{"version":3,"file":"floating-ui.react-dom.esm.mjs","sources":["../../../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js"],"sourcesContent":["import { arrow as arrow$1, computePosition } from '@floating-ui/dom';\nexport { autoPlacement, autoUpdate, computePosition, detectOverflow, flip, getOverflowAncestors, hide, inline, limitShift, offset, platform, shift, size } from '@floating-ui/dom';\nimport * as React from 'react';\nimport { useLayoutEffect, useEffect } from 'react';\nimport * as ReactDOM from 'react-dom';\n\n/**\n * A data provider that provides data to position an inner element of the\n * floating element (usually a triangle or caret) so that it is centered to the\n * reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = options => {\n  const {\n    element,\n    padding\n  } = options;\n  function isRef(value) {\n    return Object.prototype.hasOwnProperty.call(value, 'current');\n  }\n  return {\n    name: 'arrow',\n    options,\n    fn(args) {\n      if (isRef(element)) {\n        if (element.current != null) {\n          return arrow$1({\n            element: element.current,\n            padding\n          }).fn(args);\n        }\n        return {};\n      } else if (element) {\n        return arrow$1({\n          element,\n          padding\n        }).fn(args);\n      }\n      return {};\n    }\n  };\n};\n\nvar index = typeof document !== 'undefined' ? useLayoutEffect : useEffect;\n\n// Fork of `fast-deep-equal` that only does the comparisons we need and compares\n// functions\nfunction deepEqual(a, b) {\n  if (a === b) {\n    return true;\n  }\n  if (typeof a !== typeof b) {\n    return false;\n  }\n  if (typeof a === 'function' && a.toString() === b.toString()) {\n    return true;\n  }\n  let length, i, keys;\n  if (a && b && typeof a == 'object') {\n    if (Array.isArray(a)) {\n      length = a.length;\n      if (length != b.length) return false;\n      for (i = length; i-- !== 0;) {\n        if (!deepEqual(a[i], b[i])) {\n          return false;\n        }\n      }\n      return true;\n    }\n    keys = Object.keys(a);\n    length = keys.length;\n    if (length !== Object.keys(b).length) {\n      return false;\n    }\n    for (i = length; i-- !== 0;) {\n      if (!Object.prototype.hasOwnProperty.call(b, keys[i])) {\n        return false;\n      }\n    }\n    for (i = length; i-- !== 0;) {\n      const key = keys[i];\n      if (key === '_owner' && a.$$typeof) {\n        continue;\n      }\n      if (!deepEqual(a[key], b[key])) {\n        return false;\n      }\n    }\n    return true;\n  }\n  return a !== a && b !== b;\n}\n\nfunction useLatestRef(value) {\n  const ref = React.useRef(value);\n  index(() => {\n    ref.current = value;\n  });\n  return ref;\n}\n\n/**\n * Provides data to position a floating element.\n * @see https://floating-ui.com/docs/react\n */\nfunction useFloating(options) {\n  if (options === void 0) {\n    options = {};\n  }\n  const {\n    placement = 'bottom',\n    strategy = 'absolute',\n    middleware = [],\n    platform,\n    whileElementsMounted,\n    open\n  } = options;\n  const [data, setData] = React.useState({\n    x: null,\n    y: null,\n    strategy,\n    placement,\n    middlewareData: {},\n    isPositioned: false\n  });\n  const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);\n  if (!deepEqual(latestMiddleware, middleware)) {\n    setLatestMiddleware(middleware);\n  }\n  const referenceRef = React.useRef(null);\n  const floatingRef = React.useRef(null);\n  const dataRef = React.useRef(data);\n  const whileElementsMountedRef = useLatestRef(whileElementsMounted);\n  const platformRef = useLatestRef(platform);\n  const [reference, _setReference] = React.useState(null);\n  const [floating, _setFloating] = React.useState(null);\n  const setReference = React.useCallback(node => {\n    if (referenceRef.current !== node) {\n      referenceRef.current = node;\n      _setReference(node);\n    }\n  }, []);\n  const setFloating = React.useCallback(node => {\n    if (floatingRef.current !== node) {\n      floatingRef.current = node;\n      _setFloating(node);\n    }\n  }, []);\n  const update = React.useCallback(() => {\n    if (!referenceRef.current || !floatingRef.current) {\n      return;\n    }\n    const config = {\n      placement,\n      strategy,\n      middleware: latestMiddleware\n    };\n    if (platformRef.current) {\n      config.platform = platformRef.current;\n    }\n    computePosition(referenceRef.current, floatingRef.current, config).then(data => {\n      const fullData = {\n        ...data,\n        isPositioned: true\n      };\n      if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {\n        dataRef.current = fullData;\n        ReactDOM.flushSync(() => {\n          setData(fullData);\n        });\n      }\n    });\n  }, [latestMiddleware, placement, strategy, platformRef]);\n  index(() => {\n    if (open === false && dataRef.current.isPositioned) {\n      dataRef.current.isPositioned = false;\n      setData(data => ({\n        ...data,\n        isPositioned: false\n      }));\n    }\n  }, [open]);\n  const isMountedRef = React.useRef(false);\n  index(() => {\n    isMountedRef.current = true;\n    return () => {\n      isMountedRef.current = false;\n    };\n  }, []);\n  index(() => {\n    if (reference && floating) {\n      if (whileElementsMountedRef.current) {\n        return whileElementsMountedRef.current(reference, floating, update);\n      } else {\n        update();\n      }\n    }\n  }, [reference, floating, update, whileElementsMountedRef]);\n  const refs = React.useMemo(() => ({\n    reference: referenceRef,\n    floating: floatingRef,\n    setReference,\n    setFloating\n  }), [setReference, setFloating]);\n  const elements = React.useMemo(() => ({\n    reference,\n    floating\n  }), [reference, floating]);\n  return React.useMemo(() => ({\n    ...data,\n    update,\n    refs,\n    elements,\n    reference: setReference,\n    floating: setFloating\n  }), [data, update, refs, elements, setReference, setFloating]);\n}\n\nexport { arrow, useFloating };\n"],"names":["arrow","options","element","padding","name","fn","args","isRef","value","Object","prototype","hasOwnProperty","call","current","arrow$1","index","document","useLayoutEffect","useEffect","deepEqual","a","b","toString","length","i","keys","Array","isArray","key","$$typeof","useLatestRef","ref","React","useRef","useFloating","placement","strategy","middleware","platform","whileElementsMounted","open","data","setData","useState","x","y","middlewareData","isPositioned","latestMiddleware","setLatestMiddleware","referenceRef","floatingRef","dataRef","whileElementsMountedRef","platformRef","reference","_setReference","floating","_setFloating","setReference","useCallback","node","setFloating","update","config","computePosition","then","fullData","isMountedRef","ReactDOM","flushSync","refs","useMemo","elements"],"mappings":"yZAaK,MAACA,MAAQC,IACZ,MAAMC,QACJA,EAAOC,QACPA,GACEF,EAIJ,MAAO,CACLG,KAAM,QACNH,UACAI,GAAGC,GANL,SAASC,MAAMC,GACb,OAAOC,OAAOC,UAAUC,eAAeC,KAAKJ,EAAO,UACpD,CAKOD,CAAML,GACe,MAAnBA,EAAQW,QACHC,E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