import"./modulepreload-polyfill-B5Qt9EMX.js";const g="levkin-spec-prefs",a=[.875,1,1.125,1.25,1.375,1.5],d=1;function s(){try{return JSON.parse(localStorage.getItem(g)||"{}")}catch{return{}}}function f(e){localStorage.setItem(g,JSON.stringify(e))}function E(e){const n=a.indexOf(e);return n===-1?d:n}const m={light:"#e8e4dc",dim:"#b8b2a6",dark:"#080807"};function h(e){document.documentElement.dataset.theme=e,document.documentElement.style.colorScheme=e==="dark"?"dark":"light";let n=document.querySelector('meta[name="theme-color"]');n||(n=document.createElement("meta"),n.name="theme-color",document.head.appendChild(n)),n.content=m[e]||m.light;const c=document.querySelector(`input[name="theme"][value="${e}"]`);c&&(c.checked=!0)}function S(e){document.documentElement.style.setProperty("--font-scale",String(e));const n=document.getElementById("font-scale-readout");n&&(n.textContent=`${Math.round(e*100)}%`),document.querySelectorAll(".font-btn").forEach(c=>{const r=c.dataset.action;r==="decrease"&&(c.disabled=e<=a[0]),r==="increase"&&(c.disabled=e>=a[a.length-1])})}function p(){const e=s(),n=e.theme||"light",c=e.fontScale||a[d];let r=E(c);h(n),S(c),document.querySelectorAll('input[name="theme"]').forEach(o=>{o.addEventListener("change",()=>{const t={...s(),theme:o.value};f(t),h(o.value)})}),document.querySelectorAll(".font-btn").forEach(o=>{o.addEventListener("click",()=>{const t=o.dataset.action;t==="reset"?r=d:t==="decrease"&&r>0?r-=1:t==="increase"&&r<a.length-1&&(r+=1);const i=a[r],l={...s(),fontScale:i};f(l),S(i)})})}function v(){const e=document.querySelectorAll(".clause-anchor[id]"),n=document.querySelectorAll(".toc nav a");if(!e.length||!n.length)return;const c=o=>{n.forEach(t=>{const i=t.getAttribute("href")===`#${o}`;t.classList.toggle("is-active",i),i?t.setAttribute("aria-current","location"):t.removeAttribute("aria-current")})};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){const o=()=>{var l;let t=(l=e[0])==null?void 0:l.id;const i=120;e.forEach(u=>{u.getBoundingClientRect().top-i<=0&&(t=u.id)}),t&&c(t)};window.addEventListener("scroll",o,{passive:!0}),o();return}const r=new IntersectionObserver(o=>{o.forEach(t=>{t.isIntersecting&&c(t.target.id)})},{rootMargin:"-30% 0px -60% 0px"});e.forEach(o=>r.observe(o))}p();v();
