asciify-engine 4.14.1 → 4.15.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 +7 -0
- package/dist/kit.cjs +1 -1
- package/dist/kit.d.cts +3 -3
- package/dist/kit.d.ts +3 -3
- package/dist/kit.js +1 -1
- package/package.json +1 -1
- package/skills/asciify-engine/SKILL.md +2 -2
- package/skills/asciify-engine/references/applying-asciify.md +8 -9
- package/skills/asciify-engine/references/components.md +6 -3
- package/skills/asciify-engine/references/kit.md +3 -3
package/dist/kit.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("./field.cjs"),e=/\p{L}/u,n=null,r=new Set,o=new Set;var i=12,a=new Set,s=null,l=null,c=0,d=-1e9,u=0,h=!1,p=!1;var f=()=>"undefined"!=typeof performance?performance.now():Date.now(),m=()=>"number"==typeof innerHeight?innerHeight:0;function g(t,e=t.getBoundingClientRect()){if(!1===t.isConnected)return 1/0;if("function"==typeof t.getClientRects&&0===t.getClientRects().length)return 1/0;const n=e.bottom<0?-e.bottom:e.top-m();return n>0?n:0}function v(t,e){if(t.eager)return void(t.wanted=!0);const n=m(),r=g(t.host,e);!n||r<=.5*n?t.wanted=!0:r>1*n&&(t.wanted=!1)}function y(t){let e=!1;for(const n of t)if(n?.target)for(const t of a)t.host===n.target&&(v(t,n.boundingClientRect??void 0),e=!0);e&&M()}function b(t){l!==t.doc&&(l=t.doc,a.clear(),c=u=0),a.add(t);const e=function(){const t="function"==typeof IntersectionObserver?IntersectionObserver:null;if(!t)return null;if(s?.ctor!==t){s?.list.forEach(t=>t.disconnect()),s={ctor:t,list:["50% 0px","100% 0px","0px"].map(e=>new t(y,{rootMargin:e}))};for(const t of a)s.list.forEach(e=>e.observe(t.host))}return s.list}();e?.forEach(e=>e.observe(t.host)),e?v(t):t.wanted=!0,M()}function M(t=!1){if(h)p=!0;else{h=!0;try{do{p=!1;const e=f();(t||e-d>16||e<d)&&(d=e,u=0);for(const t of a)t.live&&!t.wanted&&t.release();const n=[...a].filter(t=>t.live),r=()=>n.filter(t=>t.live).map(t=>[t,g(t.host)+(t.eager?0:1e9)]).sort((t,e)=>e[1]-t[1]);for(let t=n.length-i,e=t>0?r():[];t>0;t--)e.shift()?.[0].release();const o=[...a].filter(t=>t.wanted&&!t.live).map(t=>[t,t.eager?-1:g(t.host)]).sort((t,e)=>t[1]-e[1]);let s=0;for(const[e,l]of o){if(!a.has(e)||e.live)continue;if(!e.eager&&u>=4&&(!t||s)){c||(c=requestAnimationFrame(()=>{c=0,M(!0)}));break}if(n.filter(t=>t.live).length>=i){const t=r()[0]?.[0];if(!t||!e.eager&&(t.eager||g(t.host)<=l))break;t.release()}const o=f();e.mount(),u+=f()-o,s++,e.live&&n.push(e)}}while(p)}finally{h=!1}}}var x=new WeakMap,w=new WeakMap;function k(t,e){const n=w.get(t);n&&n.getAttribute("src")!==e&&(n.src=e)}function S(t){x.get(t)?.(),x.delete(t)}var A=()=>"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches;function C(t,e,n,r,o){const i=document.createElement("img");i.alt="",i.decoding="async",i.setAttribute("aria-hidden","true"),i.setAttribute("style",`${n};object-fit:cover${A()?"":";transition:opacity 280ms cubic-bezier(.23, 1, .32, 1)"}`),i.style.opacity="1",i.dataset.asciiPoster="",i.src=e;const a=t.style.getPropertyValue("position"),s="function"==typeof getComputedStyle&&"static"===getComputedStyle(t).position;s&&t.style.setProperty("position","relative");const l=t.style.getPropertyValue("isolation"),c=/z-index:\s*-1/.test(n)&&"function"==typeof getComputedStyle&&"auto"===getComputedStyle(t).isolation;c&&t.style.setProperty("isolation","isolate"),o?.parentElement===t?t.insertBefore(i,o):t.appendChild(i);return x.set(r,()=>{i.remove(),s&&(a?t.style.setProperty("position",a):t.style.removeProperty("position")),c&&(l?t.style.setProperty("isolation",l):t.style.removeProperty("isolation"))}),w.set(r,i),{show(t){i.style.opacity=t?"1":"0"},remove:()=>S(r)}}function E(r){const{host:i,kit:l}=r;let c,d=r.canvas,u=null,h=!1,p=!1,f=!1,m=!1,g={},v={},y=r.source,x=!1,w={},k=null,S=null,E=!1,$=null;const L=!r.ownPoster&&l?.current.poster?C(i,l.current.poster,r.place,l,d):null,z=()=>{const t=v.charset,r=!1!==l?.current.globalLook&&"glyph"===(v.mark??"glyph")&&!e.test(t??"")&&n?.charset?n.charset:void 0;return r?r===c?null:(c=r,{charset:r}):void 0===c?null:(c=void 0,{charset:t??" .,:-=+*#%@"})},R={host:i,doc:document,eager:!1===l?.current.lazy,wanted:!1,live:!1,mount(){if(p||u)return;h&&(d=function(t){const e=document.createElement("canvas");for(const n of t.getAttributeNames?.()??[])"width"!==n&&"height"!==n&&e.setAttribute(n,t.getAttribute(n));return e.style.cssText=t.style.cssText,Object.assign(e.dataset,t.dataset),t.replaceWith?t.replaceWith(e):t.parentElement&&(t.parentElement.insertBefore(e,t),t.remove()),e}(d)),h=!0,v={...r.options(),...g},c=void 0;const e=z();let n;try{n=t.mountGlyphField(d,{...v,...e,...void 0===y?{}:{source:y},onError:()=>{u===n&&I()}})}catch{return void I()}u=n,R.live=!0,x&&n.pause(),n.ready.then(()=>{u===n&&(E=!0,L?.show(!1),k?.(),k=S=null)},()=>{}),r.onMount?.(n,d)},release(){if(!u)return;const t=u;u=null,R.live=!1,E=!1,$?.clear(),$=null,w=t.settings,t.destroy(),(t=>{try{t.getContext("webgl2")?.getExtension("WEBGL_lose_context")?.loseContext()}catch{}})(d),L?.show(!0),r.onRelease?.()}};function I(){f||(f=!0,P(),m||r.onFail())}function P(){p||(p=!0,R.release(),function(t){a.delete(t)&&([...a].some(e=>e.host===t.host)||s?.list.forEach(e=>e.unobserve(t.host)),!a.size&&s&&(s.list.forEach(t=>t.disconnect()),s=null),M())}(R),o.delete(T),d.remove(),f?L?.show(!0):L?.remove())}const T={relook(){const t=z();if(!t||!u)return;const e=u,n=E&&!(l?.current.reducedMotion??A());$?.clear(),$=null,n&&(e.redraw(),$=function(t,e){if(!t.width||!t.height||"undefined"==typeof document)return null;const n=document.createElement("canvas");n.width=t.width,n.height=t.height;const r=n.getContext("2d");if(!r||"function"!=typeof n.animate)return null;try{r.drawImage(t,0,0)}catch{return null}n.setAttribute("aria-hidden","true"),n.dataset.asciiSweep="",n.setAttribute("style",e);const o=document.createElement("span");let i,a;o.setAttribute("aria-hidden","true"),o.dataset.asciiSweep="",o.setAttribute("style",`${e};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)`),t.after(n,o);const s=()=>{i?.cancel(),a?.cancel(),n.remove(),o.remove()};return{clear:s,reveal(){if(!n.isConnected)return;const e={duration:200,delay:40,easing:"cubic-bezier(.23,1,.32,1)",fill:"both"};i=n.animate([{clipPath:"inset(0% 0% 0% 0%)"},{clipPath:"inset(0% 0% 0% 100%)"}],e);const r=t.clientWidth||t.getBoundingClientRect().width;a=o.animate([{transform:"translateX(0px)",opacity:.35},{opacity:.35,offset:.7},{transform:`translateX(${r}px)`,opacity:0}],e),i.onfinish=s}}}(d,r.place)),e.update(t);const o=$;o&&requestAnimationFrame(()=>requestAnimationFrame(()=>{$===o&&u===e?o.reveal():o.clear()}))}};return{field:{get canvas(){return d},get ready(){return u?u.ready:S??(S=new Promise(t=>{k=t}))},get settings(){return u?.settings??w},update(t){if(g={...g,...t},v={...v,...t},!u)return;const e=z();u.update(void 0!==c?{...t,charset:c}:e?{...t,...e}:t)},setSource:t=>(y=t,u?u.setSource(t):Promise.resolve()),pointer(t,e){u?.pointer(t,e)},redraw(){u?.redraw()},pulse(t){u?.pulse(t)},play(){x=!1,u?.play()},pause(){x=!0,u?.pause()},resize(){u?.resize()},destroy(){P()}},get canvas(){return d},get live(){return!!u},get failed(){return f},start(){o.add(T),m=!0;try{b(R)}finally{m=!1}},destroy:P}}var $,L=(t,e=0,n=1)=>Math.min(n,Math.max(e,t)),z=(t,e)=>{const n=43758.5453*Math.sin(127.1*t+311.7*e);return n-Math.floor(n)},R=(t,e=3)=>1-(1-L(t))**e,I=(t,e,n)=>{const r=L((n-t)/(e-t));return r*r*(3-2*r)},P=t=>{if(t<=0)return 0;if(t>=1)return 1;const e=(t,e,n)=>3*e*t*(1-t)**2+3*n*t*t*(1-t)+t**3;let n=0,r=1,o=t;for(let i=0;i<22;i++)o=(n+r)/2,e(o,.16,.3)<t?n=o:r=o;return e(o,1,1)},T=()=>"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,F={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 W(t,e,n){let r=(t??"").trim();const o=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/.exec(r);if(o?r=B(e,o[1])||(o[2]??"").trim():r.startsWith("--")&&(r=B(e,r)),!r)return n?W(n,e):null;if(/^#[\da-f]{6}$/i.test(r))return r.toLowerCase();if(/^#[\da-f]{3}$/i.test(r))return`#${[...r.slice(1)].map(t=>t+t).join("")}`.toLowerCase();const i=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(r);if(i)return O([+i[1],+i[2],+i[3]]);if(void 0===$)try{$="undefined"==typeof document?null:Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0})}catch{$=null}if(!$)return n?W(n,e):null;$.clearRect(0,0,1,1),$.fillStyle="#000",$.fillStyle=r,$.fillRect(0,0,1,1);const[a,s,l]=$.getImageData(0,0,1,1).data;return O([a,s,l])}var B=(t,e)=>"function"==typeof getComputedStyle?getComputedStyle(t).getPropertyValue(e).trim():"",O=t=>`#${t.map(t=>Math.round(L(t,0,255)).toString(16).padStart(2,"0")).join("")}`,N=t=>{const e=parseInt(t.slice(1,7),16);return[e>>16&255,e>>8&255,255&e]},G=(t,e,n)=>{const r=N(t),o=N(e);return O(r.map((t,e)=>t+(o[e]-t)*n))};function q(t){const e="function"==typeof getComputedStyle?getComputedStyle(t):null,n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?/i.exec(e?.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 r=W(e?.color??"",t);if(!r)return"function"==typeof matchMedia&&matchMedia("(prefers-color-scheme: dark)").matches;const[o,i,a]=N(r);return.2126*o+.7152*i+.0722*a>140}function H(){const t=[];return{set(e,n,r){t.some(([t,r])=>t===e&&r===n)||t.push([e,n,e.style.getPropertyValue(n)]),e.style.setProperty(n,r)},restore(){for(const[e,n,r]of t.reverse())r?e.style.setProperty(n,r):e.style.removeProperty(n);t.length=0}}}function D(t="",e=!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"),e&&n.setAttribute("aria-live","polite"),n.textContent=t,n}function j(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=n.width/(t.offsetWidth||n.width||1)||1;return{x:(r.left-n.left)/o,y:(r.top-n.top)/o,w:r.width/o,h:r.height/o}}function U(t,e){const n={...t,...e},r=t.look,o=e.look;return o&&(n.look=Object.fromEntries(Object.entries({...r,...o}).filter(([,t])=>void 0!==t))),n}var V=new WeakMap,X=t=>V.get(t)?.()??null;function Y(e){const{host:n,layer:r="over",outset:o=0,kit:i}=e;if("undefined"==typeof document)return null;const a=`position:absolute;left:${-o}px;top:${-o}px;width:calc(100% + ${2*o}px);height:calc(100% + ${2*o}px);pointer-events:none;z-index:${"under"===r?-1:"auto"}`;if(!t.isGlyphFieldSupported())return i?.current.poster&&C(n,i.current.poster,a,i),null;const s=H(),l=document.createElement("canvas"),c=document.createElement("canvas"),d=c.getContext("2d");if(!d)return null;"static"===getComputedStyle(n).position&&s.set(n,"position","relative"),"under"===r&&s.set(n,"isolation","isolate"),l.setAttribute("aria-hidden","true"),l.dataset.asciiKit="";const u=l.style;u.position="absolute",u.left=u.top=-o+"px",u.width=u.height=`calc(100% + ${2*o}px)`,u.pointerEvents="none",u.zIndex="under"===r?"-1":"",n.appendChild(l);const h=()=>{const t=getComputedStyle(n);b.canvas.style.borderRadius=[t.borderTopLeftRadius,t.borderTopRightRadius,t.borderBottomRightRadius,t.borderBottomLeftRadius].map(t=>o&&/^[\d.]+px$/.test(t)?`${parseFloat(t)+o}px`:t).join(" ")};let p=q(n);const f=()=>W(e.ink(p),n,p?"#d8d6cf":"#1d1d1b")??"#888888";let m=0,g=!1,v=!0,y=!1;const b=E({host:n,canvas:l,kit:i,place:a,options:()=>({...F,...e.look(),ink:f(),interactionTarget:n,label:""}),onMount:(t,e)=>{V.set(e,S),e.removeAttribute("role"),e.removeAttribute("aria-label"),t.ready.then($,()=>{}),$()},onRelease:()=>{m&&cancelAnimationFrame(m),m=0},onFail:()=>{G(),e.onFail?.()}}),M=b.field;h();const x=()=>!!(e.reducedMotion()??T()),w=t=>j(b.canvas,t),k=t=>{const r=b.canvas,i=Math.max(1,r.clientWidth||n.clientWidth+2*o),a=Math.max(1,r.clientHeight||n.clientHeight+2*o),s=e.resolution??1,[l,u]="function"==typeof s?s(i,a):[Math.max(1,Math.round(i*s)),Math.max(1,Math.round(a*s))];c.width===l&&c.height===u||(c.width=l,c.height=u),d.setTransform(1,0,0,1,0,0),d.globalAlpha=1,d.globalCompositeOperation="source-over",d.filter="none",d.fillStyle="#000",d.fillRect(0,0,l,u);let h=!1;try{h=e.paint({pen:d,width:l,height:u,w:i,h:a,scale:l/i,now:t,still:x(),dark:p,box:w})}catch(t){"undefined"!=typeof console&&console.error(t)}return M.setSource(c).then(()=>{y||M.redraw()}),h};function S(){const t=b.canvas,r=Math.max(1,t.clientWidth||n.clientWidth+2*o),i=Math.max(1,t.clientHeight||n.clientHeight+2*o),a=e.resolution??1,[s,l]="function"==typeof a?a(r,i):[Math.max(1,Math.round(r*a)),Math.max(1,Math.round(i*a))],c=document.createElement("canvas");c.width=s,c.height=l;const d=c.getContext("2d");if(!d)return null;d.fillStyle="#000",d.fillRect(0,0,s,l);try{e.paint({pen:d,width:s,height:l,w:r,h:i,scale:s/r,now:performance.now(),still:!0,dark:p,box:w})}catch{return null}return c}V.set(l,S);const A=t=>{if(m=0,y||g||!b.live)return;!k(t)||x()||!v||"undefined"!=typeof document&&document.hidden||(m=requestAnimationFrame(A))};function $(){m||y||g||!b.live||(m=requestAnimationFrame(A))}const L="function"==typeof ResizeObserver?new ResizeObserver(()=>{h(),M.resize(),!b.live||y||g||k(performance.now()),$()}):null;L?.observe(n);const z="function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{v=t.isIntersecting,v&&$()},{rootMargin:"64px"}):null;z?.observe(n);const R=()=>{document.hidden||$()};document.addEventListener("visibilitychange",R);let I=0;const P=()=>{I||y||(I=requestAnimationFrame(()=>{I=0,y||(p=q(n),M.update({ink:f()}),e.onTheme?.(),$())}))},B="function"==typeof matchMedia?matchMedia("(prefers-color-scheme: dark)"):null;B?.addEventListener?.("change",P);const O="function"==typeof matchMedia?matchMedia("(prefers-reduced-motion: reduce)"):null;O?.addEventListener?.("change",$);const N="function"==typeof MutationObserver?new MutationObserver(P):null;for(const t of[document.documentElement,document.body])t&&N?.observe(t,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]});function G(){y||(y=!0,m&&cancelAnimationFrame(m),I&&cancelAnimationFrame(I),m=I=0,L?.disconnect(),z?.disconnect(),N?.disconnect(),document.removeEventListener("visibilitychange",R),B?.removeEventListener?.("change",P),O?.removeEventListener?.("change",$),b.destroy(),s.restore(),c.width=c.height=1)}return b.start(),b.failed?(G(),null):{field:M,get canvas(){return b.canvas},get live(){return b.live},kick:$,refresh(){y||(p=q(n),M.update({...F,...e.look(),ink:f()}),$())},still:x,dark:()=>p,box:w,play(){g&&(g=!1,M.play(),$())},pause(){g=!0,m&&cancelAnimationFrame(m),m=0,M.pause()},destroy:G}}function J(t,e,n,r,o=()=>{}){let i=!1;const a={get supported(){return!!t()&&!i},get field(){return i?null:t()?.field??null},update(t){if(i)return;e.current=U(e.current,t);const r=t.poster;r&&k(e,r),n(e.current)},play(){i||t()?.play()},pause(){i||t()?.pause()},destroy(){i||(i=!0,t()?.destroy(),S(e),o())}};return Object.defineProperties(r,Object.getOwnPropertyDescriptors(a))}var _={colorful:["#22c55e","#06b6d4","#6366f1","#d946ef","#f43f5e","#f59e0b"],mono:["#ffffff"],ocean:["#22d3ee","#3b82f6","#2dd4bf","#818cf8"],sunset:["#f97316","#f43f5e","#ec4899","#fbbf24"]},K={palette:"colorful",mode:"rotate",grain:"dots",speed:1,hover:!0,depth:18},Q=["rotate","pulse","progress"],Z=t=>{const e=/^#[\da-f]{3}$/i.test(t)?`#${[...t.slice(1)].map(t=>t+t).join("")}`:t;return[1,3,5].map(t=>(parseInt(e.slice(t,t+2),16)||0)/255)},tt=(t,e,n)=>t.map((t,r)=>t+(e[r]-t)*n),et=Z("#ff4a4a"),nt=Z("#2fd67b");function rt(t){const e=("string"==typeof t?_[t]??_.colorful:t.length?t:_.colorful).map(Z),n=new Float32Array(1024);for(let t=0;t<256;t++){const r=t/256*e.length,o=Math.floor(r),i=r-o,a=1===e.length?e[0]:tt(e[o%e.length],e[(o+1)%e.length],i*i*(3-2*i)),s=Math.max(...a,.01);n.set([a[0]/s,a[1]/s,a[2]/s,(.2126*a[0]+.7152*a[1]+.0722*a[2])/s],4*t)}return n}var ot=(t,e)=>{const n=(-t%1+1)%1,r=1-n;return Math.max(n<e?(1-n/e)**2.2:0,r<.03?(1-r/.03)**2:0)},it=t=>Math.max(ot(t,.3),.75*ot(t-.5,.22)),at=(t,e)=>t<=e?.42+.4*(t/Math.max(e,.001))**1.6+.38*Math.exp(-(((e-t)/.03)**2)):t-e<.014?1.2*(1-(t-e)/.014)**2:0,st=(t,e)=>L((t-.68*e)/.07);var lt={duration:800,trigger:"visible",replayOnHover:!0,settle:"glyphs"};function ct(t,e,n=.82){const r=t.getContext("2d");if(!r)return;const o=t.width,i=t.height,a=r.createImageData(o,i),s=t=>t*t*(3-2*t),l=(t,e)=>{const n=Math.floor(t),r=Math.floor(e),o=s(t-n),i=s(e-r),a=z(n,r),l=z(n+1,r),c=z(n,r+1);return a+(l-a)*o+(c-a)*i+(a-l-c+z(n+1,r+1))*o*i};for(let t=0;t<i;t++)for(let r=0;r<o;r++){const s=.6*l(r/6+2.4*e,t/3.5-.8*e)+.4*l(r/2.5-3*e,t/2),c=Math.min(1,2.4*(1-Math.hypot(2*(r/o-.5),2*(t/i-.5))*n)),d=.72*Math.max(0,s-.42)*Math.max(0,c)*255,u=4*(t*o+r);a.data[u]=a.data[u+1]=a.data[u+2]=d,a.data[u+3]=255}r.putImageData(a,0,0)}var dt={value:0,duration:360,stagger:60,glyphs:"#%*+=-:",format:t=>t.toLocaleString(),face:"text"};function ut(t,e){const n=(t,e)=>t[t.length-1-e]??"";for(let r=e.length-1;r>=0;r--)if(/\d/.test(n(e,r))&&n(t,r)!==n(e,r))return r;return-1}var ht={check:!0,shake:!0};function pt(t,e,n,r,o,i=0){const a=24*n+170;if(e<a){const n=(e-24*t)/170;return n<1?1+Math.floor(z(t+i,Math.floor(e/46))*(n<0?3:9)):0}if(!r||o)return 0;const s=(((e-a)/1250-.07*t)%1+1)%1;return s<.3?1+Math.round(8*Math.sin(Math.PI*(s/.3))):0}var ft="cubic-bezier(.16, 1, .3, 1)";var mt={colourByState:!0,ring:!0},gt={success:["--ascii-success","#17844a","#3ccf7e"],warning:["--ascii-warning","#9a6700","#f5b83d"],error:["--ascii-error","#c93636","#ff6b6b"]},vt=120,yt=280,bt=520,Mt=2*Math.PI,xt=Mt/1050,wt=t=>1-(1-t)**4,kt=t=>`rgb(${255*t} ${255*t} ${255*t})`,St=t=>t*xt-Math.PI/2,At=(t,e=0)=>78+5*Math.sin(t/1600*Mt)*(1-e);function Ct(t,e,n=78,r=24){t.strokeStyle=kt(e),t.lineWidth=r,t.beginPath(),t.arc(vt,vt,n,0,Mt),t.stroke()}function Et(t,e,n,r=0,o=1){if(Ct(t,(.3+(n-78)/100)*o,n,24-6*r),r>=1)return void Ct(t,.72*o,n,18);const i=3.4+(Mt-3.4)*r;t.lineCap="round";for(let a=0;a<32;a++){const s=a/32,l=.3+.7*(1-s)**1.6;t.strokeStyle=kt((l+(.72-l)*r)*o),t.lineWidth=28-6*s+(18-(28-6*s))*r,t.beginPath(),t.arc(vt,vt,n,e-(s+1/32)*i,e-s*i),t.stroke()}}function $t(t,e,n,r=800,o=0,i=!0){if("idle"===e)return void Ct(t,.34);if("loading"===e)return void Et(t,St(n),At(n));const a=(t=>t<.5?4*t*t*t:1-(-2*t+2)**3/2)(Math.min(1,r/yt)),s=Math.min(r,yt),l=o+xt*(s-s*s/560);i?Et(t,l,At(n,a),a):a<1&&Et(t,l,At(n,a),0,1-a);const c=(r-196)/bt;i&&c>0&&c<1&&Ct(t,.5*(1-c)**2,88+24*c,16-8*c),function(t,e,n,r=30){t.strokeStyle="#fff",t.lineWidth=r,t.lineCap="round",t.lineJoin="round";const o=(e,n)=>{const r=e.slice(1).map((t,n)=>Math.hypot(t[0]-e[n][0],t[1]-e[n][1]));let o=n*r.reduce((t,e)=>t+e,0);t.beginPath(),t.moveTo(e[0][0],e[0][1]);for(let n=1;n<e.length&&o>0;n++){const i=Math.min(1,o/r[n-1]);t.lineTo(e[n-1][0]+(e[n][0]-e[n-1][0])*i,e[n-1][1]+(e[n][1]-e[n-1][1])*i),o-=r[n-1]}t.stroke()};"success"===e?o([[86,122],[110,146],[156,96]],n):"warning"===e?(t.lineWidth=r-4,o([[vt,74],[vt,114]],Math.min(1,n/.7)),n>.7&&(t.fillStyle="#fff",t.beginPath(),t.arc(vt,152,r/2*wt((n-.7)/.3),0,Mt),t.fill())):(o([[92,92],[148,148]],n),o([[148,92],[92,148]],n))}(t,e,wt(Math.min(1,Math.max(0,(r-40)/260))),i?24:30)}var Lt={blocks:"[data-block]",shimmer:1250,resolve:240,stagger:60,develop:560},zt=t=>`rgb(${255*t} ${255*t} ${255*t})`;function Rt(t){const e=t.dataset.block;return"text"===e||"photo"===e||"avatar"===e?e:"IMG"===t.tagName||"PICTURE"===t.tagName||"VIDEO"===t.tagName?/^50%|^9999px/.test(getComputedStyle(t).borderTopLeftRadius)?"avatar":"photo":"text"}var It={tone:"neutral",live:!1,indicator:!0,sheen:!0},Pt={light:{green:[22,150,82],amber:[200,128,10],red:[214,52,52],neutral:[120,120,114],new:[98,72,214]},dark:{green:[120,240,170],amber:[255,206,110],red:[255,156,156],neutral:[200,200,192],new:[180,164,255]}},Tt={light:{charset:" .:+*"+"#".repeat(15),top:.32},dark:{charset:" .:+*"+"#".repeat(4),top:.9}},Ft=[[255,130,225],[205,175,255],[120,215,255]],Wt=(t,e,n)=>t.map((t,r)=>t+(e[r]-t)*n),Bt=(t,e)=>Math.exp(-((t/e)**2));function Ot(t,e){const n=Math.max(1,...t),r=t.map(t=>t/n*255),o=(.2126*r[0]+.7152*r[1]+.0722*r[2])/255,i=Math.min(1,e/Math.max(o,.01));return`rgb(${r.map(t=>Math.round(Math.max(0,Math.min(255,t*i)))).join(" ")})`}var Nt=(t,e)=>{return"green"===(n=t.dataset.tone)||"amber"===n||"red"===n||"neutral"===n||"new"===n?t.dataset.tone:e;var n};var Gt={tabs:'[role="tab"]',duration:280,panels:"hidden",manage:!0};var qt=280,Ht={preview:[{k:.5,blur:9},{k:.78,blur:4}],final:{k:1,blur:0}},Dt=async t=>{if("function"==typeof createImageBitmap)return createImageBitmap("string"==typeof t?await(await fetch(t)).blob():t);const e=new Image;return e.crossOrigin="anonymous",e.src="string"==typeof t?t:URL.createObjectURL(t),await e.decode(),e};var jt=t=>new Promise(e=>setTimeout(e,t));function Ut(e){const{host:n,layer:r="under",kit:o}=e;if("undefined"==typeof document)return null;const i=`position:absolute;inset:0;width:100%;height:100%;pointer-events:none;border-radius:inherit;z-index:${"under"===r?-1:"auto"}`;if(!t.isGlyphFieldSupported())return o?.current.poster&&!e.ownPoster&&C(n,o.current.poster,i,o),null;const a=H(),s=document.createElement("canvas");"static"===getComputedStyle(n).position&&a.set(n,"position","relative"),"under"===r&&a.set(n,"isolation","isolate"),s.dataset.asciiKit="",s.setAttribute("style",i),n.appendChild(s);let l=q(n),c=!1;const d=()=>{const t=e.reducedMotion();return!0===t?{speed:0,drift:0,respectReducedMotion:!0}:{respectReducedMotion:!1!==t}},u=()=>W(e.ink(l),n,l?"#d8d6cf":"#1d1d1b")??"#888888",h=E({host:n,canvas:s,kit:o,place:i,ownPoster:e.ownPoster,source:e.source??null,options:()=>({...F,...e.look(l),...d(),ink:u(),interactionTarget:n,label:e.label??""}),onMount:(t,n)=>{e.label||(n.removeAttribute("role"),n.removeAttribute("aria-label"),n.setAttribute("aria-hidden","true")),e.onMount?.()},onRelease:e.onRelease,onFail:()=>{b(),e.onFail?.()}}),p=h.field;let f=0;const m=()=>{c||(l=q(n),p.update({...F,...e.look(l),...d(),ink:u()}))},g=()=>{f||c||(f=requestAnimationFrame(()=>{f=0,m()}))},v="function"==typeof matchMedia?matchMedia("(prefers-color-scheme: dark)"):null;v?.addEventListener?.("change",g);const y="function"==typeof MutationObserver?new MutationObserver(g):null;for(const t of[document.documentElement,document.body])t&&y?.observe(t,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]});function b(){c||(c=!0,f&&cancelAnimationFrame(f),y?.disconnect(),v?.removeEventListener?.("change",g),h.destroy(),a.restore())}return h.start(),h.failed?(b(),null):{field:p,get canvas(){return h.canvas},get live(){return h.live},dark:()=>l,still:()=>!!(e.reducedMotion()??T()),refresh:m,destroy:b}}function Vt(t,e,n,r,o=()=>{}){let i=!1;const a={get supported(){return!!t()&&!i},get field(){return i?null:t()?.field??null},update(r){if(i)return;e.current=U(e.current,r);const o=r.poster;o&&k(e,o),n(e.current),t()?.refresh()},play(){i||t()?.field.play()},pause(){i||t()?.field.pause()},destroy(){i||(i=!0,o(),t()?.destroy(),S(e))}};return Object.defineProperties(r,Object.getOwnPropertyDescriptors(a))}function Xt(t,e){const n=Object.assign(document.createElement("canvas"),{width:t,height:e}),r=n.getContext("2d");return r.fillStyle="#000",r.fillRect(0,0,t,e),{canvas:n,pen:r}}function Yt(t,e,n){if(!e)return void t.pulse({strength:n});if("getBoundingClientRect"in e)return void t.pulse({element:e,strength:n});const r=t.canvas.getBoundingClientRect();t.pulse({x:e.x-r.left,y:e.y-r.top,strength:n})}var Jt={preset:"hero",clear:!1,text:"404",ripple:!0},_t=28,Kt='600 440px "Geist", Arial, sans-serif',Qt=()=>"number"==typeof innerWidth&&innerWidth<760,Zt=t=>({mark:"glyph",scene:"drift",levels:"auto",charset:" .:+*#",font:'"Geist Mono", ui-monospace, monospace',fontWeight:400,cellSize:10,cellAspect:.62,glyphScale:.86,color:"ink",shade:0,hover:"trail",trail:{strength:.9,radius:.32},...t}),te={mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:7,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.4,fit:"contain",clear:!1,focus:{x:.5,y:.5},drift:.8,speed:.7,levels:"auto",hover:"trail",trail:{strength:1,radius:.42}};var ee=[...Array.from({length:10},(t,e)=>(e+1)/10),1,1,1,...Array.from({length:14},(t,e)=>1-(e+1)/14)];function ne(t,e,n,r){const o=e.getContext("2d");o.globalAlpha=1,o.fillStyle="#000",o.fillRect(0,0,e.width,e.height);for(const e of n){const n=Math.min(1,Math.max(0,(r-e.lag*(1-r))/(1-.5*e.lag))),i=n*n*(3-2*n);o.globalAlpha=1-.72*i,o.drawImage(t,e.x,e.y,_t,_t,e.x+e.dx*i,e.y+e.dy*i,_t,_t)}o.globalAlpha=1}var re={font:'Georgia, "Times New Roman", serif',fontWeight:600};var oe="position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit;pointer-events:none";var ie={saving:null,font:'"Geist", Arial, sans-serif'};function ae(t,e,n,r=ie.font){const o=Math.max(2,Math.round(2*t.offsetWidth)),i=Math.max(2,Math.round(2*t.offsetHeight)),{canvas:a,pen:s}=Xt(o,i),l=s.createRadialGradient(o,0,0,o,0,.52*Math.hypot(o,i));l.addColorStop(0,"rgb(150 150 150)"),l.addColorStop(.4,"rgb(64 64 64)"),l.addColorStop(1,"rgb(0 0 0)"),s.fillStyle=l,s.fillRect(0,0,o,i);const c=e?function(t,e){const n=t.getBoundingClientRect(),r=n.height?t.offsetHeight/n.height:1,o=e?.getBoundingClientRect().top??n.top+n.height;let i=e;for(;i&&i.parentElement!==t;)i=i.parentElement;let a=n.top;for(const e of Array.from(t.children)){if(e===i)break;if(void 0!==e.dataset?.asciiKit)continue;const t=e.getBoundingClientRect();t.height&&(a=Math.max(a,t.top+t.height))}return{middle:((a+o)/2-n.top)*r,height:(o-a)*r}}(t,n):null;if(e&&c&&c.height>=30){const t=Math.min(2*c.height*.9,.34*o),n=o-.07*o,i=2*c.middle+.04*t;s.font=`600 ${t}px ${r}`,s.letterSpacing=.04*-t+"px",s.textAlign="right",s.textBaseline="middle",s.lineJoin="round",s.lineWidth=.28*t,s.strokeStyle="rgb(0 0 0 / .85)",s.strokeText(e,n,i),s.fillStyle="#fff",s.fillText(e,n,i)}return a}var se={aurora:["#2ee6c8","#9d7bff","#ff6fb5"],brand:["#ffb000","#ffd84d"]},le={palette:"aurora",swell:!0},ce=t=>"mono"===t?[]:"string"==typeof t?[...se[t]??se.aurora]:[...t];function de(t,e){if(1===t.length)return t[0];const n=L(e)*(t.length-1),r=Math.min(t.length-2,Math.floor(n)),o=n-r,[i,a]=[t[r],t[r+1]].map(t=>[1,3,5].map(e=>parseInt(t.slice(e,e+2),16)||0));return`rgb(${i.map((t,e)=>Math.round(t+(a[e]-t)*o)).join(" ")})`}var ue=t=>{const e=Math.round(255*Math.min(1,Math.max(0,t)));return`rgb(${e} ${e} ${e})`},he=t=>{if(!t||"transparent"===t)return 0;const e=/\/\s*([\d.]+)(%?)\s*\)$/.exec(t);if(e)return parseFloat(e[1])/(e[2]?100:1);const n=/^rgba\([^)]*,\s*([\d.]+)\s*\)$/.exec(t);return n?parseFloat(n[1]):1},pe=/^(IMG|PICTURE|VIDEO|CANVAS|SVG|svg)$/;function fe(t,e,n,r){const o=(t,e)=>Math.max(0,Math.min(parseFloat(t.borderTopLeftRadius)||0,e.w/2,e.h/2)),i=[e,...e.querySelectorAll("*")];t.save();for(const a of i){if("CANVAS"===a.tagName&&void 0!==a.dataset?.asciiKit){if(!r||a===r.skip)continue;const e=n(a),o=e.w>0&&e.h>0?X(a):null;o&&(t.globalCompositeOperation="lighter",t.drawImage(o,e.x,e.y,e.w,e.h),t.globalCompositeOperation="source-over");continue}if(void 0!==a.dataset?.asciiPoster)continue;const i=n(a);if(i.w<=0||i.h<=0)continue;const s=getComputedStyle(a);if("hidden"===s.visibility||"none"===s.display)continue;const l=he(s.backgroundColor)>.03,c=(parseFloat(s.borderTopWidth)||0)>0&&he(s.borderTopColor)>.1;if(t.beginPath(),a===e)(l||c)&&(t.strokeStyle=ue(.42),t.lineWidth=3,t.roundRect(i.x+1.5,i.y+1.5,i.w-3,i.h-3,o(s,i)),t.stroke());else{if(pe.test(a.tagName)){t.fillStyle=ue(.5),i.w<32&&i.h<32?t.arc(i.x+i.w/2,i.y+i.h/2,.36*Math.min(i.w,i.h),0,2*Math.PI):t.roundRect(i.x,i.y,i.w,i.h,o(s,i)),t.fill();continue}l?(t.fillStyle=ue(.22),t.roundRect(i.x,i.y,i.w,i.h,o(s,i)),t.fill()):c&&(t.strokeStyle=ue(.32),t.lineWidth=1.5,t.roundRect(i.x+.75,i.y+.75,i.w-1.5,i.h-1.5,o(s,i)),t.stroke())}if("INPUT"===a.tagName||"TEXTAREA"===a.tagName){const e=a,n=e.value||e.placeholder||"";n&&me(t,n,i.x+(parseFloat(s.paddingLeft)||0),i.y,i.h,s,e.value?.82:.5)}}!function(t,e,n){if("function"!=typeof document.createTreeWalker)return;const r=document.createTreeWalker(e,4),o=document.createRange(),i=n(e),a=e.getBoundingClientRect(),s=a.width/(e.offsetWidth||a.width||1)||1;let l=0;for(let n=r.nextNode();n&&l<2e3;n=r.nextNode()){const r=n.parentElement;if(!r)continue;const c=getComputedStyle(r);if("hidden"===c.visibility||ge(r,e))continue;const d=(parseFloat(c.fontWeight)||400)>=600||/^H[1-6]$/.test(r.tagName)?1:.8;for(const e of n.data.matchAll(/\S+/g)){o.setStart(n,e.index),o.setEnd(n,e.index+e[0].length);const r=o.getClientRects()[0];r&&(l++,me(t,e[0],i.x+(r.left-a.left)/s,i.y+(r.top-a.top)/s,r.height/s,c,d))}}o.detach?.()}(t,e,n),t.restore()}function me(t,e,n,r,o,i,a){const s=Math.min(900,(parseFloat(i.fontWeight)||400)+200);t.font=`${i.fontStyle||"normal"} ${s} ${i.fontSize} ${i.fontFamily}`,t.fillStyle=ue(a),t.shadowColor=ue(a),t.shadowBlur=3,t.textBaseline="middle",t.fillText(e,n,r+o/2),t.shadowBlur=0}function ge(t,e){for(;t&&t!==e;t=t.parentElement){const e=t;if(e.offsetWidth<=1&&e.offsetHeight<=1&&"hidden"===getComputedStyle(e).overflow)return!0}return!1}function ve(t,e,n,r,o=2,i){const a=document.createElement("canvas");a.width=Math.max(2,Math.round(n*o)),a.height=Math.max(2,Math.round(r*o));const s=a.getContext("2d",{willReadFrequently:!0});return s?(s.setTransform(o,0,0,o,0,0),s.fillStyle="#000",s.fillRect(0,0,n,r),fe(s,t,e,i),a):a}var ye={input:"input",rows:'[role="option"]',hotkey:"k",manage:!0,closeOnRun:!0},be=200,Me=t=>{const e=Math.round(255*L(t));return`rgb(${e} ${e} ${e})`};var xe={thumb:'[role="slider"]',label:"[data-label]",threshold:.9,resetAfter:0},we=720,ke=(t,e,n)=>t+(e-t)*n,Se=t=>1-(1-t)**3,Ae=(t,e,n)=>({x:t,v:0,to:t,k:e,z:n});function Ce(t,e,n=.4){const r=2*Math.sqrt(t.k)*t.z,o=Math.max(1,Math.ceil(240*e)),i=e/o;for(let e=0;e<o;e++)t.v+=(-t.k*(t.x-t.to)-r*t.v)*i,t.x+=t.v*i;return!(Math.abs(t.x-t.to)<n&&Math.abs(t.v)<12*n)||(t.x=t.to,t.v=0,!1)}var Ee=t=>{t.x=t.to,t.v=0};function $e(t,e){const n=t.filter(([,t])=>e-t<80);if(n.length<2)return 0;const[r,o]=n[0],[i,a]=n[n.length-1];return a>o?(i-r)/(a-o)*1e3:0}var Le={kind:"heart",icon:"svg",manage:!0,outset:40,layer:"under"},ze=t=>1-(1-L(t))**3;function Re(t,e,n,r,o){if(t.beginPath(),"heart"===e){const e=o/29;for(let o=0;o<=56;o++){const i=o/56*Math.PI*2,a=16*Math.sin(i)**3,s=-(13*Math.cos(i)-5*Math.cos(2*i)-2*Math.cos(3*i)-Math.cos(4*i));0===o?t.moveTo(n+a*e,r+(s-2.5)*e):t.lineTo(n+a*e,r+(s-2.5)*e)}}else{const e=.7*o,i=r-o/2,a=n-e/2,s=.12*o;t.moveTo(a,i+s),t.arcTo(a,i,a+s,i,s),t.lineTo(a+e-s,i),t.arcTo(a+e,i,a+e,i+s,s),t.lineTo(a+e,r+o/2),t.lineTo(n,r+o/2-.27*o),t.lineTo(a,r+o/2)}t.closePath()}function Ie(t,e,n,r,o,i){const a=t.createRadialGradient(n,r-.1*o,0,n,r,.62*o);a.addColorStop(0,"#fff"),a.addColorStop(.7,"#e6e6e6"),a.addColorStop(1,"#8c8c8c"),t.globalAlpha=i,t.fillStyle=a,t.shadowColor="#bbb",t.shadowBlur=Math.max(2,.08*o),Re(t,e,n,r,o),t.fill(),t.shadowBlur=0,t.globalAlpha=1}function Pe(t,e,n,r,o){const i=n.x+n.w/2,a=n.y+n.h/2,s=n.h,l=1.45*s,c=(t=>t>=1?1:1-Math.exp(-5*t)*Math.cos(9*t))(r/.3),d=(t=>t<.5?4*t**3:1-(-2*t+2)**3/2)(L((r-.42)/.3)),u=d>0?l+(s-l)*d:.7*s+(l-.7*s)*c,h=L((r-.04)/.46);h>0&&h<1&&(t.strokeStyle=(t=>{const e=Math.round(255*L(t));return`rgb(${e} ${e} ${e})`})(.8*(1-h)**1.4),t.lineWidth=2.4-1.2*h,t.lineJoin="round",Re(t,e,i,a,s*(1.2+.5*ze(h))),t.stroke());t.fillStyle="#fff";for(let e=0;e<7;e++){const n=(r-.1-.05*z(e,o))/.5;if(n<=0||n>=1)continue;const l=-Math.PI/2+(e-3)/7*Math.PI*1.7+.3*(z(o+1,e)-.5),c=s*(.75+(.55+.35*z(e,o+2))*ze(n)),d=1.8*(1-.6*n);t.globalAlpha=1-n*n,t.beginPath(),t.arc(i+Math.cos(l)*c*1.15,a+Math.sin(l)*c*.85,d,0,2*Math.PI),t.fill()}t.globalAlpha=1,Ie(t,e,i,a,u,1-L((r-.72)/.28))}var Te={values:[],duration:520},Fe=t=>{const e=Math.round(255*L(t));return`rgb(${e} ${e} ${e})`};var We={dissolve:140,condense:160},Be=10,Oe=16;var Ne={cards:"[data-card]",loop:!0,threshold:.4,outset:56},Ge=(t,e,n)=>t+(e-t)*n,qe=(t,e,n)=>({x:t,v:0,to:t,k:e,z:n}),He=Array.from({length:96},(t,e)=>{const n=43758.5453*Math.sin(127.1*e+311.7);return n-Math.floor(n)});var De={length:6,accept:"digits",cells:"[data-cell]"},je=560,Ue=t=>{const e=Math.round(255*L(t));return`rgb(${e} ${e} ${e})`};function Ve(t){const e=()=>({image:t,width:t.naturalWidth,height:t.naturalHeight});return t.complete&&t.naturalWidth?Promise.resolve(e()):new Promise((n,r)=>{const o=()=>{a(),n(e())},i=()=>{a(),r(new Error(`Could not load ${t.src}`))},a=()=>{t.removeEventListener("load",o),t.removeEventListener("error",i)};t.addEventListener("load",o),t.addEventListener("error",i)})}function Xe(t,e=document.createElement("img")){return(t=>{try{return"undefined"!=typeof location&&new URL(t,location.href).origin!==location.origin}catch{return!1}})(t)&&!e.crossOrigin&&(e.crossOrigin="anonymous"),e.decoding="async",e.src=t,e}function Ye(t,e,n,r,o,i,a=.5,s=.5){if(o<=0||i<=0||!e.width||!e.height)return;const l=Math.max(o/e.width,i/e.height),c=o/l,d=i/l;t.drawImage(e.image,(e.width-c)*a,(e.height-d)*s,c,d,n,r,o,i)}function Je(t,e,n=.08){const r=Math.min(1,420/Math.max(1,t.width,t.height)),o=document.createElement("canvas");o.width=Math.max(1,Math.round(t.width*r)),o.height=Math.max(1,Math.round(t.height*r));const i=o.getContext("2d",{willReadFrequently:!0});if(!i)return t;let a;i.drawImage(t.image,0,0,o.width,o.height);try{a=i.getImageData(0,0,o.width,o.height)}catch{return t}const s=a.data,l=new Uint32Array(256),c=s.length/4,d=t=>.2126*s[t]+.7152*s[t+1]+.0722*s[t+2];for(let t=0;t<s.length;t+=4)l[Math.round(d(t))]++;let u=0,h=255,p=0;for(let t=0;t<256;t++)if(p+=l[t],p>=.02*c){u=t;break}p=0;for(let t=255;t>=0;t--)if(p+=l[t],p>=.02*c){h=t;break}const f=Math.max(1,h-u);for(let t=0;t<s.length;t+=4){let r=L((d(t)-u)/f);e&&(r=1-r),s[t]=s[t+1]=s[t+2]=Math.round(255*(n+(1-n)*r)),s[t+3]=255}return i.putImageData(a,0,0),{image:o,width:o.width,height:o.height}}var _e={strong:1,text:.82,meta:.55,tile:.42,icon:.62},Ke=new Set(["IMG","SVG","svg","VIDEO","PICTURE"]),Qe=t=>[...t.children].flatMap(t=>Ke.has(t.tagName)?[t]:[t,...Qe(t)]);function Ze(t,e,n,r){const o=document.createElement("canvas");o.width=Math.max(2,Math.round(2*e)),o.height=Math.max(2,Math.round(2*n));const i=[],a=o.getContext("2d");if(!a)return{canvas:o,rects:i};a.scale(2,2),a.fillStyle="#000",a.fillRect(0,0,e,n);const s=r(t),l=t.getBoundingClientRect(),c=l.width/(t.offsetWidth||l.width||1)||1,d=e=>{for(let n=e;n&&n!==t.parentElement;n=n.parentElement){const t=n.dataset?.paint;if(t&&void 0!==_e[t])return _e[t]}return parseFloat(e?getComputedStyle(e).fontWeight:"400")>=500?1:.7},u=t=>{const e=Math.round(255*L(t));return`rgb(${e} ${e} ${e})`},h=Qe(t),p=[t,...h].filter(t=>{const e=t.dataset?.paint;return"tile"===e||"icon"===e||!e&&Ke.has(t.tagName)&&!t.closest("[data-paint]")});for(const t of p){const e=r(t);if(e.w<=0||e.h<=0)continue;const n=t.dataset?.paint;a.fillStyle=u("icon"===n?_e.icon:_e.tile),a.beginPath(),"icon"===n||"svg"===t.tagName.toLowerCase()?a.arc(e.x+e.w/2,e.y+e.h/2,.4*Math.min(e.w,e.h),0,2*Math.PI):a.roundRect(e.x,e.y,e.w,e.h,Math.min(parseFloat(getComputedStyle(t).borderTopLeftRadius)||0,e.h/2)),a.fill(),i.push(e)}const f=document.createTreeWalker(t,4),m=document.createRange();a.textBaseline="middle";for(let t=f.nextNode();t;t=f.nextNode()){const e=t.parentElement;if(!e||e.closest('[data-paint="none"]'))continue;const n=getComputedStyle(e);a.font=`${n.fontStyle} ${n.fontWeight} ${n.fontSize} ${n.fontFamily}`,a.fillStyle=u(d(e)),a.shadowColor=a.fillStyle,a.shadowBlur=4;for(const e of t.data.matchAll(/\S+/g)){m.setStart(t,e.index),m.setEnd(t,e.index+e[0].length);const n=m.getClientRects()[0];if(!n)continue;const r={x:s.x+(n.left-l.left)/c,y:s.y+(n.top-l.top)/c,w:n.width/c,h:n.height/c};a.fillText(e[0],r.x,r.y+r.h/2),i.push(r)}}return a.shadowBlur=0,m.detach?.(),{canvas:o,rects:i}}function tn(t,e,n,r,o,i,a=1,s=.32){for(let l=0;l<n.length;l++){const c=n[l],d=(o-r[l]*(1-s))/s;if(d<=0)continue;const u=d>=1?0:1-d;let h=c.x,p=c.y;if(u>0){const[t,e]=i(c,u);h+=t,p+=e}t.globalAlpha=a*(1-u*u),t.drawImage(e,2*c.x,2*c.y,8,12,h,p,4,6)}t.globalAlpha=1}function en(t,e){if("undefined"==typeof document||document.getElementById(t))return;const n=document.createElement("style");n.setAttribute("id",t),n.textContent=e,(document.head??document.documentElement).appendChild(n)}var nn={max:3,duration:6e3,label:"Notifications",glint:!0},rn=4200,on="cubic-bezier(.16, 1, .3, 1)",an=`\n:where(.ascii-toasts){position:relative;margin:0;padding:0;list-style:none;min-height:52px}\n:where(.ascii-toast){position:absolute;left:0;right:0;bottom:0;box-sizing:border-box;display:flex;align-items:center;gap:10px;min-height:52px;padding:8px 8px 8px 10px;border-radius:13px;background:var(--ascii-toast-bg,Canvas);color:var(--ascii-toast-ink,CanvasText);box-shadow:0 0 0 1px rgb(128 128 128 / .22),0 8px 24px rgb(0 0 0 / .12);z-index:calc(10 - var(--d,0));transform-origin:50% 0;translate:0 calc(var(--d,0) * -10px);scale:calc(1 - var(--d,0) * .05);transition:translate 280ms ${on},scale 280ms ${on},opacity 160ms ${on}}\n:where(.ascii-toast) > *{transition:opacity 160ms ${on}}\n:where(.ascii-toast[data-back]) > *{opacity:0}\n:where(.ascii-toasts:not([data-open])) :where(.ascii-toast[data-back]) > *{pointer-events:none}\n:where(.ascii-toasts[data-open]) :where(.ascii-toast){translate:0 calc(var(--d,0) * (-100% - 8px));scale:1}\n:where(.ascii-toasts[data-open]) :where(.ascii-toast[data-back]) > *{opacity:1}\n:where(.ascii-toast[data-forming]){animation:ascii-toast-in 200ms ${on} both}\n:where(.ascii-toast[data-forming],.ascii-toast[data-gone]) > *{opacity:0;transition:none}\n:where(.ascii-toast[data-gone]){opacity:0;pointer-events:none}\n@keyframes ascii-toast-in{from{opacity:0}}\n:where(.ascii-toast-icon){display:grid;place-items:center;flex:none;width:32px;height:32px;border-radius:8px;background:rgb(128 128 128 / .14)}\n:where(.ascii-toast-text){display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}\n:where(.ascii-toast-title){overflow:hidden;font-size:14px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}\n:where(.ascii-toast-body){overflow:hidden;font-size:13px;opacity:.68;text-overflow:ellipsis;white-space:nowrap}\n:where(.ascii-toast-action,.ascii-toast-close){flex:none;border:0;background:rgb(128 128 128 / .14);color:inherit;font:inherit;cursor:pointer}\n:where(.ascii-toast-action){height:32px;padding:0 12px;border-radius:999px;font-size:14px;font-weight:500}\n:where(.ascii-toast-close){display:grid;place-items:center;width:28px;height:28px;border-radius:999px;background:transparent;font-size:18px;line-height:1;opacity:.6}\n@media (prefers-reduced-motion:reduce){:where(.ascii-toast){transition:none}:where(.ascii-toast[data-forming]){animation:none}}\n`,sn=t=>{const e=Math.round(255*L(t));return`rgb(${e} ${e} ${e})`};var ln=t=>{const[e,n,r]=N(t).map(t=>{const e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4});return.2126*e+.7152*n+.0722*r};var cn={lines:3,start:!0,stagger:38,rule:!0},dn=420,un=t=>`Thought for ${t}s`;var hn={caret:!0,settle:60,stagger:18,reasoningLines:2},pn="cubic-bezier(.16, 1, .3, 1)",fn=`\n:where(.ascii-reasoning){display:grid;grid-template-rows:1fr;transition:grid-template-rows 260ms ${pn},opacity 200ms ${pn}}\n:where(.ascii-reasoning[data-collapsed]){grid-template-rows:0fr;opacity:0}\n:where(.ascii-reasoning-in){min-height:0;overflow:hidden}\n:where(.ascii-reasoning ol){height:calc(var(--ascii-reasoning-lines, 2) * 1.5em);margin:0 0 .5em;padding:0;list-style:none;overflow:hidden;-webkit-mask-image:linear-gradient(to bottom,transparent,#000 45%);mask-image:linear-gradient(to bottom,transparent,#000 45%)}\n:where(.ascii-reasoning li){height:1.5em;line-height:1.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;opacity:.62;translate:0 calc(var(--ascii-reasoning-shift, 0) * -1.5em);transition:translate 240ms ${pn},opacity 200ms ${pn}}\n:where(.ascii-reasoning li[data-new]){opacity:0}\n@media (prefers-reduced-motion: reduce){:where(.ascii-reasoning, .ascii-reasoning li){transition:none}}\n`,mn=t=>[...t.children].filter(t=>"IMG"===t.tagName&&void 0!==t.dataset?.asciiPoster);var gn=t=>"string"==typeof t?{src:t}:t;var vn={maxBytes:10485760,develop:720};var yn={duration:620,collapse:!0,remove:!1},bn=16,Mn=new WeakMap;var xn={threshold:88},wn=.3;var kn={standard:{label:"Classic ASCII",chars:" .:-=+*#%@"},asciify:{label:"Asciify",chars:" .:-=+YCIFSA#@"},minimal:{label:"Minimal",chars:" .:+"},detailed:{label:"Detailed",chars:" .,:;itLf1CG80@"},letters:{label:"Letters",chars:" .liLTYCFSAWM"},technical:{label:"Technical",chars:" ._:;+/>=][{}*$#@"},blocks:{label:"Tonal blocks",chars:" ░▒▓█"},braille:{label:"Braille",chars:" ⠁⠃⠇⡇⣇⣧⣷⣿"}},Sn=(t,e,n,r)=>"number"==typeof t&&Number.isFinite(t)?Math.min(r,Math.max(n,t)):e;function An(t){if(!t)return;if("dots"===t)return" ·∙•●";const e=kn[t];return e&&Object.prototype.hasOwnProperty.call(kn,t)?e.chars:t.startsWith(" ")?t:" "+t}var Cn=(t,e)=>!1===t.cursor?"none":"string"==typeof t.cursor?t.cursor:e;function En(t,e,n){let r=null;if(r=Ut({host:t.host,kit:t.kit,layer:"under",look:n=>{const r=t.settings();return{...e(r,n),...r.look}},ink:e=>t.ink(e)??(e?n.dark:n.light),reducedMotion:t.reducedMotion,onFail:()=>{r=null,t.onFail()}}),!r)return null;const o=r.canvas;return{get field(){return r?.field??null},get canvas(){return r?.canvas??o},refresh(){r?.refresh()},play(){r?.field.play()},pause(){r?.field.pause()},destroy(){r?.destroy(),r=null}}}var $n=()=>"number"==typeof innerWidth&&innerWidth<760,Ln=(t,e)=>({scene:"drift",levels:"auto",color:"ink",shade:0,background:"transparent",vignette:0,speed:t.speed,maxPixelRatio:2,hover:e,lantern:{radius:.16,strength:.35,trail:.6,follow:9},fluid:{radius:.09,refraction:.03,glow:.6},clear:!!t.clear&&{element:t.clear,padding:32,feather:.2,shape:"rect"}}),zn={light:"#8f8d86",dark:"#64625d"},Rn={id:"drift",name:"Drift",description:"Characters that drift slowly and stay clear around your content, drawn on the GPU.",cellSize:11,speed:1,cursor:!0,mount:t=>En(t,t=>({...Ln(t,Cn(t,"trail")),mark:"glyph",scale:$n()?1.6:1,charset:t.charset??" .:-=+*#",font:'"Geist Mono", ui-monospace, monospace',fontWeight:400,cellSize:t.cellSize,cellAspect:.62,glyphScale:.86,brightness:.05,trail:{strength:.9,radius:.32}}),zn)},In={id:"halftone",name:"Halftone",description:"The drifting ground drawn as dots, clear around your content.",cellSize:14,speed:1,cursor:!0,mount:t=>En(t,t=>({...Ln(t,Cn(t,"lantern")),mark:"dot",scale:$n()?1.8:1,cellSize:t.cellSize,cellAspect:1,dotScale:.64,trail:{strength:.9,radius:.4}}),zn)},Pn={id:"field",name:"Field",description:"A word becomes the background, drawn by the GPU with a soft wake.",cellSize:13,speed:1,cursor:!0,mount:t=>En(t,(t,e)=>({scene:"flow",levels:"auto",charset:t.charset??" .,:-+"+t.text.replace(/\s+/g,"").toUpperCase(),font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:t.cellSize,cellAspect:.8,glyphScale:.76,color:"ink",shade:e?.4:0,background:"transparent",contrast:1.1,vignette:0,speed:t.speed,maxPixelRatio:2,hover:Cn(t,"trail"),fluid:{radius:.09,refraction:.04,glow:.7,dissipation:1.3},lantern:{radius:.13,strength:.6,trail:.5,follow:11},trail:{strength:.9,radius:.4}}),{light:"#9a9891",dark:"#7d7b75"})},Tn=class{constructor(t=1,e=3.5,n=!1){this.strokes=[],this.advected=[0,0,0],this.previous=null,this.energy=0,this.continuousWake=n,this.decayRate=e,this.aspect=Math.max(.25,Math.min(4,t));const r=n?96:64;this.columns=this.aspect>=1?r:Math.round(r*this.aspect),this.rows=this.aspect>=1?Math.round(r/this.aspect):r,this.front=new Float32Array(this.columns*this.rows*3),this.back=new Float32Array(this.front.length)}get active(){return this.energy>5e-4||this.strokes.length>0}move(t,e){if(!Number.isFinite(t+e))return;if(this.continuousWake&&!this.previous)return void(this.previous={x:t,y:e});const n=this.previous??{x:t-.004,y:e-.001},r=Math.max(-.09,Math.min(.09,t-n.x)),o=Math.max(-.09,Math.min(.09,e-n.y));if(this.previous={x:t,y:e},Math.abs(r)+Math.abs(o)<1e-4)return;const i=Math.min(1,25*Math.hypot(r*this.aspect,o)+.06);this.strokes.push({x:t,y:e,dx:r,dy:o,speed:i,fromX:n.x,fromY:n.y}),this.strokes.length>12&&this.strokes.shift()}leave(){this.previous=null}clear(){this.front.fill(0),this.back.fill(0),this.strokes.length=0,this.previous=null,this.energy=0}read(t,e,n,r){const o=Math.max(0,Math.min(this.columns-1.001,e*(this.columns-1))),i=Math.max(0,Math.min(this.rows-1.001,n*(this.rows-1))),a=Math.floor(o),s=Math.floor(i),l=o-a,c=i-s,d=3*(s*this.columns+a),u=d+3*this.columns,h=1-l,p=1-c;r[0]=(t[d]*h+t[d+3]*l)*p+(t[u]*h+t[u+3]*l)*c,r[1]=(t[d+1]*h+t[d+4]*l)*p+(t[u+1]*h+t[u+4]*l)*c,r[2]=(t[d+2]*h+t[d+5]*l)*p+(t[u+2]*h+t[u+5]*l)*c}sample(t,e,n){this.read(this.front,t,e,n)}step(t){if(!this.active)return;const e=Math.max(0,Math.min(.05,t)),n=Math.exp(-e*this.decayRate),r=Math.exp(-e*(this.decayRate+.5)),o=Math.max(1,this.aspect),i=Math.max(1,1/this.aspect);let a=0;for(let t=0;t<this.rows;t++)for(let s=0;s<this.columns;s++){const l=3*(t*this.columns+s),c=s/(this.columns-1),d=t/(this.rows-1),u=this.continuousWake?.65:2,h=c-this.front[l]*e*u,p=d-this.front[l+1]*e*u;this.read(this.front,h,p,this.advected);let f=this.advected[0]*n,m=this.advected[1]*n,g=this.advected[2]*r;for(const t of this.strokes){let e=(c-t.x)*o,n=(d-t.y)*i;if(this.continuousWake){const r=(c-t.fromX)*o,a=(d-t.fromY)*i,s=(t.x-t.fromX)*o,l=(t.y-t.fromY)*i,u=Math.max(0,Math.min(1,(r*s+a*l)/(s*s+l*l||1)));e=r-s*u,n=a-l*u;const h=e*e+n*n;if(h>.0225)continue;const p=Math.exp(-h/.0032),v=Math.hypot(t.dx*o,t.dy*i),y=Math.min(.025,.55*v);f+=(4.2*t.dx-n*y)*p,m+=(4.2*t.dy+e*y)*p,g=Math.max(g,Math.min(.7,18*v)*p);continue}const r=e*e+n*n;if(r>.045)continue;const a=Math.exp(-r/.0075),s=t.speed;f+=(2.8*t.dx-n*s*.16)*a,m+=(2.8*t.dy+e*s*.16)*a,g+=s*a*.3}this.back[l]=Math.max(-.18,Math.min(.18,f)),this.back[l+1]=Math.max(-.18,Math.min(.18,m)),this.back[l+2]=Math.min(.8,g),a=Math.max(a,Math.abs(f),Math.abs(m),g)}[this.front,this.back]=[this.back,this.front],this.strokes.length=0,this.energy=a,this.active||this.clear()}};var Fn=" .:+-=xICA$FY#@",Wn=.58,Bn=72649.5/59542.5;var On={id:"fluid",name:"Fluid",description:"Flowing folds with a soft wake behind the cursor. The original Asciify hero.",cellSize:7,speed:1,cursor:!0,opacity:.7,mount:function(t){const{host:e}=t;let n=new Tn(1),r=1,o=12,i=0,a=!1,s=null;const l=[],c=(e,n)=>((t,e,n)=>Math.max(t,Math.sqrt(e*n*Wn/26e3)))(t.settings().cellSize,e,n),d=Y({host:e,kit:t.kit,layer:"under",look:()=>{const n=t.settings();return{mark:"glyph",charset:n.charset??Fn,font:'"JetBrains Mono", monospace',fontWeight:400,cellSize:c(e.clientWidth||1,e.clientHeight||1)/Wn,cellAspect:Wn,glyphScale:.9,cellFit:"fill",maxPixelRatio:1.5,color:"ink",shade:0,levels:"none",fit:"cover",gamma:1,contrast:Bn,brightness:-.0004316244699164449-.5/Math.max(1,Array.from(n.charset??Fn).length-1),...n.look}},ink:e=>t.ink(e)??"#8f8d86",resolution:(t,e)=>{const n=Math.max(192,Math.min(384,Math.ceil(Math.max(t,e*Wn)/c(t,e)))),r=t/e;return r>=1?[n,Math.max(1,Math.round(n/r))]:[Math.max(1,Math.round(n*r)),n]},reducedMotion:t.reducedMotion,onFail:()=>t.onFail(),paint:({pen:c,width:d,height:u,w:h,h:p,now:f,still:m})=>{const g=t.settings(),v=i?Math.min(.05,(f-i)/1e3):1/60;i=f,m||(o+=v*g.speed);const y=h/p;if(Math.abs(y-r)>.01&&(n=new Tn(y),r=y),m||!g.cursor)n.clear(),l.length=0;else{const t=e.getBoundingClientRect();if(t.width&&t.height)for(const e of l)n.move((e.x-t.left)/t.width,(e.y-t.top)/t.height);l.length=0,a&&(n.leave(),a=!1),n.step(v)}s&&s.width===d&&s.height===u||(s=c.createImageData(d,u));const b=s.data;!function(t,e,n,r,o,i){const a=[0,0,0],s=i.active;for(let l=0;l<n;l++)for(let c=0;c<e;c++){const d=c/e,u=l/n;s&&i.sample(d,u,a);const h=(d-.5-a[0])*r,p=u-.5-a[1],f=h+.22*Math.sin(5.2*p+.17*o)+.15*Math.sin(2.4*h-3.1*p-.1*o),m=p+.19*Math.sin(3.5*h+.13*o),g=Math.hypot(.8*f+.18,1.1*m),v=.5+.5*Math.sin(14*g-2.8*f+1.4*Math.sin(5*m)-.24*o),y=.5+.5*Math.sin(3.6*f-2.9*m+.09*o),b=Math.max(0,Math.min(1,v*v*(.48+.32*y)-.075+.75*a[2])),M=Math.round(255*b),x=4*(l*e+c);t[x]=t[x+1]=t[x+2]=M,t[x+3]=255}}(b,d,u,y,o,n);for(let t=0;t<b.length;t+=4){const e=b[t]<10?0:Math.min(255,1.45*b[t]);b[t]=b[t+1]=b[t+2]=.299*e+e*(185/232)*.587,b[t+3]=255}return c.putImageData(s,0,0),!0}});if(!d)return null;const u=t=>{if(t.target instanceof Element&&t.target.closest("button, a, input, select, summary, textarea"))return a=!0,void d.kick();l.push({x:t.clientX,y:t.clientY}),l.length>6&&l.shift(),d.kick()},h=()=>{a=!0,d.kick()};return e.addEventListener("pointermove",u),e.addEventListener("pointerdown",u),e.addEventListener("pointerleave",h),e.addEventListener("pointercancel",h),{get field(){return d.field},get canvas(){return d.canvas},refresh:()=>d.refresh(),play:()=>{i=0,d.play()},pause:()=>d.pause(),destroy(){e.removeEventListener("pointermove",u),e.removeEventListener("pointerdown",u),e.removeEventListener("pointerleave",h),e.removeEventListener("pointercancel",h),d.destroy()}}}},Nn="#6f6d67",Gn="#8f8d86",qn={x:-1,y:-1,users:0},Hn=t=>{qn.x=t.clientX,qn.y=t.clientY};function Dn(t,e,n=0){if("undefined"==typeof document)return null;const{host:r}=t,o=document.createElement("canvas");let i=null;try{i=o.getContext("2d")}catch{i=null}if(!i)return null;const a=i,s=H();"static"===getComputedStyle(r).position&&s.set(r,"position","relative"),s.set(r,"isolation","isolate"),o.dataset.asciiKit="",o.setAttribute("aria-hidden","true"),o.setAttribute("style","position:absolute;inset:0;width:100%;height:100%;pointer-events:none;border-radius:inherit;z-index:-1"),r.appendChild(o);let l,c=q(r),d="";const u=()=>{d=W(t.ink(c),r,c?Gn:Nn)??Gn;const e=t.settings().accent;l=e?W(e,r)??void 0:void 0};u();let h=0,p=!0,f=!1,m=!1,g=0,v=0,y=0,b=!1,M=9,x=9,w=1,k=1,S=n;const A={x:.5,y:.5},C=()=>!!(t.reducedMotion()??T()),E=()=>{const n=t.settings(),r=performance.now(),i={fontSize:n.cellSize,chars:n.charset,ditherStrength:n.dither,lightMode:!c,ink:d,accent:l,elapsed:x,speed:n.speed};for(a.globalAlpha=1,a.globalCompositeOperation="source-over";S>0;S--)e(a,w,k,M,A,i);e(a,w,k,M,A,i),(t=>{if(!t||!t.isConnected)return;const e=j(o,t);if(!e.w||!e.h)return;const n=.71*e.w+32,r=.71*e.h+32,i=o.width/w||1;a.save(),a.setTransform(i*n,0,0,i*r,i*(e.x+e.w/2),i*(e.y+e.h/2));const s=a.createRadialGradient(0,0,0,0,0,1);s.addColorStop(0,"rgba(0,0,0,1)"),s.addColorStop(.72,"rgba(0,0,0,1)"),s.addColorStop(1,"rgba(0,0,0,0)"),a.globalCompositeOperation="destination-out",a.fillStyle=s,a.fillRect(-1,-1,2,2),a.restore()})(n.clear),y=.9*y+.1*(performance.now()-r),o.dataset.painted=""},$=e=>{if(h=0,m||f||!p||"undefined"!=typeof document&&document.hidden)return void(g=v=0);const n=C(),r=t.settings(),i=v?e-v:17;if(v=e,!n&&y>4.5&&i<12&&(b=!b))return void(h=requestAnimationFrame($));const a=g?Math.min(.05,(e-g)/1e3):0;if(g=e,n||(M+=a*r.speed,x+=a),r.cursor&&qn.x>=0){const t=o.getBoundingClientRect();t.width&&t.height&&(A.x+=.07*((qn.x-t.left)/t.width-A.x),A.y+=.07*((qn.y-t.top)/t.height-A.y))}else r.cursor||(A.x+=.07*(.5-A.x),A.y+=.07*(.5-A.y));E(),n||(h=requestAnimationFrame($))},L=()=>{h||m||f||!p||(h=requestAnimationFrame($))},z=()=>{if(m)return;const t=Math.min(2,"number"==typeof devicePixelRatio&&devicePixelRatio||1);w=Math.max(1,o.clientWidth||r.clientWidth||1),k=Math.max(1,o.clientHeight||r.clientHeight||1),o.width=Math.round(w*t),o.height=Math.round(k*t),a.setTransform(t,0,0,t,0,0),S=n,p&&!f&&E(),L()};z();const R="function"==typeof ResizeObserver?new ResizeObserver(z):null;R?.observe(r);const I="function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{p=t.isIntersecting,g=0,p?L():h&&(cancelAnimationFrame(h),h=0)},{rootMargin:"64px"}):null;I?.observe(r);const P=()=>{g=0,L()};document.addEventListener("visibilitychange",P);const F="function"==typeof matchMedia?matchMedia("(prefers-reduced-motion: reduce)"):null;F?.addEventListener?.("change",P),0===qn.users++&&"function"==typeof addEventListener&&addEventListener("pointermove",Hn,{passive:!0});const B="object"==typeof document.fonts?document.fonts:null,O=()=>{m||!p||f||(E(),L())};B?.addEventListener?.("loadingdone",O),B?.ready?.then(O,()=>{});let N=0;const G=()=>{N||m||(N=requestAnimationFrame(()=>{N=0,m||(c=q(r),u(),C()&&E(),L())}))},D="function"==typeof matchMedia?matchMedia("(prefers-color-scheme: dark)"):null;D?.addEventListener?.("change",G);const U="function"==typeof MutationObserver?new MutationObserver(G):null;for(const t of[document.documentElement,document.body])t&&U?.observe(t,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]});return{field:null,canvas:o,refresh(){m||(c=q(r),u(),C()&&p&&!f&&E(),L())},play(){f&&(f=!1,g=0,L())},pause(){f=!0,h&&cancelAnimationFrame(h),h=0},destroy(){m||(m=!0,h&&cancelAnimationFrame(h),N&&cancelAnimationFrame(N),h=N=0,R?.disconnect(),I?.disconnect(),U?.disconnect(),document.removeEventListener("visibilitychange",P),F?.removeEventListener?.("change",P),D?.removeEventListener?.("change",G),B?.removeEventListener?.("loadingdone",O),0===--qn.users&&"function"==typeof removeEventListener&&removeEventListener("pointermove",Hn),o.remove(),o.width=o.height=0,s.restore())}}}function jn(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 n=t.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);return n?{r:+n[1],g:+n[2],b:+n[3]}:null}function Un(t){return t*t*t*(t*(6*t-15)+10)}function Vn(t,e,n){return t+(e-t)*n}function Xn(t,e){let n=127*t+311*e;return n^=n>>13,(n*(n*n*15731+789221)+1376312589&2147483647)/2147483647}function Yn(t,e){const n=Math.floor(t),r=Math.floor(e),o=e-r,i=Un(t-n),a=Un(o),s=Xn(n,r),l=Xn(n+1,r),c=Xn(n,r+1),d=Xn(n+1,r+1);return Vn(Vn(s,l,i),Vn(c,d,i),a)}function Jn(t,e){return(.5*Yn(t,e)+.25*Yn(2.1*t,2.1*e)+.125*Yn(4.3*t,4.3*e))/.875}var _n='"Geist Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace';function Kn(t){const e=("function"==typeof t.getTransform?t.getTransform().a:1)||1;return t=>Math.round(t*e)/e}var Qn={r:111,g:109,b:103},Zn={r:143,g:141,b:134};function tr(t,e,n){return Math.min(1,Math.max(0,(t-e)/(n-e)))}function er(t,e=.3,n=.95){return e+(n-e)*Math.min(1,Math.max(0,t))}var nr=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function rr(t,e,n,r,o=0){const i=(nr[(3&r)<<2|3&n]+.5)/16;return Math.min(e-1,Math.max(0,Math.floor(t*(e-1)+i*Math.min(1,Math.max(0,o)))))}var or={id:"aurora",name:"Aurora",description:"Soft bands of light drift across the page and ripple under the cursor.",cellSize:13,speed:.6,cursor:!0,mount:t=>Dn(t,(t,e,n,r,o,i)=>function(t,e,n,r,o={x:.5,y:.5},i={}){const{fontSize:a=13,chars:s=" .:-=+*#%",color:l,accentColor:c,speed:d=1,layers:u=5,softness:h=1.2,mouseRipple:p=.2,lightMode:f=!1}=i,m=Array.from(s),g=.62*a,v=1.3*a,y=Math.ceil(e/g),b=Math.ceil(n/v);t.clearRect(0,0,e,n),t.font=`${a}px ${_n}`,t.textBaseline="top";const M=f?Qn:Zn;let x=M.r,w=M.g,k=M.b;const S=Kn(t);if(l){const t=jn(l);t&&(x=t.r,w=t.g,k=t.b)}let A=x,C=w,E=k;const $=c?jn(c):null;$&&(A=$.r,C=$.g,E=$.b);const L=r*d,z=[];for(let t=0;t<u;t++){const e=Xn(17*t,31*t+7),n=Xn(23*t+5,11*t);z.push({fx:.8+2.2*e,fy:1.2+1.8*n,phase:e*Math.PI*4,dt:(.3+.5*Xn(7*t,13*t+3))*(t%2==0?1:-1),amp:.55+.45*Xn(29*t,3*t)})}for(let e=0;e<b;e++){const n=e/b;for(let r=0;r<y;r++){const a=r/y,s=a-o.x,l=n-o.y,c=Math.sqrt(s*s+l*l),d=p*Math.exp(-c*c/.06),f=a+s*d,b=n+l*d;let M=0,R=0;for(let t=0;t<u;t++){const{fx:e,fy:n,phase:r,dt:o,amp:i}=z[t];M+=Math.sin(f*e*Math.PI*2+L*o+r)*Math.cos(b*n*Math.PI*2+L*o*.7+1.3*r)*i,R+=i}const I=M/R,P=.5+.5*Math.tanh(I*h*2.2),T=tr(P,.48,.94);if(T<=0)continue;const F=m[rr(T,m.length,r,e,i.ditherStrength)];if(" "===F)continue;const W=!!$&&P>.86,B=er(T);t.fillStyle=W?`rgba(${A},${C},${E},${B})`:`rgba(${x},${w},${k},${B})`,t.fillText(F,S(r*g),S(e*v))}}}(t,e,n,r,o,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};function ir(t,e,n,r,o,i={}){if(n<=0||r<=0)return;const a=Math.max(6,i.fontSize??12),s=.62*a,l=1.2*a,c=jn(i.color??i.accentColor??"")??(i.lightMode?Qn:Zn),d=Kn(e),u=o*Math.max(0,i.speed??.35),h=n/r;e.clearRect(0,0,n,r),e.font=`${a}px ${_n}`,e.textBaseline="top";const p=Array.from(i.chars||" .:-=+*#%@");for(let o=0;o<r;o+=l)for(let a=0;a<n;a+=s){const n=a/r,f=o/r,m=tr(Math.min(1,Math.max(0,t(n,f,h,u))),.06,.72);if(m<=0)continue;const g=p[rr(m,p.length,Math.round(a/s),Math.round(o/l),i.ditherStrength)];" "!==g&&(e.fillStyle=`rgba(${c.r},${c.g},${c.b},${er(m)})`,e.fillText(g,d(a),d(o)))}}var ar=(t,e,n,r)=>{const o=Math.sin(7*t+Math.sin(5*e+.16*r)),i=Math.cos(8*e+Math.cos(4*t-.12*r)),a=Math.sin(6*(t+e)-.13*r);return.85*Math.pow(Math.max(0,1-Math.abs(o+i+.5*a)),7)},sr={id:"caustics",name:"Caustics",description:"Fine pools of light that drift like water across stone.",cellSize:12,speed:1,cursor:!1,mount:t=>Dn(t,(t,e,n,r,o,i)=>ir(ar,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))},lr=1,cr=2,dr=4,ur=8,hr={3:"─",12:"│",9:"┌",10:"┐",5:"└",6:"┘",11:"┬",7:"┴",13:"├",14:"┤",15:"┼",[lr]:"╶",[cr]:"╴",[dr]:"╵",[ur]:"╷"};var pr={id:"circuit",name:"Circuit",description:"Circuit traces with signals running along them.",cellSize:13,speed:1,cursor:!1,mount:t=>Dn(t,(t,e,n,r,o,i)=>function(t,e,n,r,o={}){const{fontSize:i=13,pulseColor:a="#ffffff",color:s="#00ff88",density:l=.38,speed:c=1,lightMode:d=!1}=o,u=.62*i,h=1.4*i,p=Math.ceil(e/u),f=Math.ceil(n/h),m=jn(s)??{r:0,g:255,b:136},g=jn(a)??{r:255,g:255,b:255},v=(t,e)=>{if(Xn(17*t+1,7*e+2)>l)return 0;let n=0;return t+1<p&&Xn(17*t+1,7*e+2)>.15&&(n|=1),t-1>=0&&Xn(17*(t-1)+1,7*e+2)>.15&&(n|=2),e+1<f&&Xn(17*t+1,7*(e+1)+2)>.15&&(n|=8),e-1>=0&&Xn(17*t+1,7*(e-1)+2)>.15&&(n|=4),n};t.clearRect(0,0,e,n),t.font=`${i}px "JetBrains Mono", monospace`,t.textBaseline="top";const y=r*c;for(let e=0;e<f;e++)for(let n=0;n<p;n++){const r=v(n,e);if(0===r)continue;const o=hr[r]??"·",i=(8*y+40*Xn(n,23*e))%p,a=(6*y+40*Xn(17*e,11*n))%f,s=(1&r||2&r)&&Math.abs(n-i)<1.5,l=(4&r||8&r)&&Math.abs(e-a)<1.5,c=s||l,d=.25+.35*Xn(3*n,5*e);c?(t.globalAlpha=.95,t.fillStyle=`rgb(${g.r},${g.g},${g.b})`):(t.globalAlpha=d,t.fillStyle=`rgb(${m.r},${m.g},${m.b})`),t.fillText(o,n*u,e*h)}t.globalAlpha=1}(t,e,n,r,{fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,pulseColor:i.accent??G(i.ink,"#ffffff",.7)}))},fr=(t,e,n,r)=>{const o=3.2*e+.36*Math.sin(3.4*t+.18*r)+.19*Math.cos(6*t-2*e+.12*r),i=.5+.5*Math.cos(o*Math.PI*6);return Math.pow(i,4)*(.35+.65*e)},mr={id:"contour",name:"Contour",description:"Fine topographic lines with a slow, rolling drift.",cellSize:12,speed:1,cursor:!1,mount:t=>Dn(t,(t,e,n,r,o,i)=>ir(fr,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))};var gr={id:"dna",name:"DNA",description:"Double helices scroll past with base-pair letters.",cellSize:13,speed:1,cursor:!1,mount:t=>Dn(t,(t,e,n,r,o,i)=>function(t,e,n,r,o={}){const{fontSize:i=13,baseChars:a="ATCG",bridgeChars:s="-=≡",color:l="#00e5ff",color2:c="#ff4081",bridgeColor:d="#88ffcc",speed:u=1,helixCount:h,lightMode:p=!1}=o,f=.62*i,m=1.4*i,g=Math.ceil(e/f),v=Math.ceil(n/m),y=h??Math.max(1,Math.floor(e/80)),b=g/y,M=jn(l)??{r:0,g:229,b:255},x=jn(c)??{r:255,g:64,b:129},w=jn(d)??{r:136,g:255,b:204};t.clearRect(0,0,e,n),t.font=`${i}px "JetBrains Mono", monospace`,t.textBaseline="top";const k=r*u,S=.35*b;for(let e=0;e<y;e++){const n=b*(e+.5);for(let r=0;r<v;r++){const o=r/v*Math.PI*6-1.8*k,i=n+Math.sin(o)*S,l=n+Math.sin(o+Math.PI)*S,c=Math.round(i),d=Math.round(l);if(c<0||c>=g)continue;const u=Xn(31*e+7*r,3),h=a[Math.floor(u*a.length)],p=.5*(Math.sin(o)+1),y=.5*(Math.sin(o+Math.PI)+1);if(t.globalAlpha=.35+.65*p,t.fillStyle=`rgb(${M.r},${M.g},${M.b})`,t.fillText(h,c*f,r*m),d>=0&&d<g){const n=Xn(53*e+11*r,7),o=a[Math.floor(n*a.length)];t.globalAlpha=.35+.65*y,t.fillStyle=`rgb(${x.r},${x.g},${x.b})`,t.fillText(o,d*f,r*m)}if(r%3==0){const n=Math.min(c,d),o=Math.max(c,d);if(o-n>1){const i=Xn(17*r+43*e,5),a=s[Math.floor(i*s.length)],l=.25*(p+y)+.2;t.globalAlpha=l,t.fillStyle=`rgb(${w.r},${w.g},${w.b})`;for(let e=n+1;e<o;e++)t.fillText(a,e*f,r*m)}}}}t.globalAlpha=1}(t,e,n,r,{fontSize:i.fontSize,color:i.ink,color2:i.accent??G(i.ink,"#ffffff",.55),bridgeColor:G(i.ink,"#0c0d0b",.35)}))},vr=(t,e,n,r)=>{const o=7*e+.55*Math.sin(2.2*t+.09*r)+.22*Math.sin(4.8*t-.07*r),i=.5+.5*Math.sin(o);return Math.pow(i,5)*(.35+.65*e)+.08*Math.pow(.5+.5*Math.sin(17*o),3)*i},yr={id:"dune",name:"Dune",description:"Layered sand ridges with slow-moving light and fine grain.",cellSize:12,speed:1,cursor:!1,mount:t=>Dn(t,(t,e,n,r,o,i)=>ir(vr,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))},br=(t,e,n,r)=>{const o=48*t+4*Math.sin(2.6*e+.08*r)+1.5*Math.sin(7*e-2*t);return Math.pow(.5+.5*Math.sin(o),10)*(.35+.55*Math.pow(Math.sin(2*e+.4),2))},Mr={id:"etch",name:"Etch",description:"Cut-grain lines follow a slow, sculpted current.",cellSize:12,speed:1,cursor:!1,mount:t=>Dn(t,(t,e,n,r,o,i)=>ir(br,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))},xr=(t,e,n,r)=>{const o=2.8*t+1.8*e+.018*r,i=1.2*t-3.2*e,a=Math.abs(2*(o-Math.floor(o))-1),s=Math.abs(2*(i-Math.floor(i))-1);return.85*Math.pow(Math.min(a,s),1.8)},wr={id:"facet",name:"Facet",description:"Quiet folded planes catch light along their edges.",cellSize:12,speed:1,cursor:!1,mount:t=>Dn(t,(t,e,n,r,o,i)=>ir(xr,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))};var kr={id:"fire",name:"Fire",description:"A cellular flame rising from the bottom edge.",cellSize:13,speed:1,cursor:!1,mount:t=>Dn(t,(t,e,n,r,o,i)=>function(t,e,n,r,o={}){const{fontSize:i=13,chars:a=" .,:;i+xX#&@",color:s="#ff4500",hotColor:l="#ffe066",intensity:c=.85,wind:d=0,speed:u=1,lightMode:h=!1}=o,p=.62*i,f=1.4*i,m=Math.ceil(e/p),g=Math.ceil(n/f),v=m*g,y="__fire_heat__",b=t.canvas;let M=b[y];M&&M.length===v||(M=new Float32Array(v),b[y]=M);const x=.016*u*.18,w=d*u*.8,k=g-1,S=r*u;for(let t=0;t<m;t++){const e=(.6*(.5*Math.sin(.31*t+4.1*S)+.5)+.4*(.5*Math.sin(.73*t-2.7*S)+.5))*c;M[k*m+t]=Math.min(1,e+.15*Math.random()*c),k>0&&(M[(k-1)*m+t]=Math.min(1,.85*e+.1*Math.random()*c))}const A=new Float32Array(v);for(let t=0;t<g-2;t++)for(let e=0;e<m;e++){const n=.4*M[(t+1)*m+e]+.25*M[(t+2)*m+Math.max(0,Math.min(m-1,e+Math.round(w)))]+.175*M[(t+1)*m+Math.max(0,e-1)]+.175*M[(t+1)*m+Math.min(m-1,e+1)];A[t*m+e]=Math.max(0,n-x-.02*Math.random()*u)}for(let t=0;t<m;t++)A[(g-1)*m+t]=M[(g-1)*m+t],g>1&&(A[(g-2)*m+t]=M[(g-2)*m+t]);b[y]=A;const C=jn(s)??{r:255,g:69,b:0},E=jn(l)??{r:255,g:224,b:102};t.clearRect(0,0,e,n),t.font=`${i}px "JetBrains Mono", monospace`,t.textBaseline="top";for(let e=0;e<g;e++)for(let n=0;n<m;n++){const r=A[e*m+n];if(r<.03)continue;const o=a[Math.min(a.length-1,Math.floor(r*a.length))];if(" "===o)continue;const i=Math.min(1,1.2*r),s=C.r+(E.r-C.r)*i|0,l=C.g+(E.g-C.g)*i|0,c=C.b+(E.b-C.b)*i|0,d=h?1-.3*r:Math.min(1,r+.15);t.globalAlpha=d,t.fillStyle=`rgb(${s},${l},${c})`,t.fillText(o,n*p,e*f)}t.globalAlpha=1}(t,e,n,i.elapsed,{fontSize:i.fontSize,chars:i.chars,color:i.ink,hotColor:i.accent??G(i.ink,"#ffffff",.6),speed:i.speed}),48)};var Sr={id:"grid",name:"Grid",description:"Scan bands roll down a character grid and glitch near the cursor.",cellSize:12,speed:1,cursor:!0,mount:t=>Dn(t,(t,e,n,r,o,i)=>function(t,e,n,r,o={x:.5,y:.5},i={}){const{fontSize:a=12,chars:s="·-=+|/",accentColor:l,color:c,bands:d=3,speed:u=1,bandWidth:h=.12,glitch:p=!0,lightMode:f=!1}=i,m=l??(f?"#6b8700":"#d4ff00"),g=.62*a,v=1.4*a,y=Math.ceil(e/g),b=Math.ceil(n/v);t.clearRect(0,0,e,n),t.font=`${a}px monospace`,t.textBaseline="top";let M=255,x=255,w=255;if(f&&(M=55,x=55,w=55),c){const t=jn(c);t&&(M=t.r,x=t.g,w=t.b)}let k=212,S=255,A=0;const C=jn(m);C&&(k=C.r,S=C.g,A=C.b);const E=r*u;for(let e=0;e<b;e++)for(let n=0;n<y;n++){const r=e/b,i=((r*d-.5*E)%1+1)%1,a=Math.max(0,1-i/h),l=.35*(.5*Xn(3*n,7*e)+.5);let c=0;if(p){const t=n/y-o.x,i=r-o.y,a=Math.sqrt(t*t+i*i);if(a<.18){const t=Xn(11*n+Math.floor(12*E),5*e);c=Math.max(0,1-a/.18)*(t>.5?t-.3:0)}}const u=Math.min(1,l+.8*a+.6*c);if(u<.04)continue;const m=s[Math.floor(u*(s.length-1))],C=a>.55,$=f?.82*u:.12*u;t.fillStyle=C?`rgba(${k},${S},${A},${f?.92:.28})`:`rgba(${M},${x},${w},${$})`,t.fillText(m,n*g,e*v)}}(t,e,n,r,o,{fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))},Ar=(t,e,n,r)=>{const o=.12+.06*Math.sin(.1*r),i=Math.sin(68*t),a=Math.sin(68*(t*Math.cos(o)+e*Math.sin(o)));return.8*Math.pow((i+a+2)/4,3)},Cr={id:"moire",name:"Moiré",description:"Two fine line fields overlap into broad, shifting bands.",cellSize:12,speed:1,cursor:!1,mount:t=>Dn(t,(t,e,n,r,o,i)=>ir(Ar,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))};var Er={id:"morph",name:"Morph",description:"Every cell shimmers at its own frequencies.",cellSize:14,speed:1,cursor:!1,mount:t=>Dn(t,(t,e,n,r,o,i)=>function(t,e,n,r,o={}){const{fontSize:i=14,chars:a=" ·∙•:-=+*#",color:s,accentColor:l,speed:c=.5,harmonics:d=3,lightMode:u=!1}=o,h=l??(u?"#6b8700":"#d4ff00"),p=.62*i,f=1.4*i,m=Math.ceil(e/p),g=Math.ceil(n/f);t.clearRect(0,0,e,n),t.font=`${i}px monospace`,t.textBaseline="top";let v=255,y=255,b=255;if(u&&(v=55,y=55,b=55),s){const t=jn(s);t&&(v=t.r,y=t.g,b=t.b)}let M=212,x=255,w=0;const k=jn(h);k&&(M=k.r,x=k.g,w=k.b);const S=r*c,A=Array.from({length:d},(t,e)=>1/(e+1)).reduce((t,e)=>t+e,0);for(let e=0;e<g;e++)for(let n=0;n<m;n++){let r=0;for(let t=0;t<d;t++){const o=.18+1.4*Xn(n*(t+3)+7,e*(t+5)+11),i=Xn(n*(t+7),e*(t+9)+3)*Math.PI*2,a=1/(t+1);r+=Math.sin(S*o+i)*a}const o=.5*(r/A+1);if(o<.28)continue;const i=(o-.28)/.72,s=a[Math.min(a.length-1,Math.floor(i*a.length))],l=o>.88,c=u?.82*i:.13*i;t.fillStyle=l?`rgba(${M},${x},${w},${u?.92:.28})`:`rgba(${v},${y},${b},${c})`,t.fillText(s,n*p,e*f)}}(t,e,n,r,{fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};var $r={id:"noise",name:"Noise",description:"A slow fractal noise field that warps around the cursor.",cellSize:13,speed:.5,cursor:!0,mount:t=>Dn(t,(t,e,n,r,o,i)=>function(t,e,n,r,o={x:.5,y:.5},i={}){const{fontSize:a=13,chars:s=" .:-=+*#%@",accentColor:l,color:c,octaves:d=4,speed:u=1,scale:h=1,accentThreshold:p=.9,mouseWarp:f=.3,lightMode:m=!1}=i,g=Array.from(s),v=.62*a,y=1.3*a,b=Math.ceil(e/v),M=Math.ceil(n/y);t.clearRect(0,0,e,n),t.font=`${a}px ${_n}`,t.textBaseline="top";const x=m?Qn:Zn;let w=x.r,k=x.g,S=x.b;const A=Kn(t);if(c){const t=jn(c);t&&(w=t.r,k=t.g,S=t.b)}let C=w,E=k,$=S;const L=l?jn(l):null;L&&(C=L.r,E=L.g,$=L.b);const z=.035*h,R=r*u,I=Math.min(6,Math.max(1,d)),P=(t,e)=>{let n=0,r=.5,o=1,i=0;for(let a=0;a<I;a++)n+=Yn(t*o,e*o)*r,i+=r,r*=.5,o*=2.1;return n/i};for(let e=0;e<M;e++)for(let n=0;n<b;n++){const r=n*z+.06*R,a=e*z*1.3-.04*R,s=n/b-o.x,l=e/M-o.y,c=Math.sqrt(s*s+l*l),d=f>0?.12*Math.max(0,1-c/f):0,u=tr(.5*P(r+d*Math.sin(1.3*R+8*l),a+d*Math.cos(.9*R+8*s))+.5,.7,.83);if(u<=0)continue;const h=g[rr(u,g.length,n,e,i.ditherStrength)];if(" "===h)continue;const m=!!L&&u>p,x=er(u);t.fillStyle=m?`rgba(${C},${E},${$},${x})`:`rgba(${w},${k},${S},${x})`,t.fillText(h,A(n*v),A(e*y))}}(t,e,n,r,o,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};var Lr={id:"pulse",name:"Pulse",description:"Rings of characters ripple out from the cursor.",cellSize:14,speed:1,cursor:!0,mount:t=>Dn(t,(t,e,n,r,o,i)=>function(t,e,n,r,o={x:.5,y:.5},i={}){const{fontSize:a=14,chars:s=". · ○ ◎ ●",accentColor:l,color:c,rings:d=5,speed:u=1,sharpness:h=4,lightMode:p=!1}=i,f=l??(p?"#007a5e":"#00ffcc");t.clearRect(0,0,e,n),t.textBaseline="middle",t.textAlign="center";const m=e*o.x,g=n*o.y,v=1.6*Math.sqrt(m*m+g*g)+.2*Math.sqrt(e*e+n*n);let y=255,b=255,M=255;if(p&&(y=55,b=55,M=55),c){const t=jn(c);t&&(y=t.r,b=t.g,M=t.b)}let x=0,w=255,k=204;const S=jn(f);S&&(x=S.r,w=S.g,k=S.b);const A=s.replace(/ /g,"").split("");if(0===A.length)return;const C=Math.ceil(e/a),E=Math.ceil(n/a);for(let e=0;e<E;e++)for(let n=0;n<C;n++){const o=n*a+.5*a,i=e*a+.5*a,s=o-m,l=i-g,c=Math.sqrt(s*s+l*l)/v;let f=0;for(let t=0;t<d;t++){const e=(r*u*.38+t/d)%1,n=Math.abs(c-e),o=Math.max(0,1-n*v/(a*(12-h)));f+=Math.cos(o*Math.PI*.5)*o}if(f=Math.min(1,f),f<.02)continue;const S=f>.6;t.font=`${a}px monospace`;const C=Math.floor(f*(A.length-1)),E=A[Math.min(C,A.length-1)],$=p?.88*f:.22*f;t.fillStyle=S?`rgba(${x},${w},${k},${Math.min(p?.95:.4,.55*f)})`:`rgba(${y},${b},${M},${$})`,t.fillText(E,o,i)}t.textAlign="left"}(t,e,n,r,o,{fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};var zr={id:"rain",name:"Rain",description:"Columns of falling characters with bright heads.",cellSize:13,speed:1,cursor:!1,mount:t=>Dn(t,(t,e,n,r,o,i)=>function(t,e,n,r,o={}){const{fontSize:i=13,chars:a="0123456789ABCDEF@#$&*+=/<>",accentColor:s,color:l,speed:c=1,density:d=.55,tailLength:u=14,lightMode:h=!1}=o,p=s??(h?"#6b8700":"#d4ff00"),f=.62*i,m=1.4*i,g=Math.ceil(e/f),v=Math.ceil(n/m);t.clearRect(0,0,e,n),t.font=`${i}px monospace`,t.textBaseline="top";let y=255,b=255,M=255;if(h&&(y=55,b=55,M=55),l){const t=jn(l);t&&(y=t.r,b=t.g,M=t.b)}let x=212,w=255,k=0;const S=jn(p);S&&(x=S.r,w=S.g,k=S.b);const A=v+u;for(let e=0;e<g;e++){if(Xn(17*e,3)>d)continue;const n=(.5+1.5*Xn(31*e,7))*c,o=Xn(13*e,11)*A,i=Math.floor((r*n*7+o)%A),s=e*f;for(let n=0;n<=u;n++){const o=i-(u-n);if(o<0||o>=v)continue;const l=o*m,c=Xn(53*e+Math.floor(5*r+n),7*o),d=a[Math.floor(c*a.length)],p=n/u;if(n===u)t.fillStyle=`rgba(${x},${w},${k},${h?.7:.85})`;else{const e=h?.85*p:.15*p;t.fillStyle=`rgba(${y},${b},${M},${e})`}t.fillText(d,s,l)}}}(t,e,n,r,{fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};var Rr={id:"silk",name:"Silk",description:"Long ribbons that follow a slow flow field.",cellSize:13,speed:1,cursor:!1,mount:t=>Dn(t,(t,e,n,r,o,i)=>function(t,e,n,r,o={}){const{fontSize:i=13,color:a,accentColor:s,speed:l=.4,layers:c=4,turbulence:d=.8,lightMode:u=!1}=o,h=.62*i,p=1.3*i,f=Math.ceil(e/h),m=Math.ceil(n/p);t.clearRect(0,0,e,n),t.font=`${i}px ${_n}`,t.textBaseline="top";const g=u?Qn:Zn;let v=g.r,y=g.g,b=g.b;const M=Kn(t);if(a){const t=jn(a);t&&(v=t.r,y=t.g,b=t.b)}let x=v,w=y,k=b;const S=s?jn(s):null;S&&(x=S.r,w=S.g,k=S.b);const A=r*l,C=o.chars?Array.from(o.chars):void 0,E=["-","\\","|","/"];for(let e=0;e<m;e++){const n=e/m;for(let r=0;r<f;r++){const i=r/f;let a=0,s=0;for(let t=0;t<c;t++){const e=Xn(13*t,7*t+3),r=1.1+2.4*e,o=.9+2*Xn(29*t,11*t+1),l=e*Math.PI*6,c=(.2+.5*Xn(41*t,17*t))*(t%2==0?1:-1.3),u=Math.sin(i*r*Math.PI*2+A*c+l),h=Math.cos(n*o*Math.PI*2+A*c*.6+1.7*l),p=Math.sin(i*o*Math.PI*d+n*r*Math.PI*d+A*c*.4);a+=Math.atan2(h+.3*p,u),s+=.5*(u*h+1)}const l=a/c,u=tr(s/c,.54,.74);if(u<=0)continue;const m=(l%Math.PI+Math.PI)%Math.PI,g=Math.round(m/(Math.PI/4))%E.length;if(!C&&o.ditherStrength&&0===rr(u,2,r,e,o.ditherStrength))continue;const $=C?C[rr(u,C.length,r,e,o.ditherStrength)]:E[g];if(" "===$)continue;const L=!!S&&u>.85,z=er(u);t.fillStyle=L?`rgba(${x},${w},${k},${z})`:`rgba(${v},${y},${b},${z})`,t.fillText($,M(r*h),M(e*p))}}}(t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};var Ir={id:"stars",name:"Stars",description:"A sparse starfield that twinkles, drifts and leans toward the cursor.",cellSize:14,speed:1,cursor:!0,mount:t=>Dn(t,(t,e,n,r,o,i)=>function(t,e,n,r,o={x:.5,y:.5},i={}){const{fontSize:a=14,chars:s=" . · * + ° ★",accentColor:l,color:c,speed:d=1,count:u=180,lightMode:h=!1}=i,p=l??(h?"#6b8700":"#d4ff00");t.clearRect(0,0,e,n),t.textBaseline="middle",t.textAlign="center";const f=e*(.2+.6*o.x),m=n*(.2+.6*o.y),g=.65*Math.sqrt(e*e+n*n);let v=255,y=255,b=255;if(h&&(v=55,y=55,b=55),c){const t=jn(c);t&&(v=t.r,y=t.g,b=t.b)}let M=212,x=255,w=0;const k=jn(p);k&&(M=k.r,x=k.g,w=k.b);const S=s.replace(/ /g,"").split("");if(0!==S.length){for(let o=0;o<u;o++){const i=Xn(17*o,3)*Math.PI*2,s=(r*(.15+.85*Xn(31*o,7))*d*.22+Xn(13*o,11))%1,l=f+Math.cos(i)*s*g,c=m+Math.sin(i)*s*g;if(l<-20||l>e+20||c<-20||c>n+20)continue;const u=Math.max(6,a*(.4+.9*s));t.font=`${u}px monospace`;const p=S[Math.min(S.length-1,Math.floor(s*S.length))],k=s>.72,A=h?.85*s:.2*s;t.fillStyle=k?`rgba(${M},${x},${w},${Math.min(h?.92:.32,2.2*A)})`:`rgba(${v},${y},${b},${A})`,t.fillText(p,l,c)}t.textAlign="left"}}(t,e,n,r,o,{fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};var Pr={id:"terrain",name:"Terrain",description:"A side-scrolling landscape drawn in density characters.",cellSize:13,speed:1,cursor:!1,mount:t=>Dn(t,(t,e,n,r,o,i)=>function(t,e,n,r,o={}){const{fontSize:i=13,chars:a=" .,:;+*#@",color:s="#4caf50",skyColor:l="#1a237e",peakColor:c="#e0e0e0",speed:d=1,roughness:u=.55,heightScale:h=.55,stars:p=!0,lightMode:f=!1}=o,m=.62*i,g=1.4*i,v=Math.ceil(e/m),y=Math.ceil(n/g),b=jn(s)??{r:76,g:175,b:80},M=jn(l)??{r:26,g:35,b:126},x=jn(c)??{r:224,g:224,b:224};t.clearRect(0,0,e,n),t.font=`${i}px "JetBrains Mono", monospace`,t.textBaseline="top";const w=r*d*.4,k=new Array(v);for(let t=0;t<v;t++){const e=(.5*Jn((t/v+w)*u*3,.5)+.5)*h;k[t]=Math.floor(e*y)}for(let e=0;e<y;e++)for(let n=0;n<v;n++){const o=y-1-k[n],i=e===o;if(!(e>=o)){if(p){const o=Xn(7*n+Math.floor(.3*w),13*e);if(o>.97){const i=.3*Math.sin(2*r+100*o)+.7;t.globalAlpha=.5*i,t.fillStyle=`rgb(${M.r+60},${M.g+60},${M.b+80})`,t.fillText("·",n*m,e*g)}}continue}const s=(e-o)/Math.max(1,k[n]),l=a[Math.min(a.length-1,Math.floor(s*a.length))];if(" "===l&&!i)continue;const c=i?1:Math.max(0,1-4*s),d=b.r+(x.r-b.r)*c|0,u=b.g+(x.g-b.g)*c|0,h=b.b+(x.b-b.b)*c|0;t.globalAlpha=.5+.5*s,t.fillStyle=`rgb(${d},${u},${h})`,t.fillText(i?a[a.length-1]:l,n*m,e*g)}t.globalAlpha=1}(t,e,n,r,{fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,peakColor:i.accent??G(i.ink,"#ffffff",.65),skyColor:G(i.ink,"#0c0d0b",.55)}))},Tr=(t,e,n,r)=>{const o=5.5*(t-.5*n)+.65*Math.sin(3.2*e+.2*r)+.12*r;return Math.pow(.5+.5*Math.cos(o),7)*(.45+.55*Math.sin(2.4*e+.2))},Fr={id:"veil",name:"Veil",description:"Tall folds of light drifting across a quiet ground.",cellSize:12,speed:1,cursor:!1,mount:t=>Dn(t,(t,e,n,r,o,i)=>ir(Tr,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))};var Wr={id:"void",name:"Void",description:"A gravity well that spirals characters around the cursor.",cellSize:13,speed:1,cursor:!0,mount:t=>Dn(t,(t,e,n,r,o,i)=>function(t,e,n,r,o={x:.5,y:.5},i={}){const{fontSize:a=13,chars:s=" ·:;=+*#%@",color:l,accentColor:c,speed:d=1,radius:u=.38,swirl:h=3,lightMode:p=!1}=i,f=c??(p?"#6b8700":"#d4ff00"),m=.62*a,g=1.4*a,v=Math.ceil(e/m),y=Math.ceil(n/g),b=e/n;t.clearRect(0,0,e,n),t.font=`${a}px monospace`,t.textBaseline="top";let M=255,x=255,w=255;if(p&&(M=55,x=55,w=55),l){const t=jn(l);t&&(M=t.r,x=t.g,w=t.b)}let k=212,S=255,A=0;const C=jn(f);C&&(k=C.r,S=C.g,A=C.b);const E=r*d;for(let e=0;e<y;e++){const n=e/y;for(let r=0;r<v;r++){const i=(r/v-o.x)*b,a=n-o.y,l=Math.sqrt(i*i+a*a)/u;if(l>1){const n=Xn(3*r,7*e)*Math.max(0,1-3*(l-1));if(n<.62)continue;const o=n*(p?.28:.04);t.fillStyle=`rgba(${M},${x},${w},${o})`,t.fillText(s[1],r*m,e*g);continue}const c=Math.max(0,1-Math.abs(l-(.15+.12*Math.sin(1.1*E)))/.07),d=Math.pow(1-l,2.2),h=Math.min(1,d+.6*c);if(h<.06)continue;const f=Math.floor(h*(s.length-1)),y=s[Math.min(s.length-1,f)],C=c>.35||l<.08,$=p?.85*h:.18*h;t.fillStyle=C?`rgba(${k},${S},${A},${p?.95:.38})`:`rgba(${M},${x},${w},${$})`,t.fillText(y,r*m,e*g)}}}(t,e,n,r,o,{fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};var Br={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=>Dn(t,(t,e,n,r,o,i)=>{const[a,s,l]=N(i.ink);!function(t,e,n,r,o={x:.5,y:.5},i={}){const{fontSize:a=13,charAspect:s=.62,lineHeightRatio:l=1.3,chars:c=" .:-=+*#%@",baseColor:d=null,accentColor:u,accentThreshold:h=.52,mouseInfluence:p=.4,mouseFalloff:f=2.8,speed:m=1,vortex:g=!0,sparkles:v=!1,breathe:y=!0,lightMode:b=!1}=i,M=Array.from(c),x=a*s,w=a*l,k=Math.ceil(e/x),S=Math.ceil(n/w),A=o.x,C=o.y,E=u?jn(u):null;t.clearRect(0,0,e,n),t.font=`${a}px ${_n}`;const $=Kn(t);t.textBaseline="top";const L=r*m,z=y?.12*(.5*Math.sin(.22*L)+.5):0;for(let e=0;e<S;e++)for(let n=0;n<k;n++){const r=n/k,o=e/S,a=.045,s=.08*L,l=.06,c=(.5*Math.sin(.08*n+.05*e+.6*L)+.5+(.5*Math.sin(.03*n-.07*e+.4*L)+.5)+(.5*Math.sin(.05*n+.03*e+.8*L)+.5))/3*.45+.35*(.5*Jn(n*a+s,e*a*1.4-.7*s)+.5)+.2*(.5*Math.sin((n+.65*e)*l+1.1*L)+.5)+z,u=r-A,m=o-C,y=Math.sqrt(u*u+m*m);let R=0;if(g&&y<.35){const t=Math.atan2(m,u),e=Math.sin(4*t+2.2*L-14*y),n=Math.max(0,1-y/.35);R=e*n*n*.22}const I=c*(1-p)+(Math.max(0,1-y*f)+.5*R)*p+.15*R,P=Math.min(1,Math.max(0,I));let T=P;if(v&&P>.72){const t=Math.floor(8*L),r=Xn(7*n+3*t,11*e+t);r>.88&&(T=Math.min(1,P+4*(r-.88)))}const F=tr(T,.32,.9);if(F<=0)continue;const W=rr(F,M.length,n,e,i.ditherStrength);if(" "===M[W])continue;const B=er(F);t.fillStyle=E&&T>h?`rgba(${E.r},${E.g},${E.b},${B})`:d?d.replace("{a}",String(B)):b?`rgba(111,109,103,${B})`:`rgba(143,141,134,${B})`,t.fillText(M[W],$(n*x),$(e*w))}}(t,e,n,r,o,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,baseColor:`rgba(${a},${s},${l},{a})`,accentColor:i.accent})})},Or=(t,e,n,r)=>{const o=.2*Math.sin(3*t+2*e+.2*r);return(.65*Math.pow(.5+.5*Math.sin(45*(t+o)),8)+.35*Math.pow(.5+.5*Math.sin(50*(e-.3*o)),10))*(.4+.6*Math.sin(2*e+.4))},Nr={id:"weave",name:"Weave",description:"Interlaced threads with a subtle change in tension.",cellSize:12,speed:1,cursor:!1,mount:t=>Dn(t,(t,e,n,r,o,i)=>ir(Or,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))};exports.BEAM_PALETTES=_,exports.PILL_TONES=Pt,exports.VOICE_PALETTES=se,exports.accordion=function(t,e){const n={current:{open:0,duration:280,label:"Images",...e}},r=H(),o=n.current.images.map(gn);let i=L(Math.round(n.current.open),0,Math.max(0,o.length-1)),a=0,s=performance.now(),l=o.map((t,e)=>e===i?1:0);const c=o.map(()=>null),d=o.map(()=>null);let u=null;const h=o.map(t=>{const e=document.createElement("button");e.type="button",e.className="ascii-acc-panel",e.setAttribute("aria-label",[t.title??t.alt,t.meta].filter(Boolean).join(", ")||t.src);const n=Xe(t.src);if(n.className="ascii-acc-photo",n.alt="",n.draggable=!1,t.focus&&n.style.setProperty("object-position",`${100*t.focus.x}% ${100*t.focus.y}%`),e.appendChild(n),t.title||t.meta){const n=document.createElement("span");n.className="ascii-acc-caption",n.setAttribute("aria-hidden","true");for(const[e,r]of[["ascii-acc-title",t.title],["ascii-acc-meta",t.meta]]){if(!r)continue;const t=document.createElement("span");t.className=e,t.textContent=r,n.appendChild(t)}e.appendChild(n)}return e});u=Y({host:t,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:.62,glyphScale:.94,hover:"trail",trail:{strength:.5,radius:.25},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{u=null,delete t.dataset.asciiField},onTheme:()=>{c.forEach((t,e)=>{d[e]=t&&u?Je(t,!u.dark()):null}),u?.kick()},paint:({pen:t,now:e,still:r,box:c})=>{const u=a?Math.min(64,e-a):16;a=e;let p=!1;return l=l.map((t,e)=>{const o=e===i?1:0,a=r?o:t+Math.sign(o-t)*Math.min(Math.abs(o-t),u/Math.max(1,n.current.duration));return a!==o&&(p=!0),a}),h.forEach((e,n)=>{const r=d[n],i=R(l[n]);if(!r||i>=1)return;const a=c(e),s=parseFloat(getComputedStyle(e).borderTopLeftRadius)||0;t.save(),t.beginPath(),t.roundRect(a.x,a.y,a.w,a.h,s),t.clip(),t.globalAlpha=1-i,Ye(t,r,a.x,a.y,a.w,a.h,o[n].focus?.x,o[n].focus?.y);const u=.4*Math.sin(Math.PI*L(1.4*i));u>.01&&(t.globalCompositeOperation="lighter",t.globalAlpha=u,t.fillStyle="#fff",t.fillRect(a.x,a.y,a.w,a.h)),t.restore()}),e-s<n.current.duration+60&&(p=!0),p||(a=0),p}});const p=()=>{h.forEach((t,e)=>{t.setAttribute("aria-expanded",String(e===i)),t.tabIndex=e===i?0:-1})},f=(t,e=!1)=>{t=L(Math.round(t),0,h.length-1),e&&h[t]?.focus(),t!==i&&(i=t,s=performance.now(),p(),n.current.onChange?.(t),u?.kick())},m=h.map((t,e)=>{const n=()=>f(e),r=()=>{t.matches(":focus-visible")&&f(e)},o=t=>{const n={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[t.key],r="Home"===t.key?0:"End"===t.key?h.length-1:void 0!==n?(e+n+h.length)%h.length:null;null!==r&&(t.preventDefault(),f(r,!0))};return t.addEventListener("pointermove",n),t.addEventListener("pointerdown",n),t.addEventListener("click",n),t.addEventListener("focus",r),t.addEventListener("keydown",o),()=>{t.removeEventListener("pointermove",n),t.removeEventListener("pointerdown",n),t.removeEventListener("click",n),t.removeEventListener("focus",r),t.removeEventListener("keydown",o)}});en("ascii-kit-accordion",'\n:where([data-ascii-accordion]){display:flex;gap:6px}\n:where(.ascii-acc-panel){position:relative;flex:1 1 0;min-width:0;margin:0;padding:0;border:0;border-radius:12px;overflow:hidden;background:transparent;color:#fff;font:inherit;text-align:left;cursor:pointer;transition:flex-grow var(--ascii-acc-ms, 280ms) cubic-bezier(.16, 1, .3, 1)}\n:where(.ascii-acc-panel[aria-expanded="true"]){flex-grow:4.2;cursor:default}\n:where(.ascii-acc-photo){position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:0;scale:1.04;transition:opacity 160ms cubic-bezier(.16, 1, .3, 1),scale var(--ascii-acc-ms, 280ms) cubic-bezier(.16, 1, .3, 1)}\n:where([data-ascii-accordion]:not([data-ascii-field])) :where(.ascii-acc-photo){opacity:.45}\n:where(.ascii-acc-panel[aria-expanded="true"]) :where(.ascii-acc-photo){opacity:1;scale:1;transition:opacity 240ms cubic-bezier(.16, 1, .3, 1) 40ms,scale var(--ascii-acc-ms, 280ms) cubic-bezier(.16, 1, .3, 1)}\n:where(.ascii-acc-caption){position:absolute;inset:auto 0 0;display:flex;color:#fff;flex-direction:column;gap:2px;padding:28px 12px 11px;background:linear-gradient(to top, rgb(0 0 0 / .62), transparent);white-space:nowrap;opacity:0;translate:0 6px;transition:opacity 120ms,translate 200ms}\n:where(.ascii-acc-panel[aria-expanded="true"]) :where(.ascii-acc-caption){opacity:1;translate:0 0;transition-delay:160ms}\n:where(.ascii-acc-title){font-size:15px;font-weight:500}\n:where(.ascii-acc-meta){font-size:14px;opacity:.8}\n@media (prefers-reduced-motion:reduce){:where(.ascii-acc-panel,.ascii-acc-photo,.ascii-acc-caption){transition:none}}\n'),t.dataset.asciiAccordion="",u&&(t.dataset.asciiField="");const g=t.getAttribute("role"),v=t.getAttribute("aria-label");return g||t.setAttribute("role","group"),v||t.setAttribute("aria-label",n.current.label),r.set(t,"--ascii-acc-ms",`${n.current.duration}ms`),h.forEach(e=>t.appendChild(e)),p(),h.forEach((t,e)=>{const n=t.querySelector("img");n&&Ve(n).then(t=>{c[e]=t,d[e]=u?Je(t,!u.dark()):null,u?.kick()},()=>{})}),J(()=>u,n,e=>{r.set(t,"--ascii-acc-ms",`${e.duration}ms`),v||t.setAttribute("aria-label",e.label),u?.refresh()},{select:f,get open(){return i}},()=>{m.forEach(t=>t()),h.forEach(t=>t.remove()),delete t.dataset.asciiAccordion,delete t.dataset.asciiField,g||t.removeAttribute("role"),v||t.removeAttribute("aria-label"),r.restore()})},exports.artPanel=function(t,e={}){const n={current:{...e}},r=H(),o=t.querySelector("img"),i=n.current.image??o??null;let a=null;a=i?Ut({host:t,look:()=>{const t=n.current;return{mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.3,levels:"auto",fit:"cover",focus:t.focus??{x:.5,y:.4},hover:"trail",trail:{strength:.95,radius:.42},clear:!!t.clear&&{element:t.clear,padding:8,feather:.12,shape:"rect"},...t.look}},ink:t=>n.current.ink??(t?"#d8d6cf":"#1d1d1b"),source:i,label:n.current.label??(i instanceof HTMLImageElement&&i.alt||void 0),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{a=null,r.restore()}}):null,a&&o&&i===o&&r.set(o,"opacity","0");let s=0,l=!1;return Vt(()=>a,n,()=>{},{pulse:(t,e=1)=>{a&&!a.still()&&Yt(a.field,t,e)},shimmer:t=>{const e=a?.field;if(!e||t===l||t&&a.still())return;const n=++s;l=t,t?(async()=>{let t;try{t=await(async()=>{if(i instanceof HTMLImageElement)return i.complete||await i.decode(),i;const t=new Image;return t.crossOrigin="anonymous",t.src=i,await t.decode(),t})()}catch{return}const r=Math.min(1,1400/Math.max(t.naturalWidth,t.naturalHeight,1)),o=Object.assign(document.createElement("canvas"),{width:Math.max(1,Math.round(t.naturalWidth*r)),height:Math.max(1,Math.round(t.naturalHeight*r))}),l=o.getContext("2d"),c=o.width,d=o.height,u=performance.now();for(;n===s&&a?.field===e;){const n=performance.now(),r=-.4*c+1.8*((n-u)/1100%1)*c;l.globalCompositeOperation="source-over",l.drawImage(t,0,0,c,d);const i=l.createLinearGradient(r-.22*c,.3*r,r+.22*c,.3*r+.3*d);i.addColorStop(0,"rgb(0 0 0 / 0)"),i.addColorStop(.5,"rgb(255 255 255 / .42)"),i.addColorStop(1,"rgb(0 0 0 / 0)"),l.globalCompositeOperation="lighter",l.fillStyle=i,l.fillRect(0,0,c,d),await e.setSource(o),await jt(Math.max(0,48-(performance.now()-n)))}})():e.setSource(i)}},()=>{s++,r.restore()})},exports.asciiVideo=function(t,e={}){const n={current:{...e}},r=H(),o=[],i=t.querySelector("video"),a=n.current.src??i??null,s=()=>n.current.reducedMotion??T();let l=null,c=0;l=a?Ut({host:t,layer:"over",look:()=>({mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.25,levels:"auto",fit:"cover",focus:{x:.5,y:.5},hover:"trail",trail:{strength:.9,radius:.35},...n.current.look}),ink:t=>n.current.ink??(t?"#d8d6cf":"#1d1d1b"),source:a,label:n.current.label??"Video, drawn in characters",kit:n,ownPoster:!0,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{l=null,r.restore(),f()},onRelease:()=>{u=!1,h(),a instanceof HTMLVideoElement&&a.pause?.()},onMount:()=>{c++&&(l?.field.ready.then(()=>{u=!0,h()}),m&&a instanceof HTMLVideoElement&&a.play?.()?.catch?.(()=>{}))}}):null,l&&a instanceof HTMLVideoElement&&(t.contains(a)&&r.set(a,"opacity","0"),a.muted=!0,a.loop=!0,a.playsInline=!0);let d=null;n.current.poster&&a&&(d=Object.assign(document.createElement("img"),{alt:"",decoding:"async"}),d.className="ascii-video-poster",d.setAttribute("aria-hidden","true"),d.setAttribute("style",`${oe};transition:opacity 280ms cubic-bezier(.16, 1, .3, 1)`),d.src=n.current.poster,"static"===getComputedStyle(t).position&&r.set(t,"position","relative"),t.appendChild(d),o.push(d));let u=!1;const h=()=>{d&&(d.style.opacity=l&&u&&(m||!s())?"0":"1")};let p=null;function f(){!p&&a&&(a instanceof HTMLVideoElement?p=a:(p=document.createElement("video"),p.src=a,p.setAttribute("style",oe),p.setAttribute("aria-label",n.current.label??"Video"),"static"===getComputedStyle(t).position&&r.set(t,"position","relative"),d?t.insertBefore(p,d):t.appendChild(p),o.push(p)),n.current.poster&&!p.poster&&(p.poster=n.current.poster),p.muted=!0,p.loop=!0,p.playsInline=!0,d&&(d.style.opacity="0"),m&&p.play?.()?.catch?.(()=>{}))}let m=n.current.autoplay??!(l?l.still():s());l?(l.field.ready.then(()=>{u=!0,m||l?.field.pause(),h()}),m&&a instanceof HTMLVideoElement&&a.play?.()?.catch?.(()=>{}),h()):f();const g=Vt(()=>l,n,t=>{d&&t.poster&&d.getAttribute("src")!==t.poster&&(d.src=t.poster),p&&t.poster&&(p.poster=t.poster)},{toggle:()=>(m?g.pause():g.play(),m),get playing(){return m}},()=>{o.forEach(t=>t.remove()),r.restore()}),v=g.play,y=g.pause;return g.play=()=>{l&&!g.supported||(m=!0,l?v():p?.play?.()?.catch?.(()=>{}),h())},g.pause=()=>{l&&!g.supported||(m=!1,l?y():p?.pause?.(),h())},g},exports.aurora=or,exports.background=function(t,e){if(!e||!e.preset||"function"!=typeof e.preset.mount)throw new TypeError("background() needs a preset, such as `aurora` imported from asciify-engine/kit.");const n={current:{...e}};let r=null,o=!1,i=!1;const a=new Set,s=()=>{const t=n.current,e=t.preset;return{speed:Sn(t.speed,e.speed,0,5),cellSize:Sn(t.cellSize,e.cellSize,3,96),charset:An(t.charset),cursor:t.cursor??e.cursor,clear:t.clear??!1,dither:Sn(t.dither,0,0,1),accent:t.accent,text:t.text?.trim()||"ASCIIFY",look:t.look}},l=t=>{const e=n.current,r=e.palette;return("string"==typeof r?r:r?.[t?"dark":"light"])??e.color??e.ink},c=()=>String(Sn(n.current.opacity,n.current.preset.opacity??1,0,1)),d=()=>!!(n.current.reducedMotion??T()),u=e=>{let i=null;if(i=n.current.preset.mount({host:t,kit:n,settings:s,ink:l,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{r===i&&(r=null)}}),!i)return null;const a=i.canvas.style;return e&&(a.opacity="0",a.transition="opacity 320ms cubic-bezier(.16, 1, .3, 1)",i.canvas.offsetWidth),a.opacity=c(),o&&i.pause(),i},h=t=>{if(i||!t||"function"!=typeof t.mount||t===n.current.preset)return;n.current={...n.current,preset:t};const e=r;r=u(!!e&&!d()),e&&(t=>{if(d())return void t.destroy();t.canvas.style.transition="opacity 320ms cubic-bezier(.16, 1, .3, 1)",t.canvas.style.opacity="0";const e={run:t,timer:setTimeout(()=>{a.delete(e),t.destroy()},340)};a.add(e)})(e)};return r=u(!1),{get supported(){return!!r&&!i},get field(){return i?null:r?.field??null},get preset(){return n.current.preset},update(t){if(i||!t)return;const{preset:e,...o}=t;n.current=U(n.current,o),e&&e!==n.current.preset?h(e):r&&(r.canvas.style.opacity=c(),r.refresh())},play(){!i&&o&&(o=!1,r?.play())},pause(){i||(o=!0,r?.pause())},setPreset:h,destroy(){if(!i){i=!0;for(const t of a)clearTimeout(t.timer),t.run.destroy();a.clear(),r?.destroy(),r=null,S(n)}}}},exports.backgroundCharset=An,exports.beam=function(t,e={}){const n={current:{...K,...e}};let r="idle",o=0,i=rt(n.current.palette),a=!1;const s=()=>"mono"===n.current.palette,l=()=>({..."glyphs"===n.current.grain?{mark:"glyph",charset:" ·.:-+*",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.6,glyphScale:1}:{mark:"dot",cellSize:3.5,cellAspect:1,dotScale:.82},color:s()?"ink":"source",saturation:1.25,shade:.55,contrast:2.4,brightness:.58,...n.current.look}),c=t=>{const e=!t.dark();t.canvas.style.opacity=e?"0.72":"",t.canvas.style.filter=e&&!s()?"brightness(1.45) saturate(.9)":""};let d=null,u=null,h=new Uint8Array(0),p="",f=0,m=null,g=0,v=.62,y=0,b=0,M=0,x=0,w=0,k=0;const S={rotate:0,pulse:0,progress:0};S[n.current.mode]=1;let A=null;A=Y({host:t,look:l,ink:t=>n.current.ink??(t?"#b3b1aa":"#8a8882"),kit:n,reducedMotion:()=>n.current.reducedMotion,onTheme:()=>A&&c(A),onFail:()=>{A=null},resolution:(t,e)=>[Math.max(1,Math.round(t)),Math.max(1,Math.round(e))],paint:e=>{const{pen:s,w:c,h:C,now:E,still:$,dark:R}=e,P=n.current,T=getComputedStyle(t),F=Math.min(t.clientWidth||c,t.clientHeight||C),W=Math.max(2,Math.min(P.depth,Math.min(parseFloat(T.paddingTop)||P.depth,parseFloat(T.paddingLeft)||P.depth)-2)),B=[T.borderTopLeftRadius,T.borderTopRightRadius,T.borderBottomRightRadius,T.borderBottomLeftRadius].map(t=>((t,e)=>t.endsWith("%")?parseFloat(t)/100*e:parseFloat(t)||0)(t??"",F)),O=l(),N="dot"!==O.mark,G=O.cellSize??(N?5:3.5),q=O.cellAspect??(N?.6:1),H=`${c}x${C}:${P.grain}:${W}:${B.join(",")}:${G}:${q}`;if(H!==p){p=H,A.canvas.style.clipPath=`inset(0 round ${B.map(t=>`${t}px`).join(" ")})`;const t=Math.min(globalThis.devicePixelRatio||1,O.maxPixelRatio??2),e=Math.max(2,Math.round(G*t)),n=Math.max(2,Math.round(e*q))/t,r=e/t;d=function(t,e,n,r,o,i,a){const s=Math.ceil(t/n),l=t/2,c=e/2,d=Math.min(l,c),[u,h,p,f]=[0,1,2,3].map(t=>Math.max(0,Math.min(i[t]??i[0]??0,d))),m=new Int32Array(s*Math.ceil(e/r)).fill(-1),g=[],v=[],y=[];for(let t=0;t<m.length;t++){const e=(t%s+.5)*n-l,i=(Math.floor(t/s)+.5)*r-c,d=e<0?i<0?u:f:i<0?h:p,b=Math.abs(e)-l+d,M=Math.abs(i)-c+d,x=-(Math.hypot(Math.max(b,0),Math.max(M,0))+Math.min(Math.max(b,M),0)-d),w=x>0?Math.min(Math.max(0,1-x/Math.max(1,o))**1.7,x/Math.max(.1,a)):0;if(w<.004)continue;m[t]=g.length,g.push(w);const k=Math.atan2(i/Math.max(1,c),e/Math.max(1,l))/(2*Math.PI)+.25,S=k-Math.floor(k);v.push(S),y.push(.78*z(Math.floor(46*S),5)+.22*z(t,9))}const b=Math.max(1,Math.round(t)),M=Math.max(1,Math.round(e)),x=[],w=[];for(let t=0;t<M;t++)for(let e=0;e<b;e++){const o=m[Math.min(s-1,Math.floor((e+.5)/n))+s*Math.floor((t+.5)/r)];o>=0&&(x.push(t*b+e),w.push(o))}return{W:b,H:M,weight:Float32Array.from(g),turn:Float32Array.from(v),crack:Float32Array.from(y),pixel:Int32Array.from(x),owner:Int32Array.from(w)}}(c,C,n,r,W,B,N?Math.min(n,r)/2:(O.dotScale??.82)*n/2),u=s.createImageData(d.W,d.H),h=new Uint8Array(3*d.weight.length)}const D=d,j=u.data,U=D.crack,V=(t,e,n,r,o)=>{h.fill(0);for(let a=0;a<D.weight.length;a++){const s=D.turn[a],l=L(D.weight[a]*t(s,a))*(R?1.12:.8);if(l<.03)continue;const c=4*(255&Math.floor(((s-e)%1+1)%1*256));let d=i[c],u=i[c+1],p=i[c+2],f=i[c+3];const m=o&&R?o(s):0;(r>0||n>0||m>0)&&(r>0&&(d+=(nt[0]-d)*r,u+=(nt[1]-u)*r,p+=(nt[2]-p)*r),n>0&&(d+=(et[0]-d)*n,u+=(et[1]-u)*n,p+=(et[2]-p)*n),m>0&&(d+=(1-d)*m,u+=(1-u)*m,p+=(1-p)*m),f=.2126*d+.7152*u+.0722*p);const g=255*Math.min(1,(l+.12)/2.4/Math.max(f,.01));h[3*a]=d*g,h[3*a+1]=u*g,h[3*a+2]=p*g}j.fill(0);for(let t=0;t<D.pixel.length;t++){const e=4*D.pixel[t],n=3*D.owner[t];j[e]=h[n],j[e+1]=h[n+1],j[e+2]=h[n+2],j[e+3]=255}s.putImageData(u,0,0)};if($){const t="progress"===P.mode?t=>"running"===r||"error"===r?at(t,o):.14:t=>("running"===r?.75:.55)*(.7+.3*Math.cos(2*Math.PI*(t-.12)));return"success"===r?V(()=>.62,0,0,.9):"error"===r?V((e,n)=>.5*t(e)*st(U[n],1),0,.9,0):V(t,0,0,0),!1}const X=f?Math.min(48,E-f):16;f=E,r!==m&&("running"===r&&"running"!==m&&(w=0),g=E,m=r);let Y=E-g;"success"===r&&Y>2700&&(r=m="idle",o=0,g=E,Y=0);const J="running"===r,_="error"===r,K="success"===r,Z=P.hover&&a;for(const t of Q)S[t]+=((t===P.mode?1:0)-S[t])*(1-Math.exp(-X/260));if(_)b=0;else{const t=(J?1500-500*o:"pulse"===P.mode?9e3:2600)/Math.max(.05,P.speed);b+=(1/t*(Z?1.35:1)-b)*(1-Math.exp(-X/320)),v+=b*X,k+=X,y+=X/("pulse"===P.mode?14e3:26e3)*(1-S.progress),(J||K)&&(w+=((K?1:o)-w)*(1-Math.exp(-X/110)))}M+=((Z?1:0)-M)*(1-Math.exp(-X/220)),x=_?.9*I(0,60,Y):x*Math.exp(-X/180);const tt=1+.22*M,rt=.32+.68*(.5-.5*Math.cos(2*Math.PI*k/2400)),ot=.05+.1*(.5-.5*Math.cos(2*Math.PI*k/5200)),lt=J||K||_,ct=t=>tt*(S.rotate*it(t-v)+S.pulse*(J||_?it(t-v):rt*(.78+.22*Math.cos(2*Math.PI*(t-v))))+S.progress*(lt?at(t,w):ot));if(K){const t=I(0,260,Y),e=L((Y-240)/620),n=1-I(860,1060,Y),r=I(780,1e3,Y),o=I(1350,2450,Y),i=(R?.86:.55)*t*(1-r)+.62*r*(1-o),a=1-t*(1-I(1900,2700,Y)*(1-S.progress)),s=t=>{if(Y<240)return 0;const r=e-t;return n*(r>=0?r<.2?(1-r/.2)**2:0:r>-.02?(1+r/.02)**2:0)};return V(t=>Math.max(ct(t)*a,i*(.9+.1*Math.cos(2*Math.PI*(t-.1))),1.3*s(t),S.progress*ot*o),y,0,.9*r*(1-o),t=>L(.8*s(t))),!0}if(_){const t=Y<90?1.2:Y<170?.1:Y<260?1.2:Y<340?.1:1,e=I(380,1150,Y),n=1-.5*I(700,1500,Y),r=Math.floor(Y/50);return V((o,i)=>{const a=st(U[i],e);return a<=0?0:ct(o)*t*a*n*(1-1.4*e*(1-e)*z(i,r))},y,x,0),Y<1600||Math.abs(M-(Z?1:0))>.01}return V(ct,y,x,0),!0}});const C=()=>{a||(a=!0,A?.kick())},E=()=>{a=!1,A?.kick()},$=t=>{a=t.target?.matches?.(":focus-visible")??!1,A?.kick()};A&&(c(A),t.addEventListener("pointerenter",C),t.addEventListener("pointermove",C),t.addEventListener("pointerleave",E),t.addEventListener("focusin",$),t.addEventListener("focusout",E));const R=t=>{r=t,A?.kick()};return J(()=>A,n,t=>{i=rt(t.palette),A?.refresh(),A&&c(A)},{progress(t){o=L(Number.isFinite(t)?t:0),R("running")},success(){R("success")},error(){R("error")},reset(){o=0,R("idle")}},()=>{t.removeEventListener("pointerenter",C),t.removeEventListener("pointermove",C),t.removeEventListener("pointerleave",E),t.removeEventListener("focusin",$),t.removeEventListener("focusout",E)})},exports.beamPalette=rt,exports.blockChart=function(t,e={}){const n={current:{...Te,...e}};let r=n.current.values,o=null,i=!1===n.current.intro?-1e9:performance.now(),a=[],s=0,l=!1,c=null;const d=()=>n.current.values??[];c=Y({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:7,cellAspect:.6,glyphScale:.95,shade:.35,...n.current.look}),ink:t=>n.current.ink??(t?"#d8d6cf":"#1d1d1b"),kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{c=null},paint:({pen:t,w:e,h:r,now:l,still:c})=>{t.setTransform(2,0,0,2,0,0);const u=d(),h=u.length;if(!h)return!1;const p=s?Math.min(64,l-s):16;s=l;const f=e/h,m=Math.max(3,f*(h<=7?.56:.64)),g=n.current.max??1.04*Math.max(...u,0),v=n.current.stagger??(h<=7?45:9);let y=!1;for(let e=0;e<h;e++){const s=c?1:L((l-i-e*v)/n.current.duration);s<1&&(y=!0);const d=null===o?e===h-1?1:.55:e===o?1:.3,b=a[e]??d;a[e]=c?d:b+(d-b)*(1-Math.exp(-p/90)),Math.abs(a[e]-d)>.01&&(y=!0);const M=(g>0?Math.max(0,u[e])/g:0)*(r-2)*P(s),x=r-M,w=f*(e+.5)-m/2;if(M<=0)continue;const k=.16+.84*a[e],S=t.createLinearGradient(0,x,0,r);S.addColorStop(0,Fe(k)),S.addColorStop(1,Fe(.5*k)),t.fillStyle=S,t.fillRect(w,x,m,M)}return y}});const u=H(),h=c?null:document.createElement("div"),p=()=>{if(!h)return;const t=d(),e=t.length,r=n.current.max??1.04*Math.max(...t,0);h.replaceChildren(...t.map((t,n)=>{const i=document.createElement("div"),a=null===o?n===e-1?1:.55:n===o?1:.3;return i.setAttribute("style",`flex:1 1 0;height:${r>0?(100*L(t/r)).toFixed(2):0}%;margin:0 ${e<=7?22:18}%;background:currentColor;opacity:${.9*(.16+.84*a)}`),i}))};h&&("static"===getComputedStyle(t).position&&u.set(t,"position","relative"),h.setAttribute("aria-hidden","true"),h.setAttribute("style","position:absolute;inset:0;display:flex;align-items:flex-end;pointer-events:none"),t.appendChild(h));const f=document.createElement("table");f.setAttribute("style","position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0");const m=()=>{const t=n.current.format??(t=>t.toLocaleString()),e=n.current.labels??[],r=document.createElement("tbody");d().forEach((n,o)=>{const i=document.createElement("tr"),a=document.createElement("th"),s=document.createElement("td");a.setAttribute("scope","row"),a.setAttribute("style","font-weight:inherit"),a.textContent=e[o]??String(o+1),s.textContent=t(n),i.appendChild(a),i.appendChild(s),r.appendChild(i)}),f.replaceChildren(r)};m(),t.appendChild(f);const g=!t.hasAttribute("tabindex"),v=!t.hasAttribute("role");g&&(t.tabIndex=0),v&&t.setAttribute("role","group");const y=t=>{const e=d().length,r=null!==t&&e?Math.min(e-1,Math.max(0,Math.round(t))):null;r!==o&&(o=r,c?.kick(),p(),n.current.onHover?.(o,null===o?null:d()[o],null===o?null:n.current.labels?.[o]??null))},b=()=>{r=d(),i=performance.now(),a=d().map((t,e,n)=>e===n.length-1?1:.55),c?.kick(),p()};p();const M=e=>{const n=t.getBoundingClientRect();if(!n.width)return;const r=(e.clientX-n.left)/n.width,o=e.clientY-n.top;r<0||r>1||o<0||o>n.height?y(null):y(((t,e)=>e?Math.min(e-1,Math.max(0,Math.floor(t*e))):-1)(r,d().length))},x=()=>y(null),w=t=>{const e=d().length,n="ArrowRight"===t.key?null===o?0:Math.min(e-1,o+1):"ArrowLeft"===t.key?null===o?e-1:Math.max(0,o-1):"Home"===t.key?0:"End"===t.key?e-1:"Escape"===t.key?null:void 0;void 0!==n&&e&&(t.preventDefault(),y(n))};t.addEventListener("pointermove",M),t.addEventListener("pointerdown",M),t.addEventListener("pointerleave",x),t.addEventListener("keydown",w),t.addEventListener("blur",x);const k="function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{t?.isIntersecting&&!l&&(l=!0,!1!==n.current.intro&&b())},{threshold:.4}):null;return k?.observe(t),J(()=>c,n,t=>{m(),t.values!==r&&b(),c?.refresh()},{set(t,e){n.current={...n.current,values:[...t],...e?{labels:[...e]}:{}},null!==o&&o>=t.length&&y(null),m(),b()},highlight:y,get active(){return o},get values(){return d()}},()=>{k?.disconnect(),f.remove(),h?.remove(),u.restore(),t.removeEventListener("pointermove",M),t.removeEventListener("pointerdown",M),t.removeEventListener("pointerleave",x),t.removeEventListener("keydown",w),t.removeEventListener("blur",x),g&&t.removeAttribute("tabindex"),v&&t.removeAttribute("role")})},exports.buttonLoading=function(e,n={}){const r={current:{...ht,...n}},o=H(),i=r.current.label??e,a=r.current.text??(i.textContent??"").trim(),s=[...i.childNodes],l=void 0!==r.current.icon?r.current.icon:a?null:e.querySelector("svg"),c=e.getAttribute("aria-label");let d="idle",u=a,h=-1e9,p=0,f=null,m={cw:9,ch:15,cellSize:15};const g=D(a),v=document.createElement("span"),y=document.createElement("span");y.setAttribute("aria-hidden","true"),y.dataset.asciiCheck="",y.innerHTML='<svg viewBox="0 0 24 24" width="1.1em" height="1.1em" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>';const b=()=>{const t=Math.min(globalThis.devicePixelRatio||1,2);m=function(t,e){const n=Math.max(3,3*Math.round(t*e/3));return{cw:n/3*2/e,ch:n/e,cellSize:n/e}}(parseFloat(getComputedStyle(i).fontSize)||15,t)},M=()=>{if(l)return v.replaceChildren(),f&&v.appendChild(f.canvas),v.style.width=`${m.cw}px`,void(v.style.height=`${m.ch}px`);const t=[...u];for(const t of[...v.children])"SPAN"===t.tagName&&t.remove();const n=f&&f.canvas.parentElement===v?f.canvas:null;for(const[e,r]of t.entries()){const t=document.createElement("span");t.textContent=r,t.setAttribute("style",`position:absolute;top:0;left:${e*m.cw}px;width:${m.cw}px;height:${m.ch}px;line-height:${m.ch}px;text-align:center`),n?v.insertBefore(t,n):v.appendChild(t)}f&&!n&&v.appendChild(f.canvas),v.style.width=t.length*m.cw+"px",v.style.height=`${m.ch}px`,g.textContent=u,p=Math.max(p,e.offsetWidth),p&&o.set(e,"min-width",`${p}px`)},x="undefined"!=typeof document&&t.isGlyphFieldSupported();if(x){b(),v.setAttribute("aria-hidden","true");const t="position:absolute;left:50%;top:50%;translate:-50% -50%;pointer-events:none";l?("static"===getComputedStyle(e).position&&o.set(e,"position","relative"),v.setAttribute("style",t),y.setAttribute("style",`${t};display:grid;place-items:center;opacity:0;scale:.5`),e.appendChild(v),e.appendChild(y)):(v.setAttribute("style","display:inline-block;vertical-align:middle;position:relative;white-space:pre"),y.setAttribute("style","display:inline-grid;place-items:center;vertical-align:middle;overflow:hidden;width:0;opacity:0;scale:.5"),i.replaceChildren(g,y,v)),M()}f=x?Y({host:v,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:m.cellSize,cellAspect:2/3,glyphScale:.94,...r.current.look}),ink:()=>r.current.ink??getComputedStyle(i).color,kit:r,reducedMotion:()=>r.current.reducedMotion,resolution:(t,e)=>[Math.max(2,2*Math.round(t/m.cw)),Math.max(3,3*Math.round(e/m.ch))],onFail:()=>{f=null,v.remove(),y.remove(),o.restore(),l||(i.replaceChildren(...s),i.textContent=u)},paint:({pen:t,now:e,still:n})=>{const r=e-h;if(l){if("loading"!==d||n)return!1;const e=1+Math.round(8*(.5-.5*Math.cos(2*Math.PI*r/720))),o=Math.round(e/9*255);return t.fillStyle=`rgb(${o} ${o} ${o})`,t.fillRect(0,0,2,3),!0}const o=[...v.children].filter(t=>"SPAN"===t.tagName);let i="loading"===d&&!n;for(let e=0;e<o.length;e++){const a=n?0:pt(e,r,o.length,"loading"===d,n,u.length);r<24*o.length+170&&(i=!0);const s=" "===u[e];if(o[e].style.visibility=a&&!s?"hidden":"",!a||s)continue;const l=Math.round(a/9*255);t.fillStyle=`rgb(${l} ${l} ${l})`,t.fillRect(2*e,0,2,3)}return i}}):null,x&&!f&&(v.remove(),y.remove(),l||i.replaceChildren(...s),o.restore());const w=(t,n)=>{d=t,u=l?"":n,e.dataset.state=t,"loading"===t?e.setAttribute("aria-busy","true"):e.removeAttribute("aria-busy"),l&&null!==c&&e.setAttribute("aria-label","idle"===t?c:n),r.current.announce&&(r.current.announce.textContent="idle"===t?"":n),f?(h=performance.now(),((t,e)=>{const n=e?"none":`opacity 160ms ${ft} ${t?120:0}ms, scale 240ms ${ft} ${t?120:0}ms`;if(y.style.transition=n,y.style.opacity=t?"1":"0",y.style.scale=t?"1":".5",l||(y.style.width=t?"1.1em":"0",y.style.marginRight=t?".45em":"0"),l&&"style"in l){const t="idle"!==d&&"error"!==d;o.set(l,"transition",n.replace(/ 120ms/g,"")),o.set(l,"opacity",t?e&&"loading"===d?".4":"0":"1"),o.set(l,"scale",t&&!e?".6":"1")}})(!("success"!==t||!l&&!r.current.check),f.still()),M(),f.kick(),"error"===t&&r.current.shake&&!f.still()&&"function"==typeof e.animate&&e.animate([{translate:"0"},{translate:"-4px 0"},{translate:"4px 0"},{translate:"-2px 0"},{translate:"0"}],{duration:280,easing:ft})):l||(i.textContent=n)};return J(()=>f,r,()=>{f&&(b(),M(),f.refresh())},{start(t=(l?c??"":`${a}…`)){w("loading",t)},succeed(t="Done"){w("success",t)},fail(t="Retry"){w("error",t)},reset(t=(l?c??"":a)){w("idle",t)},get state(){return d}},()=>{f&&(v.remove(),y.remove(),l||i.replaceChildren(...s)),l&&null!==c&&e.setAttribute("aria-label",c),delete e.dataset.state,e.removeAttribute("aria-busy"),o.restore()})},exports.caustics=sr,exports.circuit=pr,exports.codeInput=function(t,e={}){const n={current:{...De,...e}},r=H(),o=H(),i=[],a=()=>!!(n.current.reducedMotion??T()),s=()=>Math.max(1,Math.round(n.current.length));let l="",c="idle",d=!1,u=[],h="",p=-1e9,f="",m=-1e9,g=[],v=[],y=0,b=null;const M=new Map;"static"===getComputedStyle(t).position&&r.set(t,"position","relative");let x=t.querySelector("input");x||(x=document.createElement("input"),x.setAttribute("style","position:absolute;inset:0;width:100%;height:100%;margin:0;padding:0;border:0;opacity:0;font-size:16px;cursor:text"),t.appendChild(x),i.push(x));const w=x;w.setAttribute("inputmode","digits"===n.current.accept?"numeric":"text"),w.setAttribute("autocomplete","one-time-code"),w.setAttribute("maxlength",String(s())),"digits"===n.current.accept&&w.setAttribute("pattern","[0-9]*"),w.hasAttribute("aria-label")||w.hasAttribute("aria-labelledby")||w.setAttribute("aria-label",`Verification code, ${s()} ${"digits"===n.current.accept?"digits":"characters"}`);const k=()=>{const e=[...t.querySelectorAll(n.current.cells)];for(;e.length<s();){const n=document.createElement("span");n.dataset.cell="",n.setAttribute("aria-hidden","true"),w.parentElement===t?t.insertBefore(n,w):t.appendChild(n),i.push(n),e.push(n)}return e.slice(0,s())},S=t=>{let e=t.querySelector("[data-digit]");return e||(e=document.createElement("span"),e.dataset.digit="",t.appendChild(e),i.push(e)),e},A=(t,e,n,r,o,i,a,s=1,l=0,c=0,d=1)=>{const u=((t,e,n,r)=>{const o=`${t}|${Math.round(e)}x${Math.round(n)}|${r}`;let i=M.get(o);if(!i){i=document.createElement("canvas"),i.width=Math.max(2,Math.round(2*e)),i.height=Math.max(2,Math.round(2*n));const a=i.getContext("2d");a&&(a.scale(2,2),a.fillStyle="#fff",a.shadowColor="#fff",a.shadowBlur=3,a.font=`600 ${Math.round(.6*n)}px ${r}`,a.textAlign="center",a.textBaseline="middle",a.fillText(t,e/2,n/2+1)),M.set(o,i)}return i})(e,n.w,n.h,a);t.globalAlpha=s;const h=n.w*d,p=n.h*d,f=n.x+(n.w-h)/2+l,m=n.y+(n.h-p)/2+c;for(let e=0;e<n.h;e+=4)for(let a=0;a<n.w;a+=3){if(z(a+31*i,e)>1.3*r-.12)continue;const n=3*(1-r);t.drawImage(u,2*a,2*e,6,8,f+a*d+(z(a,e+o)-.5)*n,m+e*d+(z(e,a+o)-.5)*n,3*d,4*d)}t.globalAlpha=1},C=(t,e)=>{t.toggleAttribute("data-shown",e),o.set(S(t),"opacity",e?"1":"0")};b=Y({host:t,outset:16,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.92,...n.current.look}),ink:t=>n.current.ink??(t?"#d8d6cf":"#1d1d1b"),kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{b=null,o.restore(),k().forEach(t=>C(t,!0))},paint:({pen:e,w:n,h:r,now:o,still:i,box:a})=>{e.setTransform(2,0,0,2,0,0);const s=k(),v=i?0:Math.floor(o/110),y=getComputedStyle(t).fontFamily||"sans-serif";if("success"===c){const t=i?1:(o-m)/700,a=n/2,l=r/2;if(s.forEach(t=>C(t,!1)),t<.55){const n=(t/.55)**2;g.forEach((t,r)=>f[r]&&A(e,f[r],t,1,v,r,y,1-n**3,(a-t.x-t.w/2)*n,(l-t.y-t.h/2)*n,1-.65*n))}const c=L((t-.45)/.55);return c>0&&c<1&&(e.strokeStyle=Ue(.55*(1-c)),e.lineWidth=3,e.beginPath(),e.arc(a,l,18+44*(t=>1-(1-L(t))**3)(c),0,2*Math.PI),e.stroke()),((t,e,n,r)=>{if(r<=0)return;const o=[[e-20,n+1],[e-7,n+14],[e+21,n-14]],i=Math.hypot(13,13),a=Math.hypot(28,28);let s=r*(i+a);t.strokeStyle="#fff",t.lineWidth=8,t.lineCap="round",t.lineJoin="round",t.shadowColor="#fff",t.shadowBlur=4,t.beginPath(),t.moveTo(o[0][0],o[0][1]);const l=Math.min(1,s/i);if(t.lineTo(o[0][0]+(o[1][0]-o[0][0])*l,o[0][1]+(o[1][1]-o[0][1])*l),s-=i,s>0){const e=Math.min(1,s/a);t.lineTo(o[1][0]+(o[2][0]-o[1][0])*e,o[1][1]+(o[2][1]-o[1][1])*e)}t.stroke(),t.shadowBlur=0})(e,a,l+1,P(L((t-.4)/.45))),t<1}let b=!1;const M=o-p;return s.forEach((t,n)=>{const r=a(t),s=l[n];if(M<je&&h[n])return C(t,!1),A(e,h[n],r,1-M/je,v,n,y),void(b=!0);if(s){const a=i?1:(o-u[n])/300;if(C(t,a>=.7),a>=1)return;return b=!0,void(a>0&&A(e,s,r,a,v,n,y,a>.7?1-(a-.7)/.3:1))}if(C(t,!1),d&&n===l.length&&M>=je){const t=i?.6:.5-.5*Math.cos(o/1600*Math.PI*2);e.fillStyle=Ue(.2+.26*t),e.beginPath(),e.roundRect(r.x+r.w/2-1.5,r.y+r.h/2-11,3,22,1.5),e.fill(),b=!0}}),b}});const E=(t,e)=>{v.push(setTimeout(e,t))},$=()=>{v.forEach(clearTimeout),v=[]},R=()=>{t.dataset.state=c,"error"===c?w.setAttribute("aria-invalid","true"):w.removeAttribute("aria-invalid");const e=d&&"success"!==c?Math.min(l.length,s()-1):-1;k().forEach((t,n)=>{S(t).textContent=l[n]??"",t.toggleAttribute("data-active",n===e),b||C(t,!0),"success"===c&&b?(r.set(t,"transition","opacity 200ms, scale 240ms cubic-bezier(.16, 1, .3, 1)"),r.set(t,"opacity","0"),r.set(t,"scale",".86")):(t.style.removeProperty("opacity"),t.style.removeProperty("scale"))}),w.value!==l&&(w.value=l),b?.kick()},I=t=>{$(),"idle"!==c&&(c="idle",m=-1e9),h="",p=-1e9;const e=((t,e,n="digits")=>("digits"===n?t.replace(/\D/g,""):t.replace(/[^a-z\d]/gi,"").toUpperCase()).slice(0,e))(t,s(),n.current.accept),r=performance.now();let o=0;for(let t=0;t<e.length;t++)e[t]!==l[t]&&(u[t]=a()?-1e9:r+y*o++);l=e,R(),e.length===s()&&E(a()||!b?0:300+y*Math.max(0,o-1)+80,()=>n.current.onComplete?.(e)),y=0},F=()=>I(w.value),W=()=>{y=55},B=()=>{d=!0,R()},O=()=>{d=!1,R()};return w.addEventListener("input",F),w.addEventListener("paste",W),w.addEventListener("focus",B),w.addEventListener("blur",O),w.value?I(w.value):R(),J(()=>b,n,()=>{w.setAttribute("maxlength",String(s())),R(),b?.refresh()},{verify:e=>{$();const n=performance.now();if(e)return f=l,g=b?k().map(t=>b.box(t)):[],m=n,c="success",void R();h=l,p=a()||!b?n-je:n,c="error",R(),a()||"function"!=typeof t.animate||t.animate([{translate:"0"},{translate:"-9px"},{translate:"7px"},{translate:"-4px"},{translate:"2px"},{translate:"0"}],{duration:380,easing:"ease-out"});const r=l;E(a()||!b?0:je,()=>{h===r&&(h="",l="",R())})},clear:()=>{$(),h="",p=-1e9,m=-1e9,l="",c="idle",R()},fill(t){y=55,I(t)},get value(){return l},get state(){return c}},()=>{$(),w.removeEventListener("input",F),w.removeEventListener("paste",W),w.removeEventListener("focus",B),w.removeEventListener("blur",O),o.restore(),r.restore();for(const t of i)t.remove();for(const e of t.querySelectorAll(n.current.cells))e.removeAttribute("data-shown"),e.removeAttribute("data-active");delete t.dataset.state})},exports.commandPalette=function(t,e={}){const n={current:{...ye,...e}},r=H(),o=()=>[...t.querySelectorAll(n.current.rows)],i=()=>t.querySelector(n.current.input);let a=n.current.open??!t.hasAttribute("hidden"),s=0,l=null,c=!1,d=0,u=0,h=null,p=!1,f=0,m=null;const g=()=>!!(n.current.reducedMotion??T());m=Y({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,...n.current.look}),ink:t=>n.current.ink??(t?"#d8d6cf":"#1d1d1b"),kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{m=null},paint:({pen:t,now:e,still:n,box:r})=>{t.setTransform(2,0,0,2,0,0);const i=u?Math.min(48,e-u):16;if(u=e,h){const r=h,o=(e-r.start)/(r.closing?be:260);if(!(o>=1||n)){const e=r.closing?1-1.02*P(o):1.04*P(o);return function(t,e,n,r,o,i,a=1,s=.32,l=2){for(let c=0;c<n.length;c++){const d=n[c],u=(o-r[c]*(1-s))/s;if(u<=0)continue;const h=u>=1?0:1-u;let p=d.x,f=d.y;if(h>0){const[t,e]=i(d,h);p+=t,f+=e}t.globalAlpha=a*(1-h*h),t.drawImage(e,d.x*l,d.y*l,4*l,6*l,p,f,4,6)}t.globalAlpha=1}(t,r.snap,r.blocks,r.order,e,(t,e)=>[(r.ox-t.x)*e*.9,(r.oy-t.y)*e*.9],r.closing?1:1-L((o-.72)/.28),.4),!0}h=null}if(!a||p)return!1;const f=o()[s];if(!f)return!1;const m=r(f),g=l?.y??m.y;if(!l||n)l={...m};else{const t=1-Math.exp(-i/45);l={x:m.x,w:m.w,y:l.y+(m.y-l.y)*t,h:l.h+(m.h-l.h)*t}}d+=((c?1:0)-d)*(n?1:1-Math.exp(-i/70));const v=l.x+4,y=Math.max(4,l.h-14),b=l.y+7;return Math.abs(g-l.y)>.5&&(t.fillStyle=Me(.32),t.fillRect(v,Math.min(g,l.y)+7,6,Math.abs(g-l.y)+y)),t.fillStyle=Me(.7+.3*d),t.beginPath(),t.roundRect(v,b,6,y,3),t.fill(),Math.abs(m.y-l.y)>.3||Math.abs((c?1:0)-d)>.01}}),m&&(t.dataset.gpu="");const v=()=>{const t=o();if(s=t.length?Math.min(Math.max(0,s),t.length-1):0,!n.current.manage)return;t.forEach((t,e)=>t.setAttribute("aria-selected",String(e===s)));const e=i(),r=t[s]?.id;e&&r&&e.setAttribute("aria-activedescendant",r)},y=()=>`inset(0 round ${getComputedStyle(t).borderTopLeftRadius||"0px"})`,b=()=>{const e=n.current.trigger,r=t.offsetWidth,o=t.offsetHeight;if(!e)return`inset(0 ${Math.max(0,r/2-40)}px ${Math.max(0,o-36)}px round 18px)`;const i=j(t,e);return`inset(${i.y}px ${r-i.x-i.w}px ${o-i.y-i.h}px ${i.x}px round ${i.h/2}px)`},M=e=>{const r=m;if(!r)return;const o=t.offsetWidth,i=t.offsetHeight,a=ve(t,r.box,o,i,2),s=function(t,e=2){const n=t.getContext("2d",{willReadFrequently:!0});if(!n)return[];const r=t.width,o=t.height,i=n.getImageData(0,0,r,o).data,a=[];for(let t=0;t<o/e;t+=6)for(let n=0;n<r/e;n+=4){let s=!1;for(let a=0;a<6*e&&!s;a+=3)for(let l=0;l<4*e&&!s;l+=2){const c=Math.round(n*e+l),d=Math.round(t*e+a);c<r&&d<o&&i[4*(d*r+c)]>10&&(s=!0)}s&&a.push({x:n,y:t,seed:z(n,t)})}return a}(a,2),l=n.current.trigger,c=l?r.box(l):{x:o/2,y:0,w:0,h:0},d=c.x+c.w/2,u=c.y+c.h/2,p=Math.hypot(o,i)||1;h={snap:a,blocks:s,order:Float32Array.from(s,t=>Math.hypot(t.x-d,t.y-u)/p*.7+.3*t.seed),ox:d,oy:u,start:performance.now(),closing:e},r.kick()},x=e=>{if(e)for(const e of[...t.children])"CANVAS"===e.tagName&&void 0!==e.dataset.asciiKit||r.set(e,"opacity","0");else r.restore()},w=(e,n,r="none")=>"function"!=typeof t.animate?null:t.animate(e.map(t=>({clipPath:t})),{duration:n,easing:"cubic-bezier(.16, 1, .3, 1)",fill:r}),k=()=>{f&&clearTimeout(f),f=0},S=(e=!0)=>{!a||p?(k(),a=!0,p=!1,l=null,s=0,t.removeAttribute("hidden"),t.dataset.open="",n.current.trigger?.setAttribute("aria-expanded","true"),v(),e&&i()?.focus({preventScroll:!0}),n.current.onOpenChange?.(!0),g()?m?.kick():(t.dataset.state="opening",w([b(),y()],260),m&&(p=!0,x(!0),M(!1)),f=setTimeout(()=>{f=0,delete t.dataset.state,p=!1,x(!1),m?.kick()},143))):e&&i()?.focus({preventScroll:!0})},A=()=>{if(!a)return;k();const e=t.contains(document.activeElement),r=()=>{f=0,p=!1,a=!1,h=null,delete t.dataset.state,delete t.dataset.open,x(!1),t.setAttribute("hidden",""),n.current.trigger?.setAttribute("aria-expanded","false"),e&&n.current.trigger?.focus({preventScroll:!0}),m?.kick(),n.current.onOpenChange?.(!1)};if(g())return void r();p=!0,t.dataset.state="closing",m&&(M(!0),x(!0));const o=w([y(),b()],be,"forwards"),i="function"==typeof t.animate?t.animate([{opacity:1},{opacity:1,offset:.4},{opacity:0}],{duration:be,fill:"forwards"}):null;f=setTimeout(()=>{r(),o?.cancel(),i?.cancel()},be)},C=t=>{const e=o().length;e&&(s=(Math.round(t)%e+e)%e,v(),m?.kick())},E=(t=s)=>{const e=o()[t];if(!e||p)return;C(t),m?.field.pulse({element:e,strength:.6}),e.dataset.run="",n.current.onRun?.(t,e);const r=()=>{delete e.dataset.run,n.current.closeOnRun&&A()};g()?r():setTimeout(r,240)},$=t=>{if(!n.current.manage)return;const e=o().length;if("Escape"===t.key&&a)return t.preventDefault(),t.stopPropagation(),void A();if(t.target!==i()&&!o().includes(t.target))return;const r="ArrowDown"===t.key?s+1:"ArrowUp"===t.key?s-1:"Home"===t.key?0:"End"===t.key?e-1:null;if(null!==r)return t.preventDefault(),c=!1,void C(r);"Enter"===t.key&&(t.preventDefault(),E())},R=t=>{const e=t.target?.closest?.(n.current.rows);return e?o().indexOf(e):-1},I=t=>{if(!n.current.manage)return;const e=R(t);e<0||(c=!0,e!==s?C(e):m?.kick())},F=()=>{c=!1,m?.kick()},W=t=>{if(!n.current.manage)return;const e=R(t);e>=0&&E(e)},B=()=>{n.current.manage&&(c=!1,l=null,C(0))},O=()=>{a?A():S(!0)},N=t=>{const e=n.current.hotkey;e&&t.key?.toLowerCase()===e.toLowerCase()&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),a?document.activeElement===i()?A():i()?.focus():S(!0))},G=e=>{if(!n.current.manage||!a||p)return;const r=e.target;t.contains(r)||n.current.trigger?.contains(r)||A()};t.addEventListener("keydown",$),t.addEventListener("pointermove",I),t.addEventListener("pointerleave",F),t.addEventListener("click",W),t.addEventListener("input",B);const q=n.current.trigger;return q?.addEventListener("click",O),q?.setAttribute("aria-expanded",String(a)),q?.setAttribute("aria-haspopup","dialog"),document.addEventListener("keydown",N),document.addEventListener("pointerdown",G),a?t.dataset.open="":t.setAttribute("hidden",""),v(),J(()=>m,n,()=>{v(),m?.refresh()},{open:S,close:A,select:C,run:E,toggle(){a?A():S(!0)},get isOpen(){return a},get selected(){return s}},()=>{k(),x(!1),t.removeEventListener("keydown",$),t.removeEventListener("pointermove",I),t.removeEventListener("pointerleave",F),t.removeEventListener("click",W),t.removeEventListener("input",B),q?.removeEventListener("click",O),document.removeEventListener("keydown",N),document.removeEventListener("pointerdown",G),delete t.dataset.gpu,delete t.dataset.state})},exports.compare=function(t,e){const n={current:{position:50,...e}},r=H();let o=L(n.current.position,0,100),i=null,a=null,s={from:o,to:o,at:-1e9},l=0,c=!1;const d=[];let u=n.current.position;a=Y({host:t,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:600,cellSize:6,cellAspect:.8,glyphScale:.96,color:"source",levels:"auto",saturation:1.3,contrast:1.45,gamma:.85,brightness:.14,hover:"trail",trail:{strength:.7,radius:.3},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:(t,e)=>{const n=Math.min(1600,Math.max(2,Math.round(2*t)));return[n,Math.max(2,Math.round(n*e/Math.max(1,t)))]},onFail:()=>{a=null},paint:({pen:t,width:e,height:n})=>(t.imageSmoothingQuality="high",i&&Ye(t,i,0,0,e,n),!1)});const h="string"==typeof n.current.image?Xe(n.current.image):n.current.image,p=t.querySelector('[role="slider"]'),f=t.querySelector("[data-compare-line]"),m=p??document.createElement("div"),g=f??document.createElement("span"),v=t=>{void 0===t&&m.hasAttribute("aria-label")||m.setAttribute("aria-label",t??"Photo and ASCII split")},y=()=>{const e=Math.round(o);r.set(t,"--ascii-pos",`${o}%`),m.setAttribute("aria-valuenow",String(e)),m.setAttribute("aria-valuetext",`${e}% photo, ${100-e}% ASCII`)},b=(t,e=!1)=>{if(t=L(t,0,100),!a)return void(o=t);if(l&&(cancelAnimationFrame(l),l=0),!e||a.still()||Math.abs(t-o)<.5)return o=t,y(),void n.current.onChange?.(o);s={from:o,to:t,at:performance.now()};const r=t=>{const e=L((t-s.at)/280);o=s.from+(s.to-s.from)*P(e),y(),n.current.onChange?.(o),l=e<1?requestAnimationFrame(r):0};l=requestAnimationFrame(r)},M=e=>{const n=t.getBoundingClientRect();return n.width?(e-n.left)/n.width*100:o},x=e=>{if(0!==e.button)return;t.setPointerCapture?.(e.pointerId),c=!0,t.dataset.dragging="";const n=M(e.clientX);b(n,Math.abs(n-o)>3),m.focus({preventScroll:!0})},w=t=>{c&&b(M(t.clientX))},k=()=>{c=!1,delete t.dataset.dragging},S=t=>{const e={ArrowLeft:-5,ArrowDown:-5,ArrowRight:5,ArrowUp:5,PageDown:-20,PageUp:20}[t.key],n="Home"===t.key?0:"End"===t.key?100:void 0!==e?5*Math.round(o/5)+e:null;null!==n&&(t.preventDefault(),b(n,!0))};let A=()=>{};if(a){en("ascii-kit-compare","\n:where(.ascii-compare-photo){position:absolute;inset:0;width:100%;height:100%;object-fit:cover;pointer-events:none;clip-path:inset(0 calc(100% - var(--ascii-pos, 50%)) 0 0)}\n:where(.ascii-compare-line){position:absolute;top:0;bottom:0;left:var(--ascii-pos, 50%);width:2px;translate:-50% 0;background:#fff;box-shadow:0 0 0 .5px rgb(0 0 0 / .25),0 0 12px rgb(0 0 0 / .45);pointer-events:none}\n:where(.ascii-compare-handle){position:absolute;top:50%;left:var(--ascii-pos, 50%);display:grid;place-items:center;width:40px;height:40px;translate:-50% -50%;border-radius:50%;background:#fff;color:#111;box-shadow:0 0 0 1px rgb(0 0 0 / .08),0 4px 14px rgb(0 0 0 / .4);cursor:grab;touch-action:none}\n:where(.ascii-compare-handle:focus-visible){outline:2px solid #fff;outline-offset:3px}\n"),r.set(t,"overflow","hidden"),r.set(t,"touch-action","pan-y"),r.set(t,"user-select","none"),r.set(t,"cursor","ew-resize");const e={className:h.className,hidden:h.getAttribute("aria-hidden")};A=()=>{h.className=e.className,null===e.hidden?h.removeAttribute("aria-hidden"):h.setAttribute("aria-hidden",e.hidden)},h.className=(e.className?`${e.className} `:"")+"ascii-compare-photo",h.setAttribute("aria-hidden","true"),h.draggable=!1,f||(g.className="ascii-compare-line",g.setAttribute("aria-hidden","true")),p||(m.className="ascii-compare-handle",m.innerHTML='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 7-5 5 5 5M15 7l5 5-5 5"/></svg>',m.setAttribute("role","slider"),m.tabIndex=0),v(n.current.label),m.setAttribute("aria-valuemin","0"),m.setAttribute("aria-valuemax","100"),m.setAttribute("aria-orientation","horizontal");for(const e of[h,g,m])t.contains(e)||(t.appendChild(e),d.push(e));y(),t.addEventListener("pointerdown",x),t.addEventListener("pointermove",w),t.addEventListener("pointerup",k),t.addEventListener("pointercancel",k),m.addEventListener("keydown",S),Ve(h).then(t=>{i=t,a?.kick()},()=>{})}else t.contains(h)||("static"===getComputedStyle(t).position&&r.set(t,"position","relative"),h.setAttribute("style","position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit"),t.appendChild(h),d.push(h));return J(()=>a,n,t=>{v(t.label),t.position!==u&&(u=t.position,b(t.position,!0)),a?.refresh()},{set:b,get position(){return o}},()=>{l&&cancelAnimationFrame(l),t.removeEventListener("pointerdown",x),t.removeEventListener("pointermove",w),t.removeEventListener("pointerup",k),t.removeEventListener("pointercancel",k),m.removeEventListener("keydown",S),delete t.dataset.dragging,d.forEach(t=>t.remove()),A(),r.restore()})},exports.contour=mr,exports.decode=function(t,e={}){const n={current:{...lt,...e}},r=H(),o=document.createElement("canvas"),i=document.createElement("canvas");let a=-1,s="",l=!1,c=!1,d=null;const u=(e,r)=>{const i=`${e}x${r}:${n.current.text??""}:${t.textContent}`;if(i===s)return;s=i,o.width=e,o.height=r;const a=o.getContext("2d");a.fillStyle="#000",a.fillRect(0,0,e,r),void 0!==n.current.text?function(t,e,n,r,o){const i=getComputedStyle(e),a=n.split("\n");t.fillStyle="#fff",t.textAlign="center",t.textBaseline="middle";const s=(parseFloat(i.letterSpacing)||0)/(parseFloat(i.fontSize)||16),l=e=>{"letterSpacing"in t&&(t.letterSpacing=s*e+"px")};t.font=`${i.fontWeight} 100px ${i.fontFamily}`,l(0);const c=Math.max(1,...a.map(e=>t.measureText(e).width)),d=Math.min(.94*r/c*100,.9*o/a.length);t.font=`${i.fontWeight} ${d}px ${i.fontFamily}`,l(d),a.forEach((e,n)=>t.fillText(e,r/2,o/2+(n-(a.length-1)/2)*d*1.04))}(a,t,n.current.text,e,r):function(t,e,n,r){const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i=document.createRange();t.fillStyle="#fff",t.textAlign="left",t.textBaseline="alphabetic";for(let e=o.nextNode();e;e=o.nextNode()){const o=e.parentElement;if(!o)continue;const a=getComputedStyle(o);t.font=`${a.fontStyle} ${a.fontWeight} ${parseFloat(a.fontSize)*r}px ${a.fontFamily}`,"letterSpacing"in t&&(t.letterSpacing=(parseFloat(a.letterSpacing)||0)*r+"px");const s=t.measureText("Hg"),l=s.fontBoundingBoxAscent||parseFloat(a.fontSize)*r*.8,c=s.fontBoundingBoxDescent||parseFloat(a.fontSize)*r*.2,d="uppercase"===a.textTransform?t=>t.toUpperCase():"lowercase"===a.textTransform?t=>t.toLowerCase():t=>t;for(const o of e.data.matchAll(/\S+/g)){i.setStart(e,o.index),i.setEnd(e,o.index+o[0].length);const a=i.getClientRects()[0];if(!a)continue;const s=(a.top-n.top)*r,u=a.height*r;t.fillText(d(o[0]),(a.left-n.left)*r,s+(u-l-c)/2+l)}}i.detach?.()}(a,t,t.getBoundingClientRect(),e/(t.getBoundingClientRect().width||1))};d=Y({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4.5,cellAspect:.62,glyphScale:.92,contrast:1.35,hover:"trail",trail:{strength:.6,radius:.2},...n.current.look}),ink:()=>n.current.ink??getComputedStyle(t).color,kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{d=null,r.restore()},paint:({pen:t,width:e,height:r,now:s,still:d})=>{u(e,r);const p=n.current,f="text"===p.settle;if(a<0||d)return!(!c&&"visible"===p.trigger&&!d)&&(f&&a>=0||t.drawImage(o,0,0),a>=0&&h(),!1);const m=s-a,g=.3*p.duration,v=.7*p.duration,y=Math.max(2,Math.ceil(e/20)),b=Math.max(2,Math.ceil(r/20));if(i.width===y&&i.height===b||(i.width=y,i.height=b),ct(i,m/1e3),t.imageSmoothingEnabled=!0,m<g)return t.drawImage(i,0,0,e,r),l&&(t.globalAlpha=1-P(m/g),t.drawImage(o,0,0),t.globalAlpha=1),!0;const M=Math.min(1,(m-g)/v),x=(1.18*M-.02)*e,w=.14*e,k=5.58,S=Math.floor(s/16);if(M>=1)return f||t.drawImage(o,0,0),h(),!1;t.drawImage(i,0,0,e,r),x>0&&t.drawImage(o,0,0,x,r,0,0,x,r);for(let e=Math.max(0,Math.floor(x/k)*k);e<x+w;e+=k){const n=(e-x)/w;for(let i=0;i<r;i+=9)z(e+13*S,i)<n||(t.globalAlpha=.35+.65*z(i+7*S,e),t.fillStyle="#000",t.fillRect(e,i,k,9),t.drawImage(o,e,i,k,9,e,i,k,9))}return t.globalAlpha=1,!0}});const h=()=>{a=-1,l="text"!==n.current.settle,l||r.restore()},p=()=>{d&&(r.set(t,"-webkit-text-fill-color","transparent"),c=!0,a=performance.now(),d.kick())};let f=!1;const m=d&&"visible"===n.current.trigger&&"function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{t.isIntersecting&&!f&&p(),f=t.isIntersecting},{threshold:.5}):null;d&&("text"!==n.current.settle&&r.set(t,"-webkit-text-fill-color","transparent"),l="text"!==n.current.settle&&"manual"===n.current.trigger,m?m.observe(t):"visible"===n.current.trigger&&p());let g=!1;const v=()=>{g||(g=!0,n.current.replayOnHover&&a<0&&p())},y=()=>{g=!1},b=e=>{!g||e.target instanceof Node&&t.contains(e.target)||(g=!1)};return d&&(t.addEventListener("pointerenter",v),t.addEventListener("pointermove",v),t.addEventListener("pointerleave",y),document.addEventListener("pointermove",b,!0)),d&&document.fonts?.ready.then(()=>{s="",d?.kick()}),J(()=>d,n,()=>{s="",d?.refresh()},{replay:p},()=>{m?.disconnect(),t.removeEventListener("pointerenter",v),t.removeEventListener("pointermove",v),t.removeEventListener("pointerleave",y),document.removeEventListener("pointermove",b,!0),r.restore()})},exports.disintegrate=function(t,e={}){const n=Mn.get(t);if(n)return n;const r={...yn,...e},o=H(),i=t.offsetHeight,a=()=>{for(const e of t.children)o.set(e,"opacity","0");o.set(t,"color","transparent"),o.set(t,"pointer-events","none"),t.setAttribute("aria-hidden","true")},s=e=>{r.collapse&&(o.set(t,"box-sizing","border-box"),o.set(t,"overflow","hidden"),o.set(t,"min-height","0"),o.set(t,"height",`${(i*(1-e)).toFixed(2)}px`),e>=1&&(o.set(t,"padding-block","0"),o.set(t,"margin-block","0"),o.set(t,"border-width","0")))},l=r.host??t.parentElement??t;let c=0,d=!1,u=null,h={x:0,y:0,w:0,h:0},p=()=>{};const f=Y({host:l,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,contrast:1.6,drift:5,...r.look}),outset:bn,resolution:2,ink:()=>r.ink??"--ascii-ink-strong",kit:{current:{lazy:!1,globalLook:r.globalLook}},reducedMotion:()=>r.reducedMotion,onFail:()=>p(),paint:({pen:t,now:e,still:n,scale:o})=>{if(n)return queueMicrotask(p),!1;if(!u||!d)return!1;const i=e-c,a=L(i/r.duration);t.setTransform(o,0,0,o,0,0),i>=300&&s(P(L((i-300)/260))),t.save(),t.globalAlpha=L(2.2*(1-a))*(1-.9*a*a),t.translate(8*a,-14*a),t.drawImage(u,0,0,u.width/2,u.height/2),t.globalCompositeOperation="destination-out";const l=h.x+h.w,f=l-(1.3*a-.3)*h.w,m=l-1.3*a*h.w,g=t.createLinearGradient(m,0,Math.max(m+1,f),0);g.addColorStop(0,"rgba(0,0,0,0)"),g.addColorStop(1,"rgba(0,0,0,1)"),t.globalAlpha=1,t.fillStyle=g,t.fillRect(h.x-bn,h.y-bn,h.w+32,h.h+32),t.restore();const v=i>=Math.max(r.duration,r.collapse?560:0);return v&&queueMicrotask(p),!v}}),m=new Promise(e=>{let n=!1;if(p=()=>{n||(n=!0,f?.destroy(),s(1),r.remove&&t.remove(),Mn.delete(t),e())},!f||f.still())return a(),void p();h=f.box(t),u=Ze(t,f.canvas.clientWidth||h.w+32,f.canvas.clientHeight||h.h+32,f.box).canvas;f.field.ready.then(()=>{n||d||(a(),d=!0,c=performance.now(),f.kick())},()=>{a(),p()})});return Mn.set(t,m),m},exports.dna=gr,exports.drift=Rn,exports.dropzone=function(t,e={}){const n={current:{...vn,...e}};let r="empty",o=null,i="",a="",s="image",l=0,c=0,d=!1,u=0,h=0,p=0,f=null,m=null,g=null;const v=D("",!0),y=["left","top","width","height"],b=()=>{const e=m?.canvas;if(!e||!t.offsetWidth)return null;const n="empty"===r?function(t,e,n=Math.min(2,"number"==typeof devicePixelRatio&&devicePixelRatio>0?devicePixelRatio:1)){const r=Math.max(2,Math.round(6*n)),o=Math.max(2,Math.round(1*r)),i=(t,e)=>{const r=Math.floor(t*n/e);for(let t=r;t>1;t--){const o=t*e/n;if(Math.abs(o-Math.round(o))<.01||t<r-8)return{n:t,css:Math.round(o)}}return{n:1,css:Math.round(e/n)}},a=i(t,o),s=i(e,r);return{cols:a.n,rows:s.n,w:a.css,h:s.css,cw:o/n,ch:r/n}}(t.offsetWidth,t.offsetHeight):null,o=n?[`${Math.round((t.offsetWidth-n.w)/2)}px`,`${Math.round((t.offsetHeight-n.h)/2)}px`,`${n.w}px`,`${n.h}px`]:["0px","0px","100%","100%"];let i=!1;return y.forEach((t,n)=>{e.style[t]!==o[n]&&(e.style[t]=o[n],i=!0)}),g=n,i?(m?.field.resize(),m?.kick(),null):n},M=document.createElement("input"),x=[v,M];let w=null;const k=!t.children.length;m=Y({host:t,layer:"under",look:()=>"empty"===r?{mark:"glyph",charset:" .:+*#",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:1,glyphScale:.9,...n.current.look}:{mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,background:q(t)?"transparent":"#0b0b0a",color:"source",saturation:1.15,contrast:1.15,levels:"auto",brightness:"developing"===r?-1:.08,hover:"trail",trail:{strength:.6,radius:.3},...n.current.look},ink:t=>n.current.ink??`var(--ascii-ink, ${t?"#7a7872":"#76746e"})`,kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:(t,e)=>"empty"===r&&g?[2*g.cols,2*g.rows]:[Math.max(1,Math.round(t)),Math.max(1,Math.round(e))],onFail:()=>{m=null,i&&C(i)},paint:({pen:e,w:i,h:a,now:s,still:c})=>{if("empty"!==r){if(!o)return!1;const t=c?1:P(L((s-l)/n.current.develop));Ye(e,o,0,0,i,a);const d=n.current.look?.brightness??.08;return"developing"===r&&m?.field.update({brightness:t*(1+d)-1}),t>=1&&"developing"===r&&A(),t<1}const u=p?Math.min(64,s-p):16;p=s;const f=d?1:0;h=c?f:h+(f-h)*(1-Math.exp(-u/70));const g=c?.5:.5-.5*Math.cos(s/1300*Math.PI*2),v=Math.max(4,(parseFloat(getComputedStyle(t).borderTopLeftRadius)||16)-6),y=b();y&&function(t,e,n,r,o){const{cols:i,rows:a}=e,s=t.createImageData(2*i,2*a),l=s.data,c=Math.max(1,n/e.cw),d=Math.max(1,n/e.ch),u=i-2,h=a-2;for(let t=0;t<a;t++)for(let e=0;e<i;e++){const n=Math.max(1+c-e,0,e-(u-c)),a=Math.max(1+d-t,0,t-(h-d));let s;if(n>0&&a>0){const t=Math.hypot(n/c,a/d);s=Math.hypot(n,a)*(1-1/t)}else s=-Math.min(e-1,u-e,t-1,h-t);const p=Math.abs(s)<.5?r:o>0&&s<-.5&&s>-1.5?.55*r*o:0,f=Math.round(255*Math.min(1,p));for(let n=0;n<4;n++){const r=4*((2*t+(n>>1))*i*2+2*e+(1&n));l[r]=l[r+1]=l[r+2]=f,l[r+3]=255}}t.putImageData(s,0,0)}(e,y,v,.56+h*(.14+.28*g),h*(.4+.6*g));const M=d||Math.abs(f-h)>.004;return M||(p=0),M}});const S=e=>{const o=r;r=e,t.dataset.state=e,"empty"===o!=("empty"===e)&&(b(),m?.refresh()),o!==e&&n.current.onState?.(e,"empty"===e?"":s)},A=()=>{S("done"),v.textContent=`${s} ready`,o&&n.current.onImage?.({file:f,src:i,width:o.width,height:o.height})};function C(e){w??(w=Object.assign(document.createElement("img"),{className:"ascii-drop-img",alt:""})),w.src=e,w.parentElement!==t&&(t.prepend(w),x.push(w))}const E=async(t,e=null)=>{const n=++c;let d;a&&URL.revokeObjectURL(a),a="string"==typeof t?"":URL.createObjectURL(t),i=a||t,f=e??("undefined"!=typeof File&&t instanceof File?t:null),s=f?.name??("string"==typeof t&&t.split("/").pop()?.split("?")[0]||"image"),v.textContent=`Converting ${s}`;try{d=await Ve(Xe(i))}catch{return void(n===c&&(v.textContent=`Could not load ${s}`))}if(n===c){if(o=d,!m)return C(i),S("done"),void A();l=performance.now(),S(m.still()?"done":"developing"),m.field.pulse({strength:1}),m.kick(),"done"===r&&A()}},$=t=>{const e=e=>{v.textContent=e,n.current.onError?.(e,t)};return t.type.startsWith("image/")?t.size>n.current.maxBytes?e(`${t.name} is over ${Math.round(n.current.maxBytes/1024/1024)} MB.`):void E(t,t):e(`${t.name} isn’t an image.`)},z=()=>{c++,o=null,i="",f=null,a&&URL.revokeObjectURL(a),a="",w?.remove(),S("empty"),v.textContent="",m?.kick()},R=()=>M.click(),I=e=>new Promise(i=>{const a=m?.field;if(!a||!o||"done"!==r)return void i(null);const l=document.createElement("canvas");l.width=a.canvas.width,l.height=a.canvas.height;const c=l.getContext("2d");c?(c.fillStyle=getComputedStyle(t).backgroundColor||"#000",c.fillRect(0,0,l.width,l.height),a.redraw(),c.drawImage(a.canvas,0,0),l.toBlob(t=>{if(t){const r=document.createElement("a");r.href=URL.createObjectURL(t),r.download=e??n.current.filename??`${s.replace(/\.[^.]+$/,"")}-ascii.png`,r.click(),setTimeout(()=>URL.revokeObjectURL(r.href),1e3)}i(t)},"image/png")):i(null)}),T=()=>{p=0,m?.kick()},F=e=>{e.preventDefault(),u++,d||(d=!0,t.dataset.over="",T())},W=t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="copy")},B=()=>{u=Math.max(0,u-1),!u&&d&&(d=!1,delete t.dataset.over,T())},O=e=>{if(e.preventDefault(),u=0,d=!1,delete t.dataset.over,m){const n=t.getBoundingClientRect();m.field.pulse({x:e.clientX-n.left,y:e.clientY-n.top,strength:1})}const n=e.dataTransfer?.files?.[0];n?$(n):T()},N=t=>{const e=t.target?.closest?.("[data-dropzone]")?.getAttribute("data-dropzone");"pick"===e?R():"clear"===e?z():"download"===e&&I()},G=()=>{const t=M.files?.[0];M.value="",t&&$(t)};en("ascii-kit-dropzone",'\n:where(.ascii-drop-empty){position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;height:100%;min-height:inherit;padding:24px;box-sizing:border-box;text-align:center}\n:where([data-ascii-dropzone]:not([data-state="empty"])) :where(.ascii-drop-empty){display:none}\n:where(.ascii-drop-title){margin:0;font-weight:500}\n:where(.ascii-drop-hint){margin:0;font-size:14px;opacity:.65}\n:where(.ascii-drop-pick){margin-top:8px;height:34px;padding:0 14px;border:0;border-radius:999px;background:currentColor;font:inherit;font-size:14px;cursor:pointer}\n:where(.ascii-drop-pick) > span{color:Canvas}\n:where(.ascii-drop-img){position:absolute;inset:0;width:100%;height:100%;object-fit:cover}\n'),t.dataset.asciiDropzone="",M.type="file",M.accept="image/*",M.tabIndex=-1,M.hidden=!0,M.setAttribute("aria-hidden","true"),k&&x.push(function(){const t=document.createElement("div"),e=document.createElement("p"),n=document.createElement("p"),r=document.createElement("button"),o=document.createElement("span");return t.className="ascii-drop-empty",e.className="ascii-drop-title",e.textContent="Drop an image",n.className="ascii-drop-hint",n.textContent="PNG, JPG or WebP",r.type="button",r.className="ascii-drop-pick",r.dataset.dropzone="pick",o.textContent="Choose file",r.appendChild(o),t.append(e,n,r),t}());for(const e of x)t.appendChild(e);return S("empty"),t.addEventListener("dragenter",F),t.addEventListener("dragover",W),t.addEventListener("dragleave",B),t.addEventListener("drop",O),t.addEventListener("click",N),M.addEventListener("change",G),J(()=>m,n,()=>m?.refresh(),{setImage:t=>E(t),clear:z,pick:R,download:I,get state(){return r}},()=>{c++,a&&URL.revokeObjectURL(a),t.removeEventListener("dragenter",F),t.removeEventListener("dragover",W),t.removeEventListener("dragleave",B),t.removeEventListener("drop",O),t.removeEventListener("click",N),M.removeEventListener("change",G),x.forEach(t=>t.remove()),delete t.dataset.asciiDropzone,delete t.dataset.state,delete t.dataset.over})},exports.dune=yr,exports.etch=Mr,exports.facet=wr,exports.fieldBackground=function(t,e={}){const n={current:{...Jt,...e}},r=()=>"notFound"===n.current.preset;let o=0,i=!1,a=0;const s={x:-1e4,y:-1e4,at:-1e6},l=()=>function(t){const e=document.createElement("canvas").getContext("2d");e.font=Kt;const n=Math.max(320,Math.ceil(e.measureText(t).width)+160),{canvas:r,pen:o}=Xt(n,560);return o.fillStyle="#fff",o.textAlign="center",o.textBaseline="middle",o.font=Kt,o.letterSpacing="-10px",o.fillText(t,n/2,296),r}(n.current.text);let c=null;c=Ut({host:t,look:()=>{const t=n.current,e=t.clear,r=t=>!!e&&{element:e,padding:-14,feather:t,shape:"ellipse"};return{..."notFound"===t.preset?te:"brand"===t.preset?Zt({scale:Qt()?1.4:1.6,brightness:.24,contrast:1.1,clear:r(.3)}):Zt({scale:Qt()?1.6:1.9,brightness:.26,contrast:1.15,clear:r(.22)}),...t.look}},ink:t=>{const e=n.current,r=e.palette,o="string"==typeof r?r:r?.[t?"dark":"light"];return o??e.ink?o??e.ink:"notFound"===e.preset?t?"#d8d6cf":"#1d1d1b":"brand"===e.preset?`var(--brand, ${t?"#8f80ff":"#5b4bd1"})`:t?"#8a8881":"#6b6964"},source:r()?l():null,label:n.current.label??(r()?n.current.text:void 0),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{c=null}}),c&&r()&&document.fonts?.load?.(Kt).then(()=>{c&&r()&&!i&&c.field.setSource(l())},()=>{});const d=(t,e=1.4)=>{c&&!c.still()&&(a=performance.now()+1400,Yt(c.field,t,e))},u=t=>{const e=n.current,o=performance.now();!c||r()||!e.ripple||c.still()||o<a||o-s.at<520||Math.hypot(t.clientX-s.x,t.clientY-s.y)<36||(Object.assign(s,{x:t.clientX,y:t.clientY,at:o}),Yt(c.field,{x:t.clientX,y:t.clientY},.65))};c&&t.addEventListener("pointermove",u);let h=n.current.preset,p=n.current.text;return Vt(()=>c,n,t=>{c&&((t.preset!==h||"notFound"===t.preset&&t.text!==p)&&(o++,i=!1,c.field.setSource("notFound"===t.preset?l():null)),h=t.preset,p=t.text)},{pulse:d,scatter:async t=>{const e=c?.field;if(!e)return;if(!r())return void d(t);if(t&&d(t,1.2),i||c.still())return;i=!0;const n=++o,a=l(),s=function(t){const e=t.getContext("2d").getImageData(0,0,t.width,t.height).data,n=[];for(let r=0;r<t.height;r+=_t)for(let o=0;o<t.width;o+=_t){let i=!1;for(let n=0;n<_t&&!i;n+=4)for(let a=0;a<_t&&!i;a+=4)i=(e[4*((r+n)*t.width+o+a)]??0)>40;if(!i)continue;const a=n.length,s=z(a,1)*Math.PI*2,l=120+420*z(a,2);n.push({x:o,y:r,dx:Math.cos(s)*l+.5*(o-t.width/2),dy:Math.sin(s)*l*.6,lag:.35*z(a,3)})}return n}(a),u=Xt(a.width,a.height).canvas;for(const t of ee){const r=performance.now();if(ne(a,u,s,t),await e.setSource(u),await jt(Math.max(0,44-(performance.now()-r))),n!==o||!c)return void(i=!1)}await e.setSource(a),i=!1}},()=>{o++,t.removeEventListener("pointermove",u)})},exports.fire=kr,exports.fluid=On,exports.getFieldBudget=()=>i,exports.getGlobalLook=()=>n,exports.grid=Sr,exports.halftone=In,exports.imageGenerate=function(t,e={}){const n={current:{...e}},r=H(),o=document.createElement("canvas");let i="idle",a=0,s=0,l="",c=null;const d={from:{img:null,k:0,blur:12},to:{img:null,k:0,blur:12},at:-1e6},u=()=>void 0===n.current.image?t.querySelector("img"):n.current.image,h=(t,e)=>{const n=e?1:P(Math.min(1,Math.max(0,(t-d.at)/qt))),r=d.from.blur+(d.to.blur-d.from.blur)*n;return[{...d.from,k:d.from.k*(1-n),blur:r},{...d.to,k:d.from.k+(d.to.k-d.from.k)*n,blur:r}]},p=(t,e,n)=>{const r=performance.now(),[o,i]=h(r,!!c?.still());d.from={img:i.img??o.img,k:o.k+i.k,blur:i.blur},d.to={img:t,k:e,blur:n},d.at=r,c?.kick()};c=Y({host:t,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:7,cellAspect:.8,glyphScale:.8,contrast:1.4,drift:.5,speed:.6,hover:"trail",trail:{strength:.9,radius:.35},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:(t,e)=>{const n=Math.min(480,Math.max(2,Math.round(t)));return[n,Math.max(2,Math.round(n*e/Math.max(1,t)))]},onFail:()=>{c=null,r.restore()},paint:({pen:t,width:e,height:r,now:s,still:l})=>{const c="generating"===i,u=l?0:(s-a)/1e3;c&&n.current.elapsed&&(n.current.elapsed.textContent=(t=>{const e=t/1e3;return e<60?`${e.toFixed(1)}s`:`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,"0")}`})(s-a));const p=c&&!l?1+.12*Math.sin(2.1*u)*(.7+.3*Math.sin(.37*u)):1,f=Math.max(2,Math.ceil(24*r/Math.max(1,e)));24===o.width&&o.height===f||(o.width=24,o.height=f),ct(o,3.1+(c?.55*u:0),.35);const m=h(s,l),g=Math.min(1,m.reduce((t,e)=>t+(e.img?e.k:0),0));t.imageSmoothingEnabled=!0,t.globalAlpha=Math.max(0,1-g),t.filter=`brightness(${1.7*p})`,t.drawImage(o,0,0,e,r);for(const{img:n,k:o,blur:i}of m){if(!n||o<=0)continue;const a=n.width,s=n.height,l=Math.min(s,a*r/e),c=Math.min(a,s*e/r);t.globalAlpha=Math.min(1,1.25*o),t.filter=`brightness(1.3) blur(${i}px)`,t.drawImage(n,(a-c)/2,Math.max(0,.45*(s-l)),c,l,0,0,e,r)}return t.filter="none",t.globalAlpha=1,c||s-d.at<qt}});const f=(e,r)=>{i=e,t.dataset.state=e,t.setAttribute("aria-busy",String("generating"===e)),n.current.onState?.(e,r)},m=t=>{const e=u();e&&c&&(r.set(e,"transition",c.still()?"none":`opacity ${t?qt:240}ms ${t?"cubic-bezier(.45, 0, .25, 1)":"cubic-bezier(.16, 1, .3, 1)"}`),r.set(e,"opacity",t?"1":"0"))},g=t=>new Promise(e=>setTimeout(e,t)),v=t=>{const e=u();e&&(l&&URL.revokeObjectURL(l),l="string"==typeof t?"":URL.createObjectURL(t),e.src=l||t,c||r.set(e,"visibility","visible"))},y=async(t=n.current.stream)=>{if(!t)return i;const e=++s,r=()=>e===s,o=!!c?.still();a=performance.now(),f("generating"),m(!1),p(null,0,12);let l=0;try{for await(const e of"function"==typeof t?t():t){if(!r())return i;if(!(e.final??e.preview))continue;if(e.final){v(e.final),c&&p(await Dt(e.final),Ht.final.k,Ht.final.blur);break}if(!c){v(e.preview);continue}const t=Ht.preview[Math.min(l++,Ht.preview.length-1)];p(await Dt(e.preview),t.k,t.blur)}if(await g(o?0:qt),!r())return i;f("done"),m(!0),c?.kick()}catch(t){if(!r())return i;p(null,0,12),await g(o?0:qt),f("failed",t)}return i};{const t=u();t&&r.set(t,c?"opacity":"visibility",c?"0":t.getAttribute("src")?"visible":"hidden")}return n.current.stream&&y(),J(()=>c,n,()=>c?.refresh(),{run:y,reset(){s++,p(null,0,12),f("idle"),m(!1)},get state(){return i}},()=>{s++,l&&URL.revokeObjectURL(l),delete t.dataset.state,t.removeAttribute("aria-busy"),r.restore()})},exports.likeBurst=function(t,e={}){const n={current:{...Le,...e}},r=H(),o=()=>t.querySelector(n.current.icon)??t,i=()=>!!(n.current.reducedMotion??T());let a="true"===t.getAttribute("aria-pressed"),s=[],l=[],c=null;c=Y({host:t,outset:n.current.outset,layer:n.current.layer,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.92,...n.current.look}),ink:t=>n.current.ink??("heart"===n.current.kind?`var(--ascii-like, ${t?"#ff6b70":"#e5484d"})`:t?"#d8d6cf":"#1d1d1b"),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{c=null},paint:({pen:t,w:e,now:r,box:i})=>{const a=i(o()),l=n.current.kind;s=s.filter(e=>{const n=(r-e.start)/("burst"===e.kind?560:300);if(n>=1)return!1;if(n<0)return!0;if(t.save(),"burst"===e.kind)Pe(t,l,a,n,e.seed);else{const e=a.x+a.w/2,r=a.y+a.h/2+3*ze(n),o=a.h*(1+.12*ze(n));Ie(t,l,e,r,o,(1-n)**1.4),t.fillStyle="#000";for(let i=r-o/2;i<r+o/2;i+=3)for(let r=e-o/2;r<e+o/2;r+=2)z(r,i)<1.15*n&&t.fillRect(r,i,2,3)}return t.restore(),!0});const c=n.current.limit;if(c&&s.length){const n=i(c),r=n.y+n.h,o=t.createLinearGradient(0,r-2,0,r+8);o.addColorStop(0,"#000"),o.addColorStop(1,"rgb(0 0 0 / 0)"),t.fillStyle="#000",t.fillRect(0,0,e,r-2),t.fillStyle=o,t.fillRect(0,r-2,e,10)}return s.length>0}});const d=()=>{l.forEach(clearTimeout),l=[]},u=()=>{if(d(),r.restore(),!c||i())return;const e=performance.now(),n=o();s=s.filter(t=>"undo"!==t.kind),s.push({kind:"burst",start:e,seed:Math.floor(e)%97}),n!==t&&r.set(n,"opacity","0"),l.push(setTimeout(()=>{r.restore(),n!==t&&"function"==typeof n.animate&&n.animate({opacity:["0","1"],scale:[".7","1"]},{duration:220,easing:"cubic-bezier(.34, 1.42, .64, 1)"})},347.2)),c.kick()},h=()=>{d(),r.restore(),c&&!i()&&(s=s.filter(t=>"burst"!==t.kind),s.push({kind:"undo",start:performance.now(),seed:0}),c.kick())},p=(e=!a)=>{a=e,t.setAttribute("aria-pressed",String(a)),a?u():h()},f=()=>{n.current.manage&&(p(),n.current.onChange?.(a))};return!t.hasAttribute("aria-pressed")&&n.current.manage&&t.setAttribute("aria-pressed","false"),t.addEventListener("click",f),J(()=>c,n,()=>c?.refresh(),{burst:u,undo:h,toggle:p,get pressed(){return a}},()=>{d(),r.restore(),t.removeEventListener("click",f)})},exports.moire=Cr,exports.morph=Er,exports.mountCanvas=Dn,exports.mountSurface=Y,exports.noise=$r,exports.odometer=function(t,e={}){const n=parseFloat((t.textContent??"").replace(/[^\d.-]/g,"")),r={current:{...dt,...e,value:e.value??(Number.isFinite(n)?n:0)}},o=H();let i=r.current.value,a=r.current.format(i),s={from:a,to:a,t0:-1e9,up:!0,first:-1},l=null;const c=D(a,!0),d=document.createElement("span"),u=()=>{d.replaceChildren(...[...a].map(t=>Object.assign(document.createElement("span"),{textContent:t}))),c.textContent=a};l=Y({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:3,cellAspect:.66,glyphScale:1,shade:.2,contrast:1.1,...r.current.look}),ink:()=>r.current.ink??getComputedStyle(t).color,kit:r,reducedMotion:()=>r.current.reducedMotion,resolution:2,onFail:()=>{l=null,t.textContent=a,o.restore()},paint:({pen:t,now:e,still:n,box:o,scale:i})=>{const a=getComputedStyle(d),l=parseFloat(a.fontSize),c=parseFloat(a.letterSpacing)||0,u=`${a.fontStyle} ${a.fontWeight} ${a.fontSize} ${a.fontFamily}`;t.setTransform(i,0,0,i,0,0),t.font=u,t.textAlign="center",t.textBaseline="alphabetic";const h=t.measureText("0"),p=h.fontBoundingBoxAscent||.8*l,f=h.fontBoundingBoxDescent||.2*l,{from:m,to:g,t0:v,up:y,first:b}=s,M=[...d.children],x=r.current,w="glyph"===x.face,k=(t,e)=>t[t.length-1-e]??"";let S=!1;return M.forEach((r,i)=>{const a=M.length-1-i,s=o(r),d=s.x+(s.w-c)/2,h=s.y,A=s.h,C=h+(A-p-f)/2+p,E=k(g,a),$=b-a,R=!n&&b>=0&&$>=0&&/\d/.test(E)?L((e-v)/(x.duration+$*x.stagger)):1,T=P(R),F=R<1&&!w?I(.72,1,R).toFixed(3):"";if(r.style.opacity!==F&&(r.style.opacity=F),R>=1)return void(w&&(t.globalAlpha=1,t.font=u,t.fillStyle="#fff",t.fillText(E,d,C)));S=!0,t.globalAlpha=w?1:1-I(.72,1,R);const W=5+2*$,B=[k(m,a),...Array.from({length:W},(t,e)=>x.glyphs[Math.floor(z(e+7*a,v)*x.glyphs.length)]??""),E];y||B.reverse();const O=(B.length-1)*A,N=y?T*O:O-T*O;t.save(),t.beginPath(),t.rect(d-s.w,h,2*s.w,A),t.clip(),B.forEach((e,n)=>{const r=C+n*A-N;if(r<h-A||r>h+2*A)return;const o=n>0&&n<B.length-1;t.font=o?`600 ${.84*l}px "Geist Mono", ui-monospace, monospace`:u,t.fillStyle=o?"#d0d0d0":"#fff",t.fillText(e,d,r)}),t.restore()}),t.globalAlpha=1,S}});const h=()=>{l&&o.set(d,"color","glyph"===r.current.face?"transparent":"inherit")};l&&(o.set(d,"display","inline-flex"),h(),d.setAttribute("aria-hidden","true"),t.replaceChildren(c,d,...(t=>[...t.children].filter(t=>"IMG"===t.tagName&&void 0!==t.dataset?.asciiPoster))(t),l.canvas),u(),document.fonts?.ready.then(()=>l?.kick()));const p=e=>{if(!Number.isFinite(e))return;const n=i,o=a;i=r.current.value=e,a=r.current.format(e),l?o!==a&&(s={from:o,to:a,up:e>=n,first:ut(o,a),t0:performance.now()},u(),l.kick()):t.textContent=a};return J(()=>l,r,t=>{h(),t.value!==i?p(t.value):(a=t.format(i),u(),l?.refresh())},{set:p,get value(){return i}},()=>{l&&(t.textContent=a),o.restore()})},exports.pageDissolve=function(t,e={}){const n={current:{...We,...e}},r=H();let o=null,i=0,a=Promise.resolve(),s=0,l=null;l=Y({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:8,cellAspect:.6,glyphScale:.9,contrast:1.15,shade:.55,...n.current.look}),ink:t=>n.current.ink??(t?"#d8d6cf":"#1d1d1b"),kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{l=null;const t=o;o=null,r.restore(),t?.done()},paint:({pen:t,now:e})=>{const n=o;if(!n)return!1;const r=Math.min(1,(e-n.start)/n.ms),a=n.from<n.to?r*r:P(r),s=n.from+(n.to-n.from)*a;return function(t,e,n,r,o){const i=e.width,a=e.height,s=[],l=Math.max(...[[0,0],[i,0],[0,a],[i,a]].map(([t,e])=>Math.hypot(t-r.x,e-r.y)))||1;for(let c=0;c<a;c+=Oe)for(let a=0;a<i;a+=Be){const i=Math.hypot(a+5-r.x,c+8-r.y)/l*.72+.28*z(a,c)-n;if(i>0&&t.drawImage(e,a,c,Be,Oe,a,c,Be,Oe),i>0&&i<.07)s.push([a,c]);else if(i<=0&&i>-.12){const n=-i/.12;t.globalAlpha=1-n,t.drawImage(e,a,c,Be,Oe,a+18*(z(c,a+o)-.5)*n,c-10*n,Be,Oe),t.globalAlpha=1}}t.globalCompositeOperation="lighter";for(const[n,r]of s)t.drawImage(e,n,r,Be,Oe,n,r,Be,Oe);t.globalCompositeOperation="source-over"}(t,n.art,s,n.at,++i),l?.field.update({brightness:-.22*(n.from<n.to?a:1-a)}),!(r>=1)||(o=null,n.done(),!1)}});const c=()=>[...t.children].filter(t=>!("CANVAS"===t.tagName&&void 0!==t.dataset.asciiKit)),d=(t,e,n,r,i,a)=>new Promise(s=>{o={art:e,from:n,to:r,start:performance.now(),ms:Math.max(1,i),at:a,done:s},t.kick()}),u=e=>ve(t,e.box,t.offsetWidth,t.offsetHeight,2,{skip:e.canvas}),h=async(e,o)=>{const i=l;if(!i||(n.current.reducedMotion??T()))return void await e();const a=((e,n)=>{if(e&&"getBoundingClientRect"in e){const t=n.box(e);return{x:2*(t.x+t.w/2),y:2*(t.y+t.h/2)}}return e?{x:2*e.x,y:2*e.y}:{x:t.offsetWidth/2*2,y:0}})(o??n.current.origin,i),s=u(i);t.dataset.state="out";for(const t of c())r.set(t,"opacity","0");if(await d(i,s,0,1.12,n.current.dissolve,a),await e(),l){i.canvas.isConnected&&i.canvas.parentElement===t||t.appendChild(i.canvas);for(const t of c())r.set(t,"opacity","0");t.dataset.state="in",await d(i,u(i),.92,-.12,n.current.condense,a),r.restore(),l?.field.update({brightness:0}),l?.kick()}};return J(()=>l,n,()=>l?.refresh(),{swap(e,n){s++;const r=a.then(()=>h(e,n)).finally(()=>{0===--s&&delete t.dataset.state});return a=r.catch(()=>{}),r},get busy(){return s>0}},()=>{const e=o;o=null,r.restore(),delete t.dataset.state,e?.done()})},exports.pill=function(t,e={}){const n={current:{...It,...e}},r=t instanceof HTMLElement?[t]:[...t],o=1===r.length,i=o?r[0]:r.length?function(t){let e=t[0].parentElement;for(;e&&!t.every(t=>e.contains(t));)e=e.parentElement;return e??document.body}(r):null,a=H(),s=new Map,l=new Map,c=new Map,d=new Map,u=[],h=t=>void 0!==t.dataset.count?"count":"new"===Nt(t,n.current.tone)?"new":"status",p=(t=-1e6)=>{for(const e of r){const r=Nt(e,n.current.tone),o=s.get(e);o?o.to!==r&&s.set(e,{from:o.to,to:r,at:t}):s.set(e,{from:r,to:r,at:-1e6})}};p();const f=()=>m?.dark()??(!i||q(i))?"dark":"light";let m=null,g="";function v(){for(;u.length;)u.pop()();a.restore()}m=i?Y({host:i,layer:o?"under":"over",look:()=>({mark:"glyph",charset:Tt[f()].charset,font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:8,cellAspect:.6,glyphScale:.92,color:"source",saturation:1,shade:0,...n.current.look}),ink:()=>n.current.ink,kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{m=null,v()},onTheme:()=>m?.field.update({charset:Tt[f()].charset}),paint:({pen:t,now:e,still:o,dark:i,box:a})=>{const u=n.current,p=i?"dark":"light",f={...Pt[p],...u.tones?.[p]},v=Tt[p].top,y=Math.min(2,globalThis.devicePixelRatio||1),b=Math.round(8*y)/y,M=Math.round(8*y*.6)/y,x=(t,e)=>Ot(t,e*v),w=r.map(t=>function(t,e,n){const r=Math.round((t.y+t.h/2)/n-.5)*n,o=Math.ceil((t.x+5)/e)*e,i=Math.floor((t.x+t.w-5)/e)*e;return{x:o,y:r,w:Math.max(0,i-o)}}(a(t),M,b)),k=function(t,e){const n=t=>t.toFixed(2),r=t.filter(t=>t.w>4).map(({x:t,y:r,w:o})=>`M${n(t+2)} ${n(r)}H${n(t+o-2)}Q${n(t+o)} ${n(r)} ${n(t+o)} ${n(r+2)}V${n(r+e-2)}Q${n(t+o)} ${n(r+e)} ${n(t+o-2)} ${n(r+e)}H${n(t+2)}Q${n(t)} ${n(r+e)} ${n(t)} ${n(r+e-2)}V${n(r+2)}Q${n(t)} ${n(r)} ${n(t+2)} ${n(r)}Z`).join("");return r?`path("${r}")`:"inset(50%)"}(w,b);k!==g&&(g=k,m.canvas.style.clipPath=k);let S=!1;return r.forEach((r,i)=>{const{x:p,y:m,w:g}=w[i],v=h(r);if(!(g<=0)){if(t.save(),t.beginPath(),t.rect(p,m,g,b),t.clip(),"status"===v){const l=s.get(r),c=o?1:R((e-l.at)/240);c<1&&(S=!0);const d=Wt(f[l.from],f[l.to],c),h=!o&&(t=>void 0!==t.dataset.live?"false"!==t.dataset.live:n.current.live)(r);if(h){S=!0;const n=(e+1300*i)%4200/1100;if(n<1){const e=p-12+R(n)*(g+24);for(let n=p;n<p+g;n+=2){const r=.42*Bt(n-e,9);r>.05&&(t.fillStyle=x(d,r),t.fillRect(n,m,2,b))}}}const v=r.querySelector("[data-dot]");if(v&&u.indicator){const n=a(v),r=(y=n.x+n.w/2,Math.round(y/M-.5)*M),o=h?.5-.5*Math.cos(e/1800*Math.PI*2):.6,i="neutral"===l.to?.7:1,s=i*(.4+.4*o);t.fillStyle=x(d,s),t.fillRect(r-M,m,3*M,b),t.fillStyle=x(d,i),t.fillRect(r,m,M,b)}}else if("new"===v){const n=(e-(l.get(r)??-1e6))/900;if(n<1&&!o){S=!0;const e=p-20+R(n)*(g+40),r=Math.sin(Math.PI*Math.min(1,1.15*n));for(let n=p;n<p+g;n+=2){const o=(n-p)/g,i=o<.5?Wt(Ft[0],Ft[1],2*o):Wt(Ft[1],Ft[2],2*o-1),a=r*Bt(n-e,11);a>.2&&(t.fillStyle=Ot(i,.55+.4*a),t.fillRect(n,m,2,b))}}}else{const n=c.get(r),i=d.get(r)?.digits.children,s=n?(e-n.at)/600:1;if(i)if(s>=1||o)for(const t of i)t.style.opacity="",t.style.translate="";else S=!0,[...i].forEach((r,o)=>{if(!n.changed[o])return;const i=r,s=a(i),l=(e-n.at-70*o)/460,c=R((l-.72)/.28);i.style.opacity=String(c),i.style.translate=`0 ${3*(c-1)}px`,l<=0||l>=1||(t.fillStyle=x(f.neutral,(.3+2.6*l%1*.7)*Math.min(1,(1-l)/.3)),t.fillRect(s.x,m,s.w,b))})}var y;t.restore()}}),S}}):null;const y=t=>[...t].map(t=>Object.assign(document.createElement("span"),{textContent:" "===t?"":t}));if(m){o||(m.canvas.style.zIndex="1");for(const t of r){const e=h(t);if("count"===e){const e=(t.textContent??"").trim(),n=[...t.childNodes],r=D(e),o=document.createElement("span");o.setAttribute("aria-hidden","true"),a.set(o,"display","inline-flex"),o.replaceChildren(...y(e)),t.replaceChildren(r,o),d.set(t,{text:e,live:r,digits:o}),u.push(()=>{const r=d.get(t)?.text??e;r===e?t.replaceChildren(...n):t.textContent=r})}else if("status"===e&&n.current.indicator&&!t.querySelector("[data-dot]")){const e=document.createElement("span");e.dataset.dot="",e.setAttribute("aria-hidden","true"),e.setAttribute("style","display:inline-block;flex:none;width:15px;height:8px;margin-inline-end:4px;vertical-align:middle"),t.prepend(e),u.push(()=>e.remove())}if(!o)for(const e of[...t.childNodes])if(3===e.nodeType&&e.textContent?.trim()){const t=document.createElement("span");e.parentElement.insertBefore(t,e),t.appendChild(e),u.push(()=>{t.parentElement?.insertBefore(e,t),t.remove()}),b(t)}else e instanceof HTMLElement&&void 0===e.dataset.dot&&b(e)}d.size&&document.fonts?.ready.then(()=>m?.kick()),i.addEventListener("pointermove",w),i.addEventListener("pointerleave",k)}function b(t){"static"===getComputedStyle(t).position&&a.set(t,"position","relative"),a.set(t,"z-index","2")}function M(t){const e=performance.now();for(const n of t?[t]:r.filter(t=>"new"===h(t)))l.set(n,e);m?.kick()}let x=null;function w(t){const e=t.target,o=r.find(t=>e&&t.contains(e))??null;o!==x&&(x=o,o&&"new"===h(o)&&n.current.sheen&&M(o))}function k(){x=null}return J(()=>m,n,()=>{p(performance.now()),m?.refresh()},{sheen:M,count:(t,e)=>{const n=e??r.find(t=>"count"===h(t));if(!n)return;const o=String(t),i=d.get(n);if(!i)return void(n.textContent=o);if(o===i.text)return;const a=Math.max(o.length,i.text.length),s=i.text.padStart(a," "),l=o.padStart(a," "),u=m?.still()??!0;i.text=o,i.live.textContent=o,i.digits.replaceChildren(...y(l)),c.set(n,{at:u?-1e6:performance.now(),changed:[...l].map((t,e)=>t!==s[e])}),m?.kick()},refresh:()=>{p(performance.now()),m?.kick()}},()=>{i?.removeEventListener("pointermove",w),i?.removeEventListener("pointerleave",k),v()})},exports.pricingGlow=function(t,e={}){const n={current:{...ie,...e}},r=(e=n.current.saving)=>ae(t,e,(()=>{const e=n.current.price;return"string"==typeof e?t.querySelector(e):e??t.querySelector("[data-price]")})(),n.current.font);let o=null,i=0,a=0,s=0,l=null;l=Ut({host:t,look:()=>({mark:"dot",scene:"drift",scale:"number"==typeof innerWidth&&innerWidth<760?1.7:1,cellSize:4,cellAspect:1,dotScale:.92,color:"ink",shade:0,fit:"cover",focus:{x:.5,y:.5},levels:"none",contrast:1.1,brightness:-.04,drift:.5,hover:"lantern",lantern:{radius:.26,strength:.4,trail:.7,follow:8},trail:{strength:.9,radius:.4},fluid:{radius:.09,refraction:.03,glow:.6},...n.current.look}),ink:t=>n.current.ink??(t?"#aeaca5":"#5c5a55"),source:o=r(),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{l=null,c?.disconnect()}}),a=t.offsetWidth,s=t.offsetHeight;const c=l&&"function"==typeof ResizeObserver?new ResizeObserver(()=>{!l||Math.abs(t.offsetWidth-a)<2&&Math.abs(t.offsetHeight-s)<2||(a=t.offsetWidth,s=t.offsetHeight,i++,l.field.setSource(o=r()))}):null;c?.observe(t);const d=async t=>{const e=l?.field,n=o;if(o=t,!e)return;const r=++i;if(!n||l.still())return void await e.setSource(t);const a=Xt(t.width,t.height),s=a.pen,c=t.width,d=t.height,u=.34*c;for(let o=1;o<=9&&r===i;o++){const r=performance.now(),i=o/9*(c+2*u)-u,l=Math.max(0,Math.min(c,i));s.globalCompositeOperation="source-over",s.drawImage(n,0,0,c,d),l>0&&s.drawImage(t,0,0,l,d,0,0,l,d);const h=s.createLinearGradient(i-u,0,i+.4*u,0);h.addColorStop(0,"rgb(0 0 0 / 0)"),h.addColorStop(.72,"rgb(255 255 255 / .5)"),h.addColorStop(1,"rgb(0 0 0 / 0)"),s.globalCompositeOperation="lighter",s.fillStyle=h,s.fillRect(0,0,c,d),await e.setSource(a.canvas),await jt(Math.max(0,48-(performance.now()-r)))}r===i&&l?.field===e&&await e.setSource(t)};return Vt(()=>l,n,()=>{d(r())},{sweep:()=>d(r()),saving:t=>(n.current={...n.current,saving:t},d(r(t))),pulse:(t,e=1.6)=>{l&&!l.still()&&Yt(l.field,t,e)}},()=>{i++,c?.disconnect()})},exports.pullRefresh=function(t,e){const n={current:{...xn,...e}},r=H(),o=()=>n.current.content??t.children[0]??null,i=D("",!0),a={x:0,v:0,to:0};let s="idle",l=!1,c=!1,d=0,u=-1,h=0,p=0,f=0,m=!0,g=null,v=[];const y=new WeakSet,b=t=>{i.textContent=t};g=Y({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.94,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{g=null},paint:({pen:t,w:e,now:i,still:c,scale:d,box:u})=>{const y=f?Math.min(1/30,(i-f)/1e3):1/60;f=i;let b=l;c?(a.x=a.to,a.v=0):l||(b=function(t,e,n=300,r=.86,o=.2){const i=2*Math.sqrt(n)*r,a=Math.max(1,Math.ceil(240*e)),s=e/a;for(let e=0;e<a;e++)t.v+=(-n*(t.x-t.to)-i*t.v)*s,t.x+=t.v*s;return!(Math.abs(t.x-t.to)<o&&Math.abs(t.v)<12*o&&(t.x=t.to,t.v=0,1))}(a,y)||b),"refreshing"===s&&(h+=7.5*y,b=!0),"done"===s&&i-p<320&&(b=!0);const M=o();M&&r.set(M,"translate",`0 ${Math.max(0,a.x).toFixed(2)}px`),t.setTransform(d,0,0,d,0,0);const w=Math.max(0,a.x),k=e/2,S=w/2,A=L(w/n.current.threshold);if(w>.5){if(t.save(),t.beginPath(),t.rect(0,0,e,w),t.clip(),"idle"===s||"pulling"===s){const e=10+32*A,n=t.createRadialGradient(k,S,0,k,S,e);n.addColorStop(0,`rgba(255,255,255,${.25+.75*A*A})`),n.addColorStop(.55,`rgba(255,255,255,${.12+.5*A*A})`),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(k-e,S-e,2*e,2*e),A>=1&&(t.strokeStyle="rgba(255,255,255,.9)",t.lineWidth=8,t.beginPath(),t.arc(k,S,28,0,2*Math.PI),t.stroke())}else{const e="done"===s&&m?c?1:R((i-p)/300):0;t.lineWidth=9,t.lineCap="round";for(let n=0;n<18;n++){const r=h+n/18*Math.PI*1.5;t.strokeStyle=`rgba(255,255,255,${(.15+n/17*.85)*(1-e)*("done"!==s||m?1:.4)})`,t.beginPath(),t.arc(k,S,28,r,r+1.5*Math.PI/18+.02),t.stroke()}e>0&&function(t,e,n,r,o){if(o<=0)return;const i=[[-.82,.02],[-.26,.56],[.86,-.6]].map(([t,o])=>[e+t*r,n+o*r]),a=Math.hypot(i[1][0]-i[0][0],i[1][1]-i[0][1])+Math.hypot(i[2][0]-i[1][0],i[2][1]-i[1][1]);t.save(),t.strokeStyle="#fff",t.lineWidth=.44*r,t.lineCap="round",t.lineJoin="round",t.setLineDash([a*o,a]),t.beginPath(),t.moveTo(i[0][0],i[0][1]),t.lineTo(i[1][0],i[1][1]),t.lineTo(i[2][0],i[2][1]),t.stroke(),t.restore()}(t,k,S,26,e)}t.restore()}return v=v.filter(e=>{if(!e.row.isConnected)return x(e,!0),!1;const n=c?1:(i-e.start)/760;if(n<0||!Number.isFinite(n))return b=b||Number.isFinite(n),!0;if(n>=wn&&x(e),n>=1)return x(e,!0),!1;const r=u(e.row);(!e.snap||Math.abs(e.snap.width/2-r.w)>.5||Math.abs(e.snap.height/2-r.h)>.5)&&(e.snap=Ze(e.row,r.w,r.h,t=>{const e=u(t);return{x:e.x-r.x,y:e.y-r.y,w:e.w,h:e.h}}).canvas,e.photos=[...e.row.querySelectorAll("img")]);const o=e.snap;return e.photos.length&&function(t,e,n){const r=e.getContext("2d"),o=n(t.row);t.photos=t.photos.filter(t=>{if(!t.complete)return!0;if(!r||!t.naturalWidth)return!1;const e=n(t),i=e.x-o.x,a=e.y-o.y,s=Math.min(parseFloat(getComputedStyle(t).borderTopLeftRadius)||0,e.w/2,e.h/2);return r.save(),r.setTransform(2,0,0,2,0,0),r.beginPath(),r.roundRect(i,a,e.w,e.h,s),r.clip(),r.fillStyle="#000",r.fillRect(i,a,e.w,e.h),Ye(r,Je({image:t,width:t.naturalWidth,height:t.naturalHeight},!g?.dark()),i,a,e.w,e.h),r.restore(),!1})}(e,o,u),t.globalAlpha=n<wn?R(n/wn,3):1-R((n-wn)/.7,3),t.drawImage(o,r.x,r.y,r.w,r.h),t.globalAlpha=1,b=!0,!0}),b||(f=0),b}});const M=()=>g?.kick();function x(t,e=!1){const n=t.row.style;t.shown||(t.shown=!0,n.transition="opacity 280ms cubic-bezier(.16, 1, .3, 1)",n.opacity=t.opacity),e&&(n.transition=t.transition)}const w=(t,e)=>{if(g&&!g.still()){for(const n of t)n instanceof HTMLElement&&!y.has(n)&&(y.add(n),v.push({row:n,snap:null,start:e,opacity:n.style.opacity,transition:n.style.transition,shown:!1,photos:[...n.querySelectorAll("img")]}),n.style.transition="none",n.style.opacity="0");M()}},k=()=>{const t=performance.now();v.forEach(e=>{e.start===1/0&&(e.start=t)}),M()},S=t=>new Promise(e=>setTimeout(e,t)),A=async()=>{if("refreshing"===s||"done"===s)return;const e=n.current,r=!g||g.still();s="refreshing",l=c=!1,a.to=e.threshold,p=performance.now(),t.setAttribute("aria-busy","true"),b(e.messages?.refreshing??"Refreshing."),M(),m=!0;try{await Promise.all([e.onRefresh(),S(r?0:600)])}catch{m=!1}if("refreshing"===s){if(m&&e.reveal&&!r){await new Promise(t=>"function"==typeof requestAnimationFrame?requestAnimationFrame(()=>t()):t());const t=o();t&&w(t.querySelectorAll(e.reveal),1/0)}s="done",p=performance.now(),b(m?e.messages?.done??"Updated.":e.messages?.failed??"Couldn’t refresh."),M(),await S(r?0:620),"done"===s?(s="idle",a.to=0,k(),t.removeAttribute("aria-busy"),M()):k()}},C=e=>{0!==e.button||"idle"!==s||t.scrollTop>0||(l=!0,c=!1,d=e.clientY,u=e.pointerId)},E=e=>{if(!l||e.pointerId!==u)return;e.clientY<d&&(d=e.clientY);const n=(e.clientY-d)/(t.getBoundingClientRect().height/(t.clientHeight||1)||1);if(!c){if(n<6)return;c=!0,s="pulling";try{t.setPointerCapture?.(e.pointerId)}catch{}}a.x=a.to=(t=>128*(1-Math.exp(-Math.max(0,t)/128)))(n-6),a.v=0,M()},$=()=>{if(l&&(l=!1,c)){if(c=!1,a.x>=n.current.threshold)return s="idle",void A();s="idle",a.to=0,M()}},z=t=>{c&&t.preventDefault()},I=t=>{l&&t.preventDefault()};return g?(r.set(t,"overscroll-behavior-y","contain"),t.appendChild(i),t.addEventListener("pointerdown",C),t.addEventListener("pointermove",E),t.addEventListener("pointerup",$),t.addEventListener("pointercancel",$),t.addEventListener("touchmove",z,{passive:!1}),t.addEventListener("dragstart",I),t.addEventListener("selectstart",I)):t.appendChild(i),J(()=>g,n,()=>g?.refresh(),{refresh:A,revealRows:t=>w(t,performance.now()),get state(){return s}},()=>{s="idle",v.forEach(t=>{t.row.style.opacity=t.opacity,t.row.style.transition=t.transition}),v=[],t.removeEventListener("pointerdown",C),t.removeEventListener("pointermove",E),t.removeEventListener("pointerup",$),t.removeEventListener("pointercancel",$),t.removeEventListener("touchmove",z),t.removeEventListener("dragstart",I),t.removeEventListener("selectstart",I),t.removeAttribute("aria-busy"),i.remove(),r.restore()})},exports.pulse=Lr,exports.rain=zr,exports.resolveColor=W,exports.setFieldBudget=function(t){i=Number.isFinite(t)&&t>=1?Math.floor(t):12,M()},exports.setGlobalLook=function(t){n=t?{...t}:null;for(const t of o)t.relook();for(const t of[...r])t(n)},exports.silk=Rr,exports.skeleton=function(t,e={}){const n={current:{...Lt,...e}},r=H();let o=0,i=null,a=null,s=null,l=null;const c=()=>[...t.querySelectorAll(n.current.blocks)].map((t,e)=>({el:t,kind:Rt(t),delay:void 0!==t.dataset.delay?Number(t.dataset.delay):80+e*n.current.stagger})),d=()=>{r.restore(),t.removeAttribute("aria-busy"),a?.(),a=null};l=Y({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",cellSize:5,cellAspect:.62,glyphScale:.92,font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,contrast:1.15,shade:.35,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{l=null,d()},paint:({pen:t,now:e,still:a,box:s,w:l})=>{if(null!==i&&a)return d(),!1;const u=n.current,h=null===i?-1:e-i;if(null!==i&&h>Math.max(n.current.develop,...c().map(t=>t.delay+n.current.resolve))+16)return d(),!1;null!==i&&(t=>{for(const{el:e,kind:o,delay:i}of c()){const a=Math.min(1,Math.max(0,(t-i)/n.current.resolve));r.set(e,"opacity",a>0?"text"===o?"1":String(a):"0"),"text"===o&&r.set(e,"clip-path",`inset(-2px ${100*(1-a)}% -2px 0)`)}})(h);const p=(a?.3:(e-o)/u.shimmer%1)*l*1.7-.35*l,f=a?1:.4+.6*Math.min(1,(e-o)/160),m=t.createLinearGradient(p-90,0,p+90,60);m.addColorStop(0,zt(.3)),m.addColorStop(.5,zt(.82)),m.addColorStop(1,zt(.3));const g=(e,n,r,o,i)=>{t.beginPath(),t.roundRect(e,n,Math.max(0,r),o,Math.min(i,o/2,Math.max(0,r)/2))};for(const{el:e,kind:n,delay:r}of c()){const{x:o,y:i,w:a,h:l}=s(e),c=h<0?0:Math.min(1,Math.max(0,(h-r)/u.resolve));if(t.fillStyle=m,"photo"===n){const n=h<0?0:R(h/u.develop,4);t.globalAlpha=(1-c)*f,g(o,i,a,l,10),t.fill();const r=e instanceof HTMLImageElement?e:e.querySelector("img");if(n>0&&r?.complete&&r.naturalWidth){const e=Math.max(a/r.naturalWidth,l/r.naturalHeight),s=r.naturalWidth*e,d=r.naturalHeight*e;t.save(),g(o,i,a,l,10),t.clip(),t.globalAlpha=n*(1-c),t.drawImage(r,o+(a-s)/2,i+(l-d)/2,s,d),t.restore()}}else if("avatar"===n)t.globalAlpha=(1-c)*f,t.beginPath(),t.arc(o+a/2,i+l/2,Math.min(a,l)/2,0,2*Math.PI),t.fill();else{const e=Math.min(.62*l,12),n=i+(l-e)/2,r=o+a*c;t.globalAlpha=f,g(r,n,o+a-r,e,e/2),t.fill(),t.globalAlpha=1,c>0&&c<1&&(t.fillStyle="#fff",t.fillRect(r-2,n-1,6,e+2))}t.globalAlpha=1}return!0}});const u=()=>{const e=null!==i;if(o=performance.now(),i=null,t.setAttribute("aria-busy","true"),l){if(e&&!l.still())for(const{el:t}of c())t.animate?.([{opacity:1},{opacity:0}],{duration:200,easing:"cubic-bezier(.16, 1, .3, 1)"});(()=>{for(const{el:t}of c())r.set(t,"opacity","0"),t.style.removeProperty("clip-path")})(),l.kick()}};return u(),J(()=>l,n,()=>l?.refresh(),{resolve:()=>l?(null!==i&&s||(i=performance.now(),s=new Promise(t=>{a=t}),l.kick()),s):(t.removeAttribute("aria-busy"),Promise.resolve()),reset(){a?.(),a=null,s=null,u()},get loading(){return null===i}},()=>{d()})},exports.slideToConfirm=function(t,e={}){const n={current:{...xe,...e}},r=H(),o=t.querySelector(n.current.thumb)??t.firstElementChild,i=()=>t.querySelector(n.current.label),a=()=>!!(n.current.reducedMotion??T());let s=Ae(0,520,.8),l=Ae(0,150,1),c=!1,d=0,u=!1,h=0,p=0,f=[],m=0,g=0,v=0,y="",b=-1,M=null;const x=()=>{if(!o)return null;const e=Math.max(0,(t.clientHeight-o.offsetHeight)/2);return{pad:e,size:o.offsetHeight,max:Math.max(1,t.clientWidth-o.offsetWidth-2*e)}},w=()=>t.getBoundingClientRect().width/(t.clientWidth||1)||1,k=e=>W(n.current.ink??"--ascii-ink-strong",t,e?"#d8d6cf":"#1d1d1b");M=Y({host:t,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.94,...n.current.look}),ink:k,kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{M=null},onTheme:()=>{y=""},paint:({pen:e,w:r,h:o,now:i,still:a,dark:c,box:d})=>{const f=x();if(!f)return!1;const m=u?a?1:L((i-h)/we):0,g=Se(L(m/.5)),v=Se(L((m-.36)/.3)),b=Se(L((m-.46)/.4)),w=L((m-.5)/.5),S=1+.07*Math.sin(Math.PI*w)*(1-w),A=p?1-L((i-p)/260):1,C=n.current.mark?d(n.current.mark):{x:r/2-18,y:o/2-18,w:36,h:36},E=C.x+C.w/2,$=C.y+C.h/2,z=Math.min(C.w/2,o/2-2)*S,R=u?G(k(c),(e=>W(n.current.color??"--ascii-success",t,e?"#3ccf7e":"#17844a"))(c),Se(L(a?1:(i-h)/360))):k(c);R!==y&&(y=R,M?.field.update({ink:R})),e.save(),e.globalAlpha=A,e.beginPath(),r>4&&o>4&&e.roundRect(2,2,r-4,o-4,(o-4)/2),e.clip(),e.fillStyle=`rgba(255,255,255,${.1*(1-g)})`,e.fillRect(0,0,r,o);const I=f.pad+s.x+f.size/2,P=u?1:l.x,T=ke(0,E-z,g),F=ke(I,E+z,g),B=ke(0,$-z,g),O=ke(o,$+z,g);if(F-T>1&&P>.004){const t=e.createLinearGradient(T,0,F,0);t.addColorStop(0,`rgba(255,255,255,${ke(.14,1,g)*P})`),t.addColorStop(.62,`rgba(255,255,255,${ke(.48,1,g)*P})`),t.addColorStop(1,`rgba(255,255,255,${P})`),e.fillStyle=t,e.globalAlpha=A*(1-.28*v),e.beginPath(),e.roundRect(T,B,F-T,O-B,ke(0,z,g)),e.fill()}return v>0&&(e.globalAlpha=1,e.fillStyle="#000",e.beginPath(),e.arc(E,$,Math.max(0,z-5)*v,0,2*Math.PI),e.fill()),e.restore(),b>0&&function(t,e,n,r,o,i,a){if(o<=0||i<=0)return;const s=[[-.82,.02],[-.26,.56],[.86,-.6]].map(([t,o])=>[e+t*r,n+o*r]),l=Math.hypot(s[1][0]-s[0][0],s[1][1]-s[0][1])+Math.hypot(s[2][0]-s[1][0],s[2][1]-s[1][1]);t.save(),t.globalAlpha=i,t.strokeStyle="#fff",t.lineWidth=a,t.lineCap="round",t.lineJoin="round",t.setLineDash([l*o,l]),t.beginPath(),t.moveTo(s[0][0],s[0][1]),t.lineTo(s[1][0],s[1][1]),t.lineTo(s[2][0],s[2][1]),t.stroke(),t.restore()}(e,E+.02*z,$+.07*z,.55*z,b,A,4.5),!1}});const S=()=>{const t=x();if(!t||!o)return;const e=s.x/t.max;r.set(o,"translate",`${s.x}px 0`),o.setAttribute("aria-valuenow",String(Math.round(100*L(e))));const n=i();n&&r.set(n,"opacity",String(u?0:1-L(1.7*e)))},A=e=>{m=0;const n=Math.min(1/30,Math.max(0,(e-g)/1e3));g=e;let i=!c&&Ce(s,n,.3);i=Ce(l,n,.003)||i,p&&(e-p>=260||a())&&(p=0,u=!1,s=Ae(0,520,.8),l=Ae(0,150,1),t.dataset.state="idle",delete t.dataset.confirmed,o&&(r.set(o,"opacity","1"),r.set(o,"scale","1"),o.tabIndex=0)),u&&e-h>302.4&&(t.dataset.confirmed=""),S(),M?.kick(),(i||c||u&&e-h<760||p>0)&&(m=requestAnimationFrame(A))},C=()=>{m||(g=performance.now(),m=requestAnimationFrame(A))},E=()=>{const e=x();if(!e||u)return;const i=e.max-s.x;c=!1,u=!0,s.to=e.max,l.to=1,h=performance.now()+(i>4?200:90),a()&&(Ee(s),Ee(l),h=-1e6,t.dataset.confirmed=""),t.dataset.state="confirmed",o&&(o.setAttribute("aria-valuetext","Confirmed"),o.tabIndex=-1,r.set(o,"transition","opacity 200ms 160ms, scale 240ms 160ms"),r.set(o,"opacity","0"),r.set(o,"scale",".6")),v&&clearTimeout(v),n.current.resetAfter>0&&(v=setTimeout($,n.current.resetAfter)),S(),C(),n.current.onConfirm?.()};function $(){if(v&&clearTimeout(v),v=0,!u)return s.to=0,l.to=0,void C();p=performance.now(),t.dataset.state="resetting",o?.removeAttribute("aria-valuetext"),C()}const z=e=>{const r=x();if(!c||!r||void 0!==e&&void 0!==e.pointerId&&e.pointerId!==b)return;c=!1;const o=$e(f,performance.now());s.x>=r.max*n.current.threshold||o>900&&s.x>.5*r.max?E():(s.to=0,s.v=.25*L(o,-1500,1500),l.to=0,a()&&(Ee(s),Ee(l)),t.dataset.state="idle",C())},R=e=>{if(0===e.button&&!u&&o)if(o.contains(e.target)){try{o.setPointerCapture?.(e.pointerId)}catch{}b=e.pointerId,c=!0,d=e.clientX-s.x*w(),l.to=1,f=[],t.dataset.state="dragging",C()}else c||a()||(s.v+=420,l.to=0,C())},I=t=>{const e=x();c&&e&&t.pointerId===b&&(s.x=s.to=L((t.clientX-d)/w(),0,e.max),s.v=0,f.push([s.x,performance.now()]),f.length>8&&f.shift(),s.x>=e.max-.5?E():C())},P=t=>{const e=x();if(!e||u)return;if("Enter"===t.key||" "===t.key||"End"===t.key)return t.preventDefault(),void E();const n={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1}[t.key],r="Home"===t.key?0:void 0!==n?L(s.to+n*e.max/4,0,e.max):null;null!==r&&(t.preventDefault(),s.to=r,l.to=r>0?1:0,a()&&(Ee(s),Ee(l)),r>=e.max-.5?E():C())};o&&(o.hasAttribute("role")||o.setAttribute("role","slider"),o.hasAttribute("tabindex")||(o.tabIndex=0),o.hasAttribute("aria-label")||o.setAttribute("aria-label",i()?.textContent?.trim()||"Slide to confirm"),o.setAttribute("aria-valuemin","0"),o.setAttribute("aria-valuemax","100"),o.setAttribute("aria-valuenow","0"),r.set(o,"touch-action","none"),o.addEventListener("keydown",P));const F=t=>t.preventDefault();return t.dataset.state="idle",t.addEventListener("pointerdown",R),t.addEventListener("pointermove",I),t.addEventListener("pointerup",z),t.addEventListener("pointercancel",z),t.addEventListener("lostpointercapture",z),t.addEventListener("dragstart",F),J(()=>M,n,()=>M?.refresh(),{confirm:E,reset:$,get confirmed(){return u}},()=>{m&&cancelAnimationFrame(m),v&&clearTimeout(v),m=v=0,o?.removeEventListener("keydown",P),t.removeEventListener("pointerdown",R),t.removeEventListener("pointermove",I),t.removeEventListener("pointerup",z),t.removeEventListener("pointercancel",z),t.removeEventListener("lostpointercapture",z),t.removeEventListener("dragstart",F),r.restore(),delete t.dataset.state,delete t.dataset.confirmed})},exports.stars=Ir,exports.statusOrb=function(t,e={}){const n={current:{...mt,...e}};let r="idle",o=0,i=0,a="",s="",l=-1e9,c="",d=null;const u=e=>{if(!n.current.colourByState||"idle"===r||"loading"===r)return(e=>W(n.current.ink??"--ascii-ink-strong",t,e?"#d8d6cf":"#1d1d1b"))(e);const[o,i,a]=gt[r];return W(n.current.colors?.[r]??o,t,e?a:i)};d=Y({host:t,look:()=>({mark:"glyph",fit:"contain",charset:" .:-=+*#%@",cellSize:5,cellAspect:.62,glyphScale:.94,font:'"Geist Mono", ui-monospace, monospace',fontWeight:600,contrast:1.1,shade:.5,...n.current.look}),ink:t=>u(t),kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:()=>[240,240],onFail:()=>{d=null},onTheme:()=>{l=-1e9,c=""},paint:({pen:t,now:e,still:h,dark:p})=>{const f=e-o;$t(t,r,h?380:e,h?800:f,i,n.current.ring);const m=u(p);m!==s&&(a=s||m,s=m,l=e);const g=h?1:wt(Math.min(1,(e-l)/200)),v=g<1?G(a,s,g):s;return v!==c&&(c=v,d?.field.update({ink:v})),"loading"===r||f<800||g<1}});const h=e=>{const n=performance.now();"loading"===r&&"loading"!==e&&(i=St(n)),r=e,o=n,t.dataset.state=e,"error"===e&&d&&!d.still()&&"function"==typeof t.animate&&t.animate({translate:["0","-5px 0","4px 0","-2px 0","0"]},{duration:260,easing:"cubic-bezier(.16, 1, .3, 1)"}),d?.kick()};return J(()=>d,n,()=>d?.refresh(),{idle:()=>h("idle"),loading:()=>h("loading"),success:()=>h("success"),warning:()=>h("warning"),error:()=>h("error"),get state(){return r}},()=>{delete t.dataset.state})},exports.streamText=function(t,e={}){const n={current:{...hn,...e}},r=[...t.childNodes];let o="idle",i="",a=[],s=null,l=0,c=null,d=null,u=null;const h=()=>{const e=getComputedStyle(t),n=parseFloat(e.fontSize)||15,r=parseFloat(e.lineHeight),o=Number.isFinite(r)&&r>0?r:1.5*n;return{size:n,line:o,ch:o/2,cw:Math.max(2,Math.round(.44*n))}};let p=null,f=null;const m=e=>{o!==e&&(o=e,"done"!==e&&"stopped"!==e||(p?.setAttribute("data-collapsed",""),p?.setAttribute("aria-hidden","true")),"streaming"===e?t.setAttribute("aria-busy","true"):t.removeAttribute("aria-busy"),n.current.onState?.(e))},g=t=>t.span.style.removeProperty("color"),v=()=>{a.forEach(g),a=[],"streaming"===o&&c&&m("done"),c?.(),c=null};if(u=Y({host:t,look:()=>{const{ch:t,cw:e}=h();return{mark:"glyph",charset:" :-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:t,cellAspect:e/t,glyphScale:1,shade:.6,...n.current.look}},ink:()=>n.current.ink??getComputedStyle(t).color,kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{u=null,v()},paint:({pen:t,now:e,still:r,box:i})=>{const{line:l,ch:d,cw:u,size:p}=h(),f=Math.floor(e/48),m=l/4,y=(e,n)=>{const r=Math.floor((e.y-m+e.h/2)/l)*l+m+(l-d)/2,o=Math.round(e.x/u),i=Math.round(255*n);t.fillStyle=`rgb(${i} ${i} ${i})`,t.fillRect(o*u,r,Math.max(1,Math.round((e.x+e.w)/u)-o)*u,d)};if(r&&(a.forEach(g),a=[]),a=a.filter(t=>e>=t.at?(g(t),!1):(y(i(t.span),.55+.45*z(f,t.seed)),!0)),!a.length&&c&&v(),n.current.caret&&"idle"!==o&&(s||"streaming"===o)){const t=s?i(s):{x:0,y:m,w:0,h:l},e=Math.round((t.x+t.w+.3*p)/u)*u;y({x:e,y:t.y,w:u,h:t.h},"streaming"===o?1:.7)}return a.length>0}}),u){const e=getComputedStyle(t),n=u.canvas.style,r=t=>parseFloat(t??"")||0,{line:o}=h(),i=r(e.paddingTop)-o/4,a=r(e.paddingRight)-o/2,s=r(e.paddingBottom)-o/4,l=r(e.paddingLeft);n.top=`${i}px`,n.left=`${l}px`,n.width=`calc(100% - ${l+a}px)`,n.height=`calc(100% - ${i+s}px)`}return J(()=>u,n,()=>u?.refresh(),{write:e=>{if(!e)return;"streaming"!==o&&("idle"===o&&(t.replaceChildren(...mn(t)),u&&t.appendChild(u.canvas)),d=null,m("streaming")),i+=e;const r=e=>t.appendChild(e);if(!u)return void r(document.createTextNode(e));const c=performance.now(),h=n.current,p=u.still();let f=0;for(const t of e.match(/\s+|\S/g)??[]){if(/^\s/.test(t)){r(document.createTextNode(t));continue}const e=document.createElement("span");e.textContent=t,p||(e.style.setProperty("color","transparent"),a.push({span:e,at:c+h.settle+f*h.stagger,seed:31*l+f})),r(e),s=e,f++}l++,u.kick()},done:()=>d||("streaming"!==o?Promise.resolve():(d=new Promise(t=>{c=t}),u&&a.length?u.kick():v(),d)),stop(){if("idle"===o&&p)return d=null,m("stopped"),void u?.kick();"streaming"===o&&(a.forEach(g),a=[],m("stopped"),c?.(),c=null,u?.kick())},reasoning:e=>{if(!e||"undefined"==typeof document)return;if(!p||!f){en("ascii-kit-reasoning",fn),p=document.createElement("div"),p.className="ascii-reasoning";const e=document.createElement("div");e.className="ascii-reasoning-in",f=document.createElement("ol"),e.appendChild(f),p.appendChild(e),t.parentElement?.insertBefore(p,t)}p.removeAttribute("data-collapsed"),p.removeAttribute("aria-hidden");const r=Math.max(1,Math.round(n.current.reasoningLines));p.style.setProperty("--ascii-reasoning-lines",String(r));const o=document.createElement("li");o.textContent=e;const i=n.current.reducedMotion??T();i||o.setAttribute("data-new",""),f.appendChild(o);const a=p,s=String(Math.max(0,f.children.length-r));i?a.style.setProperty("--ascii-reasoning-shift",s):(getComputedStyle(o).translate,requestAnimationFrame(()=>{o.removeAttribute("data-new"),a.style.setProperty("--ascii-reasoning-shift",s)}))},reset(){a=[],i="",s=null,l=0,p?.remove(),p=f=null,c?.(),c=null,d=null,t.replaceChildren(...mn(t)),u&&t.appendChild(u.canvas),m("idle"),u?.kick()},get state(){return o},get text(){return i}},()=>{c?.(),c=null,p?.remove(),p=f=null,t.removeAttribute("aria-busy"),i?t.textContent=i:t.replaceChildren(...r)})},exports.subscribeGlobalLook=function(t){return r.add(t),()=>{r.delete(t)}},exports.swipeDeck=function(t,e={}){const n={current:{...Ne,...e}},r=H(),o=()=>!!(n.current.reducedMotion??T()),i=()=>[...t.querySelectorAll(n.current.cards)];let a=0,s=qe(0,380,.72),l=qe(0,380,.8),c=qe(0,260,.9),d=!1,u=0,h=0,p=null,f=[],m=0,g=0,v=-1,y=new Map,b=null,M=null;const x=t=>i()[k(t)]??null,w=()=>t.clientWidth||160,k=t=>{const e=i().length;return e?(t%e+e)%e:0},S=(e,r,o,a)=>{const s=x(e);if(!s||!n.current.loop&&e>=i().length)return null;const l="IMG"===s.tagName?s:s.querySelector("img"),c=`${l?.currentSrc||l?.src||""}|${l?.complete}|${Math.round(r)}x${Math.round(o)}|${a}`,d=y.get(s);if(d?.key===c)return d.canvas;const u=document.createElement("canvas");u.width=Math.max(1,Math.round(r)),u.height=Math.max(1,Math.round(o));const h=u.getContext("2d");if(!h)return null;const p=n.current.radius??(parseFloat(getComputedStyle(t).borderTopLeftRadius)||16);h.beginPath(),h.roundRect(0,0,u.width,u.height,Math.min(p,u.width/2,u.height/2)),h.clip();const f=l?function(t,e,n=.04){if(!t.complete||!t.naturalWidth)return null;const r=Math.min(1,420/Math.max(t.naturalWidth,t.naturalHeight)),o=document.createElement("canvas");o.width=Math.max(1,Math.round(t.naturalWidth*r)),o.height=Math.max(1,Math.round(t.naturalHeight*r));const i=o.getContext("2d",{willReadFrequently:!0});if(!i)return null;try{i.drawImage(t,0,0,o.width,o.height);const r=i.getImageData(0,0,o.width,o.height),a=r.data,s=new Uint32Array(256),l=a.length/4,c=t=>.2126*a[t]+.7152*a[t+1]+.0722*a[t+2];for(let t=0;t<a.length;t+=4)s[Math.round(c(t))]++;let d=0,u=255,h=0;for(let t=0;t<256;t++)if(h+=s[t],h>=.02*l){d=t;break}h=0;for(let t=255;t>=0;t--)if(h+=s[t],h>=.02*l){u=t;break}const p=Math.max(1,u-d);for(let t=0;t<a.length;t+=4){let r=L((c(t)-d)/p);e&&(r=1-r),a[t]=a[t+1]=a[t+2]=Math.round(255*(n+(1-n)*r)),a[t+3]=255}return i.putImageData(r,0,0),o}catch{return null}}(l,a):null;if(f){const t=Math.max(u.width/f.width,u.height/f.height),e=u.width/t,n=u.height/t;h.drawImage(f,(f.width-e)/2,(f.height-n)/2,e,n,0,0,u.width,u.height)}else h.fillStyle="rgb(60 60 60)",h.fillRect(0,0,u.width,u.height);return h.strokeStyle="rgb(150 150 150)",h.lineWidth=6,h.stroke(),y.set(s,{key:c,canvas:u}),u};function A(){const e=i(),o=a+(p?1:0),s=!n.current.loop&&o>=e.length?null:x(o);e.forEach(t=>{M?(r.set(t,"opacity","0"),t!==s?t.setAttribute("aria-hidden","true"):t.removeAttribute("aria-hidden")):t.hidden=t!==s}),t.setAttribute("aria-label",s?`${s.getAttribute("aria-label")||s.querySelector("img")?.alt||s.textContent?.trim()||"Card"}. Left arrow to pass, right arrow to keep.`:"No more cards")}M=Y({host:t,outset:n.current.outset,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.94,contrast:1.3,...n.current.look}),ink:t=>n.current.ink??(t?"#d8d6cf":"#1d1d1b"),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{M=null,r.restore(),A()},onTheme:()=>{y=new Map},paint:({pen:e,w:n,now:r,dark:o,box:i})=>{const d=i(t),u=d.w,h=d.h,f=d.x+u/2,m=d.y+h/2,g=L(c.x),v=(t,n,r,i,a=0)=>{const s=S(t,u,h,!o);!s||i<=0||(e.save(),e.translate(f,m+r),e.scale(n,n),e.globalAlpha=i,e.drawImage(s,-u/2,-h/2),a>0&&(e.globalCompositeOperation="destination-out",e.globalAlpha=a,e.drawImage(((t,e)=>{let n=b;if(!n||n.width!==Math.round(t)||n.height!==Math.round(e)){n=b=document.createElement("canvas"),n.width=Math.max(1,Math.round(t)),n.height=Math.max(1,Math.round(e));const r=n.getContext("2d");if(r)for(let t=0;t<n.height;t+=6)for(let e=0;e<n.width;e+=4){const n=43758.5453*Math.sin(12.9898*e+78.233*t);n-Math.floor(n)<.55&&(r.fillStyle="#000",r.fillRect(e,t,4,6))}}return n})(u,h),-u/2,-h/2)),e.restore())};v(a+2,Ge(.86,.93,g),Ge(24,12,g),Ge(.3,.55,g),.3),v(a+1,Ge(.93,1,g),Ge(12,0,g),Ge(.55,1,g),.4*(1-g));const y=S(a,u,h,!o);if(!y)return!1;const M=p?L((r-p.start)/620):0,x=p?.dir??1,w=p?p.x0+x*u*.9*(1-(1-M)**3):s.x,k=p?p.y0:l.x;if(e.save(),e.translate(f+w,m+k),e.rotate(.22*L(w/u,-1.6,1.6)),!p)return e.drawImage(y,-u/2,-h/2),e.restore(),!1;const A=Math.ceil(h/6);for(let t=0;t<A;t++){const r=He[t%He.length],o=L(1.55*M-.55*r);if(o>=1)continue;const i=x*o*o*u*(.5+.9*r),a=6*t,s=Math.min(6,h-a),l=x>0?f+w+i+.62*u:f+w+i-.62*u,c=x>0?n-4-l:l-4;e.globalAlpha=(1-o*o)*L(c/56),e.drawImage(y,0,a,u,s,-u/2+i,-h/2+a,u,s)}return e.restore(),!1}});const C=e=>{m=0;const o=Math.min(1/30,Math.max(0,(e-g)/1e3));g=e;let i=!1;d||p||(i=Ce(s,o,.3),i=Ce(l,o,.3)||i),i=Ce(c,o,.002)||i,p&&e-p.start>=620&&(p=null,a+=1,$()),(()=>{(n.current.leanTarget??t).style.setProperty("--ascii-lean",String(p?0:L(s.x/(.4*w()),-1,1)));const e=x(a);!M&&e&&r.set(e,"transform",`translate(${s.x}px, ${l.x}px) rotate(${.22*L(s.x/w(),-1.6,1.6)}rad)`)})(),M?.kick(),(i||d||p)&&(m=requestAnimationFrame(C))},E=()=>{m||(g=performance.now(),m=requestAnimationFrame(C))},$=()=>{s=qe(0,380,.72),l=qe(0,380,.8),c=qe(0,260,.9)},z=(t=1)=>{const e=i();if(p||!e.length||!n.current.loop&&a>=e.length)return!1;const u=x(a),h=k(a);return d=!1,o()||!M?(a+=1,$(),M||r.set(u,"transform","")):(p={dir:t,start:performance.now(),x0:s.x,y0:l.x},c.to=1),A(),E(),n.current.onSwipe?.(t,h,u),!0},R=t=>{if(!d||void 0!==t&&void 0!==t.pointerId&&t.pointerId!==v)return;d=!1;const e=$e(f,performance.now()),r=w();Math.abs(s.x)>r*n.current.threshold||Math.abs(e)>650&&Math.sign(e)===Math.sign(s.x)&&Math.abs(s.x)>16?z(s.x<0?-1:1):(s.to=0,l.to=0,c.to=0,s.v=.2*L(e,-1600,1600),o()&&(s.x=l.x=c.x=0,s.v=l.v=c.v=0),E())},I=()=>t.getBoundingClientRect().width/(t.clientWidth||1)||1,P=e=>{if(0!==e.button||p)return;try{t.setPointerCapture?.(e.pointerId)}catch{}v=e.pointerId;const n=I();d=!0,u=e.clientX-s.x*n,h=e.clientY-l.x/.3*n,f=[],E()},F=t=>{if(!d||t.pointerId!==v)return;const e=I();s.x=s.to=(t.clientX-u)/e,l.x=l.to=(t.clientY-h)/e*.3,s.v=l.v=0,c.to=.5*L(Math.abs(s.x)/w()),f.push([s.x,performance.now()]),f.length>8&&f.shift(),E()},W=t=>{"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||(t.preventDefault(),z("ArrowRight"===t.key?1:-1))},B=()=>M?.kick(),O=t=>t.preventDefault();return t.hasAttribute("tabindex")||(t.tabIndex=0),t.setAttribute("role",t.getAttribute("role")??"group"),t.setAttribute("aria-roledescription","card"),r.set(t,"touch-action","none"),A(),t.addEventListener("pointerdown",P),t.addEventListener("pointermove",F),t.addEventListener("pointerup",R),t.addEventListener("pointercancel",R),t.addEventListener("lostpointercapture",R),t.addEventListener("keydown",W),t.addEventListener("load",B,!0),t.addEventListener("dragstart",O),J(()=>M,n,()=>{y=new Map,A(),M?.refresh()},{next:z,get index(){return k(a+(p?1:0))}},()=>{m&&cancelAnimationFrame(m),m=0,r.restore(),i().forEach(t=>{t.hidden=!1,t.removeAttribute("aria-hidden")}),(n.current.leanTarget??t).style.removeProperty("--ascii-lean"),t.removeAttribute("aria-roledescription"),t.removeEventListener("pointerdown",P),t.removeEventListener("pointermove",F),t.removeEventListener("pointerup",R),t.removeEventListener("pointercancel",R),t.removeEventListener("lostpointercapture",R),t.removeEventListener("keydown",W),t.removeEventListener("load",B,!0),t.removeEventListener("dragstart",O)})},exports.tabs=function(t,e={}){const n={current:{...Gt,...e}},r=()=>[...t.querySelectorAll(n.current.tabs)],o=r().findIndex(t=>"true"===t.getAttribute("aria-selected"));let i=Math.max(0,n.current.active??(o>=0?o:0)),a=i,s=-1e6,l=null;l=Y({host:t,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:.62,glyphScale:.96,...n.current.look}),ink:t=>n.current.ink??(t?"#7a7872":"#76746e"),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{l=null},paint:({pen:t,now:e,still:o,box:l})=>{const c=r(),d=c[a],u=c[i];if(!d||!u)return!1;const h=l(d),p=l(u),f=o?1:(e-s)/n.current.duration;if(f>=1){const e=p.x+1,n=p.y+1.5,r=p.w-2,o=p.h-3;t.save(),t.beginPath(),t.roundRect(e,n,Math.max(0,r),Math.max(0,o),Math.max(0,o/2)),t.clip();for(let i=0;i<r;i+=2){const a=Math.round(255*(.2+.5*Math.max(0,1-Math.min(i,r-i)/22)));t.fillStyle=`rgb(${a} ${a} ${a})`,t.fillRect(e+i,n,2,o)}return t.restore(),!1}const{left:m,right:g,dir:v}=function(t,e,n){const r=Math.sign(e.x-t.x)||1,o=R(n/.8),i=R((n-.22)/.78),a=(r>0?t.x+t.w:t.x)+((r>0?e.x+e.w:e.x)-(r>0?t.x+t.w:t.x))*o,s=(r>0?t.x:t.x+t.w)+((r>0?e.x:e.x+e.w)-(r>0?t.x:t.x+t.w))*i;return{left:Math.min(a,s),right:Math.max(a,s),dir:r}}(h,p,f),y=Math.max(1,g-m),b=h.y,M=h.h,x=3.72,w=Math.floor(e/40);t.save(),t.beginPath(),t.roundRect(m,b+1.5,y,Math.max(0,M-3),Math.max(0,(M-3)/2)),t.clip();for(let e=m;e<g;e+=x){const n=v>0?(e-m)/y:(g-e)/y,r=Math.min(1,1.4*f),o=.25+.75*(r+(1-r)*n**1.6);for(let i=0;i<M;i+=6){if(z(Math.round(e/x),i+w)>=o)continue;const a=i<5||i>M-8,s=Math.round((a?150:70+110*(1-r)*n)*(.6+.4*o));t.fillStyle=`rgb(${s} ${s} ${s})`,t.fillRect(e,b+i,x,6)}}return t.restore(),!0}});const c=()=>{const t=n.current;r().forEach((e,n)=>{const r=n===i;t.manage&&(e.setAttribute("aria-selected",String(r)),e.tabIndex=r?0:-1);const o=e.getAttribute("aria-controls")?document.getElementById(e.getAttribute("aria-controls")):null;o&&"none"!==t.panels&&("hidden"===t.panels?o.hidden=!r:o.toggleAttribute("data-active",r))})},d=(t,e=!1)=>{const o=r();if(!o.length)return;const d=(t%o.length+o.length)%o.length;e&&o[d].focus(),d!==i&&(a=i,i=d,s=performance.now(),c(),l?.kick(),n.current.onChange?.(d,o[d]))},u=t=>{if(!n.current.manage)return;const e=t.target.closest?.(n.current.tabs),o=e?r().indexOf(e):-1;o>=0&&d(o)},h=t=>{if(!n.current.manage)return;const e={ArrowRight:i+1,ArrowLeft:i-1,Home:0,End:r().length-1};t.key in e&&(t.preventDefault(),d(e[t.key],!0))};return t.addEventListener("click",u),t.addEventListener("keydown",h),c(),J(()=>l,n,t=>{void 0!==t.active&&t.active!==i&&d(t.active),c(),l?.refresh()},{select:d,get active(){return i}},()=>{t.removeEventListener("click",u),t.removeEventListener("keydown",h)})},exports.terrain=Pr,exports.thinking=function(t,e={}){const n={current:{...cn,...e}},r=H(),o=[...t.childNodes];let i="done",a=0,s=0,l=-1e9,c=-1e9,d=0,u="",h=null;const p=document.createElement("canvas"),f=()=>{const e=getComputedStyle(t),n=parseFloat(e.lineHeight);return Number.isFinite(n)&&n>0?n:1.45*(parseFloat(e.fontSize)||15)},m=t=>{n.current.label&&(n.current.label.textContent=t)};h=Y({host:t,layer:"under",look:()=>({mark:"dot",cellSize:5,cellAspect:1,dotScale:.86,contrast:1.2,...n.current.look}),ink:t=>n.current.ink??`var(--ascii-ink, ${t?"#7a7872":"#76746e"})`,kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{h=null},paint:({pen:t,w:e,h:r,now:o,still:a})=>{const d=n.current,u=f(),h="thinking"===i?1:a?0:1-R((o-l)/dn),m="done"===i&&d.rule?a?.7:.7*R((o-c-280)/dn):0,g=a?0:(o-s)/1e3;if(h>0){const n=Math.max(2,Math.round(e/12)),o=Math.max(2,Math.round(r/7));p.width===n&&p.height===o||(p.width=n,p.height=o),ct(p,1.7+.8*g,.15),t.save(),t.beginPath();for(let n=0;n<d.lines;n++){const r=n===d.lines-1&&d.lines>1?.62:.92-.06*z(n,2);t.rect(0,n*u+.22*u,e*r,.56*u)}t.clip(),t.globalAlpha=h,t.imageSmoothingEnabled=!0,t.globalCompositeOperation="lighter",t.drawImage(p,0,0,e,r),t.drawImage(p,0,0,e,r),t.drawImage(p,0,0,e,r),t.fillStyle="rgb(14 14 14)",t.fillRect(0,0,e,r),t.restore()}if(m>0&&(t.globalAlpha=m,t.fillStyle="#fff",t.fillRect(0,r-5,e,4),t.globalAlpha=1),h>0||m>0){const n=t.createLinearGradient(.6*e,0,.98*e,0);n.addColorStop(0,"#fff"),n.addColorStop(1,"#000"),t.globalCompositeOperation="multiply",t.fillStyle=n,t.fillRect(0,0,e,r),t.globalCompositeOperation="source-over"}return"thinking"===i||!a&&(o-l<dn||"done"===i&&o-c<700)}});const g=document.createElement("span"),v=()=>{d++,i="thinking",s=performance.now(),l=c=-1e9,u="",g.replaceChildren(),t.replaceChildren(g),h&&t.appendChild(h.canvas);const e=getComputedStyle(t),o="border-box"===e.boxSizing?(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0):0;r.set(t,"min-height",`${Math.round(n.current.lines*f()+o)}px`),t.setAttribute("aria-busy","true"),m(n.current.labels?.thinking??"Thinking…"),n.current.onState?.("thinking",0),h?.kick()};let y=0,b=0;return n.current.start&&v(),J(()=>h,n,()=>h?.refresh(),{think:v,stream:async e=>{"thinking"!==i&&v();const o=d;y=0;let p="";const f=()=>{"thinking"===i&&(i="streaming",l=b=performance.now(),r.set(t,"min-height",""),a=Math.max(1,Math.round((l-s)/1e3)),m((n.current.labels?.done??un)(a)),n.current.onState?.("streaming",a),h?.kick())},M=(t,e)=>{p+=t;const o=e?p.length:p.search(/\s\S*$/)+1;o<=0||(f(),u+=p.slice(0,o),(t=>{const e=!!h&&!h.still();for(const o of t.match(/\s+|\S+/g)??[]){if(/^\s/.test(o)){g.append(o);continue}const t=document.createElement("span");if(t.textContent=o,e){r.set(t,"opacity","0");const e=Math.max(0,y*n.current.stagger-(performance.now()-b));r.set(t,"transition",`opacity 260ms cubic-bezier(.16, 1, .3, 1) ${Math.round(e)}ms`),requestAnimationFrame(()=>requestAnimationFrame(()=>t.style.setProperty("opacity","1")))}y++,g.appendChild(t)}})(p.slice(0,o)),p=p.slice(o))};if("string"==typeof e)M(e,!0);else{for await(const t of e){if(o!==d)return;M(t,!1)}if(o!==d)return;M("",!0)}f();const x=!h||h.still()?0:Math.max(0,y*n.current.stagger-(performance.now()-b))+260;await new Promise(t=>setTimeout(t,x)),o===d&&(i="done",c=performance.now(),t.setAttribute("aria-busy","false"),n.current.onState?.("done",a),h?.kick())},get state(){return i}},()=>{d++,r.restore(),t.removeAttribute("aria-busy"),u?t.textContent=u:t.replaceChildren(...o)})},exports.toastStack=function(t,e={}){const n={current:{...nn,...e}},r=H(),o=document.createElement("ol"),i=D("",!1);i.setAttribute("role","status");let a=[],s=[],l=0,c=!1,d=!1,u=!1,h=!1,p=null,f=0;const m=[];en("ascii-kit-toast",an),o.className="ascii-toasts",o.setAttribute("aria-label",n.current.label),t.append(o,i);const g=new WeakSet,v=e=>{const r=W(n.current.ink??"--ascii-ink-strong",t,q(t)?"#d8d6cf":"#1d1d1b");r&&function(t,e){const n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+%?))?/i.exec(t.trim());if(!n)return!1;if(!((void 0===n[4]?1:n[4].endsWith("%")?parseFloat(n[4])/100:parseFloat(n[4]))>=.5))return!1;const r=`#${[n[1],n[2],n[3]].map(t=>Math.round(L(+t,0,255)).toString(16).padStart(2,"0")).join("")}`,[o,i]=[ln(r),ln(e)].sort((t,e)=>e-t);return(o+.05)/(i+.05)<3}(getComputedStyle(e).backgroundColor,r)&&(g.add(e),e.style.setProperty("transition","none","important"),e.style.setProperty("background-color","transparent","important"),e.style.setProperty("box-shadow","none","important"))},y=t=>{delete t.dataset.forming,g.delete(t)&&(t.style.removeProperty("transition"),t.style.removeProperty("background-color"),t.style.removeProperty("box-shadow"))};p=Y({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,...n.current.look}),outset:24,resolution:2,ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{p=null,s=[];for(const t of a)y(t.node)},paint:({pen:t,now:e,scale:r,still:o,box:i})=>{t.setTransform(r,0,0,r,0,0);let l=!1;const c=a[a.length-1];if(n.current.glint&&!o&&c&&void 0===c.node.dataset.forming&&void 0===c.node.dataset.gone){const n=e-c.born-700,r=n>0?n%rn/2400:-1;if(r>=0&&r<1)!function(t,e,n,r){const o=Math.min(n,e.h/2)+4,i=e.w+8,a=e.h+8,s=2*(i+a)-(8-2*Math.PI)*o,l=r*(s+150);t.save(),t.lineCap="round";for(const[n,r]of[[150,.34],[80,.66],[30,1]])t.strokeStyle=sn(r),t.lineWidth=5,t.setLineDash([n,s+n]),t.lineDashOffset=n-l,t.beginPath(),t.roundRect(e.x-4,e.y-4,i,a,Math.max(0,o)),t.stroke();t.restore()}(t,i(c.node),parseFloat(getComputedStyle(c.node).borderTopLeftRadius)||13,(t=>t<.5?4*t**3:1-(-2*t+2)**3/2)(r)),l=!0;else{f&&clearTimeout(f);const t=n>0?rn-n%rn:-n;f=setTimeout(()=>{f=0,p?.kick()},Math.max(16,t))}}return s=s.filter(n=>{const r=(e-n.start)/n.ms;return n.form&&r>=.62&&y(n.node),!(r>=1)&&(n.form?tn(t,n.snap,n.blocks,n.order,1.04*P(r),(t,e)=>[70*(t.seed-.5)*e,(14+26*z(t.x,t.y))*e],1-L((r-.62)/.28)):tn(t,n.snap,n.blocks,n.order,1-1.04*(1-(1-r)**3),(t,e)=>[(14+34*t.seed)*e,14*(z(t.y,t.x)-.35)*e],1-L((r-.75)/.25)),!0)}),s.length>0||l}}),p&&(p.canvas.style.zIndex="11");const b=()=>!!p&&p.live&&!p.still(),M=()=>{a.forEach((t,e)=>{const n=a.length-1-e;r.set(t.node,"--d",String(n)),0===n?(t.node.dataset.front="",delete t.node.dataset.back):(t.node.dataset.back="",delete t.node.dataset.front)})},x=(e,n)=>{if(!p)return;const r=Ze(e,p.canvas.clientWidth||t.clientWidth+48,p.canvas.clientHeight||t.clientHeight+48,p.box),o=function(t){const e=new Set,n=[];for(const r of t)for(let t=6*Math.floor((r.y-2)/6);t<r.y+r.h+2;t+=6)for(let o=4*Math.floor((r.x-2)/4);o<r.x+r.w+2;o+=4){const r=`${o},${t}`;e.has(r)||(e.add(r),n.push({x:o,y:t,seed:z(o,t)}))}return n}(r.rects),i=Math.max(1,...o.map(t=>t.x)),a=Float32Array.from(o,t=>(n?.3:.62)*(t.x/i)+(n?.7:.38)*t.seed);s.push({start:performance.now(),ms:n?340:440,snap:r.canvas,blocks:o,order:a,form:n,node:e}),p.kick()},w=t=>{t.timer&&clearTimeout(t.timer),t.timer=0,c||t.left<=0||(t.since=performance.now(),t.timer=setTimeout(()=>$(t.id),t.left))},k=()=>(t=>{if(t!==c){c=t,t?o.dataset.open="":delete o.dataset.open;for(const e of a)t&&e.timer&&(clearTimeout(e.timer),e.timer=0,e.left=Math.max(400,e.left-(performance.now()-e.since))),t||w(e)}})(d||u),S=()=>{d=!0,k()},A=()=>{d=!1,k()},C=()=>{u=!0,k()},E=t=>{o.contains(t.relatedTarget)||(u=!1,k())};function $(t){const e=a.find(e=>e.id===t);if(!e||void 0!==e.node.dataset.gone)return;e.timer&&clearTimeout(e.timer);const n=()=>{a=a.filter(t=>t!==e),s=s.filter(t=>t.node!==e.node),e.node.remove(),M(),p?.kick(),a.length||(d=u=!1,k())},r=a[a.length-1]===e;b()&&(r||c)?(y(e.node),x(e.node,!1),e.node.dataset.gone="",m.push(setTimeout(n,150))):n()}return o.addEventListener("pointerenter",S),o.addEventListener("pointerleave",A),o.addEventListener("focusin",C),o.addEventListener("focusout",E),J(()=>p,n,t=>{o.setAttribute("aria-label",t.label),p?.refresh()},{push:t=>{if(h)return-1;const e=++l,r=a.filter(t=>void 0===t.node.dataset.gone),s=r.length+1-Math.max(1,n.current.max);s>0&&r.slice(0,s).forEach(t=>$(t.id));const c=n.current.render?n.current.render(t,e):function(t,e){const n=(t,e,n)=>{const r=document.createElement(t);return r.className=e,n&&(r.dataset.paint=n),r},r=n("li","ascii-toast");if(void 0!==t.icon){const e=n("span","ascii-toast-icon","tile");e.setAttribute("aria-hidden","true"),"string"==typeof t.icon?e.textContent=t.icon:e.appendChild(t.icon),r.appendChild(e)}const o=n("span","ascii-toast-text"),i=n("b","ascii-toast-title","strong");if(i.textContent=t.title,o.appendChild(i),t.body){const e=n("span","ascii-toast-body","meta");e.textContent=t.body,o.appendChild(e)}if(r.appendChild(o),t.action){const{label:o,onClick:i}=t.action,a=n("button","ascii-toast-action","text");a.type="button",a.textContent=o,a.addEventListener("click",()=>{i(),e()}),r.appendChild(a)}const a=n("button","ascii-toast-close","none");return a.type="button",a.setAttribute("aria-label",`Dismiss ${t.title}`),a.textContent="×",a.addEventListener("click",e),r.appendChild(a),r}(t,()=>$(e));c.dataset.toast=String(e);const d={id:e,node:c,timer:0,left:t.duration??n.current.duration,since:0,born:performance.now()};return a.push(d),o.appendChild(c),M(),i.textContent=t.body?`${t.title}. ${t.body}`:t.title,b()?(c.dataset.forming="",v(c),x(c,!0)):p?.kick(),w(d),e},dismiss:$,clear(){[...a].forEach(t=>$(t.id))},get toasts(){return a.filter(t=>void 0===t.node.dataset.gone).map(t=>t.id)}},()=>{h=!0,f&&clearTimeout(f);for(const t of a)t.timer&&clearTimeout(t.timer);m.forEach(clearTimeout),o.removeEventListener("pointerenter",S),o.removeEventListener("pointerleave",A),o.removeEventListener("focusin",C),o.removeEventListener("focusout",E),a=[],s=[],o.remove(),i.remove(),r.restore()})},exports.veil=Fr,exports.voiceOrb=function(t,e={}){const n={current:{...le,...e}},r=H();let o="idle",i=0,a=L(n.current.level??0),s=a,l=0,c=0,d=ce(n.current.palette),u=null,h=null,p=0;const f=t=>{t.canvas.style.filter=!t.dark()&&d.length?"brightness(.68) saturate(1.35)":""},m=e=>{t.style.setProperty("--ascii-level",e.toFixed(3)),n.current.swell&&r.set(t,"scale",String(1+.1*e))};u=Y({host:t,outset:Math.round(.08*(t.offsetWidth||0)),look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:.62,glyphScale:.92,fit:"cover",color:d.length?"source":"ink",contrast:2.2,brightness:1.1-.5,saturation:1.4,...n.current.look}),ink:t=>n.current.ink??(t?"#d8d6cf":"#1d1d1b"),kit:n,reducedMotion:()=>n.current.reducedMotion,onTheme:()=>u&&f(u),onFail:()=>{u=null},paint:({pen:t,w:e,h:n,now:r,still:u})=>{const p=c?Math.min(64,r-c):16;c=r;const f=L((t=>"listening"===o?h?h.read():a:"thinking"===o?.2+.1*Math.sin((t-i)/120):"done"===o?l*(1-P(L((t-i)/420))):a)(r));return u||"done"===o?s=f:s+=(f-s)*(1-(1-(f>s?.45:.12))**(p/16.7)),u||m(s),function(t,e,n,r,o,i){const a=t=>{const e=Math.round(255*L(t)/2.2);return`rgb(${e} ${e} ${e})`},s=e/2,l=n/2,c=.36/(.92-.16*o)*Math.min(e,n),d=.86+.46*o,u=r*(.25+.6*o),h=t.createRadialGradient(s,l,.92*c,s,l,1.3*c);h.addColorStop(0,a(.36*d)),h.addColorStop(1,"#000"),t.fillStyle=h,t.fillRect(0,0,e,n),t.save(),t.beginPath(),t.arc(s,l,c,0,2*Math.PI),t.clip();const p=s+.8*Math.cos(u)*c*.62,f=l-.55*c*.62,m=t.createRadialGradient(p,f,0,p,f,1.7*c);m.addColorStop(0,a(.95*d)),m.addColorStop(.55,a(.5*d)),m.addColorStop(1,a(.18)),t.fillStyle=m,t.fillRect(s-c,l-c,2*c,2*c),t.globalCompositeOperation="lighter",t.lineWidth=Math.max(1.5,.05*c);for(let e=0;e<6;e++){const n=e/6*Math.PI+.35*r,o=Math.sin(n);o<0||(t.strokeStyle=a(.16*o),t.beginPath(),t.ellipse(s,l,c*Math.abs(Math.cos(n)),c,0,0,2*Math.PI),t.stroke())}const g=t.createRadialGradient(s,l,.7*c,s,l,c);if(g.addColorStop(0,"#000"),g.addColorStop(1,a(.3)),t.fillStyle=g,t.fillRect(s-c,l-c,2*c,2*c),t.restore(),t.globalCompositeOperation="source-over",!i.length)return;t.globalCompositeOperation="color";const v=.4*r,y=.5*o,b=t.createLinearGradient(s-Math.cos(v)*c,l-Math.sin(v)*c,s+Math.cos(v)*c,l+Math.sin(v)*c);b.addColorStop(0,de(i,y)),b.addColorStop(.5,de(i,y+.25)),b.addColorStop(1,de(i,y+.5)),t.fillStyle=b,t.fillRect(0,0,e,n),t.globalCompositeOperation="source-over"}(t,e,n,u?0:r/1e3,s,d),!0}}),u&&f(u);const g=()=>{p++,h&&(h.stream.getTracks().forEach(t=>t.stop()),h.context.close().catch(()=>{}),h=null)},v=e=>{"listening"!==e&&g(),"done"===e&&(l=s),o=e,i=performance.now(),t.dataset.state=e,u||m("listening"===e?a:0),u?.kick()};return J(()=>u,n,t=>{d=ce(t.palette),void 0!==t.level&&(a=L(t.level)),u?.refresh(),u&&f(u)},{level(t){a=L(Number.isFinite(t)?t:0),u||"listening"!==o||m(a),u?.kick()},listen:()=>v("listening"),think:()=>v("thinking"),done:()=>v("done"),idle:()=>{a=0,v("idle")},async mic(){g();const t=p,e="undefined"!=typeof navigator?navigator.mediaDevices:void 0,n=globalThis.AudioContext;if(!e?.getUserMedia||!n)return!1;let r;try{r=await e.getUserMedia({audio:!0})}catch{return!1}if(t!==p)return r.getTracks().forEach(t=>t.stop()),!1;const o=new n,i=o.createAnalyser();i.fftSize=1024,o.createMediaStreamSource(r).connect(i);const a=new Uint8Array(i.fftSize);return h={stream:r,context:o,read(){i.getByteTimeDomainData(a);let t=0;for(const e of a)t+=((e-128)/128)**2;return 5*Math.sqrt(t/a.length)}},v("listening"),!0},get state(){return o},get current(){return s}},()=>{g(),r.restore(),t.style.removeProperty("--ascii-level"),delete t.dataset.state})},exports.voidWell=Wr,exports.wave=Br,exports.weave=Nr,exports.wordField=Pn,exports.wordmark=function(t,e={}){const n=(t.textContent??"").trim(),r={current:{...re,...e}};let o=r.current.text??n;const i=H(),a=()=>function(t,e=re.font,n=re.fontWeight,r=520){const{canvas:o,pen:i}=Xt(1800,Math.max(1,Math.round(r))),a=Math.min(400,1700/Math.max(3,.56*[...t].length));return i.fillStyle="#fff",i.textAlign="center",i.textBaseline="middle",i.font=`${n} ${a}px ${e}`,i.fillText(t||" ",o.width/2,o.height/2+.05*a),o}(o,r.current.font,r.current.fontWeight,r.current.artHeight),s=!n;let l=null;l=Ut({host:t,layer:"over",look:()=>({mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:7,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.3,levels:"auto",fit:"contain",focus:{x:.5,y:.5},hover:"trail",trail:{strength:.62,radius:.22},...r.current.look}),ink:t=>r.current.ink??(t?"#d8d6cf":"#1d1d1b"),source:a(),label:s?r.current.label??o:void 0,kit:r,reducedMotion:()=>r.current.reducedMotion,onFail:()=>{l=null,i.restore()}}),l&&n&&i.set(t,"color","transparent"),l&&document.fonts?.load?.(`${r.current.fontWeight} 100px ${r.current.font}`).then(()=>{l&&l.field.setSource(a())},()=>{});const c=e=>{if(e!==o)if(o=e,void 0!==r.current.text&&(r.current={...r.current,text:o}),l)if(l.field.setSource(a()),s)l.field.update({label:r.current.label??(o||" ")});else{for(const e of[...t.childNodes])e!==l.canvas&&e.remove();t.prepend(document.createTextNode(o))}else n&&(t.textContent=o)};return Vt(()=>l,r,t=>{void 0!==t.text&&t.text!==o?c(t.text):l&&l.field.setSource(a())},{setText:c,get text(){return o}},()=>i.restore())};//# sourceMappingURL=kit.cjs.map
|
|
1
|
+
"use strict";var t=require("./field.cjs"),e=/\p{L}/u,n=null,r=new Set,o=new Set;var a=12,i=new Set,s=null,l=null,c=0,d=-1e9,u=0,h=!1,p=!1;var f=()=>"undefined"!=typeof performance?performance.now():Date.now(),m=()=>"number"==typeof innerHeight?innerHeight:0;function g(t,e=t.getBoundingClientRect()){if(!1===t.isConnected)return 1/0;if("function"==typeof t.getClientRects&&0===t.getClientRects().length)return 1/0;const n=e.bottom<0?-e.bottom:e.top-m();return n>0?n:0}function v(t,e){if(t.eager)return void(t.wanted=!0);const n=m(),r=g(t.host,e);!n||r<=.5*n?t.wanted=!0:r>1*n&&(t.wanted=!1)}function y(t){let e=!1;for(const n of t)if(n?.target)for(const t of i)t.host===n.target&&(v(t,n.boundingClientRect??void 0),e=!0);e&&b()}function M(t){l!==t.doc&&(l=t.doc,i.clear(),c=u=0),i.add(t);const e=function(){const t="function"==typeof IntersectionObserver?IntersectionObserver:null;if(!t)return null;if(s?.ctor!==t){s?.list.forEach(t=>t.disconnect()),s={ctor:t,list:["50% 0px","100% 0px","0px"].map(e=>new t(y,{rootMargin:e}))};for(const t of i)s.list.forEach(e=>e.observe(t.host))}return s.list}();e?.forEach(e=>e.observe(t.host)),e?v(t):t.wanted=!0,b()}function b(t=!1){if(h)p=!0;else{h=!0;try{do{p=!1;const e=f();(t||e-d>16||e<d)&&(d=e,u=0);for(const t of i)t.live&&!t.wanted&&t.release();const n=[...i].filter(t=>t.live),r=()=>n.filter(t=>t.live).map(t=>[t,g(t.host)+(t.eager?0:1e9)]).sort((t,e)=>e[1]-t[1]);for(let t=n.length-a,e=t>0?r():[];t>0;t--)e.shift()?.[0].release();const o=[...i].filter(t=>t.wanted&&!t.live).map(t=>[t,t.eager?-1:g(t.host)]).sort((t,e)=>t[1]-e[1]);let s=0;for(const[e,l]of o){if(!i.has(e)||e.live)continue;if(!e.eager&&u>=4&&(!t||s)){c||(c=requestAnimationFrame(()=>{c=0,b(!0)}));break}if(n.filter(t=>t.live).length>=a){const t=r()[0]?.[0];if(!t||!e.eager&&(t.eager||g(t.host)<=l))break;t.release()}const o=f();e.mount(),u+=f()-o,s++,e.live&&n.push(e)}}while(p)}finally{h=!1}}}var x='ui-monospace, "SF Mono", Menlo, Consolas, monospace',w=new Map;function k(t,e){const{max:n,mean:r}=function(t,e=x){const n=`${e}\0${t}`,r=w.get(n);if(r)return r;let o={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 ${e}`,n.textAlign="center",n.textBaseline="middle";const r=t=>{n.clearRect(0,0,48,48),n.fillStyle="#000",n.fillText(t,24,25);const e=n.getImageData(0,0,48,48).data;let r=0;for(let t=3;t<e.length;t+=4)r+=e[t];return r/255},a=t=>[...t].filter(t=>t.trim()).map(r),i=t=>t.reduce((t,e)=>t+e,0)/Math.max(1,t.length),s=a(t),l=a(".:-=+*#%@"),c=r("@");s.length&&c>0&&i(l)>0&&(o={max:Math.max(...s)/c,mean:i(s)/i(l)})}}catch{}return w.set(n,o),o}(t,e.font??x),o=e.glyphScale??.8,a=e.gamma??1,i=e.fontWeight??500;return n>1.15?{glyphScale:Math.max(.3,o*Math.max(.62,n**-.36)),gamma:a,fontWeight:i}:r>1.5?{glyphScale:Math.max(.3,o*r**-.25),gamma:a,fontWeight:i}:n<.85?{glyphScale:Math.min(1.6,o*Math.min(1.3,n**-.3)),gamma:a,fontWeight:n<.6?Math.max(i,700):i}:{glyphScale:o,gamma:a,fontWeight:i}}var S=new WeakMap,A=new WeakMap;function C(t,e){const n=A.get(t);n&&n.getAttribute("src")!==e&&(n.src=e)}function $(t){S.get(t)?.(),S.delete(t)}var E=()=>"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches;function L(t,e,n,r,o){const a=document.createElement("img");a.alt="",a.decoding="async",a.setAttribute("aria-hidden","true"),a.setAttribute("style",`${n};object-fit:cover${E()?"":";transition:opacity 280ms cubic-bezier(.23, 1, .32, 1)"}`),a.style.opacity="1",a.dataset.asciiPoster="",a.src=e;const i=t.style.getPropertyValue("position"),s="function"==typeof getComputedStyle&&"static"===getComputedStyle(t).position;s&&t.style.setProperty("position","relative");const l=t.style.getPropertyValue("isolation"),c=/z-index:\s*-1/.test(n)&&"function"==typeof getComputedStyle&&"auto"===getComputedStyle(t).isolation;c&&t.style.setProperty("isolation","isolate"),o?.parentElement===t?t.insertBefore(a,o):t.appendChild(a);return S.set(r,()=>{a.remove(),s&&(i?t.style.setProperty("position",i):t.style.removeProperty("position")),c&&(l?t.style.setProperty("isolation",l):t.style.removeProperty("isolation"))}),A.set(r,a),{show(t){a.style.opacity=t?"1":"0"},remove:()=>$(r)}}function z(r){const{host:a,kit:l}=r;let c,d=r.canvas,u=null,h=!1,p=!1,f=!1,m=!1,g={},v={},y=r.source,x=!1,w={},S=null,A=null,C=!1,$=null;const z=!r.ownPoster&&l?.current.poster?L(a,l.current.poster,r.place,l,d):null,R=()=>{const t=v.charset,r=!1!==l?.current.globalLook&&"glyph"===(v.mark??"glyph")&&!e.test(t??"")&&n?.charset?n.charset:void 0;return r?r===c?null:(c=r,{charset:r,...k(r,v)}):void 0===c?null:(c=void 0,{charset:t??" .,:-=+*#%@",glyphScale:v.glyphScale??.8,gamma:v.gamma??1,fontWeight:v.fontWeight??500})},I={host:a,doc:document,eager:!1===l?.current.lazy,wanted:!1,live:!1,mount(){if(p||u)return;h&&(d=function(t){const e=document.createElement("canvas");for(const n of t.getAttributeNames?.()??[])"width"!==n&&"height"!==n&&e.setAttribute(n,t.getAttribute(n));return e.style.cssText=t.style.cssText,Object.assign(e.dataset,t.dataset),t.replaceWith?t.replaceWith(e):t.parentElement&&(t.parentElement.insertBefore(e,t),t.remove()),e}(d)),h=!0,v={...r.options(),...g},c=void 0;const e=R();let n;try{n=t.mountGlyphField(d,{...v,...e,...void 0===y?{}:{source:y},onError:()=>{u===n&&T()}})}catch{return void T()}u=n,I.live=!0,x&&n.pause(),n.ready.then(()=>{u===n&&(C=!0,z?.show(!1),S?.(),S=A=null)},()=>{}),r.onMount?.(n,d)},release(){if(!u)return;const t=u;u=null,I.live=!1,C=!1,$?.clear(),$=null,w=t.settings,t.destroy(),(t=>{try{t.getContext("webgl2")?.getExtension("WEBGL_lose_context")?.loseContext()}catch{}})(d),z?.show(!0),r.onRelease?.()}};function T(){f||(f=!0,P(),m||r.onFail())}function P(){p||(p=!0,I.release(),function(t){i.delete(t)&&([...i].some(e=>e.host===t.host)||s?.list.forEach(e=>e.unobserve(t.host)),!i.size&&s&&(s.list.forEach(t=>t.disconnect()),s=null),b())}(I),o.delete(F),d.remove(),f?z?.show(!0):z?.remove())}const F={relook(){const t=R();if(!t||!u)return;const e=u,n=C&&!(l?.current.reducedMotion??E());$?.clear(),$=null,n&&(e.redraw(),$=function(t,e){if(!t.width||!t.height||"undefined"==typeof document)return null;const n=document.createElement("canvas");n.width=t.width,n.height=t.height;const r=n.getContext("2d");if(!r||"function"!=typeof n.animate)return null;try{r.drawImage(t,0,0)}catch{return null}n.setAttribute("aria-hidden","true"),n.dataset.asciiSweep="",n.setAttribute("style",e);const o=document.createElement("span");let a,i;o.setAttribute("aria-hidden","true"),o.dataset.asciiSweep="",o.setAttribute("style",`${e};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)`),t.after(n,o);const s=()=>{a?.cancel(),i?.cancel(),n.remove(),o.remove()};return{clear:s,reveal(){if(!n.isConnected)return;const e={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%)"}],e);const r=t.clientWidth||t.getBoundingClientRect().width;i=o.animate([{transform:"translateX(0px)",opacity:.35},{opacity:.35,offset:.7},{transform:`translateX(${r}px)`,opacity:0}],e),a.onfinish=s}}}(d,r.place)),e.update(t);const o=$;o&&requestAnimationFrame(()=>requestAnimationFrame(()=>{$===o&&u===e?o.reveal():o.clear()}))}};return{field:{get canvas(){return d},get ready(){return u?u.ready:A??(A=new Promise(t=>{S=t}))},get settings(){return u?.settings??w},update(t){if(g={...g,...t},v={...v,...t},!u)return;const e=R();u.update(void 0!==c?{...t,charset:c,...k(c,v)}:e?{...t,...e}:t)},setSource:t=>(y=t,u?u.setSource(t):Promise.resolve()),pointer(t,e){u?.pointer(t,e)},redraw(){u?.redraw()},pulse(t){u?.pulse(t)},play(){x=!1,u?.play()},pause(){x=!0,u?.pause()},resize(){u?.resize()},destroy(){P()}},get canvas(){return d},get live(){return!!u},get failed(){return f},start(){o.add(F),m=!0;try{M(I)}finally{m=!1}},destroy:P}}var R,I=(t,e=0,n=1)=>Math.min(n,Math.max(e,t)),T=(t,e)=>{const n=43758.5453*Math.sin(127.1*t+311.7*e);return n-Math.floor(n)},P=(t,e=3)=>1-(1-I(t))**e,F=(t,e,n)=>{const r=I((n-t)/(e-t));return r*r*(3-2*r)},W=t=>{if(t<=0)return 0;if(t>=1)return 1;const e=(t,e,n)=>3*e*t*(1-t)**2+3*n*t*t*(1-t)+t**3;let n=0,r=1,o=t;for(let a=0;a<22;a++)o=(n+r)/2,e(o,.16,.3)<t?n=o:r=o;return e(o,1,1)},B=()=>"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,O={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 N(t,e,n){let r=(t??"").trim();const o=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/.exec(r);if(o?r=G(e,o[1])||(o[2]??"").trim():r.startsWith("--")&&(r=G(e,r)),!r)return n?N(n,e):null;if(/^#[\da-f]{6}$/i.test(r))return r.toLowerCase();if(/^#[\da-f]{3}$/i.test(r))return`#${[...r.slice(1)].map(t=>t+t).join("")}`.toLowerCase();const a=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(r);if(a)return q([+a[1],+a[2],+a[3]]);if(void 0===R)try{R="undefined"==typeof document?null:Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0})}catch{R=null}if(!R)return n?N(n,e):null;R.clearRect(0,0,1,1),R.fillStyle="#000",R.fillStyle=r,R.fillRect(0,0,1,1);const[i,s,l]=R.getImageData(0,0,1,1).data;return q([i,s,l])}var G=(t,e)=>"function"==typeof getComputedStyle?getComputedStyle(t).getPropertyValue(e).trim():"",q=t=>`#${t.map(t=>Math.round(I(t,0,255)).toString(16).padStart(2,"0")).join("")}`,H=t=>{const e=parseInt(t.slice(1,7),16);return[e>>16&255,e>>8&255,255&e]},D=(t,e,n)=>{const r=H(t),o=H(e);return q(r.map((t,e)=>t+(o[e]-t)*n))};function j(t){const e="function"==typeof getComputedStyle?getComputedStyle(t):null,n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?/i.exec(e?.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 r=N(e?.color??"",t);if(!r)return"function"==typeof matchMedia&&matchMedia("(prefers-color-scheme: dark)").matches;const[o,a,i]=H(r);return.2126*o+.7152*a+.0722*i>140}function U(){const t=[];return{set(e,n,r){t.some(([t,r])=>t===e&&r===n)||t.push([e,n,e.style.getPropertyValue(n)]),e.style.setProperty(n,r)},restore(){for(const[e,n,r]of t.reverse())r?e.style.setProperty(n,r):e.style.removeProperty(n);t.length=0}}}function V(t="",e=!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"),e&&n.setAttribute("aria-live","polite"),n.textContent=t,n}function X(t,e){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),o=n.width/(t.offsetWidth||n.width||1)||1;return{x:(r.left-n.left)/o,y:(r.top-n.top)/o,w:r.width/o,h:r.height/o}}function Y(t,e){const n={...t,...e},r=t.look,o=e.look;return o&&(n.look=Object.fromEntries(Object.entries({...r,...o}).filter(([,t])=>void 0!==t))),n}var J=new WeakMap,_=t=>J.get(t)?.()??null;function K(e){const{host:n,layer:r="over",outset:o=0,kit:a}=e;if("undefined"==typeof document)return null;const i=`position:absolute;left:${-o}px;top:${-o}px;width:calc(100% + ${2*o}px);height:calc(100% + ${2*o}px);pointer-events:none;z-index:${"under"===r?-1:"auto"}`;if(!t.isGlyphFieldSupported())return a?.current.poster&&L(n,a.current.poster,i,a),null;const s=U(),l=document.createElement("canvas"),c=document.createElement("canvas"),d=c.getContext("2d");if(!d)return null;"static"===getComputedStyle(n).position&&s.set(n,"position","relative"),"under"===r&&s.set(n,"isolation","isolate"),l.setAttribute("aria-hidden","true"),l.dataset.asciiKit="";const u=l.style;u.position="absolute",u.left=u.top=-o+"px",u.width=u.height=`calc(100% + ${2*o}px)`,u.pointerEvents="none",u.zIndex="under"===r?"-1":"",n.appendChild(l);const h=()=>{const t=getComputedStyle(n);M.canvas.style.borderRadius=[t.borderTopLeftRadius,t.borderTopRightRadius,t.borderBottomRightRadius,t.borderBottomLeftRadius].map(t=>o&&/^[\d.]+px$/.test(t)?`${parseFloat(t)+o}px`:t).join(" ")};let p=j(n);const f=()=>N(e.ink(p),n)??N(getComputedStyle(n).color,n)??(p?"#d8d6cf":"#1d1d1b");let m=0,g=!1,v=!0,y=!1;const M=z({host:n,canvas:l,kit:a,place:i,options:()=>({...O,...e.look(),ink:f(),interactionTarget:n,label:""}),onMount:(t,e)=>{J.set(e,S),e.removeAttribute("role"),e.removeAttribute("aria-label"),t.ready.then(C,()=>{}),C()},onRelease:()=>{m&&cancelAnimationFrame(m),m=0},onFail:()=>{G(),e.onFail?.()}}),b=M.field;h();const x=()=>!!(e.reducedMotion()??B()),w=t=>X(M.canvas,t),k=t=>{const r=M.canvas,a=Math.max(1,r.clientWidth||n.clientWidth+2*o),i=Math.max(1,r.clientHeight||n.clientHeight+2*o),s=e.resolution??1,[l,u]="function"==typeof s?s(a,i):[Math.max(1,Math.round(a*s)),Math.max(1,Math.round(i*s))];c.width===l&&c.height===u||(c.width=l,c.height=u),d.setTransform(1,0,0,1,0,0),d.globalAlpha=1,d.globalCompositeOperation="source-over",d.filter="none",d.fillStyle="#000",d.fillRect(0,0,l,u);let h=!1;try{h=e.paint({pen:d,width:l,height:u,w:a,h:i,scale:l/a,now:t,still:x(),dark:p,box:w})}catch(t){"undefined"!=typeof console&&console.error(t)}return b.setSource(c).then(()=>{y||b.redraw()}),h};function S(){const t=M.canvas,r=Math.max(1,t.clientWidth||n.clientWidth+2*o),a=Math.max(1,t.clientHeight||n.clientHeight+2*o),i=e.resolution??1,[s,l]="function"==typeof i?i(r,a):[Math.max(1,Math.round(r*i)),Math.max(1,Math.round(a*i))],c=document.createElement("canvas");c.width=s,c.height=l;const d=c.getContext("2d");if(!d)return null;d.fillStyle="#000",d.fillRect(0,0,s,l);try{e.paint({pen:d,width:s,height:l,w:r,h:a,scale:s/r,now:performance.now(),still:!0,dark:p,box:w})}catch{return null}return c}J.set(l,S);const A=t=>{if(m=0,y||g||!M.live)return;!k(t)||x()||!v||"undefined"!=typeof document&&document.hidden||(m=requestAnimationFrame(A))};function C(){m||y||g||!M.live||(m=requestAnimationFrame(A))}const $="function"==typeof ResizeObserver?new ResizeObserver(()=>{h(),b.resize(),!M.live||y||g||k(performance.now()),C()}):null;$?.observe(n);const E="function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{v=t.isIntersecting,v&&C()},{rootMargin:"64px"}):null;E?.observe(n);const R=()=>{document.hidden||C()};document.addEventListener("visibilitychange",R);let I=0;const T=()=>{I||y||(I=requestAnimationFrame(()=>{I=0,y||(p=j(n),b.update({ink:f()}),e.onTheme?.(),C())}))},P="function"==typeof matchMedia?matchMedia("(prefers-color-scheme: dark)"):null;P?.addEventListener?.("change",T);const F="function"==typeof matchMedia?matchMedia("(prefers-reduced-motion: reduce)"):null;F?.addEventListener?.("change",C);const W="function"==typeof MutationObserver?new MutationObserver(T):null;for(const t of[document.documentElement,document.body])t&&W?.observe(t,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]});function G(){y||(y=!0,m&&cancelAnimationFrame(m),I&&cancelAnimationFrame(I),m=I=0,$?.disconnect(),E?.disconnect(),W?.disconnect(),document.removeEventListener("visibilitychange",R),P?.removeEventListener?.("change",T),F?.removeEventListener?.("change",C),M.destroy(),s.restore(),c.width=c.height=1)}return M.start(),M.failed?(G(),null):{field:b,get canvas(){return M.canvas},get live(){return M.live},kick:C,refresh(){y||(p=j(n),b.update({...O,...e.look(),ink:f()}),C())},still:x,dark:()=>p,box:w,play(){g&&(g=!1,b.play(),C())},pause(){g=!0,m&&cancelAnimationFrame(m),m=0,b.pause()},destroy:G}}function Q(t,e,n,r,o=()=>{}){let a=!1;const i={get supported(){return!!t()&&!a},get field(){return a?null:t()?.field??null},update(t){if(a)return;e.current=Y(e.current,t);const r=t.poster;r&&C(e,r),n(e.current)},play(){a||t()?.play()},pause(){a||t()?.pause()},destroy(){a||(a=!0,t()?.destroy(),$(e),o())}};return Object.defineProperties(r,Object.getOwnPropertyDescriptors(i))}var Z={colorful:["#22c55e","#06b6d4","#6366f1","#d946ef","#f43f5e","#f59e0b"],mono:["#ffffff"],ocean:["#22d3ee","#3b82f6","#2dd4bf","#818cf8"],sunset:["#f97316","#f43f5e","#ec4899","#fbbf24"]},tt={palette:"colorful",mode:"rotate",grain:"dots",speed:1,hover:!0,depth:18},et=["rotate","pulse","progress"],nt=t=>{const e=/^#[\da-f]{3}$/i.test(t)?`#${[...t.slice(1)].map(t=>t+t).join("")}`:t;return[1,3,5].map(t=>(parseInt(e.slice(t,t+2),16)||0)/255)},rt=(t,e,n)=>t.map((t,r)=>t+(e[r]-t)*n),ot=nt("#ff4a4a"),at=nt("#2fd67b");function it(t){const e=("string"==typeof t?Z[t]??Z.colorful:t.length?t:Z.colorful).map(nt),n=new Float32Array(1024);for(let t=0;t<256;t++){const r=t/256*e.length,o=Math.floor(r),a=r-o,i=1===e.length?e[0]:rt(e[o%e.length],e[(o+1)%e.length],a*a*(3-2*a)),s=Math.max(...i,.01);n.set([i[0]/s,i[1]/s,i[2]/s,(.2126*i[0]+.7152*i[1]+.0722*i[2])/s],4*t)}return n}var st=(t,e)=>{const n=(-t%1+1)%1,r=1-n;return Math.max(n<e?(1-n/e)**2.2:0,r<.03?(1-r/.03)**2:0)},lt=t=>Math.max(st(t,.3),.75*st(t-.5,.22)),ct=(t,e)=>t<=e?.42+.4*(t/Math.max(e,.001))**1.6+.38*Math.exp(-(((e-t)/.03)**2)):t-e<.014?1.2*(1-(t-e)/.014)**2:0,dt=(t,e)=>I((t-.68*e)/.07);var ut={duration:800,trigger:"visible",replayOnHover:!0,settle:"glyphs"};function ht(t,e,n=.82){const r=t.getContext("2d");if(!r)return;const o=t.width,a=t.height,i=r.createImageData(o,a),s=t=>t*t*(3-2*t),l=(t,e)=>{const n=Math.floor(t),r=Math.floor(e),o=s(t-n),a=s(e-r),i=T(n,r),l=T(n+1,r),c=T(n,r+1);return i+(l-i)*o+(c-i)*a+(i-l-c+T(n+1,r+1))*o*a};for(let t=0;t<a;t++)for(let r=0;r<o;r++){const s=.6*l(r/6+2.4*e,t/3.5-.8*e)+.4*l(r/2.5-3*e,t/2),c=Math.min(1,2.4*(1-Math.hypot(2*(r/o-.5),2*(t/a-.5))*n)),d=.72*Math.max(0,s-.42)*Math.max(0,c)*255,u=4*(t*o+r);i.data[u]=i.data[u+1]=i.data[u+2]=d,i.data[u+3]=255}r.putImageData(i,0,0)}var pt={value:0,duration:360,stagger:60,glyphs:"#%*+=-:",format:t=>t.toLocaleString(),face:"text"};function ft(t,e){const n=(t,e)=>t[t.length-1-e]??"";for(let r=e.length-1;r>=0;r--)if(/\d/.test(n(e,r))&&n(t,r)!==n(e,r))return r;return-1}var mt={check:!0,shake:!0};function gt(t,e,n,r,o,a=0){const i=24*n+170;if(e<i){const n=(e-24*t)/170;return n<1?1+Math.floor(T(t+a,Math.floor(e/46))*(n<0?3:9)):0}if(!r||o)return 0;const s=(((e-i)/1250-.07*t)%1+1)%1;return s<.3?1+Math.round(8*Math.sin(Math.PI*(s/.3))):0}var vt="cubic-bezier(.16, 1, .3, 1)";var yt={colourByState:!0,ring:!0},Mt={success:["--ascii-success","#17844a","#3ccf7e"],warning:["--ascii-warning","#9a6700","#f5b83d"],error:["--ascii-error","#c93636","#ff6b6b"]},bt=120,xt=280,wt=520,kt=2*Math.PI,St=kt/1050,At=t=>1-(1-t)**4,Ct=t=>`rgb(${255*t} ${255*t} ${255*t})`,$t=t=>t*St-Math.PI/2,Et=(t,e=0)=>78+5*Math.sin(t/1600*kt)*(1-e);function Lt(t,e,n=78,r=24){t.strokeStyle=Ct(e),t.lineWidth=r,t.beginPath(),t.arc(bt,bt,n,0,kt),t.stroke()}function zt(t,e,n,r=0,o=1){if(Lt(t,(.3+(n-78)/100)*o,n,24-6*r),r>=1)return void Lt(t,.72*o,n,18);const a=3.4+(kt-3.4)*r;t.lineCap="round";for(let i=0;i<32;i++){const s=i/32,l=.3+.7*(1-s)**1.6;t.strokeStyle=Ct((l+(.72-l)*r)*o),t.lineWidth=28-6*s+(18-(28-6*s))*r,t.beginPath(),t.arc(bt,bt,n,e-(s+1/32)*a,e-s*a),t.stroke()}}function Rt(t,e,n,r=800,o=0,a=!0){if("idle"===e)return void Lt(t,.34);if("loading"===e)return void zt(t,$t(n),Et(n));const i=(t=>t<.5?4*t*t*t:1-(-2*t+2)**3/2)(Math.min(1,r/xt)),s=Math.min(r,xt),l=o+St*(s-s*s/560);a?zt(t,l,Et(n,i),i):i<1&&zt(t,l,Et(n,i),0,1-i);const c=(r-196)/wt;a&&c>0&&c<1&&Lt(t,.5*(1-c)**2,88+24*c,16-8*c),function(t,e,n,r=30){t.strokeStyle="#fff",t.lineWidth=r,t.lineCap="round",t.lineJoin="round";const o=(e,n)=>{const r=e.slice(1).map((t,n)=>Math.hypot(t[0]-e[n][0],t[1]-e[n][1]));let o=n*r.reduce((t,e)=>t+e,0);t.beginPath(),t.moveTo(e[0][0],e[0][1]);for(let n=1;n<e.length&&o>0;n++){const a=Math.min(1,o/r[n-1]);t.lineTo(e[n-1][0]+(e[n][0]-e[n-1][0])*a,e[n-1][1]+(e[n][1]-e[n-1][1])*a),o-=r[n-1]}t.stroke()};"success"===e?o([[86,122],[110,146],[156,96]],n):"warning"===e?(t.lineWidth=r-4,o([[bt,74],[bt,114]],Math.min(1,n/.7)),n>.7&&(t.fillStyle="#fff",t.beginPath(),t.arc(bt,152,r/2*At((n-.7)/.3),0,kt),t.fill())):(o([[92,92],[148,148]],n),o([[148,92],[92,148]],n))}(t,e,At(Math.min(1,Math.max(0,(r-40)/260))),a?24:30)}var It={blocks:"[data-block]",shimmer:1400,resolve:420,stagger:60,develop:640},Tt=t=>`rgb(${255*t} ${255*t} ${255*t})`,Pt=(t,e,n)=>t<0?0:P((t-e)/n,3),Ft=t=>parseFloat(t)||0;function Wt(t,e,n=1){const r=getComputedStyle(t),o=t.getBoundingClientRect(),a=r.borderTopLeftRadius,i=a.endsWith("%")?Ft(a)/100*Math.min(o.width,o.height):Ft(a);if("text"!==e)return{radius:i/n,lines:[]};const s=Ft(r.fontSize)||14,l="normal"===r.lineHeight?1.2*s:Ft(r.lineHeight),c=Math.min(l,.62*s),d=new Map,u="undefined"!=typeof document&&"function"==typeof document.createRange?document.createRange():null;u?.selectNodeContents(t);for(const t of u?[...u.getClientRects()]:[]){if(!t.width)continue;const e=Math.round((t.top+t.bottom)/2/Math.max(1,l/2)),n=d.get(e);d.set(e,n?{left:Math.min(n.left,t.left),right:Math.max(n.right,t.right),top:Math.min(n.top,t.top),bottom:Math.max(n.bottom,t.bottom)}:{left:t.left,right:t.right,top:t.top,bottom:t.bottom})}const h=[...d.values()].map(t=>{const e=Math.max(t.left,o.left),r=Math.min(t.right,o.right),a=(t.top+t.bottom)/2;return{x:(e-o.left)/n,y:(a-c/2-o.top)/n,w:Math.max(0,r-e)/n,h:c/n}}).filter(t=>t.w>0);return h.length||h.push({x:0,y:(o.height-c)/2/n,w:o.width/n,h:c/n}),{radius:(i||c/2)/n,lines:h}}function Bt(t){const e=t.dataset.block;return"text"===e||"photo"===e||"avatar"===e?e:"IMG"===t.tagName||"PICTURE"===t.tagName||"VIDEO"===t.tagName?/^50%|^9999px/.test(getComputedStyle(t).borderTopLeftRadius)?"avatar":"photo":"text"}var Ot={tone:"neutral",live:!1,indicator:!0,sheen:!0},Nt={light:{green:[22,150,82],amber:[200,128,10],red:[214,52,52],neutral:[120,120,114],new:[98,72,214]},dark:{green:[120,240,170],amber:[255,206,110],red:[255,156,156],neutral:[200,200,192],new:[180,164,255]}},Gt={light:{charset:" .:+*"+"#".repeat(15),top:.32},dark:{charset:" .:+*"+"#".repeat(4),top:.9}},qt=[[255,130,225],[205,175,255],[120,215,255]],Ht=(t,e,n)=>t.map((t,r)=>t+(e[r]-t)*n),Dt=(t,e)=>Math.exp(-((t/e)**2));function jt(t,e){const n=Math.max(1,...t),r=t.map(t=>t/n*255),o=(.2126*r[0]+.7152*r[1]+.0722*r[2])/255,a=Math.min(1,e/Math.max(o,.01));return`rgb(${r.map(t=>Math.round(Math.max(0,Math.min(255,t*a)))).join(" ")})`}var Ut=(t,e)=>{return"green"===(n=t.dataset.tone)||"amber"===n||"red"===n||"neutral"===n||"new"===n?t.dataset.tone:e;var n};var Vt={tabs:'[role="tab"]',duration:280,panels:"hidden",manage:!0};var Xt=280,Yt={preview:[{k:.5,blur:9},{k:.78,blur:4}],final:{k:1,blur:0}},Jt=async t=>{if("function"==typeof createImageBitmap)return createImageBitmap("string"==typeof t?await(await fetch(t)).blob():t);const e=new Image;return e.crossOrigin="anonymous",e.src="string"==typeof t?t:URL.createObjectURL(t),await e.decode(),e};var _t=t=>new Promise(e=>setTimeout(e,t));function Kt(e){const{host:n,layer:r="under",kit:o}=e;if("undefined"==typeof document)return null;const a=`position:absolute;inset:0;width:100%;height:100%;pointer-events:none;border-radius:inherit;z-index:${"under"===r?-1:"auto"}`;if(!t.isGlyphFieldSupported())return o?.current.poster&&!e.ownPoster&&L(n,o.current.poster,a,o),null;const i=U(),s=document.createElement("canvas");"static"===getComputedStyle(n).position&&i.set(n,"position","relative"),"under"===r&&i.set(n,"isolation","isolate"),s.dataset.asciiKit="",s.setAttribute("style",a),n.appendChild(s);let l=j(n),c=!1;const d=()=>{const t=e.reducedMotion();return!0===t?{speed:0,drift:0,respectReducedMotion:!0}:{respectReducedMotion:!1!==t}},u=()=>N(e.ink(l),n,l?"#d8d6cf":"#1d1d1b")??"#888888",h=z({host:n,canvas:s,kit:o,place:a,ownPoster:e.ownPoster,source:e.source??null,options:()=>({...O,...e.look(l),...d(),ink:u(),interactionTarget:n,label:e.label??""}),onMount:(t,n)=>{e.label||(n.removeAttribute("role"),n.removeAttribute("aria-label"),n.setAttribute("aria-hidden","true")),e.onMount?.()},onRelease:e.onRelease,onFail:()=>{M(),e.onFail?.()}}),p=h.field;let f=0;const m=()=>{c||(l=j(n),p.update({...O,...e.look(l),...d(),ink:u()}))},g=()=>{f||c||(f=requestAnimationFrame(()=>{f=0,m()}))},v="function"==typeof matchMedia?matchMedia("(prefers-color-scheme: dark)"):null;v?.addEventListener?.("change",g);const y="function"==typeof MutationObserver?new MutationObserver(g):null;for(const t of[document.documentElement,document.body])t&&y?.observe(t,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]});function M(){c||(c=!0,f&&cancelAnimationFrame(f),y?.disconnect(),v?.removeEventListener?.("change",g),h.destroy(),i.restore())}return h.start(),h.failed?(M(),null):{field:p,get canvas(){return h.canvas},get live(){return h.live},dark:()=>l,still:()=>!!(e.reducedMotion()??B()),refresh:m,destroy:M}}function Qt(t,e,n,r,o=()=>{}){let a=!1;const i={get supported(){return!!t()&&!a},get field(){return a?null:t()?.field??null},update(r){if(a)return;e.current=Y(e.current,r);const o=r.poster;o&&C(e,o),n(e.current),t()?.refresh()},play(){a||t()?.field.play()},pause(){a||t()?.field.pause()},destroy(){a||(a=!0,o(),t()?.destroy(),$(e))}};return Object.defineProperties(r,Object.getOwnPropertyDescriptors(i))}function Zt(t,e){const n=Object.assign(document.createElement("canvas"),{width:t,height:e}),r=n.getContext("2d");return r.fillStyle="#000",r.fillRect(0,0,t,e),{canvas:n,pen:r}}function te(t,e,n){if(!e)return void t.pulse({strength:n});if("getBoundingClientRect"in e)return void t.pulse({element:e,strength:n});const r=t.canvas.getBoundingClientRect();t.pulse({x:e.x-r.left,y:e.y-r.top,strength:n})}var ee={preset:"hero",clear:!1,text:"404",ripple:!0},ne=28,re='600 440px "Geist", Arial, sans-serif',oe=()=>"number"==typeof innerWidth&&innerWidth<760,ae=t=>({mark:"glyph",scene:"drift",levels:"auto",charset:" .:+*#",font:'"Geist Mono", ui-monospace, monospace',fontWeight:400,cellSize:10,cellAspect:.62,glyphScale:.86,color:"ink",shade:0,hover:"trail",trail:{strength:.9,radius:.32},...t}),ie={mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:7,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.4,fit:"contain",clear:!1,focus:{x:.5,y:.5},drift:.8,speed:.7,levels:"auto",hover:"trail",trail:{strength:1,radius:.42}};var se=[...Array.from({length:10},(t,e)=>(e+1)/10),1,1,1,...Array.from({length:14},(t,e)=>1-(e+1)/14)];function le(t,e,n,r){const o=e.getContext("2d");o.globalAlpha=1,o.fillStyle="#000",o.fillRect(0,0,e.width,e.height);for(const e of n){const n=Math.min(1,Math.max(0,(r-e.lag*(1-r))/(1-.5*e.lag))),a=n*n*(3-2*n);o.globalAlpha=1-.72*a,o.drawImage(t,e.x,e.y,ne,ne,e.x+e.dx*a,e.y+e.dy*a,ne,ne)}o.globalAlpha=1}var ce={font:'Georgia, "Times New Roman", serif',fontWeight:600};var de="position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit;pointer-events:none";var ue={saving:null,font:'"Geist", Arial, sans-serif'};function he(t,e,n,r=ue.font){const o=Math.max(2,Math.round(2*t.offsetWidth)),a=Math.max(2,Math.round(2*t.offsetHeight)),{canvas:i,pen:s}=Zt(o,a),l=s.createRadialGradient(o,0,0,o,0,.52*Math.hypot(o,a));l.addColorStop(0,"rgb(150 150 150)"),l.addColorStop(.4,"rgb(64 64 64)"),l.addColorStop(1,"rgb(0 0 0)"),s.fillStyle=l,s.fillRect(0,0,o,a);const c=e?function(t,e){const n=t.getBoundingClientRect(),r=n.height?t.offsetHeight/n.height:1,o=e?.getBoundingClientRect().top??n.top+n.height;let a=e;for(;a&&a.parentElement!==t;)a=a.parentElement;let i=n.top;for(const e of Array.from(t.children)){if(e===a)break;if(void 0!==e.dataset?.asciiKit)continue;const t=e.getBoundingClientRect();t.height&&(i=Math.max(i,t.top+t.height))}return{middle:((i+o)/2-n.top)*r,height:(o-i)*r}}(t,n):null;if(e&&c&&c.height>=30){const t=Math.min(2*c.height*.9,.34*o),n=o-.07*o,a=2*c.middle+.04*t;s.font=`600 ${t}px ${r}`,s.letterSpacing=.04*-t+"px",s.textAlign="right",s.textBaseline="middle",s.lineJoin="round",s.lineWidth=.28*t,s.strokeStyle="rgb(0 0 0 / .85)",s.strokeText(e,n,a),s.fillStyle="#fff",s.fillText(e,n,a)}return i}var pe={aurora:["#2ee6c8","#9d7bff","#ff6fb5"],brand:["#ffb000","#ffd84d"]},fe={palette:"aurora",swell:!0},me=t=>"mono"===t?[]:"string"==typeof t?[...pe[t]??pe.aurora]:[...t];function ge(t,e){if(1===t.length)return t[0];const n=I(e)*(t.length-1),r=Math.min(t.length-2,Math.floor(n)),o=n-r,[a,i]=[t[r],t[r+1]].map(t=>[1,3,5].map(e=>parseInt(t.slice(e,e+2),16)||0));return`rgb(${a.map((t,e)=>Math.round(t+(i[e]-t)*o)).join(" ")})`}var ve=t=>{const e=Math.round(255*Math.min(1,Math.max(0,t)));return`rgb(${e} ${e} ${e})`},ye=t=>{if(!t||"transparent"===t)return 0;const e=/\/\s*([\d.]+)(%?)\s*\)$/.exec(t);if(e)return parseFloat(e[1])/(e[2]?100:1);const n=/^rgba\([^)]*,\s*([\d.]+)\s*\)$/.exec(t);return n?parseFloat(n[1]):1},Me=/^(IMG|PICTURE|VIDEO|CANVAS|SVG|svg)$/;function be(t,e,n,r){const o=(t,e)=>Math.max(0,Math.min(parseFloat(t.borderTopLeftRadius)||0,e.w/2,e.h/2)),a=[e,...e.querySelectorAll("*")];t.save();for(const i of a){if("CANVAS"===i.tagName&&void 0!==i.dataset?.asciiKit){if(!r||i===r.skip)continue;const e=n(i),o=e.w>0&&e.h>0?_(i):null;o&&(t.globalCompositeOperation="lighter",t.drawImage(o,e.x,e.y,e.w,e.h),t.globalCompositeOperation="source-over");continue}if(void 0!==i.dataset?.asciiPoster)continue;const a=n(i);if(a.w<=0||a.h<=0)continue;const s=getComputedStyle(i);if("hidden"===s.visibility||"none"===s.display)continue;const l=ye(s.backgroundColor)>.03,c=(parseFloat(s.borderTopWidth)||0)>0&&ye(s.borderTopColor)>.1;if(t.beginPath(),i===e)(l||c)&&(t.strokeStyle=ve(.42),t.lineWidth=3,t.roundRect(a.x+1.5,a.y+1.5,a.w-3,a.h-3,o(s,a)),t.stroke());else{if(Me.test(i.tagName)){t.fillStyle=ve(.5),a.w<32&&a.h<32?t.arc(a.x+a.w/2,a.y+a.h/2,.36*Math.min(a.w,a.h),0,2*Math.PI):t.roundRect(a.x,a.y,a.w,a.h,o(s,a)),t.fill();continue}l?(t.fillStyle=ve(.22),t.roundRect(a.x,a.y,a.w,a.h,o(s,a)),t.fill()):c&&(t.strokeStyle=ve(.32),t.lineWidth=1.5,t.roundRect(a.x+.75,a.y+.75,a.w-1.5,a.h-1.5,o(s,a)),t.stroke())}if("INPUT"===i.tagName||"TEXTAREA"===i.tagName){const e=i,n=e.value||e.placeholder||"";n&&xe(t,n,a.x+(parseFloat(s.paddingLeft)||0),a.y,a.h,s,e.value?.82:.5)}}!function(t,e,n){if("function"!=typeof document.createTreeWalker)return;const r=document.createTreeWalker(e,4),o=document.createRange(),a=n(e),i=e.getBoundingClientRect(),s=i.width/(e.offsetWidth||i.width||1)||1;let l=0;for(let n=r.nextNode();n&&l<2e3;n=r.nextNode()){const r=n.parentElement;if(!r)continue;const c=getComputedStyle(r);if("hidden"===c.visibility||we(r,e))continue;const d=(parseFloat(c.fontWeight)||400)>=600||/^H[1-6]$/.test(r.tagName)?1:.8;for(const e of n.data.matchAll(/\S+/g)){o.setStart(n,e.index),o.setEnd(n,e.index+e[0].length);const r=o.getClientRects()[0];r&&(l++,xe(t,e[0],a.x+(r.left-i.left)/s,a.y+(r.top-i.top)/s,r.height/s,c,d))}}o.detach?.()}(t,e,n),t.restore()}function xe(t,e,n,r,o,a,i){const s=Math.min(900,(parseFloat(a.fontWeight)||400)+200);t.font=`${a.fontStyle||"normal"} ${s} ${a.fontSize} ${a.fontFamily}`,t.fillStyle=ve(i),t.shadowColor=ve(i),t.shadowBlur=3,t.textBaseline="middle",t.fillText(e,n,r+o/2),t.shadowBlur=0}function we(t,e){for(;t&&t!==e;t=t.parentElement){const e=t;if(e.offsetWidth<=1&&e.offsetHeight<=1&&"hidden"===getComputedStyle(e).overflow)return!0}return!1}function ke(t,e,n,r,o=2,a){const i=document.createElement("canvas");i.width=Math.max(2,Math.round(n*o)),i.height=Math.max(2,Math.round(r*o));const s=i.getContext("2d",{willReadFrequently:!0});return s?(s.setTransform(o,0,0,o,0,0),s.fillStyle="#000",s.fillRect(0,0,n,r),be(s,t,e,a),i):i}var Se={input:"input",rows:'[role="option"]',hotkey:"k",manage:!0,closeOnRun:!0},Ae=200,Ce=t=>{const e=Math.round(255*I(t));return`rgb(${e} ${e} ${e})`};var $e={thumb:'[role="slider"]',label:"[data-label]",threshold:.9,resetAfter:0},Ee=720,Le=(t,e,n)=>t+(e-t)*n,ze=t=>1-(1-t)**3,Re=(t,e,n)=>({x:t,v:0,to:t,k:e,z:n});function Ie(t,e,n=.4){const r=2*Math.sqrt(t.k)*t.z,o=Math.max(1,Math.ceil(240*e)),a=e/o;for(let e=0;e<o;e++)t.v+=(-t.k*(t.x-t.to)-r*t.v)*a,t.x+=t.v*a;return!(Math.abs(t.x-t.to)<n&&Math.abs(t.v)<12*n)||(t.x=t.to,t.v=0,!1)}var Te=t=>{t.x=t.to,t.v=0};function Pe(t,e){const n=t.filter(([,t])=>e-t<80);if(n.length<2)return 0;const[r,o]=n[0],[a,i]=n[n.length-1];return i>o?(a-r)/(i-o)*1e3:0}var Fe={kind:"heart",icon:"svg",manage:!0,outset:40,layer:"under"},We=t=>1-(1-I(t))**3;function Be(t,e,n,r,o){if(t.beginPath(),"heart"===e){const e=o/29;for(let o=0;o<=56;o++){const a=o/56*Math.PI*2,i=16*Math.sin(a)**3,s=-(13*Math.cos(a)-5*Math.cos(2*a)-2*Math.cos(3*a)-Math.cos(4*a));0===o?t.moveTo(n+i*e,r+(s-2.5)*e):t.lineTo(n+i*e,r+(s-2.5)*e)}}else{const e=.7*o,a=r-o/2,i=n-e/2,s=.12*o;t.moveTo(i,a+s),t.arcTo(i,a,i+s,a,s),t.lineTo(i+e-s,a),t.arcTo(i+e,a,i+e,a+s,s),t.lineTo(i+e,r+o/2),t.lineTo(n,r+o/2-.27*o),t.lineTo(i,r+o/2)}t.closePath()}function Oe(t,e,n,r,o,a){const i=t.createRadialGradient(n,r-.1*o,0,n,r,.62*o);i.addColorStop(0,"#fff"),i.addColorStop(.7,"#e6e6e6"),i.addColorStop(1,"#8c8c8c"),t.globalAlpha=a,t.fillStyle=i,t.shadowColor="#bbb",t.shadowBlur=Math.max(2,.08*o),Be(t,e,n,r,o),t.fill(),t.shadowBlur=0,t.globalAlpha=1}function Ne(t,e,n,r,o){const a=n.x+n.w/2,i=n.y+n.h/2,s=n.h,l=1.45*s,c=(t=>t>=1?1:1-Math.exp(-5*t)*Math.cos(9*t))(r/.3),d=(t=>t<.5?4*t**3:1-(-2*t+2)**3/2)(I((r-.42)/.3)),u=d>0?l+(s-l)*d:.7*s+(l-.7*s)*c,h=I((r-.04)/.46);h>0&&h<1&&(t.strokeStyle=(t=>{const e=Math.round(255*I(t));return`rgb(${e} ${e} ${e})`})(.8*(1-h)**1.4),t.lineWidth=2.4-1.2*h,t.lineJoin="round",Be(t,e,a,i,s*(1.2+.5*We(h))),t.stroke());t.fillStyle="#fff";for(let e=0;e<7;e++){const n=(r-.1-.05*T(e,o))/.5;if(n<=0||n>=1)continue;const l=-Math.PI/2+(e-3)/7*Math.PI*1.7+.3*(T(o+1,e)-.5),c=s*(.75+(.55+.35*T(e,o+2))*We(n)),d=1.8*(1-.6*n);t.globalAlpha=1-n*n,t.beginPath(),t.arc(a+Math.cos(l)*c*1.15,i+Math.sin(l)*c*.85,d,0,2*Math.PI),t.fill()}t.globalAlpha=1,Oe(t,e,a,i,u,1-I((r-.72)/.28))}var Ge={values:[],duration:520},qe=t=>{const e=Math.round(255*I(t));return`rgb(${e} ${e} ${e})`};var He={dissolve:140,condense:160},De=10,je=16;var Ue={cards:"[data-card]",loop:!0,threshold:.4,outset:56},Ve=(t,e,n)=>t+(e-t)*n,Xe=(t,e,n)=>({x:t,v:0,to:t,k:e,z:n}),Ye=Array.from({length:96},(t,e)=>{const n=43758.5453*Math.sin(127.1*e+311.7);return n-Math.floor(n)});var Je={length:6,accept:"digits",cells:"[data-cell]"},_e=560,Ke=t=>{const e=Math.round(255*I(t));return`rgb(${e} ${e} ${e})`};function Qe(t){const e=()=>({image:t,width:t.naturalWidth,height:t.naturalHeight});return t.complete&&t.naturalWidth?Promise.resolve(e()):new Promise((n,r)=>{const o=()=>{i(),n(e())},a=()=>{i(),r(new Error(`Could not load ${t.src}`))},i=()=>{t.removeEventListener("load",o),t.removeEventListener("error",a)};t.addEventListener("load",o),t.addEventListener("error",a)})}function Ze(t,e=document.createElement("img")){return(t=>{try{return"undefined"!=typeof location&&new URL(t,location.href).origin!==location.origin}catch{return!1}})(t)&&!e.crossOrigin&&(e.crossOrigin="anonymous"),e.decoding="async",e.src=t,e}function tn(t,e,n,r,o,a,i=.5,s=.5){if(o<=0||a<=0||!e.width||!e.height)return;const l=Math.max(o/e.width,a/e.height),c=o/l,d=a/l;t.drawImage(e.image,(e.width-c)*i,(e.height-d)*s,c,d,n,r,o,a)}function en(t,e,n=.08){const r=Math.min(1,420/Math.max(1,t.width,t.height)),o=document.createElement("canvas");o.width=Math.max(1,Math.round(t.width*r)),o.height=Math.max(1,Math.round(t.height*r));const a=o.getContext("2d",{willReadFrequently:!0});if(!a)return t;let i;a.drawImage(t.image,0,0,o.width,o.height);try{i=a.getImageData(0,0,o.width,o.height)}catch{return t}const s=i.data,l=new Uint32Array(256),c=s.length/4,d=t=>.2126*s[t]+.7152*s[t+1]+.0722*s[t+2];for(let t=0;t<s.length;t+=4)l[Math.round(d(t))]++;let u=0,h=255,p=0;for(let t=0;t<256;t++)if(p+=l[t],p>=.02*c){u=t;break}p=0;for(let t=255;t>=0;t--)if(p+=l[t],p>=.02*c){h=t;break}const f=Math.max(1,h-u);for(let t=0;t<s.length;t+=4){let r=I((d(t)-u)/f);e&&(r=1-r),s[t]=s[t+1]=s[t+2]=Math.round(255*(n+(1-n)*r)),s[t+3]=255}return a.putImageData(i,0,0),{image:o,width:o.width,height:o.height}}var nn={strong:1,text:.82,meta:.55,tile:.42,icon:.62},rn=new Set(["IMG","SVG","svg","VIDEO","PICTURE"]),on=t=>[...t.children].flatMap(t=>rn.has(t.tagName)?[t]:[t,...on(t)]);function an(t,e,n,r){const o=document.createElement("canvas");o.width=Math.max(2,Math.round(2*e)),o.height=Math.max(2,Math.round(2*n));const a=[],i=o.getContext("2d");if(!i)return{canvas:o,rects:a};i.scale(2,2),i.fillStyle="#000",i.fillRect(0,0,e,n);const s=r(t),l=t.getBoundingClientRect(),c=l.width/(t.offsetWidth||l.width||1)||1,d=e=>{for(let n=e;n&&n!==t.parentElement;n=n.parentElement){const t=n.dataset?.paint;if(t&&void 0!==nn[t])return nn[t]}return parseFloat(e?getComputedStyle(e).fontWeight:"400")>=500?1:.7},u=t=>{const e=Math.round(255*I(t));return`rgb(${e} ${e} ${e})`},h=on(t),p=[t,...h].filter(t=>{const e=t.dataset?.paint;return"tile"===e||"icon"===e||!e&&rn.has(t.tagName)&&!t.closest("[data-paint]")});for(const t of p){const e=r(t);if(e.w<=0||e.h<=0)continue;const n=t.dataset?.paint;i.fillStyle=u("icon"===n?nn.icon:nn.tile),i.beginPath(),"icon"===n||"svg"===t.tagName.toLowerCase()?i.arc(e.x+e.w/2,e.y+e.h/2,.4*Math.min(e.w,e.h),0,2*Math.PI):i.roundRect(e.x,e.y,e.w,e.h,Math.min(parseFloat(getComputedStyle(t).borderTopLeftRadius)||0,e.h/2)),i.fill(),a.push(e)}const f=document.createTreeWalker(t,4),m=document.createRange();i.textBaseline="middle";for(let t=f.nextNode();t;t=f.nextNode()){const e=t.parentElement;if(!e||e.closest('[data-paint="none"]'))continue;const n=getComputedStyle(e);i.font=`${n.fontStyle} ${n.fontWeight} ${n.fontSize} ${n.fontFamily}`,i.fillStyle=u(d(e)),i.shadowColor=i.fillStyle,i.shadowBlur=4;for(const e of t.data.matchAll(/\S+/g)){m.setStart(t,e.index),m.setEnd(t,e.index+e[0].length);const n=m.getClientRects()[0];if(!n)continue;const r={x:s.x+(n.left-l.left)/c,y:s.y+(n.top-l.top)/c,w:n.width/c,h:n.height/c};i.fillText(e[0],r.x,r.y+r.h/2),a.push(r)}}return i.shadowBlur=0,m.detach?.(),{canvas:o,rects:a}}function sn(t,e,n,r,o,a,i=1,s=.32){for(let l=0;l<n.length;l++){const c=n[l],d=(o-r[l]*(1-s))/s;if(d<=0)continue;const u=d>=1?0:1-d;let h=c.x,p=c.y;if(u>0){const[t,e]=a(c,u);h+=t,p+=e}t.globalAlpha=i*(1-u*u),t.drawImage(e,2*c.x,2*c.y,8,12,h,p,4,6)}t.globalAlpha=1}function ln(t,e){if("undefined"==typeof document||document.getElementById(t))return;const n=document.createElement("style");n.setAttribute("id",t),n.textContent=e,(document.head??document.documentElement).appendChild(n)}var cn={max:3,duration:6e3,label:"Notifications",glint:!0},dn=4200,un="cubic-bezier(.16, 1, .3, 1)",hn=`\n:where(.ascii-toasts){position:relative;margin:0;padding:0;list-style:none;min-height:52px}\n:where(.ascii-toast){position:absolute;left:0;right:0;bottom:0;box-sizing:border-box;display:flex;align-items:center;gap:10px;min-height:52px;padding:8px 8px 8px 10px;border-radius:13px;background:var(--ascii-toast-bg,Canvas);color:var(--ascii-toast-ink,CanvasText);box-shadow:0 0 0 1px rgb(128 128 128 / .22),0 8px 24px rgb(0 0 0 / .12);z-index:calc(10 - var(--d,0));transform-origin:50% 0;translate:0 calc(var(--d,0) * -10px);scale:calc(1 - var(--d,0) * .05);transition:translate 280ms ${un},scale 280ms ${un},opacity 160ms ${un}}\n:where(.ascii-toast) > *{transition:opacity 160ms ${un}}\n:where(.ascii-toast[data-back]) > *{opacity:0}\n:where(.ascii-toasts:not([data-open])) :where(.ascii-toast[data-back]) > *{pointer-events:none}\n:where(.ascii-toasts[data-open]) :where(.ascii-toast){translate:0 calc(var(--d,0) * (-100% - 8px));scale:1}\n:where(.ascii-toasts[data-open]) :where(.ascii-toast[data-back]) > *{opacity:1}\n:where(.ascii-toast[data-forming]){animation:ascii-toast-in 200ms ${un} both}\n:where(.ascii-toast[data-forming],.ascii-toast[data-gone]) > *{opacity:0;transition:none}\n:where(.ascii-toast[data-gone]){opacity:0;pointer-events:none}\n@keyframes ascii-toast-in{from{opacity:0}}\n:where(.ascii-toast-icon){display:grid;place-items:center;flex:none;width:32px;height:32px;border-radius:8px;background:rgb(128 128 128 / .14)}\n:where(.ascii-toast-text){display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}\n:where(.ascii-toast-title){overflow:hidden;font-size:14px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}\n:where(.ascii-toast-body){overflow:hidden;font-size:13px;opacity:.68;text-overflow:ellipsis;white-space:nowrap}\n:where(.ascii-toast-action,.ascii-toast-close){flex:none;border:0;background:rgb(128 128 128 / .14);color:inherit;font:inherit;cursor:pointer}\n:where(.ascii-toast-action){height:32px;padding:0 12px;border-radius:999px;font-size:14px;font-weight:500}\n:where(.ascii-toast-close){display:grid;place-items:center;width:28px;height:28px;border-radius:999px;background:transparent;font-size:18px;line-height:1;opacity:.6}\n@media (prefers-reduced-motion:reduce){:where(.ascii-toast){transition:none}:where(.ascii-toast[data-forming]){animation:none}}\n`,pn=t=>{const e=Math.round(255*I(t));return`rgb(${e} ${e} ${e})`};var fn=t=>{const[e,n,r]=H(t).map(t=>{const e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4});return.2126*e+.7152*n+.0722*r};var mn={lines:3,start:!0,stagger:38,rule:!0},gn=420,vn=t=>`Thought for ${t}s`;var yn={caret:!0,settle:60,stagger:18,reasoningLines:2},Mn="cubic-bezier(.16, 1, .3, 1)",bn=`\n:where(.ascii-reasoning){display:grid;grid-template-rows:1fr;transition:grid-template-rows 260ms ${Mn},opacity 200ms ${Mn}}\n:where(.ascii-reasoning[data-collapsed]){grid-template-rows:0fr;opacity:0}\n:where(.ascii-reasoning-in){min-height:0;overflow:hidden}\n:where(.ascii-reasoning ol){height:calc(var(--ascii-reasoning-lines, 2) * 1.5em);margin:0 0 .5em;padding:0;list-style:none;overflow:hidden;-webkit-mask-image:linear-gradient(to bottom,transparent,#000 45%);mask-image:linear-gradient(to bottom,transparent,#000 45%)}\n:where(.ascii-reasoning li){height:1.5em;line-height:1.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;opacity:.62;translate:0 calc(var(--ascii-reasoning-shift, 0) * -1.5em);transition:translate 240ms ${Mn},opacity 200ms ${Mn}}\n:where(.ascii-reasoning li[data-new]){opacity:0}\n@media (prefers-reduced-motion: reduce){:where(.ascii-reasoning, .ascii-reasoning li){transition:none}}\n`,xn=t=>[...t.children].filter(t=>"IMG"===t.tagName&&void 0!==t.dataset?.asciiPoster);var wn=t=>"string"==typeof t?{src:t}:t;var kn={maxBytes:10485760,develop:720};var Sn={duration:620,collapse:!0,remove:!1},An=16,Cn=new WeakMap;var $n={threshold:88},En=.3;var Ln={standard:{label:"Classic ASCII",chars:" .:-=+*#%@"},asciify:{label:"Asciify",chars:" .:-=+YCIFSA#@"},minimal:{label:"Minimal",chars:" .:+"},detailed:{label:"Detailed",chars:" .,:;itLf1CG80@"},letters:{label:"Letters",chars:" .liLTYCFSAWM"},technical:{label:"Technical",chars:" ._:;+/>=][{}*$#@"},blocks:{label:"Tonal blocks",chars:" ░▒▓█"},braille:{label:"Braille",chars:" ⠁⠃⠇⡇⣇⣧⣷⣿"}},zn=(t,e,n,r)=>"number"==typeof t&&Number.isFinite(t)?Math.min(r,Math.max(n,t)):e;function Rn(t){if(!t)return;if("dots"===t)return" ·∙•●";const e=Ln[t];return e&&Object.prototype.hasOwnProperty.call(Ln,t)?e.chars:t.startsWith(" ")?t:" "+t}var In=(t,e)=>!1===t.cursor?"none":"string"==typeof t.cursor?t.cursor:e;function Tn(t,e,n){let r=null;if(r=Kt({host:t.host,kit:t.kit,layer:"under",look:n=>{const r=t.settings();return{...e(r,n),...r.look}},ink:e=>t.ink(e)??(e?n.dark:n.light),reducedMotion:t.reducedMotion,onFail:()=>{r=null,t.onFail()}}),!r)return null;const o=r.canvas;return{get field(){return r?.field??null},get canvas(){return r?.canvas??o},refresh(){r?.refresh()},play(){r?.field.play()},pause(){r?.field.pause()},destroy(){r?.destroy(),r=null}}}var Pn=()=>"number"==typeof innerWidth&&innerWidth<760,Fn=(t,e)=>({scene:"drift",levels:"auto",color:"ink",shade:0,background:"transparent",vignette:0,speed:t.speed,maxPixelRatio:2,hover:e,lantern:{radius:.16,strength:.35,trail:.6,follow:9},fluid:{radius:.09,refraction:.03,glow:.6},clear:!!t.clear&&{element:t.clear,padding:32,feather:.2,shape:"rect"}}),Wn={light:"#8f8d86",dark:"#64625d"},Bn={id:"drift",name:"Drift",description:"Characters that drift slowly and stay clear around your content, drawn on the GPU.",cellSize:11,speed:1,cursor:!0,mount:t=>Tn(t,t=>({...Fn(t,In(t,"trail")),mark:"glyph",scale:Pn()?1.6:1,charset:t.charset??" .:-=+*#",font:'"Geist Mono", ui-monospace, monospace',fontWeight:400,cellSize:t.cellSize,cellAspect:.62,glyphScale:.86,brightness:.05,trail:{strength:.9,radius:.32}}),Wn)},On={id:"halftone",name:"Halftone",description:"The drifting ground drawn as dots, clear around your content.",cellSize:14,speed:1,cursor:!0,mount:t=>Tn(t,t=>({...Fn(t,In(t,"lantern")),mark:"dot",scale:Pn()?1.8:1,cellSize:t.cellSize,cellAspect:1,dotScale:.64,trail:{strength:.9,radius:.4}}),Wn)},Nn={id:"field",name:"Field",description:"A word becomes the background, drawn by the GPU with a soft wake.",cellSize:13,speed:1,cursor:!0,mount:t=>Tn(t,(t,e)=>({scene:"flow",levels:"auto",charset:t.charset??" .,:-+"+t.text.replace(/\s+/g,"").toUpperCase(),font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:t.cellSize,cellAspect:.8,glyphScale:.76,color:"ink",shade:e?.4:0,background:"transparent",contrast:1.1,vignette:0,speed:t.speed,maxPixelRatio:2,hover:In(t,"trail"),fluid:{radius:.09,refraction:.04,glow:.7,dissipation:1.3},lantern:{radius:.13,strength:.6,trail:.5,follow:11},trail:{strength:.9,radius:.4}}),{light:"#9a9891",dark:"#7d7b75"})},Gn=class{constructor(t=1,e=3.5,n=!1){this.strokes=[],this.advected=[0,0,0],this.previous=null,this.energy=0,this.continuousWake=n,this.decayRate=e,this.aspect=Math.max(.25,Math.min(4,t));const r=n?96:64;this.columns=this.aspect>=1?r:Math.round(r*this.aspect),this.rows=this.aspect>=1?Math.round(r/this.aspect):r,this.front=new Float32Array(this.columns*this.rows*3),this.back=new Float32Array(this.front.length)}get active(){return this.energy>5e-4||this.strokes.length>0}move(t,e){if(!Number.isFinite(t+e))return;if(this.continuousWake&&!this.previous)return void(this.previous={x:t,y:e});const n=this.previous??{x:t-.004,y:e-.001},r=Math.max(-.09,Math.min(.09,t-n.x)),o=Math.max(-.09,Math.min(.09,e-n.y));if(this.previous={x:t,y:e},Math.abs(r)+Math.abs(o)<1e-4)return;const a=Math.min(1,25*Math.hypot(r*this.aspect,o)+.06);this.strokes.push({x:t,y:e,dx:r,dy:o,speed:a,fromX:n.x,fromY:n.y}),this.strokes.length>12&&this.strokes.shift()}leave(){this.previous=null}clear(){this.front.fill(0),this.back.fill(0),this.strokes.length=0,this.previous=null,this.energy=0}read(t,e,n,r){const o=Math.max(0,Math.min(this.columns-1.001,e*(this.columns-1))),a=Math.max(0,Math.min(this.rows-1.001,n*(this.rows-1))),i=Math.floor(o),s=Math.floor(a),l=o-i,c=a-s,d=3*(s*this.columns+i),u=d+3*this.columns,h=1-l,p=1-c;r[0]=(t[d]*h+t[d+3]*l)*p+(t[u]*h+t[u+3]*l)*c,r[1]=(t[d+1]*h+t[d+4]*l)*p+(t[u+1]*h+t[u+4]*l)*c,r[2]=(t[d+2]*h+t[d+5]*l)*p+(t[u+2]*h+t[u+5]*l)*c}sample(t,e,n){this.read(this.front,t,e,n)}step(t){if(!this.active)return;const e=Math.max(0,Math.min(.05,t)),n=Math.exp(-e*this.decayRate),r=Math.exp(-e*(this.decayRate+.5)),o=Math.max(1,this.aspect),a=Math.max(1,1/this.aspect);let i=0;for(let t=0;t<this.rows;t++)for(let s=0;s<this.columns;s++){const l=3*(t*this.columns+s),c=s/(this.columns-1),d=t/(this.rows-1),u=this.continuousWake?.65:2,h=c-this.front[l]*e*u,p=d-this.front[l+1]*e*u;this.read(this.front,h,p,this.advected);let f=this.advected[0]*n,m=this.advected[1]*n,g=this.advected[2]*r;for(const t of this.strokes){let e=(c-t.x)*o,n=(d-t.y)*a;if(this.continuousWake){const r=(c-t.fromX)*o,i=(d-t.fromY)*a,s=(t.x-t.fromX)*o,l=(t.y-t.fromY)*a,u=Math.max(0,Math.min(1,(r*s+i*l)/(s*s+l*l||1)));e=r-s*u,n=i-l*u;const h=e*e+n*n;if(h>.0225)continue;const p=Math.exp(-h/.0032),v=Math.hypot(t.dx*o,t.dy*a),y=Math.min(.025,.55*v);f+=(4.2*t.dx-n*y)*p,m+=(4.2*t.dy+e*y)*p,g=Math.max(g,Math.min(.7,18*v)*p);continue}const r=e*e+n*n;if(r>.045)continue;const i=Math.exp(-r/.0075),s=t.speed;f+=(2.8*t.dx-n*s*.16)*i,m+=(2.8*t.dy+e*s*.16)*i,g+=s*i*.3}this.back[l]=Math.max(-.18,Math.min(.18,f)),this.back[l+1]=Math.max(-.18,Math.min(.18,m)),this.back[l+2]=Math.min(.8,g),i=Math.max(i,Math.abs(f),Math.abs(m),g)}[this.front,this.back]=[this.back,this.front],this.strokes.length=0,this.energy=i,this.active||this.clear()}};var qn=" .:+-=xICA$FY#@",Hn=.58,Dn=72649.5/59542.5;var jn={id:"fluid",name:"Fluid",description:"Flowing folds with a soft wake behind the cursor. The original Asciify hero.",cellSize:7,speed:1,cursor:!0,opacity:.7,mount:function(t){const{host:e}=t;let n=new Gn(1),r=1,o=12,a=0,i=!1,s=null;const l=[],c=(e,n)=>((t,e,n)=>Math.max(t,Math.sqrt(e*n*Hn/26e3)))(t.settings().cellSize,e,n),d=K({host:e,kit:t.kit,layer:"under",look:()=>{const n=t.settings();return{mark:"glyph",charset:n.charset??qn,font:'"JetBrains Mono", monospace',fontWeight:400,cellSize:c(e.clientWidth||1,e.clientHeight||1)/Hn,cellAspect:Hn,glyphScale:.9,cellFit:"fill",maxPixelRatio:1.5,color:"ink",shade:0,levels:"none",fit:"cover",gamma:1,contrast:Dn,brightness:-.0004316244699164449-.5/Math.max(1,Array.from(n.charset??qn).length-1),...n.look}},ink:e=>t.ink(e)??"#8f8d86",resolution:(t,e)=>{const n=Math.max(192,Math.min(384,Math.ceil(Math.max(t,e*Hn)/c(t,e)))),r=t/e;return r>=1?[n,Math.max(1,Math.round(n/r))]:[Math.max(1,Math.round(n*r)),n]},reducedMotion:t.reducedMotion,onFail:()=>t.onFail(),paint:({pen:c,width:d,height:u,w:h,h:p,now:f,still:m})=>{const g=t.settings(),v=a?Math.min(.05,(f-a)/1e3):1/60;a=f,m||(o+=v*g.speed);const y=h/p;if(Math.abs(y-r)>.01&&(n=new Gn(y),r=y),m||!g.cursor)n.clear(),l.length=0;else{const t=e.getBoundingClientRect();if(t.width&&t.height)for(const e of l)n.move((e.x-t.left)/t.width,(e.y-t.top)/t.height);l.length=0,i&&(n.leave(),i=!1),n.step(v)}s&&s.width===d&&s.height===u||(s=c.createImageData(d,u));const M=s.data;!function(t,e,n,r,o,a){const i=[0,0,0],s=a.active;for(let l=0;l<n;l++)for(let c=0;c<e;c++){const d=c/e,u=l/n;s&&a.sample(d,u,i);const h=(d-.5-i[0])*r,p=u-.5-i[1],f=h+.22*Math.sin(5.2*p+.17*o)+.15*Math.sin(2.4*h-3.1*p-.1*o),m=p+.19*Math.sin(3.5*h+.13*o),g=Math.hypot(.8*f+.18,1.1*m),v=.5+.5*Math.sin(14*g-2.8*f+1.4*Math.sin(5*m)-.24*o),y=.5+.5*Math.sin(3.6*f-2.9*m+.09*o),M=Math.max(0,Math.min(1,v*v*(.48+.32*y)-.075+.75*i[2])),b=Math.round(255*M),x=4*(l*e+c);t[x]=t[x+1]=t[x+2]=b,t[x+3]=255}}(M,d,u,y,o,n);for(let t=0;t<M.length;t+=4){const e=M[t]<10?0:Math.min(255,1.45*M[t]);M[t]=M[t+1]=M[t+2]=.299*e+e*(185/232)*.587,M[t+3]=255}return c.putImageData(s,0,0),!0}});if(!d)return null;const u=t=>{if(t.target instanceof Element&&t.target.closest("button, a, input, select, summary, textarea"))return i=!0,void d.kick();l.push({x:t.clientX,y:t.clientY}),l.length>6&&l.shift(),d.kick()},h=()=>{i=!0,d.kick()};return e.addEventListener("pointermove",u),e.addEventListener("pointerdown",u),e.addEventListener("pointerleave",h),e.addEventListener("pointercancel",h),{get field(){return d.field},get canvas(){return d.canvas},refresh:()=>d.refresh(),play:()=>{a=0,d.play()},pause:()=>d.pause(),destroy(){e.removeEventListener("pointermove",u),e.removeEventListener("pointerdown",u),e.removeEventListener("pointerleave",h),e.removeEventListener("pointercancel",h),d.destroy()}}}},Un="#6f6d67",Vn="#8f8d86",Xn={x:-1,y:-1,users:0},Yn=t=>{Xn.x=t.clientX,Xn.y=t.clientY};function Jn(t,e,n=0){if("undefined"==typeof document)return null;const{host:r}=t,o=document.createElement("canvas");let a=null;try{a=o.getContext("2d")}catch{a=null}if(!a)return null;const i=a,s=U();"static"===getComputedStyle(r).position&&s.set(r,"position","relative"),s.set(r,"isolation","isolate"),o.dataset.asciiKit="",o.setAttribute("aria-hidden","true"),o.setAttribute("style","position:absolute;inset:0;width:100%;height:100%;pointer-events:none;border-radius:inherit;z-index:-1"),r.appendChild(o);let l,c=j(r),d="";const u=()=>{d=N(t.ink(c),r,c?Vn:Un)??Vn;const e=t.settings().accent;l=e?N(e,r)??void 0:void 0};u();let h=0,p=!0,f=!1,m=!1,g=0,v=0,y=0,M=!1,b=9,x=9,w=1,k=1,S=n;const A={x:.5,y:.5},C=()=>!!(t.reducedMotion()??B()),$=()=>{const n=t.settings(),r=performance.now(),a={fontSize:n.cellSize,chars:n.charset,ditherStrength:n.dither,lightMode:!c,ink:d,accent:l,elapsed:x,speed:n.speed};for(i.globalAlpha=1,i.globalCompositeOperation="source-over";S>0;S--)e(i,w,k,b,A,a);e(i,w,k,b,A,a),(t=>{if(!t||!t.isConnected)return;const e=X(o,t);if(!e.w||!e.h)return;const n=.71*e.w+32,r=.71*e.h+32,a=o.width/w||1;i.save(),i.setTransform(a*n,0,0,a*r,a*(e.x+e.w/2),a*(e.y+e.h/2));const s=i.createRadialGradient(0,0,0,0,0,1);s.addColorStop(0,"rgba(0,0,0,1)"),s.addColorStop(.72,"rgba(0,0,0,1)"),s.addColorStop(1,"rgba(0,0,0,0)"),i.globalCompositeOperation="destination-out",i.fillStyle=s,i.fillRect(-1,-1,2,2),i.restore()})(n.clear),y=.9*y+.1*(performance.now()-r),o.dataset.painted=""},E=e=>{if(h=0,m||f||!p||"undefined"!=typeof document&&document.hidden)return void(g=v=0);const n=C(),r=t.settings(),a=v?e-v:17;if(v=e,!n&&y>4.5&&a<12&&(M=!M))return void(h=requestAnimationFrame(E));const i=g?Math.min(.05,(e-g)/1e3):0;if(g=e,n||(b+=i*r.speed,x+=i),r.cursor&&Xn.x>=0){const t=o.getBoundingClientRect();t.width&&t.height&&(A.x+=.07*((Xn.x-t.left)/t.width-A.x),A.y+=.07*((Xn.y-t.top)/t.height-A.y))}else r.cursor||(A.x+=.07*(.5-A.x),A.y+=.07*(.5-A.y));$(),n||(h=requestAnimationFrame(E))},L=()=>{h||m||f||!p||(h=requestAnimationFrame(E))},z=()=>{if(m)return;const t=Math.min(2,"number"==typeof devicePixelRatio&&devicePixelRatio||1);w=Math.max(1,o.clientWidth||r.clientWidth||1),k=Math.max(1,o.clientHeight||r.clientHeight||1),o.width=Math.round(w*t),o.height=Math.round(k*t),i.setTransform(t,0,0,t,0,0),S=n,p&&!f&&$(),L()};z();const R="function"==typeof ResizeObserver?new ResizeObserver(z):null;R?.observe(r);const I="function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{p=t.isIntersecting,g=0,p?L():h&&(cancelAnimationFrame(h),h=0)},{rootMargin:"64px"}):null;I?.observe(r);const T=()=>{g=0,L()};document.addEventListener("visibilitychange",T);const P="function"==typeof matchMedia?matchMedia("(prefers-reduced-motion: reduce)"):null;P?.addEventListener?.("change",T),0===Xn.users++&&"function"==typeof addEventListener&&addEventListener("pointermove",Yn,{passive:!0});const F="object"==typeof document.fonts?document.fonts:null,W=()=>{m||!p||f||($(),L())};F?.addEventListener?.("loadingdone",W),F?.ready?.then(W,()=>{});let O=0;const G=()=>{O||m||(O=requestAnimationFrame(()=>{O=0,m||(c=j(r),u(),C()&&$(),L())}))},q="function"==typeof matchMedia?matchMedia("(prefers-color-scheme: dark)"):null;q?.addEventListener?.("change",G);const H="function"==typeof MutationObserver?new MutationObserver(G):null;for(const t of[document.documentElement,document.body])t&&H?.observe(t,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]});return{field:null,canvas:o,refresh(){m||(c=j(r),u(),C()&&p&&!f&&$(),L())},play(){f&&(f=!1,g=0,L())},pause(){f=!0,h&&cancelAnimationFrame(h),h=0},destroy(){m||(m=!0,h&&cancelAnimationFrame(h),O&&cancelAnimationFrame(O),h=O=0,R?.disconnect(),I?.disconnect(),H?.disconnect(),document.removeEventListener("visibilitychange",T),P?.removeEventListener?.("change",T),q?.removeEventListener?.("change",G),F?.removeEventListener?.("loadingdone",W),0===--Xn.users&&"function"==typeof removeEventListener&&removeEventListener("pointermove",Yn),o.remove(),o.width=o.height=0,s.restore())}}}function _n(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 n=t.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);return n?{r:+n[1],g:+n[2],b:+n[3]}:null}function Kn(t){return t*t*t*(t*(6*t-15)+10)}function Qn(t,e,n){return t+(e-t)*n}function Zn(t,e){let n=127*t+311*e;return n^=n>>13,(n*(n*n*15731+789221)+1376312589&2147483647)/2147483647}function tr(t,e){const n=Math.floor(t),r=Math.floor(e),o=e-r,a=Kn(t-n),i=Kn(o),s=Zn(n,r),l=Zn(n+1,r),c=Zn(n,r+1),d=Zn(n+1,r+1);return Qn(Qn(s,l,a),Qn(c,d,a),i)}function er(t,e){return(.5*tr(t,e)+.25*tr(2.1*t,2.1*e)+.125*tr(4.3*t,4.3*e))/.875}var nr='"Geist Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace';function rr(t){const e=("function"==typeof t.getTransform?t.getTransform().a:1)||1;return t=>Math.round(t*e)/e}var or={r:111,g:109,b:103},ar={r:143,g:141,b:134};function ir(t,e,n){return Math.min(1,Math.max(0,(t-e)/(n-e)))}function sr(t,e=.3,n=.95){return e+(n-e)*Math.min(1,Math.max(0,t))}var lr=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function cr(t,e,n,r,o=0){const a=(lr[(3&r)<<2|3&n]+.5)/16;return Math.min(e-1,Math.max(0,Math.floor(t*(e-1)+a*Math.min(1,Math.max(0,o)))))}var dr={id:"aurora",name:"Aurora",description:"Soft bands of light drift across the page and ripple under the cursor.",cellSize:13,speed:.6,cursor:!0,mount:t=>Jn(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=13,chars:s=" .:-=+*#%",color:l,accentColor:c,speed:d=1,layers:u=5,softness:h=1.2,mouseRipple:p=.2,lightMode:f=!1}=a,m=Array.from(s),g=.62*i,v=1.3*i,y=Math.ceil(e/g),M=Math.ceil(n/v);t.clearRect(0,0,e,n),t.font=`${i}px ${nr}`,t.textBaseline="top";const b=f?or:ar;let x=b.r,w=b.g,k=b.b;const S=rr(t);if(l){const t=_n(l);t&&(x=t.r,w=t.g,k=t.b)}let A=x,C=w,$=k;const E=c?_n(c):null;E&&(A=E.r,C=E.g,$=E.b);const L=r*d,z=[];for(let t=0;t<u;t++){const e=Zn(17*t,31*t+7),n=Zn(23*t+5,11*t);z.push({fx:.8+2.2*e,fy:1.2+1.8*n,phase:e*Math.PI*4,dt:(.3+.5*Zn(7*t,13*t+3))*(t%2==0?1:-1),amp:.55+.45*Zn(29*t,3*t)})}for(let e=0;e<M;e++){const n=e/M;for(let r=0;r<y;r++){const i=r/y,s=i-o.x,l=n-o.y,c=Math.sqrt(s*s+l*l),d=p*Math.exp(-c*c/.06),f=i+s*d,M=n+l*d;let b=0,R=0;for(let t=0;t<u;t++){const{fx:e,fy:n,phase:r,dt:o,amp:a}=z[t];b+=Math.sin(f*e*Math.PI*2+L*o+r)*Math.cos(M*n*Math.PI*2+L*o*.7+1.3*r)*a,R+=a}const I=b/R,T=.5+.5*Math.tanh(I*h*2.2),P=ir(T,.48,.94);if(P<=0)continue;const F=m[cr(P,m.length,r,e,a.ditherStrength)];if(" "===F)continue;const W=!!E&&T>.86,B=sr(P);t.fillStyle=W?`rgba(${A},${C},${$},${B})`:`rgba(${x},${w},${k},${B})`,t.fillText(F,S(r*g),S(e*v))}}}(t,e,n,r,o,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};function ur(t,e,n,r,o,a={}){if(n<=0||r<=0)return;const i=Math.max(6,a.fontSize??12),s=.62*i,l=1.2*i,c=_n(a.color??a.accentColor??"")??(a.lightMode?or:ar),d=rr(e),u=o*Math.max(0,a.speed??.35),h=n/r;e.clearRect(0,0,n,r),e.font=`${i}px ${nr}`,e.textBaseline="top";const p=Array.from(a.chars||" .:-=+*#%@");for(let o=0;o<r;o+=l)for(let i=0;i<n;i+=s){const n=i/r,f=o/r,m=ir(Math.min(1,Math.max(0,t(n,f,h,u))),.06,.72);if(m<=0)continue;const g=p[cr(m,p.length,Math.round(i/s),Math.round(o/l),a.ditherStrength)];" "!==g&&(e.fillStyle=`rgba(${c.r},${c.g},${c.b},${sr(m)})`,e.fillText(g,d(i),d(o)))}}var hr=(t,e,n,r)=>{const o=Math.sin(7*t+Math.sin(5*e+.16*r)),a=Math.cos(8*e+Math.cos(4*t-.12*r)),i=Math.sin(6*(t+e)-.13*r);return.85*Math.pow(Math.max(0,1-Math.abs(o+a+.5*i)),7)},pr={id:"caustics",name:"Caustics",description:"Fine pools of light that drift like water across stone.",cellSize:12,speed:1,cursor:!1,mount:t=>Jn(t,(t,e,n,r,o,a)=>ur(hr,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))},fr=1,mr=2,gr=4,vr=8,yr={3:"─",12:"│",9:"┌",10:"┐",5:"└",6:"┘",11:"┬",7:"┴",13:"├",14:"┤",15:"┼",[fr]:"╶",[mr]:"╴",[gr]:"╵",[vr]:"╷"};var Mr={id:"circuit",name:"Circuit",description:"Circuit traces with signals running along them.",cellSize:13,speed:1,cursor:!1,mount:t=>Jn(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,pulseColor:i="#ffffff",color:s="#00ff88",density:l=.38,speed:c=1,lightMode:d=!1}=o,u=.62*a,h=1.4*a,p=Math.ceil(e/u),f=Math.ceil(n/h),m=_n(s)??{r:0,g:255,b:136},g=_n(i)??{r:255,g:255,b:255},v=(t,e)=>{if(Zn(17*t+1,7*e+2)>l)return 0;let n=0;return t+1<p&&Zn(17*t+1,7*e+2)>.15&&(n|=1),t-1>=0&&Zn(17*(t-1)+1,7*e+2)>.15&&(n|=2),e+1<f&&Zn(17*t+1,7*(e+1)+2)>.15&&(n|=8),e-1>=0&&Zn(17*t+1,7*(e-1)+2)>.15&&(n|=4),n};t.clearRect(0,0,e,n),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";const y=r*c;for(let e=0;e<f;e++)for(let n=0;n<p;n++){const r=v(n,e);if(0===r)continue;const o=yr[r]??"·",a=(8*y+40*Zn(n,23*e))%p,i=(6*y+40*Zn(17*e,11*n))%f,s=(1&r||2&r)&&Math.abs(n-a)<1.5,l=(4&r||8&r)&&Math.abs(e-i)<1.5,c=s||l,d=.25+.35*Zn(3*n,5*e);c?(t.globalAlpha=.95,t.fillStyle=`rgb(${g.r},${g.g},${g.b})`):(t.globalAlpha=d,t.fillStyle=`rgb(${m.r},${m.g},${m.b})`),t.fillText(o,n*u,e*h)}t.globalAlpha=1}(t,e,n,r,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,pulseColor:a.accent??D(a.ink,"#ffffff",.7)}))},br=(t,e,n,r)=>{const o=3.2*e+.36*Math.sin(3.4*t+.18*r)+.19*Math.cos(6*t-2*e+.12*r),a=.5+.5*Math.cos(o*Math.PI*6);return Math.pow(a,4)*(.35+.65*e)},xr={id:"contour",name:"Contour",description:"Fine topographic lines with a slow, rolling drift.",cellSize:12,speed:1,cursor:!1,mount:t=>Jn(t,(t,e,n,r,o,a)=>ur(br,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))};var wr={id:"dna",name:"DNA",description:"Double helices scroll past with base-pair letters.",cellSize:13,speed:1,cursor:!1,mount:t=>Jn(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,baseChars:i="ATCG",bridgeChars:s="-=≡",color:l="#00e5ff",color2:c="#ff4081",bridgeColor:d="#88ffcc",speed:u=1,helixCount:h,lightMode:p=!1}=o,f=.62*a,m=1.4*a,g=Math.ceil(e/f),v=Math.ceil(n/m),y=h??Math.max(1,Math.floor(e/80)),M=g/y,b=_n(l)??{r:0,g:229,b:255},x=_n(c)??{r:255,g:64,b:129},w=_n(d)??{r:136,g:255,b:204};t.clearRect(0,0,e,n),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";const k=r*u,S=.35*M;for(let e=0;e<y;e++){const n=M*(e+.5);for(let r=0;r<v;r++){const o=r/v*Math.PI*6-1.8*k,a=n+Math.sin(o)*S,l=n+Math.sin(o+Math.PI)*S,c=Math.round(a),d=Math.round(l);if(c<0||c>=g)continue;const u=Zn(31*e+7*r,3),h=i[Math.floor(u*i.length)],p=.5*(Math.sin(o)+1),y=.5*(Math.sin(o+Math.PI)+1);if(t.globalAlpha=.35+.65*p,t.fillStyle=`rgb(${b.r},${b.g},${b.b})`,t.fillText(h,c*f,r*m),d>=0&&d<g){const n=Zn(53*e+11*r,7),o=i[Math.floor(n*i.length)];t.globalAlpha=.35+.65*y,t.fillStyle=`rgb(${x.r},${x.g},${x.b})`,t.fillText(o,d*f,r*m)}if(r%3==0){const n=Math.min(c,d),o=Math.max(c,d);if(o-n>1){const a=Zn(17*r+43*e,5),i=s[Math.floor(a*s.length)],l=.25*(p+y)+.2;t.globalAlpha=l,t.fillStyle=`rgb(${w.r},${w.g},${w.b})`;for(let e=n+1;e<o;e++)t.fillText(i,e*f,r*m)}}}}t.globalAlpha=1}(t,e,n,r,{fontSize:a.fontSize,color:a.ink,color2:a.accent??D(a.ink,"#ffffff",.55),bridgeColor:D(a.ink,"#0c0d0b",.35)}))},kr=(t,e,n,r)=>{const o=7*e+.55*Math.sin(2.2*t+.09*r)+.22*Math.sin(4.8*t-.07*r),a=.5+.5*Math.sin(o);return Math.pow(a,5)*(.35+.65*e)+.08*Math.pow(.5+.5*Math.sin(17*o),3)*a},Sr={id:"dune",name:"Dune",description:"Layered sand ridges with slow-moving light and fine grain.",cellSize:12,speed:1,cursor:!1,mount:t=>Jn(t,(t,e,n,r,o,a)=>ur(kr,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))},Ar=(t,e,n,r)=>{const o=48*t+4*Math.sin(2.6*e+.08*r)+1.5*Math.sin(7*e-2*t);return Math.pow(.5+.5*Math.sin(o),10)*(.35+.55*Math.pow(Math.sin(2*e+.4),2))},Cr={id:"etch",name:"Etch",description:"Cut-grain lines follow a slow, sculpted current.",cellSize:12,speed:1,cursor:!1,mount:t=>Jn(t,(t,e,n,r,o,a)=>ur(Ar,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))},$r=(t,e,n,r)=>{const o=2.8*t+1.8*e+.018*r,a=1.2*t-3.2*e,i=Math.abs(2*(o-Math.floor(o))-1),s=Math.abs(2*(a-Math.floor(a))-1);return.85*Math.pow(Math.min(i,s),1.8)},Er={id:"facet",name:"Facet",description:"Quiet folded planes catch light along their edges.",cellSize:12,speed:1,cursor:!1,mount:t=>Jn(t,(t,e,n,r,o,a)=>ur($r,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))};var Lr={id:"fire",name:"Fire",description:"A cellular flame rising from the bottom edge.",cellSize:13,speed:1,cursor:!1,mount:t=>Jn(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,chars:i=" .,:;i+xX#&@",color:s="#ff4500",hotColor:l="#ffe066",intensity:c=.85,wind:d=0,speed:u=1,lightMode:h=!1}=o,p=.62*a,f=1.4*a,m=Math.ceil(e/p),g=Math.ceil(n/f),v=m*g,y="__fire_heat__",M=t.canvas;let b=M[y];b&&b.length===v||(b=new Float32Array(v),M[y]=b);const x=.016*u*.18,w=d*u*.8,k=g-1,S=r*u;for(let t=0;t<m;t++){const e=(.6*(.5*Math.sin(.31*t+4.1*S)+.5)+.4*(.5*Math.sin(.73*t-2.7*S)+.5))*c;b[k*m+t]=Math.min(1,e+.15*Math.random()*c),k>0&&(b[(k-1)*m+t]=Math.min(1,.85*e+.1*Math.random()*c))}const A=new Float32Array(v);for(let t=0;t<g-2;t++)for(let e=0;e<m;e++){const n=.4*b[(t+1)*m+e]+.25*b[(t+2)*m+Math.max(0,Math.min(m-1,e+Math.round(w)))]+.175*b[(t+1)*m+Math.max(0,e-1)]+.175*b[(t+1)*m+Math.min(m-1,e+1)];A[t*m+e]=Math.max(0,n-x-.02*Math.random()*u)}for(let t=0;t<m;t++)A[(g-1)*m+t]=b[(g-1)*m+t],g>1&&(A[(g-2)*m+t]=b[(g-2)*m+t]);M[y]=A;const C=_n(s)??{r:255,g:69,b:0},$=_n(l)??{r:255,g:224,b:102};t.clearRect(0,0,e,n),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";for(let e=0;e<g;e++)for(let n=0;n<m;n++){const r=A[e*m+n];if(r<.03)continue;const o=i[Math.min(i.length-1,Math.floor(r*i.length))];if(" "===o)continue;const a=Math.min(1,1.2*r),s=C.r+($.r-C.r)*a|0,l=C.g+($.g-C.g)*a|0,c=C.b+($.b-C.b)*a|0,d=h?1-.3*r:Math.min(1,r+.15);t.globalAlpha=d,t.fillStyle=`rgb(${s},${l},${c})`,t.fillText(o,n*p,e*f)}t.globalAlpha=1}(t,e,n,a.elapsed,{fontSize:a.fontSize,chars:a.chars,color:a.ink,hotColor:a.accent??D(a.ink,"#ffffff",.6),speed:a.speed}),48)};var zr={id:"grid",name:"Grid",description:"Scan bands roll down a character grid and glitch near the cursor.",cellSize:12,speed:1,cursor:!0,mount:t=>Jn(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=12,chars:s="·-=+|/",accentColor:l,color:c,bands:d=3,speed:u=1,bandWidth:h=.12,glitch:p=!0,lightMode:f=!1}=a,m=l??(f?"#6b8700":"#d4ff00"),g=.62*i,v=1.4*i,y=Math.ceil(e/g),M=Math.ceil(n/v);t.clearRect(0,0,e,n),t.font=`${i}px monospace`,t.textBaseline="top";let b=255,x=255,w=255;if(f&&(b=55,x=55,w=55),c){const t=_n(c);t&&(b=t.r,x=t.g,w=t.b)}let k=212,S=255,A=0;const C=_n(m);C&&(k=C.r,S=C.g,A=C.b);const $=r*u;for(let e=0;e<M;e++)for(let n=0;n<y;n++){const r=e/M,a=((r*d-.5*$)%1+1)%1,i=Math.max(0,1-a/h),l=.35*(.5*Zn(3*n,7*e)+.5);let c=0;if(p){const t=n/y-o.x,a=r-o.y,i=Math.sqrt(t*t+a*a);if(i<.18){const t=Zn(11*n+Math.floor(12*$),5*e);c=Math.max(0,1-i/.18)*(t>.5?t-.3:0)}}const u=Math.min(1,l+.8*i+.6*c);if(u<.04)continue;const m=s[Math.floor(u*(s.length-1))],C=i>.55,E=f?.82*u:.12*u;t.fillStyle=C?`rgba(${k},${S},${A},${f?.92:.28})`:`rgba(${b},${x},${w},${E})`,t.fillText(m,n*g,e*v)}}(t,e,n,r,o,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))},Rr=(t,e,n,r)=>{const o=.12+.06*Math.sin(.1*r),a=Math.sin(68*t),i=Math.sin(68*(t*Math.cos(o)+e*Math.sin(o)));return.8*Math.pow((a+i+2)/4,3)},Ir={id:"moire",name:"Moiré",description:"Two fine line fields overlap into broad, shifting bands.",cellSize:12,speed:1,cursor:!1,mount:t=>Jn(t,(t,e,n,r,o,a)=>ur(Rr,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))};var Tr={id:"morph",name:"Morph",description:"Every cell shimmers at its own frequencies.",cellSize:14,speed:1,cursor:!1,mount:t=>Jn(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=14,chars:i=" ·∙•:-=+*#",color:s,accentColor:l,speed:c=.5,harmonics:d=3,lightMode:u=!1}=o,h=l??(u?"#6b8700":"#d4ff00"),p=.62*a,f=1.4*a,m=Math.ceil(e/p),g=Math.ceil(n/f);t.clearRect(0,0,e,n),t.font=`${a}px monospace`,t.textBaseline="top";let v=255,y=255,M=255;if(u&&(v=55,y=55,M=55),s){const t=_n(s);t&&(v=t.r,y=t.g,M=t.b)}let b=212,x=255,w=0;const k=_n(h);k&&(b=k.r,x=k.g,w=k.b);const S=r*c,A=Array.from({length:d},(t,e)=>1/(e+1)).reduce((t,e)=>t+e,0);for(let e=0;e<g;e++)for(let n=0;n<m;n++){let r=0;for(let t=0;t<d;t++){const o=.18+1.4*Zn(n*(t+3)+7,e*(t+5)+11),a=Zn(n*(t+7),e*(t+9)+3)*Math.PI*2,i=1/(t+1);r+=Math.sin(S*o+a)*i}const o=.5*(r/A+1);if(o<.28)continue;const a=(o-.28)/.72,s=i[Math.min(i.length-1,Math.floor(a*i.length))],l=o>.88,c=u?.82*a:.13*a;t.fillStyle=l?`rgba(${b},${x},${w},${u?.92:.28})`:`rgba(${v},${y},${M},${c})`,t.fillText(s,n*p,e*f)}}(t,e,n,r,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var Pr={id:"noise",name:"Noise",description:"A slow fractal noise field that warps around the cursor.",cellSize:13,speed:.5,cursor:!0,mount:t=>Jn(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=13,chars:s=" .:-=+*#%@",accentColor:l,color:c,octaves:d=4,speed:u=1,scale:h=1,accentThreshold:p=.9,mouseWarp:f=.3,lightMode:m=!1}=a,g=Array.from(s),v=.62*i,y=1.3*i,M=Math.ceil(e/v),b=Math.ceil(n/y);t.clearRect(0,0,e,n),t.font=`${i}px ${nr}`,t.textBaseline="top";const x=m?or:ar;let w=x.r,k=x.g,S=x.b;const A=rr(t);if(c){const t=_n(c);t&&(w=t.r,k=t.g,S=t.b)}let C=w,$=k,E=S;const L=l?_n(l):null;L&&(C=L.r,$=L.g,E=L.b);const z=.035*h,R=r*u,I=Math.min(6,Math.max(1,d)),T=(t,e)=>{let n=0,r=.5,o=1,a=0;for(let i=0;i<I;i++)n+=tr(t*o,e*o)*r,a+=r,r*=.5,o*=2.1;return n/a};for(let e=0;e<b;e++)for(let n=0;n<M;n++){const r=n*z+.06*R,i=e*z*1.3-.04*R,s=n/M-o.x,l=e/b-o.y,c=Math.sqrt(s*s+l*l),d=f>0?.12*Math.max(0,1-c/f):0,u=ir(.5*T(r+d*Math.sin(1.3*R+8*l),i+d*Math.cos(.9*R+8*s))+.5,.7,.83);if(u<=0)continue;const h=g[cr(u,g.length,n,e,a.ditherStrength)];if(" "===h)continue;const m=!!L&&u>p,x=sr(u);t.fillStyle=m?`rgba(${C},${$},${E},${x})`:`rgba(${w},${k},${S},${x})`,t.fillText(h,A(n*v),A(e*y))}}(t,e,n,r,o,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var Fr={id:"pulse",name:"Pulse",description:"Rings of characters ripple out from the cursor.",cellSize:14,speed:1,cursor:!0,mount:t=>Jn(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=". · ○ ◎ ●",accentColor:l,color:c,rings:d=5,speed:u=1,sharpness:h=4,lightMode:p=!1}=a,f=l??(p?"#007a5e":"#00ffcc");t.clearRect(0,0,e,n),t.textBaseline="middle",t.textAlign="center";const m=e*o.x,g=n*o.y,v=1.6*Math.sqrt(m*m+g*g)+.2*Math.sqrt(e*e+n*n);let y=255,M=255,b=255;if(p&&(y=55,M=55,b=55),c){const t=_n(c);t&&(y=t.r,M=t.g,b=t.b)}let x=0,w=255,k=204;const S=_n(f);S&&(x=S.r,w=S.g,k=S.b);const A=s.replace(/ /g,"").split("");if(0===A.length)return;const C=Math.ceil(e/i),$=Math.ceil(n/i);for(let e=0;e<$;e++)for(let n=0;n<C;n++){const o=n*i+.5*i,a=e*i+.5*i,s=o-m,l=a-g,c=Math.sqrt(s*s+l*l)/v;let f=0;for(let t=0;t<d;t++){const e=(r*u*.38+t/d)%1,n=Math.abs(c-e),o=Math.max(0,1-n*v/(i*(12-h)));f+=Math.cos(o*Math.PI*.5)*o}if(f=Math.min(1,f),f<.02)continue;const S=f>.6;t.font=`${i}px monospace`;const C=Math.floor(f*(A.length-1)),$=A[Math.min(C,A.length-1)],E=p?.88*f:.22*f;t.fillStyle=S?`rgba(${x},${w},${k},${Math.min(p?.95:.4,.55*f)})`:`rgba(${y},${M},${b},${E})`,t.fillText($,o,a)}t.textAlign="left"}(t,e,n,r,o,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var Wr={id:"rain",name:"Rain",description:"Columns of falling characters with bright heads.",cellSize:13,speed:1,cursor:!1,mount:t=>Jn(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,chars:i="0123456789ABCDEF@#$&*+=/<>",accentColor:s,color:l,speed:c=1,density:d=.55,tailLength:u=14,lightMode:h=!1}=o,p=s??(h?"#6b8700":"#d4ff00"),f=.62*a,m=1.4*a,g=Math.ceil(e/f),v=Math.ceil(n/m);t.clearRect(0,0,e,n),t.font=`${a}px monospace`,t.textBaseline="top";let y=255,M=255,b=255;if(h&&(y=55,M=55,b=55),l){const t=_n(l);t&&(y=t.r,M=t.g,b=t.b)}let x=212,w=255,k=0;const S=_n(p);S&&(x=S.r,w=S.g,k=S.b);const A=v+u;for(let e=0;e<g;e++){if(Zn(17*e,3)>d)continue;const n=(.5+1.5*Zn(31*e,7))*c,o=Zn(13*e,11)*A,a=Math.floor((r*n*7+o)%A),s=e*f;for(let n=0;n<=u;n++){const o=a-(u-n);if(o<0||o>=v)continue;const l=o*m,c=Zn(53*e+Math.floor(5*r+n),7*o),d=i[Math.floor(c*i.length)],p=n/u;if(n===u)t.fillStyle=`rgba(${x},${w},${k},${h?.7:.85})`;else{const e=h?.85*p:.15*p;t.fillStyle=`rgba(${y},${M},${b},${e})`}t.fillText(d,s,l)}}}(t,e,n,r,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var Br={id:"silk",name:"Silk",description:"Long ribbons that follow a slow flow field.",cellSize:13,speed:1,cursor:!1,mount:t=>Jn(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,color:i,accentColor:s,speed:l=.4,layers:c=4,turbulence:d=.8,lightMode:u=!1}=o,h=.62*a,p=1.3*a,f=Math.ceil(e/h),m=Math.ceil(n/p);t.clearRect(0,0,e,n),t.font=`${a}px ${nr}`,t.textBaseline="top";const g=u?or:ar;let v=g.r,y=g.g,M=g.b;const b=rr(t);if(i){const t=_n(i);t&&(v=t.r,y=t.g,M=t.b)}let x=v,w=y,k=M;const S=s?_n(s):null;S&&(x=S.r,w=S.g,k=S.b);const A=r*l,C=o.chars?Array.from(o.chars):void 0,$=["-","\\","|","/"];for(let e=0;e<m;e++){const n=e/m;for(let r=0;r<f;r++){const a=r/f;let i=0,s=0;for(let t=0;t<c;t++){const e=Zn(13*t,7*t+3),r=1.1+2.4*e,o=.9+2*Zn(29*t,11*t+1),l=e*Math.PI*6,c=(.2+.5*Zn(41*t,17*t))*(t%2==0?1:-1.3),u=Math.sin(a*r*Math.PI*2+A*c+l),h=Math.cos(n*o*Math.PI*2+A*c*.6+1.7*l),p=Math.sin(a*o*Math.PI*d+n*r*Math.PI*d+A*c*.4);i+=Math.atan2(h+.3*p,u),s+=.5*(u*h+1)}const l=i/c,u=ir(s/c,.54,.74);if(u<=0)continue;const m=(l%Math.PI+Math.PI)%Math.PI,g=Math.round(m/(Math.PI/4))%$.length;if(!C&&o.ditherStrength&&0===cr(u,2,r,e,o.ditherStrength))continue;const E=C?C[cr(u,C.length,r,e,o.ditherStrength)]:$[g];if(" "===E)continue;const L=!!S&&u>.85,z=sr(u);t.fillStyle=L?`rgba(${x},${w},${k},${z})`:`rgba(${v},${y},${M},${z})`,t.fillText(E,b(r*h),b(e*p))}}}(t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var Or={id:"stars",name:"Stars",description:"A sparse starfield that twinkles, drifts and leans toward the cursor.",cellSize:14,speed:1,cursor:!0,mount:t=>Jn(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=" . · * + ° ★",accentColor:l,color:c,speed:d=1,count:u=180,lightMode:h=!1}=a,p=l??(h?"#6b8700":"#d4ff00");t.clearRect(0,0,e,n),t.textBaseline="middle",t.textAlign="center";const f=e*(.2+.6*o.x),m=n*(.2+.6*o.y),g=.65*Math.sqrt(e*e+n*n);let v=255,y=255,M=255;if(h&&(v=55,y=55,M=55),c){const t=_n(c);t&&(v=t.r,y=t.g,M=t.b)}let b=212,x=255,w=0;const k=_n(p);k&&(b=k.r,x=k.g,w=k.b);const S=s.replace(/ /g,"").split("");if(0!==S.length){for(let o=0;o<u;o++){const a=Zn(17*o,3)*Math.PI*2,s=(r*(.15+.85*Zn(31*o,7))*d*.22+Zn(13*o,11))%1,l=f+Math.cos(a)*s*g,c=m+Math.sin(a)*s*g;if(l<-20||l>e+20||c<-20||c>n+20)continue;const u=Math.max(6,i*(.4+.9*s));t.font=`${u}px monospace`;const p=S[Math.min(S.length-1,Math.floor(s*S.length))],k=s>.72,A=h?.85*s:.2*s;t.fillStyle=k?`rgba(${b},${x},${w},${Math.min(h?.92:.32,2.2*A)})`:`rgba(${v},${y},${M},${A})`,t.fillText(p,l,c)}t.textAlign="left"}}(t,e,n,r,o,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var Nr={id:"terrain",name:"Terrain",description:"A side-scrolling landscape drawn in density characters.",cellSize:13,speed:1,cursor:!1,mount:t=>Jn(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,chars:i=" .,:;+*#@",color:s="#4caf50",skyColor:l="#1a237e",peakColor:c="#e0e0e0",speed:d=1,roughness:u=.55,heightScale:h=.55,stars:p=!0,lightMode:f=!1}=o,m=.62*a,g=1.4*a,v=Math.ceil(e/m),y=Math.ceil(n/g),M=_n(s)??{r:76,g:175,b:80},b=_n(l)??{r:26,g:35,b:126},x=_n(c)??{r:224,g:224,b:224};t.clearRect(0,0,e,n),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";const w=r*d*.4,k=new Array(v);for(let t=0;t<v;t++){const e=(.5*er((t/v+w)*u*3,.5)+.5)*h;k[t]=Math.floor(e*y)}for(let e=0;e<y;e++)for(let n=0;n<v;n++){const o=y-1-k[n],a=e===o;if(!(e>=o)){if(p){const o=Zn(7*n+Math.floor(.3*w),13*e);if(o>.97){const a=.3*Math.sin(2*r+100*o)+.7;t.globalAlpha=.5*a,t.fillStyle=`rgb(${b.r+60},${b.g+60},${b.b+80})`,t.fillText("·",n*m,e*g)}}continue}const s=(e-o)/Math.max(1,k[n]),l=i[Math.min(i.length-1,Math.floor(s*i.length))];if(" "===l&&!a)continue;const c=a?1:Math.max(0,1-4*s),d=M.r+(x.r-M.r)*c|0,u=M.g+(x.g-M.g)*c|0,h=M.b+(x.b-M.b)*c|0;t.globalAlpha=.5+.5*s,t.fillStyle=`rgb(${d},${u},${h})`,t.fillText(a?i[i.length-1]:l,n*m,e*g)}t.globalAlpha=1}(t,e,n,r,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,peakColor:a.accent??D(a.ink,"#ffffff",.65),skyColor:D(a.ink,"#0c0d0b",.55)}))},Gr=(t,e,n,r)=>{const o=5.5*(t-.5*n)+.65*Math.sin(3.2*e+.2*r)+.12*r;return Math.pow(.5+.5*Math.cos(o),7)*(.45+.55*Math.sin(2.4*e+.2))},qr={id:"veil",name:"Veil",description:"Tall folds of light drifting across a quiet ground.",cellSize:12,speed:1,cursor:!1,mount:t=>Jn(t,(t,e,n,r,o,a)=>ur(Gr,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))};var Hr={id:"void",name:"Void",description:"A gravity well that spirals characters around the cursor.",cellSize:13,speed:1,cursor:!0,mount:t=>Jn(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=13,chars:s=" ·:;=+*#%@",color:l,accentColor:c,speed:d=1,radius:u=.38,swirl:h=3,lightMode:p=!1}=a,f=c??(p?"#6b8700":"#d4ff00"),m=.62*i,g=1.4*i,v=Math.ceil(e/m),y=Math.ceil(n/g),M=e/n;t.clearRect(0,0,e,n),t.font=`${i}px monospace`,t.textBaseline="top";let b=255,x=255,w=255;if(p&&(b=55,x=55,w=55),l){const t=_n(l);t&&(b=t.r,x=t.g,w=t.b)}let k=212,S=255,A=0;const C=_n(f);C&&(k=C.r,S=C.g,A=C.b);const $=r*d;for(let e=0;e<y;e++){const n=e/y;for(let r=0;r<v;r++){const a=(r/v-o.x)*M,i=n-o.y,l=Math.sqrt(a*a+i*i)/u;if(l>1){const n=Zn(3*r,7*e)*Math.max(0,1-3*(l-1));if(n<.62)continue;const o=n*(p?.28:.04);t.fillStyle=`rgba(${b},${x},${w},${o})`,t.fillText(s[1],r*m,e*g);continue}const c=Math.max(0,1-Math.abs(l-(.15+.12*Math.sin(1.1*$)))/.07),d=Math.pow(1-l,2.2),h=Math.min(1,d+.6*c);if(h<.06)continue;const f=Math.floor(h*(s.length-1)),y=s[Math.min(s.length-1,f)],C=c>.35||l<.08,E=p?.85*h:.18*h;t.fillStyle=C?`rgba(${k},${S},${A},${p?.95:.38})`:`rgba(${b},${x},${w},${E})`,t.fillText(y,r*m,e*g)}}}(t,e,n,r,o,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var Dr={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=>Jn(t,(t,e,n,r,o,a)=>{const[i,s,l]=H(a.ink);!function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=13,charAspect:s=.62,lineHeightRatio:l=1.3,chars:c=" .:-=+*#%@",baseColor:d=null,accentColor:u,accentThreshold:h=.52,mouseInfluence:p=.4,mouseFalloff:f=2.8,speed:m=1,vortex:g=!0,sparkles:v=!1,breathe:y=!0,lightMode:M=!1}=a,b=Array.from(c),x=i*s,w=i*l,k=Math.ceil(e/x),S=Math.ceil(n/w),A=o.x,C=o.y,$=u?_n(u):null;t.clearRect(0,0,e,n),t.font=`${i}px ${nr}`;const E=rr(t);t.textBaseline="top";const L=r*m,z=y?.12*(.5*Math.sin(.22*L)+.5):0;for(let e=0;e<S;e++)for(let n=0;n<k;n++){const r=n/k,o=e/S,i=.045,s=.08*L,l=.06,c=(.5*Math.sin(.08*n+.05*e+.6*L)+.5+(.5*Math.sin(.03*n-.07*e+.4*L)+.5)+(.5*Math.sin(.05*n+.03*e+.8*L)+.5))/3*.45+.35*(.5*er(n*i+s,e*i*1.4-.7*s)+.5)+.2*(.5*Math.sin((n+.65*e)*l+1.1*L)+.5)+z,u=r-A,m=o-C,y=Math.sqrt(u*u+m*m);let R=0;if(g&&y<.35){const t=Math.atan2(m,u),e=Math.sin(4*t+2.2*L-14*y),n=Math.max(0,1-y/.35);R=e*n*n*.22}const I=c*(1-p)+(Math.max(0,1-y*f)+.5*R)*p+.15*R,T=Math.min(1,Math.max(0,I));let P=T;if(v&&T>.72){const t=Math.floor(8*L),r=Zn(7*n+3*t,11*e+t);r>.88&&(P=Math.min(1,T+4*(r-.88)))}const F=ir(P,.32,.9);if(F<=0)continue;const W=cr(F,b.length,n,e,a.ditherStrength);if(" "===b[W])continue;const B=sr(F);t.fillStyle=$&&P>h?`rgba(${$.r},${$.g},${$.b},${B})`:d?d.replace("{a}",String(B)):M?`rgba(111,109,103,${B})`:`rgba(143,141,134,${B})`,t.fillText(b[W],E(n*x),E(e*w))}}(t,e,n,r,o,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,baseColor:`rgba(${i},${s},${l},{a})`,accentColor:a.accent})})},jr=(t,e,n,r)=>{const o=.2*Math.sin(3*t+2*e+.2*r);return(.65*Math.pow(.5+.5*Math.sin(45*(t+o)),8)+.35*Math.pow(.5+.5*Math.sin(50*(e-.3*o)),10))*(.4+.6*Math.sin(2*e+.4))},Ur={id:"weave",name:"Weave",description:"Interlaced threads with a subtle change in tension.",cellSize:12,speed:1,cursor:!1,mount:t=>Jn(t,(t,e,n,r,o,a)=>ur(jr,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))};exports.BEAM_PALETTES=Z,exports.PILL_TONES=Nt,exports.VOICE_PALETTES=pe,exports.accordion=function(t,e){const n={current:{open:0,duration:280,label:"Images",...e}},r=U(),o=n.current.images.map(wn);let a=I(Math.round(n.current.open),0,Math.max(0,o.length-1)),i=0,s=performance.now(),l=o.map((t,e)=>e===a?1:0);const c=o.map(()=>null),d=o.map(()=>null);let u=null;const h=o.map(t=>{const e=document.createElement("button");e.type="button",e.className="ascii-acc-panel",e.setAttribute("aria-label",[t.title??t.alt,t.meta].filter(Boolean).join(", ")||t.src);const n=Ze(t.src);if(n.className="ascii-acc-photo",n.alt="",n.draggable=!1,t.focus&&n.style.setProperty("object-position",`${100*t.focus.x}% ${100*t.focus.y}%`),e.appendChild(n),t.title||t.meta){const n=document.createElement("span");n.className="ascii-acc-caption",n.setAttribute("aria-hidden","true");for(const[e,r]of[["ascii-acc-title",t.title],["ascii-acc-meta",t.meta]]){if(!r)continue;const t=document.createElement("span");t.className=e,t.textContent=r,n.appendChild(t)}e.appendChild(n)}return e});u=K({host:t,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:.62,glyphScale:.94,hover:"trail",trail:{strength:.5,radius:.25},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{u=null,delete t.dataset.asciiField},onTheme:()=>{c.forEach((t,e)=>{d[e]=t&&u?en(t,!u.dark()):null}),u?.kick()},paint:({pen:t,now:e,still:r,box:c})=>{const u=i?Math.min(64,e-i):16;i=e;let p=!1;return l=l.map((t,e)=>{const o=e===a?1:0,i=r?o:t+Math.sign(o-t)*Math.min(Math.abs(o-t),u/Math.max(1,n.current.duration));return i!==o&&(p=!0),i}),h.forEach((e,n)=>{const r=d[n],a=P(l[n]);if(!r||a>=1)return;const i=c(e),s=parseFloat(getComputedStyle(e).borderTopLeftRadius)||0;t.save(),t.beginPath(),t.roundRect(i.x,i.y,i.w,i.h,s),t.clip(),t.globalAlpha=1-a,tn(t,r,i.x,i.y,i.w,i.h,o[n].focus?.x,o[n].focus?.y);const u=.4*Math.sin(Math.PI*I(1.4*a));u>.01&&(t.globalCompositeOperation="lighter",t.globalAlpha=u,t.fillStyle="#fff",t.fillRect(i.x,i.y,i.w,i.h)),t.restore()}),e-s<n.current.duration+60&&(p=!0),p||(i=0),p}});const p=()=>{h.forEach((t,e)=>{t.setAttribute("aria-expanded",String(e===a)),t.tabIndex=e===a?0:-1})},f=(t,e=!1)=>{t=I(Math.round(t),0,h.length-1),e&&h[t]?.focus(),t!==a&&(a=t,s=performance.now(),p(),n.current.onChange?.(t),u?.kick())},m=h.map((t,e)=>{const n=()=>f(e),r=()=>{t.matches(":focus-visible")&&f(e)},o=t=>{const n={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[t.key],r="Home"===t.key?0:"End"===t.key?h.length-1:void 0!==n?(e+n+h.length)%h.length:null;null!==r&&(t.preventDefault(),f(r,!0))};return t.addEventListener("pointermove",n),t.addEventListener("pointerdown",n),t.addEventListener("click",n),t.addEventListener("focus",r),t.addEventListener("keydown",o),()=>{t.removeEventListener("pointermove",n),t.removeEventListener("pointerdown",n),t.removeEventListener("click",n),t.removeEventListener("focus",r),t.removeEventListener("keydown",o)}});ln("ascii-kit-accordion",'\n:where([data-ascii-accordion]){display:flex;gap:6px}\n:where(.ascii-acc-panel){position:relative;flex:1 1 0;min-width:0;margin:0;padding:0;border:0;border-radius:12px;overflow:hidden;background:transparent;color:#fff;font:inherit;text-align:left;cursor:pointer;transition:flex-grow var(--ascii-acc-ms, 280ms) cubic-bezier(.16, 1, .3, 1)}\n:where(.ascii-acc-panel[aria-expanded="true"]){flex-grow:4.2;cursor:default}\n:where(.ascii-acc-photo){position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:0;scale:1.04;transition:opacity 160ms cubic-bezier(.16, 1, .3, 1),scale var(--ascii-acc-ms, 280ms) cubic-bezier(.16, 1, .3, 1)}\n:where([data-ascii-accordion]:not([data-ascii-field])) :where(.ascii-acc-photo){opacity:.45}\n:where(.ascii-acc-panel[aria-expanded="true"]) :where(.ascii-acc-photo){opacity:1;scale:1;transition:opacity 240ms cubic-bezier(.16, 1, .3, 1) 40ms,scale var(--ascii-acc-ms, 280ms) cubic-bezier(.16, 1, .3, 1)}\n:where(.ascii-acc-caption){position:absolute;inset:auto 0 0;display:flex;color:#fff;flex-direction:column;gap:2px;padding:28px 12px 11px;background:linear-gradient(to top, rgb(0 0 0 / .62), transparent);white-space:nowrap;opacity:0;translate:0 6px;transition:opacity 120ms,translate 200ms}\n:where(.ascii-acc-panel[aria-expanded="true"]) :where(.ascii-acc-caption){opacity:1;translate:0 0;transition-delay:160ms}\n:where(.ascii-acc-title){font-size:15px;font-weight:500}\n:where(.ascii-acc-meta){font-size:14px;opacity:.8}\n@media (prefers-reduced-motion:reduce){:where(.ascii-acc-panel,.ascii-acc-photo,.ascii-acc-caption){transition:none}}\n'),t.dataset.asciiAccordion="",u&&(t.dataset.asciiField="");const g=t.getAttribute("role"),v=t.getAttribute("aria-label");return g||t.setAttribute("role","group"),v||t.setAttribute("aria-label",n.current.label),r.set(t,"--ascii-acc-ms",`${n.current.duration}ms`),h.forEach(e=>t.appendChild(e)),p(),h.forEach((t,e)=>{const n=t.querySelector("img");n&&Qe(n).then(t=>{c[e]=t,d[e]=u?en(t,!u.dark()):null,u?.kick()},()=>{})}),Q(()=>u,n,e=>{r.set(t,"--ascii-acc-ms",`${e.duration}ms`),v||t.setAttribute("aria-label",e.label),u?.refresh()},{select:f,get open(){return a}},()=>{m.forEach(t=>t()),h.forEach(t=>t.remove()),delete t.dataset.asciiAccordion,delete t.dataset.asciiField,g||t.removeAttribute("role"),v||t.removeAttribute("aria-label"),r.restore()})},exports.artPanel=function(t,e={}){const n={current:{...e}},r=U(),o=t.querySelector("img"),a=n.current.image??o??null;let i=null;i=a?Kt({host:t,look:()=>{const t=n.current;return{mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.3,levels:"auto",fit:"cover",focus:t.focus??{x:.5,y:.4},hover:"trail",trail:{strength:.95,radius:.42},clear:!!t.clear&&{element:t.clear,padding:8,feather:.12,shape:"rect"},...t.look}},ink:()=>n.current.ink??"--ascii-ink-strong",source:a,label:n.current.label??(a instanceof HTMLImageElement&&a.alt||void 0),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{i=null,r.restore()}}):null,i&&o&&a===o&&r.set(o,"opacity","0");let s=0,l=!1;return Qt(()=>i,n,()=>{},{pulse:(t,e=1)=>{i&&!i.still()&&te(i.field,t,e)},shimmer:t=>{const e=i?.field;if(!e||t===l||t&&i.still())return;const n=++s;l=t,t?(async()=>{let t;try{t=await(async()=>{if(a instanceof HTMLImageElement)return a.complete||await a.decode(),a;const t=new Image;return t.crossOrigin="anonymous",t.src=a,await t.decode(),t})()}catch{return}const r=Math.min(1,1400/Math.max(t.naturalWidth,t.naturalHeight,1)),o=Object.assign(document.createElement("canvas"),{width:Math.max(1,Math.round(t.naturalWidth*r)),height:Math.max(1,Math.round(t.naturalHeight*r))}),l=o.getContext("2d"),c=o.width,d=o.height,u=performance.now();for(;n===s&&i?.field===e;){const n=performance.now(),r=-.4*c+1.8*((n-u)/1100%1)*c;l.globalCompositeOperation="source-over",l.drawImage(t,0,0,c,d);const a=l.createLinearGradient(r-.22*c,.3*r,r+.22*c,.3*r+.3*d);a.addColorStop(0,"rgb(0 0 0 / 0)"),a.addColorStop(.5,"rgb(255 255 255 / .42)"),a.addColorStop(1,"rgb(0 0 0 / 0)"),l.globalCompositeOperation="lighter",l.fillStyle=a,l.fillRect(0,0,c,d),await e.setSource(o),await _t(Math.max(0,48-(performance.now()-n)))}})():e.setSource(a)}},()=>{s++,r.restore()})},exports.asciiVideo=function(t,e={}){const n={current:{...e}},r=U(),o=[],a=t.querySelector("video"),i=n.current.src??a??null,s=()=>n.current.reducedMotion??B();let l=null,c=0;l=i?Kt({host:t,layer:"over",look:()=>({mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.25,levels:"auto",fit:"cover",focus:{x:.5,y:.5},hover:"trail",trail:{strength:.9,radius:.35},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",source:i,label:n.current.label??"Video, drawn in characters",kit:n,ownPoster:!0,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{l=null,r.restore(),f()},onRelease:()=>{u=!1,h(),i instanceof HTMLVideoElement&&i.pause?.()},onMount:()=>{c++&&(l?.field.ready.then(()=>{u=!0,h()}),m&&i instanceof HTMLVideoElement&&i.play?.()?.catch?.(()=>{}))}}):null,l&&i instanceof HTMLVideoElement&&(t.contains(i)&&r.set(i,"opacity","0"),i.muted=!0,i.loop=!0,i.playsInline=!0);let d=null;n.current.poster&&i&&(d=Object.assign(document.createElement("img"),{alt:"",decoding:"async"}),d.className="ascii-video-poster",d.setAttribute("aria-hidden","true"),d.setAttribute("style",`${de};transition:opacity 280ms cubic-bezier(.16, 1, .3, 1)`),d.src=n.current.poster,"static"===getComputedStyle(t).position&&r.set(t,"position","relative"),t.appendChild(d),o.push(d));let u=!1;const h=()=>{d&&(d.style.opacity=l&&u&&(m||!s())?"0":"1")};let p=null;function f(){!p&&i&&(i instanceof HTMLVideoElement?p=i:(p=document.createElement("video"),p.src=i,p.setAttribute("style",de),p.setAttribute("aria-label",n.current.label??"Video"),"static"===getComputedStyle(t).position&&r.set(t,"position","relative"),d?t.insertBefore(p,d):t.appendChild(p),o.push(p)),n.current.poster&&!p.poster&&(p.poster=n.current.poster),p.muted=!0,p.loop=!0,p.playsInline=!0,d&&(d.style.opacity="0"),m&&p.play?.()?.catch?.(()=>{}))}let m=n.current.autoplay??!(l?l.still():s());l?(l.field.ready.then(()=>{u=!0,m||l?.field.pause(),h()}),m&&i instanceof HTMLVideoElement&&i.play?.()?.catch?.(()=>{}),h()):f();const g=Qt(()=>l,n,t=>{d&&t.poster&&d.getAttribute("src")!==t.poster&&(d.src=t.poster),p&&t.poster&&(p.poster=t.poster)},{toggle:()=>(m?g.pause():g.play(),m),get playing(){return m}},()=>{o.forEach(t=>t.remove()),r.restore()}),v=g.play,y=g.pause;return g.play=()=>{l&&!g.supported||(m=!0,l?v():p?.play?.()?.catch?.(()=>{}),h())},g.pause=()=>{l&&!g.supported||(m=!1,l?y():p?.pause?.(),h())},g},exports.aurora=dr,exports.background=function(t,e){if(!e||!e.preset||"function"!=typeof e.preset.mount)throw new TypeError("background() needs a preset, such as `aurora` imported from asciify-engine/kit.");const n={current:{...e}};let r=null,o=!1,a=!1;const i=new Set,s=()=>{const t=n.current,e=t.preset;return{speed:zn(t.speed,e.speed,0,5),cellSize:zn(t.cellSize,e.cellSize,3,96),charset:Rn(t.charset),cursor:t.cursor??e.cursor,clear:t.clear??!1,dither:zn(t.dither,0,0,1),accent:t.accent,text:t.text?.trim()||"ASCIIFY",look:t.look}},l=t=>{const e=n.current,r=e.palette;return("string"==typeof r?r:r?.[t?"dark":"light"])??e.color??e.ink},c=()=>String(zn(n.current.opacity,n.current.preset.opacity??1,0,1)),d=()=>!!(n.current.reducedMotion??B()),u=e=>{let a=null;if(a=n.current.preset.mount({host:t,kit:n,settings:s,ink:l,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{r===a&&(r=null)}}),!a)return null;const i=a.canvas.style;return e&&(i.opacity="0",i.transition="opacity 320ms cubic-bezier(.16, 1, .3, 1)",a.canvas.offsetWidth),i.opacity=c(),o&&a.pause(),a},h=t=>{if(a||!t||"function"!=typeof t.mount||t===n.current.preset)return;n.current={...n.current,preset:t};const e=r;r=u(!!e&&!d()),e&&(t=>{if(d())return void t.destroy();t.canvas.style.transition="opacity 320ms cubic-bezier(.16, 1, .3, 1)",t.canvas.style.opacity="0";const e={run:t,timer:setTimeout(()=>{i.delete(e),t.destroy()},340)};i.add(e)})(e)};return r=u(!1),{get supported(){return!!r&&!a},get field(){return a?null:r?.field??null},get preset(){return n.current.preset},update(t){if(a||!t)return;const{preset:e,...o}=t;n.current=Y(n.current,o),e&&e!==n.current.preset?h(e):r&&(r.canvas.style.opacity=c(),r.refresh())},play(){!a&&o&&(o=!1,r?.play())},pause(){a||(o=!0,r?.pause())},setPreset:h,destroy(){if(!a){a=!0;for(const t of i)clearTimeout(t.timer),t.run.destroy();i.clear(),r?.destroy(),r=null,$(n)}}}},exports.backgroundCharset=Rn,exports.beam=function(t,e={}){const n={current:{...tt,...e}};let r="idle",o=0,a=it(n.current.palette),i=!1;const s=()=>"mono"===n.current.palette,l=()=>({..."glyphs"===n.current.grain?{mark:"glyph",charset:" ·.:-+*",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.6,glyphScale:1}:{mark:"dot",cellSize:3.5,cellAspect:1,dotScale:.82},color:s()?"ink":"source",saturation:1.25,shade:.55,contrast:2.4,brightness:.58,...n.current.look}),c=t=>{const e=!t.dark();t.canvas.style.opacity=e?"0.72":"",t.canvas.style.filter=e&&!s()?"brightness(1.45) saturate(.9)":""};let d=null,u=null,h=new Uint8Array(0),p="",f=0,m=null,g=0,v=.62,y=0,M=0,b=0,x=0,w=0,k=0;const S={rotate:0,pulse:0,progress:0};S[n.current.mode]=1;let A=null;A=K({host:t,look:l,ink:t=>n.current.ink??(t?"#b3b1aa":"#8a8882"),kit:n,reducedMotion:()=>n.current.reducedMotion,onTheme:()=>A&&c(A),onFail:()=>{A=null},resolution:(t,e)=>[Math.max(1,Math.round(t)),Math.max(1,Math.round(e))],paint:e=>{const{pen:s,w:c,h:C,now:$,still:E,dark:L}=e,z=n.current,R=getComputedStyle(t),P=Math.min(t.clientWidth||c,t.clientHeight||C),W=Math.max(2,Math.min(z.depth,Math.min(parseFloat(R.paddingTop)||z.depth,parseFloat(R.paddingLeft)||z.depth)-2)),B=[R.borderTopLeftRadius,R.borderTopRightRadius,R.borderBottomRightRadius,R.borderBottomLeftRadius].map(t=>((t,e)=>t.endsWith("%")?parseFloat(t)/100*e:parseFloat(t)||0)(t??"",P)),O=l(),N="dot"!==O.mark,G=O.cellSize??(N?5:3.5),q=O.cellAspect??(N?.6:1),H=`${c}x${C}:${z.grain}:${W}:${B.join(",")}:${G}:${q}`;if(H!==p){p=H,A.canvas.style.clipPath=`inset(0 round ${B.map(t=>`${t}px`).join(" ")})`;const t=Math.min(globalThis.devicePixelRatio||1,O.maxPixelRatio??2),e=Math.max(2,Math.round(G*t)),n=Math.max(2,Math.round(e*q))/t,r=e/t;d=function(t,e,n,r,o,a,i){const s=Math.ceil(t/n),l=t/2,c=e/2,d=Math.min(l,c),[u,h,p,f]=[0,1,2,3].map(t=>Math.max(0,Math.min(a[t]??a[0]??0,d))),m=new Int32Array(s*Math.ceil(e/r)).fill(-1),g=[],v=[],y=[];for(let t=0;t<m.length;t++){const e=(t%s+.5)*n-l,a=(Math.floor(t/s)+.5)*r-c,d=e<0?a<0?u:f:a<0?h:p,M=Math.abs(e)-l+d,b=Math.abs(a)-c+d,x=-(Math.hypot(Math.max(M,0),Math.max(b,0))+Math.min(Math.max(M,b),0)-d),w=x>0?Math.min(Math.max(0,1-x/Math.max(1,o))**1.7,x/Math.max(.1,i)):0;if(w<.004)continue;m[t]=g.length,g.push(w);const k=Math.atan2(a/Math.max(1,c),e/Math.max(1,l))/(2*Math.PI)+.25,S=k-Math.floor(k);v.push(S),y.push(.78*T(Math.floor(46*S),5)+.22*T(t,9))}const M=Math.max(1,Math.round(t)),b=Math.max(1,Math.round(e)),x=[],w=[];for(let t=0;t<b;t++)for(let e=0;e<M;e++){const o=m[Math.min(s-1,Math.floor((e+.5)/n))+s*Math.floor((t+.5)/r)];o>=0&&(x.push(t*M+e),w.push(o))}return{W:M,H:b,weight:Float32Array.from(g),turn:Float32Array.from(v),crack:Float32Array.from(y),pixel:Int32Array.from(x),owner:Int32Array.from(w)}}(c,C,n,r,W,B,N?Math.min(n,r)/2:(O.dotScale??.82)*n/2),u=s.createImageData(d.W,d.H),h=new Uint8Array(3*d.weight.length)}const D=d,j=u.data,U=D.crack,V=(t,e,n,r,o)=>{h.fill(0);for(let i=0;i<D.weight.length;i++){const s=D.turn[i],l=I(D.weight[i]*t(s,i))*(L?1.12:.8);if(l<.03)continue;const c=4*(255&Math.floor(((s-e)%1+1)%1*256));let d=a[c],u=a[c+1],p=a[c+2],f=a[c+3];const m=o&&L?o(s):0;(r>0||n>0||m>0)&&(r>0&&(d+=(at[0]-d)*r,u+=(at[1]-u)*r,p+=(at[2]-p)*r),n>0&&(d+=(ot[0]-d)*n,u+=(ot[1]-u)*n,p+=(ot[2]-p)*n),m>0&&(d+=(1-d)*m,u+=(1-u)*m,p+=(1-p)*m),f=.2126*d+.7152*u+.0722*p);const g=255*Math.min(1,(l+.12)/2.4/Math.max(f,.01));h[3*i]=d*g,h[3*i+1]=u*g,h[3*i+2]=p*g}j.fill(0);for(let t=0;t<D.pixel.length;t++){const e=4*D.pixel[t],n=3*D.owner[t];j[e]=h[n],j[e+1]=h[n+1],j[e+2]=h[n+2],j[e+3]=255}s.putImageData(u,0,0)};if(E){const t="progress"===z.mode?t=>"running"===r||"error"===r?ct(t,o):.14:t=>("running"===r?.75:.55)*(.7+.3*Math.cos(2*Math.PI*(t-.12)));return"success"===r?V(()=>.62,0,0,.9):"error"===r?V((e,n)=>.5*t(e)*dt(U[n],1),0,.9,0):V(t,0,0,0),!1}const X=f?Math.min(48,$-f):16;f=$,r!==m&&("running"===r&&"running"!==m&&(w=0),g=$,m=r);let Y=$-g;"success"===r&&Y>2700&&(r=m="idle",o=0,g=$,Y=0);const J="running"===r,_="error"===r,K="success"===r,Q=z.hover&&i;for(const t of et)S[t]+=((t===z.mode?1:0)-S[t])*(1-Math.exp(-X/260));if(_)M=0;else{const t=(J?1500-500*o:"pulse"===z.mode?9e3:2600)/Math.max(.05,z.speed);M+=(1/t*(Q?1.35:1)-M)*(1-Math.exp(-X/320)),v+=M*X,k+=X,y+=X/("pulse"===z.mode?14e3:26e3)*(1-S.progress),(J||K)&&(w+=((K?1:o)-w)*(1-Math.exp(-X/110)))}b+=((Q?1:0)-b)*(1-Math.exp(-X/220)),x=_?.9*F(0,60,Y):x*Math.exp(-X/180);const Z=1+.22*b,tt=.32+.68*(.5-.5*Math.cos(2*Math.PI*k/2400)),nt=.05+.1*(.5-.5*Math.cos(2*Math.PI*k/5200)),rt=J||K||_,it=t=>Z*(S.rotate*lt(t-v)+S.pulse*(J||_?lt(t-v):tt*(.78+.22*Math.cos(2*Math.PI*(t-v))))+S.progress*(rt?ct(t,w):nt));if(K){const t=F(0,260,Y),e=I((Y-240)/620),n=1-F(860,1060,Y),r=F(780,1e3,Y),o=F(1350,2450,Y),a=(L?.86:.55)*t*(1-r)+.62*r*(1-o),i=1-t*(1-F(1900,2700,Y)*(1-S.progress)),s=t=>{if(Y<240)return 0;const r=e-t;return n*(r>=0?r<.2?(1-r/.2)**2:0:r>-.02?(1+r/.02)**2:0)};return V(t=>Math.max(it(t)*i,a*(.9+.1*Math.cos(2*Math.PI*(t-.1))),1.3*s(t),S.progress*nt*o),y,0,.9*r*(1-o),t=>I(.8*s(t))),!0}if(_){const t=Y<90?1.2:Y<170?.1:Y<260?1.2:Y<340?.1:1,e=F(380,1150,Y),n=1-.5*F(700,1500,Y),r=Math.floor(Y/50);return V((o,a)=>{const i=dt(U[a],e);return i<=0?0:it(o)*t*i*n*(1-1.4*e*(1-e)*T(a,r))},y,x,0),Y<1600||Math.abs(b-(Q?1:0))>.01}return V(it,y,x,0),!0}});const C=()=>{i||(i=!0,A?.kick())},$=()=>{i=!1,A?.kick()},E=t=>{i=t.target?.matches?.(":focus-visible")??!1,A?.kick()};A&&(c(A),t.addEventListener("pointerenter",C),t.addEventListener("pointermove",C),t.addEventListener("pointerleave",$),t.addEventListener("focusin",E),t.addEventListener("focusout",$));const L=t=>{r=t,A?.kick()};return Q(()=>A,n,t=>{a=it(t.palette),A?.refresh(),A&&c(A)},{progress(t){o=I(Number.isFinite(t)?t:0),L("running")},success(){L("success")},error(){L("error")},reset(){o=0,L("idle")}},()=>{t.removeEventListener("pointerenter",C),t.removeEventListener("pointermove",C),t.removeEventListener("pointerleave",$),t.removeEventListener("focusin",E),t.removeEventListener("focusout",$)})},exports.beamPalette=it,exports.blockChart=function(t,e={}){const n={current:{...Ge,...e}};let r=n.current.values,o=null,a=!1===n.current.intro?-1e9:performance.now(),i=[],s=0,l=!1,c=null;const d=()=>n.current.values??[];c=K({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:7,cellAspect:.6,glyphScale:.95,shade:.35,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{c=null},paint:({pen:t,w:e,h:r,now:l,still:c})=>{t.setTransform(2,0,0,2,0,0);const u=d(),h=u.length;if(!h)return!1;const p=s?Math.min(64,l-s):16;s=l;const f=e/h,m=Math.max(3,f*(h<=7?.56:.64)),g=n.current.max??1.04*Math.max(...u,0),v=n.current.stagger??(h<=7?45:9);let y=!1;for(let e=0;e<h;e++){const s=c?1:I((l-a-e*v)/n.current.duration);s<1&&(y=!0);const d=null===o?e===h-1?1:.55:e===o?1:.3,M=i[e]??d;i[e]=c?d:M+(d-M)*(1-Math.exp(-p/90)),Math.abs(i[e]-d)>.01&&(y=!0);const b=(g>0?Math.max(0,u[e])/g:0)*(r-2)*W(s),x=r-b,w=f*(e+.5)-m/2;if(b<=0)continue;const k=.16+.84*i[e],S=t.createLinearGradient(0,x,0,r);S.addColorStop(0,qe(k)),S.addColorStop(1,qe(.5*k)),t.fillStyle=S,t.fillRect(w,x,m,b)}return y}});const u=U(),h=c?null:document.createElement("div"),p=()=>{if(!h)return;const t=d(),e=t.length,r=n.current.max??1.04*Math.max(...t,0);h.replaceChildren(...t.map((t,n)=>{const a=document.createElement("div"),i=null===o?n===e-1?1:.55:n===o?1:.3;return a.setAttribute("style",`flex:1 1 0;height:${r>0?(100*I(t/r)).toFixed(2):0}%;margin:0 ${e<=7?22:18}%;background:currentColor;opacity:${.9*(.16+.84*i)}`),a}))};h&&("static"===getComputedStyle(t).position&&u.set(t,"position","relative"),h.setAttribute("aria-hidden","true"),h.setAttribute("style","position:absolute;inset:0;display:flex;align-items:flex-end;pointer-events:none"),t.appendChild(h));const f=document.createElement("table");f.setAttribute("style","position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0");const m=()=>{const t=n.current.format??(t=>t.toLocaleString()),e=n.current.labels??[],r=document.createElement("tbody");d().forEach((n,o)=>{const a=document.createElement("tr"),i=document.createElement("th"),s=document.createElement("td");i.setAttribute("scope","row"),i.setAttribute("style","font-weight:inherit"),i.textContent=e[o]??String(o+1),s.textContent=t(n),a.appendChild(i),a.appendChild(s),r.appendChild(a)}),f.replaceChildren(r)};m(),t.appendChild(f);const g=!t.hasAttribute("tabindex"),v=!t.hasAttribute("role");g&&(t.tabIndex=0),v&&t.setAttribute("role","group");const y=t=>{const e=d().length,r=null!==t&&e?Math.min(e-1,Math.max(0,Math.round(t))):null;r!==o&&(o=r,c?.kick(),p(),n.current.onHover?.(o,null===o?null:d()[o],null===o?null:n.current.labels?.[o]??null))},M=()=>{r=d(),a=performance.now(),i=d().map((t,e,n)=>e===n.length-1?1:.55),c?.kick(),p()};p();const b=e=>{const n=t.getBoundingClientRect();if(!n.width)return;const r=(e.clientX-n.left)/n.width,o=e.clientY-n.top;r<0||r>1||o<0||o>n.height?y(null):y(((t,e)=>e?Math.min(e-1,Math.max(0,Math.floor(t*e))):-1)(r,d().length))},x=()=>y(null),w=t=>{const e=d().length,n="ArrowRight"===t.key?null===o?0:Math.min(e-1,o+1):"ArrowLeft"===t.key?null===o?e-1:Math.max(0,o-1):"Home"===t.key?0:"End"===t.key?e-1:"Escape"===t.key?null:void 0;void 0!==n&&e&&(t.preventDefault(),y(n))};t.addEventListener("pointermove",b),t.addEventListener("pointerdown",b),t.addEventListener("pointerleave",x),t.addEventListener("keydown",w),t.addEventListener("blur",x);const k="function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{t?.isIntersecting&&!l&&(l=!0,!1!==n.current.intro&&M())},{threshold:.4}):null;return k?.observe(t),Q(()=>c,n,t=>{m(),t.values!==r&&M(),c?.refresh()},{set(t,e){n.current={...n.current,values:[...t],...e?{labels:[...e]}:{}},null!==o&&o>=t.length&&y(null),m(),M()},highlight:y,get active(){return o},get values(){return d()}},()=>{k?.disconnect(),f.remove(),h?.remove(),u.restore(),t.removeEventListener("pointermove",b),t.removeEventListener("pointerdown",b),t.removeEventListener("pointerleave",x),t.removeEventListener("keydown",w),t.removeEventListener("blur",x),g&&t.removeAttribute("tabindex"),v&&t.removeAttribute("role")})},exports.buttonLoading=function(e,n={}){const r={current:{...mt,...n}},o=U(),a=r.current.label??e,i=r.current.text??(a.textContent??"").trim(),s=[...a.childNodes],l=void 0!==r.current.icon?r.current.icon:i?null:e.querySelector("svg"),c=e.getAttribute("aria-label");let d="idle",u=i,h=-1e9,p=0,f=null,m={cw:9,ch:15,cellSize:15};const g=V(i),v=document.createElement("span"),y=document.createElement("span");y.setAttribute("aria-hidden","true"),y.dataset.asciiCheck="",y.innerHTML='<svg viewBox="0 0 24 24" width="1.1em" height="1.1em" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>';const M=()=>{const t=Math.min(globalThis.devicePixelRatio||1,2);m=function(t,e){const n=Math.max(3,3*Math.round(t*e/3));return{cw:n/3*2/e,ch:n/e,cellSize:n/e}}(parseFloat(getComputedStyle(a).fontSize)||15,t)},b=()=>{if(l)return v.replaceChildren(),f&&v.appendChild(f.canvas),v.style.width=`${m.cw}px`,void(v.style.height=`${m.ch}px`);const t=[...u];for(const t of[...v.children])"SPAN"===t.tagName&&t.remove();const n=f&&f.canvas.parentElement===v?f.canvas:null;for(const[e,r]of t.entries()){const t=document.createElement("span");t.textContent=r,t.setAttribute("style",`position:absolute;top:0;left:${e*m.cw}px;width:${m.cw}px;height:${m.ch}px;line-height:${m.ch}px;text-align:center`),n?v.insertBefore(t,n):v.appendChild(t)}f&&!n&&v.appendChild(f.canvas),v.style.width=t.length*m.cw+"px",v.style.height=`${m.ch}px`,g.textContent=u,p=Math.max(p,e.offsetWidth),p&&o.set(e,"min-width",`${p}px`)},x="undefined"!=typeof document&&t.isGlyphFieldSupported();if(x){M(),v.setAttribute("aria-hidden","true");const t="position:absolute;left:50%;top:50%;translate:-50% -50%;pointer-events:none";l?("static"===getComputedStyle(e).position&&o.set(e,"position","relative"),v.setAttribute("style",t),y.setAttribute("style",`${t};display:grid;place-items:center;opacity:0;scale:.5`),e.appendChild(v),e.appendChild(y)):(v.setAttribute("style","display:inline-block;vertical-align:middle;position:relative;white-space:pre"),y.setAttribute("style","display:inline-grid;place-items:center;vertical-align:middle;overflow:hidden;width:0;opacity:0;scale:.5"),a.replaceChildren(g,y,v)),b()}f=x?K({host:v,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:m.cellSize,cellAspect:2/3,glyphScale:.94,...r.current.look}),ink:()=>r.current.ink??getComputedStyle(a).color,kit:r,reducedMotion:()=>r.current.reducedMotion,resolution:(t,e)=>[Math.max(2,2*Math.round(t/m.cw)),Math.max(3,3*Math.round(e/m.ch))],onFail:()=>{f=null,v.remove(),y.remove(),o.restore(),l||(a.replaceChildren(...s),a.textContent=u)},paint:({pen:t,now:e,still:n})=>{const r=e-h;if(l){if("loading"!==d||n)return!1;const e=1+Math.round(8*(.5-.5*Math.cos(2*Math.PI*r/720))),o=Math.round(e/9*255);return t.fillStyle=`rgb(${o} ${o} ${o})`,t.fillRect(0,0,2,3),!0}const o=[...v.children].filter(t=>"SPAN"===t.tagName);let a="loading"===d&&!n;for(let e=0;e<o.length;e++){const i=n?0:gt(e,r,o.length,"loading"===d,n,u.length);r<24*o.length+170&&(a=!0);const s=" "===u[e];if(o[e].style.visibility=i&&!s?"hidden":"",!i||s)continue;const l=Math.round(i/9*255);t.fillStyle=`rgb(${l} ${l} ${l})`,t.fillRect(2*e,0,2,3)}return a}}):null,x&&!f&&(v.remove(),y.remove(),l||a.replaceChildren(...s),o.restore());const w=(t,n)=>{d=t,u=l?"":n,e.dataset.state=t,"loading"===t?e.setAttribute("aria-busy","true"):e.removeAttribute("aria-busy"),l&&null!==c&&e.setAttribute("aria-label","idle"===t?c:n),r.current.announce&&(r.current.announce.textContent="idle"===t?"":n),f?(h=performance.now(),((t,e)=>{const n=e?"none":`opacity 160ms ${vt} ${t?120:0}ms, scale 240ms ${vt} ${t?120:0}ms`;if(y.style.transition=n,y.style.opacity=t?"1":"0",y.style.scale=t?"1":".5",l||(y.style.width=t?"1.1em":"0",y.style.marginRight=t?".45em":"0"),l&&"style"in l){const t="idle"!==d&&"error"!==d;o.set(l,"transition",n.replace(/ 120ms/g,"")),o.set(l,"opacity",t?e&&"loading"===d?".4":"0":"1"),o.set(l,"scale",t&&!e?".6":"1")}})(!("success"!==t||!l&&!r.current.check),f.still()),b(),f.kick(),"error"===t&&r.current.shake&&!f.still()&&"function"==typeof e.animate&&e.animate([{translate:"0"},{translate:"-4px 0"},{translate:"4px 0"},{translate:"-2px 0"},{translate:"0"}],{duration:280,easing:vt})):l||(a.textContent=n)};return Q(()=>f,r,()=>{f&&(M(),b(),f.refresh())},{start(t=(l?c??"":`${i}…`)){w("loading",t)},succeed(t="Done"){w("success",t)},fail(t="Retry"){w("error",t)},reset(t=(l?c??"":i)){w("idle",t)},get state(){return d}},()=>{f&&(v.remove(),y.remove(),l||a.replaceChildren(...s)),l&&null!==c&&e.setAttribute("aria-label",c),delete e.dataset.state,e.removeAttribute("aria-busy"),o.restore()})},exports.caustics=pr,exports.circuit=Mr,exports.codeInput=function(t,e={}){const n={current:{...Je,...e}},r=U(),o=U(),a=[],i=()=>!!(n.current.reducedMotion??B()),s=()=>Math.max(1,Math.round(n.current.length));let l="",c="idle",d=!1,u=[],h="",p=-1e9,f="",m=-1e9,g=[],v=[],y=0,M=null;const b=new Map;"static"===getComputedStyle(t).position&&r.set(t,"position","relative");let x=t.querySelector("input");x||(x=document.createElement("input"),x.setAttribute("style","position:absolute;inset:0;width:100%;height:100%;margin:0;padding:0;border:0;opacity:0;font-size:16px;cursor:text"),t.appendChild(x),a.push(x));const w=x;w.setAttribute("inputmode","digits"===n.current.accept?"numeric":"text"),w.setAttribute("autocomplete","one-time-code"),w.setAttribute("maxlength",String(s())),"digits"===n.current.accept&&w.setAttribute("pattern","[0-9]*"),w.hasAttribute("aria-label")||w.hasAttribute("aria-labelledby")||w.setAttribute("aria-label",`Verification code, ${s()} ${"digits"===n.current.accept?"digits":"characters"}`);const k=()=>{const e=[...t.querySelectorAll(n.current.cells)];for(;e.length<s();){const n=document.createElement("span");n.dataset.cell="",n.setAttribute("aria-hidden","true"),w.parentElement===t?t.insertBefore(n,w):t.appendChild(n),a.push(n),e.push(n)}return e.slice(0,s())},S=t=>{let e=t.querySelector("[data-digit]");return e||(e=document.createElement("span"),e.dataset.digit="",t.appendChild(e),a.push(e)),e},A=(t,e,n,r,o,a,i,s=1,l=0,c=0,d=1)=>{const u=((t,e,n,r)=>{const o=`${t}|${Math.round(e)}x${Math.round(n)}|${r}`;let a=b.get(o);if(!a){a=document.createElement("canvas"),a.width=Math.max(2,Math.round(2*e)),a.height=Math.max(2,Math.round(2*n));const i=a.getContext("2d");i&&(i.scale(2,2),i.fillStyle="#fff",i.shadowColor="#fff",i.shadowBlur=3,i.font=`600 ${Math.round(.6*n)}px ${r}`,i.textAlign="center",i.textBaseline="middle",i.fillText(t,e/2,n/2+1)),b.set(o,a)}return a})(e,n.w,n.h,i);t.globalAlpha=s;const h=n.w*d,p=n.h*d,f=n.x+(n.w-h)/2+l,m=n.y+(n.h-p)/2+c;for(let e=0;e<n.h;e+=4)for(let i=0;i<n.w;i+=3){if(T(i+31*a,e)>1.3*r-.12)continue;const n=3*(1-r);t.drawImage(u,2*i,2*e,6,8,f+i*d+(T(i,e+o)-.5)*n,m+e*d+(T(e,i+o)-.5)*n,3*d,4*d)}t.globalAlpha=1},C=(t,e)=>{t.toggleAttribute("data-shown",e),o.set(S(t),"opacity",e?"1":"0")};M=K({host:t,outset:16,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.92,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{M=null,o.restore(),k().forEach(t=>C(t,!0))},paint:({pen:e,w:n,h:r,now:o,still:a,box:i})=>{e.setTransform(2,0,0,2,0,0);const s=k(),v=a?0:Math.floor(o/110),y=getComputedStyle(t).fontFamily||"sans-serif";if("success"===c){const t=a?1:(o-m)/700,i=n/2,l=r/2;if(s.forEach(t=>C(t,!1)),t<.55){const n=(t/.55)**2;g.forEach((t,r)=>f[r]&&A(e,f[r],t,1,v,r,y,1-n**3,(i-t.x-t.w/2)*n,(l-t.y-t.h/2)*n,1-.65*n))}const c=I((t-.45)/.55);return c>0&&c<1&&(e.strokeStyle=Ke(.55*(1-c)),e.lineWidth=3,e.beginPath(),e.arc(i,l,18+44*(t=>1-(1-I(t))**3)(c),0,2*Math.PI),e.stroke()),((t,e,n,r)=>{if(r<=0)return;const o=[[e-20,n+1],[e-7,n+14],[e+21,n-14]],a=Math.hypot(13,13),i=Math.hypot(28,28);let s=r*(a+i);t.strokeStyle="#fff",t.lineWidth=8,t.lineCap="round",t.lineJoin="round",t.shadowColor="#fff",t.shadowBlur=4,t.beginPath(),t.moveTo(o[0][0],o[0][1]);const l=Math.min(1,s/a);if(t.lineTo(o[0][0]+(o[1][0]-o[0][0])*l,o[0][1]+(o[1][1]-o[0][1])*l),s-=a,s>0){const e=Math.min(1,s/i);t.lineTo(o[1][0]+(o[2][0]-o[1][0])*e,o[1][1]+(o[2][1]-o[1][1])*e)}t.stroke(),t.shadowBlur=0})(e,i,l+1,W(I((t-.4)/.45))),t<1}let M=!1;const b=o-p;return s.forEach((t,n)=>{const r=i(t),s=l[n];if(b<_e&&h[n])return C(t,!1),A(e,h[n],r,1-b/_e,v,n,y),void(M=!0);if(s){const i=a?1:(o-u[n])/300;if(C(t,i>=.7),i>=1)return;return M=!0,void(i>0&&A(e,s,r,i,v,n,y,i>.7?1-(i-.7)/.3:1))}if(C(t,!1),d&&n===l.length&&b>=_e){const t=a?.6:.5-.5*Math.cos(o/1600*Math.PI*2);e.fillStyle=Ke(.2+.26*t),e.beginPath(),e.roundRect(r.x+r.w/2-1.5,r.y+r.h/2-11,3,22,1.5),e.fill(),M=!0}}),M}});const $=(t,e)=>{v.push(setTimeout(e,t))},E=()=>{v.forEach(clearTimeout),v=[]},L=()=>{t.dataset.state=c,"error"===c?w.setAttribute("aria-invalid","true"):w.removeAttribute("aria-invalid");const e=d&&"success"!==c?Math.min(l.length,s()-1):-1;k().forEach((t,n)=>{S(t).textContent=l[n]??"",t.toggleAttribute("data-active",n===e),M||C(t,!0),"success"===c&&M?(r.set(t,"transition","opacity 200ms, scale 240ms cubic-bezier(.16, 1, .3, 1)"),r.set(t,"opacity","0"),r.set(t,"scale",".86")):(t.style.removeProperty("opacity"),t.style.removeProperty("scale"))}),w.value!==l&&(w.value=l),M?.kick()},z=t=>{E(),"idle"!==c&&(c="idle",m=-1e9),h="",p=-1e9;const e=((t,e,n="digits")=>("digits"===n?t.replace(/\D/g,""):t.replace(/[^a-z\d]/gi,"").toUpperCase()).slice(0,e))(t,s(),n.current.accept),r=performance.now();let o=0;for(let t=0;t<e.length;t++)e[t]!==l[t]&&(u[t]=i()?-1e9:r+y*o++);l=e,L(),e.length===s()&&$(i()||!M?0:300+y*Math.max(0,o-1)+80,()=>n.current.onComplete?.(e)),y=0},R=()=>z(w.value),P=()=>{y=55},F=()=>{d=!0,L()},O=()=>{d=!1,L()};return w.addEventListener("input",R),w.addEventListener("paste",P),w.addEventListener("focus",F),w.addEventListener("blur",O),w.value?z(w.value):L(),Q(()=>M,n,()=>{w.setAttribute("maxlength",String(s())),L(),M?.refresh()},{verify:e=>{E();const n=performance.now();if(e)return f=l,g=M?k().map(t=>M.box(t)):[],m=n,c="success",void L();h=l,p=i()||!M?n-_e:n,c="error",L(),i()||"function"!=typeof t.animate||t.animate([{translate:"0"},{translate:"-9px"},{translate:"7px"},{translate:"-4px"},{translate:"2px"},{translate:"0"}],{duration:380,easing:"ease-out"});const r=l;$(i()||!M?0:_e,()=>{h===r&&(h="",l="",L())})},clear:()=>{E(),h="",p=-1e9,m=-1e9,l="",c="idle",L()},fill(t){y=55,z(t)},get value(){return l},get state(){return c}},()=>{E(),w.removeEventListener("input",R),w.removeEventListener("paste",P),w.removeEventListener("focus",F),w.removeEventListener("blur",O),o.restore(),r.restore();for(const t of a)t.remove();for(const e of t.querySelectorAll(n.current.cells))e.removeAttribute("data-shown"),e.removeAttribute("data-active");delete t.dataset.state})},exports.commandPalette=function(t,e={}){const n={current:{...Se,...e}},r=U(),o=()=>[...t.querySelectorAll(n.current.rows)],a=()=>t.querySelector(n.current.input);let i=n.current.open??!t.hasAttribute("hidden"),s=0,l=null,c=!1,d=0,u=0,h=null,p=!1,f=0,m=null;const g=()=>!!(n.current.reducedMotion??B());m=K({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{m=null},paint:({pen:t,now:e,still:n,box:r})=>{t.setTransform(2,0,0,2,0,0);const a=u?Math.min(48,e-u):16;if(u=e,h){const r=h,o=(e-r.start)/(r.closing?Ae:260);if(!(o>=1||n)){const e=r.closing?1-1.02*W(o):1.04*W(o);return function(t,e,n,r,o,a,i=1,s=.32,l=2){for(let c=0;c<n.length;c++){const d=n[c],u=(o-r[c]*(1-s))/s;if(u<=0)continue;const h=u>=1?0:1-u;let p=d.x,f=d.y;if(h>0){const[t,e]=a(d,h);p+=t,f+=e}t.globalAlpha=i*(1-h*h),t.drawImage(e,d.x*l,d.y*l,4*l,6*l,p,f,4,6)}t.globalAlpha=1}(t,r.snap,r.blocks,r.order,e,(t,e)=>[(r.ox-t.x)*e*.9,(r.oy-t.y)*e*.9],r.closing?1:1-I((o-.72)/.28),.4),!0}h=null}if(!i||p)return!1;const f=o()[s];if(!f)return!1;const m=r(f),g=l?.y??m.y;if(!l||n)l={...m};else{const t=1-Math.exp(-a/45);l={x:m.x,w:m.w,y:l.y+(m.y-l.y)*t,h:l.h+(m.h-l.h)*t}}d+=((c?1:0)-d)*(n?1:1-Math.exp(-a/70));const v=l.x+4,y=Math.max(4,l.h-14),M=l.y+7;return Math.abs(g-l.y)>.5&&(t.fillStyle=Ce(.32),t.fillRect(v,Math.min(g,l.y)+7,6,Math.abs(g-l.y)+y)),t.fillStyle=Ce(.7+.3*d),t.beginPath(),t.roundRect(v,M,6,y,3),t.fill(),Math.abs(m.y-l.y)>.3||Math.abs((c?1:0)-d)>.01}}),m&&(t.dataset.gpu="");const v=()=>{const t=o();if(s=t.length?Math.min(Math.max(0,s),t.length-1):0,!n.current.manage)return;t.forEach((t,e)=>t.setAttribute("aria-selected",String(e===s)));const e=a(),r=t[s]?.id;e&&r&&e.setAttribute("aria-activedescendant",r)},y=()=>`inset(0 round ${getComputedStyle(t).borderTopLeftRadius||"0px"})`,M=()=>{const e=n.current.trigger,r=t.offsetWidth,o=t.offsetHeight;if(!e)return`inset(0 ${Math.max(0,r/2-40)}px ${Math.max(0,o-36)}px round 18px)`;const a=X(t,e);return`inset(${a.y}px ${r-a.x-a.w}px ${o-a.y-a.h}px ${a.x}px round ${a.h/2}px)`},b=e=>{const r=m;if(!r)return;const o=t.offsetWidth,a=t.offsetHeight,i=ke(t,r.box,o,a,2),s=function(t,e=2){const n=t.getContext("2d",{willReadFrequently:!0});if(!n)return[];const r=t.width,o=t.height,a=n.getImageData(0,0,r,o).data,i=[];for(let t=0;t<o/e;t+=6)for(let n=0;n<r/e;n+=4){let s=!1;for(let i=0;i<6*e&&!s;i+=3)for(let l=0;l<4*e&&!s;l+=2){const c=Math.round(n*e+l),d=Math.round(t*e+i);c<r&&d<o&&a[4*(d*r+c)]>10&&(s=!0)}s&&i.push({x:n,y:t,seed:T(n,t)})}return i}(i,2),l=n.current.trigger,c=l?r.box(l):{x:o/2,y:0,w:0,h:0},d=c.x+c.w/2,u=c.y+c.h/2,p=Math.hypot(o,a)||1;h={snap:i,blocks:s,order:Float32Array.from(s,t=>Math.hypot(t.x-d,t.y-u)/p*.7+.3*t.seed),ox:d,oy:u,start:performance.now(),closing:e},r.kick()},x=e=>{if(e)for(const e of[...t.children])"CANVAS"===e.tagName&&void 0!==e.dataset.asciiKit||r.set(e,"opacity","0");else r.restore()},w=(e,n,r="none")=>"function"!=typeof t.animate?null:t.animate(e.map(t=>({clipPath:t})),{duration:n,easing:"cubic-bezier(.16, 1, .3, 1)",fill:r}),k=()=>{f&&clearTimeout(f),f=0},S=(e=!0)=>{!i||p?(k(),i=!0,p=!1,l=null,s=0,t.removeAttribute("hidden"),t.dataset.open="",n.current.trigger?.setAttribute("aria-expanded","true"),v(),e&&a()?.focus({preventScroll:!0}),n.current.onOpenChange?.(!0),g()?m?.kick():(t.dataset.state="opening",w([M(),y()],260),m&&(p=!0,x(!0),b(!1)),f=setTimeout(()=>{f=0,delete t.dataset.state,p=!1,x(!1),m?.kick()},143))):e&&a()?.focus({preventScroll:!0})},A=()=>{if(!i)return;k();const e=t.contains(document.activeElement),r=()=>{f=0,p=!1,i=!1,h=null,delete t.dataset.state,delete t.dataset.open,x(!1),t.setAttribute("hidden",""),n.current.trigger?.setAttribute("aria-expanded","false"),e&&n.current.trigger?.focus({preventScroll:!0}),m?.kick(),n.current.onOpenChange?.(!1)};if(g())return void r();p=!0,t.dataset.state="closing",m&&(b(!0),x(!0));const o=w([y(),M()],Ae,"forwards"),a="function"==typeof t.animate?t.animate([{opacity:1},{opacity:1,offset:.4},{opacity:0}],{duration:Ae,fill:"forwards"}):null;f=setTimeout(()=>{r(),o?.cancel(),a?.cancel()},Ae)},C=t=>{const e=o().length;e&&(s=(Math.round(t)%e+e)%e,v(),m?.kick())},$=(t=s)=>{const e=o()[t];if(!e||p)return;C(t),m?.field.pulse({element:e,strength:.6}),e.dataset.run="",n.current.onRun?.(t,e);const r=()=>{delete e.dataset.run,n.current.closeOnRun&&A()};g()?r():setTimeout(r,240)},E=t=>{if(!n.current.manage)return;const e=o().length;if("Escape"===t.key&&i)return t.preventDefault(),t.stopPropagation(),void A();if(t.target!==a()&&!o().includes(t.target))return;const r="ArrowDown"===t.key?s+1:"ArrowUp"===t.key?s-1:"Home"===t.key?0:"End"===t.key?e-1:null;if(null!==r)return t.preventDefault(),c=!1,void C(r);"Enter"===t.key&&(t.preventDefault(),$())},L=t=>{const e=t.target?.closest?.(n.current.rows);return e?o().indexOf(e):-1},z=t=>{if(!n.current.manage)return;const e=L(t);e<0||(c=!0,e!==s?C(e):m?.kick())},R=()=>{c=!1,m?.kick()},P=t=>{if(!n.current.manage)return;const e=L(t);e>=0&&$(e)},F=()=>{n.current.manage&&(c=!1,l=null,C(0))},O=()=>{i?A():S(!0)},N=t=>{const e=n.current.hotkey;e&&t.key?.toLowerCase()===e.toLowerCase()&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),i?document.activeElement===a()?A():a()?.focus():S(!0))},G=e=>{if(!n.current.manage||!i||p)return;const r=e.target;t.contains(r)||n.current.trigger?.contains(r)||A()};t.addEventListener("keydown",E),t.addEventListener("pointermove",z),t.addEventListener("pointerleave",R),t.addEventListener("click",P),t.addEventListener("input",F);const q=n.current.trigger;return q?.addEventListener("click",O),q?.setAttribute("aria-expanded",String(i)),q?.setAttribute("aria-haspopup","dialog"),document.addEventListener("keydown",N),document.addEventListener("pointerdown",G),i?t.dataset.open="":t.setAttribute("hidden",""),v(),Q(()=>m,n,()=>{v(),m?.refresh()},{open:S,close:A,select:C,run:$,toggle(){i?A():S(!0)},get isOpen(){return i},get selected(){return s}},()=>{k(),x(!1),t.removeEventListener("keydown",E),t.removeEventListener("pointermove",z),t.removeEventListener("pointerleave",R),t.removeEventListener("click",P),t.removeEventListener("input",F),q?.removeEventListener("click",O),document.removeEventListener("keydown",N),document.removeEventListener("pointerdown",G),delete t.dataset.gpu,delete t.dataset.state})},exports.compare=function(t,e){const n={current:{position:50,...e}},r=U();let o=I(n.current.position,0,100),a=null,i=null,s={from:o,to:o,at:-1e9},l=0,c=!1;const d=[];let u=n.current.position;i=K({host:t,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:600,cellSize:6,cellAspect:.8,glyphScale:.96,color:"source",levels:"auto",saturation:1.3,contrast:1.45,gamma:.85,brightness:.14,hover:"trail",trail:{strength:.7,radius:.3},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:(t,e)=>{const n=Math.min(1600,Math.max(2,Math.round(2*t)));return[n,Math.max(2,Math.round(n*e/Math.max(1,t)))]},onFail:()=>{i=null},paint:({pen:t,width:e,height:n})=>(t.imageSmoothingQuality="high",a&&tn(t,a,0,0,e,n),!1)});const h="string"==typeof n.current.image?Ze(n.current.image):n.current.image,p=t.querySelector('[role="slider"]'),f=t.querySelector("[data-compare-line]"),m=p??document.createElement("div"),g=f??document.createElement("span"),v=t=>{void 0===t&&m.hasAttribute("aria-label")||m.setAttribute("aria-label",t??"Photo and ASCII split")},y=()=>{const e=Math.round(o);r.set(t,"--ascii-pos",`${o}%`),m.setAttribute("aria-valuenow",String(e)),m.setAttribute("aria-valuetext",`${e}% photo, ${100-e}% ASCII`)},M=(t,e=!1)=>{if(t=I(t,0,100),!i)return void(o=t);if(l&&(cancelAnimationFrame(l),l=0),!e||i.still()||Math.abs(t-o)<.5)return o=t,y(),void n.current.onChange?.(o);s={from:o,to:t,at:performance.now()};const r=t=>{const e=I((t-s.at)/280);o=s.from+(s.to-s.from)*W(e),y(),n.current.onChange?.(o),l=e<1?requestAnimationFrame(r):0};l=requestAnimationFrame(r)},b=e=>{const n=t.getBoundingClientRect();return n.width?(e-n.left)/n.width*100:o},x=e=>{if(0!==e.button)return;t.setPointerCapture?.(e.pointerId),c=!0,t.dataset.dragging="";const n=b(e.clientX);M(n,Math.abs(n-o)>3),m.focus({preventScroll:!0})},w=t=>{c&&M(b(t.clientX))},k=()=>{c=!1,delete t.dataset.dragging},S=t=>{const e={ArrowLeft:-5,ArrowDown:-5,ArrowRight:5,ArrowUp:5,PageDown:-20,PageUp:20}[t.key],n="Home"===t.key?0:"End"===t.key?100:void 0!==e?5*Math.round(o/5)+e:null;null!==n&&(t.preventDefault(),M(n,!0))};let A=()=>{};if(i){ln("ascii-kit-compare","\n:where(.ascii-compare-photo){position:absolute;inset:0;width:100%;height:100%;object-fit:cover;pointer-events:none;clip-path:inset(0 calc(100% - var(--ascii-pos, 50%)) 0 0)}\n:where(.ascii-compare-line){position:absolute;top:0;bottom:0;left:var(--ascii-pos, 50%);width:2px;translate:-50% 0;background:#fff;box-shadow:0 0 0 .5px rgb(0 0 0 / .25),0 0 12px rgb(0 0 0 / .45);pointer-events:none}\n:where(.ascii-compare-handle){position:absolute;top:50%;left:var(--ascii-pos, 50%);display:grid;place-items:center;width:40px;height:40px;translate:-50% -50%;border-radius:50%;background:#fff;color:#111;box-shadow:0 0 0 1px rgb(0 0 0 / .08),0 4px 14px rgb(0 0 0 / .4);cursor:grab;touch-action:none}\n:where(.ascii-compare-handle:focus-visible){outline:2px solid #fff;outline-offset:3px}\n"),r.set(t,"overflow","hidden"),r.set(t,"touch-action","pan-y"),r.set(t,"user-select","none"),r.set(t,"cursor","ew-resize");const e={className:h.className,hidden:h.getAttribute("aria-hidden")};A=()=>{h.className=e.className,null===e.hidden?h.removeAttribute("aria-hidden"):h.setAttribute("aria-hidden",e.hidden)},h.className=(e.className?`${e.className} `:"")+"ascii-compare-photo",h.setAttribute("aria-hidden","true"),h.draggable=!1,f||(g.className="ascii-compare-line",g.setAttribute("aria-hidden","true")),p||(m.className="ascii-compare-handle",m.innerHTML='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 7-5 5 5 5M15 7l5 5-5 5"/></svg>',m.setAttribute("role","slider"),m.tabIndex=0),v(n.current.label),m.setAttribute("aria-valuemin","0"),m.setAttribute("aria-valuemax","100"),m.setAttribute("aria-orientation","horizontal");for(const e of[h,g,m])t.contains(e)||(t.appendChild(e),d.push(e));y(),t.addEventListener("pointerdown",x),t.addEventListener("pointermove",w),t.addEventListener("pointerup",k),t.addEventListener("pointercancel",k),m.addEventListener("keydown",S),Qe(h).then(t=>{a=t,i?.kick()},()=>{})}else t.contains(h)||("static"===getComputedStyle(t).position&&r.set(t,"position","relative"),h.setAttribute("style","position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit"),t.appendChild(h),d.push(h));return Q(()=>i,n,t=>{v(t.label),t.position!==u&&(u=t.position,M(t.position,!0)),i?.refresh()},{set:M,get position(){return o}},()=>{l&&cancelAnimationFrame(l),t.removeEventListener("pointerdown",x),t.removeEventListener("pointermove",w),t.removeEventListener("pointerup",k),t.removeEventListener("pointercancel",k),m.removeEventListener("keydown",S),delete t.dataset.dragging,d.forEach(t=>t.remove()),A(),r.restore()})},exports.contour=xr,exports.decode=function(t,e={}){const n={current:{...ut,...e}},r=U(),o=document.createElement("canvas"),a=document.createElement("canvas");let i=-1,s="",l=!1,c=!1,d=null;const u=(e,r)=>{const a=`${e}x${r}:${n.current.text??""}:${t.textContent}`;if(a===s)return;s=a,o.width=e,o.height=r;const i=o.getContext("2d");i.fillStyle="#000",i.fillRect(0,0,e,r),void 0!==n.current.text?function(t,e,n,r,o){const a=getComputedStyle(e),i=n.split("\n");t.fillStyle="#fff",t.textAlign="center",t.textBaseline="middle";const s=(parseFloat(a.letterSpacing)||0)/(parseFloat(a.fontSize)||16),l=e=>{"letterSpacing"in t&&(t.letterSpacing=s*e+"px")};t.font=`${a.fontWeight} 100px ${a.fontFamily}`,l(0);const c=Math.max(1,...i.map(e=>t.measureText(e).width)),d=Math.min(.94*r/c*100,.9*o/i.length);t.font=`${a.fontWeight} ${d}px ${a.fontFamily}`,l(d),i.forEach((e,n)=>t.fillText(e,r/2,o/2+(n-(i.length-1)/2)*d*1.04))}(i,t,n.current.text,e,r):function(t,e,n,r){const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),a=document.createRange();t.fillStyle="#fff",t.textAlign="left",t.textBaseline="alphabetic";for(let e=o.nextNode();e;e=o.nextNode()){const o=e.parentElement;if(!o)continue;const i=getComputedStyle(o);t.font=`${i.fontStyle} ${i.fontWeight} ${parseFloat(i.fontSize)*r}px ${i.fontFamily}`,"letterSpacing"in t&&(t.letterSpacing=(parseFloat(i.letterSpacing)||0)*r+"px");const s=t.measureText("Hg"),l=s.fontBoundingBoxAscent||parseFloat(i.fontSize)*r*.8,c=s.fontBoundingBoxDescent||parseFloat(i.fontSize)*r*.2,d="uppercase"===i.textTransform?t=>t.toUpperCase():"lowercase"===i.textTransform?t=>t.toLowerCase():t=>t;for(const o of e.data.matchAll(/\S+/g)){a.setStart(e,o.index),a.setEnd(e,o.index+o[0].length);const i=a.getClientRects()[0];if(!i)continue;const s=(i.top-n.top)*r,u=i.height*r;t.fillText(d(o[0]),(i.left-n.left)*r,s+(u-l-c)/2+l)}}a.detach?.()}(i,t,t.getBoundingClientRect(),e/(t.getBoundingClientRect().width||1))};d=K({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4.5,cellAspect:.62,glyphScale:.92,contrast:1.35,hover:"trail",trail:{strength:.6,radius:.2},...n.current.look}),ink:()=>n.current.ink??getComputedStyle(t).color,kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{d=null,r.restore()},paint:({pen:t,width:e,height:r,now:s,still:d})=>{u(e,r);const p=n.current,f="text"===p.settle;if(i<0||d)return!(!c&&"visible"===p.trigger&&!d)&&(f&&i>=0||t.drawImage(o,0,0),i>=0&&h(),!1);const m=s-i,g=.3*p.duration,v=.7*p.duration,y=Math.max(2,Math.ceil(e/20)),M=Math.max(2,Math.ceil(r/20));if(a.width===y&&a.height===M||(a.width=y,a.height=M),ht(a,m/1e3),t.imageSmoothingEnabled=!0,m<g)return t.drawImage(a,0,0,e,r),l&&(t.globalAlpha=1-W(m/g),t.drawImage(o,0,0),t.globalAlpha=1),!0;const b=Math.min(1,(m-g)/v),x=(1.18*b-.02)*e,w=.14*e,k=5.58,S=Math.floor(s/16);if(b>=1)return f||t.drawImage(o,0,0),h(),!1;t.drawImage(a,0,0,e,r),x>0&&t.drawImage(o,0,0,x,r,0,0,x,r);for(let e=Math.max(0,Math.floor(x/k)*k);e<x+w;e+=k){const n=(e-x)/w;for(let a=0;a<r;a+=9)T(e+13*S,a)<n||(t.globalAlpha=.35+.65*T(a+7*S,e),t.fillStyle="#000",t.fillRect(e,a,k,9),t.drawImage(o,e,a,k,9,e,a,k,9))}return t.globalAlpha=1,!0}});const h=()=>{i=-1,l="text"!==n.current.settle,l||r.restore()},p=()=>{d&&(r.set(t,"-webkit-text-fill-color","transparent"),c=!0,i=performance.now(),d.kick())};let f=!1;const m=d&&"visible"===n.current.trigger&&"function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{t.isIntersecting&&!f&&p(),f=t.isIntersecting},{threshold:.5}):null;d&&("text"!==n.current.settle&&r.set(t,"-webkit-text-fill-color","transparent"),l="text"!==n.current.settle&&"manual"===n.current.trigger,m?m.observe(t):"visible"===n.current.trigger&&p());let g=!1;const v=()=>{g||(g=!0,n.current.replayOnHover&&i<0&&p())},y=()=>{g=!1},M=e=>{!g||e.target instanceof Node&&t.contains(e.target)||(g=!1)};return d&&(t.addEventListener("pointerenter",v),t.addEventListener("pointermove",v),t.addEventListener("pointerleave",y),document.addEventListener("pointermove",M,!0)),d&&document.fonts?.ready.then(()=>{s="",d?.kick()}),Q(()=>d,n,()=>{s="",d?.refresh()},{replay:p},()=>{m?.disconnect(),t.removeEventListener("pointerenter",v),t.removeEventListener("pointermove",v),t.removeEventListener("pointerleave",y),document.removeEventListener("pointermove",M,!0),r.restore()})},exports.disintegrate=function(t,e={}){const n=Cn.get(t);if(n)return n;const r={...Sn,...e},o=U(),a=t.offsetHeight,i=()=>{for(const e of t.children)o.set(e,"opacity","0");o.set(t,"color","transparent"),o.set(t,"pointer-events","none"),t.setAttribute("aria-hidden","true")},s=e=>{r.collapse&&(o.set(t,"box-sizing","border-box"),o.set(t,"overflow","hidden"),o.set(t,"min-height","0"),o.set(t,"height",`${(a*(1-e)).toFixed(2)}px`),e>=1&&(o.set(t,"padding-block","0"),o.set(t,"margin-block","0"),o.set(t,"border-width","0")))},l=r.host??t.parentElement??t;let c=0,d=!1,u=null,h={x:0,y:0,w:0,h:0},p=()=>{};const f=K({host:l,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,contrast:1.6,drift:5,...r.look}),outset:An,resolution:2,ink:()=>r.ink??"--ascii-ink-strong",kit:{current:{lazy:!1,globalLook:r.globalLook}},reducedMotion:()=>r.reducedMotion,onFail:()=>p(),paint:({pen:t,now:e,still:n,scale:o})=>{if(n)return queueMicrotask(p),!1;if(!u||!d)return!1;const a=e-c,i=I(a/r.duration);t.setTransform(o,0,0,o,0,0),a>=300&&s(W(I((a-300)/260))),t.save(),t.globalAlpha=I(2.2*(1-i))*(1-.9*i*i),t.translate(8*i,-14*i),t.drawImage(u,0,0,u.width/2,u.height/2),t.globalCompositeOperation="destination-out";const l=h.x+h.w,f=l-(1.3*i-.3)*h.w,m=l-1.3*i*h.w,g=t.createLinearGradient(m,0,Math.max(m+1,f),0);g.addColorStop(0,"rgba(0,0,0,0)"),g.addColorStop(1,"rgba(0,0,0,1)"),t.globalAlpha=1,t.fillStyle=g,t.fillRect(h.x-An,h.y-An,h.w+32,h.h+32),t.restore();const v=a>=Math.max(r.duration,r.collapse?560:0);return v&&queueMicrotask(p),!v}}),m=new Promise(e=>{let n=!1;if(p=()=>{n||(n=!0,f?.destroy(),s(1),r.remove&&t.remove(),Cn.delete(t),e())},!f||f.still())return i(),void p();h=f.box(t),u=an(t,f.canvas.clientWidth||h.w+32,f.canvas.clientHeight||h.h+32,f.box).canvas;f.field.ready.then(()=>{n||d||(i(),d=!0,c=performance.now(),f.kick())},()=>{i(),p()})});return Cn.set(t,m),m},exports.dna=wr,exports.drift=Bn,exports.dropzone=function(t,e={}){const n={current:{...kn,...e}};let r="empty",o=null,a="",i="",s="image",l=0,c=0,d=!1,u=0,h=0,p=0,f=null,m=null,g=null;const v=V("",!0),y=["left","top","width","height"],M=()=>{const e=m?.canvas;if(!e||!t.offsetWidth)return null;const n="empty"===r?function(t,e,n=Math.min(2,"number"==typeof devicePixelRatio&&devicePixelRatio>0?devicePixelRatio:1)){const r=Math.max(2,Math.round(6*n)),o=Math.max(2,Math.round(1*r)),a=(t,e)=>{const r=Math.floor(t*n/e);for(let t=r;t>1;t--){const o=t*e/n;if(Math.abs(o-Math.round(o))<.01||t<r-8)return{n:t,css:Math.round(o)}}return{n:1,css:Math.round(e/n)}},i=a(t,o),s=a(e,r);return{cols:i.n,rows:s.n,w:i.css,h:s.css,cw:o/n,ch:r/n}}(t.offsetWidth,t.offsetHeight):null,o=n?[`${Math.round((t.offsetWidth-n.w)/2)}px`,`${Math.round((t.offsetHeight-n.h)/2)}px`,`${n.w}px`,`${n.h}px`]:["0px","0px","100%","100%"];let a=!1;return y.forEach((t,n)=>{e.style[t]!==o[n]&&(e.style[t]=o[n],a=!0)}),g=n,a?(m?.field.resize(),m?.kick(),null):n},b=document.createElement("input"),x=[v,b];let w=null;const k=!t.children.length;m=K({host:t,layer:"under",look:()=>"empty"===r?{mark:"glyph",charset:" .:+*#",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:1,glyphScale:.9,...n.current.look}:{mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,background:j(t)?"transparent":"#0b0b0a",color:"source",saturation:1.15,contrast:1.15,levels:"auto",brightness:"developing"===r?-1:.08,hover:"trail",trail:{strength:.6,radius:.3},...n.current.look},ink:t=>n.current.ink??`var(--ascii-ink, ${t?"#7a7872":"#76746e"})`,kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:(t,e)=>"empty"===r&&g?[2*g.cols,2*g.rows]:[Math.max(1,Math.round(t)),Math.max(1,Math.round(e))],onFail:()=>{m=null,a&&C(a)},paint:({pen:e,w:a,h:i,now:s,still:c})=>{if("empty"!==r){if(!o)return!1;const t=c?1:W(I((s-l)/n.current.develop));tn(e,o,0,0,a,i);const d=n.current.look?.brightness??.08;return"developing"===r&&m?.field.update({brightness:t*(1+d)-1}),t>=1&&"developing"===r&&A(),t<1}const u=p?Math.min(64,s-p):16;p=s;const f=d?1:0;h=c?f:h+(f-h)*(1-Math.exp(-u/70));const g=c?.5:.5-.5*Math.cos(s/1300*Math.PI*2),v=Math.max(4,(parseFloat(getComputedStyle(t).borderTopLeftRadius)||16)-6),y=M();y&&function(t,e,n,r,o){const{cols:a,rows:i}=e,s=t.createImageData(2*a,2*i),l=s.data,c=Math.max(1,n/e.cw),d=Math.max(1,n/e.ch),u=a-2,h=i-2;for(let t=0;t<i;t++)for(let e=0;e<a;e++){const n=Math.max(1+c-e,0,e-(u-c)),i=Math.max(1+d-t,0,t-(h-d));let s;if(n>0&&i>0){const t=Math.hypot(n/c,i/d);s=Math.hypot(n,i)*(1-1/t)}else s=-Math.min(e-1,u-e,t-1,h-t);const p=Math.abs(s)<.5?r:o>0&&s<-.5&&s>-1.5?.55*r*o:0,f=Math.round(255*Math.min(1,p));for(let n=0;n<4;n++){const r=4*((2*t+(n>>1))*a*2+2*e+(1&n));l[r]=l[r+1]=l[r+2]=f,l[r+3]=255}}t.putImageData(s,0,0)}(e,y,v,.56+h*(.14+.28*g),h*(.4+.6*g));const b=d||Math.abs(f-h)>.004;return b||(p=0),b}});const S=e=>{const o=r;r=e,t.dataset.state=e,"empty"===o!=("empty"===e)&&(M(),m?.refresh()),o!==e&&n.current.onState?.(e,"empty"===e?"":s)},A=()=>{S("done"),v.textContent=`${s} ready`,o&&n.current.onImage?.({file:f,src:a,width:o.width,height:o.height})};function C(e){w??(w=Object.assign(document.createElement("img"),{className:"ascii-drop-img",alt:""})),w.src=e,w.parentElement!==t&&(t.prepend(w),x.push(w))}const $=async(t,e=null)=>{const n=++c;let d;i&&URL.revokeObjectURL(i),i="string"==typeof t?"":URL.createObjectURL(t),a=i||t,f=e??("undefined"!=typeof File&&t instanceof File?t:null),s=f?.name??("string"==typeof t&&t.split("/").pop()?.split("?")[0]||"image"),v.textContent=`Converting ${s}`;try{d=await Qe(Ze(a))}catch{return void(n===c&&(v.textContent=`Could not load ${s}`))}if(n===c){if(o=d,!m)return C(a),S("done"),void A();l=performance.now(),S(m.still()?"done":"developing"),m.field.pulse({strength:1}),m.kick(),"done"===r&&A()}},E=t=>{const e=e=>{v.textContent=e,n.current.onError?.(e,t)};return t.type.startsWith("image/")?t.size>n.current.maxBytes?e(`${t.name} is over ${Math.round(n.current.maxBytes/1024/1024)} MB.`):void $(t,t):e(`${t.name} isn’t an image.`)},L=()=>{c++,o=null,a="",f=null,i&&URL.revokeObjectURL(i),i="",w?.remove(),S("empty"),v.textContent="",m?.kick()},z=()=>b.click(),R=e=>new Promise(a=>{const i=m?.field;if(!i||!o||"done"!==r)return void a(null);const l=document.createElement("canvas");l.width=i.canvas.width,l.height=i.canvas.height;const c=l.getContext("2d");c?(c.fillStyle=getComputedStyle(t).backgroundColor||"#000",c.fillRect(0,0,l.width,l.height),i.redraw(),c.drawImage(i.canvas,0,0),l.toBlob(t=>{if(t){const r=document.createElement("a");r.href=URL.createObjectURL(t),r.download=e??n.current.filename??`${s.replace(/\.[^.]+$/,"")}-ascii.png`,r.click(),setTimeout(()=>URL.revokeObjectURL(r.href),1e3)}a(t)},"image/png")):a(null)}),T=()=>{p=0,m?.kick()},P=e=>{e.preventDefault(),u++,d||(d=!0,t.dataset.over="",T())},F=t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="copy")},B=()=>{u=Math.max(0,u-1),!u&&d&&(d=!1,delete t.dataset.over,T())},O=e=>{if(e.preventDefault(),u=0,d=!1,delete t.dataset.over,m){const n=t.getBoundingClientRect();m.field.pulse({x:e.clientX-n.left,y:e.clientY-n.top,strength:1})}const n=e.dataTransfer?.files?.[0];n?E(n):T()},N=t=>{const e=t.target?.closest?.("[data-dropzone]")?.getAttribute("data-dropzone");"pick"===e?z():"clear"===e?L():"download"===e&&R()},G=()=>{const t=b.files?.[0];b.value="",t&&E(t)};ln("ascii-kit-dropzone",'\n:where(.ascii-drop-empty){position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;height:100%;min-height:inherit;padding:24px;box-sizing:border-box;text-align:center}\n:where([data-ascii-dropzone]:not([data-state="empty"])) :where(.ascii-drop-empty){display:none}\n:where(.ascii-drop-title){margin:0;font-weight:500}\n:where(.ascii-drop-hint){margin:0;font-size:14px;opacity:.65}\n:where(.ascii-drop-pick){margin-top:8px;height:34px;padding:0 14px;border:0;border-radius:999px;background:currentColor;font:inherit;font-size:14px;cursor:pointer}\n:where(.ascii-drop-pick) > span{color:Canvas}\n:where(.ascii-drop-img){position:absolute;inset:0;width:100%;height:100%;object-fit:cover}\n'),t.dataset.asciiDropzone="",b.type="file",b.accept="image/*",b.tabIndex=-1,b.hidden=!0,b.setAttribute("aria-hidden","true"),k&&x.push(function(){const t=document.createElement("div"),e=document.createElement("p"),n=document.createElement("p"),r=document.createElement("button"),o=document.createElement("span");return t.className="ascii-drop-empty",e.className="ascii-drop-title",e.textContent="Drop an image",n.className="ascii-drop-hint",n.textContent="PNG, JPG or WebP",r.type="button",r.className="ascii-drop-pick",r.dataset.dropzone="pick",o.textContent="Choose file",r.appendChild(o),t.append(e,n,r),t}());for(const e of x)t.appendChild(e);return S("empty"),t.addEventListener("dragenter",P),t.addEventListener("dragover",F),t.addEventListener("dragleave",B),t.addEventListener("drop",O),t.addEventListener("click",N),b.addEventListener("change",G),Q(()=>m,n,()=>m?.refresh(),{setImage:t=>$(t),clear:L,pick:z,download:R,get state(){return r}},()=>{c++,i&&URL.revokeObjectURL(i),t.removeEventListener("dragenter",P),t.removeEventListener("dragover",F),t.removeEventListener("dragleave",B),t.removeEventListener("drop",O),t.removeEventListener("click",N),b.removeEventListener("change",G),x.forEach(t=>t.remove()),delete t.dataset.asciiDropzone,delete t.dataset.state,delete t.dataset.over})},exports.dune=Sr,exports.etch=Cr,exports.facet=Er,exports.fieldBackground=function(t,e={}){const n={current:{...ee,...e}},r=()=>"notFound"===n.current.preset;let o=0,a=!1,i=0;const s={x:-1e4,y:-1e4,at:-1e6},l=()=>function(t){const e=document.createElement("canvas").getContext("2d");e.font=re;const n=Math.max(320,Math.ceil(e.measureText(t).width)+160),{canvas:r,pen:o}=Zt(n,560);return o.fillStyle="#fff",o.textAlign="center",o.textBaseline="middle",o.font=re,o.letterSpacing="-10px",o.fillText(t,n/2,296),r}(n.current.text);let c=null;c=Kt({host:t,look:()=>{const t=n.current,e=t.clear,r=t=>!!e&&{element:e,padding:-14,feather:t,shape:"ellipse"};return{..."notFound"===t.preset?ie:"brand"===t.preset?ae({scale:oe()?1.4:1.6,brightness:.24,contrast:1.1,clear:r(.3)}):ae({scale:oe()?1.6:1.9,brightness:.26,contrast:1.15,clear:r(.22)}),...t.look}},ink:t=>{const e=n.current,r=e.palette,o="string"==typeof r?r:r?.[t?"dark":"light"];return o??e.ink?o??e.ink:"notFound"===e.preset?t?"#d8d6cf":"#1d1d1b":"brand"===e.preset?`var(--brand, ${t?"#8f80ff":"#5b4bd1"})`:t?"#8a8881":"#6b6964"},source:r()?l():null,label:n.current.label??(r()?n.current.text:void 0),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{c=null}}),c&&r()&&document.fonts?.load?.(re).then(()=>{c&&r()&&!a&&c.field.setSource(l())},()=>{});const d=(t,e=1.4)=>{c&&!c.still()&&(i=performance.now()+1400,te(c.field,t,e))},u=t=>{const e=n.current,o=performance.now();!c||r()||!e.ripple||c.still()||o<i||o-s.at<520||Math.hypot(t.clientX-s.x,t.clientY-s.y)<36||(Object.assign(s,{x:t.clientX,y:t.clientY,at:o}),te(c.field,{x:t.clientX,y:t.clientY},.65))};c&&t.addEventListener("pointermove",u);let h=n.current.preset,p=n.current.text;return Qt(()=>c,n,t=>{c&&((t.preset!==h||"notFound"===t.preset&&t.text!==p)&&(o++,a=!1,c.field.setSource("notFound"===t.preset?l():null)),h=t.preset,p=t.text)},{pulse:d,scatter:async t=>{const e=c?.field;if(!e)return;if(!r())return void d(t);if(t&&d(t,1.2),a||c.still())return;a=!0;const n=++o,i=l(),s=function(t){const e=t.getContext("2d").getImageData(0,0,t.width,t.height).data,n=[];for(let r=0;r<t.height;r+=ne)for(let o=0;o<t.width;o+=ne){let a=!1;for(let n=0;n<ne&&!a;n+=4)for(let i=0;i<ne&&!a;i+=4)a=(e[4*((r+n)*t.width+o+i)]??0)>40;if(!a)continue;const i=n.length,s=T(i,1)*Math.PI*2,l=120+420*T(i,2);n.push({x:o,y:r,dx:Math.cos(s)*l+.5*(o-t.width/2),dy:Math.sin(s)*l*.6,lag:.35*T(i,3)})}return n}(i),u=Zt(i.width,i.height).canvas;for(const t of se){const r=performance.now();if(le(i,u,s,t),await e.setSource(u),await _t(Math.max(0,44-(performance.now()-r))),n!==o||!c)return void(a=!1)}await e.setSource(i),a=!1}},()=>{o++,t.removeEventListener("pointermove",u)})},exports.fire=Lr,exports.fluid=jn,exports.getFieldBudget=()=>a,exports.getGlobalLook=()=>n,exports.grid=zr,exports.halftone=On,exports.imageGenerate=function(t,e={}){const n={current:{...e}},r=U(),o=document.createElement("canvas");let a="idle",i=0,s=0,l="",c=null;const d={from:{img:null,k:0,blur:12},to:{img:null,k:0,blur:12},at:-1e6},u=()=>void 0===n.current.image?t.querySelector("img"):n.current.image,h=(t,e)=>{const n=e?1:W(Math.min(1,Math.max(0,(t-d.at)/Xt))),r=d.from.blur+(d.to.blur-d.from.blur)*n;return[{...d.from,k:d.from.k*(1-n),blur:r},{...d.to,k:d.from.k+(d.to.k-d.from.k)*n,blur:r}]},p=(t,e,n)=>{const r=performance.now(),[o,a]=h(r,!!c?.still());d.from={img:a.img??o.img,k:o.k+a.k,blur:a.blur},d.to={img:t,k:e,blur:n},d.at=r,c?.kick()};c=K({host:t,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:7,cellAspect:.8,glyphScale:.8,contrast:1.4,drift:.5,speed:.6,hover:"trail",trail:{strength:.9,radius:.35},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:(t,e)=>{const n=Math.min(480,Math.max(2,Math.round(t)));return[n,Math.max(2,Math.round(n*e/Math.max(1,t)))]},onFail:()=>{c=null,r.restore()},paint:({pen:t,width:e,height:r,now:s,still:l})=>{const c="generating"===a,u=l?0:(s-i)/1e3;c&&n.current.elapsed&&(n.current.elapsed.textContent=(t=>{const e=t/1e3;return e<60?`${e.toFixed(1)}s`:`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,"0")}`})(s-i));const p=c&&!l?1+.12*Math.sin(2.1*u)*(.7+.3*Math.sin(.37*u)):1,f=Math.max(2,Math.ceil(24*r/Math.max(1,e)));24===o.width&&o.height===f||(o.width=24,o.height=f),ht(o,3.1+(c?.55*u:0),.35);const m=h(s,l),g=Math.min(1,m.reduce((t,e)=>t+(e.img?e.k:0),0));t.imageSmoothingEnabled=!0,t.globalAlpha=Math.max(0,1-g),t.filter=`brightness(${1.7*p})`,t.drawImage(o,0,0,e,r);for(const{img:n,k:o,blur:a}of m){if(!n||o<=0)continue;const i=n.width,s=n.height,l=Math.min(s,i*r/e),c=Math.min(i,s*e/r);t.globalAlpha=Math.min(1,1.25*o),t.filter=`brightness(1.3) blur(${a}px)`,t.drawImage(n,(i-c)/2,Math.max(0,.45*(s-l)),c,l,0,0,e,r)}return t.filter="none",t.globalAlpha=1,c||s-d.at<Xt}});const f=(e,r)=>{a=e,t.dataset.state=e,t.setAttribute("aria-busy",String("generating"===e)),n.current.onState?.(e,r)},m=t=>{const e=u();e&&c&&(r.set(e,"transition",c.still()?"none":`opacity ${t?Xt:240}ms ${t?"cubic-bezier(.45, 0, .25, 1)":"cubic-bezier(.16, 1, .3, 1)"}`),r.set(e,"opacity",t?"1":"0"))},g=t=>new Promise(e=>setTimeout(e,t)),v=t=>{const e=u();e&&(l&&URL.revokeObjectURL(l),l="string"==typeof t?"":URL.createObjectURL(t),e.src=l||t,c||r.set(e,"visibility","visible"))},y=async(t=n.current.stream)=>{if(!t)return a;const e=++s,r=()=>e===s,o=!!c?.still();i=performance.now(),f("generating"),m(!1),p(null,0,12);let l=0;try{for await(const e of"function"==typeof t?t():t){if(!r())return a;if(!(e.final??e.preview))continue;if(e.final){v(e.final),c&&p(await Jt(e.final),Yt.final.k,Yt.final.blur);break}if(!c){v(e.preview);continue}const t=Yt.preview[Math.min(l++,Yt.preview.length-1)];p(await Jt(e.preview),t.k,t.blur)}if(await g(o?0:Xt),!r())return a;f("done"),m(!0),c?.kick()}catch(t){if(!r())return a;p(null,0,12),await g(o?0:Xt),f("failed",t)}return a};{const t=u();t&&r.set(t,c?"opacity":"visibility",c?"0":t.getAttribute("src")?"visible":"hidden")}return n.current.stream&&y(),Q(()=>c,n,()=>c?.refresh(),{run:y,reset(){s++,p(null,0,12),f("idle"),m(!1)},get state(){return a}},()=>{s++,l&&URL.revokeObjectURL(l),delete t.dataset.state,t.removeAttribute("aria-busy"),r.restore()})},exports.likeBurst=function(t,e={}){const n={current:{...Fe,...e}},r=U(),o=()=>t.querySelector(n.current.icon)??t,a=()=>!!(n.current.reducedMotion??B());let i="true"===t.getAttribute("aria-pressed"),s=[],l=[],c=null;c=K({host:t,outset:n.current.outset,layer:n.current.layer,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.92,...n.current.look}),ink:t=>n.current.ink??("heart"===n.current.kind?`var(--ascii-like, ${t?"#ff6b70":"#e5484d"})`:"--ascii-ink-strong"),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{c=null},paint:({pen:t,w:e,now:r,box:a})=>{const i=a(o()),l=n.current.kind;s=s.filter(e=>{const n=(r-e.start)/("burst"===e.kind?560:300);if(n>=1)return!1;if(n<0)return!0;if(t.save(),"burst"===e.kind)Ne(t,l,i,n,e.seed);else{const e=i.x+i.w/2,r=i.y+i.h/2+3*We(n),o=i.h*(1+.12*We(n));Oe(t,l,e,r,o,(1-n)**1.4),t.fillStyle="#000";for(let a=r-o/2;a<r+o/2;a+=3)for(let r=e-o/2;r<e+o/2;r+=2)T(r,a)<1.15*n&&t.fillRect(r,a,2,3)}return t.restore(),!0});const c=n.current.limit;if(c&&s.length){const n=a(c),r=n.y+n.h,o=t.createLinearGradient(0,r-2,0,r+8);o.addColorStop(0,"#000"),o.addColorStop(1,"rgb(0 0 0 / 0)"),t.fillStyle="#000",t.fillRect(0,0,e,r-2),t.fillStyle=o,t.fillRect(0,r-2,e,10)}return s.length>0}});const d=()=>{l.forEach(clearTimeout),l=[]},u=()=>{if(d(),r.restore(),!c||a())return;const e=performance.now(),n=o();s=s.filter(t=>"undo"!==t.kind),s.push({kind:"burst",start:e,seed:Math.floor(e)%97}),n!==t&&r.set(n,"opacity","0"),l.push(setTimeout(()=>{r.restore(),n!==t&&"function"==typeof n.animate&&n.animate({opacity:["0","1"],scale:[".7","1"]},{duration:220,easing:"cubic-bezier(.34, 1.42, .64, 1)"})},347.2)),c.kick()},h=()=>{d(),r.restore(),c&&!a()&&(s=s.filter(t=>"burst"!==t.kind),s.push({kind:"undo",start:performance.now(),seed:0}),c.kick())},p=(e=!i)=>{i=e,t.setAttribute("aria-pressed",String(i)),i?u():h()},f=()=>{n.current.manage&&(p(),n.current.onChange?.(i))};return!t.hasAttribute("aria-pressed")&&n.current.manage&&t.setAttribute("aria-pressed","false"),t.addEventListener("click",f),Q(()=>c,n,()=>c?.refresh(),{burst:u,undo:h,toggle:p,get pressed(){return i}},()=>{d(),r.restore(),t.removeEventListener("click",f)})},exports.moire=Ir,exports.morph=Tr,exports.mountCanvas=Jn,exports.mountSurface=K,exports.noise=Pr,exports.odometer=function(t,e={}){const n=parseFloat((t.textContent??"").replace(/[^\d.-]/g,"")),r={current:{...pt,...e,value:e.value??(Number.isFinite(n)?n:0)}},o=U();let a=r.current.value,i=r.current.format(a),s={from:i,to:i,t0:-1e9,up:!0,first:-1},l=null;const c=V(i,!0),d=document.createElement("span"),u=()=>{d.replaceChildren(...[...i].map(t=>Object.assign(document.createElement("span"),{textContent:t}))),c.textContent=i};l=K({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:3,cellAspect:.66,glyphScale:1,shade:.2,contrast:1.1,...r.current.look}),ink:()=>r.current.ink??getComputedStyle(t).color,kit:r,reducedMotion:()=>r.current.reducedMotion,resolution:2,onFail:()=>{l=null,t.textContent=i,o.restore()},paint:({pen:t,now:e,still:n,box:o,scale:a})=>{const i=getComputedStyle(d),l=parseFloat(i.fontSize),c=parseFloat(i.letterSpacing)||0,u=`${i.fontStyle} ${i.fontWeight} ${i.fontSize} ${i.fontFamily}`;t.setTransform(a,0,0,a,0,0),t.font=u,t.textAlign="center",t.textBaseline="alphabetic";const h=t.measureText("0"),p=h.fontBoundingBoxAscent||.8*l,f=h.fontBoundingBoxDescent||.2*l,{from:m,to:g,t0:v,up:y,first:M}=s,b=[...d.children],x=r.current,w="glyph"===x.face,k=(t,e)=>t[t.length-1-e]??"";let S=!1;return b.forEach((r,a)=>{const i=b.length-1-a,s=o(r),d=s.x+(s.w-c)/2,h=s.y,A=s.h,C=h+(A-p-f)/2+p,$=k(g,i),E=M-i,L=!n&&M>=0&&E>=0&&/\d/.test($)?I((e-v)/(x.duration+E*x.stagger)):1,z=W(L),R=L<1&&!w?F(.72,1,L).toFixed(3):"";if(r.style.opacity!==R&&(r.style.opacity=R),L>=1)return void(w&&(t.globalAlpha=1,t.font=u,t.fillStyle="#fff",t.fillText($,d,C)));S=!0,t.globalAlpha=w?1:1-F(.72,1,L);const P=5+2*E,B=[k(m,i),...Array.from({length:P},(t,e)=>x.glyphs[Math.floor(T(e+7*i,v)*x.glyphs.length)]??""),$];y||B.reverse();const O=(B.length-1)*A,N=y?z*O:O-z*O;t.save(),t.beginPath(),t.rect(d-s.w,h,2*s.w,A),t.clip(),B.forEach((e,n)=>{const r=C+n*A-N;if(r<h-A||r>h+2*A)return;const o=n>0&&n<B.length-1;t.font=o?`600 ${.84*l}px "Geist Mono", ui-monospace, monospace`:u,t.fillStyle=o?"#d0d0d0":"#fff",t.fillText(e,d,r)}),t.restore()}),t.globalAlpha=1,S}});const h=()=>{l&&o.set(d,"color","glyph"===r.current.face?"transparent":"inherit")};l&&(o.set(d,"display","inline-flex"),h(),d.setAttribute("aria-hidden","true"),t.replaceChildren(c,d,...(t=>[...t.children].filter(t=>"IMG"===t.tagName&&void 0!==t.dataset?.asciiPoster))(t),l.canvas),u(),document.fonts?.ready.then(()=>l?.kick()));const p=e=>{if(!Number.isFinite(e))return;const n=a,o=i;a=r.current.value=e,i=r.current.format(e),l?o!==i&&(s={from:o,to:i,up:e>=n,first:ft(o,i),t0:performance.now()},u(),l.kick()):t.textContent=i};return Q(()=>l,r,t=>{h(),t.value!==a?p(t.value):(i=t.format(a),u(),l?.refresh())},{set:p,get value(){return a}},()=>{l&&(t.textContent=i),o.restore()})},exports.pageDissolve=function(t,e={}){const n={current:{...He,...e}},r=U();let o=null,a=0,i=Promise.resolve(),s=0,l=null;l=K({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:8,cellAspect:.6,glyphScale:.9,contrast:1.15,shade:.55,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{l=null;const t=o;o=null,r.restore(),t?.done()},paint:({pen:t,now:e})=>{const n=o;if(!n)return!1;const r=Math.min(1,(e-n.start)/n.ms),i=n.from<n.to?r*r:W(r),s=n.from+(n.to-n.from)*i;return function(t,e,n,r,o){const a=e.width,i=e.height,s=[],l=Math.max(...[[0,0],[a,0],[0,i],[a,i]].map(([t,e])=>Math.hypot(t-r.x,e-r.y)))||1;for(let c=0;c<i;c+=je)for(let i=0;i<a;i+=De){const a=Math.hypot(i+5-r.x,c+8-r.y)/l*.72+.28*T(i,c)-n;if(a>0&&t.drawImage(e,i,c,De,je,i,c,De,je),a>0&&a<.07)s.push([i,c]);else if(a<=0&&a>-.12){const n=-a/.12;t.globalAlpha=1-n,t.drawImage(e,i,c,De,je,i+18*(T(c,i+o)-.5)*n,c-10*n,De,je),t.globalAlpha=1}}t.globalCompositeOperation="lighter";for(const[n,r]of s)t.drawImage(e,n,r,De,je,n,r,De,je);t.globalCompositeOperation="source-over"}(t,n.art,s,n.at,++a),l?.field.update({brightness:-.22*(n.from<n.to?i:1-i)}),!(r>=1)||(o=null,n.done(),!1)}});const c=()=>[...t.children].filter(t=>!("CANVAS"===t.tagName&&void 0!==t.dataset.asciiKit)),d=(t,e,n,r,a,i)=>new Promise(s=>{o={art:e,from:n,to:r,start:performance.now(),ms:Math.max(1,a),at:i,done:s},t.kick()}),u=e=>ke(t,e.box,t.offsetWidth,t.offsetHeight,2,{skip:e.canvas}),h=async(e,o)=>{const a=l;if(!a||(n.current.reducedMotion??B()))return void await e();const i=((e,n)=>{if(e&&"getBoundingClientRect"in e){const t=n.box(e);return{x:2*(t.x+t.w/2),y:2*(t.y+t.h/2)}}return e?{x:2*e.x,y:2*e.y}:{x:t.offsetWidth/2*2,y:0}})(o??n.current.origin,a),s=u(a);t.dataset.state="out";for(const t of c())r.set(t,"opacity","0");if(await d(a,s,0,1.12,n.current.dissolve,i),await e(),l){a.canvas.isConnected&&a.canvas.parentElement===t||t.appendChild(a.canvas);for(const t of c())r.set(t,"opacity","0");t.dataset.state="in",await d(a,u(a),.92,-.12,n.current.condense,i),r.restore(),l?.field.update({brightness:0}),l?.kick()}};return Q(()=>l,n,()=>l?.refresh(),{swap(e,n){s++;const r=i.then(()=>h(e,n)).finally(()=>{0===--s&&delete t.dataset.state});return i=r.catch(()=>{}),r},get busy(){return s>0}},()=>{const e=o;o=null,r.restore(),delete t.dataset.state,e?.done()})},exports.pill=function(t,e={}){const n={current:{...Ot,...e}},r=t instanceof HTMLElement?[t]:[...t],o=1===r.length,a=o?r[0]:r.length?function(t){let e=t[0].parentElement;for(;e&&!t.every(t=>e.contains(t));)e=e.parentElement;return e??document.body}(r):null,i=U(),s=new Map,l=new Map,c=new Map,d=new Map,u=[],h=t=>void 0!==t.dataset.count?"count":"new"===Ut(t,n.current.tone)?"new":"status",p=(t=-1e6)=>{for(const e of r){const r=Ut(e,n.current.tone),o=s.get(e);o?o.to!==r&&s.set(e,{from:o.to,to:r,at:t}):s.set(e,{from:r,to:r,at:-1e6})}};p();const f=()=>m?.dark()??(!a||j(a))?"dark":"light";let m=null,g="";function v(){for(;u.length;)u.pop()();i.restore()}m=a?K({host:a,layer:o?"under":"over",look:()=>({mark:"glyph",charset:Gt[f()].charset,font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:8,cellAspect:.6,glyphScale:.92,color:"source",saturation:1,shade:0,...n.current.look}),ink:()=>n.current.ink,kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{m=null,v()},onTheme:()=>m?.field.update({charset:Gt[f()].charset}),paint:({pen:t,now:e,still:o,dark:a,box:i})=>{const u=n.current,p=a?"dark":"light",f={...Nt[p],...u.tones?.[p]},v=Gt[p].top,y=Math.min(2,globalThis.devicePixelRatio||1),M=Math.round(8*y)/y,b=Math.round(8*y*.6)/y,x=(t,e)=>jt(t,e*v),w=r.map(t=>function(t,e,n){const r=Math.round((t.y+t.h/2)/n-.5)*n,o=Math.ceil((t.x+5)/e)*e,a=Math.floor((t.x+t.w-5)/e)*e;return{x:o,y:r,w:Math.max(0,a-o)}}(i(t),b,M)),k=function(t,e){const n=t=>t.toFixed(2),r=t.filter(t=>t.w>4).map(({x:t,y:r,w:o})=>`M${n(t+2)} ${n(r)}H${n(t+o-2)}Q${n(t+o)} ${n(r)} ${n(t+o)} ${n(r+2)}V${n(r+e-2)}Q${n(t+o)} ${n(r+e)} ${n(t+o-2)} ${n(r+e)}H${n(t+2)}Q${n(t)} ${n(r+e)} ${n(t)} ${n(r+e-2)}V${n(r+2)}Q${n(t)} ${n(r)} ${n(t+2)} ${n(r)}Z`).join("");return r?`path("${r}")`:"inset(50%)"}(w,M);k!==g&&(g=k,m.canvas.style.clipPath=k);let S=!1;return r.forEach((r,a)=>{const{x:p,y:m,w:g}=w[a],v=h(r);if(!(g<=0)){if(t.save(),t.beginPath(),t.rect(p,m,g,M),t.clip(),"status"===v){const l=s.get(r),c=o?1:P((e-l.at)/240);c<1&&(S=!0);const d=Ht(f[l.from],f[l.to],c),h=!o&&(t=>void 0!==t.dataset.live?"false"!==t.dataset.live:n.current.live)(r);if(h){S=!0;const n=(e+1300*a)%4200/1100;if(n<1){const e=p-12+P(n)*(g+24);for(let n=p;n<p+g;n+=2){const r=.42*Dt(n-e,9);r>.05&&(t.fillStyle=x(d,r),t.fillRect(n,m,2,M))}}}const v=r.querySelector("[data-dot]");if(v&&u.indicator){const n=i(v),r=(y=n.x+n.w/2,Math.round(y/b-.5)*b),o=h?.5-.5*Math.cos(e/1800*Math.PI*2):.6,a="neutral"===l.to?.7:1,s=a*(.4+.4*o);t.fillStyle=x(d,s),t.fillRect(r-b,m,3*b,M),t.fillStyle=x(d,a),t.fillRect(r,m,b,M)}}else if("new"===v){const n=(e-(l.get(r)??-1e6))/900;if(n<1&&!o){S=!0;const e=p-20+P(n)*(g+40),r=Math.sin(Math.PI*Math.min(1,1.15*n));for(let n=p;n<p+g;n+=2){const o=(n-p)/g,a=o<.5?Ht(qt[0],qt[1],2*o):Ht(qt[1],qt[2],2*o-1),i=r*Dt(n-e,11);i>.2&&(t.fillStyle=jt(a,.55+.4*i),t.fillRect(n,m,2,M))}}}else{const n=c.get(r),a=d.get(r)?.digits.children,s=n?(e-n.at)/600:1;if(a)if(s>=1||o)for(const t of a)t.style.opacity="",t.style.translate="";else S=!0,[...a].forEach((r,o)=>{if(!n.changed[o])return;const a=r,s=i(a),l=(e-n.at-70*o)/460,c=P((l-.72)/.28);a.style.opacity=String(c),a.style.translate=`0 ${3*(c-1)}px`,l<=0||l>=1||(t.fillStyle=x(f.neutral,(.3+2.6*l%1*.7)*Math.min(1,(1-l)/.3)),t.fillRect(s.x,m,s.w,M))})}var y;t.restore()}}),S}}):null;const y=t=>[...t].map(t=>Object.assign(document.createElement("span"),{textContent:" "===t?"":t}));if(m){o||(m.canvas.style.zIndex="1");for(const t of r){const e=h(t);if("count"===e){const e=(t.textContent??"").trim(),n=[...t.childNodes],r=V(e),o=document.createElement("span");o.setAttribute("aria-hidden","true"),i.set(o,"display","inline-flex"),o.replaceChildren(...y(e)),t.replaceChildren(r,o),d.set(t,{text:e,live:r,digits:o}),u.push(()=>{const r=d.get(t)?.text??e;r===e?t.replaceChildren(...n):t.textContent=r})}else if("status"===e&&n.current.indicator&&!t.querySelector("[data-dot]")){const e=document.createElement("span");e.dataset.dot="",e.setAttribute("aria-hidden","true"),e.setAttribute("style","display:inline-block;flex:none;width:15px;height:8px;margin-inline-end:4px;vertical-align:middle"),t.prepend(e),u.push(()=>e.remove())}if(!o)for(const e of[...t.childNodes])if(3===e.nodeType&&e.textContent?.trim()){const t=document.createElement("span");e.parentElement.insertBefore(t,e),t.appendChild(e),u.push(()=>{t.parentElement?.insertBefore(e,t),t.remove()}),M(t)}else e instanceof HTMLElement&&void 0===e.dataset.dot&&M(e)}d.size&&document.fonts?.ready.then(()=>m?.kick()),a.addEventListener("pointermove",w),a.addEventListener("pointerleave",k)}function M(t){"static"===getComputedStyle(t).position&&i.set(t,"position","relative"),i.set(t,"z-index","2")}function b(t){const e=performance.now();for(const n of t?[t]:r.filter(t=>"new"===h(t)))l.set(n,e);m?.kick()}let x=null;function w(t){const e=t.target,o=r.find(t=>e&&t.contains(e))??null;o!==x&&(x=o,o&&"new"===h(o)&&n.current.sheen&&b(o))}function k(){x=null}return Q(()=>m,n,()=>{p(performance.now()),m?.refresh()},{sheen:b,count:(t,e)=>{const n=e??r.find(t=>"count"===h(t));if(!n)return;const o=String(t),a=d.get(n);if(!a)return void(n.textContent=o);if(o===a.text)return;const i=Math.max(o.length,a.text.length),s=a.text.padStart(i," "),l=o.padStart(i," "),u=m?.still()??!0;a.text=o,a.live.textContent=o,a.digits.replaceChildren(...y(l)),c.set(n,{at:u?-1e6:performance.now(),changed:[...l].map((t,e)=>t!==s[e])}),m?.kick()},refresh:()=>{p(performance.now()),m?.kick()}},()=>{a?.removeEventListener("pointermove",w),a?.removeEventListener("pointerleave",k),v()})},exports.pricingGlow=function(t,e={}){const n={current:{...ue,...e}},r=(e=n.current.saving)=>he(t,e,(()=>{const e=n.current.price;return"string"==typeof e?t.querySelector(e):e??t.querySelector("[data-price]")})(),n.current.font);let o=null,a=0,i=0,s=0,l=null;l=Kt({host:t,look:()=>({mark:"dot",scene:"drift",scale:"number"==typeof innerWidth&&innerWidth<760?1.7:1,cellSize:4,cellAspect:1,dotScale:.92,color:"ink",shade:0,fit:"cover",focus:{x:.5,y:.5},levels:"none",contrast:1.1,brightness:-.04,drift:.5,hover:"lantern",lantern:{radius:.26,strength:.4,trail:.7,follow:8},trail:{strength:.9,radius:.4},fluid:{radius:.09,refraction:.03,glow:.6},...n.current.look}),ink:t=>n.current.ink??(t?"#aeaca5":"#5c5a55"),source:o=r(),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{l=null,c?.disconnect()}}),i=t.offsetWidth,s=t.offsetHeight;const c=l&&"function"==typeof ResizeObserver?new ResizeObserver(()=>{!l||Math.abs(t.offsetWidth-i)<2&&Math.abs(t.offsetHeight-s)<2||(i=t.offsetWidth,s=t.offsetHeight,a++,l.field.setSource(o=r()))}):null;c?.observe(t);const d=async t=>{const e=l?.field,n=o;if(o=t,!e)return;const r=++a;if(!n||l.still())return void await e.setSource(t);const i=Zt(t.width,t.height),s=i.pen,c=t.width,d=t.height,u=.34*c;for(let o=1;o<=9&&r===a;o++){const r=performance.now(),a=o/9*(c+2*u)-u,l=Math.max(0,Math.min(c,a));s.globalCompositeOperation="source-over",s.drawImage(n,0,0,c,d),l>0&&s.drawImage(t,0,0,l,d,0,0,l,d);const h=s.createLinearGradient(a-u,0,a+.4*u,0);h.addColorStop(0,"rgb(0 0 0 / 0)"),h.addColorStop(.72,"rgb(255 255 255 / .5)"),h.addColorStop(1,"rgb(0 0 0 / 0)"),s.globalCompositeOperation="lighter",s.fillStyle=h,s.fillRect(0,0,c,d),await e.setSource(i.canvas),await _t(Math.max(0,48-(performance.now()-r)))}r===a&&l?.field===e&&await e.setSource(t)};return Qt(()=>l,n,()=>{d(r())},{sweep:()=>d(r()),saving:t=>(n.current={...n.current,saving:t},d(r(t))),pulse:(t,e=1.6)=>{l&&!l.still()&&te(l.field,t,e)}},()=>{a++,c?.disconnect()})},exports.pullRefresh=function(t,e){const n={current:{...$n,...e}},r=U(),o=()=>n.current.content??t.children[0]??null,a=V("",!0),i={x:0,v:0,to:0};let s="idle",l=!1,c=!1,d=0,u=-1,h=0,p=0,f=0,m=!0,g=null,v=[];const y=new WeakSet,M=t=>{a.textContent=t};g=K({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.94,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{g=null},paint:({pen:t,w:e,now:a,still:c,scale:d,box:u})=>{const y=f?Math.min(1/30,(a-f)/1e3):1/60;f=a;let M=l;c?(i.x=i.to,i.v=0):l||(M=function(t,e,n=300,r=.86,o=.2){const a=2*Math.sqrt(n)*r,i=Math.max(1,Math.ceil(240*e)),s=e/i;for(let e=0;e<i;e++)t.v+=(-n*(t.x-t.to)-a*t.v)*s,t.x+=t.v*s;return!(Math.abs(t.x-t.to)<o&&Math.abs(t.v)<12*o&&(t.x=t.to,t.v=0,1))}(i,y)||M),"refreshing"===s&&(h+=7.5*y,M=!0),"done"===s&&a-p<320&&(M=!0);const b=o();b&&r.set(b,"translate",`0 ${Math.max(0,i.x).toFixed(2)}px`),t.setTransform(d,0,0,d,0,0);const w=Math.max(0,i.x),k=e/2,S=w/2,A=I(w/n.current.threshold);if(w>.5){if(t.save(),t.beginPath(),t.rect(0,0,e,w),t.clip(),"idle"===s||"pulling"===s){const e=10+32*A,n=t.createRadialGradient(k,S,0,k,S,e);n.addColorStop(0,`rgba(255,255,255,${.25+.75*A*A})`),n.addColorStop(.55,`rgba(255,255,255,${.12+.5*A*A})`),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(k-e,S-e,2*e,2*e),A>=1&&(t.strokeStyle="rgba(255,255,255,.9)",t.lineWidth=8,t.beginPath(),t.arc(k,S,28,0,2*Math.PI),t.stroke())}else{const e="done"===s&&m?c?1:P((a-p)/300):0;t.lineWidth=9,t.lineCap="round";for(let n=0;n<18;n++){const r=h+n/18*Math.PI*1.5;t.strokeStyle=`rgba(255,255,255,${(.15+n/17*.85)*(1-e)*("done"!==s||m?1:.4)})`,t.beginPath(),t.arc(k,S,28,r,r+1.5*Math.PI/18+.02),t.stroke()}e>0&&function(t,e,n,r,o){if(o<=0)return;const a=[[-.82,.02],[-.26,.56],[.86,-.6]].map(([t,o])=>[e+t*r,n+o*r]),i=Math.hypot(a[1][0]-a[0][0],a[1][1]-a[0][1])+Math.hypot(a[2][0]-a[1][0],a[2][1]-a[1][1]);t.save(),t.strokeStyle="#fff",t.lineWidth=.44*r,t.lineCap="round",t.lineJoin="round",t.setLineDash([i*o,i]),t.beginPath(),t.moveTo(a[0][0],a[0][1]),t.lineTo(a[1][0],a[1][1]),t.lineTo(a[2][0],a[2][1]),t.stroke(),t.restore()}(t,k,S,26,e)}t.restore()}return v=v.filter(e=>{if(!e.row.isConnected)return x(e,!0),!1;const n=c?1:(a-e.start)/760;if(n<0||!Number.isFinite(n))return M=M||Number.isFinite(n),!0;if(n>=En&&x(e),n>=1)return x(e,!0),!1;const r=u(e.row);(!e.snap||Math.abs(e.snap.width/2-r.w)>.5||Math.abs(e.snap.height/2-r.h)>.5)&&(e.snap=an(e.row,r.w,r.h,t=>{const e=u(t);return{x:e.x-r.x,y:e.y-r.y,w:e.w,h:e.h}}).canvas,e.photos=[...e.row.querySelectorAll("img")]);const o=e.snap;return e.photos.length&&function(t,e,n){const r=e.getContext("2d"),o=n(t.row);t.photos=t.photos.filter(t=>{if(!t.complete)return!0;if(!r||!t.naturalWidth)return!1;const e=n(t),a=e.x-o.x,i=e.y-o.y,s=Math.min(parseFloat(getComputedStyle(t).borderTopLeftRadius)||0,e.w/2,e.h/2);return r.save(),r.setTransform(2,0,0,2,0,0),r.beginPath(),r.roundRect(a,i,e.w,e.h,s),r.clip(),r.fillStyle="#000",r.fillRect(a,i,e.w,e.h),tn(r,en({image:t,width:t.naturalWidth,height:t.naturalHeight},!g?.dark()),a,i,e.w,e.h),r.restore(),!1})}(e,o,u),t.globalAlpha=n<En?P(n/En,3):1-P((n-En)/.7,3),t.drawImage(o,r.x,r.y,r.w,r.h),t.globalAlpha=1,M=!0,!0}),M||(f=0),M}});const b=()=>g?.kick();function x(t,e=!1){const n=t.row.style;t.shown||(t.shown=!0,n.transition="opacity 280ms cubic-bezier(.16, 1, .3, 1)",n.opacity=t.opacity),e&&(n.transition=t.transition)}const w=(t,e)=>{if(g&&!g.still()){for(const n of t)n instanceof HTMLElement&&!y.has(n)&&(y.add(n),v.push({row:n,snap:null,start:e,opacity:n.style.opacity,transition:n.style.transition,shown:!1,photos:[...n.querySelectorAll("img")]}),n.style.transition="none",n.style.opacity="0");b()}},k=()=>{const t=performance.now();v.forEach(e=>{e.start===1/0&&(e.start=t)}),b()},S=t=>new Promise(e=>setTimeout(e,t)),A=async()=>{if("refreshing"===s||"done"===s)return;const e=n.current,r=!g||g.still();s="refreshing",l=c=!1,i.to=e.threshold,p=performance.now(),t.setAttribute("aria-busy","true"),M(e.messages?.refreshing??"Refreshing."),b(),m=!0;try{await Promise.all([e.onRefresh(),S(r?0:600)])}catch{m=!1}if("refreshing"===s){if(m&&e.reveal&&!r){await new Promise(t=>"function"==typeof requestAnimationFrame?requestAnimationFrame(()=>t()):t());const t=o();t&&w(t.querySelectorAll(e.reveal),1/0)}s="done",p=performance.now(),M(m?e.messages?.done??"Updated.":e.messages?.failed??"Couldn’t refresh."),b(),await S(r?0:620),"done"===s?(s="idle",i.to=0,k(),t.removeAttribute("aria-busy"),b()):k()}},C=e=>{0!==e.button||"idle"!==s||t.scrollTop>0||(l=!0,c=!1,d=e.clientY,u=e.pointerId)},$=e=>{if(!l||e.pointerId!==u)return;e.clientY<d&&(d=e.clientY);const n=(e.clientY-d)/(t.getBoundingClientRect().height/(t.clientHeight||1)||1);if(!c){if(n<6)return;c=!0,s="pulling";try{t.setPointerCapture?.(e.pointerId)}catch{}}i.x=i.to=(t=>128*(1-Math.exp(-Math.max(0,t)/128)))(n-6),i.v=0,b()},E=()=>{if(l&&(l=!1,c)){if(c=!1,i.x>=n.current.threshold)return s="idle",void A();s="idle",i.to=0,b()}},L=t=>{c&&t.preventDefault()},z=t=>{l&&t.preventDefault()};return g?(r.set(t,"overscroll-behavior-y","contain"),t.appendChild(a),t.addEventListener("pointerdown",C),t.addEventListener("pointermove",$),t.addEventListener("pointerup",E),t.addEventListener("pointercancel",E),t.addEventListener("touchmove",L,{passive:!1}),t.addEventListener("dragstart",z),t.addEventListener("selectstart",z)):t.appendChild(a),Q(()=>g,n,()=>g?.refresh(),{refresh:A,revealRows:t=>w(t,performance.now()),get state(){return s}},()=>{s="idle",v.forEach(t=>{t.row.style.opacity=t.opacity,t.row.style.transition=t.transition}),v=[],t.removeEventListener("pointerdown",C),t.removeEventListener("pointermove",$),t.removeEventListener("pointerup",E),t.removeEventListener("pointercancel",E),t.removeEventListener("touchmove",L),t.removeEventListener("dragstart",z),t.removeEventListener("selectstart",z),t.removeAttribute("aria-busy"),a.remove(),r.restore()})},exports.pulse=Fr,exports.rain=Wr,exports.resolveColor=N,exports.setFieldBudget=function(t){a=Number.isFinite(t)&&t>=1?Math.floor(t):12,b()},exports.setGlobalLook=function(t){n=t?{...t}:null;for(const t of o)t.relook();for(const t of[...r])t(n)},exports.silk=Br,exports.skeleton=function(t,e={}){const n={current:{...It,...e}},r=U();let o=0,a=null,i=null,s=null,l=null;const c=()=>[...t.querySelectorAll(n.current.blocks)].map((t,e)=>({el:t,kind:Bt(t),delay:void 0!==t.dataset.delay?Number(t.dataset.delay):80+e*n.current.stagger})),d=["mask-image","-webkit-mask-image"],u=()=>{r.restore(),t.removeAttribute("aria-busy"),i?.(),i=null};l=K({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",cellSize:5,cellAspect:.62,glyphScale:.92,font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,contrast:1.15,shade:.35,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{l=null,u()},paint:({pen:t,now:e,still:i,box:s,w:l})=>{if(null!==a&&i)return u(),!1;const h=n.current,p=null===a?-1:e-a;if(null!==a&&p>Math.max(n.current.develop,...c().map(t=>t.delay+n.current.resolve))+16)return u(),!1;null!==a&&(t=>{for(const{el:e,kind:o,delay:a}of c()){const i=Pt(t,a,n.current.resolve);if(r.set(e,"opacity",String("text"===o?Math.min(1,1.6*i):i)),"text"===o){const t=128*i-14;for(const n of d)r.set(e,n,i>=1?"none":`linear-gradient(90deg, #000 ${t-14}%, transparent ${t+14}%)`)}}})(p);const f=Math.max(140,.42*l),m=l+f,g=-f+(i?.4:(e-o)/h.shimmer%1)*m,v=i?1:P((e-o)/280,3),y=t.createLinearGradient(g-m,0,g+m,.08*m);for(let t=0;t<=32;t++){const e=Math.abs(t/16-1)*m,n=Math.min(e,Math.abs(m-e)),r=n<f?.5+.5*Math.cos(n/f*Math.PI):0;y.addColorStop(t/32,Tt(.24+(.54-.24)*r))}const M=(e,n,r,o,a)=>{t.beginPath(),t.roundRect(e,n,Math.max(0,r),o,Math.min(a,o/2,Math.max(0,r)/2))};for(const{el:e,kind:n,delay:r}of c()){const{x:o,y:a,w:i,h:l}=s(e),c=e.getBoundingClientRect().width,d=Wt(e,n,c&&i?c/i:1),u=Pt(p,r,h.resolve);if(t.fillStyle=y,"photo"===n){const n=p<0?0:P(p/h.develop,4);t.globalAlpha=(1-u)*v,M(o,a,i,l,d.radius),t.fill();const r=e instanceof HTMLImageElement?e:e.querySelector("img");if(n>0&&r?.complete&&r.naturalWidth){const e=Math.max(i/r.naturalWidth,l/r.naturalHeight),s=r.naturalWidth*e,c=r.naturalHeight*e;t.save(),M(o,a,i,l,d.radius),t.clip(),t.globalAlpha=n*(1-u),t.drawImage(r,o+(i-s)/2,a+(l-c)/2,s,c),t.restore()}}else if("avatar"===n)t.globalAlpha=(1-u)*v,t.beginPath(),t.arc(o+i/2,a+l/2,Math.min(i,l)/2,0,2*Math.PI),t.fill();else{t.globalAlpha=v*(1-u);for(const e of d.lines){const n=o+e.x,r=n+e.w*u;M(r,a+e.y,n+e.w-r,e.h,d.radius),t.fill()}}t.globalAlpha=1}return!0}});const h=()=>{const e=null!==a;if(o=performance.now(),a=null,t.setAttribute("aria-busy","true"),l){if(e&&!l.still())for(const{el:t}of c())t.animate?.([{opacity:1},{opacity:0}],{duration:240,easing:"cubic-bezier(.16, 1, .3, 1)"});(()=>{for(const{el:t}of c()){r.set(t,"opacity","0");for(const e of d)t.style.removeProperty(e)}})(),l.kick()}};return h(),Q(()=>l,n,()=>l?.refresh(),{resolve:()=>l?(null!==a&&s||(a=performance.now(),s=new Promise(t=>{i=t}),l.kick()),s):(t.removeAttribute("aria-busy"),Promise.resolve()),reset(){i?.(),i=null,s=null,h()},get loading(){return null===a}},()=>{u()})},exports.slideToConfirm=function(t,e={}){const n={current:{...$e,...e}},r=U(),o=t.querySelector(n.current.thumb)??t.firstElementChild,a=()=>t.querySelector(n.current.label),i=()=>!!(n.current.reducedMotion??B());let s=Re(0,520,.8),l=Re(0,150,1),c=!1,d=0,u=!1,h=0,p=0,f=[],m=0,g=0,v=0,y="",M=-1,b=null;const x=()=>{if(!o)return null;const e=Math.max(0,(t.clientHeight-o.offsetHeight)/2);return{pad:e,size:o.offsetHeight,max:Math.max(1,t.clientWidth-o.offsetWidth-2*e)}},w=()=>t.getBoundingClientRect().width/(t.clientWidth||1)||1,k=e=>N(n.current.ink??"--ascii-ink-strong",t)??N(getComputedStyle(t).color,t)??(e?"#d8d6cf":"#1d1d1b");b=K({host:t,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.94,...n.current.look}),ink:k,kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{b=null},onTheme:()=>{y=""},paint:({pen:e,w:r,h:o,now:a,still:i,dark:c,box:d})=>{const f=x();if(!f)return!1;const m=u?i?1:I((a-h)/Ee):0,g=ze(I(m/.5)),v=ze(I((m-.36)/.3)),M=ze(I((m-.46)/.4)),w=I((m-.5)/.5),S=1+.07*Math.sin(Math.PI*w)*(1-w),A=p?1-I((a-p)/260):1,C=n.current.mark?d(n.current.mark):{x:r/2-18,y:o/2-18,w:36,h:36},$=C.x+C.w/2,E=C.y+C.h/2,L=Math.min(C.w/2,o/2-2)*S,z=u?D(k(c),(e=>N(n.current.color??"--ascii-success",t,e?"#3ccf7e":"#17844a"))(c),ze(I(i?1:(a-h)/360))):k(c);z!==y&&(y=z,b?.field.update({ink:z})),e.save(),e.globalAlpha=A,e.beginPath(),r>4&&o>4&&e.roundRect(2,2,r-4,o-4,(o-4)/2),e.clip(),e.fillStyle=`rgba(255,255,255,${.1*(1-g)})`,e.fillRect(0,0,r,o);const R=f.pad+s.x+f.size/2,T=u?1:l.x,P=Le(0,$-L,g),F=Le(R,$+L,g),W=Le(0,E-L,g),B=Le(o,E+L,g);if(F-P>1&&T>.004){const t=e.createLinearGradient(P,0,F,0);t.addColorStop(0,`rgba(255,255,255,${Le(.14,1,g)*T})`),t.addColorStop(.62,`rgba(255,255,255,${Le(.48,1,g)*T})`),t.addColorStop(1,`rgba(255,255,255,${T})`),e.fillStyle=t,e.globalAlpha=A*(1-.28*v),e.beginPath(),e.roundRect(P,W,F-P,B-W,Le(0,L,g)),e.fill()}return v>0&&(e.globalAlpha=1,e.fillStyle="#000",e.beginPath(),e.arc($,E,Math.max(0,L-5)*v,0,2*Math.PI),e.fill()),e.restore(),M>0&&function(t,e,n,r,o,a,i){if(o<=0||a<=0)return;const s=[[-.82,.02],[-.26,.56],[.86,-.6]].map(([t,o])=>[e+t*r,n+o*r]),l=Math.hypot(s[1][0]-s[0][0],s[1][1]-s[0][1])+Math.hypot(s[2][0]-s[1][0],s[2][1]-s[1][1]);t.save(),t.globalAlpha=a,t.strokeStyle="#fff",t.lineWidth=i,t.lineCap="round",t.lineJoin="round",t.setLineDash([l*o,l]),t.beginPath(),t.moveTo(s[0][0],s[0][1]),t.lineTo(s[1][0],s[1][1]),t.lineTo(s[2][0],s[2][1]),t.stroke(),t.restore()}(e,$+.02*L,E+.07*L,.55*L,M,A,4.5),!1}});const S=()=>{const t=x();if(!t||!o)return;const e=s.x/t.max;r.set(o,"translate",`${s.x}px 0`),o.setAttribute("aria-valuenow",String(Math.round(100*I(e))));const n=a();n&&r.set(n,"opacity",String(u?0:1-I(1.7*e)))},A=e=>{m=0;const n=Math.min(1/30,Math.max(0,(e-g)/1e3));g=e;let a=!c&&Ie(s,n,.3);a=Ie(l,n,.003)||a,p&&(e-p>=260||i())&&(p=0,u=!1,s=Re(0,520,.8),l=Re(0,150,1),t.dataset.state="idle",delete t.dataset.confirmed,o&&(r.set(o,"opacity","1"),r.set(o,"scale","1"),o.tabIndex=0)),u&&e-h>302.4&&(t.dataset.confirmed=""),S(),b?.kick(),(a||c||u&&e-h<760||p>0)&&(m=requestAnimationFrame(A))},C=()=>{m||(g=performance.now(),m=requestAnimationFrame(A))},$=()=>{const e=x();if(!e||u)return;const a=e.max-s.x;c=!1,u=!0,s.to=e.max,l.to=1,h=performance.now()+(a>4?200:90),i()&&(Te(s),Te(l),h=-1e6,t.dataset.confirmed=""),t.dataset.state="confirmed",o&&(o.setAttribute("aria-valuetext","Confirmed"),o.tabIndex=-1,r.set(o,"transition","opacity 200ms 160ms, scale 240ms 160ms"),r.set(o,"opacity","0"),r.set(o,"scale",".6")),v&&clearTimeout(v),n.current.resetAfter>0&&(v=setTimeout(E,n.current.resetAfter)),S(),C(),n.current.onConfirm?.()};function E(){if(v&&clearTimeout(v),v=0,!u)return s.to=0,l.to=0,void C();p=performance.now(),t.dataset.state="resetting",o?.removeAttribute("aria-valuetext"),C()}const L=e=>{const r=x();if(!c||!r||void 0!==e&&void 0!==e.pointerId&&e.pointerId!==M)return;c=!1;const o=Pe(f,performance.now());s.x>=r.max*n.current.threshold||o>900&&s.x>.5*r.max?$():(s.to=0,s.v=.25*I(o,-1500,1500),l.to=0,i()&&(Te(s),Te(l)),t.dataset.state="idle",C())},z=e=>{if(0===e.button&&!u&&o)if(o.contains(e.target)){try{o.setPointerCapture?.(e.pointerId)}catch{}M=e.pointerId,c=!0,d=e.clientX-s.x*w(),l.to=1,f=[],t.dataset.state="dragging",C()}else c||i()||(s.v+=420,l.to=0,C())},R=t=>{const e=x();c&&e&&t.pointerId===M&&(s.x=s.to=I((t.clientX-d)/w(),0,e.max),s.v=0,f.push([s.x,performance.now()]),f.length>8&&f.shift(),s.x>=e.max-.5?$():C())},T=t=>{const e=x();if(!e||u)return;if("Enter"===t.key||" "===t.key||"End"===t.key)return t.preventDefault(),void $();const n={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1}[t.key],r="Home"===t.key?0:void 0!==n?I(s.to+n*e.max/4,0,e.max):null;null!==r&&(t.preventDefault(),s.to=r,l.to=r>0?1:0,i()&&(Te(s),Te(l)),r>=e.max-.5?$():C())};o&&(o.hasAttribute("role")||o.setAttribute("role","slider"),o.hasAttribute("tabindex")||(o.tabIndex=0),o.hasAttribute("aria-label")||o.setAttribute("aria-label",a()?.textContent?.trim()||"Slide to confirm"),o.setAttribute("aria-valuemin","0"),o.setAttribute("aria-valuemax","100"),o.setAttribute("aria-valuenow","0"),r.set(o,"touch-action","none"),o.addEventListener("keydown",T));const P=t=>t.preventDefault();return t.dataset.state="idle",t.addEventListener("pointerdown",z),t.addEventListener("pointermove",R),t.addEventListener("pointerup",L),t.addEventListener("pointercancel",L),t.addEventListener("lostpointercapture",L),t.addEventListener("dragstart",P),Q(()=>b,n,()=>b?.refresh(),{confirm:$,reset:E,get confirmed(){return u}},()=>{m&&cancelAnimationFrame(m),v&&clearTimeout(v),m=v=0,o?.removeEventListener("keydown",T),t.removeEventListener("pointerdown",z),t.removeEventListener("pointermove",R),t.removeEventListener("pointerup",L),t.removeEventListener("pointercancel",L),t.removeEventListener("lostpointercapture",L),t.removeEventListener("dragstart",P),r.restore(),delete t.dataset.state,delete t.dataset.confirmed})},exports.stars=Or,exports.statusOrb=function(t,e={}){const n={current:{...yt,...e}};let r="idle",o=0,a=0,i="",s="",l=-1e9,c="",d=null;const u=e=>{if(!n.current.colourByState||"idle"===r||"loading"===r)return(e=>N(n.current.ink??"--ascii-ink-strong",t,e?"#d8d6cf":"#1d1d1b"))(e);const[o,a,i]=Mt[r];return N(n.current.colors?.[r]??o,t,e?i:a)};d=K({host:t,look:()=>({mark:"glyph",fit:"contain",charset:" .:-=+*#%@",cellSize:5,cellAspect:.62,glyphScale:.94,font:'"Geist Mono", ui-monospace, monospace',fontWeight:600,contrast:1.1,shade:.5,...n.current.look}),ink:t=>u(t),kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:()=>[240,240],onFail:()=>{d=null},onTheme:()=>{l=-1e9,c=""},paint:({pen:t,now:e,still:h,dark:p})=>{const f=e-o;Rt(t,r,h?380:e,h?800:f,a,n.current.ring);const m=u(p);m!==s&&(i=s||m,s=m,l=e);const g=h?1:At(Math.min(1,(e-l)/200)),v=g<1?D(i,s,g):s;return v!==c&&(c=v,d?.field.update({ink:v})),"loading"===r||f<800||g<1}});const h=e=>{const n=performance.now();"loading"===r&&"loading"!==e&&(a=$t(n)),r=e,o=n,t.dataset.state=e,"error"===e&&d&&!d.still()&&"function"==typeof t.animate&&t.animate({translate:["0","-5px 0","4px 0","-2px 0","0"]},{duration:260,easing:"cubic-bezier(.16, 1, .3, 1)"}),d?.kick()};return Q(()=>d,n,()=>d?.refresh(),{idle:()=>h("idle"),loading:()=>h("loading"),success:()=>h("success"),warning:()=>h("warning"),error:()=>h("error"),get state(){return r}},()=>{delete t.dataset.state})},exports.streamText=function(t,e={}){const n={current:{...yn,...e}},r=[...t.childNodes];let o="idle",a="",i=[],s=null,l=0,c=null,d=null,u=null;const h=()=>{const e=getComputedStyle(t),n=parseFloat(e.fontSize)||15,r=parseFloat(e.lineHeight),o=Number.isFinite(r)&&r>0?r:1.5*n;return{size:n,line:o,ch:o/2,cw:Math.max(2,Math.round(.44*n))}};let p=null,f=null;const m=e=>{o!==e&&(o=e,"done"!==e&&"stopped"!==e||(p?.setAttribute("data-collapsed",""),p?.setAttribute("aria-hidden","true")),"streaming"===e?t.setAttribute("aria-busy","true"):t.removeAttribute("aria-busy"),n.current.onState?.(e))},g=t=>t.span.style.removeProperty("color"),v=()=>{i.forEach(g),i=[],"streaming"===o&&c&&m("done"),c?.(),c=null};if(u=K({host:t,look:()=>{const{ch:t,cw:e}=h();return{mark:"glyph",charset:" :-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:t,cellAspect:e/t,glyphScale:1,shade:.6,...n.current.look}},ink:()=>n.current.ink??getComputedStyle(t).color,kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{u=null,v()},paint:({pen:t,now:e,still:r,box:a})=>{const{line:l,ch:d,cw:u,size:p}=h(),f=Math.floor(e/48),m=l/4,y=(e,n)=>{const r=Math.floor((e.y-m+e.h/2)/l)*l+m+(l-d)/2,o=Math.round(e.x/u),a=Math.round(255*n);t.fillStyle=`rgb(${a} ${a} ${a})`,t.fillRect(o*u,r,Math.max(1,Math.round((e.x+e.w)/u)-o)*u,d)};if(r&&(i.forEach(g),i=[]),i=i.filter(t=>e>=t.at?(g(t),!1):(y(a(t.span),.55+.45*T(f,t.seed)),!0)),!i.length&&c&&v(),n.current.caret&&"idle"!==o&&(s||"streaming"===o)){const t=s?a(s):{x:0,y:m,w:0,h:l},e=Math.round((t.x+t.w+.3*p)/u)*u;y({x:e,y:t.y,w:u,h:t.h},"streaming"===o?1:.7)}return i.length>0}}),u){const e=getComputedStyle(t),n=u.canvas.style,r=t=>parseFloat(t??"")||0,{line:o}=h(),a=r(e.paddingTop)-o/4,i=r(e.paddingRight)-o/2,s=r(e.paddingBottom)-o/4,l=r(e.paddingLeft);n.top=`${a}px`,n.left=`${l}px`,n.width=`calc(100% - ${l+i}px)`,n.height=`calc(100% - ${a+s}px)`}return Q(()=>u,n,()=>u?.refresh(),{write:e=>{if(!e)return;"streaming"!==o&&("idle"===o&&(t.replaceChildren(...xn(t)),u&&t.appendChild(u.canvas)),d=null,m("streaming")),a+=e;const r=e=>t.appendChild(e);if(!u)return void r(document.createTextNode(e));const c=performance.now(),h=n.current,p=u.still();let f=0;for(const t of e.match(/\s+|\S/g)??[]){if(/^\s/.test(t)){r(document.createTextNode(t));continue}const e=document.createElement("span");e.textContent=t,p||(e.style.setProperty("color","transparent"),i.push({span:e,at:c+h.settle+f*h.stagger,seed:31*l+f})),r(e),s=e,f++}l++,u.kick()},done:()=>d||("streaming"!==o?Promise.resolve():(d=new Promise(t=>{c=t}),u&&i.length?u.kick():v(),d)),stop(){if("idle"===o&&p)return d=null,m("stopped"),void u?.kick();"streaming"===o&&(i.forEach(g),i=[],m("stopped"),c?.(),c=null,u?.kick())},reasoning:e=>{if(!e||"undefined"==typeof document)return;if(!p||!f){ln("ascii-kit-reasoning",bn),p=document.createElement("div"),p.className="ascii-reasoning";const e=document.createElement("div");e.className="ascii-reasoning-in",f=document.createElement("ol"),e.appendChild(f),p.appendChild(e),t.parentElement?.insertBefore(p,t)}p.removeAttribute("data-collapsed"),p.removeAttribute("aria-hidden");const r=Math.max(1,Math.round(n.current.reasoningLines));p.style.setProperty("--ascii-reasoning-lines",String(r));const o=document.createElement("li");o.textContent=e;const a=n.current.reducedMotion??B();a||o.setAttribute("data-new",""),f.appendChild(o);const i=p,s=String(Math.max(0,f.children.length-r));a?i.style.setProperty("--ascii-reasoning-shift",s):(getComputedStyle(o).translate,requestAnimationFrame(()=>{o.removeAttribute("data-new"),i.style.setProperty("--ascii-reasoning-shift",s)}))},reset(){i=[],a="",s=null,l=0,p?.remove(),p=f=null,c?.(),c=null,d=null,t.replaceChildren(...xn(t)),u&&t.appendChild(u.canvas),m("idle"),u?.kick()},get state(){return o},get text(){return a}},()=>{c?.(),c=null,p?.remove(),p=f=null,t.removeAttribute("aria-busy"),a?t.textContent=a:t.replaceChildren(...r)})},exports.subscribeGlobalLook=function(t){return r.add(t),()=>{r.delete(t)}},exports.swipeDeck=function(t,e={}){const n={current:{...Ue,...e}},r=U(),o=()=>!!(n.current.reducedMotion??B()),a=()=>[...t.querySelectorAll(n.current.cards)];let i=0,s=Xe(0,380,.72),l=Xe(0,380,.8),c=Xe(0,260,.9),d=!1,u=0,h=0,p=null,f=[],m=0,g=0,v=-1,y=new Map,M=null,b=null;const x=t=>a()[k(t)]??null,w=()=>t.clientWidth||160,k=t=>{const e=a().length;return e?(t%e+e)%e:0},S=(e,r,o,i)=>{const s=x(e);if(!s||!n.current.loop&&e>=a().length)return null;const l="IMG"===s.tagName?s:s.querySelector("img"),c=`${l?.currentSrc||l?.src||""}|${l?.complete}|${Math.round(r)}x${Math.round(o)}|${i}`,d=y.get(s);if(d?.key===c)return d.canvas;const u=document.createElement("canvas");u.width=Math.max(1,Math.round(r)),u.height=Math.max(1,Math.round(o));const h=u.getContext("2d");if(!h)return null;const p=n.current.radius??(parseFloat(getComputedStyle(t).borderTopLeftRadius)||16);h.beginPath(),h.roundRect(0,0,u.width,u.height,Math.min(p,u.width/2,u.height/2)),h.clip();const f=l?function(t,e,n=.04){if(!t.complete||!t.naturalWidth)return null;const r=Math.min(1,420/Math.max(t.naturalWidth,t.naturalHeight)),o=document.createElement("canvas");o.width=Math.max(1,Math.round(t.naturalWidth*r)),o.height=Math.max(1,Math.round(t.naturalHeight*r));const a=o.getContext("2d",{willReadFrequently:!0});if(!a)return null;try{a.drawImage(t,0,0,o.width,o.height);const r=a.getImageData(0,0,o.width,o.height),i=r.data,s=new Uint32Array(256),l=i.length/4,c=t=>.2126*i[t]+.7152*i[t+1]+.0722*i[t+2];for(let t=0;t<i.length;t+=4)s[Math.round(c(t))]++;let d=0,u=255,h=0;for(let t=0;t<256;t++)if(h+=s[t],h>=.02*l){d=t;break}h=0;for(let t=255;t>=0;t--)if(h+=s[t],h>=.02*l){u=t;break}const p=Math.max(1,u-d);for(let t=0;t<i.length;t+=4){let r=I((c(t)-d)/p);e&&(r=1-r),i[t]=i[t+1]=i[t+2]=Math.round(255*(n+(1-n)*r)),i[t+3]=255}return a.putImageData(r,0,0),o}catch{return null}}(l,i):null;if(f){const t=Math.max(u.width/f.width,u.height/f.height),e=u.width/t,n=u.height/t;h.drawImage(f,(f.width-e)/2,(f.height-n)/2,e,n,0,0,u.width,u.height)}else h.fillStyle="rgb(60 60 60)",h.fillRect(0,0,u.width,u.height);return h.strokeStyle="rgb(150 150 150)",h.lineWidth=6,h.stroke(),y.set(s,{key:c,canvas:u}),u};function A(){const e=a(),o=i+(p?1:0),s=!n.current.loop&&o>=e.length?null:x(o);e.forEach(t=>{b?(r.set(t,"opacity","0"),t!==s?t.setAttribute("aria-hidden","true"):t.removeAttribute("aria-hidden")):t.hidden=t!==s}),t.setAttribute("aria-label",s?`${s.getAttribute("aria-label")||s.querySelector("img")?.alt||s.textContent?.trim()||"Card"}. Left arrow to pass, right arrow to keep.`:"No more cards")}b=K({host:t,outset:n.current.outset,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.94,contrast:1.3,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{b=null,r.restore(),A()},onTheme:()=>{y=new Map},paint:({pen:e,w:n,now:r,dark:o,box:a})=>{const d=a(t),u=d.w,h=d.h,f=d.x+u/2,m=d.y+h/2,g=I(c.x),v=(t,n,r,a,i=0)=>{const s=S(t,u,h,!o);!s||a<=0||(e.save(),e.translate(f,m+r),e.scale(n,n),e.globalAlpha=a,e.drawImage(s,-u/2,-h/2),i>0&&(e.globalCompositeOperation="destination-out",e.globalAlpha=i,e.drawImage(((t,e)=>{let n=M;if(!n||n.width!==Math.round(t)||n.height!==Math.round(e)){n=M=document.createElement("canvas"),n.width=Math.max(1,Math.round(t)),n.height=Math.max(1,Math.round(e));const r=n.getContext("2d");if(r)for(let t=0;t<n.height;t+=6)for(let e=0;e<n.width;e+=4){const n=43758.5453*Math.sin(12.9898*e+78.233*t);n-Math.floor(n)<.55&&(r.fillStyle="#000",r.fillRect(e,t,4,6))}}return n})(u,h),-u/2,-h/2)),e.restore())};v(i+2,Ve(.86,.93,g),Ve(24,12,g),Ve(.3,.55,g),.3),v(i+1,Ve(.93,1,g),Ve(12,0,g),Ve(.55,1,g),.4*(1-g));const y=S(i,u,h,!o);if(!y)return!1;const b=p?I((r-p.start)/620):0,x=p?.dir??1,w=p?p.x0+x*u*.9*(1-(1-b)**3):s.x,k=p?p.y0:l.x;if(e.save(),e.translate(f+w,m+k),e.rotate(.22*I(w/u,-1.6,1.6)),!p)return e.drawImage(y,-u/2,-h/2),e.restore(),!1;const A=Math.ceil(h/6);for(let t=0;t<A;t++){const r=Ye[t%Ye.length],o=I(1.55*b-.55*r);if(o>=1)continue;const a=x*o*o*u*(.5+.9*r),i=6*t,s=Math.min(6,h-i),l=x>0?f+w+a+.62*u:f+w+a-.62*u,c=x>0?n-4-l:l-4;e.globalAlpha=(1-o*o)*I(c/56),e.drawImage(y,0,i,u,s,-u/2+a,-h/2+i,u,s)}return e.restore(),!1}});const C=e=>{m=0;const o=Math.min(1/30,Math.max(0,(e-g)/1e3));g=e;let a=!1;d||p||(a=Ie(s,o,.3),a=Ie(l,o,.3)||a),a=Ie(c,o,.002)||a,p&&e-p.start>=620&&(p=null,i+=1,E()),(()=>{(n.current.leanTarget??t).style.setProperty("--ascii-lean",String(p?0:I(s.x/(.4*w()),-1,1)));const e=x(i);!b&&e&&r.set(e,"transform",`translate(${s.x}px, ${l.x}px) rotate(${.22*I(s.x/w(),-1.6,1.6)}rad)`)})(),b?.kick(),(a||d||p)&&(m=requestAnimationFrame(C))},$=()=>{m||(g=performance.now(),m=requestAnimationFrame(C))},E=()=>{s=Xe(0,380,.72),l=Xe(0,380,.8),c=Xe(0,260,.9)},L=(t=1)=>{const e=a();if(p||!e.length||!n.current.loop&&i>=e.length)return!1;const u=x(i),h=k(i);return d=!1,o()||!b?(i+=1,E(),b||r.set(u,"transform","")):(p={dir:t,start:performance.now(),x0:s.x,y0:l.x},c.to=1),A(),$(),n.current.onSwipe?.(t,h,u),!0},z=t=>{if(!d||void 0!==t&&void 0!==t.pointerId&&t.pointerId!==v)return;d=!1;const e=Pe(f,performance.now()),r=w();Math.abs(s.x)>r*n.current.threshold||Math.abs(e)>650&&Math.sign(e)===Math.sign(s.x)&&Math.abs(s.x)>16?L(s.x<0?-1:1):(s.to=0,l.to=0,c.to=0,s.v=.2*I(e,-1600,1600),o()&&(s.x=l.x=c.x=0,s.v=l.v=c.v=0),$())},R=()=>t.getBoundingClientRect().width/(t.clientWidth||1)||1,T=e=>{if(0!==e.button||p)return;try{t.setPointerCapture?.(e.pointerId)}catch{}v=e.pointerId;const n=R();d=!0,u=e.clientX-s.x*n,h=e.clientY-l.x/.3*n,f=[],$()},P=t=>{if(!d||t.pointerId!==v)return;const e=R();s.x=s.to=(t.clientX-u)/e,l.x=l.to=(t.clientY-h)/e*.3,s.v=l.v=0,c.to=.5*I(Math.abs(s.x)/w()),f.push([s.x,performance.now()]),f.length>8&&f.shift(),$()},F=t=>{"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||(t.preventDefault(),L("ArrowRight"===t.key?1:-1))},W=()=>b?.kick(),O=t=>t.preventDefault();return t.hasAttribute("tabindex")||(t.tabIndex=0),t.setAttribute("role",t.getAttribute("role")??"group"),t.setAttribute("aria-roledescription","card"),r.set(t,"touch-action","none"),A(),t.addEventListener("pointerdown",T),t.addEventListener("pointermove",P),t.addEventListener("pointerup",z),t.addEventListener("pointercancel",z),t.addEventListener("lostpointercapture",z),t.addEventListener("keydown",F),t.addEventListener("load",W,!0),t.addEventListener("dragstart",O),Q(()=>b,n,()=>{y=new Map,A(),b?.refresh()},{next:L,get index(){return k(i+(p?1:0))}},()=>{m&&cancelAnimationFrame(m),m=0,r.restore(),a().forEach(t=>{t.hidden=!1,t.removeAttribute("aria-hidden")}),(n.current.leanTarget??t).style.removeProperty("--ascii-lean"),t.removeAttribute("aria-roledescription"),t.removeEventListener("pointerdown",T),t.removeEventListener("pointermove",P),t.removeEventListener("pointerup",z),t.removeEventListener("pointercancel",z),t.removeEventListener("lostpointercapture",z),t.removeEventListener("keydown",F),t.removeEventListener("load",W,!0),t.removeEventListener("dragstart",O)})},exports.tabs=function(t,e={}){const n={current:{...Vt,...e}},r=()=>[...t.querySelectorAll(n.current.tabs)],o=r().findIndex(t=>"true"===t.getAttribute("aria-selected"));let a=Math.max(0,n.current.active??(o>=0?o:0)),i=a,s=-1e6,l=null;l=K({host:t,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:.62,glyphScale:.96,...n.current.look}),ink:t=>n.current.ink??(t?"#7a7872":"#76746e"),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{l=null},paint:({pen:t,now:e,still:o,box:l})=>{const c=r(),d=c[i],u=c[a];if(!d||!u)return!1;const h=l(d),p=l(u),f=o?1:(e-s)/n.current.duration;if(f>=1){const e=p.x+1,n=p.y+1.5,r=p.w-2,o=p.h-3;t.save(),t.beginPath(),t.roundRect(e,n,Math.max(0,r),Math.max(0,o),Math.max(0,o/2)),t.clip();for(let a=0;a<r;a+=2){const i=Math.round(255*(.2+.5*Math.max(0,1-Math.min(a,r-a)/22)));t.fillStyle=`rgb(${i} ${i} ${i})`,t.fillRect(e+a,n,2,o)}return t.restore(),!1}const{left:m,right:g,dir:v}=function(t,e,n){const r=Math.sign(e.x-t.x)||1,o=P(n/.8),a=P((n-.22)/.78),i=(r>0?t.x+t.w:t.x)+((r>0?e.x+e.w:e.x)-(r>0?t.x+t.w:t.x))*o,s=(r>0?t.x:t.x+t.w)+((r>0?e.x:e.x+e.w)-(r>0?t.x:t.x+t.w))*a;return{left:Math.min(i,s),right:Math.max(i,s),dir:r}}(h,p,f),y=Math.max(1,g-m),M=h.y,b=h.h,x=3.72,w=Math.floor(e/40);t.save(),t.beginPath(),t.roundRect(m,M+1.5,y,Math.max(0,b-3),Math.max(0,(b-3)/2)),t.clip();for(let e=m;e<g;e+=x){const n=v>0?(e-m)/y:(g-e)/y,r=Math.min(1,1.4*f),o=.25+.75*(r+(1-r)*n**1.6);for(let a=0;a<b;a+=6){if(T(Math.round(e/x),a+w)>=o)continue;const i=a<5||a>b-8,s=Math.round((i?150:70+110*(1-r)*n)*(.6+.4*o));t.fillStyle=`rgb(${s} ${s} ${s})`,t.fillRect(e,M+a,x,6)}}return t.restore(),!0}});const c=()=>{const t=n.current;r().forEach((e,n)=>{const r=n===a;t.manage&&(e.setAttribute("aria-selected",String(r)),e.tabIndex=r?0:-1);const o=e.getAttribute("aria-controls")?document.getElementById(e.getAttribute("aria-controls")):null;o&&"none"!==t.panels&&("hidden"===t.panels?o.hidden=!r:o.toggleAttribute("data-active",r))})},d=(t,e=!1)=>{const o=r();if(!o.length)return;const d=(t%o.length+o.length)%o.length;e&&o[d].focus(),d!==a&&(i=a,a=d,s=performance.now(),c(),l?.kick(),n.current.onChange?.(d,o[d]))},u=t=>{if(!n.current.manage)return;const e=t.target.closest?.(n.current.tabs),o=e?r().indexOf(e):-1;o>=0&&d(o)},h=t=>{if(!n.current.manage)return;const e={ArrowRight:a+1,ArrowLeft:a-1,Home:0,End:r().length-1};t.key in e&&(t.preventDefault(),d(e[t.key],!0))};return t.addEventListener("click",u),t.addEventListener("keydown",h),c(),Q(()=>l,n,t=>{void 0!==t.active&&t.active!==a&&d(t.active),c(),l?.refresh()},{select:d,get active(){return a}},()=>{t.removeEventListener("click",u),t.removeEventListener("keydown",h)})},exports.terrain=Nr,exports.thinking=function(t,e={}){const n={current:{...mn,...e}},r=U(),o=[...t.childNodes];let a="done",i=0,s=0,l=-1e9,c=-1e9,d=0,u="",h=null;const p=document.createElement("canvas"),f=()=>{const e=getComputedStyle(t),n=parseFloat(e.lineHeight);return Number.isFinite(n)&&n>0?n:1.45*(parseFloat(e.fontSize)||15)},m=t=>{n.current.label&&(n.current.label.textContent=t)};h=K({host:t,layer:"under",look:()=>({mark:"dot",cellSize:5,cellAspect:1,dotScale:.86,contrast:1.2,...n.current.look}),ink:t=>n.current.ink??`var(--ascii-ink, ${t?"#7a7872":"#76746e"})`,kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{h=null},paint:({pen:t,w:e,h:r,now:o,still:i})=>{const d=n.current,u=f(),h="thinking"===a?1:i?0:1-P((o-l)/gn),m="done"===a&&d.rule?i?.7:.7*P((o-c-280)/gn):0,g=i?0:(o-s)/1e3;if(h>0){const n=Math.max(2,Math.round(e/12)),o=Math.max(2,Math.round(r/7));p.width===n&&p.height===o||(p.width=n,p.height=o),ht(p,1.7+.8*g,.15),t.save(),t.beginPath();for(let n=0;n<d.lines;n++){const r=n===d.lines-1&&d.lines>1?.62:.92-.06*T(n,2);t.rect(0,n*u+.22*u,e*r,.56*u)}t.clip(),t.globalAlpha=h,t.imageSmoothingEnabled=!0,t.globalCompositeOperation="lighter",t.drawImage(p,0,0,e,r),t.drawImage(p,0,0,e,r),t.drawImage(p,0,0,e,r),t.fillStyle="rgb(14 14 14)",t.fillRect(0,0,e,r),t.restore()}if(m>0&&(t.globalAlpha=m,t.fillStyle="#fff",t.fillRect(0,r-5,e,4),t.globalAlpha=1),h>0||m>0){const n=t.createLinearGradient(.6*e,0,.98*e,0);n.addColorStop(0,"#fff"),n.addColorStop(1,"#000"),t.globalCompositeOperation="multiply",t.fillStyle=n,t.fillRect(0,0,e,r),t.globalCompositeOperation="source-over"}return"thinking"===a||!i&&(o-l<gn||"done"===a&&o-c<700)}});const g=document.createElement("span"),v=()=>{d++,a="thinking",s=performance.now(),l=c=-1e9,u="",g.replaceChildren(),t.replaceChildren(g),h&&t.appendChild(h.canvas);const e=getComputedStyle(t),o="border-box"===e.boxSizing?(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0):0;r.set(t,"min-height",`${Math.round(n.current.lines*f()+o)}px`),t.setAttribute("aria-busy","true"),m(n.current.labels?.thinking??"Thinking…"),n.current.onState?.("thinking",0),h?.kick()};let y=0,M=0;return n.current.start&&v(),Q(()=>h,n,()=>h?.refresh(),{think:v,stream:async e=>{"thinking"!==a&&v();const o=d;y=0;let p="";const f=()=>{"thinking"===a&&(a="streaming",l=M=performance.now(),r.set(t,"min-height",""),i=Math.max(1,Math.round((l-s)/1e3)),m((n.current.labels?.done??vn)(i)),n.current.onState?.("streaming",i),h?.kick())},b=(t,e)=>{p+=t;const o=e?p.length:p.search(/\s\S*$/)+1;o<=0||(f(),u+=p.slice(0,o),(t=>{const e=!!h&&!h.still();for(const o of t.match(/\s+|\S+/g)??[]){if(/^\s/.test(o)){g.append(o);continue}const t=document.createElement("span");if(t.textContent=o,e){r.set(t,"opacity","0");const e=Math.max(0,y*n.current.stagger-(performance.now()-M));r.set(t,"transition",`opacity 260ms cubic-bezier(.16, 1, .3, 1) ${Math.round(e)}ms`),requestAnimationFrame(()=>requestAnimationFrame(()=>t.style.setProperty("opacity","1")))}y++,g.appendChild(t)}})(p.slice(0,o)),p=p.slice(o))};if("string"==typeof e)b(e,!0);else{for await(const t of e){if(o!==d)return;b(t,!1)}if(o!==d)return;b("",!0)}f();const x=!h||h.still()?0:Math.max(0,y*n.current.stagger-(performance.now()-M))+260;await new Promise(t=>setTimeout(t,x)),o===d&&(a="done",c=performance.now(),t.setAttribute("aria-busy","false"),n.current.onState?.("done",i),h?.kick())},get state(){return a}},()=>{d++,r.restore(),t.removeAttribute("aria-busy"),u?t.textContent=u:t.replaceChildren(...o)})},exports.toastStack=function(t,e={}){const n={current:{...cn,...e}},r=U(),o=document.createElement("ol"),a=V("",!1);a.setAttribute("role","status");let i=[],s=[],l=0,c=!1,d=!1,u=!1,h=!1,p=null,f=0;const m=[];ln("ascii-kit-toast",hn),o.className="ascii-toasts",o.setAttribute("aria-label",n.current.label),t.append(o,a);const g=new WeakSet,v=e=>{const r=N(n.current.ink??"--ascii-ink-strong",t,j(t)?"#d8d6cf":"#1d1d1b");r&&function(t,e){const n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+%?))?/i.exec(t.trim());if(!n)return!1;if(!((void 0===n[4]?1:n[4].endsWith("%")?parseFloat(n[4])/100:parseFloat(n[4]))>=.5))return!1;const r=`#${[n[1],n[2],n[3]].map(t=>Math.round(I(+t,0,255)).toString(16).padStart(2,"0")).join("")}`,[o,a]=[fn(r),fn(e)].sort((t,e)=>e-t);return(o+.05)/(a+.05)<3}(getComputedStyle(e).backgroundColor,r)&&(g.add(e),e.style.setProperty("transition","none","important"),e.style.setProperty("background-color","transparent","important"),e.style.setProperty("box-shadow","none","important"))},y=t=>{delete t.dataset.forming,g.delete(t)&&(t.style.removeProperty("transition"),t.style.removeProperty("background-color"),t.style.removeProperty("box-shadow"))};p=K({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,...n.current.look}),outset:24,resolution:2,ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{p=null,s=[];for(const t of i)y(t.node)},paint:({pen:t,now:e,scale:r,still:o,box:a})=>{t.setTransform(r,0,0,r,0,0);let l=!1;const c=i[i.length-1];if(n.current.glint&&!o&&c&&void 0===c.node.dataset.forming&&void 0===c.node.dataset.gone){const n=e-c.born-700,r=n>0?n%dn/2400:-1;if(r>=0&&r<1)!function(t,e,n,r){const o=Math.min(n,e.h/2)+4,a=e.w+8,i=e.h+8,s=2*(a+i)-(8-2*Math.PI)*o,l=r*(s+150);t.save(),t.lineCap="round";for(const[n,r]of[[150,.34],[80,.66],[30,1]])t.strokeStyle=pn(r),t.lineWidth=5,t.setLineDash([n,s+n]),t.lineDashOffset=n-l,t.beginPath(),t.roundRect(e.x-4,e.y-4,a,i,Math.max(0,o)),t.stroke();t.restore()}(t,a(c.node),parseFloat(getComputedStyle(c.node).borderTopLeftRadius)||13,(t=>t<.5?4*t**3:1-(-2*t+2)**3/2)(r)),l=!0;else{f&&clearTimeout(f);const t=n>0?dn-n%dn:-n;f=setTimeout(()=>{f=0,p?.kick()},Math.max(16,t))}}return s=s.filter(n=>{const r=(e-n.start)/n.ms;return n.form&&r>=.62&&y(n.node),!(r>=1)&&(n.form?sn(t,n.snap,n.blocks,n.order,1.04*W(r),(t,e)=>[70*(t.seed-.5)*e,(14+26*T(t.x,t.y))*e],1-I((r-.62)/.28)):sn(t,n.snap,n.blocks,n.order,1-1.04*(1-(1-r)**3),(t,e)=>[(14+34*t.seed)*e,14*(T(t.y,t.x)-.35)*e],1-I((r-.75)/.25)),!0)}),s.length>0||l}}),p&&(p.canvas.style.zIndex="11");const M=()=>!!p&&p.live&&!p.still(),b=()=>{i.forEach((t,e)=>{const n=i.length-1-e;r.set(t.node,"--d",String(n)),0===n?(t.node.dataset.front="",delete t.node.dataset.back):(t.node.dataset.back="",delete t.node.dataset.front)})},x=(e,n)=>{if(!p)return;const r=an(e,p.canvas.clientWidth||t.clientWidth+48,p.canvas.clientHeight||t.clientHeight+48,p.box),o=function(t){const e=new Set,n=[];for(const r of t)for(let t=6*Math.floor((r.y-2)/6);t<r.y+r.h+2;t+=6)for(let o=4*Math.floor((r.x-2)/4);o<r.x+r.w+2;o+=4){const r=`${o},${t}`;e.has(r)||(e.add(r),n.push({x:o,y:t,seed:T(o,t)}))}return n}(r.rects),a=Math.max(1,...o.map(t=>t.x)),i=Float32Array.from(o,t=>(n?.3:.62)*(t.x/a)+(n?.7:.38)*t.seed);s.push({start:performance.now(),ms:n?340:440,snap:r.canvas,blocks:o,order:i,form:n,node:e}),p.kick()},w=t=>{t.timer&&clearTimeout(t.timer),t.timer=0,c||t.left<=0||(t.since=performance.now(),t.timer=setTimeout(()=>E(t.id),t.left))},k=()=>(t=>{if(t!==c){c=t,t?o.dataset.open="":delete o.dataset.open;for(const e of i)t&&e.timer&&(clearTimeout(e.timer),e.timer=0,e.left=Math.max(400,e.left-(performance.now()-e.since))),t||w(e)}})(d||u),S=()=>{d=!0,k()},A=()=>{d=!1,k()},C=()=>{u=!0,k()},$=t=>{o.contains(t.relatedTarget)||(u=!1,k())};function E(t){const e=i.find(e=>e.id===t);if(!e||void 0!==e.node.dataset.gone)return;e.timer&&clearTimeout(e.timer);const n=()=>{i=i.filter(t=>t!==e),s=s.filter(t=>t.node!==e.node),e.node.remove(),b(),p?.kick(),i.length||(d=u=!1,k())},r=i[i.length-1]===e;M()&&(r||c)?(y(e.node),x(e.node,!1),e.node.dataset.gone="",m.push(setTimeout(n,150))):n()}return o.addEventListener("pointerenter",S),o.addEventListener("pointerleave",A),o.addEventListener("focusin",C),o.addEventListener("focusout",$),Q(()=>p,n,t=>{o.setAttribute("aria-label",t.label),p?.refresh()},{push:t=>{if(h)return-1;const e=++l,r=i.filter(t=>void 0===t.node.dataset.gone),s=r.length+1-Math.max(1,n.current.max);s>0&&r.slice(0,s).forEach(t=>E(t.id));const c=n.current.render?n.current.render(t,e):function(t,e){const n=(t,e,n)=>{const r=document.createElement(t);return r.className=e,n&&(r.dataset.paint=n),r},r=n("li","ascii-toast");if(void 0!==t.icon){const e=n("span","ascii-toast-icon","tile");e.setAttribute("aria-hidden","true"),"string"==typeof t.icon?e.textContent=t.icon:e.appendChild(t.icon),r.appendChild(e)}const o=n("span","ascii-toast-text"),a=n("b","ascii-toast-title","strong");if(a.textContent=t.title,o.appendChild(a),t.body){const e=n("span","ascii-toast-body","meta");e.textContent=t.body,o.appendChild(e)}if(r.appendChild(o),t.action){const{label:o,onClick:a}=t.action,i=n("button","ascii-toast-action","text");i.type="button",i.textContent=o,i.addEventListener("click",()=>{a(),e()}),r.appendChild(i)}const i=n("button","ascii-toast-close","none");return i.type="button",i.setAttribute("aria-label",`Dismiss ${t.title}`),i.textContent="×",i.addEventListener("click",e),r.appendChild(i),r}(t,()=>E(e));c.dataset.toast=String(e);const d={id:e,node:c,timer:0,left:t.duration??n.current.duration,since:0,born:performance.now()};return i.push(d),o.appendChild(c),b(),a.textContent=t.body?`${t.title}. ${t.body}`:t.title,M()?(c.dataset.forming="",v(c),x(c,!0)):p?.kick(),w(d),e},dismiss:E,clear(){[...i].forEach(t=>E(t.id))},get toasts(){return i.filter(t=>void 0===t.node.dataset.gone).map(t=>t.id)}},()=>{h=!0,f&&clearTimeout(f);for(const t of i)t.timer&&clearTimeout(t.timer);m.forEach(clearTimeout),o.removeEventListener("pointerenter",S),o.removeEventListener("pointerleave",A),o.removeEventListener("focusin",C),o.removeEventListener("focusout",$),i=[],s=[],o.remove(),a.remove(),r.restore()})},exports.veil=qr,exports.voiceOrb=function(t,e={}){const n={current:{...fe,...e}},r=U();let o="idle",a=0,i=I(n.current.level??0),s=i,l=0,c=0,d=me(n.current.palette),u=null,h=null,p=0;const f=t=>{t.canvas.style.filter=!t.dark()&&d.length?"brightness(.68) saturate(1.35)":""},m=e=>{t.style.setProperty("--ascii-level",e.toFixed(3)),n.current.swell&&r.set(t,"scale",String(1+.1*e))};u=K({host:t,outset:Math.round(.08*(t.offsetWidth||0)),look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:.62,glyphScale:.92,fit:"cover",color:d.length?"source":"ink",contrast:2.2,brightness:1.1-.5,saturation:1.4,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,onTheme:()=>u&&f(u),onFail:()=>{u=null},paint:({pen:t,w:e,h:n,now:r,still:u})=>{const p=c?Math.min(64,r-c):16;c=r;const f=I((t=>"listening"===o?h?h.read():i:"thinking"===o?.2+.1*Math.sin((t-a)/120):"done"===o?l*(1-W(I((t-a)/420))):i)(r));return u||"done"===o?s=f:s+=(f-s)*(1-(1-(f>s?.45:.12))**(p/16.7)),u||m(s),function(t,e,n,r,o,a){const i=t=>{const e=Math.round(255*I(t)/2.2);return`rgb(${e} ${e} ${e})`},s=e/2,l=n/2,c=.36/(.92-.16*o)*Math.min(e,n),d=.86+.46*o,u=r*(.25+.6*o),h=t.createRadialGradient(s,l,.92*c,s,l,1.3*c);h.addColorStop(0,i(.36*d)),h.addColorStop(1,"#000"),t.fillStyle=h,t.fillRect(0,0,e,n),t.save(),t.beginPath(),t.arc(s,l,c,0,2*Math.PI),t.clip();const p=s+.8*Math.cos(u)*c*.62,f=l-.55*c*.62,m=t.createRadialGradient(p,f,0,p,f,1.7*c);m.addColorStop(0,i(.95*d)),m.addColorStop(.55,i(.5*d)),m.addColorStop(1,i(.18)),t.fillStyle=m,t.fillRect(s-c,l-c,2*c,2*c),t.globalCompositeOperation="lighter",t.lineWidth=Math.max(1.5,.05*c);for(let e=0;e<6;e++){const n=e/6*Math.PI+.35*r,o=Math.sin(n);o<0||(t.strokeStyle=i(.16*o),t.beginPath(),t.ellipse(s,l,c*Math.abs(Math.cos(n)),c,0,0,2*Math.PI),t.stroke())}const g=t.createRadialGradient(s,l,.7*c,s,l,c);if(g.addColorStop(0,"#000"),g.addColorStop(1,i(.3)),t.fillStyle=g,t.fillRect(s-c,l-c,2*c,2*c),t.restore(),t.globalCompositeOperation="source-over",!a.length)return;t.globalCompositeOperation="color";const v=.4*r,y=.5*o,M=t.createLinearGradient(s-Math.cos(v)*c,l-Math.sin(v)*c,s+Math.cos(v)*c,l+Math.sin(v)*c);M.addColorStop(0,ge(a,y)),M.addColorStop(.5,ge(a,y+.25)),M.addColorStop(1,ge(a,y+.5)),t.fillStyle=M,t.fillRect(0,0,e,n),t.globalCompositeOperation="source-over"}(t,e,n,u?0:r/1e3,s,d),!0}}),u&&f(u);const g=()=>{p++,h&&(h.stream.getTracks().forEach(t=>t.stop()),h.context.close().catch(()=>{}),h=null)},v=e=>{"listening"!==e&&g(),"done"===e&&(l=s),o=e,a=performance.now(),t.dataset.state=e,u||m("listening"===e?i:0),u?.kick()};return Q(()=>u,n,t=>{d=me(t.palette),void 0!==t.level&&(i=I(t.level)),u?.refresh(),u&&f(u)},{level(t){i=I(Number.isFinite(t)?t:0),u||"listening"!==o||m(i),u?.kick()},listen:()=>v("listening"),think:()=>v("thinking"),done:()=>v("done"),idle:()=>{i=0,v("idle")},async mic(){g();const t=p,e="undefined"!=typeof navigator?navigator.mediaDevices:void 0,n=globalThis.AudioContext;if(!e?.getUserMedia||!n)return!1;let r;try{r=await e.getUserMedia({audio:!0})}catch{return!1}if(t!==p)return r.getTracks().forEach(t=>t.stop()),!1;const o=new n,a=o.createAnalyser();a.fftSize=1024,o.createMediaStreamSource(r).connect(a);const i=new Uint8Array(a.fftSize);return h={stream:r,context:o,read(){a.getByteTimeDomainData(i);let t=0;for(const e of i)t+=((e-128)/128)**2;return 5*Math.sqrt(t/i.length)}},v("listening"),!0},get state(){return o},get current(){return s}},()=>{g(),r.restore(),t.style.removeProperty("--ascii-level"),delete t.dataset.state})},exports.voidWell=Hr,exports.wave=Dr,exports.weave=Ur,exports.wordField=Nn,exports.wordmark=function(t,e={}){const n=(t.textContent??"").trim(),r={current:{...ce,...e}};let o=r.current.text??n;const a=U(),i=()=>function(t,e=ce.font,n=ce.fontWeight,r=520){const{canvas:o,pen:a}=Zt(1800,Math.max(1,Math.round(r))),i=Math.min(400,1700/Math.max(3,.56*[...t].length));return a.fillStyle="#fff",a.textAlign="center",a.textBaseline="middle",a.font=`${n} ${i}px ${e}`,a.fillText(t||" ",o.width/2,o.height/2+.05*i),o}(o,r.current.font,r.current.fontWeight,r.current.artHeight),s=!n;let l=null;l=Kt({host:t,layer:"over",look:()=>({mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:7,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.3,levels:"auto",fit:"contain",focus:{x:.5,y:.5},hover:"trail",trail:{strength:.62,radius:.22},...r.current.look}),ink:()=>r.current.ink??"--ascii-ink-strong",source:i(),label:s?r.current.label??o:void 0,kit:r,reducedMotion:()=>r.current.reducedMotion,onFail:()=>{l=null,a.restore()}}),l&&n&&a.set(t,"color","transparent"),l&&document.fonts?.load?.(`${r.current.fontWeight} 100px ${r.current.font}`).then(()=>{l&&l.field.setSource(i())},()=>{});const c=e=>{if(e!==o)if(o=e,void 0!==r.current.text&&(r.current={...r.current,text:o}),l)if(l.field.setSource(i()),s)l.field.update({label:r.current.label??(o||" ")});else{for(const e of[...t.childNodes])e!==l.canvas&&e.remove();t.prepend(document.createTextNode(o))}else n&&(t.textContent=o)};return Qt(()=>l,r,t=>{void 0!==t.text&&t.text!==o?c(t.text):l&&l.field.setSource(i())},{setText:c,get text(){return o}},()=>a.restore())};//# sourceMappingURL=kit.cjs.map
|