\\s*<\\/p>/gm, \"\");\n newBody.innerHTML = cleanHTML;\n // Remove links where class .nolinks\n substituteWithTextNodes(newBody.querySelectorAll(\".nolinks a[href]\"));\n // Restructure the document properly\n const fragment = structure(newBody, document);\n // Frankenstein the whole thing back together\n newBody.appendChild(fragment);\n newBody.prepend(rsUI);\n document.body.replaceWith(newBody);\n}\n","/**\n * www.openjs.com/scripts/events/keyboard_shortcuts/\n * Version : 2.01.B\n * By Binny V A\n * License : BSD\n */\n\"use strict\";\nexport default {\n all_shortcuts: {}, //All the shortcuts are stored in this array\n add: function(shortcut_combination, callback, opt) {\n //Provide a set of default options\n var default_options = {\n type: \"keydown\",\n propagate: false,\n disable_in_input: false,\n target: document,\n keycode: false,\n };\n if (!opt) {\n opt = default_options;\n } else {\n for (var dfo in default_options) {\n if (typeof opt[dfo] == \"undefined\") opt[dfo] = default_options[dfo];\n }\n }\n\n var ele = opt.target;\n if (typeof opt.target == \"string\")\n ele = document.getElementById(opt.target);\n var ths = this;\n shortcut_combination = shortcut_combination.toLowerCase();\n\n //The function to be called at keypress\n var func = function(e) {\n var code;\n e = e || window.event;\n\n if (opt[\"disable_in_input\"]) {\n //Don't enable shortcut keys in Input, Textarea fields\n var element;\n if (e.target) element = e.target;\n else if (e.srcElement) element = e.srcElement;\n if (element.nodeType == 3) element = element.parentNode;\n\n if (element.tagName == \"INPUT\" || element.tagName == \"TEXTAREA\") return;\n }\n\n //Find Which key is pressed\n if (e.keyCode) code = e.keyCode;\n else if (e.which) code = e.which;\n var character = String.fromCharCode(code).toLowerCase();\n\n if (code == 188) character = \",\"; //If the user presses , when the type is onkeydown\n if (code == 190) character = \".\"; //If the user presses , when the type is onkeydown\n\n var keys = shortcut_combination.split(\"+\");\n //Key Pressed - counts the number of valid keypresses - if it is same as the number of keys, the shortcut function is invoked\n var kp = 0;\n\n //Work around for stupid Shift key bug created by using lowercase - as a result the shift+num combination was broken\n var shift_nums = {\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 //Special Keys - and their codes\n var special_keys = {\n esc: 27,\n escape: 27,\n tab: 9,\n space: 32,\n return: 13,\n enter: 13,\n backspace: 8,\n\n scrolllock: 145,\n scroll_lock: 145,\n scroll: 145,\n capslock: 20,\n caps_lock: 20,\n caps: 20,\n numlock: 144,\n num_lock: 144,\n num: 144,\n\n pause: 19,\n break: 19,\n\n insert: 45,\n home: 36,\n delete: 46,\n end: 35,\n\n pageup: 33,\n page_up: 33,\n pu: 33,\n\n pagedown: 34,\n page_down: 34,\n pd: 34,\n\n left: 37,\n up: 38,\n right: 39,\n down: 40,\n\n f1: 112,\n f2: 113,\n f3: 114,\n f4: 115,\n f5: 116,\n f6: 117,\n f7: 118,\n f8: 119,\n f9: 120,\n f10: 121,\n f11: 122,\n f12: 123,\n };\n\n var modifiers = {\n shift: { wanted: false, pressed: false },\n ctrl: { wanted: false, pressed: false },\n alt: { wanted: false, pressed: false },\n meta: { wanted: false, pressed: false }, //Meta is Mac specific\n };\n\n if (e.ctrlKey) modifiers.ctrl.pressed = true;\n if (e.shiftKey) modifiers.shift.pressed = true;\n if (e.altKey) modifiers.alt.pressed = true;\n if (e.metaKey) modifiers.meta.pressed = true;\n\n for (var i = 0, k; (k = keys[i]), i < keys.length; i++) {\n //Modifiers\n if (k == \"ctrl\" || k == \"control\") {\n kp++;\n modifiers.ctrl.wanted = true;\n } else if (k == \"shift\") {\n kp++;\n modifiers.shift.wanted = true;\n } else if (k == \"alt\") {\n kp++;\n modifiers.alt.wanted = true;\n } else if (k == \"meta\") {\n kp++;\n modifiers.meta.wanted = true;\n } else if (k.length > 1) {\n //If it is a special key\n if (special_keys[k] == code) kp++;\n } else if (opt[\"keycode\"]) {\n if (opt[\"keycode\"] == code) kp++;\n } else {\n //The special keys did not match\n if (character == k) kp++;\n else {\n if (shift_nums[character] && e.shiftKey) {\n //Stupid Shift key bug created by using lowercase\n character = shift_nums[character];\n if (character == k) kp++;\n }\n }\n }\n }\n\n if (\n kp == keys.length &&\n modifiers.ctrl.pressed == modifiers.ctrl.wanted &&\n modifiers.shift.pressed == modifiers.shift.wanted &&\n modifiers.alt.pressed == modifiers.alt.wanted &&\n modifiers.meta.pressed == modifiers.meta.wanted\n ) {\n callback(e);\n\n if (!opt[\"propagate\"]) {\n //Stop the event\n //e.cancelBubble is supported by IE - this will kill the bubbling process.\n e.cancelBubble = true;\n e.returnValue = false;\n\n //e.stopPropagation works in Firefox.\n if (e.stopPropagation) {\n e.stopPropagation();\n e.preventDefault();\n }\n return false;\n }\n }\n };\n this.all_shortcuts[shortcut_combination] = {\n callback: func,\n target: ele,\n event: opt[\"type\"],\n };\n //Attach the function with the event\n if (ele.addEventListener) ele.addEventListener(opt[\"type\"], func, false);\n else if (ele.attachEvent) ele.attachEvent(\"on\" + opt[\"type\"], func);\n else ele[\"on\" + opt[\"type\"]] = func;\n },\n\n //Remove the shortcut - just specify the shortcut and I will remove the binding\n // 'remove':function(shortcut_combination) {\n // shortcut_combination = shortcut_combination.toLowerCase();\n // var binding = this.all_shortcuts[shortcut_combination];\n // delete(this.all_shortcuts[shortcut_combination])\n // if(!binding) return;\n // var type = binding['event'];\n // var ele = binding['target'];\n // var callback = binding['callback'];\n //\n // if(ele.detachEvent) ele.detachEvent('on'+type, callback);\n // else if(ele.removeEventListener) ele.removeEventListener(type, callback, false);\n // else ele['on'+type] = false;\n // }\n};\n","// @ts-check\n// Module core/ui\n// Handles the ReSpec UI\n/* jshint laxcomma:true */\n// XXX TODO\n// - look at other UI things to add\n// - list issues\n// - lint: validator, link checker, check WebIDL, ID references\n// - save to GitHub\n// - make a release candidate that people can test\n// - once we have something decent, merge, ship as 3.2.0\n\nimport { fetchAsset } from \"./text-loader.js\";\nimport { hyperHTML } from \"./import-maps.js\";\nimport { markdownToHtml } from \"./markdown.js\";\nimport shortcut from \"../../js/shortcut.js\";\nimport { sub } from \"./pubsubhub.js\";\nexport const name = \"core/ui\";\n\n// Opportunistically inserts the style, with the chance to reduce some FOUC\ninsertStyle();\n\nasync function loadStyle() {\n try {\n return (await import(\"text!../../assets/ui.css\")).default;\n } catch {\n return fetchAsset(\"ui.css\");\n }\n}\n\nasync function insertStyle() {\n const styleElement = document.createElement(\"style\");\n styleElement.id = \"respec-ui-styles\";\n styleElement.textContent = await loadStyle();\n styleElement.classList.add(\"removeOnSave\");\n document.head.appendChild(styleElement);\n return styleElement;\n}\n\nfunction ariaDecorate(elem, ariaMap) {\n if (!elem) {\n return;\n }\n Array.from(ariaMap).forEach(([name, value]) => {\n elem.setAttribute(`aria-${name}`, value);\n });\n}\n\nconst respecUI = hyperHTML`