asciify-engine 2.0.1 → 4.0.0
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/README.md +16 -7
- package/dist/ambient-motion-CqF5-eZ2.d.cts +24 -0
- package/dist/ambient-motion-CqF5-eZ2.d.ts +24 -0
- package/dist/characters-BNTu2oEF.d.cts +71 -0
- package/dist/characters-BNTu2oEF.d.ts +71 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +3 -2
- package/dist/core.d.ts +3 -2
- package/dist/core.js +1 -1
- package/dist/hover.cjs +1 -1
- package/dist/hover.d.cts +3 -4
- package/dist/hover.d.ts +3 -4
- package/dist/hover.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.d.cts +15 -41
- package/dist/studio.d.ts +15 -41
- package/dist/studio.js +1 -1
- package/dist/{types-Cixur2pN.d.ts → types-CYKIEtDC.d.cts} +7 -7
- package/dist/{types-Cixur2pN.d.cts → types-CYKIEtDC.d.ts} +7 -7
- package/package.json +1 -15
- package/skills/asciify-engine/SKILL.md +5 -5
- package/skills/asciify-engine/references/media-api.md +2 -2
- package/skills/asciify-engine/references/studio-effects.md +2 -2
- package/skills/asciify-engine/references/studio-workspace.md +15 -0
- package/skills/asciify-engine/references/upgrading.md +14 -0
- package/dist/backgrounds.cjs +0 -1
- package/dist/backgrounds.d.cts +0 -401
- package/dist/backgrounds.d.ts +0 -401
- package/dist/backgrounds.js +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t={standard:" .:-=+*#%@",blocks:" ░▒▓█",minimal:" .:+",dense:" .'`^\",:;Il!i><~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$",binary:"01",dots:" ⠁⠃⠇⡇⣇⣧⣷⣿",letters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",claudeCode:" ╔╗╚╝║═╠╣╦╩╬░▒▓█│─┌┐└┘├┤┬┴┼",box:" ▪◾◼■█",lines:" ˗‐–—―━",braille:" ⠁⠂⠃⠄⠅⠆⠇⠈⠉⠊⠋⠌⠍⠎⠏⠐⠑⠒⠓⠔⠕⠖⠗⠘⠙⠚⠛⠜⠝⠞⠟⠠⠡⠢⠣⠤⠥⠦⠧⠨⠩⠪⠫⠬⠭⠮⠯⠰⠱⠲⠳⠴⠵⠶⠷⠸⠹⠺⠻⠼⠽⠾⠿⡀⡁⡂⡃⡄⡅⡆⡇⣀⣁⣂⣃⣄⣅⣆⣇⣈⣉⣊⣋⣌⣍⣎⣏⣐⣑⣒⣓⣔⣕⣖⣗⣘⣙⣚⣛⣜⣝⣞⣟⣠⣡⣢⣣⣤⣥⣦⣧⣨⣩⣪⣫⣬⣭⣮⣯⣰⣱⣲⣳⣴⣵⣶⣷⣸⣹⣺⣻⣼⣽⣾⣿",katakana:" ヲァィゥェォャュョッアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン",circles:" .·:∘○◦°•∙",shadows:" ·∘◦○◎⊙●◉",geometric:" ·△▷◇◈◆▣■█",pipes:" ╶─┐└├┤┬┴┼╬▒▓█",waves:" ˜∼≈〰≋∿∾∭∫",shards:" ╱╲╳◤◥◣◢△▲◆◼█",smoke:" ·˙⁚⁖∶∷⋮⋰⋱∴∵",ascii:" .'`^\",:;~-_+<>i!lI?/\\|()[]{}1tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$",interface:" ·•-–—+=:;<>[]{}()⌘⌥⇧⌃↵↗↘◇◆◈□■",prompt:" .:;>_`/\\|{}[]()=+*#@$",data:" ·∙•◦○●◇◆◈▱▰▣█",humanist:" ·˙,:;∴∵∷∶⁚⋮⋯∼≈≋∞",mesh:" ·╶╴╷╵─│┌┐└┘├┤┬┴┼╬░▒▓█"},e={cosmic:[t.smoke,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.blocks],assistant:[t.interface,t.prompt,t.data],signal:[t.mesh,t.data,t.ascii],editorial:[t.humanist,t.waves,t.smoke]},o={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"},circles:{renderMode:"ascii",charset:t.circles,colorMode:"accent",accentColor:"#d4ff00"},shadows:{renderMode:"ascii",charset:t.shadows,colorMode:"accent",accentColor:"#50a0ff"},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"}},n={agentField:{...o.interface,charsetFrames:e.assistant,charsetFps:1.6,animationStyle:"breathe",animationSpeed:.75,ditherStrength:.12,hoverEffect:"glow",hoverStrength:.42,hoverRadius:.18,hoverColor:"#f4f1ea",normalize:!0},liquidSignal:{...o.data,charsetFrames:e.signal,charsetFps:2.4,animationStyle:"melt",animationSpeed:.65,ditherStrength:.45,hoverEffect:"repel",hoverStrength:.55,hoverRadius:.22,hoverColor:"#8fd3ff",normalize:!0},cursorGravity:{...o.mesh,charsetFrames:e.angular,charsetFps:1.2,animationStyle:"orbit",animationSpeed:.9,ditherStrength:.2,hoverEffect:"attract",hoverStrength:.82,hoverRadius:.24,hoverColor:"#ffffff",normalize:!0},editorialPulse:{...o.humanist,charsetFrames:e.editorial,charsetFps:.9,animationStyle:"ripple",animationSpeed:.55,ditherStrength:.18,hoverEffect:"spotlight",hoverStrength:.35,hoverRadius:.2,hoverColor:"#fff8ea",normalize:!0},terminalFlow:{...o.prompt,charsetFrames:e.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}},r={fontSize:7,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,chromaKeyTrimPadding:.002,chromaKeyTrimLuminanceThreshold:0,chromaKeyTrimMode:"range"};function a(t,e){const o=document.createElement("canvas");o.width=t,o.height=e;const n=o.getContext("2d",{willReadFrequently:!0});return{canvas:o,ctx:n}}function i(t,e,o){let n=t+255*e;return n=259*(255*o+255)/(255*(259-255*o))*(n-128)+128,Math.max(0,Math.min(255,n))}function s(t,e,o,n,r,a){if((a?1-t/255:t/255)<.12)return" ";const i=[...e];return i[(n*r+o)%i.length]}var c=[[0,8,2,10],[12,4,14,6],[3,11,1,9],[15,7,13,5]];function l(t,e,o,n){if(n<=0)return t;const r=(c[o%4][e%4]/16-.5)*n*128;return Math.max(0,Math.min(255,t+r))}var h=new Array(256),f=new Array(256);for(let t=0;t<256;t++)h[t]=`rgb(${t},${t},${t})`,f[t]=`rgb(0,${t},0)`;function d(t,e,o,n,r,a=!1){switch(e){case"fullcolor":return`rgb(${t.r},${t.g},${t.b})`;case"matrix":return f[.299*t.r+.587*t.g+.114*t.b|0];case"accent":return`rgb(${o},${n},${r})`;default:{const e=.299*t.r+.587*t.g+.114*t.b|0;return h[e]}}}var m=[0,0,0];function u(t,e,o,n,r,a=!1){switch(e){case"fullcolor":m[0]=t.r,m[1]=t.g,m[2]=t.b;break;case"matrix":{const e=.299*t.r+.587*t.g+.114*t.b|0;m[0]=0,m[1]=e,m[2]=0;break}case"accent":m[0]=o,m[1]=n,m[2]=r;break;default:{const e=.299*t.r+.587*t.g+.114*t.b|0;m[0]=e,m[1]=e,m[2]=e;break}}return m}function g(t){const e=t.match(/rgba?\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)(?:\s*[,/]\s*([\d.]+))?\s*\)/);return e?{r:+e[1],g:+e[2],b:+e[3],a:void 0!==e[4]?+e[4]:1}:null}function M(t){let e=t;for(;e&&e!==document.documentElement.parentElement;){const t=getComputedStyle(e).backgroundColor;if(t&&"transparent"!==t&&"rgba(0, 0, 0, 0)"!==t){const e=g(t);if(e&&e.a>.1)return e}e=e.parentElement}return null}function p(t){if(t){const e=M(t);if(e){return(.299*e.r+.587*e.g+.114*e.b)/255<.4}}if("undefined"!=typeof document){const t=document.documentElement,e=(t.getAttribute("data-theme")||"").toLowerCase();if("dark"===e)return!0;if("light"===e)return!1;if(t.classList.contains("dark"))return!0;if(document.body){const t=M(document.body);if(t){return(.299*t.r+.587*t.g+.114*t.b)/255<.4}}}return"undefined"!=typeof window&&window.matchMedia("(prefers-color-scheme: dark)").matches}function x(t){if("string"!=typeof t)return t;const e=document.createElement("canvas");e.width=1,e.height=1;const o=e.getContext("2d");o.fillStyle=t,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]}}function v(t){return t*t*(3-2*t)}function b(t,e,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(t/o*Math.PI*4+3*s)+.5)+.4*(.5*Math.sin(e/n*Math.PI*3+2*s)+.5));case"pulse":{const r=o/2,a=n/2,i=Math.sqrt((t-r)**2+(e-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(e/n*Math.PI*8-5*s+.3*t)+.5)*(.3*Math.sin(t/o*Math.PI*2+s)+.7);case"breathe":{const o=.3*Math.sin(2*s)+.7,n=.1*Math.sin(.1*(t+e)+s);return Math.max(.1,Math.min(1,o+n))}case"sparkle":{const o=43758.5453*Math.sin(127.1*t+311.7*e+43758.5453*Math.floor(8*s)),n=o-Math.floor(o);return n>.7?1:.15+.4*n}case"glitch":{const t=Math.floor(e/(.05*n)),o=43758.5453*Math.sin(43.23*t+17.89*Math.floor(6*s));if(o-Math.floor(o)>.85){const e=.5*Math.sin(30*s+t)+.5;return e<.3?0:e}return 1}case"spiral":{const r=o/2,a=n/2,i=t-r,c=e-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=e*o+t-.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=t-r,c=e-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":return.55+.45*Math.sin(t/o*9+2*Math.sin(e/n*6-s)+1.5*s);case"ripple":{const r=o/2,a=n/2,i=t-r,c=e-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=e/n*Math.PI;return.05+(.5*Math.sin(o-1.8*s+.15*t)+.5)*(1-.6*(Math.max(0,e/n-.1)/.9))*.95}case"orbit":{const r=o/2,a=n/2,i=t-r,c=e-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=(t,e)=>{const n=43758.5453*Math.sin(127.1*t+311.7*e+43758.5453*o);return n-Math.floor(n)>.38?1:0},r=n(t,e),a=n(t-1,e)+n(t+1,e)+n(t,e-1)+n(t,e+1)+n(t-1,e-1)+n(t+1,e-1)+n(t-1,e+1)+n(t+1,e+1);return 1===(1===r?2===a||3===a?1:0:3===a?1:0)?1:.05}default:return 1}}var w={scale:1,offsetX:0,offsetY:0,glow:0,colorBlend:0,proximity:0};function y(t,e,o,n,r,a,i,s,c="spotlight",l=.5,h="circle",f=[],d=1){const m=(t-o)*Math.max(1,d),u=(e-n)*Math.max(1,1/d),g=.08+.35*l+.04*a;let M,p;if("box"===h){const t=Math.abs(m),e=Math.abs(u);M=Math.max(t,e),p=g}else M=Math.sqrt(m*m+u*u),p=g;if(M>=p&&("trail"!==c||0===f.length))return w.scale=1,w.offsetX=0,w.offsetY=0,w.glow=0,w.colorBlend=0,w.proximity=0,w;const x=v(Math.max(0,1-M/p))*r;let b=1,y=0,S=0,$=0,E=0;switch(c){case"spotlight":{b=1+x*a*1.8;const t=Math.atan2(u,m),e=x*x*a*.6;y=Math.cos(t)*e*i,S=Math.sin(t)*e*s,$=x*a*.4,E=x*x*a*.25;break}case"magnify":b=1+x*a*.85,$=x*a*.15;break;case"repel":{b=1;const t=Math.atan2(u,m),e=x*x*a*1.8;y=Math.cos(t)*e*i,S=Math.sin(t)*e*s;break}case"glow":$=x*a*.8,E=x*a*.4;break;case"colorShift":b=1,$=x*a*.12,E=x*a;break;case"attract":{const t=Math.atan2(u,m),e=x*x*a*1;y=(.45*-Math.cos(t)-1.6*Math.sin(t))*e*i,S=(.45*-Math.sin(t)+1.6*Math.cos(t))*e*s,$=x*a*.3;break}case"shatter":{const t=Math.atan2(u,m),e=.5*Math.sin(43.7*m+29.3*u),o=x*a*1.4*(.7+.3*e);y=Math.cos(t+e)*o*i,S=Math.sin(t+e)*o*s,b=Math.max(.1,1-x*a*.6),$=x*a*.25;break}case"trail":{let o=x,n=-u*x,r=m*x;for(const a of f){const i=(t-a.x)*Math.max(1,d),s=(e-a.y)*Math.max(1,1/d),c=Math.hypot(i,s)/g;if(c>=1)continue;const l=v(1-c)*a.intensity;o=Math.max(o,l),n+=(.35*a.vx-2*s)*l*.35,r+=(.35*a.vy+2*i)*l*.35}y=Math.tanh(2*n)*a*i*3,S=Math.tanh(2*r)*a*s*3,E=o*a*.65,$=o*a*.35,b=1+o*a*.08,w.proximity=o;break}case"glitchText":b=1,$=x*a*.5,E=x*a*.6}return w.scale=b,w.offsetX=y,w.offsetY=S,w.glow=$,w.colorBlend=E,"trail"!==c&&(w.proximity=x),w}function S(t,e,{continuous:o=!1,interactive:n=!1}={}){const r=t.parentElement??t;let a=null,i=0,s=!1,c=!0,l=!0,h=-1/0;const f=window.matchMedia("(prefers-reduced-motion: reduce)"),d=()=>{l=!0,s||!c||document.hidden||i||(i=requestAnimationFrame(m))},m=t=>{if(i=0,s||!c||document.hidden)return;const n=!f.matches&&(o||t-h<1500);(l||n)&&(e(t,f.matches?null:a),l=!1),n&&(i=requestAnimationFrame(m))},u=e=>{if("touch"===e.pointerType)return;const o=t.getBoundingClientRect();if(!o.width||!o.height)return;const n=(e.clientX-o.left)/o.width,r=(e.clientY-o.top)/o.height;a=n>=0&&n<=1&&r>=0&&r<=1?{x:n,y:r}:null,h=performance.now(),d()},g=()=>{a=null,h=performance.now(),d()},M=()=>{document.hidden&&i?(cancelAnimationFrame(i),i=0):d()},p="undefined"==typeof IntersectionObserver?null:new IntersectionObserver(([t])=>{c=t.isIntersecting,c?d():i&&(cancelAnimationFrame(i),i=0)});return p?.observe(t),n&&(r.addEventListener("pointermove",u),r.addEventListener("pointerleave",g)),document.addEventListener("visibilitychange",M),f.addEventListener("change",d),d(),{wake:d,stop:()=>{s=!0,cancelAnimationFrame(i),p?.disconnect(),r.removeEventListener("pointermove",u),r.removeEventListener("pointerleave",g),document.removeEventListener("visibilitychange",M),f.removeEventListener("change",d)}}}var $=null,E=null;function C(t,e){if(!$||!E){const o=a(t,e);$=o.canvas,E=o.ctx}return $.width!==t&&($.width=t),$.height!==e&&($.height=e),E}var T=new Map,A=new Map,F=new WeakMap;function k(t){const e=Intl.Segmenter;return e?Array.from(new e(void 0,{granularity:"grapheme"}).segment(t),({segment:t})=>t):[...t]}function I(t){let e=T.get(t);return e||(e=k(t),T.set(t,e)),e}function R(t){return k(t)}function L(t,e,o){const n=o?1-t/255:t/255,r=Math.floor(n*(e.length-1));return e[Math.max(0,Math.min(e.length-1,r))]??" "}function P(t,e,o,n){const r=`${t}\0${e?1:0}\0${o}\0${n}`;let a=A.get(r);if(!a){const s=I(t);a=new Array(256);for(let t=0;t<256;t++)a[t]=L(i(t,o,n),s,e);A.set(r,a)}return a}function B(t,e){return"auto"!==t?t:!p(e)}function z(t){const e=t.match(/^#([0-9a-fA-F]{3,6})$/);if(e){let t=e[1];if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return t}const o=t.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);return o?[o[1],o[2],o[3]].map(t=>parseInt(t).toString(16).padStart(2,"0")).join(""):null}function H(t){const e=t||"auto";if("auto"!==e)return z(e)??"ffffff";if("undefined"!=typeof document){const t=getComputedStyle(document.documentElement);for(const e of["--accent-color","--color-accent","--accent","--color-primary","--primary","--brand-color"]){const o=z(t.getPropertyValue(e).trim());if(o)return o}const e=z(getComputedStyle(document.body).accentColor??"");if(e)return e}return p("undefined"!=typeof document?document.body:null)?"faf9f7":"0d0d0d"}function W(t,e,o){return Math.max(e,Math.min(o,t))}function q(t,e,o){if(!t)return{x:0,y:0,width:e,height:o};const n=t.unit??"percent",r=!1!==t.preserveAspect,a=t=>void 0===t?void 0:"percent"===n?t*e:t,i=t=>void 0===t?void 0:"percent"===n?t*o:t,s=W(a(t.left)??0,0,e-1),c=W(a(t.right)??0,0,e-s-1),l=W(i(t.top)??0,0,o-1),h=W(i(t.bottom)??0,0,o-l-1),f=void 0!==t.left||void 0!==t.right||void 0!==t.top||void 0!==t.bottom,d=Math.max(1,e-s-c),m=Math.max(1,o-l-h),u=f?d:a(t.width),g=f?m:i(t.height);let M=u??e,p=g??o;if(r&&!f){const t=M/e,n=p/o,r=Math.min(t,n),a=void 0===u?n:void 0===g?t:r;M=e*a,p=o*a}M=W(M,1,f?d:e),p=W(p,1,f?m:o);const x=t.anchor??"center",v=a(t.x),b=i(t.y),w=f?s:0,y=f?l:0,S=f?d:e,$=f?m:o,E=x.endsWith("left")||"left"===x?0:x.endsWith("right")||"right"===x?S-M:(S-M)/2,C=x.startsWith("top")||"top"===x?0:x.startsWith("bottom")||"bottom"===x?$-p:($-p)/2;return{x:W(v??w+E,0,Math.max(0,e-M)),y:W(b??y+C,0,Math.max(0,o-p)),width:M,height:p}}function j(t,e,o,n){const r=t instanceof HTMLVideoElement?t.videoWidth:t.width,a=t instanceof HTMLVideoElement?t.videoHeight:t.height;if(0===r||0===a)return{frame:[],cols:0,rows:0};const c=e.charAspect,h=e.fontSize*e.charSpacing,f=e.fontSize/c*e.charSpacing,d=o||r,m=n||a,u=Math.floor(d/h),g=Math.floor(m/f);if(u<=0||g<=0)return{frame:[],cols:0,rows:0};const M=q(e.sourceCrop,r,a),p=Math.max(1,Math.min(Math.floor(2048/u),Math.floor(M.width/u))),v=Math.max(1,Math.min(Math.floor(2048/g),Math.floor(M.height/g))),b=u*p,w=g*v,y=C(b,w),S=y.globalCompositeOperation;y.globalCompositeOperation="copy";try{y.drawImage(t,M.x,M.y,M.width,M.height,0,0,b,w)}finally{y.globalCompositeOperation=S}const $=y.getImageData(0,0,b,w).data,E=e.chromaKey,T=null!=E&&!1!==E,A=!0===E,F="blue-screen"===E;let k=null,R=0;!T||A||F||(k=x(E),R=(e.chromaKeyTolerance??60)**2);let z=0,H=255;if(e.normalize){let t=255,e=0;for(let o=0;o<$.length;o+=4){if(T){const t=$[o],e=$[o+1],n=$[o+2];let r=!1;if(A)r=e>1.4*t&&e>1.4*n&&e>80;else if(F)r=n>1.4*t&&n>1.4*e&&n>80;else if(null!==k){const o=t-k.r,a=e-k.g,i=n-k.b;r=o*o+a*a+i*i<=R}if(r)continue}const n=.299*$[o]+.587*$[o+1]+.114*$[o+2];n<t&&(t=n),n>e&&(e=n)}z=t,H=e>t?e-t:255}const W=[],j=B(e.invert),O=T&&e.charset.replace(/ /g,"")||e.charset,N=I(O),V=e.customText?null:P(O,j,e.brightness,e.contrast),U=p*v;for(let t=0;t<g;t++){const o=[];for(let n=0;n<u;n++){let r=0,a=0,c=0,h=0,f=0;for(let e=0;e<v;e++){const o=(t*v+e)*b;for(let t=0;t<p;t++){const e=4*(o+n*p+t),i=$[e],s=$[e+1],l=$[e+2],d=$[e+3];if(T){let t=!1;if(A)t=s>1.4*i&&s>1.4*l&&s>80;else if(F)t=l>1.4*i&&l>1.4*s&&l>80;else if(null!==k){const e=i-k.r,o=s-k.g,n=l-k.b;t=e*e+o*o+n*n<=R}if(t){f++;continue}}r+=i,a+=s,c+=l,h+=d}}if(T&&f>U/2){o.push({char:" ",r:0,g:0,b:0,a:0});continue}const d=U-f,m=d>0?r/d:0,g=d>0?a/d:0,M=d>0?c/d:0,x=d>0?h/d:0,w=.299*m+.587*g+.114*M,y=e.normalize?(w-z)/H*255:w,S=i(y,e.brightness,e.contrast),E=e.ditherStrength>0?l(S,n,t,e.ditherStrength):S,C=e.customText?s(E,e.customText,n,t,u,j):e.ditherStrength>0?L(E,N,j):V[Math.max(0,Math.min(255,0|y))];o.push({char:C,r:m,g:g,b:M,a:x,lum:E})}W.push(o)}return{frame:W,cols:u,rows:g}}function O(t,e,o,n){const r=t instanceof HTMLVideoElement?t.videoWidth:t.width,a=t instanceof HTMLVideoElement?t.videoHeight:t.height;if(0===r||0===a)return{rows:[],cols:0,rowCount:0};const s=e.charAspect,c=e.fontSize*e.charSpacing,h=e.fontSize/s*e.charSpacing,f=o||r,d=n||a,m=Math.floor(f/c),u=Math.floor(d/h);if(m<=0||u<=0)return{rows:[],cols:0,rowCount:0};const g=m,M=u,p=C(g,M),v=q(e.sourceCrop,r,a),b=p.globalCompositeOperation;p.globalCompositeOperation="copy";try{p.drawImage(t,v.x,v.y,v.width,v.height,0,0,g,M)}finally{p.globalCompositeOperation=b}const w=p.getImageData(0,0,g,M).data,y=e.chromaKey,S=null!=y&&!1!==y,$=!0===y,E="blue-screen"===y;let T=null,A=0;!S||$||E||(T=x(y),A=(e.chromaKeyTolerance??60)**2);let F=0,k=255;if(e.normalize){let t=255,e=0;for(let o=0;o<w.length;o+=4){if(S){const t=w[o],e=w[o+1],n=w[o+2];let r=!1;if($)r=e>1.4*t&&e>1.4*n&&e>80;else if(E)r=n>1.4*t&&n>1.4*e&&n>80;else if(null!==T){const o=t-T.r,a=e-T.g,i=n-T.b;r=o*o+a*a+i*i<=A}if(r)continue}const n=.299*w[o]+.587*w[o+1]+.114*w[o+2];n<t&&(t=n),n>e&&(e=n)}F=t,k=e>t?e-t:255}const R=B(e.invert),z=S&&e.charset.replace(/ /g,"")||e.charset,H=I(z),W=e.customText?null:P(z,R,e.brightness,e.contrast),j=e.customText?I(e.customText):null,O="fullcolor"===e.colorMode?new Uint8ClampedArray(m*u*4):void 0,N=[];for(let t=0;t<u;t++){let o="";for(let n=0;n<m;n++){const r=4*(t*g+n),a=r,s=w[r],c=w[r+1],h=w[r+2],f=w[r+3];if(S){let t=!1;if($)t=c>1.4*s&&c>1.4*h&&c>80;else if(E)t=h>1.4*s&&h>1.4*c&&h>80;else if(null!==T){const e=s-T.r,o=c-T.g,n=h-T.b;t=e*e+o*o+n*n<=A}if(t){o+=" ",O&&(O[a]=0,O[a+1]=0,O[a+2]=0,O[a+3]=0);continue}}O&&(O[a]=s,O[a+1]=c,O[a+2]=h,O[a+3]=f);const d=.299*s+.587*c+.114*h,u=e.normalize?(d-F)/k*255:d,M=e.ditherStrength>0||j?i(u,e.brightness,e.contrast):u,p=e.ditherStrength>0?l(M,n,t,e.ditherStrength):M;if(j){o+=(R?1-p/255:p/255)<.12?" ":j[(t*m+n)%j.length]}else e.ditherStrength<=0?o+=W[Math.max(0,Math.min(255,0|u))]:o+=L(p,H,R)}N.push(o)}return{rows:N,cols:m,rowCount:u,colors:O}}function N(t,e,o,n,r){if(0===e.rows.length)return;const a=t.canvas,i=Boolean(o.chromaKey)||e.rows.some(t=>t.includes(" "));i||(F.delete(t),t.clearRect(0,0,n,r),t.fillStyle=p(a)?"#0a0a0a":"#faf9f7",t.fillRect(0,0,n,r));const s=H(o.accentColor),c=parseInt(s.substring(0,2),16),l=parseInt(s.substring(2,4),16),h=parseInt(s.substring(4,6),16),f=n/e.cols,d=r/e.rowCount,m=.9*Math.min(f/.55,d),u=e.colors;if("fullcolor"===o.colorMode&&u){F.delete(t),t.clearRect(0,0,n,r),t.font=`${m}px "JetBrains Mono", monospace`,t.textAlign="left",t.textBaseline="middle",t.globalAlpha=1;let o="";for(let n=0;n<e.rows.length;n++){const r=R(e.rows[n]);let a=0;for(;a<e.cols;){for(;a<e.cols&&" "===r[a];)a++;if(a>=e.cols)break;const i=a,s=4*(n*e.cols+a),c=240&u[s],l=240&u[s+1],h=240&u[s+2];for(a++;a<e.cols&&" "!==r[a];){const t=4*(n*e.cols+a);if((240&u[t])!==c||(240&u[t+1])!==l||(240&u[t+2])!==h)break;a++}const m=`rgb(${c},${l},${h})`;m!==o&&(t.fillStyle=m,o=m),t.fillText(r.slice(i,a).join(""),i*f+.5*f,n*d+.5*d)}}return void(t.globalAlpha=1)}t.font=`${m}px "JetBrains Mono", monospace`,t.textAlign="left",t.textBaseline="middle";const g="matrix"===o.colorMode?"rgb(0,255,0)":"grayscale"===o.colorMode?p(a)?"rgb(230,230,230)":"rgb(24,24,24)":`rgb(${c},${l},${h})`;t.fillStyle=g,t.globalAlpha=1;const M=F.get(t),x=i&&M&&M.cols===e.cols&&M.rowCount===e.rowCount&&M.canvasWidth===n&&M.canvasHeight===r&&M.fillStyle===g;x||t.clearRect(0,0,n,r);for(let o=0;o<e.rows.length;o++){const r=e.rows[o];x&&M.rows[o]===r||(x&&t.clearRect(0,o*d,n,d+1),0!==r.trim().length&&t.fillText(r,.5*f,o*d+.5*d))}F.set(t,{rows:e.rows.slice(),cols:e.cols,rowCount:e.rowCount,canvasWidth:n,canvasHeight:r,fillStyle:g}),t.globalAlpha=1}async function V(t,e,o,n,r=12,a=10,i,s=0){const c=Math.min(t.duration-s,a),l=Math.ceil(c*r),h=[];let f=0,d=0;for(let a=0;a<l;a++){const m=s+a/r;if(m>s+c)break;t.currentTime=m,await new Promise(e=>{const o=()=>{t.removeEventListener("seeked",o),e()};t.addEventListener("seeked",o)});const u=j(t,e,o,n);h.push(u.frame),f=u.cols,d=u.rows,i?.((a+1)/l)}return{frames:h,cols:f,rows:d,fps:r}}async function U(t,e,o,n,r=12,a=10,i,s=0){const c=Math.min(t.duration-s,a),l=Math.ceil(c*r),h=[];let f=0,d=0;for(let a=0;a<l;a++){const m=s+a/r;if(m>s+c)break;t.currentTime=m,await new Promise(e=>{const o=()=>{t.removeEventListener("seeked",o),e()};t.addEventListener("seeked",o)});const u=O(t,e,o,n);h.push(u),f=u.cols,d=u.rowCount,i?.((a+1)/l)}return{frames:h,cols:f,rows:d,fps:r}}async function D(t,e,o,n,r){const{parseGIF:a,decompressFrames:i}=await import("gifuct-js"),s=a(t),c=i(s,!0);if(0===c.length)return{frames:[],cols:0,rows:0,fps:10};const l=c[0].dims.width,h=c[0].dims.height,f=s.lsd?.width||l,d=s.lsd?.height||h,m=document.createElement("canvas");m.width=f,m.height=d;const u=m.getContext("2d"),g=document.createElement("canvas");g.width=f,g.height=d;const M=g.getContext("2d"),p=document.createElement("canvas"),x=p.getContext("2d"),v=[];let b=0,w=0,y=0;for(const t of c)y+=t.delay||100;const S=y/c.length,$=Math.round(Math.min(30,Math.max(5,1e3/S))),E=Math.min(c.length,300);for(let t=0;t<E;t++){const a=c[t],{dims:i,patch:s,disposalType:l}=a;3===l&&(M.clearRect(0,0,f,d),M.drawImage(m,0,0)),p.width!==i.width&&(p.width=i.width),p.height!==i.height&&(p.height=i.height);const h=new ImageData(new Uint8ClampedArray(s.buffer),i.width,i.height);x.putImageData(h,0,0),u.drawImage(p,i.left||0,i.top||0);const y=j(m,e,o,n);v.push(y.frame),b=y.cols,w=y.rows,2===l?u.clearRect(i.left||0,i.top||0,i.width,i.height):3===l&&(u.clearRect(0,0,f,d),u.drawImage(g,0,0)),r?.((t+1)/E)}return{frames:v,cols:b,rows:w,fps:$}}var _=new WeakMap,K=new WeakMap,Y=new WeakMap;function G(t,e,o,n,r,a=0,i){if(!e.length||!e[0].length||n<=0||r<=0)return;let s=null;if(o.hoverStrength>0){let e=_.get(t);e||(e={x:.5,y:.5,intensity:0,time:-1,emittedAt:-1,points:[]},_.set(t,e)),s=function(t,e,o){const n=t.time<0?1/60:Math.max(0,Math.min(.1,(o-t.time)/1e3));t.time=o;const r=t.intensity<.003,a=t.x,i=t.y;if(e){r&&(t.x=e.x,t.y=e.y);const o=1-Math.exp(-n/.055);t.x+=(e.x-t.x)*o,t.y+=(e.y-t.y)*o}t.intensity+=((e?.intensity??(e?1:0))-t.intensity)*(1-Math.exp(-n/(e?.09:.18)));const s=Math.exp(-n/.22);for(const e of t.points)e.intensity*=s;for(;t.points.length&&t.points[0].intensity<.01;)t.points.shift();return e&&!r&&o-t.emittedAt>=24&&Math.hypot(t.x-a,t.y-i)>5e-4&&(t.points.push({x:t.x,y:t.y,intensity:t.intensity,vx:Math.max(-1,Math.min(1,(t.x-a)/Math.max(n,.001))),vy:Math.max(-1,Math.min(1,(t.y-i)/Math.max(n,.001)))}),t.points.length>12&&t.points.shift(),t.emittedAt=o),!e&&t.intensity<.003&&!t.points.length?(t.intensity=0,null):{x:t.x,y:t.y,intensity:t.intensity,trail:t.points}}(e,i??null,performance.now())}else _.delete(t);if("none"!==o.animationStyle||o.charsetFrames?.length||o.hoverStrength<=0)return Y.delete(t),void J(t,e,o,n,r,a,s);const c=K.get(t);if(c?.frame!==e)return K.set(t,{frame:e,since:performance.now()}),Y.delete(t),void J(t,e,o,n,r,a,s);if(performance.now()-c.since<100)return void J(t,e,o,n,r,a,s);const l=t.getTransform();if(l.b||l.c||l.a<=0||l.d<=0)return void J(t,e,o,n,r,a,s);if(!s||(s.intensity??0)<.003)return void J(t,e,o,n,r,a,null);const h=p(t.canvas),f={...o,accentColor:"#"+H(o.accentColor)},d=JSON.stringify([f,n,r,l.a,l.d,h,void 0!==document.fonts?document.fonts.status:"loaded"]);let m=Y.get(t);if(!m||m.frame!==e||m.key!==d){const o=m?.canvas??document.createElement("canvas");o.width=Math.ceil(n*l.a),o.height=Math.ceil(r*l.d);const a=o.getContext("2d");a.setTransform(l.a,0,0,l.d,0,0),J(a,e,f,n,r,0,null,void 0,h),m={frame:e,key:d,canvas:o},Y.set(t,m)}if(t.clearRect(0,0,n,r),t.drawImage(m.canvas,0,0,n,r),!s||(s.intensity??0)<.003)return;const u=e.length,g=e[0].length,M=.08+.35*o.hoverRadius+.04*o.hoverStrength,x="trail"===o.hoverEffect?[s,...s.trail??[]]:[s];let v=1,b=1,w=0,y=0;for(const t of x)v=Math.min(v,t.x-M),w=Math.max(w,t.x+M),b=Math.min(b,t.y-M),y=Math.max(y,t.y+M);if("glitchText"===o.hoverEffect){const t=o.hoverText,e=Math.max(1,...(Array.isArray(t)?t:[t]).map(t=>t.length));v=Math.min(v,s.x-e/g),w=Math.max(w,s.x+e/g)}const S=Math.ceil(5+4*o.hoverStrength),$={x:Math.max(0,Math.floor(v*g)-S),y:Math.max(0,Math.floor(b*u)-S),right:Math.min(g,Math.ceil(w*g)+S),bottom:Math.min(u,Math.ceil(y*u)+S)};t.save(),t.beginPath(),t.rect($.x*n/g,$.y*r/u,($.right-$.x)*n/g,($.bottom-$.y)*r/u),t.clip(),J(t,e,f,n,r,a,s,$,h),t.restore()}function J(t,e,o,n,r,a=0,i,s,c){const l=e.length;if(0===l)return;const h=e[0].length;t.clearRect(0,0,n,r);let f=!1;const m=Math.max(1,l>>2),g=Math.max(1,h>>2);t:for(let t=0;t<l;t+=m){const o=e[t];for(let t=0;t<h;t+=g)if(o[t].a<200){f=!0;break t}}const M=t.canvas,x=c??p(M);f||(t.fillStyle=x?"#0a0a0a":"#faf9f7",t.fillRect(0,0,n,r));const v=n/h,w=r/l,S=i?.intensity??1,$=!!(i&&o.hoverStrength>0&&S>.005),E="#"+(z(o.hoverColor||"#ffffff")??"ffffff"),C=parseInt(E.slice(1,3),16),T=parseInt(E.slice(3,5),16),A=parseInt(E.slice(5,7),16),F=H(o.accentColor),k=parseInt(F.substring(0,2),16),R=parseInt(F.substring(2,4),16),P=parseInt(F.substring(4,6),16),W=o.hoverRadius;let q=0,j=h,O=0,N=l,V=0,U=0;if($&&i){V=i.x,U=i.y;const t=.08+.35*W+.04*o.hoverStrength;q=Math.max(0,Math.floor((V-t)*h)-1),j=Math.min(h,Math.ceil((V+t)*h)+1),O=Math.max(0,Math.floor((U-t)*l)-1),N=Math.min(l,Math.ceil((U+t)*l)+1)}if($&&"trail"===o.hoverEffect)for(const t of i?.trail??[]){const e=.08+.35*W+.04*o.hoverStrength;q=Math.min(q,Math.max(0,Math.floor((t.x-e)*h)-1)),j=Math.max(j,Math.min(h,Math.ceil((t.x+e)*h)+1)),O=Math.min(O,Math.max(0,Math.floor((t.y-e)*l)-1)),N=Math.max(N,Math.min(l,Math.ceil((t.y+e)*l)+1))}const D=o.animationStyle,_=o.animationSpeed,K="none"===D,Y=o.hoverStrength,G=o.hoverEffect,J=W,X=o.hoverShape||"circle",Q=B(o.invert,M),Z=o.colorMode,tt=2*Math.PI,et=1/h,ot=1/l;let nt="",rt=-1;if("dots"===o.renderMode){const c=.5*Math.min(v,w)*o.dotSizeRatio;for(let o=s?.y??0;o<(s?.bottom??l);o++){const f=e[o];for(let e=s?.x??0;e<(s?.right??h);e++){const s=f[e];if(s.a<10)continue;const m=.00392156863*(.299*s.r+.587*s.g+.114*s.b),g=Q?1-m:m;if(g<.02)continue;const M=K?1:b(e,o,h,l,a,D,_);let p=1,x=0,E=0,F=0,I=0;if($&&e>=q&&e<=j&&o>=O&&o<=N){const t=y(e*et,o*ot,V,U,S,Y,v,w,G,J,X,i?.trail,n/r);p=t.scale,x=t.offsetX,E=t.offsetY,F=t.glow,I=t.colorBlend}const L=c*g*M*p;if(L<.3)continue;const B=e*v+.5*v+x,z=o*w+.5*w+E;let H;if(I>0){const t=u(s,Z,k,R,P,Q);H=`rgb(${Math.min(255,t[0]+(C-t[0])*I|0)},${Math.min(255,t[1]+(T-t[1])*I|0)},${Math.min(255,t[2]+(A-t[2])*I|0)})`}else H=d(s,Z,k,R,P,Q);const W=Math.min(1,.00392156863*s.a*M*(1+F));if(W!==rt&&(t.globalAlpha=W,rt=W),H!==nt&&(t.fillStyle=H,nt=H),L<=3){const e=2*L;t.fillRect(B-L,z-L,e,e)}else t.beginPath(),t.arc(B,z,L,0,tt),t.fill()}}}else{const c=.55,f=.9*Math.min(v/c,w);{const e=/\p{Extended_Pictographic}/u.test(o.customText||o.charset);t.font=e?`${f}px "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif`:`${f}px "JetBrains Mono", monospace`,t.textAlign="center",t.textBaseline="middle"}const m=o.charsetFrames,g=!!m?.length,M=g?m[Math.floor(Math.max(0,a)*(o.charsetFps??2))%m.length]:o.charset,p=t.getTransform();if(!$&&K&&!g&&"accent"===Z&&!s&&o.hoverStrength<=0&&!/\p{Extended_Pictographic}/u.test(o.customText||o.charset)&&"letterSpacing"in t&&/^[\x20-\x7e]*$/.test(o.customText||o.charset)&&e.every(t=>t.every(t=>t.a<10||255===t.a&&1===t.char.length&&/^[\x20-\x7e]$/.test(t.char)))){const o=t.letterSpacing;t.letterSpacing="0px";const n=t.measureText("M").width;t.letterSpacing=v-n+"px",t.fillStyle=`rgb(${k},${R},${P})`,t.globalAlpha=1,t.textAlign="left";for(let o=0;o<l;o++){const r=e[o];let a="";for(let t=0;t<h;t++){const e=r[t];a+=e.a<10?" ":e.char}0!==a.trim().length&&t.fillText(a,.5*(v-n),o*w+.5*w)}return t.letterSpacing=o,t.textAlign="center",void(t.globalAlpha=1)}const x="glitchText"===G&&$,E="!@#$%^&*<>{}[]|/\\~`0123456789",F=E.length;let B="",z=0,H=0,tt=0,at=0,it=0,st=0;if(x){const t=o.hoverText??"ASCIIFY";if(H=Math.round(V*h),tt=Math.round(U*l),Array.isArray(t)){const e=t.filter(t=>t.length>0);0===e.length&&e.push("ASCIIFY");B=e[((7*Math.floor(H/Math.max(1,Math.ceil(h/5)))+13*Math.floor(tt/Math.max(1,Math.ceil(l/3))))%e.length+e.length)%e.length]}else B=t||"ASCIIFY";z=B.length,at=Math.max(3,Math.min(12,Math.round(l*W*.6)));const e=Math.floor(at/2);it=Math.max(0,tt-e),it+at>l&&(it=Math.max(0,l-at)),st=H-Math.floor(z/2)}for(let o=s?.y??0;o<(s?.bottom??l);o++){const c=e[o];for(let f=s?.x??0;f<(s?.right??h);f++){const s=c[f];if(s.a<10)continue;let m=g&&null!=s.lum?L(s.lum,I(M),Q):s.char;if(" "===m)continue;const W=K?1:b(f,o,h,l,a,D,_);if(W<.05)continue;let ct=1,lt=0,ht=0,ft=0,dt=0;if($&&!x&&f>=q&&f<=j&&o>=O&&o<=N){const t=y(f*et,o*ot,V,U,S,Y,v,w,G,J,X,i?.trail,n/r);if(ct=t.scale,lt=t.offsetX,ht=t.offsetY,ft=t.glow,dt=t.colorBlend,"trail"===G&&t.proximity>0){const n=Math.max(0,Math.min(h-1,Math.round(f-t.offsetX/v))),r=e[Math.max(0,Math.min(l-1,Math.round(o-t.offsetY/w)))][n],a=r.lum??.299*r.r+.587*r.g+.114*r.b;m=L(Math.min(255,a+t.proximity*Y*65),I(M),Q)}}if(x&&o>=it&&o<it+at){const t=f-st;if(t>=0&&t<z){const e=B[t],n=Math.abs(o-tt)/Math.max(1,.5*at),r=Math.abs(f-H)/Math.max(1,z),i=Math.max(n,r),s=Math.max(0,Math.min(1,1-.9*i)),c=43758.5453*Math.sin(127.1*f+311.7*o+43758.5453*Math.floor(12*a));m=Math.abs(c-Math.floor(c))<s?e:E[Math.abs(Math.floor(97*c))%F],ft=.3+.7*s,dt=.3+.65*s}}const mt=f*v+.5*v+lt,ut=o*w+.5*w+ht;let gt;if(dt>0){const t=u(s,Z,k,R,P,Q);gt=`rgb(${Math.min(255,t[0]+(C-t[0])*dt|0)},${Math.min(255,t[1]+(T-t[1])*dt|0)},${Math.min(255,t[2]+(A-t[2])*dt|0)})`}else gt=d(s,Z,k,R,P,Q);const Mt=Math.min(1,.00392156863*s.a*W*(1+ft));Mt!==rt&&(t.globalAlpha=Mt,rt=Mt),gt!==nt&&(t.fillStyle=gt,nt=gt),1!==ct?(t.translate(mt,ut),t.scale(ct,ct),t.fillText(m,0,0),t.setTransform(p)):t.fillText(m,mt,ut)}}}t.globalAlpha=1}function X(t){return Math.max(0,Math.min(1,t))}function Q(t){return"string"==typeof t?document.querySelector(t):t instanceof HTMLElement?t:null}function Z(t){return"ascii"===t.renderMode&&"none"===t.animationStyle&&t.hoverStrength<=0&&!t.charsetFrames?.length}function tt(t,e={}){const o=X(t),n=X(o*(void 0===e.speed?1:Math.max(.001,e.speed)));return X(e.ease?e.ease(n):n)}function et(t,e,o={}){if(!Number.isFinite(t.duration)||t.duration<=0)return;const n=o.from??0,r=o.to??t.duration,a=Math.max(n,Math.min(r,t.duration)),i=tt(e,o),s=n+(a-n)*i;t.currentTime=Math.min(Math.max(n,s),Math.max(n,a-.04)),o.onUpdate?.(i,t)}function ot(t,e){return Math.abs(t.currentTime-e)<1/240?nt(t):new Promise(o=>{const n=()=>{t.removeEventListener("seeked",n),o()};t.addEventListener("seeked",n,{once:!0});const r=t.fastSeek;r?r.call(t,e):t.currentTime=e})}function nt(t){const e=t.requestVideoFrameCallback;return new Promise(e?o=>{let n=!1;const r=()=>{n||(n=!0,o())};e.call(t,r),window.setTimeout(r,32)}:t=>requestAnimationFrame(()=>t()))}function rt(t,e={}){const o=Q(e.trigger)??t;t.pause();const n=e.gsap,r=e.ScrollTrigger??n?.ScrollTrigger;if(n&&r?.create){n.registerPlugin?.(r);const a=r.create({trigger:o,start:e.start??"top bottom",end:e.end??"bottom top",scrub:e.scrub??!0,onUpdate:o=>et(t,o.progress,e)});return()=>a.kill?.()}return function(t,e,o){let n=0;const r=()=>{n=0;const r=e.getBoundingClientRect(),a=window.innerHeight||document.documentElement.clientHeight,i=r.height+a,s=i>0?X((a-r.top)/i):0;et(t,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)}}(t,o,e)}function at(t,e,o){const n=e.gsap,r=e.ScrollTrigger??n?.ScrollTrigger;if(n&&r?.create){n.registerPlugin?.(r);const a=r.create({trigger:t,start:e.start??"top bottom",end:e.end??"bottom top",scrub:e.scrub??!0,onUpdate:t=>o(t.progress)});return()=>a.kill?.()}return function(t,e){let o=0;const n=()=>{o=0;const n=t.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight,a=n.height+r,i=a>0?X((r-n.top)/a):0;e(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)}}(t,o)}function it(t,e,o){if(!t||!e||!o.sourceCrop)return{w:t,h:e};const n=q(o.sourceCrop,t,e);return{w:Math.max(1,Math.round(n.width)),h:Math.max(1,Math.round(n.height))}}function st(t,e,o,n){const r=n.chromaKey;if(null==r||!1===r)return!1;if(!0===r)return e>1.4*t&&e>1.4*o&&e>80;if("blue-screen"===r)return o>1.4*t&&o>1.4*e&&o>80;const a=x(r),i=(n.chromaKeyTolerance??60)**2,s=t-a.r,c=e-a.g,l=o-a.b;return s*s+c*c+l*l<=i}function ct(t,e,o){if(!e.chromaKey||!e.sourceCrop||"off"===e.chromaKeyTrimMode)return e;const n=t instanceof HTMLVideoElement?t.videoWidth:t.width,r=t instanceof HTMLVideoElement?t.videoHeight:t.height;if(!n||!r)return e;const i=q(e.sourceCrop,n,r),s=Math.min(360,Math.max(1,Math.round(i.width))),c=Math.max(1,Math.round(s*(i.height/i.width))),{ctx:l}=a(s,c);l.drawImage(t,i.x,i.y,i.width,i.height,0,0,s,c);const h=l.getImageData(0,0,s,c).data,f=Math.max(0,Math.min(255,e.chromaKeyTrimLuminanceThreshold??0));let d=s,m=c,u=-1,g=-1;for(let t=0;t<c;t++)for(let o=0;o<s;o++){const n=4*(t*s+o),r=h[n+3],a=h[n],i=h[n+1],c=h[n+2];r<=8||.2126*a+.7152*i+.0722*c<=f||st(a,i,c,e)||(o<d&&(d=o),t<m&&(m=t),o>u&&(u=o),t>g&&(g=t))}if(u<d||g<m)return e;const M=Math.max(0,Math.min(.25,e.chromaKeyTrimPadding??.002)),p=Math.round(s*M),x=Math.round(c*M);d=Math.max(0,d-p),m=Math.max(0,m-x),u=Math.min(s-1,u+p),g=Math.min(c-1,g+x);const v=function(t,e,o,n,r){const a=r&&Number.isFinite(r)&&r>0?r:null;if(!a)return t;const i=e.x,s=e.y,c=e.x+e.width,l=e.y+e.height,h=Math.max(i,t.left),f=Math.max(s,t.top),d=Math.min(c,o-t.right),m=Math.min(l,n-t.bottom),u=Math.max(1,d-h),g=Math.max(1,m-f),M=h+u/2,p=f+g/2;let x=u,v=g;x/v<a?x=v*a:v=x/a;x>e.width&&(x=e.width,v=Math.max(g,Math.min(e.height,x/a)));v>e.height&&(v=e.height,x=Math.max(u,Math.min(e.width,v*a)));let b=M-x/2,w=p-v/2;return b=Math.max(i,Math.min(c-x,b)),w=Math.max(s,Math.min(l-v,w)),{left:b,top:w,right:o-(b+x),bottom:n-(w+v)}}({left:i.x+d/s*i.width,top:i.y+m/c*i.height,right:n-(i.x+(u+1)/s*i.width),bottom:r-(i.y+(g+1)/c*i.height)},{x:i.x,y:i.y,width:i.width,height:i.height},n,r,o);return{...e,sourceCrop:{unit:"pixel",...v,preserveAspect:!1}}}function lt(t){const e=t.sourceCrop;return e&&"pixel"===e.unit?void 0===e.left||void 0===e.top||void 0===e.right||void 0===e.bottom?null:{left:e.left,top:e.top,right:e.right,bottom:e.bottom}:null}async function ht(t,e,o,n,r){if(!e.chromaKey||!e.sourceCrop||"range"!==e.chromaKeyTrimMode)return e;const a=t.currentTime,i=function(t,e,o,n){const r=!0===n?{}:n||{},a=Math.max(0,r.from??e),i=r.to??o??(Number.isFinite(t.duration)?t.duration:a),s=Math.max(a,i-.04),c=Math.max(0,s-a),l=c>.1?[a,a+.25*c,a+.5*c,a+.75*c,s]:[a];return Array.from(new Set(l.map(t=>Math.max(0,Number(t.toFixed(3))))))}(t,o,n,r);let s=null;for(const o of i){await ot(t,o),await nt(t);const n=lt(ct(t,e));n&&(s=s?{left:Math.min(s.left,n.left),top:Math.min(s.top,n.top),right:Math.min(s.right,n.right),bottom:Math.min(s.bottom,n.bottom)}:n)}return await ot(t,a),await nt(t),s?{...e,sourceCrop:{unit:"pixel",...s,preserveAspect:!0}}:e}function ft(t,e,o=2048){return dt({sourceWidth:t,sourceHeight:e,maxRenderDimension:o})}function dt({sourceWidth:t,sourceHeight:e,cssWidth:o=0,cssHeight:n=0,maxRenderDimension:r=2048}){const a=Math.max(1,t),i=Math.max(1,e),s=a/i,c=Math.max(1,r),l=Math.min(1,c/Math.max(a,i)),h=Math.max(a,i)*l,f=Math.max(0,o,n),d=Math.min(c,Math.max(h,f));return s>=1?{renderW:Math.round(d),renderH:Math.round(d/s)}:{renderW:Math.round(d*s),renderH:Math.round(d)}}function mt(t,e,o,n){if(void 0===t)return;if("number"==typeof t)return t;const r=t.trim();if(r.endsWith("%")){const t=Number.parseFloat(r)/100;return Number.isFinite(t)?e*t:void 0}if(r.endsWith("px")){const t=Number.parseFloat(r);return Number.isFinite(t)?t:void 0}if(r.endsWith("vw")){const t=Number.parseFloat(r)/100;return Number.isFinite(t)?o*t:void 0}if(r.endsWith("vh")){const t=Number.parseFloat(r)/100;return Number.isFinite(t)?n*t:void 0}}function ut(t,e,o,n,r,a=2048,i={}){const{width:s,height:c}=e.getBoundingClientRect();if(!s||!c)return{renderW:0,renderH:0,dpr:1};const l="undefined"!=typeof window?window.innerWidth:s,h="undefined"!=typeof window?window.innerHeight:c,f=mt(i.width,s,l,h)??s,d=mt(i.height,c,l,h)??c,m=function(t,e,o,n,r){const a=t=>{const o=mt(t,e,n,r);return o&&o>0?o:0},i=t=>{const e=mt(t,o,n,r);return e&&e>0?e:0};return void 0===t?{x:0,y:0}:"number"==typeof t||"string"==typeof t?{x:a(t),y:i(t)}:{x:a(t.x),y:i(t.y)}}(i.bleed,s,c,l,h),u=f+2*m.x,g=d+2*m.y,{cssW:M,cssH:p}=function(t,e,o,n="contain"){if("fill"===n)return{cssW:t,cssH:e};let r=t,a=r/o;const i="cover"===n,s=a>e;return(i&&!s||!i&&s)&&(a=e,r=a*o),"scale-down"===n&&(r=Math.min(r,t),a=Math.min(a,e)),{cssW:Math.round(r),cssH:Math.round(a)}}(u,g,o,i.objectFit??"contain"),x="undefined"!=typeof window&&window.devicePixelRatio||1;let v,b;n&&r?({renderW:v,renderH:b}=dt({sourceWidth:n,sourceHeight:r,cssWidth:M,cssHeight:p,maxRenderDimension:a})):(v=M,b=p);const w=8e6,y=v*x*b*x>w?Math.sqrt(w/(v*b)):x;return t.width=Math.round(v*y),t.height=Math.round(b*y),t.style.width=`${M}px`,t.style.height=`${p}px`,{renderW:v,renderH:b,dpr:y}}async function gt(t,e,{fontSize:n,artStyle:a="classic",options:i={},fitTo:s,objectFit:c,objectPosition:l,scale:h,width:f,height:d,bleed:m,preExtract:u=!1,fps:g,maxRenderDimension:M=2048,trim:p,scroll:x,maxCachedFrames:v=90,onReady:b,onFrame:w}={}){const y=p?.start??0,$=p?.end,E=n??i.fontSize??10;let C={...r,...o[a],artStyle:a,...i,fontSize:E};const T=e.getContext("2d");if(!T)throw new Error("asciifyVideo: could not get 2d context from canvas.");const A="string"==typeof s?document.querySelector(s):s instanceof HTMLElement?s:null,F={objectFit:c,objectPosition:l,scale:h,width:f,height:d,bleed:m},k=function(t,e){var o;if(!function(t){return void 0!==t.objectFit||void 0!==t.objectPosition||void 0!==t.scale||void 0!==t.width||void 0!==t.height||void 0!==t.bleed}(e))return()=>{};const n={width:t.style.width,height:t.style.height,objectFit:t.style.objectFit,objectPosition:t.style.objectPosition,maxWidth:t.style.maxWidth,maxHeight:t.style.maxHeight,transformOrigin:t.style.transformOrigin,scale:t.style.getPropertyValue("scale")};if(e.objectFit&&(t.style.objectFit=e.objectFit),e.objectPosition&&(t.style.objectPosition=e.objectPosition,t.style.transformOrigin=e.objectPosition),void 0===e.scale&&void 0===e.bleed||(t.style.maxWidth="none",t.style.maxHeight="none"),void 0!==e.scale){const n=Number.isFinite(e.scale)&&e.scale>0?e.scale:1;t.style.setProperty("scale",String(n)),(o=t.style).transformOrigin||(o.transformOrigin=e.objectPosition??"center center")}return()=>{t.style.width=n.width,t.style.height=n.height,t.style.objectFit=n.objectFit,t.style.objectPosition=n.objectPosition,t.style.maxWidth=n.maxWidth,t.style.maxHeight=n.maxHeight,t.style.transformOrigin=n.transformOrigin,n.scale?t.style.setProperty("scale",n.scale):t.style.removeProperty("scale")}}(e,F),I=t=>()=>{t(),k()};if(u){let o;"string"==typeof t?(o=document.createElement("video"),o.crossOrigin="anonymous",o.src=t,o.readyState<2&&await new Promise((e,n)=>{o.onloadeddata=()=>e(),o.onerror=()=>n(new Error(`asciifyVideo: failed to load "${t}"`))})):o=t,C=await ht(o,C,y,$,x);const n=it(o.videoWidth,o.videoHeight,C);A&&ut(e,A,n.w/n.h,n.w,n.h,M,F);const{renderW:r,renderH:a}=ft(n.w,n.h,M),i="undefined"!=typeof window&&window.devicePixelRatio||1,s=8e6,c=r*i*a*i>s?Math.sqrt(s/(r*a)):i;e.width===Math.round(r*c)&&e.height===Math.round(a*c)||(e.width=Math.round(r*c),e.height=Math.round(a*c));const l=void 0!==$?$-y:10,h=g??(x?18:void 0);if(Z(C)){const{frames:t,fps:n}=await U(o,C,r,a,h,l,void 0,y),i=e=>{const o=t[e];o&&(T.save(),T.setTransform(c,0,0,c,0,0),N(T,o,C,r,a),T.restore(),w?.())};if(x){let n=!1,r=-1;const a=!0===x?{}:x,s=at(Q(a.trigger)??A??e,a,e=>{const s=tt(e,a),c=Math.max(0,Math.min(t.length-1,Math.round(s*(t.length-1))));c!==r&&(r=c,i(c),n||(n=!0,b?.(o)),a.onUpdate?.(s,o))});return i(0),n=!0,b?.(o),I(s)}let s,f=!1,d=0,m=performance.now(),u=!0;const g=1e3/n,M=e=>{f||(e-m>=g&&(i(d),d=(d+1)%t.length,m=e,u&&(u=!1,b?.(o))),s=requestAnimationFrame(M))};return s=requestAnimationFrame(M),I(()=>{f=!0,cancelAnimationFrame(s)})}const{frames:f,fps:d}=await V(o,C,r,a,h,l,void 0,y);if(!f.length)throw new Error("asciifyVideo: no frames were decoded.");let m=0;const u=performance.now(),p=S(e,(t,e)=>{x||(m=Math.floor((t-u)*d/1e3)%f.length),T.save(),T.setTransform(c,0,0,c,0,0),G(T,f[m],C,r,a,(t-u)/1e3,e),T.restore(),w?.()},{continuous:!x||"none"!==C.animationStyle||!!C.charsetFrames?.length,interactive:C.hoverStrength>0});let v;if(x){const t=!0===x?{}:x;v=at(Q(t.trigger)??A??e,t,e=>{m=Math.max(0,Math.min(f.length-1,Math.round(tt(e,t)*(f.length-1)))),p.wake(),t.onUpdate?.(e,o)})}return b?.(o),I(()=>{p.stop(),v?.()})}let R,L=!1;"string"==typeof t?(R=document.createElement("video"),R.crossOrigin="anonymous",R.src=t,R.muted=!0,R.loop=!0,R.playsInline=!0,R.setAttribute("playsinline",""),Object.assign(R.style,{position:"fixed",top:"0",left:"0",width:"1px",height:"1px",opacity:"0",pointerEvents:"none",zIndex:"-1"}),document.body.appendChild(R),L=!0,await new Promise((e,o)=>{R.onloadedmetadata=()=>e(),R.onerror=()=>o(new Error(`asciifyVideo: failed to load "${t}"`))}),await R.play().catch(()=>{})):(R=t,R.readyState<HTMLMediaElement.HAVE_METADATA&&await new Promise((t,e)=>{const o=()=>{R.removeEventListener("loadedmetadata",n),R.removeEventListener("error",r)},n=()=>{o(),t()},r=()=>{o(),e(new Error("asciifyVideo: provided video element failed to load metadata."))};R.addEventListener("loadedmetadata",n),R.addEventListener("error",r),R.load()}),R.paused&&await R.play().catch(()=>{})),y>0&&(R.currentTime=y,await new Promise(t=>{const e=()=>{R.removeEventListener("seeked",e),t()};R.addEventListener("seeked",e)}),await nt(R));let P=null;(y>0||void 0!==$)&&(P=()=>{(void 0!==$&&R.currentTime>=$||y>0&&R.currentTime<y)&&(R.currentTime=y)},R.addEventListener("timeupdate",P)),C=await ht(R,C,y,$,x);let B=null;const z=it(R.videoWidth,R.videoHeight,C);let{renderW:H,renderH:W}=ft(z.w,z.h,M);const q=t=>"frame"===C.chromaKeyTrimMode?ct(t,C,H/W):C;if(A){const t=z.w/z.h,o=z.w,n=z.h,r=ut(e,A,t,o,n,M,F);H=r.renderW,W=r.renderH;const a=e.getContext("2d");a&&a.setTransform(r.dpr,0,0,r.dpr,0,0),B=new ResizeObserver(()=>{const r=ut(e,A,t,o,n,M,F);H=r.renderW,W=r.renderH;const a=e.getContext("2d");a&&a.setTransform(r.dpr,0,0,r.dpr,0,0)}),B.observe(A)}else{const t="undefined"!=typeof window&&window.devicePixelRatio||1,o=8e6,n=H*t*W*t>o?Math.sqrt(o/(H*W)):t;e.width===Math.round(H*n)&&e.height===Math.round(W*n)||(e.width=Math.round(H*n),e.height=Math.round(W*n)),T.setTransform(n,0,0,n,0,0)}let D=!0,_=null;const K=x&&!u,Y=g&&g>0?1e3/g:0;let J=0;const et=!K&&Z(C);if(K&&"ascii"===C.renderMode&&"none"===C.animationStyle&&C.hoverStrength<=0&&!C.charsetFrames?.length){const t=!0===x?{}:x,o=Q(t.trigger)??A??e,n=t.from??y,r=t.to??$??R.duration,a=Math.max(n,Math.min(r,R.duration)),i=Math.max(.001,a-n),s=Math.min(60,Math.max(12,g??30)),c=Math.max(2,Math.ceil(i*s)+1),l=new Array(c),h=[],f=Math.max(2,Math.min(c,Math.floor(v))),d=()=>{for(;h.length>f;){const t=h.findIndex(t=>t!==u&&Math.abs(t-u)>2),e=t>=0?t:0,o=h.splice(e,1)[0];void 0!==o&&(l[o]=void 0)}},m=t=>{const e=h.indexOf(t);e>=0&&h.splice(e,1),h.push(t),d()};let u=0,M=0,p=-1,S=0,E=!1,F=!1,k=!1;const z=new Set,j=document.createElement("video");j.muted=!0,j.playsInline=!0,j.preload="auto",j.crossOrigin=R.crossOrigin||"anonymous",j.src=R.currentSrc||R.src,Object.assign(j.style,{position:"fixed",top:"0",left:"0",width:"1px",height:"1px",opacity:"0",pointerEvents:"none",zIndex:"-1"}),document.body.appendChild(j),j.readyState<HTMLMediaElement.HAVE_METADATA&&await new Promise((t,e)=>{const o=()=>{j.removeEventListener("loadedmetadata",n),j.removeEventListener("error",r)},n=()=>{o(),t()},r=()=>{o(),e(new Error("asciifyVideo: cache video failed to load metadata."))};j.addEventListener("loadedmetadata",n),j.addEventListener("error",r),j.load()}),j.pause(),R.paused&&await R.play().catch(()=>{});const V=t=>n+i*t/Math.max(1,c-1),U=t=>Math.max(0,Math.min(c-1,Math.round(t*(c-1)))),D=q(R),K=O(R,D,H,W);K.rows.length>0&&(l[0]=K,m(0),N(T,K,D,H,W),k=!0,b?.(R),w?.());const G=t=>{if(l[t])return t;for(let e=1;e<c;e++){const o=t-e,n=t+e;if(o>=0&&l[o])return o;if(n<c&&l[n])return n}return-1},Z=()=>{if(!l[u])return u;for(const t of z)if(!l[t])return t;for(let t=1;t<c;t++){const e=u-t,o=u+t;if(e>=0&&!l[e])return e;if(o<c&&!l[o])return o}return-1},et=t=>{t<0||t>=c||l[t]||(z.add(t),nt())},nt=async()=>{if(E||F)return;const t=Z();if(!(t<0)){z.delete(t),F=!0;try{if(await ot(j,V(t)),!E){const e=q(j),o=O(j,e,H,W);o.rows.length>0&&(l[t]=o,m(t))}}finally{F=!1,E||requestAnimationFrame(()=>{nt()})}}},rt=()=>{if(E)return;const t=G(u);if(t>=0&&t!==p){const e=l[t];e&&(N(T,e,C,H,W),p=t,k||(k=!0,b?.(R)),w?.())}else if(t<0||p<0){const t=performance.now();if(Y<=0||t-J>=Y){const e=q(R),o=O(R,e,H,W);o.rows.length>0&&(N(T,o,e,H,W),J=t,k||(k=!0,b?.(R)),w?.())}}et(u),S=requestAnimationFrame(rt)};return _=at(o,t,e=>{const o=function(t,e,o={}){if(!Number.isFinite(t.duration)||t.duration<=0)return null;const n=o.from??0,r=o.to??t.duration,a=Math.max(n,Math.min(r,t.duration)),i=tt(e,o),s=n+(a-n)*i;return{progress:i,time:Math.min(Math.max(n,s),Math.max(n,a-.04))}}(R,e,{...t,from:n,to:a});M=o?.progress??X(e),u=U(M),et(u),et(u-1),et(u+1),et(u-2),et(u+2),et(u-3),et(u+3),t.onUpdate?.(M,R)}),et(0),et(1),S=requestAnimationFrame(rt),I(()=>{E=!0,cancelAnimationFrame(S),_?.(),B?.disconnect(),z.clear(),h.length=0,l.fill(void 0),j.pause(),j.src="",j.removeAttribute("src"),j.load(),j.isConnected&&j.remove(),P&&R.removeEventListener("timeupdate",P),L&&(R.pause(),R.src="",R.removeAttribute("src"),R.load(),R.isConnected&&R.remove())})}if(K){const t=!0===x?{}:x;_=rt(R,{...t,trigger:t.trigger??A??e,from:t.from??y,to:t.to??$})}let st=-1,lt=0,dt=-1,mt=0;const gt="function"==typeof R.requestVideoFrameCallback,Mt=()=>{mt=R.requestVideoFrameCallback(()=>{lt++,Mt()})};gt&&Mt();let pt=0,xt=0,vt=null;const bt=S(e,(t,o)=>{if(R.readyState<2||0===e.width||0===e.height)return;if(Y>0&&t-J<Y&&!o)return;if(y>0&&R.currentTime<y)return;if(void 0!==$&&R.currentTime>=$)return;const n=(gt?lt!==dt:R.currentTime!==st)||pt!==H||xt!==W;if(n||!(C.hoverStrength<=0)||"none"!==C.animationStyle||C.charsetFrames?.length){if(et){const t=q(R),e=O(R,t,H,W);N(T,e,t,H,W)}else!n&&vt||(vt=j(R,q(R),H,W).frame),G(T,vt,C,H,W,t/1e3,o);st=R.currentTime,dt=lt,pt=H,xt=W,J=t,D&&(D=!1,b?.(R)),w?.()}},{continuous:!0,interactive:C.hoverStrength>0});return I(()=>{bt.stop(),mt&&R.cancelVideoFrameCallback(mt),_?.(),B?.disconnect(),P&&R.removeEventListener("timeupdate",P),L&&(R.pause(),R.src="",R.removeAttribute("src"),R.load(),R.isConnected&&R.remove())})}function Mt(t){const e=t.match(/^#([0-9a-f]{3,8})$/i)?.[1];if(e){const t=e.length<=4?e.split("").map(t=>parseInt(t+t,16)):[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)];return{r:t[0],g:t[1],b:t[2]}}const o=t.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);return o?{r:+o[1],g:+o[2],b:+o[3]}:null}function pt(t){return t*t*t*(t*(6*t-15)+10)}function xt(t,e,o){return t+(e-t)*o}function vt(t,e){let o=127*t+311*e;return o^=o>>13,(o*(o*o*15731+789221)+1376312589&2147483647)/2147483647}function bt(t,e){const o=Math.floor(t),n=Math.floor(e),r=e-n,a=pt(t-o),i=pt(r),s=vt(o,n),c=vt(o+1,n),l=vt(o,n+1),h=vt(o+1,n+1);return xt(xt(s,c,a),xt(l,h,a),i)}function wt(t,e){return(.5*bt(t,e)+.25*bt(2.1*t,2.1*e)+.125*bt(4.3*t,4.3*e))/.875}function yt(t,e,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:m=.55,mouseFalloff:u=2.8,speed:g=1,vortex:M=!0,sparkles:p=!0,breathe:x=!0,lightMode:v=!1}=a,b=f??(v?"#6b8700":"#d4ff00"),w=i*s,y=i*c,S=Math.ceil(e/w),$=Math.ceil(o/y),E=r.x,C=r.y;let T=212,A=255,F=0;{const t=b.replace("#","");6===t.length&&(T=parseInt(t.slice(0,2),16),A=parseInt(t.slice(2,4),16),F=parseInt(t.slice(4,6),16))}t.clearRect(0,0,e,o),t.font=`${i}px "JetBrains Mono", monospace`,t.textBaseline="top";const k=n*g,I=x?.12*(.5*Math.sin(.22*k)+.5):0;for(let e=0;e<$;e++)for(let o=0;o<S;o++){const n=o/S,r=e/$,a=.045,i=.08*k,s=.06,c=.45*((.5*Math.sin(.08*o+.05*e+.6*k)+.5+(.5*Math.sin(.03*o-.07*e+.4*k)+.5)+(.5*Math.sin(.05*o+.03*e+.8*k)+.5))/3)+.35*(.5*wt(o*a+i,e*a*1.4-.7*i)+.5)+.2*(.5*Math.sin((o+.65*e)*s+1.1*k)+.5)+I,f=n-E,g=r-C,x=Math.sqrt(f*f+g*g);let b=0;if(M&&x<.35){const t=Math.atan2(g,f),e=Math.sin(4*t+2.2*k-14*x),o=Math.max(0,1-x/.35);b=e*o*o*.22}const R=c*(1-m)+(Math.max(0,1-x*u)+.5*b)*m+.15*b,L=Math.min(1,Math.max(0,R));let P=L;if(p&&L>.72){const t=Math.floor(8*k),n=vt(7*o+3*t,11*e+t);n>.88&&(P=Math.min(1,L+4*(n-.88)))}const B=Math.floor(P*(l.length-1));if(" "===l[B])continue;const z=.015+.07*P;if(P>d){const e=Math.min(v?.9:.28,z*(v?14:2.8));t.fillStyle=`rgba(${T},${A},${F},${e})`}else t.fillStyle=h?h.replace("{a}",String(z)):v?`rgba(55,55,55,${7*z})`:`rgba(255,255,255,${z})`;t.fillText(l[B],o*w,e*y)}}function St(t,e,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,m=s??(d?"#6b8700":"#d4ff00"),u=.62*a,g=1.4*a,M=Math.ceil(e/u),p=Math.ceil(o/g);t.clearRect(0,0,e,o),t.font=`${a}px monospace`,t.textBaseline="top";let x=255,v=255,b=255;if(d&&(x=55,v=55,b=55),c){const t=Mt(c);t&&(x=t.r,v=t.g,b=t.b)}let w=212,y=255,S=0;const $=Mt(m);$&&(w=$.r,y=$.g,S=$.b);const E=p+f;for(let e=0;e<M;e++){if(vt(17*e,3)>h)continue;const o=(.5+1.5*vt(31*e,7))*l,r=vt(13*e,11)*E,a=Math.floor((n*o*7+r)%E),s=e*u;for(let o=0;o<=f;o++){const r=a-(f-o);if(r<0||r>=p)continue;const c=r*g,l=vt(53*e+Math.floor(5*n+o),7*r),h=i[Math.floor(l*i.length)],m=o/f;if(o===f)t.fillStyle=`rgba(${w},${y},${S},${d?.7:.85})`;else{const e=d?.85*m:.15*m;t.fillStyle=`rgba(${x},${v},${b},${e})`}t.fillText(h,s,c)}}}function $t(t,e,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,m=c??(d?"#6b8700":"#d4ff00");t.clearRect(0,0,e,o),t.textBaseline="middle",t.textAlign="center";const u=e*(.2+.6*r.x),g=o*(.2+.6*r.y),M=.65*Math.sqrt(e*e+o*o);let p=255,x=255,v=255;if(d&&(p=55,x=55,v=55),l){const t=Mt(l);t&&(p=t.r,x=t.g,v=t.b)}let b=212,w=255,y=0;const S=Mt(m);S&&(b=S.r,w=S.g,y=S.b);const $=s.replace(/ /g,"").split("");if(0!==$.length){for(let r=0;r<f;r++){const a=vt(17*r,3)*Math.PI*2,s=(n*(.15+.85*vt(31*r,7))*h*.22+vt(13*r,11))%1,c=u+Math.cos(a)*s*M,l=g+Math.sin(a)*s*M;if(c<-20||c>e+20||l<-20||l>o+20)continue;const f=Math.max(6,i*(.4+.9*s));t.font=`${f}px monospace`;const m=$[Math.min($.length-1,Math.floor(s*$.length))],S=s>.72,E=d?.85*s:.2*s;t.fillStyle=S?`rgba(${b},${w},${y},${Math.min(d?.92:.32,2.2*E)})`:`rgba(${p},${x},${v},${E})`,t.fillText(m,c,l)}t.textAlign="left"}}function Et(t,e,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:m=!1}=a,u=c??(m?"#007a5e":"#00ffcc");t.clearRect(0,0,e,o),t.textBaseline="middle",t.textAlign="center";const g=e*r.x,M=o*r.y,p=1.6*Math.sqrt(g*g+M*M)+.2*Math.sqrt(e*e+o*o);let x=255,v=255,b=255;if(m&&(x=55,v=55,b=55),l){const t=Mt(l);t&&(x=t.r,v=t.g,b=t.b)}let w=0,y=255,S=204;const $=Mt(u);$&&(w=$.r,y=$.g,S=$.b);const E=s.replace(/ /g,"").split("");if(0===E.length)return;const C=Math.ceil(e/i),T=Math.ceil(o/i);for(let e=0;e<T;e++)for(let o=0;o<C;o++){const r=o*i+.5*i,a=e*i+.5*i,s=r-g,c=a-M,l=Math.sqrt(s*s+c*c)/p;let u=0;for(let t=0;t<h;t++){const e=(n*f*.38+t/h)%1,o=Math.abs(l-e),r=Math.max(0,1-o*p/(i*(12-d)));u+=Math.cos(r*Math.PI*.5)*r}if(u=Math.min(1,u),u<.02)continue;const $=u>.6;t.font=`${i}px monospace`;const C=Math.floor(u*(E.length-1)),T=E[Math.min(C,E.length-1)],A=m?.88*u:.22*u;t.fillStyle=$?`rgba(${w},${y},${S},${Math.min(m?.95:.4,.55*u)})`:`rgba(${x},${v},${b},${A})`,t.fillText(T,r,a)}t.textAlign="left"}function Ct(t,e,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:m=.78,mouseWarp:u=.3,lightMode:g=!1}=a,M=c??(g?"#6b8700":"#d4ff00"),p=.62*i,x=1.4*i,v=Math.ceil(e/p),b=Math.ceil(o/x);t.clearRect(0,0,e,o),t.font=`${i}px monospace`,t.textBaseline="top";let w=255,y=255,S=255;if(g&&(w=55,y=55,S=55),l){const t=Mt(l);t&&(w=t.r,y=t.g,S=t.b)}let $=212,E=255,C=0;const T=Mt(M);T&&($=T.r,E=T.g,C=T.b);const A=.035*d,F=n*f,k=Math.min(6,Math.max(1,h)),I=(t,e)=>{let o=0,n=.5,r=1,a=0;for(let i=0;i<k;i++)o+=bt(t*r,e*r)*n,a+=n,n*=.5,r*=2.1;return o/a};for(let e=0;e<b;e++)for(let o=0;o<v;o++){const n=o*A+.06*F,a=e*A*1.3-.04*F,i=o/v-r.x,c=e/b-r.y,l=Math.sqrt(i*i+c*c),h=u>0?.12*Math.max(0,1-l/u):0,f=.5*I(n+h*Math.sin(1.3*F+8*c),a+h*Math.cos(.9*F+8*i))+.5;if(f<.12)continue;const d=s[Math.floor(f*(s.length-1))];if(" "===d)continue;const M=f>m,T=g?.82*f:.13*f;t.fillStyle=M?`rgba(${$},${E},${C},${g?.92:.28})`:`rgba(${w},${y},${S},${T})`,t.fillText(d,o*p,e*x)}}function Tt(t,e,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:m=!0,lightMode:u=!1}=a,g=c??(u?"#6b8700":"#d4ff00"),M=.62*i,p=1.4*i,x=Math.ceil(e/M),v=Math.ceil(o/p);t.clearRect(0,0,e,o),t.font=`${i}px monospace`,t.textBaseline="top";let b=255,w=255,y=255;if(u&&(b=55,w=55,y=55),l){const t=Mt(l);t&&(b=t.r,w=t.g,y=t.b)}let S=212,$=255,E=0;const C=Mt(g);C&&(S=C.r,$=C.g,E=C.b);const T=n*f;for(let e=0;e<v;e++)for(let o=0;o<x;o++){const n=e/v,a=((n*h-.5*T)%1+1)%1,i=Math.max(0,1-a/d),c=.35*(.5*vt(3*o,7*e)+.5);let l=0;if(m){const t=o/x-r.x,a=n-r.y,i=Math.sqrt(t*t+a*a);if(i<.18){const t=vt(11*o+Math.floor(12*T),5*e);l=Math.max(0,1-i/.18)*(t>.5?t-.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))],C=i>.55,A=u?.82*f:.12*f;t.fillStyle=C?`rgba(${S},${$},${E},${u?.92:.28})`:`rgba(${b},${w},${y},${A})`,t.fillText(g,o*M,e*p)}}function At(t,e,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:m=.2,lightMode:u=!1}=a,g=l??(u?"#6b8700":"#d4ff00"),M=.62*i,p=1.4*i,x=Math.ceil(e/M),v=Math.ceil(o/p);t.clearRect(0,0,e,o),t.font=`${i}px monospace`,t.textBaseline="top";let b=255,w=255,y=255;if(u&&(b=55,w=55,y=55),c){const t=Mt(c);t&&(b=t.r,w=t.g,y=t.b)}let S=212,$=255,E=0;const C=Mt(g);C&&(S=C.r,$=C.g,E=C.b);const T=n*h,A=[];for(let t=0;t<f;t++){const e=vt(17*t,31*t+7),o=vt(23*t+5,11*t);A.push({fx:.8+2.2*e,fy:1.2+1.8*o,phase:e*Math.PI*4,dt:(.3+.5*vt(7*t,13*t+3))*(t%2==0?1:-1),amp:.55+.45*vt(29*t,3*t)})}for(let e=0;e<v;e++){const o=e/v;for(let n=0;n<x;n++){const a=n/x,i=a-r.x,c=o-r.y,l=Math.sqrt(i*i+c*c),h=m*Math.exp(-l*l/.06),g=a+i*h,v=o+c*h;let C=0,F=0;for(let t=0;t<f;t++){const{fx:e,fy:o,phase:n,dt:r,amp:a}=A[t];C+=Math.sin(g*e*Math.PI*2+T*r+n)*Math.cos(v*o*Math.PI*2+T*r*.7+1.3*n)*a,F+=a}const k=C/F,I=.5+.5*Math.tanh(k*d*2.2);if(I<.12)continue;const R=(I-.12)/.88,L=s[Math.min(s.length-1,Math.floor(R*s.length))],P=I>.82,B=u?.82*I:.14*I;t.fillStyle=P?`rgba(${S},${$},${E},${u?.92:.32})`:`rgba(${b},${w},${y},${B})`,t.fillText(L,n*M,e*p)}}}function Ft(t,e,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"),m=.62*a,u=1.4*a,g=Math.ceil(e/m),M=Math.ceil(o/u);t.clearRect(0,0,e,o),t.font=`${a}px monospace`,t.textBaseline="top";let p=255,x=255,v=255;if(f&&(p=55,x=55,v=55),i){const t=Mt(i);t&&(p=t.r,x=t.g,v=t.b)}let b=212,w=255,y=0;const S=Mt(d);S&&(b=S.r,w=S.g,y=S.b);const $=n*c,E=["─","─","╌","·","╌","─","─","╌","·"];for(let e=0;e<M;e++){const o=e/M;for(let n=0;n<g;n++){const r=n/g;let a=0,i=0;for(let t=0;t<l;t++){const e=vt(13*t,7*t+3),n=1.1+2.4*e,s=.9+2*vt(29*t,11*t+1),c=e*Math.PI*6,l=(.2+.5*vt(41*t,17*t))*(t%2==0?1:-1.3),f=Math.sin(r*n*Math.PI*2+$*l+c),d=Math.cos(o*s*Math.PI*2+$*l*.6+1.7*c),m=Math.sin(r*s*Math.PI*h+o*n*Math.PI*h+$*l*.4);a+=Math.atan2(d+.3*m,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=E[Math.floor(d*E.length)%E.length],S=c>.8,C=f?.8*c:.13*c;t.fillStyle=S?`rgba(${b},${w},${y},${f?.9:.26})`:`rgba(${p},${x},${v},${C})`,t.fillText(M,n*m,e*u)}}}function kt(t,e,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:m=!1}=a,u=l??(m?"#6b8700":"#d4ff00"),g=.62*i,M=1.4*i,p=Math.ceil(e/g),x=Math.ceil(o/M),v=e/o;t.clearRect(0,0,e,o),t.font=`${i}px monospace`,t.textBaseline="top";let b=255,w=255,y=255;if(m&&(b=55,w=55,y=55),c){const t=Mt(c);t&&(b=t.r,w=t.g,y=t.b)}let S=212,$=255,E=0;const C=Mt(u);C&&(S=C.r,$=C.g,E=C.b);const T=n*h;for(let e=0;e<x;e++){const o=e/x;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=vt(3*n,7*e)*Math.max(0,1-3*(c-1));if(o<.62)continue;const r=o*(m?.28:.04);t.fillStyle=`rgba(${b},${w},${y},${r})`,t.fillText(s[1],n*g,e*M);continue}const l=Math.max(0,1-Math.abs(c-(.15+.12*Math.sin(1.1*T)))/.07),h=Math.pow(1-c,2.2),d=Math.min(1,h+.6*l);if(d<.06)continue;const u=Math.floor(d*(s.length-1)),x=s[Math.min(s.length-1,u)],C=l>.35||c<.08,A=m?.85*d:.18*d;t.fillStyle=C?`rgba(${S},${$},${E},${m?.95:.38})`:`rgba(${b},${w},${y},${A})`,t.fillText(x,n*g,e*M)}}}function It(t,e,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"),m=.62*a,u=1.4*a,g=Math.ceil(e/m),M=Math.ceil(o/u);t.clearRect(0,0,e,o),t.font=`${a}px monospace`,t.textBaseline="top";let p=255,x=255,v=255;if(f&&(p=55,x=55,v=55),s){const t=Mt(s);t&&(p=t.r,x=t.g,v=t.b)}let b=212,w=255,y=0;const S=Mt(d);S&&(b=S.r,w=S.g,y=S.b);const $=n*l,E=Array.from({length:h},(t,e)=>1/(e+1)).reduce((t,e)=>t+e,0);for(let e=0;e<M;e++)for(let o=0;o<g;o++){let n=0;for(let t=0;t<h;t++){const r=.18+1.4*vt(o*(t+3)+7,e*(t+5)+11),a=vt(o*(t+7),e*(t+9)+3)*Math.PI*2,i=1/(t+1);n+=Math.sin($*r+a)*i}const r=.5*(n/E+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;t.fillStyle=c?`rgba(${b},${w},${y},${f?.92:.28})`:`rgba(${p},${x},${v},${l})`,t.fillText(s,o*m,e*u)}}function Rt(t,e,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,m=.62*a,u=1.4*a,g=Math.ceil(e/m),M=Math.ceil(o/u),p=g*M,x="__fire_heat__",v=t.canvas;let b=v[x];b&&b.length===p||(b=new Float32Array(p),v[x]=b);const w=.18*(.016*f),y=h*f*.8,S=M-1,$=n*f;for(let t=0;t<g;t++){const e=(.6*(.5*Math.sin(.31*t+4.1*$)+.5)+.4*(.5*Math.sin(.73*t-2.7*$)+.5))*l;b[S*g+t]=Math.min(1,e+.15*Math.random()*l),S>0&&(b[(S-1)*g+t]=Math.min(1,.85*e+.1*Math.random()*l))}const E=new Float32Array(p);for(let t=0;t<M-2;t++)for(let e=0;e<g;e++){const o=.4*b[(t+1)*g+e]+.25*b[(t+2)*g+Math.max(0,Math.min(g-1,e+Math.round(y)))]+.175*b[(t+1)*g+Math.max(0,e-1)]+.175*b[(t+1)*g+Math.min(g-1,e+1)];E[t*g+e]=Math.max(0,o-w-.02*Math.random()*f)}for(let t=0;t<g;t++)E[(M-1)*g+t]=b[(M-1)*g+t],M>1&&(E[(M-2)*g+t]=b[(M-2)*g+t]);v[x]=E;const C=Mt(s)??{r:255,g:69,b:0},T=Mt(c)??{r:255,g:224,b:102};t.clearRect(0,0,e,o),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";for(let e=0;e<M;e++)for(let o=0;o<g;o++){const n=E[e*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=C.r+(T.r-C.r)*a|0,c=C.g+(T.g-C.g)*a|0,l=C.b+(T.b-C.b)*a|0,h=d?1-.3*n:Math.min(1,n+.15);t.globalAlpha=h,t.fillStyle=`rgb(${s},${c},${l})`,t.fillText(r,o*m,e*u)}t.globalAlpha=1}function Lt(t,e,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:m=!1}=r,u=.62*a,g=1.4*a,M=Math.ceil(e/u),p=Math.ceil(o/g),x=d??Math.max(1,Math.floor(e/80)),v=M/x,b=Mt(c)??{r:0,g:229,b:255},w=Mt(l)??{r:255,g:64,b:129},y=Mt(h)??{r:136,g:255,b:204};t.clearRect(0,0,e,o),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";const S=n*f,$=.35*v;for(let e=0;e<x;e++){const o=v*(e+.5);for(let n=0;n<p;n++){const r=n/p*Math.PI*6-1.8*S,a=o+Math.sin(r)*$,c=o+Math.sin(r+Math.PI)*$,l=Math.round(a),h=Math.round(c);if(l<0||l>=M)continue;const f=vt(31*e+7*n,3),d=i[Math.floor(f*i.length)],m=.5*(Math.sin(r)+1),x=.5*(Math.sin(r+Math.PI)+1);if(t.globalAlpha=.35+.65*m,t.fillStyle=`rgb(${b.r},${b.g},${b.b})`,t.fillText(d,l*u,n*g),h>=0&&h<M){const o=vt(53*e+11*n,7),r=i[Math.floor(o*i.length)];t.globalAlpha=.35+.65*x,t.fillStyle=`rgb(${w.r},${w.g},${w.b})`,t.fillText(r,h*u,n*g)}if(n%3===0){const o=Math.min(l,h),r=Math.max(l,h);if(r-o>1){const a=vt(17*n+43*e,5),i=s[Math.floor(a*s.length)],c=.25*(m+x)+.2;t.globalAlpha=c,t.fillStyle=`rgb(${y.r},${y.g},${y.b})`;for(let e=o+1;e<r;e++)t.fillText(i,e*u,n*g)}}}}t.globalAlpha=1}function Pt(t,e,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:m=!0,lightMode:u=!1}=r,g=.62*a,M=1.4*a,p=Math.ceil(e/g),x=Math.ceil(o/M),v=Mt(s)??{r:76,g:175,b:80},b=Mt(c)??{r:26,g:35,b:126},w=Mt(l)??{r:224,g:224,b:224};t.clearRect(0,0,e,o),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";const y=n*h*.4,S=new Array(p);for(let t=0;t<p;t++){const e=(.5*wt((t/p+y)*f*3,.5)+.5)*d;S[t]=Math.floor(e*x)}for(let e=0;e<x;e++)for(let o=0;o<p;o++){const r=x-1-S[o],a=e===r;if(!(e>=r)){if(m){const r=vt(7*o+Math.floor(.3*y),13*e);if(r>.97){const a=.3*Math.sin(2*n+100*r)+.7;t.globalAlpha=.5*a,t.fillStyle=`rgb(${b.r+60},${b.g+60},${b.b+80})`,t.fillText("·",o*g,e*M)}}continue}const s=(e-r)/Math.max(1,S[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;t.globalAlpha=.5+.5*s,t.fillStyle=`rgb(${h},${f},${d})`,t.fillText(a?i[i.length-1]:c,o*g,e*M)}t.globalAlpha=1}var Bt=1,zt=2,Ht=4,Wt=8,qt={3:"─",12:"│",9:"┌",10:"┐",5:"└",6:"┘",11:"┬",7:"┴",13:"├",14:"┤",15:"┼",[Bt]:"╶",[zt]:"╴",[Ht]:"╵",[Wt]:"╷"};function jt(t,e,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,m=Math.ceil(e/f),u=Math.ceil(o/d),g=Mt(s)??{r:0,g:255,b:136},M=Mt(i)??{r:255,g:255,b:255},p=(t,e)=>{if(vt(17*t+1,7*e+2)>c)return 0;let o=0;return t+1<m&&vt(17*t+1,7*e+2)>.15&&(o|=1),t-1>=0&&vt(17*(t-1)+1,7*e+2)>.15&&(o|=2),e+1<u&&vt(17*t+1,7*(e+1)+2)>.15&&(o|=8),e-1>=0&&vt(17*t+1,7*(e-1)+2)>.15&&(o|=4),o};t.clearRect(0,0,e,o),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";const x=n*l;for(let e=0;e<u;e++)for(let o=0;o<m;o++){const n=p(o,e);if(0===n)continue;const r=qt[n]??"·",a=(8*x+40*vt(o,23*e))%m,i=(6*x+40*vt(17*e,11*o))%u,s=(1&n||2&n)&&Math.abs(o-a)<1.5,c=(4&n||8&n)&&Math.abs(e-i)<1.5,l=s||c,h=.25+.35*vt(3*o,5*e);l?(t.globalAlpha=.95,t.fillStyle=`rgb(${M.r},${M.g},${M.b})`):(t.globalAlpha=h,t.fillStyle=`rgb(${g.r},${g.g},${g.b})`),t.fillText(r,o*f,e*d)}t.globalAlpha=1}function Ot(t,e={}){const{type:o="wave",opacity:n=.2,className:r,zIndex:a=0,colorScheme:i="auto",color:s,...c}=e,l="string"==typeof t?document.querySelector(t):t;if(!l)return console.warn("[asciify] asciiBackground: target not found",t),{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"),m=window.devicePixelRatio||1,u={x:.5,y:.5},g={x:.5,y:.5},M=()=>"light"===i||"dark"!==i&&(()=>{let t=l;for(;t&&t!==document.documentElement.parentElement;){const e=getComputedStyle(t).backgroundColor;if(e&&"transparent"!==e&&"rgba(0, 0, 0, 0)"!==e){const t=e.match(/rgba?\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)/);if(t)return(.299*+t[1]+.587*+t[2]+.114*+t[3])/255>=.4}t=t.parentElement}const e=document.documentElement,o=(e.getAttribute("data-theme")||"").toLowerCase();return"dark"!==o&&("light"===o||!e.classList.contains("dark")&&window.matchMedia("(prefers-color-scheme: light)").matches)})(),p=s?function(t){const e=t.match(/^#([0-9a-f]{3,8})$/i)?.[1];if(e){const t=e.length<=4?e.split("").map(t=>parseInt(t+t,16)):[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)];return{r:t[0],g:t[1],b:t[2]}}const o=t.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);return o?{r:+o[1],g:+o[2],b:+o[3]}:null}(s):null,x=()=>({...c,lightMode:void 0!==c.lightMode?c.lightMode:M(),baseColor:p?`rgba(${p.r},${p.g},${p.b},{a})`:c.baseColor}),v={current:x()},b=()=>{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()}:x()};b();const w=window.matchMedia("(prefers-color-scheme: light)"),y=()=>{b()};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 t=l.getBoundingClientRect();f.width=t.width*m,f.height=t.height*m,d.setTransform(m,0,0,m,0,0)};$();const E=t=>{const e=l.getBoundingClientRect();u.x=(t.clientX-e.left)/e.width,u.y=(t.clientY-e.top)/e.height},C=new ResizeObserver($);C.observe(l),window.addEventListener("mousemove",E);let T=0,A=0;const F=()=>{g.x+=.07*(u.x-g.x),g.y+=.07*(u.y-g.y);const t=l.getBoundingClientRect();"rain"===o?St(d,t.width,t.height,T,v.current):"stars"===o?$t(d,t.width,t.height,T,g,v.current):"pulse"===o?Et(d,t.width,t.height,T,g,v.current):"noise"===o?Ct(d,t.width,t.height,T,g,v.current):"grid"===o?Tt(d,t.width,t.height,T,g,v.current):"aurora"===o?At(d,t.width,t.height,T,g,v.current):"silk"===o?Ft(d,t.width,t.height,T,v.current):"void"===o?kt(d,t.width,t.height,T,g,v.current):"morph"===o?It(d,t.width,t.height,T,v.current):"fire"===o?Rt(d,t.width,t.height,T,v.current):"dna"===o?Lt(d,t.width,t.height,T,v.current):"terrain"===o?Pt(d,t.width,t.height,T,v.current):"circuit"===o?jt(d,t.width,t.height,T,v.current):yt(d,t.width,t.height,T,g,v.current),T+=.016,A=requestAnimationFrame(F)};return A=requestAnimationFrame(F),{destroy:()=>{cancelAnimationFrame(A),C.disconnect(),"auto"===i&&(w.removeEventListener("change",y),S?.disconnect()),window.removeEventListener("mousemove",E),f.remove(),l.style.position=h}}}var Nt=Ot;function Vt(t,e,o,n="#505050",r=100){if(!t||e<=0||o<=0)return[];const a=Mt(n)??{r:80,g:80,b:80},i=t,s=i.length;return Array.from({length:o},(t,o)=>Array.from({length:e},(t,n)=>({char:i[(o*e+n)%s],r:a.r,g:a.g,b:a.b,a:r})))}var Ut=new WeakMap;function Dt(t,{format:e="png",quality:o=.92,scale:n=1}={}){return new Promise((r,a)=>{let i=t;if(1!==n){const e=document.createElement("canvas");e.width=Math.round(t.width*n),e.height=Math.round(t.height*n);const o=e.getContext("2d");if(!o)return void a(new Error("captureSnapshot: could not get 2d context"));o.drawImage(t,0,0,e.width,e.height),i=e}i.toBlob(t=>t?r(t):a(new Error("captureSnapshot: toBlob returned null")),`image/${e}`,o)})}var _t={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]},Kt=[127,65,65,65,65,65,127];function Yt(t){return _t[t]??_t[t.toUpperCase()]??Kt}function Gt(t,e={}){if(!t)return"";const{char:o="█",scale:n=1}=e,r=[...o][0]??"█",a=Math.max(1,Math.floor(n)),i=7*a,s=a,c=Array.from({length:i},()=>"");for(let e=0;e<t.length;e++){const o=Yt(t[e]);for(let t=0;t<7;t++){const e=o[t];let n="";for(let t=6;t>=0;t--)n+=(e>>t&1?r:" ").repeat(a);for(let e=0;e<a;e++)c[t*a+e]+=n}if(e<t.length-1)for(let t=0;t<i;t++)c[t]+=" ".repeat(s)}return c.join("\n")}exports.ART_STYLE_PRESETS=o,exports.BACKGROUND_TYPES=["wave","rain","stars","pulse","noise","grid","aurora","silk","void","morph","fire","dna","terrain","circuit"],exports.CHARSETS=t,exports.CHARSET_SEQUENCES=e,exports.DEFAULT_OPTIONS=r,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:"Fluid trail",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=n,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=Ot,exports.asciiText=function(t,e={},o,n){const a={...r,...e},{frame:i,cols:s}=j(t,a,o,n);if(!i.length||0===s)return"";const c=[];for(const t of i)c.push(t.map(t=>t.char).join(""));return c.join("\n")},exports.asciiTextAnsi=function(t,e={},o,n){const a={...r,...e},{frame:i,cols:s}=j(t,a,o,n);if(!i.length||0===s)return"";const c=[];for(const t of i){let e="";for(const o of t)" "===o.char||o.a<10?e+=" ":e+=`[38;2;${o.r};${o.g};${o.b}m${o.char}[0m`;c.push(e)}return c.join("\n")},exports.asciify=async function(t,e,{fontSize:n,artStyle:a="classic",options:i={}}={}){let s;if("string"==typeof t){const e=new Image;e.crossOrigin="anonymous",await new Promise((o,n)=>{e.onload=()=>o(),e.onerror=()=>n(new Error(`Failed to load image: ${t}`)),e.src=t}),s=e}else t instanceof HTMLImageElement&&!t.complete?(await new Promise((e,o)=>{t.onload=()=>e(),t.onerror=()=>o(new Error("Image failed to load"))}),s=t):s=t;const c=o[a],l=n??i.fontSize??10,h={...r,...c,artStyle:a,...i,fontSize:l},f=e.getContext("2d");if(!f)throw new Error("Could not get 2d context from canvas");const{w:d,h:m}=function(t){return t instanceof HTMLVideoElement?{w:t.videoWidth,h:t.videoHeight}:t instanceof HTMLImageElement?{w:t.naturalWidth||t.width,h:t.naturalHeight||t.height}:{w:t.width,h:t.height}}(s),{renderW:u,renderH:g}=ft(d,m),M="undefined"!=typeof window&&window.devicePixelRatio||1,p=8e6,x=u*M*g*M>p?Math.sqrt(p/(u*g)):M;e.width===Math.round(u*x)&&e.height===Math.round(g*x)||(e.width=Math.round(u*x),e.height=Math.round(g*x));const{frame:v}=j(s,h,u,g),b=(t,e)=>{f.save(),f.setTransform(x,0,0,x,0,0),G(f,v,h,u,g,t/1e3,e),f.restore()};return b(0,null),S(e,b,{continuous:"none"!==h.animationStyle||!!h.charsetFrames?.length,interactive:h.hoverStrength>0}).stop},exports.asciifyGif=async function(t,e,{fontSize:n,artStyle:a="classic",options:i={}}={}){const s="string"==typeof t?await fetch(t).then(t=>t.arrayBuffer()):t,c=n??i.fontSize??10;let l={...r,...o[a],artStyle:a,...i,fontSize:c};const h=e.getContext("2d");if(!h)throw new Error("Could not get 2d context from canvas");const{frames:f,fps:d}=await D(s,l,e.width,e.height);if(!f.length)throw new Error("asciifyGif: the GIF contains no renderable frames.");const m=performance.now();let u=-1;return S(e,(t,o)=>{const n=Math.floor((t-m)*d/1e3)%f.length;n===u&&!o&&l.hoverStrength<=0&&"none"===l.animationStyle&&!l.charsetFrames?.length||(G(h,f[n],l,e.width,e.height,(t-m)/1e3,o),u=n)},{continuous:!0,interactive:l.hoverStrength>0}).stop},exports.asciifyLiveVideo=function(t,e,o){return gt(t,e,o)},exports.asciifyText=Gt,exports.asciifyVideo=gt,exports.asciifyWebcam=async function(t,{fontSize:e=10,style:n="classic",options:a={},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((t,e)=>{f.onloadedmetadata=()=>t(),f.onerror=()=>e(new Error("asciifyWebcam: video stream failed to load.")),f.play().catch(e)});const d={...r,...o[n],...a,fontSize:e},m=t.getContext("2d");if(!m)throw new Error("asciifyWebcam: could not get 2d context from canvas.");const u=l??("undefined"!=typeof window?window.devicePixelRatio:1)??1;1!==u&&m.scale(u,u);let g=null;const M=e=>{const o=t.getBoundingClientRect();g={x:(e.clientX-o.left)/o.width,y:(e.clientY-o.top)/o.height}},p=()=>{g=null};d.hoverStrength>0&&(t.addEventListener("mousemove",M),t.addEventListener("mouseleave",p));let x,v=!1;const b=performance.now(),w=e=>{if(!v){if(f.readyState>=f.HAVE_CURRENT_DATA){const o=t.width/u,n=t.height/u,r=(e-b)/1e3,a=i?{...d,...i()}:d;a.hoverStrength>0?(t.addEventListener("mousemove",M),t.addEventListener("mouseleave",p)):(t.removeEventListener("mousemove",M),t.removeEventListener("mouseleave",p));const{frame:c}=j(f,a,o,n),l=g&&s?{x:1-g.x,y:g.y}:g;s?(m.save(),m.scale(-1,1),m.translate(-o,0),G(m,c,a,o,n,r,l),m.restore()):G(m,c,a,o,n,r,l)}x=requestAnimationFrame(w)}};return x=requestAnimationFrame(w),()=>{v=!0,cancelAnimationFrame(x),t.removeEventListener("mousemove",M),t.removeEventListener("mouseleave",p),h.getTracks().forEach(t=>t.stop()),f.srcObject=null}},exports.buildTextFrame=Vt,exports.captureSnapshot=Dt,exports.clearAsciifyCaches=function(){T.clear(),A.clear(),_=new WeakMap,Y=new WeakMap,K=new WeakMap,$=null,E=null},exports.computeCanvasRenderSize=dt,exports.createVideoScrollScrub=rt,exports.gifToAsciiFrames=D,exports.gifToAsciiTextFrames=async function(t,e,o,n,r){const{parseGIF:a,decompressFrames:i}=await import("gifuct-js"),s=a(t),c=i(s,!0);if(0===c.length)return{frames:[],cols:0,rows:0,fps:10};const l=c[0].dims.width,h=c[0].dims.height,f=s.lsd?.width||l,d=s.lsd?.height||h,m=document.createElement("canvas");m.width=f,m.height=d;const u=m.getContext("2d"),g=document.createElement("canvas");g.width=f,g.height=d;const M=g.getContext("2d"),p=document.createElement("canvas"),x=p.getContext("2d"),v=[];let b=0,w=0,y=0;for(const t of c)y+=t.delay||100;const S=y/c.length,$=Math.round(Math.min(30,Math.max(5,1e3/S))),E=Math.min(c.length,300);for(let t=0;t<E;t++){const a=c[t],{dims:i,patch:s,disposalType:l}=a;3===l&&(M.clearRect(0,0,f,d),M.drawImage(m,0,0)),p.width!==i.width&&(p.width=i.width),p.height!==i.height&&(p.height=i.height);const h=new ImageData(new Uint8ClampedArray(s.buffer),i.width,i.height);x.putImageData(h,0,0),u.drawImage(p,i.left||0,i.top||0);const y=O(m,e,o,n);v.push(y),b=y.cols,w=y.rowCount,2===l?u.clearRect(i.left||0,i.top||0,i.width,i.height):3===l&&(u.clearRect(0,0,f,d),u.drawImage(g,0,0)),r?.((t+1)/E)}return{frames:v,cols:b,rows:w,fps:$}},exports.imageToAsciiFrame=j,exports.imageToAsciiTextFrame=O,exports.mountWaveBackground=Nt,exports.renderAuroraBackground=At,exports.renderCircuitBackground=jt,exports.renderDnaBackground=Lt,exports.renderFireBackground=Rt,exports.renderFrameToCanvas=G,exports.renderGridBackground=Tt,exports.renderMorphBackground=It,exports.renderNoiseBackground=Ct,exports.renderPulseBackground=Et,exports.renderRainBackground=St,exports.renderSilkBackground=Ft,exports.renderStarsBackground=$t,exports.renderTerrainBackground=Pt,exports.renderTextBackground=function(t,e,o,n,a={},i){const{fontSize:s=10,lineHeight:c=1.6,color:l="#505050",opacity:h=100,hoverEffect:f="spotlight",hoverStrength:d=.85,hoverRadius:m=.18,hoverColor:u="#d4ff00"}=a,g=Math.max(1,Math.floor(e/s)),M=Math.max(1,Math.floor(o/(s*c))),p=JSON.stringify([n,g,M,l,h]);let x=Ut.get(t);x&&x.key===p||(x={key:p,frame:Vt(n,g,M,l,h)},Ut.set(t,x)),G(t,x.frame,{...r,fontSize:s,hoverEffect:f,hoverStrength:d,hoverRadius:m,hoverColor:u},e,o,0,i??null)},exports.renderTextFrameToCanvas=N,exports.renderTextToCanvas=function(t,e,o={}){const{color:n="#d4ff00",bgColor:r,fontSize:a=10}=o,i=Gt(e,o);if(!i)return;const s=i.split("\n"),c=Math.max(...s.map(t=>[...t].length));t.width=Math.ceil(c*a*.6),t.height=Math.ceil(s.length*a);const l=t.getContext("2d");r&&"transparent"!==r?(l.fillStyle=r,l.fillRect(0,0,t.width,t.height)):l.clearRect(0,0,t.width,t.height),l.fillStyle=n,l.font=`${a}px monospace`,l.textBaseline="top",s.forEach((t,e)=>l.fillText(t,0,e*a))},exports.renderVoidBackground=kt,exports.renderWaveBackground=yt,exports.snapshotAndDownload=async function(t,e={}){const{filename:o="asciify-snapshot",format:n="png",...r}=e,a=await Dt(t,{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=V,exports.videoToAsciiTextFrames=U;//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";var e={standard:" .:-=+*#%@",blocks:" ░▒▓█",minimal:" .:+",dense:" .'`^\",:;Il!i><~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$",binary:"01",dots:" ⠁⠃⠇⡇⣇⣧⣷⣿",letters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",claudeCode:" ╔╗╚╝║═╠╣╦╩╬░▒▓█│─┌┐└┘├┤┬┴┼",box:" ▪◾◼■█",lines:" ˗‐–—―━",braille:" ⠁⠂⠃⠄⠅⠆⠇⠈⠉⠊⠋⠌⠍⠎⠏⠐⠑⠒⠓⠔⠕⠖⠗⠘⠙⠚⠛⠜⠝⠞⠟⠠⠡⠢⠣⠤⠥⠦⠧⠨⠩⠪⠫⠬⠭⠮⠯⠰⠱⠲⠳⠴⠵⠶⠷⠸⠹⠺⠻⠼⠽⠾⠿⡀⡁⡂⡃⡄⡅⡆⡇⣀⣁⣂⣃⣄⣅⣆⣇⣈⣉⣊⣋⣌⣍⣎⣏⣐⣑⣒⣓⣔⣕⣖⣗⣘⣙⣚⣛⣜⣝⣞⣟⣠⣡⣢⣣⣤⣥⣦⣧⣨⣩⣪⣫⣬⣭⣮⣯⣰⣱⣲⣳⣴⣵⣶⣷⣸⣹⣺⣻⣼⣽⣾⣿",katakana:" ヲァィゥェォャュョッアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン",circles:" .·:∘○◦°•∙",shadows:" ·∘◦○◎⊙●◉",geometric:" ·△▷◇◈◆▣■█",pipes:" ╶─┐└├┤┬┴┼╬▒▓█",waves:" ˜∼≈〰≋∿∾∭∫",shards:" ╱╲╳◤◥◣◢△▲◆◼█",smoke:" ·˙⁚⁖∶∷⋮⋰⋱∴∵",ascii:" .'`^\",:;~-_+<>i!lI?/\\|()[]{}1tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$",interface:" ·•-–—+=:;<>[]{}()⌘⌥⇧⌃↵↗↘◇◆◈□■",prompt:" .:;>_`/\\|{}[]()=+*#@$",data:" ·∙•◦○●◇◆◈▱▰▣█",humanist:" ·˙,:;∴∵∷∶⁚⋮⋯∼≈≋∞",mesh:" ·╶╴╷╵─│┌┐└┘├┤┬┴┼╬░▒▓█"},t={cosmic:[e.smoke,e.circles,e.shadows],rain:[e.katakana,e.braille,e.binary],terminal:[e.pipes,e.claudeCode,e.standard],crystal:[e.shards,e.geometric,e.blocks],fluid:[e.waves,e.smoke,e.circles],pulse:[e.dense,e.standard,e.blocks],dream:[e.braille,e.shadows,e.smoke],angular:[e.geometric,e.shards,e.blocks],assistant:[e.interface,e.prompt,e.data],signal:[e.mesh,e.data,e.ascii],editorial:[e.humanist,e.waves,e.smoke]},o={classic:{renderMode:"ascii",charset:e.standard,colorMode:"grayscale"},particles:{renderMode:"dots",colorMode:"fullcolor",dotSizeRatio:.8},letters:{renderMode:"ascii",charset:e.letters,colorMode:"fullcolor"},claudeCode:{renderMode:"ascii",charset:e.claudeCode,colorMode:"accent",accentColor:"#f97316"},art:{renderMode:"ascii",charset:e.dense,colorMode:"fullcolor"},terminal:{renderMode:"ascii",charset:e.standard,colorMode:"matrix"},box:{renderMode:"ascii",charset:e.box,colorMode:"grayscale"},lines:{renderMode:"ascii",charset:e.lines,colorMode:"fullcolor"},braille:{renderMode:"ascii",charset:e.braille,colorMode:"fullcolor"},katakana:{renderMode:"ascii",charset:e.katakana,colorMode:"matrix"},circles:{renderMode:"ascii",charset:e.circles,colorMode:"accent",accentColor:"#d4ff00"},shadows:{renderMode:"ascii",charset:e.shadows,colorMode:"accent",accentColor:"#50a0ff"},geometric:{renderMode:"ascii",charset:e.geometric,colorMode:"grayscale"},pipes:{renderMode:"ascii",charset:e.pipes,colorMode:"accent",accentColor:"#00ff88"},waves:{renderMode:"ascii",charset:e.waves,colorMode:"fullcolor"},shards:{renderMode:"ascii",charset:e.shards,colorMode:"grayscale"},smoke:{renderMode:"ascii",charset:e.smoke,colorMode:"accent",accentColor:"#c850ff"},ascii:{renderMode:"ascii",charset:e.ascii,colorMode:"grayscale"},interface:{renderMode:"ascii",charset:e.interface,colorMode:"accent",accentColor:"#f4f1ea"},prompt:{renderMode:"ascii",charset:e.prompt,colorMode:"matrix"},data:{renderMode:"ascii",charset:e.data,colorMode:"fullcolor"},humanist:{renderMode:"ascii",charset:e.humanist,colorMode:"accent",accentColor:"#d6ccc2"},mesh:{renderMode:"ascii",charset:e.mesh,colorMode:"accent",accentColor:"#8fd3ff"}},n={agentField:{...o.interface,charsetFrames:t.assistant,charsetFps:1.6,animationStyle:"caustics",animationSpeed:.75,ditherStrength:.12,hoverEffect:"glow",hoverStrength:.42,hoverRadius:.18,hoverColor:"#f4f1ea",normalize:!0},liquidSignal:{...o.data,charsetFrames:t.signal,charsetFps:2.4,animationStyle:"current",animationSpeed:.65,ditherStrength:.45,hoverEffect:"repel",hoverStrength:.55,hoverRadius:.22,hoverColor:"#8fd3ff",normalize:!0},cursorGravity:{...o.mesh,charsetFrames:t.angular,charsetFps:1.2,animationStyle:"current",animationSpeed:.9,ditherStrength:.2,hoverEffect:"attract",hoverStrength:.82,hoverRadius:.24,hoverColor:"#ffffff",normalize:!0},editorialPulse:{...o.humanist,charsetFrames:t.editorial,charsetFps:.9,animationStyle:"caustics",animationSpeed:.55,ditherStrength:.18,hoverEffect:"spotlight",hoverStrength:.35,hoverRadius:.2,hoverColor:"#fff8ea",normalize:!0},terminalFlow:{...o.prompt,charsetFrames:t.terminal,charsetFps:3,animationStyle:"reform",animationSpeed:1.1,ditherStrength:.22,hoverEffect:"glitchText",hoverStrength:.65,hoverRadius:.16,hoverColor:"#d4ff00",hoverText:["BUILD","SHIP","RUN","ASK","MODEL"],normalize:!0}},r={fontSize:7,charSpacing:1,brightness:0,contrast:0,charset:e.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,chromaKeyTrimPadding:.002,chromaKeyTrimLuminanceThreshold:0,chromaKeyTrimMode:"range"},a=[{value:"none",mode:"none",label:"Off",description:"Keep the image still. Hover stays available."},{value:"caustics",mode:"caustics",label:"Caustics",description:"Soft ribbons of light travel across a stationary character grid."},{value:"current",mode:"current",label:"Slow Current",description:"A gentle flow through the image, with steady edges."},{value:"reform",mode:"reform",label:"Reveal & Reform",description:"Disperse, gather, then hold the complete image."}];var i=(e,t,o)=>{const n=(e=>Math.max(0,Math.min(1,e)))((o-e)/(t-e));return n*n*(3-2*n)};function s(e,t,o,n,r){if(r[0]=r[1]=r[2]=0,r[3]=1,"none"===e)return r;const a=n*Math.PI/6,s=i(0,.12,Math.min(t,1-t,o,1-o));if("caustics"===e){const e=Math.sin(9*t+5*o+a)+Math.sin(8*o-3*t-a),n=Math.pow(Math.max(0,1-.72*Math.abs(e)),3);r[2]=(.22*n-.045)*s}else if("current"===e)r[0]=Math.sin(9*o+a)*Math.cos(7*t-a)*10*s,r[1]=Math.cos(8*t+a)*Math.sin(6*o-a)*7*s;else if("reform"===e){const e=(n%12+12)%12,c=((e,t)=>{const o=(.06711056*e+.00583715*t)%1*52.9829189;return o-Math.floor(o)})(Math.floor(160*t),Math.floor(100*o)),l=.65*t+.2*o+.15*c+.08*Math.sin(8*t-5*o),h=i(1.8+1.2*l,3.8+1.2*l,e)*(1-i(5+1.7*l,7.2+1.7*l,e));r[0]=Math.sin(9*o+a)*h*(1-h)*24*s,r[1]=-h*(1-h)*(8+12*c)*s,r[2]=.45*-h,r[3]=1-.9*h}return r}function c(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}}function l(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 h(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 d=[[0,8,2,10],[12,4,14,6],[3,11,1,9],[15,7,13,5]];function f(e,t,o,n){if(n<=0)return e;const r=(d[o%4][t%4]/16-.5)*n*128;return Math.max(0,Math.min(255,e+r))}var m=new Array(256),u=new Array(256);for(let e=0;e<256;e++)m[e]=`rgb(${e},${e},${e})`,u[e]=`rgb(0,${e},0)`;function g(e,t,o,n,r,a=!1){switch(t){case"fullcolor":return`rgb(${e.r},${e.g},${e.b})`;case"matrix":return u[.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 m[t]}}}var p=[0,0,0];function M(e,t,o,n,r,a=!1){switch(t){case"fullcolor":p[0]=e.r,p[1]=e.g,p[2]=e.b;break;case"matrix":{const t=.299*e.r+.587*e.g+.114*e.b|0;p[0]=0,p[1]=t,p[2]=0;break}case"accent":p[0]=o,p[1]=n,p[2]=r;break;default:{const t=.299*e.r+.587*e.g+.114*e.b|0;p[0]=t,p[1]=t,p[2]=t;break}}return p}function v(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 w(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=v(e);if(t&&t.a>.1)return t}t=t.parentElement}return null}function x(e){if(e){const t=w(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=w(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 y(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]}}function b(e){return e*e*(3-2*e)}var S={scale:1,offsetX:0,offsetY:0,glow:0,colorBlend:0,proximity:0};function E(e,t,o,n,r,a,i,s,c="spotlight",l=.5,h="circle",d=[],f=1){const m=(e-o)*Math.max(1,f),u=(t-n)*Math.max(1,1/f),g=.08+.35*l+.04*a;let p,M;if("box"===h){const e=Math.abs(m),t=Math.abs(u);p=Math.max(e,t),M=g}else p=Math.sqrt(m*m+u*u),M=g;if(p>=M&&("trail"!==c||0===d.length))return S.scale=1,S.offsetX=0,S.offsetY=0,S.glow=0,S.colorBlend=0,S.proximity=0,S;const v=b(Math.max(0,1-p/M))*r;let w=1,x=0,y=0,E=0,C=0;switch(c){case"spotlight":{w=1+v*a*1.8;const e=Math.atan2(u,m),t=v*v*a*.6;x=Math.cos(e)*t*i,y=Math.sin(e)*t*s,E=v*a*.4,C=v*v*a*.25;break}case"magnify":w=1+v*a*.85,E=v*a*.15;break;case"repel":{w=1;const e=Math.atan2(u,m),t=v*v*a*1.8;x=Math.cos(e)*t*i,y=Math.sin(e)*t*s;break}case"glow":E=v*a*.8,C=v*a*.4;break;case"colorShift":w=1,E=v*a*.12,C=v*a;break;case"attract":{const e=Math.atan2(u,m),t=v*v*a*1;x=(.45*-Math.cos(e)-1.6*Math.sin(e))*t*i,y=(.45*-Math.sin(e)+1.6*Math.cos(e))*t*s,E=v*a*.3;break}case"shatter":{const e=Math.atan2(u,m),t=.5*Math.sin(43.7*m+29.3*u),o=v*a*1.4*(.7+.3*t);x=Math.cos(e+t)*o*i,y=Math.sin(e+t)*o*s,w=Math.max(.1,1-v*a*.6),E=v*a*.25;break}case"trail":{let o=v,n=-u*v,r=m*v;for(const a of d){const i=(e-a.x)*Math.max(1,f),s=(t-a.y)*Math.max(1,1/f),c=Math.hypot(i,s)/g;if(c>=1)continue;const l=b(1-c)*a.intensity;o=Math.max(o,l),n+=(.35*a.vx-2*s)*l*.35,r+=(.35*a.vy+2*i)*l*.35}x=Math.tanh(2*n)*a*i*3,y=Math.tanh(2*r)*a*s*3,C=o*a*.65,E=o*a*.35,w=1+o*a*.08,S.proximity=o;break}case"glitchText":w=1,E=v*a*.5,C=v*a*.6}return S.scale=w,S.offsetX=x,S.offsetY=y,S.glow=E,S.colorBlend=C,"trail"!==c&&(S.proximity=v),S}function C(e,t,{continuous:o=!1,interactive:n=!1}={}){const r=e.parentElement??e;let a=null,i=0,s=!1,c=!0,l=!0,h=-1/0;const d=window.matchMedia("(prefers-reduced-motion: reduce)"),f=()=>{l=!0,s||!c||document.hidden||i||(i=requestAnimationFrame(m))},m=e=>{if(i=0,s||!c||document.hidden)return;const n=!d.matches&&(o||e-h<1500);(l||n)&&(t(e,d.matches?null:a),l=!1),n&&(i=requestAnimationFrame(m))},u=t=>{if("touch"===t.pointerType)return;const o=e.getBoundingClientRect();if(!o.width||!o.height)return;const n=(t.clientX-o.left)/o.width,r=(t.clientY-o.top)/o.height;a=n>=0&&n<=1&&r>=0&&r<=1?{x:n,y:r}:null,h=performance.now(),f()},g=()=>{a=null,h=performance.now(),f()},p=()=>{document.hidden&&i?(cancelAnimationFrame(i),i=0):f()},M="undefined"==typeof IntersectionObserver?null:new IntersectionObserver(([e])=>{c=e.isIntersecting,c?f():i&&(cancelAnimationFrame(i),i=0)});return M?.observe(e),n&&(r.addEventListener("pointermove",u),r.addEventListener("pointerleave",g)),document.addEventListener("visibilitychange",p),d.addEventListener("change",f),f(),{wake:f,stop:()=>{s=!0,cancelAnimationFrame(i),M?.disconnect(),r.removeEventListener("pointermove",u),r.removeEventListener("pointerleave",g),document.removeEventListener("visibilitychange",p),d.removeEventListener("change",f)}}}var T=null,A=null;function F(e,t){if(!T||!A){const o=c(e,t);T=o.canvas,A=o.ctx}return T.width!==e&&(T.width=e),T.height!==t&&(T.height=t),A}var R=new Map,k=new Map,L=new WeakMap;function I(e){const t=Intl.Segmenter;return t?Array.from(new t(void 0,{granularity:"grapheme"}).segment(e),({segment:e})=>e):[...e]}function H(e){let t=R.get(e);return t||(t=I(e),R.set(e,t)),t}function W(e){return I(e)}function $(e,t,o){const n=o?1-e/255:e/255,r=Math.floor(n*(t.length-1));return t[Math.max(0,Math.min(t.length-1,r))]??" "}function P(e,t,o,n){const r=`${e}\0${t?1:0}\0${o}\0${n}`;let a=k.get(r);if(!a){const i=H(e);a=new Array(256);for(let e=0;e<256;e++)a[e]=$(l(e,o,n),i,t);k.set(r,a)}return a}function j(e,t){return"auto"!==e?e:!x(t)}function z(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 O(e){const t=e||"auto";if("auto"!==t)return z(t)??"ffffff";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=z(e.getPropertyValue(t).trim());if(o)return o}const t=z(getComputedStyle(document.body).accentColor??"");if(t)return t}return x("undefined"!=typeof document?document.body:null)?"faf9f7":"0d0d0d"}function q(e,t,o){return Math.max(t,Math.min(o,e))}function V(e,t,o){if(!e)return{x:0,y:0,width:t,height:o};const n=e.unit??"percent",r=!1!==e.preserveAspect,a=e=>void 0===e?void 0:"percent"===n?e*t:e,i=e=>void 0===e?void 0:"percent"===n?e*o:e,s=q(a(e.left)??0,0,t-1),c=q(a(e.right)??0,0,t-s-1),l=q(i(e.top)??0,0,o-1),h=q(i(e.bottom)??0,0,o-l-1),d=void 0!==e.left||void 0!==e.right||void 0!==e.top||void 0!==e.bottom,f=Math.max(1,t-s-c),m=Math.max(1,o-l-h),u=d?f:a(e.width),g=d?m:i(e.height);let p=u??t,M=g??o;if(r&&!d){const e=p/t,n=M/o,r=Math.min(e,n),a=void 0===u?n:void 0===g?e:r;p=t*a,M=o*a}p=q(p,1,d?f:t),M=q(M,1,d?m:o);const v=e.anchor??"center",w=a(e.x),x=i(e.y),y=d?s:0,b=d?l:0,S=d?f:t,E=d?m:o,C=v.endsWith("left")||"left"===v?0:v.endsWith("right")||"right"===v?S-p:(S-p)/2,T=v.startsWith("top")||"top"===v?0:v.startsWith("bottom")||"bottom"===v?E-M:(E-M)/2;return{x:q(w??y+C,0,Math.max(0,t-p)),y:q(x??b+T,0,Math.max(0,o-M)),width:p,height:M}}function B(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 i=t.charAspect,s=t.fontSize*t.charSpacing,c=t.fontSize/i*t.charSpacing,d=o||r,m=n||a,u=Math.floor(d/s),g=Math.floor(m/c);if(u<=0||g<=0)return{frame:[],cols:0,rows:0};const p=V(t.sourceCrop,r,a),M=Math.max(1,Math.min(Math.floor(2048/u),Math.floor(p.width/u))),v=Math.max(1,Math.min(Math.floor(2048/g),Math.floor(p.height/g))),w=u*M,x=g*v,b=F(w,x),S=b.globalCompositeOperation;b.globalCompositeOperation="copy";try{b.drawImage(e,p.x,p.y,p.width,p.height,0,0,w,x)}finally{b.globalCompositeOperation=S}const E=b.getImageData(0,0,w,x).data,C=t.chromaKey,T=null!=C&&!1!==C,A=!0===C,R="blue-screen"===C;let k=null,L=0;!T||A||R||(k=y(C),L=(t.chromaKeyTolerance??60)**2);let I=0,W=255;if(t.normalize){let e=255,t=0;for(let o=0;o<E.length;o+=4){if(T){const e=E[o],t=E[o+1],n=E[o+2];let r=!1;if(A)r=t>1.4*e&&t>1.4*n&&t>80;else if(R)r=n>1.4*e&&n>1.4*t&&n>80;else if(null!==k){const o=e-k.r,a=t-k.g,i=n-k.b;r=o*o+a*a+i*i<=L}if(r)continue}const n=.299*E[o]+.587*E[o+1]+.114*E[o+2];n<e&&(e=n),n>t&&(t=n)}I=e,W=t>e?t-e:255}const z=[],O=j(t.invert),q=T&&t.charset.replace(/ /g,"")||t.charset,B=H(q),U=t.customText?null:P(q,O,t.brightness,t.contrast),D=M*v;for(let e=0;e<g;e++){const o=[];for(let n=0;n<u;n++){let r=0,a=0,i=0,s=0,c=0;for(let t=0;t<v;t++){const o=(e*v+t)*w;for(let e=0;e<M;e++){const t=4*(o+n*M+e),l=E[t],h=E[t+1],d=E[t+2],f=E[t+3];if(T){let e=!1;if(A)e=h>1.4*l&&h>1.4*d&&h>80;else if(R)e=d>1.4*l&&d>1.4*h&&d>80;else if(null!==k){const t=l-k.r,o=h-k.g,n=d-k.b;e=t*t+o*o+n*n<=L}if(e){c++;continue}}r+=l,a+=h,i+=d,s+=f}}if(T&&c>D/2){o.push({char:" ",r:0,g:0,b:0,a:0});continue}const d=D-c,m=d>0?r/d:0,g=d>0?a/d:0,p=d>0?i/d:0,x=d>0?s/d:0,y=.299*m+.587*g+.114*p,b=t.normalize?(y-I)/W*255:y,S=l(b,t.brightness,t.contrast),C=t.ditherStrength>0?f(S,n,e,t.ditherStrength):S,F=t.customText?h(C,t.customText,n,e,u,O):t.ditherStrength>0?$(C,B,O):U[Math.max(0,Math.min(255,0|b))];o.push({char:F,r:m,g:g,b:p,a:x,lum:C})}z.push(o)}return{frame:z,cols:u,rows:g}}function U(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{rows:[],cols:0,rowCount:0};const i=t.charAspect,s=t.fontSize*t.charSpacing,c=t.fontSize/i*t.charSpacing,h=o||r,d=n||a,m=Math.floor(h/s),u=Math.floor(d/c);if(m<=0||u<=0)return{rows:[],cols:0,rowCount:0};const g=m,p=u,M=F(g,p),v=V(t.sourceCrop,r,a),w=M.globalCompositeOperation;M.globalCompositeOperation="copy";try{M.drawImage(e,v.x,v.y,v.width,v.height,0,0,g,p)}finally{M.globalCompositeOperation=w}const x=M.getImageData(0,0,g,p).data,b=t.chromaKey,S=null!=b&&!1!==b,E=!0===b,C="blue-screen"===b;let T=null,A=0;!S||E||C||(T=y(b),A=(t.chromaKeyTolerance??60)**2);let R=0,k=255;if(t.normalize){let e=255,t=0;for(let o=0;o<x.length;o+=4){if(S){const e=x[o],t=x[o+1],n=x[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*x[o]+.587*x[o+1]+.114*x[o+2];n<e&&(e=n),n>t&&(t=n)}R=e,k=t>e?t-e:255}const L=j(t.invert),I=S&&t.charset.replace(/ /g,"")||t.charset,W=H(I),z=t.customText?null:P(I,L,t.brightness,t.contrast),O=t.customText?H(t.customText):null,q="fullcolor"===t.colorMode?new Uint8ClampedArray(m*u*4):void 0,B=[];for(let e=0;e<u;e++){let o="";for(let n=0;n<m;n++){const r=4*(e*g+n),a=r,i=x[r],s=x[r+1],c=x[r+2],h=x[r+3];if(S){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){o+=" ",q&&(q[a]=0,q[a+1]=0,q[a+2]=0,q[a+3]=0);continue}}q&&(q[a]=i,q[a+1]=s,q[a+2]=c,q[a+3]=h);const d=.299*i+.587*s+.114*c,u=t.normalize?(d-R)/k*255:d,p=t.ditherStrength>0||O?l(u,t.brightness,t.contrast):u,M=t.ditherStrength>0?f(p,n,e,t.ditherStrength):p;if(O){o+=(L?1-M/255:M/255)<.12?" ":O[(e*m+n)%O.length]}else t.ditherStrength<=0?o+=z[Math.max(0,Math.min(255,0|u))]:o+=$(M,W,L)}B.push(o)}return{rows:B,cols:m,rowCount:u,colors:q}}function D(e,t,o,n,r){if(0===t.rows.length)return;const a=e.canvas,i=Boolean(o.chromaKey)||t.rows.some(e=>e.includes(" "));i||(L.delete(e),e.clearRect(0,0,n,r),e.fillStyle=x(a)?"#0a0a0a":"#faf9f7",e.fillRect(0,0,n,r));const s=O(o.accentColor),c=parseInt(s.substring(0,2),16),l=parseInt(s.substring(2,4),16),h=parseInt(s.substring(4,6),16),d=n/t.cols,f=r/t.rowCount,m=.9*Math.min(d/.55,f),u=t.colors;if("fullcolor"===o.colorMode&&u){L.delete(e),e.clearRect(0,0,n,r),e.font=`${m}px "JetBrains Mono", monospace`,e.textAlign="left",e.textBaseline="middle",e.globalAlpha=1;let o="";for(let n=0;n<t.rows.length;n++){const r=W(t.rows[n]);let a=0;for(;a<t.cols;){for(;a<t.cols&&" "===r[a];)a++;if(a>=t.cols)break;const i=a,s=4*(n*t.cols+a),c=240&u[s],l=240&u[s+1],h=240&u[s+2];for(a++;a<t.cols&&" "!==r[a];){const e=4*(n*t.cols+a);if((240&u[e])!==c||(240&u[e+1])!==l||(240&u[e+2])!==h)break;a++}const m=`rgb(${c},${l},${h})`;m!==o&&(e.fillStyle=m,o=m),e.fillText(r.slice(i,a).join(""),i*d+.5*d,n*f+.5*f)}}return void(e.globalAlpha=1)}e.font=`${m}px "JetBrains Mono", monospace`,e.textAlign="left",e.textBaseline="middle";const g="matrix"===o.colorMode?"rgb(0,255,0)":"grayscale"===o.colorMode?x(a)?"rgb(230,230,230)":"rgb(24,24,24)":`rgb(${c},${l},${h})`;e.fillStyle=g,e.globalAlpha=1;const p=L.get(e),M=i&&p&&p.cols===t.cols&&p.rowCount===t.rowCount&&p.canvasWidth===n&&p.canvasHeight===r&&p.fillStyle===g;M||e.clearRect(0,0,n,r);for(let o=0;o<t.rows.length;o++){const r=t.rows[o];M&&p.rows[o]===r||(M&&e.clearRect(0,o*f,n,f+1),0!==r.trim().length&&e.fillText(r,.5*d,o*f+.5*f))}L.set(e,{rows:t.rows.slice(),cols:t.cols,rowCount:t.rowCount,canvasWidth:n,canvasHeight:r,fillStyle:g}),e.globalAlpha=1}async function N(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 d=0,f=0;for(let a=0;a<l;a++){const m=s+a/r;if(m>s+c)break;e.currentTime=m,await new Promise(t=>{const o=()=>{e.removeEventListener("seeked",o),t()};e.addEventListener("seeked",o)});const u=B(e,t,o,n);h.push(u.frame),d=u.cols,f=u.rows,i?.((a+1)/l)}return{frames:h,cols:d,rows:f,fps:r}}async function K(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 d=0,f=0;for(let a=0;a<l;a++){const m=s+a/r;if(m>s+c)break;e.currentTime=m,await new Promise(t=>{const o=()=>{e.removeEventListener("seeked",o),t()};e.addEventListener("seeked",o)});const u=U(e,t,o,n);h.push(u),d=u.cols,f=u.rowCount,i?.((a+1)/l)}return{frames:h,cols:d,rows:f,fps:r}}async function Y(e,t,o,n,r){const{parseGIF:a,decompressFrames:i}=await import("gifuct-js"),s=a(e),c=i(s,!0);if(0===c.length)return{frames:[],cols:0,rows:0,fps:10};const l=c[0].dims.width,h=c[0].dims.height,d=s.lsd?.width||l,f=s.lsd?.height||h,m=document.createElement("canvas");m.width=d,m.height=f;const u=m.getContext("2d"),g=document.createElement("canvas");g.width=d,g.height=f;const p=g.getContext("2d"),M=document.createElement("canvas"),v=M.getContext("2d"),w=[];let x=0,y=0,b=0;for(const e of c)b+=e.delay||100;const S=b/c.length,E=Math.round(Math.min(30,Math.max(5,1e3/S))),C=Math.min(c.length,300);for(let e=0;e<C;e++){const a=c[e],{dims:i,patch:s,disposalType:l}=a;3===l&&(p.clearRect(0,0,d,f),p.drawImage(m,0,0)),M.width!==i.width&&(M.width=i.width),M.height!==i.height&&(M.height=i.height);const h=new ImageData(new Uint8ClampedArray(s.buffer),i.width,i.height);v.putImageData(h,0,0),u.drawImage(M,i.left||0,i.top||0);const b=B(m,t,o,n);w.push(b.frame),x=b.cols,y=b.rows,2===l?u.clearRect(i.left||0,i.top||0,i.width,i.height):3===l&&(u.clearRect(0,0,d,f),u.drawImage(g,0,0)),r?.((e+1)/C)}return{frames:w,cols:x,rows:y,fps:E}}var _=new WeakMap,G=new WeakMap,X=new WeakMap;function J(e,t,o,n,r,a=0,i){if(!t.length||!t[0].length||n<=0||r<=0)return;let s=null;if(o.hoverStrength>0){let t=_.get(e);t||(t={x:.5,y:.5,intensity:0,time:-1,emittedAt:-1,points:[]},_.set(e,t)),s=function(e,t,o){const n=e.time<0?1/60:Math.max(0,Math.min(.1,(o-e.time)/1e3));e.time=o;const r=e.intensity<.003,a=e.x,i=e.y;if(t){r&&(e.x=t.x,e.y=t.y);const o=1-Math.exp(-n/.055);e.x+=(t.x-e.x)*o,e.y+=(t.y-e.y)*o}e.intensity+=((t?.intensity??(t?1:0))-e.intensity)*(1-Math.exp(-n/(t?.09:.18)));const s=Math.exp(-n/.22);for(const t of e.points)t.intensity*=s;for(;e.points.length&&e.points[0].intensity<.01;)e.points.shift();return t&&!r&&o-e.emittedAt>=24&&Math.hypot(e.x-a,e.y-i)>5e-4&&(e.points.push({x:e.x,y:e.y,intensity:e.intensity,vx:Math.max(-1,Math.min(1,(e.x-a)/Math.max(n,.001))),vy:Math.max(-1,Math.min(1,(e.y-i)/Math.max(n,.001)))}),e.points.length>12&&e.points.shift(),e.emittedAt=o),!t&&e.intensity<.003&&!e.points.length?(e.intensity=0,null):{x:e.x,y:e.y,intensity:e.intensity,trail:e.points}}(t,i??null,performance.now())}else _.delete(e);if("none"!==o.animationStyle||o.charsetFrames?.length||o.hoverStrength<=0)return X.delete(e),void Q(e,t,o,n,r,a,s);const c=G.get(e);if(c?.frame!==t)return G.set(e,{frame:t,since:performance.now()}),X.delete(e),void Q(e,t,o,n,r,a,s);if(performance.now()-c.since<100)return void Q(e,t,o,n,r,a,s);const l=e.getTransform();if(l.b||l.c||l.a<=0||l.d<=0)return void Q(e,t,o,n,r,a,s);if(!s||(s.intensity??0)<.003)return void Q(e,t,o,n,r,a,null);const h=x(e.canvas),d={...o,accentColor:"#"+O(o.accentColor)},f=JSON.stringify([d,n,r,l.a,l.d,h,void 0!==document.fonts?document.fonts.status:"loaded"]);let m=X.get(e);if(!m||m.frame!==t||m.key!==f){const o=m?.canvas??document.createElement("canvas");o.width=Math.ceil(n*l.a),o.height=Math.ceil(r*l.d);const a=o.getContext("2d");a.setTransform(l.a,0,0,l.d,0,0),Q(a,t,d,n,r,0,null,void 0,h),m={frame:t,key:f,canvas:o},X.set(e,m)}if(e.clearRect(0,0,n,r),e.drawImage(m.canvas,0,0,n,r),!s||(s.intensity??0)<.003)return;const u=t.length,g=t[0].length,p=.08+.35*o.hoverRadius+.04*o.hoverStrength,M="trail"===o.hoverEffect?[s,...s.trail??[]]:[s];let v=1,w=1,y=0,b=0;for(const e of M)v=Math.min(v,e.x-p),y=Math.max(y,e.x+p),w=Math.min(w,e.y-p),b=Math.max(b,e.y+p);if("glitchText"===o.hoverEffect){const e=o.hoverText,t=Math.max(1,...(Array.isArray(e)?e:[e]).map(e=>e.length));v=Math.min(v,s.x-t/g),y=Math.max(y,s.x+t/g)}const S=Math.ceil(5+4*o.hoverStrength),E={x:Math.max(0,Math.floor(v*g)-S),y:Math.max(0,Math.floor(w*u)-S),right:Math.min(g,Math.ceil(y*g)+S),bottom:Math.min(u,Math.ceil(b*u)+S)};e.save(),e.beginPath(),e.rect(E.x*n/g,E.y*r/u,(E.right-E.x)*n/g,(E.bottom-E.y)*r/u),e.clip(),Q(e,t,d,n,r,a,s,E,h),e.restore()}function Q(e,t,o,n,r,i=0,c,l,h){const d=t.length;if(0===d)return;const f=t[0].length;e.clearRect(0,0,n,r);let m=!1;const u=Math.max(1,d>>2),p=Math.max(1,f>>2);e:for(let e=0;e<d;e+=u){const o=t[e];for(let e=0;e<f;e+=p)if(o[e].a<200){m=!0;break e}}const v=e.canvas,w=h??x(v);m||(e.fillStyle=w?"#0a0a0a":"#faf9f7",e.fillRect(0,0,n,r));const y=n/f,b=r/d,S=c?.intensity??1,C=!!(c&&o.hoverStrength>0&&S>.005),T="#"+(z(o.hoverColor||"#ffffff")??"ffffff"),A=parseInt(T.slice(1,3),16),F=parseInt(T.slice(3,5),16),R=parseInt(T.slice(5,7),16),k=O(o.accentColor),L=parseInt(k.substring(0,2),16),I=parseInt(k.substring(2,4),16),W=parseInt(k.substring(4,6),16),P=o.hoverRadius;let q=0,V=f,B=0,U=d,D=0,N=0;if(C&&c){D=c.x,N=c.y;const e=.08+.35*P+.04*o.hoverStrength;q=Math.max(0,Math.floor((D-e)*f)-1),V=Math.min(f,Math.ceil((D+e)*f)+1),B=Math.max(0,Math.floor((N-e)*d)-1),U=Math.min(d,Math.ceil((N+e)*d)+1)}if(C&&"trail"===o.hoverEffect)for(const e of c?.trail??[]){const t=.08+.35*P+.04*o.hoverStrength;q=Math.min(q,Math.max(0,Math.floor((e.x-t)*f)-1)),V=Math.max(V,Math.min(f,Math.ceil((e.x+t)*f)+1)),B=Math.min(B,Math.max(0,Math.floor((e.y-t)*d)-1)),U=Math.max(U,Math.min(d,Math.ceil((e.y+t)*d)+1))}const K=o.animationStyle,Y=o.animationSpeed,_=(G=K,a.find(e=>e.value===G||e.mode===G)?.mode??"none");var G;const X="none"===_,J=[0,0,0,1],Q=o.hoverStrength,Z=o.hoverEffect,ee=P,te=o.hoverShape||"circle",oe=j(o.invert,v),ne=o.colorMode,re=2*Math.PI,ae=1/f,ie=1/d;let se="",ce=-1;if("dots"===o.renderMode){const a=.5*Math.min(y,b)*o.dotSizeRatio;for(let o=l?.y??0;o<(l?.bottom??d);o++){const h=t[o];for(let t=l?.x??0;t<(l?.right??f);t++){const l=h[t];if(l.a<10)continue;const m=.00392156863*(.299*l.r+.587*l.g+.114*l.b),u=oe?1-m:m;if(u<.02)continue;X||s(_,t/f,o/d,i*Y,J);const p=Math.max(0,Math.min(1,(1+J[2])*J[3]));let v=1,w=0,x=0,T=0,k=0;if(C&&t>=q&&t<=V&&o>=B&&o<=U){const e=E(t*ae,o*ie,D,N,S,Q,y,b,Z,ee,te,c?.trail,n/r);v=e.scale,w=e.offsetX,x=e.offsetY,T=e.glow,k=e.colorBlend}const H=a*u*p*v;if(H<.3)continue;const $=t*y+.5*y+w+J[0],P=o*b+.5*b+x+J[1];let j;if(k>0){const e=M(l,ne,L,I,W,oe);j=`rgb(${Math.min(255,e[0]+(A-e[0])*k|0)},${Math.min(255,e[1]+(F-e[1])*k|0)},${Math.min(255,e[2]+(R-e[2])*k|0)})`}else j=g(l,ne,L,I,W,oe);const z=Math.min(1,.00392156863*l.a*p*(1+T));if(z!==ce&&(e.globalAlpha=z,ce=z),j!==se&&(e.fillStyle=j,se=j),H<=3){const t=2*H;e.fillRect($-H,P-H,t,t)}else e.beginPath(),e.arc($,P,H,0,re),e.fill()}}}else{const a=.55,h=.9*Math.min(y/a,b);{const t=/\p{Extended_Pictographic}/u.test(o.customText||o.charset);e.font=t?`${h}px "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif`:`${h}px "JetBrains Mono", monospace`,e.textAlign="center",e.textBaseline="middle"}const m=o.charsetFrames,u=!!m?.length,p=u?m[Math.floor(Math.max(0,i)*(o.charsetFps??2))%m.length]:o.charset,v=e.getTransform();if(!C&&X&&!u&&"accent"===ne&&!l&&o.hoverStrength<=0&&!/\p{Extended_Pictographic}/u.test(o.customText||o.charset)&&"letterSpacing"in e&&/^[\x20-\x7e]*$/.test(o.customText||o.charset)&&t.every(e=>e.every(e=>e.a<10||255===e.a&&1===e.char.length&&/^[\x20-\x7e]$/.test(e.char)))){const o=e.letterSpacing;e.letterSpacing="0px";const n=e.measureText("M").width;e.letterSpacing=y-n+"px",e.fillStyle=`rgb(${L},${I},${W})`,e.globalAlpha=1,e.textAlign="left";for(let o=0;o<d;o++){const r=t[o];let a="";for(let e=0;e<f;e++){const t=r[e];a+=t.a<10?" ":t.char}0!==a.trim().length&&e.fillText(a,.5*(y-n),o*b+.5*b)}return e.letterSpacing=o,e.textAlign="center",void(e.globalAlpha=1)}const w="glitchText"===Z&&C,x="!@#$%^&*<>{}[]|/\\~`0123456789",T=x.length;let k="",j=0,z=0,O=0,K=0,G=0,re=0;if(w){const e=o.hoverText??"ASCIIFY";if(z=Math.round(D*f),O=Math.round(N*d),Array.isArray(e)){const t=e.filter(e=>e.length>0);0===t.length&&t.push("ASCIIFY");k=t[((7*Math.floor(z/Math.max(1,Math.ceil(f/5)))+13*Math.floor(O/Math.max(1,Math.ceil(d/3))))%t.length+t.length)%t.length]}else k=e||"ASCIIFY";j=k.length,K=Math.max(3,Math.min(12,Math.round(d*P*.6)));const t=Math.floor(K/2);G=Math.max(0,O-t),G+K>d&&(G=Math.max(0,d-K)),re=z-Math.floor(j/2)}for(let o=l?.y??0;o<(l?.bottom??d);o++){const a=t[o];for(let h=l?.x??0;h<(l?.right??f);h++){const l=a[h];if(l.a<10)continue;let m=u&&null!=l.lum?$(l.lum,H(p),oe):l.char;if(" "===m)continue;X||s(_,h/f,o/d,i*Y,J);const P=Math.max(0,Math.min(1,(1+J[2])*J[3]));if(P<.05)continue;let le=1,he=0,de=0,fe=0,me=0;if(C&&!w&&h>=q&&h<=V&&o>=B&&o<=U){const e=E(h*ae,o*ie,D,N,S,Q,y,b,Z,ee,te,c?.trail,n/r);if(le=e.scale,he=e.offsetX,de=e.offsetY,fe=e.glow,me=e.colorBlend,"trail"===Z&&e.proximity>0){const n=Math.max(0,Math.min(f-1,Math.round(h-e.offsetX/y))),r=t[Math.max(0,Math.min(d-1,Math.round(o-e.offsetY/b)))][n],a=r.lum??.299*r.r+.587*r.g+.114*r.b;m=$(Math.min(255,a+e.proximity*Q*65),H(p),oe)}}if(w&&o>=G&&o<G+K){const e=h-re;if(e>=0&&e<j){const t=k[e],n=Math.abs(o-O)/Math.max(1,.5*K),r=Math.abs(h-z)/Math.max(1,j),a=Math.max(n,r),s=Math.max(0,Math.min(1,1-.9*a)),c=43758.5453*Math.sin(127.1*h+311.7*o+43758.5453*Math.floor(12*i));m=Math.abs(c-Math.floor(c))<s?t:x[Math.abs(Math.floor(97*c))%T],fe=.3+.7*s,me=.3+.65*s}}const ue=h*y+.5*y+he+J[0],ge=o*b+.5*b+de+J[1];let pe;if(me>0){const e=M(l,ne,L,I,W,oe);pe=`rgb(${Math.min(255,e[0]+(A-e[0])*me|0)},${Math.min(255,e[1]+(F-e[1])*me|0)},${Math.min(255,e[2]+(R-e[2])*me|0)})`}else pe=g(l,ne,L,I,W,oe);const Me=Math.min(1,.00392156863*l.a*P*(1+fe));Me!==ce&&(e.globalAlpha=Me,ce=Me),pe!==se&&(e.fillStyle=pe,se=pe),1!==le?(e.translate(ue,ge),e.scale(le,le),e.fillText(m,0,0),e.setTransform(v)):e.fillText(m,ue,ge)}}}e.globalAlpha=1}function Z(e){return Math.max(0,Math.min(1,e))}function ee(e){return"string"==typeof e?document.querySelector(e):e instanceof HTMLElement?e:null}function te(e){return"ascii"===e.renderMode&&"none"===e.animationStyle&&e.hoverStrength<=0&&!e.charsetFrames?.length}function oe(e,t={}){const o=Z(e),n=Z(o*(void 0===t.speed?1:Math.max(.001,t.speed)));return Z(t.ease?t.ease(n):n)}function ne(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=oe(t,o),s=n+(a-n)*i;e.currentTime=Math.min(Math.max(n,s),Math.max(n,a-.04)),o.onUpdate?.(i,e)}function re(e,t){return Math.abs(e.currentTime-t)<1/240?ae(e):new Promise(o=>{const n=()=>{e.removeEventListener("seeked",n),o()};e.addEventListener("seeked",n,{once:!0});const r=e.fastSeek;r?r.call(e,t):e.currentTime=t})}function ae(e){const t=e.requestVideoFrameCallback;return new Promise(t?o=>{let n=!1;const r=()=>{n||(n=!0,o())};t.call(e,r),window.setTimeout(r,32)}:e=>requestAnimationFrame(()=>e()))}function ie(e,t={}){const o=ee(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=>ne(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?Z((a-r.top)/i):0;ne(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 se(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?Z((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 ce(e,t,o){if(!e||!t||!o.sourceCrop)return{w:e,h:t};const n=V(o.sourceCrop,e,t);return{w:Math.max(1,Math.round(n.width)),h:Math.max(1,Math.round(n.height))}}function le(e,t,o,n){const r=n.chromaKey;if(null==r||!1===r)return!1;if(!0===r)return t>1.4*e&&t>1.4*o&&t>80;if("blue-screen"===r)return o>1.4*e&&o>1.4*t&&o>80;const a=y(r),i=(n.chromaKeyTolerance??60)**2,s=e-a.r,c=t-a.g,l=o-a.b;return s*s+c*c+l*l<=i}function he(e,t,o){if(!t.chromaKey||!t.sourceCrop||"off"===t.chromaKeyTrimMode)return t;const n=e instanceof HTMLVideoElement?e.videoWidth:e.width,r=e instanceof HTMLVideoElement?e.videoHeight:e.height;if(!n||!r)return t;const a=V(t.sourceCrop,n,r),i=Math.min(360,Math.max(1,Math.round(a.width))),s=Math.max(1,Math.round(i*(a.height/a.width))),{ctx:l}=c(i,s);l.drawImage(e,a.x,a.y,a.width,a.height,0,0,i,s);const h=l.getImageData(0,0,i,s).data,d=Math.max(0,Math.min(255,t.chromaKeyTrimLuminanceThreshold??0));let f=i,m=s,u=-1,g=-1;for(let e=0;e<s;e++)for(let o=0;o<i;o++){const n=4*(e*i+o),r=h[n+3],a=h[n],s=h[n+1],c=h[n+2];r<=8||.2126*a+.7152*s+.0722*c<=d||le(a,s,c,t)||(o<f&&(f=o),e<m&&(m=e),o>u&&(u=o),e>g&&(g=e))}if(u<f||g<m)return t;const p=Math.max(0,Math.min(.25,t.chromaKeyTrimPadding??.002)),M=Math.round(i*p),v=Math.round(s*p);f=Math.max(0,f-M),m=Math.max(0,m-v),u=Math.min(i-1,u+M),g=Math.min(s-1,g+v);const w=function(e,t,o,n,r){const a=r&&Number.isFinite(r)&&r>0?r:null;if(!a)return e;const i=t.x,s=t.y,c=t.x+t.width,l=t.y+t.height,h=Math.max(i,e.left),d=Math.max(s,e.top),f=Math.min(c,o-e.right),m=Math.min(l,n-e.bottom),u=Math.max(1,f-h),g=Math.max(1,m-d),p=h+u/2,M=d+g/2;let v=u,w=g;v/w<a?v=w*a:w=v/a;v>t.width&&(v=t.width,w=Math.max(g,Math.min(t.height,v/a)));w>t.height&&(w=t.height,v=Math.max(u,Math.min(t.width,w*a)));let x=p-v/2,y=M-w/2;return x=Math.max(i,Math.min(c-v,x)),y=Math.max(s,Math.min(l-w,y)),{left:x,top:y,right:o-(x+v),bottom:n-(y+w)}}({left:a.x+f/i*a.width,top:a.y+m/s*a.height,right:n-(a.x+(u+1)/i*a.width),bottom:r-(a.y+(g+1)/s*a.height)},{x:a.x,y:a.y,width:a.width,height:a.height},n,r,o);return{...t,sourceCrop:{unit:"pixel",...w,preserveAspect:!1}}}function de(e){const t=e.sourceCrop;return t&&"pixel"===t.unit?void 0===t.left||void 0===t.top||void 0===t.right||void 0===t.bottom?null:{left:t.left,top:t.top,right:t.right,bottom:t.bottom}:null}async function fe(e,t,o,n,r){if(!t.chromaKey||!t.sourceCrop||"range"!==t.chromaKeyTrimMode)return t;const a=e.currentTime,i=function(e,t,o,n){const r=!0===n?{}:n||{},a=Math.max(0,r.from??t),i=r.to??o??(Number.isFinite(e.duration)?e.duration:a),s=Math.max(a,i-.04),c=Math.max(0,s-a),l=c>.1?[a,a+.25*c,a+.5*c,a+.75*c,s]:[a];return Array.from(new Set(l.map(e=>Math.max(0,Number(e.toFixed(3))))))}(e,o,n,r);let s=null;for(const o of i){await re(e,o),await ae(e);const n=de(he(e,t));n&&(s=s?{left:Math.min(s.left,n.left),top:Math.min(s.top,n.top),right:Math.min(s.right,n.right),bottom:Math.min(s.bottom,n.bottom)}:n)}return await re(e,a),await ae(e),s?{...t,sourceCrop:{unit:"pixel",...s,preserveAspect:!0}}:t}function me(e,t,o=2048){return ue({sourceWidth:e,sourceHeight:t,maxRenderDimension:o})}function ue({sourceWidth:e,sourceHeight:t,cssWidth:o=0,cssHeight:n=0,maxRenderDimension:r=2048}){const a=Math.max(1,e),i=Math.max(1,t),s=a/i,c=Math.max(1,r),l=Math.min(1,c/Math.max(a,i)),h=Math.max(a,i)*l,d=Math.max(0,o,n),f=Math.min(c,Math.max(h,d));return s>=1?{renderW:Math.round(f),renderH:Math.round(f/s)}:{renderW:Math.round(f*s),renderH:Math.round(f)}}function ge(e,t,o,n){if(void 0===e)return;if("number"==typeof e)return e;const r=e.trim();if(r.endsWith("%")){const e=Number.parseFloat(r)/100;return Number.isFinite(e)?t*e:void 0}if(r.endsWith("px")){const e=Number.parseFloat(r);return Number.isFinite(e)?e:void 0}if(r.endsWith("vw")){const e=Number.parseFloat(r)/100;return Number.isFinite(e)?o*e:void 0}if(r.endsWith("vh")){const e=Number.parseFloat(r)/100;return Number.isFinite(e)?n*e:void 0}}function pe(e,t,o,n,r,a=2048,i={}){const{width:s,height:c}=t.getBoundingClientRect();if(!s||!c)return{renderW:0,renderH:0,dpr:1};const l="undefined"!=typeof window?window.innerWidth:s,h="undefined"!=typeof window?window.innerHeight:c,d=ge(i.width,s,l,h)??s,f=ge(i.height,c,l,h)??c,m=function(e,t,o,n,r){const a=e=>{const o=ge(e,t,n,r);return o&&o>0?o:0},i=e=>{const t=ge(e,o,n,r);return t&&t>0?t:0};return void 0===e?{x:0,y:0}:"number"==typeof e||"string"==typeof e?{x:a(e),y:i(e)}:{x:a(e.x),y:i(e.y)}}(i.bleed,s,c,l,h),u=d+2*m.x,g=f+2*m.y,{cssW:p,cssH:M}=function(e,t,o,n="contain"){if("fill"===n)return{cssW:e,cssH:t};let r=e,a=r/o;const i="cover"===n,s=a>t;return(i&&!s||!i&&s)&&(a=t,r=a*o),"scale-down"===n&&(r=Math.min(r,e),a=Math.min(a,t)),{cssW:Math.round(r),cssH:Math.round(a)}}(u,g,o,i.objectFit??"contain"),v="undefined"!=typeof window&&window.devicePixelRatio||1;let w,x;n&&r?({renderW:w,renderH:x}=ue({sourceWidth:n,sourceHeight:r,cssWidth:p,cssHeight:M,maxRenderDimension:a})):(w=p,x=M);const y=8e6,b=w*v*x*v>y?Math.sqrt(y/(w*x)):v;return e.width=Math.round(w*b),e.height=Math.round(x*b),e.style.width=`${p}px`,e.style.height=`${M}px`,{renderW:w,renderH:x,dpr:b}}async function Me(e,t,{fontSize:n,artStyle:a="classic",options:i={},fitTo:s,objectFit:c,objectPosition:l,scale:h,width:d,height:f,bleed:m,preExtract:u=!1,fps:g,maxRenderDimension:p=2048,trim:M,scroll:v,maxCachedFrames:w=90,onReady:x,onFrame:y}={}){const b=M?.start??0,S=M?.end,E=n??i.fontSize??10;let T={...r,...o[a],artStyle:a,...i,fontSize:E};const A=t.getContext("2d");if(!A)throw new Error("asciifyVideo: could not get 2d context from canvas.");const F="string"==typeof s?document.querySelector(s):s instanceof HTMLElement?s:null,R={objectFit:c,objectPosition:l,scale:h,width:d,height:f,bleed:m},k=function(e,t){var o;if(!function(e){return void 0!==e.objectFit||void 0!==e.objectPosition||void 0!==e.scale||void 0!==e.width||void 0!==e.height||void 0!==e.bleed}(t))return()=>{};const n={width:e.style.width,height:e.style.height,objectFit:e.style.objectFit,objectPosition:e.style.objectPosition,maxWidth:e.style.maxWidth,maxHeight:e.style.maxHeight,transformOrigin:e.style.transformOrigin,scale:e.style.getPropertyValue("scale")};if(t.objectFit&&(e.style.objectFit=t.objectFit),t.objectPosition&&(e.style.objectPosition=t.objectPosition,e.style.transformOrigin=t.objectPosition),void 0===t.scale&&void 0===t.bleed||(e.style.maxWidth="none",e.style.maxHeight="none"),void 0!==t.scale){const n=Number.isFinite(t.scale)&&t.scale>0?t.scale:1;e.style.setProperty("scale",String(n)),(o=e.style).transformOrigin||(o.transformOrigin=t.objectPosition??"center center")}return()=>{e.style.width=n.width,e.style.height=n.height,e.style.objectFit=n.objectFit,e.style.objectPosition=n.objectPosition,e.style.maxWidth=n.maxWidth,e.style.maxHeight=n.maxHeight,e.style.transformOrigin=n.transformOrigin,n.scale?e.style.setProperty("scale",n.scale):e.style.removeProperty("scale")}}(t,R),L=e=>()=>{e(),k()};if(u){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,T=await fe(o,T,b,S,v);const n=ce(o.videoWidth,o.videoHeight,T);F&&pe(t,F,n.w/n.h,n.w,n.h,p,R);const{renderW:r,renderH:a}=me(n.w,n.h,p),i="undefined"!=typeof window&&window.devicePixelRatio||1,s=8e6,c=r*i*a*i>s?Math.sqrt(s/(r*a)):i;t.width===Math.round(r*c)&&t.height===Math.round(a*c)||(t.width=Math.round(r*c),t.height=Math.round(a*c));const l=void 0!==S?S-b:10,h=g??(v?18:void 0);if(te(T)){const{frames:e,fps:n}=await K(o,T,r,a,h,l,void 0,b),i=t=>{const o=e[t];o&&(A.save(),A.setTransform(c,0,0,c,0,0),D(A,o,T,r,a),A.restore(),y?.())};if(v){let n=!1,r=-1;const a=!0===v?{}:v,s=se(ee(a.trigger)??F??t,a,t=>{const s=oe(t,a),c=Math.max(0,Math.min(e.length-1,Math.round(s*(e.length-1))));c!==r&&(r=c,i(c),n||(n=!0,x?.(o)),a.onUpdate?.(s,o))});return i(0),n=!0,x?.(o),L(s)}let s,d=!1,f=0,m=performance.now(),u=!0;const g=1e3/n,p=t=>{d||(t-m>=g&&(i(f),f=(f+1)%e.length,m=t,u&&(u=!1,x?.(o))),s=requestAnimationFrame(p))};return s=requestAnimationFrame(p),L(()=>{d=!0,cancelAnimationFrame(s)})}const{frames:d,fps:f}=await N(o,T,r,a,h,l,void 0,b);if(!d.length)throw new Error("asciifyVideo: no frames were decoded.");let m=0;const u=performance.now(),M=C(t,(e,t)=>{v||(m=Math.floor((e-u)*f/1e3)%d.length),A.save(),A.setTransform(c,0,0,c,0,0),J(A,d[m],T,r,a,(e-u)/1e3,t),A.restore(),y?.()},{continuous:!v||"none"!==T.animationStyle||!!T.charsetFrames?.length,interactive:T.hoverStrength>0});let w;if(v){const e=!0===v?{}:v;w=se(ee(e.trigger)??F??t,e,t=>{m=Math.max(0,Math.min(d.length-1,Math.round(oe(t,e)*(d.length-1)))),M.wake(),e.onUpdate?.(t,o)})}return x?.(o),L(()=>{M.stop(),w?.()})}let I,H=!1;"string"==typeof e?(I=document.createElement("video"),I.crossOrigin="anonymous",I.src=e,I.muted=!0,I.loop=!0,I.playsInline=!0,I.setAttribute("playsinline",""),Object.assign(I.style,{position:"fixed",top:"0",left:"0",width:"1px",height:"1px",opacity:"0",pointerEvents:"none",zIndex:"-1"}),document.body.appendChild(I),H=!0,await new Promise((t,o)=>{I.onloadedmetadata=()=>t(),I.onerror=()=>o(new Error(`asciifyVideo: failed to load "${e}"`))}),await I.play().catch(()=>{})):(I=e,I.readyState<HTMLMediaElement.HAVE_METADATA&&await new Promise((e,t)=>{const o=()=>{I.removeEventListener("loadedmetadata",n),I.removeEventListener("error",r)},n=()=>{o(),e()},r=()=>{o(),t(new Error("asciifyVideo: provided video element failed to load metadata."))};I.addEventListener("loadedmetadata",n),I.addEventListener("error",r),I.load()}),I.paused&&await I.play().catch(()=>{})),b>0&&(I.currentTime=b,await new Promise(e=>{const t=()=>{I.removeEventListener("seeked",t),e()};I.addEventListener("seeked",t)}),await ae(I));let W=null;(b>0||void 0!==S)&&(W=()=>{(void 0!==S&&I.currentTime>=S||b>0&&I.currentTime<b)&&(I.currentTime=b)},I.addEventListener("timeupdate",W)),T=await fe(I,T,b,S,v);let $=null;const P=ce(I.videoWidth,I.videoHeight,T);let{renderW:j,renderH:z}=me(P.w,P.h,p);const O=e=>"frame"===T.chromaKeyTrimMode?he(e,T,j/z):T;if(F){const e=P.w/P.h,o=P.w,n=P.h,r=pe(t,F,e,o,n,p,R);j=r.renderW,z=r.renderH;const a=t.getContext("2d");a&&a.setTransform(r.dpr,0,0,r.dpr,0,0),$=new ResizeObserver(()=>{const r=pe(t,F,e,o,n,p,R);j=r.renderW,z=r.renderH;const a=t.getContext("2d");a&&a.setTransform(r.dpr,0,0,r.dpr,0,0)}),$.observe(F)}else{const e="undefined"!=typeof window&&window.devicePixelRatio||1,o=8e6,n=j*e*z*e>o?Math.sqrt(o/(j*z)):e;t.width===Math.round(j*n)&&t.height===Math.round(z*n)||(t.width=Math.round(j*n),t.height=Math.round(z*n)),A.setTransform(n,0,0,n,0,0)}let q=!0,V=null;const Y=v&&!u,_=g&&g>0?1e3/g:0;let G=0;const X=!Y&&te(T);if(Y&&"ascii"===T.renderMode&&"none"===T.animationStyle&&T.hoverStrength<=0&&!T.charsetFrames?.length){const e=!0===v?{}:v,o=ee(e.trigger)??F??t,n=e.from??b,r=e.to??S??I.duration,a=Math.max(n,Math.min(r,I.duration)),i=Math.max(.001,a-n),s=Math.min(60,Math.max(12,g??30)),c=Math.max(2,Math.ceil(i*s)+1),l=new Array(c),h=[],d=Math.max(2,Math.min(c,Math.floor(w))),f=()=>{for(;h.length>d;){const e=h.findIndex(e=>e!==u&&Math.abs(e-u)>2),t=e>=0?e:0,o=h.splice(t,1)[0];void 0!==o&&(l[o]=void 0)}},m=e=>{const t=h.indexOf(e);t>=0&&h.splice(t,1),h.push(e),f()};let u=0,p=0,M=-1,E=0,C=!1,R=!1,k=!1;const P=new Set,q=document.createElement("video");q.muted=!0,q.playsInline=!0,q.preload="auto",q.crossOrigin=I.crossOrigin||"anonymous",q.src=I.currentSrc||I.src,Object.assign(q.style,{position:"fixed",top:"0",left:"0",width:"1px",height:"1px",opacity:"0",pointerEvents:"none",zIndex:"-1"}),document.body.appendChild(q),q.readyState<HTMLMediaElement.HAVE_METADATA&&await new Promise((e,t)=>{const o=()=>{q.removeEventListener("loadedmetadata",n),q.removeEventListener("error",r)},n=()=>{o(),e()},r=()=>{o(),t(new Error("asciifyVideo: cache video failed to load metadata."))};q.addEventListener("loadedmetadata",n),q.addEventListener("error",r),q.load()}),q.pause(),I.paused&&await I.play().catch(()=>{});const B=e=>n+i*e/Math.max(1,c-1),N=e=>Math.max(0,Math.min(c-1,Math.round(e*(c-1)))),K=O(I),Y=U(I,K,j,z);Y.rows.length>0&&(l[0]=Y,m(0),D(A,Y,K,j,z),k=!0,x?.(I),y?.());const X=e=>{if(l[e])return e;for(let t=1;t<c;t++){const o=e-t,n=e+t;if(o>=0&&l[o])return o;if(n<c&&l[n])return n}return-1},J=()=>{if(!l[u])return u;for(const e of P)if(!l[e])return e;for(let e=1;e<c;e++){const t=u-e,o=u+e;if(t>=0&&!l[t])return t;if(o<c&&!l[o])return o}return-1},Q=e=>{e<0||e>=c||l[e]||(P.add(e),te())},te=async()=>{if(C||R)return;const e=J();if(!(e<0)){P.delete(e),R=!0;try{if(await re(q,B(e)),!C){const t=O(q),o=U(q,t,j,z);o.rows.length>0&&(l[e]=o,m(e))}}finally{R=!1,C||requestAnimationFrame(()=>{te()})}}},ne=()=>{if(C)return;const e=X(u);if(e>=0&&e!==M){const t=l[e];t&&(D(A,t,T,j,z),M=e,k||(k=!0,x?.(I)),y?.())}else if(e<0||M<0){const e=performance.now();if(_<=0||e-G>=_){const t=O(I),o=U(I,t,j,z);o.rows.length>0&&(D(A,o,t,j,z),G=e,k||(k=!0,x?.(I)),y?.())}}Q(u),E=requestAnimationFrame(ne)};return V=se(o,e,t=>{const o=function(e,t,o={}){if(!Number.isFinite(e.duration)||e.duration<=0)return null;const n=o.from??0,r=o.to??e.duration,a=Math.max(n,Math.min(r,e.duration)),i=oe(t,o),s=n+(a-n)*i;return{progress:i,time:Math.min(Math.max(n,s),Math.max(n,a-.04))}}(I,t,{...e,from:n,to:a});p=o?.progress??Z(t),u=N(p),Q(u),Q(u-1),Q(u+1),Q(u-2),Q(u+2),Q(u-3),Q(u+3),e.onUpdate?.(p,I)}),Q(0),Q(1),E=requestAnimationFrame(ne),L(()=>{C=!0,cancelAnimationFrame(E),V?.(),$?.disconnect(),P.clear(),h.length=0,l.fill(void 0),q.pause(),q.src="",q.removeAttribute("src"),q.load(),q.isConnected&&q.remove(),W&&I.removeEventListener("timeupdate",W),H&&(I.pause(),I.src="",I.removeAttribute("src"),I.load(),I.isConnected&&I.remove())})}if(Y){const e=!0===v?{}:v;V=ie(I,{...e,trigger:e.trigger??F??t,from:e.from??b,to:e.to??S})}let Q=-1,ne=0,le=-1,de=0;const ue="function"==typeof I.requestVideoFrameCallback,ge=()=>{de=I.requestVideoFrameCallback(()=>{ne++,ge()})};ue&&ge();let Me=0,ve=0,we=null;const xe=C(t,(e,o)=>{if(I.readyState<2||0===t.width||0===t.height)return;if(_>0&&e-G<_&&!o)return;if(b>0&&I.currentTime<b)return;if(void 0!==S&&I.currentTime>=S)return;const n=(ue?ne!==le:I.currentTime!==Q)||Me!==j||ve!==z;if(n||!(T.hoverStrength<=0)||"none"!==T.animationStyle||T.charsetFrames?.length){if(X){const e=O(I),t=U(I,e,j,z);D(A,t,e,j,z)}else!n&&we||(we=B(I,O(I),j,z).frame),J(A,we,T,j,z,e/1e3,o);Q=I.currentTime,le=ne,Me=j,ve=z,G=e,q&&(q=!1,x?.(I)),y?.()}},{continuous:!0,interactive:T.hoverStrength>0});return L(()=>{xe.stop(),de&&I.cancelVideoFrameCallback(de),V?.(),$?.disconnect(),W&&I.removeEventListener("timeupdate",W),H&&(I.pause(),I.src="",I.removeAttribute("src"),I.load(),I.isConnected&&I.remove())})}function ve(e,t,o,n="#505050",r=100){if(!e||t<=0||o<=0)return[];const a=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}(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})))}var we=new WeakMap;function xe(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 ye={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]},be=[127,65,65,65,65,65,127];function Se(e){return ye[e]??ye[e.toUpperCase()]??be}function Ee(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=Se(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=o,exports.CHARACTER_SETS={standard:{label:"Classic ASCII",chars:" .:-=+*#%@"},asciify:{label:"Asciify",chars:" .:-=+ASCIIFY#@"},minimal:{label:"Minimal",chars:" .:+"},detailed:{label:"Detailed",chars:" .,:;i1tfLCG08@"},letters:{label:"Letters",chars:" .ilLCFTYASMW"},technical:{label:"Technical",chars:" .:;>_/[{}]=+*#@$"},blocks:{label:"Tonal blocks",chars:" ░▒▓█"},braille:{label:"Braille",chars:" ⠁⠃⠇⡇⣇⣧⣷⣿"}},exports.CHARSETS=e,exports.CHARSET_SEQUENCES=t,exports.DEFAULT_OPTIONS=r,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:"Fluid trail",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=n,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.asciiText=function(e,t={},o,n){const a={...r,...t},{frame:i,cols:s}=B(e,a,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 a={...r,...t},{frame:i,cols:s}=B(e,a,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:n,artStyle:a="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=o[a],l=n??i.fontSize??10,h={...r,...c,artStyle:a,...i,fontSize:l},d=t.getContext("2d");if(!d)throw new Error("Could not get 2d context from canvas");const{w:f,h:m}=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:u,renderH:g}=me(f,m),p="undefined"!=typeof window&&window.devicePixelRatio||1,M=8e6,v=u*p*g*p>M?Math.sqrt(M/(u*g)):p;t.width===Math.round(u*v)&&t.height===Math.round(g*v)||(t.width=Math.round(u*v),t.height=Math.round(g*v));const{frame:w}=B(s,h,u,g),x=(e,t)=>{d.save(),d.setTransform(v,0,0,v,0,0),J(d,w,h,u,g,e/1e3,t),d.restore()};return x(0,null),C(t,x,{continuous:"none"!==h.animationStyle||!!h.charsetFrames?.length,interactive:h.hoverStrength>0}).stop},exports.asciifyGif=async function(e,t,{fontSize:n,artStyle:a="classic",options:i={}}={}){const s="string"==typeof e?await fetch(e).then(e=>e.arrayBuffer()):e,c=n??i.fontSize??10;let l={...r,...o[a],artStyle:a,...i,fontSize:c};const h=t.getContext("2d");if(!h)throw new Error("Could not get 2d context from canvas");const{frames:d,fps:f}=await Y(s,l,t.width,t.height);if(!d.length)throw new Error("asciifyGif: the GIF contains no renderable frames.");const m=performance.now();let u=-1;return C(t,(e,o)=>{const n=Math.floor((e-m)*f/1e3)%d.length;n===u&&!o&&l.hoverStrength<=0&&"none"===l.animationStyle&&!l.charsetFrames?.length||(J(h,d[n],l,t.width,t.height,(e-m)/1e3,o),u=n)},{continuous:!0,interactive:l.hoverStrength>0}).stop},exports.asciifyLiveVideo=function(e,t,o){return Me(e,t,o)},exports.asciifyText=Ee,exports.asciifyVideo=Me,exports.asciifyWebcam=async function(e,{fontSize:t=10,style:n="classic",options:a={},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}),d=document.createElement("video");d.srcObject=h,d.muted=!0,d.playsInline=!0,await new Promise((e,t)=>{d.onloadedmetadata=()=>e(),d.onerror=()=>t(new Error("asciifyWebcam: video stream failed to load.")),d.play().catch(t)});const f={...r,...o[n],...a,fontSize:t},m=e.getContext("2d");if(!m)throw new Error("asciifyWebcam: could not get 2d context from canvas.");const u=l??("undefined"!=typeof window?window.devicePixelRatio:1)??1;1!==u&&m.scale(u,u);let g=null;const p=t=>{const o=e.getBoundingClientRect();g={x:(t.clientX-o.left)/o.width,y:(t.clientY-o.top)/o.height}},M=()=>{g=null};f.hoverStrength>0&&(e.addEventListener("mousemove",p),e.addEventListener("mouseleave",M));let v,w=!1;const x=performance.now(),y=t=>{if(!w){if(d.readyState>=d.HAVE_CURRENT_DATA){const o=e.width/u,n=e.height/u,r=(t-x)/1e3,a=i?{...f,...i()}:f;a.hoverStrength>0?(e.addEventListener("mousemove",p),e.addEventListener("mouseleave",M)):(e.removeEventListener("mousemove",p),e.removeEventListener("mouseleave",M));const{frame:c}=B(d,a,o,n),l=g&&s?{x:1-g.x,y:g.y}:g;s?(m.save(),m.scale(-1,1),m.translate(-o,0),J(m,c,a,o,n,r,l),m.restore()):J(m,c,a,o,n,r,l)}v=requestAnimationFrame(y)}};return v=requestAnimationFrame(y),()=>{w=!0,cancelAnimationFrame(v),e.removeEventListener("mousemove",p),e.removeEventListener("mouseleave",M),h.getTracks().forEach(e=>e.stop()),d.srcObject=null}},exports.buildTextFrame=ve,exports.captureSnapshot=xe,exports.clearAsciifyCaches=function(){R.clear(),k.clear(),_=new WeakMap,X=new WeakMap,G=new WeakMap,T=null,A=null},exports.computeCanvasRenderSize=ue,exports.createVideoScrollScrub=ie,exports.gifToAsciiFrames=Y,exports.gifToAsciiTextFrames=async function(e,t,o,n,r){const{parseGIF:a,decompressFrames:i}=await import("gifuct-js"),s=a(e),c=i(s,!0);if(0===c.length)return{frames:[],cols:0,rows:0,fps:10};const l=c[0].dims.width,h=c[0].dims.height,d=s.lsd?.width||l,f=s.lsd?.height||h,m=document.createElement("canvas");m.width=d,m.height=f;const u=m.getContext("2d"),g=document.createElement("canvas");g.width=d,g.height=f;const p=g.getContext("2d"),M=document.createElement("canvas"),v=M.getContext("2d"),w=[];let x=0,y=0,b=0;for(const e of c)b+=e.delay||100;const S=b/c.length,E=Math.round(Math.min(30,Math.max(5,1e3/S))),C=Math.min(c.length,300);for(let e=0;e<C;e++){const a=c[e],{dims:i,patch:s,disposalType:l}=a;3===l&&(p.clearRect(0,0,d,f),p.drawImage(m,0,0)),M.width!==i.width&&(M.width=i.width),M.height!==i.height&&(M.height=i.height);const h=new ImageData(new Uint8ClampedArray(s.buffer),i.width,i.height);v.putImageData(h,0,0),u.drawImage(M,i.left||0,i.top||0);const b=U(m,t,o,n);w.push(b),x=b.cols,y=b.rowCount,2===l?u.clearRect(i.left||0,i.top||0,i.width,i.height):3===l&&(u.clearRect(0,0,d,f),u.drawImage(g,0,0)),r?.((e+1)/C)}return{frames:w,cols:x,rows:y,fps:E}},exports.imageToAsciiFrame=B,exports.imageToAsciiTextFrame=U,exports.renderFrameToCanvas=J,exports.renderTextBackground=function(e,t,o,n,a={},i){const{fontSize:s=10,lineHeight:c=1.6,color:l="#505050",opacity:h=100,hoverEffect:d="spotlight",hoverStrength:f=.85,hoverRadius:m=.18,hoverColor:u="#d4ff00"}=a,g=Math.max(1,Math.floor(t/s)),p=Math.max(1,Math.floor(o/(s*c))),M=JSON.stringify([n,g,p,l,h]);let v=we.get(e);v&&v.key===M||(v={key:M,frame:ve(n,g,p,l,h)},we.set(e,v)),J(e,v.frame,{...r,fontSize:s,hoverEffect:d,hoverStrength:f,hoverRadius:m,hoverColor:u},t,o,0,i??null)},exports.renderTextFrameToCanvas=D,exports.renderTextToCanvas=function(e,t,o={}){const{color:n="#d4ff00",bgColor:r,fontSize:a=10}=o,i=Ee(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.snapshotAndDownload=async function(e,t={}){const{filename:o="asciify-snapshot",format:n="png",...r}=t,a=await xe(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=N,exports.videoToAsciiTextFrames=K;//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { c as ART_STYLE_PRESETS, d as AnimationStyle, b as ArtStyle, e as AsciiCell, A as AsciiFrame, a as AsciiOptions, f as AsciiResult, C as CHARSETS, g as CHARSET_SEQUENCES, h as CharsetKey, i as CharsetSequenceKey, j as ColorMode, D as DEFAULT_OPTIONS, k as HOVER_PRESETS, H as HoverEffect, l as HoverPreset, m as HoverShape, L as LIVING_STYLE_PRESETS, n as LivingStylePresetKey, P as PALETTE_THEMES, o as PaletteTheme, R as RenderMode, S as SourceType } from './types-CYKIEtDC.cjs';
|
|
2
2
|
export { AsciiTextFrame, AsciifyLiveVideoOptions, AsciifySimpleOptions, AsciifyVideoOptions, BigTextOptions, CanvasBleed, CanvasObjectFit, CanvasRenderSizeInput, SnapshotOptions, TextBackgroundOptions, VideoScrollScrubOptions, WebcamOptions, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyLiveVideo, asciifyText, asciifyVideo, asciifyWebcam, buildTextFrame, captureSnapshot, clearAsciifyCaches, computeCanvasRenderSize, createVideoScrollScrub, gifToAsciiFrames, gifToAsciiTextFrames, imageToAsciiFrame, imageToAsciiTextFrame, renderFrameToCanvas, renderTextBackground, renderTextFrameToCanvas, renderTextToCanvas, snapshotAndDownload, videoToAsciiFrames, videoToAsciiTextFrames } from './core.cjs';
|
|
3
|
-
export {
|
|
3
|
+
export { C as CHARACTER_SETS } from './characters-BNTu2oEF.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { c as ART_STYLE_PRESETS, d as AnimationStyle, b as ArtStyle, e as AsciiCell, A as AsciiFrame, a as AsciiOptions, f as AsciiResult, C as CHARSETS, g as CHARSET_SEQUENCES, h as CharsetKey, i as CharsetSequenceKey, j as ColorMode, D as DEFAULT_OPTIONS, k as HOVER_PRESETS, H as HoverEffect, l as HoverPreset, m as HoverShape, L as LIVING_STYLE_PRESETS, n as LivingStylePresetKey, P as PALETTE_THEMES, o as PaletteTheme, R as RenderMode, S as SourceType } from './types-CYKIEtDC.js';
|
|
2
2
|
export { AsciiTextFrame, AsciifyLiveVideoOptions, AsciifySimpleOptions, AsciifyVideoOptions, BigTextOptions, CanvasBleed, CanvasObjectFit, CanvasRenderSizeInput, SnapshotOptions, TextBackgroundOptions, VideoScrollScrubOptions, WebcamOptions, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyLiveVideo, asciifyText, asciifyVideo, asciifyWebcam, buildTextFrame, captureSnapshot, clearAsciifyCaches, computeCanvasRenderSize, createVideoScrollScrub, gifToAsciiFrames, gifToAsciiTextFrames, imageToAsciiFrame, imageToAsciiTextFrame, renderFrameToCanvas, renderTextBackground, renderTextFrameToCanvas, renderTextToCanvas, snapshotAndDownload, videoToAsciiFrames, videoToAsciiTextFrames } from './core.js';
|
|
3
|
-
export {
|
|
3
|
+
export { C as CHARACTER_SETS } from './characters-BNTu2oEF.js';
|