{"version":3,"sources":["ccc.png","Selection.js","App.js","serviceWorker.js","index.js"],"names":["module","exports","Selection","this","props","mode","currMode","dataSet","text","src","click","console","log","className","disabled","Object","entries","length","values","some","y","undefined","onClick","Component","google","window","axios","require","https","App","chart1","React","createRef","chart2","chart3","chart4","state","carType","homeToWorkHour","homeToWorkMinute","workToHomeHour","workToHomeMinute","homeLocation","workLocation","searchingHomeAddress","searchingWorkAddress","result","commuteDays","carAge","vehicleFuel","pending","handleChange","event","target","value","name","setState","handleSubmit","document","getElementById","classList","contains","options","url","method","headers","data","API_KEY","vehicle_age","parseInt","vehicle_type","vehicle_fuel","origin_lat","lat","origin_long","lng","destination_lat","destination_long","DTI_am","DTI_pm","commute_days","httpsAgent","Agent","rejectUnauthorized","then","response","options_details","catch","reason","error","remove","add","handlePlaceSelect","autocomlete","locationType","getPlace","geometry","location","prevProps","prevState","snapshot","successResult","filter","item","numberWithCommas","x","isNaN","toFixed","toString","replace","reduce","obj","split","pop","fuel_reduction","calories_burned","fuel_cost_reduction","system_congestion_reduction","emission_pollution_reduction","GHG_emission_reduction","accident_reduction","travel_time_per_day","travel_time_change","parking_cost_reduction","total_benefits","total_saving_cost","total_travel_time","maintainence_cost_reduction","long_travel_time_warning","graph","myChartRef","str","key","keys","map","k","parseFloat","Chart","type","labels","toLocaleLowerCase","datasets","label","join","txt","charAt","toUpperCase","substr","toLowerCase","backgroundColor","scales","yAxes","ticks","beginAtZero","maxTicksLimit","current","getContext","forEach","addressType","addEventListener","slice","geocoder","maps","Geocoder","address","geocode","results","status","formatted_address","substring","homeAddressAutocomplete","places","Autocomplete","workAddressAutocomplete","addListener","getHours","UIHour","i","push","style","fontSize","height","alt","href","CCCLogo","align","marginBottom","htmlFor","id","autoComplete","onChange","action","onSubmit","UICarAges","getCarAges","role","display","ref","Boolean","hostname","match","ReactDOM","render","navigator","serviceWorker","ready","registration","unregister"],"mappings":"8EAAAA,EAAOC,QAAU,IAA0B,iC,iSCCtBC,G,uLACT,IAAD,EA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BACIQ,UAAU,QACVJ,IAAI,gBACR,8BACK,IADL,iBAEmB,IACdF,EACGF,IAEAE,EACIF,GADJ,mBAIG,IAVX,oCAkBhB,yBACIQ,UAAU,YACVsK,MAAO,CACHiB,QACI7L,EAAQF,IACRE,EAAQF,GAAR,yBAGM,GACA,SAEd,yBACIQ,UAAU,QACVJ,IAAI,sBACR,kFAKR,OAiBZ,yBAAKI,UAAU,QAAQsK,MAAO,CAAEiB,QAAS,SACrC,yBAAKvL,UAAU,IACX,6BACI,4BACIwL,IAAKlM,KAAK2B,OACVqJ,MAAO,CACHiB,QAASjM,KAAKiC,MAAMU,OACd,GACA,YAKtB,yBAAKjC,UAAU,IACX,6BACI,4BACIwL,IAAKlM,KAAK8B,OACVkJ,MAAO,CACHiB,QAASjM,KAAKiC,MAAMU,OACd,GACA,YAMtB,yBAAKjC,UAAU,IACX,6BACI,4BACIwL,IAAKlM,KAAK+B,OACViJ,MAAO,CACHiB,QAASjM,KAAKiC,MAAMU,OACd,GACA,YAKtB,yBAAKjC,UAAU,IACX,6BACI,4BACIwL,IAAKlM,KAAKgC,OACVgJ,MAAO,CACHiB,QAASjM,KAAKiC,MAAMU,OACd,GACA,oB,GArkCpCf,IAAMR,WCAJ+K,QACW,cAA7B7K,OAAOwE,SAASsG,UAEe,UAA7B9K,OAAOwE,SAASsG,UAEhB9K,OAAOwE,SAASsG,SAASC,MACvB,2DCZNC,IAASC,OAAO,kBAAC,EAAD,MAAShJ,SAASC,eAAe,SD2H3C,kBAAmBgJ,WACrBA,UAAUC,cAAcC,MAAMzH,MAAK,SAAA0H,GACjCA,EAAaC,kB","file":"static/js/main.076e4e53.chunk.js","sourcesContent":["module.exports = __webpack_public_path__ + \"static/media/ccc.af44ff3a.png\";","import React, { Component } from \"react\";\nexport default class Selection extends Component {\n render() {\n const { mode, currMode, dataSet, text, src, click } = this.props;\n if (dataSet) console.log(dataSet[mode]);\n return (\n y === \"/\" || y == undefined)\n }\n onClick={click}\n >\n {text}\n \n );\n }\n}\n","import React from 'react';\nimport './App.css';\nimport CCCLogo from './ccc.png';\nimport Chart from 'chart.js';\n// import ChartDataLabels from 'chartjs-plugin-datalabels';\nimport 'react-tabs/style/react-tabs.css';\nimport Selection from './Selection.js';\nconst google = window.google;\nconst axios = require('axios');\nconst https = require('https');\n// const dt = require(\"datatables.net\");\n\nclass App extends React.Component {\n chart1 = React.createRef();\n chart2 = React.createRef();\n chart3 = React.createRef();\n chart4 = React.createRef();\n state = {\n carType: 'Passenger Car',\n homeToWorkHour: 8,\n homeToWorkMinute: 0,\n workToHomeHour: 17,\n workToHomeMinute: 0,\n homeLocation: null,\n workLocation: null,\n searchingHomeAddress: false,\n searchingWorkAddress: false,\n result: null,\n commuteDays: 5,\n carAge: 5,\n vehicleFuel: 'gasoline',\n pending: false,\n dataSet: {},\n mode: 'Carpooling',\n // homeAddress: '',\n // workAddress: '',\n };\n\n handleChange = (event) => {\n const target = event.target;\n const value = target.value;\n const name = target.name;\n\n this.setState({\n [name]: value,\n });\n };\n\n handleSubmit = () => {\n if (\n document\n .getElementById('homeAddress')\n .classList.contains('is-invalid') ||\n document\n .getElementById('workAddress')\n .classList.contains('is-invalid')\n ) {\n return;\n }\n if (!this.state.homeLocation || !this.state.workLocation) {\n if (!this.state.homeLocation) {\n document\n .getElementById('homeAddress')\n .classList.add('is-invalid');\n } else {\n document\n .getElementById('homeAddress')\n .classList.remove('is-invalid');\n }\n if (!this.state.workLocation) {\n document\n .getElementById('workAddress')\n .classList.add('is-invalid');\n } else {\n document\n .getElementById('workAddress')\n .classList.remove('is-invalid');\n }\n } else {\n this.setState({\n pending: true,\n result: null,\n });\n\n const jsonToBeSubmitted = {\n API_KEY: 'CO4jnjOMGIba_K-tKSqysw',\n vehicle_age: parseInt(this.state.carAge),\n vehicle_type: this.state.carType,\n vehicle_fuel: this.state.vehicleFuel,\n origin_lat: this.state.homeLocation.lat,\n origin_long: this.state.homeLocation.lng,\n destination_lat: this.state.workLocation.lat,\n destination_long: this.state.workLocation.lng,\n DTI_am: `${this.state.homeToWorkHour}:${this.state.homeToWorkMinute}`,\n DTI_pm: `${this.state.workToHomeHour}:${this.state.workToHomeMinute}`,\n commute_days: parseInt(this.state.commuteDays),\n };\n\n let url = 'https://incentripapi.com:5070/emission_calculation';\n\n const options = {\n url,\n method: 'POST',\n headers: {\n 'Access-Control-Allow-Origin': '*',\n // \"Access-Control-Request-Method\": \"POST\",\n 'Content-Type': 'application/json',\n },\n data: jsonToBeSubmitted,\n httpsAgent: new https.Agent({\n rejectUnauthorized: false,\n }),\n };\n\n axios(options)\n .then((response) => {\n this.setState({\n pending: false,\n result: response.data.options_details,\n });\n })\n .catch((reason) => console.error(reason));\n // (\"submitted Json\", jsonToBeSubmitted);\n }\n };\n\n componentDidUpdate(prevProps, prevState, snapshot) {\n // (this.state.result);\n let dataSet;\n if (this.state.result && prevState.result !== this.state.result) {\n let successResult = this.state.result.filter(\n (item) => item['option_status'] === 'succeed'\n );\n let numberWithCommas = (x) => {\n return isNaN(x)\n ? x\n : x\n .toFixed(0)\n .toString()\n .replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n };\n dataSet = successResult\n .filter(\n (item) =>\n item['option_result'][0]['option_name'] !== 'Driving'\n )\n .reduce((obj, item) => {\n const option_name = item['option_result'][0]['option_name']\n .split(' ')\n .pop();\n // (item);\n obj[option_name] = {\n fuel_reduction: numberWithCommas(\n item['option_result'][0]['fuel_reduction (gallon)']\n ),\n calories_burned: numberWithCommas(\n item['option_result'][0]['calories_burned (cal)']\n ),\n fuel_cost_reduction: numberWithCommas(\n item['option_result'][0]['fuel_cost_reduction ($)']\n ),\n system_congestion_reduction: numberWithCommas(\n item['option_result'][0][\n 'system_congestion_reduction ($)'\n ]\n ),\n emission_pollution_reduction: numberWithCommas(\n item['option_result'][0][\n 'emission_pollution_reduction ($)'\n ]\n ),\n GHG_emission_reduction: numberWithCommas(\n item['option_result'][0][\n 'GHG_emission_reduction ($)'\n ]\n ),\n accident_reduction: numberWithCommas(\n item['option_result'][0]['accident_reduction ($)']\n ),\n travel_time_per_day: numberWithCommas(\n item['option_result'][0][\n 'travel_time_per_day (min)'\n ]\n ),\n travel_time_change: numberWithCommas(\n item['option_result'][0]['travel_time_change (h)']\n ),\n parking_cost_reduction: numberWithCommas(\n item['option_result'][0][\n 'parking_cost_reduction ($)'\n ]\n ),\n total_benefits: numberWithCommas(\n item['option_result'][0]['total_benefits ($)']\n ),\n total_saving_cost: numberWithCommas(\n item['option_result'][0]['total saving cost ($)']\n ),\n total_travel_time: numberWithCommas(\n item['option_result'][0]['total travel time (h)']\n ),\n maintainence_cost_reduction: numberWithCommas(\n item['option_result'][0][\n 'maintainence_cost_reduction ($)'\n ]\n ),\n long_travel_time_warning:\n item['option_result'][0][\n 'long_travel_time_warning'\n ] > 0,\n };\n return obj;\n }, {});\n this.setState({ dataSet });\n } else {\n dataSet = this.state.dataSet;\n }\n if (\n prevState.mode !== this.state.mode ||\n (prevState.mode === 'Carpooling' && this.state.result)\n ) {\n const { mode } = this.state;\n const graph = (myChartRef, dataSet, text) => {\n const split = text.split(' ');\n const key = split[0];\n const toProperCase = (str) => {\n return str.replace(/\\w\\S*/g, function (txt) {\n return (\n txt.charAt(0).toUpperCase() +\n txt.substr(1).toLowerCase()\n );\n });\n };\n let keys = [\n 'Carpooling',\n 'Biking',\n 'Walking',\n 'Multimodal',\n 'transit',\n 'hours',\n 'week',\n ];\n // (dataSet);\n keys = keys.filter(\n (x) =>\n dataSet[x] &&\n !Object.values(dataSet[x]).some(\n (y) => y === '/' || y == undefined\n )\n );\n const data = keys.map((k) =>\n parseFloat(dataSet[k][key].replace(/,/g, ''))\n );\n // (keys);\n new Chart(myChartRef, {\n type: 'bar',\n data: {\n labels: keys.map(function (x) {\n if (x[0] != x[0].toLocaleLowerCase()) {\n return x[0];\n } else {\n if (x == 'transit') {\n return 'T';\n } else if (x == 'hours') {\n return 'O';\n } else {\n return 'R';\n }\n }\n }),\n datasets: [\n {\n label: (\n toProperCase(key.split('_').join(' ')) +\n ' ' +\n split[1]\n ).replace(\n 'Total Saving Cost',\n 'Total Cost-saving'\n ),\n data: data,\n backgroundColor: keys.map((k) =>\n k === mode ? 'lightblue' : 'grey'\n ),\n },\n ],\n },\n options: {\n scales: {\n yAxes: [\n {\n ticks: {\n beginAtZero: true,\n maxTicksLimit: 5,\n },\n },\n ],\n },\n },\n });\n };\n\n let myChartRef = this.chart1.current.getContext('2d');\n graph(myChartRef, dataSet, 'calories_burned (cal)');\n myChartRef = this.chart2.current.getContext('2d');\n graph(myChartRef, dataSet, 'total_benefits ($)');\n myChartRef = this.chart3.current.getContext('2d');\n graph(myChartRef, dataSet, 'total_travel_time (h)');\n myChartRef = this.chart4.current.getContext('2d');\n graph(myChartRef, dataSet, 'total_saving_cost ($)');\n }\n }\n\n componentDidMount() {\n ['homeAddress', 'workAddress'].forEach((addressType) => {\n document\n .getElementById(addressType)\n .addEventListener('focus', (event) => {\n // (addressType);\n document\n .getElementById(addressType)\n .classList.remove('is-invalid');\n });\n\n document\n .getElementById(addressType)\n .addEventListener('focusout', (event) => {\n this.setState({\n ['searching' +\n addressType.charAt(0).toUpperCase() +\n addressType.slice(1)]: true,\n });\n\n const geocoder = new google.maps.Geocoder();\n const address = document.getElementById(addressType).value;\n geocoder.geocode(\n { address: address },\n (results, status) => {\n this.setState({\n ['searching' +\n addressType.charAt(0).toUpperCase() +\n addressType.slice(1)]: false,\n });\n\n if (status === 'OK') {\n // (results);\n // (results[0].geometry.location);\n const location = results[0].geometry.location;\n event.target.value =\n results[0].formatted_address;\n this.setState({\n [addressType.substring(0, 4) + 'Location']:\n {\n lat: location.lat(),\n lng: location.lng(),\n },\n });\n document\n .getElementById(addressType)\n .classList.remove('is-invalid');\n } else {\n document\n .getElementById(addressType)\n .classList.add('is-invalid');\n }\n }\n );\n });\n });\n\n const homeAddressAutocomplete = new google.maps.places.Autocomplete(\n document.getElementById('homeAddress')\n );\n const workAddressAutocomplete = new google.maps.places.Autocomplete(\n document.getElementById('workAddress')\n );\n homeAddressAutocomplete.addListener('place_changed', () =>\n this.handlePlaceSelect(homeAddressAutocomplete, 'homeLocation')\n );\n workAddressAutocomplete.addListener('place_changed', () =>\n this.handlePlaceSelect(workAddressAutocomplete, 'workLocation')\n );\n }\n\n handlePlaceSelect = (autocomlete, locationType) => {\n // (autocomlete);\n // (autocomlete.getPlace().formatted_address);\n if (autocomlete.getPlace().geometry) {\n this.setState({\n [locationType]: {\n lat: autocomlete.getPlace().geometry.location.lat(),\n lng: autocomlete.getPlace().geometry.location.lng(),\n },\n });\n }\n };\n\n render() {\n const { result, mode, dataSet } = this.state;\n // (dataSet);\n\n const getHours = () => {\n const UIHour = [];\n for (let i = 0; i <= 23; i++) {\n UIHour.push(\n \n );\n }\n return UIHour;\n };\n\n const getCarAges = () => {\n const UICarAges = [];\n for (let i = 1; i <= 20; i++) {\n UICarAges.push(\n \n );\n }\n return UICarAges;\n };\n\n // let resultTable = null;\n // if (this.state.result) {\n // resultTable = (\n //
\n // \n // \n // \n // \n // \n // {/* */}\n // \n // \n // \n // \n // \n // \n // \n // {/* \n // \n // \n // */}\n // \n // \n //
\n // \n // User Benefits\n // \n // System Benefits\n //
ChoicesMonthly Fuel Saving (gallon)Monthly Fuel Cost Saving ($)Daily Trip Travel Time (min)Daily Travel Time Change (min)Monthly System Delay Benefits ($)\n // Monthly Emission Pollution Benefits ($) *\n // \n // Monthly Emission GHG Benefits ($)*\n // \n // Monthly Accident Benefits ($)**\n //
\n // {/*
\n // * Emission pollution (GHG) benefits = Monthly VMT\n // reduction * Emission pollution (GHG) per VMT * $ cost per ton of\n // emission pollution (GHG)\n //
\n //
\n // ** Safety benefits = Monthly VMT reduction * Expected\n // accidents per 100M VMT * $ cost per accident\n //
*/}\n //
\n // );\n // }\n let text = `By changing mode to ${this.state.mode\n .toLocaleLowerCase()\n .replace('hours', 'commuting off-peak')\n .replace('carpooling', 'carpool-vanpool')}`;\n if (this.state.mode == 'week') text = 'By reducing one commute day';\n if (this.state.mode == 'hours') text = 'By commuting off-peak';\n\n return (\n
\n
\n \n
\n\n
\n
\n \n \n \n
\n

\n \n What is Commuter Choice Maryland?\n \n
\n
\n {/* \n Commuter Choice Maryland is the Maryland Department of\n Transportation's (MDOT) Travel Demand Management Program. This\n program enables MDOT to address key goals, objectives, and\n strategies that will maximize traveler choices, and deliver\n transportation solutions and services that can reduce congestion,\n conserve energy, protect the environment, facilitate economic\n opportunity, enhance the quality of life for everyone while saving\n you money and reducing stress. */}\n \n Are you considering a smarter commute? This\n commuter calculator will determine the best\n commute options for you and how much money\n you can save on gas, vehicle maintenance\n cost, parking cost savings, including\n environmental benefits by switching to a\n carpool, vanpool, transit, telework, commute\n during off-peak times, bike, or walk option\n one or more times a week. Simply input your\n home and work addresses, car information,\n preferred departure time, and number of days\n you commute to work per week and let the\n calculator show you your options! If you\n have questions, please reach out to a\n Commuter Choice Maryland representative at{' '}\n \n commuterchoice@mdot.maryland.gov{' '}\n \n or 410-865-1100.\n \n

\n
\n
\n \n \n Address \n \n
\n
\n
\n \n Note: You may add exact address, nearby\n intersection, landmark or zip code.\n \n
\n
\n
\n \n {this.state.searchingHomeAddress ? (\n \n ) : null}\n \n
\n Invalid Address\n
\n
\n
\n
\n
\n \n {this.state.searchingWorkAddress ? (\n \n ) : null}\n \n
\n Invalid Address\n
\n
\n
\n
\n\n \n \n Preferred Departure Time{' '}\n \n \n
\n
\n
\n
\n \n
\n \n {getHours()}\n \n \n :\n \n \n \n \n \n \n \n
\n
\n
\n
\n
\n \n
\n \n {getHours()}\n \n \n :\n \n \n \n \n \n \n \n
\n
\n
\n
\n\n \n \n Number of Days You Commute to Work Location Every\n Week \n \n \n
\n
\n
\n \n \n \n \n \n \n \n
\n
\n
\n\n \n \n \n Vehicle Information{' '}\n \n \n \n
\n
\n
\n \n \n \n \n \n \n \n \n
\n
\n\n
\n
\n \n \n {getCarAges()}\n \n
\n
\n
\n
\n \n \n \n \n \n \n \n
\n
\n
\n\n
\n \n {!this.state.pending ? 'Submit' : 'Loading...'}\n \n
\n \n \n {this.state.pending ? (\n
\n
\n Loading...\n
\n
\n ) : (\n
\n
\n \n this.setState({ mode: 'Carpooling' })\n }\n text={\n \n Carpool - Vanpool\n \n }\n />\n this.setState({ mode: 'Biking' })}\n text={'Biking'}\n />\n this.setState({ mode: 'Walking' })}\n text={'Walking'}\n />\n \n this.setState({ mode: 'Multimodal' })\n }\n text={'Multimodal'}\n />\n {/* */}\n this.setState({ mode: 'transit' })}\n text={'Transit'}\n />\n this.setState({ mode: 'hours' })}\n text={'Commute Off-Peak'}\n />\n this.setState({ mode: 'week' })}\n text={'Telework'}\n />\n {/* */}\n
\n \n
\n
\n {this.state.result ? (\n
\n
\n \n {text} you could save\n monthly:\n \n
\n
\n \n \n {` $${\n dataSet[mode] &&\n dataSet[mode][\n 'fuel_cost_reduction'\n ]\n } in fuel cost`}\n \n
\n
\n \n {` $${\n dataSet[mode] &&\n dataSet[mode][\n 'maintainence_cost_reduction'\n ]\n } in vehicle maintainence cost`}\n
\n
\n \n \n {` $${\n dataSet[mode] &&\n dataSet[mode][\n 'parking_cost_reduction'\n ]\n } in parking cost`}\n \n
\n
\n \n You could create annually\n environmental benefits:{' '}\n \n
\n
\n \n \n {` $${\n dataSet[mode] &&\n dataSet[mode][\n 'emission_pollution_reduction'\n ]\n } in emissions pollution reduction`}\n \n
\n
\n \n \n {` $${\n dataSet[mode] &&\n dataSet[mode][\n 'GHG_emission_reduction'\n ]\n } in GHG emissions reduction`}\n \n
\n
\n {dataSet[mode] &&\n dataSet[mode][\n 'calories_burned'\n ] &&\n dataSet[mode][\n 'calories_burned'\n ] > 0 && (\n \n \n \n You could burn{' '}\n {dataSet[\n mode\n ] &&\n dataSet[\n mode\n ][\n 'calories_burned'\n ]}{' '}\n additional\n calories daily\n \n \n )}\n
\n
\n {dataSet[mode] &&\n dataSet[mode][\n 'travel_time_change'\n ] &&\n dataSet[mode][\n 'travel_time_change'\n ] > 5 && (\n \n \n \n {' '}\n You could save{' '}\n {dataSet[\n mode\n ] &&\n dataSet[\n mode\n ][\n 'travel_time_change'\n ]}{' '}\n minutes of\n travel time\n monthly\n \n \n )}\n
\n \n \n \n {`Attention: this option has high travel time!`}\n \n
\n
\n ) : null}\n
\n\n {/*
\n \n
*/}\n
\n
\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n
\n \n \n )}\n \n );\n }\n}\n\nexport default App;\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.1/8 is considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\nexport function register(config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit https://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl, config) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl)\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf('javascript') === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister();\n });\n }\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport * as serviceWorker from './serviceWorker';\n\nReactDOM.render(, document.getElementById('root'));\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"],"sourceRoot":""}