{"ast":null,"code":"import { useEffect, useState } from 'react';\nimport { loadAsync, isLoaded } from \"./Font\";\nfunction isMapLoaded(map) {\n  if (typeof map === 'string') {\n    return isLoaded(map);\n  } else {\n    return Object.keys(map).every(fontFamily => isLoaded(fontFamily));\n  }\n}\nfunction useRuntimeFonts(map) {\n  const [loaded, setLoaded] = useState(isMapLoaded(map));\n  const [error, setError] = useState(null);\n  useEffect(() => {\n    let isMounted = true;\n    loadAsync(map).then(() => {\n      if (isMounted) {\n        setLoaded(true);\n      }\n    }).catch(error => {\n      if (isMounted) {\n        setError(error);\n      }\n    });\n    return () => {\n      isMounted = false;\n    };\n  }, []);\n  return [loaded, error];\n}\nfunction useStaticFonts(map) {\n  loadAsync(map);\n  return [true, null];\n}\nexport const useFonts = typeof window === 'undefined' ? useStaticFonts : useRuntimeFonts;","map":{"version":3,"names":["useEffect","useState","loadAsync","isLoaded","isMapLoaded","map","Object","keys","every","fontFamily","useRuntimeFonts","loaded","setLoaded","error","setError","isMounted","then","catch","useStaticFonts","useFonts","window"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/expo-font/src/FontHooks.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { loadAsync, isLoaded } from './Font';\nimport { FontSource } from './Font.types';\n\nfunction isMapLoaded(map: string | Record<string, FontSource>) {\n  if (typeof map === 'string') {\n    return isLoaded(map);\n  } else {\n    return Object.keys(map).every((fontFamily) => isLoaded(fontFamily));\n  }\n}\n\nfunction useRuntimeFonts(map: string | Record<string, FontSource>): [boolean, Error | null] {\n  const [loaded, setLoaded] = useState(\n    // For web rehydration, we need to check if the fonts are already loaded during the static render.\n    // Native will also benefit from this optimization.\n    isMapLoaded(map)\n  );\n  const [error, setError] = useState<Error | null>(null);\n\n  useEffect(() => {\n    let isMounted = true;\n\n    loadAsync(map)\n      .then(() => {\n        if (isMounted) {\n          setLoaded(true);\n        }\n      })\n      .catch((error) => {\n        if (isMounted) {\n          setError(error);\n        }\n      });\n\n    return () => {\n      isMounted = false;\n    };\n  }, []);\n\n  return [loaded, error];\n}\n\nfunction useStaticFonts(map: string | Record<string, FontSource>): [boolean, Error | null] {\n  loadAsync(map);\n  return [true, null];\n}\n\n// @needsAudit\n/**\n * Load a map of fonts at runtime with [`loadAsync`](#loadasyncfontfamilyorfontmap-source). This returns a `boolean` if the fonts are\n * loaded and ready to use. It also returns an error if something went wrong, to use in development.\n *\n * > Note, the fonts are not \"reloaded\" when you dynamically change the font map.\n *\n * @param map A map of `fontFamily`s to [`FontSource`](#fontsource)s. After loading the font you can\n * use the key in the `fontFamily` style prop of a `Text` element.\n *\n * @return\n * - __loaded__ (`boolean`) - A boolean to detect if the font for `fontFamily` has finished\n * loading.\n * - __error__ (`Error | null`) - An error encountered when loading the fonts.\n *\n * @example\n * ```tsx\n * const [loaded, error] = useFonts({\n *   'Inter-Black': require('./assets/fonts/Inter-Black.otf'),\n * });\n * ```\n */\nexport const useFonts: (map: string | Record<string, FontSource>) => [boolean, Error | null] =\n  typeof window === 'undefined' ? useStaticFonts : useRuntimeFonts;\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SAASC,SAAS,EAAEC,QAAQ;AAG5B,SAASC,WAAWA,CAACC,GAAwC;EAC3D,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;IAC3B,OAAOF,QAAQ,CAACE,GAAG,CAAC;EACtB,CAAC,MAAM;IACL,OAAOC,MAAM,CAACC,IAAI,CAACF,GAAG,CAAC,CAACG,KAAK,CAAEC,UAAU,IAAKN,QAAQ,CAACM,UAAU,CAAC,CAAC;EACrE;AACF;AAEA,SAASC,eAAeA,CAACL,GAAwC;EAC/D,MAAM,CAACM,MAAM,EAAEC,SAAS,CAAC,GAAGX,QAAQ,CAGlCG,WAAW,CAACC,GAAG,CAAC,CACjB;EACD,MAAM,CAACQ,KAAK,EAAEC,QAAQ,CAAC,GAAGb,QAAQ,CAAe,IAAI,CAAC;EAEtDD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