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","webpack://platform/./app/assets/common.js","webpack://platform/./app/components/time_elements/extended_time_element.js","webpack://platform/./app/components/time_elements/local_time_element.js","webpack://platform/./app/components/time_elements/relative_time.js","webpack://platform/./app/components/time_elements/relative_time_element.js","webpack://platform/./app/components/time_elements/time_ago_element.js","webpack://platform/./app/components/time_elements/time_until_element.js","webpack://platform/./app/components/time_elements/utils.js"],"sourcesContent":["Date.prototype.stdTimezoneOffset = function () {\n const monthsTestOrder = [6, 7, 5, 8, 4, 9, 3, 10, 2, 11, 1, 0]\n const fy = this.getFullYear()\n\n // eslint-disable-next-line no-prototype-builtins\n if (!Date.prototype.stdTimezoneOffset.cache.hasOwnProperty(fy)) {\n let maxOffset = new Date(fy, 0, 1).getTimezoneOffset()\n\n for (let mi = 0; mi < 12; mi++) {\n const offset = new Date(fy, monthsTestOrder[mi], 1).getTimezoneOffset()\n\n if (offset < maxOffset) {\n maxOffset = Math.max(maxOffset, offset)\n break\n } else if (offset > maxOffset) {\n maxOffset = offset\n break\n }\n }\n\n Date.prototype.stdTimezoneOffset.cache[fy] = maxOffset\n }\n\n return Date.prototype.stdTimezoneOffset.cache[fy]\n}\n\nDate.prototype.stdTimezoneOffset.cache = {}\n\nDate.prototype.isDST = function () {\n return this.getTimezoneOffset() < this.stdTimezoneOffset()\n}\n","/* global smartlook */\n\nimport 'assets/lib/react/client.jsx'\nimport 'assets/lib/time.js'\nimport 'components/time_elements/index.js'\nimport Rails from '@rails/ujs'\n\ndocument.addEventListener('DOMContentLoaded', () => {\n Rails.start()\n\n // Handle post sign out\n if (location.search !== '') {\n const params = new URLSearchParams(location.search)\n\n if (params.has('signed_out') && params.get('signed_out') === '1') {\n typeof smartlook !== 'undefined' && smartlook('anonymize')\n }\n }\n})\n","import { makeFormatter } from './utils.js'\n\nexport default class ExtendedTimeElement extends HTMLElement {\n static get observedAttributes() {\n return [\n 'datetime',\n 'day',\n 'format',\n 'hour',\n 'minute',\n 'month',\n 'second',\n 'title',\n 'weekday',\n 'year'\n ]\n }\n\n // Internal: Refresh the time element's formatted date when an attribute changes.\n //\n // Returns nothing.\n attributeChangedCallback(attrName, oldValue, newValue) {\n if (attrName === 'datetime') {\n const millis = Date.parse(newValue)\n this._date = Number.isNaN(millis) ? null : new Date(millis)\n }\n\n const title = this.getFormattedTitle()\n if (title && !this.hasAttribute('title')) {\n this.setAttribute('title', title)\n }\n\n const text = this.getFormattedDate()\n if (text) {\n this.textContent = text\n }\n }\n\n // Internal: Format the ISO 8601 timestamp according to the user agent's\n // locale-aware formatting rules. The element's existing `title` attribute\n // value takes precedence over this custom format.\n //\n // Returns a formatted time String.\n getFormattedTitle() {\n if (!this._date) {\n return\n }\n\n const formatter = makeFormatter({\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n timeZoneName: 'short'\n })\n\n if (formatter) {\n return formatter.format(this._date)\n } else {\n try {\n return this._date.toLocaleString()\n } catch (error) {\n if (error instanceof RangeError) {\n return this._date.toString()\n } else {\n throw error\n }\n }\n }\n }\n}\n","import ExtendedTimeElement from './extended_time_element.js'\nimport { isDayFirst, makeFormatter, strftime } from './utils.js'\n\nexport default class LocalTimeElement extends ExtendedTimeElement {\n // Formats the element's date, in the user's current locale, according to\n // the formatting attribute values. Values are not passed straight through to\n // an Intl.DateTimeFormat instance so that weekday and month names are always\n // displayed in English, for now.\n //\n // Supported attributes are:\n //\n // weekday - \"short\", \"long\", \"relative\"\n // year - \"numeric\", \"2-digit\"\n // month - \"short\", \"long\"\n // day - \"numeric\", \"2-digit\"\n // hour - \"numeric\", \"2-digit\"\n // minute - \"numeric\", \"2-digit\"\n // second - \"numeric\", \"2-digit\"\n //\n // Returns a formatted time String.\n getFormattedDate() {\n if (!this._date) {\n return\n }\n\n const date = formatDate(this) || ''\n const time = formatTime(this) || ''\n return `${date} ${time}`.trim()\n }\n}\n\n// Private: Format a date according to the `weekday`, `day`, `month`,\n// and `year` attribute values.\n//\n// This doesn't use Intl.DateTimeFormat to avoid creating text in the user's\n// language when the majority of the surrounding text is in English. There's\n// currently no way to separate the language from the format in Intl.\n//\n// el - The local-time element to format.\n//\n// Returns a date String or null if no date formats are provided.\nfunction formatDate(el) {\n // map attribute values to strftime\n const props = {\n weekday: {\n short: '%a',\n long: '%A',\n relative: '%W',\n repeated: \"%A's at\"\n },\n day: {\n numeric: '%e',\n '2-digit': '%d'\n },\n month: {\n short: '%b',\n long: '%B'\n },\n year: {\n numeric: '%Y',\n '2-digit': '%y'\n }\n }\n\n // build a strftime format string\n let format = isDayFirst() ? 'weekday day month year' : 'weekday month day, year'\n for (const prop in props) {\n const value = props[prop][el.getAttribute(prop)]\n format = format.replace(prop, value || '')\n }\n\n // clean up year separator comma\n format = format.replace(/(\\s,)|(,\\s$)/, '')\n\n // squeeze spaces from final string\n return strftime(el._date, format).replace(/\\s+/, ' ').trim()\n}\n\n// Private: Format a time according to the `hour`, `minute`, and `second`\n// attribute values.\n//\n// el - The local-time element to format.\n//\n// Returns a time String or null if no time formats are provided.\nfunction formatTime(el) {\n // retrieve format settings from attributes\n const options = {\n hour: el.getAttribute('hour'),\n minute: el.getAttribute('minute'),\n second: el.getAttribute('second'),\n timeZoneName: el.getAttribute('time-zone-name')\n }\n\n // remove unset format attributes\n for (const opt in options) {\n if (!options[opt]) {\n delete options[opt]\n }\n }\n\n // no time format attributes provided\n if (Object.keys(options).length === 0) {\n return\n }\n\n const formatter = makeFormatter(options)\n if (formatter) {\n // locale-aware formatting of 24 or 12 hour times\n return formatter.format(el._date)\n } else {\n // fall back to strftime for non-Intl browsers\n const timef = options.second ? '%H:%M:%S' : '%H:%M'\n return strftime(el._date, timef)\n }\n}\n\n// Public: LocalTimeElement constructor.\n//\n// var time = new LocalTimeElement()\n// # => \n//\nif (!window.customElements.get('local-time')) {\n window.LocalTimeElement = LocalTimeElement\n window.customElements.define('local-time', LocalTimeElement)\n}\n","import { isDayFirst, isThisYear, isYearSeparator, makeFormatter, strftime } from './utils.js'\n\nexport default class RelativeTime {\n constructor(date) {\n this.date = date\n }\n\n toString() {\n return this.timeElapsed() || this.timeAhead() || `on ${this.formatDate()}`\n }\n\n timeElapsed() {\n const ms = Date.now() - this.date.getTime()\n const sec = Math.round(ms / 1000)\n const min = Math.round(sec / 60)\n const hr = Math.round(min / 60)\n const day = Math.round(hr / 24)\n return ms >= 0 && day < 30 ? this.timeAgoFromMs(ms) : null\n }\n\n timeAhead() {\n const ms = this.date.getTime() - Date.now()\n const sec = Math.round(ms / 1000)\n const min = Math.round(sec / 60)\n const hr = Math.round(min / 60)\n const day = Math.round(hr / 24)\n return ms >= 0 && day < 30 ? this.timeUntil() : null\n }\n\n timeAgo() {\n const ms = Date.now() - this.date.getTime()\n return this.timeAgoFromMs(ms)\n }\n\n timeAgoFromMs(ms) {\n const sec = Math.round(ms / 1000)\n const min = Math.round(sec / 60)\n const hr = Math.round(min / 60)\n const day = Math.round(hr / 24)\n const month = Math.round(day / 30)\n const year = Math.round(month / 12)\n if (ms < 0) {\n return 'just now'\n } else if (sec < 10) {\n return 'just now'\n } else if (sec < 45) {\n return `${sec} seconds ago`\n } else if (sec < 90) {\n return 'a minute ago'\n } else if (min < 45) {\n return `${min} minutes ago`\n } else if (min < 90) {\n return 'an hour ago'\n } else if (hr < 24) {\n return `${hr} hours ago`\n } else if (hr < 36) {\n return 'a day ago'\n } else if (day < 30) {\n return `${day} days ago`\n } else if (day < 45) {\n return 'a month ago'\n } else if (month < 12) {\n return `${month} months ago`\n } else if (month < 18) {\n return 'a year ago'\n } else {\n return `${year} years ago`\n }\n }\n\n microTimeAgo() {\n const ms = Date.now() - this.date.getTime()\n const sec = Math.round(ms / 1000)\n const min = Math.round(sec / 60)\n const hr = Math.round(min / 60)\n const day = Math.round(hr / 24)\n const month = Math.round(day / 30)\n const year = Math.round(month / 12)\n if (min < 1) {\n return '1m'\n } else if (min < 60) {\n return `${min}m`\n } else if (hr < 24) {\n return `${hr}h`\n } else if (day < 365) {\n return `${day}d`\n } else {\n return `${year}y`\n }\n }\n\n timeUntil() {\n const ms = this.date.getTime() - Date.now()\n return this.timeUntilFromMs(ms)\n }\n\n timeUntilFromMs(ms) {\n const sec = Math.round(ms / 1000)\n const min = Math.round(sec / 60)\n const hr = Math.round(min / 60)\n const day = Math.round(hr / 24)\n const month = Math.round(day / 30)\n const year = Math.round(month / 12)\n if (month >= 18) {\n return `${year} years from now`\n } else if (month >= 12) {\n return 'a year from now'\n } else if (day >= 45) {\n return `${month} months from now`\n } else if (day >= 30) {\n return 'a month from now'\n } else if (hr >= 36) {\n return `${day} days from now`\n } else if (hr >= 24) {\n return 'a day from now'\n } else if (min >= 90) {\n return `${hr} hours from now`\n } else if (min >= 45) {\n return 'an hour from now'\n } else if (sec >= 90) {\n return `${min} minutes from now`\n } else if (sec >= 45) {\n return 'a minute from now'\n } else if (sec >= 10) {\n return `${sec} seconds from now`\n } else {\n return 'just now'\n }\n }\n\n microTimeUntil() {\n const ms = this.date.getTime() - Date.now()\n const sec = Math.round(ms / 1000)\n const min = Math.round(sec / 60)\n const hr = Math.round(min / 60)\n const day = Math.round(hr / 24)\n const month = Math.round(day / 30)\n const year = Math.round(month / 12)\n if (day >= 365) {\n return `${year}y`\n } else if (hr >= 24) {\n return `${day}d`\n } else if (min >= 60) {\n return `${hr}h`\n } else if (min > 1) {\n return `${min}m`\n } else {\n return '1m'\n }\n }\n\n formatDate() {\n let format = isDayFirst() ? '%e %b' : '%b %e'\n if (!isThisYear(this.date)) {\n format += isYearSeparator() ? ', %Y' : ' %Y'\n }\n return strftime(this.date, format)\n }\n\n formatTime() {\n const formatter = makeFormatter({ hour: 'numeric', minute: '2-digit' })\n return formatter ? formatter.format(this.date) : strftime(this.date, '%l:%M%P')\n }\n}\n","import ExtendedTimeElement from './extended_time_element.js'\nimport RelativeTime from './relative_time.js'\n\nexport default class RelativeTimeElement extends ExtendedTimeElement {\n getFormattedDate() {\n if (this._date) {\n return new RelativeTime(this._date).toString()\n }\n }\n\n connectedCallback() {\n nowElements.push(this)\n\n if (!updateNowElementsId) {\n updateNowElements()\n updateNowElementsId = setInterval(updateNowElements, 60 * 1000)\n }\n }\n\n disconnectedCallback() {\n const ix = nowElements.indexOf(this)\n if (ix !== -1) {\n nowElements.splice(ix, 1)\n }\n\n if (nowElements.length === 0 && updateNowElementsId) {\n clearInterval(updateNowElementsId)\n updateNowElementsId = null\n }\n }\n}\n\n// Internal: Array tracking all elements attached to the document that need\n// to be updated every minute.\nconst nowElements = []\n\n// Internal: Timer ID for `updateNowElements` interval.\nlet updateNowElementsId\n\n// Internal: Install a timer to refresh all attached relative-time elements every\n// minute.\nfunction updateNowElements() {\n let time, i, len\n for (i = 0, len = nowElements.length; i < len; i++) {\n time = nowElements[i]\n time.textContent = time.getFormattedDate()\n }\n}\n\n// Public: RelativeTimeElement constructor.\n//\n// var time = new RelativeTimeElement()\n// # => \n//\nif (!window.customElements.get('relative-time')) {\n window.RelativeTimeElement = RelativeTimeElement\n window.customElements.define('relative-time', RelativeTimeElement)\n}\n","import RelativeTime from './relative_time.js'\nimport RelativeTimeElement from './relative_time_element.js'\n\nexport default class TimeAgoElement extends RelativeTimeElement {\n getFormattedDate() {\n if (this._date) {\n const format = this.getAttribute('format')\n return format === 'micro'\n ? new RelativeTime(this._date).microTimeAgo()\n : new RelativeTime(this._date).timeAgo()\n }\n }\n}\n\nif (!window.customElements.get('time-ago')) {\n window.TimeAgoElement = TimeAgoElement\n window.customElements.define('time-ago', TimeAgoElement)\n}\n","import RelativeTime from './relative_time.js'\nimport RelativeTimeElement from './relative_time_element.js'\n\nexport default class TimeUntilElement extends RelativeTimeElement {\n getFormattedDate() {\n if (this._date) {\n return this.getAttribute('format') === 'micro'\n ? new RelativeTime(this._date).microTimeUntil()\n : new RelativeTime(this._date).timeUntil()\n }\n }\n}\n\nif (!window.customElements.get('time-until')) {\n window.TimeUntilElement = TimeUntilElement\n window.customElements.define('time-until', TimeUntilElement)\n}\n","import { addDays, isSameDay } from 'date-fns'\n\nconst weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']\nconst months = [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December'\n]\n\nfunction pad(num) {\n return `0${num}`.slice(-2)\n}\n\nexport function strftime(time, formatString) {\n const day = time.getDay()\n const date = time.getDate()\n const month = time.getMonth()\n const year = time.getFullYear()\n const hour = time.getHours()\n const minute = time.getMinutes()\n const second = time.getSeconds()\n return formatString.replaceAll(/%([%ABHIMPSWYZa-elmpwyz])/g, function (_arg) {\n let match\n const modifier = _arg[1]\n switch (modifier) {\n case '%': {\n return '%'\n }\n case 'a': {\n return weekdays[day].slice(0, 3)\n }\n case 'A': {\n return weekdays[day]\n }\n case 'b': {\n return months[month].slice(0, 3)\n }\n case 'B': {\n return months[month]\n }\n case 'c': {\n return time.toString()\n }\n case 'd': {\n return pad(date)\n }\n case 'e': {\n return date\n }\n case 'H': {\n return pad(hour)\n }\n case 'I': {\n return pad(strftime(time, '%l'))\n }\n case 'l': {\n return hour === 0 || hour === 12 ? 12 : (hour + 12) % 12\n }\n case 'm': {\n return pad(month + 1)\n }\n case 'M': {\n return pad(minute)\n }\n case 'p': {\n return hour > 11 ? 'PM' : 'AM'\n }\n case 'P': {\n return hour > 11 ? 'pm' : 'am'\n }\n case 'S': {\n return pad(second)\n }\n case 'w': {\n return day\n }\n case 'W': {\n if (isSameDay(new Date(), time)) return 'Today'\n if (isSameDay(time, addDays(new Date(), 1))) return 'Tomorrow'\n if (time <= addDays(new Date(), 6)) return strftime(time, '%A')\n\n return strftime(time, '%a, %b %e')\n }\n case 'y': {\n return pad(year % 100)\n }\n case 'Y': {\n return year\n }\n case 'Z': {\n match = time.toString().match(/\\((\\w+)\\)$/)\n return match ? match[1] : ''\n }\n case 'z': {\n match = time.toString().match(/\\w([+-]\\d{4}) /)\n return match ? match[1] : ''\n }\n }\n })\n}\n\nexport function makeFormatter(options) {\n if (typeof Intl !== 'undefined') {\n try {\n return new Intl.DateTimeFormat(undefined, options)\n } catch (error) {\n if (!(error instanceof RangeError)) {\n throw error\n }\n }\n }\n}\n\nlet dayFirst = null\n\n// Private: Determine if the day should be formatted before the month name in\n// the user's current locale. For example, `9 Jun` for en-GB and `Jun 9`\n// for en-US.\n//\n// Returns true if the day appears before the month.\nexport function isDayFirst() {\n if (dayFirst !== null) {\n return dayFirst\n }\n\n const formatter = makeFormatter({ day: 'numeric', month: 'short' })\n if (formatter) {\n const output = formatter.format(new Date(0))\n dayFirst = !!/^\\d/.test(output)\n return dayFirst\n } else {\n return false\n }\n}\n\nlet yearSeparator = null\n\n// Private: Determine if the year should be separated from the month and day\n// with a comma. For example, `9 Jun 2014` in en-GB and `Jun 9, 2014` in en-US.\n//\n// Returns true if the date needs a separator.\nexport function isYearSeparator() {\n if (yearSeparator !== null) {\n return yearSeparator\n }\n\n const formatter = makeFormatter({ day: 'numeric', month: 'short', year: 'numeric' })\n if (formatter) {\n const output = formatter.format(new Date(0))\n yearSeparator = !!/\\d,/.test(output)\n return yearSeparator\n } else {\n return true\n }\n}\n\n// Private: Determine if the date occurs in the same year as today's date.\n//\n// date - The Date to test.\n//\n// Returns true if it's this year.\nexport function isThisYear(date) {\n const now = new Date()\n return now.getUTCFullYear() === date.getUTCFullYear()\n}\n"],"names":["Date","prototype","stdTimezoneOffset","monthsTestOrder","fy","this","getFullYear","cache","hasOwnProperty","maxOffset","getTimezoneOffset","mi","offset","Math","max","isDST","document","addEventListener","Rails","start","location","search","params","URLSearchParams","has","get","smartlook","ExtendedTimeElement","HTMLElement","observedAttributes","attributeChangedCallback","attrName","oldValue","newValue","millis","parse","_date","Number","isNaN","title","getFormattedTitle","hasAttribute","setAttribute","text","getFormattedDate","textContent","formatter","makeFormatter","day","month","year","hour","minute","timeZoneName","format","toLocaleString","error","RangeError","toString","LocalTimeElement","el","props","weekday","short","long","relative","repeated","numeric","isDayFirst","prop","value","getAttribute","replace","strftime","trim","formatDate","options","second","opt","Object","keys","length","timef","formatTime","window","customElements","define","RelativeTime","constructor","date","timeElapsed","timeAhead","ms","now","getTime","sec","round","min","hr","timeAgoFromMs","timeUntil","timeAgo","microTimeAgo","timeUntilFromMs","microTimeUntil","isThisYear","isYearSeparator","RelativeTimeElement","connectedCallback","nowElements","push","updateNowElementsId","updateNowElements","setInterval","disconnectedCallback","ix","indexOf","splice","clearInterval","time","i","len","TimeAgoElement","TimeUntilElement","weekdays","months","pad","num","slice","formatString","getDay","getDate","getMonth","getHours","getMinutes","getSeconds","replaceAll","_arg","match","isSameDay","addDays","Intl","DateTimeFormat","undefined","dayFirst","output","test","yearSeparator","getUTCFullYear"],"sourceRoot":""}