{"version":3,"sources":["site.js"],"names":["searchBox","document","getElementById","search","tableSearch","querySelector","menuToggle","mainMenu","addEventListener","classList","toggle","e","defaultPrevented","key","keyCode","ctrlKey","contains","focus","remove","querySelectorAll","forEach","item","event","preventDefault","input","filter","tr","i","target","value","toUpperCase","nextSibling","getElementsByTagName","length","rowContent","textContent","replace","style","display","includes","down_class","up_class","regex_dir","element","reclassify","dir","className","nodeName","table","parentNode","test","column_index","nodes","cells","indexOf","org_tbody","tBodies","rows","slice","call","reverse","sort","a","b","x","innerText","y","isNaN","localeCompare","clone_tbody","cloneNode","appendChild","splice","replaceChild","error"],"mappings":"aAEA,IAAMA,UAAYC,SAASC,eAAe,cACpCC,OAASF,SAASC,eAAe,cACjCE,YAAcH,SAASI,cAAc,sBACrCC,WAAaL,SAASC,eAAe,cACrCK,SAAWN,SAASC,eAAe,YAEzCI,WAAWE,iBAAiB,SAAS,WACpCD,SAASE,UAAUC,OAAO,aAG3BT,SAASO,iBAAiB,SAAS,SAASG,GAC3C,IAAIA,EAAEC,iBAAN,CACA,IAAIC,EAAMF,EAAEE,KAAOF,EAAEG,SAEjBH,EAAEI,SAAoB,MAARF,GAAuB,KAARA,GAC5Bb,UAAUS,UAAUO,SAAS,aAChChB,UAAUS,UAAUC,OAAO,WAC3BV,UAAUS,UAAUC,OAAO,UAC3BP,OAAOc,SAGG,WAARJ,GAA4B,QAARA,GAAyB,KAARA,IACpCb,UAAUS,UAAUO,SAAS,YAChChB,UAAUS,UAAUC,OAAO,WAC3BV,UAAUS,UAAUC,OAAO,WAExBH,SAASE,UAAUO,SAAS,WAC/BT,SAASE,UAAUS,OAAO,eAK7BjB,SAASkB,iBAAiB,kBAAkBC,SAAQ,SAAAC,GACnDA,EAAKb,iBAAiB,SAAS,SAAAc,GAC9BA,EAAMC,iBACNvB,UAAUS,UAAUC,OAAO,WAC3BV,UAAUS,UAAUC,OAAO,UAC3BP,OAAOc,iBAKmB,IAAjBb,aAAgCA,aAC1CA,YAAYI,iBAAi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9C,IAHA,IAAIG,EAAcd,EAAUe,YAGrBb,EAAKxB,QACboC,EAAYE,YAAYd,EAAKe,OAAO,EAAG,GAAG,IAIzCxB,EAAMyB,aAAaJ,EAAad,IAE/B,MAAOmB","sourcesContent":["\n/* ------------ SEARCH BOX TOGGLER & FOCUS ---------------- */\nconst searchBox = document.getElementById('search-box')\nconst search = document.getElementById('edit-query')\nconst tableSearch = document.querySelector('input.table_search')\nconst menuToggle = document.getElementById('menuToggle')\nconst mainMenu = document.getElementById('mainMenu')\n\nmenuToggle.addEventListener('click', () => {\n\tmainMenu.classList.toggle('hidden')\n})\n\ndocument.addEventListener('keyup', function(e) {\n\tif (e.defaultPrevented) return\n\tvar key = e.key || e.keyCode\n\n\tif (e.ctrlKey && (key === 's' || key === 83)) {\n\t\tif (searchBox.classList.contains('-top-72')) {\n\t\t\tsearchBox.classList.toggle('-top-72')\n\t\t\tsearchBox.classList.toggle('-top-0')\n\t\t\tsearch.focus()\n\t\t}\n\t}\n\tif (key === 'Escape' || key === 'Esc' || key === 27) {\n\t\tif (searchBox.classList.contains('-top-0')) {\n\t\t\tsearchBox.classList.toggle('-top-72')\n\t\t\tsearchBox.classList.toggle('-top-0')\n\t\t}\n\t\tif (mainMenu.classList.contains('hidden')) {\n\t\t\tmainMenu.classList.remove('hidden')\n\t\t}\n\t}\n})\n\ndocument.querySelectorAll('.search-toggle').forEach(item => {\n\titem.addEventListener('click', event => {\n\t\tevent.preventDefault()\n\t\tsearchBox.classList.toggle('-top-72')\n\t\tsearchBox.classList.toggle('-top-0')\n\t\tsearch.focus\n\t})\n})\n\n/* table search */\nif (typeof(tableSearch) !== 'undefined' && tableSearch) {\n\ttableSearch.addEventListener('input', function(event){\n\t\tvar input, filter, table, tr, i;\n\t\tinput = event.target;\n\t\tfilter = input.value.toUpperCase();\n\t\ttable = input.nextSibling;\n\n\t\ttr = table.nextSibling.getElementsByTagName(\"tr\")\n\n\t\tfor (i = 0; i < tr.length; i++) {\n\t\t\n\t\t\tvar rowContent = tr[i].textContent; \n\t\t\trowContent = rowContent.replace(/[\\s]+/g, ' ');\n\n\t\t\tif (rowContent) {\n\t\t\t\ttr[i].style.display = rowContent.toUpperCase().includes(filter) ? \"\" : \"none\";\n\t\t\t} \n\n\t\t}\n\t})\n}\n\n/**\n * sortable 1.0\n */\ndocument.addEventListener('click', function (e) {\n\tvar down_class = ' dir-d '\n\tvar up_class = ' dir-u '\n\tvar regex_dir = / dir-(u|d) /\n\tvar regex_table = /\\bsortable\\b/\n\tvar element = e.target\n \n\tfunction reclassify(element, dir) {\n\t element.className = element.className.replace(regex_dir, '') + dir\n\t}\n \n\tif (element.nodeName === 'TH') {\n\t try {\n\t\t// var table = element.offsetParent; // Fails with positioned table elements\n\t\t// this is the only way to make really, really sure. A few more bytes though... >:\n\t\tvar table = element.parentNode.parentNode.parentNode\n\t\tif (regex_table.test(table.className)) {\n\t\t var column_index\n\t\t var tr = element.parentNode\n\t\t var nodes = tr.cells\n \n\t\t // reset thead cells and get column index\n\t\t for (var i = 0; i < nodes.length; i++) {\n\t\t\tif (nodes[i] === element) {\n\t\t\t column_index = i\n\t\t\t} else {\n\t\t\t reclassify(nodes[i], '')\n\t\t\t}\n\t\t }\n \n\t\t var dir = down_class\n \n\t\t // check if we're sorting up or down, and update the css accordingly\n\t\t if (element.className.indexOf(down_class) !== -1) {\n\t\t\tdir = up_class\n\t\t }\n \n\t\t reclassify(element, dir)\n \n\t\t // extract all table rows, so the sorting can start.\n\t\t var org_tbody = table.tBodies[0]\n \n\t\t // get the array rows in an array, so we can sort them...\n\t\t var rows = [].slice.call(org_tbody.rows, 0)\n \n\t\t var reverse = dir === up_class\n \n\t\t // sort them using custom built in array sort.\n\t\t rows.sort(function (a, b) {\n\t\t\tvar x = (reverse ? a : b).cells[column_index].innerText\n\t\t\tvar y = (reverse ? b : a).cells[column_index].innerText\n\t\t\treturn isNaN(x - y) ? x.localeCompare(y) : x - y\n\t\t })\n \n\t\t // Make a clone without contents\n\t\t var clone_tbody = org_tbody.cloneNode()\n \n\t\t // Build a sorted table body and replace the old one.\n\t\t while (rows.length) {\n\t\t\tclone_tbody.appendChild(rows.splice(0, 1)[0])\n\t\t }\n \n\t\t // And finally insert the end result\n\t\t table.replaceChild(clone_tbody, org_tbody)\n\t\t}\n\t } catch (error) {\n\t\t// console.log(error)\n\t }\n\t}\n })"]}