"use strict";(()=>{function i(e){let s=`<h1 style="text-size: 3rem;">ERROR: Couldn't find any element using the query: "${e}".</h1>
    <p>Make sure there were no errors in your markdown.<br>If you need help, please contact the developers by writing an issue at <a href="https://github.com/Mochitto/Anki-code-Cards">our GitHub page</a></p>`,t=document.querySelectorAll(e);if(!t.length)throw document.body.innerHTML=s,new Error(`Couldn't find any element matching ${e}`);return t}var u=document.querySelector(".nightMode");u&&document.documentElement.classList.add("nightMode");var f=i(".tab_group"),o,r,l,d;for(let e of f)e.addEventListener("click",m);window.addEventListener("keydown",function(e){if(r=i(".tab__label"),e.altKey&&/^[0-9]$/.test(e.key)){let s=parseInt(e.key)-1,t=r[s];t instanceof HTMLButtonElement&&t.click()}});function m(e){e.preventDefault();let s=e.currentTarget,t=e.target;if(t instanceof HTMLSpanElement&&(t=t.parentElement),!(t instanceof Element&&s instanceof Element&&t.classList.contains("tab__label")))return;o=i(".tab");let n=t.parentElement;n!=null&&n.classList.contains("tab--isfullscreen")?b(n):n!=null&&n.classList.contains("tab--isactive")?L(n):E(t,s)}function b(e){e.classList.add("tab--isactive"),e.classList.remove("tab--isfullscreen"),(l==null?void 0:l.parentElement)==e.parentElement?d.classList.add("tab--isactive"):l==null||l.classList.add("tab--isactive")}function L(e){e.classList.remove("tab--isactive"),e.classList.add("tab--isfullscreen");for(let s of o)s.classList.contains("tab--isactive")&&(l=s,d=e,s.classList.remove("tab--isactive"))}function E(e,s){var n,a;let t=document.querySelector(".tab--isfullscreen");for(let c of s.children)c.classList.remove("tab--isactive"),c.classList.remove("tab--isfullscreen");t?(t.classList.remove("tab--isfullscreen"),(n=e.parentElement)==null||n.classList.add("tab--isfullscreen")):(a=e.parentElement)==null||a.classList.add("tab--isactive")}})();
