@tgwf/co2 0.11.3 → 0.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/cjs/1byte.js +0 -0
  2. package/dist/cjs/1byte.js.map +0 -0
  3. package/dist/cjs/1byte.test.js +0 -0
  4. package/dist/cjs/1byte.test.js.map +0 -0
  5. package/dist/cjs/co2.js +0 -0
  6. package/dist/cjs/co2.js.map +0 -0
  7. package/dist/cjs/co2.test.js +0 -0
  8. package/dist/cjs/co2.test.js.map +0 -0
  9. package/dist/cjs/constants/file-size.js +0 -0
  10. package/dist/cjs/constants/file-size.js.map +0 -0
  11. package/dist/cjs/constants/index.js +0 -0
  12. package/dist/cjs/constants/index.js.map +0 -0
  13. package/dist/cjs/data/average-intensities-2021.min.js +0 -0
  14. package/dist/cjs/data/average-intensities-2021.min.js.map +0 -0
  15. package/dist/cjs/data/marginal-intensities-2021.min.js +0 -0
  16. package/dist/cjs/data/marginal-intensities-2021.min.js.map +0 -0
  17. package/dist/cjs/helpers/index.js +0 -0
  18. package/dist/cjs/helpers/index.js.map +0 -0
  19. package/dist/cjs/hosting-api.js +0 -4
  20. package/dist/cjs/hosting-api.js.map +2 -2
  21. package/dist/cjs/hosting-api.test.js +0 -0
  22. package/dist/cjs/hosting-api.test.js.map +0 -0
  23. package/dist/cjs/hosting-database.node.test.js +0 -0
  24. package/dist/cjs/hosting-database.node.test.js.map +0 -0
  25. package/dist/cjs/hosting-json.node.js +2 -1
  26. package/dist/cjs/hosting-json.node.js.map +2 -2
  27. package/dist/cjs/hosting-json.node.test.js +0 -0
  28. package/dist/cjs/hosting-json.node.test.js.map +0 -0
  29. package/dist/cjs/hosting-node.js +0 -0
  30. package/dist/cjs/hosting-node.js.map +0 -0
  31. package/dist/cjs/hosting.js +0 -0
  32. package/dist/cjs/hosting.js.map +0 -0
  33. package/dist/cjs/hosting.test.js +3 -10
  34. package/dist/cjs/hosting.test.js.map +2 -2
  35. package/dist/cjs/index-node.js +0 -0
  36. package/dist/cjs/index-node.js.map +0 -0
  37. package/dist/cjs/index.js +0 -0
  38. package/dist/cjs/index.js.map +0 -0
  39. package/dist/cjs/package.json +0 -0
  40. package/dist/cjs/sustainable-web-design.js +0 -0
  41. package/dist/cjs/sustainable-web-design.js.map +0 -0
  42. package/dist/cjs/sustainable-web-design.test.js +0 -0
  43. package/dist/cjs/sustainable-web-design.test.js.map +0 -0
  44. package/dist/esm/1byte.js +0 -0
  45. package/dist/esm/1byte.test.js +0 -0
  46. package/dist/esm/co2.js +0 -0
  47. package/dist/esm/co2.test.js +0 -0
  48. package/dist/esm/constants/file-size.js +0 -0
  49. package/dist/esm/constants/index.js +0 -0
  50. package/dist/esm/data/average-intensities-2021.min.js +0 -0
  51. package/dist/esm/data/marginal-intensities-2021.min.js +0 -0
  52. package/dist/esm/helpers/index.js +0 -0
  53. package/dist/esm/hosting-api.js +0 -4
  54. package/dist/esm/hosting-api.test.js +0 -0
  55. package/dist/esm/hosting-database.node.test.js +0 -0
  56. package/dist/esm/hosting-json.node.test.js +0 -0
  57. package/dist/esm/hosting.js +0 -0
  58. package/dist/esm/hosting.test.js +3 -10
  59. package/dist/esm/index.js +0 -0
  60. package/dist/esm/package.json +0 -0
  61. package/dist/esm/sustainable-web-design.js +0 -0
  62. package/dist/esm/sustainable-web-design.test.js +0 -0
  63. package/dist/iife/index.js +2 -2
  64. package/dist/iife/index.js.map +2 -2
  65. package/package.json +1 -1
  66. package/src/hosting-api.js +5 -4
  67. package/src/hosting-json.node.js +1 -0
  68. package/src/readme.md +0 -66
package/dist/cjs/1byte.js CHANGED
File without changes
File without changes
File without changes
File without changes
package/dist/cjs/co2.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -43,10 +43,6 @@ async function checkDomainsAgainstAPI(domains) {
43
43
  const apiPath = "https://api.thegreenwebfoundation.org/v2/greencheckmulti";
44
44
  const domainsString = JSON.stringify(domains);
45
45
  const req = await fetch(`${apiPath}/${domainsString}`);
46
- log(`${apiPath}/${domainsString}`);
47
- log({ req });
48
- const textResult = await req.text();
49
- log({ textResult });
50
46
  const allGreenCheckResults = await req.json();
51
47
  return greenDomainsFromResults(allGreenCheckResults);
52
48
  } catch (e) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hosting-api.js"],
4
- "sourcesContent": ["\"use strict\";\n\nimport debugFactory from \"debug\";\nconst log = debugFactory(\"tgwf:hostingAPI\");\n\nfunction check(domain) {\n // is it a single domain or an array of them?\n if (typeof domain === \"string\") {\n return checkAgainstAPI(domain);\n } else {\n return checkDomainsAgainstAPI(domain);\n }\n}\n\nasync function checkAgainstAPI(domain) {\n const req = await fetch(\n `https://api.thegreenwebfoundation.org/greencheck/${domain}`\n );\n const res = await req.json();\n return res.green;\n}\n\nasync function checkDomainsAgainstAPI(domains) {\n try {\n const apiPath = \"https://api.thegreenwebfoundation.org/v2/greencheckmulti\";\n const domainsString = JSON.stringify(domains);\n\n const req = await fetch(`${apiPath}/${domainsString}`);\n\n // sanity check API result. Is this the library or\n // the actual API request that's the problem?\n // Is nock mocking node-native fetch API calls properly?\n log(`${apiPath}/${domainsString}`);\n log({ req });\n const textResult = await req.text();\n log({ textResult });\n\n const allGreenCheckResults = await req.json();\n\n return greenDomainsFromResults(allGreenCheckResults);\n } catch (e) {\n return [];\n }\n}\n\nfunction greenDomainsFromResults(greenResults) {\n const entries = Object.entries(greenResults);\n const greenEntries = entries.filter(([key, val]) => val.green);\n return greenEntries.map(([key, val]) => val.url);\n}\n\nexport default {\n check,\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAyB;AACzB,MAAM,MAAM,0BAAa,iBAAiB;AAE1C,eAAe,QAAQ;AAErB,MAAI,OAAO,WAAW,UAAU;AAC9B,WAAO,gBAAgB,MAAM;AAAA,EAC/B,OAAO;AACL,WAAO,uBAAuB,MAAM;AAAA,EACtC;AACF;AAEA,+BAA+B,QAAQ;AACrC,QAAM,MAAM,MAAM,MAChB,oDAAoD,QACtD;AACA,QAAM,MAAM,MAAM,IAAI,KAAK;AAC3B,SAAO,IAAI;AACb;AAEA,sCAAsC,SAAS;AAC7C,MAAI;AACF,UAAM,UAAU;AAChB,UAAM,gBAAgB,KAAK,UAAU,OAAO;AAE5C,UAAM,MAAM,MAAM,MAAM,GAAG,WAAW,eAAe;AAKrD,QAAI,GAAG,WAAW,eAAe;AACjC,QAAI,EAAE,IAAI,CAAC;AACX,UAAM,aAAa,MAAM,IAAI,KAAK;AAClC,QAAI,EAAE,WAAW,CAAC;AAElB,UAAM,uBAAuB,MAAM,IAAI,KAAK;AAE5C,WAAO,wBAAwB,oBAAoB;AAAA,EACrD,SAAS,GAAP;AACA,WAAO,CAAC;AAAA,EACV;AACF;AAEA,iCAAiC,cAAc;AAC7C,QAAM,UAAU,OAAO,QAAQ,YAAY;AAC3C,QAAM,eAAe,QAAQ,OAAO,CAAC,CAAC,KAAK,SAAS,IAAI,KAAK;AAC7D,SAAO,aAAa,IAAI,CAAC,CAAC,KAAK,SAAS,IAAI,GAAG;AACjD;AAEA,IAAO,sBAAQ;AAAA,EACb;AACF;",
4
+ "sourcesContent": ["\"use strict\";\n\nimport debugFactory from \"debug\";\nconst log = debugFactory(\"tgwf:hostingAPI\");\n\nfunction check(domain) {\n // is it a single domain or an array of them?\n if (typeof domain === \"string\") {\n return checkAgainstAPI(domain);\n } else {\n return checkDomainsAgainstAPI(domain);\n }\n}\n\nasync function checkAgainstAPI(domain) {\n const req = await fetch(\n `https://api.thegreenwebfoundation.org/greencheck/${domain}`\n );\n const res = await req.json();\n return res.green;\n}\n\nasync function checkDomainsAgainstAPI(domains) {\n try {\n const apiPath = \"https://api.thegreenwebfoundation.org/v2/greencheckmulti\";\n const domainsString = JSON.stringify(domains);\n\n const req = await fetch(`${apiPath}/${domainsString}`);\n\n // sanity check API result. Is this the library or\n // the actual API request that's the problem?\n // Is nock mocking node-native fetch API calls properly?\n // Commented out the logs for now, as they cause an error to be thrown when using the library.\n // log(`${apiPath}/${domainsString}`);\n // log({ req });\n // const textResult = await req.text();\n // log({ textResult });\n\n const allGreenCheckResults = await req.json();\n\n return greenDomainsFromResults(allGreenCheckResults);\n } catch (e) {\n return [];\n }\n}\n\nfunction greenDomainsFromResults(greenResults) {\n const entries = Object.entries(greenResults);\n const greenEntries = entries.filter(([key, val]) => val.green);\n return greenEntries.map(([key, val]) => val.url);\n}\n\nexport default {\n check,\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAyB;AACzB,MAAM,MAAM,0BAAa,iBAAiB;AAE1C,eAAe,QAAQ;AAErB,MAAI,OAAO,WAAW,UAAU;AAC9B,WAAO,gBAAgB,MAAM;AAAA,EAC/B,OAAO;AACL,WAAO,uBAAuB,MAAM;AAAA,EACtC;AACF;AAEA,+BAA+B,QAAQ;AACrC,QAAM,MAAM,MAAM,MAChB,oDAAoD,QACtD;AACA,QAAM,MAAM,MAAM,IAAI,KAAK;AAC3B,SAAO,IAAI;AACb;AAEA,sCAAsC,SAAS;AAC7C,MAAI;AACF,UAAM,UAAU;AAChB,UAAM,gBAAgB,KAAK,UAAU,OAAO;AAE5C,UAAM,MAAM,MAAM,MAAM,GAAG,WAAW,eAAe;AAWrD,UAAM,uBAAuB,MAAM,IAAI,KAAK;AAE5C,WAAO,wBAAwB,oBAAoB;AAAA,EACrD,SAAS,GAAP;AACA,WAAO,CAAC;AAAA,EACV;AACF;AAEA,iCAAiC,cAAc;AAC7C,QAAM,UAAU,OAAO,QAAQ,YAAY;AAC3C,QAAM,eAAe,QAAQ,OAAO,CAAC,CAAC,KAAK,SAAS,IAAI,KAAK;AAC7D,SAAO,aAAa,IAAI,CAAC,CAAC,KAAK,SAAS,IAAI,GAAG;AACjD;AAEA,IAAO,sBAAQ;AAAA,EACb;AACF;",
6
6
  "names": []
7
7
  }
File without changes
File without changes
File without changes
File without changes
@@ -68,6 +68,7 @@ function checkDomainsInJSON(domains, db) {
68
68
  }
69
69
  module.exports = {
70
70
  check,
71
- loadJSON
71
+ loadJSON,
72
+ greenDomainsFromResults
72
73
  };
73
74
  //# sourceMappingURL=hosting-json.node.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hosting-json.node.js"],
4
- "sourcesContent": ["\"use strict\";\n\nimport fs from \"fs\";\nimport zlib from \"zlib\";\nimport { promisify } from \"util\";\n\nconst readFile = promisify(fs.readFile);\nconst gunzip = promisify(zlib.gunzip);\n\nimport debugFactory from \"debug\";\nconst log = debugFactory(\"tgwf:hostingCache\");\n\nasync function streamToString(stream) {\n return new Promise((resolve, reject) => {\n const chunks = [];\n stream.on(\"error\", reject);\n stream.on(\"data\", (chunk) => chunks.push(chunk));\n stream.on(\"end\", () => resolve(Buffer.concat(chunks)));\n });\n}\n\nasync function getGzippedFileAsJson(jsonPath) {\n const readStream = fs.createReadStream(jsonPath);\n const text = await streamToString(readStream);\n const unzipped = await gunzip(text);\n return unzipped.toString();\n}\n\nasync function loadJSON(jsonPath) {\n const jsonBuffer = jsonPath.endsWith(\".gz\")\n ? await getGzippedFileAsJson(jsonPath)\n : await readFile(jsonPath);\n return JSON.parse(jsonBuffer);\n}\n\nasync function check(domain, db) {\n // is it a single domain or an array of them?\n if (typeof domain === \"string\") {\n return checkInJSON(domain, db);\n } else {\n return checkDomainsInJSON(domain, db);\n }\n}\n\nfunction checkInJSON(domain, db) {\n if (db.indexOf(domain) > -1) {\n return true;\n }\n return false;\n}\n\nfunction greenDomainsFromResults(greenResults) {\n const entries = Object.entries(greenResults);\n const greenEntries = entries.filter(([key, val]) => val.green);\n\n return greenEntries.map(([key, val]) => val.url);\n}\n\nfunction checkDomainsInJSON(domains, db) {\n let greenDomains = [];\n\n for (let domain of domains) {\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eAAe,QAAQ,OAAO,CAAC,CAAC,KAAK,SAAS,IAAI,KAAK;AAE7D,SAAO,aAAa,IAAI,CAAC,CAAC,KAAK,SAAS,IAAI,GAAG;AACjD;AAEA,4BAA4B,SAAS,IAAI;AACvC,MAAI,eAAe,CAAC;AAEpB,WAAS,UAAU,SAAS;AAC1B,QAAI,GAAG,QAAQ,MAAM,IAAI,IAAI;AAC3B,mBAAa,KAAK,MAAM;AAAA,IAC1B;AAAA,EACF;AACA,SAAO;AACT;AAEA,OAAO,UAAU;AAAA,EACf;AAAA,EACA;AACF;",
4
+ "sourcesContent": ["\"use strict\";\n\nimport fs from \"fs\";\nimport zlib from \"zlib\";\nimport { promisify } from \"util\";\n\nconst readFile = promisify(fs.readFile);\nconst gunzip = promisify(zlib.gunzip);\n\nimport debugFactory from \"debug\";\nconst log = debugFactory(\"tgwf:hostingCache\");\n\nasync function streamToString(stream) {\n return new Promise((resolve, reject) => {\n const chunks = [];\n stream.on(\"error\", reject);\n stream.on(\"data\", (chunk) => chunks.push(chunk));\n stream.on(\"end\", () => resolve(Buffer.concat(chunks)));\n });\n}\n\nasync function getGzippedFileAsJson(jsonPath) {\n const readStream = fs.createReadStream(jsonPath);\n const text = await streamToString(readStream);\n const unzipped = await gunzip(text);\n return unzipped.toString();\n}\n\nasync function loadJSON(jsonPath) {\n const jsonBuffer = jsonPath.endsWith(\".gz\")\n ? await getGzippedFileAsJson(jsonPath)\n : await readFile(jsonPath);\n return JSON.parse(jsonBuffer);\n}\n\nasync function check(domain, db) {\n // is it a single domain or an array of them?\n if (typeof domain === \"string\") {\n return checkInJSON(domain, db);\n } else {\n return checkDomainsInJSON(domain, db);\n }\n}\n\nfunction checkInJSON(domain, db) {\n if (db.indexOf(domain) > -1) {\n return true;\n }\n return false;\n}\n\nfunction greenDomainsFromResults(greenResults) {\n const entries = Object.entries(greenResults);\n const greenEntries = entries.filter(([key, val]) => val.green);\n\n return greenEntries.map(([key, val]) => val.url);\n}\n\nfunction checkDomainsInJSON(domains, db) {\n let greenDomains = [];\n\n for (let domain of domains) {\n if (db.indexOf(domain) > -1) {\n greenDomains.push(domain);\n }\n }\n return greenDomains;\n}\n\nmodule.exports = {\n check,\n loadJSON,\n greenDomainsFromResults,\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAEA,gBAAe;AACf,kBAAiB;AACjB,kBAA0B;AAK1B,mBAAyB;AAHzB,MAAM,WAAW,2BAAU,kBAAG,QAAQ;AACtC,MAAM,SAAS,2BAAU,oBAAK,MAAM;AAGpC,MAAM,MAAM,0BAAa,mBAAmB;AAE5C,8BAA8B,QAAQ;AACpC,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,UAAM,SAAS,CAAC;AAChB,WAAO,GAAG,SAAS,MAAM;AACzB,WAAO,GAAG,QAAQ,CAAC,UAAU,OAAO,KAAK,KAAK,CAAC;AAC/C,WAAO,GAAG,OAAO,MAAM,QAAQ,OAAO,OAAO,MAAM,CAAC,CAAC;AAAA,EACvD,CAAC;AACH;AAEA,oCAAoC,UAAU;AAC5C,QAAM,aAAa,kBAAG,iBAAiB,QAAQ;AAC/C,QAAM,OAAO,MAAM,eAAe,UAAU;AAC5C,QAAM,WAAW,MAAM,OAAO,IAAI;AAClC,SAAO,SAAS,SAAS;AAC3B;AAEA,wBAAwB,UAAU;AAChC,QAAM,aAAa,SAAS,SAAS,KAAK,IACtC,MAAM,qBAAqB,QAAQ,IACnC,MAAM,SAAS,QAAQ;AAC3B,SAAO,KAAK,MAAM,UAAU;AAC9B;AAEA,qBAAqB,QAAQ,IAAI;AAE/B,MAAI,OAAO,WAAW,UAAU;AAC9B,WAAO,YAAY,QAAQ,EAAE;AAAA,EAC/B,OAAO;AACL,WAAO,mBAAmB,QAAQ,EAAE;AAAA,EACtC;AACF;AAEA,qBAAqB,QAAQ,IAAI;AAC/B,MAAI,GAAG,QAAQ,MAAM,IAAI,IAAI;AAC3B,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,iCAAiC,cAAc;AAC7C,QAAM,UAAU,OAAO,QAAQ,YAAY;AAC3C,QAAM,eAAe,QAAQ,OAAO,CAAC,CAAC,KAAK,SAAS,IAAI,KAAK;AAE7D,SAAO,aAAa,IAAI,CAAC,CAAC,KAAK,SAAS,IAAI,GAAG;AACjD;AAEA,4BAA4B,SAAS,IAAI;AACvC,MAAI,eAAe,CAAC;AAEpB,WAAS,UAAU,SAAS;AAC1B,QAAI,GAAG,QAAQ,MAAM,IAAI,IAAI;AAC3B,mBAAa,KAAK,MAAM;AAAA,IAC1B;AAAA,EACF;AACA,SAAO;AACT;AAEA,OAAO,UAAU;AAAA,EACf;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": []
7
7
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -52,21 +52,14 @@ describe("hosting", () => {
52
52
  describe("checking a single domain with #check", () => {
53
53
  it("use the API instead", async () => {
54
54
  const db = await import_hosting_node.default.loadJSON(jsonPath);
55
- const res = await import_hosting_node.default.check("google.com", db);
55
+ const res = await import_hosting_node.default.check("google.com");
56
56
  expect(res).toEqual(true);
57
57
  });
58
58
  });
59
- describe("implicitly checking multiple domains with #check", () => {
59
+ describe("checking multiple domains with #check", () => {
60
60
  it("Use the API", async () => {
61
61
  const db = await import_hosting_node.default.loadJSON(jsonPath);
62
- const res = await import_hosting_node.default.check(["google.com", "kochindustries.com"], db);
63
- expect(res).toContain("google.com");
64
- });
65
- });
66
- describe("explicitly checking multiple domains with #checkMulti", () => {
67
- it("use the API", async () => {
68
- const db = await import_hosting_node.default.loadJSON(jsonPath);
69
- const res = await import_hosting_node.default.check(["google.com", "kochindustries.com"], db);
62
+ const res = await import_hosting_node.default.check(["google.com", "kochindustries.com"]);
70
63
  expect(res).toContain("google.com");
71
64
  });
72
65
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hosting.test.js"],
4
- "sourcesContent": ["\"use strict\";\n\nimport fs from \"fs\";\nimport path from \"path\";\n\nimport pagexray from \"pagexray\";\n\nimport hosting from \"./hosting-node.js\";\n\nconst jsonPath = path.resolve(\n __dirname,\n \"..\",\n \"data\",\n \"fixtures\",\n \"url2green.test.json\"\n);\n\ndescribe(\"hosting\", () => {\n let har;\n beforeEach(() => {\n har = JSON.parse(\n fs.readFileSync(\n path.resolve(__dirname, \"../data/fixtures/tgwf.har\"),\n \"utf8\"\n )\n );\n });\n describe(\"checking all domains on a page object with #checkPage\", () => {\n it(\"returns a list of green domains, when passed a page object\", async () => {\n const pages = pagexray.convert(har);\n const pageXrayRun = pages[0];\n const db = await hosting.loadJSON(jsonPath);\n const greenDomains = await hosting.checkPage(pageXrayRun, db);\n\n expect(greenDomains).toHaveLength(11);\n const expectedGreendomains = [\n \"maxcdn.bootstrapcdn.com\",\n \"thegreenwebfoundation.org\",\n \"www.thegreenwebfoundation.org\",\n \"fonts.googleapis.com\",\n \"ajax.googleapis.com\",\n \"assets.digitalclimatestrike.net\",\n \"cdnjs.cloudflare.com\",\n \"graphite.thegreenwebfoundation.org\",\n \"analytics.thegreenwebfoundation.org\",\n \"fonts.gstatic.com\",\n \"api.thegreenwebfoundation.org\",\n ];\n greenDomains.forEach((dom) => {\n expect(expectedGreendomains).toContain(dom);\n });\n });\n });\n describe(\"checking a single domain with #check\", () => {\n it(\"use the API instead\", async () => {\n const db = await hosting.loadJSON(jsonPath);\n const res = await hosting.check(\"google.com\", db);\n expect(res).toEqual(true);\n });\n });\n describe(\"implicitly checking multiple domains with #check\", () => {\n it(\"Use the API\", async () => {\n const db = await hosting.loadJSON(jsonPath);\n\n const res = await hosting.check([\"google.com\", \"kochindustries.com\"], db);\n expect(res).toContain(\"google.com\");\n });\n });\n describe(\"explicitly checking multiple domains with #checkMulti\", () => {\n it(\"use the API\", async () => {\n const db = await hosting.loadJSON(jsonPath);\n const res = await hosting.check([\"google.com\", \"kochindustries.com\"], db);\n expect(res).toContain(\"google.com\");\n });\n });\n});\n"],
5
- "mappings": ";;;;;;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;AAAA,IACpC,CAAC;AAAA,EACH,CAAC;AACD,WAAS,yDAAyD,MAAM;AACtE,OAAG,eAAe,YAAY;AAC5B,YAAM,KAAK,MAAM,4BAAQ,SAAS,QAAQ;AAC1C,YAAM,MAAM,MAAM,4BAAQ,MAAM,CAAC,cAAc,oBAAoB,GAAG,EAAE;AACxE,aAAO,GAAG,EAAE,UAAU,YAAY;AAAA,IACpC,CAAC;AAAA,EACH,CAAC;AACH,CAAC;",
4
+ "sourcesContent": ["\"use strict\";\n\nimport fs from \"fs\";\nimport path from \"path\";\n\nimport pagexray from \"pagexray\";\n\nimport hosting from \"./hosting-node.js\";\n\nconst jsonPath = path.resolve(\n __dirname,\n \"..\",\n \"data\",\n \"fixtures\",\n \"url2green.test.json\"\n);\n\ndescribe(\"hosting\", () => {\n let har;\n beforeEach(() => {\n har = JSON.parse(\n fs.readFileSync(\n path.resolve(__dirname, \"../data/fixtures/tgwf.har\"),\n \"utf8\"\n )\n );\n });\n describe(\"checking all domains on a page object with #checkPage\", () => {\n it(\"returns a list of green domains, when passed a page object\", async () => {\n const pages = pagexray.convert(har);\n const pageXrayRun = pages[0];\n const db = await hosting.loadJSON(jsonPath);\n const greenDomains = await hosting.checkPage(pageXrayRun, db);\n\n expect(greenDomains).toHaveLength(11);\n const expectedGreendomains = [\n \"maxcdn.bootstrapcdn.com\",\n \"thegreenwebfoundation.org\",\n \"www.thegreenwebfoundation.org\",\n \"fonts.googleapis.com\",\n \"ajax.googleapis.com\",\n \"assets.digitalclimatestrike.net\",\n \"cdnjs.cloudflare.com\",\n \"graphite.thegreenwebfoundation.org\",\n \"analytics.thegreenwebfoundation.org\",\n \"fonts.gstatic.com\",\n \"api.thegreenwebfoundation.org\",\n ];\n greenDomains.forEach((dom) => {\n expect(expectedGreendomains).toContain(dom);\n });\n });\n });\n describe(\"checking a single domain with #check\", () => {\n it(\"use the API instead\", async () => {\n const db = await hosting.loadJSON(jsonPath);\n const res = await hosting.check(\"google.com\");\n expect(res).toEqual(true);\n });\n });\n describe(\"checking multiple domains with #check\", () => {\n it(\"Use the API\", async () => {\n const db = await hosting.loadJSON(jsonPath);\n\n const res = await hosting.check([\"google.com\", \"kochindustries.com\"]);\n expect(res).toContain(\"google.com\");\n });\n });\n});\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAEA,gBAAe;AACf,kBAAiB;AAEjB,sBAAqB;AAErB,0BAAoB;AAEpB,MAAM,WAAW,oBAAK,QACpB,WACA,MACA,QACA,YACA,qBACF;AAEA,SAAS,WAAW,MAAM;AACxB,MAAI;AACJ,aAAW,MAAM;AACf,UAAM,KAAK,MACT,kBAAG,aACD,oBAAK,QAAQ,WAAW,2BAA2B,GACnD,MACF,CACF;AAAA,EACF,CAAC;AACD,WAAS,yDAAyD,MAAM;AACtE,OAAG,8DAA8D,YAAY;AAC3E,YAAM,QAAQ,wBAAS,QAAQ,GAAG;AAClC,YAAM,cAAc,MAAM;AAC1B,YAAM,KAAK,MAAM,4BAAQ,SAAS,QAAQ;AAC1C,YAAM,eAAe,MAAM,4BAAQ,UAAU,aAAa,EAAE;AAE5D,aAAO,YAAY,EAAE,aAAa,EAAE;AACpC,YAAM,uBAAuB;AAAA,QAC3B;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AACA,mBAAa,QAAQ,CAAC,QAAQ;AAC5B,eAAO,oBAAoB,EAAE,UAAU,GAAG;AAAA,MAC5C,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACD,WAAS,wCAAwC,MAAM;AACrD,OAAG,uBAAuB,YAAY;AACpC,YAAM,KAAK,MAAM,4BAAQ,SAAS,QAAQ;AAC1C,YAAM,MAAM,MAAM,4BAAQ,MAAM,YAAY;AAC5C,aAAO,GAAG,EAAE,QAAQ,IAAI;AAAA,IAC1B,CAAC;AAAA,EACH,CAAC;AACD,WAAS,yCAAyC,MAAM;AACtD,OAAG,eAAe,YAAY;AAC5B,YAAM,KAAK,MAAM,4BAAQ,SAAS,QAAQ;AAE1C,YAAM,MAAM,MAAM,4BAAQ,MAAM,CAAC,cAAc,oBAAoB,CAAC;AACpE,aAAO,GAAG,EAAE,UAAU,YAAY;AAAA,IACpC,CAAC;AAAA,EACH,CAAC;AACH,CAAC;",
6
6
  "names": []
7
7
  }
File without changes
File without changes
package/dist/cjs/index.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/esm/1byte.js CHANGED
File without changes
File without changes
package/dist/esm/co2.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -18,10 +18,6 @@ async function checkDomainsAgainstAPI(domains) {
18
18
  const apiPath = "https://api.thegreenwebfoundation.org/v2/greencheckmulti";
19
19
  const domainsString = JSON.stringify(domains);
20
20
  const req = await fetch(`${apiPath}/${domainsString}`);
21
- log(`${apiPath}/${domainsString}`);
22
- log({ req });
23
- const textResult = await req.text();
24
- log({ textResult });
25
21
  const allGreenCheckResults = await req.json();
26
22
  return greenDomainsFromResults(allGreenCheckResults);
27
23
  } catch (e) {
File without changes
File without changes
File without changes
File without changes
@@ -37,21 +37,14 @@ describe("hosting", () => {
37
37
  describe("checking a single domain with #check", () => {
38
38
  it("use the API instead", async () => {
39
39
  const db = await hosting.loadJSON(jsonPath);
40
- const res = await hosting.check("google.com", db);
40
+ const res = await hosting.check("google.com");
41
41
  expect(res).toEqual(true);
42
42
  });
43
43
  });
44
- describe("implicitly checking multiple domains with #check", () => {
44
+ describe("checking multiple domains with #check", () => {
45
45
  it("Use the API", async () => {
46
46
  const db = await hosting.loadJSON(jsonPath);
47
- const res = await hosting.check(["google.com", "kochindustries.com"], db);
48
- expect(res).toContain("google.com");
49
- });
50
- });
51
- describe("explicitly checking multiple domains with #checkMulti", () => {
52
- it("use the API", async () => {
53
- const db = await hosting.loadJSON(jsonPath);
54
- const res = await hosting.check(["google.com", "kochindustries.com"], db);
47
+ const res = await hosting.check(["google.com", "kochindustries.com"]);
55
48
  expect(res).toContain("google.com");
56
49
  });
57
50
  });
package/dist/esm/index.js CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- var co2=(()=>{var fe=Object.create;var S=Object.defineProperty;var Ce=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var Ee=Object.getPrototypeOf,pe=Object.prototype.hasOwnProperty;var G=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),me=(r,t)=>{for(var e in t)S(r,e,{get:t[e],enumerable:!0})},j=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of de(t))!pe.call(r,o)&&o!==e&&S(r,o,{get:()=>t[o],enumerable:!(n=Ce(t,o))||n.enumerable});return r};var b=(r,t,e)=>(e=r!=null?fe(Ee(r)):{},j(t||!r||!r.__esModule?S(e,"default",{value:r,enumerable:!0}):e,r)),Re=r=>j(S({},"__esModule",{value:!0}),r);var $=G((Je,z)=>{var y=1e3,g=y*60,A=g*60,m=A*24,he=m*7,ye=m*365.25;z.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return ge(r);if(e==="number"&&isFinite(r))return t.long?Ne(r):Ae(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function ge(r){if(r=String(r),!(r.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(!!t){var e=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return e*ye;case"weeks":case"week":case"w":return e*he;case"days":case"day":case"d":return e*m;case"hours":case"hour":case"hrs":case"hr":case"h":return e*A;case"minutes":case"minute":case"mins":case"min":case"m":return e*g;case"seconds":case"second":case"secs":case"sec":case"s":return e*y;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function Ae(r){var t=Math.abs(r);return t>=m?Math.round(r/m)+"d":t>=A?Math.round(r/A)+"h":t>=g?Math.round(r/g)+"m":t>=y?Math.round(r/y)+"s":r+"ms"}function Ne(r){var t=Math.abs(r);return t>=m?T(r,t,m,"day"):t>=A?T(r,t,A,"hour"):t>=g?T(r,t,g,"minute"):t>=y?T(r,t,y,"second"):r+" ms"}function T(r,t,e,n){var o=t>=e*1.5;return Math.round(r/e)+" "+n+(o?"s":"")}});var q=G((qe,J)=>{function Fe(r){e.debug=e,e.default=e,e.coerce=h,e.disable=s,e.enable=o,e.enabled=a,e.humanize=$(),e.destroy=E,Object.keys(r).forEach(i=>{e[i]=r[i]}),e.names=[],e.skips=[],e.formatters={};function t(i){let c=0;for(let u=0;u<i.length;u++)c=(c<<5)-c+i.charCodeAt(u),c|=0;return e.colors[Math.abs(c)%e.colors.length]}e.selectColor=t;function e(i){let c,u=null,F,Y;function d(...C){if(!d.enabled)return;let p=d,B=Number(new Date),ae=B-(c||B);p.diff=ae,p.prev=c,p.curr=B,c=B,C[0]=e.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let O=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(P,ue)=>{if(P==="%%")return"%";O++;let k=e.formatters[ue];if(typeof k=="function"){let le=C[O];P=k.call(p,le),C.splice(O,1),O--}return P}),e.formatArgs.call(p,C),(p.log||e.log).apply(p,C)}return d.namespace=i,d.useColors=e.useColors(),d.color=e.selectColor(i),d.extend=n,d.destroy=e.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>u!==null?u:(F!==e.namespaces&&(F=e.namespaces,Y=e.enabled(i)),Y),set:C=>{u=C}}),typeof e.init=="function"&&e.init(d),d}function n(i,c){let u=e(this.namespace+(typeof c>"u"?":":c)+i);return u.log=this.log,u}function o(i){e.save(i),e.namespaces=i,e.names=[],e.skips=[];let c,u=(typeof i=="string"?i:"").split(/[\s,]+/),F=u.length;for(c=0;c<F;c++)!u[c]||(i=u[c].replace(/\*/g,".*?"),i[0]==="-"?e.skips.push(new RegExp("^"+i.slice(1)+"$")):e.names.push(new RegExp("^"+i+"$")))}function s(){let i=[...e.names.map(f),...e.skips.map(f).map(c=>"-"+c)].join(",");return e.enable(""),i}function a(i){if(i[i.length-1]==="*")return!0;let c,u;for(c=0,u=e.skips.length;c<u;c++)if(e.skips[c].test(i))return!1;for(c=0,u=e.names.length;c<u;c++)if(e.names[c].test(i))return!0;return!1}function f(i){return i.toString().substring(2,i.toString().length-2).replace(/\.\*\?$/,"*")}function h(i){return i instanceof Error?i.stack||i.message:i}function E(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return e.enable(e.load()),e}J.exports=Fe});var I=G((l,_)=>{l.formatArgs=Oe;l.save=Se;l.load=Te;l.useColors=Be;l.storage=_e();l.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();l.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Be(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Oe(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+_.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;r.splice(1,0,t,"color: inherit");let e=0,n=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(e++,o==="%c"&&(n=e))}),r.splice(n,0,t)}l.log=console.debug||console.log||(()=>{});function Se(r){try{r?l.storage.setItem("debug",r):l.storage.removeItem("debug")}catch{}}function Te(){let r;try{r=l.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function _e(){try{return localStorage}catch{}}_.exports=q()(l);var{formatters:Ie}=_.exports;Ie.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var je={};me(je,{averageIntensity:()=>W,co2:()=>v,default:()=>ke,hosting:()=>V,marginalIntensity:()=>H});var w=4883333333333333e-25;var M=class{constructor(t){this.options=t,this.KWH_PER_BYTE_FOR_NETWORK=w}perByte(t,e){if(t<1)return 0;if(e){let o=t*72e-12*0,s=t*w*475;return o+s}let n=72e-12+w;return t*n*519}};var Z=M;var oe=b(I());var L={GIGABYTE:1e9};var N=r=>parseFloat(r.toFixed(2));var Q=(0,oe.default)("tgwf:sustainable-web-design"),Pe=.81,X=.52,ee=.14,te=.15,re=.19,R=442,ne=50,Ge=.75,be=.25,we=.02,D=class{constructor(t){this.options=t}energyPerByteByComponent(t){let n=t/L.GIGABYTE*Pe;return{consumerDeviceEnergy:n*X,networkEnergy:n*ee,productionEnergy:n*re,dataCenterEnergy:n*te}}co2byComponent(t,e=R){let n={};for(let[o,s]of Object.entries(t))o.startsWith("dataCenterEnergy")?n[o]=s*e:n[o]=s*R;return n}perByte(t,e=R){let n=this.energyPerByteByComponent(t);if(Boolean(e)===!1&&(e=R),e===!0&&(e=ne),typeof e!="number")throw new Error(`perByte expects a numeric value or boolean for the carbon intensity value. Received: ${e}`);let o=this.co2byComponent(n,e);return Object.values(o).reduce((a,f)=>a+f)}perVisit(t,e=R){let n=this.energyPerVisitByComponent(t);if(Boolean(e)===!1&&(e=R),e===!0&&(e=ne),typeof e!="number")throw new Error(`perVisit expects a numeric value or boolean for the carbon intensity value. Received: ${e}`);let o=this.co2byComponent(n,e);return Object.values(o).reduce((a,f)=>a+f)}energyPerByte(t){let e=this.energyPerByteByComponent(t);return Object.values(e).reduce((o,s)=>o+s)}energyPerVisitByComponent(t,e=Ge,n=be,o=we){let s=this.energyPerByteByComponent(t),a={};Q({energyBycomponent:s});let f=Object.values(s);for(let[h,E]of Object.entries(s))a[`${h} - first`]=E*e,a[`${h} - subsequent`]=E*n*o;return Q({cacheAdjustedSegmentEnergy:a}),a}energyPerVisit(t){let e=0,n=0,o=Object.entries(this.energyPerVisitByComponent(t));for(let[s,a]of o)s.indexOf("first")>0&&(e+=a);for(let[s,a]of o)s.indexOf("subsequent")>0&&(n+=a);return e+n}emissionsPerVisitInGrams(t,e=R){return N(t*e)}annualEnergyInKwh(t,e=1e3){return t*e*12}annualEmissionsInGrams(t,e=1e3){return t*e*12}annualSegmentEnergy(t){return{consumerDeviceEnergy:N(t*X),networkEnergy:N(t*ee),dataCenterEnergy:N(t*te),productionEnergy:N(t*re)}}};var U=D;var K=class{constructor(t){if(this.model=new U,t?.model==="1byte")this.model=new Z;else if(t?.model==="swd")this.model=new U;else if(t?.model)throw new Error(`"${t.model}" is not a valid model. Please use "1byte" for the OneByte model, and "swd" for the Sustainable Web Design model.
1
+ var co2=(()=>{var le=Object.create;var S=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,Ee=Object.prototype.hasOwnProperty;var G=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),pe=(r,t)=>{for(var e in t)S(r,e,{get:t[e],enumerable:!0})},k=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ce(t))!Ee.call(r,n)&&n!==e&&S(r,n,{get:()=>t[n],enumerable:!(o=fe(t,n))||o.enumerable});return r};var b=(r,t,e)=>(e=r!=null?le(de(r)):{},k(t||!r||!r.__esModule?S(e,"default",{value:r,enumerable:!0}):e,r)),me=r=>k(S({},"__esModule",{value:!0}),r);var z=G(($e,Z)=>{var y=1e3,g=y*60,A=g*60,m=A*24,Re=m*7,he=m*365.25;Z.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return ye(r);if(e==="number"&&isFinite(r))return t.long?Ae(r):ge(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function ye(r){if(r=String(r),!(r.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(!!t){var e=parseFloat(t[1]),o=(t[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return e*he;case"weeks":case"week":case"w":return e*Re;case"days":case"day":case"d":return e*m;case"hours":case"hour":case"hrs":case"hr":case"h":return e*A;case"minutes":case"minute":case"mins":case"min":case"m":return e*g;case"seconds":case"second":case"secs":case"sec":case"s":return e*y;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function ge(r){var t=Math.abs(r);return t>=m?Math.round(r/m)+"d":t>=A?Math.round(r/A)+"h":t>=g?Math.round(r/g)+"m":t>=y?Math.round(r/y)+"s":r+"ms"}function Ae(r){var t=Math.abs(r);return t>=m?T(r,t,m,"day"):t>=A?T(r,t,A,"hour"):t>=g?T(r,t,g,"minute"):t>=y?T(r,t,y,"second"):r+" ms"}function T(r,t,e,o){var n=t>=e*1.5;return Math.round(r/e)+" "+o+(n?"s":"")}});var J=G((Je,$)=>{function Ne(r){e.debug=e,e.default=e,e.coerce=h,e.disable=s,e.enable=n,e.enabled=a,e.humanize=z(),e.destroy=E,Object.keys(r).forEach(i=>{e[i]=r[i]}),e.names=[],e.skips=[],e.formatters={};function t(i){let c=0;for(let u=0;u<i.length;u++)c=(c<<5)-c+i.charCodeAt(u),c|=0;return e.colors[Math.abs(c)%e.colors.length]}e.selectColor=t;function e(i){let c,u=null,F,H;function d(...C){if(!d.enabled)return;let p=d,B=Number(new Date),ce=B-(c||B);p.diff=ce,p.prev=c,p.curr=B,c=B,C[0]=e.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let O=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(P,ae)=>{if(P==="%%")return"%";O++;let Y=e.formatters[ae];if(typeof Y=="function"){let ue=C[O];P=Y.call(p,ue),C.splice(O,1),O--}return P}),e.formatArgs.call(p,C),(p.log||e.log).apply(p,C)}return d.namespace=i,d.useColors=e.useColors(),d.color=e.selectColor(i),d.extend=o,d.destroy=e.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>u!==null?u:(F!==e.namespaces&&(F=e.namespaces,H=e.enabled(i)),H),set:C=>{u=C}}),typeof e.init=="function"&&e.init(d),d}function o(i,c){let u=e(this.namespace+(typeof c>"u"?":":c)+i);return u.log=this.log,u}function n(i){e.save(i),e.namespaces=i,e.names=[],e.skips=[];let c,u=(typeof i=="string"?i:"").split(/[\s,]+/),F=u.length;for(c=0;c<F;c++)!u[c]||(i=u[c].replace(/\*/g,".*?"),i[0]==="-"?e.skips.push(new RegExp("^"+i.slice(1)+"$")):e.names.push(new RegExp("^"+i+"$")))}function s(){let i=[...e.names.map(f),...e.skips.map(f).map(c=>"-"+c)].join(",");return e.enable(""),i}function a(i){if(i[i.length-1]==="*")return!0;let c,u;for(c=0,u=e.skips.length;c<u;c++)if(e.skips[c].test(i))return!1;for(c=0,u=e.names.length;c<u;c++)if(e.names[c].test(i))return!0;return!1}function f(i){return i.toString().substring(2,i.toString().length-2).replace(/\.\*\?$/,"*")}function h(i){return i instanceof Error?i.stack||i.message:i}function E(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return e.enable(e.load()),e}$.exports=Ne});var I=G((l,_)=>{l.formatArgs=Be;l.save=Oe;l.load=Se;l.useColors=Fe;l.storage=Te();l.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();l.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Fe(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Be(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+_.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;r.splice(1,0,t,"color: inherit");let e=0,o=0;r[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(e++,n==="%c"&&(o=e))}),r.splice(o,0,t)}l.log=console.debug||console.log||(()=>{});function Oe(r){try{r?l.storage.setItem("debug",r):l.storage.removeItem("debug")}catch{}}function Se(){let r;try{r=l.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function Te(){try{return localStorage}catch{}}_.exports=J()(l);var{formatters:_e}=_.exports;_e.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var ke={};pe(ke,{averageIntensity:()=>x,co2:()=>v,default:()=>Ye,hosting:()=>V,marginalIntensity:()=>W});var w=4883333333333333e-25;var M=class{constructor(t){this.options=t,this.KWH_PER_BYTE_FOR_NETWORK=w}perByte(t,e){if(t<1)return 0;if(e){let n=t*72e-12*0,s=t*w*475;return n+s}let o=72e-12+w;return t*o*519}};var j=M;var ne=b(I());var L={GIGABYTE:1e9};var N=r=>parseFloat(r.toFixed(2));var q=(0,ne.default)("tgwf:sustainable-web-design"),Ie=.81,Q=.52,X=.14,ee=.15,te=.19,R=442,re=50,Pe=.75,Ge=.25,be=.02,D=class{constructor(t){this.options=t}energyPerByteByComponent(t){let o=t/L.GIGABYTE*Ie;return{consumerDeviceEnergy:o*Q,networkEnergy:o*X,productionEnergy:o*te,dataCenterEnergy:o*ee}}co2byComponent(t,e=R){let o={};for(let[n,s]of Object.entries(t))n.startsWith("dataCenterEnergy")?o[n]=s*e:o[n]=s*R;return o}perByte(t,e=R){let o=this.energyPerByteByComponent(t);if(Boolean(e)===!1&&(e=R),e===!0&&(e=re),typeof e!="number")throw new Error(`perByte expects a numeric value or boolean for the carbon intensity value. Received: ${e}`);let n=this.co2byComponent(o,e);return Object.values(n).reduce((a,f)=>a+f)}perVisit(t,e=R){let o=this.energyPerVisitByComponent(t);if(Boolean(e)===!1&&(e=R),e===!0&&(e=re),typeof e!="number")throw new Error(`perVisit expects a numeric value or boolean for the carbon intensity value. Received: ${e}`);let n=this.co2byComponent(o,e);return Object.values(n).reduce((a,f)=>a+f)}energyPerByte(t){let e=this.energyPerByteByComponent(t);return Object.values(e).reduce((n,s)=>n+s)}energyPerVisitByComponent(t,e=Pe,o=Ge,n=be){let s=this.energyPerByteByComponent(t),a={};q({energyBycomponent:s});let f=Object.values(s);for(let[h,E]of Object.entries(s))a[`${h} - first`]=E*e,a[`${h} - subsequent`]=E*o*n;return q({cacheAdjustedSegmentEnergy:a}),a}energyPerVisit(t){let e=0,o=0,n=Object.entries(this.energyPerVisitByComponent(t));for(let[s,a]of n)s.indexOf("first")>0&&(e+=a);for(let[s,a]of n)s.indexOf("subsequent")>0&&(o+=a);return e+o}emissionsPerVisitInGrams(t,e=R){return N(t*e)}annualEnergyInKwh(t,e=1e3){return t*e*12}annualEmissionsInGrams(t,e=1e3){return t*e*12}annualSegmentEnergy(t){return{consumerDeviceEnergy:N(t*Q),networkEnergy:N(t*X),dataCenterEnergy:N(t*ee),productionEnergy:N(t*te)}}};var U=D;var K=class{constructor(t){if(this.model=new U,t?.model==="1byte")this.model=new j;else if(t?.model==="swd")this.model=new U;else if(t?.model)throw new Error(`"${t.model}" is not a valid model. Please use "1byte" for the OneByte model, and "swd" for the Sustainable Web Design model.
2
2
  See https://developers.thegreenwebfoundation.org/co2js/models/ to learn more about the models available in CO2.js.`)}perByte(t,e){return this.model.perByte(t,e)}perVisit(t,e){if(this.model?.perVisit)return this.model.perVisit(t,e);throw new Error(`The perVisit() method is not supported in the model you are using. Try using perByte() instead.
3
- See https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more about the methods available in CO2.js.`)}perDomain(t,e){let n=[];for(let o of Object.keys(t.domains)){let s;e&&e.indexOf(o)>-1?s=this.perByte(t.domains[o].transferSize,!0):s=this.perByte(t.domains[o].transferSize),n.push({domain:o,co2:s,transferSize:t.domains[o].transferSize})}return n.sort((o,s)=>s.co2-o.co2),n}perPage(t,e){let n=this.perDomain(t,e),o=0;for(let s of n)o+=s.co2;return o}perContentType(t,e){let n={};for(let s of t.assets){let a=new URL(s.url).domain,f=s.transferSize,h=this.perByte(f,e&&e.indexOf(a)>-1),E=s.type;n[E]||(n[E]={co2:0,transferSize:0}),n[E].co2+=h,n[E].transferSize+=f}let o=[];for(let s of Object.keys(n))o.push({type:s,co2:n[s].co2,transferSize:n[s].transferSize});return o.sort((s,a)=>a.co2-s.co2),o}dirtiestResources(t,e){let n=[];for(let o of t.assets){let s=new URL(o.url).domain,a=o.transferSize,f=this.perByte(a,e&&e.indexOf(s)>-1);n.push({url:o.url,co2:f,transferSize:a})}return n.sort((o,s)=>s.co2-o.co2),n.slice(0,n.length>10?10:n.length)}perParty(t,e){let n=0,o=0,s=t.firstPartyRegEx;for(let a of Object.keys(t.domains))a.match(s)?n+=this.perByte(t.domains[a].transferSize,e&&e.indexOf(a)>-1):o+=this.perByte(t.domains[a].transferSize,e&&e.indexOf(a)>-1);return{firstParty:n,thirdParty:o}}};var v=K;var ce=b(I());var se=b(I()),x=(0,se.default)("tgwf:hostingAPI");function Me(r){return typeof r=="string"?Le(r):De(r)}async function Le(r){return(await(await fetch(`https://api.thegreenwebfoundation.org/greencheck/${r}`)).json()).green}async function De(r){try{let t="https://api.thegreenwebfoundation.org/v2/greencheckmulti",e=JSON.stringify(r),n=await fetch(`${t}/${e}`);x(`${t}/${e}`),x({req:n});let o=await n.text();x({textResult:o});let s=await n.json();return Ue(s)}catch{return[]}}function Ue(r){return Object.entries(r).filter(([n,o])=>o.green).map(([n,o])=>o.url)}var ie={check:Me};var ut=(0,ce.default)("tgwf:hosting");function Ke(r,t){return ie.check(r)}var V={check:Ke};var ve={AFRICA:"489.26",ARG:"365.292",ARM:"206.522",ASIA:"543.57",AUS:"526.876",AUT:"145.083",AZE:"536.585",BGD:"559.606",BLR:"472.727",BEL:"156.063",BOL:"311.475",BIH:"470.982",BRA:"144.677",BGR:"364.136",BDI:"275.862",CAN:"123.859",CHL:"395.565",CHN:"549.288",CRI:"30.903",HRV:"212.161",CYP:"601.19",CZE:"401.272",DNK:"240.419",ECU:"132.964",EGY:"470.879",SLV:"180.87",EST:"488.529",EU:"261.43",EUROPE:"277.64",FIN:"152.651",FRA:"67.781",G20:"445.9",G7:"338.04",GEO:"105.685",DEU:"363.982",GRC:"363.388",HUN:"236.271",IND:"632.656",IRL:"361.274",ITA:"340.937",JPN:"460.647",KAZ:"656.097",KEN:"104.0","LATIN AMERICA AND CARIBBEAN":"261.51",LVA:"226.351",LTU:"247.475",LUX:"183.824",MLT:"452.055",MEX:"391.582",MDA:"642.512",MNG:"725.26",MNE:"335.958",NLD:"386.189","NORTH AMERICA":"345.38",MKD:"444.191",NOR:"26.131",OCEANIA:"479.98",OECD:"338.24",PAK:"363.065",PER:"241.492",PHL:"579.689",POL:"657.138",PRT:"222.632",ROU:"255.718",RUS:"355.431",SAU:"568.967",SEN:"540.098",SRB:"549.083",SGP:"488.21",SVK:"173.854",SVN:"241.956",ZAF:"706.991",KOR:"442.389",ESP:"193.737",SWE:"43.9",CHE:"58.952",TWN:"565.629",TJK:"72.823",THA:"503.034",TUN:"470.848",TUR:"432.293",UKR:"240.28",GBR:"268.255",USA:"378.625",VNM:"491.192",WORLD:"442.37"},xe="average",Ve="2021";var W={data:ve,type:xe,year:Ve};var We={AFG:"414",ALB:"0",DZA:"528",ASM:"753",AND:"188",AGO:"1476",AIA:"753",ATG:"753",ARG:"478",ARM:"390",ABW:"753",AUS:"808",AUT:"242",AZE:"534","AZORES (PORTUGAL)":"753",BHS:"753",BHR:"726",BGD:"528",BRB:"749",BLR:"400",BEL:"252",BLZ:"403",BEN:"745",BMU:"753",BTN:"0",BOL:"604",BES:"753",BIH:"1197",BWA:"1486",BRA:"284",VGB:"753",BRN:"681",BGR:"911",BFA:"753",BDI:"414",KHM:"1046",CMR:"659",CAN:"372",CYM:"753",CPV:"753",CAF:"188",TCD:"753","CHANNEL ISLANDS (U.K)":"753",CHL:"657",CHN:"899",COL:"410",COM:"753",COD:"0",COG:"659",COK:"753",CRI:"108",CIV:"466",HRV:"294",CUB:"559",CUW:"876",CYP:"751",CZE:"902",DNK:"362",DJI:"753",DMA:"753",DOM:"601",ECU:"560",EGY:"554",SLV:"547",GNQ:"632",ERI:"915",EST:"1057",SWZ:"0",ETH:"0",FLK:"753",FRO:"753",FJI:"640",FIN:"267",FRA:"158",GUF:"423",PYF:"753",GAB:"946",GMB:"753",GEO:"289",DEU:"650",GHA:"495",GIB:"779",GRC:"507",GRL:"264",GRD:"753",GLP:"753",GUM:"753",GTM:"798",GIN:"753",GNB:"753",GUY:"847",HTI:"1048",HND:"662",HUN:"296",ISL:"0",IND:"951",IDN:"783",IRN:"592",IRQ:"1080",IRL:"380",IMN:"436",ISR:"394",ITA:"414",JAM:"711",JPN:"471",JOR:"529",KAZ:"797",KEN:"574",KIR:"753",PRK:"754",KOR:"555",XKX:"1145",KWT:"675",KGZ:"217",LAO:"1069",LVA:"240",LBN:"794",LSO:"0",LBR:"677",LBY:"668",LIE:"151",LTU:"211",LUX:"220",MDG:"876","MADEIRA (PORTUGAL)":"663",MWI:"489",MYS:"551",MDV:"753",MLI:"1076",MLT:"520",MHL:"753",MTQ:"753",MRT:"753",MUS:"700",MYT:"753",MEX:"531",FSM:"753",MDA:"541",MCO:"158",MNG:"1366",MNE:"899",MSR:"753",MAR:"729",MOZ:"234",MMR:"719",NAM:"355",NRU:"753",NPL:"0",NLD:"326",NCL:"779",NZL:"246",NIC:"675",NER:"772",NGA:"526",NIU:"753",MKD:"851",MNP:"753",NOR:"47",OMN:"479",PAK:"592",PLW:"753",PSE:"719",PAN:"477",PNG:"597",PRY:"0",PER:"473",PHL:"672",POL:"828",PRT:"389",PRI:"596",QAT:"503",REU:"772",ROU:"489",RUS:"476",RWA:"712",SHN:"753",KNA:"753",LCA:"753",MAF:"753",SPM:"753",VCT:"753",WSM:"753",SMR:"414",STP:"753",SAU:"592",SEN:"870",SRB:"1086",SYC:"753",SLE:"489",SGP:"379",SXM:"753",SVK:"332",SVN:"620",SLB:"753",SOM:"753",ZAF:"1070",SSD:"890",ESP:"402",LKA:"731",SDN:"736",SUR:"1029",SWE:"68",CHE:"48",SYR:"713",TWN:"484",TJK:"255",TZA:"531",THA:"450",TLS:"753",TGO:"859",TON:"753",TTO:"559",TUN:"468",TUR:"376",TKM:"927",TCA:"753",TUV:"753",UGA:"279",UKR:"768",ARE:"556",GBR:"380",USA:"416",URY:"174",UZB:"612",VUT:"753",VEN:"711",VNM:"560",VIR:"650",YEM:"807",ZMB:"416",ZWE:"1575","MEMO: EU 27":"409"},He="marginal",Ye="2021";var H={data:We,type:He,year:Ye};var ke={co2:v,hosting:V,averageIntensity:W,marginalIntensity:H};return Re(je);})();
3
+ See https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more about the methods available in CO2.js.`)}perDomain(t,e){let o=[];for(let n of Object.keys(t.domains)){let s;e&&e.indexOf(n)>-1?s=this.perByte(t.domains[n].transferSize,!0):s=this.perByte(t.domains[n].transferSize),o.push({domain:n,co2:s,transferSize:t.domains[n].transferSize})}return o.sort((n,s)=>s.co2-n.co2),o}perPage(t,e){let o=this.perDomain(t,e),n=0;for(let s of o)n+=s.co2;return n}perContentType(t,e){let o={};for(let s of t.assets){let a=new URL(s.url).domain,f=s.transferSize,h=this.perByte(f,e&&e.indexOf(a)>-1),E=s.type;o[E]||(o[E]={co2:0,transferSize:0}),o[E].co2+=h,o[E].transferSize+=f}let n=[];for(let s of Object.keys(o))n.push({type:s,co2:o[s].co2,transferSize:o[s].transferSize});return n.sort((s,a)=>a.co2-s.co2),n}dirtiestResources(t,e){let o=[];for(let n of t.assets){let s=new URL(n.url).domain,a=n.transferSize,f=this.perByte(a,e&&e.indexOf(s)>-1);o.push({url:n.url,co2:f,transferSize:a})}return o.sort((n,s)=>s.co2-n.co2),o.slice(0,o.length>10?10:o.length)}perParty(t,e){let o=0,n=0,s=t.firstPartyRegEx;for(let a of Object.keys(t.domains))a.match(s)?o+=this.perByte(t.domains[a].transferSize,e&&e.indexOf(a)>-1):n+=this.perByte(t.domains[a].transferSize,e&&e.indexOf(a)>-1);return{firstParty:o,thirdParty:n}}};var v=K;var ie=b(I());var oe=b(I()),ct=(0,oe.default)("tgwf:hostingAPI");function we(r){return typeof r=="string"?Me(r):Le(r)}async function Me(r){return(await(await fetch(`https://api.thegreenwebfoundation.org/greencheck/${r}`)).json()).green}async function Le(r){try{let t="https://api.thegreenwebfoundation.org/v2/greencheckmulti",e=JSON.stringify(r),n=await(await fetch(`${t}/${e}`)).json();return De(n)}catch{return[]}}function De(r){return Object.entries(r).filter(([o,n])=>n.green).map(([o,n])=>n.url)}var se={check:we};var ut=(0,ie.default)("tgwf:hosting");function Ue(r,t){return se.check(r)}var V={check:Ue};var Ke={AFRICA:"489.26",ARG:"365.292",ARM:"206.522",ASIA:"543.57",AUS:"526.876",AUT:"145.083",AZE:"536.585",BGD:"559.606",BLR:"472.727",BEL:"156.063",BOL:"311.475",BIH:"470.982",BRA:"144.677",BGR:"364.136",BDI:"275.862",CAN:"123.859",CHL:"395.565",CHN:"549.288",CRI:"30.903",HRV:"212.161",CYP:"601.19",CZE:"401.272",DNK:"240.419",ECU:"132.964",EGY:"470.879",SLV:"180.87",EST:"488.529",EU:"261.43",EUROPE:"277.64",FIN:"152.651",FRA:"67.781",G20:"445.9",G7:"338.04",GEO:"105.685",DEU:"363.982",GRC:"363.388",HUN:"236.271",IND:"632.656",IRL:"361.274",ITA:"340.937",JPN:"460.647",KAZ:"656.097",KEN:"104.0","LATIN AMERICA AND CARIBBEAN":"261.51",LVA:"226.351",LTU:"247.475",LUX:"183.824",MLT:"452.055",MEX:"391.582",MDA:"642.512",MNG:"725.26",MNE:"335.958",NLD:"386.189","NORTH AMERICA":"345.38",MKD:"444.191",NOR:"26.131",OCEANIA:"479.98",OECD:"338.24",PAK:"363.065",PER:"241.492",PHL:"579.689",POL:"657.138",PRT:"222.632",ROU:"255.718",RUS:"355.431",SAU:"568.967",SEN:"540.098",SRB:"549.083",SGP:"488.21",SVK:"173.854",SVN:"241.956",ZAF:"706.991",KOR:"442.389",ESP:"193.737",SWE:"43.9",CHE:"58.952",TWN:"565.629",TJK:"72.823",THA:"503.034",TUN:"470.848",TUR:"432.293",UKR:"240.28",GBR:"268.255",USA:"378.625",VNM:"491.192",WORLD:"442.37"},ve="average",Ve="2021";var x={data:Ke,type:ve,year:Ve};var xe={AFG:"414",ALB:"0",DZA:"528",ASM:"753",AND:"188",AGO:"1476",AIA:"753",ATG:"753",ARG:"478",ARM:"390",ABW:"753",AUS:"808",AUT:"242",AZE:"534","AZORES (PORTUGAL)":"753",BHS:"753",BHR:"726",BGD:"528",BRB:"749",BLR:"400",BEL:"252",BLZ:"403",BEN:"745",BMU:"753",BTN:"0",BOL:"604",BES:"753",BIH:"1197",BWA:"1486",BRA:"284",VGB:"753",BRN:"681",BGR:"911",BFA:"753",BDI:"414",KHM:"1046",CMR:"659",CAN:"372",CYM:"753",CPV:"753",CAF:"188",TCD:"753","CHANNEL ISLANDS (U.K)":"753",CHL:"657",CHN:"899",COL:"410",COM:"753",COD:"0",COG:"659",COK:"753",CRI:"108",CIV:"466",HRV:"294",CUB:"559",CUW:"876",CYP:"751",CZE:"902",DNK:"362",DJI:"753",DMA:"753",DOM:"601",ECU:"560",EGY:"554",SLV:"547",GNQ:"632",ERI:"915",EST:"1057",SWZ:"0",ETH:"0",FLK:"753",FRO:"753",FJI:"640",FIN:"267",FRA:"158",GUF:"423",PYF:"753",GAB:"946",GMB:"753",GEO:"289",DEU:"650",GHA:"495",GIB:"779",GRC:"507",GRL:"264",GRD:"753",GLP:"753",GUM:"753",GTM:"798",GIN:"753",GNB:"753",GUY:"847",HTI:"1048",HND:"662",HUN:"296",ISL:"0",IND:"951",IDN:"783",IRN:"592",IRQ:"1080",IRL:"380",IMN:"436",ISR:"394",ITA:"414",JAM:"711",JPN:"471",JOR:"529",KAZ:"797",KEN:"574",KIR:"753",PRK:"754",KOR:"555",XKX:"1145",KWT:"675",KGZ:"217",LAO:"1069",LVA:"240",LBN:"794",LSO:"0",LBR:"677",LBY:"668",LIE:"151",LTU:"211",LUX:"220",MDG:"876","MADEIRA (PORTUGAL)":"663",MWI:"489",MYS:"551",MDV:"753",MLI:"1076",MLT:"520",MHL:"753",MTQ:"753",MRT:"753",MUS:"700",MYT:"753",MEX:"531",FSM:"753",MDA:"541",MCO:"158",MNG:"1366",MNE:"899",MSR:"753",MAR:"729",MOZ:"234",MMR:"719",NAM:"355",NRU:"753",NPL:"0",NLD:"326",NCL:"779",NZL:"246",NIC:"675",NER:"772",NGA:"526",NIU:"753",MKD:"851",MNP:"753",NOR:"47",OMN:"479",PAK:"592",PLW:"753",PSE:"719",PAN:"477",PNG:"597",PRY:"0",PER:"473",PHL:"672",POL:"828",PRT:"389",PRI:"596",QAT:"503",REU:"772",ROU:"489",RUS:"476",RWA:"712",SHN:"753",KNA:"753",LCA:"753",MAF:"753",SPM:"753",VCT:"753",WSM:"753",SMR:"414",STP:"753",SAU:"592",SEN:"870",SRB:"1086",SYC:"753",SLE:"489",SGP:"379",SXM:"753",SVK:"332",SVN:"620",SLB:"753",SOM:"753",ZAF:"1070",SSD:"890",ESP:"402",LKA:"731",SDN:"736",SUR:"1029",SWE:"68",CHE:"48",SYR:"713",TWN:"484",TJK:"255",TZA:"531",THA:"450",TLS:"753",TGO:"859",TON:"753",TTO:"559",TUN:"468",TUR:"376",TKM:"927",TCA:"753",TUV:"753",UGA:"279",UKR:"768",ARE:"556",GBR:"380",USA:"416",URY:"174",UZB:"612",VUT:"753",VEN:"711",VNM:"560",VIR:"650",YEM:"807",ZMB:"416",ZWE:"1575","MEMO: EU 27":"409"},We="marginal",He="2021";var W={data:xe,type:We,year:He};var Ye={co2:v,hosting:V,averageIntensity:x,marginalIntensity:W};return me(ke);})();
4
4
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../node_modules/ms/index.js", "../../node_modules/debug/src/common.js", "../../node_modules/debug/src/browser.js", "../../src/index.js", "../../src/1byte.js", "../../src/sustainable-web-design.js", "../../src/constants/file-size.js", "../../src/helpers/index.js", "../../src/co2.js", "../../src/hosting.js", "../../src/hosting-api.js", "../../src/data/average-intensities-2021.min.js", "../../src/data/marginal-intensities-2021.min.js"],
4
- "sourcesContent": ["/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n", "\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n", "/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n", "import co2 from \"./co2.js\";\nimport hosting from \"./hosting.js\";\nimport averageIntensity from \"./data/average-intensities-2021.min.js\";\nimport marginalIntensity from \"./data/marginal-intensities-2021.min.js\";\n\nexport { co2, hosting, averageIntensity, marginalIntensity };\nexport default { co2, hosting, averageIntensity, marginalIntensity };\n", "// Use the 1byte model for now from the Shift Project, and assume a US grid mix figure they use of around 519 g co2 for the time being. It's lower for Europe, and in particular, France, but for v1, we don't include this\nconst CO2_PER_KWH_IN_DC_GREY = 519;\n\n// this figure is from the IEA's 2018 report for a global average:\nconst CO2_PER_KWH_NETWORK_GREY = 475;\n\n// TODO - these figures need to be updated, as the figures for green\n// shouldn't really be zero now we know that carbon intensity figures\n// for renewables still usually include the life cycle emissions\nconst CO2_PER_KWH_IN_DC_GREEN = 0;\n\n// the 1 byte model gives figures for energy usage for:\n\n// datacentres\n// networks\n// the device used to access a site/app\n\n// The device usage figure combines figures for:\n// 1. the usage for devices (which is small proportion of the energy use)\n// 2. the *making* the device, which is comparatively high.\n\nconst KWH_PER_BYTE_IN_DC = 7.2e-11;\n\n// this is probably best left as something users can define, or\n// a weighted average based on total usage.\n// Using a simple mean for now, as while web traffic to end users might trend\n// towards wifi and mobile,\n// Web traffic between servers is likely wired networks\n\nconst FIXED_NETWORK_WIRED = 4.29e-10;\nconst FIXED_NETWORK_WIFI = 1.52e-10;\nconst FOUR_G_MOBILE = 8.84e-10;\n\n// Pull requests gratefully accepted\nconst KWH_PER_BYTE_FOR_NETWORK =\n (FIXED_NETWORK_WIRED + FIXED_NETWORK_WIFI + FOUR_G_MOBILE) / 3;\n\nconst KWH_PER_BYTE_FOR_DEVICES = 1.3e-10;\n\nclass OneByte {\n constructor(options) {\n this.options = options;\n\n this.KWH_PER_BYTE_FOR_NETWORK = KWH_PER_BYTE_FOR_NETWORK;\n }\n\n perByte(bytes, green) {\n if (bytes < 1) {\n return 0;\n }\n\n if (green) {\n // if we have a green datacentre, use the lower figure for renewable energy\n const Co2ForDC = bytes * KWH_PER_BYTE_IN_DC * CO2_PER_KWH_IN_DC_GREEN;\n\n // but for the worest of the internet, we can't easily check, so assume\n // grey for now\n const Co2forNetwork =\n bytes * KWH_PER_BYTE_FOR_NETWORK * CO2_PER_KWH_NETWORK_GREY;\n\n return Co2ForDC + Co2forNetwork;\n }\n\n const KwHPerByte = KWH_PER_BYTE_IN_DC + KWH_PER_BYTE_FOR_NETWORK;\n return bytes * KwHPerByte * CO2_PER_KWH_IN_DC_GREY;\n }\n}\n\nexport { OneByte };\nexport default OneByte;\n", "\"use strict\";\n\n/**\n * Sustainable Web Design\n *\n * Updated calculations and figures from\n * https://sustainablewebdesign.org/calculating-digital-emissions/\n *\n *\n */\nimport debugFactory from \"debug\";\nconst log = debugFactory(\"tgwf:sustainable-web-design\");\n\nimport { fileSize } from \"./constants/index.js\";\nimport { formatNumber } from \"./helpers/index.js\";\n\n// this refers to the estimated total energy use for the internet around 2000 TWh,\n// divided by the total transfer it enables around 2500 exabytes\nconst KWH_PER_GB = 0.81;\n\n// these constants outline how the energy is attributed to\n// different parts of the system in the SWD model\nconst END_USER_DEVICE_ENERGY = 0.52;\nconst NETWORK_ENERGY = 0.14;\nconst DATACENTER_ENERGY = 0.15;\nconst PRODUCTION_ENERGY = 0.19;\n\n// These carbon intensity figures https://ember-climate.org/data/data-explorer\n// - Global carbon intensity for 2021\nconst GLOBAL_INTENSITY = 442;\nconst RENEWABLES_INTENSITY = 50;\n\n// Taken from: https://gitlab.com/wholegrain/carbon-api-2-0/-/blob/master/includes/carbonapi.php\n\nconst FIRST_TIME_VIEWING_PERCENTAGE = 0.75;\nconst RETURNING_VISITOR_PERCENTAGE = 0.25;\nconst PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD = 0.02;\n\nclass SustainableWebDesign {\n constructor(options) {\n this.options = options;\n }\n\n /**\n * Accept a figure for bytes transferred and return an object representing\n * the share of the total enrgy use of the entire system, broken down\n * by each corresponding system component\n *\n * @param {number} bytes - the data transferred in bytes\n * @return {object} Object containing the energy in kilowatt hours, keyed by system component\n */\n energyPerByteByComponent(bytes) {\n const transferedBytesToGb = bytes / fileSize.GIGABYTE;\n const energyUsage = transferedBytesToGb * KWH_PER_GB;\n\n // return the total energy, with breakdown by component\n return {\n consumerDeviceEnergy: energyUsage * END_USER_DEVICE_ENERGY,\n networkEnergy: energyUsage * NETWORK_ENERGY,\n productionEnergy: energyUsage * PRODUCTION_ENERGY,\n dataCenterEnergy: energyUsage * DATACENTER_ENERGY,\n };\n }\n /**\n * Accept an object keys by the different system components, and\n * return an object with the co2 figures key by the each component\n *\n * @param {object} energyBycomponent - energy grouped by the four system components\n * @param {number} [carbonIntensity] - carbon intensity to apply to the datacentre values\n * @return {number} the total number in grams of CO2 equivalent emissions\n */\n co2byComponent(energyBycomponent, carbonIntensity = GLOBAL_INTENSITY) {\n const returnCO2ByComponent = {};\n for (const [key, value] of Object.entries(energyBycomponent)) {\n // we update the datacentre, as that's what we have information\n // about.\n if (key.startsWith(\"dataCenterEnergy\")) {\n returnCO2ByComponent[key] = value * carbonIntensity;\n } else {\n // We don't have info about the device location,\n // nor the network path used, nor the production emissions\n // so we revert to global figures\n returnCO2ByComponent[key] = value * GLOBAL_INTENSITY;\n }\n }\n return returnCO2ByComponent;\n }\n\n /**\n * Accept a figure for bytes transferred and return a single figure for CO2\n * emissions. Where information exists about the origin data is being\n * fetched from, a different carbon intensity figure\n * is applied for the datacentre share of the carbon intensity.\n *\n * @param {number} bytes - the data transferred in bytes\n * @param {number} `carbonIntensity` the carbon intensity for datacentre (average figures, not marginal ones)\n * @return {number} the total number in grams of CO2 equivalent emissions\n */\n perByte(bytes, carbonIntensity = GLOBAL_INTENSITY) {\n const energyBycomponent = this.energyPerByteByComponent(bytes);\n\n // when faced with falsy values, fallback to global intensity\n if (Boolean(carbonIntensity) === false) {\n carbonIntensity = GLOBAL_INTENSITY;\n }\n // if we have a boolean, we have a green result from the green web checker\n // use the renewables intensity\n if (carbonIntensity === true) {\n carbonIntensity = RENEWABLES_INTENSITY;\n }\n\n // otherwise when faced with non numeric values throw an error\n if (typeof carbonIntensity !== \"number\") {\n throw new Error(\n `perByte expects a numeric value or boolean for the carbon intensity value. Received: ${carbonIntensity}`\n );\n }\n\n const co2ValuesbyComponent = this.co2byComponent(\n energyBycomponent,\n carbonIntensity\n );\n\n // pull out our values\u2026\n const co2Values = Object.values(co2ValuesbyComponent);\n\n // so we can return their sum\n return co2Values.reduce(\n (prevValue, currentValue) => prevValue + currentValue\n );\n }\n\n /**\n * Accept a figure for bytes transferred and return a single figure for CO2\n * emissions. This method applies caching assumptions from the original Sustainable Web Design model.\n *\n * @param {number} bytes - the data transferred in bytes\n * @param {number} `carbonIntensity` the carbon intensity for datacentre (average figures, not marginal ones)\n * @return {number} the total number in grams of CO2 equivalent emissions\n */\n perVisit(bytes, carbonIntensity = GLOBAL_INTENSITY) {\n const energyBycomponent = this.energyPerVisitByComponent(bytes);\n\n // when faced with falsy values, fallback to global intensity\n if (Boolean(carbonIntensity) === false) {\n carbonIntensity = GLOBAL_INTENSITY;\n }\n // if we have a boolean, we have a green result from the green web checker\n // use the renewables intensity\n if (carbonIntensity === true) {\n carbonIntensity = RENEWABLES_INTENSITY;\n }\n\n // otherwise when faced with non numeric values throw an error\n if (typeof carbonIntensity !== \"number\") {\n throw new Error(\n `perVisit expects a numeric value or boolean for the carbon intensity value. Received: ${carbonIntensity}`\n );\n }\n\n const co2ValuesbyComponent = this.co2byComponent(\n energyBycomponent,\n carbonIntensity\n );\n\n // pull out our values\u2026\n const co2Values = Object.values(co2ValuesbyComponent);\n\n // so we can return their sum\n return co2Values.reduce(\n (prevValue, currentValue) => prevValue + currentValue\n );\n }\n\n /**\n * Accept a figure for bytes transferred and return the number of kilowatt hours used\n * by the total system for this data transfer\n *\n * @param {number} bytes\n * @return {number} the number of kilowatt hours used\n */\n energyPerByte(bytes) {\n const energyByComponent = this.energyPerByteByComponent(bytes);\n\n // pull out our values\u2026\n const energyValues = Object.values(energyByComponent);\n\n // so we can return their sum\n return energyValues.reduce(\n (prevValue, currentValue) => prevValue + currentValue\n );\n }\n\n /**\n * Accept a figure for bytes transferred, and return an object containing figures\n * per system component, with the caching assumptions applied. This tries to account\n * for webpages being loaded from a cache by browsers, so if you had a thousand page views,\n * and tried to work out the energy per visit, the numbers would reflect the reduced amounts\n * of transfer.\n *\n * @param {number} bytes - the data transferred in bytes for loading a webpage\n * @param {number} firstView - what percentage of visits are loading this page for the first time\n * @param {number} returnView - what percentage of visits are loading this page for subsequent times\n * @param {number} dataReloadRatio - what percentage of a page is reloaded on each subsequent page view\n *\n * @return {object} Object containing the energy in kilowatt hours, keyed by system component\n */\n energyPerVisitByComponent(\n bytes,\n firstView = FIRST_TIME_VIEWING_PERCENTAGE,\n returnView = RETURNING_VISITOR_PERCENTAGE,\n dataReloadRatio = PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD\n ) {\n const energyBycomponent = this.energyPerByteByComponent(bytes);\n const cacheAdjustedSegmentEnergy = {};\n\n log({ energyBycomponent });\n const energyValues = Object.values(energyBycomponent);\n\n // for this, we want\n for (const [key, value] of Object.entries(energyBycomponent)) {\n // represent the first load\n cacheAdjustedSegmentEnergy[`${key} - first`] = value * firstView;\n\n // then represent the subsequent load\n cacheAdjustedSegmentEnergy[`${key} - subsequent`] =\n value * returnView * dataReloadRatio;\n }\n log({ cacheAdjustedSegmentEnergy });\n\n return cacheAdjustedSegmentEnergy;\n }\n\n /**\n * Accept a figure for bytes, and return the total figure for energy per visit\n * using the default caching assumptions for loading a single website\n *\n * @param {number} bytes\n * @return {number} the total energy use for the visit, after applying the caching assumptions\n */\n energyPerVisit(bytes) {\n // fetch the values using the default caching assumptions\n // const energyValues = Object.values(this.energyPerVisitByComponent(bytes));\n\n let firstVisits = 0;\n let subsequentVisits = 0;\n\n const energyBycomponent = Object.entries(\n this.energyPerVisitByComponent(bytes)\n );\n\n for (const [key, val] of energyBycomponent) {\n if (key.indexOf(\"first\") > 0) {\n firstVisits += val;\n }\n }\n\n for (const [key, val] of energyBycomponent) {\n if (key.indexOf(\"subsequent\") > 0) {\n subsequentVisits += val;\n }\n }\n\n return firstVisits + subsequentVisits;\n }\n\n // TODO: this method looks like it applies the carbon intensity\n // change to the *entire* system, not just the datacenter.\n emissionsPerVisitInGrams(energyPerVisit, carbonintensity = GLOBAL_INTENSITY) {\n return formatNumber(energyPerVisit * carbonintensity);\n }\n\n annualEnergyInKwh(energyPerVisit, monthlyVisitors = 1000) {\n return energyPerVisit * monthlyVisitors * 12;\n }\n\n annualEmissionsInGrams(co2grams, monthlyVisitors = 1000) {\n return co2grams * monthlyVisitors * 12;\n }\n\n annualSegmentEnergy(annualEnergy) {\n return {\n consumerDeviceEnergy: formatNumber(annualEnergy * END_USER_DEVICE_ENERGY),\n networkEnergy: formatNumber(annualEnergy * NETWORK_ENERGY),\n dataCenterEnergy: formatNumber(annualEnergy * DATACENTER_ENERGY),\n productionEnergy: formatNumber(annualEnergy * PRODUCTION_ENERGY),\n };\n }\n}\n\nexport { SustainableWebDesign };\nexport default SustainableWebDesign;\n", "const GIGABYTE = 1000 * 1000 * 1000;\n\nexport default {\n GIGABYTE,\n};\n", "const formatNumber = (num) => parseFloat(num.toFixed(2));\n\nexport { formatNumber };\n", "\"use strict\";\n\nimport OneByte from \"./1byte.js\";\nimport SustainableWebDesign from \"./sustainable-web-design.js\";\n\nclass CO2 {\n constructor(options) {\n this.model = new SustainableWebDesign();\n // Using optional chaining allows an empty object to be passed\n // in without breaking the code.\n if (options?.model === \"1byte\") {\n this.model = new OneByte();\n } else if (options?.model === \"swd\") {\n this.model = new SustainableWebDesign();\n } else if (options?.model) {\n throw new Error(\n `\"${options.model}\" is not a valid model. Please use \"1byte\" for the OneByte model, and \"swd\" for the Sustainable Web Design model.\\nSee https://developers.thegreenwebfoundation.org/co2js/models/ to learn more about the models available in CO2.js.`\n );\n }\n }\n\n /**\n * Accept a figure in bytes for data transfer, and a boolean for whether\n * the domain shows as 'green', and return a CO2 figure for energy used to shift the corresponding\n * the data transfer.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @return {number} the amount of CO2 in grammes\n */\n perByte(bytes, green) {\n return this.model.perByte(bytes, green);\n }\n\n /**\n * Accept a figure in bytes for data transfer, and a boolean for whether\n * the domain shows as 'green', and return a CO2 figure for energy used to shift the corresponding\n * the data transfer.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @return {number} the amount of CO2 in grammes\n */\n perVisit(bytes, green) {\n if (this.model?.perVisit) {\n return this.model.perVisit(bytes, green);\n } else {\n throw new Error(\n `The perVisit() method is not supported in the model you are using. Try using perByte() instead.\\nSee https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more about the methods available in CO2.js.`\n );\n }\n }\n\n perDomain(pageXray, greenDomains) {\n const co2PerDomain = [];\n for (let domain of Object.keys(pageXray.domains)) {\n let co2;\n if (greenDomains && greenDomains.indexOf(domain) > -1) {\n co2 = this.perByte(pageXray.domains[domain].transferSize, true);\n } else {\n co2 = this.perByte(pageXray.domains[domain].transferSize);\n }\n co2PerDomain.push({\n domain,\n co2,\n transferSize: pageXray.domains[domain].transferSize,\n });\n }\n co2PerDomain.sort((a, b) => b.co2 - a.co2);\n\n return co2PerDomain;\n }\n\n perPage(pageXray, green) {\n // Accept an xray object, and if we receive a boolean as the second\n // argument, we assume every request we make is sent to a server\n // running on renwewable power.\n\n // if we receive an array of domains, return a number accounting the\n // reduced CO2 from green hosted domains\n\n const domainCO2 = this.perDomain(pageXray, green);\n let totalCO2 = 0;\n for (let domain of domainCO2) {\n totalCO2 += domain.co2;\n }\n return totalCO2;\n }\n\n perContentType(pageXray, greenDomains) {\n const co2PerContentType = {};\n for (let asset of pageXray.assets) {\n const domain = new URL(asset.url).domain;\n const transferSize = asset.transferSize;\n const co2ForTransfer = this.perByte(\n transferSize,\n greenDomains && greenDomains.indexOf(domain) > -1\n );\n const contentType = asset.type;\n if (!co2PerContentType[contentType]) {\n co2PerContentType[contentType] = { co2: 0, transferSize: 0 };\n }\n co2PerContentType[contentType].co2 += co2ForTransfer;\n co2PerContentType[contentType].transferSize += transferSize;\n }\n // restructure and sort\n const all = [];\n for (let type of Object.keys(co2PerContentType)) {\n all.push({\n type,\n co2: co2PerContentType[type].co2,\n transferSize: co2PerContentType[type].transferSize,\n });\n }\n all.sort((a, b) => b.co2 - a.co2);\n return all;\n }\n\n dirtiestResources(pageXray, greenDomains) {\n const allAssets = [];\n for (let asset of pageXray.assets) {\n const domain = new URL(asset.url).domain;\n const transferSize = asset.transferSize;\n const co2ForTransfer = this.perByte(\n transferSize,\n greenDomains && greenDomains.indexOf(domain) > -1\n );\n allAssets.push({ url: asset.url, co2: co2ForTransfer, transferSize });\n }\n allAssets.sort((a, b) => b.co2 - a.co2);\n\n return allAssets.slice(0, allAssets.length > 10 ? 10 : allAssets.length);\n }\n\n perParty(pageXray, greenDomains) {\n let firstParty = 0;\n let thirdParty = 0;\n // calculate co2 per first/third party\n const firstPartyRegEx = pageXray.firstPartyRegEx;\n for (let d of Object.keys(pageXray.domains)) {\n if (!d.match(firstPartyRegEx)) {\n thirdParty += this.perByte(\n pageXray.domains[d].transferSize,\n greenDomains && greenDomains.indexOf(d) > -1\n );\n } else {\n firstParty += this.perByte(\n pageXray.domains[d].transferSize,\n greenDomains && greenDomains.indexOf(d) > -1\n );\n }\n }\n return { firstParty, thirdParty };\n }\n}\n\nexport { CO2 };\nexport default CO2;\n", "\"use strict\";\n\nimport debugFactory from \"debug\";\nconst log = debugFactory(\"tgwf:hosting\");\n\nimport hostingAPI from \"./hosting-api.js\";\n\nfunction check(domain, db) {\n return hostingAPI.check(domain);\n}\n\nexport default {\n check,\n};\n", "\"use strict\";\n\nimport debugFactory from \"debug\";\nconst log = debugFactory(\"tgwf:hostingAPI\");\n\nfunction check(domain) {\n // is it a single domain or an array of them?\n if (typeof domain === \"string\") {\n return checkAgainstAPI(domain);\n } else {\n return checkDomainsAgainstAPI(domain);\n }\n}\n\nasync function checkAgainstAPI(domain) {\n const req = await fetch(\n `https://api.thegreenwebfoundation.org/greencheck/${domain}`\n );\n const res = await req.json();\n return res.green;\n}\n\nasync function checkDomainsAgainstAPI(domains) {\n try {\n const apiPath = \"https://api.thegreenwebfoundation.org/v2/greencheckmulti\";\n const domainsString = JSON.stringify(domains);\n\n const req = await fetch(`${apiPath}/${domainsString}`);\n\n // sanity check API result. Is this the library or\n // the actual API request that's the problem?\n // Is nock mocking node-native fetch API calls properly?\n log(`${apiPath}/${domainsString}`);\n log({ req });\n const textResult = await req.text();\n log({ textResult });\n\n const allGreenCheckResults = await req.json();\n\n return greenDomainsFromResults(allGreenCheckResults);\n } catch (e) {\n return [];\n }\n}\n\nfunction greenDomainsFromResults(greenResults) {\n const entries = Object.entries(greenResults);\n const greenEntries = entries.filter(([key, val]) => val.green);\n return greenEntries.map(([key, val]) => val.url);\n}\n\nexport default {\n check,\n};\n", "const data = {\"AFRICA\":\"489.26\",\"ARG\":\"365.292\",\"ARM\":\"206.522\",\"ASIA\":\"543.57\",\"AUS\":\"526.876\",\"AUT\":\"145.083\",\"AZE\":\"536.585\",\"BGD\":\"559.606\",\"BLR\":\"472.727\",\"BEL\":\"156.063\",\"BOL\":\"311.475\",\"BIH\":\"470.982\",\"BRA\":\"144.677\",\"BGR\":\"364.136\",\"BDI\":\"275.862\",\"CAN\":\"123.859\",\"CHL\":\"395.565\",\"CHN\":\"549.288\",\"CRI\":\"30.903\",\"HRV\":\"212.161\",\"CYP\":\"601.19\",\"CZE\":\"401.272\",\"DNK\":\"240.419\",\"ECU\":\"132.964\",\"EGY\":\"470.879\",\"SLV\":\"180.87\",\"EST\":\"488.529\",\"EU\":\"261.43\",\"EUROPE\":\"277.64\",\"FIN\":\"152.651\",\"FRA\":\"67.781\",\"G20\":\"445.9\",\"G7\":\"338.04\",\"GEO\":\"105.685\",\"DEU\":\"363.982\",\"GRC\":\"363.388\",\"HUN\":\"236.271\",\"IND\":\"632.656\",\"IRL\":\"361.274\",\"ITA\":\"340.937\",\"JPN\":\"460.647\",\"KAZ\":\"656.097\",\"KEN\":\"104.0\",\"LATIN AMERICA AND CARIBBEAN\":\"261.51\",\"LVA\":\"226.351\",\"LTU\":\"247.475\",\"LUX\":\"183.824\",\"MLT\":\"452.055\",\"MEX\":\"391.582\",\"MDA\":\"642.512\",\"MNG\":\"725.26\",\"MNE\":\"335.958\",\"NLD\":\"386.189\",\"NORTH AMERICA\":\"345.38\",\"MKD\":\"444.191\",\"NOR\":\"26.131\",\"OCEANIA\":\"479.98\",\"OECD\":\"338.24\",\"PAK\":\"363.065\",\"PER\":\"241.492\",\"PHL\":\"579.689\",\"POL\":\"657.138\",\"PRT\":\"222.632\",\"ROU\":\"255.718\",\"RUS\":\"355.431\",\"SAU\":\"568.967\",\"SEN\":\"540.098\",\"SRB\":\"549.083\",\"SGP\":\"488.21\",\"SVK\":\"173.854\",\"SVN\":\"241.956\",\"ZAF\":\"706.991\",\"KOR\":\"442.389\",\"ESP\":\"193.737\",\"SWE\":\"43.9\",\"CHE\":\"58.952\",\"TWN\":\"565.629\",\"TJK\":\"72.823\",\"THA\":\"503.034\",\"TUN\":\"470.848\",\"TUR\":\"432.293\",\"UKR\":\"240.28\",\"GBR\":\"268.255\",\"USA\":\"378.625\",\"VNM\":\"491.192\",\"WORLD\":\"442.37\"}; const type = \"average\"; const year = \"2021\"; export { data, type, year }; export default { data, type, year };", "const data = {\"AFG\":\"414\",\"ALB\":\"0\",\"DZA\":\"528\",\"ASM\":\"753\",\"AND\":\"188\",\"AGO\":\"1476\",\"AIA\":\"753\",\"ATG\":\"753\",\"ARG\":\"478\",\"ARM\":\"390\",\"ABW\":\"753\",\"AUS\":\"808\",\"AUT\":\"242\",\"AZE\":\"534\",\"AZORES (PORTUGAL)\":\"753\",\"BHS\":\"753\",\"BHR\":\"726\",\"BGD\":\"528\",\"BRB\":\"749\",\"BLR\":\"400\",\"BEL\":\"252\",\"BLZ\":\"403\",\"BEN\":\"745\",\"BMU\":\"753\",\"BTN\":\"0\",\"BOL\":\"604\",\"BES\":\"753\",\"BIH\":\"1197\",\"BWA\":\"1486\",\"BRA\":\"284\",\"VGB\":\"753\",\"BRN\":\"681\",\"BGR\":\"911\",\"BFA\":\"753\",\"BDI\":\"414\",\"KHM\":\"1046\",\"CMR\":\"659\",\"CAN\":\"372\",\"CYM\":\"753\",\"CPV\":\"753\",\"CAF\":\"188\",\"TCD\":\"753\",\"CHANNEL ISLANDS (U.K)\":\"753\",\"CHL\":\"657\",\"CHN\":\"899\",\"COL\":\"410\",\"COM\":\"753\",\"COD\":\"0\",\"COG\":\"659\",\"COK\":\"753\",\"CRI\":\"108\",\"CIV\":\"466\",\"HRV\":\"294\",\"CUB\":\"559\",\"CUW\":\"876\",\"CYP\":\"751\",\"CZE\":\"902\",\"DNK\":\"362\",\"DJI\":\"753\",\"DMA\":\"753\",\"DOM\":\"601\",\"ECU\":\"560\",\"EGY\":\"554\",\"SLV\":\"547\",\"GNQ\":\"632\",\"ERI\":\"915\",\"EST\":\"1057\",\"SWZ\":\"0\",\"ETH\":\"0\",\"FLK\":\"753\",\"FRO\":\"753\",\"FJI\":\"640\",\"FIN\":\"267\",\"FRA\":\"158\",\"GUF\":\"423\",\"PYF\":\"753\",\"GAB\":\"946\",\"GMB\":\"753\",\"GEO\":\"289\",\"DEU\":\"650\",\"GHA\":\"495\",\"GIB\":\"779\",\"GRC\":\"507\",\"GRL\":\"264\",\"GRD\":\"753\",\"GLP\":\"753\",\"GUM\":\"753\",\"GTM\":\"798\",\"GIN\":\"753\",\"GNB\":\"753\",\"GUY\":\"847\",\"HTI\":\"1048\",\"HND\":\"662\",\"HUN\":\"296\",\"ISL\":\"0\",\"IND\":\"951\",\"IDN\":\"783\",\"IRN\":\"592\",\"IRQ\":\"1080\",\"IRL\":\"380\",\"IMN\":\"436\",\"ISR\":\"394\",\"ITA\":\"414\",\"JAM\":\"711\",\"JPN\":\"471\",\"JOR\":\"529\",\"KAZ\":\"797\",\"KEN\":\"574\",\"KIR\":\"753\",\"PRK\":\"754\",\"KOR\":\"555\",\"XKX\":\"1145\",\"KWT\":\"675\",\"KGZ\":\"217\",\"LAO\":\"1069\",\"LVA\":\"240\",\"LBN\":\"794\",\"LSO\":\"0\",\"LBR\":\"677\",\"LBY\":\"668\",\"LIE\":\"151\",\"LTU\":\"211\",\"LUX\":\"220\",\"MDG\":\"876\",\"MADEIRA (PORTUGAL)\":\"663\",\"MWI\":\"489\",\"MYS\":\"551\",\"MDV\":\"753\",\"MLI\":\"1076\",\"MLT\":\"520\",\"MHL\":\"753\",\"MTQ\":\"753\",\"MRT\":\"753\",\"MUS\":\"700\",\"MYT\":\"753\",\"MEX\":\"531\",\"FSM\":\"753\",\"MDA\":\"541\",\"MCO\":\"158\",\"MNG\":\"1366\",\"MNE\":\"899\",\"MSR\":\"753\",\"MAR\":\"729\",\"MOZ\":\"234\",\"MMR\":\"719\",\"NAM\":\"355\",\"NRU\":\"753\",\"NPL\":\"0\",\"NLD\":\"326\",\"NCL\":\"779\",\"NZL\":\"246\",\"NIC\":\"675\",\"NER\":\"772\",\"NGA\":\"526\",\"NIU\":\"753\",\"MKD\":\"851\",\"MNP\":\"753\",\"NOR\":\"47\",\"OMN\":\"479\",\"PAK\":\"592\",\"PLW\":\"753\",\"PSE\":\"719\",\"PAN\":\"477\",\"PNG\":\"597\",\"PRY\":\"0\",\"PER\":\"473\",\"PHL\":\"672\",\"POL\":\"828\",\"PRT\":\"389\",\"PRI\":\"596\",\"QAT\":\"503\",\"REU\":\"772\",\"ROU\":\"489\",\"RUS\":\"476\",\"RWA\":\"712\",\"SHN\":\"753\",\"KNA\":\"753\",\"LCA\":\"753\",\"MAF\":\"753\",\"SPM\":\"753\",\"VCT\":\"753\",\"WSM\":\"753\",\"SMR\":\"414\",\"STP\":\"753\",\"SAU\":\"592\",\"SEN\":\"870\",\"SRB\":\"1086\",\"SYC\":\"753\",\"SLE\":\"489\",\"SGP\":\"379\",\"SXM\":\"753\",\"SVK\":\"332\",\"SVN\":\"620\",\"SLB\":\"753\",\"SOM\":\"753\",\"ZAF\":\"1070\",\"SSD\":\"890\",\"ESP\":\"402\",\"LKA\":\"731\",\"SDN\":\"736\",\"SUR\":\"1029\",\"SWE\":\"68\",\"CHE\":\"48\",\"SYR\":\"713\",\"TWN\":\"484\",\"TJK\":\"255\",\"TZA\":\"531\",\"THA\":\"450\",\"TLS\":\"753\",\"TGO\":\"859\",\"TON\":\"753\",\"TTO\":\"559\",\"TUN\":\"468\",\"TUR\":\"376\",\"TKM\":\"927\",\"TCA\":\"753\",\"TUV\":\"753\",\"UGA\":\"279\",\"UKR\":\"768\",\"ARE\":\"556\",\"GBR\":\"380\",\"USA\":\"416\",\"URY\":\"174\",\"UZB\":\"612\",\"VUT\":\"753\",\"VEN\":\"711\",\"VNM\":\"560\",\"VIR\":\"650\",\"YEM\":\"807\",\"ZMB\":\"416\",\"ZWE\":\"1575\",\"MEMO: EU 27\":\"409\"}; const type = \"marginal\"; const year = \"2021\"; export { data, type, year }; export default { data, type, year };"],
5
- "mappings": "ioBAAA,iBAIA,GAAI,GAAI,IACJ,EAAI,EAAI,GACR,EAAI,EAAI,GACR,EAAI,EAAI,GACR,GAAI,EAAI,EACR,GAAI,EAAI,OAgBZ,EAAO,QAAU,SAAS,EAAK,EAAS,CACtC,EAAU,GAAW,CAAC,EACtB,GAAI,GAAO,MAAO,GAClB,GAAI,IAAS,UAAY,EAAI,OAAS,EACpC,MAAO,IAAM,CAAG,EACX,GAAI,IAAS,UAAY,SAAS,CAAG,EAC1C,MAAO,GAAQ,KAAO,GAAQ,CAAG,EAAI,GAAS,CAAG,EAEnD,KAAM,IAAI,OACR,wDACE,KAAK,UAAU,CAAG,CACtB,CACF,EAUA,YAAe,EAAK,CAElB,GADA,EAAM,OAAO,CAAG,EACZ,IAA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IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,OAAO,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,OAAO,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,OAAO,IAAM,KAAK,IAAM,KAAK,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,OAAO,eAAe,KAAK,EAAS,GAAO,WAAkB,GAAO,OAAqC,GAAO,GAAQ,CAAE,QAAM,QAAM,OAAK,ETM/4F,GAAO,IAAQ,CAAE,MAAK,UAAS,mBAAkB,mBAAkB",
4
+ "sourcesContent": ["/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n", "\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n", "/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n", "import co2 from \"./co2.js\";\nimport hosting from \"./hosting.js\";\nimport averageIntensity from \"./data/average-intensities-2021.min.js\";\nimport marginalIntensity from \"./data/marginal-intensities-2021.min.js\";\n\nexport { co2, hosting, averageIntensity, marginalIntensity };\nexport default { co2, hosting, averageIntensity, marginalIntensity };\n", "// Use the 1byte model for now from the Shift Project, and assume a US grid mix figure they use of around 519 g co2 for the time being. It's lower for Europe, and in particular, France, but for v1, we don't include this\nconst CO2_PER_KWH_IN_DC_GREY = 519;\n\n// this figure is from the IEA's 2018 report for a global average:\nconst CO2_PER_KWH_NETWORK_GREY = 475;\n\n// TODO - these figures need to be updated, as the figures for green\n// shouldn't really be zero now we know that carbon intensity figures\n// for renewables still usually include the life cycle emissions\nconst CO2_PER_KWH_IN_DC_GREEN = 0;\n\n// the 1 byte model gives figures for energy usage for:\n\n// datacentres\n// networks\n// the device used to access a site/app\n\n// The device usage figure combines figures for:\n// 1. the usage for devices (which is small proportion of the energy use)\n// 2. the *making* the device, which is comparatively high.\n\nconst KWH_PER_BYTE_IN_DC = 7.2e-11;\n\n// this is probably best left as something users can define, or\n// a weighted average based on total usage.\n// Using a simple mean for now, as while web traffic to end users might trend\n// towards wifi and mobile,\n// Web traffic between servers is likely wired networks\n\nconst FIXED_NETWORK_WIRED = 4.29e-10;\nconst FIXED_NETWORK_WIFI = 1.52e-10;\nconst FOUR_G_MOBILE = 8.84e-10;\n\n// Pull requests gratefully accepted\nconst KWH_PER_BYTE_FOR_NETWORK =\n (FIXED_NETWORK_WIRED + FIXED_NETWORK_WIFI + FOUR_G_MOBILE) / 3;\n\nconst KWH_PER_BYTE_FOR_DEVICES = 1.3e-10;\n\nclass OneByte {\n constructor(options) {\n this.options = options;\n\n this.KWH_PER_BYTE_FOR_NETWORK = KWH_PER_BYTE_FOR_NETWORK;\n }\n\n perByte(bytes, green) {\n if (bytes < 1) {\n return 0;\n }\n\n if (green) {\n // if we have a green datacentre, use the lower figure for renewable energy\n const Co2ForDC = bytes * KWH_PER_BYTE_IN_DC * CO2_PER_KWH_IN_DC_GREEN;\n\n // but for the worest of the internet, we can't easily check, so assume\n // grey for now\n const Co2forNetwork =\n bytes * KWH_PER_BYTE_FOR_NETWORK * CO2_PER_KWH_NETWORK_GREY;\n\n return Co2ForDC + Co2forNetwork;\n }\n\n const KwHPerByte = KWH_PER_BYTE_IN_DC + KWH_PER_BYTE_FOR_NETWORK;\n return bytes * KwHPerByte * CO2_PER_KWH_IN_DC_GREY;\n }\n}\n\nexport { OneByte };\nexport default OneByte;\n", "\"use strict\";\n\n/**\n * Sustainable Web Design\n *\n * Updated calculations and figures from\n * https://sustainablewebdesign.org/calculating-digital-emissions/\n *\n *\n */\nimport debugFactory from \"debug\";\nconst log = debugFactory(\"tgwf:sustainable-web-design\");\n\nimport { fileSize } from \"./constants/index.js\";\nimport { formatNumber } from \"./helpers/index.js\";\n\n// this refers to the estimated total energy use for the internet around 2000 TWh,\n// divided by the total transfer it enables around 2500 exabytes\nconst KWH_PER_GB = 0.81;\n\n// these constants outline how the energy is attributed to\n// different parts of the system in the SWD model\nconst END_USER_DEVICE_ENERGY = 0.52;\nconst NETWORK_ENERGY = 0.14;\nconst DATACENTER_ENERGY = 0.15;\nconst PRODUCTION_ENERGY = 0.19;\n\n// These carbon intensity figures https://ember-climate.org/data/data-explorer\n// - Global carbon intensity for 2021\nconst GLOBAL_INTENSITY = 442;\nconst RENEWABLES_INTENSITY = 50;\n\n// Taken from: https://gitlab.com/wholegrain/carbon-api-2-0/-/blob/master/includes/carbonapi.php\n\nconst FIRST_TIME_VIEWING_PERCENTAGE = 0.75;\nconst RETURNING_VISITOR_PERCENTAGE = 0.25;\nconst PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD = 0.02;\n\nclass SustainableWebDesign {\n constructor(options) {\n this.options = options;\n }\n\n /**\n * Accept a figure for bytes transferred and return an object representing\n * the share of the total enrgy use of the entire system, broken down\n * by each corresponding system component\n *\n * @param {number} bytes - the data transferred in bytes\n * @return {object} Object containing the energy in kilowatt hours, keyed by system component\n */\n energyPerByteByComponent(bytes) {\n const transferedBytesToGb = bytes / fileSize.GIGABYTE;\n const energyUsage = transferedBytesToGb * KWH_PER_GB;\n\n // return the total energy, with breakdown by component\n return {\n consumerDeviceEnergy: energyUsage * END_USER_DEVICE_ENERGY,\n networkEnergy: energyUsage * NETWORK_ENERGY,\n productionEnergy: energyUsage * PRODUCTION_ENERGY,\n dataCenterEnergy: energyUsage * DATACENTER_ENERGY,\n };\n }\n /**\n * Accept an object keys by the different system components, and\n * return an object with the co2 figures key by the each component\n *\n * @param {object} energyBycomponent - energy grouped by the four system components\n * @param {number} [carbonIntensity] - carbon intensity to apply to the datacentre values\n * @return {number} the total number in grams of CO2 equivalent emissions\n */\n co2byComponent(energyBycomponent, carbonIntensity = GLOBAL_INTENSITY) {\n const returnCO2ByComponent = {};\n for (const [key, value] of Object.entries(energyBycomponent)) {\n // we update the datacentre, as that's what we have information\n // about.\n if (key.startsWith(\"dataCenterEnergy\")) {\n returnCO2ByComponent[key] = value * carbonIntensity;\n } else {\n // We don't have info about the device location,\n // nor the network path used, nor the production emissions\n // so we revert to global figures\n returnCO2ByComponent[key] = value * GLOBAL_INTENSITY;\n }\n }\n return returnCO2ByComponent;\n }\n\n /**\n * Accept a figure for bytes transferred and return a single figure for CO2\n * emissions. Where information exists about the origin data is being\n * fetched from, a different carbon intensity figure\n * is applied for the datacentre share of the carbon intensity.\n *\n * @param {number} bytes - the data transferred in bytes\n * @param {number} `carbonIntensity` the carbon intensity for datacentre (average figures, not marginal ones)\n * @return {number} the total number in grams of CO2 equivalent emissions\n */\n perByte(bytes, carbonIntensity = GLOBAL_INTENSITY) {\n const energyBycomponent = this.energyPerByteByComponent(bytes);\n\n // when faced with falsy values, fallback to global intensity\n if (Boolean(carbonIntensity) === false) {\n carbonIntensity = GLOBAL_INTENSITY;\n }\n // if we have a boolean, we have a green result from the green web checker\n // use the renewables intensity\n if (carbonIntensity === true) {\n carbonIntensity = RENEWABLES_INTENSITY;\n }\n\n // otherwise when faced with non numeric values throw an error\n if (typeof carbonIntensity !== \"number\") {\n throw new Error(\n `perByte expects a numeric value or boolean for the carbon intensity value. Received: ${carbonIntensity}`\n );\n }\n\n const co2ValuesbyComponent = this.co2byComponent(\n energyBycomponent,\n carbonIntensity\n );\n\n // pull out our values\u2026\n const co2Values = Object.values(co2ValuesbyComponent);\n\n // so we can return their sum\n return co2Values.reduce(\n (prevValue, currentValue) => prevValue + currentValue\n );\n }\n\n /**\n * Accept a figure for bytes transferred and return a single figure for CO2\n * emissions. This method applies caching assumptions from the original Sustainable Web Design model.\n *\n * @param {number} bytes - the data transferred in bytes\n * @param {number} `carbonIntensity` the carbon intensity for datacentre (average figures, not marginal ones)\n * @return {number} the total number in grams of CO2 equivalent emissions\n */\n perVisit(bytes, carbonIntensity = GLOBAL_INTENSITY) {\n const energyBycomponent = this.energyPerVisitByComponent(bytes);\n\n // when faced with falsy values, fallback to global intensity\n if (Boolean(carbonIntensity) === false) {\n carbonIntensity = GLOBAL_INTENSITY;\n }\n // if we have a boolean, we have a green result from the green web checker\n // use the renewables intensity\n if (carbonIntensity === true) {\n carbonIntensity = RENEWABLES_INTENSITY;\n }\n\n // otherwise when faced with non numeric values throw an error\n if (typeof carbonIntensity !== \"number\") {\n throw new Error(\n `perVisit expects a numeric value or boolean for the carbon intensity value. Received: ${carbonIntensity}`\n );\n }\n\n const co2ValuesbyComponent = this.co2byComponent(\n energyBycomponent,\n carbonIntensity\n );\n\n // pull out our values\u2026\n const co2Values = Object.values(co2ValuesbyComponent);\n\n // so we can return their sum\n return co2Values.reduce(\n (prevValue, currentValue) => prevValue + currentValue\n );\n }\n\n /**\n * Accept a figure for bytes transferred and return the number of kilowatt hours used\n * by the total system for this data transfer\n *\n * @param {number} bytes\n * @return {number} the number of kilowatt hours used\n */\n energyPerByte(bytes) {\n const energyByComponent = this.energyPerByteByComponent(bytes);\n\n // pull out our values\u2026\n const energyValues = Object.values(energyByComponent);\n\n // so we can return their sum\n return energyValues.reduce(\n (prevValue, currentValue) => prevValue + currentValue\n );\n }\n\n /**\n * Accept a figure for bytes transferred, and return an object containing figures\n * per system component, with the caching assumptions applied. This tries to account\n * for webpages being loaded from a cache by browsers, so if you had a thousand page views,\n * and tried to work out the energy per visit, the numbers would reflect the reduced amounts\n * of transfer.\n *\n * @param {number} bytes - the data transferred in bytes for loading a webpage\n * @param {number} firstView - what percentage of visits are loading this page for the first time\n * @param {number} returnView - what percentage of visits are loading this page for subsequent times\n * @param {number} dataReloadRatio - what percentage of a page is reloaded on each subsequent page view\n *\n * @return {object} Object containing the energy in kilowatt hours, keyed by system component\n */\n energyPerVisitByComponent(\n bytes,\n firstView = FIRST_TIME_VIEWING_PERCENTAGE,\n returnView = RETURNING_VISITOR_PERCENTAGE,\n dataReloadRatio = PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD\n ) {\n const energyBycomponent = this.energyPerByteByComponent(bytes);\n const cacheAdjustedSegmentEnergy = {};\n\n log({ energyBycomponent });\n const energyValues = Object.values(energyBycomponent);\n\n // for this, we want\n for (const [key, value] of Object.entries(energyBycomponent)) {\n // represent the first load\n cacheAdjustedSegmentEnergy[`${key} - first`] = value * firstView;\n\n // then represent the subsequent load\n cacheAdjustedSegmentEnergy[`${key} - subsequent`] =\n value * returnView * dataReloadRatio;\n }\n log({ cacheAdjustedSegmentEnergy });\n\n return cacheAdjustedSegmentEnergy;\n }\n\n /**\n * Accept a figure for bytes, and return the total figure for energy per visit\n * using the default caching assumptions for loading a single website\n *\n * @param {number} bytes\n * @return {number} the total energy use for the visit, after applying the caching assumptions\n */\n energyPerVisit(bytes) {\n // fetch the values using the default caching assumptions\n // const energyValues = Object.values(this.energyPerVisitByComponent(bytes));\n\n let firstVisits = 0;\n let subsequentVisits = 0;\n\n const energyBycomponent = Object.entries(\n this.energyPerVisitByComponent(bytes)\n );\n\n for (const [key, val] of energyBycomponent) {\n if (key.indexOf(\"first\") > 0) {\n firstVisits += val;\n }\n }\n\n for (const [key, val] of energyBycomponent) {\n if (key.indexOf(\"subsequent\") > 0) {\n subsequentVisits += val;\n }\n }\n\n return firstVisits + subsequentVisits;\n }\n\n // TODO: this method looks like it applies the carbon intensity\n // change to the *entire* system, not just the datacenter.\n emissionsPerVisitInGrams(energyPerVisit, carbonintensity = GLOBAL_INTENSITY) {\n return formatNumber(energyPerVisit * carbonintensity);\n }\n\n annualEnergyInKwh(energyPerVisit, monthlyVisitors = 1000) {\n return energyPerVisit * monthlyVisitors * 12;\n }\n\n annualEmissionsInGrams(co2grams, monthlyVisitors = 1000) {\n return co2grams * monthlyVisitors * 12;\n }\n\n annualSegmentEnergy(annualEnergy) {\n return {\n consumerDeviceEnergy: formatNumber(annualEnergy * END_USER_DEVICE_ENERGY),\n networkEnergy: formatNumber(annualEnergy * NETWORK_ENERGY),\n dataCenterEnergy: formatNumber(annualEnergy * DATACENTER_ENERGY),\n productionEnergy: formatNumber(annualEnergy * PRODUCTION_ENERGY),\n };\n }\n}\n\nexport { SustainableWebDesign };\nexport default SustainableWebDesign;\n", "const GIGABYTE = 1000 * 1000 * 1000;\n\nexport default {\n GIGABYTE,\n};\n", "const formatNumber = (num) => parseFloat(num.toFixed(2));\n\nexport { formatNumber };\n", "\"use strict\";\n\nimport OneByte from \"./1byte.js\";\nimport SustainableWebDesign from \"./sustainable-web-design.js\";\n\nclass CO2 {\n constructor(options) {\n this.model = new SustainableWebDesign();\n // Using optional chaining allows an empty object to be passed\n // in without breaking the code.\n if (options?.model === \"1byte\") {\n this.model = new OneByte();\n } else if (options?.model === \"swd\") {\n this.model = new SustainableWebDesign();\n } else if (options?.model) {\n throw new Error(\n `\"${options.model}\" is not a valid model. Please use \"1byte\" for the OneByte model, and \"swd\" for the Sustainable Web Design model.\\nSee https://developers.thegreenwebfoundation.org/co2js/models/ to learn more about the models available in CO2.js.`\n );\n }\n }\n\n /**\n * Accept a figure in bytes for data transfer, and a boolean for whether\n * the domain shows as 'green', and return a CO2 figure for energy used to shift the corresponding\n * the data transfer.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @return {number} the amount of CO2 in grammes\n */\n perByte(bytes, green) {\n return this.model.perByte(bytes, green);\n }\n\n /**\n * Accept a figure in bytes for data transfer, and a boolean for whether\n * the domain shows as 'green', and return a CO2 figure for energy used to shift the corresponding\n * the data transfer.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @return {number} the amount of CO2 in grammes\n */\n perVisit(bytes, green) {\n if (this.model?.perVisit) {\n return this.model.perVisit(bytes, green);\n } else {\n throw new Error(\n `The perVisit() method is not supported in the model you are using. Try using perByte() instead.\\nSee https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more about the methods available in CO2.js.`\n );\n }\n }\n\n perDomain(pageXray, greenDomains) {\n const co2PerDomain = [];\n for (let domain of Object.keys(pageXray.domains)) {\n let co2;\n if (greenDomains && greenDomains.indexOf(domain) > -1) {\n co2 = this.perByte(pageXray.domains[domain].transferSize, true);\n } else {\n co2 = this.perByte(pageXray.domains[domain].transferSize);\n }\n co2PerDomain.push({\n domain,\n co2,\n transferSize: pageXray.domains[domain].transferSize,\n });\n }\n co2PerDomain.sort((a, b) => b.co2 - a.co2);\n\n return co2PerDomain;\n }\n\n perPage(pageXray, green) {\n // Accept an xray object, and if we receive a boolean as the second\n // argument, we assume every request we make is sent to a server\n // running on renwewable power.\n\n // if we receive an array of domains, return a number accounting the\n // reduced CO2 from green hosted domains\n\n const domainCO2 = this.perDomain(pageXray, green);\n let totalCO2 = 0;\n for (let domain of domainCO2) {\n totalCO2 += domain.co2;\n }\n return totalCO2;\n }\n\n perContentType(pageXray, greenDomains) {\n const co2PerContentType = {};\n for (let asset of pageXray.assets) {\n const domain = new URL(asset.url).domain;\n const transferSize = asset.transferSize;\n const co2ForTransfer = this.perByte(\n transferSize,\n greenDomains && greenDomains.indexOf(domain) > -1\n );\n const contentType = asset.type;\n if (!co2PerContentType[contentType]) {\n co2PerContentType[contentType] = { co2: 0, transferSize: 0 };\n }\n co2PerContentType[contentType].co2 += co2ForTransfer;\n co2PerContentType[contentType].transferSize += transferSize;\n }\n // restructure and sort\n const all = [];\n for (let type of Object.keys(co2PerContentType)) {\n all.push({\n type,\n co2: co2PerContentType[type].co2,\n transferSize: co2PerContentType[type].transferSize,\n });\n }\n all.sort((a, b) => b.co2 - a.co2);\n return all;\n }\n\n dirtiestResources(pageXray, greenDomains) {\n const allAssets = [];\n for (let asset of pageXray.assets) {\n const domain = new URL(asset.url).domain;\n const transferSize = asset.transferSize;\n const co2ForTransfer = this.perByte(\n transferSize,\n greenDomains && greenDomains.indexOf(domain) > -1\n );\n allAssets.push({ url: asset.url, co2: co2ForTransfer, transferSize });\n }\n allAssets.sort((a, b) => b.co2 - a.co2);\n\n return allAssets.slice(0, allAssets.length > 10 ? 10 : allAssets.length);\n }\n\n perParty(pageXray, greenDomains) {\n let firstParty = 0;\n let thirdParty = 0;\n // calculate co2 per first/third party\n const firstPartyRegEx = pageXray.firstPartyRegEx;\n for (let d of Object.keys(pageXray.domains)) {\n if (!d.match(firstPartyRegEx)) {\n thirdParty += this.perByte(\n pageXray.domains[d].transferSize,\n greenDomains && greenDomains.indexOf(d) > -1\n );\n } else {\n firstParty += this.perByte(\n pageXray.domains[d].transferSize,\n greenDomains && greenDomains.indexOf(d) > -1\n );\n }\n }\n return { firstParty, thirdParty };\n }\n}\n\nexport { CO2 };\nexport default CO2;\n", "\"use strict\";\n\nimport debugFactory from \"debug\";\nconst log = debugFactory(\"tgwf:hosting\");\n\nimport hostingAPI from \"./hosting-api.js\";\n\nfunction check(domain, db) {\n return hostingAPI.check(domain);\n}\n\nexport default {\n check,\n};\n", "\"use strict\";\n\nimport debugFactory from \"debug\";\nconst log = debugFactory(\"tgwf:hostingAPI\");\n\nfunction check(domain) {\n // is it a single domain or an array of them?\n if (typeof domain === \"string\") {\n return checkAgainstAPI(domain);\n } else {\n return checkDomainsAgainstAPI(domain);\n }\n}\n\nasync function checkAgainstAPI(domain) {\n const req = await fetch(\n `https://api.thegreenwebfoundation.org/greencheck/${domain}`\n );\n const res = await req.json();\n return res.green;\n}\n\nasync function checkDomainsAgainstAPI(domains) {\n try {\n const apiPath = \"https://api.thegreenwebfoundation.org/v2/greencheckmulti\";\n const domainsString = JSON.stringify(domains);\n\n const req = await fetch(`${apiPath}/${domainsString}`);\n\n // sanity check API result. Is this the library or\n // the actual API request that's the problem?\n // Is nock mocking node-native fetch API calls properly?\n // Commented out the logs for now, as they cause an error to be thrown when using the library.\n // log(`${apiPath}/${domainsString}`);\n // log({ req });\n // const textResult = await req.text();\n // log({ textResult });\n\n const allGreenCheckResults = await req.json();\n\n return greenDomainsFromResults(allGreenCheckResults);\n } catch (e) {\n return [];\n }\n}\n\nfunction greenDomainsFromResults(greenResults) {\n const entries = Object.entries(greenResults);\n const greenEntries = entries.filter(([key, val]) => val.green);\n return greenEntries.map(([key, val]) => val.url);\n}\n\nexport default {\n check,\n};\n", "const data = {\"AFRICA\":\"489.26\",\"ARG\":\"365.292\",\"ARM\":\"206.522\",\"ASIA\":\"543.57\",\"AUS\":\"526.876\",\"AUT\":\"145.083\",\"AZE\":\"536.585\",\"BGD\":\"559.606\",\"BLR\":\"472.727\",\"BEL\":\"156.063\",\"BOL\":\"311.475\",\"BIH\":\"470.982\",\"BRA\":\"144.677\",\"BGR\":\"364.136\",\"BDI\":\"275.862\",\"CAN\":\"123.859\",\"CHL\":\"395.565\",\"CHN\":\"549.288\",\"CRI\":\"30.903\",\"HRV\":\"212.161\",\"CYP\":\"601.19\",\"CZE\":\"401.272\",\"DNK\":\"240.419\",\"ECU\":\"132.964\",\"EGY\":\"470.879\",\"SLV\":\"180.87\",\"EST\":\"488.529\",\"EU\":\"261.43\",\"EUROPE\":\"277.64\",\"FIN\":\"152.651\",\"FRA\":\"67.781\",\"G20\":\"445.9\",\"G7\":\"338.04\",\"GEO\":\"105.685\",\"DEU\":\"363.982\",\"GRC\":\"363.388\",\"HUN\":\"236.271\",\"IND\":\"632.656\",\"IRL\":\"361.274\",\"ITA\":\"340.937\",\"JPN\":\"460.647\",\"KAZ\":\"656.097\",\"KEN\":\"104.0\",\"LATIN AMERICA AND CARIBBEAN\":\"261.51\",\"LVA\":\"226.351\",\"LTU\":\"247.475\",\"LUX\":\"183.824\",\"MLT\":\"452.055\",\"MEX\":\"391.582\",\"MDA\":\"642.512\",\"MNG\":\"725.26\",\"MNE\":\"335.958\",\"NLD\":\"386.189\",\"NORTH AMERICA\":\"345.38\",\"MKD\":\"444.191\",\"NOR\":\"26.131\",\"OCEANIA\":\"479.98\",\"OECD\":\"338.24\",\"PAK\":\"363.065\",\"PER\":\"241.492\",\"PHL\":\"579.689\",\"POL\":\"657.138\",\"PRT\":\"222.632\",\"ROU\":\"255.718\",\"RUS\":\"355.431\",\"SAU\":\"568.967\",\"SEN\":\"540.098\",\"SRB\":\"549.083\",\"SGP\":\"488.21\",\"SVK\":\"173.854\",\"SVN\":\"241.956\",\"ZAF\":\"706.991\",\"KOR\":\"442.389\",\"ESP\":\"193.737\",\"SWE\":\"43.9\",\"CHE\":\"58.952\",\"TWN\":\"565.629\",\"TJK\":\"72.823\",\"THA\":\"503.034\",\"TUN\":\"470.848\",\"TUR\":\"432.293\",\"UKR\":\"240.28\",\"GBR\":\"268.255\",\"USA\":\"378.625\",\"VNM\":\"491.192\",\"WORLD\":\"442.37\"}; const type = \"average\"; const year = \"2021\"; export { data, type, year }; export default { data, type, year };", "const data = {\"AFG\":\"414\",\"ALB\":\"0\",\"DZA\":\"528\",\"ASM\":\"753\",\"AND\":\"188\",\"AGO\":\"1476\",\"AIA\":\"753\",\"ATG\":\"753\",\"ARG\":\"478\",\"ARM\":\"390\",\"ABW\":\"753\",\"AUS\":\"808\",\"AUT\":\"242\",\"AZE\":\"534\",\"AZORES (PORTUGAL)\":\"753\",\"BHS\":\"753\",\"BHR\":\"726\",\"BGD\":\"528\",\"BRB\":\"749\",\"BLR\":\"400\",\"BEL\":\"252\",\"BLZ\":\"403\",\"BEN\":\"745\",\"BMU\":\"753\",\"BTN\":\"0\",\"BOL\":\"604\",\"BES\":\"753\",\"BIH\":\"1197\",\"BWA\":\"1486\",\"BRA\":\"284\",\"VGB\":\"753\",\"BRN\":\"681\",\"BGR\":\"911\",\"BFA\":\"753\",\"BDI\":\"414\",\"KHM\":\"1046\",\"CMR\":\"659\",\"CAN\":\"372\",\"CYM\":\"753\",\"CPV\":\"753\",\"CAF\":\"188\",\"TCD\":\"753\",\"CHANNEL ISLANDS (U.K)\":\"753\",\"CHL\":\"657\",\"CHN\":\"899\",\"COL\":\"410\",\"COM\":\"753\",\"COD\":\"0\",\"COG\":\"659\",\"COK\":\"753\",\"CRI\":\"108\",\"CIV\":\"466\",\"HRV\":\"294\",\"CUB\":\"559\",\"CUW\":\"876\",\"CYP\":\"751\",\"CZE\":\"902\",\"DNK\":\"362\",\"DJI\":\"753\",\"DMA\":\"753\",\"DOM\":\"601\",\"ECU\":\"560\",\"EGY\":\"554\",\"SLV\":\"547\",\"GNQ\":\"632\",\"ERI\":\"915\",\"EST\":\"1057\",\"SWZ\":\"0\",\"ETH\":\"0\",\"FLK\":\"753\",\"FRO\":\"753\",\"FJI\":\"640\",\"FIN\":\"267\",\"FRA\":\"158\",\"GUF\":\"423\",\"PYF\":\"753\",\"GAB\":\"946\",\"GMB\":\"753\",\"GEO\":\"289\",\"DEU\":\"650\",\"GHA\":\"495\",\"GIB\":\"779\",\"GRC\":\"507\",\"GRL\":\"264\",\"GRD\":\"753\",\"GLP\":\"753\",\"GUM\":\"753\",\"GTM\":\"798\",\"GIN\":\"753\",\"GNB\":\"753\",\"GUY\":\"847\",\"HTI\":\"1048\",\"HND\":\"662\",\"HUN\":\"296\",\"ISL\":\"0\",\"IND\":\"951\",\"IDN\":\"783\",\"IRN\":\"592\",\"IRQ\":\"1080\",\"IRL\":\"380\",\"IMN\":\"436\",\"ISR\":\"394\",\"ITA\":\"414\",\"JAM\":\"711\",\"JPN\":\"471\",\"JOR\":\"529\",\"KAZ\":\"797\",\"KEN\":\"574\",\"KIR\":\"753\",\"PRK\":\"754\",\"KOR\":\"555\",\"XKX\":\"1145\",\"KWT\":\"675\",\"KGZ\":\"217\",\"LAO\":\"1069\",\"LVA\":\"240\",\"LBN\":\"794\",\"LSO\":\"0\",\"LBR\":\"677\",\"LBY\":\"668\",\"LIE\":\"151\",\"LTU\":\"211\",\"LUX\":\"220\",\"MDG\":\"876\",\"MADEIRA (PORTUGAL)\":\"663\",\"MWI\":\"489\",\"MYS\":\"551\",\"MDV\":\"753\",\"MLI\":\"1076\",\"MLT\":\"520\",\"MHL\":\"753\",\"MTQ\":\"753\",\"MRT\":\"753\",\"MUS\":\"700\",\"MYT\":\"753\",\"MEX\":\"531\",\"FSM\":\"753\",\"MDA\":\"541\",\"MCO\":\"158\",\"MNG\":\"1366\",\"MNE\":\"899\",\"MSR\":\"753\",\"MAR\":\"729\",\"MOZ\":\"234\",\"MMR\":\"719\",\"NAM\":\"355\",\"NRU\":\"753\",\"NPL\":\"0\",\"NLD\":\"326\",\"NCL\":\"779\",\"NZL\":\"246\",\"NIC\":\"675\",\"NER\":\"772\",\"NGA\":\"526\",\"NIU\":\"753\",\"MKD\":\"851\",\"MNP\":\"753\",\"NOR\":\"47\",\"OMN\":\"479\",\"PAK\":\"592\",\"PLW\":\"753\",\"PSE\":\"719\",\"PAN\":\"477\",\"PNG\":\"597\",\"PRY\":\"0\",\"PER\":\"473\",\"PHL\":\"672\",\"POL\":\"828\",\"PRT\":\"389\",\"PRI\":\"596\",\"QAT\":\"503\",\"REU\":\"772\",\"ROU\":\"489\",\"RUS\":\"476\",\"RWA\":\"712\",\"SHN\":\"753\",\"KNA\":\"753\",\"LCA\":\"753\",\"MAF\":\"753\",\"SPM\":\"753\",\"VCT\":\"753\",\"WSM\":\"753\",\"SMR\":\"414\",\"STP\":\"753\",\"SAU\":\"592\",\"SEN\":\"870\",\"SRB\":\"1086\",\"SYC\":\"753\",\"SLE\":\"489\",\"SGP\":\"379\",\"SXM\":\"753\",\"SVK\":\"332\",\"SVN\":\"620\",\"SLB\":\"753\",\"SOM\":\"753\",\"ZAF\":\"1070\",\"SSD\":\"890\",\"ESP\":\"402\",\"LKA\":\"731\",\"SDN\":\"736\",\"SUR\":\"1029\",\"SWE\":\"68\",\"CHE\":\"48\",\"SYR\":\"713\",\"TWN\":\"484\",\"TJK\":\"255\",\"TZA\":\"531\",\"THA\":\"450\",\"TLS\":\"753\",\"TGO\":\"859\",\"TON\":\"753\",\"TTO\":\"559\",\"TUN\":\"468\",\"TUR\":\"376\",\"TKM\":\"927\",\"TCA\":\"753\",\"TUV\":\"753\",\"UGA\":\"279\",\"UKR\":\"768\",\"ARE\":\"556\",\"GBR\":\"380\",\"USA\":\"416\",\"URY\":\"174\",\"UZB\":\"612\",\"VUT\":\"753\",\"VEN\":\"711\",\"VNM\":\"560\",\"VIR\":\"650\",\"YEM\":\"807\",\"ZMB\":\"416\",\"ZWE\":\"1575\",\"MEMO: EU 27\":\"409\"}; const type = \"marginal\"; const year = \"2021\"; export { data, type, year }; export default { data, type, year };"],
5
+ "mappings": "ioBAAA,iBAIA,GAAI,GAAI,IACJ,EAAI,EAAI,GACR,EAAI,EAAI,GACR,EAAI,EAAI,GACR,GAAI,EAAI,EACR,GAAI,EAAI,OAgBZ,EAAO,QAAU,SAAS,EAAK,EAAS,CACtC,EAAU,GAAW,CAAC,EACtB,GAAI,GAAO,MAAO,GAClB,GAAI,IAAS,UAAY,EAAI,OAAS,EACpC,MAAO,IAAM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AAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,OAAO,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,OAAO,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,OAAO,IAAM,KAAK,IAAM,KAAK,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,MAAM,IAAM,OAAO,eAAe,KAAK,EAAS,GAAO,WAAkB,GAAO,OAAqC,GAAO,GAAQ,CAAE,QAAM,QAAM,OAAK,ETM/4F,GAAO,IAAQ,CAAE,MAAK,UAAS,mBAAkB,mBAAkB",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tgwf/co2",
3
- "version": "0.11.3",
3
+ "version": "0.11.4",
4
4
  "description": "Work out the co2 of your digital services",
5
5
  "main": "dist/cjs/index-node.js",
6
6
  "module": "dist/esm/index.js",
@@ -30,10 +30,11 @@ async function checkDomainsAgainstAPI(domains) {
30
30
  // sanity check API result. Is this the library or
31
31
  // the actual API request that's the problem?
32
32
  // Is nock mocking node-native fetch API calls properly?
33
- log(`${apiPath}/${domainsString}`);
34
- log({ req });
35
- const textResult = await req.text();
36
- log({ textResult });
33
+ // Commented out the logs for now, as they cause an error to be thrown when using the library.
34
+ // log(`${apiPath}/${domainsString}`);
35
+ // log({ req });
36
+ // const textResult = await req.text();
37
+ // log({ textResult });
37
38
 
38
39
  const allGreenCheckResults = await req.json();
39
40
 
@@ -70,4 +70,5 @@ function checkDomainsInJSON(domains, db) {
70
70
  module.exports = {
71
71
  check,
72
72
  loadJSON,
73
+ greenDomainsFromResults,
73
74
  };
package/src/readme.md DELETED
@@ -1,66 +0,0 @@
1
- # How to use the different models in CO2.js
2
-
3
- CO2js offers two models for understanding the environmental impact of compute - the 1byte model (`1byte.js`), and the Sustainable Web Design model (`swd.js`)
4
-
5
- ### The 1byte model
6
-
7
- The default model in use is the 1byte model as used by the Shift Project, as introduced in their report on CO2 emissions from digital infrastructure, [Lean ICT: for a sober digital][soberDigital].
8
-
9
- This returns a number for the estimated CO2 emissions for the corresponding number of bytes sent over the wire, and has been used for video streaming, file downloads and websites.
10
-
11
- ```js
12
- // assume you have imported or required the CO2 class from 1byte.js
13
- // for your runtime - either a browser, nodejs, etc.
14
-
15
- const bytesSent = (1024 * 1024 * 1024)
16
- const co2Emission = new CO2();
17
- const estimatedCO2 = co2Emission.perByte(bytesSent)
18
- ```
19
-
20
-
21
- ### The Sustainable Web Design model
22
-
23
- As of version 0.9, CO2.js also provides the [Sustainable Web Design model][swd] for calculating emissions from digital services. As the name suggests, this has been designed for helping understand the environmental impact of websites. Further details are available on the [Sustainable Web Design website explaining the model](https://sustainablewebdesign.org/calculating-digital-emissions/), but for convenience, a short summary is below.
24
-
25
- #### How the SWD works
26
-
27
- This model uses data transfer as an proxy indicator for total resource usage, and uses this number to extrapolate energy usage numbers for your application as a fraction of the energy used by the total system comprised of:
28
-
29
- 1. the use-phase energy of datacentres serving content
30
- 2. the use-phase energy network transfering the data
31
- 3. the use-phase energy of user device an user is accessing content on
32
- 4. the total embodied energy used to create all of the above
33
-
34
- ![swd model](../images/swd-energy-usage.png)
35
-
36
- It then converts these energy figures to carbon emissions, based on the carbon intensity of electricity from the [Ember annual global electricity review][Ember-annual-global-electricity-review].
37
-
38
- The carbon intensity of electricity figures for the swd model include the the full lifecycle emissions including upstream methane, supply-chain and manufacturing emissions, and include all gases, converted into CO2 equivalent over a 100 year timescale.
39
-
40
- This follows the approach used by the IPCC 5th Assessment Report Annex 3 (2014), for the carbon intensity of electricity.
41
-
42
- [Ember's methodology notes][ember-methodology] detail where the rest of this data comes from in more detail, as well as any further assumptions made.
43
-
44
-
45
- [ember-methodology]: https://ember-climate.org/app/uploads/2022/03/GER22-Methodology.pdf
46
-
47
- [Ember-annual-global-electricity-review]: https://ember-climate.org/insights/research/european-electricity-review-2022/
48
-
49
-
50
-
51
-
52
- ### Sample usage
53
-
54
- ```js
55
- // assume you have imported or required the CO2 class from swd.js
56
- // for your runtime - either a browser, nodejs, etc.
57
-
58
- // assume a 1 megabyte webpage
59
- const bytesSent = (1024 * 1024 * 1024)
60
-
61
- const co2Emission = new CO2();
62
- const estimatedCO2ForTransfer = co2Emission.emissionsPerVisitInGrams(bytesSent)
63
- ```
64
-
65
- [soberDigital]: https://theshiftproject.org/en/lean-ict-2/
66
- [swd]: https://sustainablewebdesign.org/calculating-digital-emissions