asciify-engine 1.0.83 → 1.0.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("gifuct-js"),t={standard:" .:-=+*#%@",blocks:" ░▒▓█",minimal:" .:+",dense:" .'`^\",:;Il!i><~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$",binary:"01",dots:" ⠁⠃⠇⡇⣇⣧⣷⣿",letters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",claudeCode:" ╔╗╚╝║═╠╣╦╩╬░▒▓█│─┌┐└┘├┤┬┴┼",box:" ▪◾◼■█",lines:" ˗‐–—―━",braille:" ⠁⠂⠃⠄⠅⠆⠇⠈⠉⠊⠋⠌⠍⠎⠏⠐⠑⠒⠓⠔⠕⠖⠗⠘⠙⠚⠛⠜⠝⠞⠟⠠⠡⠢⠣⠤⠥⠦⠧⠨⠩⠪⠫⠬⠭⠮⠯⠰⠱⠲⠳⠴⠵⠶⠷⠸⠹⠺⠻⠼⠽⠾⠿⡀⡁⡂⡃⡄⡅⡆⡇⣀⣁⣂⣃⣄⣅⣆⣇⣈⣉⣊⣋⣌⣍⣎⣏⣐⣑⣒⣓⣔⣕⣖⣗⣘⣙⣚⣛⣜⣝⣞⣟⣠⣡⣢⣣⣤⣥⣦⣧⣨⣩⣪⣫⣬⣭⣮⣯⣰⣱⣲⣳⣴⣵⣶⣷⣸⣹⣺⣻⣼⣽⣾⣿",katakana:" ヲァィゥェォャュョッアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン",musical:" ♩♪♫♬♭♮♯",emoji:" ⬛🟫🟥🟧🟨🟩🟦🟪⬜",circles:" .·:∘○◦°•∙",shadows:" ·∘◦○◎⊙●◉",starfield:" ˙·∘∗✦✧★◆●",geometric:" ·△▷◇◈◆▣■█",pipes:" ╶─┐└├┤┬┴┼╬▒▓█",waves:" ˜∼≈〰≋∿∾∭∫",shards:" ╱╲╳◤◥◣◢△▲◆◼█",smoke:" ·˙⁚⁖∶∷⋮⋰⋱∴∵",ascii:" .'`^\",:;~-_+<>i!lI?/\\|()[]{}1tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$",interface:" ·•-–—+=:;<>[]{}()⌘⌥⇧⌃↵↗↘◇◆◈□■",prompt:" .:;>_`/\\|{}[]()=+*#@$",data:" ·∙•◦○●◇◆◈▱▰▣█",humanist:" ·˙,:;∴∵∷∶⁚⋮⋯∼≈≋∞",mesh:" ·╶╴╷╵─│┌┐└┘├┤┬┴┼╬░▒▓█"},o={cosmic:[t.starfield,t.circles,t.shadows],rain:[t.katakana,t.braille,t.binary],terminal:[t.pipes,t.claudeCode,t.standard],crystal:[t.shards,t.geometric,t.blocks],fluid:[t.waves,t.smoke,t.circles],pulse:[t.dense,t.standard,t.blocks],dream:[t.braille,t.shadows,t.smoke],angular:[t.geometric,t.shards,t.starfield],assistant:[t.interface,t.prompt,t.data],signal:[t.mesh,t.data,t.ascii],editorial:[t.humanist,t.waves,t.smoke]},n={classic:{renderMode:"ascii",charset:t.standard,colorMode:"grayscale"},particles:{renderMode:"dots",colorMode:"fullcolor",dotSizeRatio:.8},letters:{renderMode:"ascii",charset:t.letters,colorMode:"fullcolor"},claudeCode:{renderMode:"ascii",charset:t.claudeCode,colorMode:"accent",accentColor:"#f97316"},art:{renderMode:"ascii",charset:t.dense,colorMode:"fullcolor"},terminal:{renderMode:"ascii",charset:t.standard,colorMode:"matrix"},box:{renderMode:"ascii",charset:t.box,colorMode:"grayscale"},lines:{renderMode:"ascii",charset:t.lines,colorMode:"fullcolor"},braille:{renderMode:"ascii",charset:t.braille,colorMode:"fullcolor"},katakana:{renderMode:"ascii",charset:t.katakana,colorMode:"matrix"},musical:{renderMode:"ascii",charset:t.musical,colorMode:"accent",accentColor:"#e040fb"},emoji:{renderMode:"ascii",charset:t.emoji,colorMode:"fullcolor"},circles:{renderMode:"ascii",charset:t.circles,colorMode:"accent",accentColor:"#d4ff00"},shadows:{renderMode:"ascii",charset:t.shadows,colorMode:"accent",accentColor:"#50a0ff"},starfield:{renderMode:"ascii",charset:t.starfield,colorMode:"fullcolor"},geometric:{renderMode:"ascii",charset:t.geometric,colorMode:"grayscale"},pipes:{renderMode:"ascii",charset:t.pipes,colorMode:"accent",accentColor:"#00ff88"},waves:{renderMode:"ascii",charset:t.waves,colorMode:"fullcolor"},shards:{renderMode:"ascii",charset:t.shards,colorMode:"grayscale"},smoke:{renderMode:"ascii",charset:t.smoke,colorMode:"accent",accentColor:"#c850ff"},ascii:{renderMode:"ascii",charset:t.ascii,colorMode:"grayscale"},interface:{renderMode:"ascii",charset:t.interface,colorMode:"accent",accentColor:"#f4f1ea"},prompt:{renderMode:"ascii",charset:t.prompt,colorMode:"matrix"},data:{renderMode:"ascii",charset:t.data,colorMode:"fullcolor"},humanist:{renderMode:"ascii",charset:t.humanist,colorMode:"accent",accentColor:"#d6ccc2"},mesh:{renderMode:"ascii",charset:t.mesh,colorMode:"accent",accentColor:"#8fd3ff"}},r={agentField:{...n.interface,charsetFrames:o.assistant,charsetFps:1.6,animationStyle:"breathe",animationSpeed:.75,ditherStrength:.12,hoverEffect:"glow",hoverStrength:.42,hoverRadius:.18,hoverColor:"#f4f1ea",normalize:!0},liquidSignal:{...n.data,charsetFrames:o.signal,charsetFps:2.4,animationStyle:"melt",animationSpeed:.65,ditherStrength:.45,hoverEffect:"repel",hoverStrength:.55,hoverRadius:.22,hoverColor:"#8fd3ff",normalize:!0},cursorGravity:{...n.mesh,charsetFrames:o.angular,charsetFps:1.2,animationStyle:"orbit",animationSpeed:.9,ditherStrength:.2,hoverEffect:"attract",hoverStrength:.82,hoverRadius:.24,hoverColor:"#ffffff",normalize:!0},editorialPulse:{...n.humanist,charsetFrames:o.editorial,charsetFps:.9,animationStyle:"ripple",animationSpeed:.55,ditherStrength:.18,hoverEffect:"spotlight",hoverStrength:.35,hoverRadius:.2,hoverColor:"#fff8ea",normalize:!0},terminalFlow:{...n.prompt,charsetFrames:o.terminal,charsetFps:3,animationStyle:"rain",animationSpeed:1.1,ditherStrength:.22,hoverEffect:"glitchText",hoverStrength:.65,hoverRadius:.16,hoverColor:"#d4ff00",hoverText:["BUILD","SHIP","RUN","ASK","MODEL"],normalize:!0}},a={fontSize:10,charSpacing:1,brightness:0,contrast:0,charset:t.standard,colorMode:"grayscale",accentColor:"#d4ff00",invert:!1,renderMode:"ascii",animationStyle:"none",animationSpeed:1,dotSizeRatio:.8,ditherStrength:0,charAspect:.55,normalize:!1,hoverStrength:0,hoverRadius:.2,hoverEffect:"spotlight",hoverColor:"#ffffff",hoverShape:"circle",hoverText:"ASCIIFY",artStyle:"classic",customText:"",chromaKey:null,chromaKeyTolerance:60};function i(e,t,o){let n=e+255*t;return n=259*(255*o+255)/(255*(259-255*o))*(n-128)+128,Math.max(0,Math.min(255,n))}function s(e,t,o){const n=o?1-e/255:e/255,r=[...t],a=Math.floor(n*(r.length-1));return r[Math.max(0,Math.min(r.length-1,a))]}function c(e,t,o,n,r,a){if((a?1-e/255:e/255)<.12)return" ";const i=[...t];return i[(n*r+o)%i.length]}var l=[[0,8,2,10],[12,4,14,6],[3,11,1,9],[15,7,13,5]];function h(e,t,o,n){if(n<=0)return e;const r=(l[o%4][t%4]/16-.5)*n*128;return Math.max(0,Math.min(255,e+r))}var f=new Array(256),d=new Array(256);for(let e=0;e<256;e++)f[e]=`rgb(${e},${e},${e})`,d[e]=`rgb(0,${e},0)`;function u(e,t,o,n,r,a=!1){switch(t){case"fullcolor":return`rgb(${e.r},${e.g},${e.b})`;case"matrix":return d[.299*e.r+.587*e.g+.114*e.b|0];case"accent":return`rgb(${o},${n},${r})`;default:{const t=.299*e.r+.587*e.g+.114*e.b|0;return f[t]}}}var m=[0,0,0];function g(e,t,o,n,r,a=!1){switch(t){case"fullcolor":m[0]=e.r,m[1]=e.g,m[2]=e.b;break;case"matrix":{const t=.299*e.r+.587*e.g+.114*e.b|0;m[0]=0,m[1]=t,m[2]=0;break}case"accent":m[0]=o,m[1]=n,m[2]=r;break;default:{const t=.299*e.r+.587*e.g+.114*e.b|0;m[0]=t,m[1]=t,m[2]=t;break}}return m}function M(e){const t=e.match(/rgba?\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)(?:\s*[,/]\s*([\d.]+))?\s*\)/);return t?{r:+t[1],g:+t[2],b:+t[3],a:void 0!==t[4]?+t[4]:1}:null}function p(e){let t=e;for(;t&&t!==document.documentElement.parentElement;){const e=getComputedStyle(t).backgroundColor;if(e&&"transparent"!==e&&"rgba(0, 0, 0, 0)"!==e){const t=M(e);if(t&&t.a>.1)return t}t=t.parentElement}return null}function v(e){if(e){const t=p(e);if(t){return(.299*t.r+.587*t.g+.114*t.b)/255<.4}}if("undefined"!=typeof document){const e=document.documentElement,t=(e.getAttribute("data-theme")||"").toLowerCase();if("dark"===t)return!0;if("light"===t)return!1;if(e.classList.contains("dark"))return!0;if(document.body){const e=p(document.body);if(e){return(.299*e.r+.587*e.g+.114*e.b)/255<.4}}}return"undefined"!=typeof window&&window.matchMedia("(prefers-color-scheme: dark)").matches}function b(e,t,o,n,r,a,i){if("none"===a)return 1;const s=r*i;switch(a){case"wave":return.3+.7*(.6*(.5*Math.sin(e/o*Math.PI*4+3*s)+.5)+.4*(.5*Math.sin(t/n*Math.PI*3+2*s)+.5));case"pulse":{const r=o/2,a=n/2,i=Math.sqrt((e-r)**2+(t-a)**2),c=Math.sqrt(r**2+a**2);return.2+.8*(.5*Math.sin(i/c*Math.PI*6-4*s)+.5)}case"rain":return.1+.9*(.5*Math.sin(t/n*Math.PI*8-5*s+.3*e)+.5)*(.3*Math.sin(e/o*Math.PI*2+s)+.7);case"breathe":{const o=.3*Math.sin(2*s)+.7,n=.1*Math.sin(.1*(e+t)+s);return Math.max(.1,Math.min(1,o+n))}case"sparkle":{const o=43758.5453*Math.sin(127.1*e+311.7*t+43758.5453*Math.floor(8*s)),n=o-Math.floor(o);return n>.7?1:.15+.4*n}case"glitch":{const e=Math.floor(t/(.05*n)),o=43758.5453*Math.sin(43.23*e+17.89*Math.floor(6*s));if(o-Math.floor(o)>.85){const t=.5*Math.sin(30*s+e)+.5;return t<.3?0:t}return 1}case"spiral":{const r=o/2,a=n/2,i=e-r,c=t-a,l=Math.atan2(c,i),h=Math.sqrt(i*i+c*c),f=Math.sqrt(r*r+a*a);return.15+.85*(.5*Math.sin(3*l+h/f*Math.PI*8-3*s)+.5)}case"typewriter":{const r=o*n,a=t*o+e-.5*s%1*r*1.3;if(a>0)return 0;const i=Math.max(0,1+a/(.15*r));return Math.min(1,i)}case"scatter":{const r=o/2,a=n/2,i=e-r,c=t-a,l=Math.sqrt(i*i+c*c)/Math.sqrt(r*r+a*a),h=.5*Math.sin(1.5*s)+.5;return l>h?Math.max(0,1-3*(l-h)):.7+.3*Math.sin(10*l-2*s)}case"waveField":default:return 1;case"ripple":{const r=o/2,a=n/2,i=e-r,c=t-a,l=Math.sqrt(i*i+c*c),h=Math.sqrt(r*r+a*a);return.1+.9*(.5*Math.sin(l/h*Math.PI*10-5*s)+.5)*(.4+.6*(1-Math.min(1,l/(1.1*h))))}case"melt":{const o=t/n*Math.PI;return.05+(.5*Math.sin(o-1.8*s+.15*e)+.5)*(1-.6*(Math.max(0,t/n-.1)/.9))*.95}case"orbit":{const r=o/2,a=n/2,i=e-r,c=t-a,l=Math.atan2(c,i),h=Math.sqrt(i*i+c*c)/Math.sqrt(r*r+a*a);return.1+.9*(.5*Math.sin(2*l+6*h-2.5*s)+.5)}case"cellular":{const o=Math.floor(4*s),n=(e,t)=>{const n=43758.5453*Math.sin(127.1*e+311.7*t+43758.5453*o);return n-Math.floor(n)>.38?1:0},r=n(e,t),a=n(e-1,t)+n(e+1,t)+n(e,t-1)+n(e,t+1)+n(e-1,t-1)+n(e+1,t-1)+n(e-1,t+1)+n(e+1,t+1);return 1===(1===r?2===a||3===a?1:0:3===a?1:0)?1:.05}}}var x={scale:1,offsetX:0,offsetY:0,glow:0,colorBlend:0,proximity:0};function w(e,t,o,n,r,a,i,s,c="spotlight",l=.5,h="circle"){const f=e-o,d=t-n,u=.08+.35*l+.04*a;let m,g;if("box"===h){const e=Math.abs(f),t=Math.abs(d);m=Math.max(e,t),g=u}else m=Math.sqrt(f*f+d*d),g=u;if(m>=g)return x.scale=1,x.offsetX=0,x.offsetY=0,x.glow=0,x.colorBlend=0,x.proximity=0,x;const M=function(e){return e*e*(3-2*e)}(1-m/g)*r;let p=1,v=0,b=0,w=0,y=0;switch(c){case"spotlight":{p=1+M*a*1.8;const e=Math.atan2(d,f),t=M*M*a*.6;v=Math.cos(e)*t*i,b=Math.sin(e)*t*s,w=M*a*.4,y=M*M*a*.25;break}case"magnify":p=1+M*a*2.5,w=M*a*.15;break;case"repel":{p=1+M*a*.3;const e=Math.atan2(d,f),t=M*M*a*1.2;v=Math.cos(e)*t*i,b=Math.sin(e)*t*s;break}case"glow":w=M*a*.8,y=M*a*.4;break;case"colorShift":p=1+M*a*.4,w=M*a*.2,y=M*a*.7;break;case"attract":{const e=Math.atan2(d,f),t=M*M*a*1;v=-Math.cos(e)*t*i,b=-Math.sin(e)*t*s,w=M*a*.3;break}case"shatter":{const e=Math.atan2(d,f),t=.5*Math.sin(43.7*f+29.3*d),o=M*a*1.4*(.7+.3*t);v=Math.cos(e+t)*o*i,b=Math.sin(e+t)*o*s,p=Math.max(.1,1-M*a*.6),w=M*a*.25;break}case"trail":y=M*a*.9,w=M*a*.6,p=1+M*a*.15;break;case"glitchText":p=1,w=M*a*.5,y=M*a*.6}return x.scale=p,x.offsetX=v,x.offsetY=b,x.glow=w,x.colorBlend=y,x.proximity=M,x}function y(e){const t=e.match(/^#([0-9a-f]{3,8})$/i)?.[1];if(t){const e=t.length<=4?t.split("").map(e=>parseInt(e+e,16)):[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];return{r:e[0],g:e[1],b:e[2]}}const o=e.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);return o?{r:+o[1],g:+o[2],b:+o[3]}:null}function S(e){return e*e*e*(e*(6*e-15)+10)}function $(e,t,o){return e+(t-e)*o}function E(e,t){let o=127*e+311*t;return o^=o>>13,(o*(o*o*15731+789221)+1376312589&2147483647)/2147483647}function C(e,t){const o=Math.floor(e),n=Math.floor(t),r=t-n,a=S(e-o),i=S(r),s=E(o,n),c=E(o+1,n),l=E(o,n+1),h=E(o+1,n+1);return $($(s,c,a),$(l,h,a),i)}function T(e,t){return(.5*C(e,t)+.25*C(2.1*e,2.1*t)+.125*C(4.3*e,4.3*t))/.875}function A(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=13,charAspect:s=.62,lineHeightRatio:c=1.4,chars:l=" .:-=+*#%@",baseColor:h=null,accentColor:f,accentThreshold:d=.52,mouseInfluence:u=.55,mouseFalloff:m=2.8,speed:g=1,vortex:M=!0,sparkles:p=!0,breathe:v=!0,lightMode:b=!1}=a,x=f??(b?"#6b8700":"#d4ff00"),w=i*s,y=i*c,S=Math.ceil(t/w),$=Math.ceil(o/y),C=r.x,A=r.y;let R=212,I=255,k=0;{const e=x.replace("#","");6===e.length&&(R=parseInt(e.slice(0,2),16),I=parseInt(e.slice(2,4),16),k=parseInt(e.slice(4,6),16))}e.clearRect(0,0,t,o),e.font=`${i}px "JetBrains Mono", monospace`,e.textBaseline="top";const F=n*g,B=v?.12*(.5*Math.sin(.22*F)+.5):0;for(let t=0;t<$;t++)for(let o=0;o<S;o++){const n=o/S,r=t/$,a=.045,i=.08*F,s=.06,c=.45*((.5*Math.sin(.08*o+.05*t+.6*F)+.5+(.5*Math.sin(.03*o-.07*t+.4*F)+.5)+(.5*Math.sin(.05*o+.03*t+.8*F)+.5))/3)+.35*(.5*T(o*a+i,t*a*1.4-.7*i)+.5)+.2*(.5*Math.sin((o+.65*t)*s+1.1*F)+.5)+B,f=n-C,g=r-A,v=Math.sqrt(f*f+g*g);let x=0;if(M&&v<.35){const e=Math.atan2(g,f),t=Math.sin(4*e+2.2*F-14*v),o=Math.max(0,1-v/.35);x=t*o*o*.22}const L=c*(1-u)+(Math.max(0,1-v*m)+.5*x)*u+.15*x,z=Math.min(1,Math.max(0,L));let P=z;if(p&&z>.72){const e=Math.floor(8*F),n=E(7*o+3*e,11*t+e);n>.88&&(P=Math.min(1,z+4*(n-.88)))}const q=Math.floor(P*(l.length-1));if(" "===l[q])continue;const H=.015+.07*P;if(P>d){const t=Math.min(b?.9:.28,H*(b?14:2.8));e.fillStyle=`rgba(${R},${I},${k},${t})`}else e.fillStyle=h?h.replace("{a}",String(H)):b?`rgba(55,55,55,${7*H})`:`rgba(255,255,255,${H})`;e.fillText(l[q],o*w,t*y)}}function R(e,t){return"auto"!==e?e:!v(t)}function I(e){const t=e.match(/^#([0-9a-fA-F]{3,6})$/);if(t){let e=t[1];if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return e}const o=e.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);return o?[o[1],o[2],o[3]].map(e=>parseInt(e).toString(16).padStart(2,"0")).join(""):null}function k(e){const t=e||"auto";if("auto"!==t)return t.replace("#","");if("undefined"!=typeof document){const e=getComputedStyle(document.documentElement);for(const t of["--accent-color","--color-accent","--accent","--color-primary","--primary","--brand-color"]){const o=I(e.getPropertyValue(t).trim());if(o)return o}const t=I(getComputedStyle(document.body).accentColor??"");if(t)return t}return v("undefined"!=typeof document?document.body:null)?"faf9f7":"0d0d0d"}function F(e,t,o,n){const r=e instanceof HTMLVideoElement?e.videoWidth:e.width,a=e instanceof HTMLVideoElement?e.videoHeight:e.height;if(0===r||0===a)return{frame:[],cols:0,rows:0};const l=t.charAspect,f=t.fontSize*t.charSpacing,d=t.fontSize/l*t.charSpacing,u=o||r,m=n||a,g=Math.floor(u/f),M=Math.floor(m/d);if(g<=0||M<=0)return{frame:[],cols:0,rows:0};const p=Math.max(1,Math.min(Math.floor(2048/g),Math.floor(r/g))),v=Math.max(1,Math.min(Math.floor(2048/M),Math.floor(a/M))),b=g*p,x=M*v,{ctx:w}=function(e,t){const o=document.createElement("canvas");o.width=e,o.height=t;const n=o.getContext("2d",{willReadFrequently:!0});return{canvas:o,ctx:n}}(b,x);w.drawImage(e,0,0,b,x);const y=w.getImageData(0,0,b,x).data,S=t.chromaKey,$=null!=S&&!1!==S,E=!0===S,C="blue-screen"===S;let T=null,A=0;!$||E||C||(T=function(e){if("string"!=typeof e)return e;const t=document.createElement("canvas");t.width=1,t.height=1;const o=t.getContext("2d");o.fillStyle=e,o.fillRect(0,0,1,1);const n=o.getImageData(0,0,1,1).data;return{r:n[0],g:n[1],b:n[2]}}(S),A=(t.chromaKeyTolerance??60)**2);let I=0,k=255;if(t.normalize){let e=255,t=0;for(let o=0;o<y.length;o+=4){if($){const e=y[o],t=y[o+1],n=y[o+2];let r=!1;if(E)r=t>1.4*e&&t>1.4*n&&t>80;else if(C)r=n>1.4*e&&n>1.4*t&&n>80;else if(null!==T){const o=e-T.r,a=t-T.g,i=n-T.b;r=o*o+a*a+i*i<=A}if(r)continue}const n=.299*y[o]+.587*y[o+1]+.114*y[o+2];n<e&&(e=n),n>t&&(t=n)}I=e,k=t>e?t-e:255}const F=[],B=R(t.invert),L=$&&t.charset.replace(/ /g,"")||t.charset,z=p*v;for(let e=0;e<M;e++){const o=[];for(let n=0;n<g;n++){let r=0,a=0,l=0,f=0,d=0;for(let t=0;t<v;t++){const o=(e*v+t)*b;for(let e=0;e<p;e++){const t=4*(o+n*p+e),i=y[t],s=y[t+1],c=y[t+2],h=y[t+3];if($){let e=!1;if(E)e=s>1.4*i&&s>1.4*c&&s>80;else if(C)e=c>1.4*i&&c>1.4*s&&c>80;else if(null!==T){const t=i-T.r,o=s-T.g,n=c-T.b;e=t*t+o*o+n*n<=A}if(e){d++;continue}}r+=i,a+=s,l+=c,f+=h}}if($&&d>z/2){o.push({char:" ",r:0,g:0,b:0,a:0});continue}const u=z-d,m=u>0?r/u:0,M=u>0?a/u:0,x=u>0?l/u:0,w=u>0?f/u:0,S=.299*m+.587*M+.114*x,R=h(i(t.normalize?(S-I)/k*255:S,t.brightness,t.contrast),n,e,t.ditherStrength),F=t.customText?c(R,t.customText,n,e,g,B):s(R,L,B);o.push({char:F,r:m,g:M,b:x,a:w,lum:R})}F.push(o)}return{frame:F,cols:g,rows:M}}async function B(e,t,o,n,r=12,a=10,i,s=0){const c=Math.min(e.duration-s,a),l=Math.ceil(c*r),h=[];let f=0,d=0;for(let a=0;a<l;a++){const u=s+a/r;if(u>s+c)break;e.currentTime=u,await new Promise(t=>{const o=()=>{e.removeEventListener("seeked",o),t()};e.addEventListener("seeked",o)});const m=F(e,t,o,n);h.push(m.frame),f=m.cols,d=m.rows,i?.((a+1)/l)}return{frames:h,cols:f,rows:d,fps:r}}async function L(t,o,n,r,a){const i=e.parseGIF(t),s=e.decompressFrames(i,!0);if(0===s.length)return{frames:[],cols:0,rows:0,fps:10};const c=s[0].dims.width,l=s[0].dims.height,h=i.lsd?.width||c,f=i.lsd?.height||l,d=document.createElement("canvas");d.width=h,d.height=f;const u=d.getContext("2d"),m=document.createElement("canvas");m.width=h,m.height=f;const g=m.getContext("2d"),M=[];let p=0,v=0,b=0;for(const e of s)b+=e.delay||100;const x=b/s.length,w=Math.round(Math.min(30,Math.max(5,1e3/x))),y=Math.min(s.length,300);for(let e=0;e<y;e++){const t=s[e],{dims:i,patch:c,disposalType:l}=t;3===l&&(g.clearRect(0,0,h,f),g.drawImage(d,0,0));const b=new ImageData(new Uint8ClampedArray(c.buffer),i.width,i.height),x=document.createElement("canvas");x.width=i.width,x.height=i.height;x.getContext("2d").putImageData(b,0,0),u.drawImage(x,i.left||0,i.top||0);const w=F(d,o,n,r);M.push(w.frame),p=w.cols,v=w.rows,2===l?u.clearRect(i.left||0,i.top||0,i.width,i.height):3===l&&(u.clearRect(0,0,h,f),u.drawImage(m,0,0)),a?.((e+1)/y)}return{frames:M,cols:p,rows:v,fps:w}}function z(e,t,o,n,r,a=0,i){if("waveField"===o.animationStyle){return void A(e,n,r,a,i?{x:i.x,y:i.y}:{x:.5,y:.5},{accentColor:`#${o.accentColor?k(o.accentColor):"d4ff00"}`,accentThreshold:.52,mouseInfluence:o.hoverStrength>0?Math.min(1,.3+.5*o.hoverStrength):.55,mouseFalloff:2.8,speed:o.animationSpeed,vortex:o.hoverStrength>0,sparkles:!0,breathe:!0})}const c=t.length;if(0===c)return;const l=t[0].length;e.clearRect(0,0,n,r);let h=!1;const f=Math.max(1,c>>2),d=Math.max(1,l>>2);e:for(let e=0;e<c;e+=f){const o=t[e];for(let e=0;e<l;e+=d)if(o[e].a<200){h=!0;break e}}const m=e.canvas,M=v(m);h||(e.fillStyle=M?"#0a0a0a":"#faf9f7",e.fillRect(0,0,n,r));const p=n/l,x=r/c,y=c*l,S=i?.intensity??1,$=!("none"!==o.animationStyle&&y>5e3)&&!!(i&&o.hoverStrength>0&&S>.005),E=o.hoverColor||"#ffffff",C=parseInt(E.slice(1,3),16)||255,T=parseInt(E.slice(3,5),16)||255,I=parseInt(E.slice(5,7),16)||255,F=k(o.accentColor),B=parseInt(F.substring(0,2),16)||255,L=parseInt(F.substring(2,4),16)||255,z=parseInt(F.substring(4,6),16)||255,P=y>3e4?.25:y>15e3?.4:y>5e3?.6:1,q=o.hoverRadius*P;let H=0,W=l,j=0,U=c,O=0,_=0;if($&&i){O=i.x,_=i.y;const e=.08+.35*q+.04*o.hoverStrength;H=Math.max(0,Math.floor((O-e)*l)-1),W=Math.min(l,Math.ceil((O+e)*l)+1),j=Math.max(0,Math.floor((_-e)*c)-1),U=Math.min(c,Math.ceil((_+e)*c)+1)}const D=o.animationStyle,Y=o.animationSpeed,V="none"===D,N=o.hoverStrength,G=o.hoverEffect,X=q,J=o.hoverShape||"circle",K=R(o.invert,m),Q=o.colorMode,Z=2*Math.PI,ee=1/l,te=1/c;let oe="",ne=-1;if("dots"===o.renderMode){const n=.5*Math.min(p,x)*o.dotSizeRatio;for(let o=0;o<c;o++){const r=t[o];for(let t=0;t<l;t++){const i=r[t];if(i.a<10)continue;const s=.00392156863*(.299*i.r+.587*i.g+.114*i.b),h=K?1-s:s;if(h<.02)continue;const f=V?1:b(t,o,l,c,a,D,Y);let d=1,m=0,M=0,v=0,y=0;if($&&t>=H&&t<=W&&o>=j&&o<=U){const e=w(t*ee,o*te,O,_,S,N,p,x,G,X,J);d=e.scale,m=e.offsetX,M=e.offsetY,v=e.glow,y=e.colorBlend}const E=n*h*f*d;if(E<.3)continue;const A=t*p+.5*p+m,R=o*x+.5*x+M;let k;if(y>0){const e=g(i,Q,B,L,z,K);k=`rgb(${Math.min(255,e[0]+(C-e[0])*y|0)},${Math.min(255,e[1]+(T-e[1])*y|0)},${Math.min(255,e[2]+(I-e[2])*y|0)})`}else k=u(i,Q,B,L,z,K);const F=Math.min(1,.00392156863*i.a*f*(1+v));if(F!==ne&&(e.globalAlpha=F,ne=F),k!==oe&&(e.fillStyle=k,oe=k),E<=3){const t=2*E;e.fillRect(A-E,R-E,t,t)}else e.beginPath(),e.arc(A,R,E,0,Z),e.fill()}}}else{const n=.55,r=.9*Math.min(p/n,x),i=r<6;if(!i){const t="emoji"===o.artStyle;e.font=t?`${r}px "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif`:`${r}px "JetBrains Mono", monospace`,e.textAlign="center",e.textBaseline="middle"}let h=null;const f=o.charsetFrames,d=!!f?.length,m=d?f[Math.floor(Math.max(0,a)*(o.charsetFps??2))%f.length]:o.charset;if(i){h={};const e=[...m],t=e.length;for(let o=0;o<t;o++)h[e[o]]=Math.max(.1,(o+.3)/t)}const M=i?null:e.getTransform(),v="glitchText"===G&&$,y="!@#$%^&*<>{}[]|/\\~`0123456789",E=y.length;let A="",R=0,k=0,F=0,P=0,Z=0,re=0;if(v){const e=o.hoverText??"ASCIIFY";if(k=Math.round(O*l),F=Math.round(_*c),Array.isArray(e)){const t=e.filter(e=>e.length>0);0===t.length&&t.push("ASCIIFY");A=t[((7*Math.floor(k/Math.max(1,Math.ceil(l/5)))+13*Math.floor(F/Math.max(1,Math.ceil(c/3))))%t.length+t.length)%t.length]}else A=e||"ASCIIFY";R=A.length,P=Math.max(3,Math.min(12,Math.round(c*q*.6)));const t=Math.floor(P/2);Z=Math.max(0,F-t),Z+P>c&&(Z=Math.max(0,c-P)),re=k-Math.floor(R/2)}for(let o=0;o<c;o++){const n=t[o];for(let t=0;t<l;t++){const r=n[t];if(r.a<10)continue;let f=d&&null!=r.lum?s(r.lum,m,K):r.char;if(" "===f)continue;const q=V?1:b(t,o,l,c,a,D,Y);if(q<.05)continue;let ae=1,ie=0,se=0,ce=0,le=0;if($&&!v&&t>=H&&t<=W&&o>=j&&o<=U){const e=w(t*ee,o*te,O,_,S,N,p,x,G,X,J);ae=e.scale,ie=e.offsetX,se=e.offsetY,ce=e.glow,le=e.colorBlend}if(v&&o>=Z&&o<Z+P){const e=t-re;if(e>=0&&e<R){const n=A[e],r=Math.abs(o-F)/Math.max(1,.5*P),i=Math.abs(t-k)/Math.max(1,R),s=Math.max(r,i),c=Math.max(0,Math.min(1,1-.9*s)),l=43758.5453*Math.sin(127.1*t+311.7*o+43758.5453*Math.floor(12*a));f=Math.abs(l-Math.floor(l))<c?n:y[Math.abs(Math.floor(97*l))%E],ce=.3+.7*c,le=.3+.65*c}}const he=t*p+.5*p+ie,fe=o*x+.5*x+se;let de;if(le>0){const e=g(r,Q,B,L,z,K);de=`rgb(${Math.min(255,e[0]+(C-e[0])*le|0)},${Math.min(255,e[1]+(T-e[1])*le|0)},${Math.min(255,e[2]+(I-e[2])*le|0)})`}else de=u(r,Q,B,L,z,K);if(i){const t=h[f]??.5,o=Math.min(1,.00392156863*r.a*q*(1+ce))*t;if(o<.02)continue;o!==ne&&(e.globalAlpha=o,ne=o),de!==oe&&(e.fillStyle=de,oe=de);const n=p*ae,a=x*ae;e.fillRect(he-.5*n,fe-.5*a,n,a)}else{const t=Math.min(1,.00392156863*r.a*q*(1+ce));t!==ne&&(e.globalAlpha=t,ne=t),de!==oe&&(e.fillStyle=de,oe=de),1!==ae?(e.translate(he,fe),e.scale(ae,ae),e.fillText(f,0,0),e.setTransform(M)):e.fillText(f,he,fe)}}}}e.globalAlpha=1}function P(e){return Math.max(0,Math.min(1,e))}function q(e){return"string"==typeof e?document.querySelector(e):e instanceof HTMLElement?e:null}function H(e,t,o={}){if(!Number.isFinite(e.duration)||e.duration<=0)return;const n=o.from??0,r=o.to??e.duration,a=Math.max(n,Math.min(r,e.duration)),i=P(o.ease?o.ease(P(t)):t),s=n+(a-n)*i;e.currentTime=Math.min(Math.max(n,s),Math.max(n,a-.04)),o.onUpdate?.(i,e)}function W(e,t={}){const o=q(t.trigger)??e;e.pause();const n=t.gsap,r=t.ScrollTrigger??n?.ScrollTrigger;if(n&&r?.create){n.registerPlugin?.(r);const a=r.create({trigger:o,start:t.start??"top bottom",end:t.end??"bottom top",scrub:t.scrub??!0,onUpdate:o=>H(e,o.progress,t)});return()=>a.kill?.()}return function(e,t,o){let n=0;const r=()=>{n=0;const r=t.getBoundingClientRect(),a=window.innerHeight||document.documentElement.clientHeight,i=r.height+a,s=i>0?P((a-r.top)/i):0;H(e,s,o)},a=()=>{n||(n=requestAnimationFrame(r))};return window.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a),a(),()=>{window.removeEventListener("scroll",a),window.removeEventListener("resize",a),n&&cancelAnimationFrame(n)}}(e,o,t)}function j(e,t,o){const n=t.gsap,r=t.ScrollTrigger??n?.ScrollTrigger;if(n&&r?.create){n.registerPlugin?.(r);const a=r.create({trigger:e,start:t.start??"top bottom",end:t.end??"bottom top",scrub:t.scrub??!0,onUpdate:e=>o(e.progress)});return()=>a.kill?.()}return function(e,t){let o=0;const n=()=>{o=0;const n=e.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight,a=n.height+r,i=a>0?P((r-n.top)/a):0;t(i)},r=()=>{o||(o=requestAnimationFrame(n))};return window.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),r(),()=>{window.removeEventListener("scroll",r),window.removeEventListener("resize",r),o&&cancelAnimationFrame(o)}}(e,o)}function U(e,t,o=2048){const n=o,r=Math.min(1,n/Math.max(e,t));return{renderW:Math.round(e*r),renderH:Math.round(t*r)}}function O(e,t,o,n,r,a=2048){const{width:i,height:s}=t.getBoundingClientRect();if(!i||!s)return{renderW:0,renderH:0,dpr:1};let c,l,h=i,f=h/o;f>s&&(f=s,h=f*o),h=Math.round(h),f=Math.round(f),n&&r?({renderW:c,renderH:l}=U(n,r,a)):(c=h,l=f);const d="undefined"!=typeof window&&window.devicePixelRatio||1,u=8e6,m=c*d*l*d>u?Math.sqrt(u/(c*l)):d;return e.width=Math.round(c*m),e.height=Math.round(l*m),e.style.width=h+"px",e.style.height=f+"px",{renderW:c,renderH:l,dpr:m}}async function _(e,t,{fontSize:o,artStyle:r="classic",options:i={},fitTo:s,preExtract:c=!1,fps:l,maxRenderDimension:h=2048,trim:f,scroll:d,onReady:u,onFrame:m}={}){const g=f?.start??0,M=f?.end,p=o??i.fontSize??10,v={...a,...n[r],...i,fontSize:p},b=t.getContext("2d");if(!b)throw new Error("asciifyVideo: could not get 2d context from canvas.");const x="string"==typeof s?document.querySelector(s):s instanceof HTMLElement?s:null;if(c){let o;"string"==typeof e?(o=document.createElement("video"),o.crossOrigin="anonymous",o.src=e,o.readyState<2&&await new Promise((t,n)=>{o.onloadeddata=()=>t(),o.onerror=()=>n(new Error(`asciifyVideo: failed to load "${e}"`))})):o=e,x&&O(t,x,o.videoWidth/o.videoHeight,o.videoWidth,o.videoHeight,h);const{renderW:n,renderH:r}=U(o.videoWidth,o.videoHeight,h),a="undefined"!=typeof window&&window.devicePixelRatio||1,i=8e6,s=n*a*r*a>i?Math.sqrt(i/(n*r)):a;t.width<Math.round(n*s)&&(t.width=Math.round(n*s),t.height=Math.round(r*s));const c=void 0!==M?M-g:10,f=l??(d?18:void 0),{frames:p,fps:w}=await B(o,v,n,r,f,c,void 0,g),y=e=>{const t=p[e];t&&(b.save(),b.setTransform(s,0,0,s,0,0),z(b,t,v,n,r),b.restore(),m?.())};if(d){let e=!1,n=-1;const r=!0===d?{}:d,a=j(q(r.trigger)??x??t,r,t=>{const a=P(r.ease?r.ease(P(t)):t),i=Math.max(0,Math.min(p.length-1,Math.round(a*(p.length-1))));i!==n&&(n=i,y(i),e||(e=!0,u?.(o)),r.onUpdate?.(a,o))});return y(0),e=!0,u?.(o),a}let S,$=!1,E=0,C=performance.now(),T=!0;const A=1e3/w,R=e=>{$||(e-C>=A&&(y(E),E=(E+1)%p.length,C=e,T&&(T=!1,u?.(o))),S=requestAnimationFrame(R))};return S=requestAnimationFrame(R),()=>{$=!0,cancelAnimationFrame(S)}}let w,y=!1;"string"==typeof e?(w=document.createElement("video"),w.src=e,w.muted=!0,w.loop=!0,w.playsInline=!0,w.setAttribute("playsinline",""),Object.assign(w.style,{position:"fixed",top:"0",left:"0",width:"1px",height:"1px",opacity:"0",pointerEvents:"none",zIndex:"-1"}),document.body.appendChild(w),y=!0,await new Promise((t,o)=>{w.onloadedmetadata=()=>t(),w.onerror=()=>o(new Error(`asciifyVideo: failed to load "${e}"`))}),await w.play().catch(()=>{})):(w=e,w.readyState<HTMLMediaElement.HAVE_METADATA&&await new Promise((e,t)=>{const o=()=>{w.removeEventListener("loadedmetadata",n),w.removeEventListener("error",r)},n=()=>{o(),e()},r=()=>{o(),t(new Error("asciifyVideo: provided video element failed to load metadata."))};w.addEventListener("loadedmetadata",n),w.addEventListener("error",r),w.load()}),w.paused&&await w.play().catch(()=>{})),g>0&&(w.currentTime=g,await new Promise(e=>{const t=()=>{w.removeEventListener("seeked",t),e()};w.addEventListener("seeked",t)}));let S=null;(g>0||void 0!==M)&&(S=()=>{(void 0!==M&&w.currentTime>=M||g>0&&w.currentTime<g)&&(w.currentTime=g)},w.addEventListener("timeupdate",S));let $=null;const{renderW:E,renderH:C}=U(w.videoWidth,w.videoHeight,h);if(x){const e=w.videoWidth/w.videoHeight,o=w.videoWidth,n=w.videoHeight,r=O(t,x,e,o,n,h),a=t.getContext("2d");a&&a.setTransform(r.dpr,0,0,r.dpr,0,0),$=new ResizeObserver(()=>{const r=O(t,x,e,o,n,h),a=t.getContext("2d");a&&a.setTransform(r.dpr,0,0,r.dpr,0,0)}),$.observe(x)}else{const e="undefined"!=typeof window&&window.devicePixelRatio||1,o=8e6,n=E*e*C*e>o?Math.sqrt(o/(E*C)):e;t.width<Math.round(E*n)&&(t.width=Math.round(E*n),t.height=Math.round(C*n)),b.setTransform(n,0,0,n,0,0)}let T,A=!1,R=!0,I=null;const k=d&&!c,L=l&&l>0?1e3/l:0;let H=0,_=-1;if(k){const e=!0===d?{}:d;I=W(w,{...e,trigger:e.trigger??x??t,from:e.from??g,to:e.to??M})}const D=e=>{if(A)return;if(T=requestAnimationFrame(D),w.readyState<2||0===t.width||0===t.height)return;if(L>0&&e-H<L)return;if(g>0&&w.currentTime<g)return;if(void 0!==M&&w.currentTime>=M)return;if(k&&Math.abs(w.currentTime-_)<1/240)return;const{frame:o}=F(w,v,E,C);o.length>0&&(z(b,o,v,E,C,0,null),H=e,_=w.currentTime,R&&(R=!1,u?.(w)),m?.())};return T=requestAnimationFrame(D),()=>{A=!0,cancelAnimationFrame(T),I?.(),$?.disconnect(),S&&w.removeEventListener("timeupdate",S),y&&(w.pause(),w.src="",document.body.removeChild(w))}}function D(e,t,o,n,r={}){const{fontSize:a=13,chars:i="0123456789ABCDEF@#$&*+=/<>",accentColor:s,color:c,speed:l=1,density:h=.55,tailLength:f=14,lightMode:d=!1}=r,u=s??(d?"#6b8700":"#d4ff00"),m=.62*a,g=1.4*a,M=Math.ceil(t/m),p=Math.ceil(o/g);e.clearRect(0,0,t,o),e.font=`${a}px monospace`,e.textBaseline="top";let v=255,b=255,x=255;if(d&&(v=55,b=55,x=55),c){const e=y(c);e&&(v=e.r,b=e.g,x=e.b)}let w=212,S=255,$=0;const C=y(u);C&&(w=C.r,S=C.g,$=C.b);const T=p+f;for(let t=0;t<M;t++){if(E(17*t,3)>h)continue;const o=(.5+1.5*E(31*t,7))*l,r=E(13*t,11)*T,a=Math.floor((n*o*7+r)%T),s=t*m;for(let o=0;o<=f;o++){const r=a-(f-o);if(r<0||r>=p)continue;const c=r*g,l=E(53*t+Math.floor(5*n+o),7*r),h=i[Math.floor(l*i.length)],u=o/f;if(o===f)e.fillStyle=`rgba(${w},${S},${$},${d?.7:.85})`;else{const t=d?.85*u:.15*u;e.fillStyle=`rgba(${v},${b},${x},${t})`}e.fillText(h,s,c)}}}function Y(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=" . · * + ° ★",accentColor:c,color:l,speed:h=1,count:f=180,lightMode:d=!1}=a,u=c??(d?"#6b8700":"#d4ff00");e.clearRect(0,0,t,o),e.textBaseline="middle",e.textAlign="center";const m=t*(.2+.6*r.x),g=o*(.2+.6*r.y),M=.65*Math.sqrt(t*t+o*o);let p=255,v=255,b=255;if(d&&(p=55,v=55,b=55),l){const e=y(l);e&&(p=e.r,v=e.g,b=e.b)}let x=212,w=255,S=0;const $=y(u);$&&(x=$.r,w=$.g,S=$.b);const C=s.replace(/ /g,"").split("");if(0!==C.length){for(let r=0;r<f;r++){const a=E(17*r,3)*Math.PI*2,s=(n*(.15+.85*E(31*r,7))*h*.22+E(13*r,11))%1,c=m+Math.cos(a)*s*M,l=g+Math.sin(a)*s*M;if(c<-20||c>t+20||l<-20||l>o+20)continue;const f=Math.max(6,i*(.4+.9*s));e.font=`${f}px monospace`;const u=C[Math.min(C.length-1,Math.floor(s*C.length))],y=s>.72,$=d?.85*s:.2*s;e.fillStyle=y?`rgba(${x},${w},${S},${Math.min(d?.92:.32,2.2*$)})`:`rgba(${p},${v},${b},${$})`,e.fillText(u,c,l)}e.textAlign="left"}}function V(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=". · ○ ◎ ●",accentColor:c,color:l,rings:h=5,speed:f=1,sharpness:d=4,lightMode:u=!1}=a,m=c??(u?"#007a5e":"#00ffcc");e.clearRect(0,0,t,o),e.textBaseline="middle",e.textAlign="center";const g=t*r.x,M=o*r.y,p=1.6*Math.sqrt(g*g+M*M)+.2*Math.sqrt(t*t+o*o);let v=255,b=255,x=255;if(u&&(v=55,b=55,x=55),l){const e=y(l);e&&(v=e.r,b=e.g,x=e.b)}let w=0,S=255,$=204;const E=y(m);E&&(w=E.r,S=E.g,$=E.b);const C=s.replace(/ /g,"").split("");if(0===C.length)return;const T=Math.ceil(t/i),A=Math.ceil(o/i);for(let t=0;t<A;t++)for(let o=0;o<T;o++){const r=o*i+.5*i,a=t*i+.5*i,s=r-g,c=a-M,l=Math.sqrt(s*s+c*c)/p;let m=0;for(let e=0;e<h;e++){const t=(n*f*.38+e/h)%1,o=Math.abs(l-t),r=Math.max(0,1-o*p/(i*(12-d)));m+=Math.cos(r*Math.PI*.5)*r}if(m=Math.min(1,m),m<.02)continue;const y=m>.6;e.font=`${i}px monospace`;const E=Math.floor(m*(C.length-1)),T=C[Math.min(E,C.length-1)],A=u?.88*m:.22*m;e.fillStyle=y?`rgba(${w},${S},${$},${Math.min(u?.95:.4,.55*m)})`:`rgba(${v},${b},${x},${A})`,e.fillText(T,r,a)}e.textAlign="left"}function N(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=" .·:;=+*#%@░▒▓",accentColor:c,color:l,octaves:h=4,speed:f=1,scale:d=1,accentThreshold:u=.78,mouseWarp:m=.3,lightMode:g=!1}=a,M=c??(g?"#6b8700":"#d4ff00"),p=.62*i,v=1.4*i,b=Math.ceil(t/p),x=Math.ceil(o/v);e.clearRect(0,0,t,o),e.font=`${i}px monospace`,e.textBaseline="top";let w=255,S=255,$=255;if(g&&(w=55,S=55,$=55),l){const e=y(l);e&&(w=e.r,S=e.g,$=e.b)}let E=212,T=255,A=0;const R=y(M);R&&(E=R.r,T=R.g,A=R.b);const I=.035*d,k=n*f,F=Math.min(6,Math.max(1,h)),B=(e,t)=>{let o=0,n=.5,r=1,a=0;for(let i=0;i<F;i++)o+=C(e*r,t*r)*n,a+=n,n*=.5,r*=2.1;return o/a};for(let t=0;t<x;t++)for(let o=0;o<b;o++){const n=o*I+.06*k,a=t*I*1.3-.04*k,i=o/b-r.x,c=t/x-r.y,l=Math.sqrt(i*i+c*c),h=m>0?.12*Math.max(0,1-l/m):0,f=.5*B(n+h*Math.sin(1.3*k+8*c),a+h*Math.cos(.9*k+8*i))+.5;if(f<.12)continue;const d=s[Math.floor(f*(s.length-1))];if(" "===d)continue;const M=f>u,y=g?.82*f:.13*f;e.fillStyle=M?`rgba(${E},${T},${A},${g?.92:.28})`:`rgba(${w},${S},${$},${y})`,e.fillText(d,o*p,t*v)}}function G(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=12,chars:s="·-=+|/",accentColor:c,color:l,bands:h=3,speed:f=1,bandWidth:d=.12,glitch:u=!0,lightMode:m=!1}=a,g=c??(m?"#6b8700":"#d4ff00"),M=.62*i,p=1.4*i,v=Math.ceil(t/M),b=Math.ceil(o/p);e.clearRect(0,0,t,o),e.font=`${i}px monospace`,e.textBaseline="top";let x=255,w=255,S=255;if(m&&(x=55,w=55,S=55),l){const e=y(l);e&&(x=e.r,w=e.g,S=e.b)}let $=212,C=255,T=0;const A=y(g);A&&($=A.r,C=A.g,T=A.b);const R=n*f;for(let t=0;t<b;t++)for(let o=0;o<v;o++){const n=t/b,a=((n*h-.5*R)%1+1)%1,i=Math.max(0,1-a/d),c=.35*(.5*E(3*o,7*t)+.5);let l=0;if(u){const e=o/v-r.x,a=n-r.y,i=Math.sqrt(e*e+a*a);if(i<.18){const e=E(11*o+Math.floor(12*R),5*t);l=Math.max(0,1-i/.18)*(e>.5?e-.3:0)}}const f=Math.min(1,c+.8*i+.6*l);if(f<.04)continue;const g=s[Math.floor(f*(s.length-1))],y=i>.55,A=m?.82*f:.12*f;e.fillStyle=y?`rgba(${$},${C},${T},${m?.92:.28})`:`rgba(${x},${w},${S},${A})`,e.fillText(g,o*M,t*p)}}function X(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=" ·∙•:;+=≡≣#@",color:c,accentColor:l,speed:h=1,layers:f=5,softness:d=1.2,mouseRipple:u=.2,lightMode:m=!1}=a,g=l??(m?"#6b8700":"#d4ff00"),M=.62*i,p=1.4*i,v=Math.ceil(t/M),b=Math.ceil(o/p);e.clearRect(0,0,t,o),e.font=`${i}px monospace`,e.textBaseline="top";let x=255,w=255,S=255;if(m&&(x=55,w=55,S=55),c){const e=y(c);e&&(x=e.r,w=e.g,S=e.b)}let $=212,C=255,T=0;const A=y(g);A&&($=A.r,C=A.g,T=A.b);const R=n*h,I=[];for(let e=0;e<f;e++){const t=E(17*e,31*e+7),o=E(23*e+5,11*e);I.push({fx:.8+2.2*t,fy:1.2+1.8*o,phase:t*Math.PI*4,dt:(.3+.5*E(7*e,13*e+3))*(e%2==0?1:-1),amp:.55+.45*E(29*e,3*e)})}for(let t=0;t<b;t++){const o=t/b;for(let n=0;n<v;n++){const a=n/v,i=a-r.x,c=o-r.y,l=Math.sqrt(i*i+c*c),h=u*Math.exp(-l*l/.06),g=a+i*h,b=o+c*h;let y=0,E=0;for(let e=0;e<f;e++){const{fx:t,fy:o,phase:n,dt:r,amp:a}=I[e];y+=Math.sin(g*t*Math.PI*2+R*r+n)*Math.cos(b*o*Math.PI*2+R*r*.7+1.3*n)*a,E+=a}const A=y/E,k=.5+.5*Math.tanh(A*d*2.2);if(k<.12)continue;const F=(k-.12)/.88,B=s[Math.min(s.length-1,Math.floor(F*s.length))],L=k>.82,z=m?.82*k:.14*k;e.fillStyle=L?`rgba(${$},${C},${T},${m?.92:.32})`:`rgba(${x},${w},${S},${z})`,e.fillText(B,n*M,t*p)}}}function J(e,t,o,n,r={}){const{fontSize:a=13,color:i,accentColor:s,speed:c=.4,layers:l=4,turbulence:h=.8,lightMode:f=!1}=r,d=s??(f?"#6b8700":"#d4ff00"),u=.62*a,m=1.4*a,g=Math.ceil(t/u),M=Math.ceil(o/m);e.clearRect(0,0,t,o),e.font=`${a}px monospace`,e.textBaseline="top";let p=255,v=255,b=255;if(f&&(p=55,v=55,b=55),i){const e=y(i);e&&(p=e.r,v=e.g,b=e.b)}let x=212,w=255,S=0;const $=y(d);$&&(x=$.r,w=$.g,S=$.b);const C=n*c,T=["─","─","╌","·","╌","─","─","╌","·"];for(let t=0;t<M;t++){const o=t/M;for(let n=0;n<g;n++){const r=n/g;let a=0,i=0;for(let e=0;e<l;e++){const t=E(13*e,7*e+3),n=1.1+2.4*t,s=.9+2*E(29*e,11*e+1),c=t*Math.PI*6,l=(.2+.5*E(41*e,17*e))*(e%2==0?1:-1.3),f=Math.sin(r*n*Math.PI*2+C*l+c),d=Math.cos(o*s*Math.PI*2+C*l*.6+1.7*c),u=Math.sin(r*s*Math.PI*h+o*n*Math.PI*h+C*l*.4);a+=Math.atan2(d+.3*u,f),i+=.5*(f*d+1)}const s=a/l,c=Math.min(1,i/l);if(c<.1)continue;const d=(s+Math.PI)/(2*Math.PI),M=T[Math.floor(d*T.length)%T.length],y=c>.8,$=f?.8*c:.13*c;e.fillStyle=y?`rgba(${x},${w},${S},${f?.9:.26})`:`rgba(${p},${v},${b},${$})`,e.fillText(M,n*u,t*m)}}}function K(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=13,chars:s=" ·:;=+*#%@",color:c,accentColor:l,speed:h=1,radius:f=.38,swirl:d=3,lightMode:u=!1}=a,m=l??(u?"#6b8700":"#d4ff00"),g=.62*i,M=1.4*i,p=Math.ceil(t/g),v=Math.ceil(o/M),b=t/o;e.clearRect(0,0,t,o),e.font=`${i}px monospace`,e.textBaseline="top";let x=255,w=255,S=255;if(u&&(x=55,w=55,S=55),c){const e=y(c);e&&(x=e.r,w=e.g,S=e.b)}let $=212,C=255,T=0;const A=y(m);A&&($=A.r,C=A.g,T=A.b);const R=n*h;for(let t=0;t<v;t++){const o=t/v;for(let n=0;n<p;n++){const a=(n/p-r.x)*b,i=o-r.y,c=Math.sqrt(a*a+i*i)/f;if(c>1){const o=E(3*n,7*t)*Math.max(0,1-3*(c-1));if(o<.62)continue;const r=o*(u?.28:.04);e.fillStyle=`rgba(${x},${w},${S},${r})`,e.fillText(s[1],n*g,t*M);continue}const l=Math.max(0,1-Math.abs(c-(.15+.12*Math.sin(1.1*R)))/.07),h=Math.pow(1-c,2.2),d=Math.min(1,h+.6*l);if(d<.06)continue;const m=Math.floor(d*(s.length-1)),v=s[Math.min(s.length-1,m)],y=l>.35||c<.08,A=u?.85*d:.18*d;e.fillStyle=y?`rgba(${$},${C},${T},${u?.95:.38})`:`rgba(${x},${w},${S},${A})`,e.fillText(v,n*g,t*M)}}}function Q(e,t,o,n,r={}){const{fontSize:a=14,chars:i=" ·∙•:-=+*#",color:s,accentColor:c,speed:l=.5,harmonics:h=3,lightMode:f=!1}=r,d=c??(f?"#6b8700":"#d4ff00"),u=.62*a,m=1.4*a,g=Math.ceil(t/u),M=Math.ceil(o/m);e.clearRect(0,0,t,o),e.font=`${a}px monospace`,e.textBaseline="top";let p=255,v=255,b=255;if(f&&(p=55,v=55,b=55),s){const e=y(s);e&&(p=e.r,v=e.g,b=e.b)}let x=212,w=255,S=0;const $=y(d);$&&(x=$.r,w=$.g,S=$.b);const C=n*l,T=Array.from({length:h},(e,t)=>1/(t+1)).reduce((e,t)=>e+t,0);for(let t=0;t<M;t++)for(let o=0;o<g;o++){let n=0;for(let e=0;e<h;e++){const r=.18+1.4*E(o*(e+3)+7,t*(e+5)+11),a=E(o*(e+7),t*(e+9)+3)*Math.PI*2,i=1/(e+1);n+=Math.sin(C*r+a)*i}const r=.5*(n/T+1);if(r<.28)continue;const a=(r-.28)/.72,s=i[Math.min(i.length-1,Math.floor(a*i.length))],c=r>.88,l=f?.82*a:.13*a;e.fillStyle=c?`rgba(${x},${w},${S},${f?.92:.28})`:`rgba(${p},${v},${b},${l})`,e.fillText(s,o*u,t*m)}}function Z(e,t,o,n,r={}){const{fontSize:a=13,chars:i=" .,:;i+xX#&@",color:s="#ff4500",hotColor:c="#ffe066",intensity:l=.85,wind:h=0,speed:f=1,lightMode:d=!1}=r,u=.62*a,m=1.4*a,g=Math.ceil(t/u),M=Math.ceil(o/m),p=g*M,v="__fire_heat__",b=e.canvas;let x=b[v];x&&x.length===p||(x=new Float32Array(p),b[v]=x);const w=.18*(.016*f),S=h*f*.8,$=M-1,E=n*f;for(let e=0;e<g;e++){const t=(.6*(.5*Math.sin(.31*e+4.1*E)+.5)+.4*(.5*Math.sin(.73*e-2.7*E)+.5))*l;x[$*g+e]=Math.min(1,t+.15*Math.random()*l),$>0&&(x[($-1)*g+e]=Math.min(1,.85*t+.1*Math.random()*l))}const C=new Float32Array(p);for(let e=0;e<M-2;e++)for(let t=0;t<g;t++){const o=.4*x[(e+1)*g+t]+.25*x[(e+2)*g+Math.max(0,Math.min(g-1,t+Math.round(S)))]+.175*x[(e+1)*g+Math.max(0,t-1)]+.175*x[(e+1)*g+Math.min(g-1,t+1)];C[e*g+t]=Math.max(0,o-w-.02*Math.random()*f)}for(let e=0;e<g;e++)C[(M-1)*g+e]=x[(M-1)*g+e],M>1&&(C[(M-2)*g+e]=x[(M-2)*g+e]);b[v]=C;const T=y(s)??{r:255,g:69,b:0},A=y(c)??{r:255,g:224,b:102};e.clearRect(0,0,t,o),e.font=`${a}px "JetBrains Mono", monospace`,e.textBaseline="top";for(let t=0;t<M;t++)for(let o=0;o<g;o++){const n=C[t*g+o];if(n<.03)continue;const r=i[Math.min(i.length-1,Math.floor(n*i.length))];if(" "===r)continue;const a=Math.min(1,1.2*n),s=T.r+(A.r-T.r)*a|0,c=T.g+(A.g-T.g)*a|0,l=T.b+(A.b-T.b)*a|0,h=d?1-.3*n:Math.min(1,n+.15);e.globalAlpha=h,e.fillStyle=`rgb(${s},${c},${l})`,e.fillText(r,o*u,t*m)}e.globalAlpha=1}function ee(e,t,o,n,r={}){const{fontSize:a=13,baseChars:i="ATCG",bridgeChars:s="-=≡",color:c="#00e5ff",color2:l="#ff4081",bridgeColor:h="#88ffcc",speed:f=1,helixCount:d,lightMode:u=!1}=r,m=.62*a,g=1.4*a,M=Math.ceil(t/m),p=Math.ceil(o/g),v=d??Math.max(1,Math.floor(t/80)),b=M/v,x=y(c)??{r:0,g:229,b:255},w=y(l)??{r:255,g:64,b:129},S=y(h)??{r:136,g:255,b:204};e.clearRect(0,0,t,o),e.font=`${a}px "JetBrains Mono", monospace`,e.textBaseline="top";const $=n*f,C=.35*b;for(let t=0;t<v;t++){const o=b*(t+.5);for(let n=0;n<p;n++){const r=n/p*Math.PI*6-1.8*$,a=o+Math.sin(r)*C,c=o+Math.sin(r+Math.PI)*C,l=Math.round(a),h=Math.round(c);if(l<0||l>=M)continue;const f=E(31*t+7*n,3),d=i[Math.floor(f*i.length)],u=.5*(Math.sin(r)+1),v=.5*(Math.sin(r+Math.PI)+1);if(e.globalAlpha=.35+.65*u,e.fillStyle=`rgb(${x.r},${x.g},${x.b})`,e.fillText(d,l*m,n*g),h>=0&&h<M){const o=E(53*t+11*n,7),r=i[Math.floor(o*i.length)];e.globalAlpha=.35+.65*v,e.fillStyle=`rgb(${w.r},${w.g},${w.b})`,e.fillText(r,h*m,n*g)}if(n%3===0){const o=Math.min(l,h),r=Math.max(l,h);if(r-o>1){const a=E(17*n+43*t,5),i=s[Math.floor(a*s.length)],c=.25*(u+v)+.2;e.globalAlpha=c,e.fillStyle=`rgb(${S.r},${S.g},${S.b})`;for(let t=o+1;t<r;t++)e.fillText(i,t*m,n*g)}}}}e.globalAlpha=1}function te(e,t,o,n,r={}){const{fontSize:a=13,chars:i=" .,:;+*#@",color:s="#4caf50",skyColor:c="#1a237e",peakColor:l="#e0e0e0",speed:h=1,roughness:f=.55,heightScale:d=.55,stars:u=!0,lightMode:m=!1}=r,g=.62*a,M=1.4*a,p=Math.ceil(t/g),v=Math.ceil(o/M),b=y(s)??{r:76,g:175,b:80},x=y(c)??{r:26,g:35,b:126},w=y(l)??{r:224,g:224,b:224};e.clearRect(0,0,t,o),e.font=`${a}px "JetBrains Mono", monospace`,e.textBaseline="top";const S=n*h*.4,$=new Array(p);for(let e=0;e<p;e++){const t=(.5*T((e/p+S)*f*3,.5)+.5)*d;$[e]=Math.floor(t*v)}for(let t=0;t<v;t++)for(let o=0;o<p;o++){const r=v-1-$[o],a=t===r;if(!(t>=r)){if(u){const r=E(7*o+Math.floor(.3*S),13*t);if(r>.97){const a=.3*Math.sin(2*n+100*r)+.7;e.globalAlpha=.5*a,e.fillStyle=`rgb(${x.r+60},${x.g+60},${x.b+80})`,e.fillText("·",o*g,t*M)}}continue}const s=(t-r)/Math.max(1,$[o]),c=i[Math.min(i.length-1,Math.floor(s*i.length))];if(" "===c&&!a)continue;const l=a?1:Math.max(0,1-4*s),h=b.r+(w.r-b.r)*l|0,f=b.g+(w.g-b.g)*l|0,d=b.b+(w.b-b.b)*l|0;e.globalAlpha=.5+.5*s,e.fillStyle=`rgb(${h},${f},${d})`,e.fillText(a?i[i.length-1]:c,o*g,t*M)}e.globalAlpha=1}var oe=1,ne=2,re=4,ae=8,ie={3:"─",12:"│",9:"┌",10:"┐",5:"└",6:"┘",11:"┬",7:"┴",13:"├",14:"┤",15:"┼",[oe]:"╶",[ne]:"╴",[re]:"╵",[ae]:"╷"};function se(e,t,o,n,r={}){const{fontSize:a=13,pulseColor:i="#ffffff",color:s="#00ff88",density:c=.38,speed:l=1,lightMode:h=!1}=r,f=.62*a,d=1.4*a,u=Math.ceil(t/f),m=Math.ceil(o/d),g=y(s)??{r:0,g:255,b:136},M=y(i)??{r:255,g:255,b:255},p=(e,t)=>{if(E(17*e+1,7*t+2)>c)return 0;let o=0;return e+1<u&&E(17*e+1,7*t+2)>.15&&(o|=1),e-1>=0&&E(17*(e-1)+1,7*t+2)>.15&&(o|=2),t+1<m&&E(17*e+1,7*(t+1)+2)>.15&&(o|=8),t-1>=0&&E(17*e+1,7*(t-1)+2)>.15&&(o|=4),o};e.clearRect(0,0,t,o),e.font=`${a}px "JetBrains Mono", monospace`,e.textBaseline="top";const v=n*l;for(let t=0;t<m;t++)for(let o=0;o<u;o++){const n=p(o,t);if(0===n)continue;const r=ie[n]??"·",a=(8*v+40*E(o,23*t))%u,i=(6*v+40*E(17*t,11*o))%m,s=(1&n||2&n)&&Math.abs(o-a)<1.5,c=(4&n||8&n)&&Math.abs(t-i)<1.5,l=s||c,h=.25+.35*E(3*o,5*t);l?(e.globalAlpha=.95,e.fillStyle=`rgb(${M.r},${M.g},${M.b})`):(e.globalAlpha=h,e.fillStyle=`rgb(${g.r},${g.g},${g.b})`),e.fillText(r,o*f,t*d)}e.globalAlpha=1}function ce(e,t={}){const{type:o="wave",opacity:n=.2,className:r,zIndex:a=0,colorScheme:i="auto",color:s,...c}=t,l="string"==typeof e?document.querySelector(e):e;if(!l)return console.warn("[asciify] asciiBackground: target not found",e),{destroy:()=>{}};const h=l.style.position;"static"===getComputedStyle(l).position&&(l.style.position="relative");const f=document.createElement("canvas");f.style.cssText=["position:absolute","inset:0","width:100%","height:100%",`opacity:${n}`,"pointer-events:none",`z-index:${a}`].join(";"),r&&(f.className=r),l.prepend(f);const d=f.getContext("2d"),u=window.devicePixelRatio||1,m={x:.5,y:.5},g={x:.5,y:.5},M=()=>"light"===i||"dark"!==i&&(()=>{let e=l;for(;e&&e!==document.documentElement.parentElement;){const t=getComputedStyle(e).backgroundColor;if(t&&"transparent"!==t&&"rgba(0, 0, 0, 0)"!==t){const e=t.match(/rgba?\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)/);if(e)return(.299*+e[1]+.587*+e[2]+.114*+e[3])/255>=.4}e=e.parentElement}const t=document.documentElement,o=(t.getAttribute("data-theme")||"").toLowerCase();return"dark"!==o&&("light"===o||!t.classList.contains("dark")&&window.matchMedia("(prefers-color-scheme: light)").matches)})(),p=s?function(e){const t=e.match(/^#([0-9a-f]{3,8})$/i)?.[1];if(t){const e=t.length<=4?t.split("").map(e=>parseInt(e+e,16)):[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];return{r:e[0],g:e[1],b:e[2]}}const o=e.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);return o?{r:+o[1],g:+o[2],b:+o[3]}:null}(s):null,v=()=>({...c,lightMode:void 0!==c.lightMode?c.lightMode:M(),baseColor:p?`rgba(${p.r},${p.g},${p.b},{a})`:c.baseColor}),b={current:v()},x=()=>{b.current="rain"===o||"stars"===o||"pulse"===o||"noise"===o||"grid"===o||"aurora"===o||"silk"===o||"void"===o||"morph"===o?{...c,lightMode:void 0!==c.lightMode?c.lightMode:M(),color:s??c.color}:"fire"===o||"dna"===o?{...c,color:s??c.color}:"terrain"===o||"circuit"===o?{...c,color:s??c.color,lightMode:void 0!==c.lightMode?c.lightMode:M()}:v()};x();const w=window.matchMedia("(prefers-color-scheme: light)"),y=()=>{x()};let S=null;"auto"===i&&(w.addEventListener("change",y),S=new MutationObserver(y),S.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","class"]}));const $=()=>{const e=l.getBoundingClientRect();f.width=e.width*u,f.height=e.height*u,d.setTransform(u,0,0,u,0,0)};$();const E=e=>{const t=l.getBoundingClientRect();m.x=(e.clientX-t.left)/t.width,m.y=(e.clientY-t.top)/t.height},C=new ResizeObserver($);C.observe(l),window.addEventListener("mousemove",E);let T=0,R=0;const I=()=>{g.x+=.07*(m.x-g.x),g.y+=.07*(m.y-g.y);const e=l.getBoundingClientRect();"rain"===o?D(d,e.width,e.height,T,b.current):"stars"===o?Y(d,e.width,e.height,T,g,b.current):"pulse"===o?V(d,e.width,e.height,T,g,b.current):"noise"===o?N(d,e.width,e.height,T,g,b.current):"grid"===o?G(d,e.width,e.height,T,g,b.current):"aurora"===o?X(d,e.width,e.height,T,g,b.current):"silk"===o?J(d,e.width,e.height,T,b.current):"void"===o?K(d,e.width,e.height,T,g,b.current):"morph"===o?Q(d,e.width,e.height,T,b.current):"fire"===o?Z(d,e.width,e.height,T,b.current):"dna"===o?ee(d,e.width,e.height,T,b.current):"terrain"===o?te(d,e.width,e.height,T,b.current):"circuit"===o?se(d,e.width,e.height,T,b.current):A(d,e.width,e.height,T,g,b.current),T+=.016,R=requestAnimationFrame(I)};return R=requestAnimationFrame(I),{destroy:()=>{cancelAnimationFrame(R),C.disconnect(),"auto"===i&&(w.removeEventListener("change",y),S?.disconnect()),window.removeEventListener("mousemove",E),f.remove(),l.style.position=h}}}var le=ce;function he(e,t,o,n="#505050",r=100){if(!e||t<=0||o<=0)return[];const a=y(n)??{r:80,g:80,b:80},i=e,s=i.length;return Array.from({length:o},(e,o)=>Array.from({length:t},(e,n)=>({char:i[(o*t+n)%s],r:a.r,g:a.g,b:a.b,a:r})))}function fe(e,{format:t="png",quality:o=.92,scale:n=1}={}){return new Promise((r,a)=>{let i=e;if(1!==n){const t=document.createElement("canvas");t.width=Math.round(e.width*n),t.height=Math.round(e.height*n);const o=t.getContext("2d");if(!o)return void a(new Error("captureSnapshot: could not get 2d context"));o.drawImage(e,0,0,t.width,t.height),i=t}i.toBlob(e=>e?r(e):a(new Error("captureSnapshot: toBlob returned null")),`image/${t}`,o)})}var de={A:[28,54,99,127,99,99,99],B:[126,99,99,126,99,99,126],C:[62,99,96,96,96,99,62],D:[124,102,99,99,99,102,124],E:[127,96,96,124,96,96,127],F:[127,96,96,124,96,96,96],G:[62,99,96,111,99,99,62],H:[99,99,99,127,99,99,99],I:[127,8,8,8,8,8,127],J:[63,6,6,6,102,102,60],K:[99,102,108,120,108,102,99],L:[96,96,96,96,96,96,127],M:[99,119,107,107,99,99,99],N:[99,115,107,103,99,99,99],O:[62,99,99,99,99,99,62],P:[126,99,99,126,96,96,96],Q:[62,99,99,99,107,102,61],R:[126,99,99,126,108,102,99],S:[62,99,96,62,3,99,62],T:[127,8,8,8,8,8,8],U:[99,99,99,99,99,99,62],V:[99,99,99,99,54,28,8],W:[99,99,99,107,107,54,20],X:[99,54,28,8,28,54,99],Y:[99,99,54,28,8,8,8],Z:[127,3,6,12,24,48,127],a:[0,0,60,3,62,99,61],b:[96,96,124,99,99,99,124],c:[0,0,62,96,96,96,62],d:[3,3,31,99,99,99,31],e:[0,0,62,99,127,96,62],f:[30,48,48,126,48,48,48],g:[0,0,63,99,63,3,62],h:[96,96,124,99,99,99,99],i:[8,0,24,8,8,8,28],j:[4,0,12,4,4,36,24],k:[96,96,102,108,120,108,102],l:[24,8,8,8,8,8,28],m:[0,0,92,107,107,99,99],n:[0,0,94,99,99,99,99],o:[0,0,62,99,99,99,62],p:[0,0,126,99,126,96,96],q:[0,0,63,99,63,3,3],r:[0,0,94,99,96,96,96],s:[0,0,62,96,62,3,124],t:[48,48,126,48,48,48,30],u:[0,0,99,99,99,103,59],v:[0,0,99,99,54,28,8],w:[0,0,99,99,107,54,20],x:[0,0,99,54,28,54,99],y:[0,0,99,99,63,3,62],z:[0,0,127,6,12,24,127],0:[62,99,103,107,115,99,62],1:[8,24,56,8,8,8,62],2:[62,99,3,6,24,48,127],3:[62,99,3,30,3,99,62],4:[6,14,22,38,127,6,6],5:[127,96,126,3,3,99,62],6:[62,99,96,126,99,99,62],7:[127,3,6,12,24,24,24],8:[62,99,99,62,99,99,62],9:[62,99,99,63,3,99,62]," ":[0,0,0,0,0,0,0],"!":[24,24,24,24,24,0,24],"?":[62,99,3,14,8,0,8],".":[0,0,0,0,0,24,24],",":[0,0,0,0,0,24,48],";":[0,24,24,0,24,24,48],":":[0,24,24,0,24,24,0],"-":[0,0,0,62,0,0,0],_:[0,0,0,0,0,0,127],"'":[24,24,32,0,0,0,0],'"':[54,54,36,0,0,0,0],"`":[24,8,0,0,0,0,0],")":[24,12,6,6,6,12,24],"(":[12,24,48,48,48,24,12],"[":[60,48,48,48,48,48,60],"]":[30,6,6,6,6,6,30],"{":[14,24,24,48,24,24,14],"}":[56,12,12,6,12,12,56],"/":[3,6,12,24,48,96,0],"\\":[96,48,24,12,6,3,0],"|":[8,8,8,8,8,8,8],"+":[0,8,8,62,8,8,0],"=":[0,0,62,0,62,0,0],"*":[0,42,28,127,28,42,0],"#":[36,36,127,36,127,36,36],"@":[62,99,111,107,111,96,62],"&":[24,36,24,60,74,68,58],"%":[99,38,4,8,16,50,99],$:[8,62,72,62,9,62,8],"^":[8,20,34,0,0,0,0],"~":[0,0,50,76,0,0,0],"<":[6,12,24,48,24,12,6],">":[48,24,12,6,12,24,48]},ue=[127,65,65,65,65,65,127];function me(e){return de[e]??de[e.toUpperCase()]??ue}function ge(e,t={}){if(!e)return"";const{char:o="█",scale:n=1}=t,r=[...o][0]??"█",a=Math.max(1,Math.floor(n)),i=7*a,s=a,c=Array.from({length:i},()=>"");for(let t=0;t<e.length;t++){const o=me(e[t]);for(let e=0;e<7;e++){const t=o[e];let n="";for(let e=6;e>=0;e--)n+=(t>>e&1?r:" ").repeat(a);for(let t=0;t<a;t++)c[e*a+t]+=n}if(t<e.length-1)for(let e=0;e<i;e++)c[e]+=" ".repeat(s)}return c.join("\n")}exports.ART_STYLE_PRESETS=n,exports.BACKGROUND_TYPES=["wave","rain","stars","pulse","noise","grid","aurora","silk","void","morph","fire","dna","terrain","circuit"],exports.CHARSETS=t,exports.CHARSET_SEQUENCES=o,exports.DEFAULT_OPTIONS=a,exports.HOVER_PRESETS={none:{label:"Off",options:{hoverStrength:0,hoverEffect:"spotlight",hoverRadius:.2,hoverColor:"#ffffff"}},subtle:{label:"Subtle",options:{hoverStrength:.25,hoverEffect:"glow",hoverRadius:.12,hoverColor:"#ffffff"}},flashlight:{label:"Flashlight",options:{hoverStrength:.6,hoverEffect:"spotlight",hoverRadius:.15,hoverColor:"#fffbe6"}},magnifier:{label:"Magnifier",options:{hoverStrength:.7,hoverEffect:"magnify",hoverRadius:.12,hoverColor:"#ffffff"}},forceField:{label:"Force Field",options:{hoverStrength:.7,hoverEffect:"repel",hoverRadius:.15,hoverColor:"#a0e8ff"}},neon:{label:"Neon",options:{hoverStrength:.6,hoverEffect:"colorShift",hoverRadius:.15,hoverColor:"#d946ef"}},fire:{label:"Fire",options:{hoverStrength:.7,hoverEffect:"spotlight",hoverRadius:.15,hoverColor:"#ff6b2b"}},ice:{label:"Ice",options:{hoverStrength:.5,hoverEffect:"glow",hoverRadius:.15,hoverColor:"#60d5f7"}},gravity:{label:"Gravity",options:{hoverStrength:.7,hoverEffect:"attract",hoverRadius:.18,hoverColor:"#a5d6ff"}},shatter:{label:"Shatter",options:{hoverStrength:.8,hoverEffect:"shatter",hoverRadius:.14,hoverColor:"#ff6090"}},ghost:{label:"Ghost",options:{hoverStrength:.55,hoverEffect:"trail",hoverRadius:.2,hoverColor:"#b39ddb"}},glitchReveal:{label:"Glitch Reveal",options:{hoverStrength:.8,hoverEffect:"glitchText",hoverRadius:.18,hoverColor:"#a3e635"}}},exports.LIVING_STYLE_PRESETS=r,exports.PALETTE_THEMES={dracula:{name:"Dracula",accent:"#bd93f9",bg:"#282a36",fg:"#f8f8f2"},monokai:{name:"Monokai",accent:"#a6e22e",bg:"#272822",fg:"#f8f8f2"},nord:{name:"Nord",accent:"#88c0d0",bg:"#2e3440",fg:"#eceff4"},catppuccin:{name:"Catppuccin",accent:"#cba6f7",bg:"#1e1e2e",fg:"#cdd6f4"},solarized:{name:"Solarized",accent:"#268bd2",bg:"#002b36",fg:"#839496"},gruvbox:{name:"Gruvbox",accent:"#b8bb26",bg:"#282828",fg:"#ebdbb2"}},exports.asciiBackground=ce,exports.asciiText=function(e,t={},o,n){const r={...a,...t},{frame:i,cols:s}=F(e,r,o,n);if(!i.length||0===s)return"";const c=[];for(const e of i)c.push(e.map(e=>e.char).join(""));return c.join("\n")},exports.asciiTextAnsi=function(e,t={},o,n){const r={...a,...t},{frame:i,cols:s}=F(e,r,o,n);if(!i.length||0===s)return"";const c=[];for(const e of i){let t="";for(const o of e)" "===o.char||o.a<10?t+=" ":t+=`[38;2;${o.r};${o.g};${o.b}m${o.char}[0m`;c.push(t)}return c.join("\n")},exports.asciify=async function(e,t,{fontSize:o,artStyle:r="classic",options:i={}}={}){let s;if("string"==typeof e){const t=new Image;t.crossOrigin="anonymous",await new Promise((o,n)=>{t.onload=()=>o(),t.onerror=()=>n(new Error(`Failed to load image: ${e}`)),t.src=e}),s=t}else e instanceof HTMLImageElement&&!e.complete?(await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error("Image failed to load"))}),s=e):s=e;const c=n[r],l=o??i.fontSize??10,h={...a,...c,...i,fontSize:l},f=t.getContext("2d");if(!f)throw new Error("Could not get 2d context from canvas");const{w:d,h:u}=function(e){return e instanceof HTMLVideoElement?{w:e.videoWidth,h:e.videoHeight}:e instanceof HTMLImageElement?{w:e.naturalWidth||e.width,h:e.naturalHeight||e.height}:{w:e.width,h:e.height}}(s),{renderW:m,renderH:g}=U(d,u),M="undefined"!=typeof window&&window.devicePixelRatio||1,p=8e6,v=m*M*g*M>p?Math.sqrt(p/(m*g)):M;(t.width<m||t.height<g)&&(t.width=Math.round(m*v),t.height=Math.round(g*v));const{frame:b}=F(s,h,m,g);if(h.hoverStrength>0){let e=null,o=!1,n=0;const r=o=>{const n=t.getBoundingClientRect();e={x:(o.clientX-n.left)/n.width,y:(o.clientY-n.top)/n.height}},a=()=>{e=null};t.addEventListener("mousemove",r),t.addEventListener("mouseleave",a);const i=t=>{o||(f.save(),f.setTransform(v,0,0,v,0,0),z(f,b,h,m,g,t/1e3,e),f.restore(),n=requestAnimationFrame(i))};return n=requestAnimationFrame(i),()=>{o=!0,cancelAnimationFrame(n),t.removeEventListener("mousemove",r),t.removeEventListener("mouseleave",a)}}f.save(),f.setTransform(v,0,0,v,0,0),z(f,b,h,m,g),f.restore()},exports.asciifyGif=async function(e,t,{fontSize:o,artStyle:r="classic",options:i={}}={}){const s="string"==typeof e?await fetch(e).then(e=>e.arrayBuffer()):e,c=o??i.fontSize??10,l={...a,...n[r],...i,fontSize:c},h=t.getContext("2d");if(!h)throw new Error("Could not get 2d context from canvas");const{frames:f,fps:d}=await L(s,l,t.width,t.height);let u,m=!1,g=0,M=performance.now();const p=1e3/d,v=e=>{m||(e-M>=p&&(z(h,f[g],l,t.width,t.height),g=(g+1)%f.length,M=e),u=requestAnimationFrame(v))};return u=requestAnimationFrame(v),()=>{m=!0,cancelAnimationFrame(u)}},exports.asciifyLiveVideo=function(e,t,o){return _(e,t,o)},exports.asciifyText=ge,exports.asciifyVideo=_,exports.asciifyWebcam=async function(e,{fontSize:t=10,style:o="classic",options:r={},liveOptions:i,mirror:s=!0,constraints:c={facingMode:"user"},dpr:l}={}){if(!navigator.mediaDevices?.getUserMedia)throw new Error("asciifyWebcam: getUserMedia is not supported in this browser.");const h=await navigator.mediaDevices.getUserMedia({video:c}),f=document.createElement("video");f.srcObject=h,f.muted=!0,f.playsInline=!0,await new Promise((e,t)=>{f.onloadedmetadata=()=>e(),f.onerror=()=>t(new Error("asciifyWebcam: video stream failed to load.")),f.play().catch(t)});const d={...a,...n[o],...r,fontSize:t},u=e.getContext("2d");if(!u)throw new Error("asciifyWebcam: could not get 2d context from canvas.");const m=l??("undefined"!=typeof window?window.devicePixelRatio:1)??1;1!==m&&u.scale(m,m);let g=null;const M={x:.5,y:.5,intensity:0},p=t=>{const o=e.getBoundingClientRect();g={x:(t.clientX-o.left)/o.width,y:(t.clientY-o.top)/o.height}},v=()=>{g=null};d.hoverStrength>0&&(e.addEventListener("mousemove",p),e.addEventListener("mouseleave",v));let b,x=!1;const w=performance.now(),y=t=>{if(!x){if(f.readyState>=f.HAVE_CURRENT_DATA){const o=e.width/m,n=e.height/m,r=(t-w)/1e3,a=i?{...d,...i()}:d;a.hoverStrength>0?(e.addEventListener("mousemove",p),e.addEventListener("mouseleave",v)):(e.removeEventListener("mousemove",p),e.removeEventListener("mouseleave",v));const{frame:c}=F(f,a,o,n);if(g){const e=g.x-M.x,t=g.y-M.y,o=Math.sqrt(e*e+t*t),n=Math.min(.25,.06+.8*o);M.x+=e*n,M.y+=t*n,M.intensity+=.12*(1-M.intensity)}else M.intensity*=.965,M.intensity<.003&&(M.intensity=0);const l=M.intensity>.003?{x:M.x,y:M.y,intensity:M.intensity}:null;s?(u.save(),u.scale(-1,1),u.translate(-o,0),z(u,c,a,o,n,r,l),u.restore()):z(u,c,a,o,n,r,l)}b=requestAnimationFrame(y)}};return b=requestAnimationFrame(y),()=>{x=!0,cancelAnimationFrame(b),e.removeEventListener("mousemove",p),e.removeEventListener("mouseleave",v),h.getTracks().forEach(e=>e.stop()),f.srcObject=null}},exports.buildTextFrame=he,exports.captureSnapshot=fe,exports.createVideoScrollScrub=W,exports.gifToAsciiFrames=L,exports.imageToAsciiFrame=F,exports.mountWaveBackground=le,exports.renderAuroraBackground=X,exports.renderCircuitBackground=se,exports.renderDnaBackground=ee,exports.renderFireBackground=Z,exports.renderFrameToCanvas=z,exports.renderGridBackground=G,exports.renderMorphBackground=Q,exports.renderNoiseBackground=N,exports.renderPulseBackground=V,exports.renderRainBackground=D,exports.renderSilkBackground=J,exports.renderStarsBackground=Y,exports.renderTerrainBackground=te,exports.renderTextBackground=function(e,t,o,n,r={},i){const{fontSize:s=10,lineHeight:c=1.6,color:l="#505050",opacity:h=100,hoverEffect:f="spotlight",hoverStrength:d=.85,hoverRadius:u=.18,hoverColor:m="#d4ff00"}=r;z(e,he(n,Math.max(1,Math.floor(t/s)),Math.max(1,Math.floor(o/(s*c))),l,h),{...a,hoverEffect:f,hoverStrength:d,hoverRadius:u,hoverColor:m},t,o,0,i??null)},exports.renderTextToCanvas=function(e,t,o={}){const{color:n="#d4ff00",bgColor:r,fontSize:a=10}=o,i=ge(t,o);if(!i)return;const s=i.split("\n"),c=Math.max(...s.map(e=>[...e].length));e.width=Math.ceil(c*a*.6),e.height=Math.ceil(s.length*a);const l=e.getContext("2d");r&&"transparent"!==r?(l.fillStyle=r,l.fillRect(0,0,e.width,e.height)):l.clearRect(0,0,e.width,e.height),l.fillStyle=n,l.font=`${a}px monospace`,l.textBaseline="top",s.forEach((e,t)=>l.fillText(e,0,t*a))},exports.renderVoidBackground=K,exports.renderWaveBackground=A,exports.snapshotAndDownload=async function(e,t={}){const{filename:o="asciify-snapshot",format:n="png",...r}=t,a=await fe(e,{format:n,...r}),i="jpeg"===n?"jpg":n,s=document.createElement("a");s.href=URL.createObjectURL(a),s.download=`${o}.${i}`,s.click(),setTimeout(()=>URL.revokeObjectURL(s.href),1e4)},exports.videoToAsciiFrames=B;//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";var e=require("gifuct-js"),t={standard:" .:-=+*#%@",blocks:" ░▒▓█",minimal:" .:+",dense:" .'`^\",:;Il!i><~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$",binary:"01",dots:" ⠁⠃⠇⡇⣇⣧⣷⣿",letters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",claudeCode:" ╔╗╚╝║═╠╣╦╩╬░▒▓█│─┌┐└┘├┤┬┴┼",box:" ▪◾◼■█",lines:" ˗‐–—―━",braille:" ⠁⠂⠃⠄⠅⠆⠇⠈⠉⠊⠋⠌⠍⠎⠏⠐⠑⠒⠓⠔⠕⠖⠗⠘⠙⠚⠛⠜⠝⠞⠟⠠⠡⠢⠣⠤⠥⠦⠧⠨⠩⠪⠫⠬⠭⠮⠯⠰⠱⠲⠳⠴⠵⠶⠷⠸⠹⠺⠻⠼⠽⠾⠿⡀⡁⡂⡃⡄⡅⡆⡇⣀⣁⣂⣃⣄⣅⣆⣇⣈⣉⣊⣋⣌⣍⣎⣏⣐⣑⣒⣓⣔⣕⣖⣗⣘⣙⣚⣛⣜⣝⣞⣟⣠⣡⣢⣣⣤⣥⣦⣧⣨⣩⣪⣫⣬⣭⣮⣯⣰⣱⣲⣳⣴⣵⣶⣷⣸⣹⣺⣻⣼⣽⣾⣿",katakana:" ヲァィゥェォャュョッアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン",musical:" ♩♪♫♬♭♮♯",emoji:" ⬛🟫🟥🟧🟨🟩🟦🟪⬜",circles:" .·:∘○◦°•∙",shadows:" ·∘◦○◎⊙●◉",starfield:" ˙·∘∗✦✧★◆●",geometric:" ·△▷◇◈◆▣■█",pipes:" ╶─┐└├┤┬┴┼╬▒▓█",waves:" ˜∼≈〰≋∿∾∭∫",shards:" ╱╲╳◤◥◣◢△▲◆◼█",smoke:" ·˙⁚⁖∶∷⋮⋰⋱∴∵",ascii:" .'`^\",:;~-_+<>i!lI?/\\|()[]{}1tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$",interface:" ·•-–—+=:;<>[]{}()⌘⌥⇧⌃↵↗↘◇◆◈□■",prompt:" .:;>_`/\\|{}[]()=+*#@$",data:" ·∙•◦○●◇◆◈▱▰▣█",humanist:" ·˙,:;∴∵∷∶⁚⋮⋯∼≈≋∞",mesh:" ·╶╴╷╵─│┌┐└┘├┤┬┴┼╬░▒▓█"},o={cosmic:[t.starfield,t.circles,t.shadows],rain:[t.katakana,t.braille,t.binary],terminal:[t.pipes,t.claudeCode,t.standard],crystal:[t.shards,t.geometric,t.blocks],fluid:[t.waves,t.smoke,t.circles],pulse:[t.dense,t.standard,t.blocks],dream:[t.braille,t.shadows,t.smoke],angular:[t.geometric,t.shards,t.starfield],assistant:[t.interface,t.prompt,t.data],signal:[t.mesh,t.data,t.ascii],editorial:[t.humanist,t.waves,t.smoke]},n={classic:{renderMode:"ascii",charset:t.standard,colorMode:"grayscale"},particles:{renderMode:"dots",colorMode:"fullcolor",dotSizeRatio:.8},letters:{renderMode:"ascii",charset:t.letters,colorMode:"fullcolor"},claudeCode:{renderMode:"ascii",charset:t.claudeCode,colorMode:"accent",accentColor:"#f97316"},art:{renderMode:"ascii",charset:t.dense,colorMode:"fullcolor"},terminal:{renderMode:"ascii",charset:t.standard,colorMode:"matrix"},box:{renderMode:"ascii",charset:t.box,colorMode:"grayscale"},lines:{renderMode:"ascii",charset:t.lines,colorMode:"fullcolor"},braille:{renderMode:"ascii",charset:t.braille,colorMode:"fullcolor"},katakana:{renderMode:"ascii",charset:t.katakana,colorMode:"matrix"},musical:{renderMode:"ascii",charset:t.musical,colorMode:"accent",accentColor:"#e040fb"},emoji:{renderMode:"ascii",charset:t.emoji,colorMode:"fullcolor"},circles:{renderMode:"ascii",charset:t.circles,colorMode:"accent",accentColor:"#d4ff00"},shadows:{renderMode:"ascii",charset:t.shadows,colorMode:"accent",accentColor:"#50a0ff"},starfield:{renderMode:"ascii",charset:t.starfield,colorMode:"fullcolor"},geometric:{renderMode:"ascii",charset:t.geometric,colorMode:"grayscale"},pipes:{renderMode:"ascii",charset:t.pipes,colorMode:"accent",accentColor:"#00ff88"},waves:{renderMode:"ascii",charset:t.waves,colorMode:"fullcolor"},shards:{renderMode:"ascii",charset:t.shards,colorMode:"grayscale"},smoke:{renderMode:"ascii",charset:t.smoke,colorMode:"accent",accentColor:"#c850ff"},ascii:{renderMode:"ascii",charset:t.ascii,colorMode:"grayscale"},interface:{renderMode:"ascii",charset:t.interface,colorMode:"accent",accentColor:"#f4f1ea"},prompt:{renderMode:"ascii",charset:t.prompt,colorMode:"matrix"},data:{renderMode:"ascii",charset:t.data,colorMode:"fullcolor"},humanist:{renderMode:"ascii",charset:t.humanist,colorMode:"accent",accentColor:"#d6ccc2"},mesh:{renderMode:"ascii",charset:t.mesh,colorMode:"accent",accentColor:"#8fd3ff"}},r={agentField:{...n.interface,charsetFrames:o.assistant,charsetFps:1.6,animationStyle:"breathe",animationSpeed:.75,ditherStrength:.12,hoverEffect:"glow",hoverStrength:.42,hoverRadius:.18,hoverColor:"#f4f1ea",normalize:!0},liquidSignal:{...n.data,charsetFrames:o.signal,charsetFps:2.4,animationStyle:"melt",animationSpeed:.65,ditherStrength:.45,hoverEffect:"repel",hoverStrength:.55,hoverRadius:.22,hoverColor:"#8fd3ff",normalize:!0},cursorGravity:{...n.mesh,charsetFrames:o.angular,charsetFps:1.2,animationStyle:"orbit",animationSpeed:.9,ditherStrength:.2,hoverEffect:"attract",hoverStrength:.82,hoverRadius:.24,hoverColor:"#ffffff",normalize:!0},editorialPulse:{...n.humanist,charsetFrames:o.editorial,charsetFps:.9,animationStyle:"ripple",animationSpeed:.55,ditherStrength:.18,hoverEffect:"spotlight",hoverStrength:.35,hoverRadius:.2,hoverColor:"#fff8ea",normalize:!0},terminalFlow:{...n.prompt,charsetFrames:o.terminal,charsetFps:3,animationStyle:"rain",animationSpeed:1.1,ditherStrength:.22,hoverEffect:"glitchText",hoverStrength:.65,hoverRadius:.16,hoverColor:"#d4ff00",hoverText:["BUILD","SHIP","RUN","ASK","MODEL"],normalize:!0}},a={fontSize:10,charSpacing:1,brightness:0,contrast:0,charset:t.standard,colorMode:"grayscale",accentColor:"#d4ff00",invert:!1,renderMode:"ascii",animationStyle:"none",animationSpeed:1,dotSizeRatio:.8,ditherStrength:0,charAspect:.55,normalize:!1,hoverStrength:0,hoverRadius:.2,hoverEffect:"spotlight",hoverColor:"#ffffff",hoverShape:"circle",hoverText:"ASCIIFY",artStyle:"classic",customText:"",chromaKey:null,chromaKeyTolerance:60};function i(e,t,o){let n=e+255*t;return n=259*(255*o+255)/(255*(259-255*o))*(n-128)+128,Math.max(0,Math.min(255,n))}function s(e,t,o){const n=o?1-e/255:e/255,r=[...t],a=Math.floor(n*(r.length-1));return r[Math.max(0,Math.min(r.length-1,a))]}function c(e,t,o,n,r,a){if((a?1-e/255:e/255)<.12)return" ";const i=[...t];return i[(n*r+o)%i.length]}var l=[[0,8,2,10],[12,4,14,6],[3,11,1,9],[15,7,13,5]];function h(e,t,o,n){if(n<=0)return e;const r=(l[o%4][t%4]/16-.5)*n*128;return Math.max(0,Math.min(255,e+r))}var f=new Array(256),d=new Array(256);for(let e=0;e<256;e++)f[e]=`rgb(${e},${e},${e})`,d[e]=`rgb(0,${e},0)`;function u(e,t,o,n,r,a=!1){switch(t){case"fullcolor":return`rgb(${e.r},${e.g},${e.b})`;case"matrix":return d[.299*e.r+.587*e.g+.114*e.b|0];case"accent":return`rgb(${o},${n},${r})`;default:{const t=.299*e.r+.587*e.g+.114*e.b|0;return f[t]}}}var m=[0,0,0];function g(e,t,o,n,r,a=!1){switch(t){case"fullcolor":m[0]=e.r,m[1]=e.g,m[2]=e.b;break;case"matrix":{const t=.299*e.r+.587*e.g+.114*e.b|0;m[0]=0,m[1]=t,m[2]=0;break}case"accent":m[0]=o,m[1]=n,m[2]=r;break;default:{const t=.299*e.r+.587*e.g+.114*e.b|0;m[0]=t,m[1]=t,m[2]=t;break}}return m}function M(e){const t=e.match(/rgba?\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)(?:\s*[,/]\s*([\d.]+))?\s*\)/);return t?{r:+t[1],g:+t[2],b:+t[3],a:void 0!==t[4]?+t[4]:1}:null}function p(e){let t=e;for(;t&&t!==document.documentElement.parentElement;){const e=getComputedStyle(t).backgroundColor;if(e&&"transparent"!==e&&"rgba(0, 0, 0, 0)"!==e){const t=M(e);if(t&&t.a>.1)return t}t=t.parentElement}return null}function b(e){if(e){const t=p(e);if(t){return(.299*t.r+.587*t.g+.114*t.b)/255<.4}}if("undefined"!=typeof document){const e=document.documentElement,t=(e.getAttribute("data-theme")||"").toLowerCase();if("dark"===t)return!0;if("light"===t)return!1;if(e.classList.contains("dark"))return!0;if(document.body){const e=p(document.body);if(e){return(.299*e.r+.587*e.g+.114*e.b)/255<.4}}}return"undefined"!=typeof window&&window.matchMedia("(prefers-color-scheme: dark)").matches}function v(e,t,o,n,r,a,i){if("none"===a)return 1;const s=r*i;switch(a){case"wave":return.3+.7*(.6*(.5*Math.sin(e/o*Math.PI*4+3*s)+.5)+.4*(.5*Math.sin(t/n*Math.PI*3+2*s)+.5));case"pulse":{const r=o/2,a=n/2,i=Math.sqrt((e-r)**2+(t-a)**2),c=Math.sqrt(r**2+a**2);return.2+.8*(.5*Math.sin(i/c*Math.PI*6-4*s)+.5)}case"rain":return.1+.9*(.5*Math.sin(t/n*Math.PI*8-5*s+.3*e)+.5)*(.3*Math.sin(e/o*Math.PI*2+s)+.7);case"breathe":{const o=.3*Math.sin(2*s)+.7,n=.1*Math.sin(.1*(e+t)+s);return Math.max(.1,Math.min(1,o+n))}case"sparkle":{const o=43758.5453*Math.sin(127.1*e+311.7*t+43758.5453*Math.floor(8*s)),n=o-Math.floor(o);return n>.7?1:.15+.4*n}case"glitch":{const e=Math.floor(t/(.05*n)),o=43758.5453*Math.sin(43.23*e+17.89*Math.floor(6*s));if(o-Math.floor(o)>.85){const t=.5*Math.sin(30*s+e)+.5;return t<.3?0:t}return 1}case"spiral":{const r=o/2,a=n/2,i=e-r,c=t-a,l=Math.atan2(c,i),h=Math.sqrt(i*i+c*c),f=Math.sqrt(r*r+a*a);return.15+.85*(.5*Math.sin(3*l+h/f*Math.PI*8-3*s)+.5)}case"typewriter":{const r=o*n,a=t*o+e-.5*s%1*r*1.3;if(a>0)return 0;const i=Math.max(0,1+a/(.15*r));return Math.min(1,i)}case"scatter":{const r=o/2,a=n/2,i=e-r,c=t-a,l=Math.sqrt(i*i+c*c)/Math.sqrt(r*r+a*a),h=.5*Math.sin(1.5*s)+.5;return l>h?Math.max(0,1-3*(l-h)):.7+.3*Math.sin(10*l-2*s)}case"waveField":default:return 1;case"ripple":{const r=o/2,a=n/2,i=e-r,c=t-a,l=Math.sqrt(i*i+c*c),h=Math.sqrt(r*r+a*a);return.1+.9*(.5*Math.sin(l/h*Math.PI*10-5*s)+.5)*(.4+.6*(1-Math.min(1,l/(1.1*h))))}case"melt":{const o=t/n*Math.PI;return.05+(.5*Math.sin(o-1.8*s+.15*e)+.5)*(1-.6*(Math.max(0,t/n-.1)/.9))*.95}case"orbit":{const r=o/2,a=n/2,i=e-r,c=t-a,l=Math.atan2(c,i),h=Math.sqrt(i*i+c*c)/Math.sqrt(r*r+a*a);return.1+.9*(.5*Math.sin(2*l+6*h-2.5*s)+.5)}case"cellular":{const o=Math.floor(4*s),n=(e,t)=>{const n=43758.5453*Math.sin(127.1*e+311.7*t+43758.5453*o);return n-Math.floor(n)>.38?1:0},r=n(e,t),a=n(e-1,t)+n(e+1,t)+n(e,t-1)+n(e,t+1)+n(e-1,t-1)+n(e+1,t-1)+n(e-1,t+1)+n(e+1,t+1);return 1===(1===r?2===a||3===a?1:0:3===a?1:0)?1:.05}}}var x={scale:1,offsetX:0,offsetY:0,glow:0,colorBlend:0,proximity:0};function w(e,t,o,n,r,a,i,s,c="spotlight",l=.5,h="circle"){const f=e-o,d=t-n,u=.08+.35*l+.04*a;let m,g;if("box"===h){const e=Math.abs(f),t=Math.abs(d);m=Math.max(e,t),g=u}else m=Math.sqrt(f*f+d*d),g=u;if(m>=g)return x.scale=1,x.offsetX=0,x.offsetY=0,x.glow=0,x.colorBlend=0,x.proximity=0,x;const M=function(e){return e*e*(3-2*e)}(1-m/g)*r;let p=1,b=0,v=0,w=0,y=0;switch(c){case"spotlight":{p=1+M*a*1.8;const e=Math.atan2(d,f),t=M*M*a*.6;b=Math.cos(e)*t*i,v=Math.sin(e)*t*s,w=M*a*.4,y=M*M*a*.25;break}case"magnify":p=1+M*a*2.5,w=M*a*.15;break;case"repel":{p=1+M*a*.3;const e=Math.atan2(d,f),t=M*M*a*1.2;b=Math.cos(e)*t*i,v=Math.sin(e)*t*s;break}case"glow":w=M*a*.8,y=M*a*.4;break;case"colorShift":p=1+M*a*.4,w=M*a*.2,y=M*a*.7;break;case"attract":{const e=Math.atan2(d,f),t=M*M*a*1;b=-Math.cos(e)*t*i,v=-Math.sin(e)*t*s,w=M*a*.3;break}case"shatter":{const e=Math.atan2(d,f),t=.5*Math.sin(43.7*f+29.3*d),o=M*a*1.4*(.7+.3*t);b=Math.cos(e+t)*o*i,v=Math.sin(e+t)*o*s,p=Math.max(.1,1-M*a*.6),w=M*a*.25;break}case"trail":y=M*a*.9,w=M*a*.6,p=1+M*a*.15;break;case"glitchText":p=1,w=M*a*.5,y=M*a*.6}return x.scale=p,x.offsetX=b,x.offsetY=v,x.glow=w,x.colorBlend=y,x.proximity=M,x}function y(e){const t=e.match(/^#([0-9a-f]{3,8})$/i)?.[1];if(t){const e=t.length<=4?t.split("").map(e=>parseInt(e+e,16)):[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];return{r:e[0],g:e[1],b:e[2]}}const o=e.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);return o?{r:+o[1],g:+o[2],b:+o[3]}:null}function S(e){return e*e*e*(e*(6*e-15)+10)}function $(e,t,o){return e+(t-e)*o}function E(e,t){let o=127*e+311*t;return o^=o>>13,(o*(o*o*15731+789221)+1376312589&2147483647)/2147483647}function C(e,t){const o=Math.floor(e),n=Math.floor(t),r=t-n,a=S(e-o),i=S(r),s=E(o,n),c=E(o+1,n),l=E(o,n+1),h=E(o+1,n+1);return $($(s,c,a),$(l,h,a),i)}function T(e,t){return(.5*C(e,t)+.25*C(2.1*e,2.1*t)+.125*C(4.3*e,4.3*t))/.875}function A(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=13,charAspect:s=.62,lineHeightRatio:c=1.4,chars:l=" .:-=+*#%@",baseColor:h=null,accentColor:f,accentThreshold:d=.52,mouseInfluence:u=.55,mouseFalloff:m=2.8,speed:g=1,vortex:M=!0,sparkles:p=!0,breathe:b=!0,lightMode:v=!1}=a,x=f??(v?"#6b8700":"#d4ff00"),w=i*s,y=i*c,S=Math.ceil(t/w),$=Math.ceil(o/y),C=r.x,A=r.y;let R=212,I=255,k=0;{const e=x.replace("#","");6===e.length&&(R=parseInt(e.slice(0,2),16),I=parseInt(e.slice(2,4),16),k=parseInt(e.slice(4,6),16))}e.clearRect(0,0,t,o),e.font=`${i}px "JetBrains Mono", monospace`,e.textBaseline="top";const F=n*g,B=b?.12*(.5*Math.sin(.22*F)+.5):0;for(let t=0;t<$;t++)for(let o=0;o<S;o++){const n=o/S,r=t/$,a=.045,i=.08*F,s=.06,c=.45*((.5*Math.sin(.08*o+.05*t+.6*F)+.5+(.5*Math.sin(.03*o-.07*t+.4*F)+.5)+(.5*Math.sin(.05*o+.03*t+.8*F)+.5))/3)+.35*(.5*T(o*a+i,t*a*1.4-.7*i)+.5)+.2*(.5*Math.sin((o+.65*t)*s+1.1*F)+.5)+B,f=n-C,g=r-A,b=Math.sqrt(f*f+g*g);let x=0;if(M&&b<.35){const e=Math.atan2(g,f),t=Math.sin(4*e+2.2*F-14*b),o=Math.max(0,1-b/.35);x=t*o*o*.22}const L=c*(1-u)+(Math.max(0,1-b*m)+.5*x)*u+.15*x,z=Math.min(1,Math.max(0,L));let P=z;if(p&&z>.72){const e=Math.floor(8*F),n=E(7*o+3*e,11*t+e);n>.88&&(P=Math.min(1,z+4*(n-.88)))}const q=Math.floor(P*(l.length-1));if(" "===l[q])continue;const H=.015+.07*P;if(P>d){const t=Math.min(v?.9:.28,H*(v?14:2.8));e.fillStyle=`rgba(${R},${I},${k},${t})`}else e.fillStyle=h?h.replace("{a}",String(H)):v?`rgba(55,55,55,${7*H})`:`rgba(255,255,255,${H})`;e.fillText(l[q],o*w,t*y)}}function R(e,t){return"auto"!==e?e:!b(t)}function I(e){const t=e.match(/^#([0-9a-fA-F]{3,6})$/);if(t){let e=t[1];if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return e}const o=e.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);return o?[o[1],o[2],o[3]].map(e=>parseInt(e).toString(16).padStart(2,"0")).join(""):null}function k(e){const t=e||"auto";if("auto"!==t)return t.replace("#","");if("undefined"!=typeof document){const e=getComputedStyle(document.documentElement);for(const t of["--accent-color","--color-accent","--accent","--color-primary","--primary","--brand-color"]){const o=I(e.getPropertyValue(t).trim());if(o)return o}const t=I(getComputedStyle(document.body).accentColor??"");if(t)return t}return b("undefined"!=typeof document?document.body:null)?"faf9f7":"0d0d0d"}function F(e,t,o,n){const r=e instanceof HTMLVideoElement?e.videoWidth:e.width,a=e instanceof HTMLVideoElement?e.videoHeight:e.height;if(0===r||0===a)return{frame:[],cols:0,rows:0};const l=t.charAspect,f=t.fontSize*t.charSpacing,d=t.fontSize/l*t.charSpacing,u=o||r,m=n||a,g=Math.floor(u/f),M=Math.floor(m/d);if(g<=0||M<=0)return{frame:[],cols:0,rows:0};const p=Math.max(1,Math.min(Math.floor(2048/g),Math.floor(r/g))),b=Math.max(1,Math.min(Math.floor(2048/M),Math.floor(a/M))),v=g*p,x=M*b,{ctx:w}=function(e,t){const o=document.createElement("canvas");o.width=e,o.height=t;const n=o.getContext("2d",{willReadFrequently:!0});return{canvas:o,ctx:n}}(v,x);w.drawImage(e,0,0,v,x);const y=w.getImageData(0,0,v,x).data,S=t.chromaKey,$=null!=S&&!1!==S,E=!0===S,C="blue-screen"===S;let T=null,A=0;!$||E||C||(T=function(e){if("string"!=typeof e)return e;const t=document.createElement("canvas");t.width=1,t.height=1;const o=t.getContext("2d");o.fillStyle=e,o.fillRect(0,0,1,1);const n=o.getImageData(0,0,1,1).data;return{r:n[0],g:n[1],b:n[2]}}(S),A=(t.chromaKeyTolerance??60)**2);let I=0,k=255;if(t.normalize){let e=255,t=0;for(let o=0;o<y.length;o+=4){if($){const e=y[o],t=y[o+1],n=y[o+2];let r=!1;if(E)r=t>1.4*e&&t>1.4*n&&t>80;else if(C)r=n>1.4*e&&n>1.4*t&&n>80;else if(null!==T){const o=e-T.r,a=t-T.g,i=n-T.b;r=o*o+a*a+i*i<=A}if(r)continue}const n=.299*y[o]+.587*y[o+1]+.114*y[o+2];n<e&&(e=n),n>t&&(t=n)}I=e,k=t>e?t-e:255}const F=[],B=R(t.invert),L=$&&t.charset.replace(/ /g,"")||t.charset,z=p*b;for(let e=0;e<M;e++){const o=[];for(let n=0;n<g;n++){let r=0,a=0,l=0,f=0,d=0;for(let t=0;t<b;t++){const o=(e*b+t)*v;for(let e=0;e<p;e++){const t=4*(o+n*p+e),i=y[t],s=y[t+1],c=y[t+2],h=y[t+3];if($){let e=!1;if(E)e=s>1.4*i&&s>1.4*c&&s>80;else if(C)e=c>1.4*i&&c>1.4*s&&c>80;else if(null!==T){const t=i-T.r,o=s-T.g,n=c-T.b;e=t*t+o*o+n*n<=A}if(e){d++;continue}}r+=i,a+=s,l+=c,f+=h}}if($&&d>z/2){o.push({char:" ",r:0,g:0,b:0,a:0});continue}const u=z-d,m=u>0?r/u:0,M=u>0?a/u:0,x=u>0?l/u:0,w=u>0?f/u:0,S=.299*m+.587*M+.114*x,R=h(i(t.normalize?(S-I)/k*255:S,t.brightness,t.contrast),n,e,t.ditherStrength),F=t.customText?c(R,t.customText,n,e,g,B):s(R,L,B);o.push({char:F,r:m,g:M,b:x,a:w,lum:R})}F.push(o)}return{frame:F,cols:g,rows:M}}async function B(e,t,o,n,r=12,a=10,i,s=0){const c=Math.min(e.duration-s,a),l=Math.ceil(c*r),h=[];let f=0,d=0;for(let a=0;a<l;a++){const u=s+a/r;if(u>s+c)break;e.currentTime=u,await new Promise(t=>{const o=()=>{e.removeEventListener("seeked",o),t()};e.addEventListener("seeked",o)});const m=F(e,t,o,n);h.push(m.frame),f=m.cols,d=m.rows,i?.((a+1)/l)}return{frames:h,cols:f,rows:d,fps:r}}async function L(t,o,n,r,a){const i=e.parseGIF(t),s=e.decompressFrames(i,!0);if(0===s.length)return{frames:[],cols:0,rows:0,fps:10};const c=s[0].dims.width,l=s[0].dims.height,h=i.lsd?.width||c,f=i.lsd?.height||l,d=document.createElement("canvas");d.width=h,d.height=f;const u=d.getContext("2d"),m=document.createElement("canvas");m.width=h,m.height=f;const g=m.getContext("2d"),M=[];let p=0,b=0,v=0;for(const e of s)v+=e.delay||100;const x=v/s.length,w=Math.round(Math.min(30,Math.max(5,1e3/x))),y=Math.min(s.length,300);for(let e=0;e<y;e++){const t=s[e],{dims:i,patch:c,disposalType:l}=t;3===l&&(g.clearRect(0,0,h,f),g.drawImage(d,0,0));const v=new ImageData(new Uint8ClampedArray(c.buffer),i.width,i.height),x=document.createElement("canvas");x.width=i.width,x.height=i.height;x.getContext("2d").putImageData(v,0,0),u.drawImage(x,i.left||0,i.top||0);const w=F(d,o,n,r);M.push(w.frame),p=w.cols,b=w.rows,2===l?u.clearRect(i.left||0,i.top||0,i.width,i.height):3===l&&(u.clearRect(0,0,h,f),u.drawImage(m,0,0)),a?.((e+1)/y)}return{frames:M,cols:p,rows:b,fps:w}}function z(e,t,o,n,r,a=0,i){if("waveField"===o.animationStyle){return void A(e,n,r,a,i?{x:i.x,y:i.y}:{x:.5,y:.5},{accentColor:`#${o.accentColor?k(o.accentColor):"d4ff00"}`,accentThreshold:.52,mouseInfluence:o.hoverStrength>0?Math.min(1,.3+.5*o.hoverStrength):.55,mouseFalloff:2.8,speed:o.animationSpeed,vortex:o.hoverStrength>0,sparkles:!0,breathe:!0})}const c=t.length;if(0===c)return;const l=t[0].length;e.clearRect(0,0,n,r);let h=!1;const f=Math.max(1,c>>2),d=Math.max(1,l>>2);e:for(let e=0;e<c;e+=f){const o=t[e];for(let e=0;e<l;e+=d)if(o[e].a<200){h=!0;break e}}const m=e.canvas,M=b(m);h||(e.fillStyle=M?"#0a0a0a":"#faf9f7",e.fillRect(0,0,n,r));const p=n/l,x=r/c,y=c*l,S=i?.intensity??1,$=!("none"!==o.animationStyle&&y>5e3)&&!!(i&&o.hoverStrength>0&&S>.005),E=o.hoverColor||"#ffffff",C=parseInt(E.slice(1,3),16)||255,T=parseInt(E.slice(3,5),16)||255,I=parseInt(E.slice(5,7),16)||255,F=k(o.accentColor),B=parseInt(F.substring(0,2),16)||255,L=parseInt(F.substring(2,4),16)||255,z=parseInt(F.substring(4,6),16)||255,P=y>3e4?.25:y>15e3?.4:y>5e3?.6:1,q=o.hoverRadius*P;let H=0,W=l,j=0,U=c,O=0,_=0;if($&&i){O=i.x,_=i.y;const e=.08+.35*q+.04*o.hoverStrength;H=Math.max(0,Math.floor((O-e)*l)-1),W=Math.min(l,Math.ceil((O+e)*l)+1),j=Math.max(0,Math.floor((_-e)*c)-1),U=Math.min(c,Math.ceil((_+e)*c)+1)}const D=o.animationStyle,Y=o.animationSpeed,V="none"===D,N=o.hoverStrength,G=o.hoverEffect,X=q,J=o.hoverShape||"circle",K=R(o.invert,m),Q=o.colorMode,Z=2*Math.PI,ee=1/l,te=1/c;let oe="",ne=-1;if("dots"===o.renderMode){const n=.5*Math.min(p,x)*o.dotSizeRatio;for(let o=0;o<c;o++){const r=t[o];for(let t=0;t<l;t++){const i=r[t];if(i.a<10)continue;const s=.00392156863*(.299*i.r+.587*i.g+.114*i.b),h=K?1-s:s;if(h<.02)continue;const f=V?1:v(t,o,l,c,a,D,Y);let d=1,m=0,M=0,b=0,y=0;if($&&t>=H&&t<=W&&o>=j&&o<=U){const e=w(t*ee,o*te,O,_,S,N,p,x,G,X,J);d=e.scale,m=e.offsetX,M=e.offsetY,b=e.glow,y=e.colorBlend}const E=n*h*f*d;if(E<.3)continue;const A=t*p+.5*p+m,R=o*x+.5*x+M;let k;if(y>0){const e=g(i,Q,B,L,z,K);k=`rgb(${Math.min(255,e[0]+(C-e[0])*y|0)},${Math.min(255,e[1]+(T-e[1])*y|0)},${Math.min(255,e[2]+(I-e[2])*y|0)})`}else k=u(i,Q,B,L,z,K);const F=Math.min(1,.00392156863*i.a*f*(1+b));if(F!==ne&&(e.globalAlpha=F,ne=F),k!==oe&&(e.fillStyle=k,oe=k),E<=3){const t=2*E;e.fillRect(A-E,R-E,t,t)}else e.beginPath(),e.arc(A,R,E,0,Z),e.fill()}}}else{const n=.55,r=.9*Math.min(p/n,x),i=r<6;if(!i){const t="emoji"===o.artStyle;e.font=t?`${r}px "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif`:`${r}px "JetBrains Mono", monospace`,e.textAlign="center",e.textBaseline="middle"}let h=null;const f=o.charsetFrames,d=!!f?.length,m=d?f[Math.floor(Math.max(0,a)*(o.charsetFps??2))%f.length]:o.charset;if(i){h={};const e=[...m],t=e.length;for(let o=0;o<t;o++)h[e[o]]=Math.max(.1,(o+.3)/t)}const M=i?null:e.getTransform();if(!i&&!$&&V&&!d&&"accent"===Q){e.fillStyle=`rgb(${B},${L},${z})`,e.globalAlpha=1,e.textAlign="left";for(let o=0;o<c;o++){const n=t[o];let r="";for(let e=0;e<l;e++){const t=n[e];r+=t.a<10?" ":t.char}0!==r.trim().length&&e.fillText(r,.5*p,o*x+.5*x)}return void(e.globalAlpha=1)}const b="glitchText"===G&&$,y="!@#$%^&*<>{}[]|/\\~`0123456789",E=y.length;let A="",R=0,k=0,F=0,P=0,Z=0,re=0;if(b){const e=o.hoverText??"ASCIIFY";if(k=Math.round(O*l),F=Math.round(_*c),Array.isArray(e)){const t=e.filter(e=>e.length>0);0===t.length&&t.push("ASCIIFY");A=t[((7*Math.floor(k/Math.max(1,Math.ceil(l/5)))+13*Math.floor(F/Math.max(1,Math.ceil(c/3))))%t.length+t.length)%t.length]}else A=e||"ASCIIFY";R=A.length,P=Math.max(3,Math.min(12,Math.round(c*q*.6)));const t=Math.floor(P/2);Z=Math.max(0,F-t),Z+P>c&&(Z=Math.max(0,c-P)),re=k-Math.floor(R/2)}for(let o=0;o<c;o++){const n=t[o];for(let t=0;t<l;t++){const r=n[t];if(r.a<10)continue;let f=d&&null!=r.lum?s(r.lum,m,K):r.char;if(" "===f)continue;const q=V?1:v(t,o,l,c,a,D,Y);if(q<.05)continue;let ae=1,ie=0,se=0,ce=0,le=0;if($&&!b&&t>=H&&t<=W&&o>=j&&o<=U){const e=w(t*ee,o*te,O,_,S,N,p,x,G,X,J);ae=e.scale,ie=e.offsetX,se=e.offsetY,ce=e.glow,le=e.colorBlend}if(b&&o>=Z&&o<Z+P){const e=t-re;if(e>=0&&e<R){const n=A[e],r=Math.abs(o-F)/Math.max(1,.5*P),i=Math.abs(t-k)/Math.max(1,R),s=Math.max(r,i),c=Math.max(0,Math.min(1,1-.9*s)),l=43758.5453*Math.sin(127.1*t+311.7*o+43758.5453*Math.floor(12*a));f=Math.abs(l-Math.floor(l))<c?n:y[Math.abs(Math.floor(97*l))%E],ce=.3+.7*c,le=.3+.65*c}}const he=t*p+.5*p+ie,fe=o*x+.5*x+se;let de;if(le>0){const e=g(r,Q,B,L,z,K);de=`rgb(${Math.min(255,e[0]+(C-e[0])*le|0)},${Math.min(255,e[1]+(T-e[1])*le|0)},${Math.min(255,e[2]+(I-e[2])*le|0)})`}else de=u(r,Q,B,L,z,K);if(i){const t=h[f]??.5,o=Math.min(1,.00392156863*r.a*q*(1+ce))*t;if(o<.02)continue;o!==ne&&(e.globalAlpha=o,ne=o),de!==oe&&(e.fillStyle=de,oe=de);const n=p*ae,a=x*ae;e.fillRect(he-.5*n,fe-.5*a,n,a)}else{const t=Math.min(1,.00392156863*r.a*q*(1+ce));t!==ne&&(e.globalAlpha=t,ne=t),de!==oe&&(e.fillStyle=de,oe=de),1!==ae?(e.translate(he,fe),e.scale(ae,ae),e.fillText(f,0,0),e.setTransform(M)):e.fillText(f,he,fe)}}}}e.globalAlpha=1}function P(e){return Math.max(0,Math.min(1,e))}function q(e){return"string"==typeof e?document.querySelector(e):e instanceof HTMLElement?e:null}function H(e,t,o={}){if(!Number.isFinite(e.duration)||e.duration<=0)return;const n=o.from??0,r=o.to??e.duration,a=Math.max(n,Math.min(r,e.duration)),i=P(o.ease?o.ease(P(t)):t),s=n+(a-n)*i;e.currentTime=Math.min(Math.max(n,s),Math.max(n,a-.04)),o.onUpdate?.(i,e)}function W(e,t={}){const o=q(t.trigger)??e;e.pause();const n=t.gsap,r=t.ScrollTrigger??n?.ScrollTrigger;if(n&&r?.create){n.registerPlugin?.(r);const a=r.create({trigger:o,start:t.start??"top bottom",end:t.end??"bottom top",scrub:t.scrub??!0,onUpdate:o=>H(e,o.progress,t)});return()=>a.kill?.()}return function(e,t,o){let n=0;const r=()=>{n=0;const r=t.getBoundingClientRect(),a=window.innerHeight||document.documentElement.clientHeight,i=r.height+a,s=i>0?P((a-r.top)/i):0;H(e,s,o)},a=()=>{n||(n=requestAnimationFrame(r))};return window.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a),a(),()=>{window.removeEventListener("scroll",a),window.removeEventListener("resize",a),n&&cancelAnimationFrame(n)}}(e,o,t)}function j(e,t,o){const n=t.gsap,r=t.ScrollTrigger??n?.ScrollTrigger;if(n&&r?.create){n.registerPlugin?.(r);const a=r.create({trigger:e,start:t.start??"top bottom",end:t.end??"bottom top",scrub:t.scrub??!0,onUpdate:e=>o(e.progress)});return()=>a.kill?.()}return function(e,t){let o=0;const n=()=>{o=0;const n=e.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight,a=n.height+r,i=a>0?P((r-n.top)/a):0;t(i)},r=()=>{o||(o=requestAnimationFrame(n))};return window.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),r(),()=>{window.removeEventListener("scroll",r),window.removeEventListener("resize",r),o&&cancelAnimationFrame(o)}}(e,o)}function U(e,t,o=2048){const n=o,r=Math.min(1,n/Math.max(e,t));return{renderW:Math.round(e*r),renderH:Math.round(t*r)}}function O(e,t,o,n,r,a=2048){const{width:i,height:s}=t.getBoundingClientRect();if(!i||!s)return{renderW:0,renderH:0,dpr:1};let c,l,h=i,f=h/o;f>s&&(f=s,h=f*o),h=Math.round(h),f=Math.round(f),n&&r?({renderW:c,renderH:l}=U(n,r,a)):(c=h,l=f);const d="undefined"!=typeof window&&window.devicePixelRatio||1,u=8e6,m=c*d*l*d>u?Math.sqrt(u/(c*l)):d;return e.width=Math.round(c*m),e.height=Math.round(l*m),e.style.width=h+"px",e.style.height=f+"px",{renderW:c,renderH:l,dpr:m}}async function _(e,t,{fontSize:o,artStyle:r="classic",options:i={},fitTo:s,preExtract:c=!1,fps:l,maxRenderDimension:h=2048,trim:f,scroll:d,onReady:u,onFrame:m}={}){const g=f?.start??0,M=f?.end,p=o??i.fontSize??10,b={...a,...n[r],...i,fontSize:p},v=t.getContext("2d");if(!v)throw new Error("asciifyVideo: could not get 2d context from canvas.");const x="string"==typeof s?document.querySelector(s):s instanceof HTMLElement?s:null;if(c){let o;"string"==typeof e?(o=document.createElement("video"),o.crossOrigin="anonymous",o.src=e,o.readyState<2&&await new Promise((t,n)=>{o.onloadeddata=()=>t(),o.onerror=()=>n(new Error(`asciifyVideo: failed to load "${e}"`))})):o=e,x&&O(t,x,o.videoWidth/o.videoHeight,o.videoWidth,o.videoHeight,h);const{renderW:n,renderH:r}=U(o.videoWidth,o.videoHeight,h),a="undefined"!=typeof window&&window.devicePixelRatio||1,i=8e6,s=n*a*r*a>i?Math.sqrt(i/(n*r)):a;t.width<Math.round(n*s)&&(t.width=Math.round(n*s),t.height=Math.round(r*s));const c=void 0!==M?M-g:10,f=l??(d?18:void 0),{frames:p,fps:w}=await B(o,b,n,r,f,c,void 0,g),y=e=>{const t=p[e];t&&(v.save(),v.setTransform(s,0,0,s,0,0),z(v,t,b,n,r),v.restore(),m?.())};if(d){let e=!1,n=-1;const r=!0===d?{}:d,a=j(q(r.trigger)??x??t,r,t=>{const a=P(r.ease?r.ease(P(t)):t),i=Math.max(0,Math.min(p.length-1,Math.round(a*(p.length-1))));i!==n&&(n=i,y(i),e||(e=!0,u?.(o)),r.onUpdate?.(a,o))});return y(0),e=!0,u?.(o),a}let S,$=!1,E=0,C=performance.now(),T=!0;const A=1e3/w,R=e=>{$||(e-C>=A&&(y(E),E=(E+1)%p.length,C=e,T&&(T=!1,u?.(o))),S=requestAnimationFrame(R))};return S=requestAnimationFrame(R),()=>{$=!0,cancelAnimationFrame(S)}}let w,y=!1;"string"==typeof e?(w=document.createElement("video"),w.src=e,w.muted=!0,w.loop=!0,w.playsInline=!0,w.setAttribute("playsinline",""),Object.assign(w.style,{position:"fixed",top:"0",left:"0",width:"1px",height:"1px",opacity:"0",pointerEvents:"none",zIndex:"-1"}),document.body.appendChild(w),y=!0,await new Promise((t,o)=>{w.onloadedmetadata=()=>t(),w.onerror=()=>o(new Error(`asciifyVideo: failed to load "${e}"`))}),await w.play().catch(()=>{})):(w=e,w.readyState<HTMLMediaElement.HAVE_METADATA&&await new Promise((e,t)=>{const o=()=>{w.removeEventListener("loadedmetadata",n),w.removeEventListener("error",r)},n=()=>{o(),e()},r=()=>{o(),t(new Error("asciifyVideo: provided video element failed to load metadata."))};w.addEventListener("loadedmetadata",n),w.addEventListener("error",r),w.load()}),w.paused&&await w.play().catch(()=>{})),g>0&&(w.currentTime=g,await new Promise(e=>{const t=()=>{w.removeEventListener("seeked",t),e()};w.addEventListener("seeked",t)}));let S=null;(g>0||void 0!==M)&&(S=()=>{(void 0!==M&&w.currentTime>=M||g>0&&w.currentTime<g)&&(w.currentTime=g)},w.addEventListener("timeupdate",S));let $=null;const{renderW:E,renderH:C}=U(w.videoWidth,w.videoHeight,h);if(x){const e=w.videoWidth/w.videoHeight,o=w.videoWidth,n=w.videoHeight,r=O(t,x,e,o,n,h),a=t.getContext("2d");a&&a.setTransform(r.dpr,0,0,r.dpr,0,0),$=new ResizeObserver(()=>{const r=O(t,x,e,o,n,h),a=t.getContext("2d");a&&a.setTransform(r.dpr,0,0,r.dpr,0,0)}),$.observe(x)}else{const e="undefined"!=typeof window&&window.devicePixelRatio||1,o=8e6,n=E*e*C*e>o?Math.sqrt(o/(E*C)):e;t.width<Math.round(E*n)&&(t.width=Math.round(E*n),t.height=Math.round(C*n)),v.setTransform(n,0,0,n,0,0)}let T,A=!1,R=!0,I=null;const k=d&&!c,L=l&&l>0?1e3/l:0;let H=0,_=-1;if(k){const e=!0===d?{}:d;I=W(w,{...e,trigger:e.trigger??x??t,from:e.from??g,to:e.to??M})}const D=e=>{if(A)return;if(T=requestAnimationFrame(D),w.readyState<2||0===t.width||0===t.height)return;if(L>0&&e-H<L)return;if(g>0&&w.currentTime<g)return;if(void 0!==M&&w.currentTime>=M)return;if(k&&Math.abs(w.currentTime-_)<1/240)return;const{frame:o}=F(w,b,E,C);o.length>0&&(z(v,o,b,E,C,0,null),H=e,_=w.currentTime,R&&(R=!1,u?.(w)),m?.())};return T=requestAnimationFrame(D),()=>{A=!0,cancelAnimationFrame(T),I?.(),$?.disconnect(),S&&w.removeEventListener("timeupdate",S),y&&(w.pause(),w.src="",document.body.removeChild(w))}}function D(e,t,o,n,r={}){const{fontSize:a=13,chars:i="0123456789ABCDEF@#$&*+=/<>",accentColor:s,color:c,speed:l=1,density:h=.55,tailLength:f=14,lightMode:d=!1}=r,u=s??(d?"#6b8700":"#d4ff00"),m=.62*a,g=1.4*a,M=Math.ceil(t/m),p=Math.ceil(o/g);e.clearRect(0,0,t,o),e.font=`${a}px monospace`,e.textBaseline="top";let b=255,v=255,x=255;if(d&&(b=55,v=55,x=55),c){const e=y(c);e&&(b=e.r,v=e.g,x=e.b)}let w=212,S=255,$=0;const C=y(u);C&&(w=C.r,S=C.g,$=C.b);const T=p+f;for(let t=0;t<M;t++){if(E(17*t,3)>h)continue;const o=(.5+1.5*E(31*t,7))*l,r=E(13*t,11)*T,a=Math.floor((n*o*7+r)%T),s=t*m;for(let o=0;o<=f;o++){const r=a-(f-o);if(r<0||r>=p)continue;const c=r*g,l=E(53*t+Math.floor(5*n+o),7*r),h=i[Math.floor(l*i.length)],u=o/f;if(o===f)e.fillStyle=`rgba(${w},${S},${$},${d?.7:.85})`;else{const t=d?.85*u:.15*u;e.fillStyle=`rgba(${b},${v},${x},${t})`}e.fillText(h,s,c)}}}function Y(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=" . · * + ° ★",accentColor:c,color:l,speed:h=1,count:f=180,lightMode:d=!1}=a,u=c??(d?"#6b8700":"#d4ff00");e.clearRect(0,0,t,o),e.textBaseline="middle",e.textAlign="center";const m=t*(.2+.6*r.x),g=o*(.2+.6*r.y),M=.65*Math.sqrt(t*t+o*o);let p=255,b=255,v=255;if(d&&(p=55,b=55,v=55),l){const e=y(l);e&&(p=e.r,b=e.g,v=e.b)}let x=212,w=255,S=0;const $=y(u);$&&(x=$.r,w=$.g,S=$.b);const C=s.replace(/ /g,"").split("");if(0!==C.length){for(let r=0;r<f;r++){const a=E(17*r,3)*Math.PI*2,s=(n*(.15+.85*E(31*r,7))*h*.22+E(13*r,11))%1,c=m+Math.cos(a)*s*M,l=g+Math.sin(a)*s*M;if(c<-20||c>t+20||l<-20||l>o+20)continue;const f=Math.max(6,i*(.4+.9*s));e.font=`${f}px monospace`;const u=C[Math.min(C.length-1,Math.floor(s*C.length))],y=s>.72,$=d?.85*s:.2*s;e.fillStyle=y?`rgba(${x},${w},${S},${Math.min(d?.92:.32,2.2*$)})`:`rgba(${p},${b},${v},${$})`,e.fillText(u,c,l)}e.textAlign="left"}}function V(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=". · ○ ◎ ●",accentColor:c,color:l,rings:h=5,speed:f=1,sharpness:d=4,lightMode:u=!1}=a,m=c??(u?"#007a5e":"#00ffcc");e.clearRect(0,0,t,o),e.textBaseline="middle",e.textAlign="center";const g=t*r.x,M=o*r.y,p=1.6*Math.sqrt(g*g+M*M)+.2*Math.sqrt(t*t+o*o);let b=255,v=255,x=255;if(u&&(b=55,v=55,x=55),l){const e=y(l);e&&(b=e.r,v=e.g,x=e.b)}let w=0,S=255,$=204;const E=y(m);E&&(w=E.r,S=E.g,$=E.b);const C=s.replace(/ /g,"").split("");if(0===C.length)return;const T=Math.ceil(t/i),A=Math.ceil(o/i);for(let t=0;t<A;t++)for(let o=0;o<T;o++){const r=o*i+.5*i,a=t*i+.5*i,s=r-g,c=a-M,l=Math.sqrt(s*s+c*c)/p;let m=0;for(let e=0;e<h;e++){const t=(n*f*.38+e/h)%1,o=Math.abs(l-t),r=Math.max(0,1-o*p/(i*(12-d)));m+=Math.cos(r*Math.PI*.5)*r}if(m=Math.min(1,m),m<.02)continue;const y=m>.6;e.font=`${i}px monospace`;const E=Math.floor(m*(C.length-1)),T=C[Math.min(E,C.length-1)],A=u?.88*m:.22*m;e.fillStyle=y?`rgba(${w},${S},${$},${Math.min(u?.95:.4,.55*m)})`:`rgba(${b},${v},${x},${A})`,e.fillText(T,r,a)}e.textAlign="left"}function N(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=" .·:;=+*#%@░▒▓",accentColor:c,color:l,octaves:h=4,speed:f=1,scale:d=1,accentThreshold:u=.78,mouseWarp:m=.3,lightMode:g=!1}=a,M=c??(g?"#6b8700":"#d4ff00"),p=.62*i,b=1.4*i,v=Math.ceil(t/p),x=Math.ceil(o/b);e.clearRect(0,0,t,o),e.font=`${i}px monospace`,e.textBaseline="top";let w=255,S=255,$=255;if(g&&(w=55,S=55,$=55),l){const e=y(l);e&&(w=e.r,S=e.g,$=e.b)}let E=212,T=255,A=0;const R=y(M);R&&(E=R.r,T=R.g,A=R.b);const I=.035*d,k=n*f,F=Math.min(6,Math.max(1,h)),B=(e,t)=>{let o=0,n=.5,r=1,a=0;for(let i=0;i<F;i++)o+=C(e*r,t*r)*n,a+=n,n*=.5,r*=2.1;return o/a};for(let t=0;t<x;t++)for(let o=0;o<v;o++){const n=o*I+.06*k,a=t*I*1.3-.04*k,i=o/v-r.x,c=t/x-r.y,l=Math.sqrt(i*i+c*c),h=m>0?.12*Math.max(0,1-l/m):0,f=.5*B(n+h*Math.sin(1.3*k+8*c),a+h*Math.cos(.9*k+8*i))+.5;if(f<.12)continue;const d=s[Math.floor(f*(s.length-1))];if(" "===d)continue;const M=f>u,y=g?.82*f:.13*f;e.fillStyle=M?`rgba(${E},${T},${A},${g?.92:.28})`:`rgba(${w},${S},${$},${y})`,e.fillText(d,o*p,t*b)}}function G(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=12,chars:s="·-=+|/",accentColor:c,color:l,bands:h=3,speed:f=1,bandWidth:d=.12,glitch:u=!0,lightMode:m=!1}=a,g=c??(m?"#6b8700":"#d4ff00"),M=.62*i,p=1.4*i,b=Math.ceil(t/M),v=Math.ceil(o/p);e.clearRect(0,0,t,o),e.font=`${i}px monospace`,e.textBaseline="top";let x=255,w=255,S=255;if(m&&(x=55,w=55,S=55),l){const e=y(l);e&&(x=e.r,w=e.g,S=e.b)}let $=212,C=255,T=0;const A=y(g);A&&($=A.r,C=A.g,T=A.b);const R=n*f;for(let t=0;t<v;t++)for(let o=0;o<b;o++){const n=t/v,a=((n*h-.5*R)%1+1)%1,i=Math.max(0,1-a/d),c=.35*(.5*E(3*o,7*t)+.5);let l=0;if(u){const e=o/b-r.x,a=n-r.y,i=Math.sqrt(e*e+a*a);if(i<.18){const e=E(11*o+Math.floor(12*R),5*t);l=Math.max(0,1-i/.18)*(e>.5?e-.3:0)}}const f=Math.min(1,c+.8*i+.6*l);if(f<.04)continue;const g=s[Math.floor(f*(s.length-1))],y=i>.55,A=m?.82*f:.12*f;e.fillStyle=y?`rgba(${$},${C},${T},${m?.92:.28})`:`rgba(${x},${w},${S},${A})`,e.fillText(g,o*M,t*p)}}function X(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=" ·∙•:;+=≡≣#@",color:c,accentColor:l,speed:h=1,layers:f=5,softness:d=1.2,mouseRipple:u=.2,lightMode:m=!1}=a,g=l??(m?"#6b8700":"#d4ff00"),M=.62*i,p=1.4*i,b=Math.ceil(t/M),v=Math.ceil(o/p);e.clearRect(0,0,t,o),e.font=`${i}px monospace`,e.textBaseline="top";let x=255,w=255,S=255;if(m&&(x=55,w=55,S=55),c){const e=y(c);e&&(x=e.r,w=e.g,S=e.b)}let $=212,C=255,T=0;const A=y(g);A&&($=A.r,C=A.g,T=A.b);const R=n*h,I=[];for(let e=0;e<f;e++){const t=E(17*e,31*e+7),o=E(23*e+5,11*e);I.push({fx:.8+2.2*t,fy:1.2+1.8*o,phase:t*Math.PI*4,dt:(.3+.5*E(7*e,13*e+3))*(e%2==0?1:-1),amp:.55+.45*E(29*e,3*e)})}for(let t=0;t<v;t++){const o=t/v;for(let n=0;n<b;n++){const a=n/b,i=a-r.x,c=o-r.y,l=Math.sqrt(i*i+c*c),h=u*Math.exp(-l*l/.06),g=a+i*h,v=o+c*h;let y=0,E=0;for(let e=0;e<f;e++){const{fx:t,fy:o,phase:n,dt:r,amp:a}=I[e];y+=Math.sin(g*t*Math.PI*2+R*r+n)*Math.cos(v*o*Math.PI*2+R*r*.7+1.3*n)*a,E+=a}const A=y/E,k=.5+.5*Math.tanh(A*d*2.2);if(k<.12)continue;const F=(k-.12)/.88,B=s[Math.min(s.length-1,Math.floor(F*s.length))],L=k>.82,z=m?.82*k:.14*k;e.fillStyle=L?`rgba(${$},${C},${T},${m?.92:.32})`:`rgba(${x},${w},${S},${z})`,e.fillText(B,n*M,t*p)}}}function J(e,t,o,n,r={}){const{fontSize:a=13,color:i,accentColor:s,speed:c=.4,layers:l=4,turbulence:h=.8,lightMode:f=!1}=r,d=s??(f?"#6b8700":"#d4ff00"),u=.62*a,m=1.4*a,g=Math.ceil(t/u),M=Math.ceil(o/m);e.clearRect(0,0,t,o),e.font=`${a}px monospace`,e.textBaseline="top";let p=255,b=255,v=255;if(f&&(p=55,b=55,v=55),i){const e=y(i);e&&(p=e.r,b=e.g,v=e.b)}let x=212,w=255,S=0;const $=y(d);$&&(x=$.r,w=$.g,S=$.b);const C=n*c,T=["─","─","╌","·","╌","─","─","╌","·"];for(let t=0;t<M;t++){const o=t/M;for(let n=0;n<g;n++){const r=n/g;let a=0,i=0;for(let e=0;e<l;e++){const t=E(13*e,7*e+3),n=1.1+2.4*t,s=.9+2*E(29*e,11*e+1),c=t*Math.PI*6,l=(.2+.5*E(41*e,17*e))*(e%2==0?1:-1.3),f=Math.sin(r*n*Math.PI*2+C*l+c),d=Math.cos(o*s*Math.PI*2+C*l*.6+1.7*c),u=Math.sin(r*s*Math.PI*h+o*n*Math.PI*h+C*l*.4);a+=Math.atan2(d+.3*u,f),i+=.5*(f*d+1)}const s=a/l,c=Math.min(1,i/l);if(c<.1)continue;const d=(s+Math.PI)/(2*Math.PI),M=T[Math.floor(d*T.length)%T.length],y=c>.8,$=f?.8*c:.13*c;e.fillStyle=y?`rgba(${x},${w},${S},${f?.9:.26})`:`rgba(${p},${b},${v},${$})`,e.fillText(M,n*u,t*m)}}}function K(e,t,o,n,r={x:.5,y:.5},a={}){const{fontSize:i=13,chars:s=" ·:;=+*#%@",color:c,accentColor:l,speed:h=1,radius:f=.38,swirl:d=3,lightMode:u=!1}=a,m=l??(u?"#6b8700":"#d4ff00"),g=.62*i,M=1.4*i,p=Math.ceil(t/g),b=Math.ceil(o/M),v=t/o;e.clearRect(0,0,t,o),e.font=`${i}px monospace`,e.textBaseline="top";let x=255,w=255,S=255;if(u&&(x=55,w=55,S=55),c){const e=y(c);e&&(x=e.r,w=e.g,S=e.b)}let $=212,C=255,T=0;const A=y(m);A&&($=A.r,C=A.g,T=A.b);const R=n*h;for(let t=0;t<b;t++){const o=t/b;for(let n=0;n<p;n++){const a=(n/p-r.x)*v,i=o-r.y,c=Math.sqrt(a*a+i*i)/f;if(c>1){const o=E(3*n,7*t)*Math.max(0,1-3*(c-1));if(o<.62)continue;const r=o*(u?.28:.04);e.fillStyle=`rgba(${x},${w},${S},${r})`,e.fillText(s[1],n*g,t*M);continue}const l=Math.max(0,1-Math.abs(c-(.15+.12*Math.sin(1.1*R)))/.07),h=Math.pow(1-c,2.2),d=Math.min(1,h+.6*l);if(d<.06)continue;const m=Math.floor(d*(s.length-1)),b=s[Math.min(s.length-1,m)],y=l>.35||c<.08,A=u?.85*d:.18*d;e.fillStyle=y?`rgba(${$},${C},${T},${u?.95:.38})`:`rgba(${x},${w},${S},${A})`,e.fillText(b,n*g,t*M)}}}function Q(e,t,o,n,r={}){const{fontSize:a=14,chars:i=" ·∙•:-=+*#",color:s,accentColor:c,speed:l=.5,harmonics:h=3,lightMode:f=!1}=r,d=c??(f?"#6b8700":"#d4ff00"),u=.62*a,m=1.4*a,g=Math.ceil(t/u),M=Math.ceil(o/m);e.clearRect(0,0,t,o),e.font=`${a}px monospace`,e.textBaseline="top";let p=255,b=255,v=255;if(f&&(p=55,b=55,v=55),s){const e=y(s);e&&(p=e.r,b=e.g,v=e.b)}let x=212,w=255,S=0;const $=y(d);$&&(x=$.r,w=$.g,S=$.b);const C=n*l,T=Array.from({length:h},(e,t)=>1/(t+1)).reduce((e,t)=>e+t,0);for(let t=0;t<M;t++)for(let o=0;o<g;o++){let n=0;for(let e=0;e<h;e++){const r=.18+1.4*E(o*(e+3)+7,t*(e+5)+11),a=E(o*(e+7),t*(e+9)+3)*Math.PI*2,i=1/(e+1);n+=Math.sin(C*r+a)*i}const r=.5*(n/T+1);if(r<.28)continue;const a=(r-.28)/.72,s=i[Math.min(i.length-1,Math.floor(a*i.length))],c=r>.88,l=f?.82*a:.13*a;e.fillStyle=c?`rgba(${x},${w},${S},${f?.92:.28})`:`rgba(${p},${b},${v},${l})`,e.fillText(s,o*u,t*m)}}function Z(e,t,o,n,r={}){const{fontSize:a=13,chars:i=" .,:;i+xX#&@",color:s="#ff4500",hotColor:c="#ffe066",intensity:l=.85,wind:h=0,speed:f=1,lightMode:d=!1}=r,u=.62*a,m=1.4*a,g=Math.ceil(t/u),M=Math.ceil(o/m),p=g*M,b="__fire_heat__",v=e.canvas;let x=v[b];x&&x.length===p||(x=new Float32Array(p),v[b]=x);const w=.18*(.016*f),S=h*f*.8,$=M-1,E=n*f;for(let e=0;e<g;e++){const t=(.6*(.5*Math.sin(.31*e+4.1*E)+.5)+.4*(.5*Math.sin(.73*e-2.7*E)+.5))*l;x[$*g+e]=Math.min(1,t+.15*Math.random()*l),$>0&&(x[($-1)*g+e]=Math.min(1,.85*t+.1*Math.random()*l))}const C=new Float32Array(p);for(let e=0;e<M-2;e++)for(let t=0;t<g;t++){const o=.4*x[(e+1)*g+t]+.25*x[(e+2)*g+Math.max(0,Math.min(g-1,t+Math.round(S)))]+.175*x[(e+1)*g+Math.max(0,t-1)]+.175*x[(e+1)*g+Math.min(g-1,t+1)];C[e*g+t]=Math.max(0,o-w-.02*Math.random()*f)}for(let e=0;e<g;e++)C[(M-1)*g+e]=x[(M-1)*g+e],M>1&&(C[(M-2)*g+e]=x[(M-2)*g+e]);v[b]=C;const T=y(s)??{r:255,g:69,b:0},A=y(c)??{r:255,g:224,b:102};e.clearRect(0,0,t,o),e.font=`${a}px "JetBrains Mono", monospace`,e.textBaseline="top";for(let t=0;t<M;t++)for(let o=0;o<g;o++){const n=C[t*g+o];if(n<.03)continue;const r=i[Math.min(i.length-1,Math.floor(n*i.length))];if(" "===r)continue;const a=Math.min(1,1.2*n),s=T.r+(A.r-T.r)*a|0,c=T.g+(A.g-T.g)*a|0,l=T.b+(A.b-T.b)*a|0,h=d?1-.3*n:Math.min(1,n+.15);e.globalAlpha=h,e.fillStyle=`rgb(${s},${c},${l})`,e.fillText(r,o*u,t*m)}e.globalAlpha=1}function ee(e,t,o,n,r={}){const{fontSize:a=13,baseChars:i="ATCG",bridgeChars:s="-=≡",color:c="#00e5ff",color2:l="#ff4081",bridgeColor:h="#88ffcc",speed:f=1,helixCount:d,lightMode:u=!1}=r,m=.62*a,g=1.4*a,M=Math.ceil(t/m),p=Math.ceil(o/g),b=d??Math.max(1,Math.floor(t/80)),v=M/b,x=y(c)??{r:0,g:229,b:255},w=y(l)??{r:255,g:64,b:129},S=y(h)??{r:136,g:255,b:204};e.clearRect(0,0,t,o),e.font=`${a}px "JetBrains Mono", monospace`,e.textBaseline="top";const $=n*f,C=.35*v;for(let t=0;t<b;t++){const o=v*(t+.5);for(let n=0;n<p;n++){const r=n/p*Math.PI*6-1.8*$,a=o+Math.sin(r)*C,c=o+Math.sin(r+Math.PI)*C,l=Math.round(a),h=Math.round(c);if(l<0||l>=M)continue;const f=E(31*t+7*n,3),d=i[Math.floor(f*i.length)],u=.5*(Math.sin(r)+1),b=.5*(Math.sin(r+Math.PI)+1);if(e.globalAlpha=.35+.65*u,e.fillStyle=`rgb(${x.r},${x.g},${x.b})`,e.fillText(d,l*m,n*g),h>=0&&h<M){const o=E(53*t+11*n,7),r=i[Math.floor(o*i.length)];e.globalAlpha=.35+.65*b,e.fillStyle=`rgb(${w.r},${w.g},${w.b})`,e.fillText(r,h*m,n*g)}if(n%3===0){const o=Math.min(l,h),r=Math.max(l,h);if(r-o>1){const a=E(17*n+43*t,5),i=s[Math.floor(a*s.length)],c=.25*(u+b)+.2;e.globalAlpha=c,e.fillStyle=`rgb(${S.r},${S.g},${S.b})`;for(let t=o+1;t<r;t++)e.fillText(i,t*m,n*g)}}}}e.globalAlpha=1}function te(e,t,o,n,r={}){const{fontSize:a=13,chars:i=" .,:;+*#@",color:s="#4caf50",skyColor:c="#1a237e",peakColor:l="#e0e0e0",speed:h=1,roughness:f=.55,heightScale:d=.55,stars:u=!0,lightMode:m=!1}=r,g=.62*a,M=1.4*a,p=Math.ceil(t/g),b=Math.ceil(o/M),v=y(s)??{r:76,g:175,b:80},x=y(c)??{r:26,g:35,b:126},w=y(l)??{r:224,g:224,b:224};e.clearRect(0,0,t,o),e.font=`${a}px "JetBrains Mono", monospace`,e.textBaseline="top";const S=n*h*.4,$=new Array(p);for(let e=0;e<p;e++){const t=(.5*T((e/p+S)*f*3,.5)+.5)*d;$[e]=Math.floor(t*b)}for(let t=0;t<b;t++)for(let o=0;o<p;o++){const r=b-1-$[o],a=t===r;if(!(t>=r)){if(u){const r=E(7*o+Math.floor(.3*S),13*t);if(r>.97){const a=.3*Math.sin(2*n+100*r)+.7;e.globalAlpha=.5*a,e.fillStyle=`rgb(${x.r+60},${x.g+60},${x.b+80})`,e.fillText("·",o*g,t*M)}}continue}const s=(t-r)/Math.max(1,$[o]),c=i[Math.min(i.length-1,Math.floor(s*i.length))];if(" "===c&&!a)continue;const l=a?1:Math.max(0,1-4*s),h=v.r+(w.r-v.r)*l|0,f=v.g+(w.g-v.g)*l|0,d=v.b+(w.b-v.b)*l|0;e.globalAlpha=.5+.5*s,e.fillStyle=`rgb(${h},${f},${d})`,e.fillText(a?i[i.length-1]:c,o*g,t*M)}e.globalAlpha=1}var oe=1,ne=2,re=4,ae=8,ie={3:"─",12:"│",9:"┌",10:"┐",5:"└",6:"┘",11:"┬",7:"┴",13:"├",14:"┤",15:"┼",[oe]:"╶",[ne]:"╴",[re]:"╵",[ae]:"╷"};function se(e,t,o,n,r={}){const{fontSize:a=13,pulseColor:i="#ffffff",color:s="#00ff88",density:c=.38,speed:l=1,lightMode:h=!1}=r,f=.62*a,d=1.4*a,u=Math.ceil(t/f),m=Math.ceil(o/d),g=y(s)??{r:0,g:255,b:136},M=y(i)??{r:255,g:255,b:255},p=(e,t)=>{if(E(17*e+1,7*t+2)>c)return 0;let o=0;return e+1<u&&E(17*e+1,7*t+2)>.15&&(o|=1),e-1>=0&&E(17*(e-1)+1,7*t+2)>.15&&(o|=2),t+1<m&&E(17*e+1,7*(t+1)+2)>.15&&(o|=8),t-1>=0&&E(17*e+1,7*(t-1)+2)>.15&&(o|=4),o};e.clearRect(0,0,t,o),e.font=`${a}px "JetBrains Mono", monospace`,e.textBaseline="top";const b=n*l;for(let t=0;t<m;t++)for(let o=0;o<u;o++){const n=p(o,t);if(0===n)continue;const r=ie[n]??"·",a=(8*b+40*E(o,23*t))%u,i=(6*b+40*E(17*t,11*o))%m,s=(1&n||2&n)&&Math.abs(o-a)<1.5,c=(4&n||8&n)&&Math.abs(t-i)<1.5,l=s||c,h=.25+.35*E(3*o,5*t);l?(e.globalAlpha=.95,e.fillStyle=`rgb(${M.r},${M.g},${M.b})`):(e.globalAlpha=h,e.fillStyle=`rgb(${g.r},${g.g},${g.b})`),e.fillText(r,o*f,t*d)}e.globalAlpha=1}function ce(e,t={}){const{type:o="wave",opacity:n=.2,className:r,zIndex:a=0,colorScheme:i="auto",color:s,...c}=t,l="string"==typeof e?document.querySelector(e):e;if(!l)return console.warn("[asciify] asciiBackground: target not found",e),{destroy:()=>{}};const h=l.style.position;"static"===getComputedStyle(l).position&&(l.style.position="relative");const f=document.createElement("canvas");f.style.cssText=["position:absolute","inset:0","width:100%","height:100%",`opacity:${n}`,"pointer-events:none",`z-index:${a}`].join(";"),r&&(f.className=r),l.prepend(f);const d=f.getContext("2d"),u=window.devicePixelRatio||1,m={x:.5,y:.5},g={x:.5,y:.5},M=()=>"light"===i||"dark"!==i&&(()=>{let e=l;for(;e&&e!==document.documentElement.parentElement;){const t=getComputedStyle(e).backgroundColor;if(t&&"transparent"!==t&&"rgba(0, 0, 0, 0)"!==t){const e=t.match(/rgba?\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)/);if(e)return(.299*+e[1]+.587*+e[2]+.114*+e[3])/255>=.4}e=e.parentElement}const t=document.documentElement,o=(t.getAttribute("data-theme")||"").toLowerCase();return"dark"!==o&&("light"===o||!t.classList.contains("dark")&&window.matchMedia("(prefers-color-scheme: light)").matches)})(),p=s?function(e){const t=e.match(/^#([0-9a-f]{3,8})$/i)?.[1];if(t){const e=t.length<=4?t.split("").map(e=>parseInt(e+e,16)):[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)];return{r:e[0],g:e[1],b:e[2]}}const o=e.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);return o?{r:+o[1],g:+o[2],b:+o[3]}:null}(s):null,b=()=>({...c,lightMode:void 0!==c.lightMode?c.lightMode:M(),baseColor:p?`rgba(${p.r},${p.g},${p.b},{a})`:c.baseColor}),v={current:b()},x=()=>{v.current="rain"===o||"stars"===o||"pulse"===o||"noise"===o||"grid"===o||"aurora"===o||"silk"===o||"void"===o||"morph"===o?{...c,lightMode:void 0!==c.lightMode?c.lightMode:M(),color:s??c.color}:"fire"===o||"dna"===o?{...c,color:s??c.color}:"terrain"===o||"circuit"===o?{...c,color:s??c.color,lightMode:void 0!==c.lightMode?c.lightMode:M()}:b()};x();const w=window.matchMedia("(prefers-color-scheme: light)"),y=()=>{x()};let S=null;"auto"===i&&(w.addEventListener("change",y),S=new MutationObserver(y),S.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","class"]}));const $=()=>{const e=l.getBoundingClientRect();f.width=e.width*u,f.height=e.height*u,d.setTransform(u,0,0,u,0,0)};$();const E=e=>{const t=l.getBoundingClientRect();m.x=(e.clientX-t.left)/t.width,m.y=(e.clientY-t.top)/t.height},C=new ResizeObserver($);C.observe(l),window.addEventListener("mousemove",E);let T=0,R=0;const I=()=>{g.x+=.07*(m.x-g.x),g.y+=.07*(m.y-g.y);const e=l.getBoundingClientRect();"rain"===o?D(d,e.width,e.height,T,v.current):"stars"===o?Y(d,e.width,e.height,T,g,v.current):"pulse"===o?V(d,e.width,e.height,T,g,v.current):"noise"===o?N(d,e.width,e.height,T,g,v.current):"grid"===o?G(d,e.width,e.height,T,g,v.current):"aurora"===o?X(d,e.width,e.height,T,g,v.current):"silk"===o?J(d,e.width,e.height,T,v.current):"void"===o?K(d,e.width,e.height,T,g,v.current):"morph"===o?Q(d,e.width,e.height,T,v.current):"fire"===o?Z(d,e.width,e.height,T,v.current):"dna"===o?ee(d,e.width,e.height,T,v.current):"terrain"===o?te(d,e.width,e.height,T,v.current):"circuit"===o?se(d,e.width,e.height,T,v.current):A(d,e.width,e.height,T,g,v.current),T+=.016,R=requestAnimationFrame(I)};return R=requestAnimationFrame(I),{destroy:()=>{cancelAnimationFrame(R),C.disconnect(),"auto"===i&&(w.removeEventListener("change",y),S?.disconnect()),window.removeEventListener("mousemove",E),f.remove(),l.style.position=h}}}var le=ce;function he(e,t,o,n="#505050",r=100){if(!e||t<=0||o<=0)return[];const a=y(n)??{r:80,g:80,b:80},i=e,s=i.length;return Array.from({length:o},(e,o)=>Array.from({length:t},(e,n)=>({char:i[(o*t+n)%s],r:a.r,g:a.g,b:a.b,a:r})))}function fe(e,{format:t="png",quality:o=.92,scale:n=1}={}){return new Promise((r,a)=>{let i=e;if(1!==n){const t=document.createElement("canvas");t.width=Math.round(e.width*n),t.height=Math.round(e.height*n);const o=t.getContext("2d");if(!o)return void a(new Error("captureSnapshot: could not get 2d context"));o.drawImage(e,0,0,t.width,t.height),i=t}i.toBlob(e=>e?r(e):a(new Error("captureSnapshot: toBlob returned null")),`image/${t}`,o)})}var de={A:[28,54,99,127,99,99,99],B:[126,99,99,126,99,99,126],C:[62,99,96,96,96,99,62],D:[124,102,99,99,99,102,124],E:[127,96,96,124,96,96,127],F:[127,96,96,124,96,96,96],G:[62,99,96,111,99,99,62],H:[99,99,99,127,99,99,99],I:[127,8,8,8,8,8,127],J:[63,6,6,6,102,102,60],K:[99,102,108,120,108,102,99],L:[96,96,96,96,96,96,127],M:[99,119,107,107,99,99,99],N:[99,115,107,103,99,99,99],O:[62,99,99,99,99,99,62],P:[126,99,99,126,96,96,96],Q:[62,99,99,99,107,102,61],R:[126,99,99,126,108,102,99],S:[62,99,96,62,3,99,62],T:[127,8,8,8,8,8,8],U:[99,99,99,99,99,99,62],V:[99,99,99,99,54,28,8],W:[99,99,99,107,107,54,20],X:[99,54,28,8,28,54,99],Y:[99,99,54,28,8,8,8],Z:[127,3,6,12,24,48,127],a:[0,0,60,3,62,99,61],b:[96,96,124,99,99,99,124],c:[0,0,62,96,96,96,62],d:[3,3,31,99,99,99,31],e:[0,0,62,99,127,96,62],f:[30,48,48,126,48,48,48],g:[0,0,63,99,63,3,62],h:[96,96,124,99,99,99,99],i:[8,0,24,8,8,8,28],j:[4,0,12,4,4,36,24],k:[96,96,102,108,120,108,102],l:[24,8,8,8,8,8,28],m:[0,0,92,107,107,99,99],n:[0,0,94,99,99,99,99],o:[0,0,62,99,99,99,62],p:[0,0,126,99,126,96,96],q:[0,0,63,99,63,3,3],r:[0,0,94,99,96,96,96],s:[0,0,62,96,62,3,124],t:[48,48,126,48,48,48,30],u:[0,0,99,99,99,103,59],v:[0,0,99,99,54,28,8],w:[0,0,99,99,107,54,20],x:[0,0,99,54,28,54,99],y:[0,0,99,99,63,3,62],z:[0,0,127,6,12,24,127],0:[62,99,103,107,115,99,62],1:[8,24,56,8,8,8,62],2:[62,99,3,6,24,48,127],3:[62,99,3,30,3,99,62],4:[6,14,22,38,127,6,6],5:[127,96,126,3,3,99,62],6:[62,99,96,126,99,99,62],7:[127,3,6,12,24,24,24],8:[62,99,99,62,99,99,62],9:[62,99,99,63,3,99,62]," ":[0,0,0,0,0,0,0],"!":[24,24,24,24,24,0,24],"?":[62,99,3,14,8,0,8],".":[0,0,0,0,0,24,24],",":[0,0,0,0,0,24,48],";":[0,24,24,0,24,24,48],":":[0,24,24,0,24,24,0],"-":[0,0,0,62,0,0,0],_:[0,0,0,0,0,0,127],"'":[24,24,32,0,0,0,0],'"':[54,54,36,0,0,0,0],"`":[24,8,0,0,0,0,0],")":[24,12,6,6,6,12,24],"(":[12,24,48,48,48,24,12],"[":[60,48,48,48,48,48,60],"]":[30,6,6,6,6,6,30],"{":[14,24,24,48,24,24,14],"}":[56,12,12,6,12,12,56],"/":[3,6,12,24,48,96,0],"\\":[96,48,24,12,6,3,0],"|":[8,8,8,8,8,8,8],"+":[0,8,8,62,8,8,0],"=":[0,0,62,0,62,0,0],"*":[0,42,28,127,28,42,0],"#":[36,36,127,36,127,36,36],"@":[62,99,111,107,111,96,62],"&":[24,36,24,60,74,68,58],"%":[99,38,4,8,16,50,99],$:[8,62,72,62,9,62,8],"^":[8,20,34,0,0,0,0],"~":[0,0,50,76,0,0,0],"<":[6,12,24,48,24,12,6],">":[48,24,12,6,12,24,48]},ue=[127,65,65,65,65,65,127];function me(e){return de[e]??de[e.toUpperCase()]??ue}function ge(e,t={}){if(!e)return"";const{char:o="█",scale:n=1}=t,r=[...o][0]??"█",a=Math.max(1,Math.floor(n)),i=7*a,s=a,c=Array.from({length:i},()=>"");for(let t=0;t<e.length;t++){const o=me(e[t]);for(let e=0;e<7;e++){const t=o[e];let n="";for(let e=6;e>=0;e--)n+=(t>>e&1?r:" ").repeat(a);for(let t=0;t<a;t++)c[e*a+t]+=n}if(t<e.length-1)for(let e=0;e<i;e++)c[e]+=" ".repeat(s)}return c.join("\n")}exports.ART_STYLE_PRESETS=n,exports.BACKGROUND_TYPES=["wave","rain","stars","pulse","noise","grid","aurora","silk","void","morph","fire","dna","terrain","circuit"],exports.CHARSETS=t,exports.CHARSET_SEQUENCES=o,exports.DEFAULT_OPTIONS=a,exports.HOVER_PRESETS={none:{label:"Off",options:{hoverStrength:0,hoverEffect:"spotlight",hoverRadius:.2,hoverColor:"#ffffff"}},subtle:{label:"Subtle",options:{hoverStrength:.25,hoverEffect:"glow",hoverRadius:.12,hoverColor:"#ffffff"}},flashlight:{label:"Flashlight",options:{hoverStrength:.6,hoverEffect:"spotlight",hoverRadius:.15,hoverColor:"#fffbe6"}},magnifier:{label:"Magnifier",options:{hoverStrength:.7,hoverEffect:"magnify",hoverRadius:.12,hoverColor:"#ffffff"}},forceField:{label:"Force Field",options:{hoverStrength:.7,hoverEffect:"repel",hoverRadius:.15,hoverColor:"#a0e8ff"}},neon:{label:"Neon",options:{hoverStrength:.6,hoverEffect:"colorShift",hoverRadius:.15,hoverColor:"#d946ef"}},fire:{label:"Fire",options:{hoverStrength:.7,hoverEffect:"spotlight",hoverRadius:.15,hoverColor:"#ff6b2b"}},ice:{label:"Ice",options:{hoverStrength:.5,hoverEffect:"glow",hoverRadius:.15,hoverColor:"#60d5f7"}},gravity:{label:"Gravity",options:{hoverStrength:.7,hoverEffect:"attract",hoverRadius:.18,hoverColor:"#a5d6ff"}},shatter:{label:"Shatter",options:{hoverStrength:.8,hoverEffect:"shatter",hoverRadius:.14,hoverColor:"#ff6090"}},ghost:{label:"Ghost",options:{hoverStrength:.55,hoverEffect:"trail",hoverRadius:.2,hoverColor:"#b39ddb"}},glitchReveal:{label:"Glitch Reveal",options:{hoverStrength:.8,hoverEffect:"glitchText",hoverRadius:.18,hoverColor:"#a3e635"}}},exports.LIVING_STYLE_PRESETS=r,exports.PALETTE_THEMES={dracula:{name:"Dracula",accent:"#bd93f9",bg:"#282a36",fg:"#f8f8f2"},monokai:{name:"Monokai",accent:"#a6e22e",bg:"#272822",fg:"#f8f8f2"},nord:{name:"Nord",accent:"#88c0d0",bg:"#2e3440",fg:"#eceff4"},catppuccin:{name:"Catppuccin",accent:"#cba6f7",bg:"#1e1e2e",fg:"#cdd6f4"},solarized:{name:"Solarized",accent:"#268bd2",bg:"#002b36",fg:"#839496"},gruvbox:{name:"Gruvbox",accent:"#b8bb26",bg:"#282828",fg:"#ebdbb2"}},exports.asciiBackground=ce,exports.asciiText=function(e,t={},o,n){const r={...a,...t},{frame:i,cols:s}=F(e,r,o,n);if(!i.length||0===s)return"";const c=[];for(const e of i)c.push(e.map(e=>e.char).join(""));return c.join("\n")},exports.asciiTextAnsi=function(e,t={},o,n){const r={...a,...t},{frame:i,cols:s}=F(e,r,o,n);if(!i.length||0===s)return"";const c=[];for(const e of i){let t="";for(const o of e)" "===o.char||o.a<10?t+=" ":t+=`[38;2;${o.r};${o.g};${o.b}m${o.char}[0m`;c.push(t)}return c.join("\n")},exports.asciify=async function(e,t,{fontSize:o,artStyle:r="classic",options:i={}}={}){let s;if("string"==typeof e){const t=new Image;t.crossOrigin="anonymous",await new Promise((o,n)=>{t.onload=()=>o(),t.onerror=()=>n(new Error(`Failed to load image: ${e}`)),t.src=e}),s=t}else e instanceof HTMLImageElement&&!e.complete?(await new Promise((t,o)=>{e.onload=()=>t(),e.onerror=()=>o(new Error("Image failed to load"))}),s=e):s=e;const c=n[r],l=o??i.fontSize??10,h={...a,...c,...i,fontSize:l},f=t.getContext("2d");if(!f)throw new Error("Could not get 2d context from canvas");const{w:d,h:u}=function(e){return e instanceof HTMLVideoElement?{w:e.videoWidth,h:e.videoHeight}:e instanceof HTMLImageElement?{w:e.naturalWidth||e.width,h:e.naturalHeight||e.height}:{w:e.width,h:e.height}}(s),{renderW:m,renderH:g}=U(d,u),M="undefined"!=typeof window&&window.devicePixelRatio||1,p=8e6,b=m*M*g*M>p?Math.sqrt(p/(m*g)):M;(t.width<m||t.height<g)&&(t.width=Math.round(m*b),t.height=Math.round(g*b));const{frame:v}=F(s,h,m,g);if(h.hoverStrength>0){let e=null,o=!1,n=0;const r=o=>{const n=t.getBoundingClientRect();e={x:(o.clientX-n.left)/n.width,y:(o.clientY-n.top)/n.height}},a=()=>{e=null};t.addEventListener("mousemove",r),t.addEventListener("mouseleave",a);const i=t=>{o||(f.save(),f.setTransform(b,0,0,b,0,0),z(f,v,h,m,g,t/1e3,e),f.restore(),n=requestAnimationFrame(i))};return n=requestAnimationFrame(i),()=>{o=!0,cancelAnimationFrame(n),t.removeEventListener("mousemove",r),t.removeEventListener("mouseleave",a)}}f.save(),f.setTransform(b,0,0,b,0,0),z(f,v,h,m,g),f.restore()},exports.asciifyGif=async function(e,t,{fontSize:o,artStyle:r="classic",options:i={}}={}){const s="string"==typeof e?await fetch(e).then(e=>e.arrayBuffer()):e,c=o??i.fontSize??10,l={...a,...n[r],...i,fontSize:c},h=t.getContext("2d");if(!h)throw new Error("Could not get 2d context from canvas");const{frames:f,fps:d}=await L(s,l,t.width,t.height);let u,m=!1,g=0,M=performance.now();const p=1e3/d,b=e=>{m||(e-M>=p&&(z(h,f[g],l,t.width,t.height),g=(g+1)%f.length,M=e),u=requestAnimationFrame(b))};return u=requestAnimationFrame(b),()=>{m=!0,cancelAnimationFrame(u)}},exports.asciifyLiveVideo=function(e,t,o){return _(e,t,o)},exports.asciifyText=ge,exports.asciifyVideo=_,exports.asciifyWebcam=async function(e,{fontSize:t=10,style:o="classic",options:r={},liveOptions:i,mirror:s=!0,constraints:c={facingMode:"user"},dpr:l}={}){if(!navigator.mediaDevices?.getUserMedia)throw new Error("asciifyWebcam: getUserMedia is not supported in this browser.");const h=await navigator.mediaDevices.getUserMedia({video:c}),f=document.createElement("video");f.srcObject=h,f.muted=!0,f.playsInline=!0,await new Promise((e,t)=>{f.onloadedmetadata=()=>e(),f.onerror=()=>t(new Error("asciifyWebcam: video stream failed to load.")),f.play().catch(t)});const d={...a,...n[o],...r,fontSize:t},u=e.getContext("2d");if(!u)throw new Error("asciifyWebcam: could not get 2d context from canvas.");const m=l??("undefined"!=typeof window?window.devicePixelRatio:1)??1;1!==m&&u.scale(m,m);let g=null;const M={x:.5,y:.5,intensity:0},p=t=>{const o=e.getBoundingClientRect();g={x:(t.clientX-o.left)/o.width,y:(t.clientY-o.top)/o.height}},b=()=>{g=null};d.hoverStrength>0&&(e.addEventListener("mousemove",p),e.addEventListener("mouseleave",b));let v,x=!1;const w=performance.now(),y=t=>{if(!x){if(f.readyState>=f.HAVE_CURRENT_DATA){const o=e.width/m,n=e.height/m,r=(t-w)/1e3,a=i?{...d,...i()}:d;a.hoverStrength>0?(e.addEventListener("mousemove",p),e.addEventListener("mouseleave",b)):(e.removeEventListener("mousemove",p),e.removeEventListener("mouseleave",b));const{frame:c}=F(f,a,o,n);if(g){const e=g.x-M.x,t=g.y-M.y,o=Math.sqrt(e*e+t*t),n=Math.min(.25,.06+.8*o);M.x+=e*n,M.y+=t*n,M.intensity+=.12*(1-M.intensity)}else M.intensity*=.965,M.intensity<.003&&(M.intensity=0);const l=M.intensity>.003?{x:M.x,y:M.y,intensity:M.intensity}:null;s?(u.save(),u.scale(-1,1),u.translate(-o,0),z(u,c,a,o,n,r,l),u.restore()):z(u,c,a,o,n,r,l)}v=requestAnimationFrame(y)}};return v=requestAnimationFrame(y),()=>{x=!0,cancelAnimationFrame(v),e.removeEventListener("mousemove",p),e.removeEventListener("mouseleave",b),h.getTracks().forEach(e=>e.stop()),f.srcObject=null}},exports.buildTextFrame=he,exports.captureSnapshot=fe,exports.createVideoScrollScrub=W,exports.gifToAsciiFrames=L,exports.imageToAsciiFrame=F,exports.mountWaveBackground=le,exports.renderAuroraBackground=X,exports.renderCircuitBackground=se,exports.renderDnaBackground=ee,exports.renderFireBackground=Z,exports.renderFrameToCanvas=z,exports.renderGridBackground=G,exports.renderMorphBackground=Q,exports.renderNoiseBackground=N,exports.renderPulseBackground=V,exports.renderRainBackground=D,exports.renderSilkBackground=J,exports.renderStarsBackground=Y,exports.renderTerrainBackground=te,exports.renderTextBackground=function(e,t,o,n,r={},i){const{fontSize:s=10,lineHeight:c=1.6,color:l="#505050",opacity:h=100,hoverEffect:f="spotlight",hoverStrength:d=.85,hoverRadius:u=.18,hoverColor:m="#d4ff00"}=r;z(e,he(n,Math.max(1,Math.floor(t/s)),Math.max(1,Math.floor(o/(s*c))),l,h),{...a,hoverEffect:f,hoverStrength:d,hoverRadius:u,hoverColor:m},t,o,0,i??null)},exports.renderTextToCanvas=function(e,t,o={}){const{color:n="#d4ff00",bgColor:r,fontSize:a=10}=o,i=ge(t,o);if(!i)return;const s=i.split("\n"),c=Math.max(...s.map(e=>[...e].length));e.width=Math.ceil(c*a*.6),e.height=Math.ceil(s.length*a);const l=e.getContext("2d");r&&"transparent"!==r?(l.fillStyle=r,l.fillRect(0,0,e.width,e.height)):l.clearRect(0,0,e.width,e.height),l.fillStyle=n,l.font=`${a}px monospace`,l.textBaseline="top",s.forEach((e,t)=>l.fillText(e,0,t*a))},exports.renderVoidBackground=K,exports.renderWaveBackground=A,exports.snapshotAndDownload=async function(e,t={}){const{filename:o="asciify-snapshot",format:n="png",...r}=t,a=await fe(e,{format:n,...r}),i="jpeg"===n?"jpg":n,s=document.createElement("a");s.href=URL.createObjectURL(a),s.download=`${o}.${i}`,s.click(),setTimeout(()=>URL.revokeObjectURL(s.href),1e4)},exports.videoToAsciiFrames=B;//# sourceMappingURL=index.cjs.map
|