{"version":3,"sources":["jsdelivr-header.js","/npm/@antv/xflow@2.2.4/src/index.ts","/npm/@antv/xflow@2.2.4/src/components/Wrapper.tsx","/npm/@antv/xflow@2.2.4/src/hooks/useGraphInstance.ts","/npm/@antv/xflow@2.2.4/src/context/GraphContext.tsx","/npm/@antv/xflow@2.2.4/src/components/XFlow.tsx","/npm/@antv/xflow@2.2.4/src/context/StoreContext.tsx","/npm/@antv/xflow@2.2.4/src/store/index.ts","/npm/@antv/xflow@2.2.4/src/util/algorithm.ts","/npm/@antv/xflow@2.2.4/src/util/object.ts","/npm/@antv/xflow@2.2.4/src/components/Graph.tsx","/npm/@antv/xflow@2.2.4/src/components/State.tsx","/npm/@antv/xflow@2.2.4/src/hooks/useGraphStore.ts","/npm/@antv/xflow@2.2.4/src/hooks/useGraphEvent.ts","/npm/@antv/xflow@2.2.4/src/hooks/useLatest.ts","/npm/@antv/xflow@2.2.4/src/hooks/useDnd.ts","/npm/@antv/xflow@2.2.4/src/hooks/useClipboard.ts","/npm/@antv/xflow@2.2.4/src/hooks/useLoaded.ts","/npm/@antv/xflow@2.2.4/src/hooks/useExport.ts","/npm/@antv/xflow@2.2.4/src/hooks/useHistory.ts","/npm/@antv/xflow@2.2.4/src/hooks/useKeyboard.ts","/npm/@antv/xflow@2.2.4/src/components/Grid.tsx","/npm/@antv/xflow@2.2.4/src/components/Background.tsx","/npm/@antv/xflow@2.2.4/src/components/Clipboard.tsx","/npm/@antv/xflow@2.2.4/src/components/History.tsx","/npm/@antv/xflow@2.2.4/src/components/Minimap.tsx","/npm/@antv/xflow@2.2.4/src/components/Snapline.tsx","/npm/@antv/xflow@2.2.4/src/components/Transform.tsx","/npm/@antv/xflow@2.2.4/src/components/Control.tsx"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,y/BCNA,YAAA,GAAA,SAAA,YAAA,CAAA,WAAA,IAAA,WAAA,UAAA,IAAA,UAAA,QAAA,IAAA,QAAA,YAAA,IAAA,YAAA,IAAA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Z,MACM,EAAW,KADL,SAAS,GAAQ,IAAK,IACH,GAC/B,OAAQ,GACN,IAAK,SACC,EAAO,KACT,EAAM,KAAK,KAEb,MACF,IAAK,UACC,EAAO,IACT,EAAM,MAAK,KAEb,MACF,IAAK,YACH,EAAM,UAAU,CAAE,SAAU,IAC5B,MACF,IAAK,eACH,EAAM,OAAO,GACb,MACF,IAAK,SACH,EAAM,OAAO,GAKjB,EAAQ,EAAM,SAYhB,OACE,eAAA,QAAA,cAAC,OACC,WAAA,EAAW,kBAAA,SAAW,aAAc,CAClC,mBAAkC,aAAd,KAGrB,EAAM,IAAK,IACV,MAAa,WAAT,EAEA,eAAA,QAAA,cAAC,eAAA,QAAA,CACC,IAAK,EACL,QACE,eAAA,QAAA,cAAC,OAAI,UAAU,mBACZ,cAAc,IAAK,GAEhB,eAAA,QAAA,cAAC,UAAO,IAAK,EAAK,IAAK,QAAS,IAAM,EAAW,EAAM,EAAK,MACzD,EAAK,SAMhB,aAAW,EACX,UAAU,MACV,OAAO,EACP,MAAM,gBAEN,eAAA,QAAA,cAAC,UAAO,UAAU,eAAe,GAAG,KAAK,MAAa,IAAP,QAG1C,kBAAkB,SAAS,GAElC,eAAA,QAAA,cAAC,eAAA,QAAA,CACC,IAAK,EACL,QAAS,eAAe,GAAM,MAC9B,YACA,OAAK,GAEL,eAAA,QAAA,cAAC,UACC,QAAS,IAAM,EAAW,GAC1B,UAjDe,EAiDgB,IAhD/B,UAAR,EACK,EAAO,IACI,YAAT,GACF,EAAO,OA+CH,eAAe,GAAM,OAKrB,KAxDa,IAAC,M3B3G/B,WAAA,YAAc,QAAA,wBAjBd,OAAA","file":"/npm/@antv/xflow@2.2.4/dist/index.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.48.0.\n * Original file: /npm/@antv/xflow@2.2.4/dist/index.cjs.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import {\n  Graph,\n  Point,\n  Rectangle,\n  Line,\n  Path,\n  Polyline,\n  Dom,\n  Vector,\n  Markup,\n} from '@antv/x6';\n\nexport * from './components';\nexport * from './hooks';\nexport * from './util';\nexport * from './types';\n\nexport * from '@antv/x6-react-shape';\nexport { Graph, Point, Rectangle, Line, Path, Polyline, Dom, Vector, Markup };\n","import type { FC, PropsWithChildren } from 'react';\nimport React from 'react';\n\nimport { useGraphInstance } from '../hooks/useGraphInstance';\n\nconst Wrapper: FC<PropsWithChildren> = ({ children }) => {\n  const graph = useGraphInstance();\n\n  if (graph) {\n    return <>{children}</>;\n  }\n\n  return null;\n};\n\nexport { Wrapper };\n","import { useContext } from 'react';\n\nimport { GraphContext } from '../context/GraphContext';\n\nexport const useGraphInstance = () => {\n  const { graph } = useContext(GraphContext);\n\n  return graph;\n};\n","import type { Graph } from '@antv/x6';\nimport React, { createContext, useState, type FC, type PropsWithChildren } from 'react';\n\ninterface GraphContextValue {\n  graph: Graph | null;\n  setGraph: (graph: Graph | null) => void;\n}\n\nexport const GraphContext = createContext<GraphContextValue>({\n  graph: null,\n  setGraph: () => {},\n});\n\nexport const GraphProvider: FC<PropsWithChildren> = ({ children }) => {\n  const [graph, setGraph] = useState<Graph | null>(null);\n\n  return (\n    <GraphContext.Provider value={{ graph, setGraph }}>\n      {children}\n    </GraphContext.Provider>\n  );\n};\n","import { type PropsWithChildren, type FC } from 'react';\nimport React from 'react';\n\nimport { GraphProvider, StoreProvider } from '../context';\nimport '../styles/index.css';\n\nconst XFlow: FC<PropsWithChildren> = ({ children }) => {\n  return (\n    <StoreProvider>\n      <GraphProvider>{children}</GraphProvider>\n    </StoreProvider>\n  );\n};\n\nexport { XFlow };\n","import React, { createContext, useRef, type FC, type PropsWithChildren } from 'react';\n\nimport { createGraphStore, type GraphStore } from '../store';\n\nexport const StoreContext = createContext<GraphStore | null>(null);\n\nexport const StoreProvider: FC<PropsWithChildren> = ({ children }) => {\n  const storeRef = useRef<GraphStore>();\n  if (!storeRef.current) {\n    storeRef.current = createGraphStore();\n  }\n  return (\n    <StoreContext.Provider value={storeRef.current}>{children}</StoreContext.Provider>\n  );\n};\n","/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport { StringExt } from '@antv/x6';\nimport { produce, original } from 'immer';\nimport { create } from 'zustand';\nimport type { UseBoundStore, StoreApi } from 'zustand';\n\nimport type { NodeOptions, EdgeOptions } from '../types';\nimport { apply } from '../util';\n\nexport type Command =\n  | 'init'\n  | 'addNodes'\n  | 'removeNodes'\n  | 'updateNode'\n  | 'addEdges'\n  | 'removeEdges'\n  | 'updateEdge';\n\nexport type ChangeItem = {\n  command: Command;\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  data: any;\n};\n\nexport type State = {\n  changeList: ChangeItem[];\n  nodes: NodeOptions[];\n  edges: EdgeOptions[];\n};\n\ntype ActionOptions = {\n  silent?: boolean;\n};\n\ntype UpdateNodeDataOrFn =\n  | Partial<NodeOptions>\n  | ((node: NodeOptions) => Partial<NodeOptions>);\ntype UpdateEdgeDataOrFn =\n  | Partial<EdgeOptions>\n  | ((edge: EdgeOptions) => Partial<NodeOptions>);\n\nexport type Actions = {\n  initData: (\n    data: { nodes: NodeOptions[]; edges: EdgeOptions[] },\n    options?: ActionOptions,\n  ) => void;\n  getNodes: () => NodeOptions[];\n  addNodes: (ns: NodeOptions[], options?: ActionOptions) => void;\n  removeNodes: (ids: string[], options?: ActionOptions) => void;\n  updateNode: (id: string, data: UpdateNodeDataOrFn, options?: ActionOptions) => void;\n  getEdges: () => EdgeOptions[];\n  addEdges: (es: EdgeOptions[], options?: ActionOptions) => void;\n  removeEdges: (ids: string[], options?: ActionOptions) => void;\n  updateEdge: (id: string, data: UpdateEdgeDataOrFn, options?: ActionOptions) => void;\n  clearChangeList: () => void;\n};\n\nexport type GraphStore = UseBoundStore<StoreApi<State & Actions>>;\n\nexport const createGraphStore = () => {\n  return create<State & Actions>((set, get) => ({\n    nodes: [],\n    edges: [],\n    changeList: [],\n\n    initData: (data, options) =>\n      set(\n        produce((state: State) => {\n          state.nodes = data.nodes;\n          state.edges = data.edges;\n          if (!options?.silent) {\n            state.changeList.push({\n              command: 'init',\n              data,\n            });\n          }\n        }),\n      ),\n\n    getNodes: () => get().nodes,\n\n    addNodes: (ns, options) =>\n      set(\n        produce((state: State) => {\n          if (!ns.length) return;\n          // generate id for nodes\n          ns.forEach((n) => {\n            if (!n.id) {\n              n.id = StringExt.uuid();\n            }\n          });\n          const duplicated = state.nodes.find((n) =>\n            ns.some((m) => m.id && m.id === n.id),\n          );\n          if (!duplicated) {\n            state.nodes.push(...ns);\n            if (!options?.silent) {\n              state.changeList.push({\n                command: 'addNodes',\n                data: ns,\n              });\n            }\n          } else {\n            console.error(`node id=${duplicated.id} already existed`);\n          }\n        }),\n      ),\n\n    removeNodes: (ids, options) =>\n      set(\n        produce((state: State) => {\n          if (!ids.length) return;\n          state.nodes = state.nodes.filter((n) => !ids.includes(n.id!));\n          if (!options?.silent) {\n            state.changeList.push({\n              command: 'removeNodes',\n              data: ids,\n            });\n          }\n        }),\n      ),\n\n    updateNode: (id, data, options) =>\n      set(\n        produce((state: State) => {\n          const node = state.nodes.find((n) => n.id === id);\n          if (node) {\n            const changed =\n              typeof data === 'function' ? data(original(node) || {}) : data;\n            if (changed.id !== undefined || changed.shape !== undefined) {\n              console.error(`id and shape can't be changed`);\n              return;\n            }\n            apply(node, changed);\n            if (!options?.silent) {\n              state.changeList.push({\n                command: 'updateNode',\n                data: { id, data: changed },\n              });\n            }\n          }\n        }),\n      ),\n\n    getEdges: () => get().edges,\n\n    addEdges: (es, options) =>\n      set(\n        produce((state: State) => {\n          if (!es.length) return;\n          // generate id for edges\n          es.forEach((e) => {\n            if (!e.id) {\n              e.id = StringExt.uuid();\n            }\n          });\n          const duplicated = state.edges.find((e) =>\n            es.some((m) => m.id && m.id === e.id),\n          );\n          if (!duplicated) {\n            state.edges.push(...es);\n            if (!options?.silent) {\n              state.changeList.push({\n                command: 'addEdges',\n                data: es,\n              });\n            }\n          } else {\n            console.error(`edge id=${duplicated.id} already existed`);\n          }\n        }),\n      ),\n\n    removeEdges: (ids, options) =>\n      set(\n        produce((state: State) => {\n          if (!ids.length) return;\n          state.edges = state.edges.filter((n) => !ids.includes(n.id));\n          if (!options?.silent) {\n            state.changeList.push({\n              command: 'removeEdges',\n              data: ids,\n            });\n          }\n        }),\n      ),\n\n    updateEdge: (id, data, options) =>\n      set(\n        produce((state: State) => {\n          const edge = state.edges.find((n) => n.id === id);\n          if (edge) {\n            const changed =\n              typeof data === 'function' ? data(original(edge) || {}) : data;\n            if (changed.id !== undefined || changed.shape !== undefined) {\n              console.error(`id and shape can't be changed`);\n              return;\n            }\n            apply(edge, changed);\n            if (!options?.silent) {\n              state.changeList.push({\n                command: 'updateEdge',\n                data: { id, data: changed },\n              });\n            }\n          }\n        }),\n      ),\n\n    clearChangeList: () =>\n      set(\n        produce((state: State) => {\n          state.changeList = [];\n        }),\n      ),\n  }));\n};\n","import type { Graph } from '@antv/x6';\n\nexport const getSuperGraph = (graph: Graph, nodeId: string, nodeIds: string[] = []) => {\n  nodeIds.push(nodeId);\n  const incomingEdges = graph.getIncomingEdges(nodeId);\n  incomingEdges?.forEach((edge) => {\n    const source = edge.getSourceCellId();\n    getSuperGraph(graph, source, nodeIds);\n  });\n  return nodeIds;\n};\n\nexport const getSubGraph = (graph: Graph, nodeId: string, nodeIds: string[] = []) => {\n  nodeIds.push(nodeId);\n  const outgoingEdges = graph.getOutgoingEdges(nodeId);\n  outgoingEdges?.forEach((edge) => {\n    const target = edge.getTargetCellId();\n    getSubGraph(graph, target, nodeIds);\n  });\n  return nodeIds;\n};\n","/* eslint-disable no-prototype-builtins */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/ban-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { ObjectExt } from '@antv/x6';\n\ntype mpObj<T> = { [k in keyof T | string | number | symbol]: any };\n\nexport function apply<L, R>(\n  target: mpObj<L>,\n  patchItem: mpObj<R>,\n): Partial<L> & Partial<R>;\nexport function apply<L, R>(target: mpObj<L>, patchItem: mpObj<R>): R;\nexport function apply<L, R>(target: mpObj<L>, patchItem: mpObj<R>): {};\nexport function apply<L, R>(target: mpObj<L>, patchItem: null): null;\nexport function apply<L, R>(target: mpObj<L>, patchItem: string): string;\nexport function apply<L, R>(target: mpObj<L>, patchItem: number): number;\nexport function apply<L, R>(target: mpObj<L>, patchItem: undefined): undefined;\nexport function apply<L, R>(target: mpObj<L>, patchItem: R[]): R[];\n\nexport function apply(target: any, patchItem: any): any {\n  /**\n   * If the patch is anything other than an object,\n   * the result will always be to replace\n   * the entire target with the entire patch.\n   */\n  if (typeof patchItem !== 'object' || Array.isArray(patchItem) || !patchItem) {\n    return JSON.parse(JSON.stringify(patchItem)); //return new instance of variable\n  }\n\n  if (\n    typeof patchItem === 'object' &&\n    patchItem.toJSON !== undefined &&\n    typeof patchItem.toJSON === 'function'\n  ) {\n    return patchItem.toJSON();\n  }\n  /** Also, it is not possible to\n   * patch part of a target that is not an object,\n   * such as to replace just some of the values in an array.\n   */\n  let targetResult = target;\n  if (typeof target !== 'object') {\n    //Target is empty/not an object, so basically becomes patch, minus any null valued sections (becomes {} + patch)\n    targetResult = { ...patchItem };\n  }\n\n  Object.keys(patchItem).forEach((k) => {\n    if (!targetResult.hasOwnProperty(k)) targetResult[k] = patchItem[k]; //This ensure the key exists and TS can't throw a wobbly over an undefined key\n    if (patchItem[k] === null || patchItem[k] === undefined) {\n      delete targetResult[k];\n    } else if (targetResult[k] !== null && targetResult[k] !== undefined) {\n      targetResult[k] = apply(targetResult[k], patchItem[k]);\n    }\n  });\n  return targetResult;\n}\n\nexport function flatten(obj: any, delim = '/', stop?: (val: any) => boolean) {\n  const ret: { [key: string]: any } = {};\n\n  Object.keys(obj).forEach((key) => {\n    const val = obj[key];\n    let deep = ObjectExt.isPlainObject(val);\n    if (deep && stop && stop(val)) {\n      deep = false;\n    }\n\n    if (deep) {\n      const flatObject = flatten(val, delim, stop);\n      Object.keys(flatObject).forEach((flatKey) => {\n        ret[key + delim + flatKey] = flatObject[flatKey];\n      });\n    } else {\n      ret[key] = val;\n    }\n  });\n\n  // eslint-disable-next-line no-restricted-syntax\n  for (const key in obj) {\n    if (!Object.prototype.hasOwnProperty.call(obj, key)) {\n      continue;\n    }\n  }\n\n  return ret;\n}\n","import { Graph, Options } from '@antv/x6';\nimport { Keyboard } from '@antv/x6-plugin-keyboard';\nimport { Scroller } from '@antv/x6-plugin-scroller';\nimport { Selection } from '@antv/x6-plugin-selection';\nimport React, { useContext, useRef, useEffect } from 'react';\n\nimport { GraphContext } from '../context';\nimport type { GraphOptions } from '../types';\n\nimport { XFlowState } from './State';\nimport { Wrapper } from './Wrapper';\n\nconst XFlowGraph = (props: GraphOptions) => {\n  const container = useRef<HTMLDivElement>(null);\n  const {\n    className,\n    style,\n    readonly,\n    virtual,\n    minScale,\n    maxScale,\n    zoomable,\n    zoomOptions,\n    pannable,\n    panOptions,\n    embedable,\n    embedOptions,\n    restrict,\n    restrictOptions,\n    connectionOptions,\n    onPortRendered,\n    onEdgeLabelRendered,\n    createCellView,\n    selectOptions,\n    keyboardOptions,\n    scroller,\n    scrollerOptions,\n    connectionEdgeOptions,\n    defaultHighlightOptions,\n    embedHighlightOptions,\n    nodeAvailableHighlightOptions,\n    magnetAvailableHighlightOptions,\n    magnetAdsorbedHighlightOptions,\n    magnetThreshold,\n  } = props;\n  const { graph, setGraph } = useContext(GraphContext);\n\n  useEffect(() => {\n    const g = new Graph({\n      // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n      container: container.current!,\n      autoResize: true,\n      virtual,\n      scaling: {\n        min: minScale,\n        max: maxScale,\n      },\n      connecting: {\n        ...connectionOptions,\n        createEdge() {\n          return this.createEdge({\n            shape: 'edge',\n            ...connectionEdgeOptions,\n          });\n        },\n      },\n      highlighting: {\n        default: defaultHighlightOptions,\n        embedding: embedHighlightOptions,\n        nodeAvailable: nodeAvailableHighlightOptions,\n        magnetAvailable: magnetAvailableHighlightOptions,\n        magnetAdsorbed: magnetAdsorbedHighlightOptions,\n      },\n      onPortRendered,\n      onEdgeLabelRendered,\n      createCellView,\n      magnetThreshold,\n    });\n\n    g.use(new Selection({ enabled: true, ...selectOptions }));\n    g.use(new Keyboard({ enabled: true, ...keyboardOptions }));\n\n    if (scroller) {\n      g.use(new Scroller({ enabled: true, ...scrollerOptions }));\n    }\n\n    setGraph(g);\n\n    return () => {\n      if (g) {\n        g.dispose();\n        setGraph(null);\n      }\n    };\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, []);\n\n  useEffect(() => {\n    if (graph) {\n      if (readonly) {\n        graph.options.interacting = false;\n      } else {\n        graph.options.interacting = {\n          nodeMovable: (view) => {\n            const cell = view.cell;\n            return cell.prop('draggable') !== false;\n          },\n          edgeMovable: (view) => {\n            const cell = view.cell;\n            return cell.prop('draggable') !== false;\n          },\n          edgeLabelMovable: (view) => {\n            const cell = view.cell;\n            return cell.prop('labelDraggable') === true;\n          },\n        };\n      }\n    }\n  }, [graph, readonly]);\n\n  useEffect(() => {\n    if (graph) {\n      if (zoomable) {\n        graph.enableMouseWheel();\n        graph.options.mousewheel = {\n          ...Options.defaults.mousewheel,\n          ...zoomOptions,\n          enabled: true,\n        };\n      } else {\n        graph.disableMouseWheel();\n      }\n    }\n  }, [graph, zoomable, zoomOptions]);\n\n  useEffect(() => {\n    if (graph) {\n      if (pannable) {\n        graph.options.panning = {\n          ...Options.defaults.panning,\n          enabled: true,\n          ...panOptions,\n        };\n        graph.enablePanning();\n      } else {\n        graph.disablePanning();\n      }\n    }\n  }, [graph, pannable, panOptions]);\n\n  useEffect(() => {\n    if (graph) {\n      if (embedable) {\n        graph.options.embedding = {\n          ...Options.defaults.embedding,\n          enabled: true,\n          validate: () => true,\n          ...embedOptions,\n        };\n      } else {\n        graph.options.embedding = { enabled: false, validate: () => false };\n      }\n    }\n  }, [graph, embedable, embedOptions]);\n\n  useEffect(() => {\n    if (graph) {\n      if (restrict) {\n        graph.options.translating = {\n          restrict: restrictOptions ? restrictOptions.bound : restrict,\n        };\n      } else {\n        graph.options.translating = { restrict: false };\n      }\n    }\n  }, [graph, restrict, restrictOptions]);\n\n  return (\n    <div style={{ width: '100%', height: '100%', ...style }} className={className}>\n      <div ref={container} style={{ width: '100%', height: '100%' }} />\n      <Wrapper>\n        <XFlowState\n          connectionEdgeOptions={connectionEdgeOptions}\n          centerView={props.centerView}\n          centerViewOptions={props.centerViewOptions}\n          fitView={props.fitView}\n          fitViewOptions={props.fitViewOptions}\n        />\n      </Wrapper>\n    </div>\n  );\n};\n\nexport { XFlowGraph };\n","/* eslint-disable no-case-declarations */\nimport type { Graph, EventArgs, Cell } from '@antv/x6';\nimport { FunctionExt, ObjectExt, Point } from '@antv/x6';\nimport React, { useEffect, type FC } from 'react';\n\nimport { useGraphEvent, useGraphInstance, useGraphStore } from '../hooks';\nimport type { ChangeItem } from '../store';\nimport type { GraphOptions, NodeOptions, EdgeOptions, GraphModel } from '../types';\nimport { flatten } from '../util';\n\nconst INNER_CALL = '__inner__';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst preprocess = (key: keyof Cell.Properties, value: any, graph: Graph) => {\n  if (key === 'position') {\n    const { x, y } = Point.create(value).snapToGrid(graph.getGridSize());\n    return {\n      x,\n      y,\n    };\n  }\n  if (key === 'size') {\n    return {\n      width: value.width,\n      height: value.height,\n    };\n  }\n  return {\n    [key]: value,\n  };\n};\n\nconst XFlowState: FC<\n  Pick<\n    GraphOptions,\n    | 'centerView'\n    | 'centerViewOptions'\n    | 'fitView'\n    | 'fitViewOptions'\n    | 'connectionEdgeOptions'\n  >\n> = (props) => {\n  const { centerView, centerViewOptions, fitView, fitViewOptions } = props;\n  const graph = useGraphInstance();\n  const updateNode = useGraphStore((state) => state.updateNode);\n  const updateEdge = useGraphStore((state) => state.updateEdge);\n  const addNodes = useGraphStore((state) => state.addNodes);\n  const addEdges = useGraphStore((state) => state.addEdges);\n  const removeNodes = useGraphStore((state) => state.removeNodes);\n  const removeEdges = useGraphStore((state) => state.removeEdges);\n  const changeList = useGraphStore((state) => state.changeList);\n  const clearChangeList = useGraphStore((state) => state.clearChangeList);\n\n  const changeSelectionStatus = (status: Partial<NodeOptions | EdgeOptions>[]) => {\n    if (graph) {\n      const added = status.filter((item) => item.selected);\n      const removed = status.filter((item) => !item.selected);\n      graph.select(\n        added.map((item) => item.id),\n        { [INNER_CALL]: true },\n      );\n      graph.unselect(\n        removed.map((item) => item.id),\n        { [INNER_CALL]: true },\n      );\n    }\n  };\n\n  const changeAnimatedStatus = (status: Partial<EdgeOptions>[]) => {\n    if (graph) {\n      status.forEach((item) => {\n        const cell = graph.getCellById(item.id);\n        if (cell) {\n          if (item.animated) {\n            cell.attr('line/strokeDasharray', 5, { [INNER_CALL]: true });\n            cell.attr('line/style/animation', 'animated-line 30s infinite linear', {\n              [INNER_CALL]: true,\n            });\n          } else {\n            cell.attr('line/strokeDasharray', 0, { [INNER_CALL]: true });\n            cell.attr('line/style/animation', '', { [INNER_CALL]: true });\n          }\n        }\n      });\n    }\n  };\n\n  const initData = (g: Graph, data: GraphModel) => {\n    g.fromJSON(ObjectExt.cloneDeep(data));\n\n    if (centerView) {\n      g.centerContent(centerViewOptions);\n    }\n\n    if (fitView) {\n      g.zoomToFit({ maxScale: 1, ...fitViewOptions });\n    }\n\n    const { nodes, edges }: { nodes: NodeOptions[]; edges: EdgeOptions[] } = data;\n    changeSelectionStatus([...nodes, ...edges]);\n    changeAnimatedStatus([...edges]);\n  };\n\n  const onSpecialPropChange = (\n    id: string,\n    data: Partial<NodeOptions> | Partial<EdgeOptions>,\n  ) => {\n    if (graph) {\n      const keys = Object.keys(data);\n      if (keys.includes('selected')) {\n        const selected = !!data.selected;\n        changeSelectionStatus([{ id, selected }]);\n      } else if (keys.includes('animated')) {\n        const animated = !!data.animated;\n        changeAnimatedStatus([{ id, animated }]);\n      }\n    }\n  };\n\n  const onPropChange = (\n    id: string,\n    data: Partial<NodeOptions> | Partial<EdgeOptions>,\n    batchName: string,\n  ) => {\n    if (graph) {\n      const cell = graph.getCellById(id);\n      if (cell) {\n        graph.startBatch(batchName);\n        const changed = cell.preprocess(data, true);\n        const properties = flatten(changed);\n        Object.keys(properties).forEach((key) => {\n          cell.setPropByPath(key, properties[key], {\n            [INNER_CALL]: true,\n            rewrite: true,\n          });\n        });\n        onSpecialPropChange(id, data);\n        graph.stopBatch(batchName);\n      }\n    }\n  };\n\n  const handleGraphChange = (g: Graph, changes: ChangeItem[]) => {\n    changes.forEach((changeItem) => {\n      const { command, data } = changeItem;\n      switch (command) {\n        case 'init':\n          initData(g, data);\n          break;\n        case 'addNodes':\n          const nodes = ObjectExt.cloneDeep(data);\n          g.addNodes(nodes, { [INNER_CALL]: true });\n          changeSelectionStatus(nodes);\n          break;\n        case 'removeNodes':\n          g.removeCells(data, { [INNER_CALL]: true });\n          break;\n        case 'updateNode':\n          onPropChange(data.id, data.data, 'updateNode');\n          break;\n        case 'addEdges':\n          const edges = ObjectExt.cloneDeep(data);\n          g.addEdges(edges, { [INNER_CALL]: true });\n          changeSelectionStatus(edges);\n          changeAnimatedStatus(edges);\n          break;\n        case 'removeEdges':\n          g.removeCells(data, { [INNER_CALL]: true });\n          break;\n        case 'updateEdge':\n          onPropChange(data.id, data.data, 'updateEdge');\n          break;\n        default:\n          break;\n      }\n    });\n    setTimeout(() => {\n      clearChangeList();\n    });\n  };\n\n  useEffect(() => {\n    if (graph && changeList.length) {\n      handleGraphChange(graph, changeList);\n    }\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [changeList, graph]);\n\n  // Add cells for internal operations\n  useGraphEvent('cell:added', ({ cell, options }) => {\n    if (!options[INNER_CALL]) {\n      if (cell.isNode()) {\n        const nodes = [cell.toJSON()];\n        addNodes(nodes, { silent: true });\n        changeSelectionStatus(nodes);\n      } else if (cell.isEdge()) {\n        const edges = [cell.toJSON()];\n        addEdges(edges, { silent: true });\n        changeSelectionStatus(edges);\n        changeAnimatedStatus(edges);\n      }\n    }\n  });\n\n  // Remove cells for internal operations\n  useGraphEvent('cell:removed', ({ cell }) => {\n    // no need to check INNER_CALL here\n    if (cell.isNode()) {\n      removeNodes([cell.id], { silent: true });\n    } else if (cell.isEdge()) {\n      removeEdges([cell.id], { silent: true });\n    }\n  });\n\n  // Update cells for internal operations\n  useGraphEvent(\n    'cell:change:*',\n    FunctionExt.debounce(\n      ({ cell, key, current, options }: EventArgs['cell:change:*']) => {\n        if (!options[INNER_CALL] && graph) {\n          if (cell.isNode()) {\n            updateNode(cell.id, preprocess(key, current, graph), { silent: true });\n          } else if (cell.isEdge()) {\n            updateEdge(cell.id, { [key]: current }, { silent: true });\n          }\n        }\n      },\n      100,\n      { leading: true },\n    ),\n  );\n\n  useGraphEvent('selection:changed', ({ added, removed, options }) => {\n    if (!options[INNER_CALL]) {\n      added.forEach((item) => {\n        if (item.isNode()) {\n          updateNode(item.id, { selected: true }, { silent: true });\n        } else if (item.isEdge()) {\n          updateEdge(item.id, { selected: true }, { silent: true });\n        }\n      });\n\n      removed.forEach((item) => {\n        if (item.isNode()) {\n          updateNode(item.id, { selected: false }, { silent: true });\n        } else if (item.isEdge()) {\n          updateEdge(item.id, { selected: false }, { silent: true });\n        }\n      });\n    }\n  });\n\n  return null;\n};\n\nexport { XFlowState };\n","import { useContext } from 'react';\nimport { useStore } from 'zustand';\n\nimport { StoreContext } from '../context';\nimport type { State, Actions } from '../store';\n\nexport const useGraphStore = <T>(selector: (state: State & Actions) => T) => {\n  const store = useContext(StoreContext);\n  if (!store) {\n    throw new Error('can only be get inside the xflow component.');\n  }\n  return useStore(store, selector);\n};\n","import type { EventArgs } from '@antv/x6';\nimport { useEffect } from 'react';\n\nimport { useGraphInstance } from './useGraphInstance';\nimport { useLatest } from './useLatest';\n\nexport const useGraphEvent = <T extends keyof EventArgs>(\n  name: T,\n  callback: (args: EventArgs[T]) => void,\n) => {\n  const cbRef = useLatest(callback);\n  const graph = useGraphInstance();\n\n  useEffect(() => {\n    if (graph) {\n      cbRef.current = callback;\n      graph.on(name, (args: EventArgs[T]) => {\n        cbRef.current(args);\n      });\n    }\n\n    return () => {\n      if (graph && cbRef.current) {\n        graph.off(name, cbRef.current);\n      }\n    };\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [graph]);\n};\n","import { useRef } from 'react';\n\nfunction useLatest<T>(value: T) {\n  const ref = useRef(value);\n  ref.current = value;\n\n  return ref;\n}\n\nexport { useLatest };\n","import { Dnd } from '@antv/x6-plugin-dnd';\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport type { NodeOptions } from '../types';\n\nimport { useGraphInstance } from './useGraphInstance';\n\nexport const useDnd = (\n  options?: Omit<Dnd.Options, 'target' | 'getDragNode' | 'getDropNode'>,\n) => {\n  const graph = useGraphInstance();\n  const ref = useRef<Dnd>();\n\n  useEffect(() => {\n    if (graph && !ref.current) {\n      ref.current = new Dnd({\n        target: graph,\n        getDragNode: (node) => node.clone({ keepId: true }),\n        getDropNode: (node) => node.clone({ keepId: true }),\n        ...options,\n      });\n    }\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [graph]);\n\n  const startDrag = useCallback(\n    (n: NodeOptions, e: React.MouseEvent<Element, MouseEvent>) => {\n      if (graph && ref.current) {\n        e.persist();\n        ref.current.start(graph.createNode(n), e.nativeEvent);\n      }\n    },\n    [graph],\n  );\n\n  return { startDrag };\n};\n","import type { Clipboard } from '@antv/x6-plugin-clipboard';\nimport { useCallback } from 'react';\n\nimport { useGraphInstance } from './useGraphInstance';\nimport { useLoaded } from './useLoaded';\n\nexport const useClipboard = () => {\n  const graph = useGraphInstance();\n  const { isLoaded } = useLoaded('clipboard');\n\n  const copy = useCallback(\n    (ids: string[], copyOptions?: Clipboard.CopyOptions) => {\n      if (isLoaded() && graph) {\n        const cells = ids.map((id) => graph?.getCellById(id)).filter(Boolean);\n        graph.copy(cells, copyOptions);\n      }\n    },\n    [graph, isLoaded],\n  );\n\n  const cut = useCallback(\n    (ids: string[], cutOptions?: Clipboard.CopyOptions) => {\n      if (isLoaded() && graph) {\n        const cells = ids.map((id) => graph?.getCellById(id)).filter(Boolean);\n        graph.cut(cells, cutOptions);\n      }\n    },\n    [graph, isLoaded],\n  );\n\n  const paste = useCallback(\n    (pasteOptions?: Clipboard.PasteOptions) => {\n      if (isLoaded() && graph) {\n        const cells = graph.paste(pasteOptions);\n        return cells;\n      }\n      return [];\n    },\n    [graph, isLoaded],\n  );\n\n  return { copy, cut, paste };\n};\n","import { useCallback } from 'react';\n\nimport { useGraphInstance } from './useGraphInstance';\n\nexport const useLoaded = (name: string) => {\n  const graph = useGraphInstance();\n\n  const isLoaded = useCallback(\n    (cb?: () => void) => {\n      if (!graph) {\n        console.warn('graph can only be get inside the xflow component.');\n        return false;\n      }\n      const plugin = graph.getPlugin(name);\n      if (!plugin) {\n        if (cb) {\n          return cb();\n        }\n        console.warn(`${name} is not loaded, please use ${name} component first.`);\n        return false;\n      }\n      return true;\n    },\n    [graph, name],\n  );\n\n  return {\n    isLoaded,\n  };\n};\n","import { Export } from '@antv/x6-plugin-export';\nimport { useCallback } from 'react';\n\nimport { useGraphInstance } from './useGraphInstance';\nimport { useLoaded } from './useLoaded';\n\nexport const useExport = () => {\n  const graph = useGraphInstance();\n  const { isLoaded } = useLoaded('export');\n\n  const ensure = useCallback(() => {\n    return isLoaded(() => {\n      graph?.use(new Export());\n      return true;\n    });\n  }, [graph, isLoaded]);\n\n  const exportPNG = useCallback(\n    (fileName = 'chart', options: Export.ToImageOptions = {}) => {\n      if (ensure() && graph) {\n        graph.exportPNG(fileName, options);\n      }\n    },\n    [graph, ensure],\n  );\n\n  const exportJPEG = useCallback(\n    (fileName = 'chart', options: Export.ToImageOptions = {}) => {\n      if (ensure() && graph) {\n        graph.exportJPEG(fileName, options);\n      }\n    },\n    [graph, ensure],\n  );\n\n  const exportSVG = useCallback(\n    (fileName = 'chart', options: Export.ToSVGOptions = {}) => {\n      if (ensure() && graph) {\n        graph.exportSVG(fileName, options);\n      }\n    },\n    [graph, ensure],\n  );\n\n  return { exportPNG, exportJPEG, exportSVG };\n};\n","import type { KeyValue } from '@antv/x6';\nimport { useCallback, useState } from 'react';\n\nimport { useGraphEvent } from './useGraphEvent';\nimport { useGraphInstance } from './useGraphInstance';\nimport { useLoaded } from './useLoaded';\n\nexport const useHistory = () => {\n  const graph = useGraphInstance();\n  const { isLoaded } = useLoaded('history');\n  const [canUndo, setCanUndo] = useState(false);\n  const [canRedo, setCanRedo] = useState(false);\n\n  const undo = useCallback(\n    (options?: KeyValue) => {\n      if (isLoaded() && graph) {\n        return graph.undo(options);\n      }\n      return null;\n    },\n    [graph, isLoaded],\n  );\n\n  const redo = useCallback(\n    (options?: KeyValue) => {\n      if (isLoaded() && graph) {\n        return graph.redo(options);\n      }\n      return null;\n    },\n    [graph, isLoaded],\n  );\n\n  useGraphEvent('history:change', () => {\n    if (graph) {\n      setCanUndo(graph.canUndo());\n      setCanRedo(graph.canRedo());\n    }\n  });\n\n  return { undo, redo, canUndo, canRedo };\n};\n","import { useEffect } from 'react';\n\nimport { useGraphInstance } from './useGraphInstance';\nimport { useLatest } from './useLatest';\n\nexport const useKeyboard = (\n  key: string | string[],\n  callback: (e: KeyboardEvent) => void,\n  action?: 'keypress' | 'keydown' | 'keyup',\n) => {\n  const cbRef = useLatest(callback);\n  const graph = useGraphInstance();\n\n  useEffect(() => {\n    if (graph) {\n      cbRef.current = callback;\n      graph.bindKey(\n        key,\n        (e) => {\n          cbRef.current(e);\n        },\n        action,\n      );\n    }\n\n    return () => {\n      if (graph) {\n        graph.unbindKey(key);\n      }\n    };\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [graph]);\n};\n","import { type Registry } from '@antv/x6';\nimport React, { useEffect } from 'react';\n\nimport { useGraphInstance } from '../hooks/useGraphInstance';\n\ntype GridTypes = keyof Registry.Grid.Presets;\ninterface GridProps<T extends GridTypes> {\n  visible?: boolean;\n  size?: number;\n  type: T;\n  options: Registry.Grid.OptionsMap[T];\n}\n\nconst Grid = <T extends GridTypes>(props: GridProps<T>) => {\n  const graph = useGraphInstance();\n  const { visible, size, type, options } = props;\n\n  useEffect(() => {\n    if (graph) {\n      graph.clearGrid();\n      graph.drawGrid({\n        type,\n        args: options,\n      });\n      graph.showGrid();\n    }\n  }, [graph, type, options]);\n\n  useEffect(() => {\n    if (graph) {\n      if (visible === false) {\n        graph.hideGrid();\n      } else {\n        graph.showGrid();\n      }\n    }\n  }, [graph, visible]);\n\n  useEffect(() => {\n    if (graph) {\n      if (size) {\n        graph.setGridSize(size);\n      }\n    }\n  }, [graph, size]);\n\n  return null;\n};\n\nexport { Grid };\n","import type { Graph } from '@antv/x6';\nimport React, { useEffect } from 'react';\n\nimport { useGraphInstance } from '../hooks/useGraphInstance';\n\nconst Background = (props: Graph.BackgroundManager.Options) => {\n  const graph = useGraphInstance();\n\n  useEffect(() => {\n    if (graph) {\n      graph.clearBackground();\n      graph.drawBackground(props);\n    }\n  }, [graph, props]);\n\n  return null;\n};\n\nexport { Background };\n","import { Clipboard as C } from '@antv/x6-plugin-clipboard';\nimport React, { useEffect } from 'react';\n\nimport { useGraphInstance } from '../hooks/useGraphInstance';\n\nconst Clipboard = (props: Omit<C.Options, 'enabled'>) => {\n  const graph = useGraphInstance();\n\n  useEffect(() => {\n    if (graph) {\n      if (graph.getPlugin('clipboard')) {\n        graph.disposePlugins('clipboard');\n      }\n      graph.use(\n        new C({\n          enabled: true,\n          ...props,\n        }),\n      );\n    }\n  }, [graph, props]);\n\n  return null;\n};\n\nexport { Clipboard };\n","import { History as H } from '@antv/x6-plugin-history';\nimport React, { useEffect } from 'react';\n\nimport { useGraphInstance } from '../hooks/useGraphInstance';\n\nconst History = (props: Omit<H.Options, 'enabled'>) => {\n  const graph = useGraphInstance();\n\n  useEffect(() => {\n    if (graph) {\n      if (graph.getPlugin('history')) {\n        graph.disposePlugins('history');\n      }\n      graph.use(\n        new H({\n          enabled: true,\n          ...props,\n        }),\n      );\n    }\n  }, [graph, props]);\n\n  return null;\n};\n\nexport { History };\n","import { NodeView } from '@antv/x6';\nimport { MiniMap as M } from '@antv/x6-plugin-minimap';\nimport React, { useEffect, useRef } from 'react';\n\nimport { useGraphInstance } from '../hooks/useGraphInstance';\n\ntype IProps = Partial<Omit<M.Options, 'container'>> & {\n  style?: React.CSSProperties;\n  className?: string;\n  simple?: boolean;\n  simpleNodeBackground?: string;\n};\n\nclass SimpleNodeView extends NodeView {\n  static nodeBackground = '#8f8f8f';\n\n  protected renderMarkup() {\n    const tag = this.cell.shape === 'circle' ? 'circle' : 'rect';\n    return this.renderJSONMarkup({\n      tagName: tag,\n      selector: 'body',\n    });\n  }\n\n  update() {\n    super.update({\n      body: {\n        refWidth: '100%',\n        refHeight: '100%',\n        fill: SimpleNodeView.nodeBackground,\n      },\n    });\n  }\n}\n\nconst Minimap = (props: IProps) => {\n  const { style, className, simple, simpleNodeBackground, ...others } = props;\n  const ref = useRef<HTMLDivElement>(null);\n  const graph = useGraphInstance();\n\n  useEffect(() => {\n    if (graph && ref.current) {\n      if (graph.getPlugin('minimap')) {\n        graph.disposePlugins('minimap');\n      }\n      SimpleNodeView.nodeBackground =\n        simpleNodeBackground || SimpleNodeView.nodeBackground;\n      graph.use(\n        new M({\n          container: ref.current,\n          width: 200,\n          height: 160,\n          padding: 10,\n          graphOptions: simple\n            ? {\n                createCellView(cell) {\n                  if (cell.isEdge()) {\n                    return null;\n                  }\n                  if (cell.isNode()) {\n                    return SimpleNodeView;\n                  }\n                  return undefined;\n                },\n              }\n            : undefined,\n          ...others,\n        }),\n      );\n    }\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [graph, others]);\n\n  return <div ref={ref} style={{ ...style }} className={className} />;\n};\n\nexport { Minimap };\n","import { Snapline as S } from '@antv/x6-plugin-snapline';\nimport React, { useEffect } from 'react';\n\nimport { useGraphInstance } from '../hooks/useGraphInstance';\n\nconst Snapline = (props: Omit<S.Options, 'enabled'>) => {\n  const graph = useGraphInstance();\n\n  useEffect(() => {\n    if (graph) {\n      if (graph.getPlugin('snapline')) {\n        graph.disposePlugins('snapline');\n      }\n      graph.use(\n        new S({\n          enabled: true,\n          ...props,\n        }),\n      );\n    }\n  }, [graph, props]);\n\n  return null;\n};\n\nexport { Snapline };\n","import { Transform as T } from '@antv/x6-plugin-transform';\nimport React, { useEffect } from 'react';\n\nimport { useGraphInstance } from '../hooks/useGraphInstance';\n\ntype IProps = {\n  resizing?: T.Options['resizing'];\n  rotating?: T.Options['rotating'];\n};\n\nconst Transform = (props: IProps) => {\n  const graph = useGraphInstance();\n  const { resizing, rotating } = props;\n\n  const parseOptions = (options: T.Options['resizing'] | T.Options['rotating']) => {\n    if (typeof options === 'boolean') {\n      return options;\n    }\n    if (typeof options === 'object') {\n      return {\n        enabled: true,\n        ...options,\n      };\n    }\n\n    return false;\n  };\n\n  useEffect(() => {\n    if (graph) {\n      if (graph.getPlugin('transform')) {\n        graph.disposePlugins('transform');\n      }\n\n      graph.use(\n        new T({\n          resizing: parseOptions(resizing),\n          rotating: parseOptions(rotating),\n        }),\n      );\n    }\n  }, [graph, resizing, rotating]);\n\n  return null;\n};\n\nexport { Transform };\n","import Tippy from '@tippyjs/react';\nimport classNames from 'classnames';\nimport { Plus, Minus, Minimize, Dice5 } from 'lucide-react';\nimport React, { useEffect, useState } from 'react';\nimport 'tippy.js/dist/tippy.css';\n\nimport { useGraphEvent, useGraphInstance } from '@/hooks';\n\nexport enum ControlEnum {\n  ZoomTo = 'zoomTo',\n  ZoomIn = 'zoomIn',\n  ZoomOut = 'zoomOut',\n  ZoomToFit = 'zoomToFit',\n  ZoomToOrigin = 'zoomToOrigin',\n}\n\nconst dropDownItems = [\n  {\n    key: '1',\n    label: '50%',\n  },\n  {\n    key: '2',\n    label: '75%',\n  },\n  {\n    key: '3',\n    label: '100%',\n  },\n  {\n    key: '4',\n    label: '125%',\n  },\n  {\n    key: '5',\n    label: '150%',\n  },\n];\n\nconst ControlToolMap = {\n  [ControlEnum.ZoomIn]: {\n    label: '放大',\n    icon: <Plus color=\"#545456\" size={20} />,\n  },\n  [ControlEnum.ZoomOut]: {\n    label: '缩小',\n    icon: <Minus color=\"#545456\" size={20} />,\n  },\n  [ControlEnum.ZoomTo]: {\n    label: '缩放至',\n    icon: <Plus color=\"#545456\" size={20} />,\n  },\n  [ControlEnum.ZoomToFit]: {\n    label: '自适应窗口大小',\n    icon: <Minimize color=\"#545456\" size={20} />,\n  },\n  [ControlEnum.ZoomToOrigin]: {\n    label: '实际像素展示',\n    icon: <Dice5 color=\"#545456\" size={20} />,\n  },\n};\n\nconst ControlActionList = [\n  'zoomTo',\n  'zoomIn',\n  'zoomOut',\n  'zoomToFit',\n  'zoomToOrigin',\n] as const;\n\ntype ControlAction = (typeof ControlActionList)[number];\n\ninterface ControlIProps {\n  items: ControlAction[];\n  direction?: 'horizontal' | 'vertical';\n  placement?: 'top' | 'right' | 'bottom' | 'left';\n}\n\nconst Control = (props: ControlIProps) => {\n  const { items, direction = 'horizontal', placement = 'top' } = props;\n  const graph = useGraphInstance();\n\n  const [zoom, setZoom] = useState(1);\n\n  useGraphEvent('scale', ({ sx }) => {\n    setZoom(sx);\n  });\n\n  useEffect(() => {\n    if (graph) {\n      setZoom(graph.zoom());\n    }\n  }, [graph, props]);\n\n  const changeZoom = (type: ControlAction, args?: string) => {\n    if (!graph) return;\n    const key = parseInt(args || '1', 10);\n    const zoomNum = (0.25 * (key + 1)) as number;\n    switch (type) {\n      case ControlEnum.ZoomIn:\n        if (zoom < 1.5) {\n          graph.zoom(0.25);\n        }\n        break;\n      case ControlEnum.ZoomOut:\n        if (zoom > 0.5) {\n          graph.zoom(-0.25);\n        }\n        break;\n      case ControlEnum.ZoomToFit:\n        graph.zoomToFit({ maxScale: 1 });\n        break;\n      case ControlEnum.ZoomToOrigin:\n        graph.zoomTo(1);\n        break;\n      case ControlEnum.ZoomTo:\n        graph.zoomTo(zoomNum);\n        break;\n      default:\n        break;\n    }\n    setZoom(graph.zoom());\n  };\n\n  const isToolButtonEnabled = (type: ControlEnum) => {\n    if (type == ControlEnum.ZoomIn) {\n      return zoom < 1.5;\n    } else if (type === ControlEnum.ZoomOut) {\n      return zoom > 0.51;\n    }\n    return true;\n  };\n\n  return (\n    <div\n      className={classNames('toolButton', {\n        toolbuttonVertical: direction === 'vertical',\n      })}\n    >\n      {items.map((tool) => {\n        if (tool === 'zoomTo') {\n          return (\n            <Tippy\n              key={tool}\n              content={\n                <div className=\"tippyBtnContent\">\n                  {dropDownItems.map((item) => {\n                    return (\n                      <button key={item.key} onClick={() => changeZoom(tool, item.key)}>\n                        {item.label}\n                      </button>\n                    );\n                  })}\n                </div>\n              }\n              interactive\n              placement=\"top\"\n              arrow={false}\n              theme=\"light-border\"\n            >\n              <button className=\"dropDownBtn\">{`${Math.floor(zoom * 100)}%`}</button>\n            </Tippy>\n          );\n        } else if (ControlActionList.includes(tool)) {\n          return (\n            <Tippy\n              key={tool}\n              content={ControlToolMap[tool].label}\n              placement={placement}\n              arrow\n            >\n              <button\n                onClick={() => changeZoom(tool)}\n                disabled={!isToolButtonEnabled(tool as ControlEnum)}\n              >\n                {ControlToolMap[tool].icon}\n              </button>\n            </Tippy>\n          );\n        } else {\n          return null;\n        }\n      })}\n    </div>\n  );\n};\n\nexport { Control };\n"]}