{"version":3,"file":"index.umd.cjs","sources":["../src/layout/depthUtils.ts","../src/layout/forceUtils.ts","../src/layout/layoutUtils.ts","../src/layout/forceInABox.ts","../src/layout/forceDirected.ts","../src/layout/circular2d.ts","../src/layout/hierarchical.ts","../src/layout/nooverlap.ts","../src/layout/forceatlas2.ts","../src/layout/custom.ts","../src/layout/layoutProvider.ts","../src/layout/recommender.ts","../src/sizing/pageRank.ts","../src/sizing/centrality.ts","../src/sizing/attribute.ts","../src/sizing/nodeSizeProvider.ts","../src/utils/visibility.ts","../src/utils/graph.ts","../src/utils/animation.ts","../src/utils/arrow.ts","../src/utils/position.ts","../src/utils/layout.ts","../src/utils/cluster.ts","../src/utils/useHoverIntent.ts","../src/utils/useDrag.ts","../src/utils/paths.ts","../src/store.ts","../src/collapse/utils.ts","../src/collapse/useCollapse.ts","../src/useGraph.ts","../src/symbols/Label.tsx","../src/symbols/nodes/Sphere.tsx","../src/symbols/Ring.tsx","../src/CameraControls/useCameraControls.ts","../src/CameraControls/CameraControls.tsx","../src/CameraControls/useCenterGraph.ts","../src/symbols/nodes/Icon.tsx","../src/symbols/nodes/SphereWithIcon.tsx","../src/symbols/nodes/Svg.tsx","../src/symbols/nodes/SphereWithSvg.tsx","../src/symbols/Node.tsx","../src/symbols/Arrow.tsx","../src/symbols/Line.tsx","../src/symbols/Edge.tsx","../src/symbols/edges/useEdgeGeometry.ts","../src/symbols/edges/useEdgeEvents.ts","../src/symbols/edges/useEdgeAnimations.ts","../src/symbols/edges/Edge.tsx","../src/symbols/edges/Edges.tsx","../src/symbols/Cluster.tsx","../src/GraphScene.tsx","../src/themes/darkTheme.ts","../src/themes/lightTheme.ts","../src/selection/utils.ts","../src/selection/Lasso.tsx","../src/selection/useSelection.ts","../src/GraphCanvas.tsx","../src/RadialMenu/RadialSlice.tsx","../src/RadialMenu/utils.ts","../src/RadialMenu/RadialMenu.tsx"],"sourcesContent":["import { InternalGraphEdge, InternalGraphNode } from '../types';\n\nexport interface DepthNode {\n  data: InternalGraphNode;\n  ins: DepthNode[];\n  out: DepthNode[];\n  depth: number;\n}\n\n/**\n * Traverse the graph and get the depth of each node.\n */\nfunction traverseGraph(nodes: DepthNode[], nodeStack: DepthNode[] = []) {\n  const currentDepth = nodeStack.length;\n\n  for (const node of nodes) {\n    const idx = nodeStack.indexOf(node);\n    if (idx > -1) {\n      const loop = [...nodeStack.slice(idx), node].map(d => d.data.id);\n      throw new Error(\n        `Invalid Graph: Circular node path detected: ${loop.join(' -> ')}.`\n      );\n    }\n\n    if (currentDepth > node.depth) {\n      node.depth = currentDepth;\n      traverseGraph(node.out, [...nodeStack, node]);\n    }\n  }\n}\n\n/**\n * Gets the depth of the graph's nodes. Used in the radial layout.\n */\nexport function getNodeDepth(\n  nodes: InternalGraphNode[],\n  links: InternalGraphEdge[]\n) {\n  let invalid = false;\n\n  const graph: { [key: string]: DepthNode } = nodes.reduce(\n    (acc, cur) => ({\n      ...acc,\n      [cur.id]: {\n        data: cur,\n        out: [],\n        depth: -1,\n        ins: []\n      }\n    }),\n    {}\n  );\n\n  try {\n    for (const link of links) {\n      const from = link.source;\n      const to = link.target;\n\n      if (!graph.hasOwnProperty(from)) {\n        throw new Error(`Missing source Node ${from}`);\n      }\n\n      if (!graph.hasOwnProperty(to)) {\n        throw new Error(`Missing target Node ${to}`);\n      }\n\n      const sourceNode = graph[from];\n      const targetNode = graph[to];\n      targetNode.ins.push(sourceNode);\n      sourceNode.out.push(targetNode);\n    }\n\n    traverseGraph(Object.values(graph));\n  } catch (e) {\n    invalid = true;\n  }\n\n  const allDepths = Object.keys(graph).map(id => graph[id].depth);\n  const maxDepth = Math.max(...allDepths);\n\n  return {\n    invalid,\n    depths: graph,\n    maxDepth: maxDepth || 1\n  };\n}\n","import { forceRadial as d3ForceRadial } from 'd3-force-3d';\nimport { InternalGraphEdge, InternalGraphNode } from 'types';\nimport { getNodeDepth } from './depthUtils';\n\nconst RADIALS: DagMode[] = ['radialin', 'radialout'];\n\nexport type DagMode =\n  | 'lr'\n  | 'rl'\n  | 'td'\n  | 'but'\n  | 'zout'\n  | 'zin'\n  | 'radialin'\n  | 'radialout';\n\nexport interface ForceRadialInputs {\n  nodes: InternalGraphNode[];\n  edges: InternalGraphEdge[];\n  mode: DagMode;\n  nodeLevelRatio: number;\n}\n\n/**\n * Radial graph layout using D3 Force 3d.\n * Inspired by: https://github.com/vasturiano/three-forcegraph/blob/master/src/forcegraph-kapsule.js#L970-L1018\n */\nexport function forceRadial({\n  nodes,\n  edges,\n  mode = 'lr',\n  nodeLevelRatio = 2\n}: ForceRadialInputs) {\n  const { depths, maxDepth, invalid } = getNodeDepth(nodes, edges);\n\n  if (invalid) {\n    return null;\n  }\n\n  const modeDistance = RADIALS.includes(mode) ? 1 : 5;\n  const dagLevelDistance =\n    (nodes.length / maxDepth) * nodeLevelRatio * modeDistance;\n\n  if (mode) {\n    const getFFn =\n      (fix: boolean, invert: boolean) => (node: InternalGraphNode) =>\n        !fix\n          ? undefined\n          : (depths[node.id].depth - maxDepth / 2) *\n            dagLevelDistance *\n            (invert ? -1 : 1);\n\n    const fxFn = getFFn(['lr', 'rl'].includes(mode), mode === 'rl');\n    const fyFn = getFFn(['td', 'bu'].includes(mode), mode === 'td');\n    const fzFn = getFFn(['zin', 'zout'].includes(mode), mode === 'zout');\n\n    nodes.forEach(node => {\n      node.fx = fxFn(node);\n      node.fy = fyFn(node);\n      node.fz = fzFn(node);\n    });\n  }\n\n  return RADIALS.includes(mode)\n    ? d3ForceRadial(node => {\n      const nodeDepth = depths[node.id];\n      const depth =\n          mode === 'radialin' ? maxDepth - nodeDepth.depth : nodeDepth.depth;\n      return depth * dagLevelDistance;\n    }).strength(1)\n    : null;\n}\n","import Graph from 'graphology';\nimport { LayoutStrategy } from './types';\nimport { InternalGraphEdge, InternalGraphNode } from '../types';\n\n/**\n * Promise based tick helper.\n */\nexport function tick(layout: LayoutStrategy, cb: (stable: boolean) => void) {\n  let stable: boolean | undefined;\n\n  function run() {\n    if (!stable) {\n      stable = layout.step();\n      run();\n    } else {\n      cb(stable);\n    }\n  }\n\n  run();\n}\n\n/**\n * Helper function to turn the graph nodes/edges into an array for\n * easier manipulation.\n */\nexport function buildNodeEdges(graph: Graph) {\n  const nodes: InternalGraphNode[] = [];\n  const edges: InternalGraphEdge[] = [];\n\n  graph.forEachNode((id, n: any) => {\n    nodes.push({\n      ...n,\n      id,\n      // This is for the clustering\n      radius: n.size || 1\n    });\n  });\n\n  graph.forEachEdge((id, l: any) => {\n    edges.push({ ...l, id });\n  });\n\n  return { nodes, edges };\n}\n","import {\n  forceSimulation,\n  forceX,\n  forceY,\n  forceLink,\n  forceManyBody,\n  forceCollide\n} from 'd3-force-3d';\nimport { treemap, hierarchy } from 'd3-hierarchy';\n\n/**\n * Used for calculating clusterings of nodes.\n *\n * Modified version of: https://github.com/john-guerra/forceInABox\n *\n * Changes:\n *  - Improved d3 import for tree shaking\n *  - Fixed node lookup for edges using array\n *  - Updated d3-force to use d3-force-3d\n *  - Removed template logic\n */\nexport function forceInABox() {\n  // d3 style\n  const constant = (_: any) => () => _;\n  const index = (d: any) => d.index;\n\n  // Default values\n  let id = index;\n  let nodes = [];\n  let links = []; // needed for the force version\n  let tree;\n  let size = [100, 100];\n  let forceNodeSize = constant(1); // The expected node size used for computing the cluster node\n  let forceCharge = constant(-1);\n  let forceLinkDistance = constant(100);\n  let forceLinkStrength = constant(0.1);\n  let foci = {};\n  let linkStrengthIntraCluster = 0.1;\n  let linkStrengthInterCluster = 0.001;\n  let templateNodes = [];\n  let offset = [0, 0];\n  let templateForce;\n  let groupBy = d => d.cluster;\n  let template = 'treemap';\n  let enableGrouping = true;\n  let strength = 0.1;\n\n  function force(alpha) {\n    if (!enableGrouping) {\n      return force;\n    }\n\n    if (template === 'force') {\n      // Do the tick of the template force and get the new focis\n      templateForce.tick();\n      getFocisFromTemplate();\n    }\n\n    for (let i = 0, n = nodes.length, node, k = alpha * strength; i < n; ++i) {\n      node = nodes[i];\n      node.vx += (foci[groupBy(node)].x - node.x) * k;\n      node.vy += (foci[groupBy(node)].y - node.y) * k;\n    }\n  }\n\n  function initialize() {\n    if (!nodes) {\n      return;\n    }\n\n    if (template === 'treemap') {\n      initializeWithTreemap();\n    } else {\n      initializeWithForce();\n    }\n  }\n\n  force.initialize = function (_) {\n    nodes = _;\n    initialize();\n  };\n\n  function getLinkKey(l) {\n    let sourceID = groupBy(l.source),\n      targetID = groupBy(l.target);\n\n    return sourceID <= targetID\n      ? sourceID + '~' + targetID\n      : targetID + '~' + sourceID;\n  }\n\n  function computeClustersNodeCounts(nodes) {\n    let clustersCounts = new Map(),\n      tmpCount: any = {};\n\n    nodes.forEach(function (d) {\n      if (!clustersCounts.has(groupBy(d))) {\n        clustersCounts.set(groupBy(d), { count: 0, sumforceNodeSize: 0 });\n      }\n    });\n\n    nodes.forEach(function (d) {\n      tmpCount = clustersCounts.get(groupBy(d));\n      tmpCount.count = tmpCount.count + 1;\n      tmpCount.sumforceNodeSize =\n        tmpCount.sumforceNodeSize +\n        // @ts-ignore\n        Math.PI * (forceNodeSize(d) * forceNodeSize(d)) * 1.3;\n      clustersCounts.set(groupBy(d), tmpCount);\n    });\n\n    return clustersCounts;\n  }\n\n  //Returns\n  function computeClustersLinkCounts(links) {\n    let dClusterLinks = new Map(),\n      clusterLinks = [];\n\n    links.forEach(function (l) {\n      let key = getLinkKey(l),\n        count;\n      if (dClusterLinks.has(key)) {\n        count = dClusterLinks.get(key);\n      } else {\n        count = 0;\n      }\n      count += 1;\n      dClusterLinks.set(key, count);\n    });\n\n    dClusterLinks.forEach(function (value, key) {\n      let source, target;\n      source = key.split('~')[0];\n      target = key.split('~')[1];\n      if (source !== undefined && target !== undefined) {\n        clusterLinks.push({\n          source: source,\n          target: target,\n          count: value\n        });\n      }\n    });\n\n    return clusterLinks;\n  }\n\n  //Returns the metagraph of the clusters\n  function getGroupsGraph() {\n    let gnodes = [];\n    let glinks = [];\n    let dNodes = new Map();\n    let c;\n    let i;\n    let cc;\n    let clustersCounts;\n    let clustersLinks;\n\n    clustersCounts = computeClustersNodeCounts(nodes);\n    clustersLinks = computeClustersLinkCounts(links);\n\n    for (c of clustersCounts.keys()) {\n      cc = clustersCounts.get(c);\n      gnodes.push({\n        id: c,\n        size: cc.count,\n        r: Math.sqrt(cc.sumforceNodeSize / Math.PI)\n      }); // Uses approx meta-node size\n      dNodes.set(c, i);\n    }\n\n    clustersLinks.forEach(function (l) {\n      let source = dNodes.get(l.source),\n        target = dNodes.get(l.target);\n      if (source !== undefined && target !== undefined) {\n        glinks.push({\n          source: source,\n          target: target,\n          count: l.count\n        });\n      }\n    });\n\n    return { nodes: gnodes, links: glinks };\n  }\n\n  function getGroupsTree() {\n    let children = [];\n    let c;\n    let cc;\n    let clustersCounts;\n\n    // @ts-ignore\n    clustersCounts = computeClustersNodeCounts(force.nodes());\n\n    for (c of clustersCounts.keys()) {\n      cc = clustersCounts.get(c);\n      children.push({ id: c, size: cc.count });\n    }\n    return { id: 'clustersTree', children: children };\n  }\n\n  function getFocisFromTemplate() {\n    //compute foci\n    // @ts-ignore\n    foci.none = { x: 0, y: 0 };\n    templateNodes.forEach(function (d) {\n      if (template === 'treemap') {\n        foci[d.data.id] = {\n          x: d.x0 + (d.x1 - d.x0) / 2 - offset[0],\n          y: d.y0 + (d.y1 - d.y0) / 2 - offset[1]\n        };\n      } else {\n        foci[d.id] = {\n          x: d.x - offset[0],\n          y: d.y - offset[1]\n        };\n      }\n    });\n    return foci;\n  }\n\n  function initializeWithTreemap() {\n    // @ts-ignore\n    let sim = treemap().size(force.size());\n\n    tree = hierarchy(getGroupsTree())\n      .sum((d: any) => d.radius)\n      .sort(function (a, b) {\n        return b.height - a.height || b.value - a.value;\n      });\n\n    templateNodes = sim(tree).leaves();\n    getFocisFromTemplate();\n  }\n\n  function checkLinksAsObjects() {\n    // Check if links come in the format of indexes instead of objects\n    let linkCount = 0;\n    if (nodes.length === 0) return;\n\n    links.forEach(function (link) {\n      let source, target;\n      if (!nodes) {\n        return;\n      }\n\n      source = link.source;\n      target = link.target;\n\n      if (typeof link.source !== 'object') {\n        source = nodes.find(n => n.id === link.source);\n      }\n\n      if (typeof link.target !== 'object') {\n        target = nodes.find(n => n.id === link.target);\n      }\n\n      if (source === undefined || target === undefined) {\n        throw Error(\n          'Error setting links, couldnt find nodes for a link (see it on the console)'\n        );\n      }\n      link.source = source;\n      link.target = target;\n      link.index = linkCount++;\n    });\n  }\n\n  function initializeWithForce() {\n    let net;\n\n    if (!nodes || !nodes.length) {\n      return;\n    }\n\n    checkLinksAsObjects();\n\n    net = getGroupsGraph();\n    templateForce = forceSimulation(net.nodes)\n      .force('x', forceX(size[0] / 2).strength(0.1))\n      .force('y', forceY(size[1] / 2).strength(0.1))\n      .force('collide', forceCollide(d => d.r).iterations(4))\n      .force('charge', forceManyBody().strength(forceCharge))\n      .force(\n        'links',\n        forceLink(net.nodes.length ? net.links : [])\n          .distance(forceLinkDistance)\n          .strength(forceLinkStrength)\n      );\n\n    templateNodes = templateForce.nodes();\n\n    getFocisFromTemplate();\n  }\n\n  force.template = function (x) {\n    if (!arguments.length) {\n      return template;\n    }\n\n    template = x;\n    initialize();\n    return force;\n  };\n\n  force.groupBy = function (x) {\n    if (!arguments.length) {\n      return groupBy;\n    }\n\n    if (typeof x === 'string') {\n      groupBy = function (d) {\n        return d[x];\n      };\n\n      return force;\n    }\n\n    groupBy = x;\n\n    return force;\n  };\n\n  force.enableGrouping = function (x) {\n    if (!arguments.length) {\n      return enableGrouping;\n    }\n\n    enableGrouping = x;\n\n    return force;\n  };\n\n  force.strength = function (x) {\n    if (!arguments.length) {\n      return strength;\n    }\n\n    strength = x;\n\n    return force as any;\n  };\n\n  force.getLinkStrength = function (e) {\n    if (enableGrouping) {\n      if (groupBy(e.source) === groupBy(e.target)) {\n        if (typeof linkStrengthIntraCluster === 'function') {\n          // @ts-ignore\n          return linkStrengthIntraCluster(e);\n        } else {\n          return linkStrengthIntraCluster;\n        }\n      } else {\n        if (typeof linkStrengthInterCluster === 'function') {\n          // @ts-ignore\n          return linkStrengthInterCluster(e);\n        } else {\n          return linkStrengthInterCluster;\n        }\n      }\n    } else {\n      // Not grouping return the intracluster\n      if (typeof linkStrengthIntraCluster === 'function') {\n        // @ts-ignore\n        return linkStrengthIntraCluster(e);\n      } else {\n        return linkStrengthIntraCluster;\n      }\n    }\n  };\n\n  force.id = function (_) {\n    return arguments.length ? ((id = _), force) : id;\n  };\n\n  force.size = function (_) {\n    return arguments.length ? ((size = _), force) : size;\n  };\n\n  force.linkStrengthInterCluster = function (_) {\n    return arguments.length\n      ? ((linkStrengthInterCluster = _), force)\n      : linkStrengthInterCluster;\n  };\n\n  force.linkStrengthIntraCluster = function (_) {\n    return arguments.length\n      ? ((linkStrengthIntraCluster = _), force)\n      : linkStrengthIntraCluster;\n  };\n\n  force.nodes = function (_) {\n    return arguments.length ? ((nodes = _), force) : nodes;\n  };\n\n  force.links = function (_) {\n    if (!arguments.length) {\n      return links;\n    }\n\n    if (_ === null) {\n      links = [];\n    } else {\n      links = _;\n    }\n\n    initialize();\n\n    return force;\n  };\n\n  force.template = function (x) {\n    if (!arguments.length) {\n      return template;\n    }\n\n    template = x;\n    initialize();\n    return force;\n  };\n\n  force.forceNodeSize = function (_) {\n    return arguments.length\n      ? ((forceNodeSize = typeof _ === 'function' ? _ : constant(+_)),\n      initialize(),\n      force)\n      : forceNodeSize;\n  };\n\n  // Legacy support\n  force.nodeSize = force.forceNodeSize;\n\n  force.forceCharge = function (_) {\n    return arguments.length\n      ? ((forceCharge = typeof _ === 'function' ? _ : constant(+_)),\n      initialize(),\n      force)\n      : forceCharge;\n  };\n\n  force.forceLinkDistance = function (_) {\n    return arguments.length\n      ? ((forceLinkDistance = typeof _ === 'function' ? _ : constant(+_)),\n      initialize(),\n      force)\n      : forceLinkDistance;\n  };\n\n  force.forceLinkStrength = function (_) {\n    return arguments.length\n      ? ((forceLinkStrength = typeof _ === 'function' ? _ : constant(+_)),\n      initialize(),\n      force)\n      : forceLinkStrength;\n  };\n\n  force.offset = function (_) {\n    return arguments.length\n      ? ((offset = typeof _ === 'function' ? _ : constant(+_)), force)\n      : offset;\n  };\n\n  force.getFocis = getFocisFromTemplate;\n\n  return force;\n}\n","import {\n  forceSimulation as d3ForceSimulation,\n  forceLink as d3ForceLink,\n  forceCollide,\n  forceManyBody as d3ForceManyBody,\n  forceX as d3ForceX,\n  forceY as d3ForceY,\n  forceZ as d3ForceZ\n} from 'd3-force-3d';\nimport { forceRadial, DagMode } from './forceUtils';\nimport { LayoutFactoryProps, LayoutStrategy } from './types';\nimport { buildNodeEdges } from './layoutUtils';\nimport { forceInABox } from './forceInABox';\n\nexport interface ForceDirectedLayoutInputs extends LayoutFactoryProps {\n  /**\n   * Center inertia for the layout. Default: 1.\n   */\n  centerInertia?: number;\n\n  /**\n   * Number of dimensions for the layout. 2d or 3d.\n   */\n  dimensions?: number;\n\n  /**\n   * Mode for the dag layout. Only applicable for dag layouts.\n   */\n  mode?: DagMode;\n\n  /**\n   * Distance between links.\n   */\n  linkDistance?: number;\n\n  /**\n   * Strength of the node repulsion.\n   */\n  nodeStrength?: number;\n\n  /**\n   * Strength of the cluster repulsion.\n   */\n  clusterStrength?: number;\n\n  /**\n   * The type of clustering.\n   */\n  clusterType?: 'force' | 'treemap';\n\n  /**\n   * Ratio of the distance between nodes on the same level.\n   */\n  nodeLevelRatio?: number;\n\n  /**\n   * LinkStrength between nodes of different clusters\n   */\n  linkStrengthInterCluster?: number | ((d: any) => number);\n\n  /**\n   * LinkStrength between nodes of the same cluster\n   */\n  linkStrengthIntraCluster?: number | ((d: any) => number);\n\n  /**\n   * Charge between the meta-nodes (Force template only)\n   */\n  forceLinkDistance?: number;\n\n  /**\n   * Used to compute the template force nodes size (Force template only)\n   */\n  forceLinkStrength?: number;\n\n  /**\n   * Used to compute the template force nodes size (Force template only)\n   */\n  forceCharge?: number;\n}\n\nconst TICK_COUNT = 100;\n\nexport function forceDirected({\n  graph,\n  nodeLevelRatio = 2,\n  mode = null,\n  dimensions = 2,\n  nodeStrength = -250,\n  linkDistance = 50,\n  clusterStrength = 0.5,\n  linkStrengthInterCluster = 0.01,\n  linkStrengthIntraCluster = 0.5,\n  forceLinkDistance = 100,\n  forceLinkStrength = 0.1,\n  clusterType = 'force',\n  forceCharge = -700,\n  getNodePosition,\n  drags,\n  clusterAttribute\n}: ForceDirectedLayoutInputs): LayoutStrategy {\n  const { nodes, edges } = buildNodeEdges(graph);\n\n  // Dynamically adjust node strength based on the number of edges\n  const is2d = dimensions === 2;\n  const nodeStrengthAdjustment =\n    is2d && edges.length > 25 ? nodeStrength * 2 : nodeStrength;\n\n  // Create the simulation\n  const sim = d3ForceSimulation()\n    .force('link', d3ForceLink())\n    .force('charge', d3ForceManyBody().strength(nodeStrengthAdjustment))\n    .force('x', d3ForceX(1200 / 2).strength(0.05))\n    .force('y', d3ForceY(1200 / 2).strength(0.05))\n    .force('z', d3ForceZ())\n    // Handles nodes not overlapping each other ( most relevant in clustering )\n    .force(\n      'collide',\n      forceCollide(d => d.radius)\n    )\n    .force(\n      'dagRadial',\n      forceRadial({\n        nodes,\n        edges,\n        mode,\n        nodeLevelRatio\n      })\n    )\n    .stop();\n\n  let groupingForce;\n\n  if (clusterAttribute) {\n    groupingForce = forceInABox()\n      // Strength to foci\n      .strength(clusterStrength)\n      // Either treemap or force\n      .template(clusterType)\n      // Node attribute to group\n      .groupBy(d => d.data[clusterAttribute])\n      // The graph links. Must be called after setting the grouping attribute\n      .links(edges)\n      // Size of the chart\n      .size([100, 100])\n      // linkStrength between nodes of different clusters\n      .linkStrengthInterCluster(linkStrengthInterCluster)\n      // linkStrength between nodes of the same cluster\n      .linkStrengthIntraCluster(linkStrengthIntraCluster)\n      // linkDistance between meta-nodes on the template (Force template only)\n      .forceLinkDistance(forceLinkDistance)\n      // linkStrength between meta-nodes of the template (Force template only)\n      .forceLinkStrength(forceLinkStrength)\n      // Charge between the meta-nodes (Force template only)\n      .forceCharge(forceCharge)\n      // Used to compute the template force nodes size (Force template only)\n      .forceNodeSize(d => d.radius);\n  }\n\n  // Initialize the simulation\n  let layout = sim.numDimensions(dimensions).nodes(nodes);\n\n  if (groupingForce) {\n    layout = layout.force('group', groupingForce);\n  }\n\n  // Run the force on the links\n  if (linkDistance) {\n    let linkForce = layout.force('link');\n    if (linkForce) {\n      linkForce\n        .id(d => d.id)\n        .links(edges)\n        // When no mode passed, its a tree layout\n        // so let's use a larger distance\n        .distance(linkDistance);\n\n      if (groupingForce) {\n        linkForce = linkForce.strength(groupingForce?.getLinkStrength ?? 0.1);\n      }\n    }\n  }\n\n  const nodeMap = new Map(nodes.map(n => [n.id, n]));\n\n  return {\n    step() {\n      // Run the ticker 100 times so\n      // we don't overdo the animation\n      sim.tick(TICK_COUNT);\n      return true;\n    },\n    getNodePosition(id: string) {\n      if (getNodePosition) {\n        const pos = getNodePosition(id, { graph, drags, nodes, edges });\n        if (pos) {\n          return pos;\n        }\n      }\n\n      if (drags?.[id]?.position) {\n        // If we dragged, we need to use that position\n        return drags?.[id]?.position as any;\n      }\n\n      return nodeMap.get(id);\n    }\n  };\n}\n","import circular from 'graphology-layout/circular.js';\nimport { LayoutFactoryProps } from './types';\nimport { buildNodeEdges } from './layoutUtils';\n\nexport interface CircularLayoutInputs extends LayoutFactoryProps {\n  /**\n   * Radius of the circle.\n   */\n  radius: 300;\n}\n\nexport function circular2d({\n  graph,\n  radius,\n  drags,\n  getNodePosition\n}: CircularLayoutInputs) {\n  const layout = circular(graph, {\n    scale: radius\n  });\n\n  const { nodes, edges } = buildNodeEdges(graph);\n\n  return {\n    step() {\n      return true;\n    },\n    getNodePosition(id: string) {\n      if (getNodePosition) {\n        const pos = getNodePosition(id, { graph, drags, nodes, edges });\n        if (pos) {\n          return pos;\n        }\n      }\n\n      if (drags?.[id]?.position) {\n        // If we dragged, we need to use that position\n        return drags?.[id]?.position as any;\n      }\n\n      return layout?.[id];\n    }\n  };\n}\n","import { InternalGraphEdge, InternalGraphNode } from 'types';\nimport { DepthNode, getNodeDepth } from './depthUtils';\nimport { LayoutFactoryProps, LayoutStrategy } from './types';\nimport { hierarchy, stratify, tree } from 'd3-hierarchy';\nimport { buildNodeEdges } from './layoutUtils';\n\nexport interface HierarchicalLayoutInputs extends LayoutFactoryProps {\n  /**\n   * Direction of the layout. Default 'td'.\n   */\n  mode?: 'td' | 'lr';\n  /**\n   * Factor of distance between nodes. Default 1.\n   */\n  nodeSeparation?: number;\n  /**\n   * Size of each node. Default [50,50]\n   */\n  nodeSize?: [number, number];\n}\n\nconst DIRECTION_MAP = {\n  td: {\n    x: 'x',\n    y: 'y',\n    factor: -1\n  },\n  lr: {\n    x: 'y',\n    y: 'x',\n    factor: 1\n  }\n};\n\nexport function hierarchical({\n  graph,\n  drags,\n  mode = 'td',\n  nodeSeparation = 1,\n  nodeSize = [50, 50],\n  getNodePosition\n}: HierarchicalLayoutInputs): LayoutStrategy {\n  const { nodes, edges } = buildNodeEdges(graph);\n\n  const { depths } = getNodeDepth(nodes, edges);\n  const rootNodes = Object.keys(depths).map(d => depths[d]);\n\n  const root = stratify<DepthNode>()\n    .id(d => d.data.id)\n    .parentId(d => d.ins?.[0]?.data?.id)(rootNodes);\n\n  const treeRoot = tree()\n    .separation(() => nodeSeparation)\n    .nodeSize(nodeSize)(hierarchy(root));\n\n  const treeNodes = treeRoot.descendants();\n  const path = DIRECTION_MAP[mode];\n\n  const mappedNodes = new Map<string, InternalGraphNode>(\n    nodes.map(n => {\n      const { x, y } = treeNodes.find((t: any) => t.data.id === n.id);\n      return [\n        n.id,\n        {\n          ...n,\n          [path.x]: x * path.factor,\n          [path.y]: y * path.factor,\n          z: 0\n        }\n      ];\n    })\n  );\n\n  return {\n    step() {\n      return true;\n    },\n    getNodePosition(id: string) {\n      if (getNodePosition) {\n        const pos = getNodePosition(id, { graph, drags, nodes, edges });\n        if (pos) {\n          return pos;\n        }\n      }\n\n      if (drags?.[id]?.position) {\n        // If we dragged, we need to use that position\n        return drags?.[id]?.position as any;\n      }\n\n      return mappedNodes.get(id);\n    }\n  };\n}\n","import noverlapLayout from 'graphology-layout-noverlap';\nimport { LayoutFactoryProps } from './types';\nimport { buildNodeEdges } from './layoutUtils';\n\nexport interface NoOverlapLayoutInputs extends LayoutFactoryProps {\n  /**\n   * Grid size. Default 20.\n   */\n  gridSize?: number;\n\n  /**\n   * Ratio of the layout. Default 10.\n   */\n  ratio?: number;\n\n  /**\n   * Maximum number of iterations. Default 50.\n   */\n  maxIterations?: number;\n\n  /**\n   * Margin between nodes. Default 10.\n   */\n  margin?: number;\n}\n\nexport function nooverlap({\n  graph,\n  margin,\n  drags,\n  getNodePosition,\n  ratio,\n  gridSize,\n  maxIterations\n}: NoOverlapLayoutInputs) {\n  const { nodes, edges } = buildNodeEdges(graph);\n\n  const layout = noverlapLayout(graph, {\n    maxIterations,\n    inputReducer: (_key, attr) => ({\n      ...attr,\n      // Have to specify defaults for the engine\n      x: attr.x || 0,\n      y: attr.y || 0\n    }),\n    settings: {\n      ratio,\n      margin,\n      gridSize\n    }\n  });\n\n  return {\n    step() {\n      return true;\n    },\n    getNodePosition(id: string) {\n      if (getNodePosition) {\n        const pos = getNodePosition(id, { graph, drags, nodes, edges });\n        if (pos) {\n          return pos;\n        }\n      }\n\n      if (drags?.[id]?.position) {\n        // If we dragged, we need to use that position\n        return drags?.[id]?.position as any;\n      }\n\n      return layout?.[id];\n    }\n  };\n}\n","import forceAtlas2Layout from 'graphology-layout-forceatlas2';\nimport { LayoutFactoryProps } from './types';\nimport random from 'graphology-layout/random.js';\n\nexport interface ForceAtlas2LayoutInputs extends LayoutFactoryProps {\n  /**\n   * Should the node’s sizes be taken into account. Default: false.\n   */\n  adjustSizes?: boolean;\n\n  /**\n   * whether to use the Barnes-Hut approximation to compute\n   * repulsion in O(n*log(n)) rather than default O(n^2),\n   * n being the number of nodes. Default: false.\n   */\n  barnesHutOptimize?: boolean;\n\n  /**\n   * Barnes-Hut approximation theta parameter. Default: 0.5.\n   */\n  barnesHutTheta?: number;\n\n  /**\n   * Influence of the edge’s weights on the layout. To consider edge weight, don’t\n   *  forget to pass weighted as true. Default: 1.\n   */\n  edgeWeightInfluence?: number;\n\n  /**\n   * Strength of the layout’s gravity. Default: 10.\n   */\n  gravity?: number;\n\n  /**\n   * Whether to use Noack’s LinLog model. Default: false.\n   */\n  linLogMode?: boolean;\n\n  /**\n   * Whether to consider edge weights when calculating repulsion. Default: false.\n   */\n  outboundAttractionDistribution?: boolean;\n\n  /**\n   * Scaling ratio for repulsion. Default: 100.\n   */\n  scalingRatio?: number;\n\n  /**\n   * Speed of the slowdown. Default: 1.\n   */\n  slowDown?: number;\n\n  /**\n   * Whether to use the strong gravity mode. Default: false.\n   */\n  strongGravityMode?: boolean;\n\n  /**\n   * Number of iterations to perform. Default: 50.\n   */\n  iterations?: number;\n}\n\nexport function forceAtlas2({\n  graph,\n  drags,\n  iterations,\n  ...rest\n}: ForceAtlas2LayoutInputs) {\n  // Note: We need to assign a random position to each node\n  // in order for the force atlas to work.\n  // Reference: https://graphology.github.io/standard-library/layout-forceatlas2.html#pre-requisites\n  random.assign(graph);\n\n  const layout = forceAtlas2Layout(graph, {\n    iterations,\n    settings: rest\n  });\n\n  return {\n    step() {\n      return true;\n    },\n    getNodePosition(id: string) {\n      // If we dragged, we need to use that position\n      return (drags?.[id]?.position as any) || layout?.[id];\n    }\n  };\n}\n","import { LayoutFactoryProps } from './types';\nimport { buildNodeEdges } from './layoutUtils';\n\nexport function custom({ graph, drags, getNodePosition }: LayoutFactoryProps) {\n  const { nodes, edges } = buildNodeEdges(graph);\n\n  return {\n    step() {\n      return true;\n    },\n    getNodePosition(id: string) {\n      return getNodePosition(id, { graph, drags, nodes, edges });\n    }\n  };\n}\n","import { LayoutFactoryProps, LayoutStrategy } from './types';\nimport { forceDirected, ForceDirectedLayoutInputs } from './forceDirected';\nimport { circular2d, CircularLayoutInputs } from './circular2d';\nimport { hierarchical, HierarchicalLayoutInputs } from './hierarchical';\nimport { NoOverlapLayoutInputs, nooverlap } from './nooverlap';\nimport { ForceAtlas2LayoutInputs, forceAtlas2 } from './forceatlas2';\nimport { custom } from './custom';\n\nexport type LayoutOverrides = Partial<\n  | Omit<ForceDirectedLayoutInputs, 'dimensions' | 'mode'>\n  | CircularLayoutInputs\n  | HierarchicalLayoutInputs\n>;\n\nconst FORCE_LAYOUTS = [\n  'forceDirected2d',\n  'treeTd2d',\n  'treeLr2d',\n  'radialOut2d',\n  'treeTd3d',\n  'treeLr3d',\n  'radialOut3d',\n  'forceDirected3d'\n];\n\nexport function layoutProvider({\n  type,\n  ...rest\n}: LayoutFactoryProps | LayoutOverrides): LayoutStrategy {\n  if (FORCE_LAYOUTS.includes(type)) {\n    const { nodeStrength, linkDistance, nodeLevelRatio } =\n      rest as ForceDirectedLayoutInputs;\n\n    if (type === 'forceDirected2d') {\n      return forceDirected({\n        ...rest,\n        dimensions: 2,\n        nodeLevelRatio: nodeLevelRatio || 2,\n        nodeStrength: nodeStrength || -250,\n        linkDistance\n      } as ForceDirectedLayoutInputs);\n    } else if (type === 'treeTd2d') {\n      return forceDirected({\n        ...rest,\n        mode: 'td',\n        dimensions: 2,\n        nodeLevelRatio: nodeLevelRatio || 5,\n        nodeStrength: nodeStrength || -250,\n        linkDistance: linkDistance || 50\n      } as ForceDirectedLayoutInputs);\n    } else if (type === 'treeLr2d') {\n      return forceDirected({\n        ...rest,\n        mode: 'lr',\n        dimensions: 2,\n        nodeLevelRatio: nodeLevelRatio || 5,\n        nodeStrength: nodeStrength || -250,\n        linkDistance: linkDistance || 50\n      } as ForceDirectedLayoutInputs);\n    } else if (type === 'radialOut2d') {\n      return forceDirected({\n        ...rest,\n        mode: 'radialout',\n        dimensions: 2,\n        nodeLevelRatio: nodeLevelRatio || 5,\n        nodeStrength: nodeStrength || -500,\n        linkDistance: linkDistance || 100\n      } as ForceDirectedLayoutInputs);\n    } else if (type === 'treeTd3d') {\n      return forceDirected({\n        ...rest,\n        mode: 'td',\n        dimensions: 3,\n        nodeLevelRatio: nodeLevelRatio || 2,\n        nodeStrength: nodeStrength || -500,\n        linkDistance: linkDistance || 50\n      } as ForceDirectedLayoutInputs);\n    } else if (type === 'treeLr3d') {\n      return forceDirected({\n        ...rest,\n        mode: 'lr',\n        dimensions: 3,\n        nodeLevelRatio: nodeLevelRatio || 2,\n        nodeStrength: nodeStrength || -500,\n        linkDistance: linkDistance || 50\n      } as ForceDirectedLayoutInputs);\n    } else if (type === 'radialOut3d') {\n      return forceDirected({\n        ...rest,\n        mode: 'radialout',\n        dimensions: 3,\n        nodeLevelRatio: nodeLevelRatio || 2,\n        nodeStrength: nodeStrength || -500,\n        linkDistance: linkDistance || 100\n      } as ForceDirectedLayoutInputs);\n    } else if (type === 'forceDirected3d') {\n      return forceDirected({\n        ...rest,\n        dimensions: 3,\n        nodeLevelRatio: nodeLevelRatio || 2,\n        nodeStrength: nodeStrength || -250,\n        linkDistance\n      } as ForceDirectedLayoutInputs);\n    }\n  } else if (type === 'circular2d') {\n    const { radius } = rest as CircularLayoutInputs;\n    return circular2d({\n      ...rest,\n      radius: radius || 300\n    } as CircularLayoutInputs);\n  } else if (type === 'hierarchicalTd') {\n    return hierarchical({ ...rest, mode: 'td' } as HierarchicalLayoutInputs);\n  } else if (type === 'hierarchicalLr') {\n    return hierarchical({ ...rest, mode: 'lr' } as HierarchicalLayoutInputs);\n  } else if (type === 'nooverlap') {\n    const { graph, maxIterations, ratio, margin, gridSize, ...settings } =\n      rest as NoOverlapLayoutInputs;\n\n    return nooverlap({\n      type: 'nooverlap',\n      graph,\n      margin: margin || 10,\n      maxIterations: maxIterations || 50,\n      ratio: ratio || 10,\n      gridSize: gridSize || 20,\n      ...settings\n    });\n  } else if (type === 'forceatlas2') {\n    const { graph, iterations, gravity, scalingRatio, ...settings } =\n      rest as ForceAtlas2LayoutInputs;\n\n    return forceAtlas2({\n      type: 'forceatlas2',\n      graph,\n      ...settings,\n      scalingRatio: scalingRatio || 100,\n      gravity: gravity || 10,\n      iterations: iterations || 50\n    });\n  } else if (type === 'custom') {\n    return custom({\n      type: 'custom',\n      ...rest\n    } as LayoutFactoryProps);\n  }\n\n  throw new Error(`Layout ${type} not found.`);\n}\n","import { GraphEdge, GraphNode } from '../types';\nimport { getNodeDepth } from './depthUtils';\nimport { LayoutTypes } from './types';\n\n/**\n * Given a set of nodes and edges, determine the type of layout that\n * is most ideal. This is very beta.\n */\nexport function recommendLayout(\n  nodes: GraphNode[],\n  edges: GraphEdge[]\n): LayoutTypes {\n  const { invalid } = getNodeDepth(nodes as any[], edges as any[]);\n  const nodeCount = nodes.length;\n\n  if (!invalid) {\n    // Large tree layouts\n    if (nodeCount > 100) {\n      return 'radialOut2d';\n    } else {\n      // Smaller tree layouts\n      return 'treeTd2d';\n    }\n  }\n\n  // Circular layouts\n  return 'forceDirected2d';\n}\n","import pagerank from 'graphology-metrics/centrality/pagerank.js';\nimport { SizingStrategy, SizingStrategyInputs } from './types';\n\nexport function pageRankSizing({\n  graph\n}: SizingStrategyInputs): SizingStrategy {\n  const ranks = pagerank(graph);\n\n  return {\n    ranks,\n    getSizeForNode: (nodeID: string) => ranks[nodeID] * 80\n  };\n}\n","import { SizingStrategy, SizingStrategyInputs } from './types';\nimport { degreeCentrality } from 'graphology-metrics/centrality/degree.js';\n\nexport function centralitySizing({\n  graph\n}: SizingStrategyInputs): SizingStrategy {\n  const ranks = degreeCentrality(graph);\n\n  return {\n    ranks,\n    getSizeForNode: (nodeID: string) => ranks[nodeID] * 20\n  };\n}\n","import { SizingStrategy, SizingStrategyInputs } from './types';\n\nexport function attributeSizing({\n  graph,\n  attribute,\n  defaultSize\n}: SizingStrategyInputs): SizingStrategy {\n  const map = new Map();\n\n  if (attribute) {\n    graph.forEachNode((id, node) => {\n      const size = node.data?.[attribute];\n      if (isNaN(size)) {\n        console.warn(`Attribute ${size} is not a number for node ${node.id}`);\n      }\n\n      map.set(id, size || 0);\n    });\n  } else {\n    console.warn('Attribute sizing configured but no attribute provided');\n  }\n\n  return {\n    getSizeForNode: (nodeId: string) => {\n      if (!attribute || !map) {\n        return defaultSize;\n      }\n\n      return map.get(nodeId);\n    }\n  };\n}\n","import { pageRankSizing } from './pageRank';\nimport { centralitySizing } from './centrality';\nimport { attributeSizing } from './attribute';\nimport { SizingStrategyInputs } from './types';\nimport { scaleLinear } from 'd3-scale';\n\nexport type SizingType =\n  | 'none'\n  | 'pagerank'\n  | 'centrality'\n  | 'attribute'\n  | 'default';\n\nexport interface NodeSizeProviderInputs extends SizingStrategyInputs {\n  /**\n   * The sizing strategy to use.\n   */\n  type: SizingType;\n}\n\nconst providers = {\n  pagerank: pageRankSizing,\n  centrality: centralitySizing,\n  attribute: attributeSizing,\n  none: ({ defaultSize }: SizingStrategyInputs) => ({\n    getSizeForNode: (_id: string) => defaultSize\n  })\n};\n\nexport function nodeSizeProvider({ type, ...rest }: NodeSizeProviderInputs) {\n  const provider = providers[type]?.(rest);\n  if (!provider && type !== 'default') {\n    throw new Error(`Unknown sizing strategy: ${type}`);\n  }\n\n  const { graph, minSize, maxSize } = rest;\n  const sizes = new Map();\n  let min;\n  let max;\n\n  graph.forEachNode((id, node) => {\n    let size;\n    if (type === 'default') {\n      size = node.size || rest.defaultSize;\n    } else {\n      size = provider.getSizeForNode(id);\n    }\n\n    if (min === undefined || size < min) {\n      min = size;\n    }\n\n    if (max === undefined || size > max) {\n      max = size;\n    }\n\n    sizes.set(id, size);\n  });\n\n  // Relatively scale the sizes\n  if (type !== 'none') {\n    const scale = scaleLinear()\n      .domain([min, max])\n      .rangeRound([minSize, maxSize]);\n\n    for (const [nodeId, size] of sizes) {\n      sizes.set(nodeId, scale(size));\n    }\n  }\n\n  return sizes;\n}\n","import { EdgeLabelPosition } from '../symbols';\n\nconst NODE_THRESHOLD = 20;\n\nexport type LabelVisibilityType = 'all' | 'auto' | 'none' | 'nodes' | 'edges';\n\nexport function calcLabelVisibility(\n  nodeCount: number,\n  type: LabelVisibilityType\n) {\n  return (shape: 'node' | 'edge', size: number) => {\n    if (type === 'all') {\n      return true;\n    } else if (type === 'nodes' && shape === 'node') {\n      return true;\n    } else if (type === 'edges' && shape === 'edge') {\n      return true;\n    } else if (type === 'auto' && shape === 'node') {\n      if (nodeCount <= NODE_THRESHOLD) {\n        return true;\n      } else {\n        return size > 7;\n      }\n    }\n\n    return false;\n  };\n}\n\nexport function getLabelOffsetByType(\n  offset: number,\n  position: EdgeLabelPosition\n): number {\n  switch (position) {\n  case 'above':\n    return offset;\n  case 'below':\n    return -offset;\n  case 'inline':\n  case 'natural':\n  default:\n    return 0;\n  }\n}\n","import Graph from 'graphology';\nimport { nodeSizeProvider, SizingType } from '../sizing';\nimport {\n  GraphEdge,\n  GraphNode,\n  InternalGraphEdge,\n  InternalGraphNode\n} from '../types';\nimport { calcLabelVisibility, LabelVisibilityType } from './visibility';\nimport { LayoutStrategy } from '../layout';\n\n/**\n * Initialize the graph with the nodes/edges.\n */\nexport function buildGraph(\n  graph: Graph,\n  nodes: GraphNode[],\n  edges: GraphEdge[]\n) {\n  // TODO: We probably want to make this\n  // smarter and only add/remove nodes\n  graph.clear();\n\n  for (const node of nodes) {\n    try {\n      graph.addNode(node.id, node);\n    } catch ({ message }) {\n      console.error(`[Graph] ${message}`);\n    }\n  }\n\n  for (const edge of edges) {\n    try {\n      graph.addEdge(edge.source, edge.target, edge);\n    } catch ({ message }) {\n      console.error(`[Graph] ${message}`);\n    }\n  }\n\n  return graph;\n}\n\ninterface TransformGraphInput {\n  graph: Graph;\n  layout: LayoutStrategy;\n  sizingType?: SizingType;\n  labelType?: LabelVisibilityType;\n  sizingAttribute?: string;\n  minNodeSize?: number;\n  maxNodeSize?: number;\n  defaultNodeSize?: number;\n}\n\n/**\n * Transform the graph into a format that is easier to work with.\n */\nexport function transformGraph({\n  graph,\n  layout,\n  sizingType,\n  labelType,\n  sizingAttribute,\n  defaultNodeSize,\n  minNodeSize,\n  maxNodeSize\n}: TransformGraphInput) {\n  const nodes: InternalGraphNode[] = [];\n  const edges: InternalGraphEdge[] = [];\n  const map = new Map<string, InternalGraphNode>();\n\n  const sizes = nodeSizeProvider({\n    graph,\n    type: sizingType,\n    attribute: sizingAttribute,\n    minSize: minNodeSize,\n    maxSize: maxNodeSize,\n    defaultSize: defaultNodeSize\n  });\n\n  const nodeCount = graph.nodes.length;\n  const checkVisibility = calcLabelVisibility(nodeCount, labelType);\n\n  graph.forEachNode((id, node) => {\n    const position = layout.getNodePosition(id);\n    const { data, fill, icon, label, size, ...rest } = node;\n    const nodeSize = sizes.get(node.id);\n    const labelVisible = checkVisibility('node', nodeSize);\n\n    const nodeLinks = graph.inboundNeighbors(node.id) || [];\n    const parents = nodeLinks.map(n => graph.getNodeAttributes(n));\n\n    const n: InternalGraphNode = {\n      ...(node as any),\n      size: nodeSize,\n      labelVisible,\n      label,\n      icon,\n      fill,\n      parents,\n      data: {\n        ...rest,\n        ...(data ?? {})\n      },\n      position: {\n        ...position,\n        x: position.x || 0,\n        y: position.y || 0,\n        z: position.z || 1\n      }\n    };\n\n    map.set(node.id, n);\n    nodes.push(n);\n  });\n\n  graph.forEachEdge((_id, link) => {\n    const from = map.get(link.source);\n    const to = map.get(link.target);\n\n    if (from && to) {\n      const { data, id, label, size, ...rest } = link;\n      const labelVisible = checkVisibility('edge', size);\n\n      // TODO: Fix type\n      edges.push({\n        ...link,\n        id,\n        label,\n        labelVisible,\n        size,\n        data: {\n          ...rest,\n          id,\n          ...(data || {})\n        }\n      } as any);\n    }\n  });\n\n  return {\n    nodes,\n    edges\n  };\n}\n","export const animationConfig = {\n  mass: 10,\n  tension: 1000,\n  friction: 300,\n  // Decreasing precision to improve performance from 0.00001\n  precision: 0.1\n};\n","import { Curve, Vector3 } from 'three';\n\nimport { EdgeArrowPosition } from '../symbols/Arrow';\n\n// Calculate the correct position for an arrow along a curve,\n// as well as the tangent to the curve at that point.\nexport function getArrowVectors(\n  placement: EdgeArrowPosition,\n  curve: Curve<Vector3>,\n  arrowLength: number\n): [Vector3, Vector3] {\n  const curveLength = curve.getLength();\n  const absSize = placement === 'end' ? curveLength : curveLength / 2;\n  const offset = placement === 'end' ? arrowLength / 2 : 0;\n  const u = (absSize - offset) / curveLength;\n\n  const position = curve.getPointAt(u);\n  const rotation = curve.getTangentAt(u);\n\n  return [position, rotation];\n}\n\nexport function getArrowSize(size: number): [number, number] {\n  return [size + 6, 2 + size / 1.5];\n}\n","import { Curve, LineCurve3, QuadraticBezierCurve3, Vector3 } from 'three';\nimport { InternalGraphNode, InternalVector3 } from '../types';\n\nconst MULTI_EDGE_OFFSET_FACTOR = 0.7;\n\n/**\n * Get the midpoint given two points.\n */\nexport function getMidPoint(\n  from: InternalVector3,\n  to: InternalVector3,\n  offset = 0\n) {\n  const fromVector = new Vector3(from.x, from.y || 0, from.z || 0);\n  const toVector = new Vector3(to.x, to.y || 0, to.z || 0);\n  const midVector = new Vector3()\n    .addVectors(fromVector, toVector)\n    .divideScalar(2);\n\n  return midVector.setLength(midVector.length() + offset);\n}\n\n/**\n * Calculate the center for a quadratic bezier curve.\n *\n * 1) Find the point halfway between the start and end points of the desired curve\n * 2) Find the vector pependicular to that point\n * 3) Find the point 1/4 the distance between start and end along that vector.\n */\nexport function getCurvePoints(\n  from: Vector3,\n  to: Vector3,\n  offset = -1\n): [Vector3, Vector3, Vector3] {\n  const fromVector = from.clone();\n  const toVector = to.clone();\n  const v = new Vector3().subVectors(toVector, fromVector);\n  const vlen = v.length();\n  const vn = v.clone().normalize();\n  const vv = new Vector3().subVectors(toVector, fromVector).divideScalar(2);\n  const k = Math.abs(vn.x) % 1;\n  const b = new Vector3(-vn.y, vn.x - k * vn.z, k * vn.y).normalize();\n  const vm = new Vector3()\n    .add(fromVector)\n    .add(vv)\n    .add(b.multiplyScalar(vlen / 4).multiplyScalar(offset));\n\n  return [from, vm, to];\n}\n\n/**\n * Get the curve given two points.\n */\nexport function getCurve(\n  from: Vector3,\n  fromOffset: number,\n  to: Vector3,\n  toOffset: number,\n  curved: boolean,\n  curveOffset?: number\n): Curve<Vector3> {\n  const offsetFrom = getPointBetween(from, to, fromOffset);\n  const offsetTo = getPointBetween(to, from, toOffset);\n  return curved\n    ? new QuadraticBezierCurve3(\n      ...getCurvePoints(offsetFrom, offsetTo, curveOffset)\n    )\n    : new LineCurve3(offsetFrom, offsetTo);\n}\n\n/**\n * Create a threejs vector for a node.\n */\nexport function getVector(node: InternalGraphNode): Vector3 {\n  return new Vector3(node.position.x, node.position.y, node.position.z || 0);\n}\n\n/**\n * Get the point between two vectors.\n */\nfunction getPointBetween(from: Vector3, to: Vector3, offset: number): Vector3 {\n  const distance = from.distanceTo(to);\n  return from.clone().add(\n    to\n      .clone()\n      .sub(from)\n      .multiplyScalar(offset / distance)\n  );\n}\n\n/**\n * Given a node and a new vector set, update the node model.\n */\nexport function updateNodePosition(node: InternalGraphNode, offset: Vector3) {\n  return {\n    ...node,\n    position: {\n      ...node.position,\n      x: node.position.x + offset.x,\n      y: node.position.y + offset.y,\n      z: node.position.z + offset.z\n    }\n  };\n}\n\n/**\n * Calculate the curve offset for an edge.\n * This is used to offset edges that are parallel to each other (same source and same target).\n * This will return a curveOffset of null if the edge is not parallel to any other edges.\n */\nexport function calculateEdgeCurveOffset({ edge, edges, curved }) {\n  let updatedCurved = curved;\n  let curveOffset: number;\n\n  const parallelEdges = edges\n    .filter(e => e.target === edge.target && e.source === edge.source)\n    .map(e => e.id);\n\n  if (parallelEdges.length > 1) {\n    updatedCurved = true;\n    const edgeIndex = parallelEdges.indexOf(edge.id);\n\n    if (parallelEdges.length === 2) {\n      curveOffset =\n        edgeIndex === 0 ? MULTI_EDGE_OFFSET_FACTOR : -MULTI_EDGE_OFFSET_FACTOR;\n    } else {\n      curveOffset =\n        (edgeIndex - Math.floor(parallelEdges.length / 2)) *\n        MULTI_EDGE_OFFSET_FACTOR;\n    }\n  }\n\n  return { curved: updatedCurved, curveOffset };\n}\n","import { InternalGraphNode } from '../types';\n\nexport interface CenterPositionVector {\n  x: number;\n  y: number;\n  z: number;\n  minX: number;\n  maxX: number;\n  minY: number;\n  maxY: number;\n  minZ: number;\n  maxZ: number;\n  height: number;\n  width: number;\n}\n\n/**\n * Given a collection of nodes, get the center point.\n */\nexport function getLayoutCenter(\n  nodes: InternalGraphNode[]\n): CenterPositionVector {\n  let minX = Number.POSITIVE_INFINITY;\n  let maxX = Number.NEGATIVE_INFINITY;\n  let minY = Number.POSITIVE_INFINITY;\n  let maxY = Number.NEGATIVE_INFINITY;\n  let minZ = Number.POSITIVE_INFINITY;\n  let maxZ = Number.NEGATIVE_INFINITY;\n\n  for (let node of nodes) {\n    minX = Math.min(minX, node.position.x);\n    maxX = Math.max(maxX, node.position.x);\n    minY = Math.min(minY, node.position.y);\n    maxY = Math.max(maxY, node.position.y);\n    minZ = Math.min(minZ, node.position.z);\n    maxZ = Math.max(maxZ, node.position.z);\n  }\n\n  return {\n    height: maxY - minY,\n    width: maxX - minX,\n    minX,\n    maxX,\n    minY,\n    maxY,\n    minZ,\n    maxZ,\n    x: (maxX + minX) / 2,\n    y: (maxY + minY) / 2,\n    z: (maxZ + minZ) / 2\n  };\n}\n","import { InternalGraphNode } from '../types';\nimport { CenterPositionVector, getLayoutCenter } from './layout';\n\n/**\n * Given nodes and a attribute, find all the cluster groups.\n */\nexport function buildClusterGroups(\n  nodes: InternalGraphNode[],\n  clusterAttribute?: string\n) {\n  if (!clusterAttribute) {\n    return new Map();\n  }\n\n  return nodes.reduce((entryMap, e) => {\n    const val = e.data[clusterAttribute];\n    if (val) {\n      entryMap.set(val, [...(entryMap.get(val) || []), e]);\n    }\n    return entryMap;\n  }, new Map());\n}\n\nexport interface CalculateClustersInput {\n  nodes: InternalGraphNode[];\n  clusterAttribute?: string;\n}\n\nexport interface ClusterGroup {\n  nodes: InternalGraphNode[];\n  position: CenterPositionVector;\n  label: string;\n}\n\n/**\n * Builds the cluster map.\n */\nexport function calculateClusters({\n  nodes,\n  clusterAttribute\n}: CalculateClustersInput) {\n  const result = new Map<string, ClusterGroup>();\n\n  if (clusterAttribute) {\n    const groups = buildClusterGroups(nodes, clusterAttribute);\n    for (const [key, nodes] of groups) {\n      const position = getLayoutCenter(nodes);\n      result.set(key, {\n        label: key,\n        nodes,\n        position\n      });\n    }\n  }\n\n  return result;\n}\n","import { useCallback, useRef } from 'react';\nimport { ThreeEvent } from '@react-three/fiber';\n\nexport interface HoverIntentOptions {\n  interval?: number;\n  sensitivity?: number;\n  timeout?: number;\n  disabled?: boolean;\n  onPointerOver: (event: ThreeEvent<PointerEvent>) => void;\n  onPointerOut: (event: ThreeEvent<PointerEvent>) => void;\n}\n\nexport interface HoverIntentResult {\n  pointerOut: (event: ThreeEvent<PointerEvent>) => void;\n  pointerOver: (event: ThreeEvent<PointerEvent>) => void;\n}\n\n/**\n * Hover intent identifies if the user actually is\n * intending to over by measuring the position of the mouse\n * once a pointer enters and determining if in a duration if\n * the mouse moved inside a certain threshold and fires the events.\n */\nexport const useHoverIntent = ({\n  sensitivity = 7,\n  interval = 50,\n  timeout = 0,\n  disabled,\n  onPointerOver,\n  onPointerOut\n}: HoverIntentOptions | undefined): HoverIntentResult => {\n  const mouseOver = useRef<boolean>(false);\n  const timer = useRef<any | null>(null);\n  const state = useRef<number>(0);\n  const coords = useRef({\n    x: null,\n    y: null,\n    px: null,\n    py: null\n  });\n\n  const onMouseMove = useCallback((event: MouseEvent) => {\n    coords.current.x = event.clientX;\n    coords.current.y = event.clientY;\n  }, []);\n\n  const comparePosition = useCallback(\n    (event: ThreeEvent<PointerEvent>) => {\n      timer.current = clearTimeout(timer.current);\n      const { px, x, py, y } = coords.current;\n\n      if (Math.abs(px - x) + Math.abs(py - y) < sensitivity) {\n        state.current = 1;\n        onPointerOver(event);\n      } else {\n        coords.current.px = x;\n        coords.current.py = y;\n        timer.current = setTimeout(() => comparePosition(event), interval);\n      }\n    },\n    [interval, onPointerOver, sensitivity]\n  );\n\n  const cleanup = useCallback(() => {\n    clearTimeout(timer.current);\n    document.removeEventListener('mousemove', onMouseMove, false);\n  }, [onMouseMove]);\n\n  const pointerOver = useCallback(\n    (event: ThreeEvent<PointerEvent>) => {\n      if (!disabled) {\n        mouseOver.current = true;\n        cleanup();\n\n        if (state.current !== 1) {\n          coords.current.px = event.pointer.x;\n          coords.current.py = event.pointer.y;\n          document.addEventListener('mousemove', onMouseMove, false);\n          timer.current = setTimeout(() => comparePosition(event), timeout);\n        }\n      }\n    },\n    [cleanup, comparePosition, disabled, onMouseMove, timeout]\n  );\n\n  const delay = useCallback(\n    (event: ThreeEvent<PointerEvent>) => {\n      timer.current = clearTimeout(timer.current);\n      state.current = 0;\n      onPointerOut(event);\n    },\n    [onPointerOut]\n  );\n\n  const pointerOut = useCallback(\n    (event: ThreeEvent<PointerEvent>) => {\n      mouseOver.current = false;\n      cleanup();\n\n      if (state.current === 1) {\n        timer.current = setTimeout(() => delay(event), timeout);\n      }\n    },\n    [cleanup, delay, timeout]\n  );\n\n  return {\n    pointerOver,\n    pointerOut\n  };\n};\n","import { useThree } from '@react-three/fiber';\nimport { useMemo } from 'react';\nimport { useGesture } from 'react-use-gesture';\nimport { Vector2, Vector3, Plane } from 'three';\nimport { InternalGraphPosition } from '../types';\n\ninterface DragParams {\n  draggable: boolean;\n  position: InternalGraphPosition;\n  set: (position: Vector3) => void;\n  onDragStart: () => void;\n  onDragEnd: () => void;\n}\n\nexport const useDrag = ({\n  draggable,\n  set,\n  position,\n  onDragStart,\n  onDragEnd\n}: DragParams) => {\n  const camera = useThree(state => state.camera);\n  const raycaster = useThree(state => state.raycaster);\n  const size = useThree(state => state.size);\n  const gl = useThree(state => state.gl);\n\n  // Reference: https://codesandbox.io/s/react-three-draggable-cxu37\n  const { mouse2D, mouse3D, offset, normal, plane } = useMemo(\n    () => ({\n      // Normalized 2D screen space mouse coords\n      mouse2D: new Vector2(),\n      // 3D world space mouse coords\n      mouse3D: new Vector3(),\n      // Drag point offset from object origin\n      offset: new Vector3(),\n      // Normal of the drag plane\n      normal: new Vector3(),\n      // Drag plane\n      plane: new Plane()\n    }),\n    []\n  );\n\n  const clientRect = useMemo(\n    () => gl.domElement.getBoundingClientRect(),\n    [gl.domElement]\n  );\n\n  return useGesture(\n    {\n      onDragStart: ({ event }) => {\n        // @ts-ignore\n        const { eventObject, point } = event;\n\n        // Save the offset of click point from object origin\n        eventObject.getWorldPosition(offset).sub(point);\n\n        // Set initial 3D cursor position (needed for onDrag plane calculation)\n        mouse3D.copy(point);\n\n        // Run user callback\n        onDragStart();\n      },\n      onDrag: ({ event }) => {\n        // Compute normalized mouse coordinates (screen space)\n        const nx =\n          ((event.clientX - (clientRect?.left ?? 0)) / size.width) * 2 - 1;\n        const ny =\n          -((event.clientY - (clientRect?.top ?? 0)) / size.height) * 2 + 1;\n\n        // Unlike the mouse from useThree, this works offscreen\n        mouse2D.set(nx, ny);\n\n        // Update raycaster (otherwise it doesn't track offscreen)\n        raycaster.setFromCamera(mouse2D, camera);\n\n        // The drag plane is normal to the camera view\n        camera.getWorldDirection(normal).negate();\n\n        // Find the plane that's normal to the camera and contains our drag point\n        plane.setFromNormalAndCoplanarPoint(normal, mouse3D);\n\n        // Find the point of intersection\n        raycaster.ray.intersectPlane(plane, mouse3D);\n\n        // Update the object position with the original offset\n        const updated = new Vector3(position.x, position.y, position.z)\n          .copy(mouse3D)\n          .add(offset);\n\n        return set(updated);\n      },\n      onDragEnd\n    },\n    { drag: { enabled: draggable, threshold: 10 } }\n  );\n};\n","import Graph from 'graphology';\nimport { bidirectional } from 'graphology-shortest-path';\n\nexport function findPath(graph: Graph, source: string, target: string) {\n  return bidirectional(graph, source, target);\n}\n","import { StoreApi, create } from 'zustand';\nimport createContext from 'zustand/context';\nimport {\n  InternalGraphEdge,\n  InternalGraphNode,\n  InternalGraphPosition\n} from './types';\nimport { BufferGeometry, Mesh, Vector3 } from 'three';\nimport { ClusterGroup, getVector, updateNodePosition } from './utils';\nimport Graph from 'graphology';\nimport { Theme } from './themes';\n\nexport type DragReferences = {\n  [key: string]: InternalGraphNode;\n};\n\nexport interface GraphState {\n  nodes: InternalGraphNode[];\n  edges: InternalGraphEdge[];\n  graph: Graph;\n  clusters: Map<string, ClusterGroup>;\n  collapsedNodeIds?: string[];\n  actives?: string[];\n  selections?: string[];\n  edgeContextMenus?: Set<string>;\n  setEdgeContextMenus: (edges: Set<string>) => void;\n  edgeMeshes: Array<Mesh<BufferGeometry>>;\n  setEdgeMeshes: (edgeMeshes: Array<Mesh<BufferGeometry>>) => void;\n  draggingId?: string | null;\n  drags?: DragReferences;\n  panning?: boolean;\n  theme: Theme;\n  setTheme: (theme: Theme) => void;\n  setClusters: (clusters: Map<string, ClusterGroup>) => void;\n  setPanning: (panning: boolean) => void;\n  setDrags: (drags: DragReferences) => void;\n  setDraggingId: (id: string | null) => void;\n  setActives: (actives: string[]) => void;\n  setSelections: (selections: string[]) => void;\n  setNodes: (nodes: InternalGraphNode[]) => void;\n  setEdges: (edges: InternalGraphEdge[]) => void;\n  setNodePosition: (id: string, position: InternalGraphPosition) => void;\n  setCollapsedNodeIds: (nodeIds: string[]) => void;\n}\n\nexport const { Provider, useStore } = createContext<StoreApi<GraphState>>();\n\nexport const createStore = ({\n  actives = [],\n  selections = [],\n  collapsedNodeIds = [],\n  theme\n}: Partial<GraphState>) =>\n  create<GraphState>(set => ({\n    theme: {\n      ...theme,\n      edge: {\n        ...theme.edge,\n        label: {\n          ...theme.edge.label,\n          fontSize: theme.edge.label.fontSize ?? 6\n        }\n      }\n    },\n    edges: [],\n    nodes: [],\n    collapsedNodeIds,\n    clusters: new Map(),\n    panning: false,\n    draggingId: null,\n    actives,\n    edgeContextMenus: new Set(),\n    edgeMeshes: [],\n    selections,\n    drags: {},\n    graph: new Graph({ multi: true }),\n    setTheme: theme => set(state => ({ ...state, theme })),\n    setClusters: clusters => set(state => ({ ...state, clusters })),\n    setEdgeContextMenus: edgeContextMenus =>\n      set(state => ({\n        ...state,\n        edgeContextMenus\n      })),\n    setEdgeMeshes: edgeMeshes => set(state => ({ ...state, edgeMeshes })),\n    setPanning: panning => set(state => ({ ...state, panning })),\n    setDrags: drags => set(state => ({ ...state, drags })),\n    setDraggingId: draggingId => set(state => ({ ...state, draggingId })),\n    setActives: actives => set(state => ({ ...state, actives })),\n    setSelections: selections => set(state => ({ ...state, selections })),\n    setNodes: nodes => set(state => ({ ...state, nodes })),\n    setEdges: edges => set(state => ({ ...state, edges })),\n    setNodePosition: (id, position) =>\n      set(state => {\n        const node = state.nodes.find(n => n.id === id);\n        const originalVector = getVector(node);\n        const newVector = new Vector3(position.x, position.y, position.z);\n        const offset = newVector.sub(originalVector);\n        const nodes = [...state.nodes];\n\n        if (state.selections?.includes(id)) {\n          state.selections?.forEach(id => {\n            const node = state.nodes.find(n => n.id === id);\n            // Selections can contain edges:\n            if (node) {\n              const nodeIndex = state.nodes.indexOf(node);\n              nodes[nodeIndex] = updateNodePosition(node, offset);\n            }\n          });\n        } else {\n          const nodeIndex = state.nodes.indexOf(node);\n          nodes[nodeIndex] = updateNodePosition(node, offset);\n        }\n\n        return {\n          ...state,\n          drags: {\n            ...state.drags,\n            [id]: node\n          },\n          nodes\n        };\n      }),\n    setCollapsedNodeIds: (nodeIds = []) =>\n      set(state => ({ ...state, collapsedNodeIds: nodeIds }))\n  }));\n","import { GraphEdge, GraphNode } from '../types';\n\ninterface GetHiddenChildrenInput {\n  nodeId: string;\n  nodes: GraphNode[];\n  edges: GraphEdge[];\n  currentHiddenNodes: GraphNode[];\n  currentHiddenEdges: GraphEdge[];\n}\n\ninterface GetVisibleIdsInput {\n  collapsedIds: string[];\n  nodes: GraphNode[];\n  edges: GraphEdge[];\n}\n\ninterface GetExpandPathInput {\n  nodeId: string;\n  edges: GraphEdge[];\n  visibleEdgeIds: string[];\n}\n\n/**\n * Get the children of a node id that is hidden.\n */\nfunction getHiddenChildren({\n  nodeId,\n  nodes,\n  edges,\n  currentHiddenNodes,\n  currentHiddenEdges\n}: GetHiddenChildrenInput) {\n  const hiddenNodes: GraphNode[] = [];\n  const hiddenEdges: GraphEdge[] = [];\n  const curHiddenNodeIds = currentHiddenNodes.map(n => n.id);\n  const curHiddenEdgeIds = currentHiddenEdges.map(e => e.id);\n\n  const outboundEdges = edges.filter(l => l.source === nodeId);\n  const outboundEdgeNodeIds = outboundEdges.map(l => l.target);\n\n  hiddenEdges.push(...outboundEdges);\n  for (const outboundEdgeNodeId of outboundEdgeNodeIds) {\n    const incomingEdges = edges.filter(\n      l => l.target === outboundEdgeNodeId && l.source !== nodeId\n    );\n    let hideNode = false;\n\n    // Check to see if any other edge is coming into this node\n    if (incomingEdges.length === 0) {\n      hideNode = true;\n    } else if (\n      incomingEdges.length > 0 &&\n      !curHiddenNodeIds.includes(outboundEdgeNodeId)\n    ) {\n      // If all inbound links are hidden, hide this node as well\n      const inboundNodeLinkIds = incomingEdges.map(l => l.id);\n      if (inboundNodeLinkIds.every(i => curHiddenEdgeIds.includes(i))) {\n        hideNode = true;\n      }\n    }\n    if (hideNode) {\n      // Need to hide this node and any children of this node\n      const node = nodes.find(n => n.id === outboundEdgeNodeId);\n      if (node) {\n        hiddenNodes.push(node);\n      }\n      const nested = getHiddenChildren({\n        nodeId: outboundEdgeNodeId,\n        nodes,\n        edges,\n        currentHiddenEdges: hiddenEdges,\n        currentHiddenNodes: hiddenNodes\n      });\n      hiddenEdges.push(...nested.hiddenEdges);\n      hiddenNodes.push(...nested.hiddenNodes);\n    }\n  }\n\n  const uniqueEdges: GraphEdge[] = Object.values(\n    hiddenEdges.reduce(\n      (acc, next) => ({\n        ...acc,\n        [next.id]: next\n      }),\n      {}\n    )\n  );\n\n  const uniqueNodes: GraphNode[] = Object.values(\n    hiddenNodes.reduce(\n      (acc, next) => ({\n        ...acc,\n        [next.id]: next\n      }),\n      {}\n    )\n  );\n\n  return {\n    hiddenEdges: uniqueEdges,\n    hiddenNodes: uniqueNodes\n  };\n}\n\n/**\n * Get the visible nodes and edges given a collapsed set of ids.\n */\nexport const getVisibleEntities = ({\n  collapsedIds,\n  nodes,\n  edges\n}: GetVisibleIdsInput) => {\n  const curHiddenNodes = [];\n  const curHiddenEdges = [];\n\n  for (const collapsedId of collapsedIds) {\n    const { hiddenEdges, hiddenNodes } = getHiddenChildren({\n      nodeId: collapsedId,\n      nodes,\n      edges,\n      currentHiddenEdges: curHiddenEdges,\n      currentHiddenNodes: curHiddenNodes\n    });\n\n    curHiddenNodes.push(...hiddenNodes);\n    curHiddenEdges.push(...hiddenEdges);\n  }\n\n  const hiddenNodeIds = curHiddenNodes.map(n => n.id);\n  const hiddenEdgeIds = curHiddenEdges.map(e => e.id);\n  const visibleNodes = nodes.filter(n => !hiddenNodeIds.includes(n.id));\n  const visibleEdges = edges.filter(e => !hiddenEdgeIds.includes(e.id));\n\n  return {\n    visibleNodes,\n    visibleEdges\n  };\n};\n\n/**\n * Get the path to expand a node.\n */\nexport const getExpandPath = ({\n  nodeId,\n  edges,\n  visibleEdgeIds\n}: GetExpandPathInput) => {\n  const parentIds = [];\n  const inboundEdges = edges.filter(l => l.target === nodeId);\n  const inboundEdgeIds = inboundEdges.map(e => e.id);\n  const hasVisibleInboundEdge = inboundEdgeIds.some(id =>\n    visibleEdgeIds.includes(id)\n  );\n\n  if (hasVisibleInboundEdge) {\n    // If there is a visible edge to this node, that means the node is\n    // visible so no parents need to be expanded\n    return parentIds;\n  }\n\n  const inboundEdgeNodeIds = inboundEdges.map(l => l.source);\n  let addedParent = false;\n\n  for (const inboundNodeId of inboundEdgeNodeIds) {\n    if (!addedParent) {\n      // Only want to expand a single path to the node, so if there\n      // are multiple hidden incoming edges, only expand the first\n      // to reduce how many nodes are expanded to get to the node\n      parentIds.push(\n        ...[\n          inboundNodeId,\n          ...getExpandPath({ nodeId: inboundNodeId, edges, visibleEdgeIds })\n        ]\n      );\n      addedParent = true;\n    }\n  }\n\n  return parentIds;\n};\n","import React, { useCallback } from 'react';\nimport { GraphEdge, GraphNode } from 'types';\nimport { getExpandPath, getVisibleEntities } from './utils';\n\nexport interface UseCollapseProps {\n  /**\n   * Current collapsed node ids.\n   */\n  collapsedNodeIds?: string[];\n\n  /**\n   * Node data.\n   */\n  nodes?: GraphNode[];\n\n  /**\n   * Edge data.\n   */\n  edges?: GraphEdge[];\n}\n\nexport interface CollpaseResult {\n  /**\n   * Determine if a node is currently collapsed\n   */\n  getIsCollapsed: (nodeId: string) => boolean;\n\n  /**\n   * Return a list of ids required to expand in order to view the provided node\n   */\n  getExpandPathIds: (nodeId: string) => string[];\n}\n\nexport const useCollapse = ({\n  collapsedNodeIds = [],\n  nodes = [],\n  edges = []\n}: UseCollapseProps): CollpaseResult => {\n  const getIsCollapsed = useCallback(\n    (nodeId: string) => {\n      const { visibleNodes } = getVisibleEntities({\n        nodes,\n        edges,\n        collapsedIds: collapsedNodeIds\n      });\n      const visibleNodeIds = visibleNodes.map(n => n.id);\n\n      return !visibleNodeIds.includes(nodeId);\n    },\n    [collapsedNodeIds, edges, nodes]\n  );\n\n  const getExpandPathIds = useCallback(\n    (nodeId: string) => {\n      const { visibleEdges } = getVisibleEntities({\n        nodes,\n        edges,\n        collapsedIds: collapsedNodeIds\n      });\n      const visibleEdgeIds = visibleEdges.map(e => e.id);\n\n      return getExpandPath({ nodeId, edges, visibleEdgeIds });\n    },\n    [collapsedNodeIds, edges, nodes]\n  );\n\n  return {\n    getIsCollapsed,\n    getExpandPathIds\n  };\n};\n","import {\n  useRef,\n  useState,\n  useCallback,\n  useEffect,\n  useMemo,\n  useLayoutEffect\n} from 'react';\nimport { SizingType } from './sizing';\nimport {\n  LayoutTypes,\n  layoutProvider,\n  LayoutStrategy,\n  LayoutOverrides\n} from './layout';\nimport { LabelVisibilityType } from './utils/visibility';\nimport { tick } from './layout/layoutUtils';\nimport { GraphEdge, GraphNode } from './types';\nimport { buildGraph, transformGraph } from './utils/graph';\nimport { DragReferences, useStore } from './store';\nimport { getVisibleEntities } from './collapse';\nimport { calculateClusters } from './utils/cluster';\n\nexport interface GraphInputs {\n  nodes: GraphNode[];\n  edges: GraphEdge[];\n  collapsedNodeIds?: string[];\n  layoutType?: LayoutTypes;\n  sizingType?: SizingType;\n  labelType?: LabelVisibilityType;\n  sizingAttribute?: string;\n  selections?: string[];\n  actives?: string[];\n  clusterAttribute?: string;\n  defaultNodeSize?: number;\n  minNodeSize?: number;\n  maxNodeSize?: number;\n  layoutOverrides?: LayoutOverrides;\n}\n\nexport const useGraph = ({\n  layoutType,\n  sizingType,\n  labelType,\n  sizingAttribute,\n  clusterAttribute,\n  selections,\n  nodes,\n  edges,\n  actives,\n  collapsedNodeIds,\n  defaultNodeSize,\n  maxNodeSize,\n  minNodeSize,\n  layoutOverrides\n}: GraphInputs) => {\n  const graph = useStore(state => state.graph);\n  const setClusters = useStore(state => state.setClusters);\n  const stateCollapsedNodeIds = useStore(state => state.collapsedNodeIds);\n  const setEdges = useStore(state => state.setEdges);\n  const setNodes = useStore(state => state.setNodes);\n  const setSelections = useStore(state => state.setSelections);\n  const setActives = useStore(state => state.setActives);\n  const drags = useStore(state => state.drags);\n  const setDrags = useStore(state => state.setDrags);\n  const setCollapsedNodeIds = useStore(state => state.setCollapsedNodeIds);\n\n  const [mounted, setMounted] = useState<boolean>(false);\n  const layoutMounted = useRef<boolean>(false);\n  const layout = useRef<LayoutStrategy | null>(null);\n  const { visibleEdges, visibleNodes } = useMemo(() => {\n    const { visibleEdges, visibleNodes } = getVisibleEntities({\n      collapsedIds: stateCollapsedNodeIds,\n      nodes,\n      edges\n    });\n\n    return {\n      visibleEdges,\n      visibleNodes\n    };\n  }, [stateCollapsedNodeIds, nodes, edges]);\n\n  // Transient updates\n  const dragRef = useRef<DragReferences>(drags);\n  useEffect(() => {\n    dragRef.current = drags;\n  }, [drags]);\n\n  const updateLayout = useCallback(\n    (curLayout?: any) => {\n      layout.current =\n        curLayout ||\n        layoutProvider({\n          ...layoutOverrides,\n          type: layoutType,\n          graph,\n          drags: dragRef.current,\n          clusterAttribute\n        });\n\n      tick(layout.current, () => {\n        const result = transformGraph({\n          graph,\n          layout: layout.current,\n          sizingType,\n          labelType,\n          sizingAttribute,\n          maxNodeSize,\n          minNodeSize,\n          defaultNodeSize\n        });\n\n        const clusters = calculateClusters({\n          nodes: result.nodes,\n          clusterAttribute\n        });\n\n        setEdges(result.edges);\n        setNodes(result.nodes);\n        setClusters(clusters);\n      });\n    },\n    [\n      layoutOverrides,\n      setClusters,\n      layoutType,\n      graph,\n      clusterAttribute,\n      sizingType,\n      labelType,\n      sizingAttribute,\n      maxNodeSize,\n      minNodeSize,\n      defaultNodeSize,\n      setEdges,\n      setNodes\n    ]\n  );\n\n  useEffect(() => {\n    // Let's set the store selections so its easier to access\n    setSelections(selections);\n  }, [selections, setSelections]);\n\n  useEffect(() => {\n    // Let's set the store actives so its easier to access\n    setActives(actives);\n  }, [actives, setActives]);\n\n  // Create the nggraph graph object\n  useLayoutEffect(() => {\n    layoutMounted.current = false;\n    buildGraph(graph, visibleNodes, visibleEdges);\n    updateLayout();\n\n    // queue this in a frame so it only happens after the graph is built\n    requestAnimationFrame(() => {\n      // Track mounted in state and transitent state\n      layoutMounted.current = true;\n      setMounted(true);\n    });\n\n    // eslint-disable-next-line\n  }, [visibleNodes, visibleEdges, graph]);\n\n  useEffect(() => {\n    // Let's set the store collapsedNodeIds so its easier to access\n    setCollapsedNodeIds(collapsedNodeIds);\n  }, [collapsedNodeIds, setCollapsedNodeIds]);\n\n  // Update layout on type changes\n  useEffect(() => {\n    if (layoutMounted.current) {\n      // When a update is changed, discard all the previous drag positions\n      // NOTE: This sets the transient and the state\n      dragRef.current = {};\n      setDrags({});\n\n      // Recalculate the layout\n      updateLayout();\n    }\n  }, [graph, layoutType, updateLayout, setDrags]);\n\n  // Update layout on size, label changes\n  useEffect(() => {\n    if (layoutMounted.current) {\n      updateLayout(layout.current);\n    }\n  }, [graph, sizingType, sizingAttribute, labelType, updateLayout]);\n\n  return {\n    mounted\n  };\n};\n","import React, { FC, useMemo } from 'react';\nimport { Billboard, Text } from 'glodrei';\nimport { Color, ColorRepresentation } from 'three';\nimport ellipsize from 'ellipsize';\n\nexport interface LabelProps {\n  /**\n   * Text to render.\n   */\n  text: string;\n\n  /**\n   * Font URL.\n   * Reference: https://github.com/reaviz/reagraph/issues/23\n   */\n  fontUrl?: string;\n\n  /**\n   * Size of the font.\n   */\n  fontSize?: number;\n\n  /**\n   * Color of the text.\n   */\n  color?: ColorRepresentation;\n\n  /**\n   * Stroke of the text.\n   */\n  stroke?: ColorRepresentation;\n\n  /**\n   * Opacity for the label.\n   */\n  opacity?: number;\n\n  /**\n   * The lenth of which to start the ellipsis.\n   */\n  ellipsis?: number;\n\n  /**\n   * Whether the label is active ( dragging, hover, focus ).\n   */\n  active?: boolean;\n}\n\nexport const Label: FC<LabelProps> = ({\n  text,\n  fontSize,\n  fontUrl,\n  color,\n  opacity,\n  stroke,\n  active,\n  ellipsis\n}) => {\n  const shortText = ellipsis && !active ? ellipsize(text, ellipsis) : text;\n  const normalizedColor = useMemo(() => new Color(color), [color]);\n  const normalizedStroke = useMemo(\n    () => (stroke ? new Color(stroke) : undefined),\n    [stroke]\n  );\n\n  return (\n    <Billboard position={[0, 0, 1]}>\n      <Text\n        font={fontUrl}\n        fontSize={fontSize}\n        color={normalizedColor}\n        fillOpacity={opacity}\n        textAlign=\"center\"\n        outlineWidth={stroke ? 1 : 0}\n        outlineColor={normalizedStroke}\n        depthOffset={0}\n        maxWidth={100}\n        overflowWrap=\"break-word\"\n      >\n        {shortText}\n      </Text>\n    </Billboard>\n  );\n};\n\nLabel.defaultProps = {\n  opacity: 1,\n  fontSize: 7,\n  color: '#2A6475',\n  ellipsis: 75\n};\n","import React, { FC, useMemo } from 'react';\nimport { useSpring, a } from '@react-spring/three';\nimport { animationConfig } from '../../utils/animation';\nimport { Color, DoubleSide } from 'three';\nimport { NodeRendererProps } from '../../types';\n\nexport const Sphere: FC<NodeRendererProps> = ({\n  color,\n  id,\n  size,\n  opacity,\n  animated\n}) => {\n  const { scale, nodeOpacity } = useSpring({\n    from: {\n      // Note: This prevents incorrect scaling w/ 0\n      scale: [0.00001, 0.00001, 0.00001],\n      nodeOpacity: 0\n    },\n    to: {\n      scale: [size, size, size],\n      nodeOpacity: opacity\n    },\n    config: {\n      ...animationConfig,\n      duration: animated ? undefined : 0\n    }\n  });\n  const normalizedColor = useMemo(() => new Color(color), [color]);\n\n  return (\n    <a.mesh userData={{ id, type: 'node' }} scale={scale as any}>\n      <sphereGeometry attach=\"geometry\" args={[1, 25, 25]} />\n      <a.meshPhongMaterial\n        attach=\"material\"\n        side={DoubleSide}\n        transparent={true}\n        fog={true}\n        opacity={nodeOpacity}\n        color={normalizedColor}\n      />\n    </a.mesh>\n  );\n};\n\nSphere.defaultProps = {\n  opacity: 1,\n  active: false\n};\n","import React, { FC, useMemo } from 'react';\nimport { Color, ColorRepresentation, DoubleSide } from 'three';\nimport { animationConfig } from '../utils/animation';\nimport { useSpring, a } from '@react-spring/three';\nimport { Billboard } from 'glodrei';\n\nexport interface RingProps {\n  /**\n   * The color of the ring.\n   */\n  color?: ColorRepresentation;\n\n  /**\n   * Whether the ring should be animated.\n   */\n  animated?: boolean;\n\n  /**\n   * The size of the ring.\n   */\n  size?: number;\n\n  /**\n   * The opacity of the ring.\n   */\n  opacity?: number;\n}\n\nexport const Ring: FC<RingProps> = ({ color, size, opacity, animated }) => {\n  const normalizedColor = useMemo(() => new Color(color), [color]);\n\n  const { ringSize, ringOpacity } = useSpring({\n    from: {\n      ringOpacity: 0,\n      ringSize: [0.00001, 0.00001, 0.00001]\n    },\n    to: {\n      ringOpacity: opacity,\n      ringSize: [size / 2, size / 2, 1]\n    },\n    config: {\n      ...animationConfig,\n      duration: animated ? undefined : 0\n    }\n  });\n\n  return (\n    <Billboard position={[0, 0, 1]}>\n      <a.mesh scale={ringSize as any}>\n        <ringGeometry attach=\"geometry\" args={[4, 4.5, 25]} />\n        <a.meshBasicMaterial\n          attach=\"material\"\n          color={normalizedColor}\n          transparent={true}\n          depthTest={false}\n          opacity={ringOpacity}\n          side={DoubleSide}\n          fog={true}\n        />\n      </a.mesh>\n    </Billboard>\n  );\n};\n\nRing.defaultProps = {\n  color: '#D8E6EA',\n  size: 1,\n  opacity: 0.5\n};\n","import CameraControls from 'camera-controls';\nimport { createContext, useContext } from 'react';\n\nexport interface CameraControlsContextProps {\n  controls: CameraControls | null;\n  resetControls: (animated?: boolean) => void;\n  zoomIn: () => void;\n  zoomOut: () => void;\n  panLeft: () => void;\n  panRight: () => void;\n  panUp: () => void;\n  panDown: () => void;\n}\n\nexport const CameraControlsContext = createContext<CameraControlsContextProps>({\n  controls: null,\n  resetControls: () => undefined,\n  zoomIn: () => undefined,\n  zoomOut: () => undefined,\n  panLeft: () => undefined,\n  panRight: () => undefined,\n  panUp: () => undefined,\n  panDown: () => undefined\n});\n\nexport const useCameraControls = () => {\n  const context = useContext(CameraControlsContext);\n\n  if (context === undefined) {\n    throw new Error(\n      '`useCameraControls` hook must be used within a `ControlsProvider` component'\n    );\n  }\n\n  return context;\n};\n","import React, {\n  FC,\n  useRef,\n  useEffect,\n  useCallback,\n  forwardRef,\n  Ref,\n  useImperativeHandle,\n  useMemo,\n  ReactNode\n} from 'react';\nimport { useThree, useFrame, extend } from '@react-three/fiber';\nimport {\n  MOUSE,\n  Vector2,\n  Vector3,\n  Vector4,\n  Quaternion,\n  Matrix4,\n  Spherical,\n  Box3,\n  Sphere,\n  Raycaster,\n  MathUtils\n} from 'three';\nimport ThreeCameraControls from 'camera-controls';\nimport {\n  CameraControlsContext,\n  CameraControlsContextProps\n} from './useCameraControls';\nimport { useHotkeys } from 'reakeys';\nimport * as holdEvent from 'hold-event';\nimport { useStore } from '../store';\n\n// Install the camera controls\n// Use a subset for better three shaking\nThreeCameraControls.install({\n  THREE: {\n    MOUSE: MOUSE,\n    Vector2: Vector2,\n    Vector3: Vector3,\n    Vector4: Vector4,\n    Quaternion: Quaternion,\n    Matrix4: Matrix4,\n    Spherical: Spherical,\n    Box3: Box3,\n    Sphere: Sphere,\n    Raycaster: Raycaster,\n    MathUtils: {\n      DEG2RAD: MathUtils?.DEG2RAD,\n      clamp: MathUtils?.clamp\n    }\n  }\n});\n\n// Extend r3f with the new controls\nextend({ ThreeCameraControls });\n\nconst KEY_CODES = {\n  ARROW_LEFT: 37,\n  ARROW_UP: 38,\n  ARROW_RIGHT: 39,\n  ARROW_DOWN: 40\n};\n\nconst leftKey = new holdEvent.KeyboardKeyHold(KEY_CODES.ARROW_LEFT, 100);\nconst rightKey = new holdEvent.KeyboardKeyHold(KEY_CODES.ARROW_RIGHT, 100);\nconst upKey = new holdEvent.KeyboardKeyHold(KEY_CODES.ARROW_UP, 100);\nconst downKey = new holdEvent.KeyboardKeyHold(KEY_CODES.ARROW_DOWN, 100);\n\nexport type CameraMode = 'pan' | 'rotate' | 'orbit';\n\nexport interface CameraControlsProps {\n  /**\n   * Mode of the camera.\n   */\n  mode?: CameraMode;\n\n  /**\n   * Children symbols.\n   */\n  children?: ReactNode;\n\n  /**\n   * Animate transitions to centering.\n   */\n  animated?: boolean;\n}\n\nexport type CameraControlsRef = CameraControlsContextProps;\n\nexport const CameraControls: FC<\n  CameraControlsProps & { ref?: Ref<CameraControlsRef> }\n> = forwardRef(\n  ({ mode, children, animated }, ref: Ref<CameraControlsRef>) => {\n    const cameraRef = useRef<ThreeCameraControls | null>(null);\n    const camera = useThree(state => state.camera);\n    const gl = useThree(state => state.gl);\n    const isOrbiting = mode === 'orbit';\n    const setPanning = useStore(state => state.setPanning);\n\n    useFrame((_state, delta) => {\n      if (cameraRef.current?.enabled) {\n        cameraRef.current?.update(delta);\n      }\n\n      if (isOrbiting) {\n        cameraRef.current.azimuthAngle += 20 * delta * MathUtils.DEG2RAD;\n      }\n    }, -1);\n\n    useEffect(() => () => cameraRef.current?.dispose(), []);\n\n    const zoomIn = useCallback(() => {\n      cameraRef.current?.zoom(camera.zoom / 2, animated);\n    }, [animated, camera.zoom]);\n\n    const zoomOut = useCallback(() => {\n      cameraRef.current?.zoom(-camera.zoom / 2, animated);\n    }, [animated, camera.zoom]);\n\n    const panRight = useCallback(\n      event => {\n        if (!isOrbiting) {\n          cameraRef.current?.truck(-0.03 * event.deltaTime, 0, animated);\n        }\n      },\n      [animated, isOrbiting]\n    );\n\n    const panLeft = useCallback(\n      event => {\n        if (!isOrbiting) {\n          cameraRef.current?.truck(0.03 * event.deltaTime, 0, animated);\n        }\n      },\n      [animated, isOrbiting]\n    );\n\n    const panUp = useCallback(\n      event => {\n        if (!isOrbiting) {\n          cameraRef.current?.truck(0, 0.03 * event.deltaTime, animated);\n        }\n      },\n      [animated, isOrbiting]\n    );\n\n    const panDown = useCallback(\n      event => {\n        if (!isOrbiting) {\n          cameraRef.current?.truck(0, -0.03 * event.deltaTime, animated);\n        }\n      },\n      [animated, isOrbiting]\n    );\n\n    const onKeyDown = useCallback(\n      event => {\n        if (event.code === 'Space') {\n          if (mode === 'rotate') {\n            cameraRef.current.mouseButtons.left =\n              ThreeCameraControls.ACTION.TRUCK;\n          } else {\n            cameraRef.current.mouseButtons.left =\n              ThreeCameraControls.ACTION.ROTATE;\n          }\n        }\n      },\n      [mode]\n    );\n\n    const onKeyUp = useCallback(\n      event => {\n        if (event.code === 'Space') {\n          if (mode === 'rotate') {\n            cameraRef.current.mouseButtons.left =\n              ThreeCameraControls.ACTION.ROTATE;\n          } else {\n            cameraRef.current.mouseButtons.left =\n              ThreeCameraControls.ACTION.TRUCK;\n          }\n        }\n      },\n      [mode]\n    );\n\n    useEffect(() => {\n      leftKey.addEventListener('holding', panLeft);\n      rightKey.addEventListener('holding', panRight);\n      upKey.addEventListener('holding', panUp);\n      downKey.addEventListener('holding', panDown);\n      window.addEventListener('keydown', onKeyDown);\n      window.addEventListener('keyup', onKeyUp);\n\n      return () => {\n        leftKey.removeEventListener('holding', panLeft);\n        rightKey.removeEventListener('holding', panRight);\n        upKey.removeEventListener('holding', panUp);\n        downKey.removeEventListener('holding', panDown);\n        window.removeEventListener('keydown', onKeyDown);\n        window.removeEventListener('keyup', onKeyUp);\n      };\n    }, [onKeyDown, onKeyUp, panDown, panLeft, panRight, panUp]);\n\n    useEffect(() => {\n      const onControl = () => setPanning(true);\n      const onControlEnd = () => setPanning(false);\n\n      const ref = cameraRef.current;\n      if (ref) {\n        ref.addEventListener('control', onControl);\n        ref.addEventListener('controlend', onControlEnd);\n      }\n\n      return () => {\n        if (ref) {\n          ref.removeEventListener('control', onControl);\n          ref.removeEventListener('controlend', onControlEnd);\n        }\n      };\n    }, [cameraRef, setPanning]);\n\n    useEffect(() => {\n      if (mode === 'rotate') {\n        cameraRef.current.mouseButtons.left = ThreeCameraControls.ACTION.ROTATE;\n      } else {\n        cameraRef.current.mouseButtons.left = ThreeCameraControls.ACTION.TRUCK;\n      }\n    }, [mode]);\n\n    useHotkeys([\n      {\n        name: 'Zoom In',\n        category: 'Graph',\n        keys: 'command+shift+i',\n        callback: event => {\n          event.preventDefault();\n          zoomIn();\n        }\n      },\n      {\n        name: 'Zoom Out',\n        category: 'Graph',\n        keys: 'command+shift+o',\n        callback: event => {\n          event.preventDefault();\n          zoomOut();\n        }\n      }\n    ]);\n\n    const values = useMemo(\n      () => ({\n        controls: cameraRef.current,\n        zoomIn: () => zoomIn(),\n        zoomOut: () => zoomOut(),\n        panLeft: (deltaTime = 100) => panLeft({ deltaTime }),\n        panRight: (deltaTime = 100) => panRight({ deltaTime }),\n        panDown: (deltaTime = 100) => panDown({ deltaTime }),\n        panUp: (deltaTime = 100) => panUp({ deltaTime }),\n        resetControls: (animated?: boolean) =>\n          cameraRef.current?.reset(animated)\n      }),\n      // eslint-disable-next-line\n      [zoomIn, zoomOut, panLeft, panRight, panDown, panUp, cameraRef.current]\n    );\n\n    useImperativeHandle(ref, () => values);\n\n    return (\n      <CameraControlsContext.Provider value={values}>\n        <threeCameraControls\n          ref={cameraRef}\n          args={[camera, gl.domElement]}\n          smoothTime={0.1}\n          minDistance={1000}\n          maxDistance={50000}\n        />\n        {children}\n      </CameraControlsContext.Provider>\n    );\n  }\n);\n\nCameraControls.defaultProps = {\n  mode: 'rotate'\n};\n","import { useThree } from '@react-three/fiber';\nimport { useCameraControls } from './useCameraControls';\nimport { useCallback, useLayoutEffect, useMemo, useRef } from 'react';\nimport { Vector3, Box3 } from 'three';\nimport { useHotkeys } from 'reakeys';\nimport { getLayoutCenter } from '../utils/layout';\nimport { InternalGraphNode } from '../types';\nimport { useStore } from '../store';\n\nconst PADDING = 50;\n\nexport interface CenterGraphInput {\n  /**\n   * Whether the animate the transition or not.\n   */\n  animated?: boolean;\n}\n\nexport interface CenterGraphOutput {\n  /**\n   * A function that centers the graph on the nodes with the given nodes.\n   * If no nodes are provided, the graph is centered on all nodes.\n   */\n  centerNodes: (nodes?: InternalGraphNode[]) => void;\n\n  /**\n   * A function that centers the graph on the nodes with the given ids.\n   * If no ids are provided, the graph is centered on all nodes.\n   */\n  centerNodesById: (ids?: string[]) => void;\n}\n\nexport const useCenterGraph = ({\n  animated\n}: CenterGraphInput): CenterGraphOutput => {\n  const nodes = useStore(state => state.nodes);\n  const invalidate = useThree(state => state.invalidate);\n  const { controls } = useCameraControls();\n\n  // Find the ideal spacing for focusing\n  const centerPadding = useMemo(() => {\n    const { maxX, maxY } = getLayoutCenter(nodes);\n    return Math.max(maxX, maxY);\n  }, [nodes]);\n\n  const centerNodes = useCallback(\n    (centerNodes: InternalGraphNode[], padding = PADDING, fill = false) => {\n      // Centers the graph based on the central most node\n      const { minX, maxX, minY, maxY, minZ, maxZ, x, y, z } =\n        getLayoutCenter(centerNodes);\n\n      controls.setTarget(x, y, z);\n      controls?.fitToBox(\n        new Box3(new Vector3(minX, minY, minZ), new Vector3(maxX, maxY, maxZ)),\n        animated,\n        {\n          cover: fill,\n          paddingLeft: padding,\n          paddingRight: padding,\n          paddingBottom: padding,\n          paddingTop: padding\n        }\n      );\n\n      invalidate();\n    },\n    [invalidate, controls, animated]\n  );\n\n  const centerNodesById = useCallback(\n    (nodeIds?: string[]) => {\n      let mappedNodes: InternalGraphNode[] | null = null;\n      let padding = PADDING;\n\n      if (nodeIds?.length) {\n        // Get center padding + our default padding\n        padding = centerPadding + PADDING;\n\n        // Map the node ids to the actual nodes\n        mappedNodes = nodeIds.reduce((acc, id) => {\n          const node = nodes.find(n => n.id === id);\n          if (node) {\n            acc.push(node);\n          } else {\n            throw new Error(\n              `Attempted to center ${id} but it was not found in the nodes`\n            );\n          }\n\n          return acc;\n        }, []);\n      }\n\n      centerNodes(mappedNodes || nodes, padding, !!mappedNodes);\n    },\n    [centerNodes, nodes, centerPadding]\n  );\n\n  const mounted = useRef<boolean>(false);\n  useLayoutEffect(() => {\n    // Center the graph once nodes are loaded on mount\n    if (controls && nodes?.length && !mounted.current) {\n      centerNodes(nodes);\n      mounted.current = true;\n    }\n  }, [controls, centerNodes, nodes]);\n\n  useHotkeys([\n    {\n      name: 'Center',\n      category: 'Graph',\n      keys: ['command+shift+c'],\n      callback: () => centerNodes(nodes)\n    }\n  ]);\n\n  return { centerNodes, centerNodesById };\n};\n","import React, { FC, useMemo } from 'react';\nimport { a, useSpring } from '@react-spring/three';\nimport { TextureLoader, LinearFilter, DoubleSide } from 'three';\nimport { animationConfig } from '../../utils';\nimport { NodeRendererProps } from '../../types';\n\nexport interface IconProps extends NodeRendererProps {\n  /**\n   * The image to display on the icon.\n   */\n  image: string;\n}\n\nexport const Icon: FC<IconProps> = ({ image, id, size, opacity, animated }) => {\n  const texture = useMemo(() => new TextureLoader().load(image), [image]);\n\n  const { scale, spriteOpacity } = useSpring({\n    from: {\n      scale: [0.00001, 0.00001, 0.00001],\n      spriteOpacity: 0\n    },\n    to: {\n      scale: [size, size, size],\n      spriteOpacity: opacity\n    },\n    config: {\n      ...animationConfig,\n      duration: animated ? undefined : 0\n    }\n  });\n\n  return (\n    <a.sprite userData={{ id, type: 'node' }} scale={scale as any}>\n      <a.spriteMaterial\n        attach=\"material\"\n        opacity={spriteOpacity}\n        fog={true}\n        depthTest={false}\n        transparent={true}\n        side={DoubleSide}\n      >\n        <primitive attach=\"map\" object={texture} minFilter={LinearFilter} />\n      </a.spriteMaterial>\n    </a.sprite>\n  );\n};\n\nIcon.defaultProps = {\n  opacity: 1\n};\n","import React, { FC } from 'react';\nimport { NodeRendererProps } from '../../types';\nimport { Sphere } from './Sphere';\nimport { Icon } from './Icon';\n\nexport interface SphereWithIconProps extends NodeRendererProps {\n  /**\n   * The image to display on the icon.\n   */\n  image: string;\n}\n\nexport const SphereWithIcon: FC<SphereWithIconProps> = ({\n  color,\n  id,\n  size,\n  opacity,\n  node,\n  active,\n  animated,\n  image\n}) => (\n  <>\n    <Sphere\n      id={id}\n      size={size}\n      opacity={opacity}\n      animated={animated}\n      color={color}\n      node={node}\n      active={active}\n    />\n    <Icon\n      id={id}\n      image={image}\n      size={size + 8}\n      opacity={opacity}\n      animated={animated}\n      color={color}\n      node={node}\n      active={active}\n    />\n  </>\n);\n\nSphereWithIcon.defaultProps = {\n  opacity: 1,\n  active: false\n};\n","import React, { FC, useMemo } from 'react';\nimport { a, useSpring } from '@react-spring/three';\nimport { animationConfig } from '../../utils';\nimport { NodeRendererProps } from '../../types';\nimport { Billboard, Svg as DreiSvg, SvgProps as DreiSvgProps } from 'glodrei';\nimport { Color, DoubleSide } from 'three';\n\nexport type SvgProps = NodeRendererProps &\n  Omit<DreiSvgProps, 'src' | 'id'> & {\n    /**\n     * The image to display on the icon.\n     */\n    image: string;\n  };\n\nexport const Svg: FC<SvgProps> = ({\n  id,\n  image,\n  color,\n  size,\n  opacity,\n  animated,\n  ...rest\n}) => {\n  const normalizedSize = size / 25;\n\n  const { scale } = useSpring({\n    from: {\n      scale: [0.00001, 0.00001, 0.00001]\n    },\n    to: {\n      scale: [normalizedSize, normalizedSize, normalizedSize]\n    },\n    config: {\n      ...animationConfig,\n      duration: animated ? undefined : 0\n    }\n  });\n\n  const normalizedColor = useMemo(() => new Color(color), [color]);\n\n  return (\n    <a.group userData={{ id, type: 'node' }} scale={scale as any}>\n      <Billboard position={[0, 0, 1]}>\n        <DreiSvg\n          {...rest}\n          src={image}\n          fillMaterial={{\n            fog: true,\n            depthTest: false,\n            transparent: true,\n            color: normalizedColor,\n            opacity,\n            side: DoubleSide,\n            ...(rest.fillMaterial || {})\n          }}\n          fillMeshProps={{\n            // Note: This is a hack to get the svg to\n            // render in the correct position.\n            position: [-25, -25, 1],\n            ...(rest.fillMeshProps || {})\n          }}\n        />\n      </Billboard>\n    </a.group>\n  );\n};\n\nSvg.defaultProps = {\n  opacity: 1\n};\n","import React, { FC } from 'react';\nimport { Sphere } from './Sphere';\nimport { Svg, SvgProps } from './Svg';\nimport { ColorRepresentation } from 'three';\n\nexport interface SphereWithSvgProps extends SvgProps {\n  /**\n   * The image to display on the icon.\n   */\n  image: string;\n\n  /**\n   * The color of the svg fill.\n   */\n  svgFill?: ColorRepresentation;\n}\n\nexport const SphereWithSvg: FC<SphereWithSvgProps> = ({\n  color,\n  id,\n  size,\n  opacity,\n  node,\n  svgFill,\n  active,\n  animated,\n  image,\n  ...rest\n}) => (\n  <>\n    <Sphere\n      id={id}\n      size={size}\n      opacity={opacity}\n      animated={animated}\n      color={color}\n      node={node}\n      active={active}\n    />\n    <Svg\n      {...rest}\n      id={id}\n      image={image}\n      size={size}\n      opacity={opacity}\n      animated={animated}\n      color={svgFill}\n      node={node}\n      active={active}\n    />\n  </>\n);\n\nSphereWithSvg.defaultProps = {\n  opacity: 1,\n  active: false\n};\n","import React, {\n  FC,\n  ReactNode,\n  useCallback,\n  useMemo,\n  useRef,\n  useState\n} from 'react';\nimport { Group } from 'three';\nimport { animationConfig } from '../utils';\nimport { useSpring, a } from '@react-spring/three';\nimport { Sphere } from './nodes/Sphere';\nimport { Label } from './Label';\nimport { Ring } from './Ring';\nimport {\n  NodeContextMenuProps,\n  ContextMenuEvent,\n  InternalGraphNode,\n  NodeRenderer,\n  CollapseProps\n} from '../types';\nimport { Html, useCursor } from 'glodrei';\nimport { useCameraControls } from '../CameraControls';\nimport { useStore } from '../store';\nimport { useDrag } from '../utils/useDrag';\nimport { Icon } from './nodes';\nimport { useHoverIntent } from '../utils/useHoverIntent';\n\nexport interface NodeProps {\n  /**\n   * The unique identifier for the node.\n   */\n  id: string;\n\n  /**\n   * The parent nodes of the node.\n   */\n  parents?: string[];\n\n  /**\n   * Whether the node is disabled.\n   */\n  disabled?: boolean;\n\n  /**\n   * Whether the node is animated.\n   */\n  animated?: boolean;\n\n  /**\n   * Whether the node is draggable.\n   */\n  draggable?: boolean;\n\n  /**\n   * The url for the label font.\n   */\n  labelFontUrl?: string;\n\n  /**\n   * The function to use to render the node.\n   */\n  renderNode?: NodeRenderer;\n\n  /**\n   * The context menu for the node.\n   */\n  contextMenu?: (event: ContextMenuEvent) => ReactNode;\n\n  /**\n   * The function to call when the pointer is over the node.\n   */\n  onPointerOver?: (node: InternalGraphNode) => void;\n\n  /**\n   * The function to call when the pointer is out of the node.\n   */\n  onPointerOut?: (node: InternalGraphNode) => void;\n\n  /**\n   * The function to call when the node is clicked.\n   */\n  onClick?: (node: InternalGraphNode, props?: CollapseProps) => void;\n\n  /**\n   * The function to call when the node is double clicked.\n   */\n  onDoubleClick?: (node: InternalGraphNode) => void;\n\n  /**\n   * The function to call when the node is right clicked.\n   */\n  onContextMenu?: (\n    node?: InternalGraphNode,\n    props?: NodeContextMenuProps\n  ) => void;\n\n  /**\n   * Triggered after a node was dragged.\n   */\n  onDragged?: (node: InternalGraphNode) => void;\n}\n\nexport const Node: FC<NodeProps> = ({\n  animated,\n  disabled,\n  id,\n  draggable,\n  labelFontUrl,\n  contextMenu,\n  onClick,\n  onDoubleClick,\n  onPointerOver,\n  onDragged,\n  onPointerOut,\n  onContextMenu,\n  renderNode\n}) => {\n  const cameraControls = useCameraControls();\n  const theme = useStore(state => state.theme);\n  const node = useStore(state => state.nodes.find(n => n.id === id));\n  const edges = useStore(state => state.edges);\n  const draggingId = useStore(state => state.draggingId);\n  const collapsedNodeIds = useStore(state => state.collapsedNodeIds);\n  const setDraggingId = useStore(state => state.setDraggingId);\n  const setNodePosition = useStore(state => state.setNodePosition);\n  const setCollapsedNodeIds = useStore(state => state.setCollapsedNodeIds);\n  const isCollapsed = useStore(state => state.collapsedNodeIds.includes(id));\n  const isActive = useStore(state => state.actives?.includes(id));\n  const isSelected = useStore(state => state.selections?.includes(id));\n  const hasSelections = useStore(state => state.selections?.length > 0);\n\n  const isDragging = draggingId === id;\n  const {\n    position,\n    label,\n    subLabel,\n    size: nodeSize = 7,\n    labelVisible = true\n  } = node;\n\n  const group = useRef<Group | null>(null);\n  const [active, setActive] = useState<boolean>(false);\n  const [menuVisible, setMenuVisible] = useState<boolean>(false);\n\n  const selectionOpacity = hasSelections\n    ? isSelected || active || isActive\n      ? theme.node.selectedOpacity\n      : theme.node.inactiveOpacity\n    : theme.node.opacity;\n\n  const canCollapse = useMemo(() => {\n    // If the node has outgoing edges, it can collapse via context menu\n    const outboundLinks = edges.filter(l => l.source === id);\n\n    return outboundLinks.length > 0 || isCollapsed;\n  }, [edges, id, isCollapsed]);\n\n  const onCollapse = useCallback(() => {\n    if (canCollapse) {\n      if (isCollapsed) {\n        setCollapsedNodeIds(collapsedNodeIds.filter(p => p !== id));\n      } else {\n        setCollapsedNodeIds([...collapsedNodeIds, id]);\n      }\n    }\n  }, [canCollapse, collapsedNodeIds, id, isCollapsed, setCollapsedNodeIds]);\n\n  const [{ nodePosition, labelPosition, subLabelPosition }] = useSpring(\n    () => ({\n      from: {\n        nodePosition: position\n          ? [position.x, position.y, position.z]\n          : [0, 0, 0],\n        labelPosition: [0, -(nodeSize + 7), 2],\n        subLabelPosition: [0, -(nodeSize + 14), 2]\n      },\n      to: {\n        nodePosition: position\n          ? [position.x, position.y, position.z]\n          : [0, 0, 0],\n        labelPosition: [0, -(nodeSize + 7), 2],\n        subLabelPosition: [0, -(nodeSize + 14), 2]\n      },\n      config: {\n        ...animationConfig,\n        duration: animated && !draggingId ? undefined : 0\n      }\n    }),\n    [isDragging, position, animated, nodeSize]\n  );\n\n  const bind = useDrag({\n    draggable,\n    position,\n    // @ts-ignore\n    set: pos => setNodePosition(id, pos),\n    onDragStart: () => {\n      setDraggingId(id);\n      setActive(true);\n      cameraControls.controls.enabled = false;\n    },\n    onDragEnd: () => {\n      setDraggingId(null);\n      setActive(false);\n      cameraControls.controls.enabled = true;\n      onDragged?.(node);\n    }\n  });\n\n  useCursor(active && !draggingId && onClick !== undefined, 'pointer');\n  useCursor(\n    active && draggable && !isDragging && onClick === undefined,\n    'grab'\n  );\n  useCursor(isDragging, 'grabbing');\n\n  const combinedActiveState = isSelected || active || isDragging || isActive;\n  const color = combinedActiveState\n    ? theme.node.activeFill\n    : node.fill || theme.node.fill;\n\n  const { pointerOver, pointerOut } = useHoverIntent({\n    disabled: disabled || isDragging,\n    onPointerOver: () => {\n      setActive(true);\n      onPointerOver?.(node);\n    },\n    onPointerOut: () => {\n      setActive(false);\n      onPointerOut?.(node);\n    }\n  });\n\n  return (\n    <a.group\n      userData={{ id, type: 'node' }}\n      ref={group}\n      position={nodePosition as any}\n      onPointerOver={pointerOver}\n      onPointerOut={pointerOut}\n      onClick={() => {\n        if (!disabled && !isDragging) {\n          onClick?.(node, {\n            canCollapse,\n            isCollapsed\n          });\n        }\n      }}\n      onDoubleClick={() => {\n        if (!disabled && !isDragging) {\n          onDoubleClick?.(node);\n        }\n      }}\n      onContextMenu={() => {\n        if (!disabled) {\n          setMenuVisible(true);\n          onContextMenu?.(node, {\n            canCollapse,\n            isCollapsed,\n            onCollapse\n          });\n        }\n      }}\n      {...(bind() as any)}\n    >\n      {renderNode ? (\n        renderNode({\n          id,\n          color,\n          size: nodeSize,\n          active: combinedActiveState,\n          opacity: selectionOpacity,\n          animated,\n          node\n        })\n      ) : (\n        <>\n          {node.icon ? (\n            <Icon\n              id={id}\n              image={node.icon || ''}\n              size={nodeSize + 8}\n              opacity={selectionOpacity}\n              animated={animated}\n              color={color}\n              node={node}\n              active={combinedActiveState}\n            />\n          ) : (\n            <Sphere\n              id={id}\n              size={nodeSize}\n              opacity={selectionOpacity}\n              animated={animated}\n              color={color}\n              node={node}\n              active={combinedActiveState}\n            />\n          )}\n        </>\n      )}\n      <Ring\n        opacity={isSelected ? 0.5 : 0}\n        size={nodeSize}\n        animated={animated}\n        color={isSelected || active ? theme.ring.activeFill : theme.ring.fill}\n      />\n      {menuVisible && contextMenu && (\n        <Html prepend={true} center={true}>\n          {contextMenu({\n            data: node,\n            canCollapse,\n            isCollapsed,\n            onCollapse,\n            onClose: () => setMenuVisible(false)\n          })}\n        </Html>\n      )}\n      {(labelVisible || isSelected || active) && label && (\n        <>\n          <a.group position={labelPosition as any}>\n            <Label\n              text={label}\n              fontUrl={labelFontUrl}\n              opacity={selectionOpacity}\n              stroke={theme.node.label.stroke}\n              active={isSelected || active || isDragging || isActive}\n              color={\n                isSelected || active || isDragging || isActive\n                  ? theme.node.label.activeColor\n                  : theme.node.label.color\n              }\n            />\n          </a.group>\n          {subLabel && (\n            <a.group position={subLabelPosition as any}>\n              <Label\n                text={subLabel}\n                fontUrl={labelFontUrl}\n                fontSize={5}\n                opacity={selectionOpacity}\n                stroke={theme.node.subLabel?.stroke}\n                active={isSelected || active || isDragging || isActive}\n                color={\n                  isSelected || active || isDragging || isActive\n                    ? theme.node.subLabel?.activeColor\n                    : theme.node.subLabel?.color\n                }\n              />\n            </a.group>\n          )}\n        </>\n      )}\n    </a.group>\n  );\n};\n\nNode.defaultProps = {\n  draggable: false\n};\n","import React, { FC, useMemo, useRef, useEffect, useCallback } from 'react';\nimport { useSpring, a } from '@react-spring/three';\nimport { Color, ColorRepresentation, Mesh, DoubleSide, Vector3 } from 'three';\nimport { animationConfig } from '../utils';\nimport { useStore } from '../store';\n\nexport type EdgeArrowPosition = 'none' | 'mid' | 'end';\n\nexport interface ArrowProps {\n  /**\n   * Whether the arrow should be animated.\n   */\n  animated?: boolean;\n\n  /**\n   * The color of the arrow.\n   */\n  color?: ColorRepresentation;\n\n  /**\n   * The length of the arrow.\n   */\n  length: number;\n\n  /**\n   * The opacity of the arrow.\n   */\n  opacity?: number;\n\n  /**\n   * The position of the arrow in 3D space.\n   */\n  position: Vector3;\n\n  /**\n   * The rotation of the arrow in 3D space.\n   */\n  rotation: Vector3;\n\n  /**\n   * The size of the arrow.\n   */\n  size: number;\n\n  /**\n   * A function that is called when the arrow is right-clicked.\n   */\n  onContextMenu?: () => void;\n\n  /**\n   * A function that is called when the arrow is selected or deselected.\n   */\n  onActive?: (state: boolean) => void;\n}\n\nexport const Arrow: FC<ArrowProps> = ({\n  animated,\n  color,\n  length,\n  opacity,\n  position,\n  rotation,\n  size,\n  onActive,\n  onContextMenu\n}) => {\n  const normalizedColor = useMemo(() => new Color(color), [color]);\n  const meshRef = useRef<Mesh | null>(null);\n  const draggingId = useStore(state => state.draggingId);\n\n  const [{ pos, arrowOpacity }] = useSpring(\n    () => ({\n      from: {\n        pos: [position.x, position.y, position.z],\n        arrowOpacity: 0\n      },\n      to: {\n        pos: [position.x, position.y, position.z],\n        arrowOpacity: opacity\n      },\n      config: {\n        ...animationConfig,\n        duration: animated && !draggingId ? undefined : 0\n      }\n    }),\n    [animated, draggingId, opacity, position]\n  );\n\n  const setQuaternion = useCallback(() => {\n    const axis = new Vector3(0, 1, 0);\n    meshRef.current?.quaternion.setFromUnitVectors(axis, rotation);\n  }, [rotation, meshRef]);\n\n  useEffect(() => setQuaternion(), [setQuaternion]);\n\n  return (\n    <a.mesh\n      position={pos as any}\n      ref={meshRef}\n      scale={[1, 1, 1]}\n      onPointerOver={() => onActive(true)}\n      onPointerOut={() => onActive(false)}\n      onPointerDown={event => {\n        // context menu controls\n        if (event.nativeEvent.buttons === 2) {\n          event.stopPropagation();\n          onContextMenu();\n        }\n      }}\n    >\n      <cylinderGeometry\n        args={[0, size, length, 20, 1, true]}\n        attach=\"geometry\"\n      />\n      <a.meshBasicMaterial\n        attach=\"material\"\n        color={normalizedColor}\n        depthTest={false}\n        opacity={arrowOpacity}\n        transparent={true}\n        side={DoubleSide}\n        fog={true}\n      />\n    </a.mesh>\n  );\n};\n\nArrow.defaultProps = {\n  size: 1,\n  opacity: 0.5,\n  color: '#D8E6EA'\n};\n","import React, { FC, useMemo, useRef } from 'react';\nimport { useSpring, a } from '@react-spring/three';\nimport { animationConfig, getCurve } from '../utils';\nimport {\n  Vector3,\n  TubeGeometry,\n  ColorRepresentation,\n  Color,\n  Curve\n} from 'three';\nimport { useStore } from '../store';\nimport { ThreeEvent } from '@react-three/fiber';\n\nexport interface LineProps {\n  /**\n   * Whether the line should be animated.\n   */\n  animated?: boolean;\n  /**\n   * The color of the line.\n   */\n  color?: ColorRepresentation;\n  /**\n   * Whether the line should be curved.\n   */\n  curved: boolean;\n  /**\n   * The curve of the line in 3D space.\n   */\n  curve: Curve<Vector3>;\n  /**\n   * The unique identifier of the line.\n   */\n  id: string;\n  /**\n   * The opacity of the line.\n   */\n  opacity?: number;\n  /**\n   * The size of the line.\n   */\n  size?: number;\n  /**\n   * A function that is called when the line is clicked.\n   */\n  onClick?: () => void;\n  /**\n   * A function that is called when the line is right-clicked.\n   */\n  onContextMenu?: () => void;\n  /**\n   * A function that is called when the mouse pointer is moved over the line.\n   */\n  onPointerOver?: (event: ThreeEvent<PointerEvent>) => void;\n  /**\n   * A function that is called when the mouse pointer is moved out of the line.\n   */\n  onPointerOut?: (event: ThreeEvent<PointerEvent>) => void;\n  /**\n   * The offset of the curve.\n   */\n  curveOffset?: number;\n}\n\nexport const Line: FC<LineProps> = ({\n  curveOffset,\n  animated,\n  color,\n  curve,\n  curved = false,\n  id,\n  opacity,\n  size,\n  onContextMenu,\n  onClick,\n  onPointerOver,\n  onPointerOut\n}) => {\n  const tubeRef = useRef<TubeGeometry | null>(null);\n  const draggingId = useStore(state => state.draggingId);\n  const normalizedColor = useMemo(() => new Color(color), [color]);\n\n  // Do opacity seperate from vertices for perf\n  const { lineOpacity } = useSpring({\n    from: {\n      lineOpacity: 0\n    },\n    to: {\n      lineOpacity: opacity\n    },\n    config: {\n      ...animationConfig,\n      duration: animated ? undefined : 0\n    }\n  });\n\n  useSpring(() => {\n    const from = curve.getPoint(0);\n    const to = curve.getPoint(1);\n    return {\n      from: {\n        fromVertices: [to?.x, to?.y, to?.z || 0],\n        toVertices: [from?.x, from?.y, from?.z || 0]\n      },\n      to: {\n        fromVertices: [from?.x, from?.y, from?.z || 0],\n        toVertices: [to?.x, to?.y, to?.z || 0]\n      },\n      onChange: event => {\n        const { fromVertices, toVertices } = event.value;\n        const fromVector = new Vector3(...fromVertices);\n        const toVector = new Vector3(...toVertices);\n\n        const curve = getCurve(fromVector, 0, toVector, 0, curved, curveOffset);\n        tubeRef.current.copy(new TubeGeometry(curve, 20, size / 2, 5, false));\n      },\n      config: {\n        ...animationConfig,\n        duration: animated && !draggingId ? undefined : 0\n      }\n    };\n  }, [animated, draggingId, curve, size]);\n\n  return (\n    <mesh\n      userData={{ id, type: 'edge' }}\n      onPointerOver={onPointerOver}\n      onPointerOut={onPointerOut}\n      onClick={onClick}\n      onPointerDown={event => {\n        // context menu controls\n        if (event.nativeEvent.buttons === 2) {\n          event.stopPropagation();\n          onContextMenu();\n        }\n      }}\n    >\n      <tubeGeometry attach=\"geometry\" ref={tubeRef} />\n      <a.meshBasicMaterial\n        attach=\"material\"\n        opacity={lineOpacity}\n        fog={true}\n        transparent={true}\n        depthTest={false}\n        color={normalizedColor}\n      />\n    </mesh>\n  );\n};\n\nLine.defaultProps = {\n  color: '#000',\n  size: 1,\n  opacity: 1\n};\n","import React, { FC, useMemo, useState } from 'react';\nimport { useSpring, a } from '@react-spring/three';\nimport { Arrow, EdgeArrowPosition } from './Arrow';\nimport { Label } from './Label';\nimport {\n  animationConfig,\n  calculateEdgeCurveOffset,\n  getArrowSize,\n  getArrowVectors,\n  getCurve,\n  getLabelOffsetByType,\n  getMidPoint,\n  getVector\n} from '../utils';\nimport { Line } from './Line';\nimport { Theme } from '../themes';\nimport { useStore } from '../store';\nimport { ContextMenuEvent, InternalGraphEdge } from '../types';\nimport { Html, useCursor } from 'glodrei';\nimport { useHoverIntent } from '../utils/useHoverIntent';\nimport { Euler, Vector3 } from 'three';\n\n/**\n * Label positions relatively edge.\n *\n * - below: show label under the edge line\n * - above: show label above the edge line\n * - inline: show label along the edge line\n * - natural: normal text positions\n */\nexport type EdgeLabelPosition = 'below' | 'above' | 'inline' | 'natural';\n\n/**\n * Type of edge interpolation.\n *\n * - Linear is straight\n * - Curved is curved\n */\nexport type EdgeInterpolation = 'linear' | 'curved';\n\nexport interface EdgeProps {\n  /**\n   * The url for the label font.\n   */\n  labelFontUrl?: string;\n\n  /**\n   * The unique identifier of the edge.\n   */\n  id: string;\n\n  /**\n   * Whether the edge should be animated.\n   */\n  animated?: boolean;\n\n  /**\n   * Whether the edge should be disabled.\n   */\n  disabled?: boolean;\n\n  /**\n   * The placement of the edge label.\n   */\n  labelPlacement?: EdgeLabelPosition;\n\n  /**\n   * The placement of the edge arrow.\n   */\n  arrowPlacement?: EdgeArrowPosition;\n\n  /**\n   * The type of interpolation used to draw the edge.\n   */\n  interpolation: EdgeInterpolation;\n\n  /**\n   * A function that returns the context menu for the edge.\n   */\n  contextMenu?: (event: Partial<ContextMenuEvent>) => React.ReactNode;\n\n  /**\n   * A function that is called when the edge is clicked.\n   */\n  onClick?: (edge: InternalGraphEdge) => void;\n\n  /**\n   * A function that is called when the edge is right-clicked.\n   */\n  onContextMenu?: (edge?: InternalGraphEdge) => void;\n\n  /**\n   * A function that is called when the mouse pointer is moved over the edge.\n   */\n  onPointerOver?: (edge: InternalGraphEdge) => void;\n\n  /**\n   * A function that is called when the mouse pointer is moved out of the edge.\n   */\n  onPointerOut?: (edge: InternalGraphEdge) => void;\n}\n\nconst LABEL_PLACEMENT_OFFSET = 3;\n\nexport const Edge: FC<EdgeProps> = ({\n  animated,\n  arrowPlacement,\n  contextMenu,\n  disabled,\n  labelPlacement,\n  id,\n  interpolation,\n  labelFontUrl,\n  onContextMenu,\n  onClick,\n  onPointerOver,\n  onPointerOut\n}) => {\n  const theme = useStore(state => state.theme);\n  const draggingId = useStore(state => state.draggingId);\n\n  // UI states\n  const [active, setActive] = useState<boolean>(false);\n  const [menuVisible, setMenuVisible] = useState<boolean>(false);\n\n  // Edge data\n  const edges = useStore(state => state.edges);\n  const edge = edges.find(e => e.id === id);\n  const { target, source, label, labelVisible = false, size = 1 } = edge;\n  const from = useStore(store => store.nodes.find(node => node.id === source));\n  const to = useStore(store => store.nodes.find(node => node.id === target));\n\n  // Edge properties\n  const labelOffset = (size + theme.edge.label.fontSize) / 2;\n  const [arrowLength, arrowSize] = useMemo(() => getArrowSize(size), [size]);\n  const { curveOffset, curved } = useMemo(\n    () =>\n      calculateEdgeCurveOffset({\n        edge,\n        edges,\n        curved: interpolation === 'curved'\n      }),\n    [edge, edges, interpolation]\n  );\n\n  const [curve, arrowPosition, arrowRotation] = useMemo(() => {\n    const fromVector = getVector(from);\n    const fromOffset = from.size;\n    const toVector = getVector(to);\n    const toOffset = to.size;\n\n    let curve = getCurve(\n      fromVector,\n      fromOffset,\n      toVector,\n      toOffset,\n      curved,\n      curveOffset\n    );\n\n    const [arrowPosition, arrowRotation] = getArrowVectors(\n      arrowPlacement,\n      curve,\n      arrowLength\n    );\n\n    if (arrowPlacement === 'end') {\n      curve = getCurve(\n        fromVector,\n        fromOffset,\n        arrowPosition,\n        0,\n        curved,\n        curveOffset\n      );\n    }\n\n    return [curve, arrowPosition, arrowRotation];\n  }, [from, to, curved, curveOffset, arrowPlacement, arrowLength]);\n\n  const midPoint = useMemo(() => {\n    let newMidPoint = getMidPoint(\n      from.position,\n      to.position,\n      getLabelOffsetByType(labelOffset, labelPlacement)\n    );\n\n    if (curved) {\n      // Offset the label to the mid point of the curve\n      const offset = new Vector3().subVectors(newMidPoint, curve.getPoint(0.5));\n      switch (labelPlacement) {\n        case 'above':\n          offset.y = offset.y - LABEL_PLACEMENT_OFFSET;\n          break;\n        case 'below':\n          offset.y = offset.y + LABEL_PLACEMENT_OFFSET;\n          break;\n      }\n      newMidPoint = newMidPoint.sub(offset);\n    }\n\n    return newMidPoint;\n  }, [from.position, to.position, labelOffset, labelPlacement, curved, curve]);\n\n  const isSelected = useStore(state => state.selections?.includes(id));\n  const hasSelections = useStore(state => state.selections?.length);\n  const isActive = useStore(state => state.actives?.includes(id));\n\n  const selectionOpacity = hasSelections\n    ? isSelected || isActive\n      ? theme.edge.selectedOpacity\n      : theme.edge.inactiveOpacity\n    : theme.edge.opacity;\n\n  const [{ labelPosition }] = useSpring(\n    () => ({\n      from: {\n        labelPosition: [0, 0, 0]\n      },\n      to: {\n        labelPosition: [midPoint.x, midPoint.y, midPoint.z]\n      },\n      config: {\n        ...animationConfig,\n        duration: animated && !draggingId ? undefined : 0\n      }\n    }),\n    [midPoint, animated, draggingId]\n  );\n\n  const labelRotation = useMemo(\n    () =>\n      new Euler(\n        0,\n        0,\n        labelPlacement === 'natural'\n          ? 0\n          : Math.atan(\n              (to.position.y - from.position.y) /\n                (to.position.x - from.position.x)\n            )\n      ),\n    [\n      to.position.x,\n      to.position.y,\n      from.position.x,\n      from.position.y,\n      labelPlacement\n    ]\n  );\n\n  useCursor(active && !draggingId && onClick !== undefined, 'pointer');\n\n  const { pointerOver, pointerOut } = useHoverIntent({\n    disabled,\n    onPointerOver: () => {\n      setActive(true);\n      onPointerOver?.(edge);\n    },\n    onPointerOut: () => {\n      setActive(false);\n      onPointerOut?.(edge);\n    }\n  });\n\n  return (\n    <group>\n      <Line\n        curveOffset={curveOffset}\n        animated={animated}\n        color={\n          isSelected || active || isActive\n            ? theme.edge.activeFill\n            : theme.edge.fill\n        }\n        curve={curve}\n        curved={curved}\n        id={id}\n        opacity={selectionOpacity}\n        size={size}\n        onClick={() => {\n          if (!disabled) {\n            onClick?.(edge);\n          }\n        }}\n        onPointerOver={pointerOver}\n        onPointerOut={pointerOut}\n        onContextMenu={() => {\n          if (!disabled) {\n            setMenuVisible(true);\n            onContextMenu?.(edge);\n          }\n        }}\n      />\n      {arrowPlacement !== 'none' && (\n        <Arrow\n          animated={animated}\n          color={\n            isSelected || active || isActive\n              ? theme.arrow.activeFill\n              : theme.arrow.fill\n          }\n          length={arrowLength}\n          opacity={selectionOpacity}\n          position={arrowPosition}\n          rotation={arrowRotation}\n          size={arrowSize}\n          onActive={setActive}\n          onContextMenu={() => {\n            if (!disabled) {\n              setMenuVisible(true);\n              onContextMenu?.(edge);\n            }\n          }}\n        />\n      )}\n      {labelVisible && label && (\n        <a.group position={labelPosition as any} rotation={labelRotation}>\n          <Label\n            text={label}\n            ellipsis={15}\n            fontUrl={labelFontUrl}\n            stroke={theme.edge.label.stroke}\n            color={\n              isSelected || active || isActive\n                ? theme.edge.label.activeColor\n                : theme.edge.label.color\n            }\n            opacity={selectionOpacity}\n            fontSize={theme.edge.label.fontSize}\n          />\n        </a.group>\n      )}\n      {menuVisible && contextMenu && (\n        <Html prepend={true} center={true}>\n          {contextMenu({ data: edge, onClose: () => setMenuVisible(false) })}\n        </Html>\n      )}\n    </group>\n  );\n};\n\nEdge.defaultProps = {\n  labelPlacement: 'inline',\n  arrowPlacement: 'end'\n};\n","import { useCallback, useRef } from 'react';\nimport {\n  BoxGeometry,\n  BufferGeometry,\n  CylinderGeometry,\n  Quaternion,\n  TubeGeometry,\n  Vector3\n} from 'three';\nimport { mergeBufferGeometries } from 'three-stdlib';\n\nimport { GraphState, useStore } from '../../store';\nimport { InternalGraphEdge } from '../../types';\nimport {\n  getArrowSize,\n  getArrowVectors,\n  getVector,\n  getCurve\n} from '../../utils';\nimport { EdgeArrowPosition } from '../Arrow';\nimport { EdgeInterpolation } from '../Edge';\n\nexport type UseEdgeGeometry = {\n  getGeometries(edges: Array<InternalGraphEdge>): Array<BufferGeometry>;\n  getGeometry(\n    active: Array<InternalGraphEdge>,\n    inactive: Array<InternalGraphEdge>\n  ): BufferGeometry;\n};\n\nconst NULL_GEOMETRY = new BoxGeometry(0, 0, 0);\n\nexport function useEdgeGeometry(\n  arrowPlacement: EdgeArrowPosition,\n  interpolation: EdgeInterpolation\n): UseEdgeGeometry {\n  // We don't want to rerun everything when the state changes,\n  // but we do want to use the most recent nodes whenever `getGeometries`\n  // or `getGeometry` is run, so we store it in a ref:\n  const stateRef = useRef<GraphState>();\n  const theme = useStore(state => state.theme);\n  useStore(state => {\n    stateRef.current = state;\n  });\n\n  const geometryCacheRef = useRef(new Map<string, BufferGeometry>());\n\n  const curved = interpolation === 'curved';\n  const getGeometries = useCallback(\n    (edges: Array<InternalGraphEdge>): Array<BufferGeometry> => {\n      const geometries: Array<BufferGeometry> = [];\n      const cache = geometryCacheRef.current;\n\n      const { nodes } = stateRef.current;\n\n      edges.forEach(edge => {\n        const { target, source, size = 1 } = edge;\n\n        const from = nodes.find(node => node.id === source);\n        const to = nodes.find(node => node.id === target);\n\n        if (!from || !to) {\n          return;\n        }\n\n        // Create hash so geometry can be reused if edge doesn't move:\n        const hash = `fromX:${from.position.x},fromY:${from.position.y},toX:${to.position.x}},toY:${to.position.y}`;\n        if (cache.has(hash)) {\n          const geometry = cache.get(hash);\n          geometries.push(geometry);\n          return;\n        }\n\n        const fromVector = getVector(from);\n        const fromOffset = from.size + theme.edge.label.fontSize;\n        const toVector = getVector(to);\n        const toOffset = to.size + theme.edge.label.fontSize;\n        let curve = getCurve(\n          fromVector,\n          fromOffset,\n          toVector,\n          toOffset,\n          curved\n        );\n\n        let edgeGeometry = new TubeGeometry(curve, 20, size / 2, 5, false);\n\n        if (arrowPlacement === 'none') {\n          geometries.push(edgeGeometry);\n          cache.set(hash, edgeGeometry);\n          return;\n        }\n\n        const [arrowLength, arrowSize] = getArrowSize(size);\n\n        const [arrowPosition, arrowRotation] = getArrowVectors(\n          arrowPlacement,\n          curve,\n          arrowLength\n        );\n        const quaternion = new Quaternion();\n        quaternion.setFromUnitVectors(new Vector3(0, 1, 0), arrowRotation);\n\n        const arrowGeometry = new CylinderGeometry(\n          0,\n          arrowSize,\n          arrowLength,\n          20,\n          1,\n          true\n        );\n        arrowGeometry.applyQuaternion(quaternion);\n        arrowGeometry.translate(\n          arrowPosition.x,\n          arrowPosition.y,\n          arrowPosition.z\n        );\n\n        // Move edge so it doesn't stick through the arrow:\n        if (arrowPlacement && arrowPlacement === 'end') {\n          const curve = getCurve(\n            fromVector,\n            fromOffset,\n            arrowPosition,\n            0,\n            curved\n          );\n          edgeGeometry = new TubeGeometry(curve, 20, size / 2, 5, false);\n        }\n\n        const merged = mergeBufferGeometries([edgeGeometry, arrowGeometry]);\n        geometries.push(merged);\n        cache.set(hash, merged);\n      });\n      return geometries;\n    },\n    [arrowPlacement, curved, theme.edge.label.fontSize]\n  );\n\n  const getGeometry = useCallback(\n    (\n      active: Array<InternalGraphEdge>,\n      inactive: Array<InternalGraphEdge>\n    ): BufferGeometry => {\n      const activeGeometries = getGeometries(active);\n      const inactiveGeometries = getGeometries(inactive);\n\n      return mergeBufferGeometries(\n        [\n          inactiveGeometries.length\n            ? mergeBufferGeometries(inactiveGeometries)\n            : NULL_GEOMETRY,\n          activeGeometries.length\n            ? mergeBufferGeometries(activeGeometries)\n            : NULL_GEOMETRY\n        ],\n        true\n      );\n    },\n    [getGeometries]\n  );\n\n  return {\n    getGeometries,\n    getGeometry\n  };\n}\n","import { useCallback, useRef } from 'react';\n\nimport { useStore } from '../../store';\nimport { InternalGraphEdge } from '../../types';\n\nexport type EdgeEvents = {\n  onClick?: (edge: InternalGraphEdge) => void;\n  onContextMenu?: (edge?: InternalGraphEdge) => void;\n  onPointerOver?: (edge: InternalGraphEdge) => void;\n  onPointerOut?: (edge: InternalGraphEdge) => void;\n};\n\nexport function useEdgeEvents(\n  events: EdgeEvents,\n  contextMenu,\n  disabled: boolean\n) {\n  const { onClick, onContextMenu, onPointerOut, onPointerOver } = events;\n\n  const edgeContextMenus = useStore(state => state.edgeContextMenus);\n  const setEdgeContextMenus = useStore(state => state.setEdgeContextMenus);\n\n  const clickRef = useRef(false);\n  const handleClick = useCallback(() => {\n    clickRef.current = true;\n  }, []);\n\n  const contextMenuEventRef = useRef(false);\n  const handleContextMenu = useCallback(() => {\n    contextMenuEventRef.current = true;\n  }, []);\n\n  const handleIntersections = useCallback(\n    (\n      previous: Array<InternalGraphEdge>,\n      intersected: Array<InternalGraphEdge>\n    ) => {\n      if (onClick && clickRef.current) {\n        clickRef.current = false;\n        if (!disabled) {\n          intersected.forEach(edge => {\n            onClick(edge);\n          });\n        }\n      }\n\n      if ((contextMenu || onContextMenu) && contextMenuEventRef.current) {\n        contextMenuEventRef.current = false;\n        if (!disabled) {\n          intersected.forEach(edge => {\n            if (!edgeContextMenus.has(edge.id)) {\n              setEdgeContextMenus(new Set([...edgeContextMenus, edge.id]));\n              onContextMenu?.(edge);\n            }\n          });\n        }\n      }\n\n      if (onPointerOver) {\n        const over = intersected.filter(index => !previous.includes(index));\n        over.forEach(edge => {\n          onPointerOver(edge);\n        });\n      }\n\n      if (onPointerOut) {\n        const out = previous.filter(index => !intersected.includes(index));\n        out.forEach(edge => {\n          onPointerOut(edge);\n        });\n      }\n    },\n    [\n      contextMenu,\n      disabled,\n      edgeContextMenus,\n      setEdgeContextMenus,\n      onClick,\n      onContextMenu,\n      onPointerOver,\n      onPointerOut\n    ]\n  );\n\n  return {\n    handleClick,\n    handleContextMenu,\n    handleIntersections\n  };\n}\n","import { SpringValue, useSpring } from '@react-spring/three';\nimport { useCallback, useEffect, useRef } from 'react';\nimport { BufferAttribute, BufferGeometry } from 'three';\n\nimport { Theme } from '../../themes';\nimport { animationConfig } from '../../utils';\n\nexport function useEdgePositionAnimation(\n  geometry: BufferGeometry,\n  animated: boolean\n): void {\n  const geometryRef = useRef<BufferGeometry>(geometry);\n\n  useEffect(() => {\n    geometryRef.current = geometry;\n  }, [geometry]);\n\n  const getAnimationPositions = useCallback(() => {\n    const positions = geometryRef.current.getAttribute('position');\n    const from = Array.from({\n      length: positions.array.length\n    }).fill(0) as Array<number>;\n    const to = Array.from(positions.array);\n    return { from, to };\n  }, []);\n\n  const updateGeometryPosition = useCallback((positions: Array<number>) => {\n    const buffer = new Float32Array(positions);\n    const newPosition = new BufferAttribute(buffer, 3, false);\n    geometryRef.current.setAttribute('position', newPosition);\n    newPosition.needsUpdate = true;\n  }, []);\n\n  useSpring(() => {\n    if (!animated) {\n      return null;\n    }\n\n    const animationPositions = getAnimationPositions();\n\n    return {\n      from: {\n        positions: animationPositions.from\n      },\n      to: {\n        positions: animationPositions.to\n      },\n      onChange: event => {\n        updateGeometryPosition(event.value.positions);\n      },\n      config: {\n        ...animationConfig,\n        duration: animated ? undefined : 0\n      }\n    };\n  }, [animated]);\n}\n\nexport type UseEdgeOpacityAnimations = {\n  activeOpacity: SpringValue<number>;\n  inactiveOpacity: SpringValue<number>;\n};\n\nexport function useEdgeOpacityAnimation(\n  animated: boolean,\n  hasSelections: boolean,\n  theme: Theme\n): UseEdgeOpacityAnimations {\n  const [{ activeOpacity, inactiveOpacity }] = useSpring(() => {\n    return {\n      from: {\n        activeOpacity: 0,\n        inactiveOpacity: 0\n      },\n      to: {\n        activeOpacity: hasSelections\n          ? theme.edge.selectedOpacity\n          : theme.edge.opacity,\n        inactiveOpacity: hasSelections\n          ? theme.edge.inactiveOpacity\n          : theme.edge.opacity\n      },\n      config: {\n        ...animationConfig,\n        duration: animated ? undefined : 0\n      }\n    };\n  }, [animated, hasSelections, theme]);\n\n  return { activeOpacity, inactiveOpacity };\n}\n","import React, { FC, useCallback, useMemo } from 'react';\nimport { useSpring, a } from '@react-spring/three';\nimport { Html } from 'glodrei';\nimport { ColorRepresentation, Euler } from 'three';\n\nimport { useStore } from '../../store';\nimport { Theme } from '../../themes';\nimport { ContextMenuEvent, InternalGraphEdge } from '../../types';\nimport {\n  animationConfig,\n  getLabelOffsetByType,\n  getMidPoint\n} from '../../utils';\nimport { Label } from '../Label';\n\n/**\n * Label positions relatively edge\n *\n * below: show label under the edge line\n * above: show label above the edge line\n * inline: show label along the edge line\n * natural: normal text positions\n */\nexport type EdgeLabelPosition = 'below' | 'above' | 'inline' | 'natural';\n\nexport type EdgeArrowPosition = 'none' | 'mid' | 'end';\n\nexport interface EdgeProps {\n  /**\n   * Whether the edge should be animated.\n   */\n  animated?: boolean;\n\n  /**\n   * Whether the edge should be disabled.\n   */\n  disabled?: boolean;\n\n  /**\n   * The color of the edge.\n   */\n  color: ColorRepresentation;\n\n  /**\n   * A function that returns the context menu for the edge.\n   */\n  contextMenu?: (event: Partial<ContextMenuEvent>) => React.ReactNode;\n\n  /**\n   * The edge object.\n   */\n  edge: InternalGraphEdge;\n\n  /**\n   * The URL of the font for the edge label.\n   */\n  labelFontUrl?: string;\n\n  /**\n   * The placement of the edge label.\n   */\n  labelPlacement?: EdgeLabelPosition;\n\n  /**\n   * The opacity of the edge.\n   */\n  opacity?: number;\n}\n\nexport const Edge: FC<EdgeProps> = ({\n  animated,\n  color,\n  contextMenu,\n  edge,\n  labelFontUrl,\n  labelPlacement,\n  opacity\n}) => {\n  const theme = useStore(state => state.theme);\n  const { target, source, label, labelVisible = false, size = 1 } = edge;\n\n  const nodes = useStore(store => store.nodes);\n  const from = nodes.find(node => node.id === source);\n  const to = nodes.find(node => node.id === target);\n  const draggingId = useStore(state => state.draggingId);\n\n  const labelOffset = (size + theme.edge.label.fontSize) / 2;\n\n  const midPoint = useMemo(\n    () =>\n      getMidPoint(\n        from.position,\n        to.position,\n        getLabelOffsetByType(labelOffset, labelPlacement)\n      ),\n    [from.position, to.position, labelOffset, labelPlacement]\n  );\n\n  const edgeContextMenus = useStore(state => state.edgeContextMenus);\n  const setEdgeContextMenus = useStore(state => state.setEdgeContextMenus);\n\n  const [{ labelPosition }] = useSpring(\n    () => ({\n      from: {\n        labelPosition: [0, 0, 0]\n      },\n      to: {\n        labelPosition: [midPoint.x, midPoint.y, midPoint.z]\n      },\n      config: {\n        ...animationConfig,\n        duration: animated && !draggingId ? undefined : 0\n      }\n    }),\n    [midPoint, animated, draggingId]\n  );\n\n  const removeContextMenu = useCallback(\n    (edge: InternalGraphEdge) => {\n      edgeContextMenus.delete(edge.id);\n      setEdgeContextMenus(new Set(edgeContextMenus.values()));\n    },\n    [edgeContextMenus, setEdgeContextMenus]\n  );\n\n  const labelRotation = useMemo(\n    () =>\n      new Euler(\n        0,\n        0,\n        labelPlacement === 'natural'\n          ? 0\n          : Math.atan(\n              (to.position.y - from.position.y) /\n                (to.position.x - from.position.x)\n            )\n      ),\n    [\n      to.position.x,\n      to.position.y,\n      from.position.x,\n      from.position.y,\n      labelPlacement\n    ]\n  );\n\n  return (\n    <group>\n      {labelVisible && label && (\n        <a.group position={labelPosition as any} rotation={labelRotation}>\n          <Label\n            text={label}\n            ellipsis={15}\n            fontUrl={labelFontUrl}\n            stroke={theme.edge.label.stroke}\n            color={color}\n            opacity={opacity}\n            fontSize={theme.edge.label.fontSize}\n          />\n        </a.group>\n      )}\n      {contextMenu && edgeContextMenus.has(edge.id) && (\n        <Html prepend={true} center={true} position={midPoint}>\n          {contextMenu({\n            data: edge,\n            onClose: () => removeContextMenu(edge)\n          })}\n        </Html>\n      )}\n    </group>\n  );\n};\n\nEdge.defaultProps = {\n  labelPlacement: 'inline'\n};\n","import React, { FC, useCallback, useEffect, useMemo, useRef } from 'react';\nimport { a } from '@react-spring/three';\nimport { useFrame } from '@react-three/fiber';\nimport { DoubleSide, Mesh, Raycaster, TubeGeometry } from 'three';\n\nimport { useStore } from '../../store';\nimport { ContextMenuEvent, InternalGraphEdge } from '../../types';\nimport { EdgeArrowPosition } from '../Arrow';\nimport { EdgeLabelPosition, EdgeInterpolation } from '../Edge';\nimport { useEdgeGeometry } from './useEdgeGeometry';\nimport { EdgeEvents, useEdgeEvents } from './useEdgeEvents';\nimport {\n  useEdgePositionAnimation,\n  useEdgeOpacityAnimation\n} from './useEdgeAnimations';\nimport { Edge } from './Edge';\n\nexport type EdgesProps = {\n  /**\n   * Whether the edge should be animated.\n   */\n  animated?: boolean;\n\n  /**\n   * The placement of the edge arrow.\n   */\n  arrowPlacement?: EdgeArrowPosition;\n\n  /**\n   * A function that returns the context menu for the edge.\n   */\n  contextMenu?: (event: Partial<ContextMenuEvent>) => React.ReactNode;\n\n  /**\n   * Whether the edge should be disabled.\n   */\n  disabled?: boolean;\n\n  /**\n   * The array of edge objects.\n   */\n  edges: Array<InternalGraphEdge>;\n\n  /**\n   * The URL of the font for the edge label.\n   */\n  labelFontUrl?: string;\n\n  /**\n   * The placement of the edge label.\n   */\n  labelPlacement?: EdgeLabelPosition;\n\n  /**\n   * The type of interpolation used to draw the edge.\n   */\n  interpolation?: EdgeInterpolation;\n} & EdgeEvents;\n\n/**\n * Three.js rendering starts to get slower if you have an individual mesh for each edge\n * and a high number of edges.\n *\n * Instead, we take the edges and split them into their different render states:\n *\n *  * - Active (any edges that are marked as \"selected\" or \"active\" in the state)\n *  * - Dragging (any edges that are connected to a node that is being dragged)\n *  * - Intersecting (any edges that are currently intersected by the ray from the mouse position)\n *  * - Inactive (any edges that aren't active, dragging, or intersected)\n *\n * We generate the geometry for each edge in each of these groups, and then merge them\n * into a single geometry for each group. This merged mesh is rendered as one object\n * which gives much better performance. This means that we only need to update geometry\n * and positions when edges move between the different states, rather than updating all\n * edges whenever any other edge changes.\n *\n * To get this all working, we have to do a few things outside the @react-three/fiber world,\n * specifically:\n *\n *  * manually create edge/arrow geometries (see `useEdgeGeometry`)\n *  * manually track mouse/edge interactions and fire events (see `useEdgeEvents`)\n *  * manually update edge/arrow positions during aniamations (see `useEdgeAnimations`)\n */\nexport const Edges: FC<EdgesProps> = ({\n  interpolation = 'linear',\n  arrowPlacement = 'end',\n  labelPlacement = 'inline',\n  animated,\n  contextMenu,\n  disabled,\n  edges,\n  labelFontUrl,\n  onClick,\n  onContextMenu,\n  onPointerOut,\n  onPointerOver\n}) => {\n  const theme = useStore(state => state.theme);\n  const { getGeometries, getGeometry } = useEdgeGeometry(\n    arrowPlacement,\n    interpolation\n  );\n\n  const draggingId = useStore(state => state.draggingId);\n  const edgeMeshes = useStore(state => state.edgeMeshes);\n  const setEdgeMeshes = useStore(state => state.setEdgeMeshes);\n  const actives = useStore(state => state.actives || []);\n  const selections = useStore(state => state.selections || []);\n\n  const [active, inactive, draggingActive, draggingInactive] = useMemo(() => {\n    const active: Array<InternalGraphEdge> = [];\n    const inactive: Array<InternalGraphEdge> = [];\n    const draggingActive: Array<InternalGraphEdge> = [];\n    const draggingInactive: Array<InternalGraphEdge> = [];\n    edges.forEach(edge => {\n      if (draggingId === edge.source || draggingId === edge.target) {\n        if (selections.includes(edge.id) || actives.includes(edge.id)) {\n          draggingActive.push(edge);\n        } else {\n          draggingInactive.push(edge);\n        }\n        return;\n      }\n\n      if (selections.includes(edge.id) || actives.includes(edge.id)) {\n        active.push(edge);\n      } else {\n        inactive.push(edge);\n      }\n    });\n    return [active, inactive, draggingActive, draggingInactive];\n  }, [edges, actives, selections, draggingId]);\n\n  const hasSelections = !!selections.length;\n\n  const staticEdgesGeometry = useMemo(\n    () => getGeometry(active, inactive),\n    [getGeometry, active, inactive]\n  );\n\n  const { activeOpacity, inactiveOpacity } = useEdgeOpacityAnimation(\n    animated,\n    hasSelections,\n    theme\n  );\n\n  useEdgePositionAnimation(staticEdgesGeometry, animated);\n\n  useEffect(() => {\n    if (draggingId === null) {\n      const edgeGeometries = getGeometries(edges);\n      const edgeMeshes = edgeGeometries.map(edge => new Mesh(edge));\n      setEdgeMeshes(edgeMeshes);\n    }\n  }, [getGeometries, setEdgeMeshes, edges, draggingId]);\n\n  const staticEdgesRef = useRef(new Mesh());\n  const dynamicEdgesRef = useRef(new Mesh());\n\n  const intersect = useCallback(\n    (raycaster: Raycaster): Array<InternalGraphEdge> => {\n      // Handle initial raycaster state:\n      if (!raycaster.camera) {\n        return [];\n      }\n      const intersections =\n        raycaster.intersectObjects<Mesh<TubeGeometry>>(edgeMeshes);\n      if (!intersections.length) {\n        return [];\n      }\n      return intersections.map(\n        intersection => edges[edgeMeshes.indexOf(intersection.object)]\n      );\n    },\n    [edgeMeshes, edges]\n  );\n\n  const { handleClick, handleContextMenu, handleIntersections } = useEdgeEvents(\n    {\n      onClick,\n      onContextMenu,\n      onPointerOut,\n      onPointerOver\n    },\n    contextMenu,\n    disabled\n  );\n\n  const draggingIdRef = useRef<string | null>(null);\n  const intersectingRef = useRef<Array<InternalGraphEdge>>([]);\n\n  useFrame(state => {\n    staticEdgesRef.current.geometry = staticEdgesGeometry;\n\n    if (disabled) {\n      return;\n    }\n\n    const previousDraggingId = draggingIdRef.current;\n    if (draggingId || (draggingId === null && previousDraggingId !== null)) {\n      dynamicEdgesRef.current.geometry = getGeometry(\n        draggingActive,\n        draggingInactive\n      );\n    }\n\n    draggingIdRef.current = draggingId;\n    if (draggingId) {\n      return;\n    }\n\n    const previousIntersecting = intersectingRef.current;\n    const intersecting = intersect(state.raycaster);\n    handleIntersections(previousIntersecting, intersecting);\n\n    if (intersecting.join() !== previousIntersecting.join()) {\n      dynamicEdgesRef.current.geometry = getGeometry(intersecting, []);\n    }\n\n    intersectingRef.current = intersecting;\n  });\n\n  return (\n    <group onClick={handleClick} onContextMenu={handleContextMenu}>\n      {/* Static edges */}\n      <mesh ref={staticEdgesRef}>\n        <a.meshBasicMaterial\n          attach=\"material-0\"\n          color={theme.edge.fill}\n          depthTest={false}\n          fog={true}\n          opacity={inactiveOpacity}\n          side={DoubleSide}\n          transparent={true}\n        />\n        <a.meshBasicMaterial\n          attach=\"material-1\"\n          color={theme.edge.activeFill}\n          depthTest={false}\n          fog={true}\n          opacity={activeOpacity}\n          side={DoubleSide}\n          transparent={true}\n        />\n      </mesh>\n\n      {/* Dynamic edges */}\n      <mesh ref={dynamicEdgesRef}>\n        <a.meshBasicMaterial\n          attach=\"material-0\"\n          color={theme.edge.fill}\n          depthTest={false}\n          fog={true}\n          opacity={inactiveOpacity}\n          side={DoubleSide}\n          transparent={true}\n        />\n        <a.meshBasicMaterial\n          attach=\"material-1\"\n          color={theme.edge.activeFill}\n          depthTest={false}\n          fog={true}\n          opacity={activeOpacity}\n          side={DoubleSide}\n          transparent={true}\n        />\n      </mesh>\n\n      {edges.map(edge => (\n        <Edge\n          animated={animated}\n          contextMenu={contextMenu}\n          color={theme.edge.label.color}\n          disabled={disabled}\n          edge={edge}\n          key={edge.id}\n          labelFontUrl={labelFontUrl}\n          labelPlacement={labelPlacement}\n        />\n      ))}\n    </group>\n  );\n};\n","import React, { FC, useMemo, useState } from 'react';\nimport { ClusterGroup, animationConfig, useHoverIntent } from '../utils';\nimport { useSpring, a } from '@react-spring/three';\nimport { Color, DoubleSide } from 'three';\nimport { useStore } from '../store';\nimport { Label } from './Label';\nimport { useCursor } from 'glodrei';\n\nexport type ClusterEventArgs = Omit<ClusterGroup, 'position'>;\n\nexport interface ClusterProps extends ClusterGroup {\n  /**\n   * Whether the circle should be animated.\n   */\n  animated?: boolean;\n\n  /**\n   * The radius of the circle. Default 1.\n   */\n  radius?: number;\n\n  /**\n   * The padding of the circle. Default 20.\n   */\n  padding?: number;\n\n  /**\n   * The url for the label font.\n   */\n  labelFontUrl?: string;\n\n  /**\n   * Whether the node is disabled.\n   */\n  disabled?: boolean;\n\n  /**\n   * When the cluster was clicked.\n   */\n  onClick?: (cluster: ClusterEventArgs) => void;\n\n  /**\n   * When a cluster recieves a pointer over event.\n   */\n  onPointerOver?: (cluster: ClusterEventArgs) => void;\n\n  /**\n   * When cluster recieves a pointer leave event.\n   */\n  onPointerOut?: (cluster: ClusterEventArgs) => void;\n}\n\nexport const Cluster: FC<ClusterProps> = ({\n  animated,\n  position,\n  padding,\n  labelFontUrl,\n  disabled,\n  radius,\n  nodes,\n  label,\n  onClick,\n  onPointerOver,\n  onPointerOut\n}) => {\n  const theme = useStore(state => state.theme);\n  const rad = Math.max(position.width, position.height) / 2;\n  const offset = rad - radius + padding;\n  const [active, setActive] = useState<boolean>(false);\n\n  const isActive = useStore(state =>\n    state.actives?.some(id => nodes.some(n => n.id === id))\n  );\n\n  const isSelected = useStore(state =>\n    state.selections?.some(id => nodes.some(n => n.id === id))\n  );\n\n  const hasSelections = useStore(state => state.selections?.length > 0);\n\n  const opacity = hasSelections\n    ? isSelected || active || isActive\n      ? theme.cluster?.selectedOpacity\n      : theme.cluster?.inactiveOpacity\n    : theme.cluster?.opacity;\n\n  const { circleOpacity, circlePosition, labelPosition } = useSpring({\n    from: {\n      circlePosition: position ? [position.x, position.y, -1] : [0, 0, -1],\n      circleOpacity: 0,\n      labelPosition: [0, -offset, 2]\n    },\n    to: {\n      labelPosition: [0, -offset, 2],\n      circlePosition: position ? [position.x, position.y, -1] : [0, 0, -1],\n      circleOpacity: opacity\n    },\n    config: {\n      ...animationConfig,\n      duration: animated ? undefined : 0\n    }\n  });\n\n  const normalizedStroke = useMemo(\n    () => new Color(theme.cluster?.stroke),\n    [theme.cluster?.stroke]\n  );\n\n  const normalizedFill = useMemo(\n    () => new Color(theme.cluster?.fill),\n    [theme.cluster?.fill]\n  );\n\n  useCursor(active && onClick !== undefined, 'pointer');\n\n  const { pointerOver, pointerOut } = useHoverIntent({\n    disabled,\n    onPointerOver: () => {\n      setActive(true);\n      onPointerOver?.({\n        nodes,\n        label\n      });\n    },\n    onPointerOut: () => {\n      setActive(false);\n      onPointerOut?.({\n        nodes,\n        label\n      });\n    }\n  });\n\n  return (\n    <>\n      {theme.cluster && (\n        <a.group\n          position={circlePosition as any}\n          onPointerOver={pointerOver}\n          onPointerOut={pointerOut}\n          onClick={() => {\n            if (!disabled) {\n              onClick?.({\n                nodes,\n                label\n              });\n            }\n          }}\n        >\n          <mesh>\n            <ringGeometry attach=\"geometry\" args={[offset, 0, 128]} />\n            <a.meshBasicMaterial\n              attach=\"material\"\n              color={normalizedFill}\n              transparent={true}\n              depthTest={false}\n              opacity={theme.cluster?.fill ? circleOpacity : 0}\n              side={DoubleSide}\n              fog={true}\n            />\n          </mesh>\n          <mesh>\n            <ringGeometry\n              attach=\"geometry\"\n              args={[offset, rad + padding, 128]}\n            />\n            <a.meshBasicMaterial\n              attach=\"material\"\n              color={normalizedStroke}\n              transparent={true}\n              depthTest={false}\n              opacity={circleOpacity}\n              side={DoubleSide}\n              fog={true}\n            />\n          </mesh>\n          {theme.cluster?.label && (\n            <a.group position={labelPosition as any}>\n              <Label\n                text={label}\n                opacity={opacity}\n                fontUrl={labelFontUrl}\n                stroke={theme.cluster.label.stroke}\n                active={false}\n                color={theme.cluster?.label.color}\n                fontSize={12}\n              />\n            </a.group>\n          )}\n        </a.group>\n      )}\n    </>\n  );\n};\n\nCluster.defaultProps = {\n  radius: 2,\n  padding: 40\n};\n","import React, {\n  FC,\n  forwardRef,\n  Fragment,\n  ReactNode,\n  Ref,\n  useEffect,\n  useImperativeHandle,\n  useMemo\n} from 'react';\nimport { useGraph } from './useGraph';\nimport { LayoutOverrides, LayoutTypes } from './layout';\nimport {\n  NodeContextMenuProps,\n  ContextMenuEvent,\n  GraphEdge,\n  GraphNode,\n  InternalGraphEdge,\n  InternalGraphNode,\n  NodeRenderer,\n  CollapseProps\n} from './types';\nimport { SizingType } from './sizing';\nimport {\n  Cluster,\n  ClusterEventArgs,\n  Edge,\n  EdgeArrowPosition,\n  EdgeInterpolation,\n  EdgeLabelPosition,\n  Edges,\n  Node\n} from './symbols';\nimport { useCameraControls, useCenterGraph } from './CameraControls';\nimport { LabelVisibilityType } from './utils';\nimport { Theme } from './themes';\nimport { useStore } from './store';\nimport Graph from 'graphology';\n\nexport interface GraphSceneProps {\n  /**\n   * Theme to use for the graph.\n   */\n  theme: Theme;\n\n  /**\n   * Type of layout.\n   */\n  layoutType?: LayoutTypes;\n\n  /**\n   * List of ids that are selected.\n   */\n  selections?: string[];\n\n  /**\n   * List of ids that are active.\n   */\n  actives?: string[];\n\n  /**\n   * List of node ids that are collapsed.\n   */\n  collapsedNodeIds?: string[];\n\n  /**\n   * Animate or not the graph positions.\n   */\n  animated?: boolean;\n\n  /**\n   * Nodes to pass to the graph.\n   */\n  nodes: GraphNode[];\n\n  /**\n   * Edges to pass to the graph.\n   */\n  edges: GraphEdge[];\n\n  /**\n   * Context menu element.\n   */\n  contextMenu?: (event: ContextMenuEvent) => ReactNode;\n\n  /**\n   * Type of sizing for nodes.\n   */\n  sizingType?: SizingType;\n\n  /**\n   * Type of visibility for labels.\n   */\n  labelType?: LabelVisibilityType;\n\n  /**\n   * Place of visibility for edge labels.\n   */\n  edgeLabelPosition?: EdgeLabelPosition;\n\n  /**\n   * Placement of edge arrows.\n   */\n  edgeArrowPosition?: EdgeArrowPosition;\n\n  /**\n   * Shape of edge.\n   */\n  edgeInterpolation?: EdgeInterpolation;\n\n  /**\n   * Font of label, same as troika-three-text\n   * The URL of a custom font file to be used. Supported font formats are: * .ttf * .otf * .woff (.woff2 is not supported)\n   * Default: The Roboto font loaded from Google Fonts CDN\n   */\n  labelFontUrl?: string;\n\n  /**\n   * Attribute based sizing property.\n   */\n  sizingAttribute?: string;\n\n  /**\n   * The default size to size nodes to. Default is 7.\n   */\n  defaultNodeSize?: number;\n\n  /**\n   * When using sizing attributes, the min size a node can be.\n   */\n  minNodeSize?: number;\n\n  /**\n   * When using sizing attributes, the max size a node can be.\n   */\n  maxNodeSize?: number;\n\n  /**\n   * Attribute used for clustering.\n   */\n  clusterAttribute?: string;\n\n  /**\n   * Disable interactions or not.\n   */\n  disabled?: boolean;\n\n  /**\n   * Allow dragging of nodes.\n   */\n  draggable?: boolean;\n\n  /**\n   * Render a custom node\n   */\n  renderNode?: NodeRenderer;\n\n  /**\n   * Advanced overrides for the layout.\n   */\n  layoutOverrides?: LayoutOverrides;\n\n  /**\n   * When a node was clicked.\n   */\n  onNodeClick?: (node: InternalGraphNode, props?: CollapseProps) => void;\n\n  /**\n   * When a node was double clicked.\n   */\n  onNodeDoubleClick?: (node: InternalGraphNode) => void;\n\n  /**\n   * When a node context menu happened.\n   */\n  onNodeContextMenu?: (\n    node: InternalGraphNode,\n    props?: NodeContextMenuProps\n  ) => void;\n\n  /**\n   * When node got a pointer over.\n   */\n  onNodePointerOver?: (node: InternalGraphNode) => void;\n\n  /**\n   * When node lost pointer over.\n   */\n  onNodePointerOut?: (node: InternalGraphNode) => void;\n\n  /**\n   * Triggered after a node was dragged.\n   */\n  onNodeDragged?: (node: InternalGraphNode) => void;\n\n  /**\n   * When a edge context menu happened.\n   */\n  onEdgeContextMenu?: (edge?: InternalGraphEdge) => void;\n\n  /**\n   * When an edge was clicked.\n   */\n  onEdgeClick?: (edge: InternalGraphEdge) => void;\n\n  /**\n   * When edge got a pointer over.\n   */\n  onEdgePointerOver?: (edge: InternalGraphEdge) => void;\n\n  /**\n   * When edge lost pointer over.\n   */\n  onEdgePointerOut?: (edge: InternalGraphEdge) => void;\n\n  /**\n   * When a cluster was clicked.\n   */\n  onClusterClick?: (cluster: ClusterEventArgs) => void;\n\n  /**\n   * When a cluster recieves a pointer over event.\n   */\n  onClusterPointerOver?: (cluster: ClusterEventArgs) => void;\n\n  /**\n   * When cluster recieves a pointer leave event.\n   */\n  onClusterPointerOut?: (cluster: ClusterEventArgs) => void;\n}\n\nexport interface GraphSceneRef {\n  /**\n   * Reference to the graph object.\n   */\n  graph: Graph;\n\n  /**\n   * Center the graph on a node or list of nodes.\n   */\n  centerGraph: (ids?: string[]) => void;\n}\n\nexport const GraphScene: FC<GraphSceneProps & { ref?: Ref<GraphSceneRef> }> =\n  forwardRef(\n    (\n      {\n        onNodeClick,\n        onNodeDoubleClick,\n        onNodeContextMenu,\n        onEdgeContextMenu,\n        onEdgeClick,\n        onEdgePointerOver,\n        onEdgePointerOut,\n        onNodePointerOver,\n        onNodePointerOut,\n        onClusterClick,\n        onNodeDragged,\n        onClusterPointerOver,\n        onClusterPointerOut,\n        contextMenu,\n        theme,\n        animated,\n        disabled,\n        draggable,\n        edgeLabelPosition,\n        edgeArrowPosition,\n        edgeInterpolation,\n        labelFontUrl,\n        renderNode,\n        ...rest\n      },\n      ref\n    ) => {\n      const { layoutType, clusterAttribute } = rest;\n      const { mounted } = useGraph(rest);\n      const { controls } = useCameraControls();\n\n      // Disable controls after mounted graph\n      useEffect(() => {\n        if (disabled && mounted) {\n          controls.enabled = !disabled;\n          controls.update(0);\n        }\n      }, [disabled, mounted]);\n\n      if (\n        clusterAttribute &&\n        !(layoutType === 'forceDirected2d' || layoutType === 'forceDirected3d')\n      ) {\n        throw new Error(\n          'Clustering is only supported for the force directed layouts.'\n        );\n      }\n\n      const graph = useStore(state => state.graph);\n      const nodes = useStore(state => state.nodes);\n      const edges = useStore(state => state.edges);\n      const clusters = useStore(state => [...state.clusters.values()]);\n\n      const nodeIds = useMemo(() => nodes.map(n => n.id), [nodes]);\n      const edgeIds = useMemo(() => edges.map(e => e.id), [edges]);\n\n      const { centerNodesById } = useCenterGraph({\n        animated\n      });\n\n      useImperativeHandle(\n        ref,\n        () => ({\n          centerGraph: centerNodesById,\n          graph\n        }),\n        [centerNodesById, graph]\n      );\n\n      return (\n        <Fragment>\n          {mounted && (\n            <Fragment>\n              {nodeIds.map(n => (\n                <Node\n                  key={n}\n                  id={n}\n                  labelFontUrl={labelFontUrl}\n                  draggable={draggable}\n                  disabled={disabled}\n                  animated={animated}\n                  contextMenu={contextMenu}\n                  renderNode={renderNode}\n                  onClick={onNodeClick}\n                  onDoubleClick={onNodeDoubleClick}\n                  onContextMenu={onNodeContextMenu}\n                  onPointerOver={onNodePointerOver}\n                  onPointerOut={onNodePointerOut}\n                  onDragged={onNodeDragged}\n                />\n              ))}\n              {animated ? (\n                edgeIds.map(e => (\n                  <Edge\n                    key={e}\n                    id={e}\n                    disabled={disabled}\n                    animated={animated}\n                    labelFontUrl={labelFontUrl}\n                    labelPlacement={edgeLabelPosition}\n                    arrowPlacement={edgeArrowPosition}\n                    interpolation={edgeInterpolation}\n                    contextMenu={contextMenu}\n                    onClick={onEdgeClick}\n                    onContextMenu={onEdgeContextMenu}\n                    onPointerOver={onEdgePointerOver}\n                    onPointerOut={onEdgePointerOut}\n                  />\n                ))\n              ) : (\n                <Edges\n                  edges={edges}\n                  disabled={disabled}\n                  animated={animated}\n                  labelFontUrl={labelFontUrl}\n                  labelPlacement={edgeLabelPosition}\n                  arrowPlacement={edgeArrowPosition}\n                  interpolation={edgeInterpolation}\n                  contextMenu={contextMenu}\n                  onClick={onEdgeClick}\n                  onContextMenu={onEdgeContextMenu}\n                  onPointerOver={onEdgePointerOver}\n                  onPointerOut={onEdgePointerOut}\n                />\n              )}\n              {clusters.map(c => (\n                <Cluster\n                  key={c.label}\n                  animated={animated}\n                  disabled={disabled}\n                  labelFontUrl={labelFontUrl}\n                  onClick={onClusterClick}\n                  onPointerOver={onClusterPointerOver}\n                  onPointerOut={onClusterPointerOut}\n                  {...c}\n                />\n              ))}\n            </Fragment>\n          )}\n        </Fragment>\n      );\n    }\n  );\n\nGraphScene.defaultProps = {\n  edgeInterpolation: 'linear'\n};\n","import { Theme } from './theme';\n\nexport const darkTheme: Theme = {\n  canvas: {\n    background: '#1E2026'\n  },\n  node: {\n    fill: '#7A8C9E',\n    activeFill: '#1DE9AC',\n    opacity: 1,\n    selectedOpacity: 1,\n    inactiveOpacity: 0.2,\n    label: {\n      stroke: '#1E2026',\n      color: '#ACBAC7',\n      activeColor: '#1DE9AC'\n    },\n    subLabel: {\n      stroke: '#1E2026',\n      color: '#ACBAC7',\n      activeColor: '#1DE9AC'\n    }\n  },\n  lasso: {\n    border: '1px solid #55aaff',\n    background: 'rgba(75, 160, 255, 0.1)'\n  },\n  ring: {\n    fill: '#54616D',\n    activeFill: '#1DE9AC'\n  },\n  edge: {\n    fill: '#474B56',\n    activeFill: '#1DE9AC',\n    opacity: 1,\n    selectedOpacity: 1,\n    inactiveOpacity: 0.1,\n    label: {\n      stroke: '#1E2026',\n      color: '#ACBAC7',\n      activeColor: '#1DE9AC',\n      fontSize: 6\n    }\n  },\n  arrow: {\n    fill: '#474B56',\n    activeFill: '#1DE9AC'\n  },\n  cluster: {\n    stroke: '#474B56',\n    opacity: 1,\n    selectedOpacity: 1,\n    inactiveOpacity: 0.1,\n    label: {\n      stroke: '#1E2026',\n      color: '#ACBAC7'\n    }\n  }\n};\n","import { Theme } from './theme';\n\nexport const lightTheme: Theme = {\n  canvas: {\n    background: '#fff'\n  },\n  node: {\n    fill: '#7CA0AB',\n    activeFill: '#1DE9AC',\n    opacity: 1,\n    selectedOpacity: 1,\n    inactiveOpacity: 0.2,\n    label: {\n      color: '#2A6475',\n      stroke: '#fff',\n      activeColor: '#1DE9AC'\n    },\n    subLabel: {\n      color: '#ddd',\n      stroke: 'transparent',\n      activeColor: '#1DE9AC'\n    }\n  },\n  lasso: {\n    border: '1px solid #55aaff',\n    background: 'rgba(75, 160, 255, 0.1)'\n  },\n  ring: {\n    fill: '#D8E6EA',\n    activeFill: '#1DE9AC'\n  },\n  edge: {\n    fill: '#D8E6EA',\n    activeFill: '#1DE9AC',\n    opacity: 1,\n    selectedOpacity: 1,\n    inactiveOpacity: 0.1,\n    label: {\n      stroke: '#fff',\n      color: '#2A6475',\n      activeColor: '#1DE9AC',\n      fontSize: 6\n    }\n  },\n  arrow: {\n    fill: '#D8E6EA',\n    activeFill: '#1DE9AC'\n  },\n  cluster: {\n    stroke: '#D8E6EA',\n    opacity: 1,\n    selectedOpacity: 1,\n    inactiveOpacity: 0.1,\n    label: {\n      stroke: '#fff',\n      color: '#2A6475'\n    }\n  }\n};\n","import { Theme } from '../themes';\nimport Graph from 'graphology';\n\nexport type PathSelectionTypes = 'direct' | 'out' | 'in' | 'all';\n\n/**\n * Given a graph and a list of node ids, return the adjacent nodes and edges.\n *\n * TODO: This method could be improved with the introduction of graphology\n */\nexport function getAdjacents(\n  graph: Graph,\n  nodeIds: string | string[],\n  type: PathSelectionTypes\n) {\n  nodeIds = Array.isArray(nodeIds) ? nodeIds : [nodeIds];\n\n  const nodes: string[] = [];\n  const edges: string[] = [];\n\n  for (const nodeId of nodeIds) {\n    const graphLinks = [\n      ...(graph.inEdgeEntries(nodeId) ?? []),\n      ...(graph.outEdgeEntries(nodeId) ?? [])\n    ];\n\n    if (!graphLinks) {\n      continue;\n    }\n\n    for (const link of graphLinks) {\n      const linkId = link.attributes.id;\n\n      if (type === 'in') {\n        if (link.target === nodeId && !edges.includes(linkId)) {\n          edges.push(linkId);\n        }\n      } else if (type === 'out') {\n        if (link.source === nodeId && !edges.includes(linkId)) {\n          edges.push(linkId);\n        }\n      } else {\n        if (!edges.includes(linkId)) {\n          edges.push(linkId);\n        }\n      }\n\n      if (type === 'out' || type === 'all') {\n        const toId = link.target;\n        if (!nodes.includes(toId as string)) {\n          nodes.push(toId as string);\n        }\n      }\n\n      if (type === 'in' || type === 'all') {\n        if (!nodes.includes(link.source)) {\n          nodes.push(link.source as string);\n        }\n      }\n    }\n  }\n\n  return {\n    nodes,\n    edges\n  };\n}\n\n/**\n * Set the vectors.\n */\nexport function prepareRay(event, vec, size) {\n  const { offsetX, offsetY } = event;\n  const { width, height } = size;\n  vec.set((offsetX / width) * 2 - 1, -(offsetY / height) * 2 + 1);\n}\n\n/**\n * Create a lasso element.\n */\nexport function createElement(theme: Theme) {\n  const element = document.createElement('div');\n  element.style.pointerEvents = 'none';\n  element.style.border = theme.lasso.border;\n  element.style.backgroundColor = theme.lasso.background;\n  element.style.position = 'fixed';\n  return element;\n}\n","import React, {\n  FC,\n  PropsWithChildren,\n  useCallback,\n  useEffect,\n  useRef\n} from 'react';\nimport { useThree } from '@react-three/fiber';\nimport { SelectionBox } from 'three-stdlib';\nimport { Mesh, Scene, TubeGeometry, Vector2 } from 'three';\nimport { useCameraControls } from '../CameraControls';\nimport { useStore } from '../store';\nimport { Theme } from '../themes';\nimport { createElement, prepareRay } from './utils';\n\nexport type LassoType = 'none' | 'all' | 'node' | 'edge';\n\nexport type LassoProps = PropsWithChildren<{\n  theme: Theme;\n  disabled?: boolean;\n  type?: LassoType;\n  onLasso?: (selections: string[]) => void;\n  onLassoEnd?: (selections: string[]) => void;\n}>;\n\nexport const Lasso: FC<LassoProps> = ({\n  children,\n  theme,\n  type = 'none',\n  onLasso,\n  onLassoEnd,\n  disabled\n}) => {\n  const camera = useThree(state => state.camera);\n  const gl = useThree(state => state.gl);\n  const setEvents = useThree(state => state.setEvents);\n  const size = useThree(state => state.size);\n  const get = useThree(state => state.get);\n  const scene = useThree(state => state.scene);\n\n  const cameraControls = useCameraControls();\n\n  const actives = useStore(state => state.actives);\n  const setActives = useStore(state => state.setActives);\n  const edges = useStore(state => state.edges);\n  const edgeMeshes = useStore(state => state.edgeMeshes);\n\n  const mountedRef = useRef<boolean>(false);\n  const selectionBoxRef = useRef<SelectionBox | null>(null);\n  const edgeMeshSelectionBoxRef = useRef<SelectionBox | null>(null);\n  const elementRef = useRef<HTMLDivElement>(createElement(theme));\n  const vectorsRef = useRef<[Vector2, Vector2, Vector2] | null>(null);\n  const isDownRef = useRef(false);\n  const oldRaycasterEnabledRef = useRef<boolean>(get().events.enabled);\n  const oldControlsEnabledRef = useRef<boolean>(\n    cameraControls.controls?.enabled\n  );\n\n  useEffect(() => {\n    if (mountedRef.current) {\n      onLasso?.(actives);\n    }\n\n    mountedRef.current = true;\n  }, [actives, onLasso]);\n\n  const onPointerMove = useCallback(\n    event => {\n      if (isDownRef.current) {\n        const [startPoint, pointTopLeft, pointBottomRight] = vectorsRef.current;\n\n        pointBottomRight.x = Math.max(startPoint.x, event.clientX);\n        pointBottomRight.y = Math.max(startPoint.y, event.clientY);\n        pointTopLeft.x = Math.min(startPoint.x, event.clientX);\n        pointTopLeft.y = Math.min(startPoint.y, event.clientY);\n        elementRef.current.style.left = `${pointTopLeft.x}px`;\n        elementRef.current.style.top = `${pointTopLeft.y}px`;\n        elementRef.current.style.width = `${\n          pointBottomRight.x - pointTopLeft.x\n        }px`;\n        elementRef.current.style.height = `${\n          pointBottomRight.y - pointTopLeft.y\n        }px`;\n\n        prepareRay(event, selectionBoxRef.current.endPoint, size);\n        prepareRay(event, edgeMeshSelectionBoxRef.current.endPoint, size);\n\n        const allSelected = [];\n        const edgesSelected = edgeMeshSelectionBoxRef.current\n          .select()\n          .sort(o => (o as any).uuid)\n          .map(\n            edge => edges[edgeMeshes.indexOf(edge as Mesh<TubeGeometry>)].id\n          );\n        allSelected.push(...edgesSelected);\n\n        const selected = selectionBoxRef.current\n          .select()\n          .sort(o => (o as any).uuid)\n          .filter(\n            o =>\n              o.isMesh &&\n              o.userData?.id &&\n              (o.userData?.type === type || type === 'all')\n          )\n          .map(o => o.userData.id);\n        allSelected.push(...selected);\n\n        // Note: This probably isn't the best solution but\n        // it prevents the render thrashing and causing flickering\n        requestAnimationFrame(() => {\n          setActives(allSelected);\n        });\n\n        document.addEventListener('pointermove', onPointerMove, {\n          passive: true,\n          capture: true,\n          once: true\n        });\n      }\n    },\n    [edges, edgeMeshes, setActives, size, type]\n  );\n\n  const onPointerUp = useCallback(() => {\n    if (isDownRef.current) {\n      setEvents({ enabled: oldRaycasterEnabledRef.current });\n      isDownRef.current = false;\n      elementRef.current.parentElement?.removeChild(elementRef.current);\n      cameraControls.controls.enabled = oldControlsEnabledRef.current;\n      onLassoEnd?.(actives);\n\n      document.removeEventListener('pointermove', onPointerMove);\n      document.removeEventListener('pointerup', onPointerUp);\n    }\n  }, [setEvents, cameraControls.controls, onLassoEnd, actives, onPointerMove]);\n\n  const onPointerDown = useCallback(\n    event => {\n      if (event.shiftKey) {\n        // Let's capture the old props to restore them later\n        oldRaycasterEnabledRef.current = get().events.enabled;\n        oldControlsEnabledRef.current = cameraControls.controls?.enabled;\n\n        // SelectionBox for all meshes\n        selectionBoxRef.current = new SelectionBox(camera, scene);\n\n        // SelectionBox for all Edge meshes (since they are combined into one geometry for rendering)\n        const edgeScene = new Scene();\n        if (edgeMeshes.length) {\n          edgeScene.add(...edgeMeshes);\n        }\n        edgeMeshSelectionBoxRef.current = new SelectionBox(camera, edgeScene);\n\n        vectorsRef.current = [\n          // start point\n          new Vector2(),\n          // point top left\n          new Vector2(),\n          // point bottom right\n          new Vector2()\n        ];\n\n        const [startPoint] = vectorsRef.current;\n\n        cameraControls.controls.enabled = false;\n        setEvents({ enabled: false });\n        isDownRef.current = true;\n        gl.domElement.parentElement?.appendChild(elementRef.current);\n        elementRef.current.style.left = `${event.clientX}px`;\n        elementRef.current.style.top = `${event.clientY}px`;\n        elementRef.current.style.width = '0px';\n        elementRef.current.style.height = '0px';\n        startPoint.x = event.clientX;\n        startPoint.y = event.clientY;\n\n        prepareRay(event, selectionBoxRef.current.startPoint, size);\n        prepareRay(event, edgeMeshSelectionBoxRef.current.startPoint, size);\n\n        document.addEventListener('pointermove', onPointerMove, {\n          passive: true,\n          capture: true,\n          once: true\n        });\n        document.addEventListener('pointerup', onPointerUp, { passive: true });\n      }\n    },\n    [\n      camera,\n      cameraControls.controls,\n      edgeMeshes,\n      get,\n      gl.domElement.parentElement,\n      onPointerMove,\n      onPointerUp,\n      scene,\n      setEvents,\n      size\n    ]\n  );\n\n  useEffect(() => {\n    if (disabled || type === 'none') {\n      return;\n    }\n\n    document.addEventListener('pointerdown', onPointerDown, { passive: true });\n    document.addEventListener('pointermove', onPointerMove, { passive: true });\n    document.addEventListener('pointerup', onPointerUp, { passive: true });\n\n    return () => {\n      document.removeEventListener('pointerdown', onPointerDown);\n      document.removeEventListener('pointermove', onPointerMove);\n      document.removeEventListener('pointerup', onPointerUp);\n    };\n  }, [type, disabled, onPointerDown, onPointerMove, onPointerUp]);\n\n  return <group>{children}</group>;\n};\n","import React, {\n  RefObject,\n  useCallback,\n  useEffect,\n  useMemo,\n  useState\n} from 'react';\nimport { GraphCanvasRef } from '../GraphCanvas';\nimport { useHotkeys } from 'reakeys';\nimport { GraphEdge, GraphNode } from '../types';\nimport { findPath } from '../utils/paths';\nimport { getAdjacents, PathSelectionTypes } from './utils';\n\nexport type HotkeyTypes = 'selectAll' | 'deselect' | 'delete';\n\nexport type SelectionTypes = 'single' | 'multi' | 'multiModifier';\n\nexport interface SelectionProps {\n  /**\n   * Required ref for the graph.\n   */\n  ref: RefObject<GraphCanvasRef | null>;\n\n  /**\n   * Current selections.\n   *\n   * Contains both nodes and edges ids.\n   */\n  selections?: string[];\n\n  /**\n   * Default active selections.\n   */\n  actives?: string[];\n\n  /**\n   * Node datas.\n   */\n  nodes?: GraphNode[];\n\n  /**\n   * Edge datas.\n   */\n  edges?: GraphEdge[];\n\n  /**\n   * Disabled or not.\n   */\n  disabled?: boolean;\n\n  /**\n   * Hotkey types\n   */\n  hotkeys?: HotkeyTypes[];\n\n  /**\n   * Whether to focus on select or not.\n   */\n  focusOnSelect?: boolean | 'singleOnly';\n\n  /**\n   * Type of selection.\n   */\n  type?: SelectionTypes;\n\n  /**\n   * Type of selection.\n   */\n  pathSelectionType?: PathSelectionTypes;\n\n  /**\n   * Whether it should active on hover or not.\n   */\n  pathHoverType?: PathSelectionTypes;\n\n  /**\n   * On selection change.\n   */\n  onSelection?: (selectionIds: string[]) => void;\n}\n\nexport interface SelectionResult {\n  /**\n   * Selections id array (of nodes and edges).\n   */\n  selections: string[];\n\n  /**\n   * The nodes/edges around the selections to highlight.\n   */\n  actives: string[];\n\n  /**\n   * Clear selections method.\n   */\n  clearSelections: (value?: string[]) => void;\n\n  /**\n   * A selection method.\n   */\n  addSelection: (value: string) => void;\n\n  /**\n   * Get the paths between two nodes.\n   */\n  selectNodePaths: (source: string, target: string) => void;\n\n  /**\n   * Remove selection method.\n   */\n  removeSelection: (value: string) => void;\n\n  /**\n   * Toggle existing selection on/off method.\n   */\n  toggleSelection: (value: string) => void;\n\n  /**\n   * Set internal selections.\n   */\n  setSelections: (value: string[]) => void;\n\n  /**\n   * On click event pass through.\n   */\n  onNodeClick?: (data: GraphNode) => void;\n\n  /**\n   * On canvas click event pass through.\n   */\n  onCanvasClick?: (event: MouseEvent) => void;\n\n  /**\n   * When the lasso happened.\n   */\n  onLasso?: (selections: string[]) => void;\n\n  /**\n   * When the lasso ended.\n   */\n  onLassoEnd?: (selections: string[]) => void;\n\n  /**\n   * When node got a pointer over.\n   */\n  onNodePointerOver?: (node: GraphNode) => void;\n\n  /**\n   * When node lost pointer over.\n   */\n  onNodePointerOut?: (node: GraphNode) => void;\n}\n\nexport const useSelection = ({\n  selections = [],\n  nodes = [],\n  actives = [],\n  focusOnSelect = true,\n  type = 'single',\n  pathHoverType = 'out',\n  pathSelectionType = 'direct',\n  ref,\n  hotkeys = ['selectAll', 'deselect', 'delete'],\n  disabled,\n  onSelection\n}: SelectionProps): SelectionResult => {\n  const [internalHovers, setInternalHovers] = useState<string[]>([]);\n  const [internalActives, setInternalActives] = useState<string[]>(actives);\n  const [internalSelections, setInternalSelections] =\n    useState<string[]>(selections);\n  const [metaKeyDown, setMetaKeyDown] = useState<boolean>(false);\n  const isMulti = type === 'multi' || type === 'multiModifier';\n\n  const addSelection = useCallback(\n    (items: string | string[]) => {\n      if (!disabled && items) {\n        items = Array.isArray(items) ? items : [items];\n\n        const filtered = items.filter(\n          item => !internalSelections.includes(item)\n        );\n        if (filtered.length) {\n          const next = [...internalSelections, ...filtered];\n          onSelection?.(next);\n          setInternalSelections(next);\n        }\n      }\n    },\n    [disabled, internalSelections, onSelection]\n  );\n\n  const removeSelection = useCallback(\n    (items: string | string[]) => {\n      if (!disabled && items) {\n        items = Array.isArray(items) ? items : [items];\n\n        const next = internalSelections.filter(i => !items.includes(i));\n        onSelection?.(next);\n        setInternalSelections(next);\n      }\n    },\n    [disabled, internalSelections, onSelection]\n  );\n\n  const clearSelections = useCallback(\n    (next: string | string[] = []) => {\n      if (!disabled) {\n        next = Array.isArray(next) ? next : [next];\n        setInternalActives([]);\n        setInternalSelections(next);\n        onSelection?.(next);\n      }\n    },\n    [disabled, onSelection]\n  );\n\n  const toggleSelection = useCallback(\n    (item: string) => {\n      const has = internalSelections.includes(item);\n      if (has) {\n        removeSelection(item);\n      } else {\n        if (!isMulti) {\n          clearSelections(item);\n        } else {\n          addSelection(item);\n        }\n      }\n    },\n    [\n      addSelection,\n      clearSelections,\n      internalSelections,\n      isMulti,\n      removeSelection\n    ]\n  );\n\n  const onNodeClick = useCallback(\n    (data: GraphNode) => {\n      if (isMulti) {\n        if (type === 'multiModifier') {\n          if (metaKeyDown) {\n            addSelection(data.id);\n          } else {\n            clearSelections(data.id);\n          }\n        } else {\n          addSelection(data.id);\n        }\n      } else {\n        clearSelections(data.id);\n      }\n\n      if (\n        focusOnSelect === true ||\n        (focusOnSelect === 'singleOnly' && !metaKeyDown)\n      ) {\n        if (!ref.current) {\n          throw new Error('No ref found for the graph canvas.');\n        }\n\n        const graph = ref.current.getGraph();\n        const { nodes: adjacents } = getAdjacents(\n          graph,\n          [data.id],\n          pathSelectionType\n        );\n        ref.current?.centerGraph([data.id, ...adjacents]);\n      }\n    },\n    [\n      addSelection,\n      clearSelections,\n      focusOnSelect,\n      isMulti,\n      metaKeyDown,\n      pathSelectionType,\n      ref,\n      type\n    ]\n  );\n\n  const selectNodePaths = useCallback(\n    (source: string, target: string) => {\n      const graph = ref.current.getGraph();\n      if (!graph) {\n        throw new Error('Graph is not initialized');\n      }\n\n      const path = findPath(graph, source, target);\n      clearSelections([source, target]);\n\n      const result = [];\n      for (let i = 0; i < path.length - 1; i++) {\n        const from = path[i];\n        const to = path[i + 1];\n        const edge = graph.getEdgeAttributes(from, to);\n        if (edge) {\n          result.push(edge.id);\n        }\n      }\n\n      setInternalActives([...path.map(p => p as string), ...result]);\n    },\n    [clearSelections, ref]\n  );\n\n  const onKeyDown = useCallback((event: KeyboardEvent) => {\n    const element = event.target as any;\n    const isSafe =\n      element.tagName !== 'INPUT' &&\n      element.tagName !== 'SELECT' &&\n      element.tagName !== 'TEXTAREA' &&\n      !element.isContentEditable;\n\n    const isMeta = event.metaKey || event.ctrlKey;\n\n    if (isSafe && isMeta) {\n      event.preventDefault();\n      setMetaKeyDown(true);\n    }\n  }, []);\n\n  useEffect(() => {\n    window.addEventListener('keydown', onKeyDown);\n\n    return () => {\n      window.removeEventListener('keydown', onKeyDown);\n    };\n  }, [onKeyDown]);\n\n  const onCanvasClick = useCallback(\n    (event: MouseEvent) => {\n      if (\n        event.button !== 2 &&\n        (internalSelections.length || internalActives.length)\n      ) {\n        clearSelections();\n        setMetaKeyDown(false);\n\n        // Only re-center if we have a single selection\n        if (focusOnSelect && internalSelections.length === 1) {\n          if (!ref.current) {\n            throw new Error('No ref found for the graph canvas.');\n          }\n\n          ref.current?.centerGraph();\n        }\n      }\n    },\n    [\n      clearSelections,\n      focusOnSelect,\n      internalActives.length,\n      internalSelections.length,\n      ref\n    ]\n  );\n\n  const onLasso = useCallback((selections: string[]) => {\n    setInternalActives(selections);\n  }, []);\n\n  const onLassoEnd = useCallback(\n    (selections: string[]) => {\n      clearSelections(selections);\n    },\n    [clearSelections]\n  );\n\n  const onNodePointerOver = useCallback(\n    (data: GraphNode) => {\n      if (pathHoverType) {\n        const graph = ref.current.getGraph();\n        if (!graph) {\n          throw new Error('No ref found for the graph canvas.');\n        }\n\n        const { nodes, edges } = getAdjacents(graph, [data.id], pathHoverType);\n        setInternalHovers([...nodes, ...edges]);\n      }\n    },\n    [pathHoverType, ref]\n  );\n\n  const onNodePointerOut = useCallback(() => {\n    if (pathHoverType) {\n      setInternalHovers([]);\n    }\n  }, [pathHoverType]);\n\n  useEffect(() => {\n    if (pathSelectionType !== 'direct' && internalSelections.length > 0) {\n      const graph = ref.current?.getGraph();\n      if (graph) {\n        const { nodes, edges } = getAdjacents(\n          graph,\n          internalSelections,\n          pathSelectionType\n        );\n        setInternalActives([...nodes, ...edges]);\n      }\n    }\n  }, [internalSelections, pathSelectionType, ref]);\n\n  useHotkeys([\n    {\n      name: 'Select All',\n      keys: 'mod+a',\n      disabled: !hotkeys.includes('selectAll'),\n      category: 'Graph',\n      description: 'Select all nodes and edges',\n      callback: event => {\n        event.preventDefault();\n\n        if (!disabled && type !== 'single') {\n          const next = nodes.map(n => n.id);\n          onSelection?.(next);\n          setInternalSelections(next);\n        }\n      }\n    },\n    {\n      name: 'Deselect Selections',\n      category: 'Graph',\n      disabled: !hotkeys.includes('deselect'),\n      description: 'Deselect selected nodes and edges',\n      keys: 'escape',\n      callback: event => {\n        if (!disabled) {\n          event.preventDefault();\n          onSelection?.([]);\n          setInternalSelections([]);\n        }\n      }\n    }\n  ]);\n\n  const joinedActives = useMemo(\n    () => [...internalActives, ...internalHovers],\n    [internalActives, internalHovers]\n  );\n\n  return {\n    actives: joinedActives,\n    onNodeClick,\n    onNodePointerOver,\n    onNodePointerOut,\n    onLasso,\n    onLassoEnd,\n    selectNodePaths,\n    onCanvasClick,\n    selections: internalSelections,\n    clearSelections,\n    addSelection,\n    removeSelection,\n    toggleSelection,\n    setSelections: setInternalSelections\n  };\n};\n","import React, {\n  FC,\n  forwardRef,\n  ReactNode,\n  Ref,\n  Suspense,\n  useImperativeHandle,\n  useRef,\n  useMemo\n} from 'react';\nimport { Canvas } from '@react-three/fiber';\nimport { GraphScene, GraphSceneProps, GraphSceneRef } from './GraphScene';\nimport {\n  CameraMode,\n  CameraControls,\n  CameraControlsRef\n} from './CameraControls';\nimport { Theme, lightTheme } from './themes';\nimport { createStore, Provider } from './store';\nimport Graph from 'graphology';\nimport { Lasso, LassoType } from './selection';\nimport ThreeCameraControls from 'camera-controls';\nimport css from './GraphCanvas.module.css';\n\nexport interface GraphCanvasProps extends Omit<GraphSceneProps, 'theme'> {\n  /**\n   * Theme to use for the graph.\n   */\n  theme?: Theme;\n\n  /**\n   * Type of camera interaction.\n   */\n  cameraMode?: CameraMode;\n\n  /**\n   * When the canvas was clicked but didn't hit a node/edge.\n   */\n  onCanvasClick?: (event: MouseEvent) => void;\n\n  /**\n   * The type of lasso selection.\n   */\n  lassoType?: LassoType;\n\n  /**\n   * When the canvas had a lasso selection.\n   */\n  onLasso?: (selections: string[]) => void;\n\n  /**\n   * When the canvas had a lasso selection end.\n   */\n  onLassoEnd?: (selections: string[]) => void;\n\n  /**\n   * Children to render in the canvas. Useful for things like lights.\n   */\n  children?: ReactNode;\n\n  /**\n   * Ability to extend Cavas gl options. For example { preserveDrawingBuffer: true }\n   */\n  glOptions?: Object;\n}\n\nexport type GraphCanvasRef = Omit<GraphSceneRef, 'graph'> &\n  Omit<CameraControlsRef, 'controls'> & {\n    /**\n     * Get the graph object.\n     */\n    getGraph: () => Graph;\n\n    /**\n     * Get the camera controls.\n     */\n    getControls: () => ThreeCameraControls;\n  };\n\nconst GL_DEFAULTS = {\n  alpha: true,\n  antialias: true\n};\n\n// TODO: Fix type\nconst CAMERA_DEFAULTS: any = {\n  position: [0, 0, 1000],\n  near: 5,\n  far: 50000,\n  fov: 10\n};\n\nexport const GraphCanvas: FC<GraphCanvasProps & { ref?: Ref<GraphCanvasRef> }> =\n  forwardRef(\n    (\n      {\n        cameraMode,\n        edges,\n        children,\n        nodes,\n        theme,\n        onCanvasClick,\n        animated,\n        disabled,\n        lassoType,\n        onLasso,\n        onLassoEnd,\n        glOptions,\n        ...rest\n      },\n      ref: Ref<GraphCanvasRef>\n    ) => {\n      const rendererRef = useRef<GraphSceneRef | null>(null);\n      const controlsRef = useRef<CameraControlsRef | null>(null);\n\n      useImperativeHandle(ref, () => ({\n        centerGraph: (n?: string[]) => rendererRef.current?.centerGraph(n),\n        zoomIn: () => controlsRef.current?.zoomIn(),\n        zoomOut: () => controlsRef.current?.zoomOut(),\n        panLeft: () => controlsRef.current?.panLeft(),\n        panRight: () => controlsRef.current?.panRight(),\n        panDown: () => controlsRef.current?.panDown(),\n        panUp: () => controlsRef.current?.panUp(),\n        resetControls: (animated?: boolean) =>\n          controlsRef.current?.resetControls(animated),\n        getControls: () => controlsRef.current?.controls,\n        getGraph: () => rendererRef.current?.graph\n      }));\n\n      // Defaults to pass to the store\n      const { selections, actives, collapsedNodeIds } = rest;\n\n      // It's pretty hard to get good animation performance with large n of edges/nodes\n      const finalAnimated =\n        edges.length + nodes.length > 400 ? false : animated;\n\n      const gl = useMemo(() => ({ ...glOptions, ...GL_DEFAULTS }), [glOptions]);\n\n      // NOTE: The legacy/linear/flat flags are for color issues\n      // Reference: https://github.com/protectwise/troika/discussions/213#discussioncomment-3086666\n      return (\n        <div className={css.canvas}>\n          <Canvas\n            legacy\n            linear\n            flat\n            gl={gl}\n            camera={CAMERA_DEFAULTS}\n            onPointerMissed={onCanvasClick}\n          >\n            <Provider\n              createStore={() =>\n                createStore({\n                  selections,\n                  actives,\n                  theme,\n                  collapsedNodeIds\n                })\n              }\n            >\n              {theme.canvas?.background && (\n                <color attach=\"background\" args={[theme.canvas.background]} />\n              )}\n              <ambientLight intensity={1} />\n              {children}\n              {theme.canvas?.fog && (\n                <fog attach=\"fog\" args={[theme.canvas.fog, 4000, 9000]} />\n              )}\n              <CameraControls\n                mode={cameraMode}\n                ref={controlsRef}\n                animated={animated}\n              >\n                <Lasso\n                  theme={theme}\n                  disabled={disabled}\n                  type={lassoType}\n                  onLasso={onLasso}\n                  onLassoEnd={onLassoEnd}\n                >\n                  <Suspense>\n                    <GraphScene\n                      ref={rendererRef as any}\n                      theme={theme}\n                      disabled={disabled}\n                      animated={finalAnimated}\n                      edges={edges}\n                      nodes={nodes}\n                      {...rest}\n                    />\n                  </Suspense>\n                </Lasso>\n              </CameraControls>\n            </Provider>\n          </Canvas>\n        </div>\n      );\n    }\n  );\n\nGraphCanvas.defaultProps = {\n  cameraMode: 'pan',\n  layoutType: 'forceDirected2d',\n  sizingType: 'default',\n  labelType: 'auto',\n  theme: lightTheme,\n  animated: true,\n  defaultNodeSize: 7,\n  minNodeSize: 5,\n  maxNodeSize: 15,\n  lassoType: 'none',\n  glOptions: {}\n};\n","import classNames from 'classnames';\nimport React, { FC, ReactNode } from 'react';\nimport css from './RadialSlice.module.css';\n\nexport interface MenuItem {\n  /**\n   * Label to display on the menu item.\n   */\n  label: string;\n\n  /**\n   * CSS Classname to apply to the slice.\n   */\n  className?: string;\n\n  /**\n   * Optional icon to display on the menu item.\n   */\n  icon?: ReactNode;\n\n  /**\n   * Optional callback to detemine if the menu item is active.\n   */\n  disabled?: boolean;\n\n  /**\n   * Optional callback to handle when the menu item is clicked.\n   */\n  onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;\n}\n\ninterface RadialSliceProps extends MenuItem {\n  startAngle: number;\n  endAngle: number;\n  skew: number;\n  polar: boolean;\n  centralAngle: number;\n  radius: number;\n  innerRadius: number;\n}\n\nexport const RadialSlice: FC<RadialSliceProps> = ({\n  label,\n  centralAngle,\n  startAngle,\n  endAngle,\n  polar,\n  radius,\n  className,\n  icon,\n  innerRadius,\n  skew,\n  disabled,\n  onClick\n}) => (\n  <div\n    role=\"menuitem\"\n    className={classNames(css.container, className, {\n      [css.disabled]: disabled\n    })}\n    style={{\n      width: centralAngle > 90 ? '100%' : '50%',\n      height: centralAngle > 90 ? '100%' : '50%',\n      bottom: centralAngle > 90 ? '50%' : 'initial',\n      right: centralAngle > 90 ? '50%' : 'initial',\n      transform: `rotate(${startAngle + endAngle}deg) skew(${skew}deg)`\n    }}\n    onClick={event => {\n      if (!disabled) {\n        onClick(event);\n      }\n    }}\n  >\n    <div\n      className={css.contentContainer}\n      style={{\n        transform: `skew(${-skew}deg) rotate(${\n          (polar ? 90 : centralAngle) / 2 - 90\n        }deg)`\n      }}\n    >\n      <div\n        className={css.contentInner}\n        style={{\n          top: `calc((((${\n            centralAngle > 90 ? '50% + ' : ''\n          }${radius}px) - ${innerRadius}px) / 2) - 4em)`\n        }}\n      >\n        <div\n          className={css.content}\n          style={{\n            transform: `rotate(${-endAngle}deg)`\n          }}\n          title={label}\n        >\n          {icon}\n          {label}\n        </div>\n      </div>\n    </div>\n  </div>\n);\n","import { MenuItem } from './RadialSlice';\n\nexport function calculateRadius(items: MenuItem[], startOffsetAngle: number) {\n  const centralAngle = 360 / items.length || 360;\n  const polar = centralAngle % 180 === 0;\n  const deltaAngle = 90 - centralAngle;\n  const startAngle = polar\n    ? 45\n    : startOffsetAngle + deltaAngle + centralAngle / 2;\n\n  return { centralAngle, polar, startAngle, deltaAngle };\n}\n","import React, { FC, useLayoutEffect, useMemo, useRef } from 'react';\nimport { RadialSlice, MenuItem } from './RadialSlice';\nimport { calculateRadius } from './utils';\nimport css from './RadialMenu.module.css';\nimport classNames from 'classnames';\n\ninterface RadialMenuProps {\n  items: MenuItem[];\n  radius?: number;\n  innerRadius?: number;\n  startOffsetAngle?: number;\n  className?: string;\n  onClose?: (event: React.MouseEvent<HTMLDivElement>) => void;\n}\n\nexport const RadialMenu: FC<RadialMenuProps> = ({\n  items,\n  radius,\n  className,\n  innerRadius,\n  startOffsetAngle,\n  onClose\n}) => {\n  const { centralAngle, polar, startAngle, deltaAngle } = useMemo(\n    () => calculateRadius(items, startOffsetAngle),\n    [items, startOffsetAngle]\n  );\n  const timeout = useRef<any | null>(null);\n\n  useLayoutEffect(() => {\n    const timer = timeout.current;\n    return () => clearTimeout(timer);\n  }, []);\n\n  if (items.length === 0) {\n    return null;\n  }\n\n  return (\n    <div\n      role=\"menu\"\n      className={classNames(css.container, className)}\n      onPointerEnter={() => clearTimeout(timeout.current)}\n      onPointerLeave={event => {\n        clearTimeout(timeout.current);\n        timeout.current = setTimeout(() => onClose?.(event), 500);\n      }}\n    >\n      {items.map((slice, index) => (\n        <RadialSlice\n          key={index}\n          {...slice}\n          radius={radius}\n          innerRadius={innerRadius}\n          startAngle={startAngle}\n          endAngle={centralAngle * index}\n          skew={polar ? 0 : deltaAngle}\n          polar={polar}\n          centralAngle={centralAngle}\n          onClick={event => {\n            slice?.onClick(event);\n            onClose?.(event);\n          }}\n        />\n      ))}\n    </div>\n  );\n};\n\nRadialMenu.defaultProps = {\n  radius: 175,\n  innerRadius: 25,\n  startOffsetAngle: 0\n};\n"],"names":["d3ForceRadial","nodes","links","treemap","hierarchy","forceSimulation","forceX","forceY","forceCollide","forceManyBody","forceLink","d3ForceSimulation","d3ForceLink","d3ForceManyBody","d3ForceX","d3ForceY","d3ForceZ","_a","_b","stratify","tree","degreeCentrality","scaleLinear","n","Vector3","QuadraticBezierCurve3","LineCurve3","disabled","useRef","useCallback","useThree","useMemo","Vector2","Plane","useGesture","bidirectional","create","theme","actives","selections","id","node","useState","visibleEdges","visibleNodes","useEffect","useLayoutEffect","Color","Billboard","jsx","Text","useSpring","jsxs","a","DoubleSide","createContext","useContext","MOUSE","Vector4","Quaternion","Matrix4","Spherical","Box3","Sphere","Raycaster","MathUtils","extend","holdEvent","forwardRef","useFrame","ref","useHotkeys","animated","useImperativeHandle","centerNodes","TextureLoader","LinearFilter","Fragment","DreiSvg","useCursor","Html","curve","TubeGeometry","Edge","arrowPosition","arrowRotation","Euler","BoxGeometry","CylinderGeometry","mergeBufferGeometries","BufferAttribute","edge","active","inactive","draggingActive","draggingInactive","edgeMeshes","Mesh","SelectionBox","Scene","css","Canvas","Suspense"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAYA,WAAS,cAAc,O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