{"version":3,"sources":["../../src/use-supported/index.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { useLatest } from '../use-latest'\nimport { useSafeState } from '../use-safe-state'\n\nimport type { DependencyList } from 'react'\n\n/**\n * A React Hook that helps to check if browser supports a feature in both client and Server-side Rendering (SSR).\n *\n * TODO: in 2.0 use Ref to track & mark dependencies to reduce render, only update when deps actually used and changed.\n */\nexport function useSupported(callback: () => unknown, deps: DependencyList = []): boolean {\n  const [isSupported, setIsSupported] = useSafeState<boolean>(false)\n\n  const latest = useLatest({ callback })\n\n  useEffect(() => {\n    setIsSupported(Boolean(latest.current.callback()))\n  }, deps)\n\n  return isSupported\n}\n"],"names":["useSupported","callback","deps","useSafeState","isSupported","setIsSupported","latest","useLatest","useEffect","Boolean","current"],"mappings":";;;;+BAWgBA;;;eAAAA;;;qBAXU;yBACA;4BACG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAStB,SAASA,aAAaC,QAAuB;QAAEC,OAAAA,iEAAuB,EAAE;IAC7E,IAAsCC,iCAAAA,IAAAA,0BAAY,EAAU,YAArDC,cAA+BD,kBAAlBE,iBAAkBF;IAEtC,IAAMG,SAASC,IAAAA,oBAAS,EAAC;QAAEN,UAAAA;IAAS;IAEpCO,IAAAA,gBAAS,EAAC;QACRH,eAAeI,QAAQH,OAAOI,OAAO,CAACT,QAAQ;IAChD,GAAGC;IAEH,OAAOE;AACT"}