{"version":3,"file":"use-deep-compare-DiXYwk2s.js","sources":["../../node_modules/use-deep-compare/dist-web/index.js"],"sourcesContent":["import React from 'react';\nimport { dequal } from 'dequal';\n\nfunction useDeepCompareMemoize(dependencies) {\n const dependenciesRef = React.useRef(dependencies);\n const signalRef = React.useRef(0);\n\n if (!dequal(dependencies, dependenciesRef.current)) {\n dependenciesRef.current = dependencies;\n signalRef.current += 1;\n }\n\n return React.useMemo(() => dependenciesRef.current, [signalRef.current]);\n}\n\n/**\n * `useDeepCompareCallback` will return a memoized version of the callback that\n * only changes if one of the `dependencies` has changed.\n *\n * Warning: `useDeepCompareCallback` should not be used with dependencies that\n * are all primitive values. Use `React.useCallback` instead.\n *\n * @see {@link https://react.dev/reference/react/useCallback}\n */\n\nfunction useDeepCompareCallback(callback, dependencies) {\n return React.useCallback(callback, useDeepCompareMemoize(dependencies));\n}\n\n/**\n * Accepts a function that contains imperative, possibly effectful code.\n *\n * Warning: `useDeepCompareEffect` should not be used with dependencies that\n * are all primitive values. Use `React.useEffect` instead.\n *\n * @see {@link https://react.dev/reference/react/useEffect}\n */\n\nfunction useDeepCompareEffect(effect, dependencies) {\n React.useEffect(effect, useDeepCompareMemoize(dependencies));\n}\n\n/**\n * `useDeepCompareImperativeHandle` customizes the instance value that is exposed to parent components when using `ref`.\n * As always, imperative code using refs should be avoided in most cases.\n *\n * `useDeepCompareImperativeHandle` should be used with `React.forwardRef`.\n *\n * It's similar to `useImperativeHandle`, but uses deep comparison on the dependencies.\n *\n * Warning: `useDeepCompareImperativeHandle` should not be used with dependencies that\n * are all primitive values. Use `React.useImperativeHandle` instead.\n *\n * @see {@link https://react.dev/reference/react/useImperativeHandle}\n */\n\nfunction useDeepCompareImperativeHandle(ref, init, dependencies) {\n React.useImperativeHandle(ref, init, useDeepCompareMemoize(dependencies));\n}\n\n/**\n * The signature is identical to `useDeepCompareEffect`, but it fires synchronously after all DOM mutations.\n * Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside\n * `useDeepCompareLayoutEffect` will be flushed synchronously, before the browser has a chance to paint.\n *\n * Prefer the standard `useDeepCompareEffect` when possible to avoid blocking visual updates.\n *\n * If you’re migrating code from a class component, `useDeepCompareLayoutEffect` fires in the same phase as\n * `componentDidMount` and `componentDidUpdate`.\n *\n * Warning: `useDeepCompareLayoutEffect` should not be used with dependencies that\n * are all primitive values. Use `React.useLayoutEffect` instead.\n *\n * @see {@link https://react.dev/reference/react/useLayoutEffect}\n */\n\nfunction useDeepCompareLayoutEffect(effect, dependencies) {\n React.useLayoutEffect(effect, useDeepCompareMemoize(dependencies));\n}\n\n/**\n * `useDeepCompareMemo` will only recompute the memoized value when one of the\n * `dependencies` has changed.\n *\n * Warning: `useDeepCompareMemo` should not be used with dependencies that\n * are all primitive values. Use `React.useMemo` instead.\n *\n * @see {@link https://react.dev/reference/react/useMemo}\n */\n\nfunction useDeepCompareMemo(factory, dependencies) {\n return React.useMemo(factory, useDeepCompareMemoize(dependencies));\n}\n\nexport { useDeepCompareCallback, useDeepCompareEffect, useDeepCompareImperativeHandle, useDeepCompareLayoutEffect, useDeepCompareMemo };\n//# sourceMappingURL=index.js.map\n"],"names":["useDeepCompareMemo","factory","dependencies","React","useMemo","dependenciesRef","useRef","signalRef","dequal","current","useDeepCompareMemoize"],"mappings":"iFA0FA,SAASA,EAAmBC,EAASC,GACnC,OAAOC,EAAMC,QAAQH,EAxFvB,SAA+BC,GACvB,MAAAG,EAAkBF,EAAMG,OAAOJ,GAC/BK,EAAYJ,EAAMG,OAAO,GAOxB,OALFE,EAAON,EAAcG,EAAgBI,WACxCJ,EAAgBI,QAAUP,EAC1BK,EAAUE,SAAW,GAGhBN,EAAMC,SAAQ,IAAMC,EAAgBI,SAAS,CAACF,EAAUE,SACjE,CA8EgCC,CAAsBR,GACtD","x_google_ignoreList":[0]}