{"version":3,"file":"useMultipleRefs-DJ38Gqvm.cjs","names":[],"sources":["../src/internalUtils/ref.ts","../src/hooks/useMultipleRefs.ts"],"sourcesContent":["import { Ref, RefObject } from \"react\";\n\n/**\n * Assigns a value to a ref.\n * Handles both callback refs and ref objects safely.\n *\n * @template T - The type of the ref value\n * @param ref - The ref to assign the value to (can be callback, ref object, or null)\n * @param value - The value to assign\n */\nexport const assignRef = <T = unknown>(ref: Ref<T> | null, value: T | null): void => {\n  if (typeof ref === \"function\") {\n    ref(value);\n  } else if (ref) {\n    (ref as RefObject<T | null>).current = value;\n  }\n};\n","import { useCallback } from \"react\";\nimport { assignRef } from \"../internalUtils/ref\";\n\ntype RefType<T> = React.Ref<T> | React.RefObject<T> | React.ForwardedRef<T>;\n\n/**\n * Custom hook to merge multiple refs into a single ref callback.\n *\n * @template T - The type of element the ref will reference\n * @param refs - Any number of refs or ref functions to merge\n * @returns A callback ref that assigns the value to all provided refs\n */\nexport const useMultipleRefs = <T = HTMLElement>(...refs: Array<RefType<T>>) => {\n  return useCallback(\n    (value: T | null) => {\n      refs.forEach((ref) => {\n        assignRef(ref, value);\n      });\n    },\n    [refs],\n  );\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,aAA0B,KAAoB,UAA0B;AACnF,KAAI,OAAO,QAAQ,WACjB,KAAI,MAAM;UACD,IACR,KAA4B,UAAU;;;;;;;;;;;ACF3C,MAAa,mBAAoC,GAAG,SAA4B;AAC9E,SAAA,GAAA,MAAA,cACG,UAAoB;AACnB,OAAK,SAAS,QAAQ;AACpB,aAAU,KAAK,MAAM;IACrB;IAEJ,CAAC,KAAK,CACP"}