@tgwf/co2 0.12.0 → 0.12.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.
|
@@ -30,12 +30,10 @@ __export(constants_exports, {
|
|
|
30
30
|
PRODUCTION_ENERGY: () => PRODUCTION_ENERGY,
|
|
31
31
|
RENEWABLES_GRID_INTENSITY: () => RENEWABLES_GRID_INTENSITY,
|
|
32
32
|
RETURNING_VISITOR_PERCENTAGE: () => RETURNING_VISITOR_PERCENTAGE,
|
|
33
|
-
fileSize: () => import_file_size.default
|
|
34
|
-
testConstants: () => import_test_constants.default
|
|
33
|
+
fileSize: () => import_file_size.default
|
|
35
34
|
});
|
|
36
35
|
module.exports = __toCommonJS(constants_exports);
|
|
37
36
|
var import_file_size = __toESM(require("./file-size.js"));
|
|
38
|
-
var import_test_constants = __toESM(require("./test-constants.js"));
|
|
39
37
|
const KWH_PER_GB = 0.81;
|
|
40
38
|
const END_USER_DEVICE_ENERGY = 0.52;
|
|
41
39
|
const NETWORK_ENERGY = 0.14;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/constants/index.js"],
|
|
4
|
-
"sourcesContent": ["import fileSize from \"./file-size.js\";\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
4
|
+
"sourcesContent": ["import fileSize from \"./file-size.js\";\n\n// SUSTAINABLE WEB DESIGN CONSTANTS\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_GRID_INTENSITY = 442;\nconst RENEWABLES_GRID_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\nexport {\n fileSize,\n KWH_PER_GB,\n END_USER_DEVICE_ENERGY,\n NETWORK_ENERGY,\n DATACENTER_ENERGY,\n PRODUCTION_ENERGY,\n GLOBAL_GRID_INTENSITY,\n RENEWABLES_GRID_INTENSITY,\n FIRST_TIME_VIEWING_PERCENTAGE,\n RETURNING_VISITOR_PERCENTAGE,\n PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD,\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAqB;AAKrB,MAAM,aAAa;AAInB,MAAM,yBAAyB;AAC/B,MAAM,iBAAiB;AACvB,MAAM,oBAAoB;AAC1B,MAAM,oBAAoB;AAI1B,MAAM,wBAAwB;AAC9B,MAAM,4BAA4B;AAIlC,MAAM,gCAAgC;AACtC,MAAM,+BAA+B;AACrC,MAAM,+CAA+C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import fileSize from "./file-size.js";
|
|
2
|
-
import testConstants from "./test-constants.js";
|
|
3
2
|
const KWH_PER_GB = 0.81;
|
|
4
3
|
const END_USER_DEVICE_ENERGY = 0.52;
|
|
5
4
|
const NETWORK_ENERGY = 0.14;
|
|
@@ -21,6 +20,5 @@ export {
|
|
|
21
20
|
PRODUCTION_ENERGY,
|
|
22
21
|
RENEWABLES_GRID_INTENSITY,
|
|
23
22
|
RETURNING_VISITOR_PERCENTAGE,
|
|
24
|
-
fileSize
|
|
25
|
-
testConstants
|
|
23
|
+
fileSize
|
|
26
24
|
};
|
package/dist/iife/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var co2=(()=>{var
|
|
1
|
+
var co2=(()=>{var Ee=Object.create;var v=Object.defineProperty;var ye=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var pe=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var D=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),he=(r,e)=>{for(var t in e)v(r,t,{get:e[t],enumerable:!0})},ee=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of me(e))!Re.call(r,n)&&n!==t&&v(r,n,{get:()=>e[n],enumerable:!(o=ye(e,n))||o.enumerable});return r};var L=(r,e,t)=>(t=r!=null?Ee(pe(r)):{},ee(e||!r||!r.__esModule?v(t,"default",{value:r,enumerable:!0}):t,r)),Ie=r=>ee(v({},"__esModule",{value:!0}),r);var ne=D((Je,re)=>{var h=1e3,I=h*60,N=I*60,R=N*24,Ne=R*7,be=R*365.25;re.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return Ae(r);if(t==="number"&&isFinite(r))return e.long?Fe(r):Te(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function Ae(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\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(!!e){var t=parseFloat(e[1]),o=(e[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return t*be;case"weeks":case"week":case"w":return t*Ne;case"days":case"day":case"d":return t*R;case"hours":case"hour":case"hrs":case"hr":case"h":return t*N;case"minutes":case"minute":case"mins":case"min":case"m":return t*I;case"seconds":case"second":case"secs":case"sec":case"s":return t*h;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Te(r){var e=Math.abs(r);return e>=R?Math.round(r/R)+"d":e>=N?Math.round(r/N)+"h":e>=I?Math.round(r/I)+"m":e>=h?Math.round(r/h)+"s":r+"ms"}function Fe(r){var e=Math.abs(r);return e>=R?w(r,e,R,"day"):e>=N?w(r,e,N,"hour"):e>=I?w(r,e,I,"minute"):e>=h?w(r,e,h,"second"):r+" ms"}function w(r,e,t,o){var n=e>=t*1.5;return Math.round(r/t)+" "+o+(n?"s":"")}});var se=D((qe,oe)=>{function Oe(r){t.debug=t,t.default=t,t.coerce=C,t.disable=i,t.enable=n,t.enabled=a,t.humanize=ne(),t.destroy=l,Object.keys(r).forEach(s=>{t[s]=r[s]}),t.names=[],t.skips=[],t.formatters={};function e(s){let c=0;for(let d=0;d<s.length;d++)c=(c<<5)-c+s.charCodeAt(d),c|=0;return t.colors[Math.abs(c)%t.colors.length]}t.selectColor=e;function t(s){let c,d=null,_,Q;function y(...E){if(!y.enabled)return;let p=y,P=Number(new Date),fe=P-(c||P);p.diff=fe,p.prev=c,p.curr=P,c=P,E[0]=t.coerce(E[0]),typeof E[0]!="string"&&E.unshift("%O");let S=0;E[0]=E[0].replace(/%([a-zA-Z%])/g,(V,Ce)=>{if(V==="%%")return"%";S++;let X=t.formatters[Ce];if(typeof X=="function"){let ge=E[S];V=X.call(p,ge),E.splice(S,1),S--}return V}),t.formatArgs.call(p,E),(p.log||t.log).apply(p,E)}return y.namespace=s,y.useColors=t.useColors(),y.color=t.selectColor(s),y.extend=o,y.destroy=t.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(_!==t.namespaces&&(_=t.namespaces,Q=t.enabled(s)),Q),set:E=>{d=E}}),typeof t.init=="function"&&t.init(y),y}function o(s,c){let d=t(this.namespace+(typeof c>"u"?":":c)+s);return d.log=this.log,d}function n(s){t.save(s),t.namespaces=s,t.names=[],t.skips=[];let c,d=(typeof s=="string"?s:"").split(/[\s,]+/),_=d.length;for(c=0;c<_;c++)!d[c]||(s=d[c].replace(/\*/g,".*?"),s[0]==="-"?t.skips.push(new RegExp("^"+s.slice(1)+"$")):t.names.push(new RegExp("^"+s+"$")))}function i(){let s=[...t.names.map(f),...t.skips.map(f).map(c=>"-"+c)].join(",");return t.enable(""),s}function a(s){if(s[s.length-1]==="*")return!0;let c,d;for(c=0,d=t.skips.length;c<d;c++)if(t.skips[c].test(s))return!1;for(c=0,d=t.names.length;c<d;c++)if(t.names[c].test(s))return!0;return!1}function f(s){return s.toString().substring(2,s.toString().length-2).replace(/\.\*\?$/,"*")}function C(s){return s instanceof Error?s.stack||s.message:s}function l(){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 t.enable(t.load()),t}oe.exports=Oe});var G=D((g,B)=>{g.formatArgs=Pe;g.save=Se;g.load=ve;g.useColors=_e;g.storage=we();g.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`."))}})();g.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 _e(){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 Pe(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+B.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,o=0;r[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(t++,n==="%c"&&(o=t))}),r.splice(o,0,e)}g.log=console.debug||console.log||(()=>{});function Se(r){try{r?g.storage.setItem("debug",r):g.storage.removeItem("debug")}catch{}}function ve(){let r;try{r=g.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function we(){try{return localStorage}catch{}}B.exports=se()(g);var{formatters:Be}=B.exports;Be.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var je={};he(je,{averageIntensity:()=>m,co2:()=>z,default:()=>He,hosting:()=>J,marginalIntensity:()=>q});var M=4883333333333333e-25;var U=class{constructor(e){this.options=e,this.KWH_PER_BYTE_FOR_NETWORK=M}perByte(e,t){if(e<1)return 0;if(t){let n=e*72e-12*0,i=e*M*475;return n+i}let o=72e-12+M;return e*o*519}};var te=U;var ce=L(G());var k={GIGABYTE:1e9};var ie=.81,K=.52,W=.14,Y=.15,x=.19,u=442,A=50,T=.75,F=.25,O=.02;var b=r=>parseFloat(r.toFixed(2));function H(r){if(typeof r!="object")throw new Error("Options must be an object");let e={};if(r?.gridIntensity){e.gridIntensity={};let{device:t,dataCenter:o,network:n}=r.gridIntensity;t&&(typeof t=="object"?(m.data[t.country?.toUpperCase()]||(console.warn(`"${t.country}" is not a valid country. Please use a valid 3 digit ISO 3166 country code.
|
|
2
2
|
See https://developers.thegreenwebfoundation.org/co2js/data/ for more information.
|
|
3
|
-
Falling back to global average grid intensity.`),e.gridIntensity.device={value:u}),e.gridIntensity.device={country:t.country,value:parseFloat(
|
|
4
|
-
Falling back to global average grid intensity.`))),o&&(typeof o=="object"?(
|
|
3
|
+
Falling back to global average grid intensity.`),e.gridIntensity.device={value:u}),e.gridIntensity.device={country:t.country,value:parseFloat(m.data[t.country?.toUpperCase()])}):typeof t=="number"?e.gridIntensity.device={value:t}:(e.gridIntensity.device={value:u},console.warn(`The device grid intensity must be a number or an object. You passed in a ${typeof t}.
|
|
4
|
+
Falling back to global average grid intensity.`))),o&&(typeof o=="object"?(m.data[o.country?.toUpperCase()]||(console.warn(`"${o.country}" is not a valid country. Please use a valid 3 digit ISO 3166 country code.
|
|
5
5
|
See https://developers.thegreenwebfoundation.org/co2js/data/ for more information.
|
|
6
|
-
Falling back to global average grid intensity.`),e.gridIntensity.dataCenter={value:u}),e.gridIntensity.dataCenter={country:o.country,value:parseFloat(
|
|
7
|
-
Falling back to global average grid intensity.`))),n&&(typeof n=="object"?(
|
|
6
|
+
Falling back to global average grid intensity.`),e.gridIntensity.dataCenter={value:u}),e.gridIntensity.dataCenter={country:o.country,value:parseFloat(m.data[o.country?.toUpperCase()])}):typeof o=="number"?e.gridIntensity.dataCenter={value:o}:(e.gridIntensity.dataCenter={value:u},console.warn(`The data center grid intensity must be a number or an object. You passed in a ${typeof o}.
|
|
7
|
+
Falling back to global average grid intensity.`))),n&&(typeof n=="object"?(m.data[n.country?.toUpperCase()]||(console.warn(`"${n.country}" is not a valid country. Please use a valid 3 digit ISO 3166 country code.
|
|
8
8
|
See https://developers.thegreenwebfoundation.org/co2js/data/ for more information. Falling back to global average grid intensity.
|
|
9
|
-
Falling back to global average grid intensity.`),e.gridIntensity.network={value:u}),e.gridIntensity.network={country:n.country,value:parseFloat(
|
|
10
|
-
Falling back to global average grid intensity.`)))}return r?.dataReloadRatio&&(typeof r.dataReloadRatio=="number"?r.dataReloadRatio>=0&&r.dataReloadRatio<=1?e.dataReloadRatio=r.dataReloadRatio:(e.dataReloadRatio=
|
|
11
|
-
Falling back to default value.`)):(e.dataReloadRatio=
|
|
12
|
-
Falling back to default value.`))),r?.firstVisitPercentage&&(typeof r.firstVisitPercentage=="number"?r.firstVisitPercentage>=0&&r.firstVisitPercentage<=1?e.firstVisitPercentage=r.firstVisitPercentage:(e.firstVisitPercentage=
|
|
13
|
-
Falling back to default value.`)):(e.firstVisitPercentage=
|
|
14
|
-
Falling back to default value.`))),r?.returnVisitPercentage&&(typeof r.returnVisitPercentage=="number"?r.returnVisitPercentage>=0&&r.returnVisitPercentage<=1?e.returnVisitPercentage=r.returnVisitPercentage:(e.returnVisitPercentage=
|
|
15
|
-
Falling back to default value.`)):(e.returnVisitPercentage=
|
|
16
|
-
Falling back to default value.`))),e}var ae=(0,ce.default)("tgwf:sustainable-web-design"),j=class{constructor(e){this.options=e}energyPerByteByComponent(e){let o=e/
|
|
9
|
+
Falling back to global average grid intensity.`),e.gridIntensity.network={value:u}),e.gridIntensity.network={country:n.country,value:parseFloat(m.data[n.country?.toUpperCase()])}):typeof n=="number"?e.gridIntensity.network={value:n}:(e.gridIntensity.network={value:u},console.warn(`The network grid intensity must be a number or an object. You passed in a ${typeof n}.
|
|
10
|
+
Falling back to global average grid intensity.`)))}return r?.dataReloadRatio&&(typeof r.dataReloadRatio=="number"?r.dataReloadRatio>=0&&r.dataReloadRatio<=1?e.dataReloadRatio=r.dataReloadRatio:(e.dataReloadRatio=O,console.warn(`The dataReloadRatio option must be a number between 0 and 1. You passed in ${r.dataReloadRatio}.
|
|
11
|
+
Falling back to default value.`)):(e.dataReloadRatio=O,console.warn(`The dataReloadRatio option must be a number. You passed in a ${typeof r.dataReloadRatio}.
|
|
12
|
+
Falling back to default value.`))),r?.firstVisitPercentage&&(typeof r.firstVisitPercentage=="number"?r.firstVisitPercentage>=0&&r.firstVisitPercentage<=1?e.firstVisitPercentage=r.firstVisitPercentage:(e.firstVisitPercentage=T,console.warn(`The firstVisitPercentage option must be a number between 0 and 1. You passed in ${r.firstVisitPercentage}.
|
|
13
|
+
Falling back to default value.`)):(e.firstVisitPercentage=T,console.warn(`The firstVisitPercentage option must be a number. You passed in a ${typeof r.firstVisitPercentage}.
|
|
14
|
+
Falling back to default value.`))),r?.returnVisitPercentage&&(typeof r.returnVisitPercentage=="number"?r.returnVisitPercentage>=0&&r.returnVisitPercentage<=1?e.returnVisitPercentage=r.returnVisitPercentage:(e.returnVisitPercentage=F,console.warn(`The returnVisitPercentage option must be a number between 0 and 1. You passed in ${r.returnVisitPercentage}.
|
|
15
|
+
Falling back to default value.`)):(e.returnVisitPercentage=F,console.warn(`The returnVisitPercentage option must be a number. You passed in a ${typeof r.returnVisitPercentage}.
|
|
16
|
+
Falling back to default value.`))),e}var ae=(0,ce.default)("tgwf:sustainable-web-design"),j=class{constructor(e){this.options=e}energyPerByteByComponent(e){let o=e/k.GIGABYTE*ie;return{consumerDeviceEnergy:o*K,networkEnergy:o*W,productionEnergy:o*x,dataCenterEnergy:o*Y}}co2byComponent(e,t=u,o={}){let n=u,i=u,a=u,f=u;if(o?.gridIntensity){let{device:l,network:s,dataCenter:c}=o.gridIntensity;l?.value&&(n=l.value),s?.value&&(i=s.value),c?.value&&(a=c.value)}t===!0&&(a=A);let C={};for(let[l,s]of Object.entries(e))l.startsWith("dataCenterEnergy")?C[l.replace("Energy","CO2")]=s*a:l.startsWith("consumerDeviceEnergy")?C[l.replace("Energy","CO2")]=s*n:l.startsWith("networkEnergy")?C[l.replace("Energy","CO2")]=s*i:C[l.replace("Energy","CO2")]=s*f;return C}perByte(e,t=!1,o=!1,n={}){let i=this.energyPerByteByComponent(e,n);if(typeof t!="boolean")throw new Error(`perByte expects a boolean for the carbon intensity value. Received: ${t}`);let a=this.co2byComponent(i,t,n),C=Object.values(a).reduce((l,s)=>l+s);return o?{...a,total:C}:C}perVisit(e,t=!1,o=!1,n={}){let i=this.energyPerVisitByComponent(e,n);if(typeof t!="boolean")throw new Error(`perVisit expects a boolean for the carbon intensity value. Received: ${t}`);let a=this.co2byComponent(i,t,n),C=Object.values(a).reduce((l,s)=>l+s);return o?{...a,total:C}:C}energyPerByte(e){let t=this.energyPerByteByComponent(e);return Object.values(t).reduce((n,i)=>n+i)}energyPerVisitByComponent(e,t={},o=T,n=F,i=O){t.dataReloadRatio&&(i=t.dataReloadRatio),t.firstVisitPercentage&&(o=t.firstVisitPercentage),t.returnVisitPercentage&&(n=t.returnVisitPercentage);let a=this.energyPerByteByComponent(e),f={};ae({energyBycomponent:a});let C=Object.values(a);for(let[l,s]of Object.entries(a))f[`${l} - first`]=s*o,f[`${l} - subsequent`]=s*n*i;return ae({cacheAdjustedSegmentEnergy:f}),f}energyPerVisit(e){let t=0,o=0,n=Object.entries(this.energyPerVisitByComponent(e));for(let[i,a]of n)i.indexOf("first")>0&&(t+=a);for(let[i,a]of n)i.indexOf("subsequent")>0&&(o+=a);return t+o}emissionsPerVisitInGrams(e,t=u){return b(e*t)}annualEnergyInKwh(e,t=1e3){return e*t*12}annualEmissionsInGrams(e,t=1e3){return e*t*12}annualSegmentEnergy(e){return{consumerDeviceEnergy:b(e*K),networkEnergy:b(e*W),dataCenterEnergy:b(e*Y),productionEnergy:b(e*x)}}};var $=j;var Z=class{constructor(e){if(this.model=new $,e?.model==="1byte")this.model=new te;else if(e?.model==="swd")this.model=new $;else if(e?.model)throw new Error(`"${e.model}" is not a valid model. Please use "1byte" for the OneByte model, and "swd" for the Sustainable Web Design model.
|
|
17
17
|
See https://developers.thegreenwebfoundation.org/co2js/models/ to learn more about the models available in CO2.js.`);e?.results==="segment"?this.model.results={segment:!0}:this.model.results={segment:!1}}perByte(e,t=!1){return this.model.perByte(e,t,this.model.results.segment)}perVisit(e,t=!1){if(this.model?.perVisit)return this.model.perVisit(e,t,this.model.results.segment);throw new Error(`The perVisit() method is not supported in the model you are using. Try using perByte() instead.
|
|
18
|
-
See https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more about the methods available in CO2.js.`)}perByteTrace(e,t=!1,o={}){let n={};return o&&(n=
|
|
19
|
-
See https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more about the methods available in CO2.js.`)}perDomain(e,t){let o=[];for(let n of Object.keys(e.domains)){let i;t&&t.indexOf(n)>-1?i=this.perByte(e.domains[n].transferSize,!0):i=this.perByte(e.domains[n].transferSize),o.push({domain:n,co2:i,transferSize:e.domains[n].transferSize})}return o.sort((n,i)=>i.co2-n.co2),o}perPage(e,t){let o=this.perDomain(e,t),n=0;for(let i of o)n+=i.co2;return n}perContentType(e,t){let o={};for(let i of e.assets){let a=new URL(i.url).domain,
|
|
18
|
+
See https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more about the methods available in CO2.js.`)}perByteTrace(e,t=!1,o={}){let n={};return o&&(n=H(o)),{co2:this.model.perByte(e,t,this.model.results.segment,n),green:t,variables:{description:"Below are the variables used to calculate this CO2 estimate.",bytes:e,gridIntensity:{description:"The grid intensity (grams per kilowatt-hour) used to calculate this CO2 estimate.",network:n?.gridIntensity?.network?.value||u,dataCenter:t?A:n?.gridIntensity?.dataCenter?.value||u,production:u,device:n?.gridIntensity?.device?.value||u}}}}perVisitTrace(e,t=!1,o={}){if(this.model?.perVisit){let n={};return o&&(n=H(o)),{co2:this.model.perVisit(e,t,this.model.results.segment,n),green:t,variables:{description:"Below are the variables used to calculate this CO2 estimate.",bytes:e,gridIntensity:{description:"The grid intensity (grams per kilowatt-hour) used to calculate this CO2 estimate.",network:n?.gridIntensity?.network?.value||u,dataCenter:t?A:n?.gridIntensity?.dataCenter?.value||u,production:u,device:n?.gridIntensity?.device?.value||u},dataReloadRatio:n?.dataReloadRatio||.02,firstVisitPercentage:n?.firstVisitPercentage||.75,returnVisitPercentage:n?.returnVisitPercentage||.25}}}else throw new Error(`The perVisitDetailed() method is not supported in the model you are using. Try using perByte() instead.
|
|
19
|
+
See https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more about the methods available in CO2.js.`)}perDomain(e,t){let o=[];for(let n of Object.keys(e.domains)){let i;t&&t.indexOf(n)>-1?i=this.perByte(e.domains[n].transferSize,!0):i=this.perByte(e.domains[n].transferSize),o.push({domain:n,co2:i,transferSize:e.domains[n].transferSize})}return o.sort((n,i)=>i.co2-n.co2),o}perPage(e,t){let o=this.perDomain(e,t),n=0;for(let i of o)n+=i.co2;return n}perContentType(e,t){let o={};for(let i of e.assets){let a=new URL(i.url).domain,f=i.transferSize,C=this.perByte(f,t&&t.indexOf(a)>-1),l=i.type;o[l]||(o[l]={co2:0,transferSize:0}),o[l].co2+=C,o[l].transferSize+=f}let n=[];for(let i of Object.keys(o))n.push({type:i,co2:o[i].co2,transferSize:o[i].transferSize});return n.sort((i,a)=>a.co2-i.co2),n}dirtiestResources(e,t){let o=[];for(let n of e.assets){let i=new URL(n.url).domain,a=n.transferSize,f=this.perByte(a,t&&t.indexOf(i)>-1);o.push({url:n.url,co2:f,transferSize:a})}return o.sort((n,i)=>i.co2-n.co2),o.slice(0,o.length>10?10:o.length)}perParty(e,t){let o=0,n=0,i=e.firstPartyRegEx;for(let a of Object.keys(e.domains))a.match(i)?o+=this.perByte(e.domains[a].transferSize,t&&t.indexOf(a)>-1):n+=this.perByte(e.domains[a].transferSize,t&&t.indexOf(a)>-1);return{firstParty:o,thirdParty:n}}};var z=Z;var de=L(G());var le=L(G()),ft=(0,le.default)("tgwf:hostingAPI");function Ge(r){return typeof r=="string"?Ve(r):De(r)}async function Ve(r){return(await(await fetch(`https://api.thegreenwebfoundation.org/greencheck/${r}`)).json()).green}async function De(r){try{let e="https://api.thegreenwebfoundation.org/v2/greencheckmulti",t=JSON.stringify(r),n=await(await fetch(`${e}/${t}`)).json();return Le(n)}catch{return[]}}function Le(r){return Object.entries(r).filter(([o,n])=>n.green).map(([o,n])=>n.url)}var ue={check:Ge};var gt=(0,de.default)("tgwf:hosting");function Me(r,e){return ue.check(r)}var J={check:Me};var Ue={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"},ke="average",Ke="2021";var m={data:Ue,type:ke,year:Ke};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"},Ye="marginal",xe="2021";var q={data:We,type:Ye,year:xe};var He={co2:z,hosting:J,averageIntensity:m,marginalIntensity:q};return Ie(je);})();
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
package/dist/iife/index.js.map
CHANGED
|
@@ -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/constants/index.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 /**\n * Calculates the carbon footprint of a website using the OneByte model\n * @param {number} bytes - The number of bytes to calculate the carbon footprint for\n * @param {boolean} green - Whether the energy is green or not\n * @returns {number} The carbon footprint in grams of CO2\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 */\nimport debugFactory from \"debug\";\nconst log = debugFactory(\"tgwf:sustainable-web-design\");\n\nimport {\n fileSize,\n KWH_PER_GB,\n END_USER_DEVICE_ENERGY,\n NETWORK_ENERGY,\n DATACENTER_ENERGY,\n PRODUCTION_ENERGY,\n GLOBAL_GRID_INTENSITY,\n RENEWABLES_GRID_INTENSITY,\n FIRST_TIME_VIEWING_PERCENTAGE,\n RETURNING_VISITOR_PERCENTAGE,\n PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD,\n} from \"./constants/index.js\";\nimport { formatNumber } from \"./helpers/index.js\";\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(\n energyByComponent,\n carbonIntensity = GLOBAL_GRID_INTENSITY,\n options = {}\n ) {\n let deviceCarbonIntensity = GLOBAL_GRID_INTENSITY;\n let networkCarbonIntensity = GLOBAL_GRID_INTENSITY;\n let dataCenterCarbonIntensity = GLOBAL_GRID_INTENSITY;\n\n let globalEmissions = GLOBAL_GRID_INTENSITY;\n\n if (options?.gridIntensity) {\n const { device, network, dataCenter } = options.gridIntensity;\n\n if (device?.value) {\n deviceCarbonIntensity = device.value;\n }\n if (network?.value) {\n networkCarbonIntensity = network.value;\n }\n // If the user has set a carbon intensity value for the datacentre, then that overrides everything and is used\n if (dataCenter?.value) {\n dataCenterCarbonIntensity = dataCenter.value;\n }\n }\n\n // If the user passes in a TRUE value (green web host), then use the renewables intensity value\n if (carbonIntensity === true) {\n dataCenterCarbonIntensity = RENEWABLES_GRID_INTENSITY;\n }\n\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.replace(\"Energy\", \"CO2\")] =\n value * dataCenterCarbonIntensity;\n } else if (key.startsWith(\"consumerDeviceEnergy\")) {\n returnCO2ByComponent[key.replace(\"Energy\", \"CO2\")] =\n value * deviceCarbonIntensity;\n } else if (key.startsWith(\"networkEnergy\")) {\n returnCO2ByComponent[key.replace(\"Energy\", \"CO2\")] =\n value * networkCarbonIntensity;\n } else {\n // Use the global intensity for the remaining segments\n returnCO2ByComponent[key.replace(\"Energy\", \"CO2\")] =\n value * globalEmissions;\n }\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(\n bytes,\n carbonIntensity = false,\n segmentResults = false,\n options = {}\n ) {\n const energyBycomponent = this.energyPerByteByComponent(bytes, options);\n\n // otherwise when faced with non numeric values throw an error\n if (typeof carbonIntensity !== \"boolean\") {\n throw new Error(\n `perByte expects a boolean for the carbon intensity value. Received: ${carbonIntensity}`\n );\n }\n\n const co2ValuesbyComponent = this.co2byComponent(\n energyBycomponent,\n carbonIntensity,\n options\n );\n\n // pull out our values\u2026\n const co2Values = Object.values(co2ValuesbyComponent);\n const co2ValuesSum = co2Values.reduce(\n (prevValue, currentValue) => prevValue + currentValue\n );\n\n if (segmentResults) {\n return { ...co2ValuesbyComponent, total: co2ValuesSum };\n }\n\n return co2ValuesSum;\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(\n bytes,\n carbonIntensity = false,\n segmentResults = false,\n options = {}\n ) {\n const energyBycomponent = this.energyPerVisitByComponent(bytes, options);\n\n if (typeof carbonIntensity !== \"boolean\") {\n // otherwise when faced with non numeric values throw an error\n throw new Error(\n `perVisit expects a boolean for the carbon intensity value. Received: ${carbonIntensity}`\n );\n }\n\n const co2ValuesbyComponent = this.co2byComponent(\n energyBycomponent,\n carbonIntensity,\n options\n );\n\n // pull out our values\u2026\n const co2Values = Object.values(co2ValuesbyComponent);\n const co2ValuesSum = co2Values.reduce(\n (prevValue, currentValue) => prevValue + currentValue\n );\n\n if (segmentResults) {\n return { ...co2ValuesbyComponent, total: co2ValuesSum };\n }\n\n // so we can return their sum\n return co2ValuesSum;\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 options = {},\n firstView = FIRST_TIME_VIEWING_PERCENTAGE,\n returnView = RETURNING_VISITOR_PERCENTAGE,\n dataReloadRatio = PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD\n ) {\n if (options.dataReloadRatio) {\n dataReloadRatio = options.dataReloadRatio;\n }\n\n if (options.firstVisitPercentage) {\n firstView = options.firstVisitPercentage;\n }\n\n if (options.returnVisitPercentage) {\n returnView = options.returnVisitPercentage;\n }\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 emissionsPerVisitInGrams(\n energyPerVisit,\n carbonintensity = GLOBAL_GRID_INTENSITY\n ) {\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", "import fileSize from \"./file-size.js\";\nimport testConstants from \"./test-constants.js\";\n\n// SUSTAINABLE WEB DESIGN CONSTANTS\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_GRID_INTENSITY = 442;\nconst RENEWABLES_GRID_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\nexport {\n fileSize,\n testConstants,\n KWH_PER_GB,\n END_USER_DEVICE_ENERGY,\n NETWORK_ENERGY,\n DATACENTER_ENERGY,\n PRODUCTION_ENERGY,\n GLOBAL_GRID_INTENSITY,\n RENEWABLES_GRID_INTENSITY,\n FIRST_TIME_VIEWING_PERCENTAGE,\n RETURNING_VISITOR_PERCENTAGE,\n PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD,\n};\n", "import { averageIntensity } from \"../index.js\";\nimport {\n GLOBAL_GRID_INTENSITY,\n PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD,\n FIRST_TIME_VIEWING_PERCENTAGE,\n RETURNING_VISITOR_PERCENTAGE,\n} from \"../constants/index.js\";\nconst formatNumber = (num) => parseFloat(num.toFixed(2));\n\nfunction parseOptions(options) {\n // CHeck that it is an object\n if (typeof options !== \"object\") {\n throw new Error(\"Options must be an object\");\n }\n\n const adjustments = {};\n\n if (options?.gridIntensity) {\n adjustments.gridIntensity = {};\n const { device, dataCenter, network } = options.gridIntensity;\n if (device) {\n if (typeof device === \"object\") {\n if (!averageIntensity.data[device.country?.toUpperCase()]) {\n console.warn(\n `\"${device.country}\" is not a valid country. Please use a valid 3 digit ISO 3166 country code. \\nSee https://developers.thegreenwebfoundation.org/co2js/data/ for more information. \\nFalling back to global average grid intensity.`\n );\n adjustments.gridIntensity[\"device\"] = {\n value: GLOBAL_GRID_INTENSITY,\n };\n }\n adjustments.gridIntensity[\"device\"] = {\n country: device.country,\n value: parseFloat(\n averageIntensity.data[device.country?.toUpperCase()]\n ),\n };\n } else if (typeof device === \"number\") {\n adjustments.gridIntensity[\"device\"] = {\n value: device,\n };\n } else {\n adjustments.gridIntensity[\"device\"] = {\n value: GLOBAL_GRID_INTENSITY,\n };\n console.warn(\n `The device grid intensity must be a number or an object. You passed in a ${typeof device}. \\nFalling back to global average grid intensity.`\n );\n }\n }\n if (dataCenter) {\n if (typeof dataCenter === \"object\") {\n if (!averageIntensity.data[dataCenter.country?.toUpperCase()]) {\n console.warn(\n `\"${dataCenter.country}\" is not a valid country. Please use a valid 3 digit ISO 3166 country code. \\nSee https://developers.thegreenwebfoundation.org/co2js/data/ for more information. \\nFalling back to global average grid intensity.`\n );\n adjustments.gridIntensity[\"dataCenter\"] = {\n value: GLOBAL_GRID_INTENSITY,\n };\n }\n adjustments.gridIntensity[\"dataCenter\"] = {\n country: dataCenter.country,\n value: parseFloat(\n averageIntensity.data[dataCenter.country?.toUpperCase()]\n ),\n };\n } else if (typeof dataCenter === \"number\") {\n adjustments.gridIntensity[\"dataCenter\"] = {\n value: dataCenter,\n };\n } else {\n adjustments.gridIntensity[\"dataCenter\"] = {\n value: GLOBAL_GRID_INTENSITY,\n };\n console.warn(\n `The data center grid intensity must be a number or an object. You passed in a ${typeof dataCenter}. \\nFalling back to global average grid intensity.`\n );\n }\n }\n if (network) {\n if (typeof network === \"object\") {\n if (!averageIntensity.data[network.country?.toUpperCase()]) {\n console.warn(\n `\"${network.country}\" is not a valid country. Please use a valid 3 digit ISO 3166 country code. \\nSee https://developers.thegreenwebfoundation.org/co2js/data/ for more information. Falling back to global average grid intensity. \\nFalling back to global average grid intensity.`\n );\n adjustments.gridIntensity[\"network\"] = {\n value: GLOBAL_GRID_INTENSITY,\n };\n }\n adjustments.gridIntensity[\"network\"] = {\n country: network.country,\n value: parseFloat(\n averageIntensity.data[network.country?.toUpperCase()]\n ),\n };\n } else if (typeof network === \"number\") {\n adjustments.gridIntensity[\"network\"] = {\n value: network,\n };\n } else {\n adjustments.gridIntensity[\"network\"] = {\n value: GLOBAL_GRID_INTENSITY,\n };\n console.warn(\n `The network grid intensity must be a number or an object. You passed in a ${typeof network}. \\nFalling back to global average grid intensity.`\n );\n }\n }\n }\n\n if (options?.dataReloadRatio) {\n if (typeof options.dataReloadRatio === \"number\") {\n if (options.dataReloadRatio >= 0 && options.dataReloadRatio <= 1) {\n adjustments.dataReloadRatio = options.dataReloadRatio;\n } else {\n adjustments.dataReloadRatio =\n PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD;\n console.warn(\n `The dataReloadRatio option must be a number between 0 and 1. You passed in ${options.dataReloadRatio}. \\nFalling back to default value.`\n );\n }\n } else {\n adjustments.dataReloadRatio =\n PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD;\n console.warn(\n `The dataReloadRatio option must be a number. You passed in a ${typeof options.dataReloadRatio}. \\nFalling back to default value.`\n );\n }\n }\n\n if (options?.firstVisitPercentage) {\n if (typeof options.firstVisitPercentage === \"number\") {\n if (\n options.firstVisitPercentage >= 0 &&\n options.firstVisitPercentage <= 1\n ) {\n adjustments.firstVisitPercentage = options.firstVisitPercentage;\n } else {\n adjustments.firstVisitPercentage = FIRST_TIME_VIEWING_PERCENTAGE;\n console.warn(\n `The firstVisitPercentage option must be a number between 0 and 1. You passed in ${options.firstVisitPercentage}. \\nFalling back to default value.`\n );\n }\n } else {\n adjustments.firstVisitPercentage = FIRST_TIME_VIEWING_PERCENTAGE;\n console.warn(\n `The firstVisitPercentage option must be a number. You passed in a ${typeof options.firstVisitPercentage}. \\nFalling back to default value.`\n );\n }\n }\n\n if (options?.returnVisitPercentage) {\n if (typeof options.returnVisitPercentage === \"number\") {\n if (\n options.returnVisitPercentage >= 0 &&\n options.returnVisitPercentage <= 1\n ) {\n adjustments.returnVisitPercentage = options.returnVisitPercentage;\n } else {\n adjustments.returnVisitPercentage = RETURNING_VISITOR_PERCENTAGE;\n console.warn(\n `The returnVisitPercentage option must be a number between 0 and 1. You passed in ${options.returnVisitPercentage}. \\nFalling back to default value.`\n );\n }\n } else {\n adjustments.returnVisitPercentage = RETURNING_VISITOR_PERCENTAGE;\n console.warn(\n `The returnVisitPercentage option must be a number. You passed in a ${typeof options.returnVisitPercentage}. \\nFalling back to default value.`\n );\n }\n }\n\n return adjustments;\n}\n\nexport { formatNumber, parseOptions };\n", "\"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", "\"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": "ooBAAA,mBAIA,GAAI,GAAI,IACJ,EAAI,EAAI,GACR,EAAI,EAAI,GACR,EAAI,EAAI,GACR,GAAI,EAAI,EACR,GAAI,EAAI,OAgBZ,GAAO,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,IAAI,OAAS,KAGjB,IAAI,GAAQ,mIAAmI,KAC7I,CACF,EACA,GAAI,EAAC,EAGL,IAAI,GAAI,WAAW,EAAM,EAAE,EACvB,EAAQ,GAAM,IAAM,MAAM,YAAY,EAC1C,OAAQ,OACD,YACA,WACA,UACA,SACA,IACH,MAAO,GAAI,OACR,YACA,WACA,IACH,MAAO,GAAI,OACR,WACA,UACA,IACH,MAAO,GAAI,MACR,YACA,WACA,UACA,SACA,IACH,MAAO,GAAI,MACR,cACA,aACA,WACA,UACA,IACH,MAAO,GAAI,MACR,cACA,aACA,WACA,UACA,IACH,MAAO,GAAI,MACR,mBACA,kBACA,YACA,WACA,KACH,MAAO,WAEP,SAEN,CAUA,YAAkB,EAAI,CACpB,GAAI,GAAQ,KAAK,IAAI,CAAE,EACvB,MAAI,IAAS,EACJ,KAAK,MAAM,EAAK,CAAC,EAAI,IAE1B,GAAS,EACJ,KA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AM,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,EVM/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 /**\n * Calculates the carbon footprint of a website using the OneByte model\n * @param {number} bytes - The number of bytes to calculate the carbon footprint for\n * @param {boolean} green - Whether the energy is green or not\n * @returns {number} The carbon footprint in grams of CO2\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 */\nimport debugFactory from \"debug\";\nconst log = debugFactory(\"tgwf:sustainable-web-design\");\n\nimport {\n fileSize,\n KWH_PER_GB,\n END_USER_DEVICE_ENERGY,\n NETWORK_ENERGY,\n DATACENTER_ENERGY,\n PRODUCTION_ENERGY,\n GLOBAL_GRID_INTENSITY,\n RENEWABLES_GRID_INTENSITY,\n FIRST_TIME_VIEWING_PERCENTAGE,\n RETURNING_VISITOR_PERCENTAGE,\n PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD,\n} from \"./constants/index.js\";\nimport { formatNumber } from \"./helpers/index.js\";\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(\n energyByComponent,\n carbonIntensity = GLOBAL_GRID_INTENSITY,\n options = {}\n ) {\n let deviceCarbonIntensity = GLOBAL_GRID_INTENSITY;\n let networkCarbonIntensity = GLOBAL_GRID_INTENSITY;\n let dataCenterCarbonIntensity = GLOBAL_GRID_INTENSITY;\n\n let globalEmissions = GLOBAL_GRID_INTENSITY;\n\n if (options?.gridIntensity) {\n const { device, network, dataCenter } = options.gridIntensity;\n\n if (device?.value) {\n deviceCarbonIntensity = device.value;\n }\n if (network?.value) {\n networkCarbonIntensity = network.value;\n }\n // If the user has set a carbon intensity value for the datacentre, then that overrides everything and is used\n if (dataCenter?.value) {\n dataCenterCarbonIntensity = dataCenter.value;\n }\n }\n\n // If the user passes in a TRUE value (green web host), then use the renewables intensity value\n if (carbonIntensity === true) {\n dataCenterCarbonIntensity = RENEWABLES_GRID_INTENSITY;\n }\n\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.replace(\"Energy\", \"CO2\")] =\n value * dataCenterCarbonIntensity;\n } else if (key.startsWith(\"consumerDeviceEnergy\")) {\n returnCO2ByComponent[key.replace(\"Energy\", \"CO2\")] =\n value * deviceCarbonIntensity;\n } else if (key.startsWith(\"networkEnergy\")) {\n returnCO2ByComponent[key.replace(\"Energy\", \"CO2\")] =\n value * networkCarbonIntensity;\n } else {\n // Use the global intensity for the remaining segments\n returnCO2ByComponent[key.replace(\"Energy\", \"CO2\")] =\n value * globalEmissions;\n }\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(\n bytes,\n carbonIntensity = false,\n segmentResults = false,\n options = {}\n ) {\n const energyBycomponent = this.energyPerByteByComponent(bytes, options);\n\n // otherwise when faced with non numeric values throw an error\n if (typeof carbonIntensity !== \"boolean\") {\n throw new Error(\n `perByte expects a boolean for the carbon intensity value. Received: ${carbonIntensity}`\n );\n }\n\n const co2ValuesbyComponent = this.co2byComponent(\n energyBycomponent,\n carbonIntensity,\n options\n );\n\n // pull out our values\u2026\n const co2Values = Object.values(co2ValuesbyComponent);\n const co2ValuesSum = co2Values.reduce(\n (prevValue, currentValue) => prevValue + currentValue\n );\n\n if (segmentResults) {\n return { ...co2ValuesbyComponent, total: co2ValuesSum };\n }\n\n return co2ValuesSum;\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(\n bytes,\n carbonIntensity = false,\n segmentResults = false,\n options = {}\n ) {\n const energyBycomponent = this.energyPerVisitByComponent(bytes, options);\n\n if (typeof carbonIntensity !== \"boolean\") {\n // otherwise when faced with non numeric values throw an error\n throw new Error(\n `perVisit expects a boolean for the carbon intensity value. Received: ${carbonIntensity}`\n );\n }\n\n const co2ValuesbyComponent = this.co2byComponent(\n energyBycomponent,\n carbonIntensity,\n options\n );\n\n // pull out our values\u2026\n const co2Values = Object.values(co2ValuesbyComponent);\n const co2ValuesSum = co2Values.reduce(\n (prevValue, currentValue) => prevValue + currentValue\n );\n\n if (segmentResults) {\n return { ...co2ValuesbyComponent, total: co2ValuesSum };\n }\n\n // so we can return their sum\n return co2ValuesSum;\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 options = {},\n firstView = FIRST_TIME_VIEWING_PERCENTAGE,\n returnView = RETURNING_VISITOR_PERCENTAGE,\n dataReloadRatio = PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD\n ) {\n if (options.dataReloadRatio) {\n dataReloadRatio = options.dataReloadRatio;\n }\n\n if (options.firstVisitPercentage) {\n firstView = options.firstVisitPercentage;\n }\n\n if (options.returnVisitPercentage) {\n returnView = options.returnVisitPercentage;\n }\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 emissionsPerVisitInGrams(\n energyPerVisit,\n carbonintensity = GLOBAL_GRID_INTENSITY\n ) {\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", "import fileSize from \"./file-size.js\";\n\n// SUSTAINABLE WEB DESIGN CONSTANTS\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_GRID_INTENSITY = 442;\nconst RENEWABLES_GRID_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\nexport {\n fileSize,\n KWH_PER_GB,\n END_USER_DEVICE_ENERGY,\n NETWORK_ENERGY,\n DATACENTER_ENERGY,\n PRODUCTION_ENERGY,\n GLOBAL_GRID_INTENSITY,\n RENEWABLES_GRID_INTENSITY,\n FIRST_TIME_VIEWING_PERCENTAGE,\n RETURNING_VISITOR_PERCENTAGE,\n PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD,\n};\n", "import { averageIntensity } from \"../index.js\";\nimport {\n GLOBAL_GRID_INTENSITY,\n PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD,\n FIRST_TIME_VIEWING_PERCENTAGE,\n RETURNING_VISITOR_PERCENTAGE,\n} from \"../constants/index.js\";\nconst formatNumber = (num) => parseFloat(num.toFixed(2));\n\nfunction parseOptions(options) {\n // CHeck that it is an object\n if (typeof options !== \"object\") {\n throw new Error(\"Options must be an object\");\n }\n\n const adjustments = {};\n\n if (options?.gridIntensity) {\n adjustments.gridIntensity = {};\n const { device, dataCenter, network } = options.gridIntensity;\n if (device) {\n if (typeof device === \"object\") {\n if (!averageIntensity.data[device.country?.toUpperCase()]) {\n console.warn(\n `\"${device.country}\" is not a valid country. Please use a valid 3 digit ISO 3166 country code. \\nSee https://developers.thegreenwebfoundation.org/co2js/data/ for more information. \\nFalling back to global average grid intensity.`\n );\n adjustments.gridIntensity[\"device\"] = {\n value: GLOBAL_GRID_INTENSITY,\n };\n }\n adjustments.gridIntensity[\"device\"] = {\n country: device.country,\n value: parseFloat(\n averageIntensity.data[device.country?.toUpperCase()]\n ),\n };\n } else if (typeof device === \"number\") {\n adjustments.gridIntensity[\"device\"] = {\n value: device,\n };\n } else {\n adjustments.gridIntensity[\"device\"] = {\n value: GLOBAL_GRID_INTENSITY,\n };\n console.warn(\n `The device grid intensity must be a number or an object. You passed in a ${typeof device}. \\nFalling back to global average grid intensity.`\n );\n }\n }\n if (dataCenter) {\n if (typeof dataCenter === \"object\") {\n if (!averageIntensity.data[dataCenter.country?.toUpperCase()]) {\n console.warn(\n `\"${dataCenter.country}\" is not a valid country. Please use a valid 3 digit ISO 3166 country code. \\nSee https://developers.thegreenwebfoundation.org/co2js/data/ for more information. \\nFalling back to global average grid intensity.`\n );\n adjustments.gridIntensity[\"dataCenter\"] = {\n value: GLOBAL_GRID_INTENSITY,\n };\n }\n adjustments.gridIntensity[\"dataCenter\"] = {\n country: dataCenter.country,\n value: parseFloat(\n averageIntensity.data[dataCenter.country?.toUpperCase()]\n ),\n };\n } else if (typeof dataCenter === \"number\") {\n adjustments.gridIntensity[\"dataCenter\"] = {\n value: dataCenter,\n };\n } else {\n adjustments.gridIntensity[\"dataCenter\"] = {\n value: GLOBAL_GRID_INTENSITY,\n };\n console.warn(\n `The data center grid intensity must be a number or an object. You passed in a ${typeof dataCenter}. \\nFalling back to global average grid intensity.`\n );\n }\n }\n if (network) {\n if (typeof network === \"object\") {\n if (!averageIntensity.data[network.country?.toUpperCase()]) {\n console.warn(\n `\"${network.country}\" is not a valid country. Please use a valid 3 digit ISO 3166 country code. \\nSee https://developers.thegreenwebfoundation.org/co2js/data/ for more information. Falling back to global average grid intensity. \\nFalling back to global average grid intensity.`\n );\n adjustments.gridIntensity[\"network\"] = {\n value: GLOBAL_GRID_INTENSITY,\n };\n }\n adjustments.gridIntensity[\"network\"] = {\n country: network.country,\n value: parseFloat(\n averageIntensity.data[network.country?.toUpperCase()]\n ),\n };\n } else if (typeof network === \"number\") {\n adjustments.gridIntensity[\"network\"] = {\n value: network,\n };\n } else {\n adjustments.gridIntensity[\"network\"] = {\n value: GLOBAL_GRID_INTENSITY,\n };\n console.warn(\n `The network grid intensity must be a number or an object. You passed in a ${typeof network}. \\nFalling back to global average grid intensity.`\n );\n }\n }\n }\n\n if (options?.dataReloadRatio) {\n if (typeof options.dataReloadRatio === \"number\") {\n if (options.dataReloadRatio >= 0 && options.dataReloadRatio <= 1) {\n adjustments.dataReloadRatio = options.dataReloadRatio;\n } else {\n adjustments.dataReloadRatio =\n PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD;\n console.warn(\n `The dataReloadRatio option must be a number between 0 and 1. You passed in ${options.dataReloadRatio}. \\nFalling back to default value.`\n );\n }\n } else {\n adjustments.dataReloadRatio =\n PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD;\n console.warn(\n `The dataReloadRatio option must be a number. You passed in a ${typeof options.dataReloadRatio}. \\nFalling back to default value.`\n );\n }\n }\n\n if (options?.firstVisitPercentage) {\n if (typeof options.firstVisitPercentage === \"number\") {\n if (\n options.firstVisitPercentage >= 0 &&\n options.firstVisitPercentage <= 1\n ) {\n adjustments.firstVisitPercentage = options.firstVisitPercentage;\n } else {\n adjustments.firstVisitPercentage = FIRST_TIME_VIEWING_PERCENTAGE;\n console.warn(\n `The firstVisitPercentage option must be a number between 0 and 1. You passed in ${options.firstVisitPercentage}. \\nFalling back to default value.`\n );\n }\n } else {\n adjustments.firstVisitPercentage = FIRST_TIME_VIEWING_PERCENTAGE;\n console.warn(\n `The firstVisitPercentage option must be a number. You passed in a ${typeof options.firstVisitPercentage}. \\nFalling back to default value.`\n );\n }\n }\n\n if (options?.returnVisitPercentage) {\n if (typeof options.returnVisitPercentage === \"number\") {\n if (\n options.returnVisitPercentage >= 0 &&\n options.returnVisitPercentage <= 1\n ) {\n adjustments.returnVisitPercentage = options.returnVisitPercentage;\n } else {\n adjustments.returnVisitPercentage = RETURNING_VISITOR_PERCENTAGE;\n console.warn(\n `The returnVisitPercentage option must be a number between 0 and 1. You passed in ${options.returnVisitPercentage}. \\nFalling back to default value.`\n );\n }\n } else {\n adjustments.returnVisitPercentage = RETURNING_VISITOR_PERCENTAGE;\n console.warn(\n `The returnVisitPercentage option must be a number. You passed in a ${typeof options.returnVisitPercentage}. \\nFalling back to default value.`\n );\n }\n }\n\n return adjustments;\n}\n\nexport { formatNumber, parseOptions };\n", "\"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", "\"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": "ooBAAA,mBAIA,GAAI,GAAI,IACJ,EAAI,EAAI,GACR,EAAI,EAAI,GACR,EAAI,EAAI,GACR,GAAI,EAAI,EACR,GAAI,EAAI,OAgBZ,GAAO,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,IAAI,OAAS,KAGjB,IAAI,GAAQ,mIAAmI,KAC7I,CACF,EACA,GAAI,EAAC,EAGL,IAAI,GAAI,WAAW,EAAM,EAAE,EACvB,EAAQ,GAAM,IAAM,MAAM,YAAY,EAC1C,OAAQ,OACD,YACA,WACA,UACA,SACA,IACH,MAAO,GAAI,OACR,YACA,WACA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,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,EVM/4F,GAAO,IAAQ,CAAE,MAAK,UAAS,mBAAkB,mBAAkB",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
package/src/constants/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import fileSize from "./file-size.js";
|
|
2
|
-
import testConstants from "./test-constants.js";
|
|
3
2
|
|
|
4
3
|
// SUSTAINABLE WEB DESIGN CONSTANTS
|
|
5
4
|
// this refers to the estimated total energy use for the internet around 2000 TWh,
|
|
@@ -26,7 +25,6 @@ const PERCENTAGE_OF_DATA_LOADED_ON_SUBSEQUENT_LOAD = 0.02;
|
|
|
26
25
|
|
|
27
26
|
export {
|
|
28
27
|
fileSize,
|
|
29
|
-
testConstants,
|
|
30
28
|
KWH_PER_GB,
|
|
31
29
|
END_USER_DEVICE_ENERGY,
|
|
32
30
|
NETWORK_ENERGY,
|