asciify-engine 4.25.0 → 4.26.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.
Files changed (96) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/field.cjs +1 -1
  3. package/dist/field.d.cts +132 -275
  4. package/dist/field.d.ts +132 -275
  5. package/dist/field.js +1 -1
  6. package/dist/glyph-field-C2fQIlnq.d.cts +292 -0
  7. package/dist/glyph-field-DRC-7uVf.d.ts +292 -0
  8. package/dist/kit/{chunk-KS3TL3S2.js → chunk-2FH6GGV6.js} +1 -1
  9. package/dist/kit/chunk-2GAV4OAK.js +1 -0
  10. package/dist/kit/{chunk-3F6FTBMN.js → chunk-2LBQ7QJT.js} +1 -1
  11. package/dist/kit/chunk-3LJ5C3U3.js +1 -0
  12. package/dist/kit/{chunk-SQGJ263V.js → chunk-3MHEDZLZ.js} +1 -1
  13. package/dist/kit/{chunk-KTYCGGRO.js → chunk-3OD5BMF5.js} +1 -1
  14. package/dist/kit/{chunk-OVCIHOOS.js → chunk-3VEMKDBW.js} +1 -1
  15. package/dist/kit/{chunk-H4DBJULW.js → chunk-42KMN727.js} +1 -1
  16. package/dist/kit/{chunk-PND73YEV.js → chunk-6G5MPND3.js} +1 -1
  17. package/dist/kit/{chunk-CA5J25SV.js → chunk-6WU247CB.js} +1 -1
  18. package/dist/kit/{chunk-6L2GAV5C.js → chunk-776H2BJ7.js} +1 -1
  19. package/dist/kit/{chunk-4SHQA3CO.js → chunk-7DXSG526.js} +1 -1
  20. package/dist/kit/{chunk-L3P7ZDSK.js → chunk-7M2FFUZ3.js} +1 -1
  21. package/dist/kit/{chunk-XYLLL2PQ.js → chunk-7NVKRDKE.js} +1 -1
  22. package/dist/kit/chunk-AIGAJMNN.js +1 -0
  23. package/dist/kit/{chunk-XXPDXJMQ.js → chunk-B3TY6UXJ.js} +1 -1
  24. package/dist/kit/chunk-BFBG3VHI.js +1 -0
  25. package/dist/kit/{chunk-6XNIZ52V.js → chunk-CG6SGQMY.js} +1 -1
  26. package/dist/kit/{chunk-KBXVIAWS.js → chunk-CGSWUO67.js} +1 -1
  27. package/dist/kit/{chunk-YDP6566E.js → chunk-DAJSBX6H.js} +1 -1
  28. package/dist/kit/{chunk-PFNFW4ZI.js → chunk-DCLJHSWM.js} +1 -1
  29. package/dist/kit/{chunk-QTVMD62E.js → chunk-DMRPBFLW.js} +1 -1
  30. package/dist/kit/{chunk-CR7QS3B3.js → chunk-E3FPFANJ.js} +1 -1
  31. package/dist/kit/{chunk-LUOIH2EM.js → chunk-EKYEA7Z4.js} +1 -1
  32. package/dist/kit/{chunk-QKZYCROD.js → chunk-F6F2C3RH.js} +1 -1
  33. package/dist/kit/chunk-FEAFQY7O.js +1 -0
  34. package/dist/kit/{chunk-A6EDU3UT.js → chunk-FHN3PPSI.js} +1 -1
  35. package/dist/kit/{chunk-FIWIUXNV.js → chunk-FPCCX4FM.js} +1 -1
  36. package/dist/kit/{chunk-EHYFSX5K.js → chunk-FWODCYYJ.js} +1 -1
  37. package/dist/kit/{chunk-PZAQLUAS.js → chunk-GBNV3GXG.js} +1 -1
  38. package/dist/kit/chunk-GF72XM4C.js +1 -0
  39. package/dist/kit/{chunk-MRDEO5HZ.js → chunk-GKR3ROYR.js} +1 -1
  40. package/dist/kit/{chunk-D4KCZSIP.js → chunk-H5KHXZWR.js} +1 -1
  41. package/dist/kit/{chunk-EJ3W4FN6.js → chunk-I5R2347P.js} +1 -1
  42. package/dist/kit/{chunk-ZYYLWSPY.js → chunk-IBNDCKEX.js} +1 -1
  43. package/dist/kit/{chunk-A73S2BCE.js → chunk-ILXVBO7M.js} +1 -1
  44. package/dist/kit/{chunk-QZHZWO7N.js → chunk-JELJEEJO.js} +1 -1
  45. package/dist/kit/{chunk-XDNCXCR7.js → chunk-K6JX64AS.js} +1 -1
  46. package/dist/kit/{chunk-2D2SG6FW.js → chunk-KCEYRIU4.js} +1 -1
  47. package/dist/kit/{chunk-SE6MQQLB.js → chunk-KDROJANO.js} +1 -1
  48. package/dist/kit/{chunk-ODMQERGZ.js → chunk-KEE55QSD.js} +1 -1
  49. package/dist/kit/{chunk-YBBYCUFP.js → chunk-KFXMLIVF.js} +1 -1
  50. package/dist/kit/{chunk-P6S6HSN3.js → chunk-KLRF3S7O.js} +1 -1
  51. package/dist/kit/{chunk-ANLBW5RI.js → chunk-KXI3T72F.js} +1 -1
  52. package/dist/kit/{chunk-PDNKLLBI.js → chunk-KY5KCIZE.js} +1 -1
  53. package/dist/kit/{chunk-PCGRRX5P.js → chunk-LE53AVKR.js} +1 -1
  54. package/dist/kit/{chunk-MIA6TUQC.js → chunk-LVCGC3SO.js} +1 -1
  55. package/dist/kit/chunk-M5VVLYI2.js +1 -0
  56. package/dist/kit/{chunk-KJJJORN6.js → chunk-MJJSZS23.js} +1 -1
  57. package/dist/kit/{chunk-EPVZIGEZ.js → chunk-MZFK765W.js} +1 -1
  58. package/dist/kit/{chunk-G4BQYQJ6.js → chunk-NF4WVWAC.js} +1 -1
  59. package/dist/kit/{chunk-JRSCTMFM.js → chunk-NW4U2YRE.js} +1 -1
  60. package/dist/kit/chunk-ORSI57T2.js +1 -0
  61. package/dist/kit/{chunk-GCIZKMJL.js → chunk-QSTDYL35.js} +1 -1
  62. package/dist/kit/{chunk-B6GZ645M.js → chunk-QVICL57J.js} +1 -1
  63. package/dist/kit/{chunk-JAM46FF6.js → chunk-RXOPJJC4.js} +1 -1
  64. package/dist/kit/{chunk-YL2AXWRA.js → chunk-SDSW7422.js} +1 -1
  65. package/dist/kit/{chunk-WT3XOWAI.js → chunk-TRDA73HN.js} +1 -1
  66. package/dist/kit/{chunk-VFV7HZ3G.js → chunk-UOYBFLGJ.js} +1 -1
  67. package/dist/kit/{chunk-EWPT56TR.js → chunk-UVLKCAKH.js} +1 -1
  68. package/dist/kit/{chunk-EHXSXMBE.js → chunk-VBWG7HQA.js} +1 -1
  69. package/dist/kit/{chunk-2TQW2PIG.js → chunk-VIUEAEBX.js} +1 -1
  70. package/dist/kit/{chunk-BBOSHBZK.js → chunk-VV2KP7ZW.js} +1 -1
  71. package/dist/kit/{chunk-4XT5IKM3.js → chunk-VX2AD3M7.js} +1 -1
  72. package/dist/kit/{chunk-2KFBIOVS.js → chunk-W4U5CK6L.js} +1 -1
  73. package/dist/kit/{chunk-6YVZZ3DO.js → chunk-WI2AF2KE.js} +1 -1
  74. package/dist/kit/{chunk-HMW5NRUV.js → chunk-XUCYFWC3.js} +1 -1
  75. package/dist/kit/{chunk-V6GEQ5Y5.js → chunk-Z2FRNFMB.js} +1 -1
  76. package/dist/kit/{chunk-NPJ77LDC.js → chunk-Z3KD6CLE.js} +1 -1
  77. package/dist/kit/{chunk-ONVONNUH.js → chunk-ZCXNGJGB.js} +1 -1
  78. package/dist/kit/{chunk-IUX46UDR.js → chunk-ZWZZMU5P.js} +1 -1
  79. package/dist/kit.cjs +1 -1
  80. package/dist/kit.d.cts +1 -1
  81. package/dist/kit.d.ts +1 -1
  82. package/dist/kit.js +1 -1
  83. package/dist/studio-worker.js +1 -0
  84. package/dist/studio.cjs +1 -1
  85. package/dist/studio.js +1 -1
  86. package/package.json +2 -1
  87. package/skills/asciify-engine/SKILL.md +2 -2
  88. package/skills/asciify-engine/references/performance.md +1 -1
  89. package/dist/kit/chunk-2JQ4MRIP.js +0 -1
  90. package/dist/kit/chunk-BJRPY7UB.js +0 -1
  91. package/dist/kit/chunk-EK4GIXIO.js +0 -1
  92. package/dist/kit/chunk-PFQBEWCF.js +0 -1
  93. package/dist/kit/chunk-SAQJAH2I.js +0 -1
  94. package/dist/kit/chunk-SVXRMHUJ.js +0 -1
  95. package/dist/kit/chunk-UO4U32P7.js +0 -1
  96. package/dist/kit/chunk-XVB3B3FV.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asciify-engine",
3
- "version": "4.25.0",
3
+ "version": "4.26.0",
4
4
  "description": "Framework-agnostic ASCII art engine. Convert images, videos, and GIFs into ASCII art rendered on canvas, or run full-bleed GPU character fields with a fluid cursor wake.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -96,6 +96,7 @@
96
96
  "test:hover": "node tests/hover-browser.mjs",
97
97
  "test:finish": "node tests/hero-finish-browser.mjs",
98
98
  "test:studio": "node tests/studio-browser.mjs",
99
+ "test:parity": "node tests/studio-parity-browser.mjs",
99
100
  "bench:dither": "node scripts/benchmark-dither.mjs",
100
101
  "bench:hover": "node scripts/benchmark-hover-fields.mjs"
101
102
  },
@@ -2,13 +2,13 @@
2
2
  name: asciify-engine
3
3
  description: Apply Asciify the way asciify.org does - ASCII components and backgrounds that belong in a real interface, inked from the theme, clear around text, inside the page's radii and motion. Use for UI components in characters (loading, status, toasts, tabs, AI states, charts, transitions, pages), animated ASCII backgrounds, and also photo, video and GIF conversion, GPU character fields, artwork looks for wallpapers, posters and prints, art styles and export, hover and motion, layered typography and rendering performance.
4
4
  metadata:
5
- tested-engine: "4.25.0"
5
+ tested-engine: "4.26.0"
6
6
  updated: "2026-10-17"
7
7
  ---
8
8
 
9
9
  # Asciify Engine
10
10
 
11
- Use the published `asciify-engine` npm package. Tested against **4.25.0**. Check the application's installed version and its public types before using newer options; a local checkout can contain unpublished changes.
11
+ Use the published `asciify-engine` npm package. Tested against **4.26.0**. Check the application's installed version and its public types before using newer options; a local checkout can contain unpublished changes.
12
12
 
13
13
  - Agent entry: https://asciify.org/skill (redirects to this Markdown document).
14
14
  - Components: https://asciify.org/components · Looks: https://asciify.org/looks · Backgrounds: https://asciify.org/backgrounds
@@ -12,7 +12,7 @@ What `asciify-engine` promises a host page, and the default budgets. Measured by
12
12
  - **Mounting is spread out.** Kit fields mount when they come within half a viewport of the screen, at most one per frame however many a host starts in one task (a route change, a long list). Shader programs link with `KHR_parallel_shader_compile` where the browser has it.
13
13
  - **Nothing runs when nothing changes.** A still field stops its frame loop. Fields off screen, in a hidden tab, in a `display: none` host or with zero size do not draw. Reduced motion settles every component on a still.
14
14
  - **Ambient motion is capped.** Drift, scenes and self-animating components draw at most 60 frames a second on any screen (30 with two cores or less, 2 GB of memory or less, or Save-Data). The pointer's wake, lantern, trail, pulses and anything under the pointer keep the screen's full rate.
15
- - **Studio hovers stay responsive.** A live `mountStudio` hover renders at most 60 times a second and never more often than leaves half the main thread free, then ends on its settled frame.
15
+ - **Studio draws off the main thread.** `mountStudio` and `mountStudioMedia` draw in a dedicated worker on `OffscreenCanvas`; the page only posts pointer input and shows each finished frame (an `ImageBitmap`, no copy), so a first frame or a hover never blocks the page. A hover draws at the screen's full rate: workers take turns drawing frames (up to three for a small artwork, within 6 megapixels of frames in all), and Pointillism's dots are filled on the GPU. Output is pixel-identical to drawing on the page; Pointillism's GPU dots match within rounding. Where `OffscreenCanvas` 2D is missing, or a worker cannot start, the same renderer draws on the page at most 60 times a second, never taking more than half the main thread. `destroy()` terminates the workers.
16
16
  - **Listeners are passive** where the event allows, and every listener, observer, frame, timer, object URL and context is released by `destroy()`, including after a hundred quick mount and destroy cycles.
17
17
  - **No global CSS but scoped fallbacks.** The few components that inject styles use one `<style id="ascii-kit-…">` each, with every rule inside `:where()` (zero specificity). No console output in normal use.
18
18
 
@@ -1 +0,0 @@
1
- import{parseColor as t,MONO as e,pixelSnap as n,fbm as o,hash2 as a,band as r,ditherIndex as i,toneAlpha as c}from"./chunk-ZCHGV2CV.js";import{mountCanvas as h}from"./chunk-KTYCGGRO.js";import{hexRgb as s}from"./chunk-PFQBEWCF.js";function l(h,s,l,f,M={x:.5,y:.5},m={}){const{fontSize:g=13,charAspect:u=.62,lineHeightRatio:d=1.3,chars:p=" .:-=+*#%@",baseColor:x=null,accentColor:$,accentThreshold:b=.52,mouseInfluence:S=.4,mouseFalloff:C=2.8,speed:k=1,vortex:v=!0,sparkles:y=!1,breathe:z=!0,lightMode:j=!1}=m,w=Array.from(p),A=g*u,F=g*d,G=Math.ceil(s/A),R=Math.ceil(l/F),T=M.x,B=M.y,H=$?t($):null;h.clearRect(0,0,s,l),h.font=`${g}px ${e}`;const V=n(h);h.textBaseline="top";const W=f*k,q=z?.12*(.5*Math.sin(.22*W)+.5):0;for(let t=0;t<R;t++)for(let e=0;e<G;e++){const n=e/G,s=t/R,l=.045,f=.08*W,M=.06,g=.45*((.5*Math.sin(.08*e+.05*t+.6*W)+.5+(.5*Math.sin(.03*e-.07*t+.4*W)+.5)+(.5*Math.sin(.05*e+.03*t+.8*W)+.5))/3)+.35*(.5*o(e*l+f,t*l*1.4-.7*f)+.5)+.2*(.5*Math.sin((e+.65*t)*M+1.1*W)+.5)+q,u=n-T,d=s-B,p=Math.sqrt(u*u+d*d);let $=0;if(v&&p<.35){const t=Math.atan2(d,u),e=Math.sin(4*t+2.2*W-14*p),n=Math.max(0,1-p/.35);$=e*n*n*.22}const k=g*(1-S)+(Math.max(0,1-p*C)+.5*$)*S+.15*$,z=Math.min(1,Math.max(0,k));let E=z;if(y&&z>.72){const n=Math.floor(8*W),o=a(7*e+3*n,11*t+n);o>.88&&(E=Math.min(1,z+4*(o-.88)))}const I=r(E,.32,.9);if(I<=0)continue;const K=i(I,w.length,e,t,m.ditherStrength);if(" "===w[K])continue;const O=c(I);h.fillStyle=H&&E>b?`rgba(${H.r},${H.g},${H.b},${O})`:x?x.replace("{a}",String(O)):j?`rgba(111,109,103,${O})`:`rgba(143,141,134,${O})`,h.fillText(w[K],V(e*A),V(t*F))}}var f={id:"wave",name:"Wave",description:"An interference field with a soft vortex at the cursor and a slow breath.",cellSize:13,speed:.6,cursor:!0,mount:t=>h(t,(t,e,n,o,a,r)=>{const[i,c,h]=s(r.ink);l(t,e,n,o,a,{ditherStrength:r.ditherStrength,fontSize:r.fontSize,chars:r.chars,lightMode:r.lightMode,baseColor:`rgba(${i},${c},${h},{a})`,accentColor:r.accent})})};export{l as renderWaveBackground,f as wave};//# sourceMappingURL=chunk-2JQ4MRIP.js.map
@@ -1 +0,0 @@
1
- import{parseColor as t,hash2 as e}from"./chunk-ZCHGV2CV.js";import{mountCanvas as o}from"./chunk-KTYCGGRO.js";function n(o,n,c,r,s={x:.5,y:.5},l={}){const{fontSize:a=14,chars:i=" . · * + ° ★",accentColor:h,color:f,speed:d=1,count:g=180,lightMode:m=!1}=l,p=h??(m?"#6b8700":"#d4ff00");o.clearRect(0,0,n,c),o.textBaseline="middle",o.textAlign="center";const M=n*(.2+.6*s.x),x=c*(.2+.6*s.y),$=.65*Math.sqrt(n*n+c*c);let u=255,S=255,b=255;if(m&&(u=55,S=55,b=55),f){const e=t(f);e&&(u=e.r,S=e.g,b=e.b)}let C=212,k=255,z=0;const y=t(p);y&&(C=y.r,k=y.g,z=y.b);const A=i.replace(/ /g,"").split("");if(0!==A.length){for(let t=0;t<g;t++){const s=e(17*t,3)*Math.PI*2,l=(r*(.15+.85*e(31*t,7))*d*.22+e(13*t,11))%1,i=M+Math.cos(s)*l*$,h=x+Math.sin(s)*l*$;if(i<-20||i>n+20||h<-20||h>c+20)continue;const f=Math.max(6,a*(.4+.9*l));o.font=`${f}px monospace`;const g=A[Math.min(A.length-1,Math.floor(l*A.length))],p=l>.72,y=m?.85*l:.2*l;o.fillStyle=p?`rgba(${C},${k},${z},${Math.min(m?.92:.32,2.2*y)})`:`rgba(${u},${S},${b},${y})`,o.fillText(g,i,h)}o.textAlign="left"}}var c={id:"stars",name:"Stars",description:"A sparse starfield that twinkles, drifts and leans toward the cursor.",cellSize:14,speed:1,cursor:!0,mount:t=>o(t,(t,e,o,c,r,s)=>n(t,e,o,c,r,{fontSize:s.fontSize,chars:s.chars,lightMode:s.lightMode,color:s.ink,accentColor:s.accent}))};export{n as renderStarsBackground,c as stars};//# sourceMappingURL=chunk-BJRPY7UB.js.map
@@ -1 +0,0 @@
1
- import{MONO as t,GRAPHITE_LIGHT as o,GRAPHITE_DARK as e,pixelSnap as n,parseColor as r,hash2 as c,band as h,ditherIndex as i,toneAlpha as l}from"./chunk-ZCHGV2CV.js";import{mountCanvas as a}from"./chunk-KTYCGGRO.js";function s(a,s,f,M,g={}){const{fontSize:d=13,color:u,accentColor:S,speed:$=.4,layers:I=4,turbulence:P=.8,lightMode:b=!1}=g,p=.62*d,m=1.3*d,k=Math.ceil(s/p),C=Math.ceil(f/m);a.clearRect(0,0,s,f),a.font=`${d}px ${t}`,a.textBaseline="top";const x=b?o:e;let z=x.r,w=x.g,y=x.b;const G=n(a);if(u){const t=r(u);t&&(z=t.r,w=t.g,y=t.b)}let j=z,v=w,R=y;const T=S?r(S):null;T&&(j=T.r,v=T.g,R=T.b);const V=M*$,A=g.chars?Array.from(g.chars):void 0,B=["-","\\","|","/"];for(let t=0;t<C;t++){const o=t/C;for(let e=0;e<k;e++){const n=e/k;let r=0,s=0;for(let t=0;t<I;t++){const e=c(13*t,7*t+3),h=1.1+2.4*e,i=.9+2*c(29*t,11*t+1),l=e*Math.PI*6,a=(.2+.5*c(41*t,17*t))*(t%2==0?1:-1.3),f=Math.sin(n*h*Math.PI*2+V*a+l),M=Math.cos(o*i*Math.PI*2+V*a*.6+1.7*l),g=Math.sin(n*i*Math.PI*P+o*h*Math.PI*P+V*a*.4);r+=Math.atan2(M+.3*g,f),s+=.5*(f*M+1)}const f=r/I,M=h(s/I,.54,.74);if(M<=0)continue;const d=(f%Math.PI+Math.PI)%Math.PI,u=Math.round(d/(Math.PI/4))%B.length;if(!A&&g.ditherStrength&&0===i(M,2,e,t,g.ditherStrength))continue;const S=A?A[i(M,A.length,e,t,g.ditherStrength)]:B[u];if(" "===S)continue;const $=!!T&&M>.85,b=l(M);a.fillStyle=$?`rgba(${j},${v},${R},${b})`:`rgba(${z},${w},${y},${b})`,a.fillText(S,G(e*p),G(t*m))}}}var f={id:"silk",name:"Silk",description:"Long ribbons that follow a slow flow field.",cellSize:13,speed:1,cursor:!1,mount:t=>a(t,(t,o,e,n,r,c)=>s(t,o,e,n,{ditherStrength:c.ditherStrength,fontSize:c.fontSize,chars:c.chars,lightMode:c.lightMode,color:c.ink,accentColor:c.accent}))};export{s as renderSilkBackground,f as silk};//# sourceMappingURL=chunk-EK4GIXIO.js.map
@@ -1 +0,0 @@
1
- import{poster as e,watchPointer as t,liveField as n,requestFieldFrame as o,watchVisibility as r,watchTheme as i,watchMotionPreference as a,cancelFieldFrame as s,disposeKit as c,setPosterSource as l,ambientFactor as u}from"./chunk-XVB3B3FV.js";import{isGlyphFieldSupported as d}from"../field.js";var p,f,h=(e,t=0,n=1)=>Math.min(n,Math.max(t,e)),m=(e,t)=>{const n=43758.5453*Math.sin(127.1*e+311.7*t);return n-Math.floor(n)},g=(e,t=3)=>1-(1-h(e))**t,y=(e,t,n)=>{const o=h((n-e)/(t-e));return o*o*(3-2*o)},v=e=>{if(e<=0)return 0;if(e>=1)return 1;const t=(e,t,n)=>3*t*e*(1-e)**2+3*n*e*e*(1-e)+e**3;let n=0,o=1,r=e;for(let i=0;i<22;i++)r=(n+o)/2,t(r,.16,.3)<e?n=r:o=r;return t(r,1,1)},b=()=>"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,x=e=>e??b(),w={scene:"none",background:"transparent",color:"ink",levels:"none",fit:"cover",focus:{x:.5,y:.5},vignette:0,drift:0,hover:"none",shade:0,contrast:1,brightness:0,gamma:1,maxPixelRatio:2,clear:!1};function M(e,t,n){let o=(e??"").trim();const r=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/.exec(o);if(r?o=k(t,r[1])||(r[2]??"").trim():o.startsWith("--")&&(o=k(t,o)),!o)return n?M(n,t):null;if(/^#[\da-f]{6}$/i.test(o))return o.toLowerCase();if(/^#[\da-f]{3}$/i.test(o))return`#${[...o.slice(1)].map(e=>e+e).join("")}`.toLowerCase();const i=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(o);if(i)return C([+i[1],+i[2],+i[3]]);if(void 0===f)try{f="undefined"==typeof document?null:Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0})}catch{f=null}if(!f)return n?M(n,t):null;f.clearRect(0,0,1,1),f.fillStyle="#000",f.fillStyle=o,f.fillRect(0,0,1,1);const[a,s,c]=f.getImageData(0,0,1,1).data;return C([a,s,c])}var k=(e,t)=>"function"==typeof getComputedStyle?getComputedStyle(e).getPropertyValue(t).trim():"",C=e=>`#${e.map(e=>Math.round(h(e,0,255)).toString(16).padStart(2,"0")).join("")}`,R=e=>{const t=parseInt(e.slice(1,7),16);return[t>>16&255,t>>8&255,255&t]},S=(e,t,n)=>{const o=R(e),r=R(t);return C(o.map((e,t)=>e+(r[t]-e)*n))};function $(e){const t="function"==typeof getComputedStyle?getComputedStyle(e):null,n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?/i.exec(t?.backgroundColor??"");if(n){if((void 0===n[4]?1:n[4].endsWith("%")?parseFloat(n[4])/100:parseFloat(n[4]))>=.5)return.2126*+n[1]+.7152*+n[2]+.0722*+n[3]<128}const o=M(t?.color??"",e);if(!o)return"function"==typeof matchMedia&&matchMedia("(prefers-color-scheme: dark)").matches;const[r,i,a]=R(o);return.2126*r+.7152*i+.0722*a>140}function O(){const e=[];return{set(t,n,o){e.some(([e,o])=>e===t&&o===n)||e.push([t,n,t.style.getPropertyValue(n)]),t.style.setProperty(n,o)},restore(){for(const[t,n,o]of e.reverse())o?t.style.setProperty(n,o):t.style.removeProperty(n);e.length=0}}}function j(e="",t=!1){const n=document.createElement("span");return n.setAttribute("style","position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0"),t&&n.setAttribute("aria-live","polite"),n.textContent=e,n}function P(e,t){const n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.width/(e.offsetWidth||n.width||1)||1;return{x:(o.left-n.left)/r,y:(o.top-n.top)/r,w:o.width/r,h:o.height/r}}function W(e,t){const n={...e,...t},o=e.look,r=t.look;return r&&(n.look=Object.fromEntries(Object.entries({...o,...r}).filter(([,e])=>void 0!==e))),n}var E=new WeakMap,F=e=>E.get(e)?.()??null;function A(c){const{host:l,layer:f="over",outset:h=0,kit:m}=c;if("undefined"==typeof document)return null;const g=`position:absolute;left:${-h}px;top:${-h}px;width:calc(100% + ${2*h}px);height:calc(100% + ${2*h}px);pointer-events:none;z-index:${"under"===f?-1:"auto"}`;if(!d())return m?.current.poster&&e(l,m.current.poster,g,m),null;const y=O(),v=document.createElement("canvas"),x=document.createElement("canvas"),k=x.getContext("2d");if(!k)return null;"static"===getComputedStyle(l).position&&y.set(l,"position","relative"),"under"===f&&y.set(l,"isolation","isolate"),v.setAttribute("aria-hidden","true"),v.dataset.asciiKit="";const C=v.style;C.position="absolute",C.left=C.top=-h+"px",C.width=C.height=`calc(100% + ${2*h}px)`,C.pointerEvents="none",C.zIndex="under"===f?"-1":"",l.appendChild(v);const R=()=>{const e=getComputedStyle(l);H.canvas.style.borderRadius=[e.borderTopLeftRadius,e.borderTopRightRadius,e.borderBottomRightRadius,e.borderBottomLeftRadius].map(e=>h&&/^[\d.]+px$/.test(e)?`${parseFloat(e)+h}px`:e).join(" ")};let S=$(l);const j=()=>M(c.ink(S),l)??M(getComputedStyle(l).color,l)??(S?"#d8d6cf":"#1d1d1b");let W=!1,F=!1,A=!0,B=!1,I=-1/0,z=-1/0;const T=t({target:l,move:e=>{z=e.timeStamp},leave(){}}),H=n({host:l,canvas:v,kit:m,place:g,options:()=>({...w,...c.look(),ink:j(),interactionTarget:l,label:""}),onMount:(e,t)=>{E.set(t,K),t.removeAttribute("role"),t.removeAttribute("aria-label"),e.ready.then(G,()=>{}),G()},onRelease:()=>{W&&s(X),W=!1},onFail:()=>{ee(),c.onFail?.()}}),L=H.field;R();const V=()=>!!(c.reducedMotion()??b()),D=e=>P(H.canvas,e),q=e=>{const t=H.canvas,n=Math.max(1,t.clientWidth||l.clientWidth+2*h),o=Math.max(1,t.clientHeight||l.clientHeight+2*h),r=c.resolution??1,[i,a]="function"==typeof r?r(n,o):[Math.max(1,Math.round(n*r)),Math.max(1,Math.round(o*r))];x.width===i&&x.height===a||(x.width=i,x.height=a),k.setTransform(1,0,0,1,0,0),k.globalAlpha=1,k.globalCompositeOperation="source-over",k.filter="none",k.fillStyle="#000",k.fillRect(0,0,i,a);let s=!1;try{s=c.paint({pen:k,width:i,height:a,w:n,h:o,scale:i/n,now:e,still:V(),dark:S,box:D})}catch(e){"undefined"!=typeof console&&console.error(e)}return L.setSource(x),B||L.redraw(),s};function K(){const e=H.canvas,t=Math.max(1,e.clientWidth||l.clientWidth+2*h),n=Math.max(1,e.clientHeight||l.clientHeight+2*h),o=c.resolution??1,[r,i]="function"==typeof o?o(t,n):[Math.max(1,Math.round(t*o)),Math.max(1,Math.round(n*o))],a=document.createElement("canvas");a.width=r,a.height=i;const s=a.getContext("2d");if(!s)return null;s.fillStyle="#000",s.fillRect(0,0,r,i);try{c.paint({pen:s,width:r,height:i,w:t,h:n,scale:r/t,now:performance.now(),still:!0,dark:S,box:D})}catch{return null}return a}function X(e){if(W=!1,B||F||!H.live)return;if(e-I<(p??(p=(()=>{const e="undefined"==typeof navigator?void 0:navigator;return 1e3/(e&&(e.hardwareConcurrency>0&&e.hardwareConcurrency<=2||e.deviceMemory&&e.deviceMemory<=2||e.connection?.saveData)?30:60)-2})()))*u()&&e-z>1e3)return W=!0,void o(X);I=e;!q(e)||V()||!A||"undefined"!=typeof document&&document.hidden||(W=!0,o(X))}function G(){W||B||F||!H.live||(W=!0,o(X))}E.set(v,K);const J="function"==typeof ResizeObserver?new ResizeObserver(()=>{R(),L.resize(),!H.live||B||F||q(performance.now()),G()}):null;J?.observe(l);const N="function"==typeof IntersectionObserver?new IntersectionObserver(([e])=>{A=e.isIntersecting,A&&G()},{rootMargin:"64px"}):null;N?.observe(l);const Q=r(()=>{document.hidden||G()});let U=!1;const Y=()=>{U=!1,B||(S=$(l),L.update({ink:j()}),c.onTheme?.(),G())},Z=i(()=>{U||B||(U=!0,o(Y))}),_=a(G);function ee(){B||(B=!0,W&&s(X),U&&s(Y),W=U=!1,J?.disconnect(),N?.disconnect(),Q(),T(),Z(),_(),H.destroy(),y.restore(),x.width=x.height=1)}return H.start(),H.failed?(ee(),null):{field:L,get canvas(){return H.canvas},get live(){return H.live},kick:G,refresh(){B||(S=$(l),L.update({...w,...c.look(),ink:j()}),G())},still:V,dark:()=>S,box:D,play(){F&&(F=!1,L.play(),G())},pause(){F=!0,W&&s(X),W=!1,L.pause()},destroy:ee}}function B(e,t,n,o,r=()=>{}){let i=!1;const a={get supported(){return!!e()&&!i},get field(){return i?null:e()?.field??null},update(e){if(i)return;t.current=W(t.current,e);const o=e.poster;o&&l(t,o),n(t.current)},play(){i||e()?.play()},pause(){i||e()?.pause()},destroy(){i||(i=!0,e()?.destroy(),c(t),r())}};return Object.defineProperties(o,Object.getOwnPropertyDescriptors(a))}export{w as BASE_LOOK,P as boxIn,h as clamp,g as easeOut,B as handle,m as hash,R as hexRgb,v as house,$ as isDark,W as mergeOptions,S as mixHex,A as mountSurface,b as prefersReduced,x as reducedFrom,M as resolveColor,F as settledSource,y as smoothstep,j as srOnly,O as styleKeeper,C as toHex};//# sourceMappingURL=chunk-PFQBEWCF.js.map
@@ -1 +0,0 @@
1
- import{parseColor as t,hash2 as o}from"./chunk-ZCHGV2CV.js";import{mountCanvas as e}from"./chunk-KTYCGGRO.js";function n(e,n,c,l,i={}){const{fontSize:r=13,chars:a="0123456789ABCDEF@#$&*+=/<>",accentColor:s,color:f,speed:h=1,density:g=.55,tailLength:d=14,lightMode:$=!1}=i,p=s??($?"#6b8700":"#d4ff00"),m=.62*r,u=1.4*r,M=Math.ceil(n/m),C=Math.ceil(c/u);e.clearRect(0,0,n,c),e.font=`${r}px monospace`,e.textBaseline="top";let b=255,S=255,x=255;if($&&(b=55,S=55,x=55),f){const o=t(f);o&&(b=o.r,S=o.g,x=o.b)}let z=212,k=255,y=0;const G=t(p);G&&(z=G.r,k=G.g,y=G.b);const R=C+d;for(let t=0;t<M;t++){if(o(17*t,3)>g)continue;const n=(.5+1.5*o(31*t,7))*h,c=o(13*t,11)*R,i=Math.floor((l*n*7+c)%R),r=t*m;for(let n=0;n<=d;n++){const c=i-(d-n);if(c<0||c>=C)continue;const s=c*u,f=o(53*t+Math.floor(5*l+n),7*c),h=a[Math.floor(f*a.length)],g=n/d;if(n===d)e.fillStyle=`rgba(${z},${k},${y},${$?.7:.85})`;else{const t=$?.85*g:.15*g;e.fillStyle=`rgba(${b},${S},${x},${t})`}e.fillText(h,r,s)}}}var c={id:"rain",name:"Rain",description:"Columns of falling characters with bright heads.",cellSize:13,speed:1,cursor:!1,mount:t=>e(t,(t,o,e,c,l,i)=>n(t,o,e,c,{fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};export{c as rain,n as renderRainBackground};//# sourceMappingURL=chunk-SAQJAH2I.js.map
@@ -1 +0,0 @@
1
- import{parseColor as o,hash2 as t}from"./chunk-ZCHGV2CV.js";import{mountCanvas as l}from"./chunk-KTYCGGRO.js";import{mixHex as e}from"./chunk-PFQBEWCF.js";function r(l,e,r,a,i={}){const{fontSize:n=13,baseChars:f="ATCG",bridgeChars:h="-=≡",color:c="#00e5ff",color2:s="#ff4081",bridgeColor:b="#88ffcc",speed:g=1,helixCount:M,lightMode:p=!1}=i,d=.62*n,m=1.4*n,u=Math.ceil(e/d),C=Math.ceil(r/m),$=M??Math.max(1,Math.floor(e/80)),x=u/$,S=o(c)??{r:0,g:229,b:255},k=o(s)??{r:255,g:64,b:129},A=o(b)??{r:136,g:255,b:204};l.clearRect(0,0,e,r),l.font=`${n}px "JetBrains Mono", monospace`,l.textBaseline="top";const T=a*g,z=.35*x;for(let o=0;o<$;o++){const e=x*(o+.5);for(let r=0;r<C;r++){const a=r/C*Math.PI*6-1.8*T,i=e+Math.sin(a)*z,n=e+Math.sin(a+Math.PI)*z,c=Math.round(i),s=Math.round(n);if(c<0||c>=u)continue;const b=t(31*o+7*r,3),g=f[Math.floor(b*f.length)],M=.5*(Math.sin(a)+1),p=.5*(Math.sin(a+Math.PI)+1);if(l.globalAlpha=.35+.65*M,l.fillStyle=`rgb(${S.r},${S.g},${S.b})`,l.fillText(g,c*d,r*m),s>=0&&s<u){const e=t(53*o+11*r,7),a=f[Math.floor(e*f.length)];l.globalAlpha=.35+.65*p,l.fillStyle=`rgb(${k.r},${k.g},${k.b})`,l.fillText(a,s*d,r*m)}if(r%3===0){const e=Math.min(c,s),a=Math.max(c,s);if(a-e>1){const i=t(17*r+43*o,5),n=h[Math.floor(i*h.length)],f=.25*(M+p)+.2;l.globalAlpha=f,l.fillStyle=`rgb(${A.r},${A.g},${A.b})`;for(let o=e+1;o<a;o++)l.fillText(n,o*d,r*m)}}}}l.globalAlpha=1}var a={id:"dna",name:"DNA",description:"Double helices scroll past with base-pair letters.",cellSize:13,speed:1,cursor:!1,mount:o=>l(o,(o,t,l,a,i,n)=>r(o,t,l,a,{fontSize:n.fontSize,color:n.ink,color2:n.accent??e(n.ink,"#ffffff",.55),bridgeColor:e(n.ink,"#0c0d0b",.35)}))};export{a as dna,r as renderDnaBackground};//# sourceMappingURL=chunk-SVXRMHUJ.js.map
@@ -1 +0,0 @@
1
- import{MONO as t,GRAPHITE_LIGHT as e,GRAPHITE_DARK as o,pixelSnap as r,parseColor as n,band as c,ditherIndex as i,toneAlpha as a,vnoise as l}from"./chunk-ZCHGV2CV.js";import{mountCanvas as s}from"./chunk-KTYCGGRO.js";function h(s,h,f,d,g={x:.5,y:.5},u={}){const{fontSize:m=13,chars:M=" .:-=+*#%@",accentColor:p,color:$,octaves:x=4,speed:S=1,scale:b=1,accentThreshold:C=.9,mouseWarp:y=.3,lightMode:z=!1}=u,k=Array.from(M),G=.62*m,T=1.3*m,j=Math.ceil(h/G),v=Math.ceil(f/T);s.clearRect(0,0,h,f),s.font=`${m}px ${t}`,s.textBaseline="top";const w=z?e:o;let A=w.r,R=w.g,V=w.b;const q=r(s);if($){const t=n($);t&&(A=t.r,R=t.g,V=t.b)}let B=A,H=R,K=V;const N=p?n(p):null;N&&(B=N.r,H=N.g,K=N.b);const O=.035*b,W=d*S,Y=Math.min(6,Math.max(1,x)),Z=(t,e)=>{let o=0,r=.5,n=1,c=0;for(let i=0;i<Y;i++)o+=l(t*n,e*n)*r,c+=r,r*=.5,n*=2.1;return o/c};for(let t=0;t<v;t++)for(let e=0;e<j;e++){const o=e*O+.06*W,r=t*O*1.3-.04*W,n=e/j-g.x,l=t/v-g.y,h=Math.sqrt(n*n+l*l),f=y>0?.12*Math.max(0,1-h/y):0,d=Z(o+f*Math.sin(1.3*W+8*l),r+f*Math.cos(.9*W+8*n)),m=c(.5*d+.5,.7,.83);if(m<=0)continue;const M=k[i(m,k.length,e,t,u.ditherStrength)];if(" "===M)continue;const p=!!N&&m>C,$=a(m);s.fillStyle=p?`rgba(${B},${H},${K},${$})`:`rgba(${A},${R},${V},${$})`,s.fillText(M,q(e*G),q(t*T))}}var f={id:"noise",name:"Noise",description:"A slow fractal noise field that warps around the cursor.",cellSize:13,speed:.5,cursor:!0,mount:t=>s(t,(t,e,o,r,n,c)=>h(t,e,o,r,n,{ditherStrength:c.ditherStrength,fontSize:c.fontSize,chars:c.chars,lightMode:c.lightMode,color:c.ink,accentColor:c.accent}))};export{f as noise,h as renderNoiseBackground};//# sourceMappingURL=chunk-UO4U32P7.js.map
@@ -1 +0,0 @@
1
- import{mountGlyphField as e}from"../field.js";var t=new Set,n=0,o=0,r=null,a=[],i=0,s=1,l=0,c=0;function u(e){n=0,i&&e>i&&(a.push(e-i),a.length>120&&a.shift()),i=e,o=performance.now();const r=[...t];t.clear();for(const t of r)try{t(e)}catch(e){"undefined"!=typeof console&&console.error(e)}const u=performance.now()-o;if(l=.9*l+.1*u,e-c>500){c=e;const t=function(){if(a.length<20)return 1e3/60;const e=[...a].sort((e,t)=>e-t);return Math.min(1e3/60,Math.max(1e3/360,e[Math.floor(.2*e.length)]))}(),n=!1;(l>.5*t||n)&&s<3?s++:l<.2*t&&!n&&s>1&&s--}t.size||(i=0)}var d=()=>s;function m(e){t.add(e),n&&r!==requestAnimationFrame&&(n=0),n||(r=requestAnimationFrame,n=requestAnimationFrame(u))}function f(e){t.delete(e),!t.size&&n&&(cancelAnimationFrame(n),n=0,i=0)}var h=new Set,p=new Set,g=new Set,y=new Set,v=new Set,w=!1,b=null,k=null,x=null,E=null,M=e=>{let t=null;for(const n of h){if(n.target===window){(!n.near||n.near()||n.inside)&&n.move(e);continue}t??(t=e.composedPath());t.includes(n.target)?(n.inside=!0,n.move(e)):n.inside&&(n.inside=!1,n.leave())}},S=()=>{for(const e of h)e.inside=!1,e.leave()},L=()=>{for(const e of[...p])e()},A=()=>{for(const e of[...g])e()},C=()=>{for(const e of[...y])e()},P=e=>{for(const t of[...v])t(e)};function z(){const e=h.size+p.size+g.size+y.size+v.size>0;if("undefined"==typeof document)return;if(b!==document&&(w=!1,b=document,k=x=null,E=null),e===w)return;w=e;const t=e?"addEventListener":"removeEventListener";if("undefined"!=typeof window&&(window[t]?.("pointermove",M,{capture:!0,passive:!0}),window[t]?.("pointerdown",M,{capture:!0,passive:!0})),document[t]?.("pointerleave",S),document[t]?.("visibilitychange",L),("undefined"==typeof document?void 0:document.fonts)?.[t]?.("loadingdone",P),k??(k="function"==typeof matchMedia?matchMedia("(prefers-reduced-motion: reduce)"):null),x??(x="function"==typeof matchMedia?matchMedia("(prefers-color-scheme: dark)"):null),k?.[t]?.("change",A),x?.[t]?.("change",C),e){E??(E="function"==typeof MutationObserver?new MutationObserver(C):null);for(const e of[document.documentElement,document.body])e&&E?.observe(e,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]})}else E?.disconnect()}var W=(e,t)=>(e.add(t),z(),()=>{e.delete(t)&&z()});function F(e){const t=e.target;if("undefined"==typeof window||t===window||"undefined"==typeof document)return W(h,e);const n=t,o=n.getRootNode?.();if(n.ownerDocument===document&&(!o||o===document))return W(h,e);const r=e.move,a=()=>e.leave();return n.addEventListener("pointermove",r,{passive:!0}),n.addEventListener("pointerdown",r,{passive:!0}),n.addEventListener("pointerleave",a),()=>{n.removeEventListener("pointermove",r),n.removeEventListener("pointerdown",r),n.removeEventListener("pointerleave",a)}}var T=e=>W(p,e),O=e=>W(g,e),R=e=>W(y,e),$=()=>null,q=new WeakSet,j={ascii:{mark:"glyph",charset:" .:-=+*#%@"},blocks:{mark:"glyph",charset:" ░▒▓█"},braille:{mark:"glyph",charset:" ⠁⠃⠇⡇⣇⣧⣷⣿"},dots:{mark:"dot"},lines:{mark:"glyph",charset:" -═╪╬"},cross:{mark:"glyph",charset:" ·+xX#"},diagonal:{mark:"glyph",charset:" /╱╳"},diamond:{mark:"glyph",charset:" ·◇◈◆"},mixed:{mark:"glyph",charset:" .:+/◇#@"},pixel:{mark:"pixel"},mosaic:{mark:"mosaic"},lego:{mark:"lego"},voxel:{mark:"voxel"},disco:{mark:"disco"},dither:{mark:"dither"},hex:{mark:"hex"},led:{mark:"led"},cmyk:{mark:"cmyk"},stipple:{mark:"stipple"},engraving:{mark:"engraving"},crosshatch:{mark:"crosshatch"},woodblock:{mark:"woodblock"},risograph:{mark:"risograph"},pointillism:{mark:"pointillism"}},B=e=>"string"==typeof e&&Object.prototype.hasOwnProperty.call(j,e),I=/\p{L}/u,D=null,N=new Set,X=new Set;function H(e){const{charset:t,style:n}=e??{};D=e?{...t?{charset:t}:{},...B(n)?{style:n}:{}}:null;for(const e of X)e.relook();for(const e of[...N])e(D)}var V=()=>D;function _(e){return N.add(e),()=>{N.delete(e)}}var G=12,J=new Set,K=null,Q=null,U=0,Y=-1e9,Z=0,ee=!1,te=!1,ne=()=>{const e=Q?.timeline?.currentTime;return"number"==typeof e?e:null};function oe(e){G=Number.isFinite(e)&&e>=1?Math.floor(e):12,be()}var re=()=>G,ae=()=>"undefined"!=typeof performance?performance.now():Date.now(),ie=()=>"number"==typeof innerHeight?innerHeight:0;function se(e,t=e.getBoundingClientRect()){if(!1===e.isConnected)return 1/0;if("function"==typeof e.getClientRects&&0===e.getClientRects().length)return 1/0;const n=t.bottom<0?-t.bottom:t.top-ie();return n>0?n:0}function le(){try{const e=Q?.querySelectorAll?.("dialog:modal");return e?.length?e[e.length-1]:null}catch{return null}}var ce=1e8;function ue(e,t){if(e.eager)return void(e.wanted=!0);const n=ie(),o=se(e.host,t);!n||o<=.5*n?e.wanted=!0:o>1*n&&(e.wanted=!1)}function de(e){let t=!1;for(const n of e)if(n?.target)for(const e of J)e.host===n.target&&(ue(e,n.boundingClientRect??void 0),t=!0);t&&be()}var me=()=>be(),fe=-1e9,he=0,pe=()=>{const e=ae();return e>=fe&&e-fe<140},ge=()=>{fe=ae(),clearTimeout(he),he=setTimeout(()=>be(),140)},ye=null,ve=e=>{ye!==e&&(ye?.removeEventListener?.("close",me,!0),ye?.removeEventListener?.("scroll",ge,!0),e?.addEventListener?.("close",me,!0),e?.addEventListener?.("scroll",ge,{capture:!0,passive:!0}),e||clearTimeout(he),ye=e)};function we(e){Q!==e.doc&&(Q=e.doc,J.clear(),U=Z=0,Y=fe=-1e9),ve(Q),J.add(e);const t=function(){const e="function"==typeof IntersectionObserver?IntersectionObserver:null;if(!e)return null;if(K?.ctor!==e){K?.list.forEach(e=>e.disconnect()),K={ctor:e,list:["50% 0px","100% 0px","0px"].map(t=>new e(de,{rootMargin:t}))};for(const e of J)K.list.forEach(t=>t.observe(e.host))}return K.list}();t?.forEach(t=>t.observe(e.host)),t?ue(e):e.wanted=!0,be()}function be(e=!1){if(ee)te=!0;else{ee=!0;try{do{te=!1;const t=ae(),n=ne();(e||(null===n?t-Y>16||t<Y:n!==Y))&&(Y=n??t,Z=0);for(const e of J)!1===e.host.isConnected&&(e.wanted=!1);for(const e of J)e.live&&!e.wanted&&e.release();const o=[...J].filter(e=>e.live&&!e.shared),r=le(),a=e=>!!r&&!r.contains(e.host),i=e=>se(e.host)+(a(e)?ce:0),s=e=>e.eager&&!a(e),l=()=>o.filter(e=>e.live&&!e.shared).map(e=>[e,i(e)+(s(e)?0:1e9)]).sort((e,t)=>t[1]-e[1]);for(let e=o.length-G,t=e>0?l():[];e>0;e--)t.shift()?.[0].release();const c=$(),u=[...J].filter(e=>e.wanted&&!e.live).map(e=>[e,e.eager?-1:i(e)]).sort((e,t)=>e[1]-t[1]);let d=0;const m=pe();for(const[t,n]of u){if(!J.has(t)||t.live)continue;if(m&&!t.eager&&(n>0||t.poster))continue;if(c&&c.roomy,!t.eager&&Z>=4&&(!e||d)){U||(U=requestAnimationFrame(()=>{U=0,be(!0)}));break}if(o.filter(e=>e.live&&!e.shared).length>=G){const e=l()[0]?.[0];if(!e||(s(e)?!t.eager||i(e)<=i(t):!t.eager&&i(e)<=n))break;e.release()}const r=ae();t.mount(),Z+=ae()-r,d++,t.live&&!t.shared&&o.push(t)}}while(te)}finally{ee=!1}}}var ke='ui-monospace, "SF Mono", Menlo, Consolas, monospace',xe=new Map;function Ee(e,t=ke){const n=`${t}\0${e}`,o=xe.get(n);if(o)return o;let r={max:1,mean:1};try{const n="undefined"==typeof document?null:Object.assign(document.createElement("canvas"),{width:48,height:48}).getContext("2d",{willReadFrequently:!0});if(n&&"function"==typeof n.getImageData){n.font=`500 36px ${t}`,n.textAlign="center",n.textBaseline="middle";const o=e=>{n.clearRect(0,0,48,48),n.fillStyle="#000",n.fillText(e,24,25);const t=n.getImageData(0,0,48,48).data;let o=0;for(let e=3;e<t.length;e+=4)o+=t[e];return o/255},a=e=>[...e].filter(e=>e.trim()).map(o),i=e=>e.reduce((e,t)=>e+t,0)/Math.max(1,e.length),s=a(e),l=a(".:-=+*#%@"),c=o("@");s.length&&c>0&&i(l)>0&&(r={max:Math.max(...s)/c,mean:i(s)/i(l)})}}catch{}return xe.set(n,r),r}function Me(e,t){const{max:n,mean:o}=Ee(e,t.font??ke),r=t.glyphScale??.8,a=t.gamma??1,i=t.fontWeight??500;return n>1.15?{glyphScale:Math.max(.3,r*Math.max(.62,n**-.36)),gamma:a,fontWeight:i}:o>1.5?{glyphScale:Math.max(.3,r*o**-.25),gamma:a,fontWeight:i}:n<.85?{glyphScale:Math.min(1.6,r*Math.min(1.3,n**-.3)),gamma:a,fontWeight:n<.6?Math.max(i,700):i}:{glyphScale:r,gamma:a,fontWeight:i}}var Se=new WeakMap;function Le(e,t){for(const n of Se.get(e)?.keys()??[])n.getAttribute("src")!==t&&(n.src=t)}function Ae(e){const t=Se.get(e);Se.delete(e),t?.forEach(e=>e())}var Ce=()=>"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches;function Pe(e,t,n,o,r){const a=document.createElement("img");a.alt="",a.decoding="async",a.setAttribute("aria-hidden","true"),a.setAttribute("style",`${n};object-fit:cover${Ce()?"":";transition:opacity 280ms cubic-bezier(.23, 1, .32, 1)"}`),a.style.opacity="1",a.dataset.asciiPoster="",a.src=t;const i=e.style.getPropertyValue("position"),s="function"==typeof getComputedStyle&&"static"===getComputedStyle(e).position;s&&e.style.setProperty("position","relative");const l=e.style.getPropertyValue("isolation"),c=/z-index:\s*-1/.test(n)&&"function"==typeof getComputedStyle&&"auto"===getComputedStyle(e).isolation;c&&e.style.setProperty("isolation","isolate"),r?.parentElement===e?e.insertBefore(a,r):e.appendChild(a);let u=!1;const d=()=>{u||(u=!0,a.remove(),Se.get(o)?.delete(a),s&&(i?e.style.setProperty("position",i):e.style.removeProperty("position")),c&&(l?e.style.setProperty("isolation",l):e.style.removeProperty("isolation")))},m=Se.get(o)??new Map;return m.set(a,d),Se.set(o,m),{show(e){a.style.opacity=e?"1":"0"},remove:d}}function ze(e){const t=document.createElement("canvas");for(const n of e.getAttributeNames?.()??[])"width"!==n&&"height"!==n&&t.setAttribute(n,e.getAttribute(n));return t.style.cssText=e.style.cssText,Object.assign(t.dataset,e.dataset),e.replaceWith?e.replaceWith(t):e.parentElement&&(e.parentElement.insertBefore(t,e),e.remove()),t}function We(t){const{host:n,kit:o}=t;let r,a=t.canvas,i=null,s=!1,l=!1,c=!1,u=!1,d={},m={},f=t.source,h=!1,p={},g=null,y=null,v=!1,w=null,b=()=>{};const k=!t.ownPoster&&o?.current.poster?Pe(n,o.current.poster,t.place,o,a):null,x=()=>{if(!D||!1===o?.current.globalLook||"glyph"!==(m.mark??"glyph")&&!t.glyphs||I.test(m.charset??""))return;const e=D.style?j[D.style]:void 0,n=e?.mark??"glyph",r="glyph"===n?D.charset||(e&&"charset"in e?e.charset:void 0):void 0;return e||r?{mark:n,charset:r}:void 0},E=()=>({...t.glyphs?Object.fromEntries(Object.keys(t.glyphs()).map(e=>[e,m[e]]).filter(([,e])=>void 0!==e)):{},mark:m.mark??"glyph",charset:m.charset??" .,:-=+*#%@",glyphScale:m.glyphScale??.8,gamma:m.gamma??1,fontWeight:m.fontWeight??500}),M=e=>{if(!e.charset)return{...E(),mark:e.mark};const n=t.glyphs&&"glyph"!==(m.mark??"glyph")?t.glyphs():{};return{...n,mark:e.mark,charset:e.charset,...Me(e.charset,{...m,...n})}},S=()=>{const e=x(),t=e&&`${e.mark}\0${e.charset??""}`;return t===r?null:(r=t,e?M(e):E())},L={host:n,doc:document,eager:!1===o?.current.lazy,wanted:!1,live:!1,poster:!!k||!!t.ownPoster,mount(){if(l||i)return;s&&(a=t.canvas=ze(a)),s=!0,m={...t.options(),...d},r=void 0;const n=S();let o;try{o=e(a,{...m,...n,...void 0===f?{}:{source:f},onError:()=>{i===o&&A()}})}catch{return void A()}i=o,L.live=!0,L.shared=(e=>q.has(e))(a);const c=a;if(L.shared)b=()=>{};else{let e=0;const t=()=>{i===o&&(clearTimeout(e),e=setTimeout(()=>{i===o&&a===c&&(L.release(),be())},1e3))},n=()=>clearTimeout(e);c.addEventListener?.("webglcontextlost",t),c.addEventListener?.("webglcontextrestored",n),b=()=>{clearTimeout(e),c.removeEventListener?.("webglcontextlost",t),c.removeEventListener?.("webglcontextrestored",n)}}h&&o.pause(),o.ready.then(()=>{i===o&&(v=!0,k?.show(!1),g?.(),g=y=null)},()=>{}),t.onMount?.(o,a)},release(){if(!i)return;const e=i;i=null,L.live=!1,v=!1,b(),w?.clear(),w=null,p=e.settings,e.destroy(),L.shared?l||(a.width=a.width,s=!1):((e=>{try{const t=e.getContext("webgl2");t&&!t.isContextLost?.()&&t.getExtension("WEBGL_lose_context")?.loseContext()}catch{}})(a),l||(a=t.canvas=ze(a),s=!1)),k?.show(!0),t.onRelease?.()}};function A(){c||(c=!0,C(),u||t.onFail())}function C(){l||(l=!0,L.release(),function(e){J.delete(e)&&([...J].some(t=>t.host===e.host)||K?.list.forEach(t=>t.unobserve(e.host)),!J.size&&K&&(K.list.forEach(e=>e.disconnect()),K=null),J.size||ve(null),be())}(L),X.delete(P),a.remove(),c?k?.show(!0):k?.remove())}const P={relook(){const e=S();if(!e||!i)return;const n=i,r=v&&!(o?.current.reducedMotion??Ce());w?.clear(),w=null,r&&(n.redraw(),w=function(e,t){if(!e.width||!e.height||"undefined"==typeof document)return null;const n=document.createElement("canvas");n.width=e.width,n.height=e.height;const o=n.getContext("2d");if(!o||"function"!=typeof n.animate)return null;try{o.drawImage(e,0,0)}catch{return null}n.setAttribute("aria-hidden","true"),n.dataset.asciiSweep="",n.setAttribute("style",t);const r=document.createElement("span");let a,i;r.setAttribute("aria-hidden","true"),r.dataset.asciiSweep="",r.setAttribute("style",`${t};right:auto;width:2px;margin-left:-1px;opacity:0;background:var(--ascii-sweep, #f3ba32);box-shadow:0 0 10px 1px color-mix(in srgb, var(--ascii-sweep, #f3ba32) 40%, transparent)`),e.after(n,r);const s=()=>{a?.cancel(),i?.cancel(),n.remove(),r.remove()};return{clear:s,reveal(){if(!n.isConnected)return;const t={duration:200,delay:40,easing:"cubic-bezier(.23,1,.32,1)",fill:"both"};a=n.animate([{clipPath:"inset(0% 0% 0% 0%)"},{clipPath:"inset(0% 0% 0% 100%)"}],t);const o=e.clientWidth||e.getBoundingClientRect().width;i=r.animate([{transform:"translateX(0px)",opacity:.35},{opacity:.35,offset:.7},{transform:`translateX(${o}px)`,opacity:0}],t),a.onfinish=s}}}(a,t.place)),n.update(e);const s=w;s&&requestAnimationFrame(()=>requestAnimationFrame(()=>{w===s&&i===n?s.reveal():s.clear()}))}};return{field:{get canvas(){return a},get ready(){return i?i.ready:y??(y=new Promise(e=>{g=e}))},get settings(){return i?.settings??p},update(e){if(d={...d,...e},m={...m,...e},!i)return;const t=S(),n=x();i.update(n?{...e,...M(n)}:t?{...e,...t}:e)},setSource:e=>(f=e,i?i.setSource(e):Promise.resolve()),pointer(e,t){i?.pointer(e,t)},redraw(){i?.redraw()},pulse(e){i?.pulse(e)},play(){h=!1,i?.play()},pause(){h=!0,i?.pause()},resize(){i?.resize()},destroy(){C()}},get canvas(){return a},get live(){return!!i},get failed(){return c},start(){X.add(P),u=!0;try{we(L)}finally{u=!1}},destroy:C}}export{j as KIT_STYLES,d as ambientFactor,Me as balanceCharset,f as cancelFieldFrame,Ae as disposeKit,re as getFieldBudget,V as getGlobalLook,Ee as inkWeight,We as liveField,Pe as poster,m as requestFieldFrame,oe as setFieldBudget,H as setGlobalLook,Le as setPosterSource,_ as subscribeGlobalLook,O as watchMotionPreference,F as watchPointer,R as watchTheme,T as watchVisibility};//# sourceMappingURL=chunk-XVB3B3FV.js.map