@relation-graph/react 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/package.json +65 -0
- package/relation-graph.js +56 -0
- package/relation-graph.mjs +7433 -0
- package/relation-graph.umd.js +56 -0
- package/types/components.d.ts +5 -0
- package/types/packages/platforms/react/src/constants.d.ts +1 -0
- package/types/packages/platforms/react/src/index.d.ts +182 -0
- package/types/packages/platforms/react/src/relation-graph/RGPovider.d.ts +7 -0
- package/types/packages/platforms/react/src/relation-graph/RelationGraph.d.ts +5 -0
- package/types/packages/platforms/react/src/relation-graph/RelationLinker.d.ts +5 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvas.d.ts +13 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent.d.ts +11 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGEasyView.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGFakeNode.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGGraphRefs.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLineContent.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLinePath.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLinePeel.d.ts +7 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLineText.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGNodeExpandHolder.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGNodePeel.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerCanvas.d.ts +8 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerContent.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationView.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGConnectSource.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGConnectTarget.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingConnectController.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingConnectPoints.d.ts +7 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingLineController.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingNearNodeWidget.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingNodeController.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingReferenceLine.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGEditingResize.d.ts +7 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/editing/RGMiniView.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/NewCanvas.d.ts +20 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/NewCanvasV2.d.ts +1 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/NewCanvasV3.d.ts +1 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnCanvas.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnCanvasAbove.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnLine.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnLineText.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnNode.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnNodeExpandHandle.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnSVGDefs.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnToolbar.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/slots/RGSlotOnView.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/store/index.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/store/reducers/StockStore.d.ts +8 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphBackground.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphDebugPanel.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphLoading.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphMoveOperator.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphOperateStuff.d.ts +7 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphToolBar.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphWatermark.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/GraphXsToolBar.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/widgets/RGIcons.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/hooks/RGHooks.d.ts +7 -0
- package/types/packages/platforms/react/src/relation-graph/src/hooks/useFakeNodesState.d.ts +8 -0
- package/types/packages/platforms/react/src/relation-graph/src/hooks/useGraphInstance.d.ts +13 -0
- package/types/packages/platforms/react/src/types-react.d.ts +35 -0
- package/types/packages/platforms/react/src/types.d.ts +1 -0
- package/types/packages/platforms/react/vite.config.d.ts +2 -0
- package/types/packages/platforms/vue2/src/core4vue/RGCanvas.vue.d.ts +13 -0
- package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent.vue.d.ts +10 -0
- package/types/packages/platforms/vue2/src/core4vue/RGEasyView.vue.d.ts +6 -0
- package/types/packages/platforms/vue2/src/core4vue/RGFakeNode.vue.d.ts +18 -0
- package/types/packages/platforms/vue2/src/core4vue/RGGraphDefs.vue.d.ts +18 -0
- package/types/packages/platforms/vue2/src/core4vue/RGLineContent.vue.d.ts +22 -0
- package/types/packages/platforms/vue2/src/core4vue/RGLinePath.vue.d.ts +39 -0
- package/types/packages/platforms/vue2/src/core4vue/RGLinePeel.vue.d.ts +20 -0
- package/types/packages/platforms/vue2/src/core4vue/RGLineText.vue.d.ts +33 -0
- package/types/packages/platforms/vue2/src/core4vue/RGNodeExpandHolder.vue.d.ts +36 -0
- package/types/packages/platforms/vue2/src/core4vue/RGNodePeel.vue.d.ts +32 -0
- package/types/packages/platforms/vue2/src/core4vue/RelationGraph.vue.d.ts +820 -0
- package/types/packages/platforms/vue2/src/core4vue/RelationLinker.vue.d.ts +62 -0
- package/types/packages/platforms/vue2/src/core4vue/RelationLinkerCanvas.vue.d.ts +11 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGConnectSource.vue.d.ts +29 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGConnectTarget.vue.d.ts +45 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingConnectController.vue.d.ts +8 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingConnectPoints.vue.d.ts +24 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingLineController.vue.d.ts +26 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingNearNodeWidget.vue.d.ts +20 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingNodeController.vue.d.ts +4 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingReferenceLine.vue.d.ts +29 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingResize.vue.d.ts +31 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGMiniView.vue.d.ts +38 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphBackground.vue.d.ts +32 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphDebugPanel.vue.d.ts +12 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphLoading.vue.d.ts +4 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphMoveOperator.vue.d.ts +8 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphOperateStuff.vue.d.ts +4 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphToolBar.vue.d.ts +46 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphWatermark.vue.d.ts +57 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphXsToolBar.vue.d.ts +46 -0
- package/types/packages/platforms/vue2/src/index.d.ts +2454 -0
- package/types/packages/platforms/vue2/src/types-vue2.d.ts +0 -0
- package/types/packages/platforms/vue2/vite.config.d.ts +2 -0
- package/types/packages/platforms/vue3/src/constants.d.ts +4 -0
- package/types/packages/platforms/vue3/src/index.d.ts +1495 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGCanvas.vue.d.ts +34 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGCanvasContent.vue.d.ts +37 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGEasyView.vue.d.ts +2 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGFakeNode.vue.d.ts +32 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGGraphDefs.vue.d.ts +29 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGLineContent.vue.d.ts +12 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGLinePath.vue.d.ts +16 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGLinePeel.vue.d.ts +29 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGLineText.vue.d.ts +27 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGNodeExpandHolder.vue.d.ts +18 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGNodePeel.vue.d.ts +40 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RGProvider.vue.d.ts +34 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RelationGraph.vue.d.ts +39 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RelationLinker.vue.d.ts +130 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RelationLinkerCanvas.vue.d.ts +23 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/RelationLinkerView.vue.d.ts +24 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGConnectSource.vue.d.ts +45 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGConnectTarget.vue.d.ts +46 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingConnectController.vue.d.ts +23 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingConnectPoints.vue.d.ts +16 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingLineController.vue.d.ts +56 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingNearNodeWidget.vue.d.ts +30 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingNodeController.vue.d.ts +17 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingReferenceLine.vue.d.ts +15 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGEditingResize.vue.d.ts +19 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/editing/RGMiniView.vue.d.ts +17 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/index.vue.d.ts +143 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphBackground.vue.d.ts +49 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphDebugPanel.vue.d.ts +2 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphLoading.vue.d.ts +2 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphMoveOperator.vue.d.ts +2 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphOperateStuff.vue.d.ts +19 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphToolBar.vue.d.ts +31 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphWatermark.vue.d.ts +56 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/GraphXsToolBar.vue.d.ts +31 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/core4vue3/widgets/RGIcons.vue.d.ts +15 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/RGHooks.d.ts +7 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useGraphInstance.d.ts +13 -0
- package/types/packages/platforms/vue3/src/types-vue3.d.ts +22 -0
- package/types/packages/platforms/vue3/src/types.d.ts +1 -0
- package/types/packages/platforms/vue3/vite.config.d.ts +2 -0
- package/types/packages/relation-graph-models/RGObjectsForExport.d.ts +132 -0
- package/types/packages/relation-graph-models/constants.d.ts +1 -0
- package/types/packages/relation-graph-models/layouters/RGBaseLayouter.d.ts +36 -0
- package/types/packages/relation-graph-models/layouters/RGCenterLayouter.d.ts +12 -0
- package/types/packages/relation-graph-models/layouters/RGCircleLayouter.d.ts +8 -0
- package/types/packages/relation-graph-models/layouters/RGFixedLayouter.d.ts +11 -0
- package/types/packages/relation-graph-models/layouters/RGFolderLayouter.d.ts +17 -0
- package/types/packages/relation-graph-models/layouters/RGForceLayouter.d.ts +71 -0
- package/types/packages/relation-graph-models/layouters/RGForceLayouterV2.d.ts +59 -0
- package/types/packages/relation-graph-models/layouters/RGSmartTreeLayouter.d.ts +16 -0
- package/types/packages/relation-graph-models/layouters/RGTreeLayouter.d.ts +18 -0
- package/types/packages/relation-graph-models/models/RGLineDataUtils.d.ts +9 -0
- package/types/packages/relation-graph-models/models/RGNodeDataUtils.d.ts +14 -0
- package/types/packages/relation-graph-models/models/RGOptionsDataUtils.d.ts +11 -0
- package/types/packages/relation-graph-models/models/RelationGraphBase.d.ts +67 -0
- package/types/packages/relation-graph-models/models/RelationGraphFinal.d.ts +11 -0
- package/types/packages/relation-graph-models/models/RelationGraphReact.d.ts +5 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith1Dom.d.ts +76 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith2Data.d.ts +398 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith3Image.d.ts +20 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith4Line.d.ts +48 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith5Zoom.d.ts +31 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith6Effect.d.ts +18 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith6Layout.d.ts +33 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith7Event.d.ts +74 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith8Update.d.ts +23 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith91Editing.d.ts +59 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith92MiniView.d.ts +50 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith9EasyView.d.ts +28 -0
- package/types/packages/relation-graph-models/types.d.ts +903 -0
- package/types/packages/relation-graph-models/utils/RGCanvasImpl2D.d.ts +59 -0
- package/types/packages/relation-graph-models/utils/RGCanvasImplWebGL.d.ts +47 -0
- package/types/packages/relation-graph-models/utils/RGCommon.d.ts +26 -0
- package/types/packages/relation-graph-models/utils/RGDragUtils.d.ts +17 -0
- package/types/packages/relation-graph-models/utils/RGFullscreenUtils.d.ts +3 -0
- package/types/packages/relation-graph-models/utils/RGGraphMath.d.ts +104 -0
- package/types/packages/relation-graph-models/utils/RGIconsData.d.ts +41 -0
- package/types/packages/relation-graph-models/utils/RGIntergration.d.ts +47 -0
- package/types/packages/relation-graph-models/utils/RGNodesAnalytic.d.ts +38 -0
- package/types/packages/relation-graph-models/utils/line/RGLinePath.d.ts +90 -0
- package/types/packages/relation-graph-models/utils/line/RGLinePathUtils.d.ts +54 -0
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor1.d.ts +2 -0
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor4.d.ts +2 -0
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor44.d.ts +2 -0
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor49.d.ts +2 -0
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorFor6.d.ts +6 -0
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorForCurve.d.ts +2 -0
- package/types/react.d.ts +201 -0
- package/types/svelte.d.ts +170 -0
- package/types/vue2.d.ts +862 -0
- package/types/vue3.d.ts +1246 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode("@charset \"UTF-8\";.relation-graph{box-sizing:border-box;position:relative;min-width:300px;min-height:300px;--rg-node-opacity: 1;--editor-main-color: rgb(64, 165, 248);--editor-light-color: rgb(125, 192, 248);--editor-light2-color: rgb(168, 212, 248);--editor-light-opacity: rgba(57, 144, 216, .1);--rg-node-font-size: 12px;--rg-node-font-color: #000000;--rg-node-color: #eeeeee;--rg-node-border-color: #333333;--rg-node-border-width: 1px;--rg-node-width: fit-content;--rg-node-height: fit-content;--rg-node-text-px: 10px;--rg-node-text-py: 3px;--rg-background-color: transparent;--rg-line-color: #888888;--rg-line-width: 2px;--rg-checked-line-bg-color: rgba(150,150,150,.2)}.relation-graph:focus{outline:none}.relation-graph .rg-graph-plugs{position:absolute;left:0px;top:0px;z-index:90;width:100%;height:100%;pointer-events:none;user-select:none}.relation-graph .rg-graph-plugs .rg-graph-slot{position:relative;width:100%;height:100%}.relation-graph .rg-background{position:absolute;left:0px;top:0px;width:100%;height:100%;z-index:0}.relation-graph .rg-watermark{position:absolute;--watermark-width: 200px;--watermark-height: 100px;z-index:1200;overflow:visible;min-height:100px;min-width:100px;width:var(--watermark-width);height:var(--watermark-height);box-sizing:border-box}.relation-graph .rg-watermark div{box-sizing:border-box}.relation-graph .rg-watermark.rg-watermark-top{left:calc((100% - var(--watermark-width)) / 2);top:10px}.relation-graph .rg-watermark.rg-watermark-bottom{left:calc((100% - var(--watermark-width)) / 2);bottom:10px}.relation-graph .rg-watermark.rg-watermark-left{left:10px;top:calc((100% - var(--watermark-height)) / 2)}.relation-graph .rg-watermark.rg-watermark-right{right:10px;top:calc((100% - var(--watermark-height)) / 2)}.relation-graph .rg-watermark.rg-watermark-tl{left:10px;top:10px}.relation-graph .rg-watermark.rg-watermark-tr{right:10px;top:10px}.relation-graph .rg-watermark.rg-watermark-bl{left:10px;bottom:10px}.relation-graph .rg-watermark.rg-watermark-br{right:10px;bottom:10px}.relation-graph .rg-lines-container svg{overflow:visible}.relation-graph .rg-lines-svg{overflow:visible;width:10px;height:10px;position:absolute;left:0px;top:0px}.relation-graph .rg-lines-container{overflow:visible;position:absolute;z-index:40;width:100%;top:0px;left:0px;pointer-events:none}.relation-graph .rg-lines-container-el-lines{z-index:80;pointer-events:none}.relation-graph .rg-lines-container-el-lines .rg-line-bg{pointer-events:stroke}.relation-graph .rg-lines-container-el-lines .rg-line-text{pointer-events:all}.relation-graph .rg-lines-svg-el-lines{overflow:visible;width:10px;height:10px;position:absolute;left:0px;top:0px}.relation-graph .rg-nodes-container{position:absolute;width:100%;top:0px;left:0px;z-index:50}.relation-graph .rg-map{--rg-line-width: 1px;--rg-line-color: #666666;--rg-line-fontsize: 12px;--rg-line-opacity: 1;background-color:var(--bg-background-color);overflow:hidden;cursor:default;user-select:none;opacity:.01;transition:none;width:100%;height:100%;position:relative}.relation-graph.rg-move-mode .rg-map{cursor:grab}.relation-graph .rg-map-ready{opacity:1;transition:opacity .5s ease}.relation-graph .rg-map-background-norepeat{background-repeat:no-repeat;background-position:right bottom}.relation-graph .rg-map-canvas{position:relative;user-select:none;pointer-events:none;top:0px;left:0px;border:0px;z-index:3;overflow:visible;white-space:nowrap;transform-origin:0 0}.relation-graph .rg-map-canvas .rg-events-all{pointer-events:all}.relation-graph.rg-enable-node-xy-animation .rg-node-peel{transition:transform .3s ease,top .3s ease}.relation-graph.rg-enable-node-xy-animation .rg-line-peel{opacity:0;transition:none}.relation-graph.rg-enable-node-xy-animation .rg-map-canvas{transition:transform .4s ease-in-out}.relation-graph.rg-enable-canvas-animation .rg-map-canvas{transition:transform .5s ease}.relation-graph.rg-enable-canvas-animation .rg-editing-ctrl,.relation-graph.rg-enable-canvas-animation .rg-editing-line-ctrl,.relation-graph.rg-enable-canvas-animation .rg-editing-connect-ctrl{opacity:0}.relation-graph .rg-canvas-behind{z-index:2;position:absolute}.relation-graph .rg-canvas-above{z-index:5;position:absolute}.relation-graph .rg-canvas-slot{overflow:visible;position:absolute;margin-top:0;margin-left:0}.relation-graph .rg-canvas-slot-behind{z-index:30;overflow:visible}.relation-graph .rg-canvas-slot-above{z-index:70;overflow:visible}.relation-graph .rg-single-graph{position:relative}.relation-graph .rg-map ::v-deep img{-webkit-user-drag:none;-webkit-user-select:none}.relation-graph .rg-line-text{fill:var(--rg-line-fontcolor, #888888);font-size:var(--rg-line-fontsize);paint-order:stroke;pointer-events:all}.relation-graph .rg-linetext-container{position:absolute;pointer-events:none;user-select:none;overflow:visible;left:0;top:0;z-index:45;display:block}.relation-graph .rg-linetext-container .rg-line-peel{width:fit-content;--rg-line-fontcolor: var(--rg-line-color)}.relation-graph .rg-linetext-container .rg-line-peel .rg-line-label{display:block;color:var(--rg-line-fontcolor, #888888);font-size:var(--rg-line-fontsize);transform-origin:0 0;position:absolute;user-select:none;pointer-events:all;box-sizing:border-box;padding:2px 6px;border-radius:5px}.relation-graph .rg-linetext-container .rg-line-peel-checked .rg-line-label{background-color:var(--rg-checked-line-bg-color)}.relation-graph .rg-line-peel{--rg-line-fontcolor: var(--rg-line-color);pointer-events:none;cursor:default;transition:opacity .2s ease-in;opacity:var(--rg-line-opacity, 1)}.relation-graph .rg-line{fill-rule:nonzero;stroke-linecap:round;stroke:var(--rg-line-color);stroke-width:var(--rg-line-width);pointer-events:none;fill:none;marker-end:var(--rg-line-marker-end);marker-start:var(--rg-line-marker-start)}.relation-graph .rg-line-bg{stroke:#fff;opacity:.01;fill:none;fill-rule:nonzero;stroke-linecap:round;pointer-events:stroke;stroke-width:calc(var(--rg-line-width) + 6px)}.relation-graph .rg-line-bg:hover{opacity:.1;stroke:var(--rg-line-color)}.relation-graph .rg-line-peel-checked .rg-line-bg{stroke:var(--rg-checked-line-bg-color);opacity:1}.relation-graph .rg-line-peel-checked .rg-line{z-index:100}.relation-graph .rg-line-peel-checked .rg-line-text{stroke:var(--rg-checked-line-bg-color);stroke-width:2}.relation-graph .rg-line-peel-disable-events{pointer-events:none!important}.relation-graph .rg-line-peel-disable-events .rg-line-bg,.relation-graph .rg-line-peel-disable-events .rg-line-text,.relation-graph .rg-linetext-container .rg-line-peel-disable-events .rg-line-bg,.relation-graph .rg-linetext-container .rg-line-peel-disable-events .rg-line-label{pointer-events:none}.relation-graph .rg-line-dashtype-1{stroke-dasharray:2,2,2;stroke-dashoffset:3px;stroke-linecap:butt;stroke-linejoin:bevel}.relation-graph .rg-line-dashtype-2{stroke-dasharray:5,5,5;stroke-dashoffset:3px;stroke-linecap:butt;stroke-linejoin:bevel}.relation-graph .rg-line-dashtype-3{stroke-dasharray:9,9,9;stroke-dashoffset:3px;stroke-linecap:butt;stroke-linejoin:bevel}.relation-graph .rg-line-dashtype-4{stroke-dasharray:5,5,15;stroke-dashoffset:3px;stroke-linecap:butt;stroke-linejoin:bevel}@keyframes ACTRGLineChecked{0%{stroke-dashoffset:352px;stroke-dasharray:5,5,5}50%{stroke-dasharray:5,5,5;stroke-dashoffset:3px}to{stroke-dashoffset:352px;stroke-dasharray:5,5,5}}@keyframes rg-line-anm1{0%{stroke-dashoffset:100px;stroke-dasharray:5,5,5}to{stroke-dasharray:5,5,5;stroke-dashoffset:3px}}@keyframes rg-line-anm2{0%{stroke-dashoffset:0;stroke-dasharray:4,4,4}to{stroke-dashoffset:10px;stroke-dasharray:20,20,20}}@keyframes rg-line-anm3{0%{stroke-opacity:1}50%{stroke-opacity:.2}to{stroke-opacity:1}}@keyframes rg-line-anm4{0%{stroke-dasharray:0,100%}to{stroke-dasharray:100%,0}}.relation-graph .rg-line-anm-1{animation:rg-line-anm1 10s infinite;animation-fill-mode:forwards;animation-timing-function:linear}.relation-graph .rg-line-anm-2{animation:rg-line-anm2 3s infinite}.relation-graph .rg-line-anm-3{animation:rg-line-anm3 1s infinite}.relation-graph .rg-line-anm-4{animation:rg-line-anm4 3s infinite}@keyframes deform1{0%{stroke-dashoffset:0}to{stroke-dashoffset:100%}}.relation-graph .rg-icon{width:19px;height:19px;vertical-align:0px;fill:currentColor;overflow:hidden}.relation-graph .rg-node-peel{padding:0;position:absolute;pointer-events:all;font-size:14px;box-sizing:border-box;opacity:var(--rg-node-opacity);z-index:var(--rg-node-z-index);transform-origin:0 0;cursor:default}.relation-graph .rg-node-peel-checked{z-index:9999}.relation-graph .rg-node-peel-disable-events{pointer-events:none}.relation-graph .rg-node{text-align:center;border-style:solid;box-sizing:border-box;transform-origin:0 0;font-size:var(--rg-node-font-size);color:var(--rg-node-font-color);background-color:var(--rg-node-color);border-color:var(--rg-node-border-color);border-width:var(--rg-node-border-width);width:var(--rg-node-width);height:var(--rg-node-height)}.relation-graph .rg-node-shape-0{border-radius:50%}.relation-graph .rg-node-shape-1{border-radius:var(--rg-node-border-radius, 3px)}.relation-graph img,.relation-graph svg,.relation-graph video,.relation-graph canvas,.relation-graph audio,.relation-graph iframe,.relation-graph embed,.relation-graph object{display:unset;vertical-align:unset}.relation-graph .rg-node-text{color:var(--rg-node-font-color);font-size:var(--rg-node-font-size);padding:var(--rg-node-text-py) var(--rg-node-text-px);height:100%;width:100%;display:flex;align-items:center;justify-content:center;box-sizing:border-box}.relation-graph .rg-node-type-button{border-radius:25px;color:#00f;cursor:pointer}.relation-graph .rg-node-checked{transition:background-color .2s ease,outline .2s ease,color .2s ease,-webkit-box-shadow .2s ease;box-shadow:0 0 0 8px var(--rg-checked-line-bg-color)}.relation-graph .rg-node-dragging{z-index:400}.relation-graph .rg-node-selected{box-shadow:0 0 0 2px var(--editor-main-color);z-index:400}.relation-graph .rg-editing-referline{user-select:none;position:absolute;z-index:999;pointer-events:none;width:100%;height:100%;left:0px;top:0px}.relation-graph .rg-editing-referline .rg-referline{position:absolute;display:flex;place-items:center;justify-content:center;overflow:visible;transform-origin:0 0}.relation-graph .rg-editing-referline .rg-referline .referline{display:flex;place-items:center;justify-content:center}.relation-graph .rg-editing-referline .rg-referline .referline>div{background-color:var(--editor-main-color);font-size:8px;border-radius:3px;color:#fff;width:fit-content;height:fit-content;padding:2px 5px}.relation-graph .rg-editing-referline .rg-referline-v{top:0px;width:6px;height:100%;transform:translate(-3px);border-top:var(--editor-main-color) solid 6px;border-bottom:var(--editor-main-color) solid 6px}.relation-graph .rg-editing-referline .rg-referline-v .referline{width:1px;height:100%;border-left:var(--editor-main-color) solid 1px}.relation-graph .rg-editing-referline .rg-referline-h{left:0px;width:100%;height:6px;transform:translateY(-3px);border-left:var(--editor-main-color) solid 6px;border-right:var(--editor-main-color) solid 6px}.relation-graph .rg-editing-referline .rg-referline-h .referline{width:100%;height:1px;border-top:var(--editor-main-color) solid 1px}.relation-graph .rg-editing-line-ctrl{position:absolute;left:0px;top:0px;z-index:500;pointer-events:none;user-select:none;width:100%;height:100%}.relation-graph .rg-editing-line-ctrl .rg-edt-ctrl-svg{position:absolute;pointer-events:none;left:0px;top:0px;overflow:visible}.relation-graph .rg-editing-line-ctrl .rg-edt-ctrl-svg path{stroke:var(--editor-main-color);stroke-width:1px}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-dot{--rg-ctl-x: 0px;--rg-ctl-y: 0px;pointer-events:auto;user-select:none;width:10px;height:10px;background-color:#fff;box-shadow:0 0 0 1px var(--editor-main-color);position:absolute;border-radius:50%;cursor:move;z-index:1;transform-origin:0 0}.relation-graph .rg-editing-line-ctrl .start-dot,.relation-graph .rg-editing-line-ctrl .end-dot,.relation-graph .rg-editing-line-ctrl .ctrl-dot{transform-origin:0 0;transform:translate(-50%,-50%) translate(var(--rg-ctl-x),var(--rg-ctl-y))}.relation-graph .rg-editing-line-ctrl .ctrl-split,.relation-graph .rg-editing-line-ctrl .ctrl-split-core{background-color:#fff}.relation-graph .rg-editing-line-ctrl .ctrl-split-h{width:12px;height:5px;border-radius:3px;cursor:row-resize;transform:translate(-50%,-50%) translate(var(--rg-ctl-x),var(--rg-ctl-y))}.relation-graph .rg-editing-line-ctrl .ctrl-split-v{width:5px;height:12px;border-radius:3px;cursor:col-resize;transform:translate(-50%,-50%) translate(var(--rg-ctl-x),var(--rg-ctl-y))}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-text{--rg-ctl-x: 0px;--rg-ctl-y: 0px;--font-size: 12px;pointer-events:auto;background-color:#fffc;box-shadow:0 0 0 1px var(--editor-main-color);position:absolute;border-radius:3px;cursor:move;z-index:1;white-space:nowrap;color:#000;padding:3px 10px;display:flex;place-items:center;justify-content:center;box-sizing:border-box;text-shadow:none;font-size:var(--font-size, 12px);min-height:20px;max-height:30px;transform-origin:0 0;transform:translate(-50%,-50%) translate(10px,3px) translate(var(--rg-ctl-x),var(--rg-ctl-y));min-width:50px;max-width:220px}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-text p{font-size:var(--font-size, 12px);color:#333}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-text p.empty-text{font-size:10px;color:#888}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-text .rg-line-text-input{white-space:nowrap;pointer-events:auto;user-select:auto;background-color:transparent;color:#000;border-radius:3px;height:100%;padding:3px 0;width:100px;text-shadow:none;font-size:var(--font-size, 12px);text-align:center;box-sizing:border-box;border:none;outline:none}.relation-graph .rg-editing-line-ctrl .rg-line-ctrl-text-editing{background-color:#faf191;--font-size: 12px}.relation-graph .rg-editing-ctrl,.relation-graph .rg-editing-connect-ctrl{user-select:none;position:absolute;z-index:500;box-shadow:0 0 0 1px var(--editor-main-color);border-radius:0;pointer-events:none;transform-origin:0 0}.relation-graph .rg-editing-bar{user-select:none;pointer-events:none;position:absolute;border-radius:5px;padding:3px;box-sizing:border-box;display:flex;place-items:center;justify-content:center;flex-wrap:wrap;gap:5px}.relation-graph .rg-editing-bar .rg-gee-icon{background-color:#d603f680;pointer-events:auto;min-width:20px;min-height:20px;border-radius:5px;box-sizing:border-box;display:flex;place-items:center;justify-content:center;cursor:pointer}.relation-graph .rg-editing-bar .rg-gee-icon:hover{background-color:#d603f6;color:#fff}.relation-graph .rg-connect-source-handle{pointer-events:auto;width:fit-content;height:fit-content}.relation-graph .rg-editing-bar-top{width:fit-content;height:fit-content;left:50%;transform:translate(-50%) translateY(-100%);top:-15px}.relation-graph .rg-editing-bar-bottom{width:fit-content;height:fit-content;left:50%;transform:translate(-50%) translateY(100%);bottom:-15px}.relation-graph .rg-editing-bar-left{width:fit-content;height:fit-content;left:-15px;top:50%;transform:translate(-100%) translateY(-50%)}.relation-graph .rg-editing-bar-right{width:fit-content;height:fit-content;right:-15px;top:50%;transform:translate(100%) translateY(-50%)}.relation-graph .rg-editing-bar-tl{width:30px;height:30px;right:calc(100% + 10px);top:-40px}.relation-graph .rg-editing-bar-tr{width:30px;height:30px;left:calc(100% + 10px);top:-40px}.relation-graph .rg-editing-bar-bl{width:30px;height:30px;right:calc(100% + 10px);bottom:-40px}.relation-graph .rg-editing-bar-br{width:30px;height:30px;left:calc(100% + 10px);bottom:-40px}.relation-graph .rg-resize-ctl{user-select:none;position:relative;height:100%;width:100%;--resize-handler-size: 10px;--resize-handler-offset: -5px}.relation-graph .rg-resize-ctl .rg-resize-ctl-handler{pointer-events:auto;width:var(--resize-handler-size);height:var(--resize-handler-size);background-color:#fff;position:absolute;border-radius:2px;box-shadow:inset 0 0 0 1px var(--editor-main-color)}.relation-graph .rg-resize-ctl .rg-resize-ctl-tl{cursor:nwse-resize;left:var(--resize-handler-offset);top:var(--resize-handler-offset)}.relation-graph .rg-resize-ctl .rg-resize-ctl-tr{cursor:nesw-resize;right:var(--resize-handler-offset);top:var(--resize-handler-offset)}.relation-graph .rg-resize-ctl .rg-resize-ctl-bl{cursor:nesw-resize;left:var(--resize-handler-offset);bottom:var(--resize-handler-offset)}.relation-graph .rg-resize-ctl .rg-resize-ctl-br{cursor:nwse-resize;right:var(--resize-handler-offset);bottom:var(--resize-handler-offset)}.relation-graph .rg-resize-ctl .rg-resize-ctl-t{cursor:n-resize;top:var(--resize-handler-offset);left:calc((100% - var(--resize-handler-size)) / 2)}.relation-graph .rg-resize-ctl .rg-resize-ctl-b{cursor:s-resize;bottom:var(--resize-handler-offset);left:calc((100% - var(--resize-handler-size)) / 2)}.relation-graph .rg-resize-ctl .rg-resize-ctl-l{cursor:w-resize;left:var(--resize-handler-offset);top:calc((100% - var(--resize-handler-size)) / 2)}.relation-graph .rg-resize-ctl .rg-resize-ctl-r{cursor:e-resize;right:var(--resize-handler-offset);top:calc((100% - var(--resize-handler-size)) / 2)}.relation-graph .rg-editing-connect-ctrl{position:absolute;user-select:none;pointer-events:none;z-index:1400;box-shadow:0 0 0 1px var(--editor-main-color);--hander-border-radius: 5px;border-radius:var(--hander-border-radius);--border-handler-width: 8px;--hv-handler-width: 10px;--center-handler-width: 10px;--border-point-width: 10px;--border-point-height: 10px;--hander-color: var(--editor-light2-color);--hander-border-color: var(--editor-main-color)}.relation-graph .rg-connect-ctl{width:100%;height:100%;pointer-events:none;user-select:none}.relation-graph .rg-connect-ctl-handler{pointer-events:auto;user-select:none;z-index:20;cursor:crosshair}.relation-graph .rg-connect-target{width:fit-content;height:fit-content;pointer-events:auto;display:flex;place-items:center;justify-content:center}.relation-graph .rg-connect-ctl-handler-style{background-color:var(--hander-color);border:var(--hander-border-color) solid 1px;position:absolute;border-radius:3px}.relation-graph .rg-connect-ctl-handler-style:hover{background-color:#fbe691}.relation-graph .rg-connect-ctl-center{width:var(--center-handler-width);height:var(--center-handler-width);border-radius:50%;top:calc((100% - var(--center-handler-width)) / 2);left:calc((100% - var(--center-handler-width)) / 2)}.relation-graph .rg-connect-ctl-t{width:var(--border-point-width);height:var(--border-point-height);top:calc(var(--border-point-height) / -2);left:calc((100% - var(--border-point-width)) / 2)}.relation-graph .rg-connect-ctl-b{width:var(--border-point-width);height:var(--border-point-height);bottom:calc(var(--border-point-height) / -2);left:calc((100% - var(--border-point-width)) / 2)}.relation-graph .rg-connect-ctl-l{width:var(--border-point-height);height:var(--border-point-width);left:calc(var(--border-point-height) / -2);top:calc((100% - var(--border-point-width)) / 2)}.relation-graph .rg-connect-ctl-r{width:var(--border-point-height);height:var(--border-point-width);right:calc(var(--border-point-height) / -2);top:calc((100% - var(--border-point-width)) / 2)}.relation-graph .rg-connect-ctl-lr{width:100%;height:var(--hv-handler-width);right:0px;top:calc((100% - var(--hv-handler-width)) / 2);z-index:11;opacity:.01}.relation-graph .rg-connect-ctl-lr:hover{opacity:1}.relation-graph .rg-connect-ctl-tb{width:var(--hv-handler-width);height:100%;top:0px;left:calc((100% - var(--hv-handler-width)) / 2);z-index:10;opacity:.01}.relation-graph .rg-connect-ctl-tb:hover{opacity:1}.relation-graph .rg-connect-ctl-bottom-bar{border:0px;border:none;width:100%;height:var(--border-handler-width);right:0px;top:calc(100% - var(--border-handler-width));z-index:5;opacity:.1;box-shadow:none;background-color:var(--edit-ctl-light-color);border-radius:var(--hander-border-radius);border-top-left-radius:0;border-top-right-radius:0;overflow:hidden}.relation-graph .rg-connect-ctl-bottom-bar:hover{border-top:var(--hander-border-color) solid 1px;opacity:1;box-shadow:none;scale:1}.relation-graph .rg-connect-ctl-top-bar{border:0px;border:none;width:100%;height:var(--border-handler-width);right:0px;top:0px;z-index:5;opacity:.1;box-shadow:none;background-color:var(--edit-ctl-light-color);border-radius:var(--hander-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0;overflow:hidden}.relation-graph .rg-connect-ctl-top-bar:hover{border-bottom:var(--hander-border-color) solid 1px;opacity:1;box-shadow:none;scale:1}.relation-graph .rg-connect-ctl-left-bar{border:0px;border:none;width:var(--border-handler-width);height:100%;left:0px;top:0px;z-index:5;opacity:.1;box-shadow:none;background-color:var(--edit-ctl-light-color);border-radius:var(--hander-border-radius);border-bottom-right-radius:0;border-top-right-radius:0;overflow:hidden}.relation-graph .rg-connect-ctl-left-bar:hover{border-right:var(--hander-border-color) solid 1px;opacity:1;box-shadow:none;scale:1}.relation-graph .rg-connect-ctl-right-bar{border:0px;width:var(--border-handler-width);height:100%;right:0px;top:0px;z-index:5;opacity:.1;box-shadow:none;background-color:var(--edit-ctl-light-color);border-radius:var(--hander-border-radius);border-bottom-left-radius:0;border-top-left-radius:0;overflow:hidden}.relation-graph .rg-connect-ctl-right-bar:hover{border-left:var(--hander-border-color) solid 1px;opacity:1;box-shadow:none;scale:1}.relation-graph .rg-miniview{pointer-events:all;position:absolute;user-select:none;overflow:hidden;z-index:1100;min-height:100px;min-width:100px;--miniview-width: 200px;--miniview-height: 200px;height:var(--miniview-height);width:var(--miniview-width);border-radius:3px;display:flex;place-items:center;justify-content:center;background-color:#fff;box-shadow:0 0 0 1px #ccc;border:none}.relation-graph .rg-miniview .rg-miniview-container{position:absolute;width:100%;height:100%;display:flex;place-items:center;justify-content:center}.relation-graph .rg-miniview canvas{background-color:#fff;opacity:.7}.relation-graph .rg-miniview .rg-mv-canvas-reset{cursor:pointer}.relation-graph .rg-miniview .rg-mv-canvas-reset:hover{background-color:#bbf54794}.relation-graph .rg-miniview .rg-mv-visible-area{z-index:2;position:absolute;cursor:move;transform-origin:0 0;box-shadow:0 0 0 9999px #0000001a;border:1px solid #cccccc;border-radius:3px;display:grid;place-items:center;color:#fff;font-weight:700;text-shadow:0 1px 2px rgba(0,0,0,.5)}.relation-graph .rg-miniview.rg-miniview-top{left:calc((100% - var(--miniview-width)) / 2);top:10px}.relation-graph .rg-miniview.rg-miniview-bottom{left:calc((100% - var(--miniview-width)) / 2);bottom:10px}.relation-graph .rg-miniview.rg-miniview-left{left:10px;top:calc((100% - var(--miniview-height)) / 2)}.relation-graph .rg-miniview.rg-miniview-right{right:10px;top:calc((100% - var(--miniview-height)) / 2)}.relation-graph .rg-miniview.rg-miniview-tl{left:10px;top:10px}.relation-graph .rg-miniview.rg-miniview-tr{right:10px;top:10px}.relation-graph .rg-miniview.rg-miniview-bl{left:10px;bottom:10px}.relation-graph .rg-miniview.rg-miniview-br{right:10px;bottom:10px}.relation-graph .rg-node-flashing{animation:ACTRGNodeFlashing 2s infinite}.relation-graph .rg-node-vtree-2{transform-origin:0 0;transform:rotate(30deg) translate(0)}.relation-graph .rg-node-vtree{width:130px;height:45px;text-align:left}.relation-graph .rg-node-expand-holder{position:absolute;height:fit-content;width:fit-content;display:flex;align-items:center;justify-content:center;user-select:none;pointer-events:none;cursor:pointer}.relation-graph .rg-node-expand-holder>span{width:16px;height:16px;display:block;text-align:center;border-radius:15px;cursor:pointer;font-size:19px;background-size:100% 100%;pointer-events:all;border:#aaaaaa solid .5px;background-color:#fff}.relation-graph .c-expanded{background-image:url(data:image/svg+xml;%20charset=utf8,%3Csvg%20t=%221606310217820%22%20viewBox=%220%200%201024%201024%22%20version=%221.1%22%20xmlns=%22http://www.w3.org/2000/svg%22%20p-id=%223373%22%20width=%2232%22%20height=%2232%22%3E%3Cpath%20d=%22M853.333333%20480H544V170.666667c0-17.066667-14.933333-32-32-32s-32%2014.933333-32%2032v309.333333H170.666667c-17.066667%200-32%2014.933333-32%2032s14.933333%2032%2032%2032h309.333333V853.333333c0%2017.066667%2014.933333%2032%2032%2032s32-14.933333%2032-32V544H853.333333c17.066667%200%2032-14.933333%2032-32s-14.933333-32-32-32z%22%20p-id=%223374%22%20fill=%22%23666666%22%3E%3C/path%3E%3C/svg%3E)}.relation-graph .c-collapsed{background-image:url(data:image/svg+xml;%20charset=utf8,%3Csvg%20t=%221606310454619%22%20class=%22icon%22%20viewBox=%220%200%201024%201024%22%20version=%221.1%22%20xmlns=%22http://www.w3.org/2000/svg%22%20p-id=%223662%22%20width=%22128%22%20height=%22128%22%3E%3Cpath%20d=%22M853.333333%20554.666667H170.666667c-23.466667%200-42.666667-19.2-42.666667-42.666667s19.2-42.666667%2042.666667-42.666667h682.666666c23.466667%200%2042.666667%2019.2%2042.666667%2042.666667s-19.2%2042.666667-42.666667%2042.666667z%22%20p-id=%223663%22%20fill=%22%23666666%22%3E%3C/path%3E%3C/svg%3E)}.relation-graph .c-expand-positon-left{transform:translate(-100%) translateY(-50%);left:-5px;top:50%}.relation-graph .c-expand-positon-right{transform:translate(5px) translateY(-50%);left:100%;top:50%}.relation-graph .c-expand-positon-bottom{transform:translate(-50%);left:50%;top:calc(100% + 5px)}.relation-graph .c-expand-positon-top{transform:translate(-50%) translateY(-100%);left:50%;top:-5px}.relation-graph .rg-setting-panel{--height: 300px;--width: 200px;width:300px;height:200px;position:absolute;margin-left:10px;margin-top:5px;font-size:12px;color:#3a5bb2;padding:60px 10px 10px;overflow:hidden;box-shadow:0 0 5px #999;border-radius:5px;z-index:1000;background-color:#fff;border:#999999 solid 1px}.relation-graph .rg-setting-panel-button{height:35px;width:35px;font-size:8px;line-height:35px;text-align:center;border-radius:50%;position:absolute;margin-left:25px;margin-top:20px;background-color:#3a5bb2;color:#fff;cursor:pointer;z-index:1001;box-shadow:0 0 8px #999}.relation-graph .rg-setting-panel-button:hover{box-shadow:0 0 20px #ffa20a;border:#ffffff solid 1px;color:#ffa20a;-moz-transform:rotate(-89deg) translateX(-190px);animation-timing-function:linear;animation:flashButton 2s infinite}@keyframes flashButton{0%{box-shadow:0 0 8px #2e4e8f}30%{box-shadow:0 0 20px #ffa20a}to{box-shadow:0 0 8px #2e4e8f}}.relation-graph .c-debug-tools-row{text-align:left}.relation-graph .rg-operate{pointer-events:none;user-select:none;position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:180}.relation-graph .rg-operate .rg-node{cursor:move}.relation-graph .rg-operate .rg-creating-container{pointer-events:none;position:relative}.relation-graph .rg-operate .rg-creating-container .rg-node-peel,.relation-graph .rg-operate .rg-creating-container .rg-events-all{pointer-events:none!important}.relation-graph .rg-selection{pointer-events:none;position:absolute;user-select:none;background-color:var(--editor-light-opacity);border:var(--editor-main-color) solid 1px;transform-origin:0 0}.relation-graph .rg-graph-loading{position:absolute;z-index:1600;left:0px;top:0px;height:100%;width:100%;background-color:#fff}.relation-graph .rg-graph-loading .rg-graph-loading-icon{width:16px;height:16px;vertical-align:-3px;fill:currentColor;overflow:hidden;animation:turn 1s linear infinite}.relation-graph .rg-graph-loading .rg-graph-loading-message{position:absolute;width:200px;height:30px;line-height:30px;text-align:center;left:calc((100% - 200px)/2);top:calc((100% - 30px)/2);border-radius:5px;background-color:#00000080;color:#fff;display:flex;place-items:center;justify-content:center;gap:8px}.relation-graph .rg-graph-loading-hide{display:none}@keyframes slowHide{0%{opacity:1}to{opacity:0;display:none}}.relation-graph .rg-easy-view{overflow:visible;height:100%;width:100%;background-color:transparent;position:absolute;left:0px;top:0px;z-index:3;pointer-events:none}.relation-graph .rg-easy-view canvas{opacity:0;width:100%;height:100%}.relation-graph .rg-easy-view-active{pointer-events:all}.relation-graph .rg-easy-view-active canvas{opacity:1}.relation-graph .rg-move-operator{position:absolute;width:100%;height:100%;pointer-events:none;user-select:none;left:0px;top:0px;z-index:6666}.relation-graph .rg-move-operator .rg-move-touchpad{display:none;background-color:var(--edit-ctl-light2-color);height:100%;width:100%;pointer-events:all}.relation-graph .rg-move-operator.rg-move-operator-active{pointer-events:all;cursor:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMzJweCIgaGVpZ2h0PSIzMnB4Ij48aW1hZ2UgeGxpbms6aHJlZj0iZGF0YTppbWFnZS9wbmc7YmFzZTY0LGlWQk9SdzBLR2dvQUFBQU5TVWhFVWdBQUFFQUFBQUJBQ0FZQUFBQ3FhWEhlQUFBQUFYTlNSMElBcnM0YzZRQUFDWlpKUkVGVWVGN3RXZ3RNVk5rWi9xYThabkZ4QkVIQWlCV3lFa0drUEcwRW1paWdGVVZzcFZxTmlsSmZRVEV4c2k2eDFqZHRMVnVEeGpoTlJDc0JzeHBOZktEV0J4Q05QTFFpaUNoRzBTQkxKZHBTYUFWNXlHaW4rOTNjdzQ2enVEc0Rkd1lUT01uSm5XRXU5NTcvKy8vLyt4L25xRERJaDJxUXk0OGhBSVlzWUpBak1PUUNnOXdBaGtod3lBV0dYR0NRSXpEa0FnTmtBQUo0UXdYbzViV0lxMVdXWm0wTDRQdCtCTUJHdnZJN0o0WG0vQitBZC9MVktrQllBd0FocEJEY3RyS3lNc3pYMTNlcG5aMWRvTDI5ZlhoM2QzZTVUcWVycnEydHpRc0pDYmtENEswUkVCWUR3NUlBR0dxYkdyY0ZZSGYvL3YxWkV5Wk0rTE90cmEyN3NZMi9mZnYybjQ4ZVBmcDgwcVJKZndPZ2s0RWdHTFFNVHNXQnNBUUFRdU1VMkxhc3JDekF6ODh2U2ExV0I2dlY2Z2doOUtWTGw4QjU0TUFCckYrL0huRnhjZElVUTZmVFBlN3M3THgyK1BEaFA2U2xwZjNieUNvVTR3ZExBRUJ0YzlxM3RMUnNkWFoyL3NKNHRRME5EUWdNRE1TclY2OTZmdEpvTktpdXJzYllzV1BmdTEybjB6MjRjZVBHNnRqWTJHb0EzUWF1b1FnSVNnUEE1OWxSZUsxVzY1T1NrbktQcXp4eTVBaU9IajJLMHRKU1RKMDZGY09HRGNQRml4ZXhZOGNPYk4rK0hUdDM3cFErejU0OUcrM3Q3YmgrL1RvaUl5T1JuSnlNRlN0V29MdTd1elkzTjNmK3FsV3I2bVFRaEZ2MEd3U2xBYURtSFFBNHZuang0azhlSGg2L29URFRwazNyZGFGNi9iY3VyVkwxdnBScjE2NUpvTDE4K2ZLdm5wNmV2d1hRQ2VDTjdCTDk1Z1dsQWFEMkhRRTR0YmEyWG5CeWN2cEpSRVFFYnQ2OCtSMXRFNUhlQURDMmlpbFRwcUNzckV3Q3NLT2o0MjVYVjFkNWZuNStWbkp5Y29OTWxDSnM5c2thbEFTQXo2TDJod0VZb2Rmcm4zSkZRck85Q2R1WHYvR1pPcDN1SC9YMTllbSt2cjc1QnRHQzFtRDJVQklBeG5rMXRRL0FSYS9YUDFRS2dISGp4cUcrdnY0N3ZKQ2Vudjd6ZmZ2Mk5SbndndGxoVWtrQTZQK2ZBQmdPWUtSZXJ5ZHJLMklCeG1vVnZORFkyTGh2ekpneHUyVmVFQkhDTEN0UUVnREdmZnEvUmdiZ3JsSUFmSWdYMnRyYWJnOGZQdnlYQU5vQWRNbnVZSFVBYVBvRTB0NElnTnRLQWZCOVhLRlNxWHdBTUtGb2wxM0JMRGZvandWUWNKSGYyeFFWRlFXTUh6OStiazFOemRkeGNYRVA5WHA5c1pVQThBUFFBdUMxYkFWbWtXRmZBYURnVXFwYlYxY1g3Kzd1L2l0SFI4ZjV2ZG1lMGxIQStIa3FsU29RUURPQVZwa0xHQlpOSG4wQlFBaHZYMUZSTVRVa0pPUVUyWjhzZmV2V0xYUjFkU0VoSVFFdUxpN1NJcXdBUUpBTUFOMmdRMDZWTFFZQUFaT3l2ZFRVMUZGNzkrNHR0TGUzOThuSnlVRnFhcXFVeG5Jd245KzBhWlAwTnlzQUVBS0F4WklBZ0dteXljTmNDNkQyU1hhZkZCY1h4MGRGUmVVMk5UVmg4dVRKVXB4ZXVIQWgzcjE3aDFPbmFCVEF5Wk1uc1dEQkF1bXpJWkd4NkhuOCtESG16Ly9XYTBTNnpCQW5oaW5ncVZTcVVBRE1CYXdDQUxYUFpPZlR1cnE2MzNsN2U2ZHF0VnFzVzdjT3k1Y3Zsd29lamtPSERtSE5talVZT1hJa21wdnBudThEWUtwNkJKQ0dRUFhDQVFTQUZ2QmYyUVVzYWdITTlhVmtwN2k0ZUZsVVZGVEdpUk1uc0dqUklrbjd4NDhmNzVHTkdtVWhKSWFoQlpnS2dDbWtLbHVBVlFGZ3JxODVkdXhZM09MRmkvOUMwdzhJQ0lDTmpRMEtDd3NSSGg3ZXMrNVpzMlpKVFErUnlQUkg4QSs1eFlBQkFNQzFvYUhob0plWDEwODNidHlJckt3c1RKOCtIVmV2WGxWQ3pnOCs0d011WURVT0VPa3U4MzNYN096c09TdFhydHoxK3ZWclJFZEhvN3k4SEZ1M2JzV3VYYnNzQnNKQUF5QklrQldmTTRCUnQyL2Yvanc4UER6K3lwVXJtRGx6cGlUNGhRc1hwTzZPMHFPcXFnckJ3Y0VZUFhvMEdoc2I4ZWJObTFkcXRacmRGcXVIUVJZOUkxajBCQVVGalNzb0tQalMxZFgxeDl1MmJjUHUzYnVsUmJLSm9WWXpZQ2czbUcrd1RSWWFHb283ZCs2Z3RiWDFhNDFHOHdzREFOZ3RzbWdVb0RTTUJHeDhTSFUvWFVHcjFjYWxwS1NrODBmMjhpaDhSa1lHdG16Wm9wejAzK1M1NmVucHlNek14TnExYTNIdzRFRTBOVFhkR3pWcVZKSkJKa2dBckpJS2k5WVhTMStDNEZaWldmbEZjSEJ3OUprelp6QnYzanhKOEljUEg4TFBqN1dLTW1QdTNMbkl6OC9IK2ZQbkVSOGZqOU9uVC84eE1USHhLNk5hd0NyRkVNbVFWdkNwY0lVTkd6Wk16c3pNM0dOblorZVFsSlNFdkx3OGFaRmNyQkpEY0F6OW44QTZPanAyUmtkSEx5Z3BLV0hyamRVZ2V3SnNsbG9GQU5IK1psTFU0d3FGaFlXclkySmlmczFVbDY3QTZFQ056Wmt6cDk4WWVIbDU0Zm56NXowNVJVMU56WldBZ0lDZEFQNGxaNEVzaDlrVnNtby9RR3FCaXk2UWs1T1RlMjF0YlphSGg4ZG5vdGRQeWZ1YkJTNWJ0Z3k1dWJtWU9IRWlDZ29LNE9ucGljMmJONi9mczJkUHFVeUFMSVZaQ1hJN3pheGhiakZrK0hCUkdZcEdLS09DSU1UTnZKRmNRRTVnVkNncEthSFptclU0M2h3Ykc0dWlvaUpKZUJaWC92Nyt1SGZ2WGtGUVVGQ0dYQVFaTmtQTUlrQSt2ejhBOFA5WkhmYlVCd3lMbktXbHBlc2pJaUlTZUFQMyt5NWZ2Z3huWjJka1oyY2pNVEhSSkJBWTh0TFMwdERTMHZLZThNM056UTJ1cnE1clpPRlphWWtxMEd6elZ3SUFQa1BzQmtrMWdnQ2hycTd1OTk3ZTNteFc5R3g5OFhOWVdCaVdMbDBLYm5pNHVibEprMXRsRHg0OGtHWk5UWTEwUFh2MnJBU1VvZWFsQmF0VWpQc1VYQlJBb2hWbVZ2d1hXdWl2QlFnUUdSV2tNbGxFQlliSGtwS1NsTWpJU0NrOUpDZWNPM2NPZCs5S3plSWZIR1Q3MWF0WFM1TSsvK3paczJvZkh4K1NIazJlOHo4eTh6UDIwL2ZOWW44bEFUQjJCVVlGa1IrTXlNdkxTMWl5Wk1rSzhVSUN3TWp3NU1rVFBIMzZWTHJTekNrd0JRMEtDcEtLcWhrelpraHV3L0ZONisxNldGallBWm50S1RocmYwRjhmZG9QVUJvQTRRcFN0MGkyQklKQVl0UmtabWIrTENZbVpvcS92MytvV3EwMmlRbDFPdDJicXFxcXYrZms1RnpWYXJYM1pZSHA3NXlNK1dSOUNrL1ROeXYwR1RQNUQ1cWppVGVJcUVBUWhEdlFHbGc1OGtyM1VPL2Z2ejh5SkNURTE4M056ZFhaMmRsVm85RzRPRGc0T0haMmRyWjFkSFMwdGJlM3R4VVhGNWRuWldXVlZWUlVNTWF6MFVpQk9hbDFmaGZDOTJ0alZDa1NOQVpVT2h3aHRzbmx6VklLVDVLa2RSQWNSZzd5aGpnc3hXZUlRMUxVS0RYTHJJNkNVbUF4K1owN1FJb2RsRkNDQkkwTlJGaUNTSmVaTEZGd0lUeS9Fd0FCQWtPcEFJQWFGUUJRVUU2U25EZ1RRRkFFNGZXSjlIcGJySWtXYnRadGhnZWtwQk1qOGhTZnBVMFZPWThRQVBBRkJJQ1RRbkpTWUdwYmZCY25RL3JzODlZQ1FMem52ZTB6c1p0a1lQcmlkMkVCRkV5QVFHSEZGTDZ1aU5ZdFJZTGZaeUxDSW9UQVlrTlZhSisvaThPU3ZSMllWRnh3UzRSQlUzMUU4STQ0VG1mOGY0WkFtUHJNUHQ5bkNSTHM4MklHNGgrSEFCZ0kxRCttZHc1WndNZWtqWUZZeTVBRkRBVHFIOU03QjcwRi9COEJrUXA5WU5iRzJRQUFBQUJKUlU1RXJrSmdnZz09IiB3aWR0aD0iMzIiIGhlaWdodD0iMzIiLz48L3N2Zz4=) 16 16,auto!important;cursor:-webkit-image-set(url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAACZZJREFUeF7tWgtMVNkZ/qa8ZnFxBEHAiBWyEkGkPG0EmiigFUVspVqNilJfQTExsi6x1jdtLVuDxjhNRCsBsxpNfKDWBxCNPLQiiChG0SBLJdpSaAV5yGin+93cw46zuDsDdwYTOMnJnWEu957/+///+x/nqDDIh2qQy48hAIYsYJAjMOQCg9wAhkhwyAWGXGCQIzDkAgNkAAJ4QwXo5bWIq1WWZm0L4Pt+BMBGvvI7J4Xm/B+Ad/LVKkBYAwAhpBDctrKyMszX13epnZ1doL29fXh3d3e5Tqerrq2tzQsJCbkD4K0REBYDw5IAGGqbGrcFYHf//v1ZEyZM+LOtra27sY2/ffv2n48ePfp80qRJfwOgk4EgGLQMTsWBsAQAQuMU2LasrCzAz88vSa1WB6vV6ggh9KVLl8B54MABrF+/HnFxcdIUQ6fTPe7s7Lx2+PDhP6Slpf3byCoU4wdLAEBtc9q3tLRsdXZ2/sJ4tQ0NDQgMDMSrV696ftJoNKiursbYsWPfu12n0z24cePG6tjY2GoA3QauoQgISgPA59lReK1W65OSknKPqzxy5AiOHj2K0tJSTJ06FcOGDcPFixexY8cObN++HTt37pQ+z549G+3t7bh+/ToiIyORnJyMFStWoLu7uzY3N3f+qlWr6mQQhFv0GwSlAaDmHQA4vnjx4k8eHh6/oTDTpk3rdaF6/bcurVL1vpRr165JoL18+fKvnp6evwXQCeCN7BL95gWlAaD2HQE4tba2XnBycvpJREQEbt68+R1tE5HeADC2iilTpqCsrEwCsKOj425XV1d5fn5+VnJycoNMlCJs9skalASAz6L2hwEYodfrn3JFQrO9CduXv/GZOp3uH/X19em+vr75BtGC1mD2UBIAxnk1tQ/ARa/XP1QKgHHjxqG+vv47vJCenv7zffv2NRnwgtlhUkkA6P+fABgOYKRerydrK2IBxmoVvNDY2LhvzJgxu2VeEBHCLCtQEgDGffq/RgbgrlIAfIgX2trabg8fPvyXANoAdMnuYHUAaPoE0t4IgNtKAfB9XKFSqXwAMKFol13BLDfojwVQcJHf2xQVFQWMHz9+bk1NzddxcXEP9Xp9sZUA8APQAuC1bAVmkWFfAaDgUqpbV1cX7+7u/itHR8f5vdme0lHA+HkqlSoQQDOAVpkLGBZNHn0BQAhvX1FRMTUkJOQU2Z8sfevWLXR1dSEhIQEuLi7SIqwAQJAMAN2gQ06VLQYAAZOyvdTU1FF79+4ttLe398nJyUFqaqqUxnIwn9+0aZP0NysAEAKAxZIAgGmyycNcC6D2SXafFBcXx0dFReU2NTVh8uTJUpxeuHAh3r17h1OnaBTAyZMnsWDBAumzIZGx6Hn8+DHmz//Wa0S6zBAnhingqVSqUADMBawCALXPZOfTurq633l7e6dqtVqsW7cOy5cvlwoejkOHDmHNmjUYOXIkmpvpnu8DYKp6BJCGQPXCAQSAFvBf2QUsagHM9aVkp7i4eFlUVFTGiRMnsGjRIkn7x48f75GNGmUhJIahBZgKgCmkKluAVQFgrq85duxY3OLFi/9C0w8ICICNjQ0KCwsRHh7es+5Zs2ZJTQ+RyPRH8A+5xYABAMC1oaHhoJeX1083btyIrKwsTJ8+HVevXlVCzg8+4wMuYDUOEOku833X7OzsOStXrtz1+vVrREdHo7y8HFu3bsWuXbssBsJAAyBIkBWfM4BRt2/f/jw8PDz+ypUrmDlzpiT4hQsXpO6O0qOqqgrBwcEYPXo0Ghsb8ebNm1dqtZrdFquHQRY9I1j0BAUFjSsoKPjS1dX1x9u2bcPu3bulRbKJoVYzYCg3mG+wTRYaGoo7d+6gtbX1a41G8wsDANgtsmgUoDSMBGx8SHU/XUGr1calpKSk80f28ih8RkYGtmzZopz03+S56enpyMzMxNq1a3Hw4EE0NTXdGzVqVJJBJkgArJIKi9YXS1+C4FZZWflFcHBw9JkzZzBv3jxJ8IcPH8LPj7WKMmPu3LnIz8/H+fPnER8fj9OnT/8xMTHxK6NawCrFEMmQVvCpcIUNGzZMzszM3GNnZ+eQlJSEvLw8aZFcrBJDcAz9n8A6Ojp2RkdHLygpKWHrjdUgewJslloFANH+ZlLU4wqFhYWrY2Jifs1Ul67A6ECNzZkzp98YeHl54fnz5z05RU1NzZWAgICdAP4lZ4Esh9kVsmo/QGqBiy6Qk5OTe21tbZaHh8dnotdPyfubBS5btgy5ubmYOHEiCgoK4Onpic2bN6/fs2dPqUyALIVZCXI7zaxhbjFk+HBRGYpGKKOCIMTNvJFcQE5gVCgpKaHZmrU43hwbG4uioiJJeBZX/v7+uHfvXkFQUFCGXAQZNkPMIkA+vz8A8P9ZHfbUBwyLnKWlpesjIiISeAP3+y5fvgxnZ2dkZ2cjMTHRJBAY8tLS0tDS0vKe8M3NzQ2urq5rZOFZaYkq0GzzVwIAPkPsBkk1ggChrq7u997e3mxW9Gx98XNYWBiWLl0Kbni4ublJk1tlDx48kGZNTY10PXv2rASUoealBatUjPsUXBRAohVmVvwXWuivBQgQGRWkMllEBYbHkpKSlMjISCk9JCecO3cOd+9KzeIfHGT71atXS5M+/+zZs2ofHx+SHk2e8z8y8zP20/fNYn8lATB2BUYFkR+MyMvLS1iyZMkK8UICwMjw5MkTPH36VLrSzCkwBQ0KCpKKqhkzZkhuw/FN6+16WFjYAZntKThrf0F8fdoPUBoA4QpSt0i2BIJAYtRkZmb+LCYmZoq/v3+oWq02iQl1Ot2bqqqqv+fk5FzVarX3ZYHp75yM+WR9Ck/TNyv0GTP5D5qjiTeIqEAQhDvQGlg58kr3UO/fvz8yJCTE183NzdXZ2dlVo9G4ODg4OHZ2drZ1dHS0tbe3txUXF5dnZWWVVVRUMMaz0UiBOal1fhfC92tjVCkSNAZUOhwhtsnlzVIKT5KkdRAcRg7yhjgsxWeIQ1LUKDXLrI6CUmAx+Z07QIodlFCCBI0NRFiCSJeZLFFwITy/EwABAkOpAIAaFQBQUE6SnDgTQFAE4fWJ9HpbrIkWbtZthgekpBMj8hSfpU0VOY8QAPAFBICTQnJSYGpbfBcnQ/rs89YCQLznve0zsZtkYPrid2EBFEyAQGHFFL6uiNYtRYLfZyLCIoTAYkNVaJ+/i8OSvR2YVFxwS4RBU31E8I44Tmf8f4ZAmPrMPt9nCRLs82IG4h+HABgI1D+mdw5ZwMekjYFYy5AFDATqH9M7B70F/B8BkQp9YNbG2QAAAABJRU5ErkJggg==) 2x,url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAACZZJREFUeF7tWgtMVNkZ/qa8ZnFxBEHAiBWyEkGkPG0EmiigFUVspVqNilJfQTExsi6x1jdtLVuDxjhNRCsBsxpNfKDWBxCNPLQiiChG0SBLJdpSaAV5yGin+93cw46zuDsDdwYTOMnJnWEu957/+///+x/nqDDIh2qQy48hAIYsYJAjMOQCg9wAhkhwyAWGXGCQIzDkAgNkAAJ4QwXo5bWIq1WWZm0L4Pt+BMBGvvI7J4Xm/B+Ad/LVKkBYAwAhpBDctrKyMszX13epnZ1doL29fXh3d3e5Tqerrq2tzQsJCbkD4K0REBYDw5IAGGqbGrcFYHf//v1ZEyZM+LOtra27sY2/ffv2n48ePfp80qRJfwOgk4EgGLQMTsWBsAQAQuMU2LasrCzAz88vSa1WB6vV6ggh9KVLl8B54MABrF+/HnFxcdIUQ6fTPe7s7Lx2+PDhP6Slpf3byCoU4wdLAEBtc9q3tLRsdXZ2/sJ4tQ0NDQgMDMSrV696ftJoNKiursbYsWPfu12n0z24cePG6tjY2GoA3QauoQgISgPA59lReK1W65OSknKPqzxy5AiOHj2K0tJSTJ06FcOGDcPFixexY8cObN++HTt37pQ+z549G+3t7bh+/ToiIyORnJyMFStWoLu7uzY3N3f+qlWr6mQQhFv0GwSlAaDmHQA4vnjx4k8eHh6/oTDTpk3rdaF6/bcurVL1vpRr165JoL18+fKvnp6evwXQCeCN7BL95gWlAaD2HQE4tba2XnBycvpJREQEbt68+R1tE5HeADC2iilTpqCsrEwCsKOj425XV1d5fn5+VnJycoNMlCJs9skalASAz6L2hwEYodfrn3JFQrO9CduXv/GZOp3uH/X19em+vr75BtGC1mD2UBIAxnk1tQ/ARa/XP1QKgHHjxqG+vv47vJCenv7zffv2NRnwgtlhUkkA6P+fABgOYKRerydrK2IBxmoVvNDY2LhvzJgxu2VeEBHCLCtQEgDGffq/RgbgrlIAfIgX2trabg8fPvyXANoAdMnuYHUAaPoE0t4IgNtKAfB9XKFSqXwAMKFol13BLDfojwVQcJHf2xQVFQWMHz9+bk1NzddxcXEP9Xp9sZUA8APQAuC1bAVmkWFfAaDgUqpbV1cX7+7u/itHR8f5vdme0lHA+HkqlSoQQDOAVpkLGBZNHn0BQAhvX1FRMTUkJOQU2Z8sfevWLXR1dSEhIQEuLi7SIqwAQJAMAN2gQ06VLQYAAZOyvdTU1FF79+4ttLe398nJyUFqaqqUxnIwn9+0aZP0NysAEAKAxZIAgGmyycNcC6D2SXafFBcXx0dFReU2NTVh8uTJUpxeuHAh3r17h1OnaBTAyZMnsWDBAumzIZGx6Hn8+DHmz//Wa0S6zBAnhingqVSqUADMBawCALXPZOfTurq633l7e6dqtVqsW7cOy5cvlwoejkOHDmHNmjUYOXIkmpvpnu8DYKp6BJCGQPXCAQSAFvBf2QUsagHM9aVkp7i4eFlUVFTGiRMnsGjRIkn7x48f75GNGmUhJIahBZgKgCmkKluAVQFgrq85duxY3OLFi/9C0w8ICICNjQ0KCwsRHh7es+5Zs2ZJTQ+RyPRH8A+5xYABAMC1oaHhoJeX1083btyIrKwsTJ8+HVevXlVCzg8+4wMuYDUOEOku833X7OzsOStXrtz1+vVrREdHo7y8HFu3bsWuXbssBsJAAyBIkBWfM4BRt2/f/jw8PDz+ypUrmDlzpiT4hQsXpO6O0qOqqgrBwcEYPXo0Ghsb8ebNm1dqtZrdFquHQRY9I1j0BAUFjSsoKPjS1dX1x9u2bcPu3bulRbKJoVYzYCg3mG+wTRYaGoo7d+6gtbX1a41G8wsDANgtsmgUoDSMBGx8SHU/XUGr1calpKSk80f28ih8RkYGtmzZopz03+S56enpyMzMxNq1a3Hw4EE0NTXdGzVqVJJBJkgArJIKi9YXS1+C4FZZWflFcHBw9JkzZzBv3jxJ8IcPH8LPj7WKMmPu3LnIz8/H+fPnER8fj9OnT/8xMTHxK6NawCrFEMmQVvCpcIUNGzZMzszM3GNnZ+eQlJSEvLw8aZFcrBJDcAz9n8A6Ojp2RkdHLygpKWHrjdUgewJslloFANH+ZlLU4wqFhYWrY2Jifs1Ul67A6ECNzZkzp98YeHl54fnz5z05RU1NzZWAgICdAP4lZ4Esh9kVsmo/QGqBiy6Qk5OTe21tbZaHh8dnotdPyfubBS5btgy5ubmYOHEiCgoK4Onpic2bN6/fs2dPqUyALIVZCXI7zaxhbjFk+HBRGYpGKKOCIMTNvJFcQE5gVCgpKaHZmrU43hwbG4uioiJJeBZX/v7+uHfvXkFQUFCGXAQZNkPMIkA+vz8A8P9ZHfbUBwyLnKWlpesjIiISeAP3+y5fvgxnZ2dkZ2cjMTHRJBAY8tLS0tDS0vKe8M3NzQ2urq5rZOFZaYkq0GzzVwIAPkPsBkk1ggChrq7u997e3mxW9Gx98XNYWBiWLl0Kbni4ublJk1tlDx48kGZNTY10PXv2rASUoealBatUjPsUXBRAohVmVvwXWuivBQgQGRWkMllEBYbHkpKSlMjISCk9JCecO3cOd+9KzeIfHGT71atXS5M+/+zZs2ofHx+SHk2e8z8y8zP20/fNYn8lATB2BUYFkR+MyMvLS1iyZMkK8UICwMjw5MkTPH36VLrSzCkwBQ0KCpKKqhkzZkhuw/FN6+16WFjYAZntKThrf0F8fdoPUBoA4QpSt0i2BIJAYtRkZmb+LCYmZoq/v3+oWq02iQl1Ot2bqqqqv+fk5FzVarX3ZYHp75yM+WR9Ck/TNyv0GTP5D5qjiTeIqEAQhDvQGlg58kr3UO/fvz8yJCTE183NzdXZ2dlVo9G4ODg4OHZ2drZ1dHS0tbe3txUXF5dnZWWVVVRUMMaz0UiBOal1fhfC92tjVCkSNAZUOhwhtsnlzVIKT5KkdRAcRg7yhjgsxWeIQ1LUKDXLrI6CUmAx+Z07QIodlFCCBI0NRFiCSJeZLFFwITy/EwABAkOpAIAaFQBQUE6SnDgTQFAE4fWJ9HpbrIkWbtZthgekpBMj8hSfpU0VOY8QAPAFBICTQnJSYGpbfBcnQ/rs89YCQLznve0zsZtkYPrid2EBFEyAQGHFFL6uiNYtRYLfZyLCIoTAYkNVaJ+/i8OSvR2YVFxwS4RBU31E8I44Tmf8f4ZAmPrMPt9nCRLs82IG4h+HABgI1D+mdw5ZwMekjYFYy5AFDATqH9M7B70F/B8BkQp9YNbG2QAAAABJRU5ErkJggg==) 1x) 16 16,auto!important}.relation-graph .rg-move-operator.rg-move-operator-active .rg-move-touchpad{display:flex}.relation-graph.rg-creating-line .rg-connect-source-handle{pointer-events:none;opacity:.5}.relation-graph .rg-toolbar{user-select:none;pointer-events:all;display:flex;position:absolute;z-index:300;background-color:#fff;color:#999;box-shadow:0 1px 3px #00000026,0 0 .5px #0000004d;border:1px solid rgb(204,203,203);box-sizing:border-box;border-radius:5px;width:fit-content;height:fit-content;place-items:center;justify-content:center;gap:3px}.relation-graph .rg-toolbar .rg-icon{flex-grow:1;width:16px;height:16px;fill:currentColor;overflow:hidden}.relation-graph .rg-toolbar .rg-mb-button svg{margin:auto}.relation-graph .rg-toolbar .rg-mb-button-on{color:#2e74b5}.relation-graph .rg-toolbar .rg-mb-button:hover{background-color:#dcdcdc80}.relation-graph .rg-toolbar .rg-loading-icon{animation:turn 1s linear infinite}@keyframes turn{0%{-webkit-transform:rotate(0deg)}25%{-webkit-transform:rotate(90deg)}50%{-webkit-transform:rotate(180deg)}75%{-webkit-transform:rotate(270deg)}to{-webkit-transform:rotate(360deg)}}.relation-graph .rg-toolbar .rg-current-zoom{margin-top:0;color:#262626;font-size:10px;text-align:center;border-radius:3px;cursor:pointer}.relation-graph .rg-toolbar .rg-current-zoom:hover{background-color:#dcdcdc80}.relation-graph .rg-toolbar .rg-mb-button{width:35px;height:35px;margin-top:0;opacity:1;text-align:center;cursor:pointer;font-size:18px;box-sizing:border-box;display:flex;align-items:center;justify-items:center;border-radius:3px}.relation-graph .rg-toolbar-v{flex-flow:column;padding:10px 3px}.relation-graph .rg-toolbar-v .rg-current-zoom{width:35px;height:25px;line-height:25px}.relation-graph .rg-toolbar-h{padding:3px 10px}.relation-graph .rg-toolbar-h .rg-current-zoom{width:fit-content;padding:0 5px;height:35px;line-height:35px}.relation-graph .rg-toolbar-h-right{right:15px}.relation-graph .rg-toolbar-h-left{left:15px}.relation-graph .rg-toolbar-h-center{left:50%;transform:translate(-50%)}.relation-graph .rg-toolbar-v-top{top:15px}.relation-graph .rg-toolbar-v-bottom{bottom:15px}.relation-graph .rg-toolbar-v-center{top:50%;transform:translateY(-50%)}.relation-graph .rg-xs-toolbar{background-color:#fff;color:#333}.relation-graph .rg-xs-toolbar .rg-mb-button{width:25px;height:25px}.relation-graph .rg-xs-toolbar.rg-toolbar-v{padding:3px}.relation-graph .rg-xs-toolbar.rg-toolbar-v .rg-current-zoom{width:30px;height:25px;line-height:25px}.relation-graph .rg-xs-toolbar.rg-toolbar-h{padding:3px}.relation-graph .rg-xs-toolbar.rg-toolbar-h .rg-current-zoom{width:35px;height:25px;line-height:25px}.relation-graph .rg-xs-toolbar.rg-toolbar-h .rg-mb-button{width:25px;height:25px}.relation-graph .rg-xs-toolbar.rg-toolbar-h-right{right:10px}.relation-graph .rg-xs-toolbar.rg-toolbar-h-left{left:10px}.relation-graph .rg-xs-toolbar.rg-toolbar-h-center{top:50%;transform:translate(-50%)}.relation-graph .rg-xs-toolbar.rg-toolbar-v-top{top:10px}.relation-graph .rg-xs-toolbar.rg-toolbar-v-bottom{bottom:10px}.relation-graph .rg-xs-toolbar.rg-toolbar-v-center{top:50%;transform:translateY(-50%)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();"use strict";var be=Object.defineProperty;var Oe=(i,a,t)=>a in i?be(i,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[a]=t;var S=(i,a,t)=>(Oe(i,typeof a!="symbol"?a+"":a,t),t);/*!
|
|
2
|
+
* relation-graph v3.0.0
|
|
3
|
+
* (c) 2025 WanLian <seeksdream@qq.com>
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
* Repository: https://github.com/seeksdream/relation-graph
|
|
6
|
+
*/Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=require("react/jsx-runtime"),k=require("react"),Se=require("react-dom"),Me=i=>i&&typeof i=="object"&&"default"in i?i:{default:i},lt=Me(k),Kt="3.0.0";const it=i=>{try{if("touches"in i&&i.touches||"targetTouches"in i&&i.targetTouches)return!0}catch{}return!1},xt=i=>{if(it(i)){const a=i.touches||i.targetTouches;if(!a)throw new Error("error targetTouches");return{clientX:a[0].clientX,clientY:a[0].clientY}}else return{clientX:i.clientX,clientY:i.clientY}},v=(...i)=>{typeof window<"u"&&window.relationGraphDebug&&console.log("[relation-graph:debug]",...i)},_t=(i,a,t)=>{if(!i)return null;if(i.classList){if(i.classList.contains(a))return i;if(i.classList.contains(t))return null}return _t(i.parentElement,a,t)},ft=async i=>new Promise((a,t)=>{setTimeout(()=>{a()},i)}),rt=i=>typeof i=="string"?Number.parseInt(i):i,Ne=()=>{const i="l",a="o",t="g",e=new Date().getFullYear(),n=[];return e>1&&n.push(i),e>201&&n.push(a),e>1113&&n.push(t),n.join("")},Te=()=>{const i="c",a="o",t="n",e="s",n="o",o="l",s="e",r=new Date().getFullYear(),l=[];return r>1&&l.push(i),r>21&&l.push(a),r>35&&l.push(t),r>55&&l.push(e),r>189&&l.push(n),r>231&&l.push(o),r>1234&&l.push(s),l.join("")},jt=i=>i.replace(/-/g,"").replace(/\*/g,"-"),te=i=>{const a=Te(),t=Ne(),e="r-e-l-a-t-i-o-n*g-r-a-p-h",n="h-t-t-p-s-:-/-/-g-i-t-h-u-b-.-c-o-m-/-s-e-e-k-s-d-r-e-a-m-/-r-e-l-a-t-i-o-n-*-g-r-a-p-h";window&&window[a]&&window[a][t](`%c ${jt(e)} %c Version v${Kt}(${i}) %c More info: ${jt(n)} %c`,"background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#41b883 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:#fff ; padding: 1px; border-radius: 0 3px 3px 0; color: #41b883","background:transparent")},Ee=(i,a)=>{typeof a=="string"&&(a=[a]);for(const e of a)if(i.classList.contains(e))return!0;let t=i.parentElement;for(;t;){for(const e of a)if(t.classList.contains(e))return!0;t=t.parentElement}return!1},vt=i=>{const a=i.target;return Ee(a,"rel-text-editing")?!0:["input","textarea"].includes(document.activeElement.tagName.toLowerCase())},H=k.createContext(null),gt=k.createContext(null),q=k.createContext(0),De=()=>{const i=k.useContext(H),a=k.useContext(gt),t=i.options,[e,n]=k.useState(!1),o=()=>{n(!e)},s=()=>{i.printOptions()},r=()=>{i.getGraphJsonData()},l=()=>{i.enableDebugLog(!t.debug),v("debugLog:",t.debug),a()};return C.jsxs("div",{children:[C.jsx("div",{className:"rg-setting-panel-button",onClick:()=>{o()},children:"Debug"}),e&&C.jsxs("div",{className:"rg-setting-panel",children:[C.jsx("div",{className:"c-debug-tools-row",children:C.jsx("button",{onClick:()=>{s()},children:"print options in console"})}),C.jsx("div",{className:"c-debug-tools-row",children:C.jsx("button",{onClick:()=>{r()},children:"print json data in console"})}),C.jsxs("div",{className:"c-debug-tools-row",children:["debug log status: ",t.debug?"true":"false",C.jsxs("button",{onClick:()=>{l()},children:[t.debug?"disable":"enable"," debug log"]})]})]})]})},A={getDescendantNodes(i,a=[]){return i.lot&&i.lot.childs&&i.lot.childs.forEach(t=>{a.push(t),A.getDescendantNodes(t,a)}),a},conductStrengthToParents(i){i.lot.parent&&Math.abs(i.lot.level)-1===Math.abs(i.lot.parent.lot.level)&&(i.lot.parent.lot.strengthWithChilds+=1,A.conductStrengthToParents(i.lot.parent))},analysisDataTree(i,a,t=1){const e=[];let n=0;i.forEach(o=>{(o.lot.level===0||t===(o.lot.level<0?-1:1))&&(o.lot.childs_size>0&&o.lot.childs.forEach(s=>{e.push(s)}),o.lot.parent&&n<o.lot.parent.lot.strengthWithChilds_from&&(n=o.lot.parent.lot.strengthWithChilds_from),o.lot.strengthWithChilds_from=n,n+=o.lot.strengthWithChilds)}),e.length>0&&A.analysisDataTree(e,a+(t<0?-1:1),t)},conductStrengthToParents4Folder(i){i.lot.parent&&(i.lot.parent.lot.strengthWithChilds+=1,A.conductStrengthToParents4Folder(i.lot.parent))},analysisDataFolder(i,a,t){const e=[];let n=0,o;i.forEach(s=>{(s.lot.level===0||t===(s.lot.level<0?-1:1))&&(s.lot.childs_size>0&&s.lot.childs.forEach(r=>{e.push(r)}),s.lot.parent&&(o?o!==s.lot.parent&&(o=s.lot.parent,n=o.lot.strengthWithChilds_from):(o=s.lot.parent,n=o.lot.strengthWithChilds_from)),s.lot.strengthWithChilds_from=1+n,n+=s.lot.strengthWithChilds)}),e.length>0&&A.analysisDataFolder(e,a+t,t)},isVisibleNode(i,a=0){return typeof a!="number"&&(a=0),a>18?!0:i.hidden?!1:i.lot&&i.lot.parent?i.lot.parent.expanded===!1?!1:A.isVisibleNode(i.lot.parent,a+1):!0},isAllowShowNode(i,a=0){return A.isVisibleNode(i,a=0)},getNodeWidth(i){var a;return((a=i.el)==null?void 0:a.offsetWidth)||i.width||50},getNodeHeight(i){var a;return((a=i.el)==null?void 0:a.offsetHeight)||i.height||50},getNodeXByLotX(i,a){const t=a.lot.x||0;return i.alignItemsX==="end"?t-A.getNodeWidth(a):i.alignItemsX==="start"?t:t-A.getNodeWidth(a)/2},getNodeYByLotY(i,a){const t=a.lot.y||0;return i.alignItemsY==="end"?t-A.getNodeHeight(a):i.alignItemsY==="start"?t:t-A.getNodeHeight(a)/2},getNodeLotXY(i,a){let t=a.x||0,e=a.y||0;return i.alignItemsX==="end"?t=t+A.getNodeWidth(a):i.alignItemsX==="start"||(t=t+A.getNodeWidth(a)/2),i.alignItemsY==="end"?e=e+A.getNodeHeight(a):i.alignItemsY==="start"||(e=e+A.getNodeHeight(a)/2),{x:t,y:e}},isRectangleOverlap(i,a){const t=i.x,e=a.x,n=i.el.offsetWidth,o=a.el.offsetWidth,s=i.y,r=a.y,l=i.el.offsetHeight,c=a.el.offsetHeight;return!(e>=t+n||e+o<=t||r>=s+l||r+c<=s)},isXOverlap(i,a,t,e){return!(a>=i+t||a+e<=i)},isYOverlap(i,a,t,e){return!(a>=i+t||a+e<=i)},shapesOverlap(i,a,t=1,e=1){return this.isRectangleOverlap(i,a)},getNoOverlapLimitedPosition(i,a,t,e){const n=i.x,o=i.y,s=a,r=e.x,l=i.el.offsetWidth,c=e.el.offsetWidth,h=t,d=e.y,f=i.el.offsetHeight,p=e.el.offsetHeight;let u=i.x,g=i.y;const x=this.isXOverlap(n,r,l,c),y=this.isYOverlap(o,d,f,p);return x?h<d?(u=a,g=d-f):h>d&&(u=a,g=d+p):y&&(s<r?(u=r-l,g=t):s>r&&(u=r+c,g=t)),{x:u,y:g}},flatNodeData(i,a,t,e){i.forEach(n=>{t.push(n),a&&e.push({from:a.id,to:n.id});const o=n.children||n.childs;o&&o.length>0&&this.flatNodeData(o,n,t,e)})}},ee=({expandButtonClass:i,expandOrCollapseNode:a,expandHolderPosition:t})=>C.jsx("div",{className:`rg-node-expand-holder c-expand-positon-${t}`,children:C.jsx("span",{className:i,onClickCapture:e=>{a(e)},onTouchEnd:e=>{a(e)}})}),ne=({nodeProps:i,nodeSlot:a,expandHolderSlot:t})=>{const e=k.useContext(H);k.useContext(gt);const n=k.useRef();k.useEffect(()=>(e.addNodeResizeListener(n.current,i),()=>{n.current&&e.removeNodeResizeListener(n.current)}),[]);const o=async y=>{await e.expandOrCollapseNode(i,y.nativeEvent)},s=y=>{y.type==="mousedown"&&y.button!==0||(y.stopPropagation(),e.onNodeDragStart(i,y.nativeEvent))},r=y=>{y.stopPropagation(),e.onNodeClick(i,y.nativeEvent)},l=e.options,c=()=>{if(i.width===0)return;const y=i.width||0;if(!!y)return y+"px"},h=()=>{if(i.height===0)return;const y=i.height||0;if(!!y)return y+"px"},d=i.borderWidth===void 0?void 0:i.borderWidth+"px",f=i.borderColor,p=i.opacity,u=A.isVisibleNode(i);let g=l.defaultExpandHolderPosition&&l.defaultExpandHolderPosition!=="hide"&&i.lot.childs&&i.lot.childs.length>0;i.expandHolderPosition&&(g=i.expandHolderPosition!=="hide");const x=i.expanded===!1?"c-expanded":"c-collapsed";return C.jsxs("div",{ref:n,style:{display:u?void 0:"none","--rg-node-z-index":i.zIndex?i.zIndex:void 0,pointerEvents:p===0?"none":void 0,transform:`translate(${i.x}px, ${i.y}px)`,"--rg-node-color":i.color,"--rg-node-font-color":i.fontColor,"--rg-node-font-size":i.fontSize?i.fontSize+"px":void 0,"--rg-node-border-width":d,"--rg-node-border-radius":i.borderRadius&&i.borderRadius+"px","--rg-node-border-color":f,"--rg-node-opacity":i.opacity===void 0?void 0:i.opacity},className:["rg-node-peel",i.selected&&"rg-node-selected",i.dragging&&"rg-node-dragging",i.id===l.checkedNodeId&&"rg-node-peel-checked",i.className,(i.disablePointEvent||i.opacity===0)&&"rg-node-peel-disable-events"].filter(Boolean).join(" "),"data-id":i.id,children:[g&&(t?t({node:i,expandButtonClass:x,expandOrCollapseNode:y=>{o(y)},expandHolderPosition:i.expandHolderPosition||l.defaultExpandHolderPosition,color:l.defaultExpandHolderColor||i.color||l.defaultNodeColor}):C.jsx(ee,{node:i,expandButtonClass:x,expandOrCollapseNode:y=>{o(y)},expandHolderPosition:i.expandHolderPosition||l.defaultExpandHolderPosition})),C.jsx("div",{className:`rg-node rg-node-shape-${i.nodeShape===void 0?1:i.nodeShape} rg-node-type-${i.type} ${i.id===l.checkedNodeId?"rg-node-checked":""}`,style:{width:c(),height:h()},onClick:y=>{r(y)},onMouseDown:y=>{s(y)},onTouchStart:y=>{s(y)},children:a?a({node:i,graphInstance:e}):C.jsx("div",{className:"rg-node-text",children:C.jsx("span",{children:i.text})})})]})},Yt=({forElementLines:i,svgDefs:a})=>{const e=k.useContext(H).options;return C.jsxs("defs",{children:[C.jsx("marker",{id:`${e.instanceId}-arrow-default`,markerWidth:e.defaultLineMarker.markerWidth,markerHeight:e.defaultLineMarker.markerHeight,refX:e.defaultLineMarker.refX,refY:e.defaultLineMarker.refY,markerUnits:"userSpaceOnUse",orient:"auto",viewBox:e.defaultLineMarker.viewBox,children:C.jsx("path",{style:{fill:"context-stroke"},d:e.defaultLineMarker.data})}),C.jsx("marker",{id:`${e.instanceId}-start-arrow-default`,markerWidth:e.defaultLineMarker.markerWidth,markerHeight:e.defaultLineMarker.markerHeight,refX:e.defaultLineMarker.refX,refY:e.defaultLineMarker.refY,markerUnits:"userSpaceOnUse",orient:"auto-start-reverse",viewBox:e.defaultLineMarker.viewBox,children:C.jsx("path",{style:{fill:"context-stroke"},d:e.defaultLineMarker.data})}),a]})},oe=({children:i,lineConfig:a})=>{const t=k.useContext(H);if(!t)return null;const e=t.getLineTextContainer(a==null?void 0:a.line);if(!e)return null;const n=a.line,o=t.options,s=n.id===o.checkedLineId,r=n.selected;return Se.createPortal(C.jsx("div",{className:["rg-line-peel",n.className,s&&"rg-line-peel-checked",n.disablePointEvent&&"rg-line-peel-disable-events",r&&"rg-line-peel-selected"].filter(Boolean).join(" "),"data-id":n.id+"-text",style:{"--rg-line-color":n.color,"--rg-line-fontsize":a.line.fontSize?`${a.line.fontSize}px`:void 0,"--rg-line-opacity":n.opacity,"--rg-line-fontcolor":n.fontColor,...n.cssVars||{}},children:i}),e)},ie=({lineConfig:i,linePathInfo:a,onLineClick:t})=>{const e=k.useContext(H),n=i.line,o=e.options,s=n.id===o.checkedLineId,r=n.selected,l=e.getArrowMarkerId(n,!0),c=e.getArrowMarkerId(n,!1),h=n.lineWidth?n.lineWidth+"px":void 0,f=n.useTextPath||o.lineUseTextPath?e.generateLineTextStyle4TextPath(i):null,p=o.instanceId+"-"+n.id;return C.jsxs("g",{className:["rg-line-peel",n.className,s&&"rg-line-peel-checked",r&&"rg-line-peel-selected",n.disablePointEvent&&"rg-line-peel-disable-events"].filter(Boolean).join(" "),"data-id":n.id,style:{"--rg-line-width":h,"--rg-line-color":n.color,"--rg-line-opacity":n.opacity,"--rg-line-fontcolor":n.fontColor,"--rg-line-marker-end":c,"--rg-line-marker-start":l,...n.cssVars||{}},children:[C.jsx("path",{d:a.pathData,className:"rg-line-bg",onTouchStart:t,onClick:t}),C.jsx("path",{id:p,d:a.pathData,className:["rg-line",n.dashType?"rg-line-dashtype-"+n.dashType:void 0,n.animation?"rg-line-anm-"+n.animation:void 0].filter(Boolean).join(" ")}),f&&o.canvasZoom>40&&C.jsx("g",{children:C.jsx("text",{className:"rg-line-text rg-line-text-on-path",dy:"-6px",onTouchStart:t,onClick:t,children:C.jsx("textPath",{xlinkHref:`#${p}`,startOffset:f.onPathStartOffset,textAnchor:f.textAnchor,method:"align",spacing:"auto",children:f.text})})})]})},se=({lineConfig:i})=>{const a=k.useContext(H),t=k.useMemo(()=>a.generateLinePath(i),[i]),e=s=>{console.log("onLineClick",i.line),a.onLineClick(i.line,null,s.nativeEvent)},n=!(i.line.useTextPath||a.options.lineUseTextPath)&&a.options.canvasZoom>40,o=a.generateLineTextStyle(i,t);return C.jsxs(C.Fragment,{children:[C.jsx(ie,{lineConfig:i,linePathInfo:t,onLineClick:e}),n&&C.jsx(oe,{lineConfig:i,linePathInfo:t,children:C.jsx("div",{className:"rg-line-label",style:{...o.cssStyles},onTouchStart:e,onClick:e,children:o.text})})]})},Wt=({line:i,lineSlot:a})=>{const t=k.useContext(H);k.useContext(gt);const e=i.isFakeLine?t.generateFakeLineConfig(i):t.generateLineConfig(i);return e&&C.jsx(C.Fragment,{children:a?a({config:e}):C.jsx(se,{lineConfig:e})})},ae=i=>{const a=k.useContext(H);k.useEffect(()=>{},[]);const t=a.options,e=a.getShouldRenderNodes(),n=a.getShouldRenderLines(),o=a.getShouldRenderFakeLines();return C.jsxs(C.Fragment,{children:[C.jsxs("div",{className:"rg-lines-container rg-lines-container-normal-lines",children:[C.jsxs("svg",{className:"rg-lines-svg",style:{width:`${t.canvasSize.width}px`,height:`${t.canvasSize.height}px`},xmlns:"http://www.w3.org/2000/svg",children:[C.jsx(Yt,{svgDefs:i.svgDefs}),!t.showEasyView&&n.map(s=>s.hidden!==!0&&C.jsx(Wt,{line:s,lineSlot:i.lineSlot},s.id))]}),C.jsx("div",{className:"rg-linetext-container"})]}),C.jsx("div",{className:"rg-nodes-container",children:e.map(s=>!t.showEasyView&&C.jsx(ne,{nodeProps:s,nodeSlot:i.nodeSlot,expandHolderSlot:i.expandHolderSlot},s.id))}),C.jsxs("div",{className:"rg-lines-container rg-lines-container-el-lines",children:[C.jsx("div",{className:"rg-linetext-container"}),C.jsxs("svg",{className:"rg-lines-svg rg-lines-svg-el-lines",xmlns:"http://www.w3.org/2000/svg",children:[C.jsx(Yt,{forElementLines:!0}),!t.showEasyView&&o.map(s=>s.hidden!==!0&&C.jsx(Wt,{line:s,lineSlot:i.lineSlot},s.id)),t.creatingLinePlot&&t.newLinkTemplate.fromNode&&(i.lineSlot?i.lineSlot({lineConfig:a.generateCreatingLineConfig()}):C.jsx(se,{lineConfig:a.generateCreatingLineConfig()}))]})]})]})},ke=i=>{const a=k.useContext(H),t=a.options,e=k.useRef();return k.useEffect(()=>{v("[RGEasyView mounted]"),a.setEasyViewCanvas(e.current)},[]),C.jsx("div",{className:`rg-easy-view ${t.showEasyView?"rg-easy-view-active":""}`,children:C.jsx("canvas",{ref:e})})},Re=i=>{const a=k.useContext(H),t=k.useRef(),e=k.useRef(),n={width:`${a.options.canvasSize.width}px`,height:`${a.options.canvasSize.height}px`,backgroundColor:"transparent",transform:`translate(${a.options.canvasOffset.x}px, ${a.options.canvasOffset.y}px) scale(${a.options.canvasZoom/100},${a.options.canvasZoom/100})`};k.useEffect(()=>{v("[RGCanvas mounted]"),a.setCanvasDom(t.current)},[]);const o=r=>{r.type==="mousedown"&&r.button!==0||a.onCanvasDragStart(r.nativeEvent)},s=r=>{r.preventDefault(),a.onContextmenu(r.nativeEvent)};return C.jsxs("div",{style:{"--bg-background-color":a.options.backgroundColor,"--rg-node-color":a.options.defaultNodeColor,"--rg-line-color":a.options.defaultLineColor},ref:e,className:["rg-map",a.options.canvasOpacity===1?"rg-map-ready":""].join(" "),onContextMenu:r=>{s(r)},onMouseDown:r=>{o(r)},onTouchStart:r=>{o(r)},children:[C.jsx(ke,{}),C.jsx("div",{style:n,className:"rg-map-canvas rg-canvas-behind",children:C.jsx("div",{className:"rg-canvas-slot rg-canvas-slot-behind",children:i.canvasPlugSlot&&(typeof i.canvasPlugSlot=="function"?C.jsx(i.canvasPlugSlot,{}):i.canvasPlugSlot)})}),C.jsx("div",{ref:t,style:n,className:"rg-map-canvas",children:C.jsx(ae,{svgDefs:i.svgDefs,nodeSlot:i.nodeSlot,lineSlot:i.lineSlot,expandHolderSlot:i.expandHolderSlot})}),C.jsx("div",{style:n,className:"rg-map-canvas rg-canvas-above",children:C.jsx("div",{className:"rg-canvas-slot rg-canvas-slot-above",children:i.canvasPlugAboveSlot})})]})},Pe=()=>{const i=k.useContext(H),a=(i==null?void 0:i.options.canvasMoveMode)||!1,t=e=>{i&&i.startMoveCanvas(e.nativeEvent,!0)};return C.jsx("div",{className:`rg-move-operator ${a?"rg-move-operator-active":""}`,children:C.jsx("div",{className:"rg-move-touchpad",onMouseDown:t,onTouchStart:t})})},Ie={"icon-quanping":{data:`
|
|
7
|
+
<path d="M298.666667 597.333333H213.333333v213.333334h213.333334v-85.333334H298.666667v-128z m-85.333334-170.666666h85.333334V298.666667h128V213.333333H213.333333v213.333334z m512 298.666666h-128v85.333334h213.333334v-213.333334h-85.333334v128zM597.333333 213.333333v85.333334h128v128h85.333334V213.333333h-213.333334z"/>
|
|
8
|
+
`},"icon-fangda":{data:`
|
|
9
|
+
<path d="M768 448a320 320 0 1 0-320 320 320 320 0 0 0 320-320z m64 0A384 384 0 1 1 448 64a384 384 0 0 1 384 384z"></path>
|
|
10
|
+
<path d="M681.28 726.72a32 32 0 0 1 45.44-45.44l160 160a32 32 0 0 1-45.44 45.44zM320 480a32 32 0 0 1 0-64h256a32 32 0 0 1 0 64z"></path>
|
|
11
|
+
<path d="M480 576a32 32 0 0 1-64 0V320a32 32 0 0 1 64 0z"></path>
|
|
12
|
+
`},"icon-suoxiao":{data:`
|
|
13
|
+
<path d="M768 448a320 320 0 1 0-320 320 320 320 0 0 0 320-320z m64 0A384 384 0 1 1 448 64a384 384 0 0 1 384 384z"></path>
|
|
14
|
+
<path d="M681.28 726.72a32 32 0 0 1 45.44-45.44l160 160a32 32 0 0 1-45.44 45.44zM288 480a32 32 0 0 1 0-64h320a32 32 0 0 1 0 64z"></path>
|
|
15
|
+
`},"icon-zidong":{data:`
|
|
16
|
+
<path d="M131.3 363.3c-19.2 47.3-28.9 97.3-28.9 148.7 0 51.3 9.7 101.3 28.9 148.7 7 17.2 15.1 33.8 24.3 49.7l15.8-49.1 42.8 13.8-39.8 123.8-42.8-13.9-80.9-26 13.8-42.8 52.3 16.8c-98-168.4-74.8-387.9 69.4-532.1C342.4 44.7 586.9 30.5 759.1 158.3l-32.2 32.2c-25.1-18-52.1-32.9-80.9-44.6-47.3-19.2-97.3-28.9-148.7-28.9-51.3 0-101.3 9.7-148.7 28.9-49 19.9-92.9 49.1-130.6 86.8s-66.9 81.7-86.7 130.6z m828.3-60.2l13.8-42.8-80.9-26-42.8-13.8-39.8 123.8 42.8 13.8 15-46.7c9.8 16.6 18.4 34 25.8 52.1 19.2 47.3 28.9 97.3 28.9 148.7 0 51.3-9.7 101.3-28.9 148.7-19.9 49-49.1 92.9-86.8 130.6C768.9 829 725 858.2 676 878.1c-47.3 19.2-97.3 28.9-148.7 28.9-51.3 0-101.3-9.7-148.7-28.9-28.8-11.7-55.9-26.6-80.9-44.6l-32.2 32.2c126.3 93.7 382.6 147.7 572.9-42.6 145.8-145.8 167.9-368.6 66.1-537.7l55.1 17.7zM474 241.2L295 730.4h64.8l50.5-148.2h195.3l54 148.2h70.3L539.6 241.2H474z m-45.9 288.3L479.8 386c11-30.9 19.4-62.1 25.4-93.4 6.9 26 17.9 59.9 32.8 101.5l48.2 135.5H428.1z"></path>
|
|
17
|
+
|
|
18
|
+
`},"icon-yuanquanfenxiang":{data:`
|
|
19
|
+
<path d="M751.148705 578.773799c-61.987796 0-117.066229 30.121018-151.388942 76.488045L398.287145 536.382317c1.991354-10.171664 3.046383-20.673855 3.046383-31.419594 0-18.776645-3.196809-36.817534-9.058306-53.621245l193.486736-107.492176c31.949666 58.566884 94.104261 98.391914 165.386748 98.391914 103.803157 0 188.254571-84.450391 188.254571-188.254571S854.951863 65.73105 751.148705 65.73105c-103.804181 0-188.255595 84.450391-188.255595 188.254571 0 14.246469 1.600451 28.125571 4.613064 41.4746L368.032074 406.279167c-29.841655-39.193651-76.976162-64.544015-129.927141-64.544015-90.004897 0-163.228595 73.223698-163.228595 163.228595 0 90.003873 73.223698 163.228595 163.228595 163.228595 60.882626 0 114.078175-33.510208 142.134161-83.049484L575.173808 700.16452c-7.925507 20.788465-12.280698 43.325761-12.280698 66.86385 0 103.803157 84.450391 188.254571 188.255595 188.254571 103.803157 0 188.254571-84.450391 188.254571-188.254571S854.951863 578.773799 751.148705 578.773799zM751.148705 116.89636c75.590606 0 137.089261 61.498656 137.089261 137.089261s-61.498656 137.089261-137.089261 137.089261c-75.591629 0-137.090285-61.498656-137.090285-137.089261S675.557076 116.89636 751.148705 116.89636zM238.105956 617.026008c-61.791321 0-112.063285-50.27094-112.063285-112.063285 0-61.791321 50.27094-112.063285 112.063285-112.063285s112.063285 50.27094 112.063285 112.063285C350.168218 566.755068 299.897278 617.026008 238.105956 617.026008zM751.148705 904.117632c-75.591629 0-137.090285-61.498656-137.090285-137.089261s61.498656-137.089261 137.090285-137.089261c75.590606 0 137.089261 61.498656 137.089261 137.089261S826.739311 904.117632 751.148705 904.117632z"></path>
|
|
20
|
+
|
|
21
|
+
`},"icon-hj2":{data:`
|
|
22
|
+
<path d="M963.66 256.607c0-0.244 0-0.607-0.126-0.851 0-0.369 0-0.614-0.119-0.978 0-0.369-0.119-0.733-0.119-1.104 0-0.244 0-0.487-0.126-0.725 0-0.369-0.119-0.859-0.244-1.222 0-0.244-0.119-0.369-0.119-0.613-0.126-0.365-0.126-0.852-0.245-1.216 0-0.244-0.126-0.369-0.126-0.613-0.119-0.365-0.244-0.734-0.364-1.222-0.126-0.244-0.126-0.49-0.244-0.609l-0.369-1.095c-0.119-0.245-0.119-0.49-0.244-0.734-0.121-0.369-0.245-0.613-0.365-0.978-0.126-0.244-0.244-0.613-0.369-0.851-0.119-0.244-0.238-0.613-0.364-0.859-0.119-0.364-0.244-0.607-0.364-0.977l-0.371-0.734c-0.119-0.364-0.364-0.725-0.487-0.971-0.119-0.245-0.244-0.371-0.364-0.614-0.244-0.364-0.369-0.733-0.614-1.097-0.119-0.126-0.244-0.369-0.364-0.487l-0.733-1.097c-0.119-0.126-0.244-0.369-0.365-0.487-0.244-0.369-0.487-0.733-0.733-0.978-0.126-0.244-0.244-0.369-0.487-0.613-0.245-0.238-0.49-0.607-0.734-0.851-0.244-0.245-0.487-0.49-0.607-0.734-0.244-0.244-0.369-0.487-0.614-0.733-0.851-0.972-1.829-1.83-2.681-2.682-0.245-0.244-0.49-0.369-0.734-0.614-0.244-0.244-0.487-0.487-0.733-0.607-0.245-0.244-0.614-0.487-0.859-0.733-0.238-0.121-0.364-0.365-0.607-0.49-0.365-0.244-0.734-0.487-0.978-0.733-0.119-0.119-0.364-0.244-0.487-0.365l-1.097-0.733c-0.119-0.119-0.364-0.244-0.487-0.364-0.365-0.244-0.734-0.369-1.097-0.614-0.244-0.119-0.369-0.244-0.613-0.364-0.365-0.126-0.734-0.369-0.972-0.487l-0.734-0.369c-0.369-0.121-0.613-0.245-0.977-0.365-0.244-0.126-0.614-0.244-0.859-0.369-0.244-0.119-0.607-0.238-0.851-0.364-0.365-0.119-0.609-0.244-0.978-0.364-0.244-0.126-0.487-0.126-0.733-0.245l-1.097-0.369c-0.244-0.119-0.487-0.119-0.609-0.244-0.369-0.119-0.733-0.244-1.22-0.364-0.245 0-0.371-0.126-0.614-0.126-0.364-0.119-0.851-0.244-1.216-0.244-0.244 0-0.487-0.121-0.613-0.121-0.364-0.126-0.852-0.126-1.222-0.244-0.244 0-0.482-0.126-0.725-0.126-0.369 0-0.734-0.119-1.104-0.119-0.364 0-0.607 0-0.978-0.126-0.244 0-0.607 0-0.851-0.119h-242.407c-21.604 0-39.062 17.456-39.062 39.062 0 21.604 17.458 39.055 39.062 39.055h146.102l-3.171 3.177-217.27 217.265 0.369 0.369-49.676 49.676-155.87-155.87c-7.694-7.689-17.827-11.472-27.953-11.472-10.13-0.126-20.263 3.659-27.952 11.472l-282.446 282.322c-15.258 15.258-15.258 40.041 0 55.298 15.258 15.258 40.033 15.258 55.291 0l255.108-255.11 155.746 155.751c7.813 7.815 17.945 11.593 28.076 11.474 10.126 0.119 20.382-3.659 28.070-11.474l182.964-182.969c0.734-0.734 1.347-1.342 1.956-2.075l111.564-111.564v146.109c0 21.604 17.451 39.060 39.055 39.060s39.062-17.456 39.062-39.060v-235.085c0-0.244 0.126-0.49 0.126-0.614 0-0.244 0.119-0.487 0.119-0.733 0-0.364 0.119-0.734 0.119-1.097s0-0.607 0.126-0.977c0-0.245 0-0.609 0.119-0.852-0.122-1.466-0.122-2.807-0.122-4.030v0zM963.66 256.607z"></path>
|
|
23
|
+
|
|
24
|
+
`},"icon-lianjie_connecting5":{data:`
|
|
25
|
+
<path d="M801.25952 251.74016l-28.9792-28.99968-150.79424 150.8352-35.1232-35.10272-99.14368 99.16416 99.14368 99.16416 99.16416-99.16416-35.10272-35.1232zM487.19872 476.8768l-29.94176 29.94176-19.61984-19.61984-99.16416 99.16416 35.10272 35.1232-150.8352 150.79424 28.95872 28.95872 150.8352-150.79424 35.10272 35.10272 99.14368-99.14368-19.61984-19.64032 29.96224-29.96224-59.92448-59.92448z m-15.48288 44.4416l15.4624-15.4624 30.98624 30.98624-15.4624 15.44192-30.98624-30.96576z"
|
|
26
|
+
fill=""></path>
|
|
27
|
+
`},"icon-ico_reset":{data:`
|
|
28
|
+
<path d="M925.97087933 277.33133334a479.997 479.997 0 1 0 54.33566 255.9984H916.05094133a415.9974 415.9974 0 1 1-64.191599-255.9984h74.047537z"></path>
|
|
29
|
+
<path d="M978.64255033 61.01268534L725.33213333 371.09074734h297.59814z"></path>
|
|
30
|
+
`},"icon-lianjieliu":{data:`
|
|
31
|
+
<path d="M280.224 425.856h348.608a29.536 29.536 0 1 0 0-59.072H280.224c-52.448 0-93.152-34.304-93.152-73.856s40.704-73.856 93.152-73.856h140.128C432.096 258.816 468.448 288 512 288s79.904-29.184 91.648-68.928h178.08a29.536 29.536 0 1 0 0-59.072h-179.584C588.896 122.784 553.728 96 512 96s-76.896 26.784-90.112 64H280.224C197.184 160 128 218.272 128 292.928s69.184 132.928 152.224 132.928z"></path>
|
|
32
|
+
<path d="M895.936 415.2A96 96 0 1 0 800 512c30.656 0 57.632-14.624 75.2-36.992 10.56 12.064 16.832 26.56 16.832 41.92 0 39.552-40.704 73.856-93.152 73.856H306.016A95.584 95.584 0 0 0 224 544a95.68 95.68 0 0 0-95.232 88.352C89.888 656.224 64 695.424 64 740.928c0 74.656 69.184 132.928 152.224 132.928h241.728A95.808 95.808 0 0 0 544 928a96 96 0 1 0 0-192 95.904 95.904 0 0 0-94.272 78.752H216.224c-52.448 0-93.152-34.304-93.152-73.856 0-17.504 8.32-33.792 21.76-46.72A95.808 95.808 0 0 0 224 736a95.68 95.68 0 0 0 95.008-86.144h479.84c83.072 0 152.224-58.272 152.224-132.928 0.032-41.536-21.824-77.568-55.136-101.728z"></path>
|
|
33
|
+
|
|
34
|
+
`},"icon-resize-":{data:`
|
|
35
|
+
<path d="M410.816 673.514667L230.997333 853.333333H384v85.333334H85.333333V640h85.333334v153.002667l179.818666-179.84 60.330667 60.373333z m-53.632-256L170.666667 230.997333V384H85.333333V85.333333h298.666667v85.333334h-153.002667l186.517334 186.517333-60.330667 60.330667z m234.666667-45.696L793.002667 170.666667H640V85.333333h298.666667v298.666667h-85.333334v-153.002667l-201.152 201.173334-60.330666-60.373334z m67.029333 226.709333L853.333333 793.002667V640h85.333334v298.666667H640v-85.333334h153.002667l-194.474667-194.453333 60.352-60.352z"></path>
|
|
36
|
+
|
|
37
|
+
`},"icon-tupian":{data:`
|
|
38
|
+
<path d="M938.666667 553.92V768c0 64.8-52.533333 117.333333-117.333334 117.333333H202.666667c-64.8 0-117.333333-52.533333-117.333334-117.333333V256c0-64.8 52.533333-117.333333 117.333334-117.333333h618.666666c64.8 0 117.333333 52.533333 117.333334 117.333333v297.92z m-64-74.624V256a53.333333 53.333333 0 0 0-53.333334-53.333333H202.666667a53.333333 53.333333 0 0 0-53.333334 53.333333v344.48A290.090667 290.090667 0 0 1 192 597.333333a286.88 286.88 0 0 1 183.296 65.845334C427.029333 528.384 556.906667 437.333333 704 437.333333c65.706667 0 126.997333 16.778667 170.666667 41.962667z m0 82.24c-5.333333-8.32-21.130667-21.653333-43.648-32.917333C796.768 511.488 753.045333 501.333333 704 501.333333c-121.770667 0-229.130667 76.266667-270.432 188.693334-2.730667 7.445333-7.402667 20.32-13.994667 38.581333-7.68 21.301333-34.453333 28.106667-51.370666 13.056-16.437333-14.634667-28.554667-25.066667-36.138667-31.146667A222.890667 222.890667 0 0 0 192 661.333333c-14.464 0-28.725333 1.365333-42.666667 4.053334V768a53.333333 53.333333 0 0 0 53.333334 53.333333h618.666666a53.333333 53.333333 0 0 0 53.333334-53.333333V561.525333zM320 480a96 96 0 1 1 0-192 96 96 0 0 1 0 192z m0-64a32 32 0 1 0 0-64 32 32 0 0 0 0 64z"></path>
|
|
39
|
+
|
|
40
|
+
`},"icon-ziyuan":{data:`
|
|
41
|
+
<path d="M236.615854 752.86913h-0.484162A241.500139 241.500139 0 0 1 0.538332 527.733676a238.78883 238.78883 0 0 1 64.684079-180.011531 242.081134 242.081134 0 0 1 149.025146-74.367324 298.534454 298.534454 0 0 1 596.003751 25.951097V300.95207a221.262156 221.262156 0 0 1 213.031398 233.075715 222.714643 222.714643 0 0 1-221.262156 209.1581h-3.098639a27.500417 27.500417 0 0 1 0-54.904001h2.711309A167.520145 167.520145 0 0 0 968.378705 531.219644a166.261323 166.261323 0 0 0-166.16449-175.363573 151.058627 151.058627 0 0 0-18.204502 1.065157 27.500417 27.500417 0 0 1-30.211725-30.308558 240.822312 240.822312 0 0 0 1.549319-27.306752 243.727285 243.727285 0 0 0-487.357738 0 27.500417 27.500417 0 0 1-27.403584 27.500417 185.627813 185.627813 0 0 0-185.240484 197.538205A186.30564 186.30564 0 0 0 237.100016 697.965129a27.500417 27.500417 0 0 1-0.484162 54.904001z"></path>
|
|
42
|
+
<path d="M513.266174 1021.869686a27.500417 27.500417 0 0 1-27.500417-27.403584v-484.162268a27.500417 27.500417 0 1 1 54.904001 0v484.162268a27.403584 27.403584 0 0 1-27.403584 27.403584z"></path>
|
|
43
|
+
<path d="M513.266174 1024a27.500417 27.500417 0 0 1-19.366491-8.037094L342.260061 864.129619a27.500417 27.500417 0 1 1 38.732981-38.732981L513.266174 957.766602l130.530147-130.336483a27.500417 27.500417 0 0 1 38.732981 38.732982L532.632664 1015.962906a27.403584 27.403584 0 0 1-19.36649 8.037094z"></path>
|
|
44
|
+
|
|
45
|
+
`},"icon-lianjiezhong":{data:`
|
|
46
|
+
<path d="M883.396923 298.141538a99.721846 99.721846 0 0 1-142.414769 0 103.187692 103.187692 0 0 1 0-144.423384 99.721846 99.721846 0 0 1 142.414769 0 103.187692 103.187692 0 0 1 0 144.423384zM285.144615 760.438154a87.276308 87.276308 0 0 0-124.652307 0 90.269538 90.269538 0 0 0 0 126.385231c34.422154 34.894769 90.230154 34.894769 124.652307 0a90.269538 90.269538 0 0 0 0-126.424616z m482.579693 108.307692a64.472615 64.472615 0 0 1 0-90.269538 62.345846 62.345846 0 0 1 89.00923 0c24.576 24.930462 24.576 65.378462 0 90.269538a62.345846 62.345846 0 0 1-89.00923 0zM294.006154 298.141538a103.187692 103.187692 0 0 0 0-144.423384 99.721846 99.721846 0 0 0-142.454154 0 103.187692 103.187692 0 0 0 0 144.423384 99.721846 99.721846 0 0 0 142.454154 0z m324.214154-196.01723c0 56.438154-45.095385 102.163692-100.745846 102.163692-55.611077 0-100.706462-45.725538-100.706462-102.163692C416.768 45.725538 461.863385 0 517.474462 0c55.650462 0 100.745846 45.725538 100.745846 102.124308zM517.474462 870.793846c-41.747692 0-75.539692 34.264615-75.539693 76.603077 0 42.299077 33.831385 76.603077 75.539693 76.603077 41.747692 0 75.539692-34.264615 75.539692-76.603077 0-42.299077-33.792-76.603077-75.539692-76.603077z m416.768-294.990769c-27.805538 0-50.333538-22.843077-50.333539-51.042462 0-28.199385 22.528-51.042462 50.333539-51.042461 27.844923 0 50.412308 22.843077 50.372923 51.042461 0 28.199385-22.567385 51.081846-50.372923 51.081847zM201.452308 524.8c0-56.398769-45.095385-102.124308-100.745846-102.124308C45.095385 422.596923 0 468.283077 0 524.760615c0 56.398769 45.095385 102.124308 100.706462 102.124308 55.650462 0 100.745846-45.686154 100.745846-102.124308z"></path>
|
|
47
|
+
|
|
48
|
+
`}},Q=({iconName:i,className:a})=>{const t=Ie[i];return C.jsx("svg",{className:`rg-icon ${a}`,viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",dangerouslySetInnerHTML:{__html:t.data}})},Ae=()=>{const i=k.useContext(H),a=i&&i.options,t=e=>{i.clearLoading()};return C.jsx(C.Fragment,{children:a&&C.jsx("div",{className:`rg-graph-loading ${a.graphLoading?"":"rg-graph-loading-hide"}`,onClick:e=>{t()},children:C.jsxs("div",{className:"rg-graph-loading-message",children:[C.jsx(Q,{iconName:"icon-lianjiezhong",className:"rg-graph-loading-icon"}),"Loading..."]})})})},re=({nodeSlot:i})=>{const a=k.useContext(H),t=a&&a.options;return t&&C.jsxs("div",{className:"rg-operate",children:[C.jsxs("div",{className:"rg-creating-container",children:[t.creatingNodePlot&&t.showTemplateNode&&C.jsx(ne,{nodeProps:t.newNodeTemplate,nodeSlot:i}),t.creatingSelection&&C.jsx("div",{className:"rg-selection",style:{transform:`translate(${t.selectionView.x}px, ${t.selectionView.y}px)`,width:t.selectionView.width+"px",height:t.selectionView.height+"px"}})]}),C.jsx(Pe,{}),C.jsx(Ae,{})]})},le=({direction:i="h",positionH:a="left",positionV:t="bottom",children:e})=>{const n=k.useContext(H);k.useContext(q);const o=n&&n.options,s=()=>{n==null||n.toggleAutoLayout()},r=async()=>{n&&(n.setZoom(100),n.moveToCenter(),n.enableCanvasAnimation(),n.zoomToFit(),setTimeout(()=>{n.disableCanvasAnimation()},300))},l=async h=>{await(n==null?void 0:n.zoom(h))},c=async()=>{await(n==null?void 0:n.fullscreen())};return k.useEffect(()=>{},[]),C.jsxs("div",{className:`rg-toolbar rg-xs-toolbar rg-toolbar-h-${a||o.toolBarPositionH} rg-toolbar-v-${t||o.toolBarPositionV} rg-toolbar-${i||o.toolBarDirection}`,children:[C.jsx("div",{title:"Full Screen",className:"rg-mb-button",style:{marginTop:0},onClick:c,children:C.jsx(Q,{iconName:"icon-quanping"})}),C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"rg-mb-button",onClick:()=>l(20),children:C.jsx(Q,{iconName:"icon-fangda"})}),C.jsx("div",{className:"rg-current-zoom",onClick:r,children:`${Math.round(o.canvasZoom)}%`}),C.jsx("div",{className:"rg-mb-button",style:{marginTop:0},onClick:()=>l(-20),children:C.jsx(Q,{iconName:"icon-suoxiao"})})]}),o.layout.supportAutoLayout&&C.jsx("div",{title:o.layout.autoLayouting?"Stop Force Layout":"Start Force Layout",className:`rg-mb-button ${o.layout.autoLayouting?"rg-mb-button-on":""}`,onClick:s,children:o.layout.autoLayouting?C.jsx(Q,{iconName:"icon-lianjiezhong",className:"rg-loading-icon"}):C.jsx(Q,{iconName:"icon-zidong"})}),e]})},It=({children:i})=>C.jsx(C.Fragment,{}),Mt=({children:i})=>C.jsx(C.Fragment,{}),At=({children:i})=>C.jsx(C.Fragment,{}),Vt=({children:i})=>C.jsx(C.Fragment,{}),ce=i=>({onReady:i.onReady,onNodeClick:i.onNodeClick,onNodeExpand:i.onNodeExpand,onNodeCollapse:i.onNodeCollapse,onLineClick:i.onLineClick,onImageDownload:i.onImageDownload,onImageSaveAsFile:i.onImageSaveAsFile,onNodeDragStart:i.onNodeDragStart,onNodeDragEnd:i.onNodeDragEnd,onNodeDragging:i.onNodeDragging,onCanvasDragEnd:i.onCanvasDragEnd,onCanvasDragging:i.onCanvasDragging,onContextmenu:i.onContextmenu,onFullscreen:i.onFullscreen,onCanvasClick:i.onCanvasClick,onCanvasSelectionEnd:i.onCanvasSelectionEnd,beforeZoomStart:i.beforeZoomStart,onZoomEnd:i.onZoomEnd,onViewResize:i.onViewResize,onResizeStart:i.onResizeStart,beforeNodeResize:i.beforeNodeResize,onResizeEnd:i.onResizeEnd,onLineVertexDropped:i.onLineVertexDropped,beforeCreateLine:i.beforeCreateLine,onLineBeCreated:i.onLineBeCreated,beforeAddNodes:i.beforeAddNodes,beforeAddLines:i.beforeAddLines,onKeyboardDown:i.onKeyboardDown,onKeyboardUp:i.onKeyboardUp,onCanvasDragStart:i.onCanvasDragStart,onForceLayoutFinish:i.onForceLayoutFinish,beforeScrollStart:i.beforeScrollStart}),he=({children:i})=>C.jsx(C.Fragment,{}),Ut=i=>{const a=k.useContext(H);k.useContext(q);const t=k.useRef(),[e,n]=k.useState(!1);k.useEffect(()=>{te("React"),a.setOptions(i.options);const m=ce(i);v("[RelationGraph]mounted:listeners:",m),a.setListeners(m),v("[RelationGraph]setDom:",t.current),a.setDom(t.current),n(!0),a.ready(),a.dataUpdated(),i.initialData&&(v("[RelationGraph] apply data"),a.applyInitialData(i.initialData));const w=b=>{a.onMouseWheel(b)};return t.current.addEventListener("wheel",w,{passive:!1}),()=>{t.current.removeEventListener("wheel",w),a.beforeUnmount()}},[]);const o=a&&a.options;let s,r;const l=[],c=[],h=[],d=[],f=lt.default.Children.toArray(i.children).filter(m=>{if(m&<.default.isValidElement(m))if(m.type===we){const w=m.props.children;if(typeof w=="function")s=w;else throw new Error("RGSlotOnNode children must be a function, e.g. <RGSlotOnNode>{ (node: RGNode) => <div>{node.text}</div> }</RGSlotOnNode>")}else if(m.type===It){const w=m.props.children;if(typeof w=="function")r=w;else throw new Error('RGSlotOnLine children must be a function, e.g. <RGSlotOnLine>{ (line: RGLine) => <g><path d="..." /><text>{line.text}</text></g> }</RGSlotOnLine>')}else{if(m.type===Mt)return l.push(m.props.children),!1;if(m.type===At)return c.push(m.props.children),!1;if(m.type===Vt)return h.push(m.props.children),!1;if(m.type===he)return d.push(m.props.children),!1}return!0}),p=l,u=h,g=c.concat(...f);if(s&&i.nodeSlot)throw new Error("You can only provide nodeSlot or RGSlotOnNode, but not both.");if(r&&i.lineSlot)throw new Error("You can only provide lineSlot or RGSlotOnLine, but not both.");const x=s||i.nodeSlot,y=r||i.lineSlot,L=i.expandHolderSlot;return C.jsx("div",{ref:t,id:`relation-graph-ins-${o==null?void 0:o.instanceId}`,className:["relation-graph",(o==null?void 0:o.creatingLinePlot)&&"rg-creating-line",o&&!o.selectionMode&&!o.disableDragCanvas?"rg-move-mode":"",o!=null&&o.enableNodeXYAnimation?"rg-enable-node-xy-animation":"",(o==null?void 0:o.enableCanvasTransformAnimation)&&"rg-enable-canvas-animation"].filter(Boolean).join(" "),tabIndex:1,style:{width:"100%",height:o!=null&&o.viewHeight?o==null?void 0:o.viewHeight:"100%",opacity:e?1:0,"--rg-checked-line-bg-color":o==null?void 0:o.checkedItemBackgroundColor},children:e&&o&&C.jsxs(C.Fragment,{children:[o.showDebugPanel&&C.jsx(De,{}),o.showToolBar&&C.jsx(le,{}),C.jsx(Re,{nodeSlot:x,lineSlot:y,svgDefs:d,canvasPlugSlot:g,canvasPlugAboveSlot:u,expandHolderSlot:L}),C.jsx(re,{nodeSlot:x}),C.jsx("div",{className:"rg-graph-plugs",children:C.jsx("div",{className:"rg-graph-slot",children:p})})]})})},Ve=H.Provider,ze=gt.Provider,Be=q.Provider;var B=(i=>(i.Node="node",i.NodePoint="NodePoint",i.HTMLElementId="HTMLElementId",i.CanvasPoint="CanvasPoint",i.ViewPoint="ViewPoint",i))(B||{}),U=(i=>(i.border="border",i.ltrb="ltrb",i.tb="tb",i.lr="lr",i.left="left",i.right="right",i.top="top",i.bottom="bottom",i))(U||{}),zt=(i=>(i[i.circle=0]="circle",i[i.rect=1]="rect",i))(zt||{}),G=(i=>(i[i.StandardStraight=1]="StandardStraight",i[i.StandardCurve=6]="StandardCurve",i[i.Curve2=2]="Curve2",i[i.Curve3=3]="Curve3",i[i.Curve5=5]="Curve5",i[i.Curve7=7]="Curve7",i[i.Curve8=8]="Curve8",i[i.SimpleOrthogonal=4]="SimpleOrthogonal",i[i.StandardOrthogonal=44]="StandardOrthogonal",i[i.HardOrthogonal=49]="HardOrthogonal",i))(G||{}),de=(i=>(i.Left="left",i.Top="top",i.Right="right",i.Bottom="bottom",i))(de||{}),I=(i=>(i.onReady="onReady",i.onNodeClick="onNodeClick",i.onNodeExpand="onNodeExpand",i.onNodeCollapse="onNodeCollapse",i.onLineClick="onLineClick",i.onImageDownload="onImageDownload",i.onImageSaveAsFile="onImageSaveAsFile",i.onNodeDragStart="onNodeDragStart",i.onNodeDragEnd="onNodeDragEnd",i.onNodeDragging="onNodeDragging",i.onCanvasDragEnd="onCanvasDragEnd",i.onCanvasDragging="onCanvasDragging",i.onContextmenu="onContextmenu",i.onFullscreen="onFullscreen",i.onCanvasClick="onCanvasClick",i.onCanvasSelectionEnd="onCanvasSelectionEnd",i.beforeZoomStart="beforeZoomStart",i.onZoomEnd="onZoomEnd",i.onViewResize="onViewResize",i.onResizeStart="onResizeStart",i.beforeNodeResize="beforeNodeResize",i.onResizeEnd="onResizeEnd",i.onLineVertexDropped="onLineVertexDropped",i.beforeCreateLine="beforeCreateLine",i.onLineBeCreated="onLineBeCreated",i.beforeAddNodes="beforeAddNodes",i.beforeAddLines="beforeAddLines",i.onKeyboardDown="onKeyboardDown",i.onKeyboardUp="onKeyboardUp",i.onCanvasDragStart="onCanvasDragStart",i.onForceLayoutFinish="onForceLayoutFinish",i.beforeScrollStart="beforeScrollStart",i))(I||{});const Bt={id:"rg-newNodeTemplate",x:0,y:0,text:""},Ct=(i,a)=>{var e,n;if(i.id===void 0)throw console.log("node must has id:",i),new Error("node must has option[id]:");i.isShow!==void 0&&(i.hidden=!i.isShow,console.warn("[relation-graph Warning] line option[isShow] is deprecated, please use [hidden] instead.")),i.isHide!==void 0&&(i.hidden=i.isHide,console.warn("[relation-graph Warning] line option[isHide] is deprecated, please use [hidden] instead."));const t={id:i.id,text:i.text!==void 0?i.text:"",type:i.type!==void 0?i.type:"node",targetType:i.targetType!==void 0?i.targetType:B.Node,expanded:i.expanded!==void 0?i.expanded:!0,selected:i.selected!==void 0?i.selected:!1,dragging:!1,className:i.className!==void 0?i.className:"",nodeShape:i.nodeShape!==void 0?i.nodeShape:1,borderWidth:i.borderWidth!==void 0?i.borderWidth:void 0,borderRadius:i.borderRadius!==void 0?i.borderRadius:void 0,borderColor:i.borderColor!==void 0?i.borderColor:void 0,fontColor:i.fontColor!==void 0?i.fontColor:void 0,fontSize:i.fontSize!==void 0?i.fontSize:void 0,color:i.color!==void 0?i.color:void 0,opacity:i.opacity!==void 0?i.opacity:void 0,fixed:i.fixed!==void 0?i.fixed:!1,width:i.width!==void 0?i.width:void 0,height:i.height!==void 0?i.height:void 0,force_weight:i.force_weight,x:i.x!==void 0?i.x:0,y:i.y!==void 0?i.y:0,Fx:0,Fy:0,expandHolderPosition:i.expandHolderPosition!==void 0?i.expandHolderPosition:void 0,disablePointEvent:i.disablePointEvent!==void 0?i.disablePointEvent:void 0,disableDrag:i.disableDrag!==void 0?i.disableDrag:!1,hidden:i.hidden!==void 0?i.hidden:!1,rgCalcedVisible:!0,rgShouldRender:!0,zIndex:i.zIndex||0,data:i.data!==void 0?i.data:{}};return t.lot={childs:[],parent:void 0,eached:!1,strength:0},t.el={offsetWidth:((e=i.el)==null?void 0:e.offsetWidth)||50,offsetHeight:((n=i.el)==null?void 0:n.offsetHeight)||50},t.width&&(t.el.offsetWidth=t.width),t.height&&(t.el.offsetHeight=t.height),t},Xe=["Fx","Fy","appended","dragging","el","targetFrom","targetNodes","targetTo","lot","seeks_id","shouldRender","rgCalcedVisible","rgShouldRender","origin_x","origin_y","selected"],Lt=i=>{if(!i)return;const a={};return Object.keys(i).forEach(t=>{if(!Xe.includes(t)){const e=i[t];e!==void 0&&(t==="offset_x"&&e===0||t==="offset_y"&&e===0||t==="zIndex"&&e===0||t==="fixed"&&e===!1||t==="className"&&e===""||t==="hidden"&&e===!1||t==="disableDrag"&&e===!1||t==="expanded"&&e===!0||t==="opacity"&&e===1||t==="type"&&e==="node"||t==="targetType"&&e===B.Node||t==="data"&&(!e||Object.keys(e).length===0)||(a[t]=e))}}),a},Fe={json2Node:Ct,transNodeToJson:Lt},He=Object.freeze(Object.defineProperty({__proto__:null,newNodeTemplate:Bt,json2Node:Ct,transNodeToJson:Lt,default:Fe},Symbol.toStringTag,{value:"Module"}));let yt={x:0,y:0};const mt={x:0,y:0},nt={x:0,y:0};let Dt,kt;const Rt=i=>{const a={clientX:0,clientY:0};if(it(i)){const t=i.touches||i.targetTouches;if(!t)throw new Error("error targetTouches");a.clientX=t[0].clientX,a.clientY=t[0].clientY}else a.clientX=i.clientX,a.clientY=i.clientY;return a},W={startDrag(i,a,t,e){e?Dt=(n,o,s)=>{const r=n-nt.x,l=o-nt.y;e(r,l,mt,nt,s)}:Dt=(n,o)=>{yt.x=mt.x+(n-nt.x),yt.y=mt.y+(o-nt.y)},kt=t,yt=a,mt.x=yt.x,mt.y=yt.y;try{const n=Rt(i);nt.x=n.clientX,nt.y=n.clientY,it(i)?(document.body.addEventListener("touchmove",W.onNodeMove),document.body.addEventListener("touchend",W.onNodeDragend),document.body.addEventListener("mousemove",W.onNodeMove),document.body.addEventListener("mouseup",W.onNodeDragend),i.preventDefault()):(document.body.addEventListener("mousemove",W.onNodeMove),document.body.addEventListener("mouseup",W.onNodeDragend))}catch(n){console.error(n.message)}},onNodeMove(i){const a=Rt(i);Dt(a.clientX,a.clientY,i)},onNodeDragend(i){if(it(i)?(document.body.removeEventListener("touchmove",W.onNodeMove),document.body.removeEventListener("touchend",W.onNodeDragend),document.body.removeEventListener("mousemove",W.onNodeMove),document.body.removeEventListener("mouseup",W.onNodeDragend)):(document.body.removeEventListener("mousemove",W.onNodeMove),document.body.removeEventListener("mouseup",W.onNodeDragend)),kt){const a=Rt(i),t=a.clientX,e=a.clientY,n=t-nt.x,o=e-nt.y;kt(n,o,i)}}},ct=i=>{if(i.from===void 0)throw console.log("error,line must has option[from](nodeId):",i),new Error("error,line must has option[from]:");if(i.to===void 0)throw console.log("error,line must has option[to](nodeId):",i),new Error("error,line must has option[to]:");if(typeof i.from!="string")throw console.log("error line from, must be string(nodeId):",i),new TypeError("error line from, must be string:");if(typeof i.to!="string")throw console.log("error line to, must be string(nodeId):",i),new TypeError("error line to, must be string:");return i.isShow!==void 0&&(i.hidden=!i.isShow,console.warn("[relation-graph Warning] line option[isShow] is deprecated, please use [hidden] instead.")),i.isHide!==void 0&&(i.hidden=i.isHide,console.warn("[relation-graph Warning] line option[isHide] is deprecated, please use [hidden] instead.")),i.placeText!==void 0&&(i.onPathStartOffset=i.placeText,console.warn("[relation-graph Warning] line option[placeText] is deprecated, please use [onPathStartOffset] instead.")),{id:i.id,from:i.from,to:i.to,type:i.type!==void 0?i.type:"line",isFakeLine:i.isFakeLine!==void 0?i.isFakeLine:!1,fromType:i.fromType!==void 0?i.fromType:i.isFakeLine?B.CanvasPoint:B.Node,toType:i.toType!==void 0?i.toType:i.isFakeLine?B.CanvasPoint:B.Node,selected:!1,text:i.text!==void 0?i.text:"",textOffset_x:i.textOffset_x!==void 0?i.textOffset_x:void 0,textOffset_y:i.textOffset_y!==void 0?i.textOffset_y:void 0,color:i.color!==void 0?i.color:void 0,opacity:i.opacity!==void 0?i.opacity:void 0,fontSize:i.fontSize!==void 0?i.fontSize:void 0,fontColor:i.fontColor!==void 0?i.fontColor:void 0,lineWidth:i.lineWidth!==void 0?i.lineWidth:void 0,lineShape:i.lineShape!==void 0?i.lineShape:void 0,className:i.className!==void 0?i.className:void 0,animation:i.animation!==void 0?i.animation:0,dashType:i.dashType!==void 0?i.dashType:0,disablePointEvent:i.disablePointEvent!==void 0?i.disablePointEvent:!1,showStartArrow:i.showStartArrow!==void 0?i.showStartArrow:!1,showEndArrow:i.showEndArrow!==void 0?i.showEndArrow:!0,useTextPath:i.useTextPath!==void 0?i.useTextPath:void 0,onPathStartOffset:i.onPathStartOffset!==void 0?i.onPathStartOffset:void 0,startMarkerId:i.startMarkerId||"",endMarkerId:i.endMarkerId||"",textAnchor:i.textAnchor!==void 0?i.textAnchor:void 0,junctionOffset:i.junctionOffset,fromJunctionPoint:i.fromJunctionPoint,toJunctionPoint:i.toJunctionPoint,fromJuctionPointOffsetX:i.fromJuctionPointOffsetX||0,fromJuctionPointOffsetY:i.fromJuctionPointOffsetY||0,toJuctionPointOffsetX:i.toJuctionPointOffsetX||0,toJuctionPointOffsetY:i.toJuctionPointOffsetY||0,lineRadius:i.lineRadius,force_elastic:i.force_elastic,polyLineStartDistance:i.polyLineStartDistance,ctrlPointsFor49:i.ctrlPointsFor49,ctrlPointsFor44:i.ctrlPointsFor44,ctrlPoints:i.ctrlPoints,lineDirection:i.lineDirection!==void 0?i.lineDirection:void 0,reverseText:i.reverseText!==void 0?i.reverseText:void 0,forDisplayOnly:i.forDisplayOnly||i.from===i.to,hidden:i.hidden!==void 0?i.hidden:!1,cssVars:i.cssVars!==void 0?i.cssVars:void 0,data:i.data!==void 0?i.data:{}}},$e=["arrow","reverseText","isReverse","selected","shouldRender","rgCalcedVisible"],Xt=i=>{if(!i)return;const a={};return Object.keys(i).forEach(t=>{if(!$e.includes(t)){const e=i[t];e!==void 0&&(t==="isFakeLine"&&e===!1||t==="fromType"&&e===B.Node||t==="toType"&&e===B.Node||t==="animation"&&e===0||t==="dashType"&&e===0||t==="disablePointEvent"&&e===!1||t==="showStartArrow"&&e===!1||t==="showEndArrow"&&e===!0||t==="startMarkerId"&&e===""||t==="endMarkerId"&&e===""||t==="forDisplayOnly"&&e===!1||t==="fromJuctionPointOffsetX"&&e===0||t==="fromJuctionPointOffsetY"&&e===0||t==="toJuctionPointOffsetX"&&e===0||t==="toJuctionPointOffsetY"&&e===0||t==="opacity"&&e===1||t==="hidden"&&e===!1||t==="data"&&(!e||Object.keys(e).length===0)||(a[t]=i[t]))}}),a},wt=(i,a)=>{if(!i)return;const t=Xt(i.line);t&&a.push(t)},Ge={json2Line:ct,transLinkToJson:wt},je=Object.freeze(Object.defineProperty({__proto__:null,json2Line:ct,transLineToJson:Xt,transLinkToJson:wt,default:Ge},Symbol.toStringTag,{value:"Module"}));function Ye(i,a,t,e,n,o,s,r,l){const c=n-i,h=o-a,d=Math.sqrt(c*c+h*h);if(d===0)return{x:i,y:a};const f=l*h/d,p=-(l*c)/d,u=i+f,g=a+p,x=i-t/2,y=i+t/2,L=a-e/2,m=a+e/2;let w=[];if(c!==0){let N=(x-u)/c,O=g+N*h;O>=L&&O<=m&&w.push({x,y:O});let E=(y-u)/c,T=g+E*h;T>=L&&T<=m&&w.push({x:y,y:T})}if(h!==0){let N=(L-g)/h,O=u+N*c;O>=x&&O<=y&&w.push({x:O,y:L});let E=(m-g)/h,T=u+E*c;T>=x&&T<=y&&w.push({x:T,y:m})}if(w.length===0&&c===0&&h===0)return{x:u,y:g};let b=null,M=1/0;return w.forEach(N=>{const O=Math.sqrt((N.x-n)**2+(N.y-o)**2);O<M&&(M=O,b=N)}),b}const Z={getRectPoint(i,a,t,e,n,o,s,r,l=!1,c=1,h=0,d=14,f=!1){const p=i+n/2,u=a+o/2,g=t+s/2,x=e+r/2;if(c>1){const E=Math.min(d,n,o),T=-E/2,D=E/(c-1),R=l&&f||!l&&!f?T*-1-h*D:T+h*D,_=Ye(p,u,n,o,g,x,s,r,R);if(_)return _}const y=p<g?1:-1,L=u<x?1:-1;if(x===u)return{x:p+y*n/2,y:u};const m=Math.abs((g-p)/(x-u)),w=n/o;let b=0,M=0;m<w?(b=y*o/2*m,M=L*o/2):(b=y*n/2,M=L*n/2/m);const N=p+b,O=u+M;return{x:N,y:O}},getRectPointBasic(i,a,t,e,n,o,s,r){const l=i+n/2,c=a+o/2,h=t+s/2,d=e+r/2;let f=d===c?0:(h-l)/(d-c);f===0&&d===c&&h===l?f=1:f===0&&(f=(h-l)/(d-c+(d>c?-1:1)*1e-4));const p=n/o;let u=0,g=0,x="1";return Math.abs(f)<p?(x="2",c<=d?(g=o/2,u=g*f):(g=-o/2,u=g*f)):(x="3",l<=h?(u=n/2,g=f===0&&h===l?0:u/f):(u=-n/2,g=f===0&&h===l?0:u/f)),{x:l+u,y:c+g,_case:x}},getRectJoinPoint(i){const{from_x:a,from_y:t,to_x:e,to_y:n,f_W:o,f_H:s,t_W:r,t_H:l}=i,c=a+o/2,h=t+s/2,d=e+r/2,f=n+l/2,p=Math.atan2(f-h,d-c)*180/Math.PI,u=p<0?p+360:p;return u>45&&u<=135?{x:a+o+5,y:t+s/2}:u>135&&u<=225?{x:a+o/2,y:t+s+5}:u>225&&u<=315?{x:a-5,y:t+s/2}:{x:a+o/2,y:t-5}},getRectHJoinPoint(i){const{from_x:a,from_y:t,to_x:e,f_W:n,f_H:o,t_W:s}=i,r=o/2;return a+n<e?{x:a+n+5,y:t+r}:{x:a-5,y:t+r}},getRectLeftJoinPoint(i){const{from_x:a,from_y:t,f_H:e}=i;return{x:a,y:t+e/2}},getRectRightJoinPoint(i){const{from_x:a,from_y:t,f_W:e,f_H:n}=i;return{x:a+e,y:t+n/2}},getRectTopJoinPoint(i){const{from_x:a,from_y:t,f_W:e}=i;return{x:a+e/2,y:t}},getRectBottomJoinPoint(i){const{from_x:a,from_y:t,f_W:e,f_H:n}=i;return{x:a+e/2,y:t+n}},getRectHorizontalLineJoinPoint(i){const{from_x:a,from_y:t,f_W:e,f_H:n,to_x:o,t_W:s}=i;return{x:o+s/2,y:t+n/2}},getRectVJoinPoint(i){const{from_x:a,from_y:t,to_y:e,f_W:n,f_H:o,t_H:s}=i,r=n/2;return t+o<e?{y:t+o+5,x:a+r}:{y:t-5,x:a+r}},getBorderPoint(i,a,t,e,n,o,s,r,l){return l===0?this.getCirclePoint(i,a,t,e,n,o,s,r):this.getRectPoint(i,a,t,e,n,o,s,r)},getBorderPoint4MultiLine(i){const{from_x:a,from_y:t,to_x:e,to_y:n,f_W:o,f_H:s,t_W:r,t_H:l,nodeShape:c,isReverse:h=!1,isEndPoint:d,totalLinesBetweenNodes:f=1,currentLineIndex:p=0,lineDistance:u=50}=i;return c===0?this.getCirclePoint4MultiLine(a,t,e,n,o,s,r,l,h,f,p,u,d):this.getRectPoint(a,t,e,n,o,s,r,l,h,f,p,u,d)},getCirclePoint(i,a,t,e,n,o,s,r){const l=t+s/2,c=e+r/2,h=i+n/2,d=a+o/2,f=l-h;if(f===0)return{x:h,y:d-o/2*(c<d?1:-1)};const u=(c-d)/f,g=Math.sqrt(1/(1/(n/2)**2+u**2/(o/2)**2))*(l<h?1:-1),x=u*g;return{x:h-g,y:d-x}},getCirclePoint4MultiLine(i,a,t,e,n,o,s,r,l,c,h,d,f){let p=t+s/2;const u=e+r/2;let g=i+n/2;const x=a+o/2;let y=p-g;y>-1&&y<1&&(p=p-.5,g=g+.5,y=-1);let m=0;if(c>1){const R=Math.min(d,n,o),_=-R/2,z=R/(c-1);m=l&&f||!l&&!f?_*-1-h*z:_+h*z}const w=u-x,b=Math.sqrt(y**2+w**2)*m/y,M=w/y,N=n/2,O=o/2,E=g<p?-1:1,T=(-1*N**2*M*b+N*O*Math.sqrt(Math.abs(O**2+M**2*N**2-b**2))/E)/(O**2+N**2*M**2),D=M*T+b;return{x:g-T,y:x-D}},getCirclePointBasic(i,a,t,e,n,o,s,r,l){const c=i+n/2,h=a+o/2,d=t+s/2,f=e+r/2,p=d-c,u=f-h,g=Math.sqrt(p*p+u*u),x=g-l,y=x*p/g*-1,L=x*u/g*-1;return{x:d+y,y:f+L}},getCirclePointPlus(i,a,t,e,n,o,s,r){const l=i+n/2,c=a+o/2,h=t+s/2,d=e+r/2,f=h-l,p=d-c,u=Math.sqrt(f*f+p*p),g=(u-n/2)*f/u*-1,x=(u-o/2)*p/u*-1;return{x:h+g,y:d+x}},getOvalPoint(i,a,t,e,n,o=180){const s=e*(360/n),r=(180-o+s)*Math.PI/180;return{x:i+t*Math.sin(r),y:a+t*Math.cos(r)*-1}},getAngleType(i,a){if(i>=0&&a>=0)return 1;if(i<0&&a>=0)return 2;if(i<0&&a<0)return 3;if(i>=0&&a<0)return 4},getTextAngle(i,a,t,e){let n=Math.atan2(e-a,t-i)*180/Math.PI;return n<0&&(n+=360),n>90&&n<=270&&(n+=180),n>=360&&(n-=360),Math.round(n)}},dt=(i,a,t,e)=>{const n=i-t,o=a-e;return Math.sqrt(n**2+o**2)};class pt{constructor(a,t,e){S(this,"graphOptions");S(this,"layoutOptions");S(this,"graphInstance");S(this,"allNodes",[]);S(this,"isMainLayouer",!0);S(this,"requireLinks",!1);S(this,"allLinks",[]);S(this,"rootNode");this.layoutOptions=a,this.graphOptions=t,this.graphInstance=e}setLinks(a){v("setLinks:",a.length),this.allLinks=a}placeNodes(a,t){this.allNodes=a,this.rootNode=t}doLayout(a,t){this.placeNodes(a,t)}analysisNodes(a,t,e,n){t.length>n.max_length&&(n.max_length=t.length),e>n.max_deep&&(n.max_deep=e);const o={level:e,all_size:t.length,all_strength:0};e===0&&t.forEach(r=>{r.lot.parent=void 0});const s=[];for(const r of t){a.includes(r)||(r.lot.level=e,a.push(r));for(const l of this.graphInstance.getNodeRelatedNodes(r))a.includes(l)||(a.push(l),l.lot.parent=r,r.lot.childs.push(l),s.push(l))}o.all_strength>n.max_strength&&(n.max_strength=o.all_strength),s.length>0&&this.analysisNodes(a,s,e+1,n)}generateCalcNodes(a){const t=[],e=new Map;for(const n of a){const o={rgNode:n,x:n.x,y:n.y,width:n.el.offsetWidth,height:n.el.offsetHeight};t.push(o),e.set(n.id,o)}return{calcNodes:t,calcNodeMap:e}}generateLevels(a){const t=[],e=new Map;for(const n of a){if(!n.lot||typeof n.lot.level!="number")continue;const o=n.lot.level;t.includes(o)||(t.push(o),e.set(o,[])),e.get(o).push(n)}return t.sort((n,o)=>n-o),{levels:t,levelNodesMap:e}}adjustNodePositions(a,t,e){if(!a||a.length===0)return[];for(let n=1;n<a.length;n++){const o=a[n],s=a[n-1];switch(t){case"right":o.x<s.x+s.width+e&&(o.x=s.x+s.width+e);break;case"left":o.x+o.width>s.x-e&&(o.x=s.x-o.width-e);break;case"bottom":o.y<s.y+s.height+e&&(o.y=s.y+s.height+e);break;case"top":o.y+o.height>s.y-e&&(o.y=s.y-o.height-e);break}}return a}getReverseAlignItems(a){return We[a]}}const We={start:"end",end:"start",center:"center"};class ut extends pt{constructor(t,e,n){super(t,e,n);S(this,"layoutOptions");S(this,"fastStart",!1);S(this,"skipInitLayout",!1);S(this,"maxLayoutTimes",300);S(this,"byNode",!0);S(this,"byLine",!0);S(this,"lockX",!1);S(this,"lockY",!1);S(this,"force_node_repulsion",1);S(this,"force_line_elastic",1);S(this,"stopWhenBalanced",!1);S(this,"calcNodes",[]);S(this,"_graphEventHandler");S(this,"layoutTimes",0);S(this,"prev10",[]);S(this,"visibleNodes",[]);S(this,"_onFinishCallback");S(this,"_onTickCallback");S(this,"calcNodeMap",new WeakMap);S(this,"forCalcNodes",[]);S(this,"recentGraphVelocity",[]);S(this,"graphVelocityBalancedValue",.1);S(this,"animationFrameTimer",0);S(this,"prevNodeLevel1Index",0);S(this,"prevNodeLevel2Index",0);S(this,"maxVaildLineLength",300);S(this,"minVaildLineLength",30);S(this,"zeroEffectNodeDistance",400);S(this,"minNodeDistance",30);S(this,"maxMoveSpeed",100);S(this,"n2nMaxForce",50);this.layoutOptions=t,this.layoutOptions.fastStart!==void 0&&(this.fastStart=this.layoutOptions.fastStart),this.layoutOptions.maxLayoutTimes!==void 0&&(this.maxLayoutTimes=this.layoutOptions.maxLayoutTimes),this.layoutOptions.byNode!==void 0&&(this.byNode=this.layoutOptions.byNode),this.layoutOptions.byLine!==void 0&&(this.byLine=this.layoutOptions.byLine),this.layoutOptions.force_node_repulsion!==void 0&&(this.force_node_repulsion=this.layoutOptions.force_node_repulsion),this.layoutOptions.force_line_elastic!==void 0&&(this.force_line_elastic=this.layoutOptions.force_line_elastic),this.layoutOptions.force_x_coefficient===void 0&&(this.layoutOptions.force_x_coefficient=1),this.layoutOptions.force_y_coefficient===void 0&&(this.layoutOptions.force_y_coefficient=1),this.layoutOptions.disableLiveChanges===void 0&&(this.layoutOptions.disableLiveChanges=!1),this.layoutOptions.stopWhenBalanced&&(this.stopWhenBalanced=!0),this.layoutOptions.skipInitLayout!==void 0&&(this.skipInitLayout=this.layoutOptions.skipInitLayout),this.requireLinks=!0}placeNodes(t,e){if(v("!!!RGForceLayouter.placeNodes"),this.calcNodes=t,this.allNodes.length===0&&(this.allNodes=t),this.rootNode=e,this.fastStart)v("!!!initNodesPosition fastStart"),this.calcNodes.forEach(n=>{n.fixed!==!0&&((!n.lot||!n.lot.placed)&&((Number.isNaN(n.x)||n.x===void 0)&&(n.x=Math.floor(Math.random()*200)-100),(Number.isNaN(n.y)||n.y===void 0)&&(n.y=Math.floor(Math.random()*200)-100),n!==e&&n.x===0&&n.y===0&&(n.x=Math.floor(Math.random()*200)-100,n.y=Math.floor(Math.random()*200)-100)),n.lot.placed=!0)});else if(!this.skipInitLayout){if(v("!!!initNodesPosition....."),e){v("layout by root:",e),(Number.isNaN(e.x)||e.x===void 0)&&(e.x=0,e.y=0);const n=this.easyAnalysisNodes(e);e.fixed||this.layoutOptions.fixedRootNode||(e.x=0,e.y=0);const o=this.layoutOptions.centerOffset_x||0,s=this.layoutOptions.centerOffset_y||0,r=A.getNodeLotXY({alignItemsX:"center",alignItemsY:"center"},e);e.lot.x=r.x+o,e.lot.y=r.y+s,this.easyPlaceRelativePosition(e,n),v("!!!initNodesPosition fixedRootNode:2:",e.x,e.y),n.forEach(l=>{l.fixed!==!0&&(!l.rgCalcedVisible||l!==e&&(l.x=l.lot.x-A.getNodeWidth(l)/2,l.y=l.lot.y-A.getNodeHeight(l)/2,l.lot.placed=!0))})}}if(this.allNodes.forEach(n=>{(Number.isNaN(n.x)||n.x===void 0)&&(n.x=0),(Number.isNaN(n.y)||n.y===void 0)&&(n.y=0)}),v("Start Auto Layout....."),this.updateVisibleNodes(),this.isMainLayouer&&this.layoutOptions.autoLayouting){v("!!!autoLayouting.....");return}this.start()}easyAnalysisNodes(t){this.allNodes.forEach(o=>{o.lot.eached=!1,o.lot.notLeafNode=!1,o.lot.childs=[],o.lot.parent=void 0,o.lot.index_of_parent=0,o.lot.strength=0,o.lot.placed=!1});const e=[],n={max_deep:1,max_length:1,max_strength:1};return this.analysisNodes4Didirectional(e,[t],0,n,0),e}easyPlaceRelativePosition(t,e){e.forEach(o=>{if(o.lot.subling.level===1){const s=o.lot.subling;if(s){const r=Z.getOvalPoint(t.lot.x,t.lot.y,s.level*50,o.lot.strength_plus-o.lot.strength/2,s.all_strength,this.layoutOptions.startAngle);o.lot.x=r.x,o.lot.y=r.y}}}),e.forEach(o=>{const s=o.lot.subling;if(s&&s.level>1){const r=o.lot.parent.lot.strength_plus-o.lot.parent.lot.strength,c=(o.lot.parent.lot.strength_plus-r)/(o.lot.parent.lot.childs.length+1)*(o.lot.index_of_parent+1),h=Z.getOvalPoint(t.lot.x,t.lot.y,(s.level-1)*(100+(s.level-1)*60)+50,r+c,o.lot.parent.lot.subling.all_strength,this.layoutOptions.startAngle);o.lot.x=h.x,o.lot.y=h.y}})}graphEventHandle(t,...e){if(t===I.onNodeDragStart){const n=e[0],o=this.calcNodeMap.get(n);o&&(o.dragging=!0)}else if(t===I.onNodeDragging){const n=e[0],o=e[1],s=e[2],r=this.calcNodeMap.get(n);r&&(r.x=o,r.y=s)}else if(t===I.onNodeDragEnd){const n=e[0],o=this.calcNodeMap.get(n);o&&(o.dragging=!1)}}connectToGraphInstance(){this._graphEventHandler=this.graphEventHandle.bind(this),this.graphInstance.addEventHandler(this._graphEventHandler)}disConnectToGraphInstance(){this.graphInstance.removeEventHandler(this._graphEventHandler)}updateVisibleNodes(t){this.visibleNodes=[],t&&(this.allNodes=t),this.allNodes.forEach(e=>{e.lot?e.lot.placed=!0:(v("node miss lot:",e.text),e.lot={x:e.x,y:e.y,placed:!0,childs:[]}),this.visibleNodes.push(e)}),this.resetCalcNodes(),v("visibleNodes:",this.visibleNodes.length)}viewUpdate(){this.graphInstance&&this.graphInstance.dataUpdated()}autoLayout(t=!1){this.layoutTimes=0,this.updateVisibleNodes(),v("Layout set viewUpdate:",this.viewUpdate),this.isMainLayouer&&(this.layoutOptions.autoLayouting=!0),this.doForceLayout(0)}onFinish(t){this._onFinishCallback=t}onTick(t){this._onTickCallback=t}applyFBuffToNodes(){for(const t of this.forCalcNodes)this.applyToNodePosition(t)}applyPositionToNodes(){this.visibleNodes.forEach(t=>{if(t.fixed)return;const e=this.calcNodeMap.get(t);e&&(t.x=e.x,t.y=e.y)}),this.viewUpdate()}layoutFinished(){cancelAnimationFrame(this.animationFrameTimer),this.isMainLayouer&&(this.layoutOptions.autoLayouting=!1),v("Layout finished"),this.applyFBuffToNodes(),this.applyPositionToNodes(),this.disConnectToGraphInstance();try{this._onFinishCallback&&this._onFinishCallback()}catch(t){console.error(t)}}resetCalcNodes(){v("resetCalcNodes:",this.visibleNodes.length),this.forCalcNodes=[],this.calcNodeMap=new WeakMap,this.visibleNodes.forEach(t=>{const e={rgNode:t,Fx:0,Fy:0,x:t.x,y:t.y,dragging:t.dragging||!1,force_weight:t.force_weight||1,forceCenterOffset_X:(t.width||t.el.offsetWidth||60)/2,forceCenterOffset_Y:(t.height||t.el.offsetHeight||60)/2,fixed:t.fixed||!1};this.forCalcNodes.push(e),this.calcNodeMap.set(t,e)})}start(){if(this.layoutOptions.autoLayouting){v("stop layout:already autoLayouting");return}this.connectToGraphInstance(),this.autoLayout(!0)}doForceLayout(t){if(this.graphOptions.instanceDestroyed){v("stop layout:instanceDestroyed"),this.layoutFinished();return}let e="0";t>0?(this.prev10.length>=10&&(this.prev10.splice(0,1),e=(1e3/((this.prev10[this.prev10.length-1]-this.prev10[0])/10)).toFixed(1)),this.prev10.push(t)):this.visibleNodes.length===0&&this.updateVisibleNodes(),this.layoutTimes++,this.calcNodesPosition(),this.applyFBuffToNodes(),this._onTickCallback&&this._onTickCallback(),this.layoutOptions.disableLiveChanges||this.layoutTimes%2===0&&this.applyPositionToNodes(),v("this.layoutTimes:",this.layoutTimes,"of",this.maxLayoutTimes,"Current refresh rate:",e,"Hz",this.visibleNodes.length),this.layoutTimes<=this.maxLayoutTimes?this.animationFrameTimer=requestAnimationFrame(this.doForceLayout.bind(this)):this.layoutFinished()}calcNodesPosition(){if(this.byNode)for(let t=this.prevNodeLevel1Index;t<this.forCalcNodes.length;t++){const e=this.forCalcNodes[t];if(!e.dragging&&!e.fixed){for(let n=this.prevNodeLevel2Index;n<this.forCalcNodes.length;n++)if(t!==n){const o=this.forCalcNodes[n];if(o.dragging)continue;this.addGravityByNode(e,o)}}}if(this.byLine){if(this.allLinks&&this.allLinks.length>0){for(const t of this.allLinks)if(!t.forDisplayOnly){let e=t.line.force_elastic===void 0?1:t.line.force_elastic;if(this.visibleNodes.includes(t.fromNode)&&this.visibleNodes.includes(t.toNode)){const n=this.calcNodeMap.get(t.fromNode),o=this.calcNodeMap.get(t.toNode);this.addElasticByLine(n,o,e)}}}else for(const t of this.visibleNodes)if(t.lot&&t.lot.parent){const e=this.calcNodeMap.get(t.lot.parent),n=this.calcNodeMap.get(t);this.addElasticByLine(e,n,1)}}return!0}stop(){v("[RGForceLayouter]stop:",this.layoutOptions.autoLayouting),this.layoutTimes=Number.MAX_VALUE,this.layoutFinished()}addElasticByLine(t,e,n=1){const o=t.x,s=t.y,r=e.x,l=e.y;let c=Math.sqrt((s-l)**2+(o-r)**2);if(c<this.minVaildLineLength)return;c>this.maxVaildLineLength&&(c=this.maxVaildLineLength);const h=(c-this.minVaildLineLength)*.05*this.force_line_elastic*n,d=h,f=h,p=(o-r)/c,u=(s-l)/c;this.addFtoNode(t,p*d*-1,u*d*-1),this.addFtoNode(e,p*f,u*f)}addGravityByNode(t,e,n=1){const o=t.x,s=t.y,r=e.x,l=e.y;if(n===1&&(Math.abs(o-r)>this.zeroEffectNodeDistance||Math.abs(s-l)>this.zeroEffectNodeDistance))return;const c=Math.sqrt((s-l)**2+(o-r)**2);if(n===1&&c>this.zeroEffectNodeDistance)return;let h=(this.zeroEffectNodeDistance-c)*.05*this.force_node_repulsion*n;c<this.minNodeDistance&&(h=h*2);const d=(o-r)/c,f=(s-l)/c;this.addFtoNode(t,d*h,f*h)}addFtoNode(t,e,n){if(t.fixed||t.dragging||Number.isNaN(e)||Number.isNaN(n))return;e>this.n2nMaxForce&&(e=this.n2nMaxForce),n>this.n2nMaxForce&&(n=this.n2nMaxForce),e<-this.n2nMaxForce&&(e=-this.n2nMaxForce),n<-this.n2nMaxForce&&(n=-this.n2nMaxForce);const o=t.force_weight||1;this.lockX||(t.Fx+=e*(1/o)),this.lockY||(t.Fy+=n*(1/o))}applyToNodePosition(t){if(t.fixed)return 0;if(t.dragging){const o=t.rgNode;return o.x=t.x,o.y=t.y,0}if(this.calcNodes!==this.allNodes&&!this.calcNodes.includes(t.rgNode))return 0;let e=t.Fx,n=t.Fy;if(e>this.maxMoveSpeed&&(e=this.maxMoveSpeed),n>this.maxMoveSpeed&&(n=this.maxMoveSpeed),e<-this.maxMoveSpeed&&(e=-this.maxMoveSpeed),n<-this.maxMoveSpeed&&(n=-this.maxMoveSpeed),t.x=t.x+e*this.layoutOptions.force_x_coefficient,t.y=t.y+n*this.layoutOptions.force_y_coefficient,!this.layoutOptions.disableLiveChanges){const o=t.rgNode;o.x=t.x,o.y=t.y}t.Fx=0,t.Fy=0}analysisNodes4Didirectional(t,e,n,o,s){e.length>o.max_length&&(o.max_length=e.length),n>o.max_deep&&(o.max_deep=n);const r={level:n,all_size:e.length,all_strength:0},l=[];e.forEach(h=>{h.lot||(h.lot={childs:[]}),h.lot.eached=!0,h.lot.subling=r,h.lot.level=n,t.push(h)});let c=0;e.forEach(h=>{let d=0;if(s===0){let f=0;this.graphInstance.getNodeRelatedNodes(h).forEach(p=>{p.lot||(p.lot={eached:!1,childs:[]}),p.lot.eached||(p.rgCalcedVisible?(p.lot.eached=!0,p.lot.parent=h,p.lot.index_of_parent=f++,h.lot.childs.push(p),l.push(p),d++):h.lot.childs.push(p))})}else if(s===-1){let f=0;this.graphInstance.getNodeRelatedNodes4From(h).forEach(p=>{p.lot||(p.lot={eached:!1,childs:[]}),p.lot.eached||(p.rgCalcedVisible?(p.lot.eached=!0,p.lot.parent=h,p.lot.index_of_parent=f++,h.lot.childs.push(p),l.push(p),d++):h.lot.childs.push(p))})}else{let f=0;this.graphInstance.getNodeRelatedNodes4To(h).forEach(p=>{p.lot||(p.lot={eached:!1,childs:[]}),p.lot.eached||(p.rgCalcedVisible?(p.lot.eached=!0,p.lot.parent=h,p.lot.index_of_parent=f++,h.lot.childs.push(p),l.push(p),d++):h.lot.childs.push(p))})}h.lot.strength=d>0?d:1,r.all_strength+=h.lot.strength,h.lot.strength_plus=r.all_strength,h.lot.index_of_level=c,h.lot.childs_size=d,c++}),r.all_strength>o.max_strength&&(o.max_strength=r.all_strength),l.length>0?this.analysisNodes4Didirectional(t,l,n+(s===-1?-1:1),o,s):(t.forEach(h=>{h.lot.childs_size>0&&(h.lot.strengthWithChilds=0)}),t.forEach(h=>{h.lot.childs_size===0&&(h.lot.strengthWithChilds=1,A.conductStrengthToParents(h))}),A.analysisDataTree([t[0]],0,s))}}class fe extends pt{constructor(t,e,n){super(t,e,n);S(this,"enableGatherNodes",!1);S(this,"layoutOptions");this.layoutOptions=t,v("new RGTreeLayouter:",this.layoutOptions),this.layoutOptions.from||(this.layoutOptions.from="left"),this.layoutOptions.levelGaps||(this.layoutOptions.levelGaps=[]);const o=this.layoutOptions.from;console.log("this.layoutOptions.alignItemsX:1:",this.layoutOptions.alignItemsX),o==="top"||o==="bottom"?(this.layoutOptions.treeNodeGapH||(this.layoutOptions.treeNodeGapH=10),this.layoutOptions.treeNodeGapV||(this.layoutOptions.treeNodeGapV=50)):(this.layoutOptions.treeNodeGapH||(this.layoutOptions.treeNodeGapH=50),this.layoutOptions.treeNodeGapV||(this.layoutOptions.treeNodeGapV=10)),o==="top"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="center"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="start"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.layoutOptions.alignItemsX),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.getReverseAlignItems(this.layoutOptions.alignItemsY))):o==="bottom"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="center"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="end"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.layoutOptions.alignItemsX),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.getReverseAlignItems(this.layoutOptions.alignItemsY))):o==="right"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="end"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="center"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.getReverseAlignItems(this.layoutOptions.alignItemsX)),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.layoutOptions.alignItemsY)):(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="end"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="center"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.getReverseAlignItems(this.layoutOptions.alignItemsX)),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.layoutOptions.alignItemsY)),console.log("this.layoutOptions.alignItemsX:2:",this.layoutOptions.alignItemsX),this.layoutOptions.ignoreNodeSize===void 0&&(this.layoutOptions.ignoreNodeSize=!1);const s=this.layoutOptions.layoutExpansionDirection,r=s==="start"||s==="left"||s==="top"?"start":s==="end"||s==="right"||s==="bottom"?"end":"center";this.layoutOptions.layoutExpansionDirection=r,this.layoutOptions.levelDistance&&console.error("Error: levelDistance is not support\uFF0C Please use levelGaps or treeNodeGapH,treeNodeGapV option in layoutOptions"),this.enableGatherNodes=this.layoutOptions.enableGatherNodes}analysisNodes4Didirectional(t,e,n,o,s){v(`${s} level ${n} size: ${e.length}`),e.length>o.max_length&&(o.max_length=e.length),n>o.max_deep&&(o.max_deep=n);const r={level:n,all_size:e.length,all_strength:0},l=[];e.forEach(h=>{h.lot||(h.lot={childs:[]}),h.lot.eached=!0,h.lot.subling=r,h.lot.level=n,t.push(h)});let c=0;e.forEach(h=>{let d=0,f;n===0?s===-1?f=this.graphInstance.getNodeRelatedNodes4From(h):s===1?f=this.graphInstance.getNodeRelatedNodes4To(h):f=this.graphInstance.getNodeRelatedNodes(h):f=this.graphInstance.getNodeRelatedNodes(h);let p=0;f.forEach(u=>{u.lot||(u.lot={eached:!1,childs:[]}),u.lot.eached||(u.lot.parent=h,A.isVisibleNode(u)?(u.lot.eached=!0,u.lot.index_of_parent=p++,h.lot.childs.push(u),l.push(u),d++):h.lot.childs.push(u))}),h.lot.strength=d>0?d:1,r.all_strength+=h.lot.strength,h.lot.strength_plus=r.all_strength,h.lot.index_of_level=c,h.lot.childs_size=d,c++}),r.all_strength>o.max_strength&&(o.max_strength=r.all_strength),l.length>0?this.analysisNodes4Didirectional(t,l,n+(s===-1?-1:1),o,s):(t.forEach(h=>{h.lot.childs_size>0&&(h.lot.strengthWithChilds=0)}),t.forEach(h=>{h.lot.childs_size===0&&(h.lot.strengthWithChilds=1,A.conductStrengthToParents(h))}),A.analysisDataTree([t[0]],0,s===-1?-1:1))}placeNodes(t,e){if(console.log("tree:placeNodes:rootNode",e.id,e),v("RGTreeLayouter:placeNodes"),e)v("layout by root:",e);else{console.error("root is null");return}v("allNodes:",t.length);const n={alignItemsX:this.layoutOptions.alignItemsX,alignItemsY:this.layoutOptions.alignItemsY},o={alignItemsX:this.layoutOptions.alignParentItemsX,alignItemsY:this.layoutOptions.alignParentItemsY};this.rootNode=e;let s=[];this.allNodes&&this.allNodes.length>0?(s.push(this.rootNode),A.getDescendantNodes(this.rootNode,s),v("groupNodes:1:",s.length)):s=t,s.forEach(d=>{d.lot.eached=!1,d.lot.notLeafNode=!1,d.lot.childs=[],d.lot.parent=void 0,d.lot.index_of_parent=0,d.lot.strength=0,d.lot.strengthWithChilds_from=0,d.lot.strengthWithChilds=0,d.lot.placed=!1}),this.allNodes=t;let r={max_deep:1,max_length:1,max_strength:1};s=[],this.analysisNodes(s,[this.rootNode],0,r),s.forEach(d=>{d.lot.eached=!1,d.lot.notLeafNode=!1,d.lot.childs=[],d.lot.index_of_parent=0,d.lot.strength=0,d.lot.strengthWithChilds_from=0,d.lot.strengthWithChilds=0,d.lot.placed=!1}),e.fixed||this.layoutOptions.fixedRootNode||(e.x=0,e.y=0);const l=this.layoutOptions.centerOffset_x||0,c=this.layoutOptions.centerOffset_y||0,h=A.getNodeLotXY(n,e);e.lot.x=h.x+l,e.lot.y=h.y+c,v("groupNodes:2:",s.length,s.map(d=>d.text).join(",")),s=[],r={max_deep:1,max_length:1,max_strength:1},this.layoutOptions.simpleTree===!0?(this.analysisNodes4Didirectional(s,[this.rootNode],0,r,0),this.placeNodesPosition(this.rootNode,s,r)):(this.analysisNodes4Didirectional(s,[this.rootNode],0,r,-1),v("groupNodes:L:",s.length),this.placeNodesPosition(this.rootNode,s,r),s=[],r={max_deep:1,max_length:1,max_strength:1},this.analysisNodes4Didirectional(s,[this.rootNode],0,r,1),v("groupNodes:R:",s.length),this.placeNodesPosition(this.rootNode,s,r)),this.allNodes.forEach(d=>{if(d.fixed===!0){d.lot.placed=!0;return}if(!!A.isVisibleNode(d)){if(Number.isNaN(d.lot.x)&&(v("bad lot x:",d.text,d.lot.x),d.lot.x=0),Number.isNaN(d.lot.y)&&(v("bad lot y:",d.text,d.lot.y),d.lot.y=0),d!==e){const f=d.lot.level<0?o:n;d.x=A.getNodeXByLotX(f,d),d.y=A.getNodeYByLotY(f,d)}d.lot.placed=!0}}),v("create rootNode coordinates:1",e.x,e.y)}placeNodesPosition(t,e,n){t.lot.placed=!0,this.placeRelativePosition(t,e,n)}placeRelativePosition(t,e,n){const o=this.layoutOptions.layoutExpansionDirection;if(this.layoutOptions.from==="top"||this.layoutOptions.from==="bottom"){const s=this.layoutOptions.treeNodeGapH||20,r=this.layoutOptions.treeNodeGapV||20,{levels:l,levelNodesMap:c}=this.generateLevels(e),h=new Map;for(const g of l){const x=c.get(g);h.set(g,Math.max(...x.map(y=>y.el.offsetHeight)))}let d=0,f=0;for(const g of e){const x=g.el.offsetWidth;d+=x,f++}const u=d/f+s;e.forEach(g=>{g.fixed!==!0&&g.lot.placed!==!0&&g!==t&&(this.layoutOptions.from==="bottom"?g.lot.y=t.lot.y-this.getLevelDistance(g.lot.level,h,r+10):g.lot.y=t.lot.y+this.getLevelDistance(g.lot.level,h,r+10))}),e.forEach(g=>{g.fixed!==!0&&g.lot.level!==0&&(o==="start"?g.lot.x=t.lot.x-u*g.lot.strengthWithChilds_from:o==="end"?g.lot.x=t.lot.x+u*g.lot.strengthWithChilds_from:g.lot.x=t.lot.x+u*(n.max_strength/-2+g.lot.strengthWithChilds_from+g.lot.strengthWithChilds/2))}),this.applyNodesGap(e,"v"),this.gatherNodes(e,"v",u)}else{const s=this.layoutOptions.treeNodeGapH||20,r=this.layoutOptions.treeNodeGapV||20,{levels:l,levelNodesMap:c}=this.generateLevels(e),h=new Map;for(const g of l){const x=c.get(g);h.set(g,Math.max(...x.map(y=>y.el.offsetWidth)))}let d=0,f=0;for(const g of e){const x=g.el.offsetHeight;d+=x,f++}if(f===0)return;const u=d/f+r;e.forEach(g=>{g.fixed!==!0&&g.lot.placed!==!0&&g!==t&&(this.layoutOptions.from==="right"?g.lot.x=t.lot.x-this.getLevelDistance(g.lot.level,h,s+50):g.lot.x=t.lot.x+this.getLevelDistance(g.lot.level,h,s+50))}),e.forEach(g=>{g.fixed!==!0&&g.lot.level!==0&&(o==="start"?g.lot.y=t.lot.y-u*g.lot.strengthWithChilds_from:o==="end"?g.lot.y=t.lot.y+u*g.lot.strengthWithChilds_from:g.lot.y=t.lot.y+u*(n.max_strength/-2+g.lot.strengthWithChilds_from+g.lot.strengthWithChilds/2))}),console.log("levelMaxWidthMap:",t.id,h),this.applyNodesGap(e,"h"),this.gatherNodes(e,"h",u)}}getLevelDistance(t,e,n){if(t===0)return 0;if(t>0){let o=0;for(let s=0;s<t;s++)o+=e.get(s)+this.getLevelGap(s,n);return o}else{let o=0;for(let s=0;s>t;s--)o+=e.get(s)+this.getLevelGap(s,n);return-o}}getLevelGap(t,e){var o;let n=e;if(((o=this.layoutOptions.levelGaps)==null?void 0:o.length)>0){const s=this.layoutOptions.levelGaps[Math.abs(t)];s&&(n=s)}return n}applyNodesGap(t,e){if(this.layoutOptions.ignoreNodeSize)return;const n={alignItemsX:this.layoutOptions.alignItemsX,alignItemsY:this.layoutOptions.alignItemsY},o={alignItemsX:this.layoutOptions.alignParentItemsX,alignItemsY:this.layoutOptions.alignParentItemsY},s=this.layoutOptions.layoutExpansionDirection,{levels:r,levelNodesMap:l}=this.generateLevels(t),c=new Map;for(const f of r){const p=l.get(f);c.set(f,Math.max(...p.map(u=>u.el.offsetWidth)))}const{calcNodes:h,calcNodeMap:d}=this.generateCalcNodes(t);h.forEach(f=>{const p=f.rgNode.lot.level<0?o:n;f.x=A.getNodeXByLotX(p,f.rgNode),f.y=A.getNodeYByLotY(p,f.rgNode),f.width=f.rgNode.el.offsetWidth,f.height=f.rgNode.el.offsetHeight,f.buffY=0});for(const f of r){const p=l.get(f)||[];if(e==="h")if(s==="end"){p.sort((g,x)=>g.lot.y-x.lot.y);const u=p.map(g=>d.get(g.id));this.adjustNodePositions(u,"bottom",this.layoutOptions.treeNodeGapV);for(const g of u){const x=g.rgNode.lot.level<0?o:n;g.rgNode.lot.y=A.getNodeLotXY(x,g).y}}else{p.sort((g,x)=>x.lot.y-g.lot.y);const u=p.map(g=>d.get(g.id));this.adjustNodePositions(u,"top",this.layoutOptions.treeNodeGapV);for(const g of u){const x=g.rgNode.lot.level<0?o:n;g.rgNode.lot.y=A.getNodeLotXY(x,g).y}}else if(s==="end"){p.sort((g,x)=>g.lot.x-x.lot.x);const u=p.map(g=>d.get(g.id));this.adjustNodePositions(u,"right",this.layoutOptions.treeNodeGapH);for(const g of u){const x=g.rgNode.lot.level<0?o:n,y=A.getNodeLotXY(x,g);g.rgNode.lot.x=y.x}}else{p.sort((g,x)=>x.lot.x-g.lot.x);const u=p.map(g=>d.get(g.id));this.adjustNodePositions(u,"left",this.layoutOptions.treeNodeGapH);for(const g of u){const x=g.rgNode.lot.level<0?o:n;g.rgNode.lot.x=A.getNodeLotXY(x,g).x}}console.log("levelNodes:",f,p)}if(e==="h"){const f=new Map,p=new Map;for(const m of r){const b=l.get(m).map(M=>d.get(M.id));f.set(m,Math.max(...b.map(M=>M.width))),p.set(m,Math.min(...b.map(M=>M.x)))}const u=this.layoutOptions.treeNodeGapH;let g=r.filter(m=>m>0).sort((m,w)=>m-w),x=r.filter(m=>m<0).sort((m,w)=>w-m),y=1;this.layoutOptions.from==="right"&&([x,g]=[g,x],y=-1);let L=0;for(const m of g){const w=m-y,b=p.get(w),M=f.get(w),N=p.get(m)+L;f.get(m);const O=b+M+u;if(O>N){const E=O-N;console.log("[xxxxx]move",w,m,O,N,E),L=E;const T=l.get(m);for(const D of T)D.lot.x+=L;p.set(m,N+E)}else console.log("[xxxxx]goon",w,m,O,N),p.set(m,N)}L=0;for(const m of x){const w=m+y,b=p.get(w);f.get(w);const M=p.get(m)+L,N=f.get(m),O=b-u;if(M+N>O){const E=O-(M+N);L=E;const T=l.get(m);for(const D of T)D.lot.x+=L;p.set(m,M+E)}else p.set(m,M)}}else{const f=new Map,p=new Map;for(const m of r){const b=l.get(m).map(M=>d.get(M.id));f.set(m,Math.max(...b.map(M=>M.height))),p.set(m,Math.min(...b.map(M=>M.y)))}const u=this.layoutOptions.treeNodeGapV;let g=r.filter(m=>m>0).sort((m,w)=>m-w),x=r.filter(m=>m<0).sort((m,w)=>w-m),y=1;this.layoutOptions.from==="bottom"&&([x,g]=[g,x],y=-1);let L=0;for(const m of g){const w=m-y,b=p.get(w),M=f.get(w),N=p.get(m)+L;f.get(m);const O=b+M+u;if(O>N){const E=O-N;console.log("[xxxxx]move",w,m,O,N,E),L=E;const T=l.get(m);for(const D of T)D.lot.y+=L;p.set(m,N+E)}else console.log("[xxxxx]goon",w,m,O,N),p.set(m,N)}L=0;for(const m of x){const w=m+y,b=p.get(w);f.get(w);const M=p.get(m)+L,N=f.get(m),O=b-u;if(M+N>O){const E=O-(M+N);L=E;const T=l.get(m);for(const D of T)D.lot.y+=L;p.set(m,M+E)}else p.set(m,M)}}}gatherNodes(t,e,n){if(!this.enableGatherNodes)return;const{calcNodes:o,calcNodeMap:s}=this.generateCalcNodes(t);o.forEach(l=>{l.movedNodeSizeBefore=1,l.movedNodeSizeAfter=1});const{levelNodesMap:r}=this.generateLevels(t);t.forEach(l=>{if(l.fixed!==!0&&l.lot.level!==0){const c=r.get(l.lot.level)||[];if(l.lot.strengthWithChilds===1&&l.lot.childs_size<=1){const h=this.getBloomingNearByParent(l,l.lot.parent,c,e);if(h){const d=s.get(l.id);e==="h"?l.lot.y-h.lot.y>0?(l.lot.y=h.lot.y+n*d.movedNodeSizeAfter,d.movedNodeSizeAfter++):(l.lot.y=h.lot.y-n*d.movedNodeSizeBefore,d.movedNodeSizeBefore++):l.lot.x-h.lot.x>0?(l.lot.x=h.lot.x+n*d.movedNodeSizeAfter,d.movedNodeSizeAfter++):(l.lot.x=h.lot.x-n*d.movedNodeSizeBefore,d.movedNodeSizeBefore++)}}}})}getBloomingNearByParent(t,e,n,o){let s=9999,r;for(const l of n)if(l.lot.childs_size>1&&l.lot.parent===e){const c=o==="h"?l.lot.y-e.lot.y:l.lot.x-e.lot.x;Math.abs(c)<s&&(s=Math.abs(c),r=l)}if(r&&r!==t)return r}}class ue extends ut{constructor(t,e,n){super(t,e,n);S(this,"layoutOptions");this.layoutOptions=t}placeNodes(t,e){if(v("RGCenterLayouter:placeNodes"),!e){v("root is null:",e);return}v("layout by root:",e),this.allNodes=t,this.calcNodes=t,this.rootNode=e,t.forEach(h=>{h.lot.eached=!1,h.lot.notLeafNode=!1,h.lot.childs=[],h.lot.parent=void 0,h.lot.index_of_parent=0,h.lot.strength=0,h.lot.placed=!1});let n=[],o={max_deep:1,max_length:1,max_strength:1};if(this.analysisNodes(n,[this.rootNode],0,o),n=[],o={max_deep:1,max_length:1,max_strength:1},this.analysisNodes4Didirectional(n,[this.rootNode],0,o,0),this.layoutOptions.genLotInfoOnly){v("only gen lot info, return"),t.forEach(h=>{h.lot.placed=!0});return}e.fixed||this.layoutOptions.fixedRootNode||(e.x=0,e.y=0);const s={alignItemsX:this.layoutOptions.alignItemsX||"center",alignItemsY:this.layoutOptions.alignItemsY||"center"},r=this.layoutOptions.centerOffset_x||0,l=this.layoutOptions.centerOffset_y||0,c=A.getNodeLotXY(s,e);e.lot.x=c.x+r,e.lot.y=c.y+l,v("root position:",e.lot.x,e.lot.y),this.placeRelativePosition(this.rootNode,n,o),n.forEach(h=>{if(h.fixed!==!0&&!!h.rgCalcedVisible){if(h!==e){const d=s;h.x=A.getNodeXByLotX(d,h),h.y=A.getNodeYByLotY(d,h)}h.lot.placed=!0}})}getLevelDistanceArr(){let t=[];if(this.layoutOptions.levelDistance&&(Array.isArray(this.layoutOptions.levelDistance)?t=this.layoutOptions.levelDistance:console.error("Error levelDistance, levelDistance must is Array"),t.length>0&&t.length<10))for(let e=t.length;e<10;e++)t.push(t[t.length-1]);return t}getLevelR(t,e){if(t.length===0)return;let n=0;for(let o=0;o<e;o++)n+=t[o]||t[t.length-1];return n}placeRelativePosition(t,e,n){const o=this.layoutOptions.distance_coefficient===void 0?1:this.layoutOptions.distance_coefficient,s=this.getLevelDistanceArr(),r=Math.min(this.graphOptions.viewSize.height,this.graphOptions.viewSize.width)*.4;let l=Math.min(Math.max(r,150),400)*o;v("analyticResult:",this.layoutOptions,n,r,l,o,s);let c=0;e.forEach(d=>{const f=d.lot.subling;if(f&&f.level===1){c=Math.round(f.all_size*60/Math.PI/2),c<l&&(c=l);const p=this.getLevelR(s,f.level)||f.level*c,u=Z.getOvalPoint(t.lot.x,t.lot.y,p,d.lot.strength_plus-d.lot.strength/2,f.all_strength,this.layoutOptions.startAngle);d.lot.x=u.x,d.lot.y=u.y}});const h=Math.round(300*o);e.forEach(d=>{const f=d.lot.subling;if(f&&f.level>1){const p=d.lot.parent.lot.strength_plus-d.lot.parent.lot.strength,g=(d.lot.parent.lot.strength_plus-p)/(d.lot.parent.lot.childs_size+1)*(d.lot.index_of_parent+1),x=this.getLevelR(s,f.level)||(f.level-1)*h+c,y=Z.getOvalPoint(t.lot.x,t.lot.y,x,p+g,d.lot.parent.lot.subling.all_strength,this.layoutOptions.startAngle);d.lot.x=y.x,d.lot.y=y.y}})}}class ge extends ut{constructor(a,t,e){super(a,t,e)}refresh(){this.placeNodes(this.allNodes,this.rootNode)}placeNodes(a,t){if(t)v("layout by root:",t);else{v("root is null:",t);return}this.allNodes=a,this.rootNode=t,a.forEach(c=>{c.lot.eached=!1,c.lot.notLeafNode=!1,c.lot.childs=[],c.lot.parent=void 0,c.lot.index_of_p_childs=0,c.lot.strength=0}),t.fixed||this.layoutOptions.fixedRootNode||(t.x=0,t.y=0);const e={alignItemsX:this.layoutOptions.alignItemsX||"center",alignItemsY:this.layoutOptions.alignItemsY||"center"},n=this.layoutOptions.centerOffset_x||0,o=this.layoutOptions.centerOffset_y||0,s=A.getNodeLotXY(e,t);t.lot.x=s.x+n,t.lot.y=s.y+o;const r=this.allNodes.length;let l=r*90/Math.PI/2;l<200&&(l=200),l>800&&(l=800),this.allNodes.forEach((c,h)=>{const d=Z.getOvalPoint(t.lot.x,t.lot.y,l,h,r);c.lot.x=d.x,c.lot.y=d.y}),this.allNodes.forEach(c=>{if(c.fixed!==!0&&!!c.rgCalcedVisible){if(c===t){const h=e;c.x=A.getNodeXByLotX(h,c),c.y=A.getNodeYByLotY(h,c)}c.lot.placed=!0}})}}class pe extends pt{constructor(t,e,n){super(t,e,n);S(this,"graphOptions");S(this,"layoutOptions");S(this,"allNodes",[]);S(this,"__origin_nodes",[]);this.layoutOptions=t,this.graphOptions=e}placeNodes(t,e){if(e)v("layout by root:",e);else{v("root is null:",e);return}v("allNodes:",t.length),this.__origin_nodes=t,this.rootNode=e,t.forEach(o=>{o.lot.eached=!1,o.lot.notLeafNode=!1,o.lot.childs=[],o.lot.parent=void 0,o.lot.index_of_parent=0,o.lot.strength=0,o.lot.placed=!1,o.x||(o.x=0),o.y||(o.y=0),Number.isNaN(o.x)&&(o.x=0),Number.isNaN(o.y)&&(o.y=0)}),this.allNodes=[];const n={max_strength:1,max_deep:1,max_length:1};this.analysisNodes(this.allNodes,[this.rootNode],0,n),v("[layout canvasOffset]",this.graphOptions.viewSize,this.graphOptions.canvasSize)}}class Ue extends pt{constructor(t,e,n){super(t,e,n);S(this,"graphInstance");S(this,"layoutOptions");S(this,"levelDistanceArr",[]);this.layoutOptions=t,v("new RGSmartTreeLayouter:",this.layoutOptions),this.layoutOptions.from||(this.layoutOptions.from="left"),this.layoutOptions.levelDistance&&(Array.isArray(this.layoutOptions.levelDistance)?this.levelDistanceArr=this.layoutOptions.levelDistance:console.error("Error levelDistance, levelDistance must is Array")),this.requireLinks=!0,this.graphInstance=n}analysisNodes4Didirectional(t,e,n,o){this.analysisBothWay(t,e,n,o);const s={};t.forEach(c=>{const h=c.lot.level+"";s[h]||(s[h]=[]),s[h].push(c),c.lot.subling={level:c.lot.level,all_size:0,all_strength:0}}),t.forEach(c=>{const h=c.lot.level+"",d=s[h],f=d.length;c.lot.index_of_level=d.indexOf(c),c.lot.subling.all_size=f,c.lot.subling.all_strength+=c.lot.strength||1,c.lot.strength_plus=c.lot.subling.all_strength}),t.forEach(c=>{c.lot.childs_size>0&&(c.lot.strengthWithChilds=0)}),t.forEach(c=>{c.lot.childs_size===0&&(c.lot.strengthWithChilds=1,A.conductStrengthToParents(c))});const r=Object.keys(s).map(c=>Number.parseInt(c)).sort(),l=c=>{const h=c+"",d=s[h];let f=0;d.forEach(p=>{p.lot.parent&&f<p.lot.parent.lot.strengthWithChilds_from&&(f=p.lot.parent.lot.strengthWithChilds_from),c===0?f+=1:p.lot.strengthWithChilds_from=f,v("levels:",c,f,p.text,p.lot.strengthWithChilds),f+=p.lot.strengthWithChilds})};[0].forEach(l),r.filter(c=>c>0).forEach(l),r.filter(c=>c<0).forEach(l)}analysisBothWay(t,e,n,o){v(`level ${n} size: ${e.length}`),e.length>o.max_length&&(o.max_length=e.length),n>o.max_deep&&(o.max_deep=n);const s={level:n,all_size:e.length,all_strength:0};e.forEach(l=>{l.lot||(l.lot={childs:[]}),l.lot.eached=!0,l.lot.subling=s,l.lot.level=n,t.push(l)});let r=0;e.forEach(l=>{let c=0,h=0,d=[];this.graphInstance.getNodeRelatedNodes4From(l).forEach(f=>{f.lot||(f.lot={eached:!1,childs:[]}),f.lot.eached||(f.lot.parent=l,f.rgCalcedVisible?(f.lot.eached=!0,f.lot.index_of_parent=h++,l.lot.childs.push(f),d.push(f),c++):l.lot.childs.push(f))}),this.analysisBothWay(t,d,n-1,o),d=[],this.graphInstance.getNodeRelatedNodes4To(l).forEach(f=>{f.lot||(f.lot={eached:!1,childs:[]}),f.lot.eached||(f.lot.parent=l,f.rgCalcedVisible?(f.lot.eached=!0,f.lot.index_of_parent=h++,l.lot.childs.push(f),d.push(f),c++):l.lot.childs.push(f))}),this.analysisBothWay(t,d,n+1,o),l.lot.strength=c>0?c:1,s.all_strength+=l.lot.strength,l.lot.strength_plus=s.all_strength,l.lot.index_of_level=r,l.lot.childs_size=c,r++}),s.all_strength>o.max_strength&&(o.max_strength=s.all_strength)}placeNodes(t,e){if(v("RGSmartTreeLayouter:placeNodes"),e)v("layout by root:",e);else{console.error("root is null");return}this.rootNode=e,this.allNodes=t,v("allNodes:",t.length),t.forEach(c=>{c.lot.eached=!1,c.lot.notLeafNode=!1,c.lot.childs=[],c.lot.parent=void 0,c.lot.index_of_parent=0,c.lot.strength=0,c.lot.strengthWithChilds_from=0,c.lot.strengthWithChilds=0,c.lot.placed=!1});let n=[],o={max_deep:1,max_length:1,max_strength:1};this.analysisNodes(n,[this.rootNode],0,o),n=[],o={max_deep:1,max_length:1,max_strength:1},this.analysisNodes4Didirectional(n,[this.rootNode],0,o),this.placeNodesPosition(this.rootNode,n,o),v("allNodes:",n.length),this.allNodes.forEach(c=>{if(c.fixed===!0){c.lot.placed=!0;return}!c.rgCalcedVisible||(Number.isNaN(c.lot.x)&&(v("bad lot x:",c.text,c.lot.x),c.lot.x=0),Number.isNaN(c.lot.y)&&(v("bad lot y:",c.text,c.lot.y),c.lot.y=0),c.x=A.getNodeXByLotX(this.layoutOptions,c),c.y=A.getNodeYByLotY(this.layoutOptions,c),c.lot.placed=!0)}),v("create rootNode coordinates:1",e.x,e.y);const s=n.filter(c=>c.lot.level===0),r=[];this.allLinks.forEach(c=>{s.includes(c.fromNode)&&!s.includes(c.toNode)&&r.push(c.toNode),s.includes(c.toNode)&&!s.includes(c.fromNode)&&r.push(c.fromNode)}),r.forEach(c=>{c.fixed=!0}),s.push(...r);const l=new ut({layoutName:"force",maxLayoutTimes:100,force_node_repulsion:.1,force_line_elastic:1,fixedRootNode:!0},this.graphOptions,this.graphInstance);l.isMainLayouer=!1,l.requireLinks=!0,this.layoutOptions.from==="left"||this.layoutOptions.from==="right"?l.lockX=!0:l.lockY=!0,l.visibleNodes=s,l.setLinks(this.allLinks),l.resetCalcNodes(),l.doForceLayout(0)}placeNodesPosition(t,e,n){t.fixed||this.layoutOptions.fixedRootNode||(t.x=0,t.y=0);const o=this.layoutOptions.centerOffset_x||0,s=this.layoutOptions.centerOffset_y||0,r=A.getNodeLotXY(childrenTreeAlign,t);t.lot.x=r.x+o,t.lot.y=r.y+s,t.lot.placed=!0,this.placeRelativePosition(t,e,n)}placeRelativePosition(t,e,n){const o=this.graphOptions.viewSize;if(this.layoutOptions.from==="left"||this.layoutOptions.from==="right"){const s=rt(this.layoutOptions.min_per_height)||80,r=rt(this.layoutOptions.max_per_height)||400,l=rt(this.layoutOptions.min_per_width)||430,c=rt(this.layoutOptions.max_per_width)||650;let h=Math.round((o.width-10)/(n.max_deep+2));h<l&&(h=l),h>c&&(h=c);let d=Math.round(o.height/(n.max_strength+1));d<s&&(d=s),d>r&&(d=r),e.forEach(f=>{f.fixed!==!0&&f.lot.placed!==!0&&f!==t&&(this.layoutOptions.from==="right"?f.lot.x=t.lot.x-this.getLevelDistance(f,f.lot.subling.level,h):f.lot.x=t.lot.x+this.getLevelDistance(f,f.lot.subling.level,h))}),e.forEach(f=>{f.fixed!==!0&&(f.lot.level===0?f!==t&&(f.lot.y=t.lot.y+d*f.lot.index_of_level):f.lot.y=t.lot.y+d*(n.max_strength/-2+f.lot.strengthWithChilds_from+f.lot.strengthWithChilds/2))})}else{const s=rt(this.layoutOptions.min_per_height)||350,r=rt(this.layoutOptions.max_per_height)||400,l=rt(this.layoutOptions.min_per_width)||250,c=rt(this.layoutOptions.max_per_width)||500;let h=Math.round((o.width-10)/(n.max_strength+2));h<l&&(h=l),h>c&&(h=c);let d=Math.round((o.height-10)/(n.max_deep+2));d<s&&(d=s),d>r&&(d=r),e.forEach(f=>{f.fixed!==!0&&f.lot.placed!==!0&&f!==t&&(this.layoutOptions.from==="bottom"?f.lot.y=t.lot.y-this.getLevelDistance(f,f.lot.subling.level,d):f.lot.y=t.lot.y+this.getLevelDistance(f,f.lot.subling.level,d))}),e.forEach(f=>{f.fixed!==!0&&f.lot.level!==0&&(f.lot.x=t.lot.x+h*(n.max_strength/-2+f.lot.strengthWithChilds_from+f.lot.strengthWithChilds/2))})}}getLevelDistance(t,e,n){const o=Math.abs(e);if(this.levelDistanceArr&&this.levelDistanceArr.length>0){let s=0;for(let r=0;r<o;r++){const l=this.levelDistanceArr[r]||100;s+=l}return e>0?s:s*-1}else return e*n}}class ye extends pt{constructor(t,e,n){super(t,e,n);S(this,"enableGatherNodes",!1);S(this,"layoutOptions");this.layoutOptions=t,v("new RGFolderLayouter:",this.layoutOptions),this.layoutOptions.from||(this.layoutOptions.from="left"),this.layoutOptions.treeNodeGapH||(this.layoutOptions.treeNodeGapH=10),this.layoutOptions.treeNodeGapV||(this.layoutOptions.treeNodeGapV=10),this.layoutOptions.levelGaps||(this.layoutOptions.levelGaps=[]),this.layoutOptions.bottomJuctionPointOffsetX===void 0&&(this.layoutOptions.bottomJuctionPointOffsetX=-50);const o=this.layoutOptions.from;o==="top"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="center"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="start"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.layoutOptions.alignItemsX),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.getReverseAlignItems(this.layoutOptions.alignItemsY))):o==="bottom"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="center"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="end"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.layoutOptions.alignItemsX),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.getReverseAlignItems(this.layoutOptions.alignItemsY))):o==="right"?(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="end"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="center"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.getReverseAlignItems(this.layoutOptions.alignItemsX)),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.layoutOptions.alignItemsY)):(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="end"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="center"),this.layoutOptions.alignParentItemsX||(this.layoutOptions.alignParentItemsX=this.getReverseAlignItems(this.layoutOptions.alignItemsX)),this.layoutOptions.alignParentItemsY||(this.layoutOptions.alignParentItemsY=this.layoutOptions.alignItemsY)),this.layoutOptions.levelDistance&&console.error("Error: levelDistance is not support\uFF0C Please use levelGaps, treeNodeGapH, treeNodeGapV option in layoutOptions"),this.enableGatherNodes=this.layoutOptions.enableGatherNodes}analysisNodes4Didirectional(t,e,n,o,s){v(`${s} level ${n} size: ${e.length}`),e.length>o.max_length&&(o.max_length=e.length),n>o.max_deep&&(o.max_deep=n);const r={level:n,all_size:e.length,all_strength:0},l=[];e.forEach(h=>{h.lot||(h.lot={childs:[]}),h.lot.eached=!0,h.lot.subling=r,h.lot.level=n,t.push(h)});let c=0;e.forEach(h=>{let d=0;const f=this.graphInstance.getNodeRelatedNodes(h);let p=0;f.forEach(u=>{u.lot||(u.lot={eached:!1,childs:[]}),u.lot.eached||(u.lot.parent=h,u.rgCalcedVisible?(u.lot.eached=!0,u.lot.index_of_parent=p++,h.lot.childs.push(u),l.push(u),d++):h.lot.childs.push(u))}),h.lot.strength=d>0?d:1,r.all_strength+=h.lot.strength,h.lot.strength_plus=r.all_strength,h.lot.index_of_level=c,h.lot.childs_size=d,c++}),r.all_strength>o.max_strength&&(o.max_strength=r.all_strength),l.length>0?this.analysisNodes4Didirectional(t,l,n+s,o,s):(t.forEach(h=>{h.lot.strengthWithChilds=1,A.conductStrengthToParents4Folder(h)}),A.analysisDataFolder([t[0]],0,s))}placeNodes(t,e){if(v("RGFolderLayouter:placeNodes"),e)v("layout by root:",e);else{console.error("root is null");return}this.rootNode=e,this.allNodes=t,console.log("fixedRootNode:",this.layoutOptions.fixedRootNode);const n={alignItemsX:this.layoutOptions.alignItemsX,alignItemsY:this.layoutOptions.alignItemsY},o={alignItemsX:this.layoutOptions.alignParentItemsX,alignItemsY:this.layoutOptions.alignParentItemsY};e.fixed||this.layoutOptions.fixedRootNode||(e.x=0,e.y=0);const s=this.layoutOptions.centerOffset_x||0,r=this.layoutOptions.centerOffset_y||0,l=A.getNodeLotXY(n,e);e.lot.x=l.x+s,e.lot.y=l.y+r,v("allNodes:",t.length),t.forEach(d=>{d.lot||(d.lot={}),d.lot.eached=!1,d.lot.notLeafNode=!1,d.lot.childs=[],d.lot.parent=void 0,d.lot.index_of_parent=0,d.lot.strength=0,d.lot.strengthWithChilds_from=0,d.lot.strengthWithChilds=0,d.lot.placed=!1});let c=[],h={max_deep:1,max_length:1,max_strength:1};this.analysisNodesForFolder(c,[this.rootNode],0,h),c=[],h={max_deep:1,max_length:1,max_strength:1},this.analysisNodes4Didirectional(c,[this.rootNode],0,h,1),this.placeRelativePosition(e,c,h),v("allNodes:",c.length),this.allNodes.forEach(d=>{if(d.fixed===!0){d.lot.placed=!0;return}if(Number.isNaN(d.lot.x)&&(v("bad lot x:",d.text,d.lot.x),d.lot.x=0),Number.isNaN(d.lot.y)&&(v("bad lot y:",d.text,d.lot.y),d.lot.y=0),d!==e){const f=d.lot.level<0?o:n;d.x=A.getNodeXByLotX(f,d),d.y=A.getNodeYByLotY(f,d)}d.lot.placed=!0}),v("create rootNode coordinates:1",e.x,e.y)}placeRelativePosition(t,e,n){const o=this.layoutOptions.treeNodeGapH||20,s=this.layoutOptions.treeNodeGapV||20,r=new Map;let l=0,c=0;for(const f of e){const p=f.lot.level,u=f.el.offsetWidth,g=f.el.offsetHeight;l+=g,c++;const x=r.get(p);x===void 0?r.set(p,u):u>x&&r.set(p,x)}if(c===0)return;console.log("levelMaxWidthMap:",r);const d=l/c+s;e.forEach(f=>{f.fixed!==!0&&f.lot.placed!==!0&&f!==t&&(this.layoutOptions.from==="right"?f.lot.x=t.lot.x-this.getLevelDistance(f.lot.level,r,o+50):f.lot.x=t.lot.x+this.getLevelDistance(f.lot.level,r,o+50))}),e.forEach(f=>{f.fixed!==!0&&f!==t&&f.lot.level!==0&&(f.lot.y=t.lot.y+d*(f.lot.strengthWithChilds_from-1))}),this.gatherNodes(e,"h",d)}gatherNodes(t,e,n){if(!this.enableGatherNodes)return;const o={};t.forEach(s=>{if(s.lot.level!==0)return;const r=s.lot.level+"";o[r]||(o[r]=[]),o[r].push(s),s.lot.movedNodeSizeBefore=1,s.lot.movedNodeSizeAfter=1}),t.forEach(s=>{if(s.fixed!==!0&&s.lot.level!==0){const r=s.lot.level+"",l=o[r];if(s.lot.strengthWithChilds===1&&s.lot.childs_size<=1){const c=this.getBloomingNearByParent(s,s.lot.parent,l,e);c&&(e==="h"?s.lot.y-c.lot.y>0?(s.lot.y=c.lot.y+n*c.lot.movedNodeSizeAfter,c.lot.movedNodeSizeAfter++):(s.lot.y=c.lot.y-n*c.lot.movedNodeSizeBefore,c.lot.movedNodeSizeBefore++):s.lot.x-c.lot.x>0?(s.lot.x=c.lot.x+n*c.lot.movedNodeSizeAfter,c.lot.movedNodeSizeAfter++):(s.lot.x=c.lot.x-n*c.lot.movedNodeSizeBefore,c.lot.movedNodeSizeBefore++))}}})}getBloomingNearByParent(t,e,n,o){let s=9999,r;for(const l of n)if(l.lot.childs_size>1&&l.lot.parent===e){const c=o==="h"?l.lot.y-e.lot.y:l.lot.x-e.lot.x;Math.abs(c)<s&&(s=Math.abs(c),r=l)}if(r&&r!==t)return r}getLevelDistance(t,e,n){if(t===0)return 0;if(t>0){let o=0;for(let s=0;s<t;s++)o+=e.get(s)+this.getLevelGap(s,n);return o}else{let o=t<-1?0:-e.get(t)/2;for(let s=t;s<0;s++)o+=e.get(s)+this.getLevelGap(s,n)+50;return-o}}getLevelGap(t,e){var o;let n=e;if(((o=this.layoutOptions.levelGaps)==null?void 0:o.length)>0){const s=this.layoutOptions.levelGaps[Math.abs(t)];s&&(n=s)}return n}analysisNodesForFolder(t,e,n,o){e.length>o.max_length&&(o.max_length=e.length),n>o.max_deep&&(o.max_deep=n);const s={level:n,all_size:e.length,all_strength:0};n===0&&e.forEach(l=>{l.lot.parent=void 0});const r=[];for(const l of e){t.push(l);for(const c of this.graphInstance.getNodeRelatedNodes(l))t.includes(c)||(t.push(c),c.lot.parent=l,r.push(c))}s.all_strength>o.max_strength&&(o.max_strength=s.all_strength),r.length>0&&this.analysisNodesForFolder(t,r,n+1,o)}}let Ze=0;const Ft=i=>{typeof i.graphOffset_x=="string"&&(i.graphOffset_x=parseInt(i.graphOffset_x)),typeof i.graphOffset_y=="string"&&(i.graphOffset_y=parseInt(i.graphOffset_y)),i.defaultPloyLineRadius&&(i.defaultPolyLineRadius=i.defaultPloyLineRadius);const a={instanceId:"",debug:!0,graphLoading:!1,graphLoadingText:"",instanceDestroyed:!1,useHorizontalView:!1,showDebugPanel:!1,showToolBar:!0,backgroundColor:"transparent",checkedItemBackgroundColor:void 0,downloadImageFileName:"",selectionMode:!1,disableWheelEvent:!1,wheelEventAction:"zoom",disableDragNode:!1,disableDragLine:!0,disableDragCanvas:!1,canvasMoveMode:!1,disableNodePointEvent:!1,disableLinePointEvent:!1,enableNodeXYAnimation:!1,enableCanvasTransformAnimation:!1,reLayoutWhenExpandedOrCollapsed:!1,defaultExpandHolderPosition:"hide",defaultExpandHolderColor:void 0,toolBarDirection:"v",toolBarPositionH:"right",toolBarPositionV:"center",defaultNodeColor:"#ffffff",defaultLineColor:"#cccccc",defaultLineShape:void 0,defaultLineTextOffset_x:void 0,defaultLineTextOffset_y:void 0,defaultJunctionPoint:void 0,defaultPolyLineRadius:5,placeSingleNode:!0,placeOtherGroup:!0,lineUseTextPath:!1,lineTextMaxLength:66,multiLineDistance:50,graphOffset_x:0,graphOffset_y:0,defaultLineMarker:{viewBox:"0 0 12 12",markerWidth:20,markerHeight:20,refX:3,refY:3,data:"M 0 0, V 6, L 4 3, Z"},viewSize:{width:300,height:300},viewELSize:{width:1300,height:800,left:0,top:100},canvasSize:{width:1e3,height:1e3},canvasOffset:{x:25,y:27,zoom_buff_x:0,zoom_buff_y:0},fullscreen:!1,checkedNodeId:"",checkedLineId:"",checkedLinkId:"",layout:{label:"\u4E2D\u5FC3",layoutName:"fixed",layoutDirection:"v"},canvasZoom:100,mouseWheelSpeed:10,minCanvasZoom:5,maxCanvasZoom:500,showEasyView:!1,performanceMode:!1,viewHeight:"100%",canvasOpacity:1,creatingSelection:!1,selectionView:{x:25,y:27,width:0,height:0},creatingNodePlot:!1,showTemplateNode:!0,newNodeTemplate:Ct(JSON.parse(JSON.stringify(Bt))),creatingLinePlot:!1,newLineTemplate:{from:"newRelationTemplate-from",to:"newRelationTemplate-to",color:"",text:"new line"},newLinkTemplate:{fromNode:null,toNodeObject:null,toNode:{nothing:!0,x:400,y:400,el:{offsetWidth:30,offsetHeight:30}},totalLinesBetweenNodes:1,currentLineIndex:0,line:{}},data:{},editingLineController:{show:!1,link:null,line:null,startPoint:{x:0,y:0},endPoint:{x:0,y:0},text:{show:!0,x:0,y:0,width:10,height:10},ctrlPoints:[],selectedLines:[],line44Splits:[],line49Points:[],ctrlPoint1:{x:0,y:0},ctrlPoint2:{x:0,y:0},toolbar:{x:0,y:0}},editingController:{show:!1,nodes:[],x:0,y:0,width:100,height:100},nodeConnectController:{show:!1,node:null,x:0,y:0,width:100,height:100},showReferenceLine:!1,referenceLineAdsorption:!1,editingReferenceLine:{show:!1,directionV:!1,directionH:!1,v_x:0,v_y:0,v_height:0,h_x:0,h_y:0,h_width:0},showMiniView:!1,miniViewVisibleHandle:{x:0,y:0,width:100,height:100,emptyContent:!1},snapshotting:!1};if(a.newLineTemplate=ct(a.newLineTemplate),i.layouts)throw new Error("Graph options do not support setting layouts properties !");const t=i.debug===!0;t&&v("RGOptions:user instance options:",i),window&&(window.relationGraphDebug=t);const e=Object.keys(a);return i&&Object.keys(i).forEach(n=>{const o=i[n];if(!e.includes(n)){v("RGOptions: unknow option key:",n);return}if(typeof o=="object"){v("RGOptions:user setting object:",n,o);const s=a[n];if(n==="layout")a[n]=JSON.parse(JSON.stringify(o));else if(s&&!Array.isArray(s)&&o)Object.keys(s).forEach(r=>{s[r]=o[r]});else if(Array.isArray(s)){const r=[];o.forEach(l=>{l&&typeof l=="object"?r.push(JSON.parse(JSON.stringify(l))):r.push(l)}),a[n]=r}else a[n]=o}else a[n]=o}),v("final layout:",a.layout),$t(a.layout),Ht(a.layout,a),a},Ht=(i,a)=>{v("applyDefaultOptionsByLayout",i.layoutName,a),i.layoutName==="center"?a.defaultJunctionPoint===void 0&&(a.defaultJunctionPoint=U.border):i.layoutName.includes("tree")?((i.from==="top"||i.from==="bottom")&&(v("set layoutDirection=v"),a.defaultJunctionPoint===void 0&&(a.defaultJunctionPoint=U.tb),v("set defaultJunctionPoint=tb")),(i.from==="left"||i.from==="right")&&(v("set layoutDirection=h"),a.defaultJunctionPoint===void 0&&(a.defaultJunctionPoint=U.lr),v("set defaultJunctionPoint=lr"))):i.layoutName==="fixed"||i.layoutName,a.defaultJunctionPoint===void 0&&(a.defaultJunctionPoint=U.border)},$t=i=>{if(typeof i.centerOffset_x=="string"&&(i.centerOffset_x=parseInt(i.centerOffset_x)),typeof i.centerOffset_y=="string"&&(i.centerOffset_y=parseInt(i.centerOffset_y)),i.layoutName==="center"){const a=i;a.layoutDirection===void 0&&(a.layoutDirection="h"),a.centerOffset_x===void 0&&(a.centerOffset_x=0),a.centerOffset_y===void 0&&(a.centerOffset_y=0),a.layoutDirection=void 0}else if(i.layoutName.includes("tree")){const a=i;a.layoutDirection===void 0&&(a.layoutDirection="h"),a.centerOffset_x===void 0&&(a.centerOffset_x=0),a.centerOffset_y===void 0&&(a.centerOffset_y=0),a.from===void 0&&(a.from="top"),a.levelGaps===void 0&&(a.levelGaps=[]),(a.from==="top"||a.from==="bottom")&&(a.layoutDirection="v",v("set layoutDirection=v"),v("set defaultJunctionPoint=tb")),(a.from==="left"||a.from==="right")&&(a.layoutDirection="h",v("set defaultJunctionPoint=lr"))}else(i.layoutName==="fixed"||i.layoutName==="force")&&(i.layoutDirection=void 0);i.supportAutoLayout=!1,i.autoLayouting=!1},Nt=i=>{const a=Ft(i);return v("RGOptions:new RGOptions:by:",i),v("RGOptions:new RGOptions:",a),a.instanceId||(a.instanceId=`rg-ins-${Ze++}`),a},Je={newInstanceOptions:Nt,createDefaultConfig:Ft,applyDefaultOptionsByLayout:Ht},qe=Object.freeze(Object.defineProperty({__proto__:null,createDefaultConfig:Ft,applyDefaultOptionsByLayout:Ht,appendDefaultOptions4Layout:$t,newInstanceOptions:Nt,default:Je},Symbol.toStringTag,{value:"Module"}));class Qe{constructor(a,t){S(this,"options");S(this,"listeners");S(this,"isReact",!1);S(this,"updateViewHook",()=>{});S(this,"_dataUpdating",!1);S(this,"_dataUpdatingNext",!1);S(this,"eventHandlers",[]);S(this,"_emitHook");this.listeners=t||{},this.options=a?Nt(a):{}}enableDebugLog(a){this.options.debug=a,window&&(window.relationGraphDebug=a)}setUpdateViewHook(a){this.isReact=!0,this.updateViewHook=a}_dataUpdated(){!window||!window.requestAnimationFrame||requestAnimationFrame(this._doSomethingAfterDataUpdated.bind(this))}_doSomethingAfterDataUpdated(){v("_dataUpdated:"),this.updateShouldRenderGraphData(),this.updateEasyView(),this.updateViewHook()}addEventHandler(a){this.eventHandlers.includes(a)||this.eventHandlers.push(a)}removeEventHandler(a){const t=this.eventHandlers.indexOf(a);t!==-1&&this.eventHandlers.splice(t,1)}setEventEmitHook(a){this._emitHook=a}emitEvent(a,...t){let{result:e,handled:n}=this.defaultEventHandler(a,...t);for(const o of this.eventHandlers){const s=o(a,...t);s!==void 0&&(e=s,n=!0)}if(n||this._emitHook&&this._emitHook(a,...t,o=>{o!==void 0&&(e=o)}),e!==void 0)return v("[custom event hook]Event:",a," => returnValue:",e),e}defaultEventHandler(a,...t){let e,n=!1;if(a===I.onReady)this.listeners.onReady&&(n=!0,this.listeners.onReady(this));else if(a===I.onNodeDragStart)this.listeners.onNodeDragStart&&(n=!0,this.listeners.onNodeDragStart(t[0],t[1]));else if(a===I.onNodeDragging){if(this.listeners.onNodeDragging){n=!0;const o=t[0],s=t[1],r=t[2],l=t[3],c=t[4],h=t[5];e=this.listeners.onNodeDragging(o,s,r,l,c,h)}}else if(a===I.onCanvasDragging){if(this.listeners.onCanvasDragging){n=!0;const o=t[0],s=t[1],r=t[2],l=t[3];e=this.listeners.onCanvasDragging(o,s,r,l)}}else if(a===I.onNodeDragEnd){const o=t[0],s=t[1],r=t[2],l=t[3];this.listeners.onNodeDragEnd&&(n=!0,this.listeners.onNodeDragEnd(o,s,r,l))}else if(a===I.onZoomEnd)this.listeners.onZoomEnd&&(n=!0,this.listeners.onZoomEnd());else if(a===I.onNodeClick){if(this.listeners.onNodeClick){n=!0;const o=t[0],s=t[1];this.listeners.onNodeClick(o,s)}}else if(a===I.onImageDownload){if(this.listeners.onImageDownload){n=!0;const o=t[0],s=t[1];e=this.listeners.onImageDownload(o,s)}}else if(a===I.onImageSaveAsFile){if(this.listeners.onImageSaveAsFile){n=!0;const o=t[0],s=t[1],r=t[2];e=this.listeners.onImageSaveAsFile(o,s,r)}}else if(a===I.onLineClick){if(this.listeners.onLineClick){n=!0;const o=t[0],s=t[1],r=t[2];this.listeners.onLineClick(o,s,r)}}else if(a===I.onNodeExpand){if(this.listeners.onNodeExpand){n=!0;const o=t[0],s=t[1];this.listeners.onNodeExpand(o,s)}}else if(a===I.onNodeCollapse){if(this.listeners.onNodeCollapse){n=!0;const o=t[0],s=t[1];this.listeners.onNodeCollapse(o,s)}}else if(a===I.onCanvasDragEnd){if(this.listeners.onCanvasDragEnd){n=!0;const o=t[0];this.listeners.onCanvasDragEnd(o)}}else if(a===I.onCanvasClick){if(this.listeners.onCanvasClick){n=!0;const o=t[0];this.listeners.onCanvasClick(o)}}else if(a===I.onCanvasSelectionEnd){if(this.listeners.onCanvasSelectionEnd){n=!0;const o=t[0],s=t[1];this.listeners.onCanvasSelectionEnd(o,s)}}else if(a===I.onContextmenu){if(this.listeners.onContextmenu){n=!0;const o=t[0],s=t[1],r=t[2];this.listeners.onContextmenu(o,s,r)}}else if(a===I.onFullscreen){if(this.listeners.onFullscreen){n=!0;const o=t[0],s=t[1];e=this.listeners.onFullscreen(o,s)}}else if(a===I.beforeAddNodes){if(this.listeners.beforeAddNodes){n=!0;const o=t[0];e=this.listeners.beforeAddNodes(o)}}else if(a===I.beforeAddLines){if(this.listeners.beforeAddLines){n=!0;const o=t[0];e=this.listeners.beforeAddLines(o)}}else if(a===I.onKeyboardDown){if(this.listeners.onKeyboardDown){n=!0;const o=t[0];e=this.listeners.onKeyboardDown(o)}}else if(a===I.onKeyboardUp){if(this.listeners.onKeyboardUp){n=!0;const o=t[0];e=this.listeners.onKeyboardUp(o)}}else if(a===I.onLineBeCreated){if(this.listeners.onLineBeCreated){n=!0;const o=t[0];e=this.listeners.onLineBeCreated(o)}}else if(a===I.onCanvasDragStart&&this.listeners.onCanvasDragStart){n=!0;const o=t[0],s=t[1],r=t[2];e=this.listeners.onCanvasDragStart(o,s,r)}return{result:e,handled:n}}setEventListener(a){Object.assign(this.listeners,a)}}class Ke extends Qe{constructor(t,e){super(t,e);S(this,"$dom");S(this,"$canvasDom");S(this,"resizeObserver");S(this,"resizeListenerMap",new WeakMap);S(this,"domToNodeIdMap",new WeakMap);S(this,"_rgAsConnectArea",!1);S(this,"onKeyDownHanlder");S(this,"onKeyUpHanlder");S(this,"$lineTextContainer4NormalLine");S(this,"$lineTextContainer4FakeLine")}initDom(){this.resizeObserver=new ResizeObserver((t,e)=>{for(const n of t){const o=this.resizeListenerMap.get(n.target);o?n.borderBoxSize?o(n.borderBoxSize[0].inlineSize,n.borderBoxSize[0].blockSize):o(n.target.clientWidth,n.target.clientHeight):n.borderBoxSize?this._onNodeDomResize(n.target,n.borderBoxSize[0].inlineSize,n.borderBoxSize[0].blockSize):this._onNodeDomResize(n.target,n.target.clientWidth,n.target.clientHeight)}})}setDom(t){this.$dom=t,this.addResizeListener(this.$dom,(e,n)=>{v("resizeListener:this.$dom"),this.resetViewSize(),this.updateViewBoxInfo(),this.updateEasyView(),this._rgAsConnectArea&&(this.updateConnectTargetsOnCanvas("View Resize",this.$dom.querySelector(".rg-canvas-slot-behind")),this.updateConnectTargetsOnCanvas("View Resize",this.$dom.querySelector(".rg-canvas-slot-above"))),this.updateEditingControllerView(),this.updateEditingLineView(),setTimeout(()=>{v("resizeListener:updateShouldRenderGraphData"),this.emitEvent(I.onViewResize,{width:e,height:n})},500)}),this._rgAsConnectArea||(this.removeKeyboardListener(),this.addKeyboardListener())}addKeyboardListener(){this.onKeyDownHanlder=t=>{vt(t)||(t.code==="Space"&&(t.preventDefault(),this.setCanvasMoveMode(!0)),this.emitEvent(I.onKeyboardDown,t))},this.onKeyUpHanlder=t=>{vt(t)||(t.code==="Space"&&(t.preventDefault(),this.setCanvasMoveMode(!1)),this.emitEvent(I.onKeyboardUp,t))},this.$dom.addEventListener("keydown",this.onKeyDownHanlder),this.$dom.addEventListener("keyup",this.onKeyUpHanlder)}removeKeyboardListener(){this.onKeyDownHanlder&&this.$dom.removeEventListener("keydown",this.onKeyDownHanlder),this.onKeyUpHanlder&&this.$dom.removeEventListener("keyup",this.onKeyUpHanlder)}setCanvasDom(t){this.$canvasDom=t,this.reinitMutationObservers(),this.getLineTextContainer({isFakeLine:!0}),this.getLineTextContainer({isFakeLine:!1})}getLineTextContainer(t){if(!(!t||!this.$canvasDom))return t.isFakeLine?(this.$lineTextContainer4NormalLine||(this.$lineTextContainer4NormalLine=this.$canvasDom.querySelector(".rg-lines-container-el-lines .rg-linetext-container")),this.$lineTextContainer4NormalLine):(this.$lineTextContainer4FakeLine||(this.$lineTextContainer4FakeLine=this.$canvasDom.querySelector(".rg-lines-container-normal-lines .rg-linetext-container")),this.$lineTextContainer4FakeLine)}getBoundingClientRect(){var t;return(t=this.$dom)==null?void 0:t.getBoundingClientRect()}addResizeListener(t,e){this.resizeListenerMap.set(t,e),this.resizeObserver||this.initDom(),this.resizeObserver.observe(t)}_onNodeDomResize(t,e,n){if(e===0||n===0)return;const o=this.domToNodeIdMap.get(t);this._onNodeResize(t,o,e,n)}_onNodeResize(t,e,n,o){n===0||o===0||(this.updateConnectTargetsOnNode("Node-Created",e,t),this.updateNodeOffsetSize(e,n,o))}addNodeResizeListener(t,e){this.domToNodeIdMap.set(t,e.id),this.resizeObserver||this.initDom(),this._onNodeResize(t,e.id,t.offsetWidth,t.offsetHeight),this.resizeObserver.observe(t)}removeNodeResizeListener(t){this.domToNodeIdMap.delete(t),t?this.resizeObserver.unobserve(t):v("removeNodeResizeListener: dom is null or undefined!")}removeResizeListener(t){this.resizeListenerMap.delete(t),this.resizeObserver.unobserve(t)}destroyResizeObserver(){this.resizeObserver&&this.resizeObserver.disconnect()}}class tn extends Ke{constructor(t,e){super(t,e);S(this,"graphData",{rootNode:void 0,nodes:[],normalLines:[],elementLines:[],fakeLines:[]});S(this,"runtimeDATA4Links",[]);S(this,"runtimeDATA4NodeMap",{});S(this,"runtimeDATA4ConnectTargets",[]);S(this,"reactiveData");S(this,"runtimeDATA4ShouldRenderGraphData",{nodes:[],lines:[]});S(this,"prevAddNodeTimestamp",0);S(this,"mutationObserver4Nodes");S(this,"mutationObserver4CanvasSlotBehind");S(this,"mutationObserver4CanvasSlotAbove");S(this,"canvasConnectTargetsMap",new Map);S(this,"nodeConnectTargetsMap",new Map);S(this,"fakeLineTargetRender");S(this,"runtimeDATA4ElLineTargets",[]);S(this,"elLineUpdating",!1);S(this,"_canvasBoxXY",{x:0,y:0});S(this,"canvasDragging",!1)}setReactiveData4Vue2(t,e,n){this.reactiveData=e,this.graphData=t,this.runtimeDATA4ShouldRenderGraphData=n.runtimeDATA4ShouldRenderGraphData,this.runtimeDATA4ConnectTargets=n.runtimeDATA4ConnectTargets,this.runtimeDATA4ElLineTargets=n.runtimeDATA4ElLineTargets,Object.assign(e.options,this.options),this.options=e.options}setReactiveData4Vue3(t,e,n){this.reactiveData=e,this.graphData=t,this.options.performanceMode||(this.runtimeDATA4Links=n.runtimeDATA4Links),this.runtimeDATA4ShouldRenderGraphData=n.runtimeDATA4ShouldRenderGraphData,this.runtimeDATA4ConnectTargets=n.runtimeDATA4ConnectTargets,this.runtimeDATA4ElLineTargets=n.runtimeDATA4ElLineTargets,Object.assign(e.options,this.options||{}),this.options=e.options}_setOptions(t){const e=this.options.instanceId;t.instanceId||(t.instanceId=e);const n=Nt(t);this.reactiveData?Object.assign(this.reactiveData.options,n):Object.assign(this.options,n)}_setJsonData(t,e=!1){this.clearGraph(),v("set jsonData:",t),this.loadGraphJsonData(t)}clearGraph(){this.graphData.nodes=[],this.graphData.normalLines=[],this.graphData.elementLines=[],this.graphData.fakeLines=[],this.runtimeDATA4Links.splice(0,this.runtimeDATA4Links.length),this.runtimeDATA4ElLineTargets.splice(0,this.runtimeDATA4ElLineTargets.length),this.runtimeDATA4NodeMap={},this.graphData.rootNode=void 0,this.clearChecked(),this.setEditingLine(null,null),this.setEditingNodes([])}clearFakeLines(){this.graphData.fakeLines.splice(0,this.graphData.fakeLines.length)}clearElementLines(){for(const t of this.getFakeLines())(t.fromType===B.HTMLElementId||t.toType===B.HTMLElementId)&&this.removeFakeLine(t)}generateNewNodeId(t=5){const e=this.generateNewUUID(t);return this.getNodeById(e)?this.generateNewNodeId(t+1):e}generateNewUUID(t=5){const e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";let n="";const o=t>30?30:t;for(let s=0;s<o;s++)n+=e[Math.floor(Math.random()*e.length)];return n}loadNodes(t){this.emitEvent(I.beforeAddNodes,t);const e={};this.graphData.nodes.forEach(o=>{e[o.id]=o});const n=[];t.forEach(o=>{let s=e[o.id];if(!s){let{text:r,id:l}=o;!r&&o.label&&(r=o.label,console.warn('Use "label" as "text":',o.label)),!r&&l&&(r=l,console.warn('Use "id" as "text":',l)),s=Ct(Object.assign({},o,{text:r}),this.options),s&&(e[s.id]=s,n.push(s))}}),this.graphData.nodes.push(...n);for(const o of n)this.runtimeDATA4NodeMap[o.id]=o;n.length>0&&(this.prevAddNodeTimestamp=Date.now())}loadLines(t){this.emitEvent(I.beforeAddLines,t);const e=[],n=[];t.forEach(o=>{let{from:s,to:r,text:l}=o;if(!s)if(o.source)s=o.source,console.warn('Use "source" as "from":',o.source);else{console.error('JsonLine Must have field:"from"',o);return}if(!r)if(o.target)r=o.target,console.warn('Use "target" as "to":',o.target);else{console.error('JsonLine Must have field:"to"',o);return}l||o.label&&(l=o.label,console.warn('Use "label" as "text":',o.label));const c=this.getNodeById(s);if(!c){console.error("Can not found from node:",o);return}const h=this.getNodeById(r);if(!h){console.error("Can not found to node:",o);return}if(o.id){if(this.getLineById(o.id)){console.warn("loadLines:skip duplicate line id:",o.id);return}else if(n.some(g=>g.id===o.id)){console.warn("Duplicate line id in new lines:",o.id);return}}else o.id="L-"+this.generateNewUUID(6);const d=ct(Object.assign({},o,{from:s,to:r,text:l})),p={seeks_id:"LK-"+this.generateNewUUID(6),fromNode:c,toNode:h,forDisplayOnly:d.forDisplayOnly||!1,currentLineIndex:0,totalLinesBetweenNodes:1,rgShouldRender:!0,rgCalcedVisible:!0,line:d};n.push(d),e.push(p)}),this.graphData.normalLines.push(...n),this.runtimeDATA4Links.push(...e),this.updateLinks(e)}updateLinks(t){for(const e of t){const n=this.getLinesBetweenNodes([e.fromNode,e.toNode]);for(const o of n){const s=this.getLinkByLine(o);s.totalLinesBetweenNodes=n.length,s.currentLineIndex=n.findIndex(r=>r.id===s.line.id)}}}flatNodeData(t,e,n,o){A.flatNodeData(t,e,n,o)}loadGraphJsonData(t){t.lines||(t.lines=t.relations,console.warn("[relation-graph] For compatibility with older versionsm, Use jsonData.relations as jsonData.lines, It is recommended that you define your data using")),t.lines||(t.lines=t.links||t.edges,console.warn("[relation-graph] For compatibility with older versionsm, Use jsonData.links/jsonData.edges as jsonData.lines, It is recommended that you define your data using"));const e=t.nodes||[],n=t.lines||[],o=[],s=[];this.flatNodeData(e,null,o,s),n.forEach(r=>{s.push(r)}),this.loadNodes(o),v("Nodes is initialized"),this.loadLines(s),this._dataUpdated(),setTimeout(()=>{t.elementLines&&this.addElementLines(t.elementLines),t.fakeLines&&this.addFakeLines(t.fakeLines),this._dataUpdated()},500)}getLineArrow(t,e=!1,n=!1){const o=e?"start-":"";return`${this.options.instanceId}-${o}arrow-default`}getNodes(){return[...this.graphData.nodes]}getShouldRenderNodes(){return this.options.performanceMode?this.runtimeDATA4ShouldRenderGraphData.nodes:this.calcShouldRenderNodes()}calcShouldRenderNodes(){const t=[];return this.getNodes().forEach(e=>{e.rgShouldRender===!1||!A.isVisibleNode(e)||t.push(e)}),t}getShouldRenderLines(){return this.options.performanceMode?this.runtimeDATA4ShouldRenderGraphData.lines:this.calcShouldRenderLines()}calcShouldRenderLines(){const t=[];return this.runtimeDATA4Links.forEach(e=>{e.rgShouldRender===!1||e.line.hidden===!0||!(A.isVisibleNode(e.fromNode)&&A.isVisibleNode(e.toNode))||t.push(e.line)}),t}reinitMutationObservers(){this.destroyMutationObserver();const t=this.$dom.querySelector(".rg-nodes-container");if(t)this.mutationObserver4Nodes=new MutationObserver(o=>{for(const s of o){const r=this.getNodeElByChildrenTarget(s.target),l=this.domToNodeIdMap.get(r);l&&this.updateConnectTargetsOnNode("Mutation",l,r)}}),this.mutationObserver4Nodes.observe(t,{childList:!0,subtree:!0,characterData:!0});else throw new Error("MutationObserver:error:Can not find: .rg-nodes-container");const e=this.$dom.querySelector(".rg-canvas-slot-behind");if(e)this.mutationObserver4CanvasSlotBehind=new MutationObserver(o=>{console.warn("MutationObserver:updateConnectTargetsOnCanvas:mutations:",o),this.updateConnectTargetsOnCanvas("CanvasBehind-Mutation",e)}),this.mutationObserver4CanvasSlotBehind.observe(e,{childList:!0,subtree:!0,characterData:!0});else throw new Error("MutationObserver:error:Can not find: .rg-canvas-slot-behind");const n=this.$dom.querySelector(".rg-canvas-slot-above");n&&(this.mutationObserver4CanvasSlotAbove=new MutationObserver(o=>{this.updateConnectTargetsOnCanvas("CanvasAbove-Mutation",n)}),this.mutationObserver4CanvasSlotAbove.observe(n,{childList:!0,subtree:!0,characterData:!0}))}destroyMutationObserver(){this.mutationObserver4Nodes&&(this.mutationObserver4Nodes.disconnect(),this.mutationObserver4Nodes=void 0),this.mutationObserver4CanvasSlotBehind&&(this.mutationObserver4CanvasSlotBehind.disconnect(),this.mutationObserver4CanvasSlotBehind=void 0),this.mutationObserver4CanvasSlotAbove&&(this.mutationObserver4CanvasSlotAbove.disconnect(),this.mutationObserver4CanvasSlotAbove=void 0)}updateConnectTargetsOnCanvas(t,e){if(!e)return;console.warn(`updateConnectTargetsOnCanvas:[${t}]:`);const n=e.classList.contains("rg-canvas-slot-above")?"above":"behind",o=this.canvasConnectTargetsMap.get(n);o&&o.length>0&&this.updateConnectTargetList(t,e,o)}updateConnectTargetsByNodeId(t){const e=this.getNodeElByNodeId(t);this.updateConnectTargetsOnNode("API",t,e)}updateConnectTargetsOnNode(t,e,n){const o=this.nodeConnectTargetsMap.get(e)||[];o.length!==0&&requestIdleCallback(()=>{this.updateConnectTargetList(t,n,o)})}updateConnectTargetList(t,e,n){const o=this.options.canvasZoom/100,s=e.getBoundingClientRect();for(const r of n){const l=e.querySelector(`div[data-target-id="${r.targetId}"]`);if(!l){console.error("Can not find el for connectTarget:",r.targetId,r);continue}this.updateConnectTargetOffset(t,r,l,s,o)}this._dataUpdated()}updateConnectTargetOffset(t,e,n,o,s){const r=n.getBoundingClientRect(),l=Math.round(r.x-o.x),c=Math.round(r.y-o.y);e.offsetX=l/s,e.offsetY=c/s,e.width=r.width/s,e.height=r.height/s}_onConnectTargetMounted(t,e,n,o){const s=this.options.canvasZoom/100,r=o.getBoundingClientRect();this.updateConnectTargetOffset(t,e,n,r,s)}getNodeElByNodeId(t){return this.$dom.querySelector(`[data-id="${t}"]`)}getNodeElByChildrenTarget(t){return _t(t,"rg-node-peel","rg-map")}getConnectTargetById(t){if(!t)throw new Error("[getConnectTargetById]targetId is empty");for(let e=0;e<this.runtimeDATA4ConnectTargets.length;e++){const n=this.runtimeDATA4ConnectTargets[e];if(n.targetId===t)return n}}registerConnectTarget(t,e,n,o,s={}){if(n!==B.NodePoint&&n!==B.CanvasPoint)return;if(!t){console.error(`[registerConnectTarget]Can not find CanvasPoint target DOM: ${e}`);return}const r=this.getNodeElByChildrenTarget(t),l=r==null?void 0:r.dataset.id;if(l==="rg-newNodeTemplate")return;let c=this.getConnectTargetById(e);if(!c){const d={targetId:e,targetType:B.NodePoint,junctionPoint:U.border,nodeId:"",width:20,height:20,offsetX:0,offsetY:0,offsetPercentX:0,offsetPercentY:0,targetData:{}};this.runtimeDATA4ConnectTargets.push(d),c=this.getConnectTargetById(e)}if(l?this.getNodeById(l):null){c.junctionPoint=o,c.targetType=B.NodePoint,c.nodeId=l,c.targetData=Object.assign({},s||{},{nodeId:l});let d=this.nodeConnectTargetsMap.get(l);d?d.some(f=>f.targetId===c.targetId)||d.push(c):this.nodeConnectTargetsMap.set(l,[c]),this._onConnectTargetMounted("NT-Mounted",c,t,r)}else{const d=t.closest(".rg-canvas-slot");if(!d){console.error(`Can not find CanvasPoint target DOM's parent(.rg-canvas-slot) : ${e}`,t);return}const f=d.classList.contains("rg-canvas-slot-above")?"above":"behind";c.junctionPoint=o,c.targetType=B.CanvasPoint,c.targetData=Object.assign({},s||{});const p=this.canvasConnectTargetsMap.get(f);p?p.some(u=>u.targetId===c.targetId)||p.push(c):this.canvasConnectTargetsMap.set(f,[c]),this._onConnectTargetMounted("CT-Mounted",c,t,d)}return c}unregisterConnectTarget(t){if(this.options.performanceMode)return;const e=this.runtimeDATA4ConnectTargets.findIndex(n=>n.targetId===t);if(e!==-1){const n=this.runtimeDATA4ConnectTargets[e];if(n.targetType===B.NodePoint||n.targetType===B.CanvasPoint){this.runtimeDATA4ConnectTargets.splice(e,1);const o=n.nodeId&&this.nodeConnectTargetsMap.get(n.nodeId);if(o){const s=o.findIndex(r=>r.targetId===t);o.splice(s,1)}}}}setFakeLineTargetRender(t){this.fakeLineTargetRender=t}generateCreatingLineConfig(){const t=this.options,{newLinkTemplate:e,newLineTemplate:n}=t,o=e.fromNode;if(!o)return{line:n,from:null,to:null,totalLinesBetweenNodes:1,currentLineIndex:0};const s=e.toNode,r=s.targetType===B.Node?e.toNode:this.getFakeLineTarget(s.targetType,s.id,n);return{line:Object.assign({},n,{isFakeLine:!1}),from:this.getFakeLineTarget(o.targetType,o.id,n),to:r,totalLinesBetweenNodes:1,currentLineIndex:0}}getFakeLineTargetNode(t){return this.getNodeById(t)}getFakeLineTarget(t,e,n){if(t===B.HTMLElementId){let o=this.runtimeDATA4ElLineTargets.find(s=>s.id===e);return o||(o={x:300,y:300,targetType:B.HTMLElementId,nodeShape:1,id:e,el:{offsetWidth:40,offsetHeight:40},hidden:!0},this.runtimeDATA4ElLineTargets.push(o),this.updateCanvasBoxInfo(),this.updateElementTarget(o)),o.hidden?null:o}else{if(t===B.Node)return this.getFakeLineTargetNode(e);if(t===B.NodePoint||t===B.CanvasPoint){const o=this.getConnectTargetById(e);if(!o)return;if(o.nodeId){const s=this.getFakeLineTargetNode(o.nodeId);if(!s){console.error("[getFakeLineTarget]Can not find NodePoint-s Node:",`${o.targetId}@${o.nodeId}`);return}return{x:s.x+o.offsetPercentX*s.el.offsetWidth+o.offsetX,y:s.y+o.offsetPercentY*s.el.offsetHeight+o.offsetY,targetType:B.NodePoint,targetData:o.targetData,nodeShape:0,id:e,el:{offsetWidth:o.width,offsetHeight:o.height},hidden:!1}}else return{x:o.offsetX,y:o.offsetY,targetType:B.CanvasPoint,targetData:o.targetData,nodeShape:0,id:e,el:{offsetWidth:o.width,offsetHeight:o.height},hidden:!1}}}if(this.fakeLineTargetRender)return this.fakeLineTargetRender(t,e,n)}generateLineConfig(t){const e=this.getLinkByLine(t);return!e||!e.fromNode.rgCalcedVisible||!e.toNode.rgCalcedVisible?!1:{line:e.line,from:e.fromNode,to:e.toNode,totalLinesBetweenNodes:e.totalLinesBetweenNodes,currentLineIndex:e.currentLineIndex}}generateFakeLineConfig(t){let e=1,n=0;if(t.fromType===B.HTMLElementId&&t.toType===B.HTMLElementId){const r=this.graphData.fakeLines.filter(l=>l.from===t.from&&l.to===t.to);r.length>1&&(console.warn("sameTargetLines element-line:",t),e=r.length,n=r.indexOf(t))}let o=this.getFakeLineTarget(t.fromType,t.from,t),s=this.getFakeLineTarget(t.toType,t.to,t);return!o&&t.fromType===B.Node?(console.error("[generateFakeLineConfig]error fakeLine from:",t.fromType,t.from,t),!1):!s&&t.fromType===B.Node?(console.error("[generateFakeLineConfig]error fakeLine to:",t.toType,t.to,t),!1):{line:t,from:o,to:s,totalLinesBetweenNodes:e,currentLineIndex:n}}getShouldRenderFakeLines(){return this.graphData.fakeLines}getLinks(){return[...this.runtimeDATA4Links]}getRelatedLinesByNode(t){const e=[];for(const n of this.runtimeDATA4Links)(t===n.fromNode||t===n.toNode)&&e.push(n.line);return e}getLinesBetweenNodes(t){const e=[],n=this.runtimeDATA4Links;for(const o of n)t.includes(o.fromNode)&&t.includes(o.toNode)&&e.push(o.line);return e}transRGNodeToJsonObject(t){return Lt(t)}transRGLinkToJsonObject(t){const e=[];return wt(t,e),e}transRGLineToJsonObject(t){return Xt(t)}getGraphJsonData(){const t=[],e=[];return this.graphData.nodes.forEach(n=>{const o=Lt(n);o&&t.push(o)}),this.runtimeDATA4Links.forEach(n=>{wt(n,e)}),{rootId:this.graphData.rootNode?this.graphData.rootNode.id:"",nodes:t,lines:e}}getGraphJsonOptions(){const t={},e=["layouter","autoLayouting","canvasNVInfo","canvasOffset","canvasZoom","fullscreen","instanceId","layoutClassName","layoutDirection","layoutLabel","layoutName","resetViewSize","viewELSize","viewNVInfo","viewSize","canvasSize","newLinkTemplate","newLineTemplate","newNodeTemplate"];return Object.keys(this.options).forEach(n=>{e.includes(n)||(t[n]=this.options[n])}),t}printGraphJsonData(){console.log("graph options:",JSON.stringify(this.getGraphJsonOptions())),console.log("graph json data:",JSON.stringify(this.getGraphJsonData()))}getNodeById(t){for(let e=0;e<this.graphData.nodes.length;e++)if(this.graphData.nodes[e].id===t)return this.graphData.nodes[e]}addNode(t){if(v("addNode:",t),t&&Array.isArray(t)){console.error("addNode: node is array:",t);return}this.loadNodes([t]),this._dataUpdated()}addNodes(t){if(v("addNodes:",t),t&&!Array.isArray(t)){console.error("addNodes: nodes is not array:",t);return}this.loadNodes(t),this._dataUpdated()}getLinkById(t){for(let e=0;e<this.runtimeDATA4Links.length;e++)if(this.runtimeDATA4Links[e].seeks_id===t)return this.runtimeDATA4Links[e]}getLinkByLineId(t){for(let e=0;e<this.runtimeDATA4Links.length;e++)if(this.runtimeDATA4Links[e].line.id===t)return this.runtimeDATA4Links[e]}getLinkByLine(t){return this.getLinkByLineId(t.id)}getLineById(t){for(let e=0;e<this.runtimeDATA4Links.length;e++)if(this.runtimeDATA4Links[e].line.id===t)return this.runtimeDATA4Links[e].line}getLines(){const t=[];for(const e of this.runtimeDATA4Links)t.push(e.line);return t}addLine(t){if(v("addLine:",t),t&&Array.isArray(t)){console.error("addLine: line is array:",t);return}this.addLines([t])}addLines(t){if(v("addLines:",t),t&&!Array.isArray(t)){console.error("addLines: lines is not array:",t);return}if(t.length===0)return;const e=t.filter(o=>!o.isFakeLine);this.loadLines(e);const n=t.filter(o=>o.isFakeLine);this.addFakeLines(n),this._dataUpdated()}removeLine(t){if(!t)throw new Error("removeLine: line is null");if(t.isFakeLine){this.removeFakeLine(t);return}let e=this.getLinkByLine(t);if(!e){v("Can not find link by line:",t);return}v("removeLine:",e,t);const n=this.graphData.normalLines.findIndex(o=>o.id===t.id);n!==-1&&this.graphData.normalLines.splice(n,1),this.removeLink(e),this.updateLinks([e]),this._dataUpdated()}removeLineById(t){let e=this.getFakeLineById(t);if(e){this.removeFakeLine(e);return}v("removeLineById:",t),this.removeLine(this.getLineById(t))}removeLink(t){v("removeLink:",t),this.removeLinkById(t.seeks_id),this._dataUpdated()}removeLinkById(t){v("removeLinkById:",t);for(let e=0;e<this.runtimeDATA4Links.length;e++)if(this.runtimeDATA4Links[e].seeks_id===t){this.runtimeDATA4Links.splice(e,1);break}this._dataUpdated()}getFakeLines(){return[...this.graphData.fakeLines]}addFakeLines(t){v("addFakeLines:",t);for(const e of t)if(e.id||console.warn("Must have id for fake line:",e),this.graphData.fakeLines.some(n=>n.id===e.id))console.error("Ignore duplicate fake line id:",e.id);else{e.isFakeLine=!0;const n=ct(e);n.forDisplayOnly=!0,n.id||(n.id=this.generateNewUUID(6)),this.graphData.fakeLines.push(n)}setTimeout(()=>{this._dataUpdated(),setTimeout(()=>{this._dataUpdated()},300)},100)}removeFakeLine(t){v("removeLine:",t),this.removeFakeLineById(t.id)}getFakeLineById(t){return this.graphData.fakeLines.find(e=>e.id===t)}removeFakeLineById(t){v("removeLineById:",t);for(let e=0;e<this.graphData.fakeLines.length;e++)if(this.graphData.fakeLines[e].id===t){this.graphData.fakeLines.splice(e,1);break}this._dataUpdated()}addElementLines(t){v("addElementLines:",t),t.forEach(e=>{e.fromType=B.HTMLElementId,e.toType=B.HTMLElementId,e.isFakeLine=!0,e.id||(e.id=this.generateNewUUID(6)),e.forDisplayOnly=!0}),this.addFakeLines(t),console.log("addElementLines:",t.length,t),this.updateElementLines()}getElementLineById(t){return this.getFakeLineById(t)}getElementLines(){return this.getFakeLines()}removeELementLineById(t){v("removeELementLineById:",t),this.removeFakeLineById(t)}updateElementLines(){v("updateElementLines:runtimeDATA4ElLineTargets:",this.runtimeDATA4ElLineTargets.length),this.runtimeDATA4ElLineTargets.length!==0&&(this.elLineUpdating||(this.elLineUpdating=!0,setTimeout(()=>{this.elLineUpdating=!1,this._updateElementLines()},50)))}_updateElementLines(){this.updateCanvasBoxInfo();for(const t of this.runtimeDATA4ElLineTargets)this.updateElementTarget(t);this._dataUpdated()}updateCanvasBoxInfo(){const t=this.$canvasDom.getBoundingClientRect();this._canvasBoxXY.x=t.x,this._canvasBoxXY.y=t.y}updateElementTarget(t){const e=document.getElementById(t.id);e&&(t.hidden=!e),this._updateElementLinePosition(e,t)}_updateElementLinePosition(t,e){if(!t)return;const n=t.getBoundingClientRect();e.x=(n.x-this._canvasBoxXY.x)/(this.options.canvasZoom/100),e.y=(n.y-this._canvasBoxXY.y)/(this.options.canvasZoom/100);const o=n.width/(this.options.canvasZoom/100),s=n.height/(this.options.canvasZoom/100);o>2&&Math.abs(o-e.el.offsetWidth)>2&&(e.el.offsetWidth=o),s>2&&Math.abs(s-e.el.offsetHeight)>2&&(e.el.offsetHeight=s)}getElementPosition(t){const n=document.getElementById(t).getBoundingClientRect(),o=this.$canvasDom.getBoundingClientRect(),s=(n.x-o.x)/(this.options.canvasZoom/100),r=(n.y-o.y)/(this.options.canvasZoom/100);return{x:s,y:r}}removeNodeById(t){let e=0;for(let o=0;o<this.runtimeDATA4Links.length;o++){const s=this.runtimeDATA4Links[o];(s.fromNode.id===t||s.toNode.id===t)&&(this.removeLink(s),o--,e++)}v("Removed Node link\uFF1A",t,e),this.beforeNodeBeRemove(t),v("Removed Node line/connect-arget\uFF1A",t);let n=0;for(let o=0;o<this.graphData.nodes.length;o++)if(this.graphData.nodes[o].id===t){this.graphData.nodes.splice(o,1),this.runtimeDATA4NodeMap[t]=void 0,delete this.runtimeDATA4NodeMap[t],n++;break}v("Removed node\uFF1A",t,n),this._dataUpdated()}removeNode(t){this.removeNodeById(t.id),this._dataUpdated()}getNodeRelatedNodes(t){const e=[];for(const n of this.runtimeDATA4Links)n.forDisplayOnly||(n.fromNode===t?e.push(n.toNode):n.toNode===t&&e.push(n.fromNode));return e}getNodeRelatedNodes4From(t){const e=[];for(const n of this.runtimeDATA4Links)n.forDisplayOnly||n.toNode===t&&e.push(n.fromNode);return e}getNodeRelatedNodes4To(t){const e=[];for(const n of this.runtimeDATA4Links)n.forDisplayOnly||n.fromNode===t&&e.push(n.toNode);return e}beforeNodeBeRemove(t){for(let e=0;e<this.graphData.fakeLines.length;e++){const n=this.graphData.fakeLines[e];let o=!1;if(n.fromType===B.Node&&n.from===t)o=!0;else if(n.fromType===B.CanvasPoint||n.fromType===B.NodePoint){const s=this.getConnectTargetById(n.from);s&&s.nodeId===t&&(o=!0)}else if(n.toType===B.CanvasPoint||n.toType===B.NodePoint){const s=this.getConnectTargetById(n.to);s&&s.nodeId===t&&(o=!0)}o&&(this.graphData.fakeLines.splice(e,1),e--)}for(let e=0;e<this.runtimeDATA4ConnectTargets.length;e++)this.runtimeDATA4ConnectTargets[e].nodeId===t&&(this.runtimeDATA4ConnectTargets.splice(e,1),e--)}setNodePosition(t,e,n){t.x=e,t.y=n}getGraphOffet(){const t=this.options.graphOffset_x||0,e=this.options.graphOffset_y||0;return{offset_x:t,offset_y:e}}setCanvasCenter(t,e){const n=this.options.viewSize.width/2,o=this.options.viewSize.height/2,s=this.getGraphOffet();this.setZoom(100),this.setCanvasOffset(n-t+s.offset_x,o-e+s.offset_y)}setCanvasOffset(t,e){this.options.canvasOffset.x=t,this.options.canvasOffset.y=e,!this.canvasDragging&&this._dataUpdated()}findGroupNodes(t,e=[]){return this.getNetworkNodesByNode(t,e)}getGroupNodesByNode(t,e=[]){return this.getNetworkNodesByNode(t,e)}getNetworkNodesByNode(t,e=[]){if(!t)throw new Error("Call graphInstance.getNetworkNodesByNode:error: node is undefined");e.includes(t)||e.push(t);for(const n of this.getNodeRelatedNodes(t))e.includes(n)||this.getNetworkNodesByNode(n,e);return e}getDescendantNodes(t){return A.getDescendantNodes(t)}resetViewSize(t=!1){if(!this.options)return;const e=this.$dom.getBoundingClientRect();this.options.viewSize.width=e.width,this.options.viewSize.height=e.height,this._rgAsConnectArea?(this.options.canvasZoom=100,this.options.canvasOffset.x=0,this.options.canvasOffset.y=0):t&&(this.options.canvasZoom=100,this.setCanvasCenter(0,0)),v("resetViewSize:1:",this.options.viewSize.width,this.options.viewSize.height,this.options.canvasOffset.x,this.options.canvasOffset.y),this.updateViewBoxInfo(),this._dataUpdated()}updateViewBoxInfo(){if(!this.$dom){console.error("cannot get view size !");return}const t=this.$dom.getBoundingClientRect();v("resetViewSize:",t.width,t.height,t.left,t.top),this.options.viewELSize.width=t.width,this.options.viewELSize.height=t.height,this.options.viewELSize.left=t.left,this.options.viewELSize.top=t.top}getStuffSize(t){const n=(t||this.graphData.nodes).filter(d=>d.rgCalcedVisible!==!1);if(n.length===0)return{width:10,height:10,minX:0,minY:0,maxX:0,maxY:0};let o=9999999,s=9999999,r=-9999999,l=-9999999;n.forEach(d=>{d.x<o&&(o=d.x),d.x+d.el.offsetWidth>r&&(r=d.x+d.el.offsetWidth),d.y<s&&(s=d.y);const p=d.y+d.el.offsetHeight;p>l&&(l=p)});const c=r-o,h=l-s;return{width:c<0?0:c,height:h<0?0:h,minX:o===9999999?0:o,minY:s===9999999?0:s,maxX:r===-9999999?0:r,maxY:l===-9999999?0:l}}getNodesViewInfo(t){return this.getStuffSize(t)}getNodesCenter(t){const e=this.getStuffSize(t);v("getStuffSize:",e);const n=e.minX+(e.maxX-e.minX)/2,o=e.minY+(e.maxY-e.minY)/2;return{x:n,y:o}}printOptions(){const t=this.getGraphJsonOptions();console.log("options:",t),console.log("options-json-string:"),console.log(JSON.stringify(t))}printData(){const t=this.getGraphJsonData();console.log("data:",t),console.log("data-json-string:"),console.log(JSON.stringify(t))}loading(t=""){this.options.graphLoading=!0,this.options.graphLoadingText=t}clearLoading(){this.options.graphLoading=!1,this.options.graphLoadingText=""}updateShouldRenderGraphData(t=!1){!t&&!this.options.performanceMode||this._updateShouldRenderGraphData()}_updateShouldRenderGraphData(){const t=this.getBoundingClientRect(),e=this.getCanvasXyByClientXy({x:t.x,y:t.y}),n=this.getCanvasXyByClientXy({x:t.x+this.options.viewELSize.width,y:t.y+this.options.viewELSize.height}),o=this.options.snapshotting;let s=0;for(const r of this.graphData.nodes){let l=!0;o||r.alwaysRender?l=!0:((r.x>n.x||r.y>n.y)&&(l=!1),(r.x+r.el.offsetWidth<e.x||r.y+r.el.offsetHeight<e.y)&&(l=!1)),r.rgShouldRender=l,l&&s++}for(const r of this.runtimeDATA4Links){if(o){r.rgShouldRender=!0;continue}r.rgShouldRender=r.fromNode.rgShouldRender||r.toNode.rgShouldRender}this.options.showEasyView&&s>1e3?(this.runtimeDATA4ShouldRenderGraphData.nodes=[],this.runtimeDATA4ShouldRenderGraphData.lines=[]):(this.runtimeDATA4ShouldRenderGraphData.nodes=this.calcShouldRenderNodes(),this.runtimeDATA4ShouldRenderGraphData.lines=this.calcShouldRenderLines()),v("updateShouldRenderGraphData:",this.options.showEasyView,n.x,s)}updateNodesVisibleProperty(){for(const t of this.graphData.nodes)t.rgCalcedVisible=A.isVisibleNode(t);for(const t of this.runtimeDATA4Links)t.rgCalcedVisible=t.fromNode.rgCalcedVisible&&t.toNode.rgCalcedVisible&&!t.line.hidden}setCanvasMoveMode(t){this.options.canvasMoveMode=t,this._dataUpdated()}defaultLineConnectEndHandler(t,e,n){v("defaultLineConnectEndHandler:",t,e,n)}defaultLineVertexBeChangedHandler(t,e,n){v("defaultLineVertexBeChangedHandler:",n&&n.isReverse)}}class en extends tn{constructor(t,e){super(t,e);S(this,"$watermarkDom",null);S(this,"$watermarkPosition","br");S(this,"$backgroundDom",null)}setWatermarkDom(t,e=!0,n=!1,o="br"){e&&(this.$watermarkDom=t),this.$watermarkPosition=o}setBackgroundDom(t,e=!0,n=!0){e&&(this.$backgroundDom=t)}dataURLToBlob(t){try{const e=t.split(","),n=e[0],o=n&&n.match(/:(.*?);/)[1],s=atob(e[1]);let r=s.length;const l=new Uint8Array(r);for(;r--;)l[r]=s.charCodeAt(r);return new Blob([l],{type:o})}catch(e){console.error("[relation-graph]Create and download image error:dataURLToBlob:dataurl",t),console.error("[relation-graph]error object",e)}}async createGraphCanvas(t="png"){const e=this.options.canvasZoom,n=this.$canvasDom.clientWidth,o=this.$canvasDom.clientHeight,s=this.options.layout.autoLayouting;s&&this.stopAutoLayout(),this.loading("Generating..."),this.options.snapshotting=!0;const r=await this.createGraphMainCanvas(t),l=this.$backgroundDom?await this.createGraphBackgroundCanvas(t):null,c=this.$watermarkDom?await this.createGraphWatermarkCanvas(t):null,h=this.mergeCanvas(l,r,c);return this.options.canvasSize.width=n,this.options.canvasSize.height=o,this.options.snapshotting=!1,this._zoomEnd(100,e),this.updateShouldRenderGraphData(),this.updateElementLines(),s&&this.startAutoLayout(),this.clearLoading(),this.dataUpdated(),h}mergeCanvas(t,e,n){const o=window.devicePixelRatio,s=document.createElement("canvas"),r=this.options.canvasSize.width,l=this.options.canvasSize.height;s.width=r*o,s.height=l*o,s.style.width=`${r}px`,s.style.height=`${l}px`;const c=s.getContext("2d");if(s.getContext("2d").scale(1,1),t?c.drawImage(t,0,0):(c.fillStyle=!this.options.backgroundColor||this.options.backgroundColor==="transparent"?"#ffffff":this.options.backgroundColor,c.fillRect(0,0,s.width,s.height)),c.drawImage(e,0,0),n){const h=this.$watermarkDom.getBoundingClientRect(),d=h.width,f=h.height;let p=r-d-20,u=l-f-20;this.$watermarkPosition==="bl"?(p=20,u=l-f-20):this.$watermarkPosition==="tl"?(p=20,u=20):this.$watermarkPosition==="tr"&&(p=r-d-20,u=20),c.drawImage(n,p*o,u*o)}return s}async createGraphBackgroundCanvas(t="png"){const e=window.devicePixelRatio,n=document.createElement("canvas"),o=this.options.canvasSize.width,s=this.options.canvasSize.height;n.width=o*e,n.height=s*e,n.style.width=`${o}px`,n.style.height=`${s}px`,n.getContext("2d").scale(e,e);const r=this.$backgroundDom;r.style.width=this.options.canvasSize.width+"px",r.style.height=this.options.canvasSize.height+"px";const l={backgroundColor:"#ffffff",scale:1,canvas:n,logging:!0,width:this.options.canvasSize.width,height:this.options.canvasSize.height,useCORS:!0},c=await this.createImage(r,l,t,"");return r.style.width="",r.style.height="",c}async createGraphWatermarkCanvas(t="png"){const e=this.$canvasDom.clientWidth,n=this.$canvasDom.clientHeight,o=window.devicePixelRatio,s=document.createElement("canvas");s.width=e*o,s.height=n*o,s.style.width=`${e}px`,s.style.height=`${n}px`,s.getContext("2d").scale(o,o);const r=this.$watermarkDom,l={backgroundColor:"transparent",scale:1,canvas:s,logging:!0,width:e,height:n,useCORS:!0};return await this.createImage(r,l,t,"")}async createGraphMainCanvas(t="png"){const e=this.options.canvasZoom,n=this.options.canvasOffset.x,o=this.options.canvasOffset.y;this.options.checkedNodeId="",this.options.canvasZoom=100,this._zoomEnd(e,this.options.canvasZoom),this.updateShouldRenderGraphData(!0),await ft(500);const s=this.$canvasDom;let r=999999,l=999999,c=-999999,h=-999999;this.graphData.nodes.forEach(E=>{E.x<r&&(r=E.x);const T=E.x+E.el.offsetWidth;T>c&&(c=T);const D=E.y+E.el.offsetHeight;E.y<l&&(l=E.y),D>h&&(h=D)});const d=new WeakMap,f=this.$dom.querySelectorAll("> .rg-map-canvas > .rg-canvas-slot");for(const E of f){let T=999999,D=999999,R=-999999,_=-999999;for(const z of E.children){const F=z,V=F.offsetLeft,P=F.offsetTop;V<T&&(T=V),V>R&&(R=V+F.offsetWidth),P<D&&(D=P),P>_&&(_=P+F.offsetHeight)}T<r&&(r=T),D<l&&(l=D),R>c&&(c=R),_>h&&(h=_),T!==999999&&d.set(E,{offsetX:T,offsetY:D})}const p=200;r=r-p,l=l-p,c=c+p,h=h+p;const u=r,g=l;this.graphData.nodes.forEach(E=>{E.x=E.x-u,E.y=E.y-g});for(const E of f){const T=E;T.style.marginLeft=-u+"px",T.style.marginTop=-g+"px"}this.updateElementLines();const x=this.$canvasDom.querySelectorAll(".rg-lines-svg-el-lines");x.forEach(E=>{const T=E;T.style.width="4000px",T.style.height="4000px"}),this.options.canvasOffset.x=0,this.options.canvasOffset.y=0;const y=c-r,L=h-l,m=window.devicePixelRatio;this.options.canvasSize.width=y,this.options.canvasSize.height=L,v("export image:",{_image_width:y,_image_height:L,_min_x:r,_min_y:l,_max_x:c,_max_y:h,devicePixelRatio:window.devicePixelRatio}),window.scrollTo(0,0);const w=document.createElement("canvas"),b=y,M=L;w.width=b*m,w.height=M*m,w.style.width=`${b}px`,w.style.height=`${M}px`,w.getContext("2d").scale(m,m);const N={backgroundColor:"transparent",scale:1,canvas:w,logging:!0,width:this.options.canvasSize.width,height:this.options.canvasSize.height,useCORS:!0};this.dataUpdated(),await ft(1e3);const O=await this.createImage(s,N,t,"");return f.forEach(E=>{const T=E;T.style.marginLeft="0px",T.style.marginTop="0px"}),this.graphData.nodes.forEach(E=>{E.x=E.x+u,E.y=E.y+g}),x.forEach(E=>{const T=E;T.style.width="1px",T.style.height="1px"}),this.options.canvasOffset.x=n,this.options.canvasOffset.y=o,this.options.canvasZoom=e,O}async createImage(t,e,n,o){v("createImage:",e);const s=window.getHtml2canvas();if(!s){console.error('Please define function window.getHtml2canvas, Make sure you can get "html2canvas" through the following code: const html2canvas = window.getHtml2canvas();');return}return await s(t,e)}async getImageBase64(t="png"){throw new Error("getImageBase64 is deprecated, Please get dom and trans to image by yourself!")}async downloadAsImage(t="png",e){if(this.emitEvent(I.onImageDownload,this.$canvasDom,t)===!1)return;if(this.graphData.nodes.length===0)throw new Error("No nodes, no content to export!");e||(e=this.options.downloadImageFileName),e||(e=`relation-graph-${(Math.random()*1e5).toFixed(0)}`);const o=await this.createGraphCanvas(t);v("downloadImageAsFile:",t,e),this.emitEvent(I.onImageDownload,this.$canvasDom,t)!==!1&&await this.downloadImageAsFile(o,t,e)}async downloadImageAsFile(t,e,n){const o=document.body.appendChild(t);o.style.display="none";const s=this.dataURLToBlob(o.toDataURL(`image/${e}`));document.body.removeChild(o);const r=document.createElement("a");r.style.display="none";try{window.navigator.msSaveOrOpenBlob?window.navigator.msSaveOrOpenBlob(s,`${n}.${e}`):(r.setAttribute("href",URL.createObjectURL(s)),r.setAttribute("download",`${n}.${e}`),document.body.appendChild(r),r.click(),v("click ok!"),URL.revokeObjectURL(await s.text()),v("revokeObjectURL ok!"),document.body.removeChild(r),v("removeChild ok!"))}catch(l){v("[relation-graph]Create and download image error:",l)}}}const ht=i=>!i||i.length===0?"":i.map(a=>{switch(a.type){case"M":return`${a.type} ${a.x} ${a.y}`;case"l":return`${a.type} ${a.dx} ${a.dy}`;case"L":return`${a.type} ${a.x} ${a.y}`;case"h":return`${a.type} ${a.dx}`;case"v":return`${a.type} ${a.dy}`;case"c":return`${a.type} ${a.dx1} ${a.dy1} ${a.dx2} ${a.dy2} ${a.dx} ${a.dy}`;case"s":return`${a.type} ${a.dx2} ${a.dy2} ${a.dx} ${a.dy}`;case"q":return`${a.type} ${a.dx1} ${a.dy1} ${a.dx} ${a.dy}`;case"Q":return`${a.type} ${a.x1} ${a.y1} ${a.x} ${a.y}`;case"t":return`${a.type} ${a.dx} ${a.dy}`;case"a":return`${a.type} ${a.rx} ${a.ry} ${a.xAxisRotation} ${a.largeArcFlag} ${a.sweepFlag} ${a.dx} ${a.dy}`;case"Z":return a.type;default:return console.warn("\u672A\u77E5\u7684\u8DEF\u5F84\u547D\u4EE4\u7C7B\u578B:",a),""}}).join(" ").trim(),Zt=i=>{const a=i.match(/[a-zA-Z][^a-zA-Z]*/g);let t=0,e=0,n=0,o=0,s=0,r=0,l=0,c=0;const h={x:0,y:0},d={x:0,y:0},f=[];for(const p of a){const u=p.trim().split(/[ ,]+/),g=u[0].toUpperCase(),x=u[0]===u[0].toLowerCase();switch(g){case"M":t=J(n,u[1],x),e=J(o,u[2],x),n=t,o=e;break;case"L":t=J(n,u[1],x),e=J(o,u[2],x),f.push({x:t,y:e});break;case"C":s=J(n,u[1],x),r=J(o,u[2],x),l=J(n,u[3],x),c=J(o,u[4],x),t=J(n,u[5],x),e=J(o,u[6],x),n=t,o=e;break;case"Q":s=J(n,u[1],x),r=J(o,u[2],x),t=J(n,u[3],x),e=J(o,u[4],x),n=t,o=e;break;case"V":e=J(o,u[1],x),o=e;break;case"H":t=J(n,u[1],x),n=t;break;case"Z":break;default:console.log(`Unsupported command: ${g}`)}p===a[0]&&(h.x=t,h.y=e),p===a[a.length-1]&&(d.x=t,d.y=e)}return{startPoint:h,ctrl1:{x:s,y:r},ctrl2:{x:l,y:c},endPoint:d,lines:f}},J=(i,a,t)=>t?i+parseFloat(a):parseFloat(a),nn=(i,a={x:0,y:0,rotate:0})=>{const{fx:t,fy:e,tx:n,ty:o}=i;a.rotate=Z.getTextAngle(t,e,n,o),a.x=Math.round(t+(n-t)/2),a.y=Math.round(e+(o-e)/2),Number.isNaN(a.rotate)&&(a.rotate=0);const s=Math.round(n-t),r=Math.round(o-e),l=[{type:"M",x:Math.round(t),y:Math.round(e)},{type:"l",dx:s,dy:r}],c=ht(l);return{pathCommands:l,pathData:c,textPosition:a,points:[]}},on=(i,a={x:0,y:0,rotate:0},t={})=>{const{line:e,fx:n,fy:o,fcx:s,fcy:r,f_W:l,f_H:c,tx:h,ty:d,tcx:f,tcy:p,t_W:u,t_H:g}=i,x=h-n,y=d-o,L=n-s,m=o-r,w=h-f,b=d-p,M=e.lineRadius!==void 0?e.lineRadius:t.lineRadius||0,N=Math.min(M,Math.abs(x))*(n<h?1:-1),O=Math.min(M,Math.abs(y))*(o<d?1:-1),E=e.lineDirection||Math.abs(L)>=l/2?"h":"v",T=e.lineDirection||Math.abs(w)>=u/2?"h":"v",D=[];let R=0,_=0;if(E==="v"){const F=e.polyLineStartDistance||Math.max(Math.min(30,Math.abs(d-o)/2),15),V=m>0?F:-F;if(e.onPathStartOffset==="start"?(R=n,_=o+V-(m>0?20:-5)):e.onPathStartOffset==="middle"?(R=n+(h-n)/2,_=o+V):(R=h,_=o+V+(m>0?20:-5)),D.push({type:"M",x:Math.round(n),y:Math.round(o)},{type:"v",dy:Math.round(V-O)},{type:"c",dx1:0,dy1:Math.round(O),dx2:Math.round(N),dy2:Math.round(O),dx:Math.round(N),dy:Math.round(O)}),T==="v")D.push({type:"h",dx:Math.round(h-n-N*2)},{type:"c",dx1:Math.round(N),dy1:0,dx2:Math.round(N),dy2:Math.round(O),dx:Math.round(N),dy:Math.round(O)},{type:"v",dy:Math.round(d-o-V-O)});else{const P=Math.min(30,Math.abs(h-n)/2),$=w>0?-P:P;D.push({type:"h",dx:Math.round(h-n+$-N)},{type:"c",dx1:Math.round(N),dy1:0,dx2:Math.round(N),dy2:Math.round(O),dx:Math.round(N),dy:Math.round(O)},{type:"v",dy:Math.round(d-o-V-O)},{type:"h",dx:Math.round($-N)})}}else{const F=e.polyLineStartDistance||Math.max(Math.min(30,Math.abs(h-n)/2),15),V=L>0?F:-F;if(e.onPathStartOffset==="start"?(R=n+(L>0?10:-50),_=o-5):e.onPathStartOffset==="center"||e.onPathStartOffset==="middle"?(R=n+V,_=o+(d-o)/2):(R=n+V+(L>0?20:-50),_=d-5),D.push({type:"M",x:Math.round(n),y:Math.round(o)},{type:"h",dx:Math.round(V-N)},{type:"c",dx1:Math.round(N),dy1:0,dx2:Math.round(N),dy2:Math.round(O),dx:Math.round(N),dy:Math.round(O)}),T==="v"){const P=Math.min(30,Math.abs(d-o)/2),$=b>0?-P:P;D.push({type:"v",dy:Math.round(d-o+$-O)},{type:"h",dx:Math.round(h-n-V-N)},{type:"c",dx1:0,dy1:Math.round(O),dx2:Math.round(N),dy2:Math.round(O),dx:Math.round(N),dy:Math.round(O)},{type:"v",dy:Math.round($-O)})}else D.push({type:"v",dy:Math.round(d-o-O*2)},{type:"c",dx1:0,dy1:Math.round(O),dx2:Math.round(N),dy2:Math.round(O),dx:Math.round(N),dy:Math.round(O)},{type:"h",dx:Math.round(h-n-V-N)})}a.x=R,a.y=_;const z=ht(D);return{pathCommands:D,pathData:z,textPosition:a,points:[]}},bt={left:{x:-1,y:0},right:{x:1,y:0},top:{x:0,y:-1},bottom:{x:0,y:1}},sn=({source:i,sourcePosition:a="bottom",target:t})=>a==="left"||a==="right"?i.x<t.x?{x:1,y:0}:{x:-1,y:0}:i.y<t.y?{x:0,y:1}:{x:0,y:-1},Jt=(i,a)=>Math.sqrt(Math.pow(a.x-i.x,2)+Math.pow(a.y-i.y,2));function Pt({source:i,sourcePosition:a="bottom",target:t,targetPosition:e="top",center:n,sourceOffset:o,targetOffset:s}){const r=bt[a],l=bt[e],c={x:i.x+r.x*o,y:i.y+r.y*o},h={x:t.x+l.x*s,y:t.y+l.y*s},d=sn({source:c,sourcePosition:a,target:h}),f=d.x!==0?"x":"y",p=d[f];let u=[],g,x;const y={x:0,y:0},L={x:0,y:0};let m=0;if(r[f]*l[f]===-1){g=n.x,x=n.y;const b=[{x:g,y:c.y},{x:g,y:h.y}],M=[{x:c.x,y:x},{x:h.x,y:x}];r[f]===p?(m=1.1,u=f==="x"?b:M):(m=1.2,u=f==="x"?M:b)}else{const b=[{x:c.x,y:h.y}],M=[{x:h.x,y:c.y}];if(f==="x"?u=r.x===p?M:b:u=r.y===p?b:M,a===e){m=2.1;const D=Math.abs(i[f]-t[f]),R=r[f]===p?o:s;if(D<=R){const _=Math.min(R-1,R-D);r[f]===p?y[f]=(c[f]>i[f]?-1:1)*_:L[f]=(h[f]>t[f]?-1:1)*_}}if(a!==e){m=2.2;const D=f==="x"?"y":"x",R=r[f]===l[D],_=c[D]>h[D],z=c[D]<h[D];(r[f]===1&&(!R&&_||R&&z)||r[f]!==1&&(!R&&z||R&&_))&&(u=f==="x"?b:M)}const N={x:c.x+y.x,y:c.y+y.y},O={x:h.x+L.x,y:h.y+L.y},E=Math.max(Math.abs(N.x-u[0].x),Math.abs(O.x-u[0].x)),T=Math.max(Math.abs(N.y-u[0].y),Math.abs(O.y-u[0].y));E>=T?(g=(N.x+O.x)/2,x=u[0].y):(g=u[0].x,x=(N.y+O.y)/2)}const w=[i,{x:c.x+y.x,y:c.y+y.y},...u,{x:h.x+L.x,y:h.y+L.y},t];return an(w),[w,g,x,0,0,m]}const an=i=>{for(let a=0;a<i.length;a++){const t=i[a];t.x=Math.round(t.x),t.y=Math.round(t.y)}},Ot=i=>{const a=[];for(let t=0;t<i.length;t++){const e=i[t];if(e.x=Math.round(e.x),e.y=Math.round(e.y),t===0||t===i.length-1)a.push(e);else{const n=a[a.length-1];e.x===n.x&&e.y===n.y||a.push(e)}}for(let t=2;t<a.length;t++){const e=a[t-2],n=a[t-1],o=a[t],s=e.x===n.x?"v":"h",r=n.x===o.x?"v":"h";s===r&&(n.merged=!0)}return a.filter(t=>t.merged!==!0)};function rn(i,a,t,e){const n=Math.min(Jt(i,a)/2,Jt(a,t)/2,e),{x:o,y:s}=a;if(i.x===o&&o===t.x||i.y===s&&s===t.y)return[{type:"L",x:o,y:s}];if(i.y===s){const c=i.x<t.x?-1:1,h=i.y<t.y?1:-1;return[{type:"L",x:o+n*c,y:s},{type:"Q",x1:o,y1:s,x:o,y:s+n*h}]}const r=i.x<t.x?1:-1,l=i.y<t.y?-1:1;return[{type:"L",x:o,y:s+n*l},{type:"Q",x1:o,y1:s,x:o+n*r,y:s}]}const me=(i,a)=>{const t=[];return i.forEach((e,n)=>{if(n===0)t.push({type:"M",x:Math.round(e.x),y:Math.round(e.y)});else if(n===i.length-1){const o=i[n-1],s=o.x===e.x?0:o.x<e.x?-1:1,r=o.y===e.y?0:o.y<e.y?-1:1;t.push({type:"l",dx:Math.round(e.x-o.x+s*5),dy:Math.round(e.y-o.y+r*5)})}else{const o=rn(i[n-1],e,i[n+1],a);t.push(...o)}}),t};var ot=(i=>(i.border="border",i.ltrb="ltrb",i.tb="tb",i.lr="lr",i.left="left",i.right="right",i.top="top",i.bottom="bottom",i))(ot||{});const St=(i,a,t,e,n,o,s,r)=>i==="left"?"left":i==="right"?"right":i==="top"?"top":i==="bottom"?"bottom":i==="horizontalLine"?e?o>r?"bottom":"top":o<r?"bottom":"top":i==="verticalLine"?e?n>s?"right":"left":n<s?"right":"left":a===1?"right":a===-1?"left":t===1?"bottom":t===-1?"top":"left",qt=i=>i==="left"?"right":i==="right"?"left":i==="top"?"bottom":i==="bottom"?"top":"left",xe=i=>{if(i.length<2)throw new Error("At least two points are required to form a polyline.");let a=0;const t=[];for(let o=1;o<i.length;o++){const s=i[o].x-i[o-1].x,r=i[o].y-i[o-1].y,l=Math.sqrt(s*s+r*r);t.push(l),a+=l}const e=a/2;let n=0;for(let o=0;o<t.length;o++)if(n+=t[o],n>=e){const s=i[o],r=i[o+1],l=t[o],h=(e-(n-l))/l,d=s.x+(r.x-s.x)*h,f=s.y+(r.y-s.y)*h;return{x:d,y:f}}return{x:0,y:0}},ln=(i,a={x:0,y:0,rotate:0},t={})=>{const{line:e,fromJunctionPoint:n,toJunctionPoint:o,lineDirection:s,lineShape:r,fx:l,fy:c,fcx:h,fcy:d,f_W:f,f_H:p,tx:u,ty:g,tcx:x,tcy:y,t_W:L,t_H:m}=i,w=l-h,b=c-d;let M=w>3?1:w<-3?-1:0,N=b>3?1:b<-3?-1:0;Math.abs(M)===1&&Math.abs(N)===1&&(Math.abs(w)>Math.abs(b)?N=0:M=0),M===0&&N===0&&(M=1);const O=u-x,E=g-y;let T=O>3?1:O<-3?-1:0,D=E>3?1:E<-3?-1:0;Math.abs(T)===1&&Math.abs(D)===1&&(Math.abs(O)>Math.abs(E)?D=0:T=0),T===0&&D===0&&(M=-1);const R=St(n,M,N,!1,l,c,u,g),_=St(o,T,D,!0,l,c,u,g),z=e.isReverse?_:R,F=e.isReverse?R:_,V=l+(u-l)/2,P=c+(g-c)/2;let $={x:0,y:0},Y=30,j=30;e.ctrlOptionsFor44&&($={x:e.ctrlOptionsFor44.cx,y:e.ctrlOptionsFor44.cy},Y+=e.ctrlOptionsFor44.fd,j+=e.ctrlOptionsFor44.td);const X=e.lineRadius!==void 0?e.lineRadius:t.lineRadius||0,[st]=Pt({source:{x:l,y:c},sourcePosition:z,target:{x:u,y:g},targetPosition:F,center:{x:V+$.x,y:P+$.y},sourceOffset:Y,targetOffset:j}),et=Ot(st),K=me(et,X),tt=ht(K),at=xe(st);return a.x=at.x,a.y=at.y,{pathCommands:K,pathData:tt,textPosition:a,points:et,startDirection:z,endDirection:F}},cn=(i,a={x:0,y:0,rotate:0},t={})=>{const{line:e,fromJunctionPoint:n,toJunctionPoint:o,lineDirection:s,lineShape:r,fx:l,fy:c,fcx:h,fcy:d,f_W:f,f_H:p,tx:u,ty:g,tcx:x,tcy:y,t_W:L,t_H:m}=i,w=l-h,b=c-d;let M=w>3?1:w<-3?-1:0,N=b>3?1:b<-3?-1:0;Math.abs(M)===1&&Math.abs(N)===1&&(Math.abs(w)>Math.abs(b)?N=0:M=0),M===0&&N===0&&(M=1);const O=u-x,E=g-y;let T=O>3?1:O<-3?-1:0,D=E>3?1:E<-3?-1:0;Math.abs(T)===1&&Math.abs(D)===1&&(Math.abs(O)>Math.abs(E)?D=0:T=0),T===0&&D===0&&(M=-1);let R=St(n,M,N,!1,l,c,u,g),_=St(o,T,D,!0,l,c,u,g);const z=e.lineRadius!==void 0?e.lineRadius:t.lineRadius||0,F=e.ctrlPointsFor49;let V={x:Math.round(l),y:Math.round(c)},P={x:Math.round(u),y:Math.round(g)},$={x:Math.round(F[0].x),y:Math.round(F[0].y)},Y={x:Math.round(F[F.length-1].x),y:Math.round(F[F.length-1].y)},j=[...F];if(e.isReverse&&([R,_]=[_,R]),Math.abs(V.x-$.x)>3||Math.abs(V.y-$.y)>3){const tt=V.x+($.x-V.x)/2,at=V.y+($.y-V.y)/2,Tt=qt(R),[Et]=Pt({source:V,sourcePosition:R,target:$,targetPosition:Tt,center:{x:tt,y:at},sourceOffset:20,targetOffset:5});j=Ot([...Et,...j])}if(Math.abs(P.x-Y.x)>3||Math.abs(P.y-Y.y)>3){const tt=Y.x+(P.x-Y.x)/2,at=Y.y+(P.y-Y.y)/2,Tt=qt(_),[Et]=Pt({source:Y,sourcePosition:Tt,target:P,targetPosition:_,center:{x:tt,y:at},sourceOffset:5,targetOffset:20});j=Ot([...j,...Et])}const X=j,st=me(X,z),et=ht(st),K=xe(F);return a.x=K.x,a.y=K.y,{pathCommands:[],pathData:et,textPosition:a,points:X,startDirection:R,endDirection:_}},hn=(i,a={x:0,y:0,rotate:0})=>{const{line:t,lineShape:e,fx:n,fy:o,fcx:s,fcy:r,tx:l,ty:c,tcx:h,tcy:d}=i,f=l-n,p=c-o,u=n-s,g=o-r,x=l-h,y=c-d,L=Math.min(200,Math.max(100,Math.abs(f/2))),m=Math.min(200,Math.max(100,Math.abs(p/2))),w=u/(Math.abs(u)+Math.abs(g))*L,b=g/(Math.abs(u)+Math.abs(g))*m;let M={x:w,y:b};const N=x/(Math.abs(x)+Math.abs(y))*L+f,O=y/(Math.abs(x)+Math.abs(y))*m+p;let E={x:N,y:O};t.ctrlPoints&&t.ctrlPoints.length>0&&(t.isReverse?(M.x+=t.ctrlPoints[1].x,M.y+=t.ctrlPoints[1].y,E.x+=t.ctrlPoints[0].x,E.y+=t.ctrlPoints[0].y):(M.x+=t.ctrlPoints[0].x,M.y+=t.ctrlPoints[0].y,E.x+=t.ctrlPoints[1].x,E.y+=t.ctrlPoints[1].y));const T={x:n+M.x,y:o+M.y},D={x:n+E.x,y:o+E.y},R={x:n+f,y:o+p},_=[{type:"M",x:n,y:o},{type:"c",dx1:M.x,dy1:M.y,dx2:E.x,dy2:E.y,dx:f,dy:p}];e===8&&_.push({type:"Z"});const z=ve({x:n,y:o},T,D,R,e<6?.8:.5);a.x=z.x,a.y=z.y;const F=ht(_);return{pathCommands:_,pathData:F,textPosition:a,points:[]}},ve=(i,a,t,e,n=.5)=>{const o={x:(1-n)*i.x+n*a.x,y:(1-n)*i.y+n*a.y},s={x:(1-n)*a.x+n*t.x,y:(1-n)*a.y+n*t.y},r={x:(1-n)*t.x+n*e.x,y:(1-n)*t.y+n*e.y},l={x:(1-n)*o.x+n*s.x,y:(1-n)*o.y+n*s.y},c={x:(1-n)*s.x+n*r.x,y:(1-n)*s.y+n*r.y};return{x:(1-n)*l.x+n*c.x,y:(1-n)*l.y+n*c.y}},dn=(i,a={x:0,y:0,rotate:0})=>{const{line:t,totalLinesBetweenNodes:e,currentLineIndex:n,lineDirection:o,lineShape:s,fx:r,fy:l,fcx:c,fcy:h,f_W:d,f_H:f,tx:p,ty:u,tcx:g,tcy:x,t_W:y,t_H:L}=i,m=p-r,w=u-l,b=p>r?1:-1,M=u>l?1:-1,N=o==="v"?M:b,O=r-c,E=l-h,T=p-g,D=u-x,R=1/(e+1)*(n+1);let _={x:0,y:0},z={x:0,y:0};if(s===G.Curve2)_=o==="v"?{x:0,y:N*30}:{x:N*30,y:0},z=o==="v"?{x:m*R,y:N*-10}:{x:N*-10,y:w*R};else if(s===G.Curve3)_=o==="v"?{x:0,y:w*R}:{x:N*30,y:0},z=o==="v"?{x:0,y:0}:{x:N*-10,y:w*R};else if(s===G.Curve5)_={x:0,y:0},z=o==="v"?{x:0,y:w*R}:{x:m*R,y:0};else if(s===G.Curve7||s===G.Curve8){const et=O/(Math.abs(O)+Math.abs(E))*30,K=E/(Math.abs(O)+Math.abs(E))*30;_={x:et,y:K};const tt=T/(Math.abs(T)+Math.abs(D))*30+m,at=D/(Math.abs(T)+Math.abs(D))*30+w;z={x:tt,y:at}}const F={x:r+_.x,y:l+_.y},V={x:r+z.x,y:l+z.y},P={x:r+m,y:l+w},$=[{type:"M",x:r,y:l},{type:"c",dx1:_.x,dy1:_.y,dx2:z.x,dy2:z.y,dx:m,dy:w}];s===8&&$.push({type:"Z"});const Y=ve({x:r,y:l},F,V,P,s<6?.8:.5);a.x=Y.x,a.y=Y.y;const j=ht($);return{pathCommands:$,pathData:j,textPosition:a,points:[]}};class fn extends en{constructor(a,t){super(a,t)}_getJunctionPoint(a,t){return a===U.border?Z.getBorderPoint4MultiLine(t):a===U.ltrb?Z.getRectJoinPoint(t):a===U.tb?Z.getRectVJoinPoint(t):a===U.lr?Z.getRectHJoinPoint(t):a===U.left?Z.getRectLeftJoinPoint(t):a===U.right?Z.getRectRightJoinPoint(t):a===U.top?Z.getRectTopJoinPoint(t):a===U.bottom?Z.getRectBottomJoinPoint(t):a==="horizontalLine"?Z.getRectVJoinPoint(t):a==="verticalLine"?Z.getRectHJoinPoint(t):Z.getBorderPoint4MultiLine(t)}createLinePath(a,t,e){console.error("createLinePath() is deprecated, please use createLineDrawInfo() instead.")}createLineDrawInfo(a,t){let e,n,o=1,s=0;if(a&&(s=a.currentLineIndex,o=a.totalLinesBetweenNodes),a)e=a.fromNode,n=a.toNode;else{const r=t;if(e=this.getFakeLineTarget(r.fromType,r.from,r),n=this.getFakeLineTarget(r.toType,r.to,r),!e){console.error("Invalid line configuration:error from:",t);return}if(!n){console.error("Invalid line configuration:error to:",t);return}}return this.generateLinePath({line:t,from:e,to:n,totalLinesBetweenNodes:o,currentLineIndex:s})}generateLinePath(a){a.totalLinesBetweenNodes===void 0&&(a.totalLinesBetweenNodes=1),a.currentLineIndex===void 0&&(a.currentLineIndex=0),a.defaultOptions===void 0&&(a.defaultOptions={defaultLineShape:this.options.defaultLineShape,layoutDirection:this.options.layout.layoutDirection,multiLineDistance:this.options.multiLineDistance,defaultJunctionPoint:this.options.defaultJunctionPoint,lineRadius:this.options.defaultPolyLineRadius});try{const t=this.withLineJunctionPoints(a);return this.createLinePathData(t)}catch(t){if(t.rgError)return this.createErrorLineValue(t.errorCode,t.x,t.y);throw t}}throwLineError(a,t,e){return{rgError:!0,errorCode:a,x:t,y:e}}createErrorLineValue(a,t,e){const n={x:0,y:0,rotate:0},o=[{type:"M",x:0,y:0},{type:"l",dx:t,dy:e}];return{pathCommands:o,pathData:ht(o),textPosition:n,points:[]}}withLineJunctionPoints({line:a,from:t,to:e,totalLinesBetweenNodes:n,currentLineIndex:o,defaultOptions:s}){if(!t||!e)throw v("error from-to:",t,e),this.throwLineError("F",-10,0);let r=a.lineShape||s.defaultLineShape||1;const l=a.lineDirection||s.layoutDirection||"h";let c=t.x||0,h=t.y||0,d=e.x||0,f=e.y||0;if(Number.isNaN(c)||Number.isNaN(h))throw v("error start node:",t.text,t.x,t.y),this.throwLineError("A",-10,-10);if(Number.isNaN(d)||Number.isNaN(f))throw v("error end point:",e.text,e.x,e.y),this.throwLineError("B",10,-10);let p=t.el.offsetWidth||60,u=t.el.offsetHeight||60;if(Number.isNaN(p)||Number.isNaN(u))throw this.throwLineError("C",-10,10);let g=e.el.offsetWidth||60,x=e.el.offsetHeight||60;if(Number.isNaN(g)||Number.isNaN(x))throw this.throwLineError("D",10,10);if(c===0&&d===0&&h===0&&f===0)throw this.throwLineError("D",10,10);const y=d-c+(f-h)>0,L=a.isReverse?e:t,m=a.isReverse?t:e,w=L.nodeShape!==void 0&&L.nodeShape!==null?L.nodeShape:1,b=a.junctionOffset||0;c-=b,h-=b,d-=b,f-=b,p+=b*2,u+=b*2,g+=b*2,x+=b*2;const M={from_x:c,from_y:h,to_x:d,to_y:f,f_W:p,f_H:u,t_W:g,t_H:x,nodeShape:w,isReverse:y,isEndPoint:!1,totalLinesBetweenNodes:n,currentLineIndex:o,lineDistance:s.multiLineDistance||50},N=m.nodeShape!==void 0&&m.nodeShape!==null?m.nodeShape:1,O={from_x:d,from_y:f,to_x:c,to_y:h,f_W:g,f_H:x,t_W:p,t_H:u,nodeShape:N,isReverse:y,isEndPoint:!0,totalLinesBetweenNodes:n,currentLineIndex:o,lineDistance:s.multiLineDistance||50},E=s.defaultJunctionPoint||U.border;let T=a.fromJunctionPoint||E,D=a.toJunctionPoint||E,R=a.fromJuctionPointOffsetX||0,_=a.fromJuctionPointOffsetY||0,z=a.toJuctionPointOffsetX||0,F=a.toJuctionPointOffsetY||0;a.isReverse&&([T,D]=[D,T],[R,_,z,F]=[z,F,R,_]),(t===e||c===0&&d===0&&h===0&&f===0)&&R===0&&_===0&&z===0&&F===0&&((r===G.StandardStraight||r===G.Curve2||r===G.Curve3||r===G.SimpleOrthogonal||r===G.Curve5)&&(r=G.StandardCurve),F=20);const V=this._getJunctionPoint(T,M);V.x+=R,V.y+=_;const P=this._getJunctionPoint(D,O);if(P.x+=z,P.y+=F,!V||!P)throw this.throwLineError("E",-20,-20);const $=c+p/2,Y=h+u/2,j=d+g/2,X=f+x/2;T==="horizontalLine"?(V.x=P.x,V.y=M.from_y+M.f_H/2,r===44&&(V.x+=(P.x>j?1:-1)*30)):T==="verticalLine"&&(V.x=M.from_x+M.f_W/2,V.y=P.y,r===44&&(V.y+=(P.y>X?1:-1)*30)),D==="horizontalLine"?(P.x=V.x,P.y=O.from_y+O.f_H/2,r===44&&(P.x+=(V.x>$?1:-1)*30)):D==="verticalLine"&&(P.x=O.from_x+O.f_W/2,P.y=V.y,r===44&&(P.y+=(V.y>Y?1:-1)*30));const st=V.x,et=V.y,K=P.x,tt=P.y;if(Number.isNaN(st)||Number.isNaN(et))throw v("error start point:",t.text),this.throwLineError("F",-10,0);if(Number.isNaN(K)||Number.isNaN(tt))throw v("error end point:",e.text),this.throwLineError("G",10,0);return{line:a,totalLinesBetweenNodes:n,currentLineIndex:o,lineDirection:l==="v"?"v":"h",lineShape:r,lineRadius:s.lineRadius||0,fromJunctionPoint:T,toJunctionPoint:D,fx:st,fy:et,fcx:$,fcy:Y,f_W:p,f_H:u,tx:K,ty:tt,tcx:j,tcy:X,t_W:g,t_H:x}}createLinePathData(a){const{lineShape:t}=a;let e;return t===G.SimpleOrthogonal?e=on(a,void 0,{lineRadius:a.lineRadius}):t===G.StandardOrthogonal?e=ln(a,void 0,{lineRadius:a.lineRadius}):t===G.HardOrthogonal?e=cn(a,void 0,{lineRadius:a.lineRadius}):t===G.StandardCurve?e=hn(a):t===G.Curve2||t===G.Curve3||t===G.Curve5||t===G.Curve7||t===G.Curve8?e=dn(a):e=nn(a),e}getArrowMarkerId(a,t=!1){let e=a.showStartArrow===!0,n=a.showEndArrow!==!1;if(a.isReverse&&([e,n]=[n,e]),t){if(!e)return;if(a.startMarkerId)return`url('#${a.startMarkerId}')`}else{if(!n)return;if(a.endMarkerId)return`url('#${a.endMarkerId}')`}return`url('#${this.getLineArrow(a.color,t,!1)}')`}getTextTransform(a,t){if(!a||!t)return"translate(0,0)";const{x:e,y:n,rotate:o}=t;if(Number.isNaN(e)||Number.isNaN(n))return"translate(0,0)";const s=a.textOffset_x||this.options.defaultLineTextOffset_x||0,r=a.textOffset_y||this.options.defaultLineTextOffset_y||0,l=a.lineShape||this.options.defaultLineShape;return l===G.StandardStraight||l===G.SimpleOrthogonal?`translate(-50%, -50%) translate(${e+s}px,${n+r}px) rotate(${o||0}deg)`:`translate(-50%, -50%) translate(${e+s}px,${n+r}px)`}generateLineTextStyle(a,t){const e={transform:"",transformOrigin:""};if(!a||!t)return{cssStyles:e};const{line:n}=a,{textPosition:o}=t;if(!n||!o)return{cssStyles:e};let s=n.text||"";s.length>this.options.lineTextMaxLength&&(s=s.substring(0,this.options.lineTextMaxLength||15)+"...");const{x:r,y:l,rotate:c}=o;if(Number.isNaN(r)||Number.isNaN(l))return{text:s,cssStyles:e};const h=[],d=n.textAnchor||"center";d==="start"?h.push("translate(0%, -50%)"):d==="end"?h.push("translate(100%, -50%)"):h.push("translate(-50%, -50%)"),h.push(`translate(${r}px,${l}px)`);const f=n.textOffset_x||this.options.defaultLineTextOffset_x||0,p=n.textOffset_y||this.options.defaultLineTextOffset_y||0;return(n.lineShape||this.options.defaultLineShape||1)===G.StandardStraight?(e.transformOrigin="50% 50%",h.push(`translate(${f}px,${p}px)`)):h.push(`translate(${f}px,${p}px)`),e.transform=h.join(" "),{text:s,cssStyles:e}}generateLineTextStyle4TextPath(a){const{line:t,from:e,to:n}=a;let o=t.text;if(!o||!n||!e)return null;let s=0;const r=e.x,l=e.y,c=n.x,h=n.y;o.length>this.options.lineTextMaxLength&&(o=o.substring(0,this.options.lineTextMaxLength||15)+"..."),r>c&&(s=180,o=o.split("").reverse().join(""));const p=`translate(${0},${0})`;let u="middle";const g=t.lineShape||this.options.defaultLineShape||1;let x="50%";return g===G.SimpleOrthogonal?t.onPathStartOffset==="start"?(x="10%",u="start"):t.onPathStartOffset==="end"?(x="90%",u="end"):t.onPathStartOffset?(x=t.onPathStartOffset,u="start"):this.options.layout.layoutDirection==="v"?x=String(Math.abs(c-r)+43):x=String(Math.abs(h-l)+43):t.onPathStartOffset==="start"?(x="10%",u="start"):t.onPathStartOffset==="end"?(x="90%",u="end"):t.onPathStartOffset?(x=t.onPathStartOffset,u="start"):(x="50%",u="middle"),t.textAnchor&&(u=t.textAnchor),{text:o,textOffset:p,textAnchor:u,onPathStartOffset:x,textRotate:s}}onLineVertexBeDroppedOnConnectController(a,t,e,n){if(v("onLineVertexBeDroppedOnConnectController",a,t,e),t.stopPropagation(),!e){this.onLineVertexBeDropped(a,t,void 0,n);return}const o=xt(t),s=e.getBoundingClientRect(),r={x:s.left,y:s.top+s.height/2},l={x:s.left+s.width/2,y:s.top},c={x:s.left+s.width,y:s.top+s.height/2},h={x:s.left+s.width/2,y:s.top+s.height};let d=ot.left;const f={x:0,y:0};if(a)d=a,d===ot.top||d===ot.bottom?f.x=o.clientX-h.x:d===ot.right?f.y=o.clientY-c.y:f.y=o.clientY-r.y;else{const g=dt(o.clientX,o.clientY,r.x,r.y),x=dt(o.clientX,o.clientY,l.x,l.y),y=dt(o.clientX,o.clientY,c.x,c.y),L=dt(o.clientX,o.clientY,h.x,h.y),m=Math.min(g,x,y,L);m===g?(d=ot.left,f.x=o.clientX-r.x,f.y=o.clientY-r.y):m===x?(d=ot.top,f.x=o.clientX-l.x,f.y=o.clientY-l.y):m===y?(d=ot.right,f.x=o.clientX-c.x,f.y=o.clientY-c.y):m===L&&(d=ot.bottom,f.x=o.clientX-h.x,f.y=o.clientY-h.y)}const u=this.options.canvasZoom/100;f.x=f.x/u,f.y=f.y/u,v("onMouseUpWithOffset:",a,f),this.onLineVertexBeDropped(d,t,f,n)}}class un extends fn{constructor(t,e){super(t,e);S(this,"_zooming",!1)}async zoom(t,e,n){if(!this._rgAsConnectArea){if(this._zooming){console.error("reject zoom:_zooming");return}this._zooming=!0;try{const o=this.emitEvent(I.beforeZoomStart,this.options.canvasZoom,t,n);if(v("[zoom]","abortZoom:",o),o===!0)return;if(this.options.canvasZoom+t<this.options.minCanvasZoom){if(v("zoom:minCanvasZoom"),t=this.options.minCanvasZoom-this.options.canvasZoom,t===0)return}else if(this.options.canvasZoom+t>this.options.maxCanvasZoom&&(v("zoom:maxCanvasZoom"),t=this.options.maxCanvasZoom-this.options.canvasZoom,t===0))return;const s=t/100,r=this.$dom.getBoundingClientRect(),l=this.options.canvasZoom/100,c=Math.max(.01,Math.min(10,l+s));e||(e={x:r.x+r.width/2,y:r.y+r.height/2});const h=e.x-r.left,d=e.y-r.top,f=h-(h-this.options.canvasOffset.x)*(c/l),p=d-(d-this.options.canvasOffset.y)*(c/l);this.options.canvasOffset.x=f,this.options.canvasOffset.y=p;const u=this.options.canvasZoom,g=c*100;this.options.canvasZoom=g,this._zoomEnd(u,g)&&await ft(200)}finally{this._zooming=!1}}}_zoomEnd(t,e){this.updateViewBoxInfo();let n=!1;return t<=40?e>40&&(this.options.performanceMode&&(this.updateShouldRenderGraphData(!0),n=!0),this.options.showEasyView=!1,v("zoom:hide:showEasyView",t,e),this.updateElementLines()):t>40&&e<=40&&(v("zoom:show:showEasyView",t,e),this.options.performanceMode&&(this.options.showEasyView=!0)),this.updateEditingControllerView(),this.emitEvent(I.onZoomEnd,this.options.canvasZoom),this._dataUpdated(),n}setZoom(t,e){const n=Math.floor(t-this.options.canvasZoom);this.zoom(n,e)}getCanvasXyByClientXy(t){const e=this.$dom.getBoundingClientRect(),n={x:t.x-e.left,y:t.y-e.top};return this.getCanvasXyByViewXy(n)}getCanvasXyByViewXy(t){if(this._rgAsConnectArea)return t;const e=this.options.canvasZoom/100,n={x:t.x-this.options.canvasOffset.x,y:t.y-this.options.canvasOffset.y};return{x:n.x/e,y:n.y/e}}getViewXyByCanvasXy(t){const e=this.options.canvasZoom/100;return{x:t.x*e+this.options.canvasOffset.x,y:t.y*e+this.options.canvasOffset.y}}}class gn extends un{constructor(a,t){super(a,t)}moveToCenter(a){const t=this.getNodesCenter(a);v("center:",t.x,t.y);const e=this.options.canvasZoom;this.options.canvasZoom=100,this.setCanvasCenter(t.x,t.y),this.setZoom(e),this._dataUpdated()}zoomToFit(a){const t=this.getStuffSize(a),e=50,n=this.options.viewSize.width/(t.width+e*2),o=this.options.viewSize.height/(t.height+e*2),s=Math.min(n,o,1);v("zoomToFit:",{stuffSize:t,zoomPercent:s,zoomPercentX:n,zoomPercentY:o,viewSize:this.options.viewSize}),this.moveToCenter(a),this.setZoom(s*100),this._dataUpdated()}enableNodeXYAnimation(){this.options.enableNodeXYAnimation=!0,this._dataUpdated()}disableNodeXYAnimation(){this.options.enableNodeXYAnimation=!1,this._dataUpdated()}enableCanvasAnimation(){this.options.enableCanvasTransformAnimation=!0,this._dataUpdated()}disableCanvasAnimation(){this.options.enableCanvasTransformAnimation=!1,this._dataUpdated()}}class pn extends gn{constructor(t,e){super(t,e);S(this,"_mainGroupNodes",[]);S(this,"layouter")}async doLayout(t){const e=Date.now()-this.prevAddNodeTimestamp;e<300&&(this.options.canvasOpacity=.01,this._dataUpdated(),await ft(300-e)),await this._doLayout(t),this.options.canvasOpacity=1,this._dataUpdated()}async _doLayout(t){this.updateNodesVisibleProperty(),v("node size\uFF1A",this.graphData.nodes.length);let e=this.graphData.rootNode;if(t&&(e=typeof t=="string"?this.getNodeById(t):t,!e))throw new Error("custom rootNode not found, id:"+t);e||(e=this.graphData.nodes[0],this._rgAsConnectArea||(console.error("No root node, use first node as root:",e),console.error("You can set rootNode call doLayout(rootNode | nodeId) with a node id"))),this.graphData.rootNode=e;const n=this.createLayout(this.options.layout,!0);this._mainGroupNodes=[],n.layoutOptions.layoutName==="force"?(n.onFinish(()=>{this.emitEvent(I.onForceLayoutFinish)}),await ft(100),v("doLayout:start force:",this.graphData.nodes.length),n.placeNodes(this.graphData.nodes,e)):(e&&this.findGroupNodes(e,this._mainGroupNodes),n.placeNodes(this._mainGroupNodes,e),v("doLayout:placeOtherNodes"),this.placeOtherNodes(),v("doLayout:placeOtherNodes ok!")),this.updateElementLines()}refresh(t=!0){this.resetViewSize(!0),this._dataUpdated(),t&&this.doLayout(),this.updateElementLines(),this._dataUpdated()}placeOtherNodes(){const t=this.options.placeSingleNode&&this.options.layout.layoutName!=="fixed",e=[...this._mainGroupNodes],n=[],o=[];this.graphData.nodes.forEach(s=>{e.includes(s)||(this.options.placeSingleNode&&s.fixed!==!0?this.getNodeRelatedNodes(s).length===0&&(t&&(s.x=Math.floor(Math.random()*200)-100,s.y=Math.floor(Math.random()*200)-100,s.lot||(s.lot={childs:[]})),s.lot.placed=!0,o.push(s)):n.push(s))}),t&&this.placeSingleNodes(o),t&&(this.options.placeOtherGroup&&this.placeOtherGroup(n,e),this._dataUpdated(),this.options.layout.layoutName==="force"&&(this.stopAutoLayout(),setTimeout(()=>{this.startAutoLayout()},500)))}placeSingleNodes(t){if(t.length>0){v("sigle nodes:",t.length);const e=new ut({layoutName:"force"},this.options,this);e.allNodes=this.graphData.nodes,e.fastStart=!0,e.maxLayoutTimes=100,e.byLine=!1,e.placeNodes(t)}}placeOtherGroup(t,e){if(t.length>0){v("[placeOtherGroup]notPlacedNodes nodes:",t.length);const n=JSON.parse(JSON.stringify(this.options.layout)),o=t[0],s=this.createLayout(n);s.isMainLayouer=!1;const r=this.getStuffSize(e);v("[placeOtherGroup]placeOtherGroup:",s.layoutOptions.layoutName,"root:",o.text);let l=this.options.layout.layoutName.includes("tree")?300:600;if(s.layoutOptions.layoutName==="force"){const d=s;d.maxLayoutTimes=0,l=100}o.fixed?v("[placeOtherGroup]fixed root x,y:",o.x,o.y,o.text):(o.x=r.maxX+l,o.y=0,v("[placeOtherGroup]set root x,y:",o.x,o.y,o.text)),s.layoutOptions.fixedRootNode=!0;const c=[];this.findGroupNodes(o,c),v("[placeOtherGroup]thisGroupNodes:",t.length),s.requireLinks&&s.setLinks(this.getLinks()),s.placeNodes(c,o),e.push(...c);const h=[];t.forEach(d=>{e.includes(d)||h.push(d)}),this.options.placeOtherGroup&&this.placeOtherGroup(h,e),this._dataUpdated()}else v("[placeOtherGroup]thisGroupNodes:all is OK!")}toggleAutoLayout(){v("toggleAutoLayout:to:",this.options.layout.autoLayouting),this.options.layout.autoLayouting?this.stopAutoLayout():this.startAutoLayout()}startAutoLayout(){this.options.layout.autoLayouting=!0,this.options.layout.supportAutoLayout&&(v("startAutoLayout:"),this.layouter.autoLayout(!0))}stopAutoLayout(){this.options.layout.autoLayouting=!1,this.options.layout.supportAutoLayout&&(v("stopAutoLayout:"),this.layouter.stop())}createLayout(t,e=!1){const n=this.options;$t(t);let o=null;if(t.layoutName==="tree"?o=new fe(t,n,this):t.layoutName==="center"?o=new ue(t,n,this):t.layoutName==="circle"?o=new ge(t,n,this):t.layoutName==="force"?o=new ut(t,n,this):t.layoutName==="fixed"?o=new pe(t,n,this):t.layoutName==="smart-tree"?o=new Ue(t,n,this):t.layoutName==="folder"&&(o=new ye(t,n,this)),!o)throw new Error("unknown layout: "+t.layoutName);return o.requireLinks&&o.setLinks(this.getLinks()),o.isMainLayouer=e,o.layoutOptions.fixedRootNode=!0,e&&(n.layout.supportAutoLayout=o.autoLayout!==void 0,this.layouter=o),o}}const yn=async(i,a)=>{const t=i||document.documentElement;a?await mn(t):await xn()},mn=async i=>{i.requestFullscreen?await i.requestFullscreen():i.mozRequestFullScreen?await i.mozRequestFullScreen():i.webkitRequestFullscreen?await i.webkitRequestFullscreen():i.msRequestFullscreen&&await i.msRequestFullscreen()},xn=async()=>{document.exitFullscreen?await document.exitFullscreen():document.mozCancelFullScreen?await document.mozCancelFullScreen():document.webkitExitFullscreen?await document.webkitExitFullscreen():document.msExitFullscreen&&await document.msExitFullscreen()};class vn extends pn{constructor(t,e){super(t,e);S(this,"prevClickTime",0);S(this,"nodeXYBeforeDrag",{});S(this,"movingListener");S(this,"_currentMovingLineTarget",null);S(this,"step1EventTime",0);S(this,"onCreateLineCallback");S(this,"_wheelAction",0);S(this,"_wheelBuff",0);S(this,"_fullscreenchangeHandler")}setCheckedNode(t){this.options.checkedNodeId=t}setCheckedLinkAndLine(t,e){this.options.checkedLinkId=t?t.seeks_id:"",this.options.checkedLineId=e?e.id:""}setCheckedLine(t){const e=this.getLinkByLine(t);this.options.checkedLinkId=e?e.seeks_id:"",this.options.checkedLineId=t?t.id:""}clearChecked(){this.options.checkedNodeId="",this.options.checkedLineId="",this.options.checkedLinkId=""}clearSelected(){this.graphData.nodes.forEach(t=>{t.selected=!1}),this.getLines().forEach(t=>{t.selected=!1}),this.graphData.fakeLines.forEach(t=>{t.selected=!1})}updateNodeOffsetSize(t,e,n){const o=this.getNodeById(t);if(!o){console.warn("Node not found for resize handling:",t);return}const s=o.el.offsetWidth,r=o.el.offsetHeight;(s!==e||r!==n)&&(v("Node resized:",o.id,s,",",r," > ",e,",",n),o.el.offsetWidth=e,o.el.offsetHeight=n,this._dataUpdated())}onNodeClick(t,e){if(Date.now()-this.prevClickTime<200){v("[node]click abort : time < 200");return}if(this.prevClickTime=Date.now(),this.options.creatingLinePlot){this.onNodeClickWhenCreatingLinePlot(t);return}v("[node]node click",t.text,this.options.creatingLinePlot);const n=t.disablePointEvent===void 0?this.options.disableNodePointEvent:t.disablePointEvent;!e.shiftKey&&!n&&(this.options.checkedLinkId="",this.options.checkedLineId="",this.setCheckedNode(t.id)),this.emitEvent(I.onNodeClick,t,e),this.prevClickTime=Date.now()}onNodeDragStart(t,e){if(vt(e)||!t||(this.options.disableDragNode||t.disableDrag)&&e.target&&!e.target.closest(".rg-node-drag-handler"))return;isNaN(t.x)&&(t.x=0),isNaN(t.y)&&(t.y=0),t.dragging=!0,this.setEditingLine(null,null),this.options.checkedLinkId="",this.options.checkedLineId="";const n=(r,l,c)=>{t.dragging=!1,this.options.editingReferenceLine.show=!1,this.onNodeDraged(t,r,l,c),s&&this.emitEvent(I.onNodeDragEnd,t,c,r,l),this._dataUpdated()};this.nodeXYBeforeDrag={},this.nodeXYBeforeDrag[t.id]={x:t.x,y:t.y};for(const r of this.options.editingController.nodes)this.nodeXYBeforeDrag[r.id]={x:r.x,y:r.y};const o={x:t.x,y:t.y};let s=!1;W.startDrag(e,o,n,(r,l,c)=>{if(!s)Math.abs(r)+Math.abs(l)>4&&(v("[node]onNodeDragStart...",it(e),e),this.emitEvent(I.onNodeDragStart,t,e),s=!0);else{let h=r/(this.options.canvasZoom/100)+c.x,d=l/(this.options.canvasZoom/100)+c.y,f=h-o.x,p=d-o.y;const u=this.emitEvent(I.onNodeDragging,t,h,d,f,p,e);u&&(typeof u.x=="number"&&(h=u.x,f=h-o.x),typeof u.y=="number"&&(d=u.y,p=d-o.y)),this.options.useHorizontalView&&(h=l/(this.options.canvasZoom/100)+c.x,d=-r/(this.options.canvasZoom/100)+c.y),this.draggingSelectedNodes(t,h,d,f,p)}this.updateElementLines(),this._dataUpdated()})}onNodeDraged(t,e,n,o){if(e===0&&n===0){v("[node]node click by drag"),this.onNodeClick(t,o),this.onNodeDragEnd(t,o,e,n);return}Math.abs(e)+Math.abs(n)>6?(this.prevClickTime=Date.now(),setTimeout(()=>{v("[node]onDragEnd2"),this.onNodeDragEnd(t,o,e,n)},100)):(v("[node]onDragEnd1"),this.onNodeDragEnd(t,o,e,n))}onNodeDragEnd(t,e,n,o){this.updateElementLines()}onLineClick(t,e,n){e||(e=this.getLinkByLineId(t.id)),v("onLineClick:","line:",t,"link:",e),(t.disablePointEvent===void 0?this.options.disableLinePointEvent:t.disablePointEvent)||(this.setCheckedNode(""),this.setCheckedLinkAndLine(e,t)),this.emitEvent(I.onLineClick,t,e,n),this._dataUpdated()}expandOrCollapseNode(t,e){e.stopPropagation(),t.expanded===!1?this.expandNode(t,e):this.collapseNode(t,e)}expandNode(t,e){v("onNodeExpand:",t),t.expanded=!0,v("relayout check:",this.options.reLayoutWhenExpandedOrCollapsed),this.updateNodesVisibleProperty(),this.doLayoutWhenExpandedOrCollapsed(),this.updateElementLines(),this._dataUpdated(),this.emitEvent(I.onNodeExpand,t,e)}collapseNode(t,e){v("onNodeCollapse:",t),t.expanded=!1,v("relayout check:",this.options.reLayoutWhenExpandedOrCollapsed),this.updateNodesVisibleProperty(),this.doLayoutWhenExpandedOrCollapsed(),this.updateElementLines(),this._dataUpdated(),this.emitEvent(I.onNodeCollapse,t,e)}doLayoutWhenExpandedOrCollapsed(){this.options.reLayoutWhenExpandedOrCollapsed&&this.options.layout.layoutName!=="force"&&(v("relayout..."),this.doLayout())}onCanvasDragEnd(t){this.updateEditingControllerView(),this.updateShouldRenderGraphData(),this.emitEvent(I.onCanvasDragEnd,t)}onCanvasClick(t){this.options.creatingLinePlot&&this.onCanvasClickWhenCreatingLinePlot(t),this.emitEvent(I.onCanvasClick,t)}onCanvasSelectionEnd(t,e){this.emitEvent(I.onCanvasSelectionEnd,t,e),v("[canvas]onCanvasSelectionEnd:",t),this._dataUpdated()}startCreatingNodePlot(t,e){this.options.newNodeTemplate=Ct(JSON.parse(JSON.stringify(Bt)),this.options),this.options.creatingNodePlot=!0;const n=it(t);this.options.showTemplateNode=!n;let o=(u,g)=>{const x=this.options.newNodeTemplate,y={width:x.width||96,height:x.height||96};this.options.newNodeTemplate.x=u-y.width/2,this.options.newNodeTemplate.y=g-y.height/2,this._dataUpdated()},s=(u,g,x)=>{const y="s-"+Date.now();this.addNodes([{id:y,text:this.options.newNodeTemplate.text,x:u,y:g}])};e&&e.templateText&&(this.options.newNodeTemplate.text=e.templateText),e&&e.templateClassName&&(this.options.newNodeTemplate.className=e.templateClassName),e&&e.templateNode&&Object.keys(e.templateNode).forEach(u=>{this.options.newNodeTemplate[u]=e.templateNode[u]}),e&&e.templateMove&&(o=e.templateMove),e&&e.onCreateNode&&(s=e.onCreateNode);const r=this.$dom.getBoundingClientRect();v("[CreatingNodePlot]startCreatingNodePlot:");const l=xt(t),c=l.clientX-r.x+10,h=l.clientY-r.y+10;n||o(c,h);const d=u=>{const g=this.$dom.getBoundingClientRect();v("[CreatingNodePlot]objectTemplateMove");const x=u.clientX-g.x,y=u.clientY-g.y;o(x,y)},f=u=>{v("[CreatingNodePlot]user abort!"),this.$dom.removeEventListener("mousemove",d),this.$dom.removeEventListener("click",p),this.$dom.removeEventListener("contextmenu",f),this.options.creatingNodePlot=!1},p=u=>{let g=!1;if(this.options.creatingNodePlot||(g=!0),this.$dom.removeEventListener("mousemove",d),this.$dom.removeEventListener("click",p),this.$dom.removeEventListener("contextmenu",f),this.options.creatingNodePlot=!1,g){v("[CreatingNodePlot]action be abort!");return}const x=xt(u),y=x.clientX-r.x+10,L=x.clientY-r.y+10;if(Math.abs(c-y)<30&&Math.abs(h-L)<30){v("[CreatingNodePlot]create node be abort!");return}const m=this.getCanvasXyByClientXy({x:x.clientX,y:x.clientY});v("[CreatingNodePlot]objectBePlaced:",m),s(m.x,m.y,this.options.newNodeTemplate),this._dataUpdated()};setTimeout(()=>{this.$dom.addEventListener("click",p),this.$dom.addEventListener("contextmenu",f)},300),n||this.$dom.addEventListener("mousemove",d)}startCreatingLinePlot(t,e){const n=it(t);e&&e.onCreateLine&&(this.onCreateLineCallback=e.onCreateLine);const o=ct({from:"newRelationTemplate-from",to:"newRelationTemplate-to",color:"",text:"new line"});e&&e.template&&Object.assign(o,e.template),this.options.newLineTemplate=o,this.options.newLinkTemplate.fromNode=null,this.options.newLinkTemplate.toNode.id="",this.options.newLinkTemplate.toNode.targetType=B.Node,e&&e.fromNode&&(this.options.newLinkTemplate.toNode.x=e.fromNode.x+50,this.options.newLinkTemplate.toNode.y=e.fromNode.y+50,this.options.newLinkTemplate.fromNode=e.fromNode,this.step1EventTime=Date.now()),this.options.creatingLinePlot=!0,this.options.newLinkTemplate.toNodeObject=null,this.options.newLineTemplate.disablePointEvent=!0,this.options.newLinkTemplate.toNode.el.offsetWidth=2,this.options.newLinkTemplate.toNode.el.offsetHeight=2,v("[CreatingLinePlot]startCreatingLinePlot:isTouchEvent:",n),this._currentMovingLineTarget=this.options.newLinkTemplate.toNode,n||(v("[CreatingLinePlot]Listener move"),this.movingListener&&this.$dom.removeEventListener("mousemove",this.movingListener),this.movingListener=this.onMovingWhenCreatingLinePlot.bind(this),this.$dom.addEventListener("mousemove",this.movingListener)),this.dataUpdated()}stopCreatingLinePlot(){v("[CreatingLinePlot]stop CreatingLinePlot!"),this.options.creatingLinePlot=!1,this.options.newLinkTemplate.fromNode=null,this.options.newLinkTemplate.toNodeObject=null,this.onCreateLineCallback=void 0,this.$dom.removeEventListener("mousemove",this.movingListener),this.movingListener=void 0,this._currentMovingLineTarget=null,this._currentCreatingLineIsReverse=!1,this.options.nodeConnectController.show=!1,this._dataUpdated()}onMovingWhenCreatingLinePlot(t){v("[CreatingLinePlot]mousemove");const e=this.getCanvasXyByClientXy({x:t.clientX,y:t.clientY});this._currentMovingLineTarget&&(this._currentMovingLineTarget.x=e.x,this._currentMovingLineTarget.y=e.y,this.options.editingLineController.line&&this.updateEditingLineView());const n=t.target;this.options.newLinkTemplate.fromNode&&(this.options.newLinkTemplate.toNode.x=e.x,this.options.newLinkTemplate.toNode.y=e.y,this._dataUpdated());let o="",s=B.Node;const r=this.isNode(n);r&&(o=r.id,r===this.options.newLinkTemplate.fromNode?this.options.nodeConnectController.show=!1:(this.options.nodeConnectController.node=r,this.updateEditingConnectControllerView(),this.options.nodeConnectController.show=!0));const l=this.options.newLinkTemplate,c=n.closest(".rg-connect-ctl-handler");if(c){let h=this.options.nodeConnectController.node;v("[CreatingLinePlot]content point:",c.dataset.point);let d=c.dataset.point||"border";if(c.classList.contains("rg-connect-target")){const{width:f,height:p,x:u,y:g}=c.getBoundingClientRect(),x=this.getCanvasXyByClientXy({x:u,y:g}),y=this.options.canvasZoom/100,L={x:x.x,y:x.y,el:{offsetWidth:f/y,offsetHeight:p/y},nodeShape:1,id:c.dataset.targetId,targetData:JSON.parse(c.dataset.targetData||"{}"),targetType:c.dataset.targetType};console.log("[CreatingLinePlot]fakeNode:",JSON.stringify(L)),this.options.nodeConnectController.node=L,h=this.options.nodeConnectController.node,this.options.nodeConnectController.show=!1,d=c.dataset.point,this._currentMovingLineTarget&&(o=L.id,s=L.targetType,this._currentMovingLineTarget.nodeShape=L.nodeShape),this.updateEditingConnectControllerView()}else this._currentMovingLineTarget&&(s=B.Node);l.fromNode===this._currentMovingLineTarget?this.options.newLineTemplate.isReverse?this.options.newLineTemplate.fromJunctionPoint=d:this.options.newLineTemplate.toJunctionPoint=d:this.options.newLineTemplate.isReverse?this.options.newLineTemplate.fromJunctionPoint=d:this.options.newLineTemplate.toJunctionPoint=d,this._currentMovingLineTarget&&(n.dataset.innode==="true"?(this._currentMovingLineTarget.targetType=B.Node,this._currentMovingLineTarget.el.offsetWidth=5,this._currentMovingLineTarget.el.offsetHeight=5,this._currentMovingLineTarget.x=e.x,this._currentMovingLineTarget.y=e.y,this._currentMovingLineTarget.nodeShape=1,this._currentMovingLineTarget.rotate=0):(v("[CreatingLinePlot]content point:",h.el.offsetWidth,h.el.offsetHeight),this._currentMovingLineTarget.el.offsetWidth=h.el.offsetWidth,this._currentMovingLineTarget.el.offsetHeight=h.el.offsetHeight,this._currentMovingLineTarget.x=h.x,this._currentMovingLineTarget.y=h.y,this._currentMovingLineTarget.nodeShape=h.nodeShape||1,this._currentMovingLineTarget.rotate=0))}else v("[CreatingLinePlot]point:",n.dataset.point),this.options.newLineTemplate.isReverse?this.options.newLineTemplate.fromJunctionPoint=U.border:this.options.newLineTemplate.toJunctionPoint=U.border,this._currentMovingLineTarget&&(this._currentMovingLineTarget.el.offsetWidth=3,this._currentMovingLineTarget.el.offsetHeight=3,this._currentMovingLineTarget.rotate=0,s=B.Node);this._currentMovingLineTarget&&(o&&(this._currentMovingLineTarget.id=o),this._currentMovingLineTarget.targetType=s)}onCanvasClickWhenCreatingLinePlot(t){if(Date.now()-this.step1EventTime<500){v("[CreatingLinePlot]step1EventTime:",this.step1EventTime);return}if(!this.options.newLinkTemplate.fromNode){v("[CreatingLinePlot]CreatingLinePlot:fromNode not set!");return}let e=!1;if(!this.options.newLinkTemplate.toNodeObject){v("[CreatingLinePlot]CreatingLinePlot:toNodeObject not set!");const n=xt(t),o=this.getCanvasXyByClientXy({x:n.clientX,y:n.clientY});e=this.onCreateLine(this.options.newLinkTemplate.fromNode,o)}e!==!0&&this.stopCreatingLinePlot()}onNodeClickWhenCreatingLinePlot(t){this.options.newLinkTemplate.fromNode?(v("[CreatingLinePlot]step 2: set toNodeObjecct:",this.options.newLinkTemplate.fromNode,t),this.options.newLinkTemplate.toNodeObject=t,this.options.newLinkTemplate.toJunctionPoint=U.border,this.onCreateLine(this.options.newLinkTemplate.fromNode,t)!==!0&&this.stopCreatingLinePlot()):(v("[CreatingLinePlot]step 1: set fromNode:",t),this.options.newLinkTemplate.fromNode=t,this.options.newLinkTemplate.toNode.x=t.x+50,this.options.newLinkTemplate.toNode.y=t.y+50,this.step1EventTime=Date.now())}onCreateLine(t,e){v("[CreatingLinePlot][fire-event]onCreateLine:",t,e);const n=ct(this.options.newLineTemplate);this.options.newLineTemplate.isReverse?(n.from=e?e.id:"",n.to=t?t.id:"",n.isReverse=void 0,[t,e]=[e,t]):(n.from=t?t.id:"",n.to=e?e.id:""),n.disablePointEvent=!1;const o=this.emitEvent(I.beforeCreateLine,{lineJson:n,fromNode:t,toNode:e});if(v("[CreatingLinePlot]onCreateLine:abort-flag:",o),o===!0){v("[CreatingLinePlot]onCreateLine:abort!");return}if(this.onCreateLineCallback){v("[CreatingLinePlot]onCreateLine:callback"),this.options.newLineTemplate.disablePointEvent=!1;try{this.onCreateLineCallback(t,e,this.options.newLineTemplate)}catch(r){return console.warn("[Custom Reject Connect By Throw Error:",r),!1}}return v("[CreatingLinePlot]onCreateLine:emitEvent"),this.emitEvent(I.onLineBeCreated,{lineJson:n,fromNode:t,toNode:e})}isNode(t){const e=_t(t,"rg-node-peel","rg-map");return e?this.getNodeById(e.dataset.id):void 0}isLine(t){const e=_t(t,"rg-line-peel","rg-map");return e?this.getLineById(e.dataset.id):void 0}isLink(t){throw new Error("Please use isLine")}onContextmenu(t){this.stopCreatingLinePlot();let e="canvas",n=this.isNode(t.target);n?e="node":(n=this.isLine(t.target),n&&(e="line")),v("contextmenu:objectType",e,n);const o=xt(t),s=this.getCanvasXyByClientXy({x:o.clientX,y:o.clientY}),r=this.getViewXyByCanvasXy(s);this.emitEvent(I.onContextmenu,t,e,n,s,r)}async fullscreen(t){t!==this.options.fullscreen&&(v("fullscreen:newValue:",t),t===void 0&&(t=!this.options.fullscreen),await yn(this.$dom,t),this.emitEvent(I.onFullscreen,t))}focusNodeById(t){let e;this.graphData.nodes.forEach(n=>{n.id===t&&(e=n)}),e&&this.handleSelect(e)}focusRootNode(){v("relation-graph:focusRootNode"),this.graphData.rootNode&&this.handleSelect(this.graphData.rootNode)}handleSelect(t){v("checked:",t),this.setZoom(100);const e=t.width||50,n=t.height||50,o=t.x*-1+this.options.viewSize.width/2-e/2,s=t.y*-1+this.options.viewSize.height/2-n/2;this.setCanvasOffset(o,s),this.options.checkedNodeId=t.id,this.updateViewBoxInfo()}onMouseWheel(t){if(!t.ctrlKey&&!t.metaKey&&(this.options.disableWheelEvent||this.options.wheelEventAction==="none"))return!0;try{t.preventDefault(),t.stopPropagation()}catch{}let e=t.deltaY,n=t.deltaX;e===void 0&&(e=t.wheelDelta),n===void 0&&(n=t.wheelDelta),this._onMouseWheel(t,n,e)}_onMouseWheel(t,e,n){const o=t.ctrlKey||t.metaKey;if(!o&&this.options.wheelEventAction==="scroll"){let s=0,r=0;const l=e===0?0:e>0?-1:1,c=n===0?0:n>0?-1:1;Math.abs(e)>Math.abs(n)?(s=1,r=Math.abs(n)/Math.abs(e)):(r=1,s=Math.abs(e)/Math.abs(n));const h=l*this.options.mouseWheelSpeed*5*s,d=c*this.options.mouseWheelSpeed*5*r,f=this.emitEvent(I.beforeScrollStart,h,d,t);if(v("[scroll]","abortScroll:",f),f===!0)return;this.scrollView(h,d)}else if(!(!o&&this.options.wheelEventAction==="none")){const s={x:t.clientX,y:t.clientY},r=n===0?0:n>0?-1:1,l=this.options.mouseWheelSpeed*r;this.zoom(l,s,t)}}scrollView(t,e){this.setCanvasOffset(this.options.canvasOffset.x+t,this.options.canvasOffset.y+e),this.updateEditingControllerView(),this.updateShouldRenderGraphData()}onLineDragStart(t,e){v("onLineDragStart...");const n=this.getLinkByLine(t),o={x:n.fromNode.x,y:n.fromNode.y},s={x:n.toNode.x,y:n.toNode.y},r=(l,c,h,d,f)=>{n.fromNode.x=o.x+l/(this.options.canvasZoom/100),n.fromNode.y=o.y+c/(this.options.canvasZoom/100),n.toNode.x=s.x+l/(this.options.canvasZoom/100),n.toNode.y=s.y+c/(this.options.canvasZoom/100),this.updateEditingControllerView(),this._dataUpdated()};W.startDrag(e,{x:0,y:0},(...l)=>{this.onLineDragEnd(...l)},r)}onLineDragEnd(t,e,n){v("onLineDragEnd"),this.updateElementLines()}onCanvasDragStart(t){if(!vt(t)){if(this.options.disableDragCanvas){this.onCanvasClick(t);return}if(this.options.selectionMode||t.shiftKey){this.startCreateSelection(t);return}if(!this.options.disableDragLine){const e=this.isLine(t.target);if(e){this.onLineDragStart(e,t);return}}this.startMoveCanvas(t)}}startMoveCanvas(t,e=!1){let n;if(it(t)){let r,l=1;n=(c,h,d,f,p)=>{const u=p.touches||p.targetTouches,g=u[0];if(u&&u.length>1){p.preventDefault();const x=u[1];r||(r={x:x.clientX,y:x.clientY},l=this.options.canvasZoom);const y={x:g.clientX,y:g.clientY},L={x:x.clientX,y:x.clientY},m=Math.hypot(r.x-f.x,r.y-f.y),b=Math.hypot(L.x-y.x,L.y-y.y)/m,M=this.options.mouseWheelSpeed*b,N=l*M;this.setZoom(N,f),this._dataUpdated()}else{const x=g.clientX,y=g.clientY,L=x-f.x,m=y-f.y;if(this.options.useHorizontalView){const w=d.x+m,b=d.y-L;this.onCanvasDragging(w,b,L,m)}else{const w=d.x+L,b=d.y+m;this.onCanvasDragging(w,b,m,L)}this.updateEditingControllerView(),this._dataUpdated()}}}else n=(r,l,c,h,d)=>{const f=c.x+r,p=c.y+l;this.onCanvasDragging(f,p,r,l),this.updateEditingControllerView(),this._dataUpdated()};const o={x:this.options.canvasOffset.x,y:this.options.canvasOffset.y};this.canvasDragging=!0;let s=e;W.startDrag(t,o,(r,l,c)=>{this.canvasDragging=!1,this.onCanvasDragStop(r,l,c)},(r,l,c,h,d)=>{s?n(r,l,c,h,d):Math.abs(r)+Math.abs(l)>4&&(this.emitEvent(I.onCanvasDragStart,c,h,d),s=!0)})}onCanvasDragging(t,e,n,o){const s=this.emitEvent(I.onCanvasDragging,t,e,n,o);s!==!1&&(s&&(typeof s.x=="number"&&(t=s.x),typeof s.y=="number"&&(e=s.y)),this.setCanvasOffset(t,e))}onCanvasDragStop(t,e,n){if(this.options.creatingSelection){this.options.creatingSelection=!1,this.onCanvasSelectionEnd(this.options.selectionView,n);return}if(Math.abs(t)+Math.abs(e)<4){v("[canvas]onDragEnd as click2"),this._dataUpdated(),this.onCanvasClick(n);return}else v("[canvas]onDragEnd"),this.onCanvasDragEnd(n)}startCreateSelection(t){let e=!1;const n=(o,s,r,l,c)=>{if(!e&&Math.abs(o)+Math.abs(s)>6&&(e=!0,this.options.creatingSelection=!0,this.options.selectionView.x=l.x,this.options.selectionView.y=l.y),e){const h=this.getBoundingClientRect();o<0?(this.options.selectionView.x=l.x+o-h.x,this.options.selectionView.width=Math.abs(o)):(this.options.selectionView.x=l.x-h.x,this.options.selectionView.width=o),s<0?(this.options.selectionView.y=l.y+s-h.y,this.options.selectionView.height=Math.abs(s)):(this.options.selectionView.y=l.y-h.y,this.options.selectionView.height=s)}this._dataUpdated()};W.startDrag(t,{x:0,y:0},(...o)=>{this.onCanvasDragStop(...o)},n)}addFullscreenListener(){this._fullscreenchangeHandler=()=>{let t=!1;document.fullscreenElement?(v("div entered fullscreen mode",document.fullscreenElement),this.$dom===document.fullscreenElement&&(v("relation-graph is fullscreen!"),t=!0)):v("div exited fullscreen mode"),t!==this.options.fullscreen&&(this.options.fullscreen=t,this._dataUpdated(),setTimeout(async()=>{this.updateViewBoxInfo(),this.moveToCenter(),this.zoomToFit(),v("relation-graph reset complete!"),this._dataUpdated()},500))},document.addEventListener("fullscreenchange",this._fullscreenchangeHandler)}removeFullscreenListener(){document.addEventListener("fullscreenchange",this._fullscreenchangeHandler)}async sleep(t){await ft(1e3)}}class Cn extends vn{constructor(a,t){super(a,t)}dataUpdated(){(this.isReact||this.options.showEasyView)&&this._dataUpdated()}setOptions(a){this._setOptions(a)}setRootNodeId(a){if(this.graphData.rootNode=this.graphData.nodes.find(t=>t.id===a),!this.graphData.rootNode)throw new Error("The root node [rootId] is not set! Or cannot get the root node:"+a+", If you don't have any nodes to display, you can simply set an invisible node: {id:'root', opacity:0}")}getRootNode(){return this.graphData.rootNode}setCheckedNode(a){this.options.checkedNodeId=a}getCheckedNode(){return this.getNodeById(this.options.checkedNodeId)}getCheckedLine(){if(!this.getLineById(this.options.checkedLineId))return this.getFakeLineById(this.options.checkedLineId)}getSelectedNodes(){return this.getNodes().filter(a=>a.selected)}getEditingNodes(){return[...this.options.editingController.nodes]}async setJsonData(a){this._setJsonData(a);const t=a.rootId;t&&(this.graphData.rootNode=this.graphData.nodes.find(e=>e.id===t)),!this.graphData.rootNode&&this.graphData.nodes.length>0&&(this.graphData.rootNode=this.graphData.nodes[0]),await this.doLayout()}async appendJsonData(a,t=!0){v("appendData:",a),this.loadGraphJsonData(a),t&&await this.doLayout()}async applyInitialData(a){await this.setJsonData(a),this.moveToCenter(),this.zoomToFit()}fitContentHeight(a=20){this.options.canvasOpacity=.01,this._dataUpdated();const t=this.getNodesViewInfo(),e=t.height,n=t.width,o=this.options.viewSize.width-a*2,s=t.minX+t.width/2,r=t.minY+t.height/2;console.warn("[fitContentHeight]nodesCenter:",s,r),this.setCanvasCenter(s,r);const l=Math.min(1,o/n),c=e*l+a*2;this.options.viewSize.height=c,this.options.viewHeight=c+"px",setTimeout(()=>{this.setZoom(l*100),this.moveToCenter(),this.options.canvasOpacity=1,this._dataUpdated()},200)}}class _n{constructor(a){S(this,"$evCanvasCtx");S(this,"mediaDPR");S(this,"viewScale",1);S(this,"offset",{x:0,y:0});const t=a.getContext("2d");if(!t)throw new Error("\u65E0\u6CD5\u83B7\u53D6 Canvas 2D \u4E0A\u4E0B\u6587");this.$evCanvasCtx=t,this.mediaDPR=window.devicePixelRatio||1}setSize(a,t){const e=this.$evCanvasCtx.canvas;e.width=a*this.mediaDPR,e.height=t*this.mediaDPR,e.style.width=`${a}px`,e.style.height=`${t}px`,this.$evCanvasCtx.setTransform(this.mediaDPR,0,0,this.mediaDPR,0,0),this.applyCurrentViewTransform()}setScale(a){this.viewScale=a,this.applyCurrentViewTransform()}applyCurrentViewTransform(){this.$evCanvasCtx.setTransform(this.mediaDPR,0,0,this.mediaDPR,0,0),this.$evCanvasCtx.scale(this.viewScale,this.viewScale)}setViewOffset(a,t){this.offset.x=a/this.viewScale,this.offset.y=t/this.viewScale}beforeDraw(){}evDrawNode4Rect(a,t,e,n,o,s,r=5){const l=this.$evCanvasCtx,c=this.offset.x+a,h=this.offset.y+t;let d=Math.max(0,r);e<2*d&&(d=e/2),n<2*d&&(d=n/2),l.beginPath(),l.globalAlpha=s,d===0?l.rect(c,h,e,n):(l.moveTo(c+d,h),l.arcTo(c+e,h,c+e,h+d,d),l.arcTo(c+e,h+n,c+e-d,h+n,d),l.arcTo(c,h+n,c,h+n-d,d),l.arcTo(c,h,c+d,h,d),l.closePath()),l.fillStyle=o,l.fill(),l.globalAlpha=1}evDrawNode4Circle(a,t,e,n,o,s){const r=this.$evCanvasCtx,l=this.offset.x+a+e/2,c=this.offset.y+t+n/2;r.beginPath(),r.globalAlpha=s,r.ellipse(l,c,e/2,n/2,0,0,2*Math.PI),r.fillStyle=o,r.fill(),r.globalAlpha=1}evDrawLine(a,t,e,n){const o=this.$evCanvasCtx;o.beginPath(),o.globalAlpha=n,this.evDrawSvgPathOnCanvas(o,a),o.strokeStyle=e,o.lineWidth=t*this.viewScale<.5?.5/this.viewScale:t,o.stroke(),o.globalAlpha=1}getPointValue(a,t,e){return e?a+parseFloat(t):parseFloat(t)}evDrawSvgPathOnCanvas(a,t){const e=t.match(/[a-zA-Z][^a-zA-Z]*/g);if(!e)return;let n=0,o=0,s=0,r=0,l=0,c=0,h=0,d=0,f="";a.beginPath(),e.forEach(p=>{const u=p.trim(),g=u.charAt(0),y=u.substring(1).trim().split(/[ ,]+/).filter(_=>_!=="").map(parseFloat);let L=0,m=0,w=0,b=0,M=0,N=0,O=0,E=0,T=0,D=0,R=0;switch(g){case"M":n=y[0],o=y[1],s=n,r=o,a.moveTo(n+this.offset.x,o+this.offset.y);for(let _=2;_<y.length;_+=2)n=y[_],o=y[_+1],a.lineTo(n+this.offset.x,o+this.offset.y);break;case"L":for(let _=0;_<y.length;_+=2)n=y[_],o=y[_+1],a.lineTo(n+this.offset.x,o+this.offset.y);break;case"l":for(let _=0;_<y.length;_+=2)n+=y[_],o+=y[_+1],a.lineTo(n+this.offset.x,o+this.offset.y);break;case"H":for(let _=0;_<y.length;_++)n=y[_],a.lineTo(n+this.offset.x,o+this.offset.y);break;case"h":for(let _=0;_<y.length;_++)n+=y[_],a.lineTo(n+this.offset.x,o+this.offset.y);break;case"V":for(let _=0;_<y.length;_++)o=y[_],a.lineTo(n+this.offset.x,o+this.offset.y);break;case"v":for(let _=0;_<y.length;_++)o+=y[_],a.lineTo(n+this.offset.x,o+this.offset.y);break;case"C":for(let _=0;_<y.length;_+=6)w=y[_],b=y[_+1],M=y[_+2],N=y[_+3],L=y[_+4],m=y[_+5],a.bezierCurveTo(w+this.offset.x,b+this.offset.y,M+this.offset.x,N+this.offset.y,L+this.offset.x,m+this.offset.y),n=L,o=m,l=M,c=N;break;case"c":for(let _=0;_<y.length;_+=6)w=n+y[_],b=o+y[_+1],M=n+y[_+2],N=o+y[_+3],L=n+y[_+4],m=o+y[_+5],a.bezierCurveTo(w+this.offset.x,b+this.offset.y,M+this.offset.x,N+this.offset.y,L+this.offset.x,m+this.offset.y),l=M,c=N,n=L,o=m;break;case"S":for(let _=0;_<y.length;_+=4)f.match(/[CS]/i)?(w=2*n-l,b=2*o-c):(w=n,b=o),M=y[_],N=y[_+1],L=y[_+2],m=y[_+3],a.bezierCurveTo(w+this.offset.x,b+this.offset.y,M+this.offset.x,N+this.offset.y,L+this.offset.x,m+this.offset.y),n=L,o=m,l=M,c=N;break;case"s":for(let _=0;_<y.length;_+=4)f.match(/[CS]/i)?(w=2*n-l,b=2*o-c):(w=n,b=o),M=n+y[_],N=o+y[_+1],L=n+y[_+2],m=o+y[_+3],a.bezierCurveTo(w+this.offset.x,b+this.offset.y,M+this.offset.x,N+this.offset.y,L+this.offset.x,m+this.offset.y),l=M,c=N,n=L,o=m;break;case"Q":for(let _=0;_<y.length;_+=4)w=y[_],b=y[_+1],L=y[_+2],m=y[_+3],a.quadraticCurveTo(w+this.offset.x,b+this.offset.y,L+this.offset.x,m+this.offset.y),n=L,o=m,h=w,d=b;break;case"q":for(let _=0;_<y.length;_+=4)w=n+y[_],b=o+y[_+1],L=n+y[_+2],m=o+y[_+3],a.quadraticCurveTo(w+this.offset.x,b+this.offset.y,L+this.offset.x,m+this.offset.y),h=w,d=b,n=L,o=m;break;case"T":for(let _=0;_<y.length;_+=2)f.match(/[QT]/i)?(w=2*n-h,b=2*o-d):(w=n,b=o),L=y[_],m=y[_+1],a.quadraticCurveTo(w+this.offset.x,b+this.offset.y,L+this.offset.x,m+this.offset.y),n=L,o=m,h=w,d=b;break;case"t":for(let _=0;_<y.length;_+=2)f.match(/[QT]/i)?(w=2*n-h,b=2*o-d):(w=n,b=o),L=n+y[_],m=o+y[_+1],a.quadraticCurveTo(w+this.offset.x,b+this.offset.y,L+this.offset.x,m+this.offset.y),h=w,d=b,n=L,o=m;break;case"A":for(let _=0;_<y.length;_+=7)O=y[_],E=y[_+1],T=y[_+2],D=y[_+3],R=y[_+4],L=y[_+5],m=y[_+6],this.drawArc(a,n,o,O,E,T,D,R,L,m),n=L,o=m;break;case"a":for(let _=0;_<y.length;_+=7)O=y[_],E=y[_+1],T=y[_+2],D=y[_+3],R=y[_+4],L=n+y[_+5],m=o+y[_+6],this.drawArc(a,n,o,O,E,T,D,R,L,m),n=L,o=m;break;case"Z":case"z":a.closePath(),n=s,o=r;break;default:console.warn(`\u672A\u652F\u6301\u7684SVG\u547D\u4EE4\u5B57\u7B26: ${g}`)}g.match(/[CSQT]/i)?f=g:f=""})}drawArc(a,t,e,n,o,s,r,l,c,h){if(n=Math.abs(n),o=Math.abs(o),n===0||o===0){a.lineTo(c+this.offset.x,h+this.offset.y);return}const d=s%360*Math.PI/180,f=Math.sin(d),p=Math.cos(d),u=p*(t-c)/2+f*(e-h)/2,g=-f*(t-c)/2+p*(e-h)/2,x=u*u/(n*n)+g*g/(o*o);x>1&&(n*=Math.sqrt(x),o*=Math.sqrt(x));let y=(r===l?-1:1)*Math.sqrt(Math.max(0,(n*n*o*o-n*n*g*g-o*o*u*u)/(n*n*g*g+o*o*u*u)));isNaN(y)&&(y=0);const L=y*n*g/o,m=y*-o*u/n,w=p*L-f*m+(t+c)/2,b=f*L+p*m+(e+h)/2,M=(u-L)/n,N=(g-m)/o,O=(-u-L)/n,E=(-g-m)/o;let T=Math.atan2(N,M),D=Math.atan2(N*O-M*E,M*O+N*E);l===0&&D>0?D-=2*Math.PI:l===1&&D<0&&(D+=2*Math.PI);const R=T+D;a.ellipse?a.ellipse(w+this.offset.x,b+this.offset.y,n,o,d,T,R,l===0):(console.warn("ctx.ellipse is not supported. Arc will be drawn as a line."),a.lineTo(c+this.offset.x,h+this.offset.y))}}class Ln extends Cn{constructor(t,e){super(t,e);S(this,"$easyViewCanvas");S(this,"rgWebglCanvas");S(this,"easyViewUpdating",!1);S(this,"easyViewUpdateTimer");S(this,"easyViewOffset",{x:0,y:0})}setEasyViewCanvas(t){this.$easyViewCanvas=t,this.rgWebglCanvas=new _n(t)}startUpdateTask(){this.updateEasyView(),requestAnimationFrame(this.startUpdateTask.bind(this))}updateEasyView(){this.updateMiniView(),this.options.performanceMode&&(!this.options.showEasyView||requestAnimationFrame(this._updateEasyView.bind(this)))}_updateEasyView(t){try{this._updateShouldRenderGraphData(),this.evDosomethingBeforeDraw(),this.evDrawAllLines(),this.evDrawAllNodes()}catch(e){console.error(e)}}evDosomethingBeforeDraw(){const t=this.$easyViewCanvas.getBoundingClientRect(),e=t.width,n=t.height;this.$easyViewCanvas.width=e,this.$easyViewCanvas.height=n,this.rgWebglCanvas.setSize(e,n),v("updateEasyView",e,n);const o=this.options.canvasZoom/100;this.rgWebglCanvas.setScale(o),this.easyViewOffset.x=this.options.canvasOffset.x,this.easyViewOffset.y=this.options.canvasOffset.y,this.rgWebglCanvas.setViewOffset(this.easyViewOffset.x,this.easyViewOffset.y),this.rgWebglCanvas.beforeDraw()}evDrawAllNodes(){for(const t of this.graphData.nodes)!(t.rgShouldRender!==!1&&t.rgCalcedVisible&&t.opacity!==0)||this.evDrawNode(t)}evDrawNode(t){t.nodeShape===zt.circle?this.evDrawNode4Circle(t):this.evDrawNode4Rect(t)}getNodeColor(t){const e=t.color||this.options.defaultNodeColor||"#dddddd";return e==="transparent"?"rgba(204,204,204,0.55)":e.toLowerCase()==="#ffffff"||e.toLowerCase()==="white"||e.replace(/ /g,"").includes("255,255,255")?"#cccccc":e}evDrawNode4Rect(t){const e=t.el.offsetWidth,n=t.el.offsetHeight,o=t.opacity||1,s=this.getNodeColor(t),r=t.borderRadius===void 0?3:t.borderRadius;this.rgWebglCanvas.evDrawNode4Rect(t.x,t.y,e,n,s,o,r)}evDrawNode4Circle(t){const e=t.el.offsetWidth,n=t.el.offsetHeight,o=t.opacity||1,s=this.getNodeColor(t);this.rgWebglCanvas.evDrawNode4Circle(t.x,t.y,e,n,s,o)}evDrawAllLines(){for(const t of this.runtimeDATA4Links){const e=t.fromNode.rgShouldRender!==!1&&t.fromNode.opacity!==0&&t.fromNode.rgCalcedVisible,n=t.toNode.rgShouldRender!==!1&&t.toNode.opacity!==0&&t.toNode.rgCalcedVisible;!e&&!n||this.evDrawLine(t,t.line)}}evDrawLine(t,e){const n=this.createLineDrawInfo(t,e),o=e.opacity||1,s=e.lineWidth||1,r=e.color||this.options.defaultLineColor||"#888888";this.rgWebglCanvas.evDrawLine(n.pathData,s,r,o)}getPointValue(t,e,n){return n?t+parseFloat(e):parseFloat(e)}}class wn extends Ln{constructor(){super(...arguments);S(this,"_onResizing");S(this,"_onResizeEnd");S(this,"_startPoint",{x:0,y:0});S(this,"_startSize",{x:0,y:0,width:0,height:0});S(this,"_resizeType","l");S(this,"nodeStartSizeMap",new WeakMap);S(this,"resizeMiniLimit",{width:10,height:10});S(this,"_currentCreatingLineIsReverse",!1);S(this,"_startCreateLineFromNodeTime",0)}setEditingNodes(t){this.options.editingController.nodes.forEach(e=>{e.selected=!1}),this.options.editingController.nodes.splice(0,this.options.editingController.nodes.length),this.options.editingController.nodes.push(...t),this.options.editingController.show=this.options.editingController.nodes.length>0,this.updateEditingControllerView()}addEditingNode(t){this.options.editingController.nodes.forEach(e=>{e.selected=!1}),this.options.editingController.show=!0,this.options.editingController.nodes.push(t),this.updateEditingControllerView()}removeEditingNode(t){this.options.editingController.nodes.forEach(e=>{e.selected=!1}),this.options.editingController.nodes.splice(this.options.editingController.nodes.indexOf(t),1),this.options.editingController.show=this.options.editingController.nodes.length>0,this.updateEditingControllerView()}toggleEditingNode(t){this.options.editingController.nodes.forEach(e=>{e.selected=!1}),this.options.editingController.nodes.includes(t)?this.removeEditingNode(t):this.addEditingNode(t)}updateEditingControllerView(){if(this.updateEditingLineView(),this.updateEditingConnectControllerView(),!this.options.editingController.show)return;this.options.editingController.nodes.length>1&&this.options.editingController.nodes.forEach(h=>{h.selected=!0});const{minX:t,minY:e,maxX:n,maxY:o}=this.getStuffSize(this.options.editingController.nodes),s=this.options.editingController.nodes.length>1?5:0,r=this.options.canvasZoom/100;let l=n-t,c=o-e;if(l<0&&(l=0),c<0&&(c=0),l>0&&c>0){const h=this.getViewXyByCanvasXy({x:t,y:e});this.options.editingController.x=h.x-s*r,this.options.editingController.y=h.y-s*r,this.options.editingController.width=l*r+s*2*r,this.options.editingController.height=c*r+s*2*r}else this.options.editingController.show=!1;this.dataUpdated()}_getEventPoint(t){const e={x:t.clientX,y:t.clientY};if(it(t)){const o=t.touches||t.targetTouches;if(!o)throw new Error("error targetTouches");e.x=o[0].clientX,e.x=o[0].clientY}const n=this.getBoundingClientRect();return{x:e.x-n.x,y:e.y-n.y}}onResizeStart(t,e){this._resizeType=t,this._startPoint=this._getEventPoint(e),this._startSize.x=this.options.editingController.x,this._startSize.y=this.options.editingController.y,this._startSize.width=this.options.editingController.width,this._startSize.height=this.options.editingController.height;for(const n of this.options.editingController.nodes)this.nodeStartSizeMap.set(n,{x:n.x,y:n.y,width:n.el.offsetWidth,height:n.el.offsetHeight});this._onResizing&&this.$dom.removeEventListener("mousemove",this._onResizing),this._onResizeEnd&&this.$dom.removeEventListener("mouseup",this._onResizeEnd),this._onResizing=this.onResizing.bind(this),this._onResizeEnd=this.onResizeEnd.bind(this),this.$dom.addEventListener("mousemove",this._onResizing),this.$dom.addEventListener("mouseup",this._onResizeEnd),this.emitEvent(I.onResizeStart,this.options.editingController.nodes)}onResizing(t){const e=this._getEventPoint(t),n=e.x-this._startPoint.x,o=e.y-this._startPoint.y;let s=this.options.editingController.width,r=this.options.editingController.height;const l=1;this._resizeType==="tl"?(this.options.editingController.x=this._startSize.x+n/l,this.options.editingController.y=this._startSize.y+o/l,s=this._startSize.width-n/l,r=this._startSize.height-o/l):this._resizeType==="tr"?(this.options.editingController.y=this._startSize.y+o/l,s=this._startSize.width+n/l,r=this._startSize.height-o/l):this._resizeType==="bl"?(this.options.editingController.x=this._startSize.x+n/l,s=this._startSize.width-n/l,r=this._startSize.height+o/l):this._resizeType==="br"?(s=this._startSize.width+n/l,r=this._startSize.height+o/l):this._resizeType==="t"?(this.options.editingController.y=this._startSize.y+o/l,r=this._startSize.height-o/l):this._resizeType==="r"?s=this._startSize.width+n/l:this._resizeType==="b"?r=this._startSize.height+o/l:this._resizeType==="l"&&(this.options.editingController.x=this._startSize.x+n/l,s=this._startSize.width-n/l),s<this.resizeMiniLimit.width&&(s=this.resizeMiniLimit.width),r<this.resizeMiniLimit.width&&(r=this.resizeMiniLimit.width),this.options.editingController.width=s,this.options.editingController.height=r,this._applyResizeScale(t),this.dataUpdated()}_applyResizeScale(t){const e=this.options.editingController.width/this._startSize.width,n=this.options.editingController.height/this._startSize.height,o=this.getCanvasXyByViewXy({x:this._startSize.x,y:this._startSize.y}),s=this.getCanvasXyByViewXy({x:this.options.editingController.x,y:this.options.editingController.y});let r=!0,l=!0;this._resizeType==="t"||this._resizeType==="b"?r=!1:(this._resizeType==="r"||this._resizeType==="l")&&(l=!1);for(const c of this.options.editingController.nodes){const h=this.nodeStartSizeMap.get(c),d=h.width*e,f=h.height*n,p=s.x+e*(h.x-o.x),u=s.y+n*(h.y-o.y),g=d,x=f;this.emitEvent(I.beforeNodeResize,c,p,u,g,x)===!1||(r&&(c.x=p,c.width=g,c.el.offsetWidth=g),l&&(c.y=u,c.height=x,c.el.offsetHeight=x),v("ResizeNode:",c.id,g,x,e,n))}this.updateEditingControllerView()}onResizeEnd(t){const e=this._getEventPoint(t),n=e.x-this._startPoint.x,o=e.y-this._startPoint.y;this._applyResizeScale(t),this.$dom.removeEventListener("mousemove",this._onResizing),this.$dom.removeEventListener("mouseup",this._onResizeEnd),this._onResizing=null,this._onResizeEnd=null,this.emitEvent(I.onResizeEnd,this.options.editingController.nodes,n,o,t)}draggingSelectedNodes(t,e,n,o,s){const r=this.updateReferenceLineView(t,e,n,o,s);if(r){const{showV:l,fixedX:c,showH:h,fixedY:d}=r;l&&(o+=c-e,e=c),h&&(s+=d-n,n=d)}if(!this.options.editingController.nodes.includes(t))this.setNodePosition(t,e,n),this.updateEditingLineView();else{for(const l of this.options.editingController.nodes){const c=this.nodeXYBeforeDrag[l.id];c&&(l.x=c.x+o,l.y=c.y+s)}this.updateEditingControllerView()}}getNodesInSelectionView(t){const e=this.getCanvasXyByViewXy({x:t.x,y:t.y}),n=this.getCanvasXyByViewXy({x:t.x+t.width,y:t.y+t.height}),o=[];return this.getNodes().forEach(s=>{const r=s.x+s.el.offsetWidth/2,l=s.y+s.el.offsetHeight/2;r>e.x&&l>e.y&&r<n.x&&l<n.y&&o.push(s)}),o}updateEditingConnectControllerView(){if(!this.options.nodeConnectController.show)return;const t=this.options.nodeConnectController.node,e=t.x,n=t.y,o=t.x+t.el.offsetWidth,s=t.y+t.el.offsetHeight,r=0,l=this.options.canvasZoom/100,c=e,h=n,d=o-e,f=s-n,p=this.getViewXyByCanvasXy({x:c,y:h});this.options.nodeConnectController.x=p.x-r*l,this.options.nodeConnectController.y=p.y-r*l,this.options.nodeConnectController.width=d*l+r*2*l,this.options.nodeConnectController.height=f*l+r*2*l,this.dataUpdated()}setEditingLine(t,e){this.options.editingLineController.link=e,this.options.editingLineController.line=t,this.options.editingLineController.show=!!t,this.updateEditingLineView(!0)}updateReferenceLineView(t,e,n,o,s){if(!this.options.showReferenceLine)return;if(!this.options.editingReferenceLine.show){const b=Math.abs(o),M=Math.abs(s);b+M>2&&(this.options.editingReferenceLine.show=!0)}if(!this.options.editingReferenceLine.show)return;const r=e,l=t.el.offsetWidth,c=t.el.offsetHeight,h=e+l/2,d=e+l,f=n,p=n+c/2,u=n+c,g=this.getViewXyByCanvasXy({x:h,y:p});let x=!1,y=!1,L=0,m=0;const w=this.graphData.nodes.filter(b=>this.nodeXYBeforeDrag[b.id]?!1:Math.abs(b.x-h)<600&&Math.abs(b.y-p)<600);w.sort((b,M)=>{const N=dt(h,p,b.x+b.el.offsetWidth/2,b.y+b.el.offsetHeight/2),O=dt(h,p,M.x+M.el.offsetWidth/2,M.y+M.el.offsetHeight/2);return N<O?-1:1});for(const b of w){const M=b.x,N=b.el.offsetWidth,O=b.el.offsetHeight,E=b.x+N/2,T=b.x+N,D=b.y,R=b.y+O/2,_=b.y+O,z=Math.abs(r-M),F=Math.abs(h-E),V=Math.abs(d-T),P=Math.abs(f-D),$=Math.abs(p-R),Y=Math.abs(u-_),j=5;if(F<800&&$<800){if(!y&&F<j){const X=this.getViewXyByCanvasXy({x:E,y:R});this.options.editingReferenceLine.v_x=X.x,this.options.editingReferenceLine.v_y=g.y>X.y?X.y:g.y,this.options.editingReferenceLine.v_height=Math.round(Math.abs(g.y-X.y)),y=!0,L=E-l/2}if(!y&&z<j){const X=this.getViewXyByCanvasXy({x:M,y:R});this.options.editingReferenceLine.v_x=X.x,this.options.editingReferenceLine.v_y=g.y>X.y?X.y:g.y,this.options.editingReferenceLine.v_height=Math.round(Math.abs(g.y-X.y)),y=!0,L=M}if(!y&&V<j){const X=this.getViewXyByCanvasXy({x:T,y:R});this.options.editingReferenceLine.v_x=X.x,this.options.editingReferenceLine.v_y=g.y>X.y?X.y:g.y,this.options.editingReferenceLine.v_height=Math.round(Math.abs(g.y-X.y)),y=!0,L=T-l}if(!x&&$<j){const X=this.getViewXyByCanvasXy({x:E,y:R});this.options.editingReferenceLine.h_y=X.y,this.options.editingReferenceLine.h_x=g.x>X.x?X.x:g.x,this.options.editingReferenceLine.h_width=Math.round(Math.abs(g.x-X.x)),x=!0,m=R-c/2}if(!x&&P<j){const X=this.getViewXyByCanvasXy({x:E,y:D});this.options.editingReferenceLine.h_y=X.y,this.options.editingReferenceLine.h_x=g.x>X.x?X.x:g.x,this.options.editingReferenceLine.h_width=Math.round(Math.abs(g.x-X.x)),x=!0,m=D}if(!x&&Y<j){const X=this.getViewXyByCanvasXy({x:E,y:_});this.options.editingReferenceLine.h_y=X.y,this.options.editingReferenceLine.h_x=g.x>X.x?X.x:g.x,this.options.editingReferenceLine.h_width=Math.abs(g.x-X.x),x=!0,m=_-c}if(x&&y)break}}if(this.options.editingReferenceLine.directionH=x,this.options.editingReferenceLine.directionV=y,this.options.referenceLineAdsorption)return{showV:y,fixedX:L,showH:x,fixedY:m}}hideEditingLineView(){this.options.editingLineController.show=!1}updateEditingLineView(t=!1){this.updateElementLines();const e=this.options;if(!e.editingLineController.show)return;const n=e.editingLineController.link,o=e.editingLineController.line;if(!o||o.to==="newRelationTemplate-to"){e.editingLineController.show=!1;return}let s,r,l;const c=this.createLineDrawInfo(n,o);if(!c){e.editingLineController.show=!1;return}if(o.lineShape===G.StandardOrthogonal){let{textPosition:m,pathData:w,points:b,startDirection:M,endDirection:N}=c;l=m,s=b[0],r=b[b.length-1];const O=[];for(let E=0;E<b.length-1;E++){const T=b[E],D=b[E+1],R={pIndex:E,optionName:"cp-"+E,x:0,y:0,direction:"v",startDirection:M,endDirection:N};T.x!==D.x&&(R.direction="h");const _=this.getViewXyByCanvasXy({x:(T.x+D.x)/2,y:(T.y+D.y)/2});R.x=_.x,R.y=_.y,O.push(R)}if(O.length!==1){if(O.length!==2)if(O.length===3){const E=b[0],T=b[1],D=b[3];if(O[1].direction==="v"){const R=E.x,_=T.x,z=D.x;if(Math.max(R,_,z)!==_&&Math.min(R,_,z)!==_)O[1].optionName="cx";else{const V=Math.abs(_-R),P=Math.abs(_-z);V>=P?O[1].optionName="td":V<P&&(O[1].optionName="fd")}}else{const R=E.y,_=T.y,z=D.y;if(Math.max(R,_,z)!==_&&Math.min(R,_,z)!==_)O[1].optionName="cy";else{const V=Math.abs(_-R),P=Math.abs(_-z);V>=P?O[1].optionName="td":V<P&&(O[1].optionName="fd")}}}else O.length===4?(O[1].optionName="fd",O[2].optionName="td"):O.length===5&&(O[1].optionName="fd",O[2].direction==="v"?O[2].optionName="cx":O[2].optionName="cy",O[3].optionName="td")}e.editingLineController.line44Splits=O,e.editingLineController.line49Points=b,o.ctrlPointsFor49||(o.ctrlPointsFor49=b)}else if(o.lineShape===G.HardOrthogonal){let{textPosition:m,pathData:w,points:b,startDirection:M,endDirection:N}=c;l=m;const O=[];o.ctrlPointsFor49=b,s=b[0],r=b[b.length-1];const E=b;for(let T=0;T<E.length-1;T++){const D=E[T],R=E[T+1],_={pIndex:T,optionName:"cp-"+T,x:0,y:0,direction:"v",startDirection:M,endDirection:N};D.x!==R.x?(_.direction="h",Math.abs(D.x-R.x)<15&&(_.hide=!0)):Math.abs(D.y-R.y)<15&&(_.hide=!0);const z=this.getViewXyByCanvasXy({x:(D.x+R.x)/2,y:(D.y+R.y)/2});_.x=z.x,_.y=z.y,O.push(_)}for(let T=0;T<O.length;T++){const D=O[T-1],R=O[T],_=O[T+1];T===0&&R.direction===_.direction&&(R.hide=!0),T===O.length-1&&R.direction===D.direction&&(R.hide=!0)}e.editingLineController.line44Splits=O,e.editingLineController.line49Points=E}else if(o.lineShape!==1){l=c.textPosition;const m=Zt(c.pathData);o.isReverse?(s=m.endPoint,r=m.startPoint,e.editingLineController.ctrlPoint1=this.getViewXyByCanvasXy(m.ctrl1),e.editingLineController.ctrlPoint2=this.getViewXyByCanvasXy(m.ctrl2)):(s=m.startPoint,r=m.endPoint,e.editingLineController.ctrlPoint1=this.getViewXyByCanvasXy(m.ctrl1),e.editingLineController.ctrlPoint2=this.getViewXyByCanvasXy(m.ctrl2))}else{l=c.textPosition;const m=c.pathData,w=Zt(m);s=w.startPoint,r=w.endPoint}const h=this.getViewXyByCanvasXy(o.isReverse?r:s),d=this.getViewXyByCanvasXy(o.isReverse?s:r);e.editingLineController.startPoint.x=h.x,e.editingLineController.startPoint.y=h.y,e.editingLineController.endPoint.x=d.x,e.editingLineController.endPoint.y=d.y;const f=this.getViewXyByCanvasXy(l),p=this.$canvasDom.querySelector(`g[data-id='${o.id}']`);let u=0,g=0,x=o.textOffset_x||0,y=o.textOffset_y||0;const L=e.canvasZoom/100;if(p){const m=p.querySelector("text.rg-line-text");if(m){x=Math.floor(parseFloat(m.getAttribute("x")||"0")),y=Math.floor(parseFloat(m.getAttribute("y")||"0"));const w=m.clientWidth,b=m.clientHeight;e.editingLineController.text.width=w,e.editingLineController.text.height=b}else e.editingLineController.text.width=20,e.editingLineController.text.height=10,u=-e.editingLineController.text.width/2}e.editingLineController.text.width+=40,e.editingLineController.text.height+=10,e.editingLineController.text.width>120&&(e.editingLineController.text.width=120),e.editingLineController.text.height>20&&(e.editingLineController.text.height=20),e.editingLineController.text.x=f.x+u+x*L,e.editingLineController.text.y=f.y+g+y*L}getStartAndEndPoint(t){const e=t.match(/[a-zA-Z][^a-zA-Z]*/g);let n=0,o=0,s=0,r=0;const l={x:0,y:0},c={x:0,y:0};for(const h of e){const d=h.trim().split(/[ ,]+/),f=d[0].toUpperCase(),p=d[0]===d[0].toLowerCase();switch(f){case"M":n=this.getPointValue(s,d[1],p)+this.easyViewOffset.x,o=this.getPointValue(r,d[2],p)+this.easyViewOffset.y,s=n,r=o;break;case"L":n=this.getPointValue(s,d[1],p)+this.easyViewOffset.x,o=this.getPointValue(r,d[2],p)+this.easyViewOffset.y;break;case"C":this.getPointValue(s,d[1],p),this.getPointValue(r,d[2],p),this.getPointValue(s,d[3],p),this.getPointValue(r,d[4],p),n=this.getPointValue(s,d[5],p),o=this.getPointValue(r,d[6],p),s=n,r=o;break;case"Q":this.getPointValue(s,d[1],p),this.getPointValue(r,d[2],p),n=this.getPointValue(s,d[3],p),o=this.getPointValue(r,d[4],p),s=n,r=o;break;case"V":o=this.getPointValue(r,d[1],p),r=o;break;case"H":n=this.getPointValue(s,d[1],p),s=n;break;case"Z":break;default:v(`Unsupported command: ${f}`)}h===e[0]&&(l.x=n,l.y=o),h===e[e.length-1]&&(c.x=n,c.y=o)}return{startPoint:l,endPoint:c}}startMoveLineVertex(t,e,n){e.stopPropagation();const o=this.options.editingLineController.link,s=this.options.editingLineController.line;let r,l;if(o)r=o.fromNode,l=o.toNode;else{const{from:L,to:m}=this.generateFakeLineConfig(s);r=L,l=m}let c=r;this.setEditingLine(null,null),o?this.removeLine(s):this.removeFakeLine(s),console.log("DragLine start:",t,s.isReverse),this._currentCreatingLineIsReverse=!1;const{startMarkerId:h,endMarkerId:d,fromJunctionPoint:f,fromJuctionPointOffsetX:p,fromJuctionPointOffsetY:u,toJunctionPoint:g,toJuctionPointOffsetX:x,toJuctionPointOffsetY:y}=this.options.newLineTemplate;s.lineShape===G.HardOrthogonal&&(s.lineShape=G.StandardOrthogonal),t==="start"?(s.fromJuctionPointOffsetX=0,s.fromJuctionPointOffsetY=0,s.isReverse?this._currentCreatingLineIsReverse=!0:(c=l,s.isReverse=!0)):(s.toJuctionPointOffsetX=0,s.toJuctionPointOffsetY=0,s.isReverse&&(c=l,s.isReverse=void 0,this._currentCreatingLineIsReverse=!0)),this._currentCreatingLineIsReverse&&(this.options.newLinkTemplate.fromJunctionPoint=g,this.options.newLinkTemplate.toJunctionPoint=f,this.options.newLineTemplate.startMarkerId=d,this.options.newLineTemplate.endMarkerId=h,this.options.newLineTemplate.fromJuctionPointOffsetX=p,this.options.newLineTemplate.fromJuctionPointOffsetY=u,this.options.newLineTemplate.toJuctionPointOffsetX=x,this.options.newLineTemplate.toJuctionPointOffsetY=y),this.startCreatingLinePlot(e,{template:s,fromNode:c,onCreateLine:n})}startCreateLineFromNode(t,e,n,o){if(n.stopPropagation(),this._startCreateLineFromNodeTime=Date.now(),!e.from){if(!t){const r=this.options.editingController.nodes;r.length===1&&(t=r[0])}t&&(e.from=t.id,e.fromType=t.targetType)}if(!e.from)throw console.error("Error:lineTemplate:",e),Error("Error:startCreateLineByTemplate: lineTemplate must has [fromType, from]");const s=this.getFakeLineTarget(e.fromType,e.from,e);if(!s)throw console.error("Error:fakeTarget[fromType, from]:",e.fromType,e.from,e),Error(`Error:startCreateLineByTemplate: error from fakeTarget[fromType, from]:${e.fromType}, ${e.from}`);e.lineShape||(e.lineShape=6),this.startCreatingLinePlot(n,{template:e,fromNode:s,onCreateLine:o})}onLineVertexBeDropped(t,e,n={x:0,y:0},o){if(e.stopPropagation(),!this.options.creatingLinePlot||Date.now()-this._startCreateLineFromNodeTime<500)return;console.log("Connect end:",this.options.newLineTemplate.isReverse);const s=this.options.nodeConnectController.node;if(!this.options.newLinkTemplate.fromNode)this.options.newLineTemplate.isReverse?(this.options.newLineTemplate.toJunctionPoint=t,this.options.newLineTemplate.toJuctionPointOffsetX=n.x,this.options.newLineTemplate.toJuctionPointOffsetY=n.y):(this.options.newLineTemplate.fromJunctionPoint=t,this.options.newLineTemplate.fromJuctionPointOffsetX=n.x,this.options.newLineTemplate.fromJuctionPointOffsetY=n.y),this.options.newLinkTemplate.fromNode=s;else{this.options.newLineTemplate.isReverse?(this.options.newLineTemplate.fromJunctionPoint=t,this.options.newLineTemplate.fromJuctionPointOffsetX=n.x,this.options.newLineTemplate.fromJuctionPointOffsetY=n.y):(this.options.newLineTemplate.toJunctionPoint=t,this.options.newLineTemplate.toJuctionPointOffsetX=n.x,this.options.newLineTemplate.toJuctionPointOffsetY=n.y),this.options.newLinkTemplate.toNodeObject=s;const r=this.options.newLinkTemplate.fromNode,l=s;try{this.emitEvent(I.onLineVertexDropped,{newLineTemplate:this.options.newLineTemplate,fromNode:r,toNode:l}),o&&o(r,l,this.options.newLineTemplate),this.onCreateLine(this.options.newLinkTemplate.fromNode,this.options.nodeConnectController.node)!==!0&&this.stopCreatingLinePlot()}catch(c){this.stopCreatingLinePlot(),console.warn("[Custom Reject onCreateLine By Throw Error:",c)}}}startMoveLineText(t,e){if(vt(t))return;const n=this._getEventPoint(t),o=this.options.editingLineController.line,s=o.textOffset_x||0,r=o.textOffset_y||0,l=h=>{const d=this.options.canvasZoom/100,f=this._getEventPoint(h),p=f.x-n.x,u=f.y-n.y;o.textOffset_x=Math.round(s+p/d),o.textOffset_y=Math.round(r+u/d),this.updateEditingLineView(),this._dataUpdated()},c=h=>{this.$dom.removeEventListener("mousemove",l),this.$dom.removeEventListener("mouseup",c),e&&e(),this._dataUpdated()};this.$dom.addEventListener("mousemove",l),this.$dom.addEventListener("mouseup",c)}startMoveLine6CtrlPoint(t,e){return e.stopPropagation(),e.preventDefault(),new Promise((n,o)=>{const r=this.options.editingLineController.line;r.ctrlPoints||(r.ctrlPoints=[]),r.ctrlPoints.length===0&&(r.ctrlPoints.push({x:0,y:0}),r.ctrlPoints.push({x:0,y:0})),r.isReverse&&(t=r.ctrlPoints.length-1-t);const c=this.options.canvasZoom/100,h=r.ctrlPoints[t],{x:d,y:f}=h,p=()=>{this.dataUpdated(),n()};W.startDrag(e,{x:0,y:0},p,(u,g)=>{h.x=d+u/c,h.y=f+g/c,this.updateEditingLineView(),this.dataUpdated()})})}startMoveLine44CtrlPoint(t,e){return e.stopPropagation(),e.preventDefault(),console.log("startMoveLine44CtrlPoint:",t.optionName),new Promise((n,o)=>{const s=this.options.editingLineController,r=s.line;r.ctrlOptionsFor44||(r.ctrlOptionsFor44={cx:0,cy:0,fd:0,td:0});const c=this.options.canvasZoom/100,h=r.ctrlOptionsFor44[t.optionName],d={indexOffset:0};let f=JSON.parse(JSON.stringify(r.ctrlPointsFor49));const p=()=>{if(r.lineShape===G.HardOrthogonal){const u=Ot(r.ctrlPointsFor49);r.ctrlPointsFor49=u}this.updateEditingLineView(),this.dataUpdated(),n()};W.startDrag(e,{x:0,y:0},p,(u,g)=>{if(r.lineShape===G.StandardOrthogonal)if(t.optionName==="cx"){const y=h+u/c*1;r.ctrlOptionsFor44.cx=y}else if(t.optionName==="cy"){const y=h+g/c*1;r.ctrlOptionsFor44.cy=y}else if(t.optionName==="fd"){const x=bt[t.startDirection],y=t.direction==="v"?u*x.x:g*x.y;r.ctrlOptionsFor44.fd=h+y/c}else if(t.optionName==="td"){const x=bt[t.endDirection],y=t.direction==="v"?u*x.x:g*x.y;r.ctrlOptionsFor44.td=h+y/c}else(t.direction==="v"&&Math.abs(u)>5||t.direction==="h"&&Math.abs(g)>5)&&(r.ctrlPointsFor49=s.line49Points,r.lineShape=49,f=JSON.parse(JSON.stringify(r.ctrlPointsFor49)));else if(r.lineShape===G.HardOrthogonal){const{newPoints:x,pointsChanged:y}=bn(r.ctrlPointsFor49,f,t.pIndex+d.indexOffset,t,d,u/c,g/c);y&&(f=JSON.parse(JSON.stringify(x))),r.ctrlPointsFor49=x}this.updateEditingLineView(),this.dataUpdated()})})}}const bn=(i,a,t,e,n,o,s)=>{const r=JSON.parse(JSON.stringify(i));let l=!1;if(t<0||t>=i.length-1)return{newPoints:r,pointsChanged:l};r[t-1];const c=r[t],h=r[t+1];a[t-1];const d=a[t];a[t+1];let f=o,p=s;if(e.direction==="v"){const u=a[t-2],g=a[t+2],x=d.x+f;let y=3e3;if(u){const L=Math.abs(u.x-x);L<10&&L<y&&(y=L,f=u.x-d.x)}if(g){const L=Math.abs(g.x-x);L<10&&L<y&&(y=L,f=g.x-d.x)}}else{const u=a[t-2],g=a[t+2],x=d.y+p;let y=3e3;if(u){const L=Math.abs(u.y-x);L<10&&L<y&&(y=L,p=u.y-d.y)}if(g){const L=Math.abs(g.y-x);L<10&&L<y&&(y=L,p=g.y-d.y)}}if(e.direction==="v")if(t===0){const u=c.y<h.y?1:-1,g={x:c.x,y:c.y},x={x:c.x,y:c.y+20*u};c.x=x.x+f,c.y=x.y,r.splice(t,0,g,x),n.indexOffset+=2,l=!0}else if(t===i.length-2){const u=c.y<h.y?1:-1,g={x:d.x+f,y:h.y-20*u},x={x:h.x,y:h.y-20*u};r.splice(t+1,0,g,x),l=!0}else c.x=d.x+f,h.x=d.x+f;else if(t===0){const u=c.x<h.x?1:-1,g={x:c.x,y:c.y},x={x:c.x+20*u,y:c.y};c.x=x.x,c.y=d.y+p,r.splice(t,0,g,x),n.indexOffset+=2,l=!0}else if(t===i.length-2){const u=c.x<h.x?1:-1,g={x:h.x-20*u,y:d.y+p},x={x:h.x-20*u,y:h.y};r.splice(t+1,0,g,x),l=!0}else c.y=d.y+p,h.y=d.y+p;return{newPoints:r,pointsChanged:l}};class On extends wn{constructor(t,e){super(t,e);S(this,"$miniViewCanvas");S(this,"$mvCanvasCtx");S(this,"mediaDPR");S(this,"miniViewUpdating",!1);S(this,"miniViewUpdateHasNext",!1);S(this,"canvasDomScale",1);S(this,"miniViewBox",{visibleAreaStart:{x:0,y:0},visibleAreaEnd:{x:0,y:0},canvas_start_x:0,canvas_start_y:0,canvas_end_x:0,canvas_end_y:0,canvas_width:0,canvas_height:0,miniview_width:0,miniview_height:0});S(this,"visibleArea",{x:0,y:0});S(this,"_canvasItemMiniSizeLimit",1);S(this,"miniviewVisiableHandleMoveing",!1)}initImageTool(){this.mediaDPR=window.devicePixelRatio||1}setMiniViewCanvas(t){this.$miniViewCanvas=t,this.$mvCanvasCtx=this.$miniViewCanvas.getContext("2d")}updateMiniView(){!this.options.showMiniView||requestAnimationFrame(this._updateMiniView.bind(this))}_updateMiniView(){try{this.miniViewUpdating=!0,this.mvDosomethingBeforeDraw(),this.mvDrawAllNodes(),this.mvDrawMask()}catch(t){console.error(t)}this.miniViewUpdating=!1,this.miniViewUpdateHasNext&&(this.miniViewUpdateHasNext=!1,this._updateMiniView())}mvDosomethingBeforeDraw(){let t=9999999,e=9999999,n=-9999999,o=-9999999,s=0;for(const L of this.getNodes())if(L.rgCalcedVisible&&L.opacity!==0){L.x<t&&(t=L.x),L.y<e&&(e=L.y);const m=L.x+L.el.offsetWidth,w=L.y+L.el.offsetHeight;m>n&&(n=m),w>o&&(o=w),s++}if(s===0)return;const r=1,l=50,c=50;this.miniViewBox.canvas_start_x=t-l,this.miniViewBox.canvas_start_y=e-c,this.miniViewBox.canvas_end_x=n+l,this.miniViewBox.canvas_end_y=o+c,this.miniViewBox.canvas_width=this.miniViewBox.canvas_end_x-this.miniViewBox.canvas_start_x,this.miniViewBox.canvas_height=this.miniViewBox.canvas_end_y-this.miniViewBox.canvas_start_y;const h=this.$miniViewCanvas.parentElement.getBoundingClientRect(),d=h.width,f=h.height;let p=0,u=0,g=r;d/this.miniViewBox.canvas_width<f/this.miniViewBox.canvas_height?(g=d/this.miniViewBox.canvas_width*r,p=d,u=d/this.miniViewBox.canvas_width*this.miniViewBox.canvas_height):(g=f/this.miniViewBox.canvas_height*r,p=f/this.miniViewBox.canvas_height*this.miniViewBox.canvas_width,u=f),this.miniViewBox.miniview_width=d,this.miniViewBox.miniview_height=f,this.$miniViewCanvas.width=d,this.$miniViewCanvas.height=f,this.$mvCanvasCtx.canvas.width=d*this.mediaDPR,this.$mvCanvasCtx.canvas.height=f*this.mediaDPR,this.$mvCanvasCtx.canvas.style.width=`${d}px`,this.$mvCanvasCtx.canvas.style.height=`${f}px`;const x=(f-u)/2,y=(d-p)/2;if(this.miniViewBox.canvas_start_x-=y/g,this.miniViewBox.canvas_start_y-=x/g,v("updateMiniView",y,x),this.$mvCanvasCtx.setTransform(this.mediaDPR,0,0,this.mediaDPR,0,0),this.$mvCanvasCtx.scale(g,g),!this.miniviewVisiableHandleMoveing){const L=this.getBoundingClientRect(),m=this.getCanvasXyByViewXy({x:0,y:0}),w=this.getCanvasXyByViewXy({x:L.width,y:L.height}),b=w.x-m.x,M=w.y-m.y;this.miniViewBox.visibleAreaStart=m,this.miniViewBox.visibleAreaEnd=w,this.options.miniViewVisibleHandle.width=g*b,this.options.miniViewVisibleHandle.height=g*M;const N=m.x-this.miniViewBox.canvas_start_x,O=m.y-this.miniViewBox.canvas_start_y;this.options.miniViewVisibleHandle.x=g*N,this.options.miniViewVisibleHandle.y=g*O,this.canvasDomScale=g,this.options.miniViewVisibleHandle.x+this.options.miniViewVisibleHandle.width<0||this.options.miniViewVisibleHandle.y+this.options.miniViewVisibleHandle.height<0||this.options.miniViewVisibleHandle.y>this.miniViewBox.miniview_height||this.options.miniViewVisibleHandle.x>this.miniViewBox.miniview_width?this.options.miniViewVisibleHandle.emptyContent=!0:this.options.miniViewVisibleHandle.emptyContent=!1}}mvDrawMask(){}mvDrawAllNodes(){const t=this.canvasDomScale;for(const e of this.getNodes())if(e.rgCalcedVisible&&e.opacity!==0){let n=e.el.offsetWidth,o=e.el.offsetHeight;t*n<this._canvasItemMiniSizeLimit&&(n=this._canvasItemMiniSizeLimit/this.canvasDomScale),t*o<this._canvasItemMiniSizeLimit&&(o=this._canvasItemMiniSizeLimit/this.canvasDomScale),this.mvDrawNode(e,n,o)}}mvDrawNode(t,e,n){t.nodeShape===0?this.mvDrawNode4Circle(t,e,n):this.mvDrawNode4Rect(t,e,n)}mvDrawNode4Rect(t,e,n){const o=this.$mvCanvasCtx,s=t.x-this.miniViewBox.canvas_start_x,r=t.y-this.miniViewBox.canvas_start_y;o.beginPath(),o.globalAlpha=t.opacity||1,o.rect(s,r,e,n),o.fillStyle=this.getNodeColor(t),o.fill(),o.globalAlpha=1}mvDrawNode4Circle(t,e,n){const o=this.$mvCanvasCtx,s=t.x+e/2-this.miniViewBox.canvas_start_x,r=t.y+n/2-this.miniViewBox.canvas_start_y;o.beginPath(),o.globalAlpha=t.opacity||1,o.ellipse(s,r,e/2,n/2,0,0,2*Math.PI),o.fillStyle=this.getNodeColor(t),o.fill(),o.globalAlpha=1}mvDrawAllLines(){for(const t of this.getLinks())t.fromNode.rgCalcedVisible&&t.toNode.rgCalcedVisible&&this.mvDrawLine(t,t.line)}mvDrawLine(t,e){const n=this.$mvCanvasCtx,o=this.createLineDrawInfo(t,e);n.beginPath(),n.globalAlpha=e.opacity||1,this.mvDrawSvgPathOnCanvas(n,o.pathData),n.strokeStyle=e.color||this.options.defaultLineColor||"#888888",n.lineWidth=e.lineWidth||1,n.stroke(),n.globalAlpha=1}mvDrawSvgPathOnCanvas(t,e){const n=e.match(/[a-zA-Z][^a-zA-Z]*/g);let o=0,s=0,r=0,l=0,c=0,h=0,d=0,f=0,p=!1;n.forEach(u=>{const g=u.trim().split(/[ ,]+/),x=g[0].toUpperCase(),y=g[0]===g[0].toLowerCase();switch(x){case"M":o=this.getPointValue(r,g[1],y)-this.miniViewBox.canvas_start_x,s=this.getPointValue(l,g[2],y)-this.miniViewBox.canvas_start_y,r=o,l=s,p&&(t.closePath(),p=!1),t.moveTo(o,s);break;case"L":o=this.getPointValue(r,g[1],y)-this.miniViewBox.canvas_start_x,s=this.getPointValue(l,g[2],y)-this.miniViewBox.canvas_start_y,t.lineTo(o,s);break;case"C":c=this.getPointValue(r,g[1],y),h=this.getPointValue(l,g[2],y),d=this.getPointValue(r,g[3],y),f=this.getPointValue(l,g[4],y),o=this.getPointValue(r,g[5],y),s=this.getPointValue(l,g[6],y),r=o,l=s,t.bezierCurveTo(c,h,d,f,o,s);break;case"Q":c=this.getPointValue(r,g[1],y),h=this.getPointValue(l,g[2],y),o=this.getPointValue(r,g[3],y),s=this.getPointValue(l,g[4],y),r=o,l=s;break;case"V":s=this.getPointValue(l,g[1],y),l=s,t.lineTo(o,s);break;case"H":o=this.getPointValue(r,g[1],y),r=o,t.lineTo(o,s);break;case"Z":t.closePath(),p=!1;break;default:v(`Unsupported command: ${x}`)}})}onVisiableViewHandleDragStart(t){t.preventDefault(),t.stopPropagation();const e=this.options.canvasOffset.x,n=this.options.canvasOffset.y,o=this.miniViewBox.canvas_width,s=this.miniViewBox.canvas_height,r=(c,h,d,f,p)=>{const u=c/this.miniViewBox.miniview_width,g=h/this.miniViewBox.miniview_height,x=this.options.canvasZoom/100,y=o*u*x,L=s*g*x;this.setCanvasOffset(e-y,n-L),this.updateEditingControllerView(),this.dataUpdated()},l=(c,h,d)=>{this.miniviewVisiableHandleMoveing=!1,this.onCanvasDragEnd(d)};W.startDrag(t,this.options.miniViewVisibleHandle,l,r)}resetByVisiableView(t){!this.options.miniViewVisibleHandle.emptyContent||(this.setZoom(100),this.moveToCenter(),this.zoomToFit())}}class Ce extends On{constructor(a,t){super(a,t)}setListeners(a){this.listeners=a}ready(){this.initDom(),this.resetViewSize(!0),this.initImageTool(),this.updateViewBoxInfo(),this.addFullscreenListener(),this.emitEvent(I.onReady,this)}beforeUnmount(){this.options.instanceDestroyed=!0,this.removeFullscreenListener(),this.removeKeyboardListener(),this.destroyMutationObserver(),this.destroyResizeObserver()}}const Gt=i=>{const[a,t]=k.useState(0),e=k.useRef(0),n=k.useRef(i.relationGraphCore?new i.relationGraphCore:new Ce),o=s=>{e.current++,t(e.current)};return k.useEffect(()=>{n.current.setUpdateViewHook(o),i.onProviderReady&&i.onProviderReady(n.current)},[]),C.jsx(C.Fragment,{children:C.jsx(Ve,{value:n.current,children:C.jsx(ze,{value:o,children:C.jsx(Be,{value:a,children:i.children})})})})},Sn=(i,a)=>{const t=k.useContext(H),e=k.useRef(i.relationGraphInstance);k.useImperativeHandle(a,()=>({getInstance(){return t||e.current},async setJsonData(o,s,r){throw new Error(`Please Initialize the graph using the new method:
|
|
49
|
+
Method 1:
|
|
50
|
+
// Use graphInstance to set the data.
|
|
51
|
+
const graphInstance = graphRef.current.getInstance();
|
|
52
|
+
await graphInstance.setJsonData(jsonData);
|
|
53
|
+
Method 2:
|
|
54
|
+
Set the initial data using the "initialData" property of the RelationGraph component.
|
|
55
|
+
Method 3:
|
|
56
|
+
Initialize using the onReady event of the RelationGraph component. then use graphInstance to set the data.`)}}),[]),k.useEffect(()=>{},[]);const n=o=>{console.error("onProviderReady::Index",o),e.current=o};return t?C.jsx(Ut,{...i,children:i.children}):C.jsx(Gt,{relationGraphCore:i.relationGraphCore,onProviderReady:n,children:C.jsx(Ut,{...i,children:i.children})})},_e=lt.default.forwardRef(Sn),Mn=({children:i,direction:a,positionH:t,positionV:e})=>{const n=k.useContext(H),o=async()=>{await n.refresh(),n.dataUpdated()},s=()=>{n.toggleAutoLayout()},r=async()=>{await n.fullscreen(),n.dataUpdated()},l=async()=>{n.setZoom(100),n.moveToCenter(),n.enableCanvasAnimation(),n.zoomToFit(),setTimeout(()=>{n.disableCanvasAnimation()},300)},c=d=>{n.zoom(d),n.dataUpdated()},h=n&&n.options;return C.jsxs("div",{className:["rg-toolbar","rg-toolbar-h-"+(t||h.toolBarPositionH),"rg-toolbar-v-"+(e||h.toolBarPositionV),"rg-toolbar-"+(a||h.toolBarDirection)].join(" "),children:[C.jsx("div",{className:"rg-mb-button",onClick:()=>{r()},children:C.jsx(Q,{iconName:"icon-quanping"})}),C.jsxs(lt.default.Fragment,{children:[C.jsx("div",{className:"rg-mb-button",onClick:()=>{c(20)},children:C.jsx(Q,{iconName:"icon-fangda"})}),C.jsxs("div",{className:"rg-current-zoom",onClick:()=>{l()},children:[Math.round(h.canvasZoom),"%"]}),C.jsx("div",{className:"rg-mb-button",onClick:()=>{c(-20)},children:C.jsx(Q,{iconName:"icon-suoxiao"})})]}),h.layout.supportAutoLayout&&C.jsx("div",{title:h.layout.autoLayouting?"Stop force":"Start force",className:["rg-mb-button",h.layout.autoLayouting&&"rg-mb-button-on"].join(" "),onClick:()=>{s()},children:h.layout.autoLayouting?C.jsx(Q,{iconName:"icon-lianjiezhong",className:"rg-loading-icon"}):C.jsx(Q,{iconName:"icon-zidong"})}),C.jsx("div",{className:"rg-mb-button",onClick:()=>{o()},children:C.jsx(Q,{iconName:"icon-ico_reset"})}),i,C.jsx("div",{style:{clear:"both"}})]})},Nn=({node:i,children:a})=>{const t=k.useRef(null),e=k.useContext(H);k.useContext(gt);const n=e.options,o=i.borderWidth===void 0?void 0:`${i.borderWidth}px`,s=i.width?`${i.width}px`:void 0,r=i.height?`${i.height}px`:void 0,l=()=>{const u=t.current;!u||u.offsetWidth===0&&u.offsetHeight===0||(i.el.offsetWidth!==u.offsetWidth||i.el.offsetHeight!==u.offsetHeight)&&e.updateNodeOffsetSize(i.id,u.offsetWidth,u.offsetHeight)};k.useEffect(()=>(l(),e.addNodeResizeListener(t.current,i),()=>{t.current&&e.removeNodeResizeListener(t.current)}),[]);const c=u=>{"button"in u&&u.button!==0||(u.stopPropagation(),e.onNodeDragStart(i,u.nativeEvent))},h=u=>{e.onNodeClick(i,u.nativeEvent)},d=["rg-node-peel",i.selected&&"rg-node-selected",i.dragging&&"rg-node-dragging",i.id===n.checkedNodeId&&"rg-node-peel-checked",i.className].filter(Boolean).join(" "),f=[`rg-node-shape-${i.nodeShape===void 0?1:i.nodeShape}`,`rg-node-type-${i.type}`,i.id===n.checkedNodeId?"rg-node-checked":"","rg-node"].filter(Boolean).join(" "),p={transform:`translate(${i.x}px, ${i.y}px)`,"--rg-node-z-index":i.zIndex,"--rg-node-opacity":i.opacity,pointerEvents:i.opacity===0?"none":void 0,"--rg-node-color":i.color||n.defaultNodeColor,"--rg-node-font-color":i.fontColor,"--rg-node-font-size":i.fontSize?`${i.fontSize}px`:void 0,"--rg-node-border-width":o,"--rg-node-border-radius":i.borderRadius?`${i.borderRadius}px`:void 0,"--rg-node-border-color":i.borderColor};return C.jsx("div",{ref:t,style:p,className:d,"data-id":i.id,children:C.jsx("div",{className:f,style:{width:s,height:r},onClick:h,onMouseDown:c,onTouchStart:c,children:a||C.jsx("div",{className:"rg-node-text",children:C.jsx("span",{children:i.text})})})})},Tn=({children:i})=>C.jsx(C.Fragment,{}),En=({children:i})=>{k.useContext(q);const a=k.useContext(H),t=a&&a.options;if(!t.editingController.show||t.snapshotting)return null;const e={width:t.editingController.width+"px",height:t.editingController.height+"px",transform:`translate(${t.editingController.x}px, ${t.editingController.y}px)`};return C.jsx("div",{className:"rg-editing-ctrl",style:e,children:i})},Dn=({disableResizeWidth:i,disableResizeHeight:a,beforeResizeStart:t})=>{const e=k.useContext(H);k.useContext(q);const n=e&&e.options,o=(s,r)=>{r.stopPropagation(),t&&t(),e.onResizeStart(s,r.nativeEvent)};return C.jsxs("div",{className:"rg-resize-ctl",children:[n.editingController.width>30&&!i&&!a&&C.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-tl",onMouseDown:s=>o("tl",s)}),n.editingController.width>30&&!i&&!a&&C.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-tr",onMouseDown:s=>o("tr",s)}),n.editingController.width>30&&!i&&!a&&C.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-bl",onMouseDown:s=>o("bl",s)}),!i&&!a&&C.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-br",onMouseDown:s=>o("br",s)}),(n.editingController.width>60||i)&&!a&&C.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-t",onMouseDown:s=>o("t",s)}),(n.editingController.width>60||i)&&!a&&C.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-b",onMouseDown:s=>o("b",s)}),(n.editingController.height>60||a)&&!i&&C.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-l",onMouseDown:s=>o("l",s)}),(n.editingController.height>60||a)&&!i&&C.jsx("div",{className:"rg-resize-ctl-handler rg-resize-ctl-r",onMouseDown:s=>o("r",s)})]})},kn=({position:i="br",width:a,height:t})=>{const e=k.useContext(H);k.useContext(q);const n=e&&e.options,o=k.useRef(null),s=k.useRef(null);k.useEffect(()=>(n.showMiniView=!0,e.setMiniViewCanvas(s.current),()=>{n.showMiniView=!1}),[]);const r=c=>{e.onVisiableViewHandleDragStart(c.nativeEvent)},l=async c=>{e.resetByVisiableView(c.nativeEvent)};return C.jsx("div",{className:`rg-miniview rg-miniview-${i}`,ref:o,style:{"--miniview-width":a,"--miniview-height":t},children:C.jsxs("div",{className:"rg-miniview-container",children:[C.jsx("canvas",{ref:s,className:n.miniViewVisibleHandle.emptyContent?"rg-mv-canvas-reset":"",onClick:l}),C.jsx("div",{className:"rg-mv-visible-area",onMouseDown:r,style:{left:`${n.miniViewVisibleHandle.x}px`,top:`${n.miniViewVisibleHandle.y}px`,width:n.miniViewVisibleHandle.width+"px",height:n.miniViewVisibleHandle.height+"px"}})]})})},Rn=({children:i,forDisplay:a,forImage:t,position:e,width:n,height:o})=>{const s=k.useContext(H);k.useContext(q);const r=s&&s.options,l=k.useRef(null);k.useEffect(()=>(s.setWatermarkDom(l.current,t,a,e),()=>{s.setWatermarkDom(null,a,t)}),[n,o]);let c=!1;return r.snapshotting?t===!1?c=!1:c=!0:a===!0?c=!0:c=!1,C.jsx("div",{className:`rg-watermark rg-watermark-${e||"br"}`,style:{display:c?"block":"none","--watermark-width":n,"--watermark-height":o},ref:l,children:i})},Pn=({children:i,forDisplay:a,forImage:t})=>{const e=k.useContext(H),n=k.useRef(null);return k.useEffect(()=>(n.current.style.backgroundColor="transparent",e.setBackgroundDom(n.current,a,t),()=>{e.setBackgroundDom(null,a,t)}),[]),C.jsx("div",{className:"rg-background",ref:n,children:i})},In=({position:i,children:a})=>{const t=i||"top";return C.jsx("div",{className:`rg-editing-bar rg-editing-bar-${t}`,children:a})},An=({textEditable:i=!0,moveLineVertexStart:a,moveLineVertexEnd:t,onLineTextDragEnd:e,onLineTextChanged:n,children:o})=>{const s=k.useContext(H);k.useContext(q);const l=s.options.editingLineController,c=l.line,h=l.show,d=c&&c.text,[f,p]=k.useState(!1),[u,g]=k.useState(""),x=k.useRef(0),y=k.useRef(null);k.useEffect(()=>{h||p(!1)},[h]),k.useEffect(()=>{d!==u&&g(d||"")},[d]),k.useEffect(()=>{s.updateEditingLineView()},[u,c==null?void 0:c.lineShape]),k.useEffect(()=>{f&&y.current&&y.current.focus()},[f]);const L=(P,$)=>{!c||(a&&a(P,c),s.startMoveLineVertex(P,$.nativeEvent,(Y,j,X)=>{t&&t(Y,j,X),s.defaultLineVertexBeChangedHandler(Y,j,X)}))},m=(P,$)=>{s.startMoveLine6CtrlPoint(P,$.nativeEvent)},w=(P,$)=>{s.startMoveLine44CtrlPoint(P,$.nativeEvent)},b=P=>{s.startMoveLineText(P.nativeEvent,()=>{c&&e&&e(c)})},M=()=>{x.current&&Date.now()-x.current<500&&p(!0),x.current=Date.now()},N=P=>{c&&c.text!==P.target.value&&(c.text=P.target.value,g(P.target.value),n&&n(c)),p(!1)};if(!h||!c)return null;const{startPoint:O,endPoint:E,ctrlPoint1:T,ctrlPoint2:D,line44Splits:R,text:_}=l,{lineShape:z}=c,F=`M ${O.x} ${O.y} L ${(T==null?void 0:T.x)||0} ${(T==null?void 0:T.y)||0}`,V=`M ${E.x} ${E.y} L ${(D==null?void 0:D.x)||0} ${(D==null?void 0:D.y)||0}`;return C.jsxs("div",{className:"rg-editing-line-ctrl",children:[o,C.jsx("svg",{className:"rg-edt-ctrl-svg",xmlns:"http://www.w3.org/2000/svg",children:C.jsxs("g",{children:[z===6&&T&&C.jsx("path",{d:F}),z===6&&D&&C.jsx("path",{d:V})]})}),C.jsx("div",{className:"rg-line-ctrl-dot start-dot",style:{"--rg-ctl-x":O.x+"px","--rg-ctl-y":O.y+"px"},onMouseDown:P=>L("start",P)}),C.jsx("div",{className:"rg-line-ctrl-dot end-dot",style:{"--rg-ctl-x":E.x+"px","--rg-ctl-y":E.y+"px"},onMouseDown:P=>L("end",P)}),z===6&&T&&C.jsx("div",{className:"rg-line-ctrl-dot ctrl-dot",style:{"--rg-ctl-x":T.x+"px","--rg-ctl-y":T.y+"px"},onMouseDown:P=>m(0,P)}),z===6&&D&&C.jsx("div",{className:"rg-line-ctrl-dot ctrl-dot",style:{"--rg-ctl-x":D.x+"px","--rg-ctl-y":D.y+"px"},onMouseDown:P=>m(1,P)}),(z===44||z===49)&&R.map(P=>!P.hide&&C.jsx("div",{className:`rg-line-ctrl-dot ctrl-split ${P.optionName.startsWith("cp-")?"":"ctrl-split-core"} ${P.direction==="v"?"ctrl-split-v":""} ${P.direction==="h"?"ctrl-split-h":""}`,style:{"--rg-ctl-x":P.x+"px","--rg-ctl-y":P.y+"px"},onMouseDown:$=>w(P,$)},P.optionName)),i&&c&&C.jsx("div",{className:["rg-line-ctrl-text",f&&"rg-line-ctrl-text-editing"].filter(Boolean).join(" "),style:{"--rg-ctl-x":l.text.x+"px","--rg-ctl-y":l.text.y+"px"},onClick:M,onMouseDown:b,children:f?C.jsx("input",{ref:y,className:"rg-line-text-input",value:u,onChange:P=>g(P.target.value),onBlur:N}):u?C.jsx("p",{children:u}):C.jsx("p",{className:"empty-text",children:"Add Text..."})})]})},Le=({mouseUpOnJunctionPointWithOffset:i,mouseUpOnJunctionPoint:a})=>C.jsxs("div",{className:"rg-connect-ctl",onMouseUp:t=>a("",t),onTouchEnd:t=>a("",t),children:[C.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-t","data-point":"top",onMouseUp:t=>a("top",t),onTouchEnd:t=>a("top",t)}),C.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-b","data-point":"bottom",onMouseUp:t=>a("bottom",t),onTouchEnd:t=>a("bottom",t)}),C.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-center","data-point":"border",onMouseUp:t=>a("border",t),onTouchEnd:t=>a("border",t)}),C.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-l","data-point":"left",onMouseUp:t=>a("left",t),onTouchEnd:t=>a("left",t)}),C.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-r","data-point":"right",onMouseUp:t=>a("right",t),onTouchEnd:t=>a("right",t)}),C.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-lr","data-point":"lr",onMouseUp:t=>a("lr",t),onTouchEnd:t=>a("lr",t)}),C.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-tb","data-point":"tb",onMouseUp:t=>a("tb",t),onTouchEnd:t=>a("tb",t)}),C.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-bottom-bar","data-point":"bottom","data-innode":"true",onMouseUp:t=>i("bottom",t),onTouchEnd:t=>onMouseUpWithOffset("bottom",t)}),C.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-top-bar","data-point":"top","data-innode":"true",onMouseUp:t=>i("top",t),onTouchEnd:t=>onMouseUpWithOffset("top",t)}),C.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-left-bar","data-point":"left","data-innode":"true",onMouseUp:t=>i("left",t),onTouchEnd:t=>onMouseUpWithOffset("left",t)}),C.jsx("div",{className:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-right-bar","data-point":"right","data-innode":"true",onMouseUp:t=>i("right",t),onTouchEnd:t=>onMouseUpWithOffset("right",t)})]}),Vn=({children:i})=>{const a=k.useContext(H);k.useContext(q);const t=k.useRef(),e=a&&a.options;if(!e.nodeConnectController.show)return C.jsx(C.Fragment,{});const n=(s,r)=>{a.onLineVertexBeDroppedOnConnectController(s,r,void 0,(l,c,h)=>{v("onLineVertexBeDropped:callback:",h)})},o=(s,r)=>{a.onLineVertexBeDroppedOnConnectController(s,r,t.current,(l,c,h)=>{v("onLineVertexBeDropped:callback:",h)})};return C.jsx("div",{className:"rg-editing-connect-ctrl",ref:t,style:{transform:`translate(${e.nodeConnectController.x}px, ${e.nodeConnectController.y}px)`,width:e.nodeConnectController.width+"px",height:e.nodeConnectController.height+"px"},children:i||C.jsx(Le,{mouseUpOnJunctionPoint:n,mouseUpOnJunctionPointWithOffset:o})})},zn=({fromNode:i,lineTemplate:a,onConnectStart:t,onConnectEnd:e,children:n,className:o,style:s})=>{const r=k.useContext(H),l=c=>{t&&t(i,a,c.nativeEvent),c.stopPropagation(),r.startCreateLineFromNode(i,a,c.nativeEvent,(h,d,f)=>{e&&e(h,d,f),r.defaultLineConnectEndHandler(h,d,f)})};return C.jsx("div",{className:`rg-connect-source-handle ${o||""}`,style:s,onMouseDown:c=>l(c),onClick:c=>{c.stopPropagation()},children:n})},Bn=({children:i,className:a,style:t,junctionPoint:e,targetId:n,targetType:o,targetData:s,lineTemplate:r,disableDrop:l,disableDrag:c,onLineVertexBeDropped:h,onDragConnectStart:d,onDragConnectEnd:f})=>{const p=k.useContext(H),u=k.useRef(),[g,x]=k.useState();k.useEffect(()=>{const m=p.registerConnectTarget(u.current,n,o||B.CanvasPoint,e,s);return x(m),()=>{p.unregisterConnectTarget(n)}},[]);const y=(m,w)=>{w.stopPropagation(),!l&&p.onLineVertexBeDropped(m,w.nativeEvent,void 0,(b,M,N)=>{h&&h(b,M,N)})},L=m=>{if(m.stopPropagation(),c||p.options.creatingLinePlot)return;const w=Object.assign({},r||{});w.from||(w.from=(g==null?void 0:g.targetId)||n,w.fromType=(g==null?void 0:g.targetType)||o),w.fromJunctionPoint||(w.fromJunctionPoint=(g==null?void 0:g.junctionPoint)||e),w.fromType||(w.fromType=B.Node),d&&d(w,m.nativeEvent),p.startCreateLineFromNode(null,w,m.nativeEvent,(b,M,N)=>{f&&f(b,M,N)})};return C.jsx("div",{ref:u,className:`rg-connect-ctl-handler rg-connect-target ${a||""}`,style:t,"data-point":e,"data-target-id":n,"data-target-type":o||B.CanvasPoint,"data-target-data":JSON.stringify(s),onMouseDown:m=>L(m),onMouseUp:m=>y(e,m),onClick:m=>{m.stopPropagation()},children:i})},Xn=({showText:i,adsorption:a})=>{const t=k.useContext(H),e=t&&t.options;return k.useEffect(()=>(e.editingReferenceLine.show=!0,e.showReferenceLine=!0,e.referenceLineAdsorption=a||!1,()=>{e.editingReferenceLine.show=!1}),[e]),C.jsxs("div",{className:"rg-editing-referline",style:{display:e.editingReferenceLine.show?"block":"none"},children:[e.editingReferenceLine.directionV&&C.jsx("div",{className:"rg-referline rg-referline-v",style:{transform:`translate(${e.editingReferenceLine.v_x}px, ${e.editingReferenceLine.v_y}px)`,height:e.editingReferenceLine.v_height+"px"},children:C.jsx("div",{className:"referline",children:i!==!1&&C.jsxs("div",{children:[Math.round(e.editingReferenceLine.v_height),"px"]})})}),e.editingReferenceLine.directionH&&C.jsx("div",{className:"rg-referline rg-referline-h",style:{transform:`translate(${e.editingReferenceLine.h_x}px, ${e.editingReferenceLine.h_y}px)`,width:e.editingReferenceLine.h_width+"px"},children:C.jsx("div",{className:"referline",children:i!==!1&&C.jsxs("div",{children:[Math.round(e.editingReferenceLine.h_width),"px"]})})})]})},Fn=i=>{const a=k.useContext(H),t=k.useRef(),e={backgroundColor:"transparent",textWrap:"unset",position:"relative",width:"100%",height:"fit-content"};return k.useEffect(()=>{v("[RGCanvas mounted]"),a.setCanvasDom(t.current)},[]),C.jsxs("div",{style:{"--bg-background-color":a.options.backgroundColor,"--rg-node-color":a.options.defaultNodeColor,"--rg-line-color":a.options.defaultLineColor},className:["rg-map",a.options.canvasOpacity===1?"rg-map-ready":""].join(" "),children:[C.jsx("div",{style:{...e,position:"relative",pointerEvents:"all",userSelect:"text"},className:"rg-map-canvas rg-canvas-behind",children:C.jsx("div",{className:"rg-canvas-slot rg-canvas-slot-behind",children:i.canvasPlugBehindSlot})}),C.jsx("div",{ref:t,style:{...e,pointerEvents:"none",userSelect:"none",left:"0px",top:"0px",zIndex:9},className:"rg-map-canvas",children:C.jsx(ae,{svgDefs:i.svgDefs,lineSlot:i.lineSlot})})]})},Qt=i=>{const a=k.useContext(H);k.useContext(q);const t=k.useRef(),[e,n]=k.useState(!1);k.useEffect(()=>{te("React-Linker-Board"),a.setOptions(i.options||{});const u=ce(i);return v("[RelationGraph]mounted:listeners:",u),a.setListeners(u),v("[RelationGraph]setDom:",t.current),a.setDom(t.current),n(!0),a.ready(),a.dataUpdated(),i.links&&(v("[RelationGraph] apply data"),(async()=>await a.setJsonData({fakeLines:i.links}))()),()=>{a.beforeUnmount()}},[]);const o=a&&a.options;let s;const r=[],l=[],c=[],h=lt.default.Children.toArray(i.children).filter(u=>{if(u&<.default.isValidElement(u))if(u.type===It){const g=u.props.children;if(typeof g=="function")s=g;else throw new Error('RGSlotOnLine children must be a function, e.g. <RGSlotOnLine>{ (line: RGLine) => <g><path d="..." /><text>{line.text}</text></g> }</RGSlotOnLine>')}else{if(u.type===Mt)return r.push(u.props.children),!1;if(u.type===At)return l.push(u.props.children),!1;if(u.type===Vt)return!1;if(u.type===he)return c.push(u.props.children),!1}return!0}),d=r,f=l.concat(...h);if(s&&i.lineSlot)throw new Error("You can only provide lineSlot or RGSlotOnLine, but not both.");const p=s||i.lineSlot;return C.jsx("div",{ref:t,id:`relation-graph-ins-${o==null?void 0:o.instanceId}`,className:["relation-graph",(o==null?void 0:o.creatingLinePlot)&&"rg-creating-line"].filter(Boolean).join(" "),tabIndex:1,style:{width:"100%",height:"fit-content",opacity:e?1:0,"--rg-checked-line-bg-color":o==null?void 0:o.checkedItemBackgroundColor},children:e&&o&&C.jsxs(C.Fragment,{children:[C.jsx(Fn,{lineSlot:p,svgDefs:c,canvasPlugBehindSlot:f}),C.jsx(re,{}),C.jsx("div",{className:"rg-graph-plugs",children:C.jsx("div",{className:"rg-graph-slot",children:d})})]})})},Hn=(i,a)=>{const t=k.useContext(H),e=k.useRef(i.relationGraphInstance);k.useImperativeHandle(a,()=>({getInstance(){return t||e.current}}),[]),k.useEffect(()=>{},[]);const n=o=>{console.error("onProviderReady::Index",o),e.current=o,e.current._rgAsConnectArea=!0};return t&&!t._rgAsConnectArea&&(t._rgAsConnectArea=!0),t?C.jsx(Qt,{...i,children:i.children}):C.jsx(Gt,{relationGraphCore:i.relationGraphCore,onProviderReady:n,children:C.jsx(Qt,{...i,children:i.children})})},$n=lt.default.forwardRef(Hn),Gn={BaseLayouter:pt,BidirectionalTreeLayouter:fe,CenterLayouter:ue,CircleLayouter:ge,FixedLayouter:pe,ForceLayouter:ut,RGFolderLayouter:ye},jn={RGOptionsDataUtils:qe,RGLineDataUtils:je,RGNodeDataUtils:He,RGGraphMath:Z,RGNodesAnalyticUtils:A,RGEffectUtils:W};function Yn(){return k.useContext(H)}function Wn(){return k.useContext(q)}function Un(i){if(!i||!i.options.creatingLinePlot)return{creating:!1};const{line:a,from:t,to:e}=i.generateCreatingLineConfig();return{creating:!0,fromTarget:t,toTarget:e,lineJson:a}}function Zn(i){return!i||!i.options.creatingNodePlot?{creating:!1}:{creating:!0,nodeJson:i.options.newNodeTemplate}}const Jn={useGraphInstance:Yn,useAutoUpdateView:Wn,useCreatingLine:Un,useCreatingNode:Zn},qn=Kt,Qn=Ce,Kn=Gn,to=jn,eo=Nn,no=ie,oo=oe,io=Mn,so=ee,ao=le,ro=kn,lo=Pn,co=Rn,ho=En,fo=Dn,uo=In,go=An,po=Vn,yo=zn,mo=Bn,xo=Le,vo=Xn,Co=Mt,_o=Mt,Lo=Vt,wo=At,we=Tn,bo=It,Oo=$n,So=Gt,Mo=_e;exports.RGBackground=lo;exports.RGConnectSource=yo;exports.RGConnectTarget=mo;exports.RGDirection=de;exports.RGEditingConnectController=po;exports.RGEditingConnectPoints=xo;exports.RGEditingLineController=go;exports.RGEditingNearNodeWidget=uo;exports.RGEditingNodeController=ho;exports.RGEditingReferenceLine=vo;exports.RGEditingResize=fo;exports.RGEventNames=I;exports.RGFakeNode=eo;exports.RGHooks=Jn;exports.RGInnerConnectTargetType=B;exports.RGInstanceContext=H;exports.RGJunctionPoint=U;exports.RGLayout=Kn;exports.RGLinePath=no;exports.RGLineShape=G;exports.RGLineText=oo;exports.RGMiniToolBar=ao;exports.RGMiniView=ro;exports.RGNodeExpandHolder=so;exports.RGNodeShape=zt;exports.RGProvider=So;exports.RGSlotOnCanvas=wo;exports.RGSlotOnCanvasAbove=Lo;exports.RGSlotOnGraph=Co;exports.RGSlotOnLine=bo;exports.RGSlotOnNode=we;exports.RGSlotOnView=_o;exports.RGToolBar=io;exports.RGUpdateContext=gt;exports.RGUpdateSignalContext=q;exports.RGUpdateSingalContext=q;exports.RGUtils=to;exports.RGWatermark=co;exports.RelationGraph=Mo;exports.RelationGraphCore=Qn;exports.RelationGraphStoreContext=H;exports.RelationLinker=Oo;exports.default=_e;exports.version=qn;
|