"use strict";{const e=self,t=e.document;(self.webpackChunkStylus=self.webpackChunkStylus||[]).push([["edit_keymap-help_js"],{5479:(e,n,o)=>{o.r(n),n.keymapHelp=function(){const PREF="editor.keyMap",keyMap=mergeKeyMaps({},prefs.__values[PREF],r.extraKeys),keyMapSorted=Object.keys(keyMap).map(key=>({key,cmd:keyMap[key]})).sort((e,t)=>e.cmd<t.cmd||e.cmd===t.cmd&&e.key<t.key?-1:1),table=TPL.cloneNode(!0),row=(tableBody=table.tBodies[0]).rows[0],cellA=row.children[0],cellB=row.children[1];tableBody.textContent="";for(const{key,cmd}of keyMapSorted)cellA.textContent=key,cellB.textContent=cmd,tableBody.appendChild(row.cloneNode(!0));edit_util.helpPopup.show(util.t("cm_keyMap")+": "+prefs.__values[PREF],table,{},PREF),inputs=table.$$("input"),inputs[0].on("keydown",hotkeyHandler),inputs[1].focus(),table.oninput=filterTable};var r=o(6199),dom=o(7986),localization=o(7501),prefs=o(492),util=o(6940),edit_util=o(4849);const TPL=localization.htmlToTemplate("<table class=keymap-list><thead><tr><th><input i18n=placeholder:helpKeyMapHotkey type=search></th><th><input i18n=placeholder:helpKeyMapCommand type=search></th></tr></thead><tbody><tr><td></td><td></td></tr></tbody></table>");let inputs,tableBody;function hotkeyHandler(event){const keyName=r.CodeMirror.keyName(event);if("Esc"===keyName||"Tab"===keyName||"Shift-Tab"===keyName)return;event.preventDefault(),event.stopPropagation();const keyMap={};keyMap[keyName.replace(/(Shift|Ctrl|Alt|Cmd)$/,"$&-dummy")]="";const normalizedKey=Object.keys(r.CodeMirror.normalizeKeyMap(keyMap))[0];this.value=normalizedKey.replace("-dummy",""),filterTable(event)}function filterTable(event){const input=event.target,col=input.parentNode.cellIndex;inputs[1-col].value="";for(const row of tableBody.rows){const cell=row.children[col],text=cell.textContent,query=util.stringAsRegExp(input.value,"gi"),test=query.test(text);if(row.style.display=input.value&&!1===test?"none":"",input.value&&test){cell.textContent="";let offset=0;text.replace(query,(match,index)=>{index>offset&&cell.appendChild(t.createTextNode(text.substring(offset,index))),cell.appendChild(dom.$create("mark",match)),offset=index+match.length}),offset<text.length&&cell.appendChild(t.createTextNode(text.substring(offset)))}else cell.textContent=text;const otherCell=row.children[1-col];otherCell.children.length&&(otherCell.textContent=otherCell.innerText)}}function mergeKeyMaps(merged,...more){return more.forEach(keyMap=>{"string"==typeof keyMap&&(keyMap=r.CodeMirror.keyMap[keyMap]),Object.keys(keyMap).forEach(key=>{let cmd=keyMap[key];merged[key]||key.match(/^[a-z]/)||"..."===cmd||("function"==typeof cmd?(cmd=cmd.toString().replace(/^function.*?{[\s\r\n]*([\s\S]+?)[\s\r\n]*}$/,"$1"),merged[key]=util.clipString(cmd,200)):merged[key]=cmd)}),keyMap.fallthrough&&(merged=mergeKeyMaps(merged,keyMap.fallthrough))}),merged}}}])}