{"version":3,"sources":["Logo.js","theme.js","gapi.js","msg.js","pattern.js","Chart.js","RegexField.js","PatternTable.js","Snackbar.js","Dialog.js","CustomAnalyzer.js","Settings.js","App.js","serviceWorker.js","index.js"],"names":["Logo","props","react_default","a","createElement","xmlns","viewBox","version","style","id","transform","points","fill","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontFamily","theme","createMuiTheme","palette","primary","light","orange","main","dark","contrastText","typography","useNextVariants","gapi_base","GApiError","Object","freeze","invalidSyncToken","Symbol","notLoggedIn","notLoggedOut","otherError","to_params","dict","entries","filter","_ref","_ref2","slicedToArray","map","_ref3","_ref4","k","v","concat","encodeURIComponent","join","loggedIn","_getAuthToken","interactive","arguments","length","undefined","Promise","resolver","chrome","identity","getAuthToken","token","runtime","lastError","then","_ref5","_ref6","getLoggedIn","catch","resolve","b","logout","fetch","method","async","response","status","removeCachedAuthToken","_removeCachedAuthToken","getCalendars","access_token","json","data","items","getColors","_updatePatterns","_getPatterns","_updateCalendars","_getCalendars","_getCalEvents","msgType","updatePatterns","getPatterns","updateCalendars","getCalEvents","stringifyMsgType","mt","console","error","Msg","type","classCallCheck","this","createClass","key","value","inflate","obj","s","parseMsgType","MsgClient","channelName","_this","sendMsg","cb","rcb","requestCallback","pm","ids","pop","maxId","inFlight","port","postMessage","deflate","connect","name","onMessage","addListener","msg","log","assert","push","Pattern","isRegex","label","get","RegExp","emptyPattern","anyPattern","revive","PatternEntry","idx","calPattern","eventPattern","cal","event","defaultPatternEntry","customizedLabel","cx","cy","x","y","anchor","dx","dy","textAnchor","withStyles","pieChart","margin","Grid_default","container","spacing","item","xs","lg","className","classes","patternTableWrapper","PieChart","width","height","Pie","patternGraphData","dataKey","outerRadius","deepOrange","Tooltip","formatter","toFixed","calendarGraphData","innerRadius","cyan","d","i","Cell","color","RegexField","pitems","options","p0","isEmpty","MenuItem_default","fieldRegex","fieldNoRegex","FormControl_default","Select_default","onChange","target","TextField_default","React","Component","RegexFieldWithStyles","marginRight","patternHead","field","elem","TextField","withTheme","calendars","any","PatternTable","state","page","rowsPerPage","activePattern","handleChangePage","setState","handleChangeRowsPerPage","_this2","_this$props","patterns","_this$state","nDummy","Math","min","rows","slice","p","TableRow_default","onMouseOver","onMouseOut","CustomText","TableCell_default","onUpdatePattern","deleteButtonShow","deleteButtonHide","DeleteOutlined_default","deleteIcon","onClick","onRemovePattern","Table_default","patternTable","TableHead_default","TableBody_default","colSpan","TablePagination_default","rowsPerPageOptions","component","count","backIconButtonProps","aria-label","nextIconButtonProps","onChangePage","onChangeRowsPerPage","position","right","display","cursor","overflowX","overflowY","minWidth","variantIcon","ErrorIcon","warning","WarningIcon","backgroundColor","amber","icon","iconVariant","opacity","unit","message","alignItems","variant","open","onClose","other","objectWithoutProperties","Icon","Snackbar_default","anchorOrigin","vertical","horizontal","autoHideDuration","SnackbarContent_default","assign","classNames","aria-describedby","action","IconButton_default","close","Close_default","Transition","Slide_default","direction","AlertDialog","Dialog_default","TransitionComponent","keepMounted","handleClose","aria-labelledby","DialogTitle_default","title","DialogContent_default","DialogContentText_default","DialogActions_default","Button_default","default_chart_data","CustomAnalyzer","possibleConstructorReturn","getPrototypeOf","call","startDate","endDate","snackBarOpen","snackBarMsg","snackBarVariant","dialogOpen","dialogMsg","updatePattern","msgClient","removePattern","splice","newPattern","toConsumableArray","loadPatterns","start","end","getTime","e","Date","analyze","startOf","toDate","event_pms","cals","_loop","calName","regex","test","filterPatterns","r","events","all","all_events","results","cal_results","forEach","_loop2","summary","hasOwnProperty","duration","background","handleSnackbarOpen","reset","handleDialogOpen","ans","default","keys","handleSnackbarClose","reason","dialogPromiseResolver","handleDialogClose","result","enabledOnly","gapi","src_Dialog","src_Snackbar","md","fullWidth","FormGroup_default","Typography_default","gutterBottom","marginBottom","marginLeft","AddCircle_default","src_PatternTable","textAlign","react_dates","startDateId","endDateId","onDatesChange","focusedInput","onFocusChange","isOutsideRange","buttonSpacer","Chart","STableCell","body","TableCell","CompactListItem","dense","paddingTop","paddingBottom","ListItem","Settings","isLoggedIn","handleLogin","loadAll","handleLogout","handleToggleCalendar","objectSpread","enabled","loadDefaultPatterns","colors","calendar","colorId","loadCalendars","tableHead","tableContent","disabled","Refresh_default","List_default","calendarList","disableGutters","button","Checkbox_default","checked","disableRipple","ListItemText_default","verticalAlign","lineHeight","maxWidth","maxHeight","styles","root","appBar","zIndex","drawer","transition","transitions","create","easing","sharp","leavingScreen","flexGrow","appBarSpacer","mixins","toolbar","content","padding","overflow","indicator","DashboardTabs","handleChangeTab","currentTab","history","AppBar_default","Toolbar_default","noWrap","Tabs_default","location","pathname","Tab_default","Link","to","CssBaseline_default","Route","exact","path","render","Redirect","Dashboard","Tabs","withRouter","core_styles","HashRouter","Boolean","window","hostname","match","ReactDOM","App","document","getElementById","navigator","serviceWorker","ready","registration","unregister"],"mappings":"6XACeA,EAAA,SAACC,GAAD,OACbC,EAAAC,EAAAC,cAAA,OACGC,MAAM,6BACNC,QAAQ,0BACRC,QAAQ,MACRC,MAAOP,EAAMO,OACdN,EAAAC,EAAAC,cAAA,KAAGK,GAAG,MACHC,UAAU,gCACXR,EAAAC,EAAAC,cAAA,KAAGK,GAAG,OACJP,EAAAC,EAAAC,cAAA,KACGK,GAAG,OACJP,EAAAC,EAAAC,cAAA,WACGK,GAAG,WACHE,OAAO,mGACPH,MAAO,CAACI,KAAM,aACjBV,EAAAC,EAAAC,cAAA,KACGK,GAAG,MACHC,UAAU,kCACXR,EAAAC,EAAAC,cAAA,QACGK,GAAG,QACFD,MAAO,CAACK,UAAU,SACdC,YAAY,SACZC,WAAW,SACXC,YAAY,SACZC,SAAS,GACTC,WAAW,8BACXN,KAAK,WACVF,UAAU,2BATb,8BCFGS,EAdDC,yBAAe,CACzBC,QAAS,CACLC,QAAS,CACLC,MAAOC,IAAO,KACdC,KAAMD,IAAO,KACbE,KAAMF,IAAO,KACbG,aAAc,SAGtBC,WAAY,CACRC,iBAAiB,uKCXnBC,UAAY,0CAEZC,EAAYC,OAAOC,OAAO,CAC5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,GAAX5Q,CAAmB+R,KACzC,OACI9b,EAAAC,EAAAC,cAACkd,EAAA,iBAAD,CAAkBnc,MAAOA,GACrBjB,EAAAC,EAAAC,cAACmd,EAAA,EAAD,KAAQrd,EAAAC,EAAAC,cAACgd,EAAD,eANAxQ,IAAMC,WC3EV2Q,QACW,cAA7BC,OAAOjB,SAASkB,UAEe,UAA7BD,OAAOjB,SAASkB,UAEhBD,OAAOjB,SAASkB,SAASC,MACvB,2DCbNC,IAASX,OAAO/c,EAAAC,EAAAC,cAACyd,GAAD,MAASC,SAASC,eAAe,SD4H3C,kBAAmBC,WACrBA,UAAUC,cAAcC,MAAM9Z,KAAK,SAAA+Z,GACjCA,EAAaC","file":"static/js/main.e5c342f4.chunk.js","sourcesContent":["import React from 'react';\nexport default (props) =>\n \n \n \n \n \n \n Cr\n \n \n \n \n \n","import { createMuiTheme } from '@material-ui/core/styles';\nimport orange from '@material-ui/core/colors/orange';\n\nconst theme = createMuiTheme({\n palette: {\n primary: {\n light: orange[300],\n main: orange[500],\n dark: orange[700],\n contrastText: \"#fff\"\n }\n },\n typography: {\n useNextVariants: true,\n }\n});\n\nexport default theme;\n","/* global chrome */\nimport LRU from \"lru-cache\";\nconst gapi_base = 'https://www.googleapis.com/calendar/v3';\n\nconst GApiError = Object.freeze({\n invalidSyncToken: Symbol(\"invalidSyncToken\"),\n notLoggedIn: Symbol(\"notLoggedIn\"),\n notLoggedOut: Symbol(\"notLoggedOut\"),\n otherError: Symbol(\"otherError\"),\n});\n\nfunction to_params(dict) {\n return Object.entries(dict).filter(([k, v]) => v).map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`).join('&');\n}\n\nlet loggedIn = null;\n\nfunction _getAuthToken(interactive = false) {\n return new Promise(resolver =>\n chrome.identity.getAuthToken(\n { interactive }, token => resolver([token, !chrome.runtime.lastError])))\n .then(([token, ok]) => {\n if (ok) return token;\n else throw GApiError.notLoggedIn;\n });\n}\n\nfunction _removeCachedAuthToken(token) {\n return new Promise(resolver =>\n chrome.identity.removeCachedAuthToken({ token }, () => resolver()));\n}\n\nexport function getLoggedIn() {\n if (loggedIn === null)\n {\n return _getAuthToken(false)\n .then(() => loggedIn = true)\n .catch(() => loggedIn = false)\n .then(() => loggedIn);\n }\n else return Promise.resolve(loggedIn);\n}\n\nexport function getAuthToken() {\n return getLoggedIn().then(b => {\n if (b) return _getAuthToken(false);\n else throw GApiError.notLoggedIn;\n });\n}\n\nexport function login() {\n return getLoggedIn().then(b => {\n if (!b) return _getAuthToken(true).then(() => loggedIn = true);\n else throw GApiError.notLoggedOut;\n });\n}\n\nexport function logout() {\n return getAuthToken().then(token => {\n return fetch(`https://accounts.google.com/o/oauth2/revoke?${to_params({ token })}`,\n { method: 'GET', async: true }).then(response => {\n if (response.status === 200)\n return _removeCachedAuthToken(token);\n else throw GApiError.otherError;\n });\n }).then(() => loggedIn = false);\n}\n\nexport function getCalendars(token) {\n return fetch(`${gapi_base}/users/me/calendarList?${to_params({access_token: token})}`,\n { method: 'GET', async: true })\n .then(response => response.json())\n .then(data => data.items);\n}\n\nexport function getColors(token) {\n return fetch(`${gapi_base}/colors?${to_params({access_token: token})}`,\n { method: 'GET', async: true })\n .then(response => response.json());\n}\n\nfunction getEvent(calId, eventId, token) {\n return fetch(`${gapi_base}/calendars/${calId}/events/${eventId}?${to_params({access_token: token})}`,\n { method: 'GET', async: true })\n .then(response => response.json());\n}\n\nfunction getEvents(calId, token, syncToken=null, timeMin=null, timeMax=null, resultsPerRequest=100) {\n let results = [];\n const singleFetch = (pageToken, syncToken) => fetch(`${gapi_base}/calendars/${calId}/events?${to_params({\n access_token: token,\n pageToken,\n syncToken,\n timeMin,\n timeMax,\n maxResults: resultsPerRequest\n })}`, { method: 'GET', async: true })\n .then(response => {\n if (response.status === 200)\n return response.json();\n else if (response.status === 410)\n throw GApiError.invalidSyncToken;\n else throw GApiError.otherError;\n })\n .then(data => {\n results.push(...data.items);\n if (data.nextPageToken) {\n return singleFetch(data.nextPageToken, '');\n } else {\n return ({\n nextSyncToken: data.nextSyncToken,\n results\n });\n }\n })\n\n return singleFetch('', syncToken);\n}\n\nexport class GCalendar {\n constructor(calId, name, options={maxCachedItems: 100, nDaysPerSlot: 10, largeQuery: 10}) {\n this.calId = calId;\n this.name = name;\n this.syncToken = '';\n this.cache = new LRU({\n max: options.maxCachedItems,\n dispose: (k, v) => this.onRemoveSlot(k, v)\n });\n this.eventMeta = {};\n this.options = options;\n this.divider = 8.64e7 * this.options.nDaysPerSlot;\n }\n\n get token() { return getAuthToken(); }\n\n dateToCacheKey(date) {\n return Math.floor(date / this.divider);\n }\n\n dateRangeToCacheKeys(range) {\n return {\n start: this.dateToCacheKey(range.start),\n end: this.dateToCacheKey(new Date(range.end.getTime() - 1))\n };\n }\n\n getSlot(k) {\n if (!this.cache.has(k))\n {\n let res = {};\n this.cache.set(k, res);\n return res;\n }\n else return this.cache.get(k);\n }\n\n onRemoveSlot(k, v) {\n for (let id in v) {\n console.assert(this.eventMeta[id]);\n let keys = this.eventMeta[id].keys;\n keys.delete(k);\n if (keys.size === 0)\n delete this.eventMeta[id];\n }\n }\n\n slotStartDate(k) { return new Date(k * this.divider); }\n slotEndDate(k) { return new Date((k + 1) * this.divider); }\n\n addEvent(e, evict = false) {\n //console.log('adding event', e);\n if (this.eventMeta.hasOwnProperty(e.id))\n this.removeEvent(e);\n let r = this.dateRangeToCacheKeys(e);\n let ks = r.start;\n let ke = r.end;\n let t = this.cache.length;\n let keys = new Set();\n for (let i = ks; i <= ke; i++)\n {\n keys.add(i);\n if (!this.cache.has(i)) t++;\n }\n this.eventMeta[e.id] = {\n keys,\n summary: e.summary,\n };\n if (!evict && t > this.options.maxCachedItems) return;\n if (ks === ke)\n this.getSlot(ks)[e.id] = {\n start: e.start,\n end: e.end,\n id: e.id };\n else\n {\n this.getSlot(ks)[e.id] = {\n start: e.start,\n end: this.slotEndDate(ks),\n id: e.id };\n this.getSlot(ke)[e.id] = {\n start: this.slotStartDate(ke),\n end: e.end,\n id: e.id };\n for (let k = ks + 1; k < ke; k++)\n this.getSlot(k)[e.id] = {\n start: this.slotStartDate(k),\n end: this.slotEndDate(k),\n id: e.id};\n }\n }\n\n removeEvent(e) {\n let keys = this.eventMeta[e.id].keys;\n console.assert(keys);\n keys.forEach(k => delete this.getSlot(k)[e.id]);\n delete this.eventMeta[e.id];\n }\n\n getSlotEvents(k, start, end) {\n let s = this.getSlot(k);\n //console.log(s);\n let results = [];\n for (let id in s) {\n if (!(s[id].start >= end || s[id].end <= start))\n {\n results.push({\n id,\n start: s[id].start < start ? start: s[id].start,\n end: s[id].end > end ? end: s[id].end,\n summary: this.eventMeta[id].summary\n });\n }\n }\n return results;\n }\n\n getCachedEvents(_r) {\n let r = this.dateRangeToCacheKeys(_r);\n let ks = r.start;\n let ke = r.end;\n let results = this.getSlotEvents(ks, _r.start, _r.end);\n for (let k = ks + 1; k < ke; k++)\n {\n let s = this.getSlot(k);\n for (let id in s)\n results.push(s[id]);\n }\n if (ke > ks)\n results.push(...this.getSlotEvents(ke, _r.start, _r.end));\n return results;\n }\n\n sync() {\n return this.token.then(token => getEvents(this.calId, token, this.syncToken).then(r => {\n let pms = r.results.map(e => e.start ? Promise.resolve(e) : getEvent(this.calId, e.id, token));\n return Promise.all(pms).then(results => {\n results.forEach(e => {\n e.start = new Date(e.start.dateTime);\n e.end = new Date(e.end.dateTime);\n if (e.status === 'confirmed')\n this.addEvent(e);\n else if (e.status === 'cancelled')\n this.removeEvent(e);\n });\n this.syncToken = r.nextSyncToken;\n });\n })).catch(e => {\n if (e === GApiError.invalidSyncToken) {\n this.syncToken = '';\n this.sync();\n } else throw e;\n });\n }\n\n getEvents(start, end) {\n let r = this.dateRangeToCacheKeys({ start, end });\n let query = {};\n for (let k = r.start; k <= r.end; k++)\n if (!this.cache.has(k))\n {\n if (!query.hasOwnProperty('start'))\n query.start = k;\n query.end = k;\n }\n console.log(`start: ${start} end: ${end}`);\n if (query.hasOwnProperty('start'))\n {\n console.assert(query.start <= query.end);\n if (query.end - query.start + 1 > this.options.largeQuery) {\n console.log(`encounter large query, use direct fetch`);\n return this.token.then(token => getEvents(this.calId, token, null,\n start.toISOString(), end.toISOString()).then(r => {\n let results = [];\n r.results.forEach(e => {\n console.assert(e.start);\n e.start = new Date(e.start.dateTime);\n e.end = new Date(e.end.dateTime);\n results.push(e);\n });\n return results.filter(e => !(e.start >= end || e.end <= start)).map(e => {\n return {\n id: e.id,\n start: e.start < start ? start: e.start,\n end: e.end > end ? end: e.end,\n summary: e.summary,\n };\n });\n }));\n }\n\n console.log(`fetching short event list`);\n return this.token.then(token => getEvents(this.calId, token, null,\n this.slotStartDate(query.start).toISOString(),\n this.slotEndDate(query.end).toISOString()).then(r => {\n r.results.forEach(e => {\n if (e.status === 'confirmed')\n {\n console.assert(e.start);\n e.start = new Date(e.start.dateTime);\n e.end = new Date(e.end.dateTime);\n this.addEvent(e, true);\n }\n });\n if (this.syncToken === '')\n this.syncToken = r.nextSyncToken;\n })).then(() => this.sync())\n .then(() => this.getCachedEvents({ start, end }));\n }\n else\n {\n console.log(`cache hit`);\n return this.sync().then(() => this.getCachedEvents({ start, end }));\n }\n }\n}\n","/* global chrome */\nconst _updatePatterns = \"updatePatterns\";\nconst _getPatterns = \"getPatterns\";\nconst _updateCalendars = \"updateCalendars\";\nconst _getCalendars = \"getCalendars\";\nconst _getCalEvents = \"getCalEvents\";\n\nexport const msgType = Object.freeze({\n updatePatterns: Symbol(_updatePatterns),\n getPatterns: Symbol(_getPatterns),\n updateCalendars: Symbol(_updateCalendars),\n getCalendars: Symbol(_getCalendars),\n getCalEvents: Symbol(_getCalEvents),\n});\n\nfunction stringifyMsgType(mt) {\n switch (mt) {\n case msgType.updatePatterns: return _updatePatterns;\n case msgType.getPatterns: return _getPatterns;\n case msgType.updateCalendars: return _updateCalendars;\n case msgType.getCalendars: return _getCalendars;\n case msgType.getCalEvents: return _getCalEvents;\n default: console.error(\"unreachable\");\n }\n}\n\nfunction parseMsgType(s) {\n switch(s) {\n case _updatePatterns: return msgType.updatePatterns;\n case _getPatterns: return msgType.getPatterns;\n case _updateCalendars: return msgType.updateCalendars;\n case _getCalendars: return msgType.getCalendars;\n case _getCalEvents: return msgType.getCalEvents;\n default: console.error(\"unreachable\");\n }\n}\n\nexport class Msg {\n constructor(id, type, data) {\n this.id = id;\n this.type = type;\n this.data = data;\n }\n genResp(data) { return new Msg(this.id, this.type, data); }\n deflate() {\n return {\n id: this.id,\n type: stringifyMsgType(this.type),\n data: this.data\n }\n }\n static inflate = obj => new Msg(obj.id, parseMsgType(obj.type), obj.data);\n}\n\nexport class MsgClient {\n constructor(channelName) {\n let port = chrome.runtime.connect({name: channelName});\n const getCallBack = rcb => this.requestCallback;\n port.onMessage.addListener(function(msg) {\n console.log(msg);\n let rcb = getCallBack(msg.type);\n let cb = rcb.inFlight[msg.id];\n console.assert(cb !== undefined);\n rcb.ids.push(msg.id);\n cb(msg);\n });\n this.port = port;\n this.requestCallback = {inFlight: {}, ids: [], maxId: 0};\n }\n\n sendMsg = ({ type, data }) => {\n let rcb = this.requestCallback;\n let cb;\n let pm = new Promise(resolve => { cb = resolve; });\n let id;\n if (rcb.ids.length > 0) {\n id = rcb.ids.pop();\n } else {\n id = rcb.maxId++;\n }\n rcb.inFlight[id] = cb;\n this.port.postMessage((new Msg(id, type, data)).deflate());\n return pm;\n }\n}\n","export class Pattern {\n constructor(id, isRegex, value, label) {\n this.id = id;\n this.isRegex = isRegex;\n this.value = value;\n this.label = label;\n }\n\n get regex() { return new RegExp(this.isRegex ? this.value : `^${this.value}$`); }\n get isEmpty() { return this.label === null; }\n static emptyPattern = () => new Pattern(0, true, '', null);\n static anyPattern = () => new Pattern('any', true, '.*', 'Any');\n static revive = obj => new Pattern(obj.id, obj.isRegex, obj.value, obj.label);\n}\n\nexport class PatternEntry {\n constructor(name, idx, calPattern, eventPattern) {\n this.name = name;\n this.idx = idx;\n this.cal = calPattern;\n this.event = eventPattern;\n }\n\n static defaultPatternEntry = (idx) => new PatternEntry('', idx, Pattern.emptyPattern(), Pattern.anyPattern());\n static revive = obj => new PatternEntry(\n obj.name, obj.idx,\n Pattern.revive(obj.cal), Pattern.revive(obj.event));\n}\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport Grid from '@material-ui/core/Grid';\nimport deepOrange from '@material-ui/core/colors/deepOrange';\nimport cyan from '@material-ui/core/colors/cyan';\nimport { PieChart, Pie, Cell, Tooltip } from 'recharts';\n\nconst styles = theme => ({\n pieChart: {\n margin: '0 auto',\n }\n});\n\nfunction customizedLabel(props) {\n const {cx, cy, x, y, fill, name} = props;\n let anchor = \"middle\";\n const EPS = 2;\n let dx = 0;\n let dy = 0;\n if (x < cx - EPS) {\n dx = -5;\n anchor = \"end\"\n } else if (x > cx + EPS) {\n dx = 5;\n anchor = \"start\";\n }\n\n if (y < cy - EPS) {\n dy = -5;\n } else if (y > cy + EPS) {\n dy = 10;\n }\n\n return ({`${name}`});\n}\n\nfunction ChromiclePieChart(props) {\n return (\n \n \n
\n \n \n `${value.toFixed(2)} hr`}/>\n \n
\n
\n \n
\n \n \n {props.calendarGraphData.map((d, i) => )}\n \n `${value.toFixed(2)} hr`}/>\n \n
\n
\n
);\n}\n\nChromiclePieChart.propTypes = {\n patternGraphData: PropTypes.array.isRequired,\n calendarGraphData: PropTypes.array.isRequired,\n};\n\nexport default withStyles(styles)(ChromiclePieChart);\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport Select from '@material-ui/core/Select';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport TextField from '@material-ui/core/TextField';\nimport FormControl from '@material-ui/core/FormControl';\nimport { Pattern } from './pattern';\n\nconst styles = theme => ({\n fieldNoRegex: {\n width: 200\n },\n fieldRegex: {\n marginRight: '0.5em'\n }\n});\n\nclass RegexField extends React.Component {\n render() {\n const { classes } = this.props;\n let items = [];\n var pitems = this.props.options;\n const p0 = new Pattern.emptyPattern();\n pitems[p0.id] = p0;\n for (let id in pitems)\n {\n const label = !pitems[id].isEmpty ? pitems[id].label :\n Custom;\n items.push({label});\n }\n const selectOnClick = event => {\n let value;\n if (pitems[event.target.value].label == null) {\n value = new Pattern(0, true,\n this.props.value.isRegex ?\n this.props.value.value :\n `^${this.props.value.value}$`, null);\n } else {\n value = pitems[event.target.value];\n }\n this.props.onChange({target: {value}});\n };\n\n const regexTextOnChange = event => this.props.onChange({\n target: { value: new Pattern(0, true, event.target.value, null)}});\n\n const className = this.props.value.isRegex ? classes.fieldRegex: classes.fieldNoRegex;\n return (\n \n \n {items}\n \n {this.props.value.label == null && (\n \n )}\n \n );\n }\n}\n\nRegexField.propTypes = {\n classes: PropTypes.object.isRequired,\n};\n\nconst RegexFieldWithStyles = withStyles(styles)(RegexField);\n\nexport function CalendarField(props) {\n let options = {};\n for (let id in props.calendars) {\n options[id] = new Pattern(id, false,\n props.calendars[id].name,\n props.calendars[id].name);\n }\n return (\n );\n}\n\nexport function EventField(props) {\n let any = Pattern.anyPattern();\n let options = {};\n options[any.id] = any;\n return (\n );\n}\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles, withTheme } from '@material-ui/core/styles';\nimport TextField from '@material-ui/core/TextField';\nimport Table from '@material-ui/core/Table';\nimport TableBody from '@material-ui/core/TableBody';\nimport TableRow from '@material-ui/core/TableRow';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableHead from '@material-ui/core/TableHead';\nimport TablePagination from '@material-ui/core/TablePagination';\nimport DeleteOutlinedIcon from '@material-ui/icons/DeleteOutlined';\nimport { CalendarField, EventField } from './RegexField';\nimport theme from './theme';\n\nconst styles = theme => ({\n deleteButtonShow: {\n position: 'absolute',\n right: 0,\n height: 48\n },\n deleteButtonHide: {\n display: 'none'\n },\n deleteIcon: {\n height: '100%',\n cursor: 'pointer'\n },\n patternTableWrapper: {\n overflowX: 'auto',\n overflowY: 'hidden'\n },\n patternTable: {\n minWidth: 600\n }\n});\n\nconst patternHead = [\n {label: \"Name\", field: \"name\", elem: TextField},\n {label: \"Calendar\", field: \"cal\", elem: withTheme(theme)(CalendarField)},\n {label: \"Event\", field: 'event', elem: withTheme(theme)(EventField)}];\n\nclass PatternTable extends React.Component {\n state = {\n page: 0,\n rowsPerPage: 5,\n activePattern: null\n };\n\n handleChangePage = (event, page) => {\n this.setState({ page });\n }\n\n handleChangeRowsPerPage = event => {\n this.setState({ rowsPerPage: event.target.value });\n }\n\n render() {\n const { classes, calendars, patterns } = this.props;\n const { rowsPerPage, page } = this.state;\n const nDummy = rowsPerPage - Math.min(rowsPerPage, patterns.length - page * rowsPerPage);\n let rows = patterns.slice(page * rowsPerPage, (page + 1) * rowsPerPage).map(p => (\n this.setState({ activePattern: p.idx })}\n onMouseOut={() => this.setState({ activePattern: null })}>\n {\n patternHead.map(s => {\n const CustomText = s.elem;\n return (\n \n this.props.onUpdatePattern(s.field, p.idx, event.target.value)}/>\n )})\n }\n \n this.props.onRemovePattern(p.idx)} />\n \n ));\n\n return (\n
\n
\n \n \n {patternHead.map((s, i) => ({s.label}))}\n \n \n {rows}\n {\n nDummy > 0 && (\n \n \n )\n }\n \n
\n
\n \n
);\n }\n}\n\n\nPatternTable.propTypes = {\n classes: PropTypes.object.isRequired,\n patterns: PropTypes.array.isRequired,\n calendars: PropTypes.object.isRequired,\n onRemovePattern: PropTypes.func.isRequired,\n onUpdatePattern: PropTypes.func.isRequired,\n};\n\nexport default withStyles(styles)(PatternTable);\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport amber from '@material-ui/core/colors/amber';\nimport Snackbar from '@material-ui/core/Snackbar';\nimport SnackbarContent from '@material-ui/core/SnackbarContent';\nimport ErrorIcon from '@material-ui/icons/Error';\nimport WarningIcon from '@material-ui/icons/Warning';\nimport CloseIcon from '@material-ui/icons/Close';\nimport IconButton from '@material-ui/core/IconButton';\n\n// modified from https://material-ui.com/demos/snackbars/\n\nconst variantIcon = {\n error: ErrorIcon,\n warning: WarningIcon,\n};\n\nconst styles = theme => ({\n error: {\n backgroundColor: theme.palette.error.dark,\n },\n warning: {\n backgroundColor: amber[700],\n },\n icon: {\n fontSize: 20,\n },\n iconVariant: {\n opacity: 0.9,\n marginRight: theme.spacing.unit,\n },\n message: {\n display: 'flex',\n alignItems: 'center',\n },\n});\n\nfunction CustomSnackbar(props) {\n const { classes, className, message, variant, open, onClose, ...other } = props;\n const Icon = variantIcon[variant];\n return (\n \n \n \n {message}\n \n }\n action={[\n \n \n ,\n ]}\n {...other}\n />\n \n );\n}\n\nexport default withStyles(styles)(CustomSnackbar);\n","import React from 'react';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogContentText from '@material-ui/core/DialogContentText';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport Button from '@material-ui/core/Button';\nimport Slide from '@material-ui/core/Slide';\n\n// modified from https://material-ui.com/demos/dialogs/\n\nfunction Transition(props) {\n return ;\n}\n\nfunction AlertDialog(props) {\n return (\n props.handleClose(false)}\n aria-labelledby=\"alert-dialog-slide-title\"\n aria-describedby=\"alert-dialog-slide-description\">\n \n {props.title}\n \n \n \n {props.message}\n \n \n \n \n \n \n\n );\n}\n\nexport default AlertDialog;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport 'react-dates/initialize';\nimport 'react-dates/lib/css/_datepicker.css';\nimport { DateRangePicker } from 'react-dates';\nimport { withStyles } from '@material-ui/core/styles';\nimport cyan from '@material-ui/core/colors/cyan';\nimport CssBaseline from '@material-ui/core/CssBaseline';\nimport Typography from '@material-ui/core/Typography';\nimport Button from '@material-ui/core/Button';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormGroup from '@material-ui/core/FormGroup';\nimport Grid from '@material-ui/core/Grid';\nimport AddCircleIcon from '@material-ui/icons/AddCircle';\nimport IconButton from '@material-ui/core/IconButton';\nimport * as gapi from './gapi';\nimport { msgType, MsgClient } from './msg';\nimport { Pattern, PatternEntry } from './pattern';\nimport PieChart from './Chart';\nimport PatternTable from './PatternTable';\nimport Snackbar from './Snackbar';\nimport AlertDialog from './Dialog';\n\nconst default_chart_data = [\n {name: 'Work', value: 10, color: cyan[300]},\n {name: 'Wasted', value: 10, color: cyan[300]}];\n\nfunction filterPatterns(patterns, calName) {\n return patterns.filter(p => {\n return p.cal.regex.test(calName);\n });\n}\n\nconst styles = theme => ({\n buttonSpacer: {\n marginBottom: theme.spacing.unit * 4,\n },\n});\n\nclass CustomAnalyzer extends React.Component {\n state = {\n patterns: [],\n calendars: {},\n startDate: null,\n endDate: null,\n patternGraphData: default_chart_data,\n calendarGraphData: default_chart_data,\n snackBarOpen: false,\n snackBarMsg: 'unknown',\n snackBarVariant: 'error',\n dialogOpen: false,\n dialogMsg: {title: '', message: ''},\n };\n\n constructor(props) {\n super(props);\n this.msgClient = new MsgClient('main');\n this.msgClient.sendMsg({\n type: msgType.getPatterns,\n data: { id: 'analyze' }\n }).then(msg => {\n this.setState({ patterns: msg.data.map(p => PatternEntry.revive(p)) });\n });\n this.msgClient.sendMsg({ type: msgType.getCalendars, data: { enabledOnly: true }}).then(msg => {\n this.setState({ calendars: msg.data });\n });\n gapi.getLoggedIn().then(b => !b &&\n this.handleSnackbarOpen('Not logged in. Operating in offline mode.', 'warning'));\n this.dialogPromiseResolver = null;\n }\n\n updatePattern = (field, idx, value) => {\n let patterns = this.state.patterns;\n patterns[idx][field] = value;\n this.msgClient.sendMsg({\n type: msgType.updatePatterns,\n data: { id: 'analyze', patterns }\n }).then(() => this.setState({ patterns }));\n };\n\n removePattern = idx => {\n let patterns = this.state.patterns;\n patterns.splice(idx, 1);\n for (let i = 0; i < patterns.length; i++)\n patterns[i].idx = i;\n this.msgClient.sendMsg({\n type: msgType.updatePatterns,\n data: { id: 'analyze', patterns }\n }).then(() => this.setState({ patterns }));\n };\n\n newPattern = () => {\n let patterns = [PatternEntry.defaultPatternEntry(0), ...this.state.patterns];\n for (let i = 1; i < patterns.length; i++)\n patterns[i].idx = i;\n this.msgClient.sendMsg({\n type: msgType.updatePatterns,\n data: { id: 'analyze', patterns }\n }).then(() => this.setState({ patterns }));\n };\n\n loadPatterns = patterns => {\n this.msgClient.sendMsg({\n type: msgType.updatePatterns,\n data: { id: 'analyze', patterns }\n }).then(() => this.setState({ patterns }));\n };\n\n getCalEvents = (id, start, end) => {\n return this.msgClient.sendMsg({ type: msgType.getCalEvents, data: { id,\n start: start.getTime(),\n end: end.getTime() } })\n .then(({ data }) => data.map(e => {\n return {\n id: e.id,\n start: new Date(e.start),\n end: new Date(e.end) }\n }));\n }\n\n analyze = () => {\n if (!(this.state.startDate && this.state.endDate)) {\n this.handleSnackbarOpen('Please choose a valid time range.', 'error');\n return;\n }\n let start = this.state.startDate.startOf('day').toDate();\n let end = this.state.endDate.startOf('day').toDate();\n let event_pms = [];\n let cals = this.state.calendars;\n for (let id in cals)\n {\n let patterns = filterPatterns(this.state.patterns, cals[id].name);\n if (patterns.length > 0)\n event_pms.push(this.getCalEvents(id, start, end)\n .then(r => { return { id, events: r, patterns }; }));\n }\n Promise.all(event_pms).then(all_events => {\n console.log(all_events);\n let events = {};\n let patterns = {};\n let results = {}; // pattern idx => time\n let cal_results = {}; // cal id => time\n all_events.forEach(e => {\n events[e.id] = e.events;\n patterns[e.id] = e.patterns;\n });\n for (let i = 0; i < this.state.patterns.length; i++)\n results[i] = 0;\n for (let id in cals) {\n if (!events[id]) continue;\n events[id].forEach(event => {\n patterns[id].forEach(p => {\n if (!p.event.regex.test(event.summary)) return;\n if (!cal_results.hasOwnProperty(id)) {\n cal_results[id] = 0;\n }\n let duration = (event.end - event.start) / 60000;\n results[p.idx] += duration;\n cal_results[id] += duration;\n });\n });\n }\n let patternGraphData = [];\n let calendarGraphData = [];\n for (let i = 0; i < this.state.patterns.length; i++) {\n patternGraphData.push({ name: this.state.patterns[i].name, value: results[i] / 60.0 });\n }\n for (let id in cal_results) {\n calendarGraphData.push({\n name: cals[id].name,\n value: (cal_results[id] / 60.0),\n color: cals[id].color.background});\n }\n console.log(patternGraphData, calendarGraphData);\n this.setState({ patternGraphData, calendarGraphData });\n });\n };\n\n reset = () => {\n this.handleDialogOpen(\"Reset\", \"Are you sure to reset the patterns?\").then(ans => {\n if (!ans) return;\n this.loadPatterns([]);\n this.setState({ startDate: null, endDate: null });\n });\n }\n\n default = () => {\n this.handleDialogOpen(\"Load Default\", \"Load the calendars as patterns?\").then(ans => {\n if (!ans) return;\n this.loadPatterns(Object.keys(this.state.calendars).map((id, idx) => {\n let item = this.state.calendars[id];\n return new PatternEntry(item.name, idx,\n new Pattern(id, false, item.name, item.name),\n Pattern.anyPattern());\n }));\n });\n }\n\n handleSnackbarClose = (event, reason) => {\n if (reason === 'clickaway') return;\n this.setState({ snackBarOpen: false });\n }\n\n handleSnackbarOpen = (msg, variant) => {\n this.setState({ snackBarOpen: true, snackBarMsg: msg, snackBarVariant: variant });\n }\n\n handleDialogOpen = (title, message) => {\n let pm = new Promise(resolver => {\n this.dialogPromiseResolver = resolver\n });\n this.setState({ dialogOpen: true, dialogMsg: {title, message} });\n return pm;\n }\n\n handleDialogClose = result => {\n this.dialogPromiseResolver(result);\n this.setState({ dialogOpen: false });\n }\n\n render() {\n const { classes } = this.props;\n\n return (\n \n \n \n \n \n \n \n Analyzed Events\n this.newPattern()}>\n \n \n \n \n \n Time Range\n \n
\n {\n this.setState({ startDate, endDate });\n }} \n focusedInput={this.state.focusedInput}\n onFocusChange={focusedInput => this.setState({ focusedInput })}\n isOutsideRange={() => false} />\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 Results\n \n \n \n \n );\n }\n}\n\nCustomAnalyzer.propTypes = {\n classes: PropTypes.object.isRequired,\n};\n\nexport default withStyles(styles)(CustomAnalyzer);\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport CssBaseline from '@material-ui/core/CssBaseline';\nimport Typography from '@material-ui/core/Typography';\nimport Button from '@material-ui/core/Button';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormGroup from '@material-ui/core/FormGroup';\nimport Grid from '@material-ui/core/Grid';\nimport RefreshIcon from '@material-ui/icons/Refresh';\nimport AddCircleIcon from '@material-ui/icons/AddCircle';\nimport IconButton from '@material-ui/core/IconButton';\nimport Table from '@material-ui/core/Table';\nimport TableBody from '@material-ui/core/TableBody';\nimport TableRow from '@material-ui/core/TableRow';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableHead from '@material-ui/core/TableHead';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport * as gapi from './gapi';\nimport { msgType, MsgClient } from './msg';\nimport { Pattern, PatternEntry } from './pattern';\nimport PatternTable from './PatternTable';\nimport Snackbar from './Snackbar';\nimport AlertDialog from './Dialog';\n\nconst styles = theme => ({\n tableHead: {\n verticalAlign: 'top',\n textAlign: 'right',\n lineHeight: '3em',\n },\n tableContent: {\n textAlign: 'left',\n maxWidth: 600,\n },\n calendarList: {\n maxHeight: 400,\n overflowY: 'auto'\n }\n});\n\nconst STableCell = withStyles(theme => ({\n body: {\n fontSize: 16,\n },\n}))(TableCell);\n\nconst CompactListItem = withStyles(theme => ({\n dense: {\n paddingTop: 0,\n paddingBottom: 0\n },\n}))(ListItem);\n\nclass Settings extends React.Component {\n state = {\n isLoggedIn: false,\n patterns: [],\n calendars: {},\n snackBarOpen: false,\n snackBarMsg: 'unknown',\n dialogOpen: false,\n dialogMsg: {title: '', message: ''},\n };\n\n constructor(props) {\n super(props);\n this.msgClient = new MsgClient('main');\n gapi.getLoggedIn().then(b => this.setState({ isLoggedIn: b }));\n this.msgClient.sendMsg({\n type: msgType.getPatterns,\n data: { id: 'main' }\n }).then(msg => {\n this.setState({ patterns: msg.data.map(p => PatternEntry.revive(p)) });\n });\n this.msgClient.sendMsg({ type: msgType.getCalendars, data: { enabledOnly: false } }).then(msg => {\n this.setState({ calendars: msg.data });\n });\n this.dialogPromiseResolver = null;\n }\n\n handleLogin = () => {\n gapi.login().then(() => {\n this.setState({ isLoggedIn: true });\n this.loadAll(true);\n }).catch(() => this.handleSnackbarOpen(\"Failed to login!\"));\n }\n\n handleLogout = () => {\n this.handleDialogOpen(\"Logout\", \"Are you sure to logout?\").then(ans => {\n if (!ans) return;\n gapi.logout().then(() => {\n this.setState({ isLoggedIn: false });\n //this.loadPatterns([], 'analyze');\n }).catch(() => this.handleSnackbarOpen(\"Failed to logout!\"));\n });\n }\n\n handleToggleCalendar = id => {\n var calendars = {...this.state.calendars};\n calendars[id].enabled = !calendars[id].enabled;\n this.msgClient.sendMsg({ type: msgType.updateCalendars, data: calendars }).then(() =>\n this.setState({ calendars }));\n }\n\n loadAll = loadDefaultPatterns => {\n let colors = gapi.getAuthToken().then(gapi.getColors).then(color => {\n return color.calendar;\n });\n let cals = gapi.getAuthToken().then(gapi.getCalendars);\n Promise.all([colors, cals]).then(([colors, items]) => {\n var cals = {};\n items.forEach(item => {\n cals[item.id] = {\n name: item.summary,\n color: colors[item.colorId],\n enabled: true\n //cal: new gapi.GCalendar(item.id, item.summary)\n }});\n this.loadCalendars(cals);\n if (loadDefaultPatterns)\n {\n this.loadPatterns(items.map((item, idx) => {\n return new PatternEntry(item.summary, idx,\n new Pattern(item.id, false, item.summary, item.summary),\n Pattern.anyPattern());\n }), 'main');\n }\n });\n };\n\n loadCalendars = calendars => {\n for (let id in this.state.calendars) {\n if (calendars.hasOwnProperty(id))\n calendars[id].enabled = this.state.calendars[id].enabled;\n }\n this.msgClient.sendMsg({ type: msgType.updateCalendars, data: calendars }).then(() =>\n this.setState({ calendars }));\n };\n\n loadPatterns = (patterns, id) => {\n this.msgClient.sendMsg({\n type: msgType.updatePatterns,\n data: { id, patterns }\n }).then(() => this.setState({ patterns }));\n };\n\n updatePattern = (field, idx, value) => {\n let patterns = this.state.patterns;\n patterns[idx][field] = value;\n this.msgClient.sendMsg({\n type: msgType.updatePatterns,\n data: { id: 'main', patterns }\n }).then(() => this.setState({ patterns }));\n };\n\n removePattern = idx => {\n let patterns = this.state.patterns;\n patterns.splice(idx, 1);\n for (let i = 0; i < patterns.length; i++)\n patterns[i].idx = i;\n this.msgClient.sendMsg({\n type: msgType.updatePatterns,\n data: { id: 'main', patterns }\n }).then(() => this.setState({ patterns }));\n };\n\n newPattern = () => {\n let patterns = [PatternEntry.defaultPatternEntry(0), ...this.state.patterns];\n for (let i = 1; i < patterns.length; i++)\n patterns[i].idx = i;\n this.msgClient.sendMsg({\n type: msgType.updatePatterns,\n data: { id: 'main', patterns }\n }).then(() => this.setState({ patterns }));\n };\n\n handleSnackbarClose = (event, reason) => {\n if (reason === 'clickaway') return;\n this.setState({ snackBarOpen: false });\n }\n\n handleSnackbarOpen = msg => {\n this.setState({ snackBarOpen: true, snackBarMsg: msg });\n }\n\n handleDialogOpen = (title, message) => {\n let pm = new Promise(resolver => {\n this.dialogPromiseResolver = resolver\n });\n this.setState({ dialogOpen: true, dialogMsg: {title, message} });\n return pm;\n }\n\n handleDialogClose = result => {\n this.dialogPromiseResolver(result);\n this.setState({ dialogOpen: false });\n }\n\n render() {\n const { classes } = this.props;\n return (\n
\n \n \n \n General\n \n \n \n \n Account\n \n {\n (this.state.isLoggedIn &&\n ) ||\n \n }\n \n \n \n \n this.loadAll(false)}\n disabled={!this.state.isLoggedIn}>\n Calendars\n \n \n {(this.state.isLoggedIn &&\n \n {Object.keys(this.state.calendars).map(id =>\n this.handleToggleCalendar(id)}\n disableGutters\n dense button >\n \n \n )}\n ) || 'Please Login.'}\n \n \n \n \n this.newPattern()}\n disabled={!this.state.isLoggedIn}>\n Tracked Events\n \n \n {(this.state.isLoggedIn &&\n \n \n ) || 'Please Login.'}\n \n \n \n
\n
\n );\n }\n}\n\nSettings.propTypes = {\n classes: PropTypes.object.isRequired,\n};\n\nexport default withStyles(styles)(Settings);\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport 'typeface-roboto';\nimport { withStyles } from '@material-ui/core/styles';\nimport { MuiThemeProvider } from '@material-ui/core/styles';\nimport CssBaseline from '@material-ui/core/CssBaseline';\nimport AppBar from '@material-ui/core/AppBar';\nimport Toolbar from '@material-ui/core/Toolbar';\nimport Typography from '@material-ui/core/Typography';\nimport Paper from '@material-ui/core/Paper';\nimport Tabs from '@material-ui/core/Tabs';\nimport Tab from '@material-ui/core/Tab';\nimport Grid from '@material-ui/core/Grid';\nimport { HashRouter as Router, withRouter, Route, Link, Redirect, Switch } from \"react-router-dom\";\nimport { hashHistory } from 'react-router';\nimport Logo from './Logo';\nimport theme from './theme';\nimport CustomAnalyzer from './CustomAnalyzer';\nimport Settings from './Settings';\n\nconst styles = theme => ({\n root: {\n display: 'flex',\n height: '100vh',\n },\n appBar: {\n zIndex: theme.zIndex.drawer + 1,\n transition: theme.transitions.create(['width', 'margin'], {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.leavingScreen,\n }),\n },\n title: {\n flexGrow: 1,\n display: 'inline-block'\n },\n appBarSpacer: theme.mixins.toolbar,\n content: {\n flexGrow: 1,\n padding: theme.spacing.unit * 3,\n overflow: 'auto',\n },\n indicator: {\n backgroundColor: theme.palette.primary.contrastText\n }\n});\n\nclass DashboardTabs extends React.Component {\n handleChangeTab = (event, currentTab) => {\n this.props.history.push(currentTab);\n }\n render() {\n const { classes } = this.props;\n return (\n
\n \n \n \n Chromicle\n \n \n \n \n \n \n \n \n
\n
\n \n \n }/>\n
\n
\n );\n }\n}\n\nDashboardTabs.propTypes = {\n classes: PropTypes.object.isRequired,\n};\n\nclass Dashboard extends React.Component {\n render() {\n const { classes } = this.props;\n let Tabs = withRouter(withStyles(styles)(DashboardTabs));\n return (\n \n \n );\n }\n}\n\nexport default Dashboard;\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 http://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 http://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 http://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 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: http://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"],"sourceRoot":""}