{"version":3,"sources":["webpack:///./node_modules/cocoon-js-vanilla/index.js","webpack:///./app/javascript/entrypoints/public.tsx","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","inputs","querySelectorAll","removeAttribute","afterRemove","this","hideRemovedFields","targets","start","messages","defineMessages","usernameTaken","defaultMessage","passwordExceedsLength","passwordDoesNotMatch","loaded","localeData","getLocale","locale","documentElement","lang","dateTimeFormat","Intl","DateTimeFormat","year","month","day","hour","minute","dateFormat","timeFormat","timeStyle","formatMessage","_ref","values","message","IntlMessageFormat","format","innerHTML","emojify","datetime","dateTime","formattedDate","title","textContent","todayFormat","formattedContent","date","today","getDate","getMonth","getFullYear","isToday","formattedTime","time","now","timeGiven","includes","timeAgoString","formatDate","options","reactComponents","then","_ref2","default","MediaContainer","component","Array","from","children","child","createElement","createRoot","render","_jsx","components","body","appendChild","catch","error","Rails","delegate","_throttle","_ref3","HTMLInputElement","axios","get","params","acct","setCustomValidity","leading","trailing","password","confirmation","maxLength","_this$parentNode","HTMLButtonElement","statusEl","HTMLDivElement","dataset","spoiler","spoilerLink","_spoilerLink$parentNo","window","data","type","isSetHeightMessage","parent","ready","postMessage","height","getElementsByTagName","scrollHeight","_ref4","avatar","concat","file","files","url","URL","createObjectURL","originalSrc","src","_ref5","focus","select","setSelectionRange","_ref6","_target$parentNode","input","oldReadOnly","readOnly","execCommand","blur","add","remove","err","toggleSidebar","sidebar","toggleButton","overflow","setAttribute","toggle","key","_ref7","HTMLImageElement","original","_ref8","static","field","loadPolyfills","loadLocale","test","navigator","userAgent","arrowKeyNav","register","Promise","resolve"],"mappings":"8EAAAA,SAASC,iBAAiB,oBAAoB,WAC5C,IAAIC,EAAuB,EAEvBC,EAAc,WAChB,OAAQ,IAAIC,MAAOC,UAAYH,GACjC,EAEII,EAAmB,SAAUC,GAC/B,MAAO,IAAMA,EAAK,KACpB,EAEIC,EAAwB,SAAUD,GACpC,MAAO,IAAMA,EAAK,KACpB,EAuCIE,EAAkB,SAAUC,EAAGC,GACjCD,EAAEE,iBACFF,EAAEG,kBAEF,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,EAcpB,IAZIkB,IAAeV,IACjBM,EAAe,IAAIC,OAAO,UAAYR,EAAS,cAAe,KAC9DS,EAAoB,IAAID,OAAO,QAAUR,EAAS,UAAW,KAC7DW,EAAaV,EAAQW,QAAQL,EAAclB,EAAiBqB,KAI9DG,EAAc,CADdF,EAAaA,EAAWC,QAAQH,EAAm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,EAGrC9D,IAAMC,SAASvK,SAAU,yBAA0B,SAAS,KAC1D+N,GAAe,IAGjBzD,IAAMC,SAASvK,SAAU,yBAA0B,WAAYU,IAC/C,MAAVA,EAAE2N,KAAyB,UAAV3N,EAAE2N,MACrB3N,EAAEE,iBACFmN,IACF,IAGFzD,IAAMC,SAASvK,SAAU,mBAAoB,aAAasO,IAAiB,IAAhB,OAAE3N,GAAQ2N,EAC/D3N,aAAkB4N,kBAAoB5N,EAAO8K,QAAQ+C,WACvD7N,EAAOqM,IAAMrM,EAAO8K,QAAQ+C,SAAQ,IAExClE,IAAMC,SAASvK,SAAU,mBAAoB,YAAYyO,IAAiB,IAAhB,OAAE9N,GAAQ8N,EAC9D9N,aAAkB4N,kBAAoB5N,EAAO8K,QAAQiD,SACvD/N,EAAOqM,IAAMrM,EAAO8K,QAAQiD,OAAM,IAKtCpE,IAAMC,SAASvK,SAAU,mCAAoC,UAAU,KACrE,CACE,eACA,wBACA,4BACA,sCACA2C,SAASpC,IACT,MAAMoO,EAAQ3O,SAASuC,cAAa,SAAAkK,OAA4BlM,IAC5DoO,IACFA,EAAMvJ,MAAQ,GAChB,GACA,IASJwJ,cACGxF,KAAKyF,KACLzF,MARH,WACE8C,YAAM7F,GAAQ+D,OAAOC,IACnBhI,QAAQgI,MAAMA,EAAM,GAExB,IAKGjB,MClcY,WACb,MAAI,QAAQ0F,KAAKC,UAAUC,WAJpB,iCAK6B5F,MAAK6F,IACrCA,EAAYC,UAAU,IAGnBC,QAAQC,SACjB,ID4bGhF,OAAOC,IACNhI,QAAQgI,MAAMA,EAAM,G","file":"js/public-c877e0b4ce3c3320e03d.chunk.js","sourcesContent":["document.addEventListener('DOMContentLoaded', function () {\n var cocoonElementCounter = 0;\n\n var createNewID = function () {\n return (new Date().getTime() + cocoonElementCounter++);\n };\n\n var newcontentBraced = function (id) {\n return '[' + id + ']$1';\n };\n\n var newcontentUnderscored = function (id) {\n return '_' + id + '_$1';\n };\n\n var getInsertionNodeElem = function (insertionNode, insertionTraversal, thisNode) {\n if (!insertionNode) {\n return thisNode.parentNode;\n }\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\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\n var cocoonDetach = function (node) {\n return node.parentElement.removeChild(node);\n };\n\n var cocoonGetPreviousSibling = function (elem, selector) {\n var sibling = elem.previousElementSibling;\n\n if (!selector) return sibling;\n\n while (sibling) {\n var match = sibling.matches(selector);\n if (match) return sibling;\n sibling = sibling.previousElementSibling;\n }\n };\n\n var cocoonAddFields = function (e, target) {\n e.preventDefault();\n e.stopPropagation();\n\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\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\n newContent = newContent.replace(regexpUnderscored, newcontentUnderscored(newId));\n newContents = [newContent];\n\n count = (isNaN(count) ? 1 : Math.max(count, 1));\n count -= 1;\n\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\n count -= 1;\n }\n\n var insertionNodeElem = getInsertionNodeElem(insertionNode, insertionTraversal, thisNode);\n\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\n newContents.forEach(function (node, i) {\n var contentNode = node;\n\n var beforeInsert = new CustomEvent('cocoon:before-insert', { bubbles: true, cancelable: true, detail: [contentNode, originalEvent] });\n insertionNodeElem.dispatchEvent(beforeInsert);\n\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\n var htmlMethod = htmlMapping[insertionMethod];\n var addedContent = insertionNodeElem.insertAdjacentHTML(htmlMethod, contentNode);\n\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\n var afterInsert = new CustomEvent('cocoon:after-insert', { bubbles: true, detail: [contentNode, originalEvent, addedContent] });\n insertionNodeElem.dispatchEvent(afterInsert);\n }\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\n e.preventDefault();\n e.stopPropagation();\n\n var beforeRemove = new CustomEvent('cocoon:before-remove', { bubbles: true, cancelable: true, detail: [nodeToDelete, originalEvent] });\n triggerNode.dispatchEvent(beforeRemove);\n\n if (!beforeRemove.defaultPrevented) {\n var timeout = triggerNode.getAttribute('data-remove-timeout') || 0;\n\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 inputs = nodeToDelete.querySelectorAll(\"input[required]\");\n for (var i = 0; i < inputs.length; i++) {\n inputs[i].removeAttribute(\"required\");\n }\n }\n var afterRemove = new CustomEvent('cocoon:after-remove', { bubbles: true, detail: [nodeToDelete, originalEvent] });\n triggerNode.dispatchEvent(afterRemove);\n }, timeout);\n }\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 var hideRemovedFields = function () { \n var targets = document.querySelectorAll('.remove_fields.existing.destroyed');\n for (var i = 0; i < targets.length; i++) {\n var thisNode = targets[i];\n var wrapperClass = thisNode.getAttribute('data-wrapper-class') || 'nested-fields';\n var nodeToHide = thisNode.closest('.' + wrapperClass);\n \n nodeToHide.style.display = 'none';\n }\n }\n\n document.addEventListener('page:load', hideRemovedFields);\n document.addEventListener('turbolinks:load', hideRemovedFields); // Has been replaced by Turbo\n document.addEventListener('turbo:load', hideRemovedFields);\n\n hideRemovedFields();\n});\n","import { createRoot } from 'react-dom/client';\n\nimport './public-path';\n\nimport { IntlMessageFormat } from 'intl-messageformat';\nimport type { MessageDescriptor, PrimitiveType } from 'react-intl';\nimport { defineMessages } from 'react-intl';\n\nimport Rails from '@rails/ujs';\nimport axios from 'axios';\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: {\n id: 'username.taken',\n defaultMessage: 'That username is taken. Try another',\n },\n passwordExceedsLength: {\n id: 'password_confirmation.exceeds_maxlength',\n defaultMessage: 'Password confirmation exceeds the maximum password length',\n },\n passwordDoesNotMatch: {\n id: 'password_confirmation.mismatching',\n defaultMessage: 'Password confirmation does not match',\n },\n});\n\ninterface SetHeightMessage {\n type: 'setHeight';\n id: string;\n height: number;\n}\n\nfunction isSetHeightMessage(data: unknown): data is SetHeightMessage {\n if (\n data &&\n typeof data === 'object' &&\n 'type' in data &&\n data.type === 'setHeight'\n )\n return true;\n else return false;\n}\n\nwindow.addEventListener('message', (e) => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- typings are not correct, it can be null in very rare cases\n if (!e.data || !isSetHeightMessage(e.data) || !window.parent) return;\n\n const data = e.data;\n\n ready(() => {\n window.parent.postMessage(\n {\n type: 'setHeight',\n id: data.id,\n height: document.getElementsByTagName('html')[0].scrollHeight,\n },\n '*',\n );\n }).catch((e: unknown) => {\n console.error('Error in setHeightMessage postMessage', e);\n });\n});\n\nfunction loaded() {\n const { messages: localeData } = getLocale();\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 });\n\n const timeFormat = new Intl.DateTimeFormat(locale, {\n timeStyle: 'short',\n });\n\n const formatMessage = (\n { id, defaultMessage }: MessageDescriptor,\n values?: Record,\n ) => {\n let message: string | undefined = undefined;\n\n if (id) message = localeData[id];\n\n if (!message) message = defaultMessage as string;\n\n const messageFormat = new IntlMessageFormat(message, locale);\n return messageFormat.format(values) as string;\n };\n\n document.querySelectorAll('.emojify').forEach((content) => {\n content.innerHTML = emojify(content.innerHTML);\n });\n\n document\n .querySelectorAll('time.formatted')\n .forEach((content) => {\n const datetime = new Date(content.dateTime);\n const formattedDate = dateTimeFormat.format(datetime);\n\n content.title = formattedDate;\n content.textContent = formattedDate;\n });\n\n const isToday = (date: Date) => {\n const today = new Date();\n\n return (\n date.getDate() === today.getDate() &&\n date.getMonth() === today.getMonth() &&\n date.getFullYear() === today.getFullYear()\n );\n };\n const todayFormat = new IntlMessageFormat(\n localeData['relative_format.today'] || 'Today at {time}',\n locale,\n );\n\n document\n .querySelectorAll('time.relative-formatted')\n .forEach((content) => {\n const datetime = new Date(content.dateTime);\n\n let formattedContent: string;\n\n if (isToday(datetime)) {\n const formattedTime = timeFormat.format(datetime);\n\n formattedContent = todayFormat.format({\n time: formattedTime,\n }) as string;\n } else {\n formattedContent = dateFormat.format(datetime);\n }\n\n content.title = formattedContent;\n content.textContent = formattedContent;\n });\n\n document\n .querySelectorAll('time.time-ago')\n .forEach((content) => {\n const datetime = new Date(content.dateTime);\n const now = new Date();\n\n const timeGiven = content.dateTime.includes('T');\n content.title = timeGiven\n ? dateTimeFormat.format(datetime)\n : dateFormat.format(datetime);\n content.textContent = timeAgoString(\n {\n formatMessage,\n formatDate: (date: Date, options) =>\n new Intl.DateTimeFormat(locale, options).format(date),\n },\n datetime,\n now.getTime(),\n now.getFullYear(),\n timeGiven,\n );\n });\n\n const reactComponents = document.querySelectorAll('[data-component]');\n\n if (reactComponents.length > 0) {\n import(\n /* webpackChunkName: \"containers/media_container\" */ '../mastodon/containers/media_container'\n )\n .then(({ default: MediaContainer }) => {\n reactComponents.forEach((component) => {\n Array.from(component.children).forEach((child) => {\n component.removeChild(child);\n });\n });\n\n const content = document.createElement('div');\n\n const root = createRoot(content);\n root.render(\n ,\n );\n document.body.appendChild(content);\n\n return true;\n })\n .catch((error: unknown) => {\n console.error(error);\n });\n }\n\n Rails.delegate(\n document,\n 'input#user_account_attributes_username',\n 'input',\n throttle(\n ({ target }) => {\n if (!(target instanceof HTMLInputElement)) return;\n\n if (target.value && target.value.length > 0) {\n axios\n .get('/api/v1/accounts/lookup', { params: { acct: target.value } })\n .then(() => {\n target.setCustomValidity(formatMessage(messages.usernameTaken));\n return true;\n })\n .catch(() => {\n target.setCustomValidity('');\n });\n } else {\n target.setCustomValidity('');\n }\n },\n 500,\n { leading: false, trailing: true },\n ),\n );\n\n Rails.delegate(\n document,\n '#user_password,#user_password_confirmation',\n 'input',\n () => {\n const password = document.querySelector(\n 'input#user_password',\n );\n const confirmation = document.querySelector(\n 'input#user_password_confirmation',\n );\n if (!confirmation || !password) return;\n\n if (\n confirmation.value &&\n confirmation.value.length > password.maxLength\n ) {\n confirmation.setCustomValidity(\n formatMessage(messages.passwordExceedsLength),\n );\n } else if (password.value && password.value !== confirmation.value) {\n confirmation.setCustomValidity(\n formatMessage(messages.passwordDoesNotMatch),\n );\n } else {\n confirmation.setCustomValidity('');\n }\n },\n );\n\n Rails.delegate(\n document,\n 'button.status__content__spoiler-link',\n 'click',\n function () {\n if (!(this instanceof HTMLButtonElement)) return;\n\n const statusEl = this.parentNode?.parentNode;\n\n if (\n !(\n statusEl instanceof HTMLDivElement &&\n statusEl.classList.contains('.status__content')\n )\n )\n return;\n\n if (statusEl.dataset.spoiler === 'expanded') {\n statusEl.dataset.spoiler = 'folded';\n this.textContent = new IntlMessageFormat(\n localeData['status.show_more'] || 'Show more',\n locale,\n ).format() as string;\n } else {\n statusEl.dataset.spoiler = 'expanded';\n this.textContent = new IntlMessageFormat(\n localeData['status.show_less'] || 'Show less',\n locale,\n ).format() as string;\n }\n },\n );\n\n document\n .querySelectorAll('button.status__content__spoiler-link')\n .forEach((spoilerLink) => {\n const statusEl = spoilerLink.parentNode?.parentNode;\n\n if (\n !(\n statusEl instanceof HTMLDivElement &&\n statusEl.classList.contains('.status__content')\n )\n )\n return;\n\n const message =\n statusEl.dataset.spoiler === 'expanded'\n ? localeData['status.show_less'] || 'Show less'\n : localeData['status.show_more'] || 'Show more';\n spoilerLink.textContent = new IntlMessageFormat(\n message,\n locale,\n ).format() as string;\n });\n}\n\nRails.delegate(\n document,\n '#edit_profile input[type=file]',\n 'change',\n ({ target }) => {\n if (!(target instanceof HTMLInputElement)) return;\n\n const avatar = document.querySelector(\n `img#${target.id}-preview`,\n );\n\n if (!avatar) return;\n\n let file: File | undefined;\n if (target.files) file = target.files[0];\n\n const url = file ? URL.createObjectURL(file) : avatar.dataset.originalSrc;\n\n if (url) avatar.src = url;\n },\n);\n\nRails.delegate(document, '.input-copy input', 'click', ({ target }) => {\n if (!(target instanceof HTMLInputElement)) return;\n\n target.focus();\n target.select();\n target.setSelectionRange(0, target.value.length);\n});\n\nRails.delegate(document, '.input-copy button', 'click', ({ target }) => {\n if (!(target instanceof HTMLButtonElement)) return;\n\n const input = target.parentNode?.querySelector(\n '.input-copy__wrapper input',\n );\n\n if (!input) return;\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\n const parent = target.parentElement;\n\n if (!parent) return;\n parent.classList.add('copied');\n\n setTimeout(() => {\n parent.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(\n 'a.sidebar__toggle__icon',\n );\n\n if (!sidebar || !toggleButton) return;\n\n if (sidebar.classList.contains('visible')) {\n document.body.style.overflow = '';\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\nRails.delegate(document, '.sidebar__toggle__icon', 'click', () => {\n toggleSidebar();\n});\n\nRails.delegate(document, '.sidebar__toggle__icon', 'keydown', (e) => {\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault();\n toggleSidebar();\n }\n});\n\nRails.delegate(document, 'img.custom-emoji', 'mouseover', ({ target }) => {\n if (target instanceof HTMLImageElement && target.dataset.original)\n target.src = target.dataset.original;\n});\nRails.delegate(document, 'img.custom-emoji', 'mouseout', ({ target }) => {\n if (target instanceof HTMLImageElement && target.dataset.static)\n target.src = target.dataset.static;\n});\n\n// Empty the honeypot fields in JS in case something like an extension\n// automatically filled them.\nRails.delegate(document, '#registration_new_user,#new_user', 'submit', () => {\n [\n 'user_website',\n 'user_confirm_password',\n 'registration_user_website',\n 'registration_user_confirm_password',\n ].forEach((id) => {\n const field = document.querySelector(`input#${id}`);\n if (field) {\n field.value = '';\n }\n });\n});\n\nfunction main() {\n ready(loaded).catch((error: unknown) => {\n console.error(error);\n });\n}\n\nloadPolyfills()\n .then(loadLocale)\n .then(main)\n .then(loadKeyboardExtensions)\n .catch((error: unknown) => {\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":""}