!function(){"use strict";!function(){for(const o of document.querySelectorAll(".primary")){if(o.querySelector("div.switch"))return console.debug("Skipping tabs due to existing blockswitches");var e=function(e){var t=s('<div class="tabs"></div>');return e.prepend(t),t}(o);c(o,e).tabElement.classList.add("selected"),o.querySelector(".title").remove(),o.classList.add("tabs-content")}for(const r of document.querySelectorAll(".secondary")){var t,n=function(e){let t=e.previousElementSibling;for(;t&&!t.classList.contains("primary");)t=t.previousElementSibling;return t}(r);n?(t=n.querySelector(".tabs"),(t=c(r,t)).content.classList.add("hidden"),n.append(t.content),r.remove()):console.error("Found secondary block with no primary sibling")}}();for(const n of document.querySelectorAll(".tab")){var e=r(n);n.addEventListener("click",t.bind(n,e)),n.textContent===window.localStorage.getItem(e)&&o(n)}function c(e,t){var n=e.querySelector(".title").textContent,o=e.querySelectorAll(".content").item(0),e=function(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}(e,".colist"),e=(e&&o.append(e),s('<div class="tab">'+n+"</div>"));return e.dataset.blockName=n,o.dataset.blockName=n,t.append(e),{tabElement:e,content:o}}function s(e){var t=document.createElement("template");return t.innerHTML=e,t.content.firstChild}function t(e){var t=this.textContent;window.localStorage.setItem(e,t);for(const n of document.querySelectorAll(".tab"))r(n)===e&&n.textContent===t&&o(n)}function o(e){for(const t of e.parentNode.children)t.classList.remove("selected");e.classList.add("selected");for(const n of e.parentNode.parentNode.children)n.classList.contains("content")&&(e.dataset.blockName===n.dataset.blockName?n.classList.remove("hidden"):n.classList.add("hidden"))}function r(e){var t=[];for(e of e.parentNode.querySelectorAll(".tab"))t.push(e.textContent.toLowerCase());return t.sort().join("-")}}();