1import{F as e,G as t,I as n,K as r,N as i,P as a,U as o}from"./index-BP9j8KNs.js";var s=e(`<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(e){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 r(()=>{let n=h.getContext(`2d`);if(!n)return;b(m());let r=new MutationObserver(()=>{let e=m();e!==v&&b(e)});r.observe(document.documentElement,{attributes:!0,attributeFilter:[`style`]});let i=e.width,a=e.height,o=Math.ceil(i/(u+d))+4,s=Math.floor(a/l)+1,p=s*o,x=Math.min(8,Math.max(3,Math.floor(p*.03))),S=()=>({row:Math.floor(Math.random()*s),col:Math.floor(Math.random()*o),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()*e.runeString.length*(u+d)),T=e.runeString.length*(u+d)||1,E=performance.now(),D=t=>{let r=Math.min(t-E,64);E=t,n.clearRect(0,0,i,a),n.fillStyle=`#1a1410`,n.fillRect(0,0,i,a),n.font=`${c}px PeachScript, monospace`,n.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=e.runeString,b=v.length;if(b===0){g=requestAnimationFrame(D);return}for(let e=0;e<s;e++){let t=f[e%f.length];w[e]=(w[e]+t*r/1e3)%T;let a=e*l+c+12;for(let t=0;t<o;t++){let r=t*(u+d)-w[e]%(u+d);if(r<-u||r>i+u)continue;let o=v[((Math.floor(w[e]/(u+d))+t)%b+b)%b],s=p.get(`${e},${t}`)??0;s>.01?(n.save(),n.shadowColor=`rgba(${m}, ${h}, ${_}, ${s*.9})`,n.shadowBlur=10,n.fillStyle=`rgba(${m}, ${h}, ${_}, ${.6+s*.4})`,n.fillText(o,r,a),n.restore()):(n.fillStyle=`rgba(245, 240, 234, 0.82)`,n.fillText(o,r,a))}}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),t(()=>{k(),r.disconnect(),document.removeEventListener(`visibilitychange`,A)})}),(()=>{var t=s(),r=h;return typeof r==`function`?n(r,t):h=t,o(n=>{var r=e.width,o=e.height,s=`${e.width}px`,c=`${e.height}px`;return r!==n.e&&i(t,`width`,n.e=r),o!==n.t&&i(t,`height`,n.t=o),s!==n.a&&a(t,`width`,n.a=s),c!==n.o&&a(t,`height`,n.o=c),n},{e:void 0,t:void 0,a:void 0,o:void 0}),t})()}export{h as t};