{"version":3,"file":"LifeDashboard.9d4bc441.js","sources":["../../../../../../src/components/IncreasePower.svelte","../../../../../../src/sections/Feed.svelte","../../../../../../node_modules/dom-to-image/src/dom-to-image.js","../../../../../../src/components/charts/chartFunctions/SparkLine.svelte","../../../../../../src/components/AwaitBlock.svelte","../../../../../../src/components/GlowingMetric.svelte","../../../../../../src/lib/notifications.js","../../../../../../src/components/charts/Details.svelte","../../../../../../src/components/charts/RecentSummary.svelte","../../../../../../src/components/LoadingBar.svelte","../../../../../../src/components/Controls.svelte","../../../../../../src/sections/NavColumn.svelte","../../../../../../node_modules/flatpickr/dist/esm/types/options.js","../../../../../../node_modules/flatpickr/dist/esm/l10n/default.js","../../../../../../node_modules/flatpickr/dist/esm/utils/index.js","../../../../../../node_modules/flatpickr/dist/esm/utils/dom.js","../../../../../../node_modules/flatpickr/dist/esm/utils/formatting.js","../../../../../../node_modules/flatpickr/dist/esm/utils/dates.js","../../../../../../node_modules/flatpickr/dist/esm/utils/polyfills.js","../../../../../../node_modules/flatpickr/dist/esm/index.js","../../../../../../src/components/FlatPickr.svelte","../../../../../../src/components/DatePicker.svelte","../../../../../../src/sections/LifeDashboard.svelte"],"sourcesContent":["\n\n{#if false && $IsDev}\n\tAdd to Slack\n{/if}\n\n
\n\t\n\n\t
\n\t\t
\n\t\t\t {\n\t\t\t\t\tshowActivity = { ...increase, ...(activitywatchToday?.productivityLastHour || {}) };\n\t\t\t\t\tconsole.log({ showActivity });\n\t\t\t\t\t$DateRange.daysInPast = $DateRange.daysInPast;\n\t\t\t\t\tif (!power) return;\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t\n\t\t\t\t\tCurrent Session\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t{makeDecimalIntoTime(\n\t\t\t\t\t\t\t\t\tactivitywatchToday?.productivityLastHour?.duration / 3600 || 0,\n\t\t\t\t\t\t\t\t\t'durationNoZero'\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t{#each aggregateAndSort(activitywatchToday?.productivityLastHour?.events || activitywatchToday?.window?.events?.filter((e) => e.timestamp >= activitywatchToday?.productivityLastHour?.timestamp)).slice(0, 4) as [type, data] (data.keyToAggregateOn)}\n\t\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t{makeDecimalIntoTime(data?.duration / 3600, 'durationNoZeroWithSeconds')}\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t{/each}\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\n\t\t\t\t{#if showActivity || increase}\n\t\t\t\t\t\n\t\t\t\t{/if}\n\t\t\t\n\t\t
\n\t\n\n\n\n\n","\n\n
\n\t
\n\t\t\n\t
\n\t
\n\t\t\n\t
\n
\n\n\n\n","(function (global) {\n 'use strict';\n\n var util = newUtil();\n var inliner = newInliner();\n var fontFaces = newFontFaces();\n var images = newImages();\n\n // Default impl options\n var defaultOptions = {\n // Default is to fail on error, no placeholder\n imagePlaceholder: undefined,\n // Default cache bust is false, it will use the cache\n cacheBust: false\n };\n\n var domtoimage = {\n toSvg: toSvg,\n toPng: toPng,\n toJpeg: toJpeg,\n toBlob: toBlob,\n toPixelData: toPixelData,\n impl: {\n fontFaces: fontFaces,\n images: images,\n util: util,\n inliner: inliner,\n options: {}\n }\n };\n\n if (typeof module !== 'undefined')\n module.exports = domtoimage;\n else\n global.domtoimage = domtoimage;\n\n\n /**\n * @param {Node} node - The DOM Node object to render\n * @param {Object} options - Rendering options\n * @param {Function} options.filter - Should return true if passed node should be included in the output\n * (excluding node means excluding it's children as well). Not called on the root node.\n * @param {String} options.bgcolor - color for the background, any valid CSS color value.\n * @param {Number} options.width - width to be applied to node before rendering.\n * @param {Number} options.height - height to be applied to node before rendering.\n * @param {Object} options.style - an object whose properties to be copied to node's style before rendering.\n * @param {Number} options.quality - a Number between 0 and 1 indicating image quality (applicable to JPEG only),\n defaults to 1.0.\n * @param {String} options.imagePlaceholder - dataURL to use as a placeholder for failed images, default behaviour is to fail fast on images we can't fetch\n * @param {Boolean} options.cacheBust - set to true to cache bust by appending the time to the request url\n * @return {Promise} - A promise that is fulfilled with a SVG image data URL\n * */\n function toSvg(node, options) {\n options = options || {};\n copyOptions(options);\n return Promise.resolve(node)\n .then(function (node) {\n return cloneNode(node, options.filter, true);\n })\n .then(embedFonts)\n .then(inlineImages)\n .then(applyOptions)\n .then(function (clone) {\n return makeSvgDataUri(clone,\n options.width || util.width(node),\n options.height || util.height(node)\n );\n });\n\n function applyOptions(clone) {\n if (options.bgcolor) clone.style.backgroundColor = options.bgcolor;\n\n if (options.width) clone.style.width = options.width + 'px';\n if (options.height) clone.style.height = options.height + 'px';\n\n if (options.style)\n Object.keys(options.style).forEach(function (property) {\n clone.style[property] = options.style[property];\n });\n\n return clone;\n }\n }\n\n /**\n * @param {Node} node - The DOM Node object to render\n * @param {Object} options - Rendering options, @see {@link toSvg}\n * @return {Promise} - A promise that is fulfilled with a Uint8Array containing RGBA pixel data.\n * */\n function toPixelData(node, options) {\n return draw(node, options || {})\n .then(function (canvas) {\n return canvas.getContext('2d').getImageData(\n 0,\n 0,\n util.width(node),\n util.height(node)\n ).data;\n });\n }\n\n /**\n * @param {Node} node - The DOM Node object to render\n * @param {Object} options - Rendering options, @see {@link toSvg}\n * @return {Promise} - A promise that is fulfilled with a PNG image data URL\n * */\n function toPng(node, options) {\n return draw(node, options || {})\n .then(function (canvas) {\n return canvas.toDataURL();\n });\n }\n\n /**\n * @param {Node} node - The DOM Node object to render\n * @param {Object} options - Rendering options, @see {@link toSvg}\n * @return {Promise} - A promise that is fulfilled with a JPEG image data URL\n * */\n function toJpeg(node, options) {\n options = options || {};\n return draw(node, options)\n .then(function (canvas) {\n return canvas.toDataURL('image/jpeg', options.quality || 1.0);\n });\n }\n\n /**\n * @param {Node} node - The DOM Node object to render\n * @param {Object} options - Rendering options, @see {@link toSvg}\n * @return {Promise} - A promise that is fulfilled with a PNG image blob\n * */\n function toBlob(node, options) {\n return draw(node, options || {})\n .then(util.canvasToBlob);\n }\n\n function copyOptions(options) {\n // Copy options to impl options for use in impl\n if(typeof(options.imagePlaceholder) === 'undefined') {\n domtoimage.impl.options.imagePlaceholder = defaultOptions.imagePlaceholder;\n } else {\n domtoimage.impl.options.imagePlaceholder = options.imagePlaceholder;\n }\n\n if(typeof(options.cacheBust) === 'undefined') {\n domtoimage.impl.options.cacheBust = defaultOptions.cacheBust;\n } else {\n domtoimage.impl.options.cacheBust = options.cacheBust;\n }\n }\n\n function draw(domNode, options) {\n return toSvg(domNode, options)\n .then(util.makeImage)\n .then(util.delay(100))\n .then(function (image) {\n var canvas = newCanvas(domNode);\n canvas.getContext('2d').drawImage(image, 0, 0);\n return canvas;\n });\n\n function newCanvas(domNode) {\n var canvas = document.createElement('canvas');\n canvas.width = options.width || util.width(domNode);\n canvas.height = options.height || util.height(domNode);\n\n if (options.bgcolor) {\n var ctx = canvas.getContext('2d');\n ctx.fillStyle = options.bgcolor;\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n }\n\n return canvas;\n }\n }\n\n function cloneNode(node, filter, root) {\n if (!root && filter && !filter(node)) return Promise.resolve();\n\n return Promise.resolve(node)\n .then(makeNodeCopy)\n .then(function (clone) {\n return cloneChildren(node, clone, filter);\n })\n .then(function (clone) {\n return processClone(node, clone);\n });\n\n function makeNodeCopy(node) {\n if (node instanceof HTMLCanvasElement) return util.makeImage(node.toDataURL());\n return node.cloneNode(false);\n }\n\n function cloneChildren(original, clone, filter) {\n var children = original.childNodes;\n if (children.length === 0) return Promise.resolve(clone);\n\n return cloneChildrenInOrder(clone, util.asArray(children), filter)\n .then(function () {\n return clone;\n });\n\n function cloneChildrenInOrder(parent, children, filter) {\n var done = Promise.resolve();\n children.forEach(function (child) {\n done = done\n .then(function () {\n return cloneNode(child, filter);\n })\n .then(function (childClone) {\n if (childClone) parent.appendChild(childClone);\n });\n });\n return done;\n }\n }\n\n function processClone(original, clone) {\n if (!(clone instanceof Element)) return clone;\n\n return Promise.resolve()\n .then(cloneStyle)\n .then(clonePseudoElements)\n .then(copyUserInput)\n .then(fixSvg)\n .then(function () {\n return clone;\n });\n\n function cloneStyle() {\n if (clone.style === undefined) {\n return false;\n }\n copyStyle(window.getComputedStyle(original), clone.style);\n\n function copyStyle(source, target) {\n if (source.cssText) target.cssText = source.cssText;\n else copyProperties(source, target);\n\n function copyProperties(source, target) {\n util.asArray(source).forEach(function (name) {\n target.setProperty(\n name,\n source.getPropertyValue(name),\n source.getPropertyPriority(name)\n );\n });\n }\n }\n }\n\n function clonePseudoElements() {\n [':before', ':after'].forEach(function (element) {\n clonePseudoElement(element);\n });\n\n function clonePseudoElement(element) {\n var style = window.getComputedStyle(original, element);\n var content = style.getPropertyValue('content');\n\n if (content === '' || content === 'none') return;\n\n var className = util.uid();\n clone.className = clone.className + ' ' + className;\n var styleElement = document.createElement('style');\n styleElement.appendChild(formatPseudoElementStyle(className, element, style));\n clone.appendChild(styleElement);\n\n function formatPseudoElementStyle(className, element, style) {\n var selector = '.' + className + ':' + element;\n var cssText = style.cssText ? formatCssText(style) : formatCssProperties(style);\n return document.createTextNode(selector + '{' + cssText + '}');\n\n function formatCssText(style) {\n var content = style.getPropertyValue('content');\n return style.cssText + ' content: ' + content + ';';\n }\n\n function formatCssProperties(style) {\n\n return util.asArray(style)\n .map(formatProperty)\n .join('; ') + ';';\n\n function formatProperty(name) {\n return name + ': ' +\n style.getPropertyValue(name) +\n (style.getPropertyPriority(name) ? ' !important' : '');\n }\n }\n }\n }\n }\n\n function copyUserInput() {\n if (original instanceof HTMLTextAreaElement) clone.innerHTML = original.value;\n if (original instanceof HTMLInputElement) clone.setAttribute(\"value\", original.value);\n }\n\n function fixSvg() {\n if (!(clone instanceof SVGElement)) return;\n clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');\n\n if (!(clone instanceof SVGRectElement)) return;\n ['width', 'height'].forEach(function (attribute) {\n var value = clone.getAttribute(attribute);\n if (!value) return;\n\n clone.style.setProperty(attribute, value);\n });\n }\n }\n }\n\n function embedFonts(node) {\n return fontFaces.resolveAll()\n .then(function (cssText) {\n var styleNode = document.createElement('style');\n node.appendChild(styleNode);\n styleNode.appendChild(document.createTextNode(cssText));\n return node;\n });\n }\n\n function inlineImages(node) {\n return images.inlineAll(node)\n .then(function () {\n return node;\n });\n }\n\n function makeSvgDataUri(node, width, height) {\n return Promise.resolve(node)\n .then(function (node) {\n node.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');\n return new XMLSerializer().serializeToString(node);\n })\n .then(util.escapeXhtml)\n .then(function (xhtml) {\n return '' + xhtml + '';\n })\n .then(function (foreignObject) {\n return '' +\n foreignObject + '';\n })\n .then(function (svg) {\n return 'data:image/svg+xml;charset=utf-8,' + svg;\n });\n }\n\n function newUtil() {\n return {\n escape: escape,\n parseExtension: parseExtension,\n mimeType: mimeType,\n dataAsUrl: dataAsUrl,\n isDataUrl: isDataUrl,\n canvasToBlob: canvasToBlob,\n resolveUrl: resolveUrl,\n getAndEncode: getAndEncode,\n uid: uid(),\n delay: delay,\n asArray: asArray,\n escapeXhtml: escapeXhtml,\n makeImage: makeImage,\n width: width,\n height: height\n };\n\n function mimes() {\n /*\n * Only WOFF and EOT mime types for fonts are 'real'\n * see http://www.iana.org/assignments/media-types/media-types.xhtml\n */\n var WOFF = 'application/font-woff';\n var JPEG = 'image/jpeg';\n\n return {\n 'woff': WOFF,\n 'woff2': WOFF,\n 'ttf': 'application/font-truetype',\n 'eot': 'application/vnd.ms-fontobject',\n 'png': 'image/png',\n 'jpg': JPEG,\n 'jpeg': JPEG,\n 'gif': 'image/gif',\n 'tiff': 'image/tiff',\n 'svg': 'image/svg+xml'\n };\n }\n\n function parseExtension(url) {\n var match = /\\.([^\\.\\/]*?)$/g.exec(url);\n if (match) return match[1];\n else return '';\n }\n\n function mimeType(url) {\n var extension = parseExtension(url).toLowerCase();\n return mimes()[extension] || '';\n }\n\n function isDataUrl(url) {\n return url.search(/^(data:)/) !== -1;\n }\n\n function toBlob(canvas) {\n return new Promise(function (resolve) {\n var binaryString = window.atob(canvas.toDataURL().split(',')[1]);\n var length = binaryString.length;\n var binaryArray = new Uint8Array(length);\n\n for (var i = 0; i < length; i++)\n binaryArray[i] = binaryString.charCodeAt(i);\n\n resolve(new Blob([binaryArray], {\n type: 'image/png'\n }));\n });\n }\n\n function canvasToBlob(canvas) {\n if (canvas.toBlob)\n return new Promise(function (resolve) {\n canvas.toBlob(resolve);\n });\n\n return toBlob(canvas);\n }\n\n function resolveUrl(url, baseUrl) {\n var doc = document.implementation.createHTMLDocument();\n var base = doc.createElement('base');\n doc.head.appendChild(base);\n var a = doc.createElement('a');\n doc.body.appendChild(a);\n base.href = baseUrl;\n a.href = url;\n return a.href;\n }\n\n function uid() {\n var index = 0;\n\n return function () {\n return 'u' + fourRandomChars() + index++;\n\n function fourRandomChars() {\n /* see http://stackoverflow.com/a/6248722/2519373 */\n return ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4);\n }\n };\n }\n\n function makeImage(uri) {\n return new Promise(function (resolve, reject) {\n var image = new Image();\n image.onload = function () {\n resolve(image);\n };\n image.onerror = reject;\n image.src = uri;\n });\n }\n\n function getAndEncode(url) {\n var TIMEOUT = 30000;\n if(domtoimage.impl.options.cacheBust) {\n // Cache bypass so we dont have CORS issues with cached images\n // Source: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache\n url += ((/\\?/).test(url) ? \"&\" : \"?\") + (new Date()).getTime();\n }\n\n return new Promise(function (resolve) {\n var request = new XMLHttpRequest();\n\n request.onreadystatechange = done;\n request.ontimeout = timeout;\n request.responseType = 'blob';\n request.timeout = TIMEOUT;\n request.open('GET', url, true);\n request.send();\n\n var placeholder;\n if(domtoimage.impl.options.imagePlaceholder) {\n var split = domtoimage.impl.options.imagePlaceholder.split(/,/);\n if(split && split[1]) {\n placeholder = split[1];\n }\n }\n\n function done() {\n if (request.readyState !== 4) return;\n\n if (request.status !== 200) {\n if(placeholder) {\n resolve(placeholder);\n } else {\n fail('cannot fetch resource: ' + url + ', status: ' + request.status);\n }\n\n return;\n }\n\n var encoder = new FileReader();\n encoder.onloadend = function () {\n var content = encoder.result.split(/,/)[1];\n resolve(content);\n };\n encoder.readAsDataURL(request.response);\n }\n\n function timeout() {\n if(placeholder) {\n resolve(placeholder);\n } else {\n fail('timeout of ' + TIMEOUT + 'ms occured while fetching resource: ' + url);\n }\n }\n\n function fail(message) {\n console.error(message);\n resolve('');\n }\n });\n }\n\n function dataAsUrl(content, type) {\n return 'data:' + type + ';base64,' + content;\n }\n\n function escape(string) {\n return string.replace(/([.*+?^${}()|\\[\\]\\/\\\\])/g, '\\\\$1');\n }\n\n function delay(ms) {\n return function (arg) {\n return new Promise(function (resolve) {\n setTimeout(function () {\n resolve(arg);\n }, ms);\n });\n };\n }\n\n function asArray(arrayLike) {\n var array = [];\n var length = arrayLike.length;\n for (var i = 0; i < length; i++) array.push(arrayLike[i]);\n return array;\n }\n\n function escapeXhtml(string) {\n return string.replace(/#/g, '%23').replace(/\\n/g, '%0A');\n }\n\n function width(node) {\n var leftBorder = px(node, 'border-left-width');\n var rightBorder = px(node, 'border-right-width');\n return node.scrollWidth + leftBorder + rightBorder;\n }\n\n function height(node) {\n var topBorder = px(node, 'border-top-width');\n var bottomBorder = px(node, 'border-bottom-width');\n return node.scrollHeight + topBorder + bottomBorder;\n }\n\n function px(node, styleProperty) {\n var value = window.getComputedStyle(node).getPropertyValue(styleProperty);\n return parseFloat(value.replace('px', ''));\n }\n }\n\n function newInliner() {\n var URL_REGEX = /url\\(['\"]?([^'\"]+?)['\"]?\\)/g;\n\n return {\n inlineAll: inlineAll,\n shouldProcess: shouldProcess,\n impl: {\n readUrls: readUrls,\n inline: inline\n }\n };\n\n function shouldProcess(string) {\n return string.search(URL_REGEX) !== -1;\n }\n\n function readUrls(string) {\n var result = [];\n var match;\n while ((match = URL_REGEX.exec(string)) !== null) {\n result.push(match[1]);\n }\n return result.filter(function (url) {\n return !util.isDataUrl(url);\n });\n }\n\n function inline(string, url, baseUrl, get) {\n return Promise.resolve(url)\n .then(function (url) {\n return baseUrl ? util.resolveUrl(url, baseUrl) : url;\n })\n .then(get || util.getAndEncode)\n .then(function (data) {\n return util.dataAsUrl(data, util.mimeType(url));\n })\n .then(function (dataUrl) {\n return string.replace(urlAsRegex(url), '$1' + dataUrl + '$3');\n });\n\n function urlAsRegex(url) {\n return new RegExp('(url\\\\([\\'\"]?)(' + util.escape(url) + ')([\\'\"]?\\\\))', 'g');\n }\n }\n\n function inlineAll(string, baseUrl, get) {\n if (nothingToInline()) return Promise.resolve(string);\n\n return Promise.resolve(string)\n .then(readUrls)\n .then(function (urls) {\n var done = Promise.resolve(string);\n urls.forEach(function (url) {\n done = done.then(function (string) {\n return inline(string, url, baseUrl, get);\n });\n });\n return done;\n });\n\n function nothingToInline() {\n return !shouldProcess(string);\n }\n }\n }\n\n function newFontFaces() {\n return {\n resolveAll: resolveAll,\n impl: {\n readAll: readAll\n }\n };\n\n function resolveAll() {\n return readAll(document)\n .then(function (webFonts) {\n return Promise.all(\n webFonts.map(function (webFont) {\n return webFont.resolve();\n })\n );\n })\n .then(function (cssStrings) {\n return cssStrings.join('\\n');\n });\n }\n\n function readAll() {\n return Promise.resolve(util.asArray(document.styleSheets))\n .then(getCssRules)\n .then(selectWebFontRules)\n .then(function (rules) {\n return rules.map(newWebFont);\n });\n\n function selectWebFontRules(cssRules) {\n return cssRules\n .filter(function (rule) {\n return rule.type === CSSRule.FONT_FACE_RULE;\n })\n .filter(function (rule) {\n return inliner.shouldProcess(rule.style.getPropertyValue('src'));\n });\n }\n\n function getCssRules(styleSheets) {\n var cssRules = [];\n styleSheets.forEach(function (sheet) {\n try {\n util.asArray(sheet.cssRules || []).forEach(cssRules.push.bind(cssRules));\n } catch (e) {\n console.log('Error while reading CSS rules from ' + sheet.href, e.toString());\n }\n });\n return cssRules;\n }\n\n function newWebFont(webFontRule) {\n return {\n resolve: function resolve() {\n var baseUrl = (webFontRule.parentStyleSheet || {}).href;\n return inliner.inlineAll(webFontRule.cssText, baseUrl);\n },\n src: function () {\n return webFontRule.style.getPropertyValue('src');\n }\n };\n }\n }\n }\n\n function newImages() {\n return {\n inlineAll: inlineAll,\n impl: {\n newImage: newImage\n }\n };\n\n function newImage(element) {\n return {\n inline: inline\n };\n\n function inline(get) {\n if (util.isDataUrl(element.src)) return Promise.resolve();\n\n return Promise.resolve(element.src)\n .then(get || util.getAndEncode)\n .then(function (data) {\n return util.dataAsUrl(data, util.mimeType(element.src));\n })\n .then(function (dataUrl) {\n return new Promise(function (resolve, reject) {\n element.onload = resolve;\n element.onerror = reject;\n element.src = dataUrl;\n });\n });\n }\n }\n\n function inlineAll(node) {\n if (!(node instanceof Element)) return Promise.resolve(node);\n\n return inlineBackground(node)\n .then(function () {\n if (node instanceof HTMLImageElement)\n return newImage(node).inline();\n else\n return Promise.all(\n util.asArray(node.childNodes).map(function (child) {\n return inlineAll(child);\n })\n );\n });\n\n function inlineBackground(node) {\n if (node.style === undefined) {\n return Promise.resolve(node);\n }\n var background = node.style.getPropertyValue('background');\n\n if (!background) return Promise.resolve(node);\n\n return inliner.inlineAll(background)\n .then(function (inlined) {\n node.style.setProperty(\n 'background',\n inlined,\n node.style.getPropertyPriority('background')\n );\n })\n .then(function () {\n return node;\n });\n }\n }\n }\n})(this);\n","\n\n\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\n","\n\n{#if !ignoreEmptyCache && isGraph && ($GraphsCached || []).length && !$GraphsCached.includes(graphName) && dataRequirements[graphName] && dataRequirements[graphName].every( (requirement) => Object.values($DataUploaded || {})\n\t\t\t\t.reduce((a, b) => a.concat(b), [])\n\t\t\t\t.includes(requirement) )}\n\t\n\t\tTry refreshing the page - it might be that this page is still processing and getting ready. If\n\t\tit persists, come back in 5 minutes!\n\t\t{#if window.location.href.includes('localhost') || window.location.href.includes('hedge')}\n\t\t\t\n\t\t{/if}\n\t\n{:else}\n\t{#await awaitPromise}\n\t\t\n\t\t\n\t{:then res}\n\t\t{#if !$DemoMode && graphName != 'Indieness' && (!res || (typeof res == 'string' && res.toUpperCase() === 'NO CONTENT') || (typeof res == 'object' && !Object.values(res).some((i) => i)))}\n\t\t\t{#if showError}\n\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\tšŸ‘€\n\t\t\t\t\t\t šŸ‘€ \n\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t{/if}\n\t\t{:else}\n\t\t\t\n\t\t{/if}\n\t{:catch error}\n\t\t{#if showError}\n\t\t\t\n\t\t\t\t
\n\t\t\t\t\tšŸ‘€\n\t\t\t\t\t šŸ‘€ \n\t\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t{:else}\n\t\t\t\n\t\t{/if}\n\t{/await}\n{/if}\n\n\n","\n\n
\n\t
\n\t
\n\t
\n\t\t\n\t\t\t\n\t\t
\n\t
\n\t{#key metric}\n\t\t
\n\t\t\t{#if !loaded && !metric}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t{:else if metric}\n\t\t\t\t\n\t\t\t\t\t{metric}\n\t\t\t\t\n\t\t\t{:else}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t{/if}\n\t\t\t {name} \n\t\t
\n\t{/key}\n
\n\n\n","import { LocalNotifications } from '@capacitor/local-notifications';\nimport { sleep } from '$lib/utils.js';\n\nlet timesRun = 0;\nlet beingRun;\nexport async function setPowerNotifications(powerPeaks, powerDips, wakeup) {\n timesRun = timesRun++\n await sleep(timesRun * 2000)\n if (beingRun) return;\n beingRun = true;\n let pstate = await LocalNotifications.requestPermissions();\n // 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';;\n if (pstate.display === 'granted' && powerPeaks && powerPeaks?.length) {\n let existingNotifications = await LocalNotifications.getPending().then(\n (notifObject) => notifObject.notifications\n );\n if (existingNotifications && existingNotifications?.length) LocalNotifications.cancel({\n notifications: existingNotifications\n });\n let existingPowerNotifications = existingNotifications.filter(\n (notif) => notif.title.includes('Get ready to peak') || notif.title.includes('Prepare for your dip')\n );\n if (existingPowerNotifications && existingPowerNotifications?.length)\n await LocalNotifications.cancel({\n notifications: existingPowerNotifications\n });\n let existingGmNotifications = existingNotifications.filter(\n (notif) => notif.title.includes('Good morning!')\n );\n if (existingGmNotifications && existingGmNotifications?.length)\n await LocalNotifications.cancel({\n notifications: existingGmNotifications\n });\n let peaksToNotif = powerPeaks.filter((peak) => peak.position < 1140);\n\n await LocalNotifications.schedule({\n notifications: [\n {\n id: 1000 * Math.round(999 * Math.random()) + Math.round(999 * Math.random()),\n title: 'Good morning! Feeling powerful?',\n body: `Check out your Power curve for the day, and see what's been affecting it!`,\n schedule: {\n repeats: true,\n // at: dayjs()\n on: {\n hour: wakeup ? Number(wakeup.add(15, 'minutes').format('HH:mm').split(':')[0]) : 8,\n minute: wakeup\n ? Number(wakeup.add(15, 'minutes').format('HH:mm').split(':')[1])\n : 45\n }\n }\n },\n ...(powerPeaks || [])\n .filter((peak) => peak.position < 1140)\n .slice(0, 2)\n .map((peak) => dayjs(peak.timestamp).subtract(120, 'minutes').format('HH:mm'))\n .map((time, i) => {\n return {\n id: 1000 * i + Math.round(999 * Math.random()),\n title: 'Get ready to peak in 30m',\n body: `Clear your schedule and line up your most challenging work! Try a Focus session.`,\n schedule: {\n repeats: true,\n // at: dayjs()\n on: {\n hour: Number(time.split(':')[0]),\n minute: Number(time.split(':')[1])\n }\n }\n };\n }),\n ...(powerDips || [])\n .filter((dip) => dip.position < 1140)\n .slice(0, 2)\n .map((dip) => dayjs(dip.timestamp).subtract(120, 'minutes').format('HH:mm'))\n .map((time, i) => {\n return {\n id: 1000 * i + Math.round(999 * Math.random()),\n title: 'Prepare for your dip in 30m',\n body: `Check the app for what you can do to stay productive!`,\n schedule: {\n repeats: true,\n // at: dayjs()\n on: {\n hour: Number(time.split(':')[0]),\n minute: Number(time.split(':')[1])\n }\n }\n };\n })\n ]\n });\n\n let newPending = await LocalNotifications.getPending();\n beingRun = false;\n }\n}","\n\n\n\n\n\n\n{#if showDetailsFor === 'screentime'}\n\t\n{/if}\n{#if showDetailsFor === 'recovery'}\n\t
\n\t\t
\n\t\t\t{scores.readiness ? Math.min(Math.round(scores.readiness), 100) : '--'}\n\t\t\t%\n\t\t
\n\t\t
\n\t\t\t\n\t\t
\n\t
\n\t
\n\t\t
\n\t\t\tLast night's sleep\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\t
\n\t\t\t\t\t s.date === todaysDate)\n\t\t\t\t\t\t\t? (\n\t\t\t\t\t\t\t\t\tMath.round(\n\t\t\t\t\t\t\t\t\t\tdebt.sleepWithDebt\n\t\t\t\t\t\t\t\t\t\t\t.slice(0, 13)\n\t\t\t\t\t\t\t\t\t\t\t.map((s) => s.debtContributions)\n\t\t\t\t\t\t\t\t\t\t\t.reduce((a, b) => a + b, 0) * 0.769231\n\t\t\t\t\t\t\t\t\t) /\n\t\t\t\t\t\t\t\t\t\t10 -\n\t\t\t\t\t\t\t\t\tMath.round(\n\t\t\t\t\t\t\t\t\t\tdebt?.sleepWithDebt?.find((s) => s.date === todaysDate) &&\n\t\t\t\t\t\t\t\t\t\t\tdebt?.sleepWithDebt?.find((s) => s.date === todaysDate).debtContributions * 40\n\t\t\t\t\t\t\t\t\t) /\n\t\t\t\t\t\t\t\t\t\t10\n\t\t\t\t\t\t\t ).toFixed(1) || '-- '\n\t\t\t\t\t\t\t: '-- ') + '%'}\n\t\t\t\t\t\tsize={[2, 2]}\n\t\t\t\t\t/>\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t
\n\t
\n\t\t
\n\t\t\tRecent impacts\n\t\t
\n\t\t
\n\t\t\t{#each ['steps', 'heart_rate', 'sleep'] as attribute, i}\n\t\t\t\t\n\t\t\t\t\t 0 ? '#00ff53' : '#EF226C'\n\t\t\t\t\t\t\t }`}\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{powerImpacts &&\n\t\t\t\t\t\tpowerImpacts['recent_' + attribute] !== undefined &&\n\t\t\t\t\t\t!isNaN(powerImpacts['recent_' + attribute])\n\t\t\t\t\t\t\t? powerImpacts['recent_' + attribute].toFixed(1)\n\t\t\t\t\t\t\t: '--'}%\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t{/each}\n\t\t\n\t\n{/if}\n{#if showDetailsFor === 'power'}\n\t{#if !$IsNative && !$UserInfo.syncHKEnabled}\n\t\t\n\t\t\t\n\t\t\t\t
Power score
\n\t\t\t\t

\n\t\t\t\t\tYour power score is our prediction of your current mental performance level. The higher\n\t\t\t\t\tyour power, the easier it will be for you to get into flow.\n\t\t\t\t

\n\t\t\t\t

\n\t\t\t\t\tTo get yours, you'll need our iOS app to sync Apple Health with Magicflow. We predict it\n\t\t\t\t\tfrom your circadian rhythm, activity, and biometrics (heart rate, HRV, etc.).\n\t\t\t\t

\n\t\t\t\t

\n\t\t\t\t\tScan the QR code below with your phone to download it!\n\t\t\t\t

\n\t\t\t
\n\t\t\t\"testFlight\"\n\t\t\n\t{:else}\n\t\t\n\t\t\t\n\t\t\t\t{#if mounted}\n\t\t\t\t\t{#key powerDips}\n\t\t\t\t\t\t\n\t\t\t\t\t{/key}\n\t\t\t\t{/if}\n\t\t\t\n\n\t\t\t{#each [['sleep debt', 'recovery'], ['steps', 'heart_rate']] as attributes, set}\n\t\t\t\t{#each attributes as attribute, i}\n\t\t\t\t\t (showDetailsFor = attribute)}\n\t\t\t\t\t>\n\t\t\t\t\t\t= 0\n\t\t\t\t\t\t\t\t\t\t\t? '#00FF8C'\n\t\t\t\t\t\t\t\t\t\t\t: '#EF226C'\n\t\t\t\t\t\t\t\t }`}\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{powerImpacts &&\n\t\t\t\t\t\t\tpowerImpacts['todays_' + attribute.split(' ')[0]] !== undefined &&\n\t\t\t\t\t\t\t!isNaN(powerImpacts['todays_' + attribute.split(' ')[0]])\n\t\t\t\t\t\t\t\t? (attribute.includes('sleep')\n\t\t\t\t\t\t\t\t\t\t? powerImpacts['recent_' + attribute.split(' ')[0]]\n\t\t\t\t\t\t\t\t\t\t: powerImpacts['todays_' + attribute.split(' ')[0]]\n\t\t\t\t\t\t\t\t ).toFixed(1)\n\t\t\t\t\t\t\t\t: '--'}%\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t{#if attribute === 'sleep debt'}\n\t\t\t\t\t\t\t\t{#each scores && !isNaN(scores.sleep_debt) ? makeDecimalIntoTime(scores.sleep_debt < 0 ? 0 : scores.sleep_debt) : ['--', '--'] as time, i}\n\t\t\t\t\t\t\t\t\t{time || 0}{i ? 'm' : 'h '}\n\t\t\t\t\t\t\t\t{/each}\n\t\t\t\t\t\t\t{:else if attribute === 'recovery'}\n\t\t\t\t\t\t\t\t{scores.readiness ? Math.round(scores.readiness) : '--'}%\n\t\t\t\t\t\t\t{:else}\n\t\t\t\t\t\t\t\t{todaysData && !isNaN(todaysData[attribute]?.value)\n\t\t\t\t\t\t\t\t\t? todaysData[attribute].value\n\t\t\t\t\t\t\t\t\t: '--'}\n\t\t\t\t\t\t\t{/if}\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t{/each}\n\t\t\t{/each}\n\t\t\n\t\t{#if scores || loaded}\n\t\t\t\n\t\t\t\t{#if loaded && !metric}\n\t\t\t\t\t
\n\t\t\t\t\t\tYou don't have recent enough sleep/steps data available for us to generate a power\n\t\t\t\t\t\tscore.\n\t\t\t\t\t
\n\t\t\t\t{:else}\n\t\t\t\t\t
\n\t\t\t\t\t\t
{metric || '--'}
\n\t\t\t\t\t\t
Current
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t{scores.readiness\n\t\t\t\t\t\t\t\t? Math.min(Math.round(scores.readiness + (powerImpactAggregated || 0)), 100)\n\t\t\t\t\t\t\t\t: '--'}\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
Potential
\n\t\t\t\t\t
\n\t\t\t\t{/if}\n\t\t\t\n\t\t\t{#if mounted && $UserInfo.syncHKEnabled}\n\t\t\t\t
\n\t\t\t\t\t{#if mounted && $UserInfo.syncHKEnabled}\n\t\t\t\t\t\t{#key powerDips}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{/key}\n\t\t\t\t\t{/if}\n\t\t\t\t
\n\t\t\t{/if}\n\t\t\t\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\tRecent impacts\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t{#each ['steps', 'heart_rate', 'sleep'] as attribute, i}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t 0\n\t\t\t\t\t\t\t\t\t\t\t\t? '#00ff53'\n\t\t\t\t\t\t\t\t\t\t\t\t: '#EF226C'\n\t\t\t\t\t\t\t\t\t }`}\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{powerImpacts &&\n\t\t\t\t\t\t\t\tpowerImpacts['recent_' + attribute] !== undefined &&\n\t\t\t\t\t\t\t\t!isNaN(powerImpacts['recent_' + attribute])\n\t\t\t\t\t\t\t\t\t? powerImpacts['recent_' + attribute].toFixed(1)\n\t\t\t\t\t\t\t\t\t: '--'}%\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t{/each}\n\t\t\t\t\n\t\t\t\n\t\t{:else}\n\t\t\t\n\t\t\t
\n\t\t{/if}\n\t{/if}\n{/if}\n{#each details?.[showDetailsFor]?.text || [] as paragraph, i}\n\t

{paragraph}

\n{/each}\n{#if showDetailsFor === 'power'}\n\t{#if !($UserInfo && $UserInfo.powerNotifications) && $IsNative}\n\t\t

Want a nudge before each Peak?

\n\t\t {\n\t\t\t\t$UserInfo.powerNotifications = true;\n\t\t\t\tpowerNotificationButtonText = 'Notifications set!';\n\t\t\t}}>{powerNotificationButtonText}\n\t{:else}\n\t\t {\n\t\t\t\t$Tracking.mood.tracking = true;\n\t\t\t\tshowDetailsFor = false;\n\t\t\t}}>Check in with your mind\n\t{/if}\n{/if}\n\n","\n\n\n{#if $ShowDetailsFor[$Path] && !detailsOptions.includes($ShowDetailsFor[$Path])}\n\t\n\t\t
\n\t\t\tYour {$ShowDetailsFor[$Path]}\n\t\t
\n\t\t
\n\t\n{/if}\n{#if false && $IsDev}\n\t\n\t\t\n\t\n{/if}\n{#if $ShowDetailsFor[$Path] && detailsOptions.includes($ShowDetailsFor[$Path])}\n\t\n\t\t
\n\t\t\t\n\t\t
\n\t
\n{/if}\n\n\n\t\n\t\n\t\n\t\n\t\n\t\t\n\t\t\t\n\t\t\t{#if selectedTimePeriod === 'month' && !$ShowDetailsFor.time}\n\t\t\t\t
\n\t\t\t\t\t{#each ['sankey', 'timeLines'] as view}\n\t\t\t\t\t\t (monthView = view)}>{view}\n\t\t\t\t\t{/each}\n\t\t\t\t
\n\t\t\t{/if}\n\t\t\t{#if selectedTimePeriod === 'week' && !$ShowDetailsFor.time}\n\t\t\t\t
\n\t\t\t\t\t{#each ['sankey', 'comparisons'] as view}\n\t\t\t\t\t\t (weekView = view)}>{view}\n\t\t\t\t\t{/each}\n\t\t\t\t
\n\t\t\t{/if}\n\n\t\t\t\n\t\t\n\t\t\n\t\n\n","\n\n
\n\t\n
\n","\n\n\n\tKeep all data local-only:\n\t\n\n\n\tPermanent dark mode: \n\t console.log('alwaysdark checkbox')}\n\t\tbind:checked={$UserInfo.alwaysDark}\n\t/>\n\n{#if !privacyOnly}\n\t\n\t