@tgwf/co2 0.14.0 → 0.14.1

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 (43) hide show
  1. package/CHANGELOG.md +109 -4
  2. package/README.md +70 -16
  3. package/dist/cjs/co2.js +14 -22
  4. package/dist/cjs/co2.js.map +2 -2
  5. package/dist/cjs/data/average-intensities.min.js +1 -1
  6. package/dist/cjs/data/average-intensities.min.js.map +2 -2
  7. package/dist/cjs/helpers/index.js +6 -6
  8. package/dist/cjs/helpers/index.js.map +2 -2
  9. package/dist/cjs/sustainable-web-design.js +9 -6
  10. package/dist/cjs/sustainable-web-design.js.map +2 -2
  11. package/dist/esm/co2.js +16 -24
  12. package/dist/esm/data/average-intensities.min.js +1 -1
  13. package/dist/esm/helpers/index.js +6 -6
  14. package/dist/esm/sustainable-web-design.js +9 -6
  15. package/package.json +9 -6
  16. package/.all-contributorsrc +0 -39
  17. package/.esbuild.browser.js +0 -11
  18. package/.esbuild.esm.js +0 -25
  19. package/.esbuild.node.js +0 -16
  20. package/.eslintignore +0 -1
  21. package/.gitpod.yml +0 -8
  22. package/data/output/average-intensities.js +0 -226
  23. package/data/output/average-intensities.json +0 -1328
  24. package/data/output/marginal-intensities-2021.js +0 -238
  25. package/data/output/marginal-intensities-2021.json +0 -2801
  26. package/dist/iife/index.js +0 -20
  27. package/dist/iife/index.js.map +0 -7
  28. package/fixup +0 -19
  29. package/index.d.ts +0 -2
  30. package/src/1byte.js +0 -77
  31. package/src/co2.js +0 -311
  32. package/src/constants/file-size.js +0 -5
  33. package/src/constants/index.js +0 -39
  34. package/src/data/average-intensities.min.js +0 -1
  35. package/src/data/marginal-intensities-2021.min.js +0 -1
  36. package/src/helpers/index.js +0 -175
  37. package/src/hosting-api.js +0 -64
  38. package/src/hosting-json.node.js +0 -107
  39. package/src/hosting-node.js +0 -113
  40. package/src/hosting.js +0 -16
  41. package/src/index-node.js +0 -5
  42. package/src/index.js +0 -7
  43. package/src/sustainable-web-design.js +0 -329
package/CHANGELOG.md CHANGED
@@ -18,6 +18,111 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
18
18
 
19
19
  # Released
20
20
 
21
+ ## [0.13.8] - 2023-10-09
22
+
23
+ - Fix: Properly use value of 0 for system segments and variables in the perByteTrace and perVisitTrace functions.
24
+ - Automated monthly update of annual average grid intensity data.
25
+
26
+ ## [0.13.7] - 2023-09-13
27
+
28
+ - Automated monthly update of annual average grid intensity data.
29
+
30
+ ## [0.13.6] - 2023-08-08
31
+
32
+ - Automated monthly update of annual average grid intensity data.
33
+ - Create FUNDING.yml to allow sponsor contribution to this project.
34
+ - Store segment flag on CO2 instance, not models.
35
+
36
+ ## [0.13.5] - 2023-07-5
37
+
38
+ ### Changed
39
+
40
+ - Automated monthly update of annual average grid intensity data.
41
+
42
+ ## [0.13.4] - 2023-05-24
43
+
44
+ ### Fixed
45
+
46
+ - Fixed an error when try to use global grid intensities in IIFE. (PR #147)
47
+
48
+ ## [0.13.3] - 2023-05-18
49
+
50
+ ### Changed
51
+
52
+ - Updated the global grid intensity constant to use the latest WORLD grid intensity value from Ember. (PR #142)
53
+
54
+ ## [0.13.2] - 2023-04-21
55
+
56
+ - Fix to ensure that region names that are keys in the average annual grid intensity export are capitalised.
57
+
58
+ ## [0.13.1] - 2023-04-20
59
+
60
+ ### Fixed
61
+
62
+ - Fixed the import of average grid intensities in node. (PR #137)
63
+
64
+ ## [0.13.0] - 2023-04-13
65
+
66
+ ### Changed
67
+
68
+ In PR #135 there were significant changes made to how average annual grid intensities are fetched and generated.
69
+
70
+ - Updated average annual grid intensities to include 2022 values from Ember.
71
+ - Changed the functions to generate average grid intensities to:
72
+ - Fetch data directly from Ember's API.
73
+ - Get the _latest_ annual average values for each country/region.
74
+ - Renamed the average grid intensities export file.
75
+
76
+ ## [0.12.2] - 2023-03-01
77
+
78
+ ### Added
79
+
80
+ - Add a module declaration for use from typescript (PR #131)
81
+
82
+ ### Changed
83
+
84
+ - Updated 2021 average annual grid intensity values (PR #133)
85
+
86
+ ## [0.12.1] - 2023-02-02
87
+
88
+ ### Fixed
89
+
90
+ - Removed incorrectly imported constants in tests.
91
+
92
+ ## [0.12.0] - 2023-02-02
93
+
94
+ ### Added
95
+
96
+ - Introduced two new functions `perByteTrace` and `perVisitTrace` which allow developers to pass an options object containing customised values for the constants used in the Sustainable Web Design model. (PR #126)
97
+
98
+ ### Changed
99
+
100
+ - Allowed developers now have the option to return a breakdown of carbon emissions estimates by system segment when using the Sustainable Web Design model. (PR #113)
101
+
102
+ ## [0.11.4] - 2022-12-02
103
+
104
+ ### Fixed
105
+
106
+ - Updated the `greenCheckMulti` function to work properly in ESM. (PR #123)
107
+
108
+ ## [0.11.3] - 2022-10-13
109
+
110
+ ### Fixed
111
+
112
+ - Corrected the Node export for the hosting raised in issue #110. (PR #118)
113
+
114
+ ## [0.11.2] - 2022-10-11
115
+
116
+ ### Fixed
117
+
118
+ - v0.11.x updates increased library size to 17MB + when published to NPM. This has been raised in [#108](https://github.com/thegreenwebfoundation/co2.js/issues/108) and it was found data files were being included in the published package. (PR #117)
119
+
120
+ ## [0.11.1] - 2022-10-07
121
+
122
+ ### Changed
123
+
124
+ - We have used generic filenames for data files, to avoid any confusion around the data being provided in this library. (PR #112)
125
+
21
126
  ## [0.11.0] - 2022-10-03
22
127
 
23
128
  ### Added
@@ -30,16 +135,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
30
135
 
31
136
  ### Changed
32
137
 
33
- - Changed the default model for transfer based CO2 calculations from the _1byte_ model to the _Sustainable Web Design_ model instead. See https://developers.thegreenwebfoundation.org/co2js/models/ for guidance on the differences and how to migrate between them. See [#94 for more](https://github.com/thegreenwebfoundation/co2.js/issues/94).
138
+ - Changed the default model for transfer based CO2 calculations from the _1byte_ model to the _Sustainable Web Design_ model instead. See <https://developers.thegreenwebfoundation.org/co2js/models/> for guidance on the differences and how to migrate between them. See [#94 for more](https://github.com/thegreenwebfoundation/co2.js/issues/94).
34
139
  - Updated our release commands to generate and format the carbon intensity data as part of the release process.
35
140
 
36
- ## 0.10.4 2022-08-12
141
+ ## [0.10.4] - 2022-08-12
37
142
 
38
143
  ### Added
39
144
 
40
145
  - Introduced a `release:patch` command, to automate the publishing process. This is designed to make sure we always publish the most recent compiled code, by adding a rebuild step that can be easy to forget.
41
146
 
42
- ## 0.10.3 2022-08-12
147
+ ## [0.10.3] - 2022-08-12
43
148
 
44
149
  ### Added
45
150
 
@@ -122,7 +227,7 @@ This release used a version bump as previously we had released v0.10.0 under a p
122
227
 
123
228
  ### Removed
124
229
 
125
- - Extracted sqlite usage and dependencies into a separate module, `url2green`. This means you no longer need to compile SQLite on install.
230
+ - Extracted sqlite usage and dependencies into a separate module, `url2green`. This means you no longer need to compile SQLite on install.
126
231
 
127
232
  ## [0.5.0] - 2020-03-03
128
233
 
package/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # CO2.js
2
2
 
3
+ <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
4
+
5
+ [![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors-)
6
+
7
+ <!-- ALL-CONTRIBUTORS-BADGE:END -->
8
+
3
9
  <img src="https://github.com/thegreenwebfoundation/co2.js/actions/workflows/unittests.yml/badge.svg" />
4
10
 
5
11
  One day, the internet will be powered by renewable energy. Until that day comes, there’ll be a CO2 cost that comes with every byte of data that’s uploaded or downloaded. By being able to calculate these emissions, developers can be empowered to create more efficient, lower carbon apps, websites, and software.
@@ -14,7 +20,7 @@ CO2.js is a JavaScript library that enables developers a way to estimate the emi
14
20
 
15
21
  Being able to estimate the CO2 emissions associated with digital activities can be of benefit to both developers and users.
16
22
 
17
- Internally, you may want to use this library to create a *carbon budget* for your site or app. It is also useful for inclusion in dashboards and monitoring tools.
23
+ Internally, you may want to use this library to create a _carbon budget_ for your site or app. It is also useful for inclusion in dashboards and monitoring tools.
18
24
 
19
25
  For user facing applications, CO2.js could be used to check & block the uploading of carbon intensive files. Or, to present users with information about the carbon impact of their online activities (such as browsing a website).
20
26
 
@@ -35,7 +41,7 @@ npm install @tgwf/co2
35
41
  You can import the CO2.js library into projects using Skypack.
36
42
 
37
43
  ```js
38
- import tgwf from 'https://cdn.skypack.dev/@tgwf/co2';
44
+ import tgwf from "https://cdn.skypack.dev/@tgwf/co2";
39
45
  ```
40
46
 
41
47
  ## Using a JS CDN
@@ -66,10 +72,18 @@ You can also build the CO2.js library from the source code. To do this:
66
72
  1. Clone or fork the repository.
67
73
  1. Navigate to the folder on your machine and run `npm run build` in your terminal.
68
74
  1. Once the build has finished running, you will find a `/dist` folder has been created. Inside you can find:
69
-
70
- - `dist/cjs` - A CommonJS compatible build.
71
- - `dist/esm` - An ES Modules compatible build.
72
- - `dist/iife` - An Immediately Invoked Function Expression (IIFE) version of the library.
75
+
76
+ - `dist/cjs` - A CommonJS compatible build.
77
+ - `dist/esm` - An ES Modules compatible build.
78
+ - `dist/iife` - An Immediately Invoked Function Expression (IIFE) version of the library.
79
+
80
+ ## TypeScript support
81
+
82
+ Type definitions for CO2.js are [published in the DefinitelyTyped project](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tgwf__co2), and are [available on NPM](https://www.npmjs.com/package/@types/tgwf__co2) at `@types/tgwf__co2`.
83
+
84
+ If you want to use type definitions in your project, they should be installed as a devDependency.
85
+
86
+ `npm install --dev @types/tgwf__co2`
73
87
 
74
88
  ## Marginal and average emissions intensity data
75
89
 
@@ -80,13 +94,14 @@ CO2.js includes yearly average grid intensity data from [Ember](https://ember-cl
80
94
  You can import annual, country-level marginal or average grid intensity data into your projects directly from CO2.js. For example, if we wanted to use the average grid intensity for Australia in our project, we could use the code below:
81
95
 
82
96
  ```js
83
- import { averageIntensity } from '@tgwf/co2';
97
+ import { averageIntensity } from "@tgwf/co2";
84
98
  const { data } = averageIntensity;
85
99
  const { AUS } = data;
86
- console.log({ AUS })
100
+ console.log({ AUS });
87
101
  ```
88
102
 
89
103
  All countries are represented by their respective [Alpha-3 ISO country code](https://www.iso.org/obp/ui/#search).
104
+
90
105
  ## Publishing to NPM
91
106
 
92
107
  We use [`np`](https://www.npmjs.com/package/np) to publish new versions of this library to NPM. To do this:
@@ -100,20 +115,59 @@ We use [`np`](https://www.npmjs.com/package/np) to publish new versions of this
100
115
 
101
116
  CO2.js releases will be communicated through the following channels:
102
117
 
103
- | Channel | Minor Release (0.xx) | Patch Release (0.xx.x) |
104
- |----------|----------------------|----------------------|
105
- | [Github](https://github.com/thegreenwebfoundation/co2.js/releases) | ✅ | ✅ |
106
- | [Green Web Foundation website](https://www.thegreenwebfoundation.org/co2-js/#releases) | ✅ | ❌ |
107
- | W3C Slack Sustainability Channel | ✅ | ❌ |
108
- | ClimateAction.Tech Slack | ✅ | ❌ |
109
- | [Green Web Foundation LinkedIn Account](https://www.linkedin.com/company/green-web-foundation/) | ✅ | ❌ |
118
+ | Channel | Minor Release (0.xx) | Patch Release (0.xx.x) |
119
+ | ----------------------------------------------------------------------------------------------- | -------------------- | ---------------------- |
120
+ | [Github](https://github.com/thegreenwebfoundation/co2.js/releases) | ✅ | ✅ |
121
+ | [Green Web Foundation website](https://www.thegreenwebfoundation.org/co2-js/#releases) | ✅ | ❌ |
122
+ | W3C Slack Sustainability Channel | ✅ | ❌ |
123
+ | ClimateAction.Tech Slack | ✅ | ❌ |
124
+ | [Green Web Foundation LinkedIn Account](https://www.linkedin.com/company/green-web-foundation/) | ✅ | ❌ |
110
125
 
111
126
  ## Licenses
112
127
 
113
- The code for CO2.js is licensed Apache 2.0. ([What does this mean?](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)))
128
+ The code for CO2.js is licensed Apache 2.0. ([What does this mean?](<https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)>))
114
129
 
115
130
  The average carbon intensity data from Ember is published under the Creative Commons ShareAlike Attribution Licence ([CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)). ([What does this mean?](https://www.tldrlegal.com/license/creative-commons-attribution-share-alike-cc-sa))
116
131
 
117
132
  The marginal intensity data is published by the Green Web Foundation, under the Creative Commons ShareAlike Attribution Licence ([CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)). ([What does this mean?](https://www.tldrlegal.com/license/creative-commons-attribution-share-alike-cc-sa))
118
133
 
119
134
  See LICENCE for more.
135
+
136
+ ## Contributors
137
+
138
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
139
+ <!-- prettier-ignore-start -->
140
+ <!-- markdownlint-disable -->
141
+ <table>
142
+ <tbody>
143
+ <tr>
144
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/mrchrisadams"><img src="https://avatars.githubusercontent.com/u/17906?v=4?s=100" width="100px;" alt="Chris Adams"/><br /><sub><b>Chris Adams</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=mrchrisadams" title="Code">💻</a></td>
145
+ <td align="center" valign="top" width="14.28%"><a href="https://www.fershad.com/"><img src="https://avatars.githubusercontent.com/u/27988517?v=4?s=100" width="100px;" alt="fershad"/><br /><sub><b>fershad</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=fershad" title="Code">💻</a> <a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=fershad" title="Documentation">📖</a> <a href="#maintenance-fershad" title="Maintenance">🚧</a></td>
146
+ <td align="center" valign="top" width="14.28%"><a href="https://www.peterhedenskog.com/"><img src="https://avatars.githubusercontent.com/u/540757?v=4?s=100" width="100px;" alt="Peter Hedenskog"/><br /><sub><b>Peter Hedenskog</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=soulgalore" title="Code">💻</a></td>
147
+ <td align="center" valign="top" width="14.28%"><a href="https://www.drydenwilliams.co.uk/"><img src="https://avatars.githubusercontent.com/u/4403089?v=4?s=100" width="100px;" alt="Dryden"/><br /><sub><b>Dryden</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=drydenwilliams" title="Code">💻</a></td>
148
+ <td align="center" valign="top" width="14.28%"><a href="https://evanhahn.com/"><img src="https://avatars.githubusercontent.com/u/777712?v=4?s=100" width="100px;" alt="Evan Hahn"/><br /><sub><b>Evan Hahn</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=EvanHahn" title="Code">💻</a> <a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=EvanHahn" title="Tests">⚠️</a></td>
149
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/PrathumP"><img src="https://avatars.githubusercontent.com/u/115390367?v=4?s=100" width="100px;" alt="Prathum Pandey"/><br /><sub><b>Prathum Pandey</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/issues?q=author%3APrathumP" title="Bug reports">🐛</a> <a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=PrathumP" title="Code">💻</a></td>
150
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/Fdawgs"><img src="https://avatars.githubusercontent.com/u/43814140?v=4?s=100" width="100px;" alt="Frazer Smith"/><br /><sub><b>Frazer Smith</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=Fdawgs" title="Code">💻</a> <a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=Fdawgs" title="Tests">⚠️</a></td>
151
+ </tr>
152
+ <tr>
153
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/hamishfagg"><img src="https://avatars.githubusercontent.com/u/895845?v=4?s=100" width="100px;" alt="Hamish Fagg"/><br /><sub><b>Hamish Fagg</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=hamishfagg" title="Code">💻</a></td>
154
+ <td align="center" valign="top" width="14.28%"><a href="http://portfolio.toolness.org/"><img src="https://avatars.githubusercontent.com/u/124687?v=4?s=100" width="100px;" alt="Atul Varma"/><br /><sub><b>Atul Varma</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=toolness" title="Code">💻</a></td>
155
+ <td align="center" valign="top" width="14.28%"><a href="https://www.intersectionalenvironmentalist.com/"><img src="https://avatars.githubusercontent.com/u/1530684?v=4?s=100" width="100px;" alt="Piper"/><br /><sub><b>Piper</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=piperchester" title="Code">💻</a></td>
156
+ <td align="center" valign="top" width="14.28%"><a href="https://vasquezruiz.com/"><img src="https://avatars.githubusercontent.com/u/108420?v=4?s=100" width="100px;" alt="Raymundo Vásquez Ruiz"/><br /><sub><b>Raymundo Vásquez Ruiz</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=raymundovr" title="Code">💻</a></td>
157
+ <td align="center" valign="top" width="14.28%"><a href="https://greengumption.co.uk/"><img src="https://avatars.githubusercontent.com/u/26165947?v=4?s=100" width="100px;" alt="JamieB"/><br /><sub><b>JamieB</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=JamieBeevor" title="Code">💻</a></td>
158
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/p-gerard"><img src="https://avatars.githubusercontent.com/u/97036756?v=4?s=100" width="100px;" alt="p-gerard"/><br /><sub><b>p-gerard</b></sub></a><br /><a href="https://github.com/thegreenwebfoundation/co2.js/issues?q=author%3Ap-gerard" title="Bug reports">🐛</a> <a href="https://github.com/thegreenwebfoundation/co2.js/commits?author=p-gerard" title="Code">💻</a></td>
159
+ </tr>
160
+ </tbody>
161
+ </table>
162
+
163
+ <!-- markdownlint-restore -->
164
+ <!-- prettier-ignore-end -->
165
+
166
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
167
+ <!-- prettier-ignore-start -->
168
+ <!-- markdownlint-disable -->
169
+
170
+ <!-- markdownlint-restore -->
171
+ <!-- prettier-ignore-end -->
172
+
173
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
package/dist/cjs/co2.js CHANGED
@@ -40,23 +40,15 @@ class CO2 {
40
40
  throw new Error(`"${options.model}" is not a valid model. Please use "1byte" for the OneByte model, and "swd" for the Sustainable Web Design model.
41
41
  See https://developers.thegreenwebfoundation.org/co2js/models/ to learn more about the models available in CO2.js.`);
42
42
  }
43
- if ((options == null ? void 0 : options.results) === "segment") {
44
- this.model.results = {
45
- segment: true
46
- };
47
- } else {
48
- this.model.results = {
49
- segment: false
50
- };
51
- }
43
+ this._segment = (options == null ? void 0 : options.results) === "segment";
52
44
  }
53
45
  perByte(bytes, green = false) {
54
- return this.model.perByte(bytes, green, this.model.results.segment);
46
+ return this.model.perByte(bytes, green, this._segment);
55
47
  }
56
48
  perVisit(bytes, green = false) {
57
49
  var _a;
58
50
  if ((_a = this.model) == null ? void 0 : _a.perVisit) {
59
- return this.model.perVisit(bytes, green, this.model.results.segment);
51
+ return this.model.perVisit(bytes, green, this._segment);
60
52
  } else {
61
53
  throw new Error(`The perVisit() method is not supported in the model you are using. Try using perByte() instead.
62
54
  See https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more about the methods available in CO2.js.`);
@@ -69,17 +61,17 @@ See https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more ab
69
61
  adjustments = (0, import_helpers.parseOptions)(options);
70
62
  }
71
63
  return {
72
- co2: this.model.perByte(bytes, green, this.model.results.segment, adjustments),
64
+ co2: this.model.perByte(bytes, green, this._segment, adjustments),
73
65
  green,
74
66
  variables: {
75
67
  description: "Below are the variables used to calculate this CO2 estimate.",
76
68
  bytes,
77
69
  gridIntensity: {
78
70
  description: "The grid intensity (grams per kilowatt-hour) used to calculate this CO2 estimate.",
79
- network: ((_b = (_a = adjustments == null ? void 0 : adjustments.gridIntensity) == null ? void 0 : _a.network) == null ? void 0 : _b.value) || import_constants.GLOBAL_GRID_INTENSITY,
80
- dataCenter: green ? import_constants.RENEWABLES_GRID_INTENSITY : ((_d = (_c = adjustments == null ? void 0 : adjustments.gridIntensity) == null ? void 0 : _c.dataCenter) == null ? void 0 : _d.value) || import_constants.GLOBAL_GRID_INTENSITY,
71
+ network: ((_b = (_a = adjustments == null ? void 0 : adjustments.gridIntensity) == null ? void 0 : _a.network) == null ? void 0 : _b.value) ?? import_constants.GLOBAL_GRID_INTENSITY,
72
+ dataCenter: green ? import_constants.RENEWABLES_GRID_INTENSITY : ((_d = (_c = adjustments == null ? void 0 : adjustments.gridIntensity) == null ? void 0 : _c.dataCenter) == null ? void 0 : _d.value) ?? import_constants.GLOBAL_GRID_INTENSITY,
81
73
  production: import_constants.GLOBAL_GRID_INTENSITY,
82
- device: ((_f = (_e = adjustments == null ? void 0 : adjustments.gridIntensity) == null ? void 0 : _e.device) == null ? void 0 : _f.value) || import_constants.GLOBAL_GRID_INTENSITY
74
+ device: ((_f = (_e = adjustments == null ? void 0 : adjustments.gridIntensity) == null ? void 0 : _e.device) == null ? void 0 : _f.value) ?? import_constants.GLOBAL_GRID_INTENSITY
83
75
  }
84
76
  }
85
77
  };
@@ -92,21 +84,21 @@ See https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more ab
92
84
  adjustments = (0, import_helpers.parseOptions)(options);
93
85
  }
94
86
  return {
95
- co2: this.model.perVisit(bytes, green, this.model.results.segment, adjustments),
87
+ co2: this.model.perVisit(bytes, green, this._segment, adjustments),
96
88
  green,
97
89
  variables: {
98
90
  description: "Below are the variables used to calculate this CO2 estimate.",
99
91
  bytes,
100
92
  gridIntensity: {
101
93
  description: "The grid intensity (grams per kilowatt-hour) used to calculate this CO2 estimate.",
102
- network: ((_c = (_b = adjustments == null ? void 0 : adjustments.gridIntensity) == null ? void 0 : _b.network) == null ? void 0 : _c.value) || import_constants.GLOBAL_GRID_INTENSITY,
103
- dataCenter: green ? import_constants.RENEWABLES_GRID_INTENSITY : ((_e = (_d = adjustments == null ? void 0 : adjustments.gridIntensity) == null ? void 0 : _d.dataCenter) == null ? void 0 : _e.value) || import_constants.GLOBAL_GRID_INTENSITY,
94
+ network: ((_c = (_b = adjustments == null ? void 0 : adjustments.gridIntensity) == null ? void 0 : _b.network) == null ? void 0 : _c.value) ?? import_constants.GLOBAL_GRID_INTENSITY,
95
+ dataCenter: green ? import_constants.RENEWABLES_GRID_INTENSITY : ((_e = (_d = adjustments == null ? void 0 : adjustments.gridIntensity) == null ? void 0 : _d.dataCenter) == null ? void 0 : _e.value) ?? import_constants.GLOBAL_GRID_INTENSITY,
104
96
  production: import_constants.GLOBAL_GRID_INTENSITY,
105
- device: ((_g = (_f = adjustments == null ? void 0 : adjustments.gridIntensity) == null ? void 0 : _f.device) == null ? void 0 : _g.value) || import_constants.GLOBAL_GRID_INTENSITY
97
+ device: ((_g = (_f = adjustments == null ? void 0 : adjustments.gridIntensity) == null ? void 0 : _f.device) == null ? void 0 : _g.value) ?? import_constants.GLOBAL_GRID_INTENSITY
106
98
  },
107
- dataReloadRatio: (adjustments == null ? void 0 : adjustments.dataReloadRatio) || 0.02,
108
- firstVisitPercentage: (adjustments == null ? void 0 : adjustments.firstVisitPercentage) || 0.75,
109
- returnVisitPercentage: (adjustments == null ? void 0 : adjustments.returnVisitPercentage) || 0.25
99
+ dataReloadRatio: (adjustments == null ? void 0 : adjustments.dataReloadRatio) ?? 0.02,
100
+ firstVisitPercentage: (adjustments == null ? void 0 : adjustments.firstVisitPercentage) ?? 0.75,
101
+ returnVisitPercentage: (adjustments == null ? void 0 : adjustments.returnVisitPercentage) ?? 0.25
110
102
  }
111
103
  };
112
104
  } else {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/co2.js"],
4
- "sourcesContent": ["\"use strict\";\n\n/**\n * @typedef {Object} CO2EstimateTraceResultPerByte\n * @property {number} co2 - The CO2 estimate in grams/kilowatt-hour\n * @property {boolean} green - Whether the domain is green or not\n * @property {TraceResultVariables} variables - The variables used to calculate the CO2 estimate\n */\n\n/**\n * @typedef {Object} CO2EstimateTraceResultPerVisit\n * @property {number} co2 - The CO2 estimate in grams/kilowatt-hour\n * @property {boolean} green - Whether the domain is green or not\n * @property {TraceResultVariables} variables - The variables used to calculate the CO2 estimate\n */\n\n/**\n * @typedef {Object} TraceResultVariablesPerByte\n * @property {GridIntensityVariables} gridIntensity - The grid intensity related variables\n */\n/**\n * @typedef {Object} TraceResultVariablesPerVisit\n * @property {GridIntensityVariables} gridIntensity - The grid intensity related variables\n * @property {number} dataReloadRatio - What percentage of a page is reloaded on each subsequent page view\n * @property {number} firstVisitPercentage - What percentage of visits are loading this page for subsequent times\n * @property {number} returnVisitPercentage - What percentage of visits are loading this page for the second or more time\n */\n\n/**\n * @typedef {Object} GridIntensityVariables\n * @property {string} description - The description of the variables\n * @property {number} network - The network grid intensity set by the user or the default\n * @property {number} dataCenter - The data center grid intensity set by the user or the default\n * @property {number} device - The device grid intensity set by the user or the default\n * @property {number} production - The production grid intensity set by the user or the default\n */\n\nimport OneByte from \"./1byte.js\";\nimport SustainableWebDesign from \"./sustainable-web-design.js\";\n\nimport {\n GLOBAL_GRID_INTENSITY,\n RENEWABLES_GRID_INTENSITY,\n} from \"./constants/index.js\";\nimport { parseOptions } from \"./helpers/index.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 if (options?.results === \"segment\") {\n this.model.results = {\n segment: true,\n };\n } else {\n this.model.results = {\n segment: false,\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 = false) {\n return this.model.perByte(bytes, green, this.model.results.segment);\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 = false) {\n if (this.model?.perVisit) {\n return this.model.perVisit(bytes, green, this.model.results.segment);\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 /**\n * Accept a figure in bytes for data transfer, a boolean for whether\n * the domain shows as 'green', and an options object.\n * Returns an object containing CO2 figure, green boolean, and object of the variables used in calculating the CO2 figure.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @param {Object} options\n * @return {CO2EstimateTraceResultPerByte} the amount of CO2 in grammes\n */\n perByteTrace(bytes, green = false, options = {}) {\n let adjustments = {};\n if (options) {\n // If there are options, parse them and add them to the model.\n adjustments = parseOptions(options);\n }\n return {\n co2: this.model.perByte(\n bytes,\n green,\n this.model.results.segment,\n adjustments\n ),\n green,\n variables: {\n description:\n \"Below are the variables used to calculate this CO2 estimate.\",\n bytes,\n gridIntensity: {\n description:\n \"The grid intensity (grams per kilowatt-hour) used to calculate this CO2 estimate.\",\n network:\n adjustments?.gridIntensity?.network?.value || GLOBAL_GRID_INTENSITY,\n dataCenter: green\n ? RENEWABLES_GRID_INTENSITY\n : adjustments?.gridIntensity?.dataCenter?.value ||\n GLOBAL_GRID_INTENSITY,\n production: GLOBAL_GRID_INTENSITY,\n device:\n adjustments?.gridIntensity?.device?.value || GLOBAL_GRID_INTENSITY,\n },\n },\n };\n }\n\n /**\n * Accept a figure in bytes for data transfer, a boolean for whether\n * the domain shows as 'green', and an options object.\n * Returns an object containing CO2 figure, green boolean, and object of the variables used in calculating the CO2 figure.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @param {Object} options\n * @return {CO2EstimateTraceResultPerVisit} the amount of CO2 in grammes\n */\n perVisitTrace(bytes, green = false, options = {}) {\n if (this.model?.perVisit) {\n let adjustments = {};\n if (options) {\n // If there are options, parse them and add them to the model.\n adjustments = parseOptions(options);\n }\n\n return {\n co2: this.model.perVisit(\n bytes,\n green,\n this.model.results.segment,\n adjustments\n ),\n green,\n variables: {\n description:\n \"Below are the variables used to calculate this CO2 estimate.\",\n bytes,\n gridIntensity: {\n description:\n \"The grid intensity (grams per kilowatt-hour) used to calculate this CO2 estimate.\",\n network:\n adjustments?.gridIntensity?.network?.value ||\n GLOBAL_GRID_INTENSITY,\n dataCenter: green\n ? RENEWABLES_GRID_INTENSITY\n : adjustments?.gridIntensity?.dataCenter?.value ||\n GLOBAL_GRID_INTENSITY,\n production: GLOBAL_GRID_INTENSITY,\n device:\n adjustments?.gridIntensity?.device?.value ||\n GLOBAL_GRID_INTENSITY,\n },\n dataReloadRatio: adjustments?.dataReloadRatio || 0.02,\n firstVisitPercentage: adjustments?.firstVisitPercentage || 0.75,\n returnVisitPercentage: adjustments?.returnVisitPercentage || 0.25,\n },\n };\n } else {\n throw new Error(\n `The perVisitDetailed() 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"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA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SAAS,SAAS,QAAQ;AACjC,YAAM,SAAS,IAAI,IAAI,MAAM,GAAG,EAAE;AAClC,YAAM,eAAe,MAAM;AAC3B,YAAM,iBAAiB,KAAK,QAC1B,cACA,gBAAgB,aAAa,QAAQ,MAAM,IAAI,EACjD;AACA,gBAAU,KAAK,EAAE,KAAK,MAAM,KAAK,KAAK,gBAAgB,aAAa,CAAC;AAAA,IACtE;AACA,cAAU,KAAK,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG;AAEtC,WAAO,UAAU,MAAM,GAAG,UAAU,SAAS,KAAK,KAAK,UAAU,MAAM;AAAA,EACzE;AAAA,EAEA,SAAS,UAAU,cAAc;AAC/B,QAAI,aAAa;AACjB,QAAI,aAAa;AAEjB,UAAM,kBAAkB,SAAS;AACjC,aAAS,KAAK,OAAO,KAAK,SAAS,OAAO,GAAG;AAC3C,UAAI,CAAC,EAAE,MAAM,eAAe,GAAG;AAC7B,sBAAc,KAAK,QACjB,SAAS,QAAQ,GAAG,cACpB,gBAAgB,aAAa,QAAQ,CAAC,IAAI,EAC5C;AAAA,MACF,OAAO;AACL,sBAAc,KAAK,QACjB,SAAS,QAAQ,GAAG,cACpB,gBAAgB,aAAa,QAAQ,CAAC,IAAI,EAC5C;AAAA,MACF;AAAA,IACF;AACA,WAAO,EAAE,YAAY,WAAW;AAAA,EAClC;AACF;AAGA,IAAO,cAAQ;",
4
+ "sourcesContent": ["\"use strict\";\n\n/**\n * @typedef {Object} CO2EstimateTraceResultPerByte\n * @property {number} co2 - The CO2 estimate in grams/kilowatt-hour\n * @property {boolean} green - Whether the domain is green or not\n * @property {TraceResultVariables} variables - The variables used to calculate the CO2 estimate\n */\n\n/**\n * @typedef {Object} CO2EstimateTraceResultPerVisit\n * @property {number} co2 - The CO2 estimate in grams/kilowatt-hour\n * @property {boolean} green - Whether the domain is green or not\n * @property {TraceResultVariables} variables - The variables used to calculate the CO2 estimate\n */\n\n/**\n * @typedef {Object} TraceResultVariablesPerByte\n * @property {GridIntensityVariables} gridIntensity - The grid intensity related variables\n */\n/**\n * @typedef {Object} TraceResultVariablesPerVisit\n * @property {GridIntensityVariables} gridIntensity - The grid intensity related variables\n * @property {number} dataReloadRatio - What percentage of a page is reloaded on each subsequent page view\n * @property {number} firstVisitPercentage - What percentage of visits are loading this page for subsequent times\n * @property {number} returnVisitPercentage - What percentage of visits are loading this page for the second or more time\n */\n\n/**\n * @typedef {Object} GridIntensityVariables\n * @property {string} description - The description of the variables\n * @property {number} network - The network grid intensity set by the user or the default\n * @property {number} dataCenter - The data center grid intensity set by the user or the default\n * @property {number} device - The device grid intensity set by the user or the default\n * @property {number} production - The production grid intensity set by the user or the default\n */\n\nimport OneByte from \"./1byte.js\";\nimport SustainableWebDesign from \"./sustainable-web-design.js\";\n\nimport {\n GLOBAL_GRID_INTENSITY,\n RENEWABLES_GRID_INTENSITY,\n} from \"./constants/index.js\";\nimport { parseOptions } from \"./helpers/index.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 /** @private */\n this._segment = options?.results === \"segment\";\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 = false) {\n return this.model.perByte(bytes, green, this._segment);\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 = false) {\n if (this.model?.perVisit) {\n return this.model.perVisit(bytes, green, this._segment);\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 /**\n * Accept a figure in bytes for data transfer, a boolean for whether\n * the domain shows as 'green', and an options object.\n * Returns an object containing CO2 figure, green boolean, and object of the variables used in calculating the CO2 figure.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @param {Object} options\n * @return {CO2EstimateTraceResultPerByte} the amount of CO2 in grammes\n */\n perByteTrace(bytes, green = false, options = {}) {\n let adjustments = {};\n if (options) {\n // If there are options, parse them and add them to the model.\n adjustments = parseOptions(options);\n }\n return {\n co2: this.model.perByte(bytes, green, this._segment, adjustments),\n green,\n variables: {\n description:\n \"Below are the variables used to calculate this CO2 estimate.\",\n bytes,\n gridIntensity: {\n description:\n \"The grid intensity (grams per kilowatt-hour) used to calculate this CO2 estimate.\",\n network:\n adjustments?.gridIntensity?.network?.value ?? GLOBAL_GRID_INTENSITY,\n dataCenter: green\n ? RENEWABLES_GRID_INTENSITY\n : adjustments?.gridIntensity?.dataCenter?.value ??\n GLOBAL_GRID_INTENSITY,\n production: GLOBAL_GRID_INTENSITY,\n device:\n adjustments?.gridIntensity?.device?.value ?? GLOBAL_GRID_INTENSITY,\n },\n },\n };\n }\n\n /**\n * Accept a figure in bytes for data transfer, a boolean for whether\n * the domain shows as 'green', and an options object.\n * Returns an object containing CO2 figure, green boolean, and object of the variables used in calculating the CO2 figure.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @param {Object} options\n * @return {CO2EstimateTraceResultPerVisit} the amount of CO2 in grammes\n */\n perVisitTrace(bytes, green = false, options = {}) {\n if (this.model?.perVisit) {\n let adjustments = {};\n if (options) {\n // If there are options, parse them and add them to the model.\n adjustments = parseOptions(options);\n }\n\n return {\n co2: this.model.perVisit(bytes, green, this._segment, adjustments),\n green,\n variables: {\n description:\n \"Below are the variables used to calculate this CO2 estimate.\",\n bytes,\n gridIntensity: {\n description:\n \"The grid intensity (grams per kilowatt-hour) used to calculate this CO2 estimate.\",\n network:\n adjustments?.gridIntensity?.network?.value ??\n GLOBAL_GRID_INTENSITY,\n dataCenter: green\n ? RENEWABLES_GRID_INTENSITY\n : adjustments?.gridIntensity?.dataCenter?.value ??\n GLOBAL_GRID_INTENSITY,\n production: GLOBAL_GRID_INTENSITY,\n device:\n adjustments?.gridIntensity?.device?.value ??\n GLOBAL_GRID_INTENSITY,\n },\n dataReloadRatio: adjustments?.dataReloadRatio ?? 0.02,\n firstVisitPercentage: adjustments?.firstVisitPercentage ?? 0.75,\n returnVisitPercentage: adjustments?.returnVisitPercentage ?? 0.25,\n },\n };\n } else {\n throw new Error(\n `The perVisitDetailed() 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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqCA,kBAAoB;AACpB,oCAAiC;AAEjC,uBAGO;AACP,qBAA6B;AAE7B,MAAM,IAAI;AA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,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG;AAEtC,WAAO,UAAU,MAAM,GAAG,UAAU,SAAS,KAAK,KAAK,UAAU,MAAM;AAAA,EACzE;AAAA,EAEA,SAAS,UAAU,cAAc;AAC/B,QAAI,aAAa;AACjB,QAAI,aAAa;AAEjB,UAAM,kBAAkB,SAAS;AACjC,aAAS,KAAK,OAAO,KAAK,SAAS,OAAO,GAAG;AAC3C,UAAI,CAAC,EAAE,MAAM,eAAe,GAAG;AAC7B,sBAAc,KAAK,QACjB,SAAS,QAAQ,GAAG,cACpB,gBAAgB,aAAa,QAAQ,CAAC,IAAI,EAC5C;AAAA,MACF,OAAO;AACL,sBAAc,KAAK,QACjB,SAAS,QAAQ,GAAG,cACpB,gBAAgB,aAAa,QAAQ,CAAC,IAAI,EAC5C;AAAA,MACF;AAAA,IACF;AACA,WAAO,EAAE,YAAY,WAAW;AAAA,EAClC;AACF;AAGA,IAAO,cAAQ;",
6
6
  "names": []
7
7
  }
@@ -22,7 +22,7 @@ __export(average_intensities_min_exports, {
22
22
  type: () => type
23
23
  });
24
24
  module.exports = __toCommonJS(average_intensities_min_exports);
25
- const data = { "AFG": 120.482, "AFRICA": 491.69, "ALB": 23.438, "DZA": 498.904, "ASM": 687.5, "AGO": 195.983, "ATG": 657.143, "ARG": 338.275, "ARM": 222.678, "ABW": 591.398, "ASIA": 532.12, "AUS": 503.179, "AUT": 157.52, "AZE": 532.902, "BHS": 698.113, "BHR": 489.77, "BGD": 577.027, "BRB": 644.86, "BLR": 415.641, "BEL": 165.363, "BLZ": 484.375, "BEN": 666.667, "BTN": 24.444, "BOL": 323.869, "BIH": 517.241, "BWA": 794.521, "BRA": 101.986, "BRN": 658.849, "BGR": 399.565, "BFA": 611.429, "BDI": 250, "CPV": 600, "KHM": 400.46, "CMR": 278.261, "CAN": 127.816, "CYM": 684.932, "CAF": 0, "TCD": 677.419, "CHL": 332.612, "CHN": 531.151, "COL": 168.954, "COM": 714.286, "COG": 395.522, "COD": 25.362, "COK": 400, "CRI": 37.213, "CIV": 410.747, "HRV": 246.459, "CUB": 602.025, "CYP": 589.354, "CZE": 415.345, "DNK": 180.709, "DJI": 666.667, "DMA": 529.412, "DOM": 550.881, "ECU": 188.708, "EGY": 485.367, "SLV": 194.226, "GNQ": 492.958, "ERI": 688.889, "EST": 464.029, "SWZ": 189.189, "ETH": 25.187, "EU": 277.37, "EUROPE": 298.02, "FLK": 500, "FRO": 428.571, "FJI": 289.474, "FIN": 130.977, "FRA": 84.817, "GUF": 254.717, "PYF": 471.429, "G20": 440.49, "G7": 341.12, "GAB": 397.38, "GMB": 700, "GEO": 134.831, "DEU": 385.467, "GHA": 361.204, "GRC": 343.822, "GRL": 133.333, "GRD": 714.286, "GLP": 611.765, "GUM": 670.33, "GTM": 320.637, "GIN": 208.633, "GNB": 750, "GUY": 642.276, "HTI": 606.061, "HND": 375.104, "HKG": 683.972, "HUN": 222.973, "ISL": 28.557, "IND": 632.406, "IDN": 618.996, "IRN": 493.595, "IRQ": 498.869, "IRL": 345.347, "ISR": 548.03, "ITA": 371.692, "JAM": 519.54, "JPN": 482.87, "JOR": 399.909, "KAZ": 635.574, "KEN": 100.568, "KIR": 666.667, "XKX": 768.733, "KWT": 489.61, "KGZ": 104.426, "LAO": 242.182, "LATIN AMERICA AND CARIBBEAN": 240.38, "LVA": 181.818, "LBN": 594.752, "LSO": 20, "LBR": 304.348, "LBY": 550.421, "LTU": 194.245, "LUX": 168.142, "MAC": 491.525, "MDG": 483.254, "MWI": 133.803, "MYS": 543.737, "MDV": 651.515, "MLI": 466.077, "MLT": 495, "MTQ": 698.63, "MRT": 526.596, "MUS": 611.111, "MEX": 421.402, "MIDDLE EAST": 515.47, "MDA": 678.439, "MNG": 749.656, "MNE": 399.381, "MSR": 1e3, "MAR": 610.412, "MOZ": 126.633, "MMR": 344.365, "NAM": 63.694, "NRU": 750, "NPL": 24.51, "NLD": 354.988, "NCL": 610.119, "NZL": 97.732, "NIC": 354.212, "NER": 622.222, "NGA": 368.224, "NORTH AMERICA": 336.26, "PRK": 157.785, "MKD": 529.328, "NOR": 28.818, "OCEANIA": 446.55, "OECD": 338.65, "OMN": 488.272, "PAK": 344.155, "PSE": 465.116, "PAN": 192.136, "PNG": 526.749, "PRY": 25.487, "PER": 256.512, "POL": 634.579, "PRT": 234.029, "PRI": 681.469, "QAT": 489.76, "REU": 519.031, "ROU": 264.121, "RUS": 367.189, "RWA": 294.118, "KNA": 681.818, "LCA": 685.714, "SPM": 800, "VCT": 500, "WSM": 470.588, "STP": 600, "SAU": 571.336, "SEN": 523.132, "SRB": 569.375, "SYC": 615.385, "SLE": 47.619, "SGP": 488.775, "SVK": 140.666, "SVN": 237.378, "SLB": 727.273, "SOM": 634.146, "ZAF": 708.989, "KOR": 435.689, "SSD": 684.211, "ESP": 217.373, "LKA": 462.997, "SDN": 264.014, "SUR": 356.436, "SWE": 45.084, "CHE": 45.622, "SYR": 541.169, "TWN": 561, "TJK": 83.629, "TZA": 366.748, "THA": 502.305, "PHL": 582.047, "TGO": 460.317, "TON": 625, "TTO": 491.409, "TUN": 469.428, "TUR": 413.628, "TKM": 490.187, "TCA": 703.704, "UGA": 52.273, "UKR": 206.539, "ARE": 461.845, "GBR": 257.379, "USA": 367.259, "URY": 114.81, "UZB": 505.405, "VUT": 571.429, "VEN": 212.476, "VNM": 376.828, "VGB": 714.286, "VIR": 685.714, "WORLD": 436.33, "YEM": 543.909, "ZMB": 84.698, "ZWE": 392.279 };
25
+ const data = { "AFG": 120.48, "AFRICA": 484.7, "ALB": 23.44, "DZA": 485.49, "ASM": 687.5, "AGO": 195.98, "ATG": 657.14, "ARG": 344.31, "ARM": 222.68, "ABW": 591.4, "ASEAN": 508.2, "ASIA": 534.89, "AUS": 501.7, "AUT": 158.22, "AZE": 469.58, "BHS": 698.11, "BHR": 494.02, "BGD": 574.28, "BRB": 644.86, "BLR": 425.9, "BEL": 167.11, "BLZ": 484.38, "BEN": 666.67, "BTN": 24.44, "BOL": 335.4, "BIH": 553.47, "BWA": 794.52, "BRA": 102.04, "BRN": 493.59, "BGR": 399.72, "BFA": 611.43, "BDI": 250, "CPV": 600, "KHM": 400.46, "CMR": 278.26, "CAN": 125.84, "CYM": 684.93, "CAF": 0, "TCD": 677.42, "CHL": 332.61, "CHN": 533.98, "COL": 163.99, "COM": 714.29, "COG": 395.52, "COD": 25.36, "COK": 400, "CRI": 37.21, "CIV": 410.75, "HRV": 246.29, "CUB": 654.68, "CYP": 589.35, "CZE": 414.8, "DNK": 180.42, "DJI": 666.67, "DMA": 529.41, "DOM": 549.8, "ECU": 183.63, "EGY": 469.63, "SLV": 194.23, "GNQ": 492.96, "ERI": 688.89, "EST": 460.26, "SWZ": 189.19, "ETH": 25.19, "EU": 276.63, "EUROPE": 297.05, "FLK": 500, "FRO": 428.57, "FJI": 289.47, "FIN": 131.71, "FRA": 84.88, "GUF": 254.72, "PYF": 471.43, "G20": 442.57, "G7": 344.31, "GAB": 397.38, "GMB": 700, "GEO": 134.83, "DEU": 385.39, "GHA": 361.2, "GRC": 344.41, "GRL": 133.33, "GRD": 714.29, "GLP": 623.53, "GUM": 670.33, "GTM": 304.71, "GIN": 208.63, "GNB": 750, "GUY": 642.28, "HTI": 606.06, "HND": 373.96, "HKG": 609.93, "HUN": 222.1, "ISL": 28.56, "IND": 633.4, "IDN": 619.03, "IRN": 487.86, "IRQ": 531.36, "IRL": 346.43, "ISR": 537.57, "ITA": 372.63, "JAM": 537.93, "JPN": 494.86, "JOR": 391.13, "KAZ": 635.57, "KEN": 101.13, "KIR": 666.67, "XKX": 767, "KWT": 574.56, "KGZ": 104.43, "LAO": 242.18, "LATIN AMERICA AND CARIBBEAN": 237.91, "LVA": 183.43, "LBN": 663.1, "LSO": 20, "LBR": 304.35, "LBY": 558.85, "LTU": 195.7, "LUX": 162.6, "MAC": 491.53, "MDG": 483.25, "MWI": 133.8, "MYS": 543.87, "MDV": 651.52, "MLI": 463.13, "MLT": 433.48, "MTQ": 698.63, "MRT": 526.6, "MUS": 611.11, "MEX": 423.81, "MIDDLE EAST": 519.92, "MDA": 666.67, "MNG": 749.66, "MNE": 392.75, "MSR": 1e3, "MAR": 630.75, "MOZ": 126.63, "MMR": 330.8, "NAM": 63.69, "NRU": 750, "NPL": 24.51, "NLD": 354.31, "NCL": 610.12, "NZL": 105.22, "NIC": 354.21, "NER": 622.22, "NGA": 368.11, "NORTH AMERICA": 336.68, "PRK": 102.42, "MKD": 543.71, "NOR": 28.93, "OCEANIA": 450.73, "OECD": 341.08, "OMN": 488.27, "PAK": 344.16, "PSE": 465.12, "PAN": 152.68, "PNG": 526.75, "PRY": 25.49, "PER": 256.51, "POL": 633.23, "PRT": 234.61, "PRI": 612.39, "QAT": 490.28, "REU": 519.03, "ROU": 264.24, "RUS": 363.68, "RWA": 294.12, "KNA": 681.82, "LCA": 685.71, "SPM": 800, "VCT": 500, "WSM": 470.59, "STP": 600, "SAU": 557.78, "SEN": 523.13, "SRB": 582.13, "SYC": 615.39, "SLE": 47.62, "SGP": 488.78, "SVK": 140.14, "SVN": 237.38, "SLB": 727.27, "SOM": 634.15, "ZAF": 708.21, "KOR": 437.6, "SSD": 684.21, "ESP": 217.42, "LKA": 501.53, "SDN": 288.13, "SUR": 356.44, "SWE": 45.12, "CHE": 41.28, "SYR": 541.17, "TWN": 560.98, "TJK": 83.63, "TZA": 366.75, "THA": 501.57, "PHL": 594.45, "TGO": 460.32, "TON": 625, "TTO": 491.41, "TUN": 469.43, "TUR": 413.6, "TKM": 490.19, "TCA": 703.7, "UGA": 52.27, "UKR": 232.74, "ARE": 407.98, "GBR": 261.16, "USA": 368.1, "URY": 150.13, "UZB": 505.41, "VUT": 571.43, "VEN": 212.48, "VNM": 386.49, "VGB": 714.29, "VIR": 685.71, "WORLD": 437.66, "YEM": 559.66, "ZMB": 84.7, "ZWE": 392.28 };
26
26
  const type = "average";
27
27
  var average_intensities_min_default = { data, type };
28
28
  //# sourceMappingURL=average-intensities.min.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/data/average-intensities.min.js"],
4
- "sourcesContent": ["const data = {\"AFG\":120.482,\"AFRICA\":491.69,\"ALB\":23.438,\"DZA\":498.904,\"ASM\":687.5,\"AGO\":195.983,\"ATG\":657.143,\"ARG\":338.275,\"ARM\":222.678,\"ABW\":591.398,\"ASIA\":532.12,\"AUS\":503.179,\"AUT\":157.52,\"AZE\":532.902,\"BHS\":698.113,\"BHR\":489.77,\"BGD\":577.027,\"BRB\":644.86,\"BLR\":415.641,\"BEL\":165.363,\"BLZ\":484.375,\"BEN\":666.667,\"BTN\":24.444,\"BOL\":323.869,\"BIH\":517.241,\"BWA\":794.521,\"BRA\":101.986,\"BRN\":658.849,\"BGR\":399.565,\"BFA\":611.429,\"BDI\":250,\"CPV\":600,\"KHM\":400.46,\"CMR\":278.261,\"CAN\":127.816,\"CYM\":684.932,\"CAF\":0,\"TCD\":677.419,\"CHL\":332.612,\"CHN\":531.151,\"COL\":168.954,\"COM\":714.286,\"COG\":395.522,\"COD\":25.362,\"COK\":400,\"CRI\":37.213,\"CIV\":410.747,\"HRV\":246.459,\"CUB\":602.025,\"CYP\":589.354,\"CZE\":415.345,\"DNK\":180.709,\"DJI\":666.667,\"DMA\":529.412,\"DOM\":550.881,\"ECU\":188.708,\"EGY\":485.367,\"SLV\":194.226,\"GNQ\":492.958,\"ERI\":688.889,\"EST\":464.029,\"SWZ\":189.189,\"ETH\":25.187,\"EU\":277.37,\"EUROPE\":298.02,\"FLK\":500,\"FRO\":428.571,\"FJI\":289.474,\"FIN\":130.977,\"FRA\":84.817,\"GUF\":254.717,\"PYF\":471.429,\"G20\":440.49,\"G7\":341.12,\"GAB\":397.38,\"GMB\":700,\"GEO\":134.831,\"DEU\":385.467,\"GHA\":361.204,\"GRC\":343.822,\"GRL\":133.333,\"GRD\":714.286,\"GLP\":611.765,\"GUM\":670.33,\"GTM\":320.637,\"GIN\":208.633,\"GNB\":750,\"GUY\":642.276,\"HTI\":606.061,\"HND\":375.104,\"HKG\":683.972,\"HUN\":222.973,\"ISL\":28.557,\"IND\":632.406,\"IDN\":618.996,\"IRN\":493.595,\"IRQ\":498.869,\"IRL\":345.347,\"ISR\":548.03,\"ITA\":371.692,\"JAM\":519.54,\"JPN\":482.87,\"JOR\":399.909,\"KAZ\":635.574,\"KEN\":100.568,\"KIR\":666.667,\"XKX\":768.733,\"KWT\":489.61,\"KGZ\":104.426,\"LAO\":242.182,\"LATIN AMERICA AND CARIBBEAN\":240.38,\"LVA\":181.818,\"LBN\":594.752,\"LSO\":20,\"LBR\":304.348,\"LBY\":550.421,\"LTU\":194.245,\"LUX\":168.142,\"MAC\":491.525,\"MDG\":483.254,\"MWI\":133.803,\"MYS\":543.737,\"MDV\":651.515,\"MLI\":466.077,\"MLT\":495,\"MTQ\":698.63,\"MRT\":526.596,\"MUS\":611.111,\"MEX\":421.402,\"MIDDLE EAST\":515.47,\"MDA\":678.439,\"MNG\":749.656,\"MNE\":399.381,\"MSR\":1000,\"MAR\":610.412,\"MOZ\":126.633,\"MMR\":344.365,\"NAM\":63.694,\"NRU\":750,\"NPL\":24.51,\"NLD\":354.988,\"NCL\":610.119,\"NZL\":97.732,\"NIC\":354.212,\"NER\":622.222,\"NGA\":368.224,\"NORTH AMERICA\":336.26,\"PRK\":157.785,\"MKD\":529.328,\"NOR\":28.818,\"OCEANIA\":446.55,\"OECD\":338.65,\"OMN\":488.272,\"PAK\":344.155,\"PSE\":465.116,\"PAN\":192.136,\"PNG\":526.749,\"PRY\":25.487,\"PER\":256.512,\"POL\":634.579,\"PRT\":234.029,\"PRI\":681.469,\"QAT\":489.76,\"REU\":519.031,\"ROU\":264.121,\"RUS\":367.189,\"RWA\":294.118,\"KNA\":681.818,\"LCA\":685.714,\"SPM\":800,\"VCT\":500,\"WSM\":470.588,\"STP\":600,\"SAU\":571.336,\"SEN\":523.132,\"SRB\":569.375,\"SYC\":615.385,\"SLE\":47.619,\"SGP\":488.775,\"SVK\":140.666,\"SVN\":237.378,\"SLB\":727.273,\"SOM\":634.146,\"ZAF\":708.989,\"KOR\":435.689,\"SSD\":684.211,\"ESP\":217.373,\"LKA\":462.997,\"SDN\":264.014,\"SUR\":356.436,\"SWE\":45.084,\"CHE\":45.622,\"SYR\":541.169,\"TWN\":561,\"TJK\":83.629,\"TZA\":366.748,\"THA\":502.305,\"PHL\":582.047,\"TGO\":460.317,\"TON\":625,\"TTO\":491.409,\"TUN\":469.428,\"TUR\":413.628,\"TKM\":490.187,\"TCA\":703.704,\"UGA\":52.273,\"UKR\":206.539,\"ARE\":461.845,\"GBR\":257.379,\"USA\":367.259,\"URY\":114.81,\"UZB\":505.405,\"VUT\":571.429,\"VEN\":212.476,\"VNM\":376.828,\"VGB\":714.286,\"VIR\":685.714,\"WORLD\":436.33,\"YEM\":543.909,\"ZMB\":84.698,\"ZWE\":392.279}; const type = \"average\"; export { data, type }; export default { data, type };"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,OAAO,EAAC,OAAM,SAAQ,UAAS,QAAO,OAAM,QAAO,OAAM,SAAQ,OAAM,OAAM,OAAM,SAAQ,OAAM,SAAQ,OAAM,SAAQ,OAAM,SAAQ,OAAM,SAAQ,QAAO,QAAO,OAAM,SAAQ,OAAM,QAAO,OAAM,SAAQ,OAAM,SAAQ,OAAM,QAAO,OAAM,SAAQ,OAAM,QAAO,OAAM,SAAQ,OAAM,SAAQ,OAAM,SAAQ,OAAM,SAAQ,OAAM,QAAO,OAAM,SAAQ,OAAM,SAAQ,OAAM,SAAQ,OAAM,SAAQ,OAAM,SAAQ,OAAM,SAAQ,OAAM,SAAQ,OAAM,KAAI,OAAM,KAAI,OAAM,QAAO,OAAM,SAAQ,OAAM,SAAQ,OAAM,SAAQ,OAAM,GAAE,OAAM,SAAQ,OAAM,SAAQ,OAAM,SAAQ,OAAM,SAAQ,OAAM,SAAQ,OAAM,SAAQ,OAAM,QAA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":657.14,\"ARG\":344.31,\"ARM\":222.68,\"ABW\":591.4,\"ASEAN\":508.2,\"ASIA\":534.89,\"AUS\":501.7,\"AUT\":158.22,\"AZE\":469.58,\"BHS\":698.11,\"BHR\":494.02,\"BGD\":574.28,\"BRB\":644.86,\"BLR\":425.9,\"BEL\":167.11,\"BLZ\":484.38,\"BEN\":666.67,\"BTN\":24.44,\"BOL\":335.4,\"BIH\":553.47,\"BWA\":794.52,\"BRA\":102.04,\"BRN\":493.59,\"BGR\":399.72,\"BFA\":611.43,\"BDI\":250,\"CPV\":600,\"KHM\":400.46,\"CMR\":278.26,\"CAN\":125.84,\"CYM\":684.93,\"CAF\":0,\"TCD\":677.42,\"CHL\":332.61,\"CHN\":533.98,\"COL\":163.99,\"COM\":714.29,\"COG\":395.52,\"COD\":25.36,\"COK\":400,\"CRI\":37.21,\"CIV\":410.75,\"HRV\":246.29,\"CUB\":654.68,\"CYP\":589.35,\"CZE\":414.8,\"DNK\":180.42,\"DJI\":666.67,\"DMA\":529.41,\"DOM\":549.8,\"ECU\":183.63,\"EGY\":469.63,\"SLV\":194.23,\"GNQ\":492.96,\"ERI\":688.89,\"EST\":460.26,\"SWZ\":189.19,\"ETH\":25.19,\"EU\":276.63,\"EUROPE\":297.05,\"FLK\":500,\"FRO\":428.57,\"FJI\":289.47,\"FIN\":131.71,\"FRA\":84.88,\"GUF\":254.72,\"PYF\":471.43,\"G20\":442.57,\"G7\":344.31,\"GAB\":397.38,\"GMB\":700,\"GEO\":134.83,\"DEU\":385.39,\"GHA\":361.2,\"GRC\":344.41,\"GRL\":133.33,\"GRD\":714.29,\"GLP\":623.53,\"GUM\":670.33,\"GTM\":304.71,\"GIN\":208.63,\"GNB\":750,\"GUY\":642.28,\"HTI\":606.06,\"HND\":373.96,\"HKG\":609.93,\"HUN\":222.1,\"ISL\":28.56,\"IND\":633.4,\"IDN\":619.03,\"IRN\":487.86,\"IRQ\":531.36,\"IRL\":346.43,\"ISR\":537.57,\"ITA\":372.63,\"JAM\":537.93,\"JPN\":494.86,\"JOR\":391.13,\"KAZ\":635.57,\"KEN\":101.13,\"KIR\":666.67,\"XKX\":767,\"KWT\":574.56,\"KGZ\":104.43,\"LAO\":242.18,\"LATIN AMERICA AND CARIBBEAN\":237.91,\"LVA\":183.43,\"LBN\":663.1,\"LSO\":20,\"LBR\":304.35,\"LBY\":558.85,\"LTU\":195.7,\"LUX\":162.6,\"MAC\":491.53,\"MDG\":483.25,\"MWI\":133.8,\"MYS\":543.87,\"MDV\":651.52,\"MLI\":463.13,\"MLT\":433.48,\"MTQ\":698.63,\"MRT\":526.6,\"MUS\":611.11,\"MEX\":423.81,\"MIDDLE EAST\":519.92,\"MDA\":666.67,\"MNG\":749.66,\"MNE\":392.75,\"MSR\":1000,\"MAR\":630.75,\"MOZ\":126.63,\"MMR\":330.8,\"NAM\":63.69,\"NRU\":750,\"NPL\":24.51,\"NLD\":354.31,\"NCL\":610.12,\"NZL\":105.22,\"NIC\":354.21,\"NER\":622.22,\"NGA\":368.11,\"NORTH AMERICA\":336.68,\"PRK\":102.42,\"MKD\":543.71,\"NOR\":28.93,\"OCEANIA\":450.73,\"OECD\":341.08,\"OMN\":488.27,\"PAK\":344.16,\"PSE\":465.12,\"PAN\":152.68,\"PNG\":526.75,\"PRY\":25.49,\"PER\":256.51,\"POL\":633.23,\"PRT\":234.61,\"PRI\":612.39,\"QAT\":490.28,\"REU\":519.03,\"ROU\":264.24,\"RUS\":363.68,\"RWA\":294.12,\"KNA\":681.82,\"LCA\":685.71,\"SPM\":800,\"VCT\":500,\"WSM\":470.59,\"STP\":600,\"SAU\":557.78,\"SEN\":523.13,\"SRB\":582.13,\"SYC\":615.39,\"SLE\":47.62,\"SGP\":488.78,\"SVK\":140.14,\"SVN\":237.38,\"SLB\":727.27,\"SOM\":634.15,\"ZAF\":708.21,\"KOR\":437.6,\"SSD\":684.21,\"ESP\":217.42,\"LKA\":501.53,\"SDN\":288.13,\"SUR\":356.44,\"SWE\":45.12,\"CHE\":41.28,\"SYR\":541.17,\"TWN\":560.98,\"TJK\":83.63,\"TZA\":366.75,\"THA\":501.57,\"PHL\":594.45,\"TGO\":460.32,\"TON\":625,\"TTO\":491.41,\"TUN\":469.43,\"TUR\":413.6,\"TKM\":490.19,\"TCA\":703.7,\"UGA\":52.27,\"UKR\":232.74,\"ARE\":407.98,\"GBR\":261.16,\"USA\":368.1,\"URY\":150.13,\"UZB\":505.41,\"VUT\":571.43,\"VEN\":212.48,\"VNM\":386.49,\"VGB\":714.29,\"VIR\":685.71,\"WORLD\":437.66,\"YEM\":559.66,\"ZMB\":84.7,\"ZWE\":392.28}; const type = \"average\"; export { data, type }; export default { data, type };"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,OAAO,EAAC,OAAM,QAAO,UAAS,OAAM,OAAM,OAAM,OAAM,QAAO,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,OAAM,SAAQ,OAAM,QAAO,QAAO,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,OAAM,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,KAAI,OAAM,KAAI,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,GAAE,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,OAAM,OAAM,KAAI,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAA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M,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,KAAI,OAAM,KAAI,OAAM,QAAO,OAAM,KAAI,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,OAAM,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,KAAI,OAAM,QAAO,OAAM,QAAO,OAAM,OAAM,OAAM,QAAO,OAAM,OAAM,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,SAAQ,QAAO,OAAM,QAAO,OAAM,MAAK,OAAM,OAAM;AAAG,MAAM,OAAO;AAAkC,IAAO,kCAAQ,EAAE,MAAM,KAAK;",
6
6
  "names": []
7
7
  }
@@ -33,7 +33,7 @@ function parseOptions(options) {
33
33
  if (options == null ? void 0 : options.gridIntensity) {
34
34
  adjustments.gridIntensity = {};
35
35
  const { device, dataCenter, network } = options.gridIntensity;
36
- if (device) {
36
+ if (device || device === 0) {
37
37
  if (typeof device === "object") {
38
38
  if (!import__.averageIntensity.data[(_a = device.country) == null ? void 0 : _a.toUpperCase()]) {
39
39
  console.warn(`"${device.country}" is not a valid country. Please use a valid 3 digit ISO 3166 country code.
@@ -59,7 +59,7 @@ Falling back to global average grid intensity.`);
59
59
  Falling back to global average grid intensity.`);
60
60
  }
61
61
  }
62
- if (dataCenter) {
62
+ if (dataCenter || dataCenter === 0) {
63
63
  if (typeof dataCenter === "object") {
64
64
  if (!import__.averageIntensity.data[(_c = dataCenter.country) == null ? void 0 : _c.toUpperCase()]) {
65
65
  console.warn(`"${dataCenter.country}" is not a valid country. Please use a valid 3 digit ISO 3166 country code.
@@ -85,7 +85,7 @@ Falling back to global average grid intensity.`);
85
85
  Falling back to global average grid intensity.`);
86
86
  }
87
87
  }
88
- if (network) {
88
+ if (network || network === 0) {
89
89
  if (typeof network === "object") {
90
90
  if (!import__.averageIntensity.data[(_e = network.country) == null ? void 0 : _e.toUpperCase()]) {
91
91
  console.warn(`"${network.country}" is not a valid country. Please use a valid 3 digit ISO 3166 country code.
@@ -112,7 +112,7 @@ Falling back to global average grid intensity.`);
112
112
  }
113
113
  }
114
114
  }
115
- if (options == null ? void 0 : options.dataReloadRatio) {
115
+ if ((options == null ? void 0 : options.dataReloadRatio) || options.dataReloadRatio === 0) {
116
116
  if (typeof options.dataReloadRatio === "number") {
117
117
  if (options.dataReloadRatio >= 0 && options.dataReloadRatio <= 1) {
118
118
  adjustments.dataReloadRatio = options.dataReloadRatio;
@@ -127,7 +127,7 @@ Falling back to default value.`);
127
127
  Falling back to default value.`);
128
128
  }
129
129
  }
130
- if (options == null ? void 0 : options.firstVisitPercentage) {
130
+ if ((options == null ? void 0 : options.firstVisitPercentage) || options.firstVisitPercentage === 0) {
131
131
  if (typeof options.firstVisitPercentage === "number") {
132
132
  if (options.firstVisitPercentage >= 0 && options.firstVisitPercentage <= 1) {
133
133
  adjustments.firstVisitPercentage = options.firstVisitPercentage;
@@ -142,7 +142,7 @@ Falling back to default value.`);
142
142
  Falling back to default value.`);
143
143
  }
144
144
  }
145
- if (options == null ? void 0 : options.returnVisitPercentage) {
145
+ if ((options == null ? void 0 : options.returnVisitPercentage) || options.returnVisitPercentage === 0) {
146
146
  if (typeof options.returnVisitPercentage === "number") {
147
147
  if (options.returnVisitPercentage >= 0 && options.returnVisitPercentage <= 1) {
148
148
  adjustments.returnVisitPercentage = options.returnVisitPercentage;