{"version":3,"sources":["webpack:///./node_modules/cocoon-js-vanilla/index.js","webpack:///./app/javascript/packs/public.jsx","webpack:///./app/javascript/mastodon/load_keyboard_extensions.js"],"names":["document","addEventListener","cocoonElementCounter","createNewID","Date","getTime","newcontentBraced","id","newcontentUnderscored","cocoonAddFields","e","target","preventDefault","stopPropagation","thisNode","assoc","getAttribute","assocs","content","insertionMethod","insertionNode","insertionTraversal","count","parseInt","regexpBraced","RegExp","regexpUnderscored","newId","newContent","replace","newContents","originalEvent","isNaN","Math","max","push","insertionNodeElem","console","warn","querySelector","parentNode","getInsertionNodeElem","length","forEach","node","i","contentNode","beforeInsert","CustomEvent","bubbles","cancelable","detail","dispatchEvent","defaultPrevented","htmlMapping","before","prepend","append","after","htmlMethod","addedContent","insertAdjacentHTML","previousElementSibling","firstElementChild","lastElementChild","nextElementSibling","afterInsert","cocoonRemoveFields","wrapperClass","nodeToDelete","closest","triggerNode","beforeRemove","timeout","setTimeout","classList","contains","parentElement","removeChild","elem","selector","sibling","matches","cocoonGetPreviousSibling","value","style","display","afterRemove","this","start","messages","defineMessages","usernameTaken","defaultMessage","passwordExceedsLength","passwordDoesNotMatch","loaded","localeData","getLocale","scrollToDetailedStatus","history","createBrowserHistory","detailedStatuses","querySelectorAll","location","state","scrolledToDetailedStatus","scrollIntoView","pathname","getEmojiAnimationHandler","swapTo","_ref","src","locale","documentElement","lang","dateTimeFormat","Intl","DateTimeFormat","year","month","day","hour","minute","dateFormat","timeFormat","timeStyle","hour12","formatMessage","_ref2","values","IntlMessageFormat","format","call","innerHTML","emojify","datetime","formattedDate","title","textContent","todayFormat","formattedContent","date","today","getDate","getMonth","getFullYear","isToday","formattedTime","time","now","timeGiven","includes","timeAgoString","formatDate","options","reactComponents","then","_ref3","default","MediaContainer","component","children","child","createElement","createRoot","render","_jsx","components","body","appendChild","catch","error","delegate","_throttle","username","getElementById","axios","get","params","acct","setCustomValidity","leading","trailing","password","confirmation","maxLength","statusEl","dataset","spoiler","spoilerLink","message","window","data","parent","type","ready","postMessage","height","getElementsByTagName","scrollHeight","_ref4","name","escapeTextContentForBrowser","_ref5","avatar","file","files","url","URL","createObjectURL","originalSrc","getProfileAvatarAnimationHandler","_ref6","swapSrc","_ref7","lock","checked","hidden","_ref8","focus","select","setSelectionRange","_ref9","input","oldReadOnly","readonly","execCommand","blur","add","remove","err","toggleSidebar","sidebar","toggleButton","overflow","setAttribute","toggle","key","field","loadPolyfills","loadLocale","test","navigator","userAgent","arrowKeyNav","register","Promise","resolve"],"mappings":"6EAAAA,SAASC,iBAAiB,oBAAoB,WAC5C,IAAIC,EAAuB,EACvBC,EAAc,WAChB,OAAO,IAAIC,MAAOC,UAAYH,GAChC,EACII,EAAmB,SAAUC,GAC/B,MAAO,IAAMA,EAAK,KACpB,EACIC,EAAwB,SAAUD,GACpC,MAAO,IAAMA,EAAK,KACpB,EA+BIE,EAAkB,SAAUC,EAAGC,GACjCD,EAAEE,iBACFF,EAAEG,kBACF,IAAIC,EAAWH,EACXI,EAAQD,EAASE,aAAa,oBAC9BC,EAASH,EAASE,aAAa,qBAC/BE,EAAUJ,EAASE,aAAa,uCAChCG,EAAkBL,EAASE,aAAa,sCAAwCF,EAASE,aAAa,wCAA0C,SAChJI,EAAgBN,EAASE,aAAa,mCACtCK,EAAqBP,EAASE,aAAa,wCAC3CM,EAAQC,SAAST,EAASE,aAAa,cAAe,IACtDQ,EAAe,IAAIC,OAAO,UAAYV,EAAQ,cAAe,KAC7DW,EAAoB,IAAID,OAAO,QAAUV,EAAQ,UAAW,KAC5DY,EAAQxB,IACRyB,EAAaV,EAAQW,QAAQL,EAAclB,EAAiBqB,IAC5DG,EAAc,GACdC,EAAgBrB,EAUpB,IATIkB,IAAeV,IACjBM,EAAe,IAAIC,OAAO,UAAYR,EAAS,cAAe,KAC9DS,EAAoB,IAAID,OAAO,QAAUR,EAAS,UAAW,KAC7DW,EAAaV,EAAQW,QAAQL,EAAclB,EAAiBqB,KAG9DG,EAAc,CADdF,EAAaA,EAA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,UAAUkK,OAAO,UAAU,EAGrChE,mBAAS7K,SAAU,yBAA0B,SAAS,KACpDwO,GAAe,IAGjB3D,mBAAS7K,SAAU,yBAA0B,WAAWU,IACxC,MAAVA,EAAEoO,KAAyB,UAAVpO,EAAEoO,MACrBpO,EAAEE,iBACF4N,IACF,IAKF3D,mBAAS7K,SAAU,mCAAoC,UAAU,KAC/D,CAAC,eAAgB,wBAAyB,4BAA6B,sCAAsC2C,SAAQpC,IACnH,MAAMwO,EAAQ/O,SAASgL,eAAezK,GAClCwO,IACFA,EAAM3J,MAAQ,GAChB,GACA,IAOJ4J,cACGnF,KAAKoF,KACLpF,MANH,WACEuC,YAAMpG,EACR,IAKG6D,MCjVY,WACb,MAAI,QAAQqF,KAAKC,UAAUC,WAJpB,iCAK6BvF,MAAKwF,IACrCA,EAAYC,UAAU,IAGnBC,QAAQC,SACjB,ID2UG7E,OAAMC,IACLvI,QAAQuI,MAAMA,EAAM,G","file":"js/public-c70580632c7a542f3fc1.chunk.js","sourcesContent":["document.addEventListener('DOMContentLoaded', function () {\n var cocoonElementCounter = 0;\n var createNewID = function () {\n return new Date().getTime() + cocoonElementCounter++;\n };\n var newcontentBraced = function (id) {\n return '[' + id + ']$1';\n };\n var newcontentUnderscored = function (id) {\n return '_' + id + '_$1';\n };\n var getInsertionNodeElem = function (insertionNode, insertionTraversal, thisNode) {\n if (!insertionNode) {\n return thisNode.parentNode;\n }\n if (typeof insertionNode === 'function') {\n if (insertionTraversal) {\n console.warn('association-insertion-traversal is ignored, because association-insertion-node is given as a function.');\n }\n return insertionNode(thisNode);\n }\n if (typeof insertionNode === 'string') {\n if (insertionTraversal) {\n return thisNode[insertionTraversal](insertionNode);\n } else {\n return insertionNode === 'this' ? thisNode : document.querySelector(insertionNode);\n }\n }\n };\n var cocoonDetach = function (node) {\n return node.parentElement.removeChild(node);\n };\n var cocoonGetPreviousSibling = function (elem, selector) {\n var sibling = elem.previousElementSibling;\n if (!selector) return sibling;\n while (sibling) {\n var match = sibling.matches(selector);\n if (match) return sibling;\n sibling = sibling.previousElementSibling;\n }\n };\n var cocoonAddFields = function (e, target) {\n e.preventDefault();\n e.stopPropagation();\n var thisNode = target;\n var assoc = thisNode.getAttribute('data-association');\n var assocs = thisNode.getAttribute('data-associations');\n var content = thisNode.getAttribute('data-association-insertion-template');\n var insertionMethod = thisNode.getAttribute('data-association-insertion-method') || thisNode.getAttribute('data-association-insertion-position') || 'before';\n var insertionNode = thisNode.getAttribute('data-association-insertion-node');\n var insertionTraversal = thisNode.getAttribute('data-association-insertion-traversal');\n var count = parseInt(thisNode.getAttribute('data-count'), 10);\n var regexpBraced = new RegExp('\\\\[new_' + assoc + '\\\\](.*?\\\\s)', 'g');\n var regexpUnderscored = new RegExp('_new_' + assoc + '_(\\\\w*)', 'g');\n var newId = createNewID();\n var newContent = content.replace(regexpBraced, newcontentBraced(newId));\n var newContents = [];\n var originalEvent = e;\n if (newContent === content) {\n regexpBraced = new RegExp('\\\\[new_' + assocs + '\\\\](.*?\\\\s)', 'g');\n regexpUnderscored = new RegExp('_new_' + assocs + '_(\\\\w*)', 'g');\n newContent = content.replace(regexpBraced, newcontentBraced(newId));\n }\n newContent = newContent.replace(regexpUnderscored, newcontentUnderscored(newId));\n newContents = [newContent];\n count = isNaN(count) ? 1 : Math.max(count, 1);\n count -= 1;\n while (count) {\n newId = createNewID();\n newContent = content.replace(regexpBraced, newcontentBraced(newId));\n newContent = newContent.replace(regexpUnderscored, newcontentUnderscored(newId));\n newContents.push(newContent);\n count -= 1;\n }\n var insertionNodeElem = getInsertionNodeElem(insertionNode, insertionTraversal, thisNode);\n if (!insertionNodeElem || insertionNodeElem.length === 0) {\n console.warn(\"Couldn't find the element to insert the template. Make sure your `data-association-insertion-*` on `link_to_add_association` is correct.\");\n }\n newContents.forEach(function (node, i) {\n var contentNode = node;\n var beforeInsert = new CustomEvent('cocoon:before-insert', {\n bubbles: true,\n cancelable: true,\n detail: [contentNode, originalEvent]\n });\n insertionNodeElem.dispatchEvent(beforeInsert);\n if (!beforeInsert.defaultPrevented) {\n // allow any of the jquery dom manipulation methods (after, before, append, prepend, etc)\n // to be called on the node. allows the insertion node to be the parent of the inserted\n // code and doesn't force it to be a sibling like after/before does. default: 'before'\n var htmlMapping = {\n before: 'beforebegin',\n prepend: 'afterbegin',\n append: 'beforeend',\n after: 'afterend'\n };\n var htmlMethod = htmlMapping[insertionMethod];\n var addedContent = insertionNodeElem.insertAdjacentHTML(htmlMethod, contentNode);\n if (htmlMethod === htmlMapping.before) {\n addedContent = insertionNodeElem.previousElementSibling;\n } else if (htmlMethod === htmlMapping.prepend) {\n addedContent = insertionNodeElem.firstElementChild;\n } else if (htmlMethod === htmlMapping.append) {\n addedContent = insertionNodeElem.lastElementChild;\n } else if (htmlMethod === htmlMapping.after) {\n addedContent = insertionNodeElem.nextElementSibling;\n }\n var afterInsert = new CustomEvent('cocoon:after-insert', {\n bubbles: true,\n detail: [contentNode, originalEvent, addedContent]\n });\n insertionNodeElem.dispatchEvent(afterInsert);\n }\n });\n };\n var cocoonRemoveFields = function (e, target) {\n var thisNode = target;\n var wrapperClass = thisNode.getAttribute('data-wrapper-class') || 'nested-fields';\n var nodeToDelete = thisNode.closest('.' + wrapperClass);\n var triggerNode = nodeToDelete.parentNode;\n var originalEvent = e;\n e.preventDefault();\n e.stopPropagation();\n var beforeRemove = new CustomEvent('cocoon:before-remove', {\n bubbles: true,\n cancelable: true,\n detail: [nodeToDelete, originalEvent]\n });\n triggerNode.dispatchEvent(beforeRemove);\n if (!beforeRemove.defaultPrevented) {\n var timeout = triggerNode.getAttribute('data-remove-timeout') || 0;\n setTimeout(function () {\n if (thisNode.classList.contains('dynamic')) {\n cocoonDetach(nodeToDelete);\n } else {\n var hiddenInput = cocoonGetPreviousSibling(thisNode, 'input[type=hidden]');\n hiddenInput.value = '1';\n nodeToDelete.style.display = 'none';\n }\n var afterRemove = new CustomEvent('cocoon:after-remove', {\n bubbles: true,\n detail: [nodeToDelete, originalEvent]\n });\n triggerNode.dispatchEvent(afterRemove);\n }, timeout);\n }\n };\n document.addEventListener('click', function (e) {\n for (var target = e.target; target && target !== this; target = target.parentNode) {\n if (target.matches('.add_fields')) {\n cocoonAddFields(e, target);\n return;\n }\n if (target.matches('.remove_fields')) {\n cocoonRemoveFields(e, target);\n return;\n }\n }\n }, false);\n});\n\n// TODO - Test this\n// document.addEventListener(\"DOMContentLoaded page:load turbolinks:load\", function () {\n// var destroyedFields = document.querySelectorAll(\".remove_fields.existing.destroyed\");\n// Array.prototype.forEach.call(destroyedFields, function (el) {\n// var wrapperClass = el.getAttribute(\"data-wrapper-class\") || \"nested-fields\";\n// el.closest(\".\" + wrapperClass).style.display = \"none\";\n// });\n// });","import { createRoot } from 'react-dom/client';\n\nimport './public-path';\n\nimport { IntlMessageFormat } from 'intl-messageformat';\nimport { defineMessages } from 'react-intl';\n\nimport { delegate } from '@rails/ujs';\nimport axios from 'axios';\nimport escapeTextContentForBrowser from 'escape-html';\nimport { createBrowserHistory } from 'history';\nimport { throttle } from 'lodash';\n\nimport { start } from '../mastodon/common';\nimport { timeAgoString } from '../mastodon/components/relative_timestamp';\nimport emojify from '../mastodon/features/emoji/emoji';\nimport loadKeyboardExtensions from '../mastodon/load_keyboard_extensions';\nimport { loadLocale, getLocale } from '../mastodon/locales';\nimport { loadPolyfills } from '../mastodon/polyfills';\nimport ready from '../mastodon/ready';\n\nimport 'cocoon-js-vanilla';\n\nstart();\n\nconst messages = defineMessages({\n usernameTaken: { id: 'username.taken', defaultMessage: 'That username is taken. Try another' },\n passwordExceedsLength: { id: 'password_confirmation.exceeds_maxlength', defaultMessage: 'Password confirmation exceeds the maximum password length' },\n passwordDoesNotMatch: { id: 'password_confirmation.mismatching', defaultMessage: 'Password confirmation does not match' },\n});\n\nwindow.addEventListener('message', e => {\n const data = e.data || {};\n\n if (!window.parent || data.type !== 'setHeight') {\n return;\n }\n\n ready(() => {\n window.parent.postMessage({\n type: 'setHeight',\n id: data.id,\n height: document.getElementsByTagName('html')[0].scrollHeight,\n }, '*');\n });\n});\n\nfunction loaded() {\n const { messages: localeData } = getLocale();\n\n const scrollToDetailedStatus = () => {\n const history = createBrowserHistory();\n const detailedStatuses = document.querySelectorAll('.public-layout .detailed-status');\n const location = history.location;\n\n if (detailedStatuses.length === 1 && (!location.state || !location.state.scrolledToDetailedStatus)) {\n detailedStatuses[0].scrollIntoView();\n history.replace(location.pathname, { ...location.state, scrolledToDetailedStatus: true });\n }\n };\n\n const getEmojiAnimationHandler = (swapTo) => {\n return ({ target }) => {\n target.src = target.getAttribute(swapTo);\n };\n };\n\n const locale = document.documentElement.lang;\n\n const dateTimeFormat = new Intl.DateTimeFormat(locale, {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n });\n\n const dateFormat = new Intl.DateTimeFormat(locale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n timeFormat: false,\n });\n\n const timeFormat = new Intl.DateTimeFormat(locale, {\n timeStyle: 'short',\n hour12: false,\n });\n\n const formatMessage = ({ id, defaultMessage }, values) => {\n const messageFormat = new IntlMessageFormat(localeData[id] || defaultMessage, locale);\n return messageFormat.format(values);\n };\n\n [].forEach.call(document.querySelectorAll('.emojify'), (content) => {\n content.innerHTML = emojify(content.innerHTML);\n });\n\n [].forEach.call(document.querySelectorAll('time.formatted'), (content) => {\n const datetime = new Date(content.getAttribute('datetime'));\n const formattedDate = dateTimeFormat.format(datetime);\n\n content.title = formattedDate;\n content.textContent = formattedDate;\n });\n\n const isToday = date => {\n const today = new Date();\n\n return date.getDate() === today.getDate() &&\n date.getMonth() === today.getMonth() &&\n date.getFullYear() === today.getFullYear();\n };\n const todayFormat = new IntlMessageFormat(localeData['relative_format.today'] || 'Today at {time}', locale);\n\n [].forEach.call(document.querySelectorAll('time.relative-formatted'), (content) => {\n const datetime = new Date(content.getAttribute('datetime'));\n\n let formattedContent;\n\n if (isToday(datetime)) {\n const formattedTime = timeFormat.format(datetime);\n\n formattedContent = todayFormat.format({ time: formattedTime });\n } else {\n formattedContent = dateFormat.format(datetime);\n }\n\n content.title = formattedContent;\n content.textContent = formattedContent;\n });\n\n [].forEach.call(document.querySelectorAll('time.time-ago'), (content) => {\n const datetime = new Date(content.getAttribute('datetime'));\n const now = new Date();\n\n const timeGiven = content.getAttribute('datetime').includes('T');\n content.title = timeGiven ? dateTimeFormat.format(datetime) : dateFormat.format(datetime);\n content.textContent = timeAgoString({\n formatMessage,\n formatDate: (date, options) => (new Intl.DateTimeFormat(locale, options)).format(date),\n }, datetime, now, now.getFullYear(), timeGiven);\n });\n\n const reactComponents = document.querySelectorAll('[data-component]');\n\n if (reactComponents.length > 0) {\n import(/* webpackChunkName: \"containers/media_container\" */ '../mastodon/containers/media_container')\n .then(({ default: MediaContainer }) => {\n [].forEach.call(reactComponents, (component) => {\n [].forEach.call(component.children, (child) => {\n component.removeChild(child);\n });\n });\n\n const content = document.createElement('div');\n\n const root = createRoot(content);\n root.render();\n document.body.appendChild(content);\n scrollToDetailedStatus();\n })\n .catch(error => {\n console.error(error);\n scrollToDetailedStatus();\n });\n } else {\n scrollToDetailedStatus();\n }\n\n delegate(document, '#user_account_attributes_username', 'input', throttle(() => {\n const username = document.getElementById('user_account_attributes_username');\n\n if (username.value && username.value.length > 0) {\n axios.get('/api/v1/accounts/lookup', { params: { acct: username.value } }).then(() => {\n username.setCustomValidity(formatMessage(messages.usernameTaken));\n }).catch(() => {\n username.setCustomValidity('');\n });\n } else {\n username.setCustomValidity('');\n }\n }, 500, { leading: false, trailing: true }));\n\n delegate(document, '#user_password,#user_password_confirmation', 'input', () => {\n const password = document.getElementById('user_password');\n const confirmation = document.getElementById('user_password_confirmation');\n if (!confirmation) return;\n\n if (confirmation.value && confirmation.value.length > password.maxLength) {\n confirmation.setCustomValidity(formatMessage(messages.passwordExceedsLength));\n } else if (password.value && password.value !== confirmation.value) {\n confirmation.setCustomValidity(formatMessage(messages.passwordDoesNotMatch));\n } else {\n confirmation.setCustomValidity('');\n }\n });\n\n delegate(document, '.custom-emoji', 'mouseover', getEmojiAnimationHandler('data-original'));\n delegate(document, '.custom-emoji', 'mouseout', getEmojiAnimationHandler('data-static'));\n\n delegate(document, '.status__content__spoiler-link', 'click', function() {\n const statusEl = this.parentNode.parentNode;\n\n if (statusEl.dataset.spoiler === 'expanded') {\n statusEl.dataset.spoiler = 'folded';\n this.textContent = (new IntlMessageFormat(localeData['status.show_more'] || 'Show more', locale)).format();\n } else {\n statusEl.dataset.spoiler = 'expanded';\n this.textContent = (new IntlMessageFormat(localeData['status.show_less'] || 'Show less', locale)).format();\n }\n\n return false;\n });\n\n [].forEach.call(document.querySelectorAll('.status__content__spoiler-link'), (spoilerLink) => {\n const statusEl = spoilerLink.parentNode.parentNode;\n const message = (statusEl.dataset.spoiler === 'expanded') ? (localeData['status.show_less'] || 'Show less') : (localeData['status.show_more'] || 'Show more');\n spoilerLink.textContent = (new IntlMessageFormat(message, locale)).format();\n });\n}\n\ndelegate(document, '#account_display_name', 'input', ({ target }) => {\n const name = document.querySelector('.card .display-name strong');\n if (name) {\n if (target.value) {\n name.innerHTML = emojify(escapeTextContentForBrowser(target.value));\n } else {\n name.textContent = target.dataset.default;\n }\n }\n});\n\ndelegate(document, '#edit_profile input[type=file]', 'change', ({ target }) => {\n const avatar = document.getElementById(target.id + '-preview');\n const [file] = target.files || [];\n const url = file ? URL.createObjectURL(file) : avatar.dataset.originalSrc;\n\n avatar.src = url;\n});\n\nconst getProfileAvatarAnimationHandler = (swapTo) => {\n //animate avatar gifs on the profile page when moused over\n return ({ target }) => {\n const swapSrc = target.getAttribute(swapTo);\n //only change the img source if autoplay is off and the image src is actually different\n if(target.getAttribute('data-autoplay') !== 'true' && target.src !== swapSrc) {\n target.src = swapSrc;\n }\n };\n};\n\ndelegate(document, 'img#profile_page_avatar', 'mouseover', getProfileAvatarAnimationHandler('data-original'));\n\ndelegate(document, 'img#profile_page_avatar', 'mouseout', getProfileAvatarAnimationHandler('data-static'));\n\ndelegate(document, '#account_locked', 'change', ({ target }) => {\n const lock = document.querySelector('.card .display-name i');\n\n if (lock) {\n if (target.checked) {\n delete lock.dataset.hidden;\n } else {\n lock.dataset.hidden = 'true';\n }\n }\n});\n\ndelegate(document, '.input-copy input', 'click', ({ target }) => {\n target.focus();\n target.select();\n target.setSelectionRange(0, target.value.length);\n});\n\ndelegate(document, '.input-copy button', 'click', ({ target }) => {\n const input = target.parentNode.querySelector('.input-copy__wrapper input');\n\n const oldReadOnly = input.readonly;\n\n input.readonly = false;\n input.focus();\n input.select();\n input.setSelectionRange(0, input.value.length);\n\n try {\n if (document.execCommand('copy')) {\n input.blur();\n target.parentNode.classList.add('copied');\n\n setTimeout(() => {\n target.parentNode.classList.remove('copied');\n }, 700);\n }\n } catch (err) {\n console.error(err);\n }\n\n input.readonly = oldReadOnly;\n});\n\nconst toggleSidebar = () => {\n const sidebar = document.querySelector('.sidebar ul');\n const toggleButton = document.querySelector('.sidebar__toggle__icon');\n\n if (sidebar.classList.contains('visible')) {\n document.body.style.overflow = null;\n toggleButton.setAttribute('aria-expanded', 'false');\n } else {\n document.body.style.overflow = 'hidden';\n toggleButton.setAttribute('aria-expanded', 'true');\n }\n\n toggleButton.classList.toggle('active');\n sidebar.classList.toggle('visible');\n};\n\ndelegate(document, '.sidebar__toggle__icon', 'click', () => {\n toggleSidebar();\n});\n\ndelegate(document, '.sidebar__toggle__icon', 'keydown', e => {\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault();\n toggleSidebar();\n }\n});\n\n// Empty the honeypot fields in JS in case something like an extension\n// automatically filled them.\ndelegate(document, '#registration_new_user,#new_user', 'submit', () => {\n ['user_website', 'user_confirm_password', 'registration_user_website', 'registration_user_confirm_password'].forEach(id => {\n const field = document.getElementById(id);\n if (field) {\n field.value = '';\n }\n });\n});\n\nfunction main() {\n ready(loaded);\n}\n\nloadPolyfills()\n .then(loadLocale)\n .then(main)\n .then(loadKeyboardExtensions)\n .catch(error => {\n console.error(error);\n });\n","// On KaiOS, we may not be able to use a mouse cursor or navigate using Tab-based focus, so we install\n// special left/right focus navigation keyboard listeners, at least on public pages (i.e. so folks\n// can at least log in using KaiOS devices).\n\nfunction importArrowKeyNavigation() {\n return import(/* webpackChunkName: \"arrow-key-navigation\" */ 'arrow-key-navigation');\n}\n\nexport default function loadKeyboardExtensions() {\n if (/KAIOS/.test(navigator.userAgent)) {\n return importArrowKeyNavigation().then(arrowKeyNav => {\n arrowKeyNav.register();\n });\n }\n return Promise.resolve();\n}\n"],"sourceRoot":""}