text: let path,fs,collectiveSlugFromUrl,report,reportAndThrowError;_76c‍.x([["fetchStats",()=>fetchStats],["fetchLogo",()=>fetchLogo],["fetchPkg",()=>fetchPkg]]);_76c‍.w("path",[["default",["path"],function(v){path=v}]]);_76c‍.w("fs",[["default",["fs"],function(v){fs=v}]]);_76c‍.w("./transforms",[["collectiveSlugFromUrl",["collectiveSlugFromUrl"],function(v){collectiveSlugFromUrl=v}]]);_76c‍.w("./misc",[["report",["report"],function(v){report=v}],["reportAndThrowError",["reportAndThrowError"],function(v){reportAndThrowError=v}]]);
  
  
  
  
  const fetchJson = async url => {
    try {
      return (await global.fetch(`${url}.json`)).json()
    } catch (e) {
      _76c‍.a("report",report)(e)
      _76c‍.a("reportAndThrowError",reportAndThrowError)(`Could not fetch ${url}.json`)
    }
  }
  
         const fetchStats = async collectiveUrl => {
    try {
      return await fetchJson(collectiveUrl)
    } catch (e) {
      _76c‍.a("report",report)(e)
      _76c‍.a("report",report)(`Could not load the stats for ${_76c‍.a("collectiveSlugFromUrl",collectiveSlugFromUrl)(collectiveUrl)}`)
    }
  };_76c‍.j(["fetchStats"]);
  
         const fetchLogo = async logoUrl => {
    if (!logoUrl) {
      // Silent return if no logo has been provided
      return
    }
    if (!logoUrl.match(/^https?:\/\//)) {
      _76c‍.a("reportAndThrowError",reportAndThrowError)(`Your logo URL isn't well-formatted - ${logoUrl}`)
    }
  
    try {
      const res = (await global.fetch(logoUrl))
      if (isLogoResponseWellFormatted(res)) {
        return res.text()
      }
      _76c‍.a("report",report)(`Error while fetching logo from ${logoUrl}. The response wasn't well-formatted`)
    } catch (e) {
      _76c‍.a("report",report)(`Error while fetching logo from ${logoUrl}`)
    }
  };_76c‍.j(["fetchLogo"]);
  
  const isLogoResponseWellFormatted = res => res.status === 200 && res.headers.get('content-type').match(/^text\/plain/)
  
         const fetchPkg = pathToPkg => {
    const fullPathToPkg = _76c‍.a("path",path).resolve(`${pathToPkg}/package.json`)
    try {
      return JSON.parse(_76c‍.a("fs",fs).readFileSync(fullPathToPkg, 'utf8'))
    } catch (e) {
      _76c‍.a("reportAndThrowError",reportAndThrowError)(`Could not find package.json at ${fullPathToPkg}`)
    }
  };_76c‍.j(["fetchPkg"]);
  