asciify-engine 4.14.1 → 4.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/kit.js CHANGED
@@ -1 +1 @@
1
- import{isGlyphFieldSupported as t,mountGlyphField as e}from"./field.js";var n=/\p{L}/u,r=null,o=new Set,i=new Set;function a(t){r=t?{...t}:null;for(const t of i)t.relook();for(const t of[...o])t(r)}var s=()=>r;function l(t){return o.add(t),()=>{o.delete(t)}}var c=12,d=new Set,u=null,h=null,f=0,p=-1e9,m=0,g=!1,v=!1;function y(t){c=Number.isFinite(t)&&t>=1?Math.floor(t):12,C()}var b=()=>c,M=()=>"undefined"!=typeof performance?performance.now():Date.now(),x=()=>"number"==typeof innerHeight?innerHeight:0;function w(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-x();return n>0?n:0}function k(t,e){if(t.eager)return void(t.wanted=!0);const n=x(),r=w(t.host,e);!n||r<=.5*n?t.wanted=!0:r>1*n&&(t.wanted=!1)}function S(t){let e=!1;for(const n of t)if(n?.target)for(const t of d)t.host===n.target&&(k(t,n.boundingClientRect??void 0),e=!0);e&&C()}function A(t){h!==t.doc&&(h=t.doc,d.clear(),f=m=0),d.add(t);const e=function(){const t="function"==typeof IntersectionObserver?IntersectionObserver:null;if(!t)return null;if(u?.ctor!==t){u?.list.forEach(t=>t.disconnect()),u={ctor:t,list:["50% 0px","100% 0px","0px"].map(e=>new t(S,{rootMargin:e}))};for(const t of d)u.list.forEach(e=>e.observe(t.host))}return u.list}();e?.forEach(e=>e.observe(t.host)),e?k(t):t.wanted=!0,C()}function C(t=!1){if(g)v=!0;else{g=!0;try{do{v=!1;const e=M();(t||e-p>16||e<p)&&(p=e,m=0);for(const t of d)t.live&&!t.wanted&&t.release();const n=[...d].filter(t=>t.live),r=()=>n.filter(t=>t.live).map(t=>[t,w(t.host)+(t.eager?0:1e9)]).sort((t,e)=>e[1]-t[1]);for(let t=n.length-c,e=t>0?r():[];t>0;t--)e.shift()?.[0].release();const o=[...d].filter(t=>t.wanted&&!t.live).map(t=>[t,t.eager?-1:w(t.host)]).sort((t,e)=>t[1]-e[1]);let i=0;for(const[e,a]of o){if(!d.has(e)||e.live)continue;if(!e.eager&&m>=4&&(!t||i)){f||(f=requestAnimationFrame(()=>{f=0,C(!0)}));break}if(n.filter(t=>t.live).length>=c){const t=r()[0]?.[0];if(!t||!e.eager&&(t.eager||w(t.host)<=a))break;t.release()}const o=M();e.mount(),m+=M()-o,i++,e.live&&n.push(e)}}while(v)}finally{g=!1}}}var $=new WeakMap,E=new WeakMap;function L(t,e){const n=E.get(t);n&&n.getAttribute("src")!==e&&(n.src=e)}function z(t){$.get(t)?.(),$.delete(t)}var R=()=>"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches;function I(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${R()?"":";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 $.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"))}),E.set(r,i),{show(t){i.style.opacity=t?"1":"0"},remove:()=>z(r)}}function P(t){const{host:o,kit:a}=t;let s,l=t.canvas,c=null,h=!1,f=!1,p=!1,m=!1,g={},v={},y=t.source,b=!1,M={},x=null,w=null,k=!1,S=null;const $=!t.ownPoster&&a?.current.poster?I(o,a.current.poster,t.place,a,l):null,E=()=>{const t=v.charset,e=!1!==a?.current.globalLook&&"glyph"===(v.mark??"glyph")&&!n.test(t??"")&&r?.charset?r.charset:void 0;return e?e===s?null:(s=e,{charset:e}):void 0===s?null:(s=void 0,{charset:t??" .,:-=+*#%@"})},L={host:o,doc:document,eager:!1===a?.current.lazy,wanted:!1,live:!1,mount(){if(f||c)return;h&&(l=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}(l)),h=!0,v={...t.options(),...g},s=void 0;const n=E();let r;try{r=e(l,{...v,...n,...void 0===y?{}:{source:y},onError:()=>{c===r&&z()}})}catch{return void z()}c=r,L.live=!0,b&&r.pause(),r.ready.then(()=>{c===r&&(k=!0,$?.show(!1),x?.(),x=w=null)},()=>{}),t.onMount?.(r,l)},release(){if(!c)return;const e=c;c=null,L.live=!1,k=!1,S?.clear(),S=null,M=e.settings,e.destroy(),(t=>{try{t.getContext("webgl2")?.getExtension("WEBGL_lose_context")?.loseContext()}catch{}})(l),$?.show(!0),t.onRelease?.()}};function z(){p||(p=!0,P(),m||t.onFail())}function P(){f||(f=!0,L.release(),function(t){d.delete(t)&&([...d].some(e=>e.host===t.host)||u?.list.forEach(e=>e.unobserve(t.host)),!d.size&&u&&(u.list.forEach(t=>t.disconnect()),u=null),C())}(L),i.delete(T),l.remove(),p?$?.show(!0):$?.remove())}const T={relook(){const e=E();if(!e||!c)return;const n=c,r=k&&!(a?.current.reducedMotion??R());S?.clear(),S=null,r&&(n.redraw(),S=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}}}(l,t.place)),n.update(e);const o=S;o&&requestAnimationFrame(()=>requestAnimationFrame(()=>{S===o&&c===n?o.reveal():o.clear()}))}};return{field:{get canvas(){return l},get ready(){return c?c.ready:w??(w=new Promise(t=>{x=t}))},get settings(){return c?.settings??M},update(t){if(g={...g,...t},v={...v,...t},!c)return;const e=E();c.update(void 0!==s?{...t,charset:s}:e?{...t,...e}:t)},setSource:t=>(y=t,c?c.setSource(t):Promise.resolve()),pointer(t,e){c?.pointer(t,e)},redraw(){c?.redraw()},pulse(t){c?.pulse(t)},play(){b=!1,c?.play()},pause(){b=!0,c?.pause()},resize(){c?.resize()},destroy(){P()}},get canvas(){return l},get live(){return!!c},get failed(){return p},start(){i.add(T),m=!0;try{A(L)}finally{m=!1}},destroy:P}}var T,F=(t,e=0,n=1)=>Math.min(n,Math.max(e,t)),W=(t,e)=>{const n=43758.5453*Math.sin(127.1*t+311.7*e);return n-Math.floor(n)},B=(t,e=3)=>1-(1-F(t))**e,O=(t,e,n)=>{const r=F((n-t)/(e-t));return r*r*(3-2*r)},N=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)},q=()=>"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,H={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 G(t,e,n){let r=(t??"").trim();const o=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/.exec(r);if(o?r=D(e,o[1])||(o[2]??"").trim():r.startsWith("--")&&(r=D(e,r)),!r)return n?G(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 j([+i[1],+i[2],+i[3]]);if(void 0===T)try{T="undefined"==typeof document?null:Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0})}catch{T=null}if(!T)return n?G(n,e):null;T.clearRect(0,0,1,1),T.fillStyle="#000",T.fillStyle=r,T.fillRect(0,0,1,1);const[a,s,l]=T.getImageData(0,0,1,1).data;return j([a,s,l])}var D=(t,e)=>"function"==typeof getComputedStyle?getComputedStyle(t).getPropertyValue(e).trim():"",j=t=>`#${t.map(t=>Math.round(F(t,0,255)).toString(16).padStart(2,"0")).join("")}`,U=t=>{const e=parseInt(t.slice(1,7),16);return[e>>16&255,e>>8&255,255&e]},V=(t,e,n)=>{const r=U(t),o=U(e);return j(r.map((t,e)=>t+(o[e]-t)*n))};function X(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=G(e?.color??"",t);if(!r)return"function"==typeof matchMedia&&matchMedia("(prefers-color-scheme: dark)").matches;const[o,i,a]=U(r);return.2126*o+.7152*i+.0722*a>140}function Y(){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 J(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 K(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 _(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 Q=new WeakMap,Z=t=>Q.get(t)?.()??null;function tt(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())return i?.current.poster&&I(n,i.current.poster,a,i),null;const s=Y(),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 f=X(n);const p=()=>G(e.ink(f),n,f?"#d8d6cf":"#1d1d1b")??"#888888";let m=0,g=!1,v=!0,y=!1;const b=P({host:n,canvas:l,kit:i,place:a,options:()=>({...H,...e.look(),ink:p(),interactionTarget:n,label:""}),onMount:(t,e)=>{Q.set(e,S),e.removeAttribute("role"),e.removeAttribute("aria-label"),t.ready.then(C,()=>{}),C()},onRelease:()=>{m&&cancelAnimationFrame(m),m=0},onFail:()=>{B(),e.onFail?.()}}),M=b.field;h();const x=()=>!!(e.reducedMotion()??q()),w=t=>K(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:f,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:f,box:w})}catch{return null}return c}Q.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 C(){m||y||g||!b.live||(m=requestAnimationFrame(A))}const $="function"==typeof ResizeObserver?new ResizeObserver(()=>{h(),M.resize(),!b.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 L=()=>{document.hidden||C()};document.addEventListener("visibilitychange",L);let z=0;const R=()=>{z||y||(z=requestAnimationFrame(()=>{z=0,y||(f=X(n),M.update({ink:p()}),e.onTheme?.(),C())}))},T="function"==typeof matchMedia?matchMedia("(prefers-color-scheme: dark)"):null;T?.addEventListener?.("change",R);const F="function"==typeof matchMedia?matchMedia("(prefers-reduced-motion: reduce)"):null;F?.addEventListener?.("change",C);const W="function"==typeof MutationObserver?new MutationObserver(R):null;for(const t of[document.documentElement,document.body])t&&W?.observe(t,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]});function B(){y||(y=!0,m&&cancelAnimationFrame(m),z&&cancelAnimationFrame(z),m=z=0,$?.disconnect(),E?.disconnect(),W?.disconnect(),document.removeEventListener("visibilitychange",L),T?.removeEventListener?.("change",R),F?.removeEventListener?.("change",C),b.destroy(),s.restore(),c.width=c.height=1)}return b.start(),b.failed?(B(),null):{field:M,get canvas(){return b.canvas},get live(){return b.live},kick:C,refresh(){y||(f=X(n),M.update({...H,...e.look(),ink:p()}),C())},still:x,dark:()=>f,box:w,play(){g&&(g=!1,M.play(),C())},pause(){g=!0,m&&cancelAnimationFrame(m),m=0,M.pause()},destroy:B}}function et(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=_(e.current,t);const r=t.poster;r&&L(e,r),n(e.current)},play(){i||t()?.play()},pause(){i||t()?.pause()},destroy(){i||(i=!0,t()?.destroy(),z(e),o())}};return Object.defineProperties(r,Object.getOwnPropertyDescriptors(a))}var nt={colorful:["#22c55e","#06b6d4","#6366f1","#d946ef","#f43f5e","#f59e0b"],mono:["#ffffff"],ocean:["#22d3ee","#3b82f6","#2dd4bf","#818cf8"],sunset:["#f97316","#f43f5e","#ec4899","#fbbf24"]},rt={palette:"colorful",mode:"rotate",grain:"dots",speed:1,hover:!0,depth:18},ot=["rotate","pulse","progress"],it=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)},at=(t,e,n)=>t.map((t,r)=>t+(e[r]-t)*n),st=it("#ff4a4a"),lt=it("#2fd67b");function ct(t){const e=("string"==typeof t?nt[t]??nt.colorful:t.length?t:nt.colorful).map(it),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]:at(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 dt=(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)},ut=t=>Math.max(dt(t,.3),.75*dt(t-.5,.22)),ht=(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,ft=(t,e)=>F((t-.68*e)/.07);function pt(t,e={}){const n={current:{...rt,...e}};let r="idle",o=0,i=ct(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),f="",p=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=tt({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),I=Math.min(t.clientWidth||c,t.clientHeight||C),P=Math.max(2,Math.min(z.depth,Math.min(parseFloat(R.paddingTop)||z.depth,parseFloat(R.paddingLeft)||z.depth)-2)),T=[R.borderTopLeftRadius,R.borderTopRightRadius,R.borderBottomRightRadius,R.borderBottomLeftRadius].map(t=>((t,e)=>t.endsWith("%")?parseFloat(t)/100*e:parseFloat(t)||0)(t??"",I)),B=l(),N="dot"!==B.mark,q=B.cellSize??(N?5:3.5),H=B.cellAspect??(N?.6:1),G=`${c}x${C}:${z.grain}:${P}:${T.join(",")}:${q}:${H}`;if(G!==f){f=G,A.canvas.style.clipPath=`inset(0 round ${T.map(t=>`${t}px`).join(" ")})`;const t=Math.min(globalThis.devicePixelRatio||1,B.maxPixelRatio??2),e=Math.max(2,Math.round(q*t)),n=Math.max(2,Math.round(e*H))/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,f,p]=[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:p:i<0?h:f,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*W(Math.floor(46*S),5)+.22*W(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,P,T,N?Math.min(n,r)/2:(B.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=F(D.weight[a]*t(s,a))*(L?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],f=i[c+2],p=i[c+3];const m=o&&L?o(s):0;(r>0||n>0||m>0)&&(r>0&&(d+=(lt[0]-d)*r,u+=(lt[1]-u)*r,f+=(lt[2]-f)*r),n>0&&(d+=(st[0]-d)*n,u+=(st[1]-u)*n,f+=(st[2]-f)*n),m>0&&(d+=(1-d)*m,u+=(1-u)*m,f+=(1-f)*m),p=.2126*d+.7152*u+.0722*f);const g=255*Math.min(1,(l+.12)/2.4/Math.max(p,.01));h[3*a]=d*g,h[3*a+1]=u*g,h[3*a+2]=f*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?ht(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)*ft(U[n],1),0,.9,0):V(t,0,0,0),!1}const X=p?Math.min(48,$-p):16;p=$,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,K="error"===r,_="success"===r,Q=z.hover&&a;for(const t of ot)S[t]+=((t===z.mode?1:0)-S[t])*(1-Math.exp(-X/260));if(K)b=0;else{const t=(J?1500-500*o:"pulse"===z.mode?9e3:2600)/Math.max(.05,z.speed);b+=(1/t*(Q?1.35:1)-b)*(1-Math.exp(-X/320)),v+=b*X,k+=X,y+=X/("pulse"===z.mode?14e3:26e3)*(1-S.progress),(J||_)&&(w+=((_?1:o)-w)*(1-Math.exp(-X/110)))}M+=((Q?1:0)-M)*(1-Math.exp(-X/220)),x=K?.9*O(0,60,Y):x*Math.exp(-X/180);const Z=1+.22*M,tt=.32+.68*(.5-.5*Math.cos(2*Math.PI*k/2400)),et=.05+.1*(.5-.5*Math.cos(2*Math.PI*k/5200)),nt=J||_||K,rt=t=>Z*(S.rotate*ut(t-v)+S.pulse*(J||K?ut(t-v):tt*(.78+.22*Math.cos(2*Math.PI*(t-v))))+S.progress*(nt?ht(t,w):et));if(_){const t=O(0,260,Y),e=F((Y-240)/620),n=1-O(860,1060,Y),r=O(780,1e3,Y),o=O(1350,2450,Y),i=(L?.86:.55)*t*(1-r)+.62*r*(1-o),a=1-t*(1-O(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(rt(t)*a,i*(.9+.1*Math.cos(2*Math.PI*(t-.1))),1.3*s(t),S.progress*et*o),y,0,.9*r*(1-o),t=>F(.8*s(t))),!0}if(K){const t=Y<90?1.2:Y<170?.1:Y<260?1.2:Y<340?.1:1,e=O(380,1150,Y),n=1-.5*O(700,1500,Y),r=Math.floor(Y/50);return V((o,i)=>{const a=ft(U[i],e);return a<=0?0:rt(o)*t*a*n*(1-1.4*e*(1-e)*W(i,r))},y,x,0),Y<1600||Math.abs(M-(Q?1:0))>.01}return V(rt,y,x,0),!0}});const C=()=>{a||(a=!0,A?.kick())},$=()=>{a=!1,A?.kick()},E=t=>{a=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 et(()=>A,n,t=>{i=ct(t.palette),A?.refresh(),A&&c(A)},{progress(t){o=F(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",$)})}var mt={duration:800,trigger:"visible",replayOnHover:!0,settle:"glyphs"};function gt(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=W(n,r),l=W(n+1,r),c=W(n,r+1);return a+(l-a)*o+(c-a)*i+(a-l-c+W(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)}function vt(t,e={}){const n={current:{...mt,...e}},r=Y(),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=tt({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 f=n.current,p="text"===f.settle;if(a<0||d)return!(!c&&"visible"===f.trigger&&!d)&&(p&&a>=0||t.drawImage(o,0,0),a>=0&&h(),!1);const m=s-a,g=.3*f.duration,v=.7*f.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),gt(i,m/1e3),t.imageSmoothingEnabled=!0,m<g)return t.drawImage(i,0,0,e,r),l&&(t.globalAlpha=1-N(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 p||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)W(e+13*S,i)<n||(t.globalAlpha=.35+.65*W(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()},f=()=>{d&&(r.set(t,"-webkit-text-fill-color","transparent"),c=!0,a=performance.now(),d.kick())};let p=!1;const m=d&&"visible"===n.current.trigger&&"function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{t.isIntersecting&&!p&&f(),p=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&&f());let g=!1;const v=()=>{g||(g=!0,n.current.replayOnHover&&a<0&&f())},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()}),et(()=>d,n,()=>{s="",d?.refresh()},{replay:f},()=>{m?.disconnect(),t.removeEventListener("pointerenter",v),t.removeEventListener("pointermove",v),t.removeEventListener("pointerleave",y),document.removeEventListener("pointermove",b,!0),r.restore()})}var yt={value:0,duration:360,stagger:60,glyphs:"#%*+=-:",format:t=>t.toLocaleString(),face:"text"};function bt(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}function Mt(t,e={}){const n=parseFloat((t.textContent??"").replace(/[^\d.-]/g,"")),r={current:{...yt,...e,value:e.value??(Number.isFinite(n)?n:0)}},o=Y();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=J(a,!0),d=document.createElement("span"),u=()=>{d.replaceChildren(...[...a].map(t=>Object.assign(document.createElement("span"),{textContent:t}))),c.textContent=a};l=tt({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"),f=h.fontBoundingBoxAscent||.8*l,p=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-f-p)/2+f,$=k(g,a),E=b-a,L=!n&&b>=0&&E>=0&&/\d/.test($)?F((e-v)/(x.duration+E*x.stagger)):1,z=N(L),R=L<1&&!w?O(.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-O(.72,1,L);const I=5+2*E,P=[k(m,a),...Array.from({length:I},(t,e)=>x.glyphs[Math.floor(W(e+7*a,v)*x.glyphs.length)]??""),$];y||P.reverse();const T=(P.length-1)*A,B=y?z*T:T-z*T;t.save(),t.beginPath(),t.rect(d-s.w,h,2*s.w,A),t.clip(),P.forEach((e,n)=>{const r=C+n*A-B;if(r<h-A||r>h+2*A)return;const o=n>0&&n<P.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 f=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:bt(o,a),t0:performance.now()},u(),l.kick()):t.textContent=a};return et(()=>l,r,t=>{h(),t.value!==i?f(t.value):(a=t.format(i),u(),l?.refresh())},{set:f,get value(){return i}},()=>{l&&(t.textContent=a),o.restore()})}var xt={check:!0,shake:!0};function wt(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(W(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 kt="cubic-bezier(.16, 1, .3, 1)";function St(e,n={}){const r={current:{...xt,...n}},o=Y(),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,f=0,p=null,m={cw:9,ch:15,cellSize:15};const g=J(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(),p&&v.appendChild(p.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=p&&p.canvas.parentElement===v?p.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)}p&&!n&&v.appendChild(p.canvas),v.style.width=t.length*m.cw+"px",v.style.height=`${m.ch}px`,g.textContent=u,f=Math.max(f,e.offsetWidth),f&&o.set(e,"min-width",`${f}px`)},x="undefined"!=typeof document&&t();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()}p=x?tt({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:()=>{p=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:wt(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&&!p&&(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),p?(h=performance.now(),((t,e)=>{const n=e?"none":`opacity 160ms ${kt} ${t?120:0}ms, scale 240ms ${kt} ${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),p.still()),M(),p.kick(),"error"===t&&r.current.shake&&!p.still()&&"function"==typeof e.animate&&e.animate([{translate:"0"},{translate:"-4px 0"},{translate:"4px 0"},{translate:"-2px 0"},{translate:"0"}],{duration:280,easing:kt})):l||(i.textContent=n)};return et(()=>p,r,()=>{p&&(b(),M(),p.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}},()=>{p&&(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()})}var At={colourByState:!0,ring:!0},Ct={success:["--ascii-success","#17844a","#3ccf7e"],warning:["--ascii-warning","#9a6700","#f5b83d"],error:["--ascii-error","#c93636","#ff6b6b"]},$t=120,Et=280,Lt=520,zt=2*Math.PI,Rt=zt/1050,It=t=>1-(1-t)**4,Pt=t=>`rgb(${255*t} ${255*t} ${255*t})`,Tt=t=>t*Rt-Math.PI/2,Ft=(t,e=0)=>78+5*Math.sin(t/1600*zt)*(1-e);function Wt(t,e,n=78,r=24){t.strokeStyle=Pt(e),t.lineWidth=r,t.beginPath(),t.arc($t,$t,n,0,zt),t.stroke()}function Bt(t,e,n,r=0,o=1){if(Wt(t,(.3+(n-78)/100)*o,n,24-6*r),r>=1)return void Wt(t,.72*o,n,18);const i=3.4+(zt-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=Pt((l+(.72-l)*r)*o),t.lineWidth=28-6*s+(18-(28-6*s))*r,t.beginPath(),t.arc($t,$t,n,e-(s+1/32)*i,e-s*i),t.stroke()}}function Ot(t,e,n,r=800,o=0,i=!0){if("idle"===e)return void Wt(t,.34);if("loading"===e)return void Bt(t,Tt(n),Ft(n));const a=(t=>t<.5?4*t*t*t:1-(-2*t+2)**3/2)(Math.min(1,r/Et)),s=Math.min(r,Et),l=o+Rt*(s-s*s/560);i?Bt(t,l,Ft(n,a),a):a<1&&Bt(t,l,Ft(n,a),0,1-a);const c=(r-196)/Lt;i&&c>0&&c<1&&Wt(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([[$t,74],[$t,114]],Math.min(1,n/.7)),n>.7&&(t.fillStyle="#fff",t.beginPath(),t.arc($t,152,r/2*It((n-.7)/.3),0,zt),t.fill())):(o([[92,92],[148,148]],n),o([[148,92],[92,148]],n))}(t,e,It(Math.min(1,Math.max(0,(r-40)/260))),i?24:30)}function Nt(t,e={}){const n={current:{...At,...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=>G(n.current.ink??"--ascii-ink-strong",t,e?"#d8d6cf":"#1d1d1b"))(e);const[o,i,a]=Ct[r];return G(n.current.colors?.[r]??o,t,e?a:i)};d=tt({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:f})=>{const p=e-o;Ot(t,r,h?380:e,h?800:p,i,n.current.ring);const m=u(f);m!==s&&(a=s||m,s=m,l=e);const g=h?1:It(Math.min(1,(e-l)/200)),v=g<1?V(a,s,g):s;return v!==c&&(c=v,d?.field.update({ink:v})),"loading"===r||p<800||g<1}});const h=e=>{const n=performance.now();"loading"===r&&"loading"!==e&&(i=Tt(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 et(()=>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})}var qt={blocks:"[data-block]",shimmer:1250,resolve:240,stagger:60,develop:560},Ht=t=>`rgb(${255*t} ${255*t} ${255*t})`;function Gt(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"}function Dt(t,e={}){const n={current:{...qt,...e}},r=Y();let o=0,i=null,a=null,s=null,l=null;const c=()=>[...t.querySelectorAll(n.current.blocks)].map((t,e)=>({el:t,kind:Gt(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=tt({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 f=(a?.3:(e-o)/u.shimmer%1)*l*1.7-.35*l,p=a?1:.4+.6*Math.min(1,(e-o)/160),m=t.createLinearGradient(f-90,0,f+90,60);m.addColorStop(0,Ht(.3)),m.addColorStop(.5,Ht(.82)),m.addColorStop(1,Ht(.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:B(h/u.develop,4);t.globalAlpha=(1-c)*p,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)*p,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=p,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(),et(()=>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()})}var jt={tone:"neutral",live:!1,indicator:!0,sheen:!0},Ut={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]}},Vt={light:{charset:" .:+*"+"#".repeat(15),top:.32},dark:{charset:" .:+*"+"#".repeat(4),top:.9}},Xt=[[255,130,225],[205,175,255],[120,215,255]],Yt=(t,e,n)=>t.map((t,r)=>t+(e[r]-t)*n),Jt=(t,e)=>Math.exp(-((t/e)**2));function Kt(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 _t=(t,e)=>{return"green"===(n=t.dataset.tone)||"amber"===n||"red"===n||"neutral"===n||"new"===n?t.dataset.tone:e;var n};function Qt(t,e={}){const n={current:{...jt,...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=Y(),s=new Map,l=new Map,c=new Map,d=new Map,u=[],h=t=>void 0!==t.dataset.count?"count":"new"===_t(t,n.current.tone)?"new":"status",f=(t=-1e6)=>{for(const e of r){const r=_t(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})}};f();const p=()=>m?.dark()??(!i||X(i))?"dark":"light";let m=null,g="";function v(){for(;u.length;)u.pop()();a.restore()}m=i?tt({host:i,layer:o?"under":"over",look:()=>({mark:"glyph",charset:Vt[p()].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:Vt[p()].charset}),paint:({pen:t,now:e,still:o,dark:i,box:a})=>{const u=n.current,f=i?"dark":"light",p={...Ut[f],...u.tones?.[f]},v=Vt[f].top,y=Math.min(2,globalThis.devicePixelRatio||1),b=Math.round(8*y)/y,M=Math.round(8*y*.6)/y,x=(t,e)=>Kt(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:f,y:m,w:g}=w[i],v=h(r);if(!(g<=0)){if(t.save(),t.beginPath(),t.rect(f,m,g,b),t.clip(),"status"===v){const l=s.get(r),c=o?1:B((e-l.at)/240);c<1&&(S=!0);const d=Yt(p[l.from],p[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=f-12+B(n)*(g+24);for(let n=f;n<f+g;n+=2){const r=.42*Jt(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=f-20+B(n)*(g+40),r=Math.sin(Math.PI*Math.min(1,1.15*n));for(let n=f;n<f+g;n+=2){const o=(n-f)/g,i=o<.5?Yt(Xt[0],Xt[1],2*o):Yt(Xt[1],Xt[2],2*o-1),a=r*Jt(n-e,11);a>.2&&(t.fillStyle=Kt(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=B((l-.72)/.28);i.style.opacity=String(c),i.style.translate=`0 ${3*(c-1)}px`,l<=0||l>=1||(t.fillStyle=x(p.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=J(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 et(()=>m,n,()=>{f(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:()=>{f(performance.now()),m?.kick()}},()=>{i?.removeEventListener("pointermove",w),i?.removeEventListener("pointerleave",k),v()})}var Zt={tabs:'[role="tab"]',duration:280,panels:"hidden",manage:!0};function te(t,e={}){const n={current:{...Zt,...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;let l=null;l=tt({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),f=l(u),p=o?1:(e-s)/n.current.duration;if(p>=1){const e=f.x+1,n=f.y+1.5,r=f.w-2,o=f.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=B(n/.8),i=B((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,f,p),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*p),o=.25+.75*(r+(1-r)*n**1.6);for(let i=0;i<M;i+=6){if(W(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(),et(()=>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)})}var ee=280,ne={preview:[{k:.5,blur:9},{k:.78,blur:4}],final:{k:1,blur:0}},re=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};function oe(t,e={}){const n={current:{...e}},r=Y(),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:N(Math.min(1,Math.max(0,(t-d.at)/ee))),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}]},f=(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=tt({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 f=c&&!l?1+.12*Math.sin(2.1*u)*(.7+.3*Math.sin(.37*u)):1,p=Math.max(2,Math.ceil(24*r/Math.max(1,e)));24===o.width&&o.height===p||(o.width=24,o.height=p),gt(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*f})`,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<ee}});const p=(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?ee: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(),p("generating"),m(!1),f(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&&f(await re(e.final),ne.final.k,ne.final.blur);break}if(!c){v(e.preview);continue}const t=ne.preview[Math.min(l++,ne.preview.length-1)];f(await re(e.preview),t.k,t.blur)}if(await g(o?0:ee),!r())return i;p("done"),m(!0),c?.kick()}catch(t){if(!r())return i;f(null,0,12),await g(o?0:ee),p("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(),et(()=>c,n,()=>c?.refresh(),{run:y,reset(){s++,f(null,0,12),p("idle"),m(!1)},get state(){return i}},()=>{s++,l&&URL.revokeObjectURL(l),delete t.dataset.state,t.removeAttribute("aria-busy"),r.restore()})}var ie=t=>new Promise(e=>setTimeout(e,t));function ae(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())return o?.current.poster&&!e.ownPoster&&I(n,o.current.poster,i,o),null;const a=Y(),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=X(n),c=!1;const d=()=>{const t=e.reducedMotion();return!0===t?{speed:0,drift:0,respectReducedMotion:!0}:{respectReducedMotion:!1!==t}},u=()=>G(e.ink(l),n,l?"#d8d6cf":"#1d1d1b")??"#888888",h=P({host:n,canvas:s,kit:o,place:i,ownPoster:e.ownPoster,source:e.source??null,options:()=>({...H,...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?.()}}),f=h.field;let p=0;const m=()=>{c||(l=X(n),f.update({...H,...e.look(l),...d(),ink:u()}))},g=()=>{p||c||(p=requestAnimationFrame(()=>{p=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,p&&cancelAnimationFrame(p),y?.disconnect(),v?.removeEventListener?.("change",g),h.destroy(),a.restore())}return h.start(),h.failed?(b(),null):{field:f,get canvas(){return h.canvas},get live(){return h.live},dark:()=>l,still:()=>!!(e.reducedMotion()??q()),refresh:m,destroy:b}}function se(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=_(e.current,r);const o=r.poster;o&&L(e,o),n(e.current),t()?.refresh()},play(){i||t()?.field.play()},pause(){i||t()?.field.pause()},destroy(){i||(i=!0,o(),t()?.destroy(),z(e))}};return Object.defineProperties(r,Object.getOwnPropertyDescriptors(a))}function le(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 ce(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 de={preset:"hero",clear:!1,text:"404",ripple:!0},ue=28,he='600 440px "Geist", Arial, sans-serif',fe=()=>"number"==typeof innerWidth&&innerWidth<760,pe=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}),me={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 ge=[...Array.from({length:10},(t,e)=>(e+1)/10),1,1,1,...Array.from({length:14},(t,e)=>1-(e+1)/14)];function ve(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,ue,ue,e.x+e.dx*i,e.y+e.dy*i,ue,ue)}o.globalAlpha=1}function ye(t,e={}){const n={current:{...de,...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=he;const n=Math.max(320,Math.ceil(e.measureText(t).width)+160),{canvas:r,pen:o}=le(n,560);return o.fillStyle="#fff",o.textAlign="center",o.textBaseline="middle",o.font=he,o.letterSpacing="-10px",o.fillText(t,n/2,296),r}(n.current.text);let c=null;c=ae({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?me:"brand"===t.preset?pe({scale:fe()?1.4:1.6,brightness:.24,contrast:1.1,clear:r(.3)}):pe({scale:fe()?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?.(he).then(()=>{c&&r()&&!i&&c.field.setSource(l())},()=>{});const d=(t,e=1.4)=>{c&&!c.still()&&(a=performance.now()+1400,ce(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}),ce(c.field,{x:t.clientX,y:t.clientY},.65))};c&&t.addEventListener("pointermove",u);let h=n.current.preset,f=n.current.text;return se(()=>c,n,t=>{c&&((t.preset!==h||"notFound"===t.preset&&t.text!==f)&&(o++,i=!1,c.field.setSource("notFound"===t.preset?l():null)),h=t.preset,f=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+=ue)for(let o=0;o<t.width;o+=ue){let i=!1;for(let n=0;n<ue&&!i;n+=4)for(let a=0;a<ue&&!i;a+=4)i=(e[4*((r+n)*t.width+o+a)]??0)>40;if(!i)continue;const a=n.length,s=W(a,1)*Math.PI*2,l=120+420*W(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*W(a,3)})}return n}(a),u=le(a.width,a.height).canvas;for(const t of ge){const r=performance.now();if(ve(a,u,s,t),await e.setSource(u),await ie(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)})}var be={font:'Georgia, "Times New Roman", serif',fontWeight:600};function Me(t,e={}){const n=(t.textContent??"").trim(),r={current:{...be,...e}};let o=r.current.text??n;const i=Y(),a=()=>function(t,e=be.font,n=be.fontWeight,r=520){const{canvas:o,pen:i}=le(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=ae({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 se(()=>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())}var xe="position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit;pointer-events:none";function we(t,e={}){const n={current:{...e}},r=Y(),o=[],i=t.querySelector("video"),a=n.current.src??i??null,s=()=>n.current.reducedMotion??q();let l=null,c=0;l=a?ae({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(),p()},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",`${xe};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 f=null;function p(){!f&&a&&(a instanceof HTMLVideoElement?f=a:(f=document.createElement("video"),f.src=a,f.setAttribute("style",xe),f.setAttribute("aria-label",n.current.label??"Video"),"static"===getComputedStyle(t).position&&r.set(t,"position","relative"),d?t.insertBefore(f,d):t.appendChild(f),o.push(f)),n.current.poster&&!f.poster&&(f.poster=n.current.poster),f.muted=!0,f.loop=!0,f.playsInline=!0,d&&(d.style.opacity="0"),m&&f.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()):p();const g=se(()=>l,n,t=>{d&&t.poster&&d.getAttribute("src")!==t.poster&&(d.src=t.poster),f&&t.poster&&(f.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():f?.play?.()?.catch?.(()=>{}),h())},g.pause=()=>{l&&!g.supported||(m=!1,l?y():f?.pause?.(),h())},g}function ke(t,e={}){const n={current:{...e}},r=Y(),o=t.querySelector("img"),i=n.current.image??o??null;let a=null;a=i?ae({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 se(()=>a,n,()=>{},{pulse:(t,e=1)=>{a&&!a.still()&&ce(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 ie(Math.max(0,48-(performance.now()-n)))}})():e.setSource(i)}},()=>{s++,r.restore()})}var Se={saving:null,font:'"Geist", Arial, sans-serif'};function Ae(t,e,n,r=Se.font){const o=Math.max(2,Math.round(2*t.offsetWidth)),i=Math.max(2,Math.round(2*t.offsetHeight)),{canvas:a,pen:s}=le(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}function Ce(t,e={}){const n={current:{...Se,...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=ae({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=le(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 ie(Math.max(0,48-(performance.now()-r)))}r===i&&l?.field===e&&await e.setSource(t)};return se(()=>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()&&ce(l.field,t,e)}},()=>{i++,c?.disconnect()})}var $e={aurora:["#2ee6c8","#9d7bff","#ff6fb5"],brand:["#ffb000","#ffd84d"]},Ee={palette:"aurora",swell:!0},Le=t=>"mono"===t?[]:"string"==typeof t?[...$e[t]??$e.aurora]:[...t];function ze(t,e){if(1===t.length)return t[0];const n=F(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(" ")})`}function Re(t,e={}){const n={current:{...Ee,...e}},r=Y();let o="idle",i=0,a=F(n.current.level??0),s=a,l=0,c=0,d=Le(n.current.palette),u=null,h=null,f=0;const p=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=tt({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&&p(u),onFail:()=>{u=null},paint:({pen:t,w:e,h:n,now:r,still:u})=>{const f=c?Math.min(64,r-c):16;c=r;const p=F((t=>"listening"===o?h?h.read():a:"thinking"===o?.2+.1*Math.sin((t-i)/120):"done"===o?l*(1-N(F((t-i)/420))):a)(r));return u||"done"===o?s=p:s+=(p-s)*(1-(1-(p>s?.45:.12))**(f/16.7)),u||m(s),function(t,e,n,r,o,i){const a=t=>{const e=Math.round(255*F(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 f=s+.8*Math.cos(u)*c*.62,p=l-.55*c*.62,m=t.createRadialGradient(f,p,0,f,p,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,ze(i,y)),b.addColorStop(.5,ze(i,y+.25)),b.addColorStop(1,ze(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&&p(u);const g=()=>{f++,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 et(()=>u,n,t=>{d=Le(t.palette),void 0!==t.level&&(a=F(t.level)),u?.refresh(),u&&p(u)},{level(t){a=F(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=f,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!==f)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})}var Ie=t=>{const e=Math.round(255*Math.min(1,Math.max(0,t)));return`rgb(${e} ${e} ${e})`},Pe=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},Te=/^(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?Z(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=Pe(s.backgroundColor)>.03,c=(parseFloat(s.borderTopWidth)||0)>0&&Pe(s.borderTopColor)>.1;if(t.beginPath(),a===e)(l||c)&&(t.strokeStyle=Ie(.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(Te.test(a.tagName)){t.fillStyle=Ie(.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=Ie(.22),t.roundRect(i.x,i.y,i.w,i.h,o(s,i)),t.fill()):c&&(t.strokeStyle=Ie(.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&&We(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||Be(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++,We(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 We(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=Ie(a),t.shadowColor=Ie(a),t.shadowBlur=3,t.textBaseline="middle",t.fillText(e,n,r+o/2),t.shadowBlur=0}function Be(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 Oe(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 Ne={input:"input",rows:'[role="option"]',hotkey:"k",manage:!0,closeOnRun:!0},qe=200,He=t=>{const e=Math.round(255*F(t));return`rgb(${e} ${e} ${e})`};function Ge(t,e={}){const n={current:{...Ne,...e}},r=Y(),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,f=!1,p=0,m=null;const g=()=>!!(n.current.reducedMotion??q());m=tt({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?qe:260);if(!(o>=1||n)){const e=r.closing?1-1.02*N(o):1.04*N(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 f=d.x,p=d.y;if(h>0){const[t,e]=i(d,h);f+=t,p+=e}t.globalAlpha=a*(1-h*h),t.drawImage(e,d.x*l,d.y*l,4*l,6*l,f,p,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-F((o-.72)/.28),.4),!0}h=null}if(!a||f)return!1;const p=o()[s];if(!p)return!1;const m=r(p),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=He(.32),t.fillRect(v,Math.min(g,l.y)+7,6,Math.abs(g-l.y)+y)),t.fillStyle=He(.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=K(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=Oe(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:W(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,f=Math.hypot(o,i)||1;h={snap:a,blocks:s,order:Float32Array.from(s,t=>Math.hypot(t.x-d,t.y-u)/f*.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=()=>{p&&clearTimeout(p),p=0},S=(e=!0)=>{!a||f?(k(),a=!0,f=!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&&(f=!0,x(!0),M(!1)),p=setTimeout(()=>{p=0,delete t.dataset.state,f=!1,x(!1),m?.kick()},143))):e&&i()?.focus({preventScroll:!0})},A=()=>{if(!a)return;k();const e=t.contains(document.activeElement),r=()=>{p=0,f=!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();f=!0,t.dataset.state="closing",m&&(M(!0),x(!0));const o=w([y(),b()],qe,"forwards"),i="function"==typeof t.animate?t.animate([{opacity:1},{opacity:1,offset:.4},{opacity:0}],{duration:qe,fill:"forwards"}):null;p=setTimeout(()=>{r(),o?.cancel(),i?.cancel()},qe)},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||f)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&&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(),$())},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()},I=t=>{if(!n.current.manage)return;const e=L(t);e>=0&&$(e)},P=()=>{n.current.manage&&(c=!1,l=null,C(0))},T=()=>{a?A():S(!0)},B=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))},O=e=>{if(!n.current.manage||!a||f)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",I),t.addEventListener("input",P);const H=n.current.trigger;return H?.addEventListener("click",T),H?.setAttribute("aria-expanded",String(a)),H?.setAttribute("aria-haspopup","dialog"),document.addEventListener("keydown",B),document.addEventListener("pointerdown",O),a?t.dataset.open="":t.setAttribute("hidden",""),v(),et(()=>m,n,()=>{v(),m?.refresh()},{open:S,close:A,select:C,run:$,toggle(){a?A():S(!0)},get isOpen(){return a},get selected(){return s}},()=>{k(),x(!1),t.removeEventListener("keydown",E),t.removeEventListener("pointermove",z),t.removeEventListener("pointerleave",R),t.removeEventListener("click",I),t.removeEventListener("input",P),H?.removeEventListener("click",T),document.removeEventListener("keydown",B),document.removeEventListener("pointerdown",O),delete t.dataset.gpu,delete t.dataset.state})}var De={thumb:'[role="slider"]',label:"[data-label]",threshold:.9,resetAfter:0},je=720,Ue=(t,e,n)=>t+(e-t)*n,Ve=t=>1-(1-t)**3,Xe=(t,e,n)=>({x:t,v:0,to:t,k:e,z:n});function Ye(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 Je=t=>{t.x=t.to,t.v=0};function Ke(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}function _e(t,e={}){const n={current:{...De,...e}},r=Y(),o=t.querySelector(n.current.thumb)??t.firstElementChild,i=()=>t.querySelector(n.current.label),a=()=>!!(n.current.reducedMotion??q());let s=Xe(0,520,.8),l=Xe(0,150,1),c=!1,d=0,u=!1,h=0,f=0,p=[],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=>G(n.current.ink??"--ascii-ink-strong",t,e?"#d8d6cf":"#1d1d1b");M=tt({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 p=x();if(!p)return!1;const m=u?a?1:F((i-h)/je):0,g=Ve(F(m/.5)),v=Ve(F((m-.36)/.3)),b=Ve(F((m-.46)/.4)),w=F((m-.5)/.5),S=1+.07*Math.sin(Math.PI*w)*(1-w),A=f?1-F((i-f)/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?V(k(c),(e=>G(n.current.color??"--ascii-success",t,e?"#3ccf7e":"#17844a"))(c),Ve(F(a?1:(i-h)/360))):k(c);z!==y&&(y=z,M?.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=p.pad+s.x+p.size/2,I=u?1:l.x,P=Ue(0,$-L,g),T=Ue(R,$+L,g),W=Ue(0,E-L,g),B=Ue(o,E+L,g);if(T-P>1&&I>.004){const t=e.createLinearGradient(P,0,T,0);t.addColorStop(0,`rgba(255,255,255,${Ue(.14,1,g)*I})`),t.addColorStop(.62,`rgba(255,255,255,${Ue(.48,1,g)*I})`),t.addColorStop(1,`rgba(255,255,255,${I})`),e.fillStyle=t,e.globalAlpha=A*(1-.28*v),e.beginPath(),e.roundRect(P,W,T-P,B-W,Ue(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(),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,$+.02*L,E+.07*L,.55*L,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*F(e))));const n=i();n&&r.set(n,"opacity",String(u?0:1-F(1.7*e)))},A=e=>{m=0;const n=Math.min(1/30,Math.max(0,(e-g)/1e3));g=e;let i=!c&&Ye(s,n,.3);i=Ye(l,n,.003)||i,f&&(e-f>=260||a())&&(f=0,u=!1,s=Xe(0,520,.8),l=Xe(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||f>0)&&(m=requestAnimationFrame(A))},C=()=>{m||(g=performance.now(),m=requestAnimationFrame(A))},$=()=>{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()&&(Je(s),Je(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();f=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!==b)return;c=!1;const o=Ke(p,performance.now());s.x>=r.max*n.current.threshold||o>900&&s.x>.5*r.max?$():(s.to=0,s.v=.25*F(o,-1500,1500),l.to=0,a()&&(Je(s),Je(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{}b=e.pointerId,c=!0,d=e.clientX-s.x*w(),l.to=1,p=[],t.dataset.state="dragging",C()}else c||a()||(s.v+=420,l.to=0,C())},R=t=>{const e=x();c&&e&&t.pointerId===b&&(s.x=s.to=F((t.clientX-d)/w(),0,e.max),s.v=0,p.push([s.x,performance.now()]),p.length>8&&p.shift(),s.x>=e.max-.5?$():C())},I=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?F(s.to+n*e.max/4,0,e.max):null;null!==r&&(t.preventDefault(),s.to=r,l.to=r>0?1:0,a()&&(Je(s),Je(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",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",I));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),et(()=>M,n,()=>M?.refresh(),{confirm:$,reset:E,get confirmed(){return u}},()=>{m&&cancelAnimationFrame(m),v&&clearTimeout(v),m=v=0,o?.removeEventListener("keydown",I),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})}var Qe={kind:"heart",icon:"svg",manage:!0,outset:40,layer:"under"},Ze=t=>1-(1-F(t))**3;function tn(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 en(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),tn(t,e,n,r,o),t.fill(),t.shadowBlur=0,t.globalAlpha=1}function nn(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)(F((r-.42)/.3)),u=d>0?l+(s-l)*d:.7*s+(l-.7*s)*c,h=F((r-.04)/.46);h>0&&h<1&&(t.strokeStyle=(t=>{const e=Math.round(255*F(t));return`rgb(${e} ${e} ${e})`})(.8*(1-h)**1.4),t.lineWidth=2.4-1.2*h,t.lineJoin="round",tn(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*W(e,o))/.5;if(n<=0||n>=1)continue;const l=-Math.PI/2+(e-3)/7*Math.PI*1.7+.3*(W(o+1,e)-.5),c=s*(.75+(.55+.35*W(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,en(t,e,i,a,u,1-F((r-.72)/.28))}function rn(t,e={}){const n={current:{...Qe,...e}},r=Y(),o=()=>t.querySelector(n.current.icon)??t,i=()=>!!(n.current.reducedMotion??q());let a="true"===t.getAttribute("aria-pressed"),s=[],l=[],c=null;c=tt({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)nn(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));en(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)W(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())},f=(e=!a)=>{a=e,t.setAttribute("aria-pressed",String(a)),a?u():h()},p=()=>{n.current.manage&&(f(),n.current.onChange?.(a))};return!t.hasAttribute("aria-pressed")&&n.current.manage&&t.setAttribute("aria-pressed","false"),t.addEventListener("click",p),et(()=>c,n,()=>c?.refresh(),{burst:u,undo:h,toggle:f,get pressed(){return a}},()=>{d(),r.restore(),t.removeEventListener("click",p)})}var on={values:[],duration:520},an=t=>{const e=Math.round(255*F(t));return`rgb(${e} ${e} ${e})`};function sn(t,e={}){const n={current:{...on,...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=tt({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 f=s?Math.min(64,l-s):16;s=l;const p=e/h,m=Math.max(3,p*(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:F((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(-f/90)),Math.abs(a[e]-d)>.01&&(y=!0);const M=(g>0?Math.max(0,u[e])/g:0)*(r-2)*N(s),x=r-M,w=p*(e+.5)-m/2;if(M<=0)continue;const k=.16+.84*a[e],S=t.createLinearGradient(0,x,0,r);S.addColorStop(0,an(k)),S.addColorStop(1,an(.5*k)),t.fillStyle=S,t.fillRect(w,x,m,M)}return y}});const u=Y(),h=c?null:document.createElement("div"),f=()=>{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*F(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 p=document.createElement("table");p.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)}),p.replaceChildren(r)};m(),t.appendChild(p);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(),f(),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(),f()};f();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),et(()=>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(),p.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")})}var ln={dissolve:140,condense:160},cn=10,dn=16;function un(t,e={}){const n={current:{...ln,...e}},r=Y();let o=null,i=0,a=Promise.resolve(),s=0,l=null;l=tt({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:N(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+=dn)for(let a=0;a<i;a+=cn){const i=Math.hypot(a+5-r.x,c+8-r.y)/l*.72+.28*W(a,c)-n;if(i>0&&t.drawImage(e,a,c,cn,dn,a,c,cn,dn),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,cn,dn,a+18*(W(c,a+o)-.5)*n,c-10*n,cn,dn),t.globalAlpha=1}}t.globalCompositeOperation="lighter";for(const[n,r]of s)t.drawImage(e,n,r,cn,dn,n,r,cn,dn);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=>Oe(t,e.box,t.offsetWidth,t.offsetHeight,2,{skip:e.canvas}),h=async(e,o)=>{const i=l;if(!i||(n.current.reducedMotion??q()))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 et(()=>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()})}var hn={cards:"[data-card]",loop:!0,threshold:.4,outset:56},fn=(t,e,n)=>t+(e-t)*n,pn=(t,e,n)=>({x:t,v:0,to:t,k:e,z:n}),mn=Array.from({length:96},(t,e)=>{const n=43758.5453*Math.sin(127.1*e+311.7);return n-Math.floor(n)});function gn(t,e={}){const n={current:{...hn,...e}},r=Y(),o=()=>!!(n.current.reducedMotion??q()),i=()=>[...t.querySelectorAll(n.current.cards)];let a=0,s=pn(0,380,.72),l=pn(0,380,.8),c=pn(0,260,.9),d=!1,u=0,h=0,f=null,p=[],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 f=n.current.radius??(parseFloat(getComputedStyle(t).borderTopLeftRadius)||16);h.beginPath(),h.roundRect(0,0,u.width,u.height,Math.min(f,u.width/2,u.height/2)),h.clip();const p=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 f=Math.max(1,u-d);for(let t=0;t<a.length;t+=4){let r=F((c(t)-d)/f);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(p){const t=Math.max(u.width/p.width,u.height/p.height),e=u.width/t,n=u.height/t;h.drawImage(p,(p.width-e)/2,(p.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+(f?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=tt({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,p=d.x+u/2,m=d.y+h/2,g=F(c.x),v=(t,n,r,i,a=0)=>{const s=S(t,u,h,!o);!s||i<=0||(e.save(),e.translate(p,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,fn(.86,.93,g),fn(24,12,g),fn(.3,.55,g),.3),v(a+1,fn(.93,1,g),fn(12,0,g),fn(.55,1,g),.4*(1-g));const y=S(a,u,h,!o);if(!y)return!1;const M=f?F((r-f.start)/620):0,x=f?.dir??1,w=f?f.x0+x*u*.9*(1-(1-M)**3):s.x,k=f?f.y0:l.x;if(e.save(),e.translate(p+w,m+k),e.rotate(.22*F(w/u,-1.6,1.6)),!f)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=mn[t%mn.length],o=F(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?p+w+i+.62*u:p+w+i-.62*u,c=x>0?n-4-l:l-4;e.globalAlpha=(1-o*o)*F(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||f||(i=Ye(s,o,.3),i=Ye(l,o,.3)||i),i=Ye(c,o,.002)||i,f&&e-f.start>=620&&(f=null,a+=1,E()),(()=>{(n.current.leanTarget??t).style.setProperty("--ascii-lean",String(f?0:F(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*F(s.x/w(),-1.6,1.6)}rad)`)})(),M?.kick(),(i||d||f)&&(m=requestAnimationFrame(C))},$=()=>{m||(g=performance.now(),m=requestAnimationFrame(C))},E=()=>{s=pn(0,380,.72),l=pn(0,380,.8),c=pn(0,260,.9)},L=(t=1)=>{const e=i();if(f||!e.length||!n.current.loop&&a>=e.length)return!1;const u=x(a),h=k(a);return d=!1,o()||!M?(a+=1,E(),M||r.set(u,"transform","")):(f={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=Ke(p,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*F(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,I=e=>{if(0!==e.button||f)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,p=[],$()},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*F(Math.abs(s.x)/w()),p.push([s.x,performance.now()]),p.length>8&&p.shift(),$()},T=t=>{"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||(t.preventDefault(),L("ArrowRight"===t.key?1:-1))},W=()=>M?.kick(),B=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",I),t.addEventListener("pointermove",P),t.addEventListener("pointerup",z),t.addEventListener("pointercancel",z),t.addEventListener("lostpointercapture",z),t.addEventListener("keydown",T),t.addEventListener("load",W,!0),t.addEventListener("dragstart",B),et(()=>M,n,()=>{y=new Map,A(),M?.refresh()},{next:L,get index(){return k(a+(f?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",I),t.removeEventListener("pointermove",P),t.removeEventListener("pointerup",z),t.removeEventListener("pointercancel",z),t.removeEventListener("lostpointercapture",z),t.removeEventListener("keydown",T),t.removeEventListener("load",W,!0),t.removeEventListener("dragstart",B)})}var vn={length:6,accept:"digits",cells:"[data-cell]"},yn=560,bn=t=>{const e=Math.round(255*F(t));return`rgb(${e} ${e} ${e})`};function Mn(t,e={}){const n={current:{...vn,...e}},r=Y(),o=Y(),i=[],a=()=>!!(n.current.reducedMotion??q()),s=()=>Math.max(1,Math.round(n.current.length));let l="",c="idle",d=!1,u=[],h="",f=-1e9,p="",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,f=n.h*d,p=n.x+(n.w-h)/2+l,m=n.y+(n.h-f)/2+c;for(let e=0;e<n.h;e+=4)for(let a=0;a<n.w;a+=3){if(W(a+31*i,e)>1.3*r-.12)continue;const n=3*(1-r);t.drawImage(u,2*a,2*e,6,8,p+a*d+(W(a,e+o)-.5)*n,m+e*d+(W(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=tt({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)=>p[r]&&A(e,p[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=F((t-.45)/.55);return c>0&&c<1&&(e.strokeStyle=bn(.55*(1-c)),e.lineWidth=3,e.beginPath(),e.arc(a,l,18+44*(t=>1-(1-F(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,N(F((t-.4)/.45))),t<1}let b=!1;const M=o-f;return s.forEach((t,n)=>{const r=a(t),s=l[n];if(M<yn&&h[n])return C(t,!1),A(e,h[n],r,1-M/yn,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>=yn){const t=i?.6:.5-.5*Math.cos(o/1600*Math.PI*2);e.fillStyle=bn(.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 $=(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),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()},z=t=>{E(),"idle"!==c&&(c="idle",m=-1e9),h="",f=-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,L(),e.length===s()&&$(a()||!b?0:300+y*Math.max(0,o-1)+80,()=>n.current.onComplete?.(e)),y=0},R=()=>z(w.value),I=()=>{y=55},P=()=>{d=!0,L()},T=()=>{d=!1,L()};return w.addEventListener("input",R),w.addEventListener("paste",I),w.addEventListener("focus",P),w.addEventListener("blur",T),w.value?z(w.value):L(),et(()=>b,n,()=>{w.setAttribute("maxlength",String(s())),L(),b?.refresh()},{verify:e=>{E();const n=performance.now();if(e)return p=l,g=b?k().map(t=>b.box(t)):[],m=n,c="success",void L();h=l,f=a()||!b?n-yn:n,c="error",L(),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;$(a()||!b?0:yn,()=>{h===r&&(h="",l="",L())})},clear:()=>{E(),h="",f=-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",I),w.removeEventListener("focus",P),w.removeEventListener("blur",T),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})}function xn(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 wn(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 kn(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 Sn(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,f=0;for(let t=0;t<256;t++)if(f+=l[t],f>=.02*c){u=t;break}f=0;for(let t=255;t>=0;t--)if(f+=l[t],f>=.02*c){h=t;break}const p=Math.max(1,h-u);for(let t=0;t<s.length;t+=4){let r=F((d(t)-u)/p);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 An={strong:1,text:.82,meta:.55,tile:.42,icon:.62},Cn=new Set(["IMG","SVG","svg","VIDEO","PICTURE"]),$n=t=>[...t.children].flatMap(t=>Cn.has(t.tagName)?[t]:[t,...$n(t)]);function En(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!==An[t])return An[t]}return parseFloat(e?getComputedStyle(e).fontWeight:"400")>=500?1:.7},u=t=>{const e=Math.round(255*F(t));return`rgb(${e} ${e} ${e})`},h=$n(t),f=[t,...h].filter(t=>{const e=t.dataset?.paint;return"tile"===e||"icon"===e||!e&&Cn.has(t.tagName)&&!t.closest("[data-paint]")});for(const t of f){const e=r(t);if(e.w<=0||e.h<=0)continue;const n=t.dataset?.paint;a.fillStyle=u("icon"===n?An.icon:An.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 p=document.createTreeWalker(t,4),m=document.createRange();a.textBaseline="middle";for(let t=p.nextNode();t;t=p.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 Ln(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,f=c.y;if(u>0){const[t,e]=i(c,u);h+=t,f+=e}t.globalAlpha=a*(1-u*u),t.drawImage(e,2*c.x,2*c.y,8,12,h,f,4,6)}t.globalAlpha=1}function zn(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 Rn={max:3,duration:6e3,label:"Notifications",glint:!0},In=4200,Pn="cubic-bezier(.16, 1, .3, 1)",Tn=`\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 ${Pn},scale 280ms ${Pn},opacity 160ms ${Pn}}\n:where(.ascii-toast) > *{transition:opacity 160ms ${Pn}}\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 ${Pn} 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`,Fn=t=>{const e=Math.round(255*F(t));return`rgb(${e} ${e} ${e})`};var Wn=t=>{const[e,n,r]=U(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};function Bn(t,e={}){const n={current:{...Rn,...e}},r=Y(),o=document.createElement("ol"),i=J("",!1);i.setAttribute("role","status");let a=[],s=[],l=0,c=!1,d=!1,u=!1,h=!1,f=null,p=0;const m=[];zn("ascii-kit-toast",Tn),o.className="ascii-toasts",o.setAttribute("aria-label",n.current.label),t.append(o,i);const g=new WeakSet,v=e=>{const r=G(n.current.ink??"--ascii-ink-strong",t,X(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(F(+t,0,255)).toString(16).padStart(2,"0")).join("")}`,[o,i]=[Wn(r),Wn(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"))};f=tt({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:()=>{f=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%In/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=Fn(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{p&&clearTimeout(p);const t=n>0?In-n%In:-n;p=setTimeout(()=>{p=0,f?.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?Ln(t,n.snap,n.blocks,n.order,1.04*N(r),(t,e)=>[70*(t.seed-.5)*e,(14+26*W(t.x,t.y))*e],1-F((r-.62)/.28)):Ln(t,n.snap,n.blocks,n.order,1-1.04*(1-(1-r)**3),(t,e)=>[(14+34*t.seed)*e,14*(W(t.y,t.x)-.35)*e],1-F((r-.75)/.25)),!0)}),s.length>0||l}}),f&&(f.canvas.style.zIndex="11");const b=()=>!!f&&f.live&&!f.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(!f)return;const r=En(e,f.canvas.clientWidth||t.clientWidth+48,f.canvas.clientHeight||t.clientHeight+48,f.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:W(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}),f.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 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()},$=t=>{o.contains(t.relatedTarget)||(u=!1,k())};function E(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(),f?.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()}o.addEventListener("pointerenter",S),o.addEventListener("pointerleave",A),o.addEventListener("focusin",C),o.addEventListener("focusout",$);return et(()=>f,n,t=>{o.setAttribute("aria-label",t.label),f?.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=>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"),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(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)):f?.kick(),w(d),e},dismiss:E,clear(){[...a].forEach(t=>E(t.id))},get toasts(){return a.filter(t=>void 0===t.node.dataset.gone).map(t=>t.id)}},()=>{h=!0,p&&clearTimeout(p);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",$),a=[],s=[],o.remove(),i.remove(),r.restore()})}var On={lines:3,start:!0,stagger:38,rule:!0},Nn=420,qn=t=>`Thought for ${t}s`;function Hn(t,e={}){const n={current:{...On,...e}},r=Y(),o=[...t.childNodes];let i="done",a=0,s=0,l=-1e9,c=-1e9,d=0,u="",h=null;const f=document.createElement("canvas"),p=()=>{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=tt({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=p(),h="thinking"===i?1:a?0:1-B((o-l)/Nn),m="done"===i&&d.rule?a?.7:.7*B((o-c-280)/Nn):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));f.width===n&&f.height===o||(f.width=n,f.height=o),gt(f,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*W(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(f,0,0,e,r),t.drawImage(f,0,0,e,r),t.drawImage(f,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<Nn||"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*p()+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(),et(()=>h,n,()=>h?.refresh(),{think:v,stream:async e=>{"thinking"!==i&&v();const o=d;y=0;let f="";const p=()=>{"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??qn)(a)),n.current.onState?.("streaming",a),h?.kick())},M=(t,e)=>{f+=t;const o=e?f.length:f.search(/\s\S*$/)+1;o<=0||(p(),u+=f.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)}})(f.slice(0,o)),f=f.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)}p();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)})}var Gn={caret:!0,settle:60,stagger:18,reasoningLines:2},Dn="cubic-bezier(.16, 1, .3, 1)",jn=`\n:where(.ascii-reasoning){display:grid;grid-template-rows:1fr;transition:grid-template-rows 260ms ${Dn},opacity 200ms ${Dn}}\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 ${Dn},opacity 200ms ${Dn}}\n:where(.ascii-reasoning li[data-new]){opacity:0}\n@media (prefers-reduced-motion: reduce){:where(.ascii-reasoning, .ascii-reasoning li){transition:none}}\n`,Un=t=>[...t.children].filter(t=>"IMG"===t.tagName&&void 0!==t.dataset?.asciiPoster);function Vn(t,e={}){const n={current:{...Gn,...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 f=null,p=null;const m=e=>{o!==e&&(o=e,"done"!==e&&"stopped"!==e||(f?.setAttribute("data-collapsed",""),f?.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=tt({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:f}=h(),p=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*W(p,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*f)/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 et(()=>u,n,()=>u?.refresh(),{write:e=>{if(!e)return;"streaming"!==o&&("idle"===o&&(t.replaceChildren(...Un(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,f=u.still();let p=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,f||(e.style.setProperty("color","transparent"),a.push({span:e,at:c+h.settle+p*h.stagger,seed:31*l+p})),r(e),s=e,p++}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&&f)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(!f||!p){zn("ascii-kit-reasoning",jn),f=document.createElement("div"),f.className="ascii-reasoning";const e=document.createElement("div");e.className="ascii-reasoning-in",p=document.createElement("ol"),e.appendChild(p),f.appendChild(e),t.parentElement?.insertBefore(f,t)}f.removeAttribute("data-collapsed"),f.removeAttribute("aria-hidden");const r=Math.max(1,Math.round(n.current.reasoningLines));f.style.setProperty("--ascii-reasoning-lines",String(r));const o=document.createElement("li");o.textContent=e;const i=n.current.reducedMotion??q();i||o.setAttribute("data-new",""),p.appendChild(o);const a=f,s=String(Math.max(0,p.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,f?.remove(),f=p=null,c?.(),c=null,d=null,t.replaceChildren(...Un(t)),u&&t.appendChild(u.canvas),m("idle"),u?.kick()},get state(){return o},get text(){return i}},()=>{c?.(),c=null,f?.remove(),f=p=null,t.removeAttribute("aria-busy"),i?t.textContent=i:t.replaceChildren(...r)})}function Xn(t,e){const n={current:{position:50,...e}},r=Y();let o=F(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=tt({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&&kn(t,i,0,0,e,n),!1)});const h="string"==typeof n.current.image?wn(n.current.image):n.current.image,f=t.querySelector('[role="slider"]'),p=t.querySelector("[data-compare-line]"),m=f??document.createElement("div"),g=p??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=F(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=F((t-s.at)/280);o=s.from+(s.to-s.from)*N(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){zn("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,p||(g.className="ascii-compare-line",g.setAttribute("aria-hidden","true")),f||(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),xn(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 et(()=>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()})}var Yn=t=>"string"==typeof t?{src:t}:t;function Jn(t,e){const n={current:{open:0,duration:280,label:"Images",...e}},r=Y(),o=n.current.images.map(Yn);let i=F(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=wn(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=tt({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?Sn(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 f=!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&&(f=!0),a}),h.forEach((e,n)=>{const r=d[n],i=B(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,kn(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*F(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&&(f=!0),f||(a=0),f}});const f=()=>{h.forEach((t,e)=>{t.setAttribute("aria-expanded",String(e===i)),t.tabIndex=e===i?0:-1})},p=(t,e=!1)=>{t=F(Math.round(t),0,h.length-1),e&&h[t]?.focus(),t!==i&&(i=t,s=performance.now(),f(),n.current.onChange?.(t),u?.kick())},m=h.map((t,e)=>{const n=()=>p(e),r=()=>{t.matches(":focus-visible")&&p(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(),p(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)}});zn("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)),f(),h.forEach((t,e)=>{const n=t.querySelector("img");n&&xn(n).then(t=>{c[e]=t,d[e]=u?Sn(t,!u.dark()):null,u?.kick()},()=>{})}),et(()=>u,n,e=>{r.set(t,"--ascii-acc-ms",`${e.duration}ms`),v||t.setAttribute("aria-label",e.label),u?.refresh()},{select:p,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()})}var Kn={maxBytes:10485760,develop:720};function _n(t,e={}){const n={current:{...Kn,...e}};let r="empty",o=null,i="",a="",s="image",l=0,c=0,d=!1,u=0,h=0,f=0,p=null,m=null,g=null;const v=J("",!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=tt({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:X(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:N(F((s-l)/n.current.develop));kn(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=f?Math.min(64,s-f):16;f=s;const p=d?1:0;h=c?p:h+(p-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 f=Math.abs(s)<.5?r:o>0&&s<-.5&&s>-1.5?.55*r*o:0,p=Math.round(255*Math.min(1,f));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]=p,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(p-h)>.004;return M||(f=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:p,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 $=async(t,e=null)=>{const n=++c;let d;a&&URL.revokeObjectURL(a),a="string"==typeof t?"":URL.createObjectURL(t),i=a||t,p=e??("undefined"!=typeof File&&t instanceof File?t:null),s=p?.name??("string"==typeof t&&t.split("/").pop()?.split("?")[0]||"image"),v.textContent=`Converting ${s}`;try{d=await xn(wn(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()}},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,i="",p=null,a&&URL.revokeObjectURL(a),a="",w?.remove(),S("empty"),v.textContent="",m?.kick()},z=()=>M.click(),R=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)}),I=()=>{f=0,m?.kick()},P=e=>{e.preventDefault(),u++,d||(d=!0,t.dataset.over="",I())},T=t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="copy")},W=()=>{u=Math.max(0,u-1),!u&&d&&(d=!1,delete t.dataset.over,I())},B=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):I()},O=t=>{const e=t.target?.closest?.("[data-dropzone]")?.getAttribute("data-dropzone");"pick"===e?z():"clear"===e?L():"download"===e&&R()},q=()=>{const t=M.files?.[0];M.value="",t&&E(t)};zn("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",P),t.addEventListener("dragover",T),t.addEventListener("dragleave",W),t.addEventListener("drop",B),t.addEventListener("click",O),M.addEventListener("change",q),et(()=>m,n,()=>m?.refresh(),{setImage:t=>$(t),clear:L,pick:z,download:R,get state(){return r}},()=>{c++,a&&URL.revokeObjectURL(a),t.removeEventListener("dragenter",P),t.removeEventListener("dragover",T),t.removeEventListener("dragleave",W),t.removeEventListener("drop",B),t.removeEventListener("click",O),M.removeEventListener("change",q),x.forEach(t=>t.remove()),delete t.dataset.asciiDropzone,delete t.dataset.state,delete t.dataset.over})}var Qn={duration:620,collapse:!0,remove:!1},Zn=16,tr=new WeakMap;function er(t,e={}){const n=tr.get(t);if(n)return n;const r={...Qn,...e},o=Y(),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},f=()=>{};const p=tt({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:Zn,resolution:2,ink:()=>r.ink??"--ascii-ink-strong",kit:{current:{lazy:!1,globalLook:r.globalLook}},reducedMotion:()=>r.reducedMotion,onFail:()=>f(),paint:({pen:t,now:e,still:n,scale:o})=>{if(n)return queueMicrotask(f),!1;if(!u||!d)return!1;const i=e-c,a=F(i/r.duration);t.setTransform(o,0,0,o,0,0),i>=300&&s(N(F((i-300)/260))),t.save(),t.globalAlpha=F(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,p=l-(1.3*a-.3)*h.w,m=l-1.3*a*h.w,g=t.createLinearGradient(m,0,Math.max(m+1,p),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-Zn,h.y-Zn,h.w+32,h.h+32),t.restore();const v=i>=Math.max(r.duration,r.collapse?560:0);return v&&queueMicrotask(f),!v}}),m=new Promise(e=>{let n=!1;if(f=()=>{n||(n=!0,p?.destroy(),s(1),r.remove&&t.remove(),tr.delete(t),e())},!p||p.still())return a(),void f();h=p.box(t),u=En(t,p.canvas.clientWidth||h.w+32,p.canvas.clientHeight||h.h+32,p.box).canvas;p.field.ready.then(()=>{n||d||(a(),d=!0,c=performance.now(),p.kick())},()=>{a(),f()})});return tr.set(t,m),m}var nr={threshold:88},rr=.3;function or(t,e){const n={current:{...nr,...e}},r=Y(),o=()=>n.current.content??t.children[0]??null,i=J("",!0),a={x:0,v:0,to:0};let s="idle",l=!1,c=!1,d=0,u=-1,h=0,f=0,p=0,m=!0,g=null,v=[];const y=new WeakSet,b=t=>{i.textContent=t};g=tt({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=p?Math.min(1/30,(i-p)/1e3):1/60;p=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-f<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=F(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:B((i-f)/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>=rr&&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=En(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),kn(r,Sn({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<rr?B(n/rr,3):1-B((n-rr)/.7,3),t.drawImage(o,r.x,r.y,r.w,r.h),t.globalAlpha=1,b=!0,!0}),b||(p=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,f=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",f=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=>{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()},E=()=>{if(l&&(l=!1,c)){if(c=!1,a.x>=n.current.threshold)return s="idle",void A();s="idle",a.to=0,M()}},L=t=>{c&&t.preventDefault()},z=t=>{l&&t.preventDefault()};return g?(r.set(t,"overscroll-behavior-y","contain"),t.appendChild(i),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(i),et(()=>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"),i.remove(),r.restore()})}var ir={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:" ⠁⠃⠇⡇⣇⣧⣷⣿"}},ar=(t,e,n,r)=>"number"==typeof t&&Number.isFinite(t)?Math.min(r,Math.max(n,t)):e;function sr(t){if(!t)return;if("dots"===t)return" ·∙•●";const e=ir[t];return e&&Object.prototype.hasOwnProperty.call(ir,t)?e.chars:t.startsWith(" ")?t:" "+t}function lr(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:ar(t.speed,e.speed,0,5),cellSize:ar(t.cellSize,e.cellSize,3,96),charset:sr(t.charset),cursor:t.cursor??e.cursor,clear:t.clear??!1,dither:ar(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(ar(n.current.opacity,n.current.preset.opacity??1,0,1)),d=()=>!!(n.current.reducedMotion??q()),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)};r=u(!1);return{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=_(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,z(n)}}}}var cr=(t,e)=>!1===t.cursor?"none":"string"==typeof t.cursor?t.cursor:e;function dr(t,e,n){let r=null;if(r=ae({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 ur=()=>"number"==typeof innerWidth&&innerWidth<760,hr=(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"}}),fr={light:"#8f8d86",dark:"#64625d"},pr={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=>dr(t,t=>({...hr(t,cr(t,"trail")),mark:"glyph",scale:ur()?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}}),fr)},mr={id:"halftone",name:"Halftone",description:"The drifting ground drawn as dots, clear around your content.",cellSize:14,speed:1,cursor:!0,mount:t=>dr(t,t=>({...hr(t,cr(t,"lantern")),mark:"dot",scale:ur()?1.8:1,cellSize:t.cellSize,cellAspect:1,dotScale:.64,trail:{strength:.9,radius:.4}}),fr)},gr={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=>dr(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:cr(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"})},vr=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,f=1-c;r[0]=(t[d]*h+t[d+3]*l)*f+(t[u]*h+t[u+3]*l)*c,r[1]=(t[d+1]*h+t[d+4]*l)*f+(t[u+1]*h+t[u+4]*l)*c,r[2]=(t[d+2]*h+t[d+5]*l)*f+(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,f=d-this.front[l+1]*e*u;this.read(this.front,h,f,this.advected);let p=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 f=Math.exp(-h/.0032),v=Math.hypot(t.dx*o,t.dy*i),y=Math.min(.025,.55*v);p+=(4.2*t.dx-n*y)*f,m+=(4.2*t.dy+e*y)*f,g=Math.max(g,Math.min(.7,18*v)*f);continue}const r=e*e+n*n;if(r>.045)continue;const a=Math.exp(-r/.0075),s=t.speed;p+=(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,p)),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(p),Math.abs(m),g)}[this.front,this.back]=[this.back,this.front],this.strokes.length=0,this.energy=a,this.active||this.clear()}};var yr=" .:+-=xICA$FY#@",br=.58,Mr=72649.5/59542.5;var xr={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 vr(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*br/26e3)))(t.settings().cellSize,e,n),d=tt({host:e,kit:t.kit,layer:"under",look:()=>{const n=t.settings();return{mark:"glyph",charset:n.charset??yr,font:'"JetBrains Mono", monospace',fontWeight:400,cellSize:c(e.clientWidth||1,e.clientHeight||1)/br,cellAspect:br,glyphScale:.9,cellFit:"fill",maxPixelRatio:1.5,color:"ink",shade:0,levels:"none",fit:"cover",gamma:1,contrast:Mr,brightness:-.0004316244699164449-.5/Math.max(1,Array.from(n.charset??yr).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*br)/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:f,now:p,still:m})=>{const g=t.settings(),v=i?Math.min(.05,(p-i)/1e3):1/60;i=p,m||(o+=v*g.speed);const y=h/f;if(Math.abs(y-r)>.01&&(n=new vr(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,f=u-.5-a[1],p=h+.22*Math.sin(5.2*f+.17*o)+.15*Math.sin(2.4*h-3.1*f-.1*o),m=f+.19*Math.sin(3.5*h+.13*o),g=Math.hypot(.8*p+.18,1.1*m),v=.5+.5*Math.sin(14*g-2.8*p+1.4*Math.sin(5*m)-.24*o),y=.5+.5*Math.sin(3.6*p-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()}}}},wr="#6f6d67",kr="#8f8d86",Sr={x:-1,y:-1,users:0},Ar=t=>{Sr.x=t.clientX,Sr.y=t.clientY};function Cr(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=Y();"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=X(r),d="";const u=()=>{d=G(t.ink(c),r,c?kr:wr)??kr;const e=t.settings().accent;l=e?G(e,r)??void 0:void 0};u();let h=0,f=!0,p=!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()??q()),$=()=>{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=K(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=e=>{if(h=0,m||p||!f||"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(E));const a=g?Math.min(.05,(e-g)/1e3):0;if(g=e,n||(M+=a*r.speed,x+=a),r.cursor&&Sr.x>=0){const t=o.getBoundingClientRect();t.width&&t.height&&(A.x+=.07*((Sr.x-t.left)/t.width-A.x),A.y+=.07*((Sr.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||p||!f||(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),a.setTransform(t,0,0,t,0,0),S=n,f&&!p&&$(),L()};z();const R="function"==typeof ResizeObserver?new ResizeObserver(z):null;R?.observe(r);const I="function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{f=t.isIntersecting,g=0,f?L():h&&(cancelAnimationFrame(h),h=0)},{rootMargin:"64px"}):null;I?.observe(r);const P=()=>{g=0,L()};document.addEventListener("visibilitychange",P);const T="function"==typeof matchMedia?matchMedia("(prefers-reduced-motion: reduce)"):null;T?.addEventListener?.("change",P),0===Sr.users++&&"function"==typeof addEventListener&&addEventListener("pointermove",Ar,{passive:!0});const F="object"==typeof document.fonts?document.fonts:null,W=()=>{m||!f||p||($(),L())};F?.addEventListener?.("loadingdone",W),F?.ready?.then(W,()=>{});let B=0;const O=()=>{B||m||(B=requestAnimationFrame(()=>{B=0,m||(c=X(r),u(),C()&&$(),L())}))},N="function"==typeof matchMedia?matchMedia("(prefers-color-scheme: dark)"):null;N?.addEventListener?.("change",O);const H="function"==typeof MutationObserver?new MutationObserver(O):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=X(r),u(),C()&&f&&!p&&$(),L())},play(){p&&(p=!1,g=0,L())},pause(){p=!0,h&&cancelAnimationFrame(h),h=0},destroy(){m||(m=!0,h&&cancelAnimationFrame(h),B&&cancelAnimationFrame(B),h=B=0,R?.disconnect(),I?.disconnect(),H?.disconnect(),document.removeEventListener("visibilitychange",P),T?.removeEventListener?.("change",P),N?.removeEventListener?.("change",O),F?.removeEventListener?.("loadingdone",W),0===--Sr.users&&"function"==typeof removeEventListener&&removeEventListener("pointermove",Ar),o.remove(),o.width=o.height=0,s.restore())}}}function $r(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 Er(t){return t*t*t*(t*(6*t-15)+10)}function Lr(t,e,n){return t+(e-t)*n}function zr(t,e){let n=127*t+311*e;return n^=n>>13,(n*(n*n*15731+789221)+1376312589&2147483647)/2147483647}function Rr(t,e){const n=Math.floor(t),r=Math.floor(e),o=e-r,i=Er(t-n),a=Er(o),s=zr(n,r),l=zr(n+1,r),c=zr(n,r+1),d=zr(n+1,r+1);return Lr(Lr(s,l,i),Lr(c,d,i),a)}function Ir(t,e){return(.5*Rr(t,e)+.25*Rr(2.1*t,2.1*e)+.125*Rr(4.3*t,4.3*e))/.875}var Pr='"Geist Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace';function Tr(t){const e=("function"==typeof t.getTransform?t.getTransform().a:1)||1;return t=>Math.round(t*e)/e}var Fr={r:111,g:109,b:103},Wr={r:143,g:141,b:134};function Br(t,e,n){return Math.min(1,Math.max(0,(t-e)/(n-e)))}function Or(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 qr(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 Hr={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=>Cr(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:f=.2,lightMode:p=!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 ${Pr}`,t.textBaseline="top";const M=p?Fr:Wr;let x=M.r,w=M.g,k=M.b;const S=Tr(t);if(l){const t=$r(l);t&&(x=t.r,w=t.g,k=t.b)}let A=x,C=w,$=k;const E=c?$r(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=zr(17*t,31*t+7),n=zr(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*zr(7*t,13*t+3))*(t%2==0?1:-1),amp:.55+.45*zr(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=f*Math.exp(-c*c/.06),p=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(p*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=Br(P,.48,.94);if(T<=0)continue;const F=m[qr(T,m.length,r,e,i.ditherStrength)];if(" "===F)continue;const W=!!E&&P>.86,B=Or(T);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:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};function Gr(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=$r(i.color??i.accentColor??"")??(i.lightMode?Fr:Wr),d=Tr(e),u=o*Math.max(0,i.speed??.35),h=n/r;e.clearRect(0,0,n,r),e.font=`${a}px ${Pr}`,e.textBaseline="top";const f=Array.from(i.chars||" .:-=+*#%@");for(let o=0;o<r;o+=l)for(let a=0;a<n;a+=s){const n=a/r,p=o/r,m=Br(Math.min(1,Math.max(0,t(n,p,h,u))),.06,.72);if(m<=0)continue;const g=f[qr(m,f.length,Math.round(a/s),Math.round(o/l),i.ditherStrength)];" "!==g&&(e.fillStyle=`rgba(${c.r},${c.g},${c.b},${Or(m)})`,e.fillText(g,d(a),d(o)))}}var Dr=(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)},jr={id:"caustics",name:"Caustics",description:"Fine pools of light that drift like water across stone.",cellSize:12,speed:1,cursor:!1,mount:t=>Cr(t,(t,e,n,r,o,i)=>Gr(Dr,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))},Ur=1,Vr=2,Xr=4,Yr=8,Jr={3:"─",12:"│",9:"┌",10:"┐",5:"└",6:"┘",11:"┬",7:"┴",13:"├",14:"┤",15:"┼",[Ur]:"╶",[Vr]:"╴",[Xr]:"╵",[Yr]:"╷"};var Kr={id:"circuit",name:"Circuit",description:"Circuit traces with signals running along them.",cellSize:13,speed:1,cursor:!1,mount:t=>Cr(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,f=Math.ceil(e/u),p=Math.ceil(n/h),m=$r(s)??{r:0,g:255,b:136},g=$r(a)??{r:255,g:255,b:255},v=(t,e)=>{if(zr(17*t+1,7*e+2)>l)return 0;let n=0;return t+1<f&&zr(17*t+1,7*e+2)>.15&&(n|=1),t-1>=0&&zr(17*(t-1)+1,7*e+2)>.15&&(n|=2),e+1<p&&zr(17*t+1,7*(e+1)+2)>.15&&(n|=8),e-1>=0&&zr(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<p;e++)for(let n=0;n<f;n++){const r=v(n,e);if(0===r)continue;const o=Jr[r]??"·",i=(8*y+40*zr(n,23*e))%f,a=(6*y+40*zr(17*e,11*n))%p,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*zr(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??V(i.ink,"#ffffff",.7)}))},_r=(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)},Qr={id:"contour",name:"Contour",description:"Fine topographic lines with a slow, rolling drift.",cellSize:12,speed:1,cursor:!1,mount:t=>Cr(t,(t,e,n,r,o,i)=>Gr(_r,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))};var Zr={id:"dna",name:"DNA",description:"Double helices scroll past with base-pair letters.",cellSize:13,speed:1,cursor:!1,mount:t=>Cr(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:f=!1}=o,p=.62*i,m=1.4*i,g=Math.ceil(e/p),v=Math.ceil(n/m),y=h??Math.max(1,Math.floor(e/80)),b=g/y,M=$r(l)??{r:0,g:229,b:255},x=$r(c)??{r:255,g:64,b:129},w=$r(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=zr(31*e+7*r,3),h=a[Math.floor(u*a.length)],f=.5*(Math.sin(o)+1),y=.5*(Math.sin(o+Math.PI)+1);if(t.globalAlpha=.35+.65*f,t.fillStyle=`rgb(${M.r},${M.g},${M.b})`,t.fillText(h,c*p,r*m),d>=0&&d<g){const n=zr(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*p,r*m)}if(r%3==0){const n=Math.min(c,d),o=Math.max(c,d);if(o-n>1){const i=zr(17*r+43*e,5),a=s[Math.floor(i*s.length)],l=.25*(f+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*p,r*m)}}}}t.globalAlpha=1}(t,e,n,r,{fontSize:i.fontSize,color:i.ink,color2:i.accent??V(i.ink,"#ffffff",.55),bridgeColor:V(i.ink,"#0c0d0b",.35)}))},to=(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},eo={id:"dune",name:"Dune",description:"Layered sand ridges with slow-moving light and fine grain.",cellSize:12,speed:1,cursor:!1,mount:t=>Cr(t,(t,e,n,r,o,i)=>Gr(to,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))},no=(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))},ro={id:"etch",name:"Etch",description:"Cut-grain lines follow a slow, sculpted current.",cellSize:12,speed:1,cursor:!1,mount:t=>Cr(t,(t,e,n,r,o,i)=>Gr(no,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))},oo=(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)},io={id:"facet",name:"Facet",description:"Quiet folded planes catch light along their edges.",cellSize:12,speed:1,cursor:!1,mount:t=>Cr(t,(t,e,n,r,o,i)=>Gr(oo,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))};var ao={id:"fire",name:"Fire",description:"A cellular flame rising from the bottom edge.",cellSize:13,speed:1,cursor:!1,mount:t=>Cr(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,f=.62*i,p=1.4*i,m=Math.ceil(e/f),g=Math.ceil(n/p),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=$r(s)??{r:255,g:69,b:0},$=$r(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+($.r-C.r)*i|0,l=C.g+($.g-C.g)*i|0,c=C.b+($.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*f,e*p)}t.globalAlpha=1}(t,e,n,i.elapsed,{fontSize:i.fontSize,chars:i.chars,color:i.ink,hotColor:i.accent??V(i.ink,"#ffffff",.6),speed:i.speed}),48)};var so={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=>Cr(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:f=!0,lightMode:p=!1}=i,m=l??(p?"#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(p&&(M=55,x=55,w=55),c){const t=$r(c);t&&(M=t.r,x=t.g,w=t.b)}let k=212,S=255,A=0;const C=$r(m);C&&(k=C.r,S=C.g,A=C.b);const $=r*u;for(let e=0;e<b;e++)for(let n=0;n<y;n++){const r=e/b,i=((r*d-.5*$)%1+1)%1,a=Math.max(0,1-i/h),l=.35*(.5*zr(3*n,7*e)+.5);let c=0;if(f){const t=n/y-o.x,i=r-o.y,a=Math.sqrt(t*t+i*i);if(a<.18){const t=zr(11*n+Math.floor(12*$),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,E=p?.82*u:.12*u;t.fillStyle=C?`rgba(${k},${S},${A},${p?.92:.28})`:`rgba(${M},${x},${w},${E})`,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}))},lo=(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)},co={id:"moire",name:"Moiré",description:"Two fine line fields overlap into broad, shifting bands.",cellSize:12,speed:1,cursor:!1,mount:t=>Cr(t,(t,e,n,r,o,i)=>Gr(lo,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))};var uo={id:"morph",name:"Morph",description:"Every cell shimmers at its own frequencies.",cellSize:14,speed:1,cursor:!1,mount:t=>Cr(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"),f=.62*i,p=1.4*i,m=Math.ceil(e/f),g=Math.ceil(n/p);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=$r(s);t&&(v=t.r,y=t.g,b=t.b)}let M=212,x=255,w=0;const k=$r(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*zr(n*(t+3)+7,e*(t+5)+11),i=zr(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*f,e*p)}}(t,e,n,r,{fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};var ho={id:"noise",name:"Noise",description:"A slow fractal noise field that warps around the cursor.",cellSize:13,speed:.5,cursor:!0,mount:t=>Cr(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:f=.9,mouseWarp:p=.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 ${Pr}`,t.textBaseline="top";const x=m?Fr:Wr;let w=x.r,k=x.g,S=x.b;const A=Tr(t);if(c){const t=$r(c);t&&(w=t.r,k=t.g,S=t.b)}let C=w,$=k,E=S;const L=l?$r(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)),P=(t,e)=>{let n=0,r=.5,o=1,i=0;for(let a=0;a<I;a++)n+=Rr(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=p>0?.12*Math.max(0,1-c/p):0,u=Br(.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[qr(u,g.length,n,e,i.ditherStrength)];if(" "===h)continue;const m=!!L&&u>f,x=Or(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 fo={id:"pulse",name:"Pulse",description:"Rings of characters ripple out from the cursor.",cellSize:14,speed:1,cursor:!0,mount:t=>Cr(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:f=!1}=i,p=l??(f?"#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(f&&(y=55,b=55,M=55),c){const t=$r(c);t&&(y=t.r,b=t.g,M=t.b)}let x=0,w=255,k=204;const S=$r(p);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),$=Math.ceil(n/a);for(let e=0;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 p=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)));p+=Math.cos(o*Math.PI*.5)*o}if(p=Math.min(1,p),p<.02)continue;const S=p>.6;t.font=`${a}px monospace`;const C=Math.floor(p*(A.length-1)),$=A[Math.min(C,A.length-1)],E=f?.88*p:.22*p;t.fillStyle=S?`rgba(${x},${w},${k},${Math.min(f?.95:.4,.55*p)})`:`rgba(${y},${b},${M},${E})`,t.fillText($,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 po={id:"rain",name:"Rain",description:"Columns of falling characters with bright heads.",cellSize:13,speed:1,cursor:!1,mount:t=>Cr(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,f=s??(h?"#6b8700":"#d4ff00"),p=.62*i,m=1.4*i,g=Math.ceil(e/p),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=$r(l);t&&(y=t.r,b=t.g,M=t.b)}let x=212,w=255,k=0;const S=$r(f);S&&(x=S.r,w=S.g,k=S.b);const A=v+u;for(let e=0;e<g;e++){if(zr(17*e,3)>d)continue;const n=(.5+1.5*zr(31*e,7))*c,o=zr(13*e,11)*A,i=Math.floor((r*n*7+o)%A),s=e*p;for(let n=0;n<=u;n++){const o=i-(u-n);if(o<0||o>=v)continue;const l=o*m,c=zr(53*e+Math.floor(5*r+n),7*o),d=a[Math.floor(c*a.length)],f=n/u;if(n===u)t.fillStyle=`rgba(${x},${w},${k},${h?.7:.85})`;else{const e=h?.85*f:.15*f;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 mo={id:"silk",name:"Silk",description:"Long ribbons that follow a slow flow field.",cellSize:13,speed:1,cursor:!1,mount:t=>Cr(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,f=1.3*i,p=Math.ceil(e/h),m=Math.ceil(n/f);t.clearRect(0,0,e,n),t.font=`${i}px ${Pr}`,t.textBaseline="top";const g=u?Fr:Wr;let v=g.r,y=g.g,b=g.b;const M=Tr(t);if(a){const t=$r(a);t&&(v=t.r,y=t.g,b=t.b)}let x=v,w=y,k=b;const S=s?$r(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<p;r++){const i=r/p;let a=0,s=0;for(let t=0;t<c;t++){const e=zr(13*t,7*t+3),r=1.1+2.4*e,o=.9+2*zr(29*t,11*t+1),l=e*Math.PI*6,c=(.2+.5*zr(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),f=Math.sin(i*o*Math.PI*d+n*r*Math.PI*d+A*c*.4);a+=Math.atan2(h+.3*f,u),s+=.5*(u*h+1)}const l=a/c,u=Br(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===qr(u,2,r,e,o.ditherStrength))continue;const E=C?C[qr(u,C.length,r,e,o.ditherStrength)]:$[g];if(" "===E)continue;const L=!!S&&u>.85,z=Or(u);t.fillStyle=L?`rgba(${x},${w},${k},${z})`:`rgba(${v},${y},${b},${z})`,t.fillText(E,M(r*h),M(e*f))}}}(t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};var go={id:"stars",name:"Stars",description:"A sparse starfield that twinkles, drifts and leans toward the cursor.",cellSize:14,speed:1,cursor:!0,mount:t=>Cr(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,f=l??(h?"#6b8700":"#d4ff00");t.clearRect(0,0,e,n),t.textBaseline="middle",t.textAlign="center";const p=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=$r(c);t&&(v=t.r,y=t.g,b=t.b)}let M=212,x=255,w=0;const k=$r(f);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=zr(17*o,3)*Math.PI*2,s=(r*(.15+.85*zr(31*o,7))*d*.22+zr(13*o,11))%1,l=p+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 f=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(f,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 vo={id:"terrain",name:"Terrain",description:"A side-scrolling landscape drawn in density characters.",cellSize:13,speed:1,cursor:!1,mount:t=>Cr(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:f=!0,lightMode:p=!1}=o,m=.62*i,g=1.4*i,v=Math.ceil(e/m),y=Math.ceil(n/g),b=$r(s)??{r:76,g:175,b:80},M=$r(l)??{r:26,g:35,b:126},x=$r(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*Ir((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(f){const o=zr(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??V(i.ink,"#ffffff",.65),skyColor:V(i.ink,"#0c0d0b",.55)}))},yo=(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))},bo={id:"veil",name:"Veil",description:"Tall folds of light drifting across a quiet ground.",cellSize:12,speed:1,cursor:!1,mount:t=>Cr(t,(t,e,n,r,o,i)=>Gr(yo,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))};var Mo={id:"void",name:"Void",description:"A gravity well that spirals characters around the cursor.",cellSize:13,speed:1,cursor:!0,mount:t=>Cr(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:f=!1}=i,p=c??(f?"#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(f&&(M=55,x=55,w=55),l){const t=$r(l);t&&(M=t.r,x=t.g,w=t.b)}let k=212,S=255,A=0;const C=$r(p);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 i=(r/v-o.x)*b,a=n-o.y,l=Math.sqrt(i*i+a*a)/u;if(l>1){const n=zr(3*r,7*e)*Math.max(0,1-3*(l-1));if(n<.62)continue;const o=n*(f?.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*$)))/.07),d=Math.pow(1-l,2.2),h=Math.min(1,d+.6*c);if(h<.06)continue;const p=Math.floor(h*(s.length-1)),y=s[Math.min(s.length-1,p)],C=c>.35||l<.08,E=f?.85*h:.18*h;t.fillStyle=C?`rgba(${k},${S},${A},${f?.95:.38})`:`rgba(${M},${x},${w},${E})`,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 xo={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=>Cr(t,(t,e,n,r,o,i)=>{const[a,s,l]=U(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:f=.4,mouseFalloff:p=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,$=u?$r(u):null;t.clearRect(0,0,e,n),t.font=`${a}px ${Pr}`;const E=Tr(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*Ir(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-f)+(Math.max(0,1-y*p)+.5*R)*f+.15*R,P=Math.min(1,Math.max(0,I));let T=P;if(v&&P>.72){const t=Math.floor(8*L),r=zr(7*n+3*t,11*e+t);r>.88&&(T=Math.min(1,P+4*(r-.88)))}const F=Br(T,.32,.9);if(F<=0)continue;const W=qr(F,M.length,n,e,i.ditherStrength);if(" "===M[W])continue;const B=Or(F);t.fillStyle=$&&T>h?`rgba(${$.r},${$.g},${$.b},${B})`:d?d.replace("{a}",String(B)):b?`rgba(111,109,103,${B})`:`rgba(143,141,134,${B})`,t.fillText(M[W],E(n*x),E(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})})},wo=(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))},ko={id:"weave",name:"Weave",description:"Interlaced threads with a subtle change in tension.",cellSize:12,speed:1,cursor:!1,mount:t=>Cr(t,(t,e,n,r,o,i)=>Gr(wo,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))};export{nt as BEAM_PALETTES,Ut as PILL_TONES,$e as VOICE_PALETTES,Jn as accordion,ke as artPanel,we as asciiVideo,Hr as aurora,lr as background,sr as backgroundCharset,pt as beam,ct as beamPalette,sn as blockChart,St as buttonLoading,jr as caustics,Kr as circuit,Mn as codeInput,Ge as commandPalette,Xn as compare,Qr as contour,vt as decode,er as disintegrate,Zr as dna,pr as drift,_n as dropzone,eo as dune,ro as etch,io as facet,ye as fieldBackground,ao as fire,xr as fluid,b as getFieldBudget,s as getGlobalLook,so as grid,mr as halftone,oe as imageGenerate,rn as likeBurst,co as moire,uo as morph,Cr as mountCanvas,tt as mountSurface,ho as noise,Mt as odometer,un as pageDissolve,Qt as pill,Ce as pricingGlow,or as pullRefresh,fo as pulse,po as rain,G as resolveColor,y as setFieldBudget,a as setGlobalLook,mo as silk,Dt as skeleton,_e as slideToConfirm,go as stars,Nt as statusOrb,Vn as streamText,l as subscribeGlobalLook,gn as swipeDeck,te as tabs,vo as terrain,Hn as thinking,Bn as toastStack,bo as veil,Re as voiceOrb,Mo as voidWell,xo as wave,ko as weave,gr as wordField,Me as wordmark};//# sourceMappingURL=kit.js.map
1
+ import{isGlyphFieldSupported as t,mountGlyphField as e}from"./field.js";var n=/\p{L}/u,r=null,o=new Set,i=new Set;function a(t){r=t?{...t}:null;for(const t of i)t.relook();for(const t of[...o])t(r)}var s=()=>r;function l(t){return o.add(t),()=>{o.delete(t)}}var c=12,d=new Set,u=null,h=null,f=0,p=-1e9,m=0,g=!1,v=!1;function y(t){c=Number.isFinite(t)&&t>=1?Math.floor(t):12,C()}var b=()=>c,M=()=>"undefined"!=typeof performance?performance.now():Date.now(),x=()=>"number"==typeof innerHeight?innerHeight:0;function w(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-x();return n>0?n:0}function k(t,e){if(t.eager)return void(t.wanted=!0);const n=x(),r=w(t.host,e);!n||r<=.5*n?t.wanted=!0:r>1*n&&(t.wanted=!1)}function S(t){let e=!1;for(const n of t)if(n?.target)for(const t of d)t.host===n.target&&(k(t,n.boundingClientRect??void 0),e=!0);e&&C()}function A(t){h!==t.doc&&(h=t.doc,d.clear(),f=m=0),d.add(t);const e=function(){const t="function"==typeof IntersectionObserver?IntersectionObserver:null;if(!t)return null;if(u?.ctor!==t){u?.list.forEach(t=>t.disconnect()),u={ctor:t,list:["50% 0px","100% 0px","0px"].map(e=>new t(S,{rootMargin:e}))};for(const t of d)u.list.forEach(e=>e.observe(t.host))}return u.list}();e?.forEach(e=>e.observe(t.host)),e?k(t):t.wanted=!0,C()}function C(t=!1){if(g)v=!0;else{g=!0;try{do{v=!1;const e=M();(t||e-p>16||e<p)&&(p=e,m=0);for(const t of d)t.live&&!t.wanted&&t.release();const n=[...d].filter(t=>t.live),r=()=>n.filter(t=>t.live).map(t=>[t,w(t.host)+(t.eager?0:1e9)]).sort((t,e)=>e[1]-t[1]);for(let t=n.length-c,e=t>0?r():[];t>0;t--)e.shift()?.[0].release();const o=[...d].filter(t=>t.wanted&&!t.live).map(t=>[t,t.eager?-1:w(t.host)]).sort((t,e)=>t[1]-e[1]);let i=0;for(const[e,a]of o){if(!d.has(e)||e.live)continue;if(!e.eager&&m>=4&&(!t||i)){f||(f=requestAnimationFrame(()=>{f=0,C(!0)}));break}if(n.filter(t=>t.live).length>=c){const t=r()[0]?.[0];if(!t||!e.eager&&(t.eager||w(t.host)<=a))break;t.release()}const o=M();e.mount(),m+=M()-o,i++,e.live&&n.push(e)}}while(v)}finally{g=!1}}}var $=new WeakMap,E=new WeakMap;function L(t,e){const n=E.get(t);n&&n.getAttribute("src")!==e&&(n.src=e)}function z(t){$.get(t)?.(),$.delete(t)}var R=()=>"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches;function I(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${R()?"":";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 $.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"))}),E.set(r,i),{show(t){i.style.opacity=t?"1":"0"},remove:()=>z(r)}}function P(t){const{host:o,kit:a}=t;let s,l=t.canvas,c=null,h=!1,f=!1,p=!1,m=!1,g={},v={},y=t.source,b=!1,M={},x=null,w=null,k=!1,S=null;const $=!t.ownPoster&&a?.current.poster?I(o,a.current.poster,t.place,a,l):null,E=()=>{const t=v.charset,e=!1!==a?.current.globalLook&&"glyph"===(v.mark??"glyph")&&!n.test(t??"")&&r?.charset?r.charset:void 0;return e?e===s?null:(s=e,{charset:e}):void 0===s?null:(s=void 0,{charset:t??" .,:-=+*#%@"})},L={host:o,doc:document,eager:!1===a?.current.lazy,wanted:!1,live:!1,mount(){if(f||c)return;h&&(l=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}(l)),h=!0,v={...t.options(),...g},s=void 0;const n=E();let r;try{r=e(l,{...v,...n,...void 0===y?{}:{source:y},onError:()=>{c===r&&z()}})}catch{return void z()}c=r,L.live=!0,b&&r.pause(),r.ready.then(()=>{c===r&&(k=!0,$?.show(!1),x?.(),x=w=null)},()=>{}),t.onMount?.(r,l)},release(){if(!c)return;const e=c;c=null,L.live=!1,k=!1,S?.clear(),S=null,M=e.settings,e.destroy(),(t=>{try{t.getContext("webgl2")?.getExtension("WEBGL_lose_context")?.loseContext()}catch{}})(l),$?.show(!0),t.onRelease?.()}};function z(){p||(p=!0,P(),m||t.onFail())}function P(){f||(f=!0,L.release(),function(t){d.delete(t)&&([...d].some(e=>e.host===t.host)||u?.list.forEach(e=>e.unobserve(t.host)),!d.size&&u&&(u.list.forEach(t=>t.disconnect()),u=null),C())}(L),i.delete(T),l.remove(),p?$?.show(!0):$?.remove())}const T={relook(){const e=E();if(!e||!c)return;const n=c,r=k&&!(a?.current.reducedMotion??R());S?.clear(),S=null,r&&(n.redraw(),S=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}}}(l,t.place)),n.update(e);const o=S;o&&requestAnimationFrame(()=>requestAnimationFrame(()=>{S===o&&c===n?o.reveal():o.clear()}))}};return{field:{get canvas(){return l},get ready(){return c?c.ready:w??(w=new Promise(t=>{x=t}))},get settings(){return c?.settings??M},update(t){if(g={...g,...t},v={...v,...t},!c)return;const e=E();c.update(void 0!==s?{...t,charset:s}:e?{...t,...e}:t)},setSource:t=>(y=t,c?c.setSource(t):Promise.resolve()),pointer(t,e){c?.pointer(t,e)},redraw(){c?.redraw()},pulse(t){c?.pulse(t)},play(){b=!1,c?.play()},pause(){b=!0,c?.pause()},resize(){c?.resize()},destroy(){P()}},get canvas(){return l},get live(){return!!c},get failed(){return p},start(){i.add(T),m=!0;try{A(L)}finally{m=!1}},destroy:P}}var T,F=(t,e=0,n=1)=>Math.min(n,Math.max(e,t)),W=(t,e)=>{const n=43758.5453*Math.sin(127.1*t+311.7*e);return n-Math.floor(n)},B=(t,e=3)=>1-(1-F(t))**e,O=(t,e,n)=>{const r=F((n-t)/(e-t));return r*r*(3-2*r)},N=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)},q=()=>"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,H={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 G(t,e,n){let r=(t??"").trim();const o=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/.exec(r);if(o?r=D(e,o[1])||(o[2]??"").trim():r.startsWith("--")&&(r=D(e,r)),!r)return n?G(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 j([+i[1],+i[2],+i[3]]);if(void 0===T)try{T="undefined"==typeof document?null:Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0})}catch{T=null}if(!T)return n?G(n,e):null;T.clearRect(0,0,1,1),T.fillStyle="#000",T.fillStyle=r,T.fillRect(0,0,1,1);const[a,s,l]=T.getImageData(0,0,1,1).data;return j([a,s,l])}var D=(t,e)=>"function"==typeof getComputedStyle?getComputedStyle(t).getPropertyValue(e).trim():"",j=t=>`#${t.map(t=>Math.round(F(t,0,255)).toString(16).padStart(2,"0")).join("")}`,U=t=>{const e=parseInt(t.slice(1,7),16);return[e>>16&255,e>>8&255,255&e]},V=(t,e,n)=>{const r=U(t),o=U(e);return j(r.map((t,e)=>t+(o[e]-t)*n))};function X(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=G(e?.color??"",t);if(!r)return"function"==typeof matchMedia&&matchMedia("(prefers-color-scheme: dark)").matches;const[o,i,a]=U(r);return.2126*o+.7152*i+.0722*a>140}function Y(){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 J(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 K(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 _(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 Q=new WeakMap,Z=t=>Q.get(t)?.()??null;function tt(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())return i?.current.poster&&I(n,i.current.poster,a,i),null;const s=Y(),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 f=X(n);const p=()=>G(e.ink(f),n,f?"#d8d6cf":"#1d1d1b")??"#888888";let m=0,g=!1,v=!0,y=!1;const b=P({host:n,canvas:l,kit:i,place:a,options:()=>({...H,...e.look(),ink:p(),interactionTarget:n,label:""}),onMount:(t,e)=>{Q.set(e,S),e.removeAttribute("role"),e.removeAttribute("aria-label"),t.ready.then(C,()=>{}),C()},onRelease:()=>{m&&cancelAnimationFrame(m),m=0},onFail:()=>{B(),e.onFail?.()}}),M=b.field;h();const x=()=>!!(e.reducedMotion()??q()),w=t=>K(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:f,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:f,box:w})}catch{return null}return c}Q.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 C(){m||y||g||!b.live||(m=requestAnimationFrame(A))}const $="function"==typeof ResizeObserver?new ResizeObserver(()=>{h(),M.resize(),!b.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 L=()=>{document.hidden||C()};document.addEventListener("visibilitychange",L);let z=0;const R=()=>{z||y||(z=requestAnimationFrame(()=>{z=0,y||(f=X(n),M.update({ink:p()}),e.onTheme?.(),C())}))},T="function"==typeof matchMedia?matchMedia("(prefers-color-scheme: dark)"):null;T?.addEventListener?.("change",R);const F="function"==typeof matchMedia?matchMedia("(prefers-reduced-motion: reduce)"):null;F?.addEventListener?.("change",C);const W="function"==typeof MutationObserver?new MutationObserver(R):null;for(const t of[document.documentElement,document.body])t&&W?.observe(t,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]});function B(){y||(y=!0,m&&cancelAnimationFrame(m),z&&cancelAnimationFrame(z),m=z=0,$?.disconnect(),E?.disconnect(),W?.disconnect(),document.removeEventListener("visibilitychange",L),T?.removeEventListener?.("change",R),F?.removeEventListener?.("change",C),b.destroy(),s.restore(),c.width=c.height=1)}return b.start(),b.failed?(B(),null):{field:M,get canvas(){return b.canvas},get live(){return b.live},kick:C,refresh(){y||(f=X(n),M.update({...H,...e.look(),ink:p()}),C())},still:x,dark:()=>f,box:w,play(){g&&(g=!1,M.play(),C())},pause(){g=!0,m&&cancelAnimationFrame(m),m=0,M.pause()},destroy:B}}function et(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=_(e.current,t);const r=t.poster;r&&L(e,r),n(e.current)},play(){i||t()?.play()},pause(){i||t()?.pause()},destroy(){i||(i=!0,t()?.destroy(),z(e),o())}};return Object.defineProperties(r,Object.getOwnPropertyDescriptors(a))}var nt={colorful:["#22c55e","#06b6d4","#6366f1","#d946ef","#f43f5e","#f59e0b"],mono:["#ffffff"],ocean:["#22d3ee","#3b82f6","#2dd4bf","#818cf8"],sunset:["#f97316","#f43f5e","#ec4899","#fbbf24"]},rt={palette:"colorful",mode:"rotate",grain:"dots",speed:1,hover:!0,depth:18},ot=["rotate","pulse","progress"],it=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)},at=(t,e,n)=>t.map((t,r)=>t+(e[r]-t)*n),st=it("#ff4a4a"),lt=it("#2fd67b");function ct(t){const e=("string"==typeof t?nt[t]??nt.colorful:t.length?t:nt.colorful).map(it),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]:at(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 dt=(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)},ut=t=>Math.max(dt(t,.3),.75*dt(t-.5,.22)),ht=(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,ft=(t,e)=>F((t-.68*e)/.07);function pt(t,e={}){const n={current:{...rt,...e}};let r="idle",o=0,i=ct(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),f="",p=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=tt({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),I=Math.min(t.clientWidth||c,t.clientHeight||C),P=Math.max(2,Math.min(z.depth,Math.min(parseFloat(R.paddingTop)||z.depth,parseFloat(R.paddingLeft)||z.depth)-2)),T=[R.borderTopLeftRadius,R.borderTopRightRadius,R.borderBottomRightRadius,R.borderBottomLeftRadius].map(t=>((t,e)=>t.endsWith("%")?parseFloat(t)/100*e:parseFloat(t)||0)(t??"",I)),B=l(),N="dot"!==B.mark,q=B.cellSize??(N?5:3.5),H=B.cellAspect??(N?.6:1),G=`${c}x${C}:${z.grain}:${P}:${T.join(",")}:${q}:${H}`;if(G!==f){f=G,A.canvas.style.clipPath=`inset(0 round ${T.map(t=>`${t}px`).join(" ")})`;const t=Math.min(globalThis.devicePixelRatio||1,B.maxPixelRatio??2),e=Math.max(2,Math.round(q*t)),n=Math.max(2,Math.round(e*H))/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,f,p]=[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:p:i<0?h:f,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*W(Math.floor(46*S),5)+.22*W(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,P,T,N?Math.min(n,r)/2:(B.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=F(D.weight[a]*t(s,a))*(L?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],f=i[c+2],p=i[c+3];const m=o&&L?o(s):0;(r>0||n>0||m>0)&&(r>0&&(d+=(lt[0]-d)*r,u+=(lt[1]-u)*r,f+=(lt[2]-f)*r),n>0&&(d+=(st[0]-d)*n,u+=(st[1]-u)*n,f+=(st[2]-f)*n),m>0&&(d+=(1-d)*m,u+=(1-u)*m,f+=(1-f)*m),p=.2126*d+.7152*u+.0722*f);const g=255*Math.min(1,(l+.12)/2.4/Math.max(p,.01));h[3*a]=d*g,h[3*a+1]=u*g,h[3*a+2]=f*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?ht(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)*ft(U[n],1),0,.9,0):V(t,0,0,0),!1}const X=p?Math.min(48,$-p):16;p=$,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,K="error"===r,_="success"===r,Q=z.hover&&a;for(const t of ot)S[t]+=((t===z.mode?1:0)-S[t])*(1-Math.exp(-X/260));if(K)b=0;else{const t=(J?1500-500*o:"pulse"===z.mode?9e3:2600)/Math.max(.05,z.speed);b+=(1/t*(Q?1.35:1)-b)*(1-Math.exp(-X/320)),v+=b*X,k+=X,y+=X/("pulse"===z.mode?14e3:26e3)*(1-S.progress),(J||_)&&(w+=((_?1:o)-w)*(1-Math.exp(-X/110)))}M+=((Q?1:0)-M)*(1-Math.exp(-X/220)),x=K?.9*O(0,60,Y):x*Math.exp(-X/180);const Z=1+.22*M,tt=.32+.68*(.5-.5*Math.cos(2*Math.PI*k/2400)),et=.05+.1*(.5-.5*Math.cos(2*Math.PI*k/5200)),nt=J||_||K,rt=t=>Z*(S.rotate*ut(t-v)+S.pulse*(J||K?ut(t-v):tt*(.78+.22*Math.cos(2*Math.PI*(t-v))))+S.progress*(nt?ht(t,w):et));if(_){const t=O(0,260,Y),e=F((Y-240)/620),n=1-O(860,1060,Y),r=O(780,1e3,Y),o=O(1350,2450,Y),i=(L?.86:.55)*t*(1-r)+.62*r*(1-o),a=1-t*(1-O(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(rt(t)*a,i*(.9+.1*Math.cos(2*Math.PI*(t-.1))),1.3*s(t),S.progress*et*o),y,0,.9*r*(1-o),t=>F(.8*s(t))),!0}if(K){const t=Y<90?1.2:Y<170?.1:Y<260?1.2:Y<340?.1:1,e=O(380,1150,Y),n=1-.5*O(700,1500,Y),r=Math.floor(Y/50);return V((o,i)=>{const a=ft(U[i],e);return a<=0?0:rt(o)*t*a*n*(1-1.4*e*(1-e)*W(i,r))},y,x,0),Y<1600||Math.abs(M-(Q?1:0))>.01}return V(rt,y,x,0),!0}});const C=()=>{a||(a=!0,A?.kick())},$=()=>{a=!1,A?.kick()},E=t=>{a=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 et(()=>A,n,t=>{i=ct(t.palette),A?.refresh(),A&&c(A)},{progress(t){o=F(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",$)})}var mt={duration:800,trigger:"visible",replayOnHover:!0,settle:"glyphs"};function gt(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=W(n,r),l=W(n+1,r),c=W(n,r+1);return a+(l-a)*o+(c-a)*i+(a-l-c+W(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)}function vt(t,e={}){const n={current:{...mt,...e}},r=Y(),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=tt({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 f=n.current,p="text"===f.settle;if(a<0||d)return!(!c&&"visible"===f.trigger&&!d)&&(p&&a>=0||t.drawImage(o,0,0),a>=0&&h(),!1);const m=s-a,g=.3*f.duration,v=.7*f.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),gt(i,m/1e3),t.imageSmoothingEnabled=!0,m<g)return t.drawImage(i,0,0,e,r),l&&(t.globalAlpha=1-N(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 p||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)W(e+13*S,i)<n||(t.globalAlpha=.35+.65*W(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()},f=()=>{d&&(r.set(t,"-webkit-text-fill-color","transparent"),c=!0,a=performance.now(),d.kick())};let p=!1;const m=d&&"visible"===n.current.trigger&&"function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{t.isIntersecting&&!p&&f(),p=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&&f());let g=!1;const v=()=>{g||(g=!0,n.current.replayOnHover&&a<0&&f())},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()}),et(()=>d,n,()=>{s="",d?.refresh()},{replay:f},()=>{m?.disconnect(),t.removeEventListener("pointerenter",v),t.removeEventListener("pointermove",v),t.removeEventListener("pointerleave",y),document.removeEventListener("pointermove",b,!0),r.restore()})}var yt={value:0,duration:360,stagger:60,glyphs:"#%*+=-:",format:t=>t.toLocaleString(),face:"text"};function bt(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}function Mt(t,e={}){const n=parseFloat((t.textContent??"").replace(/[^\d.-]/g,"")),r={current:{...yt,...e,value:e.value??(Number.isFinite(n)?n:0)}},o=Y();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=J(a,!0),d=document.createElement("span"),u=()=>{d.replaceChildren(...[...a].map(t=>Object.assign(document.createElement("span"),{textContent:t}))),c.textContent=a};l=tt({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"),f=h.fontBoundingBoxAscent||.8*l,p=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-f-p)/2+f,$=k(g,a),E=b-a,L=!n&&b>=0&&E>=0&&/\d/.test($)?F((e-v)/(x.duration+E*x.stagger)):1,z=N(L),R=L<1&&!w?O(.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-O(.72,1,L);const I=5+2*E,P=[k(m,a),...Array.from({length:I},(t,e)=>x.glyphs[Math.floor(W(e+7*a,v)*x.glyphs.length)]??""),$];y||P.reverse();const T=(P.length-1)*A,B=y?z*T:T-z*T;t.save(),t.beginPath(),t.rect(d-s.w,h,2*s.w,A),t.clip(),P.forEach((e,n)=>{const r=C+n*A-B;if(r<h-A||r>h+2*A)return;const o=n>0&&n<P.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 f=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:bt(o,a),t0:performance.now()},u(),l.kick()):t.textContent=a};return et(()=>l,r,t=>{h(),t.value!==i?f(t.value):(a=t.format(i),u(),l?.refresh())},{set:f,get value(){return i}},()=>{l&&(t.textContent=a),o.restore()})}var xt={check:!0,shake:!0};function wt(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(W(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 kt="cubic-bezier(.16, 1, .3, 1)";function St(e,n={}){const r={current:{...xt,...n}},o=Y(),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,f=0,p=null,m={cw:9,ch:15,cellSize:15};const g=J(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(),p&&v.appendChild(p.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=p&&p.canvas.parentElement===v?p.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)}p&&!n&&v.appendChild(p.canvas),v.style.width=t.length*m.cw+"px",v.style.height=`${m.ch}px`,g.textContent=u,f=Math.max(f,e.offsetWidth),f&&o.set(e,"min-width",`${f}px`)},x="undefined"!=typeof document&&t();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()}p=x?tt({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:()=>{p=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:wt(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&&!p&&(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),p?(h=performance.now(),((t,e)=>{const n=e?"none":`opacity 160ms ${kt} ${t?120:0}ms, scale 240ms ${kt} ${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),p.still()),M(),p.kick(),"error"===t&&r.current.shake&&!p.still()&&"function"==typeof e.animate&&e.animate([{translate:"0"},{translate:"-4px 0"},{translate:"4px 0"},{translate:"-2px 0"},{translate:"0"}],{duration:280,easing:kt})):l||(i.textContent=n)};return et(()=>p,r,()=>{p&&(b(),M(),p.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}},()=>{p&&(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()})}var At={colourByState:!0,ring:!0},Ct={success:["--ascii-success","#17844a","#3ccf7e"],warning:["--ascii-warning","#9a6700","#f5b83d"],error:["--ascii-error","#c93636","#ff6b6b"]},$t=120,Et=280,Lt=520,zt=2*Math.PI,Rt=zt/1050,It=t=>1-(1-t)**4,Pt=t=>`rgb(${255*t} ${255*t} ${255*t})`,Tt=t=>t*Rt-Math.PI/2,Ft=(t,e=0)=>78+5*Math.sin(t/1600*zt)*(1-e);function Wt(t,e,n=78,r=24){t.strokeStyle=Pt(e),t.lineWidth=r,t.beginPath(),t.arc($t,$t,n,0,zt),t.stroke()}function Bt(t,e,n,r=0,o=1){if(Wt(t,(.3+(n-78)/100)*o,n,24-6*r),r>=1)return void Wt(t,.72*o,n,18);const i=3.4+(zt-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=Pt((l+(.72-l)*r)*o),t.lineWidth=28-6*s+(18-(28-6*s))*r,t.beginPath(),t.arc($t,$t,n,e-(s+1/32)*i,e-s*i),t.stroke()}}function Ot(t,e,n,r=800,o=0,i=!0){if("idle"===e)return void Wt(t,.34);if("loading"===e)return void Bt(t,Tt(n),Ft(n));const a=(t=>t<.5?4*t*t*t:1-(-2*t+2)**3/2)(Math.min(1,r/Et)),s=Math.min(r,Et),l=o+Rt*(s-s*s/560);i?Bt(t,l,Ft(n,a),a):a<1&&Bt(t,l,Ft(n,a),0,1-a);const c=(r-196)/Lt;i&&c>0&&c<1&&Wt(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([[$t,74],[$t,114]],Math.min(1,n/.7)),n>.7&&(t.fillStyle="#fff",t.beginPath(),t.arc($t,152,r/2*It((n-.7)/.3),0,zt),t.fill())):(o([[92,92],[148,148]],n),o([[148,92],[92,148]],n))}(t,e,It(Math.min(1,Math.max(0,(r-40)/260))),i?24:30)}function Nt(t,e={}){const n={current:{...At,...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=>G(n.current.ink??"--ascii-ink-strong",t,e?"#d8d6cf":"#1d1d1b"))(e);const[o,i,a]=Ct[r];return G(n.current.colors?.[r]??o,t,e?a:i)};d=tt({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:f})=>{const p=e-o;Ot(t,r,h?380:e,h?800:p,i,n.current.ring);const m=u(f);m!==s&&(a=s||m,s=m,l=e);const g=h?1:It(Math.min(1,(e-l)/200)),v=g<1?V(a,s,g):s;return v!==c&&(c=v,d?.field.update({ink:v})),"loading"===r||p<800||g<1}});const h=e=>{const n=performance.now();"loading"===r&&"loading"!==e&&(i=Tt(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 et(()=>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})}var qt={blocks:"[data-block]",shimmer:1600,resolve:420,stagger:60,develop:640},Ht=t=>`rgb(${255*t} ${255*t} ${255*t})`,Gt=(t,e,n)=>t<0?0:B((t-e)/n,3);function Dt(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"}function jt(t,e={}){const n={current:{...qt,...e}},r=Y();let o=0,i=null,a=null,s=null,l=null;const c=()=>[...t.querySelectorAll(n.current.blocks)].map((t,e)=>({el:t,kind:Dt(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"),a?.(),a=null};l=tt({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:a,box:s,w:l})=>{if(null!==i&&a)return u(),!1;const h=n.current,f=null===i?-1:e-i;if(null!==i&&f>Math.max(n.current.develop,...c().map(t=>t.delay+n.current.resolve))+16)return u(),!1;null!==i&&(t=>{for(const{el:e,kind:o,delay:i}of c()){const a=Gt(t,i,n.current.resolve);if(r.set(e,"opacity",String("text"===o?Math.min(1,1.6*a):a)),"text"===o){const t=128*a-14;for(const n of d)r.set(e,n,a>=1?"none":`linear-gradient(90deg, #000 ${t-14}%, transparent ${t+14}%)`)}}})(f);const p=a?.4:(e-o)/h.shimmer%1,m=Math.max(160,.45*l),g=-m+((v=Math.min(1,p/.72))<.5?4*v**3:1-(-2*v+2)**3/2)*(l+2*m);var v;const y=a?1:B((e-o)/280,3),b=t.createLinearGradient(g-m,0,g+m,.18*m);for(let t=0;t<=8;t++)b.addColorStop(t/8,Ht(.24+(.54-.24)*(.5-.5*Math.cos(t/8*Math.PI*2))));const M=(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=Gt(f,r,h.resolve);if(t.fillStyle=b,"photo"===n){const n=f<0?0:B(f/h.develop,4);t.globalAlpha=(1-c)*y,M(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(),M(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)*y,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=y*(1-c),M(r,n,o+a-r,e,e/2),t.fill()}t.globalAlpha=1}return!0}});const h=()=>{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: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(),et(()=>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,h()},get loading(){return null===i}},()=>{u()})}var Ut={tone:"neutral",live:!1,indicator:!0,sheen:!0},Vt={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]}},Xt={light:{charset:" .:+*"+"#".repeat(15),top:.32},dark:{charset:" .:+*"+"#".repeat(4),top:.9}},Yt=[[255,130,225],[205,175,255],[120,215,255]],Jt=(t,e,n)=>t.map((t,r)=>t+(e[r]-t)*n),Kt=(t,e)=>Math.exp(-((t/e)**2));function _t(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 Qt=(t,e)=>{return"green"===(n=t.dataset.tone)||"amber"===n||"red"===n||"neutral"===n||"new"===n?t.dataset.tone:e;var n};function Zt(t,e={}){const n={current:{...Ut,...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=Y(),s=new Map,l=new Map,c=new Map,d=new Map,u=[],h=t=>void 0!==t.dataset.count?"count":"new"===Qt(t,n.current.tone)?"new":"status",f=(t=-1e6)=>{for(const e of r){const r=Qt(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})}};f();const p=()=>m?.dark()??(!i||X(i))?"dark":"light";let m=null,g="";function v(){for(;u.length;)u.pop()();a.restore()}m=i?tt({host:i,layer:o?"under":"over",look:()=>({mark:"glyph",charset:Xt[p()].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:Xt[p()].charset}),paint:({pen:t,now:e,still:o,dark:i,box:a})=>{const u=n.current,f=i?"dark":"light",p={...Vt[f],...u.tones?.[f]},v=Xt[f].top,y=Math.min(2,globalThis.devicePixelRatio||1),b=Math.round(8*y)/y,M=Math.round(8*y*.6)/y,x=(t,e)=>_t(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:f,y:m,w:g}=w[i],v=h(r);if(!(g<=0)){if(t.save(),t.beginPath(),t.rect(f,m,g,b),t.clip(),"status"===v){const l=s.get(r),c=o?1:B((e-l.at)/240);c<1&&(S=!0);const d=Jt(p[l.from],p[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=f-12+B(n)*(g+24);for(let n=f;n<f+g;n+=2){const r=.42*Kt(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=f-20+B(n)*(g+40),r=Math.sin(Math.PI*Math.min(1,1.15*n));for(let n=f;n<f+g;n+=2){const o=(n-f)/g,i=o<.5?Jt(Yt[0],Yt[1],2*o):Jt(Yt[1],Yt[2],2*o-1),a=r*Kt(n-e,11);a>.2&&(t.fillStyle=_t(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=B((l-.72)/.28);i.style.opacity=String(c),i.style.translate=`0 ${3*(c-1)}px`,l<=0||l>=1||(t.fillStyle=x(p.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=J(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 et(()=>m,n,()=>{f(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:()=>{f(performance.now()),m?.kick()}},()=>{i?.removeEventListener("pointermove",w),i?.removeEventListener("pointerleave",k),v()})}var te={tabs:'[role="tab"]',duration:280,panels:"hidden",manage:!0};function ee(t,e={}){const n={current:{...te,...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;let l=null;l=tt({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),f=l(u),p=o?1:(e-s)/n.current.duration;if(p>=1){const e=f.x+1,n=f.y+1.5,r=f.w-2,o=f.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=B(n/.8),i=B((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,f,p),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*p),o=.25+.75*(r+(1-r)*n**1.6);for(let i=0;i<M;i+=6){if(W(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(),et(()=>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)})}var ne=280,re={preview:[{k:.5,blur:9},{k:.78,blur:4}],final:{k:1,blur:0}},oe=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};function ie(t,e={}){const n={current:{...e}},r=Y(),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:N(Math.min(1,Math.max(0,(t-d.at)/ne))),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}]},f=(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=tt({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 f=c&&!l?1+.12*Math.sin(2.1*u)*(.7+.3*Math.sin(.37*u)):1,p=Math.max(2,Math.ceil(24*r/Math.max(1,e)));24===o.width&&o.height===p||(o.width=24,o.height=p),gt(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*f})`,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<ne}});const p=(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?ne: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(),p("generating"),m(!1),f(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&&f(await oe(e.final),re.final.k,re.final.blur);break}if(!c){v(e.preview);continue}const t=re.preview[Math.min(l++,re.preview.length-1)];f(await oe(e.preview),t.k,t.blur)}if(await g(o?0:ne),!r())return i;p("done"),m(!0),c?.kick()}catch(t){if(!r())return i;f(null,0,12),await g(o?0:ne),p("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(),et(()=>c,n,()=>c?.refresh(),{run:y,reset(){s++,f(null,0,12),p("idle"),m(!1)},get state(){return i}},()=>{s++,l&&URL.revokeObjectURL(l),delete t.dataset.state,t.removeAttribute("aria-busy"),r.restore()})}var ae=t=>new Promise(e=>setTimeout(e,t));function se(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())return o?.current.poster&&!e.ownPoster&&I(n,o.current.poster,i,o),null;const a=Y(),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=X(n),c=!1;const d=()=>{const t=e.reducedMotion();return!0===t?{speed:0,drift:0,respectReducedMotion:!0}:{respectReducedMotion:!1!==t}},u=()=>G(e.ink(l),n,l?"#d8d6cf":"#1d1d1b")??"#888888",h=P({host:n,canvas:s,kit:o,place:i,ownPoster:e.ownPoster,source:e.source??null,options:()=>({...H,...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?.()}}),f=h.field;let p=0;const m=()=>{c||(l=X(n),f.update({...H,...e.look(l),...d(),ink:u()}))},g=()=>{p||c||(p=requestAnimationFrame(()=>{p=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,p&&cancelAnimationFrame(p),y?.disconnect(),v?.removeEventListener?.("change",g),h.destroy(),a.restore())}return h.start(),h.failed?(b(),null):{field:f,get canvas(){return h.canvas},get live(){return h.live},dark:()=>l,still:()=>!!(e.reducedMotion()??q()),refresh:m,destroy:b}}function le(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=_(e.current,r);const o=r.poster;o&&L(e,o),n(e.current),t()?.refresh()},play(){i||t()?.field.play()},pause(){i||t()?.field.pause()},destroy(){i||(i=!0,o(),t()?.destroy(),z(e))}};return Object.defineProperties(r,Object.getOwnPropertyDescriptors(a))}function ce(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 de(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 ue={preset:"hero",clear:!1,text:"404",ripple:!0},he=28,fe='600 440px "Geist", Arial, sans-serif',pe=()=>"number"==typeof innerWidth&&innerWidth<760,me=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}),ge={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 ve=[...Array.from({length:10},(t,e)=>(e+1)/10),1,1,1,...Array.from({length:14},(t,e)=>1-(e+1)/14)];function ye(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,he,he,e.x+e.dx*i,e.y+e.dy*i,he,he)}o.globalAlpha=1}function be(t,e={}){const n={current:{...ue,...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=fe;const n=Math.max(320,Math.ceil(e.measureText(t).width)+160),{canvas:r,pen:o}=ce(n,560);return o.fillStyle="#fff",o.textAlign="center",o.textBaseline="middle",o.font=fe,o.letterSpacing="-10px",o.fillText(t,n/2,296),r}(n.current.text);let c=null;c=se({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?ge:"brand"===t.preset?me({scale:pe()?1.4:1.6,brightness:.24,contrast:1.1,clear:r(.3)}):me({scale:pe()?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?.(fe).then(()=>{c&&r()&&!i&&c.field.setSource(l())},()=>{});const d=(t,e=1.4)=>{c&&!c.still()&&(a=performance.now()+1400,de(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}),de(c.field,{x:t.clientX,y:t.clientY},.65))};c&&t.addEventListener("pointermove",u);let h=n.current.preset,f=n.current.text;return le(()=>c,n,t=>{c&&((t.preset!==h||"notFound"===t.preset&&t.text!==f)&&(o++,i=!1,c.field.setSource("notFound"===t.preset?l():null)),h=t.preset,f=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+=he)for(let o=0;o<t.width;o+=he){let i=!1;for(let n=0;n<he&&!i;n+=4)for(let a=0;a<he&&!i;a+=4)i=(e[4*((r+n)*t.width+o+a)]??0)>40;if(!i)continue;const a=n.length,s=W(a,1)*Math.PI*2,l=120+420*W(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*W(a,3)})}return n}(a),u=ce(a.width,a.height).canvas;for(const t of ve){const r=performance.now();if(ye(a,u,s,t),await e.setSource(u),await ae(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)})}var Me={font:'Georgia, "Times New Roman", serif',fontWeight:600};function xe(t,e={}){const n=(t.textContent??"").trim(),r={current:{...Me,...e}};let o=r.current.text??n;const i=Y(),a=()=>function(t,e=Me.font,n=Me.fontWeight,r=520){const{canvas:o,pen:i}=ce(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=se({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 le(()=>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())}var we="position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit;pointer-events:none";function ke(t,e={}){const n={current:{...e}},r=Y(),o=[],i=t.querySelector("video"),a=n.current.src??i??null,s=()=>n.current.reducedMotion??q();let l=null,c=0;l=a?se({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(),p()},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",`${we};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 f=null;function p(){!f&&a&&(a instanceof HTMLVideoElement?f=a:(f=document.createElement("video"),f.src=a,f.setAttribute("style",we),f.setAttribute("aria-label",n.current.label??"Video"),"static"===getComputedStyle(t).position&&r.set(t,"position","relative"),d?t.insertBefore(f,d):t.appendChild(f),o.push(f)),n.current.poster&&!f.poster&&(f.poster=n.current.poster),f.muted=!0,f.loop=!0,f.playsInline=!0,d&&(d.style.opacity="0"),m&&f.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()):p();const g=le(()=>l,n,t=>{d&&t.poster&&d.getAttribute("src")!==t.poster&&(d.src=t.poster),f&&t.poster&&(f.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():f?.play?.()?.catch?.(()=>{}),h())},g.pause=()=>{l&&!g.supported||(m=!1,l?y():f?.pause?.(),h())},g}function Se(t,e={}){const n={current:{...e}},r=Y(),o=t.querySelector("img"),i=n.current.image??o??null;let a=null;a=i?se({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 le(()=>a,n,()=>{},{pulse:(t,e=1)=>{a&&!a.still()&&de(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 ae(Math.max(0,48-(performance.now()-n)))}})():e.setSource(i)}},()=>{s++,r.restore()})}var Ae={saving:null,font:'"Geist", Arial, sans-serif'};function Ce(t,e,n,r=Ae.font){const o=Math.max(2,Math.round(2*t.offsetWidth)),i=Math.max(2,Math.round(2*t.offsetHeight)),{canvas:a,pen:s}=ce(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}function $e(t,e={}){const n={current:{...Ae,...e}},r=(e=n.current.saving)=>Ce(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=se({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=ce(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 ae(Math.max(0,48-(performance.now()-r)))}r===i&&l?.field===e&&await e.setSource(t)};return le(()=>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()&&de(l.field,t,e)}},()=>{i++,c?.disconnect()})}var Ee={aurora:["#2ee6c8","#9d7bff","#ff6fb5"],brand:["#ffb000","#ffd84d"]},Le={palette:"aurora",swell:!0},ze=t=>"mono"===t?[]:"string"==typeof t?[...Ee[t]??Ee.aurora]:[...t];function Re(t,e){if(1===t.length)return t[0];const n=F(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(" ")})`}function Ie(t,e={}){const n={current:{...Le,...e}},r=Y();let o="idle",i=0,a=F(n.current.level??0),s=a,l=0,c=0,d=ze(n.current.palette),u=null,h=null,f=0;const p=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=tt({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&&p(u),onFail:()=>{u=null},paint:({pen:t,w:e,h:n,now:r,still:u})=>{const f=c?Math.min(64,r-c):16;c=r;const p=F((t=>"listening"===o?h?h.read():a:"thinking"===o?.2+.1*Math.sin((t-i)/120):"done"===o?l*(1-N(F((t-i)/420))):a)(r));return u||"done"===o?s=p:s+=(p-s)*(1-(1-(p>s?.45:.12))**(f/16.7)),u||m(s),function(t,e,n,r,o,i){const a=t=>{const e=Math.round(255*F(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 f=s+.8*Math.cos(u)*c*.62,p=l-.55*c*.62,m=t.createRadialGradient(f,p,0,f,p,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,Re(i,y)),b.addColorStop(.5,Re(i,y+.25)),b.addColorStop(1,Re(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&&p(u);const g=()=>{f++,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 et(()=>u,n,t=>{d=ze(t.palette),void 0!==t.level&&(a=F(t.level)),u?.refresh(),u&&p(u)},{level(t){a=F(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=f,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!==f)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})}var Pe=t=>{const e=Math.round(255*Math.min(1,Math.max(0,t)));return`rgb(${e} ${e} ${e})`},Te=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},Fe=/^(IMG|PICTURE|VIDEO|CANVAS|SVG|svg)$/;function We(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?Z(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=Te(s.backgroundColor)>.03,c=(parseFloat(s.borderTopWidth)||0)>0&&Te(s.borderTopColor)>.1;if(t.beginPath(),a===e)(l||c)&&(t.strokeStyle=Pe(.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(Fe.test(a.tagName)){t.fillStyle=Pe(.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=Pe(.22),t.roundRect(i.x,i.y,i.w,i.h,o(s,i)),t.fill()):c&&(t.strokeStyle=Pe(.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&&Be(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||Oe(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++,Be(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 Be(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=Pe(a),t.shadowColor=Pe(a),t.shadowBlur=3,t.textBaseline="middle",t.fillText(e,n,r+o/2),t.shadowBlur=0}function Oe(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 Ne(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),We(s,t,e,i),a):a}var qe={input:"input",rows:'[role="option"]',hotkey:"k",manage:!0,closeOnRun:!0},He=200,Ge=t=>{const e=Math.round(255*F(t));return`rgb(${e} ${e} ${e})`};function De(t,e={}){const n={current:{...qe,...e}},r=Y(),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,f=!1,p=0,m=null;const g=()=>!!(n.current.reducedMotion??q());m=tt({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?He:260);if(!(o>=1||n)){const e=r.closing?1-1.02*N(o):1.04*N(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 f=d.x,p=d.y;if(h>0){const[t,e]=i(d,h);f+=t,p+=e}t.globalAlpha=a*(1-h*h),t.drawImage(e,d.x*l,d.y*l,4*l,6*l,f,p,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-F((o-.72)/.28),.4),!0}h=null}if(!a||f)return!1;const p=o()[s];if(!p)return!1;const m=r(p),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=Ge(.32),t.fillRect(v,Math.min(g,l.y)+7,6,Math.abs(g-l.y)+y)),t.fillStyle=Ge(.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=K(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=Ne(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:W(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,f=Math.hypot(o,i)||1;h={snap:a,blocks:s,order:Float32Array.from(s,t=>Math.hypot(t.x-d,t.y-u)/f*.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=()=>{p&&clearTimeout(p),p=0},S=(e=!0)=>{!a||f?(k(),a=!0,f=!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&&(f=!0,x(!0),M(!1)),p=setTimeout(()=>{p=0,delete t.dataset.state,f=!1,x(!1),m?.kick()},143))):e&&i()?.focus({preventScroll:!0})},A=()=>{if(!a)return;k();const e=t.contains(document.activeElement),r=()=>{p=0,f=!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();f=!0,t.dataset.state="closing",m&&(M(!0),x(!0));const o=w([y(),b()],He,"forwards"),i="function"==typeof t.animate?t.animate([{opacity:1},{opacity:1,offset:.4},{opacity:0}],{duration:He,fill:"forwards"}):null;p=setTimeout(()=>{r(),o?.cancel(),i?.cancel()},He)},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||f)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&&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(),$())},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()},I=t=>{if(!n.current.manage)return;const e=L(t);e>=0&&$(e)},P=()=>{n.current.manage&&(c=!1,l=null,C(0))},T=()=>{a?A():S(!0)},B=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))},O=e=>{if(!n.current.manage||!a||f)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",I),t.addEventListener("input",P);const H=n.current.trigger;return H?.addEventListener("click",T),H?.setAttribute("aria-expanded",String(a)),H?.setAttribute("aria-haspopup","dialog"),document.addEventListener("keydown",B),document.addEventListener("pointerdown",O),a?t.dataset.open="":t.setAttribute("hidden",""),v(),et(()=>m,n,()=>{v(),m?.refresh()},{open:S,close:A,select:C,run:$,toggle(){a?A():S(!0)},get isOpen(){return a},get selected(){return s}},()=>{k(),x(!1),t.removeEventListener("keydown",E),t.removeEventListener("pointermove",z),t.removeEventListener("pointerleave",R),t.removeEventListener("click",I),t.removeEventListener("input",P),H?.removeEventListener("click",T),document.removeEventListener("keydown",B),document.removeEventListener("pointerdown",O),delete t.dataset.gpu,delete t.dataset.state})}var je={thumb:'[role="slider"]',label:"[data-label]",threshold:.9,resetAfter:0},Ue=720,Ve=(t,e,n)=>t+(e-t)*n,Xe=t=>1-(1-t)**3,Ye=(t,e,n)=>({x:t,v:0,to:t,k:e,z:n});function Je(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 Ke=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}function Qe(t,e={}){const n={current:{...je,...e}},r=Y(),o=t.querySelector(n.current.thumb)??t.firstElementChild,i=()=>t.querySelector(n.current.label),a=()=>!!(n.current.reducedMotion??q());let s=Ye(0,520,.8),l=Ye(0,150,1),c=!1,d=0,u=!1,h=0,f=0,p=[],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=>G(n.current.ink??"--ascii-ink-strong",t,e?"#d8d6cf":"#1d1d1b");M=tt({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 p=x();if(!p)return!1;const m=u?a?1:F((i-h)/Ue):0,g=Xe(F(m/.5)),v=Xe(F((m-.36)/.3)),b=Xe(F((m-.46)/.4)),w=F((m-.5)/.5),S=1+.07*Math.sin(Math.PI*w)*(1-w),A=f?1-F((i-f)/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?V(k(c),(e=>G(n.current.color??"--ascii-success",t,e?"#3ccf7e":"#17844a"))(c),Xe(F(a?1:(i-h)/360))):k(c);z!==y&&(y=z,M?.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=p.pad+s.x+p.size/2,I=u?1:l.x,P=Ve(0,$-L,g),T=Ve(R,$+L,g),W=Ve(0,E-L,g),B=Ve(o,E+L,g);if(T-P>1&&I>.004){const t=e.createLinearGradient(P,0,T,0);t.addColorStop(0,`rgba(255,255,255,${Ve(.14,1,g)*I})`),t.addColorStop(.62,`rgba(255,255,255,${Ve(.48,1,g)*I})`),t.addColorStop(1,`rgba(255,255,255,${I})`),e.fillStyle=t,e.globalAlpha=A*(1-.28*v),e.beginPath(),e.roundRect(P,W,T-P,B-W,Ve(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(),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,$+.02*L,E+.07*L,.55*L,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*F(e))));const n=i();n&&r.set(n,"opacity",String(u?0:1-F(1.7*e)))},A=e=>{m=0;const n=Math.min(1/30,Math.max(0,(e-g)/1e3));g=e;let i=!c&&Je(s,n,.3);i=Je(l,n,.003)||i,f&&(e-f>=260||a())&&(f=0,u=!1,s=Ye(0,520,.8),l=Ye(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||f>0)&&(m=requestAnimationFrame(A))},C=()=>{m||(g=performance.now(),m=requestAnimationFrame(A))},$=()=>{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()&&(Ke(s),Ke(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();f=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!==b)return;c=!1;const o=_e(p,performance.now());s.x>=r.max*n.current.threshold||o>900&&s.x>.5*r.max?$():(s.to=0,s.v=.25*F(o,-1500,1500),l.to=0,a()&&(Ke(s),Ke(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{}b=e.pointerId,c=!0,d=e.clientX-s.x*w(),l.to=1,p=[],t.dataset.state="dragging",C()}else c||a()||(s.v+=420,l.to=0,C())},R=t=>{const e=x();c&&e&&t.pointerId===b&&(s.x=s.to=F((t.clientX-d)/w(),0,e.max),s.v=0,p.push([s.x,performance.now()]),p.length>8&&p.shift(),s.x>=e.max-.5?$():C())},I=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?F(s.to+n*e.max/4,0,e.max):null;null!==r&&(t.preventDefault(),s.to=r,l.to=r>0?1:0,a()&&(Ke(s),Ke(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",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",I));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),et(()=>M,n,()=>M?.refresh(),{confirm:$,reset:E,get confirmed(){return u}},()=>{m&&cancelAnimationFrame(m),v&&clearTimeout(v),m=v=0,o?.removeEventListener("keydown",I),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})}var Ze={kind:"heart",icon:"svg",manage:!0,outset:40,layer:"under"},tn=t=>1-(1-F(t))**3;function en(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 nn(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),en(t,e,n,r,o),t.fill(),t.shadowBlur=0,t.globalAlpha=1}function rn(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)(F((r-.42)/.3)),u=d>0?l+(s-l)*d:.7*s+(l-.7*s)*c,h=F((r-.04)/.46);h>0&&h<1&&(t.strokeStyle=(t=>{const e=Math.round(255*F(t));return`rgb(${e} ${e} ${e})`})(.8*(1-h)**1.4),t.lineWidth=2.4-1.2*h,t.lineJoin="round",en(t,e,i,a,s*(1.2+.5*tn(h))),t.stroke());t.fillStyle="#fff";for(let e=0;e<7;e++){const n=(r-.1-.05*W(e,o))/.5;if(n<=0||n>=1)continue;const l=-Math.PI/2+(e-3)/7*Math.PI*1.7+.3*(W(o+1,e)-.5),c=s*(.75+(.55+.35*W(e,o+2))*tn(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,nn(t,e,i,a,u,1-F((r-.72)/.28))}function on(t,e={}){const n={current:{...Ze,...e}},r=Y(),o=()=>t.querySelector(n.current.icon)??t,i=()=>!!(n.current.reducedMotion??q());let a="true"===t.getAttribute("aria-pressed"),s=[],l=[],c=null;c=tt({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)rn(t,l,a,n,e.seed);else{const e=a.x+a.w/2,r=a.y+a.h/2+3*tn(n),o=a.h*(1+.12*tn(n));nn(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)W(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())},f=(e=!a)=>{a=e,t.setAttribute("aria-pressed",String(a)),a?u():h()},p=()=>{n.current.manage&&(f(),n.current.onChange?.(a))};return!t.hasAttribute("aria-pressed")&&n.current.manage&&t.setAttribute("aria-pressed","false"),t.addEventListener("click",p),et(()=>c,n,()=>c?.refresh(),{burst:u,undo:h,toggle:f,get pressed(){return a}},()=>{d(),r.restore(),t.removeEventListener("click",p)})}var an={values:[],duration:520},sn=t=>{const e=Math.round(255*F(t));return`rgb(${e} ${e} ${e})`};function ln(t,e={}){const n={current:{...an,...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=tt({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 f=s?Math.min(64,l-s):16;s=l;const p=e/h,m=Math.max(3,p*(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:F((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(-f/90)),Math.abs(a[e]-d)>.01&&(y=!0);const M=(g>0?Math.max(0,u[e])/g:0)*(r-2)*N(s),x=r-M,w=p*(e+.5)-m/2;if(M<=0)continue;const k=.16+.84*a[e],S=t.createLinearGradient(0,x,0,r);S.addColorStop(0,sn(k)),S.addColorStop(1,sn(.5*k)),t.fillStyle=S,t.fillRect(w,x,m,M)}return y}});const u=Y(),h=c?null:document.createElement("div"),f=()=>{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*F(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 p=document.createElement("table");p.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)}),p.replaceChildren(r)};m(),t.appendChild(p);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(),f(),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(),f()};f();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),et(()=>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(),p.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")})}var cn={dissolve:140,condense:160},dn=10,un=16;function hn(t,e={}){const n={current:{...cn,...e}},r=Y();let o=null,i=0,a=Promise.resolve(),s=0,l=null;l=tt({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:N(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+=un)for(let a=0;a<i;a+=dn){const i=Math.hypot(a+5-r.x,c+8-r.y)/l*.72+.28*W(a,c)-n;if(i>0&&t.drawImage(e,a,c,dn,un,a,c,dn,un),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,dn,un,a+18*(W(c,a+o)-.5)*n,c-10*n,dn,un),t.globalAlpha=1}}t.globalCompositeOperation="lighter";for(const[n,r]of s)t.drawImage(e,n,r,dn,un,n,r,dn,un);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=>Ne(t,e.box,t.offsetWidth,t.offsetHeight,2,{skip:e.canvas}),h=async(e,o)=>{const i=l;if(!i||(n.current.reducedMotion??q()))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 et(()=>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()})}var fn={cards:"[data-card]",loop:!0,threshold:.4,outset:56},pn=(t,e,n)=>t+(e-t)*n,mn=(t,e,n)=>({x:t,v:0,to:t,k:e,z:n}),gn=Array.from({length:96},(t,e)=>{const n=43758.5453*Math.sin(127.1*e+311.7);return n-Math.floor(n)});function vn(t,e={}){const n={current:{...fn,...e}},r=Y(),o=()=>!!(n.current.reducedMotion??q()),i=()=>[...t.querySelectorAll(n.current.cards)];let a=0,s=mn(0,380,.72),l=mn(0,380,.8),c=mn(0,260,.9),d=!1,u=0,h=0,f=null,p=[],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 f=n.current.radius??(parseFloat(getComputedStyle(t).borderTopLeftRadius)||16);h.beginPath(),h.roundRect(0,0,u.width,u.height,Math.min(f,u.width/2,u.height/2)),h.clip();const p=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 f=Math.max(1,u-d);for(let t=0;t<a.length;t+=4){let r=F((c(t)-d)/f);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(p){const t=Math.max(u.width/p.width,u.height/p.height),e=u.width/t,n=u.height/t;h.drawImage(p,(p.width-e)/2,(p.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+(f?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=tt({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,p=d.x+u/2,m=d.y+h/2,g=F(c.x),v=(t,n,r,i,a=0)=>{const s=S(t,u,h,!o);!s||i<=0||(e.save(),e.translate(p,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,pn(.86,.93,g),pn(24,12,g),pn(.3,.55,g),.3),v(a+1,pn(.93,1,g),pn(12,0,g),pn(.55,1,g),.4*(1-g));const y=S(a,u,h,!o);if(!y)return!1;const M=f?F((r-f.start)/620):0,x=f?.dir??1,w=f?f.x0+x*u*.9*(1-(1-M)**3):s.x,k=f?f.y0:l.x;if(e.save(),e.translate(p+w,m+k),e.rotate(.22*F(w/u,-1.6,1.6)),!f)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=gn[t%gn.length],o=F(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?p+w+i+.62*u:p+w+i-.62*u,c=x>0?n-4-l:l-4;e.globalAlpha=(1-o*o)*F(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||f||(i=Je(s,o,.3),i=Je(l,o,.3)||i),i=Je(c,o,.002)||i,f&&e-f.start>=620&&(f=null,a+=1,E()),(()=>{(n.current.leanTarget??t).style.setProperty("--ascii-lean",String(f?0:F(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*F(s.x/w(),-1.6,1.6)}rad)`)})(),M?.kick(),(i||d||f)&&(m=requestAnimationFrame(C))},$=()=>{m||(g=performance.now(),m=requestAnimationFrame(C))},E=()=>{s=mn(0,380,.72),l=mn(0,380,.8),c=mn(0,260,.9)},L=(t=1)=>{const e=i();if(f||!e.length||!n.current.loop&&a>=e.length)return!1;const u=x(a),h=k(a);return d=!1,o()||!M?(a+=1,E(),M||r.set(u,"transform","")):(f={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=_e(p,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*F(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,I=e=>{if(0!==e.button||f)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,p=[],$()},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*F(Math.abs(s.x)/w()),p.push([s.x,performance.now()]),p.length>8&&p.shift(),$()},T=t=>{"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||(t.preventDefault(),L("ArrowRight"===t.key?1:-1))},W=()=>M?.kick(),B=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",I),t.addEventListener("pointermove",P),t.addEventListener("pointerup",z),t.addEventListener("pointercancel",z),t.addEventListener("lostpointercapture",z),t.addEventListener("keydown",T),t.addEventListener("load",W,!0),t.addEventListener("dragstart",B),et(()=>M,n,()=>{y=new Map,A(),M?.refresh()},{next:L,get index(){return k(a+(f?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",I),t.removeEventListener("pointermove",P),t.removeEventListener("pointerup",z),t.removeEventListener("pointercancel",z),t.removeEventListener("lostpointercapture",z),t.removeEventListener("keydown",T),t.removeEventListener("load",W,!0),t.removeEventListener("dragstart",B)})}var yn={length:6,accept:"digits",cells:"[data-cell]"},bn=560,Mn=t=>{const e=Math.round(255*F(t));return`rgb(${e} ${e} ${e})`};function xn(t,e={}){const n={current:{...yn,...e}},r=Y(),o=Y(),i=[],a=()=>!!(n.current.reducedMotion??q()),s=()=>Math.max(1,Math.round(n.current.length));let l="",c="idle",d=!1,u=[],h="",f=-1e9,p="",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,f=n.h*d,p=n.x+(n.w-h)/2+l,m=n.y+(n.h-f)/2+c;for(let e=0;e<n.h;e+=4)for(let a=0;a<n.w;a+=3){if(W(a+31*i,e)>1.3*r-.12)continue;const n=3*(1-r);t.drawImage(u,2*a,2*e,6,8,p+a*d+(W(a,e+o)-.5)*n,m+e*d+(W(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=tt({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)=>p[r]&&A(e,p[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=F((t-.45)/.55);return c>0&&c<1&&(e.strokeStyle=Mn(.55*(1-c)),e.lineWidth=3,e.beginPath(),e.arc(a,l,18+44*(t=>1-(1-F(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,N(F((t-.4)/.45))),t<1}let b=!1;const M=o-f;return s.forEach((t,n)=>{const r=a(t),s=l[n];if(M<bn&&h[n])return C(t,!1),A(e,h[n],r,1-M/bn,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>=bn){const t=i?.6:.5-.5*Math.cos(o/1600*Math.PI*2);e.fillStyle=Mn(.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 $=(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),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()},z=t=>{E(),"idle"!==c&&(c="idle",m=-1e9),h="",f=-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,L(),e.length===s()&&$(a()||!b?0:300+y*Math.max(0,o-1)+80,()=>n.current.onComplete?.(e)),y=0},R=()=>z(w.value),I=()=>{y=55},P=()=>{d=!0,L()},T=()=>{d=!1,L()};return w.addEventListener("input",R),w.addEventListener("paste",I),w.addEventListener("focus",P),w.addEventListener("blur",T),w.value?z(w.value):L(),et(()=>b,n,()=>{w.setAttribute("maxlength",String(s())),L(),b?.refresh()},{verify:e=>{E();const n=performance.now();if(e)return p=l,g=b?k().map(t=>b.box(t)):[],m=n,c="success",void L();h=l,f=a()||!b?n-bn:n,c="error",L(),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;$(a()||!b?0:bn,()=>{h===r&&(h="",l="",L())})},clear:()=>{E(),h="",f=-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",I),w.removeEventListener("focus",P),w.removeEventListener("blur",T),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})}function wn(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 kn(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 Sn(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 An(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,f=0;for(let t=0;t<256;t++)if(f+=l[t],f>=.02*c){u=t;break}f=0;for(let t=255;t>=0;t--)if(f+=l[t],f>=.02*c){h=t;break}const p=Math.max(1,h-u);for(let t=0;t<s.length;t+=4){let r=F((d(t)-u)/p);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 Cn={strong:1,text:.82,meta:.55,tile:.42,icon:.62},$n=new Set(["IMG","SVG","svg","VIDEO","PICTURE"]),En=t=>[...t.children].flatMap(t=>$n.has(t.tagName)?[t]:[t,...En(t)]);function Ln(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!==Cn[t])return Cn[t]}return parseFloat(e?getComputedStyle(e).fontWeight:"400")>=500?1:.7},u=t=>{const e=Math.round(255*F(t));return`rgb(${e} ${e} ${e})`},h=En(t),f=[t,...h].filter(t=>{const e=t.dataset?.paint;return"tile"===e||"icon"===e||!e&&$n.has(t.tagName)&&!t.closest("[data-paint]")});for(const t of f){const e=r(t);if(e.w<=0||e.h<=0)continue;const n=t.dataset?.paint;a.fillStyle=u("icon"===n?Cn.icon:Cn.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 p=document.createTreeWalker(t,4),m=document.createRange();a.textBaseline="middle";for(let t=p.nextNode();t;t=p.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 zn(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,f=c.y;if(u>0){const[t,e]=i(c,u);h+=t,f+=e}t.globalAlpha=a*(1-u*u),t.drawImage(e,2*c.x,2*c.y,8,12,h,f,4,6)}t.globalAlpha=1}function Rn(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 In={max:3,duration:6e3,label:"Notifications",glint:!0},Pn=4200,Tn="cubic-bezier(.16, 1, .3, 1)",Fn=`\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 ${Tn},scale 280ms ${Tn},opacity 160ms ${Tn}}\n:where(.ascii-toast) > *{transition:opacity 160ms ${Tn}}\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 ${Tn} 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`,Wn=t=>{const e=Math.round(255*F(t));return`rgb(${e} ${e} ${e})`};var Bn=t=>{const[e,n,r]=U(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};function On(t,e={}){const n={current:{...In,...e}},r=Y(),o=document.createElement("ol"),i=J("",!1);i.setAttribute("role","status");let a=[],s=[],l=0,c=!1,d=!1,u=!1,h=!1,f=null,p=0;const m=[];Rn("ascii-kit-toast",Fn),o.className="ascii-toasts",o.setAttribute("aria-label",n.current.label),t.append(o,i);const g=new WeakSet,v=e=>{const r=G(n.current.ink??"--ascii-ink-strong",t,X(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(F(+t,0,255)).toString(16).padStart(2,"0")).join("")}`,[o,i]=[Bn(r),Bn(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"))};f=tt({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:()=>{f=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%Pn/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=Wn(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{p&&clearTimeout(p);const t=n>0?Pn-n%Pn:-n;p=setTimeout(()=>{p=0,f?.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?zn(t,n.snap,n.blocks,n.order,1.04*N(r),(t,e)=>[70*(t.seed-.5)*e,(14+26*W(t.x,t.y))*e],1-F((r-.62)/.28)):zn(t,n.snap,n.blocks,n.order,1-1.04*(1-(1-r)**3),(t,e)=>[(14+34*t.seed)*e,14*(W(t.y,t.x)-.35)*e],1-F((r-.75)/.25)),!0)}),s.length>0||l}}),f&&(f.canvas.style.zIndex="11");const b=()=>!!f&&f.live&&!f.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(!f)return;const r=Ln(e,f.canvas.clientWidth||t.clientWidth+48,f.canvas.clientHeight||t.clientHeight+48,f.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:W(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}),f.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 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()},$=t=>{o.contains(t.relatedTarget)||(u=!1,k())};function E(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(),f?.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()}o.addEventListener("pointerenter",S),o.addEventListener("pointerleave",A),o.addEventListener("focusin",C),o.addEventListener("focusout",$);return et(()=>f,n,t=>{o.setAttribute("aria-label",t.label),f?.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=>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"),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(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)):f?.kick(),w(d),e},dismiss:E,clear(){[...a].forEach(t=>E(t.id))},get toasts(){return a.filter(t=>void 0===t.node.dataset.gone).map(t=>t.id)}},()=>{h=!0,p&&clearTimeout(p);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",$),a=[],s=[],o.remove(),i.remove(),r.restore()})}var Nn={lines:3,start:!0,stagger:38,rule:!0},qn=420,Hn=t=>`Thought for ${t}s`;function Gn(t,e={}){const n={current:{...Nn,...e}},r=Y(),o=[...t.childNodes];let i="done",a=0,s=0,l=-1e9,c=-1e9,d=0,u="",h=null;const f=document.createElement("canvas"),p=()=>{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=tt({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=p(),h="thinking"===i?1:a?0:1-B((o-l)/qn),m="done"===i&&d.rule?a?.7:.7*B((o-c-280)/qn):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));f.width===n&&f.height===o||(f.width=n,f.height=o),gt(f,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*W(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(f,0,0,e,r),t.drawImage(f,0,0,e,r),t.drawImage(f,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<qn||"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*p()+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(),et(()=>h,n,()=>h?.refresh(),{think:v,stream:async e=>{"thinking"!==i&&v();const o=d;y=0;let f="";const p=()=>{"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??Hn)(a)),n.current.onState?.("streaming",a),h?.kick())},M=(t,e)=>{f+=t;const o=e?f.length:f.search(/\s\S*$/)+1;o<=0||(p(),u+=f.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)}})(f.slice(0,o)),f=f.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)}p();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)})}var Dn={caret:!0,settle:60,stagger:18,reasoningLines:2},jn="cubic-bezier(.16, 1, .3, 1)",Un=`\n:where(.ascii-reasoning){display:grid;grid-template-rows:1fr;transition:grid-template-rows 260ms ${jn},opacity 200ms ${jn}}\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 ${jn},opacity 200ms ${jn}}\n:where(.ascii-reasoning li[data-new]){opacity:0}\n@media (prefers-reduced-motion: reduce){:where(.ascii-reasoning, .ascii-reasoning li){transition:none}}\n`,Vn=t=>[...t.children].filter(t=>"IMG"===t.tagName&&void 0!==t.dataset?.asciiPoster);function Xn(t,e={}){const n={current:{...Dn,...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 f=null,p=null;const m=e=>{o!==e&&(o=e,"done"!==e&&"stopped"!==e||(f?.setAttribute("data-collapsed",""),f?.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=tt({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:f}=h(),p=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*W(p,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*f)/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 et(()=>u,n,()=>u?.refresh(),{write:e=>{if(!e)return;"streaming"!==o&&("idle"===o&&(t.replaceChildren(...Vn(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,f=u.still();let p=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,f||(e.style.setProperty("color","transparent"),a.push({span:e,at:c+h.settle+p*h.stagger,seed:31*l+p})),r(e),s=e,p++}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&&f)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(!f||!p){Rn("ascii-kit-reasoning",Un),f=document.createElement("div"),f.className="ascii-reasoning";const e=document.createElement("div");e.className="ascii-reasoning-in",p=document.createElement("ol"),e.appendChild(p),f.appendChild(e),t.parentElement?.insertBefore(f,t)}f.removeAttribute("data-collapsed"),f.removeAttribute("aria-hidden");const r=Math.max(1,Math.round(n.current.reasoningLines));f.style.setProperty("--ascii-reasoning-lines",String(r));const o=document.createElement("li");o.textContent=e;const i=n.current.reducedMotion??q();i||o.setAttribute("data-new",""),p.appendChild(o);const a=f,s=String(Math.max(0,p.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,f?.remove(),f=p=null,c?.(),c=null,d=null,t.replaceChildren(...Vn(t)),u&&t.appendChild(u.canvas),m("idle"),u?.kick()},get state(){return o},get text(){return i}},()=>{c?.(),c=null,f?.remove(),f=p=null,t.removeAttribute("aria-busy"),i?t.textContent=i:t.replaceChildren(...r)})}function Yn(t,e){const n={current:{position:50,...e}},r=Y();let o=F(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=tt({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&&Sn(t,i,0,0,e,n),!1)});const h="string"==typeof n.current.image?kn(n.current.image):n.current.image,f=t.querySelector('[role="slider"]'),p=t.querySelector("[data-compare-line]"),m=f??document.createElement("div"),g=p??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=F(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=F((t-s.at)/280);o=s.from+(s.to-s.from)*N(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){Rn("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,p||(g.className="ascii-compare-line",g.setAttribute("aria-hidden","true")),f||(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),wn(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 et(()=>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()})}var Jn=t=>"string"==typeof t?{src:t}:t;function Kn(t,e){const n={current:{open:0,duration:280,label:"Images",...e}},r=Y(),o=n.current.images.map(Jn);let i=F(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=kn(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=tt({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?An(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 f=!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&&(f=!0),a}),h.forEach((e,n)=>{const r=d[n],i=B(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,Sn(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*F(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&&(f=!0),f||(a=0),f}});const f=()=>{h.forEach((t,e)=>{t.setAttribute("aria-expanded",String(e===i)),t.tabIndex=e===i?0:-1})},p=(t,e=!1)=>{t=F(Math.round(t),0,h.length-1),e&&h[t]?.focus(),t!==i&&(i=t,s=performance.now(),f(),n.current.onChange?.(t),u?.kick())},m=h.map((t,e)=>{const n=()=>p(e),r=()=>{t.matches(":focus-visible")&&p(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(),p(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)}});Rn("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)),f(),h.forEach((t,e)=>{const n=t.querySelector("img");n&&wn(n).then(t=>{c[e]=t,d[e]=u?An(t,!u.dark()):null,u?.kick()},()=>{})}),et(()=>u,n,e=>{r.set(t,"--ascii-acc-ms",`${e.duration}ms`),v||t.setAttribute("aria-label",e.label),u?.refresh()},{select:p,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()})}var _n={maxBytes:10485760,develop:720};function Qn(t,e={}){const n={current:{..._n,...e}};let r="empty",o=null,i="",a="",s="image",l=0,c=0,d=!1,u=0,h=0,f=0,p=null,m=null,g=null;const v=J("",!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=tt({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:X(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:N(F((s-l)/n.current.develop));Sn(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=f?Math.min(64,s-f):16;f=s;const p=d?1:0;h=c?p:h+(p-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 f=Math.abs(s)<.5?r:o>0&&s<-.5&&s>-1.5?.55*r*o:0,p=Math.round(255*Math.min(1,f));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]=p,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(p-h)>.004;return M||(f=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:p,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 $=async(t,e=null)=>{const n=++c;let d;a&&URL.revokeObjectURL(a),a="string"==typeof t?"":URL.createObjectURL(t),i=a||t,p=e??("undefined"!=typeof File&&t instanceof File?t:null),s=p?.name??("string"==typeof t&&t.split("/").pop()?.split("?")[0]||"image"),v.textContent=`Converting ${s}`;try{d=await wn(kn(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()}},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,i="",p=null,a&&URL.revokeObjectURL(a),a="",w?.remove(),S("empty"),v.textContent="",m?.kick()},z=()=>M.click(),R=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)}),I=()=>{f=0,m?.kick()},P=e=>{e.preventDefault(),u++,d||(d=!0,t.dataset.over="",I())},T=t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="copy")},W=()=>{u=Math.max(0,u-1),!u&&d&&(d=!1,delete t.dataset.over,I())},B=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):I()},O=t=>{const e=t.target?.closest?.("[data-dropzone]")?.getAttribute("data-dropzone");"pick"===e?z():"clear"===e?L():"download"===e&&R()},q=()=>{const t=M.files?.[0];M.value="",t&&E(t)};Rn("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",P),t.addEventListener("dragover",T),t.addEventListener("dragleave",W),t.addEventListener("drop",B),t.addEventListener("click",O),M.addEventListener("change",q),et(()=>m,n,()=>m?.refresh(),{setImage:t=>$(t),clear:L,pick:z,download:R,get state(){return r}},()=>{c++,a&&URL.revokeObjectURL(a),t.removeEventListener("dragenter",P),t.removeEventListener("dragover",T),t.removeEventListener("dragleave",W),t.removeEventListener("drop",B),t.removeEventListener("click",O),M.removeEventListener("change",q),x.forEach(t=>t.remove()),delete t.dataset.asciiDropzone,delete t.dataset.state,delete t.dataset.over})}var Zn={duration:620,collapse:!0,remove:!1},tr=16,er=new WeakMap;function nr(t,e={}){const n=er.get(t);if(n)return n;const r={...Zn,...e},o=Y(),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},f=()=>{};const p=tt({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:tr,resolution:2,ink:()=>r.ink??"--ascii-ink-strong",kit:{current:{lazy:!1,globalLook:r.globalLook}},reducedMotion:()=>r.reducedMotion,onFail:()=>f(),paint:({pen:t,now:e,still:n,scale:o})=>{if(n)return queueMicrotask(f),!1;if(!u||!d)return!1;const i=e-c,a=F(i/r.duration);t.setTransform(o,0,0,o,0,0),i>=300&&s(N(F((i-300)/260))),t.save(),t.globalAlpha=F(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,p=l-(1.3*a-.3)*h.w,m=l-1.3*a*h.w,g=t.createLinearGradient(m,0,Math.max(m+1,p),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-tr,h.y-tr,h.w+32,h.h+32),t.restore();const v=i>=Math.max(r.duration,r.collapse?560:0);return v&&queueMicrotask(f),!v}}),m=new Promise(e=>{let n=!1;if(f=()=>{n||(n=!0,p?.destroy(),s(1),r.remove&&t.remove(),er.delete(t),e())},!p||p.still())return a(),void f();h=p.box(t),u=Ln(t,p.canvas.clientWidth||h.w+32,p.canvas.clientHeight||h.h+32,p.box).canvas;p.field.ready.then(()=>{n||d||(a(),d=!0,c=performance.now(),p.kick())},()=>{a(),f()})});return er.set(t,m),m}var rr={threshold:88},or=.3;function ir(t,e){const n={current:{...rr,...e}},r=Y(),o=()=>n.current.content??t.children[0]??null,i=J("",!0),a={x:0,v:0,to:0};let s="idle",l=!1,c=!1,d=0,u=-1,h=0,f=0,p=0,m=!0,g=null,v=[];const y=new WeakSet,b=t=>{i.textContent=t};g=tt({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=p?Math.min(1/30,(i-p)/1e3):1/60;p=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-f<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=F(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:B((i-f)/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>=or&&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=Ln(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),Sn(r,An({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<or?B(n/or,3):1-B((n-or)/.7,3),t.drawImage(o,r.x,r.y,r.w,r.h),t.globalAlpha=1,b=!0,!0}),b||(p=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,f=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",f=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=>{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()},E=()=>{if(l&&(l=!1,c)){if(c=!1,a.x>=n.current.threshold)return s="idle",void A();s="idle",a.to=0,M()}},L=t=>{c&&t.preventDefault()},z=t=>{l&&t.preventDefault()};return g?(r.set(t,"overscroll-behavior-y","contain"),t.appendChild(i),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(i),et(()=>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"),i.remove(),r.restore()})}var ar={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:" ⠁⠃⠇⡇⣇⣧⣷⣿"}},sr=(t,e,n,r)=>"number"==typeof t&&Number.isFinite(t)?Math.min(r,Math.max(n,t)):e;function lr(t){if(!t)return;if("dots"===t)return" ·∙•●";const e=ar[t];return e&&Object.prototype.hasOwnProperty.call(ar,t)?e.chars:t.startsWith(" ")?t:" "+t}function cr(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:sr(t.speed,e.speed,0,5),cellSize:sr(t.cellSize,e.cellSize,3,96),charset:lr(t.charset),cursor:t.cursor??e.cursor,clear:t.clear??!1,dither:sr(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(sr(n.current.opacity,n.current.preset.opacity??1,0,1)),d=()=>!!(n.current.reducedMotion??q()),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)};r=u(!1);return{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=_(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,z(n)}}}}var dr=(t,e)=>!1===t.cursor?"none":"string"==typeof t.cursor?t.cursor:e;function ur(t,e,n){let r=null;if(r=se({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 hr=()=>"number"==typeof innerWidth&&innerWidth<760,fr=(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"}}),pr={light:"#8f8d86",dark:"#64625d"},mr={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=>ur(t,t=>({...fr(t,dr(t,"trail")),mark:"glyph",scale:hr()?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}}),pr)},gr={id:"halftone",name:"Halftone",description:"The drifting ground drawn as dots, clear around your content.",cellSize:14,speed:1,cursor:!0,mount:t=>ur(t,t=>({...fr(t,dr(t,"lantern")),mark:"dot",scale:hr()?1.8:1,cellSize:t.cellSize,cellAspect:1,dotScale:.64,trail:{strength:.9,radius:.4}}),pr)},vr={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=>ur(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:dr(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"})},yr=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,f=1-c;r[0]=(t[d]*h+t[d+3]*l)*f+(t[u]*h+t[u+3]*l)*c,r[1]=(t[d+1]*h+t[d+4]*l)*f+(t[u+1]*h+t[u+4]*l)*c,r[2]=(t[d+2]*h+t[d+5]*l)*f+(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,f=d-this.front[l+1]*e*u;this.read(this.front,h,f,this.advected);let p=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 f=Math.exp(-h/.0032),v=Math.hypot(t.dx*o,t.dy*i),y=Math.min(.025,.55*v);p+=(4.2*t.dx-n*y)*f,m+=(4.2*t.dy+e*y)*f,g=Math.max(g,Math.min(.7,18*v)*f);continue}const r=e*e+n*n;if(r>.045)continue;const a=Math.exp(-r/.0075),s=t.speed;p+=(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,p)),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(p),Math.abs(m),g)}[this.front,this.back]=[this.back,this.front],this.strokes.length=0,this.energy=a,this.active||this.clear()}};var br=" .:+-=xICA$FY#@",Mr=.58,xr=72649.5/59542.5;var wr={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 yr(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*Mr/26e3)))(t.settings().cellSize,e,n),d=tt({host:e,kit:t.kit,layer:"under",look:()=>{const n=t.settings();return{mark:"glyph",charset:n.charset??br,font:'"JetBrains Mono", monospace',fontWeight:400,cellSize:c(e.clientWidth||1,e.clientHeight||1)/Mr,cellAspect:Mr,glyphScale:.9,cellFit:"fill",maxPixelRatio:1.5,color:"ink",shade:0,levels:"none",fit:"cover",gamma:1,contrast:xr,brightness:-.0004316244699164449-.5/Math.max(1,Array.from(n.charset??br).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*Mr)/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:f,now:p,still:m})=>{const g=t.settings(),v=i?Math.min(.05,(p-i)/1e3):1/60;i=p,m||(o+=v*g.speed);const y=h/f;if(Math.abs(y-r)>.01&&(n=new yr(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,f=u-.5-a[1],p=h+.22*Math.sin(5.2*f+.17*o)+.15*Math.sin(2.4*h-3.1*f-.1*o),m=f+.19*Math.sin(3.5*h+.13*o),g=Math.hypot(.8*p+.18,1.1*m),v=.5+.5*Math.sin(14*g-2.8*p+1.4*Math.sin(5*m)-.24*o),y=.5+.5*Math.sin(3.6*p-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()}}}},kr="#6f6d67",Sr="#8f8d86",Ar={x:-1,y:-1,users:0},Cr=t=>{Ar.x=t.clientX,Ar.y=t.clientY};function $r(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=Y();"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=X(r),d="";const u=()=>{d=G(t.ink(c),r,c?Sr:kr)??Sr;const e=t.settings().accent;l=e?G(e,r)??void 0:void 0};u();let h=0,f=!0,p=!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()??q()),$=()=>{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=K(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=e=>{if(h=0,m||p||!f||"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(E));const a=g?Math.min(.05,(e-g)/1e3):0;if(g=e,n||(M+=a*r.speed,x+=a),r.cursor&&Ar.x>=0){const t=o.getBoundingClientRect();t.width&&t.height&&(A.x+=.07*((Ar.x-t.left)/t.width-A.x),A.y+=.07*((Ar.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||p||!f||(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),a.setTransform(t,0,0,t,0,0),S=n,f&&!p&&$(),L()};z();const R="function"==typeof ResizeObserver?new ResizeObserver(z):null;R?.observe(r);const I="function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{f=t.isIntersecting,g=0,f?L():h&&(cancelAnimationFrame(h),h=0)},{rootMargin:"64px"}):null;I?.observe(r);const P=()=>{g=0,L()};document.addEventListener("visibilitychange",P);const T="function"==typeof matchMedia?matchMedia("(prefers-reduced-motion: reduce)"):null;T?.addEventListener?.("change",P),0===Ar.users++&&"function"==typeof addEventListener&&addEventListener("pointermove",Cr,{passive:!0});const F="object"==typeof document.fonts?document.fonts:null,W=()=>{m||!f||p||($(),L())};F?.addEventListener?.("loadingdone",W),F?.ready?.then(W,()=>{});let B=0;const O=()=>{B||m||(B=requestAnimationFrame(()=>{B=0,m||(c=X(r),u(),C()&&$(),L())}))},N="function"==typeof matchMedia?matchMedia("(prefers-color-scheme: dark)"):null;N?.addEventListener?.("change",O);const H="function"==typeof MutationObserver?new MutationObserver(O):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=X(r),u(),C()&&f&&!p&&$(),L())},play(){p&&(p=!1,g=0,L())},pause(){p=!0,h&&cancelAnimationFrame(h),h=0},destroy(){m||(m=!0,h&&cancelAnimationFrame(h),B&&cancelAnimationFrame(B),h=B=0,R?.disconnect(),I?.disconnect(),H?.disconnect(),document.removeEventListener("visibilitychange",P),T?.removeEventListener?.("change",P),N?.removeEventListener?.("change",O),F?.removeEventListener?.("loadingdone",W),0===--Ar.users&&"function"==typeof removeEventListener&&removeEventListener("pointermove",Cr),o.remove(),o.width=o.height=0,s.restore())}}}function Er(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 Lr(t){return t*t*t*(t*(6*t-15)+10)}function zr(t,e,n){return t+(e-t)*n}function Rr(t,e){let n=127*t+311*e;return n^=n>>13,(n*(n*n*15731+789221)+1376312589&2147483647)/2147483647}function Ir(t,e){const n=Math.floor(t),r=Math.floor(e),o=e-r,i=Lr(t-n),a=Lr(o),s=Rr(n,r),l=Rr(n+1,r),c=Rr(n,r+1),d=Rr(n+1,r+1);return zr(zr(s,l,i),zr(c,d,i),a)}function Pr(t,e){return(.5*Ir(t,e)+.25*Ir(2.1*t,2.1*e)+.125*Ir(4.3*t,4.3*e))/.875}var Tr='"Geist Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace';function Fr(t){const e=("function"==typeof t.getTransform?t.getTransform().a:1)||1;return t=>Math.round(t*e)/e}var Wr={r:111,g:109,b:103},Br={r:143,g:141,b:134};function Or(t,e,n){return Math.min(1,Math.max(0,(t-e)/(n-e)))}function Nr(t,e=.3,n=.95){return e+(n-e)*Math.min(1,Math.max(0,t))}var qr=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function Hr(t,e,n,r,o=0){const i=(qr[(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 Gr={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=>$r(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:f=.2,lightMode:p=!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 ${Tr}`,t.textBaseline="top";const M=p?Wr:Br;let x=M.r,w=M.g,k=M.b;const S=Fr(t);if(l){const t=Er(l);t&&(x=t.r,w=t.g,k=t.b)}let A=x,C=w,$=k;const E=c?Er(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=Rr(17*t,31*t+7),n=Rr(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*Rr(7*t,13*t+3))*(t%2==0?1:-1),amp:.55+.45*Rr(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=f*Math.exp(-c*c/.06),p=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(p*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=Or(P,.48,.94);if(T<=0)continue;const F=m[Hr(T,m.length,r,e,i.ditherStrength)];if(" "===F)continue;const W=!!E&&P>.86,B=Nr(T);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:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};function Dr(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=Er(i.color??i.accentColor??"")??(i.lightMode?Wr:Br),d=Fr(e),u=o*Math.max(0,i.speed??.35),h=n/r;e.clearRect(0,0,n,r),e.font=`${a}px ${Tr}`,e.textBaseline="top";const f=Array.from(i.chars||" .:-=+*#%@");for(let o=0;o<r;o+=l)for(let a=0;a<n;a+=s){const n=a/r,p=o/r,m=Or(Math.min(1,Math.max(0,t(n,p,h,u))),.06,.72);if(m<=0)continue;const g=f[Hr(m,f.length,Math.round(a/s),Math.round(o/l),i.ditherStrength)];" "!==g&&(e.fillStyle=`rgba(${c.r},${c.g},${c.b},${Nr(m)})`,e.fillText(g,d(a),d(o)))}}var jr=(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)},Ur={id:"caustics",name:"Caustics",description:"Fine pools of light that drift like water across stone.",cellSize:12,speed:1,cursor:!1,mount:t=>$r(t,(t,e,n,r,o,i)=>Dr(jr,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))},Vr=1,Xr=2,Yr=4,Jr=8,Kr={3:"─",12:"│",9:"┌",10:"┐",5:"└",6:"┘",11:"┬",7:"┴",13:"├",14:"┤",15:"┼",[Vr]:"╶",[Xr]:"╴",[Yr]:"╵",[Jr]:"╷"};var _r={id:"circuit",name:"Circuit",description:"Circuit traces with signals running along them.",cellSize:13,speed:1,cursor:!1,mount:t=>$r(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,f=Math.ceil(e/u),p=Math.ceil(n/h),m=Er(s)??{r:0,g:255,b:136},g=Er(a)??{r:255,g:255,b:255},v=(t,e)=>{if(Rr(17*t+1,7*e+2)>l)return 0;let n=0;return t+1<f&&Rr(17*t+1,7*e+2)>.15&&(n|=1),t-1>=0&&Rr(17*(t-1)+1,7*e+2)>.15&&(n|=2),e+1<p&&Rr(17*t+1,7*(e+1)+2)>.15&&(n|=8),e-1>=0&&Rr(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<p;e++)for(let n=0;n<f;n++){const r=v(n,e);if(0===r)continue;const o=Kr[r]??"·",i=(8*y+40*Rr(n,23*e))%f,a=(6*y+40*Rr(17*e,11*n))%p,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*Rr(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??V(i.ink,"#ffffff",.7)}))},Qr=(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)},Zr={id:"contour",name:"Contour",description:"Fine topographic lines with a slow, rolling drift.",cellSize:12,speed:1,cursor:!1,mount:t=>$r(t,(t,e,n,r,o,i)=>Dr(Qr,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))};var to={id:"dna",name:"DNA",description:"Double helices scroll past with base-pair letters.",cellSize:13,speed:1,cursor:!1,mount:t=>$r(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:f=!1}=o,p=.62*i,m=1.4*i,g=Math.ceil(e/p),v=Math.ceil(n/m),y=h??Math.max(1,Math.floor(e/80)),b=g/y,M=Er(l)??{r:0,g:229,b:255},x=Er(c)??{r:255,g:64,b:129},w=Er(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=Rr(31*e+7*r,3),h=a[Math.floor(u*a.length)],f=.5*(Math.sin(o)+1),y=.5*(Math.sin(o+Math.PI)+1);if(t.globalAlpha=.35+.65*f,t.fillStyle=`rgb(${M.r},${M.g},${M.b})`,t.fillText(h,c*p,r*m),d>=0&&d<g){const n=Rr(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*p,r*m)}if(r%3==0){const n=Math.min(c,d),o=Math.max(c,d);if(o-n>1){const i=Rr(17*r+43*e,5),a=s[Math.floor(i*s.length)],l=.25*(f+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*p,r*m)}}}}t.globalAlpha=1}(t,e,n,r,{fontSize:i.fontSize,color:i.ink,color2:i.accent??V(i.ink,"#ffffff",.55),bridgeColor:V(i.ink,"#0c0d0b",.35)}))},eo=(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},no={id:"dune",name:"Dune",description:"Layered sand ridges with slow-moving light and fine grain.",cellSize:12,speed:1,cursor:!1,mount:t=>$r(t,(t,e,n,r,o,i)=>Dr(eo,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))},ro=(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))},oo={id:"etch",name:"Etch",description:"Cut-grain lines follow a slow, sculpted current.",cellSize:12,speed:1,cursor:!1,mount:t=>$r(t,(t,e,n,r,o,i)=>Dr(ro,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))},io=(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)},ao={id:"facet",name:"Facet",description:"Quiet folded planes catch light along their edges.",cellSize:12,speed:1,cursor:!1,mount:t=>$r(t,(t,e,n,r,o,i)=>Dr(io,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))};var so={id:"fire",name:"Fire",description:"A cellular flame rising from the bottom edge.",cellSize:13,speed:1,cursor:!1,mount:t=>$r(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,f=.62*i,p=1.4*i,m=Math.ceil(e/f),g=Math.ceil(n/p),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=Er(s)??{r:255,g:69,b:0},$=Er(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+($.r-C.r)*i|0,l=C.g+($.g-C.g)*i|0,c=C.b+($.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*f,e*p)}t.globalAlpha=1}(t,e,n,i.elapsed,{fontSize:i.fontSize,chars:i.chars,color:i.ink,hotColor:i.accent??V(i.ink,"#ffffff",.6),speed:i.speed}),48)};var lo={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=>$r(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:f=!0,lightMode:p=!1}=i,m=l??(p?"#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(p&&(M=55,x=55,w=55),c){const t=Er(c);t&&(M=t.r,x=t.g,w=t.b)}let k=212,S=255,A=0;const C=Er(m);C&&(k=C.r,S=C.g,A=C.b);const $=r*u;for(let e=0;e<b;e++)for(let n=0;n<y;n++){const r=e/b,i=((r*d-.5*$)%1+1)%1,a=Math.max(0,1-i/h),l=.35*(.5*Rr(3*n,7*e)+.5);let c=0;if(f){const t=n/y-o.x,i=r-o.y,a=Math.sqrt(t*t+i*i);if(a<.18){const t=Rr(11*n+Math.floor(12*$),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,E=p?.82*u:.12*u;t.fillStyle=C?`rgba(${k},${S},${A},${p?.92:.28})`:`rgba(${M},${x},${w},${E})`,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}))},co=(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)},uo={id:"moire",name:"Moiré",description:"Two fine line fields overlap into broad, shifting bands.",cellSize:12,speed:1,cursor:!1,mount:t=>$r(t,(t,e,n,r,o,i)=>Dr(co,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))};var ho={id:"morph",name:"Morph",description:"Every cell shimmers at its own frequencies.",cellSize:14,speed:1,cursor:!1,mount:t=>$r(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"),f=.62*i,p=1.4*i,m=Math.ceil(e/f),g=Math.ceil(n/p);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=Er(s);t&&(v=t.r,y=t.g,b=t.b)}let M=212,x=255,w=0;const k=Er(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*Rr(n*(t+3)+7,e*(t+5)+11),i=Rr(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*f,e*p)}}(t,e,n,r,{fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};var fo={id:"noise",name:"Noise",description:"A slow fractal noise field that warps around the cursor.",cellSize:13,speed:.5,cursor:!0,mount:t=>$r(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:f=.9,mouseWarp:p=.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 ${Tr}`,t.textBaseline="top";const x=m?Wr:Br;let w=x.r,k=x.g,S=x.b;const A=Fr(t);if(c){const t=Er(c);t&&(w=t.r,k=t.g,S=t.b)}let C=w,$=k,E=S;const L=l?Er(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)),P=(t,e)=>{let n=0,r=.5,o=1,i=0;for(let a=0;a<I;a++)n+=Ir(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=p>0?.12*Math.max(0,1-c/p):0,u=Or(.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[Hr(u,g.length,n,e,i.ditherStrength)];if(" "===h)continue;const m=!!L&&u>f,x=Nr(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 po={id:"pulse",name:"Pulse",description:"Rings of characters ripple out from the cursor.",cellSize:14,speed:1,cursor:!0,mount:t=>$r(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:f=!1}=i,p=l??(f?"#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(f&&(y=55,b=55,M=55),c){const t=Er(c);t&&(y=t.r,b=t.g,M=t.b)}let x=0,w=255,k=204;const S=Er(p);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),$=Math.ceil(n/a);for(let e=0;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 p=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)));p+=Math.cos(o*Math.PI*.5)*o}if(p=Math.min(1,p),p<.02)continue;const S=p>.6;t.font=`${a}px monospace`;const C=Math.floor(p*(A.length-1)),$=A[Math.min(C,A.length-1)],E=f?.88*p:.22*p;t.fillStyle=S?`rgba(${x},${w},${k},${Math.min(f?.95:.4,.55*p)})`:`rgba(${y},${b},${M},${E})`,t.fillText($,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 mo={id:"rain",name:"Rain",description:"Columns of falling characters with bright heads.",cellSize:13,speed:1,cursor:!1,mount:t=>$r(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,f=s??(h?"#6b8700":"#d4ff00"),p=.62*i,m=1.4*i,g=Math.ceil(e/p),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=Er(l);t&&(y=t.r,b=t.g,M=t.b)}let x=212,w=255,k=0;const S=Er(f);S&&(x=S.r,w=S.g,k=S.b);const A=v+u;for(let e=0;e<g;e++){if(Rr(17*e,3)>d)continue;const n=(.5+1.5*Rr(31*e,7))*c,o=Rr(13*e,11)*A,i=Math.floor((r*n*7+o)%A),s=e*p;for(let n=0;n<=u;n++){const o=i-(u-n);if(o<0||o>=v)continue;const l=o*m,c=Rr(53*e+Math.floor(5*r+n),7*o),d=a[Math.floor(c*a.length)],f=n/u;if(n===u)t.fillStyle=`rgba(${x},${w},${k},${h?.7:.85})`;else{const e=h?.85*f:.15*f;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 go={id:"silk",name:"Silk",description:"Long ribbons that follow a slow flow field.",cellSize:13,speed:1,cursor:!1,mount:t=>$r(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,f=1.3*i,p=Math.ceil(e/h),m=Math.ceil(n/f);t.clearRect(0,0,e,n),t.font=`${i}px ${Tr}`,t.textBaseline="top";const g=u?Wr:Br;let v=g.r,y=g.g,b=g.b;const M=Fr(t);if(a){const t=Er(a);t&&(v=t.r,y=t.g,b=t.b)}let x=v,w=y,k=b;const S=s?Er(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<p;r++){const i=r/p;let a=0,s=0;for(let t=0;t<c;t++){const e=Rr(13*t,7*t+3),r=1.1+2.4*e,o=.9+2*Rr(29*t,11*t+1),l=e*Math.PI*6,c=(.2+.5*Rr(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),f=Math.sin(i*o*Math.PI*d+n*r*Math.PI*d+A*c*.4);a+=Math.atan2(h+.3*f,u),s+=.5*(u*h+1)}const l=a/c,u=Or(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===Hr(u,2,r,e,o.ditherStrength))continue;const E=C?C[Hr(u,C.length,r,e,o.ditherStrength)]:$[g];if(" "===E)continue;const L=!!S&&u>.85,z=Nr(u);t.fillStyle=L?`rgba(${x},${w},${k},${z})`:`rgba(${v},${y},${b},${z})`,t.fillText(E,M(r*h),M(e*f))}}}(t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink,accentColor:i.accent}))};var vo={id:"stars",name:"Stars",description:"A sparse starfield that twinkles, drifts and leans toward the cursor.",cellSize:14,speed:1,cursor:!0,mount:t=>$r(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,f=l??(h?"#6b8700":"#d4ff00");t.clearRect(0,0,e,n),t.textBaseline="middle",t.textAlign="center";const p=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=Er(c);t&&(v=t.r,y=t.g,b=t.b)}let M=212,x=255,w=0;const k=Er(f);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=Rr(17*o,3)*Math.PI*2,s=(r*(.15+.85*Rr(31*o,7))*d*.22+Rr(13*o,11))%1,l=p+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 f=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(f,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 yo={id:"terrain",name:"Terrain",description:"A side-scrolling landscape drawn in density characters.",cellSize:13,speed:1,cursor:!1,mount:t=>$r(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:f=!0,lightMode:p=!1}=o,m=.62*i,g=1.4*i,v=Math.ceil(e/m),y=Math.ceil(n/g),b=Er(s)??{r:76,g:175,b:80},M=Er(l)??{r:26,g:35,b:126},x=Er(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*Pr((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(f){const o=Rr(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??V(i.ink,"#ffffff",.65),skyColor:V(i.ink,"#0c0d0b",.55)}))},bo=(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))},Mo={id:"veil",name:"Veil",description:"Tall folds of light drifting across a quiet ground.",cellSize:12,speed:1,cursor:!1,mount:t=>$r(t,(t,e,n,r,o,i)=>Dr(bo,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))};var xo={id:"void",name:"Void",description:"A gravity well that spirals characters around the cursor.",cellSize:13,speed:1,cursor:!0,mount:t=>$r(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:f=!1}=i,p=c??(f?"#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(f&&(M=55,x=55,w=55),l){const t=Er(l);t&&(M=t.r,x=t.g,w=t.b)}let k=212,S=255,A=0;const C=Er(p);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 i=(r/v-o.x)*b,a=n-o.y,l=Math.sqrt(i*i+a*a)/u;if(l>1){const n=Rr(3*r,7*e)*Math.max(0,1-3*(l-1));if(n<.62)continue;const o=n*(f?.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*$)))/.07),d=Math.pow(1-l,2.2),h=Math.min(1,d+.6*c);if(h<.06)continue;const p=Math.floor(h*(s.length-1)),y=s[Math.min(s.length-1,p)],C=c>.35||l<.08,E=f?.85*h:.18*h;t.fillStyle=C?`rgba(${k},${S},${A},${f?.95:.38})`:`rgba(${M},${x},${w},${E})`,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 wo={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=>$r(t,(t,e,n,r,o,i)=>{const[a,s,l]=U(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:f=.4,mouseFalloff:p=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,$=u?Er(u):null;t.clearRect(0,0,e,n),t.font=`${a}px ${Tr}`;const E=Fr(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*Pr(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-f)+(Math.max(0,1-y*p)+.5*R)*f+.15*R,P=Math.min(1,Math.max(0,I));let T=P;if(v&&P>.72){const t=Math.floor(8*L),r=Rr(7*n+3*t,11*e+t);r>.88&&(T=Math.min(1,P+4*(r-.88)))}const F=Or(T,.32,.9);if(F<=0)continue;const W=Hr(F,M.length,n,e,i.ditherStrength);if(" "===M[W])continue;const B=Nr(F);t.fillStyle=$&&T>h?`rgba(${$.r},${$.g},${$.b},${B})`:d?d.replace("{a}",String(B)):b?`rgba(111,109,103,${B})`:`rgba(143,141,134,${B})`,t.fillText(M[W],E(n*x),E(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})})},ko=(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))},So={id:"weave",name:"Weave",description:"Interlaced threads with a subtle change in tension.",cellSize:12,speed:1,cursor:!1,mount:t=>$r(t,(t,e,n,r,o,i)=>Dr(ko,t,e,n,r,{ditherStrength:i.ditherStrength,fontSize:i.fontSize,chars:i.chars,lightMode:i.lightMode,color:i.ink}))};export{nt as BEAM_PALETTES,Vt as PILL_TONES,Ee as VOICE_PALETTES,Kn as accordion,Se as artPanel,ke as asciiVideo,Gr as aurora,cr as background,lr as backgroundCharset,pt as beam,ct as beamPalette,ln as blockChart,St as buttonLoading,Ur as caustics,_r as circuit,xn as codeInput,De as commandPalette,Yn as compare,Zr as contour,vt as decode,nr as disintegrate,to as dna,mr as drift,Qn as dropzone,no as dune,oo as etch,ao as facet,be as fieldBackground,so as fire,wr as fluid,b as getFieldBudget,s as getGlobalLook,lo as grid,gr as halftone,ie as imageGenerate,on as likeBurst,uo as moire,ho as morph,$r as mountCanvas,tt as mountSurface,fo as noise,Mt as odometer,hn as pageDissolve,Zt as pill,$e as pricingGlow,ir as pullRefresh,po as pulse,mo as rain,G as resolveColor,y as setFieldBudget,a as setGlobalLook,go as silk,jt as skeleton,Qe as slideToConfirm,vo as stars,Nt as statusOrb,Xn as streamText,l as subscribeGlobalLook,vn as swipeDeck,ee as tabs,yo as terrain,Gn as thinking,On as toastStack,Mo as veil,Ie as voiceOrb,xo as voidWell,wo as wave,So as weave,vr as wordField,xe as wordmark};//# sourceMappingURL=kit.js.map