{ "version": 3, "sources": ["../../node_modules/mousetrap/mousetrap.js", "../../node_modules/textarea-caret/index.js", "../../node_modules/fast-myers-diff/bin/index.js", "../../node_modules/autosize/dist/autosize.esm.js", "../../static/index.mjs", "../../node_modules/compute-scroll-into-view/src/index.ts", "../../node_modules/scroll-into-view-if-needed/src/index.ts", "../../node_modules/@popperjs/core/lib/enums.js", "../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js", "../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js", "../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js", "../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js", "../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js", "../../node_modules/@popperjs/core/lib/utils/math.js", "../../node_modules/@popperjs/core/lib/utils/userAgent.js", "../../node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js", "../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js", "../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js", "../../node_modules/@popperjs/core/lib/dom-utils/contains.js", "../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js", "../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js", "../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js", "../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js", "../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js", "../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js", "../../node_modules/@popperjs/core/lib/utils/within.js", "../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js", "../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js", "../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js", "../../node_modules/@popperjs/core/lib/modifiers/arrow.js", "../../node_modules/@popperjs/core/lib/utils/getVariation.js", "../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js", "../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js", "../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js", "../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js", "../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js", "../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js", "../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js", "../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js", "../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js", "../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js", "../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js", "../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js", "../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js", "../../node_modules/@popperjs/core/lib/utils/computeOffsets.js", "../../node_modules/@popperjs/core/lib/utils/detectOverflow.js", "../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js", "../../node_modules/@popperjs/core/lib/modifiers/flip.js", "../../node_modules/@popperjs/core/lib/modifiers/hide.js", "../../node_modules/@popperjs/core/lib/modifiers/offset.js", "../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js", "../../node_modules/@popperjs/core/lib/utils/getAltAxis.js", "../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js", "../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js", "../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js", "../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js", "../../node_modules/@popperjs/core/lib/utils/orderModifiers.js", "../../node_modules/@popperjs/core/lib/utils/debounce.js", "../../node_modules/@popperjs/core/lib/utils/mergeByName.js", "../../node_modules/@popperjs/core/lib/createPopper.js", "../../node_modules/@popperjs/core/lib/popper.js", "../../node_modules/tippy.js/src/constants.ts", "../../node_modules/tippy.js/src/utils.ts", "../../node_modules/tippy.js/src/dom-utils.ts", "../../node_modules/tippy.js/src/bindGlobalEventListeners.ts", "../../node_modules/tippy.js/src/browser.ts", "../../node_modules/tippy.js/src/validation.ts", "../../node_modules/tippy.js/src/props.ts", "../../node_modules/tippy.js/src/template.ts", "../../node_modules/tippy.js/src/createTippy.ts", "../../node_modules/tippy.js/src/index.ts", "../../node_modules/tippy.js/src/addons/createSingleton.ts", "../../node_modules/tippy.js/src/addons/delegate.ts", "../../node_modules/tippy.js/src/plugins/animateFill.ts", "../../node_modules/tippy.js/src/plugins/followCursor.ts", "../../node_modules/tippy.js/src/plugins/inlinePositioning.ts", "../../node_modules/tippy.js/src/plugins/sticky.ts", "../../node_modules/tippy.js/build/base.js", "../../node_modules/text-field-edit/index.js", "../../node_modules/@ungap/structured-clone/esm/deserialize.js", "../../node_modules/@ungap/structured-clone/esm/serialize.js", "../../node_modules/@ungap/structured-clone/esm/index.js", "../../node_modules/bail/index.js", "../../node_modules/unified/node_modules/is-plain-obj/index.js", "../../node_modules/trough/index.js", "../../node_modules/unified/node_modules/unist-util-stringify-position/lib/index.js", "../../node_modules/unified/node_modules/vfile-message/lib/index.js", "../../node_modules/unified/node_modules/vfile/lib/minpath.browser.js", "../../node_modules/unified/node_modules/vfile/lib/minproc.browser.js", "../../node_modules/unified/node_modules/vfile/lib/minurl.shared.js", "../../node_modules/unified/node_modules/vfile/lib/minurl.browser.js", "../../node_modules/unified/node_modules/vfile/lib/index.js", "../../node_modules/unified/lib/callable-instance.js", "../../node_modules/unified/lib/index.js", "../../node_modules/property-information/lib/util/schema.js", "../../node_modules/property-information/lib/util/merge.js", "../../node_modules/property-information/lib/normalize.js", "../../node_modules/property-information/lib/util/info.js", "../../node_modules/property-information/lib/util/types.js", "../../node_modules/property-information/lib/util/defined-info.js", "../../node_modules/property-information/lib/util/create.js", "../../node_modules/property-information/lib/xlink.js", "../../node_modules/property-information/lib/xml.js", "../../node_modules/property-information/lib/util/case-sensitive-transform.js", "../../node_modules/property-information/lib/util/case-insensitive-transform.js", "../../node_modules/property-information/lib/xmlns.js", "../../node_modules/property-information/lib/aria.js", "../../node_modules/property-information/lib/html.js", "../../node_modules/property-information/lib/svg.js", "../../node_modules/property-information/lib/find.js", "../../node_modules/property-information/index.js", "../../node_modules/comma-separated-tokens/index.js", "../../node_modules/rehype-parse/node_modules/hast-util-parse-selector/lib/index.js", "../../node_modules/space-separated-tokens/index.js", "../../node_modules/rehype-parse/node_modules/hastscript/lib/create-h.js", "../../node_modules/rehype-parse/node_modules/hastscript/lib/svg-case-sensitive-tag-names.js", "../../node_modules/rehype-parse/node_modules/hastscript/lib/index.js", "../../node_modules/rehype-parse/node_modules/vfile-location/lib/index.js", "../../node_modules/web-namespaces/index.js", "../../node_modules/rehype-parse/node_modules/hast-util-from-parse5/lib/index.js", "../../node_modules/parse5/dist/common/unicode.js", "../../node_modules/parse5/dist/common/error-codes.js", "../../node_modules/parse5/dist/tokenizer/preprocessor.js", "../../node_modules/parse5/dist/common/token.js", "../../node_modules/entities/lib/esm/generated/generated/decode-data-html.ts", "../../node_modules/entities/lib/esm/generated/generated/decode-data-xml.ts", "../../node_modules/entities/lib/esm/decode_codepoint.ts", "../../node_modules/entities/lib/esm/decode.ts", "../../node_modules/parse5/dist/common/html.js", "../../node_modules/parse5/dist/tokenizer/index.js", "../../node_modules/parse5/dist/parser/open-element-stack.js", "../../node_modules/parse5/dist/parser/formatting-element-list.js", "../../node_modules/parse5/dist/tree-adapters/default.js", "../../node_modules/parse5/dist/common/doctype.js", "../../node_modules/parse5/dist/common/foreign-content.js", "../../node_modules/parse5/dist/parser/index.js", "../../node_modules/entities/lib/esm/escape.ts", "../../node_modules/parse5/dist/serializer/index.js", "../../node_modules/parse5/dist/index.js", "../../node_modules/rehype-parse/node_modules/unist-util-stringify-position/lib/index.js", "../../node_modules/rehype-parse/node_modules/vfile-message/lib/index.js", "../../node_modules/rehype-parse/node_modules/vfile/lib/minpath.browser.js", "../../node_modules/rehype-parse/node_modules/vfile/lib/minproc.browser.js", "../../node_modules/rehype-parse/node_modules/vfile/lib/minurl.shared.js", "../../node_modules/rehype-parse/node_modules/vfile/lib/minurl.browser.js", "../../node_modules/rehype-parse/node_modules/vfile/lib/index.js", "../../node_modules/rehype-parse/node_modules/hast-util-from-html/lib/errors.js", "../../node_modules/rehype-parse/node_modules/hast-util-from-html/lib/index.js", "../../node_modules/rehype-parse/lib/index.js", "../../node_modules/hast-util-embedded/node_modules/hast-util-is-element/lib/index.js", "../../node_modules/hast-util-embedded/lib/index.js", "../../node_modules/rehype-minify-whitespace/node_modules/hast-util-is-element/lib/index.js", "../../node_modules/hast-util-whitespace/lib/index.js", "../../node_modules/rehype-minify-whitespace/node_modules/unist-util-is/lib/index.js", "../../node_modules/rehype-minify-whitespace/lib/block.js", "../../node_modules/rehype-minify-whitespace/lib/content.js", "../../node_modules/rehype-minify-whitespace/lib/skippable.js", "../../node_modules/rehype-minify-whitespace/lib/index.js", "../../node_modules/unist-util-visit/node_modules/unist-util-is/lib/index.js", "../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/lib/index.js", "../../node_modules/unist-util-visit/lib/index.js", "../../node_modules/hast-util-to-mdast/node_modules/unist-util-position/lib/index.js", "../../node_modules/hast-util-to-mdast/lib/handlers/a.js", "../../node_modules/hast-util-to-mdast/lib/handlers/base.js", "../../node_modules/hast-util-to-mdast/lib/handlers/blockquote.js", "../../node_modules/hast-util-to-mdast/lib/handlers/br.js", "../../node_modules/hast-util-to-mdast/node_modules/unist-util-is/lib/index.js", "../../node_modules/hast-util-to-mdast/node_modules/unist-util-find-after/lib/index.js", "../../node_modules/hast-util-to-mdast/node_modules/hast-util-is-element/lib/index.js", "../../node_modules/hast-util-to-mdast/node_modules/hast-util-to-text/lib/index.js", "../../node_modules/trim-trailing-lines/index.js", "../../node_modules/hast-util-to-mdast/lib/handlers/code.js", "../../node_modules/hast-util-to-mdast/lib/handlers/comment.js", "../../node_modules/hast-util-to-mdast/lib/handlers/del.js", "../../node_modules/hast-util-to-mdast/lib/util/list-items-spread.js", "../../node_modules/hast-util-to-mdast/lib/handlers/dl.js", "../../node_modules/hast-util-to-mdast/lib/handlers/em.js", "../../node_modules/hast-util-to-mdast/lib/handlers/heading.js", "../../node_modules/hast-util-to-mdast/lib/handlers/hr.js", "../../node_modules/hast-util-to-mdast/lib/handlers/iframe.js", "../../node_modules/hast-util-to-mdast/lib/handlers/img.js", "../../node_modules/hast-util-to-mdast/lib/handlers/inline-code.js", "../../node_modules/hast-util-to-mdast/lib/util/find-selected-options.js", "../../node_modules/hast-util-to-mdast/lib/handlers/input.js", "../../node_modules/hast-util-has-property/lib/index.js", "../../node_modules/hast-util-is-body-ok-link/lib/index.js", "../../node_modules/hast-util-phrasing/node_modules/hast-util-is-element/lib/index.js", "../../node_modules/hast-util-phrasing/lib/index.js", "../../node_modules/hast-util-to-mdast/lib/handlers/li.js", "../../node_modules/hast-util-to-mdast/lib/handlers/list.js", "../../node_modules/hast-util-to-mdast/node_modules/mdast-util-to-string/lib/index.js", "../../node_modules/hast-util-to-mdast/node_modules/mdast-util-phrasing/lib/index.js", "../../node_modules/hast-util-to-mdast/lib/util/wrap.js", "../../node_modules/hast-util-to-mdast/lib/handlers/media.js", "../../node_modules/hast-util-to-mdast/lib/handlers/p.js", "../../node_modules/hast-util-to-mdast/lib/handlers/q.js", "../../node_modules/hast-util-to-mdast/lib/handlers/root.js", "../../node_modules/hast-util-to-mdast/lib/handlers/select.js", "../../node_modules/hast-util-to-mdast/lib/handlers/strong.js", "../../node_modules/hast-util-to-mdast/lib/handlers/table-cell.js", "../../node_modules/hast-util-to-mdast/lib/handlers/table-row.js", "../../node_modules/hast-util-to-mdast/lib/handlers/table.js", "../../node_modules/hast-util-to-mdast/lib/handlers/text.js", "../../node_modules/hast-util-to-mdast/lib/handlers/textarea.js", "../../node_modules/hast-util-to-mdast/lib/handlers/wbr.js", "../../node_modules/hast-util-to-mdast/lib/handlers/index.js", "../../node_modules/hast-util-to-mdast/lib/state.js", "../../node_modules/hast-util-to-mdast/lib/index.js", "../../node_modules/rehype-remark/lib/index.js", "../../node_modules/micromark-util-chunked/index.js", "../../node_modules/micromark-util-combine-extensions/index.js", "../../node_modules/micromark-util-character/lib/unicode-punctuation-regex.js", "../../node_modules/micromark-util-character/index.js", "../../node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js", "../../node_modules/micromark-util-classify-character/index.js", "../../node_modules/micromark-util-resolve-all/index.js", "../../node_modules/micromark-factory-space/index.js", "../../node_modules/micromark-core-commonmark/lib/blank-line.js", "../../node_modules/decode-named-character-reference/index.dom.js", "../../node_modules/micromark-util-normalize-identifier/index.js", "../../node_modules/micromark-extension-gfm-footnote/lib/syntax.js", "../../node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js", "../../node_modules/micromark-extension-gfm-table/lib/syntax.js", "../../node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js", "../../node_modules/micromark-extension-gfm/index.js", "../../node_modules/ccount/index.js", "../../node_modules/escape-string-regexp/index.js", "../../node_modules/unist-util-is/index.js", "../../node_modules/unist-util-visit-parents/index.js", "../../node_modules/mdast-util-find-and-replace/lib/index.js", "../../node_modules/mdast-util-gfm-autolink-literal/index.js", "../../node_modules/micromark-util-decode-numeric-character-reference/index.js", "../../node_modules/micromark-util-decode-string/index.js", "../../node_modules/mdast-util-to-markdown/lib/util/association.js", "../../node_modules/mdast-util-to-markdown/lib/util/container-flow.js", "../../node_modules/mdast-util-to-markdown/lib/util/indent-lines.js", "../../node_modules/mdast-util-to-markdown/lib/util/pattern-compile.js", "../../node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js", "../../node_modules/mdast-util-to-markdown/lib/util/safe.js", "../../node_modules/mdast-util-to-markdown/lib/util/track.js", "../../node_modules/mdast-util-gfm-footnote/index.js", "../../node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js", "../../node_modules/mdast-util-gfm-strikethrough/index.js", "../../node_modules/mdast-util-to-markdown/lib/handle/inline-code.js", "../../node_modules/markdown-table/index.js", "../../node_modules/mdast-util-gfm-table/lib/index.js", "../../node_modules/mdast-util-to-markdown/lib/util/check-bullet.js", "../../node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js", "../../node_modules/mdast-util-to-markdown/lib/handle/list-item.js", "../../node_modules/mdast-util-gfm-task-list-item/index.js", "../../node_modules/mdast-util-gfm/lib/index.js", "../../node_modules/remark-gfm/index.js", "../../node_modules/zwitch/index.js", "../../node_modules/mdast-util-to-markdown/lib/configure.js", "../../node_modules/mdast-util-to-markdown/lib/handle/blockquote.js", "../../node_modules/mdast-util-to-markdown/lib/handle/break.js", "../../node_modules/longest-streak/index.js", "../../node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js", "../../node_modules/mdast-util-to-markdown/lib/util/check-fence.js", "../../node_modules/mdast-util-to-markdown/lib/handle/code.js", "../../node_modules/mdast-util-to-markdown/lib/util/check-quote.js", "../../node_modules/mdast-util-to-markdown/lib/handle/definition.js", "../../node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js", "../../node_modules/mdast-util-to-markdown/lib/handle/emphasis.js", "../../node_modules/mdast-util-to-markdown/node_modules/unist-util-visit/lib/index.js", "../../node_modules/mdast-util-to-string/index.js", "../../node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js", "../../node_modules/mdast-util-to-markdown/lib/handle/heading.js", "../../node_modules/mdast-util-to-markdown/lib/handle/html.js", "../../node_modules/mdast-util-to-markdown/lib/handle/image.js", "../../node_modules/mdast-util-to-markdown/lib/handle/image-reference.js", "../../node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js", "../../node_modules/mdast-util-to-markdown/lib/handle/link.js", "../../node_modules/mdast-util-to-markdown/lib/handle/link-reference.js", "../../node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js", "../../node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js", "../../node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered-other.js", "../../node_modules/mdast-util-to-markdown/lib/util/check-rule.js", "../../node_modules/mdast-util-to-markdown/lib/handle/list.js", "../../node_modules/mdast-util-to-markdown/lib/handle/paragraph.js", "../../node_modules/mdast-util-phrasing/index.js", "../../node_modules/mdast-util-to-markdown/lib/handle/root.js", "../../node_modules/mdast-util-to-markdown/lib/util/check-strong.js", "../../node_modules/mdast-util-to-markdown/lib/handle/strong.js", "../../node_modules/mdast-util-to-markdown/lib/handle/text.js", "../../node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js", "../../node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js", "../../node_modules/mdast-util-to-markdown/lib/handle/index.js", "../../node_modules/mdast-util-to-markdown/lib/join.js", "../../node_modules/mdast-util-to-markdown/lib/unsafe.js", "../../node_modules/mdast-util-to-markdown/lib/index.js", "../../node_modules/remark-stringify/lib/index.js", "../../static/leafac--javascript.mjs"], "sourcesContent": ["/*global define:false */\n/**\n * Copyright 2012-2017 Craig Campbell\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * Mousetrap is a simple keyboard shortcut library for Javascript with\n * no external dependencies\n *\n * @version 1.6.5\n * @url craig.is/killing/mice\n */\n(function(window, document, undefined) {\n\n // Check if mousetrap is used inside browser, if not, return\n if (!window) {\n return;\n }\n\n /**\n * mapping of special keycodes to their corresponding keys\n *\n * everything in this dictionary cannot use keypress events\n * so it has to be here to map to the correct keycodes for\n * keyup/keydown events\n *\n * @type {Object}\n */\n var _MAP = {\n 8: 'backspace',\n 9: 'tab',\n 13: 'enter',\n 16: 'shift',\n 17: 'ctrl',\n 18: 'alt',\n 20: 'capslock',\n 27: 'esc',\n 32: 'space',\n 33: 'pageup',\n 34: 'pagedown',\n 35: 'end',\n 36: 'home',\n 37: 'left',\n 38: 'up',\n 39: 'right',\n 40: 'down',\n 45: 'ins',\n 46: 'del',\n 91: 'meta',\n 93: 'meta',\n 224: 'meta'\n };\n\n /**\n * mapping for special characters so they can support\n *\n * this dictionary is only used incase you want to bind a\n * keyup or keydown event to one of these keys\n *\n * @type {Object}\n */\n var _KEYCODE_MAP = {\n 106: '*',\n 107: '+',\n 109: '-',\n 110: '.',\n 111 : '/',\n 186: ';',\n 187: '=',\n 188: ',',\n 189: '-',\n 190: '.',\n 191: '/',\n 192: '`',\n 219: '[',\n 220: '\\\\',\n 221: ']',\n 222: '\\''\n };\n\n /**\n * this is a mapping of keys that require shift on a US keypad\n * back to the non shift equivelents\n *\n * this is so you can use keyup events with these keys\n *\n * note that this will only work reliably on US keyboards\n *\n * @type {Object}\n */\n var _SHIFT_MAP = {\n '~': '`',\n '!': '1',\n '@': '2',\n '#': '3',\n '$': '4',\n '%': '5',\n '^': '6',\n '&': '7',\n '*': '8',\n '(': '9',\n ')': '0',\n '_': '-',\n '+': '=',\n ':': ';',\n '\\\"': '\\'',\n '<': ',',\n '>': '.',\n '?': '/',\n '|': '\\\\'\n };\n\n /**\n * this is a list of special strings you can use to map\n * to modifier keys when you specify your keyboard shortcuts\n *\n * @type {Object}\n */\n var _SPECIAL_ALIASES = {\n 'option': 'alt',\n 'command': 'meta',\n 'return': 'enter',\n 'escape': 'esc',\n 'plus': '+',\n 'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl'\n };\n\n /**\n * variable to store the flipped version of _MAP from above\n * needed to check if we should use keypress or not when no action\n * is specified\n *\n * @type {Object|undefined}\n */\n var _REVERSE_MAP;\n\n /**\n * loop through the f keys, f1 to f19 and add them to the map\n * programatically\n */\n for (var i = 1; i < 20; ++i) {\n _MAP[111 + i] = 'f' + i;\n }\n\n /**\n * loop through to map numbers on the numeric keypad\n */\n for (i = 0; i <= 9; ++i) {\n\n // This needs to use a string cause otherwise since 0 is falsey\n // mousetrap will never fire for numpad 0 pressed as part of a keydown\n // event.\n //\n // @see https://github.com/ccampbell/mousetrap/pull/258\n _MAP[i + 96] = i.toString();\n }\n\n /**\n * cross browser add event method\n *\n * @param {Element|HTMLDocument} object\n * @param {string} type\n * @param {Function} callback\n * @returns void\n */\n function _addEvent(object, type, callback) {\n if (object.addEventListener) {\n object.addEventListener(type, callback, false);\n return;\n }\n\n object.attachEvent('on' + type, callback);\n }\n\n /**\n * takes the event and returns the key character\n *\n * @param {Event} e\n * @return {string}\n */\n function _characterFromEvent(e) {\n\n // for keypress events we should return the character as is\n if (e.type == 'keypress') {\n var character = String.fromCharCode(e.which);\n\n // if the shift key is not pressed then it is safe to assume\n // that we want the character to be lowercase. this means if\n // you accidentally have caps lock on then your key bindings\n // will continue to work\n //\n // the only side effect that might not be desired is if you\n // bind something like 'A' cause you want to trigger an\n // event when capital A is pressed caps lock will no longer\n // trigger the event. shift+a will though.\n if (!e.shiftKey) {\n character = character.toLowerCase();\n }\n\n return character;\n }\n\n // for non keypress events the special maps are needed\n if (_MAP[e.which]) {\n return _MAP[e.which];\n }\n\n if (_KEYCODE_MAP[e.which]) {\n return _KEYCODE_MAP[e.which];\n }\n\n // if it is not in the special map\n\n // with keydown and keyup events the character seems to always\n // come in as an uppercase character whether you are pressing shift\n // or not. we should make sure it is always lowercase for comparisons\n return String.fromCharCode(e.which).toLowerCase();\n }\n\n /**\n * checks if two arrays are equal\n *\n * @param {Array} modifiers1\n * @param {Array} modifiers2\n * @returns {boolean}\n */\n function _modifiersMatch(modifiers1, modifiers2) {\n return modifiers1.sort().join(',') === modifiers2.sort().join(',');\n }\n\n /**\n * takes a key event and figures out what the modifiers are\n *\n * @param {Event} e\n * @returns {Array}\n */\n function _eventModifiers(e) {\n var modifiers = [];\n\n if (e.shiftKey) {\n modifiers.push('shift');\n }\n\n if (e.altKey) {\n modifiers.push('alt');\n }\n\n if (e.ctrlKey) {\n modifiers.push('ctrl');\n }\n\n if (e.metaKey) {\n modifiers.push('meta');\n }\n\n return modifiers;\n }\n\n /**\n * prevents default for this event\n *\n * @param {Event} e\n * @returns void\n */\n function _preventDefault(e) {\n if (e.preventDefault) {\n e.preventDefault();\n return;\n }\n\n e.returnValue = false;\n }\n\n /**\n * stops propogation for this event\n *\n * @param {Event} e\n * @returns void\n */\n function _stopPropagation(e) {\n if (e.stopPropagation) {\n e.stopPropagation();\n return;\n }\n\n e.cancelBubble = true;\n }\n\n /**\n * determines if the keycode specified is a modifier key or not\n *\n * @param {string} key\n * @returns {boolean}\n */\n function _isModifier(key) {\n return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta';\n }\n\n /**\n * reverses the map lookup so that we can look for specific keys\n * to see what can and can't use keypress\n *\n * @return {Object}\n */\n function _getReverseMap() {\n if (!_REVERSE_MAP) {\n _REVERSE_MAP = {};\n for (var key in _MAP) {\n\n // pull out the numeric keypad from here cause keypress should\n // be able to detect the keys from the character\n if (key > 95 && key < 112) {\n continue;\n }\n\n if (_MAP.hasOwnProperty(key)) {\n _REVERSE_MAP[_MAP[key]] = key;\n }\n }\n }\n return _REVERSE_MAP;\n }\n\n /**\n * picks the best action based on the key combination\n *\n * @param {string} key - character for key\n * @param {Array} modifiers\n * @param {string=} action passed in\n */\n function _pickBestAction(key, modifiers, action) {\n\n // if no action was picked in we should try to pick the one\n // that we think would work best for this key\n if (!action) {\n action = _getReverseMap()[key] ? 'keydown' : 'keypress';\n }\n\n // modifier keys don't work as expected with keypress,\n // switch to keydown\n if (action == 'keypress' && modifiers.length) {\n action = 'keydown';\n }\n\n return action;\n }\n\n /**\n * Converts from a string key combination to an array\n *\n * @param {string} combination like \"command+shift+l\"\n * @return {Array}\n */\n function _keysFromString(combination) {\n if (combination === '+') {\n return ['+'];\n }\n\n combination = combination.replace(/\\+{2}/g, '+plus');\n return combination.split('+');\n }\n\n /**\n * Gets info for a specific key combination\n *\n * @param {string} combination key combination (\"command+s\" or \"a\" or \"*\")\n * @param {string=} action\n * @returns {Object}\n */\n function _getKeyInfo(combination, action) {\n var keys;\n var key;\n var i;\n var modifiers = [];\n\n // take the keys from this pattern and figure out what the actual\n // pattern is all about\n keys = _keysFromString(combination);\n\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n\n // normalize key names\n if (_SPECIAL_ALIASES[key]) {\n key = _SPECIAL_ALIASES[key];\n }\n\n // if this is not a keypress event then we should\n // be smart about using shift keys\n // this will only work for US keyboards however\n if (action && action != 'keypress' && _SHIFT_MAP[key]) {\n key = _SHIFT_MAP[key];\n modifiers.push('shift');\n }\n\n // if this key is a modifier then add it to the list of modifiers\n if (_isModifier(key)) {\n modifiers.push(key);\n }\n }\n\n // depending on what the key combination is\n // we will try to pick the best event for it\n action = _pickBestAction(key, modifiers, action);\n\n return {\n key: key,\n modifiers: modifiers,\n action: action\n };\n }\n\n function _belongsTo(element, ancestor) {\n if (element === null || element === document) {\n return false;\n }\n\n if (element === ancestor) {\n return true;\n }\n\n return _belongsTo(element.parentNode, ancestor);\n }\n\n function Mousetrap(targetElement) {\n var self = this;\n\n targetElement = targetElement || document;\n\n if (!(self instanceof Mousetrap)) {\n return new Mousetrap(targetElement);\n }\n\n /**\n * element to attach key events to\n *\n * @type {Element}\n */\n self.target = targetElement;\n\n /**\n * a list of all the callbacks setup via Mousetrap.bind()\n *\n * @type {Object}\n */\n self._callbacks = {};\n\n /**\n * direct map of string combinations to callbacks used for trigger()\n *\n * @type {Object}\n */\n self._directMap = {};\n\n /**\n * keeps track of what level each sequence is at since multiple\n * sequences can start out with the same sequence\n *\n * @type {Object}\n */\n var _sequenceLevels = {};\n\n /**\n * variable to store the setTimeout call\n *\n * @type {null|number}\n */\n var _resetTimer;\n\n /**\n * temporary state where we will ignore the next keyup\n *\n * @type {boolean|string}\n */\n var _ignoreNextKeyup = false;\n\n /**\n * temporary state where we will ignore the next keypress\n *\n * @type {boolean}\n */\n var _ignoreNextKeypress = false;\n\n /**\n * are we currently inside of a sequence?\n * type of action (\"keyup\" or \"keydown\" or \"keypress\") or false\n *\n * @type {boolean|string}\n */\n var _nextExpectedAction = false;\n\n /**\n * resets all sequence counters except for the ones passed in\n *\n * @param {Object} doNotReset\n * @returns void\n */\n function _resetSequences(doNotReset) {\n doNotReset = doNotReset || {};\n\n var activeSequences = false,\n key;\n\n for (key in _sequenceLevels) {\n if (doNotReset[key]) {\n activeSequences = true;\n continue;\n }\n _sequenceLevels[key] = 0;\n }\n\n if (!activeSequences) {\n _nextExpectedAction = false;\n }\n }\n\n /**\n * finds all callbacks that match based on the keycode, modifiers,\n * and action\n *\n * @param {string} character\n * @param {Array} modifiers\n * @param {Event|Object} e\n * @param {string=} sequenceName - name of the sequence we are looking for\n * @param {string=} combination\n * @param {number=} level\n * @returns {Array}\n */\n function _getMatches(character, modifiers, e, sequenceName, combination, level) {\n var i;\n var callback;\n var matches = [];\n var action = e.type;\n\n // if there are no events related to this keycode\n if (!self._callbacks[character]) {\n return [];\n }\n\n // if a modifier key is coming up on its own we should allow it\n if (action == 'keyup' && _isModifier(character)) {\n modifiers = [character];\n }\n\n // loop through all callbacks for the key that was pressed\n // and see if any of them match\n for (i = 0; i < self._callbacks[character].length; ++i) {\n callback = self._callbacks[character][i];\n\n // if a sequence name is not specified, but this is a sequence at\n // the wrong level then move onto the next match\n if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) {\n continue;\n }\n\n // if the action we are looking for doesn't match the action we got\n // then we should keep going\n if (action != callback.action) {\n continue;\n }\n\n // if this is a keypress event and the meta key and control key\n // are not pressed that means that we need to only look at the\n // character, otherwise check the modifiers as well\n //\n // chrome will not fire a keypress if meta or control is down\n // safari will fire a keypress if meta or meta+shift is down\n // firefox will fire a keypress if meta or control is down\n if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) {\n\n // when you bind a combination or sequence a second time it\n // should overwrite the first one. if a sequenceName or\n // combination is specified in this call it does just that\n //\n // @todo make deleting its own method?\n var deleteCombo = !sequenceName && callback.combo == combination;\n var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level;\n if (deleteCombo || deleteSequence) {\n self._callbacks[character].splice(i, 1);\n }\n\n matches.push(callback);\n }\n }\n\n return matches;\n }\n\n /**\n * actually calls the callback function\n *\n * if your callback function returns false this will use the jquery\n * convention - prevent default and stop propogation on the event\n *\n * @param {Function} callback\n * @param {Event} e\n * @returns void\n */\n function _fireCallback(callback, e, combo, sequence) {\n\n // if this event should not happen stop here\n if (self.stopCallback(e, e.target || e.srcElement, combo, sequence)) {\n return;\n }\n\n if (callback(e, combo) === false) {\n _preventDefault(e);\n _stopPropagation(e);\n }\n }\n\n /**\n * handles a character key event\n *\n * @param {string} character\n * @param {Array} modifiers\n * @param {Event} e\n * @returns void\n */\n self._handleKey = function(character, modifiers, e) {\n var callbacks = _getMatches(character, modifiers, e);\n var i;\n var doNotReset = {};\n var maxLevel = 0;\n var processedSequenceCallback = false;\n\n // Calculate the maxLevel for sequences so we can only execute the longest callback sequence\n for (i = 0; i < callbacks.length; ++i) {\n if (callbacks[i].seq) {\n maxLevel = Math.max(maxLevel, callbacks[i].level);\n }\n }\n\n // loop through matching callbacks for this key event\n for (i = 0; i < callbacks.length; ++i) {\n\n // fire for all sequence callbacks\n // this is because if for example you have multiple sequences\n // bound such as \"g i\" and \"g t\" they both need to fire the\n // callback for matching g cause otherwise you can only ever\n // match the first one\n if (callbacks[i].seq) {\n\n // only fire callbacks for the maxLevel to prevent\n // subsequences from also firing\n //\n // for example 'a option b' should not cause 'option b' to fire\n // even though 'option b' is part of the other sequence\n //\n // any sequences that do not match here will be discarded\n // below by the _resetSequences call\n if (callbacks[i].level != maxLevel) {\n continue;\n }\n\n processedSequenceCallback = true;\n\n // keep a list of which sequences were matches for later\n doNotReset[callbacks[i].seq] = 1;\n _fireCallback(callbacks[i].callback, e, callbacks[i].combo, callbacks[i].seq);\n continue;\n }\n\n // if there were no sequence matches but we are still here\n // that means this is a regular match so we should fire that\n if (!processedSequenceCallback) {\n _fireCallback(callbacks[i].callback, e, callbacks[i].combo);\n }\n }\n\n // if the key you pressed matches the type of sequence without\n // being a modifier (ie \"keyup\" or \"keypress\") then we should\n // reset all sequences that were not matched by this event\n //\n // this is so, for example, if you have the sequence \"h a t\" and you\n // type \"h e a r t\" it does not match. in this case the \"e\" will\n // cause the sequence to reset\n //\n // modifier keys are ignored because you can have a sequence\n // that contains modifiers such as \"enter ctrl+space\" and in most\n // cases the modifier key will be pressed before the next key\n //\n // also if you have a sequence such as \"ctrl+b a\" then pressing the\n // \"b\" key will trigger a \"keypress\" and a \"keydown\"\n //\n // the \"keydown\" is expected when there is a modifier, but the\n // \"keypress\" ends up matching the _nextExpectedAction since it occurs\n // after and that causes the sequence to reset\n //\n // we ignore keypresses in a sequence that directly follow a keydown\n // for the same character\n var ignoreThisKeypress = e.type == 'keypress' && _ignoreNextKeypress;\n if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) {\n _resetSequences(doNotReset);\n }\n\n _ignoreNextKeypress = processedSequenceCallback && e.type == 'keydown';\n };\n\n /**\n * handles a keydown event\n *\n * @param {Event} e\n * @returns void\n */\n function _handleKeyEvent(e) {\n\n // normalize e.which for key events\n // @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion\n if (typeof e.which !== 'number') {\n e.which = e.keyCode;\n }\n\n var character = _characterFromEvent(e);\n\n // no character found then stop\n if (!character) {\n return;\n }\n\n // need to use === for the character check because the character can be 0\n if (e.type == 'keyup' && _ignoreNextKeyup === character) {\n _ignoreNextKeyup = false;\n return;\n }\n\n self.handleKey(character, _eventModifiers(e), e);\n }\n\n /**\n * called to set a 1 second timeout on the specified sequence\n *\n * this is so after each key press in the sequence you have 1 second\n * to press the next key before you have to start over\n *\n * @returns void\n */\n function _resetSequenceTimer() {\n clearTimeout(_resetTimer);\n _resetTimer = setTimeout(_resetSequences, 1000);\n }\n\n /**\n * binds a key sequence to an event\n *\n * @param {string} combo - combo specified in bind call\n * @param {Array} keys\n * @param {Function} callback\n * @param {string=} action\n * @returns void\n */\n function _bindSequence(combo, keys, callback, action) {\n\n // start off by adding a sequence level record for this combination\n // and setting the level to 0\n _sequenceLevels[combo] = 0;\n\n /**\n * callback to increase the sequence level for this sequence and reset\n * all other sequences that were active\n *\n * @param {string} nextAction\n * @returns {Function}\n */\n function _increaseSequence(nextAction) {\n return function() {\n _nextExpectedAction = nextAction;\n ++_sequenceLevels[combo];\n _resetSequenceTimer();\n };\n }\n\n /**\n * wraps the specified callback inside of another function in order\n * to reset all sequence counters as soon as this sequence is done\n *\n * @param {Event} e\n * @returns void\n */\n function _callbackAndReset(e) {\n _fireCallback(callback, e, combo);\n\n // we should ignore the next key up if the action is key down\n // or keypress. this is so if you finish a sequence and\n // release the key the final key will not trigger a keyup\n if (action !== 'keyup') {\n _ignoreNextKeyup = _characterFromEvent(e);\n }\n\n // weird race condition if a sequence ends with the key\n // another sequence begins with\n setTimeout(_resetSequences, 10);\n }\n\n // loop through keys one at a time and bind the appropriate callback\n // function. for any key leading up to the final one it should\n // increase the sequence. after the final, it should reset all sequences\n //\n // if an action is specified in the original bind call then that will\n // be used throughout. otherwise we will pass the action that the\n // next key in the sequence should match. this allows a sequence\n // to mix and match keypress and keydown events depending on which\n // ones are better suited to the key provided\n for (var i = 0; i < keys.length; ++i) {\n var isFinal = i + 1 === keys.length;\n var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i + 1]).action);\n _bindSingle(keys[i], wrappedCallback, action, combo, i);\n }\n }\n\n /**\n * binds a single keyboard combination\n *\n * @param {string} combination\n * @param {Function} callback\n * @param {string=} action\n * @param {string=} sequenceName - name of sequence if part of sequence\n * @param {number=} level - what part of the sequence the command is\n * @returns void\n */\n function _bindSingle(combination, callback, action, sequenceName, level) {\n\n // store a direct mapped reference for use with Mousetrap.trigger\n self._directMap[combination + ':' + action] = callback;\n\n // make sure multiple spaces in a row become a single space\n combination = combination.replace(/\\s+/g, ' ');\n\n var sequence = combination.split(' ');\n var info;\n\n // if this pattern is a sequence of keys then run through this method\n // to reprocess each pattern one key at a time\n if (sequence.length > 1) {\n _bindSequence(combination, sequence, callback, action);\n return;\n }\n\n info = _getKeyInfo(combination, action);\n\n // make sure to initialize array if this is the first time\n // a callback is added for this key\n self._callbacks[info.key] = self._callbacks[info.key] || [];\n\n // remove an existing match if there is one\n _getMatches(info.key, info.modifiers, {type: info.action}, sequenceName, combination, level);\n\n // add this call back to the array\n // if it is a sequence put it at the beginning\n // if not put it at the end\n //\n // this is important because the way these are processed expects\n // the sequence ones to come first\n self._callbacks[info.key][sequenceName ? 'unshift' : 'push']({\n callback: callback,\n modifiers: info.modifiers,\n action: info.action,\n seq: sequenceName,\n level: level,\n combo: combination\n });\n }\n\n /**\n * binds multiple combinations to the same callback\n *\n * @param {Array} combinations\n * @param {Function} callback\n * @param {string|undefined} action\n * @returns void\n */\n self._bindMultiple = function(combinations, callback, action) {\n for (var i = 0; i < combinations.length; ++i) {\n _bindSingle(combinations[i], callback, action);\n }\n };\n\n // start!\n _addEvent(targetElement, 'keypress', _handleKeyEvent);\n _addEvent(targetElement, 'keydown', _handleKeyEvent);\n _addEvent(targetElement, 'keyup', _handleKeyEvent);\n }\n\n /**\n * binds an event to mousetrap\n *\n * can be a single key, a combination of keys separated with +,\n * an array of keys, or a sequence of keys separated by spaces\n *\n * be sure to list the modifier keys first to make sure that the\n * correct key ends up getting bound (the last key in the pattern)\n *\n * @param {string|Array} keys\n * @param {Function} callback\n * @param {string=} action - 'keypress', 'keydown', or 'keyup'\n * @returns void\n */\n Mousetrap.prototype.bind = function(keys, callback, action) {\n var self = this;\n keys = keys instanceof Array ? keys : [keys];\n self._bindMultiple.call(self, keys, callback, action);\n return self;\n };\n\n /**\n * unbinds an event to mousetrap\n *\n * the unbinding sets the callback function of the specified key combo\n * to an empty function and deletes the corresponding key in the\n * _directMap dict.\n *\n * TODO: actually remove this from the _callbacks dictionary instead\n * of binding an empty function\n *\n * the keycombo+action has to be exactly the same as\n * it was defined in the bind method\n *\n * @param {string|Array} keys\n * @param {string} action\n * @returns void\n */\n Mousetrap.prototype.unbind = function(keys, action) {\n var self = this;\n return self.bind.call(self, keys, function() {}, action);\n };\n\n /**\n * triggers an event that has already been bound\n *\n * @param {string} keys\n * @param {string=} action\n * @returns void\n */\n Mousetrap.prototype.trigger = function(keys, action) {\n var self = this;\n if (self._directMap[keys + ':' + action]) {\n self._directMap[keys + ':' + action]({}, keys);\n }\n return self;\n };\n\n /**\n * resets the library back to its initial state. this is useful\n * if you want to clear out the current keyboard shortcuts and bind\n * new ones - for example if you switch to another page\n *\n * @returns void\n */\n Mousetrap.prototype.reset = function() {\n var self = this;\n self._callbacks = {};\n self._directMap = {};\n return self;\n };\n\n /**\n * should we stop this event before firing off callbacks\n *\n * @param {Event} e\n * @param {Element} element\n * @return {boolean}\n */\n Mousetrap.prototype.stopCallback = function(e, element) {\n var self = this;\n\n // if the element has the class \"mousetrap\" then no need to stop\n if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {\n return false;\n }\n\n if (_belongsTo(element, self.target)) {\n return false;\n }\n\n // Events originating from a shadow DOM are re-targetted and `e.target` is the shadow host,\n // not the initial event target in the shadow tree. Note that not all events cross the\n // shadow boundary.\n // For shadow trees with `mode: 'open'`, the initial event target is the first element in\n // the event\u2019s composed path. For shadow trees with `mode: 'closed'`, the initial event\n // target cannot be obtained.\n if ('composedPath' in e && typeof e.composedPath === 'function') {\n // For open shadow trees, update `element` so that the following check works.\n var initialEventTarget = e.composedPath()[0];\n if (initialEventTarget !== e.target) {\n element = initialEventTarget;\n }\n }\n\n // stop for input, select, and textarea\n return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable;\n };\n\n /**\n * exposes _handleKey publicly so it can be overwritten by extensions\n */\n Mousetrap.prototype.handleKey = function() {\n var self = this;\n return self._handleKey.apply(self, arguments);\n };\n\n /**\n * allow custom key mappings\n */\n Mousetrap.addKeycodes = function(object) {\n for (var key in object) {\n if (object.hasOwnProperty(key)) {\n _MAP[key] = object[key];\n }\n }\n _REVERSE_MAP = null;\n };\n\n /**\n * Init the global mousetrap functions\n *\n * This method is needed to allow the global mousetrap functions to work\n * now that mousetrap is a constructor function.\n */\n Mousetrap.init = function() {\n var documentMousetrap = Mousetrap(document);\n for (var method in documentMousetrap) {\n if (method.charAt(0) !== '_') {\n Mousetrap[method] = (function(method) {\n return function() {\n return documentMousetrap[method].apply(documentMousetrap, arguments);\n };\n } (method));\n }\n }\n };\n\n Mousetrap.init();\n\n // expose mousetrap to the global object\n window.Mousetrap = Mousetrap;\n\n // expose as a common js module\n if (typeof module !== 'undefined' && module.exports) {\n module.exports = Mousetrap;\n }\n\n // expose mousetrap as an AMD module\n if (typeof define === 'function' && define.amd) {\n define(function() {\n return Mousetrap;\n });\n }\n}) (typeof window !== 'undefined' ? window : null, typeof window !== 'undefined' ? document : null);\n", "/* jshint browser: true */\n\n(function () {\n\n// We'll copy the properties below into the mirror div.\n// Note that some browsers, such as Firefox, do not concatenate properties\n// into their shorthand (e.g. padding-top, padding-bottom etc. -> padding),\n// so we have to list every single property explicitly.\nvar properties = [\n 'direction', // RTL support\n 'boxSizing',\n 'width', // on Chrome and IE, exclude the scrollbar, so the mirror div wraps exactly as the textarea does\n 'height',\n 'overflowX',\n 'overflowY', // copy the scrollbar for IE\n\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'borderStyle',\n\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/font\n 'fontStyle',\n 'fontVariant',\n 'fontWeight',\n 'fontStretch',\n 'fontSize',\n 'fontSizeAdjust',\n 'lineHeight',\n 'fontFamily',\n\n 'textAlign',\n 'textTransform',\n 'textIndent',\n 'textDecoration', // might not make a difference, but better be safe\n\n 'letterSpacing',\n 'wordSpacing',\n\n 'tabSize',\n 'MozTabSize'\n\n];\n\nvar isBrowser = (typeof window !== 'undefined');\nvar isFirefox = (isBrowser && window.mozInnerScreenX != null);\n\nfunction getCaretCoordinates(element, position, options) {\n if (!isBrowser) {\n throw new Error('textarea-caret-position#getCaretCoordinates should only be called in a browser');\n }\n\n var debug = options && options.debug || false;\n if (debug) {\n var el = document.querySelector('#input-textarea-caret-position-mirror-div');\n if (el) el.parentNode.removeChild(el);\n }\n\n // The mirror div will replicate the textarea's style\n var div = document.createElement('div');\n div.id = 'input-textarea-caret-position-mirror-div';\n document.body.appendChild(div);\n\n var style = div.style;\n var computed = window.getComputedStyle ? window.getComputedStyle(element) : element.currentStyle; // currentStyle for IE < 9\n var isInput = element.nodeName === 'INPUT';\n\n // Default textarea styles\n style.whiteSpace = 'pre-wrap';\n if (!isInput)\n style.wordWrap = 'break-word'; // only for textarea-s\n\n // Position off-screen\n style.position = 'absolute'; // required to return coordinates properly\n if (!debug)\n style.visibility = 'hidden'; // not 'display: none' because we want rendering\n\n // Transfer the element's properties to the div\n properties.forEach(function (prop) {\n if (isInput && prop === 'lineHeight') {\n // Special case for s because text is rendered centered and line height may be != height\n style.lineHeight = computed.height;\n } else {\n style[prop] = computed[prop];\n }\n });\n\n if (isFirefox) {\n // Firefox lies about the overflow property for textareas: https://bugzilla.mozilla.org/show_bug.cgi?id=984275\n if (element.scrollHeight > parseInt(computed.height))\n style.overflowY = 'scroll';\n } else {\n style.overflow = 'hidden'; // for Chrome to not render a scrollbar; IE keeps overflowY = 'scroll'\n }\n\n div.textContent = element.value.substring(0, position);\n // The second special handling for input type=\"text\" vs textarea:\n // spaces need to be replaced with non-breaking spaces - http://stackoverflow.com/a/13402035/1269037\n if (isInput)\n div.textContent = div.textContent.replace(/\\s/g, '\\u00a0');\n\n var span = document.createElement('span');\n // Wrapping must be replicated *exactly*, including when a long word gets\n // onto the next line, with whitespace at the end of the line before (#7).\n // The *only* reliable way to do that is to copy the *entire* rest of the\n // textarea's content into the created at the caret position.\n // For inputs, just '.' would be enough, but no need to bother.\n span.textContent = element.value.substring(position) || '.'; // || because a completely empty faux span doesn't render at all\n div.appendChild(span);\n\n var coordinates = {\n top: span.offsetTop + parseInt(computed['borderTopWidth']),\n left: span.offsetLeft + parseInt(computed['borderLeftWidth']),\n height: parseInt(computed['lineHeight'])\n };\n\n if (debug) {\n span.style.backgroundColor = '#aaa';\n } else {\n document.body.removeChild(div);\n }\n\n return coordinates;\n}\n\nif (typeof module != 'undefined' && typeof module.exports != 'undefined') {\n module.exports = getCaretCoordinates;\n} else if(isBrowser) {\n window.getCaretCoordinates = getCaretCoordinates;\n}\n\n}());\n", "\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:true});exports.applyPatch=exports.calcPatch=exports.lcs=exports.diff=exports.diff_core=void 0;function diff_internal(state,c){const{b,eq,stack_base}=state;let{i,N,j,M,Z,stack_top}=state;for(;;){switch(c){case 0:{Z_block:while(N>0&&M>0){b.fill(0,0,2*Z);const W=N-M;const L=N+M;const parity=L&1;const offsetx=i+N-1;const offsety=j+M-1;const hmax=(L+parity)/2;let z;h_loop:for(let h=0;h<=hmax;h++){const kmin=2*Math.max(0,h-M)-h;const kmax=h-2*Math.max(0,h-N);for(let k=kmin;k<=kmax;k+=2){const gkm=b[k-1-Z*Math.floor((k-1)/Z)];const gkp=b[k+1-Z*Math.floor((k+1)/Z)];const u=(k===-h||(k!==h&&gkm=1-h&&z=N){if(h>1||x!==u){stack_base[stack_top++]=i+x;stack_base[stack_top++]=N-x;stack_base[stack_top++]=j+y;stack_base[stack_top++]=M-y;N=u;M=v;Z=2*(Math.min(N,M)+1);continue Z_block;}\nelse\nbreak h_loop;}}\nfor(let k=kmin;k<=kmax;k+=2){const pkm=b[Z+k-1-Z*Math.floor((k-1)/Z)];const pkp=b[Z+k+1-Z*Math.floor((k+1)/Z)];const u=(k===-h||(k!==h&&pkm=-h&&z<=h&&x+b[z-Z*Math.floor(z/Z)]>=N){if(h>0||x!==u){stack_base[stack_top++]=i+N-u;stack_base[stack_top++]=u;stack_base[stack_top++]=j+M-v;stack_base[stack_top++]=v;N=N-x;M=M-y;Z=2*(Math.min(N,M)+1);continue Z_block;}\nelse\nbreak h_loop;}}}\nif(N===M)\ncontinue;if(M>N){i+=N;j+=N;M-=N;N=0;}\nelse{i+=M;j+=M;N-=M;M=0;}\nbreak;}\nif(N+M!==0){if(state.pxe===i||state.pye===j){state.pxe=i+N;state.pye=j+M;}\nelse{const sx=state.pxs;state.oxs=state.pxs;state.oxe=state.pxe;state.oys=state.pys;state.oye=state.pye;state.pxs=i;state.pxe=i+N;state.pys=j;state.pye=j+M;if(sx>=0){state.i=i;state.N=N;state.j=j;state.M=M;state.Z=Z;state.stack_top=stack_top;return 1;}}}}\ncase 1:{if(stack_top===0)\nreturn 2;M=stack_base[--stack_top];j=stack_base[--stack_top];N=stack_base[--stack_top];i=stack_base[--stack_top];Z=2*(Math.min(N,M)+1);c=0;}}}}\nclass DiffGen{constructor(state){this.state=state;this.c=0;this.result={value:null,done:false};}\n[Symbol.iterator](){return this;}\nnext(){const{state,result}=this;if(this.c>1){result.done=true;result.value=undefined;return result;}\nconst c=diff_internal(state,this.c);this.c=c;if(c===1){result.value=[state.oxs,state.oxe,state.oys,state.oye];return result;}\nif(state.pxs>=0){result.value=[state.pxs,state.pxe,state.pys,state.pye];return result;}\nresult.done=true;result.value=undefined;return result;}}\nfunction diff_core(i,N,j,M,eq){const Z=(Math.min(N,M)+1)*2;const L=N+M;const b=new(L<256?Uint8Array:L<65536?Uint16Array:Uint32Array)(2*Z);return new DiffGen({i,N,j,M,Z,b,eq,pxs:-1,pxe:-1,pys:-1,pye:-1,oxs:-1,oxe:-1,oys:-1,oye:-1,stack_top:0,stack_base:[],});}\nexports.diff_core=diff_core;function diff(xs,ys,eq){let[i,N,M]=[0,xs.length,ys.length];if(typeof eq==='function'){while(ii&&M>i);}\nelse{while(ii&&M>i);eq=(i,j)=>xs[i]===ys[j];}\nreturn diff_core(i,N+1-i,i,M+1-i,eq);}\nexports.diff=diff;class LCSGen{constructor(diff,N){this.diff=diff;this.N=N;this.i=0;this.j=0;}\n[Symbol.iterator](){return this;}\nnext(){const rec=this.diff.next();if(rec.done){const{i,j,N}=this;if(i0)\nyield ins;i=dele;}\nif(iparseFloat(n.maxHeight)?(\"hidden\"===n.overflowY&&(t.style.overflow=\"scroll\"),i=parseFloat(n.maxHeight)):\"hidden\"!==n.overflowY&&(t.style.overflow=\"hidden\"),t.style.height=i+\"px\",s&&(t.style.textAlign=s),o&&o(),r!==i&&(t.dispatchEvent(new Event(\"autosize:resized\",{bubbles:!0})),r=i),c!==n.overflow&&!s)){var v=n.textAlign;\"hidden\"===n.overflow&&(t.style.textAlign=\"start\"===v?\"end\":\"start\"),a({restoreTextAlign:v,testForHeightReduction:!0})}}function s(){a({testForHeightReduction:!0,restoreTextAlign:null})}}(t)}),t}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],t),e},r.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],o),e});var n=r;export default n;\n", "\n import \"@fontsource-variable/public-sans\";\n import \"@fontsource-variable/public-sans/wght-italic.css\";\n import \"@fontsource-variable/jetbrains-mono\";\n import \"@fontsource-variable/jetbrains-mono/wght-italic.css\";\n import \"bootstrap-icons/font/bootstrap-icons.css\";\n import \"katex/dist/katex.css\";\n import \"tippy.js/dist/tippy.css\";\n import \"tippy.js/dist/svg-arrow.css\";\n import \"tippy.js/dist/border.css\";\n import \"@leafac/css/static/index.css\";\n import \"./index.css\";\n\n import autosize from \"autosize\";\n import Mousetrap from \"mousetrap\";\n import scrollIntoViewIfNeeded from \"scroll-into-view-if-needed\";\n import * as tippy from \"tippy.js\";\n import textareaCaret from \"textarea-caret\";\n import * as textFieldEdit from \"text-field-edit\";\n import { unified } from \"unified\";\n import rehypeParse from \"rehype-parse\";\n import rehypeRemark from \"rehype-remark\";\n import remarkGfm from \"remark-gfm\";\n import remarkStringify from \"remark-stringify\";\n // import * as leafac from \"@leafac/javascript/static/index.mjs\";\n import * as leafac from \"./leafac--javascript.mjs\";\n\n leafac.customFormValidation();\n leafac.warnAboutLosingInputs();\n leafac.tippySetDefaultProps();\n leafac.liveNavigation();\n/********************************************************************************/\n\nleafac.execute.functions.set(\"esiuprnjstllbb\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Sign up on a Courselore installation managed by the developers of Courselore.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fomhgyheydeoig\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Sign in on a Courselore installation managed by the developers of Courselore.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"abtpffrqjnamc\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Join the Courselore community on Meta Courselore, a Courselore course that isn\u2019t really a course, but a place to talk about Courselore itself.\", \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"caxsoypwnzevte\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Courselore is open source and will be free forever for installing on your own server.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gejvgbbmrkzxgm\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"A Courselore installation running the latest development version. Not for use with real courses.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gwglhiuerrsnet\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"A straightforward way to make text bold, include links, and so forth.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"eosbpprmtycexg\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"A way to write mathematical formulas.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gufpgpiajhfwgk\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"Color computer code to make it easier to read.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bgyimxunfvfxjj\", function (event) {\n\n this.isModified = false;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fstbexzbletcma\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Sign up on a Courselore installation managed by the developers of Courselore.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"deirqharjstubp\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Sign in on a Courselore installation managed by the developers of Courselore.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"doqhttaaydmefk\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Join the Courselore community on Meta Courselore, a Courselore course that isn\u2019t really a course, but a place to talk about Courselore itself.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"vsksmcvsbykxr\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Courselore is open source and will be free forever for installing on your own server.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bbnxayksyitxhm\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"A Courselore installation running the latest development version. Not for use with real courses.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"zyczawlnqudcv\", function (event) {\n\n this.isModified = false;\n\n this.oninput = () => {\n const filterPhrases = this.value.split(/[^a-z0-9]+/i).filter((filterPhrase) => filterPhrase.trim() !== \"\");\n for (const user of document.querySelectorAll('[key^=\"user/\"]')) {\n let userHidden = filterPhrases.length > 0;\n for (const filterablePhrasesElement of user.querySelectorAll(\"[data-filterable-phrases]\")) {\n const filterablePhrases = JSON.parse(filterablePhrasesElement.getAttribute(\"data-filterable-phrases\"));\n const filterablePhrasesElementChildren = [];\n for (const filterablePhrase of filterablePhrases) {\n let filterablePhraseElement;\n if (filterPhrases.some(filterPhrase => filterablePhrase.toLowerCase().startsWith(filterPhrase.toLowerCase()))) {\n filterablePhraseElement = document.createElement(\"mark\");\n filterablePhraseElement.classList.add(\"mark\");\n userHidden = false;\n } else\n filterablePhraseElement = document.createElement(\"span\");\n filterablePhraseElement.textContent = filterablePhrase;\n filterablePhrasesElementChildren.push(filterablePhraseElement);\n }\n filterablePhrasesElement.replaceChildren(...filterablePhrasesElementChildren);\n }\n user.hidden = userHidden;\n }\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cnujbosyaaqdcf\", function (event) {\n\n this.onbeforemorph = (event) => !event?.detail?.liveUpdate;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"jdbrydgeplprj\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Copy Email\",\n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"copied\",\n tippyProps: {\n theme: \"green\",\n trigger: \"manual\",\n content: \"Copied\",\n },\n });\n\n this.onclick = async () => {\n await navigator.clipboard.writeText($$0);\n this.copied.show();\n await new Promise((resolve) => { window.setTimeout(resolve, 1000); });\n this.copied.hide();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"epjpghpduyhztx\", function (event) {\n\n leafac.relativizeDateTimeElement(this, { preposition: \"on\", target: this.parentElement });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dbafywbukijsii\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Update System Role\",\n },\n });\n \n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dnlqsmcstnvnwx\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: \"rose\",\n trigger: \"click\",\n content: \"You may not update your own role because you\u2019re the only administrator.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hhjiysoglyzxwf\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n theme: \"rose\",\n trigger: \"click\",\n interactive: true,\n appendTo: document.querySelector(\"body\"),\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dyoiglowopypyg\", function (event) {\n\n leafac.relativizeDateTimeElement(this, { preposition: \"on\", target: this.parentElement });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gkeedxynglvyft\", function (event) {\n\n leafac.relativizeDateTimeElement(this, { preposition: \"on\", target: this.parentElement });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"btzgovmsiavnys\", function (event) {\n\n this.isModified = false;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ejqtnukefrwpfx\", function (event) {\n\n this.onbeforelivenavigate = () => false;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cxtolggtbdeecq\", function (event) {\n\n this.onvalidate = () => {\n if (this.value !== this.closest(\"form\").querySelector('[name=\"password\"]').value)\n return \"Password & Password Confirmation don\u2019t match.\";\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"esdxmzcqffotnw\", function (event) {\n\n this.onbeforelivenavigate = () => false;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cwuyauxjuvclid\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cehqbdrtxdsiri\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$0,\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gksecezdqnjilg\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n interactive: true,\n appendTo: document.querySelector(\"body\"),\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"elvrcckyrjckkh\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n interactive: true,\n appendTo: document.querySelector(\"body\"),\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ebjhxcjoygovhp\", function (event, $$0) {\n\n if ($$0)\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Your Vote\", \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gvvnsnhjaqwlb\", function (event, $$0) {\n\n this.style.setProperty(\"--width\", $$0);\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bgtznpkxmpyres\", function (event) {\n\n leafac.relativizeDateTimeElement(this, { preposition: \"on\", target: this.parentElement });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fygkfhtdxkkodz\", function (event) {\n\n this.onclick = () => {\n this.closest(\"form\").isValid = true;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dnqputwwsbmfbr\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"The course staff and the poll creator may see individual votes. Students may see aggregate results.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gkamqhjkkjljer\", function (event) {\n\n this.onclick = async () => {\n const poll = this.closest('[key=\"poll--show\"]');\n for (const element of poll.querySelectorAll('[data-results=\"true\"]:not([data-results-votes=\"true\"])'))\n element.hidden = false;\n poll.querySelector('[key=\"poll--show--actions--show-results\"]').hidden = true;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gzpzhvrtidwuin\", function (event) {\n\n this.onclick = async () => {\n const poll = this.closest('[key=\"poll--show\"]');\n for (const element of poll.querySelectorAll('[data-results=\"true\"]'))\n element.hidden = true;\n poll.querySelector('[key=\"poll--show--actions--show-results\"]').hidden = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bcgyauqzsnkqnz\", function (event, $$0) {\n\n this.onclick = async () => {\n const poll = this.closest('[key=\"poll--show\"]');\n const loading = poll.querySelector('[key=\"poll--show--actions--show-votes--loading\"]');\n loading.hidden = false;\n const partial = leafac.stringToElement(await (await fetch($$0, { cache: \"no-store\" })).text());\n for (const partialElement of partial.querySelectorAll('[key^=\"poll--show--option--votes/\"]')) {\n const element = poll.querySelector('[key=\"' + partialElement.getAttribute(\"key\") + '\"]');\n element.onbeforemorph = (event) => !event?.detail?.liveUpdate;\n leafac.morph(element, partialElement);\n leafac.execute({ element });\n element.hidden = false;\n }\n loading.hidden = true;\n poll.querySelector('[key=\"poll--show--actions--show-votes\"]').hidden = true;\n poll.querySelector('[key=\"poll--show--actions--hide-votes\"]').hidden = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"xvelukigjqead\", function (event) {\n\n this.onclick = async () => {\n const poll = this.closest('[key=\"poll--show\"]');\n for (const element of poll.querySelectorAll('[key^=\"poll--show--option--votes/\"]'))\n element.hidden = true;\n poll.querySelector('[key=\"poll--show--actions--show-votes\"]').hidden = false;\n poll.querySelector('[key=\"poll--show--actions--hide-votes\"]').hidden = true;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hbfszpmqhhnbdl\", function (event, $$0) {\n\n this.onclick = async () => {\n const edit = this.closest('[key^=\"poll/\"]').querySelector('[key=\"poll--edit\"]');\n const loading = this.querySelector('[key=\"loading\"]');\n loading.hidden = false;\n edit.onbeforemorph = (event) => !event?.detail?.liveUpdate;\n leafac.morph(edit, await (await fetch($$0, { cache: \"no-store\" })).text());\n loading.hidden = true;\n leafac.execute({ element: edit });\n this.closest('[key^=\"poll/\"]').querySelector('[key=\"poll--show\"]').hidden = true;\n edit.hidden = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gyizffpjgaolrp\", function (event) {\n\n this.onclick = () => {\n this.closest(\"form\").isValid = true;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fqipjrjpuwmofy\", function (event) {\n\n this.onbeforemorph = (event) => !event?.detail?.liveUpdate;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dyseiaggjnxfyf\", function (event) {\n\n this.isModified = false;\n\n this.onclick = () => {\n this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write\"]').hidden = false;\n this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--loading\"]').hidden = true;\n this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--preview\"]').hidden = true; \n this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--toolbar--write\"]').hidden = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"xckzixkklusyc\", function (event, $$0) {\n\n this.isModified = false;\n\n this.onclick = async (event) => {\n const write = this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write\"]');\n const loading = this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--loading\"]');\n const preview = this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--preview\"]');\n const toolbar = this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--toolbar--write\"]');\n const textarea = write.querySelector(\"textarea\");\n const previousTextareaRequired = textarea.required;\n textarea.required = true;\n const isWriteValid = leafac.validate(write);\n textarea.required = previousTextareaRequired;\n if (!isWriteValid) {\n event.preventDefault();\n return;\n }\n tippy.hideAll();\n write.hidden = true;\n loading.hidden = false;\n preview.hidden = true;\n toolbar.hidden = true;\n leafac.loadPartial(\n preview,\n await (\n await fetch($$0, {\n method: \"POST\",\n headers: { \"CSRF-Protection\": \"true\", },\n cache: \"no-store\",\n body: new URLSearchParams({ content: textarea.value, }),\n })\n ).text()\n );\n write.hidden = true;\n loading.hidden = true;\n preview.hidden = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"facmejvuklbwds\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$0, \n },\n });\n\n const textarea = this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n\n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+alt+p\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fohxlxprcbjisq\", function (event) {\n\n this.hidden = leafac.isAppleDevice;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"jvxilfbjtrnkh\", function (event) {\n\n this.hidden = !leafac.isAppleDevice;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fmqrtryuggygem\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Headings\",\n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ehyrhsugzfteej\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"# \", \"HEADING\\n\\n\");\n textarea.selectionEnd += \"HEADING\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"# \", \"\\n\\n\");\n textarea.focus();\n };\n\n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+alt+1\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"xjocgfayroegh\", function (event) {\n\n this.hidden = leafac.isAppleDevice;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ddkrwleebevugi\", function (event) {\n\n this.hidden = !leafac.isAppleDevice;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bjjcfxdduflxg\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"## \", \"HEADING\\n\\n\");\n textarea.selectionEnd += \"HEADING\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"## \", \"\\n\\n\");\n textarea.focus(); \n };\n\n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+alt+2\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gdjxgazekdbpmh\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"### \", \"HEADING\\n\\n\");\n textarea.selectionEnd += \"HEADING\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"### \", \"\\n\\n\");\n textarea.focus(); \n };\n\n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+alt+3\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bxtbuuqadunpxv\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"---\\n\\n\", \"\");\n textarea.focus(); \n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gqdzcnwabjtvnb\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Inline\",\n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dlxrgosvlakxhr\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, \"**\", \"TEXT**\");\n textarea.selectionEnd += \"TEXT\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, \"**\");\n textarea.focus();\n };\n \n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+b\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hkuiirddazqlmj\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, \"_\", \"TEXT_\");\n textarea.selectionEnd += \"TEXT\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, \"_\");\n textarea.focus();\n };\n \n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+i\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gzftlqatvjripx\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, \"\", \"TEXT\");\n textarea.selectionEnd += \"TEXT\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, \"\", \"\");\n textarea.focus();\n };\n \n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+u\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ecylwpybigvfeh\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, \"~~\", \"TEXT~~\");\n textarea.selectionEnd += \"TEXT\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, \"~~\");\n textarea.focus();\n };\n\n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+alt+s\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"certivjsclgdtg\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, \"[\", \"TEXT](https://example.com)\");\n textarea.selectionEnd += \"TEXT\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, \"[\", \"](https://example.com)\");\n textarea.focus();\n };\n \n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+k\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hfaxvboicnoidw\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, \"$\", \"LATEX$\");\n textarea.selectionEnd += \"LATEX\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, \"$\");\n textarea.focus();\n };\n \n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+alt+e\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dvncnpenzpowf\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, \"`\", \"CODE`\");\n textarea.selectionEnd += \"CODE\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, \"`\");\n textarea.focus();\n };\n \n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+e\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"qjlmknpsaogqc\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, \"\", \"TEXT\");\n textarea.selectionEnd += \"TEXT\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, \"\", \"\");\n textarea.focus();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"eyxcfuhrescobd\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, \"~~\", \"TEXT~~\");\n textarea.selectionEnd += \"TEXT\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, \"~~\");\n textarea.focus();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fuikcmtovqceok\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, \"\", \"TEXT\");\n textarea.selectionEnd += \"TEXT\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, \"\", \"\");\n textarea.focus();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dssbjrxnhowxwx\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, \"\", \"TEXT\");\n textarea.selectionEnd += \"TEXT\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, \"\", \"\");\n textarea.focus();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bjaeonjhgpfzzn\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$0, \n },\n });\n\n this.onclick = () => {\n this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--attachments\"]').click();\n };\n\n const textarea = this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n\n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+shift+k\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"byzjlrqfbuvezb\", function (event) {\n\n this.hidden = leafac.isAppleDevice;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bgsfrsrdlmeekc\", function (event) {\n\n this.hidden = !leafac.isAppleDevice;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cclanjnavopzlb\", function (event, $$0, $$1, $$2) {\n\n this.isModified = false;\n\n const textarea = this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n\n this.upload = async (fileList) => {\n if (!checkIsSignedIn()) return;\n const body = new FormData();\n for (const file of fileList) body.append(\"attachments\", file);\n this.value = \"\";\n tippy.hideAll();\n textarea.uploadingIndicator.show();\n textarea.disabled = true;\n const response = await (await fetch($$0, {\n method: \"POST\",\n headers: { \"CSRF-Protection\": \"true\", },\n cache: \"no-store\",\n body,\n })).text();\n textarea.disabled = false;\n textarea.uploadingIndicator.hide();\n textFieldEdit.wrapSelection(textarea, response, \"\");\n textarea.focus();\n };\n\n const checkIsSignedIn = (() => {\n if ($$1) {\n leafac.setTippy({\n event,\n element: textarea,\n tippyProps: {\n trigger: \"manual\",\n theme: \"rose\",\n content: \"You must sign in to upload files.\",\n },\n });\n\n return () => {\n textarea.tooltip.show();\n return false;\n };\n } else\n return () => true;\n })();\n\n leafac.setTippy({\n event,\n element: textarea,\n elementProperty: \"uploadingIndicator\",\n tippyProps: {\n trigger: \"manual\",\n hideOnClick: false,\n content: $$2, \n },\n });\n\n this.onclick = (event) => {\n if (!checkIsSignedIn()) event.preventDefault();\n };\n\n this.onchange = () => {\n this.upload(this.files);\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"eivbwvgxsowybz\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Block\",\n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hljynlpodxtuj\", function (event, $$0) {\n\n this.onclick = () => {\n tippy.hideAll();\n const write = this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write\"]');\n if (write.querySelector('[key=\"poll-editor\"]') !== null) return;\n const poll = leafac.stringToElement($$0).querySelector('[key=\"poll-editor\"]');\n write.insertAdjacentElement(\"afterbegin\", poll);\n leafac.execute({ element: poll });\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dmzxespaoycteh\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"- \", \"TEXT\\n\\n\");\n textarea.selectionEnd += \"TEXT\".length;\n } else {\n const replacement = textFieldEdit.getSelection(textarea).split(\"\\n\").map((line) => \"- \" + line).join(\"\\n\");\n const selectionStart = textarea.selectionStart + ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\").length;\n textFieldEdit.insert(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + replacement + \"\\n\\n\");\n textarea.selectionStart = selectionStart;\n textarea.selectionEnd = textarea.selectionStart + replacement.length;\n }\n textarea.focus();\n };\n\n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+shift+8\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ekhgzyigxjdmj\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"1. \", \"TEXT\\n\\n\");\n textarea.selectionEnd += \"TEXT\".length;\n } else {\n const replacement = textFieldEdit.getSelection(textarea).split(\"\\n\").map((line, index) => String(index + 1) + \". \" + line).join(\"\\n\");\n const selectionStart = textarea.selectionStart + ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\").length;\n textFieldEdit.insert(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + replacement + \"\\n\\n\");\n textarea.selectionStart = selectionStart;\n textarea.selectionEnd = textarea.selectionStart + replacement.length;\n }\n textarea.focus();\n };\n\n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+shift+7\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"yhpblaoamkiem\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"- [ ] \", \"TEXT (USE [X] TO MARK ITEM AS DONE)\\n\\n\");\n textarea.selectionEnd += \"TEXT (USE [X] TO MARK ITEM AS DONE)\".length;\n } else {\n const replacement = textFieldEdit.getSelection(textarea).split(\"\\n\").map((line) => \"- [ ] \" + line).join(\"\\n\");\n const selectionStart = textarea.selectionStart + ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\").length;\n textFieldEdit.insert(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + replacement + \"\\n\\n\");\n textarea.selectionStart = selectionStart;\n textarea.selectionEnd = textarea.selectionStart + replacement.length;\n }\n textarea.focus();\n };\n\n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+shift+9\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gfstjluttsgqjn\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"> \", \"TEXT\\n\\n\");\n textarea.selectionEnd += \"TEXT\".length;\n } else {\n const replacement = textFieldEdit.getSelection(textarea).split(\"\\n\").map((line) => \"> \" + line).join(\"\\n\");\n const selectionStart = textarea.selectionStart + ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\").length;\n textFieldEdit.insert(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + replacement + \"\\n\\n\");\n textarea.selectionStart = selectionStart;\n textarea.selectionEnd = textarea.selectionStart + replacement.length;\n }\n textarea.focus();\n };\n\n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+'\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"glqbesfgukvuni\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n const selectionStart = textarea.selectionStart + (textFieldEdit.getSelection(textarea) + ((textarea.selectionEnd > 0) ? \"\\n\\n\" : \"\") + \"| \").length;\n textFieldEdit.insert(textarea, textFieldEdit.getSelection(textarea) + ((textarea.selectionEnd > 0) ? \"\\n\\n\" : \"\") + \"| HEADING | HEADING |\\n|---------|---------|\\n| CONTENT | CONTENT |\\n\\n\");\n textarea.selectionStart = selectionStart;\n textarea.selectionEnd = textarea.selectionStart + \"HEADING\".length;\n textarea.focus();\n };\n \n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+alt+t\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bynzrnmsgneqtt\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"
\\n\", \"SUMMARY\\n\\nCONTENT\\n\\n
\\n\\n\");\n textarea.selectionEnd += \"SUMMARY\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"
\\nSUMMARY\\n\\n\", \"\\n\\n
\\n\\n\");\n textarea.focus();\n };\n \n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+shift+d\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gtqhysznbofwwg\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n const identifier = Math.random().toString(36).slice(2);\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, \"[^footnote--\" + identifier + \"]\\n\\n[^footnote--\" + identifier + \"]: \", \"FOOTNOTE\");\n textarea.selectionEnd += \"FOOTNOTE\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, \"[^footnote--\" + identifier + \"]\\n\\n[^footnote--\" + identifier + \"]: \", \"\");\n textarea.focus();\n };\n \n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+shift+f\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"yunfshwguayeg\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"$$\\n\", \"LATEX\\n$$\\n\\n\");\n textarea.selectionEnd += \"LATEX\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"$$\\n\", \"\\n$$\\n\\n\");\n textarea.focus();\n };\n \n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+alt+shift+e\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dffmlznzmizqby\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n if (textarea.selectionStart === textarea.selectionEnd) {\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"```\", \"LANGUAGE\\nCODE\\n```\\n\\n\");\n textarea.selectionEnd += \"LANGUAGE\".length;\n }\n else\n textFieldEdit.wrapSelection(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"```LANGUAGE\\n\", \"\\n```\\n\\n\");\n textarea.focus();\n };\n \n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+shift+e\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bvfcojuanyzxdq\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Mentions & References\",\n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cmamorcwetbgqw\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n textFieldEdit.wrapSelection(textarea, \" @\", \"\");\n textarea.focus();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bupywzticrrorp\", function (event) {\n\n const textarea = this.closest(\"[data-tippy-root]\")._tippy.reference.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n textFieldEdit.wrapSelection(textarea, \" #\", \"\");\n textarea.focus();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"eqydkqzyotnzqv\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$0,\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"psiflgocnvuva\", function (event, $$0) {\n\n this.isModified = false;\n \n const textarea = this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n \n this.onchange = async () => {\n textarea.classList[this.checked ? \"add\" : \"remove\"](\"content-editor--write--textarea--programmer-mode\");\n await fetch($$0, {\n method: \"PATCH\",\n headers: { \"CSRF-Protection\": \"true\", },\n cache: \"no-store\",\n body: new URLSearchParams({ preferContentEditorProgrammerMode: String(this.checked), }),\n });\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"btffumqyrqvhro\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Help\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"csmmcoppnakcqh\", function (event, $$0, $$1, $$2, $$3, $$4, $$5, $$6, $$7, $$8) {\n\n if ($$0) this.isModified = false;\n\n autosize(this);\n autosize.update(this);\n \n this.ondragenter = (event) => {\n if (!event.dataTransfer.types.includes(\"Files\")) return;\n event.preventDefault();\n this.classList.add(\"drag\");\n };\n this.ondragleave = (event) => {\n if (!event.dataTransfer.types.includes(\"Files\")) return;\n event.preventDefault();\n this.classList.remove(\"drag\");\n };\n this.ondragover = (event) => {\n if (!event.dataTransfer.types.includes(\"Files\")) return;\n event.preventDefault();\n };\n this.ondrop = (event) => {\n if (!event.dataTransfer.types.includes(\"Files\")) return;\n event.preventDefault();\n this.classList.remove(\"drag\");\n const fileList = [...event.dataTransfer.items].flatMap((item) => item.webkitGetAsEntry()?.isFile ?? true ? [item.getAsFile()] : []);\n if (fileList.length > 0)\n this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--attachments\"]').upload(fileList);\n };\n \n this.onpaste = (event) => {\n window.setTimeout(() => {\n this.closest('[key=\"content-editor\"]').scrollIntoView();\n });\n\n this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--rich-text-help\"]').hidden = true;\n\n if (leafac.shiftKey) return;\n\n if (event.clipboardData.types.includes(\"text/html\")) {\n if (!leafac.isPhysicalKeyboard) return;\n\n event.preventDefault();\n\n const placeholder = \"\u25CA\u25CA\" + Math.random().toString(36).slice(2) + \"\u25CA\u25CA\";\n const replacements = [];\n\n const html = leafac.stringToElement(event.clipboardData.getData(\"text/html\"));\n\n for (const element of html.querySelectorAll(\".katex, .katex-display\")) {\n const annotation = element.querySelector('annotation[encoding=\"application/x-tex\"]');\n if (annotation === null) continue;\n replacements.push(\n (element.matches(\".katex-display\") ? \"\\n\\n$$\\n\" : \"$\") +\n annotation.textContent +\n (element.matches(\".katex-display\") ? \"\\n$$\\n\\n\" : \"$\")\n );\n element.outerHTML = \"\" + placeholder + \"\";\n }\n\n textFieldEdit.insert(\n this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]'),\n unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeRemark)\n .use(remarkGfm, { singleTilde: false })\n .use(remarkStringify)\n .processSync(html.innerHTML)\n .toString()\n .replaceAll(placeholder, () => replacements.shift())\n );\n\n const richTextHelp = this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--rich-text-help\"]');\n richTextHelp.hidden = false;\n window.clearTimeout(richTextHelp.hideTimeout);\n richTextHelp.hideTimeout = window.setTimeout(() => {\n richTextHelp.hidden = true;\n }, 10 * 1000);\n } else if (event.clipboardData.types.includes(\"Files\")) {\n event.preventDefault();\n const fileList = [...event.clipboardData.items].flatMap((item) => item.webkitGetAsEntry()?.isFile ?? true ? [item.getAsFile()] : []);\n if (fileList.length > 0)\n this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--attachments\"]').upload(fileList);\n }\n };\n \n if ($$1) {\n const dropdownMenuTarget = this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea--dropdown-menu-target\"]');\n \n const dropdownMenus = [\n {\n trigger: \"@\",\n route: $$2,\n dropdownMenu: leafac.setTippy({\n event,\n element: dropdownMenuTarget,\n elementProperty: \"dropdownMenuMention\",\n tippyProps: {\n placement: \"bottom-start\",\n trigger: \"manual\",\n interactive: true,\n onHidden: (dropdown) => {\n leafac.loadPartial(\n dropdown.props.content.querySelector('[key=\"search-results\"]'),\n $$3\n );\n },\n content: $$4, \n },\n }),\n },\n {\n trigger: \"#\",\n route: $$5,\n dropdownMenu: leafac.setTippy({\n event,\n element: dropdownMenuTarget,\n elementProperty: \"dropdownMenuReference\",\n tippyProps: {\n placement: \"bottom-start\",\n trigger: \"manual\",\n interactive: true,\n onHidden: (dropdown) => {\n leafac.loadPartial(\n dropdown.props.content.querySelector('[key=\"search-results\"]'),\n $$6\n );\n },\n content: $$7, \n },\n }),\n },\n ];\n \n this.isUpdating ??= false;\n this.shouldUpdateAgain ??= false;\n this.oninput = async () => {\n for (const { trigger, route, dropdownMenu } of dropdownMenus) {\n if (!dropdownMenu.state.isShown) {\n if (\n (this.selectionStart > 1 && this.value[this.selectionStart - 2].match(/^\\s$/) === null) ||\n this.value[this.selectionStart - 1] !== trigger\n ) continue;\n this.anchorIndex = this.selectionStart;\n const caretCoordinates = textareaCaret(this, this.selectionStart);\n dropdownMenuTarget.style.top = String(caretCoordinates.top - this.scrollTop) + \"px\";\n dropdownMenuTarget.style.left = String(caretCoordinates.left - 14) + \"px\";\n tippy.hideAll();\n dropdownMenu.show();\n }\n const search = this.value.slice(this.anchorIndex, this.selectionStart);\n if (this.selectionStart < this.anchorIndex || search.match(/[^a-z0-9\\/]/i) !== null) {\n dropdownMenu.hide();\n continue;\n }\n if (this.isUpdating) {\n this.shouldUpdateAgain = true;\n continue;\n }\n this.isUpdating = true;\n this.shouldUpdateAgain = false;\n const content = dropdownMenu.props.content;\n leafac.loadPartial(\n content.querySelector('[key=\"search-results\"]'),\n await (await fetch(route + \"?\" + new URLSearchParams({ search }), { cache: \"no-store\" })).text()\n );\n const buttons = content.querySelectorAll(\".button\");\n for (const button of buttons) button.classList.remove(\"hover\");\n if (buttons.length > 0) buttons[0].classList.add(\"hover\");\n this.isUpdating = false;\n if (this.shouldUpdateAgain) this.oninput();\n }\n };\n \n this.onkeydown = (event) => {\n for (const { dropdownMenu } of dropdownMenus) {\n if (!dropdownMenu.state.isShown) continue;\n const content = dropdownMenu.props.content;\n switch (event.code) {\n case \"ArrowUp\":\n case \"ArrowDown\":\n event.preventDefault();\n const buttons = [...content.querySelectorAll(\".button\")];\n if (buttons.length === 0) continue; \n const currentHoverIndex = buttons.indexOf(content.querySelector(\".button.hover\"));\n if (\n currentHoverIndex === -1 ||\n (event.code === \"ArrowUp\" && currentHoverIndex === 0) ||\n (event.code === \"ArrowDown\" && currentHoverIndex === buttons.length - 1)\n ) continue;\n buttons[currentHoverIndex].classList.remove(\"hover\");\n const buttonToHover = buttons[currentHoverIndex + (event.code === \"ArrowUp\" ? -1 : 1)];\n buttonToHover.classList.add(\"hover\");\n scrollIntoViewIfNeeded(buttonToHover, { scrollMode: \"if-needed\" });\n break;\n case \"Enter\":\n case \"Tab\":\n event.preventDefault();\n const buttonHover = content.querySelector(\".button.hover\");\n if (buttonHover === null) dropdownMenu.hide();\n else {\n event.preventDefault();\n buttonHover.click();\n }\n break;\n case \"Escape\":\n case \"ArrowLeft\":\n case \"ArrowRight\":\n case \"Home\":\n case \"End\":\n dropdownMenu.hide();\n break;\n }\n }\n };\n \n this.dropdownMenuComplete = (text) => {\n tippy.hideAll();\n this.setSelectionRange(this.anchorIndex, this.selectionStart);\n textFieldEdit.insert(this, text);\n this.focus();\n };\n\n this.onclick = this.onkeyup = () => {\n if (this.closest('[key=\"content-editor\"]').querySelector('[key=\"poll-editor\"]') !== null) return;\n \n for (const match of this.value.matchAll(/\\d+)\"><\\/courselore-poll>/g))\n if (match.index <= this.selectionStart && this.selectionStart <= match.index + match[0].length) {\n const caretCoordinates = textareaCaret(this, this.selectionStart);\n dropdownMenuTarget.style.top = String(caretCoordinates.top - this.scrollTop) + \"px\";\n dropdownMenuTarget.style.left = String(caretCoordinates.left) + \"px\";\n\n (window.locals ??= {}).editPollReference = match.groups.pollReference;\n\n leafac.setTippy({\n element: dropdownMenuTarget,\n elementProperty: \"dropdownPollEdit\",\n tippyProps: {\n trigger: \"manual\",\n interactive: true,\n content: $$8, \n },\n });\n\n tippy.hideAll();\n dropdownMenuTarget.dropdownPollEdit.show();\n\n return;\n }\n\n dropdownMenuTarget.dropdownPollEdit?.hide?.();\n };\n }\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"xjigshzovofoo\", function (event, $$0, $$1) {\n\n this.onclick = async () => {\n const loading = this.querySelector('[key=\"loading\"]');\n loading.hidden = false;\n const response = await fetch($$0 + window.locals.editPollReference + $$1, { cache: \"no-store\" });\n loading.hidden = true;\n if (!response.ok) {\n leafac.setTippy({\n element: this,\n elementProperty: \"errorTooltip\",\n tippyProps: {\n theme: \"rose\",\n trigger: \"manual\",\n content: await response.text(),\n },\n });\n this.errorTooltip.show();\n return;\n }\n const poll = leafac.stringToElement(await response.text()).querySelector('[key=\"poll-editor\"]');\n this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write\"]').insertAdjacentElement(\"afterbegin\", poll);\n leafac.execute({ element: poll });\n tippy.hideAll();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"mjctjpydscnjb\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Toolbar\",\n },\n });\n\n this.onclick = async () => {\n const toolbar = this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--toolbar\"]');\n toolbar.hidden = !toolbar.hidden;\n await fetch($$0, {\n method: \"PATCH\",\n headers: { \"CSRF-Protection\": \"true\", },\n cache: \"no-store\",\n body: new URLSearchParams({ preferContentEditorToolbarInCompact: String(!toolbar.hidden), }),\n });\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dhyefjsdptkwkh\", function (event) {\n\n this.hidden = leafac.isAppleDevice;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"egzotlclqisjog\", function (event) {\n\n this.hidden = !leafac.isAppleDevice || leafac.isSafari;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"eayrnwwbutfkok\", function (event) {\n\n this.hidden = !leafac.isAppleDevice || !leafac.isSafari;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gtgpfsftryymxy\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Drag to Reorder\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"chhwjcsqwdodii\", function (event) {\n\n this.isModified = true;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cgfcsrrfdoeyou\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: \"rose\",\n touch: false,\n content: \"Remove Option\",\n },\n });\n\n this.onclick = () => {\n const options = this.closest('[key=\"poll-editor--options\"]');\n this.closest('[key^=\"poll-editor--option/\"]').remove();\n options.reorder();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fmtbsuybrhczbt\", function (event) {\n\n this.onchange = () => {\n const closesAt = this.closest('[key=\"poll-editor\"]').querySelector('[key=\"poll-editor--closes-at\"]');\n closesAt.hidden = !this.checked;\n for (const element of leafac.descendants(closesAt))\n if (element.disabled !== undefined) element.disabled = !this.checked;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"csrfiwxfndjaaq\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Closing\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gbmirgzmzjxjxg\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Not Closing\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gtyropbwqlabsa\", function (event, $$0) {\n\n this.value = this.defaultValue = leafac.localizeDateTime(this.defaultValue);\n\n this.onvalidate = () => {\n const mustBeInTheFuture = $$0 || leafac.isModified(this);\n const error = leafac.validateLocalizedDateTime(this);\n if (typeof error === \"string\") return error;\n if (mustBeInTheFuture && new Date(this.value).getTime() <= Date.now()) return \"Must be in the future.\";\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bbbggmjwqmzrnd\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"This datetime will be converted to UTC, which may lead to surprising off-by-one-hour differences if it crosses a daylight saving time change.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bqyhskdopbxzqb\", function (event) {\n\n this.onbeforemorph = (event) => {\n const liveUpdate = event?.detail?.liveUpdate;\n if (!liveUpdate) this.isModified = false;\n return !liveUpdate;\n };\n\n this.onpointerdown = (event) => {\n if (event.target.closest('[key=\"poll-editor--option--grab--handle\"]') === null) return;\n\n const body = document.querySelector(\"body\");\n const option = event.target.closest('[key^=\"poll-editor--option/\"]');\n\n this.grabbed = option;\n body.classList.add(\"grabbing\");\n option.classList.add(\"grabbed\");\n\n body.addEventListener(\"pointerup\", () => {\n delete this.grabbed;\n body.classList.remove(\"grabbing\");\n option.classList.remove(\"grabbed\");\n }, { once: true });\n };\n\n this.onpointermove = (event) => {\n const option = (\n event.pointerType === \"touch\" ? document.elementFromPoint(event.clientX, event.clientY) : event.target\n ).closest('[key^=\"poll-editor--option/\"]');\n if (option === null || [undefined, option].includes(this.grabbed)) return;\n\n const boundingClientRect = option.getBoundingClientRect();\n option[\n (event.clientY - boundingClientRect.top) / (boundingClientRect.bottom - boundingClientRect.top) < 0.5 ?\n \"after\" : \"before\"\n ](this.grabbed);\n this.reorder();\n };\n\n this.onkeydown = (event) => {\n if (event.target.closest('[key=\"poll-editor--option--grab--handle\"]') === null) return;\n\n const option = event.target.closest('[key^=\"poll-editor--option/\"]');\n switch (event.code) {\n case \"ArrowUp\":\n event.preventDefault();\n option.previousElementSibling?.before?.(option);\n break;\n case \"ArrowDown\":\n event.preventDefault();\n option.nextElementSibling?.after?.(option);\n break;\n }\n option.querySelector('[key=\"poll-editor--option--grab--handle\"]').focus();\n this.reorder();\n };\n\n this.reorder = () => {\n this.isModified = true;\n\n for (const [order, option] of this.querySelectorAll('[key^=\"poll-editor--option/\"]').entries())\n for (const element of option.querySelectorAll('[name^=\"options[\"]'))\n element.setAttribute(\"name\", element.getAttribute(\"name\").replace(/\\d+/, String(order)));\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"exwpsspzzwyyrt\", function (event, $$0, $$1) {\n\n this.onclick = () => {\n const newOption = leafac.stringToElement($$0).querySelector('[key=\"poll-editor--option/new\"]');\n\n const options = this.closest('[key=\"poll-editor\"]').querySelector('[key=\"poll-editor--options\"]');\n options.insertAdjacentElement(\"beforeend\", newOption);\n leafac.execute({ element: newOption });\n options.reorder();\n };\n\n if ($$1 && !event?.detail?.liveUpdate)\n for (const initialOptions of new Array(3))\n this.onclick();\n\n this.onvalidate = () => {\n if (this.closest(\"[hidden]\") === null && this.closest('[key=\"poll-editor\"]').querySelector('[key=\"poll-editor--options\"]').children.length <= 1)\n return \"Please add at least two options.\";\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gbdntyzeftbwir\", function (event, $$0, $$1, $$2, $$3) {\n\n if (this.closest('[key^=\"poll/\"]') !== null) return;\n \n this.setAttribute(\"type\", \"button\");\n\n this.onclick = async () => {\n const pollEditor = this.closest('[key=\"poll-editor\"]');\n const textarea = this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]');\n\n if (!leafac.validate(pollEditor)) return;\n\n const body = leafac.serialize(pollEditor);\n\n leafac.morph(pollEditor.querySelector('[key=\"poll-editor--content\"]'), $$0);\n\n const content = await (await fetch($$1, {\n method: $$2,\n headers: { \"CSRF-Protection\": \"true\", },\n cache: \"no-store\",\n body,\n })).text();\n\n pollEditor.remove();\n\n if ($$3)\n textFieldEdit.insert(textarea, ((textarea.selectionStart > 0) ? \"\\n\\n\" : \"\") + content + \"\\n\\n\");\n textarea.focus();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"heimpcszlmschn\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"The course staff and the poll creator may see individual votes. Students may see aggregate results.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cmehjvrjwpzuhx\", function (event) {\n\n this.onclick = () => {\n this.closest(\"form\").isValid = true;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bnmtlcadhhdzys\", function (event) {\n\n this.onclick = () => {\n const poll = this.closest('[key^=\"poll/\"]');\n if (poll !== null) {\n poll.querySelector('[key=\"poll--show\"]').hidden = false;\n poll.querySelector('[key=\"poll--edit\"]').hidden = true;\n }\n this.closest('[key=\"poll-editor\"]').remove();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dcwlqygbczyvjo\", function (event, $$0) {\n\n this.onclick = () => {\n this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]').dropdownMenuComplete($$0);\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"feceudlgdbmhfy\", function (event, $$0) {\n\n this.onclick = () => {\n this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]').dropdownMenuComplete($$0);\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"drptlmiszhqasm\", function (event, $$0) {\n\n this.onclick = () => {\n this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]').dropdownMenuComplete($$0);\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hwnqazbnrwqmf\", function (event, $$0) {\n\n this.onclick = () => {\n this.closest('[key=\"content-editor\"]').querySelector('[key=\"content-editor--write--textarea\"]').dropdownMenuComplete($$0);\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gfuqkssrfzptiq\", function (event) {\n\n this.isModified = false;\n\n this.onchange = () => {\n const searchAndFilters = this.closest('[key=\"search-and-filters\"]');\n const searchAndFiltersForm = searchAndFilters.querySelector('[key=\"search-and-filters--form\"]');\n const searchAndFiltersFormSection = searchAndFiltersForm.querySelector('[key=\"search\"]');\n searchAndFiltersForm.hidden = [...searchAndFilters.querySelectorAll('[key=\"search-and-filters--show-hide--search\"], [key=\"search-and-filters--show-hide--filters\"]')]\n .every((element) => !element.checked);\n searchAndFiltersFormSection.hidden = !this.checked;\n for (const element of leafac.descendants(searchAndFiltersFormSection))\n if (element.disabled !== undefined) element.disabled = !this.checked;\n if (this.checked)\n searchAndFiltersFormSection.querySelector('[name=\"conversations[search]\"]').focus();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gjstnnbucuabov\", function (event) {\n\n this.isModified = false;\n \n this.onchange = () => {\n const searchAndFilters = this.closest('[key=\"search-and-filters\"]');\n const searchAndFiltersForm = searchAndFilters.querySelector('[key=\"search-and-filters--form\"]');\n const searchAndFiltersFormSection = searchAndFiltersForm.querySelector('[key=\"filters\"]');\n searchAndFiltersForm.hidden = [...searchAndFilters.querySelectorAll('[key=\"search-and-filters--show-hide--search\"], [key=\"search-and-filters--show-hide--filters\"]')]\n .every((element) => !element.checked);\n searchAndFiltersFormSection.hidden = !this.checked;\n for (const element of leafac.descendants(searchAndFiltersFormSection))\n if (element.disabled !== undefined) element.disabled = !this.checked;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"femqpwqrbwiqsx\", function (event) {\n\n this.isModified = false;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dbjapxrflgnmgw\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Search\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ekehlzhvuftapk\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Clear Search\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bjwfokvcuwhfdb\", function (event) {\n\n this.onchange = () => {\n if (this.checked) this.closest(\"form\").querySelector('[name=\"conversations[filters][isUnread]\"][value=\"false\"]').checked = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ebgvhynffhsxak\", function (event) {\n\n this.onchange = () => {\n if (this.checked) this.closest(\"form\").querySelector('[name=\"conversations[filters][isUnread]\"][value=\"true\"]').checked = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dypnwkufmxvvgr\", function (event, $$0, $$1) {\n\n if ($$0)\n this.onchange = () => {\n if (this.checked) return;\n for (const element of this.closest(\"form\").querySelectorAll($$1))\n element.checked = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dbkxmrgdeplayl\", function (event) {\n\n this.onchange = () => {\n if (!this.checked) return;\n const form = this.closest(\"form\");\n form.querySelector('[name=\"conversations[filters][types][]\"][value=\"question\"]').checked = true;\n form.querySelector('[name=\"conversations[filters][isResolved]\"][value=\"true\"]').checked = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gcogcfyviouqyy\", function (event) {\n\n this.onchange = () => {\n if (!this.checked) return;\n const form = this.closest(\"form\");\n form.querySelector('[name=\"conversations[filters][types][]\"][value=\"question\"]').checked = true;\n form.querySelector('[name=\"conversations[filters][isResolved]\"][value=\"false\"]').checked = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ezwwyzqtfydlpl\", function (event) {\n\n this.onchange = () => {\n if (!this.checked) return;\n const form = this.closest(\"form\");\n form.querySelector('[name=\"conversations[filters][types][]\"][value=\"note\"]').checked = true;\n form.querySelector('[name=\"conversations[filters][isAnnouncement]\"][value=\"true\"]').checked = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dfpctuqfdpxduh\", function (event) {\n\n this.onchange = () => {\n if (!this.checked) return;\n const form = this.closest(\"form\");\n form.querySelector('[name=\"conversations[filters][types][]\"][value=\"note\"]').checked = true;\n form.querySelector('[name=\"conversations[filters][isAnnouncement]\"][value=\"false\"]').checked = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"csyvcbcobgwtwk\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"Pinned conversations are listed first.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cjojxhydfjogox\", function (event) {\n\n this.onchange = () => {\n if (this.checked) this.closest(\"form\").querySelector('[name=\"conversations[filters][isPinned]\"][value=\"false\"]').checked = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"efydbcpyknmdkh\", function (event) {\n\n this.onchange = () => {\n if (this.checked) this.closest(\"form\").querySelector('[name=\"conversations[filters][isPinned]\"][value=\"true\"]').checked = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fohuijiatglji\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"Tags help to organize conversations.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fatfqywkvpxcwr\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"This tag is visible by the course staff only.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"izesevbcxewwe\", function (event, $$0, $$1, $$2) {\n\n if ($$0)\n window.setTimeout(() => {\n if (event?.detail?.previousLocation?.href?.startsWith($$1)) return;\n this.querySelector($$2)?.scrollIntoView({ block: \"center\" });\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"zdigolwjbjocd\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Mark as Read\",\n },\n });\n \n this.onclick = async (event) => {\n event.preventDefault();\n event.stopImmediatePropagation();\n await fetch(this.closest(\"a\").getAttribute(\"href\"), { cache: \"no-store\" });\n this.remove();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"lbnenfqudyhoy\", function (event, $$0, $$1, $$2) {\n\n if ($$0) {\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n interactive: true,\n delay: [1000, null],\n touch: [\"hold\", 1000],\n onHidden: () => { this.onmouseleave(); },\n content: $$1, \n },\n });\n\n window.clearTimeout(this.tooltipContentTimeout);\n this.tooltipContentSkipLoading = false;\n \n this.onmouseenter = this.onfocus = async () => {\n window.clearTimeout(this.tooltipContentTimeout);\n if (this.tooltipContentSkipLoading) return;\n this.tooltipContentSkipLoading = true;\n leafac.loadPartial(this.tooltip.props.content.querySelector('[key=\"content\"]'), await (await fetch($$2, { cache: \"no-store\" })).text());\n this.tooltip.props.content.querySelector('[key=\"loading\"]').hidden = true;\n this.tooltip.props.content.querySelector('[key=\"content\"]').hidden = false;\n this.tooltip.setProps({});\n };\n \n this.onmouseleave = this.onblur = () => {\n window.clearTimeout(this.tooltipContentTimeout);\n if (this.matches(\":hover, :focus-within\") || this.tooltip.state.isShown) return;\n this.tooltipContentTimeout = window.setTimeout(() => {\n this.tooltip.props.content.querySelector('[key=\"loading\"]').hidden = false;\n this.tooltip.props.content.querySelector('[key=\"content\"]').hidden = true;\n this.tooltipContentSkipLoading = false;\n }, 60 * 1000);\n };\n }\n else\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Participants\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"wlhbriuldkesm\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Pinned conversations are listed first.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fsvdsfoqcnbztz\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Conversation Reference\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dihgzsisrdwxhm\", function (event) {\n\n leafac.relativizeDateTimeElement(this, { capitalize: true });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fgurcyafrdmtbv\", function (event) {\n\n leafac.relativizeDateTimeElement(this, { preposition: \"on\", target: this.parentElement });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cudhaawkpvdeua\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"This tag is visible by the course staff only.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ghdutqthnbvmyw\", function (event, $$0, $$1, $$2, $$3) {\n\n this.onchange = () => {\n const form = this.closest(\"form\");\n for (const element of [form.querySelector('[name=\"content\"]'), ...form.querySelectorAll('[name=\"tagsReferences[]\"]')])\n element.required = $$0;\n\n if ($$1) {\n const notification = form.querySelector('[key=\"new-conversation--announcement\"]');\n notification.hidden = $$2;\n for (const element of leafac.descendants(notification))\n if (element.disabled !== undefined)\n element.disabled = $$3;\n }\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"celninyzezxjjf\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"Tags help to organize conversations.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ffpqrtvqjdwlpn\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"This tag is visible by the course staff only.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bgtcivswnjfzsb\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gqkbwxncththzy\", function (event, $$0, $$1, $$2, $$3) {\n\n this.isModified = false;\n\n this.onchange = () => { \n this.closest(\"form\").querySelector($$0).checked = true;\n\n const participantsDropdown = this.closest('[key=\"participants--dropdown\"]');\n const selectedParticipants = participantsDropdown.querySelector('[key=\"participants--dropdown--selected-participants\"]');\n\n if ($$1) {\n selectedParticipants.hidden = true;\n\n for (const element of this.closest(\"form\").querySelectorAll('[name=\"selectedParticipantsReferences[]\"]'))\n element.disabled = true;\n } else if ($$2) {\n selectedParticipants.hidden = false;\n selectedParticipants.querySelector('[key=\"participants--dropdown--selected-participants--separator--course-staff\"]').hidden = false;\n selectedParticipants.querySelector('[key=\"participants--dropdown--selected-participants--separator--selected-participants\"]').hidden = true;\n\n for (const element of selectedParticipants.querySelectorAll('[data-course-participant-course-role=\"course-staff\"]'))\n element.hidden = true;\n participantsDropdown.querySelector('[key=\"participants--dropdown--selected-participants--filter\"]')?.oninput();\n\n for (const element of this.closest(\"form\").querySelectorAll('[name=\"selectedParticipantsReferences[]\"]'))\n element.disabled = element.matches('[data-course-participant-course-role=\"course-staff\"]');\n\n (this.closest(\"form\").querySelector('[name=\"isAnnouncement\"]') ?? {}).checked = false;\n (this.closest(\"form\").querySelector('[name=\"isPinned\"]') ?? {}).checked = false;\n } else if ($$3) {\n selectedParticipants.hidden = false;\n selectedParticipants.querySelector('[key=\"participants--dropdown--selected-participants--separator--course-staff\"]').hidden = true;\n selectedParticipants.querySelector('[key=\"participants--dropdown--selected-participants--separator--selected-participants\"]').hidden = false;\n\n for (const element of selectedParticipants.querySelectorAll('[data-course-participant-course-role=\"course-staff\"]'))\n element.hidden = false;\n participantsDropdown.querySelector('[key=\"participants--dropdown--selected-participants--filter\"]')?.oninput();\n\n for (const element of this.closest(\"form\").querySelectorAll('[name=\"selectedParticipantsReferences[]\"]'))\n element.disabled = false;\n\n (this.closest(\"form\").querySelector('[name=\"isAnnouncement\"]') ?? {}).checked = false;\n (this.closest(\"form\").querySelector('[name=\"isPinned\"]') ?? {}).checked = false;\n }\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cnpgqwsdniowcr\", function (event) {\n\n this.isModified = false;\n\n this.oninput = () => {\n const filterPhrases = this.value.split(/[^a-z0-9]+/i).filter((filterPhrase) => filterPhrase.trim() !== \"\");\n const participantsDropdown = this.closest('[key=\"participants--dropdown\"]');\n const participantsIsCourseStaff = participantsDropdown.querySelector('[name=\"participants--dropdown--participants\"][value=\"course-staff\"]').checked;\n for (const selectedParticipant of participantsDropdown.querySelectorAll('[key^=\"participants--dropdown--selected-participant--course-participant-reference--\"]')) {\n if (participantsIsCourseStaff && selectedParticipant.matches('[data-course-participant-course-role=\"course-staff\"]'))\n continue;\n let selectedParticipantHidden = filterPhrases.length > 0;\n for (const filterablePhrasesElement of selectedParticipant.querySelectorAll(\"[data-filterable-phrases]\")) {\n const filterablePhrases = JSON.parse(filterablePhrasesElement.getAttribute(\"data-filterable-phrases\"));\n const filterablePhrasesElementChildren = [];\n for (const filterablePhrase of filterablePhrases) {\n let filterablePhraseElement;\n if (filterPhrases.some(filterPhrase => filterablePhrase.toLowerCase().startsWith(filterPhrase.toLowerCase()))) {\n filterablePhraseElement = document.createElement(\"mark\");\n filterablePhraseElement.classList.add(\"mark\");\n selectedParticipantHidden = false;\n } else\n filterablePhraseElement = document.createElement(\"span\");\n filterablePhraseElement.textContent = filterablePhrase;\n filterablePhrasesElementChildren.push(filterablePhraseElement);\n }\n filterablePhrasesElement.replaceChildren(...filterablePhrasesElementChildren);\n }\n selectedParticipant.hidden = selectedParticipantHidden;\n }\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bdjlkikxwhsgig\", function (event, $$0) {\n\n this.isModified = false;\n\n this.onchange = () => {\n this.closest(\"form\").querySelector($$0).checked = this.checked;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"csfpsjmvtwltcf\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Remove Participant\",\n },\n });\n\n this.onclick = () => {\n this.previousElementSibling.checked = false;\n\n this.closest(\"form\").querySelector('[key=\"participants\"]').dropdown.props.content.querySelector($$0).checked = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dmmcpcdtxzvbte\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"Course participants receive immediate email notifications for announcements.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gdkhdguciyouns\", function (event) {\n\n this.onchange = () => {\n if (this.checked) this.closest(\"form\").querySelector('[name=\"isPinned\"]').checked = true;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dqphxvuvlbggdy\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Announcement\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bezwquphlfwvrv\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Not an Announcement\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bgdpnkafffobub\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"Pinned conversations are listed first.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bmlplysguoriou\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Pin\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dyxtupdzjovczr\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Unpin\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gkkkxmkzokbyjl\", function (event, $$0) {\n\n this.isModified = false;\n\n this.onchange = async () => {\n await fetch($$0, {\n method: \"PATCH\",\n headers: { \"CSRF-Protection\": \"true\", },\n cache: \"no-store\",\n body: new URLSearchParams({ preferAnonymous: String(this.checked), }),\n });\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"mbgrdrjnvyhzc\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Anonymous to Other Students\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"clkkjkhzvesskc\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Signed by You\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"blrqalktahfbyd\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$0,\n },\n });\n\n const textarea = this.closest(\"form\").querySelector('[key=\"content-editor--write--textarea\"]');\n\n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+enter\", () => { this.click(); return false; });\n\n this.onclick = () => {\n delete this.closest(\"form\").isValid;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fdcnrdpmnyodmz\", function (event) {\n\n this.hidden = leafac.isAppleDevice;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gculjmwuflqfas\", function (event) {\n\n this.hidden = !leafac.isAppleDevice;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bhrajnhdpqlhsu\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$0, \n },\n });\n\n const textarea = this.closest(\"form\").querySelector('[key=\"content-editor--write--textarea\"]');\n\n // TODO: Conversation drafts\n // (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+s\", () => { this.click(); return false; });\n\n this.onclick = () => {\n this.closest(\"form\").isValid = true;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gufidtfktralky\", function (event) {\n\n this.onclick = () => {\n this.closest('[key=\"conversation--header\"]').querySelector('[key=\"conversation--header--compact\"]').hidden = true;\n this.closest('[key=\"conversation--header\"]').querySelector('[key=\"conversation--header--full\"]').hidden = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"eotmgskzswxwtw\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Update Conversation Type\",\n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fsueeflaesehm\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Resolved\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dcyihoxarsrsxx\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Unresolved\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"elixpulsaiabsa\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Announcement\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cctaacfkeemisn\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Not an Announcement\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ohhhcicevxfkc\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Pin\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"crilkotalvybij\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Unpin\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fjvumdjhidjvml\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Actions\",\n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ehuowpbyxxtyaj\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"copied\",\n tippyProps: {\n theme: \"green\",\n trigger: \"manual\",\n content: \"Copied\",\n },\n });\n\n this.onclick = async () => {\n await navigator.clipboard.writeText($$0);\n this.copied.show();\n await new Promise((resolve) => { window.setTimeout(resolve, 1000); });\n this.copied.hide();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cdmvdwirjbopbg\", function (event) {\n\n this.onclick = () => {\n this.closest('[key=\"conversation--header--full\"]').querySelector('[key=\"title--show\"]').hidden = true;\n this.closest('[key=\"conversation--header--full\"]').querySelector('[key=\"title--edit\"]').hidden = false;\n tippy.hideAll();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gdwouipkujztyn\", function (event, $$0, $$1) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n onHidden: () => { this.onmouseleave(); },\n content: $$0,\n },\n });\n\n window.clearTimeout(this.tooltipContentTimeout);\n this.tooltipContentSkipLoading = false;\n \n this.onmouseenter = this.onfocus = async () => {\n window.clearTimeout(this.tooltipContentTimeout);\n if (this.tooltipContentSkipLoading) return;\n this.tooltipContentSkipLoading = true;\n leafac.loadPartial(this.tooltip.props.content.querySelector('[key=\"content\"]'), await (await fetch($$1, { cache: \"no-store\" })).text());\n this.tooltip.props.content.querySelector('[key=\"loading\"]').hidden = true;\n this.tooltip.props.content.querySelector('[key=\"content\"]').hidden = false;\n this.tooltip.setProps({});\n };\n \n this.onmouseleave = this.onblur = () => {\n window.clearTimeout(this.tooltipContentTimeout);\n if (this.matches(\":hover, :focus-within\") || this.tooltip.state.isShown) return;\n this.tooltipContentTimeout = window.setTimeout(() => {\n this.tooltip.props.content.querySelector('[key=\"loading\"]').hidden = false;\n this.tooltip.props.content.querySelector('[key=\"content\"]').hidden = true;\n this.tooltipContentSkipLoading = false;\n }, 60 * 1000);\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"tzxegqycqnvz\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n theme: \"rose\",\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"elcfkhevverjyl\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: \"green\",\n touch: false,\n content: \"Update Title\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gqaayuhapxtgey\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: \"rose\",\n touch: false,\n content: \"Cancel\",\n },\n });\n\n this.onclick = () => {\n this.closest('[key=\"conversation--header--full\"]').querySelector('[key=\"title--show\"]').hidden = false;\n this.closest('[key=\"conversation--header--full\"]').querySelector('[key=\"title--edit\"]').hidden = true;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hdkzcdmkfozgkd\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: \"rose\",\n touch: false,\n content: \"You may not remove this tag because a conversation must have at least one tag.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"exfyvjuvrzoex\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n content: \"This tag is visible by the course staff only.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bpuunaikgxofra\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: \"rose\",\n touch: false,\n content: \"Remove Tag\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dygpwbkrjzdogd\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Add Tag\",\n },\n });\n \n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dffcwuzmvlueoi\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"This tag is visible by the course staff only.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hbkzpzuvryurot\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: \"rose\",\n touch: false,\n content: \"You may not remove this tag because a conversation must have at least one tag.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fuctdlnvdrkchb\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"This tag is visible by the course staff only.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"echtropfiiccjm\", function (event) {\n\n this.onbeforemorphattribute = (event, attribute) => [\"hidden\", \"disabled\", \"checked\"].includes(attribute);\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hiylvwniommwqx\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n placement: \"bottom\",\n onHide: () => {\n const form = this.closest(\"form\");\n if (leafac.isModified(form)) form.querySelector('[key=\"submit\"] button').click();\n },\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fjivxrpopnyvdw\", function (event, $$0, $$1, $$2, $$3) {\n\n this.isModified = false;\n\n this.onchange = () => {\n this.closest(\"form\").querySelector($$0).checked = true;\n\n const participantsDropdown = this.closest('[key=\"participants--dropdown\"]');\n const selectedParticipants = participantsDropdown.querySelector('[key=\"participants--dropdown--selected-participants\"]');\n\n if ($$1) {\n selectedParticipants.hidden = true;\n\n for (const element of this.closest(\"form\").querySelectorAll('[name=\"selectedParticipantsReferences[]\"]'))\n element.disabled = true;\n } else if ($$2) {\n selectedParticipants.hidden = false;\n selectedParticipants.querySelector('[key=\"participants--dropdown--selected-participants--separator--course-staff\"]').hidden = false;\n selectedParticipants.querySelector('[key=\"participants--dropdown--selected-participants--separator--selected-participants\"]').hidden = true;\n\n for (const element of selectedParticipants.querySelectorAll('[data-course-participant-course-role=\"course-staff\"]'))\n element.hidden = true;\n participantsDropdown.querySelector('[key=\"participants--dropdown--selected-participants--filter\"]')?.oninput();\n\n for (const element of this.closest(\"form\").querySelectorAll('[name=\"selectedParticipantsReferences[]\"]'))\n element.disabled = element.matches('[data-course-participant-course-role=\"course-staff\"]');\n } else if ($$3) {\n selectedParticipants.hidden = false;\n selectedParticipants.querySelector('[key=\"participants--dropdown--selected-participants--separator--course-staff\"]').hidden = true;\n selectedParticipants.querySelector('[key=\"participants--dropdown--selected-participants--separator--selected-participants\"]').hidden = false;\n\n for (const element of selectedParticipants.querySelectorAll('[data-course-participant-course-role=\"course-staff\"]'))\n element.hidden = false;\n participantsDropdown.querySelector('[key=\"participants--dropdown--selected-participants--filter\"]')?.oninput();\n\n for (const element of this.closest(\"form\").querySelectorAll('[name=\"selectedParticipantsReferences[]\"]'))\n element.disabled = false;\n }\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"clrjdoxhcuifne\", function (event) {\n\n this.isModified = false;\n\n this.oninput = () => {\n const filterPhrases = this.value.split(/[^a-z0-9]+/i).filter((filterPhrase) => filterPhrase.trim() !== \"\");\n const participantsDropdown = this.closest('[key=\"participants--dropdown\"]');\n const participantsIsCourseStaff = participantsDropdown.querySelector('[name=\"participants--dropdown--participants\"][value=\"course-staff\"]').checked;\n for (const selectedParticipant of participantsDropdown.querySelectorAll('[key^=\"participants--dropdown--selected-participant--course-participant-reference--\"]')) {\n if (participantsIsCourseStaff && selectedParticipant.matches('[data-course-participant-course-role=\"course-staff\"]'))\n continue;\n let selectedParticipantHidden = filterPhrases.length > 0;\n for (const filterablePhrasesElement of selectedParticipant.querySelectorAll(\"[data-filterable-phrases]\")) {\n const filterablePhrases = JSON.parse(filterablePhrasesElement.getAttribute(\"data-filterable-phrases\"));\n const filterablePhrasesElementChildren = [];\n for (const filterablePhrase of filterablePhrases) {\n let filterablePhraseElement;\n if (filterPhrases.some(filterPhrase => filterablePhrase.toLowerCase().startsWith(filterPhrase.toLowerCase()))) {\n filterablePhraseElement = document.createElement(\"mark\");\n filterablePhraseElement.classList.add(\"mark\");\n selectedParticipantHidden = false;\n } else\n filterablePhraseElement = document.createElement(\"span\");\n filterablePhraseElement.textContent = filterablePhrase;\n filterablePhrasesElementChildren.push(filterablePhraseElement);\n }\n filterablePhrasesElement.replaceChildren(...filterablePhrasesElementChildren);\n }\n selectedParticipant.hidden = selectedParticipantHidden;\n }\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dkjzwzdslnohsu\", function (event, $$0) {\n\n this.isModified = false;\n\n this.onchange = () => {\n this.closest(\"form\").querySelector($$0).checked = this.checked;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"darqtrhgrudpsz\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Remove Participant\",\n },\n });\n\n this.onclick = () => {\n this.previousElementSibling.checked = false;\n\n this.closest(\"form\").querySelector('[key=\"participants\"]').dropdown.props.content.querySelector($$0).checked = false;\n\n this.closest(\"form\").querySelector('[key=\"submit\"]').hidden = !leafac.isModified(this.closest(\"form\"));\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gnbbkdjkudhywz\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Participants\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fsldwxklnudxap\", function (event) {\n\n this.onclick = () => {\n this.closest('[key=\"conversation--header\"]').querySelector('[key=\"conversation--header--full\"]').hidden = true;\n this.closest('[key=\"conversation--header\"]').querySelector('[key=\"conversation--header--compact\"]').hidden = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"xskpniwpsnmkp\", function (event, $$0, $$1, $$2, $$3, $$4, $$5, $$6) {\n\n const scroll = () => {\n if (\n [undefined, \"GET\", \"HEAD\", \"OPTIONS\", \"TRACE\"].includes(event?.detail?.request?.method) &&\n !event?.detail?.liveUpdate\n ) {\n if ($$0) {\n const element = this.querySelector($$1);\n if (element === null) return;\n element.scrollIntoView();\n const messageHighlight = element.querySelector('[key=\"message--highlight\"]');\n messageHighlight.style.animation = \"message--highlight 2s var(--transition-timing-function--in-out)\";\n messageHighlight.onanimationend = () => {\n messageHighlight.style.animation = \"\";\n };\n } else if ($$2) {\n this.querySelector($$3)?.scrollIntoView();\n } else if ($$4) {\n this.scroll(0, this.scrollHeight);\n }\n }\n else if ($$5 && this.shouldScrollConversationToBottom) {\n this.scroll(0, this.scrollHeight);\n }\n\n if ($$6) {\n this.onscroll = () => {\n this.shouldScrollConversationToBottom = this.scrollTop === this.scrollHeight - this.offsetHeight;\n };\n this.onscroll();\n }\n };\n window.addEventListener(\"livenavigateself\", scroll);\n window.addEventListener(\"livenavigate\", () => {\n window.removeEventListener(\"livenavigateself\", scroll);\n }, { once: true });\n window.setTimeout(scroll);\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"czcbwistobdtos\", function (event) {\n\n if (this !== document.querySelector('[key=\"message--new-separator\"]')) {\n this.remove();\n return;\n }\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Close\",\n },\n });\n \n this.onclick = () => {\n this.remove();\n };\n\n this.onbeforeremove = () => false;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"frmteacjzaqvni\", function (event) {\n\n const element = this;\n leafac.relativizeDateElement(element);\n\n window.clearTimeout(element.updateTimeout);\n (function update() {\n if (!leafac.isConnected(element)) return;\n const dateSeparators = [...document.querySelectorAll('[key=\"message--date-separator\"]')];\n const thisDateSeparator = element.closest('[key=\"message--date-separator\"]');\n const thisDateSeparatorIndex = dateSeparators.indexOf(thisDateSeparator);\n const previousDateSeparator = thisDateSeparatorIndex <= 0 ? undefined : dateSeparators[thisDateSeparatorIndex - 1];\n thisDateSeparator.hidden = previousDateSeparator !== undefined && previousDateSeparator.textContent === thisDateSeparator.textContent;\n element.updateTimeout = window.setTimeout(update, 60 * 1000 + Math.random() * 10 * 1000);\n })();\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"eszvxpzwupllrg\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Course staff whispers are messages visible to the course staff only.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bzwgtvkaxztoma\", function (event, $$0, $$1) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Actions\",\n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n onHidden: () => { this.onmouseleave(); },\n content: $$0,\n },\n });\n\n window.clearTimeout(this.dropdownContentTimeout);\n this.dropdownContentSkipLoading = false;\n\n this.onmouseenter = this.onfocus = async () => {\n window.clearTimeout(this.dropdownContentTimeout);\n if (this.dropdownContentSkipLoading) return;\n this.dropdownContentSkipLoading = true;\n leafac.loadPartial(this.dropdown.props.content.querySelector('[key=\"content\"]'), await (await fetch($$1, { cache: \"no-store\" })).text());\n this.dropdown.props.content.querySelector('[key=\"loading\"]').hidden = true;\n this.dropdown.props.content.querySelector('[key=\"content\"]').hidden = false;\n this.dropdown.setProps({});\n };\n\n this.onmouseleave = this.onblur = () => {\n window.clearTimeout(this.dropdownContentTimeout);\n if (this.matches(\":hover, :focus-within\") || this.dropdown.state.isShown) return;\n this.dropdownContentTimeout = window.setTimeout(() => {\n this.dropdown.props.content.querySelector('[key=\"loading\"]').hidden = false;\n this.dropdown.props.content.querySelector('[key=\"content\"]').hidden = true;\n this.dropdownContentSkipLoading = false;\n }, 60 * 1000);\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bkdbdazhicpcsb\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Update Message Type\",\n },\n });\n \n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ckpobpoksopivk\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dezswwocyeklua\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"chmgfdlhraeqpm\", function (event, $$0, $$1) {\n\n if ($$0)\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n content: $$1, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"xdhxtmugtkgre\", function (event) {\n\n leafac.relativizeDateTimeElement(this, { capitalize: true });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"byalurfuuolqnr\", function (event) {\n\n leafac.relativizeDateTimeElement(this, { preposition: \"on\", target: this.parentElement });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gytkemwcxjyjds\", function (event, $$0) {\n\n const dropdownMenuTarget = this.closest('[key=\"message--show--content-area\"]').querySelector('[key=\"message--show--content-area--dropdown-menu-target\"]');\n leafac.setTippy({\n event,\n element: dropdownMenuTarget,\n elementProperty: \"dropdownMenu\",\n tippyProps: {\n trigger: \"manual\",\n interactive: true,\n content: $$0, \n },\n });\n \n this.onmouseup = (event) => {\n window.setTimeout(() => {\n const selection = window.getSelection();\n const anchorElement = leafac.ancestors(selection.anchorNode).reverse().find(element => typeof element?.getAttribute?.(\"data-position\") === \"string\");\n const focusElement = leafac.ancestors(selection.focusNode).reverse().find(element => typeof element?.getAttribute?.(\"data-position\") === \"string\");\n if (\n selection.isCollapsed ||\n anchorElement === undefined ||\n focusElement === undefined ||\n !this.contains(anchorElement) ||\n !this.contains(focusElement) ||\n anchorElement.closest('[key^=\"poll/\"]') !== null ||\n focusElement.closest('[key^=\"poll/\"]') !== null\n ) return;\n dropdownMenuTarget.style.top = String(event.layerY) + \"px\";\n dropdownMenuTarget.style.left = String(event.layerX) + \"px\";\n dropdownMenuTarget.dropdownMenu.show();\n });\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"blfzccfbnuobzo\", function (event, $$0, $$1, $$2) {\n\n this.onclick = () => {\n tippy.hideAll();\n const selection = window.getSelection();\n const anchorElement = leafac.ancestors(selection.anchorNode).reverse().find(element => typeof element?.getAttribute?.(\"data-position\") === \"string\");\n const focusElement = leafac.ancestors(selection.focusNode).reverse().find(element => typeof element?.getAttribute?.(\"data-position\") === \"string\");\n const contentElement = this.closest('[key=\"message--show--content-area\"]').querySelector('[key=\"message--show--content-area--content\"]');\n if (\n selection.isCollapsed ||\n anchorElement === undefined ||\n focusElement === undefined ||\n !contentElement.contains(anchorElement) ||\n !contentElement.contains(focusElement)\n ) return;\n const anchorPosition = JSON.parse(anchorElement.getAttribute(\"data-position\"));\n const focusPosition = JSON.parse(focusElement.getAttribute(\"data-position\"));\n const start = Math.min(anchorPosition.start.offset, focusPosition.start.offset);\n const end = Math.max(anchorPosition.end.offset, focusPosition.end.offset);\n const content = anchorElement.closest(\"[data-content-source]\").getAttribute(\"data-content-source\");\n const newMessage = document.querySelector('[key=\"new-message\"]');\n newMessage.querySelector('[key=\"content-editor--button--write\"]')?.click();\n const element = newMessage.querySelector('[key=\"content-editor--write--textarea\"]');\n textFieldEdit.wrapSelection(\n element,\n ((element.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"> \" + $$0 + \"#\" + $$1 + \"/\" + $$2 + \"\\n>\\n> \" + content.slice(start, end).replaceAll(\"\\n\", \"\\n> \") + \"\\n\\n\",\n \"\"\n );\n element.focus();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dkymqafsognewl\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$0,\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"daopmduulsdciv\", function (event, $$0, $$1) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"See course participants who liked\",\n },\n });\n \n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n onHidden: () => { this.onmouseleave(); },\n content: $$0,\n },\n });\n\n window.clearTimeout(this.dropdownContentTimeout);\n this.dropdownContentSkipLoading = false;\n \n this.onmouseenter = this.onfocus = async () => {\n window.clearTimeout(this.dropdownContentTimeout);\n if (this.dropdownContentSkipLoading) return;\n this.dropdownContentSkipLoading = true;\n leafac.loadPartial(this.dropdown.props.content.querySelector('[key=\"content\"]'), await (await fetch($$1, { cache: \"no-store\" })).text());\n this.dropdown.props.content.querySelector('[key=\"loading\"]').hidden = true;\n this.dropdown.props.content.querySelector('[key=\"content\"]').hidden = false;\n this.dropdown.setProps({});\n };\n \n this.onmouseleave = this.onblur = () => {\n window.clearTimeout(this.dropdownContentTimeout);\n if (this.matches(\":hover, :focus-within\") || this.dropdown.state.isShown) return;\n this.dropdownContentTimeout = window.setTimeout(() => {\n this.dropdown.props.content.querySelector('[key=\"loading\"]').hidden = false;\n this.dropdown.props.content.querySelector('[key=\"content\"]').hidden = true;\n this.dropdownContentSkipLoading = false;\n }, 60 * 1000);\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hbccbravsahvos\", function (event, $$0, $$1) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n onHidden: () => { this.onmouseleave(); },\n content: $$0,\n },\n });\n\n window.clearTimeout(this.tooltipContentTimeout);\n this.tooltipContentSkipLoading = false;\n \n this.onmouseenter = this.onfocus = async () => {\n window.clearTimeout(this.tooltipContentTimeout);\n if (this.tooltipContentSkipLoading) return;\n this.tooltipContentSkipLoading = true;\n leafac.loadPartial(this.tooltip.props.content.querySelector('[key=\"content\"]'), await (await fetch($$1, { cache: \"no-store\" })).text());\n this.tooltip.props.content.querySelector('[key=\"loading\"]').hidden = true;\n this.tooltip.props.content.querySelector('[key=\"content\"]').hidden = false;\n this.tooltip.setProps({});\n };\n \n this.onmouseleave = this.onblur = () => {\n window.clearTimeout(this.tooltipContentTimeout);\n if (this.matches(\":hover, :focus-within\") || this.tooltip.state.isShown) return;\n this.tooltipContentTimeout = window.setTimeout(() => {\n this.tooltip.props.content.querySelector('[key=\"loading\"]').hidden = false;\n this.tooltip.props.content.querySelector('[key=\"content\"]').hidden = true;\n this.tooltipContentSkipLoading = false;\n }, 60 * 1000);\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bmiajbegnaaquq\", function (event) {\n\n if (event?.detail?.liveUpdate && !this.closest('[key=\"message--edit\"]').hidden) return;\n this.partialParentElement = false;\n this.skipLoading = false;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"blczqoohbxwpxi\", function (event, $$0, $$1) {\n\n this.isModified = false;\n\n this.isUpdating ??= false;\n this.shouldUpdateAgain ??= false;\n this.oninput = async () => {\n if (this.isUpdating) {\n this.shouldUpdateAgain = true;\n return;\n }\n this.isUpdating = true;\n this.shouldUpdateAgain = false;\n await fetch($$0, {\n method: \"POST\",\n headers: { \"CSRF-Protection\": \"true\", },\n cache: \"no-store\",\n body: new URLSearchParams(new FormData(this)),\n });\n this.isUpdating = false;\n if (this.shouldUpdateAgain) this.oninput();\n };\n\n this.onsubmit = () => {\n window.setTimeout(() => {\n const placeholder = document.querySelector('[key=\"message--new-message--placeholder\"]');\n const content = this.querySelector('[name=\"content\"]');\n if ($$1)\n placeholder.querySelector('[key=\"message--new-message--placeholder--anonymous--' + (!this.querySelector('[name=\"isAnonymous\"]').checked).toString() + '\"]').hidden = true;\n placeholder.querySelector('[key=\"message--new-message--placeholder--content\"]').textContent = content.value;\n placeholder.hidden = false;\n for (const element of leafac.ancestors(placeholder))\n element.scroll(0, element.scrollHeight);\n textFieldEdit.set(content, \"\");\n });\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dodkxkdaoscsqa\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$0,\n },\n });\n\n const textarea = this.closest(\"form\").querySelector('[key=\"content-editor--write--textarea\"]');\n\n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+enter\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"eiaxptffaqjnfc\", function (event) {\n\n this.hidden = leafac.isAppleDevice;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ereyqdqjdlvllx\", function (event) {\n\n this.hidden = !leafac.isAppleDevice;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hbqopjbpotoxox\", function (event, $$0) {\n\n this.isModified = false;\n\n this.onchange = async () => {\n await fetch($$0, {\n method: \"PATCH\",\n headers: { \"CSRF-Protection\": \"true\", },\n cache: \"no-store\",\n body: new URLSearchParams({ preferAnonymous: String(this.checked), }),\n });\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"erlwokxgtxgqnf\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Anonymous to Other Students\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ktlweivjachnr\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Signed by You\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dgioikqsvbszix\", function (event, $$0, $$1) {\n\n if ($$0) return;\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$1,\n },\n });\n \n const textarea = this.closest(\"form\").querySelector('[key=\"content-editor--write--textarea\"]');\n \n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+enter\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"kbbglpbyfypll\", function (event, $$0, $$1) {\n\n if ($$0) return;\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$1,\n },\n });\n \n const textarea = this.closest(\"form\").querySelector('[key=\"content-editor--write--textarea\"]');\n \n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+enter\", () => { this.click(); return false; });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ftgsdbnplrhmda\", function (event) {\n\n this.hidden = leafac.isAppleDevice;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ezswsgcyeefeyw\", function (event) {\n\n this.hidden = !leafac.isAppleDevice;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dvpsjpvlesrzqn\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"Course staff whispers are messages visible to the course staff only.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dkvovaewomhktd\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"To join an existing course you either have to follow an invitation link or be invited via email. Contact your course staff for more information.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gbcbzvxsmhxrjg\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0,\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dusbygeprytfrw\", function (event) {\n\n this.defaultValue = new Date().getFullYear().toString();\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dqiswarsgtzkqa\", function (event) {\n\n const month = new Date().getMonth() + 1;\n this.defaultValue = month < 4 || month > 9 ? \"Spring\" : \"Fall\";\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bkllcseeaixirf\", function (event, $$0, $$1, $$2, $$3) {\n\n this.style.setProperty(\"--color--accent-color--100\", $$0);\n this.style.setProperty(\"--color--accent-color--200\", $$1);\n this.style.setProperty(\"--color--accent-color--700\", $$2);\n this.style.setProperty(\"--color--accent-color--800\", $$3);\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ckvwmowchsgjdq\", function (event) {\n\n this.onclick = () => {\n for (const element of leafac.nextSiblings(this).slice(1))\n element.hidden = !element.hidden;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fjdhjqofaiiprv\", function (event) {\n\n this.isModified = true;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dyzsbfyygmptao\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Visible by Course Staff Only\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dnpbgmnhwmctga\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Visible by Everyone\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"pqgiejeqtqoyp\", function (event, $$0, $$1) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: \"rose\",\n touch: false,\n content: \"Remove Tag\",\n },\n });\n\n if ($$0)\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n theme: \"rose\",\n trigger: \"click\",\n interactive: true,\n content: $$1, \n },\n });\n else\n this.onclick = () => {\n const tags = this.closest('[key=\"tags\"]');\n this.closest('[key^=\"tag/\"]').remove();\n tags.reorder();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"tohikuxnwzxkt\", function (event) {\n\n this.onclick = () => {\n const tag = this.closest('[key^=\"tag/\"]');\n tag.classList.add(\"removed\");\n for (const element of leafac.descendants(tag)) {\n if (element.skipDisable === true) continue;\n if (typeof element.disabled === \"boolean\") element.disabled = true;\n if (element.matches(\".button\")) element.classList.add(\"disabled\");\n if (element.tooltip !== undefined) element.tooltip.disable();\n }\n this.closest('[key=\"tags\"]').reorder();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dqgwqbchycszkn\", function (event) {\n\n this.skipDisable = true;\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Don\u2019t Remove Tag\",\n },\n });\n\n this.onclick = () => {\n const tag = this.closest('[key^=\"tag/\"]');\n tag.classList.remove(\"removed\");\n for (const element of leafac.descendants(tag)) {\n if (typeof element.disabled === \"boolean\") element.disabled = false;\n if (element.matches(\".button\")) element.classList.remove(\"disabled\");\n if (element.tooltip !== undefined) element.tooltip.enable();\n }\n tag.closest('[key=\"tags\"]').reorder();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"zosdkinxejuor\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"See Conversations with This Tag\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ddqllapnltbski\", function (event) {\n\n this.onbeforemorph = (event) => {\n const liveUpdate = event?.detail?.liveUpdate;\n if (!liveUpdate) this.isModified = false;\n return !liveUpdate;\n };\n\n this.onpointerdown = (event) => {\n if (event.target.closest('[key=\"tag--grab--handle\"]') === null) return;\n\n const body = document.querySelector(\"body\");\n const tag = event.target.closest('[key^=\"tag/\"]');\n\n this.grabbed = tag;\n body.classList.add(\"grabbing\");\n tag.classList.add(\"grabbed\");\n\n body.addEventListener(\"pointerup\", () => {\n delete this.grabbed;\n body.classList.remove(\"grabbing\");\n tag.classList.remove(\"grabbed\");\n }, { once: true });\n };\n\n this.onpointermove = (event) => {\n const tag = (\n event.pointerType === \"touch\" ? document.elementFromPoint(event.clientX, event.clientY) : event.target\n ).closest('[key^=\"tag/\"]');\n if (tag === null || [undefined, tag].includes(this.grabbed)) return;\n\n const boundingClientRect = tag.getBoundingClientRect();\n tag[\n (event.clientY - boundingClientRect.top) / (boundingClientRect.bottom - boundingClientRect.top) < 0.5 ?\n \"after\" : \"before\"\n ](this.grabbed);\n this.reorder();\n };\n\n this.onkeydown = (event) => {\n if (event.target.closest('[key=\"tag--grab--handle\"]') === null) return;\n\n const tag = event.target.closest('[key^=\"tag/\"]');\n switch (event.code) {\n case \"ArrowUp\":\n event.preventDefault();\n tag.previousElementSibling?.before?.(tag);\n break;\n case \"ArrowDown\":\n event.preventDefault();\n tag.nextElementSibling?.after?.(tag);\n break;\n }\n tag.querySelector('[key=\"tag--grab--handle\"]').focus();\n this.reorder();\n };\n\n this.reorder = () => {\n this.isModified = true;\n\n for (const [order, tag] of this.querySelectorAll('[key^=\"tag/\"]:not(.removed)').entries())\n for (const element of tag.querySelectorAll('[name^=\"tags[\"]'))\n element.setAttribute(\"name\", element.getAttribute(\"name\").replace(/\\d+/, String(order)));\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"flbxprgiqrtald\", function (event, $$0) {\n\n this.onclick = () => {\n const newTag = leafac.stringToElement($$0).querySelector('[key=\"tag/new\"]');\n\n const tags = this.closest(\"form\").querySelector('[key=\"tags\"]');\n tags.insertAdjacentElement(\"beforeend\", newTag);\n leafac.execute({ element: newTag });\n tags.reorder();\n };\n\n this.onvalidate = () => {\n if (this.closest(\"form\").querySelector('[key=\"tags\"]').children.length === 0)\n return \"Please add at least one tag.\";\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ecgjtrjiduumye\", function (event) {\n\n this.onchange = () => {\n const form = this.closest(\"form\");\n const emails = form.querySelector('[key=\"emails\"]');\n emails.hidden = true;\n for (const element of leafac.descendants(emails))\n if (element.disabled !== undefined) element.disabled = true;\n form.querySelector('[key=\"button--create-invitation\"]').hidden = false;\n form.querySelector('[key=\"button--send-invitation-emails\"]').hidden = true;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ewmzyemenadwhr\", function (event) {\n\n this.onchange = () => {\n const form = this.closest(\"form\");\n const emails = form.querySelector('[key=\"emails\"]');\n emails.hidden = false;\n for (const element of leafac.descendants(emails))\n if (element.disabled !== undefined) element.disabled = false;\n form.querySelector('[key=\"button--create-invitation\"]').hidden = true;\n form.querySelector('[key=\"button--send-invitation-emails\"]').hidden = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hhwzsaolgesynb\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ezwaxjjnwfyfii\", function (event) {\n\n this.onvalidate = () => {\n const emails = [];\n for (let email of this.value.split(/[,\\n]/)) {\n email = email.trim();\n let name = null;\n const match = email.match(/^(?.*)<(?.*)>$/);\n if (match !== null) {\n email = match.groups.email.trim();\n name = match.groups.name.trim();\n if (name.startsWith('\"') && name.endsWith('\"'))\n name = name.slice(1, -1);\n if (name === \"\") name = null;\n }\n if (email === \"\") continue;\n emails.push({ email, name });\n }\n if (\n emails.length === 0 ||\n emails.some(\n ({ email }) => email.match(leafac.regExps.email) === null\n )\n )\n return \"Match the requested format.\";\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bmjfumglnvstqt\", function (event) {\n\n this.onchange = () => {\n const expiresAt = this.closest(\"form\").querySelector('[key=\"expires-at\"]');\n expiresAt.hidden = !this.checked;\n for (const element of leafac.descendants(expiresAt))\n if (element.disabled !== undefined) element.disabled = !this.checked;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gbiyabexqzmdfn\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Expiring\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"etfxqrnrzaqxxa\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Set as Not Expiring\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dzhwmvwptlvtub\", function (event) {\n\n this.value = this.defaultValue = leafac.localizeDateTime(this.defaultValue);\n\n this.onvalidate = () => {\n const error = leafac.validateLocalizedDateTime(this);\n if (typeof error === \"string\") return error;\n if (new Date(this.value).getTime() <= Date.now()) return \"Must be in the future.\";\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"edwdoptjvtnfdt\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Invitation Link\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dkpkclitnwcpqw\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Invitation Email\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fchrefbxqxsreu\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"See Invitation Link\",\n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n maxWidth: \"none\",\n content: $$0,\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"snsaejadcmuqh\", function (event) {\n\n this.onfocus = () => {\n this.select();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cghbtykslaigkh\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Copy Link\",\n },\n });\n\n this.onclick = async () => {\n await navigator.clipboard.writeText($$0);\n const stickies = this.querySelector('[key=\"stickies\"]');\n const check = this.querySelector('[key=\"check\"]');\n stickies.hidden = true;\n check.hidden = false;\n await new Promise((resolve) => { window.setTimeout(resolve, 1000); });\n stickies.hidden = false;\n check.hidden = true;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bfjetetfptmzsl\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"See QR Code for Link\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cieopjferotuxs\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"eisoalousyfmiu\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: \"rose\",\n trigger: \"click\",\n content: \"You may not resend this invitation because it\u2019s used.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"deiqiqsduqtmus\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: \"rose\",\n trigger: \"click\",\n content: \"You may not resend this invitation because it\u2019s expired.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cinauyfystpoed\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Update Course Role\",\n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fzvduqpicemexn\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: \"rose\",\n trigger: \"click\",\n content: \"You may not update the course role of this invitation because it\u2019s used.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gkcjvjklbemwnm\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: \"rose\",\n trigger: \"click\",\n content: \"You may not update the course role of this invitation because it\u2019s expired.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"goczgnhhilvexe\", function (event) {\n\n this.value = this.defaultValue = leafac.localizeDateTime(this.defaultValue);\n\n this.onvalidate = () => {\n const error = leafac.validateLocalizedDateTime(this);\n if (typeof error === \"string\") return error;\n if (new Date(this.value).getTime() <= Date.now()) return \"Must be in the future.\";\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ouubxppovpcyv\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n interactive: true,\n content: $$0,\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ggfjeqisfnvgea\", function (event) {\n\n leafac.relativizeDateTimeElement(this, { preposition: \"on\", target: this.parentElement });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bifghjgomepmvb\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Update Expiration\",\n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cxxyhlxqiytzgm\", function (event) {\n\n leafac.relativizeDateTimeElement(this, { preposition: \"on\", target: this.parentElement });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"farskcelhbmnqd\", function (event, $$0) {\n\n this.onclick = () => {\n tippy.hideAll();\n const button = document.querySelector($$0);\n button.click();\n button.tooltip.hide();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"qqsyneauakcug\", function (event) {\n\n this.onfocus = () => {\n this.select();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bgcmogqgpuxyue\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Copy Link\",\n },\n });\n\n this.onclick = async () => {\n await navigator.clipboard.writeText($$0);\n const stickies = this.querySelector('[key=\"stickies\"]');\n const check = this.querySelector('[key=\"check\"]');\n stickies.hidden = true;\n check.hidden = false;\n await new Promise((resolve) => { window.setTimeout(resolve, 1000); });\n stickies.hidden = false;\n check.hidden = true;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cmmfvnfbuznftm\", function (event) {\n\n this.isModified = false;\n\n this.oninput = () => {\n const filterPhrases = this.value.split(/[^a-z0-9]+/i).filter((filterPhrase) => filterPhrase.trim() !== \"\");\n for (const courseParticipant of document.querySelectorAll('[key^=\"course-participant/\"]')) {\n let courseParticipantHidden = filterPhrases.length > 0;\n for (const filterablePhrasesElement of courseParticipant.querySelectorAll(\"[data-filterable-phrases]\")) {\n const filterablePhrases = JSON.parse(filterablePhrasesElement.getAttribute(\"data-filterable-phrases\"));\n const filterablePhrasesElementChildren = [];\n for (const filterablePhrase of filterablePhrases) {\n let filterablePhraseElement;\n if (filterPhrases.some(filterPhrase => filterablePhrase.toLowerCase().startsWith(filterPhrase.toLowerCase()))) {\n filterablePhraseElement = document.createElement(\"mark\");\n filterablePhraseElement.classList.add(\"mark\");\n courseParticipantHidden = false;\n } else\n filterablePhraseElement = document.createElement(\"span\");\n filterablePhraseElement.textContent = filterablePhrase;\n filterablePhrasesElementChildren.push(filterablePhraseElement);\n }\n filterablePhrasesElement.replaceChildren(...filterablePhrasesElementChildren);\n }\n courseParticipant.hidden = courseParticipantHidden;\n }\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"geqwjlvubitcxk\", function (event) {\n\n this.onbeforemorph = (event) => !event?.detail?.liveUpdate;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gmzcmjfdaeqpbs\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Copy Email\",\n },\n });\n\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"copied\",\n tippyProps: {\n theme: \"green\",\n trigger: \"manual\",\n content: \"Copied\",\n },\n });\n\n this.onclick = async () => {\n await navigator.clipboard.writeText($$0);\n this.copied.show();\n await new Promise((resolve) => { window.setTimeout(resolve, 1000); });\n this.copied.hide();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dzwmfrppzjzrmp\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Update Course Role\",\n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bqdaojwrtoefts\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: \"rose\",\n trigger: \"click\",\n content: \"You may not update your own course role because you\u2019re the only course staff member.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cvfnoskjymurkv\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n theme: \"rose\",\n trigger: \"click\",\n interactive: true,\n appendTo: document.querySelector(\"body\"),\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cernxzzmsvoqpn\", function (event, $$0, $$1) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: \"rose\",\n touch: false,\n content: \"Remove from the Course\",\n },\n });\n\n if ($$0)\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n theme: \"rose\",\n trigger: \"click\",\n content: \"You may not remove yourself from the course because you\u2019re the only course staff member.\",\n },\n });\n else\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n theme: \"rose\",\n trigger: \"click\",\n interactive: true,\n content: $$1, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cslspnctqfqyqg\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"A bar with the accent color appears at the top of pages related to this course to help you differentiate between courses.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"erlhqbrimvomxx\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"You must confirm the course name to avoid removing yourself from the wrong course by accident.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bhjppcvhtjgtnm\", function (event, $$0) {\n\n this.onvalidate = () => {\n if (this.value !== $$0)\n return \"Please confirm the course name.\";\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cqcnmtmvdhpwcq\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n theme: \"rose\",\n trigger: \"click\",\n interactive: true,\n onShow: () => leafac.validate(this.closest(\"form\")),\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ffecemskjvupzw\", function (event) {\n\n this.onclick = () => {\n document.querySelector('[key=\"update-email\"]').hidden = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"etttlyxlvljulz\", function (event) {\n\n this.onvalidate = () => {\n if (!leafac.isModified(this))\n return \"Please provide the email address to which you\u2019d like to update.\";\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dxlhguzbjtvzpm\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"You must confirm your password because this is an important operation that affects your account.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"beqrxmxfwbrlpo\", function (event, $$0, $$1, $$2, $$3, $$4, $$5, $$6, $$7) {\n\n if ($$0) {\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"flash\",\n tippyProps: {\n appendTo: this,\n trigger: \"manual\",\n hideOnClick: false,\n theme: $$1,\n arrow: false,\n interactive: true,\n content: $$2, \n },\n });\n this.flash.show();\n }\n\n document.querySelector('[key=\"theme-color--light\"]').setAttribute(\"content\", getComputedStyle(document.documentElement).getPropertyValue($$3));\n document.querySelector('[key=\"theme-color--dark\"]').setAttribute(\"content\", getComputedStyle(document.documentElement).getPropertyValue($$4));\n\n if ($$5 && event?.detail?.liveUpdate !== true)\n leafac.liveConnection({\n nonce: $$6,\n newServerVersionMessage: \"Courselore has been updated. Please reload the page.\",\n offlineMessage: \"Failed to connect to Courselore. Please check your internet connection and try reloading the page.\",\n environment: $$7,\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dywqanxkmdldcf\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: $$0,\n touch: false,\n content: \"Close\",\n },\n });\n\n this.onclick = () => {\n this.closest(\"[data-tippy-root]\")._tippy.hide();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ejhssnuiwtweya\", function (event) {\n\n this.onscroll = () => {\n this.scroll(0, 0);\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ezbjiixfhsnljj\", function (event, $$0, $$1, $$2) {\n\n this.style.setProperty(\"--color--accent-color--500\", $$0);\n this.style.setProperty(\"--color--accent-color--600\", $$1);\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"What\u2019s This?\",\n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$2, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hacllyowdvxyhg\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"eqvvpizcazzbgg\", function (event, $$0) {\n\n this.onclick = async () => {\n this.classList.add(\"button--amber\");\n await new Promise((resolve) => { window.setTimeout(resolve, 3 * 1000); });\n await fetch($$0, { cache: \"no-store\" });\n this.classList.remove(\"button--amber\");\n this.classList.add(\"button--green\");\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gnnqxvgecfrwjf\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Courselore\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"eweaghxozpbicr\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fppczrxbcrtwpg\", function (event, $$0, $$1) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$0, \n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$1, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fcqvseayqawrdx\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"To join an existing course you either have to follow an invitation link or be invited via email. Contact your course staff for more information.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dfzadgbvpgypff\", function (event, $$0, $$1) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$0,\n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$1, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"kwuqkzkhgwnfd\", function (event) {\n\n if (\n event?.detail?.previousLocation?.origin !== window.location.origin ||\n event?.detail?.previousLocation?.pathname !== window.location.pathname ||\n event?.detail?.previousLocation?.search !== window.location.search\n )\n this.scroll(0, 0);\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"qoynnnqxqpeyz\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"higtjgtkqelahz\", function (event, $$0, $$1, $$2) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0,\n },\n });\n\n if ($$1)\n this.onclick = async () => {\n this.classList.remove(\"strong\");\n this.classList.remove(\"text--green\");\n await fetch($$2, {\n method: \"PATCH\",\n headers: { \"CSRF-Protection\": \"true\", },\n cache: \"no-store\",\n });\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fbalyzfiaivaxo\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0,\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hhzhxrhkvszqzf\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Current Courselore version\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"uieeewhvaeak\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Latest Courselore version\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cgcilkkehvukfz\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Loading\u2026\",\n },\n });\n\n window.onlivenavigate = () => {\n const parentElement = this;\n parentElement.hidden = false;\n const element = parentElement.querySelector(\"div\");\n let width = 5;\n window.clearTimeout(element.updateTimeout);\n (function update() {\n if (parentElement.hidden || !leafac.isConnected(element)) return;\n element.style.width = width.toString() + \"%\";\n width += (95 - width) / (20 + Math.random() * 15);\n element.updateTimeout = window.setTimeout(update, 200 + Math.random() * 300);\n })();\n };\n\n window.onlivenavigateerror = () => {\n this.hidden = true;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fypjycvudynjzs\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n content: $$0,\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"eldgejeerlegmx\", function (event, $$0, $$1, $$2) {\n\n this.onclick = () => {\n const content = this.closest(\"[data-content-source]\").getAttribute(\"data-content-source\");\n const newMessage = document.querySelector('[key=\"new-message\"]');\n newMessage.querySelector('[key=\"content-editor--button--write\"]')?.click();\n const element = newMessage.querySelector('[key=\"content-editor--write--textarea\"]');\n textFieldEdit.wrapSelection(\n element,\n ((element.selectionStart > 0) ? \"\\n\\n\" : \"\") + \"> \" + $$0 + \"#\" + $$1 + \"/\" + $$2 + \"\\n>\\n> \" + content.replaceAll(\"\\n\", \"\\n> \") + \"\\n\\n\",\n \"\"\n );\n element.focus();\n tippy.hideAll();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cyaxlmqkldmthd\", function (event, $$0, $$1) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n onHidden: () => { this.onmouseleave(); },\n content: $$0,\n },\n });\n\n window.clearTimeout(this.tooltipContentTimeout);\n this.tooltipContentSkipLoading = false;\n \n this.onmouseenter = this.onfocus = async () => {\n window.clearTimeout(this.tooltipContentTimeout);\n if (this.tooltipContentSkipLoading) return;\n this.tooltipContentSkipLoading = true;\n leafac.loadPartial(this.tooltip.props.content.querySelector('[key=\"content\"]'), await (await fetch($$1, { cache: \"no-store\" })).text());\n this.tooltip.props.content.querySelector('[key=\"loading\"]').hidden = true;\n this.tooltip.props.content.querySelector('[key=\"content\"]').hidden = false;\n this.tooltip.setProps({});\n };\n \n this.onmouseleave = this.onblur = () => {\n window.clearTimeout(this.tooltipContentTimeout);\n if (this.matches(\":hover, :focus-within\") || this.tooltip.state.isShown) return;\n this.tooltipContentTimeout = window.setTimeout(() => {\n this.tooltip.props.content.querySelector('[key=\"loading\"]').hidden = false;\n this.tooltip.props.content.querySelector('[key=\"content\"]').hidden = true;\n this.tooltipContentSkipLoading = false;\n }, 60 * 1000);\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dvrisunlgxwtth\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"copied\",\n tippyProps: {\n theme: \"green\",\n trigger: \"manual\",\n content: \"Copied\",\n },\n });\n\n this.onclick = async () => {\n await navigator.clipboard.writeText($$0);\n this.copied.show();\n await new Promise((resolve) => { window.setTimeout(resolve, 1000); });\n this.copied.hide();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"dklrdlooqpeszl\", function (event, $$0) {\n\n this.onmouseenter = this.onfocus = async () => {\n const messageEdit = this.closest('[key^=\"message/\"]').querySelector('[key=\"message--edit\"]');\n const messageEditForm = messageEdit.querySelector('[key=\"form\"]');\n if (messageEditForm.skipLoading === true) return;\n messageEditForm.skipLoading = true;\n leafac.loadPartial(messageEditForm, await (await fetch($$0, { cache: \"no-store\" })).text());\n messageEdit.querySelector('[key=\"loading\"]').hidden = true;\n messageEdit.querySelector('[key=\"form\"]').hidden = false;\n autosize.update(this.closest('[key^=\"message/\"]')?.querySelector('[key=\"message--edit\"] [key=\"content-editor--write--textarea\"]'));\n };\n\n this.onclick = () => {\n this.closest('[key^=\"message/\"]').querySelector('[key=\"message--show\"]').hidden = true;\n this.closest('[key^=\"message/\"]').querySelector('[key=\"message--edit\"]').hidden = false;\n autosize.update(this.closest('[key^=\"message/\"]').querySelector('[key=\"message--edit\"] [key=\"content-editor--write--textarea\"]'));\n tippy.hideAll();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"giuzswqgycvakj\", function (event, $$0, $$1) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n interactive: true,\n onHidden: () => { this.onmouseleave(); },\n content: $$0,\n },\n });\n\n window.clearTimeout(this.tooltipContentTimeout);\n this.tooltipContentSkipLoading = false;\n\n this.onmouseenter = this.onfocus = async () => {\n window.clearTimeout(this.tooltipContentTimeout);\n if (this.tooltipContentSkipLoading) return;\n this.tooltipContentSkipLoading = true;\n leafac.loadPartial(this.tooltip.props.content.querySelector('[key=\"content\"]'), await (await fetch($$1, { cache: \"no-store\" })).text());\n this.tooltip.props.content.querySelector('[key=\"loading\"]').hidden = true;\n this.tooltip.props.content.querySelector('[key=\"content\"]').hidden = false;\n this.tooltip.setProps({});\n };\n\n this.onmouseleave = this.onblur = () => {\n window.clearTimeout(this.tooltipContentTimeout);\n if (this.matches(\":hover, :focus-within\") || this.tooltip.state.isShown) return;\n this.tooltipContentTimeout = window.setTimeout(() => {\n this.tooltip.props.content.querySelector('[key=\"loading\"]').hidden = false;\n this.tooltip.props.content.querySelector('[key=\"content\"]').hidden = true;\n this.tooltipContentSkipLoading = false;\n }, 60 * 1000);\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"psvvjvvimzgbr\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n theme: \"rose\",\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cxgapmycafabdw\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: $$0,\n },\n });\n\n const textarea = this.closest(\"form\").querySelector('[key=\"content-editor--write--textarea\"]');\n\n (textarea.mousetrap ??= new Mousetrap(textarea)).bind(\"mod+enter\", () => { this.click(); return false; }); \n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"btzbudshvpzvgr\", function (event) {\n\n this.onclick = () => {\n this.closest('[key^=\"message/\"]').querySelector('[key=\"message--show\"]').hidden = false;\n this.closest('[key^=\"message/\"]').querySelector('[key=\"message--edit\"]').hidden = true;\n\n const messageEdit = this.closest('[key^=\"message/\"]').querySelector('[key=\"message--edit\"]');\n messageEdit.querySelector('[key=\"loading\"]').hidden = false;\n messageEdit.querySelector('[key=\"form\"]').hidden = true;\n messageEdit.querySelector('[key=\"form\"]').skipLoading = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hkukksaegmmhlf\", function (event) {\n\n leafac.relativizeDateTimeElement(this, { capitalize: true });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cvliezdzbtbocr\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Online\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bgzcbvbynutepb\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Course Staff\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"pgxzmipiutgsw\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n interactive: true,\n appendTo: document.querySelector(\"body\"),\n delay: [1000, null],\n touch: [\"hold\", 1000],\n content: $$0, \n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fixgnebnaykheh\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Copy Email\",\n },\n });\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"copied\",\n tippyProps: {\n theme: \"green\",\n trigger: \"manual\",\n content: \"Copied\",\n },\n });\n\n this.onclick = async () => {\n await navigator.clipboard.writeText($$0);\n this.copied.show();\n await new Promise((resolve) => { window.setTimeout(resolve, 1000); });\n this.copied.hide();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hfwybvdquqrale\", function (event) {\n\n leafac.relativizeDateTimeElement(this, { preposition: \"on\", target: this.parentElement });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bdiypnbetmedhr\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Anonymous to Other Students\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"epcssncdycxbjm\", function (event) {\n\n this.dragLevel = 0;\n this.ondragenter = (event) => {\n if (!event.dataTransfer.types.includes(\"Files\")) return;\n event.preventDefault();\n if (this.dragLevel === 0) this.classList.add(\"drag\");\n this.dragLevel++;\n };\n this.ondragleave = (event) => {\n if (!event.dataTransfer.types.includes(\"Files\")) return;\n event.preventDefault();\n this.dragLevel--;\n if (this.dragLevel === 0) this.classList.remove(\"drag\");\n };\n this.ondragover = (event) => {\n if (!event.dataTransfer.types.includes(\"Files\")) return;\n event.preventDefault();\n };\n this.ondrop = (event) => {\n if (!event.dataTransfer.types.includes(\"Files\")) return;\n event.preventDefault();\n this.classList.remove(\"drag\");\n this.dragLevel = 0;\n const fileList = [...event.dataTransfer.items].flatMap((item) => item.webkitGetAsEntry()?.isFile ?? true ? [item.getAsFile()] : []);\n if (fileList.length > 0)\n this.querySelector('[key=\"avatar-chooser--upload\"]').upload(fileList);\n };\n\n this.onbeforemorph = (event) => !event?.detail?.liveUpdate;\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"hboxfjqxqpyfji\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Add Avatar\",\n },\n });\n\n this.onclick = () => {\n this.closest(\"form\").querySelector('[key=\"avatar-chooser--upload\"]').click();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"eejwmcnwmyrrgj\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n touch: false,\n content: \"Update Avatar\",\n },\n });\n\n this.onclick = () => {\n this.closest(\"form\").querySelector('[key=\"avatar-chooser--upload\"]').click();\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fswslmlqyyyth\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n theme: \"rose\",\n touch: false,\n content: \"Remove Avatar\",\n },\n });\n \n this.onclick = () => {\n const form = this.closest(\"form\");\n const avatar = form.querySelector('[name=\"avatar\"]')\n avatar.value = \"\";\n form.querySelector('[key=\"avatar-chooser--empty\"]').hidden = false;\n form.querySelector('[key=\"avatar-chooser--filled\"]').hidden = true;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"wvqxzhwuncjux\", function (event, $$0, $$1) {\n\n this.isModified = false;\n\n const avatarChooser = this.closest('[key=\"avatar-chooser\"]');\n const avatar = avatarChooser.querySelector('[name=\"avatar\"]');\n const avatarEmpty = avatarChooser.querySelector('[key=\"avatar-chooser--empty\"]');\n const avatarFilled = avatarChooser.querySelector('[key=\"avatar-chooser--filled\"]');\n\n leafac.setTippy({\n event,\n element: avatarChooser,\n elementProperty: \"uploadingIndicator\",\n tippyProps: {\n trigger: \"manual\",\n hideOnClick: false,\n content: $$0,\n },\n });\n\n this.upload = async (fileList) => {\n const body = new FormData();\n body.append(\"avatar\", fileList[0]);\n this.value = \"\";\n tippy.hideAll();\n avatarChooser.uploadingIndicator.show();\n const response = await fetch($$1, {\n method: \"POST\",\n headers: { \"CSRF-Protection\": \"true\", },\n cache: \"no-store\",\n body,\n });\n avatarChooser.uploadingIndicator.hide();\n if (!response.ok) {\n leafac.setTippy({\n element: avatarChooser,\n elementProperty: \"uploadingError\",\n tippyProps: {\n theme: \"rose\",\n trigger: \"manual\",\n content: await response.text(),\n },\n });\n avatarChooser.uploadingError.show();\n return;\n }\n const avatarURL = await response.text();\n avatar.value = avatarURL;\n avatarEmpty.hidden = true;\n avatarFilled.hidden = false;\n avatarFilled.querySelector(\"img\").setAttribute(\"src\", avatarURL);\n };\n\n this.onchange = () => {\n this.upload(this.files);\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"ceqraednhaojns\", function (event) {\n\n this.onvalidate = () => {\n if (!leafac.isModified(this))\n return \"Please provide the email address to which you\u2019d like to update.\";\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"sgkuubrrvxpgh\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"You must confirm your password because this is an important operation that affects your account.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"btbddaoktloydh\", function (event) {\n\n this.onvalidate = () => {\n if (this.value !== this.closest(\"form\").querySelector('[name=\"newPassword\"]').value)\n return \"New Password & New Password Confirmation don\u2019t match.\";\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"fqmffyedwppxuj\", function (event) {\n\n this.onchange = () => {\n if (this.checked) {\n this.closest(\"form\").querySelector('[name=\"isEmailNotificationsForMentions\"]').checked = true;\n this.closest(\"form\").querySelector('[name=\"isEmailNotificationsForMessagesInConversationsInWhichYouParticipated\"]').checked = true;\n this.closest(\"form\").querySelector('[name=\"isEmailNotificationsForMessagesInConversationsYouStarted\"]').checked = true;\n }\n for (const element of this.closest(\"form\").querySelectorAll('[name=\"emailNotificationsForAllMessages\"]')) {\n element.disabled = !this.checked;\n element.closest(\"label\").classList[this.checked ? \"remove\" : \"add\"](\"disabled\");\n }\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gqzkuxyhivpwpr\", function (event) {\n\n this.onchange = () => {\n if (!this.checked) {\n const element = this.closest(\"form\").querySelector('[name=\"isEmailNotificationsForAllMessages\"]');\n element.checked = false;\n element.onchange();\n }\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gecqgxqajdeech\", function (event) {\n\n this.onchange = () => {\n if (!this.checked) {\n const element = this.closest(\"form\").querySelector('[name=\"isEmailNotificationsForAllMessages\"]');\n element.checked = false;\n element.onchange();\n }\n if (this.checked) this.closest(\"form\").querySelector('[name=\"isEmailNotificationsForMessagesInConversationsYouStarted\"]').checked = true;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"gydomzxwjwbjkh\", function (event) {\n\n this.onchange = () => {\n if (!this.checked) {\n const element = this.closest(\"form\").querySelector('[name=\"isEmailNotificationsForAllMessages\"]');\n element.checked = false;\n element.onchange();\n }\n if (!this.checked) this.closest(\"form\").querySelector('[name=\"isEmailNotificationsForMessagesInConversationsInWhichYouParticipated\"]').checked = false;\n };\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"cypkltevryuiqn\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n content: \"You always receive email notifications for course staff announcements.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"bhcwuipqzysfgl\", function (event) {\n\n leafac.setTippy({\n event,\n element: this,\n tippyProps: {\n trigger: \"click\",\n content: \"You must confirm your email because this is an important operation that affects your account.\",\n },\n });\n });\n\n/********************************************************************************/\n\nleafac.execute.functions.set(\"efkrhudqtuboju\", function (event, $$0) {\n\n leafac.setTippy({\n event,\n element: this,\n elementProperty: \"dropdown\",\n tippyProps: {\n theme: \"rose\",\n trigger: \"click\",\n interactive: true,\n content: $$0, \n },\n });\n });\n\n", "// Compute what scrolling needs to be done on required scrolling boxes for target to be in view\n\n// The type names here are named after the spec to make it easier to find more information around what they mean:\n// To reduce churn and reduce things that need be maintained things from the official TS DOM library is used here\n// https://drafts.csswg.org/cssom-view/\n\n// For a definition on what is \"block flow direction\" exactly, check this: https://drafts.csswg.org/css-writing-modes-4/#block-flow-direction\n\n/**\n * This new option is tracked in this PR, which is the most likely candidate at the time: https://github.com/w3c/csswg-drafts/pull/1805\n * @public\n */\nexport type ScrollMode = 'always' | 'if-needed'\n\n/** @public */\nexport interface Options {\n /**\n * Control the logical scroll position on the y-axis. The spec states that the `block` direction is related to the [writing-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode), but this is not implemented yet in this library.\n * This means that `block: 'start'` aligns to the top edge and `block: 'end'` to the bottom.\n * @defaultValue 'center'\n */\n block?: ScrollLogicalPosition\n /**\n * Like `block` this is affected by the [writing-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode). In left-to-right pages `inline: 'start'` will align to the left edge. In right-to-left it should be flipped. This will be supported in a future release.\n * @defaultValue 'nearest'\n */\n inline?: ScrollLogicalPosition\n /**\n * This is a proposed addition to the spec that you can track here: https://github.com/w3c/csswg-drafts/pull/5677\n *\n * This library will be updated to reflect any changes to the spec and will provide a migration path.\n * To be backwards compatible with `Element.scrollIntoViewIfNeeded` if something is not 100% visible it will count as \"needs scrolling\". If you need a different visibility ratio your best option would be to implement an [Intersection Observer](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API).\n * @defaultValue 'always'\n */\n scrollMode?: ScrollMode\n /**\n * By default there is no boundary. All the parent elements of your target is checked until it reaches the viewport ([`document.scrollingElement`](https://developer.mozilla.org/en-US/docs/Web/API/document/scrollingElement)) when calculating layout and what to scroll.\n * By passing a boundary you can short-circuit this loop depending on your needs:\n * \n * - Prevent the browser window from scrolling.\n * - Scroll elements into view in a list, without scrolling container elements.\n * \n * You can also pass a function to do more dynamic checks to override the scroll scoping:\n * \n * ```js\n * let actions = compute(target, {\n * boundary: (parent) => {\n * // By default `overflow: hidden` elements are allowed, only `overflow: visible | clip` is skipped as\n * // this is required by the CSSOM spec\n * if (getComputedStyle(parent)['overflow'] === 'hidden') {\n * return false\n * }\n\n * return true\n * },\n * })\n * ```\n * @defaultValue null\n */\n boundary?: Element | ((parent: Element) => boolean) | null\n /**\n * New option that skips auto-scrolling all nodes with overflow: hidden set\n * See FF implementation: https://hg.mozilla.org/integration/fx-team/rev/c48c3ec05012#l7.18\n * @defaultValue false\n * @public\n */\n skipOverflowHiddenElements?: boolean\n}\n\n/** @public */\nexport interface ScrollAction {\n el: Element\n top: number\n left: number\n}\n\n// @TODO better shadowdom test, 11 = document fragment\nconst isElement = (el: any): el is Element =>\n typeof el === 'object' && el != null && el.nodeType === 1\n\nconst canOverflow = (\n overflow: string | null,\n skipOverflowHiddenElements?: boolean\n) => {\n if (skipOverflowHiddenElements && overflow === 'hidden') {\n return false\n }\n\n return overflow !== 'visible' && overflow !== 'clip'\n}\n\nconst getFrameElement = (el: Element) => {\n if (!el.ownerDocument || !el.ownerDocument.defaultView) {\n return null\n }\n\n try {\n return el.ownerDocument.defaultView.frameElement\n } catch (e) {\n return null\n }\n}\n\nconst isHiddenByFrame = (el: Element): boolean => {\n const frame = getFrameElement(el)\n if (!frame) {\n return false\n }\n\n return (\n frame.clientHeight < el.scrollHeight || frame.clientWidth < el.scrollWidth\n )\n}\n\nconst isScrollable = (el: Element, skipOverflowHiddenElements?: boolean) => {\n if (el.clientHeight < el.scrollHeight || el.clientWidth < el.scrollWidth) {\n const style = getComputedStyle(el, null)\n return (\n canOverflow(style.overflowY, skipOverflowHiddenElements) ||\n canOverflow(style.overflowX, skipOverflowHiddenElements) ||\n isHiddenByFrame(el)\n )\n }\n\n return false\n}\n/**\n * Find out which edge to align against when logical scroll position is \"nearest\"\n * Interesting fact: \"nearest\" works similarily to \"if-needed\", if the element is fully visible it will not scroll it\n *\n * Legends:\n * ┌────────┐ ┏ ━ ━ ━ ┓\n * │ target │ frame\n * └────────┘ ┗ ━ ━ ━ ┛\n */\nconst alignNearest = (\n scrollingEdgeStart: number,\n scrollingEdgeEnd: number,\n scrollingSize: number,\n scrollingBorderStart: number,\n scrollingBorderEnd: number,\n elementEdgeStart: number,\n elementEdgeEnd: number,\n elementSize: number\n) => {\n /**\n * If element edge A and element edge B are both outside scrolling box edge A and scrolling box edge B\n *\n * ┌──┐\n * ┏━│━━│━┓\n * │ │\n * ┃ │ │ ┃ do nothing\n * │ │\n * ┗━│━━│━┛\n * └──┘\n *\n * If element edge C and element edge D are both outside scrolling box edge C and scrolling box edge D\n *\n * ┏ ━ ━ ━ ━ ┓\n * ┌───────────┐\n * │┃ ┃│ do nothing\n * └───────────┘\n * ┗ ━ ━ ━ ━ ┛\n */\n if (\n (elementEdgeStart < scrollingEdgeStart &&\n elementEdgeEnd > scrollingEdgeEnd) ||\n (elementEdgeStart > scrollingEdgeStart && elementEdgeEnd < scrollingEdgeEnd)\n ) {\n return 0\n }\n\n /**\n * If element edge A is outside scrolling box edge A and element height is less than scrolling box height\n *\n * ┌──┐\n * ┏━│━━│━┓ ┏━┌━━┐━┓\n * └──┘ │ │\n * from ┃ ┃ to ┃ └──┘ ┃\n *\n * ┗━ ━━ ━┛ ┗━ ━━ ━┛\n *\n * If element edge B is outside scrolling box edge B and element height is greater than scrolling box height\n *\n * ┏━ ━━ ━┓ ┏━┌━━┐━┓\n * │ │\n * from ┃ ┌──┐ ┃ to ┃ │ │ ┃\n * │ │ │ │\n * ┗━│━━│━┛ ┗━│━━│━┛\n * │ │ └──┘\n * │ │\n * └──┘\n *\n * If element edge C is outside scrolling box edge C and element width is less than scrolling box width\n *\n * from to\n * ┏ ━ ━ ━ ━ ┓ ┏ ━ ━ ━ ━ ┓\n * ┌───┐ ┌───┐\n * │ ┃ │ ┃ ┃ │ ┃\n * └───┘ └───┘\n * ┗ ━ ━ ━ ━ ┛ ┗ ━ ━ ━ ━ ┛\n *\n * If element edge D is outside scrolling box edge D and element width is greater than scrolling box width\n *\n * from to\n * ┏ ━ ━ ━ ━ ┓ ┏ ━ ━ ━ ━ ┓\n * ┌───────────┐ ┌───────────┐\n * ┃ │ ┃ │ ┃ ┃ │\n * └───────────┘ └───────────┘\n * ┗ ━ ━ ━ ━ ┛ ┗ ━ ━ ━ ━ ┛\n */\n if (\n (elementEdgeStart <= scrollingEdgeStart && elementSize <= scrollingSize) ||\n (elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize)\n ) {\n return elementEdgeStart - scrollingEdgeStart - scrollingBorderStart\n }\n\n /**\n * If element edge B is outside scrolling box edge B and element height is less than scrolling box height\n *\n * ┏━ ━━ ━┓ ┏━ ━━ ━┓\n *\n * from ┃ ┃ to ┃ ┌──┐ ┃\n * ┌──┐ │ │\n * ┗━│━━│━┛ ┗━└━━┘━┛\n * └──┘\n *\n * If element edge A is outside scrolling box edge A and element height is greater than scrolling box height\n *\n * ┌──┐\n * │ │\n * │ │ ┌──┐\n * ┏━│━━│━┓ ┏━│━━│━┓\n * │ │ │ │\n * from ┃ └──┘ ┃ to ┃ │ │ ┃\n * │ │\n * ┗━ ━━ ━┛ ┗━└━━┘━┛\n *\n * If element edge C is outside scrolling box edge C and element width is greater than scrolling box width\n *\n * from to\n * ┏ ━ ━ ━ ━ ┓ ┏ ━ ━ ━ ━ ┓\n * ┌───────────┐ ┌───────────┐\n * │ ┃ │ ┃ │ ┃ ┃\n * └───────────┘ └───────────┘\n * ┗ ━ ━ ━ ━ ┛ ┗ ━ ━ ━ ━ ┛\n *\n * If element edge D is outside scrolling box edge D and element width is less than scrolling box width\n *\n * from to\n * ┏ ━ ━ ━ ━ ┓ ┏ ━ ━ ━ ━ ┓\n * ┌───┐ ┌───┐\n * ┃ │ ┃ │ ┃ │ ┃\n * └───┘ └───┘\n * ┗ ━ ━ ━ ━ ┛ ┗ ━ ━ ━ ━ ┛\n *\n */\n if (\n (elementEdgeEnd > scrollingEdgeEnd && elementSize < scrollingSize) ||\n (elementEdgeStart < scrollingEdgeStart && elementSize > scrollingSize)\n ) {\n return elementEdgeEnd - scrollingEdgeEnd + scrollingBorderEnd\n }\n\n return 0\n}\n\nconst getParentElement = (element: Node): Element | null => {\n const parent = element.parentElement\n if (parent == null) {\n return (element.getRootNode() as ShadowRoot).host || null\n }\n return parent\n}\n\n/** @public */\nexport const compute = (target: Element, options: Options): ScrollAction[] => {\n if (typeof document === 'undefined') {\n // If there's no DOM we assume it's not in a browser environment\n return []\n }\n\n const { scrollMode, block, inline, boundary, skipOverflowHiddenElements } =\n options\n // Allow using a callback to check the boundary\n // The default behavior is to check if the current target matches the boundary element or not\n // If undefined it'll check that target is never undefined (can happen as we recurse up the tree)\n const checkBoundary =\n typeof boundary === 'function' ? boundary : (node: any) => node !== boundary\n\n if (!isElement(target)) {\n throw new TypeError('Invalid target')\n }\n\n // Used to handle the top most element that can be scrolled\n const scrollingElement = document.scrollingElement || document.documentElement\n\n // Collect all the scrolling boxes, as defined in the spec: https://drafts.csswg.org/cssom-view/#scrolling-box\n const frames: Element[] = []\n let cursor: Element | null = target\n while (isElement(cursor) && checkBoundary(cursor)) {\n // Move cursor to parent\n cursor = getParentElement(cursor)\n\n // Stop when we reach the viewport\n if (cursor === scrollingElement) {\n frames.push(cursor)\n break\n }\n\n // Skip document.body if it's not the scrollingElement and documentElement isn't independently scrollable\n if (\n cursor != null &&\n cursor === document.body &&\n isScrollable(cursor) &&\n !isScrollable(document.documentElement)\n ) {\n continue\n }\n\n // Now we check if the element is scrollable, this code only runs if the loop haven't already hit the viewport or a custom boundary\n if (cursor != null && isScrollable(cursor, skipOverflowHiddenElements)) {\n frames.push(cursor)\n }\n }\n\n // Support pinch-zooming properly, making sure elements scroll into the visual viewport\n // Browsers that don't support visualViewport will report the layout viewport dimensions on document.documentElement.clientWidth/Height\n // and viewport dimensions on window.innerWidth/Height\n // https://www.quirksmode.org/mobile/viewports2.html\n // https://bokand.github.io/viewport/index.html\n const viewportWidth = window.visualViewport?.width ?? innerWidth\n const viewportHeight = window.visualViewport?.height ?? innerHeight\n const { scrollX, scrollY } = window\n\n const {\n height: targetHeight,\n width: targetWidth,\n top: targetTop,\n right: targetRight,\n bottom: targetBottom,\n left: targetLeft,\n } = target.getBoundingClientRect()\n\n // These values mutate as we loop through and generate scroll coordinates\n let targetBlock: number =\n block === 'start' || block === 'nearest'\n ? targetTop\n : block === 'end'\n ? targetBottom\n : targetTop + targetHeight / 2 // block === 'center\n let targetInline: number =\n inline === 'center'\n ? targetLeft + targetWidth / 2\n : inline === 'end'\n ? targetRight\n : targetLeft // inline === 'start || inline === 'nearest\n\n // Collect new scroll positions\n const computations: ScrollAction[] = []\n // In chrome there's no longer a difference between caching the `frames.length` to a var or not, so we don't in this case (size > speed anyways)\n for (let index = 0; index < frames.length; index++) {\n const frame = frames[index]\n\n // @TODO add a shouldScroll hook here that allows userland code to take control\n\n const { height, width, top, right, bottom, left } =\n frame.getBoundingClientRect()\n\n // If the element is already visible we can end it here\n // @TODO targetBlock and targetInline should be taken into account to be compliant with https://github.com/w3c/csswg-drafts/pull/1805/files#diff-3c17f0e43c20f8ecf89419d49e7ef5e0R1333\n if (\n scrollMode === 'if-needed' &&\n targetTop >= 0 &&\n targetLeft >= 0 &&\n targetBottom <= viewportHeight &&\n targetRight <= viewportWidth &&\n targetTop >= top &&\n targetBottom <= bottom &&\n targetLeft >= left &&\n targetRight <= right\n ) {\n // Break the loop and return the computations for things that are not fully visible\n return computations\n }\n\n const frameStyle = getComputedStyle(frame)\n const borderLeft = parseInt(frameStyle.borderLeftWidth as string, 10)\n const borderTop = parseInt(frameStyle.borderTopWidth as string, 10)\n const borderRight = parseInt(frameStyle.borderRightWidth as string, 10)\n const borderBottom = parseInt(frameStyle.borderBottomWidth as string, 10)\n\n let blockScroll: number = 0\n let inlineScroll: number = 0\n\n // The property existance checks for offfset[Width|Height] is because only HTMLElement objects have them, but any Element might pass by here\n // @TODO find out if the \"as HTMLElement\" overrides can be dropped\n const scrollbarWidth =\n 'offsetWidth' in frame\n ? (frame as HTMLElement).offsetWidth -\n (frame as HTMLElement).clientWidth -\n borderLeft -\n borderRight\n : 0\n const scrollbarHeight =\n 'offsetHeight' in frame\n ? (frame as HTMLElement).offsetHeight -\n (frame as HTMLElement).clientHeight -\n borderTop -\n borderBottom\n : 0\n\n const scaleX =\n 'offsetWidth' in frame\n ? (frame as HTMLElement).offsetWidth === 0\n ? 0\n : width / (frame as HTMLElement).offsetWidth\n : 0\n const scaleY =\n 'offsetHeight' in frame\n ? (frame as HTMLElement).offsetHeight === 0\n ? 0\n : height / (frame as HTMLElement).offsetHeight\n : 0\n\n if (scrollingElement === frame) {\n // Handle viewport logic (document.documentElement or document.body)\n\n if (block === 'start') {\n blockScroll = targetBlock\n } else if (block === 'end') {\n blockScroll = targetBlock - viewportHeight\n } else if (block === 'nearest') {\n blockScroll = alignNearest(\n scrollY,\n scrollY + viewportHeight,\n viewportHeight,\n borderTop,\n borderBottom,\n scrollY + targetBlock,\n scrollY + targetBlock + targetHeight,\n targetHeight\n )\n } else {\n // block === 'center' is the default\n blockScroll = targetBlock - viewportHeight / 2\n }\n\n if (inline === 'start') {\n inlineScroll = targetInline\n } else if (inline === 'center') {\n inlineScroll = targetInline - viewportWidth / 2\n } else if (inline === 'end') {\n inlineScroll = targetInline - viewportWidth\n } else {\n // inline === 'nearest' is the default\n inlineScroll = alignNearest(\n scrollX,\n scrollX + viewportWidth,\n viewportWidth,\n borderLeft,\n borderRight,\n scrollX + targetInline,\n scrollX + targetInline + targetWidth,\n targetWidth\n )\n }\n\n // Apply scroll position offsets and ensure they are within bounds\n // @TODO add more test cases to cover this 100%\n blockScroll = Math.max(0, blockScroll + scrollY)\n inlineScroll = Math.max(0, inlineScroll + scrollX)\n } else {\n // Handle each scrolling frame that might exist between the target and the viewport\n if (block === 'start') {\n blockScroll = targetBlock - top - borderTop\n } else if (block === 'end') {\n blockScroll = targetBlock - bottom + borderBottom + scrollbarHeight\n } else if (block === 'nearest') {\n blockScroll = alignNearest(\n top,\n bottom,\n height,\n borderTop,\n borderBottom + scrollbarHeight,\n targetBlock,\n targetBlock + targetHeight,\n targetHeight\n )\n } else {\n // block === 'center' is the default\n blockScroll = targetBlock - (top + height / 2) + scrollbarHeight / 2\n }\n\n if (inline === 'start') {\n inlineScroll = targetInline - left - borderLeft\n } else if (inline === 'center') {\n inlineScroll = targetInline - (left + width / 2) + scrollbarWidth / 2\n } else if (inline === 'end') {\n inlineScroll = targetInline - right + borderRight + scrollbarWidth\n } else {\n // inline === 'nearest' is the default\n inlineScroll = alignNearest(\n left,\n right,\n width,\n borderLeft,\n borderRight + scrollbarWidth,\n targetInline,\n targetInline + targetWidth,\n targetWidth\n )\n }\n\n const { scrollLeft, scrollTop } = frame\n // Ensure scroll coordinates are not out of bounds while applying scroll offsets\n blockScroll = Math.max(\n 0,\n Math.min(\n scrollTop + blockScroll / scaleY,\n frame.scrollHeight - height / scaleY + scrollbarHeight\n )\n )\n inlineScroll = Math.max(\n 0,\n Math.min(\n scrollLeft + inlineScroll / scaleX,\n frame.scrollWidth - width / scaleX + scrollbarWidth\n )\n )\n\n // Cache the offset so that parent frames can scroll this into view correctly\n targetBlock += scrollTop - blockScroll\n targetInline += scrollLeft - inlineScroll\n }\n\n computations.push({ el: frame, top: blockScroll, left: inlineScroll })\n }\n\n return computations\n}\n", "import { compute } from 'compute-scroll-into-view'\nimport type {\n Options as BaseOptions,\n ScrollAction,\n} from 'compute-scroll-into-view'\n\n/** @public */\nexport type Options =\n | StandardBehaviorOptions\n | CustomBehaviorOptions\n\n/**\n * Only scrolls if the `node` is partially out of view:\n * ```ts\n * scrollIntoView(node, { scrollMode: 'if-needed' })\n * ```\n * Skips scrolling `overflow: hidden` elements:\n * ```ts\n * scrollIntoView(node, { skipOverflowHiddenElements: true })\n * ```\n * When scrolling is needed do the least and smoothest scrolling possible:\n * ```ts\n * scrollIntoView(node, {\n * behavior: 'smooth',\n * scrollMode: 'if-needed',\n * block: 'nearest',\n * inline: 'nearest',\n * })\n * ```\n * @public\n */\nexport interface StandardBehaviorOptions extends BaseOptions {\n /**\n * @defaultValue 'auto\n */\n behavior?: ScrollBehavior\n}\n\n/** @public */\nexport interface CustomBehaviorOptions extends BaseOptions {\n behavior: CustomScrollBehaviorCallback\n}\n\n/** @public */\nexport type CustomScrollBehaviorCallback = (\n actions: ScrollAction[]\n) => T\n\nconst isStandardScrollBehavior = (\n options: any\n): options is StandardBehaviorOptions =>\n options === Object(options) && Object.keys(options).length !== 0\n\nconst isCustomScrollBehavior = (\n options: any\n): options is CustomBehaviorOptions =>\n typeof options === 'object' ? typeof options.behavior === 'function' : false\n\nconst getOptions = (options: any): StandardBehaviorOptions => {\n // Handle alignToTop for legacy reasons, to be compatible with the spec\n if (options === false) {\n return { block: 'end', inline: 'nearest' }\n }\n\n if (isStandardScrollBehavior(options)) {\n // compute.ts ensures the defaults are block: 'center' and inline: 'nearest', to conform to the spec\n return options\n }\n\n // if options = {}, options = true or options = null, based on w3c web platform test\n return { block: 'start', inline: 'nearest' }\n}\n\n// Determine if the element is part of the document (including shadow dom)\n// Derived from code of Andy Desmarais\n// https://terodox.tech/how-to-tell-if-an-element-is-in-the-dom-including-the-shadow-dom/\nconst isInDocument = (element: Node) => {\n let currentElement = element\n while (currentElement && currentElement.parentNode) {\n if (currentElement.parentNode === document) {\n return true\n } else if (currentElement.parentNode instanceof ShadowRoot) {\n currentElement = (currentElement.parentNode as ShadowRoot).host\n } else {\n currentElement = currentElement.parentNode\n }\n }\n return false\n}\n\n/**\n * Scrolls the given element into view, with options for when, and how.\n * Supports the same `options` as [`Element.prototype.scrollIntoView`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) with additions such as `scrollMode`, `behavior: Function` and `skipOverflowHiddenElements`.\n * @public\n */\nfunction scrollIntoView(\n target: Element,\n options?: StandardBehaviorOptions | boolean\n): void\n/**\n * Scrolls the given element into view, with options for when, and how.\n * Supports the same `options` as [`Element.prototype.scrollIntoView`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) with additions such as `scrollMode`, `behavior: Function` and `skipOverflowHiddenElements`.\n *\n * You can set the expected return type for `behavior: Function`:\n * ```ts\n * await scrollIntoView>(node, {\n * behavior: async actions => {\n * return Promise.all(actions.map(\n * // animate() resolves to `true` if anything was animated, `false` if the element already were in the end state\n * ({ el, left, top }) => animate(el, {scroll: {left, top}})\n * ))\n * }\n * })\n * ```\n * @public\n */\nfunction scrollIntoView(\n target: Element,\n options: CustomBehaviorOptions\n): T\nfunction scrollIntoView(\n target: Element,\n options?: StandardBehaviorOptions | CustomBehaviorOptions | boolean\n): T | void {\n // Browsers treats targets that aren't in the dom as a no-op and so should we\n if (!target.isConnected || !isInDocument(target)) {\n return\n }\n\n if (isCustomScrollBehavior(options)) {\n return options.behavior(compute(target, options))\n }\n\n const behavior = typeof options === 'boolean' ? undefined : options?.behavior\n\n for (const { el, top, left } of compute(target, getOptions(options))) {\n el.scroll({ top, left, behavior })\n }\n}\n\nexport default scrollIntoView\n", "export var top = 'top';\nexport var bottom = 'bottom';\nexport var right = 'right';\nexport var left = 'left';\nexport var auto = 'auto';\nexport var basePlacements = [top, bottom, right, left];\nexport var start = 'start';\nexport var end = 'end';\nexport var clippingParents = 'clippingParents';\nexport var viewport = 'viewport';\nexport var popper = 'popper';\nexport var reference = 'reference';\nexport var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {\n return acc.concat([placement + \"-\" + start, placement + \"-\" + end]);\n}, []);\nexport var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {\n return acc.concat([placement, placement + \"-\" + start, placement + \"-\" + end]);\n}, []); // modifiers that need to read the DOM\n\nexport var beforeRead = 'beforeRead';\nexport var read = 'read';\nexport var afterRead = 'afterRead'; // pure-logic modifiers\n\nexport var beforeMain = 'beforeMain';\nexport var main = 'main';\nexport var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)\n\nexport var beforeWrite = 'beforeWrite';\nexport var write = 'write';\nexport var afterWrite = 'afterWrite';\nexport var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];", "export default function getNodeName(element) {\n return element ? (element.nodeName || '').toLowerCase() : null;\n}", "export default function getWindow(node) {\n if (node == null) {\n return window;\n }\n\n if (node.toString() !== '[object Window]') {\n var ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n\n return node;\n}", "import getWindow from \"./getWindow.js\";\n\nfunction isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}\n\nfunction isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}\n\nfunction isShadowRoot(node) {\n // IE 11 has no ShadowRoot\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\n\nexport { isElement, isHTMLElement, isShadowRoot };", "import getNodeName from \"../dom-utils/getNodeName.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // This modifier takes the styles prepared by the `computeStyles` modifier\n// and applies them to the HTMLElements such as popper and arrow\n\nfunction applyStyles(_ref) {\n var state = _ref.state;\n Object.keys(state.elements).forEach(function (name) {\n var style = state.styles[name] || {};\n var attributes = state.attributes[name] || {};\n var element = state.elements[name]; // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n } // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe[cannot-write]\n\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (name) {\n var value = attributes[name];\n\n if (value === false) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state;\n var initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0'\n },\n arrow: {\n position: 'absolute'\n },\n reference: {}\n };\n Object.assign(state.elements.popper.style, initialStyles.popper);\n state.styles = initialStyles;\n\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n\n return function () {\n Object.keys(state.elements).forEach(function (name) {\n var element = state.elements[name];\n var attributes = state.attributes[name] || {};\n var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them\n\n var style = styleProperties.reduce(function (style, property) {\n style[property] = '';\n return style;\n }, {}); // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (attribute) {\n element.removeAttribute(attribute);\n });\n });\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'applyStyles',\n enabled: true,\n phase: 'write',\n fn: applyStyles,\n effect: effect,\n requires: ['computeStyles']\n};", "import { auto } from \"../enums.js\";\nexport default function getBasePlacement(placement) {\n return placement.split('-')[0];\n}", "export var max = Math.max;\nexport var min = Math.min;\nexport var round = Math.round;", "export default function getUAString() {\n var uaData = navigator.userAgentData;\n\n if (uaData != null && uaData.brands) {\n return uaData.brands.map(function (item) {\n return item.brand + \"/\" + item.version;\n }).join(' ');\n }\n\n return navigator.userAgent;\n}", "import getUAString from \"../utils/userAgent.js\";\nexport default function isLayoutViewport() {\n return !/^((?!chrome|android).)*safari/i.test(getUAString());\n}", "import { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport { round } from \"../utils/math.js\";\nimport getWindow from \"./getWindow.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getBoundingClientRect(element, includeScale, isFixedStrategy) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n\n var clientRect = element.getBoundingClientRect();\n var scaleX = 1;\n var scaleY = 1;\n\n if (includeScale && isHTMLElement(element)) {\n scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;\n scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;\n }\n\n var _ref = isElement(element) ? getWindow(element) : window,\n visualViewport = _ref.visualViewport;\n\n var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;\n var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;\n var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;\n var width = clientRect.width / scaleX;\n var height = clientRect.height / scaleY;\n return {\n width: width,\n height: height,\n top: y,\n right: x + width,\n bottom: y + height,\n left: x,\n x: x,\n y: y\n };\n}", "import getBoundingClientRect from \"./getBoundingClientRect.js\"; // Returns the layout rect of an element relative to its offsetParent. Layout\n// means it doesn't take into account transforms.\n\nexport default function getLayoutRect(element) {\n var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.\n // Fixes https://github.com/popperjs/popper-core/issues/1223\n\n var width = element.offsetWidth;\n var height = element.offsetHeight;\n\n if (Math.abs(clientRect.width - width) <= 1) {\n width = clientRect.width;\n }\n\n if (Math.abs(clientRect.height - height) <= 1) {\n height = clientRect.height;\n }\n\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: width,\n height: height\n };\n}", "import { isShadowRoot } from \"./instanceOf.js\";\nexport default function contains(parent, child) {\n var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n\n do {\n if (next && parent.isSameNode(next)) {\n return true;\n } // $FlowFixMe[prop-missing]: need a better way to handle this...\n\n\n next = next.parentNode || next.host;\n } while (next);\n } // Give up, the result is false\n\n\n return false;\n}", "import getWindow from \"./getWindow.js\";\nexport default function getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}", "import getNodeName from \"./getNodeName.js\";\nexport default function isTableElement(element) {\n return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;\n}", "import { isElement } from \"./instanceOf.js\";\nexport default function getDocumentElement(element) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]\n element.document) || window.document).documentElement;\n}", "import getNodeName from \"./getNodeName.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport { isShadowRoot } from \"./instanceOf.js\";\nexport default function getParentNode(element) {\n if (getNodeName(element) === 'html') {\n return element;\n }\n\n return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // $FlowFixMe[incompatible-return]\n // $FlowFixMe[prop-missing]\n element.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n element.parentNode || ( // DOM Element detected\n isShadowRoot(element) ? element.host : null) || // ShadowRoot detected\n // $FlowFixMe[incompatible-call]: HTMLElement is a Node\n getDocumentElement(element) // fallback\n\n );\n}", "import getWindow from \"./getWindow.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isHTMLElement, isShadowRoot } from \"./instanceOf.js\";\nimport isTableElement from \"./isTableElement.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getUAString from \"../utils/userAgent.js\";\n\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837\n getComputedStyle(element).position === 'fixed') {\n return null;\n }\n\n return element.offsetParent;\n} // `.offsetParent` reports `null` for fixed elements, while absolute elements\n// return the containing block\n\n\nfunction getContainingBlock(element) {\n var isFirefox = /firefox/i.test(getUAString());\n var isIE = /Trident/i.test(getUAString());\n\n if (isIE && isHTMLElement(element)) {\n // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport\n var elementCss = getComputedStyle(element);\n\n if (elementCss.position === 'fixed') {\n return null;\n }\n }\n\n var currentNode = getParentNode(element);\n\n if (isShadowRoot(currentNode)) {\n currentNode = currentNode.host;\n }\n\n while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {\n var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\n\nexport default function getOffsetParent(element) {\n var window = getWindow(element);\n var offsetParent = getTrueOffsetParent(element);\n\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {\n return window;\n }\n\n return offsetParent || getContainingBlock(element) || window;\n}", "export default function getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}", "import { max as mathMax, min as mathMin } from \"./math.js\";\nexport function within(min, value, max) {\n return mathMax(min, mathMin(value, max));\n}\nexport function withinMaxClamp(min, value, max) {\n var v = within(min, value, max);\n return v > max ? max : v;\n}", "export default function getFreshSideObject() {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n}", "import getFreshSideObject from \"./getFreshSideObject.js\";\nexport default function mergePaddingObject(paddingObject) {\n return Object.assign({}, getFreshSideObject(), paddingObject);\n}", "export default function expandToHashMap(value, keys) {\n return keys.reduce(function (hashMap, key) {\n hashMap[key] = value;\n return hashMap;\n }, {});\n}", "import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport contains from \"../dom-utils/contains.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport { within } from \"../utils/within.js\";\nimport mergePaddingObject from \"../utils/mergePaddingObject.js\";\nimport expandToHashMap from \"../utils/expandToHashMap.js\";\nimport { left, right, basePlacements, top, bottom } from \"../enums.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar toPaddingObject = function toPaddingObject(padding, state) {\n padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {\n placement: state.placement\n })) : padding;\n return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n};\n\nfunction arrow(_ref) {\n var _state$modifiersData$;\n\n var state = _ref.state,\n name = _ref.name,\n options = _ref.options;\n var arrowElement = state.elements.arrow;\n var popperOffsets = state.modifiersData.popperOffsets;\n var basePlacement = getBasePlacement(state.placement);\n var axis = getMainAxisFromPlacement(basePlacement);\n var isVertical = [left, right].indexOf(basePlacement) >= 0;\n var len = isVertical ? 'height' : 'width';\n\n if (!arrowElement || !popperOffsets) {\n return;\n }\n\n var paddingObject = toPaddingObject(options.padding, state);\n var arrowRect = getLayoutRect(arrowElement);\n var minProp = axis === 'y' ? top : left;\n var maxProp = axis === 'y' ? bottom : right;\n var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];\n var startDiff = popperOffsets[axis] - state.rects.reference[axis];\n var arrowOffsetParent = getOffsetParent(arrowElement);\n var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is\n // outside of the popper bounds\n\n var min = paddingObject[minProp];\n var max = clientSize - arrowRect[len] - paddingObject[maxProp];\n var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;\n var offset = within(min, center, max); // Prevents breaking syntax highlighting...\n\n var axisProp = axis;\n state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state,\n options = _ref2.options;\n var _options$element = options.element,\n arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;\n\n if (arrowElement == null) {\n return;\n } // CSS selector\n\n\n if (typeof arrowElement === 'string') {\n arrowElement = state.elements.popper.querySelector(arrowElement);\n\n if (!arrowElement) {\n return;\n }\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n if (!isHTMLElement(arrowElement)) {\n console.error(['Popper: \"arrow\" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));\n }\n }\n\n if (!contains(state.elements.popper, arrowElement)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(['Popper: \"arrow\" modifier\\'s `element` must be a child of the popper', 'element.'].join(' '));\n }\n\n return;\n }\n\n state.elements.arrow = arrowElement;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'arrow',\n enabled: true,\n phase: 'main',\n fn: arrow,\n effect: effect,\n requires: ['popperOffsets'],\n requiresIfExists: ['preventOverflow']\n};", "export default function getVariation(placement) {\n return placement.split('-')[1];\n}", "import { top, left, right, bottom, end } from \"../enums.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getWindow from \"../dom-utils/getWindow.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getComputedStyle from \"../dom-utils/getComputedStyle.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport { round } from \"../utils/math.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar unsetSides = {\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n left: 'auto'\n}; // Round the offsets to the nearest suitable subpixel based on the DPR.\n// Zooming can change the DPR, but it seems to report a value that will\n// cleanly divide the values into the appropriate subpixels.\n\nfunction roundOffsetsByDPR(_ref) {\n var x = _ref.x,\n y = _ref.y;\n var win = window;\n var dpr = win.devicePixelRatio || 1;\n return {\n x: round(x * dpr) / dpr || 0,\n y: round(y * dpr) / dpr || 0\n };\n}\n\nexport function mapToStyles(_ref2) {\n var _Object$assign2;\n\n var popper = _ref2.popper,\n popperRect = _ref2.popperRect,\n placement = _ref2.placement,\n variation = _ref2.variation,\n offsets = _ref2.offsets,\n position = _ref2.position,\n gpuAcceleration = _ref2.gpuAcceleration,\n adaptive = _ref2.adaptive,\n roundOffsets = _ref2.roundOffsets,\n isFixed = _ref2.isFixed;\n var _offsets$x = offsets.x,\n x = _offsets$x === void 0 ? 0 : _offsets$x,\n _offsets$y = offsets.y,\n y = _offsets$y === void 0 ? 0 : _offsets$y;\n\n var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref3.x;\n y = _ref3.y;\n var hasX = offsets.hasOwnProperty('x');\n var hasY = offsets.hasOwnProperty('y');\n var sideX = left;\n var sideY = top;\n var win = window;\n\n if (adaptive) {\n var offsetParent = getOffsetParent(popper);\n var heightProp = 'clientHeight';\n var widthProp = 'clientWidth';\n\n if (offsetParent === getWindow(popper)) {\n offsetParent = getDocumentElement(popper);\n\n if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {\n heightProp = 'scrollHeight';\n widthProp = 'scrollWidth';\n }\n } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it\n\n\n offsetParent = offsetParent;\n\n if (placement === top || (placement === left || placement === right) && variation === end) {\n sideY = bottom;\n var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]\n offsetParent[heightProp];\n y -= offsetY - popperRect.height;\n y *= gpuAcceleration ? 1 : -1;\n }\n\n if (placement === left || (placement === top || placement === bottom) && variation === end) {\n sideX = right;\n var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]\n offsetParent[widthProp];\n x -= offsetX - popperRect.width;\n x *= gpuAcceleration ? 1 : -1;\n }\n }\n\n var commonStyles = Object.assign({\n position: position\n }, adaptive && unsetSides);\n\n var _ref4 = roundOffsets === true ? roundOffsetsByDPR({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref4.x;\n y = _ref4.y;\n\n if (gpuAcceleration) {\n var _Object$assign;\n\n return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? \"translate(\" + x + \"px, \" + y + \"px)\" : \"translate3d(\" + x + \"px, \" + y + \"px, 0)\", _Object$assign));\n }\n\n return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + \"px\" : '', _Object$assign2[sideX] = hasX ? x + \"px\" : '', _Object$assign2.transform = '', _Object$assign2));\n}\n\nfunction computeStyles(_ref5) {\n var state = _ref5.state,\n options = _ref5.options;\n var _options$gpuAccelerat = options.gpuAcceleration,\n gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,\n _options$adaptive = options.adaptive,\n adaptive = _options$adaptive === void 0 ? true : _options$adaptive,\n _options$roundOffsets = options.roundOffsets,\n roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;\n\n if (process.env.NODE_ENV !== \"production\") {\n var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';\n\n if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {\n return transitionProperty.indexOf(property) >= 0;\n })) {\n console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: \"transform\", \"top\", \"right\", \"bottom\", \"left\".', '\\n\\n', 'Disable the \"computeStyles\" modifier\\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\\n\\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));\n }\n }\n\n var commonStyles = {\n placement: getBasePlacement(state.placement),\n variation: getVariation(state.placement),\n popper: state.elements.popper,\n popperRect: state.rects.popper,\n gpuAcceleration: gpuAcceleration,\n isFixed: state.options.strategy === 'fixed'\n };\n\n if (state.modifiersData.popperOffsets != null) {\n state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.popperOffsets,\n position: state.options.strategy,\n adaptive: adaptive,\n roundOffsets: roundOffsets\n })));\n }\n\n if (state.modifiersData.arrow != null) {\n state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.arrow,\n position: 'absolute',\n adaptive: false,\n roundOffsets: roundOffsets\n })));\n }\n\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-placement': state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'computeStyles',\n enabled: true,\n phase: 'beforeWrite',\n fn: computeStyles,\n data: {}\n};", "import getWindow from \"../dom-utils/getWindow.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar passive = {\n passive: true\n};\n\nfunction effect(_ref) {\n var state = _ref.state,\n instance = _ref.instance,\n options = _ref.options;\n var _options$scroll = options.scroll,\n scroll = _options$scroll === void 0 ? true : _options$scroll,\n _options$resize = options.resize,\n resize = _options$resize === void 0 ? true : _options$resize;\n var window = getWindow(state.elements.popper);\n var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);\n\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.addEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.addEventListener('resize', instance.update, passive);\n }\n\n return function () {\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.removeEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.removeEventListener('resize', instance.update, passive);\n }\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'eventListeners',\n enabled: true,\n phase: 'write',\n fn: function fn() {},\n effect: effect,\n data: {}\n};", "var hash = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nexport default function getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, function (matched) {\n return hash[matched];\n });\n}", "var hash = {\n start: 'end',\n end: 'start'\n};\nexport default function getOppositeVariationPlacement(placement) {\n return placement.replace(/start|end/g, function (matched) {\n return hash[matched];\n });\n}", "import getWindow from \"./getWindow.js\";\nexport default function getWindowScroll(node) {\n var win = getWindow(node);\n var scrollLeft = win.pageXOffset;\n var scrollTop = win.pageYOffset;\n return {\n scrollLeft: scrollLeft,\n scrollTop: scrollTop\n };\n}", "import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nexport default function getWindowScrollBarX(element) {\n // If has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n // Popper 1 is broken in this case and never had a bug report so let's assume\n // it's not an issue. I don't think anyone ever specifies width on \n // anyway.\n // Browsers where the left scrollbar doesn't cause an issue report `0` for\n // this (e.g. Edge 2019, IE11, Safari)\n return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;\n}", "import getWindow from \"./getWindow.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getViewportRect(element, strategy) {\n var win = getWindow(element);\n var html = getDocumentElement(element);\n var visualViewport = win.visualViewport;\n var width = html.clientWidth;\n var height = html.clientHeight;\n var x = 0;\n var y = 0;\n\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n var layoutViewport = isLayoutViewport();\n\n if (layoutViewport || !layoutViewport && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n\n return {\n width: width,\n height: height,\n x: x + getWindowScrollBarX(element),\n y: y\n };\n}", "import getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nimport { max } from \"../utils/math.js\"; // Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable\n\nexport default function getDocumentRect(element) {\n var _element$ownerDocumen;\n\n var html = getDocumentElement(element);\n var winScroll = getWindowScroll(element);\n var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n var x = -winScroll.scrollLeft + getWindowScrollBarX(element);\n var y = -winScroll.scrollTop;\n\n if (getComputedStyle(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n\n return {\n width: width,\n height: height,\n x: x,\n y: y\n };\n}", "import getComputedStyle from \"./getComputedStyle.js\";\nexport default function isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n var _getComputedStyle = getComputedStyle(element),\n overflow = _getComputedStyle.overflow,\n overflowX = _getComputedStyle.overflowX,\n overflowY = _getComputedStyle.overflowY;\n\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}", "import getParentNode from \"./getParentNode.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nexport default function getScrollParent(node) {\n if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return node.ownerDocument.body;\n }\n\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n\n return getScrollParent(getParentNode(node));\n}", "import getScrollParent from \"./getScrollParent.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getWindow from \"./getWindow.js\";\nimport isScrollParent from \"./isScrollParent.js\";\n/*\ngiven a DOM element, return the list of all scroll parents, up the list of ancesors\nuntil we get to the top window object. This list is what we attach scroll listeners\nto, because if any of these parent elements scroll, we'll need to re-calculate the\nreference element's position.\n*/\n\nexport default function listScrollParents(element, list) {\n var _element$ownerDocumen;\n\n if (list === void 0) {\n list = [];\n }\n\n var scrollParent = getScrollParent(element);\n var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);\n var win = getWindow(scrollParent);\n var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n var updatedList = list.concat(target);\n return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here\n updatedList.concat(listScrollParents(getParentNode(target)));\n}", "export default function rectToClientRect(rect) {\n return Object.assign({}, rect, {\n left: rect.x,\n top: rect.y,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n });\n}", "import { viewport } from \"../enums.js\";\nimport getViewportRect from \"./getViewportRect.js\";\nimport getDocumentRect from \"./getDocumentRect.js\";\nimport listScrollParents from \"./listScrollParents.js\";\nimport getOffsetParent from \"./getOffsetParent.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport contains from \"./contains.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport rectToClientRect from \"../utils/rectToClientRect.js\";\nimport { max, min } from \"../utils/math.js\";\n\nfunction getInnerBoundingClientRect(element, strategy) {\n var rect = getBoundingClientRect(element, false, strategy === 'fixed');\n rect.top = rect.top + element.clientTop;\n rect.left = rect.left + element.clientLeft;\n rect.bottom = rect.top + element.clientHeight;\n rect.right = rect.left + element.clientWidth;\n rect.width = element.clientWidth;\n rect.height = element.clientHeight;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\n\nfunction getClientRectFromMixedType(element, clippingParent, strategy) {\n return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\n\nfunction getClippingParents(element) {\n var clippingParents = listScrollParents(getParentNode(element));\n var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;\n var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n\n if (!isElement(clipperElement)) {\n return [];\n } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414\n\n\n return clippingParents.filter(function (clippingParent) {\n return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';\n });\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\n\nexport default function getClippingRect(element, boundary, rootBoundary, strategy) {\n var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n var clippingParents = [].concat(mainClippingParents, [rootBoundary]);\n var firstClippingParent = clippingParents[0];\n var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {\n var rect = getClientRectFromMixedType(element, clippingParent, strategy);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromMixedType(element, firstClippingParent, strategy));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}", "import getBasePlacement from \"./getBasePlacement.js\";\nimport getVariation from \"./getVariation.js\";\nimport getMainAxisFromPlacement from \"./getMainAxisFromPlacement.js\";\nimport { top, right, bottom, left, start, end } from \"../enums.js\";\nexport default function computeOffsets(_ref) {\n var reference = _ref.reference,\n element = _ref.element,\n placement = _ref.placement;\n var basePlacement = placement ? getBasePlacement(placement) : null;\n var variation = placement ? getVariation(placement) : null;\n var commonX = reference.x + reference.width / 2 - element.width / 2;\n var commonY = reference.y + reference.height / 2 - element.height / 2;\n var offsets;\n\n switch (basePlacement) {\n case top:\n offsets = {\n x: commonX,\n y: reference.y - element.height\n };\n break;\n\n case bottom:\n offsets = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n\n case right:\n offsets = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n\n case left:\n offsets = {\n x: reference.x - element.width,\n y: commonY\n };\n break;\n\n default:\n offsets = {\n x: reference.x,\n y: reference.y\n };\n }\n\n var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;\n\n if (mainAxis != null) {\n var len = mainAxis === 'y' ? 'height' : 'width';\n\n switch (variation) {\n case start:\n offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);\n break;\n\n case end:\n offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);\n break;\n\n default:\n }\n }\n\n return offsets;\n}", "import getClippingRect from \"../dom-utils/getClippingRect.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getBoundingClientRect from \"../dom-utils/getBoundingClientRect.js\";\nimport computeOffsets from \"./computeOffsets.js\";\nimport rectToClientRect from \"./rectToClientRect.js\";\nimport { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport } from \"../enums.js\";\nimport { isElement } from \"../dom-utils/instanceOf.js\";\nimport mergePaddingObject from \"./mergePaddingObject.js\";\nimport expandToHashMap from \"./expandToHashMap.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport default function detectOverflow(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$placement = _options.placement,\n placement = _options$placement === void 0 ? state.placement : _options$placement,\n _options$strategy = _options.strategy,\n strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,\n _options$boundary = _options.boundary,\n boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,\n _options$rootBoundary = _options.rootBoundary,\n rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,\n _options$elementConte = _options.elementContext,\n elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,\n _options$altBoundary = _options.altBoundary,\n altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,\n _options$padding = _options.padding,\n padding = _options$padding === void 0 ? 0 : _options$padding;\n var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n var altContext = elementContext === popper ? reference : popper;\n var popperRect = state.rects.popper;\n var element = state.elements[altBoundary ? altContext : elementContext];\n var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);\n var referenceClientRect = getBoundingClientRect(state.elements.reference);\n var popperOffsets = computeOffsets({\n reference: referenceClientRect,\n element: popperRect,\n strategy: 'absolute',\n placement: placement\n });\n var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));\n var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n var overflowOffsets = {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element\n\n if (elementContext === popper && offsetData) {\n var offset = offsetData[placement];\n Object.keys(overflowOffsets).forEach(function (key) {\n var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;\n var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key] += offset[axis] * multiply;\n });\n }\n\n return overflowOffsets;\n}", "import getVariation from \"./getVariation.js\";\nimport { variationPlacements, basePlacements, placements as allPlacements } from \"../enums.js\";\nimport detectOverflow from \"./detectOverflow.js\";\nimport getBasePlacement from \"./getBasePlacement.js\";\nexport default function computeAutoPlacement(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n placement = _options.placement,\n boundary = _options.boundary,\n rootBoundary = _options.rootBoundary,\n padding = _options.padding,\n flipVariations = _options.flipVariations,\n _options$allowedAutoP = _options.allowedAutoPlacements,\n allowedAutoPlacements = _options$allowedAutoP === void 0 ? allPlacements : _options$allowedAutoP;\n var variation = getVariation(placement);\n var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {\n return getVariation(placement) === variation;\n }) : basePlacements;\n var allowedPlacements = placements.filter(function (placement) {\n return allowedAutoPlacements.indexOf(placement) >= 0;\n });\n\n if (allowedPlacements.length === 0) {\n allowedPlacements = placements;\n\n if (process.env.NODE_ENV !== \"production\") {\n console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, \"auto\" cannot be used to allow \"bottom-start\".', 'Use \"auto-start\" instead.'].join(' '));\n }\n } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...\n\n\n var overflows = allowedPlacements.reduce(function (acc, placement) {\n acc[placement] = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding\n })[getBasePlacement(placement)];\n return acc;\n }, {});\n return Object.keys(overflows).sort(function (a, b) {\n return overflows[a] - overflows[b];\n });\n}", "import getOppositePlacement from \"../utils/getOppositePlacement.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getOppositeVariationPlacement from \"../utils/getOppositeVariationPlacement.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport computeAutoPlacement from \"../utils/computeAutoPlacement.js\";\nimport { bottom, top, start, right, left, auto } from \"../enums.js\";\nimport getVariation from \"../utils/getVariation.js\"; // eslint-disable-next-line import/no-unused-modules\n\nfunction getExpandedFallbackPlacements(placement) {\n if (getBasePlacement(placement) === auto) {\n return [];\n }\n\n var oppositePlacement = getOppositePlacement(placement);\n return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];\n}\n\nfunction flip(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n\n if (state.modifiersData[name]._skip) {\n return;\n }\n\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,\n specifiedFallbackPlacements = options.fallbackPlacements,\n padding = options.padding,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n _options$flipVariatio = options.flipVariations,\n flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,\n allowedAutoPlacements = options.allowedAutoPlacements;\n var preferredPlacement = state.options.placement;\n var basePlacement = getBasePlacement(preferredPlacement);\n var isBasePlacement = basePlacement === preferredPlacement;\n var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));\n var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {\n return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n flipVariations: flipVariations,\n allowedAutoPlacements: allowedAutoPlacements\n }) : placement);\n }, []);\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var checksMap = new Map();\n var makeFallbackChecks = true;\n var firstFittingPlacement = placements[0];\n\n for (var i = 0; i < placements.length; i++) {\n var placement = placements[i];\n\n var _basePlacement = getBasePlacement(placement);\n\n var isStartVariation = getVariation(placement) === start;\n var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;\n var len = isVertical ? 'width' : 'height';\n var overflow = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n altBoundary: altBoundary,\n padding: padding\n });\n var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;\n\n if (referenceRect[len] > popperRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide);\n }\n\n var altVariationSide = getOppositePlacement(mainVariationSide);\n var checks = [];\n\n if (checkMainAxis) {\n checks.push(overflow[_basePlacement] <= 0);\n }\n\n if (checkAltAxis) {\n checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);\n }\n\n if (checks.every(function (check) {\n return check;\n })) {\n firstFittingPlacement = placement;\n makeFallbackChecks = false;\n break;\n }\n\n checksMap.set(placement, checks);\n }\n\n if (makeFallbackChecks) {\n // `2` may be desired in some cases \u2013 research later\n var numberOfChecks = flipVariations ? 3 : 1;\n\n var _loop = function _loop(_i) {\n var fittingPlacement = placements.find(function (placement) {\n var checks = checksMap.get(placement);\n\n if (checks) {\n return checks.slice(0, _i).every(function (check) {\n return check;\n });\n }\n });\n\n if (fittingPlacement) {\n firstFittingPlacement = fittingPlacement;\n return \"break\";\n }\n };\n\n for (var _i = numberOfChecks; _i > 0; _i--) {\n var _ret = _loop(_i);\n\n if (_ret === \"break\") break;\n }\n }\n\n if (state.placement !== firstFittingPlacement) {\n state.modifiersData[name]._skip = true;\n state.placement = firstFittingPlacement;\n state.reset = true;\n }\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'flip',\n enabled: true,\n phase: 'main',\n fn: flip,\n requiresIfExists: ['offset'],\n data: {\n _skip: false\n }\n};", "import { top, bottom, left, right } from \"../enums.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\n\nfunction getSideOffsets(overflow, rect, preventedOffsets) {\n if (preventedOffsets === void 0) {\n preventedOffsets = {\n x: 0,\n y: 0\n };\n }\n\n return {\n top: overflow.top - rect.height - preventedOffsets.y,\n right: overflow.right - rect.width + preventedOffsets.x,\n bottom: overflow.bottom - rect.height + preventedOffsets.y,\n left: overflow.left - rect.width - preventedOffsets.x\n };\n}\n\nfunction isAnySideFullyClipped(overflow) {\n return [top, right, bottom, left].some(function (side) {\n return overflow[side] >= 0;\n });\n}\n\nfunction hide(_ref) {\n var state = _ref.state,\n name = _ref.name;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var preventedOffsets = state.modifiersData.preventOverflow;\n var referenceOverflow = detectOverflow(state, {\n elementContext: 'reference'\n });\n var popperAltOverflow = detectOverflow(state, {\n altBoundary: true\n });\n var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);\n var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);\n var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);\n var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);\n state.modifiersData[name] = {\n referenceClippingOffsets: referenceClippingOffsets,\n popperEscapeOffsets: popperEscapeOffsets,\n isReferenceHidden: isReferenceHidden,\n hasPopperEscaped: hasPopperEscaped\n };\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-reference-hidden': isReferenceHidden,\n 'data-popper-escaped': hasPopperEscaped\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'hide',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['preventOverflow'],\n fn: hide\n};", "import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport { top, left, right, placements } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport function distanceAndSkiddingToXY(placement, rects, offset) {\n var basePlacement = getBasePlacement(placement);\n var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;\n\n var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {\n placement: placement\n })) : offset,\n skidding = _ref[0],\n distance = _ref[1];\n\n skidding = skidding || 0;\n distance = (distance || 0) * invertDistance;\n return [left, right].indexOf(basePlacement) >= 0 ? {\n x: distance,\n y: skidding\n } : {\n x: skidding,\n y: distance\n };\n}\n\nfunction offset(_ref2) {\n var state = _ref2.state,\n options = _ref2.options,\n name = _ref2.name;\n var _options$offset = options.offset,\n offset = _options$offset === void 0 ? [0, 0] : _options$offset;\n var data = placements.reduce(function (acc, placement) {\n acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);\n return acc;\n }, {});\n var _data$state$placement = data[state.placement],\n x = _data$state$placement.x,\n y = _data$state$placement.y;\n\n if (state.modifiersData.popperOffsets != null) {\n state.modifiersData.popperOffsets.x += x;\n state.modifiersData.popperOffsets.y += y;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'offset',\n enabled: true,\n phase: 'main',\n requires: ['popperOffsets'],\n fn: offset\n};", "import computeOffsets from \"../utils/computeOffsets.js\";\n\nfunction popperOffsets(_ref) {\n var state = _ref.state,\n name = _ref.name;\n // Offsets are the actual position the popper needs to have to be\n // properly positioned near its reference element\n // This is the most basic placement, and will be adjusted by\n // the modifiers in the next step\n state.modifiersData[name] = computeOffsets({\n reference: state.rects.reference,\n element: state.rects.popper,\n strategy: 'absolute',\n placement: state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'popperOffsets',\n enabled: true,\n phase: 'read',\n fn: popperOffsets,\n data: {}\n};", "export default function getAltAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}", "import { top, left, right, bottom, start } from \"../enums.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport getAltAxis from \"../utils/getAltAxis.js\";\nimport { within, withinMaxClamp } from \"../utils/within.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport getFreshSideObject from \"../utils/getFreshSideObject.js\";\nimport { min as mathMin, max as mathMax } from \"../utils/math.js\";\n\nfunction preventOverflow(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n padding = options.padding,\n _options$tether = options.tether,\n tether = _options$tether === void 0 ? true : _options$tether,\n _options$tetherOffset = options.tetherOffset,\n tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;\n var overflow = detectOverflow(state, {\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n altBoundary: altBoundary\n });\n var basePlacement = getBasePlacement(state.placement);\n var variation = getVariation(state.placement);\n var isBasePlacement = !variation;\n var mainAxis = getMainAxisFromPlacement(basePlacement);\n var altAxis = getAltAxis(mainAxis);\n var popperOffsets = state.modifiersData.popperOffsets;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {\n placement: state.placement\n })) : tetherOffset;\n var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {\n mainAxis: tetherOffsetValue,\n altAxis: tetherOffsetValue\n } : Object.assign({\n mainAxis: 0,\n altAxis: 0\n }, tetherOffsetValue);\n var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;\n var data = {\n x: 0,\n y: 0\n };\n\n if (!popperOffsets) {\n return;\n }\n\n if (checkMainAxis) {\n var _offsetModifierState$;\n\n var mainSide = mainAxis === 'y' ? top : left;\n var altSide = mainAxis === 'y' ? bottom : right;\n var len = mainAxis === 'y' ? 'height' : 'width';\n var offset = popperOffsets[mainAxis];\n var min = offset + overflow[mainSide];\n var max = offset - overflow[altSide];\n var additive = tether ? -popperRect[len] / 2 : 0;\n var minLen = variation === start ? referenceRect[len] : popperRect[len];\n var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go\n // outside the reference bounds\n\n var arrowElement = state.elements.arrow;\n var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {\n width: 0,\n height: 0\n };\n var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();\n var arrowPaddingMin = arrowPaddingObject[mainSide];\n var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want\n // to include its full size in the calculation. If the reference is small\n // and near the edge of a boundary, the popper can overflow even if the\n // reference is not overflowing as well (e.g. virtual elements with no\n // width or height)\n\n var arrowLen = within(0, referenceRect[len], arrowRect[len]);\n var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;\n var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;\n var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);\n var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;\n var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;\n var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;\n var tetherMax = offset + maxOffset - offsetModifierValue;\n var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max);\n popperOffsets[mainAxis] = preventedOffset;\n data[mainAxis] = preventedOffset - offset;\n }\n\n if (checkAltAxis) {\n var _offsetModifierState$2;\n\n var _mainSide = mainAxis === 'x' ? top : left;\n\n var _altSide = mainAxis === 'x' ? bottom : right;\n\n var _offset = popperOffsets[altAxis];\n\n var _len = altAxis === 'y' ? 'height' : 'width';\n\n var _min = _offset + overflow[_mainSide];\n\n var _max = _offset - overflow[_altSide];\n\n var isOriginSide = [top, left].indexOf(basePlacement) !== -1;\n\n var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;\n\n var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;\n\n var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;\n\n var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);\n\n popperOffsets[altAxis] = _preventedOffset;\n data[altAxis] = _preventedOffset - _offset;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'preventOverflow',\n enabled: true,\n phase: 'main',\n fn: preventOverflow,\n requiresIfExists: ['offset']\n};", "export default function getHTMLElementScroll(element) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}", "import getWindowScroll from \"./getWindowScroll.js\";\nimport getWindow from \"./getWindow.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getHTMLElementScroll from \"./getHTMLElementScroll.js\";\nexport default function getNodeScroll(node) {\n if (node === getWindow(node) || !isHTMLElement(node)) {\n return getWindowScroll(node);\n } else {\n return getHTMLElementScroll(node);\n }\n}", "import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getNodeScroll from \"./getNodeScroll.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport { round } from \"../utils/math.js\";\n\nfunction isElementScaled(element) {\n var rect = element.getBoundingClientRect();\n var scaleX = round(rect.width) / element.offsetWidth || 1;\n var scaleY = round(rect.height) / element.offsetHeight || 1;\n return scaleX !== 1 || scaleY !== 1;\n} // Returns the composite rect of an element relative to its offsetParent.\n// Composite means it takes into account transforms as well as layout.\n\n\nexport default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n\n var isOffsetParentAnElement = isHTMLElement(offsetParent);\n var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);\n var documentElement = getDocumentElement(offsetParent);\n var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);\n var scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n var offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078\n isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n offsets = getBoundingClientRect(offsetParent, true);\n offsets.x += offsetParent.clientLeft;\n offsets.y += offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}", "import { modifierPhases } from \"../enums.js\"; // source: https://stackoverflow.com/questions/49875255\n\nfunction order(modifiers) {\n var map = new Map();\n var visited = new Set();\n var result = [];\n modifiers.forEach(function (modifier) {\n map.set(modifier.name, modifier);\n }); // On visiting object, check for its dependencies and visit them recursively\n\n function sort(modifier) {\n visited.add(modifier.name);\n var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);\n requires.forEach(function (dep) {\n if (!visited.has(dep)) {\n var depModifier = map.get(dep);\n\n if (depModifier) {\n sort(depModifier);\n }\n }\n });\n result.push(modifier);\n }\n\n modifiers.forEach(function (modifier) {\n if (!visited.has(modifier.name)) {\n // check for visited object\n sort(modifier);\n }\n });\n return result;\n}\n\nexport default function orderModifiers(modifiers) {\n // order based on dependencies\n var orderedModifiers = order(modifiers); // order based on phase\n\n return modifierPhases.reduce(function (acc, phase) {\n return acc.concat(orderedModifiers.filter(function (modifier) {\n return modifier.phase === phase;\n }));\n }, []);\n}", "export default function debounce(fn) {\n var pending;\n return function () {\n if (!pending) {\n pending = new Promise(function (resolve) {\n Promise.resolve().then(function () {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}", "export default function mergeByName(modifiers) {\n var merged = modifiers.reduce(function (merged, current) {\n var existing = merged[current.name];\n merged[current.name] = existing ? Object.assign({}, existing, current, {\n options: Object.assign({}, existing.options, current.options),\n data: Object.assign({}, existing.data, current.data)\n }) : current;\n return merged;\n }, {}); // IE11 does not support Object.values\n\n return Object.keys(merged).map(function (key) {\n return merged[key];\n });\n}", "import getCompositeRect from \"./dom-utils/getCompositeRect.js\";\nimport getLayoutRect from \"./dom-utils/getLayoutRect.js\";\nimport listScrollParents from \"./dom-utils/listScrollParents.js\";\nimport getOffsetParent from \"./dom-utils/getOffsetParent.js\";\nimport getComputedStyle from \"./dom-utils/getComputedStyle.js\";\nimport orderModifiers from \"./utils/orderModifiers.js\";\nimport debounce from \"./utils/debounce.js\";\nimport validateModifiers from \"./utils/validateModifiers.js\";\nimport uniqueBy from \"./utils/uniqueBy.js\";\nimport getBasePlacement from \"./utils/getBasePlacement.js\";\nimport mergeByName from \"./utils/mergeByName.js\";\nimport detectOverflow from \"./utils/detectOverflow.js\";\nimport { isElement } from \"./dom-utils/instanceOf.js\";\nimport { auto } from \"./enums.js\";\nvar INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';\nvar INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';\nvar DEFAULT_OPTIONS = {\n placement: 'bottom',\n modifiers: [],\n strategy: 'absolute'\n};\n\nfunction areValidElements() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return !args.some(function (element) {\n return !(element && typeof element.getBoundingClientRect === 'function');\n });\n}\n\nexport function popperGenerator(generatorOptions) {\n if (generatorOptions === void 0) {\n generatorOptions = {};\n }\n\n var _generatorOptions = generatorOptions,\n _generatorOptions$def = _generatorOptions.defaultModifiers,\n defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,\n _generatorOptions$def2 = _generatorOptions.defaultOptions,\n defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;\n return function createPopper(reference, popper, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n var state = {\n placement: 'bottom',\n orderedModifiers: [],\n options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),\n modifiersData: {},\n elements: {\n reference: reference,\n popper: popper\n },\n attributes: {},\n styles: {}\n };\n var effectCleanupFns = [];\n var isDestroyed = false;\n var instance = {\n state: state,\n setOptions: function setOptions(setOptionsAction) {\n var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;\n cleanupModifierEffects();\n state.options = Object.assign({}, defaultOptions, state.options, options);\n state.scrollParents = {\n reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],\n popper: listScrollParents(popper)\n }; // Orders the modifiers based on their dependencies and `phase`\n // properties\n\n var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers\n\n state.orderedModifiers = orderedModifiers.filter(function (m) {\n return m.enabled;\n }); // Validate the provided modifiers so that the consumer will get warned\n // if one of the modifiers is invalid for any reason\n\n if (process.env.NODE_ENV !== \"production\") {\n var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {\n var name = _ref.name;\n return name;\n });\n validateModifiers(modifiers);\n\n if (getBasePlacement(state.options.placement) === auto) {\n var flipModifier = state.orderedModifiers.find(function (_ref2) {\n var name = _ref2.name;\n return name === 'flip';\n });\n\n if (!flipModifier) {\n console.error(['Popper: \"auto\" placements require the \"flip\" modifier be', 'present and enabled to work.'].join(' '));\n }\n }\n\n var _getComputedStyle = getComputedStyle(popper),\n marginTop = _getComputedStyle.marginTop,\n marginRight = _getComputedStyle.marginRight,\n marginBottom = _getComputedStyle.marginBottom,\n marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can\n // cause bugs with positioning, so we'll warn the consumer\n\n\n if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {\n return parseFloat(margin);\n })) {\n console.warn(['Popper: CSS \"margin\" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));\n }\n }\n\n runModifierEffects();\n return instance.update();\n },\n // Sync update \u2013 it will always be executed, even if not necessary. This\n // is useful for low frequency updates where sync behavior simplifies the\n // logic.\n // For high frequency updates (e.g. `resize` and `scroll` events), always\n // prefer the async Popper#update method\n forceUpdate: function forceUpdate() {\n if (isDestroyed) {\n return;\n }\n\n var _state$elements = state.elements,\n reference = _state$elements.reference,\n popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements\n // anymore\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return;\n } // Store the reference and popper rects to be read by modifiers\n\n\n state.rects = {\n reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),\n popper: getLayoutRect(popper)\n }; // Modifiers have the ability to reset the current update cycle. The\n // most common use case for this is the `flip` modifier changing the\n // placement, which then needs to re-run all the modifiers, because the\n // logic was previously ran for the previous placement and is therefore\n // stale/incorrect\n\n state.reset = false;\n state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier\n // is filled with the initial data specified by the modifier. This means\n // it doesn't persist and is fresh on each update.\n // To ensure persistent data, use `${name}#persistent`\n\n state.orderedModifiers.forEach(function (modifier) {\n return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);\n });\n var __debug_loops__ = 0;\n\n for (var index = 0; index < state.orderedModifiers.length; index++) {\n if (process.env.NODE_ENV !== \"production\") {\n __debug_loops__ += 1;\n\n if (__debug_loops__ > 100) {\n console.error(INFINITE_LOOP_ERROR);\n break;\n }\n }\n\n if (state.reset === true) {\n state.reset = false;\n index = -1;\n continue;\n }\n\n var _state$orderedModifie = state.orderedModifiers[index],\n fn = _state$orderedModifie.fn,\n _state$orderedModifie2 = _state$orderedModifie.options,\n _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,\n name = _state$orderedModifie.name;\n\n if (typeof fn === 'function') {\n state = fn({\n state: state,\n options: _options,\n name: name,\n instance: instance\n }) || state;\n }\n }\n },\n // Async and optimistically optimized update \u2013 it will not be executed if\n // not necessary (debounced to run at most once-per-tick)\n update: debounce(function () {\n return new Promise(function (resolve) {\n instance.forceUpdate();\n resolve(state);\n });\n }),\n destroy: function destroy() {\n cleanupModifierEffects();\n isDestroyed = true;\n }\n };\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return instance;\n }\n\n instance.setOptions(options).then(function (state) {\n if (!isDestroyed && options.onFirstUpdate) {\n options.onFirstUpdate(state);\n }\n }); // Modifiers have the ability to execute arbitrary code before the first\n // update cycle runs. They will be executed in the same order as the update\n // cycle. This is useful when a modifier adds some persistent data that\n // other modifiers need to use, but the modifier is run after the dependent\n // one.\n\n function runModifierEffects() {\n state.orderedModifiers.forEach(function (_ref3) {\n var name = _ref3.name,\n _ref3$options = _ref3.options,\n options = _ref3$options === void 0 ? {} : _ref3$options,\n effect = _ref3.effect;\n\n if (typeof effect === 'function') {\n var cleanupFn = effect({\n state: state,\n name: name,\n instance: instance,\n options: options\n });\n\n var noopFn = function noopFn() {};\n\n effectCleanupFns.push(cleanupFn || noopFn);\n }\n });\n }\n\n function cleanupModifierEffects() {\n effectCleanupFns.forEach(function (fn) {\n return fn();\n });\n effectCleanupFns = [];\n }\n\n return instance;\n };\n}\nexport var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules\n\nexport { detectOverflow };", "import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nimport offset from \"./modifiers/offset.js\";\nimport flip from \"./modifiers/flip.js\";\nimport preventOverflow from \"./modifiers/preventOverflow.js\";\nimport arrow from \"./modifiers/arrow.js\";\nimport hide from \"./modifiers/hide.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles, offset, flip, preventOverflow, arrow, hide];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow }; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport * from \"./modifiers/index.js\";", "export const ROUND_ARROW =\n '';\n\nexport const BOX_CLASS = `__NAMESPACE_PREFIX__-box`;\nexport const CONTENT_CLASS = `__NAMESPACE_PREFIX__-content`;\nexport const BACKDROP_CLASS = `__NAMESPACE_PREFIX__-backdrop`;\nexport const ARROW_CLASS = `__NAMESPACE_PREFIX__-arrow`;\nexport const SVG_ARROW_CLASS = `__NAMESPACE_PREFIX__-svg-arrow`;\n\nexport const TOUCH_OPTIONS = {passive: true, capture: true};\n\nexport const TIPPY_DEFAULT_APPEND_TO = () => document.body;\n", "import {BasePlacement, Placement} from './types';\n\nexport function hasOwnProperty(\n obj: Record,\n key: string\n): boolean {\n return {}.hasOwnProperty.call(obj, key);\n}\n\nexport function getValueAtIndexOrReturn(\n value: T | [T | null, T | null],\n index: number,\n defaultValue: T | [T, T]\n): T {\n if (Array.isArray(value)) {\n const v = value[index];\n return v == null\n ? Array.isArray(defaultValue)\n ? defaultValue[index]\n : defaultValue\n : v;\n }\n\n return value;\n}\n\nexport function isType(value: any, type: string): boolean {\n const str = {}.toString.call(value);\n return str.indexOf('[object') === 0 && str.indexOf(`${type}]`) > -1;\n}\n\nexport function invokeWithArgsOrReturn(value: any, args: any[]): any {\n return typeof value === 'function' ? value(...args) : value;\n}\n\nexport function debounce(\n fn: (arg: T) => void,\n ms: number\n): (arg: T) => void {\n // Avoid wrapping in `setTimeout` if ms is 0 anyway\n if (ms === 0) {\n return fn;\n }\n\n let timeout: any;\n\n return (arg): void => {\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n fn(arg);\n }, ms);\n };\n}\n\nexport function removeProperties(obj: T, keys: string[]): Partial {\n const clone = {...obj};\n keys.forEach((key) => {\n delete (clone as any)[key];\n });\n return clone;\n}\n\nexport function splitBySpaces(value: string): string[] {\n return value.split(/\\s+/).filter(Boolean);\n}\n\nexport function normalizeToArray(value: T | T[]): T[] {\n return ([] as T[]).concat(value);\n}\n\nexport function pushIfUnique(arr: T[], value: T): void {\n if (arr.indexOf(value) === -1) {\n arr.push(value);\n }\n}\n\nexport function appendPxIfNumber(value: string | number): string {\n return typeof value === 'number' ? `${value}px` : value;\n}\n\nexport function unique(arr: T[]): T[] {\n return arr.filter((item, index) => arr.indexOf(item) === index);\n}\n\nexport function getNumber(value: string | number): number {\n return typeof value === 'number' ? value : parseFloat(value);\n}\n\nexport function getBasePlacement(placement: Placement): BasePlacement {\n return placement.split('-')[0] as BasePlacement;\n}\n\nexport function arrayFrom(value: ArrayLike): any[] {\n return [].slice.call(value);\n}\n\nexport function removeUndefinedProps(\n obj: Record\n): Partial> {\n return Object.keys(obj).reduce((acc, key) => {\n if (obj[key] !== undefined) {\n (acc as any)[key] = obj[key];\n }\n\n return acc;\n }, {});\n}\n", "import {ReferenceElement, Targets} from './types';\nimport {PopperTreeData} from './types-internal';\nimport {arrayFrom, isType, normalizeToArray, getBasePlacement} from './utils';\n\nexport function div(): HTMLDivElement {\n return document.createElement('div');\n}\n\nexport function isElement(value: unknown): value is Element | DocumentFragment {\n return ['Element', 'Fragment'].some((type) => isType(value, type));\n}\n\nexport function isNodeList(value: unknown): value is NodeList {\n return isType(value, 'NodeList');\n}\n\nexport function isMouseEvent(value: unknown): value is MouseEvent {\n return isType(value, 'MouseEvent');\n}\n\nexport function isReferenceElement(value: any): value is ReferenceElement {\n return !!(value && value._tippy && value._tippy.reference === value);\n}\n\nexport function getArrayOfElements(value: Targets): Element[] {\n if (isElement(value)) {\n return [value];\n }\n\n if (isNodeList(value)) {\n return arrayFrom(value);\n }\n\n if (Array.isArray(value)) {\n return value;\n }\n\n return arrayFrom(document.querySelectorAll(value));\n}\n\nexport function setTransitionDuration(\n els: (HTMLDivElement | null)[],\n value: number\n): void {\n els.forEach((el) => {\n if (el) {\n el.style.transitionDuration = `${value}ms`;\n }\n });\n}\n\nexport function setVisibilityState(\n els: (HTMLDivElement | null)[],\n state: 'visible' | 'hidden'\n): void {\n els.forEach((el) => {\n if (el) {\n el.setAttribute('data-state', state);\n }\n });\n}\n\nexport function getOwnerDocument(\n elementOrElements: Element | Element[]\n): Document {\n const [element] = normalizeToArray(elementOrElements);\n\n // Elements created via a