@relation-graph/vue3 3.0.4
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 +284 -0
- package/relation-graph.mjs +9626 -0
- package/relation-graph.umd.js +284 -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 +224 -0
- package/types/packages/platforms/react/src/relation-graph/RGProvider.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/RelationGraph.d.ts +9 -0
- package/types/packages/platforms/react/src/relation-graph/RelationLinker.d.ts +4 -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 +18 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4CreatingLine.d.ts +10 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4FakeLines.d.ts +11 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4Lines.d.ts +12 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGCanvasContent4Nodes.d.ts +13 -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 +5 -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 +7 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLinePeel.d.ts +6 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RGLineText.d.ts +6 -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 +13 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationGraphUI.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationGraphView.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerCanvas.d.ts +7 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerUI.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/RelationLinkerView.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/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/RGSlotOnView.d.ts +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/store/index.d.ts +4 -0
- package/types/packages/platforms/react/src/relation-graph/src/core4react/store/reducers/RGStore.d.ts +10 -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/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/RGDebugView.d.ts +3 -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/RGDataProvider.d.ts +17 -0
- package/types/packages/platforms/react/src/relation-graph/src/hooks/RGHooks.d.ts +30 -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 +3 -0
- package/types/packages/platforms/react/src/relation-graph/src/hooks/useGraphStore.d.ts +13 -0
- package/types/packages/platforms/react/src/relation-graph/src/hooks/useRelationGraph.d.ts +11 -0
- package/types/packages/platforms/react/src/relation-graph/src/hooks/useRelationLinker.d.ts +17 -0
- package/types/packages/platforms/react/src/types-react.d.ts +35 -0
- package/types/packages/platforms/svelte/src/RGProvider.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/context.d.ts +4 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGCanvas.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4CreatingLine.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4FakeLines.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4Lines.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGCanvasContent4Nodes.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGEasyView.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGFakeNode.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGGraphDefs.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGLineContent.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGLinePath.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGLinePeel.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGLineText.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGNodeExpandHolder.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGNodePeel.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RGProvider4Instance.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RelationGraph.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RelationGraphUI.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RelationGraphWithProvider.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RelationLinker.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RelationLinkerCanvas.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/RelationLinkerUI.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGConnectSource.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGConnectTarget.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGConnectTargetUI.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingConnectController.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingConnectPoints.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingLineController.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingLineControllerUI.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingNearNodeWidget.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingNodeController.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingNodeControllerUI.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingReferenceLine.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingResize.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGEditingResizeUI.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGMiniView.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/editing/RGMiniViewContent.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGConnectTarget.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingConnectController.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingLineController.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingNearNodeWidget.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingNodeController.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingReferenceLine.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGEditingResize.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RGMiniView.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/RelationGraphWithProvider.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/web-components/WebComponentUtils.d.ts +11 -0
- package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphBackground.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphLoading.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphMoveOperator.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphOperateStuff.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphWatermark.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/widgets/GraphXsToolBar.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/core4svelte/widgets/RGIcons.svelte.d.ts +1 -0
- package/types/packages/platforms/svelte/src/hooks/RGHooks.d.ts +27 -0
- package/types/packages/platforms/svelte/src/hooks/useGraphInstance.d.ts +2 -0
- package/types/packages/platforms/svelte/src/hooks/useGraphStore.d.ts +14 -0
- package/types/packages/platforms/svelte/src/hooks/useRGDataProvider.d.ts +19 -0
- package/types/packages/platforms/svelte/src/hooks/useRelationGraph.d.ts +48 -0
- package/types/packages/platforms/svelte/src/index.d.ts +194 -0
- package/types/packages/platforms/svelte/src/types-svelte.d.ts +85 -0
- package/types/packages/platforms/vue2/src/core4vue/RGCanvas.vue.d.ts +9 -0
- package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent.vue.d.ts +10 -0
- package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4CreatingLine.vue.d.ts +9 -0
- package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4FakeLines.vue.d.ts +9 -0
- package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4Lines.vue.d.ts +9 -0
- package/types/packages/platforms/vue2/src/core4vue/RGCanvasContent4Nodes.vue.d.ts +9 -0
- package/types/packages/platforms/vue2/src/core4vue/RGEasyView.vue.d.ts +7 -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 +19 -0
- package/types/packages/platforms/vue2/src/core4vue/RGLineContent.vue.d.ts +23 -0
- package/types/packages/platforms/vue2/src/core4vue/RGLinePath.vue.d.ts +14 -0
- package/types/packages/platforms/vue2/src/core4vue/RGLinePeel.vue.d.ts +9 -0
- package/types/packages/platforms/vue2/src/core4vue/RGNodeExpandHolder.vue.d.ts +30 -0
- package/types/packages/platforms/vue2/src/core4vue/RGNodePeel.vue.d.ts +17 -0
- package/types/packages/platforms/vue2/src/core4vue/RGProvider.vue.d.ts +50 -0
- package/types/packages/platforms/vue2/src/core4vue/RelationGraph.vue.d.ts +52 -0
- package/types/packages/platforms/vue2/src/core4vue/RelationGraphUI.vue.d.ts +46 -0
- package/types/packages/platforms/vue2/src/core4vue/RelationLinker.vue.d.ts +46 -0
- package/types/packages/platforms/vue2/src/core4vue/RelationLinkerCanvas.vue.d.ts +12 -0
- package/types/packages/platforms/vue2/src/core4vue/RelationLinkerUI.vue.d.ts +23 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGConnectSource.vue.d.ts +31 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGConnectTarget.vue.d.ts +85 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingConnectController.vue.d.ts +9 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingConnectPoints.vue.d.ts +25 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingLineController.vue.d.ts +43 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingNearNodeWidget.vue.d.ts +21 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingNodeController.vue.d.ts +5 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingReferenceLine.vue.d.ts +30 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGEditingResize.vue.d.ts +32 -0
- package/types/packages/platforms/vue2/src/core4vue/editing/RGMiniView.vue.d.ts +40 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphBackground.vue.d.ts +33 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphLoading.vue.d.ts +5 -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 +5 -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 +58 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/GraphXsToolBar.vue.d.ts +46 -0
- package/types/packages/platforms/vue2/src/core4vue/widgets/RGDebugView.vue.d.ts +12 -0
- package/types/packages/platforms/vue2/src/hooks/GraphStoreMixin.d.ts +40 -0
- package/types/packages/platforms/vue2/src/index.d.ts +944 -0
- package/types/packages/platforms/vue2/src/types-vue2.d.ts +3 -0
- package/types/packages/platforms/vue2/vite.config.d.ts +2 -0
- package/types/packages/platforms/vue3/src/constants.d.ts +3 -0
- package/types/packages/platforms/vue3/src/index.d.ts +188 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/RGHooks.d.ts +32 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useGraphData.d.ts +2 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useGraphInstance.d.ts +2 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useGraphStore.d.ts +16 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useRGDataProvider.d.ts +17 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useRelationGraph.d.ts +131 -0
- package/types/packages/platforms/vue3/src/relation-graph/src/hooks/useRelationLinker.d.ts +39 -0
- package/types/packages/platforms/vue3/src/types-vue3.d.ts +122 -0
- package/types/packages/platforms/vue3/src/types.d.ts +3 -0
- package/types/packages/platforms/vue3/vite.config.d.ts +2 -0
- package/types/packages/relation-graph-models/RGObjectsForExport.d.ts +140 -0
- package/types/packages/relation-graph-models/constants.d.ts +1 -0
- package/types/packages/relation-graph-models/data/RGDataDefine.d.ts +23 -0
- package/types/packages/relation-graph-models/data/RGDataGetter.d.ts +36 -0
- package/types/packages/relation-graph-models/data/RGDataProvider.d.ts +66 -0
- package/types/packages/relation-graph-models/data/RGDataProvider4React.d.ts +9 -0
- package/types/packages/relation-graph-models/data/RGDataProvider4Svelte.d.ts +10 -0
- package/types/packages/relation-graph-models/data/RGDataProvider4Vue2.d.ts +9 -0
- package/types/packages/relation-graph-models/data/RGDataProvider4Vue3.d.ts +10 -0
- package/types/packages/relation-graph-models/data/RGDataProvider4Vue3V1.d.ts +10 -0
- package/types/packages/relation-graph-models/data/RGLineDataUtils.d.ts +9 -0
- package/types/packages/relation-graph-models/data/RGNodeDataUtils.d.ts +17 -0
- package/types/packages/relation-graph-models/data/RGOptionsDataUtils.d.ts +7 -0
- package/types/packages/relation-graph-models/data/utils/EdgeCounter.d.ts +8 -0
- package/types/packages/relation-graph-models/layouts/RGBaseLayout.d.ts +37 -0
- package/types/packages/relation-graph-models/layouts/RGCenterLayout.d.ts +9 -0
- package/types/packages/relation-graph-models/layouts/RGCircleLayout.d.ts +7 -0
- package/types/packages/relation-graph-models/layouts/RGFixedLayout.d.ts +10 -0
- package/types/packages/relation-graph-models/layouts/RGFolderLayout.d.ts +15 -0
- package/types/packages/relation-graph-models/layouts/RGForceLayout.d.ts +82 -0
- package/types/packages/relation-graph-models/layouts/RGIOTreeLayout.d.ts +18 -0
- package/types/packages/relation-graph-models/layouts/RGSmartTreeLayout.d.ts +14 -0
- package/types/packages/relation-graph-models/layouts/RGTreeLayout.d.ts +17 -0
- package/types/packages/relation-graph-models/layouts/analyzers/BasicNetworkAnalyzer.d.ts +28 -0
- package/types/packages/relation-graph-models/layouts/analyzers/RGNetworkAnalyzer.d.ts +27 -0
- package/types/packages/relation-graph-models/layouts/tmp/old.d.ts +1 -0
- package/types/packages/relation-graph-models/models/RelationGraphBase.d.ts +80 -0
- package/types/packages/relation-graph-models/models/RelationGraphCore.d.ts +46 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith1View.d.ts +96 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith2Data.d.ts +53 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith2Data1Getter.d.ts +85 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith2Data2Analysis.d.ts +177 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith2Data3Update.d.ts +259 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith2Data4ConnectTarget.d.ts +85 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith2Data5LineConfig.d.ts +35 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith3Options1Update.d.ts +75 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith3Options2API.d.ts +39 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith4Line.d.ts +112 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith5Zoom.d.ts +29 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith6Effect.d.ts +72 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith6Layout.d.ts +85 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith7Event.d.ts +270 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith91Editing.d.ts +210 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith92MiniView.d.ts +107 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith93Image.d.ts +38 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith93Image_codes.d.ts +36 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith95Dom.d.ts +112 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith99API.d.ts +125 -0
- package/types/packages/relation-graph-models/models/RelationGraphWith9EasyView.d.ts +74 -0
- package/types/packages/relation-graph-models/utils/RGCanvasImpl2D.d.ts +58 -0
- package/types/packages/relation-graph-models/utils/RGCanvasImplWebGL.d.ts +47 -0
- package/types/packages/relation-graph-models/utils/RGCommon.d.ts +31 -0
- package/types/packages/relation-graph-models/utils/RGDragUtils.d.ts +20 -0
- package/types/packages/relation-graph-models/utils/RGFullscreenUtils.d.ts +3 -0
- package/types/packages/relation-graph-models/utils/RGGraphMath.d.ts +131 -0
- package/types/packages/relation-graph-models/utils/RGIconsData.d.ts +41 -0
- package/types/packages/relation-graph-models/utils/RGIntergration.d.ts +45 -0
- package/types/packages/relation-graph-models/utils/RGNodesAnalytic.d.ts +29 -0
- package/types/packages/relation-graph-models/utils/RGTips.d.ts +7 -0
- package/types/packages/relation-graph-models/utils/line/RGLinePath.d.ts +105 -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/RGPathGeneratorFor8.d.ts +2 -0
- package/types/packages/relation-graph-models/utils/line/RGPathGeneratorForCurve.d.ts +2 -0
- package/types/packages/types.d.ts +1467 -0
- package/types/packages/types.ts +1480 -0
|
@@ -0,0 +1,284 @@
|
|
|
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:400px;min-height:300px;--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-opacity: 1;--rg-node-font-size: 1rem;--rg-node-font-color: #000000;--rg-node-color: #eeeeee;--rg-node-border-color: #333333;--rg-node-border-width: 1px;--rg-node-border-radius: 3px;--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: 1px;--rg-line-fontcolor: var(--rg-line-color, #666666);--rg-line-fontsize: 12px;--rg-line-opacity: 1;--rg-checked-item-bg-color: rgba(150, 150, 150, .2);--rg-checked-line-text-bg-color: rgb(234, 232, 232)}.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-view-slot{position:relative;width:100%;height:100%}.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-wrapper{position:absolute;width:100%;top:0px;left:0px;z-index:50}.relation-graph .rg-nodes-container{position:relative;overflow:visible}.relation-graph .rg-map{background-color:var(--rg-background-color);overflow:hidden;cursor:default;user-select:none;opacity:.01;transition:none;width:100%;height:100%;position:relative}.relation-graph .rg-map-background{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none}.relation-graph.rg-move-mode .rg-map{cursor:grab}.relation-graph .rg-map-ready{opacity:1;transition:opacity .5s ease;will-change:opacity}.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:0;left:0;border:none;z-index:3;overflow:visible;white-space:nowrap;transform-origin:0 0;will-change:transform}.relation-graph .rg-map-canvas .rg-events-all{pointer-events:all}.relation-graph.rg-enable-node-xy-animation .rg-node-peel{transition:transform .15s ease}.relation-graph.rg-enable-node-xy-animation .rg-line-peel{transition:none}.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;overflow:visible}.relation-graph .rg-map 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}.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;white-space:nowrap}.relation-graph .rg-linetext-container .rg-line-peel .rg-line-label-on-path{background-color:#fff}.relation-graph .rg-linetext-container .rg-line-checked .rg-line-label{background-color:var(--rg-checked-line-text-bg-color);color:#0f172a}.relation-graph .rg-linetext-container .rg-line-checked .rg-line-label-on-path{background-color:var(--rg-line-color, #ffffff)}.relation-graph .rg-line-peel{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:.7;stroke:var(--rg-checked-item-bg-color)}.relation-graph .rg-line-checked .rg-line-bg{stroke:var(--rg-checked-item-bg-color);opacity:1}.relation-graph .rg-line-checked .rg-line{z-index:100}.relation-graph .rg-line-checked .rg-line-text{stroke:var(--rg-checked-item-bg-color);stroke-width:2}.relation-graph .rg-line-disable-events{pointer-events:none!important}.relation-graph .rg-line-disable-events .rg-line-bg,.relation-graph .rg-line-disable-events .rg-line-text,.relation-graph .rg-linetext-container .rg-line-disable-events .rg-line-bg,.relation-graph .rg-linetext-container .rg-line-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:none;box-sizing:border-box;opacity:var(--rg-node-opacity);z-index:var(--rg-node-z-index);will-change:transform;transform-origin:0 0;cursor:default}.relation-graph .rg-node-peel .rg-node{pointer-events:all;text-align:center;border-style:solid;box-sizing:border-box;overflow:visible;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-disable-events{pointer-events:none}.relation-graph .rg-node-shape-0>.rg-node{border-radius:50%}.relation-graph .rg-node-shape-1>.rg-node{border-radius:var(--rg-node-border-radius)}.relation-graph .rg-node-checked{z-index:800}.relation-graph .rg-node-checked>.rg-node{box-shadow:0 0 0 4px var(--rg-checked-item-bg-color)}.relation-graph .rg-node-selected>.rg-node{box-shadow:0 0 0 2px var(--editor-main-color)}.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-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;--rg-refer-offset: -3px}.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%}.relation-graph .rg-editing-referline .rg-referline-v .referline{width:1px;height:100%;background-color:var(--editor-main-color)}.relation-graph .rg-editing-referline .rg-referline-v:before{content:\"\";position:absolute;width:5px;height:5px;background-color:var(--editor-main-color);border-radius:50%;top:0;transform:translateY(-50%)}.relation-graph .rg-editing-referline .rg-referline-v:after{content:\"\";position:absolute;width:5px;height:5px;background-color:var(--editor-main-color);border-radius:50%;bottom:0;transform:translateY(50%)}.relation-graph .rg-editing-referline .rg-referline-h{left:0px;width:100%;height:6px}.relation-graph .rg-editing-referline .rg-referline-h .referline{width:100%;height:1px;background-color:var(--editor-main-color)}.relation-graph .rg-editing-referline .rg-referline-h:before{content:\"\";position:absolute;width:5px;height:5px;background-color:var(--editor-main-color);border-radius:50%;left:0;transform:translate(-50%)}.relation-graph .rg-editing-referline .rg-referline-h:after{content:\"\";position:absolute;width:5px;height:5px;background-color:var(--editor-main-color);border-radius:50%;right:0;transform:translate(50%)}.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: .8rem;pointer-events:auto;background-color:#fff;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(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}.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:50%;transform:translate(-50%)}.relation-graph .rg-resize-ctl .rg-resize-ctl-b{cursor:s-resize;bottom:var(--resize-handler-offset);left:50%;transform:translate(-50%)}.relation-graph .rg-resize-ctl .rg-resize-ctl-l{cursor:w-resize;left:var(--resize-handler-offset);top:50%;transform:translateY(-50%)}.relation-graph .rg-resize-ctl .rg-resize-ctl-r{cursor:e-resize;right:var(--resize-handler-offset);top:50%;transform:translateY(-50%)}.relation-graph .rg-editing-connect-ctrl{position:absolute;user-select:none;pointer-events:none;left:0;top:0;z-index:1400;--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);--hander-shadow-color: rgba(57, 144, 216, .1);box-shadow:0 0 0 var(--border-handler-width) var(--hander-shadow-color)}.relation-graph .rg-connect-ctl{width:100%;height:100%;pointer-events:none;user-select:none;border:none;position:relative}.relation-graph .rg-connect-ctl-handler{pointer-events:auto;user-select:none;z-index:20;cursor:crosshair}.relation-graph .rg-connect-target{pointer-events:auto}.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:100%;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{opacity:1}.relation-graph .rg-connect-ctl-top-bar{border:0px;border:none;width:100%;height:var(--border-handler-width);right:0px;top:calc(var(--border-handler-width) * -1);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{opacity:1}.relation-graph .rg-connect-ctl-left-bar{border:0px;border:none;width:var(--border-handler-width);height:100%;left:calc(var(--border-handler-width) * -1);top:0;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{opacity:1}.relation-graph .rg-connect-ctl-right-bar{border:0px;width:var(--border-handler-width);height:100%;right:calc(var(--border-handler-width) * -1);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{opacity: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: 120px;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:relative;width:100%;height:100%;display:flex;place-items:center;justify-content:center}.relation-graph .rg-miniview canvas{opacity:1}.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;left:0;top:0;cursor:move;transform-origin:0 0;box-shadow:0 0 0 9999px #0003;border:#888 solid 1px;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}.relation-graph .rg-node-expand-holder .rg-node-expand-button{width:16px;height:16px;border-radius:15px;cursor:pointer;pointer-events:all;border:#666 solid 1px;background-color:#fff;display:flex;align-items:center;justify-content:center}.relation-graph .rg-node-expand-holder .rg-icon{width:14px;height:14px}.relation-graph .c-expand-positon-hide{display:none}.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;left:10px;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 *{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:#ffffffe6}.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;padding:2px 15px;text-align:center;left:50%;top:50%;transform:translate(-50%,-50%);border-radius:5px;font-size:12px;background-color:#fff;border:#666 solid 1px;color:#666;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}.rg-background{position:absolute;left:0px;top:0px;width:100%;height:100%;z-index:0;pointer-events:none}.rg-toolbar{user-select:none;pointer-events:all;display:flex;position:absolute;z-index:300;background-color:#fff;color:#333;--rg-toolbar-hover-bg-color: rgba(220, 220, 220, .5);box-shadow:0 1px 3px #0003,0 0 1px #0006;box-sizing:border-box;border-radius:5px;width:fit-content;height:fit-content;place-items:center;justify-content:center;gap:3px;backdrop-filter:blur(5px)}.rg-toolbar .rg-icon{flex-grow:1;width:16px;height:16px;fill:currentColor;overflow:hidden}.rg-toolbar .rg-mb-button svg{margin:auto}.rg-toolbar .rg-mb-button:hover{background-color:var(--rg-toolbar-hover-bg-color)}.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)}}.rg-toolbar .rg-current-zoom{margin-top:0;font-size:10px;text-align:center;border-radius:3px;cursor:pointer}.rg-toolbar .rg-current-zoom:hover{background-color:var(--rg-toolbar-hover-bg-color)}.rg-toolbar .rg-mb-button{width:35px;height:35px;margin-top:0;opacity:1;cursor:pointer;font-size:18px;box-sizing:border-box;display:flex;align-items:center;justify-items:center;border-radius:3px}.rg-toolbar.rg-toolbar-v{flex-flow:column;padding:10px 3px}.rg-toolbar.rg-toolbar-v .rg-current-zoom{width:35px;height:25px;line-height:25px}.rg-toolbar.rg-toolbar-h{padding:3px 10px}.rg-toolbar.rg-toolbar-h .rg-current-zoom{width:fit-content;padding:0 5px;height:35px;line-height:35px}.rg-toolbar.rg-toolbar-h-right{right:15px}.rg-toolbar.rg-toolbar-h-left{left:15px}.rg-toolbar.rg-toolbar-h-center{left:50%;transform:translate(-50%)}.rg-toolbar.rg-toolbar-v-top{top:15px}.rg-toolbar.rg-toolbar-v-bottom{bottom:15px}.rg-toolbar.rg-toolbar-v-center{top:50%;transform:translateY(-50%)}.rg-toolbar.rg-xs-toolbar .rg-mb-button{width:25px;height:25px}.rg-toolbar.rg-xs-toolbar .rg-icon{width:14px;height:14px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-v{padding:3px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-v .rg-current-zoom{width:30px;height:25px;line-height:25px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-h{padding:3px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-h .rg-current-zoom{width:35px;height:25px;line-height:25px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-h .rg-mb-button{width:25px;height:25px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-h-right{right:10px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-h-left{left:10px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-h-center{left:50%;transform:translate(-50%)}.rg-toolbar.rg-xs-toolbar.rg-toolbar-v-top{top:10px}.rg-toolbar.rg-xs-toolbar.rg-toolbar-v-bottom{bottom:10px}.rg-toolbar.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 kt=Object.defineProperty;var Ot=(l,i,e)=>i in l?kt(l,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[i]=e;var _=(l,i,e)=>(Ot(l,typeof i!="symbol"?i+"":i,e),e);/*!
|
|
2
|
+
* relation-graph v3.0.4
|
|
3
|
+
* (c) 2026 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 r=require("vue"),Ze="3.0.4",Pt=Symbol("INSTALLED_KEY"),ve="RelationGraphProvideKey",ae=l=>{try{if("touches"in l&&l.touches||"targetTouches"in l&&l.targetTouches)return!0}catch{}return!1},me=l=>{if(ae(l)){const i=l.touches||l.targetTouches;if(!i)throw new Error("error targetTouches");return{clientX:i[0].clientX,clientY:i[0].clientY}}else return{clientX:l.clientX,clientY:l.clientY}},C=(...l)=>{typeof window<"u"&&window.relationGraphDebug&&console.log("[relation-graph:debug]",...l)},xe=(l,i,e)=>{if(!l)return null;if(l.classList){if(l.classList.contains(i))return l;if(l.classList.contains(e))return null}let t=null;if(l.assignedSlot?t=l.assignedSlot:t=l.parentElement,!t){const n=l.parentNode;n instanceof ShadowRoot&&(t=n.host)}return xe(t,i,e)},De=l=>new Promise(i=>setTimeout(i,l)),Tt=()=>{const l="l",i="o",e="g",t=new Date().getFullYear(),n=[];return t>1&&n.push(l),t>201&&n.push(i),t>1113&&n.push(e),n.join("")},Rt=()=>{const l="c",i="o",e="n",t="s",n="o",o="l",s="e",a=new Date().getFullYear(),d=[];return a>1&&d.push(l),a>21&&d.push(i),a>35&&d.push(e),a>55&&d.push(t),a>189&&d.push(n),a>231&&d.push(o),a>1234&&d.push(s),d.join("")},Ye=l=>l.replace(/-/g,"").replace(/\*/g,"-"),Ke=l=>{const i=Rt(),e=Tt(),t="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[i]&&window[i][e](`%c ${Ye(t)} %c Version v${Ze}(${l}) %c More info: ${Ye(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")},St=(l,i)=>{typeof i=="string"&&(i=[i]);for(const t of i)if(l.classList.contains(t))return!0;let e=l.parentElement;for(;e;){for(const t of i)if(e.classList.contains(t))return!0;e=e.parentElement}return!1},Ce=l=>{const i=l.target;return St(i,"rel-text-editing")?!0:["input","textarea"].includes(document.activeElement.tagName.toLowerCase())},ze=(l=5)=>{const i="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";let e="";const t=l>30?30:l;for(let n=0;n<t;n++)e+=i[Math.floor(Math.random()*i.length)];return e},Mt={"icon-quanping":{data:`
|
|
7
|
+
<path d="M921.6 358.4h-76.8V179.2h-179.2V102.4h256v256zM102.4 358.4h76.8V179.2h179.2V102.4H102.4v256z m0 307.2h76.8v179.2h179.2v76.8H102.4V665.6z m819.2 0h-76.8v179.2h-179.2v76.8h256V665.6z"></path>`},"icon-fangda":{data:`
|
|
8
|
+
<path d="M853.333333 480H544V170.666667c0-17.066667-14.933333-32-32-32s-32 14.933333-32 32v309.333333H170.666667c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h309.333333V853.333333c0 17.066667 14.933333 32 32 32s32-14.933333 32-32V544H853.333333c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32z"></path>
|
|
9
|
+
`},"icon-suoxiao":{data:`
|
|
10
|
+
<path d="M853.333333 544H170.666667c-17.066667 0-32-14.933333-32-32s14.933333-32 32-32h682.666666c17.066667 0 32 14.933333 32 32s-14.933333 32-32 32z"></path> `},"icon-zidong":{data:`
|
|
11
|
+
<path d="M633.6 467.2 512 467.2l64-352c0-12.8-12.8-12.8-19.2-6.4L211.2 537.6c-6.4 6.4 0 19.2 6.4 19.2l121.6 0-64 352c0 12.8 12.8 12.8 19.2 6.4L640 486.4C646.4 480 646.4 467.2 633.6 467.2z"></path>
|
|
12
|
+
<path d="M793.6 902.4l-38.4 0L736 832 627.2 832l-25.6 70.4L569.6 902.4l89.6-249.6L704 652.8 793.6 902.4zM723.2 806.4l-44.8-121.6-44.8 121.6L723.2 806.4z"></path>
|
|
13
|
+
`},"icon-yuanquanfenxiang":{data:`
|
|
14
|
+
<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>
|
|
15
|
+
|
|
16
|
+
`},"icon-hj2":{data:`
|
|
17
|
+
<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>
|
|
18
|
+
|
|
19
|
+
`},"icon-lianjie_connecting5":{data:`
|
|
20
|
+
<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"></path>
|
|
21
|
+
`},"icon-ico_reset":{data:`
|
|
22
|
+
<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>
|
|
23
|
+
<path d="M978.64255033 61.01268534L725.33213333 371.09074734h297.59814z"></path>
|
|
24
|
+
`},"icon-lianjieliu":{data:`
|
|
25
|
+
<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>
|
|
26
|
+
<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>
|
|
27
|
+
|
|
28
|
+
`},"icon-resize-":{data:`
|
|
29
|
+
<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>
|
|
30
|
+
|
|
31
|
+
`},"icon-tupian":{data:`
|
|
32
|
+
<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>
|
|
33
|
+
|
|
34
|
+
`},"icon-ziyuan":{data:`
|
|
35
|
+
<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>
|
|
36
|
+
<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>
|
|
37
|
+
<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>
|
|
38
|
+
|
|
39
|
+
`},"icon-lianjiezhong":{data:`
|
|
40
|
+
<path d="M512 907c-24.852 0-45-20.148-45-45s20.148-45 45-45c168.446 0 305-136.554 305-305S680.446 207 512 207 207 343.554 207 512c0 24.852-20.148 45-45 45S117 536.852 117 512c0-218.152 176.848-395 395-395S907 293.848 907 512 730.152 907 512 907z"></path>
|
|
41
|
+
|
|
42
|
+
`}},It=["innerHTML"],q=r.defineComponent({__name:"RGIcons",props:{iconName:{},className:{}},setup(l){const i=l,e=r.computed(()=>Mt[i.iconName]);return(t,n)=>(r.openBlock(),r.createElementBlock("svg",{class:r.normalizeClass(["rg-icon",t.className]),viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",innerHTML:e.value.data},null,10,It))}}),Qe=r.defineComponent({__name:"RGNodeExpandHolder",props:{node:{},expandOrCollapseNode:{type:Function},expandHolderPosition:{}},setup(l){const i=l,e=r.computed(()=>i.node.expanded===!1?"c-expanded":"c-collapsed");return(t,n)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["rg-node-expand-holder","c-expand-positon-"+t.expandHolderPosition])},[r.createElementVNode("div",{class:r.normalizeClass(["rg-node-expand-button",e.value]),onClick:n[0]||(n[0]=r.withModifiers((...o)=>t.expandOrCollapseNode&&t.expandOrCollapseNode(...o),["stop"])),onTouchend:n[1]||(n[1]=r.withModifiers((...o)=>t.expandOrCollapseNode&&t.expandOrCollapseNode(...o),["stop"]))},[t.node.expanded===!1?(r.openBlock(),r.createBlock(q,{key:0,iconName:"icon-fangda"})):(r.openBlock(),r.createBlock(q,{key:1,iconName:"icon-suoxiao"}))],34)],2))}});function X(){const l=r.inject(ve,null);if(!l)throw new Error("RGHooks.useGraphInstance must be used inside RGProvider or RelationGraph tag.");return l==null?void 0:l.graphInstance}const Et=["data-id"],Dt={class:"rg-node-text"},et=r.defineComponent({__name:"RGNodePeel",props:{nodeProps:{},defaultExpandHolderPosition:{},dragging:{type:Boolean},checked:{type:Boolean}},setup(l){const i=X(),e=l,t=r.ref(),n=r.computed(()=>e.nodeProps.borderColor),o=r.computed(()=>e.nodeProps.borderWidth===void 0?void 0:e.nodeProps.borderWidth+"px"),s=r.computed(()=>e.nodeProps.width?e.nodeProps.width+"px":void 0),a=r.computed(()=>e.nodeProps.height?e.nodeProps.height+"px":void 0),d=r.computed(()=>e.nodeProps.expandHolderPosition?e.nodeProps.expandHolderPosition!=="hide":e.defaultExpandHolderPosition&&e.defaultExpandHolderPosition!=="hide"&&e.nodeProps.rgChildrenSize>0),h=r.computed(()=>e.nodeProps.rgCalcedVisibility),c=p=>{i.expandOrCollapseNode(e.nodeProps,p)},u=p=>{i.onNodeDragStart(e.nodeProps,p)};return r.onMounted(()=>{i.addNodeResizeListener(t.value,e.nodeProps)}),r.onBeforeUnmount(()=>{i.removeNodeResizeListener(t.value)}),(p,m)=>r.withDirectives((r.openBlock(),r.createElementBlock("div",{ref_key:"nodePeelRef",ref:t,style:r.normalizeStyle({transform:`translate(${p.nodeProps.x}px, ${p.nodeProps.y}px)`,"--rg-node-z-index":p.nodeProps.zIndex?p.nodeProps.zIndex:void 0,"--rg-node-color":p.nodeProps.color,"--rg-node-font-color":p.nodeProps.fontColor,"--rg-node-font-size":p.nodeProps.fontSize?p.nodeProps.fontSize+"px":void 0,"--rg-node-border-width":o.value,"--rg-node-border-radius":p.nodeProps.borderRadius&&p.nodeProps.borderRadius+"px","--rg-node-border-color":n.value,"--rg-node-width":s.value,"--rg-node-height":a.value,"--rg-node-opacity":p.nodeProps.opacity===void 0?void 0:p.nodeProps.opacity}),class:r.normalizeClass(["rg-node-peel",p.nodeProps.selected&&"rg-node-selected",p.dragging&&"rg-node-dragging",p.checked&&"rg-node-checked",(p.nodeProps.disablePointEvent||p.nodeProps.opacity===0)&&"rg-node-disable-events","rg-node-shape-"+(p.nodeProps.nodeShape===void 0?1:p.nodeProps.nodeShape),"rg-node-type-"+p.nodeProps.type,p.nodeProps.className]),"data-id":p.nodeProps.id},[d.value?r.renderSlot(p.$slots,"node-expand-button",{key:0,node:p.nodeProps,expandOrCollapseNode:c,expandHolderPosition:p.nodeProps.expandHolderPosition||p.defaultExpandHolderPosition},()=>[r.createVNode(Qe,{node:p.nodeProps,checked:p.checked,expandOrCollapseNode:c,expandHolderPosition:p.nodeProps.expandHolderPosition||p.defaultExpandHolderPosition},null,8,["node","checked","expandHolderPosition"])]):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"rg-node",onMousedown:r.withModifiers(u,["left","stop"]),onTouchstart:r.withModifiers(u,["stop"])},[r.renderSlot(p.$slots,"node",{node:p.nodeProps,checked:p.checked,dragging:p.dragging},()=>[r.createElementVNode("div",Dt,[r.createElementVNode("span",null,r.toDisplayString(p.nodeProps.text),1)])])],32)],14,Et)),[[r.vShow,h.value]])}}),Vt={class:"rg-nodes-container"},Bt=r.defineComponent({__name:"RGCanvasContent4Nodes",props:{defaultExpandHolderPosition:{},draggingNodeId:{},checkedNodeId:{}},setup(l){const i=X(),e=r.computed(()=>i.getShouldRenderNodes(i.dataStores.shouldRenderNodesRef.value));return r.onMounted(()=>{C("[RGCanvas mounted]")}),(t,n)=>(r.openBlock(),r.createElementBlock("div",Vt,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(e.value,o=>(r.openBlock(),r.createBlock(et,{key:o.id,"node-props":o,"default-expand-holder-position":t.defaultExpandHolderPosition,dragging:o.id===t.draggingNodeId,checked:o.id===t.checkedNodeId},{node:r.withCtx(s=>[r.renderSlot(t.$slots,"node",r.mergeProps({ref_for:!0},s))]),"node-expand-button":r.withCtx(s=>[r.renderSlot(t.$slots,"node-expand-button",r.mergeProps({ref_for:!0},s))]),_:2},1032,["node-props","default-expand-holder-position","dragging","checked"]))),128))]))}}),zt=["id","markerWidth","markerHeight","refX","refY","viewBox"],At=["d"],Xt=["id","markerWidth","markerHeight","refX","refY","viewBox"],Gt=["d"],tt=r.defineComponent({__name:"RGGraphDefs",props:{forElementLines:{type:Boolean}},setup(l){const i=X(),e=r.computed(()=>i.dataStores.optionsRef.value);return(t,n)=>(r.openBlock(),r.createElementBlock("defs",null,[r.createElementVNode("marker",{id:e.value.instanceId+"-arrow-default",markerWidth:e.value.defaultLineMarker.markerWidth,markerHeight:e.value.defaultLineMarker.markerHeight,refX:e.value.defaultLineMarker.refX,refY:e.value.defaultLineMarker.refY,markerUnits:"userSpaceOnUse",orient:"auto",viewBox:e.value.defaultLineMarker.viewBox},[r.createElementVNode("path",{style:{fill:"context-stroke"},d:e.value.defaultLineMarker.data},null,8,At)],8,zt),r.createElementVNode("marker",{id:e.value.instanceId+"-start-arrow-default",markerWidth:e.value.defaultLineMarker.markerWidth,markerHeight:e.value.defaultLineMarker.markerHeight,refX:e.value.defaultLineMarker.refX,refY:e.value.defaultLineMarker.refY,markerUnits:"userSpaceOnUse",orient:"auto-start-reverse",viewBox:e.value.defaultLineMarker.viewBox},[r.createElementVNode("path",{style:{fill:"context-stroke"},d:e.value.defaultLineMarker.data},null,8,Gt)],8,Xt),r.renderSlot(t.$slots,"default")]))}});var D=(l=>(l.Node="node",l.NodePoint="NodePoint",l.HTMLElementId="HTMLElementId",l.CanvasPoint="CanvasPoint",l.ViewPoint="ViewPoint",l))(D||{}),H=(l=>(l.border="border",l.ltrb="ltrb",l.tb="tb",l.lr="lr",l.left="left",l.right="right",l.top="top",l.bottom="bottom",l))(H||{}),_e=(l=>(l[l.circle=0]="circle",l[l.rect=1]="rect",l))(_e||{}),$=(l=>(l[l.StandardStraight=1]="StandardStraight",l[l.StandardCurve=6]="StandardCurve",l[l.Curve2=2]="Curve2",l[l.Curve3=3]="Curve3",l[l.Curve5=5]="Curve5",l[l.Curve7=7]="Curve7",l[l.Curve8=8]="Curve8",l[l.SimpleOrthogonal=4]="SimpleOrthogonal",l[l.StandardOrthogonal=44]="StandardOrthogonal",l[l.HardOrthogonal=49]="HardOrthogonal",l))($||{}),nt=(l=>(l.Left="left",l.Top="top",l.Right="right",l.Bottom="bottom",l))(nt||{}),E=(l=>(l.onReady="onReady",l.onNodeClick="onNodeClick",l.onNodeExpand="onNodeExpand",l.onNodeCollapse="onNodeCollapse",l.onLineClick="onLineClick",l.onNodeDragStart="onNodeDragStart",l.onNodeDragEnd="onNodeDragEnd",l.onNodeDragging="onNodeDragging",l.onCanvasDragEnd="onCanvasDragEnd",l.onCanvasDragging="onCanvasDragging",l.onContextmenu="onContextmenu",l.onFullscreen="onFullscreen",l.onCanvasClick="onCanvasClick",l.onCanvasSelectionEnd="onCanvasSelectionEnd",l.beforeZoomStart="beforeZoomStart",l.onZoomEnd="onZoomEnd",l.onViewResize="onViewResize",l.onResizeStart="onResizeStart",l.beforeNodeResize="beforeNodeResize",l.onResizeEnd="onResizeEnd",l.onLineVertexDropped="onLineVertexDropped",l.beforeCreateLine="beforeCreateLine",l.onLineBeCreated="onLineBeCreated",l.beforeAddNodes="beforeAddNodes",l.beforeAddLines="beforeAddLines",l.onKeyboardDown="onKeyboardDown",l.onKeyboardUp="onKeyboardUp",l.onCanvasDragStart="onCanvasDragStart",l.onForceLayoutFinish="onForceLayoutFinish",l.beforeScrollStart="beforeScrollStart",l))(E||{});const Ft={key:0},$t=["data-id"],Yt={key:1},ot=r.defineComponent({__name:"RGLineText",props:{lineConfig:{},linePathInfo:{},checked:{type:Boolean}},setup(l){const i=X(),e=r.computed(()=>{var n;return(n=l.lineConfig)==null?void 0:n.line}),t=r.computed(()=>e.value.isFakeLine?i.dataStores.textContainer4FakeLineRef.value:i.dataStores.textContainer4NormalRef.value);return(n,o)=>e.value&&t.value?(r.openBlock(),r.createElementBlock("foreignObject",Ft,[(r.openBlock(),r.createBlock(r.Teleport,{to:t.value},[r.createElementVNode("div",{class:r.normalizeClass(["rg-line-peel",e.value.className,n.checked&&"rg-line-checked",(e.value.disablePointEvent||e.value.opacity===0)&&"rg-line-disable-events",e.value.selected&&"rg-line-selected"]),"data-id":e.value.id,style:r.normalizeStyle({"--rg-line-color":e.value.color,"--rg-line-fontsize":e.value.fontSize?`${e.value.fontSize}px`:void 0,"--rg-line-opacity":e.value.opacity,"--rg-line-fontcolor":e.value.fontColor,...e.value.cssVars||{}})},[r.renderSlot(n.$slots,"default")],14,$t)],8,["to"]))])):(r.openBlock(),r.createElementBlock("g",Yt,[r.createElementVNode("text",null,"Null-text-"+r.toDisplayString(!!e.value)+"-"+r.toDisplayString(!!t.value),1)]))}}),Ht=["data-id"],Wt=["d"],Ut=["id","d"],Jt={key:0},jt=["dx","dy"],qt=["xlink:href","startOffset","text-anchor"],it=r.defineComponent({__name:"RGLinePath",props:{lineConfig:{},linePathInfo:{},useTextOnPath:{type:Boolean},checked:{type:Boolean},graphInstanceId:{}},emits:["onLineClick"],setup(l,{emit:i}){const e=X(),t=i,n=r.computed(()=>l.lineConfig.line),o=r.computed(()=>e.getArrowMarkerId(l.lineConfig.line,!0)),s=r.computed(()=>e.getArrowMarkerId(l.lineConfig.line,!1)),a=r.computed(()=>e.generateLineTextStyle4TextOnPath(l.lineConfig)),d=r.computed(()=>l.lineConfig.line.lineWidth?l.lineConfig.line.lineWidth+"px":void 0),h=r.computed(()=>l.graphInstanceId+"-"+l.lineConfig.line.id),c=u=>{t("onLineClick",u)};return(u,p)=>(r.openBlock(),r.createElementBlock("g",{class:r.normalizeClass(["rg-line-peel",n.value.className,n.value.selected&&"rg-line-selected",(n.value.disablePointEvent||n.value.opacity===0)&&"rg-line-disable-events",u.checked&&"rg-line-checked"]),"data-id":n.value.id,style:r.normalizeStyle({"--rg-line-width":d.value,"--rg-line-color":n.value.color,"--rg-line-opacity":n.value.opacity,"--rg-line-fontcolor":n.value.fontColor,"--rg-line-marker-end":s.value,"--rg-line-marker-start":o.value,...n.value.cssVars||{}})},[r.createElementVNode("path",{d:u.linePathInfo.pathData,class:"rg-line-bg",onTouchstart:c,onClick:c},null,40,Wt),r.createElementVNode("path",{id:h.value,d:u.linePathInfo.pathData,class:r.normalizeClass(["rg-line",[n.value.dashType?"rg-line-dashtype-"+n.value.dashType:void 0,n.value.animation?"rg-line-anm-"+n.value.animation:void 0]])},null,10,Ut),u.useTextOnPath&&a.value?(r.openBlock(),r.createElementBlock("g",Jt,[r.createElementVNode("text",{class:"rg-line-text rg-line-text-on-path",dx:a.value.textOffset.x+"px",dy:a.value.textOffset.y+"px",onTouchstart:c,onClick:c},[r.createElementVNode("textPath",{"xlink:href":"#"+h.value,startOffset:a.value.onPathStartOffset,"text-anchor":a.value.textAnchor,method:"align",spacing:"auto"},r.toDisplayString(a.value.text),9,qt)],40,jt)])):r.createCommentVNode("",!0),r.renderSlot(u.$slots,"default")],14,Ht))}}),st=r.defineComponent({__name:"RGLineContent",props:{lineConfig:{},checked:{type:Boolean},defaultLineTextOnPath:{type:Boolean},graphInstanceId:{}},setup(l){const i=X(),e=r.computed(()=>i.generateLinePath(l.lineConfig)),t=r.computed(()=>i.generateLineTextStyle(l.lineConfig,e.value)),n=r.computed(()=>l.lineConfig.line.useTextOnPath||l.defaultLineTextOnPath),o=r.computed(()=>n.value&&l.lineConfig.line.lineShape!==$.StandardStraight),s=a=>{i.onLineClick(l.lineConfig.line,a)};return(a,d)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createVNode(it,{lineConfig:a.lineConfig,linePathInfo:e.value,useTextOnPath:o.value,"graph-instance-id":a.graphInstanceId,checked:a.checked,onOnLineClick:s},null,8,["lineConfig","linePathInfo","useTextOnPath","graph-instance-id","checked"]),a.lineConfig.line.text&&!o.value?(r.openBlock(),r.createBlock(ot,{key:0,lineConfig:a.lineConfig,linePathInfo:e.value,checked:a.checked},{default:r.withCtx(()=>[r.createElementVNode("div",{class:r.normalizeClass(`rg-line-label ${n.value?"rg-line-label-on-path":""}`),style:r.normalizeStyle({...t.value.cssStyles}),onTouchstart:s,onClick:s},r.toDisplayString(t.value.text),39)]),_:1},8,["lineConfig","linePathInfo","checked"])):r.createCommentVNode("",!0)],64))}}),Zt={key:0},at=r.defineComponent({__name:"RGLinePeel",props:{line:{},checked:{type:Boolean},defaultLineTextOnPath:{type:Boolean},graphInstanceId:{}},setup(l){const i=X(),e=r.computed(()=>l.line.isFakeLine?i.generateFakeLineConfig(l.line):i.generateLineConfig(l.line));return(t,n)=>e.value?(r.openBlock(),r.createElementBlock("g",Zt,[r.renderSlot(t.$slots,"line",{lineConfig:e.value,defaultLineTextOnPath:t.defaultLineTextOnPath,graphInstanceId:t.graphInstanceId,checked:t.checked},()=>[r.createVNode(st,{"line-config":e.value,defaultLineTextOnPath:t.defaultLineTextOnPath,"graph-instance-id":t.graphInstanceId,checked:t.checked},null,8,["line-config","defaultLineTextOnPath","graph-instance-id","checked"])])])):r.createCommentVNode("",!0)}}),Kt={class:"rg-lines-container rg-lines-container-el-lines"},Qt={class:"rg-lines-svg rg-lines-svg-el-lines",xmlns:"http://www.w3.org/2000/svg"},en=r.defineComponent({__name:"RGCanvasContent4FakeLines",props:{showEasyView:{type:Boolean},defaultLineTextOnPath:{type:Boolean},checkedLineId:{},graphInstanceId:{}},setup(l){const i=X(),e=r.computed(()=>(console.error("allFakeLineConfigList: computed!"),i.getShouldRenderFakeLines(i.dataStores.shouldRenderFakeLinesRef.value)));return r.onMounted(()=>{C("[RGCanvas mounted]")}),(t,n)=>(r.openBlock(),r.createElementBlock("div",Kt,[n[0]||(n[0]=r.createElementVNode("div",{class:"rg-linetext-container"},null,-1)),(r.openBlock(),r.createElementBlock("svg",Qt,[r.createVNode(tt,{"for-element-lines":!0}),t.showEasyView?r.createCommentVNode("",!0):(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(e.value,o=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:o.id},[o.hidden!==!0?(r.openBlock(),r.createBlock(at,{key:0,line:o,defaultLineTextOnPath:t.defaultLineTextOnPath,checked:o.id===t.checkedLineId,"graph-instance-id":t.graphInstanceId},{line:r.withCtx(s=>[r.renderSlot(t.$slots,"line",r.mergeProps({ref_for:!0},s))]),_:2},1032,["line","defaultLineTextOnPath","checked","graph-instance-id"])):r.createCommentVNode("",!0)],64))),128))]))]))}}),tn={class:"rg-lines-container rg-lines-container-el-lines"},nn={class:"rg-lines-svg rg-lines-svg-el-lines",xmlns:"http://www.w3.org/2000/svg"},on=r.defineComponent({__name:"RGCanvasContent4CreatingLine",props:{defaultLineTextOnPath:{type:Boolean},checkedLineId:{},graphInstanceId:{}},setup(l){const i=X(),e=r.computed(()=>(console.error("creatingLineConfig: computed!"),i.generateCreatingLineConfig(i.dataStores.optionsRef.value)));return r.onMounted(()=>{C("[RGCanvas mounted]")}),(t,n)=>(r.openBlock(),r.createElementBlock("div",tn,[n[0]||(n[0]=r.createElementVNode("div",{class:"rg-linetext-container"},null,-1)),(r.openBlock(),r.createElementBlock("svg",nn,[r.renderSlot(t.$slots,"line",{lineConfig:e.value},()=>[r.createVNode(st,{"line-config":e.value,defaultLineTextOnPath:t.defaultLineTextOnPath,"graph-instance-id":t.graphInstanceId},null,8,["line-config","defaultLineTextOnPath","graph-instance-id"])])]))]))}}),sn={class:"rg-lines-container rg-lines-container-normal-lines"},an={class:"rg-lines-svg",xmlns:"http://www.w3.org/2000/svg"},rn=r.defineComponent({__name:"RGCanvasContent4Lines",props:{showEasyView:{type:Boolean},defaultLineTextOnPath:{type:Boolean},checkedLineId:{},graphInstanceId:{}},setup(l){const i=X(),e=r.computed(()=>i.getShouldRenderLines(i.dataStores.shouldRenderLinesRef.value));return r.onMounted(()=>{C("[RGCanvas mounted]")}),(t,n)=>(r.openBlock(),r.createElementBlock("div",sn,[n[0]||(n[0]=r.createElementVNode("div",{class:"rg-linetext-container"},null,-1)),(r.openBlock(),r.createElementBlock("svg",an,[r.createVNode(tt),t.showEasyView?r.createCommentVNode("",!0):(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(e.value,o=>(r.openBlock(),r.createElementBlock(r.Fragment,{key:o.id},[o.hidden!==!0?(r.openBlock(),r.createBlock(at,{key:"l-"+o.id,line:o,defaultLineTextOnPath:t.defaultLineTextOnPath,checked:o.id===t.checkedLineId,"graph-instance-id":t.graphInstanceId},{line:r.withCtx(s=>[r.renderSlot(t.$slots,"line",r.mergeProps({ref_for:!0},s))]),_:2},1032,["line","defaultLineTextOnPath","checked","graph-instance-id"])):r.createCommentVNode("",!0)],64))),128))]))]))}}),ln={class:"rg-single-graph"},dn={class:"rg-nodes-container-wrapper"},rt=r.defineComponent({__name:"RGCanvasContent",props:{showEasyView:{type:Boolean},creatingLine:{type:Boolean},defaultExpandHolderPosition:{},draggingNodeId:{},checkedNodeId:{},checkedLineId:{},graphInstanceId:{},defaultLineTextOnPath:{type:Boolean}},setup(l){return(i,e)=>(r.openBlock(),r.createElementBlock("div",ln,[r.withMemo([i.defaultLineTextOnPath,i.checkedLineId],()=>r.createVNode(rn,{showEasyView:i.showEasyView,defaultLineTextOnPath:i.defaultLineTextOnPath,"checked-line-id":i.checkedLineId,"graph-instance-id":i.graphInstanceId},{line:r.withCtx(t=>[r.renderSlot(i.$slots,"line",r.normalizeProps(r.guardReactiveProps(t)))]),_:3},8,["showEasyView","defaultLineTextOnPath","checked-line-id","graph-instance-id"]),e,0),r.createElementVNode("div",dn,[i.showEasyView?r.createCommentVNode("",!0):r.withMemo([i.draggingNodeId,i.checkedNodeId,i.defaultExpandHolderPosition],()=>(r.openBlock(),r.createBlock(Bt,{key:0,"default-expand-holder-position":i.defaultExpandHolderPosition,draggingNodeId:i.draggingNodeId,checkedNodeId:i.checkedNodeId},{node:r.withCtx(t=>[r.renderSlot(i.$slots,"node",r.normalizeProps(r.guardReactiveProps(t)))]),"node-expand-button":r.withCtx(t=>[r.renderSlot(i.$slots,"node-expand-button",r.normalizeProps(r.guardReactiveProps(t)))]),_:3},8,["default-expand-holder-position","draggingNodeId","checkedNodeId"])),e,1)]),r.createVNode(en,{showEasyView:i.showEasyView,defaultLineTextOnPath:i.defaultLineTextOnPath,"checked-line-id":i.checkedLineId,"graph-instance-id":i.graphInstanceId},{line:r.withCtx(t=>[r.renderSlot(i.$slots,"line",r.normalizeProps(r.guardReactiveProps(t)))]),_:3},8,["showEasyView","defaultLineTextOnPath","checked-line-id","graph-instance-id"]),i.creatingLine?(r.openBlock(),r.createBlock(on,{key:0,defaultLineTextOnPath:i.defaultLineTextOnPath,"checked-line-id":i.checkedLineId},{line:r.withCtx(t=>[r.renderSlot(i.$slots,"line",r.normalizeProps(r.guardReactiveProps(t)))]),_:3},8,["defaultLineTextOnPath","checked-line-id"])):r.createCommentVNode("",!0)]))}}),cn=r.defineComponent({__name:"RGEasyView",setup(l){const i=X(),e=r.ref(),t=r.computed(()=>i.dataStores.optionsRef.value);return r.onMounted(()=>{C("[RGEasyView mounted]"),i.setEasyViewCanvas&&i.setEasyViewCanvas(e.value)}),(n,o)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["rg-easy-view",{"rg-easy-view-active":t.value.showEasyView}])},[r.createElementVNode("canvas",{ref_key:"$rgEasyCanvas",ref:e,style:{width:"100%",height:"100%"}},null,512)],2))}}),hn={class:"rg-map-background"},un={class:"rg-canvas-slot rg-canvas-slot-behind"},pn={class:"rg-canvas-slot rg-canvas-slot-above"},fn=r.defineComponent({__name:"RGCanvas",setup(l){const i=r.ref(),e=X(),t=r.computed(()=>e.dataStores.optionsRef.value),n=a=>{e.onCanvasDragStart(a)},o=a=>{e.onContextmenu(a)},s=r.computed(()=>{const a=e.dataStores.optionsRef.value;return{width:`${a.canvasSize.width}px`,height:`${a.canvasSize.height}px`,"background-color":"transparent",transform:`translate(${a.canvasOffset.x}px, ${a.canvasOffset.y}px) scale(${a.canvasZoom/100},${t.value.canvasZoom/100})`}});return r.onMounted(()=>{C("[RGCanvas mounted]"),e.setCanvasDom(i.value)}),(a,d)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["rg-map",[t.value.canvasOpacity===1&&"rg-map-ready"]]),onContextmenu:d[0]||(d[0]=r.withModifiers(h=>o(h),["prevent"])),onMousedown:d[1]||(d[1]=r.withModifiers(h=>n(h),["left"])),onTouchstart:d[2]||(d[2]=h=>n(h))},[r.createElementVNode("div",hn,[r.renderSlot(a.$slots,"background")]),r.createElementVNode("div",{style:r.normalizeStyle(s.value),class:"rg-map-canvas rg-canvas-behind"},[r.createElementVNode("div",un,[r.renderSlot(a.$slots,"canvas-plug-behind")])],4),r.createVNode(cn),r.createElementVNode("div",{ref_key:"rgCanvasRef",ref:i,style:r.normalizeStyle(s.value),class:"rg-map-canvas"},[r.createVNode(rt,{"show-easy-view":t.value.showEasyView,"creating-line":!!(t.value.creatingLinePlot&&t.value.newLinkTemplate.fromNode),"default-expand-holder-position":t.value.defaultExpandHolderPosition,draggingNodeId:t.value.draggingNodeId,checkedNodeId:t.value.checkedNodeId,defaultLineTextOnPath:t.value.defaultLineTextOnPath,"checked-line-id":t.value.checkedLineId,"graph-instance-id":t.value.instanceId},{line:r.withCtx(h=>[r.renderSlot(a.$slots,"line",r.normalizeProps(r.guardReactiveProps(h)))]),node:r.withCtx(h=>[r.renderSlot(a.$slots,"node",r.normalizeProps(r.guardReactiveProps(h)))]),"node-expand-button":r.withCtx(h=>[r.renderSlot(a.$slots,"node-expand-button",r.normalizeProps(r.guardReactiveProps(h)))]),_:3},8,["show-easy-view","creating-line","default-expand-holder-position","draggingNodeId","checkedNodeId","defaultLineTextOnPath","checked-line-id","graph-instance-id"])],4),r.createElementVNode("div",{style:r.normalizeStyle(s.value),class:"rg-map-canvas rg-canvas-above"},[r.createElementVNode("div",pn,[r.renderSlot(a.$slots,"canvas-plug-above")])],4)],34))}}),gn=r.defineComponent({__name:"GraphMoveOperator",setup(l){const i=X(),e=r.computed(()=>i.dataStores.optionsRef.value),t=r.computed(()=>e.value.canvasMoveMode),n=o=>{i.startMoveCanvas(o,!0)};return(o,s)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["rg-move-operator",{"rg-move-operator-active":t.value}])},[r.createElementVNode("div",{class:"rg-move-touchpad",onMousedown:n,onTouchstart:n},null,32)],2))}}),mn={class:"rg-graph-loading-message"},yn=r.defineComponent({__name:"GraphLoading",setup(l){const i=X(),e=r.computed(()=>i.dataStores.optionsRef.value),t=n=>{i.clearLoading()};return(n,o)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["rg-graph-loading",{"rg-graph-loading-hide":!e.value.graphLoading}]),onClick:t},[r.createElementVNode("div",mn,[r.createVNode(q,{"icon-name":"icon-lianjiezhong","class-name":"rg-graph-loading-icon"}),r.createTextVNode(" "+r.toDisplayString(e.value.graphLoadingText||"Loading..."),1)])],2))}}),vn={key:0,class:"rg-operate"},xn={class:"rg-creating-container"},lt=r.defineComponent({__name:"GraphOperateStuff",setup(l){const i=X(),e=r.computed(()=>i.dataStores.optionsRef.value);return(t,n)=>e.value?(r.openBlock(),r.createElementBlock("div",vn,[r.createElementVNode("div",xn,[e.value.creatingNodePlot&&e.value.showTemplateNode?(r.openBlock(),r.createBlock(et,{key:0,"node-props":e.value.newNodeTemplate},{node:r.withCtx(()=>[r.renderSlot(t.$slots,"node",{node:e.value.newNodeTemplate})]),_:3},8,["node-props"])):r.createCommentVNode("",!0),e.value.creatingSelection?(r.openBlock(),r.createElementBlock("div",{key:1,class:"rg-selection",style:r.normalizeStyle({transform:`translate(${e.value.selectionView.x}px, ${e.value.selectionView.y}px)`,width:e.value.selectionView.width+"px",height:e.value.selectionView.height+"px"})},null,4)):r.createCommentVNode("",!0)]),r.createVNode(gn),r.createVNode(yn)])):r.createCommentVNode("",!0)}}),Cn=["title"],dt=r.defineComponent({__name:"GraphXsToolBar",props:{direction:{},positionH:{},positionV:{}},setup(l){const i=X(),e=r.computed(()=>i.dataStores.optionsRef.value),t=()=>{i.toggleAutoLayout()},n=async()=>{i.enableCanvasAnimation(),i.setZoom(100),i.moveToCenter(),i.zoomToFit(),setTimeout(()=>{i.disableCanvasAnimation()},300)},o=async a=>{i.zoom(a)},s=async()=>{i.fullscreen()};return(a,d)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["rg-toolbar rg-xs-toolbar",["rg-toolbar-h-"+(a.positionH||e.value.toolBarPositionH||"left"),"rg-toolbar-v-"+(a.positionV||e.value.toolBarPositionV||"bottom"),"rg-toolbar-"+(a.direction||e.value.toolBarDirection||"h")]])},[r.createElementVNode("div",{title:"Full Screen",class:"rg-mb-button",style:{"margin-top":"0px"},onClick:s},[r.createVNode(q,{"icon-name":"icon-quanping"})]),r.createElementVNode("div",{class:"rg-mb-button",onClick:d[0]||(d[0]=h=>o(20))},[r.createVNode(q,{"icon-name":"icon-fangda"})]),r.createElementVNode("div",{class:"rg-current-zoom",onClick:n},r.toDisplayString(Math.round(e.value.canvasZoom))+"%",1),r.createElementVNode("div",{class:"rg-mb-button",style:{"margin-top":"0px"},onClick:d[1]||(d[1]=h=>o(-20))},[r.createVNode(q,{"icon-name":"icon-suoxiao"})]),e.value.layout.supportAutoLayout?(r.openBlock(),r.createElementBlock("div",{key:0,title:e.value.layout.autoLayouting?"Stop Force Layout":"Start Force Layout",class:r.normalizeClass([{"rg-mb-button-on":e.value.layout.autoLayouting},"rg-mb-button"]),onClick:t},[e.value.layout.autoLayouting?(r.openBlock(),r.createBlock(q,{key:1,"icon-name":"icon-lianjiezhong","class-name":"rg-loading-icon"})):(r.openBlock(),r.createBlock(q,{key:0,"icon-name":"icon-zidong"}))],10,Cn)):r.createCommentVNode("",!0),r.renderSlot(a.$slots,"default"),d[2]||(d[2]=r.createElementVNode("div",{style:{clear:"both"}},null,-1))],2))}});const Ln=["id"],wn={class:"rg-graph-plugs"},_n={class:"rg-view-slot"},Nn=r.defineComponent({__name:"RelationGraphUI",setup(l){const i=X(),e=r.ref(),t=r.computed(()=>i.dataStores.optionsRef.value),n=r.ref(!1);r.onMounted(()=>{i.setDom(e.value),n.value=!0}),r.onBeforeUnmount(()=>{i.beforeUnmount()});const o=s=>{i.onMouseWheel(s)};return console.error("RelationView.vue"),r.onMounted(()=>{console.error("RelationView.vue mounted")}),(s,a)=>{var d,h,c,u,p,m,f,g,y,v,x;return r.openBlock(),r.createElementBlock("div",{ref_key:"relationGraphRef$",ref:e,id:"relation-graph-ins-"+((d=t.value)==null?void 0:d.instanceId),tabindex:"1",class:r.normalizeClass(["relation-graph",t.value&&t.value.creatingLinePlot?"rg-creating-line":"",t.value&&t.value.dragEventAction==="move"?"rg-move-mode":"",t.value&&t.value.enableNodeXYAnimation?"rg-enable-node-xy-animation":"",t.value&&t.value.enableCanvasTransformAnimation?"rg-enable-canvas-animation":""]),style:r.normalizeStyle({width:"100%",height:(h=t.value)!=null&&h.viewHeight?(c=t.value)==null?void 0:c.viewHeight:"100%",opacity:n.value?1:0,"--rg-checked-item-bg-color":(u=t.value)==null?void 0:u.checkedItemBackgroundColor,"--rg-background-color":(p=t.value)==null?void 0:p.backgroundColor,"--rg-node-color":(m=t.value)==null?void 0:m.defaultNodeColor,"--rg-node-border-color":(f=t.value)==null?void 0:f.defaultNodeBorderColor,"--rg-node-border-width":((g=t.value)==null?void 0:g.defaultNodeBorderWidth)+"px","--rg-node-border-radius":((y=t.value)==null?void 0:y.defaultNodeBorderRadius)+"px","--rg-line-color":(v=t.value)==null?void 0:v.defaultLineColor,"--rg-line-width":((x=t.value)==null?void 0:x.defaultLineWidth)+"px"}),onWheel:o},[t.value&&n.value?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[t.value.showToolBar?(r.openBlock(),r.createBlock(dt,{key:0})):r.createCommentVNode("",!0),r.createVNode(fn,null,{node:r.withCtx(L=>[r.renderSlot(s.$slots,"node",r.normalizeProps(r.guardReactiveProps(L)))]),line:r.withCtx(L=>[r.renderSlot(s.$slots,"line",r.normalizeProps(r.guardReactiveProps(L)))]),"canvas-plug-behind":r.withCtx(()=>[r.renderSlot(s.$slots,"canvas"),r.renderSlot(s.$slots,"default")]),"canvas-plug-above":r.withCtx(()=>[r.renderSlot(s.$slots,"canvas-above")]),"node-expand-button":r.withCtx(L=>[r.renderSlot(s.$slots,"node-expand-button",r.normalizeProps(r.guardReactiveProps(L)))]),background:r.withCtx(()=>[r.renderSlot(s.$slots,"background")]),_:3}),r.createVNode(lt,null,{node:r.withCtx(L=>[r.renderSlot(s.$slots,"node",r.normalizeProps(r.guardReactiveProps(L)))]),_:3}),r.createElementVNode("div",wn,[r.createElementVNode("div",_n,[r.renderSlot(s.$slots,"view")])])],64)):r.createCommentVNode("",!0)],46,Ln)}}});class bn{constructor(i){_(this,"$evCanvasCtx");_(this,"viewScale",1);_(this,"offset",{x:0,y:0});const e=i.getContext("2d");if(!e)throw new Error("\u65E0\u6CD5\u83B7\u53D6 Canvas 2D \u4E0A\u4E0B\u6587");this.$evCanvasCtx=e}setSize(i,e){const t=this.$evCanvasCtx.canvas;t.width=i*window.devicePixelRatio,t.height=e*window.devicePixelRatio,t.style.width=`${i}px`,t.style.height=`${e}px`,this.$evCanvasCtx.setTransform(window.devicePixelRatio,0,0,window.devicePixelRatio,0,0),this.applyCurrentViewTransform()}setScale(i){this.viewScale=i,this.applyCurrentViewTransform()}applyCurrentViewTransform(){this.$evCanvasCtx.setTransform(window.devicePixelRatio,0,0,window.devicePixelRatio,0,0),this.$evCanvasCtx.scale(this.viewScale,this.viewScale)}setViewOffset(i,e){this.offset.x=i/this.viewScale,this.offset.y=e/this.viewScale}beforeDraw(){}evDrawNode4Rect(i,e,t,n,o,s,a=5,d){const h=this.$evCanvasCtx,c=this.offset.x+i,u=this.offset.y+e;let p=Math.max(0,a);t<2*p&&(p=t/2),n<2*p&&(p=n/2),h.beginPath(),h.globalAlpha=s,p===0?h.rect(c,u,t,n):(h.moveTo(c+p,u),h.arcTo(c+t,u,c+t,u+p,p),h.arcTo(c+t,u+n,c+t-p,u+n,p),h.arcTo(c,u+n,c,u+n-p,p),h.arcTo(c,u,c+p,u,p),h.closePath()),h.fillStyle=o,h.fill(),h.globalAlpha=1,h.strokeStyle=d,h.lineWidth=1,h.stroke()}evDrawNode4Circle(i,e,t,n,o,s,a){const d=this.$evCanvasCtx,h=this.offset.x+i+t/2,c=this.offset.y+e+n/2;d.beginPath(),d.globalAlpha=s,d.ellipse(h,c,t/2,n/2,0,0,2*Math.PI),d.fillStyle=o,d.fill(),d.strokeStyle=a,d.lineWidth=1,d.stroke(),d.globalAlpha=1}evDrawLine(i,e,t,n){const o=this.$evCanvasCtx;o.beginPath(),o.globalAlpha=n,this.evDrawSvgPathOnCanvas(o,i),o.strokeStyle=t,o.lineWidth=e*this.viewScale<.5?.5:e,o.stroke(),o.globalAlpha=1}getPointValue(i,e,t){return t?i+parseFloat(e):parseFloat(e)}evDrawSvgPathOnCanvas(i,e){const t=e.match(/[a-zA-Z][^a-zA-Z]*/g);if(!t)return;let n=0,o=0,s=0,a=0,d=0,h=0,c=0,u=0,p="";i.beginPath(),t.forEach(m=>{const f=m.trim(),g=f.charAt(0),v=f.substring(1).trim().split(/[ ,]+/).filter(w=>w!=="").map(parseFloat);let x=0,L=0,N=0,T=0,O=0,b=0,k=0,P=0,S=0,R=0,M=0;switch(g){case"M":n=v[0],o=v[1],s=n,a=o,i.moveTo(n+this.offset.x,o+this.offset.y);for(let w=2;w<v.length;w+=2)n=v[w],o=v[w+1],i.lineTo(n+this.offset.x,o+this.offset.y);break;case"L":for(let w=0;w<v.length;w+=2)n=v[w],o=v[w+1],i.lineTo(n+this.offset.x,o+this.offset.y);break;case"l":for(let w=0;w<v.length;w+=2)n+=v[w],o+=v[w+1],i.lineTo(n+this.offset.x,o+this.offset.y);break;case"H":for(let w=0;w<v.length;w++)n=v[w],i.lineTo(n+this.offset.x,o+this.offset.y);break;case"h":for(let w=0;w<v.length;w++)n+=v[w],i.lineTo(n+this.offset.x,o+this.offset.y);break;case"V":for(let w=0;w<v.length;w++)o=v[w],i.lineTo(n+this.offset.x,o+this.offset.y);break;case"v":for(let w=0;w<v.length;w++)o+=v[w],i.lineTo(n+this.offset.x,o+this.offset.y);break;case"C":for(let w=0;w<v.length;w+=6)N=v[w],T=v[w+1],O=v[w+2],b=v[w+3],x=v[w+4],L=v[w+5],i.bezierCurveTo(N+this.offset.x,T+this.offset.y,O+this.offset.x,b+this.offset.y,x+this.offset.x,L+this.offset.y),n=x,o=L,d=O,h=b;break;case"c":for(let w=0;w<v.length;w+=6)N=n+v[w],T=o+v[w+1],O=n+v[w+2],b=o+v[w+3],x=n+v[w+4],L=o+v[w+5],i.bezierCurveTo(N+this.offset.x,T+this.offset.y,O+this.offset.x,b+this.offset.y,x+this.offset.x,L+this.offset.y),d=O,h=b,n=x,o=L;break;case"S":for(let w=0;w<v.length;w+=4)p.match(/[CS]/i)?(N=2*n-d,T=2*o-h):(N=n,T=o),O=v[w],b=v[w+1],x=v[w+2],L=v[w+3],i.bezierCurveTo(N+this.offset.x,T+this.offset.y,O+this.offset.x,b+this.offset.y,x+this.offset.x,L+this.offset.y),n=x,o=L,d=O,h=b;break;case"s":for(let w=0;w<v.length;w+=4)p.match(/[CS]/i)?(N=2*n-d,T=2*o-h):(N=n,T=o),O=n+v[w],b=o+v[w+1],x=n+v[w+2],L=o+v[w+3],i.bezierCurveTo(N+this.offset.x,T+this.offset.y,O+this.offset.x,b+this.offset.y,x+this.offset.x,L+this.offset.y),d=O,h=b,n=x,o=L;break;case"Q":for(let w=0;w<v.length;w+=4)N=v[w],T=v[w+1],x=v[w+2],L=v[w+3],i.quadraticCurveTo(N+this.offset.x,T+this.offset.y,x+this.offset.x,L+this.offset.y),n=x,o=L,c=N,u=T;break;case"q":for(let w=0;w<v.length;w+=4)N=n+v[w],T=o+v[w+1],x=n+v[w+2],L=o+v[w+3],i.quadraticCurveTo(N+this.offset.x,T+this.offset.y,x+this.offset.x,L+this.offset.y),c=N,u=T,n=x,o=L;break;case"T":for(let w=0;w<v.length;w+=2)p.match(/[QT]/i)?(N=2*n-c,T=2*o-u):(N=n,T=o),x=v[w],L=v[w+1],i.quadraticCurveTo(N+this.offset.x,T+this.offset.y,x+this.offset.x,L+this.offset.y),n=x,o=L,c=N,u=T;break;case"t":for(let w=0;w<v.length;w+=2)p.match(/[QT]/i)?(N=2*n-c,T=2*o-u):(N=n,T=o),x=n+v[w],L=o+v[w+1],i.quadraticCurveTo(N+this.offset.x,T+this.offset.y,x+this.offset.x,L+this.offset.y),c=N,u=T,n=x,o=L;break;case"A":for(let w=0;w<v.length;w+=7)k=v[w],P=v[w+1],S=v[w+2],R=v[w+3],M=v[w+4],x=v[w+5],L=v[w+6],this.drawArc(i,n,o,k,P,S,R,M,x,L),n=x,o=L;break;case"a":for(let w=0;w<v.length;w+=7)k=v[w],P=v[w+1],S=v[w+2],R=v[w+3],M=v[w+4],x=n+v[w+5],L=o+v[w+6],this.drawArc(i,n,o,k,P,S,R,M,x,L),n=x,o=L;break;case"Z":case"z":i.closePath(),n=s,o=a;break;default:console.warn(`\u672A\u652F\u6301\u7684SVG\u547D\u4EE4\u5B57\u7B26: ${g}`)}g.match(/[CSQT]/i)?p=g:p=""})}drawArc(i,e,t,n,o,s,a,d,h,c){if(n=Math.abs(n),o=Math.abs(o),n===0||o===0){i.lineTo(h+this.offset.x,c+this.offset.y);return}const u=s%360*Math.PI/180,p=Math.sin(u),m=Math.cos(u),f=m*(e-h)/2+p*(t-c)/2,g=-p*(e-h)/2+m*(t-c)/2,y=f*f/(n*n)+g*g/(o*o);y>1&&(n*=Math.sqrt(y),o*=Math.sqrt(y));let v=(a===d?-1:1)*Math.sqrt(Math.max(0,(n*n*o*o-n*n*g*g-o*o*f*f)/(n*n*g*g+o*o*f*f)));isNaN(v)&&(v=0);const x=v*n*g/o,L=v*-o*f/n,N=m*x-p*L+(e+h)/2,T=p*x+m*L+(t+c)/2,O=(f-x)/n,b=(g-L)/o,k=(-f-x)/n,P=(-g-L)/o;let S=Math.atan2(b,O),R=Math.atan2(b*k-O*P,O*k+b*P);d===0&&R>0?R-=2*Math.PI:d===1&&R<0&&(R+=2*Math.PI);const M=S+R;i.ellipse?i.ellipse(N+this.offset.x,T+this.offset.y,n,o,u,S,M,d===0):(console.warn("ctx.ellipse is not supported. Arc will be drawn as a line."),i.lineTo(h+this.offset.x,c+this.offset.y))}}const B={getDescendantNodes(l,i=[]){return l.lot&&l.lot.childs&&l.lot.childs.forEach(e=>{i.push(e),B.getDescendantNodes(e,i)}),i},isVisibleNode(l,i=0){return typeof i!="number"&&(i=0),i>18?!0:l.hidden?!1:l.lot&&l.lot.parent?l.lot.parent.expanded===!1?!1:B.isVisibleNode(l.lot.parent,i+1):!0},isAllowShowNode(l,i=0){return B.isVisibleNode(l,i=0)},getNodeWidth(l){return l.el_W||l.width||50},getNodeHeight(l){return l.el_H||l.height||50},getNodeXByLotX(l,i){const e=i.lot.x||0;return l.alignItemsX==="end"?e-B.getNodeWidth(i):l.alignItemsX==="start"?e:e-B.getNodeWidth(i)/2},getNodeYByLotY(l,i){const e=i.lot.y||0;return l.alignItemsY==="end"?e-B.getNodeHeight(i):l.alignItemsY==="start"?e:e-B.getNodeHeight(i)/2},getNodeLotXY(l,i){let e=i.x||0,t=i.y||0;return l.alignItemsX==="end"?e=e+B.getNodeWidth(i):l.alignItemsX==="start"||(e=e+B.getNodeWidth(i)/2),l.alignItemsY==="end"?t=t+B.getNodeHeight(i):l.alignItemsY==="start"||(t=t+B.getNodeHeight(i)/2),{x:e,y:t}},isRectangleOverlap(l,i){const e=l.x,t=i.x,n=l.el_W,o=i.el_W,s=l.y,a=i.y,d=l.el_H,h=i.el_H;return!(t>=e+n||t+o<=e||a>=s+d||a+h<=s)},isXOverlap(l,i,e,t){return!(i>=l+e||i+t<=l)},isYOverlap(l,i,e,t){return!(i>=l+e||i+t<=l)},shapesOverlap(l,i,e=1,t=1){return this.isRectangleOverlap(l,i)},getNoOverlapLimitedPosition(l,i,e,t){const n=l.x,o=l.y,s=i,a=t.x,d=l.el_W,h=t.el_W,c=e,u=t.y,p=l.el_H,m=t.el_H;let f=l.x,g=l.y;const y=this.isXOverlap(n,a,d,h),v=this.isYOverlap(o,u,p,m);return y?c<u?(f=i,g=u-p):c>u&&(f=i,g=u+m):v&&(s<a?(f=a-d,g=e):s>a&&(f=a+h,g=e)),{x:f,y:g}},flatNodeData(l,i,e,t){l.forEach(n=>{e.push(n),i&&t.push({from:i.id,to:n.id});const o=n.children||n.childs;o&&o.length>0&&this.flatNodeData(o,n,e,t)})}},Le=(l,i)=>l||l===0?l:i,we=B,Ae={id:"rg-newNodeTemplate",x:0,y:0,text:""},Ne=(l,i,e)=>{if(l.id===void 0)throw console.log("node must has id:",l),new Error("node must has option[id]:");l.isShow!==void 0&&(l.hidden=!l.isShow,console.warn("[relation-graph Warning] line option[isShow] is deprecated, please use [hidden] instead.")),l.isHide!==void 0&&(l.hidden=l.isHide,console.warn("[relation-graph Warning] line option[isHide] is deprecated, please use [hidden] instead."));const t=l.width||l.width===0?l.width:i==null?void 0:i.defaultNodeWidth,n=l.height||l.height===0?l.height:i==null?void 0:i.defaultNodeHeight,o={id:l.id,text:l.text!==void 0?l.text:"",type:l.type!==void 0?l.type:"",targetType:l.targetType!==void 0?l.targetType:D.Node,expanded:l.expanded!==void 0?l.expanded:!0,selected:l.selected!==void 0?l.selected:!1,className:l.className!==void 0?l.className:"",nodeShape:Le(l.nodeShape,i==null?void 0:i.defaultNodeShape),borderWidth:l.borderWidth!==void 0?l.borderWidth:void 0,borderRadius:l.borderRadius!==void 0?l.borderRadius:void 0,borderColor:l.borderColor!==void 0?l.borderColor:void 0,fontColor:l.fontColor!==void 0?l.fontColor:void 0,fontSize:l.fontSize!==void 0?l.fontSize:void 0,color:l.color!==void 0?l.color:void 0,opacity:l.opacity!==void 0?l.opacity:void 0,fixed:l.fixed!==void 0?l.fixed:!1,width:t,height:n,force_weight:l.force_weight,x:l.x!==void 0?l.x:0,y:l.y!==void 0?l.y:0,expandHolderPosition:l.expandHolderPosition!==void 0?l.expandHolderPosition:void 0,disablePointEvent:l.disablePointEvent!==void 0?l.disablePointEvent:void 0,disableDrag:l.disableDrag!==void 0?l.disableDrag:!1,hidden:l.hidden!==void 0?l.hidden:!1,rgCalcedVisibility:!0,rgShouldRender:!0,rgChildrenSize:0,zIndex:l.zIndex||0,el_W:l.el_W||t||0,el_H:l.el_H||n||0,data:l.data!==void 0?l.data:{}};if(e&&e.has&&e.has(o.id)){const s=e.get(o.id);o.el_W||s&&(o.el_W=s[0]),o.el_H||s&&(o.el_H=s[1])}return o.lot={childs:[],parent:void 0,eached:!1,strength:0},o.width&&(o.el_W=o.width),o.height&&(o.el_H=o.height),o},kn=["Fx","Fy","appended","dragging","el","el_W","el_H","targetFrom","targetNodes","targetTo","lot","seeks_id","shouldRender","rgCalcedVisibility","rgShouldRender","rgChildrenSize","origin_x","origin_y","selected"],Oe=l=>{if(!l)return;const i={};return Object.keys(l).forEach(e=>{if(!kn.includes(e)){const t=l[e];t!==void 0&&(e==="offset_x"&&t===0||e==="nodeShape"&&t===1||e==="offset_y"&&t===0||e==="zIndex"&&t===0||e==="width"&&!t||e==="height"&&!t||e==="fixed"&&t===!1||e==="className"&&t===""||e==="hidden"&&t===!1||e==="disableDrag"&&t===!1||e==="expanded"&&t===!0||e==="opacity"&&t===1||e==="type"&&t==="node"||e==="targetType"&&t===D.Node||e==="data"&&(!t||Object.keys(t).length===0)||(i[e]=t))}}),i},On={json2Node:Ne,transNodeToJson:Oe},Pn=Object.freeze(Object.defineProperty({__proto__:null,newNodeTemplate:Ae,json2Node:Ne,transNodeToJson:Oe,default:On},Symbol.toStringTag,{value:"Module"}));let pe={x:0,y:0};const fe={x:0,y:0},ie={x:0,y:0};let Se,Me;const Ie=l=>{const i={clientX:0,clientY:0};if(ae(l)){const e=l.touches||l.targetTouches;if(!e)throw new Error("error targetTouches");i.clientX=e[0].clientX,i.clientY=e[0].clientY}else i.clientX=l.clientX,i.clientY=l.clientY;return i},K={startDrag(l,i,e,t){t?Se=(n,o,s)=>{const a=n-ie.x,d=o-ie.y;t(a,d,fe,ie,s)}:Se=(n,o)=>{pe.x=fe.x+(n-ie.x),pe.y=fe.y+(o-ie.y)},Me=e,pe=i,fe.x=pe.x,fe.y=pe.y;try{const n=Ie(l);ie.x=n.clientX,ie.y=n.clientY,ae(l)?(document.body.addEventListener("touchmove",K.onNodeMove),document.body.addEventListener("touchend",K.onNodeDragend),document.body.addEventListener("mousemove",K.onNodeMove),document.body.addEventListener("mouseup",K.onNodeDragend),l.preventDefault()):(document.body.addEventListener("mousemove",K.onNodeMove),document.body.addEventListener("mouseup",K.onNodeDragend))}catch(n){console.error(n.message)}},onNodeMove(l){const i=Ie(l);Se(i.clientX,i.clientY,l)},onNodeDragend(l){if(ae(l)?(document.body.removeEventListener("touchmove",K.onNodeMove),document.body.removeEventListener("touchend",K.onNodeDragend),document.body.removeEventListener("mousemove",K.onNodeMove),document.body.removeEventListener("mouseup",K.onNodeDragend)):(document.body.removeEventListener("mousemove",K.onNodeMove),document.body.removeEventListener("mouseup",K.onNodeDragend)),Me){const i=Ie(l),e=i.clientX,t=i.clientY,n=e-ie.x,o=t-ie.y;Me(n,o,l)}}},le=K,de=(l,i)=>{if(l.from===void 0)throw console.log("error,line must has option[from](nodeId):",l),new Error("error,line must has option[from]:");if(l.to===void 0)throw console.log("error,line must has option[to](nodeId):",l),new Error("error,line must has option[to]:");if(typeof l.from!="string")throw console.log("error line from, must be string(nodeId):",l),new TypeError("error line from, must be string:");if(typeof l.to!="string")throw console.log("error line to, must be string(nodeId):",l),new TypeError("error line to, must be string:");return l.hidden===void 0&&l.isShow!==void 0&&(l.hidden=!l.isShow,console.warn("[relation-graph Warning] line option[isShow] is deprecated, please use [hidden] instead.")),l.hidden===void 0&&l.isHide!==void 0&&(l.hidden=l.isHide,console.warn("[relation-graph Warning] line option[isHide] is deprecated, please use [hidden] instead.")),{id:l.id,from:l.from,to:l.to,type:l.type!==void 0?l.type:"",isFakeLine:l.isFakeLine!==void 0?l.isFakeLine:!1,fromType:l.fromType!==void 0?l.fromType:l.isFakeLine?D.CanvasPoint:D.Node,toType:l.toType!==void 0?l.toType:l.isFakeLine?D.CanvasPoint:D.Node,selected:!1,text:l.text!==void 0?l.text:"",textOffsetX:l.textOffsetX!==void 0?l.textOffsetX:void 0,textOffsetY:l.textOffsetY!==void 0?l.textOffsetY:void 0,color:l.color!==void 0?l.color:void 0,opacity:l.opacity!==void 0?l.opacity:void 0,fontSize:l.fontSize!==void 0?l.fontSize:void 0,fontColor:l.fontColor!==void 0?l.fontColor:void 0,lineWidth:l.lineWidth!==void 0?l.lineWidth:void 0,lineShape:l.lineShape||i.defaultLineShape||1,className:l.className!==void 0?l.className:void 0,animation:l.animation!==void 0?l.animation:0,dashType:l.dashType!==void 0?l.dashType:0,disablePointEvent:l.disablePointEvent!==void 0?l.disablePointEvent:!1,showStartArrow:l.showStartArrow!==void 0?l.showStartArrow:!1,showEndArrow:l.showEndArrow!==void 0?l.showEndArrow:!0,useTextOnPath:l.useTextOnPath!==void 0?l.useTextOnPath:void 0,placeText:l.placeText!==void 0?l.placeText:void 0,startMarkerId:l.startMarkerId||"",endMarkerId:l.endMarkerId||"",textAnchor:l.textAnchor!==void 0?l.textAnchor:void 0,junctionOffset:l.junctionOffset,fromJunctionPoint:l.fromJunctionPoint,toJunctionPoint:l.toJunctionPoint,fromJunctionPointOffsetX:l.fromJunctionPointOffsetX||0,fromJunctionPointOffsetY:l.fromJunctionPointOffsetY||0,toJunctionPointOffsetX:l.toJunctionPointOffsetX||0,toJunctionPointOffsetY:l.toJunctionPointOffsetY||0,lineRadius:l.lineRadius,force_elastic:l.force_elastic,polyLineStartDistance:l.polyLineStartDistance,ctrlPointsFor49:l.ctrlPointsFor49,ctrlPointsFor44:l.ctrlPointsFor44,ctrlPoints:l.ctrlPoints,lineDirection:l.lineDirection!==void 0?l.lineDirection:void 0,forDisplayOnly:l.forDisplayOnly||l.from===l.to,hidden:l.hidden!==void 0?l.hidden:!1,cssVars:l.cssVars!==void 0?l.cssVars:void 0,data:l.data!==void 0?l.data:{}}},Tn=["arrow","isReverse","selected","shouldRender","rgCalcedVisibility"],ye=l=>{if(!l)return;const i={};return Object.keys(l).forEach(e=>{if(!Tn.includes(e)){const t=l[e];t!==void 0&&(e==="isFakeLine"&&t===!1||e==="fromType"&&t===D.Node||e==="toType"&&t===D.Node||e==="animation"&&t===0||e==="text"&&t===""||e==="dashType"&&t===0||e==="disablePointEvent"&&t===!1||e==="showStartArrow"&&t===!1||e==="showEndArrow"&&t===!0||e==="startMarkerId"&&t===""||e==="endMarkerId"&&t===""||e==="forDisplayOnly"&&t===!1||e==="fromJunctionPointOffsetX"&&t===0||e==="fromJunctionPointOffsetY"&&t===0||e==="toJunctionPointOffsetX"&&t===0||e==="toJunctionPointOffsetY"&&t===0||e==="opacity"&&t===1||e==="hidden"&&t===!1||e==="data"&&(!t||Object.keys(t).length===0)||(i[e]=l[e]))}}),i},Xe=l=>{if(!!l)return ye(l.line)},Rn={json2Line:de,transLinkToJson:Xe},Sn=Object.freeze(Object.defineProperty({__proto__:null,json2Line:de,transLineToJson:ye,transLinkToJson:Xe,default:Rn},Symbol.toStringTag,{value:"Module"}));function Mn(l,i,e,t,n,o,s,a,d){const h=n-l,c=o-i,u=Math.sqrt(h*h+c*c);if(u===0)return{x:l,y:i};const p=d*c/u,m=-(d*h)/u,f=l+p,g=i+m,y=l-e/2,v=l+e/2,x=i-t/2,L=i+t/2;let N=[];if(h!==0){let b=(y-f)/h,k=g+b*c;k>=x&&k<=L&&N.push({x:y,y:k});let P=(v-f)/h,S=g+P*c;S>=x&&S<=L&&N.push({x:v,y:S})}if(c!==0){let b=(x-g)/c,k=f+b*h;k>=y&&k<=v&&N.push({x:k,y:x});let P=(L-g)/c,S=f+P*h;S>=y&&S<=v&&N.push({x:S,y:L})}if(N.length===0&&h===0&&c===0)return{x:f,y:g};let T=null,O=1/0;return N.forEach(b=>{const k=Math.sqrt((b.x-n)**2+(b.y-o)**2);k<O&&(O=k,T=b)}),T}const In={getRectPoint(l,i,e,t,n,o,s,a,d=!1,h=1,c=0,u=14,p=!1){const m=l+n/2,f=i+o/2,g=e+s/2,y=t+a/2;if(h>1){const P=Math.min(u,n,o),S=-P/2,R=P/(h-1),M=d&&p||!d&&!p?S*-1-c*R:S+c*R,w=Mn(m,f,n,o,g,y,s,a,M);if(w)return w}const v=m<g?1:-1,x=f<y?1:-1;if(y===f)return{x:m+v*n/2,y:f};const L=Math.abs((g-m)/(y-f)),N=n/o;let T=0,O=0;L<N?(T=v*o/2*L,O=x*o/2):(T=v*n/2,O=x*n/2/L);const b=m+T,k=f+O;return{x:b,y:k}},getRectPointBasic(l,i,e,t,n,o,s,a){const d=l+n/2,h=i+o/2,c=e+s/2,u=t+a/2;let p=u===h?0:(c-d)/(u-h);p===0&&u===h&&c===d?p=1:p===0&&(p=(c-d)/(u-h+(u>h?-1:1)*1e-4));const m=n/o;let f=0,g=0,y="1";return Math.abs(p)<m?(y="2",h<=u?(g=o/2,f=g*p):(g=-o/2,f=g*p)):(y="3",d<=c?(f=n/2,g=p===0&&c===d?0:f/p):(f=-n/2,g=p===0&&c===d?0:f/p)),{x:d+f,y:h+g,_case:y}},getRectJoinPoint(l){const{from_x:i,from_y:e,to_x:t,to_y:n,f_W:o,f_H:s,t_W:a,t_H:d}=l,h=i+o/2,c=e+s/2,u=t+a/2,p=n+d/2,m=u-h,f=p-c,g=m/(o/2),y=f/(s/2);return Math.abs(g)>Math.abs(y)?g>0?{x:i+o,y:c}:{x:i,y:c}:y>0?{x:h,y:e+s}:{x:h,y:e}},getRectHJoinPoint(l){const{from_x:i,from_y:e,to_x:t,f_W:n,f_H:o,t_W:s}=l,a=o/2;return i+n<t?{x:i+n,y:e+a}:{x:i,y:e+a}},getRectLeftJoinPoint(l){const{from_x:i,from_y:e,f_H:t}=l;return{x:i,y:e+t/2}},getRectRightJoinPoint(l){const{from_x:i,from_y:e,f_W:t,f_H:n}=l;return{x:i+t,y:e+n/2}},getRectTopJoinPoint(l){const{from_x:i,from_y:e,f_W:t}=l;return{x:i+t/2,y:e}},getRectBottomJoinPoint(l){const{from_x:i,from_y:e,f_W:t,f_H:n}=l;return{x:i+t/2,y:e+n}},getRectHorizontalLineJoinPoint(l){return this.getRectVJoinPoint(l)},getRectVerticalLineLineJoinPoint(l){return this.getRectHJoinPoint(l)},getRectVJoinPoint(l){const{from_x:i,from_y:e,to_y:t,f_W:n,f_H:o,t_H:s}=l,a=n/2;return e+o<t?{y:e+o,x:i+a}:{y:e,x:i+a}},getBorderPoint(l,i,e,t,n,o,s,a,d){return d===0?this.getCirclePoint(l,i,e,t,n,o,s,a):this.getRectPoint(l,i,e,t,n,o,s,a)},getBorderPoint4MultiLine(l){const{from_x:i,from_y:e,to_x:t,to_y:n,f_W:o,f_H:s,t_W:a,t_H:d,nodeShape:h,isReverse:c=!1,isEndPoint:u,totalLinesBetweenNodes:p=1,currentLineIndex:m=0,lineDistance:f=50}=l;return h===0?this.getCirclePoint4MultiLine(i,e,t,n,o,s,a,d,c,p,m,f,u):this.getRectPoint(i,e,t,n,o,s,a,d,c,p,m,f,u)},getCirclePoint(l,i,e,t,n,o,s,a){const d=e+s/2,h=t+a/2,c=l+n/2,u=i+o/2,p=d-c;if(p===0)return{x:c,y:u-o/2*(h<u?1:-1)};const f=(h-u)/p,g=Math.sqrt(1/(1/(n/2)**2+f**2/(o/2)**2))*(d<c?1:-1),y=f*g;return{x:c-g,y:u-y}},getCirclePoint4MultiLine(l,i,e,t,n,o,s,a,d,h,c,u,p){let m=e+s/2;const f=t+a/2;let g=l+n/2;const y=i+o/2;let v=m-g;v>-1&&v<1&&(m=m-.5,g=g+.5,v=-1);let L=0;if(h>1){const M=Math.min(u,n,o),w=-M/2,I=M/(h-1);L=d&&p||!d&&!p?w*-1-c*I:w+c*I}const N=f-y,T=Math.sqrt(v**2+N**2)*L/v,O=N/v,b=n/2,k=o/2,P=g<m?-1:1,S=(-1*b**2*O*T+b*k*Math.sqrt(Math.abs(k**2+O**2*b**2-T**2))/P)/(k**2+b**2*O**2),R=O*S+T;return{x:g-S,y:y-R}},getCirclePointBasic(l,i,e,t,n,o,s,a,d){const h=l+n/2,c=i+o/2,u=e+s/2,p=t+a/2,m=u-h,f=p-c,g=Math.sqrt(m*m+f*f),y=g-d,v=y*m/g*-1,x=y*f/g*-1;return{x:u+v,y:p+x}},getCirclePointPlus(l,i,e,t,n,o,s,a){const d=l+n/2,h=i+o/2,c=e+s/2,u=t+a/2,p=c-d,m=u-h,f=Math.sqrt(p*p+m*m),g=(f-n/2)*p/f*-1,y=(f-o/2)*m/f*-1;return{x:c+g,y:u+y}},getOvalPoint(l,i,e,t,n,o=180){const s=t*(360/n),a=(180-o+s)*Math.PI/180;return{x:l+e*Math.sin(a),y:i+e*Math.cos(a)*-1}},getRotatedPoint(l,i,e,t,n){const o=n*Math.PI/180,s=Math.cos(o),a=Math.sin(o),d=(l-e)*s-(i-t)*a+e,h=(l-e)*a+(i-t)*s+t;return{x:d,y:h}},getFlippedX(l,i){return i-(l-i)},getFlippedY(l,i){return i-(l-i)},getAngleType(l,i){if(l>=0&&i>=0)return 1;if(l<0&&i>=0)return 2;if(l<0&&i<0)return 3;if(l>=0&&i<0)return 4},getTextAngle(l,i,e,t){let n=Math.atan2(t-i,e-l)*180/Math.PI;return n<0&&(n+=360),n>90&&n<=270&&(n+=180),n>=360&&(n-=360),Math.round(n)}},ue=(l,i,e,t)=>{const n=l-e,o=i-t;return Math.sqrt(n**2+o**2)};function He(l,i,e,t,n=0,o=0){let s=1,a=n,d=o,h=0;for(let c of e){const u=c.width,p=c.height;p>h&&(h=p),t(c,a,d),a+=u+i,s>l?(d+=h+i,s=1,a=0,h=0):s++}}const J=In;class En{constructor(i){_(this,"graphInstance");_(this,"initialized",!1);_(this,"isFolderLayout",!1);this.graphInstance=i}analyzeNetwork(i,e,t=!1,n=!1){this.initialized||(this.initialized=!0),i.forEach(f=>{f.lot||(f.lot={}),f.lot.eached=!1,f.lot.index_of_level=0,f.lot.index_of_p_childs=0,f.lot.index_of_parent=0,f.lot.strength=0,f.lot.strengthWithChilds_from=0,f.lot.strengthWithChilds=0,f.lot.childrenSizeVisible=0,f.lot.childrenSize=0,f.lot.childs=[],f.lot.subling=void 0,f.lot.parent=void 0}),e.lot.parent=void 0;const o=this.markNodeParent(e);C("groupNodes:marked-tree-node:",o.networkNodes.length);const s=[],a={direct:1,min_deep:0,max_deep:0,max_length:1,max_strength:1,levels:new Map},d={direct:-1,min_deep:0,max_deep:0,max_length:1,max_strength:1,levels:new Map},h=[e];this.expandLevelNodesWithDirection(s,h,0,t,n,a,d),this.calcStrengthWithChildsValue(s),this.calcStrengthFromValue(e,1),t&&this.calcStrengthFromValue(e,-1);const c=s.filter(f=>f.lot.level===1),u=c.length===0?1:c.map(f=>f.lot.strengthWithChilds).reduce((f,g)=>f+g,0);a.max_strength=u;const p=s.filter(f=>f.lot.level>=0);C("groupNodes:tree-nodes:",p.length,a);const m={tree:{networkNodes:p,analyticResult:a},reverseTree:{networkNodes:[],analyticResult:d}};if(t){const f=s.filter(v=>v.lot.level===-1),g=f.length===0?1:f.map(v=>v.lot.strengthWithChilds).reduce((v,x)=>v+x,0);d.max_strength=g;const y=s.filter(v=>v.lot.level<=0);C("groupNodes:reverse-tree-nodes:",y.length,d),m.reverseTree.networkNodes=y}for(const f of i)this.graphInstance.updateNode(f,{rgChildrenSize:f.lot.childrenSize});return m}markNodeParent(i){let e=[];return this._markNodeParent(e,[i],0),{networkNodes:e}}_markNodeParent(i,e,t){t===0&&e.forEach(o=>{o.lot.parent=void 0});const n=[];for(const o of e){i.includes(o)||i.push(o);for(const s of this.graphInstance.getNodeRelatedNodes(o))i.includes(s)||(i.push(s),s.lot.parent=o,n.push(s))}n.length>0&&this._markNodeParent(i,n,t+1)}expandLevelNodesWithDirection(i,e,t,n,o,s,a){const d=n&&t<0?a:s;C(`bothWay:${n}(deep:${o}) level ${t} size: ${e.length}`,d.direct),e.length>d.max_length&&(d.max_length=e.length),t>d.max_deep&&(d.max_deep=t),t<d.min_deep&&(d.min_deep=t),d.levels.has(t)||d.levels.set(t,{level:t,all_size:e.length,all_strength:0});const h=d.levels.get(t);e.forEach(f=>{f.lot.eached=!0,f.lot.subling=h,f.lot.level=t,i.push(f)});const c=[],u=[];let p=1,m=0;e.forEach(f=>{let g=[],y=[];n?o||t===0?(g=this.graphInstance.getNodeIncomingNodes(f),y=this.graphInstance.getNodeOutgoingNodes(f)):(t<0&&(p=-1),y=this.graphInstance.getNodeRelatedNodes(f)):y=this.graphInstance.getNodeRelatedNodes(f),this._appendNodeChildrenToNextLevelNodes(f,y,u,h,n,1),this._appendNodeChildrenToNextLevelNodes(f,g,c,h,n,-1),f.lot.index_of_level=m,m++}),h.all_strength>d.max_strength&&(d.max_strength=h.all_strength),u.length>0&&this.expandLevelNodesWithDirection(i,u,t+p,n,o,s,a),c.length>0&&this.expandLevelNodesWithDirection(i,c,t-1,n,o,s,a)}_appendNodeChildrenToNextLevelNodes(i,e,t,n,o,s){let a=0,d=0,h=0;if(e.forEach(c=>{c.lot||(c.lot={eached:!1,childs:[]}),c.lot.eached||(d++,c.lot.parent=i,B.isVisibleNode(c)&&(c.lot.eached=!0,c.lot.index_of_parent=h++,t.push(c),a++),i.lot.childs.push(c))}),s===1){const c=a>0?a:1;i.lot.strength=c,n.all_strength+=c,i.lot.strength_of_level=n.all_strength,i.lot.childrenSizeVisible=a,i.lot.childrenSize=d}}calcStrengthWithChildsValue(i){this.isFolderLayout?i.forEach(e=>{e.lot.strengthWithChilds=1,this.conductStrengthToParents(e)}):(i.forEach(e=>{e.lot.childrenSizeVisible>0&&(e.lot.strengthWithChilds=0)}),i.forEach(e=>{e.lot.childrenSizeVisible===0&&(e.lot.strengthWithChilds=1,this.conductStrengthToParents(e))}))}calcStrengthFromValue(i,e=1){this._calcStrengthFromValue([i],0,e===-1?-1:1)}_calcStrengthFromValue(i,e,t=1){const n=[];let o=0;i.forEach(s=>{if(s.lot.level===0||t===(s.lot.level<0?-1:1)){s.lot.childs.forEach(d=>{n.push(d)}),s.lot.parent&&o<s.lot.parent.lot.strengthWithChilds_from&&(o=s.lot.parent.lot.strengthWithChilds_from);const a=this.isFolderLayout?1:0;s.lot.strengthWithChilds_from=o+a,o+=s.lot.strengthWithChilds}}),n.length>0&&this._calcStrengthFromValue(n,e+(t<0?-1:1),t)}conductStrengthToParents(i){if(i.lot.parent){const e=Math.abs(i.lot.level)-1===Math.abs(i.lot.parent.lot.level);(this.isFolderLayout||e)&&(i.lot.parent.lot.strengthWithChilds+=1,this.conductStrengthToParents(i.lot.parent))}}}class Dn{constructor(i,e,t){_(this,"graphOptions");_(this,"layoutOptions");_(this,"graphInstance");_(this,"networkAnalyzer");_(this,"allNodes",[]);_(this,"isMainLayouer",!0);_(this,"requireLinks",!1);_(this,"allLinks",[]);_(this,"rootNode");this.layoutOptions=i,this.graphOptions=e,this.graphInstance=t,this.networkAnalyzer=new En(t)}setLinks(i){C("setLinks:",i.length),this.allLinks=i}generateCalcNodes(i){const e=[],t=new Map;for(const n of i){const o={rgNode:n,x:n.x,y:n.y,width:n.width||n.el_W||50,height:n.height||n.el_H||50};e.push(o),t.set(n.id,o)}return{calcNodes:e,calcNodeMap:t}}generateLevels(i){const e=[],t=new Map;for(const n of i){if(!n.lot||typeof n.lot.level!="number")continue;const o=n.lot.level;e.includes(o)||(e.push(o),t.set(o,[])),t.get(o).push(n)}return e.sort((n,o)=>n-o),{levels:e,levelNodesMap:t}}adjustNodePositions(i,e,t){if(!i||i.length===0)return[];for(let n=1;n<i.length;n++){const o=i[n],s=i[n-1];switch(e){case"right":o.x<s.x+s.width+t&&(o.x=s.x+s.width+t);break;case"left":o.x+o.width>s.x-t&&(o.x=s.x-o.width-t);break;case"bottom":o.y<s.y+s.height+t&&(o.y=s.y+s.height+t);break;case"top":o.y+o.height>s.y-t&&(o.y=s.y-o.height-t);break}}return i}getReverseAlignItems(i){return Vn[i]}updateNodePosition(i,e,t){this.graphInstance.updateNode(typeof i=="string"?i:i.id,{x:e,y:t})}layoutEnd(){this.graphInstance&&(this.graphInstance.dataProvider.updateShouldRenderGraphData(),this.graphInstance._dataUpdated())}}const Vn={start:"end",end:"start",center:"center"},ce=Dn;class Bn extends ce{constructor(e,t,n){super(e,t,n);_(this,"layoutOptions");_(this,"fastStart",!1);_(this,"skipInitLayout",!1);_(this,"maxLayoutTimes",300);_(this,"byNode",!0);_(this,"byLine",!0);_(this,"lockX",!1);_(this,"lockY",!1);_(this,"force_node_repulsion",1);_(this,"force_line_elastic",1);_(this,"disableLiveChanges",!1);_(this,"force_x_coefficient",1);_(this,"force_y_coefficient",1);_(this,"instanceId","");_(this,"calcNodes",[]);_(this,"_graphEventHandler");_(this,"layoutTimes",0);_(this,"prev10",[]);_(this,"visibleNodes",[]);_(this,"_onFinishCallback");_(this,"_onTickCallback");_(this,"calcNodeMap",new WeakMap);_(this,"forCalcNodes",[]);_(this,"recentGraphVelocity",[]);_(this,"graphVelocityBalancedValue",.1);_(this,"prevLogTime",0);_(this,"animationFrameTimer",0);_(this,"prevNodeLevel1Index",0);_(this,"prevNodeLevel2Index",0);_(this,"stoped",!1);_(this,"maxTractionLength",400);_(this,"zeroForceLength",40);_(this,"maxRepulsionDistance",600);_(this,"nodeCollisionRadius",40);_(this,"maxMoveSpeed",100);_(this,"n2nMaxForce",50);this.layoutOptions=e,this.updateOptions(e),this.requireLinks=!0,this.instanceId=n?n.generateNewUUID(5):"error-id"}updateOptions(e){e.fastStart!==void 0&&(this.fastStart=e.fastStart),e.maxLayoutTimes!==void 0&&(this.maxLayoutTimes=e.maxLayoutTimes),e.byNode!==void 0&&(this.byNode=e.byNode),e.byLine!==void 0&&(this.byLine=e.byLine),e.force_node_repulsion!==void 0&&(this.force_node_repulsion=e.force_node_repulsion),e.force_line_elastic!==void 0&&(this.force_line_elastic=e.force_line_elastic),e.force_x_coefficient!==void 0&&(this.force_x_coefficient=e.force_x_coefficient),e.force_y_coefficient!==void 0&&(this.force_y_coefficient=e.force_y_coefficient),e.disableLiveChanges!==void 0&&(this.disableLiveChanges=e.disableLiveChanges),e.skipInitLayout!==void 0&&(this.skipInitLayout=e.skipInitLayout),e.maxTractionLength!==void 0&&(this.maxTractionLength=e.maxTractionLength),e.zeroForceLength!==void 0&&(this.zeroForceLength=e.zeroForceLength),e.maxRepulsionDistance!==void 0&&(this.maxRepulsionDistance=e.maxRepulsionDistance),e.nodeCollisionRadius!==void 0&&(this.nodeCollisionRadius=e.nodeCollisionRadius)}placeNodes(e,t){if(C("RGForceLayout["+this.instanceId+"].placeNodes"),this.calcNodes=e,this.allNodes.length===0&&(this.allNodes=e),this.rootNode=t,this.fastStart)C("RGForceLayout["+this.instanceId+"] fastStart"),this.calcNodes.forEach(n=>{if(n.fixed===!0)return;let o=n.x,s=n.y,a=!1;(Number.isNaN(o)||o===void 0)&&(o=Math.floor(Math.random()*200)-100,a=!0),(Number.isNaN(s)||s===void 0)&&(s=Math.floor(Math.random()*200)-100,a=!0),o===0&&s===0&&(o=Math.floor(Math.random()*200)-100,s=Math.floor(Math.random()*200)-100,a=!0),a&&this.updateNodePosition(n,o,s)});else if(!this.skipInitLayout){if(C("!!!initNodesPosition....."),t){C("layout by root:",t),(Number.isNaN(t.x)||t.x===void 0)&&this.updateNodePosition(t,0,0);const{tree:n}=this.networkAnalyzer.analyzeNetwork(e,t),{networkNodes:o,analyticResult:s}=n;t.fixed||this.layoutOptions.fixedRootNode||this.updateNodePosition(t,0,0);const a=B.getNodeLotXY({alignItemsX:"center",alignItemsY:"center"},t);t.lot.x=a.x,t.lot.y=a.y,this.placeRelativePosition(t,o,s,1,[]),C("!!!initNodesPosition fixedRootNode:2:",t.x,t.y),o.forEach(d=>{if(d.fixed===!0||!d.rgCalcedVisibility||d===t)return;const h=d.lot.x-B.getNodeWidth(d)/2,c=d.lot.y-B.getNodeHeight(d)/2;this.updateNodePosition(d,h,c)})}}this.allNodes.forEach(n=>{let o=n.x,s=n.y,a=!1;(Number.isNaN(o)||o===void 0)&&(o=0,a=!0),(Number.isNaN(s)||s===void 0)&&(s=0,a=!0),a&&this.updateNodePosition(n,o,s)}),C("["+this.instanceId+"]Start Auto Layout....."),this.start()}getLevelR(e,t){if(e.length===0)return;let n=0;for(let o=0;o<t;o++)n+=e[o]||e[e.length-1];return n}placeRelativePosition(e,t,n,o,s){C("analyticResult:",this.layoutOptions,n,o,s);const a={x:e.lot.x,y:e.lot.y},d=t.filter(h=>h.lot.level===1);this.placeNodesInFanRegion(d,0,360,a,1,n.max_strength,s,1,o,0)}calculateMinimumRadius(e,t=0){if(e.length===0||e.length===1)return 0;const n=e.map(c=>{const u=c.width||c.el_W,p=c.height||c.el_H;return Math.sqrt(u*u+p*p)/2+t/2}),o=[];for(let c=0;c<n.length;c++){const u=(c+1)%n.length;o.push(n[c]+n[u])}let s=Math.max(...o)/2,a=o.reduce((c,u)=>c+u,0);const d=100;let h=a;for(let c=0;c<d;c++){const u=(s+a)/2;let p=0;for(const m of o){const f=m/(2*u);if(f>1){p=10;break}p+=2*Math.asin(f)}p>2*Math.PI?s=u:(a=u,h=u)}return h}placeNodesInFanRegion(e,t,n,o,s,a,d,h,c,u){var y,v;let p=t;const m=n-t,f=200;let g=this.getLevelR(d,s)||u+f*c;s===1&&c===1&&(!this.layoutOptions.levelGaps||this.layoutOptions.levelGaps.length===0)&&(g=this.calculateMinimumRadius(e,10),g=Math.min(Math.max(g,200),500));for(const x of e){const L=((y=x.lot)==null?void 0:y.strengthWithChilds)/a,N=o.x+g,T=o.y,O=L*m,b=p+O/2,k=J.getRotatedPoint(N,T,o.x,o.y,b);x.lot.x=k.x,x.lot.y=k.y,x.lot.childs&&x.lot.childs.length>0&&this.placeNodesInFanRegion(x.lot.childs,p,p+O,o,s+1,(v=x.lot)==null?void 0:v.strengthWithChilds,d,h+1,c,g),p+=O}}graphEventHandle(e,...t){if(e===E.onNodeDragStart){const n=t[0],o=this.calcNodeMap.get(n);o&&(o.dragging=!0)}else if(e===E.onNodeDragging){const n=t[0],o=t[1],s=t[2],a=this.calcNodeMap.get(n);console.log("[force]onNodeDragging:",n.id,a),a&&(a.x=o,a.y=s)}else if(e===E.onNodeDragEnd){const n=t[0],o=this.calcNodeMap.get(n);o&&(o.dragging=!1)}}connectToGraphInstance(){this._graphEventHandler=this.graphEventHandle.bind(this),this.graphInstance&&this.graphInstance.addEventHandler(this._graphEventHandler)}disConnectToGraphInstance(){this.graphInstance&&this.graphInstance.removeEventHandler(this._graphEventHandler)}updateVisibleNodes(e){this.visibleNodes=[],e&&(this.allNodes=e),this.allNodes.forEach(t=>{t.lot||(C("node miss lot:",t.text),t.lot={x:t.x,y:t.y,childs:[]}),this.visibleNodes.push(t)}),this.resetCalcNodes(),C("visibleNodes:",this.visibleNodes.length)}viewUpdate(){this._onTickCallback&&this._onTickCallback(),this.graphInstance&&this.graphInstance.forceLayoutTickCallback()}autoLayout(e=!1){if(this.updateVisibleNodes(),this.isMainLayouer){const t=this.graphInstance.dataProvider.getOptions();this.graphInstance.dataProvider.updateOptions({layout:{...t.layout,autoLayouting:!0}})}this.doForceLayout(0)}onFinish(e){this._onFinishCallback=e}onTick(e){this._onTickCallback=e}applyFBuffToNodes(){for(const e of this.forCalcNodes)this.applyToNodePosition(e)}applyPositionToNodes(){this.visibleNodes.forEach(e=>{if(e.fixed)return;const t=this.calcNodeMap.get(e);t&&(e.x=t.x,e.y=t.y)}),this.viewUpdate()}layoutFinished(){if(cancelAnimationFrame(this.animationFrameTimer),this.isMainLayouer){const e=this.graphInstance.dataProvider.getOptions();this.graphInstance.dataProvider.updateOptions({layout:{...e.layout,autoLayouting:!1}})}console.warn("Force Layout["+this.instanceId+"] finished on:",this.layoutTimes,"of",this.maxLayoutTimes),C("Force Layout["+this.instanceId+"] finished"),this.applyFBuffToNodes(),this.applyPositionToNodes(),this.disConnectToGraphInstance();try{this._onFinishCallback&&this._onFinishCallback()}catch(e){console.error(e)}}resetCalcNodes(){this.forCalcNodes=[],this.calcNodeMap=new WeakMap,this.visibleNodes.forEach(e=>{const t={rgNode:e,Fx:0,Fy:0,x:e.x,y:e.y,dragging:!1,force_weight:e.force_weight||1,forceCenterOffset_X:(e.width||e.el_W||60)/2,forceCenterOffset_Y:(e.height||e.el_H||60)/2,fixed:e.fixed||!1};this.forCalcNodes.push(t),this.calcNodeMap.set(e,t)}),this.allLinks=this.graphInstance.getLinksBetweenNodes(this.visibleNodes)}start(){this.stoped&&this.layoutTimes===0||(this.stoped=!1,this.layoutTimes=0,this.updateVisibleNodes(),this.connectToGraphInstance(),this.autoLayout(!0))}doForceLayout(e){if(this.graphInstance.viewComponentUnmounted){C("["+this.instanceId+"]stop layout:viewComponentUnmounted"),this.layoutFinished();return}let t="0";e>0?(this.prev10.length>=10&&(this.prev10.splice(0,1),t=(1e3/((this.prev10[this.prev10.length-1]-this.prev10[0])/10)).toFixed(1)),this.prev10.push(e)):this.visibleNodes.length===0&&this.updateVisibleNodes(),this.layoutTimes++,this.calcNodesPosition(),this.applyFBuffToNodes(),this.disableLiveChanges||this.layoutTimes%2===0&&this.applyPositionToNodes(),this.layoutTimes<=this.maxLayoutTimes?(Date.now()-this.prevLogTime>3e3&&(C("Force Layout["+this.instanceId+"] Is Working...layoutTimes:",this.layoutTimes,"of",this.maxLayoutTimes,t,"Hz",this.visibleNodes.length),this.prevLogTime=Date.now()),this.animationFrameTimer=requestAnimationFrame(this.doForceLayout.bind(this))):this.layoutFinished()}syncNodePosition(e,t,n){const o=this.allNodes.find(a=>a.id===e),s=this.calcNodeMap.get(o);s&&(s.x=t,s.y=n)}calcNodesPosition(){if(this.byNode)for(let e=this.prevNodeLevel1Index;e<this.forCalcNodes.length;e++){const t=this.forCalcNodes[e];if(!t.dragging&&!t.fixed){for(let n=this.prevNodeLevel2Index;n<this.forCalcNodes.length;n++)if(e!==n){const o=this.forCalcNodes[n];if(o.dragging)continue;this.addGravityByNode(t,o)}}}if(this.byLine){if(this.allLinks&&this.allLinks.length>0){for(const e of this.allLinks)if(!e.line.forDisplayOnly){let t=e.line.force_elastic===void 0?1:e.line.force_elastic;if(this.visibleNodes.includes(e.fromNode)&&this.visibleNodes.includes(e.toNode)){const n=this.calcNodeMap.get(e.fromNode),o=this.calcNodeMap.get(e.toNode);this.addElasticByLine(n,o,t)}}}else for(const e of this.visibleNodes)if(e.lot&&e.lot.parent){const t=this.calcNodeMap.get(e.lot.parent),n=this.calcNodeMap.get(e);this.addElasticByLine(t,n,1)}}return!0}stop(){if(this.stoped=!0,this.layoutTimes===0)return;const e=this.graphInstance.dataProvider.getOptions();cancelAnimationFrame(this.animationFrameTimer),C("[RGForceLayout]["+this.instanceId+"]stop:",e.layout.autoLayouting,this.layoutTimes),this.layoutTimes=Number.MAX_VALUE,this.layoutFinished()}addElasticByLine(e,t,n=1){const o=e.x,s=e.y,a=t.x,d=t.y;let h=Math.sqrt((s-d)**2+(o-a)**2);if(h<this.zeroForceLength)return;h>this.maxTractionLength&&(h=this.maxTractionLength);const c=(h-this.zeroForceLength)*.02*this.force_line_elastic*n,u=c,p=c,m=(o-a)/h,f=(s-d)/h;this.addFtoNode(e,m*u*-1,f*u*-1),this.addFtoNode(t,m*p,f*p)}addGravityByNode(e,t,n=1){const o=e.x,s=e.y,a=t.x,d=t.y;if(n===1&&(Math.abs(o-a)>this.maxRepulsionDistance||Math.abs(s-d)>this.maxRepulsionDistance))return;const h=Math.sqrt((s-d)**2+(o-a)**2);if(n===1&&h>this.maxRepulsionDistance)return;let c=(this.maxRepulsionDistance-h)*.02*this.force_node_repulsion*n;h<this.nodeCollisionRadius&&(c=c*2);const u=(o-a)/h,p=(s-d)/h;this.addFtoNode(e,u*c,p*c)}addFtoNode(e,t,n){if(e.fixed||e.dragging||Number.isNaN(t)||Number.isNaN(n))return;t>this.n2nMaxForce&&(t=this.n2nMaxForce),n>this.n2nMaxForce&&(n=this.n2nMaxForce),t<-this.n2nMaxForce&&(t=-this.n2nMaxForce),n<-this.n2nMaxForce&&(n=-this.n2nMaxForce);const o=e.force_weight||1;this.lockX||(e.Fx+=t*(1/o)),this.lockY||(e.Fy+=n*(1/o))}applyToNodePosition(e){if(e.fixed)return 0;if(e.dragging){const o=e.rgNode;return this.updateNodePosition(o,e.x,e.y),0}if(this.calcNodes!==this.allNodes&&!this.calcNodes.includes(e.rgNode))return 0;let t=e.Fx,n=e.Fy;if(t>this.maxMoveSpeed&&(t=this.maxMoveSpeed),n>this.maxMoveSpeed&&(n=this.maxMoveSpeed),t<-this.maxMoveSpeed&&(t=-this.maxMoveSpeed),n<-this.maxMoveSpeed&&(n=-this.maxMoveSpeed),e.x=e.x+t*this.force_x_coefficient,e.y=e.y+n*this.force_y_coefficient,!this.disableLiveChanges){const o=e.rgNode;this.updateNodePosition(o,e.x,e.y)}e.Fx=0,e.Fy=0}}const be=Bn;class zn extends ce{constructor(e,t,n){super(e,t,n);_(this,"enableGatherNodes",!1);_(this,"layoutOptions");this.layoutOptions=e,C("new RGTreeLayout:",this.layoutOptions),this.layoutOptions.from||(this.layoutOptions.from="left"),this.layoutOptions.levelGaps||(this.layoutOptions.levelGaps=[]);const o=this.layoutOptions.from;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="start"),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.ignoreNodeSize===void 0&&(this.layoutOptions.ignoreNodeSize=!1);const s=this.layoutOptions.layoutExpansionDirection,a=s==="start"||s==="left"||s==="top"?"start":s==="end"||s==="right"||s==="bottom"?"end":"center";this.layoutOptions.layoutExpansionDirection=a,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,this.layoutOptions.rotate||(this.layoutOptions.rotate=0)}placeNodes(e,t){if(console.log("tree:placeNodes:rootNode",t.id,t),C("RGTreeLayout:placeNodes"),t)C("layout by root:",t);else{console.error("root is null");return}C("allNodes:",e.length);const n={alignItemsX:this.layoutOptions.alignItemsX,alignItemsY:this.layoutOptions.alignItemsY},o={alignItemsX:this.layoutOptions.alignParentItemsX,alignItemsY:this.layoutOptions.alignParentItemsY};this.rootNode=t,this.allNodes=e,t.fixed||this.layoutOptions.fixedRootNode||this.updateNodePosition(t,0,0);const s=B.getNodeLotXY(n,t);t.lot.x=s.x,t.lot.y=s.y;const a=e;if(C("groupNodes:2:",a.length,a.map(c=>c.text).join(",")),this.layoutOptions.simpleTree===!0){const{tree:c}=this.networkAnalyzer.analyzeNetwork(a,this.rootNode,!1);this.placeNodesPosition(this.rootNode,c.networkNodes,c.analyticResult)}else{const{tree:c,reverseTree:u}=this.networkAnalyzer.analyzeNetwork(a,this.rootNode,!0);this.placeNodesPosition(this.rootNode,c.networkNodes,c.analyticResult),this.placeNodesPosition(this.rootNode,u.networkNodes,u.analyticResult)}const d=this.layoutOptions.rotate||0;console.log("rotate:",d);const h={x:t.x,y:t.y};this.allNodes.forEach(c=>{if(c.fixed!==!0&&!!B.isVisibleNode(c)&&(Number.isNaN(c.lot.x)&&(C("bad lot x:",c.text,c.lot.x),c.lot.x=0),Number.isNaN(c.lot.y)&&(C("bad lot y:",c.text,c.lot.y),c.lot.y=0),c!==t)){if(d){const f=J.getRotatedPoint(c.lot.x,c.lot.y,h.x,h.y,d);c.lot.x=f.x,c.lot.y=f.y}const u=c.lot.level<0?o:n,p=B.getNodeXByLotX(u,c),m=B.getNodeYByLotY(u,c);this.updateNodePosition(c,p,m)}}),C("create rootNode coordinates:1",t.x,t.y),this.layoutEnd()}placeNodesPosition(e,t,n){this.placeRelativePosition(e,t,n)}placeRelativePosition(e,t,n){const o=this.layoutOptions.layoutExpansionDirection,{levels:s,levelNodesMap:a}=this.generateLevels(t),d=n.max_strength;if(this.layoutOptions.from==="top"||this.layoutOptions.from==="bottom"){const h=this.layoutOptions.treeNodeGapH||20,c=this.layoutOptions.treeNodeGapV||20,u=new Map;for(const y of s){const v=a.get(y);u.set(y,Math.max(...v.map(x=>x.el_H)))}let p=0,m=0;for(const y of t){const v=y.el_W;p+=v,m++}const g=p/m+h;t.forEach(y=>{y.fixed!==!0&&y!==e&&(this.layoutOptions.from==="bottom"?y.lot.y=e.lot.y-this.getLevelDistance(y.lot.level,u,c+10):y.lot.y=e.lot.y+this.getLevelDistance(y.lot.level,u,c+10))}),t.forEach(y=>{y.fixed!==!0&&y.lot.level!==0&&(o==="start"?y.lot.x=e.lot.x-g*y.lot.strengthWithChilds_from:o==="end"?y.lot.x=e.lot.x+g*y.lot.strengthWithChilds_from:y.lot.x=e.lot.x+g*(d/-2+y.lot.strengthWithChilds_from+y.lot.strengthWithChilds/2))}),this.applyNodesGap(t,"v"),this.gatherNodes(t,"v",g)}else{const h=this.layoutOptions.treeNodeGapH||20,c=this.layoutOptions.treeNodeGapV||20;console.log("levelNodesMap:",a);const u=new Map;for(const y of s){const v=a.get(y);u.set(y,Math.max(...v.map(x=>x.el_W||x.width||50)))}let p=0,m=0;for(const y of t){const v=y.el_H;p+=v,m++}if(m===0)return;const g=p/m+c;t.forEach(y=>{y.fixed!==!0&&y!==e&&(this.layoutOptions.from==="right"?y.lot.x=e.lot.x-this.getLevelDistance(y.lot.level,u,h+50):y.lot.x=e.lot.x+this.getLevelDistance(y.lot.level,u,h+50))}),t.forEach(y=>{y.fixed!==!0&&y.lot.level!==0&&(o==="start"?y.lot.y=e.lot.y-g*y.lot.strengthWithChilds_from:o==="end"?y.lot.y=e.lot.y+g*y.lot.strengthWithChilds_from:y.lot.y=e.lot.y+g*(d/-2+y.lot.strengthWithChilds_from+y.lot.strengthWithChilds/2))}),console.log("levelMaxWidthMap:",e.id,u),this.applyNodesGap(t,"h"),this.gatherNodes(t,"h",g)}}getLevelDistance(e,t,n){if(e===0)return 0;if(e>0){let o=0;for(let s=0;s<e;s++){const a=t.get(s);o+=a+this.getLevelGap(s,n,a,e)}return o}else{let o=0;for(let s=0;s>e;s--){const a=t.get(s);o+=a+this.getLevelGap(s,n,a,e)}return-o}}getLevelGap(e,t,n,o){let s=t+(o===-1&&e===0?n/2:0);if(this.layoutOptions.levelGaps.length>0){const a=this.layoutOptions.levelGaps[Math.abs(e)];a&&(s=a)}return s}applyNodesGap(e,t){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:a,levelNodesMap:d}=this.generateLevels(e),h=new Map;for(const p of a){const m=d.get(p);h.set(p,Math.max(...m.map(f=>f.el_W)))}const{calcNodes:c,calcNodeMap:u}=this.generateCalcNodes(e);c.forEach(p=>{const m=p.rgNode.lot.level<0?o:n;p.x=B.getNodeXByLotX(m,p.rgNode),p.y=B.getNodeYByLotY(m,p.rgNode),p.width=p.rgNode.el_W,p.height=p.rgNode.el_H,p.buffY=0});for(const p of a){const m=d.get(p)||[];if(t==="h")if(s==="end"){m.sort((g,y)=>g.lot.y-y.lot.y);const f=m.map(g=>u.get(g.id));this.adjustNodePositions(f,"bottom",this.layoutOptions.treeNodeGapV);for(const g of f){const y=g.rgNode.lot.level<0?o:n;g.rgNode.lot.y=B.getNodeLotXY(y,g).y}}else{m.sort((g,y)=>y.lot.y-g.lot.y);const f=m.map(g=>u.get(g.id));this.adjustNodePositions(f,"top",this.layoutOptions.treeNodeGapV);for(const g of f){const y=g.rgNode.lot.level<0?o:n;g.rgNode.lot.y=B.getNodeLotXY(y,g).y}}else if(s==="end"){m.sort((g,y)=>g.lot.x-y.lot.x);const f=m.map(g=>u.get(g.id));this.adjustNodePositions(f,"right",this.layoutOptions.treeNodeGapH);for(const g of f){const y=g.rgNode.lot.level<0?o:n,v=B.getNodeLotXY(y,g);g.rgNode.lot.x=v.x}}else{m.sort((g,y)=>y.lot.x-g.lot.x);const f=m.map(g=>u.get(g.id));this.adjustNodePositions(f,"left",this.layoutOptions.treeNodeGapH);for(const g of f){const y=g.rgNode.lot.level<0?o:n;g.rgNode.lot.x=B.getNodeLotXY(y,g).x}}console.log("levelNodes:",p,m)}if(t==="h"){const p=new Map,m=new Map;for(const L of a){const T=d.get(L).map(O=>u.get(O.id));p.set(L,Math.max(...T.map(O=>O.width))),m.set(L,Math.min(...T.map(O=>O.x)))}const f=this.layoutOptions.treeNodeGapH;let g=a.filter(L=>L>0).sort((L,N)=>L-N),y=a.filter(L=>L<0).sort((L,N)=>N-L),v=1;this.layoutOptions.from==="right"&&([y,g]=[g,y],v=-1);let x=0;for(const L of g){const N=L-v,T=m.get(N),O=p.get(N),b=m.get(L)+x;p.get(L);const k=T+O+f;if(k>b){const P=k-b;console.log("[xxxxx]move",N,L,k,b,P),x=P;const S=d.get(L);for(const R of S)R.lot.x+=x;m.set(L,b+P)}else m.set(L,b)}x=0;for(const L of y){const N=L+v,T=m.get(N);p.get(N);const O=m.get(L)+x,b=p.get(L),k=T-f;if(O+b>k){const P=k-(O+b);x=P;const S=d.get(L);for(const R of S)R.lot.x+=x;m.set(L,O+P)}else m.set(L,O)}}else{const p=new Map,m=new Map;for(const L of a){const T=d.get(L).map(O=>u.get(O.id));p.set(L,Math.max(...T.map(O=>O.height))),m.set(L,Math.min(...T.map(O=>O.y)))}const f=this.layoutOptions.treeNodeGapV;let g=a.filter(L=>L>0).sort((L,N)=>L-N),y=a.filter(L=>L<0).sort((L,N)=>N-L),v=1;this.layoutOptions.from==="bottom"&&([y,g]=[g,y],v=-1);let x=0;for(const L of g){const N=L-v,T=m.get(N),O=p.get(N),b=m.get(L)+x;p.get(L);const k=T+O+f;if(k>b){const P=k-b;console.log("[xxxxx]move",N,L,k,b,P),x=P;const S=d.get(L);for(const R of S)R.lot.y+=x;m.set(L,b+P)}else m.set(L,b)}x=0;for(const L of y){const N=L+v,T=m.get(N);p.get(N);const O=m.get(L)+x,b=p.get(L),k=T-f;if(O+b>k){const P=k-(O+b);x=P;const S=d.get(L);for(const R of S)R.lot.y+=x;m.set(L,O+P)}else m.set(L,O)}}}gatherNodes(e,t,n){if(!this.enableGatherNodes)return;const{calcNodes:o,calcNodeMap:s}=this.generateCalcNodes(e);o.forEach(d=>{d.movedNodeSizeBefore=1,d.movedNodeSizeAfter=1});const{levelNodesMap:a}=this.generateLevels(e);e.forEach(d=>{if(d.fixed!==!0&&d.lot.level!==0){const h=a.get(d.lot.level)||[];if(d.lot.strengthWithChilds===1&&d.lot.childrenSizeVisible<=1){const c=this.getBloomingNearByParent(d,d.lot.parent,h,t);if(c){const u=s.get(d.id);t==="h"?d.lot.y-c.lot.y>0?(d.lot.y=c.lot.y+n*u.movedNodeSizeAfter,u.movedNodeSizeAfter++):(d.lot.y=c.lot.y-n*u.movedNodeSizeBefore,u.movedNodeSizeBefore++):d.lot.x-c.lot.x>0?(d.lot.x=c.lot.x+n*u.movedNodeSizeAfter,u.movedNodeSizeAfter++):(d.lot.x=c.lot.x-n*u.movedNodeSizeBefore,u.movedNodeSizeBefore++)}}}})}getBloomingNearByParent(e,t,n,o){let s=9999,a;for(const d of n)if(d.lot.childrenSizeVisible>1&&d.lot.parent===t){const h=o==="h"?d.lot.y-t.lot.y:d.lot.x-t.lot.x;Math.abs(h)<s&&(s=Math.abs(h),a=d)}if(a&&a!==e)return a}}const ct=zn;class An extends be{constructor(e,t,n){super(e,t,n);_(this,"layoutOptions");this.layoutOptions=e,this.layoutOptions.distanceCoefficient||(this.layoutOptions.distanceCoefficient=1),this.layoutOptions.levelGaps||(this.layoutOptions.levelGaps=[]),this.layoutOptions.levelDistance&&console.error("Error: levelDistance is not support\uFF0C Please use levelGaps option in layoutOptions")}placeNodes(e,t){if(C("RGCenterLayout:placeNodes"),!t){C("root is null:",t);return}C("layout by root:",t),this.allNodes=e,this.calcNodes=e,this.rootNode=t;const{tree:n}=this.networkAnalyzer.analyzeNetwork(e,this.rootNode),{networkNodes:o,analyticResult:s}=n;if(this.layoutOptions.genLotInfoOnly){C("only gen lot info, return");return}t.fixed||this.layoutOptions.fixedRootNode||this.updateNodePosition(t,0,0);const a={alignItemsX:this.layoutOptions.alignItemsX||"center",alignItemsY:this.layoutOptions.alignItemsY||"center"},d=B.getNodeLotXY(a,t);t.lot.x=d.x,t.lot.y=d.y;const h=this.layoutOptions.rotate||0;C("root position:",t.lot.x,t.lot.y);const c=this.layoutOptions.distanceCoefficient||1,u=this.getLevelDistanceArr();this.placeRelativePosition(this.rootNode,o,s,c,u);const p={x:t.x,y:t.y};o.forEach(m=>{if(m.fixed!==!0&&!!m.rgCalcedVisibility&&m!==t){if(h){const v=J.getRotatedPoint(m.lot.x,m.lot.y,p.x,p.y,h);m.lot.x=v.x,m.lot.y=v.y}const f=a,g=B.getNodeXByLotX(f,m),y=B.getNodeYByLotY(f,m);this.updateNodePosition(m,g,y)}}),this.layoutEnd()}getLevelDistanceArr(){let e=[];if(this.layoutOptions.levelGaps){if(Array.isArray(this.layoutOptions.levelGaps))e=this.layoutOptions.levelGaps;else return console.error("Error levelDistance, levelDistance must is Array"),new Array(10).fill(200);if(e.length>0&&e.length<10)for(let t=e.length;t<10;t++)e.push(e[e.length-1])}return e}}const ht=An;class Xn extends be{constructor(i,e,t){super(i,e,t)}placeNodes(i,e){if(e)C("layout by root:",e);else{C("root is null:",e);return}this.allNodes=i,this.rootNode=e,e.fixed||this.layoutOptions.fixedRootNode||this.updateNodePosition(e,0,0);const t={alignItemsX:this.layoutOptions.alignItemsX||"center",alignItemsY:this.layoutOptions.alignItemsY||"center"},n=this.layoutOptions.rotate||0,o=B.getNodeLotXY(t,e);e.lot.x=o.x,e.lot.y=o.y;const s=this.allNodes.filter(h=>h.rgCalcedVisibility),a=s.length;let d=a*90/Math.PI/2;d<200&&(d=200),d>800&&(d=800),s.forEach((h,c)=>{const u=J.getOvalPoint(o.x,o.y,d,c,a);h.lot.x=u.x,h.lot.y=u.y,console.log("xxxxxxxxxxxxxx:",h.id,h.lot.x,h.lot.y)}),s.forEach(h=>{if(h.fixed===!0||!h.rgCalcedVisibility)return;if(n){const m=J.getRotatedPoint(h.lot.x,h.lot.y,e.lot.x,e.lot.y,n);h.lot.x=m.x,h.lot.y=m.y}const c=t,u=B.getNodeXByLotX(c,h),p=B.getNodeYByLotY(c,h);this.updateNodePosition(h,u,p)}),this.layoutEnd()}}const ut=Xn;class Gn extends ce{constructor(e,t,n){super(e,t,n);_(this,"graphOptions");_(this,"layoutOptions");_(this,"allNodes",[]);this.layoutOptions=e,this.graphOptions=t}placeNodes(e,t){if(t)C("layout by root:",t);else{C("root is null:",t);return}C("allNodes:",e.length),this.networkAnalyzer.analyzeNetwork(e,t,!1,!1),C("[Fixed layout canvasOffset]",this.graphOptions.viewSize,this.graphOptions.canvasSize),this.layoutEnd()}}const pt=Gn;class Fn extends ce{constructor(e,t,n){super(e,t,n);_(this,"graphInstance");_(this,"layoutOptions");_(this,"levelGaps",[]);this.layoutOptions=e,C("new RGSmartTreeLayout:",this.layoutOptions),this.layoutOptions.from||(this.layoutOptions.from="left"),this.layoutOptions.levelGaps&&(Array.isArray(this.layoutOptions.levelGaps)?this.levelGaps=this.layoutOptions.levelGaps:console.error("Error levelDistance, levelDistance must is Array"));const o=this.layoutOptions.from;o==="top"||o==="bottom"?(this.layoutOptions.treeNodeGapH||(this.layoutOptions.treeNodeGapH=10),this.layoutOptions.treeNodeGapV||(this.layoutOptions.treeNodeGapV=30),this.layoutOptions.treeNodeGapV<30&&(this.layoutOptions.treeNodeGapV=30)):(this.layoutOptions.treeNodeGapH||(this.layoutOptions.treeNodeGapH=30),this.layoutOptions.treeNodeGapV||(this.layoutOptions.treeNodeGapV=10),this.layoutOptions.treeNodeGapH<30&&(this.layoutOptions.treeNodeGapH=30)),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.alignItemsY),this.requireLinks=!0,this.graphInstance=n}placeNodes(e,t){if(C("RGSmartTreeLayout:placeNodes"),t)C("layout by root:",t);else{console.error("root is null");return}this.rootNode=t,this.allNodes=e,C("allNodes:",e.length);const n={alignItemsX:this.layoutOptions.alignItemsX,alignItemsY:this.layoutOptions.alignItemsY},o={alignItemsX:this.layoutOptions.alignParentItemsX,alignItemsY:this.layoutOptions.alignParentItemsY},{tree:s,reverseTree:a}=this.networkAnalyzer.analyzeNetwork(e,this.rootNode,!0,!0);t.fixed||this.layoutOptions.fixedRootNode||this.updateNodePosition(t,0,0);const d=B.getNodeLotXY(n,t);t.lot.x=d.x,t.lot.y=d.y,this.placeRelativePosition(t,[...s.networkNodes].concat(a.networkNodes),Math.max(s.analyticResult.max_strength,a.analyticResult.max_strength)),C("allNodes:",e.length);const h={left:0,top:90,right:180,bottom:270}[this.layoutOptions.from],c={x:t.x,y:t.y};this.allNodes.forEach(m=>{if(m.fixed===!0||!m.rgCalcedVisibility)return;if(Number.isNaN(m.lot.x)&&(C("bad lot x:",m.text,m.lot.x),m.lot.x=0),Number.isNaN(m.lot.y)&&(C("bad lot y:",m.text,m.lot.y),m.lot.y=0),h){const v=J.getRotatedPoint(m.lot.x,m.lot.y,c.x,c.y,h);m.lot.x=v.x,m.lot.y=v.y}const f=m.lot.level<0?o:n,g=B.getNodeXByLotX(f,m),y=B.getNodeYByLotY(f,m);this.updateNodePosition(m,g,y)}),C("create rootNode coordinates:1",t.x,t.y);const u=new be({layoutName:"force",maxLayoutTimes:30,force_node_repulsion:.1,force_line_elastic:1,fixedRootNode:!0,disableLiveChanges:!0},this.graphOptions,this.graphInstance);u.isMainLayouer=!1,u.requireLinks=!0,this.layoutOptions.from==="top"||this.layoutOptions.from==="bottom"?u.lockY=!0:u.lockX=!0;const p=t.fixed;t.fixed=!0,u.skipInitLayout=!0,u.resetCalcNodes(),setTimeout(()=>{t.fixed=p},800),u.onFinish(()=>{t.fixed=p,this.graphInstance&&(this.graphInstance.enableNodeXYAnimation(),this.graphInstance._dataUpdated()),this.applyNodesGap(this.allNodes),this.graphInstance&&(this.graphInstance._dataUpdated(),setTimeout(()=>{this.graphInstance.disableNodeXYAnimation(),this.graphInstance._dataUpdated()},300))}),u.placeNodes(this.allNodes,t),this.layoutEnd()}placeRelativePosition(e,t,n){const o=this.layoutOptions.from==="top"||this.layoutOptions.from==="bottom"?"v":"h";let s=this.layoutOptions.treeNodeGapH||300,a=this.layoutOptions.treeNodeGapV||10;o==="v"&&([s,a]=[a,s]);const{levels:d,levelNodesMap:h}=this.generateLevels(t),c=new Map;for(const g of d){const y=h.get(g);c.set(g,Math.max(...y.map(v=>v.el_W)))}let u=0,p=0;for(const g of t){const y=g.el_H;u+=y,p++}if(p===0)return;const f=u/p+a;t.forEach(g=>{g.fixed!==!0&&g!==e&&(g.lot.x=e.lot.x+this.getLevelDistance(g.lot.level,c,s))}),t.forEach(g=>{g.fixed!==!0&&g!==e&&(g.lot.level===0?g.lot.y=e.lot.y+f*g.lot.index_of_level:g.lot.y=e.lot.y+f*(n/-2+g.lot.strengthWithChilds_from+g.lot.strengthWithChilds/2))})}applyNodesGap(e){const t=this.layoutOptions.from==="top"||this.layoutOptions.from==="bottom"?"v":"h",{levels:n,levelNodesMap:o}=this.generateLevels(e),s=new Map;for(const h of n){const c=o.get(h);s.set(h,Math.max(...c.map(u=>u.el_W)))}const{calcNodes:a,calcNodeMap:d}=this.generateCalcNodes(e);a.forEach(h=>{h.x=h.rgNode.x,h.y=h.rgNode.y,h.width=h.rgNode.el_W,h.height=h.rgNode.el_H,h.buffY=0});for(const h of n){const c=o.get(h)||[];if(t==="h"){const u=c.map(f=>d.get(f.id)),p=u.filter(f=>f.y<this.rootNode.y).sort((f,g)=>g.y-f.y),m=u.filter(f=>f.y>=this.rootNode.y).sort((f,g)=>f.y-g.y);this.adjustNodePositions(p,"top",5),this.adjustNodePositions(m,"bottom",5);for(const f of u)f.rgNode.y=f.y}else{const u=c.map(f=>d.get(f.id)),p=u.filter(f=>f.x<this.rootNode.x).sort((f,g)=>g.x-f.x),m=u.filter(f=>f.x>=this.rootNode.x).sort((f,g)=>f.x-g.x);this.adjustNodePositions(p,"left",5),this.adjustNodePositions(m,"right",5);for(const f of u)f.rgNode.x=f.x}console.log("levelNodes:",h,c)}}getLevelDistance(e,t,n){if(e===0)return 0;if(e>0){let o=0;for(let s=1;s<=e;s++){const a=t.get(s);o+=a+this.getLevelGap(s,n,a)}return o}else{let o=0;for(let s=-1;s>=e;s--){const a=t.get(s);o+=a+this.getLevelGap(s,n,a)}return-o}}getLevelGap(e,t,n){var s;let o=t+(e===-1?n/2:0);if(((s=this.layoutOptions.levelGaps)==null?void 0:s.length)>0){const a=this.layoutOptions.levelGaps[Math.abs(e)];a&&(o=a)}return o}}const $n=Fn;class Yn extends ce{constructor(e,t,n){super(e,t,n);_(this,"enableGatherNodes",!1);_(this,"layoutOptions");this.layoutOptions=e,C("new RGFolderLayout:",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.bottomJunctionPointOffsetX===void 0&&(this.layoutOptions.bottomJunctionPointOffsetX=-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}placeNodes(e,t){if(C("RGFolderLayout:placeNodes"),t)C("layout by root:",t);else{console.error("root is null");return}this.rootNode=t,this.allNodes=e,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};t.fixed||this.layoutOptions.fixedRootNode||this.updateNodePosition(t,0,0);const s=B.getNodeLotXY(n,t);t.lot.x=s.x,t.lot.y=s.y,C("allNodes:",e.length),this.networkAnalyzer.isFolderLayout=!0;const{tree:a}=this.networkAnalyzer.analyzeNetwork(e,t,!1,!1);this.placeRelativePosition(t,a.networkNodes,a.analyticResult),C("networkNodes:",a.networkNodes.length),this.allNodes.forEach(d=>{if(d.fixed!==!0&&(Number.isNaN(d.lot.x)&&(C("bad lot x:",d.text,d.lot.x),d.lot.x=0),Number.isNaN(d.lot.y)&&(C("bad lot y:",d.text,d.lot.y),d.lot.y=0),d!==t)){const h=d.lot.level<0?o:n,c=B.getNodeXByLotX(h,d),u=B.getNodeYByLotY(h,d);this.updateNodePosition(d,c,u)}}),C("create rootNode coordinates:1",t.x,t.y),this.layoutEnd()}placeRelativePosition(e,t,n){const o=this.layoutOptions.treeNodeGapH||20,s=this.layoutOptions.treeNodeGapV||20,a=new Map;let d=0,h=0;for(const p of t){const m=p.lot.level,f=p.el_W,g=p.el_H;d+=g,h++;const y=a.get(m);y===void 0?a.set(m,f):f>y&&a.set(m,y)}if(h===0)return;console.log("levelMaxWidthMap:",a);const u=d/h+s;t.forEach(p=>{p.fixed!==!0&&p!==e&&(this.layoutOptions.from==="right"?p.lot.x=e.lot.x-this.getLevelDistance(p.lot.level,a,o+50):p.lot.x=e.lot.x+this.getLevelDistance(p.lot.level,a,o+50))}),t.forEach(p=>{p.fixed!==!0&&p!==e&&p.lot.level!==0&&(p.lot.y=e.lot.y+u*p.lot.strengthWithChilds_from)}),this.gatherNodes(t,"h",u)}gatherNodes(e,t,n){if(!this.enableGatherNodes)return;const o={};e.forEach(s=>{if(s.lot.level!==0)return;const a=s.lot.level+"";o[a]||(o[a]=[]),o[a].push(s),s.lot.movedNodeSizeBefore=1,s.lot.movedNodeSizeAfter=1}),e.forEach(s=>{if(s.fixed!==!0&&s.lot.level!==0){const a=s.lot.level+"",d=o[a];if(s.lot.strengthWithChilds===1&&s.lot.childrenSizeVisible<=1){const h=this.getBloomingNearByParent(s,s.lot.parent,d,t);h&&(t==="h"?s.lot.y-h.lot.y>0?(s.lot.y=h.lot.y+n*h.lot.movedNodeSizeAfter,h.lot.movedNodeSizeAfter++):(s.lot.y=h.lot.y-n*h.lot.movedNodeSizeBefore,h.lot.movedNodeSizeBefore++):s.lot.x-h.lot.x>0?(s.lot.x=h.lot.x+n*h.lot.movedNodeSizeAfter,h.lot.movedNodeSizeAfter++):(s.lot.x=h.lot.x-n*h.lot.movedNodeSizeBefore,h.lot.movedNodeSizeBefore++))}}})}getBloomingNearByParent(e,t,n,o){let s=9999,a;for(const d of n)if(d.lot.childrenSizeVisible>1&&d.lot.parent===t){const h=o==="h"?d.lot.y-t.lot.y:d.lot.x-t.lot.x;Math.abs(h)<s&&(s=Math.abs(h),a=d)}if(a&&a!==e)return a}getLevelDistance(e,t,n){if(e===0)return 0;if(e>0){let o=0;for(let s=0;s<e;s++)o+=t.get(s)+this.getLevelGap(s,n);return o}else{let o=e<-1?0:-t.get(e)/2;for(let s=e;s<0;s++)o+=t.get(s)+this.getLevelGap(s,n)+50;return-o}}getLevelGap(e,t){var o;let n=t;if(((o=this.layoutOptions.levelGaps)==null?void 0:o.length)>0){const s=this.layoutOptions.levelGaps[Math.abs(e)];s&&(n=s)}return n}}const ft=Yn,re=l=>!l||l.length===0?"":l.map(i=>{switch(i.type){case"M":return`${i.type} ${i.x} ${i.y}`;case"l":return`${i.type} ${i.dx} ${i.dy}`;case"L":return`${i.type} ${i.x} ${i.y}`;case"h":return`${i.type} ${i.dx}`;case"v":return`${i.type} ${i.dy}`;case"c":return`${i.type} ${i.dx1} ${i.dy1} ${i.dx2} ${i.dy2} ${i.dx} ${i.dy}`;case"s":return`${i.type} ${i.dx2} ${i.dy2} ${i.dx} ${i.dy}`;case"q":return`${i.type} ${i.dx1} ${i.dy1} ${i.dx} ${i.dy}`;case"Q":return`${i.type} ${i.x1} ${i.y1} ${i.x} ${i.y}`;case"t":return`${i.type} ${i.dx} ${i.dy}`;case"a":return`${i.type} ${i.rx} ${i.ry} ${i.xAxisRotation} ${i.largeArcFlag} ${i.sweepFlag} ${i.dx} ${i.dy}`;case"Z":return i.type;default:return console.warn("\u672A\u77E5\u7684\u8DEF\u5F84\u547D\u4EE4\u7C7B\u578B:",i),""}}).join(" ").trim(),We=l=>{const i=l.match(/[a-zA-Z][^a-zA-Z]*/g);let e=0,t=0,n=0,o=0,s=0,a=0,d=0,h=0;const c={x:0,y:0},u={x:0,y:0},p=[];for(const m of i){const f=m.trim().split(/[ ,]+/),g=f[0].toUpperCase(),y=f[0]===f[0].toLowerCase();switch(g){case"M":e=Y(n,f[1],y),t=Y(o,f[2],y),n=e,o=t;break;case"L":e=Y(n,f[1],y),t=Y(o,f[2],y),p.push({x:e,y:t});break;case"C":s=Y(n,f[1],y),a=Y(o,f[2],y),d=Y(n,f[3],y),h=Y(o,f[4],y),e=Y(n,f[5],y),t=Y(o,f[6],y),n=e,o=t;break;case"Q":s=Y(n,f[1],y),a=Y(o,f[2],y),e=Y(n,f[3],y),t=Y(o,f[4],y),n=e,o=t;break;case"V":t=Y(o,f[1],y),o=t;break;case"H":e=Y(n,f[1],y),n=e;break;case"Z":break;default:console.log(`Unsupported command: ${g}`)}m===i[0]&&(c.x=e,c.y=t),m===i[i.length-1]&&(u.x=e,u.y=t)}return{startPoint:c,ctrl1:{x:s,y:a},ctrl2:{x:d,y:h},endPoint:u,lines:p}},Y=(l,i,e)=>e?l+parseFloat(i):parseFloat(i),Hn=(l,i,e,t,n,o,s)=>{const a=JSON.parse(JSON.stringify(l));let d=!1;if(e<0||e>=l.length-1)return{newPoints:a,pointsChanged:d};a[e-1];const h=a[e],c=a[e+1];i[e-1];const u=i[e];i[e+1];let p=o,m=s;if(t.direction==="v"){const f=i[e-2],g=i[e+2],y=u.x+p;let v=3e3;if(f){const x=Math.abs(f.x-y);x<10&&x<v&&(v=x,p=f.x-u.x)}if(g){const x=Math.abs(g.x-y);x<10&&x<v&&(v=x,p=g.x-u.x)}}else{const f=i[e-2],g=i[e+2],y=u.y+m;let v=3e3;if(f){const x=Math.abs(f.y-y);x<10&&x<v&&(v=x,m=f.y-u.y)}if(g){const x=Math.abs(g.y-y);x<10&&x<v&&(v=x,m=g.y-u.y)}}if(t.direction==="v")if(e===0){const f=h.y<c.y?1:-1,g={x:h.x,y:h.y},y={x:h.x,y:h.y+20*f};h.x=y.x+p,h.y=y.y,a.splice(e,0,g,y),n.indexOffset+=2,d=!0}else if(e===l.length-2){const f=h.y<c.y?1:-1,g={x:u.x+p,y:c.y-20*f},y={x:c.x,y:c.y-20*f};a.splice(e+1,0,g,y),d=!0}else h.x=u.x+p,c.x=u.x+p;else if(e===0){const f=h.x<c.x?1:-1,g={x:h.x,y:h.y},y={x:h.x+20*f,y:h.y};h.x=y.x,h.y=u.y+m,a.splice(e,0,g,y),n.indexOffset+=2,d=!0}else if(e===l.length-2){const f=h.x<c.x?1:-1,g={x:c.x-20*f,y:u.y+m},y={x:c.x-20*f,y:c.y};a.splice(e+1,0,g,y),d=!0}else h.y=u.y+m,c.y=u.y+m;return{newPoints:a,pointsChanged:d}},Wn=(l,i={x:0,y:0,rotate:0})=>{const{fx:e,fy:t,tx:n,ty:o}=l;i.rotate=J.getTextAngle(e,t,n,o),i.x=e+(n-e)/2,i.y=t+(o-t)/2,Number.isNaN(i.rotate)&&(i.rotate=0);const s=n-e,a=o-t,d=[{type:"M",x:e,y:t},{type:"l",dx:s,dy:a}],h=re(d);return{pathCommands:d,pathData:h,textPosition:i,points:[]}},Un=(l,i={x:0,y:0,rotate:0},e={})=>{const{line:t,fx:n,fy:o,fcx:s,fcy:a,f_W:d,f_H:h,tx:c,ty:u,tcx:p,tcy:m,t_W:f,t_H:g}=l,y=c-n,v=u-o,x=n-s,L=o-a,N=c-p,T=u-m,O=t.lineRadius!==void 0?t.lineRadius:e.lineRadius||0;let b=Math.min(O,Math.abs(y))*(n<c?1:-1),k=Math.min(O,Math.abs(v))*(o<u?1:-1);const P=t.fromJunctionPoint||e.defaultJunctionPoint||H.border,S=t.toJunctionPoint||e.defaultJunctionPoint||H.border,R=t.lineDirection||(P===H.tb||P===H.top||P===H.bottom?"v":"h")||(Math.abs(x)>=d/2?"h":"v"),M=t.lineDirection||(S===H.tb||S===H.top||S===H.bottom?"v":"h")||(Math.abs(N)>=f/2?"h":"v"),w=[];let I=0,V=0;if(R==="v"){const z=t.polyLineStartDistance||Math.max(Math.min(30,Math.abs(u-o)/2),15),G=L>0?z:-z;if(t.placeText==="start"?(I=n,V=o+(L>0?20:-5)):t.placeText==="center"||t.placeText==="middle"?(I=n+(c-n)/2,V=o+G):(I=c,V=u-(L>0?20:-5)),w.push({type:"M",x:Math.round(n),y:Math.round(o)},{type:"v",dy:Math.round(G-k)},{type:"c",dx1:0,dy1:Math.round(k),dx2:Math.round(b),dy2:Math.round(k),dx:Math.round(b),dy:Math.round(k)}),M==="v")w.push({type:"h",dx:Math.round(c-n-b*2)},{type:"c",dx1:Math.round(b),dy1:0,dx2:Math.round(b),dy2:Math.round(k),dx:Math.round(b),dy:Math.round(k)},{type:"v",dy:Math.round(u-o-G-k)});else{const W=Math.min(30,Math.abs(c-n)/2),U=N>0?-W:W;w.push({type:"h",dx:Math.round(c-n+U-b)},{type:"c",dx1:Math.round(b),dy1:0,dx2:Math.round(b),dy2:Math.round(k),dx:Math.round(b),dy:Math.round(k)},{type:"v",dy:Math.round(u-o-G-k)},{type:"h",dx:Math.round(U-b)})}}else{const z=t.polyLineStartDistance||Math.max(Math.min(30,Math.abs(c-n)/2),15),G=x>0?z:-z;if(t.placeText==="start"?(I=n+(x>0?10:-50),V=o):t.placeText==="center"||t.placeText==="middle"?(I=n+G,V=o+(u-o)/2):(I=c-(x>0?10:-50),V=u),b=Math.min(O,Math.abs(y))*(n>s?1:-1),k=Math.min(O,Math.abs(v))*(o<u?1:-1),w.push({type:"M",x:Math.round(n),y:Math.round(o)},{type:"h",dx:Math.round(G-b)},{type:"c",dx1:Math.round(b),dy1:0,dx2:Math.round(b),dy2:Math.round(k),dx:Math.round(b),dy:Math.round(k)}),M==="v"){b=Math.min(O,Math.abs(y))*(u<m?1:-1),k=Math.min(O,Math.abs(v))*(u<m?1:-1);const W=Math.min(30,Math.abs(u-o)/2),U=T>0?-W:W;w.push({type:"v",dy:Math.round(u-o+U-k)},{type:"h",dx:Math.round(c-n-G-b)},{type:"c",dx1:0,dy1:Math.round(k),dx2:Math.round(b),dy2:Math.round(k),dx:Math.round(b),dy:Math.round(k)},{type:"v",dy:Math.round(U-k)})}else b=Math.min(O,Math.abs(y))*(n+G<c?1:-1),k=Math.min(O,Math.abs(v))*(u>o?1:-1),w.push({type:"v",dy:Math.round(u-o-k*2)},{type:"c",dx1:0,dy1:Math.round(k),dx2:Math.round(b),dy2:Math.round(k),dx:Math.round(b),dy:Math.round(k)},{type:"h",dx:Math.round(c-n-G-b)})}i.x=I,i.y=V;const A=re(w);return{pathCommands:w,pathData:A,textPosition:i,points:[]}},Pe={left:{x:-1,y:0},right:{x:1,y:0},top:{x:0,y:-1},bottom:{x:0,y:1}},Jn=({source:l,sourcePosition:i="bottom",target:e})=>i==="left"||i==="right"?l.x<e.x?{x:1,y:0}:{x:-1,y:0}:l.y<e.y?{x:0,y:1}:{x:0,y:-1},Ue=(l,i)=>Math.sqrt(Math.pow(i.x-l.x,2)+Math.pow(i.y-l.y,2));function Ve({source:l,sourcePosition:i="bottom",target:e,targetPosition:t="top",center:n,sourceOffset:o,targetOffset:s}){const a=Pe[i],d=Pe[t],h={x:l.x+a.x*o,y:l.y+a.y*o},c={x:e.x+d.x*s,y:e.y+d.y*s},u=Jn({source:h,sourcePosition:i,target:c}),p=u.x!==0?"x":"y",m=u[p];let f=[],g,y;const v={x:0,y:0},x={x:0,y:0};let L=0;if(a[p]*d[p]===-1){g=n.x,y=n.y;const T=[{x:g,y:h.y},{x:g,y:c.y}],O=[{x:h.x,y},{x:c.x,y}];a[p]===m?(L=1.1,f=p==="x"?T:O):(L=1.2,f=p==="x"?O:T)}else{const T=[{x:h.x,y:c.y}],O=[{x:c.x,y:h.y}];if(p==="x"?f=a.x===m?O:T:f=a.y===m?T:O,i===t){L=2.1;const R=Math.abs(l[p]-e[p]),M=a[p]===m?o:s;if(R<=M){const w=Math.min(M-1,M-R);a[p]===m?v[p]=(h[p]>l[p]?-1:1)*w:x[p]=(c[p]>e[p]?-1:1)*w}}if(i!==t){L=2.2;const R=p==="x"?"y":"x",M=a[p]===d[R],w=h[R]>c[R],I=h[R]<c[R];(a[p]===1&&(!M&&w||M&&I)||a[p]!==1&&(!M&&I||M&&w))&&(f=p==="x"?T:O)}const b={x:h.x+v.x,y:h.y+v.y},k={x:c.x+x.x,y:c.y+x.y},P=Math.max(Math.abs(b.x-f[0].x),Math.abs(k.x-f[0].x)),S=Math.max(Math.abs(b.y-f[0].y),Math.abs(k.y-f[0].y));P>=S?(g=(b.x+k.x)/2,y=f[0].y):(g=f[0].x,y=(b.y+k.y)/2)}return[[l,{x:h.x+v.x,y:h.y+v.y},...f,{x:c.x+x.x,y:c.y+x.y},e],g,y,0,0,L]}const Te=l=>{const i=[];for(let e=0;e<l.length;e++){const t=l[e];if(t.x=Math.round(t.x),t.y=Math.round(t.y),e===0||e===l.length-1)i.push(t);else{const n=i[i.length-1];t.x===n.x&&t.y===n.y||i.push(t)}}for(let e=2;e<i.length;e++){const t=i[e-2],n=i[e-1],o=i[e],s=t.x===n.x?"v":"h",a=n.x===o.x?"v":"h";s===a&&(n.merged=!0)}return i.filter(e=>e.merged!==!0)};function jn(l,i,e,t){const n=Math.min(Ue(l,i)/2,Ue(i,e)/2,t),{x:o,y:s}=i;if(l.x===o&&o===e.x||l.y===s&&s===e.y)return[{type:"L",x:o,y:s}];if(l.y===s){const h=l.x<e.x?-1:1,c=l.y<e.y?1:-1;return[{type:"L",x:o+n*h,y:s},{type:"Q",x1:o,y1:s,x:o,y:s+n*c}]}const a=l.x<e.x?1:-1,d=l.y<e.y?-1:1;return[{type:"L",x:o,y:s+n*d},{type:"Q",x1:o,y1:s,x:o+n*a,y:s}]}const gt=(l,i)=>{const e=[];return l.forEach((t,n)=>{if(n===0)e.push({type:"M",x:Math.round(t.x),y:Math.round(t.y)});else if(n===l.length-1){const o=l[n-1];let s=o.x===t.x?0:o.x<t.x?-1:1,a=o.y===t.y?0:o.y<t.y?-1:1;l.length===2&&(s=0,a=0),e.push({type:"l",dx:Math.round(t.x-o.x+i*s),dy:Math.round(t.y-o.y+i*a)})}else{const o=jn(l[n-1],t,l[n+1],i);e.push(...o)}}),e};var se=(l=>(l.border="border",l.ltrb="ltrb",l.tb="tb",l.lr="lr",l.left="left",l.right="right",l.top="top",l.bottom="bottom",l))(se||{});const Re=(l,i,e,t,n,o,s,a)=>l==="left"?"left":l==="right"?"right":l==="top"?"top":l==="bottom"?"bottom":l==="horizontalLine"?t?o>a?"bottom":"top":o<a?"bottom":"top":l==="verticalLine"?t?n>s?"right":"left":n<s?"right":"left":i===1?"right":i===-1?"left":e===1?"bottom":e===-1?"top":"left",Je=l=>l==="left"?"right":l==="right"?"left":l==="top"?"bottom":l==="bottom"?"top":"left",mt=l=>{if(l.length<2)throw new Error("At least two points are required to form a polyline.");let i=0;const e=[];for(let o=1;o<l.length;o++){const s=l[o].x-l[o-1].x,a=l[o].y-l[o-1].y,d=Math.sqrt(s*s+a*a);e.push(d),i+=d}const t=i/2;let n=0;for(let o=0;o<e.length;o++)if(n+=e[o],n>=t){const s=l[o],a=l[o+1],d=e[o],c=(t-(n-d))/d,u=s.x+(a.x-s.x)*c,p=s.y+(a.y-s.y)*c;return{x:u,y:p}}return{x:0,y:0}},qn=(l,i={x:0,y:0,rotate:0},e={})=>{const{line:t,fromJunctionPoint:n,toJunctionPoint:o,lineDirection:s,lineShape:a,fx:d,fy:h,fcx:c,fcy:u,f_W:p,f_H:m,tx:f,ty:g,tcx:y,tcy:v,t_W:x,t_H:L}=l,N=d-c,T=h-u;let O=N>1?1:N<-1?-1:0,b=T>1?1:T<-1?-1:0;Math.abs(O)===1&&Math.abs(b)===1&&(Math.abs(N)>Math.abs(T)?b=0:O=0),O===0&&b===0&&(O=1);const k=f-y,P=g-v;let S=k>1?1:k<-1?-1:0,R=P>1?1:P<-1?-1:0;Math.abs(S)===1&&Math.abs(R)===1&&(Math.abs(k)>Math.abs(P)?R=0:S=0),S===0&&R===0&&(O=-1);const M=Re(n,O,b,!1,d,h,f,g),w=Re(o,S,R,!0,d,h,f,g),I=M,V=w,A=d+(f-d)/2,z=h+(g-h)/2;let G={x:0,y:0},W=20,U=20;t.ctrlOptionsFor44&&(G={x:t.ctrlOptionsFor44.cx,y:t.ctrlOptionsFor44.cy},W+=t.ctrlOptionsFor44.fd,U+=t.ctrlOptionsFor44.td);const ne=t.lineRadius!==void 0?t.lineRadius:e.lineRadius||0,[ee]=Ve({source:{x:d,y:h},sourcePosition:I,target:{x:f,y:g},targetPosition:V,center:{x:A+G.x,y:z+G.y},sourceOffset:W,targetOffset:U}),te=Te(ee),Q=gt(te,ne),Z=re(Q),oe=mt(ee);if(i.x=oe.x,i.y=oe.y,s==="v"){const j=T>1?1:T<-1?-1:0,F=P>1?1:P<-1?-1:0;t.placeText==="start"?(i.x=d,i.y=h+j*10):t.placeText==="end"&&(i.x=f,i.y=g+F*10)}else{const j=N>1?1:N<-1?-1:0,F=k>1?1:k<-1?-1:0;t.placeText==="start"?(i.x=d+j*10,i.y=h):t.placeText==="end"&&(i.x=f+F*10,i.y=g)}return{pathCommands:Q,pathData:Z,textPosition:i,points:te,startDirection:I,endDirection:V}},Zn=(l,i={x:0,y:0,rotate:0},e={})=>{const{line:t,fromJunctionPoint:n,toJunctionPoint:o,lineDirection:s,lineShape:a,fx:d,fy:h,fcx:c,fcy:u,f_W:p,f_H:m,tx:f,ty:g,tcx:y,tcy:v,t_W:x,t_H:L}=l,N=d-c,T=h-u;let O=N>3?1:N<-3?-1:0,b=T>3?1:T<-3?-1:0;Math.abs(O)===1&&Math.abs(b)===1&&(Math.abs(N)>Math.abs(T)?b=0:O=0),O===0&&b===0&&(O=1);const k=f-y,P=g-v;let S=k>3?1:k<-3?-1:0,R=P>3?1:P<-3?-1:0;Math.abs(S)===1&&Math.abs(R)===1&&(Math.abs(k)>Math.abs(P)?R=0:S=0),S===0&&R===0&&(O=-1);let M=Re(n,O,b,!1,d,h,f,g),w=Re(o,S,R,!0,d,h,f,g);const I=t.lineRadius!==void 0?t.lineRadius:e.lineRadius||0,V=t.ctrlPointsFor49;let A={x:Math.round(d),y:Math.round(h)},z={x:Math.round(f),y:Math.round(g)},G={x:Math.round(V[0].x),y:Math.round(V[0].y)},W={x:Math.round(V[V.length-1].x),y:Math.round(V[V.length-1].y)},U=[...V];if(t.isReverse&&([M,w]=[w,M]),Math.abs(A.x-G.x)>3||Math.abs(A.y-G.y)>3){const Z=A.x+(G.x-A.x)/2,oe=A.y+(G.y-A.y)/2,j=Je(M),[F]=Ve({source:A,sourcePosition:M,target:G,targetPosition:j,center:{x:Z,y:oe},sourceOffset:20,targetOffset:5});U=Te([...F,...U])}if(Math.abs(z.x-W.x)>3||Math.abs(z.y-W.y)>3){const Z=W.x+(z.x-W.x)/2,oe=W.y+(z.y-W.y)/2,j=Je(w),[F]=Ve({source:W,sourcePosition:j,target:z,targetPosition:w,center:{x:Z,y:oe},sourceOffset:5,targetOffset:20});U=Te([...U,...F])}const ne=U,ee=gt(ne,I),te=re(ee),Q=mt(V);return i.x=Q.x,i.y=Q.y,{pathCommands:[],pathData:te,textPosition:i,points:ne,startDirection:M,endDirection:w}},Kn=(l,i={x:0,y:0,rotate:0})=>{const{line:e,lineShape:t,fx:n,fy:o,fcx:s,fcy:a,tx:d,ty:h,tcx:c,tcy:u}=l,p=d-n,m=h-o;let f=n-s,g=o-a,y=d-c,v=h-u,{fromJunctionPoint:x,toJunctionPoint:L}=e;e.isReverse&&([x,L]=[L,x]),(x===H.left||x===H.right)&&(g=0),(x===H.top||x===H.bottom)&&(f=0),(L===H.left||L===H.right)&&(v=0),(L===H.top||L===H.bottom)&&(y=0);const N=Math.min(200,Math.max(100,Math.abs(p/2))),T=Math.min(200,Math.max(100,Math.abs(m/2))),O=f/(Math.abs(f)+Math.abs(g))*N,b=g/(Math.abs(f)+Math.abs(g))*T;let k={x:O,y:b};const P=y/(Math.abs(y)+Math.abs(v))*N+p,S=v/(Math.abs(y)+Math.abs(v))*T+m;let R={x:P,y:S};e.ctrlPoints&&e.ctrlPoints.length>0&&(e.isReverse?(k.x+=e.ctrlPoints[1].x,k.y+=e.ctrlPoints[1].y,R.x+=e.ctrlPoints[0].x,R.y+=e.ctrlPoints[0].y):(k.x+=e.ctrlPoints[0].x,k.y+=e.ctrlPoints[0].y,R.x+=e.ctrlPoints[1].x,R.y+=e.ctrlPoints[1].y));const M={x:n+k.x,y:o+k.y},w={x:n+R.x,y:o+R.y},I={x:n+p,y:o+m},V=[{type:"M",x:n,y:o},{type:"c",dx1:k.x,dy1:k.y,dx2:R.x,dy2:R.y,dx:p,dy:m}];t===8&&V.push({type:"Z"});const A=yt({x:n,y:o},M,w,I,t<6?.8:.5);i.x=A.x,i.y=A.y;const z=re(V);return{pathCommands:V,pathData:z,textPosition:i,points:[]}},yt=(l,i,e,t,n=.5)=>{const o={x:(1-n)*l.x+n*i.x,y:(1-n)*l.y+n*i.y},s={x:(1-n)*i.x+n*e.x,y:(1-n)*i.y+n*e.y},a={x:(1-n)*e.x+n*t.x,y:(1-n)*e.y+n*t.y},d={x:(1-n)*o.x+n*s.x,y:(1-n)*o.y+n*s.y},h={x:(1-n)*s.x+n*a.x,y:(1-n)*s.y+n*a.y};return{x:(1-n)*d.x+n*h.x,y:(1-n)*d.y+n*h.y}},Qn=(l,i={x:0,y:0,rotate:0})=>{const{line:e,totalLinesBetweenNodes:t,currentLineIndex:n,lineDirection:o,lineShape:s,fx:a,fy:d,fcx:h,fcy:c,f_W:u,f_H:p,tx:m,ty:f,tcx:g,tcy:y,t_W:v,t_H:x}=l,L=m-a,N=f-d,T=m>a?1:-1,O=f>d?1:-1,b=o==="v"?O:T,k=a-h,P=d-c,S=m-g,R=f-y,M=1/(t+1)*(n+1);let w={x:0,y:0},I={x:0,y:0};if(s===$.Curve2)w=o==="v"?{x:0,y:b*30}:{x:b*30,y:0},I=o==="v"?{x:L*M,y:b*-10}:{x:b*-10,y:N*M};else if(s===$.Curve3)w=o==="v"?{x:0,y:N*M}:{x:b*30,y:0},I=o==="v"?{x:0,y:0}:{x:b*-10,y:N*M};else if(s===$.Curve5)w={x:0,y:0},I=o==="v"?{x:0,y:N*M}:{x:L*M,y:0};else if(s===$.Curve7||s===$.Curve8){const te=k/(Math.abs(k)+Math.abs(P))*30,Q=P/(Math.abs(k)+Math.abs(P))*30;w={x:te,y:Q};const Z=S/(Math.abs(S)+Math.abs(R))*30+L,oe=R/(Math.abs(S)+Math.abs(R))*30+N;I={x:Z,y:oe}}const V={x:a+w.x,y:d+w.y},A={x:a+I.x,y:d+I.y},z={x:a+L,y:d+N},G=[{type:"M",x:a,y:d},{type:"c",dx1:w.x,dy1:w.y,dx2:I.x,dy2:I.y,dx:L,dy:N}];s===8&&G.push({type:"Z"});const W=yt({x:a,y:d},V,A,z,s<6?.8:.5);i.x=W.x,i.y=W.y;const U=re(G);return{pathCommands:G,pathData:U,textPosition:i,points:[]}};class eo{constructor(){_(this,"graphData",{rootNode:void 0,nodes:[],normalLines:[],fakeLines:[]});_(this,"options",{});_(this,"runtimeDATA4NodeMap",new Map);_(this,"runtimeDATA4Links",[]);_(this,"runtimeDATA4LinkMap",new Map);_(this,"runtimeDATA4ConnectTargets",[]);_(this,"runtimeDATA4ElLineTargets",[]);_(this,"runtimeDATA4ShouldRenderItems",{nodes:[],lines:[],fakeLines:[]})}}class to extends eo{constructor(){super()}getOptions(){return this.options}getNodeById(i){return this.runtimeDATA4NodeMap.get(i)}getLineById(i){var e;return(e=this.runtimeDATA4LinkMap.get(i))==null?void 0:e.line}getLinkByLineId(i){return this.runtimeDATA4LinkMap.get(i)}getFakeLineById(i){return this.graphData.fakeLines.find(e=>e.id===i)}getNodes(){return this.graphData.nodes}getLinks(){return this.runtimeDATA4Links}getFakeLines(){return this.graphData.fakeLines}getLines(){return this.runtimeDATA4Links.map(i=>i.line)}getRootNode(){return this.graphData.rootNode}getShouldRenderNodes(){return this.isPerformanceMode()?this.runtimeDATA4ShouldRenderItems.nodes:this.graphData.nodes}getShouldRenderLines(){return this.isPerformanceMode()?this.runtimeDATA4ShouldRenderItems.lines:this.graphData.normalLines}getShouldRenderFakeLines(){return this.isPerformanceMode()?this.runtimeDATA4ShouldRenderItems.fakeLines:this.graphData.fakeLines}isPerformanceMode(){return this.options.performanceMode}getCanvasScale(){return this.options.canvasZoom/100}getConnectTargets(){return this.runtimeDATA4ConnectTargets}getConnectTargetById(i){if(!i)throw new Error("[getConnectTargetById]targetId is empty");for(let e=0;e<this.runtimeDATA4ConnectTargets.length;e++){const t=this.runtimeDATA4ConnectTargets[e];if(t.targetId===i)return t}}getElLineTargets(){return this.runtimeDATA4ElLineTargets}getElLineTargetById(i){return this.runtimeDATA4ElLineTargets.find(e=>e.id===i)}calcShouldRenderNodes(){const i=[];return this.graphData.nodes.forEach(e=>{e.rgShouldRender!==!1&&e.rgCalcedVisibility!==!1&&i.push(e)}),i}calcShouldRenderLines(){const i=[];return this.runtimeDATA4Links.forEach(e=>{e.rgShouldRender!==!1&&e.line.hidden!==!0&&e.rgCalcedVisibility!==!1&&i.push(e.line)}),i}calcShouldRenderFakeLines(){return this.graphData.fakeLines}findNodeByXy(i){const e=this.graphData.nodes;for(let t=e.length-1;t>=0;t--){const n=e[t],o=n.x,s=n.y,a=n.el_W||n.width||50,d=n.el_H||n.height||50;if(i.x>o&&i.x<o+a&&i.y>s&&i.y<s+d)return n}return null}}class no{constructor(){_(this,"map");this.map=new Map}_key(i,e){return i<=e?`${i}${e}`:`${e}${i}`}addEdge(i,e){const t=this._key(i,e),n=this.map.get(t)||0;return this.map.set(t,n+1),n}getCount(i,e){const t=this._key(i,e);return this.map.get(t)||0}clear(){this.map.clear()}}const Ge=(l={})=>{const i={definitelyNoDataProviderNeeded:!1,instanceId:"",debug:!0,graphLoading:!1,graphLoadingText:"",showToolBar:!0,backgroundColor:"transparent",checkedItemBackgroundColor:void 0,selectionMode:!1,disableWheelEvent:!1,wheelEventAction:"zoom",dragEventAction:"move",fullscreenElementXPath:"",disableDragNode:!1,disableDragLine:!0,canvasMoveMode:!1,disableNodePointEvent:!1,disableLinePointEvent:!1,enableNodeXYAnimation:!1,enableCanvasTransformAnimation:!1,reLayoutWhenExpandedOrCollapsed:!1,defaultExpandHolderPosition:"hide",toolBarDirection:"h",toolBarPositionH:"left",toolBarPositionV:"bottom",defaultNodeColor:"#ffffff",defaultNodeBorderColor:"#666666",defaultNodeBorderWidth:1,defaultNodeBorderRadius:4,defaultNodeShape:_e.rect,defaultNodeWidth:void 0,defaultNodeHeight:void 0,defaultLineColor:"#cccccc",defaultLineWidth:2,defaultLineShape:$.StandardStraight,defaultLineTextOffsetX:void 0,defaultLineTextOffsetY:void 0,defaultJunctionPoint:H.border,defaultLineJunctionOffset:3,defaultPolyLineRadius:5,placeOtherGroup:!0,defaultLineTextOnPath:!1,lineTextMaxLength:66,multiLineDistance:30,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},canvasSize:{width:300,height:300},canvasOffset:{x:25,y:27},fullscreen:!1,checkedNodeId:"",checkedLineId:"",draggingNodeId:"",layout:{layoutName:"center"},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:Ne(JSON.parse(JSON.stringify(Ae)),{}),creatingLinePlot:!1,newLineTemplate:{from:"newRelationTemplate-from",to:"newRelationTemplate-to",color:"",text:""},newLinkTemplate:{fromNode:null,toNodeObject:null,toNode:{nothing:!0,x:400,y:400,el_W:30,el_H:30},totalLinesBetweenNodes:1,currentLineIndex:0,line:{}},data:{},editingLineController:{show:!1,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:void 0,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};i.newLineTemplate=de(i.newLineTemplate,i);const e=Object.keys(i);return l&&Object.keys(l).forEach(t=>{const n=l[t];if(!e.includes(t)){C("RGOptions: unknow option key:",t);return}if(typeof n=="object"){C("RGOptions:user setting object:",t,n);const o=i[t];if(t==="layout")i[t]=JSON.parse(JSON.stringify(n));else if(o&&!Array.isArray(o)&&n)Object.keys(o).forEach(s=>{o[s]=n[s]});else if(Array.isArray(o)){const s=[];n.forEach(a=>{a&&typeof a=="object"?s.push(JSON.parse(JSON.stringify(a))):s.push(a)}),i[t]=s}else i[t]=n}else i[t]=n}),i},vt=l=>{const i=l.layoutName||"";if(i==="center"){const e=l;e.layoutDirection=void 0}else if(i.includes("tree")){const e=l;e.from===void 0&&(e.from="left"),e.levelGaps===void 0&&(e.levelGaps=[]),(e.from==="top"||e.from==="bottom")&&(e.layoutDirection===void 0&&(e.layoutDirection="v"),C("set layoutDirection=v"),C("set defaultJunctionPoint=tb")),(e.from==="left"||e.from==="right")&&(e.layoutDirection===void 0&&(e.layoutDirection="h"),C("set defaultJunctionPoint=lr"))}else(i==="fixed"||i==="force")&&(l.layoutDirection=void 0)},oo={createDefaultConfig:Ge},io=Object.freeze(Object.defineProperty({__proto__:null,createDefaultConfig:Ge,appendDefaultOptions4Layout:vt,default:oo},Symbol.toStringTag,{value:"Module"}));class ke extends to{constructor(){super();_(this,"commits");_(this,"updateViewHook",e=>{});this.options=Ge({}),this.commits=this.resetCommints()}clearReactiveData(){this.graphData.nodes=[],this.graphData.normalLines=[],this.graphData.fakeLines=[],this.runtimeDATA4Links.splice(0,this.runtimeDATA4Links.length),this.runtimeDATA4ElLineTargets.splice(0,this.runtimeDATA4ElLineTargets.length),this.runtimeDATA4NodeMap.clear(),this.runtimeDATA4LinkMap.clear(),this.graphData.rootNode=void 0,this.updateShouldRenderGraphData(),this.commits.optionsChanged=!0,this.commits.nodesListChanged=!0,this.commits.linesListChanged=!0,this.commits.fakeLinesListChanged=!0}resetCommints(){return{optionsChanged:!1,changedNodes:[],nodesListChanged:!1,changedLines:[],linesListChanged:!1,changedFakeLines:[],fakeLinesListChanged:!1,changedConnectTargets:[],connectTargetsListChanged:!1}}commitLine(e){this.commits.linesListChanged=!0}commitNode(e){this.commits.changedNodes.includes(e)||this.commits.changedNodes.push(e),this.commits.linesListChanged=!0,this.commits.fakeLinesListChanged=!0}commitFakeLine(e){this.commits.fakeLinesListChanged=!0}commitConnectTarget(e){this.commits.changedConnectTargets.includes(e)||this.commits.changedConnectTargets.push(e),this.commits.fakeLinesListChanged=!0}dataUpdated(){const e=this.commits;this.commits=this.resetCommints(),this.updateViewHook(e)}updateOptions(e){var t;if(e.layout&&console.log("RGDataProvider:updateOptions:layout:",(t=e.layout)==null?void 0:t.layoutName,e.layout),Object.assign(this.options,e),this.isPerformanceMode()&&!this.options.showEasyView){const n=Object.keys(e);console.log("changedKeys:",n.join(",")),n.includes("canvasZoom")&&(this.commits.nodesListChanged=!0,this.commits.linesListChanged=!0),n.includes("viewSize")&&(this.commits.nodesListChanged=!0,this.commits.linesListChanged=!0),n.includes("canvasOffset")&&(this.commits.nodesListChanged=!0,this.commits.linesListChanged=!0)}this.commits.optionsChanged=!0}clearChecked(){this.updateOptions({checkedNodeId:"",checkedLineId:""})}setCanvasOffset(e,t){this.updateOptions({canvasOffset:{x:e,y:t}}),this.commits.optionsChanged=!0}setCanvasZoom(e){this.updateOptions({canvasZoom:e})}setEditingLine(e){if(e){const t=this.getLineById(e.id)||this.getFakeLineById(e.id);t&&this.updateOptions({editingLineController:{...this.options.editingLineController,line:t,show:!0},checkedLineId:e.id})}else this.updateOptions({editingLineController:{...this.options.editingLineController,line:null,show:!1},checkedLineId:""})}setEditingNodes(e){for(const n of e)if(!n||!this.getNodeById(n.id)){console.error("setEditingNodes Error: node not found:",n);return}this.getNodes().filter(n=>n.selected).forEach(n=>this.updateNode(n.id,{selected:!1})),this.updateOptions({editingController:{...this.options.editingController,nodes:e,show:e.length>0}}),e.length>1&&this.options.editingController.nodes.forEach(n=>this.updateNode(n.id,{selected:!0}))}setCanvasCenter(e,t){const n=this.options.viewSize.width/2,o=this.options.viewSize.height/2,s=this.options.canvasZoom/100;this.setCanvasOffset(n-e*s,o-t*s)}removeNodeById(e){this.beforeNodeBeRemove(e),C("Removed Node line/connect-arget\uFF1A",e);let t=0;for(let n=0;n<this.graphData.nodes.length;n++)e.includes(this.graphData.nodes[n].id)&&(this.graphData.nodes.splice(n,1),n--,t++);for(const n of e)this.runtimeDATA4NodeMap.delete(n);C("Removed node\uFF1A",e,t),this.commits.nodesListChanged=!0}removeLineByIds(e){C("_removeLineByIds:",e.length,e),this.removeFakeLineByIds(e);let t=0;for(let n=0;n<this.graphData.normalLines.length;n++){const o=this.graphData.normalLines[n];e.includes(o.id)&&(this.graphData.normalLines.splice(n,1),n--,t++)}C("_removeLineByIds:",t),this.removeLinkByLineIds(e),this.updateLinks(),this.commits.linesListChanged=!0}removeFakeLineByIds(e){C("_removeFakeLineByIds:",e.length,e);let t=0;for(let n=0;n<this.graphData.fakeLines.length;n++){const o=this.graphData.fakeLines[n];e.includes(o.id)&&(this.graphData.fakeLines.splice(n,1),n--,t++)}this.commits.fakeLinesListChanged=!0,C("_removeFakeLineByIds:",t)}removeLinkByLineIds(e){C("_removeLinkByLineIds:",e.length,e);let t=0;for(let n=0;n<this.runtimeDATA4Links.length;n++){const o=this.runtimeDATA4Links[n];e.includes(o.lineId)&&(this.runtimeDATA4Links.splice(n,1),this.runtimeDATA4LinkMap.delete(o.lineId),n--,t++)}this.commits.fakeLinesListChanged=!0,C("_removeLinkByLineIds:",t)}removeConnectTarget(e){const t=this.runtimeDATA4ConnectTargets.findIndex(n=>n.targetId===e);if(t!==-1){const n=this.runtimeDATA4ConnectTargets[t];(n.targetType===D.NodePoint||n.targetType===D.CanvasPoint)&&this.runtimeDATA4ConnectTargets.splice(t,1)}this.commits.connectTargetsListChanged=!0}updateLinks(e=[]){const t=new no;for(const n of this.runtimeDATA4Links){const{from:o,to:s}=n.line,a=t.addEdge(o,s);a!==n.currentLineIndex&&(n.currentLineIndex=a,this.commitLine(n.lineId))}for(const n of this.runtimeDATA4Links){const{from:o,to:s}=n.line,a=t.getCount(o,s);a!==n.totalLinesBetweenNodes&&(n.totalLinesBetweenNodes=a,this.commitLine(n.lineId))}t.clear()}beforeNodeBeRemove(e){let t=0;for(let n=0;n<this.runtimeDATA4Links.length;n++){const o=this.runtimeDATA4Links[n];(e.includes(o.fromNode.id)||e.includes(o.toNode.id))&&(this.removeLinkByLineIds([o.lineId]),n--,t++)}C("Removed Node link\uFF1A",e,t);for(let n=0;n<this.graphData.fakeLines.length;n++){const o=this.graphData.fakeLines[n];let s=!1;if(o.fromType===D.Node&&e.includes(o.from))s=!0;else if(o.fromType===D.CanvasPoint||o.fromType===D.NodePoint){const a=this.getConnectTargetById(o.from);a&&a.nodeId&&e.includes(a.nodeId)&&(s=!0)}else if(o.toType===D.CanvasPoint||o.toType===D.NodePoint){const a=this.getConnectTargetById(o.to);a&&a.nodeId&&e.includes(a.nodeId)&&(s=!0)}s&&(this.graphData.fakeLines.splice(n,1),n--,this.commits.fakeLinesListChanged=!0)}for(let n=0;n<this.runtimeDATA4ConnectTargets.length;n++){const o=this.runtimeDATA4ConnectTargets[n];o.nodeId&&e.includes(o.nodeId)&&(this.runtimeDATA4ConnectTargets.splice(n,1),this.commitConnectTarget(o.targetId),n--)}}addFakeLines(e){for(const t of e)if(t.id||console.warn("[relation-graph]Must have id for fake line:",t),this.graphData.fakeLines.some(n=>n.id===t.id))console.log("[relation-graph]Ignore duplicate fake line id:",t.id);else{t.isFakeLine=!0;const n=de(t,this.options);n.id||(n.id=ze(6)),this.graphData.fakeLines.push(n)}this.commits.fakeLinesListChanged=!0}clearFakeLines(){this.graphData.fakeLines.splice(0,this.graphData.fakeLines.length),this.commits.fakeLinesListChanged=!0}addNodes(e){for(const t of e)this.runtimeDATA4NodeMap.set(t.id,t);this.graphData.nodes.push(...e.map(t=>this.runtimeDATA4NodeMap.get(t.id))),this.commits.nodesListChanged=!0}addLines(e){this.graphData.normalLines.push(...e);const t=[];for(const n of e){const o=this.getNodeById(n.from),s=this.getNodeById(n.to),a={lineId:n.id,line:n,fromNode:o,toNode:s,currentLineIndex:0,totalLinesBetweenNodes:1,rgShouldRender:!0,rgCalcedVisibility:!0};this.runtimeDATA4LinkMap.set(a.lineId,a),t.push(a)}this.runtimeDATA4Links.push(...t.map(n=>this.runtimeDATA4LinkMap.get(n.lineId))),this.updateLinks(),this.commits.linesListChanged=!0}updateNode(e,t){const n=this.getNodeById(e);if(!n){console.error("Cannot find node to update:",e,t);return}const o=t.hidden!==void 0&&n.hidden!==t.hidden;if(Object.assign(n,t,{id:e}),o){const s=we.getDescendantNodes(n);this.updateNodesVisibleProperty([n].concat(s))}this.commitNode(e)}updateNodeData(e,t){const n=this.getNodeById(e);if(!n){console.error("Cannot find node to update:",e);return}this.updateNode(e,{data:Object.assign(n.data||{},t)})}updateLine(e,t){const n=this.getLineById(e);if(!n){this.updateFakeLine(e,t);return}Object.assign(n,t,{id:e}),this.commitLine(e)}updateLineData(e,t){const n=this.getLineById(e);if(!n){console.error("Cannot find line to update:",e);return}this.updateLine(e,{data:Object.assign(n.data||{},t)})}updateFakeLine(e,t){const n=this.getFakeLineById(e);if(!n){console.error("Cannot find fakeLine to update:",e,t);return}Object.assign(n,t,{id:e}),this.commitFakeLine(e)}updateConnectTarget(e,t){const n=this.getConnectTargetById(e);!n||(Object.assign(n,t,{targetId:e}),this.commitConnectTarget(e))}updateElLineTarget(e,t){const n=this.getElLineTargetById(e);!n||Object.assign(n,t,{id:e})}updateNodesVisibleProperty(e){let t=!1;e||(e=this.getNodes(),t=!0);for(const n of e){const o=we.isVisibleNode(n);n.rgCalcedVisibility!==o&&(n.rgCalcedVisibility=o,this.commitNode(n.id))}for(const n of this.runtimeDATA4Links)if(t||e.includes(n.fromNode)||e.includes(n.toNode)){const s=this.calcLinkVisibility(n);n.rgCalcedVisibility=s,this.commitLine(n.lineId)}}calcLinkVisibility(e){return e.fromNode.rgCalcedVisibility&&e.toNode.rgCalcedVisibility}updateShouldRenderGraphData(){const e=this.options,t=e.canvasZoom/100,n={x:-e.canvasOffset.x/t,y:-e.canvasOffset.y/t},o={x:n.x+e.viewSize.width/t,y:n.y+e.viewSize.height/t},s=e.snapshotting;for(const a of this.getNodes()){let d=!0;s||a.alwaysRender?d=!0:((a.x>o.x||a.y>o.y)&&(d=!1),(a.x+a.el_W<n.x||a.y+a.el_H<n.y)&&(d=!1)),a.rgShouldRender=d}for(const a of this.runtimeDATA4Links){if(s){a.rgShouldRender=!0;continue}a.rgShouldRender=a.fromNode.rgShouldRender||a.toNode.rgShouldRender}this.options.showEasyView?(this.runtimeDATA4ShouldRenderItems.nodes=[],this.runtimeDATA4ShouldRenderItems.lines=[],this.runtimeDATA4ShouldRenderItems.fakeLines=[]):(this.runtimeDATA4ShouldRenderItems.nodes=this.calcShouldRenderNodes(),this.runtimeDATA4ShouldRenderItems.lines=this.calcShouldRenderLines(),this.runtimeDATA4ShouldRenderItems.fakeLines=this.calcShouldRenderFakeLines())}addConnectTarget(e){return this.runtimeDATA4ConnectTargets.push(e),this.commits.connectTargetsListChanged=!0,this.commits.fakeLinesListChanged=!0,this.getConnectTargetById(e.targetId)}addElLineTarget(e){this.runtimeDATA4ElLineTargets.push(e),this.commits.fakeLinesListChanged=!0}setRootNodeId(e){if(this.graphData.rootNode=this.graphData.nodes.find(t=>t.id===e),!this.graphData.rootNode)throw new Error("The root node [rootId] is not set! Or cannot get the root node:"+e+", If you don't have any nodes to display, you can simply set an invisible node: {id:'root', opacity:0}")}}class so{constructor(){_(this,"listeners");_(this,"useReactiveDataToAutoUpdateView",!1);_(this,"instanceId");_(this,"dataProvider");_(this,"options");_(this,"_dataUpdatedRequested",!1);_(this,"eventHandlers",[]);_(this,"_emitHook");this.dataProvider=new ke,this.options=this.dataProvider.getOptions(),this.listeners={},this.instanceId="RG-"+this.generateNewUUID(5)}generateNewUUID(i=5){return ze(i)}enableDebugLog(i){this.dataProvider.updateOptions({debug:i}),window&&(window.relationGraphDebug=i)}_dataUpdated(){this._requestDataUpdate()}_requestDataUpdate(){!window||!window.requestAnimationFrame||this._dataUpdatedRequested||(this._dataUpdatedRequested=!0,requestAnimationFrame(this._doSomethingAfterDataUpdated.bind(this)))}_doSomethingAfterDataUpdated(){try{!this.useReactiveDataToAutoUpdateView||this.dataProvider.isPerformanceMode()?(this._previousUpdateTime=Date.now(),this.updateShouldRenderGraphData(),this.updateEasyView(),this.dataProvider&&this.dataProvider.dataUpdated()):this.updateMiniView()}catch(i){console.error("[relation-graph]Error:",i)}finally{this._dataUpdatedRequested=!1}}addEventHandler(i){this.eventHandlers.includes(i)||this.eventHandlers.push(i)}removeEventHandler(i){const e=this.eventHandlers.indexOf(i);e!==-1&&this.eventHandlers.splice(e,1)}setEventEmitHook(i){this._emitHook=i,console.warn("[setEventEmitHook]",this._emitHook)}emitEvent(i,...e){let{result:t,handled:n}=this.defaultEventHandler(i,...e);for(const o of this.eventHandlers){const s=o(i,...e);s!==void 0&&(t=s,n=!0)}if(n||this._emitHook&&this._emitHook(i,...e,o=>{o!==void 0&&(t=o)}),t!==void 0)return C("[custom event hook]Event:",i," => returnValue:",t),t}defaultEventHandler(i,...e){let t,n=!1;if(i===E.onReady)this.listeners.onReady&&(n=!0,this.listeners.onReady(this));else if(i===E.onNodeDragStart)this.listeners.onNodeDragStart&&(n=!0,this.listeners.onNodeDragStart(e[0],e[1]));else if(i===E.onNodeDragging){if(this.listeners.onNodeDragging){n=!0;const o=e[0],s=e[1],a=e[2],d=e[3],h=e[4],c=e[5];t=this.listeners.onNodeDragging(o,s,a,d,h,c)}}else if(i===E.onCanvasDragging){if(this.listeners.onCanvasDragging){n=!0;const o=e[0],s=e[1],a=e[2],d=e[3];t=this.listeners.onCanvasDragging(o,s,a,d)}}else if(i===E.onNodeDragEnd){const o=e[0],s=e[1],a=e[2],d=e[3];this.listeners.onNodeDragEnd&&(n=!0,this.listeners.onNodeDragEnd(o,s,a,d))}else if(i===E.onZoomEnd)this.listeners.onZoomEnd&&(n=!0,this.listeners.onZoomEnd());else if(i===E.onNodeClick){if(this.listeners.onNodeClick){n=!0;const o=e[0],s=e[1];this.listeners.onNodeClick(o,s)}}else if(i===E.onLineClick){if(this.listeners.onLineClick){n=!0;const o=e[0],s=e[1],a=e[2];this.listeners.onLineClick(o,s,a)}}else if(i===E.onNodeExpand){if(this.listeners.onNodeExpand){n=!0;const o=e[0],s=e[1];this.listeners.onNodeExpand(o,s)}}else if(i===E.onNodeCollapse){if(this.listeners.onNodeCollapse){n=!0;const o=e[0],s=e[1];this.listeners.onNodeCollapse(o,s)}}else if(i===E.onCanvasDragEnd){if(this.listeners.onCanvasDragEnd){n=!0;const o=e[0];this.listeners.onCanvasDragEnd(o)}}else if(i===E.onCanvasClick){if(this.listeners.onCanvasClick){n=!0;const o=e[0];this.listeners.onCanvasClick(o)}}else if(i===E.onCanvasSelectionEnd){if(this.listeners.onCanvasSelectionEnd){n=!0;const o=e[0],s=e[1];this.listeners.onCanvasSelectionEnd(o,s)}}else if(i===E.onContextmenu){if(this.listeners.onContextmenu){n=!0;const o=e[0],s=e[1],a=e[2],d=e[3],h=e[4];this.listeners.onContextmenu(o,s,a,d,h)}}else if(i===E.onFullscreen){if(this.listeners.onFullscreen){n=!0;const o=e[0],s=e[1];t=this.listeners.onFullscreen(o,s)}}else if(i===E.beforeAddNodes){if(this.listeners.beforeAddNodes){n=!0;const o=e[0];t=this.listeners.beforeAddNodes(o)}}else if(i===E.beforeAddLines){if(this.listeners.beforeAddLines){n=!0;const o=e[0];t=this.listeners.beforeAddLines(o)}}else if(i===E.onKeyboardDown){if(this.listeners.onKeyboardDown){n=!0;const o=e[0];t=this.listeners.onKeyboardDown(o)}}else if(i===E.onKeyboardUp){if(this.listeners.onKeyboardUp){n=!0;const o=e[0];t=this.listeners.onKeyboardUp(o)}}else if(i===E.onLineBeCreated){if(this.listeners.onLineBeCreated){n=!0;const o=e[0];t=this.listeners.onLineBeCreated(o)}}else if(i===E.onCanvasDragStart){if(this.listeners.onCanvasDragStart){n=!0;const o=e[0],s=e[1],a=e[2];t=this.listeners.onCanvasDragStart(o,s,a)}}else if(i===E.onResizeEnd){if(this.listeners.onResizeEnd){n=!0;const o=e[0],s=e[1],a=e[2],d=e[3];t=this.listeners.onResizeEnd(o,s,a,d)}}else if(i===E.onResizeStart){if(this.listeners.onResizeStart){n=!0;const o=e[0],s=e[1];t=this.listeners.onResizeStart(o,s)}}else if(i===E.beforeNodeResize){if(this.listeners.beforeNodeResize){n=!0;const o=e[0],s=e[1],a=e[2],d=e[3],h=e[4];t=this.listeners.beforeNodeResize(o,s,a,d,h)}}else if(i===E.onViewResize&&this.listeners.onViewResize){n=!0;const o=e[0];t=this.listeners.onViewResize(o)}return{result:t,handled:n}}setEventListener(i){Object.assign(this.listeners,i)}}class ao extends so{constructor(){super(...arguments);_(this,"$dom");_(this,"$canvasDom");_(this,"_rgAsConnectArea",!1);_(this,"$lineTextContainer4NormalLine");_(this,"$lineTextContainer4FakeLine");_(this,"viewBoundingClientRect",null)}getLineTextContainer(e){if(!(!e||!this.$canvasDom))return e.isFakeLine?(this.$lineTextContainer4NormalLine||(this.$lineTextContainer4NormalLine=this.$canvasDom.querySelector(".rg-lines-container-el-lines .rg-linetext-container"),this.dataStores.textContainer4NormalRef&&(this.dataStores.textContainer4NormalRef.value=this.$lineTextContainer4NormalLine)),this.$lineTextContainer4NormalLine):(this.$lineTextContainer4FakeLine||(this.$lineTextContainer4FakeLine=this.$canvasDom.querySelector(".rg-lines-container-normal-lines .rg-linetext-container"),this.dataStores.textContainer4FakeLineRef&&(this.dataStores.textContainer4FakeLineRef.value=this.$lineTextContainer4FakeLine)),this.$lineTextContainer4FakeLine)}getViewBoundingClientRect(){var t;if(!this.$dom)return this.viewBoundingClientRect||console.error("[getViewBoundingClientRect] RelationGraph DOM is not set yet!"),this.viewBoundingClientRect;const e=(t=this.$dom)==null?void 0:t.getBoundingClientRect();return this.viewBoundingClientRect=e,e}getBoundingClientRect(){return console.warn("Please use getViewBoundingClientRect instead of getBoundingClientRect, this method is compatible with older api versions."),this.getViewBoundingClientRect()}_getEventPoint(e){return this.getViewXyByEvent(e)}getViewXyByEvent(e){const t={x:e.clientX,y:e.clientY};if(ae(e)){const n=e.touches||e.targetTouches;if(!n)throw new Error("error targetTouches");t.x=n[0].clientX,t.x=n[0].clientY}return this.getViewXyByClientXy(t)}getViewXyByClientXy(e){const t=this.getViewBoundingClientRect();return{x:e.x-t.x,y:e.y-t.y}}getCanvasXyByClientXy(e){const t=this.getViewBoundingClientRect(),n={x:e.x-t.left,y:e.y-t.top};return this.getCanvasXyByViewXy(n)}getCanvasXyByViewXy(e){if(this._rgAsConnectArea)return e;const t=this.dataProvider.getOptions(),n=t.canvasZoom/100,o={x:e.x-t.canvasOffset.x,y:e.y-t.canvasOffset.y};return{x:o.x/n,y:o.y/n}}getViewXyByCanvasXy(e){const t=this.dataProvider.getOptions(),n=t.canvasZoom/100;return{x:e.x*n+t.canvasOffset.x,y:e.y*n+t.canvasOffset.y}}getCanvasCoordinateByClientCoordinate(e){return console.warn("Please use getCanvasXyByClientXy instead of getCanvasCoordinateByClientCoordinate, this method is compatible with older api versions."),this.getCanvasXyByClientXy(e)}isNode(e){const t=xe(e,"rg-node-peel","rg-map");if(!!t)return this.dataProvider.getNodeById(t.dataset.id)}isLine(e){const t=xe(e,"rg-line-peel","relation-graph");if(!!t)return this.dataProvider.getLineById(t.dataset.id)}isLink(e){throw new Error("Please use isLine")}}class ro extends ke{constructor(e,t,n,o){super();_(this,"dataStores");this.dataStores=e;const s=Object.assign({},this.options,n);this.options=n,Object.assign(this.options,s),this.graphData=t,this.runtimeDATA4Links=o.runtimeDATA4Links,this.runtimeDATA4ShouldRenderItems=o.runtimeDATA4ShouldRenderItems,this.runtimeDATA4ConnectTargets=o.runtimeDATA4ConnectTargets,this.runtimeDATA4NodeMap=o.runtimeDATA4NodeMap,this.runtimeDATA4LinkMap=o.runtimeDATA4LinkMap,this.runtimeDATA4ElLineTargets=o.runtimeDATA4ElLineTargets,this.updateViewHook=a=>{if(console.log("###########updateViewHook"),a.optionsChanged&&(this.dataStores.store4Options.set(this.getOptions()),console.log("[updateViewHook]optionsChanged")),a.nodesListChanged&&(this.dataStores.store4ShouldRenderNodes.set(this.getShouldRenderNodes()),console.log("[updateViewHook]nodesListChanged")),a.linesListChanged){const d=this.getShouldRenderLines();this.dataStores.store4ShouldRenderLines.set(d),console.log("[updateViewHook]linesListChanged")}if(a.fakeLinesListChanged){const d=this.getShouldRenderFakeLines();this.dataStores.store4ShouldRenderFakeLines.set(d),console.log("[updateViewHook]fakeLinesListChanged")}}}}class lo extends ke{constructor(i,e,t){super(),this.graphData=i,this.runtimeDATA4Links=t.runtimeDATA4Links,this.runtimeDATA4ShouldRenderItems=t.runtimeDATA4ShouldRenderItems,this.runtimeDATA4ConnectTargets=t.runtimeDATA4ConnectTargets,this.runtimeDATA4NodeMap=t.runtimeDATA4NodeMap,this.runtimeDATA4LinkMap=t.runtimeDATA4LinkMap,this.runtimeDATA4ElLineTargets=t.runtimeDATA4ElLineTargets;const n=Object.assign({},this.options,e);this.options=e,Object.assign(this.options,n)}}class co extends ke{constructor(e,t){super();_(this,"dataStores");this.dataStores=e,this.updateViewHook=n=>{n.optionsChanged&&this.dataStores.store4Options.set(this.getOptions()),(n.nodesListChanged||n.changedNodes.length>0)&&(this.dataStores.store4ShouldRenderNodes.set(this.getShouldRenderNodes()),console.log("[updateViewHook]nodesListChanged")),(n.linesListChanged||n.changedLines.length>0)&&(this.dataStores.store4ShouldRenderLines.set(this.getShouldRenderLines()),console.log("[updateViewHook]linesListChanged")),(n.fakeLinesListChanged||n.changedFakeLines.length>0)&&this.dataStores.store4ShouldRenderFakeLines.set([...this.getShouldRenderFakeLines()])}}}class ho extends ke{constructor(i,e){super(),e(),this.updateViewHook=t=>{if(t.optionsChanged&&i.store4Options.set(this.getOptions()),t.linesListChanged||t.changedLines.length>0||t.nodesListChanged||t.changedNodes.length>0){const n=this.getShouldRenderNodes();i.store4ShouldRenderNodes.set([...n])}if(t.linesListChanged||t.changedLines.length>0){const n=this.getShouldRenderLines();i.store4ShouldRenderLines.set(n)}t.fakeLinesListChanged?i.store4ShouldRenderFakeLines.set([...this.getShouldRenderFakeLines()]):t.changedFakeLines.length>0&&i.store4ShouldRenderFakeLines.set(this.getShouldRenderFakeLines())}}}class uo extends ao{constructor(){super();_(this,"_initRawPropertyFn",(e,t,n)=>{});_(this,"dataStores")}setReactiveData4Vue2(e,t,n,o){this.useReactiveDataToAutoUpdateView=!0,this.dataProvider=new lo(e,t,n),this._initRawPropertyFn=o,this.options=this.dataProvider.options,this.dataStores={shouldRenderNodesStore:n.runtimeDATA4ShouldRenderItems.nodes,shouldRenderLinesStore:n.runtimeDATA4ShouldRenderItems.lines,shouldRenderFakeLinesStore:n.runtimeDATA4ShouldRenderItems.fakeLines}}setReactiveData4Vue3(e,t,n,o,s){this.useReactiveDataToAutoUpdateView=!0,this.dataProvider=new ro(e,t,n,o),this._initRawPropertyFn=s,this.options=this.dataProvider.getOptions(),this.dataStores={optionsStore:e.store4Options,shouldRenderNodesStore:e.store4ShouldRenderNodes,shouldRenderLinesStore:e.store4ShouldRenderLines,shouldRenderFakeLinesStore:e.store4ShouldRenderFakeLines,optionsRef:e.optionsRef,shouldRenderNodesRef:e.shouldRenderNodesRef,shouldRenderLinesRef:e.shouldRenderLinesRef,shouldRenderFakeLinesRef:e.shouldRenderFakeLinesRef,textContainer4NormalRef:e.textContainer4NormalRef,textContainer4FakeLineRef:e.textContainer4FakeLineRef},console.error("[RelationGraphWith2Data] setReactiveData4Vue3:",this.options)}setReactiveData4React(e,t){this.dataProvider=new ho(e,t),this.options=this.dataProvider.getOptions(),this.dataStores={optionsStore:e.store4Options,shouldRenderNodesStore:e.store4ShouldRenderNodes,shouldRenderLinesStore:e.store4ShouldRenderLines,shouldRenderFakeLinesStore:e.store4ShouldRenderFakeLines}}setReactiveData4Svelte(e,t){this.dataProvider=new co(e,t),this.options=this.dataProvider.getOptions(),this.dataStores={optionsStore:e.store4Options,shouldRenderNodesStore:e.store4ShouldRenderNodes,shouldRenderLinesStore:e.store4ShouldRenderLines,shouldRenderFakeLinesStore:e.store4ShouldRenderFakeLines},console.log("[RelationGraphWith2Data] setReactiveData4Svelte:",this.options)}generateNewNodeId(e=5){const t=ze(e);return this.dataProvider.getNodeById(t)?this.generateNewNodeId(e+1):t}}class po extends uo{constructor(){super()}getOptions(){return this.dataProvider.getOptions()}getNodeById(i){return this.dataProvider.getNodeById(i)}getLineById(i){return this.dataProvider.getLineById(i)}getLinkByLineId(i){return this.dataProvider.getLinkByLineId(i)}getLinkByLine(i){return this.getLinkByLineId(i.id)}getLines(){return this.dataProvider.getLines()}getElementLineById(i){return this.getFakeLineById(i)}getElementLines(){return this.getFakeLines()}getFakeLines(){return this.dataProvider.getFakeLines()}getFakeLineById(i){return this.dataProvider.getFakeLineById(i)}getNodes(){return this.dataProvider.getNodes()}getLinks(){return this.dataProvider.getLinks()}_getAllLinks(){const i=this.getLinks();return this._getFakeLineLinks().concat(i)}getNodeByTargetId(i){const e=this.dataProvider.getConnectTargetById(i);if(e&&e.nodeId)return this.getNodeById(e.nodeId)}_getFakeLineLinks(){const i=[];for(const e of this.getFakeLines())if(!e.forDisplayOnly&&(e.fromType===D.Node||e.fromType===D.NodePoint||e.fromType===D.CanvasPoint)&&(e.toType===D.Node||e.toType===D.NodePoint||e.toType===D.CanvasPoint)){let t=null,n=null;e.fromType===D.Node?t=this.getNodeById(e.from):(e.fromType===D.NodePoint||e.fromType===D.CanvasPoint)&&(t=this.getNodeByTargetId(e.from)),e.toType===D.Node?n=this.getNodeById(e.to):(e.toType===D.NodePoint||e.toType===D.CanvasPoint)&&(n=this.getNodeByTargetId(e.to)),t&&n&&i.push({lineId:e.id,line:e,fromNode:t,toNode:n,totalLinesBetweenNodes:1,currentLineIndex:0,rgShouldRender:!0,rgCalcedVisibility:!0})}return i}getConnectTargets(){return this.dataProvider.getConnectTargets()}getConnectTargetById(i){return this.dataProvider.getConnectTargetById(i)}}class fo extends po{constructor(){super()}getRelatedLinesByNode(i){const e=[];for(const t of this._getAllLinks())(i===t.fromNode||i===t.toNode)&&e.push(t.line);return e}getLinksBetweenNodes(i){const e=[],t=this._getAllLinks();for(const n of t)i.includes(n.fromNode)&&i.includes(n.toNode)&&e.push(n);return e}getLinesBetweenNodes(i){return this.getLinksBetweenNodes(i).map(e=>e.line)}getNodeRelatedNodes(i,e={incoming:!0,outgoing:!0}){const t=[];for(const n of this.getLinks()){if(n.line.forDisplayOnly)continue;const{fromNode:o,toNode:s}=n;e.outgoing&&o===i&&(t.includes(s)||t.push(s)),e.incoming&&s===i&&(t.includes(o)||t.push(o))}for(const n of this._getFakeLineLinks()){if(n.line.forDisplayOnly)continue;const{fromNode:o,toNode:s}=n;e.outgoing&&o===i&&(t.includes(s)||t.push(s)),e.incoming&&s===i&&(t.includes(o)||t.push(o))}return t}getNodeIncomingNodes(i){return this.getNodeRelatedNodes(i,{incoming:!0,outgoing:!1})}getNodeOutgoingNodes(i){return this.getNodeRelatedNodes(i,{incoming:!1,outgoing:!0})}findGroupNodes(i,e=[]){return this._getNetworkNodesByNode(i,e)}getGroupNodesByNode(i,e=[]){return this._getNetworkNodesByNode(i,e)}getNetworkNodesByNode(i){return this._getNetworkNodesByNode(i)}_getNetworkNodesByNode(i,e=[]){if(!i)throw new Error("Call graphInstance.getNetworkNodesByNode:error: node is undefined");e.includes(i)||e.push(i);for(const t of this.getNodeRelatedNodes(i))e.includes(t)||this._getNetworkNodesByNode(t,e);return e}getStuffSize(i){return console.warn("Please use getNodesRectBox instead of getStuffSize, this method is compatible with older api versions."),this.getNodesRectBox(i)}getNodesViewInfo(i){return console.warn("Please use getNodesRectBox instead of getNodesViewInfo, this method is compatible with older api versions."),this.getNodesRectBox(i)}getNodesRectBox(i){const t=(i||this.getNodes()).filter(c=>c.rgCalcedVisibility!==!1);if(t.length===0)return{width:10,height:10,minX:0,minY:0,maxX:0,maxY:0};let n=9999999,o=9999999,s=-9999999,a=-9999999;t.forEach(c=>{c.x<n&&(n=c.x),c.x+(c.width||c.el_W)>s&&(s=c.x+(c.width||c.el_W)),c.y<o&&(o=c.y);const p=c.y+(c.height||c.el_H);p>a&&(a=p)});const d=s-n,h=a-o;return{width:d<0?0:d,height:h<0?0:h,minX:n===9999999?0:n,minY:o===9999999?0:o,maxX:s===-9999999?0:s,maxY:a===-9999999?0:a}}getNodesCenter(i){const e=this.getNodesRectBox(i);C("getNodesCenter:",e);const t=e.minX+(e.maxX-e.minX)/2,n=e.minY+(e.maxY-e.minY)/2;return{x:t,y:n}}getDescendantNodes(i){return we.getDescendantNodes(i)}getNodesInSelectionView(i){const e=this.getCanvasXyByViewXy({x:i.x,y:i.y}),t=this.getCanvasXyByViewXy({x:i.x+i.width,y:i.y+i.height}),n=[];return this.getNodes().forEach(o=>{const s=o.x+o.el_W/2,a=o.y+o.el_H/2;s>e.x&&a>e.y&&s<t.x&&a<t.y&&n.push(o)}),n}getShouldRenderNodes(i){return this.dataProvider.isPerformanceMode()&&i?i:this.dataProvider.getShouldRenderNodes()}getShouldRenderLines(i){return this.dataProvider.isPerformanceMode()&&i?i:this.dataProvider.getShouldRenderLines()}getShouldRenderFakeLines(i){return this.dataProvider.isPerformanceMode()&&i?i:this.dataProvider.getShouldRenderFakeLines()}}class go extends fo{constructor(){super();_(this,"_elLineUpdateTimer");_(this,"_canvasCurrentInfo",{x:0,y:0,scale:1});_(this,"_nodeResizeEffectTimer");_(this,"prevAddNodeTimestamp",0);_(this,"_nodesElSizeMap",new Map)}removeLine(e){this.removeLines([e])}removeLines(e){this.removeLineByIds(e.map(t=>t.id))}removeLineById(e){this.removeLineByIds([e])}removeLineByIds(e){this.dataProvider.removeLineByIds(e),this._dataUpdated()}removeFakeLine(e){this.removeFakeLineById(e.id)}removeFakeLineById(e){C("removeLineById:",e),this.dataProvider.removeFakeLineByIds([e]),this._dataUpdated()}removeLink(e){C("removeLink:",e),this.removeLinkByLineId(e.lineId)}removeLinkByLineId(e){this.dataProvider.removeLineByIds([e]),this._dataUpdated()}removeNodeById(e){this.dataProvider.removeNodeById([e]),this._dataUpdated()}removeNodesByIds(e){e.forEach(t=>this.dataProvider.removeNodeById(e)),this._dataUpdated()}removeNodes(e){this.dataProvider.removeNodeById(e.map(t=>t.id)),this._dataUpdated()}removeNode(e){this.dataProvider.removeNodeById([e.id]),this._dataUpdated()}removeELementLineById(e){C("removeELementLineById:",e),this.removeFakeLineById(e)}addNode(e){if(C("addNode:",e),e&&Array.isArray(e)){console.error("addNode: node is array:",e);return}this._addNodes([e]),this._dataUpdated()}addNodes(e){if(C("addNodes:",e),e&&!Array.isArray(e)){console.error("addNodes: nodes is not array:",e);return}this._addNodes(e),this._dataUpdated()}addLine(e){if(C("addLine:",e),e&&Array.isArray(e)){console.error("addLine: line is array:",e);return}this.addLines([e])}addLines(e){if(C("addLines:",e),e&&!Array.isArray(e)){console.error("addLines: lines is not array:",e);return}if(e.length===0)return;const t=e.filter(o=>!o.isFakeLine);this._addLines(t);const n=e.filter(o=>o.isFakeLine);this.addFakeLines(n),this._dataUpdated()}_addFakeLines(e){this.dataProvider.addFakeLines(e)}addFakeLines(e){C("addFakeLines:",e),this._addFakeLines(e),this._dataUpdated()}updateElementLines(){this.dataProvider.getElLineTargets().length!==0&&(C("updateElementLines:runtimeDATA4ElLineTargets:",this.dataProvider.getElLineTargets().length),this._elLineUpdateTimer&&clearTimeout(this._elLineUpdateTimer),this._elLineUpdateTimer=setTimeout(()=>{this._updateElementLines(),this._dataUpdated()},100))}_updateElementLines(){this._updateCanvasBoxInfo();for(const e of this.dataProvider.getElLineTargets())this.updateElementTarget(e)}_updateCanvasBoxInfo(){const e=this.$canvasDom.getBoundingClientRect();this._canvasCurrentInfo.x=e.x,this._canvasCurrentInfo.y=e.y,this._canvasCurrentInfo.scale=this.dataProvider.getOptions().canvasZoom/100}updateElementTarget(e){const t=this._getElementTargetPosition(document.getElementById(e.id),e);t?this.dataProvider.updateElLineTarget(e.id,{hidden:!1,...t}):this.dataProvider.updateElLineTarget(e.id,{hidden:!0})}_getElementTargetPosition(e){if(!e)return null;const t=e.getBoundingClientRect(),n=(t.x-this._canvasCurrentInfo.x)/this._canvasCurrentInfo.scale,o=(t.y-this._canvasCurrentInfo.y)/this._canvasCurrentInfo.scale,s=t.width/this._canvasCurrentInfo.scale,a=t.height/this._canvasCurrentInfo.scale;return{x:n,y:o,el_W:s,el_H:a}}addElementLines(e){C("addElementLines:",e),e.forEach(t=>{t.fromType=D.HTMLElementId,t.toType=D.HTMLElementId,t.isFakeLine=!0,t.id||(t.id=this.generateNewUUID(6)),t.forDisplayOnly=!0}),this.addFakeLines(e),console.log("addElementLines:",e.length,e),this.updateElementLines()}updateNodeOffsetSize(e,t,n){const o=this.getNodeById(e);if(!o)return;const s=o.el_W,a=o.el_H;(s!==t||a!==n)&&(this.dataProvider.updateNode(e,{el_W:t,el_H:n}),this._nodeResizeEffectTimer&&clearTimeout(this._nodeResizeEffectTimer),this._nodeResizeEffectTimer=setTimeout(()=>{this._dataUpdated()},100))}clearFakeLines(){this.dataProvider.clearFakeLines(),this._dataUpdated()}clearElementLines(){const e=[];for(const t of this.getFakeLines())(t.fromType===D.HTMLElementId||t.toType===D.HTMLElementId)&&e.push(t.id);this.dataProvider.removeFakeLineByIds(e),this._dataUpdated()}_addNodes(e){this.emitEvent(E.beforeAddNodes,e);const t={};this.getNodes().forEach(s=>{t[s.id]=s});const n=[],o=this.getOptions();e.forEach(s=>{let a=t[s.id];if(!a){let{text:d,id:h}=s;!d&&s.label&&(d=s.label,console.warn('Use "label" as "text":',s.label)),d===void 0&&h&&(d=h,console.warn('Use "id" as "text":',h)),a=Ne(Object.assign({},s,{text:d}),o,this._nodesElSizeMap),this._initRawPropertyFn&&this._initRawPropertyFn(a,"lot",a.lot),a&&(t[a.id]=a,n.push(a))}}),this.dataProvider.addNodes(n),n.length>0&&(this.prevAddNodeTimestamp=Date.now())}_addLines(e){this.emitEvent(E.beforeAddLines,e);const t=[];e.forEach(n=>{let{from:o,to:s,text:a}=n;if(!o)if(n.source)o=n.source,console.warn('Use "source" as "from":',n.source);else{console.error('JsonLine Must have field:"from"',n);return}if(!s)if(n.target)s=n.target,console.warn('Use "target" as "to":',n.target);else{console.error('JsonLine Must have field:"to"',n);return}if(a||n.label&&(a=n.label,console.warn('Use "label" as "text":',n.label)),!this.getNodeById(o)){console.error("Can not found from node:",n);return}if(!this.getNodeById(s)){console.error("Can not found to node:",n);return}if(n.id){if(this.getLineById(n.id)){console.warn("_addLines:skip duplicate line id:",n.id);return}else if(t.some(p=>p.id===n.id)){console.warn("Duplicate line id in new lines:",n.id);return}}else n.id="L-"+this.generateNewUUID(6);const c=de(Object.assign({},n,{from:o,to:s,text:a}),this.getOptions());t.push(c)}),this.dataProvider.addLines(t)}updateNode(e,t){this.dataProvider.updateNode(typeof e=="string"?e:e.id,t),this._dataUpdated()}updateNodePosition(e,t,n){var s;const o=typeof e=="string"?e:e.id;this.dataProvider.updateNode(o,{x:t,y:n}),this.getOptions().layout.autoLayouting&&((s=this.layoutor)==null||s.syncNodePosition(o,t,n)),this._dataUpdated()}updateNodeData(e,t){this.dataProvider.updateNodeData(typeof e=="string"?e:e.id,t),this._dataUpdated()}updateLine(e,t){this.dataProvider.updateLine(typeof e=="string"?e:e.id,t),this._dataUpdated()}updateLineData(e,t){this.dataProvider.updateLineData(typeof e=="string"?e:e.id,t),this._dataUpdated()}updateFakeLine(e,t){this.dataProvider.updateFakeLine(typeof e=="string"?e:e.id,t),this._dataUpdated()}flatNodeData(e,t,n,o){we.flatNodeData(e,t,n,o)}backupNodesElSize(){for(const e of this.getNodes())this._nodesElSizeMap.set(e.id,[e.el_W,e.el_H])}loadGraphJsonData(e){e.lines||(e.lines=e.relations,e.lines&&console.warn("[relation-graph] For compatibility with older version, Use jsonData.relations as jsonData.lines, It is recommended that you define your data using")),e.lines||(e.lines=e.links||e.edges,e.lines&&console.warn("[relation-graph] For compatibility with older version, Use jsonData.links/jsonData.edges as jsonData.lines, It is recommended that you define your data using"));const t=e.nodes||[],n=e.lines||[],o=[],s=[];this.flatNodeData(t,null,o,s),n.forEach(a=>{s.push(a)}),this._addNodes(o),C("Nodes is initialized"),this._addLines(s),this._dataUpdated(),e.fakeLines&&this.addFakeLines(e.fakeLines),setTimeout(()=>{e.elementLines&&(console.warn("elementLines is deprecated, please use fakeLines with isFakeLine and fromType/toType = RGInnerConnectTargetType.HTMLElementId instead:",e.elementLines),this.addElementLines(e.elementLines)),this._dataUpdated()},500)}updateShouldRenderGraphData(e=!1){!e&&!this.dataProvider.isPerformanceMode()||this.dataProvider.updateShouldRenderGraphData()}updateNodesVisibleProperty(e){this.dataProvider.updateNodesVisibleProperty(e)}updateVisibleNodesSize(){for(const e of this.getShouldRenderNodes()){const t=this.getNodeElByNodeId(e.id);t&&this._onNodeDomResize(t,t.clientWidth,t.clientHeight)}}_clearGraph(){this.backupNodesElSize(),this.dataProvider.clearReactiveData(),this.dataProvider.clearChecked(),this.dataProvider.setEditingLine(null),this.dataProvider.setEditingNodes([])}_setJsonData(e,t=!1){this._clearGraph(),this.loadGraphJsonData(e)}}class mo extends go{constructor(){super();_(this,"canvasConnectTargetsMap",new Map);_(this,"nodeConnectTargetsMap",new Map);_(this,"connectTargetElementMap",new Map);_(this,"_connectTargetUpdateRequestedSet",new Map);_(this,"_updateTimer");_(this,"_removedConnectTargetMap",new Map)}updateConnectTargetsOnCanvas(e,t){if(!t)return;console.warn(`updateConnectTargetsOnCanvas:[${e}]:`);const n=t.classList.contains("rg-canvas-slot-above")?"above":"behind",o=this.canvasConnectTargetsMap.get(n);o&&o.length>0&&this.updateConnectTargetList(e,t,o)}updateConnectTargetsByNodeId(e){const t=this.getNodeElByNodeId(e);this.updateConnectTargetsOnNode("API",e,t)}getNodeElByNodeId(e){return this.$dom.querySelector(`[data-id="${e}"]`)}updateConnectTargetsOnNode(e,t,n){const o=this.nodeConnectTargetsMap.get(t)||[];o.length!==0&&this.updateConnectTargetList(e,n,o)}updateConnectTargetList(e,t,n){const o=this.dataProvider.getCanvasScale();for(const s of n){const a=this.connectTargetElementMap.get(s.targetId);if(!a){console.error("Can not find el for connectTarget:",s.targetId,s);continue}this._requestUpdateConnectTargetOffset(e,s,a,t,o)}}_requestUpdateConnectTargetOffset(e,t,n,o,s){this._connectTargetUpdateRequestedSet.set(t.targetId,{stableTimes:0,connectTarget:t,by:e,connectTargetEl:n,relativeEl:o}),clearTimeout(this._updateTimer),this._updateTimer=setTimeout(()=>{this._updateAllRequestedConnectTargetOffsets()},Math.min(this._connectTargetUpdateRequestedSet.size+10,50))}_updateAllRequestedConnectTargetOffsets(){let e=0,t=0;for(const n of this._connectTargetUpdateRequestedSet.values()){const{by:o,connectTargetEl:s,relativeEl:a,connectTarget:d}=n;if(this.dataProvider.isPerformanceMode()&&d.nodeId){const p=this.getNodeById(d.nodeId);if(!p||!p.rgShouldRender||!p.rgCalcedVisibility){t++;continue}}if(!this.dataProvider.getConnectTargetById(d.targetId))continue;const c=this.dataProvider.getCanvasScale();this._updateConnectTargetOffset(o,d,s,a,c)?e++:n.stableTimes++,n.stableTimes>2&&this._connectTargetUpdateRequestedSet.delete(d.targetId)}e>0?(console.warn(`_updateAllRequestedConnectTargetOffsets: ${e} of ${this._connectTargetUpdateRequestedSet.size} changed, ${t} Skipped!`),clearTimeout(this._updateTimer),this._updateTimer=setTimeout(()=>{this._updateAllRequestedConnectTargetOffsets()},Math.min(e/2+10,100)),this._dataUpdated()):(console.warn("_updateAllRequestedConnectTargetOffsets:::::::OK",this._connectTargetUpdateRequestedSet.size),this._connectTargetUpdateRequestedSet.clear(),this._dataUpdated())}_updateConnectTargetOffset(e,t,n,o,s){const a=o.getBoundingClientRect(),d=n.getBoundingClientRect(),h=Math.round(d.x-a.x),c=Math.round(d.y-a.y),u=this.dataProvider.getCanvasScale(),p=Math.round(h/u),m=Math.round(c/u),f=Math.round(d.width/u),g=Math.round(d.height/u),y=t.offsetX!==p,v=t.offsetY!==m,x=f!==0&&t.width!==f,L=g!==0&&t.height!==g;return y||v||x||L?(this.dataProvider.updateConnectTarget(t.targetId,{offsetX:p,offsetY:m,width:f,height:g}),!0):!1}_onConnectTargetMounted(e,t,n,o){const s=this.dataProvider.getCanvasScale();this._requestUpdateConnectTargetOffset(e,t,n,o,s)}getNodeElByChildrenTarget(e){return xe(e,"rg-node-peel","rg-map")}registerConnectTarget(e,t,n,o,s={}){if(n!==D.NodePoint&&n!==D.CanvasPoint)return;if(!e){console.error(`[registerConnectTarget]Can not find CanvasPoint target DOM: ${t}`);return}const a=this.getNodeElByChildrenTarget(e),d=a==null?void 0:a.dataset.id;if(d==="rg-newNodeTemplate")return;let h=this.dataProvider.getConnectTargetById(t);if(!h){const u={targetId:t,targetType:n,junctionPoint:o,nodeId:"",width:20,height:20,offsetX:0,offsetY:0,offsetPercentX:0,offsetPercentY:0,targetData:s||{}};this.reuseConnectTarget(u),h=this.dataProvider.addConnectTarget(u)}return this.connectTargetElementMap.set(h.targetId,e),(d?this.getNodeById(d):null)?this._addConnectTargetToNodeMap(d,h,e,a):this._addConnectTargetToCanvasMap(h,e),h}_addConnectTargetToNodeMap(e,t,n,o){this.dataProvider.updateConnectTarget(t.targetId,{junctionPoint:t.junctionPoint,targetType:D.NodePoint,nodeId:e,targetData:Object.assign({},t.targetData||{},{nodeId:e})});let s=this.nodeConnectTargetsMap.get(e);s?s.some(a=>a.targetId===t.targetId)||s.push(t):this.nodeConnectTargetsMap.set(e,[t]),this._onConnectTargetMounted("NT-Mounted",t,n,o)}_addConnectTargetToCanvasMap(e,t){let n=xe(t,"rg-canvas-slot","rg-map");if(!!n&&n){const o=n.classList.contains("rg-canvas-slot-above")?"above":"behind";this.dataProvider.updateConnectTarget(e.targetId,{junctionPoint:e.junctionPoint,targetType:D.CanvasPoint,targetData:Object.assign({},e.targetData||{})});const s=this.canvasConnectTargetsMap.get(o);s?s.some(a=>a.targetId===e.targetId)||s.push(e):this.canvasConnectTargetsMap.set(o,[e]),this._onConnectTargetMounted("CT-Mounted",e,t,n)}}unregisterConnectTarget(e){const t=this.dataProvider.getConnectTargetById(e);if(!t)return;let n;if(t.nodeId&&this.nodeConnectTargetsMap.has(t.nodeId))n=this.nodeConnectTargetsMap.get(t.nodeId);else{const o=this.canvasConnectTargetsMap.get("behind");if(o){let s=o.findIndex(a=>a.targetId===e);s!==-1?n=this.canvasConnectTargetsMap.get("behind"):(s=this.canvasConnectTargetsMap.get("above").findIndex(a=>a.targetId===e),s!==-1&&(n=this.canvasConnectTargetsMap.get("above")))}}if(n){const o=n.findIndex(s=>s.targetId===e);o!==-1&&n.splice(o,1)}this.dataProvider.removeConnectTarget(e),this.connectTargetElementMap.delete(e),this._removedConnectTargetMap.set(t.targetId,t)}reuseConnectTarget(e){if(this._removedConnectTargetMap.has(e.targetId)){const t=this._removedConnectTargetMap.get(e.targetId);e.offsetX=t.offsetX,e.offsetY=t.offsetY,e.width=t.width,e.height=t.height,e.offsetPercentX=t.offsetPercentX,e.offsetPercentY=t.offsetPercentY,this._removedConnectTargetMap.delete(e.targetId)}}}class yo extends mo{constructor(){super();_(this,"fakeLineTargetRender")}generateCreatingLineConfig(e){e||(e=this.dataProvider.getOptions());const{newLinkTemplate:t,newLineTemplate:n}=e,o=t.fromNode;if(!o)return{line:n,from:null,to:null,totalLinesBetweenNodes:1,currentLineIndex:0};const s=t.toNode,a=s.targetType===D.Node?t.toNode:this.getFakeLineTarget(s.targetType,s.id,n);return{line:Object.assign({},n,{isFakeLine:!1}),from:this.getFakeLineTarget(o.targetType,o.id,n),to:a,totalLinesBetweenNodes:1,currentLineIndex:0}}generateLineConfig(e){const t=this.getLinkByLine(e);return!t||!t.rgCalcedVisibility?!1:{line:t.line,from:t.fromNode,to:t.toNode,totalLinesBetweenNodes:t.totalLinesBetweenNodes,currentLineIndex:t.currentLineIndex}}generateFakeLineConfig(e){let t=1,n=0;if(e.fromType===D.HTMLElementId&&e.toType===D.HTMLElementId){const a=this.dataProvider.getFakeLines().filter(d=>d.from===e.from&&d.to===e.to);a.length>1&&(console.warn("sameTargetLines element-line:",e),t=a.length,n=a.indexOf(e))}let o=this.getFakeLineTarget(e.fromType,e.from,e),s=this.getFakeLineTarget(e.toType,e.to,e);return!o&&e.fromType===D.Node?(console.error("[generateFakeLineConfig]error fakeLine from:",e.fromType,e.from,e),!1):!s&&e.fromType===D.Node?(console.error("[generateFakeLineConfig]error fakeLine to:",e.toType,e.to,e),!1):{line:e,from:o,to:s,totalLinesBetweenNodes:t,currentLineIndex:n}}setFakeLineTargetRender(e){this.fakeLineTargetRender=e}getFakeLineTarget(e,t,n){if(e===D.HTMLElementId){let o=this.dataProvider.getElLineTargets().find(s=>s.id===t);return o||(o={x:300,y:300,targetType:D.HTMLElementId,nodeShape:1,id:t,el_W:40,el_H:40,hidden:!0},this.dataProvider.addElLineTarget(o),this.updateElementLines()),o.hidden?null:o}else{if(e===D.Node)return this.getNodeById(t);if(e===D.NodePoint||e===D.CanvasPoint){const o=this.dataProvider.getConnectTargetById(t);if(!o)return;if(o.nodeId){const s=this.getNodeById(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_W+o.offsetX,y:s.y+o.offsetPercentY*s.el_H+o.offsetY,targetType:D.NodePoint,targetData:o.targetData,nodeShape:0,id:t,el_W:o.width,el_H:o.height,hidden:!1}}else return{x:o.offsetX,y:o.offsetY,targetType:D.CanvasPoint,targetData:o.targetData,nodeShape:0,id:t,el_W:o.width,el_H:o.height,hidden:!1}}}if(this.fakeLineTargetRender)return this.fakeLineTargetRender(e,t,n)}}class vo extends yo{constructor(){super()}_updateOptions(i){!i.instanceId&&this.getOptions().instanceId!==i.instanceId&&(i.instanceId=this.instanceId);const e=Object.assign({},i);if(e.layouts)throw new Error('Graph options do not support setting layouts properties, Please use "layout"!');if(e.lineUseTextPath)throw new Error('Graph options do not support setting layouts properties, Please use "defaultLineTextOnPath"!');if(e.debug!==void 0){const t=e.debug===!0;t&&C("RGOptions:user instance options:",e),window&&(window.relationGraphDebug=t)}e.layout?(this.dataProvider.updateOptions({...e,layout:{...this.getOptions().layout,...e.layout}}),this.layoutor&&this.layoutor.updateOptions&&this.layoutor.updateOptions(e.layout)):this.dataProvider.updateOptions(e)}resetViewSize(i=!1){const e=this.getViewBoundingClientRect(),t={};t.viewSize={width:e.width,height:e.height},this._rgAsConnectArea?(t.canvasZoom=100,t.canvasOffset={x:0,y:0}):i&&(t.canvasZoom=100,t.canvasOffset={x:t.viewSize.width/2,y:t.viewSize.height/2}),this.dataProvider.updateOptions(t),C("resetViewSize:1:",t),this._dataUpdated()}loading(i=""){this.dataProvider.updateOptions({graphLoading:!0,graphLoadingText:i}),this._dataUpdated()}clearLoading(){this.dataProvider.updateOptions({graphLoading:!1,graphLoadingText:""}),this._dataUpdated()}setCheckedNode(i){this.dataProvider.updateOptions({checkedNodeId:i?typeof i=="string"?i:i.id:""}),this._dataUpdated()}setCheckedLine(i){this.dataProvider.updateOptions({checkedLineId:i?typeof i=="string"?i:i.id:""})}clearChecked(){this.dataProvider.clearChecked(),this._dataUpdated()}clearSelected(){const i=this.getNodes().filter(n=>n.selected),e=this.getLines().filter(n=>n.selected),t=this.getFakeLines().filter(n=>n.selected);i.forEach(n=>this.dataProvider.updateNode(n.id,{selected:!1})),e.forEach(n=>this.dataProvider.updateLine(n.id,{selected:!1})),t.forEach(n=>this.dataProvider.updateFakeLine(n.id,{selected:!1})),this._dataUpdated()}setCanvasOffset(i,e){this.dataProvider.setCanvasOffset(i,e),this._updateEditingControllerView(),this.updateShouldRenderGraphData(),this._dataUpdated()}setCanvasMoveMode(i){this.dataProvider.updateOptions({canvasMoveMode:i}),this._dataUpdated()}onMiniViewMounted(){this.dataProvider.updateOptions({showMiniView:!0}),this._dataUpdated()}onMiniViewUnMounted(){this.dataProvider.updateOptions({showMiniView:!1})}onReferenceLineMounted(i){this.dataProvider.updateOptions({referenceLineAdsorption:i||!1,showReferenceLine:!0})}onReferenceLineUnMounted(){this.dataProvider.updateOptions({referenceLineAdsorption:!1,showReferenceLine:!1})}}class xo extends vo{constructor(){super()}getCreatingLine(i){if(i||(i=this.getOptions()),!i.creatingLinePlot)return{creating:!1};const{line:e,from:t,to:n}=this.generateCreatingLineConfig();return{creating:!0,fromTarget:t,toTarget:n,lineJson:e}}getCreatingNode(i){return i||(i=this.getOptions()),i.creatingNodePlot?{creating:i.creatingNodePlot,nodeJson:i.newNodeTemplate}:{creating:!1}}}const Co=l=>{const i=Math.sin(l)*1e4;return i-Math.floor(i)},je=(l,i,e,t,n,o)=>{const a=e-l,d=t-i,h=Math.sqrt(a*a+d*d),c=Math.max(2,Math.floor(h/12)),u=-d/h,p=a/h,m=[{type:"M",x:l,y:i}];let f=l,g=i;for(let y=1;y<=c;y++){let v=l+a*y/c,x=i+d*y/c;if(y<c){const L=Co(n+y)-.5;v+=u*L*o,x+=p*L*o}m.push({type:"l",dx:v-f,dy:x-g}),f=v,g=x}return m},Lo=(l,i={x:0,y:0,rotate:0})=>{const{fx:e,fy:t,tx:n,ty:o}=l;i.rotate=J.getTextAngle(e,t,n,o),i.x=e+(n-e)/2,i.y=t+(o-t)/2,Number.isNaN(i.rotate)&&(i.rotate=0);const s=e+t+n+o,a=je(e,t,n,o,s,2.5),d=je(e,t,n,o,s+99,1.5),h=`${re(a)} ${re(d)}`;return{pathCommands:[...a,...d],pathData:h,textPosition:i,points:[]}};class wo extends xo{constructor(){super()}_getJunctionPoint(i,e){return i===H.border?J.getBorderPoint4MultiLine(e):i===H.ltrb?J.getRectJoinPoint(e):i===H.tb?J.getRectVJoinPoint(e):i===H.lr?J.getRectHJoinPoint(e):i===H.left?J.getRectLeftJoinPoint(e):i===H.right?J.getRectRightJoinPoint(e):i===H.top?J.getRectTopJoinPoint(e):i===H.bottom?J.getRectBottomJoinPoint(e):i==="horizontalLine"?J.getRectHorizontalLineJoinPoint(e):i==="verticalLine"?J.getRectVerticalLineLineJoinPoint(e):J.getBorderPoint4MultiLine(e)}createLinePath(i,e,t){throw new Error("createLinePath() is deprecated, please use createLineDrawInfo() instead.")}createLineDrawInfo(i,e){let t,n,o=1,s=0;if(i&&(s=i.currentLineIndex,o=i.totalLinesBetweenNodes),i)t=i.fromNode,n=i.toNode;else{const a=e;if(t=this.getFakeLineTarget(a.fromType,a.from,a),n=this.getFakeLineTarget(a.toType,a.to,a),!t){console.error("Invalid line configuration:error from:",e);return}if(!n){console.error("Invalid line configuration:error to:",e);return}}return this.generateLinePath({line:e,from:t,to:n,totalLinesBetweenNodes:o,currentLineIndex:s})}_getLineDefaultOptions(){const i=this.getOptions();return{layoutDirection:i.layout.layoutDirection,multiLineDistance:i.multiLineDistance,defaultJunctionPoint:i.defaultJunctionPoint,lineRadius:i.defaultPolyLineRadius,defaultLineJunctionOffset:i.defaultLineJunctionOffset,defaultNodeShape:i.defaultNodeShape}}generateLinePath(i){i.totalLinesBetweenNodes===void 0&&(i.totalLinesBetweenNodes=1),i.currentLineIndex===void 0&&(i.currentLineIndex=0),i.defaultOptions===void 0&&(i.defaultOptions=this._getLineDefaultOptions());try{const e=this.withLineJunctionPoints(i);return this.createLinePathData(e)}catch(e){if(e.rgError)return this.createErrorLineValue(e.errorCode,e.x,e.y);throw e}}throwLineError(i,e,t){return{rgError:!0,errorCode:i,x:e,y:t}}createErrorLineValue(i,e,t){const n={x:0,y:0,rotate:0},o=[{type:"M",x:0,y:0},{type:"l",dx:e,dy:t}];return{pathCommands:o,pathData:re(o),textPosition:n,points:[]}}withLineJunctionPoints({line:i,from:e,to:t,totalLinesBetweenNodes:n,currentLineIndex:o,defaultOptions:s}){if(!e||!t)throw C("error from-to:",e,t),this.throwLineError("F",-10,0);let a=i.lineShape||1;const d=i.lineDirection||s.layoutDirection||"h";let h=e.x||0,c=e.y||0,u=t.x||0,p=t.y||0;if(Number.isNaN(h)||Number.isNaN(c))throw C("error start node:",e.text,e.x,e.y),this.throwLineError("A",-10,-10);if(Number.isNaN(u)||Number.isNaN(p))throw C("error end point:",t.text,t.x,t.y),this.throwLineError("B",10,-10);let m=e.el_W||60,f=e.el_H||60;if(Number.isNaN(m)||Number.isNaN(f))throw this.throwLineError("C",-10,10);let g=t.el_W||60,y=t.el_H||60;if(Number.isNaN(g)||Number.isNaN(y))throw this.throwLineError("D",10,10);if(h===0&&u===0&&c===0&&p===0)throw this.throwLineError("D",10,10);const v=u-h+(p-c)>0,x=i.isReverse?t:e,L=i.isReverse?e:t,N=Le(x.nodeShape,s.defaultNodeShape),T=i.junctionOffset||s.defaultLineJunctionOffset||0;h-=T,c-=T,u-=T,p-=T,m+=T*2,f+=T*2,g+=T*2,y+=T*2;const O={from_x:h,from_y:c,to_x:u,to_y:p,f_W:m,f_H:f,t_W:g,t_H:y,nodeShape:N,isReverse:v,isEndPoint:!1,totalLinesBetweenNodes:n,currentLineIndex:o,lineDistance:s.multiLineDistance||30},b=Le(L.nodeShape,s.defaultNodeShape),k={from_x:u,from_y:p,to_x:h,to_y:c,f_W:g,f_H:y,t_W:m,t_H:f,nodeShape:b,isReverse:v,isEndPoint:!0,totalLinesBetweenNodes:n,currentLineIndex:o,lineDistance:s.multiLineDistance||50},P=s.defaultJunctionPoint||H.border;let S=i.fromJunctionPoint||P,R=i.toJunctionPoint||P,M=i.fromJunctionPointOffsetX||0,w=i.fromJunctionPointOffsetY||0,I=i.toJunctionPointOffsetX||0,V=i.toJunctionPointOffsetY||0;i.isReverse&&([S,R]=[R,S],[M,w,I,V]=[I,V,M,w]),(e===t||h===0&&u===0&&c===0&&p===0)&&M===0&&w===0&&I===0&&V===0&&((a===$.StandardStraight||a===$.Curve2||a===$.Curve3||a===$.SimpleOrthogonal||a===$.Curve5)&&(a=$.StandardCurve),V=20);const A=this._getJunctionPoint(S,O);A.x+=M,A.y+=w;const z=this._getJunctionPoint(R,k);if(z.x+=I,z.y+=V,!A||!z)throw this.throwLineError("E",-20,-20);const G=h+m/2,W=c+f/2,U=u+g/2,ne=p+y/2;S==="horizontalLine"?(A.x=z.x,(a===44||a===49)&&(A.x+=(z.x>U?1:-1)*30)):S==="verticalLine"&&(A.y=z.y,(a===44||a===49)&&(A.y+=(z.y>ne?1:-1)*30)),R==="horizontalLine"?(z.x=A.x,(a===44||a===49)&&(z.x+=(A.x>G?1:-1)*30)):R==="verticalLine"&&(z.y=A.y,(a===44||a===49)&&(z.y+=(A.y>W?1:-1)*30));const ee=A.x,te=A.y,Q=z.x,Z=z.y;if(Number.isNaN(ee)||Number.isNaN(te))throw C("error start point:",e.text),this.throwLineError("F",-10,0);if(Number.isNaN(Q)||Number.isNaN(Z))throw C("error end point:",t.text),this.throwLineError("G",10,0);return{line:i,totalLinesBetweenNodes:n,currentLineIndex:o,lineDirection:d==="v"?"v":"h",lineShape:a,lineRadius:s.lineRadius||0,fromJunctionPoint:S,toJunctionPoint:R,fx:ee,fy:te,fcx:G,fcy:W,f_W:m,f_H:f,tx:Q,ty:Z,tcx:U,tcy:ne,t_W:g,t_H:y}}createLinePathData(i){const{lineShape:e}=i;let t;return e===$.SimpleOrthogonal?t=Un(i,void 0,this._getLineDefaultOptions()):e===$.StandardOrthogonal?t=qn(i,void 0,this._getLineDefaultOptions()):e===$.HardOrthogonal?t=Zn(i,void 0,this._getLineDefaultOptions()):e===$.StandardCurve?t=Kn(i):e===$.Curve2||e===$.Curve3||e===$.Curve5||e===$.Curve7?t=Qn(i):e===$.Curve8?t=Lo(i):t=Wn(i),t}getArrowMarkerId(i,e=!1){let t=i.showStartArrow===!0,n=i.showEndArrow!==!1;if(i.isReverse&&([t,n]=[n,t]),e){if(!t)return;if(i.startMarkerId)return`url('#${i.startMarkerId}')`}else{if(!n)return;if(i.endMarkerId)return`url('#${i.endMarkerId}')`}return`url('#${this.getLineArrow(i.color,e,!1)}')`}getLineArrow(i,e=!1,t=!1){const n=e?"start-":"";return`${this.getOptions().instanceId}-${n}arrow-default`}getTextTransform(i,e){if(!i||!e)return"translate(0,0)";const{x:t,y:n,rotate:o}=e;if(Number.isNaN(t)||Number.isNaN(n))return"translate(0,0)";const s=this.getOptions(),a=i.textOffsetX||s.defaultLineTextOffsetX||0,d=i.textOffsetY||s.defaultLineTextOffsetY||0,h=i.lineShape||1;return h===$.StandardStraight||h===$.SimpleOrthogonal?`translate(-50%, -50%) translate(${t+a}px,${n+d}px) rotate(${o||0}deg)`:`translate(-50%, -50%) translate(${t+a}px,${n+d}px)`}generateLineTextStyle(i,e){const t=this.getOptions(),n={transform:"",transformOrigin:""};if(!i||!e)return{cssStyles:n};const{line:o}=i,{textPosition:s}=e;if(!o||!s)return{cssStyles:n};let a=o.text||"";a.length>t.lineTextMaxLength&&(a=a.substring(0,t.lineTextMaxLength||15)+"...");const{x:d,y:h,rotate:c}=s;if(Number.isNaN(d)||Number.isNaN(h))return{text:a,cssStyles:n};const u=[],p=o.textAnchor||"center";p==="start"?u.push("translate(0%, -50%)"):p==="end"?u.push("translate(-100%, -50%)"):u.push("translate(-50%, -50%)"),u.push(`translate(${d}px,${h}px)`);const m=o.textOffsetX||t.defaultLineTextOffsetX||0,f=o.textOffsetY||t.defaultLineTextOffsetY||0,g=o.lineShape||1;return(o.useTextOnPath||t.defaultLineTextOnPath)&&g===1&&c&&u.push(`rotate(${c||0}deg)`),g===$.StandardStraight?(n.transformOrigin="50% 50%",u.push(`translate(${m}px,${f}px)`)):u.push(`translate(${m}px,${f}px)`),n.transform=u.join(" "),{text:a,cssStyles:n}}generateLineTextStyle4TextOnPath(i){const{line:e,from:t,to:n}=i;let o=e.text;if(!o||!n||!t)return null;let s=0;const a=this.getOptions();o.length>a.lineTextMaxLength&&(o=o.substring(0,a.lineTextMaxLength||15)+"...");const d=e.textOffsetX||a.defaultLineTextOffsetX||0,h=e.textOffsetY||a.defaultLineTextOffsetY||0,c={x:d,y:h-6};let u="50%";e.placeText==="start"?(u="0%",c.x+=20):e.placeText==="end"?(u="100%",c.x-=20):e.placeText==="center"?u="50%":e.placeText&&(u=e.placeText);let p="middle";return e.textAnchor&&(p=e.textAnchor),{text:o,textOffset:c,textAnchor:p,onPathStartOffset:u,textRotate:s}}}class _o extends wo{constructor(){super()}zoom(i,e,t){if(this._rgAsConnectArea)return;const n=this.getOptions();try{const o=this.emitEvent(E.beforeZoomStart,n.canvasZoom,i,t);if(C("[zoom]","abortZoom:",o),o===!0)return;if(n.canvasZoom+i<n.minCanvasZoom){if(C("zoom:minCanvasZoom"),i=n.minCanvasZoom-n.canvasZoom,i===0)return}else if(n.canvasZoom+i>n.maxCanvasZoom&&(C("zoom:maxCanvasZoom"),i=n.maxCanvasZoom-n.canvasZoom,i===0))return;const s=i/100,a=this.getViewBoundingClientRect(),d=n.canvasZoom/100,h=Math.max(.01,Math.min(10,d+s));e||(e={x:a.x+a.width/2,y:a.y+a.height/2});const c=e.x-a.left,u=e.y-a.top,p=c-(c-n.canvasOffset.x)*(h/d),m=u-(u-n.canvasOffset.y)*(h/d),f=n.canvasZoom,g=h*100;this._performanceModeLogicHook(f,g),this.dataProvider.updateOptions({canvasOffset:{x:p,y:m},canvasZoom:g}),this.emitEvent(E.onZoomEnd,g,f)}finally{this._updateEditingControllerView(),this._dataUpdated()}}_performanceModeLogicHook(i,e){const t=this.getOptions();i<=40?e>40&&(t.performanceMode&&this.updateShouldRenderGraphData(!0),this.dataProvider.updateOptions({showEasyView:!1}),C("zoom:hide:showEasyView",i,e),this.updateElementLines()):i>40&&e<=40&&(C("zoom:show:showEasyView",i,e),t.performanceMode&&this.dataProvider.updateOptions({showEasyView:!0}))}setZoom(i,e){const t=this.getOptions(),n=Math.round(i-t.canvasZoom);this.zoom(n,e)}}class No extends _o{constructor(){super()}fitContentHeight(i=20){this.dataProvider.updateOptions({canvasOpacity:.01}),this._dataUpdated();const e=this.getOptions(),t=this.getNodesRectBox(),n=t.height,o=t.width,s=e.viewSize.width-i*2,a=t.minX+t.width/2,d=t.minY+t.height/2;console.warn("[fitContentHeight]nodesCenter:",a,d),this.dataProvider.setCanvasCenter(a,d);const h=Math.min(1,s/o),c=n*h+i*2;this.dataProvider.updateOptions({viewSize:{...e.viewSize,height:c},viewHeight:c+"px"}),setTimeout(()=>{this.setZoom(h*100),this._moveToCenter(),this.dataProvider.updateOptions({canvasOpacity:1}),this._dataUpdated()},200)}_moveToCenter(i){const e=this.getNodesCenter(i);this.dataProvider.setCanvasCenter(e.x,e.y),this._dataUpdated()}setCanvasCenter(i,e){this.dataProvider.setCanvasCenter(i,e),this._dataUpdated()}zoomToFit(i){const e=this.getOptions(),t=this.getCanvasSlotRectItems(),n=t.length>0?[...t,...i||this.getNodes()]:i,o=this.getNodesRectBox(n),s=50,a=e.viewSize.width/(o.width+s*2),d=e.viewSize.height/(o.height+s*2),h=Math.min(a,d,1);C("zoomToFit:",{stuffSize:o,zoomPercent:h,zoomPercentX:a,zoomPercentY:d,viewSize:e.viewSize}),this._moveToCenter(n),this.setZoom(h*100),this._dataUpdated()}async zoomToFitWithAnimation(i){this.enableCanvasAnimation(),this.zoomToFit(i),await this.sleep(330),this.disableCanvasAnimation()}async moveToCenterWithAnimation(i){this.enableCanvasAnimation(),this.moveToCenter(i),await this.sleep(330),this.disableCanvasAnimation()}enableNodeXYAnimation(){this.dataProvider.updateOptions({enableNodeXYAnimation:!0}),this._dataUpdated()}disableNodeXYAnimation(){this.dataProvider.updateOptions({enableNodeXYAnimation:!1}),this._dataUpdated()}enableCanvasAnimation(){this.dataProvider.updateOptions({enableCanvasTransformAnimation:!0}),this._dataUpdated()}disableCanvasAnimation(){this.dataProvider.updateOptions({enableCanvasTransformAnimation:!1}),this._dataUpdated()}focusNodeById(i){const e=this.getNodeById(i);e&&this.focusNode(e)}focusRootNode(){throw new Error("focusRootNode is deprecated, please use focusNodeById instead.")}focusNode(i){C("checked:",i);const e=this.getOptions();this.setZoom(100);const t=i.width||50,n=i.height||50,o=i.x*-1+e.viewSize.width/2-t/2,s=i.y*-1+e.viewSize.height/2-n/2;this.dataProvider.setCanvasOffset(o,s),this.dataProvider.updateOptions({checkedNodeId:i.id})}}class bo extends ce{constructor(e,t,n){super(e,t,n);_(this,"rotate",0);_(this,"enableGatherNodes",!1);_(this,"layoutOptions");this.layoutOptions=e,C("new RGTreeLayout:",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))):(this.layoutOptions.alignItemsX||(this.layoutOptions.alignItemsX="start"),this.layoutOptions.alignItemsY||(this.layoutOptions.alignItemsY="start"),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,a=s==="start"||s==="left"||s==="top"?"start":s==="end"||s==="right"||s==="bottom"?"end":"center";this.layoutOptions.layoutExpansionDirection=a,this.layoutOptions.treeNodeGapH<100&&(this.layoutOptions.treeNodeGapH=100),this.layoutOptions.treeNodeGapV<10&&(this.layoutOptions.treeNodeGapV=10),(this.layoutOptions.from==="bottom"||this.layoutOptions.from==="right")&&(this.rotate=180),this.layoutOptions.changeNodeSizeDuringLayout===void 0&&(this.layoutOptions.changeNodeSizeDuringLayout=!1)}placeNodes(e,t){if(console.log("tree:placeNodes:rootNode",t.id,t),C("RGTreeLayout:placeNodes"),t)C("layout by root:",t);else{console.error("root is null");return}C("allNodes:",e.length),this.layoutOptions.alignItemsX,this.layoutOptions.alignItemsY,this.layoutOptions.alignParentItemsX,this.layoutOptions.alignParentItemsY,this.rootNode=t,this.allNodes=e,t.fixed||this.layoutOptions.fixedRootNode||this.updateNodePosition(t,0,0),t.lot.x=t.x,t.lot.y=t.y;const n=e;C("groupNodes:2:",n.length,n.map(a=>a.text).join(","));const o=this.rotate;console.log("rotate:",o),this.networkAnalyzer.analyzeNetwork(n,this.rootNode,!1),this.placeNodesPosition(t,n);const s={x:t.x,y:t.y};this.allNodes.forEach(a=>{if(a.fixed!==!0&&!!B.isVisibleNode(a)&&(Number.isNaN(a.lot.x)&&(C("bad lot x:",a.text,a.lot.x),a.lot.x=0),Number.isNaN(a.lot.y)&&(C("bad lot y:",a.text,a.lot.y),a.lot.y=0),a!==t)){this.layoutOptions.from==="right"&&(a.lot.x=J.getFlippedX(a.lot.x,s.x)),this.layoutOptions.from==="bottom"&&(a.lot.y=J.getFlippedY(a.lot.y,s.y));const d=this.layoutOptions.from==="right"?B.getNodeXByLotX({alignItemsX:"end"},a):a.lot.x,h=this.layoutOptions.from==="bottom"?B.getNodeYByLotY({alignItemsY:"end"},a):a.lot.y;this.updateNodePosition(a,d,h)}});for(const a of this.allNodes)this.graphInstance.updateNode(a,{rgChildrenSize:a.lot.childs.length});C("create rootNode coordinates:1",t.x,t.y),this.layoutEnd()}placeNodesPosition(e,t){this.placeRelativePosition(e,t)}placeRelativePosition(e,t){e.lot.parent=void 0,e.lot.level=0;const n=[];this.buildNetwork([e],n,0);const o=Math.max(...n.map(h=>h.lot.level)),s=this.layoutOptions.from==="left"||this.layoutOptions.from==="right";this.reduceNodeRect(n,o,s),s?this.placeNodeChildrenH(n,0):this.placeNodeChildrenV(n,0);let a=e.lot.x-e.x,d=e.lot.y-e.y;this.layoutOptions.from==="right"&&(a+=e.lot.width),this.layoutOptions.from==="bottom"&&(d+=e.lot.height),n.forEach(h=>{h.fixed!==!0&&(h.lot.x-=a,h.lot.y-=d)}),console.log("levelMaxWidthMap:",e.id)}buildNetwork(e,t,n){n===0&&t.push(...e);const o=[];e.forEach(s=>{if(!B.isVisibleNode(s))return;const a=this.graphInstance.getNodeIncomingNodes(s).filter(B.isVisibleNode),h=this.graphInstance.getNodeOutgoingNodes(s).filter(B.isVisibleNode).filter(u=>!t.includes(u));t.push(...h);const c=a.filter(u=>!t.includes(u));t.push(...c),s.lot.level=n,s.lot.toNodes=h,s.lot.fromNodes=c;for(const u of c.concat(h))u.lot.parent=s,o.includes(u)||o.push(u)}),o.length>0&&this.buildNetwork(o,t,n+1)}reduceNodeRect(e,t,n=!1){let o=this.layoutOptions.treeNodeGapH,s=this.layoutOptions.treeNodeGapV;const a=o,d=s,h=e.filter(c=>c.lot.level===t);console.log("reduceNodeRect:level:",t,h.length);for(const c of h){if(!B.isVisibleNode(c))continue;let u=c.width||c.el_W||50,p=c.height||c.el_H||50;if(c.lot.width=u,c.lot.height=p,c.lot.toNodes.length===0&&c.lot.fromNodes.length===0)c.lot.width_with_childs=u,c.lot.height_with_childs=p;else if(n){let m=0,f=0;for(const v of c.lot.fromNodes)v.lot.height_with_childs>f&&(f=v.lot.height_with_childs),m+=v.lot.width_with_childs+d;let g=0,y=0;for(const v of c.lot.toNodes)v.lot.height_with_childs>y&&(y=v.lot.height_with_childs),g+=v.lot.width_with_childs+d;this.layoutOptions.changeNodeSizeDuringLayout&&(p=0),p=Math.max(f+a/2,p/2)+Math.max(y+a/2,p/2),c.lot.width_with_childs=u+Math.max(m,g)+d,c.lot.height_with_childs=p}else{let m=0,f=0;for(const v of c.lot.fromNodes)v.lot.width_with_childs>m&&(m=v.lot.width_with_childs),f+=v.lot.height_with_childs+d;let g=0,y=0;for(const v of c.lot.toNodes)v.lot.width_with_childs>g&&(g=v.lot.width_with_childs),y+=v.lot.height_with_childs+d;this.layoutOptions.changeNodeSizeDuringLayout&&(u=0),u=Math.max(m+a/2,u/2)+Math.max(g+a/2,u/2),c.lot.width_with_childs=u,c.lot.height_with_childs=p+Math.max(f,y)+d}}t>=0&&this.reduceNodeRect(e,t-1,n)}placeNodeChildrenV(e,t){const n=this.layoutOptions.treeNodeGapH,o=this.layoutOptions.treeNodeGapV,s=n,a=o;let d=0;const h=e.filter(c=>c.lot.level===t);console.log("placeNodeChildren:level:",t,h.length);for(const c of h){d++;let u=c.lot.width;this.layoutOptions.changeNodeSizeDuringLayout&&(u=0),t===0&&(c.lot.groupStartX=c.lot.x+u/2-c.lot.width_with_childs/2);const p=c.lot.groupStartX,m=c.lot.y;let f=0,g=0;for(const v of c.lot.fromNodes)v.lot.width_with_childs>f&&(f=v.lot.width_with_childs);for(const v of c.lot.toNodes)v.lot.width_with_childs>g&&(g=v.lot.width_with_childs);const y=p+Math.max(f+s/2,u/2);if(c.lot.fromNodes.length>0){let v=c.lot.height+a;for(const x of c.lot.fromNodes)x.lot.groupStartX=y-x.lot.width_with_childs-s/2,x.lot.y=m+v+a,v+=x.lot.height_with_childs+a}if(c.lot.toNodes.length>0){let v=c.lot.height+a;for(const x of c.lot.toNodes)x.lot.groupStartX=y+s/2,x.lot.y=m+v+a,v+=x.lot.height_with_childs+a}f>0||g>0?this.layoutOptions.changeNodeSizeDuringLayout?(c.lot.x=p,c.width=c.lot.width_with_childs):c.lot.x=y-c.lot.width/2:c.lot.x=p}d>0&&this.placeNodeChildrenV(e,t+1)}placeNodeChildrenH(e,t){const n=this.layoutOptions.treeNodeGapH,o=this.layoutOptions.treeNodeGapV,s=n,a=o;let d=0;const h=e.filter(c=>c.lot.level===t);console.log("placeNodeChildren:level:",t,h.length);for(const c of h){d++;let u=c.lot.height;this.layoutOptions.changeNodeSizeDuringLayout&&(u=0),t===0&&(c.lot.groupStartY=c.lot.y+u/2-c.lot.height_with_childs/2);const p=c.lot.groupStartY,m=c.lot.x;let f=0,g=0;for(const v of c.lot.fromNodes)v.lot.height_with_childs>f&&(f=v.lot.height_with_childs);for(const v of c.lot.toNodes)v.lot.height_with_childs>g&&(g=v.lot.height_with_childs);const y=p+Math.max(f+s/2,u/2);if(c.lot.fromNodes.length>0){let v=c.lot.width+a;for(const x of c.lot.fromNodes)x.lot.groupStartY=y-x.lot.height_with_childs-s/2,x.lot.x=m+v+a,v+=x.lot.width_with_childs+a}if(c.lot.toNodes.length>0){let v=c.lot.width+a;for(const x of c.lot.toNodes)x.lot.groupStartY=y+s/2,x.lot.x=m+v+a,v+=x.lot.width_with_childs+a}f>0||g>0?this.layoutOptions.changeNodeSizeDuringLayout?(c.lot.y=p,c.height=c.lot.height_with_childs):c.lot.y=y-c.lot.height/2:c.lot.y=p}d>0&&this.placeNodeChildrenH(e,t+1)}getLevelDistance(e,t,n){if(e===0)return 0;if(e>0){let o=0;for(let s=0;s<e;s++){const a=t.get(s);o+=a+this.getLevelGap(s,n,a,e)}return o}else{let o=0;for(let s=0;s>e;s--){const a=t.get(s);o+=a+this.getLevelGap(s,n,a,e)}return-o}}getLevelGap(e,t,n,o){let s=t+(o===-1&&e===0?n/2:0);if(this.layoutOptions.levelGaps.length>0){const a=this.layoutOptions.levelGaps[Math.abs(e)];a&&(s=a)}return s}}const ko=bo;class Oo extends No{constructor(){super();_(this,"_layoutTimer",null);_(this,"_layoutPromise",null);_(this,"_layoutResolve",null);_(this,"layoutor")}async doLayout(e){const t=Date.now()-this.prevAddNodeTimestamp;return t<300&&(this.dataProvider.updateOptions({canvasOpacity:.01}),this._dataUpdated(),await De(300-t)),this._layoutPromise||(this._layoutPromise=new Promise(n=>{this._layoutResolve=n})),clearTimeout(this._layoutTimer),this._layoutTimer=setTimeout(async()=>{var n;try{await this._doLayout(e),this.dataProvider.updateOptions({canvasOpacity:1}),this._dataUpdated()}finally{(n=this._layoutResolve)==null||n.call(this),this._layoutResolve=null,this._layoutPromise=null}},50),this._layoutPromise}async _doLayout(e){this.updateNodesVisibleProperty();const t=this.getNodes();C("node size\uFF1A",t.length);let n=this.dataProvider.getRootNode();if(e&&(n=typeof e=="string"?this.getNodeById(e):e),n||(n=t[0],this._rgAsConnectArea||(C("[relation-graph]No root node, use first node as root:",n),C("[relation-graph]You can set rootNode call doLayout(rootNode | nodeId) with a node id"))),!n)throw new Error("custom rootNode not found, id:"+e);const o=this.getOptions();this.dataProvider.setRootNodeId(n?n.id:""),this.stopAutoLayout();const s=this.createLayout(o.layout,!0);if(s.layoutOptions.layoutName==="force")s.isMainLayouer=!0,s.onFinish(()=>{this.emitEvent(E.onForceLayoutFinish)}),await De(100),C("doLayout:start force:",t.length),s.placeNodes(t,n);else{this.enableNodeXYAnimation();let a=[];n&&(a=this.getNetworkNodesByNode(n),s.placeNodes(a,n)),C("doLayout:placeOtherNodes:all:",t.length,"mainGroupNodes:",a.length),this.placeOtherNodes(a),setTimeout(()=>{this.disableNodeXYAnimation()},300),C("doLayout:placeOtherNodes ok!")}t.forEach(a=>this.dataProvider.updateNode(a.id,{x:a.x||0,y:a.y||0,rgChildrenSize:a.rgChildrenSize||0})),this.updateElementLines()}async refresh(e=!0){this.resetViewSize(!0),this._dataUpdated(),e&&await this.doLayout(),this.updateElementLines(),this._dataUpdated()}placeOtherNodes(e=[]){const t=this.getOptions();if(t.layout.layoutName==="fixed"||!t.placeOtherGroup)return;const o=[],s=[],a=this.getNodes();a.forEach(h=>{if(h.fixed===!0||e.includes(h))return;this.getNodeRelatedNodes(h).length===0?s.push(h):o.push(h)}),C("doLayout:allNodes:",a.length),C("doLayout:mainGroupNodes:",e.length),C("doLayout:notInMainGroupNodes:",o.length),C("doLayout:singleNodes:",s.length);const d=[{nodes:e}];this.placeNextNetwork(o,[...e],d),this.placeSingleNodes(s),d.push({nodes:s}),this.sortGroups(d),this._dataUpdated()}placeSingleNodes(e){if(e.length>0){const t=Math.ceil(Math.sqrt(e.length));He(t,30,e.map(o=>({width:o.el_W,height:o.el_H,node:o})),(o,s,a)=>{const d=o.node;d.x=s,d.y=a,d.lot||(d.lot={childs:[]})}),C("[placeSingleNodes]Single nodes:",e.length)}}sortGroups(e){C("[placeSingleNodes]sortGroups groupList:",e.length,e.map(s=>s.nodes.length));const t=e.map(s=>{const a=this.getNodesRectBox(s.nodes);return{width:a.width,height:a.height,nodes:s.nodes,orignX:a.minX,orignY:a.minY}});if(t.length===0)return;const n=Math.floor(Math.sqrt(t.length))||1;He(n,100,t,(s,a,d)=>{const h=a-s.orignX,c=d-s.orignY;C(`[placeNextNetwork]Move ${s.nodes.length} Nodes :`,h,c,s," > ");for(const u of s.nodes)this.updateNodePosition(u,u.x+h,u.y+c)},t[0].orignX,t[0].orignY)}placeNextNetwork(e,t,n){if(e.length>0){const o=this.getOptions();C("[placeNextNetwork]notPlacedNodes nodes:",e.length);const s=JSON.parse(JSON.stringify(o.layout)),a=e[0],d=this.createLayout(s);if(d.isMainLayouer=!1,C("[placeNextNetwork]layoutName:",d.layoutOptions.layoutName,"root:",a.text),d.layoutOptions.layoutName==="force"){const u=d;u.maxLayoutTimes=0}a.fixed?C("[placeNextNetwork]fixed root x,y:",a.x,a.y,a.text):(this.updateNodePosition(a,0,0),C("[placeNextNetwork]set root x,y:",a.x,a.y,a.text)),d.layoutOptions.fixedRootNode=!0;const h=this.getNetworkNodesByNode(a);C("[placeNextNetwork]thisNetworkNodes:",e.length),d.placeNodes(h,a),t.push(...h),n.push({nodes:h});const c=[];e.forEach(u=>{t.includes(u)||c.push(u)}),o.placeOtherGroup&&this.placeNextNetwork(c,t,n),this._dataUpdated()}else C("[placeOtherGroup]thisGroupNodes:all is OK!")}toggleAutoLayout(){const e=this.getOptions();C("toggleAutoLayout:to:",e.layout.autoLayouting),e.layout.autoLayouting?this.stopAutoLayout():this.startAutoLayout()}startAutoLayout(){var e;(e=this.layoutor)!=null&&e.start&&(C("Start force layout:"+this.layoutor.instanceId),this.layoutor.start())}stopAutoLayout(){var e;(e=this.layoutor)!=null&&e.stop&&(C("Stop force layout:"+this.layoutor.instanceId),this.layoutor.stop())}createLayout(e,t=!1){C("########createLayout:",e);const n=this.getOptions();vt(e);let o=null;if(e.layoutName==="tree"?o=new ct(e,n,this):e.layoutName==="center"?o=new ht(e,n,this):e.layoutName==="circle"?o=new ut(e,n,this):e.layoutName==="force"?o=new be(e,n,this):e.layoutName==="fixed"?o=new pt(e,n,this):e.layoutName==="smart-tree"?o=new $n(e,n,this):e.layoutName==="io-tree"?o=new ko(e,n,this):e.layoutName==="folder"&&(o=new ft(e,n,this)),!o)throw new Error("unknown layout: "+e.layoutName);return C("########supportAutoLayout:",o.autoLayout!==void 0,e.disableAsForceLayout),this.setLayoutor(o,t,o.autoLayout!==void 0&&e.disableAsForceLayout!==!0),o}setLayoutor(e,t,n=!1){e.isMainLayouer=t,e.layoutOptions.fixedRootNode=!0,t&&(this.layoutor=e,this._updateOptions({layout:{supportAutoLayout:n}}))}}const Po=async(l,i)=>{const e=l||document.documentElement;i?await To(e):await Ro()},To=async l=>{l.requestFullscreen?await l.requestFullscreen():l.mozRequestFullScreen?await l.mozRequestFullScreen():l.webkitRequestFullscreen?await l.webkitRequestFullscreen():l.msRequestFullscreen&&await l.msRequestFullscreen()},Ro=async()=>{document.exitFullscreen?await document.exitFullscreen():document.mozCancelFullScreen?await document.mozCancelFullScreen():document.webkitExitFullscreen?await document.webkitExitFullscreen():document.msExitFullscreen&&await document.msExitFullscreen()};class So extends Oo{constructor(){super();_(this,"_prevClickNodeTime",0);_(this,"_nodeXYMappingBeforeDrag",{});_(this,"canvasAutoMoving",e=>{const t=this.getOptions(),n=t.viewSize,o=40;let s=0,a=0;e.x<o?s=o-e.x:n.width-o<e.x&&(s=n.width-o-e.x),e.y<o?a=o-e.y:n.height-o<e.y&&(a=n.height-o-e.y);const d=s!==0||a!==0;d&&(s=Math.max(Math.min(s/5,30),-30),a=Math.max(Math.min(a/5,30),-30));const h=t.canvasOffset.x+s,c=t.canvasOffset.y+a;return this.onCanvasDragging(h,c,s,a),d});_(this,"_canvasMovingTimer");_(this,"_relayoutTaskTimer");_(this,"_onMovingWhenCreatingLine");_(this,"_step1EventTime",0);_(this,"_onCreateLineCallback");_(this,"_mouseWheelTimer");_(this,"_mouseWheelEventPrevApplyTime",0);_(this,"_mouseWheelForce",{x:0,y:0});_(this,"_fullscreenchangeHandler")}onNodeClick(e,t){if(Date.now()-this._prevClickNodeTime<200){C("[node]click abort : time < 200");return}this._prevClickNodeTime=Date.now();const n=this.getOptions();if(n.creatingLinePlot){this.onNodeClickWhenCreatingLinePlot(e);return}const o=e.disablePointEvent===void 0?n.disableNodePointEvent:e.disablePointEvent;C("[node]node click",e.text,n.creatingLinePlot,o),!t.shiftKey&&!o&&(n.checkedLineId="",this.dataProvider.updateOptions({checkedLineId:"",checkedNodeId:e.id})),this.emitEvent(E.onNodeClick,e,t),this._prevClickNodeTime=Date.now()}onNodeDragStart(e,t){if(!e||Ce(t))return;const n=this.getOptions();if((e.disableDrag||n.disableDragNode)&&!(t.target&&t.target.closest(".rg-node-drag-handler"))){const g=y=>{this.onNodeClick(e,y),document.body.removeEventListener("mouseup",g)};document.body.addEventListener("mouseup",g);return}isNaN(e.x)&&(e.x=0),isNaN(e.y)&&(e.y=0),this.dataProvider.setEditingLine(null),this.dataProvider.updateOptions({checkedLineId:""});let s=!1;const a=(f,g,y)=>{y.stopPropagation(),s=!0,this._canvasMovingTimer&&cancelAnimationFrame(this._canvasMovingTimer),this.dataProvider.updateOptions({draggingNodeId:"",editingReferenceLine:{...n.editingReferenceLine,show:!1}}),this._onNodeDragEnd(e,f,g,y),c?this.emitEvent(E.onNodeDragEnd,e,y,f,g):this.onNodeClick(e,t),this._dataUpdated()};this._nodeXYMappingBeforeDrag={},this._nodeXYMappingBeforeDrag[e.id]={x:e.x,y:e.y};for(const f of n.editingController.nodes)this._nodeXYMappingBeforeDrag[f.id]={x:f.x,y:f.y};const d=this.getCanvasXyByViewXy(this.getViewXyByEvent(t)),h={x:e.x,y:e.y};let c=!1;this._canvasMovingTimer&&cancelAnimationFrame(this._canvasMovingTimer);let u;const p=()=>{if(!u||s)return;const f=this.getViewXyByEvent(u),g=this.getCanvasXyByViewXy(f),y=g.x-d.x,v=g.y-d.y;let x=y+h.x,L=v+h.y,N=x-h.x,T=L-h.y;const O=this.emitEvent(E.onNodeDragging,e,x,L,N,T,u);O&&(typeof O.x=="number"&&(x=O.x,N=x-h.x),typeof O.y=="number"&&(L=O.y,T=L-h.y)),this.canvasAutoMoving(f),this.draggingSelectedNodes(e,x,L,N,T),this._dataUpdated()},m=()=>{p(),this._canvasMovingTimer=requestAnimationFrame(m)};le.startDrag(t,h,a,(f,g,y,v,x)=>{c?u=x:Math.abs(f)+Math.abs(g)>4&&(C("[node]onNodeDragStart...",ae(u),u),this.emitEvent(E.onNodeDragStart,e,u),c=!0,this.dataProvider.updateOptions({draggingNodeId:e.id}),this._canvasMovingTimer=requestAnimationFrame(m)),this.updateElementLines(),this._dataUpdated()})}_onNodeDragEnd(e,t,n,o){this.updateElementLines()}onLineClick(e,t){const n=this.getLinkByLineId(e.id);C("onLineClick:","line:",e,"link:",n);const o=this.getOptions();(e.disablePointEvent===void 0?o.disableLinePointEvent:e.disablePointEvent)||(this.setCheckedNode(""),this.setCheckedLine(e)),this.emitEvent(E.onLineClick,e,n,t),this._dataUpdated()}expandOrCollapseNode(e,t){t.stopPropagation(),e.expanded===!1?this.expandNode(e,t):this.collapseNode(e,t)}expandNode(e,t){C("onNodeExpand:",e),this.dataProvider.updateNode(e.id,{expanded:!0}),this._effectWhenExpandedOrCollapsed(e),this.emitEvent(E.onNodeExpand,e,t)}collapseNode(e,t){C("onNodeCollapse:",e),this.dataProvider.updateNode(e.id,{expanded:!1}),this._effectWhenExpandedOrCollapsed(e),this.emitEvent(E.onNodeCollapse,e,t)}_effectWhenExpandedOrCollapsed(e){const t=this.getDescendantNodes(e);this.updateNodesVisibleProperty([e].concat(t)),this._relayoutTaskTimer&&clearTimeout(this._relayoutTaskTimer),this._relayoutTaskTimer=setTimeout(()=>{this.updateElementLines(),this._dataUpdated();const n=this.getOptions();n.reLayoutWhenExpandedOrCollapsed&&(n.layout.layoutName==="force"?this.startAutoLayout():this.doLayout())},100)}onCanvasDragEnd(e){this._updateEditingControllerView(),this.updateShouldRenderGraphData(),this._dataUpdated(),this.emitEvent(E.onCanvasDragEnd,e)}onCanvasClick(e){if(this.getOptions().creatingLinePlot)this.onCanvasClickWhenCreatingLinePlot(e);else{if(this.dataProvider.isPerformanceMode()){const n=this.getNodeAtEvent(e);if(n){this.emitEvent(E.onNodeClick,n,e);return}}this.emitEvent(E.onCanvasClick,e)}}getNodeAtEvent(e){const t=this.getCanvasXyByClientXy(e);return this.dataProvider.findNodeByXy(t)}onCanvasSelectionEnd(e,t){this.emitEvent(E.onCanvasSelectionEnd,e,t),C("[canvas]onCanvasSelectionEnd:",e),this._dataUpdated()}startCreatingNodePlot(e,t){if(!t)throw new Error("startCreatingNodePlot need setting param");if(!t.onCreateNode)throw new Error("startCreatingNodePlot need setting.onCreateNode param as callback");const n=Ne(JSON.parse(JSON.stringify(Ae)),this.getOptions()),o=ae(e);this.dataProvider.updateOptions({newNodeTemplate:Object.assign({},n,t.templateNode),creatingNodePlot:!0,showTemplateNode:!o});let s=(f,g)=>{const y=this.getOptions().newNodeTemplate,v={width:y.width||50,height:y.height||50};this.dataProvider.updateOptions({newNodeTemplate:{...y,x:f-v.width/2,y:g-v.height/2}}),this._dataUpdated()};const a=this.getViewBoundingClientRect();C("[CreatingNodePlot]startCreatingNodePlot:");const d=me(e),h=d.clientX-a.x+10,c=d.clientY-a.y+10;o||s(h,c);const u=f=>{C("[CreatingNodePlot]objectTemplateMove");const g=this.getViewXyByEvent(f);t.templateMove&&t.templateMove(g.x,g.y),s(g.x,g.y)},p=f=>{C("[CreatingNodePlot]user abort!"),this.$dom.removeEventListener("mousemove",u),this.$dom.removeEventListener("click",m),this.$dom.removeEventListener("contextmenu",p),this.dataProvider.updateOptions({creatingNodePlot:!1})},m=f=>{let g=!1;if(this.getOptions().creatingNodePlot||(g=!0),this.$dom.removeEventListener("mousemove",u),this.$dom.removeEventListener("click",m),this.$dom.removeEventListener("contextmenu",p),this.dataProvider.updateOptions({creatingNodePlot:!1}),g){C("[CreatingNodePlot]action be abort!");return}const y=me(f),v=y.clientX-a.x+10,x=y.clientY-a.y+10;if(Math.abs(h-v)<30&&Math.abs(c-x)<30){C("[CreatingNodePlot]create node be abort!");return}const L=this.getCanvasXyByClientXy({x:y.clientX,y:y.clientY});C("[CreatingNodePlot]objectBePlaced:",L),t.onCreateNode(L.x,L.y,this.getOptions().newNodeTemplate),this._dataUpdated()};setTimeout(()=>{this.$dom.addEventListener("click",m),this.$dom.addEventListener("contextmenu",p)},300),o||this.$dom.addEventListener("mousemove",u)}startCreatingLinePlot(e,t){const n=ae(e);t&&t.onCreateLine&&(this._onCreateLineCallback=t.onCreateLine);const o=de({from:"newRelationTemplate-from",to:"newRelationTemplate-to",color:"",text:""},this.getOptions());t&&t.template&&Object.assign(o,t.template),this.dataProvider.updateOptions({newLineTemplate:Object.assign(o,{isReverse:t.isReverse||!1})}),this.dataProvider.updateOptions({newLineTemplate:Object.assign(o,{isReverse:t.isReverse||!1,disablePointEvent:!0}),creatingLinePlot:!0});const s=Object.assign({},this.getOptions().newLinkTemplate,{fromNode:null,toNode:{id:"",targetType:D.Node,x:0,y:0,el_W:2,el_H:2},toNodeObject:null});t&&t.fromNode&&(s.toNode.x=t.fromNode.x+50,s.toNode.y=t.fromNode.y+50,s.fromNode=t.fromNode,this._step1EventTime=Date.now()),this.dataProvider.updateOptions({newLinkTemplate:s}),C("[CreatingLinePlot]startCreatingLinePlot:isTouchEvent:",n),n||(C("[CreatingLinePlot]Listener move"),this._onMovingWhenCreatingLine&&this.$dom.removeEventListener("mousemove",this._onMovingWhenCreatingLine),this._onMovingWhenCreatingLine=this.onMovingWhenCreatingLinePlot.bind(this),this.$dom.addEventListener("mousemove",this._onMovingWhenCreatingLine)),this._dataUpdated()}stopCreatingLinePlot(){C("[CreatingLinePlot]stop CreatingLinePlot!"),this.dataProvider.updateOptions({creatingLinePlot:!1,newLinkTemplate:{...this.getOptions().newLinkTemplate,fromNode:null,toNodeObject:null},nodeConnectController:{...this.getOptions().nodeConnectController,show:!1}}),this._onCreateLineCallback=void 0,this.$dom.removeEventListener("mousemove",this._onMovingWhenCreatingLine),this._onMovingWhenCreatingLine=void 0,this._dataUpdated()}onMovingWhenCreatingLinePlot(e){C("[CreatingLinePlot]mousemove");const t=this.getCanvasXyByClientXy({x:e.clientX,y:e.clientY}),n=this.getOptions(),o=e.target;let s="",a=D.Node;const d=this.isNode(o);let h=!1,c={x:0,y:0,el_W:5,el_H:5,nodeShape:0};d&&(s=d.id,d===this.getOptions().newLinkTemplate.fromNode?this.dataProvider.updateOptions({nodeConnectController:{...this.getOptions().nodeConnectController,show:!1}}):(this.dataProvider.updateOptions({nodeConnectController:{...this.getOptions().nodeConnectController,node:d,show:!0}}),this._updateEditingConnectControllerView()));const u=o.closest(".rg-connect-ctl-handler");if(u){let p=this.getOptions().nodeConnectController.node;C("[CreatingLinePlot]content point:",u.dataset.point);let m=u.dataset.point||"border";if(u.classList.contains("rg-connect-target")){const{width:f,height:g,x:y,y:v}=u.getBoundingClientRect(),x=this.getCanvasXyByClientXy({x:y,y:v}),L=this.dataProvider.getCanvasScale(),N={x:x.x,y:x.y,el_W:f/L,el_H:g/L,nodeShape:1,id:u.dataset.targetId,targetData:JSON.parse(u.dataset.targetData||"{}"),targetType:u.dataset.targetType};h=!0,c.x=N.x,c.y=N.y,c.el_W=N.el_W,c.el_H=N.el_H,c.nodeShape=N.nodeShape,console.log("[CreatingLinePlot]fakeNode:",JSON.stringify(N)),this.dataProvider.updateOptions({nodeConnectController:{...this.getOptions().nodeConnectController,node:N,show:!1}}),m=u.dataset.point,n.newLinkTemplate.toNode&&(s=N.id,a=N.targetType,this.dataProvider.updateOptions({newLinkTemplate:{...this.getOptions().newLinkTemplate,toNode:{...this.getOptions().newLinkTemplate.toNode,nodeShape:N.nodeShape}}})),this._updateEditingConnectControllerView()}else p&&(a=D.Node,h=!0,c.x=p.x,c.y=p.y,c.el_W=p.el_W,c.el_H=p.el_H,c.nodeShape=p.nodeShape,o.dataset.innode==="true"&&(c.x=t.x,c.y=t.y,c.el_W=2,c.el_H=2,c.nodeShape=1));n.newLineTemplate.isReverse?this.dataProvider.updateOptions({newLineTemplate:{...this.getOptions().newLineTemplate,fromJunctionPoint:m}}):this.dataProvider.updateOptions({newLineTemplate:{...this.getOptions().newLineTemplate,toJunctionPoint:m}})}else C("[CreatingLinePlot]point:",o.dataset.point),n.newLineTemplate.isReverse?this.dataProvider.updateOptions({newLineTemplate:{...this.getOptions().newLineTemplate,fromJunctionPoint:H.border}}):this.dataProvider.updateOptions({newLineTemplate:{...this.getOptions().newLineTemplate,toJunctionPoint:H.border}}),n.newLinkTemplate.toNode&&(a=D.Node);n.newLinkTemplate.toNode&&(s&&this.dataProvider.updateOptions({newLinkTemplate:{...this.getOptions().newLinkTemplate,toNode:{...this.getOptions().newLinkTemplate.toNode,id:s}}}),this.dataProvider.updateOptions({newLinkTemplate:{...this.getOptions().newLinkTemplate,toNode:{...this.getOptions().newLinkTemplate.toNode,targetType:a}}})),n.newLinkTemplate.fromNode&&this.dataProvider.updateOptions({newLinkTemplate:{...this.getOptions().newLinkTemplate,toNode:{...this.getOptions().newLinkTemplate.toNode,x:h?c.x:t.x,y:h?c.y:t.y,el_W:c.el_W,el_H:c.el_H,nodeShape:c.nodeShape}}}),this._dataUpdated()}onCanvasClickWhenCreatingLinePlot(e){if(Date.now()-this._step1EventTime<500){C("[CreatingLinePlot]step1EventTime:",this._step1EventTime);return}const t=this.getOptions();if(!t.newLinkTemplate.fromNode){C("[CreatingLinePlot]CreatingLinePlot:fromNode not set!");return}let n=!1;if(!t.newLinkTemplate.toNodeObject){C("[CreatingLinePlot]CreatingLinePlot:toNodeObject not set!");const o=me(e),s=this.getCanvasXyByClientXy({x:o.clientX,y:o.clientY});n=this.onReadyToCreateLine(t.newLinkTemplate.fromNode,s)}n!==!0&&this.stopCreatingLinePlot()}onNodeClickWhenCreatingLinePlot(e){const t=this.getOptions();t.newLinkTemplate.fromNode?(C("[CreatingLinePlot]step 2: set toNodeObjecct:",t.newLinkTemplate.fromNode,e),this.dataProvider.updateOptions({newLinkTemplate:{...t.newLinkTemplate,toNodeObject:e}}),this.onReadyToCreateLine(t.newLinkTemplate.fromNode,e)!==!0&&this.stopCreatingLinePlot()):(C("[CreatingLinePlot]step 1: set fromNode:",e),this.dataProvider.updateOptions({newLinkTemplate:{...t.newLinkTemplate,fromNode:e,toNode:{...t.newLinkTemplate.toNode,x:e.x+50,y:e.y+50}}}),this._step1EventTime=Date.now())}onReadyToCreateLine(e,t){C("[CreatingLinePlot][fire-event]onCreateLine:",e,t);const n=this.getOptions(),o=de(n.newLineTemplate,this.getOptions());n.newLineTemplate.isReverse?(o.from=t?t.id:"",o.to=e?e.id:"",o.isReverse=void 0,[e,t]=[t,e]):(o.from=e?e.id:"",o.to=t?t.id:""),o.disablePointEvent=!1;const s=this.emitEvent(E.beforeCreateLine,{lineJson:o,fromNode:e,toNode:t});if(C("[CreatingLinePlot]onCreateLine:abort-flag:",s),s===!0){C("[CreatingLinePlot]onCreateLine:abort!");return}if(this._onCreateLineCallback){C("[CreatingLinePlot]onCreateLine:callback");try{this._onCreateLineCallback(e,t,o)}catch(d){return console.warn("[Custom Reject Connect By Throw Error:",d),!1}}return C("[CreatingLinePlot]onCreateLine:emitEvent"),this.emitEvent(E.onLineBeCreated,{lineJson:o,fromNode:e,toNode:t})}onContextmenu(e){e.stopPropagation(),e.preventDefault(),this.stopCreatingLinePlot();let t="canvas",n=this.isNode(e.target);n?t="node":(n=this.isLine(e.target),n&&(t="line")),C("contextmenu:objectType",t,n);const o=me(e),s=this.getCanvasXyByClientXy({x:o.clientX,y:o.clientY}),a=this.getViewXyByCanvasXy(s);this.emitEvent(E.onContextmenu,e,t,n,s,a)}async fullscreen(e){const t=this.getOptions();if(e!==void 0&&e===t.fullscreen)return;C("fullscreen:newValue:",e),console.log("fullscreen:newValue:",e),e===void 0&&(e=!t.fullscreen);let n=this.$dom;t.fullscreenElementXPath&&(n=document.querySelector(t.fullscreenElementXPath)||this.$dom),await Po(n,e),this.dataProvider.updateOptions({fullscreen:e}),this.emitEvent(E.onFullscreen,e),this._dataUpdated()}onMouseWheel(e){const t=this.getOptions();if(!e.ctrlKey&&!e.metaKey&&(t.disableWheelEvent||t.wheelEventAction==="none"))return!0;try{e.preventDefault(),e.stopPropagation()}catch{}let{deltaX:n,deltaY:o,deltaMode:s}=e;s===1?(n*=40,o*=40):s===2&&(n*=800,o*=800),this._mouseWheelForce.x+=n,this._mouseWheelForce.y+=o,this._applyWheelEvent(e)}_applyWheelEvent(e){clearTimeout(this._mouseWheelTimer),this._mouseWheelTimer=setTimeout(()=>{const t=this._mouseWheelForce.x,n=this._mouseWheelForce.y;this._onMouseWheel(e,t,n),this._mouseWheelForce.x-=t,this._mouseWheelForce.y-=n,this._mouseWheelEventPrevApplyTime=Date.now(),(Math.abs(this._mouseWheelForce.x)>1||Math.abs(this._mouseWheelForce.y)>1)&&this._applyWheelEvent(e)},Date.now()-this._mouseWheelEventPrevApplyTime>50?0:50)}_onMouseWheel(e,t,n){const o=e.ctrlKey||e.metaKey,s=this.getOptions();if(!o&&s.wheelEventAction==="scroll"){let a=Math.max(Math.abs(t),Math.abs(n));const d=t/a,h=n/a;a>200&&(a=200);const c=s.mouseWheelSpeed/10*-d*a,u=s.mouseWheelSpeed/10*-h*a,p=this.emitEvent(E.beforeScrollStart,c,u,e);if(C("[scroll]","abortScroll:",p),p===!0)return;this.scrollView(c,u)}else if(!(!o&&s.wheelEventAction==="none")){const a={x:e.clientX,y:e.clientY};let d=s.mouseWheelSpeed/20*-n;d=Math.max(Math.min(d,20),-20),this.zoom(d,a,e)}}scrollView(e,t){const n=this.getOptions();this.dataProvider.setCanvasOffset(n.canvasOffset.x+e,n.canvasOffset.y+t),this._updateEditingControllerView(),this.updateShouldRenderGraphData(),this._dataUpdated()}onLineDragStart(e,t){C("onLineDragStart...");const n=this.getLinkByLine(e),o={x:n.fromNode.x,y:n.fromNode.y},s={x:n.toNode.x,y:n.toNode.y},a=(d,h,c,u,p)=>{const m=this.dataProvider.getCanvasScale();n.fromNode.x=o.x+d/m,n.fromNode.y=o.y+h/m,n.toNode.x=s.x+d/m,n.toNode.y=s.y+h/m,this._updateEditingControllerView(),this._dataUpdated()};le.startDrag(t,{x:0,y:0},(...d)=>{this.onLineDragEnd(...d)},a)}onLineDragEnd(e,t,n){C("onLineDragEnd"),this.updateElementLines()}onCanvasDragStart(e){if(Ce(e)||e.target&&e.target.closest(".rg-line-peel"))return;const t=this.getOptions();if(this.dataProvider.isPerformanceMode()&&t.editingController.nodes.length>0){const n=this.getNodeAtEvent(e);if(n){this.onNodeDragStart(n,e);return}}if(t.dragEventAction==="none"){this.onCanvasClick(e);return}if(t.dragEventAction==="selection"||e.shiftKey){this.startCreateSelection(e);return}if(!t.disableDragLine){const n=this.isLine(e.target);if(n){this.onLineDragStart(n,e);return}}this.startMoveCanvas(e)}startMoveCanvas(e,t=!1){let n;if(ae(e)){let d,h=1;n=(c,u,p,m,f)=>{const g=f.touches||f.targetTouches,y=g[0];if(g&&g.length>1){f.preventDefault();const v=g[1],x=this.getOptions();d||(d={x:v.clientX,y:v.clientY},h=x.canvasZoom);const L={x:y.clientX,y:y.clientY},N={x:v.clientX,y:v.clientY},T=Math.hypot(d.x-m.x,d.y-m.y),b=Math.hypot(N.x-L.x,N.y-L.y)/T,k=x.mouseWheelSpeed*b,P=h*k;this.setZoom(P,m),this._dataUpdated()}else{const v=y.clientX,x=y.clientY,L=v-m.x,N=x-m.y,T=p.x+L,O=p.y+N;this.onCanvasDragging(T,O,N,L),this._updateEditingControllerView(),this._dataUpdated()}}}else n=(d,h,c,u,p)=>{const m=c.x+d,f=c.y+h;this.onCanvasDragging(m,f,d,h),this._updateEditingControllerView(),this._dataUpdated()};const o=this.getOptions(),s={x:o.canvasOffset.x,y:o.canvasOffset.y};let a=t;le.startDrag(e,s,(d,h,c)=>{this.onCanvasDragStop(d,h,c)},(d,h,c,u,p)=>{a?n(d,h,c,u,p):Math.abs(d)+Math.abs(h)>4&&(this.emitEvent(E.onCanvasDragStart,c,u,p),a=!0)})}onCanvasDragging(e,t,n,o){const s=this.emitEvent(E.onCanvasDragging,e,t,n,o);s!==!1&&(s&&(typeof s.x=="number"&&(e=s.x),typeof s.y=="number"&&(t=s.y)),this.dataProvider.setCanvasOffset(e,t))}onCanvasDragStop(e,t,n){const o=this.getOptions();if(o.creatingSelection){this.dataProvider.updateOptions({creatingSelection:!1}),this.onCanvasSelectionEnd(o.selectionView,n);return}if(Math.abs(e)+Math.abs(t)<4){C("[canvas]onDragEnd as click2"),this._dataUpdated(),this.onCanvasClick(n);return}else C("[canvas]onDragEnd"),this.onCanvasDragEnd(n)}startCreateSelection(e){const t=()=>{if(!n||s)return;const c=this.getViewXyByEvent(n);this.canvasAutoMoving(c)&&this._updateEditingControllerView();const p=this.getViewXyByCanvasXy(a),m=c.x-p.x,f=c.y-p.y;m<0?this.dataProvider.updateOptions({selectionView:{...this.getOptions().selectionView,x:p.x+m,width:Math.abs(m)}}):this.dataProvider.updateOptions({selectionView:{...this.getOptions().selectionView,x:p.x,width:Math.abs(m)}}),f<0?this.dataProvider.updateOptions({selectionView:{...this.getOptions().selectionView,y:p.y+f,height:Math.abs(f)}}):this.dataProvider.updateOptions({selectionView:{...this.getOptions().selectionView,y:p.y,height:f}}),this._dataUpdated()};let n,o=!1,s=!0;const a=this.getCanvasXyByViewXy(this.getViewXyByEvent(e)),d=()=>{t(),this._canvasMovingTimer=requestAnimationFrame(d)},h=(c,u,p,m,f)=>{if(n=f,o)n=f;else if(Math.abs(c)+Math.abs(u)>6){o=!0,s=!1;const g=this.getOptions();g.selectionView.width=5,g.selectionView.height=5,this.dataProvider.updateOptions({creatingSelection:!0}),this._canvasMovingTimer&&cancelAnimationFrame(this._canvasMovingTimer),this._canvasMovingTimer=requestAnimationFrame(d)}this._dataUpdated()};le.startDrag(e,{x:0,y:0},(...c)=>{s=!0,this._canvasMovingTimer&&cancelAnimationFrame(this._canvasMovingTimer),this.onCanvasDragStop(...c)},h)}addFullscreenListener(){this._fullscreenchangeHandler=()=>{let e=!1;document.fullscreenElement?(C("div entered fullscreen mode",document.fullscreenElement),this.$dom===document.fullscreenElement&&(C("relation-graph is fullscreen!"),e=!0)):C("div exited fullscreen mode"),e!==this.getOptions().fullscreen&&(this.dataProvider.updateOptions({fullscreen:e}),this._dataUpdated(),setTimeout(async()=>{this.resetViewSize(),this._moveToCenter(),this.zoomToFit(),C("relation-graph reset complete!")},500))},document.addEventListener("fullscreenchange",this._fullscreenchangeHandler)}removeFullscreenListener(){document.addEventListener("fullscreenchange",this._fullscreenchangeHandler)}defaultLineConnectEndHandler(e,t,n){C("defaultLineConnectEndHandler:",e,t,n)}defaultLineVertexBeChangedHandler(e,t,n){C("defaultLineVertexBeChangedHandler:",n&&n.isReverse)}async sleep(e){await De(e)}forceLayoutTickCallback(){this._updateEditingControllerView(),this.dataProvider.updateShouldRenderGraphData(),this._dataUpdated()}}class Mo extends So{constructor(){super();_(this,"$easyViewCanvas");_(this,"$rgWebglPainter");_(this,"_updateEasyViewRequested",!1);_(this,"_easyViewOffset",{x:0,y:0})}setEasyViewCanvas(e){this.$easyViewCanvas=e,this.$rgWebglPainter=new bn(e)}updateEasyView(){this.updateMiniView(),this.dataProvider.isPerformanceMode()&&(!this.getOptions().showEasyView||this._updateEasyViewRequested||(this._updateEasyViewRequested=!0,requestAnimationFrame(this._updateEasyView.bind(this))))}_updateEasyView(e){try{const t=Date.now();if(!this.$easyViewCanvas)return;this.updateShouldRenderGraphData(),this.evDosomethingBeforeDraw(),this.evDrawAllLines(),this.evDrawAllNodes()}catch(t){console.error(t)}finally{this._updateEasyViewRequested=!1}}evDosomethingBeforeDraw(){const e=this.getOptions(),t=e.viewSize.width,n=e.viewSize.height;this.$easyViewCanvas.width=t,this.$easyViewCanvas.height=n,this.$rgWebglPainter.setSize(t,n);const o=this.dataProvider.getCanvasScale();this.$rgWebglPainter.setScale(o),this._easyViewOffset.x=e.canvasOffset.x,this._easyViewOffset.y=e.canvasOffset.y,this.$rgWebglPainter.setViewOffset(this._easyViewOffset.x,this._easyViewOffset.y),this.$rgWebglPainter.beforeDraw()}evDrawAllNodes(){const e=this.getOptions().defaultNodeShape;for(const t of this.getNodes()){if(!(t.rgShouldRender!==!1&&t.rgCalcedVisibility&&t.opacity!==0))continue;const o=Le(t.nodeShape,e);this.evDrawNode(t,o)}}evDrawNode(e,t){t===_e.circle?this.evDrawNode4Circle(e):this.evDrawNode4Rect(e)}getNodeColor(e){const t=e.color||this.getOptions().defaultNodeColor||"#dddddd";return t==="transparent"?"rgba(204,204,204,0.2)":t}evDrawNode4Rect(e){const t=e.el_W,n=e.el_H,o=e.opacity||.8,s=this.getNodeColor(e),a=e.borderRadius===void 0?3:e.borderRadius,d=e.borderColor||"#666666";this.$rgWebglPainter.evDrawNode4Rect(e.x,e.y,t,n,s,o,a,d)}evDrawNode4Circle(e){const t=e.el_W,n=e.el_H,o=e.opacity||.8,s=this.getNodeColor(e),a=e.borderColor||"#666666";this.$rgWebglPainter.evDrawNode4Circle(e.x,e.y,t,n,s,o,a)}evDrawAllLines(){for(const e of this.getLinks()){const t=e.fromNode.rgShouldRender!==!1&&e.fromNode.opacity!==0&&e.fromNode.rgCalcedVisibility,n=e.toNode.rgShouldRender!==!1&&e.toNode.opacity!==0&&e.toNode.rgCalcedVisibility;!t&&!n||this.evDrawLine(e,e.line)}}evDrawLine(e,t){const n=this.createLineDrawInfo(e,t),o=t.opacity||1,s=this.getOptions(),a=t.color||s.defaultLineColor||"#888888",d=t.lineWidth||s.defaultLineWidth||1;this.$rgWebglPainter.evDrawLine(n.pathData,d,a,o)}}class Io extends Mo{constructor(){super();_(this,"_onResizing");_(this,"_onResizeEnd");_(this,"_startPoint",{x:0,y:0});_(this,"_startEventCanvasXy",{x:0,y:0});_(this,"_startSizeCanvasXy",{x:0,y:0});_(this,"_startSize",{x:0,y:0,width:0,height:0,widthOnCanvas:0,heightOnCanvas:0});_(this,"_resizeType","l");_(this,"_nodeStartSizeMap",new WeakMap);_(this,"resizeMinLimit",{width:10,height:10});_(this,"_resizeDraggingTimer");_(this,"_resizeDraggingEvent");_(this,"_resizeDraggingStoped",!0);_(this,"_startCreateLineFromNodeTime",0)}setEditingNodes(e){if(e===null||e.length===0)this.dataProvider.setEditingNodes([]);else{const t=e.map(o=>o.id),n=this.getNodes().filter(o=>t.includes(o.id));this.dataProvider.setEditingNodes(n)}this._updateEditingControllerView(),this._dataUpdated()}addEditingNode(e){if(!this.getNodeById(e.id))throw new Error("Node not found: "+e.id);this.dataProvider.setEditingNodes(this.getOptions().editingController.nodes.concat(e)),this._updateEditingControllerView(),this._dataUpdated()}removeEditingNode(e){this.dataProvider.setEditingNodes(this.getOptions().editingController.nodes.filter(t=>t.id!==e.id)),this._updateEditingControllerView(),this._dataUpdated()}toggleEditingNode(e){this.getOptions().editingController.nodes.findIndex(n=>n.id===e.id)===-1?this.addEditingNode(e):this.removeEditingNode(e)}updateEditingControllerView(){this._updateEditingControllerView(),this._dataUpdated()}_updateEditingControllerView(){this._updateEditingLineView(),this._updateEditingConnectControllerView();const e=this.getOptions();if(!e.editingController.show)return;const{minX:t,minY:n,maxX:o,maxY:s}=this.getNodesRectBox(e.editingController.nodes),a=e.editingController.nodes.length>1?5:0,d=this.dataProvider.getCanvasScale();let h=o-t,c=s-n;if(h<0&&(h=0),c<0&&(c=0),h>0&&c>0){const u=this.getViewXyByCanvasXy({x:t,y:n}),p=u.x-a*d,m=u.y-a*d,f=h*d+a*2*d,g=c*d+a*2*d;this.dataProvider.updateOptions({editingController:{...e.editingController,x:p,y:m,width:f,height:g}})}else this.dataProvider.updateOptions({editingController:{...e.editingController,show:!1}})}onResizeStart(e,t){this._resizeType=e,this._startPoint=this.getViewXyByEvent(t),this._startEventCanvasXy=this.getCanvasXyByViewXy(this._startPoint);const n=this.getOptions();this._startSize.x=n.editingController.x,this._startSize.y=n.editingController.y,this._startSizeCanvasXy=this.getCanvasXyByViewXy(this._startSize),this._startSize.width=n.editingController.width,this._startSize.height=n.editingController.height;const o=this.dataProvider.getCanvasScale();this._startSize.widthOnCanvas=n.editingController.width/o,this._startSize.heightOnCanvas=n.editingController.height/o;for(const d of n.editingController.nodes)this._nodeStartSizeMap.set(d,{x:d.x,y:d.y,width:d.el_W,height:d.el_H});this._onResizing&&this.$dom.removeEventListener("mousemove",this._onResizing),this._onResizeEnd&&this.$dom.removeEventListener("mouseup",this._onResizeEnd),this._resizeDraggingEvent=null,this._resizeDraggingStoped=!1,this._onResizing=this.onResizing.bind(this),this._onResizeEnd=this.onResizeEnd.bind(this),this.$dom.addEventListener("mousemove",this._onResizing),this.$dom.addEventListener("mouseup",this._onResizeEnd);const s=this.onResizingRequest.bind(this),a=()=>{s(),this._resizeDraggingTimer=requestAnimationFrame(a)};this._resizeDraggingTimer=requestAnimationFrame(a),this.emitEvent(E.onResizeStart,n.editingController.nodes,t)}onResizing(e){this._resizeDraggingEvent=e}onResizingRequest(){if(!this._resizeDraggingEvent||this._resizeDraggingStoped)return;const e=this.getViewXyByEvent(this._resizeDraggingEvent);this.canvasAutoMoving(e);const t=this.getViewXyByCanvasXy(this._startEventCanvasXy),n=this.getViewXyByCanvasXy(this._startSizeCanvasXy),o=e.x-t.x,s=e.y-t.y,a=this.getOptions();let d=a.editingController.width,h=a.editingController.height,c=a.editingController.x,u=a.editingController.y;const p=this.dataProvider.getCanvasScale();this._resizeType==="tl"?(c=t.x+o,u=t.y+s,d=this._startSize.widthOnCanvas*p-o,h=this._startSize.heightOnCanvas*p-s):this._resizeType==="tr"?(u=t.y+s,c=n.x,d=this._startSize.widthOnCanvas*p+o,h=this._startSize.heightOnCanvas*p-s):this._resizeType==="bl"?(c=t.x+o,u=n.y,d=this._startSize.widthOnCanvas*p-o,h=this._startSize.heightOnCanvas*p+s):this._resizeType==="br"?(c=n.x,u=n.y,d=this._startSize.widthOnCanvas*p+o,h=this._startSize.heightOnCanvas*p+s):this._resizeType==="t"?(u=t.y+s,h=this._startSize.heightOnCanvas*p-s):this._resizeType==="r"?(c=n.x,d=this._startSize.widthOnCanvas*p+o):this._resizeType==="b"?(h=this._startSize.heightOnCanvas*p+s,u=n.y):this._resizeType==="l"&&(c=t.x+o,d=this._startSize.widthOnCanvas*p-o),d<this.resizeMinLimit.width&&(d=this.resizeMinLimit.width),h<this.resizeMinLimit.width&&(h=this.resizeMinLimit.height),this.dataProvider.updateOptions({editingController:{...a.editingController,x:c,y:u,width:d,height:h}}),this._applyResizeScale(this._resizeDraggingEvent),this._updateEditingControllerView(),this._dataUpdated()}_applyResizeScale(e){const t=this.getOptions(),n=this.dataProvider.getCanvasScale(),o=t.editingController.width/n/this._startSize.widthOnCanvas,s=t.editingController.height/n/this._startSize.heightOnCanvas,a=this._startSizeCanvasXy,d=this.getCanvasXyByViewXy({x:t.editingController.x,y:t.editingController.y});let h=!0,c=!0;this._resizeType==="t"||this._resizeType==="b"?h=!1:(this._resizeType==="r"||this._resizeType==="l")&&(c=!1);for(const u of t.editingController.nodes){const p=this._nodeStartSizeMap.get(u),m=p.width*o,f=p.height*s,g=d.x+o*(p.x-a.x),y=d.y+s*(p.y-a.y),v=m,x=f;this.emitEvent(E.beforeNodeResize,u,g,y,v,x)===!1||(h&&this.dataProvider.updateNode(u.id,{x:g,width:v,el_W:v}),c&&this.dataProvider.updateNode(u.id,{y,height:x,el_H:x}))}}onResizeEnd(e){cancelAnimationFrame(this._resizeDraggingTimer),this._resizeDraggingStoped=!0;const t=this.getViewXyByEvent(e),n=t.x-this._startPoint.x,o=t.y-this._startPoint.y;this._applyResizeScale(e),this.$dom.removeEventListener("mousemove",this._onResizing),this.$dom.removeEventListener("mouseup",this._onResizeEnd),this._onResizing=null,this._onResizeEnd=null,C("onResizeEnd:",this.getOptions().editingController.nodes,n,o),this.emitEvent(E.onResizeEnd,this.getOptions().editingController.nodes,n,o,e)}draggingSelectedNodes(e,t,n,o,s){const a=this.updateReferenceLineView(e,t,n,o,s);if(a){const{showV:h,fixedX:c,showH:u,fixedY:p}=a;h&&(o+=c-t,t=c),u&&(s+=p-n,n=p)}const d=this.getOptions();if(!d.editingController.nodes.includes(e))this.dataProvider.updateNode(e.id,{x:t,y:n}),this._updateEditingLineView();else{for(const h of d.editingController.nodes){const c=this._nodeXYMappingBeforeDrag[h.id];c&&this.dataProvider.updateNode(h.id,{x:c.x+o,y:c.y+s})}this._updateEditingControllerView()}}_updateEditingConnectControllerView(){const e=this.getOptions();if(!e.nodeConnectController.show)return;const t=e.nodeConnectController.node,n=t.x,o=t.y,s=t.x+t.el_W,a=t.y+t.el_H,d=0,h=this.dataProvider.getCanvasScale(),c=n,u=o,p=s-n,m=a-o,f=this.getViewXyByCanvasXy({x:c,y:u});this.dataProvider.updateOptions({nodeConnectController:{...e.nodeConnectController,x:f.x-d*h,y:f.y-d*h,width:p*h+d*2*h,height:m*h+d*2*h}})}setEditingLine(e){this.dataProvider.setEditingLine(e),this._updateEditingLineView(),this._dataUpdated()}updateReferenceLineView(e,t,n,o,s){const a=this.getOptions();if(!a.showReferenceLine)return;if(!a.editingReferenceLine.show){const M=Math.abs(o),w=Math.abs(s);M+w>2&&this.dataProvider.updateOptions({editingReferenceLine:{...a.editingReferenceLine,show:!0}})}if(!a.editingReferenceLine.show)return;const d=t,h=e.el_W,c=e.el_H,u=t+h/2,p=t+h,m=n,f=n+c/2,g=n+c,y=this.getViewXyByCanvasXy({x:u,y:f});let v=!1,x=!1,L=0,N=0;const T=this.getNodes().filter(M=>this._nodeXYMappingBeforeDrag[M.id]?!1:Math.abs(M.x-u)<600&&Math.abs(M.y-f)<600);T.sort((M,w)=>{const I=ue(u,f,M.x+M.el_W/2,M.y+M.el_H/2),V=ue(u,f,w.x+w.el_W/2,w.y+w.el_H/2);return I<V?-1:1});let{v_x:O,v_y:b,v_height:k,h_x:P,h_y:S,h_width:R}=a.editingReferenceLine;for(const M of T){const w=M.x,I=M.el_W,V=M.el_H,A=M.x+I/2,z=M.x+I,G=M.y,W=M.y+V/2,U=M.y+V,ne=Math.abs(d-w),ee=Math.abs(u-A),te=Math.abs(p-z),Q=Math.abs(m-G),Z=Math.abs(f-W),oe=Math.abs(g-U),j=5;if(ee<800&&Z<800){if(!x&&ee<j){const F=this.getViewXyByCanvasXy({x:A,y:W});O=F.x,b=y.y>F.y?F.y:y.y,k=Math.round(Math.abs(y.y-F.y)),x=!0,L=A-h/2}if(!x&&ne<j){const F=this.getViewXyByCanvasXy({x:w,y:W});O=F.x,b=y.y>F.y?F.y:y.y,k=Math.round(Math.abs(y.y-F.y)),x=!0,L=w}if(!x&&te<j){const F=this.getViewXyByCanvasXy({x:z,y:W});O=F.x,b=y.y>F.y?F.y:y.y,k=Math.round(Math.abs(y.y-F.y)),x=!0,L=z-h}if(!v&&Z<j){const F=this.getViewXyByCanvasXy({x:A,y:W});S=F.y,P=y.x>F.x?F.x:y.x,R=Math.round(Math.abs(y.x-F.x)),v=!0,N=W-c/2}if(!v&&Q<j){const F=this.getViewXyByCanvasXy({x:A,y:G});S=F.y,P=y.x>F.x?F.x:y.x,R=Math.round(Math.abs(y.x-F.x)),v=!0,N=G}if(!v&&oe<j){const F=this.getViewXyByCanvasXy({x:A,y:U});S=F.y,P=y.x>F.x?F.x:y.x,R=Math.abs(y.x-F.x),v=!0,N=U-c}if(v&&x)break}}if(this.dataProvider.updateOptions({editingReferenceLine:{...a.editingReferenceLine,v_x:O,v_y:b,v_height:k,h_x:P,h_y:S,h_width:R,directionH:v,directionV:x}}),a.referenceLineAdsorption)return{showV:x,fixedX:L,showH:v,fixedY:N}}hideEditingLineView(){this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,show:!1}})}updateEditingLineView(){this._updateEditingLineView(),this._dataUpdated()}_updateEditingLineView(){this.updateElementLines();const e=this.getOptions();if(!e.editingLineController.show)return;const t=e.editingLineController.line,n=this.getLinkByLine(t);if(!t||t.to==="newRelationTemplate-to"){this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,show:!1}});return}let o,s,a;const d=this.createLineDrawInfo(n,t);if(!d){this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,show:!1}});return}if(t.lineShape===$.StandardOrthogonal){let{textPosition:N,pathData:T,points:O,startDirection:b,endDirection:k}=d;a=N,o=O[0],s=O[O.length-1];const P=[];for(let S=0;S<O.length-1;S++){const R=O[S],M=O[S+1],w={pIndex:S,optionName:"cp-"+S,x:0,y:0,direction:"v",startDirection:b,endDirection:k};R.x!==M.x&&(w.direction="h");const I=this.getViewXyByCanvasXy({x:(R.x+M.x)/2,y:(R.y+M.y)/2});w.x=I.x,w.y=I.y,P.push(w)}if(P.length!==1){if(P.length!==2)if(P.length===3){const S=O[0],R=O[1],M=O[3];if(P[1].direction==="v"){const w=S.x,I=R.x,V=M.x;if(Math.max(w,I,V)!==I&&Math.min(w,I,V)!==I)P[1].optionName="cx";else{const z=Math.abs(I-w),G=Math.abs(I-V);z>=G?P[1].optionName="td":z<G&&(P[1].optionName="fd")}}else{const w=S.y,I=R.y,V=M.y;if(Math.max(w,I,V)!==I&&Math.min(w,I,V)!==I)P[1].optionName="cy";else{const z=Math.abs(I-w),G=Math.abs(I-V);z>=G?P[1].optionName="td":z<G&&(P[1].optionName="fd")}}}else P.length===4?(P[1].optionName="fd",P[2].optionName="td"):P.length===5&&(P[1].optionName="fd",P[2].direction==="v"?P[2].optionName="cx":P[2].optionName="cy",P[3].optionName="td")}this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,line44Splits:P,line49Points:O}})}else if(t.lineShape===$.HardOrthogonal){let{textPosition:N,pathData:T,points:O,startDirection:b,endDirection:k}=d;a=N;const P=[];O=t.ctrlPointsFor49,o=O[0],s=O[O.length-1];const S=O;for(let R=0;R<S.length-1;R++){const M=S[R],w=S[R+1],I={pIndex:R,optionName:"cp-"+R,x:0,y:0,direction:"v",startDirection:b,endDirection:k};M.x!==w.x?(I.direction="h",Math.abs(M.x-w.x)<15&&(I.hide=!0)):Math.abs(M.y-w.y)<15&&(I.hide=!0);const V=this.getViewXyByCanvasXy({x:(M.x+w.x)/2,y:(M.y+w.y)/2});I.x=V.x,I.y=V.y,P.push(I)}for(let R=0;R<P.length;R++){const M=P[R-1],w=P[R],I=P[R+1];R===0&&w.direction===I.direction&&(w.hide=!0),R===P.length-1&&w.direction===M.direction&&(w.hide=!0)}this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,line44Splits:P,line49Points:S}})}else if(t.lineShape!==1){a=d.textPosition;const N=We(d.pathData);let T,O;t.isReverse?(o=N.endPoint,s=N.startPoint,T=this.getViewXyByCanvasXy(N.ctrl1),O=this.getViewXyByCanvasXy(N.ctrl2)):(o=N.startPoint,s=N.endPoint,T=this.getViewXyByCanvasXy(N.ctrl1),O=this.getViewXyByCanvasXy(N.ctrl2)),this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,ctrlPoint1:T,ctrlPoint2:O}})}else{a=d.textPosition;const N=d.pathData,T=We(N);o=T.startPoint,s=T.endPoint}const h=this.getViewXyByCanvasXy(t.isReverse?s:o),c=this.getViewXyByCanvasXy(t.isReverse?o:s);this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,startPoint:h,endPoint:c}});const u=this.getViewXyByCanvasXy(a),p=this.$canvasDom.querySelector(`g[data-id='${t.id}']`);let m=0,f=0,g=t.textOffsetX||0,y=t.textOffsetY||0;const v=this.dataProvider.getCanvasScale();let x=20,L=20;if(p){const N=p.querySelector("text.rg-line-text");if(N){g=Math.floor(parseFloat(N.getAttribute("x")||"0")),y=Math.floor(parseFloat(N.getAttribute("y")||"0"));const T=N.clientWidth,O=N.clientHeight;x=T,L=O}}x+=40,L+=10,x>120&&(x=120),L>20&&(L=20),this.dataProvider.updateOptions({editingLineController:{...this.getOptions().editingLineController,text:{...this.getOptions().editingLineController.text,width:x,height:L,x:u.x+m+g*v,y:u.y+f+y*v}}})}startMoveLineVertex(e,t,n){t.stopPropagation();const o=this.getOptions().editingLineController.line,s=this.getLinkByLine(o);let a,d;if(s)a=s.fromNode,d=s.toNode;else{const{from:u,to:p}=this.generateFakeLineConfig(o);a=u,d=p}let h=a;this.dataProvider.setEditingLine(null),s?this.removeLine(o):this.removeFakeLine(o),console.log("DragLine start:",e,o.isReverse);let c=!1;o.lineShape===$.HardOrthogonal&&(o.lineShape=$.StandardOrthogonal),e==="start"?(o.fromJunctionPointOffsetX=0,o.fromJunctionPointOffsetY=0,h=d,c=!0):(o.toJunctionPointOffsetX=0,o.toJunctionPointOffsetY=0),this.startCreatingLinePlot(t,{template:o,fromNode:h,isReverse:c,onCreateLine:n})}startCreateLineFromNode(e,t,n,o){n.stopPropagation();const s=JSON.parse(JSON.stringify(t));if(this._startCreateLineFromNodeTime=Date.now(),!s.from){if(!e){const d=this.getOptions().editingController.nodes;d.length===1&&(e=d[0])}e&&(s.from=e.id,s.fromType=e.targetType)}if(!s.from)throw console.error("Error:lineTemplate:",s),Error("Error:startCreateLineByTemplate: lineTemplate must has [fromType, from]");const a=this.getFakeLineTarget(s.fromType,s.from,s);if(!a)throw console.error("Error:fakeTarget[fromType, from]:",s.fromType,s.from,s),Error(`Error:startCreateLineByTemplate: error from fakeTarget[fromType, from]:${s.fromType}, ${s.from}`);s.lineShape||(s.lineShape=6),this.startCreatingLinePlot(n,{template:s,fromNode:a,isReverse:!1,onCreateLine:o})}onLineVertexBeDropped(e,t,n={x:0,y:0},o){t.stopPropagation();const s=this.getOptions();if(!s.creatingLinePlot||Date.now()-this._startCreateLineFromNodeTime<500)return;console.log("Connect end:isReverse:",s.newLineTemplate.isReverse);const a=s.nodeConnectController.node;let{toJunctionPoint:d,toJunctionPointOffsetX:h,toJunctionPointOffsetY:c,fromJunctionPoint:u,fromJunctionPointOffsetX:p,fromJunctionPointOffsetY:m}=s.newLineTemplate;if(!s.newLinkTemplate.fromNode)s.newLineTemplate.isReverse?(d=e,h=n.x,c=n.y):(u=e,p=n.x,m=n.y),this.dataProvider.updateOptions({newLineTemplate:{...this.getOptions().newLineTemplate,fromJunctionPoint:u,fromJunctionPointOffsetX:p,fromJunctionPointOffsetY:m,toJunctionPoint:d,toJunctionPointOffsetX:h,toJunctionPointOffsetY:c},newLinkTemplate:{...this.getOptions().newLinkTemplate,fromNode:a}});else{s.newLineTemplate.isReverse?(u=e,p=n.x,m=n.y):(d=e,h=n.x,c=n.y);const f=this.getOptions().newLinkTemplate.fromNode;this.dataProvider.updateOptions({newLineTemplate:{...this.getOptions().newLineTemplate,fromJunctionPoint:u,fromJunctionPointOffsetX:p,fromJunctionPointOffsetY:m,toJunctionPoint:d,toJunctionPointOffsetX:h,toJunctionPointOffsetY:c},newLinkTemplate:{...this.getOptions().newLinkTemplate,toNodeObject:a}});const g=a;try{const y={newLineTemplate:this.getOptions().newLineTemplate,fromNode:f,toNode:g};this.emitEvent(E.onLineVertexDropped,y),o&&o(y.fromNode,y.toNode,y.newLineTemplate),this.onReadyToCreateLine(this.getOptions().newLinkTemplate.fromNode,this.getOptions().nodeConnectController.node)!==!0&&this.stopCreatingLinePlot()}catch(y){this.stopCreatingLinePlot(),console.warn("[Custom Reject onCreateLine By Throw Error:",y)}}}startMoveLineText(e,t){if(Ce(e))return;const n=this.getViewXyByEvent(e),s=this.getOptions().editingLineController.line;console.log("startMoveLineText:",s.id);const a=s.textOffsetX||0,d=s.textOffsetY||0;let h=!1;const c=p=>{const m=this.dataProvider.getCanvasScale(),f=this.getViewXyByEvent(p),g=f.x-n.x,y=f.y-n.y;(g>0||y>0)&&(h=!0),s.textOffsetX=Math.round(a+g/m),s.textOffsetY=Math.round(d+y/m),this._updateEditingLineView(),this._dataUpdated()},u=p=>{this.$dom.removeEventListener("mousemove",c),this.$dom.removeEventListener("mouseup",u),h&&t&&t(),this._dataUpdated()};this.$dom.addEventListener("mousemove",c),this.$dom.addEventListener("mouseup",u)}startMoveLine6CtrlPoint(e,t,n){t.stopPropagation(),t.preventDefault();const a=this.getOptions().editingLineController.line;let d=a.ctrlPoints||[];d.length===0&&(d.push({x:0,y:0}),d.push({x:0,y:0})),this.dataProvider.updateLine(a.id,{ctrlPoints:d}),console.log("startMoveLine6CtrlPoint:line:",a),d=a.ctrlPoints,a.isReverse&&(e=d.length-1-e);const h=this.dataProvider.getCanvasScale(),c=d[e],{x:u,y:p}=c,m=()=>{n(a),this._dataUpdated()};le.startDrag(t,{x:0,y:0},m,(f,g)=>{c.x=u+f/h,c.y=p+g/h,this.dataProvider.updateLine(a.id,{ctrlPoints:d}),this._updateEditingLineView(),this._dataUpdated()})}startMoveLine44CtrlPoint(e,t,n){t.stopPropagation(),t.preventDefault();const s=this.getOptions().editingLineController,a=s.line;console.log("startMoveLine44CtrlPoint:",a==null?void 0:a.lineShape,e.optionName);let d=a.ctrlOptionsFor44;d||(d={cx:0,cy:0,fd:0,td:0},this.dataProvider.updateLine(a.id,{ctrlOptionsFor44:d}),d=a.ctrlOptionsFor44);const h=d[e.optionName],c={indexOffset:0};let u=a.ctrlPointsFor49?JSON.parse(JSON.stringify(a.ctrlPointsFor49)):null;const p=(f,g)=>{console.log("lineSplitCtrlMoving:",a==null?void 0:a.lineShape,e.optionName);const y=this.dataProvider.getCanvasScale();if(a.lineShape===$.StandardOrthogonal){if(e.optionName==="cx"){const x=h+f/y*1;d.cx=x,this.dataProvider.updateLine(a.id,{ctrlOptionsFor44:d})}else if(e.optionName==="cy"){const x=h+g/y*1;d.cy=x,this.dataProvider.updateLine(a.id,{ctrlOptionsFor44:d})}else if(e.optionName==="fd"){const v=Pe[e.startDirection],x=e.direction==="v"?f*v.x:g*v.y;d.fd=h+x/y,this.dataProvider.updateLine(a.id,{ctrlOptionsFor44:d})}else if(e.optionName==="td"){const v=Pe[e.endDirection],x=e.direction==="v"?f*v.x:g*v.y;d.td=h+x/y,this.dataProvider.updateLine(a.id,{ctrlOptionsFor44:d})}else if(e.direction==="v"&&Math.abs(f)>5||e.direction==="h"&&Math.abs(g)>5){const v=s.line49Points;u=JSON.parse(JSON.stringify(v)),console.log(":startCtrlPointsFor49:::",u),this.dataProvider.updateLine(a.id,{ctrlPointsFor49:u}),this.dataProvider.updateLine(a.id,{lineShape:$.HardOrthogonal})}}else if(a.lineShape===$.HardOrthogonal){const{newPoints:v,pointsChanged:x}=Hn(a.ctrlPointsFor49,u,e.pIndex+c.indexOffset,e,c,f/y,g/y);x&&(u=JSON.parse(JSON.stringify(v))),this.dataProvider.updateLine(a.id,{ctrlPointsFor49:v})}},m=()=>{if(a.lineShape===$.HardOrthogonal){const f=Te(a.ctrlPointsFor49);this.dataProvider.updateLine(a.id,{ctrlPointsFor49:f})}this._updateEditingLineView(),n&&n(a),this._dataUpdated()};le.startDrag(t,{x:0,y:0},m,(f,g)=>{p(f,g),this._updateEditingLineView(),this._dataUpdated()})}onLineVertexBeDroppedOnConnectController(e,t,n,o){if(C("onLineVertexBeDroppedOnConnectController",e,t,n),t.stopPropagation(),!n){this.onLineVertexBeDropped(e,t,void 0,o);return}const s=me(t),a=n.getBoundingClientRect(),d={x:a.left,y:a.top+a.height/2},h={x:a.left+a.width/2,y:a.top},c={x:a.left+a.width,y:a.top+a.height/2},u={x:a.left+a.width/2,y:a.top+a.height};let p=se.left;const m={x:0,y:0};if(e)p=e,p===se.top||p===se.bottom?m.x=s.clientX-u.x:p===se.right?m.y=s.clientY-c.y:m.y=s.clientY-d.y;else{const g=ue(s.clientX,s.clientY,d.x,d.y),y=ue(s.clientX,s.clientY,h.x,h.y),v=ue(s.clientX,s.clientY,c.x,c.y),x=ue(s.clientX,s.clientY,u.x,u.y),L=Math.min(g,y,v,x);L===g?(p=se.left,m.x=s.clientX-d.x,m.y=s.clientY-d.y):L===y?(p=se.top,m.x=s.clientX-h.x,m.y=s.clientY-h.y):L===v?(p=se.right,m.x=s.clientX-c.x,m.y=s.clientY-c.y):L===x&&(p=se.bottom,m.x=s.clientX-u.x,m.y=s.clientY-u.y)}const f=this.dataProvider.getCanvasScale();m.x=m.x/f,m.y=m.y/f,C("onMouseUpWithOffset:",e,m),this.onLineVertexBeDropped(p,t,m,o)}}class Eo extends Io{constructor(){super();_(this,"$miniViewCanvas");_(this,"$mvCanvasCtx");_(this,"_canvasDomScale",1);_(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});_(this,"visibleArea",{x:0,y:0});_(this,"_canvasItemMiniSizeLimit",1)}setMiniViewCanvas(e){this.$miniViewCanvas=e,this.$mvCanvasCtx=this.$miniViewCanvas.getContext("2d")}updateMiniView(){!this.getOptions().showMiniView||(this.updateMiniViewVisibleArea(),this._updateMiniView())}_updateMiniView(){try{const e=Date.now();this.mvDosomethingBeforeDraw(),this.mvDrawAllNodes()}catch(e){console.error(e)}}mvDosomethingBeforeDraw(){let e=9999999,t=9999999,n=-9999999,o=-9999999,s=0;for(const x of this.getNodes())if(x.rgCalcedVisibility&&x.opacity!==0){x.x<e&&(e=x.x),x.y<t&&(t=x.y);const L=x.x+x.el_W,N=x.y+x.el_H;L>n&&(n=L),N>o&&(o=N),s++}const a=1,d=50,h=50;s===0?(this.miniViewBox.canvas_start_x=-100-d,this.miniViewBox.canvas_start_y=-100-h,this.miniViewBox.canvas_end_x=100+d,this.miniViewBox.canvas_end_y=100+h,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):(this.miniViewBox.canvas_start_x=e-d,this.miniViewBox.canvas_start_y=t-h,this.miniViewBox.canvas_end_x=n+d,this.miniViewBox.canvas_end_y=o+h,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 c=this.$miniViewCanvas.parentElement.getBoundingClientRect(),u=c.width,p=c.height;let m=0,f=0,g=1;u/this.miniViewBox.canvas_width<p/this.miniViewBox.canvas_height?(g=u/this.miniViewBox.canvas_width*a,m=u,f=u/this.miniViewBox.canvas_width*this.miniViewBox.canvas_height):(g=p/this.miniViewBox.canvas_height*a,m=p/this.miniViewBox.canvas_height*this.miniViewBox.canvas_width,f=p),this.miniViewBox.miniview_width=u,this.miniViewBox.miniview_height=p,this.$miniViewCanvas.width=u,this.$miniViewCanvas.height=p,this.$mvCanvasCtx.canvas.width=u*window.devicePixelRatio,this.$mvCanvasCtx.canvas.height=p*window.devicePixelRatio,this.$mvCanvasCtx.canvas.style.width=`${u}px`,this.$mvCanvasCtx.canvas.style.height=`${p}px`;const y=(p-f)/2,v=(u-m)/2;this.miniViewBox.canvas_start_x-=v/g,this.miniViewBox.canvas_start_y-=y/g,this.$mvCanvasCtx.setTransform(window.devicePixelRatio,0,0,window.devicePixelRatio,0,0),this.$mvCanvasCtx.scale(g,g),this._canvasDomScale=g,this.$mvCanvasCtx.clearRect(0,0,this.$mvCanvasCtx.canvas.width,this.$mvCanvasCtx.canvas.height)}updateMiniViewVisibleArea(){const e=this.getCanvasXyByViewXy({x:0,y:0}),t=this.getOptions().viewSize,n=this.getCanvasXyByViewXy({x:t.width,y:t.height}),o=this._canvasDomScale,s=n.x-e.x,a=n.y-e.y;this.miniViewBox.visibleAreaStart=e,this.miniViewBox.visibleAreaEnd=n;const d=o*s,h=o*a,c=e.x-this.miniViewBox.canvas_start_x,u=e.y-this.miniViewBox.canvas_start_y,p=o*c,m=o*u;let f=!1;(p+d<0||m+h<0||m>this.miniViewBox.miniview_height||p>this.miniViewBox.miniview_width)&&(f=!0),this.dataProvider.updateOptions({miniViewVisibleHandle:{...this.getOptions().miniViewVisibleHandle,emptyContent:f,width:d,height:h,x:p,y:m}})}mvDrawAllNodes(){const e=this._canvasDomScale,t=this.getOptions().defaultNodeShape;for(const n of this.getNodes())if(n.rgCalcedVisibility&&n.opacity!==0){let o=n.el_W,s=n.el_H;e*o<this._canvasItemMiniSizeLimit&&(o=this._canvasItemMiniSizeLimit/this._canvasDomScale),e*s<this._canvasItemMiniSizeLimit&&(s=this._canvasItemMiniSizeLimit/this._canvasDomScale);const a=Le(n.nodeShape,t);this.mvDrawNode(n,a,o,s)}}mvDrawNode(e,t,n,o){t===_e.circle?this.mvDrawNode4Circle(e,n,o):this.mvDrawNode4Rect(e,n,o)}mvDrawNode4Rect(e,t,n){const o=this.$mvCanvasCtx,s=e.x-this.miniViewBox.canvas_start_x,a=e.y-this.miniViewBox.canvas_start_y;o.beginPath(),o.globalAlpha=e.opacity||1,o.rect(s,a,t,n),o.fillStyle=this.getNodeColor(e),o.fill(),o.strokeStyle="#666666",o.lineWidth=2,o.stroke(),o.globalAlpha=1}mvDrawNode4Circle(e,t,n){const o=this.$mvCanvasCtx,s=e.x+t/2-this.miniViewBox.canvas_start_x,a=e.y+n/2-this.miniViewBox.canvas_start_y;o.beginPath(),o.globalAlpha=e.opacity||1,o.ellipse(s,a,t/2,n/2,0,0,2*Math.PI),o.fillStyle=this.getNodeColor(e),o.fill(),o.strokeStyle="#666666",o.lineWidth=2,o.stroke(),o.globalAlpha=1}mvDrawAllLines(){for(const e of this.getLinks())e.fromNode.rgCalcedVisibility&&e.toNode.rgCalcedVisibility&&this.mvDrawLine(e,e.line)}mvDrawLine(e,t){const n=this.$mvCanvasCtx,o=this.createLineDrawInfo(e,t);n.beginPath(),n.globalAlpha=t.opacity||1,this.mvDrawSvgPathOnCanvas(n,o.pathData);const s=this.getOptions();n.strokeStyle=t.color||s.defaultLineColor||"#888888",n.lineWidth=t.lineWidth||s.defaultLineWidth||1,n.stroke(),n.globalAlpha=1}mvDrawSvgPathOnCanvas(e,t){const n=t.match(/[a-zA-Z][^a-zA-Z]*/g);let o=0,s=0,a=0,d=0,h=0,c=0,u=0,p=0,m=!1;n.forEach(f=>{const g=f.trim().split(/[ ,]+/),y=g[0].toUpperCase(),v=g[0]===g[0].toLowerCase();switch(y){case"M":o=Y(a,g[1],v)-this.miniViewBox.canvas_start_x,s=Y(d,g[2],v)-this.miniViewBox.canvas_start_y,a=o,d=s,m&&(e.closePath(),m=!1),e.moveTo(o,s);break;case"L":o=Y(a,g[1],v)-this.miniViewBox.canvas_start_x,s=Y(d,g[2],v)-this.miniViewBox.canvas_start_y,e.lineTo(o,s);break;case"C":h=Y(a,g[1],v),c=Y(d,g[2],v),u=Y(a,g[3],v),p=Y(d,g[4],v),o=Y(a,g[5],v),s=Y(d,g[6],v),a=o,d=s,e.bezierCurveTo(h,c,u,p,o,s);break;case"Q":h=Y(a,g[1],v),c=Y(d,g[2],v),o=Y(a,g[3],v),s=Y(d,g[4],v),a=o,d=s;break;case"V":s=Y(d,g[1],v),d=s,e.lineTo(o,s);break;case"H":o=Y(a,g[1],v),a=o,e.lineTo(o,s);break;case"Z":e.closePath(),m=!1;break;default:C(`Unsupported command: ${y}`)}})}onVisibleViewHandleDragStart(e){e.preventDefault(),e.stopPropagation(),console.log("onVisibleViewHandleDragStart:");const t=this.getOptions(),n=t.canvasOffset.x,o=t.canvasOffset.y,s=this.miniViewBox.canvas_width,a=this.miniViewBox.canvas_height,d=()=>{const f=p/this.miniViewBox.miniview_width,g=m/this.miniViewBox.miniview_height,y=this.dataProvider.getCanvasScale(),v=s*f*y,x=a*g*y;console.log("setCanvasOffset:buff:",p,m),this.dataProvider.setCanvasOffset(n-v,o-x),this._updateEditingControllerView(),this.updateMiniViewVisibleArea(),this.updateShouldRenderGraphData(),this.dataProvider.dataUpdated()};let h;const c=(f,g,y)=>{h&&clearInterval(h),this.onCanvasDragEnd(y)};let u=!1,p=0,m=0;le.startDrag(e,{x:0,y:0},c,(f,g)=>{p=f,m=g,console.log("onVisibleViewHandleDragStart:move:",f,g),!u&&Math.abs(f)+Math.abs(g)>3&&(console.log("onVisibleViewHandleDragStart:start"),u=!0,h=setInterval(()=>{d()},50))})}resetByVisiableView(e){!this.getOptions().miniViewVisibleHandle.emptyContent||(this.setZoom(100),this._moveToCenter(),this.zoomToFit())}}class Do extends Eo{constructor(){super();_(this,"$watermarkDom",null);_(this,"$watermarkPosition","br");_(this,"$backgroundDom",null);_(this,"_originBackgroundColor","");_(this,"graphStatusBeforeImageGeneration",{orignCanvasOffsetX:0,orignCanvasOffsetY:0,orignZoom:0,forceLayouting:!1})}setWatermarkDom(e,t=!0,n=!1,o="br"){t&&(this.$watermarkDom=e),this.$watermarkPosition=o}setBackgroundDom(e,t=!0,n=!0){e===null?(this._originBackgroundColor=this.options.backgroundColor,this.dataProvider.updateOptions({backgroundColor:"transparent"}),t?this.$backgroundDom=e:this.$backgroundDom=null):(this.dataProvider.updateOptions({backgroundColor:this._originBackgroundColor}),this.$backgroundDom=null)}async prepareForImageGeneration(){return this.updateShouldRenderGraphData(),this.updateElementLines(),await this.moveItemsAndFitContent(),this._dataUpdated(),this.$canvasDom.parentElement}async restoreAfterImageGeneration(){const{orignCanvasOffsetX:e,orignCanvasOffsetY:t,orignZoom:n,forceLayouting:o}=this.graphStatusBeforeImageGeneration;this.$canvasDom.parentElement.style.width="100%",this.$canvasDom.parentElement.style.height="100%",this.setZoom(n),this.dataProvider.updateOptions({canvasOffset:{x:e,y:t}}),this._dataUpdated(),o&&this.startAutoLayout(),this.clearLoading()}async moveItemsAndFitContent(){const e=this.getOptions(),t=e.canvasZoom,n=e.canvasOffset.x,o=e.canvasOffset.y,s=e.layout.autoLayouting===!0;s&&(this.stopAutoLayout(),await this.sleep(200)),this.loading("Generating..."),this.dataProvider.updateOptions({snapshotting:!0}),this.dataProvider.clearChecked(),this.setZoom(100),this.updateShouldRenderGraphData(!0),this._dataUpdated(),await this.sleep(200);const a=this.getNodesRectBox(),d=this.getCanvasSlotRectItems(),h=this.getNodesRectBox(d),c=100,u=Math.min(a.minX,h.minX)-c,p=Math.min(a.minY,h.minY)-c,m=Math.max(a.maxX,h.maxX)+c,f=Math.max(a.maxY,h.maxY)+c,g=u,y=p,v=m-u,x=f-p;this.graphStatusBeforeImageGeneration={orignCanvasOffsetX:n,orignCanvasOffsetY:o,orignZoom:t,forceLayouting:s},this.dataProvider.updateOptions({canvasOffset:{x:-g,y:-y}}),this._dataUpdated(),this.setZoom(100),this.$canvasDom.parentElement.style.width=v+"px",this.$canvasDom.parentElement.style.height=x+"px",C("export image:",{imageWidth:v,imageHeight:x,minX:u,minY:p,maxX:m,maxY:f,devicePixelRatio:window.devicePixelRatio}),await this.sleep(200)}}class Vo extends Do{constructor(){super();_(this,"resizeObserver");_(this,"resizeListenerMap",new WeakMap);_(this,"domToNodeIdMap",new WeakMap);_(this,"mutationObserver4Nodes");_(this,"mutationObserver4CanvasSlotBehind");_(this,"mutationObserver4CanvasSlotAbove");_(this,"_updateCanvasConnectTargetsTask");_(this,"onKeyDownHanlder");_(this,"onKeyUpHanlder")}setDom(e){C("relation-graph mounted on:",this.instanceId,e),this.$dom=e}setCanvasDom(e){C("relation-graph canvas dom mounted!"),this.$canvasDom=e,this.$lineTextContainer4NormalLine=null,this.$lineTextContainer4FakeLine=null,this.reinitMutationObservers(),this.getLineTextContainer({isFakeLine:!0}),this.getLineTextContainer({isFakeLine:!1})}getResizeObserver(){return this.resizeObserver||(this.resizeObserver=new ResizeObserver((e,t)=>{for(const n of e){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)}})),this.resizeObserver}initDom(){this.addResizeListener(this.$dom,(e,t)=>{C("resizeListener:this.$dom"),this.resetViewSize(),this.updateEasyView(),this._rgAsConnectArea&&this.updateCanvasConnectTargetsPosition("View Resize"),this._updateEditingLineView(),this._updateEditingControllerView(),this._dataUpdated(),setTimeout(()=>{C("resizeListener:updateShouldRenderGraphData"),this.emitEvent(E.onViewResize,{width:e,height:t}),this._dataUpdated()},500)}),this._rgAsConnectArea||(this.removeKeyboardListener(),this.addKeyboardListener())}updateCanvasConnectTargetsPosition(e="api"){this.updateConnectTargetsOnCanvas(e,this.$dom.querySelector(".rg-canvas-slot-behind")),this.updateConnectTargetsOnCanvas(e,this.$dom.querySelector(".rg-canvas-slot-above"))}reinitMutationObservers(){this.destroyMutationObserver();const e=this.$canvasDom.querySelector(".rg-nodes-container-wrapper");if(e)this.mutationObserver4Nodes=new MutationObserver(o=>{if(this.dataProvider.getConnectTargets().length>0)for(const s of o){const a=this.getNodeElByChildrenTarget(s.target),d=this.domToNodeIdMap.get(a);d&&this.updateConnectTargetsOnNode("Mutation",d,a)}}),this.mutationObserver4Nodes.observe(e,{childList:!0,subtree:!0,characterData:!0});else throw new Error("MutationObserver:error:Can not find: .rg-nodes-container-wrapper");const t=this.$canvasDom.parentElement.querySelector(".rg-canvas-slot-behind");if(t)this.mutationObserver4CanvasSlotBehind=new MutationObserver(o=>{console.warn("MutationObserver:updateConnectTargetsOnCanvas:mutations:",o),this.updateConnectTargetsOnCanvas("CanvasBehind-Mutation",t)}),this.mutationObserver4CanvasSlotBehind.observe(t,{childList:!0,subtree:!0,characterData:!0});else throw new Error("MutationObserver:error:Can not find: .rg-canvas-slot-behind");const n=this.$canvasDom.parentElement.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)}addKeyboardListener(){this.onKeyDownHanlder=e=>{Ce(e)||(e.code==="Space"&&(e.preventDefault(),this.getOptions().canvasMoveMode===!1&&this.setCanvasMoveMode(!0)),this.emitEvent(E.onKeyboardDown,e))},this.onKeyUpHanlder=e=>{Ce(e)||(e.code==="Space"&&(e.preventDefault(),this.getOptions().canvasMoveMode===!0&&this.setCanvasMoveMode(!1)),this.emitEvent(E.onKeyboardUp,e))},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)}addResizeListener(e,t){this.resizeListenerMap.set(e,t),this.getResizeObserver().observe(e)}_onNodeDomResize(e,t,n){if(t===0||n===0)return;const o=this.domToNodeIdMap.get(e);this._onNodeResize(e,o,t,n)}_onNodeResize(e,t,n,o){n===0||o===0||(this.updateConnectTargetsOnNode("Node-Created",t,e),this.updateNodeOffsetSize(t,n,o))}addNodeResizeListener(e,t){this.domToNodeIdMap.set(e,t.id),this._onNodeResize(e,t.id,e.offsetWidth,e.offsetHeight),this.getResizeObserver().observe(e)}removeNodeResizeListener(e){this.domToNodeIdMap.delete(e),e?this.getResizeObserver().unobserve(e):C("removeNodeResizeListener: dom is null or undefined!")}removeResizeListener(e){this.resizeListenerMap.delete(e),this.resizeObserver&&this.resizeObserver.unobserve(e)}destroyResizeObserver(){this.resizeObserver&&this.resizeObserver.disconnect()}getCanvasSlotList(){return this.$dom.querySelectorAll(".rg-map > .rg-map-canvas > .rg-canvas-slot")}getCanvasSlotRectItems(){if(!this.$dom)return[];const e=this.getCanvasSlotList(),t=[];for(const n of e)for(const o of n.children){const s=o,a={x:s.offsetLeft||0,y:s.offsetTop||0,nodeShape:1,el_W:s.scrollWidth,el_H:s.scrollHeight};t.push(a)}return t}}class Bo extends Vo{constructor(){super()}dataUpdated(){this._requestDataUpdate()}setOptions(i){C("setOptions:",i),this._updateOptions(i),this._dataUpdated()}updateOptions(i){C("updateOptions:",i),this._updateOptions(i),this._dataUpdated()}moveToCenter(i){this._moveToCenter(i),this._dataUpdated()}transToLinker(i=!0){this._rgAsConnectArea=i,this.resetViewSize(),this.updateCanvasConnectTargetsPosition("Linker"),this.removeKeyboardListener(),this._rgAsConnectArea||this.addKeyboardListener(),this._dataUpdated()}setRootNodeId(i){C("setRootNodeId:",i),this.dataProvider.setRootNodeId(i)}getRootNode(){return this.dataProvider.getRootNode()}getCheckedNode(){return this.getNodeById(this.getOptions().checkedNodeId)}getCheckedLine(){const i=this.getLineById(this.getOptions().checkedLineId);return i||this.getFakeLineById(this.getOptions().checkedLineId)}getSelectedNodes(){return this.getNodes().filter(i=>i.selected)}getEditingNodes(){return[...this.getOptions().editingController.nodes]}async setJsonData(i){this._setJsonData(i),await this.doLayout(i.rootId)}async appendJsonData(i,e=!0){C("appendData:",i),this.loadGraphJsonData(i),e&&await this.doLayout()}async applyInitialData(i){C("applyInitialData:",i),await this.setJsonData(i),this.moveToCenter(),this.zoomToFit()}getGraphJsonData(){var o;const i=[],e=[],t=[];this.getNodes().forEach(s=>{const a=Oe(s);a&&i.push(a)}),this.getLines().forEach(s=>{const a=ye(s);a&&e.push(a)}),this.getFakeLines().forEach(s=>{const a=ye(s);a&&t.push(a)});const n={rootId:((o=this.dataProvider.getRootNode())==null?void 0:o.id)||"",nodes:i,lines:e};return t.length>0&&(n.fakeLines=t),n}transRGNodeToJsonObject(i){return Oe(i)}transRGLinkToJsonObject(i){return Xe(i)}transRGLineToJsonObject(i){return ye(i)}getGraphJsonOptions(){const i={},e=["layouter","layoutor","autoLayouting","canvasNVInfo","canvasOffset","canvasZoom","fullscreen","instanceId","layoutClassName","layoutDirection","layoutLabel","layoutName","resetViewSize","viewELSize","viewNVInfo","viewSize","canvasSize","newLinkTemplate","newLineTemplate","newNodeTemplate"],t=this.getOptions();return Object.keys(t).forEach(n=>{e.includes(n)||(i[n]=t[n])}),i}clearGraph(){this._clearGraph(),this._dataUpdated()}printOptions(){const i=this.getGraphJsonOptions();console.log("options:",i),console.log("options-json-string:"),console.log(JSON.stringify(i))}printData(){const i=this.getGraphJsonData();console.log("data:",i),console.log("data-json-string:"),console.log(JSON.stringify(i))}printGraphJsonData(){this.printOptions(),this.printData()}}class xt extends Bo{constructor(){super();_(this,"viewComponentUnmounted",!1)}setListeners(e){this.listeners=e}ready(){this.initDom(),this.resetViewSize(),this.addFullscreenListener(),this.emitEvent(E.onReady,this),this.viewComponentUnmounted=!1}beforeUnmount(){this.viewComponentUnmounted=!0,this.removeFullscreenListener(),this.removeKeyboardListener(),this.destroyMutationObserver(),this.destroyResizeObserver()}}function Ct(l,i=!1){console.log("No parent RGProvider found, creating new graphInstance",i);const e=r.markRaw(l?Reflect.construct(l,[]):new xt);return e._rgAsConnectArea=i,e}function Lt(l,i=!1){const e=r.inject(ve,null);return e?(console.log("Use existing graphInstance from parent RGProvider"),e.graphInstance):Ct(l,i)}const Ee=l=>({get value(){return l()}});function Fe(l){return r.defineComponent({name:"RGDataProvider",props:{options:{required:!1,type:Object}},setup(i,{slots:e}){if(!r.inject(ve,null)){console.error("RGDataProvider");const n=r.ref({rootNode:void 0,nodes:[],normalLines:[],fakeLines:[]}),o=r.ref({}),s=r.ref({nodes:[],lines:[],fakeLines:[]}),a=r.ref(null),d=r.ref(null),h=r.ref([]),c=r.ref([]),u=r.ref([]),p=r.ref(new Map),m=r.ref(new Map),f=Ee(()=>s.value.nodes),g=Ee(()=>s.value.lines),y=Ee(()=>s.value.fakeLines),T={store4Options:{set:O=>{}},store4ShouldRenderNodes:{set:O=>{}},store4ShouldRenderLines:{set:O=>{}},store4ShouldRenderFakeLines:{set:O=>{}},optionsRef:o,shouldRenderNodesRef:f,shouldRenderLinesRef:g,shouldRenderFakeLinesRef:y,textContainer4FakeLineRef:a,textContainer4NormalRef:d};l.setReactiveData4Vue3(T,n.value,o.value,{runtimeDATA4Links:u.value,runtimeDATA4ElLineTargets:h.value,runtimeDATA4ConnectTargets:c.value,runtimeDATA4NodeMap:p.value,runtimeDATA4LinkMap:m.value,runtimeDATA4ShouldRenderItems:s.value},(O,b,k)=>{O[b]=r.markRaw(k)}),l.setOptions(i.options||{}),console.log("Providing new graphInstance on RelationGraph component",T.optionsRef.value),r.provide(ve,{graphInstance:l})}return r.onMounted(()=>{console.error("RGDataProvider mounted")}),()=>e.default?e.default():null}})}const $e={onReady:l=>!0,onNodeClick:(l,i)=>!0,onNodeExpand:(l,i)=>!0,onNodeCollapse:(l,i)=>!0,onLineClick:(l,i,e)=>!0,onNodeDragStart:(l,i)=>!0,onNodeDragEnd:(l,i,e,t)=>!0,onNodeDragging:(l,i,e,t,n,o)=>!0,onCanvasDragEnd:l=>!0,onCanvasDragging:(l,i,e,t)=>!0,onContextmenu:(l,i,e,t,n)=>!0,onFullscreen:(l,i)=>!0,onCanvasClick:l=>!0,onCanvasSelectionEnd:(l,i)=>!0,beforeZoomStart:()=>!0,onZoomEnd:()=>!0,onViewResize:()=>!0,onResizeStart:(l,i)=>!0,beforeNodeResize:(l,i,e,t,n)=>!0,onResizeEnd:(l,i,e,t)=>!0,onLineVertexDropped:l=>!0,beforeCreateLine:l=>!0,onLineBeCreated:l=>!0,beforeAddNodes:l=>!0,beforeAddLines:l=>!0,onKeyboardDown:l=>!0,onKeyboardUp:l=>!0,onCanvasDragStart:(l,i,e)=>!0,onForceLayoutFinish:()=>!0,beforeScrollStart:(l,i,e)=>!0};function wt({relationGraphCore:l}={}){const i=Lt(l),e=Fe(i);return{RelationGraph:r.defineComponent({name:"RelationGraph",props:{options:{required:!1,type:Object},initialData:{required:!1,type:Object},emitProxy:{required:!1,type:Function}},emits:$e,setup(t,{slots:n,emit:o}){return console.error("RelationGraph:props:",n),r.onMounted(()=>{const s=t.emitProxy||o;i.setEventEmitHook((a,...d)=>{s(a,...d)}),Ke("Vue3"),t.options&&i.setOptions(t.options||{}),i.ready(),t.initialData&&i.applyInitialData(t.initialData)}),r.onBeforeUnmount(()=>{i.beforeUnmount()}),()=>r.h(e,{options:t.options},{default:()=>r.h(Nn,t,n)})}}),graphInstance:i}}const ge=l=>l,zo=`graphRef.value.getInstance() will be deprecated
|
|
43
|
+
|
|
44
|
+
It is recommended to use the graphInstance:
|
|
45
|
+
###### Method 1: ######
|
|
46
|
+
|
|
47
|
+
import { RGProvider } from 'relation-graph-vue2';
|
|
48
|
+
|
|
49
|
+
<RGProvider>
|
|
50
|
+
<YourComponent>
|
|
51
|
+
<RelationGraph>
|
|
52
|
+
...
|
|
53
|
+
</RelationGraph>
|
|
54
|
+
</YourComponent>
|
|
55
|
+
</RGProvider>
|
|
56
|
+
|
|
57
|
+
// YourComponent.vue file:
|
|
58
|
+
|
|
59
|
+
// ensuring the correct context is provided so that you can access the graphInstance:
|
|
60
|
+
|
|
61
|
+
import { RelationGraph, useGraphInstance } from 'relation-graph-vue2';
|
|
62
|
+
const graphInstance = useGraphInstance();
|
|
63
|
+
|
|
64
|
+
const graphOptions = ref<RGOptions>({ ... }); // Your RGOptions here
|
|
65
|
+
// Now you can use graphInstance to manipulate the graph data and call APIs. This will facilitate data manipulation and API calls.
|
|
66
|
+
|
|
67
|
+
<div>
|
|
68
|
+
...
|
|
69
|
+
<RelationGraph :options="graphOptions">
|
|
70
|
+
...
|
|
71
|
+
</RelationGraph>
|
|
72
|
+
...
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
However, you can still use the current method, but you can only obtain the <RelationGraph> component instance through:
|
|
76
|
+
graphRef.value.getInstance(). in your <YourComponent>;
|
|
77
|
+
And method graphRef.value.getInstance() will be deprecated in future versions.
|
|
78
|
+
|
|
79
|
+
More details: https://www.relation-graph.com/docs/better-integration#vue3
|
|
80
|
+
|
|
81
|
+
Set option "definitelyNoDataProviderNeeded": true to disable the data provider warning if you are sure that no data provider is needed in your case.
|
|
82
|
+
`,Ao=`graphRef.value.getInstance() will be deprecated
|
|
83
|
+
|
|
84
|
+
It is recommended to use the graphInstance:
|
|
85
|
+
###### Method 1: ######
|
|
86
|
+
|
|
87
|
+
<script setup lang="ts">
|
|
88
|
+
import { useRelationGraph } from 'relation-graph-vue3';
|
|
89
|
+
|
|
90
|
+
const graphOptions = ref<RGOptions>({ ... }); // Your RGOptions here
|
|
91
|
+
const {RelationGraph, graphInstance} = useRelationGraph(); // options is reactive
|
|
92
|
+
|
|
93
|
+
onMounted(() => {
|
|
94
|
+
// Set Data Method 1:
|
|
95
|
+
// Now you can use graphInstance to manipulate the graph data and call APIs.
|
|
96
|
+
graphInstance.setJsonData(...); // Set your initial data\uFF0CThe data will be layout automatically(Use graphOptions.value.layout)
|
|
97
|
+
|
|
98
|
+
// Set Data Method 2:
|
|
99
|
+
// Or set json data by addNodes + addLines directly
|
|
100
|
+
graphInstance.addNodes([{ id:'a' }, { id: 'b'}, { id: 'c'}]);
|
|
101
|
+
graphInstance.addLines([{ from: 'a', to: 'b' }, { from: 'b', to: 'c' }]);
|
|
102
|
+
graphInstance.doLayout('a'); // Use graphOptions.value.layout as default layout algorithm, Use 'a' as the root node id.
|
|
103
|
+
// Tips: How to make different node groups use different layouts: https://www.relation-graph.com/docs/api/layout
|
|
104
|
+
|
|
105
|
+
// After setting data, you can call other APIs as needed
|
|
106
|
+
graphInstance.moveToCenter();
|
|
107
|
+
graphInstance.zoomToFit();
|
|
108
|
+
});
|
|
109
|
+
<\/script>
|
|
110
|
+
<template>
|
|
111
|
+
...
|
|
112
|
+
<RelationGraph :options="graphOptions">
|
|
113
|
+
...
|
|
114
|
+
</RelationGraph>
|
|
115
|
+
...
|
|
116
|
+
</template>
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
###### Method 2: ######
|
|
120
|
+
|
|
121
|
+
import { RGProvider } from 'relation-graph-vue3';
|
|
122
|
+
|
|
123
|
+
<RGProvider>
|
|
124
|
+
<YourComponent>
|
|
125
|
+
<RelationGraph>
|
|
126
|
+
...
|
|
127
|
+
</RelationGraph>
|
|
128
|
+
</YourComponent>
|
|
129
|
+
</RGProvider>
|
|
130
|
+
|
|
131
|
+
// YourComponent.vue file:
|
|
132
|
+
|
|
133
|
+
// ensuring the correct context is provided so that you can access the graphInstance:
|
|
134
|
+
|
|
135
|
+
import { RelationGraph, useGraphInstance } from 'relation-graph-vue3';
|
|
136
|
+
const graphInstance = useGraphInstance();
|
|
137
|
+
|
|
138
|
+
// Now you can use graphInstance to manipulate the graph data and call APIs. This will facilitate data manipulation and API calls.
|
|
139
|
+
|
|
140
|
+
<div>
|
|
141
|
+
...
|
|
142
|
+
<RelationGraph>
|
|
143
|
+
...
|
|
144
|
+
</RelationGraph>
|
|
145
|
+
...
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
However, you can still use the current method, but you can only obtain the <RelationGraph> component instance through:
|
|
149
|
+
graphRef.value.getInstance(). in your <YourComponent>;
|
|
150
|
+
And method graphRef.value.getInstance() will be deprecated in future versions.
|
|
151
|
+
|
|
152
|
+
More details: https://www.relation-graph.com/docs/better-integration#vue3
|
|
153
|
+
|
|
154
|
+
Set option "definitelyNoDataProviderNeeded": true to disable the data provider warning if you are sure that no data provider is needed in your case.
|
|
155
|
+
`,Xo=`graphRef.current.getInstance() will be deprecated
|
|
156
|
+
|
|
157
|
+
It is recommended to use the graphInstance:
|
|
158
|
+
###### Method 1: ######
|
|
159
|
+
|
|
160
|
+
import { useRelationGraph, RGOptions } from 'relation-graph-react';
|
|
161
|
+
|
|
162
|
+
const [graphOptions, setGraphOptions] = useRef<RGOptions>({ ... }); // Your RGOptions here
|
|
163
|
+
const {RelationGraph, graphInstance} = useRelationGraph(); // options is reactive
|
|
164
|
+
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
// Set Data Method 1:
|
|
167
|
+
// Now you can use graphInstance to manipulate the graph data and call APIs.
|
|
168
|
+
graphInstance.setJsonData(...); // Set your initial data\uFF0CThe data will be layout automatically(Use graphOptions.value.layout)
|
|
169
|
+
|
|
170
|
+
// Set Data Method 2:
|
|
171
|
+
// Or set json data by addNodes + addLines directly
|
|
172
|
+
graphInstance.addNodes([{ id:'a' }, { id: 'b'}, { id: 'c'}]);
|
|
173
|
+
graphInstance.addLines([{ from: 'a', to: 'b' }, { from: 'b', to: 'c' }]);
|
|
174
|
+
graphInstance.doLayout('a'); // Use graphOptions.value.layout as default layout algorithm, Use 'a' as the root node id.
|
|
175
|
+
// Tips: How to make different node groups use different layouts: https://www.relation-graph.com/docs/api/layout
|
|
176
|
+
|
|
177
|
+
// After setting data, you can call other APIs as needed
|
|
178
|
+
graphInstance.moveToCenter();
|
|
179
|
+
graphInstance.zoomToFit();
|
|
180
|
+
}, []);
|
|
181
|
+
return (
|
|
182
|
+
<div>
|
|
183
|
+
...
|
|
184
|
+
<RelationGraph options={graphOptions}>
|
|
185
|
+
...
|
|
186
|
+
</RelationGraph>
|
|
187
|
+
...
|
|
188
|
+
</div>
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
###### Method 2: ######
|
|
194
|
+
|
|
195
|
+
import { RGProvider } from 'relation-graph-react';
|
|
196
|
+
|
|
197
|
+
<RGProvider>
|
|
198
|
+
<YourComponent>
|
|
199
|
+
<RelationGraph>
|
|
200
|
+
...
|
|
201
|
+
</RelationGraph>
|
|
202
|
+
</YourComponent>
|
|
203
|
+
</RGProvider>
|
|
204
|
+
|
|
205
|
+
// YourComponent.vue file:
|
|
206
|
+
|
|
207
|
+
// ensuring the correct context is provided so that you can access the graphInstance:
|
|
208
|
+
|
|
209
|
+
import { RelationGraph, useGraphInstance } from 'relation-graph-react';
|
|
210
|
+
const graphInstance = useGraphInstance();
|
|
211
|
+
|
|
212
|
+
// Now you can use graphInstance to manipulate the graph data and call APIs. This will facilitate data manipulation and API calls.
|
|
213
|
+
|
|
214
|
+
<div>
|
|
215
|
+
...
|
|
216
|
+
<RelationGraph>
|
|
217
|
+
...
|
|
218
|
+
</RelationGraph>
|
|
219
|
+
...
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
However, you can still use the current method, but you can only obtain the <RelationGraph> component instance through:
|
|
223
|
+
graphRef.current.getInstance(). in your <YourComponent>;
|
|
224
|
+
And method graphRef.value.getInstance() will be deprecated in future versions.
|
|
225
|
+
|
|
226
|
+
More details: https://www.relation-graph.com/docs/better-integration#vue3
|
|
227
|
+
|
|
228
|
+
Set option "definitelyNoDataProviderNeeded": true to disable the data provider warning if you are sure that no data provider is needed in your case.
|
|
229
|
+
`,Go=`Please Initialize the graph using the new method:
|
|
230
|
+
|
|
231
|
+
###### Method 1: ######
|
|
232
|
+
// Use graphInstance to set the data.
|
|
233
|
+
// Set Data Method 1:
|
|
234
|
+
// Now you can use graphInstance to manipulate the graph data and call APIs.
|
|
235
|
+
graphInstance.setJsonData(...); // Set your initial data\uFF0CThe data will be layout automatically(Use graphOptions.value.layout)
|
|
236
|
+
|
|
237
|
+
// Set Data Method 2:
|
|
238
|
+
// Or set json data by addNodes + addLines directly
|
|
239
|
+
graphInstance.addNodes([{ id:'a' }, { id: 'b'}, { id: 'c'}]);
|
|
240
|
+
graphInstance.addLines([{ from: 'a', to: 'b' }, { from: 'b', to: 'c' }]);
|
|
241
|
+
graphInstance.doLayout('a'); // Use graphOptions.value.layout as default layout algorithm, Use 'a' as the root node id.
|
|
242
|
+
// Tips: How to make different node groups use different layouts: https://www.relation-graph.com/docs/api/layout
|
|
243
|
+
|
|
244
|
+
// After setting data, you can call other APIs as needed
|
|
245
|
+
graphInstance.moveToCenter();
|
|
246
|
+
graphInstance.zoomToFit();
|
|
247
|
+
|
|
248
|
+
###### Method 2: ######
|
|
249
|
+
Set the initial data using the "initialData" property of the RelationGraph component.
|
|
250
|
+
|
|
251
|
+
###### Method 3: ######
|
|
252
|
+
Initialize using the onReady event of the RelationGraph component. then use graphInstance to set the data.
|
|
253
|
+
|
|
254
|
+
###### More Method: ######
|
|
255
|
+
https://www.relation-graph.com/docs.'
|
|
256
|
+
`,Fo=`Please Initialize the graph using the new method:
|
|
257
|
+
|
|
258
|
+
###### Method 1: ######
|
|
259
|
+
// Use graphInstance to set the data.
|
|
260
|
+
const graphInstance = this.graphInstance; // this.graphInstance is obtained through inject('graphInstance').
|
|
261
|
+
// Set Data Method 1:
|
|
262
|
+
// Now you can use graphInstance to manipulate the graph data and call APIs.
|
|
263
|
+
graphInstance.setJsonData(...); // Set your initial data\uFF0CThe data will be layout automatically(Use graphOptions.value.layout)
|
|
264
|
+
|
|
265
|
+
// Set Data Method 2:
|
|
266
|
+
// Or set json data by addNodes + addLines directly
|
|
267
|
+
graphInstance.addNodes([{ id:'a' }, { id: 'b'}, { id: 'c'}]);
|
|
268
|
+
graphInstance.addLines([{ from: 'a', to: 'b' }, { from: 'b', to: 'c' }]);
|
|
269
|
+
graphInstance.doLayout('a'); // Use graphOptions.value.layout as default layout algorithm, Use 'a' as the root node id.
|
|
270
|
+
// Tips: How to make different node groups use different layouts: https://www.relation-graph.com/docs/api/layout
|
|
271
|
+
|
|
272
|
+
// After setting data, you can call other APIs as needed
|
|
273
|
+
graphInstance.moveToCenter();
|
|
274
|
+
graphInstance.zoomToFit();
|
|
275
|
+
|
|
276
|
+
###### Method 2: ######
|
|
277
|
+
Set the initial data using the "initialData" property of the RelationGraph component.
|
|
278
|
+
|
|
279
|
+
###### Method 3: ######
|
|
280
|
+
Initialize using the onReady event of the RelationGraph component. then use graphInstance to set the data.
|
|
281
|
+
|
|
282
|
+
###### More Method: ######
|
|
283
|
+
https://www.relation-graph.com/docs.'
|
|
284
|
+
`,qe={Vue3GetInstance:ge(Ao),ReactGetInstance:ge(Xo),Vue2GetInstance:ge(zo),setJsonData:ge(Go),setJsonData4Vue2:ge(Fo)},Be=r.defineComponent({name:"RelationGraph",props:{options:{required:!1,type:Object},initialData:{required:!1,type:Object},relationGraphCore:{required:!1,type:Function}},emits:$e,setup(l,{slots:i,emit:e,expose:t,attrs:n}){const{RelationGraph:o,graphInstance:s}=wt({relationGraphCore:l.relationGraphCore});if(i["graph-plug"])throw new Error('Slot name "#graph-plug" has been renamed to "#view". Please update your code accordingly.');if(i["canvas-plug"])throw new Error('Slot name "#canvas-plug" has been renamed to "#canvas". Please update your code accordingly.');if(i["canvas-plug-above"])throw new Error('Slot name "#canvas-plug-above" has been renamed to "#canvas-above". Please update your code accordingly.');if(i["node-expand-holder"])throw new Error('Slot name "#node-expand-holder" has been renamed to "#node-expand-button". Please update your code accordingly.');return t({getInstance(){var a;return(a=l.options)!=null&&a.definitelyNoDataProviderNeeded||console.warn("[relation-graph]",qe.Vue3GetInstance),s},async setJsonData(){throw new Error(qe.setJsonData)}}),()=>r.h(o,{options:l.options,initialData:l.initialData,emitProxy:e},{...i})}}),$o={class:"rg-canvas-slot rg-canvas-slot-behind",style:{position:"relative","pointer-events":"all","user-select":"text"}},Yo=r.defineComponent({__name:"RelationLinkerCanvas",setup(l){const i=r.ref(),e=X(),t=r.computed(()=>e.dataStores.optionsRef.value),n=r.computed(()=>({"background-color":"transparent","text-wrap":"unset",position:"relative",width:"100%",height:"fit-content"}));return r.onMounted(()=>{C("[RGCanvas mounted]"),e.setCanvasDom(i.value)}),(o,s)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["rg-map",[t.value.canvasOpacity===1&&"rg-map-ready"]])},[r.createElementVNode("div",{style:r.normalizeStyle(n.value),class:"rg-map-canvas rg-canvas-behind"},[r.createElementVNode("div",$o,[r.renderSlot(o.$slots,"canvas-behind")])],4),r.createElementVNode("div",{ref_key:"rgCanvasRef",ref:i,style:r.normalizeStyle([n.value,{position:"absolute",left:"0px",top:"0px","z-index":"9"}]),class:"rg-map-canvas"},[r.createVNode(rt,{"show-easy-view":t.value.showEasyView,"creating-line":!!(t.value.creatingLinePlot&&t.value.newLinkTemplate.fromNode),"default-expand-holder-position":t.value.defaultExpandHolderPosition,draggingNodeId:t.value.draggingNodeId,checkedNodeId:t.value.checkedNodeId,defaultLineTextOnPath:t.value.defaultLineTextOnPath,"checked-line-id":t.value.checkedLineId,"graph-instance-id":t.value.instanceId},{line:r.withCtx(a=>[r.renderSlot(o.$slots,"line",r.normalizeProps(r.guardReactiveProps(a)))]),_:3},8,["show-easy-view","creating-line","default-expand-holder-position","draggingNodeId","checkedNodeId","defaultLineTextOnPath","checked-line-id","graph-instance-id"])],4)],2))}}),Ho=["id"],Wo={class:"rg-graph-plugs"},Uo={class:"rg-view-slot"},Jo=r.defineComponent({__name:"RelationLinkerUI",setup(l){const i=X(),e=r.ref(),t=r.computed(()=>i.dataStores.optionsRef.value),n=r.ref(!1);return r.onMounted(()=>{i.setDom(e.value),n.value=!0}),r.onBeforeUnmount(()=>{i.beforeUnmount()}),(o,s)=>{var a,d,h,c,u,p,m,f,g;return r.openBlock(),r.createElementBlock("div",{ref_key:"relationGraphRef$",ref:e,id:"relation-graph-ins-"+((a=t.value)==null?void 0:a.instanceId),tabindex:"1",class:r.normalizeClass(["relation-graph",t.value&&t.value.creatingLinePlot?"rg-creating-line":""]),style:r.normalizeStyle({width:"100%",height:"fit-content",opacity:n.value?1:0,"--rg-checked-item-bg-color":(d=t.value)==null?void 0:d.checkedItemBackgroundColor,"--rg-background-color":(h=t.value)==null?void 0:h.backgroundColor,"--rg-node-color":(c=t.value)==null?void 0:c.defaultNodeColor,"--rg-node-border-color":(u=t.value)==null?void 0:u.defaultNodeBorderColor,"--rg-node-border-width":((p=t.value)==null?void 0:p.defaultNodeBorderWidth)+"px","--rg-node-border-radius":((m=t.value)==null?void 0:m.defaultNodeBorderRadius)+"px","--rg-line-color":(f=t.value)==null?void 0:f.defaultLineColor,"--rg-line-width":((g=t.value)==null?void 0:g.defaultLineWidth)+"px"})},[t.value&&n.value?(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[r.createVNode(Yo,null,{line:r.withCtx(y=>[r.renderSlot(o.$slots,"line",r.normalizeProps(r.guardReactiveProps(y)))]),"canvas-behind":r.withCtx(()=>[r.renderSlot(o.$slots,"default")]),_:3}),r.createVNode(lt),r.createElementVNode("div",Wo,[r.createElementVNode("div",Uo,[r.renderSlot(o.$slots,"view")])])],64)):r.createCommentVNode("",!0)],14,Ho)}}});function jo(l,{options:i,emitProxy:e}){return r.defineComponent({name:"RelationLinkerUIFrame",props:{lines:{type:Array,required:!0}},setup(t,{slots:n}){const o=e!=null?e:r.defineEmits();l.setEventEmitHook((a,...d)=>{o(a,...d)});const s=async a=>{a&&(l.clearGraph(),l.addFakeLines(a),console.error("applyReactiveData:",a))};return r.watch(()=>t.lines,async a=>{await s(a)},{deep:!0}),r.onMounted(()=>{Ke("Vue-Linker"),l.ready(),console.error("RelationLinkerUIFrame mounted, data:",t),console.error("RelationLinkerUIFrame mounted, lines:",t.lines),t.lines&&s(t.lines)}),r.onBeforeUnmount(()=>{l.beforeUnmount()}),()=>r.h(Jo,{},n)}})}function qo({relationGraphCore:l,options:i,emitProxy:e}={}){const t=Lt(l,!0),n=Fe(t),o=jo(t,{options:i,emitProxy:e}),s=r.defineComponent({name:"RelationLinker",props:{lines:{type:Array,required:!0}},setup(a,{attrs:d,slots:h}){return console.error("RelationLinker",a),r.onMounted(()=>{console.error("RelationLinker mounted",a)}),()=>r.h(n,{},{default:()=>r.h(o,a,h)})}});return{RGProvider:n,RelationLinker:s,VueLinker:s,graphInstance:t}}const Zo=r.defineComponent({__name:"RelationLinker",props:{options:{},lines:{},relationGraphCore:{}},emits:["onReady","onNodeClick","onNodeExpand","onNodeCollapse","onLineClick","onNodeDragStart","onNodeDragEnd","onNodeDragging","onCanvasDragEnd","onCanvasDragging","onContextmenu","onFullscreen","onCanvasClick","onCanvasSelectionEnd","beforeZoomStart","onZoomEnd","onViewResize","onResizeStart","beforeNodeResize","onResizeEnd","onLineVertexDropped","beforeCreateLine","onLineBeCreated","beforeAddNodes","beforeAddLines","onKeyboardDown","onKeyboardUp","onCanvasDragStart","onForceLayoutFinish","beforeScrollStart"],setup(l,{emit:i}){const e=l,t=i,{RelationLinker:n}=qo({options:e.options,relationGraphCore:e.relationGraphCore,emitProxy:t});return console.error("lines:",e.lines),(o,s)=>(r.openBlock(),r.createBlock(r.unref(n),{lines:e.lines},{view:r.withCtx(()=>[r.renderSlot(o.$slots,"view")]),line:r.withCtx(a=>[r.renderSlot(o.$slots,"line",r.normalizeProps(r.guardReactiveProps(a)))]),default:r.withCtx(()=>[r.renderSlot(o.$slots,"default")]),_:3},8,["lines"]))}}),Ko=r.defineComponent({__name:"RGProvider",props:{relationGraphCore:{},forLinker:{type:Boolean}},setup(l){const i=l,e=Ct(i.relationGraphCore,i.forLinker),t=Fe(e);return(n,o)=>(r.openBlock(),r.createBlock(r.unref(t),null,{default:r.withCtx(()=>[r.renderSlot(n.$slots,"default")]),_:3}))}}),Qo=["data-id"],ei={class:"rg-node-text"},ti=r.defineComponent({__name:"RGFakeNode",props:{node:{}},setup(l){const i=l,e=r.ref(),t=X(),n=r.computed(()=>t.dataStores.optionsRef.value),o=r.computed(()=>i.node.borderColor),s=r.computed(()=>n.value.draggingNodeId===i.node.id),a=r.computed(()=>i.node.borderWidth===void 0?void 0:i.node.borderWidth+"px"),d=r.computed(()=>i.node.width?i.node.width+"px":void 0),h=r.computed(()=>i.node.height?i.node.height+"px":void 0),c=u=>{t.onNodeDragStart(i.node,u)};return r.onMounted(()=>{t.addNodeResizeListener(e.value,i.node)}),r.onBeforeUnmount(()=>{t.removeNodeResizeListener(e.value)}),(u,p)=>(r.openBlock(),r.createElementBlock("div",{ref_key:"nodePeelRef",ref:e,style:r.normalizeStyle({left:u.node.x+"px",top:u.node.y+"px","--rg-node-z-index":u.node.zIndex?u.node.zIndex:void 0,"--rg-node-opacity":u.node.opacity>1?u.node.opacity/100:u.node.opacity,"pointer-events":u.node.opacity===0?"none":void 0,"--rg-node-color":u.node.color||n.value.defaultNodeColor,"--rg-node-font-color":u.node.fontColor,"--rg-node-font-size":u.node.fontSize?u.node.fontSize+"px":void 0,"--rg-node-border-width":a.value,"--rg-node-width":d.value,"--rg-node-height":h.value,"--rg-node-border-radius":u.node.borderRadius&&u.node.borderRadius+"px","--rg-node-border-color":o.value}),class:r.normalizeClass(["rg-node-peel",[u.node.selected&&"rg-node-selected",s.value&&"rg-node-dragging",u.node.id===n.value.checkedNodeId&&"rg-node-checked","rg-node-shape-"+(u.node.nodeShape===void 0?1:u.node.nodeShape),"rg-node-type-"+u.node.type,u.node.className]]),"data-id":u.node.id},[r.createElementVNode("div",{class:"rg-node",onMousedown:p[0]||(p[0]=r.withModifiers(m=>c(m),["left","stop"])),onTouchstart:p[1]||(p[1]=r.withModifiers(m=>c(m),["stop"]))},[r.renderSlot(u.$slots,"default",{},()=>[r.createElementVNode("div",ei,[r.createElementVNode("span",null,r.toDisplayString(u.node.text),1)])])],32)],14,Qo))}}),ni={class:"c-debug-tools-row"},oi=r.defineComponent({__name:"RGDebugView",setup(l){const i=X(),e=r.computed(()=>i.dataStores.optionsRef.value),t=r.ref(!1),n=()=>{t.value=!t.value},o=()=>{i.printOptions()},s=()=>{i.printData()},a=()=>{i.enableDebugLog(!i.options.debug),C("debugLog:",i.options.debug)};return(d,h)=>(r.openBlock(),r.createElementBlock("div",null,[r.createElementVNode("div",{class:r.normalizeClass([[],"rg-setting-panel-button"]),onClick:n}," Debug "),t.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([[],"rg-setting-panel"])},[r.createElementVNode("div",{class:"c-debug-tools-row"},[r.createElementVNode("button",{onClick:o},"print options in console")]),r.createElementVNode("div",{class:"c-debug-tools-row"},[r.createElementVNode("button",{onClick:s},"print json data in console")]),r.createElementVNode("div",ni,[r.createTextVNode("debug log status: "+r.toDisplayString(e.value.debug)+" ",1),r.createElementVNode("button",{onClick:a},r.toDisplayString(e.value.debug?"disable":"enable")+" debug log",1)]),r.renderSlot(d.$slots,"default")])):r.createCommentVNode("",!0)]))}}),ii=["title"],si=r.defineComponent({__name:"GraphToolBar",props:{direction:{},positionH:{},positionV:{}},setup(l){const i=X(),e=r.computed(()=>i.dataStores.optionsRef.value);r.onMounted(()=>{});const t=()=>{i.refresh()},n=()=>{i.toggleAutoLayout()},o=async()=>{i.setZoom(100),i.moveToCenter(),i.enableCanvasAnimation(),i.zoomToFit(),setTimeout(()=>{i.disableCanvasAnimation()},300)},s=d=>{i.zoom(d)},a=()=>{i.fullscreen()};return(d,h)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["rg-toolbar",["rg-toolbar-h-"+(d.positionH||e.value.toolBarPositionH),"rg-toolbar-v-"+(d.positionV||e.value.toolBarPositionV),"rg-toolbar-"+(d.direction||e.value.toolBarDirection)]])},[r.createElementVNode("div",{class:"rg-mb-button",style:{"margin-top":"0px"},onClick:h[0]||(h[0]=c=>a())},[r.createVNode(q,{"icon-name":"icon-quanping"})]),r.createElementVNode("div",{class:"rg-mb-button",onClick:h[1]||(h[1]=c=>s(20))},[r.createVNode(q,{"icon-name":"icon-fangda"})]),r.createElementVNode("div",{class:"rg-current-zoom",onClick:o},r.toDisplayString(Math.round(e.value.canvasZoom))+"%",1),r.createElementVNode("div",{class:"rg-mb-button",style:{"margin-top":"0px"},onClick:h[2]||(h[2]=c=>s(-20))},[r.createVNode(q,{"icon-name":"icon-suoxiao"})]),e.value.layout.supportAutoLayout?(r.openBlock(),r.createElementBlock("div",{key:0,title:e.value.layout.autoLayouting?"\u70B9\u51FB\u505C\u6B62\u81EA\u52A8\u5E03\u5C40":"\u70B9\u51FB\u5F00\u59CB\u81EA\u52A8\u8C03\u6574\u5E03\u5C40",class:r.normalizeClass([{"rg-mb-button-on":e.value.layout.autoLayouting},"rg-mb-button"]),onClick:n},[e.value.layout.autoLayouting?(r.openBlock(),r.createBlock(q,{key:1,"icon-name":"icon-lianjiezhong","class-name":"rg-loading-icon"})):(r.openBlock(),r.createBlock(q,{key:0,"icon-name":"icon-zidong"}))],10,ii)):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"rg-mb-button",onClick:t},[r.createVNode(q,{"icon-name":"icon-ico_reset"})]),r.renderSlot(d.$slots,"default"),h[3]||(h[3]=r.createElementVNode("div",{style:{clear:"both"}},null,-1))],2))}}),ai=r.defineComponent({__name:"GraphBackground",props:{forImage:{type:Boolean,default:!0},forDisplay:{type:Boolean,default:!0}},setup(l){const i=X(),e=l;r.computed(()=>i.dataStores.optionsRef.value);const t=r.ref();return r.onMounted(()=>{i.setBackgroundDom(t.value,e.forImage,e.forDisplay)}),r.onUnmounted(()=>{i.setBackgroundDom(null,e.forImage,e.forDisplay)}),(n,o)=>r.withDirectives((r.openBlock(),r.createElementBlock("div",{class:"rg-background",ref_key:"$backgroundRef",ref:t},[r.renderSlot(n.$slots,"default")],512)),[[r.vShow,n.forDisplay!==!1]])}}),ri=r.defineComponent({__name:"GraphWatermark",props:{forImage:{type:Boolean,default:!0},forDisplay:{type:Boolean,default:!1},position:{default:"br"},width:{},height:{}},setup(l){const i=X(),e=l,t=r.computed(()=>i.dataStores.optionsRef.value),n=r.computed(()=>{let s=!1;return t.value.snapshotting?e.forImage===!1?s=!1:s=!0:e.forDisplay===!0?s=!0:s=!1,s}),o=r.ref();return r.onMounted(()=>{i.setWatermarkDom(o.value,e.forImage,e.forDisplay,e.position)}),r.onUnmounted(()=>{i.setWatermarkDom(null,e.forImage,e.forDisplay)}),(s,a)=>r.withDirectives((r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["rg-watermark",["rg-watermark-"+(s.position||"br")]]),ref_key:"$watermarkRef",ref:o,style:r.normalizeStyle({"--watermark-width":s.width,"--watermark-height":s.height})},[r.renderSlot(s.$slots,"default")],6)),[[r.vShow,n.value]])}}),li=r.defineComponent({__name:"RGEditingNodeController",setup(l){const i=X(),e=r.computed(()=>i.dataStores.optionsRef.value);return(t,n)=>e.value.editingController.show?(r.openBlock(),r.createElementBlock("div",{key:0,class:"rg-editing-ctrl",style:r.normalizeStyle({width:e.value.editingController.width+"px",height:e.value.editingController.height+"px",transform:`translate(${e.value.editingController.x}px, ${e.value.editingController.y}px)`})},[r.renderSlot(t.$slots,"default")],4)):r.createCommentVNode("",!0)}}),di={class:"rg-resize-ctl"},ci=r.defineComponent({__name:"RGEditingResize",props:{disableResizeWidth:{type:Boolean},disableResizeHeight:{type:Boolean}},emits:["beforeResizeStart"],setup(l,{emit:i}){const e=X(),t=i,n=r.computed(()=>e.dataStores.optionsRef.value),o=(s,a)=>{a.stopPropagation(),t("beforeResizeStart"),e.onResizeStart(s,a)};return(s,a)=>(r.openBlock(),r.createElementBlock("div",di,[n.value.editingController.width>30&&!s.disableResizeWidth&&!s.disableResizeHeight?(r.openBlock(),r.createElementBlock("div",{key:0,class:"rg-resize-ctl-handler rg-resize-ctl-tl",onMousedown:a[0]||(a[0]=d=>o("tl",d))},null,32)):r.createCommentVNode("",!0),n.value.editingController.width>30&&!s.disableResizeWidth&&!s.disableResizeHeight?(r.openBlock(),r.createElementBlock("div",{key:1,class:"rg-resize-ctl-handler rg-resize-ctl-tr",onMousedown:a[1]||(a[1]=d=>o("tr",d))},null,32)):r.createCommentVNode("",!0),n.value.editingController.width>30&&!s.disableResizeWidth&&!s.disableResizeHeight?(r.openBlock(),r.createElementBlock("div",{key:2,class:"rg-resize-ctl-handler rg-resize-ctl-bl",onMousedown:a[2]||(a[2]=d=>o("bl",d))},null,32)):r.createCommentVNode("",!0),!s.disableResizeWidth&&!s.disableResizeHeight?(r.openBlock(),r.createElementBlock("div",{key:3,class:"rg-resize-ctl-handler rg-resize-ctl-br",onMousedown:a[3]||(a[3]=d=>o("br",d))},null,32)):r.createCommentVNode("",!0),(n.value.editingController.width>60||s.disableResizeWidth)&&!s.disableResizeHeight?(r.openBlock(),r.createElementBlock("div",{key:4,class:"rg-resize-ctl-handler rg-resize-ctl-t",onMousedown:a[4]||(a[4]=d=>o("t",d))},null,32)):r.createCommentVNode("",!0),(n.value.editingController.width>60||s.disableResizeWidth)&&!s.disableResizeHeight?(r.openBlock(),r.createElementBlock("div",{key:5,class:"rg-resize-ctl-handler rg-resize-ctl-b",onMousedown:a[5]||(a[5]=d=>o("b",d))},null,32)):r.createCommentVNode("",!0),(n.value.editingController.height>60||s.disableResizeHeight)&&!s.disableResizeWidth?(r.openBlock(),r.createElementBlock("div",{key:6,class:"rg-resize-ctl-handler rg-resize-ctl-l",onMousedown:a[6]||(a[6]=d=>o("l",d))},null,32)):r.createCommentVNode("",!0),(n.value.editingController.height>60||s.disableResizeHeight)&&!s.disableResizeWidth?(r.openBlock(),r.createElementBlock("div",{key:7,class:"rg-resize-ctl-handler rg-resize-ctl-r",onMousedown:a[7]||(a[7]=d=>o("r",d))},null,32)):r.createCommentVNode("",!0)]))}}),hi={class:"rg-miniview-container"},ui=r.defineComponent({__name:"RGMiniView",props:{position:{},width:{},height:{},className:{}},setup(l){const i=X(),e=r.computed(()=>i.dataStores.optionsRef.value),t=r.ref(),n=r.ref();r.onMounted(()=>{i.onMiniViewMounted(),i.setMiniViewCanvas(n.value)}),r.onUnmounted(()=>{i.onMiniViewUnMounted()});const o=a=>{i.onVisibleViewHandleDragStart(a)},s=a=>{i.resetByVisiableView(a)};return(a,d)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["rg-miniview",["rg-miniview-"+(a.position||"br"),a.$attrs.className]]),ref_key:"$rgMiniView",ref:t,style:r.normalizeStyle({...a.$attrs.style,"--miniview-width":a.width,"--miniview-height":a.height})},[r.createElementVNode("div",hi,[r.createElementVNode("canvas",{ref_key:"$rgMiniViewCanvas",ref:n,class:r.normalizeClass({"rg-mv-canvas-reset":e.value.miniViewVisibleHandle.emptyContent}),onClick:s},null,2),r.createElementVNode("div",{class:"rg-mv-visible-area",onMousedown:o,style:r.normalizeStyle({transform:`translate(${e.value.miniViewVisibleHandle.x}px, ${e.value.miniViewVisibleHandle.y}px)`,width:e.value.miniViewVisibleHandle.width+"px",height:e.value.miniViewVisibleHandle.height+"px"})},null,36)])],6))}}),pi=r.defineComponent({__name:"RGEditingNearNodeWidget",props:{position:{}},setup(l){return(i,e)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["rg-editing-bar",["rg-editing-bar-"+(i.position||"top")]])},[r.renderSlot(i.$slots,"default")],2))}}),fi={key:0,class:"rg-editing-line-ctrl"},gi={key:0,class:"rg-edt-ctrl-svg",xmlns:"http://www.w3.org/2000/svg"},mi=["d"],yi=["d"],vi=["onMousedown","onTouchstart"],xi={key:0},Ci={key:1,class:"empty-text"},Li=["value"],wi=r.defineComponent({__name:"RGEditingLineController",props:{textEditable:{type:Boolean,default:!0},pathEditable:{type:Boolean,default:!0}},emits:["onMoveLineVertexStart","onMoveLineVertexEnd","onLinePathChanged","onLineTextDragEnd","onLineTextChanged"],setup(l,{emit:i}){const e=X(),t=r.computed(()=>e.dataStores.optionsRef.value),n=r.computed(()=>t.value.editingLineController),o=r.computed(()=>n.value.line),s=r.computed(()=>{var b;return(b=n.value.line)==null?void 0:b.lineShape}),a=r.computed(()=>n.value.ctrlPoint1),d=r.computed(()=>n.value.ctrlPoint2),h=r.computed(()=>`M ${n.value.startPoint.x} ${n.value.startPoint.y} L ${a.value.x} ${a.value.y}`),c=r.computed(()=>`M ${n.value.endPoint.x} ${n.value.endPoint.y} L ${d.value.x} ${d.value.y}`),u=r.computed(()=>n.value.line44Splits),p=r.computed(()=>o.value&&o.value.text),m=r.ref(""),f=r.ref(!1);let g=r.ref(0);const y=i;r.watch(p,b=>{b!==m.value&&(m.value=b,r.nextTick(()=>{e.updateEditingLineView()}))}),r.watch(s,b=>{r.nextTick(()=>{e.updateEditingLineView()})});const v=(b,k)=>{e.startMoveLine6CtrlPoint(b,k,P=>{y("onLinePathChanged",P,b)})},x=(b,k)=>{e.startMoveLine44CtrlPoint(b,k,P=>{y("onLinePathChanged",P,b)})},L=(b,k)=>{const P=t.value.editingLineController.line;y("onMoveLineVertexStart",b,P),e.startMoveLineVertex(b,k,(S,R,M)=>{y("onMoveLineVertexEnd",S,R,M),e.defaultLineVertexBeChangedHandler(S,R,M)})},N=b=>{e.startMoveLineText(b,()=>{const k=t.value.editingLineController.line;y("onLineTextDragEnd",k)})},T=b=>{g.value&&Date.now()-g.value<500&&(f.value=!0,r.nextTick(()=>{b.target.focus()})),g.value=Date.now()},O=b=>{const k=o.value;k&&k.text!==b.target.value&&(e.updateLine(k.id,{text:b.target.value}),y("onLineTextChanged",k)),f.value=!1};return(b,k)=>n.value.show?(r.openBlock(),r.createElementBlock("div",fi,[r.renderSlot(b.$slots,"default"),b.pathEditable?(r.openBlock(),r.createElementBlock("svg",gi,[r.createElementVNode("g",null,[o.value.lineShape===6&&a.value?(r.openBlock(),r.createElementBlock("path",{key:0,d:h.value},null,8,mi)):r.createCommentVNode("",!0),o.value.lineShape===6&&d.value?(r.openBlock(),r.createElementBlock("path",{key:1,d:c.value},null,8,yi)):r.createCommentVNode("",!0)])])):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"rg-line-ctrl-dot start-dot",style:r.normalizeStyle({"--rg-ctl-x":n.value.startPoint.x+"px","--rg-ctl-y":n.value.startPoint.y+"px"}),onMousedown:k[0]||(k[0]=r.withModifiers(P=>L("start",P),["left"])),onTouchstart:k[1]||(k[1]=P=>L("start",P))},null,36),r.createElementVNode("div",{class:"rg-line-ctrl-dot end-dot",style:r.normalizeStyle({"--rg-ctl-x":n.value.endPoint.x+"px","--rg-ctl-y":n.value.endPoint.y+"px"}),onMousedown:k[2]||(k[2]=r.withModifiers(P=>L("end",P),["left"])),onTouchstart:k[3]||(k[3]=P=>L("end",P))},null,36),b.pathEditable&&o.value.lineShape===6&&a.value?(r.openBlock(),r.createElementBlock("div",{key:1,class:"rg-line-ctrl-dot ctrl-dot",style:r.normalizeStyle({"--rg-ctl-x":a.value.x+"px","--rg-ctl-y":a.value.y+"px"}),onMousedown:k[4]||(k[4]=r.withModifiers(P=>v(0,P),["left"])),onTouchstart:k[5]||(k[5]=P=>v(0,P))},null,36)):r.createCommentVNode("",!0),b.pathEditable&&o.value.lineShape===6&&d.value?(r.openBlock(),r.createElementBlock("div",{key:2,class:"rg-line-ctrl-dot ctrl-dot",style:r.normalizeStyle({"--rg-ctl-x":d.value.x+"px","--rg-ctl-y":d.value.y+"px"}),onMousedown:k[6]||(k[6]=r.withModifiers(P=>v(1,P),["left"])),onTouchstart:k[7]||(k[7]=P=>v(1,P))},null,36)):r.createCommentVNode("",!0),b.pathEditable&&(o.value.lineShape===44||o.value.lineShape===49)?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:3},r.renderList(u.value,P=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[P.hide?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",{key:P.optionName,class:r.normalizeClass(["rg-line-ctrl-dot ctrl-split",{"ctrl-split-core":!P.optionName.startsWith("cp-"),"ctrl-split-v":P.direction==="v","ctrl-split-h":P.direction==="h"}]),style:r.normalizeStyle({"--rg-ctl-x":P.x+"px","--rg-ctl-y":P.y+"px"}),onMousedown:r.withModifiers(S=>x(P,S),["left"]),onTouchstart:S=>x(P,S)},null,46,vi))],64))),256)):r.createCommentVNode("",!0),b.textEditable&&o.value?(r.openBlock(),r.createElementBlock("div",{key:4,class:r.normalizeClass(["rg-line-ctrl-text",f.value&&"rg-line-ctrl-text-editing"]),style:r.normalizeStyle({"--rg-ctl-x":n.value.text.x+"px","--rg-ctl-y":n.value.text.y+"px"}),onClick:T,onMousedown:k[8]||(k[8]=P=>N(P)),onTouchstart:k[9]||(k[9]=P=>N(P))},[f.value?(r.openBlock(),r.createElementBlock("input",{key:1,ref:"inputRef",class:"rg-line-text-input",value:m.value,onBlur:O},null,40,Li)):(r.openBlock(),r.createElementBlock(r.Fragment,{key:0},[m.value?(r.openBlock(),r.createElementBlock("p",xi,r.toDisplayString(m.value),1)):(r.openBlock(),r.createElementBlock("p",Ci,"Add Text..."))],64))],38)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0)}}),_t=r.defineComponent({__name:"RGEditingConnectPoints",props:{mouseUpOnJunctionPoint:{type:Function},mouseUpOnJunctionPointWithOffset:{type:Function}},setup(l){return(i,e)=>(r.openBlock(),r.createElementBlock("div",{class:"rg-connect-ctl",onMouseup:e[15]||(e[15]=t=>i.mouseUpOnJunctionPointWithOffset("",t)),onTouchend:e[16]||(e[16]=t=>i.mouseUpOnJunctionPointWithOffset("",t))},[r.createElementVNode("div",{class:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-t","data-point":"top",onMouseup:e[0]||(e[0]=t=>i.mouseUpOnJunctionPoint("top",t))},null,32),r.createElementVNode("div",{class:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-b","data-point":"bottom",onMouseup:e[1]||(e[1]=t=>i.mouseUpOnJunctionPoint("bottom",t))},null,32),r.createElementVNode("div",{class:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-center","data-point":"border",onMouseup:e[2]||(e[2]=t=>i.mouseUpOnJunctionPoint("border",t))},null,32),r.createElementVNode("div",{class:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-l","data-point":"left",onMouseup:e[3]||(e[3]=t=>i.mouseUpOnJunctionPoint("left",t))},null,32),r.createElementVNode("div",{class:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-r","data-point":"right",onMouseup:e[4]||(e[4]=t=>i.mouseUpOnJunctionPoint("right",t))},null,32),r.createElementVNode("div",{class:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-lr","data-point":"lr",onMouseup:e[5]||(e[5]=t=>i.mouseUpOnJunctionPoint("lr",t))},null,32),r.createElementVNode("div",{class:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-tb","data-point":"tb",onMouseup:e[6]||(e[6]=t=>i.mouseUpOnJunctionPoint("tb",t))},null,32),r.createElementVNode("div",{class:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-bottom-bar","data-point":"bottom","data-innode":"true",onMouseup:e[7]||(e[7]=t=>i.mouseUpOnJunctionPointWithOffset("bottom",t)),onTouchend:e[8]||(e[8]=t=>i.onMouseUpWithOffset("bottom",t))},null,32),r.createElementVNode("div",{class:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-top-bar","data-point":"top","data-innode":"true",onMouseup:e[9]||(e[9]=t=>i.mouseUpOnJunctionPointWithOffset("top",t)),onTouchend:e[10]||(e[10]=t=>i.onMouseUpWithOffset("top",t))},null,32),r.createElementVNode("div",{class:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-left-bar","data-point":"left","data-innode":"true",onMouseup:e[11]||(e[11]=t=>i.mouseUpOnJunctionPointWithOffset("left",t)),onTouchend:e[12]||(e[12]=t=>i.onMouseUpWithOffset("left",t))},null,32),r.createElementVNode("div",{class:"rg-connect-ctl-handler rg-connect-ctl-handler-style rg-connect-ctl-right-bar","data-point":"right","data-innode":"true",onMouseup:e[13]||(e[13]=t=>i.mouseUpOnJunctionPointWithOffset("right",t)),onTouchend:e[14]||(e[14]=t=>i.onMouseUpWithOffset("right",t))},null,32)],32))}}),_i=r.defineComponent({__name:"RGEditingConnectController",setup(l){const i=X(),e=r.computed(()=>i.dataStores.optionsRef.value),t=r.ref(),n=(s,a)=>{i.onLineVertexBeDroppedOnConnectController(s,a,void 0,(d,h,c)=>{C("onLineVertexBeDropped:callback:",c)})},o=(s,a)=>{i.onLineVertexBeDroppedOnConnectController(s,a,t.value,(d,h,c)=>{C("onLineVertexBeDropped:callback:",c)})};return(s,a)=>e.value.nodeConnectController.show?(r.openBlock(),r.createElementBlock("div",{key:0,class:"rg-editing-connect-ctrl",ref_key:"connectBoxRef",ref:t,style:r.normalizeStyle({transform:`translate(${e.value.nodeConnectController.x}px, ${e.value.nodeConnectController.y}px)`,width:e.value.nodeConnectController.width+"px",height:e.value.nodeConnectController.height+"px"})},[r.renderSlot(s.$slots,"default",{mouseUpOnJunctionPoint:n,mouseUpOnJunctionPointWithOffset:o},()=>[r.createVNode(_t,{mouseUpOnJunctionPoint:n,mouseUpOnJunctionPointWithOffset:o})])],4)):r.createCommentVNode("",!0)}}),Ni=r.defineComponent({__name:"RGConnectSource",props:{lineTemplate:{}},emits:["onConnectStart","onLineConnectEnd"],setup(l,{emit:i}){const e=X(),t=l,n=i,o=a=>{a.stopPropagation()},s=a=>{a.stopPropagation(),n("onConnectStart",t.lineTemplate,a),e.startCreateLineFromNode(null,t.lineTemplate||{},a,(d,h,c)=>{n("onLineConnectEnd",d,h,c),e.defaultLineConnectEndHandler(d,h,c)})};return(a,d)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["rg-connect-source-handle",["rg-connect-ctl-handler","rg-connect-target",a.$attrs.className]]),style:r.normalizeStyle(a.$attrs.style),onMousedown:d[0]||(d[0]=h=>s(h)),onClick:o},[r.renderSlot(a.$slots,"default")],38))}}),bi=["data-point","data-target-id","data-target-type","data-target-data"],ki=["data-point","data-target-id","data-target-type","data-target-data"],Oi=r.defineComponent({__name:"RGConnectTarget",props:{junctionPoint:{},targetId:{},targetType:{},targetData:{},lineTemplate:{},disableDrop:{type:Boolean},disableDrag:{type:Boolean},forSvg:{type:Boolean}},emits:["onLineVertexBeDropped","onDragConnectStart","onDragConnectEnd"],setup(l,{emit:i}){const e=X(),t=l,n=i,o=r.ref();r.onMounted(()=>{e.registerConnectTarget(o.value,t.targetId,t.targetType||D.NodePoint,t.junctionPoint,t.targetData)}),r.onUnmounted(()=>{e.unregisterConnectTarget(t.targetId)});const s=h=>{h.stopPropagation()},a=(h,c)=>{c.stopPropagation(),!t.disableDrop&&e.onLineVertexBeDropped(h,c,void 0,(u,p,m)=>{n("onLineVertexBeDropped",u,p,m)})},d=h=>{if(h.stopPropagation(),t.disableDrag||e.options.creatingLinePlot)return;const c=Object.assign({},t.lineTemplate||{});c.from||(c.from=t.targetId),c.fromType||(c.fromType=t.targetType||D.NodePoint),c.fromJunctionPoint||(c.fromJunctionPoint=t.junctionPoint),n("onDragConnectStart",c,h),e.startCreateLineFromNode(null,c,h,(u,p,m)=>{n("onDragConnectEnd",u,p,m)})};return(h,c)=>h.forSvg?(r.openBlock(),r.createElementBlock("g",{key:0,ref_key:"targetRef",ref:o,class:r.normalizeClass(["rg-connect-ctl-handler","rg-connect-target",h.$attrs.className]),style:r.normalizeStyle(h.$attrs.style),"data-point":h.junctionPoint||r.unref(H).border,"data-target-id":h.targetId,"data-target-type":h.targetType||r.unref(D).NodePoint,"data-target-data":JSON.stringify(h.targetData||{}),onMousedown:d,onMouseup:c[0]||(c[0]=u=>a(h.junctionPoint,u)),onClick:s},[r.renderSlot(h.$slots,"default")],46,bi)):(r.openBlock(),r.createElementBlock("div",{key:1,ref_key:"targetRef",ref:o,class:r.normalizeClass(["rg-connect-ctl-handler","rg-connect-target",h.$attrs.className]),style:r.normalizeStyle(h.$attrs.style),"data-point":h.junctionPoint||r.unref(H).border,"data-target-id":h.targetId,"data-target-type":h.targetType||r.unref(D).NodePoint,"data-target-data":JSON.stringify(h.targetData||{}),onMousedown:d,onMouseup:c[1]||(c[1]=u=>a(h.junctionPoint,u)),onClick:s},[r.renderSlot(h.$slots,"default")],46,ki))}}),Pi={class:"rg-editing-referline"},Ti={class:"referline"},Ri={key:0},Si={class:"referline"},Mi={key:0},Ii=r.defineComponent({__name:"RGEditingReferenceLine",props:{showText:{type:Boolean},adsorption:{type:Boolean}},setup(l){const i=X(),e=l,t=r.computed(()=>i.dataStores.optionsRef.value);return r.onMounted(()=>{i.onReferenceLineMounted(e.adsorption)}),r.onUnmounted(()=>{i.onReferenceLineUnMounted()}),(n,o)=>r.withDirectives((r.openBlock(),r.createElementBlock("div",Pi,[r.withDirectives(r.createElementVNode("div",{class:"rg-referline rg-referline-v",style:r.normalizeStyle({transform:`translate(var(--rg-refer-offset), 0px) translate(${t.value.editingReferenceLine.v_x}px, ${t.value.editingReferenceLine.v_y}px)`,height:t.value.editingReferenceLine.v_height+"px"})},[r.createElementVNode("div",Ti,[n.showText!==!1?(r.openBlock(),r.createElementBlock("div",Ri,r.toDisplayString(Math.round(t.value.editingReferenceLine.v_height))+"px",1)):r.createCommentVNode("",!0)])],4),[[r.vShow,t.value.editingReferenceLine.directionV]]),r.withDirectives(r.createElementVNode("div",{class:"rg-referline rg-referline-h",style:r.normalizeStyle({transform:`translate(0px, var(--rg-refer-offset)) translate(${t.value.editingReferenceLine.h_x}px, ${t.value.editingReferenceLine.h_y}px)`,width:t.value.editingReferenceLine.h_width+"px"})},[r.createElementVNode("div",Si,[n.showText!==!1?(r.openBlock(),r.createElementBlock("div",Mi,r.toDisplayString(Math.round(t.value.editingReferenceLine.h_width))+"px",1)):r.createCommentVNode("",!0)])],4),[[r.vShow,t.value.editingReferenceLine.directionH]])],512)),[[r.vShow,t.value.editingReferenceLine.show]])}});function Ei(){const l=X();if(!l)throw new Error("RGHooks.useGraphStore must be used inside RGProvider or RelationGraph tag.");return{optionsRef:l.dataStores.optionsRef}}function he(){const l=X();if(!l)throw new Error("RGHooks.useGraphStore must be used inside RGProvider or RelationGraph tag.");return l.dataStores.optionsRef}function Di(){const l=X();if(!l)throw new Error("RGHooks.useGraphStore must be used inside RGProvider or RelationGraph tag.");const i=l.dataStores.optionsRef;return r.computed(()=>l.getCreatingLine(i.value))}function Vi(){const l=X();if(!l)throw new Error("RGHooks.useGraphStore must be used inside RGProvider or RelationGraph tag.");const i=l.dataStores.optionsRef;return r.computed(()=>l.getCreatingNode(i.value))}function Bi(){const l=he();return r.computed(()=>l.value.editingController)}function zi(){const l=he();return r.computed(()=>l.value.editingLineController)}function Ai(){const l=he();return r.computed(()=>l.value.nodeConnectController)}function Xi(){const l=he();return r.computed(()=>({viewSize:l.value.viewSize,canvasSize:l.value.canvasSize,canvasOffset:l.value.canvasOffset,canvasZoom:l.value.canvasZoom,fullscreen:l.value.fullscreen,showEasyView:l.value.showEasyView}))}function Gi(){const l=he();return r.computed(()=>({...l.value.selectionView,show:l.value.creatingSelection}))}function Fi(){const l=he();return r.computed(()=>({checkedLineId:l.value.checkedLineId,checkedNodeId:l.value.checkedNodeId,draggingNodeId:l.value.draggingNodeId}))}function $i(){const l=X();if(!l)throw new Error("RGHooks.useGraphStore must be used inside RGProvider or RelationGraph tag.");return{optionsRef:l.dataStores.optionsRef,shouldRenderNodesRef:l.dataStores.shouldRenderNodesRef,shouldRenderLinesRef:l.dataStores.shouldRenderLinesRef,shouldRenderFakeLinesRef:l.dataStores.shouldRenderFakeLinesRef}}const Nt={useGraphInstance:X,useRelationGraph:wt,useGraphStore:Ei,useGraphData:$i,useGraphOptions:he,useCreatingLine:Di,useCreatingNode:Vi,useEditingNodes:Bi,useEditingLine:zi,useViewInformation:Xi,useSelection:Gi,useConnectingNode:Ai,useCheckedItem:Fi},Yi=Ze,Hi={BaseLayout:ce,BidirectionalTreeLayout:ct,CenterLayout:ht,CircleLayout:ut,FixedLayout:pt,ForceLayout:be,RGFolderLayout:ft},Wi={RGOptionsDataUtils:io,RGLineDataUtils:Sn,RGNodeDataUtils:Pn,RGGraphMath:J,RGNodesAnalyticUtils:we,RGEffectUtils:le},Ui=ti,Ji=it,ji=ot,qi=oi,Zi=si,Ki=Qe,Qi=dt,es=ui,ts=ai,ns=ri,os=li,is=ci,ss=pi,as=wi,rs=_i,ls=Ni,ds=Oi,cs=_t,hs=Ii,us=Nt,ps=Nt.useRelationGraph,fs=Ko,gs=Zo;Be.install=l=>{l.component("RelationGraph",Be)};const bt=Be;exports.INSTALLED_KEY=Pt;exports.RGBackground=ts;exports.RGConnectSource=ls;exports.RGConnectTarget=ds;exports.RGDebugView=qi;exports.RGDirection=nt;exports.RGEditingConnectController=rs;exports.RGEditingConnectPoints=cs;exports.RGEditingLineController=as;exports.RGEditingNearNodeWidget=ss;exports.RGEditingNodeController=os;exports.RGEditingReferenceLine=hs;exports.RGEditingResize=is;exports.RGEventNames=E;exports.RGEventsDefine4Vue3=$e;exports.RGFakeNode=Ui;exports.RGHooks=us;exports.RGInnerConnectTargetType=D;exports.RGJunctionPoint=H;exports.RGLayouts=Hi;exports.RGLinePath=Ji;exports.RGLineShape=$;exports.RGLineText=ji;exports.RGMiniToolBar=Qi;exports.RGMiniView=es;exports.RGNodeExpandHolder=Ki;exports.RGNodeShape=_e;exports.RGProvider=fs;exports.RGToolBar=Zi;exports.RGUtils=Wi;exports.RGWatermark=ns;exports.RelationGraph=bt;exports.RelationGraphCore=xt;exports.RelationGraphProvideKey=ve;exports.RelationLinker=gs;exports.default=bt;exports.useRelationGraph=ps;exports.version=Yi;
|