/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@robinl/energy_usage@0.1.9/dist/energy_usage.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).energy_usage={})}(this,(function(e){"use strict";let t={};const o={conversion:null,sources:[]};function r(e){return Object.assign({},e)}function s(e,i,a,u,c,l){if(c.push(i),a in t){u*=t[i][a].conversion;let _=t[a];n[i]=n[i]||{},n[i][a]=n[i][a]||{},Object.keys(_).forEach((i=>{let _=[...l];c.includes(i)||i in t[e]||(n[e][i]=r(o),n[e][i].conversion=u*t[a][i].conversion,_=[..._,...t[a][i].sources],n[e][i].sources=_,s(e,a,i,u,[...c],[..._]))}))}}t.kilometers={meters:{conversion:1e3,sources:[]},miles:{conversion:.621371,sources:[{url:"www.google.com/search?q=one+km+in+miles",notes:null}]}},t.litres={imperial_gallons:{conversion:.219969204701183,sources:[{url:"www.google.com/search?q=one+litre+in+imperial+gallons",notes:null}]},us_gallons:{conversion:.264172,sources:[{url:"www.google.com/search?q=one+litre+in+us+gallons",notes:null}]},oil_barrels:{conversion:.00628981,sources:[{url:"www.google.com/search?q=one+litre+in+oil+barrel",notes:null}]}},t.joules={kilocalories:{conversion:1/4184,sources:[{url:"www.google.com/search?q=one+joule+in+kilocalories",notes:null}]}},t.kilowatt_hours={megawatt_hours:{conversion:.001,sources:[]},joules:{conversion:36e5,sources:[]},kg_co2_from_grid_electricity:{conversion:.25358,sources:[{url:"https://gist.github.com/RobinL/2d253d1b5a4a27e563fd1ce811c1bb86#file-defra_conversion_factors_2019-csv-L1928",notes:null}]}},t.kwh_potential_solar_schools_energy={gbp:{conversion:22e5/1945,sources:[{url:"https://schools-energy-coop.co.uk/wp-content/uploads/2019/08/Schools-Energy-Annual-Report-2019.pdf",notes:null}]}},t.residential_solar_uk_kwh_potential_capacity={kwh_generated_per_year:{conversion:1447169/1945,sources:[{url:"https://schools-energy-coop.co.uk/wp-content/uploads/2019/08/Schools-Energy-Annual-Report-2019.pdf",notes:null}]}},t.megawatt_hours={gigawatt_hours:{conversion:.001,sources:[]},gbp_to_generate_offshore_wind_uk:{conversion:40,sources:[{url:"https://www.theguardian.com/environment/2019/sep/20/new-windfarms-taxpayers-subsidies-record-low",notes:null}]},gbp_to_generate_solar_nevada_usa:{conversion:23.76*.79,sources:[{url:"https://earther.gizmodo.com/solar-just-hit-a-record-low-price-in-the-u-s-1826830592",notes:null},{url:"https://www.google.com/search?q=google+one+dollar+in+gbp",notes:null}]},gbp_to_generate_nuclear_hinkley_point_uk:{conversion:92.5,sources:[{url:"https://en.wikipedia.org/w/index.php?title=Hinkley_Point_C_nuclear_power_station&oldid=918854599",notes:null}]},gbp_to_generate_solar_schools_energy:{conversion:1e3*t.kwh_potential_solar_schools_energy.gbp.conversion/(20*t.residential_solar_uk_kwh_potential_capacity.kwh_generated_per_year.conversion),sources:[{url:"https://schools-energy-coop.co.uk/wp-content/uploads/2019/08/Schools-Energy-Annual-Report-2019.pdf",notes:"Assumes lifetime of solar panels installed on UK schools is about 20 years."}]}},t.litres_petrol={kilowatt_hours:{conversion:9.5727,sources:[{url:"https://en.wikipedia.org/wiki/Energy_density",notes:null},{url:"Energy Saving Trust Conversion Factors 2016",notes:null}]},imperial_gallons_petrol:r(t.litres.imperial_gallons),kg_co2_from_petrol:{conversion:2.19585,sources:[{url:"https://gist.github.com/RobinL/2d253d1b5a4a27e563fd1ce811c1bb86#file-defra_conversion_factors_2019-csv-L236",notes:null}]}},t.litres_jet_fuel={joules:{conversion:35e6,sources:[{url:"https://en.wikipedia.org/wiki/Energy_density",notes:null}]},kg_co2_from_jet_fuel:{conversion:2.51772,sources:[{url:"https://gist.github.com/RobinL/2d253d1b5a4a27e563fd1ce811c1bb86#file-defra_conversion_factors_2019-csv-L108",notes:null}]}},t.metric_gas_units={joules:{conversion:395e5,sources:[{url:"https://www.gov.uk/guidance/gas-meter-readings-and-bill-calculation",notes:null}]},kg_co2_from_domestic_gas:{conversion:2.0268,sources:[{url:"https://gist.github.com/RobinL/2d253d1b5a4a27e563fd1ce811c1bb86#file-defra_conversion_factors_2019-csv-L60",notes:null}]}},t.imperial_gas_units={metric_gas_units:{conversion:2.83,sources:[{url:"https://www.gov.uk/guidance/gas-meter-readings-and-bill-calculation",notes:null}]}},t.years={days:{conversion:365.25,sources:[]},months:{conversion:12,sources:[]}},t.weeks={days:{conversion:7,sources:[]}},t.days={hours:{conversion:24,sources:[]}},t.hours={minutes:{conversion:60,sources:[]}},t.minutes={seconds:{conversion:60,sources:[]}},Object.keys(t).forEach((e=>{let s=t[e];Object.keys(s).forEach((s=>{t[s]=t[s]||{},t[s][e]=r(o),t[s][e].conversion=1/t[e][s].conversion,t[s][e].sources=[...t[e][s].sources]}))})),Object.keys(t).forEach((e=>{let o=t[e];Object.keys(o).forEach((r=>{let s=[...o[r].sources];0==s.length&&(s=[{}]),s.forEach((function(t){t.from_to=`${e} -> ${r}`})),t[e][r].sources=s}))}));let n=JSON.parse(JSON.stringify(t));function i(e){let t={gwh:"gigawatt_hours",mwh:"megawatt_hours",kwh:"kilowatt_hours",kcal:"kilocalories",km:"kilometers",j:"joules"};return e in t?t[e]:e}function a(e,t){if((e=i(e))==(t=i(t)))return 1;if(!(e in n)){throw`your from unit ${e} does not exist in our conversions table. Units available are ${Object.keys(n).join(", ")}`}if(!(t in n)){throw`your from unit ${e} does not exist in our conversions table. Units available are ${Object.keys(n).join(", ")}`}return n[e][t].conversion}Object.keys(t).forEach((e=>{let o=t[e];Object.keys(o).forEach((o=>{let r=[...t[e][o].sources];s(e,e,o,1,[],r)}))}));let u={_constants_dict:n,convert_units:a,per:function(e){let t=e.split("/");return a(t[1],t[0])}};function c(e,t,o){return e*t*o*.06}let l={shower_get_daily_litres:c,shower_get_daily_kwh:function(e,t,o,r=30,s=.9){let n=4184*c(e,t,o)*r/s;return u.per("kwh/j")*n},bath_get_daily_kwh:function(e,t,o=30,r=.9){let s=t*e*4184*o/r;return u.per("kwh/j")*s}};function _(e,t,o=30){return e*u.convert_units("days",t)/o}let h={miles_driven_to_kwh_per_day:function(e,t,o=30){return function(e){let t=u.per("litres/imperial_gallons")*e,o=u.convert_units("litres_petrol","joules")*t;return u.per("kwh/joules")*o}(_(e,t,o))},_miles_driven_to_gallons_of_fuel_per_day:_};let d={flying_miles_to_kwh:function(e,t="days"){return e*u.convert_units("days",t)*(2.61/100*u.per("km/miles"))*u.per("kwh/litres_jet_fuel")*1.08}};let p={format_kwh:function(e){return e.toPrecision(2)}};const g={30:.7},w={50:1.05};let f={washing_machine_kwh_per_day:function(e,t,o="30"){let r=o+"";if(!(r in g))throw"No data available for the temperature you chose: "+r;let s=g[r]*e;return u.convert_units("days",t)*s},dishwasher_kwh_per_day:function(e,t,o="50"){let r=o+"";if(!(r in w))throw"No data available for the temperature you chose: "+r;let s=w[r]*e;return u.convert_units("days",t)*s}};let m={kwh_required_by_dogs_per_day:function(e){let t=7*(143*e**.75);return u.per("kwh/kcal")*t}};function y(e,t,o,r){let s,n=10*e+6.25*t-5*o;return s="male"==r?n+5:n-161,s}let k={kwh_per_day:function(e,t,o,r,s,n="omnivore"){let i=7*function(e,t,o,r,s){let n=function(e,t){return e*{sedentary_light:1.53,moderately_active:1.76,vigorous:2.25}[t]}(y(e,t,o,r),s);return n}(e,t,o,r,s)*u.convert_units("kcal","joules"),a=function(e){let t={omnivore:3959.3,vegetarian:2598.3,vegan:2336.1},o=t.omnivore,r={};return Object.keys(t).forEach((function(e){r[e]=t[e]/o})),r[e]}(n);return i*=a,u.per("kwh/j")*i},_get_BMR:y},v=[{thermostat:0,heat_required:0},{thermostat:1,heat_required:0},{thermostat:2,heat_required:.37571428571428567},{thermostat:3,heat_required:5.0985714285714305},{thermostat:4,heat_required:26.044285714285724},{thermostat:5,heat_required:78.48999999999997},{thermostat:6,heat_required:169.6057142857142},{thermostat:7,heat_required:287.250238095238},{thermostat:8,heat_required:422.87452380952385},{thermostat:9,heat_required:576.3630952380952},{thermostat:10,heat_required:754.0873809523811},{thermostat:11,heat_required:950.7330952380953},{thermostat:12,heat_required:1164.0188095238095},{thermostat:13,heat_required:1391.993095238095},{thermostat:14,heat_required:1643.9459523809514},{thermostat:15,heat_required:1920.8502380952373},{thermostat:16,heat_required:2217.6545238095227},{thermostat:17,heat_required:2539.715952380951},{thermostat:18,heat_required:2889.3630952380945},{thermostat:19,heat_required:3252.295952380951},{thermostat:20,heat_required:3618.2802380952367},{thermostat:21,heat_required:3984.280238095237},{thermostat:22,heat_required:4350.280238095237},{thermostat:23,heat_required:4716.280238095237},{thermostat:24,heat_required:5082.280238095236},{thermostat:25,heat_required:5448.280238095238},{thermostat:26,heat_required:5814.280238095238},{thermostat:27,heat_required:6180.280238095238},{thermostat:28,heat_required:6546.28023809524},{thermostat:29,heat_required:6912.28023809524}];function b(e,t){let o=v.filter((function(t){return t.thermostat==e}));o=o[0].heat_required;let r=v.filter((function(e){return e.thermostat==t}));return r=r[0].heat_required,r/o}let q={heating_kwh_per_day:function(e,t,o,r,s="kwh"){let n=u.convert_units(s,"kwh")*e*u.per("years/days");return n/=r,n*=b(t,o),n},_get_thermostat_adjustment:b};let j={electricity_kwh_per_day:function(e,t){let o=e*u.per("years/days");return o/=t,o}},E=[{type_of_stuff:"Aluminium drink cans","kwh_per_£":1.2,source:"https://www.withouthotair.com/c15/page_89.shtml",weight:.5},{type_of_stuff:"computers","kwh_per_£":1.8,source:"https://www.withouthotair.com/c15/page_89.shtml",weight:1},{type_of_stuff:"batteries","kwh_per_£":1.4/1.5,source:"https://www.withouthotair.com/c15/page_89.shtml",weight:.5},{type_of_stuff:"Newspapers","kwh_per_£":1,source:"https://www.withouthotair.com/c15/page_90.shtml",weight:1},{type_of_stuff:"car","kwh_per_£":155528/3/17500,source:"https://www.nimblefins.co.uk/average-cost-cars-uk and https://www.withouthotair.com/c15/page_90.shtml and http://energyskeptic.com/2015/how-much-energy-does-it-take-to-make-a-car-by-david-fridley-lbl/",weight:2},{type_of_stuff:"smartphone","kwh_per_£":1e3*u.convert_units("j","kwh")*1e6/250,source:"https://energyeducation.ca/encyclopedia/Embodied_energy",weight:1},{type_of_stuff:"laptop","kwh_per_£":45e8*u.convert_units("j","kwh")/1500,source:"https://energyeducation.ca/encyclopedia/Embodied_energy",weight:1},{type_of_stuff:"washing machine","kwh_per_£":39e8*u.convert_units("j","kwh")/450,source:"https://energyeducation.ca/encyclopedia/Embodied_energy",weight:1},{type_of_stuff:"fridge","kwh_per_£":59e8*u.convert_units("j","kwh")/500,source:"https://energyeducation.ca/encyclopedia/Embodied_energy",weight:1}];function O(){let e=E.reduce(((e,t)=>e+t.weight),0);return E.map((t=>t.weight/e*t["kwh_per_£"])).reduce(((e,t)=>e+t),0)}let L={_estimates:E,_get_average_kwh_per_pound_sterling:O,pounds_sterling_to_kwh:function(e){return e*O()}};e.convert=u,e.driving=h,e.eating=k,e.electricity=j,e.flying=d,e.heating=q,e.pets=m,e.shower_bath=l,e.stuff=L,e.utils=p,e.washing=f,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=/sm/a95a77c6edb061465c4cdfb69e382efd5e67f3f3861f8142fd9c3f50a78cb778.map