\n *
Selected nodes: {selectedNodes.join(', ')}
\n *
Selected edges: {selectedEdges.join(', ')}
\n *
\n * );\n *}\n *```\n *\n * @remarks You need to memoize the passed `onChange` handler, otherwise the hook will not work correctly.\n */\nfunction useOnSelectionChange({ onChange }) {\n const store = useStoreApi();\n useEffect(() => {\n const nextOnSelectionChangeHandlers = [...store.getState().onSelectionChangeHandlers, onChange];\n store.setState({ onSelectionChangeHandlers: nextOnSelectionChangeHandlers });\n return () => {\n const nextHandlers = store.getState().onSelectionChangeHandlers.filter((fn) => fn !== onChange);\n store.setState({ onSelectionChangeHandlers: nextHandlers });\n };\n }, [onChange]);\n}\n\nconst selector$4 = (options) => (s) => {\n if (s.nodeLookup.size === 0) {\n return false;\n }\n for (const [, { hidden, internals }] of s.nodeLookup) {\n if (options.includeHiddenNodes || !hidden) {\n if (internals.handleBounds === undefined || !nodeHasDimensions(internals.userNode)) {\n return false;\n }\n }\n }\n return true;\n};\n/**\n * This hook tells you whether all the nodes in a flow have been measured and given\n *a width and height. When you add a node to the flow, this hook will return\n *`false` and then `true` again once the node has been measured.\n *\n * @public\n * @param options.includeHiddenNodes - defaults to false\n * @returns boolean indicating whether all nodes are initialized\n *\n * @example\n * ```jsx\n *import { useReactFlow, useNodesInitialized } from '@xyflow/react';\n *import { useEffect, useState } from 'react';\n *\n *const options = {\n * includeHiddenNodes: false,\n *};\n *\n *export default function useLayout() {\n * const { getNodes } = useReactFlow();\n * const nodesInitialized = useNodesInitialized(options);\n * const [layoutedNodes, setLayoutedNodes] = useState(getNodes());\n *\n * useEffect(() => {\n * if (nodesInitialized) {\n * setLayoutedNodes(yourLayoutingFunction(getNodes()));\n * }\n * }, [nodesInitialized]);\n *\n * return layoutedNodes;\n *}\n *```\n */\nfunction useNodesInitialized(options = {\n includeHiddenNodes: false,\n}) {\n const initialized = useStore(selector$4(options));\n return initialized;\n}\n\n/**\n * Hook to check if a