{"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$relative_","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","_localeData$statusSh","_localeData$statusSh2","HTMLDivElement","dataset","spoiler","spoilerLink","_spoilerLink$parentNo","_localeData$statusSh3","_localeData$statusSh4","_ref4","avatar","file","files","url","URL","createObjectURL","originalSrc","src","_ref5","focus","select","setSelectionRange","_ref6","_target$parentNode","input","oldReadOnly","readOnly","execCommand","blur","parent","add","remove","err","toggleSidebar","sidebar","toggleButton","overflow","setAttribute","toggle","key","_ref7","HTMLImageElement","original","_ref8","static","_ref9","form","setInputDisabled","disabled","wrapper","hidden","type","checked","field","loadPolyfills","loadLocale","ready","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,EAAi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,G","file":"js/public-4cb6f24bd097e33a6291.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\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<string, PrimitiveType>,\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<HTMLTimeElement>('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<HTMLTimeElement>('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<HTMLTimeElement>('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          <MediaContainer locale={locale} components={reactComponents} />,\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<HTMLInputElement>(\n        'input#user_password',\n      );\n      const confirmation = document.querySelector<HTMLInputElement>(\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<HTMLButtonElement>('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<HTMLImageElement>(\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<HTMLInputElement>(\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<HTMLUListElement>('.sidebar ul');\n  const toggleButton = document.querySelector<HTMLAnchorElement>(\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\nconst setInputDisabled = (\n  input: HTMLInputElement | HTMLSelectElement,\n  disabled: boolean,\n) => {\n  input.disabled = disabled;\n\n  const wrapper = input.closest('.with_label');\n  if (wrapper) {\n    wrapper.classList.toggle('disabled', input.disabled);\n\n    const hidden =\n      input.type === 'checkbox' &&\n      wrapper.querySelector<HTMLInputElement>('input[type=hidden][value=\"0\"]');\n    if (hidden) {\n      hidden.disabled = input.disabled;\n    }\n  }\n};\n\nRails.delegate(\n  document,\n  '#account_statuses_cleanup_policy_enabled',\n  'change',\n  ({ target }) => {\n    if (!(target instanceof HTMLInputElement) || !target.form) return;\n\n    target.form\n      .querySelectorAll<\n        HTMLInputElement | HTMLSelectElement\n      >('input:not([type=hidden], #account_statuses_cleanup_policy_enabled), select')\n      .forEach((input) => {\n        setInputDisabled(input, !target.checked);\n      });\n  },\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<HTMLInputElement>(`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":""}