@vyr/cli 0.0.1 → 0.0.2

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.
Files changed (82) hide show
  1. package/.entry/app.js +363 -363
  2. package/README.zh-CN.md +0 -33
  3. package/build/css/1111.86597cc5.css +1 -0
  4. package/build/css/2546.a9c3029e.css +1 -0
  5. package/build/css/3085.43d5665d.css +1 -0
  6. package/build/css/{2505.39376622.css → 3745.5e7a01f4.css} +1 -1
  7. package/build/css/{8093.21e188eb.css → 3864.d7e761ea.css} +1 -1
  8. package/build/css/{9157.971090af.css → 3964.4c4113a3.css} +1 -1
  9. package/build/css/login.3b035eb6.css +1 -0
  10. package/build/deps/socket.js +3 -3
  11. package/build/fonts/{iconfont.2e5056cd.woff → iconfont.892a2301.woff} +0 -0
  12. package/build/fonts/{iconfont.01dfbc15.ttf → iconfont.ba63119b.ttf} +0 -0
  13. package/build/index.html +1 -1
  14. package/build/js/1111.d7fb9219.js +1 -0
  15. package/build/js/{8743.2cffd0be.js → 1124.74dc01cf.js} +1 -1
  16. package/build/js/2546.9d7d58e4.js +1 -0
  17. package/build/js/3085.5ce399d8.js +1 -0
  18. package/build/js/3745.cd0df446.js +1 -0
  19. package/build/js/3864.d5d8003c.js +3 -0
  20. package/build/js/3964.66f0c619.js +1 -0
  21. package/build/js/{4263.870a448a.js → 4263.4fee7680.js} +1 -1
  22. package/build/js/4530.f37bf7ff.js +1 -0
  23. package/build/js/4587.04343c23.js +1 -0
  24. package/build/js/6234.efa90525.js +1 -0
  25. package/build/js/677.c536501d.js +1 -0
  26. package/build/js/6881.110a38eb.js +1 -0
  27. package/build/js/6968.d6e90089.js +1 -0
  28. package/build/js/7195.e454ee38.js +1 -0
  29. package/build/js/7692.0a1cdf62.js +1 -0
  30. package/build/js/8657.8fef2180.js +1 -0
  31. package/build/js/{1124.4cf01e6d.js → 8743.ae6b01fb.js} +1 -1
  32. package/build/js/931.8edc5ac8.js +1 -0
  33. package/build/js/index.715638f0.js +1 -0
  34. package/build/js/login.1a6bff2e.js +1 -0
  35. package/build/js/preview.6ee9a584.js +1 -0
  36. package/build/login.html +1 -1
  37. package/build/preview.html +1 -1
  38. package/pack/auto-provider-plugin/package.json +1 -8
  39. package/pack/class-wrapper-plugin/package.json +1 -8
  40. package/pack/rollup-config-plugin/package.json +1 -8
  41. package/pack/var-rename-plugin/package.json +1 -8
  42. package/package.json +2 -2
  43. package/build/css/1060.a79f9d80.css +0 -1
  44. package/build/css/1111.7f5086f2.css +0 -1
  45. package/build/css/6827.7d5b54a4.css +0 -1
  46. package/build/css/login.de13ff0c.css +0 -1
  47. package/build/js/1060.331f9a15.js +0 -1
  48. package/build/js/1111.8555bd5c.js +0 -1
  49. package/build/js/2505.b43421df.js +0 -1
  50. package/build/js/4530.60b7c78d.js +0 -1
  51. package/build/js/4587.9701b203.js +0 -1
  52. package/build/js/6234.8760a038.js +0 -1
  53. package/build/js/677.618fc137.js +0 -1
  54. package/build/js/6827.62f794a0.js +0 -1
  55. package/build/js/6881.e7455ee6.js +0 -1
  56. package/build/js/6968.07bbc3cd.js +0 -1
  57. package/build/js/7195.7a9c1589.js +0 -1
  58. package/build/js/7692.217959b6.js +0 -1
  59. package/build/js/8093.b4466960.js +0 -3
  60. package/build/js/8657.d3a8799b.js +0 -1
  61. package/build/js/9157.58a8fa2d.js +0 -1
  62. package/build/js/931.88800e05.js +0 -1
  63. package/build/js/index.b935de87.js +0 -1
  64. package/build/js/login.1488a09a.js +0 -1
  65. package/build/js/preview.6c550af7.js +0 -1
  66. /package/build/js/{1018.094a4eaf.js → 1018.841102d5.js} +0 -0
  67. /package/build/js/{1349.8c9198a0.js → 1349.8c628175.js} +0 -0
  68. /package/build/js/{1402.4e06e186.js → 1402.a2b31799.js} +0 -0
  69. /package/build/js/{150.0eb50ff3.js → 150.e0b6ce77.js} +0 -0
  70. /package/build/js/{1583.e8f36a93.js → 1583.ebe181e2.js} +0 -0
  71. /package/build/js/{1877.41a30a46.js → 1877.1ae78e83.js} +0 -0
  72. /package/build/js/{250.369da5c4.js → 250.86810c99.js} +0 -0
  73. /package/build/js/{4296.634b3fe2.js → 4296.4744698e.js} +0 -0
  74. /package/build/js/{4582.a686fadd.js → 4582.a70df995.js} +0 -0
  75. /package/build/js/{530.b4e0e136.js → 530.4b2961fe.js} +0 -0
  76. /package/build/js/{5639.7661231d.js → 5639.f2d2e21b.js} +0 -0
  77. /package/build/js/{6357.1354eb2c.js → 6357.264f8155.js} +0 -0
  78. /package/build/js/{7769.15f4d355.js → 7769.81492015.js} +0 -0
  79. /package/build/js/{8637.20577619.js → 8637.a22cc644.js} +0 -0
  80. /package/build/js/{9044.73639ece.js → 9044.70484b04.js} +0 -0
  81. /package/build/js/{9339.d75f7c2e.js → 9339.e3438ab8.js} +0 -0
  82. /package/build/js/{9620.e7e75a12.js → 9620.ee62a8bc.js} +0 -0
@@ -1 +1 @@
1
- (self["webpackChunk_vyr_cli"]=self["webpackChunk_vyr_cli"]||[]).push([[4263],{4600:function(t,e,n){"use strict";n.d(e,{_:function(){return I}});var i,s=n(50931),r=n(44943),o=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class a extends r.Ss{get graph(){return this.options.graph}get boxClassName(){return this.prefixClassName(i.classNames.box)}get $boxes(){return r.Jf.children(this.container,this.boxClassName)}get handleOptions(){return this.options}constructor(t){super(),this.options=t,this.options.model&&(this.options.collection=this.options.model.collection),this.options.collection?this.collection=this.options.collection:(this.collection=new r.pM([],{comparator:i.depthComparator}),this.options.collection=this.collection),this.boxCount=0,this.createContainer(),this.startListening()}startListening(){const t=this.graph,e=this.collection;this.delegateEvents({[`mousedown .${this.boxClassName}`]:"onSelectionBoxMouseDown",[`touchstart .${this.boxClassName}`]:"onSelectionBoxMouseDown"},!0),t.on("scale",this.onGraphTransformed,this),t.on("translate",this.onGraphTransformed,this),t.model.on("updated",this.onModelUpdated,this),e.on("added",this.onCellAdded,this),e.on("removed",this.onCellRemoved,this),e.on("reseted",this.onReseted,this),e.on("updated",this.onCollectionUpdated,this),e.on("node:change:position",this.onNodePositionChanged,this),e.on("cell:changed",this.onCellChanged,this)}stopListening(){const t=this.graph,e=this.collection;this.undelegateEvents(),t.off("scale",this.onGraphTransformed,this),t.off("translate",this.onGraphTransformed,this),t.model.off("updated",this.onModelUpdated,this),e.off("added",this.onCellAdded,this),e.off("removed",this.onCellRemoved,this),e.off("reseted",this.onReseted,this),e.off("updated",this.onCollectionUpdated,this),e.off("node:change:position",this.onNodePositionChanged,this),e.off("cell:changed",this.onCellChanged,this)}onRemove(){this.stopListening()}onGraphTransformed(){this.updateSelectionBoxes()}onCellChanged(){this.updateSelectionBoxes()}onNodePositionChanged({node:t,options:e}){const{showNodeSelectionBox:n,pointerEvents:i}=this.options,{ui:s,selection:r,translateBy:o,snapped:a}=e,l=(!0!==n||i&&"none"===this.getPointerEventsValue(i))&&!this.translating&&!r,c=s&&o&&t.id===o;if(l&&(c||a)){this.translating=!0;const n=t.position(),i=t.previous("position"),s=n.x-i.x,r=n.y-i.y;0===s&&0===r||this.translateSelectedNodes(s,r,t,e),this.translating=!1}}onModelUpdated({removed:t}){t&&t.length&&this.unselect(t)}isEmpty(){return this.length<=0}isSelected(t){return this.collection.has(t)}get length(){return this.collection.length}get cells(){return this.collection.toArray()}select(t,e={}){e.dryrun=!0;const n=this.filter(Array.isArray(t)?t:[t]);return this.collection.add(n,e),this}unselect(t,e={}){return e.dryrun=!0,this.collection.remove(Array.isArray(t)?t:[t],e),this}reset(t,e={}){if(t){if(e.batch){const n=this.filter(Array.isArray(t)?t:[t]);return this.collection.reset(n,Object.assign(Object.assign({},e),{ui:!0})),this}const n=this.cells,i=this.filter(Array.isArray(t)?t:[t]),s={},r={};n.forEach(t=>s[t.id]=t),i.forEach(t=>r[t.id]=t);const o=[],a=[];return i.forEach(t=>{s[t.id]||o.push(t)}),n.forEach(t=>{r[t.id]||a.push(t)}),a.length&&this.unselect(a,Object.assign(Object.assign({},e),{ui:!0})),o.length&&this.select(o,Object.assign(Object.assign({},e),{ui:!0})),0===a.length&&0===o.length&&this.updateContainer(),this}return this.clean(e)}clean(t={}){return this.length&&(!1===t.batch?this.unselect(this.cells,t):this.collection.reset([],Object.assign(Object.assign({},t),{ui:!0}))),this}setFilter(t){this.options.filter=t}setContent(t){this.options.content=t}startSelecting(t){let e,n;t=this.normalizeEvent(t),this.clean();const s=this.graph.container;if(null!=t.offsetX&&null!=t.offsetY&&s.contains(t.target))e=t.offsetX,n=t.offsetY;else{const i=r.Jf.offset(s),o=s.scrollLeft,a=s.scrollTop;e=t.clientX-i.left+window.pageXOffset+o,n=t.clientY-i.top+window.pageYOffset+a}r.Jf.css(this.container,{top:n,left:e,width:1,height:1}),this.setEventData(t,{action:"selecting",clientX:t.clientX,clientY:t.clientY,offsetX:e,offsetY:n,scrollerX:0,scrollerY:0,moving:!1}),this.delegateDocumentEvents(i.documentEvents,t.data)}filter(t){const e=this.options.filter;return t.filter(t=>Array.isArray(e)?e.some(e=>"string"===typeof e?t.shape===e:t.id===e.id):"function"!==typeof e||r.eY.call(e,this.graph,t))}stopSelecting(t){const e=this.graph,n=this.getEventData(t),i=n.action;switch(i){case"selecting":{let t=r.Jf.width(this.container),n=r.Jf.height(this.container);const i=r.Jf.offset(this.container),s=e.pageToLocal(i.left,i.top),o=e.transform.getScale();t/=o.sx,n/=o.sy;const a=new r.M_(s.x,s.y,t,n),l=this.getCellViewsInArea(a).map(t=>t.cell);this.reset(l,{batch:!0}),this.hideRubberband();break}case"translating":{const i=e.snapToGrid(t.clientX,t.clientY);if(!this.options.following){const t=n;this.updateSelectedNodesPosition({dx:t.clientX-t.originX,dy:t.clientY-t.originY})}this.graph.model.stopBatch("move-selection"),this.notifyBoxEvent("box:mouseup",t,i.x,i.y);break}default:this.clean();break}}onMouseUp(t){const e=this.getEventData(t).action;e&&(this.stopSelecting(t),this.undelegateDocumentEvents())}onSelectionBoxMouseDown(t){this.options.following||t.stopPropagation();const e=this.normalizeEvent(t);this.options.movable&&this.startTranslating(e);const n=this.getCellViewFromElem(e.target);this.setEventData(e,{activeView:n});const s=this.graph.snapToGrid(e.clientX,e.clientY);this.notifyBoxEvent("box:mousedown",e,s.x,s.y),this.delegateDocumentEvents(i.documentEvents,e.data)}startTranslating(t){this.graph.model.startBatch("move-selection");const e=this.graph.snapToGrid(t.clientX,t.clientY);this.setEventData(t,{action:"translating",clientX:e.x,clientY:e.y,originX:e.x,originY:e.y})}getRestrictArea(){const t=this.graph.options.translating.restrict,e="function"===typeof t?r.eY.call(t,this.graph,null):t;return"number"===typeof e?this.graph.transform.getGraphArea().inflate(e):!0===e?this.graph.transform.getGraphArea():e||null}getSelectionOffset(t,e){let n=t.x-e.clientX,i=t.y-e.clientY;const s=this.getRestrictArea();if(s){const o=this.collection.toArray(),a=r.fh.getCellsBBox(o,{deep:!0})||r.M_.create(),l=s.x-a.x,c=s.y-a.y,h=s.x+s.width-(a.x+a.width),u=s.y+s.height-(a.y+a.height);if(n<l&&(n=l),i<c&&(i=c),h<n&&(n=h),u<i&&(i=u),!this.options.following){const s=t.x-e.originX,r=t.y-e.originY;n=s<=l||s>=h?0:n,i=r<=c||r>=u?0:i}}return{dx:n,dy:i}}updateElementPosition(t,e,n){const i=r.Jf.css(t,"left"),s=r.Jf.css(t,"top"),o=i?parseFloat(i):0,a=s?parseFloat(s):0;r.Jf.css(t,"left",o+e),r.Jf.css(t,"top",a+n)}updateSelectedNodesPosition(t){const{dx:e,dy:n}=t;if(e||n)if(this.translateSelectedNodes(e,n),this.boxesUpdated)this.collection.length>1&&this.updateSelectionBoxes();else{const t=this.graph.transform.getScale();for(let i=0,s=this.$boxes,r=s.length;i<r;i+=1)this.updateElementPosition(s[i],e*t.sx,n*t.sy);this.updateElementPosition(this.selectionContainer,e*t.sx,n*t.sy)}}autoScrollGraph(t,e){const n=this.graph.getPlugin("scroller");return n?n.autoScroll(t,e):{scrollerX:0,scrollerY:0}}adjustSelection(t){const e=this.normalizeEvent(t),n=this.getEventData(e),i=n.action;switch(i){case"selecting":{const t=n;!0!==t.moving&&(r.Jf.appendTo(this.container,this.graph.container),this.showRubberband(),t.moving=!0);const{scrollerX:i,scrollerY:s}=this.autoScrollGraph(e.clientX,e.clientY);t.scrollerX+=i,t.scrollerY+=s;const o=e.clientX-t.clientX+t.scrollerX,a=e.clientY-t.clientY+t.scrollerY,l=parseInt(r.Jf.css(this.container,"left")||"0",10),c=parseInt(r.Jf.css(this.container,"top")||"0",10);r.Jf.css(this.container,{left:o<0?t.offsetX+o:l,top:a<0?t.offsetY+a:c,width:Math.abs(o),height:Math.abs(a)});break}case"translating":{const i=this.graph.snapToGrid(e.clientX,e.clientY),s=n,r=this.getSelectionOffset(i,s);this.options.following?this.updateSelectedNodesPosition(r):this.updateContainerPosition(r),r.dx&&(s.clientX=i.x),r.dy&&(s.clientY=i.y),this.notifyBoxEvent("box:mousemove",t,i.x,i.y);break}default:break}this.boxesUpdated=!1}translateSelectedNodes(t,e,n,i){const s={},r=[];if(n&&(s[n.id]=!0),this.collection.toArray().forEach(t=>{t.getDescendants({deep:!0}).forEach(t=>{s[t.id]=!0})}),i&&i.translateBy){const t=this.graph.getCellById(i.translateBy);t&&(s[t.id]=!0,t.getDescendants({deep:!0}).forEach(t=>{s[t.id]=!0}),r.push(t))}this.collection.toArray().forEach(n=>{if(!s[n.id]){const o=Object.assign(Object.assign({},i),{selection:this.cid,exclude:r});n.translate(t,e,o),this.graph.model.getConnectedEdges(n).forEach(n=>{s[n.id]||(n.translate(t,e,o),s[n.id]=!0)})}})}getCellViewsInArea(t){const e=this.graph,n={strict:this.options.strict};let i=[];return this.options.rubberNode&&(i=i.concat(e.model.getNodesInArea(t,n).map(t=>e.renderer.findViewByCell(t)).filter(t=>null!=t))),this.options.rubberEdge&&(i=i.concat(e.model.getEdgesInArea(t,n).map(t=>e.renderer.findViewByCell(t)).filter(t=>null!=t))),i}notifyBoxEvent(t,e,n,i){const s=this.getEventData(e),r=s.activeView;this.trigger(t,{e:e,view:r,x:n,y:i,cell:r.cell})}getSelectedClassName(t){return this.prefixClassName((t.isNode()?"node":"edge")+"-selected")}addCellSelectedClassName(t){const e=this.graph.renderer.findViewByCell(t);e&&e.addClass(this.getSelectedClassName(t))}removeCellUnSelectedClassName(t){const e=this.graph.renderer.findViewByCell(t);e&&e.removeClass(this.getSelectedClassName(t))}destroySelectionBox(t){this.removeCellUnSelectedClassName(t),this.canShowSelectionBox(t)&&(r.Jf.remove(this.container.querySelector(`[data-cell-id="${t.id}"]`)),0===this.$boxes.length&&this.hide(),this.boxCount=Math.max(0,this.boxCount-1))}destroyAllSelectionBoxes(t){t.forEach(t=>this.removeCellUnSelectedClassName(t)),this.hide(),r.Jf.remove(this.$boxes),this.boxCount=0}hide(){r.Jf.removeClass(this.container,this.prefixClassName(i.classNames.rubberband)),r.Jf.removeClass(this.container,this.prefixClassName(i.classNames.selected))}showRubberband(){r.Jf.addClass(this.container,this.prefixClassName(i.classNames.rubberband))}hideRubberband(){r.Jf.removeClass(this.container,this.prefixClassName(i.classNames.rubberband))}showSelected(){r.Jf.removeAttribute(this.container,"style"),r.Jf.addClass(this.container,this.prefixClassName(i.classNames.selected))}createContainer(){this.container=document.createElement("div"),r.Jf.addClass(this.container,this.prefixClassName(i.classNames.root)),this.options.className&&r.Jf.addClass(this.container,this.options.className),this.selectionContainer=document.createElement("div"),r.Jf.addClass(this.selectionContainer,this.prefixClassName(i.classNames.inner)),this.selectionContent=document.createElement("div"),r.Jf.addClass(this.selectionContent,this.prefixClassName(i.classNames.content)),r.Jf.append(this.selectionContainer,this.selectionContent),r.Jf.attr(this.selectionContainer,"data-selection-length",this.collection.length),r.Jf.prepend(this.container,this.selectionContainer)}updateContainerPosition(t){(t.dx||t.dy)&&this.updateElementPosition(this.selectionContainer,t.dx,t.dy)}updateContainer(){const t={x:1/0,y:1/0},e={x:0,y:0},n=this.collection.toArray().filter(t=>this.canShowSelectionBox(t));n.forEach(n=>{const i=this.graph.renderer.findViewByCell(n);if(i){const n=i.getBBox({useCellGeometry:!0});t.x=Math.min(t.x,n.x),t.y=Math.min(t.y,n.y),e.x=Math.max(e.x,n.x+n.width),e.y=Math.max(e.y,n.y+n.height)}}),r.Jf.css(this.selectionContainer,{position:"absolute",pointerEvents:"none",left:t.x,top:t.y,width:e.x-t.x,height:e.y-t.y}),r.Jf.attr(this.selectionContainer,"data-selection-length",this.collection.length);const i=this.options.content;if(i)if("function"===typeof i){const t=r.eY.call(i,this.graph,this,this.selectionContent);t&&(this.selectionContent.innerHTML=t)}else this.selectionContent.innerHTML=i;this.collection.length>0&&!this.container.parentNode?r.Jf.appendTo(this.container,this.graph.container):this.collection.length<=0&&this.container.parentNode&&this.container.parentNode.removeChild(this.container)}canShowSelectionBox(t){return t.isNode()&&!0===this.options.showNodeSelectionBox||t.isEdge()&&!0===this.options.showEdgeSelectionBox}getPointerEventsValue(t){return"string"===typeof t?t:t(this.cells)}createSelectionBox(t){if(this.addCellSelectedClassName(t),this.canShowSelectionBox(t)){const e=this.graph.renderer.findViewByCell(t);if(e){const n=e.getBBox({useCellGeometry:!0}),i=this.boxClassName,s=document.createElement("div"),o=this.options.pointerEvents;r.Jf.addClass(s,i),r.Jf.addClass(s,`${i}-${t.isNode()?"node":"edge"}`),r.Jf.attr(s,"data-cell-id",t.id),r.Jf.css(s,{position:"absolute",left:n.x,top:n.y,width:n.width,height:n.height,pointerEvents:o?this.getPointerEventsValue(o):"auto"}),r.Jf.appendTo(s,this.container),this.showSelected(),this.boxCount+=1}}}updateSelectionBoxes(){this.collection.length>0&&(this.boxesUpdated=!0,this.confirmUpdate())}confirmUpdate(){if(this.boxCount){this.hide();for(let t=0,e=this.$boxes,n=e.length;t<n;t+=1){const n=e[t],i=r.Jf.attr(n,"data-cell-id");r.Jf.remove(n),this.boxCount-=1;const s=this.collection.get(i);s&&this.createSelectionBox(s)}this.updateContainer()}return 0}getCellViewFromElem(t){const e=t.getAttribute("data-cell-id");if(e){const t=this.collection.get(e);if(t)return this.graph.renderer.findViewByCell(t)}return null}onCellRemoved({cell:t}){this.destroySelectionBox(t),this.updateContainer()}onReseted({previous:t,current:e}){this.destroyAllSelectionBoxes(t),e.forEach(t=>{this.listenCellRemoveEvent(t),this.createSelectionBox(t)}),this.updateContainer()}onCellAdded({cell:t}){this.listenCellRemoveEvent(t),this.createSelectionBox(t),this.updateContainer()}listenCellRemoveEvent(t){t.off("removed",this.onCellRemoved,this),t.on("removed",this.onCellRemoved,this)}onCollectionUpdated({added:t,removed:e,options:n}){t.forEach(t=>{this.trigger("cell:selected",{cell:t,options:n}),t.isNode()?this.trigger("node:selected",{cell:t,options:n,node:t}):t.isEdge()&&this.trigger("edge:selected",{cell:t,options:n,edge:t})}),e.forEach(t=>{this.trigger("cell:unselected",{cell:t,options:n}),t.isNode()?this.trigger("node:unselected",{cell:t,options:n,node:t}):t.isEdge()&&this.trigger("edge:unselected",{cell:t,options:n,edge:t})});const i={added:t,removed:e,options:n,selected:this.cells.filter(t=>!!this.graph.getCellById(t.id))};this.trigger("selection:changed",i)}dispose(){this.clean(),this.remove(),this.off()}}o([r.Ss.dispose()],a.prototype,"dispose",null),function(t){const e="widget-selection";function n(t){return t.getAncestors().length}t.classNames={root:e,inner:`${e}-inner`,box:`${e}-box`,content:`${e}-content`,rubberband:`${e}-rubberband`,selected:`${e}-selected`},t.documentEvents={mousemove:"adjustSelection",touchmove:"adjustSelection",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},t.depthComparator=n}(i||(i={}));const l=".x6-widget-selection {\n position: absolute;\n top: 0;\n left: 0;\n display: none;\n width: 0;\n height: 0;\n touch-action: none;\n}\n.x6-widget-selection-rubberband {\n display: block;\n overflow: visible;\n opacity: 0.3;\n}\n.x6-widget-selection-selected {\n display: block;\n}\n.x6-widget-selection-box {\n cursor: move;\n}\n.x6-widget-selection-inner[data-selection-length='0'],\n.x6-widget-selection-inner[data-selection-length='1'] {\n display: none;\n}\n.x6-widget-selection-content {\n position: absolute;\n top: 100%;\n right: -20px;\n left: -20px;\n margin-top: 30px;\n padding: 6px;\n line-height: 14px;\n text-align: center;\n border-radius: 6px;\n}\n.x6-widget-selection-content:empty {\n display: none;\n}\n.x6-widget-selection-rubberband {\n background-color: #3498db;\n border: 2px solid #2980b9;\n}\n.x6-widget-selection-box {\n box-sizing: content-box !important;\n margin-top: -4px;\n margin-left: -4px;\n padding-right: 4px;\n padding-bottom: 4px;\n border: 2px dashed #feb663;\n box-shadow: 2px 2px 5px #d3d3d3;\n}\n.x6-widget-selection-inner {\n box-sizing: content-box !important;\n margin-top: -8px;\n margin-left: -8px;\n padding-right: 12px;\n padding-bottom: 12px;\n border: 2px solid #feb663;\n box-shadow: 2px 2px 5px #d3d3d3;\n}\n.x6-widget-selection-content {\n color: #fff;\n font-size: 10px;\n background-color: #6a6b8a;\n}\n";r.ke.prototype.isSelectionEnabled=function(){const t=this.getPlugin("selection");return!!t&&t.isEnabled()},r.ke.prototype.enableSelection=function(){const t=this.getPlugin("selection");return t&&t.enable(),this},r.ke.prototype.disableSelection=function(){const t=this.getPlugin("selection");return t&&t.disable(),this},r.ke.prototype.toggleSelection=function(t){const e=this.getPlugin("selection");return e&&e.toggleEnabled(t),this},r.ke.prototype.isMultipleSelection=function(){const t=this.getPlugin("selection");return!!t&&t.isMultipleSelection()},r.ke.prototype.enableMultipleSelection=function(){const t=this.getPlugin("selection");return t&&t.enableMultipleSelection(),this},r.ke.prototype.disableMultipleSelection=function(){const t=this.getPlugin("selection");return t&&t.disableMultipleSelection(),this},r.ke.prototype.toggleMultipleSelection=function(t){const e=this.getPlugin("selection");return e&&e.toggleMultipleSelection(t),this},r.ke.prototype.isSelectionMovable=function(){const t=this.getPlugin("selection");return!!t&&t.isSelectionMovable()},r.ke.prototype.enableSelectionMovable=function(){const t=this.getPlugin("selection");return t&&t.enableSelectionMovable(),this},r.ke.prototype.disableSelectionMovable=function(){const t=this.getPlugin("selection");return t&&t.disableSelectionMovable(),this},r.ke.prototype.toggleSelectionMovable=function(t){const e=this.getPlugin("selection");return e&&e.toggleSelectionMovable(t),this},r.ke.prototype.isRubberbandEnabled=function(){const t=this.getPlugin("selection");return!!t&&t.isRubberbandEnabled()},r.ke.prototype.enableRubberband=function(){const t=this.getPlugin("selection");return t&&t.enableRubberband(),this},r.ke.prototype.disableRubberband=function(){const t=this.getPlugin("selection");return t&&t.disableRubberband(),this},r.ke.prototype.toggleRubberband=function(t){const e=this.getPlugin("selection");return e&&e.toggleRubberband(t),this},r.ke.prototype.isStrictRubberband=function(){const t=this.getPlugin("selection");return!!t&&t.isStrictRubberband()},r.ke.prototype.enableStrictRubberband=function(){const t=this.getPlugin("selection");return t&&t.enableStrictRubberband(),this},r.ke.prototype.disableStrictRubberband=function(){const t=this.getPlugin("selection");return t&&t.disableStrictRubberband(),this},r.ke.prototype.toggleStrictRubberband=function(t){const e=this.getPlugin("selection");return e&&e.toggleStrictRubberband(t),this},r.ke.prototype.setRubberbandModifiers=function(t){const e=this.getPlugin("selection");return e&&e.setRubberbandModifiers(t),this},r.ke.prototype.setSelectionFilter=function(t){const e=this.getPlugin("selection");return e&&e.setSelectionFilter(t),this},r.ke.prototype.setSelectionDisplayContent=function(t){const e=this.getPlugin("selection");return e&&e.setSelectionDisplayContent(t),this},r.ke.prototype.isSelectionEmpty=function(){const t=this.getPlugin("selection");return!t||t.isEmpty()},r.ke.prototype.cleanSelection=function(t){const e=this.getPlugin("selection");return e&&e.clean(t),this},r.ke.prototype.resetSelection=function(t,e){const n=this.getPlugin("selection");return n&&n.reset(t,e),this},r.ke.prototype.getSelectedCells=function(){const t=this.getPlugin("selection");return t?t.getSelectedCells():[]},r.ke.prototype.getSelectedCellCount=function(){const t=this.getPlugin("selection");return t?t.getSelectedCellCount():0},r.ke.prototype.isSelected=function(t){const e=this.getPlugin("selection");return!!e&&e.isSelected(t)},r.ke.prototype.select=function(t,e){const n=this.getPlugin("selection");return n&&n.select(t,e),this},r.ke.prototype.unselect=function(t,e){const n=this.getPlugin("selection");return n&&n.unselect(t,e),this};var c=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class h extends r.Nb{get rubberbandDisabled(){return!0!==this.options.enabled||!0!==this.options.rubberband}get disabled(){return!0!==this.options.enabled}get length(){return this.selectionImpl.length}get cells(){return this.selectionImpl.cells}constructor(t={}){super(),this.name="selection",this.movedMap=new WeakMap,this.unselectMap=new WeakMap,this.options=Object.assign(Object.assign({enabled:!0},h.defaultOptions),t),r.H.ensure(this.name,l)}init(t){this.graph=t,this.selectionImpl=new a(Object.assign(Object.assign({},this.options),{graph:t})),this.setup(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(t){return null!=t?t!==this.isEnabled()&&(t?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}isMultipleSelection(){return this.isMultiple()}enableMultipleSelection(){return this.enableMultiple(),this}disableMultipleSelection(){return this.disableMultiple(),this}toggleMultipleSelection(t){return null!=t?t!==this.isMultipleSelection()&&(t?this.enableMultipleSelection():this.disableMultipleSelection()):this.isMultipleSelection()?this.disableMultipleSelection():this.enableMultipleSelection(),this}isSelectionMovable(){return!1!==this.options.movable}enableSelectionMovable(){return this.selectionImpl.options.movable=!0,this}disableSelectionMovable(){return this.selectionImpl.options.movable=!1,this}toggleSelectionMovable(t){return null!=t?t!==this.isSelectionMovable()&&(t?this.enableSelectionMovable():this.disableSelectionMovable()):this.isSelectionMovable()?this.disableSelectionMovable():this.enableSelectionMovable(),this}isRubberbandEnabled(){return!this.rubberbandDisabled}enableRubberband(){return this.rubberbandDisabled&&(this.options.rubberband=!0),this}disableRubberband(){return this.rubberbandDisabled||(this.options.rubberband=!1),this}toggleRubberband(t){return null!=t?t!==this.isRubberbandEnabled()&&(t?this.enableRubberband():this.disableRubberband()):this.isRubberbandEnabled()?this.disableRubberband():this.enableRubberband(),this}isStrictRubberband(){return!0===this.selectionImpl.options.strict}enableStrictRubberband(){return this.selectionImpl.options.strict=!0,this}disableStrictRubberband(){return this.selectionImpl.options.strict=!1,this}toggleStrictRubberband(t){return null!=t?t!==this.isStrictRubberband()&&(t?this.enableStrictRubberband():this.disableStrictRubberband()):this.isStrictRubberband()?this.disableStrictRubberband():this.enableStrictRubberband(),this}setRubberbandModifiers(t){this.setModifiers(t)}setSelectionFilter(t){return this.setFilter(t),this}setSelectionDisplayContent(t){return this.setContent(t),this}isEmpty(){return this.length<=0}clean(t={}){return this.selectionImpl.clean(t),this}reset(t,e={}){return this.selectionImpl.reset(t?this.getCells(t):[],e),this}getSelectedCells(){return this.cells}getSelectedCellCount(){return this.length}isSelected(t){return this.selectionImpl.isSelected(t)}select(t,e={}){const n=this.getCells(t);return n.length&&(this.isMultiple()?this.selectionImpl.select(n,e):this.reset(n.slice(0,1),e)),this}unselect(t,e={}){return this.selectionImpl.unselect(this.getCells(t),e),this}setup(){this.selectionImpl.on("*",(t,e)=>{this.trigger(t,e),this.graph.trigger(t,e)})}startListening(){this.graph.on("blank:mousedown",this.onBlankMouseDown,this),this.graph.on("blank:click",this.onBlankClick,this),this.graph.on("cell:mousemove",this.onCellMouseMove,this),this.graph.on("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.on("box:mousedown",this.onBoxMouseDown,this)}stopListening(){this.graph.off("blank:mousedown",this.onBlankMouseDown,this),this.graph.off("blank:click",this.onBlankClick,this),this.graph.off("cell:mousemove",this.onCellMouseMove,this),this.graph.off("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.off("box:mousedown",this.onBoxMouseDown,this)}onBlankMouseDown({e:t}){if(!this.allowBlankMouseDown(t))return;const e=this.graph.panning.allowPanning(t,!0),n=this.graph.getPlugin("scroller"),i=n&&n.allowPanning(t,!0);(this.allowRubberband(t,!0)||this.allowRubberband(t)&&!i&&!e)&&this.startRubberband(t)}allowBlankMouseDown(t){const e=this.options.eventTypes;return(null===e||void 0===e?void 0:e.includes("leftMouseDown"))&&0===t.button||(null===e||void 0===e?void 0:e.includes("mouseWheelDown"))&&1===t.button}onBlankClick(){this.clean()}allowRubberband(t,e){return!this.rubberbandDisabled&&r.xH.isMatch(t,this.options.modifiers,e)}allowMultipleSelection(t){return this.isMultiple()&&r.xH.isMatch(t,this.options.multipleSelectionModifiers)}onCellMouseMove({cell:t}){this.movedMap.set(t,!0)}onCellMouseUp({e:t,cell:e}){const n=this.options;let i=this.disabled;!i&&this.movedMap.has(e)&&(i=!1===n.selectCellOnMoved,i||(i=!1===n.selectNodeOnMoved&&e.isNode()),i||(i=!1===n.selectEdgeOnMoved&&e.isEdge())),i||(this.allowMultipleSelection(t)?this.unselectMap.has(e)?this.unselectMap.delete(e):this.isSelected(e)?this.unselect(e):this.select(e):this.reset(e)),this.movedMap.delete(e)}onBoxMouseDown({e:t,cell:e}){this.disabled||this.allowMultipleSelection(t)&&(this.unselect(e),this.unselectMap.set(e,!0))}getCells(t){return(Array.isArray(t)?t:[t]).map(t=>"string"===typeof t?this.graph.getCellById(t):t).filter(t=>null!=t)}startRubberband(t){return this.rubberbandDisabled||this.selectionImpl.startSelecting(t),this}isMultiple(){return!1!==this.options.multiple}enableMultiple(){return this.options.multiple=!0,this}disableMultiple(){return this.options.multiple=!1,this}setModifiers(t){return this.options.modifiers=t,this}setContent(t){return this.selectionImpl.setContent(t),this}setFilter(t){return this.selectionImpl.setFilter(t),this}dispose(){this.stopListening(),this.off(),this.selectionImpl.dispose(),r.H.clean(this.name)}}c([r.Nb.dispose()],h.prototype,"dispose",null),function(t){t.defaultOptions={rubberband:!1,rubberNode:!0,rubberEdge:!1,pointerEvents:"auto",multiple:!0,multipleSelectionModifiers:["ctrl","meta"],movable:!0,strict:!1,selectCellOnMoved:!1,selectNodeOnMoved:!1,selectEdgeOnMoved:!1,following:!0,content:null,eventTypes:["leftMouseDown","mouseWheelDown"]}}(h||(h={}));const u=".x6-widget-dnd {\n position: absolute;\n top: -10000px;\n left: -10000px;\n z-index: 999999;\n display: none;\n cursor: move;\n opacity: 0.7;\n pointer-events: 'cursor';\n}\n.x6-widget-dnd.dragging {\n display: inline-block;\n}\n.x6-widget-dnd.dragging * {\n pointer-events: none !important;\n}\n.x6-widget-dnd .x6-graph {\n background: transparent;\n box-shadow: none;\n}\n";var d,g=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class p extends r.Ss{get targetScroller(){const t=this.options.target,e=t.getPlugin("scroller");return e}get targetGraph(){return this.options.target}get targetModel(){return this.targetGraph.model}get snapline(){const t=this.options.target,e=t.getPlugin("snapline");return e}constructor(t){super(),this.name="dnd",this.options=Object.assign(Object.assign({},p.defaults),t),this.init()}init(){r.H.ensure(this.name,u),this.container=document.createElement("div"),r.Jf.addClass(this.container,this.prefixClassName("widget-dnd")),this.draggingGraph=new r.ke(Object.assign(Object.assign({},this.options.delegateGraphOptions),{container:document.createElement("div"),width:1,height:1,async:!1})),r.Jf.append(this.container,this.draggingGraph.container)}start(t,e){const n=e;n.preventDefault(),this.targetModel.startBatch("dnd"),r.Jf.addClass(this.container,"dragging"),r.Jf.appendTo(this.container,this.options.draggingContainer||document.body),this.sourceNode=t,this.prepareDragging(t,n.clientX,n.clientY);const i=this.updateNodePosition(n.clientX,n.clientY);this.isSnaplineEnabled()&&(this.snapline.captureCursorOffset({e:n,node:t,cell:t,view:this.draggingView,x:i.x,y:i.y}),this.draggingNode.on("change:position",this.snap,this)),this.delegateDocumentEvents(p.documentEvents,n.data)}isSnaplineEnabled(){return this.snapline&&this.snapline.isEnabled()}prepareDragging(t,e,n){const i=this.draggingGraph,s=i.model,r=this.options.getDragNode(t,{sourceNode:t,draggingGraph:i,targetGraph:this.targetGraph});r.position(0,0);let o=5;if(this.isSnaplineEnabled()&&(o+=this.snapline.options.tolerance||0),this.isSnaplineEnabled()||this.options.scaled){const t=this.targetGraph.transform.getScale();i.scale(t.sx,t.sy),o*=Math.max(t.sx,t.sy)}else i.scale(1,1);this.clearDragging(),s.resetCells([r]);const a=i.findViewByCell(r);a.undelegateEvents(),a.cell.off("changed"),i.fitToContent({padding:o,allowNewOrigin:"any",useCellGeometry:!1});const l=a.getBBox();this.geometryBBox=a.getBBox({useCellGeometry:!0}),this.delta=this.geometryBBox.getTopLeft().diff(l.getTopLeft()),this.draggingNode=r,this.draggingView=a,this.draggingBBox=r.getBBox(),this.padding=o,this.originOffset=this.updateGraphPosition(e,n)}updateGraphPosition(t,e){const n=document.body.scrollTop||document.documentElement.scrollTop,i=document.body.scrollLeft||document.documentElement.scrollLeft,s=this.delta,o=this.geometryBBox,a=this.padding||5,l={left:t-s.x-o.width/2-a+i,top:e-s.y-o.height/2-a+n};return this.draggingGraph&&r.Jf.css(this.container,{left:`${l.left}px`,top:`${l.top}px`}),l}updateNodePosition(t,e){const n=this.targetGraph.clientToLocal(t,e),i=this.draggingBBox;return n.x-=i.width/2,n.y-=i.height/2,this.draggingNode.position(n.x,n.y),n}snap({cell:t,current:e,options:n}){const i=t;if(n.snapped){const t=this.draggingBBox;i.position(t.x+n.tx,t.y+n.ty,{silent:!0}),this.draggingView.translate(),i.position(e.x,e.y,{silent:!0}),this.snapOffset={x:n.tx,y:n.ty}}else this.snapOffset=null}onDragging(t){const e=this.draggingView;if(e){t.preventDefault();const n=this.normalizeEvent(t),i=n.clientX,s=n.clientY;this.updateGraphPosition(i,s);const r=this.updateNodePosition(i,s),o=this.targetGraph.options.embedding.enabled,a=(o||this.isSnaplineEnabled())&&this.isInsideValidArea({x:i,y:s});if(o){e.setEventData(n,{graph:this.targetGraph,candidateEmbedView:this.candidateEmbedView});const t=e.getEventData(n);a?e.processEmbedding(n,t):e.clearEmbedding(t),this.candidateEmbedView=t.candidateEmbedView}this.isSnaplineEnabled()&&(a?this.snapline.snapOnMoving({e:n,view:e,x:r.x,y:r.y}):this.snapline.hide())}}onDragEnd(t){const e=this.draggingNode;if(e){const n=this.normalizeEvent(t),i=this.draggingView,s=this.draggingBBox,o=this.snapOffset;let a=s.x,l=s.y;o&&(a+=o.x,l+=o.y),e.position(a,l,{silent:!0});const c=this.drop(e,{x:n.clientX,y:n.clientY}),h=t=>{t?(this.onDropped(e),this.targetGraph.options.embedding.enabled&&i&&(i.setEventData(n,{cell:t,graph:this.targetGraph,candidateEmbedView:this.candidateEmbedView}),i.finalizeEmbedding(n,i.getEventData(n)))):this.onDropInvalid(),this.candidateEmbedView=null,this.targetModel.stopBatch("dnd")};r.eY.isAsync(c)?(this.undelegateDocumentEvents(),c.then(h)):h(c)}}clearDragging(){this.draggingNode&&(this.sourceNode=null,this.draggingNode.remove(),this.draggingNode=null,this.draggingView=null,this.delta=null,this.padding=null,this.snapOffset=null,this.originOffset=null,this.undelegateDocumentEvents())}onDropped(t){this.draggingNode===t&&(this.clearDragging(),r.Jf.removeClass(this.container,"dragging"),r.Jf.remove(this.container))}onDropInvalid(){const t=this.draggingNode;t&&this.onDropped(t)}isInsideValidArea(t){let e,n=null;const i=this.targetGraph,s=this.targetScroller;this.options.dndContainer&&(n=this.getDropArea(this.options.dndContainer));const r=n&&n.containsPoint(t);if(s)if(s.options.autoResize)e=this.getDropArea(s.container);else{const t=this.getDropArea(s.container);e=this.getDropArea(i.container).intersectsWithRect(t)}else e=this.getDropArea(i.container);return!r&&e&&e.containsPoint(t)}getDropArea(t){const e=r.Jf.offset(t),n=document.body.scrollTop||document.documentElement.scrollTop,i=document.body.scrollLeft||document.documentElement.scrollLeft;return r.M_.create({x:e.left+parseInt(r.Jf.css(t,"border-left-width"),10)-i,y:e.top+parseInt(r.Jf.css(t,"border-top-width"),10)-n,width:t.clientWidth,height:t.clientHeight})}drop(t,e){if(this.isInsideValidArea(e)){const n=this.targetGraph,i=n.model,s=n.clientToLocal(e),o=this.sourceNode,a=this.options.getDropNode(t,{sourceNode:o,draggingNode:t,targetGraph:this.targetGraph,draggingGraph:this.draggingGraph}),l=a.getBBox();s.x+=l.x-l.width/2,s.y+=l.y-l.height/2;const c=this.snapOffset?1:n.getGridSize();a.position(r.fZ.snapToGrid(s.x,c),r.fZ.snapToGrid(s.y,c)),a.removeZIndex();const h=this.options.validateNode,u=!h||h(a,{sourceNode:o,draggingNode:t,droppingNode:a,targetGraph:n,draggingGraph:this.draggingGraph});return"boolean"===typeof u?u?(i.addCell(a,{stencil:this.cid}),a):null:r.eY.toDeferredBoolean(u).then(t=>t?(i.addCell(a,{stencil:this.cid}),a):null)}return null}onRemove(){this.draggingGraph&&(this.draggingGraph.view.remove(),this.draggingGraph.dispose())}dispose(){this.remove(),r.H.clean(this.name)}}function f(t,e={}){const n=r.Kx.isModel(t)?t:(new r.Kx).resetCells(t,{sort:!1,dryrun:!0}),i=n.getNodes(),s=e.columns||1,o=Math.ceil(i.length/s),a=e.dx||0,l=e.dy||0,c=!1!==e.center,h=!0===e.resizeToFit,u=e.marginX||0,g=e.marginY||0,p=[];let f=e.columnWidth;if("compact"===f)for(let r=0;r<s;r+=1){const t=d.getNodesInColumn(i,r,s);p.push(d.getMaxDim(t,"width")+a)}else{null!=f&&"auto"!==f||(f=d.getMaxDim(i,"width")+a);for(let t=0;t<s;t+=1)p.push(f)}const m=d.accumulate(p,u),y=[];let b=e.rowHeight;if("compact"===b)for(let r=0;r<o;r+=1){const t=d.getNodesInRow(i,r,s);y.push(d.getMaxDim(t,"height")+l)}else{null!=b&&"auto"!==b||(b=d.getMaxDim(i,"height")+l);for(let t=0;t<o;t+=1)y.push(b)}const v=d.accumulate(y,g);n.startBatch("layout"),i.forEach((t,n)=>{const i=n%s,r=Math.floor(n/s),o=p[i],u=y[r];let d=0,g=0,f=t.getSize();if(h){let n=o-2*a,i=u-2*l;const s=f.height*(f.width?n/f.width:1),r=f.width*(f.height?i/f.height:1);u<s?n=r:i=s,f={width:n,height:i},t.setSize(f,e)}c&&(d=(o-f.width)/2,g=(u-f.height)/2),t.position(m[i]+a+d,v[r]+l+g,e)}),n.stopBatch("layout")}g([r.Ss.dispose()],p.prototype,"dispose",null),function(t){t.defaults={getDragNode:t=>t.clone(),getDropNode:t=>t.clone()},t.documentEvents={mousemove:"onDragging",touchmove:"onDragging",mouseup:"onDragEnd",touchend:"onDragEnd",touchcancel:"onDragEnd"}}(p||(p={})),function(t){function e(t,e){return t.reduce((t,n)=>Math.max(null===n||void 0===n?void 0:n.getSize()[e],t),0)}function n(t,e,n){const i=[];for(let s=n*e,r=s+n;s<r;s+=1)t[s]&&i.push(t[s]);return i}function i(t,e,n){const i=[];for(let s=e,r=t.length;s<r;s+=n)t[s]&&i.push(t[s]);return i}function s(t,e){return t.reduce((t,e,n)=>(t.push(t[n]+e),t),[e||0])}t.getMaxDim=e,t.getNodesInRow=n,t.getNodesInColumn=i,t.accumulate=s}(d||(d={}));const m=".x6-widget-dnd {\n position: absolute;\n top: -10000px;\n left: -10000px;\n z-index: 999999;\n display: none;\n cursor: move;\n opacity: 0.7;\n pointer-events: 'cursor';\n}\n.x6-widget-dnd.dragging {\n display: inline-block;\n}\n.x6-widget-dnd.dragging * {\n pointer-events: none !important;\n}\n.x6-widget-dnd .x6-graph {\n background: transparent;\n box-shadow: none;\n}\n.x6-widget-stencil {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n}\n.x6-widget-stencil::after {\n position: absolute;\n top: 0;\n display: block;\n width: 100%;\n height: 20px;\n padding: 8px 0;\n line-height: 20px;\n text-align: center;\n opacity: 0;\n transition: top 0.1s linear, opacity 0.1s linear;\n content: ' ';\n pointer-events: none;\n}\n.x6-widget-stencil-content {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n height: auto;\n overflow-x: hidden;\n overflow-y: auto;\n}\n.x6-widget-stencil .x6-node [magnet]:not([magnet='passive']) {\n pointer-events: none;\n}\n.x6-widget-stencil-group {\n padding: 0;\n padding-bottom: 8px;\n overflow: hidden;\n user-select: none;\n}\n.x6-widget-stencil-group.collapsed {\n height: auto;\n padding-bottom: 0;\n}\n.x6-widget-stencil-group-title {\n position: relative;\n margin-top: 0;\n margin-bottom: 0;\n padding: 4px;\n cursor: pointer;\n}\n.x6-widget-stencil-title,\n.x6-widget-stencil-group > .x6-widget-stencil-group-title {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n user-select: none;\n}\n.x6-widget-stencil .unmatched {\n opacity: 0.3;\n}\n.x6-widget-stencil .x6-node.unmatched {\n display: none;\n}\n.x6-widget-stencil-group.unmatched {\n display: none;\n}\n.x6-widget-stencil-search-text {\n position: relative;\n z-index: 1;\n box-sizing: border-box;\n width: 100%;\n height: 30px;\n max-height: 30px;\n line-height: 30px;\n outline: 0;\n}\n.x6-widget-stencil.not-found::after {\n opacity: 1;\n content: attr(data-not-found-text);\n}\n.x6-widget-stencil.not-found.searchable::after {\n top: 30px;\n}\n.x6-widget-stencil.not-found.searchable.collapsable::after {\n top: 50px;\n}\n.x6-widget-stencil {\n color: #333;\n background: #f5f5f5;\n}\n.x6-widget-stencil-content {\n position: absolute;\n}\n.x6-widget-stencil.collapsable > .x6-widget-stencil-content {\n top: 32px;\n}\n.x6-widget-stencil.searchable > .x6-widget-stencil-content {\n top: 80px;\n}\n.x6-widget-stencil.not-found::after {\n position: absolute;\n}\n.x6-widget-stencil.not-found.searchable.collapsable::after {\n top: 80px;\n}\n.x6-widget-stencil.not-found.searchable::after {\n top: 60px;\n}\n.x6-widget-stencil-group {\n height: auto;\n margin-bottom: 1px;\n padding: 0;\n transition: none;\n}\n.x6-widget-stencil-group .x6-graph {\n background: transparent;\n box-shadow: none;\n}\n.x6-widget-stencil-group.collapsed {\n height: auto;\n max-height: 31px;\n}\n.x6-widget-stencil-title,\n.x6-widget-stencil-group > .x6-widget-stencil-group-title {\n position: relative;\n left: 0;\n box-sizing: border-box;\n width: 100%;\n height: 32px;\n padding: 0 5px 0 8px;\n color: #666;\n font-weight: 700;\n font-size: 12px;\n line-height: 32px;\n cursor: default;\n transition: all 0.3;\n}\n.x6-widget-stencil-title:hover,\n.x6-widget-stencil-group > .x6-widget-stencil-group-title:hover {\n color: #444;\n}\n.x6-widget-stencil-title {\n background: #e9e9e9;\n}\n.x6-widget-stencil-group > .x6-widget-stencil-group-title {\n background: #ededed;\n}\n.x6-widget-stencil.collapsable > .x6-widget-stencil-title,\n.x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title {\n padding-left: 32px;\n cursor: pointer;\n}\n.x6-widget-stencil.collapsable > .x6-widget-stencil-title::before,\n.x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title::before {\n position: absolute;\n top: 6px;\n left: 8px;\n display: block;\n width: 18px;\n height: 18px;\n margin: 0;\n padding: 0;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: 0 0;\n border: none;\n content: ' ';\n}\n.x6-widget-stencil.collapsable > .x6-widget-stencil-title::before,\n.x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJub256ZXJvIj48cGF0aCBkPSJNOS4zNzUuNUM0LjY4Ny41Ljg3NSA0LjMxMy44NzUgOWMwIDQuNjg4IDMuODEyIDguNSA4LjUgOC41IDQuNjg3IDAgOC41LTMuODEyIDguNS04LjUgMC00LjY4Ny0zLjgxMy04LjUtOC41LTguNXptMCAxNS44ODZDNS4zMDMgMTYuMzg2IDEuOTkgMTMuMDcyIDEuOTkgOXMzLjMxMi03LjM4NSA3LjM4NS03LjM4NVMxNi43NiA0LjkyOCAxNi43NiA5YzAgNC4wNzItMy4zMTMgNy4zODYtNy4zODUgNy4zODZ6Ii8+PHBhdGggZD0iTTEyLjc1MyA4LjQ0M0g1Ljk5N2EuNTU4LjU1OCAwIDAwMCAxLjExNmg2Ljc1NmEuNTU4LjU1OCAwIDAwMC0xLjExNnoiLz48L2c+PC9zdmc+');\n opacity: 0.4;\n transition: all 0.3s;\n}\n.x6-widget-stencil.collapsable > .x6-widget-stencil-title:hover::before,\n.x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title:hover::before {\n opacity: 0.6;\n}\n.x6-widget-stencil.collapsable.collapsed > .x6-widget-stencil-title::before,\n.x6-widget-stencil-group.collapsable.collapsed > .x6-widget-stencil-group-title::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJub256ZXJvIj48cGF0aCBkPSJNOS4zNzUuNUM0LjY4Ny41Ljg3NSA0LjMxMy44NzUgOWMwIDQuNjg4IDMuODEyIDguNSA4LjUgOC41IDQuNjg3IDAgOC41LTMuODEyIDguNS04LjUgMC00LjY4Ny0zLjgxMy04LjUtOC41LTguNXptMCAxNS44ODZDNS4zMDMgMTYuMzg2IDEuOTkgMTMuMDcyIDEuOTkgOXMzLjMxMi03LjM4NSA3LjM4NS03LjM4NVMxNi43NiA0LjkyOCAxNi43NiA5YzAgNC4wNzItMy4zMTMgNy4zODYtNy4zODUgNy4zODZ6Ii8+PHBhdGggZD0iTTEyLjc1MyA4LjQ0M0g1Ljk5N2EuNTU4LjU1OCAwIDAwMCAxLjExNmg2Ljc1NmEuNTU4LjU1OCAwIDAwMC0xLjExNnoiLz48cGF0aCBkPSJNOC44MTcgNS42MjN2Ni43NTZhLjU1OC41NTggMCAwMDEuMTE2IDBWNS42MjNhLjU1OC41NTggMCAxMC0xLjExNiAweiIvPjwvZz48L3N2Zz4=');\n opacity: 0.4;\n}\n.x6-widget-stencil.collapsable.collapsed > .x6-widget-stencil-title:hover::before,\n.x6-widget-stencil-group.collapsable.collapsed > .x6-widget-stencil-group-title:hover::before {\n opacity: 0.6;\n}\n.x6-widget-stencil input[type='search'] {\n appearance: textfield;\n}\n.x6-widget-stencil input[type='search']::-webkit-search-cancel-button,\n.x6-widget-stencil input[type='search']::-webkit-search-decoration {\n appearance: none;\n}\n.x6-widget-stencil-search-text {\n display: block;\n width: 90%;\n margin: 8px 5%;\n padding-left: 8px;\n color: #333;\n background: #fff;\n border: 1px solid #e9e9e9;\n border-radius: 12px;\n outline: 0;\n}\n.x6-widget-stencil-search-text:focus {\n outline: 0;\n}\n.x6-widget-stencil::after {\n color: #808080;\n font-weight: 600;\n font-size: 12px;\n background: 0 0;\n}\n";var y,b,v=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class x extends r.Ss{get targetScroller(){const t=this.options.target,e=t.getPlugin("scroller");return e}get targetGraph(){return this.options.target}get targetModel(){return this.targetGraph.model}constructor(t={}){super(),this.name="stencil",r.H.ensure(this.name,m),this.graphs={},this.groups={},this.options=Object.assign(Object.assign({},x.defaultOptions),t),this.init()}init(){this.dnd=new p(this.options),this.onSearch=r.eY.debounce(this.onSearch,200),this.initContainer(),this.initSearch(),this.initContent(),this.initGroups(),this.setTitle(),this.startListening()}load(t,e){return Array.isArray(t)?this.loadGroup(t,e):this.options.groups&&Object.keys(this.options.groups).forEach(e=>{t[e]&&this.loadGroup(t[e],e)}),this}unload(t,e){return Array.isArray(t)?this.loadGroup(t,e,!0):this.options.groups&&Object.keys(this.options.groups).forEach(e=>{t[e]&&this.loadGroup(t[e],e,!0)}),this}toggleGroup(t){return this.isGroupCollapsed(t)?this.expandGroup(t):this.collapseGroup(t),this}collapseGroup(t){if(this.isGroupCollapsable(t)){const e=this.groups[t];e&&!this.isGroupCollapsed(t)&&(this.trigger("group:collapse",{name:t}),r.Jf.addClass(e,"collapsed"))}return this}expandGroup(t){if(this.isGroupCollapsable(t)){const e=this.groups[t];e&&this.isGroupCollapsed(t)&&(this.trigger("group:expand",{name:t}),r.Jf.removeClass(e,"collapsed"))}return this}isGroupCollapsable(t){const e=this.groups[t];return r.Jf.hasClass(e,"collapsable")}isGroupCollapsed(t){const e=this.groups[t];return e&&r.Jf.hasClass(e,"collapsed")}collapseGroups(){return Object.keys(this.groups).forEach(t=>this.collapseGroup(t)),this}expandGroups(){return Object.keys(this.groups).forEach(t=>this.expandGroup(t)),this}resizeGroup(t,e){const n=this.graphs[t];return n&&n.resize(e.width,e.height),this}addGroup(t){const e=Array.isArray(t)?t:[t];this.options.groups?this.options.groups.push(...e):this.options.groups=e,e.forEach(t=>this.initGroup(t))}removeGroup(t){const e=Array.isArray(t)?t:[t];this.options.groups&&(this.options.groups=this.options.groups.filter(t=>!e.includes(t.name)),e.forEach(t=>{const e=this.graphs[t];this.unregisterGraphEvents(e),e.dispose(),delete this.graphs[t];const n=this.groups[t];r.Jf.remove(n),delete this.groups[t]}))}initContainer(){this.container=document.createElement("div"),r.Jf.addClass(this.container,this.prefixClassName(y.base)),r.Jf.attr(this.container,"data-not-found-text",this.options.notFoundText||"No matches found")}initContent(){this.content=document.createElement("div"),r.Jf.addClass(this.content,this.prefixClassName(y.content)),r.Jf.appendTo(this.content,this.container)}initSearch(){this.options.search&&(r.Jf.addClass(this.container,"searchable"),r.Jf.append(this.container,this.renderSearch()))}initGroup(t){const e=this.options.stencilGraphOptions||{},n=document.createElement("div");r.Jf.addClass(n,this.prefixClassName(y.group)),r.Jf.attr(n,"data-name",t.name),(null==t.collapsable&&this.options.collapsable||!1!==t.collapsable)&&r.Jf.addClass(n,"collapsable"),r.Jf.toggleClass(n,"collapsed",!0===t.collapsed);const i=document.createElement("h3");r.Jf.addClass(i,this.prefixClassName(y.groupTitle)),i.innerHTML=t.title||t.name;const s=document.createElement("div");r.Jf.addClass(s,this.prefixClassName(y.groupContent));const o=t.graphOptions,a=new r.ke(Object.assign(Object.assign(Object.assign({},e),o),{container:document.createElement("div"),model:e.model||new r.Kx,width:t.graphWidth||this.options.stencilGraphWidth,height:t.graphHeight||this.options.stencilGraphHeight,interacting:!1,preventDefaultBlankAction:!1}));this.registerGraphEvents(a),r.Jf.append(s,a.container),r.Jf.append(n,[i,s]),r.Jf.appendTo(n,this.content),this.groups[t.name]=n,this.graphs[t.name]=a}initGroups(){if(this.clearGroups(),this.setCollapsableState(),this.options.groups&&this.options.groups.length)this.options.groups.forEach(t=>{this.initGroup(t)});else{const t=this.options.stencilGraphOptions||{},e=new r.ke(Object.assign(Object.assign({},t),{container:document.createElement("div"),model:t.model||new r.Kx,width:this.options.stencilGraphWidth,height:this.options.stencilGraphHeight,interacting:!1,preventDefaultBlankAction:!1}));r.Jf.append(this.content,e.container),this.graphs[b.defaultGroupName]=e}}setCollapsableState(){if(this.options.collapsable=this.options.collapsable&&this.options.groups&&this.options.groups.some(t=>!1!==t.collapsable),this.options.collapsable){r.Jf.addClass(this.container,"collapsable");const t=this.options.groups&&this.options.groups.every(t=>t.collapsed||!1===t.collapsable);t?r.Jf.addClass(this.container,"collapsed"):r.Jf.removeClass(this.container,"collapsed")}else r.Jf.removeClass(this.container,"collapsable")}setTitle(){const t=document.createElement("div");r.Jf.addClass(t,this.prefixClassName(y.title)),t.innerHTML=this.options.title,r.Jf.appendTo(t,this.container)}renderSearch(){const t=document.createElement("div");r.Jf.addClass(t,this.prefixClassName(y.search));const e=document.createElement("input");return r.Jf.attr(e,{type:"search",placeholder:this.options.placeholder||"Search"}),r.Jf.addClass(e,this.prefixClassName(y.searchText)),r.Jf.append(t,e),t}startListening(){const t=this.prefixClassName(y.title),e=this.prefixClassName(y.searchText),n=this.prefixClassName(y.groupTitle);this.delegateEvents({[`click .${t}`]:"onTitleClick",[`touchstart .${t}`]:"onTitleClick",[`click .${n}`]:"onGroupTitleClick",[`touchstart .${n}`]:"onGroupTitleClick",[`input .${e}`]:"onSearch",[`focusin .${e}`]:"onSearchFocusIn",[`focusout .${e}`]:"onSearchFocusOut"})}stopListening(){this.undelegateEvents()}registerGraphEvents(t){t.on("cell:mousedown",this.onDragStart,this)}unregisterGraphEvents(t){t.off("cell:mousedown",this.onDragStart,this)}loadGroup(t,e,n){const i=this.getModel(e);if(i){const e=t.map(t=>r.bP.isNode(t)?t:r.bP.create(t));!0===n?i.removeCells(e):i.resetCells(e)}const s=this.getGroup(e);let o=this.options.stencilGraphHeight;s&&null!=s.graphHeight&&(o=s.graphHeight);const a=s&&s.layout||this.options.layout;if(a&&i&&r.eY.call(a,this,i,s),!o){const t=this.getGraph(e);t.fitToContent({minWidth:t.options.width,gridHeight:1,padding:s&&s.graphPadding||this.options.stencilGraphPadding||10})}return this}onDragStart(t){const{e:e,node:n}=t,i=this.getGroupByNode(n);i&&!1===i.nodeMovable||this.dnd.start(n,e)}filter(t,e){const n=Object.keys(this.graphs).reduce((n,i)=>{const s=this.graphs[i],o=i===b.defaultGroupName?null:i,a=s.model.getNodes().filter(n=>{let i=!1;i="function"===typeof e?r.eY.call(e,this,n,t,o,this):"boolean"===typeof e?e:this.isCellMatched(n,t,e,t.toLowerCase()!==t);const a=s.renderer.findViewByCell(n);return a&&r.Jf.toggleClass(a.container,"unmatched",!i),i}),l=a.length>0,c=this.options,h=new r.Kx;return h.resetCells(a),c.layout&&r.eY.call(c.layout,this,h,this.getGroup(i)),this.groups[i]&&r.Jf.toggleClass(this.groups[i],"unmatched",!l),s.fitToContent({gridWidth:1,gridHeight:1,padding:c.stencilGraphPadding||10}),n||l},!1);r.Jf.toggleClass(this.container,"not-found",!n)}isCellMatched(t,e,n,i){return!e||!n||Object.keys(n).some(s=>{if("*"===s||t.shape===s){const r=n[s];if("boolean"===typeof r)return r;const o=Array.isArray(r)?r:[r];return o.some(n=>{let s=t.getPropByPath(n);return null!=s&&(s=`${s}`,i||(s=s.toLowerCase()),s.indexOf(e)>=0)})}return!1})}onSearch(t){this.filter(t.target.value,this.options.search)}onSearchFocusIn(){r.Jf.addClass(this.container,"is-focused")}onSearchFocusOut(){r.Jf.removeClass(this.container,"is-focused")}onTitleClick(){this.options.collapsable&&(r.Jf.toggleClass(this.container,"collapsed"),r.Jf.hasClass(this.container,"collapsed")?this.collapseGroups():this.expandGroups())}onGroupTitleClick(t){const e=t.target.closest(`.${this.prefixClassName(y.group)}`);e&&this.toggleGroup(r.Jf.attr(e,"data-name")||"");const n=Object.keys(this.groups).every(t=>{const e=this.getGroup(t),n=this.groups[t];return e&&!1===e.collapsable||r.Jf.hasClass(n,"collapsed")});r.Jf.toggleClass(this.container,"collapsed",n)}getModel(t){const e=this.getGraph(t);return e?e.model:null}getGraph(t){return this.graphs[t||b.defaultGroupName]}getGroup(t){const e=this.options.groups;return null!=t&&e&&e.length?e.find(e=>e.name===t):null}getGroupByNode(t){const e=this.options.groups;return e?e.find(e=>{const n=this.getModel(e.name);return!!n&&n.has(t.id)}):null}clearGroups(){Object.keys(this.graphs).forEach(t=>{const e=this.graphs[t];this.unregisterGraphEvents(e),e.dispose()}),Object.keys(this.groups).forEach(t=>{const e=this.groups[t];r.Jf.remove(e)}),this.graphs={},this.groups={}}onRemove(){this.clearGroups(),this.dnd.remove(),this.stopListening(),this.undelegateDocumentEvents()}dispose(){this.remove(),r.H.clean(this.name)}}v([r.Ss.dispose()],x.prototype,"dispose",null),function(t){t.defaultOptions=Object.assign({stencilGraphWidth:200,stencilGraphHeight:800,title:"Stencil",collapsable:!1,placeholder:"Search",notFoundText:"No matches found",layout(t,e){const n={columnWidth:this.options.stencilGraphWidth/2-10,columns:2,rowHeight:80,resizeToFit:!1,dx:10,dy:10};f(t,Object.assign(Object.assign(Object.assign({},n),this.options.layoutOptions),e?e.layoutOptions:{}))}},p.defaults)}(x||(x={})),function(t){t.base="widget-stencil",t.title=`${t.base}-title`,t.search=`${t.base}-search`,t.searchText=`${t.search}-text`,t.content=`${t.base}-content`,t.group=`${t.base}-group`,t.groupTitle=`${t.group}-title`,t.groupContent=`${t.group}-content`}(y||(y={})),function(t){t.defaultGroupName="__default__"}(b||(b={})),r.ke.prototype.isHistoryEnabled=function(){const t=this.getPlugin("history");return!!t&&t.isEnabled()},r.ke.prototype.enableHistory=function(){const t=this.getPlugin("history");return t&&t.enable(),this},r.ke.prototype.disableHistory=function(){const t=this.getPlugin("history");return t&&t.disable(),this},r.ke.prototype.toggleHistory=function(t){const e=this.getPlugin("history");return e&&e.toggleEnabled(t),this},r.ke.prototype.undo=function(t){const e=this.getPlugin("history");return e&&e.undo(t),this},r.ke.prototype.redo=function(t){const e=this.getPlugin("history");return e&&e.redo(t),this},r.ke.prototype.undoAndCancel=function(t){const e=this.getPlugin("history");return e&&e.cancel(t),this},r.ke.prototype.canUndo=function(){const t=this.getPlugin("history");return!!t&&t.canUndo()},r.ke.prototype.canRedo=function(){const t=this.getPlugin("history");return!!t&&t.canRedo()},r.ke.prototype.cleanHistory=function(t){const e=this.getPlugin("history");return e&&e.clean(t),this},r.ke.prototype.getHistoryStackSize=function(){const t=this.getPlugin("history");return t.getSize()},r.ke.prototype.getUndoStackSize=function(){const t=this.getPlugin("history");return t.getUndoSize()},r.ke.prototype.getRedoStackSize=function(){const t=this.getPlugin("history");return t.getRedoSize()},r.ke.prototype.getUndoRemainSize=function(){const t=this.getPlugin("history");return t.getUndoRemainSize()};var w,C=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class P extends r.Nb{constructor(t={}){super(),this.name="history",this.batchCommands=null,this.batchLevel=0,this.lastBatchIndex=-1,this.freezed=!1,this.stackSize=0,this.handlers=[];const{stackSize:e=0}=t;this.stackSize=e,this.options=w.getOptions(t),this.validator=new P.Validator({history:this,cancelInvalid:this.options.cancelInvalid})}init(t){this.graph=t,this.model=this.graph.model,this.clean(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(t){return null!=t?t!==this.isEnabled()&&(t?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}undo(t={}){if(!this.disabled){const e=this.undoStack.pop();e&&(this.revertCommand(e,t),this.redoStack.push(e),this.notify("undo",e,t))}return this}redo(t={}){if(!this.disabled){const e=this.redoStack.pop();e&&(this.applyCommand(e,t),this.undoStackPush(e),this.notify("redo",e,t))}return this}cancel(t={}){if(!this.disabled){const e=this.undoStack.pop();e&&(this.revertCommand(e,t),this.redoStack=[],this.notify("cancel",e,t))}return this}getSize(){return this.stackSize}getUndoRemainSize(){const t=this.undoStack.length;return this.stackSize-t}getUndoSize(){return this.undoStack.length}getRedoSize(){return this.redoStack.length}canUndo(){return!this.disabled&&this.undoStack.length>0}canRedo(){return!this.disabled&&this.redoStack.length>0}clean(t={}){return this.undoStack=[],this.redoStack=[],this.notify("clean",null,t),this}get disabled(){return!0!==this.options.enabled}validate(t,...e){return this.validator.validate(t,...e),this}startListening(){this.model.on("batch:start",this.initBatchCommand,this),this.model.on("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&this.options.eventNames.forEach((t,e)=>{this.handlers[e]=this.addCommand.bind(this,t),this.model.on(t,this.handlers[e])}),this.validator.on("invalid",t=>this.trigger("invalid",t))}stopListening(){this.model.off("batch:start",this.initBatchCommand,this),this.model.off("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&(this.options.eventNames.forEach((t,e)=>{this.model.off(t,this.handlers[e])}),this.handlers.length=0),this.validator.off("invalid")}createCommand(t){return{batch:!!t&&t.batch,data:{}}}revertCommand(t,e){this.freezed=!0;const n=Array.isArray(t)?w.sortBatchCommands(t):[t];for(let i=n.length-1;i>=0;i-=1){const t=n[i],s=Object.assign(Object.assign({},e),r.D5.pick(t.options,this.options.revertOptionsList||[]));this.executeCommand(t,!0,s)}this.freezed=!1}applyCommand(t,e){this.freezed=!0;const n=Array.isArray(t)?w.sortBatchCommands(t):[t];for(let i=0;i<n.length;i+=1){const t=n[i],s=Object.assign(Object.assign({},e),r.D5.pick(t.options,this.options.applyOptionsList||[]));this.executeCommand(t,!1,s)}this.freezed=!1}executeCommand(t,e,n){const i=this.model,s=i.getCell(t.data.id),o=t.event;if(w.isAddEvent(o)&&e||w.isRemoveEvent(o)&&!e)s&&s.remove(n);else if(w.isAddEvent(o)&&!e||w.isRemoveEvent(o)&&e){const e=t.data;e.node?i.addNode(e.props,n):e.edge&&i.addEdge(e.props,n)}else if(w.isChangeEvent(o)){const i=t.data,r=i.key;if(r&&s){const t=e?i.prev[r]:i.next[r];if("attrs"===i.key){const s=this.ensureUndefinedAttrs(t,e?i.next[r]:i.prev[r]);s&&(n.dirty=!0)}s.prop(r,t,n)}}else{const i=this.options.executeCommand;i&&r.eY.call(i,this,t,e,n)}}addCommand(t,e){if(this.freezed||this.disabled)return;const n=e,i=n.options||{};if(i.dryrun)return;if(w.isAddEvent(t)&&this.options.ignoreAdd||w.isRemoveEvent(t)&&this.options.ignoreRemove||w.isChangeEvent(t)&&this.options.ignoreChange)return;const s=this.options.beforeAddCommand;if(null!=s&&!1===r.eY.call(s,this,t,e))return;"cell:change:*"===t&&(t=`cell:change:${n.key}`);const o=n.cell,a=r.Kx.isModel(o);let l;if(this.batchCommands){l=this.batchCommands[Math.max(this.lastBatchIndex,0)];const e=a&&!l.modelChange||l.data.id!==o.id,n=l.event!==t;if(this.lastBatchIndex>=0&&(e||n)){const e=this.batchCommands.findIndex(e=>(a&&e.modelChange||e.data.id===o.id)&&e.event===t);e<0||w.isAddEvent(t)||w.isRemoveEvent(t)?l=this.createCommand({batch:!0}):(l=this.batchCommands[e],this.batchCommands.splice(e,1)),this.batchCommands.push(l),this.lastBatchIndex=this.batchCommands.length-1}}else l=this.createCommand({batch:!1});if(w.isAddEvent(t)||w.isRemoveEvent(t)){const e=l.data;return l.event=t,l.options=i,e.id=o.id,e.props=r.D5.cloneDeep(o.toJSON()),o.isEdge()?e.edge=!0:o.isNode()&&(e.node=!0),this.push(l,i)}if(w.isChangeEvent(t)){const n=e.key,s=l.data;return l.batch&&l.event||(l.event=t,l.options=i,s.key=n,null==s.prev&&(s.prev={}),s.prev[n]=r.D5.cloneDeep(o.previous(n)),a?l.modelChange=!0:s.id=o.id),null==s.next&&(s.next={}),s.next[n]=r.D5.cloneDeep(o.prop(n)),this.push(l,i)}const c=this.options.afterAddCommand;c&&r.eY.call(c,this,t,e,l),this.push(l,i)}initBatchCommand(t){this.freezed||(this.batchCommands?this.batchLevel+=1:(this.batchCommands=[this.createCommand({batch:!0})],this.batchLevel=0,this.lastBatchIndex=-1))}storeBatchCommand(t){if(!this.freezed)if(this.batchCommands&&this.batchLevel<=0){const e=this.filterBatchCommand(this.batchCommands);e.length>0&&(this.redoStack=[],this.undoStackPush(e),this.consolidateCommands(),this.notify("add",e,t)),this.batchCommands=null,this.lastBatchIndex=-1,this.batchLevel=0}else this.batchCommands&&this.batchLevel>0&&(this.batchLevel-=1)}filterBatchCommand(t){let e=t.slice();const n=[];while(e.length>0){const t=e.shift(),i=t.event,s=t.data.id;if(null!=i&&(null!=s||t.modelChange)){if(w.isAddEvent(i)){const t=e.findIndex(t=>w.isRemoveEvent(t.event)&&t.data.id===s);if(t>=0){e=e.filter((e,n)=>t<n||e.data.id!==s);continue}}else if(w.isRemoveEvent(i)){const t=e.findIndex(t=>w.isAddEvent(t.event)&&t.data.id===s);if(t>=0){e.splice(t,1);continue}}else if(w.isChangeEvent(i)){const e=t.data;if(r.D5.isEqual(e.prev,e.next))continue}n.push(t)}}return n}notify(t,e,n){const i=null==e?null:Array.isArray(e)?e:[e];this.emit(t,{cmds:i,options:n}),this.graph.trigger(`history:${t}`,{cmds:i,options:n}),this.emit("change",{cmds:i,options:n}),this.graph.trigger("history:change",{cmds:i,options:n})}push(t,e){this.redoStack=[],t.batch?(this.lastBatchIndex=Math.max(this.lastBatchIndex,0),this.emit("batch",{cmd:t,options:e})):(this.undoStackPush(t),this.consolidateCommands(),this.notify("add",t,e))}consolidateCommands(){var t;const e=this.undoStack[this.undoStack.length-1],n=this.undoStack[this.undoStack.length-2];if(!Array.isArray(e))return;const i=new Set(e.map(t=>t.event));if(2!==i.size||!i.has("cell:change:parent")||!i.has("cell:change:children"))return;if(!e.every(t=>{var e;return t.batch&&(null===(e=t.options)||void 0===e?void 0:e.ui)}))return;if(!Array.isArray(n)||1!==n.length)return;const s=n[0];"cell:change:position"===s.event&&(null===(t=s.options)||void 0===t?void 0:t.ui)&&(n.push(...e),this.undoStack.pop())}undoStackPush(t){0!==this.stackSize?(this.undoStack.length>=this.stackSize&&this.undoStack.shift(),this.undoStack.push(t)):this.undoStack.push(t)}ensureUndefinedAttrs(t,e){let n=!1;return null!==t&&null!==e&&"object"===typeof t&&"object"===typeof e&&Object.keys(e).forEach(i=>{void 0===t[i]&&void 0!==e[i]?(t[i]=void 0,n=!0):"object"===typeof t[i]&&"object"===typeof e[i]&&(n=this.ensureUndefinedAttrs(t[i],e[i]))}),n}dispose(){this.validator.dispose(),this.clean(),this.stopListening(),this.off()}}C([r.Nb.dispose()],P.prototype,"dispose",null),function(t){class e extends r.Nb{constructor(t){super(),this.map={},this.command=t.history,this.cancelInvalid=!1!==t.cancelInvalid,this.command.on("add",this.onCommandAdded,this)}onCommandAdded({cmds:t}){return Array.isArray(t)?t.every(t=>this.isValidCommand(t)):this.isValidCommand(t)}isValidCommand(t){if(t.options&&!1===t.options.validation)return!0;const e=t.event&&this.map[t.event]||[];let n=null;return e.forEach(e=>{let i=0;const s=r=>{const o=e[i];i+=1;try{if(!o)return void(n=r);o(r,t,s)}catch(a){s(a)}};s(n)}),!n||(this.cancelInvalid&&this.command.cancel(),this.emit("invalid",{err:n}),!1)}validate(t,...e){const n=Array.isArray(t)?t:t.split(/\s+/);return e.forEach(t=>{if("function"!==typeof t)throw new Error(`${n.join(" ")} requires callback functions.`)}),n.forEach(t=>{null==this.map[t]&&(this.map[t]=[]),this.map[t].push(e)}),this}dispose(){this.command.off("add",this.onCommandAdded,this)}}C([r.Nb.dispose()],e.prototype,"dispose",null),t.Validator=e}(P||(P={})),function(t){function e(t){return"cell:added"===t}function n(t){return"cell:removed"===t}function i(t){return null!=t&&t.startsWith("cell:change:")}function s(e){const n=["cell:added","cell:removed","cell:change:*"],i=["batch:start","batch:stop"],s=e.eventNames?e.eventNames.filter(e=>!(t.isChangeEvent(e)||n.includes(e)||i.includes(e))):n;return Object.assign(Object.assign({enabled:!0},e),{eventNames:s,applyOptionsList:e.applyOptionsList||["propertyPath"],revertOptionsList:e.revertOptionsList||["propertyPath"]})}function r(e){const n=[];for(let i=0,s=e.length;i<s;i+=1){const s=e[i];let r=null;if(t.isAddEvent(s.event)){const t=s.data.id;for(let n=0;n<i;n+=1)if(e[n].data.id===t){r=n;break}}null!==r?n.splice(r,0,s):n.push(s)}return n}t.isAddEvent=e,t.isRemoveEvent=n,t.isChangeEvent=i,t.getOptions=s,t.sortBatchCommands=r}(w||(w={}));var E=n(14246),M=n(46237),O=Object.defineProperty,A=Object.defineProperties,S=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable,j=(t,e,n)=>e in t?O(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,L=(t,e)=>{for(var n in e||(e={}))T.call(e,n)&&j(t,n,e[n]);if(N)for(var n of N(e))k.call(e,n)&&j(t,n,e[n]);return t},D=(t,e)=>A(t,S(e)),B=(t,e,n)=>j(t,"symbol"!==typeof e?e+"":e,n);class I extends s.Listener{constructor(){super(),B(this,"isReadonly",!1),B(this,"connecting"),B(this,"dom",document.createElement("div")),B(this,"selection"),B(this,"stencil"),B(this,"graph"),B(this,"history"),B(this,"tool"),B(this,"selectEdge",""),B(this,"container",null),B(this,"needTriggerChange",!1),B(this,"_interacting",({cell:t})=>{const e={nodeMovable:!0};return t instanceof E.N&&(e.nodeMovable=t.isMove()),e}),B(this,"_validateMagnet",({cell:t,magnet:e})=>t instanceof E.N&&t.isCreateEdge(e)),B(this,"_createEdge",()=>new r.yp.oH({attrs:E.N.edge})),B(this,"_validateConnection",({sourceCell:t,targetCell:e,targetMagnet:n})=>!(!n||!t)&&(e instanceof E.N&&e.isConnection(n,t))),B(this,"_undo",t=>{!1!==t.ctrlKey&&!1!==["KeyZ"].includes(t.code)&&this.history.canUndo()&&this.history.undo()}),B(this,"_redo",t=>{!1!==t.ctrlKey&&!1!==["KeyY"].includes(t.code)&&this.history.canRedo()&&this.history.redo()}),B(this,"_unselectEdge",()=>{if(this.selectEdge){const t=this.graph.getCellById(this.selectEdge);t.setAttrs({line:E.N.edge.line})}this.selectEdge=""}),B(this,"_delaySelect",s.Generate.delayExecute(()=>{const t=this.selection.getSelectedCells();this.trigger("select",t)})),B(this,"_changeListener",()=>{!1!==this.needTriggerChange&&this._delayChange()}),B(this,"_delayChange",s.Generate.delayExecute(()=>{this.trigger("change",{})})),B(this,"_resize",s.Generate.delayExecute(()=>{if(!this.container)return;const t=this.container.getBoundingClientRect();this.graph.resize(t.width,t.height),this.trigger("resize",{})})),B(this,"_delete",t=>{if(!0===this.isReadonly)return;if(!1===["Delete"].includes(t.code))return;const e=this.selection.getSelectedCells();for(const n of e)this.remove(n);this.selectEdge&&this.remove(this.graph.getCellById(this.selectEdge))}),this.dom=document.createElement("div"),this.connecting={snap:!0,allowMulti:!1,allowBlank:!1,allowLoop:!1,allowNode:!1,highlight:!0,connector:"rounded",connectionPoint:"boundary",router:"manhattan",validateMagnet:this._validateMagnet,validateConnection:this._validateConnection},this.graph=new r.ke({container:this.dom,autoResize:!0,mousewheel:!0,panning:{enabled:!0},interacting:this._interacting,connecting:D(L({},this.connecting),{createEdge:this._createEdge})}),this.selection=new h({enabled:!0,multiple:!0,rubberband:!0,movable:!0,modifiers:"ctrl",showNodeSelectionBox:!0,filter(t){return t instanceof E.N}}),this.stencil=new x({target:this.graph,title:M.B.get("graphDrawer.stencil.title"),layoutOptions:{columns:1,columnWidth:200,dx:20},stencilGraphHeight:0,stencilGraphPadding:0,groups:[{name:"inspector"}]}),this.history=new P({enabled:!1}),this.graph.use(this.selection),this.graph.use(this.history),this.tool=document.createElement("div"),this.tool.style.width="240px",this.tool.style.height="100%",this.tool.style.position="absolute",this.tool.style.top="0px",this.tool.style.left="0px",this.tool.style.zIndex="999",this.tool.appendChild(this.stencil.container),this.stencil.dnd.options.dndContainer=this.tool,this.graph.on("node:added",this._changeListener),this.graph.on("node:removed",this._changeListener),this.graph.on("edge:removed",this._changeListener),this.graph.on("node:moved",this._changeListener),this.graph.on("node:selected",this._delaySelect),this.graph.on("node:unselected",this._delaySelect),this.graph.on("edge:connected",t=>{const e=t.edge.source.cell,n=t.edge.target.cell,i=this.graph.getCellById(e),s=this.graph.getCellById(n);i instanceof E.N&&s instanceof E.N&&(this.trigger("link",{source:e,target:n}),this._changeListener())}),this.graph.on("edge:mouseenter",({edge:t})=>{}),this.graph.on("edge:mouseleave",({edge:t})=>{}),this.graph.on("edge:click",({edge:t})=>{this._unselectEdge(),t.setAttrs({line:E.N.edge.highlight}),this.selectEdge=t.id}),this.graph.on("edge:removed",({edge:t})=>{t.id===this.selectEdge&&(this.selectEdge="");const e=this.graph.getCellById(t.source.cell),n=this.graph.getCellById(t.target.cell);e instanceof E.N&&n instanceof E.N&&this.trigger("unlink",{source:t.source.cell,target:t.target.cell})}),this.graph.on("blank:mouseup",()=>{this._unselectEdge()}),this.graph.on("blank:contextmenu",t=>{}),this.graph.on("cell:contextmenu",({cell:t,x:e,y:n})=>{t instanceof E.N&&t.rightClick({cell:t,x:e,y:n})}),this.graph.on("cell:click",({cell:t,x:e,y:n})=>{this._unselectEdge(),t instanceof E.N&&t.click({cell:t,x:e,y:n})}),window.addEventListener("resize",this._resize),window.addEventListener("keydown",this._delete),this.listen("dispose",()=>{window.removeEventListener("resize",this._resize),window.removeEventListener("keydown",this._delete)})}_isEdgePort(t){return!!(null==t?void 0:t.cell)}getMapper(t){return!1===this._isEdgePort(t.source)||!1===this._isEdgePort(t.target)?null:{source:t.source.cell,target:t.target.cell}}getEdgeOfMapper(t,e){const n={shape:"edge",source:{cell:t,port:"out"},target:{cell:e,port:"in"},attrs:E.N.edge};return n}setReadonly(t){this.isReadonly=t;let e="none";t?this.graph.options.interacting=!1:(this.graph.options.interacting=this._interacting,e="block"),this.tool.style.display=e}mount(t){var e;this.container=t instanceof Element?t:null!=(e=document.getElementById(t))?e:null,null!==this.container&&(this.container.appendChild(this.dom),this.container.appendChild(this.tool),this._resize(),window.addEventListener("keydown",this._redo),window.addEventListener("keydown",this._undo))}unmount(){this.container&&(window.removeEventListener("keydown",this._redo),window.removeEventListener("keydown",this._undo),this.container.removeChild(this.dom),this.container=null)}find(t){const e=this.graph.getCells();for(const n of e)if(n.id===t)return n;return null}remove(t){const e=t.parent;if(this.graph.removeCell(t),e){const t=e.getChildren();for(let e=0;e<t.length;e++){const n=t[e];n.setProp("position",{x:0,y:e*E.N.height})}}t instanceof E.N&&this.trigger("remove",t),t.dispose()}clear(){this._unselectEdge(),this.graph.resetCells([]),this.selection.clean()}dispose(){this.clear(),this.unmount()}}},10506:function(){"object"===typeof window&&window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),"undefined"!==typeof window&&function(t){t.forEach(t=>{Object.prototype.hasOwnProperty.call(t,"append")||Object.defineProperty(t,"append",{configurable:!0,enumerable:!0,writable:!0,value(...t){const e=document.createDocumentFragment();t.forEach(t=>{const n=t instanceof Node;e.appendChild(n?t:document.createTextNode(String(t)))}),this.appendChild(e)}})})}([Element.prototype,Document.prototype,DocumentFragment.prototype])},14246:function(t,e,n){"use strict";n.d(e,{N:function(){return f}});var i=n(50931),s=n(44943),r=Object.defineProperty,o=Object.defineProperties,a=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,u=(t,e,n)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,d=(t,e)=>{for(var n in e||(e={}))c.call(e,n)&&u(t,n,e[n]);if(l)for(var n of l(e))h.call(e,n)&&u(t,n,e[n]);return t},g=(t,e)=>o(t,a(e)),p=(t,e,n)=>u(t,"symbol"!==typeof e?e+"":e,n);class f extends s.yp.rw{constructor(t){var e,n,s,r,o,a;super({id:null!=(e=t.id)?e:i.Generate.uuid(),label:t.label,position:t.position}),p(this,"vMeta"),this.vMeta={drawer:t.drawer,icon:null!=(n=t.icon)?n:"",label:null!=(s=t.label)?s:"",status:null!=(r=t.status)?r:"",maxOutCount:null!=(o=t.maxOutCount)?o:1,maxInCount:null!=(a=t.maxInCount)?a:1,id:this.id},this.htmlFactory()}static instanceOf(t,e){for(const n of e)if(t instanceof n)return!0;return!1}static getPortMeta(t){return{position:t,attrs:{circle:{r:4,magnet:!0,stroke:"#31d0c6",strokeWidth:1,fill:"#fff"}}}}static formatName(t){const e=10;return!t||t.length<=e?t:t.substring(0,e)+"..."}clone(){const t=this.constructor;return new t(g(d({},this.vMeta),{id:void 0}))}htmlFactory(){if(!this.attrs)return;const t=`\n <div class="graph-service-unit">\n <i class="${this.vMeta.icon} unit-icon" ></i>\n <div class="unit-wrapper">${this.label}</div>\n <i class="graphfont graph-${this.vMeta.status} unit-icon" ></i>\n </div>\n `;this.setAttrs({html:{html:t}})}setVMeta(t){const e=Object.keys(t);for(const n of e){const e=t[n];void 0!==e&&(this.vMeta[n]=e)}this.setLabel(t.label),t.position&&this.setPosition(t.position),this.htmlFactory()}click(t){}rightClick(t){}isMove(){return!0}isCreateEdge(t){if("out"!==t.getAttribute("port-group"))return!1;const e=this.vMeta.drawer.graph.getConnectedEdges(this,{outgoing:!0});return e.length<this.vMeta.maxOutCount}isConnection(t,e){if("in"!==t.getAttribute("port-group"))return!1;const n=this.vMeta.drawer.graph.getConnectedEdges(this,{incoming:!0});return n.length<this.vMeta.maxInCount}}p(f,"width",180),p(f,"height",45),p(f,"edge",{line:{stroke:"#A2B1C3",strokeWidth:2},highlight:{stroke:"#feb663"}}),p(f,"attrs",{card:{refWidth:"100%",refHeight:"100%",fill:"transparent",rx:4,ry:4},html:{refWidth:"100%",refHeight:"100%",x:0,y:0}}),f.config({width:f.width,height:f.height,position:{x:0,y:0},attrs:{card:f.attrs.card,html:f.attrs.html},markup:[{tagName:"rect",selector:"card"},{tagName:"foreignObject",selector:"html"}],ports:{groups:{in:f.getPortMeta("left"),out:f.getPortMeta("right")},items:[{id:"in",group:"in"},{id:"out",group:"out"}]}})},44943:function(t,e,n){"use strict";n.d(e,{Nb:function(){return Hh},fh:function(){return EE},pM:function(){return kE},H:function(){return o},Jf:function(){return r},eY:function(){return s},fZ:function(){return Ab},ke:function(){return NM},Kx:function(){return LE},xH:function(){return yb},bP:function(){return AE},D5:function(){return i},M_:function(){return Tb},yp:function(){return w},Ss:function(){return Xw}});var i={};n.r(i),n.d(i,{applyMixins:function(){return Sh},clone:function(){return gh},cloneDeep:function(){return yh},createClass:function(){return Lh},defaults:function(){return wh},defaultsDeep:function(){return Ah},ensure:function(){return Dh},flatten:function(){return Gh},getBoolean:function(){return Rh},getByPath:function(){return zh},getNumber:function(){return Ih},getValue:function(){return Bh},has:function(){return ri},inherit:function(){return Th},isEmpty:function(){return Ml},isEqual:function(){return vl},isMaliciousProp:function(){return Vh},isObject:function(){return M},isPlainObject:function(){return fr},merge:function(){return jo},pick:function(){return ns},setByPath:function(){return $h},unsetByPath:function(){return Fh}});var s={};n.r(s),n.d(s,{apply:function(){return Ct},call:function(){return Pt},debounce:function(){return bt},isAsync:function(){return Mt},isAsyncLike:function(){return Et},throttle:function(){return wt},toAsyncBoolean:function(){return Ot},toDeferredBoolean:function(){return At}});var r={};n.r(r),n.d(r,{CASE_SENSITIVE_ATTR:function(){return xm},Event:function(){return ib},EventHook:function(){return Zy},EventObject:function(){return eb},KAPPA:function(){return fy},MouseWheelHandle:function(){return ob},addClass:function(){return Hf},after:function(){return fm},append:function(){return dm},appendTo:function(){return mm},attr:function(){return Mm},before:function(){return pm},breakText:function(){return py},children:function(){return vm},circleToPathData:function(){return Py},clearSelection:function(){return Jm},computeStyle:function(){return Xm},computeStyleInt:function(){return Ym},contains:function(){return cm},createElement:function(){return Qf},createElementNS:function(){return tm},createSVGMatrix:function(){return Dy},createSVGPoint:function(){return Ly},createSVGTransform:function(){return By},createSlicePathData:function(){return Ny},createSvgDocument:function(){return nm},createSvgElement:function(){return em},css:function(){return Km},data:function(){return ny},decomposeMatrix:function(){return $y},ellipseToPathData:function(){return Ey},empty:function(){return um},ensureId:function(){return Xf},find:function(){return om},findOne:function(){return am},findParentByClass:function(){return lm},getAttribute:function(){return wm},getClass:function(){return Gf},getComputedStyle:function(){return Hm},getData:function(){return ty},getPointsFromSvgElement:function(){return Cy},getTransformToElement:function(){return Wy},getTransformToParentElement:function(){return Xy},getVendorPrefixedName:function(){return Gm},hasClass:function(){return _f},hasScrollbars:function(){return Um},height:function(){return cb},index:function(){return rm},isCSSVariable:function(){return Wm},isElement:function(){return ym},isHTMLElement:function(){return bm},isSVGGraphicsElement:function(){return Yf},kebablizeAttrs:function(){return Am},lineToPathData:function(){return by},matrixToRotation:function(){return Gy},matrixToScale:function(){return Fy},matrixToTransformString:function(){return Ry},matrixToTranslation:function(){return _y},measureText:function(){return dy},mergeAttrs:function(){return Nm},ns:function(){return Zf},offset:function(){return ab},parseTransformString:function(){return Vy},parseXML:function(){return im},polygonToPathData:function(){return vy},polylineToPathData:function(){return xy},position:function(){return hb},prepend:function(){return gm},prop:function(){return sy},qualifyAttr:function(){return Om},rectToPathData:function(){return Oy},rectangleToPathData:function(){return My},remove:function(){return hm},removeAttribute:function(){return Cm},removeClass:function(){return Uf},rotate:function(){return Jy},sample:function(){return yy},scale:function(){return qy},setAttribute:function(){return Pm},setAttributes:function(){return Em},setData:function(){return ey},setPrefixedStyle:function(){return _m},splitTextByLength:function(){return gy},styleToObject:function(){return Sm},svgVersion:function(){return Kf},tagName:function(){return sm},text:function(){return uy},toLocalPoint:function(){return Yy},toPath:function(){return Ay},toPathData:function(){return Sy},toggleClass:function(){return Jf},transform:function(){return Hy},transformStringToMatrix:function(){return Iy},translate:function(){return Uy},uniqueId:function(){return Wf},width:function(){return lb}});var o={};n.r(o),n.d(o,{clean:function(){return Mb},ensure:function(){return Eb}});var a={};n.r(a),n.d(a,{dot:function(){return nv},doubleMesh:function(){return rv},fixedDot:function(){return iv},mesh:function(){return sv}});var l={};n.r(l),n.d(l,{flipX:function(){return av},flipXY:function(){return cv},flipY:function(){return lv},watermark:function(){return hv}});var c={};n.r(c),n.d(c,{blur:function(){return yv},brightness:function(){return Ev},contrast:function(){return Mv},dropShadow:function(){return bv},grayScale:function(){return vv},highlight:function(){return mv},hueRotate:function(){return Cv},invert:function(){return Pv},outline:function(){return fv},saturate:function(){return wv},sepia:function(){return xv}});var h={};n.r(h),n.d(h,{async:function(){return Dx},block:function(){return Ex},circle:function(){return Ix},circlePlus:function(){return Rx},classic:function(){return Mx},cross:function(){return jx},diamond:function(){return Sx},ellipse:function(){return zx},path:function(){return Tx}});var u={};n.r(u),n.d(u,{annotations:function(){return hx},atConnectionLength:function(){return tw},atConnectionLengthIgnoreGradient:function(){return Zx},atConnectionLengthKeepGradient:function(){return Yx},atConnectionRatio:function(){return ew},atConnectionRatioIgnoreGradient:function(){return Qx},atConnectionRatioKeepGradient:function(){return Kx},connection:function(){return Xx},displayEmpty:function(){return dx},eol:function(){return ux},fill:function(){return nx},filter:function(){return xx},html:function(){return vx},lineHeight:function(){return ax},port:function(){return wx},ref:function(){return Av},refCx:function(){return Vv},refCy:function(){return zv},refD:function(){return Uv},refDKeepOffset:function(){return Fv},refDResetOffset:function(){return $v},refDx:function(){return Tv},refDy:function(){return kv},refHeight:function(){return Lv},refHeight2:function(){return Yv},refPoints:function(){return Jv},refPointsKeepOffset:function(){return _v},refPointsResetOffset:function(){return Gv},refR:function(){return Hv},refRCircumscribed:function(){return Rv},refRInscribed:function(){return Iv},refRx:function(){return Dv},refRy:function(){return Bv},refWidth:function(){return jv},refWidth2:function(){return Xv},refX:function(){return Sv},refX2:function(){return qv},refY:function(){return Nv},refY2:function(){return Wv},resetOffset:function(){return mx},sourceMarker:function(){return _x},stroke:function(){return ix},style:function(){return bx},targetMarker:function(){return Hx},text:function(){return sx},textPath:function(){return cx},textVerticalAnchor:function(){return lx},textWrap:function(){return rx},title:function(){return gx},vertexMarker:function(){return Ux},xAlign:function(){return px},yAlign:function(){return fx}});var d={};n.r(d),n.d(d,{className:function(){return ow},opacity:function(){return lw},stroke:function(){return uw}});var g={};n.r(g),n.d(g,{absolute:function(){return mw},bottom:function(){return Mw},ellipse:function(){return yw},ellipseSpread:function(){return bw},left:function(){return Cw},line:function(){return ww},right:function(){return Pw},top:function(){return Ew}});var p={};n.r(p),n.d(p,{bottom:function(){return Dw},inside:function(){return Rw},insideOriented:function(){return Vw},left:function(){return kw},manual:function(){return Tw},outside:function(){return Bw},outsideOriented:function(){return Iw},radial:function(){return Gw},radialOriented:function(){return _w},right:function(){return jw},top:function(){return Lw}});var f={};n.r(f),n.d(f,{noop:function(){return iC},pinAbsolute:function(){return cC},pinRelative:function(){return lC}});var m={};n.r(m),n.d(m,{bottom:function(){return kC},bottomLeft:function(){return IC},bottomRight:function(){return RC},center:function(){return NC},left:function(){return jC},midSide:function(){return UC},nodeCenter:function(){return _C},orth:function(){return GC},right:function(){return LC},top:function(){return TC},topLeft:function(){return DC},topRight:function(){return BC}});var y={};n.r(y),n.d(y,{closest:function(){return YC},length:function(){return WC},orth:function(){return KC},ratio:function(){return qC}});var b={};n.r(b),n.d(b,{anchor:function(){return aP},bbox:function(){return iP},boundary:function(){return rP},rect:function(){return sP}});var v={};n.r(v),n.d(v,{er:function(){return YP},loop:function(){return KP},manhattan:function(){return qP},metro:function(){return XP},normal:function(){return cP},oneSide:function(){return hP},orth:function(){return yP}});var x={};n.r(x),n.d(x,{jumpover:function(){return mE},loop:function(){return eE},normal:function(){return tE},rounded:function(){return nE},smooth:function(){return iE}});var w={};n.r(w),n.d(w,{oH:function(){return FE},rw:function(){return $E}});n(10506);class C{get disposed(){return!0===this._disposed}dispose(){this._disposed=!0}}(function(t){function e(){return(t,e,n)=>{const i=n.value,s=t.__proto__;n.value=function(...t){this.disposed||(i.call(this,...t),s.dispose.call(this))}}}t.dispose=e})(C||(C={}));class P{constructor(){this.isDisposed=!1,this.items=new Set}get disposed(){return this.isDisposed}dispose(){this.isDisposed||(this.isDisposed=!0,this.items.forEach(t=>{t.dispose()}),this.items.clear())}contains(t){return this.items.has(t)}add(t){this.items.add(t)}remove(t){this.items.delete(t)}clear(){this.items.clear()}}function E(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}(function(t){function e(e){const n=new t;return e.forEach(t=>{n.add(t)}),n}t.from=e})(P||(P={}));var M=E,O="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,A=O,S="object"==typeof self&&self&&self.Object===Object&&self,N=A||S||Function("return this")(),T=N,k=function(){return T.Date.now()},j=k,L=/\s/;function D(t){var e=t.length;while(e--&&L.test(t.charAt(e)));return e}var B=D,I=/^\s+/;function R(t){return t?t.slice(0,B(t)+1).replace(I,""):t}var V=R,z=T.Symbol,$=z,F=Object.prototype,G=F.hasOwnProperty,_=F.toString,H=$?$.toStringTag:void 0;function U(t){var e=G.call(t,H),n=t[H];try{t[H]=void 0;var i=!0}catch(r){}var s=_.call(t);return i&&(e?t[H]=n:delete t[H]),s}var J=U,q=Object.prototype,W=q.toString;function X(t){return W.call(t)}var Y=X,Z="[object Null]",K="[object Undefined]",Q=$?$.toStringTag:void 0;function tt(t){return null==t?void 0===t?K:Z:Q&&Q in Object(t)?J(t):Y(t)}var et=tt;function nt(t){return null!=t&&"object"==typeof t}var it=nt,st="[object Symbol]";function rt(t){return"symbol"==typeof t||it(t)&&et(t)==st}var ot=rt,at=NaN,lt=/^[-+]0x[0-9a-f]+$/i,ct=/^0b[01]+$/i,ht=/^0o[0-7]+$/i,ut=parseInt;function dt(t){if("number"==typeof t)return t;if(ot(t))return at;if(M(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=M(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=V(t);var n=ct.test(t);return n||ht.test(t)?ut(t.slice(2),n?2:8):lt.test(t)?at:+t}var gt=dt,pt="Expected a function",ft=Math.max,mt=Math.min;function yt(t,e,n){var i,s,r,o,a,l,c=0,h=!1,u=!1,d=!0;if("function"!=typeof t)throw new TypeError(pt);function g(e){var n=i,r=s;return i=s=void 0,c=e,o=t.apply(r,n),o}function p(t){return c=t,a=setTimeout(y,e),h?g(t):o}function f(t){var n=t-l,i=t-c,s=e-n;return u?mt(s,r-i):s}function m(t){var n=t-l,i=t-c;return void 0===l||n>=e||n<0||u&&i>=r}function y(){var t=j();if(m(t))return b(t);a=setTimeout(y,f(t))}function b(t){return a=void 0,d&&i?g(t):(i=s=void 0,o)}function v(){void 0!==a&&clearTimeout(a),c=0,i=l=s=a=void 0}function x(){return void 0===a?o:b(j())}function w(){var t=j(),n=m(t);if(i=arguments,s=this,l=t,n){if(void 0===a)return p(l);if(u)return clearTimeout(a),a=setTimeout(y,e),g(l)}return void 0===a&&(a=setTimeout(y,e)),o}return e=gt(e)||0,M(n)&&(h=!!n.leading,u="maxWait"in n,r=u?ft(gt(n.maxWait)||0,e):r,d="trailing"in n?!!n.trailing:d),w.cancel=v,w.flush=x,w}var bt=yt,vt="Expected a function";function xt(t,e,n){var i=!0,s=!0;if("function"!=typeof t)throw new TypeError(vt);return M(n)&&(i="leading"in n?!!n.leading:i,s="trailing"in n?!!n.trailing:s),bt(t,e,{leading:i,maxWait:e,trailing:s})}var wt=xt;function Ct(t,e,n){if(n)switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2]);case 4:return t.call(e,n[0],n[1],n[2],n[3]);case 5:return t.call(e,n[0],n[1],n[2],n[3],n[4]);case 6:return t.call(e,n[0],n[1],n[2],n[3],n[4],n[5]);default:return t.apply(e,n)}return t.call(e)}function Pt(t,e,...n){return Ct(t,e,n)}function Et(t){return"object"===typeof t&&t.then&&"function"===typeof t.then}function Mt(t){return null!=t&&(t instanceof Promise||Et(t))}function Ot(...t){const e=[];t.forEach(t=>{Array.isArray(t)?e.push(...t):e.push(t)});const n=e.some(t=>Mt(t));if(n){const t=e.map(t=>Mt(t)?t:Promise.resolve(!1!==t));return Promise.all(t).then(t=>t.reduce((t,e)=>!1!==e&&t,!0))}return e.every(t=>!1!==t)}function At(...t){const e=Ot(t);return"boolean"===typeof e?Promise.resolve(e):e}function St(t,e){const n=[];for(let i=0;i<t.length;i+=2){const s=t[i],r=t[i+1],o=Array.isArray(e)?e:[e],a=Ct(s,r,o);n.push(a)}return Ot(n)}class Nt{constructor(){this.listeners={}}on(t,e,n){if(null==e)return this;this.listeners[t]||(this.listeners[t]=[]);const i=this.listeners[t];return i.push(e,n),this}once(t,e,n){const i=(...s)=>(this.off(t,i),St([e,n],s));return this.on(t,i,this)}off(t,e,n){if(!(t||e||n))return this.listeners={},this;const i=this.listeners,s=t?[t]:Object.keys(i);return s.forEach(t=>{const s=i[t];if(s)if(e||n)for(let i=s.length-2;i>=0;i-=2)e&&s[i]!==e||n&&s[i+1]!==n||s.splice(i,2);else delete i[t]}),this}trigger(t,...e){let n=!0;if("*"!==t){const i=this.listeners[t];null!=i&&(n=St([...i],e))}const i=this.listeners["*"];return null!=i?Ot([n,St([...i],[t,...e])]):n}emit(t,...e){return this.trigger(t,...e)}}var Tt=Object.prototype,kt=Tt.hasOwnProperty;function jt(t,e){return null!=t&&kt.call(t,e)}var Lt=jt,Dt=Array.isArray,Bt=Dt,It=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Rt=/^\w*$/;function Vt(t,e){if(Bt(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ot(t))||(Rt.test(t)||!It.test(t)||null!=e&&t in Object(e))}var zt=Vt,$t="[object AsyncFunction]",Ft="[object Function]",Gt="[object GeneratorFunction]",_t="[object Proxy]";function Ht(t){if(!M(t))return!1;var e=et(t);return e==Ft||e==Gt||e==$t||e==_t}var Ut=Ht,Jt=T["__core-js_shared__"],qt=Jt,Wt=function(){var t=/[^.]+$/.exec(qt&&qt.keys&&qt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Xt(t){return!!Wt&&Wt in t}var Yt=Xt,Zt=Function.prototype,Kt=Zt.toString;function Qt(t){if(null!=t){try{return Kt.call(t)}catch(e){}try{return t+""}catch(e){}}return""}var te=Qt,ee=/[\\^$.*+?()[\]{}|]/g,ne=/^\[object .+?Constructor\]$/,ie=Function.prototype,se=Object.prototype,re=ie.toString,oe=se.hasOwnProperty,ae=RegExp("^"+re.call(oe).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function le(t){if(!M(t)||Yt(t))return!1;var e=Ut(t)?ae:ne;return e.test(te(t))}var ce=le;function he(t,e){return null==t?void 0:t[e]}var ue=he;function de(t,e){var n=ue(t,e);return ce(n)?n:void 0}var ge=de,pe=ge(Object,"create"),fe=pe;function me(){this.__data__=fe?fe(null):{},this.size=0}var ye=me;function be(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ve=be,xe="__lodash_hash_undefined__",we=Object.prototype,Ce=we.hasOwnProperty;function Pe(t){var e=this.__data__;if(fe){var n=e[t];return n===xe?void 0:n}return Ce.call(e,t)?e[t]:void 0}var Ee=Pe,Me=Object.prototype,Oe=Me.hasOwnProperty;function Ae(t){var e=this.__data__;return fe?void 0!==e[t]:Oe.call(e,t)}var Se=Ae,Ne="__lodash_hash_undefined__";function Te(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=fe&&void 0===e?Ne:e,this}var ke=Te;function je(t){var e=-1,n=null==t?0:t.length;this.clear();while(++e<n){var i=t[e];this.set(i[0],i[1])}}je.prototype.clear=ye,je.prototype["delete"]=ve,je.prototype.get=Ee,je.prototype.has=Se,je.prototype.set=ke;var Le=je;function De(){this.__data__=[],this.size=0}var Be=De;function Ie(t,e){return t===e||t!==t&&e!==e}var Re=Ie;function Ve(t,e){var n=t.length;while(n--)if(Re(t[n][0],e))return n;return-1}var ze=Ve,$e=Array.prototype,Fe=$e.splice;function Ge(t){var e=this.__data__,n=ze(e,t);if(n<0)return!1;var i=e.length-1;return n==i?e.pop():Fe.call(e,n,1),--this.size,!0}var _e=Ge;function He(t){var e=this.__data__,n=ze(e,t);return n<0?void 0:e[n][1]}var Ue=He;function Je(t){return ze(this.__data__,t)>-1}var qe=Je;function We(t,e){var n=this.__data__,i=ze(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}var Xe=We;function Ye(t){var e=-1,n=null==t?0:t.length;this.clear();while(++e<n){var i=t[e];this.set(i[0],i[1])}}Ye.prototype.clear=Be,Ye.prototype["delete"]=_e,Ye.prototype.get=Ue,Ye.prototype.has=qe,Ye.prototype.set=Xe;var Ze=Ye,Ke=ge(T,"Map"),Qe=Ke;function tn(){this.size=0,this.__data__={hash:new Le,map:new(Qe||Ze),string:new Le}}var en=tn;function nn(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}var sn=nn;function rn(t,e){var n=t.__data__;return sn(e)?n["string"==typeof e?"string":"hash"]:n.map}var on=rn;function an(t){var e=on(this,t)["delete"](t);return this.size-=e?1:0,e}var ln=an;function cn(t){return on(this,t).get(t)}var hn=cn;function un(t){return on(this,t).has(t)}var dn=un;function gn(t,e){var n=on(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}var pn=gn;function fn(t){var e=-1,n=null==t?0:t.length;this.clear();while(++e<n){var i=t[e];this.set(i[0],i[1])}}fn.prototype.clear=en,fn.prototype["delete"]=ln,fn.prototype.get=hn,fn.prototype.has=dn,fn.prototype.set=pn;var mn=fn,yn="Expected a function";function bn(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(yn);var n=function(){var i=arguments,s=e?e.apply(this,i):i[0],r=n.cache;if(r.has(s))return r.get(s);var o=t.apply(this,i);return n.cache=r.set(s,o)||r,o};return n.cache=new(bn.Cache||mn),n}bn.Cache=mn;var vn=bn,xn=500;function wn(t){var e=vn(t,function(t){return n.size===xn&&n.clear(),t}),n=e.cache;return e}var Cn=wn,Pn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,En=/\\(\\)?/g,Mn=Cn(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Pn,function(t,n,i,s){e.push(i?s.replace(En,"$1"):n||t)}),e}),On=Mn;function An(t,e){var n=-1,i=null==t?0:t.length,s=Array(i);while(++n<i)s[n]=e(t[n],n,t);return s}var Sn=An,Nn=1/0,Tn=$?$.prototype:void 0,kn=Tn?Tn.toString:void 0;function jn(t){if("string"==typeof t)return t;if(Bt(t))return Sn(t,jn)+"";if(ot(t))return kn?kn.call(t):"";var e=t+"";return"0"==e&&1/t==-Nn?"-0":e}var Ln=jn;function Dn(t){return null==t?"":Ln(t)}var Bn=Dn;function In(t,e){return Bt(t)?t:zt(t,e)?[t]:On(Bn(t))}var Rn=In,Vn="[object Arguments]";function zn(t){return it(t)&&et(t)==Vn}var $n=zn,Fn=Object.prototype,Gn=Fn.hasOwnProperty,_n=Fn.propertyIsEnumerable,Hn=$n(function(){return arguments}())?$n:function(t){return it(t)&&Gn.call(t,"callee")&&!_n.call(t,"callee")},Un=Hn,Jn=9007199254740991,qn=/^(?:0|[1-9]\d*)$/;function Wn(t,e){var n=typeof t;return e=null==e?Jn:e,!!e&&("number"==n||"symbol"!=n&&qn.test(t))&&t>-1&&t%1==0&&t<e}var Xn=Wn,Yn=9007199254740991;function Zn(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Yn}var Kn=Zn,Qn=1/0;function ti(t){if("string"==typeof t||ot(t))return t;var e=t+"";return"0"==e&&1/t==-Qn?"-0":e}var ei=ti;function ni(t,e,n){e=Rn(e,t);var i=-1,s=e.length,r=!1;while(++i<s){var o=ei(e[i]);if(!(r=null!=t&&n(t,o)))break;t=t[o]}return r||++i!=s?r:(s=null==t?0:t.length,!!s&&Kn(s)&&Xn(o,s)&&(Bt(t)||Un(t)))}var ii=ni;function si(t,e){return null!=t&&ii(t,e,Lt)}var ri=si;function oi(t,e){e=Rn(e,t);var n=0,i=e.length;while(null!=t&&n<i)t=t[ei(e[n++])];return n&&n==i?t:void 0}var ai=oi,li=function(){try{var t=ge(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),ci=li;function hi(t,e,n){"__proto__"==e&&ci?ci(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var ui=hi,di=Object.prototype,gi=di.hasOwnProperty;function pi(t,e,n){var i=t[e];gi.call(t,e)&&Re(i,n)&&(void 0!==n||e in t)||ui(t,e,n)}var fi=pi;function mi(t,e,n,i){if(!M(t))return t;e=Rn(e,t);var s=-1,r=e.length,o=r-1,a=t;while(null!=a&&++s<r){var l=ei(e[s]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(s!=o){var h=a[l];c=i?i(h,l,a):void 0,void 0===c&&(c=M(h)?h:Xn(e[s+1])?[]:{})}fi(a,l,c),a=a[l]}return t}var yi=mi;function bi(t,e,n){var i=-1,s=e.length,r={};while(++i<s){var o=e[i],a=ai(t,o);n(a,o)&&yi(r,Rn(o,t),a)}return r}var vi=bi;function xi(t,e){return null!=t&&e in Object(t)}var wi=xi;function Ci(t,e){return null!=t&&ii(t,e,wi)}var Pi=Ci;function Ei(t,e){return vi(t,e,function(e,n){return Pi(t,n)})}var Mi=Ei;function Oi(t,e){var n=-1,i=e.length,s=t.length;while(++n<i)t[s+n]=e[n];return t}var Ai=Oi,Si=$?$.isConcatSpreadable:void 0;function Ni(t){return Bt(t)||Un(t)||!!(Si&&t&&t[Si])}var Ti=Ni;function ki(t,e,n,i,s){var r=-1,o=t.length;n||(n=Ti),s||(s=[]);while(++r<o){var a=t[r];e>0&&n(a)?e>1?ki(a,e-1,n,i,s):Ai(s,a):i||(s[s.length]=a)}return s}var ji=ki;function Li(t){var e=null==t?0:t.length;return e?ji(t,1):[]}var Di=Li;function Bi(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var Ii=Bi,Ri=Math.max;function Vi(t,e,n){return e=Ri(void 0===e?t.length-1:e,0),function(){var i=arguments,s=-1,r=Ri(i.length-e,0),o=Array(r);while(++s<r)o[s]=i[e+s];s=-1;var a=Array(e+1);while(++s<e)a[s]=i[s];return a[e]=n(o),Ii(t,this,a)}}var zi=Vi;function $i(t){return function(){return t}}var Fi=$i;function Gi(t){return t}var _i=Gi,Hi=ci?function(t,e){return ci(t,"toString",{configurable:!0,enumerable:!1,value:Fi(e),writable:!0})}:_i,Ui=Hi,Ji=800,qi=16,Wi=Date.now;function Xi(t){var e=0,n=0;return function(){var i=Wi(),s=qi-(i-n);if(n=i,s>0){if(++e>=Ji)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Yi=Xi,Zi=Yi(Ui),Ki=Zi;function Qi(t){return Ki(zi(t,void 0,Di),t+"")}var ts=Qi,es=ts(function(t,e){return null==t?{}:Mi(t,e)}),ns=es;function is(){this.__data__=new Ze,this.size=0}var ss=is;function rs(t){var e=this.__data__,n=e["delete"](t);return this.size=e.size,n}var os=rs;function as(t){return this.__data__.get(t)}var ls=as;function cs(t){return this.__data__.has(t)}var hs=cs,us=200;function ds(t,e){var n=this.__data__;if(n instanceof Ze){var i=n.__data__;if(!Qe||i.length<us-1)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new mn(i)}return n.set(t,e),this.size=n.size,this}var gs=ds;function ps(t){var e=this.__data__=new Ze(t);this.size=e.size}ps.prototype.clear=ss,ps.prototype["delete"]=os,ps.prototype.get=ls,ps.prototype.has=hs,ps.prototype.set=gs;var fs=ps;function ms(t,e,n){(void 0!==n&&!Re(t[e],n)||void 0===n&&!(e in t))&&ui(t,e,n)}var ys=ms;function bs(t){return function(e,n,i){var s=-1,r=Object(e),o=i(e),a=o.length;while(a--){var l=o[t?a:++s];if(!1===n(r[l],l,r))break}return e}}var vs=bs,xs=vs(),ws=xs,Cs="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ps=Cs&&"object"==typeof module&&module&&!module.nodeType&&module,Es=Ps&&Ps.exports===Cs,Ms=Es?T.Buffer:void 0,Os=Ms?Ms.allocUnsafe:void 0;function As(t,e){if(e)return t.slice();var n=t.length,i=Os?Os(n):new t.constructor(n);return t.copy(i),i}var Ss=As,Ns=T.Uint8Array,Ts=Ns;function ks(t){var e=new t.constructor(t.byteLength);return new Ts(e).set(new Ts(t)),e}var js=ks;function Ls(t,e){var n=e?js(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var Ds=Ls;function Bs(t,e){var n=-1,i=t.length;e||(e=Array(i));while(++n<i)e[n]=t[n];return e}var Is=Bs,Rs=Object.create,Vs=function(){function t(){}return function(e){if(!M(e))return{};if(Rs)return Rs(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}(),zs=Vs;function $s(t,e){return function(n){return t(e(n))}}var Fs=$s,Gs=Fs(Object.getPrototypeOf,Object),_s=Gs,Hs=Object.prototype;function Us(t){var e=t&&t.constructor,n="function"==typeof e&&e.prototype||Hs;return t===n}var Js=Us;function qs(t){return"function"!=typeof t.constructor||Js(t)?{}:zs(_s(t))}var Ws=qs;function Xs(t){return null!=t&&Kn(t.length)&&!Ut(t)}var Ys=Xs;function Zs(t){return it(t)&&Ys(t)}var Ks=Zs;function Qs(){return!1}var tr=Qs,er="object"==typeof exports&&exports&&!exports.nodeType&&exports,nr=er&&"object"==typeof module&&module&&!module.nodeType&&module,ir=nr&&nr.exports===er,sr=ir?T.Buffer:void 0,rr=sr?sr.isBuffer:void 0,or=rr||tr,ar=or,lr="[object Object]",cr=Function.prototype,hr=Object.prototype,ur=cr.toString,dr=hr.hasOwnProperty,gr=ur.call(Object);function pr(t){if(!it(t)||et(t)!=lr)return!1;var e=_s(t);if(null===e)return!0;var n=dr.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&ur.call(n)==gr}var fr=pr,mr="[object Arguments]",yr="[object Array]",br="[object Boolean]",vr="[object Date]",xr="[object Error]",wr="[object Function]",Cr="[object Map]",Pr="[object Number]",Er="[object Object]",Mr="[object RegExp]",Or="[object Set]",Ar="[object String]",Sr="[object WeakMap]",Nr="[object ArrayBuffer]",Tr="[object DataView]",kr="[object Float32Array]",jr="[object Float64Array]",Lr="[object Int8Array]",Dr="[object Int16Array]",Br="[object Int32Array]",Ir="[object Uint8Array]",Rr="[object Uint8ClampedArray]",Vr="[object Uint16Array]",zr="[object Uint32Array]",$r={};function Fr(t){return it(t)&&Kn(t.length)&&!!$r[et(t)]}$r[kr]=$r[jr]=$r[Lr]=$r[Dr]=$r[Br]=$r[Ir]=$r[Rr]=$r[Vr]=$r[zr]=!0,$r[mr]=$r[yr]=$r[Nr]=$r[br]=$r[Tr]=$r[vr]=$r[xr]=$r[wr]=$r[Cr]=$r[Pr]=$r[Er]=$r[Mr]=$r[Or]=$r[Ar]=$r[Sr]=!1;var Gr=Fr;function _r(t){return function(e){return t(e)}}var Hr=_r,Ur="object"==typeof exports&&exports&&!exports.nodeType&&exports,Jr=Ur&&"object"==typeof module&&module&&!module.nodeType&&module,qr=Jr&&Jr.exports===Ur,Wr=qr&&A.process,Xr=function(){try{var t=Jr&&Jr.require&&Jr.require("util").types;return t||Wr&&Wr.binding&&Wr.binding("util")}catch(e){}}(),Yr=Xr,Zr=Yr&&Yr.isTypedArray,Kr=Zr?Hr(Zr):Gr,Qr=Kr;function to(t,e){if(("constructor"!==e||"function"!==typeof t[e])&&"__proto__"!=e)return t[e]}var eo=to;function no(t,e,n,i){var s=!n;n||(n={});var r=-1,o=e.length;while(++r<o){var a=e[r],l=i?i(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),s?ui(n,a,l):fi(n,a,l)}return n}var io=no;function so(t,e){var n=-1,i=Array(t);while(++n<t)i[n]=e(n);return i}var ro=so,oo=Object.prototype,ao=oo.hasOwnProperty;function lo(t,e){var n=Bt(t),i=!n&&Un(t),s=!n&&!i&&ar(t),r=!n&&!i&&!s&&Qr(t),o=n||i||s||r,a=o?ro(t.length,String):[],l=a.length;for(var c in t)!e&&!ao.call(t,c)||o&&("length"==c||s&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Xn(c,l))||a.push(c);return a}var co=lo;function ho(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}var uo=ho,go=Object.prototype,po=go.hasOwnProperty;function fo(t){if(!M(t))return uo(t);var e=Js(t),n=[];for(var i in t)("constructor"!=i||!e&&po.call(t,i))&&n.push(i);return n}var mo=fo;function yo(t){return Ys(t)?co(t,!0):mo(t)}var bo=yo;function vo(t){return io(t,bo(t))}var xo=vo;function wo(t,e,n,i,s,r,o){var a=eo(t,n),l=eo(e,n),c=o.get(l);if(c)ys(t,n,c);else{var h=r?r(a,l,n+"",t,e,o):void 0,u=void 0===h;if(u){var d=Bt(l),g=!d&&ar(l),p=!d&&!g&&Qr(l);h=l,d||g||p?Bt(a)?h=a:Ks(a)?h=Is(a):g?(u=!1,h=Ss(l,!0)):p?(u=!1,h=Ds(l,!0)):h=[]:fr(l)||Un(l)?(h=a,Un(a)?h=xo(a):M(a)&&!Ut(a)||(h=Ws(l))):u=!1}u&&(o.set(l,h),s(h,l,i,r,o),o["delete"](l)),ys(t,n,h)}}var Co=wo;function Po(t,e,n,i,s){t!==e&&ws(e,function(r,o){if(s||(s=new fs),M(r))Co(t,e,o,n,Po,i,s);else{var a=i?i(eo(t,o),r,o+"",t,e,s):void 0;void 0===a&&(a=r),ys(t,o,a)}},bo)}var Eo=Po;function Mo(t,e){return Ki(zi(t,e,_i),t+"")}var Oo=Mo;function Ao(t,e,n){if(!M(n))return!1;var i=typeof e;return!!("number"==i?Ys(n)&&Xn(e,n.length):"string"==i&&e in n)&&Re(n[e],t)}var So=Ao;function No(t){return Oo(function(e,n){var i=-1,s=n.length,r=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;r=t.length>3&&"function"==typeof r?(s--,r):void 0,o&&So(n[0],n[1],o)&&(r=s<3?void 0:r,s=1),e=Object(e);while(++i<s){var a=n[i];a&&t(e,a,i,r)}return e})}var To=No,ko=To(function(t,e,n){Eo(t,e,n)}),jo=ko,Lo="__lodash_hash_undefined__";function Do(t){return this.__data__.set(t,Lo),this}var Bo=Do;function Io(t){return this.__data__.has(t)}var Ro=Io;function Vo(t){var e=-1,n=null==t?0:t.length;this.__data__=new mn;while(++e<n)this.add(t[e])}Vo.prototype.add=Vo.prototype.push=Bo,Vo.prototype.has=Ro;var zo=Vo;function $o(t,e){var n=-1,i=null==t?0:t.length;while(++n<i)if(e(t[n],n,t))return!0;return!1}var Fo=$o;function Go(t,e){return t.has(e)}var _o=Go,Ho=1,Uo=2;function Jo(t,e,n,i,s,r){var o=n&Ho,a=t.length,l=e.length;if(a!=l&&!(o&&l>a))return!1;var c=r.get(t),h=r.get(e);if(c&&h)return c==e&&h==t;var u=-1,d=!0,g=n&Uo?new zo:void 0;r.set(t,e),r.set(e,t);while(++u<a){var p=t[u],f=e[u];if(i)var m=o?i(f,p,u,e,t,r):i(p,f,u,t,e,r);if(void 0!==m){if(m)continue;d=!1;break}if(g){if(!Fo(e,function(t,e){if(!_o(g,e)&&(p===t||s(p,t,n,i,r)))return g.push(e)})){d=!1;break}}else if(p!==f&&!s(p,f,n,i,r)){d=!1;break}}return r["delete"](t),r["delete"](e),d}var qo=Jo;function Wo(t){var e=-1,n=Array(t.size);return t.forEach(function(t,i){n[++e]=[i,t]}),n}var Xo=Wo;function Yo(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var Zo=Yo,Ko=1,Qo=2,ta="[object Boolean]",ea="[object Date]",na="[object Error]",ia="[object Map]",sa="[object Number]",ra="[object RegExp]",oa="[object Set]",aa="[object String]",la="[object Symbol]",ca="[object ArrayBuffer]",ha="[object DataView]",ua=$?$.prototype:void 0,da=ua?ua.valueOf:void 0;function ga(t,e,n,i,s,r,o){switch(n){case ha:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case ca:return!(t.byteLength!=e.byteLength||!r(new Ts(t),new Ts(e)));case ta:case ea:case sa:return Re(+t,+e);case na:return t.name==e.name&&t.message==e.message;case ra:case aa:return t==e+"";case ia:var a=Xo;case oa:var l=i&Ko;if(a||(a=Zo),t.size!=e.size&&!l)return!1;var c=o.get(t);if(c)return c==e;i|=Qo,o.set(t,e);var h=qo(a(t),a(e),i,s,r,o);return o["delete"](t),h;case la:if(da)return da.call(t)==da.call(e)}return!1}var pa=ga;function fa(t,e,n){var i=e(t);return Bt(t)?i:Ai(i,n(t))}var ma=fa;function ya(t,e){var n=-1,i=null==t?0:t.length,s=0,r=[];while(++n<i){var o=t[n];e(o,n,t)&&(r[s++]=o)}return r}var ba=ya;function va(){return[]}var xa=va,wa=Object.prototype,Ca=wa.propertyIsEnumerable,Pa=Object.getOwnPropertySymbols,Ea=Pa?function(t){return null==t?[]:(t=Object(t),ba(Pa(t),function(e){return Ca.call(t,e)}))}:xa,Ma=Ea,Oa=Fs(Object.keys,Object),Aa=Oa,Sa=Object.prototype,Na=Sa.hasOwnProperty;function Ta(t){if(!Js(t))return Aa(t);var e=[];for(var n in Object(t))Na.call(t,n)&&"constructor"!=n&&e.push(n);return e}var ka=Ta;function ja(t){return Ys(t)?co(t):ka(t)}var La=ja;function Da(t){return ma(t,La,Ma)}var Ba=Da,Ia=1,Ra=Object.prototype,Va=Ra.hasOwnProperty;function za(t,e,n,i,s,r){var o=n&Ia,a=Ba(t),l=a.length,c=Ba(e),h=c.length;if(l!=h&&!o)return!1;var u=l;while(u--){var d=a[u];if(!(o?d in e:Va.call(e,d)))return!1}var g=r.get(t),p=r.get(e);if(g&&p)return g==e&&p==t;var f=!0;r.set(t,e),r.set(e,t);var m=o;while(++u<l){d=a[u];var y=t[d],b=e[d];if(i)var v=o?i(b,y,d,e,t,r):i(y,b,d,t,e,r);if(!(void 0===v?y===b||s(y,b,n,i,r):v)){f=!1;break}m||(m="constructor"==d)}if(f&&!m){var x=t.constructor,w=e.constructor;x==w||!("constructor"in t)||!("constructor"in e)||"function"==typeof x&&x instanceof x&&"function"==typeof w&&w instanceof w||(f=!1)}return r["delete"](t),r["delete"](e),f}var $a=za,Fa=ge(T,"DataView"),Ga=Fa,_a=ge(T,"Promise"),Ha=_a,Ua=ge(T,"Set"),Ja=Ua,qa=ge(T,"WeakMap"),Wa=qa,Xa="[object Map]",Ya="[object Object]",Za="[object Promise]",Ka="[object Set]",Qa="[object WeakMap]",tl="[object DataView]",el=te(Ga),nl=te(Qe),il=te(Ha),sl=te(Ja),rl=te(Wa),ol=et;(Ga&&ol(new Ga(new ArrayBuffer(1)))!=tl||Qe&&ol(new Qe)!=Xa||Ha&&ol(Ha.resolve())!=Za||Ja&&ol(new Ja)!=Ka||Wa&&ol(new Wa)!=Qa)&&(ol=function(t){var e=et(t),n=e==Ya?t.constructor:void 0,i=n?te(n):"";if(i)switch(i){case el:return tl;case nl:return Xa;case il:return Za;case sl:return Ka;case rl:return Qa}return e});var al=ol,ll=1,cl="[object Arguments]",hl="[object Array]",ul="[object Object]",dl=Object.prototype,gl=dl.hasOwnProperty;function pl(t,e,n,i,s,r){var o=Bt(t),a=Bt(e),l=o?hl:al(t),c=a?hl:al(e);l=l==cl?ul:l,c=c==cl?ul:c;var h=l==ul,u=c==ul,d=l==c;if(d&&ar(t)){if(!ar(e))return!1;o=!0,h=!1}if(d&&!h)return r||(r=new fs),o||Qr(t)?qo(t,e,n,i,s,r):pa(t,e,l,n,i,s,r);if(!(n&ll)){var g=h&&gl.call(t,"__wrapped__"),p=u&&gl.call(e,"__wrapped__");if(g||p){var f=g?t.value():t,m=p?e.value():e;return r||(r=new fs),s(f,m,n,i,r)}}return!!d&&(r||(r=new fs),$a(t,e,n,i,s,r))}var fl=pl;function ml(t,e,n,i,s){return t===e||(null==t||null==e||!it(t)&&!it(e)?t!==t&&e!==e:fl(t,e,n,i,ml,s))}var yl=ml;function bl(t,e){return yl(t,e)}var vl=bl,xl="[object Map]",wl="[object Set]",Cl=Object.prototype,Pl=Cl.hasOwnProperty;function El(t){if(null==t)return!0;if(Ys(t)&&(Bt(t)||"string"==typeof t||"function"==typeof t.splice||ar(t)||Qr(t)||Un(t)))return!t.length;var e=al(t);if(e==xl||e==wl)return!t.size;if(Js(t))return!ka(t).length;for(var n in t)if(Pl.call(t,n))return!1;return!0}var Ml=El;function Ol(t,e){var n=-1,i=null==t?0:t.length;while(++n<i)if(!1===e(t[n],n,t))break;return t}var Al=Ol;function Sl(t,e){return t&&io(e,La(e),t)}var Nl=Sl;function Tl(t,e){return t&&io(e,bo(e),t)}var kl=Tl;function jl(t,e){return io(t,Ma(t),e)}var Ll=jl,Dl=Object.getOwnPropertySymbols,Bl=Dl?function(t){var e=[];while(t)Ai(e,Ma(t)),t=_s(t);return e}:xa,Il=Bl;function Rl(t,e){return io(t,Il(t),e)}var Vl=Rl;function zl(t){return ma(t,bo,Il)}var $l=zl,Fl=Object.prototype,Gl=Fl.hasOwnProperty;function _l(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Gl.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var Hl=_l;function Ul(t,e){var n=e?js(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}var Jl=Ul,ql=/\w*$/;function Wl(t){var e=new t.constructor(t.source,ql.exec(t));return e.lastIndex=t.lastIndex,e}var Xl=Wl,Yl=$?$.prototype:void 0,Zl=Yl?Yl.valueOf:void 0;function Kl(t){return Zl?Object(Zl.call(t)):{}}var Ql=Kl,tc="[object Boolean]",ec="[object Date]",nc="[object Map]",ic="[object Number]",sc="[object RegExp]",rc="[object Set]",oc="[object String]",ac="[object Symbol]",lc="[object ArrayBuffer]",cc="[object DataView]",hc="[object Float32Array]",uc="[object Float64Array]",dc="[object Int8Array]",gc="[object Int16Array]",pc="[object Int32Array]",fc="[object Uint8Array]",mc="[object Uint8ClampedArray]",yc="[object Uint16Array]",bc="[object Uint32Array]";function vc(t,e,n){var i=t.constructor;switch(e){case lc:return js(t);case tc:case ec:return new i(+t);case cc:return Jl(t,n);case hc:case uc:case dc:case gc:case pc:case fc:case mc:case yc:case bc:return Ds(t,n);case nc:return new i;case ic:case oc:return new i(t);case sc:return Xl(t);case rc:return new i;case ac:return Ql(t)}}var xc=vc,wc="[object Map]";function Cc(t){return it(t)&&al(t)==wc}var Pc=Cc,Ec=Yr&&Yr.isMap,Mc=Ec?Hr(Ec):Pc,Oc=Mc,Ac="[object Set]";function Sc(t){return it(t)&&al(t)==Ac}var Nc=Sc,Tc=Yr&&Yr.isSet,kc=Tc?Hr(Tc):Nc,jc=kc,Lc=1,Dc=2,Bc=4,Ic="[object Arguments]",Rc="[object Array]",Vc="[object Boolean]",zc="[object Date]",$c="[object Error]",Fc="[object Function]",Gc="[object GeneratorFunction]",_c="[object Map]",Hc="[object Number]",Uc="[object Object]",Jc="[object RegExp]",qc="[object Set]",Wc="[object String]",Xc="[object Symbol]",Yc="[object WeakMap]",Zc="[object ArrayBuffer]",Kc="[object DataView]",Qc="[object Float32Array]",th="[object Float64Array]",eh="[object Int8Array]",nh="[object Int16Array]",ih="[object Int32Array]",sh="[object Uint8Array]",rh="[object Uint8ClampedArray]",oh="[object Uint16Array]",ah="[object Uint32Array]",lh={};function ch(t,e,n,i,s,r){var o,a=e&Lc,l=e&Dc,c=e&Bc;if(n&&(o=s?n(t,i,s,r):n(t)),void 0!==o)return o;if(!M(t))return t;var h=Bt(t);if(h){if(o=Hl(t),!a)return Is(t,o)}else{var u=al(t),d=u==Fc||u==Gc;if(ar(t))return Ss(t,a);if(u==Uc||u==Ic||d&&!s){if(o=l||d?{}:Ws(t),!a)return l?Vl(t,kl(o,t)):Ll(t,Nl(o,t))}else{if(!lh[u])return s?t:{};o=xc(t,u,a)}}r||(r=new fs);var g=r.get(t);if(g)return g;r.set(t,o),jc(t)?t.forEach(function(i){o.add(ch(i,e,n,i,t,r))}):Oc(t)&&t.forEach(function(i,s){o.set(s,ch(i,e,n,s,t,r))});var p=c?l?$l:Ba:l?bo:La,f=h?void 0:p(t);return Al(f||t,function(i,s){f&&(s=i,i=t[s]),fi(o,s,ch(i,e,n,s,t,r))}),o}lh[Ic]=lh[Rc]=lh[Zc]=lh[Kc]=lh[Vc]=lh[zc]=lh[Qc]=lh[th]=lh[eh]=lh[nh]=lh[ih]=lh[_c]=lh[Hc]=lh[Uc]=lh[Jc]=lh[qc]=lh[Wc]=lh[Xc]=lh[sh]=lh[rh]=lh[oh]=lh[ah]=!0,lh[$c]=lh[Fc]=lh[Yc]=!1;var hh=ch,uh=4;function dh(t){return hh(t,uh)}var gh=dh,ph=1,fh=4;function mh(t){return hh(t,ph|fh)}var yh=mh,bh=Object.prototype,vh=bh.hasOwnProperty,xh=Oo(function(t,e){t=Object(t);var n=-1,i=e.length,s=i>2?e[2]:void 0;s&&So(e[0],e[1],s)&&(i=1);while(++n<i){var r=e[n],o=bo(r),a=-1,l=o.length;while(++a<l){var c=o[a],h=t[c];(void 0===h||Re(h,bh[c])&&!vh.call(t,c))&&(t[c]=r[c])}}return t}),wh=xh;function Ch(t,e,n,i,s,r){return M(t)&&M(e)&&(r.set(e,t),Eo(t,e,void 0,Ch,r),r["delete"](e)),t}var Ph=Ch,Eh=To(function(t,e,n,i){Eo(t,e,n,i)}),Mh=Eh,Oh=Oo(function(t){return t.push(void 0,Ph),Ii(Mh,void 0,t)}),Ah=Oh;function Sh(t,...e){e.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(n=>{"constructor"!==n&&Object.defineProperty(t.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n))})})}const Nh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])};function Th(t,e){function n(){this.constructor=t}Nh(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}class kh{}const jh=/^\s*class\s+/.test(`${kh}`)||/^\s*class\s*\{/.test(`${class{}}`);function Lh(t,e){let n;return jh?n=class extends e{}:(n=function(){return e.apply(this,arguments)},Th(n,e)),Object.defineProperty(n,"name",{value:t}),n}function Dh(t,e){return null!=t?t:e}function Bh(t,e,n){const i=null!=t?t[e]:null;return void 0!==n?Dh(i,n):i}function Ih(t,e,n){let i=null!=t?t[e]:null;return null==i?n:(i=+i,Number.isNaN(i)||!Number.isFinite(i)?n:i)}function Rh(t,e,n){const i=null!=t?t[e]:null;return null==i?n:!!i}function Vh(t){return"__proto__"===t}function zh(t,e,n="/"){let i;const s=Array.isArray(e)?e:e.split(n);if(s.length){i=t;while(s.length){const t=s.shift();if(Object(i)!==i||!t||!(t in i))return;i=i[t]}}return i}function $h(t,e,n,i="/"){const s=Array.isArray(e)?e:e.split(i),r=s.pop();if(r&&!Vh(r)){let e=t;s.forEach(t=>{Vh(t)||(null==e[t]&&(e[t]={}),e=e[t])}),e[r]=n}return t}function Fh(t,e,n="/"){const i=Array.isArray(e)?e.slice():e.split(n),s=i.pop();if(s)if(i.length>0){const e=zh(t,i);e&&delete e[s]}else delete t[s];return t}function Gh(t,e="/",n){const i={};Object.keys(t).forEach(s=>{const r=t[s];let o="object"===typeof r||Array.isArray(r);if(o&&n&&n(r)&&(o=!1),o){const t=Gh(r,e,n);Object.keys(t).forEach(n=>{i[s+e+n]=t[n]})}else i[s]=r});for(const s in t)Object.prototype.hasOwnProperty.call(t,s);return i}var _h=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class Hh extends Nt{dispose(){this.off()}}_h([C.dispose()],Hh.prototype,"dispose",null),function(t){t.dispose=C.dispose}(Hh||(Hh={})),Sh(Hh,C);function Uh(t,e,n,i){var s=t.length,r=n+(i?1:-1);while(i?r--:++r<s)if(e(t[r],r,t))return r;return-1}var Jh=Uh;function qh(t){return t!==t}var Wh=qh;function Xh(t,e,n){var i=n-1,s=t.length;while(++i<s)if(t[i]===e)return i;return-1}var Yh=Xh;function Zh(t,e,n){return e===e?Yh(t,e,n):Jh(t,Wh,n)}var Kh=Zh;function Qh(t,e){var n=null==t?0:t.length;return!!n&&Kh(t,e,0)>-1}var tu=Qh;function eu(t,e,n){var i=-1,s=null==t?0:t.length;while(++i<s)if(n(e,t[i]))return!0;return!1}var nu=eu;function iu(){}var su=iu,ru=1/0,ou=Ja&&1/Zo(new Ja([,-0]))[1]==ru?function(t){return new Ja(t)}:su,au=ou,lu=200;function cu(t,e,n){var i=-1,s=tu,r=t.length,o=!0,a=[],l=a;if(n)o=!1,s=nu;else if(r>=lu){var c=e?null:au(t);if(c)return Zo(c);o=!1,s=_o,l=new zo}else l=e?[]:a;t:while(++i<r){var h=t[i],u=e?e(h):h;if(h=n||0!==h?h:0,o&&u===u){var d=l.length;while(d--)if(l[d]===u)continue t;e&&l.push(u),a.push(h)}else s(l,u,n)||(l!==a&&l.push(u),a.push(h))}return a}var hu=cu;function uu(t){return t&&t.length?hu(t):[]}var du=uu,gu=Oo(function(t){return hu(ji(t,1,Ks,!0))}),pu=gu,fu=4294967295,mu=fu-1,yu=Math.floor,bu=Math.min;function vu(t,e,n,i){var s=0,r=null==t?0:t.length;if(0===r)return 0;e=n(e);var o=e!==e,a=null===e,l=ot(e),c=void 0===e;while(s<r){var h=yu((s+r)/2),u=n(t[h]),d=void 0!==u,g=null===u,p=u===u,f=ot(u);if(o)var m=i||p;else m=c?p&&(i||d):a?p&&d&&(i||!g):l?p&&d&&!g&&(i||!f):!g&&!f&&(i?u<=e:u<e);m?s=h+1:r=h}return bu(r,mu)}var xu=vu,wu=4294967295,Cu=wu>>>1;function Pu(t,e,n){var i=0,s=null==t?i:t.length;if("number"==typeof e&&e===e&&s<=Cu){while(i<s){var r=i+s>>>1,o=t[r];null!==o&&!ot(o)&&(n?o<=e:o<e)?i=r+1:s=r}return s}return xu(t,e,_i,n)}var Eu=Pu;function Mu(t,e){return Eu(t,e)}var Ou=Mu,Au=1,Su=2;function Nu(t,e,n,i){var s=n.length,r=s,o=!i;if(null==t)return!r;t=Object(t);while(s--){var a=n[s];if(o&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}while(++s<r){a=n[s];var l=a[0],c=t[l],h=a[1];if(o&&a[2]){if(void 0===c&&!(l in t))return!1}else{var u=new fs;if(i)var d=i(c,h,l,t,e,u);if(!(void 0===d?yl(h,c,Au|Su,i,u):d))return!1}}return!0}var Tu=Nu;function ku(t){return t===t&&!M(t)}var ju=ku;function Lu(t){var e=La(t),n=e.length;while(n--){var i=e[n],s=t[i];e[n]=[i,s,ju(s)]}return e}var Du=Lu;function Bu(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}var Iu=Bu;function Ru(t){var e=Du(t);return 1==e.length&&e[0][2]?Iu(e[0][0],e[0][1]):function(n){return n===t||Tu(n,t,e)}}var Vu=Ru;function zu(t,e,n){var i=null==t?void 0:ai(t,e);return void 0===i?n:i}var $u=zu,Fu=1,Gu=2;function _u(t,e){return zt(t)&&ju(e)?Iu(ei(t),e):function(n){var i=$u(n,t);return void 0===i&&i===e?Pi(n,t):yl(e,i,Fu|Gu)}}var Hu=_u;function Uu(t){return function(e){return null==e?void 0:e[t]}}var Ju=Uu;function qu(t){return function(e){return ai(e,t)}}var Wu=qu;function Xu(t){return zt(t)?Ju(ei(t)):Wu(t)}var Yu=Xu;function Zu(t){return"function"==typeof t?t:null==t?_i:"object"==typeof t?Bt(t)?Hu(t[0],t[1]):Vu(t):Yu(t)}var Ku=Zu;function Qu(t,e,n){return xu(t,e,Ku(n,2))}var td=Qu;function ed(t,e){return t&&ws(t,e,La)}var nd=ed;function id(t,e){return function(n,i){if(null==n)return n;if(!Ys(n))return t(n,i);var s=n.length,r=e?s:-1,o=Object(n);while(e?r--:++r<s)if(!1===i(o[r],r,o))break;return n}}var sd=id,rd=sd(nd),od=rd;function ad(t,e){var n=-1,i=Ys(t)?Array(t.length):[];return od(t,function(t,s,r){i[++n]=e(t,s,r)}),i}var ld=ad;function cd(t,e){var n=t.length;t.sort(e);while(n--)t[n]=t[n].value;return t}var hd=cd;function ud(t,e){if(t!==e){var n=void 0!==t,i=null===t,s=t===t,r=ot(t),o=void 0!==e,a=null===e,l=e===e,c=ot(e);if(!a&&!c&&!r&&t>e||r&&o&&l&&!a&&!c||i&&o&&l||!n&&l||!s)return 1;if(!i&&!r&&!c&&t<e||c&&n&&s&&!i&&!r||a&&n&&s||!o&&s||!l)return-1}return 0}var dd=ud;function gd(t,e,n){var i=-1,s=t.criteria,r=e.criteria,o=s.length,a=n.length;while(++i<o){var l=dd(s[i],r[i]);if(l){if(i>=a)return l;var c=n[i];return l*("desc"==c?-1:1)}}return t.index-e.index}var pd=gd;function fd(t,e,n){e=e.length?Sn(e,function(t){return Bt(t)?function(e){return ai(e,1===t.length?t[0]:t)}:t}):[_i];var i=-1;e=Sn(e,Hr(Ku));var s=ld(t,function(t,n,s){var r=Sn(e,function(e){return e(t)});return{criteria:r,index:++i,value:t}});return hd(s,function(t,e){return pd(t,e,n)})}var md=fd,yd=Oo(function(t,e){if(null==t)return[];var n=e.length;return n>1&&So(t,e[0],e[1])?e=[]:n>2&&So(e[0],e[1],e[2])&&(e=[e[0]]),md(t,ji(e,1),[])}),bd=yd;function vd(t,e,n,i){var s=-1,r=null==t?0:t.length;while(++s<r){var o=t[s];e(i,o,n(o),t)}return i}var xd=vd;function wd(t,e,n,i){return od(t,function(t,s,r){e(i,t,n(t),r)}),i}var Cd=wd;function Pd(t,e){return function(n,i){var s=Bt(n)?xd:Cd,r=e?e():{};return s(n,t,Ku(i,2),r)}}var Ed=Pd,Md=Object.prototype,Od=Md.hasOwnProperty,Ad=Ed(function(t,e,n){Od.call(t,n)?t[n].push(e):ui(t,n,[e])}),Sd=Ad,Nd=200;function Td(t,e,n,i){var s=-1,r=tu,o=!0,a=t.length,l=[],c=e.length;if(!a)return l;n&&(e=Sn(e,Hr(n))),i?(r=nu,o=!1):e.length>=Nd&&(r=_o,o=!1,e=new zo(e));t:while(++s<a){var h=t[s],u=null==n?h:n(h);if(h=i||0!==h?h:0,o&&u===u){var d=c;while(d--)if(e[d]===u)continue t;l.push(h)}else r(e,u,i)||l.push(h)}return l}var kd=Td,jd=Oo(function(t,e){return Ks(t)?kd(t,ji(e,1,Ks,!0)):[]}),Ld=jd;function Dd(t,e,n){var i=-1,s=t.length;while(++i<s){var r=t[i],o=e(r);if(null!=o&&(void 0===a?o===o&&!ot(o):n(o,a)))var a=o,l=r}return l}var Bd=Dd;function Id(t,e){return t>e}var Rd=Id;function Vd(t){return t&&t.length?Bd(t,_i,Rd):void 0}var zd=Vd;function $d(t,e,n,i){var s=-1,r=null==t?0:t.length;i&&r&&(n=t[++s]);while(++s<r)n=e(n,t[s],s,t);return n}var Fd=$d;function Gd(t){return function(e){return null==t?void 0:t[e]}}var _d=Gd,Hd={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},Ud=_d(Hd),Jd=Ud,qd=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Wd="\\u0300-\\u036f",Xd="\\ufe20-\\ufe2f",Yd="\\u20d0-\\u20ff",Zd=Wd+Xd+Yd,Kd="["+Zd+"]",Qd=RegExp(Kd,"g");function tg(t){return t=Bn(t),t&&t.replace(qd,Jd).replace(Qd,"")}var eg=tg,ng=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function ig(t){return t.match(ng)||[]}var sg=ig,rg=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function og(t){return rg.test(t)}var ag=og,lg="\\ud800-\\udfff",cg="\\u0300-\\u036f",hg="\\ufe20-\\ufe2f",ug="\\u20d0-\\u20ff",dg=cg+hg+ug,gg="\\u2700-\\u27bf",pg="a-z\\xdf-\\xf6\\xf8-\\xff",fg="\\xac\\xb1\\xd7\\xf7",mg="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",yg="\\u2000-\\u206f",bg=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",vg="A-Z\\xc0-\\xd6\\xd8-\\xde",xg="\\ufe0e\\ufe0f",wg=fg+mg+yg+bg,Cg="['’]",Pg="["+wg+"]",Eg="["+dg+"]",Mg="\\d+",Og="["+gg+"]",Ag="["+pg+"]",Sg="[^"+lg+wg+Mg+gg+pg+vg+"]",Ng="\\ud83c[\\udffb-\\udfff]",Tg="(?:"+Eg+"|"+Ng+")",kg="[^"+lg+"]",jg="(?:\\ud83c[\\udde6-\\uddff]){2}",Lg="[\\ud800-\\udbff][\\udc00-\\udfff]",Dg="["+vg+"]",Bg="\\u200d",Ig="(?:"+Ag+"|"+Sg+")",Rg="(?:"+Dg+"|"+Sg+")",Vg="(?:"+Cg+"(?:d|ll|m|re|s|t|ve))?",zg="(?:"+Cg+"(?:D|LL|M|RE|S|T|VE))?",$g=Tg+"?",Fg="["+xg+"]?",Gg="(?:"+Bg+"(?:"+[kg,jg,Lg].join("|")+")"+Fg+$g+")*",_g="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Hg="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ug=Fg+$g+Gg,Jg="(?:"+[Og,jg,Lg].join("|")+")"+Ug,qg=RegExp([Dg+"?"+Ag+"+"+Vg+"(?="+[Pg,Dg,"$"].join("|")+")",Rg+"+"+zg+"(?="+[Pg,Dg+Ig,"$"].join("|")+")",Dg+"?"+Ig+"+"+Vg,Dg+"+"+zg,Hg,_g,Mg,Jg].join("|"),"g");function Wg(t){return t.match(qg)||[]}var Xg=Wg;function Yg(t,e,n){return t=Bn(t),e=n?void 0:e,void 0===e?ag(t)?Xg(t):sg(t):t.match(e)||[]}var Zg=Yg,Kg="['’]",Qg=RegExp(Kg,"g");function tp(t){return function(e){return Fd(Zg(eg(e).replace(Qg,"")),t,"")}}var ep=tp;function np(t,e,n){var i=-1,s=t.length;e<0&&(e=-e>s?0:s+e),n=n>s?s:n,n<0&&(n+=s),s=e>n?0:n-e>>>0,e>>>=0;var r=Array(s);while(++i<s)r[i]=t[i+e];return r}var ip=np;function sp(t,e,n){var i=t.length;return n=void 0===n?i:n,!e&&n>=i?t:ip(t,e,n)}var rp=sp,op="\\ud800-\\udfff",ap="\\u0300-\\u036f",lp="\\ufe20-\\ufe2f",cp="\\u20d0-\\u20ff",hp=ap+lp+cp,up="\\ufe0e\\ufe0f",dp="\\u200d",gp=RegExp("["+dp+op+hp+up+"]");function pp(t){return gp.test(t)}var fp=pp;function mp(t){return t.split("")}var yp=mp,bp="\\ud800-\\udfff",vp="\\u0300-\\u036f",xp="\\ufe20-\\ufe2f",wp="\\u20d0-\\u20ff",Cp=vp+xp+wp,Pp="\\ufe0e\\ufe0f",Ep="["+bp+"]",Mp="["+Cp+"]",Op="\\ud83c[\\udffb-\\udfff]",Ap="(?:"+Mp+"|"+Op+")",Sp="[^"+bp+"]",Np="(?:\\ud83c[\\udde6-\\uddff]){2}",Tp="[\\ud800-\\udbff][\\udc00-\\udfff]",kp="\\u200d",jp=Ap+"?",Lp="["+Pp+"]?",Dp="(?:"+kp+"(?:"+[Sp,Np,Tp].join("|")+")"+Lp+jp+")*",Bp=Lp+jp+Dp,Ip="(?:"+[Sp+Mp+"?",Mp,Np,Tp,Ep].join("|")+")",Rp=RegExp(Op+"(?="+Op+")|"+Ip+Bp,"g");function Vp(t){return t.match(Rp)||[]}var zp=Vp;function $p(t){return fp(t)?zp(t):yp(t)}var Fp=$p;function Gp(t){return function(e){e=Bn(e);var n=fp(e)?Fp(e):void 0,i=n?n[0]:e.charAt(0),s=n?rp(n,1).join(""):e.slice(1);return i[t]()+s}}var _p=Gp,Hp=_p("toUpperCase"),Up=Hp,Jp=ep(function(t,e,n){return t+(n?" ":"")+Up(e)}),qp=Jp;function Wp(t){return Up(Bn(t).toLowerCase())}var Xp=Wp,Yp=ep(function(t,e,n){return e=e.toLowerCase(),t+(n?Xp(e):e)}),Zp=Yp,Kp=ep(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),Qp=Kp,tf=ep(function(t,e,n){return t+(n?" ":"")+e.toLowerCase()}),ef=tf,nf=_p("toLowerCase"),sf=nf;const rf=t=>{const e=Object.create(null);return n=>{const i=e[n];return i||(e[n]=t(n))}},of=rf(t=>t.replace(/\B([A-Z])/g,"-$1").toLowerCase()),af=rf(t=>qp(Zp(t)).replace(/ /g,""));rf(t=>Qp(t).replace(/ /g,"_")),rf(t=>ef(t).replace(/ /g,".")),rf(t=>ef(t).replace(/ /g,"/")),rf(t=>Up(ef(t))),rf(t=>qp(Zp(t)));function lf(t){let e=2166136261,n=!1,i=t;for(let s=0,r=i.length;s<r;s+=1){let t=i.charCodeAt(s);t>127&&!n&&(i=unescape(encodeURIComponent(i)),t=i.charCodeAt(s),n=!0),e^=t,e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}return e>>>0}function cf(){let t="";const e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";for(let n=0,i=e.length;n<i;n+=1){const i=e[n],s=16*Math.random()|0,r="x"===i?s:"y"===i?3&s|8:i;t+=r.toString(16)}return t}function hf(t,e,n){const i=Math.min(2,Math.floor(.34*t.length));let s,r=Math.floor(.4*t.length)+1,o=!1;const a=t.toLowerCase();for(const l of e){const e=n(l);if(void 0!==e&&Math.abs(e.length-a.length)<=i){const n=e.toLowerCase();if(n===a){if(e===t)continue;return l}if(o)continue;if(e.length<3)continue;const i=uf(a,n,r-1);if(void 0===i)continue;i<3?(o=!0,s=l):(r=i,s=l)}}return s}function uf(t,e,n){let i=new Array(e.length+1),s=new Array(e.length+1);const r=n+1;for(let a=0;a<=e.length;a+=1)i[a]=a;for(let a=1;a<=t.length;a+=1){const o=t.charCodeAt(a-1),l=a>n?a-n:1,c=e.length>n+a?n+a:e.length;s[0]=a;let h=a;for(let t=1;t<l;t+=1)s[t]=r;for(let t=l;t<=c;t+=1){const n=o===e.charCodeAt(t-1)?i[t-1]:Math.min(i[t]+1,s[t-1]+1,i[t-1]+2);s[t]=n,h=Math.min(h,n)}for(let t=c+1;t<=e.length;t+=1)s[t]=r;if(h>n)return;const u=i;i=s,s=u}const o=i[e.length];return o>n?void 0:o}var df="[object Number]";function gf(t){return"number"==typeof t||it(t)&&et(t)==df}var pf=gf;function ff(t,e,n){return t===t&&(void 0!==n&&(t=t<=n?t:n),void 0!==e&&(t=t>=e?t:e)),t}var mf=ff;function yf(t,e,n){return void 0===n&&(n=e,e=void 0),void 0!==n&&(n=gt(n),n=n===n?n:0),void 0!==e&&(e=gt(e),e=e===e?e:0),mf(gt(t),e,n)}var bf=yf;function vf(t){return"string"===typeof t&&"%"===t.slice(-1)}function xf(t,e){if(null==t)return 0;let n;if("string"===typeof t){if(n=parseFloat(t),vf(t)&&(n/=100,Number.isFinite(n)))return n*e}else n=t;return Number.isFinite(n)?n>0&&n<1?n*e:n:0}function wf(t){if("object"===typeof t){let e=0,n=0,i=0,s=0;return null!=t.vertical&&Number.isFinite(t.vertical)&&(n=s=t.vertical),null!=t.horizontal&&Number.isFinite(t.horizontal)&&(i=e=t.horizontal),null!=t.left&&Number.isFinite(t.left)&&(e=t.left),null!=t.top&&Number.isFinite(t.top)&&(n=t.top),null!=t.right&&Number.isFinite(t.right)&&(i=t.right),null!=t.bottom&&Number.isFinite(t.bottom)&&(s=t.bottom),{top:n,right:i,bottom:s,left:e}}let e=0;return null!=t&&Number.isFinite(t)&&(e=t),{top:e,right:e,bottom:e,left:e}}let Cf=!1,Pf=!1,Ef=!1,Mf=!1,Of=!1,Af=!1,Sf=!1,Nf=!1,Tf=!1,kf=!1,jf=!1,Lf=!1,Df=!1,Bf=!1,If=!1,Rf=!1;if("object"===typeof navigator){const t=navigator.userAgent;Cf=t.indexOf("Macintosh")>=0,Pf=!!t.match(/(iPad|iPhone|iPod)/g),Ef=t.indexOf("Windows")>=0,Mf=t.indexOf("MSIE")>=0,Of=!!t.match(/Trident\/7\./),Af=!!t.match(/Edge\//),Sf=t.indexOf("Mozilla/")>=0&&t.indexOf("MSIE")<0&&t.indexOf("Edge/")<0,Tf=t.indexOf("Chrome/")>=0&&t.indexOf("Edge/")<0,kf=t.indexOf("Opera/")>=0||t.indexOf("OPR/")>=0,jf=t.indexOf("Firefox/")>=0,Lf=t.indexOf("AppleWebKit/")>=0&&t.indexOf("Chrome/")<0&&t.indexOf("Edge/")<0,"object"===typeof document&&(Rf=!document.createElementNS||"[object SVGForeignObjectElement]"!==`${document.createElementNS("http://www.w3.org/2000/svg","foreignObject")}`||t.indexOf("Opera/")>=0)}if("object"===typeof window&&(Nf=null!=window.chrome&&null!=window.chrome.app&&null!=window.chrome.app.runtime,Bf=null!=window.PointerEvent&&!Cf),"object"===typeof document){Df="ontouchstart"in document.documentElement;try{const t=Object.defineProperty({},"passive",{get(){If=!0}}),e=document.createElement("div");e.addEventListener&&e.addEventListener("click",()=>{},t)}catch(LM){}}var Vf;(function(t){t.IS_MAC=Cf,t.IS_IOS=Pf,t.IS_WINDOWS=Ef,t.IS_IE=Mf,t.IS_IE11=Of,t.IS_EDGE=Af,t.IS_NETSCAPE=Sf,t.IS_CHROME_APP=Nf,t.IS_CHROME=Tf,t.IS_OPERA=kf,t.IS_FIREFOX=jf,t.IS_SAFARI=Lf,t.SUPPORT_TOUCH=Df,t.SUPPORT_POINTER=Bf,t.SUPPORT_PASSIVE=If,t.NO_FOREIGNOBJECT=Rf,t.SUPPORT_FOREIGNOBJECT=!t.NO_FOREIGNOBJECT})(Vf||(Vf={})),function(t){function e(){const t=window.module;return null!=t&&null!=t.hot&&null!=t.hot.status?t.hot.status():"unkonwn"}function n(){return"apply"===e()}t.getHMRStatus=e,t.isApplyingHMR=n;const i={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};function s(t){const e=document.createElement(i[t]||"div"),n=`on${t}`;let s=n in e;return s||(e.setAttribute(n,"return;"),s="function"===typeof e[n]),s}t.isEventSupported=s}(Vf||(Vf={}));const zf=/[\t\r\n\f]/g,$f=/\S+/g,Ff=t=>` ${t} `;function Gf(t){return t&&t.getAttribute&&t.getAttribute("class")||""}function _f(t,e){if(null==t||null==e)return!1;const n=Ff(Gf(t)),i=Ff(e);return 1===t.nodeType&&n.replace(zf," ").includes(i)}function Hf(t,e){if(null!=t&&null!=e){if("function"===typeof e)return Hf(t,e(Gf(t)));if("string"===typeof e&&1===t.nodeType){const n=e.match($f)||[],i=Ff(Gf(t)).replace(zf," ");let s=n.reduce((t,e)=>t.indexOf(Ff(e))<0?`${t}${e} `:t,i);s=s.trim(),i!==s&&t.setAttribute("class",s)}}}function Uf(t,e){if(null!=t){if("function"===typeof e)return Uf(t,e(Gf(t)));if((!e||"string"===typeof e)&&1===t.nodeType){const n=(e||"").match($f)||[],i=Ff(Gf(t)).replace(zf," ");let s=n.reduce((t,e)=>{const n=Ff(e);return t.indexOf(n)>-1?t.replace(n," "):t},i);s=e?s.trim():"",i!==s&&t.setAttribute("class",s)}}}function Jf(t,e,n){if(null!=t&&null!=e)if(null==n||"string"!==typeof e){if("function"===typeof e)return Jf(t,e(Gf(t),n),n);if("string"===typeof e){const n=e.match($f)||[];n.forEach(e=>{_f(t,e)?Uf(t,e):Hf(t,e)})}}else n?Hf(t,e):Uf(t,e)}let qf=0;function Wf(){return qf+=1,`v${qf}`}function Xf(t){return null!=t.id&&""!==t.id||(t.id=Wf()),t.id}function Yf(t){return null!=t&&("function"===typeof t.getScreenCTM&&t instanceof SVGElement)}const Zf={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xhtml:"http://www.w3.org/1999/xhtml"},Kf="1.1";function Qf(t,e=document){return e.createElement(t)}function tm(t,e=Zf.xhtml,n=document){return n.createElementNS(e,t)}function em(t,e=document){return tm(t,Zf.svg,e)}function nm(t){if(t){const e=`<svg xmlns="${Zf.svg}" xmlns:xlink="${Zf.xlink}" version="${Kf}">${t}</svg>`,{documentElement:n}=im(e,{async:!1});return n}const e=document.createElementNS(Zf.svg,"svg");return e.setAttributeNS(Zf.xmlns,"xmlns:xlink",Zf.xlink),e.setAttribute("version",Kf),e}function im(t,e={}){let n;try{const i=new DOMParser;if(null!=e.async){const t=i;t.async=e.async}n=i.parseFromString(t,e.mimeType||"text/xml")}catch(i){n=void 0}if(!n||n.getElementsByTagName("parsererror").length)throw new Error(`Invalid XML: ${t}`);return n}function sm(t,e=!0){const n=t.nodeName;return e?n.toLowerCase():n.toUpperCase()}function rm(t){let e=0,n=t.previousSibling;while(n)1===n.nodeType&&(e+=1),n=n.previousSibling;return e}function om(t,e){return t.querySelectorAll(e)}function am(t,e){return t.querySelector(e)}function lm(t,e,n){const i=t.ownerSVGElement;let s=t.parentNode;while(s&&s!==n&&s!==i){if(_f(s,e))return s;s=s.parentNode}return null}function cm(t,e){const n=e&&e.parentNode;return t===n||!!(n&&1===n.nodeType&&16&t.compareDocumentPosition(n))}function hm(t){if(t){const e=Array.isArray(t)?t:[t];e.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)})}}function um(t){while(t.firstChild)t.removeChild(t.firstChild)}function dm(t,e){const n=Array.isArray(e)?e:[e];n.forEach(e=>{null!=e&&t.appendChild(e)})}function gm(t,e){const n=t.firstChild;return n?pm(n,e):dm(t,e)}function pm(t,e){const n=t.parentNode;if(n){const i=Array.isArray(e)?e:[e];i.forEach(e=>{null!=e&&n.insertBefore(e,t)})}}function fm(t,e){const n=t.parentNode;if(n){const i=Array.isArray(e)?e:[e];i.forEach(e=>{null!=e&&n.insertBefore(e,t.nextSibling)})}}function mm(t,e){null!=e&&e.appendChild(t)}function ym(t){return!!t&&1===t.nodeType}function bm(t){try{return t instanceof HTMLElement}catch(e){return"object"===typeof t&&1===t.nodeType&&"object"===typeof t.style&&"object"===typeof t.ownerDocument}}function vm(t,e){const n=[];let i=t.firstChild;for(;i;i=i.nextSibling)1===i.nodeType&&(e&&!_f(i,e)||n.push(i));return n}const xm=["viewBox","attributeName","attributeType","repeatCount","textLength","lengthAdjust","gradientUnits"];function wm(t,e){return t.getAttribute(e)}function Cm(t,e){const n=Om(e);n.ns?t.hasAttributeNS(n.ns,n.local)&&t.removeAttributeNS(n.ns,n.local):t.hasAttribute(e)&&t.removeAttribute(e)}function Pm(t,e,n){if(null==n)return Cm(t,e);const i=Om(e);i.ns&&"string"===typeof n?t.setAttributeNS(i.ns,e,n):"id"===e?t.id=`${n}`:t.setAttribute(e,`${n}`)}function Em(t,e){Object.keys(e).forEach(n=>{Pm(t,n,e[n])})}function Mm(t,e,n){if(null==e){const e=t.attributes,n={};for(let t=0;t<e.length;t+=1)n[e[t].name]=e[t].value;return n}if("string"===typeof e&&void 0===n)return t.getAttribute(e);"object"===typeof e?Em(t,e):Pm(t,e,n)}function Om(t){if(-1!==t.indexOf(":")){const e=t.split(":");return{ns:Zf[e[0]],local:e[1]}}return{ns:null,local:t}}function Am(t){const e={};return Object.keys(t).forEach(n=>{const i=xm.includes(n)?n:of(n);e[i]=t[n]}),e}function Sm(t){const e={},n=t.split(";");return n.forEach(t=>{const n=t.trim();if(n){const t=n.split("=");t.length&&(e[t[0].trim()]=t[1]?t[1].trim():"")}}),e}function Nm(t,e){return Object.keys(e).forEach(n=>{if("class"===n)t[n]=t[n]?`${t[n]} ${e[n]}`:e[n];else if("style"===n){const i="object"===typeof t[n],s="object"===typeof e[n];let r,o;i&&s?(r=t[n],o=e[n]):i?(r=t[n],o=Sm(e[n])):s?(r=Sm(t[n]),o=e[n]):(r=Sm(t[n]),o=Sm(e[n])),t[n]=Nm(r,o)}else t[n]=e[n]}),t}function Tm(t,e,n={}){const i=n.offset||0,s=[],r=[];let o,a,l=null;for(let c=0;c<t.length;c+=1){o=r[c]=t[c];for(let s=0,a=e.length;s<a;s+=1){const a=e[s],l=a.start+i,h=a.end+i;c>=l&&c<h&&("string"===typeof o?o=r[c]={t:t[c],attrs:a.attrs}:o.attrs=Nm(Nm({},o.attrs),a.attrs),n.includeAnnotationIndices&&(null==o.annotations&&(o.annotations=[]),o.annotations.push(s)))}a=r[c-1],a?M(o)&&M(a)?JSON.stringify(o.attrs)===JSON.stringify(a.attrs)?l.t+=o.t:(s.push(l),l=o):M(o)||M(a)?(s.push(l),l=o):l=(l||"")+o:l=o}return null!=l&&s.push(l),s}function km(t){return t.replace(/ /g," ")}var jm;let Lm;(function(t){function e(t){const e="data:";return t.substr(0,e.length)===e}function n(t,n){if(!t||e(t))return void setTimeout(()=>n(null,t));const i=()=>{n(new Error(`Failed to load image: ${t}`))},s=window.FileReader?t=>{if(200===t.status){const e=new FileReader;e.onload=t=>{const e=t.target.result;n(null,e)},e.onerror=i,e.readAsDataURL(t.response)}else i()}:e=>{const s=t=>{const e=32768,n=[];for(let i=0;i<t.length;i+=e)n.push(String.fromCharCode.apply(null,t.subarray(i,i+e)));return n.join("")};if(200===e.status){let i=t.split(".").pop()||"png";"svg"===i&&(i="svg+xml");const r=`data:image/${i};base64,`,o=new Uint8Array(e.response),a=r+btoa(s(o));n(null,a)}else i()},r=new XMLHttpRequest;r.responseType=window.FileReader?"blob":"arraybuffer",r.open("GET",t,!0),r.addEventListener("error",i),r.addEventListener("load",()=>s(r)),r.send()}function i(t){let e=t.replace(/\s/g,"");e=decodeURIComponent(e);const n=e.indexOf(","),i=e.slice(0,n),s=i.split(":")[1].split(";")[0],r=e.slice(n+1);let o;o=i.indexOf("base64")>=0?atob(r):unescape(encodeURIComponent(r));const a=new Uint8Array(o.length);for(let l=0;l<o.length;l+=1)a[l]=o.charCodeAt(l);return new Blob([a],{type:s})}function s(t,e){const n=window.navigator.msSaveBlob;if(n)n(t,e);else{const n=window.URL.createObjectURL(t),i=document.createElement("a");i.href=n,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(n)}}function r(t,e){const n=i(t);s(n,e)}function o(t){const e=t.match(/<svg[^>]*viewBox\s*=\s*(["']?)(.+?)\1[^>]*>/i);return e&&e[2]?e[2].replace(/\s+/," ").split(" "):null}function a(t){const e=parseFloat(t);return Number.isNaN(e)?null:e}function l(t,e={}){let n=null;const i=e=>(null==n&&(n=o(t)),null!=n?a(n[e]):null),s=e=>{const n=t.match(e);return n&&n[2]?a(n[2]):null};let r=e.width;if(null==r&&(r=s(/<svg[^>]*width\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==r&&(r=i(2)),null==r)throw new Error("Can not parse width from svg string");let l=e.height;if(null==l&&(l=s(/<svg[^>]*height\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==l&&(l=i(3)),null==l)throw new Error("Can not parse height from svg string");const c=encodeURIComponent(t).replace(/'/g,"%27").replace(/"/g,"%22"),h="data:image/svg+xml",u=`${h},${c}`;return u}t.isDataUrl=e,t.imageToDataUri=n,t.dataUriToBlob=i,t.downloadBlob=s,t.downloadDataUri=r,t.svgToDataUrl=l})(jm||(jm={}));const Dm={px(t){return t},mm(t){return Lm*t},cm(t){return Lm*t*10},in(t){return Lm*t*25.4},pt(t){return Lm*(25.4*t/72)},pc(t){return Lm*(25.4*t/6)}};var Bm;(function(t){function e(t,e,n){const i=document.createElement("div"),s=i.style;s.display="inline-block",s.position="absolute",s.left="-15000px",s.top="-15000px",s.width=t+(n||"px"),s.height=e+(n||"px"),document.body.appendChild(i);const r=i.getBoundingClientRect(),o={width:r.width||0,height:r.height||0};return document.body.removeChild(i),o}function n(t,n){null==Lm&&(Lm=e("1","1","mm").width);const i=n?Dm[n]:null;return i?i(t):t}t.measure=e,t.toPx=n})(Bm||(Bm={}));const Im=/-(.)/g;function Rm(t){return t.replace(Im,(t,e)=>e.toUpperCase())}const Vm={},zm=["webkit","ms","moz","o"],$m="undefined"!==typeof document?document.createElement("div").style:{};function Fm(t){for(let e=0;e<zm.length;e+=1){const n=zm[e]+t;if(n in $m)return n}return null}function Gm(t){const e=Rm(t);if(null==Vm[e]){const t=e.charAt(0).toUpperCase()+e.slice(1);Vm[e]=e in $m?e:Fm(t)}return Vm[e]}function _m(t,e,n){const i=Gm(e);null!=i&&(t[i]=n),t[e]=n}function Hm(t,e){const n=t.ownerDocument&&t.ownerDocument.defaultView&&t.ownerDocument.defaultView.opener?t.ownerDocument.defaultView.getComputedStyle(t,null):window.getComputedStyle(t,null);return n&&e?n.getPropertyValue(e)||n[e]:n}function Um(t){const e=Hm(t);return null!=e&&("scroll"===e.overflow||"auto"===e.overflow)}const Jm=function(){if("undefined"==typeof document)return function(){};const t=document;return t.selection?function(){t.selection.empty()}:window.getSelection?function(){const t=window.getSelection();t&&(t.empty?t.empty():t.removeAllRanges&&t.removeAllRanges())}:function(){}}(),qm={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function Wm(t){return/^--/.test(t)}function Xm(t,e,n){const i=window.getComputedStyle(t,null);return n?i.getPropertyValue(e)||void 0:i[e]||t.style[e]}function Ym(t,e){return parseInt(Xm(t,e),10)||0}function Zm(t,e){return qm[t]||"number"!==typeof e?e:`${e}px`}function Km(t,e,n){if("string"===typeof e){const i=Wm(e);if(i||(e=Gm(e)),void 0===n)return Xm(t,e,i);i||(n=Zm(e,n));const s=t.style;return void(i?s.setProperty(e,n):s[e]=n)}for(const i in e)Km(t,i,e[i])}const Qm=new WeakMap;function ty(t,e){const n=Zp(e),i=Qm.get(t);if(i)return i[n]}function ey(t,e,n){const i=Zp(e),s=Qm.get(t);s?s[i]=n:Qm.set(t,{[i]:n})}function ny(t,e,n){if(!e){const e={};return Object.keys(Qm).forEach(n=>{e[n]=ty(t,n)}),e}if("string"===typeof e)return void 0===n?ty(t,e):void ey(t,e,n);for(const i in e)ny(t,i,e[i])}const iy={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};function sy(t,e,n){if(e){if("string"===typeof e)return e=iy[e]||e,arguments.length<3?t[e]:void(t[e]=n);for(const n in e)sy(t,n,e[n])}}class ry{get[Symbol.toStringTag](){return ry.toStringTag}get type(){return this.node.nodeName}get id(){return this.node.id}set id(t){this.node.id=t}constructor(t,e,n){if(!t)throw new TypeError("Invalid element to create vector");let i;if(ry.isVector(t))i=t.node;else if("string"===typeof t)if("svg"===t.toLowerCase())i=nm();else if("<"===t[0]){const e=nm(t);i=document.importNode(e.firstChild,!0)}else i=document.createElementNS(Zf.svg,t);else i=t;this.node=i,e&&this.setAttributes(e),n&&this.append(n)}transform(t,e){return null==t?Hy(this.node):(Hy(this.node,t,e),this)}translate(t,e=0,n={}){return null==t?Uy(this.node):(Uy(this.node,t,e,n),this)}rotate(t,e,n,i={}){return null==t?Jy(this.node):(Jy(this.node,t,e,n,i),this)}scale(t,e){return null==t?qy(this.node):(qy(this.node,t,e),this)}getTransformToElement(t){const e=ry.toNode(t);return Wy(this.node,e)}removeAttribute(t){return Cm(this.node,t),this}getAttribute(t){return wm(this.node,t)}setAttribute(t,e){return Pm(this.node,t,e),this}setAttributes(t){return Em(this.node,t),this}attr(t,e){return null==t?Mm(this.node):"string"===typeof t&&void 0===e?Mm(this.node,t):("object"===typeof t?Mm(this.node,t):Mm(this.node,t,e),this)}svg(){return this.node instanceof SVGSVGElement?this:ry.create(this.node.ownerSVGElement)}defs(){const t=this.svg()||this,e=t.node.getElementsByTagName("defs")[0];return e?ry.create(e):ry.create("defs").appendTo(t)}text(t,e={}){return uy(this.node,t,e),this}tagName(){return sm(this.node)}clone(){return ry.create(this.node.cloneNode(!0))}remove(){return hm(this.node),this}empty(){return um(this.node),this}append(t){return dm(this.node,ry.toNodes(t)),this}appendTo(t){return mm(this.node,ry.isVector(t)?t.node:t),this}prepend(t){return gm(this.node,ry.toNodes(t)),this}before(t){return pm(this.node,ry.toNodes(t)),this}replace(t){return this.node.parentNode&&this.node.parentNode.replaceChild(ry.toNode(t),this.node),ry.create(t)}first(){return this.node.firstChild?ry.create(this.node.firstChild):null}last(){return this.node.lastChild?ry.create(this.node.lastChild):null}get(t){const e=this.node.childNodes[t];return e?ry.create(e):null}indexOf(t){const e=Array.prototype.slice.call(this.node.childNodes);return e.indexOf(ry.toNode(t))}find(t){const e=[],n=om(this.node,t);if(n)for(let i=0,s=n.length;i<s;i+=1)e.push(ry.create(n[i]));return e}findOne(t){const e=am(this.node,t);return e?ry.create(e):null}findParentByClass(t,e){const n=lm(this.node,t,e);return n?ry.create(n):null}matches(t){const e=this.node,n=(this.node.matches,e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector||null);return n&&n.call(e,t)}contains(t){return cm(this.node,ry.isVector(t)?t.node:t)}wrap(t){const e=ry.create(t),n=this.node.parentNode;return null!=n&&n.insertBefore(e.node,this.node),e.append(this)}parent(t){let e=this;if(null==e.node.parentNode)return null;if(e=ry.create(e.node.parentNode),null==t)return e;do{if("string"===typeof t?e.matches(t):e instanceof t)return e}while(e=ry.create(e.node.parentNode));return e}children(){const t=this.node.childNodes,e=[];for(let n=0;n<t.length;n+=1){const i=t[n];1===i.nodeType&&e.push(ry.create(t[n]))}return e}eachChild(t,e){const n=this.children();for(let i=0,s=n.length;i<s;i+=1)t.call(n[i],n[i],i,n),e&&n[i].eachChild(t,e);return this}index(){return rm(this.node)}hasClass(t){return _f(this.node,t)}addClass(t){return Hf(this.node,t),this}removeClass(t){return Uf(this.node,t),this}toggleClass(t,e){return Jf(this.node,t,e),this}toLocalPoint(t,e){return Yy(this.node,t,e)}sample(t=1){return this.node instanceof SVGPathElement?yy(this.node,t):[]}toPath(){return ry.create(Ay(this.node))}toPathData(){return Sy(this.node)}}function oy(t,e){const n=ry.create(e),i=ry.create("textPath"),s=t.d;if(s&&void 0===t["xlink:href"]){const t=ry.create("path").attr("d",s).appendTo(n.defs());i.attr("xlink:href",`#${t.id}`)}return"object"===typeof t&&i.attr(t),i.node}function ay(t,e,n){const i=n.eol,s=n.baseSize,r=n.lineHeight;let o,a=0;const l={},c=e.length-1;for(let h=0;h<=c;h+=1){let r=e[h],l=null;if("object"===typeof r){const t=r.attrs,e=ry.create("tspan",t);o=e.node;let u=r.t;i&&h===c&&(u+=i),o.textContent=u;const d=t.class;d&&e.addClass(d),n.includeAnnotationIndices&&e.attr("annotations",r.annotations.join(",")),l=parseFloat(t["font-size"]),void 0===l&&(l=s),l&&l>a&&(a=l)}else i&&h===c&&(r+=i),o=document.createTextNode(r||" "),s&&s>a&&(a=s);t.appendChild(o)}return a&&(l.maxFontSize=a),r?l.lineHeight=r:a&&(l.lineHeight=1.2*a),l}(function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&i.node instanceof SVGElement&&"function"===typeof i.sample&&"function"===typeof i.toPath}function n(e,n,i){return new t(e,n,i)}function i(t){if("<"===t[0]){const e=nm(t),i=[];for(let t=0,s=e.childNodes.length;t<s;t+=1){const s=e.childNodes[t];i.push(n(document.importNode(s,!0)))}return i}return[n(t)]}function s(t){return e(t)?t.node:t}function r(t){return Array.isArray(t)?t.map(t=>s(t)):[s(t)]}t.toStringTag=`X6.${t.name}`,t.isVector=e,t.create=n,t.createVectors=i,t.toNode=s,t.toNodes=r})(ry||(ry={}));const ly=/em$/;function cy(t,e){const n=parseFloat(t);return ly.test(t)?n*e:n}function hy(t,e,n,i){if(!Array.isArray(e))return 0;const s=e.length;if(!s)return 0;let r=e[0];const o=cy(r.maxFontSize,n)||n;let a=0;const l=cy(i,n);for(let u=1;u<s;u+=1){r=e[u];const t=cy(r.lineHeight,n)||l;a+=t}const c=cy(r.maxFontSize,n)||n;let h;switch(t){case"middle":h=o/2-.15*c-a/2;break;case"bottom":h=-.25*c-a;break;case"top":default:h=.8*o;break}return h}function uy(t,e,n={}){e=km(e);const i=n.eol;let s=n.textPath;const r=n.textVerticalAnchor,o="middle"===r||"bottom"===r||"top"===r;let a=n.x;void 0===a&&(a=t.getAttribute("x")||0);const l=n.includeAnnotationIndices;let c=n.annotations;c&&!Array.isArray(c)&&(c=[c]);const h=n.lineHeight,u="auto"===h,d=u?"1.5em":h||"1em";let g=!0;const p=t.childNodes;if(1===p.length){const t=p[0];t&&"TITLE"===t.tagName.toUpperCase()&&(g=!1)}g&&um(t),Mm(t,{"xml:space":"preserve",display:e||n.displayEmpty?null:"none"});const f=Mm(t,"font-size");let m,y,b=parseFloat(f);b||(b=16,!o&&!c||f||Mm(t,"font-size",`${b}`)),s?("string"===typeof s&&(s={d:s}),m=oy(s,t)):m=document.createDocumentFragment();let v,x=0;const w=e.split("\n"),C=[],P=w.length-1;for(let M=0;M<=P;M+=1){y=d;let t="v-line";const e=em("tspan");let n,r=w[M];if(r)if(c){const t=Tm(r,c,{offset:-x,includeAnnotationIndices:l});n=ay(e,t,{eol:M!==P&&i,baseSize:b,lineHeight:u?null:d,includeAnnotationIndices:l});const s=n.lineHeight;s&&u&&0!==M&&(y=s),0===M&&(v=.8*n.maxFontSize)}else i&&M!==P&&(r+=i),e.textContent=r;else{e.textContent="-",t+=" v-empty-line";const i=e.style;i.fillOpacity=0,i.strokeOpacity=0,c&&(n={})}n&&C.push(n),M>0&&e.setAttribute("dy",y),(M>0||s)&&e.setAttribute("x",a),e.className.baseVal=t,m.appendChild(e),x+=r.length+1}if(o)if(c)y=hy(r,C,b,d);else if("top"===r)y="0.8em";else{let t;switch(P>0?(t=parseFloat(d)||1,t*=P,ly.test(d)||(t/=b)):t=0,r){case"middle":y=.3-t/2+"em";break;case"bottom":y=-t-.3+"em";break;default:break}}else 0===r?y="0em":r?y=r:(y=0,null==t.getAttribute("y")&&t.setAttribute("y",`${v||"0.8em"}`));const E=m.firstChild;E.setAttribute("dy",y),t.appendChild(m)}function dy(t,e={}){const n=document.createElement("canvas").getContext("2d");if(!t)return{width:0};const i=[],s=e["font-size"]?`${parseFloat(e["font-size"])}px`:"14px";return i.push(e["font-style"]||"normal"),i.push(e["font-variant"]||"normal"),i.push(e["font-weight"]||400),i.push(s),i.push(e["font-family"]||"sans-serif"),n.font=i.join(" "),n.measureText(t)}function gy(t,e,n,i={}){if(e>=n)return[t,""];const s=t.length,r={};let o=Math.round(e/n*s-1);o<0&&(o=0);while(o>=0&&o<s){const n=t.slice(0,o),s=r[n]||dy(n,i).width,a=t.slice(0,o+1),l=r[a]||dy(a,i).width;if(r[n]=s,r[a]=l,s>e)o-=1;else{if(!(l<=e))break;o+=1}}return[t.slice(0,o),t.slice(o)]}function py(t,e,n={},i={}){const s=e.width,r=e.height,o=i.eol||"\n",a=n.fontSize||14,l=n.lineHeight?parseFloat(n.lineHeight):Math.ceil(1.4*a),c=Math.floor(r/l);if(t.indexOf(o)>-1){const s=cf(),r=[];return t.split(o).map(t=>{const o=py(t,Object.assign(Object.assign({},e),{height:Number.MAX_SAFE_INTEGER}),n,Object.assign(Object.assign({},i),{eol:s}));o&&r.push(...o.split(s))}),r.slice(0,c).join(o)}const{width:h}=dy(t,n);if(h<s)return t;const u=[];let d=t,g=h,p=i.ellipsis,f=0;p&&("string"!==typeof p&&(p="…"),f=dy(p,n).width);for(let m=0;m<c;m+=1){if(!(g>s)){u.push(d);break}{const t=m===c-1;if(t){const[t]=gy(d,s-f,g,n);u.push(p?`${t}${p}`:t)}else{const[t,e]=gy(d,s,g,n);u.push(t),d=e,g=dy(d,n).width}}}return u.join(o)}const fy=.551784;function my(t,e,n=NaN){const i=t.getAttribute(e);if(null==i)return n;const s=parseFloat(i);return Number.isNaN(s)?n:s}function yy(t,e=1){const n=t.getTotalLength(),i=[];let s,r=0;while(r<n)s=t.getPointAtLength(r),i.push({distance:r,x:s.x,y:s.y}),r+=e;return i}function by(t){return["M",my(t,"x1"),my(t,"y1"),"L",my(t,"x2"),my(t,"y2")].join(" ")}function vy(t){const e=Cy(t);return 0===e.length?null:`${wy(e)} Z`}function xy(t){const e=Cy(t);return 0===e.length?null:wy(e)}function wy(t){const e=t.map(t=>`${t.x} ${t.y}`);return`M ${e.join(" L")}`}function Cy(t){const e=[],n=t.points;if(n)for(let i=0,s=n.numberOfItems;i<s;i+=1)e.push(n.getItem(i));return e}function Py(t){const e=my(t,"cx",0),n=my(t,"cy",0),i=my(t,"r"),s=i*fy;return["M",e,n-i,"C",e+s,n-i,e+i,n-s,e+i,n,"C",e+i,n+s,e+s,n+i,e,n+i,"C",e-s,n+i,e-i,n+s,e-i,n,"C",e-i,n-s,e-s,n-i,e,n-i,"Z"].join(" ")}function Ey(t){const e=my(t,"cx",0),n=my(t,"cy",0),i=my(t,"rx"),s=my(t,"ry")||i,r=i*fy,o=s*fy,a=["M",e,n-s,"C",e+r,n-s,e+i,n-o,e+i,n,"C",e+i,n+o,e+r,n+s,e,n+s,"C",e-r,n+s,e-i,n+o,e-i,n,"C",e-i,n-o,e-r,n-s,e,n-s,"Z"].join(" ");return a}function My(t){return Oy({x:my(t,"x",0),y:my(t,"y",0),width:my(t,"width",0),height:my(t,"height",0),rx:my(t,"rx",0),ry:my(t,"ry",0)})}function Oy(t){let e;const n=t.x,i=t.y,s=t.width,r=t.height,o=Math.min(t.rx||t["top-rx"]||0,s/2),a=Math.min(t.rx||t["bottom-rx"]||0,s/2),l=Math.min(t.ry||t["top-ry"]||0,r/2),c=Math.min(t.ry||t["bottom-ry"]||0,r/2);return e=o||a||l||c?["M",n,i+l,"v",r-l-c,"a",a,c,0,0,0,a,c,"h",s-2*a,"a",a,c,0,0,0,a,-c,"v",-(r-c-l),"a",o,l,0,0,0,-o,-l,"h",-(s-2*o),"a",o,l,0,0,0,-o,l,"Z"]:["M",n,i,"H",n+s,"V",i+r,"H",n,"V",i,"Z"],e.join(" ")}function Ay(t){const e=em("path");Mm(e,Mm(t));const n=Sy(t);return n&&e.setAttribute("d",n),e}function Sy(t){const e=t.tagName.toLowerCase();switch(e){case"path":return t.getAttribute("d");case"line":return by(t);case"polygon":return vy(t);case"polyline":return xy(t);case"ellipse":return Ey(t);case"circle":return Py(t);case"rect":return My(t);default:break}throw new Error(`"${e}" cannot be converted to svg path element.`)}function Ny(t,e,n,i){const s=2*Math.PI-1e-6,r=t,o=e;let a=n,l=i;if(l<a){const t=a;a=l,l=t}const c=l-a,h=c<Math.PI?"0":"1",u=Math.cos(a),d=Math.sin(a),g=Math.cos(l),p=Math.sin(l);return c>=s?r?`M0,${o}A${o},${o} 0 1,1 0,${-o}A${o},${o} 0 1,1 0,${o}M0,${r}A${r},${r} 0 1,0 0,${-r}A${r},${r} 0 1,0 0,${r}Z`:`M0,${o}A${o},${o} 0 1,1 0,${-o}A${o},${o} 0 1,1 0,${o}Z`:r?`M${o*u},${o*d}A${o},${o} 0 ${h},1 ${o*g},${o*p}L${r*g},${r*p}A${r},${r} 0 ${h},0 ${r*u},${r*d}Z`:`M${o*u},${o*d}A${o},${o} 0 ${h},1 ${o*g},${o*p}L0,0Z`}const Ty=/(\w+)\(([^,)]+),?([^)]+)?\)/gi,ky=/[ ,]+/,jy=/^(\w+)\((.*)\)/;function Ly(t,e){const n=em("svg"),i=n.createSVGPoint();return i.x=t,i.y=e,i}function Dy(t){const e=em("svg"),n=e.createSVGMatrix();if(null!=t){const e=t,i=n;for(const t in e)i[t]=e[t]}return n}function By(t){const e=em("svg");return null!=t?(t instanceof DOMMatrix||(t=Dy(t)),e.createSVGTransformFromMatrix(t)):e.createSVGTransform()}function Iy(t){let e=Dy();const n=null!=t&&t.match(Ty);if(!n)return e;for(let i=0,s=n.length;i<s;i+=1){const t=n[i],s=t.match(jy);if(s){let t,n,i,r,o,a=Dy();const l=s[2].split(ky);switch(s[1].toLowerCase()){case"scale":t=parseFloat(l[0]),n=void 0===l[1]?t:parseFloat(l[1]),a=a.scaleNonUniform(t,n);break;case"translate":i=parseFloat(l[0]),r=parseFloat(l[1]),a=a.translate(i,r);break;case"rotate":o=parseFloat(l[0]),i=parseFloat(l[1])||0,r=parseFloat(l[2])||0,a=0!==i||0!==r?a.translate(i,r).rotate(o).translate(-i,-r):a.rotate(o);break;case"skewx":o=parseFloat(l[0]),a=a.skewX(o);break;case"skewy":o=parseFloat(l[0]),a=a.skewY(o);break;case"matrix":a.a=parseFloat(l[0]),a.b=parseFloat(l[1]),a.c=parseFloat(l[2]),a.d=parseFloat(l[3]),a.e=parseFloat(l[4]),a.f=parseFloat(l[5]);break;default:continue}e=e.multiply(a)}}return e}function Ry(t){const e=t||{},n=null!=e.a?e.a:1,i=null!=e.b?e.b:0,s=null!=e.c?e.c:0,r=null!=e.d?e.d:1,o=null!=e.e?e.e:0,a=null!=e.f?e.f:0;return`matrix(${n},${i},${s},${r},${o},${a})`}function Vy(t){let e,n,i;if(t){const s=ky;if(t.trim().indexOf("matrix")>=0){const s=Iy(t),r=$y(s);e=[r.translateX,r.translateY],n=[r.rotation],i=[r.scaleX,r.scaleY];const o=[];0===e[0]&&0===e[1]||o.push(`translate(${e.join(",")})`),1===i[0]&&1===i[1]||o.push(`scale(${i.join(",")})`),0!==n[0]&&o.push(`rotate(${n[0]})`),t=o.join(" ")}else{const r=t.match(/translate\((.*?)\)/);r&&(e=r[1].split(s));const o=t.match(/rotate\((.*?)\)/);o&&(n=o[1].split(s));const a=t.match(/scale\((.*?)\)/);a&&(i=a[1].split(s))}}const s=i&&i[0]?parseFloat(i[0]):1;return{raw:t||"",translation:{tx:e&&e[0]?parseInt(e[0],10):0,ty:e&&e[1]?parseInt(e[1],10):0},rotation:{angle:n&&n[0]?parseInt(n[0],10):0,cx:n&&n[1]?parseInt(n[1],10):void 0,cy:n&&n[2]?parseInt(n[2],10):void 0},scale:{sx:s,sy:i&&i[1]?parseFloat(i[1]):s}}}function zy(t,e){const n=e.x*t.a+e.y*t.c+0,i=e.x*t.b+e.y*t.d+0;return{x:n,y:i}}function $y(t){const e=zy(t,{x:0,y:1}),n=zy(t,{x:1,y:0}),i=180/Math.PI*Math.atan2(e.y,e.x)-90,s=180/Math.PI*Math.atan2(n.y,n.x);return{skewX:i,skewY:s,translateX:t.e,translateY:t.f,scaleX:Math.sqrt(t.a*t.a+t.b*t.b),scaleY:Math.sqrt(t.c*t.c+t.d*t.d),rotation:i}}function Fy(t){let e,n,i,s;return t?(e=null==t.a?1:t.a,s=null==t.d?1:t.d,n=t.b,i=t.c):e=s=1,{sx:n?Math.sqrt(e*e+n*n):e,sy:i?Math.sqrt(i*i+s*s):s}}function Gy(t){let e={x:0,y:1};t&&(e=zy(t,e));const n=180*Math.atan2(e.y,e.x)/Math.PI%360-90,i=n%360+(n<0?360:0);return{angle:i}}function _y(t){return{tx:t&&t.e||0,ty:t&&t.f||0}}function Hy(t,e,n={}){if(null==e)return Iy(Mm(t,"transform"));if(n.absolute)return void t.setAttribute("transform",Ry(e));const i=t.transform,s=By(e);i.baseVal.appendItem(s)}function Uy(t,e,n=0,i={}){let s=Mm(t,"transform");const r=Vy(s);if(null==e)return r.translation;s=r.raw,s=s.replace(/translate\([^)]*\)/g,"").trim();const o=i.absolute?e:r.translation.tx+e,a=i.absolute?n:r.translation.ty+n,l=`translate(${o},${a})`;t.setAttribute("transform",`${l} ${s}`.trim())}function Jy(t,e,n,i,s={}){let r=Mm(t,"transform");const o=Vy(r);if(null==e)return o.rotation;r=o.raw,r=r.replace(/rotate\([^)]*\)/g,"").trim(),e%=360;const a=s.absolute?e:o.rotation.angle+e,l=null!=n&&null!=i?`,${n},${i}`:"",c=`rotate(${a}${l})`;t.setAttribute("transform",`${r} ${c}`.trim())}function qy(t,e,n){let i=Mm(t,"transform");const s=Vy(i);if(null==e)return s.scale;n=null==n?e:n,i=s.raw,i=i.replace(/scale\([^)]*\)/g,"").trim();const r=`scale(${e},${n})`;t.setAttribute("transform",`${i} ${r}`.trim())}function Wy(t,e){if(Yf(e)&&Yf(t)){const n=e.getScreenCTM(),i=t.getScreenCTM();if(n&&i)return n.inverse().multiply(i)}return Dy()}function Xy(t,e){let n=Dy();if(Yf(e)&&Yf(t)){let i=t;const s=[];while(i&&i!==e){const t=i.getAttribute("transform")||null,e=Iy(t);s.push(e),i=i.parentNode}s.reverse().forEach(t=>{n=n.multiply(t)})}return n}function Yy(t,e,n){const i=t instanceof SVGSVGElement?t:t.ownerSVGElement,s=i.createSVGPoint();s.x=e,s.y=n;try{const e=i.getScreenCTM(),n=s.matrixTransform(e.inverse()),r=Wy(t,i).inverse();return n.matrixTransform(r)}catch(r){return s}}var Zy,Ky,Qy,tb;(function(t){const e={};function n(t){return e[t]||{}}function i(t,n){e[t]=n}function s(t){delete e[t]}t.get=n,t.register=i,t.unregister=s})(Zy||(Zy={})),function(t){const e=new WeakMap;function n(t){return e.has(t)||e.set(t,{events:Object.create(null)}),e.get(t)}function i(t){return e.get(t)}function s(t){return e.delete(t)}t.ensure=n,t.get=i,t.remove=s}(Ky||(Ky={})),function(t){function e(t){t.stopPropagation()}function n(t,e,n){null!=t.addEventListener&&t.addEventListener(e,n)}function i(t,e,n){null!=t.removeEventListener&&t.removeEventListener(e,n)}t.returnTrue=()=>!0,t.returnFalse=()=>!1,t.stopPropagationCallback=e,t.addEventListener=n,t.removeEventListener=i}(Qy||(Qy={})),function(t){const e=/[^\x20\t\r\n\f]+/g,n=/^([^.]*)(?:\.(.+)|)/;function i(t){return(t||"").match(e)||[""]}function s(t){const e=n.exec(t)||[];return{originType:e[1]?e[1].trim():e[1],namespaces:e[2]?e[2].split(".").map(t=>t.trim()).sort():[]}}function r(t){return 1===t.nodeType||9===t.nodeType||!+t.nodeType}function o(t,e){if(e){const n=t;return null!=n.querySelector&&null!=n.querySelector(e)}return!0}t.splitType=i,t.normalizeType=s,t.isValidTarget=r,t.isValidSelector=o}(Qy||(Qy={})),function(t){let e=0;const n=new WeakMap;function i(t){return n.has(t)||(n.set(t,e),e+=1),n.get(t)}function s(t){return n.get(t)}function r(t){return n.delete(t)}function o(t,e){return n.set(t,e)}t.ensureHandlerId=i,t.getHandlerId=s,t.removeHandlerId=r,t.setHandlerId=o}(Qy||(Qy={})),function(t){function e(t,e){const n=[],i=Ky.get(t),s=i&&i.events&&i.events[e.type],r=s&&s.handlers||[],o=s?s.delegateCount:0;if(o>0&&!("click"===e.type&&"number"===typeof e.button&&e.button>=1))for(let a=e.target;a!==t;a=a.parentNode||t)if(1===a.nodeType&&("click"!==e.type||!0!==a.disabled)){const e=[],i={};for(let n=0;n<o;n+=1){const s=r[n],o=s.selector;if(null!=o&&null==i[o]){const e=t,n=[];e.querySelectorAll(o).forEach(t=>{n.push(t)}),i[o]=n.includes(a)}i[o]&&e.push(s)}e.length&&n.push({elem:a,handlers:e})}return o<r.length&&n.push({elem:t,handlers:r.slice(o)}),n}t.getHandlerQueue=e}(Qy||(Qy={})),function(t){function e(t){return null!=t&&t===t.window}t.isWindow=e}(Qy||(Qy={})),function(t){function e(t,e){const n=9===t.nodeType?t.documentElement:t,i=e&&e.parentNode;return t===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):t.compareDocumentPosition&&16&t.compareDocumentPosition(i)))}t.contains=e}(Qy||(Qy={}));class eb{constructor(t,e){this.isDefaultPrevented=Qy.returnFalse,this.isPropagationStopped=Qy.returnFalse,this.isImmediatePropagationStopped=Qy.returnFalse,this.isSimulated=!1,this.preventDefault=()=>{const t=this.originalEvent;this.isDefaultPrevented=Qy.returnTrue,t&&!this.isSimulated&&t.preventDefault()},this.stopPropagation=()=>{const t=this.originalEvent;this.isPropagationStopped=Qy.returnTrue,t&&!this.isSimulated&&t.stopPropagation()},this.stopImmediatePropagation=()=>{const t=this.originalEvent;this.isImmediatePropagationStopped=Qy.returnTrue,t&&!this.isSimulated&&t.stopImmediatePropagation(),this.stopPropagation()},"string"===typeof t?this.type=t:t.type&&(this.originalEvent=t,this.type=t.type,this.isDefaultPrevented=t.defaultPrevented?Qy.returnTrue:Qy.returnFalse,this.target=t.target,this.currentTarget=t.currentTarget,this.relatedTarget=t.relatedTarget,this.timeStamp=t.timeStamp),e&&Object.assign(this,e),this.timeStamp||(this.timeStamp=Date.now())}}(function(t){function e(e){return e instanceof t?e:new t(e)}t.create=e})(eb||(eb={})),function(t){function e(e,n){Object.defineProperty(t.prototype,e,{enumerable:!0,configurable:!0,get:"function"===typeof n?function(){if(this.originalEvent)return n(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})}t.addProperty=e}(eb||(eb={})),function(t){const e={bubbles:!0,cancelable:!0,eventPhase:!0,detail:!0,view:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pageX:!0,pageY:!0,screenX:!0,screenY:!0,toElement:!0,pointerId:!0,pointerType:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,touches:!0,changedTouches:!0,targetTouches:!0,which:!0,altKey:!0,ctrlKey:!0,metaKey:!0,shiftKey:!0};Object.keys(e).forEach(n=>t.addProperty(n,e[n]))}(eb||(eb={})),function(){Zy.register("load",{noBubble:!0})}(tb||(tb={})),function(){Zy.register("beforeunload",{postDispatch(t,e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}})}(tb||(tb={})),function(){Zy.register("mouseenter",{delegateType:"mouseover",bindType:"mouseover",handle(t,e){let n;const i=e.relatedTarget,s=e.handleObj;return i&&(i===t||Qy.contains(t,i))||(e.type=s.originType,n=s.handler.call(t,e),e.type="mouseover"),n}}),Zy.register("mouseleave",{delegateType:"mouseout",bindType:"mouseout",handle(t,e){let n;const i=e.relatedTarget,s=e.handleObj;return i&&(i===t||Qy.contains(t,i))||(e.type=s.originType,n=s.handler.call(t,e),e.type="mouseout"),n}})}(tb||(tb={}));var nb,ib,sb,rb=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};(function(t){let e;function n(t,n,i,r,o){if(!Qy.isValidTarget(t))return;let a;if("function"!==typeof i){const{handler:t,selector:e}=i,n=rb(i,["handler","selector"]);i=t,o=e,a=n}const l=Ky.ensure(t);let c=l.handler;null==c&&(c=l.handler=function(n,...i){return e!==n.type?s(t,n,...i):void 0});const h=Qy.ensureHandlerId(i);Qy.splitType(n).forEach(e=>{const{originType:n,namespaces:s}=Qy.normalizeType(e);if(!n)return;let u=n,d=Zy.get(u);u=(o?d.delegateType:d.bindType)||u,d=Zy.get(u);const g=Object.assign({type:u,originType:n,data:r,selector:o,guid:h,handler:i,namespace:s.join(".")},a),p=l.events;let f=p[u];f||(f=p[u]={handlers:[],delegateCount:0},d.setup&&!1!==d.setup(t,r,s,c)||Qy.addEventListener(t,u,c)),d.add&&(Qy.removeHandlerId(g.handler),d.add(t,g),Qy.setHandlerId(g.handler,h)),o?(f.handlers.splice(f.delegateCount,0,g),f.delegateCount+=1):f.handlers.push(g)})}function i(t,e,n,s,r){const o=Ky.get(t);if(!o)return;const a=o.events;a&&(Qy.splitType(e).forEach(e=>{const{originType:l,namespaces:c}=Qy.normalizeType(e);if(!l)return void Object.keys(a).forEach(r=>{i(t,r+e,n,s,!0)});let h=l;const u=Zy.get(h);h=(s?u.delegateType:u.bindType)||h;const d=a[h];if(!d)return;const g=c.length>0?new RegExp(`(^|\\.)${c.join("\\.(?:.*\\.|)")}(\\.|$)`):null,p=d.handlers.length;for(let i=d.handlers.length-1;i>=0;i-=1){const e=d.handlers[i];!r&&l!==e.originType||n&&Qy.getHandlerId(n)!==e.guid||!(null==g||e.namespace&&g.test(e.namespace))||!(null==s||s===e.selector||"**"===s&&e.selector)||(d.handlers.splice(i,1),e.selector&&(d.delegateCount-=1),u.remove&&u.remove(t,e))}p&&0===d.handlers.length&&(u.teardown&&!1!==u.teardown(t,c,o.handler)||Qy.removeEventListener(t,h,o.handler),delete a[h])}),0===Object.keys(a).length&&Ky.remove(t))}function s(t,e,...n){const i=eb.create(e);i.delegateTarget=t;const s=Zy.get(i.type);if(s.preDispatch&&!1===s.preDispatch(t,i))return;const r=Qy.getHandlerQueue(t,i);for(let o=0,a=r.length;o<a&&!i.isPropagationStopped();o+=1){const t=r[o];i.currentTarget=t.elem;for(let e=0,s=t.handlers.length;e<s&&!i.isImmediatePropagationStopped();e+=1){const s=t.handlers[e];if(null==i.rnamespace||s.namespace&&i.rnamespace.test(s.namespace)){i.handleObj=s,i.data=s.data;const e=Zy.get(s.originType).handle,r=e?e(t.elem,i,...n):s.handler.call(t.elem,i,...n);void 0!==r&&(i.result=r,!1===r&&(i.preventDefault(),i.stopPropagation()))}}}return s.postDispatch&&s.postDispatch(t,i),i.result}function r(t,n,i,s){let r=t,o="string"===typeof t?t:t.type,a="string"===typeof t||null==r.namespace?[]:r.namespace.split(".");const l=i;if(3===l.nodeType||8===l.nodeType)return;o.indexOf(".")>-1&&(a=o.split("."),o=a.shift(),a.sort());const c=o.indexOf(":")<0&&`on${o}`;r=t instanceof eb?t:new eb(o,"object"===typeof t?t:null),r.namespace=a.join("."),r.rnamespace=r.namespace?new RegExp(`(^|\\.)${a.join("\\.(?:.*\\.|)")}(\\.|$)`):null,r.result=void 0,r.target||(r.target=l);const h=[r];Array.isArray(n)?h.push(...n):h.push(n);const u=Zy.get(o);if(!s&&u.trigger&&!1===u.trigger(l,r,n))return;let d;const g=[l];if(!s&&!u.noBubble&&!Qy.isWindow(l)){d=u.delegateType||o;let t=l,e=l.parentNode;while(null!=e)g.push(e),t=e,e=e.parentNode;const n=l.ownerDocument||document;if(t===n){const e=t.defaultView||t.parentWindow||window;g.push(e)}}let p=l;for(let e=0,f=g.length;e<f&&!r.isPropagationStopped();e+=1){const t=g[e];p=t,r.type=e>1?d:u.bindType||o;const n=Ky.get(t);n&&n.events[r.type]&&n.handler&&n.handler.call(t,...h);const i=c&&t[c]||null;i&&Qy.isValidTarget(t)&&(r.result=i.call(t,...h),!1===r.result&&r.preventDefault())}if(r.type=o,!s&&!r.isDefaultPrevented()){const t=u.preventDefault;if((null==t||!1===t(g.pop(),r,n))&&Qy.isValidTarget(l)&&c&&"function"===typeof l[o]&&!Qy.isWindow(l)){const t=l[c];t&&(l[c]=null),e=o,r.isPropagationStopped()&&p.addEventListener(o,Qy.stopPropagationCallback),l[o](),r.isPropagationStopped()&&p.removeEventListener(o,Qy.stopPropagationCallback),e=void 0,t&&(l[c]=t)}}return r.result}t.on=n,t.off=i,t.dispatch=s,t.trigger=r})(nb||(nb={})),function(t){function e(t,e,n,i,s){return sb.on(t,e,n,i,s),t}function n(t,e,n,i,s){return sb.on(t,e,n,i,s,!0),t}function i(t,e,n,i){return sb.off(t,e,n,i),t}function s(t,e,n,i){return nb.trigger(e,n,t,i),t}t.on=e,t.once=n,t.off=i,t.trigger=s}(ib||(ib={})),function(t){function e(n,i,s,r,o,a){if("object"===typeof i)return"string"!==typeof s&&(r=r||s,s=void 0),void Object.keys(i).forEach(t=>e(n,t,s,r,i[t],a));if(null==r&&null==o?(o=s,r=s=void 0):null==o&&("string"===typeof s?(o=r,r=void 0):(o=r,r=s,s=void 0)),!1===o)o=Qy.returnFalse;else if(!o)return;if(a){const e=o;o=function(i,...s){return t.off(n,i),e.call(this,i,...s)},Qy.setHandlerId(o,Qy.ensureHandlerId(e))}nb.on(n,i,o,r,s)}function n(t,e,i,s){const r=e;if(r&&null!=r.preventDefault&&null!=r.handleObj){const t=r.handleObj;return void n(r.delegateTarget,t.namespace?`${t.originType}.${t.namespace}`:t.originType,t.selector,t.handler)}if("object"===typeof e){const s=e;return void Object.keys(s).forEach(e=>n(t,e,i,s[e]))}!1!==i&&"function"!==typeof i||(s=i,i=void 0),!1===s&&(s=Qy.returnFalse),nb.off(t,e,s,i)}t.on=e,t.off=n}(sb||(sb={}));class ob{constructor(t,e,n){this.animationFrameId=0,this.deltaX=0,this.deltaY=0,this.eventName=Vf.isEventSupported("wheel")?"wheel":"mousewheel",this.target=t,this.onWheelCallback=e,this.onWheelGuard=n,this.onWheel=this.onWheel.bind(this),this.didWheel=this.didWheel.bind(this)}enable(){this.target.addEventListener(this.eventName,this.onWheel,{passive:!1})}disable(){this.target.removeEventListener(this.eventName,this.onWheel)}onWheel(t){if(null!=this.onWheelGuard&&!this.onWheelGuard(t))return;let e;this.deltaX+=t.deltaX,this.deltaY+=t.deltaY,t.preventDefault(),0===this.deltaX&&0===this.deltaY||(t.stopPropagation(),e=!0),!0===e&&0===this.animationFrameId&&(this.animationFrameId=requestAnimationFrame(()=>{this.didWheel(t)}))}didWheel(t){this.animationFrameId=0,this.onWheelCallback(t,this.deltaX,this.deltaY),this.deltaX=0,this.deltaY=0}}function ab(t){const e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView;return{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}}function lb(t){const e=t.getBoundingClientRect();return e.width}function cb(t){const e=t.getBoundingClientRect();return e.height}function hb(t){const e="fixed"===Xm(t,"position");let n;if(e){const e=t.getBoundingClientRect();n={left:e.left,top:e.top}}else n=ab(t);if(!e){const e=t.ownerDocument;let i=t.offsetParent||e.documentElement;while((i===e.body||i===e.documentElement)&&"static"===Xm(i,"position"))i=i.parentNode;if(i!==t&&ym(i)){const t=ab(i);n.top-=t.top+Ym(i,"borderTopWidth"),n.left-=t.left+Ym(i,"borderLeftWidth")}}return{top:n.top-Ym(t,"marginTop"),left:n.left-Ym(t,"marginLeft")}}function ub(t,e=60){let n=null;return(...i)=>{n&&clearTimeout(n),n=window.setTimeout(()=>{t.apply(this,i)},e)}}function db(t){let e=null,n=[];const i=()=>{if("static"===getComputedStyle(t).position){const e=t.style;e.position="relative"}const e=document.createElement("object");return e.onload=()=>{e.contentDocument.defaultView.addEventListener("resize",s),s()},e.style.display="block",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.height="100%",e.style.width="100%",e.style.overflow="hidden",e.style.pointerEvents="none",e.style.zIndex="-1",e.style.opacity="0",e.setAttribute("tabindex","-1"),e.type="text/html",t.appendChild(e),e.data="about:blank",e},s=ub(()=>{n.forEach(e=>e(t))}),r=t=>{e||(e=i()),-1===n.indexOf(t)&&n.push(t)},o=()=>{e&&e.parentNode&&(e.contentDocument&&e.contentDocument.defaultView.removeEventListener("resize",s),e.parentNode.removeChild(e),e=null,n=[])},a=t=>{const i=n.indexOf(t);-1!==i&&n.splice(i,1),0===n.length&&e&&o()};return{element:t,bind:r,destroy:o,unbind:a}}function gb(t){let e=null,n=[];const i=ub(()=>{n.forEach(e=>{e(t)})}),s=()=>{const e=new ResizeObserver(i);return e.observe(t),i(),e},r=t=>{e||(e=s()),-1===n.indexOf(t)&&n.push(t)},o=()=>{e&&(e.disconnect(),n=[],e=null)},a=t=>{const i=n.indexOf(t);-1!==i&&n.splice(i,1),0===n.length&&e&&o()};return{element:t,bind:r,destroy:o,unbind:a}}const pb="undefined"!==typeof ResizeObserver?gb:db;var fb,mb,yb,bb,vb;(function(t){const e=new WeakMap;function n(t){let n=e.get(t);return n||(n=pb(t),e.set(t,n),n)}function i(t){t.destroy(),e.delete(t.element)}t.bind=(t,e)=>{const i=n(t);return i.bind(e),()=>i.unbind(e)},t.clear=t=>{const e=n(t);i(e)}})(fb||(fb={}));class xb{constructor(t={}){this.comparator=t.comparator||xb.defaultComparator,this.index={},this.data=t.data||[],this.heapify()}isEmpty(){return 0===this.data.length}insert(t,e,n){const i={priority:t,value:e},s=this.data.length;return n&&(i.id=n,this.index[n]=s),this.data.push(i),this.bubbleUp(s),this}peek(){return this.data[0]?this.data[0].value:null}peekPriority(){return this.data[0]?this.data[0].priority:null}updatePriority(t,e){const n=this.index[t];if("undefined"===typeof n)throw new Error(`Node with id '${t}' was not found in the heap.`);const i=this.data,s=i[n].priority,r=this.comparator(e,s);r<0?(i[n].priority=e,this.bubbleUp(n)):r>0&&(i[n].priority=e,this.bubbleDown(n))}remove(){const t=this.data,e=t[0],n=t.pop();return e.id&&delete this.index[e.id],t.length>0&&(t[0]=n,n.id&&(this.index[n.id]=0),this.bubbleDown(0)),e?e.value:null}heapify(){for(let t=0;t<this.data.length;t+=1)this.bubbleUp(t)}bubbleUp(t){const e=this.data;let n,i,s=t;while(s>0){if(i=s-1>>>1,!(this.comparator(e[s].priority,e[i].priority)<0))break;{n=e[i],e[i]=e[s];let t=e[s].id;null!=t&&(this.index[t]=i),e[s]=n,t=e[s].id,null!=t&&(this.index[t]=s),s=i}}}bubbleDown(t){const e=this.data,n=e.length-1;let i=t;while(1){const t=1+(i<<1),s=t+1;let r=i;if(t<=n&&this.comparator(e[t].priority,e[r].priority)<0&&(r=t),s<=n&&this.comparator(e[s].priority,e[r].priority)<0&&(r=s),r===i)break;{const t=e[r];e[r]=e[i];let n=e[i].id;null!=n&&(this.index[n]=r),e[i]=t,n=e[i].id,null!=n&&(this.index[n]=i),i=r}}}}(function(t){t.defaultComparator=(t,e)=>t-e})(xb||(xb={})),function(t){function e(t,e,n=(t,e)=>1){const i={},s={},r={},o=new xb;i[e]=0,Object.keys(t).forEach(t=>{t!==e&&(i[t]=1/0),o.insert(i[t],t,t)});while(!o.isEmpty()){const e=o.remove();r[e]=!0;const a=t[e]||[];for(let t=0;t<a.length;t+=1){const l=a[t];if(!r[l]){const t=i[e]+n(e,l);t<i[l]&&(i[l]=t,s[l]=e,o.updatePriority(l,t))}}}return s}t.run=e}(mb||(mb={}));class wb{constructor(t,e,n,i){return null==t?this.set(255,255,255,1):"number"===typeof t?this.set(t,e,n,i):"string"===typeof t?wb.fromString(t)||this:Array.isArray(t)?this.set(t):void this.set(t.r,t.g,t.b,null==t.a?1:t.a)}blend(t,e,n){this.set(t.r+(e.r-t.r)*n,t.g+(e.g-t.g)*n,t.b+(e.b-t.b)*n,t.a+(e.a-t.a)*n)}lighten(t){const e=wb.lighten(this.toArray(),t);this.r=e[0],this.g=e[1],this.b=e[2],this.a=e[3]}darken(t){this.lighten(-t)}set(t,e,n,i){const s=Array.isArray(t)?t[0]:t,r=Array.isArray(t)?t[1]:e,o=Array.isArray(t)?t[2]:n,a=Array.isArray(t)?t[3]:i;return this.r=Math.round(bf(s,0,255)),this.g=Math.round(bf(r,0,255)),this.b=Math.round(bf(o,0,255)),this.a=null==a?1:bf(a,0,1),this}toHex(){const t=["r","g","b"].map(t=>{const e=this[t].toString(16);return e.length<2?`0${e}`:e});return`#${t.join("")}`}toRGBA(){return this.toArray()}toHSLA(){return wb.rgba2hsla(this.r,this.g,this.b,this.a)}toCSS(t){const e=`${this.r},${this.g},${this.b},`;return t?`rgb(${e})`:`rgba(${e},${this.a})`}toGrey(){return wb.makeGrey(Math.round((this.r+this.g+this.b)/3),this.a)}toArray(){return[this.r,this.g,this.b,this.a]}toString(){return this.toCSS()}}(function(t){function e(e){return new t(e)}function n(e){return new t([...p(e),1])}function i(e){const n=e.toLowerCase().match(/^rgba?\(([\s.,0-9]+)\)/);if(n){const e=n[1].split(/\s*,\s*/).map(t=>parseInt(t,10));return new t(e)}return null}function s(t,e,n){n<0&&++n,n>1&&--n;const i=6*n;return i<1?t+(e-t)*i:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function r(e){const n=e.toLowerCase().match(/^hsla?\(([\s.,0-9]+)\)/);if(n){const e=n[2].split(/\s*,\s*/),i=(parseFloat(e[0])%360+360)%360/360,s=parseFloat(e[1])/100,r=parseFloat(e[2])/100,o=null==e[3]?1:parseInt(e[3],10);return new t(c(i,s,r,o))}return null}function o(e){if(e.startsWith("#"))return n(e);if(e.startsWith("rgb"))return i(e);const s=t.named[e];return s?n(s):r(e)}function a(e,n){return t.fromArray([e,e,e,n])}function l(t,e,n,i){const s=Array.isArray(t)?t[0]:t,r=Array.isArray(t)?t[1]:e,o=Array.isArray(t)?t[2]:n,a=Array.isArray(t)?t[3]:i,l=Math.max(s,r,o),c=Math.min(s,r,o),h=(l+c)/2;let u=0,d=0;if(c!==l){const t=l-c;switch(d=h>.5?t/(2-l-c):t/(l+c),l){case s:u=(r-o)/t+(r<o?6:0);break;case r:u=(o-s)/t+2;break;case o:u=(s-r)/t+4;break;default:break}u/=6}return[u,d,h,null==a?1:a]}function c(t,e,n,i){const r=Array.isArray(t)?t[0]:t,o=Array.isArray(t)?t[1]:e,a=Array.isArray(t)?t[2]:n,l=Array.isArray(t)?t[3]:i,c=a<=.5?a*(o+1):a+o-a*o,h=2*a-c;return[256*s(h,c,r+1/3),256*s(h,c,r),256*s(h,c,r-1/3),null==l?1:l]}function h(e){return new t(Math.round(256*Math.random()),Math.round(256*Math.random()),Math.round(256*Math.random()),e?void 0:parseFloat(Math.random().toFixed(2)))}function u(){const t="0123456789ABCDEF";let e="#";for(let n=0;n<6;n+=1)e+=t[Math.floor(16*Math.random())];return e}function d(t){return h(t).toString()}function g(t,e){if("string"===typeof t){const n="#"===t[0],[i,s,r]=p(t);return e?.299*i+.587*s+.114*r>186?"#000000":"#ffffff":`${n?"#":""}${f(255-i,255-s,255-r)}`}const n=t[0],i=t[1],s=t[2],r=t[3];return e?.299*n+.587*i+.114*s>186?[0,0,0,r]:[255,255,255,r]:[255-n,255-i,255-s,r]}function p(t){const e=0===t.indexOf("#")?t:`#${t}`;let n=Number(`0x${e.substr(1)}`);if(4!==e.length&&7!==e.length||Number.isNaN(n))throw new Error("Invalid hex color.");const i=4===e.length?4:8,s=(1<<i)-1,r=["b","g","r"].map(()=>{const t=n&s;return n>>=i,4===i?17*t:t});return[r[2],r[1],r[0]]}function f(t,e,n){const i=t=>t.length<2?`0${t}`:t;return`${i(t.toString(16))}${i(e.toString(16))}${i(n.toString(16))}`}function m(t,e){return b(t,e)}function y(t,e){return b(t,-e)}function b(t,e){if("string"===typeof t){const n="#"===t[0],i=parseInt(n?t.substr(1):t,16),s=bf((i>>16)+e,0,255),r=bf((i>>8&255)+e,0,255),o=bf((255&i)+e,0,255);return`${n?"#":""}${(o|r<<8|s<<16).toString(16)}`}const n=f(t[0],t[1],t[2]),i=p(b(n,e));return[i[0],i[1],i[2],t[3]]}t.fromArray=e,t.fromHex=n,t.fromRGBA=i,t.fromHSLA=r,t.fromString=o,t.makeGrey=a,t.rgba2hsla=l,t.hsla2rgba=c,t.random=h,t.randomHex=u,t.randomRGBA=d,t.invert=g,t.lighten=m,t.darken=y})(wb||(wb={})),function(t){t.named={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",burntsienna:"#ea7e5d",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}}(wb||(wb={}));class Cb{constructor(){this.clear()}clear(){this.map=new WeakMap,this.arr=[]}has(t){return this.map.has(t)}get(t){return this.map.get(t)}set(t,e){this.map.set(t,e),this.arr.push(t)}delete(t){const e=this.arr.indexOf(t);e>=0&&this.arr.splice(e,1);const n=this.map.get(t);return this.map.delete(t),n}each(t){this.arr.forEach(e=>{const n=this.map.get(e);t(n,e)})}dispose(){this.clear()}}(function(t){function e(t){const e=[],n=[];return Array.isArray(t)?e.push(...t):t.split("|").forEach(t=>{-1===t.indexOf("&")?e.push(t):n.push(...t.split("&"))}),{or:e,and:n}}function n(t,n){if(null!=t&&null!=n){const i=e(t),s=e(n),r=i.or.sort(),o=s.or.sort(),a=i.and.sort(),l=s.and.sort(),c=(t,e)=>t.length===e.length&&(0===t.length||t.every((t,n)=>t===e[n]));return c(r,o)&&c(a,l)}return null==t&&null==n}function i(t,n,i){if(null==n||Array.isArray(n)&&0===n.length)return!i||!0!==t.altKey&&!0!==t.ctrlKey&&!0!==t.metaKey&&!0!==t.shiftKey;const{or:s,and:r}=e(n),o=e=>{const n=`${e.toLowerCase()}Key`;return!0===t[n]};return s.some(t=>o(t))&&r.every(t=>o(t))}t.parse=e,t.equals=n,t.isMatch=i})(yb||(yb={})),function(t){t.linear=t=>t,t.quad=t=>t*t,t.cubic=t=>t*t*t,t.inout=t=>{if(t<=0)return 0;if(t>=1)return 1;const e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)},t.exponential=t=>Math.pow(2,10*(t-1)),t.bounce=t=>{for(let e=0,n=1;1;e+=n,n/=2)if(t>=(7-4*e)/11){const i=(11-6*e-11*t)/4;return-i*i+n*n}}}(bb||(bb={})),function(t){t.decorators={reverse(t){return e=>1-t(1-e)},reflect(t){return e=>.5*(e<.5?t(2*e):2-t(2-2*e))},clamp(t,e=0,n=1){return i=>{const s=t(i);return s<e?e:s>n?n:s}},back(t=1.70158){return e=>e*e*((t+1)*e-t)},elastic(t=1.5){return e=>Math.pow(2,10*(e-1))*Math.cos(20*Math.PI*t/3*e)}}}(bb||(bb={})),function(t){function e(t){return-1*Math.cos(t*(Math.PI/2))+1}function n(t){return Math.sin(t*(Math.PI/2))}function i(t){return-.5*(Math.cos(Math.PI*t)-1)}function s(t){return t*t}function r(t){return t*(2-t)}function o(t){return t<.5?2*t*t:(4-2*t)*t-1}function a(t){return t*t*t}function l(t){const e=t-1;return e*e*e+1}function c(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1}function h(t){return t*t*t*t}function u(t){const e=t-1;return 1-e*e*e*e}function d(t){const e=t-1;return t<.5?8*t*t*t*t:1-8*e*e*e*e}function g(t){return t*t*t*t*t}function p(t){const e=t-1;return 1+e*e*e*e*e}function f(t){const e=t-1;return t<.5?16*t*t*t*t*t:1+16*e*e*e*e*e}function m(t){return 0===t?0:Math.pow(2,10*(t-1))}function y(t){return 1===t?1:1-Math.pow(2,-10*t)}function b(t){if(0===t||1===t)return t;const e=2*t,n=e-1;return e<1?.5*Math.pow(2,10*n):.5*(2-Math.pow(2,-10*n))}function v(t){const e=t/1;return-1*(Math.sqrt(1-e*t)-1)}function x(t){const e=t-1;return Math.sqrt(1-e*e)}function w(t){const e=2*t,n=e-2;return e<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-n*n)+1)}function C(t,e=1.70158){return t*t*((e+1)*t-e)}function P(t,e=1.70158){const n=t/1-1;return n*n*((e+1)*n+e)+1}function E(t,e=1.70158){const n=2*t,i=n-2,s=1.525*e;return n<1?.5*n*n*((s+1)*n-s):.5*(i*i*((s+1)*i+s)+2)}function M(t,e=.7){if(0===t||1===t)return t;const n=t/1,i=n-1,s=1-e,r=s/(2*Math.PI)*Math.asin(1);return-Math.pow(2,10*i)*Math.sin((i-r)*(2*Math.PI)/s)}function O(t,e=.7){const n=1-e,i=2*t;if(0===t||1===t)return t;const s=n/(2*Math.PI)*Math.asin(1);return Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/n)+1}function A(t,e=.65){const n=1-e;if(0===t||1===t)return t;const i=2*t,s=i-1,r=n/(2*Math.PI)*Math.asin(1);return i<1?Math.pow(2,10*s)*Math.sin((s-r)*(2*Math.PI)/n)*-.5:Math.pow(2,-10*s)*Math.sin((s-r)*(2*Math.PI)/n)*.5+1}function S(t){const e=t/1;if(e<1/2.75)return 7.5625*e*e;if(e<2/2.75){const t=e-1.5/2.75;return 7.5625*t*t+.75}if(e<2.5/2.75){const t=e-2.25/2.75;return 7.5625*t*t+.9375}{const t=e-2.625/2.75;return 7.5625*t*t+.984375}}function N(t){return 1-S(1-t)}function T(t){return t<.5?.5*N(2*t):.5*S(2*t-1)+.5}t.easeInSine=e,t.easeOutSine=n,t.easeInOutSine=i,t.easeInQuad=s,t.easeOutQuad=r,t.easeInOutQuad=o,t.easeInCubic=a,t.easeOutCubic=l,t.easeInOutCubic=c,t.easeInQuart=h,t.easeOutQuart=u,t.easeInOutQuart=d,t.easeInQuint=g,t.easeOutQuint=p,t.easeInOutQuint=f,t.easeInExpo=m,t.easeOutExpo=y,t.easeInOutExpo=b,t.easeInCirc=v,t.easeOutCirc=x,t.easeInOutCirc=w,t.easeInBack=C,t.easeOutBack=P,t.easeInOutBack=E,t.easeInElastic=M,t.easeOutElastic=O,t.easeInOutElastic=A,t.easeOutBounce=S,t.easeInBounce=N,t.easeInOutBounce=T}(bb||(bb={})),function(t){t.number=(t,e)=>{const n=e-t;return e=>t+n*e},t.object=(t,e)=>{const n=Object.keys(t);return i=>{const s={};for(let r=n.length-1;-1!==r;r-=1){const o=n[r];s[o]=t[o]+(e[o]-t[o])*i}return s}},t.unit=(t,e)=>{const n=/(-?[0-9]*.[0-9]*)(px|em|cm|mm|in|pt|pc|%)/,i=n.exec(t),s=n.exec(e),r=s?s[1]:"",o=i?+i[1]:0,a=s?+s[1]:0,l=r.indexOf("."),c=l>0?r[1].length-l-1:0,h=a-o,u=i?i[2]:"";return t=>(o+h*t).toFixed(c)+u},t.color=(t,e)=>{const n=parseInt(t.slice(1),16),i=parseInt(e.slice(1),16),s=255&n,r=(255&i)-s,o=65280&n,a=(65280&i)-o,l=16711680&n,c=(16711680&i)-l;return t=>{const e=s+r*t&255,n=o+a*t&65280,i=l+c*t&16711680;return`#${(1<<24|e|n|i).toString(16).slice(1)}`}}}(vb||(vb={}));const Pb=[];function Eb(t,e){const n=Pb.find(e=>e.name===t);if(!(n&&(n.loadTimes+=1,n.loadTimes>1))&&!Vf.isApplyingHMR()){const n=document.createElement("style");n.setAttribute("type","text/css"),n.textContent=e;const i=document.querySelector("head");i&&i.insertBefore(n,i.firstChild),Pb.push({name:t,loadTimes:1,styleElement:n})}}function Mb(t){const e=Pb.findIndex(e=>e.name===t);if(e>-1){const t=Pb[e];if(t.loadTimes-=1,t.loadTimes>0)return;let n=t.styleElement;n&&n.parentNode&&n.parentNode.removeChild(n),n=null,Pb.splice(e,1)}}var Ob,Ab;(function(t){function e(t){return 180*t/Math.PI%360}function n(t){return t%360+(t<0?360:0)}t.toDeg=e,t.toRad=function(t,e=!1){const n=e?t:t%360;return n*Math.PI/180},t.normalize=n})(Ob||(Ob={})),function(t){function e(t,e=0){return Number.isInteger(t)?t:+t.toFixed(e)}function n(t,e){let n,i;if(null==e?(i=null==t?1:t,n=0):(i=e,n=null==t?0:t),i<n){const t=n;n=i,i=t}return Math.floor(Math.random()*(i-n+1)+n)}function i(t,e,n){return Number.isNaN(t)?NaN:Number.isNaN(e)||Number.isNaN(n)?0:e<n?t<e?e:t>n?n:t:t<n?n:t>e?e:t}function s(t,e){return e*Math.round(t/e)}function r(t,e){return null!=e&&null!=t&&e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height}function o(t,e){const n=t.x-e.x,i=t.y-e.y;return n*n+i*i}t.round=e,t.random=n,t.clamp=i,t.snapToGrid=s,t.containsPoint=r,t.squaredLength=o}(Ab||(Ab={}));class Sb{valueOf(){return this.toJSON()}toString(){return JSON.stringify(this.toJSON())}}class Nb extends Sb{constructor(t,e){super(),this.x=null==t?0:t,this.y=null==e?0:e}round(t=0){return this.x=Ab.round(this.x,t),this.y=Ab.round(this.y,t),this}add(t,e){const n=Nb.create(t,e);return this.x+=n.x,this.y+=n.y,this}update(t,e){const n=Nb.create(t,e);return this.x=n.x,this.y=n.y,this}translate(t,e){const n=Nb.create(t,e);return this.x+=n.x,this.y+=n.y,this}rotate(t,e){const n=Nb.rotate(this,t,e);return this.x=n.x,this.y=n.y,this}scale(t,e,n=new Nb){const i=Nb.create(n);return this.x=i.x+t*(this.x-i.x),this.y=i.y+e*(this.y-i.y),this}closest(t){if(1===t.length)return Nb.create(t[0]);let e=null,n=1/0;return t.forEach(t=>{const i=this.squaredDistance(t);i<n&&(e=t,n=i)}),e?Nb.create(e):null}distance(t){return Math.sqrt(this.squaredDistance(t))}squaredDistance(t){const e=Nb.create(t),n=this.x-e.x,i=this.y-e.y;return n*n+i*i}manhattanDistance(t){const e=Nb.create(t);return Math.abs(e.x-this.x)+Math.abs(e.y-this.y)}magnitude(){return Math.sqrt(this.x*this.x+this.y*this.y)||.01}theta(t=new Nb){const e=Nb.create(t),n=-(e.y-this.y),i=e.x-this.x;let s=Math.atan2(n,i);return s<0&&(s=2*Math.PI+s),180*s/Math.PI}angleBetween(t,e){if(this.equals(t)||this.equals(e))return NaN;let n=this.theta(e)-this.theta(t);return n<0&&(n+=360),n}vectorAngle(t){const e=new Nb(0,0);return e.angleBetween(this,t)}toPolar(t){return this.update(Nb.toPolar(this,t)),this}changeInAngle(t,e,n=new Nb){return this.clone().translate(-t,-e).theta(n)-this.theta(n)}adhereToRect(t){return Ab.containsPoint(t,this)||(this.x=Math.min(Math.max(this.x,t.x),t.x+t.width),this.y=Math.min(Math.max(this.y,t.y),t.y+t.height)),this}bearing(t){const e=Nb.create(t),n=Ob.toRad(this.y),i=Ob.toRad(e.y),s=this.x,r=e.x,o=Ob.toRad(r-s),a=Math.sin(o)*Math.cos(i),l=Math.cos(n)*Math.sin(i)-Math.sin(n)*Math.cos(i)*Math.cos(o),c=Ob.toDeg(Math.atan2(a,l)),h=["NE","E","SE","S","SW","W","NW","N"];let u=c-22.5;return u<0&&(u+=360),u=parseInt(u/45,10),h[u]}cross(t,e){if(null!=t&&null!=e){const n=Nb.create(t),i=Nb.create(e);return(i.x-this.x)*(n.y-this.y)-(i.y-this.y)*(n.x-this.x)}return NaN}dot(t){const e=Nb.create(t);return this.x*e.x+this.y*e.y}diff(t,e){if("number"===typeof t)return new Nb(this.x-t,this.y-e);const n=Nb.create(t);return new Nb(this.x-n.x,this.y-n.y)}lerp(t,e){const n=Nb.create(t);return new Nb((1-e)*this.x+e*n.x,(1-e)*this.y+e*n.y)}normalize(t=1){const e=t/this.magnitude();return this.scale(e,e)}move(t,e){const n=Nb.create(t),i=Ob.toRad(n.theta(this));return this.translate(Math.cos(i)*e,-Math.sin(i)*e)}reflection(t){return Nb.create(t).move(this,this.distance(t))}snapToGrid(t,e){return this.x=Ab.snapToGrid(this.x,t),this.y=Ab.snapToGrid(this.y,null==e?t:e),this}equals(t){const e=Nb.create(t);return null!=e&&e.x===this.x&&e.y===this.y}clone(){return Nb.clone(this)}toJSON(){return Nb.toJSON(this)}serialize(){return`${this.x} ${this.y}`}}(function(t){function e(e){return null!=e&&e instanceof t}t.isPoint=e})(Nb||(Nb={})),function(t){function e(t){return null!=t&&"object"===typeof t&&"number"===typeof t.x&&"number"===typeof t.y}function n(t){return null!=t&&Array.isArray(t)&&2===t.length&&"number"===typeof t[0]&&"number"===typeof t[1]}t.isPointLike=e,t.isPointData=n}(Nb||(Nb={})),function(t){function e(e,i){return null==e||"number"===typeof e?new t(e,i):n(e)}function n(e){return t.isPoint(e)?new t(e.x,e.y):Array.isArray(e)?new t(e[0],e[1]):new t(e.x,e.y)}function i(e){return t.isPoint(e)?{x:e.x,y:e.y}:Array.isArray(e)?{x:e[0],y:e[1]}:{x:e.x,y:e.y}}function s(e,i,s=new t){let r=Math.abs(e*Math.cos(i)),o=Math.abs(e*Math.sin(i));const a=n(s),l=Ob.normalize(Ob.toDeg(i));return l<90?o=-o:l<180?(r=-r,o=-o):l<270&&(r=-r),new t(a.x+r,a.y+o)}function r(e,i=new t){const s=n(e),r=n(i),o=s.x-r.x,a=s.y-r.y;return new t(Math.sqrt(o*o+a*a),Ob.toRad(r.theta(s)))}function o(t,e){return t===e||null!=t&&null!=e&&(t.x===e.x&&t.y===e.y)}function a(t,e){if(null==t&&null!=e||null!=t&&null==e||null!=t&&null!=e&&t.length!==e.length)return!1;if(null!=t&&null!=e)for(let n=0,i=t.length;n<i;n+=1)if(!o(t[n],e[n]))return!1;return!0}function l(e,n,i,s){return new t(Ab.random(e,n),Ab.random(i,s))}function c(t,e,n){const i=Ob.toRad(Ob.normalize(-e)),s=Math.sin(i),r=Math.cos(i);return h(t,r,s,n)}function h(e,i,s,r=new t){const o=n(e),a=n(r),l=o.x-a.x,c=o.y-a.y,h=l*i-c*s,u=c*i+l*s;return new t(h+a.x,u+a.y)}t.create=e,t.clone=n,t.toJSON=i,t.fromPolar=s,t.toPolar=r,t.equals=o,t.equalPoints=a,t.random=l,t.rotate=c,t.rotateEx=h}(Nb||(Nb={}));class Tb extends Sb{get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get origin(){return new Nb(this.x,this.y)}get topLeft(){return new Nb(this.x,this.y)}get topCenter(){return new Nb(this.x+this.width/2,this.y)}get topRight(){return new Nb(this.x+this.width,this.y)}get center(){return new Nb(this.x+this.width/2,this.y+this.height/2)}get bottomLeft(){return new Nb(this.x,this.y+this.height)}get bottomCenter(){return new Nb(this.x+this.width/2,this.y+this.height)}get bottomRight(){return new Nb(this.x+this.width,this.y+this.height)}get corner(){return new Nb(this.x+this.width,this.y+this.height)}get rightMiddle(){return new Nb(this.x+this.width,this.y+this.height/2)}get leftMiddle(){return new Nb(this.x,this.y+this.height/2)}get topLine(){return new kb(this.topLeft,this.topRight)}get rightLine(){return new kb(this.topRight,this.bottomRight)}get bottomLine(){return new kb(this.bottomLeft,this.bottomRight)}get leftLine(){return new kb(this.topLeft,this.bottomLeft)}constructor(t,e,n,i){super(),this.x=null==t?0:t,this.y=null==e?0:e,this.width=null==n?0:n,this.height=null==i?0:i}getOrigin(){return this.origin}getTopLeft(){return this.topLeft}getTopCenter(){return this.topCenter}getTopRight(){return this.topRight}getCenter(){return this.center}getCenterX(){return this.x+this.width/2}getCenterY(){return this.y+this.height/2}getBottomLeft(){return this.bottomLeft}getBottomCenter(){return this.bottomCenter}getBottomRight(){return this.bottomRight}getCorner(){return this.corner}getRightMiddle(){return this.rightMiddle}getLeftMiddle(){return this.leftMiddle}getTopLine(){return this.topLine}getRightLine(){return this.rightLine}getBottomLine(){return this.bottomLine}getLeftLine(){return this.leftLine}bbox(t){if(!t)return this.clone();const e=Ob.toRad(t),n=Math.abs(Math.sin(e)),i=Math.abs(Math.cos(e)),s=this.width*i+this.height*n,r=this.width*n+this.height*i;return new Tb(this.x+(this.width-s)/2,this.y+(this.height-r)/2,s,r)}round(t=0){return this.x=Ab.round(this.x,t),this.y=Ab.round(this.y,t),this.width=Ab.round(this.width,t),this.height=Ab.round(this.height,t),this}add(t,e,n,i){const s=Tb.create(t,e,n,i),r=Math.min(this.x,s.x),o=Math.min(this.y,s.y),a=Math.max(this.x+this.width,s.x+s.width),l=Math.max(this.y+this.height,s.y+s.height);return this.x=r,this.y=o,this.width=a-r,this.height=l-o,this}update(t,e,n,i){const s=Tb.create(t,e,n,i);return this.x=s.x,this.y=s.y,this.width=s.width,this.height=s.height,this}inflate(t,e){const n=t,i=null!=e?e:t;return this.x-=n,this.y-=i,this.width+=2*n,this.height+=2*i,this}snapToGrid(t,e){const n=this.origin.snapToGrid(t,e),i=this.corner.snapToGrid(t,e);return this.x=n.x,this.y=n.y,this.width=i.x-n.x,this.height=i.y-n.y,this}translate(t,e){const n=Nb.create(t,e);return this.x+=n.x,this.y+=n.y,this}scale(t,e,n=new Nb){const i=this.origin.scale(t,e,n);return this.x=i.x,this.y=i.y,this.width*=t,this.height*=e,this}rotate(t,e=this.getCenter()){if(0!==t){const n=Ob.toRad(t),i=Math.cos(n),s=Math.sin(n);let r=this.getOrigin(),o=this.getTopRight(),a=this.getBottomRight(),l=this.getBottomLeft();r=Nb.rotateEx(r,i,s,e),o=Nb.rotateEx(o,i,s,e),a=Nb.rotateEx(a,i,s,e),l=Nb.rotateEx(l,i,s,e);const c=new Tb(r.x,r.y,0,0);c.add(o.x,o.y,0,0),c.add(a.x,a.y,0,0),c.add(l.x,l.y,0,0),this.update(c)}return this}rotate90(){const t=(this.width-this.height)/2;this.x+=t,this.y-=t;const e=this.width;return this.width=this.height,this.height=e,this}moveAndExpand(t){const e=Tb.clone(t);return this.x+=e.x||0,this.y+=e.y||0,this.width+=e.width||0,this.height+=e.height||0,this}getMaxScaleToFit(t,e=this.center){const n=Tb.clone(t),i=e.x,s=e.y;let r=1/0,o=1/0,a=1/0,l=1/0,c=1/0,h=1/0,u=1/0,d=1/0;const g=n.topLeft;g.x<i&&(r=(this.x-i)/(g.x-i)),g.y<s&&(c=(this.y-s)/(g.y-s));const p=n.bottomRight;p.x>i&&(o=(this.x+this.width-i)/(p.x-i)),p.y>s&&(h=(this.y+this.height-s)/(p.y-s));const f=n.topRight;f.x>i&&(a=(this.x+this.width-i)/(f.x-i)),f.y<s&&(u=(this.y-s)/(f.y-s));const m=n.bottomLeft;return m.x<i&&(l=(this.x-i)/(m.x-i)),m.y>s&&(d=(this.y+this.height-s)/(m.y-s)),{sx:Math.min(r,o,a,l),sy:Math.min(c,h,u,d)}}getMaxUniformScaleToFit(t,e=this.center){const n=this.getMaxScaleToFit(t,e);return Math.min(n.sx,n.sy)}containsPoint(t,e){return Ab.containsPoint(this,Nb.create(t,e))}containsRect(t,e,n,i){const s=Tb.create(t,e,n,i),r=this.x,o=this.y,a=this.width,l=this.height,c=s.x,h=s.y,u=s.width,d=s.height;return 0!==a&&0!==l&&0!==u&&0!==d&&(c>=r&&h>=o&&c+u<=r+a&&h+d<=o+l)}intersectsWithLine(t){const e=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],n=[],i=[];return e.forEach(e=>{const s=t.intersectsWithLine(e);null!==s&&i.indexOf(s.toString())<0&&(n.push(s),i.push(s.toString()))}),n.length>0?n:null}intersectsWithLineFromCenterToPoint(t,e){const n=Nb.clone(t),i=this.center;let s=null;null!=e&&0!==e&&n.rotate(e,i);const r=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],o=new kb(i,n);for(let a=r.length-1;a>=0;a-=1){const t=r[a].intersectsWithLine(o);if(null!==t){s=t;break}}return s&&null!=e&&0!==e&&s.rotate(-e,i),s}intersectsWithRect(t,e,n,i){const s=Tb.create(t,e,n,i);if(!this.isIntersectWithRect(s))return null;const r=this.origin,o=this.corner,a=s.origin,l=s.corner,c=Math.max(r.x,a.x),h=Math.max(r.y,a.y);return new Tb(c,h,Math.min(o.x,l.x)-c,Math.min(o.y,l.y)-h)}isIntersectWithRect(t,e,n,i){const s=Tb.create(t,e,n,i),r=this.origin,o=this.corner,a=s.origin,l=s.corner;return!(l.x<=r.x||l.y<=r.y||a.x>=o.x||a.y>=o.y)}normalize(){let t=this.x,e=this.y,n=this.width,i=this.height;return this.width<0&&(t=this.x+this.width,n=-this.width),this.height<0&&(e=this.y+this.height,i=-this.height),this.x=t,this.y=e,this.width=n,this.height=i,this}union(t){const e=Tb.clone(t),n=this.origin,i=this.corner,s=e.origin,r=e.corner,o=Math.min(n.x,s.x),a=Math.min(n.y,s.y),l=Math.max(i.x,r.x),c=Math.max(i.y,r.y);return new Tb(o,a,l-o,c-a)}getNearestSideToPoint(t){const e=Nb.clone(t),n=e.x-this.x,i=this.x+this.width-e.x,s=e.y-this.y,r=this.y+this.height-e.y;let o=n,a="left";return i<o&&(o=i,a="right"),s<o&&(o=s,a="top"),r<o&&(a="bottom"),a}getNearestPointToPoint(t){const e=Nb.clone(t);if(this.containsPoint(e)){const t=this.getNearestSideToPoint(e);if("left"===t)return new Nb(this.x,e.y);if("top"===t)return new Nb(e.x,this.y);if("right"===t)return new Nb(this.x+this.width,e.y);if("bottom"===t)return new Nb(e.x,this.y+this.height)}return e.adhereToRect(this)}equals(t){return null!=t&&t.x===this.x&&t.y===this.y&&t.width===this.width&&t.height===this.height}clone(){return new Tb(this.x,this.y,this.width,this.height)}toJSON(){return{x:this.x,y:this.y,width:this.width,height:this.height}}serialize(){return`${this.x} ${this.y} ${this.width} ${this.height}`}}(function(t){function e(e){return null!=e&&e instanceof t}t.isRectangle=e})(Tb||(Tb={})),function(t){function e(t){return null!=t&&"object"===typeof t&&"number"===typeof t.x&&"number"===typeof t.y&&"number"===typeof t.width&&"number"===typeof t.height}t.isRectangleLike=e}(Tb||(Tb={})),function(t){function e(e,i,s,r){return null==e||"number"===typeof e?new t(e,i,s,r):n(e)}function n(e){return t.isRectangle(e)?e.clone():Array.isArray(e)?new t(e[0],e[1],e[2],e[3]):new t(e.x,e.y,e.width,e.height)}function i(e){return new t(e.x-e.a,e.y-e.b,2*e.a,2*e.b)}function s(e){return new t(0,0,e.width,e.height)}function r(e,n){return new t(e.x,e.y,n.width,n.height)}t.create=e,t.clone=n,t.fromEllipse=i,t.fromSize=s,t.fromPositionAndSize=r}(Tb||(Tb={}));class kb extends Sb{get center(){return new Nb((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}constructor(t,e,n,i){super(),"number"===typeof t&&"number"===typeof e?(this.start=new Nb(t,e),this.end=new Nb(n,i)):(this.start=Nb.create(t),this.end=Nb.create(e))}getCenter(){return this.center}round(t=0){return this.start.round(t),this.end.round(t),this}translate(t,e){return"number"===typeof t?(this.start.translate(t,e),this.end.translate(t,e)):(this.start.translate(t),this.end.translate(t)),this}rotate(t,e){return this.start.rotate(t,e),this.end.rotate(t,e),this}scale(t,e,n){return this.start.scale(t,e,n),this.end.scale(t,e,n),this}length(){return Math.sqrt(this.squaredLength())}squaredLength(){const t=this.start.x-this.end.x,e=this.start.y-this.end.y;return t*t+e*e}setLength(t){const e=this.length();if(!e)return this;const n=t/e;return this.scale(n,n,this.start)}parallel(t){const e=this.clone();if(!e.isDifferentiable())return e;const{start:n,end:i}=e,s=n.clone().rotate(270,i),r=i.clone().rotate(90,n);return n.move(r,t),i.move(s,t),e}vector(){return new Nb(this.end.x-this.start.x,this.end.y-this.start.y)}angle(){const t=new Nb(this.start.x+1,this.start.y);return this.start.angleBetween(this.end,t)}bbox(){const t=Math.min(this.start.x,this.end.x),e=Math.min(this.start.y,this.end.y),n=Math.max(this.start.x,this.end.x),i=Math.max(this.start.y,this.end.y);return new Tb(t,e,n-t,i-e)}bearing(){return this.start.bearing(this.end)}closestPoint(t){return this.pointAt(this.closestPointNormalizedLength(t))}closestPointLength(t){return this.closestPointNormalizedLength(t)*this.length()}closestPointTangent(t){return this.tangentAt(this.closestPointNormalizedLength(t))}closestPointNormalizedLength(t){const e=this.vector().dot(new kb(this.start,t).vector()),n=Math.min(1,Math.max(0,e/this.squaredLength()));return Number.isNaN(n)?0:n}pointAt(t){const e=this.start,n=this.end;return t<=0?e.clone():t>=1?n.clone():e.lerp(n,t)}pointAtLength(t){const e=this.start,n=this.end;let i=!0;t<0&&(i=!1,t=-t);const s=this.length();if(t>=s)return i?n.clone():e.clone();const r=(i?t:s-t)/s;return this.pointAt(r)}divideAt(t){const e=this.pointAt(t);return[new kb(this.start,e),new kb(e,this.end)]}divideAtLength(t){const e=this.pointAtLength(t);return[new kb(this.start,e),new kb(e,this.end)]}containsPoint(t){const e=this.start,n=this.end;if(0!==e.cross(t,n))return!1;const i=this.length();return!(new kb(e,t).length()>i)&&!(new kb(t,n).length()>i)}intersect(t,e){const n=t.intersectsWithLine(this,e);return n?Array.isArray(n)?n:[n]:null}intersectsWithLine(t){const e=new Nb(this.end.x-this.start.x,this.end.y-this.start.y),n=new Nb(t.end.x-t.start.x,t.end.y-t.start.y),i=e.x*n.y-e.y*n.x,s=new Nb(t.start.x-this.start.x,t.start.y-this.start.y),r=s.x*n.y-s.y*n.x,o=s.x*e.y-s.y*e.x;if(0===i||r*i<0||o*i<0)return null;if(i>0){if(r>i||o>i)return null}else if(r<i||o<i)return null;return new Nb(this.start.x+r*e.x/i,this.start.y+r*e.y/i)}isDifferentiable(){return!this.start.equals(this.end)}pointOffset(t){const e=Nb.clone(t),n=this.start,i=this.end,s=(i.x-n.x)*(e.y-n.y)-(i.y-n.y)*(e.x-n.x);return s/this.length()}pointSquaredDistance(t,e){const n=Nb.create(t,e);return this.closestPoint(n).squaredDistance(n)}pointDistance(t,e){const n=Nb.create(t,e);return this.closestPoint(n).distance(n)}tangentAt(t){if(!this.isDifferentiable())return null;const e=this.start,n=this.end,i=this.pointAt(t),s=new kb(e,n);return s.translate(i.x-e.x,i.y-e.y),s}tangentAtLength(t){if(!this.isDifferentiable())return null;const e=this.start,n=this.end,i=this.pointAtLength(t),s=new kb(e,n);return s.translate(i.x-e.x,i.y-e.y),s}relativeCcw(t,e){const n=Nb.create(t,e);let i=n.x-this.start.x,s=n.y-this.start.y;const r=this.end.x-this.start.x,o=this.end.y-this.start.y;let a=i*o-s*r;return 0===a&&(a=i*r+s*o,a>0&&(i-=r,s-=o,a=i*r+s*o,a<0&&(a=0))),a<0?-1:a>0?1:0}equals(t){return null!=t&&this.start.x===t.start.x&&this.start.y===t.start.y&&this.end.x===t.end.x&&this.end.y===t.end.y}clone(){return new kb(this.start,this.end)}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.end.serialize()].join(" ")}}(function(t){function e(e){return null!=e&&e instanceof t}t.isLine=e})(kb||(kb={}));class jb extends Sb{get center(){return new Nb(this.x,this.y)}constructor(t,e,n,i){super(),this.x=null==t?0:t,this.y=null==e?0:e,this.a=null==n?0:n,this.b=null==i?0:i}bbox(){return Tb.fromEllipse(this)}getCenter(){return this.center}inflate(t,e){const n=t,i=null!=e?e:t;return this.a+=2*n,this.b+=2*i,this}normalizedDistance(t,e){const n=Nb.create(t,e),i=n.x-this.x,s=n.y-this.y,r=this.a,o=this.b;return i*i/(r*r)+s*s/(o*o)}containsPoint(t,e){return this.normalizedDistance(t,e)<=1}intersectsWithLine(t){const e=[],n=this.a,i=this.b,s=t.start,r=t.end,o=t.vector(),a=s.diff(new Nb(this.x,this.y)),l=new Nb(o.x/(n*n),o.y/(i*i)),c=new Nb(a.x/(n*n),a.y/(i*i)),h=o.dot(l),u=o.dot(c),d=a.dot(c)-1,g=u*u-h*d;if(g<0)return null;if(g>0){const t=Math.sqrt(g),n=(-u-t)/h,i=(-u+t)/h;if((n<0||n>1)&&(i<0||i>1))return null;n>=0&&n<=1&&e.push(s.lerp(r,n)),i>=0&&i<=1&&e.push(s.lerp(r,i))}else{const t=-u/h;if(!(t>=0&&t<=1))return null;e.push(s.lerp(r,t))}return e}intersectsWithLineFromCenterToPoint(t,e=0){const n=Nb.clone(t);e&&n.rotate(e,this.getCenter());const i=n.x-this.x,s=n.y-this.y;let r;if(0===i)return r=this.bbox().getNearestPointToPoint(n),e?r.rotate(-e,this.getCenter()):r;const o=s/i,a=o*o,l=this.a*this.a,c=this.b*this.b;let h=Math.sqrt(1/(1/l+a/c));h=i<0?-h:h;const u=o*h;return r=new Nb(this.x+h,this.y+u),e?r.rotate(-e,this.getCenter()):r}tangentTheta(t){const e=Nb.clone(t),n=e.x,i=e.y,s=this.a,r=this.b,o=this.bbox().center,a=o.x,l=o.y,c=30,h=n>o.x+s/2,u=n<o.x-s/2;let d,g;return h||u?(g=n>o.x?i-c:i+c,d=s*s/(n-a)-s*s*(i-l)*(g-l)/(r*r*(n-a))+a):(d=i>o.y?n+c:n-c,g=r*r/(i-l)-r*r*(n-a)*(d-a)/(s*s*(i-l))+l),new Nb(d,g).theta(e)}scale(t,e){return this.a*=t,this.b*=e,this}rotate(t,e){const n=Tb.fromEllipse(this);n.rotate(t,e);const i=jb.fromRect(n);return this.a=i.a,this.b=i.b,this.x=i.x,this.y=i.y,this}translate(t,e){const n=Nb.create(t,e);return this.x+=n.x,this.y+=n.y,this}equals(t){return null!=t&&t.x===this.x&&t.y===this.y&&t.a===this.a&&t.b===this.b}clone(){return new jb(this.x,this.y,this.a,this.b)}toJSON(){return{x:this.x,y:this.y,a:this.a,b:this.b}}serialize(){return`${this.x} ${this.y} ${this.a} ${this.b}`}}(function(t){function e(e){return null!=e&&e instanceof t}t.isEllipse=e})(jb||(jb={})),function(t){function e(e,i,s,r){return null==e||"number"===typeof e?new t(e,i,s,r):n(e)}function n(e){return t.isEllipse(e)?e.clone():Array.isArray(e)?new t(e[0],e[1],e[2],e[3]):new t(e.x,e.y,e.a,e.b)}function i(e){const n=e.center;return new t(n.x,n.y,e.width/2,e.height/2)}t.create=e,t.parse=n,t.fromRect=i}(jb||(jb={}));const Lb=new RegExp("^[\\s\\dLMCZz,.]*$");function Db(t){return"string"===typeof t&&Lb.test(t)}function Bb(t,e){return(t%e+e)%e}function Ib(t,e,n,i,s){const r=[],o=t[t.length-1],a=null!=e&&e>0,l=e||0;if(i&&a){t=t.slice();const e=t[0],n=new Nb(o.x+(e.x-o.x)/2,o.y+(e.y-o.y)/2);t.splice(0,0,n)}let c=t[0],h=1;n?r.push("M",c.x,c.y):r.push("L",c.x,c.y);while(h<(i?t.length:t.length-1)){let e=t[Bb(h,t.length)],n=c.x-e.x,i=c.y-e.y;if(a&&(0!==n||0!==i)&&(null==s||s.indexOf(h-1)<0)){let s=Math.sqrt(n*n+i*i);const o=n*Math.min(l,s/2)/s,a=i*Math.min(l,s/2)/s,c=e.x+o,u=e.y+a;r.push("L",c,u);let d=t[Bb(h+1,t.length)];while(h<t.length-2&&0===Math.round(d.x-e.x)&&0===Math.round(d.y-e.y))d=t[Bb(h+2,t.length)],h+=1;n=d.x-e.x,i=d.y-e.y,s=Math.max(1,Math.sqrt(n*n+i*i));const g=n*Math.min(l,s/2)/s,p=i*Math.min(l,s/2)/s,f=e.x+g,m=e.y+p;r.push("Q",e.x,e.y,f,m),e=new Nb(f,m)}else r.push("L",e.x,e.y);c=e,h+=1}return i?r.push("Z"):r.push("L",o.x,o.y),r.map(t=>"string"===typeof t?t:+t.toFixed(3)).join(" ")}function Rb(t,e={}){const n=[];return t&&t.length&&t.forEach(t=>{Array.isArray(t)?n.push({x:t[0],y:t[1]}):n.push({x:t.x,y:t.y})}),Ib(n,e.round,null==e.initialMove||e.initialMove,e.close,e.exclude)}function Vb(t,e,n,i,s=0,r=0,o=0,a,l){if(0===n||0===i)return[];a-=t,l-=e,n=Math.abs(n),i=Math.abs(i);const c=-a/2,h=-l/2,u=Math.cos(s*Math.PI/180),d=Math.sin(s*Math.PI/180),g=u*c+d*h,p=-1*d*c+u*h,f=g*g,m=p*p,y=n*n,b=i*i,v=f/y+m/b;let x;if(v>1)n=Math.sqrt(v)*n,i=Math.sqrt(v)*i,x=0;else{let t=1;r===o&&(t=-1),x=t*Math.sqrt((y*b-y*m-b*f)/(y*m+b*f))}const w=x*n*p/i,C=-1*x*i*g/n,P=u*w-d*C+a/2,E=d*w+u*C+l/2;let M=Math.atan2((p-C)/i,(g-w)/n)-Math.atan2(0,1),O=M>=0?M:2*Math.PI+M;M=Math.atan2((-p-C)/i,(-g-w)/n)-Math.atan2((p-C)/i,(g-w)/n);let A=M>=0?M:2*Math.PI+M;0===o&&A>0?A-=2*Math.PI:0!==o&&A<0&&(A+=2*Math.PI);const S=2*A/Math.PI,N=Math.ceil(S<0?-1*S:S),T=A/N,k=8/3*Math.sin(T/4)*Math.sin(T/4)/Math.sin(T/2),j=u*n,L=u*i,D=d*n,B=d*i;let I=Math.cos(O),R=Math.sin(O),V=-k*(j*R+B*I),z=-k*(D*R-L*I),$=0,F=0;const G=[];for(let _=0;_<N;_+=1){O+=T,I=Math.cos(O),R=Math.sin(O),$=j*I-B*R+P,F=D*I+L*R+E;const n=-k*(j*R+B*I),i=-k*(D*R-L*I),s=6*_;G[s]=Number(V+t),G[s+1]=Number(z+e),G[s+2]=Number($-n+t),G[s+3]=Number(F-i+e),G[s+4]=Number($+t),G[s+5]=Number(F+e),V=$+n,z=F+i}return G.map(t=>+t.toFixed(2))}function zb(t,e,n,i,s=0,r=0,o=0,a,l){const c=[],h=Vb(t,e,n,i,s,r,o,a,l);if(null!=h)for(let u=0,d=h.length;u<d;u+=6)c.push("C",h[u],h[u+1],h[u+2],h[u+3],h[u+4],h[u+5]);return c.join(" ")}class $b extends Sb{get start(){return this.points[0]||null}get end(){return this.points[this.points.length-1]||null}constructor(t){if(super(),null!=t){if("string"===typeof t)return $b.parse(t);this.points=t.map(t=>Nb.create(t))}else this.points=[]}scale(t,e,n=new Nb){return this.points.forEach(i=>i.scale(t,e,n)),this}rotate(t,e){return this.points.forEach(n=>n.rotate(t,e)),this}translate(t,e){const n=Nb.create(t,e);return this.points.forEach(t=>t.translate(n.x,n.y)),this}round(t=0){return this.points.forEach(e=>e.round(t)),this}bbox(){if(0===this.points.length)return new Tb;let t=1/0,e=-1/0,n=1/0,i=-1/0;const s=this.points;for(let r=0,o=s.length;r<o;r+=1){const o=s[r],a=o.x,l=o.y;a<t&&(t=a),a>e&&(e=a),l<n&&(n=l),l>i&&(i=l)}return new Tb(t,n,e-t,i-n)}closestPoint(t){const e=this.closestPointLength(t);return this.pointAtLength(e)}closestPointLength(t){const e=this.points,n=e.length;if(0===n||1===n)return 0;let i=0,s=0,r=1/0;for(let o=0,a=n-1;o<a;o+=1){const n=new kb(e[o],e[o+1]),a=n.length(),l=n.closestPointNormalizedLength(t),c=n.pointAt(l),h=c.squaredDistance(t);h<r&&(r=h,s=i+l*a),i+=a}return s}closestPointNormalizedLength(t){const e=this.length();if(0===e)return 0;const n=this.closestPointLength(t);return n/e}closestPointTangent(t){const e=this.closestPointLength(t);return this.tangentAtLength(e)}containsPoint(t){if(0===this.points.length)return!1;const e=Nb.clone(t),n=e.x,i=e.y,s=this.points,r=s.length;let o=r-1,a=0;for(let l=0;l<r;l+=1){const r=s[o],c=s[l];if(e.equals(r))return!0;const h=new kb(r,c);if(h.containsPoint(t))return!0;if(i<=r.y&&i>c.y||i>r.y&&i<=c.y){const e=r.x-n>c.x-n?r.x-n:c.x-n;if(e>=0){const s=new Nb(n+e,i),r=new kb(t,s);h.intersectsWithLine(r)&&(a+=1)}}o=l}return a%2===1}intersectsWithLine(t){const e=[];for(let n=0,i=this.points.length-1;n<i;n+=1){const i=this.points[n],s=this.points[n+1],r=t.intersectsWithLine(new kb(i,s));r&&e.push(r)}return e.length>0?e:null}isDifferentiable(){for(let t=0,e=this.points.length-1;t<e;t+=1){const e=this.points[t],n=this.points[t+1],i=new kb(e,n);if(i.isDifferentiable())return!0}return!1}length(){let t=0;for(let e=0,n=this.points.length-1;e<n;e+=1){const n=this.points[e],i=this.points[e+1];t+=n.distance(i)}return t}pointAt(t){const e=this.points,n=e.length;if(0===n)return null;if(1===n)return e[0].clone();if(t<=0)return e[0].clone();if(t>=1)return e[n-1].clone();const i=this.length(),s=i*t;return this.pointAtLength(s)}pointAtLength(t){const e=this.points,n=e.length;if(0===n)return null;if(1===n)return e[0].clone();let i=!0;t<0&&(i=!1,t=-t);let s=0;for(let o=0,a=n-1;o<a;o+=1){const n=i?o:a-1-o,r=e[n],l=e[n+1],c=new kb(r,l),h=r.distance(l);if(t<=s+h)return c.pointAtLength((i?1:-1)*(t-s));s+=h}const r=i?e[n-1]:e[0];return r.clone()}tangentAt(t){const e=this.points,n=e.length;if(0===n||1===n)return null;t<0&&(t=0),t>1&&(t=1);const i=this.length(),s=i*t;return this.tangentAtLength(s)}tangentAtLength(t){const e=this.points,n=e.length;if(0===n||1===n)return null;let i,s=!0;t<0&&(s=!1,t=-t);let r=0;for(let o=0,a=n-1;o<a;o+=1){const n=s?o:a-1-o,l=e[n],c=e[n+1],h=new kb(l,c),u=l.distance(c);if(h.isDifferentiable()){if(t<=r+u)return h.tangentAtLength((s?1:-1)*(t-r));i=h}r+=u}if(i){const t=s?1:0;return i.tangentAt(t)}return null}simplify(t={}){const e=this.points;if(e.length<3)return this;const n=t.threshold||0;let i=0;while(e[i+2]){const t=i,s=i+1,r=i+2,o=e[t],a=e[s],l=e[r],c=new kb(o,l),h=c.closestPoint(a),u=h.distance(a);u<=n?e.splice(s,1):i+=1}return this}toHull(){const t=this.points,e=t.length;if(0===e)return new $b;let n=t[0];for(let u=1;u<e;u+=1)(t[u].y<n.y||t[u].y===n.y&&t[u].x>n.x)&&(n=t[u]);const i=[];for(let u=0;u<e;u+=1){let e=n.theta(t[u]);0===e&&(e=360),i.push([t[u],u,e])}if(i.sort((t,e)=>{let n=t[2]-e[2];return 0===n&&(n=e[1]-t[1]),n}),i.length>2){const t=i[i.length-1];i.unshift(t)}const s={},r=[],o=t=>`${t[0].toString()}@${t[1]}`;while(0!==i.length){const t=i.pop(),e=t[0];if(s[o(t)])continue;let n=!1;while(!n)if(r.length<2)r.push(t),n=!0;else{const a=r.pop(),l=a[0],c=r.pop(),h=c[0],u=h.cross(l,e);if(u<0)r.push(c),r.push(a),r.push(t),n=!0;else if(0===u){const t=1e-10,n=l.angleBetween(h,e);Math.abs(n-180)<t||l.equals(e)||h.equals(l)?(s[o(a)]=l,r.push(c)):Math.abs((n+1)%360-1)<t&&(r.push(c),i.push(a))}else s[o(a)]=l,r.push(c)}}let a;r.length>2&&r.pop();let l=-1;for(let u=0,d=r.length;u<d;u+=1){const t=r[u][1];(void 0===a||t<a)&&(a=t,l=u)}let c=[];if(l>0){const t=r.slice(l),e=r.slice(0,l);c=t.concat(e)}else c=r;const h=[];for(let u=0,d=c.length;u<d;u+=1)h.push(c[u][0]);return new $b(h)}equals(t){return null!=t&&(t.points.length===this.points.length&&t.points.every((t,e)=>t.equals(this.points[e])))}clone(){return new $b(this.points.map(t=>t.clone()))}toJSON(){return this.points.map(t=>t.toJSON())}serialize(){return this.points.map(t=>`${t.serialize()}`).join(" ")}}(function(t){function e(e){return null!=e&&e instanceof t}t.isPolyline=e})($b||($b={})),function(t){function e(e){const n=e.trim();if(""===n)return new t;const i=[],s=n.split(/\s*,\s*|\s+/);for(let t=0,r=s.length;t<r;t+=2)i.push({x:+s[t],y:+s[t+1]});return new t(i)}t.parse=e}($b||($b={}));class Fb extends Sb{constructor(t,e,n,i){super(),this.PRECISION=3,this.start=Nb.create(t),this.controlPoint1=Nb.create(e),this.controlPoint2=Nb.create(n),this.end=Nb.create(i)}bbox(){const t=this.start,e=this.controlPoint1,n=this.controlPoint2,i=this.end,s=t.x,r=t.y,o=e.x,a=e.y,l=n.x,c=n.y,h=i.x,u=i.y,d=[],g=[],p=[[],[]];let f,m,y,b,v,x,w,C,P,E,M;for(let j=0;j<2;j+=1)if(0===j?(m=6*s-12*o+6*l,f=-3*s+9*o-9*l+3*h,y=3*o-3*s):(m=6*r-12*a+6*c,f=-3*r+9*a-9*c+3*u,y=3*a-3*r),Math.abs(f)<1e-12){if(Math.abs(m)<1e-12)continue;b=-y/m,b>0&&b<1&&g.push(b)}else w=m*m-4*y*f,C=Math.sqrt(w),w<0||(v=(-m+C)/(2*f),v>0&&v<1&&g.push(v),x=(-m-C)/(2*f),x>0&&x<1&&g.push(x));let O=g.length;const A=O;while(O)O-=1,b=g[O],M=1-b,P=M*M*M*s+3*M*M*b*o+3*M*b*b*l+b*b*b*h,p[0][O]=P,E=M*M*M*r+3*M*M*b*a+3*M*b*b*c+b*b*b*u,p[1][O]=E,d[O]={X:P,Y:E};g[A]=0,g[A+1]=1,d[A]={X:s,Y:r},d[A+1]={X:h,Y:u},p[0][A]=s,p[1][A]=r,p[0][A+1]=h,p[1][A+1]=u,g.length=A+2,p[0].length=A+2,p[1].length=A+2,d.length=A+2;const S=Math.min.apply(null,p[0]),N=Math.min.apply(null,p[1]),T=Math.max.apply(null,p[0]),k=Math.max.apply(null,p[1]);return new Tb(S,N,T-S,k-N)}closestPoint(t,e={}){return this.pointAtT(this.closestPointT(t,e))}closestPointLength(t,e={}){const n=this.getOptions(e);return this.lengthAtT(this.closestPointT(t,n),n)}closestPointNormalizedLength(t,e={}){const n=this.getOptions(e),i=this.closestPointLength(t,n);if(!i)return 0;const s=this.length(n);return 0===s?0:i/s}closestPointT(t,e={}){const n=this.getPrecision(e),i=this.getDivisions(e),s=Math.pow(10,-n);let r=null,o=0,a=0,l=0,c=0,h=0,u=null;const d=i.length;let g=d>0?1/d:0;i.forEach((e,n)=>{const i=e.start.distance(t),s=e.end.distance(t),d=i+s;(null==u||d<u)&&(r=e,o=n*g,a=(n+1)*g,l=i,c=s,u=d,h=e.endpointDistance())});while(1){const e=l?Math.abs(l-c)/l:0,n=null!=c?Math.abs(l-c)/c:0,i=e<s||n<s,u=!l||l<h*s,d=!c||c<h*s,p=u||d;if(i||p)return l<=c?o:a;const f=r.divide(.5);g/=2;const m=f[0].start.distance(t),y=f[0].end.distance(t),b=m+y,v=f[1].start.distance(t),x=f[1].end.distance(t),w=v+x;b<=w?(r=f[0],a-=g,l=m,c=y):(r=f[1],o+=g,l=v,c=x)}}closestPointTangent(t,e={}){return this.tangentAtT(this.closestPointT(t,e))}containsPoint(t,e={}){const n=this.toPolyline(e);return n.containsPoint(t)}divideAt(t,e={}){if(t<=0)return this.divideAtT(0);if(t>=1)return this.divideAtT(1);const n=this.tAt(t,e);return this.divideAtT(n)}divideAtLength(t,e={}){const n=this.tAtLength(t,e);return this.divideAtT(n)}divide(t){return this.divideAtT(t)}divideAtT(t){const e=this.start,n=this.controlPoint1,i=this.controlPoint2,s=this.end;if(t<=0)return[new Fb(e,e,e,e),new Fb(e,n,i,s)];if(t>=1)return[new Fb(e,n,i,s),new Fb(s,s,s,s)];const r=this.getSkeletonPoints(t),o=r.startControlPoint1,a=r.startControlPoint2,l=r.divider,c=r.dividerControlPoint1,h=r.dividerControlPoint2;return[new Fb(e,o,a,l),new Fb(l,c,h,s)]}endpointDistance(){return this.start.distance(this.end)}getSkeletonPoints(t){const e=this.start,n=this.controlPoint1,i=this.controlPoint2,s=this.end;if(t<=0)return{startControlPoint1:e.clone(),startControlPoint2:e.clone(),divider:e.clone(),dividerControlPoint1:n.clone(),dividerControlPoint2:i.clone()};if(t>=1)return{startControlPoint1:n.clone(),startControlPoint2:i.clone(),divider:s.clone(),dividerControlPoint1:s.clone(),dividerControlPoint2:s.clone()};const r=new kb(e,n).pointAt(t),o=new kb(n,i).pointAt(t),a=new kb(i,s).pointAt(t),l=new kb(r,o).pointAt(t),c=new kb(o,a).pointAt(t),h=new kb(l,c).pointAt(t);return{startControlPoint1:r,startControlPoint2:l,divider:h,dividerControlPoint1:c,dividerControlPoint2:a}}getSubdivisions(t={}){const e=this.getPrecision(t);let n=[new Fb(this.start,this.controlPoint1,this.controlPoint2,this.end)];if(0===e)return n;let i=this.endpointDistance();const s=Math.pow(10,-e);let r=0;while(1){r+=1;const t=[];n.forEach(e=>{const n=e.divide(.5);t.push(n[0],n[1])});const e=t.reduce((t,e)=>t+e.endpointDistance(),0),o=0!==e?(e-i)/e:0;if(r>1&&o<s)return t;n=t,i=e}}length(t={}){const e=this.getDivisions(t);return e.reduce((t,e)=>t+e.endpointDistance(),0)}lengthAtT(t,e={}){if(t<=0)return 0;const n=void 0===e.precision?this.PRECISION:e.precision,i=this.divide(t)[0];return i.length({precision:n})}pointAt(t,e={}){if(t<=0)return this.start.clone();if(t>=1)return this.end.clone();const n=this.tAt(t,e);return this.pointAtT(n)}pointAtLength(t,e={}){const n=this.tAtLength(t,e);return this.pointAtT(n)}pointAtT(t){return t<=0?this.start.clone():t>=1?this.end.clone():this.getSkeletonPoints(t).divider}isDifferentiable(){const t=this.start,e=this.controlPoint1,n=this.controlPoint2,i=this.end;return!(t.equals(e)&&e.equals(n)&&n.equals(i))}tangentAt(t,e={}){if(!this.isDifferentiable())return null;t<0?t=0:t>1&&(t=1);const n=this.tAt(t,e);return this.tangentAtT(n)}tangentAtLength(t,e={}){if(!this.isDifferentiable())return null;const n=this.tAtLength(t,e);return this.tangentAtT(n)}tangentAtT(t){if(!this.isDifferentiable())return null;t<0&&(t=0),t>1&&(t=1);const e=this.getSkeletonPoints(t),n=e.startControlPoint2,i=e.dividerControlPoint1,s=e.divider,r=new kb(n,i);return r.translate(s.x-n.x,s.y-n.y),r}getPrecision(t={}){return null==t.precision?this.PRECISION:t.precision}getDivisions(t={}){if(null!=t.subdivisions)return t.subdivisions;const e=this.getPrecision(t);return this.getSubdivisions({precision:e})}getOptions(t={}){const e=this.getPrecision(t),n=this.getDivisions(t);return{precision:e,subdivisions:n}}tAt(t,e={}){if(t<=0)return 0;if(t>=1)return 1;const n=this.getOptions(e),i=this.length(n),s=i*t;return this.tAtLength(s,n)}tAtLength(t,e={}){let n=!0;t<0&&(n=!1,t=-t);const i=this.getPrecision(e),s=this.getDivisions(e),r={precision:i,subdivisions:s};let o,a,l=null,c=0,h=0,u=0;const d=s.length;let g=d>0?1/d:0;for(let m=0;m<d;m+=1){const e=n?m:d-1-m,i=s[m],r=i.endpointDistance();if(t<=u+r){l=i,o=e*g,a=(e+1)*g,c=n?t-u:r+u-t,h=n?r+u-t:t-u;break}u+=r}if(null==l)return n?1:0;const p=this.length(r),f=Math.pow(10,-i);while(1){let t,e,n;if(t=0!==p?c/p:0,t<f)return o;if(t=0!==p?h/p:0,t<f)return a;const i=l.divide(.5);g/=2;const s=i[0].endpointDistance(),r=i[1].endpointDistance();c<=s?(l=i[0],a-=g,e=c,n=s-e):(l=i[1],o+=g,e=c-s,n=r-e),c=e,h=n}}toPoints(t={}){const e=this.getDivisions(t),n=[e[0].start.clone()];return e.forEach(t=>n.push(t.end.clone())),n}toPolyline(t={}){return new $b(this.toPoints(t))}scale(t,e,n){return this.start.scale(t,e,n),this.controlPoint1.scale(t,e,n),this.controlPoint2.scale(t,e,n),this.end.scale(t,e,n),this}rotate(t,e){return this.start.rotate(t,e),this.controlPoint1.rotate(t,e),this.controlPoint2.rotate(t,e),this.end.rotate(t,e),this}translate(t,e){return"number"===typeof t?(this.start.translate(t,e),this.controlPoint1.translate(t,e),this.controlPoint2.translate(t,e),this.end.translate(t,e)):(this.start.translate(t),this.controlPoint1.translate(t),this.controlPoint2.translate(t),this.end.translate(t)),this}equals(t){return null!=t&&this.start.equals(t.start)&&this.controlPoint1.equals(t.controlPoint1)&&this.controlPoint2.equals(t.controlPoint2)&&this.end.equals(t.end)}clone(){return new Fb(this.start,this.controlPoint1,this.controlPoint2,this.end)}toJSON(){return{start:this.start.toJSON(),controlPoint1:this.controlPoint1.toJSON(),controlPoint2:this.controlPoint2.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.controlPoint1.serialize(),this.controlPoint2.serialize(),this.end.serialize()].join(" ")}}(function(t){function e(e){return null!=e&&e instanceof t}t.isCurve=e})(Fb||(Fb={})),function(t){function e(t){const e=t.length,n=[],i=[];let s=2;n[0]=t[0]/s;for(let r=1;r<e;r+=1)i[r]=1/s,s=(r<e-1?4:3.5)-i[r],n[r]=(t[r]-n[r-1])/s;for(let r=1;r<e;r+=1)n[e-r-1]-=i[e-r]*n[e-r];return n}function n(t){const n=t.map(t=>Nb.clone(t)),i=[],s=[],r=n.length-1;if(1===r)return i[0]=new Nb((2*n[0].x+n[1].x)/3,(2*n[0].y+n[1].y)/3),s[0]=new Nb(2*i[0].x-n[0].x,2*i[0].y-n[0].y),[i,s];const o=[];for(let e=1;e<r-1;e+=1)o[e]=4*n[e].x+2*n[e+1].x;o[0]=n[0].x+2*n[1].x,o[r-1]=(8*n[r-1].x+n[r].x)/2;const a=e(o);for(let e=1;e<r-1;e+=1)o[e]=4*n[e].y+2*n[e+1].y;o[0]=n[0].y+2*n[1].y,o[r-1]=(8*n[r-1].y+n[r].y)/2;const l=e(o);for(let e=0;e<r;e+=1)i.push(new Nb(a[e],l[e])),e<r-1?s.push(new Nb(2*n[e+1].x-a[e+1],2*n[e+1].y-l[e+1])):s.push(new Nb((n[r].x+a[r-1])/2,(n[r].y+l[r-1])/2));return[i,s]}function i(e){if(null==e||Array.isArray(e)&&e.length<2)throw new Error("At least 2 points are required");const i=n(e),s=[];for(let n=0,r=i[0].length;n<r;n+=1){const r=new Nb(i[0][n].x,i[0][n].y),o=new Nb(i[1][n].x,i[1][n].y);s.push(new t(e[n],r,o,e[n+1]))}return s}t.throughPoints=i}(Fb||(Fb={}));class Gb extends Sb{constructor(){super(...arguments),this.isVisible=!0,this.isSegment=!0,this.isSubpathStart=!1}get end(){return this.endPoint}get start(){if(null==this.previousSegment)throw new Error("Missing previous segment. (This segment cannot be the first segment of a path, or segment has not yet been added to a path.)");return this.previousSegment.end}closestPointT(t,e){if(this.closestPointNormalizedLength)return this.closestPointNormalizedLength(t);throw new Error("Neither `closestPointT` nor `closestPointNormalizedLength` method is implemented.")}lengthAtT(t,e){if(t<=0)return 0;const n=this.length();return t>=1?n:n*t}divideAtT(t){if(this.divideAt)return this.divideAt(t);throw new Error("Neither `divideAtT` nor `divideAt` method is implemented.")}pointAtT(t){if(this.pointAt)return this.pointAt(t);throw new Error("Neither `pointAtT` nor `pointAt` method is implemented.")}tangentAtT(t){if(this.tangentAt)return this.tangentAt(t);throw new Error("Neither `tangentAtT` nor `tangentAt` method is implemented.")}}class _b extends Gb{constructor(t,e){super(),kb.isLine(t)?this.endPoint=t.end.clone().round(2):this.endPoint=Nb.create(t,e).round(2)}get type(){return"L"}get line(){return new kb(this.start,this.end)}bbox(){return this.line.bbox()}closestPoint(t){return this.line.closestPoint(t)}closestPointLength(t){return this.line.closestPointLength(t)}closestPointNormalizedLength(t){return this.line.closestPointNormalizedLength(t)}closestPointTangent(t){return this.line.closestPointTangent(t)}length(){return this.line.length()}divideAt(t){const e=this.line.divideAt(t);return[new _b(e[0]),new _b(e[1])]}divideAtLength(t){const e=this.line.divideAtLength(t);return[new _b(e[0]),new _b(e[1])]}getSubdivisions(){return[]}pointAt(t){return this.line.pointAt(t)}pointAtLength(t){return this.line.pointAtLength(t)}tangentAt(t){return this.line.tangentAt(t)}tangentAtLength(t){return this.line.tangentAtLength(t)}isDifferentiable(){return null!=this.previousSegment&&!this.start.equals(this.end)}clone(){return new _b(this.end)}scale(t,e,n){return this.end.scale(t,e,n),this}rotate(t,e){return this.end.rotate(t,e),this}translate(t,e){return"number"===typeof t?this.end.translate(t,e):this.end.translate(t),this}equals(t){return this.type===t.type&&this.start.equals(t.start)&&this.end.equals(t.end)}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){const t=this.end;return`${this.type} ${t.x} ${t.y}`}}(function(t){function e(...e){const n=e.length,i=e[0];if(kb.isLine(i))return new t(i);if(Nb.isPointLike(i))return 1===n?new t(i):e.map(e=>new t(e));if(2===n)return new t(+e[0],+e[1]);const s=[];for(let r=0;r<n;r+=2){const n=+e[r],i=+e[r+1];s.push(new t(n,i))}return s}t.create=e})(_b||(_b={}));class Hb extends Gb{get end(){if(!this.subpathStartSegment)throw new Error("Missing subpath start segment. (This segment needs a subpath start segment (e.g. MoveTo), or segment has not yet been added to a path.)");return this.subpathStartSegment.end}get type(){return"Z"}get line(){return new kb(this.start,this.end)}bbox(){return this.line.bbox()}closestPoint(t){return this.line.closestPoint(t)}closestPointLength(t){return this.line.closestPointLength(t)}closestPointNormalizedLength(t){return this.line.closestPointNormalizedLength(t)}closestPointTangent(t){return this.line.closestPointTangent(t)}length(){return this.line.length()}divideAt(t){const e=this.line.divideAt(t);return[e[1].isDifferentiable()?new _b(e[0]):this.clone(),new _b(e[1])]}divideAtLength(t){const e=this.line.divideAtLength(t);return[e[1].isDifferentiable()?new _b(e[0]):this.clone(),new _b(e[1])]}getSubdivisions(){return[]}pointAt(t){return this.line.pointAt(t)}pointAtLength(t){return this.line.pointAtLength(t)}tangentAt(t){return this.line.tangentAt(t)}tangentAtLength(t){return this.line.tangentAtLength(t)}isDifferentiable(){return!(!this.previousSegment||!this.subpathStartSegment)&&!this.start.equals(this.end)}scale(){return this}rotate(){return this}translate(){return this}equals(t){return this.type===t.type&&this.start.equals(t.start)&&this.end.equals(t.end)}clone(){return new Hb}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return this.type}}(function(t){function e(){return new t}t.create=e})(Hb||(Hb={}));class Ub extends Gb{constructor(t,e){super(),this.isVisible=!1,this.isSubpathStart=!0,kb.isLine(t)||Fb.isCurve(t)?this.endPoint=t.end.clone().round(2):this.endPoint=Nb.create(t,e).round(2)}get start(){throw new Error("Illegal access. Moveto segments should not need a start property.")}get type(){return"M"}bbox(){return null}closestPoint(){return this.end.clone()}closestPointLength(){return 0}closestPointNormalizedLength(){return 0}closestPointT(){return 1}closestPointTangent(){return null}length(){return 0}lengthAtT(){return 0}divideAt(){return[this.clone(),this.clone()]}divideAtLength(){return[this.clone(),this.clone()]}getSubdivisions(){return[]}pointAt(){return this.end.clone()}pointAtLength(){return this.end.clone()}pointAtT(){return this.end.clone()}tangentAt(){return null}tangentAtLength(){return null}tangentAtT(){return null}isDifferentiable(){return!1}scale(t,e,n){return this.end.scale(t,e,n),this}rotate(t,e){return this.end.rotate(t,e),this}translate(t,e){return"number"===typeof t?this.end.translate(t,e):this.end.translate(t),this}clone(){return new Ub(this.end)}equals(t){return this.type===t.type&&this.end.equals(t.end)}toJSON(){return{type:this.type,end:this.end.toJSON()}}serialize(){const t=this.end;return`${this.type} ${t.x} ${t.y}`}}(function(t){function e(...e){const n=e.length,i=e[0];if(kb.isLine(i))return new t(i);if(Fb.isCurve(i))return new t(i);if(Nb.isPointLike(i)){if(1===n)return new t(i);const s=[];for(let i=0;i<n;i+=1)0===i?s.push(new t(e[i])):s.push(new _b(e[i]));return s}if(2===n)return new t(+e[0],+e[1]);const s=[];for(let r=0;r<n;r+=2){const n=+e[r],i=+e[r+1];0===r?s.push(new t(n,i)):s.push(new _b(n,i))}return s}t.create=e})(Ub||(Ub={}));class Jb extends Gb{constructor(t,e,n,i,s,r){super(),Fb.isCurve(t)?(this.controlPoint1=t.controlPoint1.clone().round(2),this.controlPoint2=t.controlPoint2.clone().round(2),this.endPoint=t.end.clone().round(2)):"number"===typeof t?(this.controlPoint1=new Nb(t,e).round(2),this.controlPoint2=new Nb(n,i).round(2),this.endPoint=new Nb(s,r).round(2)):(this.controlPoint1=Nb.create(t).round(2),this.controlPoint2=Nb.create(e).round(2),this.endPoint=Nb.create(n).round(2))}get type(){return"C"}get curve(){return new Fb(this.start,this.controlPoint1,this.controlPoint2,this.end)}bbox(){return this.curve.bbox()}closestPoint(t){return this.curve.closestPoint(t)}closestPointLength(t){return this.curve.closestPointLength(t)}closestPointNormalizedLength(t){return this.curve.closestPointNormalizedLength(t)}closestPointTangent(t){return this.curve.closestPointTangent(t)}length(){return this.curve.length()}divideAt(t,e={}){const n=this.curve.divideAt(t,e);return[new Jb(n[0]),new Jb(n[1])]}divideAtLength(t,e={}){const n=this.curve.divideAtLength(t,e);return[new Jb(n[0]),new Jb(n[1])]}divideAtT(t){const e=this.curve.divideAtT(t);return[new Jb(e[0]),new Jb(e[1])]}getSubdivisions(){return[]}pointAt(t){return this.curve.pointAt(t)}pointAtLength(t){return this.curve.pointAtLength(t)}tangentAt(t){return this.curve.tangentAt(t)}tangentAtLength(t){return this.curve.tangentAtLength(t)}isDifferentiable(){if(!this.previousSegment)return!1;const t=this.start,e=this.controlPoint1,n=this.controlPoint2,i=this.end;return!(t.equals(e)&&e.equals(n)&&n.equals(i))}scale(t,e,n){return this.controlPoint1.scale(t,e,n),this.controlPoint2.scale(t,e,n),this.end.scale(t,e,n),this}rotate(t,e){return this.controlPoint1.rotate(t,e),this.controlPoint2.rotate(t,e),this.end.rotate(t,e),this}translate(t,e){return"number"===typeof t?(this.controlPoint1.translate(t,e),this.controlPoint2.translate(t,e),this.end.translate(t,e)):(this.controlPoint1.translate(t),this.controlPoint2.translate(t),this.end.translate(t)),this}equals(t){return this.start.equals(t.start)&&this.end.equals(t.end)&&this.controlPoint1.equals(t.controlPoint1)&&this.controlPoint2.equals(t.controlPoint2)}clone(){return new Jb(this.controlPoint1,this.controlPoint2,this.end)}toJSON(){return{type:this.type,start:this.start.toJSON(),controlPoint1:this.controlPoint1.toJSON(),controlPoint2:this.controlPoint2.toJSON(),end:this.end.toJSON()}}serialize(){const t=this.controlPoint1,e=this.controlPoint2,n=this.end;return[this.type,t.x,t.y,e.x,e.y,n.x,n.y].join(" ")}}function qb(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function Wb(t,e,n,i,s,r){const o=1/3,a=2/3;return[o*t+a*n,o*e+a*i,o*s+a*n,o*r+a*i,s,r]}function Xb(t,e,n,i,s,r,o,a,l,c){const h=120*Math.PI/180,u=Math.PI/180*(+s||0);let d,g,p,f,m,y=[];if(c)g=c[0],p=c[1],f=c[2],m=c[3];else{d=qb(t,e,-u),t=d.x,e=d.y,d=qb(a,l,-u),a=d.x,l=d.y;const s=(t-a)/2,c=(e-l)/2;let h=s*s/(n*n)+c*c/(i*i);h>1&&(h=Math.sqrt(h),n*=h,i*=h);const y=n*n,b=i*i,v=(r===o?-1:1)*Math.sqrt(Math.abs((y*b-y*c*c-b*s*s)/(y*c*c+b*s*s)));f=v*n*c/i+(t+a)/2,m=v*-i*s/n+(e+l)/2,g=Math.asin((e-m)/i),p=Math.asin((l-m)/i),g=t<f?Math.PI-g:g,p=a<f?Math.PI-p:p,g<0&&(g=2*Math.PI+g),p<0&&(p=2*Math.PI+p),o&&g>p&&(g-=2*Math.PI),!o&&p>g&&(p-=2*Math.PI)}let b=p-g;if(Math.abs(b)>h){const t=p,e=a,r=l;p=g+h*(o&&p>g?1:-1),a=f+n*Math.cos(p),l=m+i*Math.sin(p),y=Xb(a,l,n,i,s,0,o,e,r,[p,t,f,m])}b=p-g;const v=Math.cos(g),x=Math.sin(g),w=Math.cos(p),C=Math.sin(p),P=Math.tan(b/4),E=4/3*(n*P),M=4/3*(i*P),O=[t,e],A=[t+E*x,e-M*v],S=[a+E*C,l-M*w],N=[a,l];if(A[0]=2*O[0]-A[0],A[1]=2*O[1]-A[1],c)return[A,S,N].concat(y);{y=[A,S,N].concat(y).join().split(",");const t=[],e=y.length;for(let n=0;n<e;n+=1)t[n]=n%2?qb(+y[n-1],+y[n],u).y:qb(+y[n],+y[n+1],u).x;return t}}function Yb(t){if(!t)return null;const e="\t\n\v\f\r   ᠎              \u2028\u2029",n=new RegExp(`([a-z])[${e},]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[${e}]*,?[${e}]*)+)`,"ig"),i=new RegExp(`(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[${e}]*,?[${e}]*`,"ig"),s={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=[];return t.replace(n,(t,e,n)=>{const o=[];let a=e.toLowerCase();n.replace(i,(t,e)=>(e&&o.push(+e),t)),"m"===a&&o.length>2&&(r.push([e,...o.splice(0,2)]),a="l",e="m"===e?"l":"L");const l=s[a];while(o.length>=l)if(r.push([e,...o.splice(0,l)]),!l)break;return t}),r}function Zb(t){const e=Yb(t);if(!e||!e.length)return[["M",0,0]];let n=0,i=0,s=0,r=0;const o=[];for(let a=0,l=e.length;a<l;a+=1){const t=[];o.push(t);const l=e[a],c=l[0];if(c!==c.toUpperCase())switch(t[0]=c.toUpperCase(),t[0]){case"A":t[1]=l[1],t[2]=l[2],t[3]=l[3],t[4]=l[4],t[5]=l[5],t[6]=+l[6]+n,t[7]=+l[7]+i;break;case"V":t[1]=+l[1]+i;break;case"H":t[1]=+l[1]+n;break;case"M":s=+l[1]+n,r=+l[2]+i;for(let e=1,s=l.length;e<s;e+=1)t[e]=+l[e]+(e%2?n:i);break;default:for(let e=1,s=l.length;e<s;e+=1)t[e]=+l[e]+(e%2?n:i);break}else for(let e=0,n=l.length;e<n;e+=1)t[e]=l[e];switch(t[0]){case"Z":n=+s,i=+r;break;case"H":n=t[1];break;case"V":i=t[1];break;case"M":s=t[t.length-2],r=t[t.length-1],n=t[t.length-2],i=t[t.length-1];break;default:n=t[t.length-2],i=t[t.length-1];break}}return o}function Kb(t){const e=Zb(t),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};function i(t,e,n){let i,s;if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(t[0]in{T:1,Q:1}||(e.qx=null,e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":return 0===parseFloat(t[1])||0===parseFloat(t[2])?["L",t[6],t[7]]:["C"].concat(Xb.apply(0,[e.x,e.y].concat(t.slice(1))));case"S":return"C"===n||"S"===n?(i=2*e.x-e.bx,s=2*e.y-e.by):(i=e.x,s=e.y),["C",i,s].concat(t.slice(1));case"T":return"Q"===n||"T"===n?(e.qx=2*e.x-e.qx,e.qy=2*e.y-e.qy):(e.qx=e.x,e.qy=e.y),["C"].concat(Wb(e.x,e.y,e.qx,e.qy,t[1],t[2]));case"Q":return e.qx=t[1],e.qy=t[2],["C"].concat(Wb(e.x,e.y,t[1],t[2],t[3],t[4]));case"H":return["L"].concat(t[1],e.y);case"V":return["L"].concat(e.x,t[1]);case"L":break;case"Z":break;default:break}return t}function s(t,n){if(t[n].length>7){t[n].shift();const i=t[n];while(i.length)r[n]="A",n+=1,t.splice(n,0,["C"].concat(i.splice(0,6)));t.splice(n,1),a=e.length}}const r=[];let o="",a=e.length;for(let l=0;l<a;l+=1){let t="";e[l]&&(t=e[l][0]),"C"!==t&&(r[l]=t,l>0&&(o=r[l-1])),e[l]=i(e[l],n,o),"A"!==r[l]&&"C"===t&&(r[l]="C"),s(e,l);const a=e[l],c=a.length;n.x=a[c-2],n.y=a[c-1],n.bx=parseFloat(a[c-4])||n.x,n.by=parseFloat(a[c-3])||n.y}return e[0][0]&&"M"===e[0][0]||e.unshift(["M",0,0]),e}function Qb(t){return Kb(t).map(t=>t.map(t=>"string"===typeof t?t:Ab.round(t,2))).join(",").split(",").join(" ")}(function(t){function e(...e){const n=e.length,i=e[0];if(Fb.isCurve(i))return new t(i);if(Nb.isPointLike(i)){if(3===n)return new t(e[0],e[1],e[2]);const i=[];for(let s=0;s<n;s+=3)i.push(new t(e[s],e[s+1],e[s+2]));return i}if(6===n)return new t(e[0],e[1],e[2],e[3],e[4],e[5]);const s=[];for(let r=0;r<n;r+=6)s.push(new t(e[r],e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]));return s}t.create=e})(Jb||(Jb={}));class tv extends Sb{constructor(t){if(super(),this.PRECISION=3,this.segments=[],Array.isArray(t))if(kb.isLine(t[0])||Fb.isCurve(t[0])){let e=null;const n=t;n.forEach((t,n)=>{0===n&&this.appendSegment(tv.createSegment("M",t.start)),null==e||e.end.equals(t.start)||this.appendSegment(tv.createSegment("M",t.start)),kb.isLine(t)?this.appendSegment(tv.createSegment("L",t.end)):Fb.isCurve(t)&&this.appendSegment(tv.createSegment("C",t.controlPoint1,t.controlPoint2,t.end)),e=t})}else{const e=t;e.forEach(t=>{t.isSegment&&this.appendSegment(t)})}else null!=t&&(kb.isLine(t)?(this.appendSegment(tv.createSegment("M",t.start)),this.appendSegment(tv.createSegment("L",t.end))):Fb.isCurve(t)?(this.appendSegment(tv.createSegment("M",t.start)),this.appendSegment(tv.createSegment("C",t.controlPoint1,t.controlPoint2,t.end))):$b.isPolyline(t)?t.points&&t.points.length&&t.points.forEach((t,e)=>{const n=0===e?tv.createSegment("M",t):tv.createSegment("L",t);this.appendSegment(n)}):t.isSegment&&this.appendSegment(t))}get start(){const t=this.segments,e=t.length;if(0===e)return null;for(let n=0;n<e;n+=1){const e=t[n];if(e.isVisible)return e.start}return t[e-1].end}get end(){const t=this.segments,e=t.length;if(0===e)return null;for(let n=e-1;n>=0;n-=1){const e=t[n];if(e.isVisible)return e.end}return t[e-1].end}moveTo(...t){return this.appendSegment(Ub.create.call(null,...t))}lineTo(...t){return this.appendSegment(_b.create.call(null,...t))}curveTo(...t){return this.appendSegment(Jb.create.call(null,...t))}arcTo(t,e,n,i,s,r,o){const a=this.end||new Nb,l="number"===typeof r?Vb(a.x,a.y,t,e,n,i,s,r,o):Vb(a.x,a.y,t,e,n,i,s,r.x,r.y);if(null!=l)for(let c=0,h=l.length;c<h;c+=6)this.curveTo(l[c],l[c+1],l[c+2],l[c+3],l[c+4],l[c+5]);return this}quadTo(t,e,n,i){const s=this.end||new Nb,r=["M",s.x,s.y];if("number"===typeof t)r.push("Q",t,e,n,i);else{const n=e;r.push("Q",t.x,t.y,n.x,n.y)}const o=tv.parse(r.join(" "));return this.appendSegment(o.segments.slice(1)),this}close(){return this.appendSegment(Hb.create())}drawPoints(t,e={}){const n=Rb(t,e),i=tv.parse(n);i&&i.segments&&this.appendSegment(i.segments)}bbox(){const t=this.segments,e=t.length;if(0===e)return null;let n;for(let s=0;s<e;s+=1){const e=t[s];if(e.isVisible){const t=e.bbox();null!=t&&(n=n?n.union(t):t)}}if(null!=n)return n;const i=t[e-1];return new Tb(i.end.x,i.end.y,0,0)}appendSegment(t){const e=this.segments.length;let n,i=0!==e?this.segments[e-1]:null;const s=null;if(Array.isArray(t))for(let r=0,o=t.length;r<o;r+=1){const e=t[r];n=this.prepareSegment(e,i,s),this.segments.push(n),i=n}else null!=t&&t.isSegment&&(n=this.prepareSegment(t,i,s),this.segments.push(n));return this}insertSegment(t,e){const n=this.segments.length;if(t<0&&(t=n+t+1),t>n||t<0)throw new Error("Index out of range.");let i,s=null,r=null;if(0!==n&&(t>=1?(s=this.segments[t-1],r=s.nextSegment):(s=null,r=this.segments[0])),Array.isArray(e))for(let o=0,a=e.length;o<a;o+=1){const n=e[o];i=this.prepareSegment(n,s,r),this.segments.splice(t+o,0,i),s=i}else i=this.prepareSegment(e,s,r),this.segments.splice(t,0,i);return this}removeSegment(t){const e=this.fixIndex(t),n=this.segments.splice(e,1)[0],i=n.previousSegment,s=n.nextSegment;return i&&(i.nextSegment=s),s&&(s.previousSegment=i),n.isSubpathStart&&s&&this.updateSubpathStartSegment(s),n}replaceSegment(t,e){const n=this.fixIndex(t);let i;const s=this.segments[n];let r=s.previousSegment;const o=s.nextSegment;let a=s.isSubpathStart;if(Array.isArray(e)){this.segments.splice(t,1);for(let n=0,s=e.length;n<s;n+=1){const s=e[n];i=this.prepareSegment(s,r,o),this.segments.splice(t+n,0,i),r=i,a&&i.isSubpathStart&&(a=!1)}}else i=this.prepareSegment(e,r,o),this.segments.splice(n,1,i),a&&i.isSubpathStart&&(a=!1);a&&o&&this.updateSubpathStartSegment(o)}getSegment(t){const e=this.fixIndex(t);return this.segments[e]}fixIndex(t){const e=this.segments.length;if(0===e)throw new Error("Path has no segments.");let n=t;while(n<0)n=e+n;if(n>=e||n<0)throw new Error("Index out of range.");return n}segmentAt(t,e={}){const n=this.segmentIndexAt(t,e);return n?this.getSegment(n):null}segmentAtLength(t,e={}){const n=this.segmentIndexAtLength(t,e);return n?this.getSegment(n):null}segmentIndexAt(t,e={}){if(0===this.segments.length)return null;const n=Ab.clamp(t,0,1),i=this.getOptions(e),s=this.length(i),r=s*n;return this.segmentIndexAtLength(r,i)}segmentIndexAtLength(t,e={}){const n=this.segments.length;if(0===n)return null;let i=!0;t<0&&(i=!1,t=-t);const s=this.getPrecision(e),r=this.getSubdivisions(e);let o=0,a=null;for(let l=0;l<n;l+=1){const e=i?l:n-1-l,c=this.segments[e],h=r[e],u=c.length({precision:s,subdivisions:h});if(c.isVisible){if(t<=o+u)return e;a=e}o+=u}return a}getSegmentSubdivisions(t={}){const e=this.getPrecision(t),n=[];for(let i=0,s=this.segments.length;i<s;i+=1){const t=this.segments[i],s=t.getSubdivisions({precision:e});n.push(s)}return n}updateSubpathStartSegment(t){let e=t.previousSegment,n=t;while(n&&!n.isSubpathStart)n.subpathStartSegment=null!=e?e.subpathStartSegment:null,e=n,n=n.nextSegment}prepareSegment(t,e,n){t.previousSegment=e,t.nextSegment=n,null!=e&&(e.nextSegment=t),null!=n&&(n.previousSegment=t);let i=t;return t.isSubpathStart&&(t.subpathStartSegment=t,i=n),null!=i&&this.updateSubpathStartSegment(i),t}closestPoint(t,e={}){const n=this.closestPointT(t,e);return n?this.pointAtT(n):null}closestPointLength(t,e={}){const n=this.getOptions(e),i=this.closestPointT(t,n);return i?this.lengthAtT(i,n):0}closestPointNormalizedLength(t,e={}){const n=this.getOptions(e),i=this.closestPointLength(t,n);if(0===i)return 0;const s=this.length(n);return 0===s?0:i/s}closestPointT(t,e={}){if(0===this.segments.length)return null;const n=this.getPrecision(e),i=this.getSubdivisions(e);let s,r=1/0;for(let o=0,a=this.segments.length;o<a;o+=1){const e=this.segments[o],a=i[o];if(e.isVisible){const i=e.closestPointT(t,{precision:n,subdivisions:a}),l=e.pointAtT(i),c=Ab.squaredLength(l,t);c<r&&(s={segmentIndex:o,value:i},r=c)}}return s||{segmentIndex:this.segments.length-1,value:1}}closestPointTangent(t,e={}){if(0===this.segments.length)return null;const n=this.getPrecision(e),i=this.getSubdivisions(e);let s,r=1/0;for(let o=0,a=this.segments.length;o<a;o+=1){const e=this.segments[o],a=i[o];if(e.isDifferentiable()){const i=e.closestPointT(t,{precision:n,subdivisions:a}),o=e.pointAtT(i),l=Ab.squaredLength(o,t);l<r&&(s=e.tangentAtT(i),r=l)}}return s||null}containsPoint(t,e={}){const n=this.toPolylines(e);if(!n)return!1;let i=0;for(let s=0,r=n.length;s<r;s+=1){const e=n[s];e.containsPoint(t)&&(i+=1)}return i%2===1}pointAt(t,e={}){if(0===this.segments.length)return null;if(t<=0)return this.start.clone();if(t>=1)return this.end.clone();const n=this.getOptions(e),i=this.length(n),s=i*t;return this.pointAtLength(s,n)}pointAtLength(t,e={}){if(0===this.segments.length)return null;if(0===t)return this.start.clone();let n=!0;t<0&&(n=!1,t=-t);const i=this.getPrecision(e),s=this.getSubdivisions(e);let r,o=0;for(let l=0,c=this.segments.length;l<c;l+=1){const e=n?l:c-1-l,a=this.segments[e],h=s[e],u=a.length({precision:i,subdivisions:h});if(a.isVisible){if(t<=o+u)return a.pointAtLength((n?1:-1)*(t-o),{precision:i,subdivisions:h});r=a}o+=u}if(r)return n?r.end:r.start;const a=this.segments[this.segments.length-1];return a.end.clone()}pointAtT(t){const e=this.segments,n=e.length;if(0===n)return null;const i=t.segmentIndex;if(i<0)return e[0].pointAtT(0);if(i>=n)return e[n-1].pointAtT(1);const s=Ab.clamp(t.value,0,1);return e[i].pointAtT(s)}divideAt(t,e={}){if(0===this.segments.length)return null;const n=Ab.clamp(t,0,1),i=this.getOptions(e),s=this.length(i),r=s*n;return this.divideAtLength(r,i)}divideAtLength(t,e={}){if(0===this.segments.length)return null;let n=!0;t<0&&(n=!1,t=-t);const i=this.getPrecision(e),s=this.getSubdivisions(e);let r,o,a,l,c,h=0;for(let x=0,w=this.segments.length;x<w;x+=1){const e=n?x:w-1-x,c=this.getSegment(e),u=s[e],d={precision:i,subdivisions:u},g=c.length(d);if(c.isDifferentiable()&&(a=c,l=e,t<=h+g)){o=e,r=c.divideAtLength((n?1:-1)*(t-h),d);break}h+=g}if(!a)return null;r||(o=l,c=n?1:0,r=a.divideAtT(c));const u=this.clone(),d=o;u.replaceSegment(d,r);const g=d;let p=d+1,f=d+2;r[0].isDifferentiable()||(u.removeSegment(g),p-=1,f-=1);const m=u.getSegment(p).start;u.insertSegment(p,tv.createSegment("M",m)),f+=1,r[1].isDifferentiable()||(u.removeSegment(f-1),f-=1);const y=f-g-1;for(let x=f,w=u.segments.length;x<w;x+=1){const t=this.getSegment(x-y),e=u.getSegment(x);if("Z"===e.type&&!t.subpathStartSegment.end.equals(e.subpathStartSegment.end)){const e=tv.createSegment("L",t.end);u.replaceSegment(x,e)}}const b=new tv(u.segments.slice(0,p)),v=new tv(u.segments.slice(p));return[b,v]}intersectsWithLine(t,e={}){const n=this.toPolylines(e);if(null==n)return null;let i=null;for(let s=0,r=n.length;s<r;s+=1){const e=n[s],r=t.intersect(e);r&&(null==i&&(i=[]),Array.isArray(r)?i.push(...r):i.push(r))}return i}isDifferentiable(){for(let t=0,e=this.segments.length;t<e;t+=1){const e=this.segments[t];if(e.isDifferentiable())return!0}return!1}isValid(){const t=this.segments,e=0===t.length||"M"===t[0].type;return e}length(t={}){if(0===this.segments.length)return 0;const e=this.getSubdivisions(t);let n=0;for(let i=0,s=this.segments.length;i<s;i+=1){const t=this.segments[i],s=e[i];n+=t.length({subdivisions:s})}return n}lengthAtT(t,e={}){const n=this.segments.length;if(0===n)return 0;let i=t.segmentIndex;if(i<0)return 0;let s=Ab.clamp(t.value,0,1);i>=n&&(i=n-1,s=1);const r=this.getPrecision(e),o=this.getSubdivisions(e);let a=0;for(let h=0;h<i;h+=1){const t=this.segments[h],e=o[h];a+=t.length({precision:r,subdivisions:e})}const l=this.segments[i],c=o[i];return a+=l.lengthAtT(s,{precision:r,subdivisions:c}),a}tangentAt(t,e={}){if(0===this.segments.length)return null;const n=Ab.clamp(t,0,1),i=this.getOptions(e),s=this.length(i),r=s*n;return this.tangentAtLength(r,i)}tangentAtLength(t,e={}){if(0===this.segments.length)return null;let n=!0;t<0&&(n=!1,t=-t);const i=this.getPrecision(e),s=this.getSubdivisions(e);let r,o=0;for(let a=0,l=this.segments.length;a<l;a+=1){const e=n?a:l-1-a,c=this.segments[e],h=s[e],u=c.length({precision:i,subdivisions:h});if(c.isDifferentiable()){if(t<=o+u)return c.tangentAtLength((n?1:-1)*(t-o),{precision:i,subdivisions:h});r=c}o+=u}if(r){const t=n?1:0;return r.tangentAtT(t)}return null}tangentAtT(t){const e=this.segments.length;if(0===e)return null;const n=t.segmentIndex;if(n<0)return this.segments[0].tangentAtT(0);if(n>=e)return this.segments[e-1].tangentAtT(1);const i=Ab.clamp(t.value,0,1);return this.segments[n].tangentAtT(i)}getPrecision(t={}){return null==t.precision?this.PRECISION:t.precision}getSubdivisions(t={}){if(null==t.segmentSubdivisions){const e=this.getPrecision(t);return this.getSegmentSubdivisions({precision:e})}return t.segmentSubdivisions}getOptions(t={}){const e=this.getPrecision(t),n=this.getSubdivisions(t);return{precision:e,segmentSubdivisions:n}}toPoints(t={}){const e=this.segments,n=e.length;if(0===n)return null;const i=this.getSubdivisions(t),s=[];let r=[];for(let o=0;o<n;o+=1){const t=e[o];if(t.isVisible){const e=i[o];e.length>0?e.forEach(t=>r.push(t.start)):r.push(t.start)}else r.length>0&&(r.push(e[o-1].end),s.push(r),r=[])}return r.length>0&&(r.push(this.end),s.push(r)),s}toPolylines(t={}){const e=this.toPoints(t);return e?e.map(t=>new $b(t)):null}scale(t,e,n){return this.segments.forEach(i=>i.scale(t,e,n)),this}rotate(t,e){return this.segments.forEach(n=>n.rotate(t,e)),this}translate(t,e){return"number"===typeof t?this.segments.forEach(n=>n.translate(t,e)):this.segments.forEach(e=>e.translate(t)),this}clone(){const t=new tv;return this.segments.forEach(e=>t.appendSegment(e.clone())),t}equals(t){if(null==t)return!1;const e=this.segments,n=t.segments,i=e.length;if(n.length!==i)return!1;for(let s=0;s<i;s+=1){const t=e[s],i=n[s];if(t.type!==i.type||!t.equals(i))return!1}return!0}toJSON(){return this.segments.map(t=>t.toJSON())}serialize(){if(!this.isValid())throw new Error("Invalid path segments.");return this.segments.map(t=>t.serialize()).join(" ")}toString(){return this.serialize()}}(function(t){function e(e){return null!=e&&e instanceof t}t.isPath=e})(tv||(tv={})),function(t){function e(e){if(!e)return new t;const i=new t,s=/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g,r=t.normalize(e).match(s);if(null!=r)for(let t=0,o=r.length;t<o;t+=1){const e=r[t],s=/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g,o=e.match(s);if(null!=o){const t=o[0],e=o.slice(1).map(t=>+t),s=n.call(null,t,...e);i.appendSegment(s)}}return i}function n(t,...e){if("M"===t)return Ub.create.call(null,...e);if("L"===t)return _b.create.call(null,...e);if("C"===t)return Jb.create.call(null,...e);if("z"===t||"Z"===t)return Hb.create();throw new Error(`Invalid path segment type "${t}"`)}t.parse=e,t.createSegment=n}(tv||(tv={})),function(t){t.normalize=Qb,t.isValid=Db,t.drawArc=zb,t.drawPoints=Rb,t.arcToCurves=Vb}(tv||(tv={}));class ev{constructor(t){this.options=Object.assign({},t),this.data=this.options.data||{},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this)}get names(){return Object.keys(this.data)}register(t,e,n=!1){if("object"===typeof t)return void Object.entries(t).forEach(([t,n])=>{this.register(t,n,e)});!this.exist(t)||n||Vf.isApplyingHMR()||this.onDuplicated(t);const i=this.options.process,s=i?Pt(i,this,t,e):e;return this.data[t]=s,s}unregister(t){const e=t?this.data[t]:null;return delete this.data[t],e}get(t){return t?this.data[t]:null}exist(t){return!!t&&null!=this.data[t]}onDuplicated(t){try{throw this.options.onConflict&&Pt(this.options.onConflict,this,t),new Error(`${Up(this.options.type)} with name '${t}' already registered.`)}catch(LM){throw LM}}onNotFound(t,e){throw new Error(this.getSpellingSuggestion(t,e))}getSpellingSuggestion(t,e){const n=this.getSpellingSuggestionForName(t),i=e?`${e} ${sf(this.options.type)}`:this.options.type;return`${Up(i)} with name '${t}' does not exist.${n?` Did you mean '${n}'?`:""}`}getSpellingSuggestionForName(t){return hf(t,Object.keys(this.data),t=>t)}}(function(t){function e(e){return new t(e)}t.create=e})(ev||(ev={}));const nv={color:"#aaaaaa",thickness:1,markup:"rect",update(t,e){const n=e.thickness*e.sx,i=e.thickness*e.sy;Mm(t,{width:n,height:i,rx:n,ry:i,fill:e.color})}},iv={color:"#aaaaaa",thickness:1,markup:"rect",update(t,e){const n=e.sx<=1?e.thickness*e.sx:e.thickness;Mm(t,{width:n,height:n,rx:n,ry:n,fill:e.color})}},sv={color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(t,e){let n;const i=e.width,s=e.height,r=e.thickness;n=i-r>=0&&s-r>=0?["M",i,0,"H0 M0 0 V0",s].join(" "):"M 0 0 0 0",Mm(t,{d:n,stroke:e.color,"stroke-width":e.thickness})}},rv=[{color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(t,e){let n;const i=e.width,s=e.height,r=e.thickness;n=i-r>=0&&s-r>=0?["M",i,0,"H0 M0 0 V0",s].join(" "):"M 0 0 0 0",Mm(t,{d:n,stroke:e.color,"stroke-width":e.thickness})}},{color:"rgba(224,224,224,0.2)",thickness:3,factor:4,markup:"path",update(t,e){let n;const i=e.factor||1,s=e.width*i,r=e.height*i,o=e.thickness;n=s-o>=0&&r-o>=0?["M",s,0,"H0 M0 0 V0",r].join(" "):"M 0 0 0 0",e.width=s,e.height=r,Mm(t,{d:n,stroke:e.color,"stroke-width":e.thickness})}}];class ov{constructor(){this.patterns={},this.root=ry.create(nm(),{width:"100%",height:"100%"},[em("defs")]).node}add(t,e){const n=this.root.childNodes[0];n&&n.appendChild(e),this.patterns[t]=e,ry.create("rect",{width:"100%",height:"100%",fill:`url(#${t})`}).appendTo(this.root)}get(t){return this.patterns[t]}has(t){return null!=this.patterns[t]}}(function(t){t.presets=a,t.registry=ev.create({type:"grid"}),t.registry.register(t.presets,!0)})(ov||(ov={}));const av=function(t){const e=document.createElement("canvas"),n=t.width,i=t.height;e.width=2*n,e.height=i;const s=e.getContext("2d");return s.drawImage(t,0,0,n,i),s.translate(2*n,0),s.scale(-1,1),s.drawImage(t,0,0,n,i),e},lv=function(t){const e=document.createElement("canvas"),n=t.width,i=t.height;e.width=n,e.height=2*i;const s=e.getContext("2d");return s.drawImage(t,0,0,n,i),s.translate(0,2*i),s.scale(1,-1),s.drawImage(t,0,0,n,i),e},cv=function(t){const e=document.createElement("canvas"),n=t.width,i=t.height;e.width=2*n,e.height=2*i;const s=e.getContext("2d");return s.drawImage(t,0,0,n,i),s.setTransform(-1,0,0,-1,e.width,e.height),s.drawImage(t,0,0,n,i),s.setTransform(-1,0,0,1,e.width,0),s.drawImage(t,0,0,n,i),s.setTransform(1,0,0,-1,0,e.height),s.drawImage(t,0,0,n,i),e},hv=function(t,e){const n=t.width,i=t.height,s=document.createElement("canvas");s.width=3*n,s.height=3*i;const r=s.getContext("2d"),o=null!=e.angle?-e.angle:-20,a=Ob.toRad(o),l=s.width/4,c=s.height/4;for(let h=0;h<4;h+=1)for(let e=0;e<4;e+=1)(h+e)%2>0&&(r.setTransform(1,0,0,1,(2*h-1)*l,(2*e-1)*c),r.rotate(a),r.drawImage(t,-n/2,-i/2,n,i));return s};var uv,dv;function gv(t,e){return null!=t?t:e}function pv(t,e){return null!=t&&Number.isFinite(t)?t:e}function fv(t={}){const e=gv(t.color,"blue"),n=pv(t.width,1),i=pv(t.margin,2),s=pv(t.opacity,1),r=i,o=i+n;return`\n <filter>\n <feFlood flood-color="${e}" flood-opacity="${s}" result="colored"/>\n <feMorphology in="SourceAlpha" result="morphedOuter" operator="dilate" radius="${o}" />\n <feMorphology in="SourceAlpha" result="morphedInner" operator="dilate" radius="${r}" />\n <feComposite result="morphedOuterColored" in="colored" in2="morphedOuter" operator="in"/>\n <feComposite operator="xor" in="morphedOuterColored" in2="morphedInner" result="outline"/>\n <feMerge>\n <feMergeNode in="outline"/>\n <feMergeNode in="SourceGraphic"/>\n </feMerge>\n </filter>\n `.trim()}function mv(t={}){const e=gv(t.color,"red"),n=pv(t.blur,0),i=pv(t.width,1),s=pv(t.opacity,1);return`\n <filter>\n <feFlood flood-color="${e}" flood-opacity="${s}" result="colored"/>\n <feMorphology result="morphed" in="SourceGraphic" operator="dilate" radius="${i}"/>\n <feComposite result="composed" in="colored" in2="morphed" operator="in"/>\n <feGaussianBlur result="blured" in="composed" stdDeviation="${n}"/>\n <feBlend in="SourceGraphic" in2="blured" mode="normal"/>\n </filter>\n `.trim()}function yv(t={}){const e=pv(t.x,2),n=null!=t.y&&Number.isFinite(t.y)?[e,t.y]:e;return`\n <filter>\n <feGaussianBlur stdDeviation="${n}"/>\n </filter>\n `.trim()}function bv(t={}){const e=pv(t.dx,0),n=pv(t.dy,0),i=gv(t.color,"black"),s=pv(t.blur,4),r=pv(t.opacity,1);return"SVGFEDropShadowElement"in window?`<filter>\n <feDropShadow stdDeviation="${s}" dx="${e}" dy="${n}" flood-color="${i}" flood-opacity="${r}" />\n </filter>`.trim():`<filter>\n <feGaussianBlur in="SourceAlpha" stdDeviation="${s}" />\n <feOffset dx="${e}" dy="${n}" result="offsetblur" />\n <feFlood flood-color="${i}" />\n <feComposite in2="offsetblur" operator="in" />\n <feComponentTransfer>\n <feFuncA type="linear" slope="${r}" />\n </feComponentTransfer>\n <feMerge>\n <feMergeNode/>\n <feMergeNode in="SourceGraphic"/>\n </feMerge>\n </filter>`.trim()}function vv(t={}){const e=pv(t.amount,1),n=.2126+.7874*(1-e),i=.7152-.7152*(1-e),s=.0722-.0722*(1-e),r=.2126-.2126*(1-e),o=.7152+.2848*(1-e),a=.0722-.0722*(1-e),l=.2126-.2126*(1-e),c=.0722+.9278*(1-e);return`\n <filter>\n <feColorMatrix type="matrix" values="${n} ${i} ${s} 0 0 ${r} ${o} ${a} 0 0 ${l} ${i} ${c} 0 0 0 0 0 1 0"/>\n </filter>\n `.trim()}function xv(t={}){const e=pv(t.amount,1),n=.393+.607*(1-e),i=.769-.769*(1-e),s=.189-.189*(1-e),r=.349-.349*(1-e),o=.686+.314*(1-e),a=.168-.168*(1-e),l=.272-.272*(1-e),c=.534-.534*(1-e),h=.131+.869*(1-e);return`\n <filter>\n <feColorMatrix type="matrix" values="${n} ${i} ${s} 0 0 ${r} ${o} ${a} 0 0 ${l} ${c} ${h} 0 0 0 0 0 1 0"/>\n </filter>\n `.trim()}function wv(t={}){const e=pv(t.amount,1);return`\n <filter>\n <feColorMatrix type="saturate" values="${1-e}"/>\n </filter>\n `.trim()}function Cv(t={}){const e=pv(t.angle,0);return`\n <filter>\n <feColorMatrix type="hueRotate" values="${e}"/>\n </filter>\n `.trim()}function Pv(t={}){const e=pv(t.amount,1),n=1-e;return`\n <filter>\n <feComponentTransfer>\n <feFuncR type="table" tableValues="${e} ${n}"/>\n <feFuncG type="table" tableValues="${e} ${n}"/>\n <feFuncB type="table" tableValues="${e} ${n}"/>\n </feComponentTransfer>\n </filter>\n `.trim()}function Ev(t={}){const e=pv(t.amount,1);return`\n <filter>\n <feComponentTransfer>\n <feFuncR type="linear" slope="${e}"/>\n <feFuncG type="linear" slope="${e}"/>\n <feFuncB type="linear" slope="${e}"/>\n </feComponentTransfer>\n </filter>\n `.trim()}function Mv(t={}){const e=pv(t.amount,1),n=.5-e/2;return`\n <filter>\n <feComponentTransfer>\n <feFuncR type="linear" slope="${e}" intercept="${n}"/>\n <feFuncG type="linear" slope="${e}" intercept="${n}"/>\n <feFuncB type="linear" slope="${e}" intercept="${n}"/>\n </feComponentTransfer>\n </filter>\n `.trim()}(function(t){t.presets=Object.assign({},l),t.presets["flip-x"]=av,t.presets["flip-y"]=lv,t.presets["flip-xy"]=cv,t.registry=ev.create({type:"background pattern"}),t.registry.register(t.presets,!0)})(uv||(uv={})),function(t){t.presets=c,t.registry=ev.create({type:"filter"}),t.registry.register(t.presets,!0)}(dv||(dv={}));const Ov={xlinkHref:"xlink:href",xlinkShow:"xlink:show",xlinkRole:"xlink:role",xlinkType:"xlink:type",xlinkArcrole:"xlink:arcrole",xlinkTitle:"xlink:title",xlinkActuate:"xlink:actuate",xmlSpace:"xml:space",xmlBase:"xml:base",xmlLang:"xml:lang",preserveAspectRatio:"preserveAspectRatio",requiredExtension:"requiredExtension",requiredFeatures:"requiredFeatures",systemLanguage:"systemLanguage",externalResourcesRequired:"externalResourceRequired"},Av={},Sv={position:Zv("x","width","origin")},Nv={position:Zv("y","height","origin")},Tv={position:Zv("x","width","corner")},kv={position:Zv("y","height","corner")},jv={set:Kv("width","width")},Lv={set:Kv("height","height")},Dv={set:Kv("rx","width")},Bv={set:Kv("ry","height")},Iv={set:(t=>{const e=Kv(t,"width"),n=Kv(t,"height");return function(t,i){const s=i.refBBox,r=s.height>s.width?e:n;return Pt(r,this,t,i)}})("r")},Rv={set(t,{refBBox:e}){let n=parseFloat(t);const i=vf(t);i&&(n/=100);const s=Math.sqrt(e.height*e.height+e.width*e.width);let r;return Number.isFinite(n)&&(r=i||n>=0&&n<=1?n*s:Math.max(n+s,0)),{r:r}}},Vv={set:Kv("cx","width")},zv={set:Kv("cy","height")},$v={set:tx({resetOffset:!0})},Fv={set:tx({resetOffset:!1})},Gv={set:ex({resetOffset:!0})},_v={set:ex({resetOffset:!1})},Hv=Iv,Uv=$v,Jv=Gv,qv=Sv,Wv=Nv,Xv=jv,Yv=Lv;function Zv(t,e,n){return(i,{refBBox:s})=>{if(null==i)return null;let r=parseFloat(i);const o=vf(i);let a;if(o&&(r/=100),Number.isFinite(r)){const i=s[n];a=o||r>0&&r<1?i[t]+s[e]*r:i[t]+r}const l=new Nb;return l[t]=a||0,l}}function Kv(t,e){return function(n,{refBBox:i}){let s=parseFloat(n);const r=vf(n);r&&(s/=100);const o={};if(Number.isFinite(s)){const n=r||s>=0&&s<=1?s*i[e]:Math.max(s+i[e],0);o[t]=n}return o}}function Qv(t,e){const n="x6-shape",i=e&&e.resetOffset;return function(e,{elem:s,refBBox:r}){let o=ny(s,n);if(!o||o.value!==e){const i=t(e);o={value:e,shape:i,shapeBBox:i.bbox()},ny(s,n,o)}const a=o.shape.clone(),l=o.shapeBBox.clone(),c=l.getOrigin(),h=r.getOrigin();l.x=h.x,l.y=h.y;const u=r.getMaxScaleToFit(l,h),d=0===l.width||0===r.width?1:u.sx,g=0===l.height||0===r.height?1:u.sy;return a.scale(d,g,c),i&&a.translate(-c.x,-c.y),a}}function tx(t){function e(t){return tv.parse(t)}const n=Qv(e,t);return(t,e)=>{const i=n(t,e);return{d:i.serialize()}}}function ex(t){const e=Qv(t=>new $b(t),t);return(t,n)=>{const i=e(t,n);return{points:i.serialize()}}}const nx={qualify:fr,set(t,{view:e}){return`url(#${e.graph.defineGradient(t)})`}},ix={qualify:fr,set(t,{view:e}){const n=e.cell,i=Object.assign({},t);if(n.isEdge()&&"linearGradient"===i.type){const t=e,s=t.sourcePoint,r=t.targetPoint;i.id=`gradient-${i.type}-${n.id}`,i.attrs=Object.assign(Object.assign({},i.attrs),{x1:s.x,y1:s.y,x2:r.x,y2:r.y,gradientUnits:"userSpaceOnUse"}),e.graph.defs.remove(i.id)}return`url(#${e.graph.defineGradient(i)})`}},sx={qualify(t,{attrs:e}){return null==e.textWrap||!fr(e.textWrap)},set(t,{view:e,elem:n,attrs:i}){const s="x6-text",r=ny(n,s),o=t=>{try{return JSON.parse(t)}catch(e){return t}},a={x:i.x,eol:i.eol,annotations:o(i.annotations),textPath:o(i["text-path"]||i.textPath),textVerticalAnchor:i["text-vertical-anchor"]||i.textVerticalAnchor,displayEmpty:"true"===(i["display-empty"]||i.displayEmpty),lineHeight:i["line-height"]||i.lineHeight},l=i["font-size"]||i.fontSize,c=JSON.stringify([t,a]);if(l&&n.setAttribute("font-size",l),null==r||r!==c){const i=a.textPath;if(null!=i&&"object"===typeof i){const t=i.selector;if("string"===typeof t){const n=e.find(t)[0];n instanceof SVGPathElement&&(Xf(n),a.textPath=Object.assign({"xlink:href":`#${n.id}`},i))}}uy(n,`${t}`,a),ny(n,s,c)}}},rx={qualify:fr,set(t,{view:e,elem:n,attrs:i,refBBox:s}){const r=t,o=r.width||0;vf(o)?s.width*=parseFloat(o)/100:o<=0?s.width+=o:s.width=o;const a=r.height||0;let l;vf(a)?s.height*=parseFloat(a)/100:a<=0?s.height+=a:s.height=a;let c=r.text;null==c&&(c=i.text||(null===n||void 0===n?void 0:n.textContent)),l=null!=c?py(`${c}`,s,{"font-weight":i["font-weight"]||i.fontWeight,"font-size":i["font-size"]||i.fontSize,"font-family":i["font-family"]||i.fontFamily,lineHeight:i.lineHeight},{ellipsis:r.ellipsis}):"",Pt(sx.set,this,l,{view:e,elem:n,attrs:i,refBBox:s,cell:e.cell})}},ox=(t,{attrs:e})=>void 0!==e.text,ax={qualify:ox},lx={qualify:ox},cx={qualify:ox},hx={qualify:ox},ux={qualify:ox},dx={qualify:ox},gx={qualify(t,{elem:e}){return e instanceof SVGElement},set(t,{elem:e}){const n="x6-title",i=`${t}`,s=ny(e,n);if(null==s||s!==i){ny(e,n,i);const t=e.firstChild;if(t&&"TITLE"===t.tagName.toUpperCase()){const e=t;e.textContent=i}else{const n=document.createElementNS(e.namespaceURI,"title");n.textContent=i,e.insertBefore(n,t)}}}},px={offset:yx("x","width","right")},fx={offset:yx("y","height","bottom")},mx={offset(t,{refBBox:e}){return t?{x:-e.x,y:-e.y}:{x:0,y:0}}};function yx(t,e,n){return(i,{refBBox:s})=>{const r=new Nb;let o;return o="middle"===i?s[e]/2:i===n?s[e]:"number"===typeof i&&Number.isFinite(i)?i>-1&&i<1?-s[e]*i:-i:vf(i)?s[e]*parseFloat(i)/100:0,r[t]=-(s[t]+o),r}}const bx={qualify:fr,set(t,{elem:e}){Km(e,t)}},vx={set(t,{elem:e}){e.innerHTML=`${t}`}},xx={qualify:fr,set(t,{view:e}){return`url(#${e.graph.defineFilter(t)})`}},wx={set(t){return null!=t&&"object"===typeof t&&t.id?t.id:t}};function Cx(t,e,n){let i,s;"object"===typeof e?(i=e.x,s=e.y):(i=e,s=n);const r=tv.parse(t),o=r.bbox();if(o){let t=-o.height/2-o.y,e=-o.width/2-o.x;"number"===typeof i&&(e-=i),"number"===typeof s&&(t-=s),r.translate(e,t)}return r.serialize()}var Px=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const Ex=t=>{var{size:e,width:n,height:i,offset:s,open:r}=t,o=Px(t,["size","width","height","offset","open"]);return Ox({size:e,width:n,height:i,offset:s},!0===r,!0,void 0,o)},Mx=t=>{var{size:e,width:n,height:i,offset:s,factor:r}=t,o=Px(t,["size","width","height","offset","factor"]);return Ox({size:e,width:n,height:i,offset:s},!1,!1,r,o)};function Ox(t,e,n,i=3/4,s={}){const r=t.size||10,o=t.width||r,a=t.height||r,l=new tv,c={};if(e)l.moveTo(o,0).lineTo(0,a/2).lineTo(o,a),c.fill="none";else{if(l.moveTo(0,a/2),l.lineTo(o,0),!n){const t=bf(i,0,1);l.lineTo(o*t,a/2)}l.lineTo(o,a),l.close()}return Object.assign(Object.assign(Object.assign({},c),s),{tagName:"path",d:Cx(l.serialize(),{x:null!=t.offset?t.offset:-o/2})})}var Ax=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const Sx=t=>{var{size:e,width:n,height:i,offset:s}=t,r=Ax(t,["size","width","height","offset"]);const o=e||10,a=n||o,l=i||o,c=new tv;return c.moveTo(0,l/2).lineTo(a/2,0).lineTo(a,l/2).lineTo(a/2,l).close(),Object.assign(Object.assign({},r),{tagName:"path",d:Cx(c.serialize(),null==s?-a/2:s)})};var Nx=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const Tx=t=>{var{d:e,offsetX:n,offsetY:i}=t,s=Nx(t,["d","offsetX","offsetY"]);return Object.assign(Object.assign({},s),{tagName:"path",d:Cx(e,n,i)})};var kx=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const jx=t=>{var{size:e,width:n,height:i,offset:s}=t,r=kx(t,["size","width","height","offset"]);const o=e||10,a=n||o,l=i||o,c=new tv;return c.moveTo(0,0).lineTo(a,l).moveTo(0,l).lineTo(a,0),Object.assign(Object.assign({},r),{tagName:"path",fill:"none",d:Cx(c.serialize(),s||-a/2)})};var Lx=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const Dx=t=>{var{width:e,height:n,offset:i,open:s,flip:r}=t,o=Lx(t,["width","height","offset","open","flip"]);let a=n||6;const l=e||10,c=!0===s,h=!0===r,u=Object.assign(Object.assign({},o),{tagName:"path"});h&&(a=-a);const d=new tv;return d.moveTo(0,a).lineTo(l,0),c?u.fill="none":(d.lineTo(l,a),d.close()),u.d=Cx(d.serialize(),{x:i||-l/2,y:a/2}),u};var Bx=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const Ix=t=>{var{r:e}=t,n=Bx(t,["r"]);const i=e||5;return Object.assign(Object.assign({cx:i},n),{tagName:"circle",r:i})},Rx=t=>{var{r:e}=t,n=Bx(t,["r"]);const i=e||5,s=new tv;return s.moveTo(i,0).lineTo(i,2*i),s.moveTo(0,i).lineTo(2*i,i),{children:[Object.assign(Object.assign({},Ix({r:i})),{fill:"none"}),Object.assign(Object.assign({},n),{tagName:"path",d:Cx(s.serialize(),-i)})]}};var Vx=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const zx=t=>{var{rx:e,ry:n}=t,i=Vx(t,["rx","ry"]);const s=e||5,r=n||5;return Object.assign(Object.assign({cx:s},i),{tagName:"ellipse",rx:s,ry:r})};var $x;(function(t){t.presets=h,t.registry=ev.create({type:"marker"}),t.registry.register(t.presets,!0)})($x||($x={})),function(t){t.normalize=Cx}($x||($x={}));var Fx=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};function Gx(t){return"string"===typeof t||fr(t)}const _x={qualify:Gx,set(t,{view:e,attrs:n}){return Jx("marker-start",t,e,n)}},Hx={qualify:Gx,set(t,{view:e,attrs:n}){return Jx("marker-end",t,e,n,{transform:"rotate(180)"})}},Ux={qualify:Gx,set(t,{view:e,attrs:n}){return Jx("marker-mid",t,e,n)}};function Jx(t,e,n,i,s={}){const r="string"===typeof e?{name:e}:e,{name:o,args:a}=r,l=Fx(r,["name","args"]);let c=l;if(o&&"string"===typeof o){const t=$x.registry.get(o);if(!t)return $x.registry.onNotFound(o);c=t(Object.assign(Object.assign({},l),a))}const h=Object.assign(Object.assign(Object.assign({},qx(i,t)),s),c);return{[t]:`url(#${n.graph.defineMarker(h)})`}}function qx(t,e){const n={},i=t.stroke;"string"===typeof i&&(n.stroke=i,n.fill=i);let s=t.strokeOpacity;if(null==s&&(s=t["stroke-opacity"]),null==s&&(s=t.opacity),null!=s&&(n["stroke-opacity"]=s,n["fill-opacity"]=s),"marker-mid"!==e){const i=parseFloat(t.strokeWidth||t["stroke-width"]);if(Number.isFinite(i)&&i>1){const t=Math.ceil(i/2);n.refX="marker-start"===e?t:-t}}return n}const Wx=(t,{view:e})=>e.cell.isEdge(),Xx={qualify:Wx,set(t,e){var n,i,s,r;const o=e.view,a=t.reverse||!1,l=t.stubs||0;let c;if(Number.isFinite(l)&&0!==l)if(a){let t,e;const a=o.getConnectionLength()||0;l<0?(t=(a+l)/2,e=-l):(t=l,e=a-2*l);const h=o.getConnection();c=null===(r=null===(s=null===(i=null===(n=null===h||void 0===h?void 0:h.divideAtLength(t))||void 0===n?void 0:n[1])||void 0===i?void 0:i.divideAtLength(e))||void 0===s?void 0:s[0])||void 0===r?void 0:r.serialize()}else{let t;if(l<0){const e=o.getConnectionLength()||0;t=(e+l)/2}else t=l;const e=o.getConnection();if(e){const n=e.divideAtLength(t),i=e.divideAtLength(-t);n&&i&&(c=`${n[0].serialize()} ${i[1].serialize()}`)}}return{d:c||o.getConnectionPathData()}}},Yx={qualify:Wx,set:nw("getTangentAtLength",{rotate:!0})},Zx={qualify:Wx,set:nw("getTangentAtLength",{rotate:!1})},Kx={qualify:Wx,set:nw("getTangentAtRatio",{rotate:!0})},Qx={qualify:Wx,set:nw("getTangentAtRatio",{rotate:!1})},tw=Yx,ew=Kx;function nw(t,e){const n={x:1,y:0};return(i,s)=>{let r,o;const a=s.view,l=a[t](Number(i));return l?(o=e.rotate?l.vector().vectorAngle(n):0,r=l.start):(r=a.path.start,o=0),0===o?{transform:`translate(${r.x},${r.y}')`}:{transform:`translate(${r.x},${r.y}') rotate(${o})`}}}var iw;(function(t){function e(t,e,n){if(null!=t){if("string"===typeof t)return!0;if("function"!==typeof t.qualify||Pt(t.qualify,this,e,n))return!0}return!1}t.isValidDefinition=e})(iw||(iw={})),function(t){t.presets=Object.assign(Object.assign({},Ov),u),t.registry=ev.create({type:"attribute definition"}),t.registry.register(t.presets,!0)}(iw||(iw={}));const sw={prefixCls:"x6",autoInsertCSS:!0,useCSSSelector:!0,prefix(t){return`${sw.prefixCls}-${t}`}},rw=sw.prefix("highlighted"),ow={highlight(t,e,n){const i=n&&n.className||rw;Hf(e,i)},unhighlight(t,e,n){const i=n&&n.className||rw;Uf(e,i)}},aw=sw.prefix("highlight-opacity"),lw={highlight(t,e){Hf(e,aw)},unhighlight(t,e){Uf(e,aw)}};var cw;(function(t){function e(t,e){const n=Ly(t.x,t.y).matrixTransform(e);return new Nb(n.x,n.y)}function n(t,n){return new kb(e(t.start,n),e(t.end,n))}function i(t,n){let i=t instanceof $b?t.points:t;return Array.isArray(i)||(i=[]),new $b(i.map(t=>e(t,n)))}function s(t,e){const n=em("svg"),i=n.createSVGPoint();i.x=t.x,i.y=t.y;const s=i.matrixTransform(e);i.x=t.x+t.width,i.y=t.y;const r=i.matrixTransform(e);i.x=t.x+t.width,i.y=t.y+t.height;const o=i.matrixTransform(e);i.x=t.x,i.y=t.y+t.height;const a=i.matrixTransform(e),l=Math.min(s.x,r.x,o.x,a.x),c=Math.max(s.x,r.x,o.x,a.x),h=Math.min(s.y,r.y,o.y,a.y),u=Math.max(s.y,r.y,o.y,a.y);return new Tb(l,h,c-l,u-h)}function r(t,e,n){let i;const r=t.ownerSVGElement;if(!r)return new Tb(0,0,0,0);try{i=t.getBBox()}catch(a){i={x:t.clientLeft,y:t.clientTop,width:t.clientWidth,height:t.clientHeight}}if(e)return Tb.create(i);const o=Wy(t,n||r);return s(i,o)}function o(t,e={}){let n;const i=t.ownerSVGElement;if(!i||!Yf(t)){if(bm(t)){const{left:e,top:n,width:i,height:s}=a(t);return new Tb(e,n,i,s)}return new Tb(0,0,0,0)}let r=e.target;const l=e.recursive;if(!l){try{n=t.getBBox()}catch(c){n={x:t.clientLeft,y:t.clientTop,width:t.clientWidth,height:t.clientHeight}}if(!r)return Tb.create(n);const e=Wy(t,r);return s(n,e)}{const e=t.childNodes,i=e.length;if(0===i)return o(t,{target:r});r||(r=t);for(let t=0;t<i;t+=1){const i=e[t];let s;s=0===i.childNodes.length?o(i,{target:r}):o(i,{target:r,recursive:!0}),n=n?n.union(s):s}return n}}function a(t){let e=0,n=0,i=0,s=0;if(t){let r=t;while(r)e+=r.offsetLeft,n+=r.offsetTop,r=r.offsetParent,r&&(e+=parseInt(Hm(r,"borderLeft"),10),n+=parseInt(Hm(r,"borderTop"),10));i=t.offsetWidth,s=t.offsetHeight}return{left:e,top:n,width:i,height:s}}function l(t){const e=e=>{const n=t.getAttribute(e),i=n?parseFloat(n):0;return Number.isNaN(i)?0:i};switch(t instanceof SVGElement&&t.nodeName.toLowerCase()){case"rect":return new Tb(e("x"),e("y"),e("width"),e("height"));case"circle":return new jb(e("cx"),e("cy"),e("r"),e("r"));case"ellipse":return new jb(e("cx"),e("cy"),e("rx"),e("ry"));case"polyline":{const e=Cy(t);return new $b(e)}case"polygon":{const e=Cy(t);return e.length>1&&e.push(e[0]),new $b(e)}case"path":{let e=t.getAttribute("d");return tv.isValid(e)||(e=tv.normalize(e)),tv.parse(e)}case"line":return new kb(e("x1"),e("y1"),e("x2"),e("y2"));default:break}return o(t)}function c(t,e,n,i){const s=Nb.create(e),r=Nb.create(n);if(!i){const e=t instanceof SVGSVGElement?t:t.ownerSVGElement;i=e}const a=qy(t);t.setAttribute("transform","");const l=o(t,{target:i}).scale(a.sx,a.sy),c=By();c.setTranslate(-l.x-l.width/2,-l.y-l.height/2);const h=By(),u=s.angleBetween(r,s.clone().translate(1,0));u&&h.setRotate(u,0,0);const d=By(),g=s.clone().move(r,l.width/2);d.setTranslate(2*s.x-g.x,2*s.y-g.y);const p=Wy(t,i),f=By();f.setMatrix(d.matrix.multiply(h.matrix.multiply(c.matrix.multiply(p.scale(a.sx,a.sy))))),t.setAttribute("transform",Ry(f.matrix))}function h(t){if(null==t)return null;let e=t;do{let t=e.tagName;if("string"!==typeof t)return null;if(t=t.toUpperCase(),_f(e,"x6-port"))e=e.nextElementSibling;else if("G"===t)e=e.firstElementChild;else{if("TITLE"!==t)break;e=e.nextElementSibling}}while(e);return e}function u(t){const e=h(t);if(!Yf(e)){if(bm(t)){const{left:e,top:n,width:i,height:s}=a(t);return new Tb(e,n,i,s)}return new Tb(0,0,0,0)}const n=l(e),i=n.bbox()||Tb.create();return i}t.normalizeMarker=Cx,t.transformPoint=e,t.transformLine=n,t.transformPolyline=i,t.transformRectangle=s,t.bbox=r,t.getBBox=o,t.getBoundingOffsetRect=a,t.toGeometryShape=l,t.translateAndAutoOrient=c,t.findShapeNode=h,t.getBBoxV2=u})(cw||(cw={}));const hw={padding:3,rx:0,ry:0,attrs:{"stroke-width":3,stroke:"#FEB663"}},uw={highlight(t,e,n){const i=dw.getHighlighterId(e,n);if(dw.hasCache(i))return;n=Ah({},n,hw);const s=ry.create(e);let r,o;try{r=s.toPathData()}catch(h){o=cw.bbox(s.node,!0),r=Oy(Object.assign(Object.assign({},n),o))}const a=em("path");if(Mm(a,Object.assign({d:r,"pointer-events":"none","vector-effect":"non-scaling-stroke",fill:"none"},n.attrs?Am(n.attrs):null)),t.isEdgeElement(e))Mm(a,"d",t.getConnectionPathData());else{let e=s.getTransformToElement(t.container);const i=n.padding;if(i){null==o&&(o=cw.bbox(s.node,!0));const t=o.x+o.width/2,n=o.y+o.height/2;o=cw.transformRectangle(o,e);const r=Math.max(o.width,1),a=Math.max(o.height,1),l=(r+i)/r,c=(a+i)/a,h=Dy({a:l,b:0,c:0,d:c,e:t-l*t,f:n-c*n});e=e.multiply(h)}Hy(a,e)}Hf(a,sw.prefix("highlight-stroke"));const l=t.cell,c=()=>dw.removeHighlighter(i);l.on("removed",c),l.model&&l.model.on("reseted",c),t.container.appendChild(a),dw.setCache(i,a)},unhighlight(t,e,n){dw.removeHighlighter(dw.getHighlighterId(e,n))}};var dw,gw;function pw(t,e={}){return new Nb(xf(e.x,t.width),xf(e.y,t.height))}function fw(t,e,n){return Object.assign({angle:e,position:t.toJSON()},n)}(function(t){function e(t,e){return Xf(t),t.id+JSON.stringify(e)}t.getHighlighterId=e;const n={};function i(t,e){n[t]=e}function s(t){return null!=n[t]}function r(t){const e=n[t];e&&(hm(e),delete n[t])}t.setCache=i,t.hasCache=s,t.removeHighlighter=r})(dw||(dw={})),function(t){function e(t,e){if("function"!==typeof e.highlight)throw new Error(`Highlighter '${t}' is missing required \`highlight()\` method`);if("function"!==typeof e.unhighlight)throw new Error(`Highlighter '${t}' is missing required \`unhighlight()\` method`)}t.check=e}(gw||(gw={})),function(t){t.presets=d,t.registry=ev.create({type:"highlighter"}),t.registry.register(t.presets,!0)}(gw||(gw={}));const mw=(t,e)=>t.map(({x:t,y:n,angle:i})=>fw(pw(e,{x:t,y:n}),i||0)),yw=(t,e,n)=>{const i=n.start||0,s=n.step||20;return vw(t,e,i,(t,e)=>(t+.5-e/2)*s)},bw=(t,e,n)=>{const i=n.start||0,s=n.step||360/t.length;return vw(t,e,i,t=>t*s)};function vw(t,e,n,i){const s=e.getCenter(),r=e.getTopCenter(),o=e.width/e.height,a=jb.fromRect(e),l=t.length;return t.map((t,e)=>{const c=n+i(e,l),h=r.clone().rotate(-c,s).scale(o,1,s),u=t.compensateRotate?-a.tangentTheta(h):0;return(t.dx||t.dy)&&h.translate(t.dx||0,t.dy||0),t.dr&&h.move(s,t.dr),fw(h.round(),u,t)})}var xw=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const ww=(t,e,n)=>{const i=pw(e,n.start||e.getOrigin()),s=pw(e,n.end||e.getCorner());return Ow(t,i,s,n)},Cw=(t,e,n)=>Ow(t,e.getTopLeft(),e.getBottomLeft(),n),Pw=(t,e,n)=>Ow(t,e.getTopRight(),e.getBottomRight(),n),Ew=(t,e,n)=>Ow(t,e.getTopLeft(),e.getTopRight(),n),Mw=(t,e,n)=>Ow(t,e.getBottomLeft(),e.getBottomRight(),n);function Ow(t,e,n,i){const s=new kb(e,n),r=t.length;return t.map((t,e)=>{var{strict:n}=t,o=xw(t,["strict"]);const a=n||i.strict?(e+1)/(r+1):(e+.5)/r,l=s.pointAt(a);return(o.dx||o.dy)&&l.translate(o.dx||0,o.dy||0),fw(l.round(),0,o)})}var Aw;(function(t){t.presets=g,t.registry=ev.create({type:"port layout"}),t.registry.register(t.presets,!0)})(Aw||(Aw={}));const Sw={position:{x:0,y:0},angle:0,attrs:{".":{y:"0","text-anchor":"start"}}};function Nw(t,e){const{x:n,y:i,angle:s,attrs:r}=e||{};return Ah({},{angle:s,attrs:r,position:{x:n,y:i}},t,Sw)}const Tw=(t,e,n)=>Nw({position:e.getTopLeft()},n),kw=(t,e,n)=>Nw({position:{x:-15,y:0},attrs:{".":{y:".3em","text-anchor":"end"}}},n),jw=(t,e,n)=>Nw({position:{x:15,y:0},attrs:{".":{y:".3em","text-anchor":"start"}}},n),Lw=(t,e,n)=>Nw({position:{x:0,y:-15},attrs:{".":{"text-anchor":"middle"}}},n),Dw=(t,e,n)=>Nw({position:{x:0,y:15},attrs:{".":{y:".6em","text-anchor":"middle"}}},n),Bw=(t,e,n)=>zw(t,e,!1,n),Iw=(t,e,n)=>zw(t,e,!0,n),Rw=(t,e,n)=>$w(t,e,!1,n),Vw=(t,e,n)=>$w(t,e,!0,n);function zw(t,e,n,i){const s=null!=i.offset?i.offset:15,r=e.getCenter().theta(t),o=Fw(e);let a,l,c,h,u=0;return r<o[1]||r>o[2]?(a=".3em",l=s,c=0,h="start"):r<o[0]?(a="0",l=0,c=-s,n?(u=-90,h="start"):h="middle"):r<o[3]?(a=".3em",l=-s,c=0,h="end"):(a=".6em",l=0,c=s,n?(u=90,h="start"):h="middle"),Nw({position:{x:Math.round(l),y:Math.round(c)},angle:u,attrs:{".":{y:a,"text-anchor":h}}},i)}function $w(t,e,n,i){const s=null!=i.offset?i.offset:15,r=e.getCenter().theta(t),o=Fw(e);let a,l,c,h,u=0;return r<o[1]||r>o[2]?(a=".3em",l=-s,c=0,h="end"):r<o[0]?(a=".6em",l=0,c=s,n?(u=90,h="start"):h="middle"):r<o[3]?(a=".3em",l=s,c=0,h="start"):(a="0em",l=0,c=-s,n?(u=-90,h="start"):h="middle"),Nw({position:{x:Math.round(l),y:Math.round(c)},angle:u,attrs:{".":{y:a,"text-anchor":h}}},i)}function Fw(t){const e=t.getCenter(),n=e.theta(t.getTopLeft()),i=e.theta(t.getBottomLeft()),s=e.theta(t.getBottomRight()),r=e.theta(t.getTopRight());return[n,r,s,i]}const Gw=(t,e,n)=>Hw(t.diff(e.getCenter()),!1,n),_w=(t,e,n)=>Hw(t.diff(e.getCenter()),!0,n);function Hw(t,e,n){const i=null!=n.offset?n.offset:20,s=new Nb(0,0),r=-t.theta(s),o=t.clone().move(s,i).diff(t).round();let a,l=".3em",c=r;return(r+90)%180===0?(a=e?"end":"middle",e||-270!==r||(l="0em")):r>-270&&r<-90?(a="start",c=r-180):a="end",Nw({position:o.round().toJSON(),angle:e?c:0,attrs:{".":{y:l,"text-anchor":a}}},n)}var Uw;(function(t){t.presets=p,t.registry=ev.create({type:"port label layout"}),t.registry.register(t.presets,!0)})(Uw||(Uw={}));var Jw,qw,Ww=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class Xw extends Hh{get priority(){return 2}get disposeContainer(){return!0}constructor(){super(),this.cid=Jw.uniqueId(),Xw.views[this.cid]=this}confirmUpdate(t,e){return 0}empty(t=this.container){return um(t),this}unmount(t=this.container){return hm(t),this}remove(t=this.container){return t===this.container?(this.removeEventListeners(document),this.onRemove(),delete Xw.views[this.cid],this.disposeContainer&&this.unmount(t)):this.unmount(t),this}onRemove(){}setClass(t,e=this.container){e.classList.value=Array.isArray(t)?t.join(" "):t}addClass(t,e=this.container){return Hf(e,Array.isArray(t)?t.join(" "):t),this}removeClass(t,e=this.container){return Uf(e,Array.isArray(t)?t.join(" "):t),this}setStyle(t,e=this.container){return Km(e,t),this}setAttrs(t,e=this.container){return null!=t&&null!=e&&Mm(e,t),this}findAttr(t,e=this.container){let n=e;while(n&&1===n.nodeType){const e=n.getAttribute(t);if(null!=e)return e;if(n===this.container)return null;n=n.parentNode}return null}find(t,e=this.container,n=this.selectors){return Xw.find(t,e,n).elems}findOne(t,e=this.container,n=this.selectors){const i=this.find(t,e,n);return i.length>0?i[0]:null}findByAttr(t,e=this.container){let n=e;while(n&&n.getAttribute){const e=n.getAttribute(t);if((null!=e||n===this.container)&&"false"!==e)return n;n=n.parentNode}return null}getSelector(t,e){let n;if(t===this.container)return"string"===typeof e&&(n=`> ${e}`),n;if(t){const i=rm(t)+1;n=`${t.tagName.toLowerCase()}:nth-child(${i})`,e&&(n+=` > ${e}`),n=this.getSelector(t.parentNode,n)}return n}prefixClassName(t){return sw.prefix(t)}delegateEvents(t,e){if(null==t)return this;e||this.undelegateEvents();const n=/^(\S+)\s*(.*)$/;return Object.keys(t).forEach(e=>{const i=e.match(n);if(null==i)return;const s=this.getEventHandler(t[e]);"function"===typeof s&&this.delegateEvent(i[1],i[2],s)}),this}undelegateEvents(){return ib.off(this.container,this.getEventNamespace()),this}delegateDocumentEvents(t,e){return this.addEventListeners(document,t,e),this}undelegateDocumentEvents(){return this.removeEventListeners(document),this}delegateEvent(t,e,n){return ib.on(this.container,t+this.getEventNamespace(),e,n),this}undelegateEvent(t,e,n){const i=t+this.getEventNamespace();return null==e?ib.off(this.container,i):"string"===typeof e?ib.off(this.container,i,e,n):ib.off(this.container,i,e),this}addEventListeners(t,e,n){if(null==e)return this;const i=this.getEventNamespace();return Object.keys(e).forEach(s=>{const r=this.getEventHandler(e[s]);"function"===typeof r&&ib.on(t,s+i,n,r)}),this}removeEventListeners(t){return null!=t&&ib.off(t,this.getEventNamespace()),this}getEventNamespace(){return`.${sw.prefixCls}-event-${this.cid}`}getEventHandler(t){let e;if("string"===typeof t){const n=this[t];"function"===typeof n&&(e=(...t)=>n.call(this,...t))}else e=(...e)=>t.call(this,...e);return e}getEventTarget(t,e={}){const{target:n,type:i,clientX:s=0,clientY:r=0}=t;return e.fromPoint||"touchmove"===i||"touchend"===i?document.elementFromPoint(s,r):n}stopPropagation(t){return this.setEventData(t,{propagationStopped:!0}),this}isPropagationStopped(t){return!0===this.getEventData(t).propagationStopped}getEventData(t){return this.eventData(t)}setEventData(t,e){return this.eventData(t,e)}eventData(t,e){if(null==t)throw new TypeError("Event object required");let n=t.data;const i=`__${this.cid}__`;return null==e?null==n?{}:n[i]||{}:(null==n&&(n=t.data={}),null==n[i]?n[i]=Object.assign({},e):n[i]=Object.assign(Object.assign({},n[i]),e),n[i])}normalizeEvent(t){return Xw.normalizeEvent(t)}dispose(){this.remove()}}Ww([Xw.dispose()],Xw.prototype,"dispose",null),function(t){function e(t,e){return e?em(t||"g"):tm(t||"div")}function n(t,e,n){if(!t||"."===t)return{elems:[e]};if(n){const e=n[t];if(e)return{elems:Array.isArray(e)?e:[e]}}if(sw.useCSSSelector){const n=t.includes(">")?`:scope ${t}`:t;return{isCSSSelector:!0,elems:Array.prototype.slice.call(e.querySelectorAll(n))}}return{elems:[]}}function i(t){let e=t;const n=t.originalEvent,i=n&&n.changedTouches&&n.changedTouches[0];if(i){for(const e in t)void 0===i[e]&&(i[e]=t[e]);e=i}return e}t.createElement=e,t.find=n,t.normalizeEvent=i}(Xw||(Xw={})),function(t){function e(e){return t.views[e]||null}t.views={},t.getView=e}(Xw||(Xw={})),function(t){let e=0;function n(){const t=`v${e}`;return e+=1,t}t.uniqueId=n}(Jw||(Jw={}));class Yw{constructor(t){this.view=t,this.clean()}clean(){this.elemCache&&this.elemCache.dispose(),this.elemCache=new Cb,this.pathCache={}}get(t){const e=this.elemCache;return e.has(t)||this.elemCache.set(t,{}),this.elemCache.get(t)}getData(t){const e=this.get(t);return e.data||(e.data={}),e.data}getMatrix(t){const e=this.get(t);if(null==e.matrix){const n=this.view.container;e.matrix=Xy(t,n)}return Dy(e.matrix)}getShape(t){const e=this.get(t);return null==e.shape&&(e.shape=cw.toGeometryShape(t)),e.shape.clone()}getBoundingRect(t){const e=this.get(t);return null==e.boundingRect&&(e.boundingRect=cw.getBBoxV2(t)),e.boundingRect.clone()}}(function(t){function e(t){return null!=t&&!n(t)}function n(t){return null!=t&&"string"===typeof t}function i(t){return null==t||n(t)?t:yh(t)}function s(t){return`${t}`.trim().replace(/[\r|\n]/g," ").replace(/>\s+</g,"><")}function r(t,e={ns:Zf.svg}){const n=document.createDocumentFragment(),i={},s={},r=[{markup:Array.isArray(t)?t:[t],parent:n,ns:e.ns}];while(r.length>0){const t=r.pop();let e=t.ns||Zf.svg;const n=t.markup,o=t.parent;n.forEach(t=>{const n=t.tagName;if(!n)throw new TypeError("Invalid tagName");t.ns&&(e=t.ns);const a=e?tm(n,e):Qf(n),l=t.attrs;l&&Mm(a,Am(l));const c=t.style;c&&Km(a,c);const h=t.className;null!=h&&a.setAttribute("class",Array.isArray(h)?h.join(" "):h),t.textContent&&(a.textContent=t.textContent);const u=t.selector;if(null!=u){if(s[u])throw new TypeError("Selector must be unique");s[u]=a}if(t.groupSelector){let e=t.groupSelector;Array.isArray(e)||(e=[e]),e.forEach(t=>{i[t]||(i[t]=[]),i[t].push(a)})}o.appendChild(a);const d=t.children;Array.isArray(d)&&r.push({ns:e,markup:d,parent:a})})}return Object.keys(i).forEach(t=>{if(s[t])throw new Error("Ambiguous group selector");s[t]=i[t]}),{fragment:n,selectors:s,groups:i}}function o(t){return t instanceof SVGElement?em("g"):Qf("div")}function a(t){if(n(t)){const e=ry.createVectors(t),n=e.length;if(1===n)return{elem:e[0].node};if(n>1){const t=o(e[0].node);return e.forEach(e=>{t.appendChild(e.node)}),{elem:t}}return{}}const e=r(t),i=e.fragment;let s=null;return i.childNodes.length>1?(s=o(i.firstChild),s.appendChild(i)):s=i.firstChild,{elem:s,selectors:e.selectors}}function l(t){const e=ry.createVectors(t),n=document.createDocumentFragment();for(let i=0,s=e.length;i<s;i+=1){const t=e[i].node;n.appendChild(t)}return{fragment:n,selectors:{}}}t.isJSONMarkup=e,t.isStringMarkup=n,t.clone=i,t.sanitize=s,t.parseJSONMarkup=r,t.renderMarkup=a,t.parseLabelStringMarkup=l})(qw||(qw={})),function(t){function e(t,n,i){if(null!=t){let s;const r=t.tagName.toLowerCase();if(t===n)return s="string"===typeof i?`> ${r} > ${i}`:`> ${r}`,s;const o=t.parentNode;if(o&&o.childNodes.length>1){const e=rm(t)+1;s=`${r}:nth-child(${e})`}else s=r;return i&&(s+=` > ${i}`),e(t.parentNode,n,s)}return i}t.getSelector=e}(qw||(qw={})),function(t){function e(){return"g"}function n(){return{tagName:"circle",selector:"circle",attrs:{r:10,fill:"#FFFFFF",stroke:"#000000"}}}function i(){return{tagName:"text",selector:"text",attrs:{fill:"#000000"}}}t.getPortContainerMarkup=e,t.getPortMarkup=n,t.getPortLabelMarkup=i}(qw||(qw={})),function(t){function e(){return[{tagName:"path",selector:"wrap",groupSelector:"lines",attrs:{fill:"none",cursor:"pointer",stroke:"transparent",strokeLinecap:"round"}},{tagName:"path",selector:"line",groupSelector:"lines",attrs:{fill:"none",pointerEvents:"none"}}]}t.getEdgeMarkup=e}(qw||(qw={})),function(t){function e(t=!1){return{tagName:"foreignObject",selector:"fo",children:[{ns:Zf.xhtml,tagName:"body",selector:"foBody",attrs:{xmlns:Zf.xhtml},style:{width:"100%",height:"100%",background:"transparent"},children:t?[]:[{tagName:"div",selector:"foContent",style:{width:"100%",height:"100%"}}]}]}}t.getForeignObjectMarkup=e}(qw||(qw={}));class Zw{constructor(t){this.view=t}get cell(){return this.view.cell}getDefinition(t){return this.cell.getAttrDefinition(t)}processAttrs(t,e){let n,i,s,r;const o=[];return Object.keys(e).forEach(i=>{const s=e[i],r=this.getDefinition(i),a=Pt(iw.isValidDefinition,this.view,r,s,{elem:t,attrs:e,cell:this.cell,view:this.view});if(r&&a)"string"===typeof r?(null==n&&(n={}),n[r]=s):null!==s&&o.push({name:i,definition:r});else{null==n&&(n={});const t=xm.includes(i)?i:of(i);n[t]=s}}),o.forEach(({name:t,definition:n})=>{const o=e[t],a=n;"function"===typeof a.set&&(null==i&&(i={}),i[t]=o);const l=n;"function"===typeof l.offset&&(null==s&&(s={}),s[t]=o);const c=n;"function"===typeof c.position&&(null==r&&(r={}),r[t]=o)}),{raw:e,normal:n,set:i,offset:s,position:r}}mergeProcessedAttrs(t,e){t.set=Object.assign(Object.assign({},t.set),e.set),t.position=Object.assign(Object.assign({},t.position),e.position),t.offset=Object.assign(Object.assign({},t.offset),e.offset);const n=t.normal&&t.normal.transform;null!=n&&e.normal&&(e.normal.transform=n),t.normal=e.normal}findAttrs(t,e,n,i){const s=[],r=new Cb;return Object.keys(t).forEach(o=>{const a=t[o];if(!fr(a))return;const{isCSSSelector:l,elems:c}=Xw.find(o,e,i);n[o]=c;for(let t=0,e=c.length;t<e;t+=1){const n=c[t],h=i&&i[o]===n,u=r.get(n);if(u){u.array||(s.push(n),u.array=!0,u.attrs=[u.attrs],u.priority=[u.priority]);const t=u.attrs,i=u.priority;if(h)t.unshift(a),i.unshift(-1);else{const n=Ou(i,l?-1:e);t.splice(n,0,a),i.splice(n,0,e)}}else r.set(n,{elem:n,attrs:a,priority:h?-1:e,array:!1})}}),s.forEach(t=>{const e=r.get(t),n=e.attrs;e.attrs=n.reduceRight((t,e)=>jo(t,e),{})}),r}updateRelativeAttrs(t,e,n){const i=e.raw||{};let s=e.normal||{};const r=e.set,o=e.position,a=e.offset,l=()=>({elem:t,cell:this.cell,view:this.view,attrs:i,refBBox:n.clone()});if(null!=r&&Object.keys(r).forEach(t=>{const e=r[t],n=this.getDefinition(t);if(null!=n){const i=Pt(n.set,this.view,e,l());"object"===typeof i?s=Object.assign(Object.assign({},s),i):null!=i&&(s[t]=i)}}),t instanceof HTMLElement)return void this.view.setAttrs(s,t);const c=s.transform,h=c?`${c}`:null,u=Iy(h),d=new Nb(u.e,u.f);c&&(delete s.transform,u.e=0,u.f=0);let g=!1;null!=o&&Object.keys(o).forEach(t=>{const e=o[t],n=this.getDefinition(t);if(null!=n){const t=Pt(n.position,this.view,e,l());null!=t&&(g=!0,d.translate(Nb.create(t)))}}),this.view.setAttrs(s,t);let p=!1;if(null!=a){const e=this.view.getBoundingRectOfElement(t);if(e.width>0&&e.height>0){const n=cw.transformRectangle(e,u);Object.keys(a).forEach(e=>{const s=a[e],r=this.getDefinition(e);if(null!=r){const e=Pt(r.offset,this.view,s,{elem:t,cell:this.cell,view:this.view,attrs:i,refBBox:n});null!=e&&(p=!0,d.translate(Nb.create(e)))}})}}(null!=c||g||p)&&(d.round(1),u.e=Number.isFinite(d.x)?d.x:0,u.f=Number.isFinite(d.y)?d.y:0,t.setAttribute("transform",Ry(u)))}update(t,e,n){const i={},s=this.findAttrs(n.attrs||e,t,i,n.selectors),r=n.attrs?this.findAttrs(e,t,i,n.selectors):s,o=[];s.each(e=>{const s=e.elem,a=e.attrs,l=this.processAttrs(s,a);if(null==l.set&&null==l.position&&null==l.offset)this.view.setAttrs(l.normal,s);else{const e=r.get(s),c=e?e.attrs:null,h=c&&null==a.ref?c.ref:a.ref;let u;if(h){if(u=(i[h]||this.view.find(h,t,n.selectors))[0],!u)throw new Error(`"${h}" reference does not exist.`)}else u=null;const d={node:s,refNode:u,attributes:c,processedAttributes:l},g=o.findIndex(t=>t.refNode===s);g>-1?o.splice(g,0,d):o.push(d)}});const a=new Cb;let l;o.forEach(e=>{const i=e.node,s=e.refNode;let r;const o=null!=s&&null!=n.rotatableNode&&cm(n.rotatableNode,s);if(s&&(r=a.get(s)),!r){const e=o?n.rotatableNode:t;r=s?cw.getBBox(s,{target:e}):n.rootBBox,s&&a.set(s,r)}let c;n.attrs&&e.attributes?(c=this.processAttrs(i,e.attributes),this.mergeProcessedAttrs(c,e.processedAttributes)):c=e.processedAttributes;let h=r;o&&null!=n.rotatableNode&&!n.rotatableNode.contains(i)&&(l||(l=Iy(Mm(n.rotatableNode,"transform"))),h=cw.transformRectangle(r,l)),this.updateRelativeAttrs(i,c,h)})}}class Kw{get cell(){return this.view.cell}constructor(t,e,n=[]){this.view=t;const i={},s={};let r=0;Object.keys(e).forEach(t=>{let n=e[t];Array.isArray(n)||(n=[n]),n.forEach(e=>{let n=i[e];n||(r+=1,n=i[e]=1<<r),s[t]|=n})});let o=n;if(Array.isArray(o)||(o=[o]),o.forEach(t=>{i[t]||(r+=1,i[t]=1<<r)}),r>25)throw new Error("Maximum number of flags exceeded.");this.flags=i,this.attrs=s,this.bootstrap=n}getFlag(t){const e=this.flags;return null==e?0:Array.isArray(t)?t.reduce((t,n)=>t|e[n],0):0|e[t]}hasAction(t,e){return t&this.getFlag(e)}removeAction(t,e){return t^t&this.getFlag(e)}getBootstrapFlag(){return this.getFlag(this.bootstrap)}getChangedFlag(){let t=0;return this.attrs?(Object.keys(this.attrs).forEach(e=>{this.cell.hasChanged(e)&&(t|=this.attrs[e])}),t):t}}var Qw=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o},tC=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class eC extends Xw{static getDefaults(){return this.defaults}static config(t){this.defaults=this.getOptions(t)}static getOptions(t){const e=(t,e)=>null!=e?du([...Array.isArray(t)?t:[t],...Array.isArray(e)?e:[e]]):Array.isArray(t)?[...t]:[t],n=yh(this.getDefaults()),{bootstrap:i,actions:s,events:r,documentEvents:o}=t,a=tC(t,["bootstrap","actions","events","documentEvents"]);return i&&(n.bootstrap=e(n.bootstrap,i)),s&&Object.entries(s).forEach(([t,i])=>{const s=n.actions[t];i&&s?n.actions[t]=e(s,i):i&&(n.actions[t]=e(i))}),r&&(n.events=Object.assign(Object.assign({},n.events),r)),t.documentEvents&&(n.documentEvents=Object.assign(Object.assign({},n.documentEvents),o)),jo(n,a)}get[Symbol.toStringTag](){return eC.toStringTag}constructor(t,e={}){super(),this.cell=t,this.options=this.ensureOptions(e),this.graph=this.options.graph,this.attr=new Zw(this),this.flag=new Kw(this,this.options.actions,this.options.bootstrap),this.cache=new Yw(this),this.setContainer(this.ensureContainer()),this.setup(),this.init()}init(){}onRemove(){this.removeTools()}get priority(){return this.options.priority}get rootSelector(){return this.options.rootSelector}getConstructor(){return this.constructor}ensureOptions(t){return this.getConstructor().getOptions(t)}getContainerTagName(){return this.options.isSvgElement?"g":"div"}getContainerStyle(){}getContainerAttrs(){return{"data-cell-id":this.cell.id,"data-shape":this.cell.shape}}getContainerClassName(){return this.prefixClassName("cell")}ensureContainer(){return Xw.createElement(this.getContainerTagName(),this.options.isSvgElement)}setContainer(t){if(this.container!==t){this.undelegateEvents(),this.container=t,null!=this.options.events&&this.delegateEvents(this.options.events);const e=this.getContainerAttrs();null!=e&&this.setAttrs(e,t);const n=this.getContainerStyle();null!=n&&this.setStyle(n,t);const i=this.getContainerClassName();null!=i&&this.addClass(i,t)}return this}isNodeView(){return!1}isEdgeView(){return!1}render(){return this}confirmUpdate(t,e={}){return 0}getBootstrapFlag(){return this.flag.getBootstrapFlag()}getFlag(t){return this.flag.getFlag(t)}hasAction(t,e){return this.flag.hasAction(t,e)}removeAction(t,e){return this.flag.removeAction(t,e)}handleAction(t,e,n,i){if(this.hasAction(t,e)){n();const s=[e];return i&&("string"===typeof i?s.push(i):s.push(...i)),this.removeAction(t,s)}return t}setup(){this.cell.on("changed",this.onCellChanged,this)}onCellChanged({options:t}){this.onAttrsChange(t)}onAttrsChange(t){let e=this.flag.getChangedFlag();!t.updated&&e&&(t.dirty&&this.hasAction(e,"update")&&(e|=this.getFlag("render")),t.toolId&&(t.async=!1),null!=this.graph&&this.graph.renderer.requestViewUpdate(this,e,t))}parseJSONMarkup(t,e){const n=qw.parseJSONMarkup(t),i=n.selectors,s=this.rootSelector;if(e&&s){if(i[s])throw new Error("Invalid root selector");i[s]=e}return n}can(t){let e=this.graph.options.interacting;if("function"===typeof e&&(e=Pt(e,this.graph,this)),"object"===typeof e){let n=e[t];return"function"===typeof n&&(n=Pt(n,this.graph,this)),!1!==n}return"boolean"===typeof e&&e}cleanCache(){return this.cache.clean(),this}getCache(t){return this.cache.get(t)}getDataOfElement(t){return this.cache.getData(t)}getMatrixOfElement(t){return this.cache.getMatrix(t)}getShapeOfElement(t){return this.cache.getShape(t)}getBoundingRectOfElement(t){return this.cache.getBoundingRect(t)}getBBoxOfElement(t){const e=this.getBoundingRectOfElement(t),n=this.getMatrixOfElement(t),i=this.getRootRotatedMatrix(),s=this.getRootTranslatedMatrix();return cw.transformRectangle(e,s.multiply(i).multiply(n))}getUnrotatedBBoxOfElement(t){const e=this.getBoundingRectOfElement(t),n=this.getMatrixOfElement(t),i=this.getRootTranslatedMatrix();return cw.transformRectangle(e,i.multiply(n))}getBBox(t={}){let e;if(t.useCellGeometry){const t=this.cell,n=t.isNode()?t.getAngle():0;e=t.getBBox().bbox(n)}else e=this.getBBoxOfElement(this.container);return this.graph.coord.localToGraphRect(e)}getRootTranslatedMatrix(){const t=this.cell,e=t.isNode()?t.getPosition():{x:0,y:0};return Dy().translate(e.x,e.y)}getRootRotatedMatrix(){let t=Dy();const e=this.cell,n=e.isNode()?e.getAngle():0;if(n){const i=e.getBBox(),s=i.width/2,r=i.height/2;t=t.translate(s,r).rotate(n).translate(-s,-r)}return t}findMagnet(t=this.container){return this.findByAttr("magnet",t)}updateAttrs(t,e,n={}){null==n.rootBBox&&(n.rootBBox=new Tb),null==n.selectors&&(n.selectors=this.selectors),this.attr.update(t,e,n)}isEdgeElement(t){return this.cell.isEdge()&&(null==t||t===this.container)}prepareHighlight(t,e={}){const n=t||this.container;return e.partial=n===this.container,n}highlight(t,e={}){const n=this.prepareHighlight(t,e);return this.notify("cell:highlight",{magnet:n,options:e,view:this,cell:this.cell}),this.isEdgeView()?this.notify("edge:highlight",{magnet:n,options:e,view:this,edge:this.cell,cell:this.cell}):this.isNodeView()&&this.notify("node:highlight",{magnet:n,options:e,view:this,node:this.cell,cell:this.cell}),this}unhighlight(t,e={}){const n=this.prepareHighlight(t,e);return this.notify("cell:unhighlight",{magnet:n,options:e,view:this,cell:this.cell}),this.isNodeView()?this.notify("node:unhighlight",{magnet:n,options:e,view:this,node:this.cell,cell:this.cell}):this.isEdgeView()&&this.notify("edge:unhighlight",{magnet:n,options:e,view:this,edge:this.cell,cell:this.cell}),this}notifyUnhighlight(t,e){}getEdgeTerminal(t,e,n,i,s){const r=this.cell,o=this.findAttr("port",t),a=t.getAttribute("data-selector"),l={cell:r.id};return null!=a&&(l.magnet=a),null!=o?(l.port=o,r.isNode()&&(r.hasPort(o)||null!=a||(l.selector=this.getSelector(t)))):null==a&&this.container!==t&&(l.selector=this.getSelector(t)),l}getMagnetFromEdgeTerminal(t){const e=this.cell,n=this.container,i=t.port;let s,r=t.magnet;return null!=i&&e.isNode()&&e.hasPort(i)?s=this.findPortElem(i,r)||n:(r||(r=t.selector),r||null==i||(r=`[port="${i}"]`),s=this.findOne(r,n,this.selectors)),s}hasTools(t){const e=this.tools;return null!=e&&(null==t||e.name===t)}addTools(t){if(this.removeTools(),t){if(!this.can("toolsAddable"))return this;const e=nC.isToolsView(t)?t:new nC(t);this.tools=e,e.config({view:this}),e.mount()}return this}updateTools(t={}){return this.tools&&this.tools.update(t),this}removeTools(){return this.tools&&(this.tools.remove(),this.tools=null),this}hideTools(){return this.tools&&this.tools.hide(),this}showTools(){return this.tools&&this.tools.show(),this}renderTools(){const t=this.cell.getTools();return this.addTools(t),this}notify(t,e){return this.trigger(t,e),this.graph.trigger(t,e),this}getEventArgs(t,e,n){const i=this,s=i.cell;return null==e||null==n?{e:t,view:i,cell:s}:{e:t,x:e,y:n,view:i,cell:s}}onClick(t,e,n){this.notify("cell:click",this.getEventArgs(t,e,n))}onDblClick(t,e,n){this.notify("cell:dblclick",this.getEventArgs(t,e,n))}onContextMenu(t,e,n){this.notify("cell:contextmenu",this.getEventArgs(t,e,n))}onMouseDown(t,e,n){this.cell.model&&(this.cachedModelForMouseEvent=this.cell.model,this.cachedModelForMouseEvent.startBatch("mouse")),this.notify("cell:mousedown",this.getEventArgs(t,e,n))}onMouseUp(t,e,n){this.notify("cell:mouseup",this.getEventArgs(t,e,n)),this.cachedModelForMouseEvent&&(this.cachedModelForMouseEvent.stopBatch("mouse",{cell:this.cell}),this.cachedModelForMouseEvent=null)}onMouseMove(t,e,n){this.notify("cell:mousemove",this.getEventArgs(t,e,n))}onMouseOver(t){this.notify("cell:mouseover",this.getEventArgs(t))}onMouseOut(t){this.notify("cell:mouseout",this.getEventArgs(t))}onMouseEnter(t){this.notify("cell:mouseenter",this.getEventArgs(t))}onMouseLeave(t){this.notify("cell:mouseleave",this.getEventArgs(t))}onMouseWheel(t,e,n,i){this.notify("cell:mousewheel",Object.assign({delta:i},this.getEventArgs(t,e,n)))}onCustomEvent(t,e,n,i){this.notify("cell:customevent",Object.assign({name:e},this.getEventArgs(t,n,i))),this.notify(e,Object.assign({},this.getEventArgs(t,n,i)))}onMagnetMouseDown(t,e,n,i){}onMagnetDblClick(t,e,n,i){}onMagnetContextMenu(t,e,n,i){}onLabelMouseDown(t,e,n){}checkMouseleave(t){const e=this.getEventTarget(t,{fromPoint:!0}),n=this.graph.findViewByElem(e);n!==this&&(this.onMouseLeave(t),n&&n.onMouseEnter(t))}dispose(){this.cell.off("changed",this.onCellChanged,this)}}eC.defaults={isSvgElement:!0,rootSelector:"root",priority:0,bootstrap:[],actions:{}},Qw([eC.dispose()],eC.prototype,"dispose",null),function(t){t.Flag=Kw,t.Attr=Zw}(eC||(eC={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNodeView&&"function"===typeof i.isEdgeView&&"function"===typeof i.confirmUpdate}t.toStringTag=`X6.${t.name}`,t.isCellView=e}(eC||(eC={})),function(t){function e(t){return function(e){e.config({priority:t})}}function n(t){return function(e){e.config({bootstrap:t})}}t.priority=e,t.bootstrap=n}(eC||(eC={})),function(t){t.registry=ev.create({type:"view"})}(eC||(eC={}));class nC extends Xw{get name(){return this.options.name}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get[Symbol.toStringTag](){return nC.toStringTag}constructor(t={}){super(),this.svgContainer=this.createContainer(!0,t),this.htmlContainer=this.createContainer(!1,t),this.config(t)}createContainer(t,e){const n=t?Xw.createElement("g",!0):Xw.createElement("div",!1);return Hf(n,this.prefixClassName("cell-tools")),e.className&&Hf(n,e.className),n}config(t){if(this.options=Object.assign(Object.assign({},this.options),t),!eC.isCellView(t.view)||t.view===this.cellView)return this;this.cellView=t.view,this.cell.isEdge()?(Hf(this.svgContainer,this.prefixClassName("edge-tools")),Hf(this.htmlContainer,this.prefixClassName("edge-tools"))):this.cell.isNode()&&(Hf(this.svgContainer,this.prefixClassName("node-tools")),Hf(this.htmlContainer,this.prefixClassName("node-tools"))),this.svgContainer.setAttribute("data-cell-id",this.cell.id),this.htmlContainer.setAttribute("data-cell-id",this.cell.id),this.name&&(this.svgContainer.setAttribute("data-tools-name",this.name),this.htmlContainer.setAttribute("data-tools-name",this.name));const e=this.options.items;if(!Array.isArray(e))return this;this.tools=[];const n=[];e.forEach(t=>{if(nC.ToolItem.isToolItem(t))"vertices"===t.name?n.unshift(t):n.push(t);else{const e="object"===typeof t?t.name:t;"vertices"===e?n.unshift(t):n.push(t)}});for(let i=0;i<n.length;i+=1){const t=n[i];let e;if(nC.ToolItem.isToolItem(t))e=t;else{const n="object"===typeof t?t.name:t,i="object"===typeof t&&t.args||{};if(n)if(this.cell.isNode()){const t=OC.registry.get(n);if(!t)return OC.registry.onNotFound(n);e=new t(i)}else if(this.cell.isEdge()){const t=AC.registry.get(n);if(!t)return AC.registry.onNotFound(n);e=new t(i)}}if(e){e.config(this.cellView,this),e.render();const t=!1!==e.options.isSVGElement?this.svgContainer:this.htmlContainer;t.appendChild(e.container),this.tools.push(e)}}return this}update(t={}){const e=this.tools;return e&&e.forEach(e=>{t.toolId!==e.cid&&e.isVisible()&&e.update()}),this}focus(t){const e=this.tools;return e&&e.forEach(e=>{t===e?e.show():e.hide()}),this}blur(t){const e=this.tools;return e&&e.forEach(e=>{e===t||e.isVisible()||(e.show(),e.update())}),this}hide(){return this.focus(null)}show(){return this.blur(null)}remove(){const t=this.tools;return t&&(t.forEach(t=>t.remove()),this.tools=null),hm(this.svgContainer),hm(this.htmlContainer),super.remove()}mount(){const t=this.tools,e=this.cellView;if(e&&t){const n=t.some(t=>!1!==t.options.isSVGElement),i=t.some(t=>!1===t.options.isSVGElement);if(n){const t=this.options.local?e.container:e.graph.view.decorator;t.appendChild(this.svgContainer)}i&&this.graph.container.appendChild(this.htmlContainer)}return this}}(function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&null!=i.graph&&null!=i.cell&&"function"===typeof i.config&&"function"===typeof i.update&&"function"===typeof i.focus&&"function"===typeof i.blur&&"function"===typeof i.show&&"function"===typeof i.hide}t.toStringTag=`X6.${t.name}`,t.isToolsView=e})(nC||(nC={})),function(t){class e extends Xw{static getDefaults(){return this.defaults}static config(t){this.defaults=this.getOptions(t)}static getOptions(t){return jo(yh(this.getDefaults()),t)}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get name(){return this.options.name}get[Symbol.toStringTag](){return e.toStringTag}constructor(t={}){super(),this.visible=!0,this.options=this.getOptions(t),this.container=Xw.createElement(this.options.tagName||"g",!1!==this.options.isSVGElement),Hf(this.container,this.prefixClassName("cell-tool")),"string"===typeof this.options.className&&Hf(this.container,this.options.className),this.init()}init(){}getOptions(t){const e=this.constructor;return e.getOptions(t)}delegateEvents(){return this.options.events&&super.delegateEvents(this.options.events),this}config(t,e){return this.cellView=t,this.parent=e,this.stamp(this.container),this.cell.isEdge()?Hf(this.container,this.prefixClassName("edge-tool")):this.cell.isNode()&&Hf(this.container,this.prefixClassName("node-tool")),this.name&&this.container.setAttribute("data-tool-name",this.name),this.delegateEvents(),this}render(){this.empty();const t=this.options.markup;if(t){const e=qw.parseJSONMarkup(t);this.container.appendChild(e.fragment),this.childNodes=e.selectors}return this.onRender(),this}onRender(){}update(){return this}stamp(t){t&&t.setAttribute("data-cell-id",this.cellView.cell.id)}show(){return this.container.style.display="",this.visible=!0,this}hide(){return this.container.style.display="none",this.visible=!1,this}isVisible(){return this.visible}focus(){const t=this.options.focusOpacity;return null!=t&&Number.isFinite(t)&&(this.container.style.opacity=`${t}`),this.parent.focus(this),this}blur(){return this.container.style.opacity="",this.parent.blur(this),this}guard(t){return null==this.graph||null==this.cellView||this.graph.view.guard(t,this.cellView)}}e.defaults={isSVGElement:!0,tagName:"g"},t.ToolItem=e,function(t){let e=0;function n(t){return t?af(t):(e+=1,`CustomTool${e}`)}function i(t){const e=Lh(n(t.name),this);return e.config(t),e}t.define=i}(e=t.ToolItem||(t.ToolItem={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&null!=i.graph&&null!=i.cell&&"function"===typeof i.config&&"function"===typeof i.update&&"function"===typeof i.focus&&"function"===typeof i.blur&&"function"===typeof i.show&&"function"===typeof i.hide&&"function"===typeof i.isVisible}t.toStringTag=`X6.${t.name}`,t.isToolItem=e}(e=t.ToolItem||(t.ToolItem={}))}(nC||(nC={}));const iC=t=>t;function sC(t,e){return 0===e?"0%":`${Math.round(t/e*100)}%`}function rC(t){const e=(e,n,i,s)=>n.isEdgeElement(i)?aC(t,e,n,i,s):oC(t,e,n,i,s);return e}function oC(t,e,n,i,s){const r=n.cell,o=r.getAngle(),a=n.getUnrotatedBBoxOfElement(i),l=r.getBBox().getCenter(),c=Nb.create(s).rotate(o,l);let h=c.x-a.x,u=c.y-a.y;return t&&(h=sC(h,a.width),u=sC(u,a.height)),e.anchor={name:"topLeft",args:{dx:h,dy:u,rotate:!0}},e}function aC(t,e,n,i,s){const r=n.getConnection();if(!r)return e;const o=r.closestPointLength(s);if(t){const t=r.length();e.anchor={name:"ratio",args:{ratio:o/t}}}else e.anchor={name:"length",args:{length:o}};return e}const lC=rC(!0),cC=rC(!1);var hC;function uC(t,e,n,i){const s=Pt(hC.presets.pinRelative,this.graph,{},e,n,t,this.cell,i,{});return s.anchor}function dC(t,e){return e?t.cell.getBBox():t.cell.isEdge()?t.getConnection().bbox():t.getUnrotatedBBoxOfElement(t.container)}(function(t){t.presets=f,t.registry=ev.create({type:"connection strategy"}),t.registry.register(t.presets,!0)})(hC||(hC={}));class gC extends nC.ToolItem{onRender(){Hf(this.container,this.prefixClassName("cell-tool-button")),this.update()}update(){return this.updatePosition(),this}updatePosition(){const t=this.cellView,e=t.cell.isEdge()?this.getEdgeMatrix():this.getNodeMatrix();Hy(this.container,e,{absolute:!0})}getNodeMatrix(){const t=this.cellView,e=this.options;let{x:n=0,y:i=0}=e;const{offset:s,useCellGeometry:r,rotate:o}=e;let a=dC(t,r);const l=t.cell.getAngle();o||(a=a.bbox(l));let c=0,h=0;"number"===typeof s?(c=s,h=s):"object"===typeof s&&(c=s.x,h=s.y),n=xf(n,a.width),i=xf(i,a.height);let u=Dy().translate(a.x+a.width/2,a.y+a.height/2);return o&&(u=u.rotate(l)),u=u.translate(n+c-a.width/2,i+h-a.height/2),u}getEdgeMatrix(){const t=this.cellView,e=this.options,{offset:n=0,distance:i=0,rotate:s}=e;let r,o,a;const l=xf(i,1);r=l>=0&&l<=1?t.getTangentAtRatio(l):t.getTangentAtLength(l),r?(o=r.start,a=r.vector().vectorAngle(new Nb(1,0))||0):(o=t.getConnection().start,a=0);let c=Dy().translate(o.x,o.y).rotate(a);return c="object"===typeof n?c.translate(n.x||0,n.y||0):c.translate(0,n),s||(c=c.rotate(-a)),c}onMouseDown(t){if(this.guard(t))return;t.stopPropagation(),t.preventDefault();const e=this.options.onClick;"function"===typeof e&&Pt(e,this.cellView,{e:t,view:this.cellView,cell:this.cellView.cell,btn:this})}}(function(t){t.config({name:"button",useCellGeometry:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"}})})(gC||(gC={})),function(t){t.Remove=t.define({name:"button-remove",markup:[{tagName:"circle",selector:"button",attrs:{r:7,fill:"#FF1D00",cursor:"pointer"}},{tagName:"path",selector:"icon",attrs:{d:"M -3 -3 3 3 M -3 3 3 -3",fill:"none",stroke:"#FFFFFF","stroke-width":2,"pointer-events":"none"}}],distance:60,offset:0,useCellGeometry:!0,onClick({view:t,btn:e}){e.parent.remove(),t.cell.remove({ui:!0,toolId:e.cid})}})}(gC||(gC={}));var pC=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class fC extends nC.ToolItem{onRender(){if(Hf(this.container,this.prefixClassName("cell-tool-boundary")),this.options.attrs){const t=this.options.attrs,{class:e}=t,n=pC(t,["class"]);Mm(this.container,Am(n)),e&&Hf(this.container,e)}this.update()}update(){const t=this.cellView,e=this.options,{useCellGeometry:n,rotate:i}=e,s=wf(e.padding);let r=dC(t,n).moveAndExpand({x:-s.left,y:-s.top,width:s.left+s.right,height:s.top+s.bottom});const o=t.cell;if(o.isNode()){const t=o.getAngle();if(t)if(i){const e=o.getBBox().getCenter();Jy(this.container,t,e.x,e.y,{absolute:!0})}else r=r.bbox(t)}return Mm(this.container,r.toJSON()),this}}(function(t){t.config({name:"boundary",tagName:"rect",padding:10,useCellGeometry:!0,attrs:{fill:"none",stroke:"#333","stroke-width":.5,"stroke-dasharray":"5, 5","pointer-events":"none"}})})(fC||(fC={}));class mC extends nC.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}onRender(){return this.addClass(this.prefixClassName("edge-tool-vertices")),this.options.addable&&this.updatePath(),this.resetHandles(),this.renderHandles(),this}update(){const t=this.vertices;return t.length===this.handles.length?this.updateHandles():(this.resetHandles(),this.renderHandles()),this.options.addable&&this.updatePath(),this}resetHandles(){const t=this.handles;this.handles=[],t&&t.forEach(t=>{this.stopHandleListening(t),t.remove()})}renderHandles(){const t=this.vertices;for(let e=0,n=t.length;e<n;e+=1){const n=t[e],i=this.options.createHandle,s=this.options.processHandle,r=i({index:e,graph:this.graph,guard:t=>this.guard(t),attrs:this.options.attrs||{}});s&&s(r),r.updatePosition(n.x,n.y),this.stamp(r.container),this.container.appendChild(r.container),this.handles.push(r),this.startHandleListening(r)}}updateHandles(){const t=this.vertices;for(let e=0,n=t.length;e<n;e+=1){const n=t[e],i=this.handles[e];i&&i.updatePosition(n.x,n.y)}}updatePath(){const t=this.childNodes.connection;t&&t.setAttribute("d",this.cellView.getConnectionPathData())}startHandleListening(t){const e=this.cellView;e.can("vertexMovable")&&(t.on("change",this.onHandleChange,this),t.on("changing",this.onHandleChanging,this),t.on("changed",this.onHandleChanged,this)),e.can("vertexDeletable")&&t.on("remove",this.onHandleRemove,this)}stopHandleListening(t){const e=this.cellView;e.can("vertexMovable")&&(t.off("change",this.onHandleChange,this),t.off("changing",this.onHandleChanging,this),t.off("changed",this.onHandleChanged,this)),e.can("vertexDeletable")&&t.off("remove",this.onHandleRemove,this)}getNeighborPoints(t){const e=this.cellView,n=this.vertices,i=t>0?n[t-1]:e.sourceAnchor,s=t<n.length-1?n[t+1]:e.targetAnchor;return{prev:Nb.create(i),next:Nb.create(s)}}getMouseEventArgs(t){const e=this.normalizeEvent(t),{x:n,y:i}=this.graph.snapToGrid(e.clientX,e.clientY);return{e:e,x:n,y:i}}onHandleChange({e:t}){this.focus();const e=this.cellView;if(e.cell.startBatch("move-vertex",{ui:!0,toolId:this.cid}),!this.options.stopPropagation){const{e:n,x:i,y:s}=this.getMouseEventArgs(t);this.eventData(n,{start:{x:i,y:s}}),e.notifyMouseDown(n,i,s)}}onHandleChanging({handle:t,e:e}){const n=this.cellView,i=t.options.index,{e:s,x:r,y:o}=this.getMouseEventArgs(e),a={x:r,y:o};this.snapVertex(a,i),n.cell.setVertexAt(i,a,{ui:!0,toolId:this.cid}),t.updatePosition(a.x,a.y),this.options.stopPropagation||n.notifyMouseMove(s,r,o)}stopBatch(t){this.cell.stopBatch("move-vertex",{ui:!0,toolId:this.cid}),t&&this.cell.stopBatch("add-vertex",{ui:!0,toolId:this.cid})}onHandleChanged({e:t}){const e=this.options,n=this.cellView;if(e.addable&&this.updatePath(),!e.removeRedundancies)return void this.stopBatch(this.eventData(t).vertexAdded);const i=n.removeRedundantLinearVertices({ui:!0,toolId:this.cid});i&&this.render(),this.blur(),this.stopBatch(this.eventData(t).vertexAdded);const{e:s,x:r,y:o}=this.getMouseEventArgs(t);if(!this.options.stopPropagation){n.notifyMouseUp(s,r,o);const{start:t}=this.eventData(s);if(t){const{x:e,y:i}=t;e===r&&i===o&&n.onClick(s,r,o)}}n.checkMouseleave(s),e.onChanged&&e.onChanged({edge:n.cell,edgeView:n})}snapVertex(t,e){const n=this.options.snapRadius||0;if(n>0){const i=this.getNeighborPoints(e),s=i.prev,r=i.next;Math.abs(t.x-s.x)<n?t.x=s.x:Math.abs(t.x-r.x)<n&&(t.x=r.x),Math.abs(t.y-s.y)<n?t.y=i.prev.y:Math.abs(t.y-r.y)<n&&(t.y=r.y)}}onHandleRemove({handle:t,e:e}){if(this.options.removable){const n=t.options.index,i=this.cellView;i.cell.removeVertexAt(n,{ui:!0}),this.options.addable&&this.updatePath(),i.checkMouseleave(this.normalizeEvent(e))}}allowAddVertex(t){const e=this.guard(t),n=this.options.addable&&this.cellView.can("vertexAddable"),i=!this.options.modifiers||yb.isMatch(t,this.options.modifiers);return!e&&n&&i}onPathMouseDown(t){const e=this.cellView;if(!this.allowAddVertex(t))return;t.stopPropagation(),t.preventDefault();const n=this.normalizeEvent(t),i=this.graph.snapToGrid(n.clientX,n.clientY).toJSON();e.cell.startBatch("add-vertex",{ui:!0,toolId:this.cid});const s=e.getVertexIndex(i.x,i.y);this.snapVertex(i,s),e.cell.insertVertex(i,s,{ui:!0,toolId:this.cid}),this.render();const r=this.handles[s];this.eventData(n,{vertexAdded:!0}),r.onMouseDown(n)}onRemove(){this.resetHandles()}}(function(t){class e extends Xw{get graph(){return this.options.graph}constructor(t){super(),this.options=t,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown",dblclick:"onDoubleClick"})}render(){this.container=Xw.createElement("circle",!0);const e=this.options.attrs;if("function"===typeof e){const n=t.getDefaults();this.setAttrs(Object.assign(Object.assign({},n.attrs),e(this)))}else this.setAttrs(e);this.addClass(this.prefixClassName("edge-tool-vertex"))}updatePosition(t,e){this.setAttrs({cx:t,cy:e})}onMouseDown(t){this.options.guard(t)||(t.stopPropagation(),t.preventDefault(),this.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},t.data),this.emit("change",{e:t,handle:this}))}onMouseMove(t){this.emit("changing",{e:t,handle:this})}onMouseUp(t){this.emit("changed",{e:t,handle:this}),this.undelegateDocumentEvents(),this.graph.view.delegateEvents()}onDoubleClick(t){this.emit("remove",{e:t,handle:this})}}t.Handle=e})(mC||(mC={})),function(t){const e=sw.prefix("edge-tool-vertex-path");t.config({name:"vertices",snapRadius:20,addable:!0,removable:!0,removeRedundancies:!0,stopPropagation:!0,attrs:{r:6,fill:"#333",stroke:"#fff",cursor:"move","stroke-width":2},createHandle:e=>new t.Handle(e),markup:[{tagName:"path",selector:"connection",className:e,attrs:{fill:"none",stroke:"transparent","stroke-width":10,cursor:"pointer"}}],events:{[`mousedown .${e}`]:"onPathMouseDown",[`touchstart .${e}`]:"onPathMouseDown"}})}(mC||(mC={}));class yC extends nC.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}update(){return this.render(),this}onRender(){Hf(this.container,this.prefixClassName("edge-tool-segments")),this.resetHandles();const t=this.cellView,e=[...this.vertices];e.unshift(t.sourcePoint),e.push(t.targetPoint);for(let n=0,i=e.length;n<i-1;n+=1){const t=e[n],i=e[n+1],s=this.renderHandle(t,i,n);this.stamp(s.container),this.handles.push(s)}return this}renderHandle(t,e,n){const i=this.options.createHandle({index:n,graph:this.graph,guard:t=>this.guard(t),attrs:this.options.attrs||{}});return this.options.processHandle&&this.options.processHandle(i),this.updateHandle(i,t,e),this.container.appendChild(i.container),this.startHandleListening(i),i}startHandleListening(t){t.on("change",this.onHandleChange,this),t.on("changing",this.onHandleChanging,this),t.on("changed",this.onHandleChanged,this)}stopHandleListening(t){t.off("change",this.onHandleChange,this),t.off("changing",this.onHandleChanging,this),t.off("changed",this.onHandleChanged,this)}resetHandles(){const t=this.handles;this.handles=[],t&&t.forEach(t=>{this.stopHandleListening(t),t.remove()})}shiftHandleIndexes(t){const e=this.handles;for(let n=0,i=e.length;n<i;n+=1)e[n].options.index+=t}resetAnchor(t,e){const n=this.cellView.cell,i={ui:!0,toolId:this.cid};e?n.prop([t,"anchor"],e,i):n.removeProp([t,"anchor"],i)}snapHandle(t,e,n){const i=t.options.axis,s=t.options.index,r=this.cellView,o=r.cell,a=o.getVertices(),l=a[s-2]||n.sourceAnchor,c=a[s+1]||n.targetAnchor,h=this.options.snapRadius;return Math.abs(e[i]-l[i])<h?e[i]=l[i]:Math.abs(e[i]-c[i])<h&&(e[i]=c[i]),e}onHandleChanging({handle:t,e:e}){const n=this.graph,i=this.options,s=this.cellView,r=i.anchor,o=t.options.axis,a=t.options.index-1,l=this.getEventData(e),c=this.normalizeEvent(e),h=n.snapToGrid(c.clientX,c.clientY),u=this.snapHandle(t,h.clone(),l),d=yh(this.vertices);let g=d[a],p=d[a+1];const f=s.sourceView,m=s.sourceBBox;let y=!1,b=!1;if(g?0===a?m.containsPoint(g)?(d.shift(),this.shiftHandleIndexes(-1),y=!0):(g[o]=u[o],b=!0):g[o]=u[o]:(g=s.sourceAnchor.toJSON(),g[o]=u[o],m.containsPoint(g)?y=!0:(d.unshift(g),this.shiftHandleIndexes(1),b=!0)),"function"===typeof r&&f){if(y){const t=l.sourceAnchor.clone();t[o]=u[o];const e=Pt(r,s,t,f,s.sourceMagnet||f.container,"source",s,this);this.resetAnchor("source",e)}b&&this.resetAnchor("source",l.sourceAnchorDef)}const v=s.targetView,x=s.targetBBox;let w=!1,C=!1;if(p?a===d.length-2?x.containsPoint(p)?(d.pop(),w=!0):(p[o]=u[o],C=!0):p[o]=u[o]:(p=s.targetAnchor.toJSON(),p[o]=u[o],x.containsPoint(p)?w=!0:(d.push(p),C=!0)),"function"===typeof r&&v){if(w){const t=l.targetAnchor.clone();t[o]=u[o];const e=Pt(r,s,t,v,s.targetMagnet||v.container,"target",s,this);this.resetAnchor("target",e)}C&&this.resetAnchor("target",l.targetAnchorDef)}Nb.equalPoints(d,this.vertices)||this.cellView.cell.setVertices(d,{ui:!0,toolId:this.cid}),this.updateHandle(t,g,p,0),i.stopPropagation||s.notifyMouseMove(c,h.x,h.y)}onHandleChange({handle:t,e:e}){const n=this.options,i=this.handles,s=this.cellView,r=t.options.index;if(Array.isArray(i)){for(let t=0,e=i.length;t<e;t+=1)t!==r&&i[t].hide();if(this.focus(),this.setEventData(e,{sourceAnchor:s.sourceAnchor.clone(),targetAnchor:s.targetAnchor.clone(),sourceAnchorDef:yh(this.cell.prop(["source","anchor"])),targetAnchorDef:yh(this.cell.prop(["target","anchor"]))}),this.cell.startBatch("move-segment",{ui:!0,toolId:this.cid}),!n.stopPropagation){const t=this.normalizeEvent(e),n=this.graph.snapToGrid(t.clientX,t.clientY);s.notifyMouseDown(t,n.x,n.y)}}}onHandleChanged({e:t}){const e=this.options,n=this.cellView;e.removeRedundancies&&n.removeRedundantLinearVertices({ui:!0,toolId:this.cid});const i=this.normalizeEvent(t),s=this.graph.snapToGrid(i.clientX,i.clientY);this.render(),this.blur(),this.cell.stopBatch("move-segment",{ui:!0,toolId:this.cid}),e.stopPropagation||n.notifyMouseUp(i,s.x,s.y),n.checkMouseleave(i),e.onChanged&&e.onChanged({edge:n.cell,edgeView:n})}updateHandle(t,e,n,i=0){const s=this.options.precision||0,r=Math.abs(e.x-n.x)<s,o=Math.abs(e.y-n.y)<s;if(r||o){const s=new kb(e,n),o=s.length();if(o<this.options.threshold)t.hide();else{const e=s.getCenter(),n=r?"x":"y";e[n]+=i||0;const o=s.vector().vectorAngle(new Nb(1,0));t.updatePosition(e.x,e.y,o,this.cellView),t.show(),t.options.axis=n}}else t.hide()}onRemove(){this.resetHandles()}}(function(t){class e extends Xw{constructor(t){super(),this.options=t,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown"})}render(){this.container=Xw.createElement("rect",!0);const e=this.options.attrs;if("function"===typeof e){const n=t.getDefaults();this.setAttrs(Object.assign(Object.assign({},n.attrs),e(this)))}else this.setAttrs(e);this.addClass(this.prefixClassName("edge-tool-segment"))}updatePosition(t,e,n,i){const s=i.getClosestPoint(new Nb(t,e))||new Nb(t,e);let r=Dy().translate(s.x,s.y);if(s.equals({x:t,y:e}))r=r.rotate(n);else{const n=new kb(t,e,s.x,s.y);let i=n.vector().vectorAngle(new Nb(1,0));0!==i&&(i+=90),r=r.rotate(i)}this.setAttrs({transform:Ry(r),cursor:n%180===0?"row-resize":"col-resize"})}onMouseDown(t){this.options.guard(t)||(this.trigger("change",{e:t,handle:this}),t.stopPropagation(),t.preventDefault(),this.options.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},t.data))}onMouseMove(t){this.emit("changing",{e:t,handle:this})}onMouseUp(t){this.emit("changed",{e:t,handle:this}),this.undelegateDocumentEvents(),this.options.graph.view.delegateEvents()}show(){this.container.style.display=""}hide(){this.container.style.display="none"}}t.Handle=e})(yC||(yC={})),function(t){t.config({name:"segments",precision:.5,threshold:40,snapRadius:10,stopPropagation:!0,removeRedundancies:!0,attrs:{width:20,height:8,x:-10,y:-4,rx:4,ry:4,fill:"#333",stroke:"#fff","stroke-width":2},createHandle:e=>new t.Handle(e),anchor:uC})}(yC||(yC={}));class bC extends nC.ToolItem{get type(){return this.options.type}onRender(){Hf(this.container,this.prefixClassName(`edge-tool-${this.type}-anchor`)),this.toggleArea(!1),this.update()}update(){const t=this.type,e=this.cellView,n=e.getTerminalView(t);return n?(this.updateAnchor(),this.updateArea(),this.container.style.display=""):this.container.style.display="none",this}updateAnchor(){const t=this.childNodes;if(!t)return;const e=t.anchor;if(!e)return;const n=this.type,i=this.cellView,s=this.options,r=i.getTerminalAnchor(n),o=i.cell.prop([n,"anchor"]);e.setAttribute("transform",`translate(${r.x}, ${r.y})`);const a=o?s.customAnchorAttrs:s.defaultAnchorAttrs;a&&Object.keys(a).forEach(t=>{e.setAttribute(t,a[t])})}updateArea(){const t=this.childNodes;if(!t)return;const e=t.area;if(!e)return;const n=this.type,i=this.cellView,s=i.getTerminalView(n);if(s){const t=s.cell,r=i.getTerminalMagnet(n);let o,a,l,c=this.options.areaPadding||0;Number.isFinite(c)||(c=0),s.isEdgeElement(r)?(o=s.getBBox(),a=0,l=o.getCenter()):(o=s.getUnrotatedBBoxOfElement(r),a=t.getAngle(),l=o.getCenter(),a&&l.rotate(-a,t.getBBox().getCenter())),o.inflate(c),Mm(e,{x:-o.width/2,y:-o.height/2,width:o.width,height:o.height,transform:`translate(${l.x}, ${l.y}) rotate(${a})`})}}toggleArea(t){if(this.childNodes){const e=this.childNodes.area;e&&(e.style.display=t?"":"none")}}onMouseDown(t){this.guard(t)||(t.stopPropagation(),t.preventDefault(),this.graph.view.undelegateEvents(),this.options.documentEvents&&this.delegateDocumentEvents(this.options.documentEvents),this.focus(),this.toggleArea(this.options.restrictArea),this.cell.startBatch("move-anchor",{ui:!0,toolId:this.cid}))}resetAnchor(t){const e=this.type,n=this.cell;t?n.prop([e,"anchor"],t,{rewrite:!0,ui:!0,toolId:this.cid}):n.removeProp([e,"anchor"],{ui:!0,toolId:this.cid})}onMouseMove(t){const e=this.type,n=this.cellView,i=n.getTerminalView(e);if(null==i)return;const s=this.normalizeEvent(t),r=i.cell,o=n.getTerminalMagnet(e);let a=this.graph.coord.clientToLocalPoint(s.clientX,s.clientY);const l=this.options.snap;if("function"===typeof l){const t=Pt(l,n,a,i,o,e,n,this);a=Nb.create(t)}if(this.options.restrictArea)if(i.isEdgeElement(o)){const t=i.getClosestPoint(a);t&&(a=t)}else{const t=i.getUnrotatedBBoxOfElement(o),e=r.getAngle(),n=r.getBBox().getCenter(),s=a.clone().rotate(e,n);t.containsPoint(s)||(a=t.getNearestPointToPoint(s).rotate(-e,n))}let c;const h=this.options.anchor;"function"===typeof h&&(c=Pt(h,n,a,i,o,e,n,this)),this.resetAnchor(c),this.update()}onMouseUp(t){this.graph.view.delegateEvents(),this.undelegateDocumentEvents(),this.blur(),this.toggleArea(!1);const e=this.cellView;this.options.removeRedundancies&&e.removeRedundantLinearVertices({ui:!0,toolId:this.cid}),this.cell.stopBatch("move-anchor",{ui:!0,toolId:this.cid})}onDblClick(){const t=this.options.resetAnchor;t&&this.resetAnchor(!0===t?void 0:t),this.update()}}(function(t){t.config({tagName:"g",markup:[{tagName:"circle",selector:"anchor",attrs:{cursor:"pointer"}},{tagName:"rect",selector:"area",attrs:{"pointer-events":"none",fill:"none",stroke:"#33334F","stroke-dasharray":"2,4",rx:5,ry:5}}],events:{mousedown:"onMouseDown",touchstart:"onMouseDown",dblclick:"onDblClick"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},customAnchorAttrs:{"stroke-width":4,stroke:"#33334F",fill:"#FFFFFF",r:5},defaultAnchorAttrs:{"stroke-width":2,stroke:"#FFFFFF",fill:"#33334F",r:6},areaPadding:6,snapRadius:10,resetAnchor:!0,restrictArea:!0,removeRedundancies:!0,anchor:uC,snap(t,e,n,i,s,r){const o=r.options.snapRadius||0,a="source"===i,l=a?0:-1,c=this.cell.getVertexAt(l)||this.getTerminalAnchor(a?"target":"source");return c&&(Math.abs(c.x-t.x)<o&&(t.x=c.x),Math.abs(c.y-t.y)<o&&(t.y=c.y)),t}})})(bC||(bC={}));const vC=bC.define({name:"source-anchor",type:"source"}),xC=bC.define({name:"target-anchor",type:"target"});var wC=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class CC extends nC.ToolItem{get type(){return this.options.type}get ratio(){return this.options.ratio}init(){if(this.options.attrs){const t=this.options.attrs,{class:e}=t,n=wC(t,["class"]);this.setAttrs(n,this.container),e&&Hf(this.container,e)}}onRender(){Hf(this.container,this.prefixClassName(`edge-tool-${this.type}-arrowhead`)),this.update()}update(){const t=this.ratio,e=this.cellView,n=e.getTangentAtRatio(t),i=n?n.start:e.getPointAtRatio(t),s=n&&n.vector().vectorAngle(new Nb(1,0))||0;if(!i)return this;const r=Dy().translate(i.x,i.y).rotate(s);return Hy(this.container,r,{absolute:!0}),this}onMouseDown(t){if(this.guard(t))return;t.stopPropagation(),t.preventDefault();const e=this.cellView;if(e.can("arrowheadMovable")){e.cell.startBatch("move-arrowhead",{ui:!0,toolId:this.cid});const n=this.graph.snapToGrid(t.clientX,t.clientY),i=e.prepareArrowheadDragging(this.type,{x:n.x,y:n.y,options:Object.assign(Object.assign({},this.options),{toolId:this.cid})});this.cellView.setEventData(t,i),this.delegateDocumentEvents(this.options.documentEvents,t.data),e.graph.view.undelegateEvents(),this.container.style.pointerEvents="none"}this.focus()}onMouseMove(t){const e=this.normalizeEvent(t),n=this.graph.snapToGrid(e.clientX,e.clientY);this.cellView.onMouseMove(e,n.x,n.y),this.update()}onMouseUp(t){this.undelegateDocumentEvents();const e=this.normalizeEvent(t),n=this.cellView,i=this.graph.snapToGrid(e.clientX,e.clientY);n.onMouseUp(e,i.x,i.y),this.graph.view.delegateEvents(),this.blur(),this.container.style.pointerEvents="",n.cell.stopBatch("move-arrowhead",{ui:!0,toolId:this.cid})}}(function(t){t.config({tagName:"path",isSVGElement:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}})})(CC||(CC={}));const PC=CC.define({name:"source-arrowhead",type:"source",ratio:0,attrs:{d:"M 10 -8 -10 0 10 8 Z",fill:"#333",stroke:"#fff","stroke-width":2,cursor:"move"}}),EC=CC.define({name:"target-arrowhead",type:"target",ratio:1,attrs:{d:"M -10 -8 10 0 -10 8 Z",fill:"#333",stroke:"#fff","stroke-width":2,cursor:"move"}});class MC extends nC.ToolItem{constructor(){super(...arguments),this.labelIndex=-1,this.distance=.5,this.dblClick=this.onCellDblClick.bind(this)}onRender(){const t=this.cellView;t&&t.on("cell:dblclick",this.dblClick)}createElement(){const t=[this.prefixClassName((this.cell.isEdge()?"edge":"node")+"-tool-editor"),this.prefixClassName("cell-tool-editor")];this.editor=nC.createElement("div",!1),this.addClass(t,this.editor),this.editor.contentEditable="true",this.container.appendChild(this.editor)}removeElement(){this.undelegateDocumentEvents(),this.editor&&(this.container.removeChild(this.editor),this.editor=null)}updateEditor(){const{cell:t,editor:e}=this;if(!e)return;const{style:n}=e;t.isNode()?this.updateNodeEditorTransform():t.isEdge()&&this.updateEdgeEditorTransform();const{attrs:i}=this.options;n.fontSize=`${i.fontSize}px`,n.fontFamily=i.fontFamily,n.color=i.color,n.backgroundColor=i.backgroundColor;const s=this.getCellText()||"";return e.innerText=s,this.setCellText(""),this}updateNodeEditorTransform(){const{graph:t,cell:e,editor:n}=this;if(!n)return;let i=Nb.create(),s=20,r="",{x:o,y:a}=this.options;const{width:l,height:c}=this.options;if("undefined"!==typeof o&&"undefined"!==typeof a){const t=e.getBBox();o=xf(o,t.width),a=xf(a,t.height),i=t.topLeft.translate(o,a),s=t.width-2*o}else{const t=e.getBBox();i=t.center,s=t.width-4,r="translate(-50%, -50%)"}const h=t.scale(),{style:u}=n;i=t.localToGraph(i),u.left=`${i.x}px`,u.top=`${i.y}px`,u.transform=`scale(${h.sx}, ${h.sy}) ${r}`,u.minWidth=`${s}px`,"number"===typeof l&&(u.width=`${l}px`),"number"===typeof c&&(u.height=`${c}px`)}updateEdgeEditorTransform(){if(!this.event)return;const{graph:t,editor:e}=this;if(!e)return;let n=Nb.create(),i=20;const{style:s}=e,r=this.event.target,o=r.parentElement,a=o&&_f(o,this.prefixClassName("edge-label"));if(a){const t=o.getAttribute("data-index")||"0";this.labelIndex=parseInt(t,10);const e=o.getAttribute("transform"),{translation:s}=Vy(e);n=new Nb(s.tx,s.ty),i=cw.getBBox(r).width}else{if(!this.options.labelAddable)return this;n=t.clientToLocal(Nb.create(this.event.clientX,this.event.clientY));const e=this.cellView,i=e.path.closestPointLength(n);this.distance=i,this.labelIndex=-1}n=t.localToGraph(n);const l=t.scale();s.left=`${n.x}px`,s.top=`${n.y}px`,s.minWidth=`${i}px`,s.transform=`scale(${l.sx}, ${l.sy}) translate(-50%, -50%)`}onDocumentMouseUp(t){if(this.editor&&t.target!==this.editor){const t=this.editor.innerText.replace(/\n$/,"")||"";this.setCellText(""!==t?t:null),this.removeElement()}}onCellDblClick({e:t}){this.editor||(t.stopPropagation(),this.removeElement(),this.event=t,this.createElement(),this.updateEditor(),this.autoFocus(),this.delegateDocumentEvents(this.options.documentEvents))}onMouseDown(t){t.stopPropagation()}autoFocus(){setTimeout(()=>{this.editor&&(this.editor.focus(),this.selectText())})}selectText(){if(window.getSelection&&this.editor){const t=document.createRange(),e=window.getSelection();t.selectNodeContents(this.editor),e.removeAllRanges(),e.addRange(t)}}getCellText(){const{getText:t}=this.options;if("function"===typeof t)return Pt(t,this.cellView,{cell:this.cell,index:this.labelIndex});if("string"===typeof t){if(this.cell.isNode())return this.cell.attr(t);if(this.cell.isEdge()&&-1!==this.labelIndex)return this.cell.prop(`labels/${this.labelIndex}/attrs/${t}`)}}setCellText(t){const e=this.options.setText;if("function"!==typeof e){if("string"===typeof e){if(this.cell.isNode())return void(null!==t&&this.cell.attr(e,t));if(this.cell.isEdge()){const n=this.cell;if(-1===this.labelIndex){if(t){const i={position:{distance:this.distance},attrs:{}};$h(i,`attrs/${e}`,t),n.appendLabel(i)}}else null!==t?n.prop(`labels/${this.labelIndex}/attrs/${e}`,t):"number"===typeof this.labelIndex&&n.removeLabelAt(this.labelIndex)}}}else Pt(e,this.cellView,{cell:this.cell,value:t,index:this.labelIndex,distance:this.distance})}onRemove(){const t=this.cellView;t&&t.off("cell:dblclick",this.dblClick),this.removeElement()}}(function(t){t.config({tagName:"div",isSVGElement:!1,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mouseup:"onDocumentMouseUp",touchend:"onDocumentMouseUp",touchcancel:"onDocumentMouseUp"}})})(MC||(MC={})),function(t){t.NodeEditor=t.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},getText:"text/text",setText:"text/text"}),t.EdgeEditor=t.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},labelAddable:!0,getText:"label/text",setText:"label/text"})}(MC||(MC={}));var OC,AC,SC=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};(function(t){t.presets={boundary:fC,button:gC,"button-remove":gC.Remove,"node-editor":MC.NodeEditor},t.registry=ev.create({type:"node tool",process(t,e){if("function"===typeof e)return e;let n=nC.ToolItem;const{inherit:i}=e,s=SC(e,["inherit"]);if(i){const t=this.get(i);null==t?this.onNotFound(i,"inherited"):n=t}return null==s.name&&(s.name=t),n.define.call(n,s)}}),t.registry.register(t.presets,!0)})(OC||(OC={})),function(t){t.presets={boundary:fC,vertices:mC,segments:yC,button:gC,"button-remove":gC.Remove,"source-anchor":vC,"target-anchor":xC,"source-arrowhead":PC,"target-arrowhead":EC,"edge-editor":MC.EdgeEditor},t.registry=ev.create({type:"edge tool",process(t,e){if("function"===typeof e)return e;let n=nC.ToolItem;const{inherit:i}=e,s=SC(e,["inherit"]);if(i){const t=this.get(i);null==t?this.onNotFound(i,"inherited"):n=t}return null==s.name&&(s.name=t),n.define.call(n,s)}}),t.registry.register(t.presets,!0)}(AC||(AC={}));const NC=VC("center"),TC=VC("topCenter"),kC=VC("bottomCenter"),jC=VC("leftMiddle"),LC=VC("rightMiddle"),DC=VC("topLeft"),BC=VC("topRight"),IC=VC("bottomLeft"),RC=VC("bottomRight");function VC(t){return function(e,n,i,s={}){let r;r=e.cell.visible?s.rotate?e.getUnrotatedBBoxOfElement(n):e.getBBoxOfElement(n):e.cell.getBBox();const o=r[t];o.x+=xf(s.dx,r.width),o.y+=xf(s.dy,r.height);const a=e.cell;return s.rotate?o.rotate(-a.getAngle(),a.getBBox().getCenter()):o}}function zC(t){return function(e,n,i,s){if(i instanceof Element){const r=this.graph.findViewByElem(i);let o;if(r)if(r.isEdgeElement(i)){const t=null!=s.fixedAt?s.fixedAt:"50%";o=$C(r,t)}else o=r.getBBoxOfElement(i).getCenter();else o=new Nb;return t.call(this,e,n,o,s)}return t.apply(this,arguments)}}function $C(t,e){const n=vf(e),i="string"===typeof e?parseFloat(e):e;return n?t.getPointAtRatio(i/100):t.getPointAtLength(i)}const FC=function(t,e,n,i){const s=Ob.normalize(t.cell.getAngle()),r=t.cell.visible?t.getBBoxOfElement(e):t.cell.getBBox(),o=r.getCenter(),a=r.getTopLeft(),l=r.getBottomRight();let c=i.padding;if(Number.isFinite(c)||(c=0),a.y+c<=n.y&&n.y<=l.y-c){const t=n.y-o.y;o.x+=0===s||180===s?0:1*t/Math.tan(Ob.toRad(s)),o.y+=t}else if(a.x+c<=n.x&&n.x<=l.x-c){const t=n.x-o.x;o.y+=90===s||270===s?0:t*Math.tan(Ob.toRad(s)),o.x+=t}return o},GC=zC(FC),_C=function(t,e,n,i,s){const r=t.cell.getConnectionPoint(this.cell,s);return(i.dx||i.dy)&&r.translate(i.dx||0,i.dy||0),r},HC=function(t,e,n,i){let s,r,o=0;const a=t.cell;i.rotate?(s=t.getUnrotatedBBoxOfElement(e),r=a.getBBox().getCenter(),o=a.getAngle()):s=a.visible?t.getBBoxOfElement(e):t.cell.getBBox();const l=i.padding;null!=l&&Number.isFinite(l)&&s.inflate(l),i.rotate&&n.rotate(o,r);const c=s.getNearestSideToPoint(n);let h;switch(c){case"left":h=s.getLeftMiddle();break;case"right":h=s.getRightMiddle();break;case"top":h=s.getTopCenter();break;case"bottom":h=s.getBottomCenter();break;default:break}const u=i.direction;return"H"===u?"top"!==c&&"bottom"!==c||(h=n.x<=s.x+s.width?s.getLeftMiddle():s.getRightMiddle()):"V"===u&&(h=n.y<=s.y+s.height?s.getTopCenter():s.getBottomCenter()),i.rotate?h.rotate(-o,r):h},UC=zC(HC);var JC;(function(t){t.presets=m,t.registry=ev.create({type:"node endpoint"}),t.registry.register(t.presets,!0)})(JC||(JC={}));const qC=function(t,e,n,i){let s=null!=i.ratio?i.ratio:.5;return s>1&&(s/=100),t.getPointAtRatio(s)},WC=function(t,e,n,i){const s=null!=i.length?i.length:20;return t.getPointAtLength(s)},XC=function(t,e,n,i){const s=t.getClosestPoint(n);return null!=s?s:new Nb},YC=zC(XC),ZC=function(t,e,n,i){const s=1e6,r=t.getConnection(),o=t.getConnectionSubdivisions(),a=new kb(n.clone().translate(0,s),n.clone().translate(0,-s)),l=new kb(n.clone().translate(s,0),n.clone().translate(-s,0)),c=a.intersect(r,{segmentSubdivisions:o}),h=l.intersect(r,{segmentSubdivisions:o}),u=[];return c&&u.push(...c),h&&u.push(...h),u.length>0?n.closest(u):null!=i.fallbackAt?$C(t,i.fallbackAt):Pt(XC,this,t,e,n,i)},KC=zC(ZC);var QC;function tP(t,e,n){let i;if("object"===typeof n){if(Number.isFinite(n.y)){const i=new kb(e,t),{start:s,end:r}=i.parallel(n.y);e=s,t=r}i=n.x}else i=n;if(null==i||!Number.isFinite(i))return t;const s=t.distance(e);return 0===i&&s>0?t:t.move(e,-Math.min(i,s-1))}function eP(t){const e=t.getAttribute("stroke-width");return null===e?0:parseFloat(e)||0}function nP(t){if(null==t)return null;let e=t;do{let t=e.tagName;if("string"!==typeof t)return null;if(t=t.toUpperCase(),"G"===t)e=e.firstElementChild;else{if("TITLE"!==t)break;e=e.nextElementSibling}}while(e);return e}(function(t){t.presets=y,t.registry=ev.create({type:"edge endpoint"}),t.registry.register(t.presets,!0)})(QC||(QC={}));const iP=function(t,e,n,i){const s=e.getBBoxOfElement(n);i.stroked&&s.inflate(eP(n)/2);const r=t.intersect(s),o=r&&r.length?t.start.closest(r):t.end;return tP(o,t.start,i.offset)},sP=function(t,e,n,i,s){const r=e.cell,o=r.isNode()?r.getAngle():0;if(0===o)return Pt(iP,this,t,e,n,i,s);const a=e.getUnrotatedBBoxOfElement(n);i.stroked&&a.inflate(eP(n)/2);const l=a.getCenter(),c=t.clone().rotate(o,l),h=c.setLength(1e6).intersect(a),u=h&&h.length?c.start.closest(h).rotate(-o,l):t.end;return tP(u,t.start,i.offset)},rP=function(t,e,n,i){let s,r;const o=t.end,a=i.selector;if(s="string"===typeof a?e.findOne(a):Array.isArray(a)?zh(n,a):nP(n),!Yf(s)){if(s===n||!Yf(n))return o;s=n}const l=e.getShapeOfElement(s),c=e.getMatrixOfElement(s),h=e.getRootTranslatedMatrix(),u=e.getRootRotatedMatrix(),d=h.multiply(u).multiply(c),g=d.inverse(),p=cw.transformLine(t,g),f=p.start.clone(),m=e.getDataOfElement(s);if(!1===i.insideout){null==m.shapeBBox&&(m.shapeBBox=l.bbox());const t=m.shapeBBox;if(null!=t&&t.containsPoint(f))return o}let y;if(!0===i.extrapolate&&p.setLength(1e6),tv.isPath(l)){const t=i.precision||2;null==m.segmentSubdivisions&&(m.segmentSubdivisions=l.getSegmentSubdivisions({precision:t})),y={precision:t,segmentSubdivisions:m.segmentSubdivisions},r=p.intersect(l,y)}else r=p.intersect(l);r?Array.isArray(r)&&(r=f.closest(r)):!0===i.sticky&&(r=Tb.isRectangle(l)?l.getNearestPointToPoint(f):jb.isEllipse(l)?l.intersectsWithLineFromCenterToPoint(f):l.closestPoint(f,y));const b=r?cw.transformPoint(r,d):o;let v=i.offset||0;return!1!==i.stroked&&("object"===typeof v?(v=Object.assign({},v),null==v.x&&(v.x=0),v.x+=eP(s)/2):v+=eP(s)/2),tP(b,t.start,v)};function oP(t,e,n=0){const{start:i,end:s}=t;let r,o,a,l;switch(e){case"left":l="x",r=s,o=i,a=-1;break;case"right":l="x",r=i,o=s,a=1;break;case"top":l="y",r=s,o=i,a=-1;break;case"bottom":l="y",r=i,o=s,a=1;break;default:return}i[l]<s[l]?r[l]=o[l]:o[l]=r[l],Number.isFinite(n)&&(r[l]+=a*n,o[l]+=a*n)}const aP=function(t,e,n,i){const{alignOffset:s,align:r}=i;return r&&oP(t,r,s),tP(t.end,t.start,i.offset)};var lP;(function(t){t.presets=b,t.registry=ev.create({type:"connection point"}),t.registry.register(t.presets,!0)})(lP||(lP={}));const cP=function(t){return[...t]},hP=function(t,e,n){const i=e.side||"bottom",s=wf(e.padding||40),r=n.sourceBBox,o=n.targetBBox,a=r.getCenter(),l=o.getCenter();let c,h,u;switch(i){case"top":u=-1,c="y",h="height";break;case"left":u=-1,c="x",h="width";break;case"right":u=1,c="x",h="width";break;case"bottom":default:u=1,c="y",h="height";break}return a[c]+=u*(r[h]/2+s[i]),l[c]+=u*(o[h]/2+s[i]),u*(a[c]-l[c])>0?l[c]=a[c]:a[c]=l[c],[a.toJSON(),...t,l.toJSON()]};function uP(t){return new Tb(t.x,t.y,0,0)}function dP(t={}){const e=wf(t.padding||20);return{x:-e.left,y:-e.top,width:e.left+e.right,height:e.top+e.bottom}}function gP(t,e={}){return t.sourceBBox.clone().moveAndExpand(dP(e))}function pP(t,e={}){return t.targetBBox.clone().moveAndExpand(dP(e))}function fP(t,e={}){if(t.sourceAnchor)return t.sourceAnchor;const n=gP(t,e);return n.getCenter()}function mP(t,e={}){if(t.targetAnchor)return t.targetAnchor;const n=pP(t,e);return n.getCenter()}const yP=function(t,e,n){let i=gP(n,e),s=pP(n,e);const r=fP(n,e),o=mP(n,e);i=i.union(uP(r)),s=s.union(uP(o));const a=t.map(t=>Nb.create(t));a.unshift(r),a.push(o);let l=null;const c=[];for(let h=0,u=a.length-1;h<u;h+=1){let t=null;const n=a[h],r=a[h+1],o=null!=bP.getBearing(n,r);if(0===h)h+1===u?i.intersectsWithRect(s.clone().inflate(1))?t=bP.insideNode(n,r,i,s):o||(t=bP.nodeToNode(n,r,i,s)):i.containsPoint(r)?t=bP.insideNode(n,r,i,uP(r).moveAndExpand(dP(e))):o||(t=bP.nodeToVertex(n,r,i));else if(h+1===u){const i=o&&bP.getBearing(r,n)===l;s.containsPoint(n)||i?t=bP.insideNode(n,r,uP(n).moveAndExpand(dP(e)),s,l):o||(t=bP.vertexToNode(n,r,s,l))}else o||(t=bP.vertexToVertex(n,r,l));t?(c.push(...t.points),l=t.direction):l=bP.getBearing(n,r),h+1<u&&c.push(r)}return c};var bP;(function(t){const e={N:"S",S:"N",E:"W",W:"E"},n={N:-Math.PI/2*3,S:-Math.PI/2,E:0,W:Math.PI};function i(t,e,n){let i=new Nb(t.x,e.y);return n.containsPoint(i)&&(i=new Nb(e.x,t.y)),i}function s(t,e){return t["W"===e||"E"===e?"width":"height"]}function r(t,e){return t.x===e.x?t.y>e.y?"N":"S":t.y===e.y?t.x>e.x?"W":"E":null}function o(t,n,i){const s=new Nb(t.x,n.y),o=new Nb(n.x,t.y),a=r(t,s),l=r(t,o),c=i?e[i]:null,h=a===i||a!==c&&(l===c||l!==i)?s:o;return{points:[h],direction:r(h,n)}}function a(t,e,n){const s=i(t,e,n);return{points:[s],direction:r(s,e)}}function l(t,e,n,o){const a=[new Nb(t.x,e.y),new Nb(e.x,t.y)],l=a.filter(t=>!n.containsPoint(t)),c=l.filter(e=>r(e,t)!==o);let h;if(c.length>0)return h=c.filter(e=>r(t,e)===o).pop(),h=h||c[0],{points:[h],direction:r(h,e)};{h=Ld(a,l)[0];const c=Nb.create(e).move(h,-s(n,o)/2),u=i(c,t,n);return{points:[u,c],direction:r(c,e)}}}function c(t,e,n,i){let l=a(e,t,i);const c=l.points[0];if(n.containsPoint(c)){l=a(t,e,n);const h=l.points[0];if(i.containsPoint(h)){const u=Nb.create(t).move(h,-s(n,r(t,h))/2),d=Nb.create(e).move(c,-s(i,r(e,c))/2),g=new kb(u,d).getCenter(),p=a(t,g,n),f=o(g,e,p.direction);l.points=[p.points[0],f.points[0]],l.direction=f.direction}}return l}function h(t,e,s,o,a){const l=s.union(o).inflate(1),c=l.getCenter(),h=c.distance(e)>c.distance(t),u=h?e:t,d=h?t:e;let g,p,f,m;a?(g=Nb.fromPolar(l.width+l.height,n[a],u),g=l.getNearestPointToPoint(g).move(g,-1)):g=l.getNearestPointToPoint(u).move(u,1),p=i(g,d,l),g.round().equals(p.round())?(p=Nb.fromPolar(l.width+l.height,Ob.toRad(g.theta(u))+Math.PI/2,d),p=l.getNearestPointToPoint(p).move(d,1).round(),f=i(g,p,l),m=h?[p,f,g]:[g,f,p]):m=h?[p,g]:[g,p];const y=r(h?g:p,e);return{points:m,direction:y}}t.getBBoxSize=s,t.getBearing=r,t.vertexToVertex=o,t.nodeToVertex=a,t.vertexToNode=l,t.nodeToNode=c,t.insideNode=h})(bP||(bP={}));const vP={step:10,maxLoopCount:2e3,precision:1,maxDirectionChange:90,perpendicular:!0,excludeTerminals:[],excludeNodes:[],excludeShapes:[],startDirections:["top","right","bottom","left"],endDirections:["top","right","bottom","left"],directionMap:{top:{x:0,y:-1},right:{x:1,y:0},bottom:{x:0,y:1},left:{x:-1,y:0}},cost(){const t=xP(this.step,this);return t},directions(){const t=xP(this.step,this),e=xP(this.cost,this);return[{cost:e,offsetX:t,offsetY:0},{cost:e,offsetX:-t,offsetY:0},{cost:e,offsetX:0,offsetY:t},{cost:e,offsetX:0,offsetY:-t}]},penalties(){const t=xP(this.step,this);return{0:0,45:t/2,90:t/2}},paddingBox(){const t=xP(this.step,this);return{x:-t,y:-t,width:2*t,height:2*t}},fallbackRouter:yP,draggingRouter:null,snapToGrid:!0};function xP(t,e){return"function"===typeof t?t.call(e):t}function wP(t){const e=Object.keys(t).reduce((e,n)=>{const i=e;return i[n]="fallbackRouter"===n||"draggingRouter"===n||"fallbackRoute"===n?t[n]:xP(t[n],t),e},{});if(e.padding){const t=wf(e.padding);e.paddingBox={x:-t.left,y:-t.top,width:t.left+t.right,height:t.top+t.bottom}}return e.directions.forEach(t=>{const e=new Nb(0,0),n=new Nb(t.offsetX,t.offsetY);t.angle=Ob.normalize(e.theta(n))}),e}const CP=1,PP=2;class EP{constructor(){this.items=[],this.hash={},this.values={}}add(t,e){this.hash[t]?this.items.splice(this.items.indexOf(t),1):this.hash[t]=CP,this.values[t]=e;const n=td(this.items,t,t=>this.values[t]);this.items.splice(n,0,t)}pop(){const t=this.items.shift();return t&&(this.hash[t]=PP),t}isOpen(t){return this.hash[t]===CP}isClose(t){return this.hash[t]===PP}isEmpty(){return 0===this.items.length}}class MP{constructor(t){this.options=t,this.mapGridSize=100,this.map={}}build(t,e){const n=this.options,i=n.excludeTerminals.reduce((n,i)=>{const s=e[i];if(s){const e=t.getCell(s.cell);e&&n.push(e)}return n},[]);let s=[];const r=t.getCell(e.getSourceCellId());r&&(s=pu(s,r.getAncestors().map(t=>t.id)));const o=t.getCell(e.getTargetCellId());o&&(s=pu(s,o.getAncestors().map(t=>t.id)));const a=this.mapGridSize;return t.getNodes().reduce((t,e)=>{const r=i.some(t=>t.id===e.id),o=!!e.shape&&n.excludeShapes.includes(e.shape),l=n.excludeNodes.some(t=>"string"===typeof t?e.id===t:t===e),c=s.includes(e.id),h=o||r||l||c;if(e.isVisible()&&!h){const i=e.getBBox().moveAndExpand(n.paddingBox),s=i.getOrigin().snapToGrid(a),r=i.getCorner().snapToGrid(a);for(let e=s.x;e<=r.x;e+=a)for(let n=s.y;n<=r.y;n+=a){const s=new Nb(e,n).toString();null==t[s]&&(t[s]=[]),t[s].push(i)}}return t},this.map),this}isAccessible(t){const e=t.clone().snapToGrid(this.mapGridSize).toString(),n=this.map[e];return!n||n.every(e=>!e.containsPoint(t))}}function OP(t,e){const n=t.sourceBBox.clone();return e&&e.paddingBox?n.moveAndExpand(e.paddingBox):n}function AP(t,e){const n=t.targetBBox.clone();return e&&e.paddingBox?n.moveAndExpand(e.paddingBox):n}function SP(t,e){if(t.sourceAnchor)return t.sourceAnchor;const n=OP(t,e);return n.getCenter()}function NP(t,e){if(t.targetAnchor)return t.targetAnchor;const n=AP(t,e);return n.getCenter()}function TP(t,e,n,i,s){const r=360/n,o=t.theta(kP(t,e,i,s)),a=Ob.normalize(o+r/2);return r*Math.floor(a/r)}function kP(t,e,n,i){const s=i.step,r=e.x-t.x,o=e.y-t.y,a=r/n.x,l=o/n.y,c=a*s,h=l*s;return new Nb(t.x+c,t.y+h)}function jP(t,e){const n=Math.abs(t-e);return n>180?360-n:n}function LP(t,e){const n=e.step;return e.directions.forEach(e=>{e.gridOffsetX=e.offsetX/n*t.x,e.gridOffsetY=e.offsetY/n*t.y}),e.directions}function DP(t,e,n){return{source:e.clone(),x:BP(n.x-e.x,t),y:BP(n.y-e.y,t)}}function BP(t,e){if(!t)return e;const n=Math.abs(t),i=Math.round(n/e);if(!i)return n;const s=i*e,r=n-s,o=r/i;return e+o}function IP(t,e){const n=e.source,i=Ab.snapToGrid(t.x-n.x,e.x)+n.x,s=Ab.snapToGrid(t.y-n.y,e.y)+n.y;return new Nb(i,s)}function RP(t,e){return t.round(e)}function VP(t,e,n){return RP(IP(t.clone(),e),n)}function zP(t){return t.toString()}function $P(t){return new Nb(0===t.x?0:Math.abs(t.x)/t.x,0===t.y?0:Math.abs(t.y)/t.y)}function FP(t,e){let n=1/0;for(let i=0,s=e.length;i<s;i+=1){const s=t.manhattanDistance(e[i]);s<n&&(n=s)}return n}function GP(t,e,n,i,s){const r=s.precision,o=s.directionMap,a=t.diff(e.getCenter()),l=Object.keys(o).reduce((s,l)=>{if(n.includes(l)){const n=o[l],c=new Nb(t.x+n.x*(Math.abs(a.x)+e.width),t.y+n.y*(Math.abs(a.y)+e.height)),h=new kb(t,c),u=h.intersect(e)||[];let d,g=null;for(let e=0;e<u.length;e+=1){const n=u[e],i=t.squaredDistance(n);(null==d||i>d)&&(d=i,g=n)}if(g){let t=VP(g,i,r);e.containsPoint(t)&&(t=VP(t.translate(n.x*i.x,n.y*i.y),i,r)),s.push(t)}}return s},[]);return e.containsPoint(t)||l.push(VP(t,i,r)),l}function _P(t,e,n,i,s){const r=[];let o,a=$P(s.diff(n)),l=zP(n),c=t[l];while(c){o=e[l];const n=$P(o.diff(c));n.equals(a)||(r.unshift(o),a=n),l=zP(c),c=t[l]}const h=e[l],u=$P(h.diff(i));return u.equals(a)||r.unshift(h),r}function HP(t,e,n,i,s){const r=s.precision;let o,a;o=Tb.isRectangle(e)?RP(SP(t,s).clone(),r):RP(e.clone(),r),a=Tb.isRectangle(n)?RP(NP(t,s).clone(),r):RP(n.clone(),r);const l=DP(s.step,o,a),c=o,h=a;let u,d;if(u=Tb.isRectangle(e)?GP(c,e,s.startDirections,l,s):[c],d=Tb.isRectangle(n)?GP(a,n,s.endDirections,l,s):[h],u=u.filter(t=>i.isAccessible(t)),d=d.filter(t=>i.isAccessible(t)),u.length>0&&d.length>0){const t=new EP,e={},n={},o={};for(let i=0,s=u.length;i<s;i+=1){const n=u[i],s=zP(n);t.add(s,FP(n,d)),e[s]=n,o[s]=0}const a=s.previousDirectionAngle,g=void 0===a;let p,f;const m=LP(l,s),y=m.length,b=d.reduce((t,e)=>{const n=zP(e);return t.push(n),t},[]),v=Nb.equalPoints(u,d);let x=s.maxLoopCount;while(!t.isEmpty()&&x>0){const u=t.pop(),w=e[u],C=n[u],P=o[u],E=w.equals(c),M=null==C;let O;O=M?g?E?null:TP(c,w,y,l,s):a:TP(C,w,y,l,s);const A=M&&v;if(!A&&b.indexOf(u)>=0)return s.previousDirectionAngle=O,_P(n,e,w,c,h);for(let a=0;a<y;a+=1){p=m[a];const c=p.angle;if(f=jP(O,c),(!g||!E)&&f>s.maxDirectionChange)continue;const u=VP(w.clone().translate(p.gridOffsetX||0,p.gridOffsetY||0),l,r),v=zP(u);if(t.isClose(v)||!i.isAccessible(u))continue;if(b.indexOf(v)>=0){const t=u.equals(h);if(!t){const t=TP(u,h,y,l,s),e=jP(c,t);if(e>s.maxDirectionChange)continue}}const x=p.cost,C=E?0:s.penalties[f],M=P+x+C;(!t.isOpen(v)||M<o[v])&&(e[v]=u,n[v]=w,o[v]=M,t.add(v,M+FP(u,d)))}x-=1}}return s.fallbackRoute?Pt(s.fallbackRoute,this,c,h,s):null}function UP(t,e=10){if(t.length<=1)return t;for(let n=0,i=t.length;n<i-1;n+=1){const i=t[n],s=t[n+1];if(i.x===s.x){const t=e*Math.round(i.x/e);i.x!==t&&(i.x=t,s.x=t)}else if(i.y===s.y){const t=e*Math.round(i.y/e);i.y!==t&&(i.y=t,s.y=t)}}return t}const JP=function(t,e,n){const i=wP(e),s=OP(n,i),r=AP(n,i),o=SP(n,i),a=new MP(i).build(n.graph.model,n.cell),l=t.map(t=>Nb.create(t)),c=[];let h,u,d=o;for(let g=0,p=l.length;g<=p;g+=1){let e=null;if(h=u||s,u=l[g],null==u){u=r;const t=n.cell,a=null==t.getSourceCellId()||null==t.getTargetCellId();if(a&&"function"===typeof i.draggingRouter){const t=h===s?o:h,r=u.getOrigin();e=Pt(i.draggingRouter,n,t,r,i)}}if(null==e&&(e=HP(n,h,u,a,i)),null===e)return console.warn("Unable to execute manhattan algorithm, use orth instead"),Pt(i.fallbackRouter,this,t,i,n);const p=e[0];p&&p.equals(d)&&e.shift(),d=e[e.length-1]||d,c.push(...e)}return i.snapToGrid?UP(c,n.graph.grid.getGridSize()):c},qP=function(t,e,n){return Pt(JP,this,t,Object.assign(Object.assign({},vP),e),n)},WP={maxDirectionChange:45,directions(){const t=xP(this.step,this),e=xP(this.cost,this),n=Math.ceil(Math.sqrt(t*t<<1));return[{cost:e,offsetX:t,offsetY:0},{cost:n,offsetX:t,offsetY:t},{cost:e,offsetX:0,offsetY:t},{cost:n,offsetX:-t,offsetY:t},{cost:e,offsetX:-t,offsetY:0},{cost:n,offsetX:-t,offsetY:-t},{cost:e,offsetX:0,offsetY:-t},{cost:n,offsetX:t,offsetY:-t}]},fallbackRoute(t,e,n){const i=t.theta(e),s=[];let r={x:e.x,y:t.y},o={x:t.x,y:e.y};if(i%180>90){const t=r;r=o,o=t}const a=i%90<45?r:o,l=new kb(t,a),c=90*Math.ceil(i/90),h=Nb.fromPolar(l.squaredLength(),Ob.toRad(c+135),a),u=new kb(e,h),d=l.intersectsWithLine(u),g=d||e,p=d?g:t,f=360/n.directions.length,m=p.theta(e),y=Ob.normalize(m+f/2),b=f*Math.floor(y/f);return n.previousDirectionAngle=b,g&&s.push(g.round()),s.push(e),s}},XP=function(t,e,n){return Pt(qP,this,t,Object.assign(Object.assign({},WP),e),n)},YP=function(t,e,n){const i=e.offset||32,s=null==e.min?16:e.min;let r=0,o=e.direction;const a=n.sourceBBox,l=n.targetBBox,c=a.getCenter(),h=l.getCenter();if("number"===typeof i&&(r=i),null==o){let t=l.left-a.right,e=l.top-a.bottom;t>=0&&e>=0?o=t>=e?"L":"T":t<=0&&e>=0?(t=a.left-l.right,o=t>=0&&t>=e?"R":"T"):t>=0&&e<=0?(e=a.top-l.bottom,o=e>=0?t>=e?"L":"B":"L"):(t=a.left-l.right,e=a.top-l.bottom,o=t>=0&&e>=0?t>=e?"R":"B":t<=0&&e>=0?"B":t>=0&&e<=0||Math.abs(t)>Math.abs(e)?"R":"B")}let u,d,g;"H"===o?o=h.x-c.x>=0?"L":"R":"V"===o&&(o=h.y-c.y>=0?"T":"B"),"center"===i&&("L"===o?r=(l.left-a.right)/2:"R"===o?r=(a.left-l.right)/2:"T"===o?r=(l.top-a.bottom)/2:"B"===o&&(r=(a.top-l.bottom)/2));const p="L"===o||"R"===o;if(p){if(h.y===c.y)return[...t];g="L"===o?1:-1,u="x",d="width"}else{if(h.x===c.x)return[...t];g="T"===o?1:-1,u="y",d="height"}const f=c.clone(),m=h.clone();if(f[u]+=g*(a[d]/2+r),m[u]-=g*(l[d]/2+r),p){const t=f.x,e=m.x,n=a.width/2+s,i=l.width/2+s;h.x>c.x?e<=t&&(f.x=Math.max(e,c.x+n),m.x=Math.min(t,h.x-i)):e>=t&&(f.x=Math.min(e,c.x-n),m.x=Math.max(t,h.x+i))}else{const t=f.y,e=m.y,n=a.height/2+s,i=l.height/2+s;h.y>c.y?e<=t&&(f.y=Math.max(e,c.y+n),m.y=Math.min(t,h.y-i)):e>=t&&(f.y=Math.min(e,c.y-n),m.y=Math.max(t,h.y+i))}return[f.toJSON(),...t,m.toJSON()]};function ZP(t,e){if(null!=e&&!1!==e){const n="boolean"===typeof e?0:e;if(n>0){const e=Nb.create(t[1]).move(t[2],n),i=Nb.create(t[1]).move(t[0],n);return[e.toJSON(),...t,i.toJSON()]}{const e=t[1];return[Object.assign({},e),...t,Object.assign({},e)]}}return t}const KP=function(t,e,n){const i=e.width||50,s=e.height||80,r=s/2,o=e.angle||"auto",a=n.sourceAnchor,l=n.targetAnchor,c=n.sourceBBox,h=n.targetBBox;if(a.equals(l)){const t=t=>{const e=Ob.toRad(t),n=Math.sin(e),s=Math.cos(e),o=new Nb(a.x+s*i,a.y+n*i),l=new Nb(o.x-s*r,o.y-n*r),c=l.clone().rotate(-90,o),h=l.clone().rotate(90,o);return[c.toJSON(),o.toJSON(),h.toJSON()]},n=t=>{const e=a.clone().move(t,-1),n=new kb(e,t);return!c.containsPoint(t)&&!c.intersectsWithLine(n)},s=[0,90,180,270,45,135,225,315];if("number"===typeof o)return ZP(t(o),e.merge);const l=c.getCenter();if(l.equals(a))return ZP(t(0),e.merge);const h=l.angleBetween(a,l.clone().translate(1,0));let u=t(h);if(n(u[1]))return ZP(u,e.merge);for(let i=1,r=s.length;i<r;i+=1)if(u=t(h+s[i]),n(u[1]))return ZP(u,e.merge);return ZP(u,e.merge)}{const t=new kb(a,l);let s=t.parallel(-i),o=s.getCenter(),u=s.start.clone().move(s.end,r),d=s.end.clone().move(s.start,r);const g=t.parallel(-1),p=new kb(g.start,o),f=new kb(g.end,o);if((c.containsPoint(o)||h.containsPoint(o)||c.intersectsWithLine(p)||c.intersectsWithLine(f)||h.intersectsWithLine(p)||h.intersectsWithLine(f))&&(s=t.parallel(i),o=s.getCenter(),u=s.start.clone().move(s.end,r),d=s.end.clone().move(s.start,r)),e.merge){const t=new kb(a,l),e=new kb(o,t.center).setLength(Number.MAX_SAFE_INTEGER),i=c.intersectsWithLine(e),s=h.intersectsWithLine(e),r=i?Array.isArray(i)?i:[i]:[];s&&(Array.isArray(s)?r.push(...s):r.push(s));const u=t.center.closest(r);u?(n.sourceAnchor=u.clone(),n.targetAnchor=u.clone()):(n.sourceAnchor=t.center.clone(),n.targetAnchor=t.center.clone())}return ZP([u.toJSON(),o.toJSON(),d.toJSON()],e.merge)}};var QP;(function(t){t.presets=v,t.registry=ev.create({type:"router"}),t.registry.register(t.presets,!0)})(QP||(QP={}));const tE=function(t,e,n,i={}){const s=[t,...n,e],r=new $b(s),o=new tv(r);return i.raw?o:o.serialize()},eE=function(t,e,n,i={}){const s=3===n.length?0:1,r=Nb.create(n[0+s]),o=Nb.create(n[2+s]),a=Nb.create(n[1+s]);if(!Nb.equals(t,e)){const n=new Nb((t.x+e.x)/2,(t.y+e.y)/2),i=n.angleBetween(Nb.create(t).rotate(90,n),a);i>1&&(r.rotate(180-i,n),o.rotate(180-i,n),a.rotate(180-i,n))}const l=`\n M ${t.x} ${t.y}\n Q ${r.x} ${r.y} ${a.x} ${a.y}\n Q ${o.x} ${o.y} ${e.x} ${e.y}\n `;return i.raw?tv.parse(l):l},nE=function(t,e,n,i={}){const s=new tv;s.appendSegment(tv.createSegment("M",t));const r=1/3,o=2/3,a=i.radius||10;let l,c;for(let h=0,u=n.length;h<u;h+=1){const i=Nb.create(n[h]),u=n[h-1]||t,d=n[h+1]||e;l=c||i.distance(u)/2,c=i.distance(d)/2;const g=-Math.min(a,l),p=-Math.min(a,c),f=i.clone().move(u,g).round(),m=i.clone().move(d,p).round(),y=new Nb(r*f.x+o*i.x,o*i.y+r*f.y),b=new Nb(r*m.x+o*i.x,o*i.y+r*m.y);s.appendSegment(tv.createSegment("L",f)),s.appendSegment(tv.createSegment("C",y,b,m))}return s.appendSegment(tv.createSegment("L",e)),i.raw?s:s.serialize()},iE=function(t,e,n,i={}){let s,r=i.direction;if(n&&0!==n.length){const i=[t,...n,e],r=Fb.throughPoints(i);s=new tv(r)}else if(s=new tv,s.appendSegment(tv.createSegment("M",t)),r||(r=Math.abs(t.x-e.x)>=Math.abs(t.y-e.y)?"H":"V"),"H"===r){const n=(t.x+e.x)/2;s.appendSegment(tv.createSegment("C",n,t.y,n,e.y,e.x,e.y))}else{const n=(t.y+e.y)/2;s.appendSegment(tv.createSegment("C",t.x,n,e.x,n,e.x,e.y))}return i.raw?s:s.serialize()},sE=1,rE=1/3,oE=2/3;function aE(t){let e=t.graph._jumpOverUpdateList;if(null==e&&(e=t.graph._jumpOverUpdateList=[],t.graph.on("cell:mouseup",()=>{const e=t.graph._jumpOverUpdateList;setTimeout(()=>{for(let t=0;t<e.length;t+=1)e[t].update()})}),t.graph.on("model:reseted",()=>{e=t.graph._jumpOverUpdateList=[]})),e.indexOf(t)<0){e.push(t);const n=()=>e.splice(e.indexOf(t),1);t.cell.once("change:connector",n),t.cell.once("removed",n)}}function lE(t,e,n=[]){const i=[t,...n,e],s=[];return i.forEach((t,e)=>{const n=i[e+1];null!=n&&s.push(new kb(t,n))}),s}function cE(t,e){const n=[];return e.forEach(e=>{const i=t.intersectsWithLine(e);if(i){const{x:t,y:s}=i,{start:r,end:o}=e,a=Math.round(r.x)===Math.round(t)&&Math.round(r.y)===Math.round(s),l=Math.round(o.x)===Math.round(t)&&Math.round(o.y)===Math.round(s);if(a||l)return;n.push(i)}}),n}function hE(t,e){return new kb(t,e).squaredLength()}function uE(t,e,n){return e.reduce((i,s,r)=>{if(fE.includes(s))return i;const o=i.pop()||t,a=Nb.create(s).move(o.start,-n);let l=Nb.create(s).move(o.start,+n);const c=e[r+1];if(null!=c){const t=l.distance(c);t<=n&&(l=c.move(o.start,t),fE.push(c))}else{const t=a.distance(o.end);if(t<2*n+sE)return i.push(o),i}const h=l.distance(o.start);if(h<2*n+sE)return i.push(o),i;const u=new kb(a,l);return pE.push(u),i.push(new kb(o.start,a),u,new kb(l,o.end)),i},[])}function dE(t,e,n,i){const s=new tv;let r;return r=tv.createSegment("M",t[0].start),s.appendSegment(r),t.forEach((o,a)=>{if(pE.includes(o)){let t,i,a,l;if("arc"===n){t=-90,i=o.start.diff(o.end);const e=i.x<0||0===i.x&&i.y<0;e&&(t+=180);const n=o.getCenter(),c=new kb(n,o.end).rotate(t,n);let h;h=new kb(o.start,n),a=h.pointAt(2/3).rotate(t,o.start),l=c.pointAt(1/3).rotate(-t,c.end),r=tv.createSegment("C",a,l,c.end),s.appendSegment(r),h=new kb(n,o.end),a=c.pointAt(1/3).rotate(t,c.end),l=h.pointAt(1/3).rotate(-t,o.end),r=tv.createSegment("C",a,l,o.end),s.appendSegment(r)}else if("gap"===n)r=tv.createSegment("M",o.end),s.appendSegment(r);else if("cubic"===n){t=o.start.theta(o.end);const n=.6*e;let c=1.35*e;i=o.start.diff(o.end);const h=i.x<0||0===i.x&&i.y<0;h&&(c*=-1),a=new Nb(o.start.x+n,o.start.y+c).rotate(t,o.start),l=new Nb(o.end.x-n,o.end.y+c).rotate(t,o.end),r=tv.createSegment("C",a,l,o.end),s.appendSegment(r)}}else{const e=t[a+1];0===i||!e||pE.includes(e)?(r=tv.createSegment("L",o.end),s.appendSegment(r)):gE(i,s,o.end,o.start,e.end)}}),s}function gE(t,e,n,i,s){const r=n.distance(i)/2,o=n.distance(s)/2,a=-Math.min(t,r),l=-Math.min(t,o),c=n.clone().move(i,a).round(),h=n.clone().move(s,l).round(),u=new Nb(rE*c.x+oE*n.x,oE*n.y+rE*c.y),d=new Nb(rE*h.x+oE*n.x,oE*n.y+rE*h.y);let g;g=tv.createSegment("L",c),e.appendSegment(g),g=tv.createSegment("C",u,d,h),e.appendSegment(g)}let pE,fE;const mE=function(t,e,n,i={}){pE=[],fE=[],aE(this);const s=i.size||5,r=i.type||"arc",o=i.radius||0,a=i.ignoreConnectors||["smooth"],l=this.graph,c=l.model,h=c.getEdges();if(1===h.length)return dE(lE(t,e,n),s,r,o);const u=this.cell,d=h.indexOf(u),g=l.options.connecting.connector||{},p=h.filter((t,e)=>{const n=t.getConnector()||g;return!a.includes(n.name)&&(!(e>d)||"jumpover"!==n.name)}),f=p.map(t=>l.findViewByCell(t)),m=lE(t,e,n),y=f.map(t=>null==t?[]:t===this?m:lE(t.sourcePoint,t.targetPoint,t.routePoints)),b=[];m.forEach(t=>{const e=p.reduce((e,n,i)=>{if(n!==u){const n=cE(t,y[i]);e.push(...n)}return e},[]).sort((e,n)=>hE(t.start,e)-hE(t.start,n));e.length>0?b.push(...uE(t,e,s)):b.push(t)});const v=dE(b,s,r,o);return pE=[],fE=[],i.raw?v:v.serialize()};var yE;(function(t){t.presets=x,t.registry=ev.create({type:"connector"}),t.registry.register(t.presets,!0)})(yE||(yE={}));var bE=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class vE extends Hh{constructor(t={}){super(),this.pending=!1,this.changing=!1,this.data={},this.mutate(yh(t)),this.changed={}}mutate(t,e={}){const n=!0===e.unset,i=!0===e.silent,s=[],r=this.changing;this.changing=!0,r||(this.previous=yh(this.data),this.changed={});const o=this.data,a=this.previous,l=this.changed;if(Object.keys(t).forEach(e=>{const i=e,r=t[i];vl(o[i],r)||s.push(i),vl(a[i],r)?delete l[i]:l[i]=r,n?delete o[i]:o[i]=r}),!i&&s.length>0&&(this.pending=!0,this.pendingOptions=e,s.forEach(t=>{this.emit("change:*",{key:t,options:e,store:this,current:o[t],previous:a[t]})})),r)return this;if(!i)while(this.pending)this.pending=!1,this.emit("changed",{current:o,previous:a,store:this,options:this.pendingOptions});return this.pending=!1,this.changing=!1,this.pendingOptions=null,this}get(t,e){if(null==t)return this.data;const n=this.data[t];return null==n?e:n}getPrevious(t){if(this.previous){const e=this.previous[t];return null==e?void 0:e}}set(t,e,n){return null!=t&&("object"===typeof t?this.mutate(t,e):this.mutate({[t]:e},n)),this}remove(t,e){const n=void 0,i={};let s;if("string"===typeof t)i[t]=n,s=e;else if(Array.isArray(t))t.forEach(t=>i[t]=n),s=e;else{for(const t in this.data)i[t]=n;s=t}return this.mutate(i,Object.assign(Object.assign({},s),{unset:!0})),this}getByPath(t){return zh(this.data,t,"/")}setByPath(t,e,n={}){const i="/",s=Array.isArray(t)?[...t]:t.split(i),r=Array.isArray(t)?t.join(i):t,o=s[0],a=s.length;if(n.propertyPath=r,n.propertyValue=e,n.propertyPathArray=s,1===a)this.set(o,e,n);else{const r={};let l=r,c=o;for(let t=1;t<a;t+=1){const e=s[t],n=Number.isFinite(Number(e));l=l[c]=n?[]:{},c=e}$h(r,s,e,i);const h=yh(this.data);n.rewrite&&Fh(h,t,i);const u=jo(h,r);this.set(o,u[o],n)}return this}removeByPath(t,e){const n=Array.isArray(t)?t:t.split("/"),i=n[0];if(1===n.length)this.remove(i,e);else{const t=n.slice(1),s=yh(this.get(i));s&&Fh(s,t),this.set(i,s,e)}return this}hasChanged(t){return null==t?Object.keys(this.changed).length>0:t in this.changed}getChanges(t){if(null==t)return this.hasChanged()?yh(this.changed):null;const e=this.changing?this.previous:this.data,n={};let i;for(const s in t){const r=t[s];vl(e[s],r)||(n[s]=r,i=!0)}return i?yh(n):null}toJSON(){return yh(this.data)}clone(){const t=this.constructor;return new t(this.data)}dispose(){this.off(),this.data={},this.previous={},this.changed={},this.pending=!1,this.changing=!1,this.pendingOptions=null,this.trigger("disposed",{store:this})}}bE([Hh.dispose()],vE.prototype,"dispose",null);class xE{constructor(t){this.cell=t,this.ids={},this.cache={}}get(){return Object.keys(this.ids)}start(t,e,n={},i="/"){const s=this.cell.getPropByPath(t),r=wh(n,xE.defaultOptions),o=this.getTiming(r.timing),a=this.getInterp(r.interp,s,e);let l=0;const c=Array.isArray(t)?t.join(i):t,h=Array.isArray(t)?t:t.split(i),u=()=>{const t=(new Date).getTime();0===l&&(l=t);const e=t-l;let i=e/r.duration;i<1?this.ids[c]=requestAnimationFrame(u):i=1;const s=a(o(i));this.cell.setPropByPath(h,s),n.progress&&n.progress(Object.assign({progress:i,currentValue:s},this.getArgs(c))),1===i&&(this.cell.notify("transition:complete",this.getArgs(c)),n.complete&&n.complete(this.getArgs(c)),this.cell.notify("transition:finish",this.getArgs(c)),n.finish&&n.finish(this.getArgs(c)),this.clean(c))};return setTimeout(()=>{this.stop(t,void 0,i),this.cache[c]={startValue:s,targetValue:e,options:r},this.ids[c]=requestAnimationFrame(u),this.cell.notify("transition:start",this.getArgs(c)),n.start&&n.start(this.getArgs(c))},n.delay),this.stop.bind(this,t,i,n)}stop(t,e={},n="/"){const i=Array.isArray(t)?t:t.split(n);return Object.keys(this.ids).filter(t=>vl(i,t.split(n).slice(0,i.length))).forEach(t=>{cancelAnimationFrame(this.ids[t]);const n=this.cache[t],i=this.getArgs(t),s=Object.assign(Object.assign({},n.options),e),r=s.jumpedToEnd;r&&null!=n.targetValue&&(this.cell.setPropByPath(t,n.targetValue),this.cell.notify("transition:end",Object.assign({},i)),this.cell.notify("transition:complete",Object.assign({},i)),s.complete&&s.complete(Object.assign({},i)));const o=Object.assign({jumpedToEnd:r},i);this.cell.notify("transition:stop",Object.assign({},o)),s.stop&&s.stop(Object.assign({},o)),this.cell.notify("transition:finish",Object.assign({},i)),s.finish&&s.finish(Object.assign({},i)),this.clean(t)}),this}clean(t){delete this.ids[t],delete this.cache[t]}getTiming(t){return"string"===typeof t?bb[t]:t}getInterp(t,e,n){return t?t(e,n):"number"===typeof n?vb.number(e,n):"string"===typeof n?"#"===n[0]?vb.color(e,n):vb.unit(e,n):vb.object(e,n)}getArgs(t){const e=this.cache[t];return{path:t,startValue:e.startValue,targetValue:e.targetValue,cell:this.cell}}}(function(t){t.defaultOptions={delay:10,duration:100,timing:"linear"}})(xE||(xE={}));var wE,CE=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o},PE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class EE extends Hh{static config(t){const{markup:e,propHooks:n,attrHooks:i}=t,s=PE(t,["markup","propHooks","attrHooks"]);null!=e&&(this.markup=e),n&&(this.propHooks=this.propHooks.slice(),Array.isArray(n)?this.propHooks.push(...n):"function"===typeof n?this.propHooks.push(n):Object.values(n).forEach(t=>{"function"===typeof t&&this.propHooks.push(t)})),i&&(this.attrHooks=Object.assign(Object.assign({},this.attrHooks),i)),this.defaults=jo({},this.defaults,s)}static getMarkup(){return this.markup}static getDefaults(t){return t?this.defaults:yh(this.defaults)}static getAttrHooks(){return this.attrHooks}static applyPropHooks(t,e){return this.propHooks.reduce((e,n)=>n?Pt(n,t,e):e,e)}get[Symbol.toStringTag](){return EE.toStringTag}constructor(t={}){super();const e=this.constructor,n=e.getDefaults(!0),i=jo({},this.preprocess(n),this.preprocess(t));this.id=i.id||cf(),this.store=new vE(i),this.animation=new xE(this),this.setup(),this.init(),this.postprocess(t)}init(){}get model(){return this._model}set model(t){this._model!==t&&(this._model=t)}preprocess(t,e){const n=t.id,i=this.constructor,s=i.applyPropHooks(this,t);return null==n&&!0!==e&&(s.id=cf()),s}postprocess(t){}setup(){this.store.on("change:*",t=>{const{key:e,current:n,previous:i,options:s}=t;this.notify("change:*",{key:e,options:s,current:n,previous:i,cell:this}),this.notify(`change:${e}`,{options:s,current:n,previous:i,cell:this});const r=e;"source"!==r&&"target"!==r||this.notify("change:terminal",{type:r,current:n,previous:i,options:s,cell:this})}),this.store.on("changed",({options:t})=>this.notify("changed",{options:t,cell:this}))}notify(t,e){this.trigger(t,e);const n=this.model;return n&&(n.notify(`cell:${t}`,e),this.isNode()?n.notify(`node:${t}`,Object.assign(Object.assign({},e),{node:this})):this.isEdge()&&n.notify(`edge:${t}`,Object.assign(Object.assign({},e),{edge:this}))),this}isNode(){return!1}isEdge(){return!1}isSameStore(t){return this.store===t.store}get view(){return this.store.get("view")}get shape(){return this.store.get("shape","")}getProp(t,e){return null==t?this.store.get():this.store.get(t,e)}setProp(t,e,n){if("string"===typeof t)this.store.set(t,e,n);else{const n=this.preprocess(t,!0);this.store.set(jo({},this.getProp(),n),e),this.postprocess(t)}return this}removeProp(t,e){return"string"===typeof t||Array.isArray(t)?this.store.removeByPath(t,e):this.store.remove(e),this}hasChanged(t){return null==t?this.store.hasChanged():this.store.hasChanged(t)}getPropByPath(t){return this.store.getByPath(t)}setPropByPath(t,e,n={}){return this.model&&("children"===t?this._children=e?e.map(t=>this.model.getCell(t)).filter(t=>null!=t):null:"parent"===t&&(this._parent=e?this.model.getCell(e):null)),this.store.setByPath(t,e,n),this}removePropByPath(t,e={}){const n=Array.isArray(t)?t:t.split("/");return"attrs"===n[0]&&(e.dirty=!0),this.store.removeByPath(n,e),this}prop(t,e,n){return null==t?this.getProp():"string"===typeof t||Array.isArray(t)?1===arguments.length?this.getPropByPath(t):null==e?this.removePropByPath(t,n||{}):this.setPropByPath(t,e,n||{}):this.setProp(t,e||{})}previous(t){return this.store.getPrevious(t)}get zIndex(){return this.getZIndex()}set zIndex(t){null==t?this.removeZIndex():this.setZIndex(t)}getZIndex(){return this.store.get("zIndex")}setZIndex(t,e={}){return this.store.set("zIndex",t,e),this}removeZIndex(t={}){return this.store.remove("zIndex",t),this}toFront(t={}){const e=this.model;if(e){let n,i=e.getMaxZIndex();t.deep?(n=this.getDescendants({deep:!0,breadthFirst:!0}),n.unshift(this)):n=[this],i=i-n.length+1;const s=e.total();let r=e.indexOf(this)!==s-n.length;r||(r=n.some((t,e)=>t.getZIndex()!==i+e)),r&&this.batchUpdate("to-front",()=>{i+=n.length,n.forEach((e,n)=>{e.setZIndex(i+n,t)})})}return this}toBack(t={}){const e=this.model;if(e){let n,i=e.getMinZIndex();t.deep?(n=this.getDescendants({deep:!0,breadthFirst:!0}),n.unshift(this)):n=[this];let s=0!==e.indexOf(this);s||(s=n.some((t,e)=>t.getZIndex()!==i+e)),s&&this.batchUpdate("to-back",()=>{i-=n.length,n.forEach((e,n)=>{e.setZIndex(i+n,t)})})}return this}get markup(){return this.getMarkup()}set markup(t){null==t?this.removeMarkup():this.setMarkup(t)}getMarkup(){let t=this.store.get("markup");if(null==t){const e=this.constructor;t=e.getMarkup()}return t}setMarkup(t,e={}){return this.store.set("markup",t,e),this}removeMarkup(t={}){return this.store.remove("markup",t),this}get attrs(){return this.getAttrs()}set attrs(t){null==t?this.removeAttrs():this.setAttrs(t)}getAttrs(){const t=this.store.get("attrs");return t?Object.assign({},t):{}}setAttrs(t,e={}){if(null==t)this.removeAttrs(e);else{const n=t=>this.store.set("attrs",t,e);if(!0===e.overwrite)n(t);else{const i=this.getAttrs();!1===e.deep?n(Object.assign(Object.assign({},i),t)):n(jo({},i,t))}}return this}replaceAttrs(t,e={}){return this.setAttrs(t,Object.assign(Object.assign({},e),{overwrite:!0}))}updateAttrs(t,e={}){return this.setAttrs(t,Object.assign(Object.assign({},e),{deep:!1}))}removeAttrs(t={}){return this.store.remove("attrs",t),this}getAttrDefinition(t){if(!t)return null;const e=this.constructor,n=e.getAttrHooks()||{};let i=n[t]||iw.registry.get(t);if(!i){const e=Zp(t);i=n[e]||iw.registry.get(e)}return i||null}getAttrByPath(t){return null==t||""===t?this.getAttrs():this.getPropByPath(this.prefixAttrPath(t))}setAttrByPath(t,e,n={}){return this.setPropByPath(this.prefixAttrPath(t),e,n),this}removeAttrByPath(t,e={}){return this.removePropByPath(this.prefixAttrPath(t),e),this}prefixAttrPath(t){return Array.isArray(t)?["attrs"].concat(t):`attrs/${t}`}attr(t,e,n){return null==t?this.getAttrByPath():"string"===typeof t||Array.isArray(t)?1===arguments.length?this.getAttrByPath(t):null==e?this.removeAttrByPath(t,n||{}):this.setAttrByPath(t,e,n||{}):this.setAttrs(t,e||{})}get visible(){return this.isVisible()}set visible(t){this.setVisible(t)}setVisible(t,e={}){return this.store.set("visible",t,e),this}isVisible(){return!1!==this.store.get("visible")}show(t={}){return this.isVisible()||this.setVisible(!0,t),this}hide(t={}){return this.isVisible()&&this.setVisible(!1,t),this}toggleVisible(t,e={}){const n="boolean"===typeof t?t:!this.isVisible(),i="boolean"===typeof t?e:t;return n?this.show(i):this.hide(i),this}get data(){return this.getData()}set data(t){this.setData(t)}getData(){return this.store.get("data")}setData(t,e={}){if(null==t)this.removeData(e);else{const n=t=>this.store.set("data",t,e);if(!0===e.overwrite)n(t);else{const i=this.getData();!1===e.deep?n("object"===typeof t?Object.assign(Object.assign({},i),t):t):n(jo({},i,t))}}return this}replaceData(t,e={}){return this.setData(t,Object.assign(Object.assign({},e),{overwrite:!0}))}updateData(t,e={}){return this.setData(t,Object.assign(Object.assign({},e),{deep:!1}))}removeData(t={}){return this.store.remove("data",t),this}get parent(){return this.getParent()}get children(){return this.getChildren()}getParentId(){return this.store.get("parent")}getParent(){const t=this.getParentId();if(t&&this.model){const e=this.model.getCell(t);return this._parent=e,e}return null}getChildren(){const t=this.store.get("children");if(t&&t.length&&this.model){const e=t.map(t=>{var e;return null===(e=this.model)||void 0===e?void 0:e.getCell(t)}).filter(t=>null!=t);return this._children=e,[...e]}return null}hasParent(){return null!=this.parent}isParentOf(t){return null!=t&&t.getParent()===this}isChildOf(t){return null!=t&&this.getParent()===t}eachChild(t,e){return this.children&&this.children.forEach(t,e),this}filterChild(t,e){return this.children?this.children.filter(t,e):[]}getChildCount(){return null==this.children?0:this.children.length}getChildIndex(t){return null==this.children?-1:this.children.indexOf(t)}getChildAt(t){return null!=this.children&&t>=0?this.children[t]:null}getAncestors(t={}){const e=[];let n=this.getParent();while(n)e.push(n),n=!1!==t.deep?n.getParent():null;return e}getDescendants(t={}){if(!1!==t.deep){if(t.breadthFirst){const t=[],e=this.getChildren()||[];while(e.length>0){const n=e.shift(),i=n.getChildren();t.push(n),i&&e.push(...i)}return t}{const e=this.getChildren()||[];return e.forEach(n=>{e.push(...n.getDescendants(t))}),e}}return this.getChildren()||[]}isDescendantOf(t,e={}){if(null==t)return!1;if(!1!==e.deep){let e=this.getParent();while(e){if(e===t)return!0;e=e.getParent()}return!1}return this.isChildOf(t)}isAncestorOf(t,e={}){return null!=t&&t.isDescendantOf(this,e)}contains(t){return this.isAncestorOf(t)}getCommonAncestor(...t){return EE.getCommonAncestor(this,...t)}setParent(t,e={}){return this._parent=t,t?this.store.set("parent",t.id,e):this.store.remove("parent",e),this}setChildren(t,e={}){return this._children=t,null!=t?this.store.set("children",t.map(t=>t.id),e):this.store.remove("children",e),this}unembed(t,e={}){const n=this.children;if(null!=n&&null!=t){const i=this.getChildIndex(t);-1!==i&&(n.splice(i,1),t.setParent(null,e),this.setChildren(n,e))}return this}embed(t,e={}){return t.addTo(this,e),this}addTo(t,e={}){return EE.isCell(t)?t.addChild(this,e):t.addCell(this,e),this}insertTo(t,e,n={}){return t.insertChild(this,e,n),this}addChild(t,e={}){return this.insertChild(t,void 0,e)}insertChild(t,e,n={}){if(null!=t&&t!==this){const i=t.getParent(),s=this!==i;let r=e;if(null==r&&(r=this.getChildCount(),s||(r-=1)),i){const e=i.getChildren();if(e){const s=e.indexOf(t);s>=0&&(t.setParent(null,n),e.splice(s,1),i.setChildren(e,n))}}let o=this.children;if(null==o?(o=[],o.push(t)):o.splice(r,0,t),t.setParent(this,n),this.setChildren(o,n),s&&this.model){const t=this.model.getIncomingEdges(this),e=this.model.getOutgoingEdges(this);t&&t.forEach(t=>t.updateParent(n)),e&&e.forEach(t=>t.updateParent(n))}this.model&&this.model.addCell(t,n)}return this}removeFromParent(t={}){const e=this.getParent();if(null!=e){const n=e.getChildIndex(this);e.removeChildAt(n,t)}return this}removeChild(t,e={}){const n=this.getChildIndex(t);return this.removeChildAt(n,e)}removeChildAt(t,e={}){const n=this.getChildAt(t),i=this.children;return null!=i&&null!=n&&(this.unembed(n,e),n.remove(e)),n}remove(t={}){return this.batchUpdate("remove",()=>{const e=this.getParent();e&&e.removeChild(this,t),!1!==t.deep&&this.eachChild(e=>e.remove(t)),this.model&&this.model.removeCell(this,t)}),this}transition(t,e,n={},i="/"){return this.animation.start(t,e,n,i)}stopTransition(t,e,n="/"){return this.animation.stop(t,e,n),this}getTransitions(){return this.animation.get()}translate(t,e,n){return this}scale(t,e,n,i){return this}addTools(t,e,n){const i=Array.isArray(t)?t:[t],s="string"===typeof e?e:null,r="object"===typeof e?e:"object"===typeof n?n:{};if(r.reset)return this.setTools({name:s,items:i,local:r.local},r);let o=yh(this.getTools());return null==o||null==s||o.name===s?(null==o&&(o={}),o.items||(o.items=[]),o.name=s,o.items=[...o.items,...i],this.setTools(Object.assign({},o),r)):void 0}setTools(t,e={}){return null==t?this.removeTools():this.store.set("tools",EE.normalizeTools(t),e),this}getTools(){return this.store.get("tools")}removeTools(t={}){return this.store.remove("tools",t),this}hasTools(t){const e=this.getTools();return null!=e&&(null==t||e.name===t)}hasTool(t){const e=this.getTools();return null!=e&&e.items.some(e=>"string"===typeof e?e===t:e.name===t)}removeTool(t,e={}){const n=yh(this.getTools());if(n){let i=!1;const s=n.items.slice(),r=t=>{s.splice(t,1),i=!0};if("number"===typeof t)r(t);else for(let e=s.length-1;e>=0;e-=1){const n=s[e],i="string"===typeof n?n===t:n.name===t;i&&r(e)}i&&(n.items=s,this.setTools(n,e))}return this}getBBox(t){return new Tb}getConnectionPoint(t,e){return new Nb}toJSON(t={}){const e=Object.assign({},this.store.get()),n=Object.prototype.toString,i=this.isNode()?"node":this.isEdge()?"edge":"cell";if(!e.shape){const t=this.constructor;throw new Error(`Unable to serialize ${i} missing "shape" prop, check the ${i} "${t.name||n.call(t)}"`)}const s=this.constructor,r=!0===t.diff,o=e.attrs||{},a=s.getDefaults(!0),l=r?this.preprocess(a,!0):a,c=l.attrs||{},h={};Object.entries(e).forEach(([t,s])=>{if(null!=s&&!Array.isArray(s)&&"object"===typeof s&&!fr(s))throw new Error(`Can only serialize ${i} with plain-object props, but got a "${n.call(s)}" type of key "${t}" on ${i} "${this.id}"`);if("attrs"!==t&&"shape"!==t&&r){const n=l[t];vl(s,n)&&delete e[t]}}),Object.keys(o).forEach(t=>{const e=o[t],n=c[t];Object.keys(e).forEach(i=>{const s=e[i],r=n?n[i]:null;null==s||"object"!==typeof s||Array.isArray(s)?null!=n&&vl(r,s)||(null==h[t]&&(h[t]={}),h[t][i]=s):Object.keys(s).forEach(e=>{const o=s[e];if(null==n||null==r||!M(r)||!vl(r[e],o)){null==h[t]&&(h[t]={}),null==h[t][i]&&(h[t][i]={});const n=h[t][i];n[e]=o}})})});const u=Object.assign(Object.assign({},e),{attrs:Ml(h)?void 0:h});null==u.attrs&&delete u.attrs;const d=u;return 0===d.angle&&delete d.angle,yh(d)}clone(t={}){if(!t.deep){const e=Object.assign({},this.store.get());t.keepId||delete e.id,delete e.parent,delete e.children;const n=this.constructor;return new n(e)}const e=EE.deepClone(this);return e[this.id]}findView(t){return t.findViewByCell(this)}startBatch(t,e={},n=this.model){return this.notify("batch:start",{name:t,data:e,cell:this}),n&&n.startBatch(t,Object.assign(Object.assign({},e),{cell:this})),this}stopBatch(t,e={},n=this.model){return n&&n.stopBatch(t,Object.assign(Object.assign({},e),{cell:this})),this.notify("batch:stop",{name:t,data:e,cell:this}),this}batchUpdate(t,e,n){const i=this.model;this.startBatch(t,n,i);const s=e();return this.stopBatch(t,n,i),s}dispose(){this.removeFromParent(),this.store.dispose()}}EE.defaults={},EE.attrHooks={},EE.propHooks=[],CE([Hh.dispose()],EE.prototype,"dispose",null),function(t){function e(t){return"string"===typeof t?{items:[t]}:Array.isArray(t)?{items:t}:t.items?t:{items:[t]}}t.normalizeTools=e}(EE||(EE={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNode&&"function"===typeof i.isEdge&&"function"===typeof i.prop&&"function"===typeof i.attr}t.toStringTag=`X6.${t.name}`,t.isCell=e}(EE||(EE={})),function(t){function e(...t){const e=t.filter(t=>null!=t).map(t=>t.getAncestors()).sort((t,e)=>t.length-e.length),n=e.shift();return n.find(t=>e.every(e=>e.includes(t)))||null}function n(t,e={}){let n=null;for(let i=0,s=t.length;i<s;i+=1){const s=t[i];let r=s.getBBox(e);if(r){if(s.isNode()){const t=s.getAngle();null!=t&&0!==t&&(r=r.bbox(t))}n=null==n?r:n.union(r)}}return n}function i(e){const n=[e,...e.getDescendants({deep:!0})];return t.cloneCells(n)}function s(t){const e=du(t),n=e.reduce((t,e)=>(t[e.id]=e.clone(),t),{});return e.forEach(t=>{const e=n[t.id];if(e.isEdge()){const t=e.getSourceCellId(),i=e.getTargetCellId();t&&n[t]&&e.setSource(Object.assign(Object.assign({},e.getSource()),{cell:n[t].id})),i&&n[i]&&e.setTarget(Object.assign(Object.assign({},e.getTarget()),{cell:n[i].id}))}const i=t.getParent();i&&n[i.id]&&e.setParent(n[i.id]);const s=t.getChildren();if(s&&s.length){const t=s.reduce((t,e)=>(n[e.id]&&t.push(n[e.id]),t),[]);t.length>0&&e.setChildren(t)}}),n}t.getCommonAncestor=e,t.getCellsBBox=n,t.deepClone=i,t.cloneCells=s}(EE||(EE={})),function(t){t.config({propHooks(e){var{tools:n}=e,i=PE(e,["tools"]);return n&&(i.tools=t.normalizeTools(n)),i}})}(EE||(EE={})),function(t){let e,n;function i(t,i){return i?null!=e&&e.exist(t):null!=n&&n.exist(t)}function s(t){e=t}function r(t){n=t}t.exist=i,t.setEdgeRegistry=s,t.setNodeRegistry=r}(wE||(wE={}));class ME{constructor(t){this.ports=[],this.groups={},this.init(yh(t))}getPorts(){return this.ports}getGroup(t){return null!=t?this.groups[t]:null}getPortsByGroup(t){return this.ports.filter(e=>e.group===t||null==e.group&&null==t)}getPortsLayoutByGroup(t,e){const n=this.getPortsByGroup(t),i=t?this.getGroup(t):null,s=i?i.position:null,r=s?s.name:null;let o;if(null!=r){const t=Aw.registry.get(r);if(null==t)return Aw.registry.onNotFound(r);o=t}else o=Aw.presets.left;const a=n.map(t=>t&&t.position&&t.position.args||{}),l=s&&s.args||{},c=o(a,e,l);return c.map((t,i)=>{const s=n[i];return{portLayout:t,portId:s.id,portSize:s.size,portAttrs:s.attrs,labelSize:s.label.size,labelLayout:this.getPortLabelLayout(s,Nb.create(t.position),e)}})}init(t){const{groups:e,items:n}=t;null!=e&&Object.keys(e).forEach(t=>{this.groups[t]=this.parseGroup(e[t])}),Array.isArray(n)&&n.forEach(t=>{this.ports.push(this.parsePort(t))})}parseGroup(t){return Object.assign(Object.assign({},t),{label:this.getLabel(t,!0),position:this.getPortPosition(t.position,!0)})}parsePort(t){const e=Object.assign({},t),n=this.getGroup(t.group)||{};return e.markup=e.markup||n.markup,e.attrs=jo({},n.attrs,e.attrs),e.position=this.createPosition(n,e),e.label=jo({},n.label,this.getLabel(e)),e.zIndex=this.getZIndex(n,e),e.size=Object.assign(Object.assign({},n.size),e.size),e}getZIndex(t,e){return"number"===typeof e.zIndex?e.zIndex:"number"===typeof t.zIndex||"auto"===t.zIndex?t.zIndex:"auto"}createPosition(t,e){return jo({name:"left",args:{}},t.position,{args:e.args})}getPortPosition(t,e=!1){if(null==t){if(e)return{name:"left",args:{}}}else{if("string"===typeof t)return{name:t,args:{}};if(Array.isArray(t))return{name:"absolute",args:{x:t[0],y:t[1]}};if("object"===typeof t)return t}return{args:{}}}getPortLabelPosition(t,e=!1){if(null==t){if(e)return{name:"left",args:{}}}else{if("string"===typeof t)return{name:t,args:{}};if("object"===typeof t)return t}return{args:{}}}getLabel(t,e=!1){const n=t.label||{};return n.position=this.getPortLabelPosition(n.position,e),n}getPortLabelLayout(t,e,n){const i=t.label.position.name||"left",s=t.label.position.args||{},r=Uw.registry.get(i)||Uw.presets.left;return r?r(e,n,s):null}}var OE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class AE extends EE{get[Symbol.toStringTag](){return AE.toStringTag}constructor(t={}){super(t),this.initPorts()}preprocess(t,e){const{x:n,y:i,width:s,height:r}=t,o=OE(t,["x","y","width","height"]);if(null!=n||null!=i){const t=o.position;o.position=Object.assign(Object.assign({},t),{x:null!=n?n:t?t.x:0,y:null!=i?i:t?t.y:0})}if(null!=s||null!=r){const t=o.size;o.size=Object.assign(Object.assign({},t),{width:null!=s?s:t?t.width:0,height:null!=r?r:t?t.height:0})}return super.preprocess(o,e)}isNode(){return!0}size(t,e,n){return void 0===t?this.getSize():"number"===typeof t?this.setSize(t,e,n):this.setSize(t,e)}getSize(){const t=this.store.get("size");return t?Object.assign({},t):{width:1,height:1}}setSize(t,e,n){return"object"===typeof t?this.resize(t.width,t.height,e):this.resize(t,e,n),this}resize(t,e,n={}){this.startBatch("resize",n);const i=n.direction;if(i){const s=this.getSize();switch(i){case"left":case"right":e=s.height;break;case"top":case"bottom":t=s.width;break;default:break}const r={right:0,"top-right":0,top:1,"top-left":1,left:2,"bottom-left":2,bottom:3,"bottom-right":3};let o=r[i];const a=Ob.normalize(this.getAngle()||0);n.absolute&&(o+=Math.floor((a+45)/90),o%=4);const l=this.getBBox();let c;c=0===o?l.getBottomLeft():1===o?l.getCorner():2===o?l.getTopRight():l.getOrigin();const h=c.clone().rotate(-a,l.getCenter()),u=Math.sqrt(t*t+e*e)/2;let d=o*Math.PI/2;d+=Math.atan(o%2===0?e/t:t/e),d-=Ob.toRad(a);const g=Nb.fromPolar(u,d,h),p=g.clone().translate(t/-2,e/-2);this.store.set("size",{width:t,height:e},n),this.setPosition(p.x,p.y,n)}else this.store.set("size",{width:t,height:e},n);return this.stopBatch("resize",n),this}scale(t,e,n,i={}){const s=this.getBBox().scale(t,e,null==n?void 0:n);return this.startBatch("scale",i),this.setPosition(s.x,s.y,i),this.resize(s.width,s.height,i),this.stopBatch("scale"),this}position(t,e,n){return"number"===typeof t?this.setPosition(t,e,n):this.getPosition(t)}getPosition(t={}){if(t.relative){const t=this.getParent();if(null!=t&&t.isNode()){const e=this.getPosition(),n=t.getPosition();return{x:e.x-n.x,y:e.y-n.y}}}const e=this.store.get("position");return e?Object.assign({},e):{x:0,y:0}}setPosition(t,e,n={}){let i,s,r;if("object"===typeof t?(i=t.x,s=t.y,r=e||{}):(i=t,s=e,r=n||{}),r.relative){const t=this.getParent();if(null!=t&&t.isNode()){const e=t.getPosition();i+=e.x,s+=e.y}}if(r.deep){const t=this.getPosition();this.translate(i-t.x,s-t.y,r)}else this.store.set("position",{x:i,y:s},r);return this}translate(t=0,e=0,n={}){if(0===t&&0===e)return this;n.translateBy=n.translateBy||this.id;const i=this.getPosition();if(null!=n.restrict&&n.translateBy===this.id){const s=this.getBBox({deep:!0}),r=n.restrict,o=i.x-s.x,a=i.y-s.y,l=Math.max(r.x+o,Math.min(r.x+r.width+o-s.width,i.x+t)),c=Math.max(r.y+a,Math.min(r.y+r.height+a-s.height,i.y+e));t=l-i.x,e=c-i.y}const s={x:i.x+t,y:i.y+e};return n.tx=t,n.ty=e,n.transition?("object"!==typeof n.transition&&(n.transition={}),this.transition("position",s,Object.assign(Object.assign({},n.transition),{interp:vb.object})),this.eachChild(i=>{var s;const r=null===(s=n.exclude)||void 0===s?void 0:s.includes(i);r||i.translate(t,e,n)})):(this.startBatch("translate",n),this.store.set("position",s,n),this.eachChild(i=>{var s;const r=null===(s=n.exclude)||void 0===s?void 0:s.includes(i);r||i.translate(t,e,n)}),this.stopBatch("translate",n)),this}angle(t,e){return null==t?this.getAngle():this.rotate(t,e)}getAngle(){return this.store.get("angle",0)}rotate(t,e={}){const n=this.getAngle();if(e.center){const i=this.getSize(),s=this.getPosition(),r=this.getBBox().getCenter();r.rotate(n-t,e.center);const o=r.x-i.width/2-s.x,a=r.y-i.height/2-s.y;this.startBatch("rotate",{angle:t,options:e}),this.setPosition(s.x+o,s.y+a,e),this.rotate(t,Object.assign(Object.assign({},e),{center:null})),this.stopBatch("rotate")}else this.store.set("angle",e.absolute?t:(n+t)%360,e);return this}getBBox(t={}){if(t.deep){const t=this.getDescendants({deep:!0,breadthFirst:!0});return t.push(this),EE.getCellsBBox(t)}return Tb.fromPositionAndSize(this.getPosition(),this.getSize())}getConnectionPoint(t,e){const n=this.getBBox(),i=n.getCenter(),s=t.getTerminal(e);if(null==s)return i;const r=s.port;if(!r||!this.hasPort(r))return i;const o=this.getPort(r);if(!o||!o.group)return i;const a=this.getPortsPosition(o.group),l=a[r].position,c=Nb.create(l).translate(n.getOrigin()),h=this.getAngle();return h&&c.rotate(-h,i),c}fit(t={}){const e=this.getChildren()||[],n=e.filter(t=>t.isNode());if(0===n.length)return this;this.startBatch("fit-embeds",t),t.deep&&n.forEach(e=>e.fit(t));let{x:i,y:s,width:r,height:o}=EE.getCellsBBox(n);const a=wf(t.padding);return i-=a.left,s-=a.top,r+=a.left+a.right,o+=a.bottom+a.top,this.store.set({position:{x:i,y:s},size:{width:r,height:o}},t),this.stopBatch("fit-embeds"),this}get portContainerMarkup(){return this.getPortContainerMarkup()}set portContainerMarkup(t){this.setPortContainerMarkup(t)}getDefaultPortContainerMarkup(){return this.store.get("defaultPortContainerMarkup")||qw.getPortContainerMarkup()}getPortContainerMarkup(){return this.store.get("portContainerMarkup")||this.getDefaultPortContainerMarkup()}setPortContainerMarkup(t,e={}){return this.store.set("portContainerMarkup",qw.clone(t),e),this}get portMarkup(){return this.getPortMarkup()}set portMarkup(t){this.setPortMarkup(t)}getDefaultPortMarkup(){return this.store.get("defaultPortMarkup")||qw.getPortMarkup()}getPortMarkup(){return this.store.get("portMarkup")||this.getDefaultPortMarkup()}setPortMarkup(t,e={}){return this.store.set("portMarkup",qw.clone(t),e),this}get portLabelMarkup(){return this.getPortLabelMarkup()}set portLabelMarkup(t){this.setPortLabelMarkup(t)}getDefaultPortLabelMarkup(){return this.store.get("defaultPortLabelMarkup")||qw.getPortLabelMarkup()}getPortLabelMarkup(){return this.store.get("portLabelMarkup")||this.getDefaultPortLabelMarkup()}setPortLabelMarkup(t,e={}){return this.store.set("portLabelMarkup",qw.clone(t),e),this}get ports(){const t=this.store.get("ports",{items:[]});return null==t.items&&(t.items=[]),t}getPorts(){return yh(this.ports.items)}getPortsByGroup(t){return this.getPorts().filter(e=>e.group===t)}getPort(t){return yh(this.ports.items.find(e=>e.id&&e.id===t))}getPortAt(t){return this.ports.items[t]||null}hasPorts(){return this.ports.items.length>0}hasPort(t){return-1!==this.getPortIndex(t)}getPortIndex(t){const e="string"===typeof t?t:t.id;return null!=e?this.ports.items.findIndex(t=>t.id===e):-1}getPortsPosition(t){const e=this.getSize(),n=this.port.getPortsLayoutByGroup(t,new Tb(0,0,e.width,e.height));return n.reduce((t,e)=>{const n=e.portLayout;return t[e.portId]={position:Object.assign({},n.position),angle:n.angle||0},t},{})}getPortProp(t,e){return this.getPropByPath(this.prefixPortPath(t,e))}setPortProp(t,e,n,i){if("string"===typeof e||Array.isArray(e)){const s=this.prefixPortPath(t,e),r=n;return this.setPropByPath(s,r,i)}const s=this.prefixPortPath(t),r=e;return this.setPropByPath(s,r,n)}removePortProp(t,e,n){return"string"===typeof e||Array.isArray(e)?this.removePropByPath(this.prefixPortPath(t,e),n):this.removePropByPath(this.prefixPortPath(t),e)}portProp(t,e,n,i){return null==e?this.getPortProp(t):"string"===typeof e||Array.isArray(e)?2===arguments.length?this.getPortProp(t,e):null==n?this.removePortProp(t,e,i):this.setPortProp(t,e,n,i):this.setPortProp(t,e,n)}prefixPortPath(t,e){const n=this.getPortIndex(t);if(-1===n)throw new Error(`Unable to find port with id: "${t}"`);return null==e||""===e?["ports","items",`${n}`]:Array.isArray(e)?["ports","items",`${n}`,...e]:`ports/items/${n}/${e}`}addPort(t,e){const n=[...this.ports.items];return n.push(t),this.setPropByPath("ports/items",n,e),this}addPorts(t,e){return this.setPropByPath("ports/items",[...this.ports.items,...t],e),this}insertPort(t,e,n){const i=[...this.ports.items];return i.splice(t,0,e),this.setPropByPath("ports/items",i,n),this}removePort(t,e={}){return this.removePortAt(this.getPortIndex(t),e)}removePortAt(t,e={}){if(t>=0){const n=[...this.ports.items];n.splice(t,1),e.rewrite=!0,this.setPropByPath("ports/items",n,e)}return this}removePorts(t,e){let n;if(Array.isArray(t)){if(n=e||{},t.length){n.rewrite=!0;const e=[...this.ports.items],i=e.filter(e=>!t.some(t=>{const n="string"===typeof t?t:t.id;return e.id===n}));this.setPropByPath("ports/items",i,n)}}else n=t||{},n.rewrite=!0,this.setPropByPath("ports/items",[],n);return this}getParsedPorts(){return this.port.getPorts()}getParsedGroups(){return this.port.groups}getPortsLayoutByGroup(t,e){return this.port.getPortsLayoutByGroup(t,e)}initPorts(){this.updatePortData(),this.on("change:ports",()=>{this.processRemovedPort(),this.updatePortData()})}processRemovedPort(){const t=this.ports,e={};t.items.forEach(t=>{t.id&&(e[t.id]=!0)});const n={},i=this.store.getPrevious("ports")||{items:[]};i.items.forEach(t=>{t.id&&!e[t.id]&&(n[t.id]=!0)});const s=this.model;if(s&&!Ml(n)){const t=s.getConnectedEdges(this,{incoming:!0});t.forEach(t=>{const e=t.getTargetPortId();e&&n[e]&&t.remove()});const e=s.getConnectedEdges(this,{outgoing:!0});e.forEach(t=>{const e=t.getSourcePortId();e&&n[e]&&t.remove()})}}validatePorts(){const t={},e=[];return this.ports.items.forEach(n=>{"object"!==typeof n&&e.push(`Invalid port ${n}.`),null==n.id&&(n.id=this.generatePortId()),t[n.id]&&e.push("Duplicitied port id."),t[n.id]=!0}),e}generatePortId(){return cf()}updatePortData(){const t=this.validatePorts();if(t.length>0)throw this.store.set("ports",this.store.getPrevious("ports")),new Error(t.join(" "));const e=this.port?this.port.getPorts():null;this.port=new ME(this.ports);const n=this.port.getPorts(),i=e?n.filter(t=>e.find(e=>e.id===t.id)?null:t):[...n],s=e?e.filter(t=>n.find(e=>e.id===t.id)?null:t):[];i.length>0&&this.notify("ports:added",{added:i,cell:this,node:this}),s.length>0&&this.notify("ports:removed",{removed:s,cell:this,node:this})}}AE.defaults={angle:0,position:{x:0,y:0},size:{width:1,height:1}},function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNode&&"function"===typeof i.isEdge&&"function"===typeof i.prop&&"function"===typeof i.attr&&"function"===typeof i.size&&"function"===typeof i.position}t.toStringTag=`X6.${t.name}`,t.isNode=e}(AE||(AE={})),function(t){t.config({propHooks(t){var{ports:e}=t,n=OE(t,["ports"]);return e&&(n.ports=Array.isArray(e)?{items:e}:e),n}})}(AE||(AE={})),function(t){t.registry=ev.create({type:"node",process(e,n){if(wE.exist(e,!0))throw new Error(`Node with name '${e}' was registered by anthor Edge`);if("function"===typeof n)return n.config({shape:e}),n;let i=t;const{inherit:s}=n,r=OE(n,["inherit"]);if(s)if("string"===typeof s){const t=this.get(s);null==t?this.onNotFound(s,"inherited"):i=t}else i=s;null==r.constructorName&&(r.constructorName=e);const o=i.define.call(i,r);return o.config({shape:e}),o}}),wE.setNodeRegistry(t.registry)}(AE||(AE={})),function(t){let e=0;function n(t){return t?af(t):(e+=1,`CustomNode${e}`)}function i(e){const{constructorName:i,overwrite:s}=e,r=OE(e,["constructorName","overwrite"]),o=Lh(n(i||r.shape),this);return o.config(r),r.shape&&t.registry.register(r.shape,o,s),o}function s(e){const n=e.shape||"rect",i=t.registry.get(n);return i?new i(e):t.registry.onNotFound(n)}t.define=i,t.create=s}(AE||(AE={}));var SE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class NE extends EE{get[Symbol.toStringTag](){return NE.toStringTag}constructor(t={}){super(t)}preprocess(t,e){const{source:n,sourceCell:i,sourcePort:s,sourcePoint:r,target:o,targetCell:a,targetPort:l,targetPoint:c}=t,h=SE(t,["source","sourceCell","sourcePort","sourcePoint","target","targetCell","targetPort","targetPoint"]),u=h,d=t=>"string"===typeof t||"number"===typeof t;if(null!=n)if(EE.isCell(n))u.source={cell:n.id};else if(d(n))u.source={cell:n};else if(Nb.isPoint(n))u.source=n.toJSON();else if(Array.isArray(n))u.source={x:n[0],y:n[1]};else{const t=n.cell;EE.isCell(t)?u.source=Object.assign(Object.assign({},n),{cell:t.id}):u.source=n}if(null!=i||null!=s){let t=u.source;if(null!=i){const e=d(i)?i:i.id;t?t.cell=e:t=u.source={cell:e}}null!=s&&t&&(t.port=s)}else null!=r&&(u.source=Nb.create(r).toJSON());if(null!=o)if(EE.isCell(o))u.target={cell:o.id};else if(d(o))u.target={cell:o};else if(Nb.isPoint(o))u.target=o.toJSON();else if(Array.isArray(o))u.target={x:o[0],y:o[1]};else{const t=o.cell;EE.isCell(t)?u.target=Object.assign(Object.assign({},o),{cell:t.id}):u.target=o}if(null!=a||null!=l){let t=u.target;if(null!=a){const e=d(a)?a:a.id;t?t.cell=e:t=u.target={cell:e}}null!=l&&t&&(t.port=l)}else null!=c&&(u.target=Nb.create(c).toJSON());return super.preprocess(u,e)}setup(){super.setup(),this.on("change:labels",t=>this.onLabelsChanged(t)),this.on("change:vertices",t=>this.onVertexsChanged(t))}isEdge(){return!0}disconnect(t={}){return this.store.set({source:{x:0,y:0},target:{x:0,y:0}},t),this}get source(){return this.getSource()}set source(t){this.setSource(t)}getSource(){return this.getTerminal("source")}getSourceCellId(){return this.source.cell}getSourcePortId(){return this.source.port}setSource(t,e,n={}){return this.setTerminal("source",t,e,n)}get target(){return this.getTarget()}set target(t){this.setTarget(t)}getTarget(){return this.getTerminal("target")}getTargetCellId(){return this.target.cell}getTargetPortId(){return this.target.port}setTarget(t,e,n={}){return this.setTerminal("target",t,e,n)}getTerminal(t){return Object.assign({},this.store.get(t))}setTerminal(t,e,n,i={}){if(EE.isCell(e))return this.store.set(t,jo({},n,{cell:e.id}),i),this;const s=e;return Nb.isPoint(e)||null!=s.x&&null!=s.y?(this.store.set(t,jo({},n,{x:s.x,y:s.y}),i),this):(this.store.set(t,yh(e),i),this)}getSourcePoint(){return this.getTerminalPoint("source")}getTargetPoint(){return this.getTerminalPoint("target")}getTerminalPoint(t){const e=this[t];if(Nb.isPointLike(e))return Nb.create(e);const n=this.getTerminalCell(t);return n?n.getConnectionPoint(this,t):new Nb}getSourceCell(){return this.getTerminalCell("source")}getTargetCell(){return this.getTerminalCell("target")}getTerminalCell(t){if(this.model){const e="source"===t?this.getSourceCellId():this.getTargetCellId();if(e)return this.model.getCell(e)}return null}getSourceNode(){return this.getTerminalNode("source")}getTargetNode(){return this.getTerminalNode("target")}getTerminalNode(t){let e=this;const n={};while(e&&e.isEdge()){if(n[e.id])return null;n[e.id]=!0,e=e.getTerminalCell(t)}return e&&e.isNode()?e:null}get router(){return this.getRouter()}set router(t){null==t?this.removeRouter():this.setRouter(t)}getRouter(){return this.store.get("router")}setRouter(t,e,n){return"object"===typeof t?this.store.set("router",t,e):this.store.set("router",{name:t,args:e},n),this}removeRouter(t={}){return this.store.remove("router",t),this}get connector(){return this.getConnector()}set connector(t){null==t?this.removeConnector():this.setConnector(t)}getConnector(){return this.store.get("connector")}setConnector(t,e,n){return"object"===typeof t?this.store.set("connector",t,e):this.store.set("connector",{name:t,args:e},n),this}removeConnector(t={}){return this.store.remove("connector",t)}getDefaultLabel(){const t=this.constructor,e=this.store.get("defaultLabel")||t.defaultLabel||{};return yh(e)}get labels(){return this.getLabels()}set labels(t){this.setLabels(t)}getLabels(){return[...this.store.get("labels",[])].map(t=>this.parseLabel(t))}setLabels(t,e={}){return this.store.set("labels",Array.isArray(t)?t:[t],e),this}insertLabel(t,e,n={}){const i=this.getLabels(),s=i.length;let r=null!=e&&Number.isFinite(e)?e:s;return r<0&&(r=s+r+1),i.splice(r,0,this.parseLabel(t)),this.setLabels(i,n)}appendLabel(t,e={}){return this.insertLabel(t,-1,e)}getLabelAt(t){const e=this.getLabels();return null!=t&&Number.isFinite(t)?this.parseLabel(e[t]):null}setLabelAt(t,e,n={}){if(null!=t&&Number.isFinite(t)){const i=this.getLabels();i[t]=this.parseLabel(e),this.setLabels(i,n)}return this}removeLabelAt(t,e={}){const n=this.getLabels(),i=null!=t&&Number.isFinite(t)?t:-1,s=n.splice(i,1);return this.setLabels(n,e),s.length?s[0]:null}parseLabel(t){if("string"===typeof t){const e=this.constructor;return e.parseStringLabel(t)}return t}onLabelsChanged({previous:t,current:e}){const n=t&&e?e.filter(e=>t.find(t=>e===t||vl(e,t))?null:e):e?[...e]:[],i=t&&e?t.filter(t=>e.find(e=>t===e||vl(t,e))?null:t):t?[...t]:[];n.length>0&&this.notify("labels:added",{added:n,cell:this,edge:this}),i.length>0&&this.notify("labels:removed",{removed:i,cell:this,edge:this})}get vertices(){return this.getVertices()}set vertices(t){this.setVertices(t)}getVertices(){return[...this.store.get("vertices",[])]}setVertices(t,e={}){const n=Array.isArray(t)?t:[t];return this.store.set("vertices",n.map(t=>Nb.toJSON(t)),e),this}insertVertex(t,e,n={}){const i=this.getVertices(),s=i.length;let r=null!=e&&Number.isFinite(e)?e:s;return r<0&&(r=s+r+1),i.splice(r,0,Nb.toJSON(t)),this.setVertices(i,n)}appendVertex(t,e={}){return this.insertVertex(t,-1,e)}getVertexAt(t){if(null!=t&&Number.isFinite(t)){const e=this.getVertices();return e[t]}return null}setVertexAt(t,e,n={}){if(null!=t&&Number.isFinite(t)){const i=this.getVertices();i[t]=e,this.setVertices(i,n)}return this}removeVertexAt(t,e={}){const n=this.getVertices(),i=null!=t&&Number.isFinite(t)?t:-1;return n.splice(i,1),this.setVertices(n,e)}onVertexsChanged({previous:t,current:e}){const n=t&&e?e.filter(e=>t.find(t=>Nb.equals(e,t))?null:e):e?[...e]:[],i=t&&e?t.filter(t=>e.find(e=>Nb.equals(t,e))?null:t):t?[...t]:[];n.length>0&&this.notify("vertexs:added",{added:n,cell:this,edge:this}),i.length>0&&this.notify("vertexs:removed",{removed:i,cell:this,edge:this})}getDefaultMarkup(){return this.store.get("defaultMarkup")||qw.getEdgeMarkup()}getMarkup(){return super.getMarkup()||this.getDefaultMarkup()}translate(t,e,n={}){return n.translateBy=n.translateBy||this.id,n.tx=t,n.ty=e,this.applyToPoints(n=>({x:(n.x||0)+t,y:(n.y||0)+e}),n)}scale(t,e,n,i={}){return this.applyToPoints(i=>Nb.create(i).scale(t,e,n).toJSON(),i)}applyToPoints(t,e={}){const n={},i=this.getSource(),s=this.getTarget();Nb.isPointLike(i)&&(n.source=t(i)),Nb.isPointLike(s)&&(n.target=t(s));const r=this.getVertices();return r.length>0&&(n.vertices=r.map(t)),this.store.set(n,e),this}getBBox(){return this.getPolyline().bbox()}getConnectionPoint(){return this.getPolyline().pointAt(.5)}getPolyline(){const t=[this.getSourcePoint(),...this.getVertices().map(t=>Nb.create(t)),this.getTargetPoint()];return new $b(t)}updateParent(t){let e=null;const n=this.getSourceCell(),i=this.getTargetCell(),s=this.getParent();return n&&i&&(e=n===i||n.isDescendantOf(i)?i:i.isDescendantOf(n)?n:EE.getCommonAncestor(n,i)),s&&e&&e.id!==s.id&&s.unembed(this,t),!e||s&&s.id===e.id||e.embed(this,t),e}hasLoop(t={}){const e=this.getSource(),n=this.getTarget(),i=e.cell,s=n.cell;if(!i||!s)return!1;let r=i===s;if(!r&&t.deep&&this._model){const e=this.getSourceCell(),n=this.getTargetCell();e&&n&&(r=e.isAncestorOf(n,t)||n.isAncestorOf(e,t))}return r}getFragmentAncestor(){const t=[this,this.getSourceNode(),this.getTargetNode()].filter(t=>null!=t);return this.getCommonAncestor(...t)}isFragmentDescendantOf(t){const e=this.getFragmentAncestor();return!!e&&(e.id===t.id||e.isDescendantOf(t))}}NE.defaults={},function(t){function e(t,e){const n=t,i=e;return n.cell===i.cell&&(n.port===i.port||null==n.port&&null==i.port)}t.equalTerminals=e}(NE||(NE={})),function(t){function e(t){return{attrs:{label:{text:t}}}}t.defaultLabel={markup:[{tagName:"rect",selector:"body"},{tagName:"text",selector:"label"}],attrs:{text:{fill:"#000",fontSize:14,textAnchor:"middle",textVerticalAnchor:"middle",pointerEvents:"none"},rect:{ref:"label",fill:"#fff",rx:3,ry:3,refWidth:1,refHeight:1,refX:0,refY:0}},position:{distance:.5}},t.parseStringLabel=e}(NE||(NE={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNode&&"function"===typeof i.isEdge&&"function"===typeof i.prop&&"function"===typeof i.attr&&"function"===typeof i.disconnect&&"function"===typeof i.getSource&&"function"===typeof i.getTarget}t.toStringTag=`X6.${t.name}`,t.isEdge=e}(NE||(NE={})),function(t){t.registry=ev.create({type:"edge",process(e,n){if(wE.exist(e,!1))throw new Error(`Edge with name '${e}' was registered by anthor Node`);if("function"===typeof n)return n.config({shape:e}),n;let i=t;const{inherit:s="edge"}=n,r=SE(n,["inherit"]);if("string"===typeof s){const t=this.get(s||"edge");null==t&&s?this.onNotFound(s,"inherited"):i=t}else i=s;null==r.constructorName&&(r.constructorName=e);const o=i.define.call(i,r);return o.config({shape:e}),o}}),wE.setEdgeRegistry(t.registry)}(NE||(NE={})),function(t){let e=0;function n(t){return t?af(t):(e+=1,`CustomEdge${e}`)}function i(e){const{constructorName:i,overwrite:s}=e,r=SE(e,["constructorName","overwrite"]),o=Lh(n(i||r.shape),this);return o.config(r),r.shape&&t.registry.register(r.shape,o,s),o}function s(e){const n=e.shape||"edge",i=t.registry.get(n);return i?new i(e):t.registry.onNotFound(n)}t.define=i,t.create=s}(NE||(NE={})),function(t){const e="basic.edge";t.config({shape:e,propHooks(e){const{label:n,vertices:i}=e,s=SE(e,["label","vertices"]);if(n){null==s.labels&&(s.labels=[]);const e="string"===typeof n?t.parseStringLabel(n):n;s.labels.push(e)}return i&&Array.isArray(i)&&(s.vertices=i.map(t=>Nb.create(t).toJSON())),s}}),t.registry.register(e,t)}(NE||(NE={}));var TE=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class kE extends Hh{constructor(t,e={}){super(),this.length=0,this.comparator=e.comparator||"zIndex",this.clean(),t&&this.reset(t,{silent:!0})}toJSON(){return this.cells.map(t=>t.toJSON())}add(t,e,n){let i,s;"number"===typeof e?(i=e,s=Object.assign({merge:!1},n)):(i=this.length,s=Object.assign({merge:!1},e)),i>this.length&&(i=this.length),i<0&&(i+=this.length+1);const r=Array.isArray(t)?t:[t],o=this.comparator&&"number"!==typeof e&&!1!==s.sort,a=this.comparator||null;let l=!1;const c=[],h=[];return r.forEach(t=>{const e=this.get(t);e?s.merge&&!t.isSameStore(e)&&(e.setProp(t.getProp(),n),h.push(e),o&&!l&&(l=null==a||"function"===typeof a?e.hasChanged():"string"===typeof a?e.hasChanged(a):a.some(t=>e.hasChanged(t)))):(c.push(t),this.reference(t))}),c.length&&(o&&(l=!0),this.cells.splice(i,0,...c),this.length=this.cells.length),l&&this.sort({silent:!0}),s.silent||(c.forEach((t,e)=>{const n={cell:t,index:i+e,options:s};this.trigger("added",n),s.dryrun||t.notify("added",Object.assign({},n))}),l&&this.trigger("sorted"),(c.length||h.length)&&this.trigger("updated",{added:c,merged:h,removed:[],options:s})),this}remove(t,e={}){const n=Array.isArray(t)?t:[t],i=this.removeCells(n,e);return!e.silent&&i.length>0&&this.trigger("updated",{options:e,removed:i,added:[],merged:[]}),Array.isArray(t)?i:i[0]}removeCells(t,e){const n=[];for(let i=0;i<t.length;i+=1){const s=this.get(t[i]);if(null==s)continue;const r=this.cells.indexOf(s);this.cells.splice(r,1),this.length-=1,delete this.map[s.id],n.push(s),this.unreference(s),e.dryrun||s.remove(),e.silent||(this.trigger("removed",{cell:s,index:r,options:e}),e.dryrun||s.notify("removed",{cell:s,index:r,options:e}))}return n}reset(t,e={}){const n=this.cells.slice();if(n.forEach(t=>this.unreference(t)),this.clean(),this.add(t,Object.assign({silent:!0},e)),!e.silent){const t=this.cells.slice();this.trigger("reseted",{options:e,previous:n,current:t});const i=[],s=[];t.forEach(t=>{const e=n.some(e=>e.id===t.id);e||i.push(t)}),n.forEach(e=>{const n=t.some(t=>t.id===e.id);n||s.push(e)}),this.trigger("updated",{options:e,added:i,removed:s,merged:[]})}return this}push(t,e){return this.add(t,this.length,e)}pop(t){const e=this.at(this.length-1);return this.remove(e,t)}unshift(t,e){return this.add(t,0,e)}shift(t){const e=this.at(0);return this.remove(e,t)}get(t){if(null==t)return null;const e="string"===typeof t||"number"===typeof t?t:t.id;return this.map[e]||null}has(t){return null!=this.get(t)}at(t){return t<0&&(t+=this.length),this.cells[t]||null}first(){return this.at(0)}last(){return this.at(-1)}indexOf(t){return this.cells.indexOf(t)}toArray(){return this.cells.slice()}sort(t={}){return null!=this.comparator&&(this.cells=bd(this.cells,this.comparator),t.silent||this.trigger("sorted")),this}clone(){const t=this.constructor;return new t(this.cells.slice(),{comparator:this.comparator})}reference(t){this.map[t.id]=t,t.on("*",this.notifyCellEvent,this)}unreference(t){t.off("*",this.notifyCellEvent,this),delete this.map[t.id]}notifyCellEvent(t,e){const n=e.cell;this.trigger(`cell:${t}`,e),n&&(n.isNode()?this.trigger(`node:${t}`,Object.assign(Object.assign({},e),{node:n})):n.isEdge()&&this.trigger(`edge:${t}`,Object.assign(Object.assign({},e),{edge:n})))}clean(){this.length=0,this.cells=[],this.map={}}dispose(){this.reset([])}}TE([kE.dispose()],kE.prototype,"dispose",null);var jE=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class LE extends Hh{get[Symbol.toStringTag](){return LE.toStringTag}constructor(t=[]){super(),this.batches={},this.addings=new WeakMap,this.nodes={},this.edges={},this.outgoings={},this.incomings={},this.collection=new kE(t),this.setup()}notify(t,e){this.trigger(t,e);const n=this.graph;return n&&("sorted"===t||"reseted"===t||"updated"===t?n.trigger(`model:${t}`,e):n.trigger(t,e)),this}setup(){const t=this.collection;t.on("sorted",()=>this.notify("sorted",null)),t.on("updated",t=>this.notify("updated",t)),t.on("cell:change:zIndex",()=>this.sortOnChangeZ()),t.on("added",({cell:t})=>{this.onCellAdded(t)}),t.on("removed",t=>{const e=t.cell;this.onCellRemoved(e,t.options),this.notify("cell:removed",t),e.isNode()?this.notify("node:removed",Object.assign(Object.assign({},t),{node:e})):e.isEdge()&&this.notify("edge:removed",Object.assign(Object.assign({},t),{edge:e}))}),t.on("reseted",t=>{this.onReset(t.current),this.notify("reseted",t)}),t.on("edge:change:source",({edge:t})=>this.onEdgeTerminalChanged(t,"source")),t.on("edge:change:target",({edge:t})=>{this.onEdgeTerminalChanged(t,"target")})}sortOnChangeZ(){this.collection.sort()}onCellAdded(t){const e=t.id;t.isEdge()?(t.updateParent(),this.edges[e]=!0,this.onEdgeTerminalChanged(t,"source"),this.onEdgeTerminalChanged(t,"target")):this.nodes[e]=!0}onCellRemoved(t,e){const n=t.id;if(t.isEdge()){delete this.edges[n];const e=t.getSource(),i=t.getTarget();if(e&&e.cell){const t=this.outgoings[e.cell],i=t?t.indexOf(n):-1;i>=0&&(t.splice(i,1),0===t.length&&delete this.outgoings[e.cell])}if(i&&i.cell){const t=this.incomings[i.cell],e=t?t.indexOf(n):-1;e>=0&&(t.splice(e,1),0===t.length&&delete this.incomings[i.cell])}}else delete this.nodes[n];e.clear||(e.disconnectEdges?this.disconnectConnectedEdges(t,e):this.removeConnectedEdges(t,e)),t.model===this&&(t.model=null)}onReset(t){this.nodes={},this.edges={},this.outgoings={},this.incomings={},t.forEach(t=>this.onCellAdded(t))}onEdgeTerminalChanged(t,e){const n="source"===e?this.outgoings:this.incomings,i=t.previous(e);if(i&&i.cell){const e=EE.isCell(i.cell)?i.cell.id:i.cell,s=n[e],r=s?s.indexOf(t.id):-1;r>=0&&(s.splice(r,1),0===s.length&&delete n[e])}const s=t.getTerminal(e);if(s&&s.cell){const e=EE.isCell(s.cell)?s.cell.id:s.cell,i=n[e]||[],r=i.indexOf(t.id);-1===r&&i.push(t.id),n[e]=i}}prepareCell(t,e){return t.model||e&&e.dryrun||(t.model=this),null==t.zIndex&&t.setZIndex(this.getMaxZIndex()+1,{silent:!0}),t}resetCells(t,e={}){return t.map(t=>this.prepareCell(t,Object.assign(Object.assign({},e),{dryrun:!0}))),this.collection.reset(t,e),t.map(t=>this.prepareCell(t,{options:e})),this}clear(t={}){const e=this.getCells();if(0===e.length)return this;const n=Object.assign(Object.assign({},t),{clear:!0});return this.batchUpdate("clear",()=>{const t=e.sort((t,e)=>{const n=t.isEdge()?1:2,i=e.isEdge()?1:2;return n-i});while(t.length>0){const e=t.shift();e&&e.remove(n)}},n),this}addNode(t,e={}){const n=AE.isNode(t)?t:this.createNode(t);return this.addCell(n,e),n}updateNode(t,e={}){const n=this.createNode(t),i=n.getProp();return n.dispose(),this.updateCell(i,e)}createNode(t){return AE.create(t)}addEdge(t,e={}){const n=NE.isEdge(t)?t:this.createEdge(t);return this.addCell(n,e),n}createEdge(t){return NE.create(t)}updateEdge(t,e={}){const n=this.createEdge(t),i=n.getProp();return n.dispose(),this.updateCell(i,e)}addCell(t,e={}){return Array.isArray(t)?this.addCells(t,e):(this.collection.has(t)||this.addings.has(t)||(this.addings.set(t,!0),this.collection.add(this.prepareCell(t,e),e),t.eachChild(t=>this.addCell(t,e)),this.addings.delete(t)),this)}addCells(t,e={}){const n=t.length;if(0===n)return this;const i=Object.assign(Object.assign({},e),{position:n-1,maxPosition:n-1});return this.startBatch("add",Object.assign(Object.assign({},i),{cells:t})),t.forEach(t=>{this.addCell(t,i),i.position-=1}),this.stopBatch("add",Object.assign(Object.assign({},i),{cells:t})),this}updateCell(t,e={}){const n=t.id&&this.getCell(t.id);return!!n&&this.batchUpdate("update",()=>(Object.entries(t).forEach(([t,i])=>n.setProp(t,i,e)),!0),t)}removeCell(t,e={}){const n="string"===typeof t?this.getCell(t):t;return n&&this.has(n)?this.collection.remove(n,e):null}updateCellId(t,e){if(t.id===e)return;this.startBatch("update",{id:e}),t.prop("id",e);const n=t.clone({keepId:!0});this.addCell(n);const i=this.getConnectedEdges(t);return i.forEach(n=>{const i=n.getSourceCell(),s=n.getTargetCell();i===t&&n.setSource(Object.assign(Object.assign({},n.getSource()),{cell:e})),s===t&&n.setTarget(Object.assign(Object.assign({},n.getTarget()),{cell:e}))}),this.removeCell(t),this.stopBatch("update",{id:e}),n}removeCells(t,e={}){return t.length?this.batchUpdate("remove",()=>t.map(t=>this.removeCell(t,e))):[]}removeConnectedEdges(t,e={}){const n=this.getConnectedEdges(t);return n.forEach(t=>{t.remove(e)}),n}disconnectConnectedEdges(t,e={}){const n="string"===typeof t?t:t.id;this.getConnectedEdges(t).forEach(t=>{const i=t.getSourceCellId(),s=t.getTargetCellId();i===n&&t.setSource({x:0,y:0},e),s===n&&t.setTarget({x:0,y:0},e)})}has(t){return this.collection.has(t)}total(){return this.collection.length}indexOf(t){return this.collection.indexOf(t)}getCell(t){return this.collection.get(t)}getCells(){return this.collection.toArray()}getFirstCell(){return this.collection.first()}getLastCell(){return this.collection.last()}getMinZIndex(){const t=this.collection.first();return t&&t.getZIndex()||0}getMaxZIndex(){const t=this.collection.last();return t&&t.getZIndex()||0}getCellsFromCache(t){return t?Object.keys(t).map(t=>this.getCell(t)).filter(t=>null!=t):[]}getNodes(){return this.getCellsFromCache(this.nodes)}getEdges(){return this.getCellsFromCache(this.edges)}getOutgoingEdges(t){const e="string"===typeof t?t:t.id,n=this.outgoings[e];return n?n.map(t=>this.getCell(t)).filter(t=>t&&t.isEdge()):null}getIncomingEdges(t){const e="string"===typeof t?t:t.id,n=this.incomings[e];return n?n.map(t=>this.getCell(t)).filter(t=>t&&t.isEdge()):null}getConnectedEdges(t,e={}){const n=[],i="string"===typeof t?this.getCell(t):t;if(null==i)return n;const s={},r=e.indirect;let o=e.incoming,a=e.outgoing;null==o&&null==a&&(o=a=!0);const l=(t,e)=>{const i=e?this.getOutgoingEdges(t):this.getIncomingEdges(t);if(null!=i&&i.forEach(t=>{s[t.id]||(n.push(t),s[t.id]=!0,r&&(o&&l(t,!1),a&&l(t,!0)))}),r&&t.isEdge()){const i=e?t.getTargetCell():t.getSourceCell();i&&i.isEdge()&&(s[i.id]||(n.push(i),l(i,e)))}};if(a&&l(i,!0),o&&l(i,!1),e.deep){const t=i.getDescendants({deep:!0}),r={};t.forEach(t=>{t.isNode()&&(r[t.id]=!0)});const l=(t,i)=>{const o=i?this.getOutgoingEdges(t.id):this.getIncomingEdges(t.id);null!=o&&o.forEach(t=>{if(!s[t.id]){const i=t.getSourceCell(),o=t.getTargetCell();if(!e.enclosed&&i&&r[i.id]&&o&&r[o.id])return;n.push(t),s[t.id]=!0}})};t.forEach(t=>{t.isEdge()||(a&&l(t,!0),o&&l(t,!1))})}return n}isBoundary(t,e){const n="string"===typeof t?this.getCell(t):t,i=e?this.getIncomingEdges(n):this.getOutgoingEdges(n);return null==i||0===i.length}getBoundaryNodes(t){const e=[];return Object.keys(this.nodes).forEach(n=>{if(this.isBoundary(n,t)){const t=this.getCell(n);t&&e.push(t)}}),e}getRoots(){return this.getBoundaryNodes(!0)}getLeafs(){return this.getBoundaryNodes(!1)}isRoot(t){return this.isBoundary(t,!0)}isLeaf(t){return this.isBoundary(t,!1)}getNeighbors(t,e={}){let n=e.incoming,i=e.outgoing;null==n&&null==i&&(n=i=!0);const s=this.getConnectedEdges(t,e),r=s.reduce((s,r)=>{const o=r.hasLoop(e),a=r.getSourceCell(),l=r.getTargetCell();return n&&a&&a.isNode()&&!s[a.id]&&(!o&&(a===t||e.deep&&a.isDescendantOf(t))||(s[a.id]=a)),i&&l&&l.isNode()&&!s[l.id]&&(!o&&(l===t||e.deep&&l.isDescendantOf(t))||(s[l.id]=l)),s},{});if(t.isEdge()){if(n){const e=t.getSourceCell();e&&e.isNode()&&!r[e.id]&&(r[e.id]=e)}if(i){const e=t.getTargetCell();e&&e.isNode()&&!r[e.id]&&(r[e.id]=e)}}return Object.keys(r).map(t=>r[t])}isNeighbor(t,e,n={}){let i=n.incoming,s=n.outgoing;return null==i&&null==s&&(i=s=!0),this.getConnectedEdges(t,n).some(t=>{const n=t.getSourceCell(),r=t.getTargetCell();return!(!i||!n||n.id!==e.id)||!(!s||!r||r.id!==e.id)})}getSuccessors(t,e={}){const n=[];return this.search(t,(i,s)=>{i!==t&&this.matchDistance(s,e.distance)&&n.push(i)},Object.assign(Object.assign({},e),{outgoing:!0})),n}isSuccessor(t,e,n={}){let i=!1;return this.search(t,(s,r)=>{if(s===e&&s!==t&&this.matchDistance(r,n.distance))return i=!0,!1},Object.assign(Object.assign({},n),{outgoing:!0})),i}getPredecessors(t,e={}){const n=[];return this.search(t,(i,s)=>{i!==t&&this.matchDistance(s,e.distance)&&n.push(i)},Object.assign(Object.assign({},e),{incoming:!0})),n}isPredecessor(t,e,n={}){let i=!1;return this.search(t,(s,r)=>{if(s===e&&s!==t&&this.matchDistance(r,n.distance))return i=!0,!1},Object.assign(Object.assign({},n),{incoming:!0})),i}matchDistance(t,e){return null==e||("function"===typeof e?e(t):!(!Array.isArray(e)||!e.includes(t))||t===e)}getCommonAncestor(...t){const e=[];return t.forEach(t=>{t&&(Array.isArray(t)?e.push(...t):e.push(t))}),EE.getCommonAncestor(...e)}getSubGraph(t,e={}){const n=[],i={},s=[],r=[],o=t=>{i[t.id]||(n.push(t),i[t.id]=t,t.isEdge()&&r.push(t),t.isNode()&&s.push(t))};return t.forEach(t=>{if(o(t),e.deep){const e=t.getDescendants({deep:!0});e.forEach(t=>o(t))}}),r.forEach(t=>{const e=t.getSourceCell(),r=t.getTargetCell();e&&!i[e.id]&&(n.push(e),i[e.id]=e,e.isNode()&&s.push(e)),r&&!i[r.id]&&(n.push(r),i[r.id]=r,r.isNode()&&s.push(r))}),s.forEach(t=>{const s=this.getConnectedEdges(t,e);s.forEach(t=>{const e=t.getSourceCell(),s=t.getTargetCell();!i[t.id]&&e&&i[e.id]&&s&&i[s.id]&&(n.push(t),i[t.id]=t)})}),n}cloneSubGraph(t,e={}){const n=this.getSubGraph(t,e);return this.cloneCells(n)}cloneCells(t){return EE.cloneCells(t)}getNodesFromPoint(t,e){const n="number"===typeof t?{x:t,y:e||0}:t;return this.getNodes().filter(t=>t.getBBox().containsPoint(n))}getNodesInArea(t,e,n,i,s){const r="number"===typeof t?new Tb(t,e,n,i):Tb.create(t),o="number"===typeof t?s:e,a=o&&o.strict;return this.getNodes().filter(t=>{const e=t.getBBox();return a?r.containsRect(e):r.isIntersectWithRect(e)})}getEdgesInArea(t,e,n,i,s){const r="number"===typeof t?new Tb(t,e,n,i):Tb.create(t),o="number"===typeof t?s:e,a=o&&o.strict;return this.getEdges().filter(t=>{const e=t.getBBox();return 0===e.width?e.inflate(1,0):0===e.height&&e.inflate(0,1),a?r.containsRect(e):r.isIntersectWithRect(e)})}getNodesUnderNode(t,e={}){const n=t.getBBox(),i=null==e.by||"bbox"===e.by?this.getNodesInArea(n):this.getNodesFromPoint(n[e.by]);return i.filter(e=>t.id!==e.id&&!e.isDescendantOf(t))}getAllCellsBBox(){return this.getCellsBBox(this.getCells())}getCellsBBox(t,e={}){return EE.getCellsBBox(t,e)}search(t,e,n={}){n.breadthFirst?this.breadthFirstSearch(t,e,n):this.depthFirstSearch(t,e,n)}breadthFirstSearch(t,e,n={}){const i=[],s={},r={};i.push(t),r[t.id]=0;while(i.length>0){const t=i.shift();if(null==t||s[t.id])continue;if(s[t.id]=!0,!1===Pt(e,this,t,r[t.id]))continue;const o=this.getNeighbors(t,n);o.forEach(e=>{r[e.id]=r[t.id]+1,i.push(e)})}}depthFirstSearch(t,e,n={}){const i=[],s={},r={};i.push(t),r[t.id]=0;while(i.length>0){const t=i.pop();if(null==t||s[t.id])continue;if(s[t.id]=!0,!1===Pt(e,this,t,r[t.id]))continue;const o=this.getNeighbors(t,n),a=i.length;o.forEach(e=>{r[e.id]=r[t.id]+1,i.splice(a,0,e)})}}getShortestPath(t,e,n={}){const i={};this.getEdges().forEach(t=>{const e=t.getSourceCellId(),s=t.getTargetCellId();e&&s&&(i[e]||(i[e]=[]),i[s]||(i[s]=[]),i[e].push(s),n.directed||i[s].push(e))});const s="string"===typeof t?t:t.id,r=mb.run(i,s,n.weight),o=[];let a="string"===typeof e?e:e.id;r[a]&&o.push(a);while(a=r[a])o.unshift(a);return o}translate(t,e,n){return this.getCells().filter(t=>!t.hasParent()).forEach(i=>i.translate(t,e,n)),this}resize(t,e,n){return this.resizeCells(t,e,this.getCells(),n)}resizeCells(t,e,n,i={}){const s=this.getCellsBBox(n);if(s){const r=Math.max(t/s.width,0),o=Math.max(e/s.height,0),a=s.getOrigin();n.forEach(t=>t.scale(r,o,a,i))}return this}toJSON(t={}){return LE.toJSON(this.getCells(),t)}parseJSON(t){return LE.fromJSON(t)}fromJSON(t,e={}){const n=this.parseJSON(t);return this.resetCells(n,e),this}startBatch(t,e={}){return this.batches[t]=(this.batches[t]||0)+1,this.notify("batch:start",{name:t,data:e}),this}stopBatch(t,e={}){return this.batches[t]=(this.batches[t]||0)-1,this.notify("batch:stop",{name:t,data:e}),this}batchUpdate(t,e,n={}){this.startBatch(t,n);const i=e();return this.stopBatch(t,n),i}hasActiveBatch(t=Object.keys(this.batches)){const e=Array.isArray(t)?t:[t];return e.some(t=>this.batches[t]>0)}dispose(){this.collection.dispose()}}jE([LE.dispose()],LE.prototype,"dispose",null),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.addNode&&"function"===typeof i.addEdge&&null!=i.collection}t.toStringTag=`X6.${t.name}`,t.isModel=e}(LE||(LE={})),function(t){function e(t,e={}){return{cells:t.map(t=>t.toJSON(e))}}function n(t){const e=[];return Array.isArray(t)?e.push(...t):(t.cells&&e.push(...t.cells),t.nodes&&t.nodes.forEach(t=>{null==t.shape&&(t.shape="rect"),e.push(t)}),t.edges&&t.edges.forEach(t=>{null==t.shape&&(t.shape="edge"),e.push(t)})),e.map(t=>{const e=t.shape;if(e){if(AE.registry.exist(e))return AE.create(t);if(NE.registry.exist(e))return NE.create(t)}throw new Error("The `shape` should be specified when creating a node/edge instance")})}t.toJSON=e,t.fromJSON=n}(LE||(LE={}));var DE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class BE extends AE{get label(){return this.getLabel()}set label(t){this.setLabel(t)}getLabel(){return this.getAttrByPath("text/text")}setLabel(t,e){return null==t?this.removeLabel():this.setAttrByPath("text/text",t,e),this}removeLabel(){return this.removeAttrByPath("text/text"),this}}(function(t){t.bodyAttr={fill:"#ffffff",stroke:"#333333",strokeWidth:2},t.labelAttr={fontSize:14,fill:"#000000",refX:.5,refY:.5,textAnchor:"middle",textVerticalAnchor:"middle",fontFamily:"Arial, helvetica, sans-serif"},t.config({attrs:{text:Object.assign({},t.labelAttr)},propHooks(t){const{label:e}=t,n=DE(t,["label"]);return e&&$h(n,"attrs/text/text",e),n},visible:!0})})(BE||(BE={}));var IE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};function RE(t,e="body"){return[{tagName:t,selector:e},{tagName:"text",selector:"label"}]}function VE(t="xlink:href"){const e=e=>{const{imageUrl:n,imageWidth:i,imageHeight:s}=e,r=IE(e,["imageUrl","imageWidth","imageHeight"]);if(null!=n||null!=i||null!=s){const e=()=>{if(r.attrs){const e=r.attrs.image;null!=n&&(e[t]=n),null!=i&&(e.width=i),null!=s&&(e.height=s),r.attrs.image=e}};r.attrs?(null==r.attrs.image&&(r.attrs.image={}),e()):(r.attrs={image:{}},e())}return r};return e}function zE(t,e,n={}){const i={constructorName:t,markup:RE(t,n.selector),attrs:{[t]:Object.assign({},BE.bodyAttr)}},s=n.parent||BE;return s.define(jo(i,e,{shape:t}))}const $E=zE("rect",{attrs:{body:{refWidth:"100%",refHeight:"100%"}}}),FE=NE.define({shape:"edge",markup:[{tagName:"path",selector:"wrap",groupSelector:"lines",attrs:{fill:"none",cursor:"pointer",stroke:"transparent",strokeLinecap:"round"}},{tagName:"path",selector:"line",groupSelector:"lines",attrs:{fill:"none",pointerEvents:"none"}}],attrs:{lines:{connection:!0,strokeLinejoin:"round"},wrap:{strokeWidth:10},line:{stroke:"#333",strokeWidth:2,targetMarker:"classic"}}});zE("ellipse",{attrs:{body:{refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%"}}});var GE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class _E extends BE{get points(){return this.getPoints()}set points(t){this.setPoints(t)}getPoints(){return this.getAttrByPath("body/refPoints")}setPoints(t,e){return null==t?this.removePoints():this.setAttrByPath("body/refPoints",_E.pointsToString(t),e),this}removePoints(){return this.removeAttrByPath("body/refPoints"),this}}(function(t){function e(t){return"string"===typeof t?t:t.map(t=>Array.isArray(t)?t.join(","):Nb.isPointLike(t)?`${t.x}, ${t.y}`:"").join(" ")}t.pointsToString=e,t.config({propHooks(t){const{points:n}=t,i=GE(t,["points"]);if(n){const t=e(n);t&&$h(i,"attrs/body/refPoints",t)}return i}})})(_E||(_E={}));zE("polygon",{},{parent:_E}),zE("polyline",{},{parent:_E});var HE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};BE.define({shape:"path",markup:[{tagName:"rect",selector:"bg"},{tagName:"path",selector:"body"},{tagName:"text",selector:"label"}],attrs:{bg:{refWidth:"100%",refHeight:"100%",fill:"none",stroke:"none",pointerEvents:"all"},body:{fill:"none",stroke:"#000",strokeWidth:2}},propHooks(t){const{path:e}=t,n=HE(t,["path"]);return e&&$h(n,"attrs/body/refD",e),n}});var UE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};BE.define({shape:"text-block",markup:[{tagName:"rect",selector:"body"},Vf.SUPPORT_FOREIGNOBJECT?{tagName:"foreignObject",selector:"foreignObject",children:[{tagName:"div",ns:Zf.xhtml,selector:"label",style:{width:"100%",height:"100%",position:"static",backgroundColor:"transparent",textAlign:"center",margin:0,padding:"0px 5px",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center"}}]}:{tagName:"text",selector:"label",attrs:{textAnchor:"middle"}}],attrs:{body:Object.assign(Object.assign({},BE.bodyAttr),{refWidth:"100%",refHeight:"100%"}),foreignObject:{refWidth:"100%",refHeight:"100%"},label:{style:{fontSize:14}}},propHooks(t){const{text:e}=t,n=UE(t,["text"]);return e&&$h(n,"attrs/label/text",e),n},attrHooks:{text:{set(t,{cell:e,view:n,refBBox:i,elem:s,attrs:r}){if(!(s instanceof HTMLElement)){const o=r.style||{},a={text:t,width:-5,height:"100%"},l=Object.assign({textVerticalAnchor:"middle"},o),c=iw.presets.textWrap;return Pt(c.set,this,a,{cell:e,view:n,elem:s,refBBox:i,attrs:l}),{fill:o.color||null}}s.textContent=t},position(t,{refBBox:e,elem:n}){if(n instanceof SVGElement)return e.getCenter()}}}}),zE("image",{attrs:{image:{refWidth:"100%",refHeight:"100%"}},propHooks:VE()},{selector:"image"}),zE("circle",{attrs:{body:{refCx:"50%",refCy:"50%",refR:"50%"}}});class JE extends eC{constructor(){super(...arguments),this.portsCache={}}get[Symbol.toStringTag](){return JE.toStringTag}getContainerClassName(){const t=[super.getContainerClassName(),this.prefixClassName("node")];return this.can("nodeMovable")||t.push(this.prefixClassName("node-immovable")),t.join(" ")}updateClassName(t){const e=t.target;if(e.hasAttribute("magnet")){const t=this.prefixClassName("port-unconnectable");this.can("magnetConnectable")?Uf(e,t):Hf(e,t)}else{const t=this.prefixClassName("node-immovable");this.can("nodeMovable")?this.removeClass(t):this.addClass(t)}}isNodeView(){return!0}confirmUpdate(t,e={}){let n=t;return this.hasAction(n,"ports")&&(this.removePorts(),this.cleanPortsCache()),this.hasAction(n,"render")?(this.render(),n=this.removeAction(n,["render","update","resize","translate","rotate","ports","tools"])):(n=this.handleAction(n,"resize",()=>this.resize(),"update"),n=this.handleAction(n,"update",()=>this.update(),sw.useCSSSelector?"ports":null),n=this.handleAction(n,"translate",()=>this.translate()),n=this.handleAction(n,"rotate",()=>this.rotate()),n=this.handleAction(n,"ports",()=>this.renderPorts()),n=this.handleAction(n,"tools",()=>{this.getFlag("tools")===t?this.renderTools():this.updateTools(e)})),n}update(t){this.cleanCache(),sw.useCSSSelector&&this.removePorts();const e=this.cell,n=e.getSize(),i=e.getAttrs();this.updateAttrs(this.container,i,{attrs:t===i?null:t,rootBBox:new Tb(0,0,n.width,n.height),selectors:this.selectors}),sw.useCSSSelector&&this.renderPorts()}renderMarkup(){const t=this.cell.markup;if(t){if("string"===typeof t)throw new TypeError("Not support string markup.");return this.renderJSONMarkup(t)}throw new TypeError("Invalid node markup.")}renderJSONMarkup(t){const e=this.parseJSONMarkup(t,this.container);this.selectors=e.selectors,this.container.appendChild(e.fragment)}render(){return this.empty(),this.renderMarkup(),this.resize(),this.updateTransform(),sw.useCSSSelector||this.renderPorts(),this.renderTools(),this}resize(){this.cell.getAngle()&&this.rotate(),this.update()}translate(){this.updateTransform()}rotate(){this.updateTransform()}getTranslationString(){const t=this.cell.getPosition();return`translate(${t.x},${t.y})`}getRotationString(){const t=this.cell.getAngle();if(t){const e=this.cell.getSize();return`rotate(${t},${e.width/2},${e.height/2})`}}updateTransform(){let t=this.getTranslationString();const e=this.getRotationString();e&&(t+=` ${e}`),this.container.setAttribute("transform",t)}findPortElem(t,e){const n=t?this.portsCache[t]:null;if(!n)return null;const i=n.portContentElement,s=n.portContentSelectors||{};return this.findOne(e,i,s)}cleanPortsCache(){this.portsCache={}}removePorts(){Object.values(this.portsCache).forEach(t=>{hm(t.portElement)})}renderPorts(){const t=this.container,e=[];t.childNodes.forEach(t=>{e.push(t)});const n=this.cell.getParsedPorts(),i=Sd(n,"zIndex"),s="auto";i[s]&&i[s].forEach(n=>{const i=this.getPortElement(n);t.append(i),e.push(i)}),Object.keys(i).forEach(t=>{if(t!==s){const n=parseInt(t,10);this.appendPorts(i[t],n,e)}}),this.updatePorts()}appendPorts(t,e,n){const i=t.map(t=>this.getPortElement(t));n[e]||e<0?pm(n[Math.max(e,0)],i):dm(this.container,i)}getPortElement(t){const e=this.portsCache[t.id];return e?e.portElement:this.createPortElement(t)}createPortElement(t){let e=qw.renderMarkup(this.cell.getPortContainerMarkup());const n=e.elem;if(null==n)throw new Error("Invalid port container markup.");e=qw.renderMarkup(this.getPortMarkup(t));const i=e.elem,s=e.selectors;if(null==i)throw new Error("Invalid port markup.");this.setAttrs({port:t.id,"port-group":t.group},i);let r="x6-port";t.group&&(r+=` x6-port-${t.group}`),Hf(n,r),Hf(n,"x6-port"),Hf(i,"x6-port-body"),n.appendChild(i);let o,a,l=s;const c=this.existPortLabel(t);if(c){if(e=qw.renderMarkup(this.getPortLabelMarkup(t.label)),o=e.elem,a=e.selectors,null==o)throw new Error("Invalid port label markup.");if(s&&a){for(const t in a)if(s[t]&&t!==this.rootSelector)throw new Error("Selectors within port must be unique.");l=Object.assign(Object.assign({},s),a)}Hf(o,"x6-port-label"),n.appendChild(o)}return this.portsCache[t.id]={portElement:n,portSelectors:l,portLabelElement:o,portLabelSelectors:a,portContentElement:i,portContentSelectors:s},this.graph.options.onPortRendered&&this.graph.options.onPortRendered({port:t,node:this.cell,container:n,selectors:l,labelContainer:o,labelSelectors:a,contentContainer:i,contentSelectors:s}),n}updatePorts(){const t=this.cell.getParsedGroups(),e=Object.keys(t);0===e.length?this.updatePortGroup():e.forEach(t=>this.updatePortGroup(t))}updatePortGroup(t){const e=Tb.fromSize(this.cell.getSize()),n=this.cell.getPortsLayoutByGroup(t,e);for(let i=0,s=n.length;i<s;i+=1){const t=n[i],e=t.portId,s=this.portsCache[e]||{},r=t.portLayout;if(this.applyPortTransform(s.portElement,r),null!=t.portAttrs){const e={selectors:s.portSelectors||{}};t.portSize&&(e.rootBBox=Tb.fromSize(t.portSize)),this.updateAttrs(s.portElement,t.portAttrs,e)}const o=t.labelLayout;if(o&&s.portLabelElement&&(this.applyPortTransform(s.portLabelElement,o,-(r.angle||0)),o.attrs)){const e={selectors:s.portLabelSelectors||{}};t.labelSize&&(e.rootBBox=Tb.fromSize(t.labelSize)),this.updateAttrs(s.portLabelElement,o.attrs,e)}}}applyPortTransform(t,e,n=0){const i=e.angle,s=e.position,r=Dy().rotate(n).translate(s.x||0,s.y||0).rotate(i||0);Hy(t,r,{absolute:!0})}getPortMarkup(t){return t.markup||this.cell.portMarkup}getPortLabelMarkup(t){return t.markup||this.cell.portLabelMarkup}existPortLabel(t){return t.attrs&&t.attrs.text}getEventArgs(t,e,n){const i=this,s=i.cell,r=s;return null==e||null==n?{e:t,view:i,node:s,cell:r}:{e:t,x:e,y:n,view:i,node:s,cell:r}}getPortEventArgs(t,e,n){const i=this,s=i.cell,r=s;return n?{e:t,x:n.x,y:n.y,view:i,node:s,cell:r,port:e}:{e:t,view:i,node:s,cell:r,port:e}}notifyMouseDown(t,e,n){super.onMouseDown(t,e,n),this.notify("node:mousedown",this.getEventArgs(t,e,n))}notifyMouseMove(t,e,n){super.onMouseMove(t,e,n),this.notify("node:mousemove",this.getEventArgs(t,e,n))}notifyMouseUp(t,e,n){super.onMouseUp(t,e,n),this.notify("node:mouseup",this.getEventArgs(t,e,n))}notifyPortEvent(t,e,n){const i=this.findAttr("port",e.target);if(i){const s=e.type;"node:port:mouseenter"===t?e.type="mouseenter":"node:port:mouseleave"===t&&(e.type="mouseleave"),this.notify(t,this.getPortEventArgs(e,i,n)),e.type=s}}onClick(t,e,n){super.onClick(t,e,n),this.notify("node:click",this.getEventArgs(t,e,n)),this.notifyPortEvent("node:port:click",t,{x:e,y:n})}onDblClick(t,e,n){super.onDblClick(t,e,n),this.notify("node:dblclick",this.getEventArgs(t,e,n)),this.notifyPortEvent("node:port:dblclick",t,{x:e,y:n})}onContextMenu(t,e,n){super.onContextMenu(t,e,n),this.notify("node:contextmenu",this.getEventArgs(t,e,n)),this.notifyPortEvent("node:port:contextmenu",t,{x:e,y:n})}onMouseDown(t,e,n){this.isPropagationStopped(t)||(this.notifyMouseDown(t,e,n),this.notifyPortEvent("node:port:mousedown",t,{x:e,y:n}),this.startNodeDragging(t,e,n))}onMouseMove(t,e,n){const i=this.getEventData(t),s=i.action;if("magnet"===s)this.dragMagnet(t,e,n);else{if("move"===s){const s=i,r=s.targetView||this;r.dragNode(t,e,n),r.notify("node:moving",{e:t,x:e,y:n,view:r,cell:r.cell,node:r.cell})}this.notifyMouseMove(t,e,n),this.notifyPortEvent("node:port:mousemove",t,{x:e,y:n})}this.setEventData(t,i)}onMouseUp(t,e,n){const i=this.getEventData(t),s=i.action;if("magnet"===s)this.stopMagnetDragging(t,e,n);else if(this.notifyMouseUp(t,e,n),this.notifyPortEvent("node:port:mouseup",t,{x:e,y:n}),"move"===s){const s=i,r=s.targetView||this;r.stopNodeDragging(t,e,n)}const r=i.targetMagnet;r&&this.onMagnetClick(t,r,e,n),this.checkMouseleave(t)}onMouseOver(t){super.onMouseOver(t),this.notify("node:mouseover",this.getEventArgs(t)),this.notifyPortEvent("node:port:mouseenter",t),this.notifyPortEvent("node:port:mouseover",t)}onMouseOut(t){super.onMouseOut(t),this.notify("node:mouseout",this.getEventArgs(t)),this.notifyPortEvent("node:port:mouseleave",t),this.notifyPortEvent("node:port:mouseout",t)}onMouseEnter(t){this.updateClassName(t),super.onMouseEnter(t),this.notify("node:mouseenter",this.getEventArgs(t))}onMouseLeave(t){super.onMouseLeave(t),this.notify("node:mouseleave",this.getEventArgs(t))}onMouseWheel(t,e,n,i){super.onMouseWheel(t,e,n,i),this.notify("node:mousewheel",Object.assign({delta:i},this.getEventArgs(t,e,n)))}onMagnetClick(t,e,n,i){const s=this.graph,r=s.view.getMouseMovedCount(t);r>s.options.clickThreshold||this.notify("node:magnet:click",Object.assign({magnet:e},this.getEventArgs(t,n,i)))}onMagnetDblClick(t,e,n,i){this.notify("node:magnet:dblclick",Object.assign({magnet:e},this.getEventArgs(t,n,i)))}onMagnetContextMenu(t,e,n,i){this.notify("node:magnet:contextmenu",Object.assign({magnet:e},this.getEventArgs(t,n,i)))}onMagnetMouseDown(t,e,n,i){this.startMagnetDragging(t,n,i)}onCustomEvent(t,e,n,i){this.notify("node:customevent",Object.assign({name:e},this.getEventArgs(t,n,i))),super.onCustomEvent(t,e,n,i)}prepareEmbedding(t){const e=this.graph,n=this.getEventData(t),i=n.cell||this.cell,s=e.findViewByCell(i),r=e.snapToGrid(t.clientX,t.clientY);this.notify("node:embed",{e:t,node:i,view:s,cell:i,x:r.x,y:r.y,currentParent:i.getParent()})}processEmbedding(t,e){const n=e.cell||this.cell,i=e.graph||this.graph,s=i.options.embedding,r=s.findParent;let o="function"===typeof r?Pt(r,i,{view:this,node:this.cell}).filter(t=>EE.isCell(t)&&this.cell.id!==t.id&&!t.isDescendantOf(this.cell)):i.model.getNodesUnderNode(n,{by:r});if(s.frontOnly&&o.length>0){const t=Sd(o,"zIndex"),e=zd(Object.keys(t).map(t=>parseInt(t,10)));e&&(o=t[e])}o=o.filter(t=>t.visible);let a=null;const l=e.candidateEmbedView,c=s.validate;for(let u=o.length-1;u>=0;u-=1){const t=o[u];if(l&&l.cell.id===t.id){a=l;break}{const e=t.findView(i);if(c&&Pt(c,i,{child:this.cell,parent:e.cell,childView:this,parentView:e})){a=e;break}}}this.clearEmbedding(e),a&&a.highlight(null,{type:"embedding"}),e.candidateEmbedView=a;const h=i.snapToGrid(t.clientX,t.clientY);this.notify("node:embedding",{e:t,cell:n,node:n,view:i.findViewByCell(n),x:h.x,y:h.y,currentParent:n.getParent(),candidateParent:a?a.cell:null})}clearEmbedding(t){const e=t.candidateEmbedView;e&&(e.unhighlight(null,{type:"embedding"}),t.candidateEmbedView=null)}finalizeEmbedding(t,e){this.graph.startBatch("embedding");const n=e.cell||this.cell,i=e.graph||this.graph,s=i.findViewByCell(n),r=n.getParent(),o=e.candidateEmbedView;if(o?(o.unhighlight(null,{type:"embedding"}),e.candidateEmbedView=null,null!=r&&r.id===o.cell.id||o.cell.insertChild(n,void 0,{ui:!0})):r&&r.unembed(n,{ui:!0}),i.model.getConnectedEdges(n,{deep:!0}).forEach(t=>{t.updateParent({ui:!0})}),s&&o){const e=i.snapToGrid(t.clientX,t.clientY);s.notify("node:embedded",{e:t,cell:n,x:e.x,y:e.y,node:n,view:i.findViewByCell(n),previousParent:r,currentParent:n.getParent()})}this.graph.stopBatch("embedding")}getDelegatedView(){let t=this.cell,e=this;while(e){if(t.isEdge())break;if(!t.hasParent()||e.can("stopDelegateOnDragging"))return e;t=t.getParent(),e=this.graph.findViewByCell(t)}return null}validateMagnet(t,e,n){if("passive"!==e.getAttribute("magnet")){const i=this.graph.options.connecting.validateMagnet;return!i||Pt(i,this.graph,{e:n,magnet:e,view:t,cell:t.cell})}return!1}startMagnetDragging(t,e,n){if(!this.can("magnetConnectable"))return;t.stopPropagation();const i=t.currentTarget,s=this.graph;this.setEventData(t,{targetMagnet:i}),this.validateMagnet(this,i,t)?(s.options.magnetThreshold<=0&&this.startConnectting(t,i,e,n),this.setEventData(t,{action:"magnet"}),this.stopPropagation(t)):this.onMouseDown(t,e,n),s.view.delegateDragEvents(t,this)}startConnectting(t,e,n,i){this.graph.model.startBatch("add-edge");const s=this.createEdgeFromMagnet(e,n,i);s.setEventData(t,s.prepareArrowheadDragging("target",{x:n,y:i,isNewEdge:!0,fallbackAction:"remove"})),this.setEventData(t,{edgeView:s}),s.notifyMouseDown(t,n,i)}getDefaultEdge(t,e){let n;const i=this.graph.options.connecting.createEdge;return i&&(n=Pt(i,this.graph,{sourceMagnet:e,sourceView:t,sourceCell:t.cell})),n}createEdgeFromMagnet(t,e,n){const i=this.graph,s=i.model,r=this.getDefaultEdge(this,t);return r.setSource(Object.assign(Object.assign({},r.getSource()),this.getEdgeTerminal(t,e,n,r,"source"))),r.setTarget(Object.assign(Object.assign({},r.getTarget()),{x:e,y:n})),r.addTo(s,{async:!1,ui:!0}),r.findView(i)}dragMagnet(t,e,n){const i=this.getEventData(t),s=i.edgeView;if(s)s.onMouseMove(t,e,n),this.autoScrollGraph(t.clientX,t.clientY);else{const s=this.graph,r=s.options.magnetThreshold,o=this.getEventTarget(t),a=i.targetMagnet;if("onleave"===r){if(a===o||a.contains(o))return}else if(s.view.getMouseMovedCount(t)<=r)return;this.startConnectting(t,a,e,n)}}stopMagnetDragging(t,e,n){const i=this.eventData(t),s=i.edgeView;s&&(s.onMouseUp(t,e,n),this.graph.model.stopBatch("add-edge"))}notifyUnhandledMouseDown(t,e,n){this.notify("node:unhandled:mousedown",{e:t,x:e,y:n,view:this,cell:this.cell,node:this.cell})}notifyNodeMove(t,e,n,i,s){let r=[s];const o=this.graph.getPlugin("selection");if(o&&o.isSelectionMovable()){const t=o.getSelectedCells();t.includes(s)&&(r=t.filter(t=>t.isNode()))}r.forEach(s=>{this.notify(t,{e:e,x:n,y:i,cell:s,node:s,view:s.findView(this.graph)})})}getRestrictArea(t){const e=this.graph.options.translating.restrict,n="function"===typeof e?Pt(e,this.graph,t):e;return"number"===typeof n?this.graph.transform.getGraphArea().inflate(n):!0===n?this.graph.transform.getGraphArea():n||null}startNodeDragging(t,e,n){const i=this.getDelegatedView();if(null==i||!i.can("nodeMovable"))return this.notifyUnhandledMouseDown(t,e,n);this.setEventData(t,{targetView:i,action:"move"});const s=Nb.create(i.cell.getPosition());i.setEventData(t,{moving:!1,offset:s.diff(e,n),restrict:this.getRestrictArea(i)})}dragNode(t,e,n){const i=this.cell,s=this.graph,r=s.getGridSize(),o=this.getEventData(t),a=o.offset,l=o.restrict;o.moving||(o.moving=!0,this.addClass("node-moving"),this.notifyNodeMove("node:move",t,e,n,this.cell)),this.autoScrollGraph(t.clientX,t.clientY);const c=Ab.snapToGrid(e+a.x,r),h=Ab.snapToGrid(n+a.y,r);i.setPosition(c,h,{restrict:l,deep:!0,ui:!0}),s.options.embedding.enabled&&(o.embedding||(this.prepareEmbedding(t),o.embedding=!0),this.processEmbedding(t,o))}autoOffsetNode(){const t=this.cell,e=this.graph,n=Object.assign({id:t.id},t.getPosition()),i=e.getNodes(),s=i.map(t=>{const e=t.getPosition();return{id:t.id,x:e.x,y:e.y}}).filter(t=>t.id!==n.id),r=[[1,1],[1,-1],[-1,1],[-1,-1]];let o=e.getGridSize();const a=t=>s.some(e=>e.x===t.x&&e.y===t.y);while(a(n)){let i=!1;for(let e=0;e<r.length;e+=1){const s=r[e],l={x:n.x+s[0]*o,y:n.y+s[1]*o};if(!a(l)){t.translate(s[0]*o,s[1]*o),i=!0;break}}if(i)break;o+=e.getGridSize()}}stopNodeDragging(t,e,n){const i=this.getEventData(t),s=this.graph;if(i.embedding&&this.finalizeEmbedding(t,i),i.moving){const i=s.options.translating.autoOffset;i&&this.autoOffsetNode(),this.removeClass("node-moving"),this.notifyNodeMove("node:moved",t,e,n,this.cell)}i.moving=!1,i.embedding=!1}autoScrollGraph(t,e){const n=this.graph.getPlugin("scroller");n&&n.autoScroll(t,e)}}(function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNodeView&&"function"===typeof i.isEdgeView&&"function"===typeof i.confirmUpdate&&"function"===typeof i.update&&"function"===typeof i.findPortElem&&"function"===typeof i.resize&&"function"===typeof i.rotate&&"function"===typeof i.translate}t.toStringTag=`X6.${t.name}`,t.isNodeView=e})(JE||(JE={})),JE.config({isSvgElement:!0,priority:0,bootstrap:["render"],actions:{view:["render"],markup:["render"],attrs:["update"],size:["resize","ports","tools"],angle:["rotate","tools"],position:["translate","tools"],ports:["ports"],tools:["tools"]}}),JE.registry.register("node",JE,!0);var qE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class WE extends eC{constructor(){super(...arguments),this.POINT_ROUNDING=2,this.labelDestroyFn={}}get[Symbol.toStringTag](){return WE.toStringTag}getContainerClassName(){return[super.getContainerClassName(),this.prefixClassName("edge")].join(" ")}get sourceBBox(){const t=this.sourceView;if(!t){const t=this.cell.getSource();return new Tb(t.x,t.y)}const e=this.sourceMagnet;return t.isEdgeElement(e)?new Tb(this.sourceAnchor.x,this.sourceAnchor.y):t.getBBoxOfElement(e||t.container)}get targetBBox(){const t=this.targetView;if(!t){const t=this.cell.getTarget();return new Tb(t.x,t.y)}const e=this.targetMagnet;return t.isEdgeElement(e)?new Tb(this.targetAnchor.x,this.targetAnchor.y):t.getBBoxOfElement(e||t.container)}isEdgeView(){return!0}confirmUpdate(t,e={}){let n=t;if(this.hasAction(n,"source")){if(!this.updateTerminalProperties("source"))return n;n=this.removeAction(n,"source")}if(this.hasAction(n,"target")){if(!this.updateTerminalProperties("target"))return n;n=this.removeAction(n,"target")}return this.hasAction(n,"render")?(this.render(),n=this.removeAction(n,["render","update","labels","tools"]),n):(n=this.handleAction(n,"update",()=>this.update(e)),n=this.handleAction(n,"labels",()=>this.onLabelsChange(e)),n=this.handleAction(n,"tools",()=>this.renderTools()),n)}render(){return this.empty(),this.renderMarkup(),this.labelContainer=null,this.renderLabels(),this.update(),this.renderTools(),this}renderMarkup(){const t=this.cell.markup;if(t){if("string"===typeof t)throw new TypeError("Not support string markup.");return this.renderJSONMarkup(t)}throw new TypeError("Invalid edge markup.")}renderJSONMarkup(t){const e=this.parseJSONMarkup(t,this.container);this.selectors=e.selectors,this.container.append(e.fragment)}customizeLabels(){if(this.labelContainer){const t=this.cell,e=t.labels;for(let n=0,i=e.length;n<i;n+=1){const i=e[n],s=this.labelCache[n],r=this.labelSelectors[n],o=this.graph.options.onEdgeLabelRendered;if(o){const e=o({edge:t,label:i,container:s,selectors:r});e&&(this.labelDestroyFn[n]=e)}}}}destroyCustomizeLabels(){const t=this.cell.labels;if(this.labelCache&&this.labelSelectors&&this.labelDestroyFn)for(let e=0,n=t.length;e<n;e+=1){const n=this.labelDestroyFn[e],i=this.labelCache[e],s=this.labelSelectors[e];n&&i&&s&&n({edge:this.cell,label:t[e],container:i,selectors:s})}this.labelDestroyFn={}}renderLabels(){const t=this.cell,e=t.getLabels(),n=e.length;let i=this.labelContainer;if(this.labelCache={},this.labelSelectors={},n<=0)return i&&i.parentNode&&i.parentNode.removeChild(i),this;i?this.empty(i):(i=em("g"),this.addClass(this.prefixClassName("edge-labels"),i),this.labelContainer=i);for(let s=0,r=e.length;s<r;s+=1){const n=e[s],r=this.normalizeLabelMarkup(this.parseLabelMarkup(n.markup));let o,a;if(r)o=r.node,a=r.selectors;else{const e=t.getDefaultLabel(),n=this.normalizeLabelMarkup(this.parseLabelMarkup(e.markup));o=n.node,a=n.selectors}o.setAttribute("data-index",`${s}`),i.appendChild(o);const l=this.rootSelector;if(a[l])throw new Error("Ambiguous label root selector.");a[l]=o,this.labelCache[s]=o,this.labelSelectors[s]=a}return null==i.parentNode&&this.container.appendChild(i),this.updateLabels(),this.customizeLabels(),this}onLabelsChange(t={}){this.destroyCustomizeLabels(),this.shouldRerenderLabels(t)?this.renderLabels():this.updateLabels(),this.updateLabelPositions()}shouldRerenderLabels(t={}){const e=this.cell.previous("labels");if(null==e)return!0;if("propertyPathArray"in t&&"propertyValue"in t){const n=t.propertyPathArray||[],i=n.length;if(i>1){const s=n[1];if(e[s]){if(2===i)return"object"===typeof t.propertyValue&&ri(t.propertyValue,"markup");if("markup"!==n[2])return!1}}}return!0}parseLabelMarkup(t){return t?"string"===typeof t?this.parseLabelStringMarkup(t):this.parseJSONMarkup(t):null}parseLabelStringMarkup(t){const e=ry.createVectors(t),n=document.createDocumentFragment();for(let i=0,s=e.length;i<s;i+=1){const t=e[i].node;n.appendChild(t)}return{fragment:n,selectors:{}}}normalizeLabelMarkup(t){if(null==t)return;const e=t.fragment;if(!(e instanceof DocumentFragment)||!e.hasChildNodes())throw new Error("Invalid label markup.");let n;const i=e.childNodes;return n=i.length>1||"G"!==i[0].nodeName.toUpperCase()?ry.create("g").append(e):ry.create(i[0]),n.addClass(this.prefixClassName("edge-label")),{node:n.node,selectors:t.selectors}}updateLabels(){if(this.labelContainer){const t=this.cell,e=t.labels,n=this.can("edgeLabelMovable"),i=t.getDefaultLabel();for(let s=0,r=e.length;s<r;s+=1){const t=this.labelCache[s],r=this.labelSelectors[s];t.setAttribute("cursor",n?"move":"default");const o=e[s],a=jo({},i.attrs,o.attrs);this.updateAttrs(t,a,{selectors:r,rootBBox:o.size?Tb.fromSize(o.size):void 0})}}}renderTools(){const t=this.cell.getTools();return this.addTools(t),this}update(t={}){this.cleanCache(),this.updateConnection(t);const e=this.cell.getAttrs(),{text:n}=e,i=qE(e,["text"]);return null!=i&&this.updateAttrs(this.container,i,{selectors:this.selectors}),this.updateLabelPositions(),this.updateTools(t),this}removeRedundantLinearVertices(t={}){const e=this.cell,n=e.getVertices(),i=[this.sourceAnchor,...n,this.targetAnchor],s=i.length,r=new $b(i);r.simplify({threshold:.01});const o=r.points.map(t=>t.toJSON()),a=o.length;return s===a?0:(e.setVertices(o.slice(1,a-1),t),s-a)}getTerminalView(t){switch(t){case"source":return this.sourceView||null;case"target":return this.targetView||null;default:throw new Error(`Unknown terminal type '${t}'`)}}getTerminalAnchor(t){switch(t){case"source":return Nb.create(this.sourceAnchor);case"target":return Nb.create(this.targetAnchor);default:throw new Error(`Unknown terminal type '${t}'`)}}getTerminalConnectionPoint(t){switch(t){case"source":return Nb.create(this.sourcePoint);case"target":return Nb.create(this.targetPoint);default:throw new Error(`Unknown terminal type '${t}'`)}}getTerminalMagnet(t,e={}){switch(t){case"source":{if(e.raw)return this.sourceMagnet;const t=this.sourceView;return t?this.sourceMagnet||t.container:null}case"target":{if(e.raw)return this.targetMagnet;const t=this.targetView;return t?this.targetMagnet||t.container:null}default:throw new Error(`Unknown terminal type '${t}'`)}}updateConnection(t={}){const e=this.cell;if(t.translateBy&&e.isFragmentDescendantOf(t.translateBy)){const e=t.tx||0,n=t.ty||0;this.routePoints=new $b(this.routePoints).translate(e,n).points,this.translateConnectionPoints(e,n),this.path.translate(e,n)}else{const t=e.getVertices(),n=this.findAnchors(t);this.sourceAnchor=n.source,this.targetAnchor=n.target,this.routePoints=this.findRoutePoints(t);const i=this.findConnectionPoints(this.routePoints,this.sourceAnchor,this.targetAnchor);this.sourcePoint=i.source,this.targetPoint=i.target;const s=this.findMarkerPoints(this.routePoints,this.sourcePoint,this.targetPoint);this.path=this.findPath(this.routePoints,s.source||this.sourcePoint,s.target||this.targetPoint)}this.cleanCache()}findAnchors(t){const e=this.cell,n=e.source,i=e.target,s=t[0],r=t[t.length-1];return i.priority&&!n.priority?this.findAnchorsOrdered("target",r,"source",s):this.findAnchorsOrdered("source",s,"target",r)}findAnchorsOrdered(t,e,n,i){let s,r;const o=this.cell,a=o[t],l=o[n],c=this.getTerminalView(t),h=this.getTerminalView(n),u=this.getTerminalMagnet(t),d=this.getTerminalMagnet(n);if(c){let n;n=e?Nb.create(e):h?d:Nb.create(l),s=this.getAnchor(a.anchor,c,u,n,t)}else s=Nb.create(a);if(h){const t=Nb.create(i||s);r=this.getAnchor(l.anchor,h,d,t,n)}else r=Nb.isPointLike(l)?Nb.create(l):new Nb;return{[t]:s,[n]:r}}getAnchor(t,e,n,i,s){const r=e.isEdgeElement(n),o=this.graph.options.connecting;let a,l="string"===typeof t?{name:t}:t;if(!l){const t=r?("source"===s?o.sourceEdgeAnchor:o.targetEdgeAnchor)||o.edgeAnchor:("source"===s?o.sourceAnchor:o.targetAnchor)||o.anchor;l="string"===typeof t?{name:t}:t}if(!l)throw new Error("Anchor should be specified.");const c=l.name;if(r){const t=QC.registry.get(c);if("function"!==typeof t)return QC.registry.onNotFound(c);a=Pt(t,this,e,n,i,l.args||{},s)}else{const t=JC.registry.get(c);if("function"!==typeof t)return JC.registry.onNotFound(c);a=Pt(t,this,e,n,i,l.args||{},s)}return a?a.round(this.POINT_ROUNDING):new Nb}findRoutePoints(t=[]){const e=this.graph.options.connecting.router||QP.presets.normal,n=this.cell.getRouter()||e;let i;if("function"===typeof n)i=Pt(n,this,t,{},this);else{const e="string"===typeof n?n:n.name,s="string"===typeof n?{}:n.args||{},r=e?QP.registry.get(e):QP.presets.normal;if("function"!==typeof r)return QP.registry.onNotFound(e);i=Pt(r,this,t,s,this)}return null==i?t.map(t=>Nb.create(t)):i.map(t=>Nb.create(t))}findConnectionPoints(t,e,n){const i=this.cell,s=this.graph.options.connecting,r=i.getSource(),o=i.getTarget(),a=this.sourceView,l=this.targetView,c=t[0],h=t[t.length-1];let u,d;if(a&&!a.isEdgeElement(this.sourceMagnet)){const t=this.sourceMagnet||a.container,i=c||n,o=new kb(i,e),l=r.connectionPoint||s.sourceConnectionPoint||s.connectionPoint;u=this.getConnectionPoint(l,a,t,o,"source")}else u=e;if(l&&!l.isEdgeElement(this.targetMagnet)){const t=this.targetMagnet||l.container,i=o.connectionPoint||s.targetConnectionPoint||s.connectionPoint,r=h||e,a=new kb(r,n);d=this.getConnectionPoint(i,l,t,a,"target")}else d=n;return{source:u,target:d}}getConnectionPoint(t,e,n,i,s){const r=i.end;if(null==t)return r;const o="string"===typeof t?t:t.name,a="string"===typeof t?{}:t.args,l=lP.registry.get(o);if("function"!==typeof l)return lP.registry.onNotFound(o);const c=Pt(l,this,i,e,n,a||{},s);return c?c.round(this.POINT_ROUNDING):r}findMarkerPoints(t,e,n){const i=t=>{const e=this.cell.getAttrs(),n=Object.keys(e);for(let i=0,s=n.length;i<s;i+=1){const s=e[n[i]];if(s[`${t}Marker`]||s[`${t}-marker`]){const t=s.strokeWidth||s["stroke-width"];if(t)return parseFloat(t);break}}return null},s=t[0],r=t[t.length-1];let o,a;const l=i("source");l&&(o=e.clone().move(s||n,-l));const c=i("target");return c&&(a=n.clone().move(r||e,-c)),this.sourceMarkerPoint=o||e.clone(),this.targetMarkerPoint=a||n.clone(),{source:o,target:a}}findPath(t,e,n){const i=this.cell.getConnector()||this.graph.options.connecting.connector;let s,r,o;if("string"===typeof i?s=i:(s=i.name,r=i.args),s){const t=yE.registry.get(s);if("function"!==typeof t)return yE.registry.onNotFound(s);o=t}else o=yE.presets.normal;const a=Pt(o,this,e,n,t,Object.assign(Object.assign({},r),{raw:!0}),this);return"string"===typeof a?tv.parse(a):a}translateConnectionPoints(t,e){this.sourcePoint.translate(t,e),this.targetPoint.translate(t,e),this.sourceAnchor.translate(t,e),this.targetAnchor.translate(t,e),this.sourceMarkerPoint.translate(t,e),this.targetMarkerPoint.translate(t,e)}updateLabelPositions(){if(null==this.labelContainer)return this;const t=this.path;if(!t)return this;const e=this.cell,n=e.getLabels();if(0===n.length)return this;const i=e.getDefaultLabel(),s=this.normalizeLabelPosition(i.position);for(let r=0,o=n.length;r<o;r+=1){const t=n[r],e=this.labelCache[r];if(!e)continue;const i=this.normalizeLabelPosition(t.position),o=jo({},s,i),a=this.getLabelTransformationMatrix(o);e.setAttribute("transform",Ry(a))}return this}updateTerminalProperties(t){const e=this.cell,n=this.graph,i=e[t],s=i&&i.cell,r=`${t}View`;if(!s)return this[r]=null,this.updateTerminalMagnet(t),!0;const o=n.getCellById(s);if(!o)throw new Error(`Edge's ${t} node with id "${s}" not exists`);const a=o.findView(n);return!!a&&(this[r]=a,this.updateTerminalMagnet(t),!0)}updateTerminalMagnet(t){const e=`${t}Magnet`,n=this.getTerminalView(t);if(n){let i=n.getMagnetFromEdgeTerminal(this.cell[t]);i===n.container&&(i=null),this[e]=i}else this[e]=null}getLabelPositionAngle(t){const e=this.cell.getLabelAt(t);return e&&e.position&&"object"===typeof e.position&&e.position.angle||0}getLabelPositionArgs(t){const e=this.cell.getLabelAt(t);if(e&&e.position&&"object"===typeof e.position)return e.position.options}getDefaultLabelPositionArgs(){const t=this.cell.getDefaultLabel();if(t&&t.position&&"object"===typeof t.position)return t.position.options}mergeLabelPositionArgs(t,e){return null===t?null:void 0===t?null===e?null:e:jo({},e,t)}getConnection(){return null!=this.path?this.path.clone():null}getConnectionPathData(){if(null==this.path)return"";const t=this.cache.pathCache;return ri(t,"data")||(t.data=this.path.serialize()),t.data||""}getConnectionSubdivisions(){if(null==this.path)return null;const t=this.cache.pathCache;return ri(t,"segmentSubdivisions")||(t.segmentSubdivisions=this.path.getSegmentSubdivisions()),t.segmentSubdivisions}getConnectionLength(){if(null==this.path)return 0;const t=this.cache.pathCache;return ri(t,"length")||(t.length=this.path.length({segmentSubdivisions:this.getConnectionSubdivisions()})),t.length}getPointAtLength(t){return null==this.path?null:this.path.pointAtLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getPointAtRatio(t){return null==this.path?null:(vf(t)&&(t=parseFloat(t)/100),this.path.pointAt(t,{segmentSubdivisions:this.getConnectionSubdivisions()}))}getTangentAtLength(t){return null==this.path?null:this.path.tangentAtLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getTangentAtRatio(t){return null==this.path?null:this.path.tangentAt(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPoint(t){return null==this.path?null:this.path.closestPoint(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointLength(t){return null==this.path?null:this.path.closestPointLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointRatio(t){return null==this.path?null:this.path.closestPointNormalizedLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getLabelPosition(t,e,n,i){const s={distance:0};let r,o=0;"number"===typeof n?(o=n,r=i):r=n,null!=r&&(s.options=r);const a=r&&r.absoluteOffset,l=!(r&&r.absoluteDistance),c=r&&r.absoluteDistance&&r.reverseDistance,h=this.path,u={segmentSubdivisions:this.getConnectionSubdivisions()},d=new Nb(t,e),g=h.closestPointT(d,u),p=this.getConnectionLength()||0;let f,m,y=h.lengthAtT(g,u);if(l&&(y=p>0?y/p:0),c&&(y=-1*(p-y)||1),s.distance=y,a||(f=h.tangentAtT(g)),f)m=f.pointOffset(d);else{const t=h.pointAtT(g),e=d.diff(t);m={x:e.x,y:e.y}}return s.offset=m,s.angle=o,s}normalizeLabelPosition(t){return"number"===typeof t?{distance:t}:t}getLabelTransformationMatrix(t){const e=this.normalizeLabelPosition(t),n=e.options||{},i=e.angle||0,s=e.distance,r=s>0&&s<=1;let o=0;const a={x:0,y:0},l=e.offset;l&&("number"===typeof l?o=l:(null!=l.x&&(a.x=l.x),null!=l.y&&(a.y=l.y)));const c=0!==a.x||0!==a.y||0===o,h=n.keepGradient,u=n.ensureLegibility,d=this.path,g={segmentSubdivisions:this.getConnectionSubdivisions()},p=r?s*this.getConnectionLength():s,f=d.tangentAtLength(p,g);let m,y=i;if(f){if(c)m=f.start,m.translate(a);else{const t=f.clone();t.rotate(-90,f.start),t.setLength(o),m=t.end}h&&(y=f.angle()+i,u&&(y=Ob.normalize((y+90)%180-90)))}else m=d.start,c&&m.translate(a);return Dy().translate(m.x,m.y).rotate(y)}getVertexIndex(t,e){const n=this.cell,i=n.getVertices(),s=this.getClosestPointLength(new Nb(t,e));let r=0;if(null!=s)for(const o=i.length;r<o;r+=1){const t=i[r],e=this.getClosestPointLength(t);if(null!=e&&s<e)break}return r}getEventArgs(t,e,n){const i=this,s=i.cell,r=s;return null==e||null==n?{e:t,view:i,edge:s,cell:r}:{e:t,x:e,y:n,view:i,edge:s,cell:r}}notifyUnhandledMouseDown(t,e,n){this.notify("edge:unhandled:mousedown",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})}notifyMouseDown(t,e,n){super.onMouseDown(t,e,n),this.notify("edge:mousedown",this.getEventArgs(t,e,n))}notifyMouseMove(t,e,n){super.onMouseMove(t,e,n),this.notify("edge:mousemove",this.getEventArgs(t,e,n))}notifyMouseUp(t,e,n){super.onMouseUp(t,e,n),this.notify("edge:mouseup",this.getEventArgs(t,e,n))}onClick(t,e,n){super.onClick(t,e,n),this.notify("edge:click",this.getEventArgs(t,e,n))}onDblClick(t,e,n){super.onDblClick(t,e,n),this.notify("edge:dblclick",this.getEventArgs(t,e,n))}onContextMenu(t,e,n){super.onContextMenu(t,e,n),this.notify("edge:contextmenu",this.getEventArgs(t,e,n))}onMouseDown(t,e,n){this.notifyMouseDown(t,e,n),this.startEdgeDragging(t,e,n)}onMouseMove(t,e,n){const i=this.getEventData(t);switch(i.action){case"drag-label":this.dragLabel(t,e,n);break;case"drag-arrowhead":this.dragArrowhead(t,e,n);break;case"drag-edge":this.dragEdge(t,e,n);break;default:break}return this.notifyMouseMove(t,e,n),i}onMouseUp(t,e,n){const i=this.getEventData(t);switch(i.action){case"drag-label":this.stopLabelDragging(t,e,n);break;case"drag-arrowhead":this.stopArrowheadDragging(t,e,n);break;case"drag-edge":this.stopEdgeDragging(t,e,n);break;default:break}return this.notifyMouseUp(t,e,n),this.checkMouseleave(t),i}onMouseOver(t){super.onMouseOver(t),this.notify("edge:mouseover",this.getEventArgs(t))}onMouseOut(t){super.onMouseOut(t),this.notify("edge:mouseout",this.getEventArgs(t))}onMouseEnter(t){super.onMouseEnter(t),this.notify("edge:mouseenter",this.getEventArgs(t))}onMouseLeave(t){super.onMouseLeave(t),this.notify("edge:mouseleave",this.getEventArgs(t))}onMouseWheel(t,e,n,i){super.onMouseWheel(t,e,n,i),this.notify("edge:mousewheel",Object.assign({delta:i},this.getEventArgs(t,e,n)))}onCustomEvent(t,e,n,i){const s=lm(t.target,"edge-tool",this.container);if(s){if(t.stopPropagation(),this.can("useEdgeTools")){if("edge:remove"===e)return void this.cell.remove({ui:!0});this.notify("edge:customevent",Object.assign({name:e},this.getEventArgs(t,n,i)))}this.notifyMouseDown(t,n,i)}else this.notify("edge:customevent",Object.assign({name:e},this.getEventArgs(t,n,i))),super.onCustomEvent(t,e,n,i)}onLabelMouseDown(t,e,n){this.notifyMouseDown(t,e,n),this.startLabelDragging(t,e,n);const i=this.getEventData(t).stopPropagation;i&&t.stopPropagation()}startEdgeDragging(t,e,n){this.can("edgeMovable")?this.setEventData(t,{x:e,y:n,moving:!1,action:"drag-edge"}):this.notifyUnhandledMouseDown(t,e,n)}dragEdge(t,e,n){const i=this.getEventData(t);i.moving||(i.moving=!0,this.addClass("edge-moving"),this.notify("edge:move",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})),this.cell.translate(e-i.x,n-i.y,{ui:!0}),this.setEventData(t,{x:e,y:n}),this.notify("edge:moving",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})}stopEdgeDragging(t,e,n){const i=this.getEventData(t);i.moving&&(this.removeClass("edge-moving"),this.notify("edge:moved",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})),i.moving=!1}prepareArrowheadDragging(t,e){const n=this.getTerminalMagnet(t),i={action:"drag-arrowhead",x:e.x,y:e.y,isNewEdge:!0===e.isNewEdge,terminalType:t,initialMagnet:n,initialTerminal:gh(this.cell[t]),fallbackAction:e.fallbackAction||"revert",getValidateConnectionArgs:this.createValidateConnectionArgs(t),options:e.options};return this.beforeArrowheadDragging(i),i}createValidateConnectionArgs(t){const e=[];let n;e[4]=t,e[5]=this;let i=0,s=0;"source"===t?(i=2,n="target"):(s=2,n="source");const r=this.cell[n],o=r.cell;if(o){let t;const n=e[i]=this.graph.findViewByCell(o);n&&(t=n.getMagnetFromEdgeTerminal(r),t===n.container&&(t=void 0)),e[i+1]=t}return(t,n)=>(e[s]=t,e[s+1]=t.container===n?void 0:n,e)}beforeArrowheadDragging(t){t.zIndex=this.cell.zIndex,this.cell.toFront();const e=this.container.style;t.pointerEvents=e.pointerEvents,e.pointerEvents="none",this.graph.options.connecting.highlight&&this.highlightAvailableMagnets(t)}afterArrowheadDragging(t){null!=t.zIndex&&(this.cell.setZIndex(t.zIndex,{ui:!0}),t.zIndex=null);const e=this.container;e.style.pointerEvents=t.pointerEvents||"",this.graph.options.connecting.highlight&&this.unhighlightAvailableMagnets(t)}validateConnection(t,e,n,i,s,r,o){const a=this.graph.options.connecting,l=a.allowLoop,c=a.allowNode,h=a.allowEdge,u=a.allowPort,d=a.allowMulti,g=a.validateConnection,p=r?r.cell:null,f="target"===s?n:t,m="target"===s?i:e;let y=!0;const b=a=>{const l="source"===s?o?o.port:null:p?p.getSourcePortId():null,c="target"===s?o?o.port:null:p?p.getTargetPortId():null;return Pt(a,this.graph,{edge:p,edgeView:r,sourceView:t,targetView:n,sourcePort:l,targetPort:c,sourceMagnet:e,targetMagnet:i,sourceCell:t?t.cell:null,targetCell:n?n.cell:null,type:s})};if(null!=l&&("boolean"===typeof l?l||t!==n||(y=!1):y=b(l)),y&&null!=u&&("boolean"===typeof u?!u&&m&&(y=!1):y=b(u)),y&&null!=h&&("boolean"===typeof h?!h&&WE.isEdgeView(f)&&(y=!1):y=b(h)),y&&null!=c&&null==m&&("boolean"===typeof c?!c&&JE.isNodeView(f)&&(y=!1):y=b(c)),y&&null!=d&&r){const t=r.cell,e="source"===s?o:t.getSource(),n="target"===s?o:t.getTarget(),i=o?this.graph.getCellById(o.cell):null;if(e&&n&&e.cell&&n.cell&&i)if("function"===typeof d)y=b(d);else{const t=this.graph.model.getConnectedEdges(i,{outgoing:"source"===s,incoming:"target"===s});if(t.length)if("withPort"===d){const i=t.some(t=>{const i=t.getSource(),s=t.getTarget();return i&&s&&i.cell===e.cell&&s.cell===n.cell&&null!=i.port&&i.port===e.port&&null!=s.port&&s.port===n.port});i&&(y=!1)}else if(!d){const i=t.some(t=>{const i=t.getSource(),s=t.getTarget();return i&&s&&i.cell===e.cell&&s.cell===n.cell});i&&(y=!1)}}}return y&&null!=g&&(y=b(g)),y}allowConnectToBlank(t){const e=this.graph,n=e.options.connecting,i=n.allowBlank;if("function"!==typeof i)return!!i;const s=e.findViewByCell(t),r=t.getSourceCell(),o=t.getTargetCell(),a=e.findViewByCell(r),l=e.findViewByCell(o);return Pt(i,e,{edge:t,edgeView:s,sourceCell:r,targetCell:o,sourceView:a,targetView:l,sourcePort:t.getSourcePortId(),targetPort:t.getTargetPortId(),sourceMagnet:s.sourceMagnet,targetMagnet:s.targetMagnet})}validateEdge(t,e,n){const i=this.graph;if(!this.allowConnectToBlank(t)){const e=t.getSourceCellId(),n=t.getTargetCellId();if(!e||!n)return!1}const s=i.options.connecting.validateEdge;return!s||Pt(s,i,{edge:t,type:e,previous:n})}arrowheadDragging(t,e,n,i){i.x=e,i.y=n,i.currentTarget!==t&&(i.currentMagnet&&i.currentView&&i.currentView.unhighlight(i.currentMagnet,{type:"magnetAdsorbed"}),i.currentView=this.graph.findViewByElem(t),i.currentView?(i.currentMagnet=i.currentView.findMagnet(t),i.currentMagnet&&this.validateConnection(...i.getValidateConnectionArgs(i.currentView,i.currentMagnet),i.currentView.getEdgeTerminal(i.currentMagnet,e,n,this.cell,i.terminalType))?i.currentView.highlight(i.currentMagnet,{type:"magnetAdsorbed"}):i.currentMagnet=null):i.currentMagnet=null),i.currentTarget=t,this.cell.prop(i.terminalType,{x:e,y:n},Object.assign(Object.assign({},i.options),{ui:!0}))}arrowheadDragged(t,e,n){const i=t.currentView,s=t.currentMagnet;if(!s||!i)return;i.unhighlight(s,{type:"magnetAdsorbed"});const r=t.terminalType,o=i.getEdgeTerminal(s,e,n,this.cell,r);this.cell.setTerminal(r,o,{ui:!0})}snapArrowhead(t,e,n){const i=this.graph,{snap:s,allowEdge:r}=i.options.connecting,o="object"===typeof s&&s.radius||50,a="object"===typeof s&&s.anchor||"center",l=i.renderer.findViewsInArea({x:t-o,y:e-o,width:2*o,height:2*o},{nodeOnly:!0});if(r){const n=i.renderer.findEdgeViewsFromPoint({x:t,y:e},o).filter(t=>t!==this);l.push(...n)}const c=n.closestView||null,h=n.closestMagnet||null;let u;n.closestView=null,n.closestMagnet=null;let d=Number.MAX_SAFE_INTEGER;const g=new Nb(t,e);let p;l.forEach(i=>{if("false"!==i.container.getAttribute("magnet")){if(i.isNodeView())u="center"===a?i.cell.getBBox().getCenter().distance(g):i.cell.getBBox().getNearestPointToPoint(g).distance(g);else if(i.isEdgeView()){const t=i.getClosestPoint(g);u=t?t.distance(g):Number.MAX_SAFE_INTEGER}u<o&&u<d&&(h===i.container||this.validateConnection(...n.getValidateConnectionArgs(i,null),i.getEdgeTerminal(i.container,t,e,this.cell,n.terminalType)))&&(d=u,n.closestView=i,n.closestMagnet=i.container)}i.container.querySelectorAll("[magnet]").forEach(s=>{if("false"!==s.getAttribute("magnet")){const r=i.getBBoxOfElement(s);u=g.distance(r.getCenter()),u<o&&u<d&&(h===s||this.validateConnection(...n.getValidateConnectionArgs(i,s),i.getEdgeTerminal(s,t,e,this.cell,n.terminalType)))&&(d=u,n.closestView=i,n.closestMagnet=s)}})});const f=n.terminalType,m=n.closestView,y=n.closestMagnet,b=h!==y;if(c&&b&&c.unhighlight(h,{type:"magnetAdsorbed"}),m){if(!b)return;m.highlight(y,{type:"magnetAdsorbed"}),p=m.getEdgeTerminal(y,t,e,this.cell,f)}else p={x:t,y:e};this.cell.setTerminal(f,p,{},Object.assign(Object.assign({},n.options),{ui:!0}))}snapArrowheadEnd(t){const e=t.closestView,n=t.closestMagnet;e&&n&&(e.unhighlight(n,{type:"magnetAdsorbed"}),t.currentMagnet=e.findMagnet(n)),t.closestView=null,t.closestMagnet=null}finishEmbedding(t){this.graph.options.embedding.enabled&&this.cell.updateParent()&&(t.zIndex=null)}fallbackConnection(t){switch(t.fallbackAction){case"remove":this.cell.remove({ui:!0});break;case"revert":default:this.cell.prop(t.terminalType,t.initialTerminal,{ui:!0});break}}notifyConnectionEvent(t,e){const n=t.terminalType,i=t.initialTerminal,s=this.cell[n],r=s&&!NE.equalTerminals(i,s);if(r){const r=this.graph,o=i,a=o.cell?r.getCellById(o.cell):null,l=o.port,c=a?r.findViewByCell(a):null,h=a||t.isNewEdge?null:Nb.create(i).toJSON(),u=s,d=u.cell?r.getCellById(u.cell):null,g=u.port,p=d?r.findViewByCell(d):null,f=d?null:Nb.create(s).toJSON();this.notify("edge:connected",{e:e,previousCell:a,previousPort:l,previousView:c,previousPoint:h,currentCell:d,currentView:p,currentPort:g,currentPoint:f,previousMagnet:t.initialMagnet,currentMagnet:t.currentMagnet,edge:this.cell,view:this,type:n,isNew:t.isNewEdge})}}highlightAvailableMagnets(t){const e=this.graph,n=e.model.getCells();t.marked={};for(let i=0,s=n.length;i<s;i+=1){const s=e.findViewByCell(n[i]);if(!s||s.cell.id===this.cell.id)continue;const r=Array.prototype.slice.call(s.container.querySelectorAll("[magnet]"));"false"!==s.container.getAttribute("magnet")&&r.push(s.container);const o=r.filter(e=>this.validateConnection(...t.getValidateConnectionArgs(s,e),s.getEdgeTerminal(e,t.x,t.y,this.cell,t.terminalType)));if(o.length>0){for(let t=0,e=o.length;t<e;t+=1)s.highlight(o[t],{type:"magnetAvailable"});s.highlight(null,{type:"nodeAvailable"}),t.marked[s.cell.id]=o}}}unhighlightAvailableMagnets(t){const e=t.marked||{};Object.keys(e).forEach(t=>{const n=this.graph.findViewByCell(t);if(n){const i=e[t];i.forEach(t=>{n.unhighlight(t,{type:"magnetAvailable"})}),n.unhighlight(null,{type:"nodeAvailable"})}}),t.marked=null}startArrowheadDragging(t,e,n){if(!this.can("arrowheadMovable"))return void this.notifyUnhandledMouseDown(t,e,n);const i=t.target,s=i.getAttribute("data-terminal"),r=this.prepareArrowheadDragging(s,{x:e,y:n});this.setEventData(t,r)}dragArrowhead(t,e,n){const i=this.getEventData(t);this.graph.options.connecting.snap?this.snapArrowhead(e,n,i):this.arrowheadDragging(this.getEventTarget(t),e,n,i)}stopArrowheadDragging(t,e,n){const i=this.graph,s=this.getEventData(t);i.options.connecting.snap?this.snapArrowheadEnd(s):this.arrowheadDragged(s,e,n);const r=this.validateEdge(this.cell,s.terminalType,s.initialTerminal);r?(this.finishEmbedding(s),this.notifyConnectionEvent(s,t)):this.fallbackConnection(s),this.afterArrowheadDragging(s)}startLabelDragging(t,e,n){if(this.can("edgeLabelMovable")){const e=t.currentTarget,n=parseInt(e.getAttribute("data-index"),10),i=this.getLabelPositionAngle(n),s=this.getLabelPositionArgs(n),r=this.getDefaultLabelPositionArgs(),o=this.mergeLabelPositionArgs(s,r);this.setEventData(t,{index:n,positionAngle:i,positionArgs:o,stopPropagation:!0,action:"drag-label"})}else this.setEventData(t,{stopPropagation:!0});this.graph.view.delegateDragEvents(t,this)}dragLabel(t,e,n){const i=this.getEventData(t),s=this.cell.getLabelAt(i.index),r=jo({},s,{position:this.getLabelPosition(e,n,i.positionAngle,i.positionArgs)});this.cell.setLabelAt(i.index,r)}stopLabelDragging(t,e,n){}}(function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNodeView&&"function"===typeof i.isEdgeView&&"function"===typeof i.confirmUpdate&&"function"===typeof i.update&&"function"===typeof i.getConnection}t.toStringTag=`X6.${t.name}`,t.isEdgeView=e})(WE||(WE={})),WE.config({isSvgElement:!0,priority:1,bootstrap:["render","source","target"],actions:{view:["render"],markup:["render"],attrs:["update"],source:["source","update"],target:["target","update"],router:["update"],connector:["update"],labels:["labels"],defaultLabel:["labels"],tools:["tools"],vertices:["vertices","update"]}}),WE.registry.register("edge",WE,!0);var XE=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class YE extends Xw{get disposeContainer(){return!1}get options(){return this.graph.options}constructor(t){super(),this.graph=t;const{selectors:e,fragment:n}=qw.parseJSONMarkup(YE.markup);this.background=e.background,this.grid=e.grid,this.svg=e.svg,this.defs=e.defs,this.viewport=e.viewport,this.primer=e.primer,this.stage=e.stage,this.decorator=e.decorator,this.overlay=e.overlay,this.container=this.options.container,this.restore=YE.snapshoot(this.container),Hf(this.container,this.prefixClassName("graph")),dm(this.container,n),this.delegateEvents()}delegateEvents(){const t=this.constructor;return super.delegateEvents(t.events),this}guard(t,e){return"mousedown"===t.type&&2===t.button||(!(!this.options.guard||!this.options.guard(t,e))||(t.data&&void 0!==t.data.guarded?t.data.guarded:!(e&&e.cell&&EE.isCell(e.cell))&&(this.svg!==t.target&&this.container!==t.target&&!this.svg.contains(t.target))))}findView(t){return this.graph.findViewByElem(t)}onDblClick(t){this.options.preventDefaultDblClick&&t.preventDefault();const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const i=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onDblClick(e,i.x,i.y):this.graph.trigger("blank:dblclick",{e:e,x:i.x,y:i.y})}onClick(t){if(this.getMouseMovedCount(t)<=this.options.clickThreshold){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const i=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onClick(e,i.x,i.y):this.graph.trigger("blank:click",{e:e,x:i.x,y:i.y})}}isPreventDefaultContextMenu(t){let e=this.options.preventDefaultContextMenu;return"function"===typeof e&&(e=Pt(e,this.graph,{view:t})),e}onContextMenu(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.isPreventDefaultContextMenu(n)&&t.preventDefault(),this.guard(e,n))return;const i=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onContextMenu(e,i.x,i.y):this.graph.trigger("blank:contextmenu",{e:e,x:i.x,y:i.y})}delegateDragEvents(t,e){null==t.data&&(t.data={}),this.setEventData(t,{currentView:e||null,mouseMovedCount:0,startPosition:{x:t.clientX,y:t.clientY}});const n=this.constructor;this.delegateDocumentEvents(n.documentEvents,t.data),this.undelegateEvents()}getMouseMovedCount(t){const e=this.getEventData(t);return e.mouseMovedCount||0}onMouseDown(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;this.options.preventDefaultMouseDown&&t.preventDefault();const i=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onMouseDown(e,i.x,i.y):(this.options.preventDefaultBlankAction&&["touchstart"].includes(e.type)&&t.preventDefault(),this.graph.trigger("blank:mousedown",{e:e,x:i.x,y:i.y})),this.delegateDragEvents(e,n)}onMouseMove(t){const e=this.getEventData(t),n=e.startPosition;if(n&&n.x===t.clientX&&n.y===t.clientY)return;null==e.mouseMovedCount&&(e.mouseMovedCount=0),e.mouseMovedCount+=1;const i=e.mouseMovedCount;if(i<=this.options.moveThreshold)return;const s=this.normalizeEvent(t),r=this.graph.snapToGrid(s.clientX,s.clientY),o=e.currentView;o?o.onMouseMove(s,r.x,r.y):this.graph.trigger("blank:mousemove",{e:s,x:r.x,y:r.y}),this.setEventData(s,e)}onMouseUp(t){this.undelegateDocumentEvents();const e=this.normalizeEvent(t),n=this.graph.snapToGrid(e.clientX,e.clientY),i=this.getEventData(t),s=i.currentView;if(s?s.onMouseUp(e,n.x,n.y):this.graph.trigger("blank:mouseup",{e:e,x:n.x,y:n.y}),!t.isPropagationStopped()){const e=new eb(t,{type:"click",data:t.data});this.onClick(e)}t.stopImmediatePropagation(),this.delegateEvents()}onMouseOver(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(!this.guard(e,n))if(n)n.onMouseOver(e);else{if(this.container===e.target)return;this.graph.trigger("blank:mouseover",{e:e})}}onMouseOut(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(!this.guard(e,n))if(n)n.onMouseOut(e);else{if(this.container===e.target)return;this.graph.trigger("blank:mouseout",{e:e})}}onMouseEnter(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const i=this.graph.findViewByElem(e.relatedTarget);if(n){if(i===n)return;n.onMouseEnter(e)}else{if(i)return;this.graph.trigger("graph:mouseenter",{e:e})}}onMouseLeave(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const i=this.graph.findViewByElem(e.relatedTarget);if(n){if(i===n)return;n.onMouseLeave(e)}else{if(i)return;this.graph.trigger("graph:mouseleave",{e:e})}}onMouseWheel(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const i=e.originalEvent,s=this.graph.snapToGrid(i.clientX,i.clientY),r=Math.max(-1,Math.min(1,i.wheelDelta||-i.detail));n?n.onMouseWheel(e,s.x,s.y,r):this.graph.trigger("blank:mousewheel",{e:e,delta:r,x:s.x,y:s.y})}onCustomEvent(t){const e=t.currentTarget,n=e.getAttribute("event")||e.getAttribute("data-event");if(n){const i=this.findView(e);if(i){const e=this.normalizeEvent(t);if(this.guard(e,i))return;const s=this.graph.snapToGrid(e.clientX,e.clientY);i.onCustomEvent(e,n,s.x,s.y)}}}handleMagnetEvent(t,e){const n=t.currentTarget,i=n.getAttribute("magnet");if(i&&"false"!==i.toLowerCase()){const i=this.findView(n);if(i){const s=this.normalizeEvent(t);if(this.guard(s,i))return;const r=this.graph.snapToGrid(s.clientX,s.clientY);Pt(e,this.graph,i,s,n,r.x,r.y)}}}onMagnetMouseDown(t){this.handleMagnetEvent(t,(t,e,n,i,s)=>{t.onMagnetMouseDown(e,n,i,s)})}onMagnetDblClick(t){this.handleMagnetEvent(t,(t,e,n,i,s)=>{t.onMagnetDblClick(e,n,i,s)})}onMagnetContextMenu(t){const e=this.findView(t.target);this.isPreventDefaultContextMenu(e)&&t.preventDefault(),this.handleMagnetEvent(t,(t,e,n,i,s)=>{t.onMagnetContextMenu(e,n,i,s)})}onLabelMouseDown(t){const e=t.currentTarget,n=this.findView(e);if(n){const e=this.normalizeEvent(t);if(this.guard(e,n))return;const i=this.graph.snapToGrid(e.clientX,e.clientY);n.onLabelMouseDown(e,i.x,i.y)}}onImageDragStart(){return!1}dispose(){this.undelegateEvents(),this.undelegateDocumentEvents(),this.restore(),this.restore=()=>{}}}XE([Xw.dispose()],YE.prototype,"dispose",null),function(t){const e=`${sw.prefixCls}-graph`;function n(t){const e=t.cloneNode();return t.childNodes.forEach(t=>e.appendChild(t)),()=>{um(t);while(t.attributes.length>0)t.removeAttribute(t.attributes[0].name);for(let n=0,i=e.attributes.length;n<i;n+=1){const i=e.attributes[n];t.setAttribute(i.name,i.value)}e.childNodes.forEach(e=>t.appendChild(e))}}t.markup=[{ns:Zf.xhtml,tagName:"div",selector:"background",className:`${e}-background`},{ns:Zf.xhtml,tagName:"div",selector:"grid",className:`${e}-grid`},{ns:Zf.svg,tagName:"svg",selector:"svg",className:`${e}-svg`,attrs:{width:"100%",height:"100%","xmlns:xlink":Zf.xlink},children:[{tagName:"defs",selector:"defs"},{tagName:"g",selector:"viewport",className:`${e}-svg-viewport`,children:[{tagName:"g",selector:"primer",className:`${e}-svg-primer`},{tagName:"g",selector:"stage",className:`${e}-svg-stage`},{tagName:"g",selector:"decorator",className:`${e}-svg-decorator`},{tagName:"g",selector:"overlay",className:`${e}-svg-overlay`}]}]}],t.snapshoot=n}(YE||(YE={})),function(t){const e=sw.prefixCls;t.events={dblclick:"onDblClick",contextmenu:"onContextMenu",touchstart:"onMouseDown",mousedown:"onMouseDown",mouseover:"onMouseOver",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",DOMMouseScroll:"onMouseWheel",[`mouseenter .${e}-cell`]:"onMouseEnter",[`mouseleave .${e}-cell`]:"onMouseLeave",[`mouseenter .${e}-cell-tools`]:"onMouseEnter",[`mouseleave .${e}-cell-tools`]:"onMouseLeave",[`mousedown .${e}-cell [event]`]:"onCustomEvent",[`touchstart .${e}-cell [event]`]:"onCustomEvent",[`mousedown .${e}-cell [data-event]`]:"onCustomEvent",[`touchstart .${e}-cell [data-event]`]:"onCustomEvent",[`dblclick .${e}-cell [magnet]`]:"onMagnetDblClick",[`contextmenu .${e}-cell [magnet]`]:"onMagnetContextMenu",[`mousedown .${e}-cell [magnet]`]:"onMagnetMouseDown",[`touchstart .${e}-cell [magnet]`]:"onMagnetMouseDown",[`dblclick .${e}-cell [data-magnet]`]:"onMagnetDblClick",[`contextmenu .${e}-cell [data-magnet]`]:"onMagnetContextMenu",[`mousedown .${e}-cell [data-magnet]`]:"onMagnetMouseDown",[`touchstart .${e}-cell [data-magnet]`]:"onMagnetMouseDown",[`dragstart .${e}-cell image`]:"onImageDragStart",[`mousedown .${e}-edge .${e}-edge-label`]:"onLabelMouseDown",[`touchstart .${e}-edge .${e}-edge-label`]:"onLabelMouseDown"},t.documentEvents={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}}(YE||(YE={}));const ZE=".x6-graph {\n position: relative;\n overflow: hidden;\n outline: none;\n touch-action: none;\n}\n.x6-graph-background,\n.x6-graph-grid,\n.x6-graph-svg {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n}\n.x6-graph-background-stage,\n.x6-graph-grid-stage,\n.x6-graph-svg-stage {\n user-select: none;\n}\n.x6-graph.x6-graph-pannable {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n.x6-graph.x6-graph-panning {\n cursor: grabbing;\n cursor: -moz-grabbing;\n cursor: -webkit-grabbing;\n user-select: none;\n}\n.x6-node {\n cursor: move;\n /* stylelint-disable-next-line */\n}\n.x6-node.x6-node-immovable {\n cursor: default;\n}\n.x6-node * {\n -webkit-user-drag: none;\n}\n.x6-node .scalable * {\n vector-effect: non-scaling-stroke;\n}\n.x6-node [magnet='true'] {\n cursor: crosshair;\n transition: opacity 0.3s;\n}\n.x6-node [magnet='true']:hover {\n opacity: 0.7;\n}\n.x6-node foreignObject {\n display: block;\n overflow: visible;\n background-color: transparent;\n}\n.x6-node foreignObject > body {\n position: static;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n overflow: visible;\n background-color: transparent;\n}\n.x6-edge .source-marker,\n.x6-edge .target-marker {\n vector-effect: non-scaling-stroke;\n}\n.x6-edge .connection {\n stroke-linejoin: round;\n fill: none;\n}\n.x6-edge .connection-wrap {\n cursor: move;\n opacity: 0;\n fill: none;\n stroke: #000;\n stroke-width: 15;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n.x6-edge .connection-wrap:hover {\n opacity: 0.4;\n stroke-opacity: 0.4;\n}\n.x6-edge .vertices {\n cursor: move;\n opacity: 0;\n}\n.x6-edge .vertices .vertex {\n fill: #1abc9c;\n}\n.x6-edge .vertices .vertex :hover {\n fill: #34495e;\n stroke: none;\n}\n.x6-edge .vertices .vertex-remove {\n cursor: pointer;\n fill: #fff;\n}\n.x6-edge .vertices .vertex-remove-area {\n cursor: pointer;\n opacity: 0.1;\n}\n.x6-edge .vertices .vertex-group:hover .vertex-remove-area {\n opacity: 1;\n}\n.x6-edge .arrowheads {\n cursor: move;\n opacity: 0;\n}\n.x6-edge .arrowheads .arrowhead {\n fill: #1abc9c;\n}\n.x6-edge .arrowheads .arrowhead :hover {\n fill: #f39c12;\n stroke: none;\n}\n.x6-edge .tools {\n cursor: pointer;\n opacity: 0;\n}\n.x6-edge .tools .tool-options {\n display: none;\n}\n.x6-edge .tools .tool-remove circle {\n fill: #f00;\n}\n.x6-edge .tools .tool-remove path {\n fill: #fff;\n}\n.x6-edge:hover .vertices,\n.x6-edge:hover .arrowheads,\n.x6-edge:hover .tools {\n opacity: 1;\n}\n.x6-highlight-opacity {\n opacity: 0.3;\n}\n.x6-cell-tool-editor {\n position: relative;\n display: inline-block;\n min-height: 1em;\n margin: 0;\n padding: 0;\n line-height: 1;\n white-space: normal;\n text-align: center;\n vertical-align: top;\n overflow-wrap: normal;\n outline: none;\n transform-origin: 0 0;\n -webkit-user-drag: none;\n}\n.x6-edge-tool-editor {\n border: 1px solid #275fc5;\n border-radius: 2px;\n}\n";class KE extends C{get options(){return this.graph.options}get model(){return this.graph.model}get view(){return this.graph.view}constructor(t){super(),this.graph=t,this.init()}init(){}}var QE=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class tM extends KE{init(){sw.autoInsertCSS&&Eb("core",ZE)}dispose(){Mb("core")}}QE([tM.dispose()],tM.prototype,"dispose",null);var eM,nM=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};(function(t){function e(e){const{grid:n,panning:i,mousewheel:s,embedding:r}=e,o=nM(e,["grid","panning","mousewheel","embedding"]),a=e.container;if(null==a)throw new Error("Ensure the container of the graph is specified and valid");null==o.width&&(o.width=a.clientWidth),null==o.height&&(o.height=a.clientHeight);const l=jo({},t.defaults,o),c={size:10,visible:!1};l.grid="number"===typeof n?{size:n,visible:!1}:"boolean"===typeof n?Object.assign(Object.assign({},c),{visible:n}):Object.assign(Object.assign({},c),n);const h=["panning","mousewheel","embedding"];return h.forEach(t=>{const n=e[t];"boolean"===typeof n?l[t].enabled=n:l[t]=Object.assign(Object.assign({},l[t]),n)}),l}t.get=e})(eM||(eM={})),function(t){t.defaults={x:0,y:0,scaling:{min:.01,max:16},grid:{size:10,visible:!1},background:!1,panning:{enabled:!1,eventTypes:["leftMouseDown"]},mousewheel:{enabled:!1,factor:1.2,zoomAtMousePosition:!0},highlighting:{default:{name:"stroke",args:{padding:3}},nodeAvailable:{name:"className",args:{className:sw.prefix("available-node")}},magnetAvailable:{name:"className",args:{className:sw.prefix("available-magnet")}}},connecting:{snap:!1,allowLoop:!0,allowNode:!0,allowEdge:!1,allowPort:!0,allowBlank:!0,allowMulti:!0,highlight:!1,anchor:"center",edgeAnchor:"ratio",connectionPoint:"boundary",router:"normal",connector:"normal",validateConnection({type:t,sourceView:e,targetView:n}){const i="target"===t?n:e;return null!=i},createEdge(){return new FE}},translating:{restrict:!1},embedding:{enabled:!1,findParent:"bbox",frontOnly:!0,validate:()=>!0},moveThreshold:0,clickThreshold:0,magnetThreshold:0,preventDefaultDblClick:!0,preventDefaultMouseDown:!1,preventDefaultContextMenu:!0,preventDefaultBlankAction:!0,interacting:{edgeLabelMovable:!1},async:!0,virtual:!1,guard:()=>!1}}(eM||(eM={}));var iM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o},sM=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class rM extends KE{get elem(){return this.view.grid}get grid(){return this.options.grid}init(){this.startListening(),this.draw(this.grid)}startListening(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}stopListening(){this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this)}setVisible(t){this.grid.visible!==t&&(this.grid.visible=t,this.update())}getGridSize(){return this.grid.size}setGridSize(t){this.grid.size=Math.max(t,1),this.update()}show(){this.setVisible(!0),this.update()}hide(){this.setVisible(!1),this.update()}clear(){this.elem.style.backgroundImage=""}draw(t){this.clear(),this.instance=null,Object.assign(this.grid,t),this.patterns=this.resolveGrid(t),this.update()}update(t={}){const e=this.grid.size;if(e<=1||!this.grid.visible)return this.clear();const n=this.graph.matrix(),i=this.getInstance(),s=Array.isArray(t)?t:[t];this.patterns.forEach((t,r)=>{const o=`pattern_${r}`,a=n.a||1,l=n.d||1,{update:c,markup:h}=t,u=sM(t,["update","markup"]),d=Object.assign(Object.assign(Object.assign({},u),s[r]),{sx:a,sy:l,ox:n.e||0,oy:n.f||0,width:e*a,height:e*l});i.has(o)||i.add(o,ry.create("pattern",{id:o,patternUnits:"userSpaceOnUse"},ry.createVectors(h)).node);const g=i.get(o);"function"===typeof c&&c(g.childNodes[0],d);let p=d.ox%d.width;p<0&&(p+=d.width);let f=d.oy%d.height;f<0&&(f+=d.height),Mm(g,{x:p,y:f,width:d.width,height:d.height})});const r=(new XMLSerializer).serializeToString(i.root),o=`url(data:image/svg+xml;base64,${btoa(r)})`;this.elem.style.backgroundImage=o}getInstance(){return this.instance||(this.instance=new ov),this.instance}resolveGrid(t){if(!t)return[];const e=t.type;if(null==e)return[Object.assign(Object.assign({},ov.presets.dot),t.args)];const n=ov.registry.get(e);if(n){let e=t.args||[];return Array.isArray(e)||(e=[e]),Array.isArray(n)?n.map((t,n)=>Object.assign(Object.assign({},t),e[n])):[Object.assign(Object.assign({},n),e[0])]}return ov.registry.onNotFound(e)}dispose(){this.stopListening(),this.clear()}}iM([KE.dispose()],rM.prototype,"dispose",null);class oM extends KE{get container(){return this.graph.view.container}get viewport(){return this.graph.view.viewport}get stage(){return this.graph.view.stage}init(){this.resize()}getMatrix(){const t=this.viewport.getAttribute("transform");return t!==this.viewportTransformString&&(this.viewportMatrix=this.viewport.getCTM(),this.viewportTransformString=t),Dy(this.viewportMatrix)}setMatrix(t){const e=Dy(t);e.a=Number.isFinite(e.a)?e.a:1,e.b=Number.isFinite(e.b)?e.b:0,e.c=Number.isFinite(e.c)?e.c:0,e.d=Number.isFinite(e.d)?e.d:1,e.e=Number.isFinite(e.e)?e.e:0,e.f=Number.isFinite(e.f)?e.f:0;const n=Ry(e);this.viewport.setAttribute("transform",n),this.viewportMatrix=e,this.viewportTransformString=n}resize(t,e){let n=void 0===t?this.options.width:t,i=void 0===e?this.options.height:e;this.options.width=n,this.options.height=i,"number"===typeof n&&(n=Math.round(n)),"number"===typeof i&&(i=Math.round(i)),this.container.style.width=null==n?"":`${n}px`,this.container.style.height=null==i?"":`${i}px`;const s=this.getComputedSize();return this.graph.trigger("resize",Object.assign({},s)),this}getComputedSize(){let t=this.options.width,e=this.options.height;return pf(t)||(t=this.container.clientWidth),pf(e)||(e=this.container.clientHeight),{width:t,height:e}}getScale(){return Fy(this.getMatrix())}scale(t,e=t,n=0,i=0){if(t=this.clampScale(t),e=this.clampScale(e),n||i){const s=this.getTranslation(),r=s.tx-n*(t-1),o=s.ty-i*(e-1);r===s.tx&&o===s.ty||this.translate(r,o)}const s=this.getMatrix(),r=Number.isFinite(t)?t:1,o=Number.isFinite(e)?e:1;return s.a=r,s.d=o,this.setMatrix(s),this.graph.trigger("scale",{sx:r,sy:o,ox:n,oy:i}),this}clampScale(t){const e=this.graph.options.scaling;return bf(t,e.min||.01,e.max||16)}getZoom(){return this.getScale().sx}zoom(t,e){e=e||{};let n=t,i=t;const s=this.getScale(),r=this.getComputedSize();let o=r.width/2,a=r.height/2;if(e.absolute||(n+=s.sx,i+=s.sy),e.scaleGrid&&(n=Math.round(n/e.scaleGrid)*e.scaleGrid,i=Math.round(i/e.scaleGrid)*e.scaleGrid),e.maxScale&&(n=Math.min(e.maxScale,n),i=Math.min(e.maxScale,i)),e.minScale&&(n=Math.max(e.minScale,n),i=Math.max(e.minScale,i)),e.center&&(o=e.center.x,a=e.center.y),n=this.clampScale(n),i=this.clampScale(i),n=Number.isFinite(n)?n:s.sx,i=Number.isFinite(i)?i:s.sy,o||a){const t=this.getTranslation(),e=0===s.sx?1:s.sx,r=0===s.sy?1:s.sy,l=o-(o-t.tx)*(n/e),c=a-(a-t.ty)*(i/r);l===t.tx&&c===t.ty||this.translate(l,c)}return this.scale(n,i),this}getRotation(){return Gy(this.getMatrix())}rotate(t,e,n){if(null==e||null==n){const t=cw.getBBox(this.stage);e=t.width/2,n=t.height/2}const i=this.getMatrix().translate(e,n).rotate(t).translate(-e,-n);return this.setMatrix(i),this}getTranslation(){return _y(this.getMatrix())}translate(t,e){const n=this.getMatrix();n.e=Number.isFinite(t)?t:0,n.f=Number.isFinite(e)?e:0,this.setMatrix(n);const i=this.getTranslation();return this.options.x=i.tx,this.options.y=i.ty,this.graph.trigger("translate",Object.assign({},i)),this}setOrigin(t,e){return this.translate(t||0,e||0)}fitToContent(t,e,n,i){if("object"===typeof t){const s=t;t=s.gridWidth||1,e=s.gridHeight||1,n=s.padding||0,i=s}else t=t||1,e=e||1,n=n||0,null==i&&(i={});const s=wf(n),r=i.border||0,o=i.contentArea?Tb.create(i.contentArea):this.getContentArea(i);r>0&&o.inflate(r);const a=this.getScale(),l=this.getTranslation(),c=a.sx,h=a.sy;o.x*=c,o.y*=h,o.width*=c,o.height*=h;let u=Math.max(Math.ceil((o.width+o.x)/t),1)*t,d=Math.max(Math.ceil((o.height+o.y)/e),1)*e,g=0,p=0;("negative"===i.allowNewOrigin&&o.x<0||"positive"===i.allowNewOrigin&&o.x>=0||"any"===i.allowNewOrigin)&&(g=Math.ceil(-o.x/t)*t,g+=s.left,u+=g),("negative"===i.allowNewOrigin&&o.y<0||"positive"===i.allowNewOrigin&&o.y>=0||"any"===i.allowNewOrigin)&&(p=Math.ceil(-o.y/e)*e,p+=s.top,d+=p),u+=s.right,d+=s.bottom,u=Math.max(u,i.minWidth||0),d=Math.max(d,i.minHeight||0),u=Math.min(u,i.maxWidth||Number.MAX_SAFE_INTEGER),d=Math.min(d,i.maxHeight||Number.MAX_SAFE_INTEGER);const f=this.getComputedSize(),m=u!==f.width||d!==f.height,y=g!==l.tx||p!==l.ty;return y&&this.translate(g,p),m&&this.resize(u,d),new Tb(-g/c,-p/h,u/c,d/h)}scaleContentToFit(t={}){this.scaleContentToFitImpl(t)}scaleContentToFitImpl(t={},e=!0){let n,i;if(t.contentArea){const e=t.contentArea;n=this.graph.localToGraph(e),i=Nb.create(e)}else n=this.getContentBBox(t),i=this.graph.graphToLocal(n);if(!n.width||!n.height)return;const s=wf(t.padding),r=t.minScale||0,o=t.maxScale||Number.MAX_SAFE_INTEGER,a=t.minScaleX||r,l=t.maxScaleX||o,c=t.minScaleY||r,h=t.maxScaleY||o;let u;if(t.viewportArea)u=t.viewportArea;else{const t=this.getComputedSize(),e=this.getTranslation();u={x:e.tx,y:e.ty,width:t.width,height:t.height}}u=Tb.create(u).moveAndExpand({x:s.left,y:s.top,width:-s.left-s.right,height:-s.top-s.bottom});const d=this.getScale();let g=u.width/n.width*d.sx,p=u.height/n.height*d.sy;!1!==t.preserveAspectRatio&&(g=p=Math.min(g,p));const f=t.scaleGrid;if(f&&(g=f*Math.floor(g/f),p=f*Math.floor(p/f)),g=bf(g,a,l),p=bf(p,c,h),this.scale(g,p),e){const t=this.options,e=u.x-i.x*g-t.x,n=u.y-i.y*p-t.y;this.translate(e,n)}}getContentArea(t={}){return!1!==t.useCellGeometry?this.model.getAllCellsBBox()||new Tb:cw.getBBox(this.stage)}getContentBBox(t={}){return this.graph.localToGraph(this.getContentArea(t))}getGraphArea(){const t=Tb.fromSize(this.getComputedSize());return this.graph.graphToLocal(t)}zoomToRect(t,e={}){const n=Tb.create(t),i=this.graph;e.contentArea=n,null==e.viewportArea&&(e.viewportArea={x:i.options.x,y:i.options.y,width:this.options.width,height:this.options.height}),this.scaleContentToFitImpl(e,!1);const s=n.getCenter();return this.centerPoint(s.x,s.y),this}zoomToFit(t={}){return this.zoomToRect(this.getContentArea(t),t)}centerPoint(t,e){const n=this.getComputedSize(),i=this.getScale(),s=this.getTranslation(),r=n.width/2,o=n.height/2;t="number"===typeof t?t:r,e="number"===typeof e?e:o,t=r-t*i.sx,e=o-e*i.sy,s.tx===t&&s.ty===e||this.translate(t,e)}centerContent(t){const e=this.graph.getContentArea(t),n=e.getCenter();this.centerPoint(n.x,n.y)}centerCell(t){return this.positionCell(t,"center")}positionPoint(t,e,n){const i=this.getComputedSize();e=xf(e,Math.max(0,i.width)),e<0&&(e=i.width+e),n=xf(n,Math.max(0,i.height)),n<0&&(n=i.height+n);const s=this.getTranslation(),r=this.getScale(),o=e-t.x*r.sx,a=n-t.y*r.sy;s.tx===o&&s.ty===a||this.translate(o,a)}positionRect(t,e){const n=Tb.create(t);switch(e){case"center":return this.positionPoint(n.getCenter(),"50%","50%");case"top":return this.positionPoint(n.getTopCenter(),"50%",0);case"top-right":return this.positionPoint(n.getTopRight(),"100%",0);case"right":return this.positionPoint(n.getRightMiddle(),"100%","50%");case"bottom-right":return this.positionPoint(n.getBottomRight(),"100%","100%");case"bottom":return this.positionPoint(n.getBottomCenter(),"50%","100%");case"bottom-left":return this.positionPoint(n.getBottomLeft(),0,"100%");case"left":return this.positionPoint(n.getLeftMiddle(),0,"50%");case"top-left":return this.positionPoint(n.getTopLeft(),0,0);default:return this}}positionCell(t,e){const n=t.getBBox();return this.positionRect(n,e)}positionContent(t,e){const n=this.graph.getContentArea(e);return this.positionRect(n,t)}}var aM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class lM extends KE{get elem(){return this.view.background}init(){this.startListening(),this.options.background&&this.draw(this.options.background)}startListening(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}stopListening(){this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this)}updateBackgroundImage(t={}){let e=t.size||"auto auto",n=t.position||"center";const i=this.graph.transform.getScale(),s=this.graph.translate();if("object"===typeof n){const t=s.tx+i.sx*(n.x||0),e=s.ty+i.sy*(n.y||0);n=`${t}px ${e}px`}"object"===typeof e&&(e=Tb.fromSize(e).scale(i.sx,i.sy),e=`${e.width}px ${e.height}px`),this.elem.style.backgroundSize=e,this.elem.style.backgroundPosition=n}drawBackgroundImage(t,e={}){if(!(t instanceof HTMLImageElement))return void(this.elem.style.backgroundImage="");const n=this.optionsCache;if(n&&n.image!==e.image)return;let i;const s=e.opacity,r=e.size;let o=e.repeat||"no-repeat";const a=uv.registry.get(o);if("function"===typeof a){const n=e.quality||1;t.width*=n,t.height*=n;const s=a(t,e);if(!(s instanceof HTMLCanvasElement))throw new Error("Background pattern must return an HTML Canvas instance");i=s.toDataURL("image/png"),o=e.repeat&&o!==e.repeat?e.repeat:"repeat","object"===typeof r?(r.width*=s.width/t.width,r.height*=s.height/t.height):void 0===r&&(e.size={width:s.width/n,height:s.height/n})}else i=t.src,void 0===r&&(e.size={width:t.width,height:t.height});null!=n&&"object"===typeof e.size&&e.image===n.image&&e.repeat===n.repeat&&e.quality===n.quality&&(n.size=gh(e.size));const l=this.elem.style;l.backgroundImage=`url(${i})`,l.backgroundRepeat=o,l.opacity=null==s||s>=1?"":`${s}`,this.updateBackgroundImage(e)}updateBackgroundColor(t){this.elem.style.backgroundColor=t||""}updateBackgroundOptions(t){this.graph.options.background=t}update(){this.optionsCache&&this.updateBackgroundImage(this.optionsCache)}draw(t){const e=t||{};if(this.updateBackgroundOptions(t),this.updateBackgroundColor(e.color),e.image){this.optionsCache=gh(e);const n=document.createElement("img");n.onload=()=>this.drawBackgroundImage(n,t),n.setAttribute("crossorigin","anonymous"),n.src=e.image}else this.drawBackgroundImage(null),this.optionsCache=null}clear(){this.draw()}dispose(){this.clear(),this.stopListening()}}aM([KE.dispose()],lM.prototype,"dispose",null);var cM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class hM extends KE{get widgetOptions(){return this.options.panning}get pannable(){return this.widgetOptions&&!0===this.widgetOptions.enabled}init(){this.onRightMouseDown=this.onRightMouseDown.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.startListening(),this.updateClassName()}startListening(){this.graph.on("blank:mousedown",this.onMouseDown,this),this.graph.on("node:unhandled:mousedown",this.onMouseDown,this),this.graph.on("edge:unhandled:mousedown",this.onMouseDown,this),ib.on(this.graph.container,"mousedown",this.onRightMouseDown),ib.on(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle=new ob(this.graph.container,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.mousewheelHandle.enable()}stopListening(){this.graph.off("blank:mousedown",this.onMouseDown,this),this.graph.off("node:unhandled:mousedown",this.onMouseDown,this),this.graph.off("edge:unhandled:mousedown",this.onMouseDown,this),ib.off(this.graph.container,"mousedown",this.onRightMouseDown),ib.off(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle&&this.mousewheelHandle.disable()}allowPanning(t,e){return t.spaceKey=this.isSpaceKeyPressed,this.pannable&&yb.isMatch(t,this.widgetOptions.modifiers,e)}startPanning(t){const e=this.view.normalizeEvent(t);this.clientX=e.clientX,this.clientY=e.clientY,this.panning=!0,this.updateClassName(t),ib.on(document.body,{"mousemove.panning touchmove.panning":this.pan.bind(this),"mouseup.panning touchend.panning":this.stopPanning.bind(this),"mouseleave.panning":this.stopPanning.bind(this)}),ib.on(window,"mouseup.panning",this.stopPanning.bind(this))}pan(t){const e=this.view.normalizeEvent(t),n=e.clientX-this.clientX,i=e.clientY-this.clientY;this.clientX=e.clientX,this.clientY=e.clientY,this.graph.translateBy(n,i)}stopPanning(t){this.panning=!1,this.updateClassName(t),ib.off(document.body,".panning"),ib.off(window,".panning")}updateClassName(t){const e=this.widgetOptions.eventTypes;if(1===(null===e||void 0===e?void 0:e.length)&&e.includes("mouseWheel"))return;const n=this.view.container,i=this.view.prefixClassName("graph-panning"),s=this.view.prefixClassName("graph-pannable"),r=this.graph.getPlugin("selection"),o=r&&r.allowRubberband(t,!0),a=(null===e||void 0===e?void 0:e.includes("leftMouseDown"))&&!o;this.allowPanning(null!==t&&void 0!==t?t:{},!0)||this.allowPanning(null!==t&&void 0!==t?t:{})&&a?this.panning?(Hf(n,i),Uf(n,s)):(Uf(n,i),Hf(n,s)):this.panning||(Uf(n,i),Uf(n,s))}onMouseDown({e:t}){if(!this.allowBlankMouseDown(t))return;const e=this.graph.getPlugin("selection"),n=e&&e.allowRubberband(t,!0);(this.allowPanning(t,!0)||this.allowPanning(t)&&!n)&&this.startPanning(t)}onRightMouseDown(t){const e=this.widgetOptions.eventTypes;(null===e||void 0===e?void 0:e.includes("rightMouseDown"))&&2===t.button&&this.allowPanning(t,!0)&&this.startPanning(t)}onMouseWheel(t,e,n){this.graph.translateBy(-e,-n)}onKeyDown(t){32===t.which&&(this.isSpaceKeyPressed=!0),this.updateClassName(t)}onKeyUp(t){32===t.which&&(this.isSpaceKeyPressed=!1),this.updateClassName(t)}allowBlankMouseDown(t){const e=this.widgetOptions.eventTypes;return(null===e||void 0===e?void 0:e.includes("leftMouseDown"))&&0===t.button||(null===e||void 0===e?void 0:e.includes("mouseWheelDown"))&&1===t.button}allowMouseWheel(t){var e;return this.pannable&&!t.ctrlKey&&(null===(e=this.widgetOptions.eventTypes)||void 0===e?void 0:e.includes("mouseWheel"))}autoPanning(t,e){const n=10,i=this.graph.getGraphArea();let s=0,r=0;t<=i.left+n&&(s=-n),e<=i.top+n&&(r=-n),t>=i.right-n&&(s=n),e>=i.bottom-n&&(r=n),0===s&&0===r||this.graph.translateBy(-s,-r)}enablePanning(){this.pannable||(this.widgetOptions.enabled=!0,this.updateClassName())}disablePanning(){this.pannable&&(this.widgetOptions.enabled=!1,this.updateClassName())}dispose(){this.stopListening()}}cM([KE.dispose()],hM.prototype,"dispose",null);var uM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class dM extends KE{constructor(){super(...arguments),this.cumulatedFactor=1}get widgetOptions(){return this.options.mousewheel}init(){this.container=this.graph.container,this.target=this.widgetOptions.global?document:this.container,this.mousewheelHandle=new ob(this.target,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.widgetOptions.enabled&&this.enable(!0)}get disabled(){return!0!==this.widgetOptions.enabled}enable(t){(this.disabled||t)&&(this.widgetOptions.enabled=!0,this.mousewheelHandle.enable())}disable(){this.disabled||(this.widgetOptions.enabled=!1,this.mousewheelHandle.disable())}allowMouseWheel(t){const e=this.widgetOptions.guard;return(null==e||e(t))&&yb.isMatch(t,this.widgetOptions.modifiers)}onMouseWheel(t){const e=this.widgetOptions.guard;if((null==e||e(t))&&yb.isMatch(t,this.widgetOptions.modifiers)){const e=this.widgetOptions.factor||1.2;null==this.currentScale&&(this.startPos={x:t.clientX,y:t.clientY},this.currentScale=this.graph.transform.getScale().sx);const n=t.deltaY;n<0?(this.currentScale<.15?this.cumulatedFactor=(this.currentScale+.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*e*20)/20/this.currentScale,this.cumulatedFactor<=1&&(this.cumulatedFactor=1.05)):(this.currentScale<=.15?this.cumulatedFactor=(this.currentScale-.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*(1/e)*20)/20/this.currentScale,this.cumulatedFactor>=1&&(this.cumulatedFactor=.95)),this.cumulatedFactor=Math.max(.01,Math.min(this.currentScale*this.cumulatedFactor,160)/this.currentScale);const i=this.currentScale;let s=this.graph.transform.clampScale(i*this.cumulatedFactor);const r=this.widgetOptions.minScale||Number.MIN_SAFE_INTEGER,o=this.widgetOptions.maxScale||Number.MAX_SAFE_INTEGER;if(s=bf(s,r,o),s!==i)if(this.widgetOptions.zoomAtMousePosition){const t=!!this.graph.getPlugin("scroller"),e=t?this.graph.clientToLocal(this.startPos):this.graph.clientToGraph(this.startPos);this.graph.zoom(s,{absolute:!0,center:e.clone()})}else this.graph.zoom(s,{absolute:!0});this.currentScale=null,this.cumulatedFactor=1}}dispose(){this.disable()}}uM([C.dispose()],dM.prototype,"dispose",null);var gM,pM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class fM extends KE{init(){this.resetRenderArea=wt(this.resetRenderArea,200,{leading:!0}),this.resetRenderArea(),this.startListening()}startListening(){this.graph.on("translate",this.resetRenderArea,this),this.graph.on("scale",this.resetRenderArea,this),this.graph.on("resize",this.resetRenderArea,this)}stopListening(){this.graph.off("translate",this.resetRenderArea,this),this.graph.off("scale",this.resetRenderArea,this),this.graph.off("resize",this.resetRenderArea,this)}enableVirtualRender(){this.options.virtual=!0,this.resetRenderArea()}disableVirtualRender(){this.options.virtual=!1,this.graph.renderer.setRenderArea(void 0)}resetRenderArea(){if(this.options.virtual){const t=this.graph.getGraphArea();this.graph.renderer.setRenderArea(t)}}dispose(){this.stopListening()}}pM([KE.dispose()],fM.prototype,"dispose",null);class mM{constructor(){this.isFlushing=!1,this.isFlushPending=!1,this.scheduleId=0,this.queue=[],this.frameInterval=33,this.initialTime=Date.now()}queueJob(t){if(t.priority&gM.PRIOR)t.cb();else{const e=this.findInsertionIndex(t);e>=0&&this.queue.splice(e,0,t)}}queueFlush(){this.isFlushing||this.isFlushPending||(this.isFlushPending=!0,this.scheduleJob())}queueFlushSync(){this.isFlushing||this.isFlushPending||(this.isFlushPending=!0,this.flushJobsSync())}clearJobs(){this.queue.length=0,this.isFlushing=!1,this.isFlushPending=!1,this.cancelScheduleJob()}flushJobs(){this.isFlushPending=!1,this.isFlushing=!0;const t=this.getCurrentTime();let e;while(e=this.queue.shift())if(e.cb(),this.getCurrentTime()-t>=this.frameInterval)break;this.isFlushing=!1,this.queue.length&&this.queueFlush()}flushJobsSync(){let t;this.isFlushPending=!1,this.isFlushing=!0;while(t=this.queue.shift())try{t.cb()}catch(e){console.log(e)}this.isFlushing=!1}findInsertionIndex(t){let e=0,n=this.queue.length,i=n-1;const s=t.priority;while(e<=i){const t=(i-e>>1)+e;s<=this.queue[t].priority?e=t+1:(n=t,i=t-1)}return n}scheduleJob(){"requestIdleCallback"in window?(this.scheduleId&&this.cancelScheduleJob(),this.scheduleId=window.requestIdleCallback(this.flushJobs.bind(this),{timeout:100})):(this.scheduleId&&this.cancelScheduleJob(),this.scheduleId=window.setTimeout(this.flushJobs.bind(this)))}cancelScheduleJob(){"cancelIdleCallback"in window?(this.scheduleId&&window.cancelIdleCallback(this.scheduleId),this.scheduleId=0):(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduleId=0)}getCurrentTime(){const t="object"===typeof performance&&"function"===typeof performance.now;return t?performance.now():Date.now()-this.initialTime}}(function(t){t[t["Update"]=2]="Update",t[t["RenderEdge"]=4]="RenderEdge",t[t["RenderNode"]=8]="RenderNode",t[t["PRIOR"]=1048576]="PRIOR"})(gM||(gM={}));var yM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class bM extends C{get model(){return this.graph.model}get container(){return this.graph.view.stage}constructor(t){super(),this.views={},this.willRemoveViews={},this.queue=new mM,this.graph=t,this.init()}init(){this.startListening(),this.renderViews(this.model.getCells())}startListening(){this.model.on("reseted",this.onModelReseted,this),this.model.on("cell:added",this.onCellAdded,this),this.model.on("cell:removed",this.onCellRemoved,this),this.model.on("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.on("cell:change:visible",this.onCellVisibleChanged,this)}stopListening(){this.model.off("reseted",this.onModelReseted,this),this.model.off("cell:added",this.onCellAdded,this),this.model.off("cell:removed",this.onCellRemoved,this),this.model.off("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.off("cell:change:visible",this.onCellVisibleChanged,this)}onModelReseted({options:t}){this.queue.clearJobs(),this.removeZPivots(),this.resetViews();const e=this.model.getCells();this.renderViews(e,Object.assign(Object.assign({},t),{queue:e.map(t=>t.id)}))}onCellAdded({cell:t,options:e}){this.renderViews([t],e)}onCellRemoved({cell:t}){this.removeViews([t])}onCellZIndexChanged({cell:t,options:e}){const n=this.views[t.id];n&&this.requestViewUpdate(n.view,bM.FLAG_INSERT,e,gM.Update,!0)}onCellVisibleChanged({cell:t,current:e}){this.toggleVisible(t,!!e)}requestViewUpdate(t,e,n={},i=gM.Update,s=!0){const r=t.cell.id,o=this.views[r];if(!o)return;o.flag=e,o.options=n;const a=t.hasAction(e,["translate","resize","rotate"]);(a||!1===n.async)&&(i=gM.PRIOR,s=!1),this.queue.queueJob({id:r,priority:i,cb:()=>{this.renderViewInArea(t,e,n);const i=n.queue;if(i){const e=i.indexOf(t.cell.id);e>=0&&i.splice(e,1),0===i.length&&this.graph.trigger("render:done")}}});const l=this.getEffectedEdges(t);l.forEach(t=>{this.requestViewUpdate(t.view,t.flag,n,i,!1)}),s&&this.flush()}setRenderArea(t){this.renderArea=t,this.flushWaitingViews()}isViewMounted(t){if(null==t)return!1;const e=this.views[t.cell.id];return!!e&&e.state===bM.ViewState.MOUNTED}renderViews(t,e={}){t.sort((t,e)=>t.isNode()&&e.isEdge()?-1:0),t.forEach(t=>{const n=t.id,i=this.views;let s=0,r=i[n];if(r)s=bM.FLAG_INSERT;else{const i=this.createCellView(t);i&&(i.graph=this.graph,s=bM.FLAG_INSERT|i.getBootstrapFlag(),r={view:i,flag:s,options:e,state:bM.ViewState.CREATED},this.views[n]=r)}r&&this.requestViewUpdate(r.view,s,e,this.getRenderPriority(r.view),!1)}),this.flush()}renderViewInArea(t,e,n={}){const i=t.cell,s=i.id,r=this.views[s];if(!r)return;let o=0;this.isUpdatable(t)||r.state===bM.ViewState.MOUNTED?(o=this.updateView(t,e,n),r.flag=o):r.state=bM.ViewState.WAITING,o&&i.isEdge()&&0===(o&t.getFlag(["source","target"]))&&this.queue.queueJob({id:s,priority:gM.RenderEdge,cb:()=>{this.updateView(t,e,n)}})}removeViews(t){t.forEach(t=>{const e=t.id,n=this.views[e];n&&(this.willRemoveViews[e]=n,delete this.views[e],this.queue.queueJob({id:e,priority:this.getRenderPriority(n.view),cb:()=>{this.removeView(n.view)}}))}),this.flush()}flush(){this.graph.options.async?this.queue.queueFlush():this.queue.queueFlushSync()}flushWaitingViews(){Object.values(this.views).forEach(t=>{if(t&&t.state===bM.ViewState.WAITING){const{view:e,flag:n,options:i}=t;this.requestViewUpdate(e,n,i,this.getRenderPriority(e),!1)}}),this.flush()}updateView(t,e,n={}){if(null==t)return 0;if(eC.isCellView(t)){if(e&bM.FLAG_REMOVE)return this.removeView(t.cell),0;e&bM.FLAG_INSERT&&(this.insertView(t),e^=bM.FLAG_INSERT)}return e?t.confirmUpdate(e,n):0}insertView(t){const e=this.views[t.cell.id];if(e){const n=t.cell.getZIndex(),i=this.addZPivot(n);this.container.insertBefore(t.container,i),t.cell.isVisible()||this.toggleVisible(t.cell,!1),e.state=bM.ViewState.MOUNTED,this.graph.trigger("view:mounted",{view:t})}}resetViews(){this.willRemoveViews=Object.assign(Object.assign({},this.views),this.willRemoveViews),Object.values(this.willRemoveViews).forEach(t=>{t&&this.removeView(t.view)}),this.views={},this.willRemoveViews={}}removeView(t){const e=t.cell,n=this.willRemoveViews[e.id];n&&t&&(n.view.remove(),delete this.willRemoveViews[e.id],this.graph.trigger("view:unmounted",{view:t}))}toggleVisible(t,e){const n=this.model.getConnectedEdges(t);for(let s=0,r=n.length;s<r;s+=1){const t=n[s];if(e){const e=t.getSourceCell(),n=t.getTargetCell();if(e&&!e.isVisible()||n&&!n.isVisible())continue;this.toggleVisible(t,!0)}else this.toggleVisible(t,!1)}const i=this.views[t.id];i&&Km(i.view.container,{display:e?"unset":"none"})}addZPivot(t=0){null==this.zPivots&&(this.zPivots={});const e=this.zPivots;let n=e[t];if(n)return n;n=e[t]=document.createComment(`z-index:${t+1}`);let i=-1/0;for(const r in e){const e=+r;e<t&&e>i&&(i=e)}const s=this.container;if(i!==-1/0){const t=e[i];s.insertBefore(n,t.nextSibling)}else s.insertBefore(n,s.firstChild);return n}removeZPivots(){this.zPivots&&Object.values(this.zPivots).forEach(t=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),this.zPivots={}}createCellView(t){const e={graph:this.graph},n=this.graph.options.createCellView;if(n){const i=Pt(n,this.graph,t);if(i)return new i(t,e);if(null===i)return null}const i=t.view;if(null!=i&&"string"===typeof i){const n=eC.registry.get(i);return n?new n(t,e):eC.registry.onNotFound(i)}return t.isNode()?new JE(t,e):t.isEdge()?new WE(t,e):null}getEffectedEdges(t){const e=[],n=t.cell,i=this.model.getConnectedEdges(n);for(let s=0,r=i.length;s<r;s+=1){const t=i[s],r=this.views[t.id];if(!r)continue;const o=r.view;if(!this.isViewMounted(o))continue;const a=["update"];t.getTargetCell()===n&&a.push("target"),t.getSourceCell()===n&&a.push("source"),e.push({id:t.id,view:o,flag:o.getFlag(a)})}return e}isUpdatable(t){if(t.isNodeView())return!this.renderArea||this.renderArea.isIntersectWithRect(t.cell.getBBox());if(t.isEdgeView()){const e=t.cell,n=e.getSourceCell(),i=e.getTargetCell();if(this.renderArea&&n&&i)return this.renderArea.isIntersectWithRect(n.getBBox())||this.renderArea.isIntersectWithRect(i.getBBox())}return!0}getRenderPriority(t){return t.cell.isNode()?gM.RenderNode:gM.RenderEdge}dispose(){this.stopListening(),Object.keys(this.views).forEach(t=>{this.views[t].view.dispose()}),this.views={}}}yM([C.dispose()],bM.prototype,"dispose",null),function(t){t.FLAG_INSERT=1<<30,t.FLAG_REMOVE=1<<29,t.FLAG_RENDER=67108863}(bM||(bM={})),function(t){let e;(function(t){t[t["CREATED"]=0]="CREATED",t[t["MOUNTED"]=1]="MOUNTED",t[t["WAITING"]=2]="WAITING"})(e=t.ViewState||(t.ViewState={}))}(bM||(bM={}));var vM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class xM extends KE{constructor(){super(...arguments),this.schedule=new bM(this.graph)}requestViewUpdate(t,e,n={}){this.schedule.requestViewUpdate(t,e,n)}isViewMounted(t){return this.schedule.isViewMounted(t)}setRenderArea(t){this.schedule.setRenderArea(t)}findViewByElem(t){if(null==t)return null;const e=this.options.container,n="string"===typeof t?e.querySelector(t):t instanceof Element?t:t[0];if(n){const t=this.graph.view.findAttr("data-cell-id",n);if(t){const e=this.schedule.views;if(e[t])return e[t].view}}return null}findViewByCell(t){if(null==t)return null;const e=EE.isCell(t)?t.id:t,n=this.schedule.views;return n[e]?n[e].view:null}findViewsFromPoint(t){const e={x:t.x,y:t.y};return this.model.getCells().map(t=>this.findViewByCell(t)).filter(t=>null!=t&&cw.getBBox(t.container,{target:this.view.stage}).containsPoint(e))}findEdgeViewsFromPoint(t,e=5){return this.model.getEdges().map(t=>this.findViewByCell(t)).filter(n=>{if(null!=n){const i=n.getClosestPoint(t);if(i)return i.distance(t)<=e}return!1})}findViewsInArea(t,e={}){const n=Tb.create(t);return this.model.getCells().map(t=>this.findViewByCell(t)).filter(t=>{if(t){if(e.nodeOnly&&!t.isNodeView())return!1;const i=cw.getBBox(t.container,{target:this.view.stage});return 0===i.width?i.inflate(1,0):0===i.height&&i.inflate(0,1),e.strict?n.containsRect(i):n.isIntersectWithRect(i)}return!1})}dispose(){this.schedule.dispose()}}vM([KE.dispose()],xM.prototype,"dispose",null);var wM=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class CM extends KE{get cid(){return this.graph.view.cid}get svg(){return this.view.svg}get defs(){return this.view.defs}isDefined(t){return null!=this.svg.getElementById(t)}filter(t){let e=t.id;const n=t.name;if(e||(e=`filter-${n}-${this.cid}-${lf(JSON.stringify(t))}`),!this.isDefined(e)){const i=dv.registry.get(n);if(null==i)return dv.registry.onNotFound(n);const s=i(t.args||{}),r=Object.assign(Object.assign({x:-1,y:-1,width:3,height:3,filterUnits:"objectBoundingBox"},t.attrs),{id:e});ry.create(qw.sanitize(s),r).appendTo(this.defs)}return e}gradient(t){let e=t.id;const n=t.type;if(e||(e=`gradient-${n}-${this.cid}-${lf(JSON.stringify(t))}`),!this.isDefined(e)){const i=t.stops,s=i.map(t=>{const e=null!=t.opacity&&Number.isFinite(t.opacity)?t.opacity:1;return`<stop offset="${t.offset}" stop-color="${t.color}" stop-opacity="${e}"/>`}),r=`<${n}>${s.join("")}</${n}>`,o=Object.assign({id:e},t.attrs);ry.create(r,o).appendTo(this.defs)}return e}marker(t){const{id:e,refX:n,refY:i,markerUnits:s,markerOrient:r,tagName:o,children:a}=t,l=wM(t,["id","refX","refY","markerUnits","markerOrient","tagName","children"]);let c=e;if(c||(c=`marker-${this.cid}-${lf(JSON.stringify(t))}`),!this.isDefined(c)){"path"!==o&&delete l.d;const t=ry.create("marker",{refX:n,refY:i,id:c,overflow:"visible",orient:null!=r?r:"auto",markerUnits:s||"userSpaceOnUse"},a?a.map(t=>{var{tagName:e}=t,n=wM(t,["tagName"]);return ry.create(`${e}`||"path",Am(Object.assign(Object.assign({},l),n)))}):[ry.create(o||"path",Am(l))]);this.defs.appendChild(t.node)}return c}remove(t){const e=this.svg.getElementById(t);e&&e.parentNode&&e.parentNode.removeChild(e)}}class PM extends KE{getClientMatrix(){return Dy(this.view.stage.getScreenCTM())}getClientOffset(){const t=this.view.svg.getBoundingClientRect();return new Nb(t.left,t.top)}getPageOffset(){return this.getClientOffset().translate(window.scrollX,window.scrollY)}snapToGrid(t,e){const n="number"===typeof t?this.clientToLocalPoint(t,e):this.clientToLocalPoint(t.x,t.y);return n.snapToGrid(this.graph.getGridSize())}localToGraphPoint(t,e){const n=Nb.create(t,e);return cw.transformPoint(n,this.graph.matrix())}localToClientPoint(t,e){const n=Nb.create(t,e);return cw.transformPoint(n,this.getClientMatrix())}localToPagePoint(t,e){const n="number"===typeof t?this.localToGraphPoint(t,e):this.localToGraphPoint(t);return n.translate(this.getPageOffset())}localToGraphRect(t,e,n,i){const s=Tb.create(t,e,n,i);return cw.transformRectangle(s,this.graph.matrix())}localToClientRect(t,e,n,i){const s=Tb.create(t,e,n,i);return cw.transformRectangle(s,this.getClientMatrix())}localToPageRect(t,e,n,i){const s="number"===typeof t?this.localToGraphRect(t,e,n,i):this.localToGraphRect(t);return s.translate(this.getPageOffset())}graphToLocalPoint(t,e){const n=Nb.create(t,e);return cw.transformPoint(n,this.graph.matrix().inverse())}clientToLocalPoint(t,e){const n=Nb.create(t,e);return cw.transformPoint(n,this.getClientMatrix().inverse())}clientToGraphPoint(t,e){const n=Nb.create(t,e);return cw.transformPoint(n,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalPoint(t,e){const n=Nb.create(t,e),i=n.diff(this.getPageOffset());return this.graphToLocalPoint(i)}graphToLocalRect(t,e,n,i){const s=Tb.create(t,e,n,i);return cw.transformRectangle(s,this.graph.matrix().inverse())}clientToLocalRect(t,e,n,i){const s=Tb.create(t,e,n,i);return cw.transformRectangle(s,this.getClientMatrix().inverse())}clientToGraphRect(t,e,n,i){const s=Tb.create(t,e,n,i);return cw.transformRectangle(s,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalRect(t,e,n,i){const s=Tb.create(t,e,n,i),r=this.getPageOffset();return s.x-=r.x,s.y-=r.y,this.graphToLocalRect(s)}}var EM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class MM extends KE{constructor(){super(...arguments),this.highlights={}}init(){this.startListening()}startListening(){this.graph.on("cell:highlight",this.onCellHighlight,this),this.graph.on("cell:unhighlight",this.onCellUnhighlight,this)}stopListening(){this.graph.off("cell:highlight",this.onCellHighlight,this),this.graph.off("cell:unhighlight",this.onCellUnhighlight,this)}onCellHighlight({view:t,magnet:e,options:n={}}){const i=this.resolveHighlighter(n);if(!i)return;const s=this.getHighlighterId(e,i);if(!this.highlights[s]){const n=i.highlighter;n.highlight(t,e,Object.assign({},i.args)),this.highlights[s]={cellView:t,magnet:e,highlighter:n,args:i.args}}}onCellUnhighlight({magnet:t,options:e={}}){const n=this.resolveHighlighter(e);if(!n)return;const i=this.getHighlighterId(t,n);this.unhighlight(i)}resolveHighlighter(t){const e=this.options;let n=t.highlighter;if(null==n){const i=t.type;n=i&&e.highlighting[i]||e.highlighting.default}if(null==n)return null;const i="string"===typeof n?{name:n}:n,s=i.name,r=gw.registry.get(s);return null==r?gw.registry.onNotFound(s):(gw.check(s,r),{name:s,highlighter:r,args:i.args||{}})}getHighlighterId(t,e){return Xf(t),e.name+t.id+JSON.stringify(e.args)}unhighlight(t){const e=this.highlights[t];e&&(e.highlighter.unhighlight(e.cellView,e.magnet,e.args),delete this.highlights[t])}dispose(){Object.keys(this.highlights).forEach(t=>this.unhighlight(t)),this.stopListening()}}EM([MM.dispose()],MM.prototype,"dispose",null);var OM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class AM extends KE{getScroller(){const t=this.graph.getPlugin("scroller");return t&&t.options.enabled?t:null}getContainer(){const t=this.getScroller();return t?t.container.parentElement:this.graph.container.parentElement}getSensorTarget(){const t=this.options.autoResize;if(t)return"boolean"===typeof t?this.getContainer():t}init(){const t=this.options.autoResize;if(t){const t=this.getSensorTarget();t&&fb.bind(t,()=>{const e=t.offsetWidth,n=t.offsetHeight;this.resize(e,n)})}}resize(t,e){const n=this.getScroller();n?n.resize(t,e):this.graph.transform.resize(t,e)}dispose(){fb.clear(this.graph.container)}}OM([KE.dispose()],AM.prototype,"dispose",null);var SM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class NM extends Hh{get container(){return this.options.container}get[Symbol.toStringTag](){return NM.toStringTag}constructor(t){super(),this.installedPlugins=new Set,this.options=eM.get(t),this.css=new tM(this),this.view=new YE(this),this.defs=new CM(this),this.coord=new PM(this),this.transform=new oM(this),this.highlight=new MM(this),this.grid=new rM(this),this.background=new lM(this),this.options.model?this.model=this.options.model:(this.model=new LE,this.model.graph=this),this.renderer=new xM(this),this.panning=new hM(this),this.mousewheel=new dM(this),this.virtualRender=new fM(this),this.size=new AM(this)}isNode(t){return t.isNode()}isEdge(t){return t.isEdge()}resetCells(t,e={}){return this.model.resetCells(t,e),this}clearCells(t={}){return this.model.clear(t),this}toJSON(t={}){return this.model.toJSON(t)}parseJSON(t){return this.model.parseJSON(t)}fromJSON(t,e={}){return this.model.fromJSON(t,e),this}getCellById(t){return this.model.getCell(t)}addNode(t,e={}){return this.model.addNode(t,e)}addNodes(t,e={}){return this.addCell(t.map(t=>AE.isNode(t)?t:this.createNode(t)),e)}createNode(t){return this.model.createNode(t)}removeNode(t,e={}){return this.model.removeCell(t,e)}addEdge(t,e={}){return this.model.addEdge(t,e)}addEdges(t,e={}){return this.addCell(t.map(t=>NE.isEdge(t)?t:this.createEdge(t)),e)}removeEdge(t,e={}){return this.model.removeCell(t,e)}createEdge(t){return this.model.createEdge(t)}addCell(t,e={}){return this.model.addCell(t,e),this}removeCell(t,e={}){return this.model.removeCell(t,e)}removeCells(t,e={}){return this.model.removeCells(t,e)}removeConnectedEdges(t,e={}){return this.model.removeConnectedEdges(t,e)}disconnectConnectedEdges(t,e={}){return this.model.disconnectConnectedEdges(t,e),this}hasCell(t){return this.model.has(t)}getCells(){return this.model.getCells()}getCellCount(){return this.model.total()}getNodes(){return this.model.getNodes()}getEdges(){return this.model.getEdges()}getOutgoingEdges(t){return this.model.getOutgoingEdges(t)}getIncomingEdges(t){return this.model.getIncomingEdges(t)}getConnectedEdges(t,e={}){return this.model.getConnectedEdges(t,e)}getRootNodes(){return this.model.getRoots()}getLeafNodes(){return this.model.getLeafs()}isRootNode(t){return this.model.isRoot(t)}isLeafNode(t){return this.model.isLeaf(t)}getNeighbors(t,e={}){return this.model.getNeighbors(t,e)}isNeighbor(t,e,n={}){return this.model.isNeighbor(t,e,n)}getSuccessors(t,e={}){return this.model.getSuccessors(t,e)}isSuccessor(t,e,n={}){return this.model.isSuccessor(t,e,n)}getPredecessors(t,e={}){return this.model.getPredecessors(t,e)}isPredecessor(t,e,n={}){return this.model.isPredecessor(t,e,n)}getCommonAncestor(...t){return this.model.getCommonAncestor(...t)}getSubGraph(t,e={}){return this.model.getSubGraph(t,e)}cloneSubGraph(t,e={}){return this.model.cloneSubGraph(t,e)}cloneCells(t){return this.model.cloneCells(t)}getNodesFromPoint(t,e){return this.model.getNodesFromPoint(t,e)}getNodesInArea(t,e,n,i,s){return this.model.getNodesInArea(t,e,n,i,s)}getNodesUnderNode(t,e={}){return this.model.getNodesUnderNode(t,e)}searchCell(t,e,n={}){return this.model.search(t,e,n),this}getShortestPath(t,e,n={}){return this.model.getShortestPath(t,e,n)}getAllCellsBBox(){return this.model.getAllCellsBBox()}getCellsBBox(t,e={}){return this.model.getCellsBBox(t,e)}startBatch(t,e={}){this.model.startBatch(t,e)}stopBatch(t,e={}){this.model.stopBatch(t,e)}batchUpdate(t,e,n){const i="string"===typeof t?t:"update",s="string"===typeof t?e:t,r="function"===typeof e?n:e;this.startBatch(i,r);const o=s();return this.stopBatch(i,r),o}updateCellId(t,e){return this.model.updateCellId(t,e)}findView(t){return EE.isCell(t)?this.findViewByCell(t):this.findViewByElem(t)}findViews(t){return Tb.isRectangleLike(t)?this.findViewsInArea(t):Nb.isPointLike(t)?this.findViewsFromPoint(t):[]}findViewByCell(t){return this.renderer.findViewByCell(t)}findViewByElem(t){return this.renderer.findViewByElem(t)}findViewsFromPoint(t,e){const n="number"===typeof t?{x:t,y:e}:t;return this.renderer.findViewsFromPoint(n)}findViewsInArea(t,e,n,i,s){const r="number"===typeof t?{x:t,y:e,width:n,height:i}:t,o="number"===typeof t?s:e;return this.renderer.findViewsInArea(r,o)}matrix(t){return"undefined"===typeof t?this.transform.getMatrix():(this.transform.setMatrix(t),this)}resize(t,e){const n=this.getPlugin("scroller");return n?n.resize(t,e):this.transform.resize(t,e),this}scale(t,e=t,n=0,i=0){return"undefined"===typeof t?this.transform.getScale():(this.transform.scale(t,e,n,i),this)}zoom(t,e){const n=this.getPlugin("scroller");if(n){if("undefined"===typeof t)return n.zoom();n.zoom(t,e)}else{if("undefined"===typeof t)return this.transform.getZoom();this.transform.zoom(t,e)}return this}zoomTo(t,e={}){const n=this.getPlugin("scroller");return n?n.zoom(t,Object.assign(Object.assign({},e),{absolute:!0})):this.transform.zoom(t,Object.assign(Object.assign({},e),{absolute:!0})),this}zoomToRect(t,e={}){const n=this.getPlugin("scroller");return n?n.zoomToRect(t,e):this.transform.zoomToRect(t,e),this}zoomToFit(t={}){const e=this.getPlugin("scroller");return e?e.zoomToFit(t):this.transform.zoomToFit(t),this}rotate(t,e,n){return"undefined"===typeof t?this.transform.getRotation():(this.transform.rotate(t,e,n),this)}translate(t,e){return"undefined"===typeof t?this.transform.getTranslation():(this.transform.translate(t,e),this)}translateBy(t,e){const n=this.translate(),i=n.tx+t,s=n.ty+e;return this.translate(i,s)}getGraphArea(){return this.transform.getGraphArea()}getContentArea(t={}){return this.transform.getContentArea(t)}getContentBBox(t={}){return this.transform.getContentBBox(t)}fitToContent(t,e,n,i){return this.transform.fitToContent(t,e,n,i)}scaleContentToFit(t={}){return this.transform.scaleContentToFit(t),this}center(t){return this.centerPoint(t)}centerPoint(t,e,n){const i=this.getPlugin("scroller");return i?i.centerPoint(t,e,n):this.transform.centerPoint(t,e),this}centerContent(t){const e=this.getPlugin("scroller");return e?e.centerContent(t):this.transform.centerContent(t),this}centerCell(t,e){const n=this.getPlugin("scroller");return n?n.centerCell(t,e):this.transform.centerCell(t),this}positionPoint(t,e,n,i={}){const s=this.getPlugin("scroller");return s?s.positionPoint(t,e,n,i):this.transform.positionPoint(t,e,n),this}positionRect(t,e,n){const i=this.getPlugin("scroller");return i?i.positionRect(t,e,n):this.transform.positionRect(t,e),this}positionCell(t,e,n){const i=this.getPlugin("scroller");return i?i.positionCell(t,e,n):this.transform.positionCell(t,e),this}positionContent(t,e){const n=this.getPlugin("scroller");return n?n.positionContent(t,e):this.transform.positionContent(t,e),this}snapToGrid(t,e){return this.coord.snapToGrid(t,e)}pageToLocal(t,e,n,i){return Tb.isRectangleLike(t)?this.coord.pageToLocalRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.pageToLocalRect(t,e,n,i):this.coord.pageToLocalPoint(t,e)}localToPage(t,e,n,i){return Tb.isRectangleLike(t)?this.coord.localToPageRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.localToPageRect(t,e,n,i):this.coord.localToPagePoint(t,e)}clientToLocal(t,e,n,i){return Tb.isRectangleLike(t)?this.coord.clientToLocalRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.clientToLocalRect(t,e,n,i):this.coord.clientToLocalPoint(t,e)}localToClient(t,e,n,i){return Tb.isRectangleLike(t)?this.coord.localToClientRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.localToClientRect(t,e,n,i):this.coord.localToClientPoint(t,e)}localToGraph(t,e,n,i){return Tb.isRectangleLike(t)?this.coord.localToGraphRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.localToGraphRect(t,e,n,i):this.coord.localToGraphPoint(t,e)}graphToLocal(t,e,n,i){return Tb.isRectangleLike(t)?this.coord.graphToLocalRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.graphToLocalRect(t,e,n,i):this.coord.graphToLocalPoint(t,e)}clientToGraph(t,e,n,i){return Tb.isRectangleLike(t)?this.coord.clientToGraphRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.clientToGraphRect(t,e,n,i):this.coord.clientToGraphPoint(t,e)}defineFilter(t){return this.defs.filter(t)}defineGradient(t){return this.defs.gradient(t)}defineMarker(t){return this.defs.marker(t)}getGridSize(){return this.grid.getGridSize()}setGridSize(t){return this.grid.setGridSize(t),this}showGrid(){return this.grid.show(),this}hideGrid(){return this.grid.hide(),this}clearGrid(){return this.grid.clear(),this}drawGrid(t){return this.grid.draw(t),this}updateBackground(){return this.background.update(),this}drawBackground(t,e){const n=this.getPlugin("scroller");return null==n||null!=this.options.background&&e?this.background.draw(t):n.drawBackground(t,e),this}clearBackground(t){const e=this.getPlugin("scroller");return null==e||null!=this.options.background&&t?this.background.clear():e.clearBackground(t),this}enableVirtualRender(){return this.virtualRender.enableVirtualRender(),this}disableVirtualRender(){return this.virtualRender.disableVirtualRender(),this}isMouseWheelEnabled(){return!this.mousewheel.disabled}enableMouseWheel(){return this.mousewheel.enable(),this}disableMouseWheel(){return this.mousewheel.disable(),this}toggleMouseWheel(t){return null==t?this.isMouseWheelEnabled()?this.disableMouseWheel():this.enableMouseWheel():t?this.enableMouseWheel():this.disableMouseWheel(),this}isPannable(){const t=this.getPlugin("scroller");return t?t.isPannable():this.panning.pannable}enablePanning(){const t=this.getPlugin("scroller");return t?t.enablePanning():this.panning.enablePanning(),this}disablePanning(){const t=this.getPlugin("scroller");return t?t.disablePanning():this.panning.disablePanning(),this}togglePanning(t){return null==t?this.isPannable()?this.disablePanning():this.enablePanning():t!==this.isPannable()&&(t?this.enablePanning():this.disablePanning()),this}use(t,...e){return this.installedPlugins.has(t)||(this.installedPlugins.add(t),t.init(this,...e)),this}getPlugin(t){return Array.from(this.installedPlugins).find(e=>e.name===t)}getPlugins(t){return Array.from(this.installedPlugins).filter(e=>t.includes(e.name))}enablePlugins(t){let e=t;Array.isArray(e)||(e=[e]);const n=this.getPlugins(e);return null===n||void 0===n||n.forEach(t=>{var e;null===(e=null===t||void 0===t?void 0:t.enable)||void 0===e||e.call(t)}),this}disablePlugins(t){let e=t;Array.isArray(e)||(e=[e]);const n=this.getPlugins(e);return null===n||void 0===n||n.forEach(t=>{var e;null===(e=null===t||void 0===t?void 0:t.disable)||void 0===e||e.call(t)}),this}isPluginEnabled(t){var e;const n=this.getPlugin(t);return null===(e=null===n||void 0===n?void 0:n.isEnabled)||void 0===e?void 0:e.call(n)}disposePlugins(t){let e=t;Array.isArray(e)||(e=[e]);const n=this.getPlugins(e);return null===n||void 0===n||n.forEach(t=>{t.dispose(),this.installedPlugins.delete(t)}),this}dispose(t=!0){t&&this.model.dispose(),this.css.dispose(),this.defs.dispose(),this.grid.dispose(),this.coord.dispose(),this.transform.dispose(),this.highlight.dispose(),this.background.dispose(),this.mousewheel.dispose(),this.panning.dispose(),this.view.dispose(),this.renderer.dispose(),this.installedPlugins.forEach(t=>{t.dispose()})}}SM([Hh.dispose()],NM.prototype,"dispose",null),function(t){t.View=YE,t.Renderer=xM,t.MouseWheel=dM,t.DefsManager=CM,t.GridManager=rM,t.CoordManager=PM,t.TransformManager=oM,t.HighlightManager=MM,t.BackgroundManager=lM,t.PanningManager=hM}(NM||(NM={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag];return null==n||n===t.toStringTag}t.toStringTag=`X6.${t.name}`,t.isGraph=e}(NM||(NM={})),function(t){function e(e,n){const i=e instanceof HTMLElement?new t({container:e}):new t(e);return null!=n&&i.fromJSON(n),i}t.render=e}(NM||(NM={})),function(t){t.registerNode=AE.registry.register,t.registerEdge=NE.registry.register,t.registerView=eC.registry.register,t.registerAttr=iw.registry.register,t.registerGrid=ov.registry.register,t.registerFilter=dv.registry.register,t.registerNodeTool=OC.registry.register,t.registerEdgeTool=AC.registry.register,t.registerBackground=uv.registry.register,t.registerHighlighter=gw.registry.register,t.registerPortLayout=Aw.registry.register,t.registerPortLabelLayout=Uw.registry.register,t.registerMarker=$x.registry.register,t.registerRouter=QP.registry.register,t.registerConnector=yE.registry.register,t.registerAnchor=JC.registry.register,t.registerEdgeAnchor=QC.registry.register,t.registerConnectionPoint=lP.registry.register}(NM||(NM={})),function(t){t.unregisterNode=AE.registry.unregister,t.unregisterEdge=NE.registry.unregister,t.unregisterView=eC.registry.unregister,t.unregisterAttr=iw.registry.unregister,t.unregisterGrid=ov.registry.unregister,t.unregisterFilter=dv.registry.unregister,t.unregisterNodeTool=OC.registry.unregister,t.unregisterEdgeTool=AC.registry.unregister,t.unregisterBackground=uv.registry.unregister,t.unregisterHighlighter=gw.registry.unregister,t.unregisterPortLayout=Aw.registry.unregister,t.unregisterPortLabelLayout=Uw.registry.unregister,t.unregisterMarker=$x.registry.unregister,t.unregisterRouter=QP.registry.unregister,t.unregisterConnector=yE.registry.unregister,t.unregisterAnchor=JC.registry.unregister,t.unregisterEdgeAnchor=QC.registry.unregister,t.unregisterConnectionPoint=lP.registry.unregister}(NM||(NM={}));var TM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o},kM=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class jM extends AE{}(function(t){class e extends JE{init(){super.init(),this.cell.on("change:*",this.onCellChangeAny,this)}onCellChangeAny({key:e}){const n=t.shapeMaps[this.cell.shape];if(n){const{effect:t}=n;t&&!t.includes(e)||this.renderHTMLComponent()}}confirmUpdate(t){const n=super.confirmUpdate(t);return this.handleAction(n,e.action,()=>this.renderHTMLComponent())}renderHTMLComponent(){const e=this.selectors&&this.selectors.foContent;if(e){um(e);const n=t.shapeMaps[this.cell.shape];if(!n)return;let{html:i}=n;"function"===typeof i&&(i=i(this.cell)),i&&("string"===typeof i?e.innerHTML=i:dm(e,i))}}dispose(){this.cell.off("change:*",this.onCellChangeAny,this)}}TM([e.dispose()],e.prototype,"dispose",null),t.View=e,function(t){t.action="html",t.config({bootstrap:[t.action],actions:{html:t.action}}),JE.registry.register("html-view",t,!0)}(e=t.View||(t.View={}))})(jM||(jM={})),function(t){t.config({view:"html-view",markup:[{tagName:"rect",selector:"body"},Object.assign({},qw.getForeignObjectMarkup()),{tagName:"text",selector:"label"}],attrs:{body:{fill:"none",stroke:"none",refWidth:"100%",refHeight:"100%"},fo:{refWidth:"100%",refHeight:"100%"}}}),AE.registry.register("html",t,!0)}(jM||(jM={})),function(t){function e(e){const{shape:n,html:i,effect:s,inherit:r}=e,o=kM(e,["shape","html","effect","inherit"]);if(!n)throw new Error("should specify shape in config");t.shapeMaps[n]={html:i,effect:s},NM.registerNode(n,Object.assign({inherit:r||"html"},o),!0)}t.shapeMaps={},t.register=e}(jM||(jM={}))},46237:function(t,e,n){"use strict";n.d(e,{B:function(){return r},t:function(){return i}});const i={id:"zh_CN",name:"@vyr/service-graph","graphDrawer.stencil.title":"例程节点"};var s=n(75133);s.Locale.register(i);const r=s.Locale.getLanguage(i.name)},64263:function(t,e,n){"use strict";n.d(e,{G:function(){return x}});var i=n(14291),s=n(67227),r=n(87167),o=n(50931),a=n(86200),l=n(4600),c=Object.defineProperty,h=Object.defineProperties,u=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,f=(t,e,n)=>e in t?c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,m=(t,e)=>{for(var n in e||(e={}))g.call(e,n)&&f(t,n,e[n]);if(d)for(var n of d(e))p.call(e,n)&&f(t,n,e[n]);return t},y=(t,e)=>h(t,u(e)),b=(t,e,n)=>f(t,"symbol"!==typeof e?e+"":e,n);class v{constructor(){b(this,"width","60%"),b(this,"height","60%"),b(this,"visible",!1),b(this,"descriptor",""),b(this,"event",""),b(this,"inputs",{}),b(this,"routine",null)}reset(){this.descriptor="",this.event="",this.inputs={},this.routine=null}}class x extends r.Service{constructor(){super(...arguments),b(this,"_map",new Map),b(this,"_drawer",null),b(this,"state",(0,i.Kh)(new v)),b(this,"routine",null)}get drawer(){return null===this._drawer&&(this._drawer=new l._,this._drawer.stencil.load([new a.Wl({drawer:this._drawer,label:"Execute"}),new a.D0({drawer:this._drawer,label:"Branch"}),new a.oh({drawer:this._drawer,label:"Condition"})],"inspector")),this._drawer}_doNodes(t){for(const e of t)if("Execute"===e.routine){const t=new a.Wl(y(m({},e),{drawer:this.drawer}));this.drawer.graph.addCell(t)}else"Condition"===e.routine?this.drawer.graph.addCell(new a.oh(y(m({},e),{drawer:this.drawer}))):"Branch"===e.routine&&this.drawer.graph.addCell(new a.D0(y(m({},e),{drawer:this.drawer})))}_doMappers(t){for(const e of t){const t=this.drawer.getEdgeOfMapper(e.source,e.target);this.drawer.graph.addEdge(t)}}_diff(t,e){const n=[],i=[],s=[],r=new Map;for(const o of e)r.set(o.id,o);for(const a of t){const t=r.get(a.id);void 0===t?n.push(a):(!1===o.ObjectUtils.equals(a,t)&&s.push(a),r.delete(a.id))}return i.push(...r.values()),{addQueue:n,removeQueue:i,updateQueue:s}}render(t){this.routine=t,this.drawer.needTriggerChange=!1,this._doNodes(t.nodes),this._doMappers(t.mappers),this.drawer.needTriggerChange=!0}update(t){if(null===this.routine)return;this.drawer.needTriggerChange=!1,this.drawer.selectEdge="",this.drawer.history.clean();const e=this.drawer.selection.getSelectedCells(),n=this.drawer.graph.getEdges();for(const r of n)this.drawer.remove(r);const i=this._diff(t.nodes,this.routine.nodes);let s=!1;for(const r of i.removeQueue){const t=this.drawer.graph.getCellById(r.id);t&&(e.includes(t)&&(s=!0),this.drawer.remove(t))}s&&this.drawer.selection.clean(),this._doNodes(i.addQueue);for(const r of i.updateQueue){const t=this.drawer.graph.getCellById(r.id);t&&t.setVMeta(r)}this._doMappers(t.mappers),this.drawer.needTriggerChange=!0,this.routine=t}build(){var t,e;const n=new o.RoutineDescriptor,i=this.drawer.graph.getCells();for(const r of i)if(r instanceof a.ZK){const e={id:r.id,label:null!=(t=r.vMeta.label)?t:"",url:r.vMeta.url,routine:r.vMeta.routine,input:r.vMeta.input,position:r.getPosition()};n.nodes.push(e)}else if(r.isEdge()){const t=this.drawer.getMapper(r);t&&n.mappers.push(t)}const s=this.drawer.graph.getRootNodes();for(const r of s)n.roots.push(r.id);return y(m({},n),{uuid:null==(e=this.routine)?void 0:e.uuid})}get(t){var e;return null!=(e=this._map.get(t))?e:null}keys(){return[...this._map.keys()]}set(t,e){const n=(0,s.$V)({loader:e,timeout:5e3});this._map.set(t,n)}}},86200:function(t,e,n){"use strict";n.d(e,{D0:function(){return m},Wl:function(){return f},ZK:function(){return p},oh:function(){return y}});var i=n(50931),s=n(14246),r=Object.defineProperty,o=Object.defineProperties,a=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,u=(t,e,n)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,d=(t,e)=>{for(var n in e||(e={}))c.call(e,n)&&u(t,n,e[n]);if(l)for(var n of l(e))h.call(e,n)&&u(t,n,e[n]);return t},g=(t,e)=>o(t,a(e));class p extends s.N{constructor(t){super(t),this.vMeta.input=t.input?i.Descriptor.deepClone(t.input):{}}}class f extends p{constructor(t){var e;super(g(d({},t),{maxInCount:1/0,icon:"graphfont graph-execute"})),this.vMeta.routine="Execute",this.vMeta.url=null!=(e=t.url)?e:""}isConnection(t,e){return!1!==s.N.instanceOf(e,[f,y])&&super.isConnection(t,e)}}class m extends p{constructor(t){var e;super(g(d({},t),{maxOutCount:1/0,icon:"graphfont graph-branch"})),this.vMeta.routine="Branch",this.vMeta.url=null!=(e=t.url)?e:""}isConnection(t,e){return!1!==s.N.instanceOf(e,[f,y])&&super.isConnection(t,e)}}class y extends p{constructor(t){var e;super(g(d({input:{value:{type:"string",value:""}}},t),{icon:"graphfont graph-condition"})),this.vMeta.routine="Condition",this.vMeta.url=null!=(e=t.url)?e:""}isConnection(t,e){return!1!==s.N.instanceOf(e,[m])&&super.isConnection(t,e)}}}}]);
1
+ (self["webpackChunk_vyr_cli"]=self["webpackChunk_vyr_cli"]||[]).push([[4263],{4600:function(t,e,n){"use strict";n.d(e,{_:function(){return I}});var i,s=n(50931),r=n(44943),o=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class a extends r.Ss{get graph(){return this.options.graph}get boxClassName(){return this.prefixClassName(i.classNames.box)}get $boxes(){return r.Jf.children(this.container,this.boxClassName)}get handleOptions(){return this.options}constructor(t){super(),this.options=t,this.options.model&&(this.options.collection=this.options.model.collection),this.options.collection?this.collection=this.options.collection:(this.collection=new r.pM([],{comparator:i.depthComparator}),this.options.collection=this.collection),this.boxCount=0,this.createContainer(),this.startListening()}startListening(){const t=this.graph,e=this.collection;this.delegateEvents({[`mousedown .${this.boxClassName}`]:"onSelectionBoxMouseDown",[`touchstart .${this.boxClassName}`]:"onSelectionBoxMouseDown"},!0),t.on("scale",this.onGraphTransformed,this),t.on("translate",this.onGraphTransformed,this),t.model.on("updated",this.onModelUpdated,this),e.on("added",this.onCellAdded,this),e.on("removed",this.onCellRemoved,this),e.on("reseted",this.onReseted,this),e.on("updated",this.onCollectionUpdated,this),e.on("node:change:position",this.onNodePositionChanged,this),e.on("cell:changed",this.onCellChanged,this)}stopListening(){const t=this.graph,e=this.collection;this.undelegateEvents(),t.off("scale",this.onGraphTransformed,this),t.off("translate",this.onGraphTransformed,this),t.model.off("updated",this.onModelUpdated,this),e.off("added",this.onCellAdded,this),e.off("removed",this.onCellRemoved,this),e.off("reseted",this.onReseted,this),e.off("updated",this.onCollectionUpdated,this),e.off("node:change:position",this.onNodePositionChanged,this),e.off("cell:changed",this.onCellChanged,this)}onRemove(){this.stopListening()}onGraphTransformed(){this.updateSelectionBoxes()}onCellChanged(){this.updateSelectionBoxes()}onNodePositionChanged({node:t,options:e}){const{showNodeSelectionBox:n,pointerEvents:i}=this.options,{ui:s,selection:r,translateBy:o,snapped:a}=e,l=(!0!==n||i&&"none"===this.getPointerEventsValue(i))&&!this.translating&&!r,c=s&&o&&t.id===o;if(l&&(c||a)){this.translating=!0;const n=t.position(),i=t.previous("position"),s=n.x-i.x,r=n.y-i.y;0===s&&0===r||this.translateSelectedNodes(s,r,t,e),this.translating=!1}}onModelUpdated({removed:t}){t&&t.length&&this.unselect(t)}isEmpty(){return this.length<=0}isSelected(t){return this.collection.has(t)}get length(){return this.collection.length}get cells(){return this.collection.toArray()}select(t,e={}){e.dryrun=!0;const n=this.filter(Array.isArray(t)?t:[t]);return this.collection.add(n,e),this}unselect(t,e={}){return e.dryrun=!0,this.collection.remove(Array.isArray(t)?t:[t],e),this}reset(t,e={}){if(t){if(e.batch){const n=this.filter(Array.isArray(t)?t:[t]);return this.collection.reset(n,Object.assign(Object.assign({},e),{ui:!0})),this}const n=this.cells,i=this.filter(Array.isArray(t)?t:[t]),s={},r={};n.forEach(t=>s[t.id]=t),i.forEach(t=>r[t.id]=t);const o=[],a=[];return i.forEach(t=>{s[t.id]||o.push(t)}),n.forEach(t=>{r[t.id]||a.push(t)}),a.length&&this.unselect(a,Object.assign(Object.assign({},e),{ui:!0})),o.length&&this.select(o,Object.assign(Object.assign({},e),{ui:!0})),0===a.length&&0===o.length&&this.updateContainer(),this}return this.clean(e)}clean(t={}){return this.length&&(!1===t.batch?this.unselect(this.cells,t):this.collection.reset([],Object.assign(Object.assign({},t),{ui:!0}))),this}setFilter(t){this.options.filter=t}setContent(t){this.options.content=t}startSelecting(t){let e,n;t=this.normalizeEvent(t),this.clean();const s=this.graph.container;if(null!=t.offsetX&&null!=t.offsetY&&s.contains(t.target))e=t.offsetX,n=t.offsetY;else{const i=r.Jf.offset(s),o=s.scrollLeft,a=s.scrollTop;e=t.clientX-i.left+window.pageXOffset+o,n=t.clientY-i.top+window.pageYOffset+a}r.Jf.css(this.container,{top:n,left:e,width:1,height:1}),this.setEventData(t,{action:"selecting",clientX:t.clientX,clientY:t.clientY,offsetX:e,offsetY:n,scrollerX:0,scrollerY:0,moving:!1}),this.delegateDocumentEvents(i.documentEvents,t.data)}filter(t){const e=this.options.filter;return t.filter(t=>Array.isArray(e)?e.some(e=>"string"===typeof e?t.shape===e:t.id===e.id):"function"!==typeof e||r.eY.call(e,this.graph,t))}stopSelecting(t){const e=this.graph,n=this.getEventData(t),i=n.action;switch(i){case"selecting":{let t=r.Jf.width(this.container),n=r.Jf.height(this.container);const i=r.Jf.offset(this.container),s=e.pageToLocal(i.left,i.top),o=e.transform.getScale();t/=o.sx,n/=o.sy;const a=new r.M_(s.x,s.y,t,n),l=this.getCellViewsInArea(a).map(t=>t.cell);this.reset(l,{batch:!0}),this.hideRubberband();break}case"translating":{const i=e.snapToGrid(t.clientX,t.clientY);if(!this.options.following){const t=n;this.updateSelectedNodesPosition({dx:t.clientX-t.originX,dy:t.clientY-t.originY})}this.graph.model.stopBatch("move-selection"),this.notifyBoxEvent("box:mouseup",t,i.x,i.y);break}default:this.clean();break}}onMouseUp(t){const e=this.getEventData(t).action;e&&(this.stopSelecting(t),this.undelegateDocumentEvents())}onSelectionBoxMouseDown(t){this.options.following||t.stopPropagation();const e=this.normalizeEvent(t);this.options.movable&&this.startTranslating(e);const n=this.getCellViewFromElem(e.target);this.setEventData(e,{activeView:n});const s=this.graph.snapToGrid(e.clientX,e.clientY);this.notifyBoxEvent("box:mousedown",e,s.x,s.y),this.delegateDocumentEvents(i.documentEvents,e.data)}startTranslating(t){this.graph.model.startBatch("move-selection");const e=this.graph.snapToGrid(t.clientX,t.clientY);this.setEventData(t,{action:"translating",clientX:e.x,clientY:e.y,originX:e.x,originY:e.y})}getRestrictArea(){const t=this.graph.options.translating.restrict,e="function"===typeof t?r.eY.call(t,this.graph,null):t;return"number"===typeof e?this.graph.transform.getGraphArea().inflate(e):!0===e?this.graph.transform.getGraphArea():e||null}getSelectionOffset(t,e){let n=t.x-e.clientX,i=t.y-e.clientY;const s=this.getRestrictArea();if(s){const o=this.collection.toArray(),a=r.fh.getCellsBBox(o,{deep:!0})||r.M_.create(),l=s.x-a.x,c=s.y-a.y,h=s.x+s.width-(a.x+a.width),u=s.y+s.height-(a.y+a.height);if(n<l&&(n=l),i<c&&(i=c),h<n&&(n=h),u<i&&(i=u),!this.options.following){const s=t.x-e.originX,r=t.y-e.originY;n=s<=l||s>=h?0:n,i=r<=c||r>=u?0:i}}return{dx:n,dy:i}}updateElementPosition(t,e,n){const i=r.Jf.css(t,"left"),s=r.Jf.css(t,"top"),o=i?parseFloat(i):0,a=s?parseFloat(s):0;r.Jf.css(t,"left",o+e),r.Jf.css(t,"top",a+n)}updateSelectedNodesPosition(t){const{dx:e,dy:n}=t;if(e||n)if(this.translateSelectedNodes(e,n),this.boxesUpdated)this.collection.length>1&&this.updateSelectionBoxes();else{const t=this.graph.transform.getScale();for(let i=0,s=this.$boxes,r=s.length;i<r;i+=1)this.updateElementPosition(s[i],e*t.sx,n*t.sy);this.updateElementPosition(this.selectionContainer,e*t.sx,n*t.sy)}}autoScrollGraph(t,e){const n=this.graph.getPlugin("scroller");return n?n.autoScroll(t,e):{scrollerX:0,scrollerY:0}}adjustSelection(t){const e=this.normalizeEvent(t),n=this.getEventData(e),i=n.action;switch(i){case"selecting":{const t=n;!0!==t.moving&&(r.Jf.appendTo(this.container,this.graph.container),this.showRubberband(),t.moving=!0);const{scrollerX:i,scrollerY:s}=this.autoScrollGraph(e.clientX,e.clientY);t.scrollerX+=i,t.scrollerY+=s;const o=e.clientX-t.clientX+t.scrollerX,a=e.clientY-t.clientY+t.scrollerY,l=parseInt(r.Jf.css(this.container,"left")||"0",10),c=parseInt(r.Jf.css(this.container,"top")||"0",10);r.Jf.css(this.container,{left:o<0?t.offsetX+o:l,top:a<0?t.offsetY+a:c,width:Math.abs(o),height:Math.abs(a)});break}case"translating":{const i=this.graph.snapToGrid(e.clientX,e.clientY),s=n,r=this.getSelectionOffset(i,s);this.options.following?this.updateSelectedNodesPosition(r):this.updateContainerPosition(r),r.dx&&(s.clientX=i.x),r.dy&&(s.clientY=i.y),this.notifyBoxEvent("box:mousemove",t,i.x,i.y);break}default:break}this.boxesUpdated=!1}translateSelectedNodes(t,e,n,i){const s={},r=[];if(n&&(s[n.id]=!0),this.collection.toArray().forEach(t=>{t.getDescendants({deep:!0}).forEach(t=>{s[t.id]=!0})}),i&&i.translateBy){const t=this.graph.getCellById(i.translateBy);t&&(s[t.id]=!0,t.getDescendants({deep:!0}).forEach(t=>{s[t.id]=!0}),r.push(t))}this.collection.toArray().forEach(n=>{if(!s[n.id]){const o=Object.assign(Object.assign({},i),{selection:this.cid,exclude:r});n.translate(t,e,o),this.graph.model.getConnectedEdges(n).forEach(n=>{s[n.id]||(n.translate(t,e,o),s[n.id]=!0)})}})}getCellViewsInArea(t){const e=this.graph,n={strict:this.options.strict};let i=[];return this.options.rubberNode&&(i=i.concat(e.model.getNodesInArea(t,n).map(t=>e.renderer.findViewByCell(t)).filter(t=>null!=t))),this.options.rubberEdge&&(i=i.concat(e.model.getEdgesInArea(t,n).map(t=>e.renderer.findViewByCell(t)).filter(t=>null!=t))),i}notifyBoxEvent(t,e,n,i){const s=this.getEventData(e),r=s.activeView;this.trigger(t,{e:e,view:r,x:n,y:i,cell:r.cell})}getSelectedClassName(t){return this.prefixClassName((t.isNode()?"node":"edge")+"-selected")}addCellSelectedClassName(t){const e=this.graph.renderer.findViewByCell(t);e&&e.addClass(this.getSelectedClassName(t))}removeCellUnSelectedClassName(t){const e=this.graph.renderer.findViewByCell(t);e&&e.removeClass(this.getSelectedClassName(t))}destroySelectionBox(t){this.removeCellUnSelectedClassName(t),this.canShowSelectionBox(t)&&(r.Jf.remove(this.container.querySelector(`[data-cell-id="${t.id}"]`)),0===this.$boxes.length&&this.hide(),this.boxCount=Math.max(0,this.boxCount-1))}destroyAllSelectionBoxes(t){t.forEach(t=>this.removeCellUnSelectedClassName(t)),this.hide(),r.Jf.remove(this.$boxes),this.boxCount=0}hide(){r.Jf.removeClass(this.container,this.prefixClassName(i.classNames.rubberband)),r.Jf.removeClass(this.container,this.prefixClassName(i.classNames.selected))}showRubberband(){r.Jf.addClass(this.container,this.prefixClassName(i.classNames.rubberband))}hideRubberband(){r.Jf.removeClass(this.container,this.prefixClassName(i.classNames.rubberband))}showSelected(){r.Jf.removeAttribute(this.container,"style"),r.Jf.addClass(this.container,this.prefixClassName(i.classNames.selected))}createContainer(){this.container=document.createElement("div"),r.Jf.addClass(this.container,this.prefixClassName(i.classNames.root)),this.options.className&&r.Jf.addClass(this.container,this.options.className),this.selectionContainer=document.createElement("div"),r.Jf.addClass(this.selectionContainer,this.prefixClassName(i.classNames.inner)),this.selectionContent=document.createElement("div"),r.Jf.addClass(this.selectionContent,this.prefixClassName(i.classNames.content)),r.Jf.append(this.selectionContainer,this.selectionContent),r.Jf.attr(this.selectionContainer,"data-selection-length",this.collection.length),r.Jf.prepend(this.container,this.selectionContainer)}updateContainerPosition(t){(t.dx||t.dy)&&this.updateElementPosition(this.selectionContainer,t.dx,t.dy)}updateContainer(){const t={x:1/0,y:1/0},e={x:0,y:0},n=this.collection.toArray().filter(t=>this.canShowSelectionBox(t));n.forEach(n=>{const i=this.graph.renderer.findViewByCell(n);if(i){const n=i.getBBox({useCellGeometry:!0});t.x=Math.min(t.x,n.x),t.y=Math.min(t.y,n.y),e.x=Math.max(e.x,n.x+n.width),e.y=Math.max(e.y,n.y+n.height)}}),r.Jf.css(this.selectionContainer,{position:"absolute",pointerEvents:"none",left:t.x,top:t.y,width:e.x-t.x,height:e.y-t.y}),r.Jf.attr(this.selectionContainer,"data-selection-length",this.collection.length);const i=this.options.content;if(i)if("function"===typeof i){const t=r.eY.call(i,this.graph,this,this.selectionContent);t&&(this.selectionContent.innerHTML=t)}else this.selectionContent.innerHTML=i;this.collection.length>0&&!this.container.parentNode?r.Jf.appendTo(this.container,this.graph.container):this.collection.length<=0&&this.container.parentNode&&this.container.parentNode.removeChild(this.container)}canShowSelectionBox(t){return t.isNode()&&!0===this.options.showNodeSelectionBox||t.isEdge()&&!0===this.options.showEdgeSelectionBox}getPointerEventsValue(t){return"string"===typeof t?t:t(this.cells)}createSelectionBox(t){if(this.addCellSelectedClassName(t),this.canShowSelectionBox(t)){const e=this.graph.renderer.findViewByCell(t);if(e){const n=e.getBBox({useCellGeometry:!0}),i=this.boxClassName,s=document.createElement("div"),o=this.options.pointerEvents;r.Jf.addClass(s,i),r.Jf.addClass(s,`${i}-${t.isNode()?"node":"edge"}`),r.Jf.attr(s,"data-cell-id",t.id),r.Jf.css(s,{position:"absolute",left:n.x,top:n.y,width:n.width,height:n.height,pointerEvents:o?this.getPointerEventsValue(o):"auto"}),r.Jf.appendTo(s,this.container),this.showSelected(),this.boxCount+=1}}}updateSelectionBoxes(){this.collection.length>0&&(this.boxesUpdated=!0,this.confirmUpdate())}confirmUpdate(){if(this.boxCount){this.hide();for(let t=0,e=this.$boxes,n=e.length;t<n;t+=1){const n=e[t],i=r.Jf.attr(n,"data-cell-id");r.Jf.remove(n),this.boxCount-=1;const s=this.collection.get(i);s&&this.createSelectionBox(s)}this.updateContainer()}return 0}getCellViewFromElem(t){const e=t.getAttribute("data-cell-id");if(e){const t=this.collection.get(e);if(t)return this.graph.renderer.findViewByCell(t)}return null}onCellRemoved({cell:t}){this.destroySelectionBox(t),this.updateContainer()}onReseted({previous:t,current:e}){this.destroyAllSelectionBoxes(t),e.forEach(t=>{this.listenCellRemoveEvent(t),this.createSelectionBox(t)}),this.updateContainer()}onCellAdded({cell:t}){this.listenCellRemoveEvent(t),this.createSelectionBox(t),this.updateContainer()}listenCellRemoveEvent(t){t.off("removed",this.onCellRemoved,this),t.on("removed",this.onCellRemoved,this)}onCollectionUpdated({added:t,removed:e,options:n}){t.forEach(t=>{this.trigger("cell:selected",{cell:t,options:n}),t.isNode()?this.trigger("node:selected",{cell:t,options:n,node:t}):t.isEdge()&&this.trigger("edge:selected",{cell:t,options:n,edge:t})}),e.forEach(t=>{this.trigger("cell:unselected",{cell:t,options:n}),t.isNode()?this.trigger("node:unselected",{cell:t,options:n,node:t}):t.isEdge()&&this.trigger("edge:unselected",{cell:t,options:n,edge:t})});const i={added:t,removed:e,options:n,selected:this.cells.filter(t=>!!this.graph.getCellById(t.id))};this.trigger("selection:changed",i)}dispose(){this.clean(),this.remove(),this.off()}}o([r.Ss.dispose()],a.prototype,"dispose",null),function(t){const e="widget-selection";function n(t){return t.getAncestors().length}t.classNames={root:e,inner:`${e}-inner`,box:`${e}-box`,content:`${e}-content`,rubberband:`${e}-rubberband`,selected:`${e}-selected`},t.documentEvents={mousemove:"adjustSelection",touchmove:"adjustSelection",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},t.depthComparator=n}(i||(i={}));const l=".x6-widget-selection {\n position: absolute;\n top: 0;\n left: 0;\n display: none;\n width: 0;\n height: 0;\n touch-action: none;\n}\n.x6-widget-selection-rubberband {\n display: block;\n overflow: visible;\n opacity: 0.3;\n}\n.x6-widget-selection-selected {\n display: block;\n}\n.x6-widget-selection-box {\n cursor: move;\n}\n.x6-widget-selection-inner[data-selection-length='0'],\n.x6-widget-selection-inner[data-selection-length='1'] {\n display: none;\n}\n.x6-widget-selection-content {\n position: absolute;\n top: 100%;\n right: -20px;\n left: -20px;\n margin-top: 30px;\n padding: 6px;\n line-height: 14px;\n text-align: center;\n border-radius: 6px;\n}\n.x6-widget-selection-content:empty {\n display: none;\n}\n.x6-widget-selection-rubberband {\n background-color: #3498db;\n border: 2px solid #2980b9;\n}\n.x6-widget-selection-box {\n box-sizing: content-box !important;\n margin-top: -4px;\n margin-left: -4px;\n padding-right: 4px;\n padding-bottom: 4px;\n border: 2px dashed #feb663;\n box-shadow: 2px 2px 5px #d3d3d3;\n}\n.x6-widget-selection-inner {\n box-sizing: content-box !important;\n margin-top: -8px;\n margin-left: -8px;\n padding-right: 12px;\n padding-bottom: 12px;\n border: 2px solid #feb663;\n box-shadow: 2px 2px 5px #d3d3d3;\n}\n.x6-widget-selection-content {\n color: #fff;\n font-size: 10px;\n background-color: #6a6b8a;\n}\n";r.ke.prototype.isSelectionEnabled=function(){const t=this.getPlugin("selection");return!!t&&t.isEnabled()},r.ke.prototype.enableSelection=function(){const t=this.getPlugin("selection");return t&&t.enable(),this},r.ke.prototype.disableSelection=function(){const t=this.getPlugin("selection");return t&&t.disable(),this},r.ke.prototype.toggleSelection=function(t){const e=this.getPlugin("selection");return e&&e.toggleEnabled(t),this},r.ke.prototype.isMultipleSelection=function(){const t=this.getPlugin("selection");return!!t&&t.isMultipleSelection()},r.ke.prototype.enableMultipleSelection=function(){const t=this.getPlugin("selection");return t&&t.enableMultipleSelection(),this},r.ke.prototype.disableMultipleSelection=function(){const t=this.getPlugin("selection");return t&&t.disableMultipleSelection(),this},r.ke.prototype.toggleMultipleSelection=function(t){const e=this.getPlugin("selection");return e&&e.toggleMultipleSelection(t),this},r.ke.prototype.isSelectionMovable=function(){const t=this.getPlugin("selection");return!!t&&t.isSelectionMovable()},r.ke.prototype.enableSelectionMovable=function(){const t=this.getPlugin("selection");return t&&t.enableSelectionMovable(),this},r.ke.prototype.disableSelectionMovable=function(){const t=this.getPlugin("selection");return t&&t.disableSelectionMovable(),this},r.ke.prototype.toggleSelectionMovable=function(t){const e=this.getPlugin("selection");return e&&e.toggleSelectionMovable(t),this},r.ke.prototype.isRubberbandEnabled=function(){const t=this.getPlugin("selection");return!!t&&t.isRubberbandEnabled()},r.ke.prototype.enableRubberband=function(){const t=this.getPlugin("selection");return t&&t.enableRubberband(),this},r.ke.prototype.disableRubberband=function(){const t=this.getPlugin("selection");return t&&t.disableRubberband(),this},r.ke.prototype.toggleRubberband=function(t){const e=this.getPlugin("selection");return e&&e.toggleRubberband(t),this},r.ke.prototype.isStrictRubberband=function(){const t=this.getPlugin("selection");return!!t&&t.isStrictRubberband()},r.ke.prototype.enableStrictRubberband=function(){const t=this.getPlugin("selection");return t&&t.enableStrictRubberband(),this},r.ke.prototype.disableStrictRubberband=function(){const t=this.getPlugin("selection");return t&&t.disableStrictRubberband(),this},r.ke.prototype.toggleStrictRubberband=function(t){const e=this.getPlugin("selection");return e&&e.toggleStrictRubberband(t),this},r.ke.prototype.setRubberbandModifiers=function(t){const e=this.getPlugin("selection");return e&&e.setRubberbandModifiers(t),this},r.ke.prototype.setSelectionFilter=function(t){const e=this.getPlugin("selection");return e&&e.setSelectionFilter(t),this},r.ke.prototype.setSelectionDisplayContent=function(t){const e=this.getPlugin("selection");return e&&e.setSelectionDisplayContent(t),this},r.ke.prototype.isSelectionEmpty=function(){const t=this.getPlugin("selection");return!t||t.isEmpty()},r.ke.prototype.cleanSelection=function(t){const e=this.getPlugin("selection");return e&&e.clean(t),this},r.ke.prototype.resetSelection=function(t,e){const n=this.getPlugin("selection");return n&&n.reset(t,e),this},r.ke.prototype.getSelectedCells=function(){const t=this.getPlugin("selection");return t?t.getSelectedCells():[]},r.ke.prototype.getSelectedCellCount=function(){const t=this.getPlugin("selection");return t?t.getSelectedCellCount():0},r.ke.prototype.isSelected=function(t){const e=this.getPlugin("selection");return!!e&&e.isSelected(t)},r.ke.prototype.select=function(t,e){const n=this.getPlugin("selection");return n&&n.select(t,e),this},r.ke.prototype.unselect=function(t,e){const n=this.getPlugin("selection");return n&&n.unselect(t,e),this};var c=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class h extends r.Nb{get rubberbandDisabled(){return!0!==this.options.enabled||!0!==this.options.rubberband}get disabled(){return!0!==this.options.enabled}get length(){return this.selectionImpl.length}get cells(){return this.selectionImpl.cells}constructor(t={}){super(),this.name="selection",this.movedMap=new WeakMap,this.unselectMap=new WeakMap,this.options=Object.assign(Object.assign({enabled:!0},h.defaultOptions),t),r.H.ensure(this.name,l)}init(t){this.graph=t,this.selectionImpl=new a(Object.assign(Object.assign({},this.options),{graph:t})),this.setup(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(t){return null!=t?t!==this.isEnabled()&&(t?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}isMultipleSelection(){return this.isMultiple()}enableMultipleSelection(){return this.enableMultiple(),this}disableMultipleSelection(){return this.disableMultiple(),this}toggleMultipleSelection(t){return null!=t?t!==this.isMultipleSelection()&&(t?this.enableMultipleSelection():this.disableMultipleSelection()):this.isMultipleSelection()?this.disableMultipleSelection():this.enableMultipleSelection(),this}isSelectionMovable(){return!1!==this.options.movable}enableSelectionMovable(){return this.selectionImpl.options.movable=!0,this}disableSelectionMovable(){return this.selectionImpl.options.movable=!1,this}toggleSelectionMovable(t){return null!=t?t!==this.isSelectionMovable()&&(t?this.enableSelectionMovable():this.disableSelectionMovable()):this.isSelectionMovable()?this.disableSelectionMovable():this.enableSelectionMovable(),this}isRubberbandEnabled(){return!this.rubberbandDisabled}enableRubberband(){return this.rubberbandDisabled&&(this.options.rubberband=!0),this}disableRubberband(){return this.rubberbandDisabled||(this.options.rubberband=!1),this}toggleRubberband(t){return null!=t?t!==this.isRubberbandEnabled()&&(t?this.enableRubberband():this.disableRubberband()):this.isRubberbandEnabled()?this.disableRubberband():this.enableRubberband(),this}isStrictRubberband(){return!0===this.selectionImpl.options.strict}enableStrictRubberband(){return this.selectionImpl.options.strict=!0,this}disableStrictRubberband(){return this.selectionImpl.options.strict=!1,this}toggleStrictRubberband(t){return null!=t?t!==this.isStrictRubberband()&&(t?this.enableStrictRubberband():this.disableStrictRubberband()):this.isStrictRubberband()?this.disableStrictRubberband():this.enableStrictRubberband(),this}setRubberbandModifiers(t){this.setModifiers(t)}setSelectionFilter(t){return this.setFilter(t),this}setSelectionDisplayContent(t){return this.setContent(t),this}isEmpty(){return this.length<=0}clean(t={}){return this.selectionImpl.clean(t),this}reset(t,e={}){return this.selectionImpl.reset(t?this.getCells(t):[],e),this}getSelectedCells(){return this.cells}getSelectedCellCount(){return this.length}isSelected(t){return this.selectionImpl.isSelected(t)}select(t,e={}){const n=this.getCells(t);return n.length&&(this.isMultiple()?this.selectionImpl.select(n,e):this.reset(n.slice(0,1),e)),this}unselect(t,e={}){return this.selectionImpl.unselect(this.getCells(t),e),this}setup(){this.selectionImpl.on("*",(t,e)=>{this.trigger(t,e),this.graph.trigger(t,e)})}startListening(){this.graph.on("blank:mousedown",this.onBlankMouseDown,this),this.graph.on("blank:click",this.onBlankClick,this),this.graph.on("cell:mousemove",this.onCellMouseMove,this),this.graph.on("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.on("box:mousedown",this.onBoxMouseDown,this)}stopListening(){this.graph.off("blank:mousedown",this.onBlankMouseDown,this),this.graph.off("blank:click",this.onBlankClick,this),this.graph.off("cell:mousemove",this.onCellMouseMove,this),this.graph.off("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.off("box:mousedown",this.onBoxMouseDown,this)}onBlankMouseDown({e:t}){if(!this.allowBlankMouseDown(t))return;const e=this.graph.panning.allowPanning(t,!0),n=this.graph.getPlugin("scroller"),i=n&&n.allowPanning(t,!0);(this.allowRubberband(t,!0)||this.allowRubberband(t)&&!i&&!e)&&this.startRubberband(t)}allowBlankMouseDown(t){const e=this.options.eventTypes;return(null===e||void 0===e?void 0:e.includes("leftMouseDown"))&&0===t.button||(null===e||void 0===e?void 0:e.includes("mouseWheelDown"))&&1===t.button}onBlankClick(){this.clean()}allowRubberband(t,e){return!this.rubberbandDisabled&&r.xH.isMatch(t,this.options.modifiers,e)}allowMultipleSelection(t){return this.isMultiple()&&r.xH.isMatch(t,this.options.multipleSelectionModifiers)}onCellMouseMove({cell:t}){this.movedMap.set(t,!0)}onCellMouseUp({e:t,cell:e}){const n=this.options;let i=this.disabled;!i&&this.movedMap.has(e)&&(i=!1===n.selectCellOnMoved,i||(i=!1===n.selectNodeOnMoved&&e.isNode()),i||(i=!1===n.selectEdgeOnMoved&&e.isEdge())),i||(this.allowMultipleSelection(t)?this.unselectMap.has(e)?this.unselectMap.delete(e):this.isSelected(e)?this.unselect(e):this.select(e):this.reset(e)),this.movedMap.delete(e)}onBoxMouseDown({e:t,cell:e}){this.disabled||this.allowMultipleSelection(t)&&(this.unselect(e),this.unselectMap.set(e,!0))}getCells(t){return(Array.isArray(t)?t:[t]).map(t=>"string"===typeof t?this.graph.getCellById(t):t).filter(t=>null!=t)}startRubberband(t){return this.rubberbandDisabled||this.selectionImpl.startSelecting(t),this}isMultiple(){return!1!==this.options.multiple}enableMultiple(){return this.options.multiple=!0,this}disableMultiple(){return this.options.multiple=!1,this}setModifiers(t){return this.options.modifiers=t,this}setContent(t){return this.selectionImpl.setContent(t),this}setFilter(t){return this.selectionImpl.setFilter(t),this}dispose(){this.stopListening(),this.off(),this.selectionImpl.dispose(),r.H.clean(this.name)}}c([r.Nb.dispose()],h.prototype,"dispose",null),function(t){t.defaultOptions={rubberband:!1,rubberNode:!0,rubberEdge:!1,pointerEvents:"auto",multiple:!0,multipleSelectionModifiers:["ctrl","meta"],movable:!0,strict:!1,selectCellOnMoved:!1,selectNodeOnMoved:!1,selectEdgeOnMoved:!1,following:!0,content:null,eventTypes:["leftMouseDown","mouseWheelDown"]}}(h||(h={}));const u=".x6-widget-dnd {\n position: absolute;\n top: -10000px;\n left: -10000px;\n z-index: 999999;\n display: none;\n cursor: move;\n opacity: 0.7;\n pointer-events: 'cursor';\n}\n.x6-widget-dnd.dragging {\n display: inline-block;\n}\n.x6-widget-dnd.dragging * {\n pointer-events: none !important;\n}\n.x6-widget-dnd .x6-graph {\n background: transparent;\n box-shadow: none;\n}\n";var d,g=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class p extends r.Ss{get targetScroller(){const t=this.options.target,e=t.getPlugin("scroller");return e}get targetGraph(){return this.options.target}get targetModel(){return this.targetGraph.model}get snapline(){const t=this.options.target,e=t.getPlugin("snapline");return e}constructor(t){super(),this.name="dnd",this.options=Object.assign(Object.assign({},p.defaults),t),this.init()}init(){r.H.ensure(this.name,u),this.container=document.createElement("div"),r.Jf.addClass(this.container,this.prefixClassName("widget-dnd")),this.draggingGraph=new r.ke(Object.assign(Object.assign({},this.options.delegateGraphOptions),{container:document.createElement("div"),width:1,height:1,async:!1})),r.Jf.append(this.container,this.draggingGraph.container)}start(t,e){const n=e;n.preventDefault(),this.targetModel.startBatch("dnd"),r.Jf.addClass(this.container,"dragging"),r.Jf.appendTo(this.container,this.options.draggingContainer||document.body),this.sourceNode=t,this.prepareDragging(t,n.clientX,n.clientY);const i=this.updateNodePosition(n.clientX,n.clientY);this.isSnaplineEnabled()&&(this.snapline.captureCursorOffset({e:n,node:t,cell:t,view:this.draggingView,x:i.x,y:i.y}),this.draggingNode.on("change:position",this.snap,this)),this.delegateDocumentEvents(p.documentEvents,n.data)}isSnaplineEnabled(){return this.snapline&&this.snapline.isEnabled()}prepareDragging(t,e,n){const i=this.draggingGraph,s=i.model,r=this.options.getDragNode(t,{sourceNode:t,draggingGraph:i,targetGraph:this.targetGraph});r.position(0,0);let o=5;if(this.isSnaplineEnabled()&&(o+=this.snapline.options.tolerance||0),this.isSnaplineEnabled()||this.options.scaled){const t=this.targetGraph.transform.getScale();i.scale(t.sx,t.sy),o*=Math.max(t.sx,t.sy)}else i.scale(1,1);this.clearDragging(),s.resetCells([r]);const a=i.findViewByCell(r);a.undelegateEvents(),a.cell.off("changed"),i.fitToContent({padding:o,allowNewOrigin:"any",useCellGeometry:!1});const l=a.getBBox();this.geometryBBox=a.getBBox({useCellGeometry:!0}),this.delta=this.geometryBBox.getTopLeft().diff(l.getTopLeft()),this.draggingNode=r,this.draggingView=a,this.draggingBBox=r.getBBox(),this.padding=o,this.originOffset=this.updateGraphPosition(e,n)}updateGraphPosition(t,e){const n=document.body.scrollTop||document.documentElement.scrollTop,i=document.body.scrollLeft||document.documentElement.scrollLeft,s=this.delta,o=this.geometryBBox,a=this.padding||5,l={left:t-s.x-o.width/2-a+i,top:e-s.y-o.height/2-a+n};return this.draggingGraph&&r.Jf.css(this.container,{left:`${l.left}px`,top:`${l.top}px`}),l}updateNodePosition(t,e){const n=this.targetGraph.clientToLocal(t,e),i=this.draggingBBox;return n.x-=i.width/2,n.y-=i.height/2,this.draggingNode.position(n.x,n.y),n}snap({cell:t,current:e,options:n}){const i=t;if(n.snapped){const t=this.draggingBBox;i.position(t.x+n.tx,t.y+n.ty,{silent:!0}),this.draggingView.translate(),i.position(e.x,e.y,{silent:!0}),this.snapOffset={x:n.tx,y:n.ty}}else this.snapOffset=null}onDragging(t){const e=this.draggingView;if(e){t.preventDefault();const n=this.normalizeEvent(t),i=n.clientX,s=n.clientY;this.updateGraphPosition(i,s);const r=this.updateNodePosition(i,s),o=this.targetGraph.options.embedding.enabled,a=(o||this.isSnaplineEnabled())&&this.isInsideValidArea({x:i,y:s});if(o){e.setEventData(n,{graph:this.targetGraph,candidateEmbedView:this.candidateEmbedView});const t=e.getEventData(n);a?e.processEmbedding(n,t):e.clearEmbedding(t),this.candidateEmbedView=t.candidateEmbedView}this.isSnaplineEnabled()&&(a?this.snapline.snapOnMoving({e:n,view:e,x:r.x,y:r.y}):this.snapline.hide())}}onDragEnd(t){const e=this.draggingNode;if(e){const n=this.normalizeEvent(t),i=this.draggingView,s=this.draggingBBox,o=this.snapOffset;let a=s.x,l=s.y;o&&(a+=o.x,l+=o.y),e.position(a,l,{silent:!0});const c=this.drop(e,{x:n.clientX,y:n.clientY}),h=t=>{t?(this.onDropped(e),this.targetGraph.options.embedding.enabled&&i&&(i.setEventData(n,{cell:t,graph:this.targetGraph,candidateEmbedView:this.candidateEmbedView}),i.finalizeEmbedding(n,i.getEventData(n)))):this.onDropInvalid(),this.candidateEmbedView=null,this.targetModel.stopBatch("dnd")};r.eY.isAsync(c)?(this.undelegateDocumentEvents(),c.then(h)):h(c)}}clearDragging(){this.draggingNode&&(this.sourceNode=null,this.draggingNode.remove(),this.draggingNode=null,this.draggingView=null,this.delta=null,this.padding=null,this.snapOffset=null,this.originOffset=null,this.undelegateDocumentEvents())}onDropped(t){this.draggingNode===t&&(this.clearDragging(),r.Jf.removeClass(this.container,"dragging"),r.Jf.remove(this.container))}onDropInvalid(){const t=this.draggingNode;t&&this.onDropped(t)}isInsideValidArea(t){let e,n=null;const i=this.targetGraph,s=this.targetScroller;this.options.dndContainer&&(n=this.getDropArea(this.options.dndContainer));const r=n&&n.containsPoint(t);if(s)if(s.options.autoResize)e=this.getDropArea(s.container);else{const t=this.getDropArea(s.container);e=this.getDropArea(i.container).intersectsWithRect(t)}else e=this.getDropArea(i.container);return!r&&e&&e.containsPoint(t)}getDropArea(t){const e=r.Jf.offset(t),n=document.body.scrollTop||document.documentElement.scrollTop,i=document.body.scrollLeft||document.documentElement.scrollLeft;return r.M_.create({x:e.left+parseInt(r.Jf.css(t,"border-left-width"),10)-i,y:e.top+parseInt(r.Jf.css(t,"border-top-width"),10)-n,width:t.clientWidth,height:t.clientHeight})}drop(t,e){if(this.isInsideValidArea(e)){const n=this.targetGraph,i=n.model,s=n.clientToLocal(e),o=this.sourceNode,a=this.options.getDropNode(t,{sourceNode:o,draggingNode:t,targetGraph:this.targetGraph,draggingGraph:this.draggingGraph}),l=a.getBBox();s.x+=l.x-l.width/2,s.y+=l.y-l.height/2;const c=this.snapOffset?1:n.getGridSize();a.position(r.fZ.snapToGrid(s.x,c),r.fZ.snapToGrid(s.y,c)),a.removeZIndex();const h=this.options.validateNode,u=!h||h(a,{sourceNode:o,draggingNode:t,droppingNode:a,targetGraph:n,draggingGraph:this.draggingGraph});return"boolean"===typeof u?u?(i.addCell(a,{stencil:this.cid}),a):null:r.eY.toDeferredBoolean(u).then(t=>t?(i.addCell(a,{stencil:this.cid}),a):null)}return null}onRemove(){this.draggingGraph&&(this.draggingGraph.view.remove(),this.draggingGraph.dispose())}dispose(){this.remove(),r.H.clean(this.name)}}function f(t,e={}){const n=r.Kx.isModel(t)?t:(new r.Kx).resetCells(t,{sort:!1,dryrun:!0}),i=n.getNodes(),s=e.columns||1,o=Math.ceil(i.length/s),a=e.dx||0,l=e.dy||0,c=!1!==e.center,h=!0===e.resizeToFit,u=e.marginX||0,g=e.marginY||0,p=[];let f=e.columnWidth;if("compact"===f)for(let r=0;r<s;r+=1){const t=d.getNodesInColumn(i,r,s);p.push(d.getMaxDim(t,"width")+a)}else{null!=f&&"auto"!==f||(f=d.getMaxDim(i,"width")+a);for(let t=0;t<s;t+=1)p.push(f)}const m=d.accumulate(p,u),y=[];let b=e.rowHeight;if("compact"===b)for(let r=0;r<o;r+=1){const t=d.getNodesInRow(i,r,s);y.push(d.getMaxDim(t,"height")+l)}else{null!=b&&"auto"!==b||(b=d.getMaxDim(i,"height")+l);for(let t=0;t<o;t+=1)y.push(b)}const v=d.accumulate(y,g);n.startBatch("layout"),i.forEach((t,n)=>{const i=n%s,r=Math.floor(n/s),o=p[i],u=y[r];let d=0,g=0,f=t.getSize();if(h){let n=o-2*a,i=u-2*l;const s=f.height*(f.width?n/f.width:1),r=f.width*(f.height?i/f.height:1);u<s?n=r:i=s,f={width:n,height:i},t.setSize(f,e)}c&&(d=(o-f.width)/2,g=(u-f.height)/2),t.position(m[i]+a+d,v[r]+l+g,e)}),n.stopBatch("layout")}g([r.Ss.dispose()],p.prototype,"dispose",null),function(t){t.defaults={getDragNode:t=>t.clone(),getDropNode:t=>t.clone()},t.documentEvents={mousemove:"onDragging",touchmove:"onDragging",mouseup:"onDragEnd",touchend:"onDragEnd",touchcancel:"onDragEnd"}}(p||(p={})),function(t){function e(t,e){return t.reduce((t,n)=>Math.max(null===n||void 0===n?void 0:n.getSize()[e],t),0)}function n(t,e,n){const i=[];for(let s=n*e,r=s+n;s<r;s+=1)t[s]&&i.push(t[s]);return i}function i(t,e,n){const i=[];for(let s=e,r=t.length;s<r;s+=n)t[s]&&i.push(t[s]);return i}function s(t,e){return t.reduce((t,e,n)=>(t.push(t[n]+e),t),[e||0])}t.getMaxDim=e,t.getNodesInRow=n,t.getNodesInColumn=i,t.accumulate=s}(d||(d={}));const m=".x6-widget-dnd {\n position: absolute;\n top: -10000px;\n left: -10000px;\n z-index: 999999;\n display: none;\n cursor: move;\n opacity: 0.7;\n pointer-events: 'cursor';\n}\n.x6-widget-dnd.dragging {\n display: inline-block;\n}\n.x6-widget-dnd.dragging * {\n pointer-events: none !important;\n}\n.x6-widget-dnd .x6-graph {\n background: transparent;\n box-shadow: none;\n}\n.x6-widget-stencil {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n}\n.x6-widget-stencil::after {\n position: absolute;\n top: 0;\n display: block;\n width: 100%;\n height: 20px;\n padding: 8px 0;\n line-height: 20px;\n text-align: center;\n opacity: 0;\n transition: top 0.1s linear, opacity 0.1s linear;\n content: ' ';\n pointer-events: none;\n}\n.x6-widget-stencil-content {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n height: auto;\n overflow-x: hidden;\n overflow-y: auto;\n}\n.x6-widget-stencil .x6-node [magnet]:not([magnet='passive']) {\n pointer-events: none;\n}\n.x6-widget-stencil-group {\n padding: 0;\n padding-bottom: 8px;\n overflow: hidden;\n user-select: none;\n}\n.x6-widget-stencil-group.collapsed {\n height: auto;\n padding-bottom: 0;\n}\n.x6-widget-stencil-group-title {\n position: relative;\n margin-top: 0;\n margin-bottom: 0;\n padding: 4px;\n cursor: pointer;\n}\n.x6-widget-stencil-title,\n.x6-widget-stencil-group > .x6-widget-stencil-group-title {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n user-select: none;\n}\n.x6-widget-stencil .unmatched {\n opacity: 0.3;\n}\n.x6-widget-stencil .x6-node.unmatched {\n display: none;\n}\n.x6-widget-stencil-group.unmatched {\n display: none;\n}\n.x6-widget-stencil-search-text {\n position: relative;\n z-index: 1;\n box-sizing: border-box;\n width: 100%;\n height: 30px;\n max-height: 30px;\n line-height: 30px;\n outline: 0;\n}\n.x6-widget-stencil.not-found::after {\n opacity: 1;\n content: attr(data-not-found-text);\n}\n.x6-widget-stencil.not-found.searchable::after {\n top: 30px;\n}\n.x6-widget-stencil.not-found.searchable.collapsable::after {\n top: 50px;\n}\n.x6-widget-stencil {\n color: #333;\n background: #f5f5f5;\n}\n.x6-widget-stencil-content {\n position: absolute;\n}\n.x6-widget-stencil.collapsable > .x6-widget-stencil-content {\n top: 32px;\n}\n.x6-widget-stencil.searchable > .x6-widget-stencil-content {\n top: 80px;\n}\n.x6-widget-stencil.not-found::after {\n position: absolute;\n}\n.x6-widget-stencil.not-found.searchable.collapsable::after {\n top: 80px;\n}\n.x6-widget-stencil.not-found.searchable::after {\n top: 60px;\n}\n.x6-widget-stencil-group {\n height: auto;\n margin-bottom: 1px;\n padding: 0;\n transition: none;\n}\n.x6-widget-stencil-group .x6-graph {\n background: transparent;\n box-shadow: none;\n}\n.x6-widget-stencil-group.collapsed {\n height: auto;\n max-height: 31px;\n}\n.x6-widget-stencil-title,\n.x6-widget-stencil-group > .x6-widget-stencil-group-title {\n position: relative;\n left: 0;\n box-sizing: border-box;\n width: 100%;\n height: 32px;\n padding: 0 5px 0 8px;\n color: #666;\n font-weight: 700;\n font-size: 12px;\n line-height: 32px;\n cursor: default;\n transition: all 0.3;\n}\n.x6-widget-stencil-title:hover,\n.x6-widget-stencil-group > .x6-widget-stencil-group-title:hover {\n color: #444;\n}\n.x6-widget-stencil-title {\n background: #e9e9e9;\n}\n.x6-widget-stencil-group > .x6-widget-stencil-group-title {\n background: #ededed;\n}\n.x6-widget-stencil.collapsable > .x6-widget-stencil-title,\n.x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title {\n padding-left: 32px;\n cursor: pointer;\n}\n.x6-widget-stencil.collapsable > .x6-widget-stencil-title::before,\n.x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title::before {\n position: absolute;\n top: 6px;\n left: 8px;\n display: block;\n width: 18px;\n height: 18px;\n margin: 0;\n padding: 0;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: 0 0;\n border: none;\n content: ' ';\n}\n.x6-widget-stencil.collapsable > .x6-widget-stencil-title::before,\n.x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJub256ZXJvIj48cGF0aCBkPSJNOS4zNzUuNUM0LjY4Ny41Ljg3NSA0LjMxMy44NzUgOWMwIDQuNjg4IDMuODEyIDguNSA4LjUgOC41IDQuNjg3IDAgOC41LTMuODEyIDguNS04LjUgMC00LjY4Ny0zLjgxMy04LjUtOC41LTguNXptMCAxNS44ODZDNS4zMDMgMTYuMzg2IDEuOTkgMTMuMDcyIDEuOTkgOXMzLjMxMi03LjM4NSA3LjM4NS03LjM4NVMxNi43NiA0LjkyOCAxNi43NiA5YzAgNC4wNzItMy4zMTMgNy4zODYtNy4zODUgNy4zODZ6Ii8+PHBhdGggZD0iTTEyLjc1MyA4LjQ0M0g1Ljk5N2EuNTU4LjU1OCAwIDAwMCAxLjExNmg2Ljc1NmEuNTU4LjU1OCAwIDAwMC0xLjExNnoiLz48L2c+PC9zdmc+');\n opacity: 0.4;\n transition: all 0.3s;\n}\n.x6-widget-stencil.collapsable > .x6-widget-stencil-title:hover::before,\n.x6-widget-stencil-group.collapsable > .x6-widget-stencil-group-title:hover::before {\n opacity: 0.6;\n}\n.x6-widget-stencil.collapsable.collapsed > .x6-widget-stencil-title::before,\n.x6-widget-stencil-group.collapsable.collapsed > .x6-widget-stencil-group-title::before {\n background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzAwMCIgZmlsbC1ydWxlPSJub256ZXJvIj48cGF0aCBkPSJNOS4zNzUuNUM0LjY4Ny41Ljg3NSA0LjMxMy44NzUgOWMwIDQuNjg4IDMuODEyIDguNSA4LjUgOC41IDQuNjg3IDAgOC41LTMuODEyIDguNS04LjUgMC00LjY4Ny0zLjgxMy04LjUtOC41LTguNXptMCAxNS44ODZDNS4zMDMgMTYuMzg2IDEuOTkgMTMuMDcyIDEuOTkgOXMzLjMxMi03LjM4NSA3LjM4NS03LjM4NVMxNi43NiA0LjkyOCAxNi43NiA5YzAgNC4wNzItMy4zMTMgNy4zODYtNy4zODUgNy4zODZ6Ii8+PHBhdGggZD0iTTEyLjc1MyA4LjQ0M0g1Ljk5N2EuNTU4LjU1OCAwIDAwMCAxLjExNmg2Ljc1NmEuNTU4LjU1OCAwIDAwMC0xLjExNnoiLz48cGF0aCBkPSJNOC44MTcgNS42MjN2Ni43NTZhLjU1OC41NTggMCAwMDEuMTE2IDBWNS42MjNhLjU1OC41NTggMCAxMC0xLjExNiAweiIvPjwvZz48L3N2Zz4=');\n opacity: 0.4;\n}\n.x6-widget-stencil.collapsable.collapsed > .x6-widget-stencil-title:hover::before,\n.x6-widget-stencil-group.collapsable.collapsed > .x6-widget-stencil-group-title:hover::before {\n opacity: 0.6;\n}\n.x6-widget-stencil input[type='search'] {\n appearance: textfield;\n}\n.x6-widget-stencil input[type='search']::-webkit-search-cancel-button,\n.x6-widget-stencil input[type='search']::-webkit-search-decoration {\n appearance: none;\n}\n.x6-widget-stencil-search-text {\n display: block;\n width: 90%;\n margin: 8px 5%;\n padding-left: 8px;\n color: #333;\n background: #fff;\n border: 1px solid #e9e9e9;\n border-radius: 12px;\n outline: 0;\n}\n.x6-widget-stencil-search-text:focus {\n outline: 0;\n}\n.x6-widget-stencil::after {\n color: #808080;\n font-weight: 600;\n font-size: 12px;\n background: 0 0;\n}\n";var y,b,v=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class x extends r.Ss{get targetScroller(){const t=this.options.target,e=t.getPlugin("scroller");return e}get targetGraph(){return this.options.target}get targetModel(){return this.targetGraph.model}constructor(t={}){super(),this.name="stencil",r.H.ensure(this.name,m),this.graphs={},this.groups={},this.options=Object.assign(Object.assign({},x.defaultOptions),t),this.init()}init(){this.dnd=new p(this.options),this.onSearch=r.eY.debounce(this.onSearch,200),this.initContainer(),this.initSearch(),this.initContent(),this.initGroups(),this.setTitle(),this.startListening()}load(t,e){return Array.isArray(t)?this.loadGroup(t,e):this.options.groups&&Object.keys(this.options.groups).forEach(e=>{t[e]&&this.loadGroup(t[e],e)}),this}unload(t,e){return Array.isArray(t)?this.loadGroup(t,e,!0):this.options.groups&&Object.keys(this.options.groups).forEach(e=>{t[e]&&this.loadGroup(t[e],e,!0)}),this}toggleGroup(t){return this.isGroupCollapsed(t)?this.expandGroup(t):this.collapseGroup(t),this}collapseGroup(t){if(this.isGroupCollapsable(t)){const e=this.groups[t];e&&!this.isGroupCollapsed(t)&&(this.trigger("group:collapse",{name:t}),r.Jf.addClass(e,"collapsed"))}return this}expandGroup(t){if(this.isGroupCollapsable(t)){const e=this.groups[t];e&&this.isGroupCollapsed(t)&&(this.trigger("group:expand",{name:t}),r.Jf.removeClass(e,"collapsed"))}return this}isGroupCollapsable(t){const e=this.groups[t];return r.Jf.hasClass(e,"collapsable")}isGroupCollapsed(t){const e=this.groups[t];return e&&r.Jf.hasClass(e,"collapsed")}collapseGroups(){return Object.keys(this.groups).forEach(t=>this.collapseGroup(t)),this}expandGroups(){return Object.keys(this.groups).forEach(t=>this.expandGroup(t)),this}resizeGroup(t,e){const n=this.graphs[t];return n&&n.resize(e.width,e.height),this}addGroup(t){const e=Array.isArray(t)?t:[t];this.options.groups?this.options.groups.push(...e):this.options.groups=e,e.forEach(t=>this.initGroup(t))}removeGroup(t){const e=Array.isArray(t)?t:[t];this.options.groups&&(this.options.groups=this.options.groups.filter(t=>!e.includes(t.name)),e.forEach(t=>{const e=this.graphs[t];this.unregisterGraphEvents(e),e.dispose(),delete this.graphs[t];const n=this.groups[t];r.Jf.remove(n),delete this.groups[t]}))}initContainer(){this.container=document.createElement("div"),r.Jf.addClass(this.container,this.prefixClassName(y.base)),r.Jf.attr(this.container,"data-not-found-text",this.options.notFoundText||"No matches found")}initContent(){this.content=document.createElement("div"),r.Jf.addClass(this.content,this.prefixClassName(y.content)),r.Jf.appendTo(this.content,this.container)}initSearch(){this.options.search&&(r.Jf.addClass(this.container,"searchable"),r.Jf.append(this.container,this.renderSearch()))}initGroup(t){const e=this.options.stencilGraphOptions||{},n=document.createElement("div");r.Jf.addClass(n,this.prefixClassName(y.group)),r.Jf.attr(n,"data-name",t.name),(null==t.collapsable&&this.options.collapsable||!1!==t.collapsable)&&r.Jf.addClass(n,"collapsable"),r.Jf.toggleClass(n,"collapsed",!0===t.collapsed);const i=document.createElement("h3");r.Jf.addClass(i,this.prefixClassName(y.groupTitle)),i.innerHTML=t.title||t.name;const s=document.createElement("div");r.Jf.addClass(s,this.prefixClassName(y.groupContent));const o=t.graphOptions,a=new r.ke(Object.assign(Object.assign(Object.assign({},e),o),{container:document.createElement("div"),model:e.model||new r.Kx,width:t.graphWidth||this.options.stencilGraphWidth,height:t.graphHeight||this.options.stencilGraphHeight,interacting:!1,preventDefaultBlankAction:!1}));this.registerGraphEvents(a),r.Jf.append(s,a.container),r.Jf.append(n,[i,s]),r.Jf.appendTo(n,this.content),this.groups[t.name]=n,this.graphs[t.name]=a}initGroups(){if(this.clearGroups(),this.setCollapsableState(),this.options.groups&&this.options.groups.length)this.options.groups.forEach(t=>{this.initGroup(t)});else{const t=this.options.stencilGraphOptions||{},e=new r.ke(Object.assign(Object.assign({},t),{container:document.createElement("div"),model:t.model||new r.Kx,width:this.options.stencilGraphWidth,height:this.options.stencilGraphHeight,interacting:!1,preventDefaultBlankAction:!1}));r.Jf.append(this.content,e.container),this.graphs[b.defaultGroupName]=e}}setCollapsableState(){if(this.options.collapsable=this.options.collapsable&&this.options.groups&&this.options.groups.some(t=>!1!==t.collapsable),this.options.collapsable){r.Jf.addClass(this.container,"collapsable");const t=this.options.groups&&this.options.groups.every(t=>t.collapsed||!1===t.collapsable);t?r.Jf.addClass(this.container,"collapsed"):r.Jf.removeClass(this.container,"collapsed")}else r.Jf.removeClass(this.container,"collapsable")}setTitle(){const t=document.createElement("div");r.Jf.addClass(t,this.prefixClassName(y.title)),t.innerHTML=this.options.title,r.Jf.appendTo(t,this.container)}renderSearch(){const t=document.createElement("div");r.Jf.addClass(t,this.prefixClassName(y.search));const e=document.createElement("input");return r.Jf.attr(e,{type:"search",placeholder:this.options.placeholder||"Search"}),r.Jf.addClass(e,this.prefixClassName(y.searchText)),r.Jf.append(t,e),t}startListening(){const t=this.prefixClassName(y.title),e=this.prefixClassName(y.searchText),n=this.prefixClassName(y.groupTitle);this.delegateEvents({[`click .${t}`]:"onTitleClick",[`touchstart .${t}`]:"onTitleClick",[`click .${n}`]:"onGroupTitleClick",[`touchstart .${n}`]:"onGroupTitleClick",[`input .${e}`]:"onSearch",[`focusin .${e}`]:"onSearchFocusIn",[`focusout .${e}`]:"onSearchFocusOut"})}stopListening(){this.undelegateEvents()}registerGraphEvents(t){t.on("cell:mousedown",this.onDragStart,this)}unregisterGraphEvents(t){t.off("cell:mousedown",this.onDragStart,this)}loadGroup(t,e,n){const i=this.getModel(e);if(i){const e=t.map(t=>r.bP.isNode(t)?t:r.bP.create(t));!0===n?i.removeCells(e):i.resetCells(e)}const s=this.getGroup(e);let o=this.options.stencilGraphHeight;s&&null!=s.graphHeight&&(o=s.graphHeight);const a=s&&s.layout||this.options.layout;if(a&&i&&r.eY.call(a,this,i,s),!o){const t=this.getGraph(e);t.fitToContent({minWidth:t.options.width,gridHeight:1,padding:s&&s.graphPadding||this.options.stencilGraphPadding||10})}return this}onDragStart(t){const{e:e,node:n}=t,i=this.getGroupByNode(n);i&&!1===i.nodeMovable||this.dnd.start(n,e)}filter(t,e){const n=Object.keys(this.graphs).reduce((n,i)=>{const s=this.graphs[i],o=i===b.defaultGroupName?null:i,a=s.model.getNodes().filter(n=>{let i=!1;i="function"===typeof e?r.eY.call(e,this,n,t,o,this):"boolean"===typeof e?e:this.isCellMatched(n,t,e,t.toLowerCase()!==t);const a=s.renderer.findViewByCell(n);return a&&r.Jf.toggleClass(a.container,"unmatched",!i),i}),l=a.length>0,c=this.options,h=new r.Kx;return h.resetCells(a),c.layout&&r.eY.call(c.layout,this,h,this.getGroup(i)),this.groups[i]&&r.Jf.toggleClass(this.groups[i],"unmatched",!l),s.fitToContent({gridWidth:1,gridHeight:1,padding:c.stencilGraphPadding||10}),n||l},!1);r.Jf.toggleClass(this.container,"not-found",!n)}isCellMatched(t,e,n,i){return!e||!n||Object.keys(n).some(s=>{if("*"===s||t.shape===s){const r=n[s];if("boolean"===typeof r)return r;const o=Array.isArray(r)?r:[r];return o.some(n=>{let s=t.getPropByPath(n);return null!=s&&(s=`${s}`,i||(s=s.toLowerCase()),s.indexOf(e)>=0)})}return!1})}onSearch(t){this.filter(t.target.value,this.options.search)}onSearchFocusIn(){r.Jf.addClass(this.container,"is-focused")}onSearchFocusOut(){r.Jf.removeClass(this.container,"is-focused")}onTitleClick(){this.options.collapsable&&(r.Jf.toggleClass(this.container,"collapsed"),r.Jf.hasClass(this.container,"collapsed")?this.collapseGroups():this.expandGroups())}onGroupTitleClick(t){const e=t.target.closest(`.${this.prefixClassName(y.group)}`);e&&this.toggleGroup(r.Jf.attr(e,"data-name")||"");const n=Object.keys(this.groups).every(t=>{const e=this.getGroup(t),n=this.groups[t];return e&&!1===e.collapsable||r.Jf.hasClass(n,"collapsed")});r.Jf.toggleClass(this.container,"collapsed",n)}getModel(t){const e=this.getGraph(t);return e?e.model:null}getGraph(t){return this.graphs[t||b.defaultGroupName]}getGroup(t){const e=this.options.groups;return null!=t&&e&&e.length?e.find(e=>e.name===t):null}getGroupByNode(t){const e=this.options.groups;return e?e.find(e=>{const n=this.getModel(e.name);return!!n&&n.has(t.id)}):null}clearGroups(){Object.keys(this.graphs).forEach(t=>{const e=this.graphs[t];this.unregisterGraphEvents(e),e.dispose()}),Object.keys(this.groups).forEach(t=>{const e=this.groups[t];r.Jf.remove(e)}),this.graphs={},this.groups={}}onRemove(){this.clearGroups(),this.dnd.remove(),this.stopListening(),this.undelegateDocumentEvents()}dispose(){this.remove(),r.H.clean(this.name)}}v([r.Ss.dispose()],x.prototype,"dispose",null),function(t){t.defaultOptions=Object.assign({stencilGraphWidth:200,stencilGraphHeight:800,title:"Stencil",collapsable:!1,placeholder:"Search",notFoundText:"No matches found",layout(t,e){const n={columnWidth:this.options.stencilGraphWidth/2-10,columns:2,rowHeight:80,resizeToFit:!1,dx:10,dy:10};f(t,Object.assign(Object.assign(Object.assign({},n),this.options.layoutOptions),e?e.layoutOptions:{}))}},p.defaults)}(x||(x={})),function(t){t.base="widget-stencil",t.title=`${t.base}-title`,t.search=`${t.base}-search`,t.searchText=`${t.search}-text`,t.content=`${t.base}-content`,t.group=`${t.base}-group`,t.groupTitle=`${t.group}-title`,t.groupContent=`${t.group}-content`}(y||(y={})),function(t){t.defaultGroupName="__default__"}(b||(b={})),r.ke.prototype.isHistoryEnabled=function(){const t=this.getPlugin("history");return!!t&&t.isEnabled()},r.ke.prototype.enableHistory=function(){const t=this.getPlugin("history");return t&&t.enable(),this},r.ke.prototype.disableHistory=function(){const t=this.getPlugin("history");return t&&t.disable(),this},r.ke.prototype.toggleHistory=function(t){const e=this.getPlugin("history");return e&&e.toggleEnabled(t),this},r.ke.prototype.undo=function(t){const e=this.getPlugin("history");return e&&e.undo(t),this},r.ke.prototype.redo=function(t){const e=this.getPlugin("history");return e&&e.redo(t),this},r.ke.prototype.undoAndCancel=function(t){const e=this.getPlugin("history");return e&&e.cancel(t),this},r.ke.prototype.canUndo=function(){const t=this.getPlugin("history");return!!t&&t.canUndo()},r.ke.prototype.canRedo=function(){const t=this.getPlugin("history");return!!t&&t.canRedo()},r.ke.prototype.cleanHistory=function(t){const e=this.getPlugin("history");return e&&e.clean(t),this},r.ke.prototype.getHistoryStackSize=function(){const t=this.getPlugin("history");return t.getSize()},r.ke.prototype.getUndoStackSize=function(){const t=this.getPlugin("history");return t.getUndoSize()},r.ke.prototype.getRedoStackSize=function(){const t=this.getPlugin("history");return t.getRedoSize()},r.ke.prototype.getUndoRemainSize=function(){const t=this.getPlugin("history");return t.getUndoRemainSize()};var w,C=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class P extends r.Nb{constructor(t={}){super(),this.name="history",this.batchCommands=null,this.batchLevel=0,this.lastBatchIndex=-1,this.freezed=!1,this.stackSize=0,this.handlers=[];const{stackSize:e=0}=t;this.stackSize=e,this.options=w.getOptions(t),this.validator=new P.Validator({history:this,cancelInvalid:this.options.cancelInvalid})}init(t){this.graph=t,this.model=this.graph.model,this.clean(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(t){return null!=t?t!==this.isEnabled()&&(t?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}undo(t={}){if(!this.disabled){const e=this.undoStack.pop();e&&(this.revertCommand(e,t),this.redoStack.push(e),this.notify("undo",e,t))}return this}redo(t={}){if(!this.disabled){const e=this.redoStack.pop();e&&(this.applyCommand(e,t),this.undoStackPush(e),this.notify("redo",e,t))}return this}cancel(t={}){if(!this.disabled){const e=this.undoStack.pop();e&&(this.revertCommand(e,t),this.redoStack=[],this.notify("cancel",e,t))}return this}getSize(){return this.stackSize}getUndoRemainSize(){const t=this.undoStack.length;return this.stackSize-t}getUndoSize(){return this.undoStack.length}getRedoSize(){return this.redoStack.length}canUndo(){return!this.disabled&&this.undoStack.length>0}canRedo(){return!this.disabled&&this.redoStack.length>0}clean(t={}){return this.undoStack=[],this.redoStack=[],this.notify("clean",null,t),this}get disabled(){return!0!==this.options.enabled}validate(t,...e){return this.validator.validate(t,...e),this}startListening(){this.model.on("batch:start",this.initBatchCommand,this),this.model.on("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&this.options.eventNames.forEach((t,e)=>{this.handlers[e]=this.addCommand.bind(this,t),this.model.on(t,this.handlers[e])}),this.validator.on("invalid",t=>this.trigger("invalid",t))}stopListening(){this.model.off("batch:start",this.initBatchCommand,this),this.model.off("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&(this.options.eventNames.forEach((t,e)=>{this.model.off(t,this.handlers[e])}),this.handlers.length=0),this.validator.off("invalid")}createCommand(t){return{batch:!!t&&t.batch,data:{}}}revertCommand(t,e){this.freezed=!0;const n=Array.isArray(t)?w.sortBatchCommands(t):[t];for(let i=n.length-1;i>=0;i-=1){const t=n[i],s=Object.assign(Object.assign({},e),r.D5.pick(t.options,this.options.revertOptionsList||[]));this.executeCommand(t,!0,s)}this.freezed=!1}applyCommand(t,e){this.freezed=!0;const n=Array.isArray(t)?w.sortBatchCommands(t):[t];for(let i=0;i<n.length;i+=1){const t=n[i],s=Object.assign(Object.assign({},e),r.D5.pick(t.options,this.options.applyOptionsList||[]));this.executeCommand(t,!1,s)}this.freezed=!1}executeCommand(t,e,n){const i=this.model,s=i.getCell(t.data.id),o=t.event;if(w.isAddEvent(o)&&e||w.isRemoveEvent(o)&&!e)s&&s.remove(n);else if(w.isAddEvent(o)&&!e||w.isRemoveEvent(o)&&e){const e=t.data;e.node?i.addNode(e.props,n):e.edge&&i.addEdge(e.props,n)}else if(w.isChangeEvent(o)){const i=t.data,r=i.key;if(r&&s){const t=e?i.prev[r]:i.next[r];if("attrs"===i.key){const s=this.ensureUndefinedAttrs(t,e?i.next[r]:i.prev[r]);s&&(n.dirty=!0)}s.prop(r,t,n)}}else{const i=this.options.executeCommand;i&&r.eY.call(i,this,t,e,n)}}addCommand(t,e){if(this.freezed||this.disabled)return;const n=e,i=n.options||{};if(i.dryrun)return;if(w.isAddEvent(t)&&this.options.ignoreAdd||w.isRemoveEvent(t)&&this.options.ignoreRemove||w.isChangeEvent(t)&&this.options.ignoreChange)return;const s=this.options.beforeAddCommand;if(null!=s&&!1===r.eY.call(s,this,t,e))return;"cell:change:*"===t&&(t=`cell:change:${n.key}`);const o=n.cell,a=r.Kx.isModel(o);let l;if(this.batchCommands){l=this.batchCommands[Math.max(this.lastBatchIndex,0)];const e=a&&!l.modelChange||l.data.id!==o.id,n=l.event!==t;if(this.lastBatchIndex>=0&&(e||n)){const e=this.batchCommands.findIndex(e=>(a&&e.modelChange||e.data.id===o.id)&&e.event===t);e<0||w.isAddEvent(t)||w.isRemoveEvent(t)?l=this.createCommand({batch:!0}):(l=this.batchCommands[e],this.batchCommands.splice(e,1)),this.batchCommands.push(l),this.lastBatchIndex=this.batchCommands.length-1}}else l=this.createCommand({batch:!1});if(w.isAddEvent(t)||w.isRemoveEvent(t)){const e=l.data;return l.event=t,l.options=i,e.id=o.id,e.props=r.D5.cloneDeep(o.toJSON()),o.isEdge()?e.edge=!0:o.isNode()&&(e.node=!0),this.push(l,i)}if(w.isChangeEvent(t)){const n=e.key,s=l.data;return l.batch&&l.event||(l.event=t,l.options=i,s.key=n,null==s.prev&&(s.prev={}),s.prev[n]=r.D5.cloneDeep(o.previous(n)),a?l.modelChange=!0:s.id=o.id),null==s.next&&(s.next={}),s.next[n]=r.D5.cloneDeep(o.prop(n)),this.push(l,i)}const c=this.options.afterAddCommand;c&&r.eY.call(c,this,t,e,l),this.push(l,i)}initBatchCommand(t){this.freezed||(this.batchCommands?this.batchLevel+=1:(this.batchCommands=[this.createCommand({batch:!0})],this.batchLevel=0,this.lastBatchIndex=-1))}storeBatchCommand(t){if(!this.freezed)if(this.batchCommands&&this.batchLevel<=0){const e=this.filterBatchCommand(this.batchCommands);e.length>0&&(this.redoStack=[],this.undoStackPush(e),this.consolidateCommands(),this.notify("add",e,t)),this.batchCommands=null,this.lastBatchIndex=-1,this.batchLevel=0}else this.batchCommands&&this.batchLevel>0&&(this.batchLevel-=1)}filterBatchCommand(t){let e=t.slice();const n=[];while(e.length>0){const t=e.shift(),i=t.event,s=t.data.id;if(null!=i&&(null!=s||t.modelChange)){if(w.isAddEvent(i)){const t=e.findIndex(t=>w.isRemoveEvent(t.event)&&t.data.id===s);if(t>=0){e=e.filter((e,n)=>t<n||e.data.id!==s);continue}}else if(w.isRemoveEvent(i)){const t=e.findIndex(t=>w.isAddEvent(t.event)&&t.data.id===s);if(t>=0){e.splice(t,1);continue}}else if(w.isChangeEvent(i)){const e=t.data;if(r.D5.isEqual(e.prev,e.next))continue}n.push(t)}}return n}notify(t,e,n){const i=null==e?null:Array.isArray(e)?e:[e];this.emit(t,{cmds:i,options:n}),this.graph.trigger(`history:${t}`,{cmds:i,options:n}),this.emit("change",{cmds:i,options:n}),this.graph.trigger("history:change",{cmds:i,options:n})}push(t,e){this.redoStack=[],t.batch?(this.lastBatchIndex=Math.max(this.lastBatchIndex,0),this.emit("batch",{cmd:t,options:e})):(this.undoStackPush(t),this.consolidateCommands(),this.notify("add",t,e))}consolidateCommands(){var t;const e=this.undoStack[this.undoStack.length-1],n=this.undoStack[this.undoStack.length-2];if(!Array.isArray(e))return;const i=new Set(e.map(t=>t.event));if(2!==i.size||!i.has("cell:change:parent")||!i.has("cell:change:children"))return;if(!e.every(t=>{var e;return t.batch&&(null===(e=t.options)||void 0===e?void 0:e.ui)}))return;if(!Array.isArray(n)||1!==n.length)return;const s=n[0];"cell:change:position"===s.event&&(null===(t=s.options)||void 0===t?void 0:t.ui)&&(n.push(...e),this.undoStack.pop())}undoStackPush(t){0!==this.stackSize?(this.undoStack.length>=this.stackSize&&this.undoStack.shift(),this.undoStack.push(t)):this.undoStack.push(t)}ensureUndefinedAttrs(t,e){let n=!1;return null!==t&&null!==e&&"object"===typeof t&&"object"===typeof e&&Object.keys(e).forEach(i=>{void 0===t[i]&&void 0!==e[i]?(t[i]=void 0,n=!0):"object"===typeof t[i]&&"object"===typeof e[i]&&(n=this.ensureUndefinedAttrs(t[i],e[i]))}),n}dispose(){this.validator.dispose(),this.clean(),this.stopListening(),this.off()}}C([r.Nb.dispose()],P.prototype,"dispose",null),function(t){class e extends r.Nb{constructor(t){super(),this.map={},this.command=t.history,this.cancelInvalid=!1!==t.cancelInvalid,this.command.on("add",this.onCommandAdded,this)}onCommandAdded({cmds:t}){return Array.isArray(t)?t.every(t=>this.isValidCommand(t)):this.isValidCommand(t)}isValidCommand(t){if(t.options&&!1===t.options.validation)return!0;const e=t.event&&this.map[t.event]||[];let n=null;return e.forEach(e=>{let i=0;const s=r=>{const o=e[i];i+=1;try{if(!o)return void(n=r);o(r,t,s)}catch(a){s(a)}};s(n)}),!n||(this.cancelInvalid&&this.command.cancel(),this.emit("invalid",{err:n}),!1)}validate(t,...e){const n=Array.isArray(t)?t:t.split(/\s+/);return e.forEach(t=>{if("function"!==typeof t)throw new Error(`${n.join(" ")} requires callback functions.`)}),n.forEach(t=>{null==this.map[t]&&(this.map[t]=[]),this.map[t].push(e)}),this}dispose(){this.command.off("add",this.onCommandAdded,this)}}C([r.Nb.dispose()],e.prototype,"dispose",null),t.Validator=e}(P||(P={})),function(t){function e(t){return"cell:added"===t}function n(t){return"cell:removed"===t}function i(t){return null!=t&&t.startsWith("cell:change:")}function s(e){const n=["cell:added","cell:removed","cell:change:*"],i=["batch:start","batch:stop"],s=e.eventNames?e.eventNames.filter(e=>!(t.isChangeEvent(e)||n.includes(e)||i.includes(e))):n;return Object.assign(Object.assign({enabled:!0},e),{eventNames:s,applyOptionsList:e.applyOptionsList||["propertyPath"],revertOptionsList:e.revertOptionsList||["propertyPath"]})}function r(e){const n=[];for(let i=0,s=e.length;i<s;i+=1){const s=e[i];let r=null;if(t.isAddEvent(s.event)){const t=s.data.id;for(let n=0;n<i;n+=1)if(e[n].data.id===t){r=n;break}}null!==r?n.splice(r,0,s):n.push(s)}return n}t.isAddEvent=e,t.isRemoveEvent=n,t.isChangeEvent=i,t.getOptions=s,t.sortBatchCommands=r}(w||(w={}));var E=n(14246),M=n(46237),O=Object.defineProperty,A=Object.defineProperties,S=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable,j=(t,e,n)=>e in t?O(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,L=(t,e)=>{for(var n in e||(e={}))T.call(e,n)&&j(t,n,e[n]);if(N)for(var n of N(e))k.call(e,n)&&j(t,n,e[n]);return t},D=(t,e)=>A(t,S(e)),B=(t,e,n)=>j(t,"symbol"!==typeof e?e+"":e,n);class I extends s.Listener{constructor(){super(),B(this,"isReadonly",!1),B(this,"connecting"),B(this,"dom",document.createElement("div")),B(this,"selection"),B(this,"stencil"),B(this,"graph"),B(this,"history"),B(this,"tool"),B(this,"selectEdge",""),B(this,"container",null),B(this,"needTriggerChange",!1),B(this,"_interacting",({cell:t})=>{const e={nodeMovable:!0};return t instanceof E.N&&(e.nodeMovable=t.isMove()),e}),B(this,"_validateMagnet",({cell:t,magnet:e})=>t instanceof E.N&&t.isCreateEdge(e)),B(this,"_createEdge",()=>new r.yp.oH({attrs:E.N.edge})),B(this,"_validateConnection",({sourceCell:t,targetCell:e,targetMagnet:n})=>!(!n||!t)&&(e instanceof E.N&&e.isConnection(n,t))),B(this,"_undo",t=>{!1!==t.ctrlKey&&!1!==["KeyZ"].includes(t.code)&&this.history.canUndo()&&this.history.undo()}),B(this,"_redo",t=>{!1!==t.ctrlKey&&!1!==["KeyY"].includes(t.code)&&this.history.canRedo()&&this.history.redo()}),B(this,"_unselectEdge",()=>{if(this.selectEdge){const t=this.graph.getCellById(this.selectEdge);t.setAttrs({line:E.N.edge.line})}this.selectEdge=""}),B(this,"_delaySelect",s.Generate.delayExecute(()=>{const t=this.selection.getSelectedCells();this.trigger("select",t)})),B(this,"_changeListener",()=>{!1!==this.needTriggerChange&&this._delayChange()}),B(this,"_delayChange",s.Generate.delayExecute(()=>{this.trigger("change",{})})),B(this,"_resize",s.Generate.delayExecute(()=>{if(!this.container)return;const t=this.container.getBoundingClientRect();this.graph.resize(t.width,t.height),this.trigger("resize",{})})),B(this,"_delete",t=>{if(!0===this.isReadonly)return;if(!1===["Delete"].includes(t.code))return;const e=this.selection.getSelectedCells();for(const n of e)this.remove(n);this.selectEdge&&this.remove(this.graph.getCellById(this.selectEdge))}),this.dom=document.createElement("div"),this.connecting={snap:!0,allowMulti:!1,allowBlank:!1,allowLoop:!1,allowNode:!1,highlight:!0,connector:"rounded",connectionPoint:"boundary",router:"manhattan",validateMagnet:this._validateMagnet,validateConnection:this._validateConnection},this.graph=new r.ke({container:this.dom,autoResize:!0,mousewheel:!0,panning:{enabled:!0},interacting:this._interacting,connecting:D(L({},this.connecting),{createEdge:this._createEdge})}),this.selection=new h({enabled:!0,multiple:!0,rubberband:!0,movable:!0,modifiers:"ctrl",showNodeSelectionBox:!0,filter(t){return t instanceof E.N}}),this.stencil=new x({target:this.graph,title:M.B.get("graphDrawer.stencil.title"),layoutOptions:{columns:1,columnWidth:200,dx:20},stencilGraphHeight:0,stencilGraphPadding:0,groups:[{name:"inspector"}]}),this.history=new P({enabled:!1}),this.graph.use(this.selection),this.graph.use(this.history),this.tool=document.createElement("div"),this.tool.style.width="240px",this.tool.style.height="100%",this.tool.style.position="absolute",this.tool.style.top="0px",this.tool.style.left="0px",this.tool.style.zIndex="999",this.tool.appendChild(this.stencil.container),this.stencil.dnd.options.dndContainer=this.tool,this.graph.on("node:added",this._changeListener),this.graph.on("node:removed",this._changeListener),this.graph.on("edge:removed",this._changeListener),this.graph.on("node:moved",this._changeListener),this.graph.on("node:selected",this._delaySelect),this.graph.on("node:unselected",this._delaySelect),this.graph.on("edge:connected",t=>{const e=t.edge.source.cell,n=t.edge.target.cell,i=this.graph.getCellById(e),s=this.graph.getCellById(n);i instanceof E.N&&s instanceof E.N&&(this.trigger("link",{source:e,target:n}),this._changeListener())}),this.graph.on("edge:mouseenter",({edge:t})=>{}),this.graph.on("edge:mouseleave",({edge:t})=>{}),this.graph.on("edge:click",({edge:t})=>{this._unselectEdge(),t.setAttrs({line:E.N.edge.highlight}),this.selectEdge=t.id}),this.graph.on("edge:removed",({edge:t})=>{t.id===this.selectEdge&&(this.selectEdge="");const e=this.graph.getCellById(t.source.cell),n=this.graph.getCellById(t.target.cell);e instanceof E.N&&n instanceof E.N&&this.trigger("unlink",{source:t.source.cell,target:t.target.cell})}),this.graph.on("blank:mouseup",()=>{this._unselectEdge()}),this.graph.on("blank:contextmenu",t=>{}),this.graph.on("cell:contextmenu",({cell:t,x:e,y:n})=>{t instanceof E.N&&t.rightClick({cell:t,x:e,y:n})}),this.graph.on("cell:click",({cell:t,x:e,y:n})=>{this._unselectEdge(),t instanceof E.N&&t.click({cell:t,x:e,y:n})}),window.addEventListener("resize",this._resize),window.addEventListener("keydown",this._delete),this.listen("dispose",()=>{window.removeEventListener("resize",this._resize),window.removeEventListener("keydown",this._delete)})}_isEdgePort(t){return!!(null==t?void 0:t.cell)}getMapper(t){return!1===this._isEdgePort(t.source)||!1===this._isEdgePort(t.target)?null:{source:t.source.cell,target:t.target.cell}}getEdgeOfMapper(t,e){const n={shape:"edge",source:{cell:t,port:"out"},target:{cell:e,port:"in"},attrs:E.N.edge};return n}setReadonly(t){this.isReadonly=t;let e="none";t?this.graph.options.interacting=!1:(this.graph.options.interacting=this._interacting,e="block"),this.tool.style.display=e}mount(t){var e;this.container=t instanceof Element?t:null!=(e=document.getElementById(t))?e:null,null!==this.container&&(this.container.appendChild(this.dom),this.container.appendChild(this.tool),this._resize(),window.addEventListener("keydown",this._redo),window.addEventListener("keydown",this._undo))}unmount(){this.container&&(window.removeEventListener("keydown",this._redo),window.removeEventListener("keydown",this._undo),this.container.removeChild(this.dom),this.container=null)}find(t){const e=this.graph.getCells();for(const n of e)if(n.id===t)return n;return null}remove(t){const e=t.parent;if(this.graph.removeCell(t),e){const t=e.getChildren();for(let e=0;e<t.length;e++){const n=t[e];n.setProp("position",{x:0,y:e*E.N.height})}}t instanceof E.N&&this.trigger("remove",t),t.dispose()}clear(){this._unselectEdge(),this.graph.resetCells([]),this.selection.clean()}dispose(){this.clear(),this.unmount()}}},10506:function(){"object"===typeof window&&window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),"undefined"!==typeof window&&function(t){t.forEach(t=>{Object.prototype.hasOwnProperty.call(t,"append")||Object.defineProperty(t,"append",{configurable:!0,enumerable:!0,writable:!0,value(...t){const e=document.createDocumentFragment();t.forEach(t=>{const n=t instanceof Node;e.appendChild(n?t:document.createTextNode(String(t)))}),this.appendChild(e)}})})}([Element.prototype,Document.prototype,DocumentFragment.prototype])},14246:function(t,e,n){"use strict";n.d(e,{N:function(){return f}});var i=n(50931),s=n(44943),r=Object.defineProperty,o=Object.defineProperties,a=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,u=(t,e,n)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,d=(t,e)=>{for(var n in e||(e={}))c.call(e,n)&&u(t,n,e[n]);if(l)for(var n of l(e))h.call(e,n)&&u(t,n,e[n]);return t},g=(t,e)=>o(t,a(e)),p=(t,e,n)=>u(t,"symbol"!==typeof e?e+"":e,n);class f extends s.yp.rw{constructor(t){var e,n,s,r,o,a;super({id:null!=(e=t.id)?e:i.Generate.uuid(),label:t.label,position:t.position}),p(this,"vMeta"),this.vMeta={drawer:t.drawer,icon:null!=(n=t.icon)?n:"",label:null!=(s=t.label)?s:"",status:null!=(r=t.status)?r:"",maxOutCount:null!=(o=t.maxOutCount)?o:1,maxInCount:null!=(a=t.maxInCount)?a:1,id:this.id},this.htmlFactory()}static instanceOf(t,e){for(const n of e)if(t instanceof n)return!0;return!1}static getPortMeta(t){return{position:t,attrs:{circle:{r:4,magnet:!0,stroke:"#31d0c6",strokeWidth:1,fill:"#fff"}}}}static formatName(t){const e=10;return!t||t.length<=e?t:t.substring(0,e)+"..."}clone(){const t=this.constructor;return new t(g(d({},this.vMeta),{id:void 0}))}htmlFactory(){if(!this.attrs)return;const t=`\n <div class="graph-service-unit">\n <i class="${this.vMeta.icon} unit-icon" ></i>\n <div class="unit-wrapper">${this.label}</div>\n <i class="graphfont graph-${this.vMeta.status} unit-icon" ></i>\n </div>\n `;this.setAttrs({html:{html:t}})}setVMeta(t){const e=Object.keys(t);for(const n of e){const e=t[n];void 0!==e&&(this.vMeta[n]=e)}this.setLabel(t.label),t.position&&this.setPosition(t.position),this.htmlFactory()}click(t){}rightClick(t){}isMove(){return!0}isCreateEdge(t){if("out"!==t.getAttribute("port-group"))return!1;const e=this.vMeta.drawer.graph.getConnectedEdges(this,{outgoing:!0});return e.length<this.vMeta.maxOutCount}isConnection(t,e){if("in"!==t.getAttribute("port-group"))return!1;const n=this.vMeta.drawer.graph.getConnectedEdges(this,{incoming:!0});return n.length<this.vMeta.maxInCount}}p(f,"width",180),p(f,"height",45),p(f,"edge",{line:{stroke:"#A2B1C3",strokeWidth:2},highlight:{stroke:"#feb663"}}),p(f,"attrs",{card:{refWidth:"100%",refHeight:"100%",fill:"transparent",rx:4,ry:4},html:{refWidth:"100%",refHeight:"100%",x:0,y:0}}),f.config({width:f.width,height:f.height,position:{x:0,y:0},attrs:{card:f.attrs.card,html:f.attrs.html},markup:[{tagName:"rect",selector:"card"},{tagName:"foreignObject",selector:"html"}],ports:{groups:{in:f.getPortMeta("left"),out:f.getPortMeta("right")},items:[{id:"in",group:"in"},{id:"out",group:"out"}]}})},44943:function(t,e,n){"use strict";n.d(e,{Nb:function(){return Hh},fh:function(){return EE},pM:function(){return kE},H:function(){return o},Jf:function(){return r},eY:function(){return s},fZ:function(){return Ab},ke:function(){return NM},Kx:function(){return LE},xH:function(){return yb},bP:function(){return AE},D5:function(){return i},M_:function(){return Tb},yp:function(){return w},Ss:function(){return Xw}});var i={};n.r(i),n.d(i,{applyMixins:function(){return Sh},clone:function(){return gh},cloneDeep:function(){return yh},createClass:function(){return Lh},defaults:function(){return wh},defaultsDeep:function(){return Ah},ensure:function(){return Dh},flatten:function(){return Gh},getBoolean:function(){return Rh},getByPath:function(){return zh},getNumber:function(){return Ih},getValue:function(){return Bh},has:function(){return ri},inherit:function(){return Th},isEmpty:function(){return Ml},isEqual:function(){return vl},isMaliciousProp:function(){return Vh},isObject:function(){return M},isPlainObject:function(){return fr},merge:function(){return jo},pick:function(){return ns},setByPath:function(){return $h},unsetByPath:function(){return Fh}});var s={};n.r(s),n.d(s,{apply:function(){return Ct},call:function(){return Pt},debounce:function(){return bt},isAsync:function(){return Mt},isAsyncLike:function(){return Et},throttle:function(){return wt},toAsyncBoolean:function(){return Ot},toDeferredBoolean:function(){return At}});var r={};n.r(r),n.d(r,{CASE_SENSITIVE_ATTR:function(){return xm},Event:function(){return ib},EventHook:function(){return Zy},EventObject:function(){return eb},KAPPA:function(){return fy},MouseWheelHandle:function(){return ob},addClass:function(){return Hf},after:function(){return fm},append:function(){return dm},appendTo:function(){return mm},attr:function(){return Mm},before:function(){return pm},breakText:function(){return py},children:function(){return vm},circleToPathData:function(){return Py},clearSelection:function(){return Jm},computeStyle:function(){return Xm},computeStyleInt:function(){return Ym},contains:function(){return cm},createElement:function(){return Qf},createElementNS:function(){return tm},createSVGMatrix:function(){return Dy},createSVGPoint:function(){return Ly},createSVGTransform:function(){return By},createSlicePathData:function(){return Ny},createSvgDocument:function(){return nm},createSvgElement:function(){return em},css:function(){return Km},data:function(){return ny},decomposeMatrix:function(){return $y},ellipseToPathData:function(){return Ey},empty:function(){return um},ensureId:function(){return Xf},find:function(){return om},findOne:function(){return am},findParentByClass:function(){return lm},getAttribute:function(){return wm},getClass:function(){return Gf},getComputedStyle:function(){return Hm},getData:function(){return ty},getPointsFromSvgElement:function(){return Cy},getTransformToElement:function(){return Wy},getTransformToParentElement:function(){return Xy},getVendorPrefixedName:function(){return Gm},hasClass:function(){return _f},hasScrollbars:function(){return Um},height:function(){return cb},index:function(){return rm},isCSSVariable:function(){return Wm},isElement:function(){return ym},isHTMLElement:function(){return bm},isSVGGraphicsElement:function(){return Yf},kebablizeAttrs:function(){return Am},lineToPathData:function(){return by},matrixToRotation:function(){return Gy},matrixToScale:function(){return Fy},matrixToTransformString:function(){return Ry},matrixToTranslation:function(){return _y},measureText:function(){return dy},mergeAttrs:function(){return Nm},ns:function(){return Zf},offset:function(){return ab},parseTransformString:function(){return Vy},parseXML:function(){return im},polygonToPathData:function(){return vy},polylineToPathData:function(){return xy},position:function(){return hb},prepend:function(){return gm},prop:function(){return sy},qualifyAttr:function(){return Om},rectToPathData:function(){return Oy},rectangleToPathData:function(){return My},remove:function(){return hm},removeAttribute:function(){return Cm},removeClass:function(){return Uf},rotate:function(){return Jy},sample:function(){return yy},scale:function(){return qy},setAttribute:function(){return Pm},setAttributes:function(){return Em},setData:function(){return ey},setPrefixedStyle:function(){return _m},splitTextByLength:function(){return gy},styleToObject:function(){return Sm},svgVersion:function(){return Kf},tagName:function(){return sm},text:function(){return uy},toLocalPoint:function(){return Yy},toPath:function(){return Ay},toPathData:function(){return Sy},toggleClass:function(){return Jf},transform:function(){return Hy},transformStringToMatrix:function(){return Iy},translate:function(){return Uy},uniqueId:function(){return Wf},width:function(){return lb}});var o={};n.r(o),n.d(o,{clean:function(){return Mb},ensure:function(){return Eb}});var a={};n.r(a),n.d(a,{dot:function(){return nv},doubleMesh:function(){return rv},fixedDot:function(){return iv},mesh:function(){return sv}});var l={};n.r(l),n.d(l,{flipX:function(){return av},flipXY:function(){return cv},flipY:function(){return lv},watermark:function(){return hv}});var c={};n.r(c),n.d(c,{blur:function(){return yv},brightness:function(){return Ev},contrast:function(){return Mv},dropShadow:function(){return bv},grayScale:function(){return vv},highlight:function(){return mv},hueRotate:function(){return Cv},invert:function(){return Pv},outline:function(){return fv},saturate:function(){return wv},sepia:function(){return xv}});var h={};n.r(h),n.d(h,{async:function(){return Dx},block:function(){return Ex},circle:function(){return Ix},circlePlus:function(){return Rx},classic:function(){return Mx},cross:function(){return jx},diamond:function(){return Sx},ellipse:function(){return zx},path:function(){return Tx}});var u={};n.r(u),n.d(u,{annotations:function(){return hx},atConnectionLength:function(){return tw},atConnectionLengthIgnoreGradient:function(){return Zx},atConnectionLengthKeepGradient:function(){return Yx},atConnectionRatio:function(){return ew},atConnectionRatioIgnoreGradient:function(){return Qx},atConnectionRatioKeepGradient:function(){return Kx},connection:function(){return Xx},displayEmpty:function(){return dx},eol:function(){return ux},fill:function(){return nx},filter:function(){return xx},html:function(){return vx},lineHeight:function(){return ax},port:function(){return wx},ref:function(){return Av},refCx:function(){return Vv},refCy:function(){return zv},refD:function(){return Uv},refDKeepOffset:function(){return Fv},refDResetOffset:function(){return $v},refDx:function(){return Tv},refDy:function(){return kv},refHeight:function(){return Lv},refHeight2:function(){return Yv},refPoints:function(){return Jv},refPointsKeepOffset:function(){return _v},refPointsResetOffset:function(){return Gv},refR:function(){return Hv},refRCircumscribed:function(){return Rv},refRInscribed:function(){return Iv},refRx:function(){return Dv},refRy:function(){return Bv},refWidth:function(){return jv},refWidth2:function(){return Xv},refX:function(){return Sv},refX2:function(){return qv},refY:function(){return Nv},refY2:function(){return Wv},resetOffset:function(){return mx},sourceMarker:function(){return _x},stroke:function(){return ix},style:function(){return bx},targetMarker:function(){return Hx},text:function(){return sx},textPath:function(){return cx},textVerticalAnchor:function(){return lx},textWrap:function(){return rx},title:function(){return gx},vertexMarker:function(){return Ux},xAlign:function(){return px},yAlign:function(){return fx}});var d={};n.r(d),n.d(d,{className:function(){return ow},opacity:function(){return lw},stroke:function(){return uw}});var g={};n.r(g),n.d(g,{absolute:function(){return mw},bottom:function(){return Mw},ellipse:function(){return yw},ellipseSpread:function(){return bw},left:function(){return Cw},line:function(){return ww},right:function(){return Pw},top:function(){return Ew}});var p={};n.r(p),n.d(p,{bottom:function(){return Dw},inside:function(){return Rw},insideOriented:function(){return Vw},left:function(){return kw},manual:function(){return Tw},outside:function(){return Bw},outsideOriented:function(){return Iw},radial:function(){return Gw},radialOriented:function(){return _w},right:function(){return jw},top:function(){return Lw}});var f={};n.r(f),n.d(f,{noop:function(){return iC},pinAbsolute:function(){return cC},pinRelative:function(){return lC}});var m={};n.r(m),n.d(m,{bottom:function(){return kC},bottomLeft:function(){return IC},bottomRight:function(){return RC},center:function(){return NC},left:function(){return jC},midSide:function(){return UC},nodeCenter:function(){return _C},orth:function(){return GC},right:function(){return LC},top:function(){return TC},topLeft:function(){return DC},topRight:function(){return BC}});var y={};n.r(y),n.d(y,{closest:function(){return YC},length:function(){return WC},orth:function(){return KC},ratio:function(){return qC}});var b={};n.r(b),n.d(b,{anchor:function(){return aP},bbox:function(){return iP},boundary:function(){return rP},rect:function(){return sP}});var v={};n.r(v),n.d(v,{er:function(){return YP},loop:function(){return KP},manhattan:function(){return qP},metro:function(){return XP},normal:function(){return cP},oneSide:function(){return hP},orth:function(){return yP}});var x={};n.r(x),n.d(x,{jumpover:function(){return mE},loop:function(){return eE},normal:function(){return tE},rounded:function(){return nE},smooth:function(){return iE}});var w={};n.r(w),n.d(w,{oH:function(){return FE},rw:function(){return $E}});n(10506);class C{get disposed(){return!0===this._disposed}dispose(){this._disposed=!0}}(function(t){function e(){return(t,e,n)=>{const i=n.value,s=t.__proto__;n.value=function(...t){this.disposed||(i.call(this,...t),s.dispose.call(this))}}}t.dispose=e})(C||(C={}));class P{constructor(){this.isDisposed=!1,this.items=new Set}get disposed(){return this.isDisposed}dispose(){this.isDisposed||(this.isDisposed=!0,this.items.forEach(t=>{t.dispose()}),this.items.clear())}contains(t){return this.items.has(t)}add(t){this.items.add(t)}remove(t){this.items.delete(t)}clear(){this.items.clear()}}function E(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}(function(t){function e(e){const n=new t;return e.forEach(t=>{n.add(t)}),n}t.from=e})(P||(P={}));var M=E,O="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,A=O,S="object"==typeof self&&self&&self.Object===Object&&self,N=A||S||Function("return this")(),T=N,k=function(){return T.Date.now()},j=k,L=/\s/;function D(t){var e=t.length;while(e--&&L.test(t.charAt(e)));return e}var B=D,I=/^\s+/;function R(t){return t?t.slice(0,B(t)+1).replace(I,""):t}var V=R,z=T.Symbol,$=z,F=Object.prototype,G=F.hasOwnProperty,_=F.toString,H=$?$.toStringTag:void 0;function U(t){var e=G.call(t,H),n=t[H];try{t[H]=void 0;var i=!0}catch(r){}var s=_.call(t);return i&&(e?t[H]=n:delete t[H]),s}var J=U,q=Object.prototype,W=q.toString;function X(t){return W.call(t)}var Y=X,Z="[object Null]",K="[object Undefined]",Q=$?$.toStringTag:void 0;function tt(t){return null==t?void 0===t?K:Z:Q&&Q in Object(t)?J(t):Y(t)}var et=tt;function nt(t){return null!=t&&"object"==typeof t}var it=nt,st="[object Symbol]";function rt(t){return"symbol"==typeof t||it(t)&&et(t)==st}var ot=rt,at=NaN,lt=/^[-+]0x[0-9a-f]+$/i,ct=/^0b[01]+$/i,ht=/^0o[0-7]+$/i,ut=parseInt;function dt(t){if("number"==typeof t)return t;if(ot(t))return at;if(M(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=M(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=V(t);var n=ct.test(t);return n||ht.test(t)?ut(t.slice(2),n?2:8):lt.test(t)?at:+t}var gt=dt,pt="Expected a function",ft=Math.max,mt=Math.min;function yt(t,e,n){var i,s,r,o,a,l,c=0,h=!1,u=!1,d=!0;if("function"!=typeof t)throw new TypeError(pt);function g(e){var n=i,r=s;return i=s=void 0,c=e,o=t.apply(r,n),o}function p(t){return c=t,a=setTimeout(y,e),h?g(t):o}function f(t){var n=t-l,i=t-c,s=e-n;return u?mt(s,r-i):s}function m(t){var n=t-l,i=t-c;return void 0===l||n>=e||n<0||u&&i>=r}function y(){var t=j();if(m(t))return b(t);a=setTimeout(y,f(t))}function b(t){return a=void 0,d&&i?g(t):(i=s=void 0,o)}function v(){void 0!==a&&clearTimeout(a),c=0,i=l=s=a=void 0}function x(){return void 0===a?o:b(j())}function w(){var t=j(),n=m(t);if(i=arguments,s=this,l=t,n){if(void 0===a)return p(l);if(u)return clearTimeout(a),a=setTimeout(y,e),g(l)}return void 0===a&&(a=setTimeout(y,e)),o}return e=gt(e)||0,M(n)&&(h=!!n.leading,u="maxWait"in n,r=u?ft(gt(n.maxWait)||0,e):r,d="trailing"in n?!!n.trailing:d),w.cancel=v,w.flush=x,w}var bt=yt,vt="Expected a function";function xt(t,e,n){var i=!0,s=!0;if("function"!=typeof t)throw new TypeError(vt);return M(n)&&(i="leading"in n?!!n.leading:i,s="trailing"in n?!!n.trailing:s),bt(t,e,{leading:i,maxWait:e,trailing:s})}var wt=xt;function Ct(t,e,n){if(n)switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2]);case 4:return t.call(e,n[0],n[1],n[2],n[3]);case 5:return t.call(e,n[0],n[1],n[2],n[3],n[4]);case 6:return t.call(e,n[0],n[1],n[2],n[3],n[4],n[5]);default:return t.apply(e,n)}return t.call(e)}function Pt(t,e,...n){return Ct(t,e,n)}function Et(t){return"object"===typeof t&&t.then&&"function"===typeof t.then}function Mt(t){return null!=t&&(t instanceof Promise||Et(t))}function Ot(...t){const e=[];t.forEach(t=>{Array.isArray(t)?e.push(...t):e.push(t)});const n=e.some(t=>Mt(t));if(n){const t=e.map(t=>Mt(t)?t:Promise.resolve(!1!==t));return Promise.all(t).then(t=>t.reduce((t,e)=>!1!==e&&t,!0))}return e.every(t=>!1!==t)}function At(...t){const e=Ot(t);return"boolean"===typeof e?Promise.resolve(e):e}function St(t,e){const n=[];for(let i=0;i<t.length;i+=2){const s=t[i],r=t[i+1],o=Array.isArray(e)?e:[e],a=Ct(s,r,o);n.push(a)}return Ot(n)}class Nt{constructor(){this.listeners={}}on(t,e,n){if(null==e)return this;this.listeners[t]||(this.listeners[t]=[]);const i=this.listeners[t];return i.push(e,n),this}once(t,e,n){const i=(...s)=>(this.off(t,i),St([e,n],s));return this.on(t,i,this)}off(t,e,n){if(!(t||e||n))return this.listeners={},this;const i=this.listeners,s=t?[t]:Object.keys(i);return s.forEach(t=>{const s=i[t];if(s)if(e||n)for(let i=s.length-2;i>=0;i-=2)e&&s[i]!==e||n&&s[i+1]!==n||s.splice(i,2);else delete i[t]}),this}trigger(t,...e){let n=!0;if("*"!==t){const i=this.listeners[t];null!=i&&(n=St([...i],e))}const i=this.listeners["*"];return null!=i?Ot([n,St([...i],[t,...e])]):n}emit(t,...e){return this.trigger(t,...e)}}var Tt=Object.prototype,kt=Tt.hasOwnProperty;function jt(t,e){return null!=t&&kt.call(t,e)}var Lt=jt,Dt=Array.isArray,Bt=Dt,It=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Rt=/^\w*$/;function Vt(t,e){if(Bt(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ot(t))||(Rt.test(t)||!It.test(t)||null!=e&&t in Object(e))}var zt=Vt,$t="[object AsyncFunction]",Ft="[object Function]",Gt="[object GeneratorFunction]",_t="[object Proxy]";function Ht(t){if(!M(t))return!1;var e=et(t);return e==Ft||e==Gt||e==$t||e==_t}var Ut=Ht,Jt=T["__core-js_shared__"],qt=Jt,Wt=function(){var t=/[^.]+$/.exec(qt&&qt.keys&&qt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Xt(t){return!!Wt&&Wt in t}var Yt=Xt,Zt=Function.prototype,Kt=Zt.toString;function Qt(t){if(null!=t){try{return Kt.call(t)}catch(e){}try{return t+""}catch(e){}}return""}var te=Qt,ee=/[\\^$.*+?()[\]{}|]/g,ne=/^\[object .+?Constructor\]$/,ie=Function.prototype,se=Object.prototype,re=ie.toString,oe=se.hasOwnProperty,ae=RegExp("^"+re.call(oe).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function le(t){if(!M(t)||Yt(t))return!1;var e=Ut(t)?ae:ne;return e.test(te(t))}var ce=le;function he(t,e){return null==t?void 0:t[e]}var ue=he;function de(t,e){var n=ue(t,e);return ce(n)?n:void 0}var ge=de,pe=ge(Object,"create"),fe=pe;function me(){this.__data__=fe?fe(null):{},this.size=0}var ye=me;function be(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ve=be,xe="__lodash_hash_undefined__",we=Object.prototype,Ce=we.hasOwnProperty;function Pe(t){var e=this.__data__;if(fe){var n=e[t];return n===xe?void 0:n}return Ce.call(e,t)?e[t]:void 0}var Ee=Pe,Me=Object.prototype,Oe=Me.hasOwnProperty;function Ae(t){var e=this.__data__;return fe?void 0!==e[t]:Oe.call(e,t)}var Se=Ae,Ne="__lodash_hash_undefined__";function Te(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=fe&&void 0===e?Ne:e,this}var ke=Te;function je(t){var e=-1,n=null==t?0:t.length;this.clear();while(++e<n){var i=t[e];this.set(i[0],i[1])}}je.prototype.clear=ye,je.prototype["delete"]=ve,je.prototype.get=Ee,je.prototype.has=Se,je.prototype.set=ke;var Le=je;function De(){this.__data__=[],this.size=0}var Be=De;function Ie(t,e){return t===e||t!==t&&e!==e}var Re=Ie;function Ve(t,e){var n=t.length;while(n--)if(Re(t[n][0],e))return n;return-1}var ze=Ve,$e=Array.prototype,Fe=$e.splice;function Ge(t){var e=this.__data__,n=ze(e,t);if(n<0)return!1;var i=e.length-1;return n==i?e.pop():Fe.call(e,n,1),--this.size,!0}var _e=Ge;function He(t){var e=this.__data__,n=ze(e,t);return n<0?void 0:e[n][1]}var Ue=He;function Je(t){return ze(this.__data__,t)>-1}var qe=Je;function We(t,e){var n=this.__data__,i=ze(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}var Xe=We;function Ye(t){var e=-1,n=null==t?0:t.length;this.clear();while(++e<n){var i=t[e];this.set(i[0],i[1])}}Ye.prototype.clear=Be,Ye.prototype["delete"]=_e,Ye.prototype.get=Ue,Ye.prototype.has=qe,Ye.prototype.set=Xe;var Ze=Ye,Ke=ge(T,"Map"),Qe=Ke;function tn(){this.size=0,this.__data__={hash:new Le,map:new(Qe||Ze),string:new Le}}var en=tn;function nn(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}var sn=nn;function rn(t,e){var n=t.__data__;return sn(e)?n["string"==typeof e?"string":"hash"]:n.map}var on=rn;function an(t){var e=on(this,t)["delete"](t);return this.size-=e?1:0,e}var ln=an;function cn(t){return on(this,t).get(t)}var hn=cn;function un(t){return on(this,t).has(t)}var dn=un;function gn(t,e){var n=on(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}var pn=gn;function fn(t){var e=-1,n=null==t?0:t.length;this.clear();while(++e<n){var i=t[e];this.set(i[0],i[1])}}fn.prototype.clear=en,fn.prototype["delete"]=ln,fn.prototype.get=hn,fn.prototype.has=dn,fn.prototype.set=pn;var mn=fn,yn="Expected a function";function bn(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(yn);var n=function(){var i=arguments,s=e?e.apply(this,i):i[0],r=n.cache;if(r.has(s))return r.get(s);var o=t.apply(this,i);return n.cache=r.set(s,o)||r,o};return n.cache=new(bn.Cache||mn),n}bn.Cache=mn;var vn=bn,xn=500;function wn(t){var e=vn(t,function(t){return n.size===xn&&n.clear(),t}),n=e.cache;return e}var Cn=wn,Pn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,En=/\\(\\)?/g,Mn=Cn(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Pn,function(t,n,i,s){e.push(i?s.replace(En,"$1"):n||t)}),e}),On=Mn;function An(t,e){var n=-1,i=null==t?0:t.length,s=Array(i);while(++n<i)s[n]=e(t[n],n,t);return s}var Sn=An,Nn=1/0,Tn=$?$.prototype:void 0,kn=Tn?Tn.toString:void 0;function jn(t){if("string"==typeof t)return t;if(Bt(t))return Sn(t,jn)+"";if(ot(t))return kn?kn.call(t):"";var e=t+"";return"0"==e&&1/t==-Nn?"-0":e}var Ln=jn;function Dn(t){return null==t?"":Ln(t)}var Bn=Dn;function In(t,e){return Bt(t)?t:zt(t,e)?[t]:On(Bn(t))}var Rn=In,Vn="[object Arguments]";function zn(t){return it(t)&&et(t)==Vn}var $n=zn,Fn=Object.prototype,Gn=Fn.hasOwnProperty,_n=Fn.propertyIsEnumerable,Hn=$n(function(){return arguments}())?$n:function(t){return it(t)&&Gn.call(t,"callee")&&!_n.call(t,"callee")},Un=Hn,Jn=9007199254740991,qn=/^(?:0|[1-9]\d*)$/;function Wn(t,e){var n=typeof t;return e=null==e?Jn:e,!!e&&("number"==n||"symbol"!=n&&qn.test(t))&&t>-1&&t%1==0&&t<e}var Xn=Wn,Yn=9007199254740991;function Zn(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Yn}var Kn=Zn,Qn=1/0;function ti(t){if("string"==typeof t||ot(t))return t;var e=t+"";return"0"==e&&1/t==-Qn?"-0":e}var ei=ti;function ni(t,e,n){e=Rn(e,t);var i=-1,s=e.length,r=!1;while(++i<s){var o=ei(e[i]);if(!(r=null!=t&&n(t,o)))break;t=t[o]}return r||++i!=s?r:(s=null==t?0:t.length,!!s&&Kn(s)&&Xn(o,s)&&(Bt(t)||Un(t)))}var ii=ni;function si(t,e){return null!=t&&ii(t,e,Lt)}var ri=si;function oi(t,e){e=Rn(e,t);var n=0,i=e.length;while(null!=t&&n<i)t=t[ei(e[n++])];return n&&n==i?t:void 0}var ai=oi,li=function(){try{var t=ge(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),ci=li;function hi(t,e,n){"__proto__"==e&&ci?ci(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var ui=hi,di=Object.prototype,gi=di.hasOwnProperty;function pi(t,e,n){var i=t[e];gi.call(t,e)&&Re(i,n)&&(void 0!==n||e in t)||ui(t,e,n)}var fi=pi;function mi(t,e,n,i){if(!M(t))return t;e=Rn(e,t);var s=-1,r=e.length,o=r-1,a=t;while(null!=a&&++s<r){var l=ei(e[s]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(s!=o){var h=a[l];c=i?i(h,l,a):void 0,void 0===c&&(c=M(h)?h:Xn(e[s+1])?[]:{})}fi(a,l,c),a=a[l]}return t}var yi=mi;function bi(t,e,n){var i=-1,s=e.length,r={};while(++i<s){var o=e[i],a=ai(t,o);n(a,o)&&yi(r,Rn(o,t),a)}return r}var vi=bi;function xi(t,e){return null!=t&&e in Object(t)}var wi=xi;function Ci(t,e){return null!=t&&ii(t,e,wi)}var Pi=Ci;function Ei(t,e){return vi(t,e,function(e,n){return Pi(t,n)})}var Mi=Ei;function Oi(t,e){var n=-1,i=e.length,s=t.length;while(++n<i)t[s+n]=e[n];return t}var Ai=Oi,Si=$?$.isConcatSpreadable:void 0;function Ni(t){return Bt(t)||Un(t)||!!(Si&&t&&t[Si])}var Ti=Ni;function ki(t,e,n,i,s){var r=-1,o=t.length;n||(n=Ti),s||(s=[]);while(++r<o){var a=t[r];e>0&&n(a)?e>1?ki(a,e-1,n,i,s):Ai(s,a):i||(s[s.length]=a)}return s}var ji=ki;function Li(t){var e=null==t?0:t.length;return e?ji(t,1):[]}var Di=Li;function Bi(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var Ii=Bi,Ri=Math.max;function Vi(t,e,n){return e=Ri(void 0===e?t.length-1:e,0),function(){var i=arguments,s=-1,r=Ri(i.length-e,0),o=Array(r);while(++s<r)o[s]=i[e+s];s=-1;var a=Array(e+1);while(++s<e)a[s]=i[s];return a[e]=n(o),Ii(t,this,a)}}var zi=Vi;function $i(t){return function(){return t}}var Fi=$i;function Gi(t){return t}var _i=Gi,Hi=ci?function(t,e){return ci(t,"toString",{configurable:!0,enumerable:!1,value:Fi(e),writable:!0})}:_i,Ui=Hi,Ji=800,qi=16,Wi=Date.now;function Xi(t){var e=0,n=0;return function(){var i=Wi(),s=qi-(i-n);if(n=i,s>0){if(++e>=Ji)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Yi=Xi,Zi=Yi(Ui),Ki=Zi;function Qi(t){return Ki(zi(t,void 0,Di),t+"")}var ts=Qi,es=ts(function(t,e){return null==t?{}:Mi(t,e)}),ns=es;function is(){this.__data__=new Ze,this.size=0}var ss=is;function rs(t){var e=this.__data__,n=e["delete"](t);return this.size=e.size,n}var os=rs;function as(t){return this.__data__.get(t)}var ls=as;function cs(t){return this.__data__.has(t)}var hs=cs,us=200;function ds(t,e){var n=this.__data__;if(n instanceof Ze){var i=n.__data__;if(!Qe||i.length<us-1)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new mn(i)}return n.set(t,e),this.size=n.size,this}var gs=ds;function ps(t){var e=this.__data__=new Ze(t);this.size=e.size}ps.prototype.clear=ss,ps.prototype["delete"]=os,ps.prototype.get=ls,ps.prototype.has=hs,ps.prototype.set=gs;var fs=ps;function ms(t,e,n){(void 0!==n&&!Re(t[e],n)||void 0===n&&!(e in t))&&ui(t,e,n)}var ys=ms;function bs(t){return function(e,n,i){var s=-1,r=Object(e),o=i(e),a=o.length;while(a--){var l=o[t?a:++s];if(!1===n(r[l],l,r))break}return e}}var vs=bs,xs=vs(),ws=xs,Cs="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ps=Cs&&"object"==typeof module&&module&&!module.nodeType&&module,Es=Ps&&Ps.exports===Cs,Ms=Es?T.Buffer:void 0,Os=Ms?Ms.allocUnsafe:void 0;function As(t,e){if(e)return t.slice();var n=t.length,i=Os?Os(n):new t.constructor(n);return t.copy(i),i}var Ss=As,Ns=T.Uint8Array,Ts=Ns;function ks(t){var e=new t.constructor(t.byteLength);return new Ts(e).set(new Ts(t)),e}var js=ks;function Ls(t,e){var n=e?js(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var Ds=Ls;function Bs(t,e){var n=-1,i=t.length;e||(e=Array(i));while(++n<i)e[n]=t[n];return e}var Is=Bs,Rs=Object.create,Vs=function(){function t(){}return function(e){if(!M(e))return{};if(Rs)return Rs(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}(),zs=Vs;function $s(t,e){return function(n){return t(e(n))}}var Fs=$s,Gs=Fs(Object.getPrototypeOf,Object),_s=Gs,Hs=Object.prototype;function Us(t){var e=t&&t.constructor,n="function"==typeof e&&e.prototype||Hs;return t===n}var Js=Us;function qs(t){return"function"!=typeof t.constructor||Js(t)?{}:zs(_s(t))}var Ws=qs;function Xs(t){return null!=t&&Kn(t.length)&&!Ut(t)}var Ys=Xs;function Zs(t){return it(t)&&Ys(t)}var Ks=Zs;function Qs(){return!1}var tr=Qs,er="object"==typeof exports&&exports&&!exports.nodeType&&exports,nr=er&&"object"==typeof module&&module&&!module.nodeType&&module,ir=nr&&nr.exports===er,sr=ir?T.Buffer:void 0,rr=sr?sr.isBuffer:void 0,or=rr||tr,ar=or,lr="[object Object]",cr=Function.prototype,hr=Object.prototype,ur=cr.toString,dr=hr.hasOwnProperty,gr=ur.call(Object);function pr(t){if(!it(t)||et(t)!=lr)return!1;var e=_s(t);if(null===e)return!0;var n=dr.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&ur.call(n)==gr}var fr=pr,mr="[object Arguments]",yr="[object Array]",br="[object Boolean]",vr="[object Date]",xr="[object Error]",wr="[object Function]",Cr="[object Map]",Pr="[object Number]",Er="[object Object]",Mr="[object RegExp]",Or="[object Set]",Ar="[object String]",Sr="[object WeakMap]",Nr="[object ArrayBuffer]",Tr="[object DataView]",kr="[object Float32Array]",jr="[object Float64Array]",Lr="[object Int8Array]",Dr="[object Int16Array]",Br="[object Int32Array]",Ir="[object Uint8Array]",Rr="[object Uint8ClampedArray]",Vr="[object Uint16Array]",zr="[object Uint32Array]",$r={};function Fr(t){return it(t)&&Kn(t.length)&&!!$r[et(t)]}$r[kr]=$r[jr]=$r[Lr]=$r[Dr]=$r[Br]=$r[Ir]=$r[Rr]=$r[Vr]=$r[zr]=!0,$r[mr]=$r[yr]=$r[Nr]=$r[br]=$r[Tr]=$r[vr]=$r[xr]=$r[wr]=$r[Cr]=$r[Pr]=$r[Er]=$r[Mr]=$r[Or]=$r[Ar]=$r[Sr]=!1;var Gr=Fr;function _r(t){return function(e){return t(e)}}var Hr=_r,Ur="object"==typeof exports&&exports&&!exports.nodeType&&exports,Jr=Ur&&"object"==typeof module&&module&&!module.nodeType&&module,qr=Jr&&Jr.exports===Ur,Wr=qr&&A.process,Xr=function(){try{var t=Jr&&Jr.require&&Jr.require("util").types;return t||Wr&&Wr.binding&&Wr.binding("util")}catch(e){}}(),Yr=Xr,Zr=Yr&&Yr.isTypedArray,Kr=Zr?Hr(Zr):Gr,Qr=Kr;function to(t,e){if(("constructor"!==e||"function"!==typeof t[e])&&"__proto__"!=e)return t[e]}var eo=to;function no(t,e,n,i){var s=!n;n||(n={});var r=-1,o=e.length;while(++r<o){var a=e[r],l=i?i(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),s?ui(n,a,l):fi(n,a,l)}return n}var io=no;function so(t,e){var n=-1,i=Array(t);while(++n<t)i[n]=e(n);return i}var ro=so,oo=Object.prototype,ao=oo.hasOwnProperty;function lo(t,e){var n=Bt(t),i=!n&&Un(t),s=!n&&!i&&ar(t),r=!n&&!i&&!s&&Qr(t),o=n||i||s||r,a=o?ro(t.length,String):[],l=a.length;for(var c in t)!e&&!ao.call(t,c)||o&&("length"==c||s&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Xn(c,l))||a.push(c);return a}var co=lo;function ho(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}var uo=ho,go=Object.prototype,po=go.hasOwnProperty;function fo(t){if(!M(t))return uo(t);var e=Js(t),n=[];for(var i in t)("constructor"!=i||!e&&po.call(t,i))&&n.push(i);return n}var mo=fo;function yo(t){return Ys(t)?co(t,!0):mo(t)}var bo=yo;function vo(t){return io(t,bo(t))}var xo=vo;function wo(t,e,n,i,s,r,o){var a=eo(t,n),l=eo(e,n),c=o.get(l);if(c)ys(t,n,c);else{var h=r?r(a,l,n+"",t,e,o):void 0,u=void 0===h;if(u){var d=Bt(l),g=!d&&ar(l),p=!d&&!g&&Qr(l);h=l,d||g||p?Bt(a)?h=a:Ks(a)?h=Is(a):g?(u=!1,h=Ss(l,!0)):p?(u=!1,h=Ds(l,!0)):h=[]:fr(l)||Un(l)?(h=a,Un(a)?h=xo(a):M(a)&&!Ut(a)||(h=Ws(l))):u=!1}u&&(o.set(l,h),s(h,l,i,r,o),o["delete"](l)),ys(t,n,h)}}var Co=wo;function Po(t,e,n,i,s){t!==e&&ws(e,function(r,o){if(s||(s=new fs),M(r))Co(t,e,o,n,Po,i,s);else{var a=i?i(eo(t,o),r,o+"",t,e,s):void 0;void 0===a&&(a=r),ys(t,o,a)}},bo)}var Eo=Po;function Mo(t,e){return Ki(zi(t,e,_i),t+"")}var Oo=Mo;function Ao(t,e,n){if(!M(n))return!1;var i=typeof e;return!!("number"==i?Ys(n)&&Xn(e,n.length):"string"==i&&e in n)&&Re(n[e],t)}var So=Ao;function No(t){return Oo(function(e,n){var i=-1,s=n.length,r=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;r=t.length>3&&"function"==typeof r?(s--,r):void 0,o&&So(n[0],n[1],o)&&(r=s<3?void 0:r,s=1),e=Object(e);while(++i<s){var a=n[i];a&&t(e,a,i,r)}return e})}var To=No,ko=To(function(t,e,n){Eo(t,e,n)}),jo=ko,Lo="__lodash_hash_undefined__";function Do(t){return this.__data__.set(t,Lo),this}var Bo=Do;function Io(t){return this.__data__.has(t)}var Ro=Io;function Vo(t){var e=-1,n=null==t?0:t.length;this.__data__=new mn;while(++e<n)this.add(t[e])}Vo.prototype.add=Vo.prototype.push=Bo,Vo.prototype.has=Ro;var zo=Vo;function $o(t,e){var n=-1,i=null==t?0:t.length;while(++n<i)if(e(t[n],n,t))return!0;return!1}var Fo=$o;function Go(t,e){return t.has(e)}var _o=Go,Ho=1,Uo=2;function Jo(t,e,n,i,s,r){var o=n&Ho,a=t.length,l=e.length;if(a!=l&&!(o&&l>a))return!1;var c=r.get(t),h=r.get(e);if(c&&h)return c==e&&h==t;var u=-1,d=!0,g=n&Uo?new zo:void 0;r.set(t,e),r.set(e,t);while(++u<a){var p=t[u],f=e[u];if(i)var m=o?i(f,p,u,e,t,r):i(p,f,u,t,e,r);if(void 0!==m){if(m)continue;d=!1;break}if(g){if(!Fo(e,function(t,e){if(!_o(g,e)&&(p===t||s(p,t,n,i,r)))return g.push(e)})){d=!1;break}}else if(p!==f&&!s(p,f,n,i,r)){d=!1;break}}return r["delete"](t),r["delete"](e),d}var qo=Jo;function Wo(t){var e=-1,n=Array(t.size);return t.forEach(function(t,i){n[++e]=[i,t]}),n}var Xo=Wo;function Yo(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var Zo=Yo,Ko=1,Qo=2,ta="[object Boolean]",ea="[object Date]",na="[object Error]",ia="[object Map]",sa="[object Number]",ra="[object RegExp]",oa="[object Set]",aa="[object String]",la="[object Symbol]",ca="[object ArrayBuffer]",ha="[object DataView]",ua=$?$.prototype:void 0,da=ua?ua.valueOf:void 0;function ga(t,e,n,i,s,r,o){switch(n){case ha:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case ca:return!(t.byteLength!=e.byteLength||!r(new Ts(t),new Ts(e)));case ta:case ea:case sa:return Re(+t,+e);case na:return t.name==e.name&&t.message==e.message;case ra:case aa:return t==e+"";case ia:var a=Xo;case oa:var l=i&Ko;if(a||(a=Zo),t.size!=e.size&&!l)return!1;var c=o.get(t);if(c)return c==e;i|=Qo,o.set(t,e);var h=qo(a(t),a(e),i,s,r,o);return o["delete"](t),h;case la:if(da)return da.call(t)==da.call(e)}return!1}var pa=ga;function fa(t,e,n){var i=e(t);return Bt(t)?i:Ai(i,n(t))}var ma=fa;function ya(t,e){var n=-1,i=null==t?0:t.length,s=0,r=[];while(++n<i){var o=t[n];e(o,n,t)&&(r[s++]=o)}return r}var ba=ya;function va(){return[]}var xa=va,wa=Object.prototype,Ca=wa.propertyIsEnumerable,Pa=Object.getOwnPropertySymbols,Ea=Pa?function(t){return null==t?[]:(t=Object(t),ba(Pa(t),function(e){return Ca.call(t,e)}))}:xa,Ma=Ea,Oa=Fs(Object.keys,Object),Aa=Oa,Sa=Object.prototype,Na=Sa.hasOwnProperty;function Ta(t){if(!Js(t))return Aa(t);var e=[];for(var n in Object(t))Na.call(t,n)&&"constructor"!=n&&e.push(n);return e}var ka=Ta;function ja(t){return Ys(t)?co(t):ka(t)}var La=ja;function Da(t){return ma(t,La,Ma)}var Ba=Da,Ia=1,Ra=Object.prototype,Va=Ra.hasOwnProperty;function za(t,e,n,i,s,r){var o=n&Ia,a=Ba(t),l=a.length,c=Ba(e),h=c.length;if(l!=h&&!o)return!1;var u=l;while(u--){var d=a[u];if(!(o?d in e:Va.call(e,d)))return!1}var g=r.get(t),p=r.get(e);if(g&&p)return g==e&&p==t;var f=!0;r.set(t,e),r.set(e,t);var m=o;while(++u<l){d=a[u];var y=t[d],b=e[d];if(i)var v=o?i(b,y,d,e,t,r):i(y,b,d,t,e,r);if(!(void 0===v?y===b||s(y,b,n,i,r):v)){f=!1;break}m||(m="constructor"==d)}if(f&&!m){var x=t.constructor,w=e.constructor;x==w||!("constructor"in t)||!("constructor"in e)||"function"==typeof x&&x instanceof x&&"function"==typeof w&&w instanceof w||(f=!1)}return r["delete"](t),r["delete"](e),f}var $a=za,Fa=ge(T,"DataView"),Ga=Fa,_a=ge(T,"Promise"),Ha=_a,Ua=ge(T,"Set"),Ja=Ua,qa=ge(T,"WeakMap"),Wa=qa,Xa="[object Map]",Ya="[object Object]",Za="[object Promise]",Ka="[object Set]",Qa="[object WeakMap]",tl="[object DataView]",el=te(Ga),nl=te(Qe),il=te(Ha),sl=te(Ja),rl=te(Wa),ol=et;(Ga&&ol(new Ga(new ArrayBuffer(1)))!=tl||Qe&&ol(new Qe)!=Xa||Ha&&ol(Ha.resolve())!=Za||Ja&&ol(new Ja)!=Ka||Wa&&ol(new Wa)!=Qa)&&(ol=function(t){var e=et(t),n=e==Ya?t.constructor:void 0,i=n?te(n):"";if(i)switch(i){case el:return tl;case nl:return Xa;case il:return Za;case sl:return Ka;case rl:return Qa}return e});var al=ol,ll=1,cl="[object Arguments]",hl="[object Array]",ul="[object Object]",dl=Object.prototype,gl=dl.hasOwnProperty;function pl(t,e,n,i,s,r){var o=Bt(t),a=Bt(e),l=o?hl:al(t),c=a?hl:al(e);l=l==cl?ul:l,c=c==cl?ul:c;var h=l==ul,u=c==ul,d=l==c;if(d&&ar(t)){if(!ar(e))return!1;o=!0,h=!1}if(d&&!h)return r||(r=new fs),o||Qr(t)?qo(t,e,n,i,s,r):pa(t,e,l,n,i,s,r);if(!(n&ll)){var g=h&&gl.call(t,"__wrapped__"),p=u&&gl.call(e,"__wrapped__");if(g||p){var f=g?t.value():t,m=p?e.value():e;return r||(r=new fs),s(f,m,n,i,r)}}return!!d&&(r||(r=new fs),$a(t,e,n,i,s,r))}var fl=pl;function ml(t,e,n,i,s){return t===e||(null==t||null==e||!it(t)&&!it(e)?t!==t&&e!==e:fl(t,e,n,i,ml,s))}var yl=ml;function bl(t,e){return yl(t,e)}var vl=bl,xl="[object Map]",wl="[object Set]",Cl=Object.prototype,Pl=Cl.hasOwnProperty;function El(t){if(null==t)return!0;if(Ys(t)&&(Bt(t)||"string"==typeof t||"function"==typeof t.splice||ar(t)||Qr(t)||Un(t)))return!t.length;var e=al(t);if(e==xl||e==wl)return!t.size;if(Js(t))return!ka(t).length;for(var n in t)if(Pl.call(t,n))return!1;return!0}var Ml=El;function Ol(t,e){var n=-1,i=null==t?0:t.length;while(++n<i)if(!1===e(t[n],n,t))break;return t}var Al=Ol;function Sl(t,e){return t&&io(e,La(e),t)}var Nl=Sl;function Tl(t,e){return t&&io(e,bo(e),t)}var kl=Tl;function jl(t,e){return io(t,Ma(t),e)}var Ll=jl,Dl=Object.getOwnPropertySymbols,Bl=Dl?function(t){var e=[];while(t)Ai(e,Ma(t)),t=_s(t);return e}:xa,Il=Bl;function Rl(t,e){return io(t,Il(t),e)}var Vl=Rl;function zl(t){return ma(t,bo,Il)}var $l=zl,Fl=Object.prototype,Gl=Fl.hasOwnProperty;function _l(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Gl.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var Hl=_l;function Ul(t,e){var n=e?js(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}var Jl=Ul,ql=/\w*$/;function Wl(t){var e=new t.constructor(t.source,ql.exec(t));return e.lastIndex=t.lastIndex,e}var Xl=Wl,Yl=$?$.prototype:void 0,Zl=Yl?Yl.valueOf:void 0;function Kl(t){return Zl?Object(Zl.call(t)):{}}var Ql=Kl,tc="[object Boolean]",ec="[object Date]",nc="[object Map]",ic="[object Number]",sc="[object RegExp]",rc="[object Set]",oc="[object String]",ac="[object Symbol]",lc="[object ArrayBuffer]",cc="[object DataView]",hc="[object Float32Array]",uc="[object Float64Array]",dc="[object Int8Array]",gc="[object Int16Array]",pc="[object Int32Array]",fc="[object Uint8Array]",mc="[object Uint8ClampedArray]",yc="[object Uint16Array]",bc="[object Uint32Array]";function vc(t,e,n){var i=t.constructor;switch(e){case lc:return js(t);case tc:case ec:return new i(+t);case cc:return Jl(t,n);case hc:case uc:case dc:case gc:case pc:case fc:case mc:case yc:case bc:return Ds(t,n);case nc:return new i;case ic:case oc:return new i(t);case sc:return Xl(t);case rc:return new i;case ac:return Ql(t)}}var xc=vc,wc="[object Map]";function Cc(t){return it(t)&&al(t)==wc}var Pc=Cc,Ec=Yr&&Yr.isMap,Mc=Ec?Hr(Ec):Pc,Oc=Mc,Ac="[object Set]";function Sc(t){return it(t)&&al(t)==Ac}var Nc=Sc,Tc=Yr&&Yr.isSet,kc=Tc?Hr(Tc):Nc,jc=kc,Lc=1,Dc=2,Bc=4,Ic="[object Arguments]",Rc="[object Array]",Vc="[object Boolean]",zc="[object Date]",$c="[object Error]",Fc="[object Function]",Gc="[object GeneratorFunction]",_c="[object Map]",Hc="[object Number]",Uc="[object Object]",Jc="[object RegExp]",qc="[object Set]",Wc="[object String]",Xc="[object Symbol]",Yc="[object WeakMap]",Zc="[object ArrayBuffer]",Kc="[object DataView]",Qc="[object Float32Array]",th="[object Float64Array]",eh="[object Int8Array]",nh="[object Int16Array]",ih="[object Int32Array]",sh="[object Uint8Array]",rh="[object Uint8ClampedArray]",oh="[object Uint16Array]",ah="[object Uint32Array]",lh={};function ch(t,e,n,i,s,r){var o,a=e&Lc,l=e&Dc,c=e&Bc;if(n&&(o=s?n(t,i,s,r):n(t)),void 0!==o)return o;if(!M(t))return t;var h=Bt(t);if(h){if(o=Hl(t),!a)return Is(t,o)}else{var u=al(t),d=u==Fc||u==Gc;if(ar(t))return Ss(t,a);if(u==Uc||u==Ic||d&&!s){if(o=l||d?{}:Ws(t),!a)return l?Vl(t,kl(o,t)):Ll(t,Nl(o,t))}else{if(!lh[u])return s?t:{};o=xc(t,u,a)}}r||(r=new fs);var g=r.get(t);if(g)return g;r.set(t,o),jc(t)?t.forEach(function(i){o.add(ch(i,e,n,i,t,r))}):Oc(t)&&t.forEach(function(i,s){o.set(s,ch(i,e,n,s,t,r))});var p=c?l?$l:Ba:l?bo:La,f=h?void 0:p(t);return Al(f||t,function(i,s){f&&(s=i,i=t[s]),fi(o,s,ch(i,e,n,s,t,r))}),o}lh[Ic]=lh[Rc]=lh[Zc]=lh[Kc]=lh[Vc]=lh[zc]=lh[Qc]=lh[th]=lh[eh]=lh[nh]=lh[ih]=lh[_c]=lh[Hc]=lh[Uc]=lh[Jc]=lh[qc]=lh[Wc]=lh[Xc]=lh[sh]=lh[rh]=lh[oh]=lh[ah]=!0,lh[$c]=lh[Fc]=lh[Yc]=!1;var hh=ch,uh=4;function dh(t){return hh(t,uh)}var gh=dh,ph=1,fh=4;function mh(t){return hh(t,ph|fh)}var yh=mh,bh=Object.prototype,vh=bh.hasOwnProperty,xh=Oo(function(t,e){t=Object(t);var n=-1,i=e.length,s=i>2?e[2]:void 0;s&&So(e[0],e[1],s)&&(i=1);while(++n<i){var r=e[n],o=bo(r),a=-1,l=o.length;while(++a<l){var c=o[a],h=t[c];(void 0===h||Re(h,bh[c])&&!vh.call(t,c))&&(t[c]=r[c])}}return t}),wh=xh;function Ch(t,e,n,i,s,r){return M(t)&&M(e)&&(r.set(e,t),Eo(t,e,void 0,Ch,r),r["delete"](e)),t}var Ph=Ch,Eh=To(function(t,e,n,i){Eo(t,e,n,i)}),Mh=Eh,Oh=Oo(function(t){return t.push(void 0,Ph),Ii(Mh,void 0,t)}),Ah=Oh;function Sh(t,...e){e.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(n=>{"constructor"!==n&&Object.defineProperty(t.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n))})})}const Nh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])};function Th(t,e){function n(){this.constructor=t}Nh(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}class kh{}const jh=/^\s*class\s+/.test(`${kh}`)||/^\s*class\s*\{/.test(`${class{}}`);function Lh(t,e){let n;return jh?n=class extends e{}:(n=function(){return e.apply(this,arguments)},Th(n,e)),Object.defineProperty(n,"name",{value:t}),n}function Dh(t,e){return null!=t?t:e}function Bh(t,e,n){const i=null!=t?t[e]:null;return void 0!==n?Dh(i,n):i}function Ih(t,e,n){let i=null!=t?t[e]:null;return null==i?n:(i=+i,Number.isNaN(i)||!Number.isFinite(i)?n:i)}function Rh(t,e,n){const i=null!=t?t[e]:null;return null==i?n:!!i}function Vh(t){return"__proto__"===t}function zh(t,e,n="/"){let i;const s=Array.isArray(e)?e:e.split(n);if(s.length){i=t;while(s.length){const t=s.shift();if(Object(i)!==i||!t||!(t in i))return;i=i[t]}}return i}function $h(t,e,n,i="/"){const s=Array.isArray(e)?e:e.split(i),r=s.pop();if(r&&!Vh(r)){let e=t;s.forEach(t=>{Vh(t)||(null==e[t]&&(e[t]={}),e=e[t])}),e[r]=n}return t}function Fh(t,e,n="/"){const i=Array.isArray(e)?e.slice():e.split(n),s=i.pop();if(s)if(i.length>0){const e=zh(t,i);e&&delete e[s]}else delete t[s];return t}function Gh(t,e="/",n){const i={};Object.keys(t).forEach(s=>{const r=t[s];let o="object"===typeof r||Array.isArray(r);if(o&&n&&n(r)&&(o=!1),o){const t=Gh(r,e,n);Object.keys(t).forEach(n=>{i[s+e+n]=t[n]})}else i[s]=r});for(const s in t)Object.prototype.hasOwnProperty.call(t,s);return i}var _h=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class Hh extends Nt{dispose(){this.off()}}_h([C.dispose()],Hh.prototype,"dispose",null),function(t){t.dispose=C.dispose}(Hh||(Hh={})),Sh(Hh,C);function Uh(t,e,n,i){var s=t.length,r=n+(i?1:-1);while(i?r--:++r<s)if(e(t[r],r,t))return r;return-1}var Jh=Uh;function qh(t){return t!==t}var Wh=qh;function Xh(t,e,n){var i=n-1,s=t.length;while(++i<s)if(t[i]===e)return i;return-1}var Yh=Xh;function Zh(t,e,n){return e===e?Yh(t,e,n):Jh(t,Wh,n)}var Kh=Zh;function Qh(t,e){var n=null==t?0:t.length;return!!n&&Kh(t,e,0)>-1}var tu=Qh;function eu(t,e,n){var i=-1,s=null==t?0:t.length;while(++i<s)if(n(e,t[i]))return!0;return!1}var nu=eu;function iu(){}var su=iu,ru=1/0,ou=Ja&&1/Zo(new Ja([,-0]))[1]==ru?function(t){return new Ja(t)}:su,au=ou,lu=200;function cu(t,e,n){var i=-1,s=tu,r=t.length,o=!0,a=[],l=a;if(n)o=!1,s=nu;else if(r>=lu){var c=e?null:au(t);if(c)return Zo(c);o=!1,s=_o,l=new zo}else l=e?[]:a;t:while(++i<r){var h=t[i],u=e?e(h):h;if(h=n||0!==h?h:0,o&&u===u){var d=l.length;while(d--)if(l[d]===u)continue t;e&&l.push(u),a.push(h)}else s(l,u,n)||(l!==a&&l.push(u),a.push(h))}return a}var hu=cu;function uu(t){return t&&t.length?hu(t):[]}var du=uu,gu=Oo(function(t){return hu(ji(t,1,Ks,!0))}),pu=gu,fu=4294967295,mu=fu-1,yu=Math.floor,bu=Math.min;function vu(t,e,n,i){var s=0,r=null==t?0:t.length;if(0===r)return 0;e=n(e);var o=e!==e,a=null===e,l=ot(e),c=void 0===e;while(s<r){var h=yu((s+r)/2),u=n(t[h]),d=void 0!==u,g=null===u,p=u===u,f=ot(u);if(o)var m=i||p;else m=c?p&&(i||d):a?p&&d&&(i||!g):l?p&&d&&!g&&(i||!f):!g&&!f&&(i?u<=e:u<e);m?s=h+1:r=h}return bu(r,mu)}var xu=vu,wu=4294967295,Cu=wu>>>1;function Pu(t,e,n){var i=0,s=null==t?i:t.length;if("number"==typeof e&&e===e&&s<=Cu){while(i<s){var r=i+s>>>1,o=t[r];null!==o&&!ot(o)&&(n?o<=e:o<e)?i=r+1:s=r}return s}return xu(t,e,_i,n)}var Eu=Pu;function Mu(t,e){return Eu(t,e)}var Ou=Mu,Au=1,Su=2;function Nu(t,e,n,i){var s=n.length,r=s,o=!i;if(null==t)return!r;t=Object(t);while(s--){var a=n[s];if(o&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}while(++s<r){a=n[s];var l=a[0],c=t[l],h=a[1];if(o&&a[2]){if(void 0===c&&!(l in t))return!1}else{var u=new fs;if(i)var d=i(c,h,l,t,e,u);if(!(void 0===d?yl(h,c,Au|Su,i,u):d))return!1}}return!0}var Tu=Nu;function ku(t){return t===t&&!M(t)}var ju=ku;function Lu(t){var e=La(t),n=e.length;while(n--){var i=e[n],s=t[i];e[n]=[i,s,ju(s)]}return e}var Du=Lu;function Bu(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}var Iu=Bu;function Ru(t){var e=Du(t);return 1==e.length&&e[0][2]?Iu(e[0][0],e[0][1]):function(n){return n===t||Tu(n,t,e)}}var Vu=Ru;function zu(t,e,n){var i=null==t?void 0:ai(t,e);return void 0===i?n:i}var $u=zu,Fu=1,Gu=2;function _u(t,e){return zt(t)&&ju(e)?Iu(ei(t),e):function(n){var i=$u(n,t);return void 0===i&&i===e?Pi(n,t):yl(e,i,Fu|Gu)}}var Hu=_u;function Uu(t){return function(e){return null==e?void 0:e[t]}}var Ju=Uu;function qu(t){return function(e){return ai(e,t)}}var Wu=qu;function Xu(t){return zt(t)?Ju(ei(t)):Wu(t)}var Yu=Xu;function Zu(t){return"function"==typeof t?t:null==t?_i:"object"==typeof t?Bt(t)?Hu(t[0],t[1]):Vu(t):Yu(t)}var Ku=Zu;function Qu(t,e,n){return xu(t,e,Ku(n,2))}var td=Qu;function ed(t,e){return t&&ws(t,e,La)}var nd=ed;function id(t,e){return function(n,i){if(null==n)return n;if(!Ys(n))return t(n,i);var s=n.length,r=e?s:-1,o=Object(n);while(e?r--:++r<s)if(!1===i(o[r],r,o))break;return n}}var sd=id,rd=sd(nd),od=rd;function ad(t,e){var n=-1,i=Ys(t)?Array(t.length):[];return od(t,function(t,s,r){i[++n]=e(t,s,r)}),i}var ld=ad;function cd(t,e){var n=t.length;t.sort(e);while(n--)t[n]=t[n].value;return t}var hd=cd;function ud(t,e){if(t!==e){var n=void 0!==t,i=null===t,s=t===t,r=ot(t),o=void 0!==e,a=null===e,l=e===e,c=ot(e);if(!a&&!c&&!r&&t>e||r&&o&&l&&!a&&!c||i&&o&&l||!n&&l||!s)return 1;if(!i&&!r&&!c&&t<e||c&&n&&s&&!i&&!r||a&&n&&s||!o&&s||!l)return-1}return 0}var dd=ud;function gd(t,e,n){var i=-1,s=t.criteria,r=e.criteria,o=s.length,a=n.length;while(++i<o){var l=dd(s[i],r[i]);if(l){if(i>=a)return l;var c=n[i];return l*("desc"==c?-1:1)}}return t.index-e.index}var pd=gd;function fd(t,e,n){e=e.length?Sn(e,function(t){return Bt(t)?function(e){return ai(e,1===t.length?t[0]:t)}:t}):[_i];var i=-1;e=Sn(e,Hr(Ku));var s=ld(t,function(t,n,s){var r=Sn(e,function(e){return e(t)});return{criteria:r,index:++i,value:t}});return hd(s,function(t,e){return pd(t,e,n)})}var md=fd,yd=Oo(function(t,e){if(null==t)return[];var n=e.length;return n>1&&So(t,e[0],e[1])?e=[]:n>2&&So(e[0],e[1],e[2])&&(e=[e[0]]),md(t,ji(e,1),[])}),bd=yd;function vd(t,e,n,i){var s=-1,r=null==t?0:t.length;while(++s<r){var o=t[s];e(i,o,n(o),t)}return i}var xd=vd;function wd(t,e,n,i){return od(t,function(t,s,r){e(i,t,n(t),r)}),i}var Cd=wd;function Pd(t,e){return function(n,i){var s=Bt(n)?xd:Cd,r=e?e():{};return s(n,t,Ku(i,2),r)}}var Ed=Pd,Md=Object.prototype,Od=Md.hasOwnProperty,Ad=Ed(function(t,e,n){Od.call(t,n)?t[n].push(e):ui(t,n,[e])}),Sd=Ad,Nd=200;function Td(t,e,n,i){var s=-1,r=tu,o=!0,a=t.length,l=[],c=e.length;if(!a)return l;n&&(e=Sn(e,Hr(n))),i?(r=nu,o=!1):e.length>=Nd&&(r=_o,o=!1,e=new zo(e));t:while(++s<a){var h=t[s],u=null==n?h:n(h);if(h=i||0!==h?h:0,o&&u===u){var d=c;while(d--)if(e[d]===u)continue t;l.push(h)}else r(e,u,i)||l.push(h)}return l}var kd=Td,jd=Oo(function(t,e){return Ks(t)?kd(t,ji(e,1,Ks,!0)):[]}),Ld=jd;function Dd(t,e,n){var i=-1,s=t.length;while(++i<s){var r=t[i],o=e(r);if(null!=o&&(void 0===a?o===o&&!ot(o):n(o,a)))var a=o,l=r}return l}var Bd=Dd;function Id(t,e){return t>e}var Rd=Id;function Vd(t){return t&&t.length?Bd(t,_i,Rd):void 0}var zd=Vd;function $d(t,e,n,i){var s=-1,r=null==t?0:t.length;i&&r&&(n=t[++s]);while(++s<r)n=e(n,t[s],s,t);return n}var Fd=$d;function Gd(t){return function(e){return null==t?void 0:t[e]}}var _d=Gd,Hd={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},Ud=_d(Hd),Jd=Ud,qd=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Wd="\\u0300-\\u036f",Xd="\\ufe20-\\ufe2f",Yd="\\u20d0-\\u20ff",Zd=Wd+Xd+Yd,Kd="["+Zd+"]",Qd=RegExp(Kd,"g");function tg(t){return t=Bn(t),t&&t.replace(qd,Jd).replace(Qd,"")}var eg=tg,ng=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function ig(t){return t.match(ng)||[]}var sg=ig,rg=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function og(t){return rg.test(t)}var ag=og,lg="\\ud800-\\udfff",cg="\\u0300-\\u036f",hg="\\ufe20-\\ufe2f",ug="\\u20d0-\\u20ff",dg=cg+hg+ug,gg="\\u2700-\\u27bf",pg="a-z\\xdf-\\xf6\\xf8-\\xff",fg="\\xac\\xb1\\xd7\\xf7",mg="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",yg="\\u2000-\\u206f",bg=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",vg="A-Z\\xc0-\\xd6\\xd8-\\xde",xg="\\ufe0e\\ufe0f",wg=fg+mg+yg+bg,Cg="['’]",Pg="["+wg+"]",Eg="["+dg+"]",Mg="\\d+",Og="["+gg+"]",Ag="["+pg+"]",Sg="[^"+lg+wg+Mg+gg+pg+vg+"]",Ng="\\ud83c[\\udffb-\\udfff]",Tg="(?:"+Eg+"|"+Ng+")",kg="[^"+lg+"]",jg="(?:\\ud83c[\\udde6-\\uddff]){2}",Lg="[\\ud800-\\udbff][\\udc00-\\udfff]",Dg="["+vg+"]",Bg="\\u200d",Ig="(?:"+Ag+"|"+Sg+")",Rg="(?:"+Dg+"|"+Sg+")",Vg="(?:"+Cg+"(?:d|ll|m|re|s|t|ve))?",zg="(?:"+Cg+"(?:D|LL|M|RE|S|T|VE))?",$g=Tg+"?",Fg="["+xg+"]?",Gg="(?:"+Bg+"(?:"+[kg,jg,Lg].join("|")+")"+Fg+$g+")*",_g="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Hg="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ug=Fg+$g+Gg,Jg="(?:"+[Og,jg,Lg].join("|")+")"+Ug,qg=RegExp([Dg+"?"+Ag+"+"+Vg+"(?="+[Pg,Dg,"$"].join("|")+")",Rg+"+"+zg+"(?="+[Pg,Dg+Ig,"$"].join("|")+")",Dg+"?"+Ig+"+"+Vg,Dg+"+"+zg,Hg,_g,Mg,Jg].join("|"),"g");function Wg(t){return t.match(qg)||[]}var Xg=Wg;function Yg(t,e,n){return t=Bn(t),e=n?void 0:e,void 0===e?ag(t)?Xg(t):sg(t):t.match(e)||[]}var Zg=Yg,Kg="['’]",Qg=RegExp(Kg,"g");function tp(t){return function(e){return Fd(Zg(eg(e).replace(Qg,"")),t,"")}}var ep=tp;function np(t,e,n){var i=-1,s=t.length;e<0&&(e=-e>s?0:s+e),n=n>s?s:n,n<0&&(n+=s),s=e>n?0:n-e>>>0,e>>>=0;var r=Array(s);while(++i<s)r[i]=t[i+e];return r}var ip=np;function sp(t,e,n){var i=t.length;return n=void 0===n?i:n,!e&&n>=i?t:ip(t,e,n)}var rp=sp,op="\\ud800-\\udfff",ap="\\u0300-\\u036f",lp="\\ufe20-\\ufe2f",cp="\\u20d0-\\u20ff",hp=ap+lp+cp,up="\\ufe0e\\ufe0f",dp="\\u200d",gp=RegExp("["+dp+op+hp+up+"]");function pp(t){return gp.test(t)}var fp=pp;function mp(t){return t.split("")}var yp=mp,bp="\\ud800-\\udfff",vp="\\u0300-\\u036f",xp="\\ufe20-\\ufe2f",wp="\\u20d0-\\u20ff",Cp=vp+xp+wp,Pp="\\ufe0e\\ufe0f",Ep="["+bp+"]",Mp="["+Cp+"]",Op="\\ud83c[\\udffb-\\udfff]",Ap="(?:"+Mp+"|"+Op+")",Sp="[^"+bp+"]",Np="(?:\\ud83c[\\udde6-\\uddff]){2}",Tp="[\\ud800-\\udbff][\\udc00-\\udfff]",kp="\\u200d",jp=Ap+"?",Lp="["+Pp+"]?",Dp="(?:"+kp+"(?:"+[Sp,Np,Tp].join("|")+")"+Lp+jp+")*",Bp=Lp+jp+Dp,Ip="(?:"+[Sp+Mp+"?",Mp,Np,Tp,Ep].join("|")+")",Rp=RegExp(Op+"(?="+Op+")|"+Ip+Bp,"g");function Vp(t){return t.match(Rp)||[]}var zp=Vp;function $p(t){return fp(t)?zp(t):yp(t)}var Fp=$p;function Gp(t){return function(e){e=Bn(e);var n=fp(e)?Fp(e):void 0,i=n?n[0]:e.charAt(0),s=n?rp(n,1).join(""):e.slice(1);return i[t]()+s}}var _p=Gp,Hp=_p("toUpperCase"),Up=Hp,Jp=ep(function(t,e,n){return t+(n?" ":"")+Up(e)}),qp=Jp;function Wp(t){return Up(Bn(t).toLowerCase())}var Xp=Wp,Yp=ep(function(t,e,n){return e=e.toLowerCase(),t+(n?Xp(e):e)}),Zp=Yp,Kp=ep(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),Qp=Kp,tf=ep(function(t,e,n){return t+(n?" ":"")+e.toLowerCase()}),ef=tf,nf=_p("toLowerCase"),sf=nf;const rf=t=>{const e=Object.create(null);return n=>{const i=e[n];return i||(e[n]=t(n))}},of=rf(t=>t.replace(/\B([A-Z])/g,"-$1").toLowerCase()),af=rf(t=>qp(Zp(t)).replace(/ /g,""));rf(t=>Qp(t).replace(/ /g,"_")),rf(t=>ef(t).replace(/ /g,".")),rf(t=>ef(t).replace(/ /g,"/")),rf(t=>Up(ef(t))),rf(t=>qp(Zp(t)));function lf(t){let e=2166136261,n=!1,i=t;for(let s=0,r=i.length;s<r;s+=1){let t=i.charCodeAt(s);t>127&&!n&&(i=unescape(encodeURIComponent(i)),t=i.charCodeAt(s),n=!0),e^=t,e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}return e>>>0}function cf(){let t="";const e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";for(let n=0,i=e.length;n<i;n+=1){const i=e[n],s=16*Math.random()|0,r="x"===i?s:"y"===i?3&s|8:i;t+=r.toString(16)}return t}function hf(t,e,n){const i=Math.min(2,Math.floor(.34*t.length));let s,r=Math.floor(.4*t.length)+1,o=!1;const a=t.toLowerCase();for(const l of e){const e=n(l);if(void 0!==e&&Math.abs(e.length-a.length)<=i){const n=e.toLowerCase();if(n===a){if(e===t)continue;return l}if(o)continue;if(e.length<3)continue;const i=uf(a,n,r-1);if(void 0===i)continue;i<3?(o=!0,s=l):(r=i,s=l)}}return s}function uf(t,e,n){let i=new Array(e.length+1),s=new Array(e.length+1);const r=n+1;for(let a=0;a<=e.length;a+=1)i[a]=a;for(let a=1;a<=t.length;a+=1){const o=t.charCodeAt(a-1),l=a>n?a-n:1,c=e.length>n+a?n+a:e.length;s[0]=a;let h=a;for(let t=1;t<l;t+=1)s[t]=r;for(let t=l;t<=c;t+=1){const n=o===e.charCodeAt(t-1)?i[t-1]:Math.min(i[t]+1,s[t-1]+1,i[t-1]+2);s[t]=n,h=Math.min(h,n)}for(let t=c+1;t<=e.length;t+=1)s[t]=r;if(h>n)return;const u=i;i=s,s=u}const o=i[e.length];return o>n?void 0:o}var df="[object Number]";function gf(t){return"number"==typeof t||it(t)&&et(t)==df}var pf=gf;function ff(t,e,n){return t===t&&(void 0!==n&&(t=t<=n?t:n),void 0!==e&&(t=t>=e?t:e)),t}var mf=ff;function yf(t,e,n){return void 0===n&&(n=e,e=void 0),void 0!==n&&(n=gt(n),n=n===n?n:0),void 0!==e&&(e=gt(e),e=e===e?e:0),mf(gt(t),e,n)}var bf=yf;function vf(t){return"string"===typeof t&&"%"===t.slice(-1)}function xf(t,e){if(null==t)return 0;let n;if("string"===typeof t){if(n=parseFloat(t),vf(t)&&(n/=100,Number.isFinite(n)))return n*e}else n=t;return Number.isFinite(n)?n>0&&n<1?n*e:n:0}function wf(t){if("object"===typeof t){let e=0,n=0,i=0,s=0;return null!=t.vertical&&Number.isFinite(t.vertical)&&(n=s=t.vertical),null!=t.horizontal&&Number.isFinite(t.horizontal)&&(i=e=t.horizontal),null!=t.left&&Number.isFinite(t.left)&&(e=t.left),null!=t.top&&Number.isFinite(t.top)&&(n=t.top),null!=t.right&&Number.isFinite(t.right)&&(i=t.right),null!=t.bottom&&Number.isFinite(t.bottom)&&(s=t.bottom),{top:n,right:i,bottom:s,left:e}}let e=0;return null!=t&&Number.isFinite(t)&&(e=t),{top:e,right:e,bottom:e,left:e}}let Cf=!1,Pf=!1,Ef=!1,Mf=!1,Of=!1,Af=!1,Sf=!1,Nf=!1,Tf=!1,kf=!1,jf=!1,Lf=!1,Df=!1,Bf=!1,If=!1,Rf=!1;if("object"===typeof navigator){const t=navigator.userAgent;Cf=t.indexOf("Macintosh")>=0,Pf=!!t.match(/(iPad|iPhone|iPod)/g),Ef=t.indexOf("Windows")>=0,Mf=t.indexOf("MSIE")>=0,Of=!!t.match(/Trident\/7\./),Af=!!t.match(/Edge\//),Sf=t.indexOf("Mozilla/")>=0&&t.indexOf("MSIE")<0&&t.indexOf("Edge/")<0,Tf=t.indexOf("Chrome/")>=0&&t.indexOf("Edge/")<0,kf=t.indexOf("Opera/")>=0||t.indexOf("OPR/")>=0,jf=t.indexOf("Firefox/")>=0,Lf=t.indexOf("AppleWebKit/")>=0&&t.indexOf("Chrome/")<0&&t.indexOf("Edge/")<0,"object"===typeof document&&(Rf=!document.createElementNS||"[object SVGForeignObjectElement]"!==`${document.createElementNS("http://www.w3.org/2000/svg","foreignObject")}`||t.indexOf("Opera/")>=0)}if("object"===typeof window&&(Nf=null!=window.chrome&&null!=window.chrome.app&&null!=window.chrome.app.runtime,Bf=null!=window.PointerEvent&&!Cf),"object"===typeof document){Df="ontouchstart"in document.documentElement;try{const t=Object.defineProperty({},"passive",{get(){If=!0}}),e=document.createElement("div");e.addEventListener&&e.addEventListener("click",()=>{},t)}catch(LM){}}var Vf;(function(t){t.IS_MAC=Cf,t.IS_IOS=Pf,t.IS_WINDOWS=Ef,t.IS_IE=Mf,t.IS_IE11=Of,t.IS_EDGE=Af,t.IS_NETSCAPE=Sf,t.IS_CHROME_APP=Nf,t.IS_CHROME=Tf,t.IS_OPERA=kf,t.IS_FIREFOX=jf,t.IS_SAFARI=Lf,t.SUPPORT_TOUCH=Df,t.SUPPORT_POINTER=Bf,t.SUPPORT_PASSIVE=If,t.NO_FOREIGNOBJECT=Rf,t.SUPPORT_FOREIGNOBJECT=!t.NO_FOREIGNOBJECT})(Vf||(Vf={})),function(t){function e(){const t=window.module;return null!=t&&null!=t.hot&&null!=t.hot.status?t.hot.status():"unkonwn"}function n(){return"apply"===e()}t.getHMRStatus=e,t.isApplyingHMR=n;const i={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};function s(t){const e=document.createElement(i[t]||"div"),n=`on${t}`;let s=n in e;return s||(e.setAttribute(n,"return;"),s="function"===typeof e[n]),s}t.isEventSupported=s}(Vf||(Vf={}));const zf=/[\t\r\n\f]/g,$f=/\S+/g,Ff=t=>` ${t} `;function Gf(t){return t&&t.getAttribute&&t.getAttribute("class")||""}function _f(t,e){if(null==t||null==e)return!1;const n=Ff(Gf(t)),i=Ff(e);return 1===t.nodeType&&n.replace(zf," ").includes(i)}function Hf(t,e){if(null!=t&&null!=e){if("function"===typeof e)return Hf(t,e(Gf(t)));if("string"===typeof e&&1===t.nodeType){const n=e.match($f)||[],i=Ff(Gf(t)).replace(zf," ");let s=n.reduce((t,e)=>t.indexOf(Ff(e))<0?`${t}${e} `:t,i);s=s.trim(),i!==s&&t.setAttribute("class",s)}}}function Uf(t,e){if(null!=t){if("function"===typeof e)return Uf(t,e(Gf(t)));if((!e||"string"===typeof e)&&1===t.nodeType){const n=(e||"").match($f)||[],i=Ff(Gf(t)).replace(zf," ");let s=n.reduce((t,e)=>{const n=Ff(e);return t.indexOf(n)>-1?t.replace(n," "):t},i);s=e?s.trim():"",i!==s&&t.setAttribute("class",s)}}}function Jf(t,e,n){if(null!=t&&null!=e)if(null==n||"string"!==typeof e){if("function"===typeof e)return Jf(t,e(Gf(t),n),n);if("string"===typeof e){const n=e.match($f)||[];n.forEach(e=>{_f(t,e)?Uf(t,e):Hf(t,e)})}}else n?Hf(t,e):Uf(t,e)}let qf=0;function Wf(){return qf+=1,`v${qf}`}function Xf(t){return null!=t.id&&""!==t.id||(t.id=Wf()),t.id}function Yf(t){return null!=t&&("function"===typeof t.getScreenCTM&&t instanceof SVGElement)}const Zf={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xml:"http://www.w3.org/XML/1998/namespace",xlink:"http://www.w3.org/1999/xlink",xhtml:"http://www.w3.org/1999/xhtml"},Kf="1.1";function Qf(t,e=document){return e.createElement(t)}function tm(t,e=Zf.xhtml,n=document){return n.createElementNS(e,t)}function em(t,e=document){return tm(t,Zf.svg,e)}function nm(t){if(t){const e=`<svg xmlns="${Zf.svg}" xmlns:xlink="${Zf.xlink}" version="${Kf}">${t}</svg>`,{documentElement:n}=im(e,{async:!1});return n}const e=document.createElementNS(Zf.svg,"svg");return e.setAttributeNS(Zf.xmlns,"xmlns:xlink",Zf.xlink),e.setAttribute("version",Kf),e}function im(t,e={}){let n;try{const i=new DOMParser;if(null!=e.async){const t=i;t.async=e.async}n=i.parseFromString(t,e.mimeType||"text/xml")}catch(i){n=void 0}if(!n||n.getElementsByTagName("parsererror").length)throw new Error(`Invalid XML: ${t}`);return n}function sm(t,e=!0){const n=t.nodeName;return e?n.toLowerCase():n.toUpperCase()}function rm(t){let e=0,n=t.previousSibling;while(n)1===n.nodeType&&(e+=1),n=n.previousSibling;return e}function om(t,e){return t.querySelectorAll(e)}function am(t,e){return t.querySelector(e)}function lm(t,e,n){const i=t.ownerSVGElement;let s=t.parentNode;while(s&&s!==n&&s!==i){if(_f(s,e))return s;s=s.parentNode}return null}function cm(t,e){const n=e&&e.parentNode;return t===n||!!(n&&1===n.nodeType&&16&t.compareDocumentPosition(n))}function hm(t){if(t){const e=Array.isArray(t)?t:[t];e.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)})}}function um(t){while(t.firstChild)t.removeChild(t.firstChild)}function dm(t,e){const n=Array.isArray(e)?e:[e];n.forEach(e=>{null!=e&&t.appendChild(e)})}function gm(t,e){const n=t.firstChild;return n?pm(n,e):dm(t,e)}function pm(t,e){const n=t.parentNode;if(n){const i=Array.isArray(e)?e:[e];i.forEach(e=>{null!=e&&n.insertBefore(e,t)})}}function fm(t,e){const n=t.parentNode;if(n){const i=Array.isArray(e)?e:[e];i.forEach(e=>{null!=e&&n.insertBefore(e,t.nextSibling)})}}function mm(t,e){null!=e&&e.appendChild(t)}function ym(t){return!!t&&1===t.nodeType}function bm(t){try{return t instanceof HTMLElement}catch(e){return"object"===typeof t&&1===t.nodeType&&"object"===typeof t.style&&"object"===typeof t.ownerDocument}}function vm(t,e){const n=[];let i=t.firstChild;for(;i;i=i.nextSibling)1===i.nodeType&&(e&&!_f(i,e)||n.push(i));return n}const xm=["viewBox","attributeName","attributeType","repeatCount","textLength","lengthAdjust","gradientUnits"];function wm(t,e){return t.getAttribute(e)}function Cm(t,e){const n=Om(e);n.ns?t.hasAttributeNS(n.ns,n.local)&&t.removeAttributeNS(n.ns,n.local):t.hasAttribute(e)&&t.removeAttribute(e)}function Pm(t,e,n){if(null==n)return Cm(t,e);const i=Om(e);i.ns&&"string"===typeof n?t.setAttributeNS(i.ns,e,n):"id"===e?t.id=`${n}`:t.setAttribute(e,`${n}`)}function Em(t,e){Object.keys(e).forEach(n=>{Pm(t,n,e[n])})}function Mm(t,e,n){if(null==e){const e=t.attributes,n={};for(let t=0;t<e.length;t+=1)n[e[t].name]=e[t].value;return n}if("string"===typeof e&&void 0===n)return t.getAttribute(e);"object"===typeof e?Em(t,e):Pm(t,e,n)}function Om(t){if(-1!==t.indexOf(":")){const e=t.split(":");return{ns:Zf[e[0]],local:e[1]}}return{ns:null,local:t}}function Am(t){const e={};return Object.keys(t).forEach(n=>{const i=xm.includes(n)?n:of(n);e[i]=t[n]}),e}function Sm(t){const e={},n=t.split(";");return n.forEach(t=>{const n=t.trim();if(n){const t=n.split("=");t.length&&(e[t[0].trim()]=t[1]?t[1].trim():"")}}),e}function Nm(t,e){return Object.keys(e).forEach(n=>{if("class"===n)t[n]=t[n]?`${t[n]} ${e[n]}`:e[n];else if("style"===n){const i="object"===typeof t[n],s="object"===typeof e[n];let r,o;i&&s?(r=t[n],o=e[n]):i?(r=t[n],o=Sm(e[n])):s?(r=Sm(t[n]),o=e[n]):(r=Sm(t[n]),o=Sm(e[n])),t[n]=Nm(r,o)}else t[n]=e[n]}),t}function Tm(t,e,n={}){const i=n.offset||0,s=[],r=[];let o,a,l=null;for(let c=0;c<t.length;c+=1){o=r[c]=t[c];for(let s=0,a=e.length;s<a;s+=1){const a=e[s],l=a.start+i,h=a.end+i;c>=l&&c<h&&("string"===typeof o?o=r[c]={t:t[c],attrs:a.attrs}:o.attrs=Nm(Nm({},o.attrs),a.attrs),n.includeAnnotationIndices&&(null==o.annotations&&(o.annotations=[]),o.annotations.push(s)))}a=r[c-1],a?M(o)&&M(a)?JSON.stringify(o.attrs)===JSON.stringify(a.attrs)?l.t+=o.t:(s.push(l),l=o):M(o)||M(a)?(s.push(l),l=o):l=(l||"")+o:l=o}return null!=l&&s.push(l),s}function km(t){return t.replace(/ /g," ")}var jm;let Lm;(function(t){function e(t){const e="data:";return t.substr(0,e.length)===e}function n(t,n){if(!t||e(t))return void setTimeout(()=>n(null,t));const i=()=>{n(new Error(`Failed to load image: ${t}`))},s=window.FileReader?t=>{if(200===t.status){const e=new FileReader;e.onload=t=>{const e=t.target.result;n(null,e)},e.onerror=i,e.readAsDataURL(t.response)}else i()}:e=>{const s=t=>{const e=32768,n=[];for(let i=0;i<t.length;i+=e)n.push(String.fromCharCode.apply(null,t.subarray(i,i+e)));return n.join("")};if(200===e.status){let i=t.split(".").pop()||"png";"svg"===i&&(i="svg+xml");const r=`data:image/${i};base64,`,o=new Uint8Array(e.response),a=r+btoa(s(o));n(null,a)}else i()},r=new XMLHttpRequest;r.responseType=window.FileReader?"blob":"arraybuffer",r.open("GET",t,!0),r.addEventListener("error",i),r.addEventListener("load",()=>s(r)),r.send()}function i(t){let e=t.replace(/\s/g,"");e=decodeURIComponent(e);const n=e.indexOf(","),i=e.slice(0,n),s=i.split(":")[1].split(";")[0],r=e.slice(n+1);let o;o=i.indexOf("base64")>=0?atob(r):unescape(encodeURIComponent(r));const a=new Uint8Array(o.length);for(let l=0;l<o.length;l+=1)a[l]=o.charCodeAt(l);return new Blob([a],{type:s})}function s(t,e){const n=window.navigator.msSaveBlob;if(n)n(t,e);else{const n=window.URL.createObjectURL(t),i=document.createElement("a");i.href=n,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(n)}}function r(t,e){const n=i(t);s(n,e)}function o(t){const e=t.match(/<svg[^>]*viewBox\s*=\s*(["']?)(.+?)\1[^>]*>/i);return e&&e[2]?e[2].replace(/\s+/," ").split(" "):null}function a(t){const e=parseFloat(t);return Number.isNaN(e)?null:e}function l(t,e={}){let n=null;const i=e=>(null==n&&(n=o(t)),null!=n?a(n[e]):null),s=e=>{const n=t.match(e);return n&&n[2]?a(n[2]):null};let r=e.width;if(null==r&&(r=s(/<svg[^>]*width\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==r&&(r=i(2)),null==r)throw new Error("Can not parse width from svg string");let l=e.height;if(null==l&&(l=s(/<svg[^>]*height\s*=\s*(["']?)(.+?)\1[^>]*>/i)),null==l&&(l=i(3)),null==l)throw new Error("Can not parse height from svg string");const c=encodeURIComponent(t).replace(/'/g,"%27").replace(/"/g,"%22"),h="data:image/svg+xml",u=`${h},${c}`;return u}t.isDataUrl=e,t.imageToDataUri=n,t.dataUriToBlob=i,t.downloadBlob=s,t.downloadDataUri=r,t.svgToDataUrl=l})(jm||(jm={}));const Dm={px(t){return t},mm(t){return Lm*t},cm(t){return Lm*t*10},in(t){return Lm*t*25.4},pt(t){return Lm*(25.4*t/72)},pc(t){return Lm*(25.4*t/6)}};var Bm;(function(t){function e(t,e,n){const i=document.createElement("div"),s=i.style;s.display="inline-block",s.position="absolute",s.left="-15000px",s.top="-15000px",s.width=t+(n||"px"),s.height=e+(n||"px"),document.body.appendChild(i);const r=i.getBoundingClientRect(),o={width:r.width||0,height:r.height||0};return document.body.removeChild(i),o}function n(t,n){null==Lm&&(Lm=e("1","1","mm").width);const i=n?Dm[n]:null;return i?i(t):t}t.measure=e,t.toPx=n})(Bm||(Bm={}));const Im=/-(.)/g;function Rm(t){return t.replace(Im,(t,e)=>e.toUpperCase())}const Vm={},zm=["webkit","ms","moz","o"],$m="undefined"!==typeof document?document.createElement("div").style:{};function Fm(t){for(let e=0;e<zm.length;e+=1){const n=zm[e]+t;if(n in $m)return n}return null}function Gm(t){const e=Rm(t);if(null==Vm[e]){const t=e.charAt(0).toUpperCase()+e.slice(1);Vm[e]=e in $m?e:Fm(t)}return Vm[e]}function _m(t,e,n){const i=Gm(e);null!=i&&(t[i]=n),t[e]=n}function Hm(t,e){const n=t.ownerDocument&&t.ownerDocument.defaultView&&t.ownerDocument.defaultView.opener?t.ownerDocument.defaultView.getComputedStyle(t,null):window.getComputedStyle(t,null);return n&&e?n.getPropertyValue(e)||n[e]:n}function Um(t){const e=Hm(t);return null!=e&&("scroll"===e.overflow||"auto"===e.overflow)}const Jm=function(){if("undefined"==typeof document)return function(){};const t=document;return t.selection?function(){t.selection.empty()}:window.getSelection?function(){const t=window.getSelection();t&&(t.empty?t.empty():t.removeAllRanges&&t.removeAllRanges())}:function(){}}(),qm={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function Wm(t){return/^--/.test(t)}function Xm(t,e,n){const i=window.getComputedStyle(t,null);return n?i.getPropertyValue(e)||void 0:i[e]||t.style[e]}function Ym(t,e){return parseInt(Xm(t,e),10)||0}function Zm(t,e){return qm[t]||"number"!==typeof e?e:`${e}px`}function Km(t,e,n){if("string"===typeof e){const i=Wm(e);if(i||(e=Gm(e)),void 0===n)return Xm(t,e,i);i||(n=Zm(e,n));const s=t.style;return void(i?s.setProperty(e,n):s[e]=n)}for(const i in e)Km(t,i,e[i])}const Qm=new WeakMap;function ty(t,e){const n=Zp(e),i=Qm.get(t);if(i)return i[n]}function ey(t,e,n){const i=Zp(e),s=Qm.get(t);s?s[i]=n:Qm.set(t,{[i]:n})}function ny(t,e,n){if(!e){const e={};return Object.keys(Qm).forEach(n=>{e[n]=ty(t,n)}),e}if("string"===typeof e)return void 0===n?ty(t,e):void ey(t,e,n);for(const i in e)ny(t,i,e[i])}const iy={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};function sy(t,e,n){if(e){if("string"===typeof e)return e=iy[e]||e,arguments.length<3?t[e]:void(t[e]=n);for(const n in e)sy(t,n,e[n])}}class ry{get[Symbol.toStringTag](){return ry.toStringTag}get type(){return this.node.nodeName}get id(){return this.node.id}set id(t){this.node.id=t}constructor(t,e,n){if(!t)throw new TypeError("Invalid element to create vector");let i;if(ry.isVector(t))i=t.node;else if("string"===typeof t)if("svg"===t.toLowerCase())i=nm();else if("<"===t[0]){const e=nm(t);i=document.importNode(e.firstChild,!0)}else i=document.createElementNS(Zf.svg,t);else i=t;this.node=i,e&&this.setAttributes(e),n&&this.append(n)}transform(t,e){return null==t?Hy(this.node):(Hy(this.node,t,e),this)}translate(t,e=0,n={}){return null==t?Uy(this.node):(Uy(this.node,t,e,n),this)}rotate(t,e,n,i={}){return null==t?Jy(this.node):(Jy(this.node,t,e,n,i),this)}scale(t,e){return null==t?qy(this.node):(qy(this.node,t,e),this)}getTransformToElement(t){const e=ry.toNode(t);return Wy(this.node,e)}removeAttribute(t){return Cm(this.node,t),this}getAttribute(t){return wm(this.node,t)}setAttribute(t,e){return Pm(this.node,t,e),this}setAttributes(t){return Em(this.node,t),this}attr(t,e){return null==t?Mm(this.node):"string"===typeof t&&void 0===e?Mm(this.node,t):("object"===typeof t?Mm(this.node,t):Mm(this.node,t,e),this)}svg(){return this.node instanceof SVGSVGElement?this:ry.create(this.node.ownerSVGElement)}defs(){const t=this.svg()||this,e=t.node.getElementsByTagName("defs")[0];return e?ry.create(e):ry.create("defs").appendTo(t)}text(t,e={}){return uy(this.node,t,e),this}tagName(){return sm(this.node)}clone(){return ry.create(this.node.cloneNode(!0))}remove(){return hm(this.node),this}empty(){return um(this.node),this}append(t){return dm(this.node,ry.toNodes(t)),this}appendTo(t){return mm(this.node,ry.isVector(t)?t.node:t),this}prepend(t){return gm(this.node,ry.toNodes(t)),this}before(t){return pm(this.node,ry.toNodes(t)),this}replace(t){return this.node.parentNode&&this.node.parentNode.replaceChild(ry.toNode(t),this.node),ry.create(t)}first(){return this.node.firstChild?ry.create(this.node.firstChild):null}last(){return this.node.lastChild?ry.create(this.node.lastChild):null}get(t){const e=this.node.childNodes[t];return e?ry.create(e):null}indexOf(t){const e=Array.prototype.slice.call(this.node.childNodes);return e.indexOf(ry.toNode(t))}find(t){const e=[],n=om(this.node,t);if(n)for(let i=0,s=n.length;i<s;i+=1)e.push(ry.create(n[i]));return e}findOne(t){const e=am(this.node,t);return e?ry.create(e):null}findParentByClass(t,e){const n=lm(this.node,t,e);return n?ry.create(n):null}matches(t){const e=this.node,n=(this.node.matches,e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector||null);return n&&n.call(e,t)}contains(t){return cm(this.node,ry.isVector(t)?t.node:t)}wrap(t){const e=ry.create(t),n=this.node.parentNode;return null!=n&&n.insertBefore(e.node,this.node),e.append(this)}parent(t){let e=this;if(null==e.node.parentNode)return null;if(e=ry.create(e.node.parentNode),null==t)return e;do{if("string"===typeof t?e.matches(t):e instanceof t)return e}while(e=ry.create(e.node.parentNode));return e}children(){const t=this.node.childNodes,e=[];for(let n=0;n<t.length;n+=1){const i=t[n];1===i.nodeType&&e.push(ry.create(t[n]))}return e}eachChild(t,e){const n=this.children();for(let i=0,s=n.length;i<s;i+=1)t.call(n[i],n[i],i,n),e&&n[i].eachChild(t,e);return this}index(){return rm(this.node)}hasClass(t){return _f(this.node,t)}addClass(t){return Hf(this.node,t),this}removeClass(t){return Uf(this.node,t),this}toggleClass(t,e){return Jf(this.node,t,e),this}toLocalPoint(t,e){return Yy(this.node,t,e)}sample(t=1){return this.node instanceof SVGPathElement?yy(this.node,t):[]}toPath(){return ry.create(Ay(this.node))}toPathData(){return Sy(this.node)}}function oy(t,e){const n=ry.create(e),i=ry.create("textPath"),s=t.d;if(s&&void 0===t["xlink:href"]){const t=ry.create("path").attr("d",s).appendTo(n.defs());i.attr("xlink:href",`#${t.id}`)}return"object"===typeof t&&i.attr(t),i.node}function ay(t,e,n){const i=n.eol,s=n.baseSize,r=n.lineHeight;let o,a=0;const l={},c=e.length-1;for(let h=0;h<=c;h+=1){let r=e[h],l=null;if("object"===typeof r){const t=r.attrs,e=ry.create("tspan",t);o=e.node;let u=r.t;i&&h===c&&(u+=i),o.textContent=u;const d=t.class;d&&e.addClass(d),n.includeAnnotationIndices&&e.attr("annotations",r.annotations.join(",")),l=parseFloat(t["font-size"]),void 0===l&&(l=s),l&&l>a&&(a=l)}else i&&h===c&&(r+=i),o=document.createTextNode(r||" "),s&&s>a&&(a=s);t.appendChild(o)}return a&&(l.maxFontSize=a),r?l.lineHeight=r:a&&(l.lineHeight=1.2*a),l}(function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&i.node instanceof SVGElement&&"function"===typeof i.sample&&"function"===typeof i.toPath}function n(e,n,i){return new t(e,n,i)}function i(t){if("<"===t[0]){const e=nm(t),i=[];for(let t=0,s=e.childNodes.length;t<s;t+=1){const s=e.childNodes[t];i.push(n(document.importNode(s,!0)))}return i}return[n(t)]}function s(t){return e(t)?t.node:t}function r(t){return Array.isArray(t)?t.map(t=>s(t)):[s(t)]}t.toStringTag=`X6.${t.name}`,t.isVector=e,t.create=n,t.createVectors=i,t.toNode=s,t.toNodes=r})(ry||(ry={}));const ly=/em$/;function cy(t,e){const n=parseFloat(t);return ly.test(t)?n*e:n}function hy(t,e,n,i){if(!Array.isArray(e))return 0;const s=e.length;if(!s)return 0;let r=e[0];const o=cy(r.maxFontSize,n)||n;let a=0;const l=cy(i,n);for(let u=1;u<s;u+=1){r=e[u];const t=cy(r.lineHeight,n)||l;a+=t}const c=cy(r.maxFontSize,n)||n;let h;switch(t){case"middle":h=o/2-.15*c-a/2;break;case"bottom":h=-.25*c-a;break;case"top":default:h=.8*o;break}return h}function uy(t,e,n={}){e=km(e);const i=n.eol;let s=n.textPath;const r=n.textVerticalAnchor,o="middle"===r||"bottom"===r||"top"===r;let a=n.x;void 0===a&&(a=t.getAttribute("x")||0);const l=n.includeAnnotationIndices;let c=n.annotations;c&&!Array.isArray(c)&&(c=[c]);const h=n.lineHeight,u="auto"===h,d=u?"1.5em":h||"1em";let g=!0;const p=t.childNodes;if(1===p.length){const t=p[0];t&&"TITLE"===t.tagName.toUpperCase()&&(g=!1)}g&&um(t),Mm(t,{"xml:space":"preserve",display:e||n.displayEmpty?null:"none"});const f=Mm(t,"font-size");let m,y,b=parseFloat(f);b||(b=16,!o&&!c||f||Mm(t,"font-size",`${b}`)),s?("string"===typeof s&&(s={d:s}),m=oy(s,t)):m=document.createDocumentFragment();let v,x=0;const w=e.split("\n"),C=[],P=w.length-1;for(let M=0;M<=P;M+=1){y=d;let t="v-line";const e=em("tspan");let n,r=w[M];if(r)if(c){const t=Tm(r,c,{offset:-x,includeAnnotationIndices:l});n=ay(e,t,{eol:M!==P&&i,baseSize:b,lineHeight:u?null:d,includeAnnotationIndices:l});const s=n.lineHeight;s&&u&&0!==M&&(y=s),0===M&&(v=.8*n.maxFontSize)}else i&&M!==P&&(r+=i),e.textContent=r;else{e.textContent="-",t+=" v-empty-line";const i=e.style;i.fillOpacity=0,i.strokeOpacity=0,c&&(n={})}n&&C.push(n),M>0&&e.setAttribute("dy",y),(M>0||s)&&e.setAttribute("x",a),e.className.baseVal=t,m.appendChild(e),x+=r.length+1}if(o)if(c)y=hy(r,C,b,d);else if("top"===r)y="0.8em";else{let t;switch(P>0?(t=parseFloat(d)||1,t*=P,ly.test(d)||(t/=b)):t=0,r){case"middle":y=.3-t/2+"em";break;case"bottom":y=-t-.3+"em";break;default:break}}else 0===r?y="0em":r?y=r:(y=0,null==t.getAttribute("y")&&t.setAttribute("y",`${v||"0.8em"}`));const E=m.firstChild;E.setAttribute("dy",y),t.appendChild(m)}function dy(t,e={}){const n=document.createElement("canvas").getContext("2d");if(!t)return{width:0};const i=[],s=e["font-size"]?`${parseFloat(e["font-size"])}px`:"14px";return i.push(e["font-style"]||"normal"),i.push(e["font-variant"]||"normal"),i.push(e["font-weight"]||400),i.push(s),i.push(e["font-family"]||"sans-serif"),n.font=i.join(" "),n.measureText(t)}function gy(t,e,n,i={}){if(e>=n)return[t,""];const s=t.length,r={};let o=Math.round(e/n*s-1);o<0&&(o=0);while(o>=0&&o<s){const n=t.slice(0,o),s=r[n]||dy(n,i).width,a=t.slice(0,o+1),l=r[a]||dy(a,i).width;if(r[n]=s,r[a]=l,s>e)o-=1;else{if(!(l<=e))break;o+=1}}return[t.slice(0,o),t.slice(o)]}function py(t,e,n={},i={}){const s=e.width,r=e.height,o=i.eol||"\n",a=n.fontSize||14,l=n.lineHeight?parseFloat(n.lineHeight):Math.ceil(1.4*a),c=Math.floor(r/l);if(t.indexOf(o)>-1){const s=cf(),r=[];return t.split(o).map(t=>{const o=py(t,Object.assign(Object.assign({},e),{height:Number.MAX_SAFE_INTEGER}),n,Object.assign(Object.assign({},i),{eol:s}));o&&r.push(...o.split(s))}),r.slice(0,c).join(o)}const{width:h}=dy(t,n);if(h<s)return t;const u=[];let d=t,g=h,p=i.ellipsis,f=0;p&&("string"!==typeof p&&(p="…"),f=dy(p,n).width);for(let m=0;m<c;m+=1){if(!(g>s)){u.push(d);break}{const t=m===c-1;if(t){const[t]=gy(d,s-f,g,n);u.push(p?`${t}${p}`:t)}else{const[t,e]=gy(d,s,g,n);u.push(t),d=e,g=dy(d,n).width}}}return u.join(o)}const fy=.551784;function my(t,e,n=NaN){const i=t.getAttribute(e);if(null==i)return n;const s=parseFloat(i);return Number.isNaN(s)?n:s}function yy(t,e=1){const n=t.getTotalLength(),i=[];let s,r=0;while(r<n)s=t.getPointAtLength(r),i.push({distance:r,x:s.x,y:s.y}),r+=e;return i}function by(t){return["M",my(t,"x1"),my(t,"y1"),"L",my(t,"x2"),my(t,"y2")].join(" ")}function vy(t){const e=Cy(t);return 0===e.length?null:`${wy(e)} Z`}function xy(t){const e=Cy(t);return 0===e.length?null:wy(e)}function wy(t){const e=t.map(t=>`${t.x} ${t.y}`);return`M ${e.join(" L")}`}function Cy(t){const e=[],n=t.points;if(n)for(let i=0,s=n.numberOfItems;i<s;i+=1)e.push(n.getItem(i));return e}function Py(t){const e=my(t,"cx",0),n=my(t,"cy",0),i=my(t,"r"),s=i*fy;return["M",e,n-i,"C",e+s,n-i,e+i,n-s,e+i,n,"C",e+i,n+s,e+s,n+i,e,n+i,"C",e-s,n+i,e-i,n+s,e-i,n,"C",e-i,n-s,e-s,n-i,e,n-i,"Z"].join(" ")}function Ey(t){const e=my(t,"cx",0),n=my(t,"cy",0),i=my(t,"rx"),s=my(t,"ry")||i,r=i*fy,o=s*fy,a=["M",e,n-s,"C",e+r,n-s,e+i,n-o,e+i,n,"C",e+i,n+o,e+r,n+s,e,n+s,"C",e-r,n+s,e-i,n+o,e-i,n,"C",e-i,n-o,e-r,n-s,e,n-s,"Z"].join(" ");return a}function My(t){return Oy({x:my(t,"x",0),y:my(t,"y",0),width:my(t,"width",0),height:my(t,"height",0),rx:my(t,"rx",0),ry:my(t,"ry",0)})}function Oy(t){let e;const n=t.x,i=t.y,s=t.width,r=t.height,o=Math.min(t.rx||t["top-rx"]||0,s/2),a=Math.min(t.rx||t["bottom-rx"]||0,s/2),l=Math.min(t.ry||t["top-ry"]||0,r/2),c=Math.min(t.ry||t["bottom-ry"]||0,r/2);return e=o||a||l||c?["M",n,i+l,"v",r-l-c,"a",a,c,0,0,0,a,c,"h",s-2*a,"a",a,c,0,0,0,a,-c,"v",-(r-c-l),"a",o,l,0,0,0,-o,-l,"h",-(s-2*o),"a",o,l,0,0,0,-o,l,"Z"]:["M",n,i,"H",n+s,"V",i+r,"H",n,"V",i,"Z"],e.join(" ")}function Ay(t){const e=em("path");Mm(e,Mm(t));const n=Sy(t);return n&&e.setAttribute("d",n),e}function Sy(t){const e=t.tagName.toLowerCase();switch(e){case"path":return t.getAttribute("d");case"line":return by(t);case"polygon":return vy(t);case"polyline":return xy(t);case"ellipse":return Ey(t);case"circle":return Py(t);case"rect":return My(t);default:break}throw new Error(`"${e}" cannot be converted to svg path element.`)}function Ny(t,e,n,i){const s=2*Math.PI-1e-6,r=t,o=e;let a=n,l=i;if(l<a){const t=a;a=l,l=t}const c=l-a,h=c<Math.PI?"0":"1",u=Math.cos(a),d=Math.sin(a),g=Math.cos(l),p=Math.sin(l);return c>=s?r?`M0,${o}A${o},${o} 0 1,1 0,${-o}A${o},${o} 0 1,1 0,${o}M0,${r}A${r},${r} 0 1,0 0,${-r}A${r},${r} 0 1,0 0,${r}Z`:`M0,${o}A${o},${o} 0 1,1 0,${-o}A${o},${o} 0 1,1 0,${o}Z`:r?`M${o*u},${o*d}A${o},${o} 0 ${h},1 ${o*g},${o*p}L${r*g},${r*p}A${r},${r} 0 ${h},0 ${r*u},${r*d}Z`:`M${o*u},${o*d}A${o},${o} 0 ${h},1 ${o*g},${o*p}L0,0Z`}const Ty=/(\w+)\(([^,)]+),?([^)]+)?\)/gi,ky=/[ ,]+/,jy=/^(\w+)\((.*)\)/;function Ly(t,e){const n=em("svg"),i=n.createSVGPoint();return i.x=t,i.y=e,i}function Dy(t){const e=em("svg"),n=e.createSVGMatrix();if(null!=t){const e=t,i=n;for(const t in e)i[t]=e[t]}return n}function By(t){const e=em("svg");return null!=t?(t instanceof DOMMatrix||(t=Dy(t)),e.createSVGTransformFromMatrix(t)):e.createSVGTransform()}function Iy(t){let e=Dy();const n=null!=t&&t.match(Ty);if(!n)return e;for(let i=0,s=n.length;i<s;i+=1){const t=n[i],s=t.match(jy);if(s){let t,n,i,r,o,a=Dy();const l=s[2].split(ky);switch(s[1].toLowerCase()){case"scale":t=parseFloat(l[0]),n=void 0===l[1]?t:parseFloat(l[1]),a=a.scaleNonUniform(t,n);break;case"translate":i=parseFloat(l[0]),r=parseFloat(l[1]),a=a.translate(i,r);break;case"rotate":o=parseFloat(l[0]),i=parseFloat(l[1])||0,r=parseFloat(l[2])||0,a=0!==i||0!==r?a.translate(i,r).rotate(o).translate(-i,-r):a.rotate(o);break;case"skewx":o=parseFloat(l[0]),a=a.skewX(o);break;case"skewy":o=parseFloat(l[0]),a=a.skewY(o);break;case"matrix":a.a=parseFloat(l[0]),a.b=parseFloat(l[1]),a.c=parseFloat(l[2]),a.d=parseFloat(l[3]),a.e=parseFloat(l[4]),a.f=parseFloat(l[5]);break;default:continue}e=e.multiply(a)}}return e}function Ry(t){const e=t||{},n=null!=e.a?e.a:1,i=null!=e.b?e.b:0,s=null!=e.c?e.c:0,r=null!=e.d?e.d:1,o=null!=e.e?e.e:0,a=null!=e.f?e.f:0;return`matrix(${n},${i},${s},${r},${o},${a})`}function Vy(t){let e,n,i;if(t){const s=ky;if(t.trim().indexOf("matrix")>=0){const s=Iy(t),r=$y(s);e=[r.translateX,r.translateY],n=[r.rotation],i=[r.scaleX,r.scaleY];const o=[];0===e[0]&&0===e[1]||o.push(`translate(${e.join(",")})`),1===i[0]&&1===i[1]||o.push(`scale(${i.join(",")})`),0!==n[0]&&o.push(`rotate(${n[0]})`),t=o.join(" ")}else{const r=t.match(/translate\((.*?)\)/);r&&(e=r[1].split(s));const o=t.match(/rotate\((.*?)\)/);o&&(n=o[1].split(s));const a=t.match(/scale\((.*?)\)/);a&&(i=a[1].split(s))}}const s=i&&i[0]?parseFloat(i[0]):1;return{raw:t||"",translation:{tx:e&&e[0]?parseInt(e[0],10):0,ty:e&&e[1]?parseInt(e[1],10):0},rotation:{angle:n&&n[0]?parseInt(n[0],10):0,cx:n&&n[1]?parseInt(n[1],10):void 0,cy:n&&n[2]?parseInt(n[2],10):void 0},scale:{sx:s,sy:i&&i[1]?parseFloat(i[1]):s}}}function zy(t,e){const n=e.x*t.a+e.y*t.c+0,i=e.x*t.b+e.y*t.d+0;return{x:n,y:i}}function $y(t){const e=zy(t,{x:0,y:1}),n=zy(t,{x:1,y:0}),i=180/Math.PI*Math.atan2(e.y,e.x)-90,s=180/Math.PI*Math.atan2(n.y,n.x);return{skewX:i,skewY:s,translateX:t.e,translateY:t.f,scaleX:Math.sqrt(t.a*t.a+t.b*t.b),scaleY:Math.sqrt(t.c*t.c+t.d*t.d),rotation:i}}function Fy(t){let e,n,i,s;return t?(e=null==t.a?1:t.a,s=null==t.d?1:t.d,n=t.b,i=t.c):e=s=1,{sx:n?Math.sqrt(e*e+n*n):e,sy:i?Math.sqrt(i*i+s*s):s}}function Gy(t){let e={x:0,y:1};t&&(e=zy(t,e));const n=180*Math.atan2(e.y,e.x)/Math.PI%360-90,i=n%360+(n<0?360:0);return{angle:i}}function _y(t){return{tx:t&&t.e||0,ty:t&&t.f||0}}function Hy(t,e,n={}){if(null==e)return Iy(Mm(t,"transform"));if(n.absolute)return void t.setAttribute("transform",Ry(e));const i=t.transform,s=By(e);i.baseVal.appendItem(s)}function Uy(t,e,n=0,i={}){let s=Mm(t,"transform");const r=Vy(s);if(null==e)return r.translation;s=r.raw,s=s.replace(/translate\([^)]*\)/g,"").trim();const o=i.absolute?e:r.translation.tx+e,a=i.absolute?n:r.translation.ty+n,l=`translate(${o},${a})`;t.setAttribute("transform",`${l} ${s}`.trim())}function Jy(t,e,n,i,s={}){let r=Mm(t,"transform");const o=Vy(r);if(null==e)return o.rotation;r=o.raw,r=r.replace(/rotate\([^)]*\)/g,"").trim(),e%=360;const a=s.absolute?e:o.rotation.angle+e,l=null!=n&&null!=i?`,${n},${i}`:"",c=`rotate(${a}${l})`;t.setAttribute("transform",`${r} ${c}`.trim())}function qy(t,e,n){let i=Mm(t,"transform");const s=Vy(i);if(null==e)return s.scale;n=null==n?e:n,i=s.raw,i=i.replace(/scale\([^)]*\)/g,"").trim();const r=`scale(${e},${n})`;t.setAttribute("transform",`${i} ${r}`.trim())}function Wy(t,e){if(Yf(e)&&Yf(t)){const n=e.getScreenCTM(),i=t.getScreenCTM();if(n&&i)return n.inverse().multiply(i)}return Dy()}function Xy(t,e){let n=Dy();if(Yf(e)&&Yf(t)){let i=t;const s=[];while(i&&i!==e){const t=i.getAttribute("transform")||null,e=Iy(t);s.push(e),i=i.parentNode}s.reverse().forEach(t=>{n=n.multiply(t)})}return n}function Yy(t,e,n){const i=t instanceof SVGSVGElement?t:t.ownerSVGElement,s=i.createSVGPoint();s.x=e,s.y=n;try{const e=i.getScreenCTM(),n=s.matrixTransform(e.inverse()),r=Wy(t,i).inverse();return n.matrixTransform(r)}catch(r){return s}}var Zy,Ky,Qy,tb;(function(t){const e={};function n(t){return e[t]||{}}function i(t,n){e[t]=n}function s(t){delete e[t]}t.get=n,t.register=i,t.unregister=s})(Zy||(Zy={})),function(t){const e=new WeakMap;function n(t){return e.has(t)||e.set(t,{events:Object.create(null)}),e.get(t)}function i(t){return e.get(t)}function s(t){return e.delete(t)}t.ensure=n,t.get=i,t.remove=s}(Ky||(Ky={})),function(t){function e(t){t.stopPropagation()}function n(t,e,n){null!=t.addEventListener&&t.addEventListener(e,n)}function i(t,e,n){null!=t.removeEventListener&&t.removeEventListener(e,n)}t.returnTrue=()=>!0,t.returnFalse=()=>!1,t.stopPropagationCallback=e,t.addEventListener=n,t.removeEventListener=i}(Qy||(Qy={})),function(t){const e=/[^\x20\t\r\n\f]+/g,n=/^([^.]*)(?:\.(.+)|)/;function i(t){return(t||"").match(e)||[""]}function s(t){const e=n.exec(t)||[];return{originType:e[1]?e[1].trim():e[1],namespaces:e[2]?e[2].split(".").map(t=>t.trim()).sort():[]}}function r(t){return 1===t.nodeType||9===t.nodeType||!+t.nodeType}function o(t,e){if(e){const n=t;return null!=n.querySelector&&null!=n.querySelector(e)}return!0}t.splitType=i,t.normalizeType=s,t.isValidTarget=r,t.isValidSelector=o}(Qy||(Qy={})),function(t){let e=0;const n=new WeakMap;function i(t){return n.has(t)||(n.set(t,e),e+=1),n.get(t)}function s(t){return n.get(t)}function r(t){return n.delete(t)}function o(t,e){return n.set(t,e)}t.ensureHandlerId=i,t.getHandlerId=s,t.removeHandlerId=r,t.setHandlerId=o}(Qy||(Qy={})),function(t){function e(t,e){const n=[],i=Ky.get(t),s=i&&i.events&&i.events[e.type],r=s&&s.handlers||[],o=s?s.delegateCount:0;if(o>0&&!("click"===e.type&&"number"===typeof e.button&&e.button>=1))for(let a=e.target;a!==t;a=a.parentNode||t)if(1===a.nodeType&&("click"!==e.type||!0!==a.disabled)){const e=[],i={};for(let n=0;n<o;n+=1){const s=r[n],o=s.selector;if(null!=o&&null==i[o]){const e=t,n=[];e.querySelectorAll(o).forEach(t=>{n.push(t)}),i[o]=n.includes(a)}i[o]&&e.push(s)}e.length&&n.push({elem:a,handlers:e})}return o<r.length&&n.push({elem:t,handlers:r.slice(o)}),n}t.getHandlerQueue=e}(Qy||(Qy={})),function(t){function e(t){return null!=t&&t===t.window}t.isWindow=e}(Qy||(Qy={})),function(t){function e(t,e){const n=9===t.nodeType?t.documentElement:t,i=e&&e.parentNode;return t===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):t.compareDocumentPosition&&16&t.compareDocumentPosition(i)))}t.contains=e}(Qy||(Qy={}));class eb{constructor(t,e){this.isDefaultPrevented=Qy.returnFalse,this.isPropagationStopped=Qy.returnFalse,this.isImmediatePropagationStopped=Qy.returnFalse,this.isSimulated=!1,this.preventDefault=()=>{const t=this.originalEvent;this.isDefaultPrevented=Qy.returnTrue,t&&!this.isSimulated&&t.preventDefault()},this.stopPropagation=()=>{const t=this.originalEvent;this.isPropagationStopped=Qy.returnTrue,t&&!this.isSimulated&&t.stopPropagation()},this.stopImmediatePropagation=()=>{const t=this.originalEvent;this.isImmediatePropagationStopped=Qy.returnTrue,t&&!this.isSimulated&&t.stopImmediatePropagation(),this.stopPropagation()},"string"===typeof t?this.type=t:t.type&&(this.originalEvent=t,this.type=t.type,this.isDefaultPrevented=t.defaultPrevented?Qy.returnTrue:Qy.returnFalse,this.target=t.target,this.currentTarget=t.currentTarget,this.relatedTarget=t.relatedTarget,this.timeStamp=t.timeStamp),e&&Object.assign(this,e),this.timeStamp||(this.timeStamp=Date.now())}}(function(t){function e(e){return e instanceof t?e:new t(e)}t.create=e})(eb||(eb={})),function(t){function e(e,n){Object.defineProperty(t.prototype,e,{enumerable:!0,configurable:!0,get:"function"===typeof n?function(){if(this.originalEvent)return n(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})}t.addProperty=e}(eb||(eb={})),function(t){const e={bubbles:!0,cancelable:!0,eventPhase:!0,detail:!0,view:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pageX:!0,pageY:!0,screenX:!0,screenY:!0,toElement:!0,pointerId:!0,pointerType:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,touches:!0,changedTouches:!0,targetTouches:!0,which:!0,altKey:!0,ctrlKey:!0,metaKey:!0,shiftKey:!0};Object.keys(e).forEach(n=>t.addProperty(n,e[n]))}(eb||(eb={})),function(){Zy.register("load",{noBubble:!0})}(tb||(tb={})),function(){Zy.register("beforeunload",{postDispatch(t,e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}})}(tb||(tb={})),function(){Zy.register("mouseenter",{delegateType:"mouseover",bindType:"mouseover",handle(t,e){let n;const i=e.relatedTarget,s=e.handleObj;return i&&(i===t||Qy.contains(t,i))||(e.type=s.originType,n=s.handler.call(t,e),e.type="mouseover"),n}}),Zy.register("mouseleave",{delegateType:"mouseout",bindType:"mouseout",handle(t,e){let n;const i=e.relatedTarget,s=e.handleObj;return i&&(i===t||Qy.contains(t,i))||(e.type=s.originType,n=s.handler.call(t,e),e.type="mouseout"),n}})}(tb||(tb={}));var nb,ib,sb,rb=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};(function(t){let e;function n(t,n,i,r,o){if(!Qy.isValidTarget(t))return;let a;if("function"!==typeof i){const{handler:t,selector:e}=i,n=rb(i,["handler","selector"]);i=t,o=e,a=n}const l=Ky.ensure(t);let c=l.handler;null==c&&(c=l.handler=function(n,...i){return e!==n.type?s(t,n,...i):void 0});const h=Qy.ensureHandlerId(i);Qy.splitType(n).forEach(e=>{const{originType:n,namespaces:s}=Qy.normalizeType(e);if(!n)return;let u=n,d=Zy.get(u);u=(o?d.delegateType:d.bindType)||u,d=Zy.get(u);const g=Object.assign({type:u,originType:n,data:r,selector:o,guid:h,handler:i,namespace:s.join(".")},a),p=l.events;let f=p[u];f||(f=p[u]={handlers:[],delegateCount:0},d.setup&&!1!==d.setup(t,r,s,c)||Qy.addEventListener(t,u,c)),d.add&&(Qy.removeHandlerId(g.handler),d.add(t,g),Qy.setHandlerId(g.handler,h)),o?(f.handlers.splice(f.delegateCount,0,g),f.delegateCount+=1):f.handlers.push(g)})}function i(t,e,n,s,r){const o=Ky.get(t);if(!o)return;const a=o.events;a&&(Qy.splitType(e).forEach(e=>{const{originType:l,namespaces:c}=Qy.normalizeType(e);if(!l)return void Object.keys(a).forEach(r=>{i(t,r+e,n,s,!0)});let h=l;const u=Zy.get(h);h=(s?u.delegateType:u.bindType)||h;const d=a[h];if(!d)return;const g=c.length>0?new RegExp(`(^|\\.)${c.join("\\.(?:.*\\.|)")}(\\.|$)`):null,p=d.handlers.length;for(let i=d.handlers.length-1;i>=0;i-=1){const e=d.handlers[i];!r&&l!==e.originType||n&&Qy.getHandlerId(n)!==e.guid||!(null==g||e.namespace&&g.test(e.namespace))||!(null==s||s===e.selector||"**"===s&&e.selector)||(d.handlers.splice(i,1),e.selector&&(d.delegateCount-=1),u.remove&&u.remove(t,e))}p&&0===d.handlers.length&&(u.teardown&&!1!==u.teardown(t,c,o.handler)||Qy.removeEventListener(t,h,o.handler),delete a[h])}),0===Object.keys(a).length&&Ky.remove(t))}function s(t,e,...n){const i=eb.create(e);i.delegateTarget=t;const s=Zy.get(i.type);if(s.preDispatch&&!1===s.preDispatch(t,i))return;const r=Qy.getHandlerQueue(t,i);for(let o=0,a=r.length;o<a&&!i.isPropagationStopped();o+=1){const t=r[o];i.currentTarget=t.elem;for(let e=0,s=t.handlers.length;e<s&&!i.isImmediatePropagationStopped();e+=1){const s=t.handlers[e];if(null==i.rnamespace||s.namespace&&i.rnamespace.test(s.namespace)){i.handleObj=s,i.data=s.data;const e=Zy.get(s.originType).handle,r=e?e(t.elem,i,...n):s.handler.call(t.elem,i,...n);void 0!==r&&(i.result=r,!1===r&&(i.preventDefault(),i.stopPropagation()))}}}return s.postDispatch&&s.postDispatch(t,i),i.result}function r(t,n,i,s){let r=t,o="string"===typeof t?t:t.type,a="string"===typeof t||null==r.namespace?[]:r.namespace.split(".");const l=i;if(3===l.nodeType||8===l.nodeType)return;o.indexOf(".")>-1&&(a=o.split("."),o=a.shift(),a.sort());const c=o.indexOf(":")<0&&`on${o}`;r=t instanceof eb?t:new eb(o,"object"===typeof t?t:null),r.namespace=a.join("."),r.rnamespace=r.namespace?new RegExp(`(^|\\.)${a.join("\\.(?:.*\\.|)")}(\\.|$)`):null,r.result=void 0,r.target||(r.target=l);const h=[r];Array.isArray(n)?h.push(...n):h.push(n);const u=Zy.get(o);if(!s&&u.trigger&&!1===u.trigger(l,r,n))return;let d;const g=[l];if(!s&&!u.noBubble&&!Qy.isWindow(l)){d=u.delegateType||o;let t=l,e=l.parentNode;while(null!=e)g.push(e),t=e,e=e.parentNode;const n=l.ownerDocument||document;if(t===n){const e=t.defaultView||t.parentWindow||window;g.push(e)}}let p=l;for(let e=0,f=g.length;e<f&&!r.isPropagationStopped();e+=1){const t=g[e];p=t,r.type=e>1?d:u.bindType||o;const n=Ky.get(t);n&&n.events[r.type]&&n.handler&&n.handler.call(t,...h);const i=c&&t[c]||null;i&&Qy.isValidTarget(t)&&(r.result=i.call(t,...h),!1===r.result&&r.preventDefault())}if(r.type=o,!s&&!r.isDefaultPrevented()){const t=u.preventDefault;if((null==t||!1===t(g.pop(),r,n))&&Qy.isValidTarget(l)&&c&&"function"===typeof l[o]&&!Qy.isWindow(l)){const t=l[c];t&&(l[c]=null),e=o,r.isPropagationStopped()&&p.addEventListener(o,Qy.stopPropagationCallback),l[o](),r.isPropagationStopped()&&p.removeEventListener(o,Qy.stopPropagationCallback),e=void 0,t&&(l[c]=t)}}return r.result}t.on=n,t.off=i,t.dispatch=s,t.trigger=r})(nb||(nb={})),function(t){function e(t,e,n,i,s){return sb.on(t,e,n,i,s),t}function n(t,e,n,i,s){return sb.on(t,e,n,i,s,!0),t}function i(t,e,n,i){return sb.off(t,e,n,i),t}function s(t,e,n,i){return nb.trigger(e,n,t,i),t}t.on=e,t.once=n,t.off=i,t.trigger=s}(ib||(ib={})),function(t){function e(n,i,s,r,o,a){if("object"===typeof i)return"string"!==typeof s&&(r=r||s,s=void 0),void Object.keys(i).forEach(t=>e(n,t,s,r,i[t],a));if(null==r&&null==o?(o=s,r=s=void 0):null==o&&("string"===typeof s?(o=r,r=void 0):(o=r,r=s,s=void 0)),!1===o)o=Qy.returnFalse;else if(!o)return;if(a){const e=o;o=function(i,...s){return t.off(n,i),e.call(this,i,...s)},Qy.setHandlerId(o,Qy.ensureHandlerId(e))}nb.on(n,i,o,r,s)}function n(t,e,i,s){const r=e;if(r&&null!=r.preventDefault&&null!=r.handleObj){const t=r.handleObj;return void n(r.delegateTarget,t.namespace?`${t.originType}.${t.namespace}`:t.originType,t.selector,t.handler)}if("object"===typeof e){const s=e;return void Object.keys(s).forEach(e=>n(t,e,i,s[e]))}!1!==i&&"function"!==typeof i||(s=i,i=void 0),!1===s&&(s=Qy.returnFalse),nb.off(t,e,s,i)}t.on=e,t.off=n}(sb||(sb={}));class ob{constructor(t,e,n){this.animationFrameId=0,this.deltaX=0,this.deltaY=0,this.eventName=Vf.isEventSupported("wheel")?"wheel":"mousewheel",this.target=t,this.onWheelCallback=e,this.onWheelGuard=n,this.onWheel=this.onWheel.bind(this),this.didWheel=this.didWheel.bind(this)}enable(){this.target.addEventListener(this.eventName,this.onWheel,{passive:!1})}disable(){this.target.removeEventListener(this.eventName,this.onWheel)}onWheel(t){if(null!=this.onWheelGuard&&!this.onWheelGuard(t))return;let e;this.deltaX+=t.deltaX,this.deltaY+=t.deltaY,t.preventDefault(),0===this.deltaX&&0===this.deltaY||(t.stopPropagation(),e=!0),!0===e&&0===this.animationFrameId&&(this.animationFrameId=requestAnimationFrame(()=>{this.didWheel(t)}))}didWheel(t){this.animationFrameId=0,this.onWheelCallback(t,this.deltaX,this.deltaY),this.deltaX=0,this.deltaY=0}}function ab(t){const e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView;return{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}}function lb(t){const e=t.getBoundingClientRect();return e.width}function cb(t){const e=t.getBoundingClientRect();return e.height}function hb(t){const e="fixed"===Xm(t,"position");let n;if(e){const e=t.getBoundingClientRect();n={left:e.left,top:e.top}}else n=ab(t);if(!e){const e=t.ownerDocument;let i=t.offsetParent||e.documentElement;while((i===e.body||i===e.documentElement)&&"static"===Xm(i,"position"))i=i.parentNode;if(i!==t&&ym(i)){const t=ab(i);n.top-=t.top+Ym(i,"borderTopWidth"),n.left-=t.left+Ym(i,"borderLeftWidth")}}return{top:n.top-Ym(t,"marginTop"),left:n.left-Ym(t,"marginLeft")}}function ub(t,e=60){let n=null;return(...i)=>{n&&clearTimeout(n),n=window.setTimeout(()=>{t.apply(this,i)},e)}}function db(t){let e=null,n=[];const i=()=>{if("static"===getComputedStyle(t).position){const e=t.style;e.position="relative"}const e=document.createElement("object");return e.onload=()=>{e.contentDocument.defaultView.addEventListener("resize",s),s()},e.style.display="block",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.height="100%",e.style.width="100%",e.style.overflow="hidden",e.style.pointerEvents="none",e.style.zIndex="-1",e.style.opacity="0",e.setAttribute("tabindex","-1"),e.type="text/html",t.appendChild(e),e.data="about:blank",e},s=ub(()=>{n.forEach(e=>e(t))}),r=t=>{e||(e=i()),-1===n.indexOf(t)&&n.push(t)},o=()=>{e&&e.parentNode&&(e.contentDocument&&e.contentDocument.defaultView.removeEventListener("resize",s),e.parentNode.removeChild(e),e=null,n=[])},a=t=>{const i=n.indexOf(t);-1!==i&&n.splice(i,1),0===n.length&&e&&o()};return{element:t,bind:r,destroy:o,unbind:a}}function gb(t){let e=null,n=[];const i=ub(()=>{n.forEach(e=>{e(t)})}),s=()=>{const e=new ResizeObserver(i);return e.observe(t),i(),e},r=t=>{e||(e=s()),-1===n.indexOf(t)&&n.push(t)},o=()=>{e&&(e.disconnect(),n=[],e=null)},a=t=>{const i=n.indexOf(t);-1!==i&&n.splice(i,1),0===n.length&&e&&o()};return{element:t,bind:r,destroy:o,unbind:a}}const pb="undefined"!==typeof ResizeObserver?gb:db;var fb,mb,yb,bb,vb;(function(t){const e=new WeakMap;function n(t){let n=e.get(t);return n||(n=pb(t),e.set(t,n),n)}function i(t){t.destroy(),e.delete(t.element)}t.bind=(t,e)=>{const i=n(t);return i.bind(e),()=>i.unbind(e)},t.clear=t=>{const e=n(t);i(e)}})(fb||(fb={}));class xb{constructor(t={}){this.comparator=t.comparator||xb.defaultComparator,this.index={},this.data=t.data||[],this.heapify()}isEmpty(){return 0===this.data.length}insert(t,e,n){const i={priority:t,value:e},s=this.data.length;return n&&(i.id=n,this.index[n]=s),this.data.push(i),this.bubbleUp(s),this}peek(){return this.data[0]?this.data[0].value:null}peekPriority(){return this.data[0]?this.data[0].priority:null}updatePriority(t,e){const n=this.index[t];if("undefined"===typeof n)throw new Error(`Node with id '${t}' was not found in the heap.`);const i=this.data,s=i[n].priority,r=this.comparator(e,s);r<0?(i[n].priority=e,this.bubbleUp(n)):r>0&&(i[n].priority=e,this.bubbleDown(n))}remove(){const t=this.data,e=t[0],n=t.pop();return e.id&&delete this.index[e.id],t.length>0&&(t[0]=n,n.id&&(this.index[n.id]=0),this.bubbleDown(0)),e?e.value:null}heapify(){for(let t=0;t<this.data.length;t+=1)this.bubbleUp(t)}bubbleUp(t){const e=this.data;let n,i,s=t;while(s>0){if(i=s-1>>>1,!(this.comparator(e[s].priority,e[i].priority)<0))break;{n=e[i],e[i]=e[s];let t=e[s].id;null!=t&&(this.index[t]=i),e[s]=n,t=e[s].id,null!=t&&(this.index[t]=s),s=i}}}bubbleDown(t){const e=this.data,n=e.length-1;let i=t;while(1){const t=1+(i<<1),s=t+1;let r=i;if(t<=n&&this.comparator(e[t].priority,e[r].priority)<0&&(r=t),s<=n&&this.comparator(e[s].priority,e[r].priority)<0&&(r=s),r===i)break;{const t=e[r];e[r]=e[i];let n=e[i].id;null!=n&&(this.index[n]=r),e[i]=t,n=e[i].id,null!=n&&(this.index[n]=i),i=r}}}}(function(t){t.defaultComparator=(t,e)=>t-e})(xb||(xb={})),function(t){function e(t,e,n=(t,e)=>1){const i={},s={},r={},o=new xb;i[e]=0,Object.keys(t).forEach(t=>{t!==e&&(i[t]=1/0),o.insert(i[t],t,t)});while(!o.isEmpty()){const e=o.remove();r[e]=!0;const a=t[e]||[];for(let t=0;t<a.length;t+=1){const l=a[t];if(!r[l]){const t=i[e]+n(e,l);t<i[l]&&(i[l]=t,s[l]=e,o.updatePriority(l,t))}}}return s}t.run=e}(mb||(mb={}));class wb{constructor(t,e,n,i){return null==t?this.set(255,255,255,1):"number"===typeof t?this.set(t,e,n,i):"string"===typeof t?wb.fromString(t)||this:Array.isArray(t)?this.set(t):void this.set(t.r,t.g,t.b,null==t.a?1:t.a)}blend(t,e,n){this.set(t.r+(e.r-t.r)*n,t.g+(e.g-t.g)*n,t.b+(e.b-t.b)*n,t.a+(e.a-t.a)*n)}lighten(t){const e=wb.lighten(this.toArray(),t);this.r=e[0],this.g=e[1],this.b=e[2],this.a=e[3]}darken(t){this.lighten(-t)}set(t,e,n,i){const s=Array.isArray(t)?t[0]:t,r=Array.isArray(t)?t[1]:e,o=Array.isArray(t)?t[2]:n,a=Array.isArray(t)?t[3]:i;return this.r=Math.round(bf(s,0,255)),this.g=Math.round(bf(r,0,255)),this.b=Math.round(bf(o,0,255)),this.a=null==a?1:bf(a,0,1),this}toHex(){const t=["r","g","b"].map(t=>{const e=this[t].toString(16);return e.length<2?`0${e}`:e});return`#${t.join("")}`}toRGBA(){return this.toArray()}toHSLA(){return wb.rgba2hsla(this.r,this.g,this.b,this.a)}toCSS(t){const e=`${this.r},${this.g},${this.b},`;return t?`rgb(${e})`:`rgba(${e},${this.a})`}toGrey(){return wb.makeGrey(Math.round((this.r+this.g+this.b)/3),this.a)}toArray(){return[this.r,this.g,this.b,this.a]}toString(){return this.toCSS()}}(function(t){function e(e){return new t(e)}function n(e){return new t([...p(e),1])}function i(e){const n=e.toLowerCase().match(/^rgba?\(([\s.,0-9]+)\)/);if(n){const e=n[1].split(/\s*,\s*/).map(t=>parseInt(t,10));return new t(e)}return null}function s(t,e,n){n<0&&++n,n>1&&--n;const i=6*n;return i<1?t+(e-t)*i:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}function r(e){const n=e.toLowerCase().match(/^hsla?\(([\s.,0-9]+)\)/);if(n){const e=n[2].split(/\s*,\s*/),i=(parseFloat(e[0])%360+360)%360/360,s=parseFloat(e[1])/100,r=parseFloat(e[2])/100,o=null==e[3]?1:parseInt(e[3],10);return new t(c(i,s,r,o))}return null}function o(e){if(e.startsWith("#"))return n(e);if(e.startsWith("rgb"))return i(e);const s=t.named[e];return s?n(s):r(e)}function a(e,n){return t.fromArray([e,e,e,n])}function l(t,e,n,i){const s=Array.isArray(t)?t[0]:t,r=Array.isArray(t)?t[1]:e,o=Array.isArray(t)?t[2]:n,a=Array.isArray(t)?t[3]:i,l=Math.max(s,r,o),c=Math.min(s,r,o),h=(l+c)/2;let u=0,d=0;if(c!==l){const t=l-c;switch(d=h>.5?t/(2-l-c):t/(l+c),l){case s:u=(r-o)/t+(r<o?6:0);break;case r:u=(o-s)/t+2;break;case o:u=(s-r)/t+4;break;default:break}u/=6}return[u,d,h,null==a?1:a]}function c(t,e,n,i){const r=Array.isArray(t)?t[0]:t,o=Array.isArray(t)?t[1]:e,a=Array.isArray(t)?t[2]:n,l=Array.isArray(t)?t[3]:i,c=a<=.5?a*(o+1):a+o-a*o,h=2*a-c;return[256*s(h,c,r+1/3),256*s(h,c,r),256*s(h,c,r-1/3),null==l?1:l]}function h(e){return new t(Math.round(256*Math.random()),Math.round(256*Math.random()),Math.round(256*Math.random()),e?void 0:parseFloat(Math.random().toFixed(2)))}function u(){const t="0123456789ABCDEF";let e="#";for(let n=0;n<6;n+=1)e+=t[Math.floor(16*Math.random())];return e}function d(t){return h(t).toString()}function g(t,e){if("string"===typeof t){const n="#"===t[0],[i,s,r]=p(t);return e?.299*i+.587*s+.114*r>186?"#000000":"#ffffff":`${n?"#":""}${f(255-i,255-s,255-r)}`}const n=t[0],i=t[1],s=t[2],r=t[3];return e?.299*n+.587*i+.114*s>186?[0,0,0,r]:[255,255,255,r]:[255-n,255-i,255-s,r]}function p(t){const e=0===t.indexOf("#")?t:`#${t}`;let n=Number(`0x${e.substr(1)}`);if(4!==e.length&&7!==e.length||Number.isNaN(n))throw new Error("Invalid hex color.");const i=4===e.length?4:8,s=(1<<i)-1,r=["b","g","r"].map(()=>{const t=n&s;return n>>=i,4===i?17*t:t});return[r[2],r[1],r[0]]}function f(t,e,n){const i=t=>t.length<2?`0${t}`:t;return`${i(t.toString(16))}${i(e.toString(16))}${i(n.toString(16))}`}function m(t,e){return b(t,e)}function y(t,e){return b(t,-e)}function b(t,e){if("string"===typeof t){const n="#"===t[0],i=parseInt(n?t.substr(1):t,16),s=bf((i>>16)+e,0,255),r=bf((i>>8&255)+e,0,255),o=bf((255&i)+e,0,255);return`${n?"#":""}${(o|r<<8|s<<16).toString(16)}`}const n=f(t[0],t[1],t[2]),i=p(b(n,e));return[i[0],i[1],i[2],t[3]]}t.fromArray=e,t.fromHex=n,t.fromRGBA=i,t.fromHSLA=r,t.fromString=o,t.makeGrey=a,t.rgba2hsla=l,t.hsla2rgba=c,t.random=h,t.randomHex=u,t.randomRGBA=d,t.invert=g,t.lighten=m,t.darken=y})(wb||(wb={})),function(t){t.named={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",burntsienna:"#ea7e5d",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}}(wb||(wb={}));class Cb{constructor(){this.clear()}clear(){this.map=new WeakMap,this.arr=[]}has(t){return this.map.has(t)}get(t){return this.map.get(t)}set(t,e){this.map.set(t,e),this.arr.push(t)}delete(t){const e=this.arr.indexOf(t);e>=0&&this.arr.splice(e,1);const n=this.map.get(t);return this.map.delete(t),n}each(t){this.arr.forEach(e=>{const n=this.map.get(e);t(n,e)})}dispose(){this.clear()}}(function(t){function e(t){const e=[],n=[];return Array.isArray(t)?e.push(...t):t.split("|").forEach(t=>{-1===t.indexOf("&")?e.push(t):n.push(...t.split("&"))}),{or:e,and:n}}function n(t,n){if(null!=t&&null!=n){const i=e(t),s=e(n),r=i.or.sort(),o=s.or.sort(),a=i.and.sort(),l=s.and.sort(),c=(t,e)=>t.length===e.length&&(0===t.length||t.every((t,n)=>t===e[n]));return c(r,o)&&c(a,l)}return null==t&&null==n}function i(t,n,i){if(null==n||Array.isArray(n)&&0===n.length)return!i||!0!==t.altKey&&!0!==t.ctrlKey&&!0!==t.metaKey&&!0!==t.shiftKey;const{or:s,and:r}=e(n),o=e=>{const n=`${e.toLowerCase()}Key`;return!0===t[n]};return s.some(t=>o(t))&&r.every(t=>o(t))}t.parse=e,t.equals=n,t.isMatch=i})(yb||(yb={})),function(t){t.linear=t=>t,t.quad=t=>t*t,t.cubic=t=>t*t*t,t.inout=t=>{if(t<=0)return 0;if(t>=1)return 1;const e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)},t.exponential=t=>Math.pow(2,10*(t-1)),t.bounce=t=>{for(let e=0,n=1;1;e+=n,n/=2)if(t>=(7-4*e)/11){const i=(11-6*e-11*t)/4;return-i*i+n*n}}}(bb||(bb={})),function(t){t.decorators={reverse(t){return e=>1-t(1-e)},reflect(t){return e=>.5*(e<.5?t(2*e):2-t(2-2*e))},clamp(t,e=0,n=1){return i=>{const s=t(i);return s<e?e:s>n?n:s}},back(t=1.70158){return e=>e*e*((t+1)*e-t)},elastic(t=1.5){return e=>Math.pow(2,10*(e-1))*Math.cos(20*Math.PI*t/3*e)}}}(bb||(bb={})),function(t){function e(t){return-1*Math.cos(t*(Math.PI/2))+1}function n(t){return Math.sin(t*(Math.PI/2))}function i(t){return-.5*(Math.cos(Math.PI*t)-1)}function s(t){return t*t}function r(t){return t*(2-t)}function o(t){return t<.5?2*t*t:(4-2*t)*t-1}function a(t){return t*t*t}function l(t){const e=t-1;return e*e*e+1}function c(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1}function h(t){return t*t*t*t}function u(t){const e=t-1;return 1-e*e*e*e}function d(t){const e=t-1;return t<.5?8*t*t*t*t:1-8*e*e*e*e}function g(t){return t*t*t*t*t}function p(t){const e=t-1;return 1+e*e*e*e*e}function f(t){const e=t-1;return t<.5?16*t*t*t*t*t:1+16*e*e*e*e*e}function m(t){return 0===t?0:Math.pow(2,10*(t-1))}function y(t){return 1===t?1:1-Math.pow(2,-10*t)}function b(t){if(0===t||1===t)return t;const e=2*t,n=e-1;return e<1?.5*Math.pow(2,10*n):.5*(2-Math.pow(2,-10*n))}function v(t){const e=t/1;return-1*(Math.sqrt(1-e*t)-1)}function x(t){const e=t-1;return Math.sqrt(1-e*e)}function w(t){const e=2*t,n=e-2;return e<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-n*n)+1)}function C(t,e=1.70158){return t*t*((e+1)*t-e)}function P(t,e=1.70158){const n=t/1-1;return n*n*((e+1)*n+e)+1}function E(t,e=1.70158){const n=2*t,i=n-2,s=1.525*e;return n<1?.5*n*n*((s+1)*n-s):.5*(i*i*((s+1)*i+s)+2)}function M(t,e=.7){if(0===t||1===t)return t;const n=t/1,i=n-1,s=1-e,r=s/(2*Math.PI)*Math.asin(1);return-Math.pow(2,10*i)*Math.sin((i-r)*(2*Math.PI)/s)}function O(t,e=.7){const n=1-e,i=2*t;if(0===t||1===t)return t;const s=n/(2*Math.PI)*Math.asin(1);return Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/n)+1}function A(t,e=.65){const n=1-e;if(0===t||1===t)return t;const i=2*t,s=i-1,r=n/(2*Math.PI)*Math.asin(1);return i<1?Math.pow(2,10*s)*Math.sin((s-r)*(2*Math.PI)/n)*-.5:Math.pow(2,-10*s)*Math.sin((s-r)*(2*Math.PI)/n)*.5+1}function S(t){const e=t/1;if(e<1/2.75)return 7.5625*e*e;if(e<2/2.75){const t=e-1.5/2.75;return 7.5625*t*t+.75}if(e<2.5/2.75){const t=e-2.25/2.75;return 7.5625*t*t+.9375}{const t=e-2.625/2.75;return 7.5625*t*t+.984375}}function N(t){return 1-S(1-t)}function T(t){return t<.5?.5*N(2*t):.5*S(2*t-1)+.5}t.easeInSine=e,t.easeOutSine=n,t.easeInOutSine=i,t.easeInQuad=s,t.easeOutQuad=r,t.easeInOutQuad=o,t.easeInCubic=a,t.easeOutCubic=l,t.easeInOutCubic=c,t.easeInQuart=h,t.easeOutQuart=u,t.easeInOutQuart=d,t.easeInQuint=g,t.easeOutQuint=p,t.easeInOutQuint=f,t.easeInExpo=m,t.easeOutExpo=y,t.easeInOutExpo=b,t.easeInCirc=v,t.easeOutCirc=x,t.easeInOutCirc=w,t.easeInBack=C,t.easeOutBack=P,t.easeInOutBack=E,t.easeInElastic=M,t.easeOutElastic=O,t.easeInOutElastic=A,t.easeOutBounce=S,t.easeInBounce=N,t.easeInOutBounce=T}(bb||(bb={})),function(t){t.number=(t,e)=>{const n=e-t;return e=>t+n*e},t.object=(t,e)=>{const n=Object.keys(t);return i=>{const s={};for(let r=n.length-1;-1!==r;r-=1){const o=n[r];s[o]=t[o]+(e[o]-t[o])*i}return s}},t.unit=(t,e)=>{const n=/(-?[0-9]*.[0-9]*)(px|em|cm|mm|in|pt|pc|%)/,i=n.exec(t),s=n.exec(e),r=s?s[1]:"",o=i?+i[1]:0,a=s?+s[1]:0,l=r.indexOf("."),c=l>0?r[1].length-l-1:0,h=a-o,u=i?i[2]:"";return t=>(o+h*t).toFixed(c)+u},t.color=(t,e)=>{const n=parseInt(t.slice(1),16),i=parseInt(e.slice(1),16),s=255&n,r=(255&i)-s,o=65280&n,a=(65280&i)-o,l=16711680&n,c=(16711680&i)-l;return t=>{const e=s+r*t&255,n=o+a*t&65280,i=l+c*t&16711680;return`#${(1<<24|e|n|i).toString(16).slice(1)}`}}}(vb||(vb={}));const Pb=[];function Eb(t,e){const n=Pb.find(e=>e.name===t);if(!(n&&(n.loadTimes+=1,n.loadTimes>1))&&!Vf.isApplyingHMR()){const n=document.createElement("style");n.setAttribute("type","text/css"),n.textContent=e;const i=document.querySelector("head");i&&i.insertBefore(n,i.firstChild),Pb.push({name:t,loadTimes:1,styleElement:n})}}function Mb(t){const e=Pb.findIndex(e=>e.name===t);if(e>-1){const t=Pb[e];if(t.loadTimes-=1,t.loadTimes>0)return;let n=t.styleElement;n&&n.parentNode&&n.parentNode.removeChild(n),n=null,Pb.splice(e,1)}}var Ob,Ab;(function(t){function e(t){return 180*t/Math.PI%360}function n(t){return t%360+(t<0?360:0)}t.toDeg=e,t.toRad=function(t,e=!1){const n=e?t:t%360;return n*Math.PI/180},t.normalize=n})(Ob||(Ob={})),function(t){function e(t,e=0){return Number.isInteger(t)?t:+t.toFixed(e)}function n(t,e){let n,i;if(null==e?(i=null==t?1:t,n=0):(i=e,n=null==t?0:t),i<n){const t=n;n=i,i=t}return Math.floor(Math.random()*(i-n+1)+n)}function i(t,e,n){return Number.isNaN(t)?NaN:Number.isNaN(e)||Number.isNaN(n)?0:e<n?t<e?e:t>n?n:t:t<n?n:t>e?e:t}function s(t,e){return e*Math.round(t/e)}function r(t,e){return null!=e&&null!=t&&e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height}function o(t,e){const n=t.x-e.x,i=t.y-e.y;return n*n+i*i}t.round=e,t.random=n,t.clamp=i,t.snapToGrid=s,t.containsPoint=r,t.squaredLength=o}(Ab||(Ab={}));class Sb{valueOf(){return this.toJSON()}toString(){return JSON.stringify(this.toJSON())}}class Nb extends Sb{constructor(t,e){super(),this.x=null==t?0:t,this.y=null==e?0:e}round(t=0){return this.x=Ab.round(this.x,t),this.y=Ab.round(this.y,t),this}add(t,e){const n=Nb.create(t,e);return this.x+=n.x,this.y+=n.y,this}update(t,e){const n=Nb.create(t,e);return this.x=n.x,this.y=n.y,this}translate(t,e){const n=Nb.create(t,e);return this.x+=n.x,this.y+=n.y,this}rotate(t,e){const n=Nb.rotate(this,t,e);return this.x=n.x,this.y=n.y,this}scale(t,e,n=new Nb){const i=Nb.create(n);return this.x=i.x+t*(this.x-i.x),this.y=i.y+e*(this.y-i.y),this}closest(t){if(1===t.length)return Nb.create(t[0]);let e=null,n=1/0;return t.forEach(t=>{const i=this.squaredDistance(t);i<n&&(e=t,n=i)}),e?Nb.create(e):null}distance(t){return Math.sqrt(this.squaredDistance(t))}squaredDistance(t){const e=Nb.create(t),n=this.x-e.x,i=this.y-e.y;return n*n+i*i}manhattanDistance(t){const e=Nb.create(t);return Math.abs(e.x-this.x)+Math.abs(e.y-this.y)}magnitude(){return Math.sqrt(this.x*this.x+this.y*this.y)||.01}theta(t=new Nb){const e=Nb.create(t),n=-(e.y-this.y),i=e.x-this.x;let s=Math.atan2(n,i);return s<0&&(s=2*Math.PI+s),180*s/Math.PI}angleBetween(t,e){if(this.equals(t)||this.equals(e))return NaN;let n=this.theta(e)-this.theta(t);return n<0&&(n+=360),n}vectorAngle(t){const e=new Nb(0,0);return e.angleBetween(this,t)}toPolar(t){return this.update(Nb.toPolar(this,t)),this}changeInAngle(t,e,n=new Nb){return this.clone().translate(-t,-e).theta(n)-this.theta(n)}adhereToRect(t){return Ab.containsPoint(t,this)||(this.x=Math.min(Math.max(this.x,t.x),t.x+t.width),this.y=Math.min(Math.max(this.y,t.y),t.y+t.height)),this}bearing(t){const e=Nb.create(t),n=Ob.toRad(this.y),i=Ob.toRad(e.y),s=this.x,r=e.x,o=Ob.toRad(r-s),a=Math.sin(o)*Math.cos(i),l=Math.cos(n)*Math.sin(i)-Math.sin(n)*Math.cos(i)*Math.cos(o),c=Ob.toDeg(Math.atan2(a,l)),h=["NE","E","SE","S","SW","W","NW","N"];let u=c-22.5;return u<0&&(u+=360),u=parseInt(u/45,10),h[u]}cross(t,e){if(null!=t&&null!=e){const n=Nb.create(t),i=Nb.create(e);return(i.x-this.x)*(n.y-this.y)-(i.y-this.y)*(n.x-this.x)}return NaN}dot(t){const e=Nb.create(t);return this.x*e.x+this.y*e.y}diff(t,e){if("number"===typeof t)return new Nb(this.x-t,this.y-e);const n=Nb.create(t);return new Nb(this.x-n.x,this.y-n.y)}lerp(t,e){const n=Nb.create(t);return new Nb((1-e)*this.x+e*n.x,(1-e)*this.y+e*n.y)}normalize(t=1){const e=t/this.magnitude();return this.scale(e,e)}move(t,e){const n=Nb.create(t),i=Ob.toRad(n.theta(this));return this.translate(Math.cos(i)*e,-Math.sin(i)*e)}reflection(t){return Nb.create(t).move(this,this.distance(t))}snapToGrid(t,e){return this.x=Ab.snapToGrid(this.x,t),this.y=Ab.snapToGrid(this.y,null==e?t:e),this}equals(t){const e=Nb.create(t);return null!=e&&e.x===this.x&&e.y===this.y}clone(){return Nb.clone(this)}toJSON(){return Nb.toJSON(this)}serialize(){return`${this.x} ${this.y}`}}(function(t){function e(e){return null!=e&&e instanceof t}t.isPoint=e})(Nb||(Nb={})),function(t){function e(t){return null!=t&&"object"===typeof t&&"number"===typeof t.x&&"number"===typeof t.y}function n(t){return null!=t&&Array.isArray(t)&&2===t.length&&"number"===typeof t[0]&&"number"===typeof t[1]}t.isPointLike=e,t.isPointData=n}(Nb||(Nb={})),function(t){function e(e,i){return null==e||"number"===typeof e?new t(e,i):n(e)}function n(e){return t.isPoint(e)?new t(e.x,e.y):Array.isArray(e)?new t(e[0],e[1]):new t(e.x,e.y)}function i(e){return t.isPoint(e)?{x:e.x,y:e.y}:Array.isArray(e)?{x:e[0],y:e[1]}:{x:e.x,y:e.y}}function s(e,i,s=new t){let r=Math.abs(e*Math.cos(i)),o=Math.abs(e*Math.sin(i));const a=n(s),l=Ob.normalize(Ob.toDeg(i));return l<90?o=-o:l<180?(r=-r,o=-o):l<270&&(r=-r),new t(a.x+r,a.y+o)}function r(e,i=new t){const s=n(e),r=n(i),o=s.x-r.x,a=s.y-r.y;return new t(Math.sqrt(o*o+a*a),Ob.toRad(r.theta(s)))}function o(t,e){return t===e||null!=t&&null!=e&&(t.x===e.x&&t.y===e.y)}function a(t,e){if(null==t&&null!=e||null!=t&&null==e||null!=t&&null!=e&&t.length!==e.length)return!1;if(null!=t&&null!=e)for(let n=0,i=t.length;n<i;n+=1)if(!o(t[n],e[n]))return!1;return!0}function l(e,n,i,s){return new t(Ab.random(e,n),Ab.random(i,s))}function c(t,e,n){const i=Ob.toRad(Ob.normalize(-e)),s=Math.sin(i),r=Math.cos(i);return h(t,r,s,n)}function h(e,i,s,r=new t){const o=n(e),a=n(r),l=o.x-a.x,c=o.y-a.y,h=l*i-c*s,u=c*i+l*s;return new t(h+a.x,u+a.y)}t.create=e,t.clone=n,t.toJSON=i,t.fromPolar=s,t.toPolar=r,t.equals=o,t.equalPoints=a,t.random=l,t.rotate=c,t.rotateEx=h}(Nb||(Nb={}));class Tb extends Sb{get left(){return this.x}get top(){return this.y}get right(){return this.x+this.width}get bottom(){return this.y+this.height}get origin(){return new Nb(this.x,this.y)}get topLeft(){return new Nb(this.x,this.y)}get topCenter(){return new Nb(this.x+this.width/2,this.y)}get topRight(){return new Nb(this.x+this.width,this.y)}get center(){return new Nb(this.x+this.width/2,this.y+this.height/2)}get bottomLeft(){return new Nb(this.x,this.y+this.height)}get bottomCenter(){return new Nb(this.x+this.width/2,this.y+this.height)}get bottomRight(){return new Nb(this.x+this.width,this.y+this.height)}get corner(){return new Nb(this.x+this.width,this.y+this.height)}get rightMiddle(){return new Nb(this.x+this.width,this.y+this.height/2)}get leftMiddle(){return new Nb(this.x,this.y+this.height/2)}get topLine(){return new kb(this.topLeft,this.topRight)}get rightLine(){return new kb(this.topRight,this.bottomRight)}get bottomLine(){return new kb(this.bottomLeft,this.bottomRight)}get leftLine(){return new kb(this.topLeft,this.bottomLeft)}constructor(t,e,n,i){super(),this.x=null==t?0:t,this.y=null==e?0:e,this.width=null==n?0:n,this.height=null==i?0:i}getOrigin(){return this.origin}getTopLeft(){return this.topLeft}getTopCenter(){return this.topCenter}getTopRight(){return this.topRight}getCenter(){return this.center}getCenterX(){return this.x+this.width/2}getCenterY(){return this.y+this.height/2}getBottomLeft(){return this.bottomLeft}getBottomCenter(){return this.bottomCenter}getBottomRight(){return this.bottomRight}getCorner(){return this.corner}getRightMiddle(){return this.rightMiddle}getLeftMiddle(){return this.leftMiddle}getTopLine(){return this.topLine}getRightLine(){return this.rightLine}getBottomLine(){return this.bottomLine}getLeftLine(){return this.leftLine}bbox(t){if(!t)return this.clone();const e=Ob.toRad(t),n=Math.abs(Math.sin(e)),i=Math.abs(Math.cos(e)),s=this.width*i+this.height*n,r=this.width*n+this.height*i;return new Tb(this.x+(this.width-s)/2,this.y+(this.height-r)/2,s,r)}round(t=0){return this.x=Ab.round(this.x,t),this.y=Ab.round(this.y,t),this.width=Ab.round(this.width,t),this.height=Ab.round(this.height,t),this}add(t,e,n,i){const s=Tb.create(t,e,n,i),r=Math.min(this.x,s.x),o=Math.min(this.y,s.y),a=Math.max(this.x+this.width,s.x+s.width),l=Math.max(this.y+this.height,s.y+s.height);return this.x=r,this.y=o,this.width=a-r,this.height=l-o,this}update(t,e,n,i){const s=Tb.create(t,e,n,i);return this.x=s.x,this.y=s.y,this.width=s.width,this.height=s.height,this}inflate(t,e){const n=t,i=null!=e?e:t;return this.x-=n,this.y-=i,this.width+=2*n,this.height+=2*i,this}snapToGrid(t,e){const n=this.origin.snapToGrid(t,e),i=this.corner.snapToGrid(t,e);return this.x=n.x,this.y=n.y,this.width=i.x-n.x,this.height=i.y-n.y,this}translate(t,e){const n=Nb.create(t,e);return this.x+=n.x,this.y+=n.y,this}scale(t,e,n=new Nb){const i=this.origin.scale(t,e,n);return this.x=i.x,this.y=i.y,this.width*=t,this.height*=e,this}rotate(t,e=this.getCenter()){if(0!==t){const n=Ob.toRad(t),i=Math.cos(n),s=Math.sin(n);let r=this.getOrigin(),o=this.getTopRight(),a=this.getBottomRight(),l=this.getBottomLeft();r=Nb.rotateEx(r,i,s,e),o=Nb.rotateEx(o,i,s,e),a=Nb.rotateEx(a,i,s,e),l=Nb.rotateEx(l,i,s,e);const c=new Tb(r.x,r.y,0,0);c.add(o.x,o.y,0,0),c.add(a.x,a.y,0,0),c.add(l.x,l.y,0,0),this.update(c)}return this}rotate90(){const t=(this.width-this.height)/2;this.x+=t,this.y-=t;const e=this.width;return this.width=this.height,this.height=e,this}moveAndExpand(t){const e=Tb.clone(t);return this.x+=e.x||0,this.y+=e.y||0,this.width+=e.width||0,this.height+=e.height||0,this}getMaxScaleToFit(t,e=this.center){const n=Tb.clone(t),i=e.x,s=e.y;let r=1/0,o=1/0,a=1/0,l=1/0,c=1/0,h=1/0,u=1/0,d=1/0;const g=n.topLeft;g.x<i&&(r=(this.x-i)/(g.x-i)),g.y<s&&(c=(this.y-s)/(g.y-s));const p=n.bottomRight;p.x>i&&(o=(this.x+this.width-i)/(p.x-i)),p.y>s&&(h=(this.y+this.height-s)/(p.y-s));const f=n.topRight;f.x>i&&(a=(this.x+this.width-i)/(f.x-i)),f.y<s&&(u=(this.y-s)/(f.y-s));const m=n.bottomLeft;return m.x<i&&(l=(this.x-i)/(m.x-i)),m.y>s&&(d=(this.y+this.height-s)/(m.y-s)),{sx:Math.min(r,o,a,l),sy:Math.min(c,h,u,d)}}getMaxUniformScaleToFit(t,e=this.center){const n=this.getMaxScaleToFit(t,e);return Math.min(n.sx,n.sy)}containsPoint(t,e){return Ab.containsPoint(this,Nb.create(t,e))}containsRect(t,e,n,i){const s=Tb.create(t,e,n,i),r=this.x,o=this.y,a=this.width,l=this.height,c=s.x,h=s.y,u=s.width,d=s.height;return 0!==a&&0!==l&&0!==u&&0!==d&&(c>=r&&h>=o&&c+u<=r+a&&h+d<=o+l)}intersectsWithLine(t){const e=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],n=[],i=[];return e.forEach(e=>{const s=t.intersectsWithLine(e);null!==s&&i.indexOf(s.toString())<0&&(n.push(s),i.push(s.toString()))}),n.length>0?n:null}intersectsWithLineFromCenterToPoint(t,e){const n=Nb.clone(t),i=this.center;let s=null;null!=e&&0!==e&&n.rotate(e,i);const r=[this.topLine,this.rightLine,this.bottomLine,this.leftLine],o=new kb(i,n);for(let a=r.length-1;a>=0;a-=1){const t=r[a].intersectsWithLine(o);if(null!==t){s=t;break}}return s&&null!=e&&0!==e&&s.rotate(-e,i),s}intersectsWithRect(t,e,n,i){const s=Tb.create(t,e,n,i);if(!this.isIntersectWithRect(s))return null;const r=this.origin,o=this.corner,a=s.origin,l=s.corner,c=Math.max(r.x,a.x),h=Math.max(r.y,a.y);return new Tb(c,h,Math.min(o.x,l.x)-c,Math.min(o.y,l.y)-h)}isIntersectWithRect(t,e,n,i){const s=Tb.create(t,e,n,i),r=this.origin,o=this.corner,a=s.origin,l=s.corner;return!(l.x<=r.x||l.y<=r.y||a.x>=o.x||a.y>=o.y)}normalize(){let t=this.x,e=this.y,n=this.width,i=this.height;return this.width<0&&(t=this.x+this.width,n=-this.width),this.height<0&&(e=this.y+this.height,i=-this.height),this.x=t,this.y=e,this.width=n,this.height=i,this}union(t){const e=Tb.clone(t),n=this.origin,i=this.corner,s=e.origin,r=e.corner,o=Math.min(n.x,s.x),a=Math.min(n.y,s.y),l=Math.max(i.x,r.x),c=Math.max(i.y,r.y);return new Tb(o,a,l-o,c-a)}getNearestSideToPoint(t){const e=Nb.clone(t),n=e.x-this.x,i=this.x+this.width-e.x,s=e.y-this.y,r=this.y+this.height-e.y;let o=n,a="left";return i<o&&(o=i,a="right"),s<o&&(o=s,a="top"),r<o&&(a="bottom"),a}getNearestPointToPoint(t){const e=Nb.clone(t);if(this.containsPoint(e)){const t=this.getNearestSideToPoint(e);if("left"===t)return new Nb(this.x,e.y);if("top"===t)return new Nb(e.x,this.y);if("right"===t)return new Nb(this.x+this.width,e.y);if("bottom"===t)return new Nb(e.x,this.y+this.height)}return e.adhereToRect(this)}equals(t){return null!=t&&t.x===this.x&&t.y===this.y&&t.width===this.width&&t.height===this.height}clone(){return new Tb(this.x,this.y,this.width,this.height)}toJSON(){return{x:this.x,y:this.y,width:this.width,height:this.height}}serialize(){return`${this.x} ${this.y} ${this.width} ${this.height}`}}(function(t){function e(e){return null!=e&&e instanceof t}t.isRectangle=e})(Tb||(Tb={})),function(t){function e(t){return null!=t&&"object"===typeof t&&"number"===typeof t.x&&"number"===typeof t.y&&"number"===typeof t.width&&"number"===typeof t.height}t.isRectangleLike=e}(Tb||(Tb={})),function(t){function e(e,i,s,r){return null==e||"number"===typeof e?new t(e,i,s,r):n(e)}function n(e){return t.isRectangle(e)?e.clone():Array.isArray(e)?new t(e[0],e[1],e[2],e[3]):new t(e.x,e.y,e.width,e.height)}function i(e){return new t(e.x-e.a,e.y-e.b,2*e.a,2*e.b)}function s(e){return new t(0,0,e.width,e.height)}function r(e,n){return new t(e.x,e.y,n.width,n.height)}t.create=e,t.clone=n,t.fromEllipse=i,t.fromSize=s,t.fromPositionAndSize=r}(Tb||(Tb={}));class kb extends Sb{get center(){return new Nb((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}constructor(t,e,n,i){super(),"number"===typeof t&&"number"===typeof e?(this.start=new Nb(t,e),this.end=new Nb(n,i)):(this.start=Nb.create(t),this.end=Nb.create(e))}getCenter(){return this.center}round(t=0){return this.start.round(t),this.end.round(t),this}translate(t,e){return"number"===typeof t?(this.start.translate(t,e),this.end.translate(t,e)):(this.start.translate(t),this.end.translate(t)),this}rotate(t,e){return this.start.rotate(t,e),this.end.rotate(t,e),this}scale(t,e,n){return this.start.scale(t,e,n),this.end.scale(t,e,n),this}length(){return Math.sqrt(this.squaredLength())}squaredLength(){const t=this.start.x-this.end.x,e=this.start.y-this.end.y;return t*t+e*e}setLength(t){const e=this.length();if(!e)return this;const n=t/e;return this.scale(n,n,this.start)}parallel(t){const e=this.clone();if(!e.isDifferentiable())return e;const{start:n,end:i}=e,s=n.clone().rotate(270,i),r=i.clone().rotate(90,n);return n.move(r,t),i.move(s,t),e}vector(){return new Nb(this.end.x-this.start.x,this.end.y-this.start.y)}angle(){const t=new Nb(this.start.x+1,this.start.y);return this.start.angleBetween(this.end,t)}bbox(){const t=Math.min(this.start.x,this.end.x),e=Math.min(this.start.y,this.end.y),n=Math.max(this.start.x,this.end.x),i=Math.max(this.start.y,this.end.y);return new Tb(t,e,n-t,i-e)}bearing(){return this.start.bearing(this.end)}closestPoint(t){return this.pointAt(this.closestPointNormalizedLength(t))}closestPointLength(t){return this.closestPointNormalizedLength(t)*this.length()}closestPointTangent(t){return this.tangentAt(this.closestPointNormalizedLength(t))}closestPointNormalizedLength(t){const e=this.vector().dot(new kb(this.start,t).vector()),n=Math.min(1,Math.max(0,e/this.squaredLength()));return Number.isNaN(n)?0:n}pointAt(t){const e=this.start,n=this.end;return t<=0?e.clone():t>=1?n.clone():e.lerp(n,t)}pointAtLength(t){const e=this.start,n=this.end;let i=!0;t<0&&(i=!1,t=-t);const s=this.length();if(t>=s)return i?n.clone():e.clone();const r=(i?t:s-t)/s;return this.pointAt(r)}divideAt(t){const e=this.pointAt(t);return[new kb(this.start,e),new kb(e,this.end)]}divideAtLength(t){const e=this.pointAtLength(t);return[new kb(this.start,e),new kb(e,this.end)]}containsPoint(t){const e=this.start,n=this.end;if(0!==e.cross(t,n))return!1;const i=this.length();return!(new kb(e,t).length()>i)&&!(new kb(t,n).length()>i)}intersect(t,e){const n=t.intersectsWithLine(this,e);return n?Array.isArray(n)?n:[n]:null}intersectsWithLine(t){const e=new Nb(this.end.x-this.start.x,this.end.y-this.start.y),n=new Nb(t.end.x-t.start.x,t.end.y-t.start.y),i=e.x*n.y-e.y*n.x,s=new Nb(t.start.x-this.start.x,t.start.y-this.start.y),r=s.x*n.y-s.y*n.x,o=s.x*e.y-s.y*e.x;if(0===i||r*i<0||o*i<0)return null;if(i>0){if(r>i||o>i)return null}else if(r<i||o<i)return null;return new Nb(this.start.x+r*e.x/i,this.start.y+r*e.y/i)}isDifferentiable(){return!this.start.equals(this.end)}pointOffset(t){const e=Nb.clone(t),n=this.start,i=this.end,s=(i.x-n.x)*(e.y-n.y)-(i.y-n.y)*(e.x-n.x);return s/this.length()}pointSquaredDistance(t,e){const n=Nb.create(t,e);return this.closestPoint(n).squaredDistance(n)}pointDistance(t,e){const n=Nb.create(t,e);return this.closestPoint(n).distance(n)}tangentAt(t){if(!this.isDifferentiable())return null;const e=this.start,n=this.end,i=this.pointAt(t),s=new kb(e,n);return s.translate(i.x-e.x,i.y-e.y),s}tangentAtLength(t){if(!this.isDifferentiable())return null;const e=this.start,n=this.end,i=this.pointAtLength(t),s=new kb(e,n);return s.translate(i.x-e.x,i.y-e.y),s}relativeCcw(t,e){const n=Nb.create(t,e);let i=n.x-this.start.x,s=n.y-this.start.y;const r=this.end.x-this.start.x,o=this.end.y-this.start.y;let a=i*o-s*r;return 0===a&&(a=i*r+s*o,a>0&&(i-=r,s-=o,a=i*r+s*o,a<0&&(a=0))),a<0?-1:a>0?1:0}equals(t){return null!=t&&this.start.x===t.start.x&&this.start.y===t.start.y&&this.end.x===t.end.x&&this.end.y===t.end.y}clone(){return new kb(this.start,this.end)}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.end.serialize()].join(" ")}}(function(t){function e(e){return null!=e&&e instanceof t}t.isLine=e})(kb||(kb={}));class jb extends Sb{get center(){return new Nb(this.x,this.y)}constructor(t,e,n,i){super(),this.x=null==t?0:t,this.y=null==e?0:e,this.a=null==n?0:n,this.b=null==i?0:i}bbox(){return Tb.fromEllipse(this)}getCenter(){return this.center}inflate(t,e){const n=t,i=null!=e?e:t;return this.a+=2*n,this.b+=2*i,this}normalizedDistance(t,e){const n=Nb.create(t,e),i=n.x-this.x,s=n.y-this.y,r=this.a,o=this.b;return i*i/(r*r)+s*s/(o*o)}containsPoint(t,e){return this.normalizedDistance(t,e)<=1}intersectsWithLine(t){const e=[],n=this.a,i=this.b,s=t.start,r=t.end,o=t.vector(),a=s.diff(new Nb(this.x,this.y)),l=new Nb(o.x/(n*n),o.y/(i*i)),c=new Nb(a.x/(n*n),a.y/(i*i)),h=o.dot(l),u=o.dot(c),d=a.dot(c)-1,g=u*u-h*d;if(g<0)return null;if(g>0){const t=Math.sqrt(g),n=(-u-t)/h,i=(-u+t)/h;if((n<0||n>1)&&(i<0||i>1))return null;n>=0&&n<=1&&e.push(s.lerp(r,n)),i>=0&&i<=1&&e.push(s.lerp(r,i))}else{const t=-u/h;if(!(t>=0&&t<=1))return null;e.push(s.lerp(r,t))}return e}intersectsWithLineFromCenterToPoint(t,e=0){const n=Nb.clone(t);e&&n.rotate(e,this.getCenter());const i=n.x-this.x,s=n.y-this.y;let r;if(0===i)return r=this.bbox().getNearestPointToPoint(n),e?r.rotate(-e,this.getCenter()):r;const o=s/i,a=o*o,l=this.a*this.a,c=this.b*this.b;let h=Math.sqrt(1/(1/l+a/c));h=i<0?-h:h;const u=o*h;return r=new Nb(this.x+h,this.y+u),e?r.rotate(-e,this.getCenter()):r}tangentTheta(t){const e=Nb.clone(t),n=e.x,i=e.y,s=this.a,r=this.b,o=this.bbox().center,a=o.x,l=o.y,c=30,h=n>o.x+s/2,u=n<o.x-s/2;let d,g;return h||u?(g=n>o.x?i-c:i+c,d=s*s/(n-a)-s*s*(i-l)*(g-l)/(r*r*(n-a))+a):(d=i>o.y?n+c:n-c,g=r*r/(i-l)-r*r*(n-a)*(d-a)/(s*s*(i-l))+l),new Nb(d,g).theta(e)}scale(t,e){return this.a*=t,this.b*=e,this}rotate(t,e){const n=Tb.fromEllipse(this);n.rotate(t,e);const i=jb.fromRect(n);return this.a=i.a,this.b=i.b,this.x=i.x,this.y=i.y,this}translate(t,e){const n=Nb.create(t,e);return this.x+=n.x,this.y+=n.y,this}equals(t){return null!=t&&t.x===this.x&&t.y===this.y&&t.a===this.a&&t.b===this.b}clone(){return new jb(this.x,this.y,this.a,this.b)}toJSON(){return{x:this.x,y:this.y,a:this.a,b:this.b}}serialize(){return`${this.x} ${this.y} ${this.a} ${this.b}`}}(function(t){function e(e){return null!=e&&e instanceof t}t.isEllipse=e})(jb||(jb={})),function(t){function e(e,i,s,r){return null==e||"number"===typeof e?new t(e,i,s,r):n(e)}function n(e){return t.isEllipse(e)?e.clone():Array.isArray(e)?new t(e[0],e[1],e[2],e[3]):new t(e.x,e.y,e.a,e.b)}function i(e){const n=e.center;return new t(n.x,n.y,e.width/2,e.height/2)}t.create=e,t.parse=n,t.fromRect=i}(jb||(jb={}));const Lb=new RegExp("^[\\s\\dLMCZz,.]*$");function Db(t){return"string"===typeof t&&Lb.test(t)}function Bb(t,e){return(t%e+e)%e}function Ib(t,e,n,i,s){const r=[],o=t[t.length-1],a=null!=e&&e>0,l=e||0;if(i&&a){t=t.slice();const e=t[0],n=new Nb(o.x+(e.x-o.x)/2,o.y+(e.y-o.y)/2);t.splice(0,0,n)}let c=t[0],h=1;n?r.push("M",c.x,c.y):r.push("L",c.x,c.y);while(h<(i?t.length:t.length-1)){let e=t[Bb(h,t.length)],n=c.x-e.x,i=c.y-e.y;if(a&&(0!==n||0!==i)&&(null==s||s.indexOf(h-1)<0)){let s=Math.sqrt(n*n+i*i);const o=n*Math.min(l,s/2)/s,a=i*Math.min(l,s/2)/s,c=e.x+o,u=e.y+a;r.push("L",c,u);let d=t[Bb(h+1,t.length)];while(h<t.length-2&&0===Math.round(d.x-e.x)&&0===Math.round(d.y-e.y))d=t[Bb(h+2,t.length)],h+=1;n=d.x-e.x,i=d.y-e.y,s=Math.max(1,Math.sqrt(n*n+i*i));const g=n*Math.min(l,s/2)/s,p=i*Math.min(l,s/2)/s,f=e.x+g,m=e.y+p;r.push("Q",e.x,e.y,f,m),e=new Nb(f,m)}else r.push("L",e.x,e.y);c=e,h+=1}return i?r.push("Z"):r.push("L",o.x,o.y),r.map(t=>"string"===typeof t?t:+t.toFixed(3)).join(" ")}function Rb(t,e={}){const n=[];return t&&t.length&&t.forEach(t=>{Array.isArray(t)?n.push({x:t[0],y:t[1]}):n.push({x:t.x,y:t.y})}),Ib(n,e.round,null==e.initialMove||e.initialMove,e.close,e.exclude)}function Vb(t,e,n,i,s=0,r=0,o=0,a,l){if(0===n||0===i)return[];a-=t,l-=e,n=Math.abs(n),i=Math.abs(i);const c=-a/2,h=-l/2,u=Math.cos(s*Math.PI/180),d=Math.sin(s*Math.PI/180),g=u*c+d*h,p=-1*d*c+u*h,f=g*g,m=p*p,y=n*n,b=i*i,v=f/y+m/b;let x;if(v>1)n=Math.sqrt(v)*n,i=Math.sqrt(v)*i,x=0;else{let t=1;r===o&&(t=-1),x=t*Math.sqrt((y*b-y*m-b*f)/(y*m+b*f))}const w=x*n*p/i,C=-1*x*i*g/n,P=u*w-d*C+a/2,E=d*w+u*C+l/2;let M=Math.atan2((p-C)/i,(g-w)/n)-Math.atan2(0,1),O=M>=0?M:2*Math.PI+M;M=Math.atan2((-p-C)/i,(-g-w)/n)-Math.atan2((p-C)/i,(g-w)/n);let A=M>=0?M:2*Math.PI+M;0===o&&A>0?A-=2*Math.PI:0!==o&&A<0&&(A+=2*Math.PI);const S=2*A/Math.PI,N=Math.ceil(S<0?-1*S:S),T=A/N,k=8/3*Math.sin(T/4)*Math.sin(T/4)/Math.sin(T/2),j=u*n,L=u*i,D=d*n,B=d*i;let I=Math.cos(O),R=Math.sin(O),V=-k*(j*R+B*I),z=-k*(D*R-L*I),$=0,F=0;const G=[];for(let _=0;_<N;_+=1){O+=T,I=Math.cos(O),R=Math.sin(O),$=j*I-B*R+P,F=D*I+L*R+E;const n=-k*(j*R+B*I),i=-k*(D*R-L*I),s=6*_;G[s]=Number(V+t),G[s+1]=Number(z+e),G[s+2]=Number($-n+t),G[s+3]=Number(F-i+e),G[s+4]=Number($+t),G[s+5]=Number(F+e),V=$+n,z=F+i}return G.map(t=>+t.toFixed(2))}function zb(t,e,n,i,s=0,r=0,o=0,a,l){const c=[],h=Vb(t,e,n,i,s,r,o,a,l);if(null!=h)for(let u=0,d=h.length;u<d;u+=6)c.push("C",h[u],h[u+1],h[u+2],h[u+3],h[u+4],h[u+5]);return c.join(" ")}class $b extends Sb{get start(){return this.points[0]||null}get end(){return this.points[this.points.length-1]||null}constructor(t){if(super(),null!=t){if("string"===typeof t)return $b.parse(t);this.points=t.map(t=>Nb.create(t))}else this.points=[]}scale(t,e,n=new Nb){return this.points.forEach(i=>i.scale(t,e,n)),this}rotate(t,e){return this.points.forEach(n=>n.rotate(t,e)),this}translate(t,e){const n=Nb.create(t,e);return this.points.forEach(t=>t.translate(n.x,n.y)),this}round(t=0){return this.points.forEach(e=>e.round(t)),this}bbox(){if(0===this.points.length)return new Tb;let t=1/0,e=-1/0,n=1/0,i=-1/0;const s=this.points;for(let r=0,o=s.length;r<o;r+=1){const o=s[r],a=o.x,l=o.y;a<t&&(t=a),a>e&&(e=a),l<n&&(n=l),l>i&&(i=l)}return new Tb(t,n,e-t,i-n)}closestPoint(t){const e=this.closestPointLength(t);return this.pointAtLength(e)}closestPointLength(t){const e=this.points,n=e.length;if(0===n||1===n)return 0;let i=0,s=0,r=1/0;for(let o=0,a=n-1;o<a;o+=1){const n=new kb(e[o],e[o+1]),a=n.length(),l=n.closestPointNormalizedLength(t),c=n.pointAt(l),h=c.squaredDistance(t);h<r&&(r=h,s=i+l*a),i+=a}return s}closestPointNormalizedLength(t){const e=this.length();if(0===e)return 0;const n=this.closestPointLength(t);return n/e}closestPointTangent(t){const e=this.closestPointLength(t);return this.tangentAtLength(e)}containsPoint(t){if(0===this.points.length)return!1;const e=Nb.clone(t),n=e.x,i=e.y,s=this.points,r=s.length;let o=r-1,a=0;for(let l=0;l<r;l+=1){const r=s[o],c=s[l];if(e.equals(r))return!0;const h=new kb(r,c);if(h.containsPoint(t))return!0;if(i<=r.y&&i>c.y||i>r.y&&i<=c.y){const e=r.x-n>c.x-n?r.x-n:c.x-n;if(e>=0){const s=new Nb(n+e,i),r=new kb(t,s);h.intersectsWithLine(r)&&(a+=1)}}o=l}return a%2===1}intersectsWithLine(t){const e=[];for(let n=0,i=this.points.length-1;n<i;n+=1){const i=this.points[n],s=this.points[n+1],r=t.intersectsWithLine(new kb(i,s));r&&e.push(r)}return e.length>0?e:null}isDifferentiable(){for(let t=0,e=this.points.length-1;t<e;t+=1){const e=this.points[t],n=this.points[t+1],i=new kb(e,n);if(i.isDifferentiable())return!0}return!1}length(){let t=0;for(let e=0,n=this.points.length-1;e<n;e+=1){const n=this.points[e],i=this.points[e+1];t+=n.distance(i)}return t}pointAt(t){const e=this.points,n=e.length;if(0===n)return null;if(1===n)return e[0].clone();if(t<=0)return e[0].clone();if(t>=1)return e[n-1].clone();const i=this.length(),s=i*t;return this.pointAtLength(s)}pointAtLength(t){const e=this.points,n=e.length;if(0===n)return null;if(1===n)return e[0].clone();let i=!0;t<0&&(i=!1,t=-t);let s=0;for(let o=0,a=n-1;o<a;o+=1){const n=i?o:a-1-o,r=e[n],l=e[n+1],c=new kb(r,l),h=r.distance(l);if(t<=s+h)return c.pointAtLength((i?1:-1)*(t-s));s+=h}const r=i?e[n-1]:e[0];return r.clone()}tangentAt(t){const e=this.points,n=e.length;if(0===n||1===n)return null;t<0&&(t=0),t>1&&(t=1);const i=this.length(),s=i*t;return this.tangentAtLength(s)}tangentAtLength(t){const e=this.points,n=e.length;if(0===n||1===n)return null;let i,s=!0;t<0&&(s=!1,t=-t);let r=0;for(let o=0,a=n-1;o<a;o+=1){const n=s?o:a-1-o,l=e[n],c=e[n+1],h=new kb(l,c),u=l.distance(c);if(h.isDifferentiable()){if(t<=r+u)return h.tangentAtLength((s?1:-1)*(t-r));i=h}r+=u}if(i){const t=s?1:0;return i.tangentAt(t)}return null}simplify(t={}){const e=this.points;if(e.length<3)return this;const n=t.threshold||0;let i=0;while(e[i+2]){const t=i,s=i+1,r=i+2,o=e[t],a=e[s],l=e[r],c=new kb(o,l),h=c.closestPoint(a),u=h.distance(a);u<=n?e.splice(s,1):i+=1}return this}toHull(){const t=this.points,e=t.length;if(0===e)return new $b;let n=t[0];for(let u=1;u<e;u+=1)(t[u].y<n.y||t[u].y===n.y&&t[u].x>n.x)&&(n=t[u]);const i=[];for(let u=0;u<e;u+=1){let e=n.theta(t[u]);0===e&&(e=360),i.push([t[u],u,e])}if(i.sort((t,e)=>{let n=t[2]-e[2];return 0===n&&(n=e[1]-t[1]),n}),i.length>2){const t=i[i.length-1];i.unshift(t)}const s={},r=[],o=t=>`${t[0].toString()}@${t[1]}`;while(0!==i.length){const t=i.pop(),e=t[0];if(s[o(t)])continue;let n=!1;while(!n)if(r.length<2)r.push(t),n=!0;else{const a=r.pop(),l=a[0],c=r.pop(),h=c[0],u=h.cross(l,e);if(u<0)r.push(c),r.push(a),r.push(t),n=!0;else if(0===u){const t=1e-10,n=l.angleBetween(h,e);Math.abs(n-180)<t||l.equals(e)||h.equals(l)?(s[o(a)]=l,r.push(c)):Math.abs((n+1)%360-1)<t&&(r.push(c),i.push(a))}else s[o(a)]=l,r.push(c)}}let a;r.length>2&&r.pop();let l=-1;for(let u=0,d=r.length;u<d;u+=1){const t=r[u][1];(void 0===a||t<a)&&(a=t,l=u)}let c=[];if(l>0){const t=r.slice(l),e=r.slice(0,l);c=t.concat(e)}else c=r;const h=[];for(let u=0,d=c.length;u<d;u+=1)h.push(c[u][0]);return new $b(h)}equals(t){return null!=t&&(t.points.length===this.points.length&&t.points.every((t,e)=>t.equals(this.points[e])))}clone(){return new $b(this.points.map(t=>t.clone()))}toJSON(){return this.points.map(t=>t.toJSON())}serialize(){return this.points.map(t=>`${t.serialize()}`).join(" ")}}(function(t){function e(e){return null!=e&&e instanceof t}t.isPolyline=e})($b||($b={})),function(t){function e(e){const n=e.trim();if(""===n)return new t;const i=[],s=n.split(/\s*,\s*|\s+/);for(let t=0,r=s.length;t<r;t+=2)i.push({x:+s[t],y:+s[t+1]});return new t(i)}t.parse=e}($b||($b={}));class Fb extends Sb{constructor(t,e,n,i){super(),this.PRECISION=3,this.start=Nb.create(t),this.controlPoint1=Nb.create(e),this.controlPoint2=Nb.create(n),this.end=Nb.create(i)}bbox(){const t=this.start,e=this.controlPoint1,n=this.controlPoint2,i=this.end,s=t.x,r=t.y,o=e.x,a=e.y,l=n.x,c=n.y,h=i.x,u=i.y,d=[],g=[],p=[[],[]];let f,m,y,b,v,x,w,C,P,E,M;for(let j=0;j<2;j+=1)if(0===j?(m=6*s-12*o+6*l,f=-3*s+9*o-9*l+3*h,y=3*o-3*s):(m=6*r-12*a+6*c,f=-3*r+9*a-9*c+3*u,y=3*a-3*r),Math.abs(f)<1e-12){if(Math.abs(m)<1e-12)continue;b=-y/m,b>0&&b<1&&g.push(b)}else w=m*m-4*y*f,C=Math.sqrt(w),w<0||(v=(-m+C)/(2*f),v>0&&v<1&&g.push(v),x=(-m-C)/(2*f),x>0&&x<1&&g.push(x));let O=g.length;const A=O;while(O)O-=1,b=g[O],M=1-b,P=M*M*M*s+3*M*M*b*o+3*M*b*b*l+b*b*b*h,p[0][O]=P,E=M*M*M*r+3*M*M*b*a+3*M*b*b*c+b*b*b*u,p[1][O]=E,d[O]={X:P,Y:E};g[A]=0,g[A+1]=1,d[A]={X:s,Y:r},d[A+1]={X:h,Y:u},p[0][A]=s,p[1][A]=r,p[0][A+1]=h,p[1][A+1]=u,g.length=A+2,p[0].length=A+2,p[1].length=A+2,d.length=A+2;const S=Math.min.apply(null,p[0]),N=Math.min.apply(null,p[1]),T=Math.max.apply(null,p[0]),k=Math.max.apply(null,p[1]);return new Tb(S,N,T-S,k-N)}closestPoint(t,e={}){return this.pointAtT(this.closestPointT(t,e))}closestPointLength(t,e={}){const n=this.getOptions(e);return this.lengthAtT(this.closestPointT(t,n),n)}closestPointNormalizedLength(t,e={}){const n=this.getOptions(e),i=this.closestPointLength(t,n);if(!i)return 0;const s=this.length(n);return 0===s?0:i/s}closestPointT(t,e={}){const n=this.getPrecision(e),i=this.getDivisions(e),s=Math.pow(10,-n);let r=null,o=0,a=0,l=0,c=0,h=0,u=null;const d=i.length;let g=d>0?1/d:0;i.forEach((e,n)=>{const i=e.start.distance(t),s=e.end.distance(t),d=i+s;(null==u||d<u)&&(r=e,o=n*g,a=(n+1)*g,l=i,c=s,u=d,h=e.endpointDistance())});while(1){const e=l?Math.abs(l-c)/l:0,n=null!=c?Math.abs(l-c)/c:0,i=e<s||n<s,u=!l||l<h*s,d=!c||c<h*s,p=u||d;if(i||p)return l<=c?o:a;const f=r.divide(.5);g/=2;const m=f[0].start.distance(t),y=f[0].end.distance(t),b=m+y,v=f[1].start.distance(t),x=f[1].end.distance(t),w=v+x;b<=w?(r=f[0],a-=g,l=m,c=y):(r=f[1],o+=g,l=v,c=x)}}closestPointTangent(t,e={}){return this.tangentAtT(this.closestPointT(t,e))}containsPoint(t,e={}){const n=this.toPolyline(e);return n.containsPoint(t)}divideAt(t,e={}){if(t<=0)return this.divideAtT(0);if(t>=1)return this.divideAtT(1);const n=this.tAt(t,e);return this.divideAtT(n)}divideAtLength(t,e={}){const n=this.tAtLength(t,e);return this.divideAtT(n)}divide(t){return this.divideAtT(t)}divideAtT(t){const e=this.start,n=this.controlPoint1,i=this.controlPoint2,s=this.end;if(t<=0)return[new Fb(e,e,e,e),new Fb(e,n,i,s)];if(t>=1)return[new Fb(e,n,i,s),new Fb(s,s,s,s)];const r=this.getSkeletonPoints(t),o=r.startControlPoint1,a=r.startControlPoint2,l=r.divider,c=r.dividerControlPoint1,h=r.dividerControlPoint2;return[new Fb(e,o,a,l),new Fb(l,c,h,s)]}endpointDistance(){return this.start.distance(this.end)}getSkeletonPoints(t){const e=this.start,n=this.controlPoint1,i=this.controlPoint2,s=this.end;if(t<=0)return{startControlPoint1:e.clone(),startControlPoint2:e.clone(),divider:e.clone(),dividerControlPoint1:n.clone(),dividerControlPoint2:i.clone()};if(t>=1)return{startControlPoint1:n.clone(),startControlPoint2:i.clone(),divider:s.clone(),dividerControlPoint1:s.clone(),dividerControlPoint2:s.clone()};const r=new kb(e,n).pointAt(t),o=new kb(n,i).pointAt(t),a=new kb(i,s).pointAt(t),l=new kb(r,o).pointAt(t),c=new kb(o,a).pointAt(t),h=new kb(l,c).pointAt(t);return{startControlPoint1:r,startControlPoint2:l,divider:h,dividerControlPoint1:c,dividerControlPoint2:a}}getSubdivisions(t={}){const e=this.getPrecision(t);let n=[new Fb(this.start,this.controlPoint1,this.controlPoint2,this.end)];if(0===e)return n;let i=this.endpointDistance();const s=Math.pow(10,-e);let r=0;while(1){r+=1;const t=[];n.forEach(e=>{const n=e.divide(.5);t.push(n[0],n[1])});const e=t.reduce((t,e)=>t+e.endpointDistance(),0),o=0!==e?(e-i)/e:0;if(r>1&&o<s)return t;n=t,i=e}}length(t={}){const e=this.getDivisions(t);return e.reduce((t,e)=>t+e.endpointDistance(),0)}lengthAtT(t,e={}){if(t<=0)return 0;const n=void 0===e.precision?this.PRECISION:e.precision,i=this.divide(t)[0];return i.length({precision:n})}pointAt(t,e={}){if(t<=0)return this.start.clone();if(t>=1)return this.end.clone();const n=this.tAt(t,e);return this.pointAtT(n)}pointAtLength(t,e={}){const n=this.tAtLength(t,e);return this.pointAtT(n)}pointAtT(t){return t<=0?this.start.clone():t>=1?this.end.clone():this.getSkeletonPoints(t).divider}isDifferentiable(){const t=this.start,e=this.controlPoint1,n=this.controlPoint2,i=this.end;return!(t.equals(e)&&e.equals(n)&&n.equals(i))}tangentAt(t,e={}){if(!this.isDifferentiable())return null;t<0?t=0:t>1&&(t=1);const n=this.tAt(t,e);return this.tangentAtT(n)}tangentAtLength(t,e={}){if(!this.isDifferentiable())return null;const n=this.tAtLength(t,e);return this.tangentAtT(n)}tangentAtT(t){if(!this.isDifferentiable())return null;t<0&&(t=0),t>1&&(t=1);const e=this.getSkeletonPoints(t),n=e.startControlPoint2,i=e.dividerControlPoint1,s=e.divider,r=new kb(n,i);return r.translate(s.x-n.x,s.y-n.y),r}getPrecision(t={}){return null==t.precision?this.PRECISION:t.precision}getDivisions(t={}){if(null!=t.subdivisions)return t.subdivisions;const e=this.getPrecision(t);return this.getSubdivisions({precision:e})}getOptions(t={}){const e=this.getPrecision(t),n=this.getDivisions(t);return{precision:e,subdivisions:n}}tAt(t,e={}){if(t<=0)return 0;if(t>=1)return 1;const n=this.getOptions(e),i=this.length(n),s=i*t;return this.tAtLength(s,n)}tAtLength(t,e={}){let n=!0;t<0&&(n=!1,t=-t);const i=this.getPrecision(e),s=this.getDivisions(e),r={precision:i,subdivisions:s};let o,a,l=null,c=0,h=0,u=0;const d=s.length;let g=d>0?1/d:0;for(let m=0;m<d;m+=1){const e=n?m:d-1-m,i=s[m],r=i.endpointDistance();if(t<=u+r){l=i,o=e*g,a=(e+1)*g,c=n?t-u:r+u-t,h=n?r+u-t:t-u;break}u+=r}if(null==l)return n?1:0;const p=this.length(r),f=Math.pow(10,-i);while(1){let t,e,n;if(t=0!==p?c/p:0,t<f)return o;if(t=0!==p?h/p:0,t<f)return a;const i=l.divide(.5);g/=2;const s=i[0].endpointDistance(),r=i[1].endpointDistance();c<=s?(l=i[0],a-=g,e=c,n=s-e):(l=i[1],o+=g,e=c-s,n=r-e),c=e,h=n}}toPoints(t={}){const e=this.getDivisions(t),n=[e[0].start.clone()];return e.forEach(t=>n.push(t.end.clone())),n}toPolyline(t={}){return new $b(this.toPoints(t))}scale(t,e,n){return this.start.scale(t,e,n),this.controlPoint1.scale(t,e,n),this.controlPoint2.scale(t,e,n),this.end.scale(t,e,n),this}rotate(t,e){return this.start.rotate(t,e),this.controlPoint1.rotate(t,e),this.controlPoint2.rotate(t,e),this.end.rotate(t,e),this}translate(t,e){return"number"===typeof t?(this.start.translate(t,e),this.controlPoint1.translate(t,e),this.controlPoint2.translate(t,e),this.end.translate(t,e)):(this.start.translate(t),this.controlPoint1.translate(t),this.controlPoint2.translate(t),this.end.translate(t)),this}equals(t){return null!=t&&this.start.equals(t.start)&&this.controlPoint1.equals(t.controlPoint1)&&this.controlPoint2.equals(t.controlPoint2)&&this.end.equals(t.end)}clone(){return new Fb(this.start,this.controlPoint1,this.controlPoint2,this.end)}toJSON(){return{start:this.start.toJSON(),controlPoint1:this.controlPoint1.toJSON(),controlPoint2:this.controlPoint2.toJSON(),end:this.end.toJSON()}}serialize(){return[this.start.serialize(),this.controlPoint1.serialize(),this.controlPoint2.serialize(),this.end.serialize()].join(" ")}}(function(t){function e(e){return null!=e&&e instanceof t}t.isCurve=e})(Fb||(Fb={})),function(t){function e(t){const e=t.length,n=[],i=[];let s=2;n[0]=t[0]/s;for(let r=1;r<e;r+=1)i[r]=1/s,s=(r<e-1?4:3.5)-i[r],n[r]=(t[r]-n[r-1])/s;for(let r=1;r<e;r+=1)n[e-r-1]-=i[e-r]*n[e-r];return n}function n(t){const n=t.map(t=>Nb.clone(t)),i=[],s=[],r=n.length-1;if(1===r)return i[0]=new Nb((2*n[0].x+n[1].x)/3,(2*n[0].y+n[1].y)/3),s[0]=new Nb(2*i[0].x-n[0].x,2*i[0].y-n[0].y),[i,s];const o=[];for(let e=1;e<r-1;e+=1)o[e]=4*n[e].x+2*n[e+1].x;o[0]=n[0].x+2*n[1].x,o[r-1]=(8*n[r-1].x+n[r].x)/2;const a=e(o);for(let e=1;e<r-1;e+=1)o[e]=4*n[e].y+2*n[e+1].y;o[0]=n[0].y+2*n[1].y,o[r-1]=(8*n[r-1].y+n[r].y)/2;const l=e(o);for(let e=0;e<r;e+=1)i.push(new Nb(a[e],l[e])),e<r-1?s.push(new Nb(2*n[e+1].x-a[e+1],2*n[e+1].y-l[e+1])):s.push(new Nb((n[r].x+a[r-1])/2,(n[r].y+l[r-1])/2));return[i,s]}function i(e){if(null==e||Array.isArray(e)&&e.length<2)throw new Error("At least 2 points are required");const i=n(e),s=[];for(let n=0,r=i[0].length;n<r;n+=1){const r=new Nb(i[0][n].x,i[0][n].y),o=new Nb(i[1][n].x,i[1][n].y);s.push(new t(e[n],r,o,e[n+1]))}return s}t.throughPoints=i}(Fb||(Fb={}));class Gb extends Sb{constructor(){super(...arguments),this.isVisible=!0,this.isSegment=!0,this.isSubpathStart=!1}get end(){return this.endPoint}get start(){if(null==this.previousSegment)throw new Error("Missing previous segment. (This segment cannot be the first segment of a path, or segment has not yet been added to a path.)");return this.previousSegment.end}closestPointT(t,e){if(this.closestPointNormalizedLength)return this.closestPointNormalizedLength(t);throw new Error("Neither `closestPointT` nor `closestPointNormalizedLength` method is implemented.")}lengthAtT(t,e){if(t<=0)return 0;const n=this.length();return t>=1?n:n*t}divideAtT(t){if(this.divideAt)return this.divideAt(t);throw new Error("Neither `divideAtT` nor `divideAt` method is implemented.")}pointAtT(t){if(this.pointAt)return this.pointAt(t);throw new Error("Neither `pointAtT` nor `pointAt` method is implemented.")}tangentAtT(t){if(this.tangentAt)return this.tangentAt(t);throw new Error("Neither `tangentAtT` nor `tangentAt` method is implemented.")}}class _b extends Gb{constructor(t,e){super(),kb.isLine(t)?this.endPoint=t.end.clone().round(2):this.endPoint=Nb.create(t,e).round(2)}get type(){return"L"}get line(){return new kb(this.start,this.end)}bbox(){return this.line.bbox()}closestPoint(t){return this.line.closestPoint(t)}closestPointLength(t){return this.line.closestPointLength(t)}closestPointNormalizedLength(t){return this.line.closestPointNormalizedLength(t)}closestPointTangent(t){return this.line.closestPointTangent(t)}length(){return this.line.length()}divideAt(t){const e=this.line.divideAt(t);return[new _b(e[0]),new _b(e[1])]}divideAtLength(t){const e=this.line.divideAtLength(t);return[new _b(e[0]),new _b(e[1])]}getSubdivisions(){return[]}pointAt(t){return this.line.pointAt(t)}pointAtLength(t){return this.line.pointAtLength(t)}tangentAt(t){return this.line.tangentAt(t)}tangentAtLength(t){return this.line.tangentAtLength(t)}isDifferentiable(){return null!=this.previousSegment&&!this.start.equals(this.end)}clone(){return new _b(this.end)}scale(t,e,n){return this.end.scale(t,e,n),this}rotate(t,e){return this.end.rotate(t,e),this}translate(t,e){return"number"===typeof t?this.end.translate(t,e):this.end.translate(t),this}equals(t){return this.type===t.type&&this.start.equals(t.start)&&this.end.equals(t.end)}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){const t=this.end;return`${this.type} ${t.x} ${t.y}`}}(function(t){function e(...e){const n=e.length,i=e[0];if(kb.isLine(i))return new t(i);if(Nb.isPointLike(i))return 1===n?new t(i):e.map(e=>new t(e));if(2===n)return new t(+e[0],+e[1]);const s=[];for(let r=0;r<n;r+=2){const n=+e[r],i=+e[r+1];s.push(new t(n,i))}return s}t.create=e})(_b||(_b={}));class Hb extends Gb{get end(){if(!this.subpathStartSegment)throw new Error("Missing subpath start segment. (This segment needs a subpath start segment (e.g. MoveTo), or segment has not yet been added to a path.)");return this.subpathStartSegment.end}get type(){return"Z"}get line(){return new kb(this.start,this.end)}bbox(){return this.line.bbox()}closestPoint(t){return this.line.closestPoint(t)}closestPointLength(t){return this.line.closestPointLength(t)}closestPointNormalizedLength(t){return this.line.closestPointNormalizedLength(t)}closestPointTangent(t){return this.line.closestPointTangent(t)}length(){return this.line.length()}divideAt(t){const e=this.line.divideAt(t);return[e[1].isDifferentiable()?new _b(e[0]):this.clone(),new _b(e[1])]}divideAtLength(t){const e=this.line.divideAtLength(t);return[e[1].isDifferentiable()?new _b(e[0]):this.clone(),new _b(e[1])]}getSubdivisions(){return[]}pointAt(t){return this.line.pointAt(t)}pointAtLength(t){return this.line.pointAtLength(t)}tangentAt(t){return this.line.tangentAt(t)}tangentAtLength(t){return this.line.tangentAtLength(t)}isDifferentiable(){return!(!this.previousSegment||!this.subpathStartSegment)&&!this.start.equals(this.end)}scale(){return this}rotate(){return this}translate(){return this}equals(t){return this.type===t.type&&this.start.equals(t.start)&&this.end.equals(t.end)}clone(){return new Hb}toJSON(){return{type:this.type,start:this.start.toJSON(),end:this.end.toJSON()}}serialize(){return this.type}}(function(t){function e(){return new t}t.create=e})(Hb||(Hb={}));class Ub extends Gb{constructor(t,e){super(),this.isVisible=!1,this.isSubpathStart=!0,kb.isLine(t)||Fb.isCurve(t)?this.endPoint=t.end.clone().round(2):this.endPoint=Nb.create(t,e).round(2)}get start(){throw new Error("Illegal access. Moveto segments should not need a start property.")}get type(){return"M"}bbox(){return null}closestPoint(){return this.end.clone()}closestPointLength(){return 0}closestPointNormalizedLength(){return 0}closestPointT(){return 1}closestPointTangent(){return null}length(){return 0}lengthAtT(){return 0}divideAt(){return[this.clone(),this.clone()]}divideAtLength(){return[this.clone(),this.clone()]}getSubdivisions(){return[]}pointAt(){return this.end.clone()}pointAtLength(){return this.end.clone()}pointAtT(){return this.end.clone()}tangentAt(){return null}tangentAtLength(){return null}tangentAtT(){return null}isDifferentiable(){return!1}scale(t,e,n){return this.end.scale(t,e,n),this}rotate(t,e){return this.end.rotate(t,e),this}translate(t,e){return"number"===typeof t?this.end.translate(t,e):this.end.translate(t),this}clone(){return new Ub(this.end)}equals(t){return this.type===t.type&&this.end.equals(t.end)}toJSON(){return{type:this.type,end:this.end.toJSON()}}serialize(){const t=this.end;return`${this.type} ${t.x} ${t.y}`}}(function(t){function e(...e){const n=e.length,i=e[0];if(kb.isLine(i))return new t(i);if(Fb.isCurve(i))return new t(i);if(Nb.isPointLike(i)){if(1===n)return new t(i);const s=[];for(let i=0;i<n;i+=1)0===i?s.push(new t(e[i])):s.push(new _b(e[i]));return s}if(2===n)return new t(+e[0],+e[1]);const s=[];for(let r=0;r<n;r+=2){const n=+e[r],i=+e[r+1];0===r?s.push(new t(n,i)):s.push(new _b(n,i))}return s}t.create=e})(Ub||(Ub={}));class Jb extends Gb{constructor(t,e,n,i,s,r){super(),Fb.isCurve(t)?(this.controlPoint1=t.controlPoint1.clone().round(2),this.controlPoint2=t.controlPoint2.clone().round(2),this.endPoint=t.end.clone().round(2)):"number"===typeof t?(this.controlPoint1=new Nb(t,e).round(2),this.controlPoint2=new Nb(n,i).round(2),this.endPoint=new Nb(s,r).round(2)):(this.controlPoint1=Nb.create(t).round(2),this.controlPoint2=Nb.create(e).round(2),this.endPoint=Nb.create(n).round(2))}get type(){return"C"}get curve(){return new Fb(this.start,this.controlPoint1,this.controlPoint2,this.end)}bbox(){return this.curve.bbox()}closestPoint(t){return this.curve.closestPoint(t)}closestPointLength(t){return this.curve.closestPointLength(t)}closestPointNormalizedLength(t){return this.curve.closestPointNormalizedLength(t)}closestPointTangent(t){return this.curve.closestPointTangent(t)}length(){return this.curve.length()}divideAt(t,e={}){const n=this.curve.divideAt(t,e);return[new Jb(n[0]),new Jb(n[1])]}divideAtLength(t,e={}){const n=this.curve.divideAtLength(t,e);return[new Jb(n[0]),new Jb(n[1])]}divideAtT(t){const e=this.curve.divideAtT(t);return[new Jb(e[0]),new Jb(e[1])]}getSubdivisions(){return[]}pointAt(t){return this.curve.pointAt(t)}pointAtLength(t){return this.curve.pointAtLength(t)}tangentAt(t){return this.curve.tangentAt(t)}tangentAtLength(t){return this.curve.tangentAtLength(t)}isDifferentiable(){if(!this.previousSegment)return!1;const t=this.start,e=this.controlPoint1,n=this.controlPoint2,i=this.end;return!(t.equals(e)&&e.equals(n)&&n.equals(i))}scale(t,e,n){return this.controlPoint1.scale(t,e,n),this.controlPoint2.scale(t,e,n),this.end.scale(t,e,n),this}rotate(t,e){return this.controlPoint1.rotate(t,e),this.controlPoint2.rotate(t,e),this.end.rotate(t,e),this}translate(t,e){return"number"===typeof t?(this.controlPoint1.translate(t,e),this.controlPoint2.translate(t,e),this.end.translate(t,e)):(this.controlPoint1.translate(t),this.controlPoint2.translate(t),this.end.translate(t)),this}equals(t){return this.start.equals(t.start)&&this.end.equals(t.end)&&this.controlPoint1.equals(t.controlPoint1)&&this.controlPoint2.equals(t.controlPoint2)}clone(){return new Jb(this.controlPoint1,this.controlPoint2,this.end)}toJSON(){return{type:this.type,start:this.start.toJSON(),controlPoint1:this.controlPoint1.toJSON(),controlPoint2:this.controlPoint2.toJSON(),end:this.end.toJSON()}}serialize(){const t=this.controlPoint1,e=this.controlPoint2,n=this.end;return[this.type,t.x,t.y,e.x,e.y,n.x,n.y].join(" ")}}function qb(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function Wb(t,e,n,i,s,r){const o=1/3,a=2/3;return[o*t+a*n,o*e+a*i,o*s+a*n,o*r+a*i,s,r]}function Xb(t,e,n,i,s,r,o,a,l,c){const h=120*Math.PI/180,u=Math.PI/180*(+s||0);let d,g,p,f,m,y=[];if(c)g=c[0],p=c[1],f=c[2],m=c[3];else{d=qb(t,e,-u),t=d.x,e=d.y,d=qb(a,l,-u),a=d.x,l=d.y;const s=(t-a)/2,c=(e-l)/2;let h=s*s/(n*n)+c*c/(i*i);h>1&&(h=Math.sqrt(h),n*=h,i*=h);const y=n*n,b=i*i,v=(r===o?-1:1)*Math.sqrt(Math.abs((y*b-y*c*c-b*s*s)/(y*c*c+b*s*s)));f=v*n*c/i+(t+a)/2,m=v*-i*s/n+(e+l)/2,g=Math.asin((e-m)/i),p=Math.asin((l-m)/i),g=t<f?Math.PI-g:g,p=a<f?Math.PI-p:p,g<0&&(g=2*Math.PI+g),p<0&&(p=2*Math.PI+p),o&&g>p&&(g-=2*Math.PI),!o&&p>g&&(p-=2*Math.PI)}let b=p-g;if(Math.abs(b)>h){const t=p,e=a,r=l;p=g+h*(o&&p>g?1:-1),a=f+n*Math.cos(p),l=m+i*Math.sin(p),y=Xb(a,l,n,i,s,0,o,e,r,[p,t,f,m])}b=p-g;const v=Math.cos(g),x=Math.sin(g),w=Math.cos(p),C=Math.sin(p),P=Math.tan(b/4),E=4/3*(n*P),M=4/3*(i*P),O=[t,e],A=[t+E*x,e-M*v],S=[a+E*C,l-M*w],N=[a,l];if(A[0]=2*O[0]-A[0],A[1]=2*O[1]-A[1],c)return[A,S,N].concat(y);{y=[A,S,N].concat(y).join().split(",");const t=[],e=y.length;for(let n=0;n<e;n+=1)t[n]=n%2?qb(+y[n-1],+y[n],u).y:qb(+y[n],+y[n+1],u).x;return t}}function Yb(t){if(!t)return null;const e="\t\n\v\f\r   ᠎              \u2028\u2029",n=new RegExp(`([a-z])[${e},]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[${e}]*,?[${e}]*)+)`,"ig"),i=new RegExp(`(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[${e}]*,?[${e}]*`,"ig"),s={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=[];return t.replace(n,(t,e,n)=>{const o=[];let a=e.toLowerCase();n.replace(i,(t,e)=>(e&&o.push(+e),t)),"m"===a&&o.length>2&&(r.push([e,...o.splice(0,2)]),a="l",e="m"===e?"l":"L");const l=s[a];while(o.length>=l)if(r.push([e,...o.splice(0,l)]),!l)break;return t}),r}function Zb(t){const e=Yb(t);if(!e||!e.length)return[["M",0,0]];let n=0,i=0,s=0,r=0;const o=[];for(let a=0,l=e.length;a<l;a+=1){const t=[];o.push(t);const l=e[a],c=l[0];if(c!==c.toUpperCase())switch(t[0]=c.toUpperCase(),t[0]){case"A":t[1]=l[1],t[2]=l[2],t[3]=l[3],t[4]=l[4],t[5]=l[5],t[6]=+l[6]+n,t[7]=+l[7]+i;break;case"V":t[1]=+l[1]+i;break;case"H":t[1]=+l[1]+n;break;case"M":s=+l[1]+n,r=+l[2]+i;for(let e=1,s=l.length;e<s;e+=1)t[e]=+l[e]+(e%2?n:i);break;default:for(let e=1,s=l.length;e<s;e+=1)t[e]=+l[e]+(e%2?n:i);break}else for(let e=0,n=l.length;e<n;e+=1)t[e]=l[e];switch(t[0]){case"Z":n=+s,i=+r;break;case"H":n=t[1];break;case"V":i=t[1];break;case"M":s=t[t.length-2],r=t[t.length-1],n=t[t.length-2],i=t[t.length-1];break;default:n=t[t.length-2],i=t[t.length-1];break}}return o}function Kb(t){const e=Zb(t),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};function i(t,e,n){let i,s;if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(t[0]in{T:1,Q:1}||(e.qx=null,e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":return 0===parseFloat(t[1])||0===parseFloat(t[2])?["L",t[6],t[7]]:["C"].concat(Xb.apply(0,[e.x,e.y].concat(t.slice(1))));case"S":return"C"===n||"S"===n?(i=2*e.x-e.bx,s=2*e.y-e.by):(i=e.x,s=e.y),["C",i,s].concat(t.slice(1));case"T":return"Q"===n||"T"===n?(e.qx=2*e.x-e.qx,e.qy=2*e.y-e.qy):(e.qx=e.x,e.qy=e.y),["C"].concat(Wb(e.x,e.y,e.qx,e.qy,t[1],t[2]));case"Q":return e.qx=t[1],e.qy=t[2],["C"].concat(Wb(e.x,e.y,t[1],t[2],t[3],t[4]));case"H":return["L"].concat(t[1],e.y);case"V":return["L"].concat(e.x,t[1]);case"L":break;case"Z":break;default:break}return t}function s(t,n){if(t[n].length>7){t[n].shift();const i=t[n];while(i.length)r[n]="A",n+=1,t.splice(n,0,["C"].concat(i.splice(0,6)));t.splice(n,1),a=e.length}}const r=[];let o="",a=e.length;for(let l=0;l<a;l+=1){let t="";e[l]&&(t=e[l][0]),"C"!==t&&(r[l]=t,l>0&&(o=r[l-1])),e[l]=i(e[l],n,o),"A"!==r[l]&&"C"===t&&(r[l]="C"),s(e,l);const a=e[l],c=a.length;n.x=a[c-2],n.y=a[c-1],n.bx=parseFloat(a[c-4])||n.x,n.by=parseFloat(a[c-3])||n.y}return e[0][0]&&"M"===e[0][0]||e.unshift(["M",0,0]),e}function Qb(t){return Kb(t).map(t=>t.map(t=>"string"===typeof t?t:Ab.round(t,2))).join(",").split(",").join(" ")}(function(t){function e(...e){const n=e.length,i=e[0];if(Fb.isCurve(i))return new t(i);if(Nb.isPointLike(i)){if(3===n)return new t(e[0],e[1],e[2]);const i=[];for(let s=0;s<n;s+=3)i.push(new t(e[s],e[s+1],e[s+2]));return i}if(6===n)return new t(e[0],e[1],e[2],e[3],e[4],e[5]);const s=[];for(let r=0;r<n;r+=6)s.push(new t(e[r],e[r+1],e[r+2],e[r+3],e[r+4],e[r+5]));return s}t.create=e})(Jb||(Jb={}));class tv extends Sb{constructor(t){if(super(),this.PRECISION=3,this.segments=[],Array.isArray(t))if(kb.isLine(t[0])||Fb.isCurve(t[0])){let e=null;const n=t;n.forEach((t,n)=>{0===n&&this.appendSegment(tv.createSegment("M",t.start)),null==e||e.end.equals(t.start)||this.appendSegment(tv.createSegment("M",t.start)),kb.isLine(t)?this.appendSegment(tv.createSegment("L",t.end)):Fb.isCurve(t)&&this.appendSegment(tv.createSegment("C",t.controlPoint1,t.controlPoint2,t.end)),e=t})}else{const e=t;e.forEach(t=>{t.isSegment&&this.appendSegment(t)})}else null!=t&&(kb.isLine(t)?(this.appendSegment(tv.createSegment("M",t.start)),this.appendSegment(tv.createSegment("L",t.end))):Fb.isCurve(t)?(this.appendSegment(tv.createSegment("M",t.start)),this.appendSegment(tv.createSegment("C",t.controlPoint1,t.controlPoint2,t.end))):$b.isPolyline(t)?t.points&&t.points.length&&t.points.forEach((t,e)=>{const n=0===e?tv.createSegment("M",t):tv.createSegment("L",t);this.appendSegment(n)}):t.isSegment&&this.appendSegment(t))}get start(){const t=this.segments,e=t.length;if(0===e)return null;for(let n=0;n<e;n+=1){const e=t[n];if(e.isVisible)return e.start}return t[e-1].end}get end(){const t=this.segments,e=t.length;if(0===e)return null;for(let n=e-1;n>=0;n-=1){const e=t[n];if(e.isVisible)return e.end}return t[e-1].end}moveTo(...t){return this.appendSegment(Ub.create.call(null,...t))}lineTo(...t){return this.appendSegment(_b.create.call(null,...t))}curveTo(...t){return this.appendSegment(Jb.create.call(null,...t))}arcTo(t,e,n,i,s,r,o){const a=this.end||new Nb,l="number"===typeof r?Vb(a.x,a.y,t,e,n,i,s,r,o):Vb(a.x,a.y,t,e,n,i,s,r.x,r.y);if(null!=l)for(let c=0,h=l.length;c<h;c+=6)this.curveTo(l[c],l[c+1],l[c+2],l[c+3],l[c+4],l[c+5]);return this}quadTo(t,e,n,i){const s=this.end||new Nb,r=["M",s.x,s.y];if("number"===typeof t)r.push("Q",t,e,n,i);else{const n=e;r.push("Q",t.x,t.y,n.x,n.y)}const o=tv.parse(r.join(" "));return this.appendSegment(o.segments.slice(1)),this}close(){return this.appendSegment(Hb.create())}drawPoints(t,e={}){const n=Rb(t,e),i=tv.parse(n);i&&i.segments&&this.appendSegment(i.segments)}bbox(){const t=this.segments,e=t.length;if(0===e)return null;let n;for(let s=0;s<e;s+=1){const e=t[s];if(e.isVisible){const t=e.bbox();null!=t&&(n=n?n.union(t):t)}}if(null!=n)return n;const i=t[e-1];return new Tb(i.end.x,i.end.y,0,0)}appendSegment(t){const e=this.segments.length;let n,i=0!==e?this.segments[e-1]:null;const s=null;if(Array.isArray(t))for(let r=0,o=t.length;r<o;r+=1){const e=t[r];n=this.prepareSegment(e,i,s),this.segments.push(n),i=n}else null!=t&&t.isSegment&&(n=this.prepareSegment(t,i,s),this.segments.push(n));return this}insertSegment(t,e){const n=this.segments.length;if(t<0&&(t=n+t+1),t>n||t<0)throw new Error("Index out of range.");let i,s=null,r=null;if(0!==n&&(t>=1?(s=this.segments[t-1],r=s.nextSegment):(s=null,r=this.segments[0])),Array.isArray(e))for(let o=0,a=e.length;o<a;o+=1){const n=e[o];i=this.prepareSegment(n,s,r),this.segments.splice(t+o,0,i),s=i}else i=this.prepareSegment(e,s,r),this.segments.splice(t,0,i);return this}removeSegment(t){const e=this.fixIndex(t),n=this.segments.splice(e,1)[0],i=n.previousSegment,s=n.nextSegment;return i&&(i.nextSegment=s),s&&(s.previousSegment=i),n.isSubpathStart&&s&&this.updateSubpathStartSegment(s),n}replaceSegment(t,e){const n=this.fixIndex(t);let i;const s=this.segments[n];let r=s.previousSegment;const o=s.nextSegment;let a=s.isSubpathStart;if(Array.isArray(e)){this.segments.splice(t,1);for(let n=0,s=e.length;n<s;n+=1){const s=e[n];i=this.prepareSegment(s,r,o),this.segments.splice(t+n,0,i),r=i,a&&i.isSubpathStart&&(a=!1)}}else i=this.prepareSegment(e,r,o),this.segments.splice(n,1,i),a&&i.isSubpathStart&&(a=!1);a&&o&&this.updateSubpathStartSegment(o)}getSegment(t){const e=this.fixIndex(t);return this.segments[e]}fixIndex(t){const e=this.segments.length;if(0===e)throw new Error("Path has no segments.");let n=t;while(n<0)n=e+n;if(n>=e||n<0)throw new Error("Index out of range.");return n}segmentAt(t,e={}){const n=this.segmentIndexAt(t,e);return n?this.getSegment(n):null}segmentAtLength(t,e={}){const n=this.segmentIndexAtLength(t,e);return n?this.getSegment(n):null}segmentIndexAt(t,e={}){if(0===this.segments.length)return null;const n=Ab.clamp(t,0,1),i=this.getOptions(e),s=this.length(i),r=s*n;return this.segmentIndexAtLength(r,i)}segmentIndexAtLength(t,e={}){const n=this.segments.length;if(0===n)return null;let i=!0;t<0&&(i=!1,t=-t);const s=this.getPrecision(e),r=this.getSubdivisions(e);let o=0,a=null;for(let l=0;l<n;l+=1){const e=i?l:n-1-l,c=this.segments[e],h=r[e],u=c.length({precision:s,subdivisions:h});if(c.isVisible){if(t<=o+u)return e;a=e}o+=u}return a}getSegmentSubdivisions(t={}){const e=this.getPrecision(t),n=[];for(let i=0,s=this.segments.length;i<s;i+=1){const t=this.segments[i],s=t.getSubdivisions({precision:e});n.push(s)}return n}updateSubpathStartSegment(t){let e=t.previousSegment,n=t;while(n&&!n.isSubpathStart)n.subpathStartSegment=null!=e?e.subpathStartSegment:null,e=n,n=n.nextSegment}prepareSegment(t,e,n){t.previousSegment=e,t.nextSegment=n,null!=e&&(e.nextSegment=t),null!=n&&(n.previousSegment=t);let i=t;return t.isSubpathStart&&(t.subpathStartSegment=t,i=n),null!=i&&this.updateSubpathStartSegment(i),t}closestPoint(t,e={}){const n=this.closestPointT(t,e);return n?this.pointAtT(n):null}closestPointLength(t,e={}){const n=this.getOptions(e),i=this.closestPointT(t,n);return i?this.lengthAtT(i,n):0}closestPointNormalizedLength(t,e={}){const n=this.getOptions(e),i=this.closestPointLength(t,n);if(0===i)return 0;const s=this.length(n);return 0===s?0:i/s}closestPointT(t,e={}){if(0===this.segments.length)return null;const n=this.getPrecision(e),i=this.getSubdivisions(e);let s,r=1/0;for(let o=0,a=this.segments.length;o<a;o+=1){const e=this.segments[o],a=i[o];if(e.isVisible){const i=e.closestPointT(t,{precision:n,subdivisions:a}),l=e.pointAtT(i),c=Ab.squaredLength(l,t);c<r&&(s={segmentIndex:o,value:i},r=c)}}return s||{segmentIndex:this.segments.length-1,value:1}}closestPointTangent(t,e={}){if(0===this.segments.length)return null;const n=this.getPrecision(e),i=this.getSubdivisions(e);let s,r=1/0;for(let o=0,a=this.segments.length;o<a;o+=1){const e=this.segments[o],a=i[o];if(e.isDifferentiable()){const i=e.closestPointT(t,{precision:n,subdivisions:a}),o=e.pointAtT(i),l=Ab.squaredLength(o,t);l<r&&(s=e.tangentAtT(i),r=l)}}return s||null}containsPoint(t,e={}){const n=this.toPolylines(e);if(!n)return!1;let i=0;for(let s=0,r=n.length;s<r;s+=1){const e=n[s];e.containsPoint(t)&&(i+=1)}return i%2===1}pointAt(t,e={}){if(0===this.segments.length)return null;if(t<=0)return this.start.clone();if(t>=1)return this.end.clone();const n=this.getOptions(e),i=this.length(n),s=i*t;return this.pointAtLength(s,n)}pointAtLength(t,e={}){if(0===this.segments.length)return null;if(0===t)return this.start.clone();let n=!0;t<0&&(n=!1,t=-t);const i=this.getPrecision(e),s=this.getSubdivisions(e);let r,o=0;for(let l=0,c=this.segments.length;l<c;l+=1){const e=n?l:c-1-l,a=this.segments[e],h=s[e],u=a.length({precision:i,subdivisions:h});if(a.isVisible){if(t<=o+u)return a.pointAtLength((n?1:-1)*(t-o),{precision:i,subdivisions:h});r=a}o+=u}if(r)return n?r.end:r.start;const a=this.segments[this.segments.length-1];return a.end.clone()}pointAtT(t){const e=this.segments,n=e.length;if(0===n)return null;const i=t.segmentIndex;if(i<0)return e[0].pointAtT(0);if(i>=n)return e[n-1].pointAtT(1);const s=Ab.clamp(t.value,0,1);return e[i].pointAtT(s)}divideAt(t,e={}){if(0===this.segments.length)return null;const n=Ab.clamp(t,0,1),i=this.getOptions(e),s=this.length(i),r=s*n;return this.divideAtLength(r,i)}divideAtLength(t,e={}){if(0===this.segments.length)return null;let n=!0;t<0&&(n=!1,t=-t);const i=this.getPrecision(e),s=this.getSubdivisions(e);let r,o,a,l,c,h=0;for(let x=0,w=this.segments.length;x<w;x+=1){const e=n?x:w-1-x,c=this.getSegment(e),u=s[e],d={precision:i,subdivisions:u},g=c.length(d);if(c.isDifferentiable()&&(a=c,l=e,t<=h+g)){o=e,r=c.divideAtLength((n?1:-1)*(t-h),d);break}h+=g}if(!a)return null;r||(o=l,c=n?1:0,r=a.divideAtT(c));const u=this.clone(),d=o;u.replaceSegment(d,r);const g=d;let p=d+1,f=d+2;r[0].isDifferentiable()||(u.removeSegment(g),p-=1,f-=1);const m=u.getSegment(p).start;u.insertSegment(p,tv.createSegment("M",m)),f+=1,r[1].isDifferentiable()||(u.removeSegment(f-1),f-=1);const y=f-g-1;for(let x=f,w=u.segments.length;x<w;x+=1){const t=this.getSegment(x-y),e=u.getSegment(x);if("Z"===e.type&&!t.subpathStartSegment.end.equals(e.subpathStartSegment.end)){const e=tv.createSegment("L",t.end);u.replaceSegment(x,e)}}const b=new tv(u.segments.slice(0,p)),v=new tv(u.segments.slice(p));return[b,v]}intersectsWithLine(t,e={}){const n=this.toPolylines(e);if(null==n)return null;let i=null;for(let s=0,r=n.length;s<r;s+=1){const e=n[s],r=t.intersect(e);r&&(null==i&&(i=[]),Array.isArray(r)?i.push(...r):i.push(r))}return i}isDifferentiable(){for(let t=0,e=this.segments.length;t<e;t+=1){const e=this.segments[t];if(e.isDifferentiable())return!0}return!1}isValid(){const t=this.segments,e=0===t.length||"M"===t[0].type;return e}length(t={}){if(0===this.segments.length)return 0;const e=this.getSubdivisions(t);let n=0;for(let i=0,s=this.segments.length;i<s;i+=1){const t=this.segments[i],s=e[i];n+=t.length({subdivisions:s})}return n}lengthAtT(t,e={}){const n=this.segments.length;if(0===n)return 0;let i=t.segmentIndex;if(i<0)return 0;let s=Ab.clamp(t.value,0,1);i>=n&&(i=n-1,s=1);const r=this.getPrecision(e),o=this.getSubdivisions(e);let a=0;for(let h=0;h<i;h+=1){const t=this.segments[h],e=o[h];a+=t.length({precision:r,subdivisions:e})}const l=this.segments[i],c=o[i];return a+=l.lengthAtT(s,{precision:r,subdivisions:c}),a}tangentAt(t,e={}){if(0===this.segments.length)return null;const n=Ab.clamp(t,0,1),i=this.getOptions(e),s=this.length(i),r=s*n;return this.tangentAtLength(r,i)}tangentAtLength(t,e={}){if(0===this.segments.length)return null;let n=!0;t<0&&(n=!1,t=-t);const i=this.getPrecision(e),s=this.getSubdivisions(e);let r,o=0;for(let a=0,l=this.segments.length;a<l;a+=1){const e=n?a:l-1-a,c=this.segments[e],h=s[e],u=c.length({precision:i,subdivisions:h});if(c.isDifferentiable()){if(t<=o+u)return c.tangentAtLength((n?1:-1)*(t-o),{precision:i,subdivisions:h});r=c}o+=u}if(r){const t=n?1:0;return r.tangentAtT(t)}return null}tangentAtT(t){const e=this.segments.length;if(0===e)return null;const n=t.segmentIndex;if(n<0)return this.segments[0].tangentAtT(0);if(n>=e)return this.segments[e-1].tangentAtT(1);const i=Ab.clamp(t.value,0,1);return this.segments[n].tangentAtT(i)}getPrecision(t={}){return null==t.precision?this.PRECISION:t.precision}getSubdivisions(t={}){if(null==t.segmentSubdivisions){const e=this.getPrecision(t);return this.getSegmentSubdivisions({precision:e})}return t.segmentSubdivisions}getOptions(t={}){const e=this.getPrecision(t),n=this.getSubdivisions(t);return{precision:e,segmentSubdivisions:n}}toPoints(t={}){const e=this.segments,n=e.length;if(0===n)return null;const i=this.getSubdivisions(t),s=[];let r=[];for(let o=0;o<n;o+=1){const t=e[o];if(t.isVisible){const e=i[o];e.length>0?e.forEach(t=>r.push(t.start)):r.push(t.start)}else r.length>0&&(r.push(e[o-1].end),s.push(r),r=[])}return r.length>0&&(r.push(this.end),s.push(r)),s}toPolylines(t={}){const e=this.toPoints(t);return e?e.map(t=>new $b(t)):null}scale(t,e,n){return this.segments.forEach(i=>i.scale(t,e,n)),this}rotate(t,e){return this.segments.forEach(n=>n.rotate(t,e)),this}translate(t,e){return"number"===typeof t?this.segments.forEach(n=>n.translate(t,e)):this.segments.forEach(e=>e.translate(t)),this}clone(){const t=new tv;return this.segments.forEach(e=>t.appendSegment(e.clone())),t}equals(t){if(null==t)return!1;const e=this.segments,n=t.segments,i=e.length;if(n.length!==i)return!1;for(let s=0;s<i;s+=1){const t=e[s],i=n[s];if(t.type!==i.type||!t.equals(i))return!1}return!0}toJSON(){return this.segments.map(t=>t.toJSON())}serialize(){if(!this.isValid())throw new Error("Invalid path segments.");return this.segments.map(t=>t.serialize()).join(" ")}toString(){return this.serialize()}}(function(t){function e(e){return null!=e&&e instanceof t}t.isPath=e})(tv||(tv={})),function(t){function e(e){if(!e)return new t;const i=new t,s=/(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g,r=t.normalize(e).match(s);if(null!=r)for(let t=0,o=r.length;t<o;t+=1){const e=r[t],s=/(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g,o=e.match(s);if(null!=o){const t=o[0],e=o.slice(1).map(t=>+t),s=n.call(null,t,...e);i.appendSegment(s)}}return i}function n(t,...e){if("M"===t)return Ub.create.call(null,...e);if("L"===t)return _b.create.call(null,...e);if("C"===t)return Jb.create.call(null,...e);if("z"===t||"Z"===t)return Hb.create();throw new Error(`Invalid path segment type "${t}"`)}t.parse=e,t.createSegment=n}(tv||(tv={})),function(t){t.normalize=Qb,t.isValid=Db,t.drawArc=zb,t.drawPoints=Rb,t.arcToCurves=Vb}(tv||(tv={}));class ev{constructor(t){this.options=Object.assign({},t),this.data=this.options.data||{},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this)}get names(){return Object.keys(this.data)}register(t,e,n=!1){if("object"===typeof t)return void Object.entries(t).forEach(([t,n])=>{this.register(t,n,e)});!this.exist(t)||n||Vf.isApplyingHMR()||this.onDuplicated(t);const i=this.options.process,s=i?Pt(i,this,t,e):e;return this.data[t]=s,s}unregister(t){const e=t?this.data[t]:null;return delete this.data[t],e}get(t){return t?this.data[t]:null}exist(t){return!!t&&null!=this.data[t]}onDuplicated(t){try{throw this.options.onConflict&&Pt(this.options.onConflict,this,t),new Error(`${Up(this.options.type)} with name '${t}' already registered.`)}catch(LM){throw LM}}onNotFound(t,e){throw new Error(this.getSpellingSuggestion(t,e))}getSpellingSuggestion(t,e){const n=this.getSpellingSuggestionForName(t),i=e?`${e} ${sf(this.options.type)}`:this.options.type;return`${Up(i)} with name '${t}' does not exist.${n?` Did you mean '${n}'?`:""}`}getSpellingSuggestionForName(t){return hf(t,Object.keys(this.data),t=>t)}}(function(t){function e(e){return new t(e)}t.create=e})(ev||(ev={}));const nv={color:"#aaaaaa",thickness:1,markup:"rect",update(t,e){const n=e.thickness*e.sx,i=e.thickness*e.sy;Mm(t,{width:n,height:i,rx:n,ry:i,fill:e.color})}},iv={color:"#aaaaaa",thickness:1,markup:"rect",update(t,e){const n=e.sx<=1?e.thickness*e.sx:e.thickness;Mm(t,{width:n,height:n,rx:n,ry:n,fill:e.color})}},sv={color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(t,e){let n;const i=e.width,s=e.height,r=e.thickness;n=i-r>=0&&s-r>=0?["M",i,0,"H0 M0 0 V0",s].join(" "):"M 0 0 0 0",Mm(t,{d:n,stroke:e.color,"stroke-width":e.thickness})}},rv=[{color:"rgba(224,224,224,1)",thickness:1,markup:"path",update(t,e){let n;const i=e.width,s=e.height,r=e.thickness;n=i-r>=0&&s-r>=0?["M",i,0,"H0 M0 0 V0",s].join(" "):"M 0 0 0 0",Mm(t,{d:n,stroke:e.color,"stroke-width":e.thickness})}},{color:"rgba(224,224,224,0.2)",thickness:3,factor:4,markup:"path",update(t,e){let n;const i=e.factor||1,s=e.width*i,r=e.height*i,o=e.thickness;n=s-o>=0&&r-o>=0?["M",s,0,"H0 M0 0 V0",r].join(" "):"M 0 0 0 0",e.width=s,e.height=r,Mm(t,{d:n,stroke:e.color,"stroke-width":e.thickness})}}];class ov{constructor(){this.patterns={},this.root=ry.create(nm(),{width:"100%",height:"100%"},[em("defs")]).node}add(t,e){const n=this.root.childNodes[0];n&&n.appendChild(e),this.patterns[t]=e,ry.create("rect",{width:"100%",height:"100%",fill:`url(#${t})`}).appendTo(this.root)}get(t){return this.patterns[t]}has(t){return null!=this.patterns[t]}}(function(t){t.presets=a,t.registry=ev.create({type:"grid"}),t.registry.register(t.presets,!0)})(ov||(ov={}));const av=function(t){const e=document.createElement("canvas"),n=t.width,i=t.height;e.width=2*n,e.height=i;const s=e.getContext("2d");return s.drawImage(t,0,0,n,i),s.translate(2*n,0),s.scale(-1,1),s.drawImage(t,0,0,n,i),e},lv=function(t){const e=document.createElement("canvas"),n=t.width,i=t.height;e.width=n,e.height=2*i;const s=e.getContext("2d");return s.drawImage(t,0,0,n,i),s.translate(0,2*i),s.scale(1,-1),s.drawImage(t,0,0,n,i),e},cv=function(t){const e=document.createElement("canvas"),n=t.width,i=t.height;e.width=2*n,e.height=2*i;const s=e.getContext("2d");return s.drawImage(t,0,0,n,i),s.setTransform(-1,0,0,-1,e.width,e.height),s.drawImage(t,0,0,n,i),s.setTransform(-1,0,0,1,e.width,0),s.drawImage(t,0,0,n,i),s.setTransform(1,0,0,-1,0,e.height),s.drawImage(t,0,0,n,i),e},hv=function(t,e){const n=t.width,i=t.height,s=document.createElement("canvas");s.width=3*n,s.height=3*i;const r=s.getContext("2d"),o=null!=e.angle?-e.angle:-20,a=Ob.toRad(o),l=s.width/4,c=s.height/4;for(let h=0;h<4;h+=1)for(let e=0;e<4;e+=1)(h+e)%2>0&&(r.setTransform(1,0,0,1,(2*h-1)*l,(2*e-1)*c),r.rotate(a),r.drawImage(t,-n/2,-i/2,n,i));return s};var uv,dv;function gv(t,e){return null!=t?t:e}function pv(t,e){return null!=t&&Number.isFinite(t)?t:e}function fv(t={}){const e=gv(t.color,"blue"),n=pv(t.width,1),i=pv(t.margin,2),s=pv(t.opacity,1),r=i,o=i+n;return`\n <filter>\n <feFlood flood-color="${e}" flood-opacity="${s}" result="colored"/>\n <feMorphology in="SourceAlpha" result="morphedOuter" operator="dilate" radius="${o}" />\n <feMorphology in="SourceAlpha" result="morphedInner" operator="dilate" radius="${r}" />\n <feComposite result="morphedOuterColored" in="colored" in2="morphedOuter" operator="in"/>\n <feComposite operator="xor" in="morphedOuterColored" in2="morphedInner" result="outline"/>\n <feMerge>\n <feMergeNode in="outline"/>\n <feMergeNode in="SourceGraphic"/>\n </feMerge>\n </filter>\n `.trim()}function mv(t={}){const e=gv(t.color,"red"),n=pv(t.blur,0),i=pv(t.width,1),s=pv(t.opacity,1);return`\n <filter>\n <feFlood flood-color="${e}" flood-opacity="${s}" result="colored"/>\n <feMorphology result="morphed" in="SourceGraphic" operator="dilate" radius="${i}"/>\n <feComposite result="composed" in="colored" in2="morphed" operator="in"/>\n <feGaussianBlur result="blured" in="composed" stdDeviation="${n}"/>\n <feBlend in="SourceGraphic" in2="blured" mode="normal"/>\n </filter>\n `.trim()}function yv(t={}){const e=pv(t.x,2),n=null!=t.y&&Number.isFinite(t.y)?[e,t.y]:e;return`\n <filter>\n <feGaussianBlur stdDeviation="${n}"/>\n </filter>\n `.trim()}function bv(t={}){const e=pv(t.dx,0),n=pv(t.dy,0),i=gv(t.color,"black"),s=pv(t.blur,4),r=pv(t.opacity,1);return"SVGFEDropShadowElement"in window?`<filter>\n <feDropShadow stdDeviation="${s}" dx="${e}" dy="${n}" flood-color="${i}" flood-opacity="${r}" />\n </filter>`.trim():`<filter>\n <feGaussianBlur in="SourceAlpha" stdDeviation="${s}" />\n <feOffset dx="${e}" dy="${n}" result="offsetblur" />\n <feFlood flood-color="${i}" />\n <feComposite in2="offsetblur" operator="in" />\n <feComponentTransfer>\n <feFuncA type="linear" slope="${r}" />\n </feComponentTransfer>\n <feMerge>\n <feMergeNode/>\n <feMergeNode in="SourceGraphic"/>\n </feMerge>\n </filter>`.trim()}function vv(t={}){const e=pv(t.amount,1),n=.2126+.7874*(1-e),i=.7152-.7152*(1-e),s=.0722-.0722*(1-e),r=.2126-.2126*(1-e),o=.7152+.2848*(1-e),a=.0722-.0722*(1-e),l=.2126-.2126*(1-e),c=.0722+.9278*(1-e);return`\n <filter>\n <feColorMatrix type="matrix" values="${n} ${i} ${s} 0 0 ${r} ${o} ${a} 0 0 ${l} ${i} ${c} 0 0 0 0 0 1 0"/>\n </filter>\n `.trim()}function xv(t={}){const e=pv(t.amount,1),n=.393+.607*(1-e),i=.769-.769*(1-e),s=.189-.189*(1-e),r=.349-.349*(1-e),o=.686+.314*(1-e),a=.168-.168*(1-e),l=.272-.272*(1-e),c=.534-.534*(1-e),h=.131+.869*(1-e);return`\n <filter>\n <feColorMatrix type="matrix" values="${n} ${i} ${s} 0 0 ${r} ${o} ${a} 0 0 ${l} ${c} ${h} 0 0 0 0 0 1 0"/>\n </filter>\n `.trim()}function wv(t={}){const e=pv(t.amount,1);return`\n <filter>\n <feColorMatrix type="saturate" values="${1-e}"/>\n </filter>\n `.trim()}function Cv(t={}){const e=pv(t.angle,0);return`\n <filter>\n <feColorMatrix type="hueRotate" values="${e}"/>\n </filter>\n `.trim()}function Pv(t={}){const e=pv(t.amount,1),n=1-e;return`\n <filter>\n <feComponentTransfer>\n <feFuncR type="table" tableValues="${e} ${n}"/>\n <feFuncG type="table" tableValues="${e} ${n}"/>\n <feFuncB type="table" tableValues="${e} ${n}"/>\n </feComponentTransfer>\n </filter>\n `.trim()}function Ev(t={}){const e=pv(t.amount,1);return`\n <filter>\n <feComponentTransfer>\n <feFuncR type="linear" slope="${e}"/>\n <feFuncG type="linear" slope="${e}"/>\n <feFuncB type="linear" slope="${e}"/>\n </feComponentTransfer>\n </filter>\n `.trim()}function Mv(t={}){const e=pv(t.amount,1),n=.5-e/2;return`\n <filter>\n <feComponentTransfer>\n <feFuncR type="linear" slope="${e}" intercept="${n}"/>\n <feFuncG type="linear" slope="${e}" intercept="${n}"/>\n <feFuncB type="linear" slope="${e}" intercept="${n}"/>\n </feComponentTransfer>\n </filter>\n `.trim()}(function(t){t.presets=Object.assign({},l),t.presets["flip-x"]=av,t.presets["flip-y"]=lv,t.presets["flip-xy"]=cv,t.registry=ev.create({type:"background pattern"}),t.registry.register(t.presets,!0)})(uv||(uv={})),function(t){t.presets=c,t.registry=ev.create({type:"filter"}),t.registry.register(t.presets,!0)}(dv||(dv={}));const Ov={xlinkHref:"xlink:href",xlinkShow:"xlink:show",xlinkRole:"xlink:role",xlinkType:"xlink:type",xlinkArcrole:"xlink:arcrole",xlinkTitle:"xlink:title",xlinkActuate:"xlink:actuate",xmlSpace:"xml:space",xmlBase:"xml:base",xmlLang:"xml:lang",preserveAspectRatio:"preserveAspectRatio",requiredExtension:"requiredExtension",requiredFeatures:"requiredFeatures",systemLanguage:"systemLanguage",externalResourcesRequired:"externalResourceRequired"},Av={},Sv={position:Zv("x","width","origin")},Nv={position:Zv("y","height","origin")},Tv={position:Zv("x","width","corner")},kv={position:Zv("y","height","corner")},jv={set:Kv("width","width")},Lv={set:Kv("height","height")},Dv={set:Kv("rx","width")},Bv={set:Kv("ry","height")},Iv={set:(t=>{const e=Kv(t,"width"),n=Kv(t,"height");return function(t,i){const s=i.refBBox,r=s.height>s.width?e:n;return Pt(r,this,t,i)}})("r")},Rv={set(t,{refBBox:e}){let n=parseFloat(t);const i=vf(t);i&&(n/=100);const s=Math.sqrt(e.height*e.height+e.width*e.width);let r;return Number.isFinite(n)&&(r=i||n>=0&&n<=1?n*s:Math.max(n+s,0)),{r:r}}},Vv={set:Kv("cx","width")},zv={set:Kv("cy","height")},$v={set:tx({resetOffset:!0})},Fv={set:tx({resetOffset:!1})},Gv={set:ex({resetOffset:!0})},_v={set:ex({resetOffset:!1})},Hv=Iv,Uv=$v,Jv=Gv,qv=Sv,Wv=Nv,Xv=jv,Yv=Lv;function Zv(t,e,n){return(i,{refBBox:s})=>{if(null==i)return null;let r=parseFloat(i);const o=vf(i);let a;if(o&&(r/=100),Number.isFinite(r)){const i=s[n];a=o||r>0&&r<1?i[t]+s[e]*r:i[t]+r}const l=new Nb;return l[t]=a||0,l}}function Kv(t,e){return function(n,{refBBox:i}){let s=parseFloat(n);const r=vf(n);r&&(s/=100);const o={};if(Number.isFinite(s)){const n=r||s>=0&&s<=1?s*i[e]:Math.max(s+i[e],0);o[t]=n}return o}}function Qv(t,e){const n="x6-shape",i=e&&e.resetOffset;return function(e,{elem:s,refBBox:r}){let o=ny(s,n);if(!o||o.value!==e){const i=t(e);o={value:e,shape:i,shapeBBox:i.bbox()},ny(s,n,o)}const a=o.shape.clone(),l=o.shapeBBox.clone(),c=l.getOrigin(),h=r.getOrigin();l.x=h.x,l.y=h.y;const u=r.getMaxScaleToFit(l,h),d=0===l.width||0===r.width?1:u.sx,g=0===l.height||0===r.height?1:u.sy;return a.scale(d,g,c),i&&a.translate(-c.x,-c.y),a}}function tx(t){function e(t){return tv.parse(t)}const n=Qv(e,t);return(t,e)=>{const i=n(t,e);return{d:i.serialize()}}}function ex(t){const e=Qv(t=>new $b(t),t);return(t,n)=>{const i=e(t,n);return{points:i.serialize()}}}const nx={qualify:fr,set(t,{view:e}){return`url(#${e.graph.defineGradient(t)})`}},ix={qualify:fr,set(t,{view:e}){const n=e.cell,i=Object.assign({},t);if(n.isEdge()&&"linearGradient"===i.type){const t=e,s=t.sourcePoint,r=t.targetPoint;i.id=`gradient-${i.type}-${n.id}`,i.attrs=Object.assign(Object.assign({},i.attrs),{x1:s.x,y1:s.y,x2:r.x,y2:r.y,gradientUnits:"userSpaceOnUse"}),e.graph.defs.remove(i.id)}return`url(#${e.graph.defineGradient(i)})`}},sx={qualify(t,{attrs:e}){return null==e.textWrap||!fr(e.textWrap)},set(t,{view:e,elem:n,attrs:i}){const s="x6-text",r=ny(n,s),o=t=>{try{return JSON.parse(t)}catch(e){return t}},a={x:i.x,eol:i.eol,annotations:o(i.annotations),textPath:o(i["text-path"]||i.textPath),textVerticalAnchor:i["text-vertical-anchor"]||i.textVerticalAnchor,displayEmpty:"true"===(i["display-empty"]||i.displayEmpty),lineHeight:i["line-height"]||i.lineHeight},l=i["font-size"]||i.fontSize,c=JSON.stringify([t,a]);if(l&&n.setAttribute("font-size",l),null==r||r!==c){const i=a.textPath;if(null!=i&&"object"===typeof i){const t=i.selector;if("string"===typeof t){const n=e.find(t)[0];n instanceof SVGPathElement&&(Xf(n),a.textPath=Object.assign({"xlink:href":`#${n.id}`},i))}}uy(n,`${t}`,a),ny(n,s,c)}}},rx={qualify:fr,set(t,{view:e,elem:n,attrs:i,refBBox:s}){const r=t,o=r.width||0;vf(o)?s.width*=parseFloat(o)/100:o<=0?s.width+=o:s.width=o;const a=r.height||0;let l;vf(a)?s.height*=parseFloat(a)/100:a<=0?s.height+=a:s.height=a;let c=r.text;null==c&&(c=i.text||(null===n||void 0===n?void 0:n.textContent)),l=null!=c?py(`${c}`,s,{"font-weight":i["font-weight"]||i.fontWeight,"font-size":i["font-size"]||i.fontSize,"font-family":i["font-family"]||i.fontFamily,lineHeight:i.lineHeight},{ellipsis:r.ellipsis}):"",Pt(sx.set,this,l,{view:e,elem:n,attrs:i,refBBox:s,cell:e.cell})}},ox=(t,{attrs:e})=>void 0!==e.text,ax={qualify:ox},lx={qualify:ox},cx={qualify:ox},hx={qualify:ox},ux={qualify:ox},dx={qualify:ox},gx={qualify(t,{elem:e}){return e instanceof SVGElement},set(t,{elem:e}){const n="x6-title",i=`${t}`,s=ny(e,n);if(null==s||s!==i){ny(e,n,i);const t=e.firstChild;if(t&&"TITLE"===t.tagName.toUpperCase()){const e=t;e.textContent=i}else{const n=document.createElementNS(e.namespaceURI,"title");n.textContent=i,e.insertBefore(n,t)}}}},px={offset:yx("x","width","right")},fx={offset:yx("y","height","bottom")},mx={offset(t,{refBBox:e}){return t?{x:-e.x,y:-e.y}:{x:0,y:0}}};function yx(t,e,n){return(i,{refBBox:s})=>{const r=new Nb;let o;return o="middle"===i?s[e]/2:i===n?s[e]:"number"===typeof i&&Number.isFinite(i)?i>-1&&i<1?-s[e]*i:-i:vf(i)?s[e]*parseFloat(i)/100:0,r[t]=-(s[t]+o),r}}const bx={qualify:fr,set(t,{elem:e}){Km(e,t)}},vx={set(t,{elem:e}){e.innerHTML=`${t}`}},xx={qualify:fr,set(t,{view:e}){return`url(#${e.graph.defineFilter(t)})`}},wx={set(t){return null!=t&&"object"===typeof t&&t.id?t.id:t}};function Cx(t,e,n){let i,s;"object"===typeof e?(i=e.x,s=e.y):(i=e,s=n);const r=tv.parse(t),o=r.bbox();if(o){let t=-o.height/2-o.y,e=-o.width/2-o.x;"number"===typeof i&&(e-=i),"number"===typeof s&&(t-=s),r.translate(e,t)}return r.serialize()}var Px=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const Ex=t=>{var{size:e,width:n,height:i,offset:s,open:r}=t,o=Px(t,["size","width","height","offset","open"]);return Ox({size:e,width:n,height:i,offset:s},!0===r,!0,void 0,o)},Mx=t=>{var{size:e,width:n,height:i,offset:s,factor:r}=t,o=Px(t,["size","width","height","offset","factor"]);return Ox({size:e,width:n,height:i,offset:s},!1,!1,r,o)};function Ox(t,e,n,i=3/4,s={}){const r=t.size||10,o=t.width||r,a=t.height||r,l=new tv,c={};if(e)l.moveTo(o,0).lineTo(0,a/2).lineTo(o,a),c.fill="none";else{if(l.moveTo(0,a/2),l.lineTo(o,0),!n){const t=bf(i,0,1);l.lineTo(o*t,a/2)}l.lineTo(o,a),l.close()}return Object.assign(Object.assign(Object.assign({},c),s),{tagName:"path",d:Cx(l.serialize(),{x:null!=t.offset?t.offset:-o/2})})}var Ax=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const Sx=t=>{var{size:e,width:n,height:i,offset:s}=t,r=Ax(t,["size","width","height","offset"]);const o=e||10,a=n||o,l=i||o,c=new tv;return c.moveTo(0,l/2).lineTo(a/2,0).lineTo(a,l/2).lineTo(a/2,l).close(),Object.assign(Object.assign({},r),{tagName:"path",d:Cx(c.serialize(),null==s?-a/2:s)})};var Nx=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const Tx=t=>{var{d:e,offsetX:n,offsetY:i}=t,s=Nx(t,["d","offsetX","offsetY"]);return Object.assign(Object.assign({},s),{tagName:"path",d:Cx(e,n,i)})};var kx=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const jx=t=>{var{size:e,width:n,height:i,offset:s}=t,r=kx(t,["size","width","height","offset"]);const o=e||10,a=n||o,l=i||o,c=new tv;return c.moveTo(0,0).lineTo(a,l).moveTo(0,l).lineTo(a,0),Object.assign(Object.assign({},r),{tagName:"path",fill:"none",d:Cx(c.serialize(),s||-a/2)})};var Lx=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const Dx=t=>{var{width:e,height:n,offset:i,open:s,flip:r}=t,o=Lx(t,["width","height","offset","open","flip"]);let a=n||6;const l=e||10,c=!0===s,h=!0===r,u=Object.assign(Object.assign({},o),{tagName:"path"});h&&(a=-a);const d=new tv;return d.moveTo(0,a).lineTo(l,0),c?u.fill="none":(d.lineTo(l,a),d.close()),u.d=Cx(d.serialize(),{x:i||-l/2,y:a/2}),u};var Bx=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const Ix=t=>{var{r:e}=t,n=Bx(t,["r"]);const i=e||5;return Object.assign(Object.assign({cx:i},n),{tagName:"circle",r:i})},Rx=t=>{var{r:e}=t,n=Bx(t,["r"]);const i=e||5,s=new tv;return s.moveTo(i,0).lineTo(i,2*i),s.moveTo(0,i).lineTo(2*i,i),{children:[Object.assign(Object.assign({},Ix({r:i})),{fill:"none"}),Object.assign(Object.assign({},n),{tagName:"path",d:Cx(s.serialize(),-i)})]}};var Vx=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const zx=t=>{var{rx:e,ry:n}=t,i=Vx(t,["rx","ry"]);const s=e||5,r=n||5;return Object.assign(Object.assign({cx:s},i),{tagName:"ellipse",rx:s,ry:r})};var $x;(function(t){t.presets=h,t.registry=ev.create({type:"marker"}),t.registry.register(t.presets,!0)})($x||($x={})),function(t){t.normalize=Cx}($x||($x={}));var Fx=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};function Gx(t){return"string"===typeof t||fr(t)}const _x={qualify:Gx,set(t,{view:e,attrs:n}){return Jx("marker-start",t,e,n)}},Hx={qualify:Gx,set(t,{view:e,attrs:n}){return Jx("marker-end",t,e,n,{transform:"rotate(180)"})}},Ux={qualify:Gx,set(t,{view:e,attrs:n}){return Jx("marker-mid",t,e,n)}};function Jx(t,e,n,i,s={}){const r="string"===typeof e?{name:e}:e,{name:o,args:a}=r,l=Fx(r,["name","args"]);let c=l;if(o&&"string"===typeof o){const t=$x.registry.get(o);if(!t)return $x.registry.onNotFound(o);c=t(Object.assign(Object.assign({},l),a))}const h=Object.assign(Object.assign(Object.assign({},qx(i,t)),s),c);return{[t]:`url(#${n.graph.defineMarker(h)})`}}function qx(t,e){const n={},i=t.stroke;"string"===typeof i&&(n.stroke=i,n.fill=i);let s=t.strokeOpacity;if(null==s&&(s=t["stroke-opacity"]),null==s&&(s=t.opacity),null!=s&&(n["stroke-opacity"]=s,n["fill-opacity"]=s),"marker-mid"!==e){const i=parseFloat(t.strokeWidth||t["stroke-width"]);if(Number.isFinite(i)&&i>1){const t=Math.ceil(i/2);n.refX="marker-start"===e?t:-t}}return n}const Wx=(t,{view:e})=>e.cell.isEdge(),Xx={qualify:Wx,set(t,e){var n,i,s,r;const o=e.view,a=t.reverse||!1,l=t.stubs||0;let c;if(Number.isFinite(l)&&0!==l)if(a){let t,e;const a=o.getConnectionLength()||0;l<0?(t=(a+l)/2,e=-l):(t=l,e=a-2*l);const h=o.getConnection();c=null===(r=null===(s=null===(i=null===(n=null===h||void 0===h?void 0:h.divideAtLength(t))||void 0===n?void 0:n[1])||void 0===i?void 0:i.divideAtLength(e))||void 0===s?void 0:s[0])||void 0===r?void 0:r.serialize()}else{let t;if(l<0){const e=o.getConnectionLength()||0;t=(e+l)/2}else t=l;const e=o.getConnection();if(e){const n=e.divideAtLength(t),i=e.divideAtLength(-t);n&&i&&(c=`${n[0].serialize()} ${i[1].serialize()}`)}}return{d:c||o.getConnectionPathData()}}},Yx={qualify:Wx,set:nw("getTangentAtLength",{rotate:!0})},Zx={qualify:Wx,set:nw("getTangentAtLength",{rotate:!1})},Kx={qualify:Wx,set:nw("getTangentAtRatio",{rotate:!0})},Qx={qualify:Wx,set:nw("getTangentAtRatio",{rotate:!1})},tw=Yx,ew=Kx;function nw(t,e){const n={x:1,y:0};return(i,s)=>{let r,o;const a=s.view,l=a[t](Number(i));return l?(o=e.rotate?l.vector().vectorAngle(n):0,r=l.start):(r=a.path.start,o=0),0===o?{transform:`translate(${r.x},${r.y}')`}:{transform:`translate(${r.x},${r.y}') rotate(${o})`}}}var iw;(function(t){function e(t,e,n){if(null!=t){if("string"===typeof t)return!0;if("function"!==typeof t.qualify||Pt(t.qualify,this,e,n))return!0}return!1}t.isValidDefinition=e})(iw||(iw={})),function(t){t.presets=Object.assign(Object.assign({},Ov),u),t.registry=ev.create({type:"attribute definition"}),t.registry.register(t.presets,!0)}(iw||(iw={}));const sw={prefixCls:"x6",autoInsertCSS:!0,useCSSSelector:!0,prefix(t){return`${sw.prefixCls}-${t}`}},rw=sw.prefix("highlighted"),ow={highlight(t,e,n){const i=n&&n.className||rw;Hf(e,i)},unhighlight(t,e,n){const i=n&&n.className||rw;Uf(e,i)}},aw=sw.prefix("highlight-opacity"),lw={highlight(t,e){Hf(e,aw)},unhighlight(t,e){Uf(e,aw)}};var cw;(function(t){function e(t,e){const n=Ly(t.x,t.y).matrixTransform(e);return new Nb(n.x,n.y)}function n(t,n){return new kb(e(t.start,n),e(t.end,n))}function i(t,n){let i=t instanceof $b?t.points:t;return Array.isArray(i)||(i=[]),new $b(i.map(t=>e(t,n)))}function s(t,e){const n=em("svg"),i=n.createSVGPoint();i.x=t.x,i.y=t.y;const s=i.matrixTransform(e);i.x=t.x+t.width,i.y=t.y;const r=i.matrixTransform(e);i.x=t.x+t.width,i.y=t.y+t.height;const o=i.matrixTransform(e);i.x=t.x,i.y=t.y+t.height;const a=i.matrixTransform(e),l=Math.min(s.x,r.x,o.x,a.x),c=Math.max(s.x,r.x,o.x,a.x),h=Math.min(s.y,r.y,o.y,a.y),u=Math.max(s.y,r.y,o.y,a.y);return new Tb(l,h,c-l,u-h)}function r(t,e,n){let i;const r=t.ownerSVGElement;if(!r)return new Tb(0,0,0,0);try{i=t.getBBox()}catch(a){i={x:t.clientLeft,y:t.clientTop,width:t.clientWidth,height:t.clientHeight}}if(e)return Tb.create(i);const o=Wy(t,n||r);return s(i,o)}function o(t,e={}){let n;const i=t.ownerSVGElement;if(!i||!Yf(t)){if(bm(t)){const{left:e,top:n,width:i,height:s}=a(t);return new Tb(e,n,i,s)}return new Tb(0,0,0,0)}let r=e.target;const l=e.recursive;if(!l){try{n=t.getBBox()}catch(c){n={x:t.clientLeft,y:t.clientTop,width:t.clientWidth,height:t.clientHeight}}if(!r)return Tb.create(n);const e=Wy(t,r);return s(n,e)}{const e=t.childNodes,i=e.length;if(0===i)return o(t,{target:r});r||(r=t);for(let t=0;t<i;t+=1){const i=e[t];let s;s=0===i.childNodes.length?o(i,{target:r}):o(i,{target:r,recursive:!0}),n=n?n.union(s):s}return n}}function a(t){let e=0,n=0,i=0,s=0;if(t){let r=t;while(r)e+=r.offsetLeft,n+=r.offsetTop,r=r.offsetParent,r&&(e+=parseInt(Hm(r,"borderLeft"),10),n+=parseInt(Hm(r,"borderTop"),10));i=t.offsetWidth,s=t.offsetHeight}return{left:e,top:n,width:i,height:s}}function l(t){const e=e=>{const n=t.getAttribute(e),i=n?parseFloat(n):0;return Number.isNaN(i)?0:i};switch(t instanceof SVGElement&&t.nodeName.toLowerCase()){case"rect":return new Tb(e("x"),e("y"),e("width"),e("height"));case"circle":return new jb(e("cx"),e("cy"),e("r"),e("r"));case"ellipse":return new jb(e("cx"),e("cy"),e("rx"),e("ry"));case"polyline":{const e=Cy(t);return new $b(e)}case"polygon":{const e=Cy(t);return e.length>1&&e.push(e[0]),new $b(e)}case"path":{let e=t.getAttribute("d");return tv.isValid(e)||(e=tv.normalize(e)),tv.parse(e)}case"line":return new kb(e("x1"),e("y1"),e("x2"),e("y2"));default:break}return o(t)}function c(t,e,n,i){const s=Nb.create(e),r=Nb.create(n);if(!i){const e=t instanceof SVGSVGElement?t:t.ownerSVGElement;i=e}const a=qy(t);t.setAttribute("transform","");const l=o(t,{target:i}).scale(a.sx,a.sy),c=By();c.setTranslate(-l.x-l.width/2,-l.y-l.height/2);const h=By(),u=s.angleBetween(r,s.clone().translate(1,0));u&&h.setRotate(u,0,0);const d=By(),g=s.clone().move(r,l.width/2);d.setTranslate(2*s.x-g.x,2*s.y-g.y);const p=Wy(t,i),f=By();f.setMatrix(d.matrix.multiply(h.matrix.multiply(c.matrix.multiply(p.scale(a.sx,a.sy))))),t.setAttribute("transform",Ry(f.matrix))}function h(t){if(null==t)return null;let e=t;do{let t=e.tagName;if("string"!==typeof t)return null;if(t=t.toUpperCase(),_f(e,"x6-port"))e=e.nextElementSibling;else if("G"===t)e=e.firstElementChild;else{if("TITLE"!==t)break;e=e.nextElementSibling}}while(e);return e}function u(t){const e=h(t);if(!Yf(e)){if(bm(t)){const{left:e,top:n,width:i,height:s}=a(t);return new Tb(e,n,i,s)}return new Tb(0,0,0,0)}const n=l(e),i=n.bbox()||Tb.create();return i}t.normalizeMarker=Cx,t.transformPoint=e,t.transformLine=n,t.transformPolyline=i,t.transformRectangle=s,t.bbox=r,t.getBBox=o,t.getBoundingOffsetRect=a,t.toGeometryShape=l,t.translateAndAutoOrient=c,t.findShapeNode=h,t.getBBoxV2=u})(cw||(cw={}));const hw={padding:3,rx:0,ry:0,attrs:{"stroke-width":3,stroke:"#FEB663"}},uw={highlight(t,e,n){const i=dw.getHighlighterId(e,n);if(dw.hasCache(i))return;n=Ah({},n,hw);const s=ry.create(e);let r,o;try{r=s.toPathData()}catch(h){o=cw.bbox(s.node,!0),r=Oy(Object.assign(Object.assign({},n),o))}const a=em("path");if(Mm(a,Object.assign({d:r,"pointer-events":"none","vector-effect":"non-scaling-stroke",fill:"none"},n.attrs?Am(n.attrs):null)),t.isEdgeElement(e))Mm(a,"d",t.getConnectionPathData());else{let e=s.getTransformToElement(t.container);const i=n.padding;if(i){null==o&&(o=cw.bbox(s.node,!0));const t=o.x+o.width/2,n=o.y+o.height/2;o=cw.transformRectangle(o,e);const r=Math.max(o.width,1),a=Math.max(o.height,1),l=(r+i)/r,c=(a+i)/a,h=Dy({a:l,b:0,c:0,d:c,e:t-l*t,f:n-c*n});e=e.multiply(h)}Hy(a,e)}Hf(a,sw.prefix("highlight-stroke"));const l=t.cell,c=()=>dw.removeHighlighter(i);l.on("removed",c),l.model&&l.model.on("reseted",c),t.container.appendChild(a),dw.setCache(i,a)},unhighlight(t,e,n){dw.removeHighlighter(dw.getHighlighterId(e,n))}};var dw,gw;function pw(t,e={}){return new Nb(xf(e.x,t.width),xf(e.y,t.height))}function fw(t,e,n){return Object.assign({angle:e,position:t.toJSON()},n)}(function(t){function e(t,e){return Xf(t),t.id+JSON.stringify(e)}t.getHighlighterId=e;const n={};function i(t,e){n[t]=e}function s(t){return null!=n[t]}function r(t){const e=n[t];e&&(hm(e),delete n[t])}t.setCache=i,t.hasCache=s,t.removeHighlighter=r})(dw||(dw={})),function(t){function e(t,e){if("function"!==typeof e.highlight)throw new Error(`Highlighter '${t}' is missing required \`highlight()\` method`);if("function"!==typeof e.unhighlight)throw new Error(`Highlighter '${t}' is missing required \`unhighlight()\` method`)}t.check=e}(gw||(gw={})),function(t){t.presets=d,t.registry=ev.create({type:"highlighter"}),t.registry.register(t.presets,!0)}(gw||(gw={}));const mw=(t,e)=>t.map(({x:t,y:n,angle:i})=>fw(pw(e,{x:t,y:n}),i||0)),yw=(t,e,n)=>{const i=n.start||0,s=n.step||20;return vw(t,e,i,(t,e)=>(t+.5-e/2)*s)},bw=(t,e,n)=>{const i=n.start||0,s=n.step||360/t.length;return vw(t,e,i,t=>t*s)};function vw(t,e,n,i){const s=e.getCenter(),r=e.getTopCenter(),o=e.width/e.height,a=jb.fromRect(e),l=t.length;return t.map((t,e)=>{const c=n+i(e,l),h=r.clone().rotate(-c,s).scale(o,1,s),u=t.compensateRotate?-a.tangentTheta(h):0;return(t.dx||t.dy)&&h.translate(t.dx||0,t.dy||0),t.dr&&h.move(s,t.dr),fw(h.round(),u,t)})}var xw=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};const ww=(t,e,n)=>{const i=pw(e,n.start||e.getOrigin()),s=pw(e,n.end||e.getCorner());return Ow(t,i,s,n)},Cw=(t,e,n)=>Ow(t,e.getTopLeft(),e.getBottomLeft(),n),Pw=(t,e,n)=>Ow(t,e.getTopRight(),e.getBottomRight(),n),Ew=(t,e,n)=>Ow(t,e.getTopLeft(),e.getTopRight(),n),Mw=(t,e,n)=>Ow(t,e.getBottomLeft(),e.getBottomRight(),n);function Ow(t,e,n,i){const s=new kb(e,n),r=t.length;return t.map((t,e)=>{var{strict:n}=t,o=xw(t,["strict"]);const a=n||i.strict?(e+1)/(r+1):(e+.5)/r,l=s.pointAt(a);return(o.dx||o.dy)&&l.translate(o.dx||0,o.dy||0),fw(l.round(),0,o)})}var Aw;(function(t){t.presets=g,t.registry=ev.create({type:"port layout"}),t.registry.register(t.presets,!0)})(Aw||(Aw={}));const Sw={position:{x:0,y:0},angle:0,attrs:{".":{y:"0","text-anchor":"start"}}};function Nw(t,e){const{x:n,y:i,angle:s,attrs:r}=e||{};return Ah({},{angle:s,attrs:r,position:{x:n,y:i}},t,Sw)}const Tw=(t,e,n)=>Nw({position:e.getTopLeft()},n),kw=(t,e,n)=>Nw({position:{x:-15,y:0},attrs:{".":{y:".3em","text-anchor":"end"}}},n),jw=(t,e,n)=>Nw({position:{x:15,y:0},attrs:{".":{y:".3em","text-anchor":"start"}}},n),Lw=(t,e,n)=>Nw({position:{x:0,y:-15},attrs:{".":{"text-anchor":"middle"}}},n),Dw=(t,e,n)=>Nw({position:{x:0,y:15},attrs:{".":{y:".6em","text-anchor":"middle"}}},n),Bw=(t,e,n)=>zw(t,e,!1,n),Iw=(t,e,n)=>zw(t,e,!0,n),Rw=(t,e,n)=>$w(t,e,!1,n),Vw=(t,e,n)=>$w(t,e,!0,n);function zw(t,e,n,i){const s=null!=i.offset?i.offset:15,r=e.getCenter().theta(t),o=Fw(e);let a,l,c,h,u=0;return r<o[1]||r>o[2]?(a=".3em",l=s,c=0,h="start"):r<o[0]?(a="0",l=0,c=-s,n?(u=-90,h="start"):h="middle"):r<o[3]?(a=".3em",l=-s,c=0,h="end"):(a=".6em",l=0,c=s,n?(u=90,h="start"):h="middle"),Nw({position:{x:Math.round(l),y:Math.round(c)},angle:u,attrs:{".":{y:a,"text-anchor":h}}},i)}function $w(t,e,n,i){const s=null!=i.offset?i.offset:15,r=e.getCenter().theta(t),o=Fw(e);let a,l,c,h,u=0;return r<o[1]||r>o[2]?(a=".3em",l=-s,c=0,h="end"):r<o[0]?(a=".6em",l=0,c=s,n?(u=90,h="start"):h="middle"):r<o[3]?(a=".3em",l=s,c=0,h="start"):(a="0em",l=0,c=-s,n?(u=-90,h="start"):h="middle"),Nw({position:{x:Math.round(l),y:Math.round(c)},angle:u,attrs:{".":{y:a,"text-anchor":h}}},i)}function Fw(t){const e=t.getCenter(),n=e.theta(t.getTopLeft()),i=e.theta(t.getBottomLeft()),s=e.theta(t.getBottomRight()),r=e.theta(t.getTopRight());return[n,r,s,i]}const Gw=(t,e,n)=>Hw(t.diff(e.getCenter()),!1,n),_w=(t,e,n)=>Hw(t.diff(e.getCenter()),!0,n);function Hw(t,e,n){const i=null!=n.offset?n.offset:20,s=new Nb(0,0),r=-t.theta(s),o=t.clone().move(s,i).diff(t).round();let a,l=".3em",c=r;return(r+90)%180===0?(a=e?"end":"middle",e||-270!==r||(l="0em")):r>-270&&r<-90?(a="start",c=r-180):a="end",Nw({position:o.round().toJSON(),angle:e?c:0,attrs:{".":{y:l,"text-anchor":a}}},n)}var Uw;(function(t){t.presets=p,t.registry=ev.create({type:"port label layout"}),t.registry.register(t.presets,!0)})(Uw||(Uw={}));var Jw,qw,Ww=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class Xw extends Hh{get priority(){return 2}get disposeContainer(){return!0}constructor(){super(),this.cid=Jw.uniqueId(),Xw.views[this.cid]=this}confirmUpdate(t,e){return 0}empty(t=this.container){return um(t),this}unmount(t=this.container){return hm(t),this}remove(t=this.container){return t===this.container?(this.removeEventListeners(document),this.onRemove(),delete Xw.views[this.cid],this.disposeContainer&&this.unmount(t)):this.unmount(t),this}onRemove(){}setClass(t,e=this.container){e.classList.value=Array.isArray(t)?t.join(" "):t}addClass(t,e=this.container){return Hf(e,Array.isArray(t)?t.join(" "):t),this}removeClass(t,e=this.container){return Uf(e,Array.isArray(t)?t.join(" "):t),this}setStyle(t,e=this.container){return Km(e,t),this}setAttrs(t,e=this.container){return null!=t&&null!=e&&Mm(e,t),this}findAttr(t,e=this.container){let n=e;while(n&&1===n.nodeType){const e=n.getAttribute(t);if(null!=e)return e;if(n===this.container)return null;n=n.parentNode}return null}find(t,e=this.container,n=this.selectors){return Xw.find(t,e,n).elems}findOne(t,e=this.container,n=this.selectors){const i=this.find(t,e,n);return i.length>0?i[0]:null}findByAttr(t,e=this.container){let n=e;while(n&&n.getAttribute){const e=n.getAttribute(t);if((null!=e||n===this.container)&&"false"!==e)return n;n=n.parentNode}return null}getSelector(t,e){let n;if(t===this.container)return"string"===typeof e&&(n=`> ${e}`),n;if(t){const i=rm(t)+1;n=`${t.tagName.toLowerCase()}:nth-child(${i})`,e&&(n+=` > ${e}`),n=this.getSelector(t.parentNode,n)}return n}prefixClassName(t){return sw.prefix(t)}delegateEvents(t,e){if(null==t)return this;e||this.undelegateEvents();const n=/^(\S+)\s*(.*)$/;return Object.keys(t).forEach(e=>{const i=e.match(n);if(null==i)return;const s=this.getEventHandler(t[e]);"function"===typeof s&&this.delegateEvent(i[1],i[2],s)}),this}undelegateEvents(){return ib.off(this.container,this.getEventNamespace()),this}delegateDocumentEvents(t,e){return this.addEventListeners(document,t,e),this}undelegateDocumentEvents(){return this.removeEventListeners(document),this}delegateEvent(t,e,n){return ib.on(this.container,t+this.getEventNamespace(),e,n),this}undelegateEvent(t,e,n){const i=t+this.getEventNamespace();return null==e?ib.off(this.container,i):"string"===typeof e?ib.off(this.container,i,e,n):ib.off(this.container,i,e),this}addEventListeners(t,e,n){if(null==e)return this;const i=this.getEventNamespace();return Object.keys(e).forEach(s=>{const r=this.getEventHandler(e[s]);"function"===typeof r&&ib.on(t,s+i,n,r)}),this}removeEventListeners(t){return null!=t&&ib.off(t,this.getEventNamespace()),this}getEventNamespace(){return`.${sw.prefixCls}-event-${this.cid}`}getEventHandler(t){let e;if("string"===typeof t){const n=this[t];"function"===typeof n&&(e=(...t)=>n.call(this,...t))}else e=(...e)=>t.call(this,...e);return e}getEventTarget(t,e={}){const{target:n,type:i,clientX:s=0,clientY:r=0}=t;return e.fromPoint||"touchmove"===i||"touchend"===i?document.elementFromPoint(s,r):n}stopPropagation(t){return this.setEventData(t,{propagationStopped:!0}),this}isPropagationStopped(t){return!0===this.getEventData(t).propagationStopped}getEventData(t){return this.eventData(t)}setEventData(t,e){return this.eventData(t,e)}eventData(t,e){if(null==t)throw new TypeError("Event object required");let n=t.data;const i=`__${this.cid}__`;return null==e?null==n?{}:n[i]||{}:(null==n&&(n=t.data={}),null==n[i]?n[i]=Object.assign({},e):n[i]=Object.assign(Object.assign({},n[i]),e),n[i])}normalizeEvent(t){return Xw.normalizeEvent(t)}dispose(){this.remove()}}Ww([Xw.dispose()],Xw.prototype,"dispose",null),function(t){function e(t,e){return e?em(t||"g"):tm(t||"div")}function n(t,e,n){if(!t||"."===t)return{elems:[e]};if(n){const e=n[t];if(e)return{elems:Array.isArray(e)?e:[e]}}if(sw.useCSSSelector){const n=t.includes(">")?`:scope ${t}`:t;return{isCSSSelector:!0,elems:Array.prototype.slice.call(e.querySelectorAll(n))}}return{elems:[]}}function i(t){let e=t;const n=t.originalEvent,i=n&&n.changedTouches&&n.changedTouches[0];if(i){for(const e in t)void 0===i[e]&&(i[e]=t[e]);e=i}return e}t.createElement=e,t.find=n,t.normalizeEvent=i}(Xw||(Xw={})),function(t){function e(e){return t.views[e]||null}t.views={},t.getView=e}(Xw||(Xw={})),function(t){let e=0;function n(){const t=`v${e}`;return e+=1,t}t.uniqueId=n}(Jw||(Jw={}));class Yw{constructor(t){this.view=t,this.clean()}clean(){this.elemCache&&this.elemCache.dispose(),this.elemCache=new Cb,this.pathCache={}}get(t){const e=this.elemCache;return e.has(t)||this.elemCache.set(t,{}),this.elemCache.get(t)}getData(t){const e=this.get(t);return e.data||(e.data={}),e.data}getMatrix(t){const e=this.get(t);if(null==e.matrix){const n=this.view.container;e.matrix=Xy(t,n)}return Dy(e.matrix)}getShape(t){const e=this.get(t);return null==e.shape&&(e.shape=cw.toGeometryShape(t)),e.shape.clone()}getBoundingRect(t){const e=this.get(t);return null==e.boundingRect&&(e.boundingRect=cw.getBBoxV2(t)),e.boundingRect.clone()}}(function(t){function e(t){return null!=t&&!n(t)}function n(t){return null!=t&&"string"===typeof t}function i(t){return null==t||n(t)?t:yh(t)}function s(t){return`${t}`.trim().replace(/[\r|\n]/g," ").replace(/>\s+</g,"><")}function r(t,e={ns:Zf.svg}){const n=document.createDocumentFragment(),i={},s={},r=[{markup:Array.isArray(t)?t:[t],parent:n,ns:e.ns}];while(r.length>0){const t=r.pop();let e=t.ns||Zf.svg;const n=t.markup,o=t.parent;n.forEach(t=>{const n=t.tagName;if(!n)throw new TypeError("Invalid tagName");t.ns&&(e=t.ns);const a=e?tm(n,e):Qf(n),l=t.attrs;l&&Mm(a,Am(l));const c=t.style;c&&Km(a,c);const h=t.className;null!=h&&a.setAttribute("class",Array.isArray(h)?h.join(" "):h),t.textContent&&(a.textContent=t.textContent);const u=t.selector;if(null!=u){if(s[u])throw new TypeError("Selector must be unique");s[u]=a}if(t.groupSelector){let e=t.groupSelector;Array.isArray(e)||(e=[e]),e.forEach(t=>{i[t]||(i[t]=[]),i[t].push(a)})}o.appendChild(a);const d=t.children;Array.isArray(d)&&r.push({ns:e,markup:d,parent:a})})}return Object.keys(i).forEach(t=>{if(s[t])throw new Error("Ambiguous group selector");s[t]=i[t]}),{fragment:n,selectors:s,groups:i}}function o(t){return t instanceof SVGElement?em("g"):Qf("div")}function a(t){if(n(t)){const e=ry.createVectors(t),n=e.length;if(1===n)return{elem:e[0].node};if(n>1){const t=o(e[0].node);return e.forEach(e=>{t.appendChild(e.node)}),{elem:t}}return{}}const e=r(t),i=e.fragment;let s=null;return i.childNodes.length>1?(s=o(i.firstChild),s.appendChild(i)):s=i.firstChild,{elem:s,selectors:e.selectors}}function l(t){const e=ry.createVectors(t),n=document.createDocumentFragment();for(let i=0,s=e.length;i<s;i+=1){const t=e[i].node;n.appendChild(t)}return{fragment:n,selectors:{}}}t.isJSONMarkup=e,t.isStringMarkup=n,t.clone=i,t.sanitize=s,t.parseJSONMarkup=r,t.renderMarkup=a,t.parseLabelStringMarkup=l})(qw||(qw={})),function(t){function e(t,n,i){if(null!=t){let s;const r=t.tagName.toLowerCase();if(t===n)return s="string"===typeof i?`> ${r} > ${i}`:`> ${r}`,s;const o=t.parentNode;if(o&&o.childNodes.length>1){const e=rm(t)+1;s=`${r}:nth-child(${e})`}else s=r;return i&&(s+=` > ${i}`),e(t.parentNode,n,s)}return i}t.getSelector=e}(qw||(qw={})),function(t){function e(){return"g"}function n(){return{tagName:"circle",selector:"circle",attrs:{r:10,fill:"#FFFFFF",stroke:"#000000"}}}function i(){return{tagName:"text",selector:"text",attrs:{fill:"#000000"}}}t.getPortContainerMarkup=e,t.getPortMarkup=n,t.getPortLabelMarkup=i}(qw||(qw={})),function(t){function e(){return[{tagName:"path",selector:"wrap",groupSelector:"lines",attrs:{fill:"none",cursor:"pointer",stroke:"transparent",strokeLinecap:"round"}},{tagName:"path",selector:"line",groupSelector:"lines",attrs:{fill:"none",pointerEvents:"none"}}]}t.getEdgeMarkup=e}(qw||(qw={})),function(t){function e(t=!1){return{tagName:"foreignObject",selector:"fo",children:[{ns:Zf.xhtml,tagName:"body",selector:"foBody",attrs:{xmlns:Zf.xhtml},style:{width:"100%",height:"100%",background:"transparent"},children:t?[]:[{tagName:"div",selector:"foContent",style:{width:"100%",height:"100%"}}]}]}}t.getForeignObjectMarkup=e}(qw||(qw={}));class Zw{constructor(t){this.view=t}get cell(){return this.view.cell}getDefinition(t){return this.cell.getAttrDefinition(t)}processAttrs(t,e){let n,i,s,r;const o=[];return Object.keys(e).forEach(i=>{const s=e[i],r=this.getDefinition(i),a=Pt(iw.isValidDefinition,this.view,r,s,{elem:t,attrs:e,cell:this.cell,view:this.view});if(r&&a)"string"===typeof r?(null==n&&(n={}),n[r]=s):null!==s&&o.push({name:i,definition:r});else{null==n&&(n={});const t=xm.includes(i)?i:of(i);n[t]=s}}),o.forEach(({name:t,definition:n})=>{const o=e[t],a=n;"function"===typeof a.set&&(null==i&&(i={}),i[t]=o);const l=n;"function"===typeof l.offset&&(null==s&&(s={}),s[t]=o);const c=n;"function"===typeof c.position&&(null==r&&(r={}),r[t]=o)}),{raw:e,normal:n,set:i,offset:s,position:r}}mergeProcessedAttrs(t,e){t.set=Object.assign(Object.assign({},t.set),e.set),t.position=Object.assign(Object.assign({},t.position),e.position),t.offset=Object.assign(Object.assign({},t.offset),e.offset);const n=t.normal&&t.normal.transform;null!=n&&e.normal&&(e.normal.transform=n),t.normal=e.normal}findAttrs(t,e,n,i){const s=[],r=new Cb;return Object.keys(t).forEach(o=>{const a=t[o];if(!fr(a))return;const{isCSSSelector:l,elems:c}=Xw.find(o,e,i);n[o]=c;for(let t=0,e=c.length;t<e;t+=1){const n=c[t],h=i&&i[o]===n,u=r.get(n);if(u){u.array||(s.push(n),u.array=!0,u.attrs=[u.attrs],u.priority=[u.priority]);const t=u.attrs,i=u.priority;if(h)t.unshift(a),i.unshift(-1);else{const n=Ou(i,l?-1:e);t.splice(n,0,a),i.splice(n,0,e)}}else r.set(n,{elem:n,attrs:a,priority:h?-1:e,array:!1})}}),s.forEach(t=>{const e=r.get(t),n=e.attrs;e.attrs=n.reduceRight((t,e)=>jo(t,e),{})}),r}updateRelativeAttrs(t,e,n){const i=e.raw||{};let s=e.normal||{};const r=e.set,o=e.position,a=e.offset,l=()=>({elem:t,cell:this.cell,view:this.view,attrs:i,refBBox:n.clone()});if(null!=r&&Object.keys(r).forEach(t=>{const e=r[t],n=this.getDefinition(t);if(null!=n){const i=Pt(n.set,this.view,e,l());"object"===typeof i?s=Object.assign(Object.assign({},s),i):null!=i&&(s[t]=i)}}),t instanceof HTMLElement)return void this.view.setAttrs(s,t);const c=s.transform,h=c?`${c}`:null,u=Iy(h),d=new Nb(u.e,u.f);c&&(delete s.transform,u.e=0,u.f=0);let g=!1;null!=o&&Object.keys(o).forEach(t=>{const e=o[t],n=this.getDefinition(t);if(null!=n){const t=Pt(n.position,this.view,e,l());null!=t&&(g=!0,d.translate(Nb.create(t)))}}),this.view.setAttrs(s,t);let p=!1;if(null!=a){const e=this.view.getBoundingRectOfElement(t);if(e.width>0&&e.height>0){const n=cw.transformRectangle(e,u);Object.keys(a).forEach(e=>{const s=a[e],r=this.getDefinition(e);if(null!=r){const e=Pt(r.offset,this.view,s,{elem:t,cell:this.cell,view:this.view,attrs:i,refBBox:n});null!=e&&(p=!0,d.translate(Nb.create(e)))}})}}(null!=c||g||p)&&(d.round(1),u.e=Number.isFinite(d.x)?d.x:0,u.f=Number.isFinite(d.y)?d.y:0,t.setAttribute("transform",Ry(u)))}update(t,e,n){const i={},s=this.findAttrs(n.attrs||e,t,i,n.selectors),r=n.attrs?this.findAttrs(e,t,i,n.selectors):s,o=[];s.each(e=>{const s=e.elem,a=e.attrs,l=this.processAttrs(s,a);if(null==l.set&&null==l.position&&null==l.offset)this.view.setAttrs(l.normal,s);else{const e=r.get(s),c=e?e.attrs:null,h=c&&null==a.ref?c.ref:a.ref;let u;if(h){if(u=(i[h]||this.view.find(h,t,n.selectors))[0],!u)throw new Error(`"${h}" reference does not exist.`)}else u=null;const d={node:s,refNode:u,attributes:c,processedAttributes:l},g=o.findIndex(t=>t.refNode===s);g>-1?o.splice(g,0,d):o.push(d)}});const a=new Cb;let l;o.forEach(e=>{const i=e.node,s=e.refNode;let r;const o=null!=s&&null!=n.rotatableNode&&cm(n.rotatableNode,s);if(s&&(r=a.get(s)),!r){const e=o?n.rotatableNode:t;r=s?cw.getBBox(s,{target:e}):n.rootBBox,s&&a.set(s,r)}let c;n.attrs&&e.attributes?(c=this.processAttrs(i,e.attributes),this.mergeProcessedAttrs(c,e.processedAttributes)):c=e.processedAttributes;let h=r;o&&null!=n.rotatableNode&&!n.rotatableNode.contains(i)&&(l||(l=Iy(Mm(n.rotatableNode,"transform"))),h=cw.transformRectangle(r,l)),this.updateRelativeAttrs(i,c,h)})}}class Kw{get cell(){return this.view.cell}constructor(t,e,n=[]){this.view=t;const i={},s={};let r=0;Object.keys(e).forEach(t=>{let n=e[t];Array.isArray(n)||(n=[n]),n.forEach(e=>{let n=i[e];n||(r+=1,n=i[e]=1<<r),s[t]|=n})});let o=n;if(Array.isArray(o)||(o=[o]),o.forEach(t=>{i[t]||(r+=1,i[t]=1<<r)}),r>25)throw new Error("Maximum number of flags exceeded.");this.flags=i,this.attrs=s,this.bootstrap=n}getFlag(t){const e=this.flags;return null==e?0:Array.isArray(t)?t.reduce((t,n)=>t|e[n],0):0|e[t]}hasAction(t,e){return t&this.getFlag(e)}removeAction(t,e){return t^t&this.getFlag(e)}getBootstrapFlag(){return this.getFlag(this.bootstrap)}getChangedFlag(){let t=0;return this.attrs?(Object.keys(this.attrs).forEach(e=>{this.cell.hasChanged(e)&&(t|=this.attrs[e])}),t):t}}var Qw=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o},tC=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class eC extends Xw{static getDefaults(){return this.defaults}static config(t){this.defaults=this.getOptions(t)}static getOptions(t){const e=(t,e)=>null!=e?du([...Array.isArray(t)?t:[t],...Array.isArray(e)?e:[e]]):Array.isArray(t)?[...t]:[t],n=yh(this.getDefaults()),{bootstrap:i,actions:s,events:r,documentEvents:o}=t,a=tC(t,["bootstrap","actions","events","documentEvents"]);return i&&(n.bootstrap=e(n.bootstrap,i)),s&&Object.entries(s).forEach(([t,i])=>{const s=n.actions[t];i&&s?n.actions[t]=e(s,i):i&&(n.actions[t]=e(i))}),r&&(n.events=Object.assign(Object.assign({},n.events),r)),t.documentEvents&&(n.documentEvents=Object.assign(Object.assign({},n.documentEvents),o)),jo(n,a)}get[Symbol.toStringTag](){return eC.toStringTag}constructor(t,e={}){super(),this.cell=t,this.options=this.ensureOptions(e),this.graph=this.options.graph,this.attr=new Zw(this),this.flag=new Kw(this,this.options.actions,this.options.bootstrap),this.cache=new Yw(this),this.setContainer(this.ensureContainer()),this.setup(),this.init()}init(){}onRemove(){this.removeTools()}get priority(){return this.options.priority}get rootSelector(){return this.options.rootSelector}getConstructor(){return this.constructor}ensureOptions(t){return this.getConstructor().getOptions(t)}getContainerTagName(){return this.options.isSvgElement?"g":"div"}getContainerStyle(){}getContainerAttrs(){return{"data-cell-id":this.cell.id,"data-shape":this.cell.shape}}getContainerClassName(){return this.prefixClassName("cell")}ensureContainer(){return Xw.createElement(this.getContainerTagName(),this.options.isSvgElement)}setContainer(t){if(this.container!==t){this.undelegateEvents(),this.container=t,null!=this.options.events&&this.delegateEvents(this.options.events);const e=this.getContainerAttrs();null!=e&&this.setAttrs(e,t);const n=this.getContainerStyle();null!=n&&this.setStyle(n,t);const i=this.getContainerClassName();null!=i&&this.addClass(i,t)}return this}isNodeView(){return!1}isEdgeView(){return!1}render(){return this}confirmUpdate(t,e={}){return 0}getBootstrapFlag(){return this.flag.getBootstrapFlag()}getFlag(t){return this.flag.getFlag(t)}hasAction(t,e){return this.flag.hasAction(t,e)}removeAction(t,e){return this.flag.removeAction(t,e)}handleAction(t,e,n,i){if(this.hasAction(t,e)){n();const s=[e];return i&&("string"===typeof i?s.push(i):s.push(...i)),this.removeAction(t,s)}return t}setup(){this.cell.on("changed",this.onCellChanged,this)}onCellChanged({options:t}){this.onAttrsChange(t)}onAttrsChange(t){let e=this.flag.getChangedFlag();!t.updated&&e&&(t.dirty&&this.hasAction(e,"update")&&(e|=this.getFlag("render")),t.toolId&&(t.async=!1),null!=this.graph&&this.graph.renderer.requestViewUpdate(this,e,t))}parseJSONMarkup(t,e){const n=qw.parseJSONMarkup(t),i=n.selectors,s=this.rootSelector;if(e&&s){if(i[s])throw new Error("Invalid root selector");i[s]=e}return n}can(t){let e=this.graph.options.interacting;if("function"===typeof e&&(e=Pt(e,this.graph,this)),"object"===typeof e){let n=e[t];return"function"===typeof n&&(n=Pt(n,this.graph,this)),!1!==n}return"boolean"===typeof e&&e}cleanCache(){return this.cache.clean(),this}getCache(t){return this.cache.get(t)}getDataOfElement(t){return this.cache.getData(t)}getMatrixOfElement(t){return this.cache.getMatrix(t)}getShapeOfElement(t){return this.cache.getShape(t)}getBoundingRectOfElement(t){return this.cache.getBoundingRect(t)}getBBoxOfElement(t){const e=this.getBoundingRectOfElement(t),n=this.getMatrixOfElement(t),i=this.getRootRotatedMatrix(),s=this.getRootTranslatedMatrix();return cw.transformRectangle(e,s.multiply(i).multiply(n))}getUnrotatedBBoxOfElement(t){const e=this.getBoundingRectOfElement(t),n=this.getMatrixOfElement(t),i=this.getRootTranslatedMatrix();return cw.transformRectangle(e,i.multiply(n))}getBBox(t={}){let e;if(t.useCellGeometry){const t=this.cell,n=t.isNode()?t.getAngle():0;e=t.getBBox().bbox(n)}else e=this.getBBoxOfElement(this.container);return this.graph.coord.localToGraphRect(e)}getRootTranslatedMatrix(){const t=this.cell,e=t.isNode()?t.getPosition():{x:0,y:0};return Dy().translate(e.x,e.y)}getRootRotatedMatrix(){let t=Dy();const e=this.cell,n=e.isNode()?e.getAngle():0;if(n){const i=e.getBBox(),s=i.width/2,r=i.height/2;t=t.translate(s,r).rotate(n).translate(-s,-r)}return t}findMagnet(t=this.container){return this.findByAttr("magnet",t)}updateAttrs(t,e,n={}){null==n.rootBBox&&(n.rootBBox=new Tb),null==n.selectors&&(n.selectors=this.selectors),this.attr.update(t,e,n)}isEdgeElement(t){return this.cell.isEdge()&&(null==t||t===this.container)}prepareHighlight(t,e={}){const n=t||this.container;return e.partial=n===this.container,n}highlight(t,e={}){const n=this.prepareHighlight(t,e);return this.notify("cell:highlight",{magnet:n,options:e,view:this,cell:this.cell}),this.isEdgeView()?this.notify("edge:highlight",{magnet:n,options:e,view:this,edge:this.cell,cell:this.cell}):this.isNodeView()&&this.notify("node:highlight",{magnet:n,options:e,view:this,node:this.cell,cell:this.cell}),this}unhighlight(t,e={}){const n=this.prepareHighlight(t,e);return this.notify("cell:unhighlight",{magnet:n,options:e,view:this,cell:this.cell}),this.isNodeView()?this.notify("node:unhighlight",{magnet:n,options:e,view:this,node:this.cell,cell:this.cell}):this.isEdgeView()&&this.notify("edge:unhighlight",{magnet:n,options:e,view:this,edge:this.cell,cell:this.cell}),this}notifyUnhighlight(t,e){}getEdgeTerminal(t,e,n,i,s){const r=this.cell,o=this.findAttr("port",t),a=t.getAttribute("data-selector"),l={cell:r.id};return null!=a&&(l.magnet=a),null!=o?(l.port=o,r.isNode()&&(r.hasPort(o)||null!=a||(l.selector=this.getSelector(t)))):null==a&&this.container!==t&&(l.selector=this.getSelector(t)),l}getMagnetFromEdgeTerminal(t){const e=this.cell,n=this.container,i=t.port;let s,r=t.magnet;return null!=i&&e.isNode()&&e.hasPort(i)?s=this.findPortElem(i,r)||n:(r||(r=t.selector),r||null==i||(r=`[port="${i}"]`),s=this.findOne(r,n,this.selectors)),s}hasTools(t){const e=this.tools;return null!=e&&(null==t||e.name===t)}addTools(t){if(this.removeTools(),t){if(!this.can("toolsAddable"))return this;const e=nC.isToolsView(t)?t:new nC(t);this.tools=e,e.config({view:this}),e.mount()}return this}updateTools(t={}){return this.tools&&this.tools.update(t),this}removeTools(){return this.tools&&(this.tools.remove(),this.tools=null),this}hideTools(){return this.tools&&this.tools.hide(),this}showTools(){return this.tools&&this.tools.show(),this}renderTools(){const t=this.cell.getTools();return this.addTools(t),this}notify(t,e){return this.trigger(t,e),this.graph.trigger(t,e),this}getEventArgs(t,e,n){const i=this,s=i.cell;return null==e||null==n?{e:t,view:i,cell:s}:{e:t,x:e,y:n,view:i,cell:s}}onClick(t,e,n){this.notify("cell:click",this.getEventArgs(t,e,n))}onDblClick(t,e,n){this.notify("cell:dblclick",this.getEventArgs(t,e,n))}onContextMenu(t,e,n){this.notify("cell:contextmenu",this.getEventArgs(t,e,n))}onMouseDown(t,e,n){this.cell.model&&(this.cachedModelForMouseEvent=this.cell.model,this.cachedModelForMouseEvent.startBatch("mouse")),this.notify("cell:mousedown",this.getEventArgs(t,e,n))}onMouseUp(t,e,n){this.notify("cell:mouseup",this.getEventArgs(t,e,n)),this.cachedModelForMouseEvent&&(this.cachedModelForMouseEvent.stopBatch("mouse",{cell:this.cell}),this.cachedModelForMouseEvent=null)}onMouseMove(t,e,n){this.notify("cell:mousemove",this.getEventArgs(t,e,n))}onMouseOver(t){this.notify("cell:mouseover",this.getEventArgs(t))}onMouseOut(t){this.notify("cell:mouseout",this.getEventArgs(t))}onMouseEnter(t){this.notify("cell:mouseenter",this.getEventArgs(t))}onMouseLeave(t){this.notify("cell:mouseleave",this.getEventArgs(t))}onMouseWheel(t,e,n,i){this.notify("cell:mousewheel",Object.assign({delta:i},this.getEventArgs(t,e,n)))}onCustomEvent(t,e,n,i){this.notify("cell:customevent",Object.assign({name:e},this.getEventArgs(t,n,i))),this.notify(e,Object.assign({},this.getEventArgs(t,n,i)))}onMagnetMouseDown(t,e,n,i){}onMagnetDblClick(t,e,n,i){}onMagnetContextMenu(t,e,n,i){}onLabelMouseDown(t,e,n){}checkMouseleave(t){const e=this.getEventTarget(t,{fromPoint:!0}),n=this.graph.findViewByElem(e);n!==this&&(this.onMouseLeave(t),n&&n.onMouseEnter(t))}dispose(){this.cell.off("changed",this.onCellChanged,this)}}eC.defaults={isSvgElement:!0,rootSelector:"root",priority:0,bootstrap:[],actions:{}},Qw([eC.dispose()],eC.prototype,"dispose",null),function(t){t.Flag=Kw,t.Attr=Zw}(eC||(eC={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNodeView&&"function"===typeof i.isEdgeView&&"function"===typeof i.confirmUpdate}t.toStringTag=`X6.${t.name}`,t.isCellView=e}(eC||(eC={})),function(t){function e(t){return function(e){e.config({priority:t})}}function n(t){return function(e){e.config({bootstrap:t})}}t.priority=e,t.bootstrap=n}(eC||(eC={})),function(t){t.registry=ev.create({type:"view"})}(eC||(eC={}));class nC extends Xw{get name(){return this.options.name}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get[Symbol.toStringTag](){return nC.toStringTag}constructor(t={}){super(),this.svgContainer=this.createContainer(!0,t),this.htmlContainer=this.createContainer(!1,t),this.config(t)}createContainer(t,e){const n=t?Xw.createElement("g",!0):Xw.createElement("div",!1);return Hf(n,this.prefixClassName("cell-tools")),e.className&&Hf(n,e.className),n}config(t){if(this.options=Object.assign(Object.assign({},this.options),t),!eC.isCellView(t.view)||t.view===this.cellView)return this;this.cellView=t.view,this.cell.isEdge()?(Hf(this.svgContainer,this.prefixClassName("edge-tools")),Hf(this.htmlContainer,this.prefixClassName("edge-tools"))):this.cell.isNode()&&(Hf(this.svgContainer,this.prefixClassName("node-tools")),Hf(this.htmlContainer,this.prefixClassName("node-tools"))),this.svgContainer.setAttribute("data-cell-id",this.cell.id),this.htmlContainer.setAttribute("data-cell-id",this.cell.id),this.name&&(this.svgContainer.setAttribute("data-tools-name",this.name),this.htmlContainer.setAttribute("data-tools-name",this.name));const e=this.options.items;if(!Array.isArray(e))return this;this.tools=[];const n=[];e.forEach(t=>{if(nC.ToolItem.isToolItem(t))"vertices"===t.name?n.unshift(t):n.push(t);else{const e="object"===typeof t?t.name:t;"vertices"===e?n.unshift(t):n.push(t)}});for(let i=0;i<n.length;i+=1){const t=n[i];let e;if(nC.ToolItem.isToolItem(t))e=t;else{const n="object"===typeof t?t.name:t,i="object"===typeof t&&t.args||{};if(n)if(this.cell.isNode()){const t=OC.registry.get(n);if(!t)return OC.registry.onNotFound(n);e=new t(i)}else if(this.cell.isEdge()){const t=AC.registry.get(n);if(!t)return AC.registry.onNotFound(n);e=new t(i)}}if(e){e.config(this.cellView,this),e.render();const t=!1!==e.options.isSVGElement?this.svgContainer:this.htmlContainer;t.appendChild(e.container),this.tools.push(e)}}return this}update(t={}){const e=this.tools;return e&&e.forEach(e=>{t.toolId!==e.cid&&e.isVisible()&&e.update()}),this}focus(t){const e=this.tools;return e&&e.forEach(e=>{t===e?e.show():e.hide()}),this}blur(t){const e=this.tools;return e&&e.forEach(e=>{e===t||e.isVisible()||(e.show(),e.update())}),this}hide(){return this.focus(null)}show(){return this.blur(null)}remove(){const t=this.tools;return t&&(t.forEach(t=>t.remove()),this.tools=null),hm(this.svgContainer),hm(this.htmlContainer),super.remove()}mount(){const t=this.tools,e=this.cellView;if(e&&t){const n=t.some(t=>!1!==t.options.isSVGElement),i=t.some(t=>!1===t.options.isSVGElement);if(n){const t=this.options.local?e.container:e.graph.view.decorator;t.appendChild(this.svgContainer)}i&&this.graph.container.appendChild(this.htmlContainer)}return this}}(function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&null!=i.graph&&null!=i.cell&&"function"===typeof i.config&&"function"===typeof i.update&&"function"===typeof i.focus&&"function"===typeof i.blur&&"function"===typeof i.show&&"function"===typeof i.hide}t.toStringTag=`X6.${t.name}`,t.isToolsView=e})(nC||(nC={})),function(t){class e extends Xw{static getDefaults(){return this.defaults}static config(t){this.defaults=this.getOptions(t)}static getOptions(t){return jo(yh(this.getDefaults()),t)}get graph(){return this.cellView.graph}get cell(){return this.cellView.cell}get name(){return this.options.name}get[Symbol.toStringTag](){return e.toStringTag}constructor(t={}){super(),this.visible=!0,this.options=this.getOptions(t),this.container=Xw.createElement(this.options.tagName||"g",!1!==this.options.isSVGElement),Hf(this.container,this.prefixClassName("cell-tool")),"string"===typeof this.options.className&&Hf(this.container,this.options.className),this.init()}init(){}getOptions(t){const e=this.constructor;return e.getOptions(t)}delegateEvents(){return this.options.events&&super.delegateEvents(this.options.events),this}config(t,e){return this.cellView=t,this.parent=e,this.stamp(this.container),this.cell.isEdge()?Hf(this.container,this.prefixClassName("edge-tool")):this.cell.isNode()&&Hf(this.container,this.prefixClassName("node-tool")),this.name&&this.container.setAttribute("data-tool-name",this.name),this.delegateEvents(),this}render(){this.empty();const t=this.options.markup;if(t){const e=qw.parseJSONMarkup(t);this.container.appendChild(e.fragment),this.childNodes=e.selectors}return this.onRender(),this}onRender(){}update(){return this}stamp(t){t&&t.setAttribute("data-cell-id",this.cellView.cell.id)}show(){return this.container.style.display="",this.visible=!0,this}hide(){return this.container.style.display="none",this.visible=!1,this}isVisible(){return this.visible}focus(){const t=this.options.focusOpacity;return null!=t&&Number.isFinite(t)&&(this.container.style.opacity=`${t}`),this.parent.focus(this),this}blur(){return this.container.style.opacity="",this.parent.blur(this),this}guard(t){return null==this.graph||null==this.cellView||this.graph.view.guard(t,this.cellView)}}e.defaults={isSVGElement:!0,tagName:"g"},t.ToolItem=e,function(t){let e=0;function n(t){return t?af(t):(e+=1,`CustomTool${e}`)}function i(t){const e=Lh(n(t.name),this);return e.config(t),e}t.define=i}(e=t.ToolItem||(t.ToolItem={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&null!=i.graph&&null!=i.cell&&"function"===typeof i.config&&"function"===typeof i.update&&"function"===typeof i.focus&&"function"===typeof i.blur&&"function"===typeof i.show&&"function"===typeof i.hide&&"function"===typeof i.isVisible}t.toStringTag=`X6.${t.name}`,t.isToolItem=e}(e=t.ToolItem||(t.ToolItem={}))}(nC||(nC={}));const iC=t=>t;function sC(t,e){return 0===e?"0%":`${Math.round(t/e*100)}%`}function rC(t){const e=(e,n,i,s)=>n.isEdgeElement(i)?aC(t,e,n,i,s):oC(t,e,n,i,s);return e}function oC(t,e,n,i,s){const r=n.cell,o=r.getAngle(),a=n.getUnrotatedBBoxOfElement(i),l=r.getBBox().getCenter(),c=Nb.create(s).rotate(o,l);let h=c.x-a.x,u=c.y-a.y;return t&&(h=sC(h,a.width),u=sC(u,a.height)),e.anchor={name:"topLeft",args:{dx:h,dy:u,rotate:!0}},e}function aC(t,e,n,i,s){const r=n.getConnection();if(!r)return e;const o=r.closestPointLength(s);if(t){const t=r.length();e.anchor={name:"ratio",args:{ratio:o/t}}}else e.anchor={name:"length",args:{length:o}};return e}const lC=rC(!0),cC=rC(!1);var hC;function uC(t,e,n,i){const s=Pt(hC.presets.pinRelative,this.graph,{},e,n,t,this.cell,i,{});return s.anchor}function dC(t,e){return e?t.cell.getBBox():t.cell.isEdge()?t.getConnection().bbox():t.getUnrotatedBBoxOfElement(t.container)}(function(t){t.presets=f,t.registry=ev.create({type:"connection strategy"}),t.registry.register(t.presets,!0)})(hC||(hC={}));class gC extends nC.ToolItem{onRender(){Hf(this.container,this.prefixClassName("cell-tool-button")),this.update()}update(){return this.updatePosition(),this}updatePosition(){const t=this.cellView,e=t.cell.isEdge()?this.getEdgeMatrix():this.getNodeMatrix();Hy(this.container,e,{absolute:!0})}getNodeMatrix(){const t=this.cellView,e=this.options;let{x:n=0,y:i=0}=e;const{offset:s,useCellGeometry:r,rotate:o}=e;let a=dC(t,r);const l=t.cell.getAngle();o||(a=a.bbox(l));let c=0,h=0;"number"===typeof s?(c=s,h=s):"object"===typeof s&&(c=s.x,h=s.y),n=xf(n,a.width),i=xf(i,a.height);let u=Dy().translate(a.x+a.width/2,a.y+a.height/2);return o&&(u=u.rotate(l)),u=u.translate(n+c-a.width/2,i+h-a.height/2),u}getEdgeMatrix(){const t=this.cellView,e=this.options,{offset:n=0,distance:i=0,rotate:s}=e;let r,o,a;const l=xf(i,1);r=l>=0&&l<=1?t.getTangentAtRatio(l):t.getTangentAtLength(l),r?(o=r.start,a=r.vector().vectorAngle(new Nb(1,0))||0):(o=t.getConnection().start,a=0);let c=Dy().translate(o.x,o.y).rotate(a);return c="object"===typeof n?c.translate(n.x||0,n.y||0):c.translate(0,n),s||(c=c.rotate(-a)),c}onMouseDown(t){if(this.guard(t))return;t.stopPropagation(),t.preventDefault();const e=this.options.onClick;"function"===typeof e&&Pt(e,this.cellView,{e:t,view:this.cellView,cell:this.cellView.cell,btn:this})}}(function(t){t.config({name:"button",useCellGeometry:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"}})})(gC||(gC={})),function(t){t.Remove=t.define({name:"button-remove",markup:[{tagName:"circle",selector:"button",attrs:{r:7,fill:"#FF1D00",cursor:"pointer"}},{tagName:"path",selector:"icon",attrs:{d:"M -3 -3 3 3 M -3 3 3 -3",fill:"none",stroke:"#FFFFFF","stroke-width":2,"pointer-events":"none"}}],distance:60,offset:0,useCellGeometry:!0,onClick({view:t,btn:e}){e.parent.remove(),t.cell.remove({ui:!0,toolId:e.cid})}})}(gC||(gC={}));var pC=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class fC extends nC.ToolItem{onRender(){if(Hf(this.container,this.prefixClassName("cell-tool-boundary")),this.options.attrs){const t=this.options.attrs,{class:e}=t,n=pC(t,["class"]);Mm(this.container,Am(n)),e&&Hf(this.container,e)}this.update()}update(){const t=this.cellView,e=this.options,{useCellGeometry:n,rotate:i}=e,s=wf(e.padding);let r=dC(t,n).moveAndExpand({x:-s.left,y:-s.top,width:s.left+s.right,height:s.top+s.bottom});const o=t.cell;if(o.isNode()){const t=o.getAngle();if(t)if(i){const e=o.getBBox().getCenter();Jy(this.container,t,e.x,e.y,{absolute:!0})}else r=r.bbox(t)}return Mm(this.container,r.toJSON()),this}}(function(t){t.config({name:"boundary",tagName:"rect",padding:10,useCellGeometry:!0,attrs:{fill:"none",stroke:"#333","stroke-width":.5,"stroke-dasharray":"5, 5","pointer-events":"none"}})})(fC||(fC={}));class mC extends nC.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}onRender(){return this.addClass(this.prefixClassName("edge-tool-vertices")),this.options.addable&&this.updatePath(),this.resetHandles(),this.renderHandles(),this}update(){const t=this.vertices;return t.length===this.handles.length?this.updateHandles():(this.resetHandles(),this.renderHandles()),this.options.addable&&this.updatePath(),this}resetHandles(){const t=this.handles;this.handles=[],t&&t.forEach(t=>{this.stopHandleListening(t),t.remove()})}renderHandles(){const t=this.vertices;for(let e=0,n=t.length;e<n;e+=1){const n=t[e],i=this.options.createHandle,s=this.options.processHandle,r=i({index:e,graph:this.graph,guard:t=>this.guard(t),attrs:this.options.attrs||{}});s&&s(r),r.updatePosition(n.x,n.y),this.stamp(r.container),this.container.appendChild(r.container),this.handles.push(r),this.startHandleListening(r)}}updateHandles(){const t=this.vertices;for(let e=0,n=t.length;e<n;e+=1){const n=t[e],i=this.handles[e];i&&i.updatePosition(n.x,n.y)}}updatePath(){const t=this.childNodes.connection;t&&t.setAttribute("d",this.cellView.getConnectionPathData())}startHandleListening(t){const e=this.cellView;e.can("vertexMovable")&&(t.on("change",this.onHandleChange,this),t.on("changing",this.onHandleChanging,this),t.on("changed",this.onHandleChanged,this)),e.can("vertexDeletable")&&t.on("remove",this.onHandleRemove,this)}stopHandleListening(t){const e=this.cellView;e.can("vertexMovable")&&(t.off("change",this.onHandleChange,this),t.off("changing",this.onHandleChanging,this),t.off("changed",this.onHandleChanged,this)),e.can("vertexDeletable")&&t.off("remove",this.onHandleRemove,this)}getNeighborPoints(t){const e=this.cellView,n=this.vertices,i=t>0?n[t-1]:e.sourceAnchor,s=t<n.length-1?n[t+1]:e.targetAnchor;return{prev:Nb.create(i),next:Nb.create(s)}}getMouseEventArgs(t){const e=this.normalizeEvent(t),{x:n,y:i}=this.graph.snapToGrid(e.clientX,e.clientY);return{e:e,x:n,y:i}}onHandleChange({e:t}){this.focus();const e=this.cellView;if(e.cell.startBatch("move-vertex",{ui:!0,toolId:this.cid}),!this.options.stopPropagation){const{e:n,x:i,y:s}=this.getMouseEventArgs(t);this.eventData(n,{start:{x:i,y:s}}),e.notifyMouseDown(n,i,s)}}onHandleChanging({handle:t,e:e}){const n=this.cellView,i=t.options.index,{e:s,x:r,y:o}=this.getMouseEventArgs(e),a={x:r,y:o};this.snapVertex(a,i),n.cell.setVertexAt(i,a,{ui:!0,toolId:this.cid}),t.updatePosition(a.x,a.y),this.options.stopPropagation||n.notifyMouseMove(s,r,o)}stopBatch(t){this.cell.stopBatch("move-vertex",{ui:!0,toolId:this.cid}),t&&this.cell.stopBatch("add-vertex",{ui:!0,toolId:this.cid})}onHandleChanged({e:t}){const e=this.options,n=this.cellView;if(e.addable&&this.updatePath(),!e.removeRedundancies)return void this.stopBatch(this.eventData(t).vertexAdded);const i=n.removeRedundantLinearVertices({ui:!0,toolId:this.cid});i&&this.render(),this.blur(),this.stopBatch(this.eventData(t).vertexAdded);const{e:s,x:r,y:o}=this.getMouseEventArgs(t);if(!this.options.stopPropagation){n.notifyMouseUp(s,r,o);const{start:t}=this.eventData(s);if(t){const{x:e,y:i}=t;e===r&&i===o&&n.onClick(s,r,o)}}n.checkMouseleave(s),e.onChanged&&e.onChanged({edge:n.cell,edgeView:n})}snapVertex(t,e){const n=this.options.snapRadius||0;if(n>0){const i=this.getNeighborPoints(e),s=i.prev,r=i.next;Math.abs(t.x-s.x)<n?t.x=s.x:Math.abs(t.x-r.x)<n&&(t.x=r.x),Math.abs(t.y-s.y)<n?t.y=i.prev.y:Math.abs(t.y-r.y)<n&&(t.y=r.y)}}onHandleRemove({handle:t,e:e}){if(this.options.removable){const n=t.options.index,i=this.cellView;i.cell.removeVertexAt(n,{ui:!0}),this.options.addable&&this.updatePath(),i.checkMouseleave(this.normalizeEvent(e))}}allowAddVertex(t){const e=this.guard(t),n=this.options.addable&&this.cellView.can("vertexAddable"),i=!this.options.modifiers||yb.isMatch(t,this.options.modifiers);return!e&&n&&i}onPathMouseDown(t){const e=this.cellView;if(!this.allowAddVertex(t))return;t.stopPropagation(),t.preventDefault();const n=this.normalizeEvent(t),i=this.graph.snapToGrid(n.clientX,n.clientY).toJSON();e.cell.startBatch("add-vertex",{ui:!0,toolId:this.cid});const s=e.getVertexIndex(i.x,i.y);this.snapVertex(i,s),e.cell.insertVertex(i,s,{ui:!0,toolId:this.cid}),this.render();const r=this.handles[s];this.eventData(n,{vertexAdded:!0}),r.onMouseDown(n)}onRemove(){this.resetHandles()}}(function(t){class e extends Xw{get graph(){return this.options.graph}constructor(t){super(),this.options=t,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown",dblclick:"onDoubleClick"})}render(){this.container=Xw.createElement("circle",!0);const e=this.options.attrs;if("function"===typeof e){const n=t.getDefaults();this.setAttrs(Object.assign(Object.assign({},n.attrs),e(this)))}else this.setAttrs(e);this.addClass(this.prefixClassName("edge-tool-vertex"))}updatePosition(t,e){this.setAttrs({cx:t,cy:e})}onMouseDown(t){this.options.guard(t)||(t.stopPropagation(),t.preventDefault(),this.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},t.data),this.emit("change",{e:t,handle:this}))}onMouseMove(t){this.emit("changing",{e:t,handle:this})}onMouseUp(t){this.emit("changed",{e:t,handle:this}),this.undelegateDocumentEvents(),this.graph.view.delegateEvents()}onDoubleClick(t){this.emit("remove",{e:t,handle:this})}}t.Handle=e})(mC||(mC={})),function(t){const e=sw.prefix("edge-tool-vertex-path");t.config({name:"vertices",snapRadius:20,addable:!0,removable:!0,removeRedundancies:!0,stopPropagation:!0,attrs:{r:6,fill:"#333",stroke:"#fff",cursor:"move","stroke-width":2},createHandle:e=>new t.Handle(e),markup:[{tagName:"path",selector:"connection",className:e,attrs:{fill:"none",stroke:"transparent","stroke-width":10,cursor:"pointer"}}],events:{[`mousedown .${e}`]:"onPathMouseDown",[`touchstart .${e}`]:"onPathMouseDown"}})}(mC||(mC={}));class yC extends nC.ToolItem{constructor(){super(...arguments),this.handles=[]}get vertices(){return this.cellView.cell.getVertices()}update(){return this.render(),this}onRender(){Hf(this.container,this.prefixClassName("edge-tool-segments")),this.resetHandles();const t=this.cellView,e=[...this.vertices];e.unshift(t.sourcePoint),e.push(t.targetPoint);for(let n=0,i=e.length;n<i-1;n+=1){const t=e[n],i=e[n+1],s=this.renderHandle(t,i,n);this.stamp(s.container),this.handles.push(s)}return this}renderHandle(t,e,n){const i=this.options.createHandle({index:n,graph:this.graph,guard:t=>this.guard(t),attrs:this.options.attrs||{}});return this.options.processHandle&&this.options.processHandle(i),this.updateHandle(i,t,e),this.container.appendChild(i.container),this.startHandleListening(i),i}startHandleListening(t){t.on("change",this.onHandleChange,this),t.on("changing",this.onHandleChanging,this),t.on("changed",this.onHandleChanged,this)}stopHandleListening(t){t.off("change",this.onHandleChange,this),t.off("changing",this.onHandleChanging,this),t.off("changed",this.onHandleChanged,this)}resetHandles(){const t=this.handles;this.handles=[],t&&t.forEach(t=>{this.stopHandleListening(t),t.remove()})}shiftHandleIndexes(t){const e=this.handles;for(let n=0,i=e.length;n<i;n+=1)e[n].options.index+=t}resetAnchor(t,e){const n=this.cellView.cell,i={ui:!0,toolId:this.cid};e?n.prop([t,"anchor"],e,i):n.removeProp([t,"anchor"],i)}snapHandle(t,e,n){const i=t.options.axis,s=t.options.index,r=this.cellView,o=r.cell,a=o.getVertices(),l=a[s-2]||n.sourceAnchor,c=a[s+1]||n.targetAnchor,h=this.options.snapRadius;return Math.abs(e[i]-l[i])<h?e[i]=l[i]:Math.abs(e[i]-c[i])<h&&(e[i]=c[i]),e}onHandleChanging({handle:t,e:e}){const n=this.graph,i=this.options,s=this.cellView,r=i.anchor,o=t.options.axis,a=t.options.index-1,l=this.getEventData(e),c=this.normalizeEvent(e),h=n.snapToGrid(c.clientX,c.clientY),u=this.snapHandle(t,h.clone(),l),d=yh(this.vertices);let g=d[a],p=d[a+1];const f=s.sourceView,m=s.sourceBBox;let y=!1,b=!1;if(g?0===a?m.containsPoint(g)?(d.shift(),this.shiftHandleIndexes(-1),y=!0):(g[o]=u[o],b=!0):g[o]=u[o]:(g=s.sourceAnchor.toJSON(),g[o]=u[o],m.containsPoint(g)?y=!0:(d.unshift(g),this.shiftHandleIndexes(1),b=!0)),"function"===typeof r&&f){if(y){const t=l.sourceAnchor.clone();t[o]=u[o];const e=Pt(r,s,t,f,s.sourceMagnet||f.container,"source",s,this);this.resetAnchor("source",e)}b&&this.resetAnchor("source",l.sourceAnchorDef)}const v=s.targetView,x=s.targetBBox;let w=!1,C=!1;if(p?a===d.length-2?x.containsPoint(p)?(d.pop(),w=!0):(p[o]=u[o],C=!0):p[o]=u[o]:(p=s.targetAnchor.toJSON(),p[o]=u[o],x.containsPoint(p)?w=!0:(d.push(p),C=!0)),"function"===typeof r&&v){if(w){const t=l.targetAnchor.clone();t[o]=u[o];const e=Pt(r,s,t,v,s.targetMagnet||v.container,"target",s,this);this.resetAnchor("target",e)}C&&this.resetAnchor("target",l.targetAnchorDef)}Nb.equalPoints(d,this.vertices)||this.cellView.cell.setVertices(d,{ui:!0,toolId:this.cid}),this.updateHandle(t,g,p,0),i.stopPropagation||s.notifyMouseMove(c,h.x,h.y)}onHandleChange({handle:t,e:e}){const n=this.options,i=this.handles,s=this.cellView,r=t.options.index;if(Array.isArray(i)){for(let t=0,e=i.length;t<e;t+=1)t!==r&&i[t].hide();if(this.focus(),this.setEventData(e,{sourceAnchor:s.sourceAnchor.clone(),targetAnchor:s.targetAnchor.clone(),sourceAnchorDef:yh(this.cell.prop(["source","anchor"])),targetAnchorDef:yh(this.cell.prop(["target","anchor"]))}),this.cell.startBatch("move-segment",{ui:!0,toolId:this.cid}),!n.stopPropagation){const t=this.normalizeEvent(e),n=this.graph.snapToGrid(t.clientX,t.clientY);s.notifyMouseDown(t,n.x,n.y)}}}onHandleChanged({e:t}){const e=this.options,n=this.cellView;e.removeRedundancies&&n.removeRedundantLinearVertices({ui:!0,toolId:this.cid});const i=this.normalizeEvent(t),s=this.graph.snapToGrid(i.clientX,i.clientY);this.render(),this.blur(),this.cell.stopBatch("move-segment",{ui:!0,toolId:this.cid}),e.stopPropagation||n.notifyMouseUp(i,s.x,s.y),n.checkMouseleave(i),e.onChanged&&e.onChanged({edge:n.cell,edgeView:n})}updateHandle(t,e,n,i=0){const s=this.options.precision||0,r=Math.abs(e.x-n.x)<s,o=Math.abs(e.y-n.y)<s;if(r||o){const s=new kb(e,n),o=s.length();if(o<this.options.threshold)t.hide();else{const e=s.getCenter(),n=r?"x":"y";e[n]+=i||0;const o=s.vector().vectorAngle(new Nb(1,0));t.updatePosition(e.x,e.y,o,this.cellView),t.show(),t.options.axis=n}}else t.hide()}onRemove(){this.resetHandles()}}(function(t){class e extends Xw{constructor(t){super(),this.options=t,this.render(),this.delegateEvents({mousedown:"onMouseDown",touchstart:"onMouseDown"})}render(){this.container=Xw.createElement("rect",!0);const e=this.options.attrs;if("function"===typeof e){const n=t.getDefaults();this.setAttrs(Object.assign(Object.assign({},n.attrs),e(this)))}else this.setAttrs(e);this.addClass(this.prefixClassName("edge-tool-segment"))}updatePosition(t,e,n,i){const s=i.getClosestPoint(new Nb(t,e))||new Nb(t,e);let r=Dy().translate(s.x,s.y);if(s.equals({x:t,y:e}))r=r.rotate(n);else{const n=new kb(t,e,s.x,s.y);let i=n.vector().vectorAngle(new Nb(1,0));0!==i&&(i+=90),r=r.rotate(i)}this.setAttrs({transform:Ry(r),cursor:n%180===0?"row-resize":"col-resize"})}onMouseDown(t){this.options.guard(t)||(this.trigger("change",{e:t,handle:this}),t.stopPropagation(),t.preventDefault(),this.options.graph.view.undelegateEvents(),this.delegateDocumentEvents({mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},t.data))}onMouseMove(t){this.emit("changing",{e:t,handle:this})}onMouseUp(t){this.emit("changed",{e:t,handle:this}),this.undelegateDocumentEvents(),this.options.graph.view.delegateEvents()}show(){this.container.style.display=""}hide(){this.container.style.display="none"}}t.Handle=e})(yC||(yC={})),function(t){t.config({name:"segments",precision:.5,threshold:40,snapRadius:10,stopPropagation:!0,removeRedundancies:!0,attrs:{width:20,height:8,x:-10,y:-4,rx:4,ry:4,fill:"#333",stroke:"#fff","stroke-width":2},createHandle:e=>new t.Handle(e),anchor:uC})}(yC||(yC={}));class bC extends nC.ToolItem{get type(){return this.options.type}onRender(){Hf(this.container,this.prefixClassName(`edge-tool-${this.type}-anchor`)),this.toggleArea(!1),this.update()}update(){const t=this.type,e=this.cellView,n=e.getTerminalView(t);return n?(this.updateAnchor(),this.updateArea(),this.container.style.display=""):this.container.style.display="none",this}updateAnchor(){const t=this.childNodes;if(!t)return;const e=t.anchor;if(!e)return;const n=this.type,i=this.cellView,s=this.options,r=i.getTerminalAnchor(n),o=i.cell.prop([n,"anchor"]);e.setAttribute("transform",`translate(${r.x}, ${r.y})`);const a=o?s.customAnchorAttrs:s.defaultAnchorAttrs;a&&Object.keys(a).forEach(t=>{e.setAttribute(t,a[t])})}updateArea(){const t=this.childNodes;if(!t)return;const e=t.area;if(!e)return;const n=this.type,i=this.cellView,s=i.getTerminalView(n);if(s){const t=s.cell,r=i.getTerminalMagnet(n);let o,a,l,c=this.options.areaPadding||0;Number.isFinite(c)||(c=0),s.isEdgeElement(r)?(o=s.getBBox(),a=0,l=o.getCenter()):(o=s.getUnrotatedBBoxOfElement(r),a=t.getAngle(),l=o.getCenter(),a&&l.rotate(-a,t.getBBox().getCenter())),o.inflate(c),Mm(e,{x:-o.width/2,y:-o.height/2,width:o.width,height:o.height,transform:`translate(${l.x}, ${l.y}) rotate(${a})`})}}toggleArea(t){if(this.childNodes){const e=this.childNodes.area;e&&(e.style.display=t?"":"none")}}onMouseDown(t){this.guard(t)||(t.stopPropagation(),t.preventDefault(),this.graph.view.undelegateEvents(),this.options.documentEvents&&this.delegateDocumentEvents(this.options.documentEvents),this.focus(),this.toggleArea(this.options.restrictArea),this.cell.startBatch("move-anchor",{ui:!0,toolId:this.cid}))}resetAnchor(t){const e=this.type,n=this.cell;t?n.prop([e,"anchor"],t,{rewrite:!0,ui:!0,toolId:this.cid}):n.removeProp([e,"anchor"],{ui:!0,toolId:this.cid})}onMouseMove(t){const e=this.type,n=this.cellView,i=n.getTerminalView(e);if(null==i)return;const s=this.normalizeEvent(t),r=i.cell,o=n.getTerminalMagnet(e);let a=this.graph.coord.clientToLocalPoint(s.clientX,s.clientY);const l=this.options.snap;if("function"===typeof l){const t=Pt(l,n,a,i,o,e,n,this);a=Nb.create(t)}if(this.options.restrictArea)if(i.isEdgeElement(o)){const t=i.getClosestPoint(a);t&&(a=t)}else{const t=i.getUnrotatedBBoxOfElement(o),e=r.getAngle(),n=r.getBBox().getCenter(),s=a.clone().rotate(e,n);t.containsPoint(s)||(a=t.getNearestPointToPoint(s).rotate(-e,n))}let c;const h=this.options.anchor;"function"===typeof h&&(c=Pt(h,n,a,i,o,e,n,this)),this.resetAnchor(c),this.update()}onMouseUp(t){this.graph.view.delegateEvents(),this.undelegateDocumentEvents(),this.blur(),this.toggleArea(!1);const e=this.cellView;this.options.removeRedundancies&&e.removeRedundantLinearVertices({ui:!0,toolId:this.cid}),this.cell.stopBatch("move-anchor",{ui:!0,toolId:this.cid})}onDblClick(){const t=this.options.resetAnchor;t&&this.resetAnchor(!0===t?void 0:t),this.update()}}(function(t){t.config({tagName:"g",markup:[{tagName:"circle",selector:"anchor",attrs:{cursor:"pointer"}},{tagName:"rect",selector:"area",attrs:{"pointer-events":"none",fill:"none",stroke:"#33334F","stroke-dasharray":"2,4",rx:5,ry:5}}],events:{mousedown:"onMouseDown",touchstart:"onMouseDown",dblclick:"onDblClick"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},customAnchorAttrs:{"stroke-width":4,stroke:"#33334F",fill:"#FFFFFF",r:5},defaultAnchorAttrs:{"stroke-width":2,stroke:"#FFFFFF",fill:"#33334F",r:6},areaPadding:6,snapRadius:10,resetAnchor:!0,restrictArea:!0,removeRedundancies:!0,anchor:uC,snap(t,e,n,i,s,r){const o=r.options.snapRadius||0,a="source"===i,l=a?0:-1,c=this.cell.getVertexAt(l)||this.getTerminalAnchor(a?"target":"source");return c&&(Math.abs(c.x-t.x)<o&&(t.x=c.x),Math.abs(c.y-t.y)<o&&(t.y=c.y)),t}})})(bC||(bC={}));const vC=bC.define({name:"source-anchor",type:"source"}),xC=bC.define({name:"target-anchor",type:"target"});var wC=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class CC extends nC.ToolItem{get type(){return this.options.type}get ratio(){return this.options.ratio}init(){if(this.options.attrs){const t=this.options.attrs,{class:e}=t,n=wC(t,["class"]);this.setAttrs(n,this.container),e&&Hf(this.container,e)}}onRender(){Hf(this.container,this.prefixClassName(`edge-tool-${this.type}-arrowhead`)),this.update()}update(){const t=this.ratio,e=this.cellView,n=e.getTangentAtRatio(t),i=n?n.start:e.getPointAtRatio(t),s=n&&n.vector().vectorAngle(new Nb(1,0))||0;if(!i)return this;const r=Dy().translate(i.x,i.y).rotate(s);return Hy(this.container,r,{absolute:!0}),this}onMouseDown(t){if(this.guard(t))return;t.stopPropagation(),t.preventDefault();const e=this.cellView;if(e.can("arrowheadMovable")){e.cell.startBatch("move-arrowhead",{ui:!0,toolId:this.cid});const n=this.graph.snapToGrid(t.clientX,t.clientY),i=e.prepareArrowheadDragging(this.type,{x:n.x,y:n.y,options:Object.assign(Object.assign({},this.options),{toolId:this.cid})});this.cellView.setEventData(t,i),this.delegateDocumentEvents(this.options.documentEvents,t.data),e.graph.view.undelegateEvents(),this.container.style.pointerEvents="none"}this.focus()}onMouseMove(t){const e=this.normalizeEvent(t),n=this.graph.snapToGrid(e.clientX,e.clientY);this.cellView.onMouseMove(e,n.x,n.y),this.update()}onMouseUp(t){this.undelegateDocumentEvents();const e=this.normalizeEvent(t),n=this.cellView,i=this.graph.snapToGrid(e.clientX,e.clientY);n.onMouseUp(e,i.x,i.y),this.graph.view.delegateEvents(),this.blur(),this.container.style.pointerEvents="",n.cell.stopBatch("move-arrowhead",{ui:!0,toolId:this.cid})}}(function(t){t.config({tagName:"path",isSVGElement:!0,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}})})(CC||(CC={}));const PC=CC.define({name:"source-arrowhead",type:"source",ratio:0,attrs:{d:"M 10 -8 -10 0 10 8 Z",fill:"#333",stroke:"#fff","stroke-width":2,cursor:"move"}}),EC=CC.define({name:"target-arrowhead",type:"target",ratio:1,attrs:{d:"M -10 -8 10 0 -10 8 Z",fill:"#333",stroke:"#fff","stroke-width":2,cursor:"move"}});class MC extends nC.ToolItem{constructor(){super(...arguments),this.labelIndex=-1,this.distance=.5,this.dblClick=this.onCellDblClick.bind(this)}onRender(){const t=this.cellView;t&&t.on("cell:dblclick",this.dblClick)}createElement(){const t=[this.prefixClassName((this.cell.isEdge()?"edge":"node")+"-tool-editor"),this.prefixClassName("cell-tool-editor")];this.editor=nC.createElement("div",!1),this.addClass(t,this.editor),this.editor.contentEditable="true",this.container.appendChild(this.editor)}removeElement(){this.undelegateDocumentEvents(),this.editor&&(this.container.removeChild(this.editor),this.editor=null)}updateEditor(){const{cell:t,editor:e}=this;if(!e)return;const{style:n}=e;t.isNode()?this.updateNodeEditorTransform():t.isEdge()&&this.updateEdgeEditorTransform();const{attrs:i}=this.options;n.fontSize=`${i.fontSize}px`,n.fontFamily=i.fontFamily,n.color=i.color,n.backgroundColor=i.backgroundColor;const s=this.getCellText()||"";return e.innerText=s,this.setCellText(""),this}updateNodeEditorTransform(){const{graph:t,cell:e,editor:n}=this;if(!n)return;let i=Nb.create(),s=20,r="",{x:o,y:a}=this.options;const{width:l,height:c}=this.options;if("undefined"!==typeof o&&"undefined"!==typeof a){const t=e.getBBox();o=xf(o,t.width),a=xf(a,t.height),i=t.topLeft.translate(o,a),s=t.width-2*o}else{const t=e.getBBox();i=t.center,s=t.width-4,r="translate(-50%, -50%)"}const h=t.scale(),{style:u}=n;i=t.localToGraph(i),u.left=`${i.x}px`,u.top=`${i.y}px`,u.transform=`scale(${h.sx}, ${h.sy}) ${r}`,u.minWidth=`${s}px`,"number"===typeof l&&(u.width=`${l}px`),"number"===typeof c&&(u.height=`${c}px`)}updateEdgeEditorTransform(){if(!this.event)return;const{graph:t,editor:e}=this;if(!e)return;let n=Nb.create(),i=20;const{style:s}=e,r=this.event.target,o=r.parentElement,a=o&&_f(o,this.prefixClassName("edge-label"));if(a){const t=o.getAttribute("data-index")||"0";this.labelIndex=parseInt(t,10);const e=o.getAttribute("transform"),{translation:s}=Vy(e);n=new Nb(s.tx,s.ty),i=cw.getBBox(r).width}else{if(!this.options.labelAddable)return this;n=t.clientToLocal(Nb.create(this.event.clientX,this.event.clientY));const e=this.cellView,i=e.path.closestPointLength(n);this.distance=i,this.labelIndex=-1}n=t.localToGraph(n);const l=t.scale();s.left=`${n.x}px`,s.top=`${n.y}px`,s.minWidth=`${i}px`,s.transform=`scale(${l.sx}, ${l.sy}) translate(-50%, -50%)`}onDocumentMouseUp(t){if(this.editor&&t.target!==this.editor){const t=this.editor.innerText.replace(/\n$/,"")||"";this.setCellText(""!==t?t:null),this.removeElement()}}onCellDblClick({e:t}){this.editor||(t.stopPropagation(),this.removeElement(),this.event=t,this.createElement(),this.updateEditor(),this.autoFocus(),this.delegateDocumentEvents(this.options.documentEvents))}onMouseDown(t){t.stopPropagation()}autoFocus(){setTimeout(()=>{this.editor&&(this.editor.focus(),this.selectText())})}selectText(){if(window.getSelection&&this.editor){const t=document.createRange(),e=window.getSelection();t.selectNodeContents(this.editor),e.removeAllRanges(),e.addRange(t)}}getCellText(){const{getText:t}=this.options;if("function"===typeof t)return Pt(t,this.cellView,{cell:this.cell,index:this.labelIndex});if("string"===typeof t){if(this.cell.isNode())return this.cell.attr(t);if(this.cell.isEdge()&&-1!==this.labelIndex)return this.cell.prop(`labels/${this.labelIndex}/attrs/${t}`)}}setCellText(t){const e=this.options.setText;if("function"!==typeof e){if("string"===typeof e){if(this.cell.isNode())return void(null!==t&&this.cell.attr(e,t));if(this.cell.isEdge()){const n=this.cell;if(-1===this.labelIndex){if(t){const i={position:{distance:this.distance},attrs:{}};$h(i,`attrs/${e}`,t),n.appendLabel(i)}}else null!==t?n.prop(`labels/${this.labelIndex}/attrs/${e}`,t):"number"===typeof this.labelIndex&&n.removeLabelAt(this.labelIndex)}}}else Pt(e,this.cellView,{cell:this.cell,value:t,index:this.labelIndex,distance:this.distance})}onRemove(){const t=this.cellView;t&&t.off("cell:dblclick",this.dblClick),this.removeElement()}}(function(t){t.config({tagName:"div",isSVGElement:!1,events:{mousedown:"onMouseDown",touchstart:"onMouseDown"},documentEvents:{mouseup:"onDocumentMouseUp",touchend:"onDocumentMouseUp",touchcancel:"onDocumentMouseUp"}})})(MC||(MC={})),function(t){t.NodeEditor=t.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},getText:"text/text",setText:"text/text"}),t.EdgeEditor=t.define({attrs:{fontSize:14,fontFamily:"Arial, helvetica, sans-serif",color:"#000",backgroundColor:"#fff"},labelAddable:!0,getText:"label/text",setText:"label/text"})}(MC||(MC={}));var OC,AC,SC=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};(function(t){t.presets={boundary:fC,button:gC,"button-remove":gC.Remove,"node-editor":MC.NodeEditor},t.registry=ev.create({type:"node tool",process(t,e){if("function"===typeof e)return e;let n=nC.ToolItem;const{inherit:i}=e,s=SC(e,["inherit"]);if(i){const t=this.get(i);null==t?this.onNotFound(i,"inherited"):n=t}return null==s.name&&(s.name=t),n.define.call(n,s)}}),t.registry.register(t.presets,!0)})(OC||(OC={})),function(t){t.presets={boundary:fC,vertices:mC,segments:yC,button:gC,"button-remove":gC.Remove,"source-anchor":vC,"target-anchor":xC,"source-arrowhead":PC,"target-arrowhead":EC,"edge-editor":MC.EdgeEditor},t.registry=ev.create({type:"edge tool",process(t,e){if("function"===typeof e)return e;let n=nC.ToolItem;const{inherit:i}=e,s=SC(e,["inherit"]);if(i){const t=this.get(i);null==t?this.onNotFound(i,"inherited"):n=t}return null==s.name&&(s.name=t),n.define.call(n,s)}}),t.registry.register(t.presets,!0)}(AC||(AC={}));const NC=VC("center"),TC=VC("topCenter"),kC=VC("bottomCenter"),jC=VC("leftMiddle"),LC=VC("rightMiddle"),DC=VC("topLeft"),BC=VC("topRight"),IC=VC("bottomLeft"),RC=VC("bottomRight");function VC(t){return function(e,n,i,s={}){let r;r=e.cell.visible?s.rotate?e.getUnrotatedBBoxOfElement(n):e.getBBoxOfElement(n):e.cell.getBBox();const o=r[t];o.x+=xf(s.dx,r.width),o.y+=xf(s.dy,r.height);const a=e.cell;return s.rotate?o.rotate(-a.getAngle(),a.getBBox().getCenter()):o}}function zC(t){return function(e,n,i,s){if(i instanceof Element){const r=this.graph.findViewByElem(i);let o;if(r)if(r.isEdgeElement(i)){const t=null!=s.fixedAt?s.fixedAt:"50%";o=$C(r,t)}else o=r.getBBoxOfElement(i).getCenter();else o=new Nb;return t.call(this,e,n,o,s)}return t.apply(this,arguments)}}function $C(t,e){const n=vf(e),i="string"===typeof e?parseFloat(e):e;return n?t.getPointAtRatio(i/100):t.getPointAtLength(i)}const FC=function(t,e,n,i){const s=Ob.normalize(t.cell.getAngle()),r=t.cell.visible?t.getBBoxOfElement(e):t.cell.getBBox(),o=r.getCenter(),a=r.getTopLeft(),l=r.getBottomRight();let c=i.padding;if(Number.isFinite(c)||(c=0),a.y+c<=n.y&&n.y<=l.y-c){const t=n.y-o.y;o.x+=0===s||180===s?0:1*t/Math.tan(Ob.toRad(s)),o.y+=t}else if(a.x+c<=n.x&&n.x<=l.x-c){const t=n.x-o.x;o.y+=90===s||270===s?0:t*Math.tan(Ob.toRad(s)),o.x+=t}return o},GC=zC(FC),_C=function(t,e,n,i,s){const r=t.cell.getConnectionPoint(this.cell,s);return(i.dx||i.dy)&&r.translate(i.dx||0,i.dy||0),r},HC=function(t,e,n,i){let s,r,o=0;const a=t.cell;i.rotate?(s=t.getUnrotatedBBoxOfElement(e),r=a.getBBox().getCenter(),o=a.getAngle()):s=a.visible?t.getBBoxOfElement(e):t.cell.getBBox();const l=i.padding;null!=l&&Number.isFinite(l)&&s.inflate(l),i.rotate&&n.rotate(o,r);const c=s.getNearestSideToPoint(n);let h;switch(c){case"left":h=s.getLeftMiddle();break;case"right":h=s.getRightMiddle();break;case"top":h=s.getTopCenter();break;case"bottom":h=s.getBottomCenter();break;default:break}const u=i.direction;return"H"===u?"top"!==c&&"bottom"!==c||(h=n.x<=s.x+s.width?s.getLeftMiddle():s.getRightMiddle()):"V"===u&&(h=n.y<=s.y+s.height?s.getTopCenter():s.getBottomCenter()),i.rotate?h.rotate(-o,r):h},UC=zC(HC);var JC;(function(t){t.presets=m,t.registry=ev.create({type:"node endpoint"}),t.registry.register(t.presets,!0)})(JC||(JC={}));const qC=function(t,e,n,i){let s=null!=i.ratio?i.ratio:.5;return s>1&&(s/=100),t.getPointAtRatio(s)},WC=function(t,e,n,i){const s=null!=i.length?i.length:20;return t.getPointAtLength(s)},XC=function(t,e,n,i){const s=t.getClosestPoint(n);return null!=s?s:new Nb},YC=zC(XC),ZC=function(t,e,n,i){const s=1e6,r=t.getConnection(),o=t.getConnectionSubdivisions(),a=new kb(n.clone().translate(0,s),n.clone().translate(0,-s)),l=new kb(n.clone().translate(s,0),n.clone().translate(-s,0)),c=a.intersect(r,{segmentSubdivisions:o}),h=l.intersect(r,{segmentSubdivisions:o}),u=[];return c&&u.push(...c),h&&u.push(...h),u.length>0?n.closest(u):null!=i.fallbackAt?$C(t,i.fallbackAt):Pt(XC,this,t,e,n,i)},KC=zC(ZC);var QC;function tP(t,e,n){let i;if("object"===typeof n){if(Number.isFinite(n.y)){const i=new kb(e,t),{start:s,end:r}=i.parallel(n.y);e=s,t=r}i=n.x}else i=n;if(null==i||!Number.isFinite(i))return t;const s=t.distance(e);return 0===i&&s>0?t:t.move(e,-Math.min(i,s-1))}function eP(t){const e=t.getAttribute("stroke-width");return null===e?0:parseFloat(e)||0}function nP(t){if(null==t)return null;let e=t;do{let t=e.tagName;if("string"!==typeof t)return null;if(t=t.toUpperCase(),"G"===t)e=e.firstElementChild;else{if("TITLE"!==t)break;e=e.nextElementSibling}}while(e);return e}(function(t){t.presets=y,t.registry=ev.create({type:"edge endpoint"}),t.registry.register(t.presets,!0)})(QC||(QC={}));const iP=function(t,e,n,i){const s=e.getBBoxOfElement(n);i.stroked&&s.inflate(eP(n)/2);const r=t.intersect(s),o=r&&r.length?t.start.closest(r):t.end;return tP(o,t.start,i.offset)},sP=function(t,e,n,i,s){const r=e.cell,o=r.isNode()?r.getAngle():0;if(0===o)return Pt(iP,this,t,e,n,i,s);const a=e.getUnrotatedBBoxOfElement(n);i.stroked&&a.inflate(eP(n)/2);const l=a.getCenter(),c=t.clone().rotate(o,l),h=c.setLength(1e6).intersect(a),u=h&&h.length?c.start.closest(h).rotate(-o,l):t.end;return tP(u,t.start,i.offset)},rP=function(t,e,n,i){let s,r;const o=t.end,a=i.selector;if(s="string"===typeof a?e.findOne(a):Array.isArray(a)?zh(n,a):nP(n),!Yf(s)){if(s===n||!Yf(n))return o;s=n}const l=e.getShapeOfElement(s),c=e.getMatrixOfElement(s),h=e.getRootTranslatedMatrix(),u=e.getRootRotatedMatrix(),d=h.multiply(u).multiply(c),g=d.inverse(),p=cw.transformLine(t,g),f=p.start.clone(),m=e.getDataOfElement(s);if(!1===i.insideout){null==m.shapeBBox&&(m.shapeBBox=l.bbox());const t=m.shapeBBox;if(null!=t&&t.containsPoint(f))return o}let y;if(!0===i.extrapolate&&p.setLength(1e6),tv.isPath(l)){const t=i.precision||2;null==m.segmentSubdivisions&&(m.segmentSubdivisions=l.getSegmentSubdivisions({precision:t})),y={precision:t,segmentSubdivisions:m.segmentSubdivisions},r=p.intersect(l,y)}else r=p.intersect(l);r?Array.isArray(r)&&(r=f.closest(r)):!0===i.sticky&&(r=Tb.isRectangle(l)?l.getNearestPointToPoint(f):jb.isEllipse(l)?l.intersectsWithLineFromCenterToPoint(f):l.closestPoint(f,y));const b=r?cw.transformPoint(r,d):o;let v=i.offset||0;return!1!==i.stroked&&("object"===typeof v?(v=Object.assign({},v),null==v.x&&(v.x=0),v.x+=eP(s)/2):v+=eP(s)/2),tP(b,t.start,v)};function oP(t,e,n=0){const{start:i,end:s}=t;let r,o,a,l;switch(e){case"left":l="x",r=s,o=i,a=-1;break;case"right":l="x",r=i,o=s,a=1;break;case"top":l="y",r=s,o=i,a=-1;break;case"bottom":l="y",r=i,o=s,a=1;break;default:return}i[l]<s[l]?r[l]=o[l]:o[l]=r[l],Number.isFinite(n)&&(r[l]+=a*n,o[l]+=a*n)}const aP=function(t,e,n,i){const{alignOffset:s,align:r}=i;return r&&oP(t,r,s),tP(t.end,t.start,i.offset)};var lP;(function(t){t.presets=b,t.registry=ev.create({type:"connection point"}),t.registry.register(t.presets,!0)})(lP||(lP={}));const cP=function(t){return[...t]},hP=function(t,e,n){const i=e.side||"bottom",s=wf(e.padding||40),r=n.sourceBBox,o=n.targetBBox,a=r.getCenter(),l=o.getCenter();let c,h,u;switch(i){case"top":u=-1,c="y",h="height";break;case"left":u=-1,c="x",h="width";break;case"right":u=1,c="x",h="width";break;case"bottom":default:u=1,c="y",h="height";break}return a[c]+=u*(r[h]/2+s[i]),l[c]+=u*(o[h]/2+s[i]),u*(a[c]-l[c])>0?l[c]=a[c]:a[c]=l[c],[a.toJSON(),...t,l.toJSON()]};function uP(t){return new Tb(t.x,t.y,0,0)}function dP(t={}){const e=wf(t.padding||20);return{x:-e.left,y:-e.top,width:e.left+e.right,height:e.top+e.bottom}}function gP(t,e={}){return t.sourceBBox.clone().moveAndExpand(dP(e))}function pP(t,e={}){return t.targetBBox.clone().moveAndExpand(dP(e))}function fP(t,e={}){if(t.sourceAnchor)return t.sourceAnchor;const n=gP(t,e);return n.getCenter()}function mP(t,e={}){if(t.targetAnchor)return t.targetAnchor;const n=pP(t,e);return n.getCenter()}const yP=function(t,e,n){let i=gP(n,e),s=pP(n,e);const r=fP(n,e),o=mP(n,e);i=i.union(uP(r)),s=s.union(uP(o));const a=t.map(t=>Nb.create(t));a.unshift(r),a.push(o);let l=null;const c=[];for(let h=0,u=a.length-1;h<u;h+=1){let t=null;const n=a[h],r=a[h+1],o=null!=bP.getBearing(n,r);if(0===h)h+1===u?i.intersectsWithRect(s.clone().inflate(1))?t=bP.insideNode(n,r,i,s):o||(t=bP.nodeToNode(n,r,i,s)):i.containsPoint(r)?t=bP.insideNode(n,r,i,uP(r).moveAndExpand(dP(e))):o||(t=bP.nodeToVertex(n,r,i));else if(h+1===u){const i=o&&bP.getBearing(r,n)===l;s.containsPoint(n)||i?t=bP.insideNode(n,r,uP(n).moveAndExpand(dP(e)),s,l):o||(t=bP.vertexToNode(n,r,s,l))}else o||(t=bP.vertexToVertex(n,r,l));t?(c.push(...t.points),l=t.direction):l=bP.getBearing(n,r),h+1<u&&c.push(r)}return c};var bP;(function(t){const e={N:"S",S:"N",E:"W",W:"E"},n={N:-Math.PI/2*3,S:-Math.PI/2,E:0,W:Math.PI};function i(t,e,n){let i=new Nb(t.x,e.y);return n.containsPoint(i)&&(i=new Nb(e.x,t.y)),i}function s(t,e){return t["W"===e||"E"===e?"width":"height"]}function r(t,e){return t.x===e.x?t.y>e.y?"N":"S":t.y===e.y?t.x>e.x?"W":"E":null}function o(t,n,i){const s=new Nb(t.x,n.y),o=new Nb(n.x,t.y),a=r(t,s),l=r(t,o),c=i?e[i]:null,h=a===i||a!==c&&(l===c||l!==i)?s:o;return{points:[h],direction:r(h,n)}}function a(t,e,n){const s=i(t,e,n);return{points:[s],direction:r(s,e)}}function l(t,e,n,o){const a=[new Nb(t.x,e.y),new Nb(e.x,t.y)],l=a.filter(t=>!n.containsPoint(t)),c=l.filter(e=>r(e,t)!==o);let h;if(c.length>0)return h=c.filter(e=>r(t,e)===o).pop(),h=h||c[0],{points:[h],direction:r(h,e)};{h=Ld(a,l)[0];const c=Nb.create(e).move(h,-s(n,o)/2),u=i(c,t,n);return{points:[u,c],direction:r(c,e)}}}function c(t,e,n,i){let l=a(e,t,i);const c=l.points[0];if(n.containsPoint(c)){l=a(t,e,n);const h=l.points[0];if(i.containsPoint(h)){const u=Nb.create(t).move(h,-s(n,r(t,h))/2),d=Nb.create(e).move(c,-s(i,r(e,c))/2),g=new kb(u,d).getCenter(),p=a(t,g,n),f=o(g,e,p.direction);l.points=[p.points[0],f.points[0]],l.direction=f.direction}}return l}function h(t,e,s,o,a){const l=s.union(o).inflate(1),c=l.getCenter(),h=c.distance(e)>c.distance(t),u=h?e:t,d=h?t:e;let g,p,f,m;a?(g=Nb.fromPolar(l.width+l.height,n[a],u),g=l.getNearestPointToPoint(g).move(g,-1)):g=l.getNearestPointToPoint(u).move(u,1),p=i(g,d,l),g.round().equals(p.round())?(p=Nb.fromPolar(l.width+l.height,Ob.toRad(g.theta(u))+Math.PI/2,d),p=l.getNearestPointToPoint(p).move(d,1).round(),f=i(g,p,l),m=h?[p,f,g]:[g,f,p]):m=h?[p,g]:[g,p];const y=r(h?g:p,e);return{points:m,direction:y}}t.getBBoxSize=s,t.getBearing=r,t.vertexToVertex=o,t.nodeToVertex=a,t.vertexToNode=l,t.nodeToNode=c,t.insideNode=h})(bP||(bP={}));const vP={step:10,maxLoopCount:2e3,precision:1,maxDirectionChange:90,perpendicular:!0,excludeTerminals:[],excludeNodes:[],excludeShapes:[],startDirections:["top","right","bottom","left"],endDirections:["top","right","bottom","left"],directionMap:{top:{x:0,y:-1},right:{x:1,y:0},bottom:{x:0,y:1},left:{x:-1,y:0}},cost(){const t=xP(this.step,this);return t},directions(){const t=xP(this.step,this),e=xP(this.cost,this);return[{cost:e,offsetX:t,offsetY:0},{cost:e,offsetX:-t,offsetY:0},{cost:e,offsetX:0,offsetY:t},{cost:e,offsetX:0,offsetY:-t}]},penalties(){const t=xP(this.step,this);return{0:0,45:t/2,90:t/2}},paddingBox(){const t=xP(this.step,this);return{x:-t,y:-t,width:2*t,height:2*t}},fallbackRouter:yP,draggingRouter:null,snapToGrid:!0};function xP(t,e){return"function"===typeof t?t.call(e):t}function wP(t){const e=Object.keys(t).reduce((e,n)=>{const i=e;return i[n]="fallbackRouter"===n||"draggingRouter"===n||"fallbackRoute"===n?t[n]:xP(t[n],t),e},{});if(e.padding){const t=wf(e.padding);e.paddingBox={x:-t.left,y:-t.top,width:t.left+t.right,height:t.top+t.bottom}}return e.directions.forEach(t=>{const e=new Nb(0,0),n=new Nb(t.offsetX,t.offsetY);t.angle=Ob.normalize(e.theta(n))}),e}const CP=1,PP=2;class EP{constructor(){this.items=[],this.hash={},this.values={}}add(t,e){this.hash[t]?this.items.splice(this.items.indexOf(t),1):this.hash[t]=CP,this.values[t]=e;const n=td(this.items,t,t=>this.values[t]);this.items.splice(n,0,t)}pop(){const t=this.items.shift();return t&&(this.hash[t]=PP),t}isOpen(t){return this.hash[t]===CP}isClose(t){return this.hash[t]===PP}isEmpty(){return 0===this.items.length}}class MP{constructor(t){this.options=t,this.mapGridSize=100,this.map={}}build(t,e){const n=this.options,i=n.excludeTerminals.reduce((n,i)=>{const s=e[i];if(s){const e=t.getCell(s.cell);e&&n.push(e)}return n},[]);let s=[];const r=t.getCell(e.getSourceCellId());r&&(s=pu(s,r.getAncestors().map(t=>t.id)));const o=t.getCell(e.getTargetCellId());o&&(s=pu(s,o.getAncestors().map(t=>t.id)));const a=this.mapGridSize;return t.getNodes().reduce((t,e)=>{const r=i.some(t=>t.id===e.id),o=!!e.shape&&n.excludeShapes.includes(e.shape),l=n.excludeNodes.some(t=>"string"===typeof t?e.id===t:t===e),c=s.includes(e.id),h=o||r||l||c;if(e.isVisible()&&!h){const i=e.getBBox().moveAndExpand(n.paddingBox),s=i.getOrigin().snapToGrid(a),r=i.getCorner().snapToGrid(a);for(let e=s.x;e<=r.x;e+=a)for(let n=s.y;n<=r.y;n+=a){const s=new Nb(e,n).toString();null==t[s]&&(t[s]=[]),t[s].push(i)}}return t},this.map),this}isAccessible(t){const e=t.clone().snapToGrid(this.mapGridSize).toString(),n=this.map[e];return!n||n.every(e=>!e.containsPoint(t))}}function OP(t,e){const n=t.sourceBBox.clone();return e&&e.paddingBox?n.moveAndExpand(e.paddingBox):n}function AP(t,e){const n=t.targetBBox.clone();return e&&e.paddingBox?n.moveAndExpand(e.paddingBox):n}function SP(t,e){if(t.sourceAnchor)return t.sourceAnchor;const n=OP(t,e);return n.getCenter()}function NP(t,e){if(t.targetAnchor)return t.targetAnchor;const n=AP(t,e);return n.getCenter()}function TP(t,e,n,i,s){const r=360/n,o=t.theta(kP(t,e,i,s)),a=Ob.normalize(o+r/2);return r*Math.floor(a/r)}function kP(t,e,n,i){const s=i.step,r=e.x-t.x,o=e.y-t.y,a=r/n.x,l=o/n.y,c=a*s,h=l*s;return new Nb(t.x+c,t.y+h)}function jP(t,e){const n=Math.abs(t-e);return n>180?360-n:n}function LP(t,e){const n=e.step;return e.directions.forEach(e=>{e.gridOffsetX=e.offsetX/n*t.x,e.gridOffsetY=e.offsetY/n*t.y}),e.directions}function DP(t,e,n){return{source:e.clone(),x:BP(n.x-e.x,t),y:BP(n.y-e.y,t)}}function BP(t,e){if(!t)return e;const n=Math.abs(t),i=Math.round(n/e);if(!i)return n;const s=i*e,r=n-s,o=r/i;return e+o}function IP(t,e){const n=e.source,i=Ab.snapToGrid(t.x-n.x,e.x)+n.x,s=Ab.snapToGrid(t.y-n.y,e.y)+n.y;return new Nb(i,s)}function RP(t,e){return t.round(e)}function VP(t,e,n){return RP(IP(t.clone(),e),n)}function zP(t){return t.toString()}function $P(t){return new Nb(0===t.x?0:Math.abs(t.x)/t.x,0===t.y?0:Math.abs(t.y)/t.y)}function FP(t,e){let n=1/0;for(let i=0,s=e.length;i<s;i+=1){const s=t.manhattanDistance(e[i]);s<n&&(n=s)}return n}function GP(t,e,n,i,s){const r=s.precision,o=s.directionMap,a=t.diff(e.getCenter()),l=Object.keys(o).reduce((s,l)=>{if(n.includes(l)){const n=o[l],c=new Nb(t.x+n.x*(Math.abs(a.x)+e.width),t.y+n.y*(Math.abs(a.y)+e.height)),h=new kb(t,c),u=h.intersect(e)||[];let d,g=null;for(let e=0;e<u.length;e+=1){const n=u[e],i=t.squaredDistance(n);(null==d||i>d)&&(d=i,g=n)}if(g){let t=VP(g,i,r);e.containsPoint(t)&&(t=VP(t.translate(n.x*i.x,n.y*i.y),i,r)),s.push(t)}}return s},[]);return e.containsPoint(t)||l.push(VP(t,i,r)),l}function _P(t,e,n,i,s){const r=[];let o,a=$P(s.diff(n)),l=zP(n),c=t[l];while(c){o=e[l];const n=$P(o.diff(c));n.equals(a)||(r.unshift(o),a=n),l=zP(c),c=t[l]}const h=e[l],u=$P(h.diff(i));return u.equals(a)||r.unshift(h),r}function HP(t,e,n,i,s){const r=s.precision;let o,a;o=Tb.isRectangle(e)?RP(SP(t,s).clone(),r):RP(e.clone(),r),a=Tb.isRectangle(n)?RP(NP(t,s).clone(),r):RP(n.clone(),r);const l=DP(s.step,o,a),c=o,h=a;let u,d;if(u=Tb.isRectangle(e)?GP(c,e,s.startDirections,l,s):[c],d=Tb.isRectangle(n)?GP(a,n,s.endDirections,l,s):[h],u=u.filter(t=>i.isAccessible(t)),d=d.filter(t=>i.isAccessible(t)),u.length>0&&d.length>0){const t=new EP,e={},n={},o={};for(let i=0,s=u.length;i<s;i+=1){const n=u[i],s=zP(n);t.add(s,FP(n,d)),e[s]=n,o[s]=0}const a=s.previousDirectionAngle,g=void 0===a;let p,f;const m=LP(l,s),y=m.length,b=d.reduce((t,e)=>{const n=zP(e);return t.push(n),t},[]),v=Nb.equalPoints(u,d);let x=s.maxLoopCount;while(!t.isEmpty()&&x>0){const u=t.pop(),w=e[u],C=n[u],P=o[u],E=w.equals(c),M=null==C;let O;O=M?g?E?null:TP(c,w,y,l,s):a:TP(C,w,y,l,s);const A=M&&v;if(!A&&b.indexOf(u)>=0)return s.previousDirectionAngle=O,_P(n,e,w,c,h);for(let a=0;a<y;a+=1){p=m[a];const c=p.angle;if(f=jP(O,c),(!g||!E)&&f>s.maxDirectionChange)continue;const u=VP(w.clone().translate(p.gridOffsetX||0,p.gridOffsetY||0),l,r),v=zP(u);if(t.isClose(v)||!i.isAccessible(u))continue;if(b.indexOf(v)>=0){const t=u.equals(h);if(!t){const t=TP(u,h,y,l,s),e=jP(c,t);if(e>s.maxDirectionChange)continue}}const x=p.cost,C=E?0:s.penalties[f],M=P+x+C;(!t.isOpen(v)||M<o[v])&&(e[v]=u,n[v]=w,o[v]=M,t.add(v,M+FP(u,d)))}x-=1}}return s.fallbackRoute?Pt(s.fallbackRoute,this,c,h,s):null}function UP(t,e=10){if(t.length<=1)return t;for(let n=0,i=t.length;n<i-1;n+=1){const i=t[n],s=t[n+1];if(i.x===s.x){const t=e*Math.round(i.x/e);i.x!==t&&(i.x=t,s.x=t)}else if(i.y===s.y){const t=e*Math.round(i.y/e);i.y!==t&&(i.y=t,s.y=t)}}return t}const JP=function(t,e,n){const i=wP(e),s=OP(n,i),r=AP(n,i),o=SP(n,i),a=new MP(i).build(n.graph.model,n.cell),l=t.map(t=>Nb.create(t)),c=[];let h,u,d=o;for(let g=0,p=l.length;g<=p;g+=1){let e=null;if(h=u||s,u=l[g],null==u){u=r;const t=n.cell,a=null==t.getSourceCellId()||null==t.getTargetCellId();if(a&&"function"===typeof i.draggingRouter){const t=h===s?o:h,r=u.getOrigin();e=Pt(i.draggingRouter,n,t,r,i)}}if(null==e&&(e=HP(n,h,u,a,i)),null===e)return console.warn("Unable to execute manhattan algorithm, use orth instead"),Pt(i.fallbackRouter,this,t,i,n);const p=e[0];p&&p.equals(d)&&e.shift(),d=e[e.length-1]||d,c.push(...e)}return i.snapToGrid?UP(c,n.graph.grid.getGridSize()):c},qP=function(t,e,n){return Pt(JP,this,t,Object.assign(Object.assign({},vP),e),n)},WP={maxDirectionChange:45,directions(){const t=xP(this.step,this),e=xP(this.cost,this),n=Math.ceil(Math.sqrt(t*t<<1));return[{cost:e,offsetX:t,offsetY:0},{cost:n,offsetX:t,offsetY:t},{cost:e,offsetX:0,offsetY:t},{cost:n,offsetX:-t,offsetY:t},{cost:e,offsetX:-t,offsetY:0},{cost:n,offsetX:-t,offsetY:-t},{cost:e,offsetX:0,offsetY:-t},{cost:n,offsetX:t,offsetY:-t}]},fallbackRoute(t,e,n){const i=t.theta(e),s=[];let r={x:e.x,y:t.y},o={x:t.x,y:e.y};if(i%180>90){const t=r;r=o,o=t}const a=i%90<45?r:o,l=new kb(t,a),c=90*Math.ceil(i/90),h=Nb.fromPolar(l.squaredLength(),Ob.toRad(c+135),a),u=new kb(e,h),d=l.intersectsWithLine(u),g=d||e,p=d?g:t,f=360/n.directions.length,m=p.theta(e),y=Ob.normalize(m+f/2),b=f*Math.floor(y/f);return n.previousDirectionAngle=b,g&&s.push(g.round()),s.push(e),s}},XP=function(t,e,n){return Pt(qP,this,t,Object.assign(Object.assign({},WP),e),n)},YP=function(t,e,n){const i=e.offset||32,s=null==e.min?16:e.min;let r=0,o=e.direction;const a=n.sourceBBox,l=n.targetBBox,c=a.getCenter(),h=l.getCenter();if("number"===typeof i&&(r=i),null==o){let t=l.left-a.right,e=l.top-a.bottom;t>=0&&e>=0?o=t>=e?"L":"T":t<=0&&e>=0?(t=a.left-l.right,o=t>=0&&t>=e?"R":"T"):t>=0&&e<=0?(e=a.top-l.bottom,o=e>=0?t>=e?"L":"B":"L"):(t=a.left-l.right,e=a.top-l.bottom,o=t>=0&&e>=0?t>=e?"R":"B":t<=0&&e>=0?"B":t>=0&&e<=0||Math.abs(t)>Math.abs(e)?"R":"B")}let u,d,g;"H"===o?o=h.x-c.x>=0?"L":"R":"V"===o&&(o=h.y-c.y>=0?"T":"B"),"center"===i&&("L"===o?r=(l.left-a.right)/2:"R"===o?r=(a.left-l.right)/2:"T"===o?r=(l.top-a.bottom)/2:"B"===o&&(r=(a.top-l.bottom)/2));const p="L"===o||"R"===o;if(p){if(h.y===c.y)return[...t];g="L"===o?1:-1,u="x",d="width"}else{if(h.x===c.x)return[...t];g="T"===o?1:-1,u="y",d="height"}const f=c.clone(),m=h.clone();if(f[u]+=g*(a[d]/2+r),m[u]-=g*(l[d]/2+r),p){const t=f.x,e=m.x,n=a.width/2+s,i=l.width/2+s;h.x>c.x?e<=t&&(f.x=Math.max(e,c.x+n),m.x=Math.min(t,h.x-i)):e>=t&&(f.x=Math.min(e,c.x-n),m.x=Math.max(t,h.x+i))}else{const t=f.y,e=m.y,n=a.height/2+s,i=l.height/2+s;h.y>c.y?e<=t&&(f.y=Math.max(e,c.y+n),m.y=Math.min(t,h.y-i)):e>=t&&(f.y=Math.min(e,c.y-n),m.y=Math.max(t,h.y+i))}return[f.toJSON(),...t,m.toJSON()]};function ZP(t,e){if(null!=e&&!1!==e){const n="boolean"===typeof e?0:e;if(n>0){const e=Nb.create(t[1]).move(t[2],n),i=Nb.create(t[1]).move(t[0],n);return[e.toJSON(),...t,i.toJSON()]}{const e=t[1];return[Object.assign({},e),...t,Object.assign({},e)]}}return t}const KP=function(t,e,n){const i=e.width||50,s=e.height||80,r=s/2,o=e.angle||"auto",a=n.sourceAnchor,l=n.targetAnchor,c=n.sourceBBox,h=n.targetBBox;if(a.equals(l)){const t=t=>{const e=Ob.toRad(t),n=Math.sin(e),s=Math.cos(e),o=new Nb(a.x+s*i,a.y+n*i),l=new Nb(o.x-s*r,o.y-n*r),c=l.clone().rotate(-90,o),h=l.clone().rotate(90,o);return[c.toJSON(),o.toJSON(),h.toJSON()]},n=t=>{const e=a.clone().move(t,-1),n=new kb(e,t);return!c.containsPoint(t)&&!c.intersectsWithLine(n)},s=[0,90,180,270,45,135,225,315];if("number"===typeof o)return ZP(t(o),e.merge);const l=c.getCenter();if(l.equals(a))return ZP(t(0),e.merge);const h=l.angleBetween(a,l.clone().translate(1,0));let u=t(h);if(n(u[1]))return ZP(u,e.merge);for(let i=1,r=s.length;i<r;i+=1)if(u=t(h+s[i]),n(u[1]))return ZP(u,e.merge);return ZP(u,e.merge)}{const t=new kb(a,l);let s=t.parallel(-i),o=s.getCenter(),u=s.start.clone().move(s.end,r),d=s.end.clone().move(s.start,r);const g=t.parallel(-1),p=new kb(g.start,o),f=new kb(g.end,o);if((c.containsPoint(o)||h.containsPoint(o)||c.intersectsWithLine(p)||c.intersectsWithLine(f)||h.intersectsWithLine(p)||h.intersectsWithLine(f))&&(s=t.parallel(i),o=s.getCenter(),u=s.start.clone().move(s.end,r),d=s.end.clone().move(s.start,r)),e.merge){const t=new kb(a,l),e=new kb(o,t.center).setLength(Number.MAX_SAFE_INTEGER),i=c.intersectsWithLine(e),s=h.intersectsWithLine(e),r=i?Array.isArray(i)?i:[i]:[];s&&(Array.isArray(s)?r.push(...s):r.push(s));const u=t.center.closest(r);u?(n.sourceAnchor=u.clone(),n.targetAnchor=u.clone()):(n.sourceAnchor=t.center.clone(),n.targetAnchor=t.center.clone())}return ZP([u.toJSON(),o.toJSON(),d.toJSON()],e.merge)}};var QP;(function(t){t.presets=v,t.registry=ev.create({type:"router"}),t.registry.register(t.presets,!0)})(QP||(QP={}));const tE=function(t,e,n,i={}){const s=[t,...n,e],r=new $b(s),o=new tv(r);return i.raw?o:o.serialize()},eE=function(t,e,n,i={}){const s=3===n.length?0:1,r=Nb.create(n[0+s]),o=Nb.create(n[2+s]),a=Nb.create(n[1+s]);if(!Nb.equals(t,e)){const n=new Nb((t.x+e.x)/2,(t.y+e.y)/2),i=n.angleBetween(Nb.create(t).rotate(90,n),a);i>1&&(r.rotate(180-i,n),o.rotate(180-i,n),a.rotate(180-i,n))}const l=`\n M ${t.x} ${t.y}\n Q ${r.x} ${r.y} ${a.x} ${a.y}\n Q ${o.x} ${o.y} ${e.x} ${e.y}\n `;return i.raw?tv.parse(l):l},nE=function(t,e,n,i={}){const s=new tv;s.appendSegment(tv.createSegment("M",t));const r=1/3,o=2/3,a=i.radius||10;let l,c;for(let h=0,u=n.length;h<u;h+=1){const i=Nb.create(n[h]),u=n[h-1]||t,d=n[h+1]||e;l=c||i.distance(u)/2,c=i.distance(d)/2;const g=-Math.min(a,l),p=-Math.min(a,c),f=i.clone().move(u,g).round(),m=i.clone().move(d,p).round(),y=new Nb(r*f.x+o*i.x,o*i.y+r*f.y),b=new Nb(r*m.x+o*i.x,o*i.y+r*m.y);s.appendSegment(tv.createSegment("L",f)),s.appendSegment(tv.createSegment("C",y,b,m))}return s.appendSegment(tv.createSegment("L",e)),i.raw?s:s.serialize()},iE=function(t,e,n,i={}){let s,r=i.direction;if(n&&0!==n.length){const i=[t,...n,e],r=Fb.throughPoints(i);s=new tv(r)}else if(s=new tv,s.appendSegment(tv.createSegment("M",t)),r||(r=Math.abs(t.x-e.x)>=Math.abs(t.y-e.y)?"H":"V"),"H"===r){const n=(t.x+e.x)/2;s.appendSegment(tv.createSegment("C",n,t.y,n,e.y,e.x,e.y))}else{const n=(t.y+e.y)/2;s.appendSegment(tv.createSegment("C",t.x,n,e.x,n,e.x,e.y))}return i.raw?s:s.serialize()},sE=1,rE=1/3,oE=2/3;function aE(t){let e=t.graph._jumpOverUpdateList;if(null==e&&(e=t.graph._jumpOverUpdateList=[],t.graph.on("cell:mouseup",()=>{const e=t.graph._jumpOverUpdateList;setTimeout(()=>{for(let t=0;t<e.length;t+=1)e[t].update()})}),t.graph.on("model:reseted",()=>{e=t.graph._jumpOverUpdateList=[]})),e.indexOf(t)<0){e.push(t);const n=()=>e.splice(e.indexOf(t),1);t.cell.once("change:connector",n),t.cell.once("removed",n)}}function lE(t,e,n=[]){const i=[t,...n,e],s=[];return i.forEach((t,e)=>{const n=i[e+1];null!=n&&s.push(new kb(t,n))}),s}function cE(t,e){const n=[];return e.forEach(e=>{const i=t.intersectsWithLine(e);if(i){const{x:t,y:s}=i,{start:r,end:o}=e,a=Math.round(r.x)===Math.round(t)&&Math.round(r.y)===Math.round(s),l=Math.round(o.x)===Math.round(t)&&Math.round(o.y)===Math.round(s);if(a||l)return;n.push(i)}}),n}function hE(t,e){return new kb(t,e).squaredLength()}function uE(t,e,n){return e.reduce((i,s,r)=>{if(fE.includes(s))return i;const o=i.pop()||t,a=Nb.create(s).move(o.start,-n);let l=Nb.create(s).move(o.start,+n);const c=e[r+1];if(null!=c){const t=l.distance(c);t<=n&&(l=c.move(o.start,t),fE.push(c))}else{const t=a.distance(o.end);if(t<2*n+sE)return i.push(o),i}const h=l.distance(o.start);if(h<2*n+sE)return i.push(o),i;const u=new kb(a,l);return pE.push(u),i.push(new kb(o.start,a),u,new kb(l,o.end)),i},[])}function dE(t,e,n,i){const s=new tv;let r;return r=tv.createSegment("M",t[0].start),s.appendSegment(r),t.forEach((o,a)=>{if(pE.includes(o)){let t,i,a,l;if("arc"===n){t=-90,i=o.start.diff(o.end);const e=i.x<0||0===i.x&&i.y<0;e&&(t+=180);const n=o.getCenter(),c=new kb(n,o.end).rotate(t,n);let h;h=new kb(o.start,n),a=h.pointAt(2/3).rotate(t,o.start),l=c.pointAt(1/3).rotate(-t,c.end),r=tv.createSegment("C",a,l,c.end),s.appendSegment(r),h=new kb(n,o.end),a=c.pointAt(1/3).rotate(t,c.end),l=h.pointAt(1/3).rotate(-t,o.end),r=tv.createSegment("C",a,l,o.end),s.appendSegment(r)}else if("gap"===n)r=tv.createSegment("M",o.end),s.appendSegment(r);else if("cubic"===n){t=o.start.theta(o.end);const n=.6*e;let c=1.35*e;i=o.start.diff(o.end);const h=i.x<0||0===i.x&&i.y<0;h&&(c*=-1),a=new Nb(o.start.x+n,o.start.y+c).rotate(t,o.start),l=new Nb(o.end.x-n,o.end.y+c).rotate(t,o.end),r=tv.createSegment("C",a,l,o.end),s.appendSegment(r)}}else{const e=t[a+1];0===i||!e||pE.includes(e)?(r=tv.createSegment("L",o.end),s.appendSegment(r)):gE(i,s,o.end,o.start,e.end)}}),s}function gE(t,e,n,i,s){const r=n.distance(i)/2,o=n.distance(s)/2,a=-Math.min(t,r),l=-Math.min(t,o),c=n.clone().move(i,a).round(),h=n.clone().move(s,l).round(),u=new Nb(rE*c.x+oE*n.x,oE*n.y+rE*c.y),d=new Nb(rE*h.x+oE*n.x,oE*n.y+rE*h.y);let g;g=tv.createSegment("L",c),e.appendSegment(g),g=tv.createSegment("C",u,d,h),e.appendSegment(g)}let pE,fE;const mE=function(t,e,n,i={}){pE=[],fE=[],aE(this);const s=i.size||5,r=i.type||"arc",o=i.radius||0,a=i.ignoreConnectors||["smooth"],l=this.graph,c=l.model,h=c.getEdges();if(1===h.length)return dE(lE(t,e,n),s,r,o);const u=this.cell,d=h.indexOf(u),g=l.options.connecting.connector||{},p=h.filter((t,e)=>{const n=t.getConnector()||g;return!a.includes(n.name)&&(!(e>d)||"jumpover"!==n.name)}),f=p.map(t=>l.findViewByCell(t)),m=lE(t,e,n),y=f.map(t=>null==t?[]:t===this?m:lE(t.sourcePoint,t.targetPoint,t.routePoints)),b=[];m.forEach(t=>{const e=p.reduce((e,n,i)=>{if(n!==u){const n=cE(t,y[i]);e.push(...n)}return e},[]).sort((e,n)=>hE(t.start,e)-hE(t.start,n));e.length>0?b.push(...uE(t,e,s)):b.push(t)});const v=dE(b,s,r,o);return pE=[],fE=[],i.raw?v:v.serialize()};var yE;(function(t){t.presets=x,t.registry=ev.create({type:"connector"}),t.registry.register(t.presets,!0)})(yE||(yE={}));var bE=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class vE extends Hh{constructor(t={}){super(),this.pending=!1,this.changing=!1,this.data={},this.mutate(yh(t)),this.changed={}}mutate(t,e={}){const n=!0===e.unset,i=!0===e.silent,s=[],r=this.changing;this.changing=!0,r||(this.previous=yh(this.data),this.changed={});const o=this.data,a=this.previous,l=this.changed;if(Object.keys(t).forEach(e=>{const i=e,r=t[i];vl(o[i],r)||s.push(i),vl(a[i],r)?delete l[i]:l[i]=r,n?delete o[i]:o[i]=r}),!i&&s.length>0&&(this.pending=!0,this.pendingOptions=e,s.forEach(t=>{this.emit("change:*",{key:t,options:e,store:this,current:o[t],previous:a[t]})})),r)return this;if(!i)while(this.pending)this.pending=!1,this.emit("changed",{current:o,previous:a,store:this,options:this.pendingOptions});return this.pending=!1,this.changing=!1,this.pendingOptions=null,this}get(t,e){if(null==t)return this.data;const n=this.data[t];return null==n?e:n}getPrevious(t){if(this.previous){const e=this.previous[t];return null==e?void 0:e}}set(t,e,n){return null!=t&&("object"===typeof t?this.mutate(t,e):this.mutate({[t]:e},n)),this}remove(t,e){const n=void 0,i={};let s;if("string"===typeof t)i[t]=n,s=e;else if(Array.isArray(t))t.forEach(t=>i[t]=n),s=e;else{for(const t in this.data)i[t]=n;s=t}return this.mutate(i,Object.assign(Object.assign({},s),{unset:!0})),this}getByPath(t){return zh(this.data,t,"/")}setByPath(t,e,n={}){const i="/",s=Array.isArray(t)?[...t]:t.split(i),r=Array.isArray(t)?t.join(i):t,o=s[0],a=s.length;if(n.propertyPath=r,n.propertyValue=e,n.propertyPathArray=s,1===a)this.set(o,e,n);else{const r={};let l=r,c=o;for(let t=1;t<a;t+=1){const e=s[t],n=Number.isFinite(Number(e));l=l[c]=n?[]:{},c=e}$h(r,s,e,i);const h=yh(this.data);n.rewrite&&Fh(h,t,i);const u=jo(h,r);this.set(o,u[o],n)}return this}removeByPath(t,e){const n=Array.isArray(t)?t:t.split("/"),i=n[0];if(1===n.length)this.remove(i,e);else{const t=n.slice(1),s=yh(this.get(i));s&&Fh(s,t),this.set(i,s,e)}return this}hasChanged(t){return null==t?Object.keys(this.changed).length>0:t in this.changed}getChanges(t){if(null==t)return this.hasChanged()?yh(this.changed):null;const e=this.changing?this.previous:this.data,n={};let i;for(const s in t){const r=t[s];vl(e[s],r)||(n[s]=r,i=!0)}return i?yh(n):null}toJSON(){return yh(this.data)}clone(){const t=this.constructor;return new t(this.data)}dispose(){this.off(),this.data={},this.previous={},this.changed={},this.pending=!1,this.changing=!1,this.pendingOptions=null,this.trigger("disposed",{store:this})}}bE([Hh.dispose()],vE.prototype,"dispose",null);class xE{constructor(t){this.cell=t,this.ids={},this.cache={}}get(){return Object.keys(this.ids)}start(t,e,n={},i="/"){const s=this.cell.getPropByPath(t),r=wh(n,xE.defaultOptions),o=this.getTiming(r.timing),a=this.getInterp(r.interp,s,e);let l=0;const c=Array.isArray(t)?t.join(i):t,h=Array.isArray(t)?t:t.split(i),u=()=>{const t=(new Date).getTime();0===l&&(l=t);const e=t-l;let i=e/r.duration;i<1?this.ids[c]=requestAnimationFrame(u):i=1;const s=a(o(i));this.cell.setPropByPath(h,s),n.progress&&n.progress(Object.assign({progress:i,currentValue:s},this.getArgs(c))),1===i&&(this.cell.notify("transition:complete",this.getArgs(c)),n.complete&&n.complete(this.getArgs(c)),this.cell.notify("transition:finish",this.getArgs(c)),n.finish&&n.finish(this.getArgs(c)),this.clean(c))};return setTimeout(()=>{this.stop(t,void 0,i),this.cache[c]={startValue:s,targetValue:e,options:r},this.ids[c]=requestAnimationFrame(u),this.cell.notify("transition:start",this.getArgs(c)),n.start&&n.start(this.getArgs(c))},n.delay),this.stop.bind(this,t,i,n)}stop(t,e={},n="/"){const i=Array.isArray(t)?t:t.split(n);return Object.keys(this.ids).filter(t=>vl(i,t.split(n).slice(0,i.length))).forEach(t=>{cancelAnimationFrame(this.ids[t]);const n=this.cache[t],i=this.getArgs(t),s=Object.assign(Object.assign({},n.options),e),r=s.jumpedToEnd;r&&null!=n.targetValue&&(this.cell.setPropByPath(t,n.targetValue),this.cell.notify("transition:end",Object.assign({},i)),this.cell.notify("transition:complete",Object.assign({},i)),s.complete&&s.complete(Object.assign({},i)));const o=Object.assign({jumpedToEnd:r},i);this.cell.notify("transition:stop",Object.assign({},o)),s.stop&&s.stop(Object.assign({},o)),this.cell.notify("transition:finish",Object.assign({},i)),s.finish&&s.finish(Object.assign({},i)),this.clean(t)}),this}clean(t){delete this.ids[t],delete this.cache[t]}getTiming(t){return"string"===typeof t?bb[t]:t}getInterp(t,e,n){return t?t(e,n):"number"===typeof n?vb.number(e,n):"string"===typeof n?"#"===n[0]?vb.color(e,n):vb.unit(e,n):vb.object(e,n)}getArgs(t){const e=this.cache[t];return{path:t,startValue:e.startValue,targetValue:e.targetValue,cell:this.cell}}}(function(t){t.defaultOptions={delay:10,duration:100,timing:"linear"}})(xE||(xE={}));var wE,CE=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o},PE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class EE extends Hh{static config(t){const{markup:e,propHooks:n,attrHooks:i}=t,s=PE(t,["markup","propHooks","attrHooks"]);null!=e&&(this.markup=e),n&&(this.propHooks=this.propHooks.slice(),Array.isArray(n)?this.propHooks.push(...n):"function"===typeof n?this.propHooks.push(n):Object.values(n).forEach(t=>{"function"===typeof t&&this.propHooks.push(t)})),i&&(this.attrHooks=Object.assign(Object.assign({},this.attrHooks),i)),this.defaults=jo({},this.defaults,s)}static getMarkup(){return this.markup}static getDefaults(t){return t?this.defaults:yh(this.defaults)}static getAttrHooks(){return this.attrHooks}static applyPropHooks(t,e){return this.propHooks.reduce((e,n)=>n?Pt(n,t,e):e,e)}get[Symbol.toStringTag](){return EE.toStringTag}constructor(t={}){super();const e=this.constructor,n=e.getDefaults(!0),i=jo({},this.preprocess(n),this.preprocess(t));this.id=i.id||cf(),this.store=new vE(i),this.animation=new xE(this),this.setup(),this.init(),this.postprocess(t)}init(){}get model(){return this._model}set model(t){this._model!==t&&(this._model=t)}preprocess(t,e){const n=t.id,i=this.constructor,s=i.applyPropHooks(this,t);return null==n&&!0!==e&&(s.id=cf()),s}postprocess(t){}setup(){this.store.on("change:*",t=>{const{key:e,current:n,previous:i,options:s}=t;this.notify("change:*",{key:e,options:s,current:n,previous:i,cell:this}),this.notify(`change:${e}`,{options:s,current:n,previous:i,cell:this});const r=e;"source"!==r&&"target"!==r||this.notify("change:terminal",{type:r,current:n,previous:i,options:s,cell:this})}),this.store.on("changed",({options:t})=>this.notify("changed",{options:t,cell:this}))}notify(t,e){this.trigger(t,e);const n=this.model;return n&&(n.notify(`cell:${t}`,e),this.isNode()?n.notify(`node:${t}`,Object.assign(Object.assign({},e),{node:this})):this.isEdge()&&n.notify(`edge:${t}`,Object.assign(Object.assign({},e),{edge:this}))),this}isNode(){return!1}isEdge(){return!1}isSameStore(t){return this.store===t.store}get view(){return this.store.get("view")}get shape(){return this.store.get("shape","")}getProp(t,e){return null==t?this.store.get():this.store.get(t,e)}setProp(t,e,n){if("string"===typeof t)this.store.set(t,e,n);else{const n=this.preprocess(t,!0);this.store.set(jo({},this.getProp(),n),e),this.postprocess(t)}return this}removeProp(t,e){return"string"===typeof t||Array.isArray(t)?this.store.removeByPath(t,e):this.store.remove(e),this}hasChanged(t){return null==t?this.store.hasChanged():this.store.hasChanged(t)}getPropByPath(t){return this.store.getByPath(t)}setPropByPath(t,e,n={}){return this.model&&("children"===t?this._children=e?e.map(t=>this.model.getCell(t)).filter(t=>null!=t):null:"parent"===t&&(this._parent=e?this.model.getCell(e):null)),this.store.setByPath(t,e,n),this}removePropByPath(t,e={}){const n=Array.isArray(t)?t:t.split("/");return"attrs"===n[0]&&(e.dirty=!0),this.store.removeByPath(n,e),this}prop(t,e,n){return null==t?this.getProp():"string"===typeof t||Array.isArray(t)?1===arguments.length?this.getPropByPath(t):null==e?this.removePropByPath(t,n||{}):this.setPropByPath(t,e,n||{}):this.setProp(t,e||{})}previous(t){return this.store.getPrevious(t)}get zIndex(){return this.getZIndex()}set zIndex(t){null==t?this.removeZIndex():this.setZIndex(t)}getZIndex(){return this.store.get("zIndex")}setZIndex(t,e={}){return this.store.set("zIndex",t,e),this}removeZIndex(t={}){return this.store.remove("zIndex",t),this}toFront(t={}){const e=this.model;if(e){let n,i=e.getMaxZIndex();t.deep?(n=this.getDescendants({deep:!0,breadthFirst:!0}),n.unshift(this)):n=[this],i=i-n.length+1;const s=e.total();let r=e.indexOf(this)!==s-n.length;r||(r=n.some((t,e)=>t.getZIndex()!==i+e)),r&&this.batchUpdate("to-front",()=>{i+=n.length,n.forEach((e,n)=>{e.setZIndex(i+n,t)})})}return this}toBack(t={}){const e=this.model;if(e){let n,i=e.getMinZIndex();t.deep?(n=this.getDescendants({deep:!0,breadthFirst:!0}),n.unshift(this)):n=[this];let s=0!==e.indexOf(this);s||(s=n.some((t,e)=>t.getZIndex()!==i+e)),s&&this.batchUpdate("to-back",()=>{i-=n.length,n.forEach((e,n)=>{e.setZIndex(i+n,t)})})}return this}get markup(){return this.getMarkup()}set markup(t){null==t?this.removeMarkup():this.setMarkup(t)}getMarkup(){let t=this.store.get("markup");if(null==t){const e=this.constructor;t=e.getMarkup()}return t}setMarkup(t,e={}){return this.store.set("markup",t,e),this}removeMarkup(t={}){return this.store.remove("markup",t),this}get attrs(){return this.getAttrs()}set attrs(t){null==t?this.removeAttrs():this.setAttrs(t)}getAttrs(){const t=this.store.get("attrs");return t?Object.assign({},t):{}}setAttrs(t,e={}){if(null==t)this.removeAttrs(e);else{const n=t=>this.store.set("attrs",t,e);if(!0===e.overwrite)n(t);else{const i=this.getAttrs();!1===e.deep?n(Object.assign(Object.assign({},i),t)):n(jo({},i,t))}}return this}replaceAttrs(t,e={}){return this.setAttrs(t,Object.assign(Object.assign({},e),{overwrite:!0}))}updateAttrs(t,e={}){return this.setAttrs(t,Object.assign(Object.assign({},e),{deep:!1}))}removeAttrs(t={}){return this.store.remove("attrs",t),this}getAttrDefinition(t){if(!t)return null;const e=this.constructor,n=e.getAttrHooks()||{};let i=n[t]||iw.registry.get(t);if(!i){const e=Zp(t);i=n[e]||iw.registry.get(e)}return i||null}getAttrByPath(t){return null==t||""===t?this.getAttrs():this.getPropByPath(this.prefixAttrPath(t))}setAttrByPath(t,e,n={}){return this.setPropByPath(this.prefixAttrPath(t),e,n),this}removeAttrByPath(t,e={}){return this.removePropByPath(this.prefixAttrPath(t),e),this}prefixAttrPath(t){return Array.isArray(t)?["attrs"].concat(t):`attrs/${t}`}attr(t,e,n){return null==t?this.getAttrByPath():"string"===typeof t||Array.isArray(t)?1===arguments.length?this.getAttrByPath(t):null==e?this.removeAttrByPath(t,n||{}):this.setAttrByPath(t,e,n||{}):this.setAttrs(t,e||{})}get visible(){return this.isVisible()}set visible(t){this.setVisible(t)}setVisible(t,e={}){return this.store.set("visible",t,e),this}isVisible(){return!1!==this.store.get("visible")}show(t={}){return this.isVisible()||this.setVisible(!0,t),this}hide(t={}){return this.isVisible()&&this.setVisible(!1,t),this}toggleVisible(t,e={}){const n="boolean"===typeof t?t:!this.isVisible(),i="boolean"===typeof t?e:t;return n?this.show(i):this.hide(i),this}get data(){return this.getData()}set data(t){this.setData(t)}getData(){return this.store.get("data")}setData(t,e={}){if(null==t)this.removeData(e);else{const n=t=>this.store.set("data",t,e);if(!0===e.overwrite)n(t);else{const i=this.getData();!1===e.deep?n("object"===typeof t?Object.assign(Object.assign({},i),t):t):n(jo({},i,t))}}return this}replaceData(t,e={}){return this.setData(t,Object.assign(Object.assign({},e),{overwrite:!0}))}updateData(t,e={}){return this.setData(t,Object.assign(Object.assign({},e),{deep:!1}))}removeData(t={}){return this.store.remove("data",t),this}get parent(){return this.getParent()}get children(){return this.getChildren()}getParentId(){return this.store.get("parent")}getParent(){const t=this.getParentId();if(t&&this.model){const e=this.model.getCell(t);return this._parent=e,e}return null}getChildren(){const t=this.store.get("children");if(t&&t.length&&this.model){const e=t.map(t=>{var e;return null===(e=this.model)||void 0===e?void 0:e.getCell(t)}).filter(t=>null!=t);return this._children=e,[...e]}return null}hasParent(){return null!=this.parent}isParentOf(t){return null!=t&&t.getParent()===this}isChildOf(t){return null!=t&&this.getParent()===t}eachChild(t,e){return this.children&&this.children.forEach(t,e),this}filterChild(t,e){return this.children?this.children.filter(t,e):[]}getChildCount(){return null==this.children?0:this.children.length}getChildIndex(t){return null==this.children?-1:this.children.indexOf(t)}getChildAt(t){return null!=this.children&&t>=0?this.children[t]:null}getAncestors(t={}){const e=[];let n=this.getParent();while(n)e.push(n),n=!1!==t.deep?n.getParent():null;return e}getDescendants(t={}){if(!1!==t.deep){if(t.breadthFirst){const t=[],e=this.getChildren()||[];while(e.length>0){const n=e.shift(),i=n.getChildren();t.push(n),i&&e.push(...i)}return t}{const e=this.getChildren()||[];return e.forEach(n=>{e.push(...n.getDescendants(t))}),e}}return this.getChildren()||[]}isDescendantOf(t,e={}){if(null==t)return!1;if(!1!==e.deep){let e=this.getParent();while(e){if(e===t)return!0;e=e.getParent()}return!1}return this.isChildOf(t)}isAncestorOf(t,e={}){return null!=t&&t.isDescendantOf(this,e)}contains(t){return this.isAncestorOf(t)}getCommonAncestor(...t){return EE.getCommonAncestor(this,...t)}setParent(t,e={}){return this._parent=t,t?this.store.set("parent",t.id,e):this.store.remove("parent",e),this}setChildren(t,e={}){return this._children=t,null!=t?this.store.set("children",t.map(t=>t.id),e):this.store.remove("children",e),this}unembed(t,e={}){const n=this.children;if(null!=n&&null!=t){const i=this.getChildIndex(t);-1!==i&&(n.splice(i,1),t.setParent(null,e),this.setChildren(n,e))}return this}embed(t,e={}){return t.addTo(this,e),this}addTo(t,e={}){return EE.isCell(t)?t.addChild(this,e):t.addCell(this,e),this}insertTo(t,e,n={}){return t.insertChild(this,e,n),this}addChild(t,e={}){return this.insertChild(t,void 0,e)}insertChild(t,e,n={}){if(null!=t&&t!==this){const i=t.getParent(),s=this!==i;let r=e;if(null==r&&(r=this.getChildCount(),s||(r-=1)),i){const e=i.getChildren();if(e){const s=e.indexOf(t);s>=0&&(t.setParent(null,n),e.splice(s,1),i.setChildren(e,n))}}let o=this.children;if(null==o?(o=[],o.push(t)):o.splice(r,0,t),t.setParent(this,n),this.setChildren(o,n),s&&this.model){const t=this.model.getIncomingEdges(this),e=this.model.getOutgoingEdges(this);t&&t.forEach(t=>t.updateParent(n)),e&&e.forEach(t=>t.updateParent(n))}this.model&&this.model.addCell(t,n)}return this}removeFromParent(t={}){const e=this.getParent();if(null!=e){const n=e.getChildIndex(this);e.removeChildAt(n,t)}return this}removeChild(t,e={}){const n=this.getChildIndex(t);return this.removeChildAt(n,e)}removeChildAt(t,e={}){const n=this.getChildAt(t),i=this.children;return null!=i&&null!=n&&(this.unembed(n,e),n.remove(e)),n}remove(t={}){return this.batchUpdate("remove",()=>{const e=this.getParent();e&&e.removeChild(this,t),!1!==t.deep&&this.eachChild(e=>e.remove(t)),this.model&&this.model.removeCell(this,t)}),this}transition(t,e,n={},i="/"){return this.animation.start(t,e,n,i)}stopTransition(t,e,n="/"){return this.animation.stop(t,e,n),this}getTransitions(){return this.animation.get()}translate(t,e,n){return this}scale(t,e,n,i){return this}addTools(t,e,n){const i=Array.isArray(t)?t:[t],s="string"===typeof e?e:null,r="object"===typeof e?e:"object"===typeof n?n:{};if(r.reset)return this.setTools({name:s,items:i,local:r.local},r);let o=yh(this.getTools());return null==o||null==s||o.name===s?(null==o&&(o={}),o.items||(o.items=[]),o.name=s,o.items=[...o.items,...i],this.setTools(Object.assign({},o),r)):void 0}setTools(t,e={}){return null==t?this.removeTools():this.store.set("tools",EE.normalizeTools(t),e),this}getTools(){return this.store.get("tools")}removeTools(t={}){return this.store.remove("tools",t),this}hasTools(t){const e=this.getTools();return null!=e&&(null==t||e.name===t)}hasTool(t){const e=this.getTools();return null!=e&&e.items.some(e=>"string"===typeof e?e===t:e.name===t)}removeTool(t,e={}){const n=yh(this.getTools());if(n){let i=!1;const s=n.items.slice(),r=t=>{s.splice(t,1),i=!0};if("number"===typeof t)r(t);else for(let e=s.length-1;e>=0;e-=1){const n=s[e],i="string"===typeof n?n===t:n.name===t;i&&r(e)}i&&(n.items=s,this.setTools(n,e))}return this}getBBox(t){return new Tb}getConnectionPoint(t,e){return new Nb}toJSON(t={}){const e=Object.assign({},this.store.get()),n=Object.prototype.toString,i=this.isNode()?"node":this.isEdge()?"edge":"cell";if(!e.shape){const t=this.constructor;throw new Error(`Unable to serialize ${i} missing "shape" prop, check the ${i} "${t.name||n.call(t)}"`)}const s=this.constructor,r=!0===t.diff,o=e.attrs||{},a=s.getDefaults(!0),l=r?this.preprocess(a,!0):a,c=l.attrs||{},h={};Object.entries(e).forEach(([t,s])=>{if(null!=s&&!Array.isArray(s)&&"object"===typeof s&&!fr(s))throw new Error(`Can only serialize ${i} with plain-object props, but got a "${n.call(s)}" type of key "${t}" on ${i} "${this.id}"`);if("attrs"!==t&&"shape"!==t&&r){const n=l[t];vl(s,n)&&delete e[t]}}),Object.keys(o).forEach(t=>{const e=o[t],n=c[t];Object.keys(e).forEach(i=>{const s=e[i],r=n?n[i]:null;null==s||"object"!==typeof s||Array.isArray(s)?null!=n&&vl(r,s)||(null==h[t]&&(h[t]={}),h[t][i]=s):Object.keys(s).forEach(e=>{const o=s[e];if(null==n||null==r||!M(r)||!vl(r[e],o)){null==h[t]&&(h[t]={}),null==h[t][i]&&(h[t][i]={});const n=h[t][i];n[e]=o}})})});const u=Object.assign(Object.assign({},e),{attrs:Ml(h)?void 0:h});null==u.attrs&&delete u.attrs;const d=u;return 0===d.angle&&delete d.angle,yh(d)}clone(t={}){if(!t.deep){const e=Object.assign({},this.store.get());t.keepId||delete e.id,delete e.parent,delete e.children;const n=this.constructor;return new n(e)}const e=EE.deepClone(this);return e[this.id]}findView(t){return t.findViewByCell(this)}startBatch(t,e={},n=this.model){return this.notify("batch:start",{name:t,data:e,cell:this}),n&&n.startBatch(t,Object.assign(Object.assign({},e),{cell:this})),this}stopBatch(t,e={},n=this.model){return n&&n.stopBatch(t,Object.assign(Object.assign({},e),{cell:this})),this.notify("batch:stop",{name:t,data:e,cell:this}),this}batchUpdate(t,e,n){const i=this.model;this.startBatch(t,n,i);const s=e();return this.stopBatch(t,n,i),s}dispose(){this.removeFromParent(),this.store.dispose()}}EE.defaults={},EE.attrHooks={},EE.propHooks=[],CE([Hh.dispose()],EE.prototype,"dispose",null),function(t){function e(t){return"string"===typeof t?{items:[t]}:Array.isArray(t)?{items:t}:t.items?t:{items:[t]}}t.normalizeTools=e}(EE||(EE={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNode&&"function"===typeof i.isEdge&&"function"===typeof i.prop&&"function"===typeof i.attr}t.toStringTag=`X6.${t.name}`,t.isCell=e}(EE||(EE={})),function(t){function e(...t){const e=t.filter(t=>null!=t).map(t=>t.getAncestors()).sort((t,e)=>t.length-e.length),n=e.shift();return n.find(t=>e.every(e=>e.includes(t)))||null}function n(t,e={}){let n=null;for(let i=0,s=t.length;i<s;i+=1){const s=t[i];let r=s.getBBox(e);if(r){if(s.isNode()){const t=s.getAngle();null!=t&&0!==t&&(r=r.bbox(t))}n=null==n?r:n.union(r)}}return n}function i(e){const n=[e,...e.getDescendants({deep:!0})];return t.cloneCells(n)}function s(t){const e=du(t),n=e.reduce((t,e)=>(t[e.id]=e.clone(),t),{});return e.forEach(t=>{const e=n[t.id];if(e.isEdge()){const t=e.getSourceCellId(),i=e.getTargetCellId();t&&n[t]&&e.setSource(Object.assign(Object.assign({},e.getSource()),{cell:n[t].id})),i&&n[i]&&e.setTarget(Object.assign(Object.assign({},e.getTarget()),{cell:n[i].id}))}const i=t.getParent();i&&n[i.id]&&e.setParent(n[i.id]);const s=t.getChildren();if(s&&s.length){const t=s.reduce((t,e)=>(n[e.id]&&t.push(n[e.id]),t),[]);t.length>0&&e.setChildren(t)}}),n}t.getCommonAncestor=e,t.getCellsBBox=n,t.deepClone=i,t.cloneCells=s}(EE||(EE={})),function(t){t.config({propHooks(e){var{tools:n}=e,i=PE(e,["tools"]);return n&&(i.tools=t.normalizeTools(n)),i}})}(EE||(EE={})),function(t){let e,n;function i(t,i){return i?null!=e&&e.exist(t):null!=n&&n.exist(t)}function s(t){e=t}function r(t){n=t}t.exist=i,t.setEdgeRegistry=s,t.setNodeRegistry=r}(wE||(wE={}));class ME{constructor(t){this.ports=[],this.groups={},this.init(yh(t))}getPorts(){return this.ports}getGroup(t){return null!=t?this.groups[t]:null}getPortsByGroup(t){return this.ports.filter(e=>e.group===t||null==e.group&&null==t)}getPortsLayoutByGroup(t,e){const n=this.getPortsByGroup(t),i=t?this.getGroup(t):null,s=i?i.position:null,r=s?s.name:null;let o;if(null!=r){const t=Aw.registry.get(r);if(null==t)return Aw.registry.onNotFound(r);o=t}else o=Aw.presets.left;const a=n.map(t=>t&&t.position&&t.position.args||{}),l=s&&s.args||{},c=o(a,e,l);return c.map((t,i)=>{const s=n[i];return{portLayout:t,portId:s.id,portSize:s.size,portAttrs:s.attrs,labelSize:s.label.size,labelLayout:this.getPortLabelLayout(s,Nb.create(t.position),e)}})}init(t){const{groups:e,items:n}=t;null!=e&&Object.keys(e).forEach(t=>{this.groups[t]=this.parseGroup(e[t])}),Array.isArray(n)&&n.forEach(t=>{this.ports.push(this.parsePort(t))})}parseGroup(t){return Object.assign(Object.assign({},t),{label:this.getLabel(t,!0),position:this.getPortPosition(t.position,!0)})}parsePort(t){const e=Object.assign({},t),n=this.getGroup(t.group)||{};return e.markup=e.markup||n.markup,e.attrs=jo({},n.attrs,e.attrs),e.position=this.createPosition(n,e),e.label=jo({},n.label,this.getLabel(e)),e.zIndex=this.getZIndex(n,e),e.size=Object.assign(Object.assign({},n.size),e.size),e}getZIndex(t,e){return"number"===typeof e.zIndex?e.zIndex:"number"===typeof t.zIndex||"auto"===t.zIndex?t.zIndex:"auto"}createPosition(t,e){return jo({name:"left",args:{}},t.position,{args:e.args})}getPortPosition(t,e=!1){if(null==t){if(e)return{name:"left",args:{}}}else{if("string"===typeof t)return{name:t,args:{}};if(Array.isArray(t))return{name:"absolute",args:{x:t[0],y:t[1]}};if("object"===typeof t)return t}return{args:{}}}getPortLabelPosition(t,e=!1){if(null==t){if(e)return{name:"left",args:{}}}else{if("string"===typeof t)return{name:t,args:{}};if("object"===typeof t)return t}return{args:{}}}getLabel(t,e=!1){const n=t.label||{};return n.position=this.getPortLabelPosition(n.position,e),n}getPortLabelLayout(t,e,n){const i=t.label.position.name||"left",s=t.label.position.args||{},r=Uw.registry.get(i)||Uw.presets.left;return r?r(e,n,s):null}}var OE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class AE extends EE{get[Symbol.toStringTag](){return AE.toStringTag}constructor(t={}){super(t),this.initPorts()}preprocess(t,e){const{x:n,y:i,width:s,height:r}=t,o=OE(t,["x","y","width","height"]);if(null!=n||null!=i){const t=o.position;o.position=Object.assign(Object.assign({},t),{x:null!=n?n:t?t.x:0,y:null!=i?i:t?t.y:0})}if(null!=s||null!=r){const t=o.size;o.size=Object.assign(Object.assign({},t),{width:null!=s?s:t?t.width:0,height:null!=r?r:t?t.height:0})}return super.preprocess(o,e)}isNode(){return!0}size(t,e,n){return void 0===t?this.getSize():"number"===typeof t?this.setSize(t,e,n):this.setSize(t,e)}getSize(){const t=this.store.get("size");return t?Object.assign({},t):{width:1,height:1}}setSize(t,e,n){return"object"===typeof t?this.resize(t.width,t.height,e):this.resize(t,e,n),this}resize(t,e,n={}){this.startBatch("resize",n);const i=n.direction;if(i){const s=this.getSize();switch(i){case"left":case"right":e=s.height;break;case"top":case"bottom":t=s.width;break;default:break}const r={right:0,"top-right":0,top:1,"top-left":1,left:2,"bottom-left":2,bottom:3,"bottom-right":3};let o=r[i];const a=Ob.normalize(this.getAngle()||0);n.absolute&&(o+=Math.floor((a+45)/90),o%=4);const l=this.getBBox();let c;c=0===o?l.getBottomLeft():1===o?l.getCorner():2===o?l.getTopRight():l.getOrigin();const h=c.clone().rotate(-a,l.getCenter()),u=Math.sqrt(t*t+e*e)/2;let d=o*Math.PI/2;d+=Math.atan(o%2===0?e/t:t/e),d-=Ob.toRad(a);const g=Nb.fromPolar(u,d,h),p=g.clone().translate(t/-2,e/-2);this.store.set("size",{width:t,height:e},n),this.setPosition(p.x,p.y,n)}else this.store.set("size",{width:t,height:e},n);return this.stopBatch("resize",n),this}scale(t,e,n,i={}){const s=this.getBBox().scale(t,e,null==n?void 0:n);return this.startBatch("scale",i),this.setPosition(s.x,s.y,i),this.resize(s.width,s.height,i),this.stopBatch("scale"),this}position(t,e,n){return"number"===typeof t?this.setPosition(t,e,n):this.getPosition(t)}getPosition(t={}){if(t.relative){const t=this.getParent();if(null!=t&&t.isNode()){const e=this.getPosition(),n=t.getPosition();return{x:e.x-n.x,y:e.y-n.y}}}const e=this.store.get("position");return e?Object.assign({},e):{x:0,y:0}}setPosition(t,e,n={}){let i,s,r;if("object"===typeof t?(i=t.x,s=t.y,r=e||{}):(i=t,s=e,r=n||{}),r.relative){const t=this.getParent();if(null!=t&&t.isNode()){const e=t.getPosition();i+=e.x,s+=e.y}}if(r.deep){const t=this.getPosition();this.translate(i-t.x,s-t.y,r)}else this.store.set("position",{x:i,y:s},r);return this}translate(t=0,e=0,n={}){if(0===t&&0===e)return this;n.translateBy=n.translateBy||this.id;const i=this.getPosition();if(null!=n.restrict&&n.translateBy===this.id){const s=this.getBBox({deep:!0}),r=n.restrict,o=i.x-s.x,a=i.y-s.y,l=Math.max(r.x+o,Math.min(r.x+r.width+o-s.width,i.x+t)),c=Math.max(r.y+a,Math.min(r.y+r.height+a-s.height,i.y+e));t=l-i.x,e=c-i.y}const s={x:i.x+t,y:i.y+e};return n.tx=t,n.ty=e,n.transition?("object"!==typeof n.transition&&(n.transition={}),this.transition("position",s,Object.assign(Object.assign({},n.transition),{interp:vb.object})),this.eachChild(i=>{var s;const r=null===(s=n.exclude)||void 0===s?void 0:s.includes(i);r||i.translate(t,e,n)})):(this.startBatch("translate",n),this.store.set("position",s,n),this.eachChild(i=>{var s;const r=null===(s=n.exclude)||void 0===s?void 0:s.includes(i);r||i.translate(t,e,n)}),this.stopBatch("translate",n)),this}angle(t,e){return null==t?this.getAngle():this.rotate(t,e)}getAngle(){return this.store.get("angle",0)}rotate(t,e={}){const n=this.getAngle();if(e.center){const i=this.getSize(),s=this.getPosition(),r=this.getBBox().getCenter();r.rotate(n-t,e.center);const o=r.x-i.width/2-s.x,a=r.y-i.height/2-s.y;this.startBatch("rotate",{angle:t,options:e}),this.setPosition(s.x+o,s.y+a,e),this.rotate(t,Object.assign(Object.assign({},e),{center:null})),this.stopBatch("rotate")}else this.store.set("angle",e.absolute?t:(n+t)%360,e);return this}getBBox(t={}){if(t.deep){const t=this.getDescendants({deep:!0,breadthFirst:!0});return t.push(this),EE.getCellsBBox(t)}return Tb.fromPositionAndSize(this.getPosition(),this.getSize())}getConnectionPoint(t,e){const n=this.getBBox(),i=n.getCenter(),s=t.getTerminal(e);if(null==s)return i;const r=s.port;if(!r||!this.hasPort(r))return i;const o=this.getPort(r);if(!o||!o.group)return i;const a=this.getPortsPosition(o.group),l=a[r].position,c=Nb.create(l).translate(n.getOrigin()),h=this.getAngle();return h&&c.rotate(-h,i),c}fit(t={}){const e=this.getChildren()||[],n=e.filter(t=>t.isNode());if(0===n.length)return this;this.startBatch("fit-embeds",t),t.deep&&n.forEach(e=>e.fit(t));let{x:i,y:s,width:r,height:o}=EE.getCellsBBox(n);const a=wf(t.padding);return i-=a.left,s-=a.top,r+=a.left+a.right,o+=a.bottom+a.top,this.store.set({position:{x:i,y:s},size:{width:r,height:o}},t),this.stopBatch("fit-embeds"),this}get portContainerMarkup(){return this.getPortContainerMarkup()}set portContainerMarkup(t){this.setPortContainerMarkup(t)}getDefaultPortContainerMarkup(){return this.store.get("defaultPortContainerMarkup")||qw.getPortContainerMarkup()}getPortContainerMarkup(){return this.store.get("portContainerMarkup")||this.getDefaultPortContainerMarkup()}setPortContainerMarkup(t,e={}){return this.store.set("portContainerMarkup",qw.clone(t),e),this}get portMarkup(){return this.getPortMarkup()}set portMarkup(t){this.setPortMarkup(t)}getDefaultPortMarkup(){return this.store.get("defaultPortMarkup")||qw.getPortMarkup()}getPortMarkup(){return this.store.get("portMarkup")||this.getDefaultPortMarkup()}setPortMarkup(t,e={}){return this.store.set("portMarkup",qw.clone(t),e),this}get portLabelMarkup(){return this.getPortLabelMarkup()}set portLabelMarkup(t){this.setPortLabelMarkup(t)}getDefaultPortLabelMarkup(){return this.store.get("defaultPortLabelMarkup")||qw.getPortLabelMarkup()}getPortLabelMarkup(){return this.store.get("portLabelMarkup")||this.getDefaultPortLabelMarkup()}setPortLabelMarkup(t,e={}){return this.store.set("portLabelMarkup",qw.clone(t),e),this}get ports(){const t=this.store.get("ports",{items:[]});return null==t.items&&(t.items=[]),t}getPorts(){return yh(this.ports.items)}getPortsByGroup(t){return this.getPorts().filter(e=>e.group===t)}getPort(t){return yh(this.ports.items.find(e=>e.id&&e.id===t))}getPortAt(t){return this.ports.items[t]||null}hasPorts(){return this.ports.items.length>0}hasPort(t){return-1!==this.getPortIndex(t)}getPortIndex(t){const e="string"===typeof t?t:t.id;return null!=e?this.ports.items.findIndex(t=>t.id===e):-1}getPortsPosition(t){const e=this.getSize(),n=this.port.getPortsLayoutByGroup(t,new Tb(0,0,e.width,e.height));return n.reduce((t,e)=>{const n=e.portLayout;return t[e.portId]={position:Object.assign({},n.position),angle:n.angle||0},t},{})}getPortProp(t,e){return this.getPropByPath(this.prefixPortPath(t,e))}setPortProp(t,e,n,i){if("string"===typeof e||Array.isArray(e)){const s=this.prefixPortPath(t,e),r=n;return this.setPropByPath(s,r,i)}const s=this.prefixPortPath(t),r=e;return this.setPropByPath(s,r,n)}removePortProp(t,e,n){return"string"===typeof e||Array.isArray(e)?this.removePropByPath(this.prefixPortPath(t,e),n):this.removePropByPath(this.prefixPortPath(t),e)}portProp(t,e,n,i){return null==e?this.getPortProp(t):"string"===typeof e||Array.isArray(e)?2===arguments.length?this.getPortProp(t,e):null==n?this.removePortProp(t,e,i):this.setPortProp(t,e,n,i):this.setPortProp(t,e,n)}prefixPortPath(t,e){const n=this.getPortIndex(t);if(-1===n)throw new Error(`Unable to find port with id: "${t}"`);return null==e||""===e?["ports","items",`${n}`]:Array.isArray(e)?["ports","items",`${n}`,...e]:`ports/items/${n}/${e}`}addPort(t,e){const n=[...this.ports.items];return n.push(t),this.setPropByPath("ports/items",n,e),this}addPorts(t,e){return this.setPropByPath("ports/items",[...this.ports.items,...t],e),this}insertPort(t,e,n){const i=[...this.ports.items];return i.splice(t,0,e),this.setPropByPath("ports/items",i,n),this}removePort(t,e={}){return this.removePortAt(this.getPortIndex(t),e)}removePortAt(t,e={}){if(t>=0){const n=[...this.ports.items];n.splice(t,1),e.rewrite=!0,this.setPropByPath("ports/items",n,e)}return this}removePorts(t,e){let n;if(Array.isArray(t)){if(n=e||{},t.length){n.rewrite=!0;const e=[...this.ports.items],i=e.filter(e=>!t.some(t=>{const n="string"===typeof t?t:t.id;return e.id===n}));this.setPropByPath("ports/items",i,n)}}else n=t||{},n.rewrite=!0,this.setPropByPath("ports/items",[],n);return this}getParsedPorts(){return this.port.getPorts()}getParsedGroups(){return this.port.groups}getPortsLayoutByGroup(t,e){return this.port.getPortsLayoutByGroup(t,e)}initPorts(){this.updatePortData(),this.on("change:ports",()=>{this.processRemovedPort(),this.updatePortData()})}processRemovedPort(){const t=this.ports,e={};t.items.forEach(t=>{t.id&&(e[t.id]=!0)});const n={},i=this.store.getPrevious("ports")||{items:[]};i.items.forEach(t=>{t.id&&!e[t.id]&&(n[t.id]=!0)});const s=this.model;if(s&&!Ml(n)){const t=s.getConnectedEdges(this,{incoming:!0});t.forEach(t=>{const e=t.getTargetPortId();e&&n[e]&&t.remove()});const e=s.getConnectedEdges(this,{outgoing:!0});e.forEach(t=>{const e=t.getSourcePortId();e&&n[e]&&t.remove()})}}validatePorts(){const t={},e=[];return this.ports.items.forEach(n=>{"object"!==typeof n&&e.push(`Invalid port ${n}.`),null==n.id&&(n.id=this.generatePortId()),t[n.id]&&e.push("Duplicitied port id."),t[n.id]=!0}),e}generatePortId(){return cf()}updatePortData(){const t=this.validatePorts();if(t.length>0)throw this.store.set("ports",this.store.getPrevious("ports")),new Error(t.join(" "));const e=this.port?this.port.getPorts():null;this.port=new ME(this.ports);const n=this.port.getPorts(),i=e?n.filter(t=>e.find(e=>e.id===t.id)?null:t):[...n],s=e?e.filter(t=>n.find(e=>e.id===t.id)?null:t):[];i.length>0&&this.notify("ports:added",{added:i,cell:this,node:this}),s.length>0&&this.notify("ports:removed",{removed:s,cell:this,node:this})}}AE.defaults={angle:0,position:{x:0,y:0},size:{width:1,height:1}},function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNode&&"function"===typeof i.isEdge&&"function"===typeof i.prop&&"function"===typeof i.attr&&"function"===typeof i.size&&"function"===typeof i.position}t.toStringTag=`X6.${t.name}`,t.isNode=e}(AE||(AE={})),function(t){t.config({propHooks(t){var{ports:e}=t,n=OE(t,["ports"]);return e&&(n.ports=Array.isArray(e)?{items:e}:e),n}})}(AE||(AE={})),function(t){t.registry=ev.create({type:"node",process(e,n){if(wE.exist(e,!0))throw new Error(`Node with name '${e}' was registered by anthor Edge`);if("function"===typeof n)return n.config({shape:e}),n;let i=t;const{inherit:s}=n,r=OE(n,["inherit"]);if(s)if("string"===typeof s){const t=this.get(s);null==t?this.onNotFound(s,"inherited"):i=t}else i=s;null==r.constructorName&&(r.constructorName=e);const o=i.define.call(i,r);return o.config({shape:e}),o}}),wE.setNodeRegistry(t.registry)}(AE||(AE={})),function(t){let e=0;function n(t){return t?af(t):(e+=1,`CustomNode${e}`)}function i(e){const{constructorName:i,overwrite:s}=e,r=OE(e,["constructorName","overwrite"]),o=Lh(n(i||r.shape),this);return o.config(r),r.shape&&t.registry.register(r.shape,o,s),o}function s(e){const n=e.shape||"rect",i=t.registry.get(n);return i?new i(e):t.registry.onNotFound(n)}t.define=i,t.create=s}(AE||(AE={}));var SE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class NE extends EE{get[Symbol.toStringTag](){return NE.toStringTag}constructor(t={}){super(t)}preprocess(t,e){const{source:n,sourceCell:i,sourcePort:s,sourcePoint:r,target:o,targetCell:a,targetPort:l,targetPoint:c}=t,h=SE(t,["source","sourceCell","sourcePort","sourcePoint","target","targetCell","targetPort","targetPoint"]),u=h,d=t=>"string"===typeof t||"number"===typeof t;if(null!=n)if(EE.isCell(n))u.source={cell:n.id};else if(d(n))u.source={cell:n};else if(Nb.isPoint(n))u.source=n.toJSON();else if(Array.isArray(n))u.source={x:n[0],y:n[1]};else{const t=n.cell;EE.isCell(t)?u.source=Object.assign(Object.assign({},n),{cell:t.id}):u.source=n}if(null!=i||null!=s){let t=u.source;if(null!=i){const e=d(i)?i:i.id;t?t.cell=e:t=u.source={cell:e}}null!=s&&t&&(t.port=s)}else null!=r&&(u.source=Nb.create(r).toJSON());if(null!=o)if(EE.isCell(o))u.target={cell:o.id};else if(d(o))u.target={cell:o};else if(Nb.isPoint(o))u.target=o.toJSON();else if(Array.isArray(o))u.target={x:o[0],y:o[1]};else{const t=o.cell;EE.isCell(t)?u.target=Object.assign(Object.assign({},o),{cell:t.id}):u.target=o}if(null!=a||null!=l){let t=u.target;if(null!=a){const e=d(a)?a:a.id;t?t.cell=e:t=u.target={cell:e}}null!=l&&t&&(t.port=l)}else null!=c&&(u.target=Nb.create(c).toJSON());return super.preprocess(u,e)}setup(){super.setup(),this.on("change:labels",t=>this.onLabelsChanged(t)),this.on("change:vertices",t=>this.onVertexsChanged(t))}isEdge(){return!0}disconnect(t={}){return this.store.set({source:{x:0,y:0},target:{x:0,y:0}},t),this}get source(){return this.getSource()}set source(t){this.setSource(t)}getSource(){return this.getTerminal("source")}getSourceCellId(){return this.source.cell}getSourcePortId(){return this.source.port}setSource(t,e,n={}){return this.setTerminal("source",t,e,n)}get target(){return this.getTarget()}set target(t){this.setTarget(t)}getTarget(){return this.getTerminal("target")}getTargetCellId(){return this.target.cell}getTargetPortId(){return this.target.port}setTarget(t,e,n={}){return this.setTerminal("target",t,e,n)}getTerminal(t){return Object.assign({},this.store.get(t))}setTerminal(t,e,n,i={}){if(EE.isCell(e))return this.store.set(t,jo({},n,{cell:e.id}),i),this;const s=e;return Nb.isPoint(e)||null!=s.x&&null!=s.y?(this.store.set(t,jo({},n,{x:s.x,y:s.y}),i),this):(this.store.set(t,yh(e),i),this)}getSourcePoint(){return this.getTerminalPoint("source")}getTargetPoint(){return this.getTerminalPoint("target")}getTerminalPoint(t){const e=this[t];if(Nb.isPointLike(e))return Nb.create(e);const n=this.getTerminalCell(t);return n?n.getConnectionPoint(this,t):new Nb}getSourceCell(){return this.getTerminalCell("source")}getTargetCell(){return this.getTerminalCell("target")}getTerminalCell(t){if(this.model){const e="source"===t?this.getSourceCellId():this.getTargetCellId();if(e)return this.model.getCell(e)}return null}getSourceNode(){return this.getTerminalNode("source")}getTargetNode(){return this.getTerminalNode("target")}getTerminalNode(t){let e=this;const n={};while(e&&e.isEdge()){if(n[e.id])return null;n[e.id]=!0,e=e.getTerminalCell(t)}return e&&e.isNode()?e:null}get router(){return this.getRouter()}set router(t){null==t?this.removeRouter():this.setRouter(t)}getRouter(){return this.store.get("router")}setRouter(t,e,n){return"object"===typeof t?this.store.set("router",t,e):this.store.set("router",{name:t,args:e},n),this}removeRouter(t={}){return this.store.remove("router",t),this}get connector(){return this.getConnector()}set connector(t){null==t?this.removeConnector():this.setConnector(t)}getConnector(){return this.store.get("connector")}setConnector(t,e,n){return"object"===typeof t?this.store.set("connector",t,e):this.store.set("connector",{name:t,args:e},n),this}removeConnector(t={}){return this.store.remove("connector",t)}getDefaultLabel(){const t=this.constructor,e=this.store.get("defaultLabel")||t.defaultLabel||{};return yh(e)}get labels(){return this.getLabels()}set labels(t){this.setLabels(t)}getLabels(){return[...this.store.get("labels",[])].map(t=>this.parseLabel(t))}setLabels(t,e={}){return this.store.set("labels",Array.isArray(t)?t:[t],e),this}insertLabel(t,e,n={}){const i=this.getLabels(),s=i.length;let r=null!=e&&Number.isFinite(e)?e:s;return r<0&&(r=s+r+1),i.splice(r,0,this.parseLabel(t)),this.setLabels(i,n)}appendLabel(t,e={}){return this.insertLabel(t,-1,e)}getLabelAt(t){const e=this.getLabels();return null!=t&&Number.isFinite(t)?this.parseLabel(e[t]):null}setLabelAt(t,e,n={}){if(null!=t&&Number.isFinite(t)){const i=this.getLabels();i[t]=this.parseLabel(e),this.setLabels(i,n)}return this}removeLabelAt(t,e={}){const n=this.getLabels(),i=null!=t&&Number.isFinite(t)?t:-1,s=n.splice(i,1);return this.setLabels(n,e),s.length?s[0]:null}parseLabel(t){if("string"===typeof t){const e=this.constructor;return e.parseStringLabel(t)}return t}onLabelsChanged({previous:t,current:e}){const n=t&&e?e.filter(e=>t.find(t=>e===t||vl(e,t))?null:e):e?[...e]:[],i=t&&e?t.filter(t=>e.find(e=>t===e||vl(t,e))?null:t):t?[...t]:[];n.length>0&&this.notify("labels:added",{added:n,cell:this,edge:this}),i.length>0&&this.notify("labels:removed",{removed:i,cell:this,edge:this})}get vertices(){return this.getVertices()}set vertices(t){this.setVertices(t)}getVertices(){return[...this.store.get("vertices",[])]}setVertices(t,e={}){const n=Array.isArray(t)?t:[t];return this.store.set("vertices",n.map(t=>Nb.toJSON(t)),e),this}insertVertex(t,e,n={}){const i=this.getVertices(),s=i.length;let r=null!=e&&Number.isFinite(e)?e:s;return r<0&&(r=s+r+1),i.splice(r,0,Nb.toJSON(t)),this.setVertices(i,n)}appendVertex(t,e={}){return this.insertVertex(t,-1,e)}getVertexAt(t){if(null!=t&&Number.isFinite(t)){const e=this.getVertices();return e[t]}return null}setVertexAt(t,e,n={}){if(null!=t&&Number.isFinite(t)){const i=this.getVertices();i[t]=e,this.setVertices(i,n)}return this}removeVertexAt(t,e={}){const n=this.getVertices(),i=null!=t&&Number.isFinite(t)?t:-1;return n.splice(i,1),this.setVertices(n,e)}onVertexsChanged({previous:t,current:e}){const n=t&&e?e.filter(e=>t.find(t=>Nb.equals(e,t))?null:e):e?[...e]:[],i=t&&e?t.filter(t=>e.find(e=>Nb.equals(t,e))?null:t):t?[...t]:[];n.length>0&&this.notify("vertexs:added",{added:n,cell:this,edge:this}),i.length>0&&this.notify("vertexs:removed",{removed:i,cell:this,edge:this})}getDefaultMarkup(){return this.store.get("defaultMarkup")||qw.getEdgeMarkup()}getMarkup(){return super.getMarkup()||this.getDefaultMarkup()}translate(t,e,n={}){return n.translateBy=n.translateBy||this.id,n.tx=t,n.ty=e,this.applyToPoints(n=>({x:(n.x||0)+t,y:(n.y||0)+e}),n)}scale(t,e,n,i={}){return this.applyToPoints(i=>Nb.create(i).scale(t,e,n).toJSON(),i)}applyToPoints(t,e={}){const n={},i=this.getSource(),s=this.getTarget();Nb.isPointLike(i)&&(n.source=t(i)),Nb.isPointLike(s)&&(n.target=t(s));const r=this.getVertices();return r.length>0&&(n.vertices=r.map(t)),this.store.set(n,e),this}getBBox(){return this.getPolyline().bbox()}getConnectionPoint(){return this.getPolyline().pointAt(.5)}getPolyline(){const t=[this.getSourcePoint(),...this.getVertices().map(t=>Nb.create(t)),this.getTargetPoint()];return new $b(t)}updateParent(t){let e=null;const n=this.getSourceCell(),i=this.getTargetCell(),s=this.getParent();return n&&i&&(e=n===i||n.isDescendantOf(i)?i:i.isDescendantOf(n)?n:EE.getCommonAncestor(n,i)),s&&e&&e.id!==s.id&&s.unembed(this,t),!e||s&&s.id===e.id||e.embed(this,t),e}hasLoop(t={}){const e=this.getSource(),n=this.getTarget(),i=e.cell,s=n.cell;if(!i||!s)return!1;let r=i===s;if(!r&&t.deep&&this._model){const e=this.getSourceCell(),n=this.getTargetCell();e&&n&&(r=e.isAncestorOf(n,t)||n.isAncestorOf(e,t))}return r}getFragmentAncestor(){const t=[this,this.getSourceNode(),this.getTargetNode()].filter(t=>null!=t);return this.getCommonAncestor(...t)}isFragmentDescendantOf(t){const e=this.getFragmentAncestor();return!!e&&(e.id===t.id||e.isDescendantOf(t))}}NE.defaults={},function(t){function e(t,e){const n=t,i=e;return n.cell===i.cell&&(n.port===i.port||null==n.port&&null==i.port)}t.equalTerminals=e}(NE||(NE={})),function(t){function e(t){return{attrs:{label:{text:t}}}}t.defaultLabel={markup:[{tagName:"rect",selector:"body"},{tagName:"text",selector:"label"}],attrs:{text:{fill:"#000",fontSize:14,textAnchor:"middle",textVerticalAnchor:"middle",pointerEvents:"none"},rect:{ref:"label",fill:"#fff",rx:3,ry:3,refWidth:1,refHeight:1,refX:0,refY:0}},position:{distance:.5}},t.parseStringLabel=e}(NE||(NE={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNode&&"function"===typeof i.isEdge&&"function"===typeof i.prop&&"function"===typeof i.attr&&"function"===typeof i.disconnect&&"function"===typeof i.getSource&&"function"===typeof i.getTarget}t.toStringTag=`X6.${t.name}`,t.isEdge=e}(NE||(NE={})),function(t){t.registry=ev.create({type:"edge",process(e,n){if(wE.exist(e,!1))throw new Error(`Edge with name '${e}' was registered by anthor Node`);if("function"===typeof n)return n.config({shape:e}),n;let i=t;const{inherit:s="edge"}=n,r=SE(n,["inherit"]);if("string"===typeof s){const t=this.get(s||"edge");null==t&&s?this.onNotFound(s,"inherited"):i=t}else i=s;null==r.constructorName&&(r.constructorName=e);const o=i.define.call(i,r);return o.config({shape:e}),o}}),wE.setEdgeRegistry(t.registry)}(NE||(NE={})),function(t){let e=0;function n(t){return t?af(t):(e+=1,`CustomEdge${e}`)}function i(e){const{constructorName:i,overwrite:s}=e,r=SE(e,["constructorName","overwrite"]),o=Lh(n(i||r.shape),this);return o.config(r),r.shape&&t.registry.register(r.shape,o,s),o}function s(e){const n=e.shape||"edge",i=t.registry.get(n);return i?new i(e):t.registry.onNotFound(n)}t.define=i,t.create=s}(NE||(NE={})),function(t){const e="basic.edge";t.config({shape:e,propHooks(e){const{label:n,vertices:i}=e,s=SE(e,["label","vertices"]);if(n){null==s.labels&&(s.labels=[]);const e="string"===typeof n?t.parseStringLabel(n):n;s.labels.push(e)}return i&&Array.isArray(i)&&(s.vertices=i.map(t=>Nb.create(t).toJSON())),s}}),t.registry.register(e,t)}(NE||(NE={}));var TE=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class kE extends Hh{constructor(t,e={}){super(),this.length=0,this.comparator=e.comparator||"zIndex",this.clean(),t&&this.reset(t,{silent:!0})}toJSON(){return this.cells.map(t=>t.toJSON())}add(t,e,n){let i,s;"number"===typeof e?(i=e,s=Object.assign({merge:!1},n)):(i=this.length,s=Object.assign({merge:!1},e)),i>this.length&&(i=this.length),i<0&&(i+=this.length+1);const r=Array.isArray(t)?t:[t],o=this.comparator&&"number"!==typeof e&&!1!==s.sort,a=this.comparator||null;let l=!1;const c=[],h=[];return r.forEach(t=>{const e=this.get(t);e?s.merge&&!t.isSameStore(e)&&(e.setProp(t.getProp(),n),h.push(e),o&&!l&&(l=null==a||"function"===typeof a?e.hasChanged():"string"===typeof a?e.hasChanged(a):a.some(t=>e.hasChanged(t)))):(c.push(t),this.reference(t))}),c.length&&(o&&(l=!0),this.cells.splice(i,0,...c),this.length=this.cells.length),l&&this.sort({silent:!0}),s.silent||(c.forEach((t,e)=>{const n={cell:t,index:i+e,options:s};this.trigger("added",n),s.dryrun||t.notify("added",Object.assign({},n))}),l&&this.trigger("sorted"),(c.length||h.length)&&this.trigger("updated",{added:c,merged:h,removed:[],options:s})),this}remove(t,e={}){const n=Array.isArray(t)?t:[t],i=this.removeCells(n,e);return!e.silent&&i.length>0&&this.trigger("updated",{options:e,removed:i,added:[],merged:[]}),Array.isArray(t)?i:i[0]}removeCells(t,e){const n=[];for(let i=0;i<t.length;i+=1){const s=this.get(t[i]);if(null==s)continue;const r=this.cells.indexOf(s);this.cells.splice(r,1),this.length-=1,delete this.map[s.id],n.push(s),this.unreference(s),e.dryrun||s.remove(),e.silent||(this.trigger("removed",{cell:s,index:r,options:e}),e.dryrun||s.notify("removed",{cell:s,index:r,options:e}))}return n}reset(t,e={}){const n=this.cells.slice();if(n.forEach(t=>this.unreference(t)),this.clean(),this.add(t,Object.assign({silent:!0},e)),!e.silent){const t=this.cells.slice();this.trigger("reseted",{options:e,previous:n,current:t});const i=[],s=[];t.forEach(t=>{const e=n.some(e=>e.id===t.id);e||i.push(t)}),n.forEach(e=>{const n=t.some(t=>t.id===e.id);n||s.push(e)}),this.trigger("updated",{options:e,added:i,removed:s,merged:[]})}return this}push(t,e){return this.add(t,this.length,e)}pop(t){const e=this.at(this.length-1);return this.remove(e,t)}unshift(t,e){return this.add(t,0,e)}shift(t){const e=this.at(0);return this.remove(e,t)}get(t){if(null==t)return null;const e="string"===typeof t||"number"===typeof t?t:t.id;return this.map[e]||null}has(t){return null!=this.get(t)}at(t){return t<0&&(t+=this.length),this.cells[t]||null}first(){return this.at(0)}last(){return this.at(-1)}indexOf(t){return this.cells.indexOf(t)}toArray(){return this.cells.slice()}sort(t={}){return null!=this.comparator&&(this.cells=bd(this.cells,this.comparator),t.silent||this.trigger("sorted")),this}clone(){const t=this.constructor;return new t(this.cells.slice(),{comparator:this.comparator})}reference(t){this.map[t.id]=t,t.on("*",this.notifyCellEvent,this)}unreference(t){t.off("*",this.notifyCellEvent,this),delete this.map[t.id]}notifyCellEvent(t,e){const n=e.cell;this.trigger(`cell:${t}`,e),n&&(n.isNode()?this.trigger(`node:${t}`,Object.assign(Object.assign({},e),{node:n})):n.isEdge()&&this.trigger(`edge:${t}`,Object.assign(Object.assign({},e),{edge:n})))}clean(){this.length=0,this.cells=[],this.map={}}dispose(){this.reset([])}}TE([kE.dispose()],kE.prototype,"dispose",null);var jE=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class LE extends Hh{get[Symbol.toStringTag](){return LE.toStringTag}constructor(t=[]){super(),this.batches={},this.addings=new WeakMap,this.nodes={},this.edges={},this.outgoings={},this.incomings={},this.collection=new kE(t),this.setup()}notify(t,e){this.trigger(t,e);const n=this.graph;return n&&("sorted"===t||"reseted"===t||"updated"===t?n.trigger(`model:${t}`,e):n.trigger(t,e)),this}setup(){const t=this.collection;t.on("sorted",()=>this.notify("sorted",null)),t.on("updated",t=>this.notify("updated",t)),t.on("cell:change:zIndex",()=>this.sortOnChangeZ()),t.on("added",({cell:t})=>{this.onCellAdded(t)}),t.on("removed",t=>{const e=t.cell;this.onCellRemoved(e,t.options),this.notify("cell:removed",t),e.isNode()?this.notify("node:removed",Object.assign(Object.assign({},t),{node:e})):e.isEdge()&&this.notify("edge:removed",Object.assign(Object.assign({},t),{edge:e}))}),t.on("reseted",t=>{this.onReset(t.current),this.notify("reseted",t)}),t.on("edge:change:source",({edge:t})=>this.onEdgeTerminalChanged(t,"source")),t.on("edge:change:target",({edge:t})=>{this.onEdgeTerminalChanged(t,"target")})}sortOnChangeZ(){this.collection.sort()}onCellAdded(t){const e=t.id;t.isEdge()?(t.updateParent(),this.edges[e]=!0,this.onEdgeTerminalChanged(t,"source"),this.onEdgeTerminalChanged(t,"target")):this.nodes[e]=!0}onCellRemoved(t,e){const n=t.id;if(t.isEdge()){delete this.edges[n];const e=t.getSource(),i=t.getTarget();if(e&&e.cell){const t=this.outgoings[e.cell],i=t?t.indexOf(n):-1;i>=0&&(t.splice(i,1),0===t.length&&delete this.outgoings[e.cell])}if(i&&i.cell){const t=this.incomings[i.cell],e=t?t.indexOf(n):-1;e>=0&&(t.splice(e,1),0===t.length&&delete this.incomings[i.cell])}}else delete this.nodes[n];e.clear||(e.disconnectEdges?this.disconnectConnectedEdges(t,e):this.removeConnectedEdges(t,e)),t.model===this&&(t.model=null)}onReset(t){this.nodes={},this.edges={},this.outgoings={},this.incomings={},t.forEach(t=>this.onCellAdded(t))}onEdgeTerminalChanged(t,e){const n="source"===e?this.outgoings:this.incomings,i=t.previous(e);if(i&&i.cell){const e=EE.isCell(i.cell)?i.cell.id:i.cell,s=n[e],r=s?s.indexOf(t.id):-1;r>=0&&(s.splice(r,1),0===s.length&&delete n[e])}const s=t.getTerminal(e);if(s&&s.cell){const e=EE.isCell(s.cell)?s.cell.id:s.cell,i=n[e]||[],r=i.indexOf(t.id);-1===r&&i.push(t.id),n[e]=i}}prepareCell(t,e){return t.model||e&&e.dryrun||(t.model=this),null==t.zIndex&&t.setZIndex(this.getMaxZIndex()+1,{silent:!0}),t}resetCells(t,e={}){return t.map(t=>this.prepareCell(t,Object.assign(Object.assign({},e),{dryrun:!0}))),this.collection.reset(t,e),t.map(t=>this.prepareCell(t,{options:e})),this}clear(t={}){const e=this.getCells();if(0===e.length)return this;const n=Object.assign(Object.assign({},t),{clear:!0});return this.batchUpdate("clear",()=>{const t=e.sort((t,e)=>{const n=t.isEdge()?1:2,i=e.isEdge()?1:2;return n-i});while(t.length>0){const e=t.shift();e&&e.remove(n)}},n),this}addNode(t,e={}){const n=AE.isNode(t)?t:this.createNode(t);return this.addCell(n,e),n}updateNode(t,e={}){const n=this.createNode(t),i=n.getProp();return n.dispose(),this.updateCell(i,e)}createNode(t){return AE.create(t)}addEdge(t,e={}){const n=NE.isEdge(t)?t:this.createEdge(t);return this.addCell(n,e),n}createEdge(t){return NE.create(t)}updateEdge(t,e={}){const n=this.createEdge(t),i=n.getProp();return n.dispose(),this.updateCell(i,e)}addCell(t,e={}){return Array.isArray(t)?this.addCells(t,e):(this.collection.has(t)||this.addings.has(t)||(this.addings.set(t,!0),this.collection.add(this.prepareCell(t,e),e),t.eachChild(t=>this.addCell(t,e)),this.addings.delete(t)),this)}addCells(t,e={}){const n=t.length;if(0===n)return this;const i=Object.assign(Object.assign({},e),{position:n-1,maxPosition:n-1});return this.startBatch("add",Object.assign(Object.assign({},i),{cells:t})),t.forEach(t=>{this.addCell(t,i),i.position-=1}),this.stopBatch("add",Object.assign(Object.assign({},i),{cells:t})),this}updateCell(t,e={}){const n=t.id&&this.getCell(t.id);return!!n&&this.batchUpdate("update",()=>(Object.entries(t).forEach(([t,i])=>n.setProp(t,i,e)),!0),t)}removeCell(t,e={}){const n="string"===typeof t?this.getCell(t):t;return n&&this.has(n)?this.collection.remove(n,e):null}updateCellId(t,e){if(t.id===e)return;this.startBatch("update",{id:e}),t.prop("id",e);const n=t.clone({keepId:!0});this.addCell(n);const i=this.getConnectedEdges(t);return i.forEach(n=>{const i=n.getSourceCell(),s=n.getTargetCell();i===t&&n.setSource(Object.assign(Object.assign({},n.getSource()),{cell:e})),s===t&&n.setTarget(Object.assign(Object.assign({},n.getTarget()),{cell:e}))}),this.removeCell(t),this.stopBatch("update",{id:e}),n}removeCells(t,e={}){return t.length?this.batchUpdate("remove",()=>t.map(t=>this.removeCell(t,e))):[]}removeConnectedEdges(t,e={}){const n=this.getConnectedEdges(t);return n.forEach(t=>{t.remove(e)}),n}disconnectConnectedEdges(t,e={}){const n="string"===typeof t?t:t.id;this.getConnectedEdges(t).forEach(t=>{const i=t.getSourceCellId(),s=t.getTargetCellId();i===n&&t.setSource({x:0,y:0},e),s===n&&t.setTarget({x:0,y:0},e)})}has(t){return this.collection.has(t)}total(){return this.collection.length}indexOf(t){return this.collection.indexOf(t)}getCell(t){return this.collection.get(t)}getCells(){return this.collection.toArray()}getFirstCell(){return this.collection.first()}getLastCell(){return this.collection.last()}getMinZIndex(){const t=this.collection.first();return t&&t.getZIndex()||0}getMaxZIndex(){const t=this.collection.last();return t&&t.getZIndex()||0}getCellsFromCache(t){return t?Object.keys(t).map(t=>this.getCell(t)).filter(t=>null!=t):[]}getNodes(){return this.getCellsFromCache(this.nodes)}getEdges(){return this.getCellsFromCache(this.edges)}getOutgoingEdges(t){const e="string"===typeof t?t:t.id,n=this.outgoings[e];return n?n.map(t=>this.getCell(t)).filter(t=>t&&t.isEdge()):null}getIncomingEdges(t){const e="string"===typeof t?t:t.id,n=this.incomings[e];return n?n.map(t=>this.getCell(t)).filter(t=>t&&t.isEdge()):null}getConnectedEdges(t,e={}){const n=[],i="string"===typeof t?this.getCell(t):t;if(null==i)return n;const s={},r=e.indirect;let o=e.incoming,a=e.outgoing;null==o&&null==a&&(o=a=!0);const l=(t,e)=>{const i=e?this.getOutgoingEdges(t):this.getIncomingEdges(t);if(null!=i&&i.forEach(t=>{s[t.id]||(n.push(t),s[t.id]=!0,r&&(o&&l(t,!1),a&&l(t,!0)))}),r&&t.isEdge()){const i=e?t.getTargetCell():t.getSourceCell();i&&i.isEdge()&&(s[i.id]||(n.push(i),l(i,e)))}};if(a&&l(i,!0),o&&l(i,!1),e.deep){const t=i.getDescendants({deep:!0}),r={};t.forEach(t=>{t.isNode()&&(r[t.id]=!0)});const l=(t,i)=>{const o=i?this.getOutgoingEdges(t.id):this.getIncomingEdges(t.id);null!=o&&o.forEach(t=>{if(!s[t.id]){const i=t.getSourceCell(),o=t.getTargetCell();if(!e.enclosed&&i&&r[i.id]&&o&&r[o.id])return;n.push(t),s[t.id]=!0}})};t.forEach(t=>{t.isEdge()||(a&&l(t,!0),o&&l(t,!1))})}return n}isBoundary(t,e){const n="string"===typeof t?this.getCell(t):t,i=e?this.getIncomingEdges(n):this.getOutgoingEdges(n);return null==i||0===i.length}getBoundaryNodes(t){const e=[];return Object.keys(this.nodes).forEach(n=>{if(this.isBoundary(n,t)){const t=this.getCell(n);t&&e.push(t)}}),e}getRoots(){return this.getBoundaryNodes(!0)}getLeafs(){return this.getBoundaryNodes(!1)}isRoot(t){return this.isBoundary(t,!0)}isLeaf(t){return this.isBoundary(t,!1)}getNeighbors(t,e={}){let n=e.incoming,i=e.outgoing;null==n&&null==i&&(n=i=!0);const s=this.getConnectedEdges(t,e),r=s.reduce((s,r)=>{const o=r.hasLoop(e),a=r.getSourceCell(),l=r.getTargetCell();return n&&a&&a.isNode()&&!s[a.id]&&(!o&&(a===t||e.deep&&a.isDescendantOf(t))||(s[a.id]=a)),i&&l&&l.isNode()&&!s[l.id]&&(!o&&(l===t||e.deep&&l.isDescendantOf(t))||(s[l.id]=l)),s},{});if(t.isEdge()){if(n){const e=t.getSourceCell();e&&e.isNode()&&!r[e.id]&&(r[e.id]=e)}if(i){const e=t.getTargetCell();e&&e.isNode()&&!r[e.id]&&(r[e.id]=e)}}return Object.keys(r).map(t=>r[t])}isNeighbor(t,e,n={}){let i=n.incoming,s=n.outgoing;return null==i&&null==s&&(i=s=!0),this.getConnectedEdges(t,n).some(t=>{const n=t.getSourceCell(),r=t.getTargetCell();return!(!i||!n||n.id!==e.id)||!(!s||!r||r.id!==e.id)})}getSuccessors(t,e={}){const n=[];return this.search(t,(i,s)=>{i!==t&&this.matchDistance(s,e.distance)&&n.push(i)},Object.assign(Object.assign({},e),{outgoing:!0})),n}isSuccessor(t,e,n={}){let i=!1;return this.search(t,(s,r)=>{if(s===e&&s!==t&&this.matchDistance(r,n.distance))return i=!0,!1},Object.assign(Object.assign({},n),{outgoing:!0})),i}getPredecessors(t,e={}){const n=[];return this.search(t,(i,s)=>{i!==t&&this.matchDistance(s,e.distance)&&n.push(i)},Object.assign(Object.assign({},e),{incoming:!0})),n}isPredecessor(t,e,n={}){let i=!1;return this.search(t,(s,r)=>{if(s===e&&s!==t&&this.matchDistance(r,n.distance))return i=!0,!1},Object.assign(Object.assign({},n),{incoming:!0})),i}matchDistance(t,e){return null==e||("function"===typeof e?e(t):!(!Array.isArray(e)||!e.includes(t))||t===e)}getCommonAncestor(...t){const e=[];return t.forEach(t=>{t&&(Array.isArray(t)?e.push(...t):e.push(t))}),EE.getCommonAncestor(...e)}getSubGraph(t,e={}){const n=[],i={},s=[],r=[],o=t=>{i[t.id]||(n.push(t),i[t.id]=t,t.isEdge()&&r.push(t),t.isNode()&&s.push(t))};return t.forEach(t=>{if(o(t),e.deep){const e=t.getDescendants({deep:!0});e.forEach(t=>o(t))}}),r.forEach(t=>{const e=t.getSourceCell(),r=t.getTargetCell();e&&!i[e.id]&&(n.push(e),i[e.id]=e,e.isNode()&&s.push(e)),r&&!i[r.id]&&(n.push(r),i[r.id]=r,r.isNode()&&s.push(r))}),s.forEach(t=>{const s=this.getConnectedEdges(t,e);s.forEach(t=>{const e=t.getSourceCell(),s=t.getTargetCell();!i[t.id]&&e&&i[e.id]&&s&&i[s.id]&&(n.push(t),i[t.id]=t)})}),n}cloneSubGraph(t,e={}){const n=this.getSubGraph(t,e);return this.cloneCells(n)}cloneCells(t){return EE.cloneCells(t)}getNodesFromPoint(t,e){const n="number"===typeof t?{x:t,y:e||0}:t;return this.getNodes().filter(t=>t.getBBox().containsPoint(n))}getNodesInArea(t,e,n,i,s){const r="number"===typeof t?new Tb(t,e,n,i):Tb.create(t),o="number"===typeof t?s:e,a=o&&o.strict;return this.getNodes().filter(t=>{const e=t.getBBox();return a?r.containsRect(e):r.isIntersectWithRect(e)})}getEdgesInArea(t,e,n,i,s){const r="number"===typeof t?new Tb(t,e,n,i):Tb.create(t),o="number"===typeof t?s:e,a=o&&o.strict;return this.getEdges().filter(t=>{const e=t.getBBox();return 0===e.width?e.inflate(1,0):0===e.height&&e.inflate(0,1),a?r.containsRect(e):r.isIntersectWithRect(e)})}getNodesUnderNode(t,e={}){const n=t.getBBox(),i=null==e.by||"bbox"===e.by?this.getNodesInArea(n):this.getNodesFromPoint(n[e.by]);return i.filter(e=>t.id!==e.id&&!e.isDescendantOf(t))}getAllCellsBBox(){return this.getCellsBBox(this.getCells())}getCellsBBox(t,e={}){return EE.getCellsBBox(t,e)}search(t,e,n={}){n.breadthFirst?this.breadthFirstSearch(t,e,n):this.depthFirstSearch(t,e,n)}breadthFirstSearch(t,e,n={}){const i=[],s={},r={};i.push(t),r[t.id]=0;while(i.length>0){const t=i.shift();if(null==t||s[t.id])continue;if(s[t.id]=!0,!1===Pt(e,this,t,r[t.id]))continue;const o=this.getNeighbors(t,n);o.forEach(e=>{r[e.id]=r[t.id]+1,i.push(e)})}}depthFirstSearch(t,e,n={}){const i=[],s={},r={};i.push(t),r[t.id]=0;while(i.length>0){const t=i.pop();if(null==t||s[t.id])continue;if(s[t.id]=!0,!1===Pt(e,this,t,r[t.id]))continue;const o=this.getNeighbors(t,n),a=i.length;o.forEach(e=>{r[e.id]=r[t.id]+1,i.splice(a,0,e)})}}getShortestPath(t,e,n={}){const i={};this.getEdges().forEach(t=>{const e=t.getSourceCellId(),s=t.getTargetCellId();e&&s&&(i[e]||(i[e]=[]),i[s]||(i[s]=[]),i[e].push(s),n.directed||i[s].push(e))});const s="string"===typeof t?t:t.id,r=mb.run(i,s,n.weight),o=[];let a="string"===typeof e?e:e.id;r[a]&&o.push(a);while(a=r[a])o.unshift(a);return o}translate(t,e,n){return this.getCells().filter(t=>!t.hasParent()).forEach(i=>i.translate(t,e,n)),this}resize(t,e,n){return this.resizeCells(t,e,this.getCells(),n)}resizeCells(t,e,n,i={}){const s=this.getCellsBBox(n);if(s){const r=Math.max(t/s.width,0),o=Math.max(e/s.height,0),a=s.getOrigin();n.forEach(t=>t.scale(r,o,a,i))}return this}toJSON(t={}){return LE.toJSON(this.getCells(),t)}parseJSON(t){return LE.fromJSON(t)}fromJSON(t,e={}){const n=this.parseJSON(t);return this.resetCells(n,e),this}startBatch(t,e={}){return this.batches[t]=(this.batches[t]||0)+1,this.notify("batch:start",{name:t,data:e}),this}stopBatch(t,e={}){return this.batches[t]=(this.batches[t]||0)-1,this.notify("batch:stop",{name:t,data:e}),this}batchUpdate(t,e,n={}){this.startBatch(t,n);const i=e();return this.stopBatch(t,n),i}hasActiveBatch(t=Object.keys(this.batches)){const e=Array.isArray(t)?t:[t];return e.some(t=>this.batches[t]>0)}dispose(){this.collection.dispose()}}jE([LE.dispose()],LE.prototype,"dispose",null),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.addNode&&"function"===typeof i.addEdge&&null!=i.collection}t.toStringTag=`X6.${t.name}`,t.isModel=e}(LE||(LE={})),function(t){function e(t,e={}){return{cells:t.map(t=>t.toJSON(e))}}function n(t){const e=[];return Array.isArray(t)?e.push(...t):(t.cells&&e.push(...t.cells),t.nodes&&t.nodes.forEach(t=>{null==t.shape&&(t.shape="rect"),e.push(t)}),t.edges&&t.edges.forEach(t=>{null==t.shape&&(t.shape="edge"),e.push(t)})),e.map(t=>{const e=t.shape;if(e){if(AE.registry.exist(e))return AE.create(t);if(NE.registry.exist(e))return NE.create(t)}throw new Error("The `shape` should be specified when creating a node/edge instance")})}t.toJSON=e,t.fromJSON=n}(LE||(LE={}));var DE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class BE extends AE{get label(){return this.getLabel()}set label(t){this.setLabel(t)}getLabel(){return this.getAttrByPath("text/text")}setLabel(t,e){return null==t?this.removeLabel():this.setAttrByPath("text/text",t,e),this}removeLabel(){return this.removeAttrByPath("text/text"),this}}(function(t){t.bodyAttr={fill:"#ffffff",stroke:"#333333",strokeWidth:2},t.labelAttr={fontSize:14,fill:"#000000",refX:.5,refY:.5,textAnchor:"middle",textVerticalAnchor:"middle",fontFamily:"Arial, helvetica, sans-serif"},t.config({attrs:{text:Object.assign({},t.labelAttr)},propHooks(t){const{label:e}=t,n=DE(t,["label"]);return e&&$h(n,"attrs/text/text",e),n},visible:!0})})(BE||(BE={}));var IE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};function RE(t,e="body"){return[{tagName:t,selector:e},{tagName:"text",selector:"label"}]}function VE(t="xlink:href"){const e=e=>{const{imageUrl:n,imageWidth:i,imageHeight:s}=e,r=IE(e,["imageUrl","imageWidth","imageHeight"]);if(null!=n||null!=i||null!=s){const e=()=>{if(r.attrs){const e=r.attrs.image;null!=n&&(e[t]=n),null!=i&&(e.width=i),null!=s&&(e.height=s),r.attrs.image=e}};r.attrs?(null==r.attrs.image&&(r.attrs.image={}),e()):(r.attrs={image:{}},e())}return r};return e}function zE(t,e,n={}){const i={constructorName:t,markup:RE(t,n.selector),attrs:{[t]:Object.assign({},BE.bodyAttr)}},s=n.parent||BE;return s.define(jo(i,e,{shape:t}))}const $E=zE("rect",{attrs:{body:{refWidth:"100%",refHeight:"100%"}}}),FE=NE.define({shape:"edge",markup:[{tagName:"path",selector:"wrap",groupSelector:"lines",attrs:{fill:"none",cursor:"pointer",stroke:"transparent",strokeLinecap:"round"}},{tagName:"path",selector:"line",groupSelector:"lines",attrs:{fill:"none",pointerEvents:"none"}}],attrs:{lines:{connection:!0,strokeLinejoin:"round"},wrap:{strokeWidth:10},line:{stroke:"#333",strokeWidth:2,targetMarker:"classic"}}});zE("ellipse",{attrs:{body:{refCx:"50%",refCy:"50%",refRx:"50%",refRy:"50%"}}});var GE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class _E extends BE{get points(){return this.getPoints()}set points(t){this.setPoints(t)}getPoints(){return this.getAttrByPath("body/refPoints")}setPoints(t,e){return null==t?this.removePoints():this.setAttrByPath("body/refPoints",_E.pointsToString(t),e),this}removePoints(){return this.removeAttrByPath("body/refPoints"),this}}(function(t){function e(t){return"string"===typeof t?t:t.map(t=>Array.isArray(t)?t.join(","):Nb.isPointLike(t)?`${t.x}, ${t.y}`:"").join(" ")}t.pointsToString=e,t.config({propHooks(t){const{points:n}=t,i=GE(t,["points"]);if(n){const t=e(n);t&&$h(i,"attrs/body/refPoints",t)}return i}})})(_E||(_E={}));zE("polygon",{},{parent:_E}),zE("polyline",{},{parent:_E});var HE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};BE.define({shape:"path",markup:[{tagName:"rect",selector:"bg"},{tagName:"path",selector:"body"},{tagName:"text",selector:"label"}],attrs:{bg:{refWidth:"100%",refHeight:"100%",fill:"none",stroke:"none",pointerEvents:"all"},body:{fill:"none",stroke:"#000",strokeWidth:2}},propHooks(t){const{path:e}=t,n=HE(t,["path"]);return e&&$h(n,"attrs/body/refD",e),n}});var UE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};BE.define({shape:"text-block",markup:[{tagName:"rect",selector:"body"},Vf.SUPPORT_FOREIGNOBJECT?{tagName:"foreignObject",selector:"foreignObject",children:[{tagName:"div",ns:Zf.xhtml,selector:"label",style:{width:"100%",height:"100%",position:"static",backgroundColor:"transparent",textAlign:"center",margin:0,padding:"0px 5px",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center"}}]}:{tagName:"text",selector:"label",attrs:{textAnchor:"middle"}}],attrs:{body:Object.assign(Object.assign({},BE.bodyAttr),{refWidth:"100%",refHeight:"100%"}),foreignObject:{refWidth:"100%",refHeight:"100%"},label:{style:{fontSize:14}}},propHooks(t){const{text:e}=t,n=UE(t,["text"]);return e&&$h(n,"attrs/label/text",e),n},attrHooks:{text:{set(t,{cell:e,view:n,refBBox:i,elem:s,attrs:r}){if(!(s instanceof HTMLElement)){const o=r.style||{},a={text:t,width:-5,height:"100%"},l=Object.assign({textVerticalAnchor:"middle"},o),c=iw.presets.textWrap;return Pt(c.set,this,a,{cell:e,view:n,elem:s,refBBox:i,attrs:l}),{fill:o.color||null}}s.textContent=t},position(t,{refBBox:e,elem:n}){if(n instanceof SVGElement)return e.getCenter()}}}}),zE("image",{attrs:{image:{refWidth:"100%",refHeight:"100%"}},propHooks:VE()},{selector:"image"}),zE("circle",{attrs:{body:{refCx:"50%",refCy:"50%",refR:"50%"}}});class JE extends eC{constructor(){super(...arguments),this.portsCache={}}get[Symbol.toStringTag](){return JE.toStringTag}getContainerClassName(){const t=[super.getContainerClassName(),this.prefixClassName("node")];return this.can("nodeMovable")||t.push(this.prefixClassName("node-immovable")),t.join(" ")}updateClassName(t){const e=t.target;if(e.hasAttribute("magnet")){const t=this.prefixClassName("port-unconnectable");this.can("magnetConnectable")?Uf(e,t):Hf(e,t)}else{const t=this.prefixClassName("node-immovable");this.can("nodeMovable")?this.removeClass(t):this.addClass(t)}}isNodeView(){return!0}confirmUpdate(t,e={}){let n=t;return this.hasAction(n,"ports")&&(this.removePorts(),this.cleanPortsCache()),this.hasAction(n,"render")?(this.render(),n=this.removeAction(n,["render","update","resize","translate","rotate","ports","tools"])):(n=this.handleAction(n,"resize",()=>this.resize(),"update"),n=this.handleAction(n,"update",()=>this.update(),sw.useCSSSelector?"ports":null),n=this.handleAction(n,"translate",()=>this.translate()),n=this.handleAction(n,"rotate",()=>this.rotate()),n=this.handleAction(n,"ports",()=>this.renderPorts()),n=this.handleAction(n,"tools",()=>{this.getFlag("tools")===t?this.renderTools():this.updateTools(e)})),n}update(t){this.cleanCache(),sw.useCSSSelector&&this.removePorts();const e=this.cell,n=e.getSize(),i=e.getAttrs();this.updateAttrs(this.container,i,{attrs:t===i?null:t,rootBBox:new Tb(0,0,n.width,n.height),selectors:this.selectors}),sw.useCSSSelector&&this.renderPorts()}renderMarkup(){const t=this.cell.markup;if(t){if("string"===typeof t)throw new TypeError("Not support string markup.");return this.renderJSONMarkup(t)}throw new TypeError("Invalid node markup.")}renderJSONMarkup(t){const e=this.parseJSONMarkup(t,this.container);this.selectors=e.selectors,this.container.appendChild(e.fragment)}render(){return this.empty(),this.renderMarkup(),this.resize(),this.updateTransform(),sw.useCSSSelector||this.renderPorts(),this.renderTools(),this}resize(){this.cell.getAngle()&&this.rotate(),this.update()}translate(){this.updateTransform()}rotate(){this.updateTransform()}getTranslationString(){const t=this.cell.getPosition();return`translate(${t.x},${t.y})`}getRotationString(){const t=this.cell.getAngle();if(t){const e=this.cell.getSize();return`rotate(${t},${e.width/2},${e.height/2})`}}updateTransform(){let t=this.getTranslationString();const e=this.getRotationString();e&&(t+=` ${e}`),this.container.setAttribute("transform",t)}findPortElem(t,e){const n=t?this.portsCache[t]:null;if(!n)return null;const i=n.portContentElement,s=n.portContentSelectors||{};return this.findOne(e,i,s)}cleanPortsCache(){this.portsCache={}}removePorts(){Object.values(this.portsCache).forEach(t=>{hm(t.portElement)})}renderPorts(){const t=this.container,e=[];t.childNodes.forEach(t=>{e.push(t)});const n=this.cell.getParsedPorts(),i=Sd(n,"zIndex"),s="auto";i[s]&&i[s].forEach(n=>{const i=this.getPortElement(n);t.append(i),e.push(i)}),Object.keys(i).forEach(t=>{if(t!==s){const n=parseInt(t,10);this.appendPorts(i[t],n,e)}}),this.updatePorts()}appendPorts(t,e,n){const i=t.map(t=>this.getPortElement(t));n[e]||e<0?pm(n[Math.max(e,0)],i):dm(this.container,i)}getPortElement(t){const e=this.portsCache[t.id];return e?e.portElement:this.createPortElement(t)}createPortElement(t){let e=qw.renderMarkup(this.cell.getPortContainerMarkup());const n=e.elem;if(null==n)throw new Error("Invalid port container markup.");e=qw.renderMarkup(this.getPortMarkup(t));const i=e.elem,s=e.selectors;if(null==i)throw new Error("Invalid port markup.");this.setAttrs({port:t.id,"port-group":t.group},i);let r="x6-port";t.group&&(r+=` x6-port-${t.group}`),Hf(n,r),Hf(n,"x6-port"),Hf(i,"x6-port-body"),n.appendChild(i);let o,a,l=s;const c=this.existPortLabel(t);if(c){if(e=qw.renderMarkup(this.getPortLabelMarkup(t.label)),o=e.elem,a=e.selectors,null==o)throw new Error("Invalid port label markup.");if(s&&a){for(const t in a)if(s[t]&&t!==this.rootSelector)throw new Error("Selectors within port must be unique.");l=Object.assign(Object.assign({},s),a)}Hf(o,"x6-port-label"),n.appendChild(o)}return this.portsCache[t.id]={portElement:n,portSelectors:l,portLabelElement:o,portLabelSelectors:a,portContentElement:i,portContentSelectors:s},this.graph.options.onPortRendered&&this.graph.options.onPortRendered({port:t,node:this.cell,container:n,selectors:l,labelContainer:o,labelSelectors:a,contentContainer:i,contentSelectors:s}),n}updatePorts(){const t=this.cell.getParsedGroups(),e=Object.keys(t);0===e.length?this.updatePortGroup():e.forEach(t=>this.updatePortGroup(t))}updatePortGroup(t){const e=Tb.fromSize(this.cell.getSize()),n=this.cell.getPortsLayoutByGroup(t,e);for(let i=0,s=n.length;i<s;i+=1){const t=n[i],e=t.portId,s=this.portsCache[e]||{},r=t.portLayout;if(this.applyPortTransform(s.portElement,r),null!=t.portAttrs){const e={selectors:s.portSelectors||{}};t.portSize&&(e.rootBBox=Tb.fromSize(t.portSize)),this.updateAttrs(s.portElement,t.portAttrs,e)}const o=t.labelLayout;if(o&&s.portLabelElement&&(this.applyPortTransform(s.portLabelElement,o,-(r.angle||0)),o.attrs)){const e={selectors:s.portLabelSelectors||{}};t.labelSize&&(e.rootBBox=Tb.fromSize(t.labelSize)),this.updateAttrs(s.portLabelElement,o.attrs,e)}}}applyPortTransform(t,e,n=0){const i=e.angle,s=e.position,r=Dy().rotate(n).translate(s.x||0,s.y||0).rotate(i||0);Hy(t,r,{absolute:!0})}getPortMarkup(t){return t.markup||this.cell.portMarkup}getPortLabelMarkup(t){return t.markup||this.cell.portLabelMarkup}existPortLabel(t){return t.attrs&&t.attrs.text}getEventArgs(t,e,n){const i=this,s=i.cell,r=s;return null==e||null==n?{e:t,view:i,node:s,cell:r}:{e:t,x:e,y:n,view:i,node:s,cell:r}}getPortEventArgs(t,e,n){const i=this,s=i.cell,r=s;return n?{e:t,x:n.x,y:n.y,view:i,node:s,cell:r,port:e}:{e:t,view:i,node:s,cell:r,port:e}}notifyMouseDown(t,e,n){super.onMouseDown(t,e,n),this.notify("node:mousedown",this.getEventArgs(t,e,n))}notifyMouseMove(t,e,n){super.onMouseMove(t,e,n),this.notify("node:mousemove",this.getEventArgs(t,e,n))}notifyMouseUp(t,e,n){super.onMouseUp(t,e,n),this.notify("node:mouseup",this.getEventArgs(t,e,n))}notifyPortEvent(t,e,n){const i=this.findAttr("port",e.target);if(i){const s=e.type;"node:port:mouseenter"===t?e.type="mouseenter":"node:port:mouseleave"===t&&(e.type="mouseleave"),this.notify(t,this.getPortEventArgs(e,i,n)),e.type=s}}onClick(t,e,n){super.onClick(t,e,n),this.notify("node:click",this.getEventArgs(t,e,n)),this.notifyPortEvent("node:port:click",t,{x:e,y:n})}onDblClick(t,e,n){super.onDblClick(t,e,n),this.notify("node:dblclick",this.getEventArgs(t,e,n)),this.notifyPortEvent("node:port:dblclick",t,{x:e,y:n})}onContextMenu(t,e,n){super.onContextMenu(t,e,n),this.notify("node:contextmenu",this.getEventArgs(t,e,n)),this.notifyPortEvent("node:port:contextmenu",t,{x:e,y:n})}onMouseDown(t,e,n){this.isPropagationStopped(t)||(this.notifyMouseDown(t,e,n),this.notifyPortEvent("node:port:mousedown",t,{x:e,y:n}),this.startNodeDragging(t,e,n))}onMouseMove(t,e,n){const i=this.getEventData(t),s=i.action;if("magnet"===s)this.dragMagnet(t,e,n);else{if("move"===s){const s=i,r=s.targetView||this;r.dragNode(t,e,n),r.notify("node:moving",{e:t,x:e,y:n,view:r,cell:r.cell,node:r.cell})}this.notifyMouseMove(t,e,n),this.notifyPortEvent("node:port:mousemove",t,{x:e,y:n})}this.setEventData(t,i)}onMouseUp(t,e,n){const i=this.getEventData(t),s=i.action;if("magnet"===s)this.stopMagnetDragging(t,e,n);else if(this.notifyMouseUp(t,e,n),this.notifyPortEvent("node:port:mouseup",t,{x:e,y:n}),"move"===s){const s=i,r=s.targetView||this;r.stopNodeDragging(t,e,n)}const r=i.targetMagnet;r&&this.onMagnetClick(t,r,e,n),this.checkMouseleave(t)}onMouseOver(t){super.onMouseOver(t),this.notify("node:mouseover",this.getEventArgs(t)),this.notifyPortEvent("node:port:mouseenter",t),this.notifyPortEvent("node:port:mouseover",t)}onMouseOut(t){super.onMouseOut(t),this.notify("node:mouseout",this.getEventArgs(t)),this.notifyPortEvent("node:port:mouseleave",t),this.notifyPortEvent("node:port:mouseout",t)}onMouseEnter(t){this.updateClassName(t),super.onMouseEnter(t),this.notify("node:mouseenter",this.getEventArgs(t))}onMouseLeave(t){super.onMouseLeave(t),this.notify("node:mouseleave",this.getEventArgs(t))}onMouseWheel(t,e,n,i){super.onMouseWheel(t,e,n,i),this.notify("node:mousewheel",Object.assign({delta:i},this.getEventArgs(t,e,n)))}onMagnetClick(t,e,n,i){const s=this.graph,r=s.view.getMouseMovedCount(t);r>s.options.clickThreshold||this.notify("node:magnet:click",Object.assign({magnet:e},this.getEventArgs(t,n,i)))}onMagnetDblClick(t,e,n,i){this.notify("node:magnet:dblclick",Object.assign({magnet:e},this.getEventArgs(t,n,i)))}onMagnetContextMenu(t,e,n,i){this.notify("node:magnet:contextmenu",Object.assign({magnet:e},this.getEventArgs(t,n,i)))}onMagnetMouseDown(t,e,n,i){this.startMagnetDragging(t,n,i)}onCustomEvent(t,e,n,i){this.notify("node:customevent",Object.assign({name:e},this.getEventArgs(t,n,i))),super.onCustomEvent(t,e,n,i)}prepareEmbedding(t){const e=this.graph,n=this.getEventData(t),i=n.cell||this.cell,s=e.findViewByCell(i),r=e.snapToGrid(t.clientX,t.clientY);this.notify("node:embed",{e:t,node:i,view:s,cell:i,x:r.x,y:r.y,currentParent:i.getParent()})}processEmbedding(t,e){const n=e.cell||this.cell,i=e.graph||this.graph,s=i.options.embedding,r=s.findParent;let o="function"===typeof r?Pt(r,i,{view:this,node:this.cell}).filter(t=>EE.isCell(t)&&this.cell.id!==t.id&&!t.isDescendantOf(this.cell)):i.model.getNodesUnderNode(n,{by:r});if(s.frontOnly&&o.length>0){const t=Sd(o,"zIndex"),e=zd(Object.keys(t).map(t=>parseInt(t,10)));e&&(o=t[e])}o=o.filter(t=>t.visible);let a=null;const l=e.candidateEmbedView,c=s.validate;for(let u=o.length-1;u>=0;u-=1){const t=o[u];if(l&&l.cell.id===t.id){a=l;break}{const e=t.findView(i);if(c&&Pt(c,i,{child:this.cell,parent:e.cell,childView:this,parentView:e})){a=e;break}}}this.clearEmbedding(e),a&&a.highlight(null,{type:"embedding"}),e.candidateEmbedView=a;const h=i.snapToGrid(t.clientX,t.clientY);this.notify("node:embedding",{e:t,cell:n,node:n,view:i.findViewByCell(n),x:h.x,y:h.y,currentParent:n.getParent(),candidateParent:a?a.cell:null})}clearEmbedding(t){const e=t.candidateEmbedView;e&&(e.unhighlight(null,{type:"embedding"}),t.candidateEmbedView=null)}finalizeEmbedding(t,e){this.graph.startBatch("embedding");const n=e.cell||this.cell,i=e.graph||this.graph,s=i.findViewByCell(n),r=n.getParent(),o=e.candidateEmbedView;if(o?(o.unhighlight(null,{type:"embedding"}),e.candidateEmbedView=null,null!=r&&r.id===o.cell.id||o.cell.insertChild(n,void 0,{ui:!0})):r&&r.unembed(n,{ui:!0}),i.model.getConnectedEdges(n,{deep:!0}).forEach(t=>{t.updateParent({ui:!0})}),s&&o){const e=i.snapToGrid(t.clientX,t.clientY);s.notify("node:embedded",{e:t,cell:n,x:e.x,y:e.y,node:n,view:i.findViewByCell(n),previousParent:r,currentParent:n.getParent()})}this.graph.stopBatch("embedding")}getDelegatedView(){let t=this.cell,e=this;while(e){if(t.isEdge())break;if(!t.hasParent()||e.can("stopDelegateOnDragging"))return e;t=t.getParent(),e=this.graph.findViewByCell(t)}return null}validateMagnet(t,e,n){if("passive"!==e.getAttribute("magnet")){const i=this.graph.options.connecting.validateMagnet;return!i||Pt(i,this.graph,{e:n,magnet:e,view:t,cell:t.cell})}return!1}startMagnetDragging(t,e,n){if(!this.can("magnetConnectable"))return;t.stopPropagation();const i=t.currentTarget,s=this.graph;this.setEventData(t,{targetMagnet:i}),this.validateMagnet(this,i,t)?(s.options.magnetThreshold<=0&&this.startConnectting(t,i,e,n),this.setEventData(t,{action:"magnet"}),this.stopPropagation(t)):this.onMouseDown(t,e,n),s.view.delegateDragEvents(t,this)}startConnectting(t,e,n,i){this.graph.model.startBatch("add-edge");const s=this.createEdgeFromMagnet(e,n,i);s.setEventData(t,s.prepareArrowheadDragging("target",{x:n,y:i,isNewEdge:!0,fallbackAction:"remove"})),this.setEventData(t,{edgeView:s}),s.notifyMouseDown(t,n,i)}getDefaultEdge(t,e){let n;const i=this.graph.options.connecting.createEdge;return i&&(n=Pt(i,this.graph,{sourceMagnet:e,sourceView:t,sourceCell:t.cell})),n}createEdgeFromMagnet(t,e,n){const i=this.graph,s=i.model,r=this.getDefaultEdge(this,t);return r.setSource(Object.assign(Object.assign({},r.getSource()),this.getEdgeTerminal(t,e,n,r,"source"))),r.setTarget(Object.assign(Object.assign({},r.getTarget()),{x:e,y:n})),r.addTo(s,{async:!1,ui:!0}),r.findView(i)}dragMagnet(t,e,n){const i=this.getEventData(t),s=i.edgeView;if(s)s.onMouseMove(t,e,n),this.autoScrollGraph(t.clientX,t.clientY);else{const s=this.graph,r=s.options.magnetThreshold,o=this.getEventTarget(t),a=i.targetMagnet;if("onleave"===r){if(a===o||a.contains(o))return}else if(s.view.getMouseMovedCount(t)<=r)return;this.startConnectting(t,a,e,n)}}stopMagnetDragging(t,e,n){const i=this.eventData(t),s=i.edgeView;s&&(s.onMouseUp(t,e,n),this.graph.model.stopBatch("add-edge"))}notifyUnhandledMouseDown(t,e,n){this.notify("node:unhandled:mousedown",{e:t,x:e,y:n,view:this,cell:this.cell,node:this.cell})}notifyNodeMove(t,e,n,i,s){let r=[s];const o=this.graph.getPlugin("selection");if(o&&o.isSelectionMovable()){const t=o.getSelectedCells();t.includes(s)&&(r=t.filter(t=>t.isNode()))}r.forEach(s=>{this.notify(t,{e:e,x:n,y:i,cell:s,node:s,view:s.findView(this.graph)})})}getRestrictArea(t){const e=this.graph.options.translating.restrict,n="function"===typeof e?Pt(e,this.graph,t):e;return"number"===typeof n?this.graph.transform.getGraphArea().inflate(n):!0===n?this.graph.transform.getGraphArea():n||null}startNodeDragging(t,e,n){const i=this.getDelegatedView();if(null==i||!i.can("nodeMovable"))return this.notifyUnhandledMouseDown(t,e,n);this.setEventData(t,{targetView:i,action:"move"});const s=Nb.create(i.cell.getPosition());i.setEventData(t,{moving:!1,offset:s.diff(e,n),restrict:this.getRestrictArea(i)})}dragNode(t,e,n){const i=this.cell,s=this.graph,r=s.getGridSize(),o=this.getEventData(t),a=o.offset,l=o.restrict;o.moving||(o.moving=!0,this.addClass("node-moving"),this.notifyNodeMove("node:move",t,e,n,this.cell)),this.autoScrollGraph(t.clientX,t.clientY);const c=Ab.snapToGrid(e+a.x,r),h=Ab.snapToGrid(n+a.y,r);i.setPosition(c,h,{restrict:l,deep:!0,ui:!0}),s.options.embedding.enabled&&(o.embedding||(this.prepareEmbedding(t),o.embedding=!0),this.processEmbedding(t,o))}autoOffsetNode(){const t=this.cell,e=this.graph,n=Object.assign({id:t.id},t.getPosition()),i=e.getNodes(),s=i.map(t=>{const e=t.getPosition();return{id:t.id,x:e.x,y:e.y}}).filter(t=>t.id!==n.id),r=[[1,1],[1,-1],[-1,1],[-1,-1]];let o=e.getGridSize();const a=t=>s.some(e=>e.x===t.x&&e.y===t.y);while(a(n)){let i=!1;for(let e=0;e<r.length;e+=1){const s=r[e],l={x:n.x+s[0]*o,y:n.y+s[1]*o};if(!a(l)){t.translate(s[0]*o,s[1]*o),i=!0;break}}if(i)break;o+=e.getGridSize()}}stopNodeDragging(t,e,n){const i=this.getEventData(t),s=this.graph;if(i.embedding&&this.finalizeEmbedding(t,i),i.moving){const i=s.options.translating.autoOffset;i&&this.autoOffsetNode(),this.removeClass("node-moving"),this.notifyNodeMove("node:moved",t,e,n,this.cell)}i.moving=!1,i.embedding=!1}autoScrollGraph(t,e){const n=this.graph.getPlugin("scroller");n&&n.autoScroll(t,e)}}(function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNodeView&&"function"===typeof i.isEdgeView&&"function"===typeof i.confirmUpdate&&"function"===typeof i.update&&"function"===typeof i.findPortElem&&"function"===typeof i.resize&&"function"===typeof i.rotate&&"function"===typeof i.translate}t.toStringTag=`X6.${t.name}`,t.isNodeView=e})(JE||(JE={})),JE.config({isSvgElement:!0,priority:0,bootstrap:["render"],actions:{view:["render"],markup:["render"],attrs:["update"],size:["resize","ports","tools"],angle:["rotate","tools"],position:["translate","tools"],ports:["ports"],tools:["tools"]}}),JE.registry.register("node",JE,!0);var qE=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class WE extends eC{constructor(){super(...arguments),this.POINT_ROUNDING=2,this.labelDestroyFn={}}get[Symbol.toStringTag](){return WE.toStringTag}getContainerClassName(){return[super.getContainerClassName(),this.prefixClassName("edge")].join(" ")}get sourceBBox(){const t=this.sourceView;if(!t){const t=this.cell.getSource();return new Tb(t.x,t.y)}const e=this.sourceMagnet;return t.isEdgeElement(e)?new Tb(this.sourceAnchor.x,this.sourceAnchor.y):t.getBBoxOfElement(e||t.container)}get targetBBox(){const t=this.targetView;if(!t){const t=this.cell.getTarget();return new Tb(t.x,t.y)}const e=this.targetMagnet;return t.isEdgeElement(e)?new Tb(this.targetAnchor.x,this.targetAnchor.y):t.getBBoxOfElement(e||t.container)}isEdgeView(){return!0}confirmUpdate(t,e={}){let n=t;if(this.hasAction(n,"source")){if(!this.updateTerminalProperties("source"))return n;n=this.removeAction(n,"source")}if(this.hasAction(n,"target")){if(!this.updateTerminalProperties("target"))return n;n=this.removeAction(n,"target")}return this.hasAction(n,"render")?(this.render(),n=this.removeAction(n,["render","update","labels","tools"]),n):(n=this.handleAction(n,"update",()=>this.update(e)),n=this.handleAction(n,"labels",()=>this.onLabelsChange(e)),n=this.handleAction(n,"tools",()=>this.renderTools()),n)}render(){return this.empty(),this.renderMarkup(),this.labelContainer=null,this.renderLabels(),this.update(),this.renderTools(),this}renderMarkup(){const t=this.cell.markup;if(t){if("string"===typeof t)throw new TypeError("Not support string markup.");return this.renderJSONMarkup(t)}throw new TypeError("Invalid edge markup.")}renderJSONMarkup(t){const e=this.parseJSONMarkup(t,this.container);this.selectors=e.selectors,this.container.append(e.fragment)}customizeLabels(){if(this.labelContainer){const t=this.cell,e=t.labels;for(let n=0,i=e.length;n<i;n+=1){const i=e[n],s=this.labelCache[n],r=this.labelSelectors[n],o=this.graph.options.onEdgeLabelRendered;if(o){const e=o({edge:t,label:i,container:s,selectors:r});e&&(this.labelDestroyFn[n]=e)}}}}destroyCustomizeLabels(){const t=this.cell.labels;if(this.labelCache&&this.labelSelectors&&this.labelDestroyFn)for(let e=0,n=t.length;e<n;e+=1){const n=this.labelDestroyFn[e],i=this.labelCache[e],s=this.labelSelectors[e];n&&i&&s&&n({edge:this.cell,label:t[e],container:i,selectors:s})}this.labelDestroyFn={}}renderLabels(){const t=this.cell,e=t.getLabels(),n=e.length;let i=this.labelContainer;if(this.labelCache={},this.labelSelectors={},n<=0)return i&&i.parentNode&&i.parentNode.removeChild(i),this;i?this.empty(i):(i=em("g"),this.addClass(this.prefixClassName("edge-labels"),i),this.labelContainer=i);for(let s=0,r=e.length;s<r;s+=1){const n=e[s],r=this.normalizeLabelMarkup(this.parseLabelMarkup(n.markup));let o,a;if(r)o=r.node,a=r.selectors;else{const e=t.getDefaultLabel(),n=this.normalizeLabelMarkup(this.parseLabelMarkup(e.markup));o=n.node,a=n.selectors}o.setAttribute("data-index",`${s}`),i.appendChild(o);const l=this.rootSelector;if(a[l])throw new Error("Ambiguous label root selector.");a[l]=o,this.labelCache[s]=o,this.labelSelectors[s]=a}return null==i.parentNode&&this.container.appendChild(i),this.updateLabels(),this.customizeLabels(),this}onLabelsChange(t={}){this.destroyCustomizeLabels(),this.shouldRerenderLabels(t)?this.renderLabels():this.updateLabels(),this.updateLabelPositions()}shouldRerenderLabels(t={}){const e=this.cell.previous("labels");if(null==e)return!0;if("propertyPathArray"in t&&"propertyValue"in t){const n=t.propertyPathArray||[],i=n.length;if(i>1){const s=n[1];if(e[s]){if(2===i)return"object"===typeof t.propertyValue&&ri(t.propertyValue,"markup");if("markup"!==n[2])return!1}}}return!0}parseLabelMarkup(t){return t?"string"===typeof t?this.parseLabelStringMarkup(t):this.parseJSONMarkup(t):null}parseLabelStringMarkup(t){const e=ry.createVectors(t),n=document.createDocumentFragment();for(let i=0,s=e.length;i<s;i+=1){const t=e[i].node;n.appendChild(t)}return{fragment:n,selectors:{}}}normalizeLabelMarkup(t){if(null==t)return;const e=t.fragment;if(!(e instanceof DocumentFragment)||!e.hasChildNodes())throw new Error("Invalid label markup.");let n;const i=e.childNodes;return n=i.length>1||"G"!==i[0].nodeName.toUpperCase()?ry.create("g").append(e):ry.create(i[0]),n.addClass(this.prefixClassName("edge-label")),{node:n.node,selectors:t.selectors}}updateLabels(){if(this.labelContainer){const t=this.cell,e=t.labels,n=this.can("edgeLabelMovable"),i=t.getDefaultLabel();for(let s=0,r=e.length;s<r;s+=1){const t=this.labelCache[s],r=this.labelSelectors[s];t.setAttribute("cursor",n?"move":"default");const o=e[s],a=jo({},i.attrs,o.attrs);this.updateAttrs(t,a,{selectors:r,rootBBox:o.size?Tb.fromSize(o.size):void 0})}}}renderTools(){const t=this.cell.getTools();return this.addTools(t),this}update(t={}){this.cleanCache(),this.updateConnection(t);const e=this.cell.getAttrs(),{text:n}=e,i=qE(e,["text"]);return null!=i&&this.updateAttrs(this.container,i,{selectors:this.selectors}),this.updateLabelPositions(),this.updateTools(t),this}removeRedundantLinearVertices(t={}){const e=this.cell,n=e.getVertices(),i=[this.sourceAnchor,...n,this.targetAnchor],s=i.length,r=new $b(i);r.simplify({threshold:.01});const o=r.points.map(t=>t.toJSON()),a=o.length;return s===a?0:(e.setVertices(o.slice(1,a-1),t),s-a)}getTerminalView(t){switch(t){case"source":return this.sourceView||null;case"target":return this.targetView||null;default:throw new Error(`Unknown terminal type '${t}'`)}}getTerminalAnchor(t){switch(t){case"source":return Nb.create(this.sourceAnchor);case"target":return Nb.create(this.targetAnchor);default:throw new Error(`Unknown terminal type '${t}'`)}}getTerminalConnectionPoint(t){switch(t){case"source":return Nb.create(this.sourcePoint);case"target":return Nb.create(this.targetPoint);default:throw new Error(`Unknown terminal type '${t}'`)}}getTerminalMagnet(t,e={}){switch(t){case"source":{if(e.raw)return this.sourceMagnet;const t=this.sourceView;return t?this.sourceMagnet||t.container:null}case"target":{if(e.raw)return this.targetMagnet;const t=this.targetView;return t?this.targetMagnet||t.container:null}default:throw new Error(`Unknown terminal type '${t}'`)}}updateConnection(t={}){const e=this.cell;if(t.translateBy&&e.isFragmentDescendantOf(t.translateBy)){const e=t.tx||0,n=t.ty||0;this.routePoints=new $b(this.routePoints).translate(e,n).points,this.translateConnectionPoints(e,n),this.path.translate(e,n)}else{const t=e.getVertices(),n=this.findAnchors(t);this.sourceAnchor=n.source,this.targetAnchor=n.target,this.routePoints=this.findRoutePoints(t);const i=this.findConnectionPoints(this.routePoints,this.sourceAnchor,this.targetAnchor);this.sourcePoint=i.source,this.targetPoint=i.target;const s=this.findMarkerPoints(this.routePoints,this.sourcePoint,this.targetPoint);this.path=this.findPath(this.routePoints,s.source||this.sourcePoint,s.target||this.targetPoint)}this.cleanCache()}findAnchors(t){const e=this.cell,n=e.source,i=e.target,s=t[0],r=t[t.length-1];return i.priority&&!n.priority?this.findAnchorsOrdered("target",r,"source",s):this.findAnchorsOrdered("source",s,"target",r)}findAnchorsOrdered(t,e,n,i){let s,r;const o=this.cell,a=o[t],l=o[n],c=this.getTerminalView(t),h=this.getTerminalView(n),u=this.getTerminalMagnet(t),d=this.getTerminalMagnet(n);if(c){let n;n=e?Nb.create(e):h?d:Nb.create(l),s=this.getAnchor(a.anchor,c,u,n,t)}else s=Nb.create(a);if(h){const t=Nb.create(i||s);r=this.getAnchor(l.anchor,h,d,t,n)}else r=Nb.isPointLike(l)?Nb.create(l):new Nb;return{[t]:s,[n]:r}}getAnchor(t,e,n,i,s){const r=e.isEdgeElement(n),o=this.graph.options.connecting;let a,l="string"===typeof t?{name:t}:t;if(!l){const t=r?("source"===s?o.sourceEdgeAnchor:o.targetEdgeAnchor)||o.edgeAnchor:("source"===s?o.sourceAnchor:o.targetAnchor)||o.anchor;l="string"===typeof t?{name:t}:t}if(!l)throw new Error("Anchor should be specified.");const c=l.name;if(r){const t=QC.registry.get(c);if("function"!==typeof t)return QC.registry.onNotFound(c);a=Pt(t,this,e,n,i,l.args||{},s)}else{const t=JC.registry.get(c);if("function"!==typeof t)return JC.registry.onNotFound(c);a=Pt(t,this,e,n,i,l.args||{},s)}return a?a.round(this.POINT_ROUNDING):new Nb}findRoutePoints(t=[]){const e=this.graph.options.connecting.router||QP.presets.normal,n=this.cell.getRouter()||e;let i;if("function"===typeof n)i=Pt(n,this,t,{},this);else{const e="string"===typeof n?n:n.name,s="string"===typeof n?{}:n.args||{},r=e?QP.registry.get(e):QP.presets.normal;if("function"!==typeof r)return QP.registry.onNotFound(e);i=Pt(r,this,t,s,this)}return null==i?t.map(t=>Nb.create(t)):i.map(t=>Nb.create(t))}findConnectionPoints(t,e,n){const i=this.cell,s=this.graph.options.connecting,r=i.getSource(),o=i.getTarget(),a=this.sourceView,l=this.targetView,c=t[0],h=t[t.length-1];let u,d;if(a&&!a.isEdgeElement(this.sourceMagnet)){const t=this.sourceMagnet||a.container,i=c||n,o=new kb(i,e),l=r.connectionPoint||s.sourceConnectionPoint||s.connectionPoint;u=this.getConnectionPoint(l,a,t,o,"source")}else u=e;if(l&&!l.isEdgeElement(this.targetMagnet)){const t=this.targetMagnet||l.container,i=o.connectionPoint||s.targetConnectionPoint||s.connectionPoint,r=h||e,a=new kb(r,n);d=this.getConnectionPoint(i,l,t,a,"target")}else d=n;return{source:u,target:d}}getConnectionPoint(t,e,n,i,s){const r=i.end;if(null==t)return r;const o="string"===typeof t?t:t.name,a="string"===typeof t?{}:t.args,l=lP.registry.get(o);if("function"!==typeof l)return lP.registry.onNotFound(o);const c=Pt(l,this,i,e,n,a||{},s);return c?c.round(this.POINT_ROUNDING):r}findMarkerPoints(t,e,n){const i=t=>{const e=this.cell.getAttrs(),n=Object.keys(e);for(let i=0,s=n.length;i<s;i+=1){const s=e[n[i]];if(s[`${t}Marker`]||s[`${t}-marker`]){const t=s.strokeWidth||s["stroke-width"];if(t)return parseFloat(t);break}}return null},s=t[0],r=t[t.length-1];let o,a;const l=i("source");l&&(o=e.clone().move(s||n,-l));const c=i("target");return c&&(a=n.clone().move(r||e,-c)),this.sourceMarkerPoint=o||e.clone(),this.targetMarkerPoint=a||n.clone(),{source:o,target:a}}findPath(t,e,n){const i=this.cell.getConnector()||this.graph.options.connecting.connector;let s,r,o;if("string"===typeof i?s=i:(s=i.name,r=i.args),s){const t=yE.registry.get(s);if("function"!==typeof t)return yE.registry.onNotFound(s);o=t}else o=yE.presets.normal;const a=Pt(o,this,e,n,t,Object.assign(Object.assign({},r),{raw:!0}),this);return"string"===typeof a?tv.parse(a):a}translateConnectionPoints(t,e){this.sourcePoint.translate(t,e),this.targetPoint.translate(t,e),this.sourceAnchor.translate(t,e),this.targetAnchor.translate(t,e),this.sourceMarkerPoint.translate(t,e),this.targetMarkerPoint.translate(t,e)}updateLabelPositions(){if(null==this.labelContainer)return this;const t=this.path;if(!t)return this;const e=this.cell,n=e.getLabels();if(0===n.length)return this;const i=e.getDefaultLabel(),s=this.normalizeLabelPosition(i.position);for(let r=0,o=n.length;r<o;r+=1){const t=n[r],e=this.labelCache[r];if(!e)continue;const i=this.normalizeLabelPosition(t.position),o=jo({},s,i),a=this.getLabelTransformationMatrix(o);e.setAttribute("transform",Ry(a))}return this}updateTerminalProperties(t){const e=this.cell,n=this.graph,i=e[t],s=i&&i.cell,r=`${t}View`;if(!s)return this[r]=null,this.updateTerminalMagnet(t),!0;const o=n.getCellById(s);if(!o)throw new Error(`Edge's ${t} node with id "${s}" not exists`);const a=o.findView(n);return!!a&&(this[r]=a,this.updateTerminalMagnet(t),!0)}updateTerminalMagnet(t){const e=`${t}Magnet`,n=this.getTerminalView(t);if(n){let i=n.getMagnetFromEdgeTerminal(this.cell[t]);i===n.container&&(i=null),this[e]=i}else this[e]=null}getLabelPositionAngle(t){const e=this.cell.getLabelAt(t);return e&&e.position&&"object"===typeof e.position&&e.position.angle||0}getLabelPositionArgs(t){const e=this.cell.getLabelAt(t);if(e&&e.position&&"object"===typeof e.position)return e.position.options}getDefaultLabelPositionArgs(){const t=this.cell.getDefaultLabel();if(t&&t.position&&"object"===typeof t.position)return t.position.options}mergeLabelPositionArgs(t,e){return null===t?null:void 0===t?null===e?null:e:jo({},e,t)}getConnection(){return null!=this.path?this.path.clone():null}getConnectionPathData(){if(null==this.path)return"";const t=this.cache.pathCache;return ri(t,"data")||(t.data=this.path.serialize()),t.data||""}getConnectionSubdivisions(){if(null==this.path)return null;const t=this.cache.pathCache;return ri(t,"segmentSubdivisions")||(t.segmentSubdivisions=this.path.getSegmentSubdivisions()),t.segmentSubdivisions}getConnectionLength(){if(null==this.path)return 0;const t=this.cache.pathCache;return ri(t,"length")||(t.length=this.path.length({segmentSubdivisions:this.getConnectionSubdivisions()})),t.length}getPointAtLength(t){return null==this.path?null:this.path.pointAtLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getPointAtRatio(t){return null==this.path?null:(vf(t)&&(t=parseFloat(t)/100),this.path.pointAt(t,{segmentSubdivisions:this.getConnectionSubdivisions()}))}getTangentAtLength(t){return null==this.path?null:this.path.tangentAtLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getTangentAtRatio(t){return null==this.path?null:this.path.tangentAt(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPoint(t){return null==this.path?null:this.path.closestPoint(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointLength(t){return null==this.path?null:this.path.closestPointLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getClosestPointRatio(t){return null==this.path?null:this.path.closestPointNormalizedLength(t,{segmentSubdivisions:this.getConnectionSubdivisions()})}getLabelPosition(t,e,n,i){const s={distance:0};let r,o=0;"number"===typeof n?(o=n,r=i):r=n,null!=r&&(s.options=r);const a=r&&r.absoluteOffset,l=!(r&&r.absoluteDistance),c=r&&r.absoluteDistance&&r.reverseDistance,h=this.path,u={segmentSubdivisions:this.getConnectionSubdivisions()},d=new Nb(t,e),g=h.closestPointT(d,u),p=this.getConnectionLength()||0;let f,m,y=h.lengthAtT(g,u);if(l&&(y=p>0?y/p:0),c&&(y=-1*(p-y)||1),s.distance=y,a||(f=h.tangentAtT(g)),f)m=f.pointOffset(d);else{const t=h.pointAtT(g),e=d.diff(t);m={x:e.x,y:e.y}}return s.offset=m,s.angle=o,s}normalizeLabelPosition(t){return"number"===typeof t?{distance:t}:t}getLabelTransformationMatrix(t){const e=this.normalizeLabelPosition(t),n=e.options||{},i=e.angle||0,s=e.distance,r=s>0&&s<=1;let o=0;const a={x:0,y:0},l=e.offset;l&&("number"===typeof l?o=l:(null!=l.x&&(a.x=l.x),null!=l.y&&(a.y=l.y)));const c=0!==a.x||0!==a.y||0===o,h=n.keepGradient,u=n.ensureLegibility,d=this.path,g={segmentSubdivisions:this.getConnectionSubdivisions()},p=r?s*this.getConnectionLength():s,f=d.tangentAtLength(p,g);let m,y=i;if(f){if(c)m=f.start,m.translate(a);else{const t=f.clone();t.rotate(-90,f.start),t.setLength(o),m=t.end}h&&(y=f.angle()+i,u&&(y=Ob.normalize((y+90)%180-90)))}else m=d.start,c&&m.translate(a);return Dy().translate(m.x,m.y).rotate(y)}getVertexIndex(t,e){const n=this.cell,i=n.getVertices(),s=this.getClosestPointLength(new Nb(t,e));let r=0;if(null!=s)for(const o=i.length;r<o;r+=1){const t=i[r],e=this.getClosestPointLength(t);if(null!=e&&s<e)break}return r}getEventArgs(t,e,n){const i=this,s=i.cell,r=s;return null==e||null==n?{e:t,view:i,edge:s,cell:r}:{e:t,x:e,y:n,view:i,edge:s,cell:r}}notifyUnhandledMouseDown(t,e,n){this.notify("edge:unhandled:mousedown",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})}notifyMouseDown(t,e,n){super.onMouseDown(t,e,n),this.notify("edge:mousedown",this.getEventArgs(t,e,n))}notifyMouseMove(t,e,n){super.onMouseMove(t,e,n),this.notify("edge:mousemove",this.getEventArgs(t,e,n))}notifyMouseUp(t,e,n){super.onMouseUp(t,e,n),this.notify("edge:mouseup",this.getEventArgs(t,e,n))}onClick(t,e,n){super.onClick(t,e,n),this.notify("edge:click",this.getEventArgs(t,e,n))}onDblClick(t,e,n){super.onDblClick(t,e,n),this.notify("edge:dblclick",this.getEventArgs(t,e,n))}onContextMenu(t,e,n){super.onContextMenu(t,e,n),this.notify("edge:contextmenu",this.getEventArgs(t,e,n))}onMouseDown(t,e,n){this.notifyMouseDown(t,e,n),this.startEdgeDragging(t,e,n)}onMouseMove(t,e,n){const i=this.getEventData(t);switch(i.action){case"drag-label":this.dragLabel(t,e,n);break;case"drag-arrowhead":this.dragArrowhead(t,e,n);break;case"drag-edge":this.dragEdge(t,e,n);break;default:break}return this.notifyMouseMove(t,e,n),i}onMouseUp(t,e,n){const i=this.getEventData(t);switch(i.action){case"drag-label":this.stopLabelDragging(t,e,n);break;case"drag-arrowhead":this.stopArrowheadDragging(t,e,n);break;case"drag-edge":this.stopEdgeDragging(t,e,n);break;default:break}return this.notifyMouseUp(t,e,n),this.checkMouseleave(t),i}onMouseOver(t){super.onMouseOver(t),this.notify("edge:mouseover",this.getEventArgs(t))}onMouseOut(t){super.onMouseOut(t),this.notify("edge:mouseout",this.getEventArgs(t))}onMouseEnter(t){super.onMouseEnter(t),this.notify("edge:mouseenter",this.getEventArgs(t))}onMouseLeave(t){super.onMouseLeave(t),this.notify("edge:mouseleave",this.getEventArgs(t))}onMouseWheel(t,e,n,i){super.onMouseWheel(t,e,n,i),this.notify("edge:mousewheel",Object.assign({delta:i},this.getEventArgs(t,e,n)))}onCustomEvent(t,e,n,i){const s=lm(t.target,"edge-tool",this.container);if(s){if(t.stopPropagation(),this.can("useEdgeTools")){if("edge:remove"===e)return void this.cell.remove({ui:!0});this.notify("edge:customevent",Object.assign({name:e},this.getEventArgs(t,n,i)))}this.notifyMouseDown(t,n,i)}else this.notify("edge:customevent",Object.assign({name:e},this.getEventArgs(t,n,i))),super.onCustomEvent(t,e,n,i)}onLabelMouseDown(t,e,n){this.notifyMouseDown(t,e,n),this.startLabelDragging(t,e,n);const i=this.getEventData(t).stopPropagation;i&&t.stopPropagation()}startEdgeDragging(t,e,n){this.can("edgeMovable")?this.setEventData(t,{x:e,y:n,moving:!1,action:"drag-edge"}):this.notifyUnhandledMouseDown(t,e,n)}dragEdge(t,e,n){const i=this.getEventData(t);i.moving||(i.moving=!0,this.addClass("edge-moving"),this.notify("edge:move",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})),this.cell.translate(e-i.x,n-i.y,{ui:!0}),this.setEventData(t,{x:e,y:n}),this.notify("edge:moving",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})}stopEdgeDragging(t,e,n){const i=this.getEventData(t);i.moving&&(this.removeClass("edge-moving"),this.notify("edge:moved",{e:t,x:e,y:n,view:this,cell:this.cell,edge:this.cell})),i.moving=!1}prepareArrowheadDragging(t,e){const n=this.getTerminalMagnet(t),i={action:"drag-arrowhead",x:e.x,y:e.y,isNewEdge:!0===e.isNewEdge,terminalType:t,initialMagnet:n,initialTerminal:gh(this.cell[t]),fallbackAction:e.fallbackAction||"revert",getValidateConnectionArgs:this.createValidateConnectionArgs(t),options:e.options};return this.beforeArrowheadDragging(i),i}createValidateConnectionArgs(t){const e=[];let n;e[4]=t,e[5]=this;let i=0,s=0;"source"===t?(i=2,n="target"):(s=2,n="source");const r=this.cell[n],o=r.cell;if(o){let t;const n=e[i]=this.graph.findViewByCell(o);n&&(t=n.getMagnetFromEdgeTerminal(r),t===n.container&&(t=void 0)),e[i+1]=t}return(t,n)=>(e[s]=t,e[s+1]=t.container===n?void 0:n,e)}beforeArrowheadDragging(t){t.zIndex=this.cell.zIndex,this.cell.toFront();const e=this.container.style;t.pointerEvents=e.pointerEvents,e.pointerEvents="none",this.graph.options.connecting.highlight&&this.highlightAvailableMagnets(t)}afterArrowheadDragging(t){null!=t.zIndex&&(this.cell.setZIndex(t.zIndex,{ui:!0}),t.zIndex=null);const e=this.container;e.style.pointerEvents=t.pointerEvents||"",this.graph.options.connecting.highlight&&this.unhighlightAvailableMagnets(t)}validateConnection(t,e,n,i,s,r,o){const a=this.graph.options.connecting,l=a.allowLoop,c=a.allowNode,h=a.allowEdge,u=a.allowPort,d=a.allowMulti,g=a.validateConnection,p=r?r.cell:null,f="target"===s?n:t,m="target"===s?i:e;let y=!0;const b=a=>{const l="source"===s?o?o.port:null:p?p.getSourcePortId():null,c="target"===s?o?o.port:null:p?p.getTargetPortId():null;return Pt(a,this.graph,{edge:p,edgeView:r,sourceView:t,targetView:n,sourcePort:l,targetPort:c,sourceMagnet:e,targetMagnet:i,sourceCell:t?t.cell:null,targetCell:n?n.cell:null,type:s})};if(null!=l&&("boolean"===typeof l?l||t!==n||(y=!1):y=b(l)),y&&null!=u&&("boolean"===typeof u?!u&&m&&(y=!1):y=b(u)),y&&null!=h&&("boolean"===typeof h?!h&&WE.isEdgeView(f)&&(y=!1):y=b(h)),y&&null!=c&&null==m&&("boolean"===typeof c?!c&&JE.isNodeView(f)&&(y=!1):y=b(c)),y&&null!=d&&r){const t=r.cell,e="source"===s?o:t.getSource(),n="target"===s?o:t.getTarget(),i=o?this.graph.getCellById(o.cell):null;if(e&&n&&e.cell&&n.cell&&i)if("function"===typeof d)y=b(d);else{const t=this.graph.model.getConnectedEdges(i,{outgoing:"source"===s,incoming:"target"===s});if(t.length)if("withPort"===d){const i=t.some(t=>{const i=t.getSource(),s=t.getTarget();return i&&s&&i.cell===e.cell&&s.cell===n.cell&&null!=i.port&&i.port===e.port&&null!=s.port&&s.port===n.port});i&&(y=!1)}else if(!d){const i=t.some(t=>{const i=t.getSource(),s=t.getTarget();return i&&s&&i.cell===e.cell&&s.cell===n.cell});i&&(y=!1)}}}return y&&null!=g&&(y=b(g)),y}allowConnectToBlank(t){const e=this.graph,n=e.options.connecting,i=n.allowBlank;if("function"!==typeof i)return!!i;const s=e.findViewByCell(t),r=t.getSourceCell(),o=t.getTargetCell(),a=e.findViewByCell(r),l=e.findViewByCell(o);return Pt(i,e,{edge:t,edgeView:s,sourceCell:r,targetCell:o,sourceView:a,targetView:l,sourcePort:t.getSourcePortId(),targetPort:t.getTargetPortId(),sourceMagnet:s.sourceMagnet,targetMagnet:s.targetMagnet})}validateEdge(t,e,n){const i=this.graph;if(!this.allowConnectToBlank(t)){const e=t.getSourceCellId(),n=t.getTargetCellId();if(!e||!n)return!1}const s=i.options.connecting.validateEdge;return!s||Pt(s,i,{edge:t,type:e,previous:n})}arrowheadDragging(t,e,n,i){i.x=e,i.y=n,i.currentTarget!==t&&(i.currentMagnet&&i.currentView&&i.currentView.unhighlight(i.currentMagnet,{type:"magnetAdsorbed"}),i.currentView=this.graph.findViewByElem(t),i.currentView?(i.currentMagnet=i.currentView.findMagnet(t),i.currentMagnet&&this.validateConnection(...i.getValidateConnectionArgs(i.currentView,i.currentMagnet),i.currentView.getEdgeTerminal(i.currentMagnet,e,n,this.cell,i.terminalType))?i.currentView.highlight(i.currentMagnet,{type:"magnetAdsorbed"}):i.currentMagnet=null):i.currentMagnet=null),i.currentTarget=t,this.cell.prop(i.terminalType,{x:e,y:n},Object.assign(Object.assign({},i.options),{ui:!0}))}arrowheadDragged(t,e,n){const i=t.currentView,s=t.currentMagnet;if(!s||!i)return;i.unhighlight(s,{type:"magnetAdsorbed"});const r=t.terminalType,o=i.getEdgeTerminal(s,e,n,this.cell,r);this.cell.setTerminal(r,o,{ui:!0})}snapArrowhead(t,e,n){const i=this.graph,{snap:s,allowEdge:r}=i.options.connecting,o="object"===typeof s&&s.radius||50,a="object"===typeof s&&s.anchor||"center",l=i.renderer.findViewsInArea({x:t-o,y:e-o,width:2*o,height:2*o},{nodeOnly:!0});if(r){const n=i.renderer.findEdgeViewsFromPoint({x:t,y:e},o).filter(t=>t!==this);l.push(...n)}const c=n.closestView||null,h=n.closestMagnet||null;let u;n.closestView=null,n.closestMagnet=null;let d=Number.MAX_SAFE_INTEGER;const g=new Nb(t,e);let p;l.forEach(i=>{if("false"!==i.container.getAttribute("magnet")){if(i.isNodeView())u="center"===a?i.cell.getBBox().getCenter().distance(g):i.cell.getBBox().getNearestPointToPoint(g).distance(g);else if(i.isEdgeView()){const t=i.getClosestPoint(g);u=t?t.distance(g):Number.MAX_SAFE_INTEGER}u<o&&u<d&&(h===i.container||this.validateConnection(...n.getValidateConnectionArgs(i,null),i.getEdgeTerminal(i.container,t,e,this.cell,n.terminalType)))&&(d=u,n.closestView=i,n.closestMagnet=i.container)}i.container.querySelectorAll("[magnet]").forEach(s=>{if("false"!==s.getAttribute("magnet")){const r=i.getBBoxOfElement(s);u=g.distance(r.getCenter()),u<o&&u<d&&(h===s||this.validateConnection(...n.getValidateConnectionArgs(i,s),i.getEdgeTerminal(s,t,e,this.cell,n.terminalType)))&&(d=u,n.closestView=i,n.closestMagnet=s)}})});const f=n.terminalType,m=n.closestView,y=n.closestMagnet,b=h!==y;if(c&&b&&c.unhighlight(h,{type:"magnetAdsorbed"}),m){if(!b)return;m.highlight(y,{type:"magnetAdsorbed"}),p=m.getEdgeTerminal(y,t,e,this.cell,f)}else p={x:t,y:e};this.cell.setTerminal(f,p,{},Object.assign(Object.assign({},n.options),{ui:!0}))}snapArrowheadEnd(t){const e=t.closestView,n=t.closestMagnet;e&&n&&(e.unhighlight(n,{type:"magnetAdsorbed"}),t.currentMagnet=e.findMagnet(n)),t.closestView=null,t.closestMagnet=null}finishEmbedding(t){this.graph.options.embedding.enabled&&this.cell.updateParent()&&(t.zIndex=null)}fallbackConnection(t){switch(t.fallbackAction){case"remove":this.cell.remove({ui:!0});break;case"revert":default:this.cell.prop(t.terminalType,t.initialTerminal,{ui:!0});break}}notifyConnectionEvent(t,e){const n=t.terminalType,i=t.initialTerminal,s=this.cell[n],r=s&&!NE.equalTerminals(i,s);if(r){const r=this.graph,o=i,a=o.cell?r.getCellById(o.cell):null,l=o.port,c=a?r.findViewByCell(a):null,h=a||t.isNewEdge?null:Nb.create(i).toJSON(),u=s,d=u.cell?r.getCellById(u.cell):null,g=u.port,p=d?r.findViewByCell(d):null,f=d?null:Nb.create(s).toJSON();this.notify("edge:connected",{e:e,previousCell:a,previousPort:l,previousView:c,previousPoint:h,currentCell:d,currentView:p,currentPort:g,currentPoint:f,previousMagnet:t.initialMagnet,currentMagnet:t.currentMagnet,edge:this.cell,view:this,type:n,isNew:t.isNewEdge})}}highlightAvailableMagnets(t){const e=this.graph,n=e.model.getCells();t.marked={};for(let i=0,s=n.length;i<s;i+=1){const s=e.findViewByCell(n[i]);if(!s||s.cell.id===this.cell.id)continue;const r=Array.prototype.slice.call(s.container.querySelectorAll("[magnet]"));"false"!==s.container.getAttribute("magnet")&&r.push(s.container);const o=r.filter(e=>this.validateConnection(...t.getValidateConnectionArgs(s,e),s.getEdgeTerminal(e,t.x,t.y,this.cell,t.terminalType)));if(o.length>0){for(let t=0,e=o.length;t<e;t+=1)s.highlight(o[t],{type:"magnetAvailable"});s.highlight(null,{type:"nodeAvailable"}),t.marked[s.cell.id]=o}}}unhighlightAvailableMagnets(t){const e=t.marked||{};Object.keys(e).forEach(t=>{const n=this.graph.findViewByCell(t);if(n){const i=e[t];i.forEach(t=>{n.unhighlight(t,{type:"magnetAvailable"})}),n.unhighlight(null,{type:"nodeAvailable"})}}),t.marked=null}startArrowheadDragging(t,e,n){if(!this.can("arrowheadMovable"))return void this.notifyUnhandledMouseDown(t,e,n);const i=t.target,s=i.getAttribute("data-terminal"),r=this.prepareArrowheadDragging(s,{x:e,y:n});this.setEventData(t,r)}dragArrowhead(t,e,n){const i=this.getEventData(t);this.graph.options.connecting.snap?this.snapArrowhead(e,n,i):this.arrowheadDragging(this.getEventTarget(t),e,n,i)}stopArrowheadDragging(t,e,n){const i=this.graph,s=this.getEventData(t);i.options.connecting.snap?this.snapArrowheadEnd(s):this.arrowheadDragged(s,e,n);const r=this.validateEdge(this.cell,s.terminalType,s.initialTerminal);r?(this.finishEmbedding(s),this.notifyConnectionEvent(s,t)):this.fallbackConnection(s),this.afterArrowheadDragging(s)}startLabelDragging(t,e,n){if(this.can("edgeLabelMovable")){const e=t.currentTarget,n=parseInt(e.getAttribute("data-index"),10),i=this.getLabelPositionAngle(n),s=this.getLabelPositionArgs(n),r=this.getDefaultLabelPositionArgs(),o=this.mergeLabelPositionArgs(s,r);this.setEventData(t,{index:n,positionAngle:i,positionArgs:o,stopPropagation:!0,action:"drag-label"})}else this.setEventData(t,{stopPropagation:!0});this.graph.view.delegateDragEvents(t,this)}dragLabel(t,e,n){const i=this.getEventData(t),s=this.cell.getLabelAt(i.index),r=jo({},s,{position:this.getLabelPosition(e,n,i.positionAngle,i.positionArgs)});this.cell.setLabelAt(i.index,r)}stopLabelDragging(t,e,n){}}(function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag],i=e;return(null==n||n===t.toStringTag)&&"function"===typeof i.isNodeView&&"function"===typeof i.isEdgeView&&"function"===typeof i.confirmUpdate&&"function"===typeof i.update&&"function"===typeof i.getConnection}t.toStringTag=`X6.${t.name}`,t.isEdgeView=e})(WE||(WE={})),WE.config({isSvgElement:!0,priority:1,bootstrap:["render","source","target"],actions:{view:["render"],markup:["render"],attrs:["update"],source:["source","update"],target:["target","update"],router:["update"],connector:["update"],labels:["labels"],defaultLabel:["labels"],tools:["tools"],vertices:["vertices","update"]}}),WE.registry.register("edge",WE,!0);var XE=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class YE extends Xw{get disposeContainer(){return!1}get options(){return this.graph.options}constructor(t){super(),this.graph=t;const{selectors:e,fragment:n}=qw.parseJSONMarkup(YE.markup);this.background=e.background,this.grid=e.grid,this.svg=e.svg,this.defs=e.defs,this.viewport=e.viewport,this.primer=e.primer,this.stage=e.stage,this.decorator=e.decorator,this.overlay=e.overlay,this.container=this.options.container,this.restore=YE.snapshoot(this.container),Hf(this.container,this.prefixClassName("graph")),dm(this.container,n),this.delegateEvents()}delegateEvents(){const t=this.constructor;return super.delegateEvents(t.events),this}guard(t,e){return"mousedown"===t.type&&2===t.button||(!(!this.options.guard||!this.options.guard(t,e))||(t.data&&void 0!==t.data.guarded?t.data.guarded:!(e&&e.cell&&EE.isCell(e.cell))&&(this.svg!==t.target&&this.container!==t.target&&!this.svg.contains(t.target))))}findView(t){return this.graph.findViewByElem(t)}onDblClick(t){this.options.preventDefaultDblClick&&t.preventDefault();const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const i=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onDblClick(e,i.x,i.y):this.graph.trigger("blank:dblclick",{e:e,x:i.x,y:i.y})}onClick(t){if(this.getMouseMovedCount(t)<=this.options.clickThreshold){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const i=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onClick(e,i.x,i.y):this.graph.trigger("blank:click",{e:e,x:i.x,y:i.y})}}isPreventDefaultContextMenu(t){let e=this.options.preventDefaultContextMenu;return"function"===typeof e&&(e=Pt(e,this.graph,{view:t})),e}onContextMenu(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.isPreventDefaultContextMenu(n)&&t.preventDefault(),this.guard(e,n))return;const i=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onContextMenu(e,i.x,i.y):this.graph.trigger("blank:contextmenu",{e:e,x:i.x,y:i.y})}delegateDragEvents(t,e){null==t.data&&(t.data={}),this.setEventData(t,{currentView:e||null,mouseMovedCount:0,startPosition:{x:t.clientX,y:t.clientY}});const n=this.constructor;this.delegateDocumentEvents(n.documentEvents,t.data),this.undelegateEvents()}getMouseMovedCount(t){const e=this.getEventData(t);return e.mouseMovedCount||0}onMouseDown(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;this.options.preventDefaultMouseDown&&t.preventDefault();const i=this.graph.snapToGrid(e.clientX,e.clientY);n?n.onMouseDown(e,i.x,i.y):(this.options.preventDefaultBlankAction&&["touchstart"].includes(e.type)&&t.preventDefault(),this.graph.trigger("blank:mousedown",{e:e,x:i.x,y:i.y})),this.delegateDragEvents(e,n)}onMouseMove(t){const e=this.getEventData(t),n=e.startPosition;if(n&&n.x===t.clientX&&n.y===t.clientY)return;null==e.mouseMovedCount&&(e.mouseMovedCount=0),e.mouseMovedCount+=1;const i=e.mouseMovedCount;if(i<=this.options.moveThreshold)return;const s=this.normalizeEvent(t),r=this.graph.snapToGrid(s.clientX,s.clientY),o=e.currentView;o?o.onMouseMove(s,r.x,r.y):this.graph.trigger("blank:mousemove",{e:s,x:r.x,y:r.y}),this.setEventData(s,e)}onMouseUp(t){this.undelegateDocumentEvents();const e=this.normalizeEvent(t),n=this.graph.snapToGrid(e.clientX,e.clientY),i=this.getEventData(t),s=i.currentView;if(s?s.onMouseUp(e,n.x,n.y):this.graph.trigger("blank:mouseup",{e:e,x:n.x,y:n.y}),!t.isPropagationStopped()){const e=new eb(t,{type:"click",data:t.data});this.onClick(e)}t.stopImmediatePropagation(),this.delegateEvents()}onMouseOver(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(!this.guard(e,n))if(n)n.onMouseOver(e);else{if(this.container===e.target)return;this.graph.trigger("blank:mouseover",{e:e})}}onMouseOut(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(!this.guard(e,n))if(n)n.onMouseOut(e);else{if(this.container===e.target)return;this.graph.trigger("blank:mouseout",{e:e})}}onMouseEnter(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const i=this.graph.findViewByElem(e.relatedTarget);if(n){if(i===n)return;n.onMouseEnter(e)}else{if(i)return;this.graph.trigger("graph:mouseenter",{e:e})}}onMouseLeave(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const i=this.graph.findViewByElem(e.relatedTarget);if(n){if(i===n)return;n.onMouseLeave(e)}else{if(i)return;this.graph.trigger("graph:mouseleave",{e:e})}}onMouseWheel(t){const e=this.normalizeEvent(t),n=this.findView(e.target);if(this.guard(e,n))return;const i=e.originalEvent,s=this.graph.snapToGrid(i.clientX,i.clientY),r=Math.max(-1,Math.min(1,i.wheelDelta||-i.detail));n?n.onMouseWheel(e,s.x,s.y,r):this.graph.trigger("blank:mousewheel",{e:e,delta:r,x:s.x,y:s.y})}onCustomEvent(t){const e=t.currentTarget,n=e.getAttribute("event")||e.getAttribute("data-event");if(n){const i=this.findView(e);if(i){const e=this.normalizeEvent(t);if(this.guard(e,i))return;const s=this.graph.snapToGrid(e.clientX,e.clientY);i.onCustomEvent(e,n,s.x,s.y)}}}handleMagnetEvent(t,e){const n=t.currentTarget,i=n.getAttribute("magnet");if(i&&"false"!==i.toLowerCase()){const i=this.findView(n);if(i){const s=this.normalizeEvent(t);if(this.guard(s,i))return;const r=this.graph.snapToGrid(s.clientX,s.clientY);Pt(e,this.graph,i,s,n,r.x,r.y)}}}onMagnetMouseDown(t){this.handleMagnetEvent(t,(t,e,n,i,s)=>{t.onMagnetMouseDown(e,n,i,s)})}onMagnetDblClick(t){this.handleMagnetEvent(t,(t,e,n,i,s)=>{t.onMagnetDblClick(e,n,i,s)})}onMagnetContextMenu(t){const e=this.findView(t.target);this.isPreventDefaultContextMenu(e)&&t.preventDefault(),this.handleMagnetEvent(t,(t,e,n,i,s)=>{t.onMagnetContextMenu(e,n,i,s)})}onLabelMouseDown(t){const e=t.currentTarget,n=this.findView(e);if(n){const e=this.normalizeEvent(t);if(this.guard(e,n))return;const i=this.graph.snapToGrid(e.clientX,e.clientY);n.onLabelMouseDown(e,i.x,i.y)}}onImageDragStart(){return!1}dispose(){this.undelegateEvents(),this.undelegateDocumentEvents(),this.restore(),this.restore=()=>{}}}XE([Xw.dispose()],YE.prototype,"dispose",null),function(t){const e=`${sw.prefixCls}-graph`;function n(t){const e=t.cloneNode();return t.childNodes.forEach(t=>e.appendChild(t)),()=>{um(t);while(t.attributes.length>0)t.removeAttribute(t.attributes[0].name);for(let n=0,i=e.attributes.length;n<i;n+=1){const i=e.attributes[n];t.setAttribute(i.name,i.value)}e.childNodes.forEach(e=>t.appendChild(e))}}t.markup=[{ns:Zf.xhtml,tagName:"div",selector:"background",className:`${e}-background`},{ns:Zf.xhtml,tagName:"div",selector:"grid",className:`${e}-grid`},{ns:Zf.svg,tagName:"svg",selector:"svg",className:`${e}-svg`,attrs:{width:"100%",height:"100%","xmlns:xlink":Zf.xlink},children:[{tagName:"defs",selector:"defs"},{tagName:"g",selector:"viewport",className:`${e}-svg-viewport`,children:[{tagName:"g",selector:"primer",className:`${e}-svg-primer`},{tagName:"g",selector:"stage",className:`${e}-svg-stage`},{tagName:"g",selector:"decorator",className:`${e}-svg-decorator`},{tagName:"g",selector:"overlay",className:`${e}-svg-overlay`}]}]}],t.snapshoot=n}(YE||(YE={})),function(t){const e=sw.prefixCls;t.events={dblclick:"onDblClick",contextmenu:"onContextMenu",touchstart:"onMouseDown",mousedown:"onMouseDown",mouseover:"onMouseOver",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",DOMMouseScroll:"onMouseWheel",[`mouseenter .${e}-cell`]:"onMouseEnter",[`mouseleave .${e}-cell`]:"onMouseLeave",[`mouseenter .${e}-cell-tools`]:"onMouseEnter",[`mouseleave .${e}-cell-tools`]:"onMouseLeave",[`mousedown .${e}-cell [event]`]:"onCustomEvent",[`touchstart .${e}-cell [event]`]:"onCustomEvent",[`mousedown .${e}-cell [data-event]`]:"onCustomEvent",[`touchstart .${e}-cell [data-event]`]:"onCustomEvent",[`dblclick .${e}-cell [magnet]`]:"onMagnetDblClick",[`contextmenu .${e}-cell [magnet]`]:"onMagnetContextMenu",[`mousedown .${e}-cell [magnet]`]:"onMagnetMouseDown",[`touchstart .${e}-cell [magnet]`]:"onMagnetMouseDown",[`dblclick .${e}-cell [data-magnet]`]:"onMagnetDblClick",[`contextmenu .${e}-cell [data-magnet]`]:"onMagnetContextMenu",[`mousedown .${e}-cell [data-magnet]`]:"onMagnetMouseDown",[`touchstart .${e}-cell [data-magnet]`]:"onMagnetMouseDown",[`dragstart .${e}-cell image`]:"onImageDragStart",[`mousedown .${e}-edge .${e}-edge-label`]:"onLabelMouseDown",[`touchstart .${e}-edge .${e}-edge-label`]:"onLabelMouseDown"},t.documentEvents={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"}}(YE||(YE={}));const ZE=".x6-graph {\n position: relative;\n overflow: hidden;\n outline: none;\n touch-action: none;\n}\n.x6-graph-background,\n.x6-graph-grid,\n.x6-graph-svg {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n}\n.x6-graph-background-stage,\n.x6-graph-grid-stage,\n.x6-graph-svg-stage {\n user-select: none;\n}\n.x6-graph.x6-graph-pannable {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n.x6-graph.x6-graph-panning {\n cursor: grabbing;\n cursor: -moz-grabbing;\n cursor: -webkit-grabbing;\n user-select: none;\n}\n.x6-node {\n cursor: move;\n /* stylelint-disable-next-line */\n}\n.x6-node.x6-node-immovable {\n cursor: default;\n}\n.x6-node * {\n -webkit-user-drag: none;\n}\n.x6-node .scalable * {\n vector-effect: non-scaling-stroke;\n}\n.x6-node [magnet='true'] {\n cursor: crosshair;\n transition: opacity 0.3s;\n}\n.x6-node [magnet='true']:hover {\n opacity: 0.7;\n}\n.x6-node foreignObject {\n display: block;\n overflow: visible;\n background-color: transparent;\n}\n.x6-node foreignObject > body {\n position: static;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n overflow: visible;\n background-color: transparent;\n}\n.x6-edge .source-marker,\n.x6-edge .target-marker {\n vector-effect: non-scaling-stroke;\n}\n.x6-edge .connection {\n stroke-linejoin: round;\n fill: none;\n}\n.x6-edge .connection-wrap {\n cursor: move;\n opacity: 0;\n fill: none;\n stroke: #000;\n stroke-width: 15;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n.x6-edge .connection-wrap:hover {\n opacity: 0.4;\n stroke-opacity: 0.4;\n}\n.x6-edge .vertices {\n cursor: move;\n opacity: 0;\n}\n.x6-edge .vertices .vertex {\n fill: #1abc9c;\n}\n.x6-edge .vertices .vertex :hover {\n fill: #34495e;\n stroke: none;\n}\n.x6-edge .vertices .vertex-remove {\n cursor: pointer;\n fill: #fff;\n}\n.x6-edge .vertices .vertex-remove-area {\n cursor: pointer;\n opacity: 0.1;\n}\n.x6-edge .vertices .vertex-group:hover .vertex-remove-area {\n opacity: 1;\n}\n.x6-edge .arrowheads {\n cursor: move;\n opacity: 0;\n}\n.x6-edge .arrowheads .arrowhead {\n fill: #1abc9c;\n}\n.x6-edge .arrowheads .arrowhead :hover {\n fill: #f39c12;\n stroke: none;\n}\n.x6-edge .tools {\n cursor: pointer;\n opacity: 0;\n}\n.x6-edge .tools .tool-options {\n display: none;\n}\n.x6-edge .tools .tool-remove circle {\n fill: #f00;\n}\n.x6-edge .tools .tool-remove path {\n fill: #fff;\n}\n.x6-edge:hover .vertices,\n.x6-edge:hover .arrowheads,\n.x6-edge:hover .tools {\n opacity: 1;\n}\n.x6-highlight-opacity {\n opacity: 0.3;\n}\n.x6-cell-tool-editor {\n position: relative;\n display: inline-block;\n min-height: 1em;\n margin: 0;\n padding: 0;\n line-height: 1;\n white-space: normal;\n text-align: center;\n vertical-align: top;\n overflow-wrap: normal;\n outline: none;\n transform-origin: 0 0;\n -webkit-user-drag: none;\n}\n.x6-edge-tool-editor {\n border: 1px solid #275fc5;\n border-radius: 2px;\n}\n";class KE extends C{get options(){return this.graph.options}get model(){return this.graph.model}get view(){return this.graph.view}constructor(t){super(),this.graph=t,this.init()}init(){}}var QE=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class tM extends KE{init(){sw.autoInsertCSS&&Eb("core",ZE)}dispose(){Mb("core")}}QE([tM.dispose()],tM.prototype,"dispose",null);var eM,nM=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};(function(t){function e(e){const{grid:n,panning:i,mousewheel:s,embedding:r}=e,o=nM(e,["grid","panning","mousewheel","embedding"]),a=e.container;if(null==a)throw new Error("Ensure the container of the graph is specified and valid");null==o.width&&(o.width=a.clientWidth),null==o.height&&(o.height=a.clientHeight);const l=jo({},t.defaults,o),c={size:10,visible:!1};l.grid="number"===typeof n?{size:n,visible:!1}:"boolean"===typeof n?Object.assign(Object.assign({},c),{visible:n}):Object.assign(Object.assign({},c),n);const h=["panning","mousewheel","embedding"];return h.forEach(t=>{const n=e[t];"boolean"===typeof n?l[t].enabled=n:l[t]=Object.assign(Object.assign({},l[t]),n)}),l}t.get=e})(eM||(eM={})),function(t){t.defaults={x:0,y:0,scaling:{min:.01,max:16},grid:{size:10,visible:!1},background:!1,panning:{enabled:!1,eventTypes:["leftMouseDown"]},mousewheel:{enabled:!1,factor:1.2,zoomAtMousePosition:!0},highlighting:{default:{name:"stroke",args:{padding:3}},nodeAvailable:{name:"className",args:{className:sw.prefix("available-node")}},magnetAvailable:{name:"className",args:{className:sw.prefix("available-magnet")}}},connecting:{snap:!1,allowLoop:!0,allowNode:!0,allowEdge:!1,allowPort:!0,allowBlank:!0,allowMulti:!0,highlight:!1,anchor:"center",edgeAnchor:"ratio",connectionPoint:"boundary",router:"normal",connector:"normal",validateConnection({type:t,sourceView:e,targetView:n}){const i="target"===t?n:e;return null!=i},createEdge(){return new FE}},translating:{restrict:!1},embedding:{enabled:!1,findParent:"bbox",frontOnly:!0,validate:()=>!0},moveThreshold:0,clickThreshold:0,magnetThreshold:0,preventDefaultDblClick:!0,preventDefaultMouseDown:!1,preventDefaultContextMenu:!0,preventDefaultBlankAction:!0,interacting:{edgeLabelMovable:!1},async:!0,virtual:!1,guard:()=>!1}}(eM||(eM={}));var iM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o},sM=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class rM extends KE{get elem(){return this.view.grid}get grid(){return this.options.grid}init(){this.startListening(),this.draw(this.grid)}startListening(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}stopListening(){this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this)}setVisible(t){this.grid.visible!==t&&(this.grid.visible=t,this.update())}getGridSize(){return this.grid.size}setGridSize(t){this.grid.size=Math.max(t,1),this.update()}show(){this.setVisible(!0),this.update()}hide(){this.setVisible(!1),this.update()}clear(){this.elem.style.backgroundImage=""}draw(t){this.clear(),this.instance=null,Object.assign(this.grid,t),this.patterns=this.resolveGrid(t),this.update()}update(t={}){const e=this.grid.size;if(e<=1||!this.grid.visible)return this.clear();const n=this.graph.matrix(),i=this.getInstance(),s=Array.isArray(t)?t:[t];this.patterns.forEach((t,r)=>{const o=`pattern_${r}`,a=n.a||1,l=n.d||1,{update:c,markup:h}=t,u=sM(t,["update","markup"]),d=Object.assign(Object.assign(Object.assign({},u),s[r]),{sx:a,sy:l,ox:n.e||0,oy:n.f||0,width:e*a,height:e*l});i.has(o)||i.add(o,ry.create("pattern",{id:o,patternUnits:"userSpaceOnUse"},ry.createVectors(h)).node);const g=i.get(o);"function"===typeof c&&c(g.childNodes[0],d);let p=d.ox%d.width;p<0&&(p+=d.width);let f=d.oy%d.height;f<0&&(f+=d.height),Mm(g,{x:p,y:f,width:d.width,height:d.height})});const r=(new XMLSerializer).serializeToString(i.root),o=`url(data:image/svg+xml;base64,${btoa(r)})`;this.elem.style.backgroundImage=o}getInstance(){return this.instance||(this.instance=new ov),this.instance}resolveGrid(t){if(!t)return[];const e=t.type;if(null==e)return[Object.assign(Object.assign({},ov.presets.dot),t.args)];const n=ov.registry.get(e);if(n){let e=t.args||[];return Array.isArray(e)||(e=[e]),Array.isArray(n)?n.map((t,n)=>Object.assign(Object.assign({},t),e[n])):[Object.assign(Object.assign({},n),e[0])]}return ov.registry.onNotFound(e)}dispose(){this.stopListening(),this.clear()}}iM([KE.dispose()],rM.prototype,"dispose",null);class oM extends KE{get container(){return this.graph.view.container}get viewport(){return this.graph.view.viewport}get stage(){return this.graph.view.stage}init(){this.resize()}getMatrix(){const t=this.viewport.getAttribute("transform");return t!==this.viewportTransformString&&(this.viewportMatrix=this.viewport.getCTM(),this.viewportTransformString=t),Dy(this.viewportMatrix)}setMatrix(t){const e=Dy(t);e.a=Number.isFinite(e.a)?e.a:1,e.b=Number.isFinite(e.b)?e.b:0,e.c=Number.isFinite(e.c)?e.c:0,e.d=Number.isFinite(e.d)?e.d:1,e.e=Number.isFinite(e.e)?e.e:0,e.f=Number.isFinite(e.f)?e.f:0;const n=Ry(e);this.viewport.setAttribute("transform",n),this.viewportMatrix=e,this.viewportTransformString=n}resize(t,e){let n=void 0===t?this.options.width:t,i=void 0===e?this.options.height:e;this.options.width=n,this.options.height=i,"number"===typeof n&&(n=Math.round(n)),"number"===typeof i&&(i=Math.round(i)),this.container.style.width=null==n?"":`${n}px`,this.container.style.height=null==i?"":`${i}px`;const s=this.getComputedSize();return this.graph.trigger("resize",Object.assign({},s)),this}getComputedSize(){let t=this.options.width,e=this.options.height;return pf(t)||(t=this.container.clientWidth),pf(e)||(e=this.container.clientHeight),{width:t,height:e}}getScale(){return Fy(this.getMatrix())}scale(t,e=t,n=0,i=0){if(t=this.clampScale(t),e=this.clampScale(e),n||i){const s=this.getTranslation(),r=s.tx-n*(t-1),o=s.ty-i*(e-1);r===s.tx&&o===s.ty||this.translate(r,o)}const s=this.getMatrix(),r=Number.isFinite(t)?t:1,o=Number.isFinite(e)?e:1;return s.a=r,s.d=o,this.setMatrix(s),this.graph.trigger("scale",{sx:r,sy:o,ox:n,oy:i}),this}clampScale(t){const e=this.graph.options.scaling;return bf(t,e.min||.01,e.max||16)}getZoom(){return this.getScale().sx}zoom(t,e){e=e||{};let n=t,i=t;const s=this.getScale(),r=this.getComputedSize();let o=r.width/2,a=r.height/2;if(e.absolute||(n+=s.sx,i+=s.sy),e.scaleGrid&&(n=Math.round(n/e.scaleGrid)*e.scaleGrid,i=Math.round(i/e.scaleGrid)*e.scaleGrid),e.maxScale&&(n=Math.min(e.maxScale,n),i=Math.min(e.maxScale,i)),e.minScale&&(n=Math.max(e.minScale,n),i=Math.max(e.minScale,i)),e.center&&(o=e.center.x,a=e.center.y),n=this.clampScale(n),i=this.clampScale(i),n=Number.isFinite(n)?n:s.sx,i=Number.isFinite(i)?i:s.sy,o||a){const t=this.getTranslation(),e=0===s.sx?1:s.sx,r=0===s.sy?1:s.sy,l=o-(o-t.tx)*(n/e),c=a-(a-t.ty)*(i/r);l===t.tx&&c===t.ty||this.translate(l,c)}return this.scale(n,i),this}getRotation(){return Gy(this.getMatrix())}rotate(t,e,n){if(null==e||null==n){const t=cw.getBBox(this.stage);e=t.width/2,n=t.height/2}const i=this.getMatrix().translate(e,n).rotate(t).translate(-e,-n);return this.setMatrix(i),this}getTranslation(){return _y(this.getMatrix())}translate(t,e){const n=this.getMatrix();n.e=Number.isFinite(t)?t:0,n.f=Number.isFinite(e)?e:0,this.setMatrix(n);const i=this.getTranslation();return this.options.x=i.tx,this.options.y=i.ty,this.graph.trigger("translate",Object.assign({},i)),this}setOrigin(t,e){return this.translate(t||0,e||0)}fitToContent(t,e,n,i){if("object"===typeof t){const s=t;t=s.gridWidth||1,e=s.gridHeight||1,n=s.padding||0,i=s}else t=t||1,e=e||1,n=n||0,null==i&&(i={});const s=wf(n),r=i.border||0,o=i.contentArea?Tb.create(i.contentArea):this.getContentArea(i);r>0&&o.inflate(r);const a=this.getScale(),l=this.getTranslation(),c=a.sx,h=a.sy;o.x*=c,o.y*=h,o.width*=c,o.height*=h;let u=Math.max(Math.ceil((o.width+o.x)/t),1)*t,d=Math.max(Math.ceil((o.height+o.y)/e),1)*e,g=0,p=0;("negative"===i.allowNewOrigin&&o.x<0||"positive"===i.allowNewOrigin&&o.x>=0||"any"===i.allowNewOrigin)&&(g=Math.ceil(-o.x/t)*t,g+=s.left,u+=g),("negative"===i.allowNewOrigin&&o.y<0||"positive"===i.allowNewOrigin&&o.y>=0||"any"===i.allowNewOrigin)&&(p=Math.ceil(-o.y/e)*e,p+=s.top,d+=p),u+=s.right,d+=s.bottom,u=Math.max(u,i.minWidth||0),d=Math.max(d,i.minHeight||0),u=Math.min(u,i.maxWidth||Number.MAX_SAFE_INTEGER),d=Math.min(d,i.maxHeight||Number.MAX_SAFE_INTEGER);const f=this.getComputedSize(),m=u!==f.width||d!==f.height,y=g!==l.tx||p!==l.ty;return y&&this.translate(g,p),m&&this.resize(u,d),new Tb(-g/c,-p/h,u/c,d/h)}scaleContentToFit(t={}){this.scaleContentToFitImpl(t)}scaleContentToFitImpl(t={},e=!0){let n,i;if(t.contentArea){const e=t.contentArea;n=this.graph.localToGraph(e),i=Nb.create(e)}else n=this.getContentBBox(t),i=this.graph.graphToLocal(n);if(!n.width||!n.height)return;const s=wf(t.padding),r=t.minScale||0,o=t.maxScale||Number.MAX_SAFE_INTEGER,a=t.minScaleX||r,l=t.maxScaleX||o,c=t.minScaleY||r,h=t.maxScaleY||o;let u;if(t.viewportArea)u=t.viewportArea;else{const t=this.getComputedSize(),e=this.getTranslation();u={x:e.tx,y:e.ty,width:t.width,height:t.height}}u=Tb.create(u).moveAndExpand({x:s.left,y:s.top,width:-s.left-s.right,height:-s.top-s.bottom});const d=this.getScale();let g=u.width/n.width*d.sx,p=u.height/n.height*d.sy;!1!==t.preserveAspectRatio&&(g=p=Math.min(g,p));const f=t.scaleGrid;if(f&&(g=f*Math.floor(g/f),p=f*Math.floor(p/f)),g=bf(g,a,l),p=bf(p,c,h),this.scale(g,p),e){const t=this.options,e=u.x-i.x*g-t.x,n=u.y-i.y*p-t.y;this.translate(e,n)}}getContentArea(t={}){return!1!==t.useCellGeometry?this.model.getAllCellsBBox()||new Tb:cw.getBBox(this.stage)}getContentBBox(t={}){return this.graph.localToGraph(this.getContentArea(t))}getGraphArea(){const t=Tb.fromSize(this.getComputedSize());return this.graph.graphToLocal(t)}zoomToRect(t,e={}){const n=Tb.create(t),i=this.graph;e.contentArea=n,null==e.viewportArea&&(e.viewportArea={x:i.options.x,y:i.options.y,width:this.options.width,height:this.options.height}),this.scaleContentToFitImpl(e,!1);const s=n.getCenter();return this.centerPoint(s.x,s.y),this}zoomToFit(t={}){return this.zoomToRect(this.getContentArea(t),t)}centerPoint(t,e){const n=this.getComputedSize(),i=this.getScale(),s=this.getTranslation(),r=n.width/2,o=n.height/2;t="number"===typeof t?t:r,e="number"===typeof e?e:o,t=r-t*i.sx,e=o-e*i.sy,s.tx===t&&s.ty===e||this.translate(t,e)}centerContent(t){const e=this.graph.getContentArea(t),n=e.getCenter();this.centerPoint(n.x,n.y)}centerCell(t){return this.positionCell(t,"center")}positionPoint(t,e,n){const i=this.getComputedSize();e=xf(e,Math.max(0,i.width)),e<0&&(e=i.width+e),n=xf(n,Math.max(0,i.height)),n<0&&(n=i.height+n);const s=this.getTranslation(),r=this.getScale(),o=e-t.x*r.sx,a=n-t.y*r.sy;s.tx===o&&s.ty===a||this.translate(o,a)}positionRect(t,e){const n=Tb.create(t);switch(e){case"center":return this.positionPoint(n.getCenter(),"50%","50%");case"top":return this.positionPoint(n.getTopCenter(),"50%",0);case"top-right":return this.positionPoint(n.getTopRight(),"100%",0);case"right":return this.positionPoint(n.getRightMiddle(),"100%","50%");case"bottom-right":return this.positionPoint(n.getBottomRight(),"100%","100%");case"bottom":return this.positionPoint(n.getBottomCenter(),"50%","100%");case"bottom-left":return this.positionPoint(n.getBottomLeft(),0,"100%");case"left":return this.positionPoint(n.getLeftMiddle(),0,"50%");case"top-left":return this.positionPoint(n.getTopLeft(),0,0);default:return this}}positionCell(t,e){const n=t.getBBox();return this.positionRect(n,e)}positionContent(t,e){const n=this.graph.getContentArea(e);return this.positionRect(n,t)}}var aM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class lM extends KE{get elem(){return this.view.background}init(){this.startListening(),this.options.background&&this.draw(this.options.background)}startListening(){this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this)}stopListening(){this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this)}updateBackgroundImage(t={}){let e=t.size||"auto auto",n=t.position||"center";const i=this.graph.transform.getScale(),s=this.graph.translate();if("object"===typeof n){const t=s.tx+i.sx*(n.x||0),e=s.ty+i.sy*(n.y||0);n=`${t}px ${e}px`}"object"===typeof e&&(e=Tb.fromSize(e).scale(i.sx,i.sy),e=`${e.width}px ${e.height}px`),this.elem.style.backgroundSize=e,this.elem.style.backgroundPosition=n}drawBackgroundImage(t,e={}){if(!(t instanceof HTMLImageElement))return void(this.elem.style.backgroundImage="");const n=this.optionsCache;if(n&&n.image!==e.image)return;let i;const s=e.opacity,r=e.size;let o=e.repeat||"no-repeat";const a=uv.registry.get(o);if("function"===typeof a){const n=e.quality||1;t.width*=n,t.height*=n;const s=a(t,e);if(!(s instanceof HTMLCanvasElement))throw new Error("Background pattern must return an HTML Canvas instance");i=s.toDataURL("image/png"),o=e.repeat&&o!==e.repeat?e.repeat:"repeat","object"===typeof r?(r.width*=s.width/t.width,r.height*=s.height/t.height):void 0===r&&(e.size={width:s.width/n,height:s.height/n})}else i=t.src,void 0===r&&(e.size={width:t.width,height:t.height});null!=n&&"object"===typeof e.size&&e.image===n.image&&e.repeat===n.repeat&&e.quality===n.quality&&(n.size=gh(e.size));const l=this.elem.style;l.backgroundImage=`url(${i})`,l.backgroundRepeat=o,l.opacity=null==s||s>=1?"":`${s}`,this.updateBackgroundImage(e)}updateBackgroundColor(t){this.elem.style.backgroundColor=t||""}updateBackgroundOptions(t){this.graph.options.background=t}update(){this.optionsCache&&this.updateBackgroundImage(this.optionsCache)}draw(t){const e=t||{};if(this.updateBackgroundOptions(t),this.updateBackgroundColor(e.color),e.image){this.optionsCache=gh(e);const n=document.createElement("img");n.onload=()=>this.drawBackgroundImage(n,t),n.setAttribute("crossorigin","anonymous"),n.src=e.image}else this.drawBackgroundImage(null),this.optionsCache=null}clear(){this.draw()}dispose(){this.clear(),this.stopListening()}}aM([KE.dispose()],lM.prototype,"dispose",null);var cM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class hM extends KE{get widgetOptions(){return this.options.panning}get pannable(){return this.widgetOptions&&!0===this.widgetOptions.enabled}init(){this.onRightMouseDown=this.onRightMouseDown.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.startListening(),this.updateClassName()}startListening(){this.graph.on("blank:mousedown",this.onMouseDown,this),this.graph.on("node:unhandled:mousedown",this.onMouseDown,this),this.graph.on("edge:unhandled:mousedown",this.onMouseDown,this),ib.on(this.graph.container,"mousedown",this.onRightMouseDown),ib.on(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle=new ob(this.graph.container,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.mousewheelHandle.enable()}stopListening(){this.graph.off("blank:mousedown",this.onMouseDown,this),this.graph.off("node:unhandled:mousedown",this.onMouseDown,this),this.graph.off("edge:unhandled:mousedown",this.onMouseDown,this),ib.off(this.graph.container,"mousedown",this.onRightMouseDown),ib.off(document.body,{keydown:this.onKeyDown,keyup:this.onKeyUp}),this.mousewheelHandle&&this.mousewheelHandle.disable()}allowPanning(t,e){return t.spaceKey=this.isSpaceKeyPressed,this.pannable&&yb.isMatch(t,this.widgetOptions.modifiers,e)}startPanning(t){const e=this.view.normalizeEvent(t);this.clientX=e.clientX,this.clientY=e.clientY,this.panning=!0,this.updateClassName(t),ib.on(document.body,{"mousemove.panning touchmove.panning":this.pan.bind(this),"mouseup.panning touchend.panning":this.stopPanning.bind(this),"mouseleave.panning":this.stopPanning.bind(this)}),ib.on(window,"mouseup.panning",this.stopPanning.bind(this))}pan(t){const e=this.view.normalizeEvent(t),n=e.clientX-this.clientX,i=e.clientY-this.clientY;this.clientX=e.clientX,this.clientY=e.clientY,this.graph.translateBy(n,i)}stopPanning(t){this.panning=!1,this.updateClassName(t),ib.off(document.body,".panning"),ib.off(window,".panning")}updateClassName(t){const e=this.widgetOptions.eventTypes;if(1===(null===e||void 0===e?void 0:e.length)&&e.includes("mouseWheel"))return;const n=this.view.container,i=this.view.prefixClassName("graph-panning"),s=this.view.prefixClassName("graph-pannable"),r=this.graph.getPlugin("selection"),o=r&&r.allowRubberband(t,!0),a=(null===e||void 0===e?void 0:e.includes("leftMouseDown"))&&!o;this.allowPanning(null!==t&&void 0!==t?t:{},!0)||this.allowPanning(null!==t&&void 0!==t?t:{})&&a?this.panning?(Hf(n,i),Uf(n,s)):(Uf(n,i),Hf(n,s)):this.panning||(Uf(n,i),Uf(n,s))}onMouseDown({e:t}){if(!this.allowBlankMouseDown(t))return;const e=this.graph.getPlugin("selection"),n=e&&e.allowRubberband(t,!0);(this.allowPanning(t,!0)||this.allowPanning(t)&&!n)&&this.startPanning(t)}onRightMouseDown(t){const e=this.widgetOptions.eventTypes;(null===e||void 0===e?void 0:e.includes("rightMouseDown"))&&2===t.button&&this.allowPanning(t,!0)&&this.startPanning(t)}onMouseWheel(t,e,n){this.graph.translateBy(-e,-n)}onKeyDown(t){32===t.which&&(this.isSpaceKeyPressed=!0),this.updateClassName(t)}onKeyUp(t){32===t.which&&(this.isSpaceKeyPressed=!1),this.updateClassName(t)}allowBlankMouseDown(t){const e=this.widgetOptions.eventTypes;return(null===e||void 0===e?void 0:e.includes("leftMouseDown"))&&0===t.button||(null===e||void 0===e?void 0:e.includes("mouseWheelDown"))&&1===t.button}allowMouseWheel(t){var e;return this.pannable&&!t.ctrlKey&&(null===(e=this.widgetOptions.eventTypes)||void 0===e?void 0:e.includes("mouseWheel"))}autoPanning(t,e){const n=10,i=this.graph.getGraphArea();let s=0,r=0;t<=i.left+n&&(s=-n),e<=i.top+n&&(r=-n),t>=i.right-n&&(s=n),e>=i.bottom-n&&(r=n),0===s&&0===r||this.graph.translateBy(-s,-r)}enablePanning(){this.pannable||(this.widgetOptions.enabled=!0,this.updateClassName())}disablePanning(){this.pannable&&(this.widgetOptions.enabled=!1,this.updateClassName())}dispose(){this.stopListening()}}cM([KE.dispose()],hM.prototype,"dispose",null);var uM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class dM extends KE{constructor(){super(...arguments),this.cumulatedFactor=1}get widgetOptions(){return this.options.mousewheel}init(){this.container=this.graph.container,this.target=this.widgetOptions.global?document:this.container,this.mousewheelHandle=new ob(this.target,this.onMouseWheel.bind(this),this.allowMouseWheel.bind(this)),this.widgetOptions.enabled&&this.enable(!0)}get disabled(){return!0!==this.widgetOptions.enabled}enable(t){(this.disabled||t)&&(this.widgetOptions.enabled=!0,this.mousewheelHandle.enable())}disable(){this.disabled||(this.widgetOptions.enabled=!1,this.mousewheelHandle.disable())}allowMouseWheel(t){const e=this.widgetOptions.guard;return(null==e||e(t))&&yb.isMatch(t,this.widgetOptions.modifiers)}onMouseWheel(t){const e=this.widgetOptions.guard;if((null==e||e(t))&&yb.isMatch(t,this.widgetOptions.modifiers)){const e=this.widgetOptions.factor||1.2;null==this.currentScale&&(this.startPos={x:t.clientX,y:t.clientY},this.currentScale=this.graph.transform.getScale().sx);const n=t.deltaY;n<0?(this.currentScale<.15?this.cumulatedFactor=(this.currentScale+.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*e*20)/20/this.currentScale,this.cumulatedFactor<=1&&(this.cumulatedFactor=1.05)):(this.currentScale<=.15?this.cumulatedFactor=(this.currentScale-.01)/this.currentScale:this.cumulatedFactor=Math.round(this.currentScale*(1/e)*20)/20/this.currentScale,this.cumulatedFactor>=1&&(this.cumulatedFactor=.95)),this.cumulatedFactor=Math.max(.01,Math.min(this.currentScale*this.cumulatedFactor,160)/this.currentScale);const i=this.currentScale;let s=this.graph.transform.clampScale(i*this.cumulatedFactor);const r=this.widgetOptions.minScale||Number.MIN_SAFE_INTEGER,o=this.widgetOptions.maxScale||Number.MAX_SAFE_INTEGER;if(s=bf(s,r,o),s!==i)if(this.widgetOptions.zoomAtMousePosition){const t=!!this.graph.getPlugin("scroller"),e=t?this.graph.clientToLocal(this.startPos):this.graph.clientToGraph(this.startPos);this.graph.zoom(s,{absolute:!0,center:e.clone()})}else this.graph.zoom(s,{absolute:!0});this.currentScale=null,this.cumulatedFactor=1}}dispose(){this.disable()}}uM([C.dispose()],dM.prototype,"dispose",null);var gM,pM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class fM extends KE{init(){this.resetRenderArea=wt(this.resetRenderArea,200,{leading:!0}),this.resetRenderArea(),this.startListening()}startListening(){this.graph.on("translate",this.resetRenderArea,this),this.graph.on("scale",this.resetRenderArea,this),this.graph.on("resize",this.resetRenderArea,this)}stopListening(){this.graph.off("translate",this.resetRenderArea,this),this.graph.off("scale",this.resetRenderArea,this),this.graph.off("resize",this.resetRenderArea,this)}enableVirtualRender(){this.options.virtual=!0,this.resetRenderArea()}disableVirtualRender(){this.options.virtual=!1,this.graph.renderer.setRenderArea(void 0)}resetRenderArea(){if(this.options.virtual){const t=this.graph.getGraphArea();this.graph.renderer.setRenderArea(t)}}dispose(){this.stopListening()}}pM([KE.dispose()],fM.prototype,"dispose",null);class mM{constructor(){this.isFlushing=!1,this.isFlushPending=!1,this.scheduleId=0,this.queue=[],this.frameInterval=33,this.initialTime=Date.now()}queueJob(t){if(t.priority&gM.PRIOR)t.cb();else{const e=this.findInsertionIndex(t);e>=0&&this.queue.splice(e,0,t)}}queueFlush(){this.isFlushing||this.isFlushPending||(this.isFlushPending=!0,this.scheduleJob())}queueFlushSync(){this.isFlushing||this.isFlushPending||(this.isFlushPending=!0,this.flushJobsSync())}clearJobs(){this.queue.length=0,this.isFlushing=!1,this.isFlushPending=!1,this.cancelScheduleJob()}flushJobs(){this.isFlushPending=!1,this.isFlushing=!0;const t=this.getCurrentTime();let e;while(e=this.queue.shift())if(e.cb(),this.getCurrentTime()-t>=this.frameInterval)break;this.isFlushing=!1,this.queue.length&&this.queueFlush()}flushJobsSync(){let t;this.isFlushPending=!1,this.isFlushing=!0;while(t=this.queue.shift())try{t.cb()}catch(e){console.log(e)}this.isFlushing=!1}findInsertionIndex(t){let e=0,n=this.queue.length,i=n-1;const s=t.priority;while(e<=i){const t=(i-e>>1)+e;s<=this.queue[t].priority?e=t+1:(n=t,i=t-1)}return n}scheduleJob(){"requestIdleCallback"in window?(this.scheduleId&&this.cancelScheduleJob(),this.scheduleId=window.requestIdleCallback(this.flushJobs.bind(this),{timeout:100})):(this.scheduleId&&this.cancelScheduleJob(),this.scheduleId=window.setTimeout(this.flushJobs.bind(this)))}cancelScheduleJob(){"cancelIdleCallback"in window?(this.scheduleId&&window.cancelIdleCallback(this.scheduleId),this.scheduleId=0):(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduleId=0)}getCurrentTime(){const t="object"===typeof performance&&"function"===typeof performance.now;return t?performance.now():Date.now()-this.initialTime}}(function(t){t[t["Update"]=2]="Update",t[t["RenderEdge"]=4]="RenderEdge",t[t["RenderNode"]=8]="RenderNode",t[t["PRIOR"]=1048576]="PRIOR"})(gM||(gM={}));var yM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class bM extends C{get model(){return this.graph.model}get container(){return this.graph.view.stage}constructor(t){super(),this.views={},this.willRemoveViews={},this.queue=new mM,this.graph=t,this.init()}init(){this.startListening(),this.renderViews(this.model.getCells())}startListening(){this.model.on("reseted",this.onModelReseted,this),this.model.on("cell:added",this.onCellAdded,this),this.model.on("cell:removed",this.onCellRemoved,this),this.model.on("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.on("cell:change:visible",this.onCellVisibleChanged,this)}stopListening(){this.model.off("reseted",this.onModelReseted,this),this.model.off("cell:added",this.onCellAdded,this),this.model.off("cell:removed",this.onCellRemoved,this),this.model.off("cell:change:zIndex",this.onCellZIndexChanged,this),this.model.off("cell:change:visible",this.onCellVisibleChanged,this)}onModelReseted({options:t}){this.queue.clearJobs(),this.removeZPivots(),this.resetViews();const e=this.model.getCells();this.renderViews(e,Object.assign(Object.assign({},t),{queue:e.map(t=>t.id)}))}onCellAdded({cell:t,options:e}){this.renderViews([t],e)}onCellRemoved({cell:t}){this.removeViews([t])}onCellZIndexChanged({cell:t,options:e}){const n=this.views[t.id];n&&this.requestViewUpdate(n.view,bM.FLAG_INSERT,e,gM.Update,!0)}onCellVisibleChanged({cell:t,current:e}){this.toggleVisible(t,!!e)}requestViewUpdate(t,e,n={},i=gM.Update,s=!0){const r=t.cell.id,o=this.views[r];if(!o)return;o.flag=e,o.options=n;const a=t.hasAction(e,["translate","resize","rotate"]);(a||!1===n.async)&&(i=gM.PRIOR,s=!1),this.queue.queueJob({id:r,priority:i,cb:()=>{this.renderViewInArea(t,e,n);const i=n.queue;if(i){const e=i.indexOf(t.cell.id);e>=0&&i.splice(e,1),0===i.length&&this.graph.trigger("render:done")}}});const l=this.getEffectedEdges(t);l.forEach(t=>{this.requestViewUpdate(t.view,t.flag,n,i,!1)}),s&&this.flush()}setRenderArea(t){this.renderArea=t,this.flushWaitingViews()}isViewMounted(t){if(null==t)return!1;const e=this.views[t.cell.id];return!!e&&e.state===bM.ViewState.MOUNTED}renderViews(t,e={}){t.sort((t,e)=>t.isNode()&&e.isEdge()?-1:0),t.forEach(t=>{const n=t.id,i=this.views;let s=0,r=i[n];if(r)s=bM.FLAG_INSERT;else{const i=this.createCellView(t);i&&(i.graph=this.graph,s=bM.FLAG_INSERT|i.getBootstrapFlag(),r={view:i,flag:s,options:e,state:bM.ViewState.CREATED},this.views[n]=r)}r&&this.requestViewUpdate(r.view,s,e,this.getRenderPriority(r.view),!1)}),this.flush()}renderViewInArea(t,e,n={}){const i=t.cell,s=i.id,r=this.views[s];if(!r)return;let o=0;this.isUpdatable(t)||r.state===bM.ViewState.MOUNTED?(o=this.updateView(t,e,n),r.flag=o):r.state=bM.ViewState.WAITING,o&&i.isEdge()&&0===(o&t.getFlag(["source","target"]))&&this.queue.queueJob({id:s,priority:gM.RenderEdge,cb:()=>{this.updateView(t,e,n)}})}removeViews(t){t.forEach(t=>{const e=t.id,n=this.views[e];n&&(this.willRemoveViews[e]=n,delete this.views[e],this.queue.queueJob({id:e,priority:this.getRenderPriority(n.view),cb:()=>{this.removeView(n.view)}}))}),this.flush()}flush(){this.graph.options.async?this.queue.queueFlush():this.queue.queueFlushSync()}flushWaitingViews(){Object.values(this.views).forEach(t=>{if(t&&t.state===bM.ViewState.WAITING){const{view:e,flag:n,options:i}=t;this.requestViewUpdate(e,n,i,this.getRenderPriority(e),!1)}}),this.flush()}updateView(t,e,n={}){if(null==t)return 0;if(eC.isCellView(t)){if(e&bM.FLAG_REMOVE)return this.removeView(t.cell),0;e&bM.FLAG_INSERT&&(this.insertView(t),e^=bM.FLAG_INSERT)}return e?t.confirmUpdate(e,n):0}insertView(t){const e=this.views[t.cell.id];if(e){const n=t.cell.getZIndex(),i=this.addZPivot(n);this.container.insertBefore(t.container,i),t.cell.isVisible()||this.toggleVisible(t.cell,!1),e.state=bM.ViewState.MOUNTED,this.graph.trigger("view:mounted",{view:t})}}resetViews(){this.willRemoveViews=Object.assign(Object.assign({},this.views),this.willRemoveViews),Object.values(this.willRemoveViews).forEach(t=>{t&&this.removeView(t.view)}),this.views={},this.willRemoveViews={}}removeView(t){const e=t.cell,n=this.willRemoveViews[e.id];n&&t&&(n.view.remove(),delete this.willRemoveViews[e.id],this.graph.trigger("view:unmounted",{view:t}))}toggleVisible(t,e){const n=this.model.getConnectedEdges(t);for(let s=0,r=n.length;s<r;s+=1){const t=n[s];if(e){const e=t.getSourceCell(),n=t.getTargetCell();if(e&&!e.isVisible()||n&&!n.isVisible())continue;this.toggleVisible(t,!0)}else this.toggleVisible(t,!1)}const i=this.views[t.id];i&&Km(i.view.container,{display:e?"unset":"none"})}addZPivot(t=0){null==this.zPivots&&(this.zPivots={});const e=this.zPivots;let n=e[t];if(n)return n;n=e[t]=document.createComment(`z-index:${t+1}`);let i=-1/0;for(const r in e){const e=+r;e<t&&e>i&&(i=e)}const s=this.container;if(i!==-1/0){const t=e[i];s.insertBefore(n,t.nextSibling)}else s.insertBefore(n,s.firstChild);return n}removeZPivots(){this.zPivots&&Object.values(this.zPivots).forEach(t=>{t&&t.parentNode&&t.parentNode.removeChild(t)}),this.zPivots={}}createCellView(t){const e={graph:this.graph},n=this.graph.options.createCellView;if(n){const i=Pt(n,this.graph,t);if(i)return new i(t,e);if(null===i)return null}const i=t.view;if(null!=i&&"string"===typeof i){const n=eC.registry.get(i);return n?new n(t,e):eC.registry.onNotFound(i)}return t.isNode()?new JE(t,e):t.isEdge()?new WE(t,e):null}getEffectedEdges(t){const e=[],n=t.cell,i=this.model.getConnectedEdges(n);for(let s=0,r=i.length;s<r;s+=1){const t=i[s],r=this.views[t.id];if(!r)continue;const o=r.view;if(!this.isViewMounted(o))continue;const a=["update"];t.getTargetCell()===n&&a.push("target"),t.getSourceCell()===n&&a.push("source"),e.push({id:t.id,view:o,flag:o.getFlag(a)})}return e}isUpdatable(t){if(t.isNodeView())return!this.renderArea||this.renderArea.isIntersectWithRect(t.cell.getBBox());if(t.isEdgeView()){const e=t.cell,n=e.getSourceCell(),i=e.getTargetCell();if(this.renderArea&&n&&i)return this.renderArea.isIntersectWithRect(n.getBBox())||this.renderArea.isIntersectWithRect(i.getBBox())}return!0}getRenderPriority(t){return t.cell.isNode()?gM.RenderNode:gM.RenderEdge}dispose(){this.stopListening(),Object.keys(this.views).forEach(t=>{this.views[t].view.dispose()}),this.views={}}}yM([C.dispose()],bM.prototype,"dispose",null),function(t){t.FLAG_INSERT=1<<30,t.FLAG_REMOVE=1<<29,t.FLAG_RENDER=67108863}(bM||(bM={})),function(t){let e;(function(t){t[t["CREATED"]=0]="CREATED",t[t["MOUNTED"]=1]="MOUNTED",t[t["WAITING"]=2]="WAITING"})(e=t.ViewState||(t.ViewState={}))}(bM||(bM={}));var vM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class xM extends KE{constructor(){super(...arguments),this.schedule=new bM(this.graph)}requestViewUpdate(t,e,n={}){this.schedule.requestViewUpdate(t,e,n)}isViewMounted(t){return this.schedule.isViewMounted(t)}setRenderArea(t){this.schedule.setRenderArea(t)}findViewByElem(t){if(null==t)return null;const e=this.options.container,n="string"===typeof t?e.querySelector(t):t instanceof Element?t:t[0];if(n){const t=this.graph.view.findAttr("data-cell-id",n);if(t){const e=this.schedule.views;if(e[t])return e[t].view}}return null}findViewByCell(t){if(null==t)return null;const e=EE.isCell(t)?t.id:t,n=this.schedule.views;return n[e]?n[e].view:null}findViewsFromPoint(t){const e={x:t.x,y:t.y};return this.model.getCells().map(t=>this.findViewByCell(t)).filter(t=>null!=t&&cw.getBBox(t.container,{target:this.view.stage}).containsPoint(e))}findEdgeViewsFromPoint(t,e=5){return this.model.getEdges().map(t=>this.findViewByCell(t)).filter(n=>{if(null!=n){const i=n.getClosestPoint(t);if(i)return i.distance(t)<=e}return!1})}findViewsInArea(t,e={}){const n=Tb.create(t);return this.model.getCells().map(t=>this.findViewByCell(t)).filter(t=>{if(t){if(e.nodeOnly&&!t.isNodeView())return!1;const i=cw.getBBox(t.container,{target:this.view.stage});return 0===i.width?i.inflate(1,0):0===i.height&&i.inflate(0,1),e.strict?n.containsRect(i):n.isIntersectWithRect(i)}return!1})}dispose(){this.schedule.dispose()}}vM([KE.dispose()],xM.prototype,"dispose",null);var wM=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class CM extends KE{get cid(){return this.graph.view.cid}get svg(){return this.view.svg}get defs(){return this.view.defs}isDefined(t){return null!=this.svg.getElementById(t)}filter(t){let e=t.id;const n=t.name;if(e||(e=`filter-${n}-${this.cid}-${lf(JSON.stringify(t))}`),!this.isDefined(e)){const i=dv.registry.get(n);if(null==i)return dv.registry.onNotFound(n);const s=i(t.args||{}),r=Object.assign(Object.assign({x:-1,y:-1,width:3,height:3,filterUnits:"objectBoundingBox"},t.attrs),{id:e});ry.create(qw.sanitize(s),r).appendTo(this.defs)}return e}gradient(t){let e=t.id;const n=t.type;if(e||(e=`gradient-${n}-${this.cid}-${lf(JSON.stringify(t))}`),!this.isDefined(e)){const i=t.stops,s=i.map(t=>{const e=null!=t.opacity&&Number.isFinite(t.opacity)?t.opacity:1;return`<stop offset="${t.offset}" stop-color="${t.color}" stop-opacity="${e}"/>`}),r=`<${n}>${s.join("")}</${n}>`,o=Object.assign({id:e},t.attrs);ry.create(r,o).appendTo(this.defs)}return e}marker(t){const{id:e,refX:n,refY:i,markerUnits:s,markerOrient:r,tagName:o,children:a}=t,l=wM(t,["id","refX","refY","markerUnits","markerOrient","tagName","children"]);let c=e;if(c||(c=`marker-${this.cid}-${lf(JSON.stringify(t))}`),!this.isDefined(c)){"path"!==o&&delete l.d;const t=ry.create("marker",{refX:n,refY:i,id:c,overflow:"visible",orient:null!=r?r:"auto",markerUnits:s||"userSpaceOnUse"},a?a.map(t=>{var{tagName:e}=t,n=wM(t,["tagName"]);return ry.create(`${e}`||"path",Am(Object.assign(Object.assign({},l),n)))}):[ry.create(o||"path",Am(l))]);this.defs.appendChild(t.node)}return c}remove(t){const e=this.svg.getElementById(t);e&&e.parentNode&&e.parentNode.removeChild(e)}}class PM extends KE{getClientMatrix(){return Dy(this.view.stage.getScreenCTM())}getClientOffset(){const t=this.view.svg.getBoundingClientRect();return new Nb(t.left,t.top)}getPageOffset(){return this.getClientOffset().translate(window.scrollX,window.scrollY)}snapToGrid(t,e){const n="number"===typeof t?this.clientToLocalPoint(t,e):this.clientToLocalPoint(t.x,t.y);return n.snapToGrid(this.graph.getGridSize())}localToGraphPoint(t,e){const n=Nb.create(t,e);return cw.transformPoint(n,this.graph.matrix())}localToClientPoint(t,e){const n=Nb.create(t,e);return cw.transformPoint(n,this.getClientMatrix())}localToPagePoint(t,e){const n="number"===typeof t?this.localToGraphPoint(t,e):this.localToGraphPoint(t);return n.translate(this.getPageOffset())}localToGraphRect(t,e,n,i){const s=Tb.create(t,e,n,i);return cw.transformRectangle(s,this.graph.matrix())}localToClientRect(t,e,n,i){const s=Tb.create(t,e,n,i);return cw.transformRectangle(s,this.getClientMatrix())}localToPageRect(t,e,n,i){const s="number"===typeof t?this.localToGraphRect(t,e,n,i):this.localToGraphRect(t);return s.translate(this.getPageOffset())}graphToLocalPoint(t,e){const n=Nb.create(t,e);return cw.transformPoint(n,this.graph.matrix().inverse())}clientToLocalPoint(t,e){const n=Nb.create(t,e);return cw.transformPoint(n,this.getClientMatrix().inverse())}clientToGraphPoint(t,e){const n=Nb.create(t,e);return cw.transformPoint(n,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalPoint(t,e){const n=Nb.create(t,e),i=n.diff(this.getPageOffset());return this.graphToLocalPoint(i)}graphToLocalRect(t,e,n,i){const s=Tb.create(t,e,n,i);return cw.transformRectangle(s,this.graph.matrix().inverse())}clientToLocalRect(t,e,n,i){const s=Tb.create(t,e,n,i);return cw.transformRectangle(s,this.getClientMatrix().inverse())}clientToGraphRect(t,e,n,i){const s=Tb.create(t,e,n,i);return cw.transformRectangle(s,this.graph.matrix().multiply(this.getClientMatrix().inverse()))}pageToLocalRect(t,e,n,i){const s=Tb.create(t,e,n,i),r=this.getPageOffset();return s.x-=r.x,s.y-=r.y,this.graphToLocalRect(s)}}var EM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class MM extends KE{constructor(){super(...arguments),this.highlights={}}init(){this.startListening()}startListening(){this.graph.on("cell:highlight",this.onCellHighlight,this),this.graph.on("cell:unhighlight",this.onCellUnhighlight,this)}stopListening(){this.graph.off("cell:highlight",this.onCellHighlight,this),this.graph.off("cell:unhighlight",this.onCellUnhighlight,this)}onCellHighlight({view:t,magnet:e,options:n={}}){const i=this.resolveHighlighter(n);if(!i)return;const s=this.getHighlighterId(e,i);if(!this.highlights[s]){const n=i.highlighter;n.highlight(t,e,Object.assign({},i.args)),this.highlights[s]={cellView:t,magnet:e,highlighter:n,args:i.args}}}onCellUnhighlight({magnet:t,options:e={}}){const n=this.resolveHighlighter(e);if(!n)return;const i=this.getHighlighterId(t,n);this.unhighlight(i)}resolveHighlighter(t){const e=this.options;let n=t.highlighter;if(null==n){const i=t.type;n=i&&e.highlighting[i]||e.highlighting.default}if(null==n)return null;const i="string"===typeof n?{name:n}:n,s=i.name,r=gw.registry.get(s);return null==r?gw.registry.onNotFound(s):(gw.check(s,r),{name:s,highlighter:r,args:i.args||{}})}getHighlighterId(t,e){return Xf(t),e.name+t.id+JSON.stringify(e.args)}unhighlight(t){const e=this.highlights[t];e&&(e.highlighter.unhighlight(e.cellView,e.magnet,e.args),delete this.highlights[t])}dispose(){Object.keys(this.highlights).forEach(t=>this.unhighlight(t)),this.stopListening()}}EM([MM.dispose()],MM.prototype,"dispose",null);var OM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class AM extends KE{getScroller(){const t=this.graph.getPlugin("scroller");return t&&t.options.enabled?t:null}getContainer(){const t=this.getScroller();return t?t.container.parentElement:this.graph.container.parentElement}getSensorTarget(){const t=this.options.autoResize;if(t)return"boolean"===typeof t?this.getContainer():t}init(){const t=this.options.autoResize;if(t){const t=this.getSensorTarget();t&&fb.bind(t,()=>{const e=t.offsetWidth,n=t.offsetHeight;this.resize(e,n)})}}resize(t,e){const n=this.getScroller();n?n.resize(t,e):this.graph.transform.resize(t,e)}dispose(){fb.clear(this.graph.container)}}OM([KE.dispose()],AM.prototype,"dispose",null);var SM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o};class NM extends Hh{get container(){return this.options.container}get[Symbol.toStringTag](){return NM.toStringTag}constructor(t){super(),this.installedPlugins=new Set,this.options=eM.get(t),this.css=new tM(this),this.view=new YE(this),this.defs=new CM(this),this.coord=new PM(this),this.transform=new oM(this),this.highlight=new MM(this),this.grid=new rM(this),this.background=new lM(this),this.options.model?this.model=this.options.model:(this.model=new LE,this.model.graph=this),this.renderer=new xM(this),this.panning=new hM(this),this.mousewheel=new dM(this),this.virtualRender=new fM(this),this.size=new AM(this)}isNode(t){return t.isNode()}isEdge(t){return t.isEdge()}resetCells(t,e={}){return this.model.resetCells(t,e),this}clearCells(t={}){return this.model.clear(t),this}toJSON(t={}){return this.model.toJSON(t)}parseJSON(t){return this.model.parseJSON(t)}fromJSON(t,e={}){return this.model.fromJSON(t,e),this}getCellById(t){return this.model.getCell(t)}addNode(t,e={}){return this.model.addNode(t,e)}addNodes(t,e={}){return this.addCell(t.map(t=>AE.isNode(t)?t:this.createNode(t)),e)}createNode(t){return this.model.createNode(t)}removeNode(t,e={}){return this.model.removeCell(t,e)}addEdge(t,e={}){return this.model.addEdge(t,e)}addEdges(t,e={}){return this.addCell(t.map(t=>NE.isEdge(t)?t:this.createEdge(t)),e)}removeEdge(t,e={}){return this.model.removeCell(t,e)}createEdge(t){return this.model.createEdge(t)}addCell(t,e={}){return this.model.addCell(t,e),this}removeCell(t,e={}){return this.model.removeCell(t,e)}removeCells(t,e={}){return this.model.removeCells(t,e)}removeConnectedEdges(t,e={}){return this.model.removeConnectedEdges(t,e)}disconnectConnectedEdges(t,e={}){return this.model.disconnectConnectedEdges(t,e),this}hasCell(t){return this.model.has(t)}getCells(){return this.model.getCells()}getCellCount(){return this.model.total()}getNodes(){return this.model.getNodes()}getEdges(){return this.model.getEdges()}getOutgoingEdges(t){return this.model.getOutgoingEdges(t)}getIncomingEdges(t){return this.model.getIncomingEdges(t)}getConnectedEdges(t,e={}){return this.model.getConnectedEdges(t,e)}getRootNodes(){return this.model.getRoots()}getLeafNodes(){return this.model.getLeafs()}isRootNode(t){return this.model.isRoot(t)}isLeafNode(t){return this.model.isLeaf(t)}getNeighbors(t,e={}){return this.model.getNeighbors(t,e)}isNeighbor(t,e,n={}){return this.model.isNeighbor(t,e,n)}getSuccessors(t,e={}){return this.model.getSuccessors(t,e)}isSuccessor(t,e,n={}){return this.model.isSuccessor(t,e,n)}getPredecessors(t,e={}){return this.model.getPredecessors(t,e)}isPredecessor(t,e,n={}){return this.model.isPredecessor(t,e,n)}getCommonAncestor(...t){return this.model.getCommonAncestor(...t)}getSubGraph(t,e={}){return this.model.getSubGraph(t,e)}cloneSubGraph(t,e={}){return this.model.cloneSubGraph(t,e)}cloneCells(t){return this.model.cloneCells(t)}getNodesFromPoint(t,e){return this.model.getNodesFromPoint(t,e)}getNodesInArea(t,e,n,i,s){return this.model.getNodesInArea(t,e,n,i,s)}getNodesUnderNode(t,e={}){return this.model.getNodesUnderNode(t,e)}searchCell(t,e,n={}){return this.model.search(t,e,n),this}getShortestPath(t,e,n={}){return this.model.getShortestPath(t,e,n)}getAllCellsBBox(){return this.model.getAllCellsBBox()}getCellsBBox(t,e={}){return this.model.getCellsBBox(t,e)}startBatch(t,e={}){this.model.startBatch(t,e)}stopBatch(t,e={}){this.model.stopBatch(t,e)}batchUpdate(t,e,n){const i="string"===typeof t?t:"update",s="string"===typeof t?e:t,r="function"===typeof e?n:e;this.startBatch(i,r);const o=s();return this.stopBatch(i,r),o}updateCellId(t,e){return this.model.updateCellId(t,e)}findView(t){return EE.isCell(t)?this.findViewByCell(t):this.findViewByElem(t)}findViews(t){return Tb.isRectangleLike(t)?this.findViewsInArea(t):Nb.isPointLike(t)?this.findViewsFromPoint(t):[]}findViewByCell(t){return this.renderer.findViewByCell(t)}findViewByElem(t){return this.renderer.findViewByElem(t)}findViewsFromPoint(t,e){const n="number"===typeof t?{x:t,y:e}:t;return this.renderer.findViewsFromPoint(n)}findViewsInArea(t,e,n,i,s){const r="number"===typeof t?{x:t,y:e,width:n,height:i}:t,o="number"===typeof t?s:e;return this.renderer.findViewsInArea(r,o)}matrix(t){return"undefined"===typeof t?this.transform.getMatrix():(this.transform.setMatrix(t),this)}resize(t,e){const n=this.getPlugin("scroller");return n?n.resize(t,e):this.transform.resize(t,e),this}scale(t,e=t,n=0,i=0){return"undefined"===typeof t?this.transform.getScale():(this.transform.scale(t,e,n,i),this)}zoom(t,e){const n=this.getPlugin("scroller");if(n){if("undefined"===typeof t)return n.zoom();n.zoom(t,e)}else{if("undefined"===typeof t)return this.transform.getZoom();this.transform.zoom(t,e)}return this}zoomTo(t,e={}){const n=this.getPlugin("scroller");return n?n.zoom(t,Object.assign(Object.assign({},e),{absolute:!0})):this.transform.zoom(t,Object.assign(Object.assign({},e),{absolute:!0})),this}zoomToRect(t,e={}){const n=this.getPlugin("scroller");return n?n.zoomToRect(t,e):this.transform.zoomToRect(t,e),this}zoomToFit(t={}){const e=this.getPlugin("scroller");return e?e.zoomToFit(t):this.transform.zoomToFit(t),this}rotate(t,e,n){return"undefined"===typeof t?this.transform.getRotation():(this.transform.rotate(t,e,n),this)}translate(t,e){return"undefined"===typeof t?this.transform.getTranslation():(this.transform.translate(t,e),this)}translateBy(t,e){const n=this.translate(),i=n.tx+t,s=n.ty+e;return this.translate(i,s)}getGraphArea(){return this.transform.getGraphArea()}getContentArea(t={}){return this.transform.getContentArea(t)}getContentBBox(t={}){return this.transform.getContentBBox(t)}fitToContent(t,e,n,i){return this.transform.fitToContent(t,e,n,i)}scaleContentToFit(t={}){return this.transform.scaleContentToFit(t),this}center(t){return this.centerPoint(t)}centerPoint(t,e,n){const i=this.getPlugin("scroller");return i?i.centerPoint(t,e,n):this.transform.centerPoint(t,e),this}centerContent(t){const e=this.getPlugin("scroller");return e?e.centerContent(t):this.transform.centerContent(t),this}centerCell(t,e){const n=this.getPlugin("scroller");return n?n.centerCell(t,e):this.transform.centerCell(t),this}positionPoint(t,e,n,i={}){const s=this.getPlugin("scroller");return s?s.positionPoint(t,e,n,i):this.transform.positionPoint(t,e,n),this}positionRect(t,e,n){const i=this.getPlugin("scroller");return i?i.positionRect(t,e,n):this.transform.positionRect(t,e),this}positionCell(t,e,n){const i=this.getPlugin("scroller");return i?i.positionCell(t,e,n):this.transform.positionCell(t,e),this}positionContent(t,e){const n=this.getPlugin("scroller");return n?n.positionContent(t,e):this.transform.positionContent(t,e),this}snapToGrid(t,e){return this.coord.snapToGrid(t,e)}pageToLocal(t,e,n,i){return Tb.isRectangleLike(t)?this.coord.pageToLocalRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.pageToLocalRect(t,e,n,i):this.coord.pageToLocalPoint(t,e)}localToPage(t,e,n,i){return Tb.isRectangleLike(t)?this.coord.localToPageRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.localToPageRect(t,e,n,i):this.coord.localToPagePoint(t,e)}clientToLocal(t,e,n,i){return Tb.isRectangleLike(t)?this.coord.clientToLocalRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.clientToLocalRect(t,e,n,i):this.coord.clientToLocalPoint(t,e)}localToClient(t,e,n,i){return Tb.isRectangleLike(t)?this.coord.localToClientRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.localToClientRect(t,e,n,i):this.coord.localToClientPoint(t,e)}localToGraph(t,e,n,i){return Tb.isRectangleLike(t)?this.coord.localToGraphRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.localToGraphRect(t,e,n,i):this.coord.localToGraphPoint(t,e)}graphToLocal(t,e,n,i){return Tb.isRectangleLike(t)?this.coord.graphToLocalRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.graphToLocalRect(t,e,n,i):this.coord.graphToLocalPoint(t,e)}clientToGraph(t,e,n,i){return Tb.isRectangleLike(t)?this.coord.clientToGraphRect(t):"number"===typeof t&&"number"===typeof e&&"number"===typeof n&&"number"===typeof i?this.coord.clientToGraphRect(t,e,n,i):this.coord.clientToGraphPoint(t,e)}defineFilter(t){return this.defs.filter(t)}defineGradient(t){return this.defs.gradient(t)}defineMarker(t){return this.defs.marker(t)}getGridSize(){return this.grid.getGridSize()}setGridSize(t){return this.grid.setGridSize(t),this}showGrid(){return this.grid.show(),this}hideGrid(){return this.grid.hide(),this}clearGrid(){return this.grid.clear(),this}drawGrid(t){return this.grid.draw(t),this}updateBackground(){return this.background.update(),this}drawBackground(t,e){const n=this.getPlugin("scroller");return null==n||null!=this.options.background&&e?this.background.draw(t):n.drawBackground(t,e),this}clearBackground(t){const e=this.getPlugin("scroller");return null==e||null!=this.options.background&&t?this.background.clear():e.clearBackground(t),this}enableVirtualRender(){return this.virtualRender.enableVirtualRender(),this}disableVirtualRender(){return this.virtualRender.disableVirtualRender(),this}isMouseWheelEnabled(){return!this.mousewheel.disabled}enableMouseWheel(){return this.mousewheel.enable(),this}disableMouseWheel(){return this.mousewheel.disable(),this}toggleMouseWheel(t){return null==t?this.isMouseWheelEnabled()?this.disableMouseWheel():this.enableMouseWheel():t?this.enableMouseWheel():this.disableMouseWheel(),this}isPannable(){const t=this.getPlugin("scroller");return t?t.isPannable():this.panning.pannable}enablePanning(){const t=this.getPlugin("scroller");return t?t.enablePanning():this.panning.enablePanning(),this}disablePanning(){const t=this.getPlugin("scroller");return t?t.disablePanning():this.panning.disablePanning(),this}togglePanning(t){return null==t?this.isPannable()?this.disablePanning():this.enablePanning():t!==this.isPannable()&&(t?this.enablePanning():this.disablePanning()),this}use(t,...e){return this.installedPlugins.has(t)||(this.installedPlugins.add(t),t.init(this,...e)),this}getPlugin(t){return Array.from(this.installedPlugins).find(e=>e.name===t)}getPlugins(t){return Array.from(this.installedPlugins).filter(e=>t.includes(e.name))}enablePlugins(t){let e=t;Array.isArray(e)||(e=[e]);const n=this.getPlugins(e);return null===n||void 0===n||n.forEach(t=>{var e;null===(e=null===t||void 0===t?void 0:t.enable)||void 0===e||e.call(t)}),this}disablePlugins(t){let e=t;Array.isArray(e)||(e=[e]);const n=this.getPlugins(e);return null===n||void 0===n||n.forEach(t=>{var e;null===(e=null===t||void 0===t?void 0:t.disable)||void 0===e||e.call(t)}),this}isPluginEnabled(t){var e;const n=this.getPlugin(t);return null===(e=null===n||void 0===n?void 0:n.isEnabled)||void 0===e?void 0:e.call(n)}disposePlugins(t){let e=t;Array.isArray(e)||(e=[e]);const n=this.getPlugins(e);return null===n||void 0===n||n.forEach(t=>{t.dispose(),this.installedPlugins.delete(t)}),this}dispose(t=!0){t&&this.model.dispose(),this.css.dispose(),this.defs.dispose(),this.grid.dispose(),this.coord.dispose(),this.transform.dispose(),this.highlight.dispose(),this.background.dispose(),this.mousewheel.dispose(),this.panning.dispose(),this.view.dispose(),this.renderer.dispose(),this.installedPlugins.forEach(t=>{t.dispose()})}}SM([Hh.dispose()],NM.prototype,"dispose",null),function(t){t.View=YE,t.Renderer=xM,t.MouseWheel=dM,t.DefsManager=CM,t.GridManager=rM,t.CoordManager=PM,t.TransformManager=oM,t.HighlightManager=MM,t.BackgroundManager=lM,t.PanningManager=hM}(NM||(NM={})),function(t){function e(e){if(null==e)return!1;if(e instanceof t)return!0;const n=e[Symbol.toStringTag];return null==n||n===t.toStringTag}t.toStringTag=`X6.${t.name}`,t.isGraph=e}(NM||(NM={})),function(t){function e(e,n){const i=e instanceof HTMLElement?new t({container:e}):new t(e);return null!=n&&i.fromJSON(n),i}t.render=e}(NM||(NM={})),function(t){t.registerNode=AE.registry.register,t.registerEdge=NE.registry.register,t.registerView=eC.registry.register,t.registerAttr=iw.registry.register,t.registerGrid=ov.registry.register,t.registerFilter=dv.registry.register,t.registerNodeTool=OC.registry.register,t.registerEdgeTool=AC.registry.register,t.registerBackground=uv.registry.register,t.registerHighlighter=gw.registry.register,t.registerPortLayout=Aw.registry.register,t.registerPortLabelLayout=Uw.registry.register,t.registerMarker=$x.registry.register,t.registerRouter=QP.registry.register,t.registerConnector=yE.registry.register,t.registerAnchor=JC.registry.register,t.registerEdgeAnchor=QC.registry.register,t.registerConnectionPoint=lP.registry.register}(NM||(NM={})),function(t){t.unregisterNode=AE.registry.unregister,t.unregisterEdge=NE.registry.unregister,t.unregisterView=eC.registry.unregister,t.unregisterAttr=iw.registry.unregister,t.unregisterGrid=ov.registry.unregister,t.unregisterFilter=dv.registry.unregister,t.unregisterNodeTool=OC.registry.unregister,t.unregisterEdgeTool=AC.registry.unregister,t.unregisterBackground=uv.registry.unregister,t.unregisterHighlighter=gw.registry.unregister,t.unregisterPortLayout=Aw.registry.unregister,t.unregisterPortLabelLayout=Uw.registry.unregister,t.unregisterMarker=$x.registry.unregister,t.unregisterRouter=QP.registry.unregister,t.unregisterConnector=yE.registry.unregister,t.unregisterAnchor=JC.registry.unregister,t.unregisterEdgeAnchor=QC.registry.unregister,t.unregisterConnectionPoint=lP.registry.unregister}(NM||(NM={}));var TM=function(t,e,n,i){var s,r=arguments.length,o=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,n,o):s(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o},kM=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(t);s<i.length;s++)e.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(t,i[s])&&(n[i[s]]=t[i[s]])}return n};class jM extends AE{}(function(t){class e extends JE{init(){super.init(),this.cell.on("change:*",this.onCellChangeAny,this)}onCellChangeAny({key:e}){const n=t.shapeMaps[this.cell.shape];if(n){const{effect:t}=n;t&&!t.includes(e)||this.renderHTMLComponent()}}confirmUpdate(t){const n=super.confirmUpdate(t);return this.handleAction(n,e.action,()=>this.renderHTMLComponent())}renderHTMLComponent(){const e=this.selectors&&this.selectors.foContent;if(e){um(e);const n=t.shapeMaps[this.cell.shape];if(!n)return;let{html:i}=n;"function"===typeof i&&(i=i(this.cell)),i&&("string"===typeof i?e.innerHTML=i:dm(e,i))}}dispose(){this.cell.off("change:*",this.onCellChangeAny,this)}}TM([e.dispose()],e.prototype,"dispose",null),t.View=e,function(t){t.action="html",t.config({bootstrap:[t.action],actions:{html:t.action}}),JE.registry.register("html-view",t,!0)}(e=t.View||(t.View={}))})(jM||(jM={})),function(t){t.config({view:"html-view",markup:[{tagName:"rect",selector:"body"},Object.assign({},qw.getForeignObjectMarkup()),{tagName:"text",selector:"label"}],attrs:{body:{fill:"none",stroke:"none",refWidth:"100%",refHeight:"100%"},fo:{refWidth:"100%",refHeight:"100%"}}}),AE.registry.register("html",t,!0)}(jM||(jM={})),function(t){function e(e){const{shape:n,html:i,effect:s,inherit:r}=e,o=kM(e,["shape","html","effect","inherit"]);if(!n)throw new Error("should specify shape in config");t.shapeMaps[n]={html:i,effect:s},NM.registerNode(n,Object.assign({inherit:r||"html"},o),!0)}t.shapeMaps={},t.register=e}(jM||(jM={}))},46237:function(t,e,n){"use strict";n.d(e,{B:function(){return r},t:function(){return i}});const i={id:"zh_CN",name:"@vyr/service-graph","graphDrawer.stencil.title":"例程节点"};var s=n(75133);s.Locale.register(i);const r=s.Locale.getLanguage(i.name)},64263:function(t,e,n){"use strict";n.d(e,{G:function(){return x}});var i=n(14291),s=n(67227),r=n(87167),o=n(50931),a=n(93904),l=n(4600),c=Object.defineProperty,h=Object.defineProperties,u=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,g=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,f=(t,e,n)=>e in t?c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,m=(t,e)=>{for(var n in e||(e={}))g.call(e,n)&&f(t,n,e[n]);if(d)for(var n of d(e))p.call(e,n)&&f(t,n,e[n]);return t},y=(t,e)=>h(t,u(e)),b=(t,e,n)=>f(t,"symbol"!==typeof e?e+"":e,n);class v{constructor(){b(this,"width","60%"),b(this,"height","60%"),b(this,"visible",!1),b(this,"descriptor",""),b(this,"event",""),b(this,"inputs",{}),b(this,"interaction",null)}reset(){this.descriptor="",this.event="",this.inputs={},this.interaction=null}}class x extends r.Service{constructor(){super(...arguments),b(this,"_map",new Map),b(this,"_drawer",null),b(this,"state",(0,i.Kh)(new v)),b(this,"interaction",null)}get drawer(){return null===this._drawer&&(this._drawer=new l._,this._drawer.stencil.load([new a.Wl({drawer:this._drawer,label:"Execute"}),new a.D0({drawer:this._drawer,label:"Branch"}),new a.oh({drawer:this._drawer,label:"Condition"})],"inspector")),this._drawer}_doNodes(t){for(const e of t)if("Execute"===e.interaction){const t=new a.Wl(y(m({},e),{drawer:this.drawer}));this.drawer.graph.addCell(t)}else"Condition"===e.interaction?this.drawer.graph.addCell(new a.oh(y(m({},e),{drawer:this.drawer}))):"Branch"===e.interaction&&this.drawer.graph.addCell(new a.D0(y(m({},e),{drawer:this.drawer})))}_doMappers(t){for(const e of t){const t=this.drawer.getEdgeOfMapper(e.source,e.target);this.drawer.graph.addEdge(t)}}_diff(t,e){const n=[],i=[],s=[],r=new Map;for(const o of e)r.set(o.id,o);for(const a of t){const t=r.get(a.id);void 0===t?n.push(a):(!1===o.ObjectUtils.equals(a,t)&&s.push(a),r.delete(a.id))}return i.push(...r.values()),{addQueue:n,removeQueue:i,updateQueue:s}}render(t){this.interaction=t,this.drawer.needTriggerChange=!1,this._doNodes(t.nodes),this._doMappers(t.mappers),this.drawer.needTriggerChange=!0}update(t){if(null===this.interaction)return;this.drawer.needTriggerChange=!1,this.drawer.selectEdge="",this.drawer.history.clean();const e=this.drawer.selection.getSelectedCells(),n=this.drawer.graph.getEdges();for(const r of n)this.drawer.remove(r);const i=this._diff(t.nodes,this.interaction.nodes);let s=!1;for(const r of i.removeQueue){const t=this.drawer.graph.getCellById(r.id);t&&(e.includes(t)&&(s=!0),this.drawer.remove(t))}s&&this.drawer.selection.clean(),this._doNodes(i.addQueue);for(const r of i.updateQueue){const t=this.drawer.graph.getCellById(r.id);t&&t.setVMeta(r)}this._doMappers(t.mappers),this.drawer.needTriggerChange=!0,this.interaction=t}build(){var t,e;const n=new o.InteractionDescriptor,i=this.drawer.graph.getCells();for(const r of i)if(r instanceof a.HZ){const e={id:r.id,label:null!=(t=r.vMeta.label)?t:"",url:r.vMeta.url,interaction:r.vMeta.interaction,input:r.vMeta.input,position:r.getPosition()};n.nodes.push(e)}else if(r.isEdge()){const t=this.drawer.getMapper(r);t&&n.mappers.push(t)}const s=this.drawer.graph.getRootNodes();for(const r of s)n.roots.push(r.id);return y(m({},n),{uuid:null==(e=this.interaction)?void 0:e.uuid})}get(t){var e;return null!=(e=this._map.get(t))?e:null}keys(){return[...this._map.keys()]}set(t,e){const n=(0,s.$V)({loader:e,timeout:5e3});this._map.set(t,n)}}},93904:function(t,e,n){"use strict";n.d(e,{D0:function(){return m},HZ:function(){return p},Wl:function(){return f},oh:function(){return y}});var i=n(50931),s=n(14246),r=Object.defineProperty,o=Object.defineProperties,a=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,u=(t,e,n)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,d=(t,e)=>{for(var n in e||(e={}))c.call(e,n)&&u(t,n,e[n]);if(l)for(var n of l(e))h.call(e,n)&&u(t,n,e[n]);return t},g=(t,e)=>o(t,a(e));class p extends s.N{constructor(t){super(t),this.vMeta.input=t.input?i.Descriptor.deepClone(t.input):{}}}class f extends p{constructor(t){var e;super(g(d({},t),{maxInCount:1/0,icon:"graphfont graph-execute"})),this.vMeta.interaction="Execute",this.vMeta.url=null!=(e=t.url)?e:""}isConnection(t,e){return!1!==s.N.instanceOf(e,[f,y])&&super.isConnection(t,e)}}class m extends p{constructor(t){var e;super(g(d({},t),{maxOutCount:1/0,icon:"graphfont graph-branch"})),this.vMeta.interaction="Branch",this.vMeta.url=null!=(e=t.url)?e:""}isConnection(t,e){return!1!==s.N.instanceOf(e,[f,y])&&super.isConnection(t,e)}}class y extends p{constructor(t){var e;super(g(d({input:{value:{type:"string",value:""}}},t),{icon:"graphfont graph-condition"})),this.vMeta.interaction="Condition",this.vMeta.url=null!=(e=t.url)?e:""}isConnection(t,e){return!1!==s.N.instanceOf(e,[m])&&super.isConnection(t,e)}}}}]);