1import{C as e,F as t,M as n,P as r,S as i,T as a,w as o}from"./index-DMA67SNg.js";var s=o(`<canvas class=peach-rune-canvas style=display:block>`),c=17,l=c*2.3,u=c*1.35,d=c*.18,f=[18,24,14],p=`#F49C70`;function m(){let e=getComputedStyle(document.documentElement).getPropertyValue(`--peach-accent`).trim();return/^#[0-9a-fA-F]{6}$/.test(e)?e:p}function h(o){let h,g=0,_=!1,v=p,y=[244,156,112];function b(e){v=e,y=[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}return t(()=>{let e=h.getContext(`2d`);if(!e)return;b(m());let t=new MutationObserver(()=>{let e=m();e!==v&&b(e)});t.observe(document.documentElement,{attributes:!0,attributeFilter:[`style`]});let n=o.width,i=o.height,a=Math.ceil(n/(u+d))+4,s=Math.floor(i/l)+1,p=s*a,x=Math.min(8,Math.max(3,Math.floor(p*.03))),S=()=>({row:Math.floor(Math.random()*s),col:Math.floor(Math.random()*a),phase:Math.random(),speed:.4+Math.random()*.4,lifetime:2e3+Math.random()*3e3,age:0}),C=Array.from({length:x},S),w=Array.from({length:s},()=>Math.random()*o.runeString.length*(u+d)),T=o.runeString.length*(u+d)||1,E=performance.now(),D=t=>{let r=Math.min(t-E,64);E=t,e.clearRect(0,0,n,i),e.fillStyle=`#1a1410`,e.fillRect(0,0,n,i),e.font=`${c}px PeachScript, monospace`,e.textBaseline=`alphabetic`;let p=new Map;for(let e of C){e.age+=r,e.phase=(e.phase+e.speed*r/1e3)%1;let t=e.age/e.lifetime,n=Math.sin(t*Math.PI),i=Math.sin(e.phase*Math.PI*2)*.5+.5,a=Math.max(0,n)*i*.85;p.set(`${e.row},${e.col}`,a),e.age>=e.lifetime&&Object.assign(e,S())}let[m,h,_]=y,v=o.runeString,b=v.length;if(b===0){g=requestAnimationFrame(D);return}for(let t=0;t<s;t++){let i=f[t%f.length];w[t]=(w[t]+i*r/1e3)%T;let o=t*l+c+12;for(let r=0;r<a;r++){let i=r*(u+d)-w[t]%(u+d);if(i<-u||i>n+u)continue;let a=v[((Math.floor(w[t]/(u+d))+r)%b+b)%b],s=p.get(`${t},${r}`)??0;s>.01?(e.save(),e.shadowColor=`rgba(${m}, ${h}, ${_}, ${s*.9})`,e.shadowBlur=10,e.fillStyle=`rgba(${m}, ${h}, ${_}, ${.6+s*.4})`,e.fillText(a,i,o),e.restore()):(e.fillStyle=`rgba(245, 240, 234, 0.82)`,e.fillText(a,i,o))}}g=requestAnimationFrame(D)},O=()=>{_||(_=!0,E=performance.now(),g=requestAnimationFrame(D))},k=()=>{_&&(_=!1,cancelAnimationFrame(g))},A=()=>{document.hidden?k():O()};document.addEventListener(`visibilitychange`,A),document.fonts.load(`${c}px PeachScript`).finally(O),r(()=>{k(),t.disconnect(),document.removeEventListener(`visibilitychange`,A)})}),(()=>{var t=s(),r=h;return typeof r==`function`?a(r,t):h=t,n(n=>{var r=o.width,a=o.height,s=`${o.width}px`,c=`${o.height}px`;return r!==n.e&&i(t,`width`,n.e=r),a!==n.t&&i(t,`height`,n.t=a),s!==n.a&&e(t,`width`,n.a=s),c!==n.o&&e(t,`height`,n.o=c),n},{e:void 0,t:void 0,a:void 0,o:void 0}),t})()}export{h as t};