asciify-engine 4.27.0 → 4.27.1

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.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var t=require("./field.cjs"),e={ascii:{mark:"glyph",charset:" .:-=+*#%@"},blocks:{mark:"glyph",charset:" ░▒▓█"},braille:{mark:"glyph",charset:" ⠁⠃⠇⡇⣇⣧⣷⣿"},dots:{mark:"dot"},lines:{mark:"glyph",charset:" -═╪╬"},cross:{mark:"glyph",charset:" ·+xX#"},diagonal:{mark:"glyph",charset:" /╱╳"},diamond:{mark:"glyph",charset:" ·◇◈◆"},mixed:{mark:"glyph",charset:" .:+/◇#@"},pixel:{mark:"pixel"},mosaic:{mark:"mosaic"},lego:{mark:"lego"},voxel:{mark:"voxel"},disco:{mark:"disco"},dither:{mark:"dither"},hex:{mark:"hex"},led:{mark:"led"},cmyk:{mark:"cmyk"},stipple:{mark:"stipple"},engraving:{mark:"engraving"},crosshatch:{mark:"crosshatch"},woodblock:{mark:"woodblock"},risograph:{mark:"risograph"},pointillism:{mark:"pointillism"}},n=t=>"string"==typeof t&&Object.prototype.hasOwnProperty.call(e,t),r=/\p{L}/u,o=null,a=new Set,i=new Set;var s=12,l=new Set,c=null,d=null,h=0,u=-1e9,p=0,f=0,m=!1,g=!1,x=()=>{const t=d?.timeline?.currentTime;return"number"==typeof t?t:null};var y=()=>"undefined"!=typeof performance?performance.now():Date.now(),v=()=>"number"==typeof innerHeight?innerHeight:0;function M(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-v();return n>0?n:0}function b(){try{const t=d?.querySelectorAll?.("dialog:modal");return t?.length?t[t.length-1]:null}catch{return null}}var w=1e8;function k(t,e){if(t.eager)return void(t.wanted=!0);const n=v(),r=M(t.host,e);!n||r<=2*n?t.wanted=!0:r>3*n&&(t.wanted=!1)}function S(t){let e=!1;for(const n of t)if(n?.target)for(const t of l)t.host===n.target&&(k(t,n.boundingClientRect??void 0),e=!0);e&&B()}var A=()=>B(),C=0,E=0,$=()=>{const t="number"==typeof scrollY?scrollY:0;t!==E&&(C=t>E?1:-1),E=t};function L(t,e){if(!e||!C)return e;return t.getBoundingClientRect().top>0===C>0?e:2*e}var z=null,P=t=>{z!==t&&(z?.removeEventListener?.("close",A,!0),z?.removeEventListener?.("scroll",$,!0),t?.addEventListener?.("close",A,!0),t?.addEventListener?.("scroll",$,{capture:!0,passive:!0}),z=t)},R=new WeakSet,F=0;function T(){F||"function"!=typeof requestIdleCallback||(F=requestIdleCallback(I,{timeout:2e3}))}function I(t){F=0;const e=[...l].filter(t=>!t.live&&t.prewarm&&!R.has(t)).sort((t,e)=>M(t.host)-M(e.host));for(const n of e){if(t.timeRemaining()<2&&!t.didTimeout)return void T();R.add(n);try{n.prewarm()}catch{}}}function W(t){d!==t.doc&&(d=t.doc,l.clear(),h=p=f=C=0,u=-1e9,E="number"==typeof scrollY?scrollY:0),P(d),l.add(t);const e=function(){const t="function"==typeof IntersectionObserver?IntersectionObserver:null;if(!t)return null;if(c?.ctor!==t){c?.list.forEach(t=>t.disconnect()),c={ctor:t,list:["200% 0px","300% 0px","0px"].map(e=>new t(S,{rootMargin:e}))};for(const t of l)c.list.forEach(e=>e.observe(t.host))}return c.list}();e?.forEach(e=>e.observe(t.host)),e?k(t):t.wanted=!0,B(),t.live||T()}function B(e=!1){if(m)g=!0;else{m=!0;try{do{g=!1;const n=y(),r=x();(e||(null===r?n-u>16||n<u:r!==u))&&(u=r??n,p=f=0);for(const t of l)!1===t.host.isConnected&&(t.wanted=!1);for(const t of l)t.live&&!t.wanted&&t.release();const o=[...l].filter(t=>t.live&&!t.shared),a=b(),i=t=>!!a&&!a.contains(t.host),c=t=>M(t.host)+(i(t)?w:0),d=t=>t.eager&&!i(t),m=()=>o.filter(t=>t.live&&!t.shared).map(t=>[t,c(t)+(d(t)?0:1e9)]).sort((t,e)=>e[1]-t[1]);for(let t=o.length-s,e=t>0?m():[];t>0;t--)e.shift()?.[0].release();const k=t.currentFieldContext(),S=1*v(),A=()=>[...l].filter(t=>t.live&&t.shared&&c(t)>S).sort((t,e)=>c(e)-c(t));if(k?.overBudget)for(const t of A()){if(!k.overBudget)break;t.release()}const C=[...l].filter(t=>t.wanted&&!t.live).map(t=>[t,t.eager?-1:c(t)]).map(([t,e])=>[t,e,e>0?L(t.host,e):e]).sort((t,e)=>t[2]-e[2]);let E=0;for(const[t,n]of C){if(!l.has(t)||t.live)continue;if(k&&!k.roomy){const e=A()[0];if(!e||c(e)<=c(t))break;if(e.release(),!k.roomy)break}if(!t.eager&&(p>=4||f>=2)&&(!e||E)){h||(h=requestAnimationFrame(()=>{h=0,B(!0)}));break}if(o.filter(t=>t.live&&!t.shared).length>=s){const e=m()[0]?.[0];if(!e||(d(e)?!t.eager||c(e)<=c(t):!t.eager&&c(e)<=n))break;e.release()}const r=y();t.mount(),p+=y()-r,E++,t.eager||f++,t.live&&!t.shared&&o.push(t)}}while(g)}finally{m=!1}}}var O='ui-monospace, "SF Mono", Menlo, Consolas, monospace',q=new Map;function N(t,e){const{max:n,mean:r}=function(t,e=O){const n=`${e}\0${t}`,r=q.get(n);if(r)return r;let o={max:1,mean:1};try{const n="undefined"==typeof document?null:Object.assign(document.createElement("canvas"),{width:48,height:48}).getContext("2d",{willReadFrequently:!0});if(n&&"function"==typeof n.getImageData){n.font=`500 36px ${e}`,n.textAlign="center",n.textBaseline="middle";const r=t=>{n.clearRect(0,0,48,48),n.fillStyle="#000",n.fillText(t,24,25);const e=n.getImageData(0,0,48,48).data;let r=0;for(let t=3;t<e.length;t+=4)r+=e[t];return r/255},a=t=>[...t].filter(t=>t.trim()).map(r),i=t=>t.reduce((t,e)=>t+e,0)/Math.max(1,t.length),s=a(t),l=a(".:-=+*#%@"),c=r("@");s.length&&c>0&&i(l)>0&&(o={max:Math.max(...s)/c,mean:i(s)/i(l)})}}catch{}return q.set(n,o),o}(t,e.font??O),o=e.glyphScale??.8,a=e.gamma??1,i=e.fontWeight??500;return n>1.15?{glyphScale:Math.max(.3,o*Math.max(.62,n**-.36)),gamma:a,fontWeight:i}:r>1.5?{glyphScale:Math.max(.3,o*r**-.25),gamma:a,fontWeight:i}:n<.85?{glyphScale:Math.min(1.6,o*Math.min(1.3,n**-.3)),gamma:a,fontWeight:n<.6?Math.max(i,700):i}:{glyphScale:o,gamma:a,fontWeight:i}}var H=new WeakMap;function G(t,e){for(const n of H.get(t)?.keys()??[])n.getAttribute("src")!==e&&(n.src=e)}function D(t){const e=H.get(t);H.delete(t),e?.forEach(t=>t())}function j(t,e,n,r,o){const a=document.createElement("img");a.alt="",a.decoding="async",a.setAttribute("aria-hidden","true"),a.setAttribute("style",`${n};object-fit:cover`),a.style.opacity="1",a.dataset.asciiPoster="",a.src=e;const i=t.style.getPropertyValue("position"),s="function"==typeof getComputedStyle&&"static"===getComputedStyle(t).position;s&&t.style.setProperty("position","relative");const l=t.style.getPropertyValue("isolation"),c=/z-index:\s*-1/.test(n)&&"function"==typeof getComputedStyle&&"auto"===getComputedStyle(t).isolation;c&&t.style.setProperty("isolation","isolate"),o?.parentElement===t?t.insertBefore(a,o):t.appendChild(a);let d=!1;const h=()=>{d||(d=!0,a.remove(),H.get(r)?.delete(a),s&&(i?t.style.setProperty("position",i):t.style.removeProperty("position")),c&&(l?t.style.setProperty("isolation",l):t.style.removeProperty("isolation")))},u=H.get(r)??new Map;return u.set(a,h),H.set(r,u),{show(t){a.style.opacity=t?"1":"0"},remove:h}}function U(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}function X(n){const{host:a,kit:s}=n;let d,h=n.canvas,u=null,p=!1,f=!1,m=!1,g=!1,x={},y={},v=n.source,M=!1,b={},w=null,k=null,S=!1,A=null,C=()=>{};const E=!n.ownPoster&&s?.current.poster?j(a,s.current.poster,n.place,s,h):null,$=()=>{if(!o||!1===s?.current.globalLook||"glyph"!==(y.mark??"glyph")&&!n.glyphs||r.test(y.charset??""))return;const t=o.style?e[o.style]:void 0,a=t?.mark??"glyph",i="glyph"===a?o.charset||(t&&"charset"in t?t.charset:void 0):void 0;return t||i?{mark:a,charset:i}:void 0},L=()=>({...n.glyphs?Object.fromEntries(Object.keys(n.glyphs()).map(t=>[t,y[t]]).filter(([,t])=>void 0!==t)):{},mark:y.mark??"glyph",charset:y.charset??" .,:-=+*#%@",glyphScale:y.glyphScale??.8,gamma:y.gamma??1,fontWeight:y.fontWeight??500}),z=t=>{if(!t.charset)return{...L(),mark:t.mark};const e=n.glyphs&&"glyph"!==(y.mark??"glyph")?n.glyphs():{};return{...e,mark:t.mark,charset:t.charset,...N(t.charset,{...y,...e})}},I=()=>{const t=$(),e=t&&`${t.mark}\0${t.charset??""}`;return e===d?null:(d=e,t?z(t):L())},O={host:a,doc:document,eager:!1===s?.current.lazy,wanted:!1,live:!1,poster:!!E||!!n.ownPoster,mount(){if(f||u)return;p&&(h=n.canvas=U(h)),p=!0,y={...n.options(),...x},d=void 0;const e=I();let r;try{r=t.mountGlyphField(h,{...y,...e,...void 0===v?{}:{source:v},onError:()=>{u===r&&q()}})}catch{return void q()}u=r,O.live=!0,O.shared=t.isSharedFieldCanvas(h);const o=h;if(O.shared)C=()=>{};else{let t=0;const e=()=>{u===r&&(E?.show(!0),clearTimeout(t),t=setTimeout(()=>{u===r&&h===o&&(O.release(),B())},1e3))},n=()=>{clearTimeout(t),requestAnimationFrame(()=>requestAnimationFrame(()=>{u===r&&E?.show(!1)}))};o.addEventListener?.("webglcontextlost",e),o.addEventListener?.("webglcontextrestored",n),C=()=>{clearTimeout(t),o.removeEventListener?.("webglcontextlost",e),o.removeEventListener?.("webglcontextrestored",n)}}M&&r.pause(),r.ready.then(()=>{u===r&&(S=!0,E?.show(!1),w?.(),w=k=null)},()=>{}),n.onMount?.(r,h)},release(){if(!u)return;const t=u;u=null,O.live=!1,S=!1,C(),A?.clear(),A=null,b=t.settings,t.destroy(),O.shared?f||(h.width=h.width,p=!1):((t=>{try{const e=t.getContext("webgl2");e&&!e.isContextLost?.()&&e.getExtension("WEBGL_lose_context")?.loseContext()}catch{}})(h),f||(h=n.canvas=U(h),p=!1)),E?.show(!0),n.onRelease?.()},prewarm(){if(f||u)return;y={...n.options(),...x};const e=$();t.prewarmGlyphAtlas(h,{...y,...e?z(e):{}})}};function q(){m||(m=!0,H(),g||n.onFail())}function H(){f||(f=!0,O.release(),function(t){l.delete(t)&&([...l].some(e=>e.host===t.host)||c?.list.forEach(e=>e.unobserve(t.host)),!l.size&&c&&(c.list.forEach(t=>t.disconnect()),c=null),l.size||(P(null),F&&"function"==typeof cancelIdleCallback&&cancelIdleCallback(F),F=0),B())}(O),i.delete(G),h.remove(),m?E?.show(!0):E?.remove())}const G={relook(){u||(t=>{R.delete(t),l.has(t)&&T()})(O);const t=I();if(!t||!u)return;const e=u,r=S&&!(s?.current.reducedMotion??("function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches));A?.clear(),A=null,r&&(e.redraw(),A=function(t,e){if(!t.width||!t.height||"undefined"==typeof document)return null;const n=document.createElement("canvas");n.width=t.width,n.height=t.height;const r=n.getContext("2d");if(!r||"function"!=typeof n.animate)return null;try{r.drawImage(t,0,0)}catch{return null}n.setAttribute("aria-hidden","true"),n.dataset.asciiSweep="",n.setAttribute("style",e);const o=document.createElement("span");let a,i;o.setAttribute("aria-hidden","true"),o.dataset.asciiSweep="",o.setAttribute("style",`${e};right:auto;width:2px;margin-left:-1px;opacity:0;background:var(--ascii-sweep, #f3ba32);box-shadow:0 0 10px 1px color-mix(in srgb, var(--ascii-sweep, #f3ba32) 40%, transparent)`),t.after(n,o);const s=()=>{a?.cancel(),i?.cancel(),n.remove(),o.remove()};return{clear:s,reveal(){if(!n.isConnected)return;const e={duration:200,delay:40,easing:"cubic-bezier(.23,1,.32,1)",fill:"both"};a=n.animate([{clipPath:"inset(0% 0% 0% 0%)"},{clipPath:"inset(0% 0% 0% 100%)"}],e);const r=t.clientWidth||t.getBoundingClientRect().width;i=o.animate([{transform:"translateX(0px)",opacity:.35},{opacity:.35,offset:.7},{transform:`translateX(${r}px)`,opacity:0}],e),a.onfinish=s}}}(h,n.place)),e.update(t);const o=A;o&&requestAnimationFrame(()=>requestAnimationFrame(()=>{A===o&&u===e?o.reveal():o.clear()}))}};return{field:{get canvas(){return h},get ready(){return u?u.ready:k??(k=new Promise(t=>{w=t}))},get settings(){return u?.settings??b},update(t){if(x={...x,...t},y={...y,...t},!u)return;const e=I(),n=$();u.update(n?{...t,...z(n)}:e?{...t,...e}:t)},setSource:t=>(v=t,u?u.setSource(t):Promise.resolve()),pointer(t,e){u?.pointer(t,e)},redraw(){u?.redraw()},pulse(t){u?.pulse(t)},play(){M=!1,u?.play()},pause(){M=!0,u?.pause()},resize(){u?.resize()},destroy(){H()}},get canvas(){return h},get live(){return!!u},get failed(){return m},start(){i.add(G),g=!0;try{W(O)}finally{g=!1}},destroy:H}}var Y,V,_=(t,e=0,n=1)=>Math.min(n,Math.max(e,t)),J=(t,e)=>{const n=43758.5453*Math.sin(127.1*t+311.7*e);return n-Math.floor(n)},K=(t,e=3)=>1-(1-_(t))**e,Q=(t,e,n)=>{const r=_((n-t)/(e-t));return r*r*(3-2*r)},Z=t=>{if(t<=0)return 0;if(t>=1)return 1;const e=(t,e,n)=>3*e*t*(1-t)**2+3*n*t*t*(1-t)+t**3;let n=0,r=1,o=t;for(let a=0;a<22;a++)o=(n+r)/2,e(o,.16,.3)<t?n=o:r=o;return e(o,1,1)},tt=()=>"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,et={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 nt(t,e,n){let r=(t??"").trim();const o=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/.exec(r);if(o?r=rt(e,o[1])||(o[2]??"").trim():r.startsWith("--")&&(r=rt(e,r)),!r)return n?nt(n,e):null;if(/^#[\da-f]{6}$/i.test(r))return r.toLowerCase();if(/^#[\da-f]{3}$/i.test(r))return`#${[...r.slice(1)].map(t=>t+t).join("")}`.toLowerCase();const a=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(r);if(a)return ot([+a[1],+a[2],+a[3]]);if(void 0===V)try{V="undefined"==typeof document?null:Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0})}catch{V=null}if(!V)return n?nt(n,e):null;V.clearRect(0,0,1,1),V.fillStyle="#000",V.fillStyle=r,V.fillRect(0,0,1,1);const[i,s,l]=V.getImageData(0,0,1,1).data;return ot([i,s,l])}var rt=(t,e)=>"function"==typeof getComputedStyle?getComputedStyle(t).getPropertyValue(e).trim():"",ot=t=>`#${t.map(t=>Math.round(_(t,0,255)).toString(16).padStart(2,"0")).join("")}`,at=t=>{const e=parseInt(t.slice(1,7),16);return[e>>16&255,e>>8&255,255&e]},it=(t,e,n)=>{const r=at(t),o=at(e);return ot(r.map((t,e)=>t+(o[e]-t)*n))};function st(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=nt(e?.color??"",t);if(!r)return"function"==typeof matchMedia&&matchMedia("(prefers-color-scheme: dark)").matches;const[o,a,i]=at(r);return.2126*o+.7152*a+.0722*i>140}function lt(){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 ct(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 dt(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 ht(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 ut=new WeakMap,pt=t=>ut.get(t)?.()??null;function ft(e){const{host:n,layer:r="over",outset:o=0,kit:a}=e;if("undefined"==typeof document)return null;const i=`position:absolute;left:${-o}px;top:${-o}px;width:calc(100% + ${2*o}px);height:calc(100% + ${2*o}px);pointer-events:none;z-index:${"under"===r?-1:"auto"}`;if(!t.isGlyphFieldSupported())return a?.current.poster&&j(n,a.current.poster,i,a),null;const s=lt(),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 h=l.style;h.position="absolute",h.left=h.top=-o+"px",h.width=h.height=`calc(100% + ${2*o}px)`,h.pointerEvents="none",h.zIndex="under"===r?"-1":"",n.appendChild(l);const u=()=>{const t=getComputedStyle(n);w.canvas.style.borderRadius=[t.borderTopLeftRadius,t.borderTopRightRadius,t.borderBottomRightRadius,t.borderBottomLeftRadius].map(t=>o&&/^[\d.]+px$/.test(t)?`${parseFloat(t)+o}px`:t).join(" ")};let p=st(n);const f=()=>nt(e.ink(p),n)??nt(getComputedStyle(n).color,n)??(p?"#d8d6cf":"#1d1d1b");let m=!1,g=!1,x=!0,y=!1,v=-1/0,M=-1/0;const b=t.watchPointer({target:n,move:t=>{M=t.timeStamp},leave(){}}),w=X({host:n,canvas:l,kit:a,place:i,options:()=>({...et,...e.look(),ink:f(),interactionTarget:n,label:""}),onMount:(t,e)=>{ut.set(e,E),e.removeAttribute("role"),e.removeAttribute("aria-label"),t.ready.then(L,()=>{}),L()},onRelease:()=>{m&&t.cancelFieldFrame($),m=!1},onFail:()=>{B(),e.onFail?.()}}),k=w.field;u();const S=()=>!!(e.reducedMotion()??tt()),A=t=>dt(w.canvas,t),C=t=>{const r=w.canvas,a=Math.max(1,r.clientWidth||n.clientWidth+2*o),i=Math.max(1,r.clientHeight||n.clientHeight+2*o),s=e.resolution??1,[l,h]="function"==typeof s?s(a,i):[Math.max(1,Math.round(a*s)),Math.max(1,Math.round(i*s))];c.width===l&&c.height===h||(c.width=l,c.height=h),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,h);let u=!1;try{u=e.paint({pen:d,width:l,height:h,w:a,h:i,scale:l/a,now:t,still:S(),dark:p,box:A})}catch(t){"undefined"!=typeof console&&console.error(t)}return k.setSource(c),y||k.redraw(),u};function E(){const t=w.canvas,r=Math.max(1,t.clientWidth||n.clientWidth+2*o),a=Math.max(1,t.clientHeight||n.clientHeight+2*o),i=e.resolution??1,[s,l]="function"==typeof i?i(r,a):[Math.max(1,Math.round(r*i)),Math.max(1,Math.round(a*i))],c=document.createElement("canvas");c.width=s,c.height=l;const d=c.getContext("2d");if(!d)return null;d.fillStyle="#000",d.fillRect(0,0,s,l);try{e.paint({pen:d,width:s,height:l,w:r,h:a,scale:s/r,now:performance.now(),still:!0,dark:p,box:A})}catch{return null}return c}function $(e){if(m=!1,y||g||!w.live)return;if(e-v<(Y??(Y=(()=>{const t="undefined"==typeof navigator?void 0:navigator;return 1e3/(t&&(t.hardwareConcurrency>0&&t.hardwareConcurrency<=2||t.deviceMemory&&t.deviceMemory<=2||t.connection?.saveData)?30:60)-2})()))*t.ambientFactor()&&e-M>1e3)return m=!0,void t.requestFieldFrame($);v=e;!C(e)||S()||!x||"undefined"!=typeof document&&document.hidden||(m=!0,t.requestFieldFrame($))}function L(){m||y||g||!w.live||(m=!0,t.requestFieldFrame($))}ut.set(l,E);const z="function"==typeof ResizeObserver?new ResizeObserver(()=>{u(),k.resize(),!w.live||y||g||C(performance.now()),L()}):null;z?.observe(n);const P="function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{x=t.isIntersecting,x&&L()},{rootMargin:"64px"}):null;P?.observe(n);const R=t.watchVisibility(()=>{document.hidden||L()});let F=!1;const T=()=>{F=!1,y||(p=st(n),k.update({ink:f()}),e.onTheme?.(),L())},I=t.watchTheme(()=>{F||y||(F=!0,t.requestFieldFrame(T))}),W=t.watchMotionPreference(L);function B(){y||(y=!0,m&&t.cancelFieldFrame($),F&&t.cancelFieldFrame(T),m=F=!1,z?.disconnect(),P?.disconnect(),R(),b(),I(),W(),w.destroy(),s.restore(),c.width=c.height=1)}return w.start(),w.failed?(B(),null):{field:k,get canvas(){return w.canvas},get live(){return w.live},kick:L,refresh(){y||(p=st(n),k.update({...et,...e.look(),ink:f()}),L())},still:S,dark:()=>p,box:A,play(){g&&(g=!1,k.play(),L())},pause(){g=!0,m&&t.cancelFieldFrame($),m=!1,k.pause()},destroy:B}}function mt(t,e,n,r,o=()=>{}){let a=!1;const i={get supported(){return!!t()&&!a},get field(){return a?null:t()?.field??null},update(t){if(a)return;e.current=ht(e.current,t);const r=t.poster;r&&G(e,r),n(e.current)},play(){a||t()?.play()},pause(){a||t()?.pause()},destroy(){a||(a=!0,t()?.destroy(),D(e),o())}};return Object.defineProperties(r,Object.getOwnPropertyDescriptors(i))}var gt={colorful:["#22c55e","#06b6d4","#6366f1","#d946ef","#f43f5e","#f59e0b"],mono:["#ffffff"],ocean:["#22d3ee","#3b82f6","#2dd4bf","#818cf8"],sunset:["#f97316","#f43f5e","#ec4899","#fbbf24"]},xt={palette:"colorful",mode:"rotate",grain:"dots",speed:1,hover:!0,depth:18},yt=["rotate","pulse","progress"],vt=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)},Mt=(t,e,n)=>t.map((t,r)=>t+(e[r]-t)*n),bt=vt("#ff4a4a"),wt=vt("#2fd67b");function kt(t){const e=("string"==typeof t?gt[t]??gt.colorful:t.length?t:gt.colorful).map(vt),n=new Float32Array(1024);for(let t=0;t<256;t++){const r=t/256*e.length,o=Math.floor(r),a=r-o,i=1===e.length?e[0]:Mt(e[o%e.length],e[(o+1)%e.length],a*a*(3-2*a)),s=Math.max(...i,.01);n.set([i[0]/s,i[1]/s,i[2]/s,(.2126*i[0]+.7152*i[1]+.0722*i[2])/s],4*t)}return n}var St=(t,e)=>{const n=(-t%1+1)%1,r=1-n;return Math.max(n<e?(1-n/e)**2.2:0,r<.03?(1-r/.03)**2:0)},At=t=>Math.max(St(t,.3),.75*St(t-.5,.22)),Ct=(t,e)=>t<=e?.42+.4*(t/Math.max(e,.001))**1.6+.38*Math.exp(-(((e-t)/.03)**2)):t-e<.014?1.2*(1-(t-e)/.014)**2:0,Et=(t,e)=>_((t-.68*e)/.07);var $t={duration:800,trigger:"visible",replayOnHover:!0,settle:"glyphs"};function Lt(t,e,n=.82){const r=t.getContext("2d");if(!r)return;const o=t.width,a=t.height,i=r.createImageData(o,a),s=t=>t*t*(3-2*t),l=(t,e)=>{const n=Math.floor(t),r=Math.floor(e),o=s(t-n),a=s(e-r),i=J(n,r),l=J(n+1,r),c=J(n,r+1);return i+(l-i)*o+(c-i)*a+(i-l-c+J(n+1,r+1))*o*a};for(let t=0;t<a;t++)for(let r=0;r<o;r++){const s=.6*l(r/6+2.4*e,t/3.5-.8*e)+.4*l(r/2.5-3*e,t/2),c=Math.min(1,2.4*(1-Math.hypot(2*(r/o-.5),2*(t/a-.5))*n)),d=.72*Math.max(0,s-.42)*Math.max(0,c)*255,h=4*(t*o+r);i.data[h]=i.data[h+1]=i.data[h+2]=d,i.data[h+3]=255}r.putImageData(i,0,0)}var zt={value:0,duration:360,stagger:60,glyphs:"#%*+=-:",format:t=>t.toLocaleString(),face:"text"};function Pt(t,e){const n=(t,e)=>t[t.length-1-e]??"";for(let r=e.length-1;r>=0;r--)if(/\d/.test(n(e,r))&&n(t,r)!==n(e,r))return r;return-1}var Rt={check:!0,shake:!0};function Ft(t,e,n,r,o,a=0){const i=24*n+170;if(e<i){const n=(e-24*t)/170;return n<1?1+Math.floor(J(t+a,Math.floor(e/46))*(n<0?3:9)):0}if(!r||o)return 0;const s=(((e-i)/1250-.07*t)%1+1)%1;return s<.3?1+Math.round(8*Math.sin(Math.PI*(s/.3))):0}var Tt="cubic-bezier(.16, 1, .3, 1)";var It={colourByState:!0,ring:!0},Wt={success:["--ascii-success","#17844a","#3ccf7e"],warning:["--ascii-warning","#9a6700","#f5b83d"],error:["--ascii-error","#c93636","#ff6b6b"]},Bt=120,Ot=280,qt=520,Nt=2*Math.PI,Ht=Nt/1050,Gt=t=>1-(1-t)**4,Dt=t=>`rgb(${255*t} ${255*t} ${255*t})`,jt=t=>t*Ht-Math.PI/2,Ut=(t,e=0)=>78+5*Math.sin(t/1600*Nt)*(1-e);function Xt(t,e,n=78,r=24){t.strokeStyle=Dt(e),t.lineWidth=r,t.beginPath(),t.arc(Bt,Bt,n,0,Nt),t.stroke()}function Yt(t,e,n,r=0,o=1){if(Xt(t,(.3+(n-78)/100)*o,n,24-6*r),r>=1)return void Xt(t,.72*o,n,18);const a=3.4+(Nt-3.4)*r;t.lineCap="round";for(let i=0;i<32;i++){const s=i/32,l=.3+.7*(1-s)**1.6;t.strokeStyle=Dt((l+(.72-l)*r)*o),t.lineWidth=28-6*s+(18-(28-6*s))*r,t.beginPath(),t.arc(Bt,Bt,n,e-(s+1/32)*a,e-s*a),t.stroke()}}function Vt(t,e,n,r=800,o=0,a=!0){if("idle"===e)return void Xt(t,.34);if("loading"===e)return void Yt(t,jt(n),Ut(n));const i=(t=>t<.5?4*t*t*t:1-(-2*t+2)**3/2)(Math.min(1,r/Ot)),s=Math.min(r,Ot),l=o+Ht*(s-s*s/560);a?Yt(t,l,Ut(n,i),i):i<1&&Yt(t,l,Ut(n,i),0,1-i);const c=(r-196)/qt;a&&c>0&&c<1&&Xt(t,.5*(1-c)**2,88+24*c,16-8*c),function(t,e,n,r=30){t.strokeStyle="#fff",t.lineWidth=r,t.lineCap="round",t.lineJoin="round";const o=(e,n)=>{const r=e.slice(1).map((t,n)=>Math.hypot(t[0]-e[n][0],t[1]-e[n][1]));let o=n*r.reduce((t,e)=>t+e,0);t.beginPath(),t.moveTo(e[0][0],e[0][1]);for(let n=1;n<e.length&&o>0;n++){const a=Math.min(1,o/r[n-1]);t.lineTo(e[n-1][0]+(e[n][0]-e[n-1][0])*a,e[n-1][1]+(e[n][1]-e[n-1][1])*a),o-=r[n-1]}t.stroke()};"success"===e?o([[86,122],[110,146],[156,96]],n):"warning"===e?(t.lineWidth=r-4,o([[Bt,74],[Bt,114]],Math.min(1,n/.7)),n>.7&&(t.fillStyle="#fff",t.beginPath(),t.arc(Bt,152,r/2*Gt((n-.7)/.3),0,Nt),t.fill())):(o([[92,92],[148,148]],n),o([[148,92],[92,148]],n))}(t,e,Gt(Math.min(1,Math.max(0,(r-40)/260))),a?24:30)}var _t={blocks:"[data-block]",shimmer:1400,resolve:420,stagger:60,develop:640},Jt=t=>`rgb(${255*t} ${255*t} ${255*t})`,Kt=(t,e,n)=>t<0?0:K((t-e)/n,3),Qt=t=>parseFloat(t)||0;function Zt(t,e,n=1){const r=getComputedStyle(t),o=t.getBoundingClientRect(),a=r.borderTopLeftRadius,i=a.endsWith("%")?Qt(a)/100*Math.min(o.width,o.height):Qt(a);if("text"!==e)return{radius:i/n,lines:[]};const s=Qt(r.fontSize)||14,l="normal"===r.lineHeight?1.2*s:Qt(r.lineHeight),c=Math.min(l,.62*s),d=new Map,h="undefined"!=typeof document&&"function"==typeof document.createRange?document.createRange():null;h?.selectNodeContents(t);for(const t of h?[...h.getClientRects()]:[]){if(!t.width)continue;const e=Math.round((t.top+t.bottom)/2/Math.max(1,l/2)),n=d.get(e);d.set(e,n?{left:Math.min(n.left,t.left),right:Math.max(n.right,t.right),top:Math.min(n.top,t.top),bottom:Math.max(n.bottom,t.bottom)}:{left:t.left,right:t.right,top:t.top,bottom:t.bottom})}const u=[...d.values()].map(t=>{const e=Math.max(t.left,o.left),r=Math.min(t.right,o.right),a=(t.top+t.bottom)/2;return{x:(e-o.left)/n,y:(a-c/2-o.top)/n,w:Math.max(0,r-e)/n,h:c/n}}).filter(t=>t.w>0);return u.length||u.push({x:0,y:(o.height-c)/2/n,w:o.width/n,h:c/n}),{radius:(i||c/2)/n,lines:u}}function te(t){const e=t.dataset.block;return"text"===e||"photo"===e||"avatar"===e?e:"IMG"===t.tagName||"PICTURE"===t.tagName||"VIDEO"===t.tagName?/^50%|^9999px/.test(getComputedStyle(t).borderTopLeftRadius)?"avatar":"photo":"text"}var ee={tone:"neutral",live:!1,indicator:!0,sheen:!0},ne={light:{green:[22,150,82],amber:[214,138,8],red:[214,52,52],neutral:[120,120,114],new:[255,255,255]},dark:{green:[120,240,170],amber:[255,206,110],red:[255,156,156],neutral:[200,200,192],new:[255,255,255]}},re={light:[[.03," "],[.08,"·"],[.13,"•"],[.18,"○"],[.5,"●"],[.56,"◐"],[.62,"◓"],[.68,"◑"],[.74,"◒"],[.8,"●"],[.88,"✧"],[2,"✦"]],dark:[[.02," "],[.06,"✦"],[.1,"✧"],[.2,"·"],[.3,"•"],[.38,"○"],[.64,"●"],[.68,"◐"],[.72,"◓"],[.76,"◑"],[.8,"◒"],[2,"●"]]},oe=t=>Array.from({length:96},(e,n)=>t.find(([t])=>n/95<t)[1]).join(""),ae={light:oe(re.light),dark:oe(re.dark)},ie=["◐","◓","◑","◒"],se=["✧","·","✧","✦","✧","✦"],le=12;var ce=(t,e)=>{return"green"===(n=t.dataset.tone)||"amber"===n||"red"===n||"neutral"===n||"new"===n?t.dataset.tone:e;var n};var de={tabs:'[role="tab"]',duration:440,panels:"hidden",manage:!0};var he=680,ue=12,pe={preview:[{k:.55,blur:6},{k:.8,blur:2.5}],final:{k:1,blur:0}},fe=t=>.5-.5*Math.cos(Math.PI*Math.min(1,Math.max(0,t))),me=async t=>{if("function"==typeof createImageBitmap)return createImageBitmap("string"==typeof t?await(await fetch(t)).blob():t);const e=new Image;return e.crossOrigin="anonymous",e.src="string"==typeof t?t:URL.createObjectURL(t),await e.decode(),e};var ge=t=>new Promise(e=>setTimeout(e,t));function xe(e){const{host:n,layer:r="under",kit:o}=e;if("undefined"==typeof document)return null;const a=`position:absolute;inset:0;width:100%;height:100%;pointer-events:none;border-radius:inherit;z-index:${"under"===r?-1:"auto"}`;if(!t.isGlyphFieldSupported())return o?.current.poster&&!e.ownPoster&&j(n,o.current.poster,a,o),null;const i=lt(),s=document.createElement("canvas");"static"===getComputedStyle(n).position&&i.set(n,"position","relative"),"under"===r&&i.set(n,"isolation","isolate"),s.dataset.asciiKit="",s.setAttribute("style",a),n.appendChild(s);let l=st(n),c=!1;const d=()=>{const t=e.reducedMotion();return!0===t?{speed:0,drift:0,respectReducedMotion:!0}:{respectReducedMotion:!1!==t}},h=()=>nt(e.ink(l),n,l?"#d8d6cf":"#1d1d1b")??"#888888",u=X({host:n,canvas:s,kit:o,place:a,ownPoster:e.ownPoster,glyphs:e.glyphs,source:e.source??null,options:()=>({...et,...e.look(l),...d(),ink:h(),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:()=>{y(),e.onFail?.()}}),p=u.field;let f=!1;const m=()=>{c||(l=st(n),p.update({...et,...e.look(l),...d(),ink:h()}))},g=()=>{f=!1,m()},x=t.watchTheme(()=>{f||c||(f=!0,t.requestFieldFrame(g))});function y(){c||(c=!0,f&&t.cancelFieldFrame(g),x(),u.destroy(),i.restore())}return u.start(),u.failed?(y(),null):{field:p,get canvas(){return u.canvas},get live(){return u.live},dark:()=>l,still:()=>!!(e.reducedMotion()??tt()),refresh:m,destroy:y}}function ye(t,e,n,r,o=()=>{}){let a=!1;const i={get supported(){return!!t()&&!a},get field(){return a?null:t()?.field??null},update(r){if(a)return;e.current=ht(e.current,r);const o=r.poster;o&&G(e,o),n(e.current),t()?.refresh()},play(){a||t()?.field.play()},pause(){a||t()?.field.pause()},destroy(){a||(a=!0,o(),t()?.destroy(),D(e))}};return Object.defineProperties(r,Object.getOwnPropertyDescriptors(i))}function ve(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 Me(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 be={preset:"hero",clear:!1,text:"404",ripple:!0},we=28,ke='600 440px "Geist", Arial, sans-serif',Se=()=>"number"==typeof innerWidth&&innerWidth<760,Ae=t=>({mark:"glyph",scene:"drift",levels:"auto",charset:" .:+*#",font:'"Geist Mono", ui-monospace, monospace',fontWeight:400,cellSize:10,cellAspect:.62,glyphScale:.86,color:"ink",shade:0,hover:"trail",trail:{strength:.9,radius:.32},...t}),Ce={mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:7,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.4,fit:"contain",clear:!1,focus:{x:.5,y:.5},drift:.8,speed:.7,levels:"auto",hover:"trail",trail:{strength:1,radius:.42}};var Ee=[...Array.from({length:10},(t,e)=>(e+1)/10),1,1,1,...Array.from({length:14},(t,e)=>1-(e+1)/14)];function $e(t,e,n,r){const o=e.getContext("2d");o.globalAlpha=1,o.fillStyle="#000",o.fillRect(0,0,e.width,e.height);for(const e of n){const n=Math.min(1,Math.max(0,(r-e.lag*(1-r))/(1-.5*e.lag))),a=n*n*(3-2*n);o.globalAlpha=1-.72*a,o.drawImage(t,e.x,e.y,we,we,e.x+e.dx*a,e.y+e.dy*a,we,we)}o.globalAlpha=1}var Le={font:'Georgia, "Times New Roman", serif',fontWeight:600};var ze="position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit;pointer-events:none";var Pe={saving:null,font:'"Geist", Arial, sans-serif'};function Re(t,e,n,r=Pe.font){const o=Math.max(2,Math.round(2*t.offsetWidth)),a=Math.max(2,Math.round(2*t.offsetHeight)),{canvas:i,pen:s}=ve(o,a),l=s.createRadialGradient(o,0,0,o,0,.52*Math.hypot(o,a));l.addColorStop(0,"rgb(150 150 150)"),l.addColorStop(.4,"rgb(64 64 64)"),l.addColorStop(1,"rgb(0 0 0)"),s.fillStyle=l,s.fillRect(0,0,o,a);const c=e?function(t,e){const n=t.getBoundingClientRect(),r=n.height?t.offsetHeight/n.height:1,o=e?.getBoundingClientRect().top??n.top+n.height;let a=e;for(;a&&a.parentElement!==t;)a=a.parentElement;let i=n.top;for(const e of Array.from(t.children)){if(e===a)break;if(void 0!==e.dataset?.asciiKit)continue;const t=e.getBoundingClientRect();t.height&&(i=Math.max(i,t.top+t.height))}return{middle:((i+o)/2-n.top)*r,height:(o-i)*r}}(t,n):null;if(e&&c&&c.height>=30){const t=Math.min(2*c.height*.9,.34*o),n=o-.07*o,a=2*c.middle+.04*t;s.font=`600 ${t}px ${r}`,s.letterSpacing=.04*-t+"px",s.textAlign="right",s.textBaseline="middle",s.lineJoin="round",s.lineWidth=.28*t,s.strokeStyle="rgb(0 0 0 / .85)",s.strokeText(e,n,a),s.fillStyle="#fff",s.fillText(e,n,a)}return i}var Fe={aurora:["#2ee6c8","#9d7bff","#ff6fb5"],brand:["#ffb000","#ffd84d"]},Te={palette:"aurora",swell:!0},Ie=t=>"mono"===t?[]:"string"==typeof t?[...Fe[t]??Fe.aurora]:[...t];function We(t,e){if(1===t.length)return t[0];const n=_(e)*(t.length-1),r=Math.min(t.length-2,Math.floor(n)),o=n-r,[a,i]=[t[r],t[r+1]].map(t=>[1,3,5].map(e=>parseInt(t.slice(e,e+2),16)||0));return`rgb(${a.map((t,e)=>Math.round(t+(i[e]-t)*o)).join(" ")})`}var Be=t=>{const e=Math.round(255*Math.min(1,Math.max(0,t)));return`rgb(${e} ${e} ${e})`},Oe=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},qe=/^(IMG|PICTURE|VIDEO|CANVAS|SVG|svg)$/;function Ne(t,e,n,r){const o=(t,e)=>Math.max(0,Math.min(parseFloat(t.borderTopLeftRadius)||0,e.w/2,e.h/2)),a=[e,...e.querySelectorAll("*")];t.save();for(const i of a){if("CANVAS"===i.tagName&&void 0!==i.dataset?.asciiKit){if(!r||i===r.skip)continue;const e=n(i),o=e.w>0&&e.h>0?pt(i):null;o&&(t.globalCompositeOperation="lighter",t.drawImage(o,e.x,e.y,e.w,e.h),t.globalCompositeOperation="source-over");continue}if(void 0!==i.dataset?.asciiPoster)continue;const a=n(i);if(a.w<=0||a.h<=0)continue;const s=getComputedStyle(i);if("hidden"===s.visibility||"none"===s.display)continue;const l=Oe(s.backgroundColor)>.03,c=(parseFloat(s.borderTopWidth)||0)>0&&Oe(s.borderTopColor)>.1;if(t.beginPath(),i===e)(l||c)&&(t.strokeStyle=Be(.42),t.lineWidth=3,t.roundRect(a.x+1.5,a.y+1.5,a.w-3,a.h-3,o(s,a)),t.stroke());else{if(qe.test(i.tagName)){t.fillStyle=Be(.5),a.w<32&&a.h<32?t.arc(a.x+a.w/2,a.y+a.h/2,.36*Math.min(a.w,a.h),0,2*Math.PI):t.roundRect(a.x,a.y,a.w,a.h,o(s,a)),t.fill();continue}l?(t.fillStyle=Be(.22),t.roundRect(a.x,a.y,a.w,a.h,o(s,a)),t.fill()):c&&(t.strokeStyle=Be(.32),t.lineWidth=1.5,t.roundRect(a.x+.75,a.y+.75,a.w-1.5,a.h-1.5,o(s,a)),t.stroke())}if("INPUT"===i.tagName||"TEXTAREA"===i.tagName){const e=i,n=e.value||e.placeholder||"";n&&He(t,n,a.x+(parseFloat(s.paddingLeft)||0),a.y,a.h,s,e.value?.82:.5)}}!function(t,e,n){if("function"!=typeof document.createTreeWalker)return;const r=document.createTreeWalker(e,4),o=document.createRange(),a=n(e),i=e.getBoundingClientRect(),s=i.width/(e.offsetWidth||i.width||1)||1;let l=0;for(let n=r.nextNode();n&&l<2e3;n=r.nextNode()){const r=n.parentElement;if(!r)continue;const c=getComputedStyle(r);if("hidden"===c.visibility||Ge(r,e))continue;const d=(parseFloat(c.fontWeight)||400)>=600||/^H[1-6]$/.test(r.tagName)?1:.8;for(const e of n.data.matchAll(/\S+/g)){o.setStart(n,e.index),o.setEnd(n,e.index+e[0].length);const r=o.getClientRects()[0];r&&(l++,He(t,e[0],a.x+(r.left-i.left)/s,a.y+(r.top-i.top)/s,r.height/s,c,d))}}o.detach?.()}(t,e,n),t.restore()}function He(t,e,n,r,o,a,i){const s=Math.min(900,(parseFloat(a.fontWeight)||400)+200);t.font=`${a.fontStyle||"normal"} ${s} ${a.fontSize} ${a.fontFamily}`,t.fillStyle=Be(i),t.shadowColor=Be(i),t.shadowBlur=3,t.textBaseline="middle",t.fillText(e,n,r+o/2),t.shadowBlur=0}function Ge(t,e){for(;t&&t!==e;t=t.parentElement){const e=t,n=getComputedStyle(e);if(e.offsetWidth<=1&&e.offsetHeight<=1&&"hidden"===n.overflow)return!0;if("inset(50%)"===n.clipPath||"rect(0px, 0px, 0px, 0px)"===n.clip)return!0}return!1}function De(t,e,n,r,o=2,a){const i=document.createElement("canvas");i.width=Math.max(2,Math.round(n*o)),i.height=Math.max(2,Math.round(r*o));const s=i.getContext("2d",{willReadFrequently:!0});return s?(s.setTransform(o,0,0,o,0,0),s.fillStyle="#000",s.fillRect(0,0,n,r),Ne(s,t,e,a),i):i}function je(t,e=2){const n=t.getContext("2d",{willReadFrequently:!0});if(!n)return[];const r=t.width,o=t.height,a=n.getImageData(0,0,r,o).data,i=[];for(let t=0;t<o/e;t+=6)for(let n=0;n<r/e;n+=4){let s=!1;for(let i=0;i<6*e&&!s;i+=3)for(let l=0;l<4*e&&!s;l+=2){const c=Math.round(n*e+l),d=Math.round(t*e+i);c<r&&d<o&&a[4*(d*r+c)]>10&&(s=!0)}s&&i.push({x:n,y:t,seed:J(n,t)})}return i}function Ue(t,e,n,r,o,a,i=1,s=.32,l=2){for(let c=0;c<n.length;c++){const d=n[c],h=(o-r[c]*(1-s))/s;if(h<=0)continue;const u=h>=1?0:1-h;let p=d.x,f=d.y;if(u>0){const[t,e]=a(d,u);p+=t,f+=e}t.globalAlpha=i*(1-u*u),t.drawImage(e,d.x*l,d.y*l,4*l,6*l,p,f,4,6)}t.globalAlpha=1}function Xe(t){const e=()=>({image:t,width:t.naturalWidth,height:t.naturalHeight});return t.complete&&t.naturalWidth?Promise.resolve(e()):new Promise((n,r)=>{const o=()=>{i(),n(e())},a=()=>{i(),r(new Error(`Could not load ${t.src}`))},i=()=>{t.removeEventListener("load",o),t.removeEventListener("error",a)};t.addEventListener("load",o),t.addEventListener("error",a)})}function Ye(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 Ve(t,e,n,r,o,a,i=.5,s=.5){if(o<=0||a<=0||!e.width||!e.height)return;const l=Math.max(o/e.width,a/e.height),c=o/l,d=a/l;t.drawImage(e.image,(e.width-c)*i,(e.height-d)*s,c,d,n,r,o,a)}function _e(t,e,n=.08){const r=Math.min(1,420/Math.max(1,t.width,t.height)),o=document.createElement("canvas");o.width=Math.max(1,Math.round(t.width*r)),o.height=Math.max(1,Math.round(t.height*r));const a=o.getContext("2d",{willReadFrequently:!0});if(!a)return t;let i;a.drawImage(t.image,0,0,o.width,o.height);try{i=a.getImageData(0,0,o.width,o.height)}catch{return t}const s=i.data,l=new Uint32Array(256),c=s.length/4,d=t=>.2126*s[t]+.7152*s[t+1]+.0722*s[t+2];for(let t=0;t<s.length;t+=4)l[Math.round(d(t))]++;let h=0,u=255,p=0;for(let t=0;t<256;t++)if(p+=l[t],p>=.02*c){h=t;break}p=0;for(let t=255;t>=0;t--)if(p+=l[t],p>=.02*c){u=t;break}const f=Math.max(1,u-h);for(let t=0;t<s.length;t+=4){let r=_((d(t)-h)/f);e&&(r=1-r),s[t]=s[t+1]=s[t+2]=Math.round(255*(n+(1-n)*r)),s[t+3]=255}return a.putImageData(i,0,0),{image:o,width:o.width,height:o.height}}var Je={strong:1,text:.82,meta:.55,tile:.42,icon:.62},Ke=new Set(["IMG","SVG","svg","VIDEO","PICTURE"]),Qe=t=>[...t.children].flatMap(t=>Ke.has(t.tagName)?[t]:[t,...Qe(t)]);function Ze(t,e,n,r){const o=document.createElement("canvas");o.width=Math.max(2,Math.round(2*e)),o.height=Math.max(2,Math.round(2*n));const a=[],i=o.getContext("2d");if(!i)return{canvas:o,rects:a};i.scale(2,2),i.fillStyle="#000",i.fillRect(0,0,e,n);const s=r(t),l=t.getBoundingClientRect(),c=l.width/(t.offsetWidth||l.width||1)||1,d=e=>{for(let n=e;n&&n!==t.parentElement;n=n.parentElement){const t=n.dataset?.paint;if(t&&void 0!==Je[t])return Je[t]}return parseFloat(e?getComputedStyle(e).fontWeight:"400")>=500?1:.7},h=t=>{const e=Math.round(255*_(t));return`rgb(${e} ${e} ${e})`},u=Qe(t),p=[t,...u].filter(t=>{const e=t.dataset?.paint;return"tile"===e||"icon"===e||!e&&Ke.has(t.tagName)&&!t.closest("[data-paint]")});for(const t of p){const e=r(t);if(e.w<=0||e.h<=0)continue;const n=t.dataset?.paint;i.fillStyle=h("icon"===n?Je.icon:Je.tile),i.beginPath(),"icon"===n||"svg"===t.tagName.toLowerCase()?i.arc(e.x+e.w/2,e.y+e.h/2,.4*Math.min(e.w,e.h),0,2*Math.PI):i.roundRect(e.x,e.y,e.w,e.h,Math.min(parseFloat(getComputedStyle(t).borderTopLeftRadius)||0,e.h/2)),i.fill(),a.push(e)}const f=document.createTreeWalker(t,4),m=document.createRange();i.textBaseline="middle";for(let t=f.nextNode();t;t=f.nextNode()){const e=t.parentElement;if(!e||e.closest('[data-paint="none"]'))continue;const n=getComputedStyle(e);i.font=`${n.fontStyle} ${n.fontWeight} ${n.fontSize} ${n.fontFamily}`,i.fillStyle=h(d(e)),i.shadowColor=i.fillStyle,i.shadowBlur=4;for(const e of t.data.matchAll(/\S+/g)){m.setStart(t,e.index),m.setEnd(t,e.index+e[0].length);const n=m.getClientRects()[0];if(!n)continue;const r={x:s.x+(n.left-l.left)/c,y:s.y+(n.top-l.top)/c,w:n.width/c,h:n.height/c};i.fillText(e[0],r.x,r.y+r.h/2),a.push(r)}}return i.shadowBlur=0,m.detach?.(),{canvas:o,rects:a}}function tn(t,e,n,r,o,a,i=1,s=.32){for(let l=0;l<n.length;l++){const c=n[l],d=(o-r[l]*(1-s))/s;if(d<=0)continue;const h=d>=1?0:1-d;let u=c.x,p=c.y;if(h>0){const[t,e]=a(c,h);u+=t,p+=e}t.globalAlpha=i*(1-h*h),t.drawImage(e,2*c.x,2*c.y,8,12,u,p,4,6)}t.globalAlpha=1}function en(t,e){if("undefined"==typeof document||document.getElementById(t))return;const n=document.createElement("style");n.setAttribute("id",t),n.textContent=e,(document.head??document.documentElement).appendChild(n)}var nn={input:"input",rows:'[role="option"]',hotkey:"k",manage:!0,closeOnRun:!0,highlight:!0,ai:"[data-ai]"},rn=200,on=3600,an=40,sn="cubic-bezier(.16, 1, .3, 1)",ln=`\n:where([data-ascii-cmd-highlight]){position:absolute;left:0;top:0;z-index:-1;pointer-events:none;opacity:0;background:var(--ascii-cmd-highlight,color-mix(in oklab,currentColor 7%,transparent));transition:translate 240ms ${sn},width 240ms ${sn},height 240ms ${sn},opacity 160ms ${sn}}\n:where([data-ascii-cmd-highlight][data-on]){opacity:1}\n@media (prefers-reduced-motion:reduce){:where([data-ascii-cmd-highlight]){transition:none}}\n`;var cn={thumb:'[role="slider"]',label:"[data-label]",threshold:.9,resetAfter:0},dn=720,hn=(t,e,n)=>t+(e-t)*n,un=t=>1-(1-t)**3,pn=(t,e,n)=>({x:t,v:0,to:t,k:e,z:n});function fn(t,e,n=.4){const r=2*Math.sqrt(t.k)*t.z,o=Math.max(1,Math.ceil(240*e)),a=e/o;for(let e=0;e<o;e++)t.v+=(-t.k*(t.x-t.to)-r*t.v)*a,t.x+=t.v*a;return!(Math.abs(t.x-t.to)<n&&Math.abs(t.v)<12*n)||(t.x=t.to,t.v=0,!1)}var mn=t=>{t.x=t.to,t.v=0};function gn(t,e){const n=t.filter(([,t])=>e-t<80);if(n.length<2)return 0;const[r,o]=n[0],[a,i]=n[n.length-1];return i>o?(a-r)/(i-o)*1e3:0}var xn={kind:"heart",icon:"svg",manage:!0,outset:40,layer:"under"},yn=t=>1-(1-_(t))**3;function vn(t,e,n,r,o){if(t.beginPath(),"heart"===e){const e=o/29;for(let o=0;o<=56;o++){const a=o/56*Math.PI*2,i=16*Math.sin(a)**3,s=-(13*Math.cos(a)-5*Math.cos(2*a)-2*Math.cos(3*a)-Math.cos(4*a));0===o?t.moveTo(n+i*e,r+(s-2.5)*e):t.lineTo(n+i*e,r+(s-2.5)*e)}}else{const e=.7*o,a=r-o/2,i=n-e/2,s=.12*o;t.moveTo(i,a+s),t.arcTo(i,a,i+s,a,s),t.lineTo(i+e-s,a),t.arcTo(i+e,a,i+e,a+s,s),t.lineTo(i+e,r+o/2),t.lineTo(n,r+o/2-.27*o),t.lineTo(i,r+o/2)}t.closePath()}function Mn(t,e,n,r,o,a){const i=t.createRadialGradient(n,r-.1*o,0,n,r,.62*o);i.addColorStop(0,"#fff"),i.addColorStop(.7,"#e6e6e6"),i.addColorStop(1,"#8c8c8c"),t.globalAlpha=a,t.fillStyle=i,t.shadowColor="#bbb",t.shadowBlur=Math.max(2,.08*o),vn(t,e,n,r,o),t.fill(),t.shadowBlur=0,t.globalAlpha=1}function bn(t,e,n,r,o){const a=n.x+n.w/2,i=n.y+n.h/2,s=n.h,l=1.45*s,c=(t=>t>=1?1:1-Math.exp(-5*t)*Math.cos(9*t))(r/.3),d=(t=>t<.5?4*t**3:1-(-2*t+2)**3/2)(_((r-.42)/.3)),h=d>0?l+(s-l)*d:.7*s+(l-.7*s)*c,u=_((r-.04)/.46);u>0&&u<1&&(t.strokeStyle=(t=>{const e=Math.round(255*_(t));return`rgb(${e} ${e} ${e})`})(.8*(1-u)**1.4),t.lineWidth=2.4-1.2*u,t.lineJoin="round",vn(t,e,a,i,s*(1.2+.5*yn(u))),t.stroke());t.fillStyle="#fff";for(let e=0;e<7;e++){const n=(r-.1-.05*J(e,o))/.5;if(n<=0||n>=1)continue;const l=-Math.PI/2+(e-3)/7*Math.PI*1.7+.3*(J(o+1,e)-.5),c=s*(.75+(.55+.35*J(e,o+2))*yn(n)),d=1.8*(1-.6*n);t.globalAlpha=1-n*n,t.beginPath(),t.arc(a+Math.cos(l)*c*1.15,i+Math.sin(l)*c*.85,d,0,2*Math.PI),t.fill()}t.globalAlpha=1,Mn(t,e,a,i,h,1-_((r-.72)/.28))}var wn={values:[],duration:560},kn=.46;function Sn(t,e){if(!e)return{bar:0,gap:0,left:0};const n=e<=7?.5:.6;let r=Math.max(1,Math.floor(t/e));for(;r>1&&e*r+(e-1)*Math.max(1,Math.round(r*n))>t;)r--;const o=e>1?Math.max(0,Math.min(Math.ceil(r*n*1.6),Math.floor((t-e*r)/(e-1)))):0;return{bar:r,gap:o,left:Math.max(0,Math.floor((t-e*r-(e-1)*o)/2))}}var An={dissolve:300,condense:300},Cn=10,En=16,$n=t=>.5-.5*Math.cos(Math.PI*Math.min(1,Math.max(0,t))),Ln=t=>Z(Math.min(1,Math.max(0,t))),zn=()=>{let t=()=>{};return[new Promise(e=>{t=e}),t]};function Pn(t,e,n,r,o,a=!1){const i=e.width,s=e.height,l=Math.ceil(i/Cn),c=Math.ceil(s/En),d=[],h=[],u=Math.max(...[[0,0],[i,0],[0,s],[i,s]].map(([t,e])=>Math.hypot(t-r.x,e-r.y)))||1,p=function(t,e,n){const r=Rn.get(t);if(r)return r;const o=Object.assign(document.createElement("canvas"),{width:e,height:n}),a=Object.assign(document.createElement("canvas"),{width:t.width,height:t.height}),i=o.getContext("2d"),s=a.getContext("2d"),l={mask:o,maskPen:i,data:i.createImageData(e,n),clip:a,clipPen:s};return Rn.set(t,l),l}(e,l,c),f=p.data.data;let m=0;for(let t=0;t<c;t++)for(let e=0;e<l;e++){const o=e*Cn,i=t*En,s=Math.hypot(o+5-r.x,i+8-r.y)/u*.72+.28*J(o,i),c=a?n-s-.12:s-n;f[4*(t*l+e)+3]=c>0?255:0,c>0&&m++,c>0&&c<.07?d.push([o,i]):c<=0&&c>-.12&&h.push([o,i,-c/.12])}if(m){p.maskPen.putImageData(p.data,0,0);const n=p.clipPen;n.globalCompositeOperation="source-over",n.clearRect(0,0,i,s),n.drawImage(e,0,0),n.globalCompositeOperation="destination-in",n.imageSmoothingEnabled=!1,n.drawImage(p.mask,0,0,l*Cn,c*En),n.globalCompositeOperation="source-over",t.drawImage(p.clip,0,0)}for(const[n,r,i]of h)t.globalAlpha=(1-i)*(a?.7:1),t.drawImage(e,n,r,Cn,En,n+18*(J(r,n+o)-.5)*i,r-10*i*(a?-.6:1),Cn,En);t.globalAlpha=1,t.globalCompositeOperation="lighter",t.globalAlpha=a?.5:1;for(const[n,r]of d)t.drawImage(e,n,r,Cn,En,n,r,Cn,En);t.globalAlpha=1,t.globalCompositeOperation="source-over"}var Rn=new WeakMap;var Fn={cards:"[data-card]",loop:!0,threshold:.4,outset:56},Tn=(t,e,n)=>t+(e-t)*n,In=(t,e,n)=>({x:t,v:0,to:t,k:e,z:n}),Wn=Array.from({length:96},(t,e)=>{const n=43758.5453*Math.sin(127.1*e+311.7);return n-Math.floor(n)});var Bn={length:6,accept:"digits",cells:"[data-cell]"},On=560,qn=t=>{const e=Math.round(255*_(t));return`rgb(${e} ${e} ${e})`};var Nn={max:3,duration:6e3,label:"Notifications",swipe:!0},Hn="cubic-bezier(.16, 1, .3, 1)",Gn=`\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:14px;background:var(--ascii-toast-bg,Canvas);color:var(--ascii-toast-ink,CanvasText);box-shadow:var(--ascii-toast-shadow,0 1px 2px rgb(0 0 0 / .06),0 10px 28px -10px rgb(0 0 0 / .22));z-index:calc(10 - var(--d,0));transform-origin:50% 0;translate:0 calc(var(--d,0) * -12px);scale:calc(1 - var(--d,0) * .05);touch-action:pan-y;transition:translate 380ms ${Hn},scale 380ms ${Hn},opacity 220ms ${Hn},transform 300ms ${Hn},filter 380ms ${Hn}}\n:where(.ascii-toast)::after{content:"";position:absolute;left:0;right:0;top:100%;height:10px}\n:where(.ascii-toast) > *{transition:opacity 200ms ${Hn}}\n:where(.ascii-toast[data-back]) > *{opacity:0}\n:where(.ascii-toasts:not([data-open])) :where(.ascii-toast[data-back]){filter:brightness(calc(1 - var(--d,0) * .04))}\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 420ms ${Hn} both}\n:where(.ascii-toast[data-forming],.ascii-toast[data-gone]) > *{opacity:0;transition:none}\n:where(.ascii-toast[data-gone]){opacity:0;scale:.97;pointer-events:none}\n:where(.ascii-toast[data-swiping]){transition:translate 380ms ${Hn},scale 380ms ${Hn},opacity 220ms ${Hn}}\n@keyframes ascii-toast-in{from{opacity:0;translate:0 14px}}\n:where(.ascii-toast-icon){display:grid;place-items:center;flex:none;width:32px;height:32px;border-radius:9px;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`,Dn=t=>{const[e,n,r]=at(t).map(t=>{const e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4});return.2126*e+.7152*n+.0722*r};var jn={start:!0,stagger:38,roll:520,wave:55,glyphs:"#%*+=-:"},Un=t=>`Thought for ${t}s`;var Xn={caret:!0,settle:60,stagger:18,reasoningLines:2,transition:"flicker",roll:300,glyphs:"#%*+=-:"},Yn="cubic-bezier(.16, 1, .3, 1)",Vn=`\n:where(.ascii-reasoning){display:grid;grid-template-rows:1fr;transition:grid-template-rows 260ms ${Yn},opacity 200ms ${Yn}}\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 ${Yn},opacity 200ms ${Yn}}\n:where(.ascii-reasoning li[data-new]){opacity:0}\n@media (prefers-reduced-motion: reduce){:where(.ascii-reasoning, .ascii-reasoning li){transition:none}}\n`,_n=.7,Jn=t=>[...t.children].filter(t=>"IMG"===t.tagName&&void 0!==t.dataset?.asciiPoster);var Kn=t=>"string"==typeof t?{src:t}:t;var Qn={maxBytes:10485760,develop:900};var Zn={duration:620,collapse:!0,remove:!1},tr=16,er=new WeakMap;var nr={threshold:64},rr=.3;var or={standard:{label:"Classic ASCII",chars:" .:-=+*#%@"},asciify:{label:"Asciify",chars:" .:-=+YCIFSA#@"},minimal:{label:"Minimal",chars:" .:+"},detailed:{label:"Detailed",chars:" .,:;-~=+*xX#%@"},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 ir(t){if(!t)return;if("dots"===t)return" ·∙•●";const e=or[t];return e&&Object.prototype.hasOwnProperty.call(or,t)?e.chars:t.startsWith(" ")?t:" "+t}var sr=(t,e)=>!1===t.cursor?"none":"string"==typeof t.cursor?t.cursor:e;function lr(t,e,n,r){let o=null;if(o=xe({host:t.host,kit:t.kit,layer:"under",glyphs:r&&(()=>r(t.settings())),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:()=>{o=null,t.onFail()}}),!o)return null;const a=o.canvas;return{get field(){return o?.field??null},get canvas(){return o?.canvas??a},refresh(){o?.refresh()},play(){o?.field.play()},pause(){o?.field.pause()},destroy(){o?.destroy(),o=null}}}var cr=()=>"number"==typeof innerWidth&&innerWidth<760,dr={light:"#86847e",dark:"#7c7a74"},hr={light:"#8f8d86",dark:"#64625d"},ur=t=>({font:'"Geist Mono", ui-monospace, monospace',fontWeight:400,cellSize:t.cellSize,cellAspect:.62,glyphScale:.86}),pr=t=>({cellSize:t.cellSize,cellAspect:1,dotScale:.68}),fr={x:.18,y:.2,width:.64,height:.6,feather:.3,shape:"ellipse"};function mr(t){const{scene:e,charset:n,hover:r,middle:o=fr,feather:a=.3,graphite:i=dr}=t,s=t.mark??"glyph";return{id:t.id,name:t.name,description:t.description,cellSize:t.cellSize,speed:t.speed??1,cursor:t.cursor??!0,opacity:t.opacity,mount(l){const c=lr(l,(i,l)=>{const c=((t,e)=>t.mark??(t.charset||t.look?.charset?"glyph":e))(i,s);return{scene:e,color:"ink",shade:0,background:"transparent",vignette:0,speed:i.speed,maxPixelRatio:2,levels:"none",blend:"on",..."dot"===c?{mark:"dot",...pr(i)}:{mark:"glyph",charset:i.charset??n,...ur(i)},hover:sr(i,r),lantern:{radius:.14,strength:.45,trail:.8,follow:9},trail:{strength:.8,radius:.35},fluid:{radius:.09,refraction:.03,glow:.6},clear:i.clear?{element:i.clear,padding:0,feather:a,shape:"ellipse"}:o,...t.tune?.(i,l)}},i,"dot"===s?t=>({...ur(t),charset:n}):void 0);if(!c||!t.extra)return c;const d=t.extra(l,c),h=c.destroy.bind(c);return Object.assign(c,{destroy(){d(),h()}})}}}var gr=mr({id:"swell",name:"Swell",description:"A fine grid that swells in slow rolling waves, quiet in the middle. Dots by default, or characters.",cellSize:10,opacity:.6,scene:"swell",mark:"dot",charset:" .:-=+*#",hover:"lantern",graphite:hr,tune:()=>({scale:cr()?1.5:1,contrast:.62,brightness:-.19,blend:"auto",lantern:{radius:.12,strength:.5,trail:1,follow:8},trail:{strength:.7,radius:.35}})}),xr=mr({id:"drift",name:"Drift",description:"Characters that drift slowly in broad lobes and stay clear around your content.",cellSize:11,scene:"drift",charset:" .:-=+*#",hover:"trail",graphite:hr,middle:!1,feather:.2,tune:t=>({scale:cr()?"dot"===t.mark?1.8:1.6:1,brightness:"dot"===t.mark?0:.05,blend:"auto",lantern:{radius:.16,strength:.35,trail:.6,follow:9},trail:{strength:.9,radius:"dot"===t.mark?.4:.32},...t.clear?{clear:{element:t.clear,padding:32,feather:.2,shape:"rect"}}:{}})}),yr={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=>lr(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?cr()?.1:.4:0,background:"transparent",contrast:1.1,scale:cr()?1.6:1,brightness:cr()&&e?.08:0,vignette:0,speed:t.speed,maxPixelRatio:2,hover:sr(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 a=Math.min(1,25*Math.hypot(r*this.aspect,o)+.06);this.strokes.push({x:t,y:e,dx:r,dy:o,speed:a,fromX:n.x,fromY:n.y}),this.strokes.length>12&&this.strokes.shift()}leave(){this.previous=null}clear(){this.front.fill(0),this.back.fill(0),this.strokes.length=0,this.previous=null,this.energy=0}read(t,e,n,r){const o=Math.max(0,Math.min(this.columns-1.001,e*(this.columns-1))),a=Math.max(0,Math.min(this.rows-1.001,n*(this.rows-1))),i=Math.floor(o),s=Math.floor(a),l=o-i,c=a-s,d=3*(s*this.columns+i),h=d+3*this.columns,u=1-l,p=1-c;r[0]=(t[d]*u+t[d+3]*l)*p+(t[h]*u+t[h+3]*l)*c,r[1]=(t[d+1]*u+t[d+4]*l)*p+(t[h+1]*u+t[h+4]*l)*c,r[2]=(t[d+2]*u+t[d+5]*l)*p+(t[h+2]*u+t[h+5]*l)*c}sample(t,e,n){this.read(this.front,t,e,n)}step(t){if(!this.active)return;const e=Math.max(0,Math.min(.05,t)),n=Math.exp(-e*this.decayRate),r=Math.exp(-e*(this.decayRate+.5)),o=Math.max(1,this.aspect),a=Math.max(1,1/this.aspect);let i=0;for(let t=0;t<this.rows;t++)for(let s=0;s<this.columns;s++){const l=3*(t*this.columns+s),c=s/(this.columns-1),d=t/(this.rows-1),h=this.continuousWake?.65:2,u=c-this.front[l]*e*h,p=d-this.front[l+1]*e*h;this.read(this.front,u,p,this.advected);let f=this.advected[0]*n,m=this.advected[1]*n,g=this.advected[2]*r;for(const t of this.strokes){let e=(c-t.x)*o,n=(d-t.y)*a;if(this.continuousWake){const r=(c-t.fromX)*o,i=(d-t.fromY)*a,s=(t.x-t.fromX)*o,l=(t.y-t.fromY)*a,h=Math.max(0,Math.min(1,(r*s+i*l)/(s*s+l*l||1)));e=r-s*h,n=i-l*h;const u=e*e+n*n;if(u>.0225)continue;const p=Math.exp(-u/.0032),x=Math.hypot(t.dx*o,t.dy*a),y=Math.min(.025,.55*x);f+=(4.2*t.dx-n*y)*p,m+=(4.2*t.dy+e*y)*p,g=Math.max(g,Math.min(.7,18*x)*p);continue}const r=e*e+n*n;if(r>.045)continue;const i=Math.exp(-r/.0075),s=t.speed;f+=(2.8*t.dx-n*s*.16)*i,m+=(2.8*t.dy+e*s*.16)*i,g+=s*i*.3}this.back[l]=Math.max(-.18,Math.min(.18,f)),this.back[l+1]=Math.max(-.18,Math.min(.18,m)),this.back[l+2]=Math.min(.8,g),i=Math.max(i,Math.abs(f),Math.abs(m),g)}[this.front,this.back]=[this.back,this.front],this.strokes.length=0,this.energy=i,this.active||this.clear()}};var Mr=" .:+-=xICA$FY#@",br=.58,wr=72649.5/59542.5;var kr={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,a=0,i=!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=ft({host:e,kit:t.kit,layer:"under",look:()=>{const n=t.settings();return{mark:"glyph",charset:n.charset??Mr,font:'"JetBrains Mono", monospace',fontWeight:400,cellSize:c(e.clientWidth||1,e.clientHeight||1)/br,cellAspect:br,glyphScale:.9,cellFit:"fill",maxPixelRatio:1.5,clear:!!n.clear&&{element:n.clear,padding:8,feather:.22,shape:"ellipse"},color:"ink",shade:0,levels:"none",fit:"cover",gamma:1,contrast:wr,brightness:-.0004316244699164449-.5/Math.max(1,Array.from(n.charset??Mr).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:h,w:u,h:p,now:f,still:m})=>{const g=t.settings(),x=a?Math.min(.05,(f-a)/1e3):1/60;a=f,m||(o+=x*g.speed);const y=u/p;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,i&&(n.leave(),i=!1),n.step(x)}s&&s.width===d&&s.height===h||(s=c.createImageData(d,h));const v=s.data;!function(t,e,n,r,o,a){const i=[0,0,0],s=a.active;for(let l=0;l<n;l++)for(let c=0;c<e;c++){const d=c/e,h=l/n;s&&a.sample(d,h,i);const u=(d-.5-i[0])*r,p=h-.5-i[1],f=u+.22*Math.sin(5.2*p+.17*o)+.15*Math.sin(2.4*u-3.1*p-.1*o),m=p+.19*Math.sin(3.5*u+.13*o),g=Math.hypot(.8*f+.18,1.1*m),x=.5+.5*Math.sin(14*g-2.8*f+1.4*Math.sin(5*m)-.24*o),y=.5+.5*Math.sin(3.6*f-2.9*m+.09*o),v=Math.max(0,Math.min(1,x*x*(.48+.32*y)-.075+.75*i[2])),M=Math.round(255*v),b=4*(l*e+c);t[b]=t[b+1]=t[b+2]=M,t[b+3]=255}}(v,d,h,y,o,n);for(let t=0;t<v.length;t+=4){const e=v[t]<10?0:Math.min(255,1.45*v[t]);v[t]=v[t+1]=v[t+2]=.299*e+e*(185/232)*.587,v[t+3]=255}return c.putImageData(s,0,0),!0}});if(!d)return null;const h=t=>{if(t.target instanceof Element&&t.target.closest("button, a, input, select, summary, textarea"))return i=!0,void d.kick();l.push({x:t.clientX,y:t.clientY}),l.length>6&&l.shift(),d.kick()},u=()=>{i=!0,d.kick()};return e.addEventListener("pointermove",h),e.addEventListener("pointerdown",h),e.addEventListener("pointerleave",u),e.addEventListener("pointercancel",u),{get field(){return d.field},get canvas(){return d.canvas},refresh:()=>d.refresh(),play:()=>{a=0,d.play()},pause:()=>d.pause(),destroy(){e.removeEventListener("pointermove",h),e.removeEventListener("pointerdown",h),e.removeEventListener("pointerleave",u),e.removeEventListener("pointercancel",u),d.destroy()}}}},Sr=mr({id:"caustics",name:"Caustics",description:"Light focused by moving water: fine bright lines that fold, part and meet again.",cellSize:11,scene:"caustics",charset:" .:-=+*#",hover:"lantern",tune:()=>({blend:"off",lantern:{radius:.14,strength:.22,trail:.8,follow:9}})}),Ar=mr({id:"contour",name:"Contour",description:"Survey lines over a slowly shifting terrain, every fifth an index line.",cellSize:11,scene:"contour",charset:" .·-~=",hover:"lantern"}),Cr=mr({id:"ripple",name:"Ripple",description:"Still water: drops land here and there and ring outward, and the pointer drops its own.",cellSize:11,scene:"ripple",charset:" .·:-~=",hover:"none",extra(t,e){const{host:n}=t;let r=-1e9,o=-1e4,a=-1e4;const i=n=>{const i=performance.now();if(!1===t.settings().cursor||i-r<260||Math.hypot(n.clientX-o,n.clientY-a)<48)return;r=i,o=n.clientX,a=n.clientY;const s=e.canvas.getBoundingClientRect();e.field?.pulse({x:n.clientX-s.left,y:n.clientY-s.top,strength:.5})};return n.addEventListener("pointermove",i,{passive:!0}),()=>n.removeEventListener("pointermove",i)}}),Er=mr({id:"halo",name:"Halo",description:"A corona breathes slowly round the middle, its rays turning; the centre stays empty for a headline.",cellSize:11,scene:"halo",charset:" .·:-=+*",hover:"lantern",middle:!1,feather:.12}),$r=mr({id:"interference",name:"Interference",description:"Two fine ring grids from slowly orbiting centres; where they cross, moiré bands open and close.",cellSize:11,scene:"interference",charset:" .:-=+*#",hover:"lantern"}),Lr=mr({id:"mesh",name:"Mesh",description:"Four soft lights on slow paths: a gradient mesh written in characters.",cellSize:11,scene:"mesh",charset:" .:-=+*#%@",hover:"trail"}),zr=mr({id:"cascade",name:"Cascade",description:"Streaks fall in three depths: far ones faint and slow, near ones rare, bright and quick.",cellSize:11,scene:"cascade",charset:" .:;|",hover:"lantern",tune:()=>({blend:"off"}),middle:{x:.22,y:.25,width:.56,height:.5,feather:.3,shape:"ellipse"}}),Pr=mr({id:"constellation",name:"Constellation",description:"Points wander and neighbours close enough are linked by fine lines that come and go.",cellSize:11,scene:"constellation",charset:" .·:+*#",hover:"lantern",tune:()=>({blend:"off"})}),Rr=mr({id:"aurora",name:"Aurora",description:"Curtains of light at three depths hang from the top in tall vertical rays, brightest along their hems.",cellSize:11,scene:"aurora",charset:" .:¦|",hover:"lantern",tune:()=>({blend:"off"}),middle:{x:.2,y:.42,width:.6,height:.5,feather:.3,shape:"ellipse"}}),Fr=mr({id:"halftone",name:"Halftone",description:"The drifting ground drawn as dots, clear around your content.",cellSize:14,scene:"drift",mark:"dot",charset:" .:-=+*#",hover:"lantern",graphite:hr,middle:!1,feather:.2,tune:t=>({scale:cr()?1.8:1,blend:"auto",dotScale:.64,lantern:{radius:.16,strength:.35,trail:.6,follow:9},trail:{strength:.9,radius:.4},...t.clear?{clear:{element:t.clear,padding:32,feather:.2,shape:"rect"}}:{}})}),Tr="#6f6d67",Ir="#8f8d86",Wr={x:-1,y:-1,users:0},Br=t=>{Wr.x=t.clientX,Wr.y=t.clientY};function Or(t,e,n=0){if("undefined"==typeof document)return null;const{host:r}=t,o=document.createElement("canvas");let a=null;try{a=o.getContext("2d")}catch{a=null}if(!a)return null;const i=a,s=lt();"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=st(r),d="";const h=()=>{d=nt(t.ink(c),r,c?Ir:Tr)??Ir;const e=t.settings().accent;l=e?nt(e,r)??void 0:void 0};h();let u=0,p=!0,f=!1,m=!1,g=0,x=0,y=0,v=!1,M=9,b=9,w=1,k=1,S=n;const A={x:.5,y:.5},C=()=>!!(t.reducedMotion()??tt()),E=()=>{const n=t.settings(),r=performance.now(),a={fontSize:n.cellSize,chars:n.charset,ditherStrength:n.dither,lightMode:!c,ink:d,accent:l,elapsed:b,speed:n.speed};for(i.globalAlpha=1,i.globalCompositeOperation="source-over";S>0;S--)e(i,w,k,M,A,a);e(i,w,k,M,A,a),(t=>{if(!t||!t.isConnected)return;const e=dt(o,t);if(!e.w||!e.h)return;const n=.71*e.w+32,r=.71*e.h+32,a=o.width/w||1;i.save(),i.setTransform(a*n,0,0,a*r,a*(e.x+e.w/2),a*(e.y+e.h/2));const s=i.createRadialGradient(0,0,0,0,0,1);s.addColorStop(0,"rgba(0,0,0,1)"),s.addColorStop(.72,"rgba(0,0,0,1)"),s.addColorStop(1,"rgba(0,0,0,0)"),i.globalCompositeOperation="destination-out",i.fillStyle=s,i.fillRect(-1,-1,2,2),i.restore()})(n.clear),y=.9*y+.1*(performance.now()-r),o.dataset.painted=""},$=e=>{if(u=0,m||f||!p||"undefined"!=typeof document&&document.hidden)return void(g=x=0);const n=C(),r=t.settings(),a=x?e-x:17;if(x=e,!n&&y>4.5&&a<12&&(v=!v))return void(u=requestAnimationFrame($));const i=g?Math.min(.05,(e-g)/1e3):0;if(g=e,n||(M+=i*r.speed,b+=i),r.cursor&&Wr.x>=0){const t=o.getBoundingClientRect();t.width&&t.height&&(A.x+=.07*((Wr.x-t.left)/t.width-A.x),A.y+=.07*((Wr.y-t.top)/t.height-A.y))}else r.cursor||(A.x+=.07*(.5-A.x),A.y+=.07*(.5-A.y));E(),n||(u=requestAnimationFrame($))},L=()=>{u||m||f||!p||(u=requestAnimationFrame($))},z=()=>{if(m)return;const t=Math.min(2,"number"==typeof devicePixelRatio&&devicePixelRatio||1);w=Math.max(1,o.clientWidth||r.clientWidth||1),k=Math.max(1,o.clientHeight||r.clientHeight||1),o.width=Math.round(w*t),o.height=Math.round(k*t),i.setTransform(t,0,0,t,0,0),S=n,p&&!f&&E(),L()};z();const P="function"==typeof ResizeObserver?new ResizeObserver(z):null;P?.observe(r);const R="function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{p=t.isIntersecting,g=0,p?L():u&&(cancelAnimationFrame(u),u=0)},{rootMargin:"64px"}):null;R?.observe(r);const F=()=>{g=0,L()};document.addEventListener("visibilitychange",F);const T="function"==typeof matchMedia?matchMedia("(prefers-reduced-motion: reduce)"):null;T?.addEventListener?.("change",F),0===Wr.users++&&"function"==typeof addEventListener&&addEventListener("pointermove",Br,{passive:!0});const I="object"==typeof document.fonts?document.fonts:null,W=()=>{m||!p||f||(E(),L())};I?.addEventListener?.("loadingdone",W),I?.ready?.then(W,()=>{});let B=0;const O=()=>{B||m||(B=requestAnimationFrame(()=>{B=0,m||(c=st(r),h(),C()&&E(),L())}))},q="function"==typeof matchMedia?matchMedia("(prefers-color-scheme: dark)"):null;q?.addEventListener?.("change",O);const N="function"==typeof MutationObserver?new MutationObserver(O):null;for(const t of[document.documentElement,document.body])t&&N?.observe(t,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]});return{field:null,canvas:o,refresh(){m||(c=st(r),h(),C()&&p&&!f&&E(),L())},play(){f&&(f=!1,g=0,L())},pause(){f=!0,u&&cancelAnimationFrame(u),u=0},destroy(){m||(m=!0,u&&cancelAnimationFrame(u),B&&cancelAnimationFrame(B),u=B=0,P?.disconnect(),R?.disconnect(),N?.disconnect(),document.removeEventListener("visibilitychange",F),T?.removeEventListener?.("change",F),q?.removeEventListener?.("change",O),I?.removeEventListener?.("loadingdone",W),0===--Wr.users&&"function"==typeof removeEventListener&&removeEventListener("pointermove",Br),o.remove(),o.width=o.height=0,s.restore())}}}function qr(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 Nr(t){return t*t*t*(t*(6*t-15)+10)}function Hr(t,e,n){return t+(e-t)*n}function Gr(t,e){let n=127*t+311*e;return n^=n>>13,(n*(n*n*15731+789221)+1376312589&2147483647)/2147483647}function Dr(t,e){const n=Math.floor(t),r=Math.floor(e),o=e-r,a=Nr(t-n),i=Nr(o),s=Gr(n,r),l=Gr(n+1,r),c=Gr(n,r+1),d=Gr(n+1,r+1);return Hr(Hr(s,l,a),Hr(c,d,a),i)}function jr(t,e){return(.5*Dr(t,e)+.25*Dr(2.1*t,2.1*e)+.125*Dr(4.3*t,4.3*e))/.875}var Ur='"Geist Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace';function Xr(t){const e=("function"==typeof t.getTransform?t.getTransform().a:1)||1;return t=>Math.round(t*e)/e}var Yr={r:111,g:109,b:103},Vr={r:143,g:141,b:134};function _r(t,e,n){return Math.min(1,Math.max(0,(t-e)/(n-e)))}function Jr(t,e=.3,n=.95){return e+(n-e)*Math.min(1,Math.max(0,t))}var Kr=[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 a=(Kr[(3&r)<<2|3&n]+.5)/16;return Math.min(e-1,Math.max(0,Math.floor(t*(e-1)+a*Math.min(1,Math.max(0,o)))))}var Zr=1,to=2,eo=4,no=8,ro={3:"─",12:"│",9:"┌",10:"┐",5:"└",6:"┘",11:"┬",7:"┴",13:"├",14:"┤",15:"┼",[Zr]:"╶",[to]:"╴",[eo]:"╵",[no]:"╷"};var oo={id:"circuit",name:"Circuit",description:"Circuit traces with signals running along them.",cellSize:13,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,pulseColor:i="#ffffff",color:s="#00ff88",density:l=.38,speed:c=1,lightMode:d=!1}=o,h=.62*a,u=1.4*a,p=Math.ceil(e/h),f=Math.ceil(n/u),m=qr(s)??{r:0,g:255,b:136},g=qr(i)??{r:255,g:255,b:255},x=(t,e)=>{if(Gr(17*t+1,7*e+2)>l)return 0;let n=0;return t+1<p&&Gr(17*t+1,7*e+2)>.15&&(n|=1),t-1>=0&&Gr(17*(t-1)+1,7*e+2)>.15&&(n|=2),e+1<f&&Gr(17*t+1,7*(e+1)+2)>.15&&(n|=8),e-1>=0&&Gr(17*t+1,7*(e-1)+2)>.15&&(n|=4),n};t.clearRect(0,0,e,n),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";const y=r*c;for(let e=0;e<f;e++)for(let n=0;n<p;n++){const r=x(n,e);if(0===r)continue;const o=ro[r]??"·",a=(8*y+40*Gr(n,23*e))%p,i=(6*y+40*Gr(17*e,11*n))%f,s=(1&r||2&r)&&Math.abs(n-a)<1.5,l=(4&r||8&r)&&Math.abs(e-i)<1.5,c=s||l,d=.25+.35*Gr(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*h,e*u)}t.globalAlpha=1}(t,e,n,r,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,pulseColor:a.accent??it(a.ink,"#ffffff",.7)}))};var ao={id:"dna",name:"DNA",description:"Double helices scroll past with base-pair letters.",cellSize:13,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,baseChars:i="ATCG",bridgeChars:s="-=≡",color:l="#00e5ff",color2:c="#ff4081",bridgeColor:d="#88ffcc",speed:h=1,helixCount:u,lightMode:p=!1}=o,f=.62*a,m=1.4*a,g=Math.ceil(e/f),x=Math.ceil(n/m),y=u??Math.max(1,Math.floor(e/80)),v=g/y,M=qr(l)??{r:0,g:229,b:255},b=qr(c)??{r:255,g:64,b:129},w=qr(d)??{r:136,g:255,b:204};t.clearRect(0,0,e,n),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";const k=r*h,S=.35*v;for(let e=0;e<y;e++){const n=v*(e+.5);for(let r=0;r<x;r++){const o=r/x*Math.PI*6-1.8*k,a=n+Math.sin(o)*S,l=n+Math.sin(o+Math.PI)*S,c=Math.round(a),d=Math.round(l);if(c<0||c>=g)continue;const h=Gr(31*e+7*r,3),u=i[Math.floor(h*i.length)],p=.5*(Math.sin(o)+1),y=.5*(Math.sin(o+Math.PI)+1);if(t.globalAlpha=.35+.65*p,t.fillStyle=`rgb(${M.r},${M.g},${M.b})`,t.fillText(u,c*f,r*m),d>=0&&d<g){const n=Gr(53*e+11*r,7),o=i[Math.floor(n*i.length)];t.globalAlpha=.35+.65*y,t.fillStyle=`rgb(${b.r},${b.g},${b.b})`,t.fillText(o,d*f,r*m)}if(r%3==0){const n=Math.min(c,d),o=Math.max(c,d);if(o-n>1){const a=Gr(17*r+43*e,5),i=s[Math.floor(a*s.length)],l=.25*(p+y)+.2;t.globalAlpha=l,t.fillStyle=`rgb(${w.r},${w.g},${w.b})`;for(let e=n+1;e<o;e++)t.fillText(i,e*f,r*m)}}}}t.globalAlpha=1}(t,e,n,r,{fontSize:a.fontSize,color:a.ink,color2:a.accent??it(a.ink,"#ffffff",.55),bridgeColor:it(a.ink,"#0c0d0b",.35)}))};function io(t,e,n,r,o,a={}){if(n<=0||r<=0)return;const i=Math.max(6,a.fontSize??12),s=.62*i,l=1.2*i,c=qr(a.color??a.accentColor??"")??(a.lightMode?Yr:Vr),d=Xr(e),h=o*Math.max(0,a.speed??.35),u=n/r;e.clearRect(0,0,n,r),e.font=`${i}px ${Ur}`,e.textBaseline="top";const p=Array.from(a.chars||" .:-=+*#%@");for(let o=0;o<r;o+=l)for(let i=0;i<n;i+=s){const n=i/r,f=o/r,m=_r(Math.min(1,Math.max(0,t(n,f,u,h))),.06,.72);if(m<=0)continue;const g=p[Qr(m,p.length,Math.round(i/s),Math.round(o/l),a.ditherStrength)];" "!==g&&(e.fillStyle=`rgba(${c.r},${c.g},${c.b},${Jr(m)})`,e.fillText(g,d(i),d(o)))}}var so=(t,e,n,r)=>{const o=7*e+.55*Math.sin(2.2*t+.09*r)+.22*Math.sin(4.8*t-.07*r),a=.5+.5*Math.sin(o);return Math.pow(a,5)*(.35+.65*e)+.08*Math.pow(.5+.5*Math.sin(17*o),3)*a},lo={id:"dune",name:"Dune",description:"Layered sand ridges with slow-moving light and fine grain.",cellSize:12,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>io(so,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))},co=(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))},ho={id:"etch",name:"Etch",description:"Cut-grain lines follow a slow, sculpted current.",cellSize:12,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>io(co,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))},uo=(t,e,n,r)=>{const o=2.8*t+1.8*e+.018*r,a=1.2*t-3.2*e,i=Math.abs(2*(o-Math.floor(o))-1),s=Math.abs(2*(a-Math.floor(a))-1);return.85*Math.pow(Math.min(i,s),1.8)},po={id:"facet",name:"Facet",description:"Quiet folded planes catch light along their edges.",cellSize:12,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>io(uo,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))};var fo={id:"fire",name:"Fire",description:"A cellular flame rising from the bottom edge.",cellSize:13,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,chars:i=" .,:;i+xX#&@",color:s="#ff4500",hotColor:l="#ffe066",intensity:c=.85,wind:d=0,speed:h=1,lightMode:u=!1}=o,p=.62*a,f=1.4*a,m=Math.ceil(e/p),g=Math.ceil(n/f),x=m*g,y="__fire_heat__",v=t.canvas;let M=v[y];M&&M.length===x||(M=new Float32Array(x),v[y]=M);const b=.016*h*.18,w=d*h*.8,k=g-1,S=r*h;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(x);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-b-.02*Math.random()*h)}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]);v[y]=A;const C=qr(s)??{r:255,g:69,b:0},E=qr(l)??{r:255,g:224,b:102};t.clearRect(0,0,e,n),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";for(let e=0;e<g;e++)for(let n=0;n<m;n++){const r=A[e*m+n];if(r<.03)continue;const o=i[Math.min(i.length-1,Math.floor(r*i.length))];if(" "===o)continue;const a=Math.min(1,1.2*r),s=C.r+(E.r-C.r)*a|0,l=C.g+(E.g-C.g)*a|0,c=C.b+(E.b-C.b)*a|0,d=u?1-.3*r:Math.min(1,r+.15);t.globalAlpha=d,t.fillStyle=`rgb(${s},${l},${c})`,t.fillText(o,n*p,e*f)}t.globalAlpha=1}(t,e,n,a.elapsed,{fontSize:a.fontSize,chars:a.chars,color:a.ink,hotColor:a.accent??it(a.ink,"#ffffff",.6),speed:a.speed}),48)};var mo={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=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=12,chars:s="·-=+|/",accentColor:l,color:c,bands:d=3,speed:h=1,bandWidth:u=.12,glitch:p=!0,lightMode:f=!1}=a,m=l??(f?"#6b8700":"#d4ff00"),g=.62*i,x=1.4*i,y=Math.ceil(e/g),v=Math.ceil(n/x);t.clearRect(0,0,e,n),t.font=`${i}px monospace`,t.textBaseline="top";let M=255,b=255,w=255;if(f&&(M=55,b=55,w=55),c){const t=qr(c);t&&(M=t.r,b=t.g,w=t.b)}let k=212,S=255,A=0;const C=qr(m);C&&(k=C.r,S=C.g,A=C.b);const E=r*h;for(let e=0;e<v;e++)for(let n=0;n<y;n++){const r=e/v,a=((r*d-.5*E)%1+1)%1,i=Math.max(0,1-a/u),l=.35*(.5*Gr(3*n,7*e)+.5);let c=0;if(p){const t=n/y-o.x,a=r-o.y,i=Math.sqrt(t*t+a*a);if(i<.18){const t=Gr(11*n+Math.floor(12*E),5*e);c=Math.max(0,1-i/.18)*(t>.5?t-.3:0)}}const h=Math.min(1,l+.8*i+.6*c);if(h<.04)continue;const m=s[Math.floor(h*(s.length-1))],C=i>.55,$=f?.82*h:.12*h;t.fillStyle=C?`rgba(${k},${S},${A},${f?.92:.28})`:`rgba(${M},${b},${w},${$})`,t.fillText(m,n*g,e*x)}}(t,e,n,r,o,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))},go=(t,e,n,r)=>{const o=.12+.06*Math.sin(.1*r),a=Math.sin(68*t),i=Math.sin(68*(t*Math.cos(o)+e*Math.sin(o)));return.8*Math.pow((a+i+2)/4,3)},xo={id:"moire",name:"Moiré",description:"Two fine line fields overlap into broad, shifting bands.",cellSize:12,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>io(go,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))};var yo={id:"morph",name:"Morph",description:"Every cell shimmers at its own frequencies.",cellSize:14,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=14,chars:i=" ·∙•:-=+*#",color:s,accentColor:l,speed:c=.5,harmonics:d=3,lightMode:h=!1}=o,u=l??(h?"#6b8700":"#d4ff00"),p=.62*a,f=1.4*a,m=Math.ceil(e/p),g=Math.ceil(n/f);t.clearRect(0,0,e,n),t.font=`${a}px monospace`,t.textBaseline="top";let x=255,y=255,v=255;if(h&&(x=55,y=55,v=55),s){const t=qr(s);t&&(x=t.r,y=t.g,v=t.b)}let M=212,b=255,w=0;const k=qr(u);k&&(M=k.r,b=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*Gr(n*(t+3)+7,e*(t+5)+11),a=Gr(n*(t+7),e*(t+9)+3)*Math.PI*2,i=1/(t+1);r+=Math.sin(S*o+a)*i}const o=.5*(r/A+1);if(o<.28)continue;const a=(o-.28)/.72,s=i[Math.min(i.length-1,Math.floor(a*i.length))],l=o>.88,c=h?.82*a:.13*a;t.fillStyle=l?`rgba(${M},${b},${w},${h?.92:.28})`:`rgba(${x},${y},${v},${c})`,t.fillText(s,n*p,e*f)}}(t,e,n,r,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var vo={id:"noise",name:"Noise",description:"A slow fractal noise field that warps around the cursor.",cellSize:13,speed:.5,cursor:!0,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=13,chars:s=" .:-=+*#%@",accentColor:l,color:c,octaves:d=4,speed:h=1,scale:u=1,accentThreshold:p=.9,mouseWarp:f=.3,lightMode:m=!1}=a,g=Array.from(s),x=.62*i,y=1.3*i,v=Math.ceil(e/x),M=Math.ceil(n/y);t.clearRect(0,0,e,n),t.font=`${i}px ${Ur}`,t.textBaseline="top";const b=m?Yr:Vr;let w=b.r,k=b.g,S=b.b;const A=Xr(t);if(c){const t=qr(c);t&&(w=t.r,k=t.g,S=t.b)}let C=w,E=k,$=S;const L=l?qr(l):null;L&&(C=L.r,E=L.g,$=L.b);const z=.035*u,P=r*h,R=Math.min(6,Math.max(1,d)),F=(t,e)=>{let n=0,r=.5,o=1,a=0;for(let i=0;i<R;i++)n+=Dr(t*o,e*o)*r,a+=r,r*=.5,o*=2.1;return n/a};for(let e=0;e<M;e++)for(let n=0;n<v;n++){const r=n*z+.06*P,i=e*z*1.3-.04*P,s=n/v-o.x,l=e/M-o.y,c=Math.sqrt(s*s+l*l),d=f>0?.12*Math.max(0,1-c/f):0,h=_r(.5*F(r+d*Math.sin(1.3*P+8*l),i+d*Math.cos(.9*P+8*s))+.5,.7,.83);if(h<=0)continue;const u=g[Qr(h,g.length,n,e,a.ditherStrength)];if(" "===u)continue;const m=!!L&&h>p,b=Jr(h);t.fillStyle=m?`rgba(${C},${E},${$},${b})`:`rgba(${w},${k},${S},${b})`,t.fillText(u,A(n*x),A(e*y))}}(t,e,n,r,o,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var Mo={id:"pulse",name:"Pulse",description:"Rings of characters ripple out from the cursor.",cellSize:14,speed:1,cursor:!0,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=". · ○ ◎ ●",accentColor:l,color:c,rings:d=5,speed:h=1,sharpness:u=4,lightMode:p=!1}=a,f=l??(p?"#007a5e":"#00ffcc");t.clearRect(0,0,e,n),t.textBaseline="middle",t.textAlign="center";const m=e*o.x,g=n*o.y,x=1.6*Math.sqrt(m*m+g*g)+.2*Math.sqrt(e*e+n*n);let y=255,v=255,M=255;if(p&&(y=55,v=55,M=55),c){const t=qr(c);t&&(y=t.r,v=t.g,M=t.b)}let b=0,w=255,k=204;const S=qr(f);S&&(b=S.r,w=S.g,k=S.b);const A=s.replace(/ /g,"").split("");if(0===A.length)return;const C=Math.ceil(e/i),E=Math.ceil(n/i);for(let e=0;e<E;e++)for(let n=0;n<C;n++){const o=n*i+.5*i,a=e*i+.5*i,s=o-m,l=a-g,c=Math.sqrt(s*s+l*l)/x;let f=0;for(let t=0;t<d;t++){const e=(r*h*.38+t/d)%1,n=Math.abs(c-e),o=Math.max(0,1-n*x/(i*(12-u)));f+=Math.cos(o*Math.PI*.5)*o}if(f=Math.min(1,f),f<.02)continue;const S=f>.6;t.font=`${i}px monospace`;const C=Math.floor(f*(A.length-1)),E=A[Math.min(C,A.length-1)],$=p?.88*f:.22*f;t.fillStyle=S?`rgba(${b},${w},${k},${Math.min(p?.95:.4,.55*f)})`:`rgba(${y},${v},${M},${$})`,t.fillText(E,o,a)}t.textAlign="left"}(t,e,n,r,o,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var bo={id:"rain",name:"Rain",description:"Columns of falling characters with bright heads.",cellSize:13,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,chars:i="0123456789ABCDEF@#$&*+=/<>",accentColor:s,color:l,speed:c=1,density:d=.55,tailLength:h=14,lightMode:u=!1}=o,p=s??(u?"#6b8700":"#d4ff00"),f=.62*a,m=1.4*a,g=Math.ceil(e/f),x=Math.ceil(n/m);t.clearRect(0,0,e,n),t.font=`${a}px monospace`,t.textBaseline="top";let y=255,v=255,M=255;if(u&&(y=55,v=55,M=55),l){const t=qr(l);t&&(y=t.r,v=t.g,M=t.b)}let b=212,w=255,k=0;const S=qr(p);S&&(b=S.r,w=S.g,k=S.b);const A=x+h;for(let e=0;e<g;e++){if(Gr(17*e,3)>d)continue;const n=(.5+1.5*Gr(31*e,7))*c,o=Gr(13*e,11)*A,a=Math.floor((r*n*7+o)%A),s=e*f;for(let n=0;n<=h;n++){const o=a-(h-n);if(o<0||o>=x)continue;const l=o*m,c=Gr(53*e+Math.floor(5*r+n),7*o),d=i[Math.floor(c*i.length)],p=n/h;if(n===h)t.fillStyle=`rgba(${b},${w},${k},${u?.7:.85})`;else{const e=u?.85*p:.15*p;t.fillStyle=`rgba(${y},${v},${M},${e})`}t.fillText(d,s,l)}}}(t,e,n,r,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var wo={id:"silk",name:"Silk",description:"Long ribbons that follow a slow flow field.",cellSize:13,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,color:i,accentColor:s,speed:l=.4,layers:c=4,turbulence:d=.8,lightMode:h=!1}=o,u=.62*a,p=1.3*a,f=Math.ceil(e/u),m=Math.ceil(n/p);t.clearRect(0,0,e,n),t.font=`${a}px ${Ur}`,t.textBaseline="top";const g=h?Yr:Vr;let x=g.r,y=g.g,v=g.b;const M=Xr(t);if(i){const t=qr(i);t&&(x=t.r,y=t.g,v=t.b)}let b=x,w=y,k=v;const S=s?qr(s):null;S&&(b=S.r,w=S.g,k=S.b);const A=r*l,C=o.chars?Array.from(o.chars):void 0,E=["-","\\","|","/"];for(let e=0;e<m;e++){const n=e/m;for(let r=0;r<f;r++){const a=r/f;let i=0,s=0;for(let t=0;t<c;t++){const e=Gr(13*t,7*t+3),r=1.1+2.4*e,o=.9+2*Gr(29*t,11*t+1),l=e*Math.PI*6,c=(.2+.5*Gr(41*t,17*t))*(t%2==0?1:-1.3),h=Math.sin(a*r*Math.PI*2+A*c+l),u=Math.cos(n*o*Math.PI*2+A*c*.6+1.7*l),p=Math.sin(a*o*Math.PI*d+n*r*Math.PI*d+A*c*.4);i+=Math.atan2(u+.3*p,h),s+=.5*(h*u+1)}const l=i/c,h=_r(s/c,.54,.74);if(h<=0)continue;const m=(l%Math.PI+Math.PI)%Math.PI,g=Math.round(m/(Math.PI/4))%E.length;if(!C&&o.ditherStrength&&0===Qr(h,2,r,e,o.ditherStrength))continue;const $=C?C[Qr(h,C.length,r,e,o.ditherStrength)]:E[g];if(" "===$)continue;const L=!!S&&h>.85,z=Jr(h);t.fillStyle=L?`rgba(${b},${w},${k},${z})`:`rgba(${x},${y},${v},${z})`,t.fillText($,M(r*u),M(e*p))}}}(t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var ko={id:"stars",name:"Stars",description:"A sparse starfield that twinkles, drifts and leans toward the cursor.",cellSize:14,speed:1,cursor:!0,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=" . · * + ° ★",accentColor:l,color:c,speed:d=1,count:h=180,lightMode:u=!1}=a,p=l??(u?"#6b8700":"#d4ff00");t.clearRect(0,0,e,n),t.textBaseline="middle",t.textAlign="center";const f=e*(.2+.6*o.x),m=n*(.2+.6*o.y),g=.65*Math.sqrt(e*e+n*n);let x=255,y=255,v=255;if(u&&(x=55,y=55,v=55),c){const t=qr(c);t&&(x=t.r,y=t.g,v=t.b)}let M=212,b=255,w=0;const k=qr(p);k&&(M=k.r,b=k.g,w=k.b);const S=s.replace(/ /g,"").split("");if(0!==S.length){for(let o=0;o<h;o++){const a=Gr(17*o,3)*Math.PI*2,s=(r*(.15+.85*Gr(31*o,7))*d*.22+Gr(13*o,11))%1,l=f+Math.cos(a)*s*g,c=m+Math.sin(a)*s*g;if(l<-20||l>e+20||c<-20||c>n+20)continue;const h=Math.max(6,i*(.4+.9*s));t.font=`${h}px monospace`;const p=S[Math.min(S.length-1,Math.floor(s*S.length))],k=s>.72,A=u?.85*s:.2*s;t.fillStyle=k?`rgba(${M},${b},${w},${Math.min(u?.92:.32,2.2*A)})`:`rgba(${x},${y},${v},${A})`,t.fillText(p,l,c)}t.textAlign="left"}}(t,e,n,r,o,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var So={id:"terrain",name:"Terrain",description:"A side-scrolling landscape drawn in density characters.",cellSize:13,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,chars:i=" .,:;+*#@",color:s="#4caf50",skyColor:l="#1a237e",peakColor:c="#e0e0e0",speed:d=1,roughness:h=.55,heightScale:u=.55,stars:p=!0,lightMode:f=!1}=o,m=.62*a,g=1.4*a,x=Math.ceil(e/m),y=Math.ceil(n/g),v=qr(s)??{r:76,g:175,b:80},M=qr(l)??{r:26,g:35,b:126},b=qr(c)??{r:224,g:224,b:224};t.clearRect(0,0,e,n),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";const w=r*d*.4,k=new Array(x);for(let t=0;t<x;t++){const e=(.5*jr((t/x+w)*h*3,.5)+.5)*u;k[t]=Math.floor(e*y)}for(let e=0;e<y;e++)for(let n=0;n<x;n++){const o=y-1-k[n],a=e===o;if(!(e>=o)){if(p){const o=Gr(7*n+Math.floor(.3*w),13*e);if(o>.97){const a=.3*Math.sin(2*r+100*o)+.7;t.globalAlpha=.5*a,t.fillStyle=`rgb(${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=i[Math.min(i.length-1,Math.floor(s*i.length))];if(" "===l&&!a)continue;const c=a?1:Math.max(0,1-4*s),d=v.r+(b.r-v.r)*c|0,h=v.g+(b.g-v.g)*c|0,u=v.b+(b.b-v.b)*c|0;t.globalAlpha=.5+.5*s,t.fillStyle=`rgb(${d},${h},${u})`,t.fillText(a?i[i.length-1]:l,n*m,e*g)}t.globalAlpha=1}(t,e,n,r,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,peakColor:a.accent??it(a.ink,"#ffffff",.65),skyColor:it(a.ink,"#0c0d0b",.55)}))},Ao=(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))},Co={id:"veil",name:"Veil",description:"Tall folds of light drifting across a quiet ground.",cellSize:12,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>io(Ao,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))};var Eo={id:"void",name:"Void",description:"A gravity well that spirals characters around the cursor.",cellSize:13,speed:1,cursor:!0,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=13,chars:s=" ·:;=+*#%@",color:l,accentColor:c,speed:d=1,radius:h=.38,swirl:u=3,lightMode:p=!1}=a,f=c??(p?"#6b8700":"#d4ff00"),m=.62*i,g=1.4*i,x=Math.ceil(e/m),y=Math.ceil(n/g),v=e/n;t.clearRect(0,0,e,n),t.font=`${i}px monospace`,t.textBaseline="top";let M=255,b=255,w=255;if(p&&(M=55,b=55,w=55),l){const t=qr(l);t&&(M=t.r,b=t.g,w=t.b)}let k=212,S=255,A=0;const C=qr(f);C&&(k=C.r,S=C.g,A=C.b);const E=r*d;for(let e=0;e<y;e++){const n=e/y;for(let r=0;r<x;r++){const a=(r/x-o.x)*v,i=n-o.y,l=Math.sqrt(a*a+i*i)/h;if(l>1){const n=Gr(3*r,7*e)*Math.max(0,1-3*(l-1));if(n<.62)continue;const o=n*(p?.28:.04);t.fillStyle=`rgba(${M},${b},${w},${o})`,t.fillText(s[1],r*m,e*g);continue}const c=Math.max(0,1-Math.abs(l-(.15+.12*Math.sin(1.1*E)))/.07),d=Math.pow(1-l,2.2),u=Math.min(1,d+.6*c);if(u<.06)continue;const f=Math.floor(u*(s.length-1)),y=s[Math.min(s.length-1,f)],C=c>.35||l<.08,$=p?.85*u:.18*u;t.fillStyle=C?`rgba(${k},${S},${A},${p?.95:.38})`:`rgba(${M},${b},${w},${$})`,t.fillText(y,r*m,e*g)}}}(t,e,n,r,o,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var $o={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=>Or(t,(t,e,n,r,o,a)=>{const[i,s,l]=at(a.ink);!function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=13,charAspect:s=.62,lineHeightRatio:l=1.3,chars:c=" .:-=+*#%@",baseColor:d=null,accentColor:h,accentThreshold:u=.52,mouseInfluence:p=.4,mouseFalloff:f=2.8,speed:m=1,vortex:g=!0,sparkles:x=!1,breathe:y=!0,lightMode:v=!1}=a,M=Array.from(c),b=i*s,w=i*l,k=Math.ceil(e/b),S=Math.ceil(n/w),A=o.x,C=o.y,E=h?qr(h):null;t.clearRect(0,0,e,n),t.font=`${i}px ${Ur}`;const $=Xr(t);t.textBaseline="top";const L=r*m,z=y?.12*(.5*Math.sin(.22*L)+.5):0;for(let e=0;e<S;e++)for(let n=0;n<k;n++){const r=n/k,o=e/S,i=.045,s=.08*L,l=.06,c=(.5*Math.sin(.08*n+.05*e+.6*L)+.5+(.5*Math.sin(.03*n-.07*e+.4*L)+.5)+(.5*Math.sin(.05*n+.03*e+.8*L)+.5))/3*.45+.35*(.5*jr(n*i+s,e*i*1.4-.7*s)+.5)+.2*(.5*Math.sin((n+.65*e)*l+1.1*L)+.5)+z,h=r-A,m=o-C,y=Math.sqrt(h*h+m*m);let P=0;if(g&&y<.35){const t=Math.atan2(m,h),e=Math.sin(4*t+2.2*L-14*y),n=Math.max(0,1-y/.35);P=e*n*n*.22}const R=c*(1-p)+(Math.max(0,1-y*f)+.5*P)*p+.15*P,F=Math.min(1,Math.max(0,R));let T=F;if(x&&F>.72){const t=Math.floor(8*L),r=Gr(7*n+3*t,11*e+t);r>.88&&(T=Math.min(1,F+4*(r-.88)))}const I=_r(T,.32,.9);if(I<=0)continue;const W=Qr(I,M.length,n,e,a.ditherStrength);if(" "===M[W])continue;const B=Jr(I);t.fillStyle=E&&T>u?`rgba(${E.r},${E.g},${E.b},${B})`:d?d.replace("{a}",String(B)):v?`rgba(111,109,103,${B})`:`rgba(143,141,134,${B})`,t.fillText(M[W],$(n*b),$(e*w))}}(t,e,n,r,o,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,baseColor:`rgba(${i},${s},${l},{a})`,accentColor:a.accent})})},Lo=(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))},zo={id:"weave",name:"Weave",description:"Interlaced threads with a subtle change in tension.",cellSize:12,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>io(Lo,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))};exports.BEAM_PALETTES=gt,exports.KIT_STYLES=e,exports.PILL_TONES=ne,exports.VOICE_PALETTES=Fe,exports.accordion=function(t,e){const n={current:{open:0,duration:420,label:"Images",...e}},r=lt(),o=n.current.images.map(Kn);let a=_(Math.round(n.current.open),0,Math.max(0,o.length-1)),i=0,s=0;const l=o.map((t,e)=>({x:e===a?1:0,v:0})),c=o.map(()=>null),d=o.map(()=>null);let h=null;const u=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=Ye(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});function p(t,e){const r=i?Math.min(.064,(t-i)/1e3):1/60;i=t;const o=5/(Math.max(1,n.current.duration)/1e3),s=Math.max(1,Math.ceil(240*r)),c=r/s;let d=!1;return l.forEach((t,n)=>{const r=n===a?1:0;e&&(t.x=r,t.v=0);for(let e=0;e<s&&(t.x!==r||t.v);e++)t.v+=(-o*o*(t.x-r)-2*o*t.v)*c,t.x+=t.v*c;Math.abs(t.x-r)<.001&&Math.abs(t.v)<.01?(t.x=r,t.v=0):d=!0,f(u[n],t.x)}),d||(i=0),d}function f(t,e){const n=t.style;n.setProperty("--ascii-acc-open",e.toFixed(4)),n.setProperty("--ascii-acc-photo",(h?Q(.15,.75,e):.45+.55*e).toFixed(3)),n.setProperty("--ascii-acc-caption",Q(.6,1,e).toFixed(3))}h=ft({host:t,layer:"under",look:()=>({blend:"coarse",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:()=>{h=null,delete t.dataset.asciiField},onTheme:()=>{c.forEach((t,e)=>{d[e]=t&&h?_e(t,!h.dark()):null}),h?.kick()},paint:({pen:t,still:e,now:n,box:r})=>{const a=p(n,e);return u.forEach((e,n)=>{const a=d[n],i=l[n].x,s=1-Q(.45,.95,i);if(!a||s<=0)return;const c=r(e),h=parseFloat(getComputedStyle(e).borderTopLeftRadius)||0,u=1.04-.04*i;t.save(),t.beginPath(),t.roundRect(c.x,c.y,c.w,c.h,h),t.clip(),t.globalAlpha=s,Ve(t,a,c.x-c.w*(u-1)/2,c.y-c.h*(u-1)/2,c.w*u,c.h*u,o[n].focus?.x,o[n].focus?.y),t.restore()}),a}});const m=()=>{u.forEach((t,e)=>{t.setAttribute("aria-expanded",String(e===a)),t.tabIndex=e===a?0:-1})},g=(t,e=!1)=>{t=_(Math.round(t),0,u.length-1),e&&u[t]?.focus(),t!==a&&(a=t,m(),n.current.onChange?.(t),(()=>{if(h)return void h.kick();if(s||"function"!=typeof requestAnimationFrame)return void(s||p(performance.now(),!0));const t=e=>{s=p(e,!!(n.current.reducedMotion??tt()))?requestAnimationFrame(t):0};s=requestAnimationFrame(t)})())};let x=0,y=0,v=0,M=0,b=0;const w=()=>{x&&clearTimeout(x),x=0},k=u.map((t,e)=>{const n=t=>{if("mouse"!==t.pointerType)return;const n=t.timeStamp||performance.now(),r=Math.max(1,n-v);if(M=v&&r<100?.5*M+Math.abs(t.clientX-y)/r*.5:0,y=t.clientX,v=n,b!==e&&w(),b=e,e!==a)return M<.3?(w(),void g(e)):void(x||(x=setTimeout(()=>{x=0,g(b)},90)));w()},r=()=>{w(),g(e)},o=()=>{t.matches(":focus-visible")&&g(e)},i=t=>{const n={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[t.key],r="Home"===t.key?0:"End"===t.key?u.length-1:void 0!==n?(e+n+u.length)%u.length:null;null!==r&&(t.preventDefault(),g(r,!0))};return t.addEventListener("pointermove",n),t.addEventListener("pointerdown",r),t.addEventListener("click",r),t.addEventListener("focus",o),t.addEventListener("keydown",i),()=>{t.removeEventListener("pointermove",n),t.removeEventListener("pointerdown",r),t.removeEventListener("click",r),t.removeEventListener("focus",o),t.removeEventListener("keydown",i)}}),S=()=>{w(),v=0};t.addEventListener("pointerleave",S),en("ascii-kit-accordion",'\n:where([data-ascii-accordion]){display:flex;gap:6px}\n:where(.ascii-acc-panel){position:relative;flex:calc(1 + 3.2 * var(--ascii-acc-open, 0)) 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;-webkit-tap-highlight-color:transparent}\n:where(.ascii-acc-panel[aria-expanded="true"]){cursor:default}\n:where(.ascii-acc-photo){position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:var(--ascii-acc-photo, 0);scale:calc(1.04 - .04 * var(--ascii-acc-open, 0))}\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:var(--ascii-acc-caption, 0);translate:0 calc(6px - 6px * var(--ascii-acc-caption, 0))}\n:where(.ascii-acc-title){font-size:15px;font-weight:500}\n:where(.ascii-acc-meta){font-size:14px;opacity:.8}\n'),t.dataset.asciiAccordion="",h&&(t.dataset.asciiField="");const A=t.getAttribute("role"),C=t.getAttribute("aria-label");return A||t.setAttribute("role","group"),C||t.setAttribute("aria-label",n.current.label),u.forEach((e,n)=>{f(e,l[n].x),t.appendChild(e)}),m(),u.forEach((t,e)=>{const n=t.querySelector("img");n&&Xe(n).then(t=>{c[e]=t,d[e]=h?_e(t,!h.dark()):null,h?.kick()},()=>{})}),mt(()=>h,n,e=>{C||t.setAttribute("aria-label",e.label),h?.refresh()},{select:g,get open(){return a}},()=>{k.forEach(t=>t()),w(),s&&cancelAnimationFrame(s),t.removeEventListener("pointerleave",S),u.forEach(t=>t.remove()),delete t.dataset.asciiAccordion,delete t.dataset.asciiField,A||t.removeAttribute("role"),C||t.removeAttribute("aria-label"),r.restore()})},exports.artPanel=function(t,e={}){const n={current:{...e}},r=lt(),o=t.querySelector("img"),a=n.current.image??o??null;let i=null;i=a?xe({host:t,look:()=>{const t=n.current;return{mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.3,levels:"auto",fit:"cover",focus:t.focus??{x:.5,y:.4},hover:"trail",trail:{strength:.95,radius:.42},clear:!!t.clear&&{element:t.clear,padding:8,feather:.12,shape:"rect"},...t.look}},ink:()=>n.current.ink??"--ascii-ink-strong",source:a,label:n.current.label??(a instanceof HTMLImageElement&&a.alt||void 0),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{i=null,r.restore()}}):null,i&&o&&a===o&&r.set(o,"opacity","0");let s=0,l=!1;return ye(()=>i,n,()=>{},{pulse:(t,e=1)=>{i&&!i.still()&&Me(i.field,t,e)},shimmer:t=>{const e=i?.field;if(!e||t===l||t&&i.still())return;const n=++s;l=t,t?(async()=>{let t;try{t=await(async()=>{if(a instanceof HTMLImageElement)return a.complete||await a.decode(),a;const t=new Image;return t.crossOrigin="anonymous",t.src=a,await t.decode(),t})()}catch{return}const r=Math.min(1,1400/Math.max(t.naturalWidth,t.naturalHeight,1)),o=Object.assign(document.createElement("canvas"),{width:Math.max(1,Math.round(t.naturalWidth*r)),height:Math.max(1,Math.round(t.naturalHeight*r))}),l=o.getContext("2d"),c=o.width,d=o.height,h=performance.now();for(;n===s&&i?.field===e;){const n=performance.now(),r=-.4*c+1.8*((n-h)/1100%1)*c;l.globalCompositeOperation="source-over",l.drawImage(t,0,0,c,d);const a=l.createLinearGradient(r-.22*c,.3*r,r+.22*c,.3*r+.3*d);a.addColorStop(0,"rgb(0 0 0 / 0)"),a.addColorStop(.5,"rgb(255 255 255 / .42)"),a.addColorStop(1,"rgb(0 0 0 / 0)"),l.globalCompositeOperation="lighter",l.fillStyle=a,l.fillRect(0,0,c,d),await e.setSource(o),await ge(Math.max(0,48-(performance.now()-n)))}})():e.setSource(a)}},()=>{s++,r.restore()})},exports.asciiVideo=function(t,e={}){const n={current:{...e}},r=lt(),o=[],a=t.querySelector("video"),i=n.current.src??a??null,s=()=>n.current.reducedMotion??tt();let l=null,c=0;l=i?xe({host:t,layer:"over",look:()=>({mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.25,levels:"auto",fit:"cover",focus:{x:.5,y:.5},hover:"trail",trail:{strength:.9,radius:.35},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",source:i,label:n.current.label??"Video, drawn in characters",kit:n,ownPoster:!0,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{l=null,r.restore(),f()},onRelease:()=>{h=!1,u(),i instanceof HTMLVideoElement&&i.pause?.()},onMount:()=>{c++&&(l?.field.ready.then(()=>{h=!0,u()}),m&&i instanceof HTMLVideoElement&&i.play?.()?.catch?.(()=>{}))}}):null,l&&i instanceof HTMLVideoElement&&(t.contains(i)&&r.set(i,"opacity","0"),i.muted=!0,i.loop=!0,i.playsInline=!0);let d=null;n.current.poster&&i&&(d=Object.assign(document.createElement("img"),{alt:"",decoding:"async"}),d.className="ascii-video-poster",d.setAttribute("aria-hidden","true"),d.setAttribute("style",`${ze};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 h=!1;const u=()=>{d&&(d.style.opacity=l&&h&&(m||!s())?"0":"1")};let p=null;function f(){!p&&i&&(i instanceof HTMLVideoElement?p=i:(p=document.createElement("video"),p.src=i,p.setAttribute("style",ze),p.setAttribute("aria-label",n.current.label??"Video"),"static"===getComputedStyle(t).position&&r.set(t,"position","relative"),d?t.insertBefore(p,d):t.appendChild(p),o.push(p)),n.current.poster&&!p.poster&&(p.poster=n.current.poster),p.muted=!0,p.loop=!0,p.playsInline=!0,d&&(d.style.opacity="0"),m&&p.play?.()?.catch?.(()=>{}))}let m=n.current.autoplay??!(l?l.still():s());l?(l.field.ready.then(()=>{h=!0,m||l?.field.pause(),u()}),m&&i instanceof HTMLVideoElement&&i.play?.()?.catch?.(()=>{}),u()):f();const g=ye(()=>l,n,t=>{d&&t.poster&&d.getAttribute("src")!==t.poster&&(d.src=t.poster),p&&t.poster&&(p.poster=t.poster)},{toggle:()=>(m?g.pause():g.play(),m),get playing(){return m}},()=>{o.forEach(t=>t.remove()),r.restore()}),x=g.play,y=g.pause;return g.play=()=>{l&&!g.supported||(m=!0,l?x():p?.play?.()?.catch?.(()=>{}),u())},g.pause=()=>{l&&!g.supported||(m=!1,l?y():p?.pause?.(),u())},g},exports.aurora=Rr,exports.background=function(t,e){if(!e||!e.preset||"function"!=typeof e.preset.mount)throw new TypeError("background() needs a preset, such as `aurora` imported from asciify-engine/kit.");const n=e.preset;let r=e.poster;const o=t=>({...t,poster:t.preset===n?r:void 0}),a={current:o({...e})};let i=null,s=!1,l=!1;const c=new Set,d=()=>{const t=a.current,e=t.preset;return{speed:ar(t.speed,e.speed,0,5),cellSize:ar(t.cellSize,e.cellSize,3,96),charset:ir(t.charset),cursor:"none"!==t.look?.hover&&(t.cursor??e.cursor),mark:"glyph"===t.mark||"dot"===t.mark?t.mark:void 0,clear:t.clear??!1,dither:ar(t.dither,0,0,1),accent:t.accent,text:t.text?.trim()||"ASCIIFY",look:t.look}},h=t=>{const e=a.current,n=e.palette;return("string"==typeof n?n:n?.[t?"dark":"light"])??e.color??e.ink},u=()=>String(ar(a.current.opacity,a.current.preset.opacity??1,0,1)),p=()=>!!(a.current.reducedMotion??tt()),f=e=>{let n=null;if(n=a.current.preset.mount({host:t,kit:a,settings:d,ink:h,reducedMotion:()=>a.current.reducedMotion,onFail:()=>{i===n&&(i=null)}}),!n)return null;const r=n.canvas.style;return e&&(r.opacity="0",r.transition="opacity 320ms cubic-bezier(.16, 1, .3, 1)",n.canvas.offsetWidth),r.opacity=u(),s&&n.pause(),n},m={position:t.style.getPropertyValue("position"),isolation:t.style.getPropertyValue("isolation")},g=(e,n)=>{n?t.style.setProperty(e,n):t.style.removeProperty(e)};let x=!1;const y=e=>{x=!0,e.destroy(),i&&!l&&("function"==typeof getComputedStyle&&"static"===getComputedStyle(t).position&&t.style.setProperty("position","relative"),t.style.setProperty("isolation","isolate"))},v=t=>{if(l||!t||"function"!=typeof t.mount||t===a.current.preset)return;a.current=o({...a.current,preset:t});const e=i;i=f(!!e&&!p()),e&&(t=>{if(p())return void y(t);t.canvas.style.transition="opacity 320ms cubic-bezier(.16, 1, .3, 1)",t.canvas.style.opacity="0";const e={run:t,timer:setTimeout(()=>{c.delete(e),y(t)},340)};c.add(e)})(e)};return i=f(!1),{get supported(){return!!i&&!l},get field(){return l?null:i?.field??null},get preset(){return a.current.preset},update(t){if(l||!t)return;const{preset:e,...n}=t;"poster"in n&&(r=n.poster),a.current=o(ht(a.current,n)),n.poster&&a.current.poster&&G(a,n.poster),e&&e!==a.current.preset?v(e):i&&(i.canvas.style.opacity=u(),i.refresh())},play(){!l&&s&&(s=!1,i?.play())},pause(){l||(s=!0,i?.pause())},setPreset:v,destroy(){if(!l){l=!0;for(const t of c)clearTimeout(t.timer),t.run.destroy(),x=!0;c.clear(),i?.destroy(),i=null,x&&(g("position",m.position),g("isolation",m.isolation)),D(a)}}}},exports.backgroundCharset=ir,exports.beam=function(t,e={}){const n={current:{...xt,...e}};let r="idle",o=0,a=kt(n.current.palette),i=!1;const s=()=>"mono"===n.current.palette,l=()=>({..."glyphs"===n.current.grain?{mark:"glyph",charset:" ·.:-+*",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.6,glyphScale:1}:{mark:"dot",cellSize:3.5,cellAspect:1,dotScale:.82},color:s()?"ink":"source",saturation:1.25,shade:.55,contrast:2.4,brightness:.58,...n.current.look}),c=t=>{const e=!t.dark();t.canvas.style.opacity=e?"0.72":"",t.canvas.style.filter=e&&!s()?"brightness(1.45) saturate(.9)":""};let d=null,h=null,u=new Uint8Array(0),p="",f=0,m=null,g=0,x=.62,y=0,v=0,M=0,b=0,w=0,k=0;const S={rotate:0,pulse:0,progress:0};S[n.current.mode]=1;let A=null;A=ft({host:t,look:l,ink:t=>n.current.ink??(t?"#b3b1aa":"#8a8882"),kit:n,reducedMotion:()=>n.current.reducedMotion,onTheme:()=>A&&c(A),onFail:()=>{A=null},resolution:(t,e)=>[Math.max(1,Math.round(t)),Math.max(1,Math.round(e))],paint:e=>{const{pen:s,w:c,h:C,now:E,still:$,dark:L}=e,z=n.current,P=getComputedStyle(t),R=Math.min(t.clientWidth||c,t.clientHeight||C),F=Math.max(2,Math.min(z.depth,Math.min(parseFloat(P.paddingTop)||z.depth,parseFloat(P.paddingLeft)||z.depth)-2)),T=[P.borderTopLeftRadius,P.borderTopRightRadius,P.borderBottomRightRadius,P.borderBottomLeftRadius].map(t=>((t,e)=>t.endsWith("%")?parseFloat(t)/100*e:parseFloat(t)||0)(t??"",R)),I=l(),W="dot"!==I.mark,B=I.cellSize??(W?5:3.5),O=I.cellAspect??(W?.6:1),q=`${c}x${C}:${z.grain}:${F}:${T.join(",")}:${B}:${O}`;if(q!==p){p=q,A.canvas.style.clipPath=`inset(0 round ${T.map(t=>`${t}px`).join(" ")})`;const t=Math.min(globalThis.devicePixelRatio||1,I.maxPixelRatio??2),e=Math.max(2,Math.round(B*t)),n=Math.max(2,Math.round(e*O))/t,r=e/t;d=function(t,e,n,r,o,a,i){const s=Math.ceil(t/n),l=t/2,c=e/2,d=Math.min(l,c),[h,u,p,f]=[0,1,2,3].map(t=>Math.max(0,Math.min(a[t]??a[0]??0,d))),m=new Int32Array(s*Math.ceil(e/r)).fill(-1),g=[],x=[],y=[];for(let t=0;t<m.length;t++){const e=(t%s+.5)*n-l,a=(Math.floor(t/s)+.5)*r-c,d=e<0?a<0?h:f:a<0?u:p,v=Math.abs(e)-l+d,M=Math.abs(a)-c+d,b=-(Math.hypot(Math.max(v,0),Math.max(M,0))+Math.min(Math.max(v,M),0)-d),w=b>0?Math.min(Math.max(0,1-b/Math.max(1,o))**1.7,b/Math.max(.1,i)):0;if(w<.004)continue;m[t]=g.length,g.push(w);const k=Math.atan2(a/Math.max(1,c),e/Math.max(1,l))/(2*Math.PI)+.25,S=k-Math.floor(k);x.push(S),y.push(.78*J(Math.floor(46*S),5)+.22*J(t,9))}const v=Math.max(1,Math.round(t)),M=Math.max(1,Math.round(e)),b=[],w=[];for(let t=0;t<M;t++)for(let e=0;e<v;e++){const o=m[Math.min(s-1,Math.floor((e+.5)/n))+s*Math.floor((t+.5)/r)];o>=0&&(b.push(t*v+e),w.push(o))}return{W:v,H:M,weight:Float32Array.from(g),turn:Float32Array.from(x),crack:Float32Array.from(y),pixel:Int32Array.from(b),owner:Int32Array.from(w)}}(c,C,n,r,F,T,W?Math.min(n,r)/2:(I.dotScale??.82)*n/2),h=s.createImageData(d.W,d.H),u=new Uint8Array(3*d.weight.length)}const N=d,H=h.data,G=N.crack,D=(t,e,n,r,o)=>{u.fill(0);for(let i=0;i<N.weight.length;i++){const s=N.turn[i],l=_(N.weight[i]*t(s,i))*(L?1.12:.8);if(l<.03)continue;const c=4*(255&Math.floor(((s-e)%1+1)%1*256));let d=a[c],h=a[c+1],p=a[c+2],f=a[c+3];const m=o&&L?o(s):0;(r>0||n>0||m>0)&&(r>0&&(d+=(wt[0]-d)*r,h+=(wt[1]-h)*r,p+=(wt[2]-p)*r),n>0&&(d+=(bt[0]-d)*n,h+=(bt[1]-h)*n,p+=(bt[2]-p)*n),m>0&&(d+=(1-d)*m,h+=(1-h)*m,p+=(1-p)*m),f=.2126*d+.7152*h+.0722*p);const g=255*Math.min(1,(l+.12)/2.4/Math.max(f,.01));u[3*i]=d*g,u[3*i+1]=h*g,u[3*i+2]=p*g}H.fill(0);for(let t=0;t<N.pixel.length;t++){const e=4*N.pixel[t],n=3*N.owner[t];H[e]=u[n],H[e+1]=u[n+1],H[e+2]=u[n+2],H[e+3]=255}s.putImageData(h,0,0)};if($){const t="progress"===z.mode?t=>"running"===r||"error"===r?Ct(t,o):.14:t=>("running"===r?.75:.55)*(.7+.3*Math.cos(2*Math.PI*(t-.12)));return"success"===r?D(()=>.62,0,0,.9):"error"===r?D((e,n)=>.5*t(e)*Et(G[n],1),0,.9,0):D(t,0,0,0),!1}const j=f?Math.min(48,E-f):16;f=E,r!==m&&("running"===r&&"running"!==m&&(w=0),g=E,m=r);let U=E-g;"success"===r&&U>2700&&(r=m="idle",o=0,g=E,U=0);const X="running"===r,Y="error"===r,V="success"===r,K=z.hover&&i;for(const t of yt)S[t]+=((t===z.mode?1:0)-S[t])*(1-Math.exp(-j/260));if(Y)v=0;else{const t=(X?1500-500*o:"pulse"===z.mode?9e3:2600)/Math.max(.05,z.speed);v+=(1/t*(K?1.35:1)-v)*(1-Math.exp(-j/320)),x+=v*j,k+=j,y+=j/("pulse"===z.mode?14e3:26e3)*(1-S.progress),(X||V)&&(w+=((V?1:o)-w)*(1-Math.exp(-j/110)))}M+=((K?1:0)-M)*(1-Math.exp(-j/220)),b=Y?.9*Q(0,60,U):b*Math.exp(-j/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=X||V||Y,rt=t=>Z*(S.rotate*At(t-x)+S.pulse*(X||Y?At(t-x):tt*(.78+.22*Math.cos(2*Math.PI*(t-x))))+S.progress*(nt?Ct(t,w):et));if(V){const t=Q(0,260,U),e=_((U-240)/620),n=1-Q(860,1060,U),r=Q(780,1e3,U),o=Q(1350,2450,U),a=(L?.86:.55)*t*(1-r)+.62*r*(1-o),i=1-t*(1-Q(1900,2700,U)*(1-S.progress)),s=t=>{if(U<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 D(t=>Math.max(rt(t)*i,a*(.9+.1*Math.cos(2*Math.PI*(t-.1))),1.3*s(t),S.progress*et*o),y,0,.9*r*(1-o),t=>_(.8*s(t))),!0}if(Y){const t=U<90?1.2:U<170?.1:U<260?1.2:U<340?.1:1,e=Q(380,1150,U),n=1-.5*Q(700,1500,U),r=Math.floor(U/50);return D((o,a)=>{const i=Et(G[a],e);return i<=0?0:rt(o)*t*i*n*(1-1.4*e*(1-e)*J(a,r))},y,b,0),U<1600||Math.abs(M-(K?1:0))>.01}return D(rt,y,b,0),!0}});const C=()=>{i||(i=!0,A?.kick())},E=()=>{i=!1,A?.kick()},$=t=>{i=t.target?.matches?.(":focus-visible")??!1,A?.kick()};A&&(c(A),t.addEventListener("pointerenter",C),t.addEventListener("pointermove",C),t.addEventListener("pointerleave",E),t.addEventListener("focusin",$),t.addEventListener("focusout",E));const L=t=>{r=t,A?.kick()};return mt(()=>A,n,t=>{a=kt(t.palette),A?.refresh(),A&&c(A)},{progress(t){o=_(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",E),t.removeEventListener("focusin",$),t.removeEventListener("focusout",E)})},exports.beamPalette=kt,exports.blockChart=function(t,e={}){const n={current:{...wn,...e}};let r=n.current.values,o=null,a=[],i=0,s=!1,l=null,c=!1===n.current.intro?-1e9:performance.now(),d=[],h=[],u=[],p={cols:0,rows:0};const f=()=>n.current.values??[],m=()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:7,cellAspect:1,glyphScale:1.1,shade:.5,blend:"off",...n.current.look}),g=(t,e)=>{const{cellSize:n=7,maxPixelRatio:r=2}=m(),o=Math.min("number"==typeof devicePixelRatio&&devicePixelRatio>0?devicePixelRatio:1,r),a=Math.max(2,Math.round(n*o)),i=a/o,s=t=>{const e=Math.max(1,Math.floor(t*o/a));for(let t=e;t>1&&t>e-8;t--)if(Math.abs(t*i-Math.round(t*i))<.01)return t;return e},l=s(t),c=Math.max(2,s(e));return{cols:l,rows:c,cell:i,gw:Math.round(l*i),gh:Math.round(c*i)}};let x={left:0,cell:0};const y=(t,e)=>null===o?t===e-1?.8:kn:t===o?.8:.3,v=(t,e)=>Z((e-c-(h[t]??0))/n.current.duration),M=(t,e,r,o)=>{const a=((t,e,r,o)=>{const{bar:a,gap:i,left:s}=Sn(r,e.length),l=n.current.max??1.04*Math.max(...e,0),c=l>0?_(Math.max(0,e[t])/l)*(o-1):0,d=s+t*(a+i);return{x0:d,x1:d+a,h:c>0?Math.max(1,Math.round(c)):0}})(t,e,p.cols,p.rows);if(o)return a;const i=d[t]??{...a,h:0},s=v(t,r);return{x0:i.x0+(a.x0-i.x0)*s,x1:i.x1+(a.x1-i.x1)*s,h:i.h+(a.h-i.h)*s}};l=ft({host:t,look:m,ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:(t,e)=>{const{cell:n}=g(t,e);return[Math.max(2,2*Math.round(t/n)),Math.max(4,2*Math.round(e/n))]},onFail:()=>{l=null},paint:({pen:e,width:r,height:o,now:s,still:d})=>{const h=(()=>{const e=l?.canvas;if(!e||!t.offsetWidth)return!1;const{gw:n,gh:r,cell:o}=g(t.offsetWidth,t.offsetHeight),a=Math.round((t.offsetWidth-n)/2),i=[`${a}px`,t.offsetHeight-r+"px",`${n}px`,`${r}px`];x={left:a,cell:o};let s=!1;return["left","top","width","height"].forEach((t,n)=>{e.style[t]!==i[n]&&(e.style[t]=i[n],s=!0)}),s&&l?.field.resize(),s})(),m=r/2,b=o/2;p={cols:m,rows:b};const w=f(),k=w.length,S=i?Math.min(64,s-i):16;i=s;const A=new Float32Array(m*b),C=(t,e,n)=>{const r=(b-1-e)*m+t;n>A[r]&&(A[r]=n)};for(let t=0;t<m;t++)C(t,0,.16);const E=({x0:t,x1:e,h:n},r)=>{if(n<=.01)return;const o=Math.ceil(n)-1;for(let a=Math.max(0,Math.floor(t));a<Math.min(m,Math.ceil(e));a++){const i=_(Math.min(a+1,e)-Math.max(a,t));for(let t=0;t<=o&&t<b-1;t++)C(a,t+1,(t===o?Math.min(1,r+.2):r)*i*_(n-t))}};let $=!1;const L=d?1:Z((s-c)/n.current.duration);L<1&&($=!0);for(const t of u)E({...t,h:t.h*(1-L)},kn);L>=1&&(u=[]);for(let t=0;t<k;t++){!d&&v(t,s)<1&&($=!0);const e=y(t,k),n=a[t]??e;a[t]=d?e:n+(e-n)*(1-Math.exp(-S/70)),Math.abs(a[t]-e)>.004&&($=!0),E(M(t,w,s,d),a[t])}for(let t=0;t<A.length;t++){if(A[t]<=0)continue;const n=Math.round(255*A[t]);e.fillStyle=`rgb(${n} ${n} ${n})`,e.fillRect(t%m*2,2*Math.floor(t/m),2,2)}return h&&d&&l?.kick(),$||h}});const b=lt(),w=l?null:document.createElement("div"),k=()=>{if(!w)return;const t=f(),e=t.length,r=n.current.max??1.04*Math.max(...t,0);w.replaceChildren(...t.map((t,n)=>{const o=document.createElement("div");return o.setAttribute("style",`flex:1 1 0;height:${r>0?(100*_(t/r)).toFixed(2):0}%;margin:0 ${e<=7?22:18}%;background:currentColor;opacity:${.9*(.16+.84*y(n,e))}`),o}))};w&&("static"===getComputedStyle(t).position&&b.set(t,"position","relative"),w.setAttribute("aria-hidden","true"),w.setAttribute("style","position:absolute;inset:0;display:flex;align-items:flex-end;pointer-events:none"),t.appendChild(w));const S=document.createElement("table");S.setAttribute("style","position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0");const A=()=>{const t=n.current.format??(t=>t.toLocaleString()),e=n.current.labels??[],r=document.createElement("tbody");f().forEach((n,o)=>{const a=document.createElement("tr"),i=document.createElement("th"),s=document.createElement("td");i.setAttribute("scope","row"),i.setAttribute("style","font-weight:inherit"),i.textContent=e[o]??String(o+1),s.textContent=t(n),a.appendChild(i),a.appendChild(s),r.appendChild(a)}),S.replaceChildren(r)};A(),t.appendChild(S);const C=!t.hasAttribute("tabindex"),E=!t.hasAttribute("role");C&&(t.tabIndex=0),E&&t.setAttribute("role","group");const $=t=>{const e=f().length,r=null!==t&&e?Math.min(e-1,Math.max(0,Math.round(t))):null;r!==o&&(o=r,l?.kick(),k(),n.current.onHover?.(o,null===o?null:f()[o],null===o?null:n.current.labels?.[o]??null))},L=t=>n.current.stagger??(t<=7?45:12),z=(t,e)=>{const o=f(),i=n.current.labels,s=performance.now(),m=!!l?.still(),g=p.cols&&!m?t.map((e,n)=>M(n,t,s,!1)):[],x=m?[]:u.map(t=>({...t,h:t.h*(1-Z((s-c)/n.current.duration))})),y=new Map,v=(t,n,r)=>i&&e?r?.[t]??`#${t}`:"#"+(n-1-t);t.forEach((n,r)=>y.set(v(r,t.length,e),r));const b=new Set,w=a;let S=0;const A=o.length;d=o.map((t,e)=>{const n=y.get(v(e,A,i));return void 0!==n&&g[n]?(b.add(n),g[n]):null}),a=o.map((t,e)=>{const n=y.get(v(e,A,i));return void 0!==n?w[n]??kn:kn}),h=d.map(t=>t?0:S++*L(A)*.6),u=[...x,...g.filter((t,e)=>!b.has(e))].filter(t=>t.h>.01),r=o,c=s,l?.kick(),k()};k();const P=e=>{const n=t.getBoundingClientRect(),r=f().length;if(!n.width)return;const o=(e.clientX-n.left)/n.width,a=e.clientY-n.top;if(o<0||o>1||a<0||a>n.height)return void $(null);if(!p.cols)return void $(((t,e)=>e?Math.min(e-1,Math.max(0,Math.floor(t*e))):-1)(o,r));const{bar:i,gap:s,left:l}=Sn(p.cols,r);$(Math.round(((e.clientX-n.left-x.left)/x.cell-l-i/2)/Math.max(1,i+s)))},R=()=>$(null),F=t=>{const e=f().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(),$(n))};t.addEventListener("pointermove",P),t.addEventListener("pointerdown",P),t.addEventListener("pointerleave",R),t.addEventListener("pointercancel",R),t.addEventListener("keydown",F),t.addEventListener("blur",R);const T="function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{t?.isIntersecting&&!s&&(s=!0,!1!==n.current.intro&&(()=>{const t=f().length;r=f(),c=performance.now(),d=[],u=[],h=Array.from({length:t},(e,n)=>n*L(t)),a=f().map((t,e,n)=>y(e,n.length)),l?.kick(),k()})())},{threshold:.4}):null;T?.observe(t);let I=n.current.labels;return mt(()=>l,n,t=>{A(),t.values!==r&&(z(r,I),I=t.labels),l?.refresh()},{set(t,e){const a=r,i=I;n.current={...n.current,values:[...t],...e?{labels:[...e]}:{}},I=n.current.labels,null!==o&&o>=t.length&&$(null),A(),z(a,i)},highlight:$,get active(){return o},get values(){return f()}},()=>{T?.disconnect(),S.remove(),w?.remove(),b.restore(),t.removeEventListener("pointermove",P),t.removeEventListener("pointerdown",P),t.removeEventListener("pointerleave",R),t.removeEventListener("pointercancel",R),t.removeEventListener("keydown",F),t.removeEventListener("blur",R),C&&t.removeAttribute("tabindex"),E&&t.removeAttribute("role")})},exports.buttonLoading=function(e,n={}){const r={current:{...Rt,...n}},o=lt(),a=r.current.label??e,i=r.current.text??(a.textContent??"").trim(),s=[...a.childNodes],l=void 0!==r.current.icon?r.current.icon:i?null:e.querySelector("svg"),c=e.getAttribute("aria-label");let d="idle",h=i,u=-1e9,p=0,f=null,m={cw:9,ch:15,cellSize:15};const g=ct(i),x=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 v=()=>{const t=Math.min(globalThis.devicePixelRatio||1,2);m=function(t,e){const n=Math.max(3,3*Math.round(t*e/3));return{cw:n/3*2/e,ch:n/e,cellSize:n/e}}(parseFloat(getComputedStyle(a).fontSize)||15,t)},M=()=>{if(l)return x.replaceChildren(),f&&x.appendChild(f.canvas),x.style.width=`${m.cw}px`,void(x.style.height=`${m.ch}px`);const t=[...h];for(const t of[...x.children])"SPAN"===t.tagName&&t.remove();const n=f&&f.canvas.parentElement===x?f.canvas:null;for(const[e,r]of t.entries()){const t=document.createElement("span");t.textContent=r,t.setAttribute("style",`position:absolute;top:0;left:${e*m.cw}px;width:${m.cw}px;height:${m.ch}px;line-height:${m.ch}px;text-align:center`),n?x.insertBefore(t,n):x.appendChild(t)}f&&!n&&x.appendChild(f.canvas),x.style.width=t.length*m.cw+"px",x.style.height=`${m.ch}px`,g.textContent=h,p=Math.max(p,e.offsetWidth),p&&o.set(e,"min-width",`${p}px`)},b="undefined"!=typeof document&&t.isGlyphFieldSupported();if(b){v(),x.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"),x.setAttribute("style",t),y.setAttribute("style",`${t};display:grid;place-items:center;opacity:0;scale:.5`),e.appendChild(x),e.appendChild(y)):(x.setAttribute("style","display:inline-block;vertical-align:middle;position:relative;white-space:pre"),y.setAttribute("style","display:inline-grid;place-items:center;vertical-align:middle;overflow:hidden;width:0;opacity:0;scale:.5"),a.replaceChildren(g,y,x)),M()}f=b?ft({host:x,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:m.cellSize,cellAspect:2/3,glyphScale:.94,...r.current.look}),ink:()=>r.current.ink??getComputedStyle(a).color,kit:r,reducedMotion:()=>r.current.reducedMotion,resolution:(t,e)=>[Math.max(2,2*Math.round(t/m.cw)),Math.max(3,3*Math.round(e/m.ch))],onFail:()=>{f=null,x.remove(),y.remove(),o.restore(),l||(a.replaceChildren(...s),a.textContent=h)},paint:({pen:t,now:e,still:n})=>{const r=e-u;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=[...x.children].filter(t=>"SPAN"===t.tagName);let a="loading"===d&&!n;for(let e=0;e<o.length;e++){const i=n?0:Ft(e,r,o.length,"loading"===d,n,h.length);r<24*o.length+170&&(a=!0);const s=" "===h[e];if(o[e].style.visibility=i&&!s?"hidden":"",!i||s)continue;const l=Math.round(i/9*255);t.fillStyle=`rgb(${l} ${l} ${l})`,t.fillRect(2*e,0,2,3)}return a}}):null,b&&!f&&(x.remove(),y.remove(),l||a.replaceChildren(...s),o.restore());const w=(t,n)=>{d=t,h=l?"":n,e.dataset.state=t,"loading"===t?e.setAttribute("aria-busy","true"):e.removeAttribute("aria-busy"),l&&null!==c&&e.setAttribute("aria-label","idle"===t?c:n),r.current.announce&&(r.current.announce.textContent="idle"===t?"":n),f?(u=performance.now(),((t,e)=>{const n=e?"none":`opacity 160ms ${Tt} ${t?120:0}ms, scale 240ms ${Tt} ${t?120:0}ms`;if(y.style.transition=n,y.style.opacity=t?"1":"0",y.style.scale=t?"1":".5",l||(y.style.width=t?"1.1em":"0",y.style.marginRight=t?".45em":"0"),l&&"style"in l){const t="idle"!==d&&"error"!==d;o.set(l,"transition",n.replace(/ 120ms/g,"")),o.set(l,"opacity",t?e&&"loading"===d?".4":"0":"1"),o.set(l,"scale",t&&!e?".6":"1")}})(!("success"!==t||!l&&!r.current.check),f.still()),M(),f.kick(),"error"===t&&r.current.shake&&!f.still()&&"function"==typeof e.animate&&e.animate([{translate:"0"},{translate:"-4px 0"},{translate:"4px 0"},{translate:"-2px 0"},{translate:"0"}],{duration:280,easing:Tt})):l||(a.textContent=n)};return mt(()=>f,r,()=>{f&&(v(),M(),f.refresh())},{start(t=(l?c??"":`${i}…`)){w("loading",t)},succeed(t="Done"){w("success",t)},fail(t="Retry"){w("error",t)},reset(t=(l?c??"":i)){w("idle",t)},get state(){return d}},()=>{f&&(x.remove(),y.remove(),l||a.replaceChildren(...s)),l&&null!==c&&e.setAttribute("aria-label",c),delete e.dataset.state,e.removeAttribute("aria-busy"),o.restore()})},exports.cascade=zr,exports.caustics=Sr,exports.circuit=oo,exports.codeInput=function(t,e={}){const n={current:{...Bn,...e}},r=lt(),o=lt(),a=[],i=()=>!!(n.current.reducedMotion??tt()),s=()=>Math.max(1,Math.round(n.current.length));let l="",c="idle",d=!1,h=[],u="",p=-1e9,f="",m=-1e9,g=[],x=[],y=0,v=null;const M=new Map;"static"===getComputedStyle(t).position&&r.set(t,"position","relative");let b=t.querySelector("input");b||(b=document.createElement("input"),b.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(b),a.push(b));const w=b;w.setAttribute("inputmode","digits"===n.current.accept?"numeric":"text"),w.setAttribute("autocomplete","one-time-code"),w.setAttribute("maxlength",String(s())),"digits"===n.current.accept&&w.setAttribute("pattern","[0-9]*"),w.hasAttribute("aria-label")||w.hasAttribute("aria-labelledby")||w.setAttribute("aria-label",`Verification code, ${s()} ${"digits"===n.current.accept?"digits":"characters"}`);const k=()=>{const e=[...t.querySelectorAll(n.current.cells)];for(;e.length<s();){const n=document.createElement("span");n.dataset.cell="",n.setAttribute("aria-hidden","true"),w.parentElement===t?t.insertBefore(n,w):t.appendChild(n),a.push(n),e.push(n)}return e.slice(0,s())},S=t=>{let e=t.querySelector("[data-digit]");return e||(e=document.createElement("span"),e.dataset.digit="",t.appendChild(e),a.push(e)),e},A=(t,e,n,r,o,a,i,s=1,l=0,c=0,d=1)=>{const h=((t,e,n,r)=>{const o=`${t}|${Math.round(e)}x${Math.round(n)}|${r}`;let a=M.get(o);if(!a){a=document.createElement("canvas"),a.width=Math.max(2,Math.round(2*e)),a.height=Math.max(2,Math.round(2*n));const i=a.getContext("2d");i&&(i.scale(2,2),i.fillStyle="#fff",i.shadowColor="#fff",i.shadowBlur=3,i.font=`600 ${Math.round(.6*n)}px ${r}`,i.textAlign="center",i.textBaseline="middle",i.fillText(t,e/2,n/2+1)),M.set(o,a)}return a})(e,n.w,n.h,i);t.globalAlpha=s;const u=n.w*d,p=n.h*d,f=n.x+(n.w-u)/2+l,m=n.y+(n.h-p)/2+c;for(let e=0;e<n.h;e+=4)for(let i=0;i<n.w;i+=3){if(J(i+31*a,e)>1.3*r-.12)continue;const n=3*(1-r);t.drawImage(h,2*i,2*e,6,8,f+i*d+(J(i,e+o)-.5)*n,m+e*d+(J(e,i+o)-.5)*n,3*d,4*d)}t.globalAlpha=1},C=(t,e)=>{t.toggleAttribute("data-shown",e),o.set(S(t),"opacity",e?"1":"0")};v=ft({host:t,outset:16,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.92,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{v=null,o.restore(),k().forEach(t=>C(t,!0))},paint:({pen:e,w:n,h:r,now:o,still:a,box:i})=>{e.setTransform(2,0,0,2,0,0);const s=k(),x=a?0:Math.floor(o/110),y=getComputedStyle(t).fontFamily||"sans-serif";if("success"===c){const t=a?1:(o-m)/700,i=n/2,l=r/2;if(s.forEach(t=>C(t,!1)),t<.55){const n=(t/.55)**2;g.forEach((t,r)=>f[r]&&A(e,f[r],t,1,x,r,y,1-n**3,(i-t.x-t.w/2)*n,(l-t.y-t.h/2)*n,1-.65*n))}const c=_((t-.45)/.55);return c>0&&c<1&&(e.strokeStyle=qn(.55*(1-c)),e.lineWidth=3,e.beginPath(),e.arc(i,l,18+44*(t=>1-(1-_(t))**3)(c),0,2*Math.PI),e.stroke()),((t,e,n,r)=>{if(r<=0)return;const o=[[e-20,n+1],[e-7,n+14],[e+21,n-14]],a=Math.hypot(13,13),i=Math.hypot(28,28);let s=r*(a+i);t.strokeStyle="#fff",t.lineWidth=8,t.lineCap="round",t.lineJoin="round",t.shadowColor="#fff",t.shadowBlur=4,t.beginPath(),t.moveTo(o[0][0],o[0][1]);const l=Math.min(1,s/a);if(t.lineTo(o[0][0]+(o[1][0]-o[0][0])*l,o[0][1]+(o[1][1]-o[0][1])*l),s-=a,s>0){const e=Math.min(1,s/i);t.lineTo(o[1][0]+(o[2][0]-o[1][0])*e,o[1][1]+(o[2][1]-o[1][1])*e)}t.stroke(),t.shadowBlur=0})(e,i,l+1,Z(_((t-.4)/.45))),t<1}let v=!1;const M=o-p;return s.forEach((t,n)=>{const r=i(t),s=l[n];if(M<On&&u[n])return C(t,!1),A(e,u[n],r,1-M/On,x,n,y),void(v=!0);if(s){const i=a?1:(o-h[n])/300;if(C(t,i>=.7),i>=1)return;return v=!0,void(i>0&&A(e,s,r,i,x,n,y,i>.7?1-(i-.7)/.3:1))}if(C(t,!1),d&&n===l.length&&M>=On){const t=a?.6:.5-.5*Math.cos(o/1600*Math.PI*2);e.fillStyle=qn(.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(),v=!0}}),v}});const E=(t,e)=>{x.push(setTimeout(e,t))},$=()=>{x.forEach(clearTimeout),x=[]},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),v||C(t,!0),"success"===c&&v?(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),v?.kick()},z=t=>{$(),"idle"!==c&&(c="idle",m=-1e9),u="",p=-1e9;const e=((t,e,n="digits")=>("digits"===n?t.replace(/\D/g,""):t.replace(/[^a-z\d]/gi,"").toUpperCase()).slice(0,e))(t,s(),n.current.accept),r=performance.now();let o=0;for(let t=0;t<e.length;t++)e[t]!==l[t]&&(h[t]=i()?-1e9:r+y*o++);l=e,L(),e.length===s()&&E(i()||!v?0:300+y*Math.max(0,o-1)+80,()=>n.current.onComplete?.(e)),y=0},P=()=>z(w.value),R=()=>{y=55},F=()=>{d=!0,L()},T=()=>{d=!1,L()};return w.addEventListener("input",P),w.addEventListener("paste",R),w.addEventListener("focus",F),w.addEventListener("blur",T),w.value?z(w.value):L(),mt(()=>v,n,()=>{w.setAttribute("maxlength",String(s())),L(),v?.refresh()},{verify:e=>{$();const n=performance.now();if(e)return f=l,g=v?k().map(t=>v.box(t)):[],m=n,c="success",void L();u=l,p=i()||!v?n-On:n,c="error",L(),i()||"function"!=typeof t.animate||t.animate([{translate:"0"},{translate:"-9px"},{translate:"7px"},{translate:"-4px"},{translate:"2px"},{translate:"0"}],{duration:380,easing:"ease-out"});const r=l;E(i()||!v?0:On,()=>{u===r&&(u="",l="",L())})},clear:()=>{$(),u="",p=-1e9,m=-1e9,l="",c="idle",L()},fill(t){y=55,z(t)},get value(){return l},get state(){return c}},()=>{$(),w.removeEventListener("input",P),w.removeEventListener("paste",R),w.removeEventListener("focus",F),w.removeEventListener("blur",T),o.restore(),r.restore();for(const t of a)t.remove();for(const e of t.querySelectorAll(n.current.cells))e.removeAttribute("data-shown"),e.removeAttribute("data-active");delete t.dataset.state})},exports.commandPalette=function(t,e={}){const n={current:{...nn,...e}},r=lt(),o=()=>[...t.querySelectorAll(n.current.rows)],a=()=>t.querySelector(n.current.input),i=lt();let s=n.current.open??!t.hasAttribute("hidden"),l=0,c=null,d=!1,h=0,u=null,p=[],f=null,m=0,g=0;const x=new WeakMap,y=()=>!!(n.current.reducedMotion??tt());en("ascii-kit-command",ln),"static"===getComputedStyle(t).position&&i.set(t,"position","relative"),i.set(t,"isolation","isolate");const v=document.createElement("div");v.setAttribute("aria-hidden","true"),v.dataset.asciiCmdHighlight="",n.current.highlight&&t.insertBefore(v,t.firstElementChild);const M=e=>{if(void 0===e.offsetParent)return dt(t,e);let n=0,r=0;for(let o=e;o&&o!==t;o=o.offsetParent)n+=o.offsetLeft,r+=o.offsetTop;for(let o=e.parentElement;o&&o!==t;o=o.parentElement)n-=o.scrollLeft,r-=o.scrollTop;return{x:n,y:r,w:e.offsetWidth,h:e.offsetHeight}},b=t=>{const e=o()[l];if(!v.parentElement)return;if(!e||!s)return void delete v.dataset.on;const n=M(e),r=!t||void 0===v.dataset.on||y();r&&(v.style.transition="none"),v.style.translate=`${n.x}px ${n.y}px`,v.style.width=`${n.w}px`,v.style.height=`${n.h}px`,v.style.borderRadius=getComputedStyle(e).borderTopLeftRadius,v.dataset.on="",r&&(v.offsetWidth,v.style.removeProperty("transition"))};let w=null;const k=lt();u=ft({host:t,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{u=null},paint:({pen:e,now:r,still:a,box:i})=>{if(e.setTransform(2,0,0,2,0,0),c){const t=c,n=(r-t.start)/(t.closing?rn:260);if(!(n>=1||a)){const r=t.closing?1-1.02*Z(n):1.04*Z(n);return Ue(e,t.snap,t.blocks,t.order,r,(e,n)=>[(t.ox-e.x)*n*.9,(t.oy-e.y)*n*.9],t.closing?1:1-_((n-.72)/.28),.4),!0}c=null}if(!s||d)return!1;let h=!1;p=p.filter(n=>{const o=(r-n.start)/280;return(o>=.7||a)&&n.styles.restore(),o>=1||a||!t.contains(n.row)?(n.styles.restore(),!1):(h=!0,o>0&&Ue(e,n.snap,n.blocks,n.order,1.04*Z(o),(t,e)=>[14*e,0],1-_((o-.7)/.3),.42),!0)});const x=o()[l];if(x&&!a&&x.matches(n.current.ai)){x!==f&&(f=x,m=r+160);const n=r-m,o=n>=0?n%on/1100:-1;if(o>=0&&o<1&&!p.some(t=>t.row===x))((e,n,r,o,a)=>{const i=u,s=`${n.textContent}|${r.x}|${r.y}|${r.w}`;if(w?.row!==n||w.key!==s){const e=De(n,i.box,i.canvas.clientWidth||t.offsetWidth,i.canvas.clientHeight||t.offsetHeight,2);w={row:n,key:s,snap:e,blocks:je(e,2)}}const l=r.x-an+(r.w+80)*(t=>t<.5?4*t**3:1-(-2*t+2)**3/2)(o),c=Math.floor(a/70);for(const t of w.blocks){const n=(t.x+2-l)/an;if(n<=-1||n>=1)continue;const r=1-n*n;J(t.x+c,t.y)>.35+.65*r||(e.globalAlpha=Math.min(1,1.6*r),e.drawImage(w.snap,2*t.x,2*t.y,8,12,t.x,t.y,4,6))}e.globalAlpha=1;const d=l-r.x;k.set(n,"mask-image",`linear-gradient(90deg, #000 ${d-an}px, transparent ${d-14}px, transparent ${d+14}px, #000 ${d+an}px)`)})(e,x,i(x),o,r),h=!0;else{if(k.restore(),h)return!0;g&&clearTimeout(g);const t=n>=0?on-n%on:-n;g=setTimeout(()=>{g=0,u?.kick()},Math.max(16,t))}}else f=null,k.restore();return h}}),u&&(t.dataset.gpu="");const S=(t=!0)=>{const e=o();if(l=e.length?Math.min(Math.max(0,l),e.length-1):0,b(t),!n.current.manage)return;e.forEach((t,e)=>t.setAttribute("aria-selected",String(e===l)));const r=a(),i=e[l]?.id;r&&i&&r.setAttribute("aria-activedescendant",i)},A=()=>`inset(0 round ${getComputedStyle(t).borderTopLeftRadius||"0px"})`,C=()=>{const e=n.current.trigger,r=t.offsetWidth,o=t.offsetHeight;if(!e)return`inset(0 ${Math.max(0,r/2-40)}px ${Math.max(0,o-36)}px round 18px)`;const a=dt(t,e);return`inset(${a.y}px ${r-a.x-a.w}px ${o-a.y-a.h}px ${a.x}px round ${a.h/2}px)`},E=e=>{const r=u;if(!r)return;const o=t.offsetWidth,a=t.offsetHeight,i=De(t,r.box,o,a,2),s=je(i,2),l=n.current.trigger,d=l?r.box(l):{x:o/2,y:0,w:0,h:0},h=d.x+d.w/2,p=d.y+d.h/2,f=Math.hypot(o,a)||1;c={snap:i,blocks:s,order:Float32Array.from(s,t=>Math.hypot(t.x-h,t.y-p)/f*.7+.3*t.seed),ox:h,oy:p,start:performance.now(),closing:e},r.kick()},$=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()},L=(e,n,r="none")=>"function"!=typeof t.animate?null:t.animate(e.map(t=>({clipPath:t})),{duration:n,easing:sn,fill:r}),z=()=>{h&&clearTimeout(h),h=0},P=(e=!0)=>{!s||d?(z(),s=!0,d=!1,l=0,t.removeAttribute("hidden"),t.dataset.open="",n.current.trigger?.setAttribute("aria-expanded","true"),S(!1),(()=>{for(const t of o())x.set(t,M(t).y)})(),e&&a()?.focus({preventScroll:!0}),n.current.onOpenChange?.(!0),y()?u?.kick():(t.dataset.state="opening",L([C(),A()],260),u&&(d=!0,$(!0),E(!1)),h=setTimeout(()=>{h=0,delete t.dataset.state,d=!1,$(!1),u?.kick()},143))):e&&a()?.focus({preventScroll:!0})},R=()=>{if(!s)return;z();const e=t.contains(document.activeElement),r=()=>{h=0,d=!1,s=!1,c=null,delete t.dataset.state,delete t.dataset.open,$(!1),b(!1);for(const t of p)t.styles.restore();p=[],k.restore(),w=null,t.setAttribute("hidden",""),n.current.trigger?.setAttribute("aria-expanded","false"),e&&n.current.trigger?.focus({preventScroll:!0}),u?.kick(),n.current.onOpenChange?.(!1)};if(y())return void r();d=!0,t.dataset.state="closing",u&&(E(!0),$(!0));const o=L([A(),C()],rn,"forwards"),a="function"==typeof t.animate?t.animate([{opacity:1},{opacity:1,offset:.4},{opacity:0}],{duration:rn,fill:"forwards"}):null;h=setTimeout(()=>{r(),o?.cancel(),a?.cancel()},rn)},F=t=>{const e=o().length;e&&(l=(Math.round(t)%e+e)%e,S(),u?.kick())},T=(t=l)=>{const e=o()[t];if(!e||d)return;F(t),u?.field.pulse({element:e,strength:.6}),e.matches(n.current.ai)&&(f=e,m=performance.now()),e.dataset.run="",n.current.onRun?.(t,e);const r=()=>{delete e.dataset.run,n.current.closeOnRun&&R()};y()?r():setTimeout(r,240)},I=t=>{if(!n.current.manage)return;const e=o().length;if("Escape"===t.key&&s)return t.preventDefault(),t.stopPropagation(),void R();if(t.target!==a()&&!o().includes(t.target))return;const r="ArrowDown"===t.key?l+1:"ArrowUp"===t.key?l-1:"Home"===t.key?0:"End"===t.key?e-1:null;if(null!==r)return t.preventDefault(),void F(r);"Enter"===t.key&&(t.preventDefault(),T())},W=t=>{const e=t.target?.closest?.(n.current.rows);return e?o().indexOf(e):-1},B=t=>{if(!n.current.manage)return;const e=W(t);e<0||e!==l&&F(e)},O=t=>{if(!n.current.manage)return;const e=W(t);e>=0&&T(e)},q=()=>{n.current.manage&&(l=0,S(!1))},N="function"==typeof MutationObserver?new MutationObserver(()=>{s&&(S(!1),(()=>{const e=u,n=o(),r=n.filter(t=>{const e=M(t).y,n=x.get(t);return x.set(t,e),void 0===n||Math.abs(n-e)>1});for(const t of p)n.includes(t.row)&&!r.includes(t.row)||t.styles.restore();if(p=p.filter(t=>n.includes(t.row)&&!r.includes(t.row)),!e||!e.live||e.still()||d||!s)return;const a=e.canvas.clientWidth||t.offsetWidth,i=e.canvas.clientHeight||t.offsetHeight,l=performance.now();r.forEach((t,n)=>{const r=De(t,e.box,a,i,2),o=je(r,2);if(!o.length)return;const s=Math.min(...o.map(t=>t.x)),c=Math.max(1,Math.max(...o.map(t=>t.x))-s),d=lt();for(const e of[...t.children])d.set(e,"opacity","0");p.push({row:t,snap:r,blocks:o,order:Float32Array.from(o,t=>(t.x-s)/c*.72+.28*t.seed),start:l+28*n,styles:d})}),e.kick()})())}):null;N?.observe(t,{childList:!0,subtree:!0});const H="function"==typeof ResizeObserver?new ResizeObserver(()=>b(!1)):null;H?.observe(t);const G=()=>{s?R():P(!0)},D=t=>{const e=n.current.hotkey;e&&t.key?.toLowerCase()===e.toLowerCase()&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),s?document.activeElement===a()?R():a()?.focus():P(!0))},j=e=>{if(!n.current.manage||!s||d)return;const r=e.target;t.contains(r)||n.current.trigger?.contains(r)||R()};t.addEventListener("keydown",I),t.addEventListener("pointermove",B),t.addEventListener("click",O),t.addEventListener("input",q);const U=n.current.trigger;return U?.addEventListener("click",G),U?.setAttribute("aria-expanded",String(s)),U?.setAttribute("aria-haspopup","dialog"),document.addEventListener("keydown",D),document.addEventListener("pointerdown",j),s?t.dataset.open="":t.setAttribute("hidden",""),S(),mt(()=>u,n,()=>{S(),u?.refresh()},{open:P,close:R,select:F,run:T,toggle(){s?R():P(!0)},get isOpen(){return s},get selected(){return l}},()=>{z(),g&&clearTimeout(g),$(!1);for(const t of p)t.styles.restore();k.restore(),N?.disconnect(),H?.disconnect(),v.remove(),i.restore(),t.removeEventListener("keydown",I),t.removeEventListener("pointermove",B),t.removeEventListener("click",O),t.removeEventListener("input",q),U?.removeEventListener("click",G),document.removeEventListener("keydown",D),document.removeEventListener("pointerdown",j),delete t.dataset.gpu,delete t.dataset.state})},exports.compare=function(t,e){const n={current:{position:50,...e}},r=lt();let o=_(n.current.position,0,100),a=null,i=null,s={from:o,to:o,at:-1e9},l=0,c=!1;const d=[];let h=n.current.position;i=ft({host:t,layer:"under",look:()=>({blend:"coarse",mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:600,cellSize:6,cellAspect:.8,glyphScale:.96,color:"source",levels:"auto",saturation:1.3,contrast:1.45,gamma:.85,brightness:.14,hover:"trail",trail:{strength:.7,radius:.3},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:(t,e)=>{const n=Math.min(1600,Math.max(2,Math.round(2*t)));return[n,Math.max(2,Math.round(n*e/Math.max(1,t)))]},onFail:()=>{i=null},paint:({pen:t,width:e,height:n})=>(t.imageSmoothingQuality="high",a&&Ve(t,a,0,0,e,n),!1)});const u="string"==typeof n.current.image?Ye(n.current.image):n.current.image,p=t.querySelector('[role="slider"]'),f=t.querySelector("[data-compare-line]"),m=p??document.createElement("div"),g=f??document.createElement("span"),x=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`)},v=(t,e=!1)=>{if(t=_(t,0,100),!i)return void(o=t);if(l&&(cancelAnimationFrame(l),l=0),!e||i.still()||Math.abs(t-o)<.5)return o=t,y(),void n.current.onChange?.(o);s={from:o,to:t,at:performance.now()};const r=t=>{const e=_((t-s.at)/280);o=s.from+(s.to-s.from)*Z(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},b=e=>{if(0!==e.button)return;t.setPointerCapture?.(e.pointerId),c=!0,t.dataset.dragging="";const n=M(e.clientX);v(n,Math.abs(n-o)>3),m.focus({preventScroll:!0})},w=t=>{c&&v(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(),v(n,!0))};let A=()=>{};if(i){en("ascii-kit-compare","\n:where(.ascii-compare-photo){position:absolute;inset:0;width:100%;height:100%;object-fit:cover;pointer-events:none;clip-path:inset(0 calc(100% - var(--ascii-pos, 50%)) 0 0)}\n:where(.ascii-compare-line){position:absolute;top:0;bottom:0;left:var(--ascii-pos, 50%);width:2px;translate:-50% 0;background:#fff;box-shadow:0 0 0 .5px rgb(0 0 0 / .25),0 0 12px rgb(0 0 0 / .45);pointer-events:none}\n:where(.ascii-compare-handle){position:absolute;top:50%;left:var(--ascii-pos, 50%);display:grid;place-items:center;width:40px;height:40px;translate:-50% -50%;border-radius:50%;background:#fff;color:#111;box-shadow:0 0 0 1px rgb(0 0 0 / .08),0 4px 14px rgb(0 0 0 / .4);cursor:grab;touch-action:none}\n:where(.ascii-compare-handle:focus-visible){outline:2px solid #fff;outline-offset:3px}\n"),r.set(t,"overflow","hidden"),r.set(t,"touch-action","pan-y"),r.set(t,"user-select","none"),r.set(t,"cursor","ew-resize");const e={className:u.className,hidden:u.getAttribute("aria-hidden")};A=()=>{u.className=e.className,null===e.hidden?u.removeAttribute("aria-hidden"):u.setAttribute("aria-hidden",e.hidden)},u.className=(e.className?`${e.className} `:"")+"ascii-compare-photo",u.setAttribute("aria-hidden","true"),u.draggable=!1,f||(g.className="ascii-compare-line",g.setAttribute("aria-hidden","true")),p||(m.className="ascii-compare-handle",m.innerHTML='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 7-5 5 5 5M15 7l5 5-5 5"/></svg>',m.setAttribute("role","slider"),m.tabIndex=0),x(n.current.label),m.setAttribute("aria-valuemin","0"),m.setAttribute("aria-valuemax","100"),m.setAttribute("aria-orientation","horizontal");for(const e of[u,g,m])t.contains(e)||(t.appendChild(e),d.push(e));y(),t.addEventListener("pointerdown",b),t.addEventListener("pointermove",w),t.addEventListener("pointerup",k),t.addEventListener("pointercancel",k),m.addEventListener("keydown",S),Xe(u).then(t=>{a=t,i?.kick()},()=>{})}else t.contains(u)||("static"===getComputedStyle(t).position&&r.set(t,"position","relative"),u.setAttribute("style","position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit"),t.appendChild(u),d.push(u));return mt(()=>i,n,t=>{x(t.label),t.position!==h&&(h=t.position,v(t.position,!0)),i?.refresh()},{set:v,get position(){return o}},()=>{l&&cancelAnimationFrame(l),t.removeEventListener("pointerdown",b),t.removeEventListener("pointermove",w),t.removeEventListener("pointerup",k),t.removeEventListener("pointercancel",k),m.removeEventListener("keydown",S),delete t.dataset.dragging,d.forEach(t=>t.remove()),A(),r.restore()})},exports.constellation=Pr,exports.contour=Ar,exports.decode=function(t,e={}){const n={current:{...$t,...e}},r=lt(),o=document.createElement("canvas"),a=document.createElement("canvas");let i=-1,s="",l=!1,c=!1,d=null;const h=(e,r)=>{const a=`${e}x${r}:${n.current.text??""}:${t.textContent}`;if(a===s)return;s=a,o.width=e,o.height=r;const i=o.getContext("2d");i.fillStyle="#000",i.fillRect(0,0,e,r),void 0!==n.current.text?function(t,e,n,r,o){const a=getComputedStyle(e),i=n.split("\n");t.fillStyle="#fff",t.textAlign="center",t.textBaseline="middle";const s=(parseFloat(a.letterSpacing)||0)/(parseFloat(a.fontSize)||16),l=e=>{"letterSpacing"in t&&(t.letterSpacing=s*e+"px")};t.font=`${a.fontWeight} 100px ${a.fontFamily}`,l(0);const c=Math.max(1,...i.map(e=>t.measureText(e).width)),d=Math.min(.94*r/c*100,.9*o/i.length);t.font=`${a.fontWeight} ${d}px ${a.fontFamily}`,l(d),i.forEach((e,n)=>t.fillText(e,r/2,o/2+(n-(i.length-1)/2)*d*1.04))}(i,t,n.current.text,e,r):function(t,e,n,r){const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),a=document.createRange();t.fillStyle="#fff",t.textAlign="left",t.textBaseline="alphabetic";for(let e=o.nextNode();e;e=o.nextNode()){const o=e.parentElement;if(!o)continue;const i=getComputedStyle(o);t.font=`${i.fontStyle} ${i.fontWeight} ${parseFloat(i.fontSize)*r}px ${i.fontFamily}`,"letterSpacing"in t&&(t.letterSpacing=(parseFloat(i.letterSpacing)||0)*r+"px");const s=t.measureText("Hg"),l=s.fontBoundingBoxAscent||parseFloat(i.fontSize)*r*.8,c=s.fontBoundingBoxDescent||parseFloat(i.fontSize)*r*.2,d="uppercase"===i.textTransform?t=>t.toUpperCase():"lowercase"===i.textTransform?t=>t.toLowerCase():t=>t;for(const o of e.data.matchAll(/\S+/g)){a.setStart(e,o.index),a.setEnd(e,o.index+o[0].length);const i=a.getClientRects()[0];if(!i)continue;const s=(i.top-n.top)*r,h=i.height*r;t.fillText(d(o[0]),(i.left-n.left)*r,s+(h-l-c)/2+l)}}a.detach?.()}(i,t,t.getBoundingClientRect(),e/(t.getBoundingClientRect().width||1))};d=ft({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})=>{h(e,r);const p=n.current,f="text"===p.settle;if(i<0||d)return!(!c&&"visible"===p.trigger&&!d)&&(f&&i>=0||t.drawImage(o,0,0),i>=0&&u(),!1);const m=s-i,g=.3*p.duration,x=.7*p.duration,y=Math.max(2,Math.ceil(e/20)),v=Math.max(2,Math.ceil(r/20));if(a.width===y&&a.height===v||(a.width=y,a.height=v),Lt(a,m/1e3),t.imageSmoothingEnabled=!0,m<g)return t.drawImage(a,0,0,e,r),l&&(t.globalAlpha=1-Z(m/g),t.drawImage(o,0,0),t.globalAlpha=1),!0;const M=Math.min(1,(m-g)/x),b=(1.18*M-.02)*e,w=.14*e,k=5.58,S=Math.floor(s/16);if(M>=1)return f||t.drawImage(o,0,0),u(),!1;t.drawImage(a,0,0,e,r),b>0&&t.drawImage(o,0,0,b,r,0,0,b,r);for(let e=Math.max(0,Math.floor(b/k)*k);e<b+w;e+=k){const n=(e-b)/w;for(let a=0;a<r;a+=9)J(e+13*S,a)<n||(t.globalAlpha=.35+.65*J(a+7*S,e),t.fillStyle="#000",t.fillRect(e,a,k,9),t.drawImage(o,e,a,k,9,e,a,k,9))}return t.globalAlpha=1,!0}});const u=()=>{i=-1,l="text"!==n.current.settle,l||r.restore()},p=()=>{d&&(r.set(t,"-webkit-text-fill-color","transparent"),c=!0,i=performance.now(),d.kick())};let f=!1;const m=d&&"visible"===n.current.trigger&&"function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{t.isIntersecting&&!f&&p(),f=t.isIntersecting},{threshold:.5}):null;d&&("text"!==n.current.settle&&r.set(t,"-webkit-text-fill-color","transparent"),l="text"!==n.current.settle&&"manual"===n.current.trigger,m?m.observe(t):"visible"===n.current.trigger&&p());let g=!1;const x=()=>{g||(g=!0,n.current.replayOnHover&&i<0&&p())},y=()=>{g=!1},v=e=>{!g||e.target instanceof Node&&t.contains(e.target)||(g=!1)};return d&&(t.addEventListener("pointerenter",x),t.addEventListener("pointermove",x),t.addEventListener("pointerleave",y),document.addEventListener("pointermove",v,!0)),d&&document.fonts?.ready.then(()=>{s="",d?.kick()}),mt(()=>d,n,()=>{s="",d?.refresh()},{replay:p},()=>{m?.disconnect(),t.removeEventListener("pointerenter",x),t.removeEventListener("pointermove",x),t.removeEventListener("pointerleave",y),document.removeEventListener("pointermove",v,!0),r.restore()})},exports.disintegrate=function(t,e={}){const n=er.get(t);if(n)return n;const r={...Zn,...e},o=lt(),a=t.offsetHeight,i=()=>{for(const e of t.children)o.set(e,"opacity","0");o.set(t,"color","transparent"),o.set(t,"pointer-events","none"),t.setAttribute("aria-hidden","true")},s=e=>{r.collapse&&(o.set(t,"box-sizing","border-box"),o.set(t,"overflow","hidden"),o.set(t,"min-height","0"),o.set(t,"height",`${(a*(1-e)).toFixed(2)}px`),e>=1&&(o.set(t,"padding-block","0"),o.set(t,"margin-block","0"),o.set(t,"border-width","0")))},l=r.host??t.parentElement??t;let c=0,d=!1,h=null,u={x:0,y:0,w:0,h:0},p=()=>{};const f=ft({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:()=>p(),paint:({pen:t,now:e,still:n,scale:o})=>{if(n)return queueMicrotask(p),!1;if(!h||!d)return!1;const a=e-c,i=_(a/r.duration);t.setTransform(o,0,0,o,0,0),a>=300&&s(Z(_((a-300)/260))),t.save(),t.globalAlpha=_(2.2*(1-i))*(1-.9*i*i),t.translate(8*i,-14*i),t.drawImage(h,0,0,h.width/2,h.height/2),t.globalCompositeOperation="destination-out";const l=u.x+u.w,f=l-(1.3*i-.3)*u.w,m=l-1.3*i*u.w,g=t.createLinearGradient(m,0,Math.max(m+1,f),0);g.addColorStop(0,"rgba(0,0,0,0)"),g.addColorStop(1,"rgba(0,0,0,1)"),t.globalAlpha=1,t.fillStyle=g,t.fillRect(u.x-tr,u.y-tr,u.w+32,u.h+32),t.restore();const x=a>=Math.max(r.duration,r.collapse?560:0);return x&&queueMicrotask(p),!x}}),m=new Promise(e=>{let n=!1;if(p=()=>{n||(n=!0,f?.destroy(),s(1),r.remove&&t.remove(),er.delete(t),e())},!f||f.still())return i(),void p();u=f.box(t),h=Ze(t,f.canvas.clientWidth||u.w+32,f.canvas.clientHeight||u.h+32,f.box).canvas;f.field.ready.then(()=>{n||d||(i(),d=!0,c=performance.now(),f.kick())},()=>{i(),p()})});return er.set(t,m),m},exports.dna=ao,exports.drift=xr,exports.dropzone=function(t,e={}){const n={current:{...Qn,...e}};let r="empty",o=null,a="",i="",s="image",l=0,c=0,d=!1,h=0,u=0,p=0,f=0,m=null,g=null,x=null,y=null,v=null;const M=ct("",!0),b=["left","top","width","height"],w=()=>{const e=y?.canvas;if(!e||!t.offsetWidth)return null;const n="empty"===r?function(t,e,n=Math.min(2,"number"==typeof devicePixelRatio&&devicePixelRatio>0?devicePixelRatio:1)){const r=Math.max(2,Math.round(6*n)),o=Math.max(2,Math.round(1*r)),a=(t,e)=>{const r=Math.floor(t*n/e);for(let t=r;t>1;t--){const o=t*e/n;if(Math.abs(o-Math.round(o))<.01||t<r-8)return{n:t,css:Math.round(o)}}return{n:1,css:Math.round(e/n)}},i=a(t,o),s=a(e,r);return{cols:i.n,rows:s.n,w:i.css,h:s.css,cw:o/n,ch:r/n}}(t.offsetWidth,t.offsetHeight):null,o=n?[`${Math.round((t.offsetWidth-n.w)/2)}px`,`${Math.round((t.offsetHeight-n.h)/2)}px`,`${n.w}px`,`${n.h}px`]:["0px","0px","100%","100%"];let a=!1;return b.forEach((t,n)=>{e.style[t]!==o[n]&&(e.style[t]=o[n],a=!0)}),v=n,a?(y?.field.resize(),y?.kick(),null):n},k=document.createElement("input"),S=[M,k];let A=null;const C=!t.children.length;y=ft({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}:{blend:"coarse",mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,background:st(t)?"transparent":"#0b0b0a",color:"source",saturation:1.15,contrast:1.15,levels:"auto",brightness:.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&&v?[2*v.cols,2*v.rows]:[Math.max(1,Math.round(t)),Math.max(1,Math.round(e))],onFail:()=>{y=null,a&&L(a)},paint:({pen:e,w:a,h:i,now:s,still:c})=>{if("empty"!==r){if(!o)return!1;const t=c?1:_((s-l)/n.current.develop),d=1-(1-t)**2;return Ve(e,o,0,0,a,i),"developing"===r&&d<1&&function(t,e,n,r,o){const a=Math.max(Math.hypot(r.x,r.y),Math.hypot(e-r.x,r.y),Math.hypot(r.x,n-r.y),Math.hypot(e-r.x,n-r.y)),i=Math.max(24,.22*Math.min(e,n)),s=o*(a+i),l=Math.max(0,s-i),c=t.createRadialGradient(r.x,r.y,l,r.x,r.y,Math.max(l+1,s));c.addColorStop(0,"rgb(0 0 0 / 0)"),c.addColorStop(1,"rgb(0 0 0 / 1)"),t.globalCompositeOperation="source-over",t.fillStyle=c,t.fillRect(0,0,e,n);const d=t.createRadialGradient(r.x,r.y,l,r.x,r.y,Math.max(l+1,s)),h=1-o*o;d.addColorStop(0,"rgb(255 255 255 / 0)"),d.addColorStop(.55,`rgb(255 255 255 / ${.5*h})`),d.addColorStop(1,"rgb(255 255 255 / 0)"),t.globalCompositeOperation="lighter",t.fillStyle=d,t.fillRect(0,0,e,n),t.globalCompositeOperation="source-over"}(e,a,i,x??{x:a/2,y:i/2},d),t>=1&&"developing"===r&&$(),t<1}const h=p?Math.min(64,s-p):16;p=s;const m=d?1:0;u=c?m:u+(m-u)*(1-Math.exp(-h/90)),!c&&u>.004&&(f+=h/1e3*14);const v=Math.max(4,(parseFloat(getComputedStyle(t).borderTopLeftRadius)||16)-6),M=w();if(M){const t=y.canvas.getBoundingClientRect(),n=g&&t.width?{x:(g.x-t.left)/t.width*M.cols,y:(g.y-t.top)/t.height*M.rows}:null;!function(t,e,n,r){const{cols:o,rows:a}=e,i=t.createImageData(2*o,2*a),s=i.data,{tone:l,glow:c=0,phase:d=0,near:h=null}=r,u=Math.max(1,n/e.cw),p=Math.max(1,n/e.ch),f=o-2,m=a-2,g=Math.max(0,f-1-2*u),x=Math.max(0,m-1-2*p),y=Math.PI/4*(u+p),v=.45*Math.hypot(o,a);for(let t=0;t<a;t++)for(let e=0;e<o;e++){const n=Math.max(1+u-e,0,e-(f-u)),r=Math.max(1+p-t,0,t-(m-p));let a;if(n>0&&r>0){const t=Math.hypot(n/u,r/p);a=Math.hypot(n,r)*(1-1/t)}else a=-Math.min(e-1,f-e,t-1,m-t);let i=0;if(Math.abs(a)<.5){if(i=l,c>0){const o=e>f-u,a=t>m-p,s=e<1+u,h=t<1+p,v=(t,e)=>Math.atan2(t,e)/(Math.PI/2);let M;M=!h||s||o?h&&o?g+y*v(n/u,r/p):!o||h||a?a&&o?g+y+x+y*v(r/p,n/u):a&&!s?g+2*y+x+(f-u-e):a&&s?2*g+2*y+x+y*v(n/u,r/p):s&&!h?2*g+3*y+x+(m-p-t):2*g+3*y+2*x+y*v(r/p,n/u):g+y+(t-(1+p)):e-(1+u);const b=((M-d)%9+9)%9;i=l+c*(.2+.32*Math.max(0,1-Math.abs(b-4.5)/2.2))}}else c>0&&a<-.5&&a>-3.5&&(i=c*(1-(-a-.5)/3)**1.6*(.1+.32*(h?Math.max(0,1-Math.hypot(e-h.x,t-h.y)/v):.4)));const M=Math.round(255*Math.min(1,i));for(let n=0;n<4;n++){const r=4*((2*t+(n>>1))*o*2+2*e+(1&n));s[r]=s[r+1]=s[r+2]=M,s[r+3]=255}}t.putImageData(i,0,0)}(e,M,v,{tone:.3,glow:u,phase:f,near:n})}const b=!c&&(d||Math.abs(m-u)>.004);return b||(p=0),b}});const E=e=>{const o=r;r=e,t.dataset.state=e,"empty"===o!=("empty"===e)&&(w(),y?.refresh()),o!==e&&n.current.onState?.(e,"empty"===e?"":s)},$=()=>{E("done"),M.textContent=`${s} ready`,o&&n.current.onImage?.({file:m,src:a,width:o.width,height:o.height})};function L(e){A??(A=Object.assign(document.createElement("img"),{className:"ascii-drop-img",alt:""})),A.src=e,A.parentElement!==t&&(t.prepend(A),S.push(A))}const z=async(t,e=null,n=null)=>{const d=++c;let h;x=n,i&&URL.revokeObjectURL(i),i="string"==typeof t?"":URL.createObjectURL(t),a=i||t,m=e??("undefined"!=typeof File&&t instanceof File?t:null),s=m?.name??("string"==typeof t&&t.split("/").pop()?.split("?")[0]||"image"),M.textContent=`Converting ${s}`;try{h=await Xe(Ye(a))}catch{return void(d===c&&(M.textContent=`Could not load ${s}`))}if(d===c){if(o=h,!y)return L(a),E("done"),void $();l=performance.now(),E(y.still()?"done":"developing"),y.field.pulse({strength:1}),y.kick(),"done"===r&&$()}},P=(t,e=null)=>{const r=e=>{M.textContent=e,n.current.onError?.(e,t)};return t.type.startsWith("image/")?t.size>n.current.maxBytes?r(`${t.name} is over ${Math.round(n.current.maxBytes/1024/1024)} MB.`):void z(t,t,e):r(`${t.name} isn’t an image.`)},R=()=>{c++,o=null,a="",m=null,i&&URL.revokeObjectURL(i),i="",A?.remove(),E("empty"),M.textContent="",y?.kick()},F=()=>k.click(),T=e=>new Promise(a=>{const i=y?.field;if(!i||!o||"done"!==r)return void a(null);const l=document.createElement("canvas");l.width=i.canvas.width,l.height=i.canvas.height;const c=l.getContext("2d");c?(c.fillStyle=getComputedStyle(t).backgroundColor||"#000",c.fillRect(0,0,l.width,l.height),i.redraw(),c.drawImage(i.canvas,0,0),l.toBlob(t=>{if(t){const r=document.createElement("a");r.href=URL.createObjectURL(t),r.download=e??n.current.filename??`${s.replace(/\.[^.]+$/,"")}-ascii.png`,r.click(),setTimeout(()=>URL.revokeObjectURL(r.href),1e3)}a(t)},"image/png")):a(null)}),I=()=>{p=0,y?.kick()},W=e=>{e.preventDefault(),h++,g={x:e.clientX,y:e.clientY},d||(d=!0,t.dataset.over="",I())},B=t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="copy"),g={x:t.clientX,y:t.clientY}},O=()=>{h=Math.max(0,h-1),!h&&d&&(d=!1,g=null,delete t.dataset.over,I())},q=e=>{e.preventDefault(),h=0,d=!1,g=null,delete t.dataset.over;const n=t.getBoundingClientRect(),r={x:e.clientX-n.left,y:e.clientY-n.top};y?.field.pulse({...r,strength:1});const o=e.dataTransfer?.files?.[0];o?P(o,r):I()},N=t=>{const e=t.target?.closest?.("[data-dropzone]")?.getAttribute("data-dropzone");"pick"===e?F():"clear"===e?R():"download"===e&&T()},H=()=>{const t=k.files?.[0];k.value="",t&&P(t)};en("ascii-kit-dropzone",'\n:where(.ascii-drop-empty){position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;height:100%;min-height:inherit;padding:24px;box-sizing:border-box;text-align:center}\n:where([data-ascii-dropzone]:not([data-state="empty"])) :where(.ascii-drop-empty){display:none}\n:where(.ascii-drop-title){margin:0;font-weight:500}\n:where(.ascii-drop-hint){margin:0;font-size:14px;opacity:.65}\n:where(.ascii-drop-pick){margin-top:8px;height:34px;padding:0 14px;border:0;border-radius:999px;background:currentColor;font:inherit;font-size:14px;cursor:pointer}\n:where(.ascii-drop-pick) > span{color:Canvas}\n:where(.ascii-drop-img){position:absolute;inset:0;width:100%;height:100%;object-fit:cover}\n'),t.dataset.asciiDropzone="",k.type="file",k.accept="image/*",k.tabIndex=-1,k.hidden=!0,k.setAttribute("aria-hidden","true"),C&&S.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 S)t.appendChild(e);return E("empty"),t.addEventListener("dragenter",W),t.addEventListener("dragover",B),t.addEventListener("dragleave",O),t.addEventListener("drop",q),t.addEventListener("click",N),k.addEventListener("change",H),mt(()=>y,n,()=>y?.refresh(),{setImage:t=>z(t),clear:R,pick:F,download:T,get state(){return r}},()=>{c++,i&&URL.revokeObjectURL(i),t.removeEventListener("dragenter",W),t.removeEventListener("dragover",B),t.removeEventListener("dragleave",O),t.removeEventListener("drop",q),t.removeEventListener("click",N),k.removeEventListener("change",H),S.forEach(t=>t.remove()),delete t.dataset.asciiDropzone,delete t.dataset.state,delete t.dataset.over})},exports.dune=lo,exports.etch=ho,exports.facet=po,exports.fieldBackground=function(t,e={}){const n={current:{...be,...e}},r=()=>"notFound"===n.current.preset;let o=0,a=!1,i=0;const s={x:-1e4,y:-1e4,at:-1e6},l=()=>function(t){const e=document.createElement("canvas").getContext("2d");e.font=ke;const n=Math.max(320,Math.ceil(e.measureText(t).width)+160),{canvas:r,pen:o}=ve(n,560);return o.fillStyle="#fff",o.textAlign="center",o.textBaseline="middle",o.font=ke,o.letterSpacing="-10px",o.fillText(t,n/2,296),r}(n.current.text);let c=null;c=xe({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?Ce:"brand"===t.preset?Ae({scale:Se()?1.4:1.6,brightness:.24,contrast:1.1,clear:r(.3)}):Ae({scale:Se()?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?.(ke).then(()=>{c&&r()&&!a&&c.field.setSource(l())},()=>{});const d=(t,e=1.4)=>{c&&!c.still()&&(i=performance.now()+1400,Me(c.field,t,e))},h=t=>{const e=n.current,o=performance.now();!c||r()||!e.ripple||c.still()||o<i||o-s.at<520||Math.hypot(t.clientX-s.x,t.clientY-s.y)<36||(Object.assign(s,{x:t.clientX,y:t.clientY,at:o}),Me(c.field,{x:t.clientX,y:t.clientY},.65))};c&&t.addEventListener("pointermove",h);let u=n.current.preset,p=n.current.text;return ye(()=>c,n,t=>{c&&((t.preset!==u||"notFound"===t.preset&&t.text!==p)&&(o++,a=!1,c.field.setSource("notFound"===t.preset?l():null)),u=t.preset,p=t.text)},{pulse:d,scatter:async t=>{const e=c?.field;if(!e)return;if(!r())return void d(t);if(t&&d(t,1.2),a||c.still())return;a=!0;const n=++o,i=l(),s=function(t){const e=t.getContext("2d").getImageData(0,0,t.width,t.height).data,n=[];for(let r=0;r<t.height;r+=we)for(let o=0;o<t.width;o+=we){let a=!1;for(let n=0;n<we&&!a;n+=4)for(let i=0;i<we&&!a;i+=4)a=(e[4*((r+n)*t.width+o+i)]??0)>40;if(!a)continue;const i=n.length,s=J(i,1)*Math.PI*2,l=120+420*J(i,2);n.push({x:o,y:r,dx:Math.cos(s)*l+.5*(o-t.width/2),dy:Math.sin(s)*l*.6,lag:.35*J(i,3)})}return n}(i),h=ve(i.width,i.height).canvas;for(const t of Ee){const r=performance.now();if($e(i,h,s,t),await e.setSource(h),await ge(Math.max(0,44-(performance.now()-r))),n!==o||!c)return void(a=!1)}await e.setSource(i),a=!1}},()=>{o++,t.removeEventListener("pointermove",h)})},exports.fire=fo,exports.fluid=kr,exports.getFieldBudget=()=>s,exports.getGlobalLook=()=>o,exports.grid=mo,exports.halftone=Fr,exports.halo=Er,exports.imageGenerate=function(t,e={}){const n={current:{...e}},r=lt(),o=document.createElement("canvas");let a="idle",i=0,s=0,l="",c=null;const d={from:{img:null,k:0,blur:ue},to:{img:null,k:0,blur:ue},at:-1e6},h=()=>void 0===n.current.image?t.querySelector("img"):n.current.image,u=(t,e)=>{const n=e?1:fe((t-d.at)/he),r="generating"===a&&!e&&d.to.img?1-.45*(1-Math.exp(-Math.max(0,t-d.at)/1600)):1,o=(d.from.blur+(d.to.blur-d.from.blur)*n)*r,i=(d.from.img?d.from.k:0)+((d.to.img?d.to.k:0)-(d.from.img?d.from.k:0))*n;return d.to.img??d.from.img?[{img:d.from.img,k:i,blur:o,mix:1},{img:d.to.img,k:i,blur:o,mix:d.from.img?n:1}].filter(t=>t.img):[]},p=(t,e,n)=>{const r=performance.now(),o=c?.still()?1:fe((r-d.at)/he),[a]=u(r,!!c?.still());d.from={img:(o>=.5?d.to.img:d.from.img)??d.to.img??d.from.img,k:a?.k??0,blur:a?.blur??ue},d.to={img:t,k:e,blur:n},d.at=r,c?.kick()};c=ft({host:t,layer:"under",look:()=>({blend:"coarse",mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:7,cellAspect:.8,glyphScale:.8,contrast:1.4,drift:.5,speed:.6,hover:"trail",trail:{strength:.9,radius:.35},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:(t,e)=>{const n=Math.min(480,Math.max(2,Math.round(t)));return[n,Math.max(2,Math.round(n*e/Math.max(1,t)))]},onFail:()=>{c=null,r.restore()},paint:({pen:t,width:e,height:r,now:s,still:l})=>{const c="generating"===a,h=l?0:(s-i)/1e3;c&&n.current.elapsed&&(n.current.elapsed.textContent=(t=>{const e=t/1e3;return e<60?`${e.toFixed(1)}s`:`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,"0")}`})(s-i));const p=c&&!l?1+.12*Math.sin(2.1*h)*(.7+.3*Math.sin(.37*h)):1,f=Math.max(2,Math.ceil(24*r/Math.max(1,e)));24===o.width&&o.height===f||(o.width=24,o.height=f),Lt(o,3.1+(c?.55*h:0),.35);const m=u(s,l),g=Math.min(1,m[0]?.k??0);t.imageSmoothingEnabled=!0,t.globalAlpha=Math.max(0,1-g),t.filter=`brightness(${1.7*p})`,t.drawImage(o,0,0,e,r);for(const{img:n,k:o,blur:a,mix:i=1}of m){if(!n||o<=0||i<=0)continue;const s=n.width,l=n.height,c=Math.min(l,s*r/e),d=Math.min(s,l*e/r);t.globalAlpha=Math.min(1,1.25*o)*i,t.filter=`brightness(1.3) blur(${a*e/480}px)`,t.drawImage(n,(s-d)/2,Math.max(0,.45*(l-c)),d,c,0,0,e,r)}const x=c&&!l?.6*Math.min(1,g)*(1-Math.max(0,g-.8)/.2):0;return x>.01&&(t.globalCompositeOperation="lighter",t.globalAlpha=x,t.filter=`brightness(${.9*p})`,t.drawImage(o,0,0,e,r),t.globalCompositeOperation="source-over"),t.filter="none",t.globalAlpha=1,c||s-d.at<he}});const f=(e,r)=>{a=e,t.dataset.state=e,t.setAttribute("aria-busy",String("generating"===e)),n.current.onState?.(e,r)},m=t=>{const e=h();e&&c&&(r.set(e,"transition",c.still()?"none":`opacity ${t?560:440}ms cubic-bezier(.45, 0, .25, 1)`),r.set(e,"opacity",t?"1":"0"))},g=t=>new Promise(e=>setTimeout(e,t)),x=t=>{const e=h();e&&(l&&URL.revokeObjectURL(l),l="string"==typeof t?"":URL.createObjectURL(t),e.src=l||t,c||r.set(e,"visibility","visible"))},y=async(t=n.current.stream)=>{if(!t)return a;const e=++s,r=()=>e===s,o=!!c?.still();i=performance.now(),f("generating"),m(!1),p(null,0,ue);let l=0;try{for await(const e of"function"==typeof t?t():t){if(!r())return a;if(!(e.final??e.preview))continue;if(e.final){x(e.final),c&&p(await me(e.final),pe.final.k,pe.final.blur);break}if(!c){x(e.preview);continue}const t=pe.preview[Math.min(l++,pe.preview.length-1)];p(await me(e.preview),t.k,t.blur)}if(await g(o?0:544),!r())return a;f("done"),m(!0),c?.kick()}catch(t){if(!r())return a;p(null,0,ue),await g(o?0:340),f("failed",t)}return a};{const t=h();t&&r.set(t,c?"opacity":"visibility",c?"0":t.getAttribute("src")?"visible":"hidden")}return n.current.stream&&y(),mt(()=>c,n,()=>c?.refresh(),{run:y,reset(){s++,p(null,0,ue),f("idle"),m(!1)},get state(){return a}},()=>{s++,l&&URL.revokeObjectURL(l),delete t.dataset.state,t.removeAttribute("aria-busy"),r.restore()})},exports.interference=$r,exports.likeBurst=function(t,e={}){const n={current:{...xn,...e}},r=lt(),o=()=>t.querySelector(n.current.icon)??t,a=()=>!!(n.current.reducedMotion??tt());let i="true"===t.getAttribute("aria-pressed"),s=[],l=[],c=null;c=ft({host:t,outset:n.current.outset,layer:n.current.layer,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.92,...n.current.look}),ink:t=>n.current.ink??("heart"===n.current.kind?`var(--ascii-like, ${t?"#ff6b70":"#e5484d"})`:"--ascii-ink-strong"),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{c=null},paint:({pen:t,w:e,now:r,box:a})=>{const i=a(o()),l=n.current.kind;s=s.filter(e=>{const n=(r-e.start)/("burst"===e.kind?560:300);if(n>=1)return!1;if(n<0)return!0;if(t.save(),"burst"===e.kind)bn(t,l,i,n,e.seed);else{const e=i.x+i.w/2,r=i.y+i.h/2+3*yn(n),o=i.h*(1+.12*yn(n));Mn(t,l,e,r,o,(1-n)**1.4),t.fillStyle="#000";for(let a=r-o/2;a<r+o/2;a+=3)for(let r=e-o/2;r<e+o/2;r+=2)J(r,a)<1.15*n&&t.fillRect(r,a,2,3)}return t.restore(),!0});const c=n.current.limit;if(c&&s.length){const n=a(c),r=n.y+n.h,o=t.createLinearGradient(0,r-2,0,r+8);o.addColorStop(0,"#000"),o.addColorStop(1,"rgb(0 0 0 / 0)"),t.fillStyle="#000",t.fillRect(0,0,e,r-2),t.fillStyle=o,t.fillRect(0,r-2,e,10)}return s.length>0}});const d=()=>{l.forEach(clearTimeout),l=[]},h=()=>{if(d(),r.restore(),!c||a())return;const e=performance.now(),n=o();s=s.filter(t=>"undo"!==t.kind),s.push({kind:"burst",start:e,seed:Math.floor(e)%97}),n!==t&&r.set(n,"opacity","0"),l.push(setTimeout(()=>{r.restore(),n!==t&&"function"==typeof n.animate&&n.animate({opacity:["0","1"],scale:[".7","1"]},{duration:220,easing:"cubic-bezier(.34, 1.42, .64, 1)"})},347.2)),c.kick()},u=()=>{d(),r.restore(),c&&!a()&&(s=s.filter(t=>"burst"!==t.kind),s.push({kind:"undo",start:performance.now(),seed:0}),c.kick())},p=(e=!i)=>{i=e,t.setAttribute("aria-pressed",String(i)),i?h():u()},f=()=>{n.current.manage&&(p(),n.current.onChange?.(i))};return!t.hasAttribute("aria-pressed")&&n.current.manage&&t.setAttribute("aria-pressed","false"),t.addEventListener("click",f),mt(()=>c,n,()=>c?.refresh(),{burst:h,undo:u,toggle:p,get pressed(){return i}},()=>{d(),r.restore(),t.removeEventListener("click",f)})},exports.mesh=Lr,exports.moire=xo,exports.morph=yo,exports.mountCanvas=Or,exports.mountSurface=ft,exports.noise=vo,exports.odometer=function(t,e={}){const n=parseFloat((t.textContent??"").replace(/[^\d.-]/g,"")),r={current:{...zt,...e,value:e.value??(Number.isFinite(n)?n:0)}},o=lt();let a=r.current.value,i=r.current.format(a),s={from:i,to:i,t0:-1e9,up:!0,first:-1},l=null;const c=ct(i,!0),d=document.createElement("span"),h=()=>{d.replaceChildren(...[...i].map(t=>Object.assign(document.createElement("span"),{textContent:t}))),c.textContent=i};l=ft({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:3,cellAspect:.66,glyphScale:1,shade:.2,contrast:1.1,...r.current.look}),ink:()=>r.current.ink??getComputedStyle(t).color,kit:r,reducedMotion:()=>r.current.reducedMotion,resolution:2,onFail:()=>{l=null,t.textContent=i,o.restore()},paint:({pen:t,now:e,still:n,box:o,scale:a})=>{const i=getComputedStyle(d),l=parseFloat(i.fontSize),c=parseFloat(i.letterSpacing)||0,h=`${i.fontStyle} ${i.fontWeight} ${i.fontSize} ${i.fontFamily}`;t.setTransform(a,0,0,a,0,0),t.font=h,t.textAlign="center",t.textBaseline="alphabetic";const u=t.measureText("0"),p=u.fontBoundingBoxAscent||.8*l,f=u.fontBoundingBoxDescent||.2*l,{from:m,to:g,t0:x,up:y,first:v}=s,M=[...d.children],b=r.current,w="glyph"===b.face,k=(t,e)=>t[t.length-1-e]??"";let S=!1;return M.forEach((r,a)=>{const i=M.length-1-a,s=o(r),d=s.x+(s.w-c)/2,u=s.y,A=s.h,C=u+(A-p-f)/2+p,E=k(g,i),$=v-i,L=!n&&v>=0&&$>=0&&/\d/.test(E)?_((e-x)/(b.duration+$*b.stagger)):1,z=Z(L),P=L<1&&!w?Q(.72,1,L).toFixed(3):"";if(r.style.opacity!==P&&(r.style.opacity=P),L>=1)return void(w&&(t.globalAlpha=1,t.font=h,t.fillStyle="#fff",t.fillText(E,d,C)));S=!0,t.globalAlpha=w?1:1-Q(.72,1,L);const R=5+2*$,F=[k(m,i),...Array.from({length:R},(t,e)=>b.glyphs[Math.floor(J(e+7*i,x)*b.glyphs.length)]??""),E];y||F.reverse();const T=(F.length-1)*A,I=y?z*T:T-z*T;t.save(),t.beginPath(),t.rect(d-s.w,u,2*s.w,A),t.clip(),F.forEach((e,n)=>{const r=C+n*A-I;if(r<u-A||r>u+2*A)return;const o=n>0&&n<F.length-1;t.font=o?`600 ${.84*l}px "Geist Mono", ui-monospace, monospace`:h,t.fillStyle=o?"#d0d0d0":"#fff",t.fillText(e,d,r)}),t.restore()}),t.globalAlpha=1,S}});const u=()=>{l&&o.set(d,"color","glyph"===r.current.face?"transparent":"inherit")};l&&(o.set(d,"display","inline-flex"),u(),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),h(),document.fonts?.ready.then(()=>l?.kick()));const p=e=>{if(!Number.isFinite(e))return;const n=a,o=i;a=r.current.value=e,i=r.current.format(e),l?o!==i&&(s={from:o,to:i,up:e>=n,first:Pt(o,i),t0:performance.now()},h(),l.kick()):t.textContent=i};return mt(()=>l,r,t=>{u(),t.value!==a?p(t.value):(i=t.format(a),h(),l?.refresh())},{set:p,get value(){return a}},()=>{l&&(t.textContent=i),o.restore()})},exports.pageDissolve=function(t,e={}){const n={current:{...An,...e}},r=lt();let o=null,a=0,i=0,s=Promise.resolve(),l=0,c=null;const d="function"==typeof matchMedia&&matchMedia("(pointer: coarse)").matches?1:2,h=t=>{t.handed(),t.landing(),t.done()};c=ft({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:8,cellAspect:.6,glyphScale:.9,contrast:1.15,shade:.55,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:{get current(){return{...n.current,poster:void 0}}},reducedMotion:()=>n.current.reducedMotion,resolution:d,onFail:()=>{c=null;const t=o;o=null,r.restore(),t&&h(t)},paint:({pen:t,width:e,height:n,now:r})=>{const s=o;if(!s)return!1;const l=r-s.start,d=l/s.outMs,h=s.next?(r-s.nextAt)/s.nextMs:0;var u;d<1&&Pn(t,s.out,1.12*$n(d),s.at,++i),s.next&&h>0&&Pn(t,s.next,.1+1.14*(u=h,1-(1-Math.min(1,Math.max(0,u)))**2),s.at,i,!0);const p=s.next?(r-s.nextAt-s.nextMs+s.hand)/s.hand:-1,f=Ln(l/s.hand)*(1-Ln(p));f<1&&(t.globalAlpha=1-f,t.fillStyle="#000",t.fillRect(0,0,e,n),t.globalAlpha=1);const m=Math.round(-160*$n(2*d)*(s.next?1-$n(h):1))/1e3;return m!==a&&(a=m,c?.field.update({brightness:m})),0===s.stage&&l>=s.hand&&(s.stage=1,s.handed()),1===s.stage&&p>=0&&(s.stage=2,s.landing()),!(p>=1)||(o=null,s.done(),!1)}});const u=(e,n)=>{if(e&&"getBoundingClientRect"in e){const t=n.box(e);return{x:(t.x+t.w/2)*d,y:(t.y+t.h/2)*d}}return e?{x:e.x*d,y:e.y*d}:{x:t.offsetWidth/2*d,y:0}},p=e=>De(t,e.box,t.offsetWidth,t.offsetHeight,d,{skip:e.canvas}),f=(e,n)=>{for(const o of[...t.children].filter(t=>void 0===t.dataset.asciiKit&&void 0===t.dataset.asciiPoster))r.set(o,"transition",n?`opacity ${n}ms cubic-bezier(.16, 1, .3, 1)`:"none"),r.set(o,"opacity",e?"1":"0")},m=async(e,i)=>{const s=c;if(!s||(n.current.reducedMotion??tt())||!s.live)return void await e();const{dissolve:l,condense:d}=n.current,h=Math.max(1,Math.min(110,l/2,d/2)),[m,g]=zn(),[x,y]=zn(),[v,M]=zn(),b=o={at:u(i??n.current.origin,s),start:performance.now(),hand:h,out:p(s),outMs:Math.max(1,l),next:null,nextAt:0,nextMs:Math.max(1,d),handed:g,landing:y,done:M,stage:0};if(t.dataset.state="out",f(!1,h),s.kick(),await m,o===b){try{await e()}catch(t){throw o===b&&(o=null,r.restore(),c?.field.update({brightness:0})),t}c&&o===b&&(s.canvas.isConnected&&s.canvas.parentElement===t||t.appendChild(s.canvas),f(!1,0),t.dataset.state="in",b.next=p(s),b.nextAt=performance.now(),s.kick(),await x,o===b&&f(!0,h),await v,r.restore(),a=0,c?.field.update({brightness:0}),c?.kick())}};return mt(()=>c,n,()=>c?.refresh(),{swap(e,n){l++;const r=s.then(()=>m(e,n)).finally(()=>{0===--l&&delete t.dataset.state});return s=r.catch(()=>{}),r},get busy(){return l>0}},()=>{const e=o;o=null,r.restore(),delete t.dataset.state,e&&h(e)})},exports.pill=function(t,e={}){const n={current:{...ee,...e}},r=t instanceof HTMLElement?[t]:[...t],o=1===r.length,a=o?r[0]:r.length?function(t){let e=t[0].parentElement;for(;e&&!t.every(t=>e.contains(t));)e=e.parentElement;return e??document.body}(r):null,i=lt(),s=new Map,l=new Map,c=new Map,d=new Map,h=[],u=t=>void 0!==t.dataset.count?"count":"new"===ce(t,n.current.tone)?"new":"status",p=t=>void 0!==t.dataset.live?"false"!==t.dataset.live:n.current.live,f=(t=-1e6)=>{for(const e of r){const r=ce(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 m=()=>M?.dark()??(!a||st(a))?"dark":"light",g=()=>({mark:"glyph",charset:ae[m()],font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:le,cellAspect:1,glyphScale:1,color:"source",saturation:1,shade:0,...n.current.look}),x=()=>{const{cellSize:t=le,cellAspect:e=1}=g(),n=Math.min(2,globalThis.devicePixelRatio||1),r=Math.max(2,Math.round(t*n));return{ch:r/n,cw:Math.max(2,Math.round(r*e))/n}};let y=[0,0];const v=new Map;let M=null,b="";function w(){for(;h.length;)h.pop()();i.restore()}M=a?ft({host:a,layer:o?"under":"over",look:g,ink:()=>n.current.ink,kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:(t,e)=>{const{cw:n,ch:r}=x();return[Math.max(2,Math.round(2*t/n)),Math.max(2,Math.round(2*e/r))]},onFail:()=>{M=null,w()},onTheme:()=>M?.field.update({charset:ae[m()]}),paint:({pen:t,now:e,still:o,dark:h,box:f,width:m,w:g})=>{const w=n.current,k=h?"dark":"light",S={...ne[k],...w.tones?.[k]},A=(t,e)=>((t,e,n=.5)=>{const r=re[t],o=r.findIndex(([,t])=>t===e),a=o>0?r[o-1][0]:0;return a+(Math.min(r[o][0],1)-a)*n})(k,t,e),{cw:C,ch:E}=x(),$=m/g,L=(e,n,r,o)=>{o<=0||(t.fillStyle=function(t,e){const n=Math.max(1,...t),r=t.map(t=>t/n*255),o=(.2126*r[0]+.7152*r[1]+.0722*r[2])/255,a=Math.min(1,e/Math.max(o,.01));return`rgb(${r.map(t=>Math.round(Math.max(0,Math.min(255,t*a)))).join(" ")})`}(r,o),t.fillRect(Math.round((e+.5)*C*$)-1,Math.round((n+.5)*E*$)-1,2,2))};let z=!1;const P=r.map(t=>"count"!==u(t)&&w.indicator?t.querySelector("[data-dot]"):null),R=r.map((t,e)=>{const n=f(t),r=P[e]?f(P[e]):null,[o,a]=v.get(t)??[0,0],i=t=>({...t,x:t.x+y[0]-o,y:t.y+y[1]-a});return{b:i(n),dot:r&&i(r)}}),F=R.find((t,e)=>t.dot&&"status"===u(r[e]))??R.find(t=>t.dot)??R[0];if(F){const t=(t,e)=>{const n=((t-e/2)%e+e)%e;return n>.001?n-e:0},e=[F.dot?t(F.dot.x+F.dot.w/2,C):0,t(F.b.y+F.b.h/2,E)];(Math.abs(e[0]-y[0])>.01||Math.abs(e[1]-y[1])>.01)&&(y=e,M.canvas.style.translate=`${y[0].toFixed(2)}px ${y[1].toFixed(2)}px`)}const T=M.canvas.style,I=(t,e,n)=>Math.max(1,Math.floor((t-e)/n))*n+"px",W=I(a.clientWidth,y[0],C),B=I(a.clientHeight,y[1],E);T.width===W&&T.height===B||(T.width=W,T.height=B,M.field.resize(),z=!0);const O=R.map((t,e)=>{const n=t=>({...t,x:t.x-y[0],y:t.y-y[1]});return((t,e,n,r,o)=>{const[a,s]=v.get(t)??[0,0],l=(t,e)=>Math.round((t-e/2)/e)*e+e/2-t,c=n?l(n.x+n.w/2,r):0,d=l(e.y+e.h/2,o);return(Math.abs(c-a)>.01||Math.abs(d-s)>.01)&&(v.set(t,[c,d]),i.set(t,"translate",`${c.toFixed(2)}px ${d.toFixed(2)}px`)),{b:{...e,x:e.x+c,y:e.y+d},dot:n&&{...n,x:n.x+c,y:n.y+d}}})(r[e],n(t.b),t.dot&&n(t.dot),C,E)}),q=O.map(t=>t.b).map(t=>function(t,e,n){return{x:t.x+2,y:Math.round((t.y+t.h/2)/n-.5)*n,w:Math.max(0,t.w-4)}}(t,0,E)),N=function(t,e){const n=t=>t.toFixed(2),r=e/2,o=t.filter(t=>t.w>2*r).map(({x:t,y:o,w:a})=>`M${n(t+r)} ${n(o)}H${n(t+a-r)}A${n(r)} ${n(r)} 0 0 1 ${n(t+a-r)} ${n(o+e)}H${n(t+r)}A${n(r)} ${n(r)} 0 0 1 ${n(t+r)} ${n(o)}Z`).join("");return o?`path("${o}")`:"inset(50%)"}(q,E);return N!==b&&(b=N,M.canvas.style.clipPath=N),r.forEach((t,n)=>{const r=q[n],a=u(t),i=Math.round(r.y/E),h=Math.ceil(r.x/C),m=Math.floor((r.x+r.w)/C)-1;var g,x,y;if(!(m<h))if("status"===a){const r=O[n].dot;if(!r)return;const a=s.get(t),l=e-a.at,c=o?1:K(l/240);c<1&&(z=!0);const d=(g=S[a.from],x=S[a.to],y=c,g.map((t,e)=>t+(x[e]-t)*y)),u=!o&&p(t),f=Math.floor((r.x+r.w/2)/C),v="light"===k?.55:.7,M="light"===k?.35:.25;let b="neutral"===a.to?A("○"):"amber"===a.to&&p(t)?A("◐"):A("●",v);"red"===a.to&&!o&&l<640?(z=!0,Math.floor(l/160)%2==0&&(b=A("○"))):u&&"amber"===a.to?(z=!0,b=A(ie[Math.floor((e+90*n)/130)%4])):u&&(z=!0,b=A("●",v-M*Math.cos((e+500*n)/2200*Math.PI*2))),f>=h&&f<=m&&L(f,i,d,b)}else if("new"===a){const r=O[n].dot;if(!r)return;const a=Math.max(0,(e-(l.get(t)??-1e6))/720),s=Math.floor((r.x+r.w/2)/C);a<1&&!o&&(z=!0),s>=h&&s<=m&&L(s,i,S.new,A(a<1&&!o?se[Math.floor(a*se.length)]:"✦"))}else{const n=c.get(t),r=d.get(t)?.digits.children;if(!r)return;if((n?(e-n.at)/600:1)>=1||o){for(const t of r)t.style.opacity="",t.style.translate="";return}z=!0,[...r].forEach((t,r)=>{if(!n.changed[r])return;const o=t,a=f(o),s=(e-n.at-70*r)/460,l=K((s-.72)/.28);if(o.style.opacity=String(l),o.style.translate=`0 ${3*(l-1)}px`,s<=0||s>=.78)return;const c=Math.min(m,Math.max(h,Math.floor((a.x+a.w/2)/C)));L(c,i,S.neutral,A(["·","•","○","●"][Math.floor(9*s)%4]))})}}),z}}):null;const k=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){if("count"===u(t)){const e=(t.textContent??"").trim(),n=[...t.childNodes],r=ct(e),o=document.createElement("span");o.setAttribute("aria-hidden","true"),i.set(o,"display","inline-flex"),o.replaceChildren(...k(e)),t.replaceChildren(r,o),d.set(t,{text:e,live:r,digits:o}),h.push(()=>{const r=d.get(t)?.text??e;r===e?t.replaceChildren(...n):t.textContent=r})}else if(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:${le}px;height:${le}px;margin-inline-end:4px;vertical-align:middle`),t.prepend(e),h.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),h.push(()=>{t.parentElement?.insertBefore(e,t),t.remove()}),S(t)}else e instanceof HTMLElement&&void 0===e.dataset.dot&&S(e)}d.size&&document.fonts?.ready.then(()=>M?.kick()),a.addEventListener("pointermove",E),a.addEventListener("pointerleave",$)}function S(t){"static"===getComputedStyle(t).position&&i.set(t,"position","relative"),i.set(t,"z-index","2")}function A(t){const e=performance.now();for(const n of t?[t]:r.filter(t=>"new"===u(t)))l.set(n,e);M?.kick()}let C=null;function E(t){const e=t.target,o=r.find(t=>e&&t.contains(e))??null;o!==C&&(C=o,o&&"new"===u(o)&&n.current.sheen&&A(o))}function $(){C=null}return mt(()=>M,n,()=>{f(performance.now()),M?.refresh()},{sheen:A,count:(t,e)=>{const n=e??r.find(t=>"count"===u(t));if(!n)return;const o=String(t),a=d.get(n);if(!a)return void(n.textContent=o);if(o===a.text)return;const i=Math.max(o.length,a.text.length),s=a.text.padStart(i," "),l=o.padStart(i," "),h=M?.still()??!0;a.text=o,a.live.textContent=o,a.digits.replaceChildren(...k(l)),c.set(n,{at:h?-1e6:performance.now(),changed:[...l].map((t,e)=>t!==s[e])}),M?.kick()},refresh:()=>{f(performance.now()),M?.kick()}},()=>{a?.removeEventListener("pointermove",E),a?.removeEventListener("pointerleave",$),w()})},exports.pricingGlow=function(t,e={}){const n={current:{...Pe,...e}},r=(e=n.current.saving)=>Re(t,e,(()=>{const e=n.current.price;return"string"==typeof e?t.querySelector(e):e??t.querySelector("[data-price]")})(),n.current.font);let o=null,a=0,i=0,s=0,l=null;l=xe({host:t,look:()=>({mark:"dot",scene:"drift",scale:"number"==typeof innerWidth&&innerWidth<760?1.7:1,cellSize:4,cellAspect:1,dotScale:.92,color:"ink",shade:0,fit:"cover",focus:{x:.5,y:.5},levels:"none",contrast:1.1,brightness:-.04,drift:.5,hover:"lantern",lantern:{radius:.26,strength:.4,trail:.7,follow:8},trail:{strength:.9,radius:.4},fluid:{radius:.09,refraction:.03,glow:.6},...n.current.look}),ink:t=>n.current.ink??(t?"#aeaca5":"#5c5a55"),source:o=r(),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{l=null,c?.disconnect()}}),i=t.offsetWidth,s=t.offsetHeight;const c=l&&"function"==typeof ResizeObserver?new ResizeObserver(()=>{!l||Math.abs(t.offsetWidth-i)<2&&Math.abs(t.offsetHeight-s)<2||(i=t.offsetWidth,s=t.offsetHeight,a++,l.field.setSource(o=r()))}):null;c?.observe(t);const d=async t=>{const e=l?.field,n=o;if(o=t,!e)return;const r=++a;if(!n||l.still())return void await e.setSource(t);const i=ve(t.width,t.height),s=i.pen,c=t.width,d=t.height,h=.34*c;for(let o=1;o<=9&&r===a;o++){const r=performance.now(),a=o/9*(c+2*h)-h,l=Math.max(0,Math.min(c,a));s.globalCompositeOperation="source-over",s.drawImage(n,0,0,c,d),l>0&&s.drawImage(t,0,0,l,d,0,0,l,d);const u=s.createLinearGradient(a-h,0,a+.4*h,0);u.addColorStop(0,"rgb(0 0 0 / 0)"),u.addColorStop(.72,"rgb(255 255 255 / .5)"),u.addColorStop(1,"rgb(0 0 0 / 0)"),s.globalCompositeOperation="lighter",s.fillStyle=u,s.fillRect(0,0,c,d),await e.setSource(i.canvas),await ge(Math.max(0,48-(performance.now()-r)))}r===a&&l?.field===e&&await e.setSource(t)};return ye(()=>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()&&Me(l.field,t,e)}},()=>{a++,c?.disconnect()})},exports.pullRefresh=function(t,e){const n={current:{...nr,...e}},r=lt(),o=()=>n.current.content??t.children[0]??null,a=ct("",!0),i={x:0,v:0,to:0};let s="idle",l=!1,c=!1,d=0,h=-1,u=0,p=0,f=0,m=!0,g=0,x=null,y=[];const v=new WeakSet,M=t=>{a.textContent=t};x=ft({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:()=>{x=null},paint:({pen:t,w:e,now:a,still:c,scale:d,box:h})=>{const v=f?Math.min(1/30,(a-f)/1e3):1/60;f=a;let M=l;c?(i.x=i.to,i.v=0):l||(M=function(t,e,n=300,r=.86,o=.2){const a=2*Math.sqrt(n)*r,i=Math.max(1,Math.ceil(240*e)),s=e/i;for(let e=0;e<i;e++)t.v+=(-n*(t.x-t.to)-a*t.v)*s,t.x+=t.v*s;return!(Math.abs(t.x-t.to)<o&&Math.abs(t.v)<12*o&&(t.x=t.to,t.v=0,1))}(i,v)||M),"refreshing"===s&&(u+=6.5*v,M=!0),"done"===s&&a-p<320&&(M=!0);const b=o();b&&r.set(b,"translate",`0 ${Math.max(0,i.x).toFixed(2)}px`),t.setTransform(d,0,0,d,0,0);const k=n.current,S=Math.max(0,i.x),A=_(S/k.threshold),C=Math.min(k.threshold,48),E="idle"===s||"pulling"===s?Q(.1,.55,A):_(S/C),$=e/2,L=Math.min(S,C)/2+.25*Math.max(0,S-C);"pulling"===s&&A>=1&&!g&&(g=a),A<1&&(g=0);const z=g&&!c&&a-g<260?.14*Math.sin(Math.PI*((a-g)/260)):0;if(z&&(M=!0),S>.5&&E>.01){if(t.save(),t.beginPath(),t.rect(0,0,e,S),t.clip(),t.translate($,L),t.scale(E*(1+z),E*(1+z)),t.lineWidth=4,t.lineCap="round","idle"===s||"pulling"===s){const e=-Math.PI/2+.03*Math.max(0,S-k.threshold);t.strokeStyle=`rgba(255,255,255,${.55+.45*A})`,t.beginPath(),t.arc(0,0,11,e,e+2*Math.PI*Math.max(.02,A)),t.stroke()}else{const e="done"===s&&m?c?1:K((a-p)/300):0,n="refreshing"!==s||c?1:K((a-p)/240),r=24,o=2*Math.PI*(1-.22*n);for(let a=0;a<r;a++){const i=u-Math.PI/2+a/r*o,l=1-.85*n*(1-a/(r-1));t.strokeStyle=`rgba(255,255,255,${l*(1-e)*("done"!==s||m?1:.4)})`,t.beginPath(),t.arc(0,0,11,i,i+o/r+.02),t.stroke()}e>0&&function(t,e,n,r,o){if(o<=0)return;const a=[[-.82,.02],[-.26,.56],[.86,-.6]].map(([t,o])=>[e+t*r,n+o*r]),i=Math.hypot(a[1][0]-a[0][0],a[1][1]-a[0][1])+Math.hypot(a[2][0]-a[1][0],a[2][1]-a[1][1]);t.save(),t.strokeStyle="#fff",t.lineWidth=4.5,t.lineCap="round",t.lineJoin="round",t.setLineDash([i*o,i]),t.beginPath(),t.moveTo(a[0][0],a[0][1]),t.lineTo(a[1][0],a[1][1]),t.lineTo(a[2][0],a[2][1]),t.stroke(),t.restore()}(t,0,0,11,e)}t.restore()}return y=y.filter(e=>{if(!e.row.isConnected)return w(e,!0),!1;const n=c?1:(a-e.start)/760;if(n<0||!Number.isFinite(n))return M=M||Number.isFinite(n),!0;if(n>=rr&&w(e),n>=1)return w(e,!0),!1;const r=h(e.row);(!e.snap||Math.abs(e.snap.width/2-r.w)>.5||Math.abs(e.snap.height/2-r.h)>.5)&&(e.snap=Ze(e.row,r.w,r.h,t=>{const e=h(t);return{x:e.x-r.x,y:e.y-r.y,w:e.w,h:e.h}}).canvas,e.photos=[...e.row.querySelectorAll("img")]);const o=e.snap;return e.photos.length&&function(t,e,n){const r=e.getContext("2d"),o=n(t.row);t.photos=t.photos.filter(t=>{if(!t.complete)return!0;if(!r||!t.naturalWidth)return!1;const e=n(t),a=e.x-o.x,i=e.y-o.y,s=Math.min(parseFloat(getComputedStyle(t).borderTopLeftRadius)||0,e.w/2,e.h/2);return r.save(),r.setTransform(2,0,0,2,0,0),r.beginPath(),r.roundRect(a,i,e.w,e.h,s),r.clip(),r.fillStyle="#000",r.fillRect(a,i,e.w,e.h),Ve(r,_e({image:t,width:t.naturalWidth,height:t.naturalHeight},!x?.dark()),a,i,e.w,e.h),r.restore(),!1})}(e,o,h),t.globalAlpha=n<rr?K(n/rr,3):1-K((n-rr)/.7,3),t.drawImage(o,r.x,r.y,r.w,r.h),t.globalAlpha=1,M=!0,!0}),M||(f=0),M}});const b=()=>x?.kick();function w(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 k=(t,e)=>{if(x&&!x.still()){for(const n of t)n instanceof HTMLElement&&!v.has(n)&&(v.add(n),y.push({row:n,snap:null,start:e,opacity:n.style.opacity,transition:n.style.transition,shown:!1,photos:[...n.querySelectorAll("img")]}),n.style.transition="none",n.style.opacity="0");b()}},S=()=>{const t=performance.now();y.forEach(e=>{e.start===1/0&&(e.start=t)}),b()},A=t=>new Promise(e=>setTimeout(e,t)),C=async()=>{if("refreshing"===s||"done"===s)return;const e=n.current,r=!x||x.still();s="refreshing",l=c=!1,i.to=Math.min(e.threshold,48),p=performance.now(),t.setAttribute("aria-busy","true"),M(e.messages?.refreshing??"Refreshing."),b(),m=!0;try{await Promise.all([e.onRefresh(),A(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&&k(t.querySelectorAll(e.reveal),1/0)}s="done",p=performance.now(),M(m?e.messages?.done??"Updated.":e.messages?.failed??"Couldn’t refresh."),b(),await A(r?0:620),"done"===s?(s="idle",i.to=0,S(),t.removeAttribute("aria-busy"),b()):S()}},E=e=>{0!==e.button||"idle"!==s||t.scrollTop>0||(l=!0,c=!1,d=e.clientY,h=e.pointerId)},$=e=>{if(!l||e.pointerId!==h)return;e.clientY<d&&(d=e.clientY);const n=(e.clientY-d)/(t.getBoundingClientRect().height/(t.clientHeight||1)||1);if(!c){if(n<6)return;c=!0,s="pulling";try{t.setPointerCapture?.(e.pointerId)}catch{}}i.x=i.to=(t=>128*(1-Math.exp(-Math.max(0,t)/128)))(n-6),i.v=0,b()},L=()=>{if(l&&(l=!1,c)){if(c=!1,i.x>=n.current.threshold)return s="idle",void C();s="idle",i.to=0,b()}},z=t=>{c&&t.preventDefault()},P=t=>{l&&t.preventDefault()};return x?(r.set(t,"overscroll-behavior-y","contain"),t.appendChild(a),t.addEventListener("pointerdown",E),t.addEventListener("pointermove",$),t.addEventListener("pointerup",L),t.addEventListener("pointercancel",L),t.addEventListener("touchmove",z,{passive:!1}),t.addEventListener("dragstart",P),t.addEventListener("selectstart",P)):t.appendChild(a),mt(()=>x,n,()=>x?.refresh(),{refresh:C,revealRows:t=>k(t,performance.now()),get state(){return s}},()=>{s="idle",y.forEach(t=>{t.row.style.opacity=t.opacity,t.row.style.transition=t.transition}),y=[],t.removeEventListener("pointerdown",E),t.removeEventListener("pointermove",$),t.removeEventListener("pointerup",L),t.removeEventListener("pointercancel",L),t.removeEventListener("touchmove",z),t.removeEventListener("dragstart",P),t.removeEventListener("selectstart",P),t.removeAttribute("aria-busy"),a.remove(),r.restore()})},exports.pulse=Mo,exports.rain=bo,exports.resolveColor=nt,exports.ripple=Cr,exports.setFieldBudget=function(t){s=Number.isFinite(t)&&t>=1?Math.floor(t):12,B()},exports.setGlobalLook=function(t){const{charset:e,style:r}=t??{};o=t?{...e?{charset:e}:{},...n(r)?{style:r}:{}}:null;for(const t of i)t.relook();for(const t of[...a])t(o)},exports.silk=wo,exports.skeleton=function(t,e={}){const n={current:{..._t,...e}},r=lt();let o=0,a=null,i=null,s=null,l=null;const c=()=>[...t.querySelectorAll(n.current.blocks)].map((t,e)=>({el:t,kind:te(t),delay:void 0!==t.dataset.delay?Number(t.dataset.delay):80+e*n.current.stagger})),d=["mask-image","-webkit-mask-image"],h=()=>{r.restore(),t.removeAttribute("aria-busy"),i?.(),i=null};l=ft({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,h()},paint:({pen:t,now:e,still:i,box:s,w:l})=>{if(null!==a&&i)return h(),!1;const u=n.current,p=null===a?-1:e-a;if(null!==a&&p>Math.max(n.current.develop,...c().map(t=>t.delay+n.current.resolve))+16)return h(),!1;null!==a&&(t=>{for(const{el:e,kind:o,delay:a}of c()){const i=Kt(t,a,n.current.resolve);if(r.set(e,"opacity",String("text"===o?Math.min(1,1.6*i):i)),"text"===o){const t=128*i-14;for(const n of d)r.set(e,n,i>=1?"none":`linear-gradient(90deg, #000 ${t-14}%, transparent ${t+14}%)`)}}})(p);const f=Math.max(140,.42*l),m=l+f,g=-f+(i?.4:(e-o)/u.shimmer%1)*m,x=i?1:K((e-o)/280,3),y=t.createLinearGradient(g-m,0,g+m,.08*m);for(let t=0;t<=32;t++){const e=Math.abs(t/16-1)*m,n=Math.min(e,Math.abs(m-e)),r=n<f?.5+.5*Math.cos(n/f*Math.PI):0;y.addColorStop(t/32,Jt(.24+(.54-.24)*r))}const v=(e,n,r,o,a)=>{t.beginPath(),t.roundRect(e,n,Math.max(0,r),o,Math.min(a,o/2,Math.max(0,r)/2))};for(const{el:e,kind:n,delay:r}of c()){const{x:o,y:a,w:i,h:l}=s(e),c=e.getBoundingClientRect().width,d=Zt(e,n,c&&i?c/i:1),h=Kt(p,r,u.resolve);if(t.fillStyle=y,"photo"===n){const n=p<0?0:K(p/u.develop,4);t.globalAlpha=(1-h)*x,v(o,a,i,l,d.radius),t.fill();const r=e instanceof HTMLImageElement?e:e.querySelector("img");if(n>0&&r?.complete&&r.naturalWidth){const e=Math.max(i/r.naturalWidth,l/r.naturalHeight),s=r.naturalWidth*e,c=r.naturalHeight*e;t.save(),v(o,a,i,l,d.radius),t.clip(),t.globalAlpha=n*(1-h),t.drawImage(r,o+(i-s)/2,a+(l-c)/2,s,c),t.restore()}}else if("avatar"===n)t.globalAlpha=(1-h)*x,t.beginPath(),t.arc(o+i/2,a+l/2,Math.min(i,l)/2,0,2*Math.PI),t.fill();else{t.globalAlpha=x*(1-h);for(const e of d.lines){const n=o+e.x,r=n+e.w*h;v(r,a+e.y,n+e.w-r,e.h,d.radius),t.fill()}}t.globalAlpha=1}return!0}});const u=()=>{const e=null!==a;if(o=performance.now(),a=null,t.setAttribute("aria-busy","true"),l){if(e&&!l.still())for(const{el:t}of c())t.animate?.([{opacity:1},{opacity:0}],{duration:240,easing:"cubic-bezier(.16, 1, .3, 1)"});(()=>{for(const{el:t}of c()){r.set(t,"opacity","0");for(const e of d)t.style.removeProperty(e)}})(),l.kick()}};return u(),mt(()=>l,n,()=>l?.refresh(),{resolve:()=>l?(null!==a&&s||(a=performance.now(),s=new Promise(t=>{i=t}),l.kick()),s):(t.removeAttribute("aria-busy"),Promise.resolve()),reset(){i?.(),i=null,s=null,u()},get loading(){return null===a}},()=>{h()})},exports.slideToConfirm=function(t,e={}){const n={current:{...cn,...e}},r=lt(),o=t.querySelector(n.current.thumb)??t.firstElementChild,a=()=>t.querySelector(n.current.label),i=()=>!!(n.current.reducedMotion??tt());let s=pn(0,520,.8),l=pn(0,150,1),c=!1,d=0,h=!1,u=0,p=0,f=[],m=0,g=0,x=0,y="",v=-1,M=null;const b=()=>{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=>nt(n.current.ink??"--ascii-ink-strong",t)??nt(getComputedStyle(t).color,t)??(e?"#d8d6cf":"#1d1d1b");M=ft({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:a,still:i,dark:c,box:d})=>{const f=b();if(!f)return!1;const m=h?i?1:_((a-u)/dn):0,g=un(_(m/.5)),x=un(_((m-.36)/.3)),v=un(_((m-.46)/.4)),w=_((m-.5)/.5),S=1+.07*Math.sin(Math.PI*w)*(1-w),A=p?1-_((a-p)/260):1,C=n.current.mark?d(n.current.mark):{x:r/2-18,y:o/2-18,w:36,h:36},E=C.x+C.w/2,$=C.y+C.h/2,L=Math.min(C.w/2,o/2-2)*S,z=h?it(k(c),(e=>nt(n.current.color??"--ascii-success",t,e?"#3ccf7e":"#17844a"))(c),un(_(i?1:(a-u)/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 P=f.pad+s.x+f.size/2,R=h?1:l.x,F=hn(0,E-L,g),T=hn(P,E+L,g),I=hn(0,$-L,g),W=hn(o,$+L,g);if(T-F>1&&R>.004){const t=e.createLinearGradient(F,0,T,0);t.addColorStop(0,`rgba(255,255,255,${hn(.14,1,g)*R})`),t.addColorStop(.62,`rgba(255,255,255,${hn(.48,1,g)*R})`),t.addColorStop(1,`rgba(255,255,255,${R})`),e.fillStyle=t,e.globalAlpha=A*(1-.28*x),e.beginPath(),e.roundRect(F,I,T-F,W-I,hn(0,L,g)),e.fill()}return x>0&&(e.globalAlpha=1,e.fillStyle="#000",e.beginPath(),e.arc(E,$,Math.max(0,L-5)*x,0,2*Math.PI),e.fill()),e.restore(),v>0&&function(t,e,n,r,o,a,i){if(o<=0||a<=0)return;const s=[[-.82,.02],[-.26,.56],[.86,-.6]].map(([t,o])=>[e+t*r,n+o*r]),l=Math.hypot(s[1][0]-s[0][0],s[1][1]-s[0][1])+Math.hypot(s[2][0]-s[1][0],s[2][1]-s[1][1]);t.save(),t.globalAlpha=a,t.strokeStyle="#fff",t.lineWidth=i,t.lineCap="round",t.lineJoin="round",t.setLineDash([l*o,l]),t.beginPath(),t.moveTo(s[0][0],s[0][1]),t.lineTo(s[1][0],s[1][1]),t.lineTo(s[2][0],s[2][1]),t.stroke(),t.restore()}(e,E+.02*L,$+.07*L,.55*L,v,A,4.5),!1}});const S=()=>{const t=b();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*_(e))));const n=a();n&&r.set(n,"opacity",String(h?0:1-_(1.7*e)))},A=e=>{m=0;const n=Math.min(1/30,Math.max(0,(e-g)/1e3));g=e;let a=!c&&fn(s,n,.3);a=fn(l,n,.003)||a,p&&(e-p>=260||i())&&(p=0,h=!1,s=pn(0,520,.8),l=pn(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)),h&&e-u>302.4&&(t.dataset.confirmed=""),S(),M?.kick(),(a||c||h&&e-u<760||p>0)&&(m=requestAnimationFrame(A))},C=()=>{m||(g=performance.now(),m=requestAnimationFrame(A))},E=()=>{const e=b();if(!e||h)return;const a=e.max-s.x;c=!1,h=!0,s.to=e.max,l.to=1,u=performance.now()+(a>4?200:90),i()&&(mn(s),mn(l),u=-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")),x&&clearTimeout(x),n.current.resetAfter>0&&(x=setTimeout($,n.current.resetAfter)),S(),C(),n.current.onConfirm?.()};function $(){if(x&&clearTimeout(x),x=0,!h)return s.to=0,l.to=0,void C();p=performance.now(),t.dataset.state="resetting",o?.removeAttribute("aria-valuetext"),C()}const L=e=>{const r=b();if(!c||!r||void 0!==e&&void 0!==e.pointerId&&e.pointerId!==v)return;c=!1;const o=gn(f,performance.now());s.x>=r.max*n.current.threshold||o>900&&s.x>.5*r.max?E():(s.to=0,s.v=.25*_(o,-1500,1500),l.to=0,i()&&(mn(s),mn(l)),t.dataset.state="idle",C())},z=e=>{if(0===e.button&&!h&&o)if(o.contains(e.target)){try{o.setPointerCapture?.(e.pointerId)}catch{}v=e.pointerId,c=!0,d=e.clientX-s.x*w(),l.to=1,f=[],t.dataset.state="dragging",C()}else c||i()||(s.v+=420,l.to=0,C())},P=t=>{const e=b();c&&e&&t.pointerId===v&&(s.x=s.to=_((t.clientX-d)/w(),0,e.max),s.v=0,f.push([s.x,performance.now()]),f.length>8&&f.shift(),s.x>=e.max-.5?E():C())},R=t=>{const e=b();if(!e||h)return;if("Enter"===t.key||" "===t.key||"End"===t.key)return t.preventDefault(),void E();const n={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1}[t.key],r="Home"===t.key?0:void 0!==n?_(s.to+n*e.max/4,0,e.max):null;null!==r&&(t.preventDefault(),s.to=r,l.to=r>0?1:0,i()&&(mn(s),mn(l)),r>=e.max-.5?E():C())};o&&(o.hasAttribute("role")||o.setAttribute("role","slider"),o.hasAttribute("tabindex")||(o.tabIndex=0),o.hasAttribute("aria-label")||o.setAttribute("aria-label",a()?.textContent?.trim()||"Slide to confirm"),o.setAttribute("aria-valuemin","0"),o.setAttribute("aria-valuemax","100"),o.setAttribute("aria-valuenow","0"),r.set(o,"touch-action","none"),o.addEventListener("keydown",R));const F=t=>t.preventDefault();return t.dataset.state="idle",t.addEventListener("pointerdown",z),t.addEventListener("pointermove",P),t.addEventListener("pointerup",L),t.addEventListener("pointercancel",L),t.addEventListener("lostpointercapture",L),t.addEventListener("dragstart",F),mt(()=>M,n,()=>M?.refresh(),{confirm:E,reset:$,get confirmed(){return h}},()=>{m&&cancelAnimationFrame(m),x&&clearTimeout(x),m=x=0,o?.removeEventListener("keydown",R),t.removeEventListener("pointerdown",z),t.removeEventListener("pointermove",P),t.removeEventListener("pointerup",L),t.removeEventListener("pointercancel",L),t.removeEventListener("lostpointercapture",L),t.removeEventListener("dragstart",F),r.restore(),delete t.dataset.state,delete t.dataset.confirmed})},exports.stars=ko,exports.statusOrb=function(t,e={}){const n={current:{...It,...e}};let r="idle",o=0,a=0,i="",s="",l=-1e9,c="",d=null;const h=e=>{if(!n.current.colourByState||"idle"===r||"loading"===r)return(e=>nt(n.current.ink??"--ascii-ink-strong",t,e?"#d8d6cf":"#1d1d1b"))(e);const[o,a,i]=Wt[r];return nt(n.current.colors?.[r]??o,t,e?i:a)};d=ft({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=>h(t),kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:()=>[240,240],onFail:()=>{d=null},onTheme:()=>{l=-1e9,c=""},paint:({pen:t,now:e,still:u,dark:p})=>{const f=e-o;Vt(t,r,u?380:e,u?800:f,a,n.current.ring);const m=h(p);m!==s&&(i=s||m,s=m,l=e);const g=u?1:Gt(Math.min(1,(e-l)/200)),x=g<1?it(i,s,g):s;return x!==c&&(c=x,d?.field.update({ink:x})),"loading"===r||f<800||g<1}});const u=e=>{const n=performance.now();"loading"===r&&"loading"!==e&&(a=jt(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 mt(()=>d,n,()=>d?.refresh(),{idle:()=>u("idle"),loading:()=>u("loading"),success:()=>u("success"),warning:()=>u("warning"),error:()=>u("error"),get state(){return r}},()=>{delete t.dataset.state})},exports.streamText=function(t,e={}){const n={current:{...Xn,...e}},r=[...t.childNodes];let o="idle",a="",i=[],s=null,l=0,c=null,d=null,h=null;const u=()=>{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))}},p="roll"===n.current.transition;let f=null,m=null;const g=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))},x=t=>{t.span.style.removeProperty("color"),t.span.style.removeProperty("opacity")},y=()=>{i.forEach(x),i=[],"streaming"===o&&c&&g("done"),c?.(),c=null};if(h=ft({host:t,look:()=>{if(p){return{mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:u().size<24?2:3,cellAspect:.66,glyphScale:1,shade:.2,contrast:1.1,...n.current.look}}const{ch:t,cw:e}=u();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:()=>{h=null,y()},resolution:p?2:1,paint:({pen:e,now:r,still:a,box:l,scale:d})=>{if(p)return((e,r,a,l,d)=>{const h=getComputedStyle(t),p=parseFloat(h.fontSize)||15,{line:f}=u(),m=`${h.fontStyle} ${h.fontWeight} ${h.fontSize} ${h.fontFamily}`;e.setTransform(d,0,0,d,0,0),e.textAlign="left",e.textBaseline="alphabetic",e.font=m;const g=e.measureText("x"),v=g.fontBoundingBoxAscent||.8*p,M=g.fontBoundingBoxDescent||.2*p;a&&(i.forEach(x),i=[]);const b=n.current;if(i=i.filter(t=>{if(r>=t.at)return x(t),!1;const n=_((r-t.from)/Math.max(1,t.at-t.from)),o=Z(n),a=l(t.span);if(t.span.style.setProperty("opacity",Q(.72,1,n).toFixed(3)),n<=0)return!0;const i=a.y+(a.h-f)/2,s=i+(f-v-M)/2+v,c=3+t.seed%3,d=[...Array.from({length:c},(e,n)=>b.glyphs[Math.floor(J(n,t.seed)*b.glyphs.length)]??""),t.span.textContent??""],h=(1-o)*(d.length-1)*f;return e.save(),e.beginPath(),e.rect(a.x-2,i,a.w+4,f),e.clip(),e.globalAlpha=1-Q(.72,1,n),d.forEach((t,n)=>{const r=s+(n-(d.length-1))*f+h;if(r<i-f||r>i+2*f)return;const o=n===d.length-1;e.font=o?m:`600 ${.84*p}px "Geist Mono", ui-monospace, monospace`,e.fillStyle=o?"#fff":"#d0d0d0",e.fillText(t,a.x+(o?0:(a.w-e.measureText(t).width)/2),r)}),e.restore(),!0}),e.globalAlpha=1,!i.length&&c&&y(),b.caret&&"idle"!==o&&(s||"streaming"===o)){const t=i.find(t=>t.from>r),n=t?t.span.previousElementSibling:s,a=n?l(n):{x:0,y:0,w:0,h:f},c=a.y+(a.h-f)/2;e.fillStyle="streaming"===o?"#fff":"rgb(178.5 178.5 178.5)",e.fillRect(a.x+a.w+.18*p,c+.2*f,Math.max(2,.5*p),.6*f)}return i.length>0})(e,r,a,l,d);const{line:h,ch:f,cw:m,size:g}=u(),v=Math.floor(r/48),M=h/4,b=(t,n)=>{const r=Math.floor((t.y-M+t.h/2)/h)*h+M+(h-f)/2,o=Math.round(t.x/m),a=Math.round(255*n);e.fillStyle=`rgb(${a} ${a} ${a})`,e.fillRect(o*m,r,Math.max(1,Math.round((t.x+t.w)/m)-o)*m,f)};if(a&&(i.forEach(x),i=[]),i=i.filter(t=>r>=t.at?(x(t),!1):(b(l(t.span),.55+.45*J(v,t.seed)),!0)),!i.length&&c&&y(),n.current.caret&&"idle"!==o&&(s||"streaming"===o)){const t=s?l(s):{x:0,y:M,w:0,h:h},e=Math.round((t.x+t.w+.3*g)/m)*m;b({x:e,y:t.y,w:m,h:t.h},"streaming"===o?1:_n)}return i.length>0}}),h){const e=getComputedStyle(t),n=h.canvas.style,r=t=>parseFloat(t??"")||0,{line:o}=u(),a=r(e.paddingTop)-o/4,i=r(e.paddingRight)-o/2,s=r(e.paddingBottom)-o/4,l=r(e.paddingLeft);n.top=`${a}px`,n.left=`${l}px`,n.width=`calc(100% - ${l+i}px)`,n.height=`calc(100% - ${a+s}px)`}return mt(()=>h,n,()=>h?.refresh(),{write:e=>{if(!e)return;"streaming"!==o&&("idle"===o&&(t.replaceChildren(...Jn(t)),h&&t.appendChild(h.canvas)),d=null,g("streaming")),a+=e;const r=e=>t.appendChild(e);if(!h)return void r(document.createTextNode(e));const c=performance.now(),u=n.current,f=h.still();let m=0;for(const t of e.match(/\s+|\S/g)??[]){if(/^\s/.test(t)){r(document.createTextNode(t));continue}const e=document.createElement("span");if(e.textContent=t,!f)if(p){const t=i.length?i[i.length-1].from+u.stagger:c,n=Math.max(c,t);e.style.setProperty("opacity","0"),i.push({span:e,from:n,at:n+u.roll,seed:31*l+m})}else e.style.setProperty("color","transparent"),i.push({span:e,from:c,at:c+u.settle+m*u.stagger,seed:31*l+m});r(e),s=e,m++}l++,h.kick()},done:()=>d||("streaming"!==o?Promise.resolve():(d=new Promise(t=>{c=t}),h&&i.length?h.kick():y(),d)),stop(){if("idle"===o&&f)return d=null,g("stopped"),void h?.kick();"streaming"===o&&(i.forEach(x),i=[],g("stopped"),c?.(),c=null,h?.kick())},reasoning:e=>{if(!e||"undefined"==typeof document)return;if(!f||!m){en("ascii-kit-reasoning",Vn),f=document.createElement("div"),f.className="ascii-reasoning";const e=document.createElement("div");e.className="ascii-reasoning-in",m=document.createElement("ol"),e.appendChild(m),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 a=n.current.reducedMotion??tt();a||o.setAttribute("data-new",""),m.appendChild(o);const i=f,s=String(Math.max(0,m.children.length-r));a?i.style.setProperty("--ascii-reasoning-shift",s):(getComputedStyle(o).translate,requestAnimationFrame(()=>{o.removeAttribute("data-new"),i.style.setProperty("--ascii-reasoning-shift",s)}))},reset(){i=[],a="",s=null,l=0,f?.remove(),f=m=null,c?.(),c=null,d=null,t.replaceChildren(...Jn(t)),h&&t.appendChild(h.canvas),g("idle"),h?.kick()},get state(){return o},get text(){return a}},()=>{c?.(),c=null,f?.remove(),f=m=null,t.removeAttribute("aria-busy"),a?t.textContent=a:t.replaceChildren(...r)})},exports.subscribeGlobalLook=function(t){return a.add(t),()=>{a.delete(t)}},exports.swell=gr,exports.swipeDeck=function(t,e={}){const n={current:{...Fn,...e}},r=lt(),o=()=>!!(n.current.reducedMotion??tt()),a=()=>[...t.querySelectorAll(n.current.cards)];let i=0,s=In(0,380,.72),l=In(0,380,.8),c=In(0,260,.9),d=!1,h=0,u=0,p=null,f=[],m=0,g=0,x=-1,y=new Map,v=null,M=null;const b=t=>a()[k(t)]??null,w=()=>t.clientWidth||160,k=t=>{const e=a().length;return e?(t%e+e)%e:0},S=(e,r,o,i)=>{const s=b(e);if(!s||!n.current.loop&&e>=a().length)return null;const l="IMG"===s.tagName?s:s.querySelector("img"),c=`${l?.currentSrc||l?.src||""}|${l?.complete}|${Math.round(r)}x${Math.round(o)}|${i}`,d=y.get(s);if(d?.key===c)return d.canvas;const h=document.createElement("canvas");h.width=Math.max(1,Math.round(r)),h.height=Math.max(1,Math.round(o));const u=h.getContext("2d");if(!u)return null;const p=n.current.radius??(parseFloat(getComputedStyle(t).borderTopLeftRadius)||16);u.beginPath(),u.roundRect(0,0,h.width,h.height,Math.min(p,h.width/2,h.height/2)),u.clip();const f=l?function(t,e,n=.04){if(!t.complete||!t.naturalWidth)return null;const r=Math.min(1,420/Math.max(t.naturalWidth,t.naturalHeight)),o=document.createElement("canvas");o.width=Math.max(1,Math.round(t.naturalWidth*r)),o.height=Math.max(1,Math.round(t.naturalHeight*r));const a=o.getContext("2d",{willReadFrequently:!0});if(!a)return null;try{a.drawImage(t,0,0,o.width,o.height);const r=a.getImageData(0,0,o.width,o.height),i=r.data,s=new Uint32Array(256),l=i.length/4,c=t=>.2126*i[t]+.7152*i[t+1]+.0722*i[t+2];for(let t=0;t<i.length;t+=4)s[Math.round(c(t))]++;let d=0,h=255,u=0;for(let t=0;t<256;t++)if(u+=s[t],u>=.02*l){d=t;break}u=0;for(let t=255;t>=0;t--)if(u+=s[t],u>=.02*l){h=t;break}const p=Math.max(1,h-d);for(let t=0;t<i.length;t+=4){let r=_((c(t)-d)/p);e&&(r=1-r),i[t]=i[t+1]=i[t+2]=Math.round(255*(n+(1-n)*r)),i[t+3]=255}return a.putImageData(r,0,0),o}catch{return null}}(l,i):null;if(f){const t=Math.max(h.width/f.width,h.height/f.height),e=h.width/t,n=h.height/t;u.drawImage(f,(f.width-e)/2,(f.height-n)/2,e,n,0,0,h.width,h.height)}else u.fillStyle="rgb(60 60 60)",u.fillRect(0,0,h.width,h.height);return u.strokeStyle="rgb(150 150 150)",u.lineWidth=6,u.stroke(),y.set(s,{key:c,canvas:h}),h};function A(){const e=a(),o=i+(p?1:0),s=!n.current.loop&&o>=e.length?null:b(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=ft({host:t,outset:n.current.outset,look:()=>({blend:"coarse",mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.94,contrast:1.3,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{M=null,r.restore(),A()},onTheme:()=>{y=new Map},paint:({pen:e,w:n,now:r,dark:o,box:a})=>{const d=a(t),h=d.w,u=d.h,f=d.x+h/2,m=d.y+u/2,g=_(c.x),x=(t,n,r,a,i=0)=>{const s=S(t,h,u,!o);!s||a<=0||(e.save(),e.translate(f,m+r),e.scale(n,n),e.globalAlpha=a,e.drawImage(s,-h/2,-u/2),i>0&&(e.globalCompositeOperation="destination-out",e.globalAlpha=i,e.drawImage(((t,e)=>{let n=v;if(!n||n.width!==Math.round(t)||n.height!==Math.round(e)){n=v=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})(h,u),-h/2,-u/2)),e.restore())};x(i+2,Tn(.86,.93,g),Tn(24,12,g),Tn(.3,.55,g),.3),x(i+1,Tn(.93,1,g),Tn(12,0,g),Tn(.55,1,g),.4*(1-g));const y=S(i,h,u,!o);if(!y)return!1;const M=p?_((r-p.start)/620):0,b=p?.dir??1,w=p?p.x0+b*h*.9*(1-(1-M)**3):s.x,k=p?p.y0:l.x;if(e.save(),e.translate(f+w,m+k),e.rotate(.22*_(w/h,-1.6,1.6)),!p)return e.drawImage(y,-h/2,-u/2),e.restore(),!1;const A=Math.ceil(u/6);for(let t=0;t<A;t++){const r=Wn[t%Wn.length],o=_(1.55*M-.55*r);if(o>=1)continue;const a=b*o*o*h*(.5+.9*r),i=6*t,s=Math.min(6,u-i),l=b>0?f+w+a+.62*h:f+w+a-.62*h,c=b>0?n-4-l:l-4;e.globalAlpha=(1-o*o)*_(c/56),e.drawImage(y,0,i,h,s,-h/2+a,-u/2+i,h,s)}return e.restore(),!1}});const C=e=>{m=0;const o=Math.min(1/30,Math.max(0,(e-g)/1e3));g=e;let a=!1;d||p||(a=fn(s,o,.3),a=fn(l,o,.3)||a),a=fn(c,o,.002)||a,p&&e-p.start>=620&&(p=null,i+=1,$()),(()=>{(n.current.leanTarget??t).style.setProperty("--ascii-lean",String(p?0:_(s.x/(.4*w()),-1,1)));const e=b(i);!M&&e&&r.set(e,"transform",`translate(${s.x}px, ${l.x}px) rotate(${.22*_(s.x/w(),-1.6,1.6)}rad)`)})(),M?.kick(),(a||d||p)&&(m=requestAnimationFrame(C))},E=()=>{m||(g=performance.now(),m=requestAnimationFrame(C))},$=()=>{s=In(0,380,.72),l=In(0,380,.8),c=In(0,260,.9)},L=(t=1)=>{const e=a();if(p||!e.length||!n.current.loop&&i>=e.length)return!1;const h=b(i),u=k(i);return d=!1,o()||!M?(i+=1,$(),M||r.set(h,"transform","")):(p={dir:t,start:performance.now(),x0:s.x,y0:l.x},c.to=1),A(),E(),n.current.onSwipe?.(t,u,h),!0},z=t=>{if(!d||void 0!==t&&void 0!==t.pointerId&&t.pointerId!==x)return;d=!1;const e=gn(f,performance.now()),r=w();Math.abs(s.x)>r*n.current.threshold||Math.abs(e)>650&&Math.sign(e)===Math.sign(s.x)&&Math.abs(s.x)>16?L(s.x<0?-1:1):(s.to=0,l.to=0,c.to=0,s.v=.2*_(e,-1600,1600),o()&&(s.x=l.x=c.x=0,s.v=l.v=c.v=0),E())},P=()=>t.getBoundingClientRect().width/(t.clientWidth||1)||1,R=e=>{if(0!==e.button||p)return;try{t.setPointerCapture?.(e.pointerId)}catch{}x=e.pointerId;const n=P();d=!0,h=e.clientX-s.x*n,u=e.clientY-l.x/.3*n,f=[],E()},F=t=>{if(!d||t.pointerId!==x)return;const e=P();s.x=s.to=(t.clientX-h)/e,l.x=l.to=(t.clientY-u)/e*.3,s.v=l.v=0,c.to=.5*_(Math.abs(s.x)/w()),f.push([s.x,performance.now()]),f.length>8&&f.shift(),E()},T=t=>{"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||(t.preventDefault(),L("ArrowRight"===t.key?1:-1))},I=()=>M?.kick(),W=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",R),t.addEventListener("pointermove",F),t.addEventListener("pointerup",z),t.addEventListener("pointercancel",z),t.addEventListener("lostpointercapture",z),t.addEventListener("keydown",T),t.addEventListener("load",I,!0),t.addEventListener("dragstart",W),mt(()=>M,n,()=>{y=new Map,A(),M?.refresh()},{next:L,get index(){return k(i+(p?1:0))}},()=>{m&&cancelAnimationFrame(m),m=0,r.restore(),a().forEach(t=>{t.hidden=!1,t.removeAttribute("aria-hidden")}),(n.current.leanTarget??t).style.removeProperty("--ascii-lean"),t.removeAttribute("aria-roledescription"),t.removeEventListener("pointerdown",R),t.removeEventListener("pointermove",F),t.removeEventListener("pointerup",z),t.removeEventListener("pointercancel",z),t.removeEventListener("lostpointercapture",z),t.removeEventListener("keydown",T),t.removeEventListener("load",I,!0),t.removeEventListener("dragstart",W)})},exports.tabs=function(t,e={}){const n={current:{...de,...e}},r=()=>[...t.querySelectorAll(n.current.tabs)],o=r().findIndex(t=>"true"===t.getAttribute("aria-selected"));let a=Math.max(0,n.current.active??(o>=0?o:0)),i=-1e6,s=null,l=null;const c=lt(),d=()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:.62,glyphScale:.96,blend:"off",...n.current.look}),h=e=>{const n=dt(t,e);return{...n,x:n.x-t.clientLeft,y:n.y-t.clientTop}},u=e=>{l=e;const n=t=>Math.round(100*t)/100+"px";c.set(t,"--tabs-x",n(e.x)),c.set(t,"--tabs-y",n(e.y)),c.set(t,"--tabs-w",n(e.w)),c.set(t,"--tabs-h",n(e.h))},p=()=>{const t=r()[a];t&&u(h(t))};let f=null;f=ft({host:t,layer:"under",look:d,ink:()=>n.current.ink??"--ascii-ink",kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{f=null,p()},paint:({pen:t,now:e,still:o})=>{const l=r()[a];if(!l)return!1;const c=h(l),p=o||!s?1:_((e-i)/n.current.duration),m=p<1?function(t,e,n){const r=Math.sign(e.x+e.w/2-(t.x+t.w/2))||1,o=K(n/.78,4),a=K((n-.14)/.86,4);return{left:t.x+(e.x-t.x)*(r>0?a:o),right:t.x+t.w+(e.x+e.w-t.x-t.w)*(r>0?o:a),dir:r}}(s,c,p):{left:c.x,right:c.x+c.w,dir:1},g={x:m.left,y:c.y,w:m.right-m.left,h:c.h};u(g),p>=1&&(s=null);const x=d(),y=Math.min(2,globalThis.devicePixelRatio||1),v=Math.max(2,Math.round((x.cellSize??6)*y)),M=v/y,b=Math.max(2,Math.round(v*(x.cellAspect??.62)))/y,{n:w,x0:k}=function(t,e,n=20){const r=Math.max(0,Math.floor((t-2*n)/e));return{n:r,x0:(t-r*e)/2}}(g.w,b),S=t=>p<1?t:Math.round(t*y)/y,A=S(g.x+k),C=S(g.y+g.h-7-M),E=(A%b+b)%b-b,$=(C%M+M)%M-M,L=f.canvas,z=`${E.toFixed(3)}px ${$.toFixed(3)}px`;L.style.translate!==z&&(L.style.translate=z);const P=t=>`${Math.max(0,t).toFixed(2)}px`,R=A-E,F=C-$,T=`inset(${P(F)} ${P(L.clientWidth-R-w*b)} ${P(L.clientHeight-F-M)} ${P(R)})`;L.style.clipPath!==T&&(L.style.clipPath=T);const I=p<1?1-K(p,2):0;for(let e=0;e<w;e++){const n=w>1?e/(w-1):.5,r=m.dir>0?n:1-n,o=Q(0,.42,1-Math.abs(2*n-1))*(.5+I*(.5*r**1.4-.2));t.fillStyle=`rgb(${Math.round(255*o)} ${Math.round(255*o)} ${Math.round(255*o)})`,t.fillRect(A-E+e*b,C-$,b,M)}return p<1}});const m=()=>{const t=n.current;r().forEach((e,n)=>{const r=n===a;t.manage&&(e.setAttribute("aria-selected",String(r)),e.tabIndex=r?0:-1);const o=e.getAttribute("aria-controls")?document.getElementById(e.getAttribute("aria-controls")):null;o&&"none"!==t.panels&&("hidden"===t.panels?o.hidden=!r:o.toggleAttribute("data-active",r))})},g=(t,e=!1)=>{const o=r();if(!o.length)return;const c=(t%o.length+o.length)%o.length;e&&o[c].focus(),c!==a&&(s=l??h(o[a]),a=c,i=performance.now(),m(),f&&!f.still()||(s=null,p()),f.kick(),n.current.onChange?.(c,o[c]))},x=t=>{if(!n.current.manage)return;const e=t.target.closest?.(n.current.tabs),o=e?r().indexOf(e):-1;o>=0&&g(o)},y=t=>{if(!n.current.manage)return;const e={ArrowRight:a+1,ArrowLeft:a-1,Home:0,End:r().length-1};t.key in e&&(t.preventDefault(),g(e[t.key],!0))},v="function"==typeof ResizeObserver?new ResizeObserver(()=>{f?.live||p()}):null;return v?.observe(t),t.addEventListener("click",x),t.addEventListener("keydown",y),m(),p(),mt(()=>f,n,t=>{void 0!==t.active&&t.active!==a&&g(t.active),m(),f?.refresh()},{select:g,get active(){return a}},()=>{t.removeEventListener("click",x),t.removeEventListener("keydown",y),v?.disconnect(),c.restore()})},exports.terrain=So,exports.thinking=function(t,e={}){const n={current:{...jn,...e}},r=lt(),o=[...t.childNodes],a=n.current.label??null,i=a?[...a.childNodes]:[];let s="done",l=0,c=0,d=-1e9,h=0,u="",p=null;const f=a?ct("",!0):null,m=document.createElement("span");let g="",x="";const y=()=>n.current.reducedMotion??tt(),v=(t,e)=>{x=g,g=t,a&&(f&&(f.textContent=t),p?(m.replaceChildren(...[...t].map(t=>Object.assign(document.createElement("span"),{textContent:t}))),d=e?performance.now():-1e9,p.kick()):a.textContent=t)};a&&(p=ft({host:a,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:2,cellAspect:.66,glyphScale:1,shade:.2,contrast:1.1,...n.current.look}),ink:()=>n.current.ink??getComputedStyle(a).color,kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{p=null,a.textContent=g,r.restore()},paint:({pen:t,now:e,still:r,box:o,scale:a})=>{const i=getComputedStyle(m),l=parseFloat(i.fontSize)||14,h=`${i.fontStyle} ${i.fontWeight} ${i.fontSize} ${i.fontFamily}`;t.setTransform(a,0,0,a,0,0),t.textAlign="center",t.textBaseline="alphabetic",t.font=h;const u=t.measureText("x"),p=u.fontBoundingBoxAscent||.8*l,f=u.fontBoundingBoxDescent||.2*l,g=n.current,y=[...m.children],v=e-d<g.roll+y.length*g.wave,M=y.length*g.wave+g.roll+420;let b=!1;return y.forEach((n,a)=>{let i=1;if(!r&&v)i=_((e-d-a*g.wave)/g.roll);else if(!r&&"thinking"===s){const t=(e-c)%M-a*g.wave;i=t<0||t>g.roll?1:t/g.roll}const u=i<1?Q(.7,1,i).toFixed(3):"";if(n.style.opacity!==u&&(n.style.opacity=u),i>=1||!n.textContent?.trim())return;b=!0;const m=o(n),y=m.y+(m.h-p-f)/2+p,w=m.x+m.w/2,k=v?x[a]??" ":n.textContent,S=n.textContent,A=[k,...Array.from({length:3},(t,e)=>g.glyphs[Math.floor(J(e+7*a,Math.floor(c))*g.glyphs.length)]??""),S],C=Z(i)*(A.length-1)*m.h;t.save(),t.beginPath(),t.rect(m.x-2,m.y,m.w+4,m.h),t.clip(),t.globalAlpha=1-Q(.7,1,i),A.forEach((e,n)=>{const r=y+n*m.h-C;if(r<m.y-m.h||r>m.y+2*m.h)return;const o=0===n||n===A.length-1;t.font=o?h:`600 ${.86*l}px "Geist Mono", ui-monospace, monospace`,t.fillStyle=o?"#fff":"#d0d0d0",t.fillText(e,w,r)}),t.restore()}),t.globalAlpha=1,b||!r&&("thinking"===s||v)}}),p&&f&&(r.set(m,"display","inline-flex"),r.set(m,"white-space","pre"),m.setAttribute("aria-hidden","true"),a.replaceChildren(f,m,p.canvas)));const M=document.createElement("span"),b=()=>{h++,s="thinking",c=performance.now(),u="",M.replaceChildren(),t.replaceChildren(M),t.setAttribute("aria-busy","true"),v(n.current.labels?.thinking??"Thinking…",!1),n.current.onState?.("thinking",0),p?.kick()};let w=0,k=0;return n.current.start&&b(),mt(()=>p,n,()=>p?.refresh(),{think:b,stream:async e=>{"thinking"!==s&&b();const o=h;w=0;let a="";const i=()=>{"thinking"===s&&(s="streaming",k=performance.now(),l=Math.max(1,Math.round((k-c)/1e3)),v((n.current.labels?.done??Un)(l),!0),n.current.onState?.("streaming",l))},d=(t,e)=>{a+=t;const o=e?a.length:a.search(/\s\S*$/)+1;o<=0||(i(),u+=a.slice(0,o),(t=>{const e=!y()&&!p?.still();for(const o of t.match(/\s+|\S+/g)??[]){if(/^\s/.test(o)){M.append(o);continue}const t=document.createElement("span");if(t.textContent=o,e){r.set(t,"opacity","0");const e=Math.max(0,w*n.current.stagger-(performance.now()-k));r.set(t,"transition",`opacity 260ms cubic-bezier(.16, 1, .3, 1) ${Math.round(e)}ms`),requestAnimationFrame(()=>requestAnimationFrame(()=>t.style.setProperty("opacity","1")))}w++,M.appendChild(t)}})(a.slice(0,o)),a=a.slice(o))};if("string"==typeof e)d(e,!0);else{for await(const t of e){if(o!==h)return;d(t,!1)}if(o!==h)return;d("",!0)}i();const f=y()?0:Math.max(0,w*n.current.stagger-(performance.now()-k))+260;await new Promise(t=>setTimeout(t,f)),o===h&&(s="done",t.setAttribute("aria-busy","false"),n.current.onState?.("done",l),p?.kick())},get state(){return s}},()=>{h++,r.restore(),t.removeAttribute("aria-busy"),u?t.textContent=u:t.replaceChildren(...o),a&&(g?a.textContent=g:a.replaceChildren(...i))})},exports.toastStack=function(t,e={}){const n={current:{...Nn,...e}},r=lt(),o=document.createElement("ol"),a=ct("",!1);a.setAttribute("role","status");let i=[],s=[],l=0,c=!1,d=!1,h=!1,u=!1,p=null;const f=[];en("ascii-kit-toast",Gn),o.className="ascii-toasts",o.setAttribute("aria-label",n.current.label),t.append(o,a);const m=new WeakSet,g=e=>{const r=nt(n.current.ink??"--ascii-ink-strong",t,st(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(_(+t,0,255)).toString(16).padStart(2,"0")).join("")}`,[o,a]=[Dn(r),Dn(e)].sort((t,e)=>e-t);return(o+.05)/(a+.05)<3}(getComputedStyle(e).backgroundColor,r)&&(m.add(e),e.style.setProperty("transition","none","important"),e.style.setProperty("background-color","transparent","important"),e.style.setProperty("box-shadow","none","important"))},x=t=>{delete t.dataset.forming,m.delete(t)&&(t.style.removeProperty("transition"),t.style.removeProperty("background-color"),t.style.removeProperty("box-shadow"))};p=ft({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,...n.current.look}),outset:24,resolution:2,ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{p=null,s=[];for(const t of i)x(t.node)},paint:({pen:t,now:e,scale:n,still:r,box:o})=>(t.setTransform(n,0,0,n,0,0),s=s.filter(n=>{const r=(e-n.start)/n.ms;if(n.form&&r>=.62&&x(n.node),r>=1)return!1;if(n.form)tn(t,n.snap,n.blocks,n.order,1.04*Z(r),(t,e)=>[70*(t.seed-.5)*e,(14+26*J(t.x,t.y))*e],1-_((r-.62)/.28));else{const e=n.dir;tn(t,n.snap,n.blocks,n.order,1-1.04*(1-(1-r)**3),(t,r)=>[e*(14+34*t.seed+.5*Math.abs(n.throw))*r,14*(J(t.y,t.x)-.35)*r],1-_((r-.75)/.25))}return!0}),s.length>0)}),p&&(p.canvas.style.zIndex="11");const y=()=>!!p&&p.live&&!p.still(),v=()=>{const t=i.filter(t=>void 0===t.node.dataset.gone);t.forEach((e,n)=>{const o=t.length-1-n;r.set(e.node,"--d",String(o)),0===o?(e.node.dataset.front="",delete e.node.dataset.back):(e.node.dataset.back="",delete e.node.dataset.front)})},M=(e,n,r=0)=>{if(!p)return;const o=Ze(e,p.canvas.clientWidth||t.clientWidth+48,p.canvas.clientHeight||t.clientHeight+48,p.box),a=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:J(o,t)}))}return n}(o.rects),i=Math.max(1,...a.map(t=>t.x)),l=r<0?-1:1,c=l>0?t=>t.x/i:t=>1-t.x/i,d=Float32Array.from(a,t=>n?t.x/i*.3+.7*t.seed:.62*c(t)+.38*t.seed);s.push({start:performance.now(),ms:n?340:440,snap:o.canvas,blocks:a,order:d,form:n,node:e,dir:l,throw:r}),p.kick()},b=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))},w=()=>(t=>{if(t!==c){c=t,t?o.dataset.open="":delete o.dataset.open;for(const e of i)t&&e.timer&&(clearTimeout(e.timer),e.timer=0,e.left=Math.max(400,e.left-(performance.now()-e.since))),t||b(e)}})(d||h),k=()=>{d=!0,w()},S=()=>{d=!1,w()},A=()=>{h=!0,w()},C=t=>{o.contains(t.relatedTarget)||(h=!1,w())};function E(t,e=0){const n=i.find(e=>e.id===t);if(!n||void 0!==n.node.dataset.gone)return;n.timer&&clearTimeout(n.timer);const r=()=>{i=i.filter(t=>t!==n),s=s.filter(t=>t.node!==n.node),n.node.remove(),v(),p?.kick(),i.some(t=>void 0===t.node.dataset.gone)||(d=h=!1,w())},o=i[i.length-1]===n;y()&&(o||c||e)?(x(n.node),M(n.node,!1,e),n.node.dataset.gone="",v(),f.push(setTimeout(r,220))):r()}o.addEventListener("pointerenter",k),o.addEventListener("pointerleave",S),o.addEventListener("focusin",A),o.addEventListener("focusout",C);let $=null;const L=t=>{if(!n.current.swipe||0!==t.button||$)return;const e=t.target;if(e?.closest?.('button, a, input, textarea, select, [role="button"]'))return;const r=e?.closest?.("[data-toast]"),o=r&&i.find(t=>t.node===r);o&&void 0===r.dataset.gone&&void 0===r.dataset.forming&&($={item:o,id:t.pointerId,x0:t.clientX,dx:0,t:performance.now(),v:0},r.dataset.swiping="",r.setPointerCapture?.(t.pointerId))},z=t=>{if(!$||t.pointerId!==$.id)return;const e=performance.now(),n=t.clientX-$.x0;$.v=(n-$.dx)/Math.max(1,e-$.t),$.dx=n,$.t=e,$.item.node.style.setProperty("transform",`translateX(${n}px)`),$.item.node.style.setProperty("opacity",String(_(1-Math.abs(n)/260,.2)))},P=t=>{if(!$||t.pointerId!==$.id)return;const{item:e,dx:n}=$,r=e.node,o=performance.now()-$.t>90?0:$.v;$=null,delete r.dataset.swiping;const a=Math.abs(n)>64||Math.abs(o)>.45&&Math.abs(n)>8;r.style.removeProperty("opacity"),a?(E(e.id,n||o),r.style.setProperty("transform",`translateX(${n+48*Math.sign(n||o)}px)`)):r.style.removeProperty("transform")};return o.addEventListener("pointerdown",L),o.addEventListener("pointermove",z),o.addEventListener("pointerup",P),o.addEventListener("pointercancel",P),mt(()=>p,n,t=>{o.setAttribute("aria-label",t.label),p?.refresh()},{push:t=>{if(u)return-1;const e=++l,r=i.filter(t=>void 0===t.node.dataset.gone),s=r.length+1-Math.max(1,n.current.max);s>0&&r.slice(0,s).forEach(t=>E(t.id));const c=n.current.render?n.current.render(t,e):function(t,e){const n=(t,e,n)=>{const r=document.createElement(t);return r.className=e,n&&(r.dataset.paint=n),r},r=n("li","ascii-toast");if(void 0!==t.icon){const e=n("span","ascii-toast-icon","tile");e.setAttribute("aria-hidden","true"),"string"==typeof t.icon?e.textContent=t.icon:e.appendChild(t.icon),r.appendChild(e)}const o=n("span","ascii-toast-text"),a=n("b","ascii-toast-title","strong");if(a.textContent=t.title,o.appendChild(a),t.body){const e=n("span","ascii-toast-body","meta");e.textContent=t.body,o.appendChild(e)}if(r.appendChild(o),t.action){const{label:o,onClick:a}=t.action,i=n("button","ascii-toast-action","text");i.type="button",i.textContent=o,i.addEventListener("click",()=>{a(),e()}),r.appendChild(i)}const i=n("button","ascii-toast-close","none");return i.type="button",i.setAttribute("aria-label",`Dismiss ${t.title}`),i.textContent="×",i.addEventListener("click",e),r.appendChild(i),r}(t,()=>E(e));c.dataset.toast=String(e);const d={id:e,node:c,timer:0,left:t.duration??n.current.duration,since:0,born:performance.now()};return i.push(d),o.appendChild(c),v(),a.textContent=t.body?`${t.title}. ${t.body}`:t.title,y()?(c.dataset.forming="",g(c),M(c,!0)):p?.kick(),b(d),e},dismiss:t=>E(t),clear(){[...i].forEach(t=>E(t.id))},get toasts(){return i.filter(t=>void 0===t.node.dataset.gone).map(t=>t.id)}},()=>{u=!0;for(const t of i)t.timer&&clearTimeout(t.timer);f.forEach(clearTimeout),o.removeEventListener("pointerenter",k),o.removeEventListener("pointerleave",S),o.removeEventListener("focusin",A),o.removeEventListener("focusout",C),o.removeEventListener("pointerdown",L),o.removeEventListener("pointermove",z),o.removeEventListener("pointerup",P),o.removeEventListener("pointercancel",P),i=[],s=[],o.remove(),a.remove(),r.restore()})},exports.veil=Co,exports.voiceOrb=function(t,e={}){const n={current:{...Te,...e}},r=lt();let o="idle",a=0,i=_(n.current.level??0),s=i,l=0,c=0,d=Ie(n.current.palette),h=null,u=null,p=0;const f=t=>{t.canvas.style.filter=!t.dark()&&d.length?"brightness(.68) saturate(1.35)":""},m=e=>{t.style.setProperty("--ascii-level",e.toFixed(3)),n.current.swell&&r.set(t,"scale",String(1+.1*e))};h=ft({host:t,outset:Math.round(.08*(t.offsetWidth||0)),look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:.62,glyphScale:.92,fit:"cover",color:d.length?"source":"ink",contrast:2.2,brightness:1.1-.5,saturation:1.4,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,onTheme:()=>h&&f(h),onFail:()=>{h=null},paint:({pen:t,w:e,h:n,now:r,still:h})=>{const p=c?Math.min(64,r-c):16;c=r;const f=_((t=>"listening"===o?u?u.read():i:"thinking"===o?.2+.1*Math.sin((t-a)/120):"done"===o?l*(1-Z(_((t-a)/420))):i)(r));return h||"done"===o?s=f:s+=(f-s)*(1-(1-(f>s?.45:.12))**(p/16.7)),h||m(s),function(t,e,n,r,o,a){const i=t=>{const e=Math.round(255*_(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,h=r*(.25+.6*o),u=t.createRadialGradient(s,l,.92*c,s,l,1.3*c);u.addColorStop(0,i(.36*d)),u.addColorStop(1,"#000"),t.fillStyle=u,t.fillRect(0,0,e,n),t.save(),t.beginPath(),t.arc(s,l,c,0,2*Math.PI),t.clip();const p=s+.8*Math.cos(h)*c*.62,f=l-.55*c*.62,m=t.createRadialGradient(p,f,0,p,f,1.7*c);m.addColorStop(0,i(.95*d)),m.addColorStop(.55,i(.5*d)),m.addColorStop(1,i(.18)),t.fillStyle=m,t.fillRect(s-c,l-c,2*c,2*c),t.globalCompositeOperation="lighter",t.lineWidth=Math.max(1.5,.05*c);for(let e=0;e<6;e++){const n=e/6*Math.PI+.35*r,o=Math.sin(n);o<0||(t.strokeStyle=i(.16*o),t.beginPath(),t.ellipse(s,l,c*Math.abs(Math.cos(n)),c,0,0,2*Math.PI),t.stroke())}const g=t.createRadialGradient(s,l,.7*c,s,l,c);if(g.addColorStop(0,"#000"),g.addColorStop(1,i(.3)),t.fillStyle=g,t.fillRect(s-c,l-c,2*c,2*c),t.restore(),t.globalCompositeOperation="source-over",!a.length)return;t.globalCompositeOperation="color";const x=.4*r,y=.5*o,v=t.createLinearGradient(s-Math.cos(x)*c,l-Math.sin(x)*c,s+Math.cos(x)*c,l+Math.sin(x)*c);v.addColorStop(0,We(a,y)),v.addColorStop(.5,We(a,y+.25)),v.addColorStop(1,We(a,y+.5)),t.fillStyle=v,t.fillRect(0,0,e,n),t.globalCompositeOperation="source-over"}(t,e,n,h?0:r/1e3,s,d),!0}}),h&&f(h);const g=()=>{p++,u&&(u.stream.getTracks().forEach(t=>t.stop()),u.context.close().catch(()=>{}),u=null)},x=e=>{"listening"!==e&&g(),"done"===e&&(l=s),o=e,a=performance.now(),t.dataset.state=e,h||m("listening"===e?i:0),h?.kick()};return mt(()=>h,n,t=>{d=Ie(t.palette),void 0!==t.level&&(i=_(t.level)),h?.refresh(),h&&f(h)},{level(t){i=_(Number.isFinite(t)?t:0),h||"listening"!==o||m(i),h?.kick()},listen:()=>x("listening"),think:()=>x("thinking"),done:()=>x("done"),idle:()=>{i=0,x("idle")},async mic(){g();const t=p,e="undefined"!=typeof navigator?navigator.mediaDevices:void 0,n=globalThis.AudioContext;if(!e?.getUserMedia||!n)return!1;let r;try{r=await e.getUserMedia({audio:!0})}catch{return!1}if(t!==p)return r.getTracks().forEach(t=>t.stop()),!1;const o=new n,a=o.createAnalyser();a.fftSize=1024,o.createMediaStreamSource(r).connect(a);const i=new Uint8Array(a.fftSize);return u={stream:r,context:o,read(){a.getByteTimeDomainData(i);let t=0;for(const e of i)t+=((e-128)/128)**2;return 5*Math.sqrt(t/i.length)}},x("listening"),!0},get state(){return o},get current(){return s}},()=>{g(),r.restore(),t.style.removeProperty("--ascii-level"),delete t.dataset.state})},exports.voidWell=Eo,exports.wave=$o,exports.weave=zo,exports.wordField=yr,exports.wordmark=function(t,e={}){const n=(t.textContent??"").trim(),r={current:{...Le,...e}};let o=r.current.text??n;const a=lt(),i=()=>function(t,e=Le.font,n=Le.fontWeight,r=520){const{canvas:o,pen:a}=ve(1800,Math.max(1,Math.round(r))),i=Math.min(400,1700/Math.max(3,.56*[...t].length));return a.fillStyle="#fff",a.textAlign="center",a.textBaseline="middle",a.font=`${n} ${i}px ${e}`,a.fillText(t||" ",o.width/2,o.height/2+.05*i),o}(o,r.current.font,r.current.fontWeight,r.current.artHeight),s=!n;let l=null;l=xe({host:t,layer:"over",look:()=>({mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:7,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.3,levels:"auto",fit:"contain",focus:{x:.5,y:.5},hover:"trail",trail:{strength:.62,radius:.22},...r.current.look}),ink:()=>r.current.ink??"--ascii-ink-strong",source:i(),label:s?r.current.label??o:void 0,kit:r,reducedMotion:()=>r.current.reducedMotion,onFail:()=>{l=null,a.restore()}}),l&&n&&a.set(t,"color","transparent"),l&&document.fonts?.load?.(`${r.current.fontWeight} 100px ${r.current.font}`).then(()=>{l&&l.field.setSource(i())},()=>{});const c=e=>{if(e!==o)if(o=e,void 0!==r.current.text&&(r.current={...r.current,text:o}),l)if(l.field.setSource(i()),s)l.field.update({label:r.current.label??(o||" ")});else{for(const e of[...t.childNodes])e!==l.canvas&&e.remove();t.prepend(document.createTextNode(o))}else n&&(t.textContent=o)};return ye(()=>l,r,t=>{void 0!==t.text&&t.text!==o?c(t.text):l&&l.field.setSource(i())},{setText:c,get text(){return o}},()=>a.restore())};//# sourceMappingURL=kit.cjs.map
1
+ "use strict";var t=require("./field.cjs"),e={ascii:{mark:"glyph",charset:" .:-=+*#%@"},blocks:{mark:"glyph",charset:" ░▒▓█"},braille:{mark:"glyph",charset:" ⠁⠃⠇⡇⣇⣧⣷⣿"},dots:{mark:"dot"},lines:{mark:"glyph",charset:" -═╪╬"},cross:{mark:"glyph",charset:" ·+xX#"},diagonal:{mark:"glyph",charset:" /╱╳"},diamond:{mark:"glyph",charset:" ·◇◈◆"},mixed:{mark:"glyph",charset:" .:+/◇#@"},pixel:{mark:"pixel"},mosaic:{mark:"mosaic"},lego:{mark:"lego"},voxel:{mark:"voxel"},disco:{mark:"disco"},dither:{mark:"dither"},hex:{mark:"hex"},led:{mark:"led"},cmyk:{mark:"cmyk"},stipple:{mark:"stipple"},engraving:{mark:"engraving"},crosshatch:{mark:"crosshatch"},woodblock:{mark:"woodblock"},risograph:{mark:"risograph"},pointillism:{mark:"pointillism"}},n=t=>"string"==typeof t&&Object.prototype.hasOwnProperty.call(e,t),r=/\p{L}/u,o=null,a=new Set,i=new Set;var s=12,l=new Set,c=null,d=null,h=0,u=-1e9,p=0,f=0,m=!1,g=!1,x=()=>{const t=d?.timeline?.currentTime;return"number"==typeof t?t:null};var y=()=>"undefined"!=typeof performance?performance.now():Date.now(),v=()=>"number"==typeof innerHeight?innerHeight:0;function M(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-v();return n>0?n:0}function b(){try{const t=d?.querySelectorAll?.("dialog:modal");return t?.length?t[t.length-1]:null}catch{return null}}var w=1e8;function k(t,e){if(t.eager)return void(t.wanted=!0);const n=v(),r=M(t.host,e);!n||r<=2*n?t.wanted=!0:r>3*n&&(t.wanted=!1)}function S(t){let e=!1;for(const n of t)if(n?.target)for(const t of l)t.host===n.target&&(k(t,n.boundingClientRect??void 0),e=!0);e&&B()}var A=()=>B(),C=0,E=0,$=()=>{const t="number"==typeof scrollY?scrollY:0;t!==E&&(C=t>E?1:-1),E=t};function L(t,e){if(!e||!C)return e;return t.getBoundingClientRect().top>0===C>0?e:2*e}var z=null,P=t=>{z!==t&&(z?.removeEventListener?.("close",A,!0),z?.removeEventListener?.("scroll",$,!0),t?.addEventListener?.("close",A,!0),t?.addEventListener?.("scroll",$,{capture:!0,passive:!0}),z=t)},R=new WeakSet,F=0;function T(){F||"function"!=typeof requestIdleCallback||(F=requestIdleCallback(I,{timeout:2e3}))}function I(t){F=0;const e=[...l].filter(t=>!t.live&&t.prewarm&&!R.has(t)).sort((t,e)=>M(t.host)-M(e.host));for(const n of e){if(t.timeRemaining()<2&&!t.didTimeout)return void T();R.add(n);try{n.prewarm()}catch{}}}function W(t){d!==t.doc&&(d=t.doc,l.clear(),h=p=f=C=0,u=-1e9,E="number"==typeof scrollY?scrollY:0),P(d),l.add(t);const e=function(){const t="function"==typeof IntersectionObserver?IntersectionObserver:null;if(!t)return null;if(c?.ctor!==t){c?.list.forEach(t=>t.disconnect()),c={ctor:t,list:["200% 0px","300% 0px","0px"].map(e=>new t(S,{rootMargin:e}))};for(const t of l)c.list.forEach(e=>e.observe(t.host))}return c.list}();e?.forEach(e=>e.observe(t.host)),e?k(t):t.wanted=!0,B(),t.live||T()}function B(e=!1){if(m)g=!0;else{m=!0;try{do{g=!1;const n=y(),r=x();(e||(null===r?n-u>16||n<u:r!==u))&&(u=r??n,p=f=0);for(const t of l)!1===t.host.isConnected&&(t.wanted=!1);for(const t of l)t.live&&!t.wanted&&t.release();const o=[...l].filter(t=>t.live&&!t.shared),a=b(),i=t=>!!a&&!a.contains(t.host),c=t=>M(t.host)+(i(t)?w:0),d=t=>t.eager&&!i(t),m=()=>o.filter(t=>t.live&&!t.shared).map(t=>[t,c(t)+(d(t)?0:1e9)]).sort((t,e)=>e[1]-t[1]);for(let t=o.length-s,e=t>0?m():[];t>0;t--)e.shift()?.[0].release();const k=t.currentFieldContext(),S=1*v(),A=()=>[...l].filter(t=>t.live&&t.shared&&c(t)>S).sort((t,e)=>c(e)-c(t));if(k?.overBudget)for(const t of A()){if(!k.overBudget)break;t.release()}const C=[...l].filter(t=>t.wanted&&!t.live).map(t=>[t,t.eager?-1:c(t)]).map(([t,e])=>[t,e,e>0?L(t.host,e):e]).sort((t,e)=>t[2]-e[2]);let E=0;for(const[t,n]of C){if(!l.has(t)||t.live)continue;if(k&&!k.roomy){const e=A()[0];if(!e||c(e)<=c(t))break;if(e.release(),!k.roomy)break}if(!t.eager&&(p>=4||f>=2)&&(!e||E)){h||(h=requestAnimationFrame(()=>{h=0,B(!0)}));break}if(o.filter(t=>t.live&&!t.shared).length>=s){const e=m()[0]?.[0];if(!e||(d(e)?!t.eager||c(e)<=c(t):!t.eager&&c(e)<=n))break;e.release()}const r=y();t.mount(),p+=y()-r,E++,t.eager||f++,t.live&&!t.shared&&o.push(t)}}while(g)}finally{m=!1}}}var O='ui-monospace, "SF Mono", Menlo, Consolas, monospace',q=new Map;function N(t,e){const{max:n,mean:r}=function(t,e=O){const n=`${e}\0${t}`,r=q.get(n);if(r)return r;let o={max:1,mean:1};try{const n="undefined"==typeof document?null:Object.assign(document.createElement("canvas"),{width:48,height:48}).getContext("2d",{willReadFrequently:!0});if(n&&"function"==typeof n.getImageData){n.font=`500 36px ${e}`,n.textAlign="center",n.textBaseline="middle";const r=t=>{n.clearRect(0,0,48,48),n.fillStyle="#000",n.fillText(t,24,25);const e=n.getImageData(0,0,48,48).data;let r=0;for(let t=3;t<e.length;t+=4)r+=e[t];return r/255},a=t=>[...t].filter(t=>t.trim()).map(r),i=t=>t.reduce((t,e)=>t+e,0)/Math.max(1,t.length),s=a(t),l=a(".:-=+*#%@"),c=r("@");s.length&&c>0&&i(l)>0&&(o={max:Math.max(...s)/c,mean:i(s)/i(l)})}}catch{}return q.set(n,o),o}(t,e.font??O),o=e.glyphScale??.8,a=e.gamma??1,i=e.fontWeight??500;return n>1.15?{glyphScale:Math.max(.3,o*Math.max(.62,n**-.36)),gamma:a,fontWeight:i}:r>1.5?{glyphScale:Math.max(.3,o*r**-.25),gamma:a,fontWeight:i}:n<.85?{glyphScale:Math.min(1.6,o*Math.min(1.3,n**-.3)),gamma:a,fontWeight:n<.6?Math.max(i,700):i}:{glyphScale:o,gamma:a,fontWeight:i}}var H=new WeakMap;function G(t,e){for(const n of H.get(t)?.keys()??[])n.getAttribute("src")!==e&&(n.src=e)}function D(t){const e=H.get(t);H.delete(t),e?.forEach(t=>t())}function j(t,e,n,r,o){const a=document.createElement("img");a.alt="",a.decoding="async",a.setAttribute("aria-hidden","true"),a.setAttribute("style",`${n};object-fit:cover`),a.style.opacity="1",a.dataset.asciiPoster="",a.src=e;const i=t.style.getPropertyValue("position"),s="function"==typeof getComputedStyle&&"static"===getComputedStyle(t).position;s&&t.style.setProperty("position","relative");const l=t.style.getPropertyValue("isolation"),c=/z-index:\s*-1/.test(n)&&"function"==typeof getComputedStyle&&"auto"===getComputedStyle(t).isolation;c&&t.style.setProperty("isolation","isolate"),o?.parentElement===t?t.insertBefore(a,o):t.appendChild(a);let d=!1;const h=()=>{d||(d=!0,a.remove(),H.get(r)?.delete(a),s&&(i?t.style.setProperty("position",i):t.style.removeProperty("position")),c&&(l?t.style.setProperty("isolation",l):t.style.removeProperty("isolation")))},u=H.get(r)??new Map;return u.set(a,h),H.set(r,u),{show(t){a.style.opacity=t?"1":"0"},remove:h}}function U(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}function X(n){const{host:a,kit:s}=n;let d,h=n.canvas,u=null,p=!1,f=!1,m=!1,g=!1,x={},y={},v=n.source,M=!1,b={},w=null,k=null,S=!1,A=null,C=()=>{};const E=!n.ownPoster&&s?.current.poster?j(a,s.current.poster,n.place,s,h):null,$=()=>{if(!o||!1===s?.current.globalLook||"glyph"!==(y.mark??"glyph")&&!n.glyphs||r.test(y.charset??""))return;const t=o.style?e[o.style]:void 0,a=t?.mark??"glyph",i="glyph"===a?o.charset||(t&&"charset"in t?t.charset:void 0):void 0;return t||i?{mark:a,charset:i}:void 0},L=()=>({...n.glyphs?Object.fromEntries(Object.keys(n.glyphs()).map(t=>[t,y[t]]).filter(([,t])=>void 0!==t)):{},mark:y.mark??"glyph",charset:y.charset??" .,:-=+*#%@",glyphScale:y.glyphScale??.8,gamma:y.gamma??1,fontWeight:y.fontWeight??500}),z=t=>{if(!t.charset)return{...L(),mark:t.mark};const e=n.glyphs&&"glyph"!==(y.mark??"glyph")?n.glyphs():{};return{...e,mark:t.mark,charset:t.charset,...N(t.charset,{...y,...e})}},I=()=>{const t=$(),e=t&&`${t.mark}\0${t.charset??""}`;return e===d?null:(d=e,t?z(t):L())},O={host:a,doc:document,eager:!1===s?.current.lazy,wanted:!1,live:!1,poster:!!E||!!n.ownPoster,mount(){if(f||u)return;p&&(h=n.canvas=U(h)),p=!0,y={...n.options(),...x},d=void 0;const e=I();let r;try{r=t.mountGlyphField(h,{...y,...e,...void 0===v?{}:{source:v},onError:()=>{u===r&&q()}})}catch{return void q()}u=r,O.live=!0,O.shared=t.isSharedFieldCanvas(h);const o=h;if(O.shared)C=()=>{};else{let t=0;const e=()=>{u===r&&(E?.show(!0),clearTimeout(t),t=setTimeout(()=>{u===r&&h===o&&(O.release(),B())},1e3))},n=()=>{clearTimeout(t),requestAnimationFrame(()=>requestAnimationFrame(()=>{u===r&&E?.show(!1)}))};o.addEventListener?.("webglcontextlost",e),o.addEventListener?.("webglcontextrestored",n),C=()=>{clearTimeout(t),o.removeEventListener?.("webglcontextlost",e),o.removeEventListener?.("webglcontextrestored",n)}}M&&r.pause(),r.ready.then(()=>{u===r&&(S=!0,E?.show(!1),w?.(),w=k=null)},()=>{}),n.onMount?.(r,h)},release(){if(!u)return;const t=u;u=null,O.live=!1,S=!1,C(),A?.clear(),A=null,b=t.settings,t.destroy(),O.shared?f||(h.width=h.width,p=!1):((t=>{try{const e=t.getContext("webgl2");e&&!e.isContextLost?.()&&e.getExtension("WEBGL_lose_context")?.loseContext()}catch{}})(h),f||(h=n.canvas=U(h),p=!1)),E?.show(!0),n.onRelease?.()},prewarm(){if(f||u)return;y={...n.options(),...x};const e=$();t.prewarmGlyphAtlas(h,{...y,...e?z(e):{}})}};function q(){m||(m=!0,H(),g||n.onFail())}function H(){f||(f=!0,O.release(),function(t){l.delete(t)&&([...l].some(e=>e.host===t.host)||c?.list.forEach(e=>e.unobserve(t.host)),!l.size&&c&&(c.list.forEach(t=>t.disconnect()),c=null),l.size||(P(null),F&&"function"==typeof cancelIdleCallback&&cancelIdleCallback(F),F=0),B())}(O),i.delete(G),h.remove(),m?E?.show(!0):E?.remove())}const G={relook(){u||(t=>{R.delete(t),l.has(t)&&T()})(O);const t=I();if(!t||!u)return;const e=u,r=S&&!(s?.current.reducedMotion??("function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches));A?.clear(),A=null,r&&(e.redraw(),A=function(t,e){if(!t.width||!t.height||"undefined"==typeof document)return null;const n=document.createElement("canvas");n.width=t.width,n.height=t.height;const r=n.getContext("2d");if(!r||"function"!=typeof n.animate)return null;try{r.drawImage(t,0,0)}catch{return null}n.setAttribute("aria-hidden","true"),n.dataset.asciiSweep="",n.setAttribute("style",e);const o=document.createElement("span");let a,i;o.setAttribute("aria-hidden","true"),o.dataset.asciiSweep="",o.setAttribute("style",`${e};right:auto;width:2px;margin-left:-1px;opacity:0;background:var(--ascii-sweep, #f3ba32);box-shadow:0 0 10px 1px color-mix(in srgb, var(--ascii-sweep, #f3ba32) 40%, transparent)`),t.after(n,o);const s=()=>{a?.cancel(),i?.cancel(),n.remove(),o.remove()};return{clear:s,reveal(){if(!n.isConnected)return;const e={duration:200,delay:40,easing:"cubic-bezier(.23,1,.32,1)",fill:"both"};a=n.animate([{clipPath:"inset(0% 0% 0% 0%)"},{clipPath:"inset(0% 0% 0% 100%)"}],e);const r=t.clientWidth||t.getBoundingClientRect().width;i=o.animate([{transform:"translateX(0px)",opacity:.35},{opacity:.35,offset:.7},{transform:`translateX(${r}px)`,opacity:0}],e),a.onfinish=s}}}(h,n.place)),e.update(t);const o=A;o&&requestAnimationFrame(()=>requestAnimationFrame(()=>{A===o&&u===e?o.reveal():o.clear()}))}};return{field:{get canvas(){return h},get ready(){return u?u.ready:k??(k=new Promise(t=>{w=t}))},get settings(){return u?.settings??b},update(t){if(x={...x,...t},y={...y,...t},!u)return;const e=I(),n=$();u.update(n?{...t,...z(n)}:e?{...t,...e}:t)},setSource:t=>(v=t,u?u.setSource(t):Promise.resolve()),pointer(t,e){u?.pointer(t,e)},redraw(){u?.redraw()},pulse(t){u?.pulse(t)},play(){M=!1,u?.play()},pause(){M=!0,u?.pause()},resize(){u?.resize()},destroy(){H()}},get canvas(){return h},get live(){return!!u},get failed(){return m},start(){i.add(G),g=!0;try{W(O)}finally{g=!1}},destroy:H}}var Y,V,_=(t,e=0,n=1)=>Math.min(n,Math.max(e,t)),J=(t,e)=>{const n=43758.5453*Math.sin(127.1*t+311.7*e);return n-Math.floor(n)},K=(t,e=3)=>1-(1-_(t))**e,Q=(t,e,n)=>{const r=_((n-t)/(e-t));return r*r*(3-2*r)},Z=t=>{if(t<=0)return 0;if(t>=1)return 1;const e=(t,e,n)=>3*e*t*(1-t)**2+3*n*t*t*(1-t)+t**3;let n=0,r=1,o=t;for(let a=0;a<22;a++)o=(n+r)/2,e(o,.16,.3)<t?n=o:r=o;return e(o,1,1)},tt=()=>"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,et={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 nt(t,e,n){let r=(t??"").trim();const o=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/.exec(r);if(o?r=rt(e,o[1])||(o[2]??"").trim():r.startsWith("--")&&(r=rt(e,r)),!r)return n?nt(n,e):null;if(/^#[\da-f]{6}$/i.test(r))return r.toLowerCase();if(/^#[\da-f]{3}$/i.test(r))return`#${[...r.slice(1)].map(t=>t+t).join("")}`.toLowerCase();const a=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(r);if(a)return ot([+a[1],+a[2],+a[3]]);if(void 0===V)try{V="undefined"==typeof document?null:Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0})}catch{V=null}if(!V)return n?nt(n,e):null;V.clearRect(0,0,1,1),V.fillStyle="#000",V.fillStyle=r,V.fillRect(0,0,1,1);const[i,s,l]=V.getImageData(0,0,1,1).data;return ot([i,s,l])}var rt=(t,e)=>"function"==typeof getComputedStyle?getComputedStyle(t).getPropertyValue(e).trim():"",ot=t=>`#${t.map(t=>Math.round(_(t,0,255)).toString(16).padStart(2,"0")).join("")}`,at=t=>{const e=parseInt(t.slice(1,7),16);return[e>>16&255,e>>8&255,255&e]},it=(t,e,n)=>{const r=at(t),o=at(e);return ot(r.map((t,e)=>t+(o[e]-t)*n))};function st(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=nt(e?.color??"",t);if(!r)return"function"==typeof matchMedia&&matchMedia("(prefers-color-scheme: dark)").matches;const[o,a,i]=at(r);return.2126*o+.7152*a+.0722*i>140}function lt(){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 ct(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 dt(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 ht(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 ut=new WeakMap,pt=t=>ut.get(t)?.()??null;function ft(e){const{host:n,layer:r="over",outset:o=0,kit:a}=e;if("undefined"==typeof document)return null;const i=`position:absolute;left:${-o}px;top:${-o}px;width:calc(100% + ${2*o}px);height:calc(100% + ${2*o}px);pointer-events:none;z-index:${"under"===r?-1:"auto"}`;if(!t.isGlyphFieldSupported())return a?.current.poster&&j(n,a.current.poster,i,a),null;const s=lt(),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 h=l.style;h.position="absolute",h.left=h.top=-o+"px",h.width=h.height=`calc(100% + ${2*o}px)`,h.pointerEvents="none",h.zIndex="under"===r?"-1":"",n.appendChild(l);const u=()=>{const t=getComputedStyle(n);w.canvas.style.borderRadius=[t.borderTopLeftRadius,t.borderTopRightRadius,t.borderBottomRightRadius,t.borderBottomLeftRadius].map(t=>o&&/^[\d.]+px$/.test(t)?`${parseFloat(t)+o}px`:t).join(" ")};let p=st(n);const f=()=>nt(e.ink(p),n)??nt(getComputedStyle(n).color,n)??(p?"#d8d6cf":"#1d1d1b");let m=!1,g=!1,x=!0,y=!1,v=-1/0,M=-1/0;const b=t.watchPointer({target:n,move:t=>{M=t.timeStamp},leave(){}}),w=X({host:n,canvas:l,kit:a,place:i,options:()=>({...et,...e.look(),ink:f(),interactionTarget:n,label:""}),onMount:(t,e)=>{ut.set(e,E),e.removeAttribute("role"),e.removeAttribute("aria-label"),t.ready.then(L,()=>{}),L()},onRelease:()=>{m&&t.cancelFieldFrame($),m=!1},onFail:()=>{B(),e.onFail?.()}}),k=w.field;u();const S=()=>!!(e.reducedMotion()??tt()),A=t=>dt(w.canvas,t),C=t=>{const r=w.canvas,a=Math.max(1,r.clientWidth||n.clientWidth+2*o),i=Math.max(1,r.clientHeight||n.clientHeight+2*o),s=e.resolution??1,[l,h]="function"==typeof s?s(a,i):[Math.max(1,Math.round(a*s)),Math.max(1,Math.round(i*s))];c.width===l&&c.height===h||(c.width=l,c.height=h),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,h);let u=!1;try{u=e.paint({pen:d,width:l,height:h,w:a,h:i,scale:l/a,now:t,still:S(),dark:p,box:A})}catch(t){"undefined"!=typeof console&&console.error(t)}return k.setSource(c),y||k.redraw(),u};function E(){const t=w.canvas,r=Math.max(1,t.clientWidth||n.clientWidth+2*o),a=Math.max(1,t.clientHeight||n.clientHeight+2*o),i=e.resolution??1,[s,l]="function"==typeof i?i(r,a):[Math.max(1,Math.round(r*i)),Math.max(1,Math.round(a*i))],c=document.createElement("canvas");c.width=s,c.height=l;const d=c.getContext("2d");if(!d)return null;d.fillStyle="#000",d.fillRect(0,0,s,l);try{e.paint({pen:d,width:s,height:l,w:r,h:a,scale:s/r,now:performance.now(),still:!0,dark:p,box:A})}catch{return null}return c}function $(e){if(m=!1,y||g||!w.live)return;if(e-v<(Y??(Y=(()=>{const t="undefined"==typeof navigator?void 0:navigator;return 1e3/(t&&(t.hardwareConcurrency>0&&t.hardwareConcurrency<=2||t.deviceMemory&&t.deviceMemory<=2||t.connection?.saveData)?30:60)-2})()))*t.ambientFactor()&&e-M>1e3)return m=!0,void t.requestFieldFrame($);v=e;!C(e)||S()||!x||"undefined"!=typeof document&&document.hidden||(m=!0,t.requestFieldFrame($))}function L(){m||y||g||!w.live||(m=!0,t.requestFieldFrame($))}ut.set(l,E);const z="function"==typeof ResizeObserver?new ResizeObserver(()=>{u(),k.resize(),!w.live||y||g||C(performance.now()),L()}):null;z?.observe(n);const P="function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{x=t.isIntersecting,x&&L()},{rootMargin:"64px"}):null;P?.observe(n);const R=t.watchVisibility(()=>{document.hidden||L()});let F=!1;const T=()=>{F=!1,y||(p=st(n),k.update({ink:f()}),e.onTheme?.(),L())},I=t.watchTheme(()=>{F||y||(F=!0,t.requestFieldFrame(T))}),W=t.watchMotionPreference(L);function B(){y||(y=!0,m&&t.cancelFieldFrame($),F&&t.cancelFieldFrame(T),m=F=!1,z?.disconnect(),P?.disconnect(),R(),b(),I(),W(),w.destroy(),s.restore(),c.width=c.height=1)}return w.start(),w.failed?(B(),null):{field:k,get canvas(){return w.canvas},get live(){return w.live},kick:L,refresh(){y||(p=st(n),k.update({...et,...e.look(),ink:f()}),L())},still:S,dark:()=>p,box:A,play(){g&&(g=!1,k.play(),L())},pause(){g=!0,m&&t.cancelFieldFrame($),m=!1,k.pause()},destroy:B}}function mt(t,e,n,r,o=()=>{}){let a=!1;const i={get supported(){return!!t()&&!a},get field(){return a?null:t()?.field??null},update(t){if(a)return;e.current=ht(e.current,t);const r=t.poster;r&&G(e,r),n(e.current)},play(){a||t()?.play()},pause(){a||t()?.pause()},destroy(){a||(a=!0,t()?.destroy(),D(e),o())}};return Object.defineProperties(r,Object.getOwnPropertyDescriptors(i))}var gt={colorful:["#22c55e","#06b6d4","#6366f1","#d946ef","#f43f5e","#f59e0b"],mono:["#ffffff"],ocean:["#22d3ee","#3b82f6","#2dd4bf","#818cf8"],sunset:["#f97316","#f43f5e","#ec4899","#fbbf24"]},xt={palette:"colorful",mode:"rotate",grain:"dots",speed:1,hover:!0,depth:18},yt=["rotate","pulse","progress"],vt=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)},Mt=(t,e,n)=>t.map((t,r)=>t+(e[r]-t)*n),bt=vt("#ff4a4a"),wt=vt("#2fd67b");function kt(t){const e=("string"==typeof t?gt[t]??gt.colorful:t.length?t:gt.colorful).map(vt),n=new Float32Array(1024);for(let t=0;t<256;t++){const r=t/256*e.length,o=Math.floor(r),a=r-o,i=1===e.length?e[0]:Mt(e[o%e.length],e[(o+1)%e.length],a*a*(3-2*a)),s=Math.max(...i,.01);n.set([i[0]/s,i[1]/s,i[2]/s,(.2126*i[0]+.7152*i[1]+.0722*i[2])/s],4*t)}return n}var St=(t,e)=>{const n=(-t%1+1)%1,r=1-n;return Math.max(n<e?(1-n/e)**2.2:0,r<.03?(1-r/.03)**2:0)},At=t=>Math.max(St(t,.3),.75*St(t-.5,.22)),Ct=(t,e)=>t<=e?.42+.4*(t/Math.max(e,.001))**1.6+.38*Math.exp(-(((e-t)/.03)**2)):t-e<.014?1.2*(1-(t-e)/.014)**2:0,Et=(t,e)=>_((t-.68*e)/.07);var $t={duration:800,trigger:"visible",replayOnHover:!0,settle:"glyphs"};function Lt(t,e,n=.82){const r=t.getContext("2d");if(!r)return;const o=t.width,a=t.height,i=r.createImageData(o,a),s=t=>t*t*(3-2*t),l=(t,e)=>{const n=Math.floor(t),r=Math.floor(e),o=s(t-n),a=s(e-r),i=J(n,r),l=J(n+1,r),c=J(n,r+1);return i+(l-i)*o+(c-i)*a+(i-l-c+J(n+1,r+1))*o*a};for(let t=0;t<a;t++)for(let r=0;r<o;r++){const s=.6*l(r/6+2.4*e,t/3.5-.8*e)+.4*l(r/2.5-3*e,t/2),c=Math.min(1,2.4*(1-Math.hypot(2*(r/o-.5),2*(t/a-.5))*n)),d=.72*Math.max(0,s-.42)*Math.max(0,c)*255,h=4*(t*o+r);i.data[h]=i.data[h+1]=i.data[h+2]=d,i.data[h+3]=255}r.putImageData(i,0,0)}var zt={value:0,duration:360,stagger:60,glyphs:"#%*+=-:",format:t=>t.toLocaleString(),face:"text"};function Pt(t,e){const n=(t,e)=>t[t.length-1-e]??"";for(let r=e.length-1;r>=0;r--)if(/\d/.test(n(e,r))&&n(t,r)!==n(e,r))return r;return-1}var Rt={check:!0,shake:!0};function Ft(t,e,n,r,o,a=0){const i=24*n+170;if(e<i){const n=(e-24*t)/170;return n<1?1+Math.floor(J(t+a,Math.floor(e/46))*(n<0?3:9)):0}if(!r||o)return 0;const s=(((e-i)/1250-.07*t)%1+1)%1;return s<.3?1+Math.round(8*Math.sin(Math.PI*(s/.3))):0}var Tt="cubic-bezier(.16, 1, .3, 1)";var It={colourByState:!0,ring:!0},Wt={success:["--ascii-success","#17844a","#3ccf7e"],warning:["--ascii-warning","#9a6700","#f5b83d"],error:["--ascii-error","#c93636","#ff6b6b"]},Bt=120,Ot=280,qt=520,Nt=2*Math.PI,Ht=Nt/1050,Gt=t=>1-(1-t)**4,Dt=t=>`rgb(${255*t} ${255*t} ${255*t})`,jt=t=>t*Ht-Math.PI/2,Ut=(t,e=0)=>78+5*Math.sin(t/1600*Nt)*(1-e);function Xt(t,e,n=78,r=24){t.strokeStyle=Dt(e),t.lineWidth=r,t.beginPath(),t.arc(Bt,Bt,n,0,Nt),t.stroke()}function Yt(t,e,n,r=0,o=1){if(Xt(t,(.3+(n-78)/100)*o,n,24-6*r),r>=1)return void Xt(t,.72*o,n,18);const a=3.4+(Nt-3.4)*r;t.lineCap="round";for(let i=0;i<32;i++){const s=i/32,l=.3+.7*(1-s)**1.6;t.strokeStyle=Dt((l+(.72-l)*r)*o),t.lineWidth=28-6*s+(18-(28-6*s))*r,t.beginPath(),t.arc(Bt,Bt,n,e-(s+1/32)*a,e-s*a),t.stroke()}}function Vt(t,e,n,r=800,o=0,a=!0){if("idle"===e)return void Xt(t,.34);if("loading"===e)return void Yt(t,jt(n),Ut(n));const i=(t=>t<.5?4*t*t*t:1-(-2*t+2)**3/2)(Math.min(1,r/Ot)),s=Math.min(r,Ot),l=o+Ht*(s-s*s/560);a?Yt(t,l,Ut(n,i),i):i<1&&Yt(t,l,Ut(n,i),0,1-i);const c=(r-196)/qt;a&&c>0&&c<1&&Xt(t,.5*(1-c)**2,88+24*c,16-8*c),function(t,e,n,r=30){t.strokeStyle="#fff",t.lineWidth=r,t.lineCap="round",t.lineJoin="round";const o=(e,n)=>{const r=e.slice(1).map((t,n)=>Math.hypot(t[0]-e[n][0],t[1]-e[n][1]));let o=n*r.reduce((t,e)=>t+e,0);t.beginPath(),t.moveTo(e[0][0],e[0][1]);for(let n=1;n<e.length&&o>0;n++){const a=Math.min(1,o/r[n-1]);t.lineTo(e[n-1][0]+(e[n][0]-e[n-1][0])*a,e[n-1][1]+(e[n][1]-e[n-1][1])*a),o-=r[n-1]}t.stroke()};"success"===e?o([[86,122],[110,146],[156,96]],n):"warning"===e?(t.lineWidth=r-4,o([[Bt,74],[Bt,114]],Math.min(1,n/.7)),n>.7&&(t.fillStyle="#fff",t.beginPath(),t.arc(Bt,152,r/2*Gt((n-.7)/.3),0,Nt),t.fill())):(o([[92,92],[148,148]],n),o([[148,92],[92,148]],n))}(t,e,Gt(Math.min(1,Math.max(0,(r-40)/260))),a?24:30)}var _t={blocks:"[data-block]",shimmer:1400,resolve:420,stagger:60,develop:640},Jt=t=>`rgb(${255*t} ${255*t} ${255*t})`,Kt=(t,e,n)=>t<0?0:K((t-e)/n,3),Qt=t=>parseFloat(t)||0;function Zt(t,e,n=1){const r=getComputedStyle(t),o=t.getBoundingClientRect(),a=r.borderTopLeftRadius,i=a.endsWith("%")?Qt(a)/100*Math.min(o.width,o.height):Qt(a);if("text"!==e)return{radius:i/n,lines:[]};const s=Qt(r.fontSize)||14,l="normal"===r.lineHeight?1.2*s:Qt(r.lineHeight),c=Math.min(l,.62*s),d=new Map,h="undefined"!=typeof document&&"function"==typeof document.createRange?document.createRange():null;h?.selectNodeContents(t);for(const t of h?[...h.getClientRects()]:[]){if(!t.width)continue;const e=Math.round((t.top+t.bottom)/2/Math.max(1,l/2)),n=d.get(e);d.set(e,n?{left:Math.min(n.left,t.left),right:Math.max(n.right,t.right),top:Math.min(n.top,t.top),bottom:Math.max(n.bottom,t.bottom)}:{left:t.left,right:t.right,top:t.top,bottom:t.bottom})}const u=[...d.values()].map(t=>{const e=Math.max(t.left,o.left),r=Math.min(t.right,o.right),a=(t.top+t.bottom)/2;return{x:(e-o.left)/n,y:(a-c/2-o.top)/n,w:Math.max(0,r-e)/n,h:c/n}}).filter(t=>t.w>0);return u.length||u.push({x:0,y:(o.height-c)/2/n,w:o.width/n,h:c/n}),{radius:(i||c/2)/n,lines:u}}function te(t){const e=t.dataset.block;return"text"===e||"photo"===e||"avatar"===e?e:"IMG"===t.tagName||"PICTURE"===t.tagName||"VIDEO"===t.tagName?/^50%|^9999px/.test(getComputedStyle(t).borderTopLeftRadius)?"avatar":"photo":"text"}var ee={tone:"neutral",live:!1,indicator:!0,sheen:!0},ne={light:{green:[22,150,82],amber:[214,138,8],red:[214,52,52],neutral:[120,120,114],new:[255,255,255]},dark:{green:[120,240,170],amber:[255,206,110],red:[255,156,156],neutral:[200,200,192],new:[255,255,255]}},re={light:[[.03," "],[.08,"·"],[.13,"•"],[.18,"○"],[.5,"●"],[.56,"◐"],[.62,"◓"],[.68,"◑"],[.74,"◒"],[.8,"●"],[.88,"✧"],[2,"✦"]],dark:[[.02," "],[.06,"✦"],[.1,"✧"],[.2,"·"],[.3,"•"],[.38,"○"],[.64,"●"],[.68,"◐"],[.72,"◓"],[.76,"◑"],[.8,"◒"],[2,"●"]]},oe=t=>Array.from({length:96},(e,n)=>t.find(([t])=>n/95<t)[1]).join(""),ae={light:oe(re.light),dark:oe(re.dark)},ie=["◐","◓","◑","◒"],se=["✧","·","✧","✦","✧","✦"],le=12;var ce=(t,e)=>{return"green"===(n=t.dataset.tone)||"amber"===n||"red"===n||"neutral"===n||"new"===n?t.dataset.tone:e;var n};var de={tabs:'[role="tab"]',duration:440,panels:"hidden",manage:!0};var he=680,ue=12,pe={preview:[{k:.55,blur:6},{k:.8,blur:2.5}],final:{k:1,blur:0}},fe=t=>.5-.5*Math.cos(Math.PI*Math.min(1,Math.max(0,t))),me=async t=>{if("function"==typeof createImageBitmap)return createImageBitmap("string"==typeof t?await(await fetch(t)).blob():t);const e=new Image;return e.crossOrigin="anonymous",e.src="string"==typeof t?t:URL.createObjectURL(t),await e.decode(),e};var ge=t=>new Promise(e=>setTimeout(e,t));function xe(e){const{host:n,layer:r="under",kit:o}=e;if("undefined"==typeof document)return null;const a=`position:absolute;inset:0;width:100%;height:100%;pointer-events:none;border-radius:inherit;z-index:${"under"===r?-1:"auto"}`;if(!t.isGlyphFieldSupported())return o?.current.poster&&!e.ownPoster&&j(n,o.current.poster,a,o),null;const i=lt(),s=document.createElement("canvas");"static"===getComputedStyle(n).position&&i.set(n,"position","relative"),"under"===r&&i.set(n,"isolation","isolate"),s.dataset.asciiKit="",s.setAttribute("style",a),n.appendChild(s);let l=st(n),c=!1;const d=()=>{const t=e.reducedMotion();return!0===t?{speed:0,drift:0,respectReducedMotion:!0}:{respectReducedMotion:!1!==t}},h=()=>nt(e.ink(l),n,l?"#d8d6cf":"#1d1d1b")??"#888888",u=X({host:n,canvas:s,kit:o,place:a,ownPoster:e.ownPoster,glyphs:e.glyphs,source:e.source??null,options:()=>({...et,...e.look(l),...d(),ink:h(),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:()=>{y(),e.onFail?.()}}),p=u.field;let f=!1;const m=()=>{c||(l=st(n),p.update({...et,...e.look(l),...d(),ink:h()}))},g=()=>{f=!1,m()},x=t.watchTheme(()=>{f||c||(f=!0,t.requestFieldFrame(g))});function y(){c||(c=!0,f&&t.cancelFieldFrame(g),x(),u.destroy(),i.restore())}return u.start(),u.failed?(y(),null):{field:p,get canvas(){return u.canvas},get live(){return u.live},dark:()=>l,still:()=>!!(e.reducedMotion()??tt()),refresh:m,destroy:y}}function ye(t,e,n,r,o=()=>{}){let a=!1;const i={get supported(){return!!t()&&!a},get field(){return a?null:t()?.field??null},update(r){if(a)return;e.current=ht(e.current,r);const o=r.poster;o&&G(e,o),n(e.current),t()?.refresh()},play(){a||t()?.field.play()},pause(){a||t()?.field.pause()},destroy(){a||(a=!0,o(),t()?.destroy(),D(e))}};return Object.defineProperties(r,Object.getOwnPropertyDescriptors(i))}function ve(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 Me(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 be={preset:"hero",clear:!1,text:"404",ripple:!0},we=28,ke='600 440px "Geist", Arial, sans-serif',Se=()=>"number"==typeof innerWidth&&innerWidth<760,Ae=t=>({mark:"glyph",scene:"drift",levels:"auto",charset:" .:+*#",font:'"Geist Mono", ui-monospace, monospace',fontWeight:400,cellSize:10,cellAspect:.62,glyphScale:.86,color:"ink",shade:0,hover:"trail",trail:{strength:.9,radius:.32},...t}),Ce={mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:7,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.4,fit:"contain",clear:!1,focus:{x:.5,y:.5},drift:.8,speed:.7,levels:"auto",hover:"trail",trail:{strength:1,radius:.42}};var Ee=[...Array.from({length:10},(t,e)=>(e+1)/10),1,1,1,...Array.from({length:14},(t,e)=>1-(e+1)/14)];function $e(t,e,n,r){const o=e.getContext("2d");o.globalAlpha=1,o.fillStyle="#000",o.fillRect(0,0,e.width,e.height);for(const e of n){const n=Math.min(1,Math.max(0,(r-e.lag*(1-r))/(1-.5*e.lag))),a=n*n*(3-2*n);o.globalAlpha=1-.72*a,o.drawImage(t,e.x,e.y,we,we,e.x+e.dx*a,e.y+e.dy*a,we,we)}o.globalAlpha=1}var Le={font:'Georgia, "Times New Roman", serif',fontWeight:600};var ze="position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit;pointer-events:none";var Pe={saving:null,font:'"Geist", Arial, sans-serif'};function Re(t,e,n,r=Pe.font){const o=Math.max(2,Math.round(2*t.offsetWidth)),a=Math.max(2,Math.round(2*t.offsetHeight)),{canvas:i,pen:s}=ve(o,a),l=s.createRadialGradient(o,0,0,o,0,.52*Math.hypot(o,a));l.addColorStop(0,"rgb(150 150 150)"),l.addColorStop(.4,"rgb(64 64 64)"),l.addColorStop(1,"rgb(0 0 0)"),s.fillStyle=l,s.fillRect(0,0,o,a);const c=e?function(t,e){const n=t.getBoundingClientRect(),r=n.height?t.offsetHeight/n.height:1,o=e?.getBoundingClientRect().top??n.top+n.height;let a=e;for(;a&&a.parentElement!==t;)a=a.parentElement;let i=n.top;for(const e of Array.from(t.children)){if(e===a)break;if(void 0!==e.dataset?.asciiKit)continue;const t=e.getBoundingClientRect();t.height&&(i=Math.max(i,t.top+t.height))}return{middle:((i+o)/2-n.top)*r,height:(o-i)*r}}(t,n):null;if(e&&c&&c.height>=30){const t=Math.min(2*c.height*.9,.34*o),n=o-.07*o,a=2*c.middle+.04*t;s.font=`600 ${t}px ${r}`,s.letterSpacing=.04*-t+"px",s.textAlign="right",s.textBaseline="middle",s.lineJoin="round",s.lineWidth=.28*t,s.strokeStyle="rgb(0 0 0 / .85)",s.strokeText(e,n,a),s.fillStyle="#fff",s.fillText(e,n,a)}return i}var Fe={aurora:["#2ee6c8","#9d7bff","#ff6fb5"],brand:["#ffb000","#ffd84d"]},Te={palette:"aurora",swell:!0},Ie=t=>"mono"===t?[]:"string"==typeof t?[...Fe[t]??Fe.aurora]:[...t];function We(t,e){if(1===t.length)return t[0];const n=_(e)*(t.length-1),r=Math.min(t.length-2,Math.floor(n)),o=n-r,[a,i]=[t[r],t[r+1]].map(t=>[1,3,5].map(e=>parseInt(t.slice(e,e+2),16)||0));return`rgb(${a.map((t,e)=>Math.round(t+(i[e]-t)*o)).join(" ")})`}var Be=t=>{const e=Math.round(255*Math.min(1,Math.max(0,t)));return`rgb(${e} ${e} ${e})`},Oe=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},qe=/^(IMG|PICTURE|VIDEO|CANVAS|SVG|svg)$/;function Ne(t,e,n,r){const o=(t,e)=>Math.max(0,Math.min(parseFloat(t.borderTopLeftRadius)||0,e.w/2,e.h/2)),a=[e,...e.querySelectorAll("*")];t.save();for(const i of a){if("CANVAS"===i.tagName&&void 0!==i.dataset?.asciiKit){if(!r||i===r.skip)continue;const e=n(i),o=e.w>0&&e.h>0?pt(i):null;o&&(t.globalCompositeOperation="lighter",t.drawImage(o,e.x,e.y,e.w,e.h),t.globalCompositeOperation="source-over");continue}if(void 0!==i.dataset?.asciiPoster)continue;const a=n(i);if(a.w<=0||a.h<=0)continue;const s=getComputedStyle(i);if("hidden"===s.visibility||"none"===s.display)continue;const l=Oe(s.backgroundColor)>.03,c=(parseFloat(s.borderTopWidth)||0)>0&&Oe(s.borderTopColor)>.1;if(t.beginPath(),i===e)(l||c)&&(t.strokeStyle=Be(.42),t.lineWidth=3,t.roundRect(a.x+1.5,a.y+1.5,a.w-3,a.h-3,o(s,a)),t.stroke());else{if(qe.test(i.tagName)){t.fillStyle=Be(.5),a.w<32&&a.h<32?t.arc(a.x+a.w/2,a.y+a.h/2,.36*Math.min(a.w,a.h),0,2*Math.PI):t.roundRect(a.x,a.y,a.w,a.h,o(s,a)),t.fill();continue}l?(t.fillStyle=Be(.22),t.roundRect(a.x,a.y,a.w,a.h,o(s,a)),t.fill()):c&&(t.strokeStyle=Be(.32),t.lineWidth=1.5,t.roundRect(a.x+.75,a.y+.75,a.w-1.5,a.h-1.5,o(s,a)),t.stroke())}if("INPUT"===i.tagName||"TEXTAREA"===i.tagName){const e=i,n=e.value||e.placeholder||"";n&&He(t,n,a.x+(parseFloat(s.paddingLeft)||0),a.y,a.h,s,e.value?.82:.5)}}!function(t,e,n){if("function"!=typeof document.createTreeWalker)return;const r=document.createTreeWalker(e,4),o=document.createRange(),a=n(e),i=e.getBoundingClientRect(),s=i.width/(e.offsetWidth||i.width||1)||1;let l=0;for(let n=r.nextNode();n&&l<2e3;n=r.nextNode()){const r=n.parentElement;if(!r)continue;const c=getComputedStyle(r);if("hidden"===c.visibility||Ge(r,e))continue;const d=(parseFloat(c.fontWeight)||400)>=600||/^H[1-6]$/.test(r.tagName)?1:.8;for(const e of n.data.matchAll(/\S+/g)){o.setStart(n,e.index),o.setEnd(n,e.index+e[0].length);const r=o.getClientRects()[0];r&&(l++,He(t,e[0],a.x+(r.left-i.left)/s,a.y+(r.top-i.top)/s,r.height/s,c,d))}}o.detach?.()}(t,e,n),t.restore()}function He(t,e,n,r,o,a,i){const s=Math.min(900,(parseFloat(a.fontWeight)||400)+200);t.font=`${a.fontStyle||"normal"} ${s} ${a.fontSize} ${a.fontFamily}`,t.fillStyle=Be(i),t.shadowColor=Be(i),t.shadowBlur=3,t.textBaseline="middle",t.fillText(e,n,r+o/2),t.shadowBlur=0}function Ge(t,e){for(;t&&t!==e;t=t.parentElement){const e=t,n=getComputedStyle(e);if(e.offsetWidth<=1&&e.offsetHeight<=1&&"hidden"===n.overflow)return!0;if("inset(50%)"===n.clipPath||"rect(0px, 0px, 0px, 0px)"===n.clip)return!0}return!1}function De(t,e,n,r,o=2,a){const i=document.createElement("canvas");i.width=Math.max(2,Math.round(n*o)),i.height=Math.max(2,Math.round(r*o));const s=i.getContext("2d",{willReadFrequently:!0});return s?(s.setTransform(o,0,0,o,0,0),s.fillStyle="#000",s.fillRect(0,0,n,r),Ne(s,t,e,a),i):i}function je(t,e=2){const n=t.getContext("2d",{willReadFrequently:!0});if(!n)return[];const r=t.width,o=t.height,a=n.getImageData(0,0,r,o).data,i=[];for(let t=0;t<o/e;t+=6)for(let n=0;n<r/e;n+=4){let s=!1;for(let i=0;i<6*e&&!s;i+=3)for(let l=0;l<4*e&&!s;l+=2){const c=Math.round(n*e+l),d=Math.round(t*e+i);c<r&&d<o&&a[4*(d*r+c)]>10&&(s=!0)}s&&i.push({x:n,y:t,seed:J(n,t)})}return i}function Ue(t,e,n,r,o,a,i=1,s=.32,l=2){for(let c=0;c<n.length;c++){const d=n[c],h=(o-r[c]*(1-s))/s;if(h<=0)continue;const u=h>=1?0:1-h;let p=d.x,f=d.y;if(u>0){const[t,e]=a(d,u);p+=t,f+=e}t.globalAlpha=i*(1-u*u),t.drawImage(e,d.x*l,d.y*l,4*l,6*l,p,f,4,6)}t.globalAlpha=1}function Xe(t){const e=()=>({image:t,width:t.naturalWidth,height:t.naturalHeight});return t.complete&&t.naturalWidth?Promise.resolve(e()):new Promise((n,r)=>{const o=()=>{i(),n(e())},a=()=>{i(),r(new Error(`Could not load ${t.src}`))},i=()=>{t.removeEventListener("load",o),t.removeEventListener("error",a)};t.addEventListener("load",o),t.addEventListener("error",a)})}function Ye(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 Ve(t,e,n,r,o,a,i=.5,s=.5){if(o<=0||a<=0||!e.width||!e.height)return;const l=Math.max(o/e.width,a/e.height),c=e.width*l,d=e.height*l;t.save(),t.beginPath(),t.rect(n,r,o,a),t.clip(),t.drawImage(e.image,n+(o-c)*i,r+(a-d)*s,c,d),t.restore()}function _e(t,e,n=.08){const r=Math.min(1,420/Math.max(1,t.width,t.height)),o=document.createElement("canvas");o.width=Math.max(1,Math.round(t.width*r)),o.height=Math.max(1,Math.round(t.height*r));const a=o.getContext("2d",{willReadFrequently:!0});if(!a)return t;let i;a.drawImage(t.image,0,0,o.width,o.height);try{i=a.getImageData(0,0,o.width,o.height)}catch{return t}const s=i.data,l=new Uint32Array(256),c=s.length/4,d=t=>.2126*s[t]+.7152*s[t+1]+.0722*s[t+2];for(let t=0;t<s.length;t+=4)l[Math.round(d(t))]++;let h=0,u=255,p=0;for(let t=0;t<256;t++)if(p+=l[t],p>=.02*c){h=t;break}p=0;for(let t=255;t>=0;t--)if(p+=l[t],p>=.02*c){u=t;break}const f=Math.max(1,u-h);for(let t=0;t<s.length;t+=4){let r=_((d(t)-h)/f);e&&(r=1-r),s[t]=s[t+1]=s[t+2]=Math.round(255*(n+(1-n)*r)),s[t+3]=255}return a.putImageData(i,0,0),{image:o,width:o.width,height:o.height}}var Je={strong:1,text:.82,meta:.55,tile:.42,icon:.62},Ke=new Set(["IMG","SVG","svg","VIDEO","PICTURE"]),Qe=t=>[...t.children].flatMap(t=>Ke.has(t.tagName)?[t]:[t,...Qe(t)]);function Ze(t,e,n,r){const o=document.createElement("canvas");o.width=Math.max(2,Math.round(2*e)),o.height=Math.max(2,Math.round(2*n));const a=[],i=o.getContext("2d");if(!i)return{canvas:o,rects:a};i.scale(2,2),i.fillStyle="#000",i.fillRect(0,0,e,n);const s=r(t),l=t.getBoundingClientRect(),c=l.width/(t.offsetWidth||l.width||1)||1,d=e=>{for(let n=e;n&&n!==t.parentElement;n=n.parentElement){const t=n.dataset?.paint;if(t&&void 0!==Je[t])return Je[t]}return parseFloat(e?getComputedStyle(e).fontWeight:"400")>=500?1:.7},h=t=>{const e=Math.round(255*_(t));return`rgb(${e} ${e} ${e})`},u=Qe(t),p=[t,...u].filter(t=>{const e=t.dataset?.paint;return"tile"===e||"icon"===e||!e&&Ke.has(t.tagName)&&!t.closest("[data-paint]")});for(const t of p){const e=r(t);if(e.w<=0||e.h<=0)continue;const n=t.dataset?.paint;i.fillStyle=h("icon"===n?Je.icon:Je.tile),i.beginPath(),"icon"===n||"svg"===t.tagName.toLowerCase()?i.arc(e.x+e.w/2,e.y+e.h/2,.4*Math.min(e.w,e.h),0,2*Math.PI):i.roundRect(e.x,e.y,e.w,e.h,Math.min(parseFloat(getComputedStyle(t).borderTopLeftRadius)||0,e.h/2)),i.fill(),a.push(e)}const f=document.createTreeWalker(t,4),m=document.createRange();i.textBaseline="middle";for(let t=f.nextNode();t;t=f.nextNode()){const e=t.parentElement;if(!e||e.closest('[data-paint="none"]'))continue;const n=getComputedStyle(e);i.font=`${n.fontStyle} ${n.fontWeight} ${n.fontSize} ${n.fontFamily}`,i.fillStyle=h(d(e)),i.shadowColor=i.fillStyle,i.shadowBlur=4;for(const e of t.data.matchAll(/\S+/g)){m.setStart(t,e.index),m.setEnd(t,e.index+e[0].length);const n=m.getClientRects()[0];if(!n)continue;const r={x:s.x+(n.left-l.left)/c,y:s.y+(n.top-l.top)/c,w:n.width/c,h:n.height/c};i.fillText(e[0],r.x,r.y+r.h/2),a.push(r)}}return i.shadowBlur=0,m.detach?.(),{canvas:o,rects:a}}function tn(t,e,n,r,o,a,i=1,s=.32){for(let l=0;l<n.length;l++){const c=n[l],d=(o-r[l]*(1-s))/s;if(d<=0)continue;const h=d>=1?0:1-d;let u=c.x,p=c.y;if(h>0){const[t,e]=a(c,h);u+=t,p+=e}t.globalAlpha=i*(1-h*h),t.drawImage(e,2*c.x,2*c.y,8,12,u,p,4,6)}t.globalAlpha=1}function en(t,e){if("undefined"==typeof document||document.getElementById(t))return;const n=document.createElement("style");n.setAttribute("id",t),n.textContent=e,(document.head??document.documentElement).appendChild(n)}var nn={input:"input",rows:'[role="option"]',hotkey:"k",manage:!0,closeOnRun:!0,highlight:!0,ai:"[data-ai]"},rn=200,on=3600,an=40,sn="cubic-bezier(.16, 1, .3, 1)",ln=`\n:where([data-ascii-cmd-highlight]){position:absolute;left:0;top:0;z-index:-1;pointer-events:none;opacity:0;background:var(--ascii-cmd-highlight,color-mix(in oklab,currentColor 7%,transparent));transition:translate 240ms ${sn},width 240ms ${sn},height 240ms ${sn},opacity 160ms ${sn}}\n:where([data-ascii-cmd-highlight][data-on]){opacity:1}\n@media (prefers-reduced-motion:reduce){:where([data-ascii-cmd-highlight]){transition:none}}\n`;var cn={thumb:'[role="slider"]',label:"[data-label]",threshold:.9,resetAfter:0},dn=720,hn=(t,e,n)=>t+(e-t)*n,un=t=>1-(1-t)**3,pn=(t,e,n)=>({x:t,v:0,to:t,k:e,z:n});function fn(t,e,n=.4){const r=2*Math.sqrt(t.k)*t.z,o=Math.max(1,Math.ceil(240*e)),a=e/o;for(let e=0;e<o;e++)t.v+=(-t.k*(t.x-t.to)-r*t.v)*a,t.x+=t.v*a;return!(Math.abs(t.x-t.to)<n&&Math.abs(t.v)<12*n)||(t.x=t.to,t.v=0,!1)}var mn=t=>{t.x=t.to,t.v=0};function gn(t,e){const n=t.filter(([,t])=>e-t<80);if(n.length<2)return 0;const[r,o]=n[0],[a,i]=n[n.length-1];return i>o?(a-r)/(i-o)*1e3:0}var xn={kind:"heart",icon:"svg",manage:!0,outset:40,layer:"under"},yn=t=>1-(1-_(t))**3;function vn(t,e,n,r,o){if(t.beginPath(),"heart"===e){const e=o/29;for(let o=0;o<=56;o++){const a=o/56*Math.PI*2,i=16*Math.sin(a)**3,s=-(13*Math.cos(a)-5*Math.cos(2*a)-2*Math.cos(3*a)-Math.cos(4*a));0===o?t.moveTo(n+i*e,r+(s-2.5)*e):t.lineTo(n+i*e,r+(s-2.5)*e)}}else{const e=.7*o,a=r-o/2,i=n-e/2,s=.12*o;t.moveTo(i,a+s),t.arcTo(i,a,i+s,a,s),t.lineTo(i+e-s,a),t.arcTo(i+e,a,i+e,a+s,s),t.lineTo(i+e,r+o/2),t.lineTo(n,r+o/2-.27*o),t.lineTo(i,r+o/2)}t.closePath()}function Mn(t,e,n,r,o,a){const i=t.createRadialGradient(n,r-.1*o,0,n,r,.62*o);i.addColorStop(0,"#fff"),i.addColorStop(.7,"#e6e6e6"),i.addColorStop(1,"#8c8c8c"),t.globalAlpha=a,t.fillStyle=i,t.shadowColor="#bbb",t.shadowBlur=Math.max(2,.08*o),vn(t,e,n,r,o),t.fill(),t.shadowBlur=0,t.globalAlpha=1}function bn(t,e,n,r,o){const a=n.x+n.w/2,i=n.y+n.h/2,s=n.h,l=1.45*s,c=(t=>t>=1?1:1-Math.exp(-5*t)*Math.cos(9*t))(r/.3),d=(t=>t<.5?4*t**3:1-(-2*t+2)**3/2)(_((r-.42)/.3)),h=d>0?l+(s-l)*d:.7*s+(l-.7*s)*c,u=_((r-.04)/.46);u>0&&u<1&&(t.strokeStyle=(t=>{const e=Math.round(255*_(t));return`rgb(${e} ${e} ${e})`})(.8*(1-u)**1.4),t.lineWidth=2.4-1.2*u,t.lineJoin="round",vn(t,e,a,i,s*(1.2+.5*yn(u))),t.stroke());t.fillStyle="#fff";for(let e=0;e<7;e++){const n=(r-.1-.05*J(e,o))/.5;if(n<=0||n>=1)continue;const l=-Math.PI/2+(e-3)/7*Math.PI*1.7+.3*(J(o+1,e)-.5),c=s*(.75+(.55+.35*J(e,o+2))*yn(n)),d=1.8*(1-.6*n);t.globalAlpha=1-n*n,t.beginPath(),t.arc(a+Math.cos(l)*c*1.15,i+Math.sin(l)*c*.85,d,0,2*Math.PI),t.fill()}t.globalAlpha=1,Mn(t,e,a,i,h,1-_((r-.72)/.28))}var wn={values:[],duration:560},kn=.46;function Sn(t,e){if(!e)return{bar:0,gap:0,left:0};const n=e<=7?.5:.6;let r=Math.max(1,Math.floor(t/e));for(;r>1&&e*r+(e-1)*Math.max(1,Math.round(r*n))>t;)r--;const o=e>1?Math.max(0,Math.min(Math.ceil(r*n*1.6),Math.floor((t-e*r)/(e-1)))):0;return{bar:r,gap:o,left:Math.max(0,Math.floor((t-e*r-(e-1)*o)/2))}}var An={dissolve:300,condense:300},Cn=10,En=16,$n=t=>.5-.5*Math.cos(Math.PI*Math.min(1,Math.max(0,t))),Ln=t=>Z(Math.min(1,Math.max(0,t))),zn=()=>{let t=()=>{};return[new Promise(e=>{t=e}),t]};function Pn(t,e,n,r,o,a=!1){const i=e.width,s=e.height,l=Math.ceil(i/Cn),c=Math.ceil(s/En),d=[],h=[],u=Math.max(...[[0,0],[i,0],[0,s],[i,s]].map(([t,e])=>Math.hypot(t-r.x,e-r.y)))||1,p=function(t,e,n){const r=Rn.get(t);if(r)return r;const o=Object.assign(document.createElement("canvas"),{width:e,height:n}),a=Object.assign(document.createElement("canvas"),{width:t.width,height:t.height}),i=o.getContext("2d"),s=a.getContext("2d"),l={mask:o,maskPen:i,data:i.createImageData(e,n),clip:a,clipPen:s};return Rn.set(t,l),l}(e,l,c),f=p.data.data;let m=0;for(let t=0;t<c;t++)for(let e=0;e<l;e++){const o=e*Cn,i=t*En,s=Math.hypot(o+5-r.x,i+8-r.y)/u*.72+.28*J(o,i),c=a?n-s-.12:s-n;f[4*(t*l+e)+3]=c>0?255:0,c>0&&m++,c>0&&c<.07?d.push([o,i]):c<=0&&c>-.12&&h.push([o,i,-c/.12])}if(m){p.maskPen.putImageData(p.data,0,0);const n=p.clipPen;n.globalCompositeOperation="source-over",n.clearRect(0,0,i,s),n.drawImage(e,0,0),n.globalCompositeOperation="destination-in",n.imageSmoothingEnabled=!1,n.drawImage(p.mask,0,0,l*Cn,c*En),n.globalCompositeOperation="source-over",t.drawImage(p.clip,0,0)}for(const[n,r,i]of h)t.globalAlpha=(1-i)*(a?.7:1),t.drawImage(e,n,r,Cn,En,n+18*(J(r,n+o)-.5)*i,r-10*i*(a?-.6:1),Cn,En);t.globalAlpha=1,t.globalCompositeOperation="lighter",t.globalAlpha=a?.5:1;for(const[n,r]of d)t.drawImage(e,n,r,Cn,En,n,r,Cn,En);t.globalAlpha=1,t.globalCompositeOperation="source-over"}var Rn=new WeakMap;var Fn={cards:"[data-card]",loop:!0,threshold:.4,outset:56},Tn=(t,e,n)=>t+(e-t)*n,In=(t,e,n)=>({x:t,v:0,to:t,k:e,z:n}),Wn=Array.from({length:96},(t,e)=>{const n=43758.5453*Math.sin(127.1*e+311.7);return n-Math.floor(n)});var Bn={length:6,accept:"digits",cells:"[data-cell]"},On=560,qn=t=>{const e=Math.round(255*_(t));return`rgb(${e} ${e} ${e})`};var Nn={max:3,duration:6e3,label:"Notifications",swipe:!0},Hn="cubic-bezier(.16, 1, .3, 1)",Gn=`\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:14px;background:var(--ascii-toast-bg,Canvas);color:var(--ascii-toast-ink,CanvasText);box-shadow:var(--ascii-toast-shadow,0 1px 2px rgb(0 0 0 / .06),0 10px 28px -10px rgb(0 0 0 / .22));z-index:calc(10 - var(--d,0));transform-origin:50% 0;translate:0 calc(var(--d,0) * -12px);scale:calc(1 - var(--d,0) * .05);touch-action:pan-y;transition:translate 380ms ${Hn},scale 380ms ${Hn},opacity 220ms ${Hn},transform 300ms ${Hn},filter 380ms ${Hn}}\n:where(.ascii-toast)::after{content:"";position:absolute;left:0;right:0;top:100%;height:10px}\n:where(.ascii-toast) > *{transition:opacity 200ms ${Hn}}\n:where(.ascii-toast[data-back]) > *{opacity:0}\n:where(.ascii-toasts:not([data-open])) :where(.ascii-toast[data-back]){filter:brightness(calc(1 - var(--d,0) * .04))}\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 420ms ${Hn} both}\n:where(.ascii-toast[data-forming],.ascii-toast[data-gone]) > *{opacity:0;transition:none}\n:where(.ascii-toast[data-gone]){opacity:0;scale:.97;pointer-events:none}\n:where(.ascii-toast[data-swiping]){transition:translate 380ms ${Hn},scale 380ms ${Hn},opacity 220ms ${Hn}}\n@keyframes ascii-toast-in{from{opacity:0;translate:0 14px}}\n:where(.ascii-toast-icon){display:grid;place-items:center;flex:none;width:32px;height:32px;border-radius:9px;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`,Dn=t=>{const[e,n,r]=at(t).map(t=>{const e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4});return.2126*e+.7152*n+.0722*r};var jn={start:!0,stagger:38,roll:520,wave:55,glyphs:"#%*+=-:"},Un=t=>`Thought for ${t}s`;var Xn={caret:!0,settle:60,stagger:18,reasoningLines:2,transition:"flicker",roll:300,glyphs:"#%*+=-:"},Yn="cubic-bezier(.16, 1, .3, 1)",Vn=`\n:where(.ascii-reasoning){display:grid;grid-template-rows:1fr;transition:grid-template-rows 260ms ${Yn},opacity 200ms ${Yn}}\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 ${Yn},opacity 200ms ${Yn}}\n:where(.ascii-reasoning li[data-new]){opacity:0}\n@media (prefers-reduced-motion: reduce){:where(.ascii-reasoning, .ascii-reasoning li){transition:none}}\n`,_n=.7,Jn=t=>[...t.children].filter(t=>"IMG"===t.tagName&&void 0!==t.dataset?.asciiPoster);var Kn=t=>"string"==typeof t?{src:t}:t;var Qn={maxBytes:10485760,develop:900};var Zn={duration:620,collapse:!0,remove:!1},tr=16,er=new WeakMap;var nr={threshold:64},rr=.3;var or={standard:{label:"Classic ASCII",chars:" .:-=+*#%@"},asciify:{label:"Asciify",chars:" .:-=+YCIFSA#@"},minimal:{label:"Minimal",chars:" .:+"},detailed:{label:"Detailed",chars:" .,:;-~=+*xX#%@"},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 ir(t){if(!t)return;if("dots"===t)return" ·∙•●";const e=or[t];return e&&Object.prototype.hasOwnProperty.call(or,t)?e.chars:t.startsWith(" ")?t:" "+t}var sr=(t,e)=>!1===t.cursor?"none":"string"==typeof t.cursor?t.cursor:e;function lr(t,e,n,r){let o=null;if(o=xe({host:t.host,kit:t.kit,layer:"under",glyphs:r&&(()=>r(t.settings())),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:()=>{o=null,t.onFail()}}),!o)return null;const a=o.canvas;return{get field(){return o?.field??null},get canvas(){return o?.canvas??a},refresh(){o?.refresh()},play(){o?.field.play()},pause(){o?.field.pause()},destroy(){o?.destroy(),o=null}}}var cr=()=>"number"==typeof innerWidth&&innerWidth<760,dr={light:"#86847e",dark:"#7c7a74"},hr={light:"#8f8d86",dark:"#64625d"},ur=t=>({font:'"Geist Mono", ui-monospace, monospace',fontWeight:400,cellSize:t.cellSize,cellAspect:.62,glyphScale:.86}),pr=t=>({cellSize:t.cellSize,cellAspect:1,dotScale:.68}),fr={x:.18,y:.2,width:.64,height:.6,feather:.3,shape:"ellipse"};function mr(t){const{scene:e,charset:n,hover:r,middle:o=fr,feather:a=.3,graphite:i=dr}=t,s=t.mark??"glyph";return{id:t.id,name:t.name,description:t.description,cellSize:t.cellSize,speed:t.speed??1,cursor:t.cursor??!0,opacity:t.opacity,mount(l){const c=lr(l,(i,l)=>{const c=((t,e)=>t.mark??(t.charset||t.look?.charset?"glyph":e))(i,s);return{scene:e,color:"ink",shade:0,background:"transparent",vignette:0,speed:i.speed,maxPixelRatio:2,levels:"none",blend:"on",..."dot"===c?{mark:"dot",...pr(i)}:{mark:"glyph",charset:i.charset??n,...ur(i)},hover:sr(i,r),lantern:{radius:.14,strength:.45,trail:.8,follow:9},trail:{strength:.8,radius:.35},fluid:{radius:.09,refraction:.03,glow:.6},clear:i.clear?{element:i.clear,padding:0,feather:a,shape:"ellipse"}:o,...t.tune?.(i,l)}},i,"dot"===s?t=>({...ur(t),charset:n}):void 0);if(!c||!t.extra)return c;const d=t.extra(l,c),h=c.destroy.bind(c);return Object.assign(c,{destroy(){d(),h()}})}}}var gr=mr({id:"swell",name:"Swell",description:"A fine grid that swells in slow rolling waves, quiet in the middle. Dots by default, or characters.",cellSize:10,opacity:.6,scene:"swell",mark:"dot",charset:" .:-=+*#",hover:"lantern",graphite:hr,tune:()=>({scale:cr()?1.5:1,contrast:.62,brightness:-.19,blend:"auto",lantern:{radius:.12,strength:.5,trail:1,follow:8},trail:{strength:.7,radius:.35}})}),xr=mr({id:"drift",name:"Drift",description:"Characters that drift slowly in broad lobes and stay clear around your content.",cellSize:11,scene:"drift",charset:" .:-=+*#",hover:"trail",graphite:hr,middle:!1,feather:.2,tune:t=>({scale:cr()?"dot"===t.mark?1.8:1.6:1,brightness:"dot"===t.mark?0:.05,blend:"auto",lantern:{radius:.16,strength:.35,trail:.6,follow:9},trail:{strength:.9,radius:"dot"===t.mark?.4:.32},...t.clear?{clear:{element:t.clear,padding:32,feather:.2,shape:"rect"}}:{}})}),yr={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=>lr(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?cr()?.1:.4:0,background:"transparent",contrast:1.1,scale:cr()?1.6:1,brightness:cr()&&e?.08:0,vignette:0,speed:t.speed,maxPixelRatio:2,hover:sr(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 a=Math.min(1,25*Math.hypot(r*this.aspect,o)+.06);this.strokes.push({x:t,y:e,dx:r,dy:o,speed:a,fromX:n.x,fromY:n.y}),this.strokes.length>12&&this.strokes.shift()}leave(){this.previous=null}clear(){this.front.fill(0),this.back.fill(0),this.strokes.length=0,this.previous=null,this.energy=0}read(t,e,n,r){const o=Math.max(0,Math.min(this.columns-1.001,e*(this.columns-1))),a=Math.max(0,Math.min(this.rows-1.001,n*(this.rows-1))),i=Math.floor(o),s=Math.floor(a),l=o-i,c=a-s,d=3*(s*this.columns+i),h=d+3*this.columns,u=1-l,p=1-c;r[0]=(t[d]*u+t[d+3]*l)*p+(t[h]*u+t[h+3]*l)*c,r[1]=(t[d+1]*u+t[d+4]*l)*p+(t[h+1]*u+t[h+4]*l)*c,r[2]=(t[d+2]*u+t[d+5]*l)*p+(t[h+2]*u+t[h+5]*l)*c}sample(t,e,n){this.read(this.front,t,e,n)}step(t){if(!this.active)return;const e=Math.max(0,Math.min(.05,t)),n=Math.exp(-e*this.decayRate),r=Math.exp(-e*(this.decayRate+.5)),o=Math.max(1,this.aspect),a=Math.max(1,1/this.aspect);let i=0;for(let t=0;t<this.rows;t++)for(let s=0;s<this.columns;s++){const l=3*(t*this.columns+s),c=s/(this.columns-1),d=t/(this.rows-1),h=this.continuousWake?.65:2,u=c-this.front[l]*e*h,p=d-this.front[l+1]*e*h;this.read(this.front,u,p,this.advected);let f=this.advected[0]*n,m=this.advected[1]*n,g=this.advected[2]*r;for(const t of this.strokes){let e=(c-t.x)*o,n=(d-t.y)*a;if(this.continuousWake){const r=(c-t.fromX)*o,i=(d-t.fromY)*a,s=(t.x-t.fromX)*o,l=(t.y-t.fromY)*a,h=Math.max(0,Math.min(1,(r*s+i*l)/(s*s+l*l||1)));e=r-s*h,n=i-l*h;const u=e*e+n*n;if(u>.0225)continue;const p=Math.exp(-u/.0032),x=Math.hypot(t.dx*o,t.dy*a),y=Math.min(.025,.55*x);f+=(4.2*t.dx-n*y)*p,m+=(4.2*t.dy+e*y)*p,g=Math.max(g,Math.min(.7,18*x)*p);continue}const r=e*e+n*n;if(r>.045)continue;const i=Math.exp(-r/.0075),s=t.speed;f+=(2.8*t.dx-n*s*.16)*i,m+=(2.8*t.dy+e*s*.16)*i,g+=s*i*.3}this.back[l]=Math.max(-.18,Math.min(.18,f)),this.back[l+1]=Math.max(-.18,Math.min(.18,m)),this.back[l+2]=Math.min(.8,g),i=Math.max(i,Math.abs(f),Math.abs(m),g)}[this.front,this.back]=[this.back,this.front],this.strokes.length=0,this.energy=i,this.active||this.clear()}};var Mr=" .:+-=xICA$FY#@",br=.58,wr=72649.5/59542.5;var kr={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,a=0,i=!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=ft({host:e,kit:t.kit,layer:"under",look:()=>{const n=t.settings();return{mark:"glyph",charset:n.charset??Mr,font:'"JetBrains Mono", monospace',fontWeight:400,cellSize:c(e.clientWidth||1,e.clientHeight||1)/br,cellAspect:br,glyphScale:.9,cellFit:"fill",maxPixelRatio:1.5,clear:!!n.clear&&{element:n.clear,padding:8,feather:.22,shape:"ellipse"},color:"ink",shade:0,levels:"none",fit:"cover",gamma:1,contrast:wr,brightness:-.0004316244699164449-.5/Math.max(1,Array.from(n.charset??Mr).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:h,w:u,h:p,now:f,still:m})=>{const g=t.settings(),x=a?Math.min(.05,(f-a)/1e3):1/60;a=f,m||(o+=x*g.speed);const y=u/p;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,i&&(n.leave(),i=!1),n.step(x)}s&&s.width===d&&s.height===h||(s=c.createImageData(d,h));const v=s.data;!function(t,e,n,r,o,a){const i=[0,0,0],s=a.active;for(let l=0;l<n;l++)for(let c=0;c<e;c++){const d=c/e,h=l/n;s&&a.sample(d,h,i);const u=(d-.5-i[0])*r,p=h-.5-i[1],f=u+.22*Math.sin(5.2*p+.17*o)+.15*Math.sin(2.4*u-3.1*p-.1*o),m=p+.19*Math.sin(3.5*u+.13*o),g=Math.hypot(.8*f+.18,1.1*m),x=.5+.5*Math.sin(14*g-2.8*f+1.4*Math.sin(5*m)-.24*o),y=.5+.5*Math.sin(3.6*f-2.9*m+.09*o),v=Math.max(0,Math.min(1,x*x*(.48+.32*y)-.075+.75*i[2])),M=Math.round(255*v),b=4*(l*e+c);t[b]=t[b+1]=t[b+2]=M,t[b+3]=255}}(v,d,h,y,o,n);for(let t=0;t<v.length;t+=4){const e=v[t]<10?0:Math.min(255,1.45*v[t]);v[t]=v[t+1]=v[t+2]=.299*e+e*(185/232)*.587,v[t+3]=255}return c.putImageData(s,0,0),!0}});if(!d)return null;const h=t=>{if(t.target instanceof Element&&t.target.closest("button, a, input, select, summary, textarea"))return i=!0,void d.kick();l.push({x:t.clientX,y:t.clientY}),l.length>6&&l.shift(),d.kick()},u=()=>{i=!0,d.kick()};return e.addEventListener("pointermove",h),e.addEventListener("pointerdown",h),e.addEventListener("pointerleave",u),e.addEventListener("pointercancel",u),{get field(){return d.field},get canvas(){return d.canvas},refresh:()=>d.refresh(),play:()=>{a=0,d.play()},pause:()=>d.pause(),destroy(){e.removeEventListener("pointermove",h),e.removeEventListener("pointerdown",h),e.removeEventListener("pointerleave",u),e.removeEventListener("pointercancel",u),d.destroy()}}}},Sr=mr({id:"caustics",name:"Caustics",description:"Light focused by moving water: fine bright lines that fold, part and meet again.",cellSize:11,scene:"caustics",charset:" .:-=+*#",hover:"lantern",tune:()=>({blend:"off",lantern:{radius:.14,strength:.22,trail:.8,follow:9}})}),Ar=mr({id:"contour",name:"Contour",description:"Survey lines over a slowly shifting terrain, every fifth an index line.",cellSize:11,scene:"contour",charset:" .·-~=",hover:"lantern"}),Cr=mr({id:"ripple",name:"Ripple",description:"Still water: drops land here and there and ring outward, and the pointer drops its own.",cellSize:11,scene:"ripple",charset:" .·:-~=",hover:"none",extra(t,e){const{host:n}=t;let r=-1e9,o=-1e4,a=-1e4;const i=n=>{const i=performance.now();if(!1===t.settings().cursor||i-r<260||Math.hypot(n.clientX-o,n.clientY-a)<48)return;r=i,o=n.clientX,a=n.clientY;const s=e.canvas.getBoundingClientRect();e.field?.pulse({x:n.clientX-s.left,y:n.clientY-s.top,strength:.5})};return n.addEventListener("pointermove",i,{passive:!0}),()=>n.removeEventListener("pointermove",i)}}),Er=mr({id:"halo",name:"Halo",description:"A corona breathes slowly round the middle, its rays turning; the centre stays empty for a headline.",cellSize:11,scene:"halo",charset:" .·:-=+*",hover:"lantern",middle:!1,feather:.12}),$r=mr({id:"interference",name:"Interference",description:"Two fine ring grids from slowly orbiting centres; where they cross, moiré bands open and close.",cellSize:11,scene:"interference",charset:" .:-=+*#",hover:"lantern"}),Lr=mr({id:"mesh",name:"Mesh",description:"Four soft lights on slow paths: a gradient mesh written in characters.",cellSize:11,scene:"mesh",charset:" .:-=+*#%@",hover:"trail"}),zr=mr({id:"cascade",name:"Cascade",description:"Streaks fall in three depths: far ones faint and slow, near ones rare, bright and quick.",cellSize:11,scene:"cascade",charset:" .:;|",hover:"lantern",tune:()=>({blend:"off"}),middle:{x:.22,y:.25,width:.56,height:.5,feather:.3,shape:"ellipse"}}),Pr=mr({id:"constellation",name:"Constellation",description:"Points wander and neighbours close enough are linked by fine lines that come and go.",cellSize:11,scene:"constellation",charset:" .·:+*#",hover:"lantern",tune:()=>({blend:"off"})}),Rr=mr({id:"aurora",name:"Aurora",description:"Curtains of light at three depths hang from the top in tall vertical rays, brightest along their hems.",cellSize:11,scene:"aurora",charset:" .:¦|",hover:"lantern",tune:()=>({blend:"off"}),middle:{x:.2,y:.42,width:.6,height:.5,feather:.3,shape:"ellipse"}}),Fr=mr({id:"halftone",name:"Halftone",description:"The drifting ground drawn as dots, clear around your content.",cellSize:14,scene:"drift",mark:"dot",charset:" .:-=+*#",hover:"lantern",graphite:hr,middle:!1,feather:.2,tune:t=>({scale:cr()?1.8:1,blend:"auto",dotScale:.64,lantern:{radius:.16,strength:.35,trail:.6,follow:9},trail:{strength:.9,radius:.4},...t.clear?{clear:{element:t.clear,padding:32,feather:.2,shape:"rect"}}:{}})}),Tr="#6f6d67",Ir="#8f8d86",Wr={x:-1,y:-1,users:0},Br=t=>{Wr.x=t.clientX,Wr.y=t.clientY};function Or(t,e,n=0){if("undefined"==typeof document)return null;const{host:r}=t,o=document.createElement("canvas");let a=null;try{a=o.getContext("2d")}catch{a=null}if(!a)return null;const i=a,s=lt();"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=st(r),d="";const h=()=>{d=nt(t.ink(c),r,c?Ir:Tr)??Ir;const e=t.settings().accent;l=e?nt(e,r)??void 0:void 0};h();let u=0,p=!0,f=!1,m=!1,g=0,x=0,y=0,v=!1,M=9,b=9,w=1,k=1,S=n;const A={x:.5,y:.5},C=()=>!!(t.reducedMotion()??tt()),E=()=>{const n=t.settings(),r=performance.now(),a={fontSize:n.cellSize,chars:n.charset,ditherStrength:n.dither,lightMode:!c,ink:d,accent:l,elapsed:b,speed:n.speed};for(i.globalAlpha=1,i.globalCompositeOperation="source-over";S>0;S--)e(i,w,k,M,A,a);e(i,w,k,M,A,a),(t=>{if(!t||!t.isConnected)return;const e=dt(o,t);if(!e.w||!e.h)return;const n=.71*e.w+32,r=.71*e.h+32,a=o.width/w||1;i.save(),i.setTransform(a*n,0,0,a*r,a*(e.x+e.w/2),a*(e.y+e.h/2));const s=i.createRadialGradient(0,0,0,0,0,1);s.addColorStop(0,"rgba(0,0,0,1)"),s.addColorStop(.72,"rgba(0,0,0,1)"),s.addColorStop(1,"rgba(0,0,0,0)"),i.globalCompositeOperation="destination-out",i.fillStyle=s,i.fillRect(-1,-1,2,2),i.restore()})(n.clear),y=.9*y+.1*(performance.now()-r),o.dataset.painted=""},$=e=>{if(u=0,m||f||!p||"undefined"!=typeof document&&document.hidden)return void(g=x=0);const n=C(),r=t.settings(),a=x?e-x:17;if(x=e,!n&&y>4.5&&a<12&&(v=!v))return void(u=requestAnimationFrame($));const i=g?Math.min(.05,(e-g)/1e3):0;if(g=e,n||(M+=i*r.speed,b+=i),r.cursor&&Wr.x>=0){const t=o.getBoundingClientRect();t.width&&t.height&&(A.x+=.07*((Wr.x-t.left)/t.width-A.x),A.y+=.07*((Wr.y-t.top)/t.height-A.y))}else r.cursor||(A.x+=.07*(.5-A.x),A.y+=.07*(.5-A.y));E(),n||(u=requestAnimationFrame($))},L=()=>{u||m||f||!p||(u=requestAnimationFrame($))},z=()=>{if(m)return;const t=Math.min(2,"number"==typeof devicePixelRatio&&devicePixelRatio||1);w=Math.max(1,o.clientWidth||r.clientWidth||1),k=Math.max(1,o.clientHeight||r.clientHeight||1),o.width=Math.round(w*t),o.height=Math.round(k*t),i.setTransform(t,0,0,t,0,0),S=n,p&&!f&&E(),L()};z();const P="function"==typeof ResizeObserver?new ResizeObserver(z):null;P?.observe(r);const R="function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{p=t.isIntersecting,g=0,p?L():u&&(cancelAnimationFrame(u),u=0)},{rootMargin:"64px"}):null;R?.observe(r);const F=()=>{g=0,L()};document.addEventListener("visibilitychange",F);const T="function"==typeof matchMedia?matchMedia("(prefers-reduced-motion: reduce)"):null;T?.addEventListener?.("change",F),0===Wr.users++&&"function"==typeof addEventListener&&addEventListener("pointermove",Br,{passive:!0});const I="object"==typeof document.fonts?document.fonts:null,W=()=>{m||!p||f||(E(),L())};I?.addEventListener?.("loadingdone",W),I?.ready?.then(W,()=>{});let B=0;const O=()=>{B||m||(B=requestAnimationFrame(()=>{B=0,m||(c=st(r),h(),C()&&E(),L())}))},q="function"==typeof matchMedia?matchMedia("(prefers-color-scheme: dark)"):null;q?.addEventListener?.("change",O);const N="function"==typeof MutationObserver?new MutationObserver(O):null;for(const t of[document.documentElement,document.body])t&&N?.observe(t,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]});return{field:null,canvas:o,refresh(){m||(c=st(r),h(),C()&&p&&!f&&E(),L())},play(){f&&(f=!1,g=0,L())},pause(){f=!0,u&&cancelAnimationFrame(u),u=0},destroy(){m||(m=!0,u&&cancelAnimationFrame(u),B&&cancelAnimationFrame(B),u=B=0,P?.disconnect(),R?.disconnect(),N?.disconnect(),document.removeEventListener("visibilitychange",F),T?.removeEventListener?.("change",F),q?.removeEventListener?.("change",O),I?.removeEventListener?.("loadingdone",W),0===--Wr.users&&"function"==typeof removeEventListener&&removeEventListener("pointermove",Br),o.remove(),o.width=o.height=0,s.restore())}}}function qr(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 Nr(t){return t*t*t*(t*(6*t-15)+10)}function Hr(t,e,n){return t+(e-t)*n}function Gr(t,e){let n=127*t+311*e;return n^=n>>13,(n*(n*n*15731+789221)+1376312589&2147483647)/2147483647}function Dr(t,e){const n=Math.floor(t),r=Math.floor(e),o=e-r,a=Nr(t-n),i=Nr(o),s=Gr(n,r),l=Gr(n+1,r),c=Gr(n,r+1),d=Gr(n+1,r+1);return Hr(Hr(s,l,a),Hr(c,d,a),i)}function jr(t,e){return(.5*Dr(t,e)+.25*Dr(2.1*t,2.1*e)+.125*Dr(4.3*t,4.3*e))/.875}var Ur='"Geist Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace';function Xr(t){const e=("function"==typeof t.getTransform?t.getTransform().a:1)||1;return t=>Math.round(t*e)/e}var Yr={r:111,g:109,b:103},Vr={r:143,g:141,b:134};function _r(t,e,n){return Math.min(1,Math.max(0,(t-e)/(n-e)))}function Jr(t,e=.3,n=.95){return e+(n-e)*Math.min(1,Math.max(0,t))}var Kr=[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 a=(Kr[(3&r)<<2|3&n]+.5)/16;return Math.min(e-1,Math.max(0,Math.floor(t*(e-1)+a*Math.min(1,Math.max(0,o)))))}var Zr=1,to=2,eo=4,no=8,ro={3:"─",12:"│",9:"┌",10:"┐",5:"└",6:"┘",11:"┬",7:"┴",13:"├",14:"┤",15:"┼",[Zr]:"╶",[to]:"╴",[eo]:"╵",[no]:"╷"};var oo={id:"circuit",name:"Circuit",description:"Circuit traces with signals running along them.",cellSize:13,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,pulseColor:i="#ffffff",color:s="#00ff88",density:l=.38,speed:c=1,lightMode:d=!1}=o,h=.62*a,u=1.4*a,p=Math.ceil(e/h),f=Math.ceil(n/u),m=qr(s)??{r:0,g:255,b:136},g=qr(i)??{r:255,g:255,b:255},x=(t,e)=>{if(Gr(17*t+1,7*e+2)>l)return 0;let n=0;return t+1<p&&Gr(17*t+1,7*e+2)>.15&&(n|=1),t-1>=0&&Gr(17*(t-1)+1,7*e+2)>.15&&(n|=2),e+1<f&&Gr(17*t+1,7*(e+1)+2)>.15&&(n|=8),e-1>=0&&Gr(17*t+1,7*(e-1)+2)>.15&&(n|=4),n};t.clearRect(0,0,e,n),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";const y=r*c;for(let e=0;e<f;e++)for(let n=0;n<p;n++){const r=x(n,e);if(0===r)continue;const o=ro[r]??"·",a=(8*y+40*Gr(n,23*e))%p,i=(6*y+40*Gr(17*e,11*n))%f,s=(1&r||2&r)&&Math.abs(n-a)<1.5,l=(4&r||8&r)&&Math.abs(e-i)<1.5,c=s||l,d=.25+.35*Gr(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*h,e*u)}t.globalAlpha=1}(t,e,n,r,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,pulseColor:a.accent??it(a.ink,"#ffffff",.7)}))};var ao={id:"dna",name:"DNA",description:"Double helices scroll past with base-pair letters.",cellSize:13,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,baseChars:i="ATCG",bridgeChars:s="-=≡",color:l="#00e5ff",color2:c="#ff4081",bridgeColor:d="#88ffcc",speed:h=1,helixCount:u,lightMode:p=!1}=o,f=.62*a,m=1.4*a,g=Math.ceil(e/f),x=Math.ceil(n/m),y=u??Math.max(1,Math.floor(e/80)),v=g/y,M=qr(l)??{r:0,g:229,b:255},b=qr(c)??{r:255,g:64,b:129},w=qr(d)??{r:136,g:255,b:204};t.clearRect(0,0,e,n),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";const k=r*h,S=.35*v;for(let e=0;e<y;e++){const n=v*(e+.5);for(let r=0;r<x;r++){const o=r/x*Math.PI*6-1.8*k,a=n+Math.sin(o)*S,l=n+Math.sin(o+Math.PI)*S,c=Math.round(a),d=Math.round(l);if(c<0||c>=g)continue;const h=Gr(31*e+7*r,3),u=i[Math.floor(h*i.length)],p=.5*(Math.sin(o)+1),y=.5*(Math.sin(o+Math.PI)+1);if(t.globalAlpha=.35+.65*p,t.fillStyle=`rgb(${M.r},${M.g},${M.b})`,t.fillText(u,c*f,r*m),d>=0&&d<g){const n=Gr(53*e+11*r,7),o=i[Math.floor(n*i.length)];t.globalAlpha=.35+.65*y,t.fillStyle=`rgb(${b.r},${b.g},${b.b})`,t.fillText(o,d*f,r*m)}if(r%3==0){const n=Math.min(c,d),o=Math.max(c,d);if(o-n>1){const a=Gr(17*r+43*e,5),i=s[Math.floor(a*s.length)],l=.25*(p+y)+.2;t.globalAlpha=l,t.fillStyle=`rgb(${w.r},${w.g},${w.b})`;for(let e=n+1;e<o;e++)t.fillText(i,e*f,r*m)}}}}t.globalAlpha=1}(t,e,n,r,{fontSize:a.fontSize,color:a.ink,color2:a.accent??it(a.ink,"#ffffff",.55),bridgeColor:it(a.ink,"#0c0d0b",.35)}))};function io(t,e,n,r,o,a={}){if(n<=0||r<=0)return;const i=Math.max(6,a.fontSize??12),s=.62*i,l=1.2*i,c=qr(a.color??a.accentColor??"")??(a.lightMode?Yr:Vr),d=Xr(e),h=o*Math.max(0,a.speed??.35),u=n/r;e.clearRect(0,0,n,r),e.font=`${i}px ${Ur}`,e.textBaseline="top";const p=Array.from(a.chars||" .:-=+*#%@");for(let o=0;o<r;o+=l)for(let i=0;i<n;i+=s){const n=i/r,f=o/r,m=_r(Math.min(1,Math.max(0,t(n,f,u,h))),.06,.72);if(m<=0)continue;const g=p[Qr(m,p.length,Math.round(i/s),Math.round(o/l),a.ditherStrength)];" "!==g&&(e.fillStyle=`rgba(${c.r},${c.g},${c.b},${Jr(m)})`,e.fillText(g,d(i),d(o)))}}var so=(t,e,n,r)=>{const o=7*e+.55*Math.sin(2.2*t+.09*r)+.22*Math.sin(4.8*t-.07*r),a=.5+.5*Math.sin(o);return Math.pow(a,5)*(.35+.65*e)+.08*Math.pow(.5+.5*Math.sin(17*o),3)*a},lo={id:"dune",name:"Dune",description:"Layered sand ridges with slow-moving light and fine grain.",cellSize:12,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>io(so,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))},co=(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))},ho={id:"etch",name:"Etch",description:"Cut-grain lines follow a slow, sculpted current.",cellSize:12,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>io(co,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))},uo=(t,e,n,r)=>{const o=2.8*t+1.8*e+.018*r,a=1.2*t-3.2*e,i=Math.abs(2*(o-Math.floor(o))-1),s=Math.abs(2*(a-Math.floor(a))-1);return.85*Math.pow(Math.min(i,s),1.8)},po={id:"facet",name:"Facet",description:"Quiet folded planes catch light along their edges.",cellSize:12,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>io(uo,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))};var fo={id:"fire",name:"Fire",description:"A cellular flame rising from the bottom edge.",cellSize:13,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,chars:i=" .,:;i+xX#&@",color:s="#ff4500",hotColor:l="#ffe066",intensity:c=.85,wind:d=0,speed:h=1,lightMode:u=!1}=o,p=.62*a,f=1.4*a,m=Math.ceil(e/p),g=Math.ceil(n/f),x=m*g,y="__fire_heat__",v=t.canvas;let M=v[y];M&&M.length===x||(M=new Float32Array(x),v[y]=M);const b=.016*h*.18,w=d*h*.8,k=g-1,S=r*h;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(x);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-b-.02*Math.random()*h)}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]);v[y]=A;const C=qr(s)??{r:255,g:69,b:0},E=qr(l)??{r:255,g:224,b:102};t.clearRect(0,0,e,n),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";for(let e=0;e<g;e++)for(let n=0;n<m;n++){const r=A[e*m+n];if(r<.03)continue;const o=i[Math.min(i.length-1,Math.floor(r*i.length))];if(" "===o)continue;const a=Math.min(1,1.2*r),s=C.r+(E.r-C.r)*a|0,l=C.g+(E.g-C.g)*a|0,c=C.b+(E.b-C.b)*a|0,d=u?1-.3*r:Math.min(1,r+.15);t.globalAlpha=d,t.fillStyle=`rgb(${s},${l},${c})`,t.fillText(o,n*p,e*f)}t.globalAlpha=1}(t,e,n,a.elapsed,{fontSize:a.fontSize,chars:a.chars,color:a.ink,hotColor:a.accent??it(a.ink,"#ffffff",.6),speed:a.speed}),48)};var mo={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=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=12,chars:s="·-=+|/",accentColor:l,color:c,bands:d=3,speed:h=1,bandWidth:u=.12,glitch:p=!0,lightMode:f=!1}=a,m=l??(f?"#6b8700":"#d4ff00"),g=.62*i,x=1.4*i,y=Math.ceil(e/g),v=Math.ceil(n/x);t.clearRect(0,0,e,n),t.font=`${i}px monospace`,t.textBaseline="top";let M=255,b=255,w=255;if(f&&(M=55,b=55,w=55),c){const t=qr(c);t&&(M=t.r,b=t.g,w=t.b)}let k=212,S=255,A=0;const C=qr(m);C&&(k=C.r,S=C.g,A=C.b);const E=r*h;for(let e=0;e<v;e++)for(let n=0;n<y;n++){const r=e/v,a=((r*d-.5*E)%1+1)%1,i=Math.max(0,1-a/u),l=.35*(.5*Gr(3*n,7*e)+.5);let c=0;if(p){const t=n/y-o.x,a=r-o.y,i=Math.sqrt(t*t+a*a);if(i<.18){const t=Gr(11*n+Math.floor(12*E),5*e);c=Math.max(0,1-i/.18)*(t>.5?t-.3:0)}}const h=Math.min(1,l+.8*i+.6*c);if(h<.04)continue;const m=s[Math.floor(h*(s.length-1))],C=i>.55,$=f?.82*h:.12*h;t.fillStyle=C?`rgba(${k},${S},${A},${f?.92:.28})`:`rgba(${M},${b},${w},${$})`,t.fillText(m,n*g,e*x)}}(t,e,n,r,o,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))},go=(t,e,n,r)=>{const o=.12+.06*Math.sin(.1*r),a=Math.sin(68*t),i=Math.sin(68*(t*Math.cos(o)+e*Math.sin(o)));return.8*Math.pow((a+i+2)/4,3)},xo={id:"moire",name:"Moiré",description:"Two fine line fields overlap into broad, shifting bands.",cellSize:12,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>io(go,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))};var yo={id:"morph",name:"Morph",description:"Every cell shimmers at its own frequencies.",cellSize:14,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=14,chars:i=" ·∙•:-=+*#",color:s,accentColor:l,speed:c=.5,harmonics:d=3,lightMode:h=!1}=o,u=l??(h?"#6b8700":"#d4ff00"),p=.62*a,f=1.4*a,m=Math.ceil(e/p),g=Math.ceil(n/f);t.clearRect(0,0,e,n),t.font=`${a}px monospace`,t.textBaseline="top";let x=255,y=255,v=255;if(h&&(x=55,y=55,v=55),s){const t=qr(s);t&&(x=t.r,y=t.g,v=t.b)}let M=212,b=255,w=0;const k=qr(u);k&&(M=k.r,b=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*Gr(n*(t+3)+7,e*(t+5)+11),a=Gr(n*(t+7),e*(t+9)+3)*Math.PI*2,i=1/(t+1);r+=Math.sin(S*o+a)*i}const o=.5*(r/A+1);if(o<.28)continue;const a=(o-.28)/.72,s=i[Math.min(i.length-1,Math.floor(a*i.length))],l=o>.88,c=h?.82*a:.13*a;t.fillStyle=l?`rgba(${M},${b},${w},${h?.92:.28})`:`rgba(${x},${y},${v},${c})`,t.fillText(s,n*p,e*f)}}(t,e,n,r,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var vo={id:"noise",name:"Noise",description:"A slow fractal noise field that warps around the cursor.",cellSize:13,speed:.5,cursor:!0,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=13,chars:s=" .:-=+*#%@",accentColor:l,color:c,octaves:d=4,speed:h=1,scale:u=1,accentThreshold:p=.9,mouseWarp:f=.3,lightMode:m=!1}=a,g=Array.from(s),x=.62*i,y=1.3*i,v=Math.ceil(e/x),M=Math.ceil(n/y);t.clearRect(0,0,e,n),t.font=`${i}px ${Ur}`,t.textBaseline="top";const b=m?Yr:Vr;let w=b.r,k=b.g,S=b.b;const A=Xr(t);if(c){const t=qr(c);t&&(w=t.r,k=t.g,S=t.b)}let C=w,E=k,$=S;const L=l?qr(l):null;L&&(C=L.r,E=L.g,$=L.b);const z=.035*u,P=r*h,R=Math.min(6,Math.max(1,d)),F=(t,e)=>{let n=0,r=.5,o=1,a=0;for(let i=0;i<R;i++)n+=Dr(t*o,e*o)*r,a+=r,r*=.5,o*=2.1;return n/a};for(let e=0;e<M;e++)for(let n=0;n<v;n++){const r=n*z+.06*P,i=e*z*1.3-.04*P,s=n/v-o.x,l=e/M-o.y,c=Math.sqrt(s*s+l*l),d=f>0?.12*Math.max(0,1-c/f):0,h=_r(.5*F(r+d*Math.sin(1.3*P+8*l),i+d*Math.cos(.9*P+8*s))+.5,.7,.83);if(h<=0)continue;const u=g[Qr(h,g.length,n,e,a.ditherStrength)];if(" "===u)continue;const m=!!L&&h>p,b=Jr(h);t.fillStyle=m?`rgba(${C},${E},${$},${b})`:`rgba(${w},${k},${S},${b})`,t.fillText(u,A(n*x),A(e*y))}}(t,e,n,r,o,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var Mo={id:"pulse",name:"Pulse",description:"Rings of characters ripple out from the cursor.",cellSize:14,speed:1,cursor:!0,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=". · ○ ◎ ●",accentColor:l,color:c,rings:d=5,speed:h=1,sharpness:u=4,lightMode:p=!1}=a,f=l??(p?"#007a5e":"#00ffcc");t.clearRect(0,0,e,n),t.textBaseline="middle",t.textAlign="center";const m=e*o.x,g=n*o.y,x=1.6*Math.sqrt(m*m+g*g)+.2*Math.sqrt(e*e+n*n);let y=255,v=255,M=255;if(p&&(y=55,v=55,M=55),c){const t=qr(c);t&&(y=t.r,v=t.g,M=t.b)}let b=0,w=255,k=204;const S=qr(f);S&&(b=S.r,w=S.g,k=S.b);const A=s.replace(/ /g,"").split("");if(0===A.length)return;const C=Math.ceil(e/i),E=Math.ceil(n/i);for(let e=0;e<E;e++)for(let n=0;n<C;n++){const o=n*i+.5*i,a=e*i+.5*i,s=o-m,l=a-g,c=Math.sqrt(s*s+l*l)/x;let f=0;for(let t=0;t<d;t++){const e=(r*h*.38+t/d)%1,n=Math.abs(c-e),o=Math.max(0,1-n*x/(i*(12-u)));f+=Math.cos(o*Math.PI*.5)*o}if(f=Math.min(1,f),f<.02)continue;const S=f>.6;t.font=`${i}px monospace`;const C=Math.floor(f*(A.length-1)),E=A[Math.min(C,A.length-1)],$=p?.88*f:.22*f;t.fillStyle=S?`rgba(${b},${w},${k},${Math.min(p?.95:.4,.55*f)})`:`rgba(${y},${v},${M},${$})`,t.fillText(E,o,a)}t.textAlign="left"}(t,e,n,r,o,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var bo={id:"rain",name:"Rain",description:"Columns of falling characters with bright heads.",cellSize:13,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,chars:i="0123456789ABCDEF@#$&*+=/<>",accentColor:s,color:l,speed:c=1,density:d=.55,tailLength:h=14,lightMode:u=!1}=o,p=s??(u?"#6b8700":"#d4ff00"),f=.62*a,m=1.4*a,g=Math.ceil(e/f),x=Math.ceil(n/m);t.clearRect(0,0,e,n),t.font=`${a}px monospace`,t.textBaseline="top";let y=255,v=255,M=255;if(u&&(y=55,v=55,M=55),l){const t=qr(l);t&&(y=t.r,v=t.g,M=t.b)}let b=212,w=255,k=0;const S=qr(p);S&&(b=S.r,w=S.g,k=S.b);const A=x+h;for(let e=0;e<g;e++){if(Gr(17*e,3)>d)continue;const n=(.5+1.5*Gr(31*e,7))*c,o=Gr(13*e,11)*A,a=Math.floor((r*n*7+o)%A),s=e*f;for(let n=0;n<=h;n++){const o=a-(h-n);if(o<0||o>=x)continue;const l=o*m,c=Gr(53*e+Math.floor(5*r+n),7*o),d=i[Math.floor(c*i.length)],p=n/h;if(n===h)t.fillStyle=`rgba(${b},${w},${k},${u?.7:.85})`;else{const e=u?.85*p:.15*p;t.fillStyle=`rgba(${y},${v},${M},${e})`}t.fillText(d,s,l)}}}(t,e,n,r,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var wo={id:"silk",name:"Silk",description:"Long ribbons that follow a slow flow field.",cellSize:13,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,color:i,accentColor:s,speed:l=.4,layers:c=4,turbulence:d=.8,lightMode:h=!1}=o,u=.62*a,p=1.3*a,f=Math.ceil(e/u),m=Math.ceil(n/p);t.clearRect(0,0,e,n),t.font=`${a}px ${Ur}`,t.textBaseline="top";const g=h?Yr:Vr;let x=g.r,y=g.g,v=g.b;const M=Xr(t);if(i){const t=qr(i);t&&(x=t.r,y=t.g,v=t.b)}let b=x,w=y,k=v;const S=s?qr(s):null;S&&(b=S.r,w=S.g,k=S.b);const A=r*l,C=o.chars?Array.from(o.chars):void 0,E=["-","\\","|","/"];for(let e=0;e<m;e++){const n=e/m;for(let r=0;r<f;r++){const a=r/f;let i=0,s=0;for(let t=0;t<c;t++){const e=Gr(13*t,7*t+3),r=1.1+2.4*e,o=.9+2*Gr(29*t,11*t+1),l=e*Math.PI*6,c=(.2+.5*Gr(41*t,17*t))*(t%2==0?1:-1.3),h=Math.sin(a*r*Math.PI*2+A*c+l),u=Math.cos(n*o*Math.PI*2+A*c*.6+1.7*l),p=Math.sin(a*o*Math.PI*d+n*r*Math.PI*d+A*c*.4);i+=Math.atan2(u+.3*p,h),s+=.5*(h*u+1)}const l=i/c,h=_r(s/c,.54,.74);if(h<=0)continue;const m=(l%Math.PI+Math.PI)%Math.PI,g=Math.round(m/(Math.PI/4))%E.length;if(!C&&o.ditherStrength&&0===Qr(h,2,r,e,o.ditherStrength))continue;const $=C?C[Qr(h,C.length,r,e,o.ditherStrength)]:E[g];if(" "===$)continue;const L=!!S&&h>.85,z=Jr(h);t.fillStyle=L?`rgba(${b},${w},${k},${z})`:`rgba(${x},${y},${v},${z})`,t.fillText($,M(r*u),M(e*p))}}}(t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var ko={id:"stars",name:"Stars",description:"A sparse starfield that twinkles, drifts and leans toward the cursor.",cellSize:14,speed:1,cursor:!0,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=14,chars:s=" . · * + ° ★",accentColor:l,color:c,speed:d=1,count:h=180,lightMode:u=!1}=a,p=l??(u?"#6b8700":"#d4ff00");t.clearRect(0,0,e,n),t.textBaseline="middle",t.textAlign="center";const f=e*(.2+.6*o.x),m=n*(.2+.6*o.y),g=.65*Math.sqrt(e*e+n*n);let x=255,y=255,v=255;if(u&&(x=55,y=55,v=55),c){const t=qr(c);t&&(x=t.r,y=t.g,v=t.b)}let M=212,b=255,w=0;const k=qr(p);k&&(M=k.r,b=k.g,w=k.b);const S=s.replace(/ /g,"").split("");if(0!==S.length){for(let o=0;o<h;o++){const a=Gr(17*o,3)*Math.PI*2,s=(r*(.15+.85*Gr(31*o,7))*d*.22+Gr(13*o,11))%1,l=f+Math.cos(a)*s*g,c=m+Math.sin(a)*s*g;if(l<-20||l>e+20||c<-20||c>n+20)continue;const h=Math.max(6,i*(.4+.9*s));t.font=`${h}px monospace`;const p=S[Math.min(S.length-1,Math.floor(s*S.length))],k=s>.72,A=u?.85*s:.2*s;t.fillStyle=k?`rgba(${M},${b},${w},${Math.min(u?.92:.32,2.2*A)})`:`rgba(${x},${y},${v},${A})`,t.fillText(p,l,c)}t.textAlign="left"}}(t,e,n,r,o,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var So={id:"terrain",name:"Terrain",description:"A side-scrolling landscape drawn in density characters.",cellSize:13,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={}){const{fontSize:a=13,chars:i=" .,:;+*#@",color:s="#4caf50",skyColor:l="#1a237e",peakColor:c="#e0e0e0",speed:d=1,roughness:h=.55,heightScale:u=.55,stars:p=!0,lightMode:f=!1}=o,m=.62*a,g=1.4*a,x=Math.ceil(e/m),y=Math.ceil(n/g),v=qr(s)??{r:76,g:175,b:80},M=qr(l)??{r:26,g:35,b:126},b=qr(c)??{r:224,g:224,b:224};t.clearRect(0,0,e,n),t.font=`${a}px "JetBrains Mono", monospace`,t.textBaseline="top";const w=r*d*.4,k=new Array(x);for(let t=0;t<x;t++){const e=(.5*jr((t/x+w)*h*3,.5)+.5)*u;k[t]=Math.floor(e*y)}for(let e=0;e<y;e++)for(let n=0;n<x;n++){const o=y-1-k[n],a=e===o;if(!(e>=o)){if(p){const o=Gr(7*n+Math.floor(.3*w),13*e);if(o>.97){const a=.3*Math.sin(2*r+100*o)+.7;t.globalAlpha=.5*a,t.fillStyle=`rgb(${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=i[Math.min(i.length-1,Math.floor(s*i.length))];if(" "===l&&!a)continue;const c=a?1:Math.max(0,1-4*s),d=v.r+(b.r-v.r)*c|0,h=v.g+(b.g-v.g)*c|0,u=v.b+(b.b-v.b)*c|0;t.globalAlpha=.5+.5*s,t.fillStyle=`rgb(${d},${h},${u})`,t.fillText(a?i[i.length-1]:l,n*m,e*g)}t.globalAlpha=1}(t,e,n,r,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,peakColor:a.accent??it(a.ink,"#ffffff",.65),skyColor:it(a.ink,"#0c0d0b",.55)}))},Ao=(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))},Co={id:"veil",name:"Veil",description:"Tall folds of light drifting across a quiet ground.",cellSize:12,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>io(Ao,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))};var Eo={id:"void",name:"Void",description:"A gravity well that spirals characters around the cursor.",cellSize:13,speed:1,cursor:!0,mount:t=>Or(t,(t,e,n,r,o,a)=>function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=13,chars:s=" ·:;=+*#%@",color:l,accentColor:c,speed:d=1,radius:h=.38,swirl:u=3,lightMode:p=!1}=a,f=c??(p?"#6b8700":"#d4ff00"),m=.62*i,g=1.4*i,x=Math.ceil(e/m),y=Math.ceil(n/g),v=e/n;t.clearRect(0,0,e,n),t.font=`${i}px monospace`,t.textBaseline="top";let M=255,b=255,w=255;if(p&&(M=55,b=55,w=55),l){const t=qr(l);t&&(M=t.r,b=t.g,w=t.b)}let k=212,S=255,A=0;const C=qr(f);C&&(k=C.r,S=C.g,A=C.b);const E=r*d;for(let e=0;e<y;e++){const n=e/y;for(let r=0;r<x;r++){const a=(r/x-o.x)*v,i=n-o.y,l=Math.sqrt(a*a+i*i)/h;if(l>1){const n=Gr(3*r,7*e)*Math.max(0,1-3*(l-1));if(n<.62)continue;const o=n*(p?.28:.04);t.fillStyle=`rgba(${M},${b},${w},${o})`,t.fillText(s[1],r*m,e*g);continue}const c=Math.max(0,1-Math.abs(l-(.15+.12*Math.sin(1.1*E)))/.07),d=Math.pow(1-l,2.2),u=Math.min(1,d+.6*c);if(u<.06)continue;const f=Math.floor(u*(s.length-1)),y=s[Math.min(s.length-1,f)],C=c>.35||l<.08,$=p?.85*u:.18*u;t.fillStyle=C?`rgba(${k},${S},${A},${p?.95:.38})`:`rgba(${M},${b},${w},${$})`,t.fillText(y,r*m,e*g)}}}(t,e,n,r,o,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};var $o={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=>Or(t,(t,e,n,r,o,a)=>{const[i,s,l]=at(a.ink);!function(t,e,n,r,o={x:.5,y:.5},a={}){const{fontSize:i=13,charAspect:s=.62,lineHeightRatio:l=1.3,chars:c=" .:-=+*#%@",baseColor:d=null,accentColor:h,accentThreshold:u=.52,mouseInfluence:p=.4,mouseFalloff:f=2.8,speed:m=1,vortex:g=!0,sparkles:x=!1,breathe:y=!0,lightMode:v=!1}=a,M=Array.from(c),b=i*s,w=i*l,k=Math.ceil(e/b),S=Math.ceil(n/w),A=o.x,C=o.y,E=h?qr(h):null;t.clearRect(0,0,e,n),t.font=`${i}px ${Ur}`;const $=Xr(t);t.textBaseline="top";const L=r*m,z=y?.12*(.5*Math.sin(.22*L)+.5):0;for(let e=0;e<S;e++)for(let n=0;n<k;n++){const r=n/k,o=e/S,i=.045,s=.08*L,l=.06,c=(.5*Math.sin(.08*n+.05*e+.6*L)+.5+(.5*Math.sin(.03*n-.07*e+.4*L)+.5)+(.5*Math.sin(.05*n+.03*e+.8*L)+.5))/3*.45+.35*(.5*jr(n*i+s,e*i*1.4-.7*s)+.5)+.2*(.5*Math.sin((n+.65*e)*l+1.1*L)+.5)+z,h=r-A,m=o-C,y=Math.sqrt(h*h+m*m);let P=0;if(g&&y<.35){const t=Math.atan2(m,h),e=Math.sin(4*t+2.2*L-14*y),n=Math.max(0,1-y/.35);P=e*n*n*.22}const R=c*(1-p)+(Math.max(0,1-y*f)+.5*P)*p+.15*P,F=Math.min(1,Math.max(0,R));let T=F;if(x&&F>.72){const t=Math.floor(8*L),r=Gr(7*n+3*t,11*e+t);r>.88&&(T=Math.min(1,F+4*(r-.88)))}const I=_r(T,.32,.9);if(I<=0)continue;const W=Qr(I,M.length,n,e,a.ditherStrength);if(" "===M[W])continue;const B=Jr(I);t.fillStyle=E&&T>u?`rgba(${E.r},${E.g},${E.b},${B})`:d?d.replace("{a}",String(B)):v?`rgba(111,109,103,${B})`:`rgba(143,141,134,${B})`,t.fillText(M[W],$(n*b),$(e*w))}}(t,e,n,r,o,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,baseColor:`rgba(${i},${s},${l},{a})`,accentColor:a.accent})})},Lo=(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))},zo={id:"weave",name:"Weave",description:"Interlaced threads with a subtle change in tension.",cellSize:12,speed:1,cursor:!1,mount:t=>Or(t,(t,e,n,r,o,a)=>io(Lo,t,e,n,r,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))};exports.BEAM_PALETTES=gt,exports.KIT_STYLES=e,exports.PILL_TONES=ne,exports.VOICE_PALETTES=Fe,exports.accordion=function(t,e){const n={current:{open:0,duration:420,label:"Images",...e}},r=lt(),o=n.current.images.map(Kn);let a=_(Math.round(n.current.open),0,Math.max(0,o.length-1)),i=0,s=0;const l=o.map((t,e)=>({x:e===a?1:0,v:0})),c=o.map(()=>null),d=o.map(()=>null);let h=null;const u=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=Ye(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});function p(t,e){const r=i?Math.min(.064,(t-i)/1e3):1/60;i=t;const o=5/(Math.max(1,n.current.duration)/1e3),s=Math.max(1,Math.ceil(240*r)),c=r/s;let d=!1;return l.forEach((t,n)=>{const r=n===a?1:0;e&&(t.x=r,t.v=0);for(let e=0;e<s&&(t.x!==r||t.v);e++)t.v+=(-o*o*(t.x-r)-2*o*t.v)*c,t.x+=t.v*c;Math.abs(t.x-r)<.001&&Math.abs(t.v)<.01?(t.x=r,t.v=0):d=!0,f(u[n],t.x)}),d||(i=0),d}function f(t,e){const n=t.style;n.setProperty("--ascii-acc-open",e.toFixed(4)),n.setProperty("--ascii-acc-photo",(h?Q(.15,.75,e):.45+.55*e).toFixed(3)),n.setProperty("--ascii-acc-caption",Q(.6,1,e).toFixed(3))}h=ft({host:t,layer:"under",look:()=>({blend:"coarse",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:()=>{h=null,delete t.dataset.asciiField},onTheme:()=>{c.forEach((t,e)=>{d[e]=t&&h?_e(t,!h.dark()):null}),h?.kick()},paint:({pen:t,still:e,now:n,box:r})=>{const a=p(n,e);return u.forEach((e,n)=>{const a=d[n],i=l[n].x,s=1-Q(.45,.95,i);if(!a||s<=0)return;const c=r(e),h=parseFloat(getComputedStyle(e).borderTopLeftRadius)||0,u=1.04-.04*i;t.save(),t.beginPath(),t.roundRect(c.x,c.y,c.w,c.h,h),t.clip(),t.globalAlpha=s,Ve(t,a,c.x-c.w*(u-1)/2,c.y-c.h*(u-1)/2,c.w*u,c.h*u,o[n].focus?.x,o[n].focus?.y),t.restore()}),a}});const m=()=>{u.forEach((t,e)=>{t.setAttribute("aria-expanded",String(e===a)),t.tabIndex=e===a?0:-1})},g=(t,e=!1)=>{t=_(Math.round(t),0,u.length-1),e&&u[t]?.focus(),t!==a&&(a=t,m(),n.current.onChange?.(t),(()=>{if(h)return void h.kick();if(s||"function"!=typeof requestAnimationFrame)return void(s||p(performance.now(),!0));const t=e=>{s=p(e,!!(n.current.reducedMotion??tt()))?requestAnimationFrame(t):0};s=requestAnimationFrame(t)})())};let x=0,y=0,v=0,M=0,b=0;const w=()=>{x&&clearTimeout(x),x=0},k=u.map((t,e)=>{const n=t=>{if("mouse"!==t.pointerType)return;const n=t.timeStamp||performance.now(),r=Math.max(1,n-v);if(M=v&&r<100?.5*M+Math.abs(t.clientX-y)/r*.5:0,y=t.clientX,v=n,b!==e&&w(),b=e,e!==a)return M<.3?(w(),void g(e)):void(x||(x=setTimeout(()=>{x=0,g(b)},90)));w()},r=()=>{w(),g(e)},o=()=>{t.matches(":focus-visible")&&g(e)},i=t=>{const n={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[t.key],r="Home"===t.key?0:"End"===t.key?u.length-1:void 0!==n?(e+n+u.length)%u.length:null;null!==r&&(t.preventDefault(),g(r,!0))};return t.addEventListener("pointermove",n),t.addEventListener("pointerdown",r),t.addEventListener("click",r),t.addEventListener("focus",o),t.addEventListener("keydown",i),()=>{t.removeEventListener("pointermove",n),t.removeEventListener("pointerdown",r),t.removeEventListener("click",r),t.removeEventListener("focus",o),t.removeEventListener("keydown",i)}}),S=()=>{w(),v=0};t.addEventListener("pointerleave",S),en("ascii-kit-accordion",'\n:where([data-ascii-accordion]){display:flex;gap:6px}\n:where(.ascii-acc-panel){position:relative;flex:calc(1 + 3.2 * var(--ascii-acc-open, 0)) 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;-webkit-tap-highlight-color:transparent}\n:where(.ascii-acc-panel[aria-expanded="true"]){cursor:default}\n:where(.ascii-acc-photo){position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:var(--ascii-acc-photo, 0);scale:calc(1.04 - .04 * var(--ascii-acc-open, 0))}\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:var(--ascii-acc-caption, 0);translate:0 calc(6px - 6px * var(--ascii-acc-caption, 0))}\n:where(.ascii-acc-title){font-size:15px;font-weight:500}\n:where(.ascii-acc-meta){font-size:14px;opacity:.8}\n'),t.dataset.asciiAccordion="",h&&(t.dataset.asciiField="");const A=t.getAttribute("role"),C=t.getAttribute("aria-label");return A||t.setAttribute("role","group"),C||t.setAttribute("aria-label",n.current.label),u.forEach((e,n)=>{f(e,l[n].x),t.appendChild(e)}),m(),u.forEach((t,e)=>{const n=t.querySelector("img");n&&Xe(n).then(t=>{c[e]=t,d[e]=h?_e(t,!h.dark()):null,h?.kick()},()=>{})}),mt(()=>h,n,e=>{C||t.setAttribute("aria-label",e.label),h?.refresh()},{select:g,get open(){return a}},()=>{k.forEach(t=>t()),w(),s&&cancelAnimationFrame(s),t.removeEventListener("pointerleave",S),u.forEach(t=>t.remove()),delete t.dataset.asciiAccordion,delete t.dataset.asciiField,A||t.removeAttribute("role"),C||t.removeAttribute("aria-label"),r.restore()})},exports.artPanel=function(t,e={}){const n={current:{...e}},r=lt(),o=t.querySelector("img"),a=n.current.image??o??null;let i=null;i=a?xe({host:t,look:()=>{const t=n.current;return{mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.3,levels:"auto",fit:"cover",focus:t.focus??{x:.5,y:.4},hover:"trail",trail:{strength:.95,radius:.42},clear:!!t.clear&&{element:t.clear,padding:8,feather:.12,shape:"rect"},...t.look}},ink:()=>n.current.ink??"--ascii-ink-strong",source:a,label:n.current.label??(a instanceof HTMLImageElement&&a.alt||void 0),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{i=null,r.restore()}}):null,i&&o&&a===o&&r.set(o,"opacity","0");let s=0,l=!1;return ye(()=>i,n,()=>{},{pulse:(t,e=1)=>{i&&!i.still()&&Me(i.field,t,e)},shimmer:t=>{const e=i?.field;if(!e||t===l||t&&i.still())return;const n=++s;l=t,t?(async()=>{let t;try{t=await(async()=>{if(a instanceof HTMLImageElement)return a.complete||await a.decode(),a;const t=new Image;return t.crossOrigin="anonymous",t.src=a,await t.decode(),t})()}catch{return}const r=Math.min(1,1400/Math.max(t.naturalWidth,t.naturalHeight,1)),o=Object.assign(document.createElement("canvas"),{width:Math.max(1,Math.round(t.naturalWidth*r)),height:Math.max(1,Math.round(t.naturalHeight*r))}),l=o.getContext("2d"),c=o.width,d=o.height,h=performance.now();for(;n===s&&i?.field===e;){const n=performance.now(),r=-.4*c+1.8*((n-h)/1100%1)*c;l.globalCompositeOperation="source-over",l.drawImage(t,0,0,c,d);const a=l.createLinearGradient(r-.22*c,.3*r,r+.22*c,.3*r+.3*d);a.addColorStop(0,"rgb(0 0 0 / 0)"),a.addColorStop(.5,"rgb(255 255 255 / .42)"),a.addColorStop(1,"rgb(0 0 0 / 0)"),l.globalCompositeOperation="lighter",l.fillStyle=a,l.fillRect(0,0,c,d),await e.setSource(o),await ge(Math.max(0,48-(performance.now()-n)))}})():e.setSource(a)}},()=>{s++,r.restore()})},exports.asciiVideo=function(t,e={}){const n={current:{...e}},r=lt(),o=[],a=t.querySelector("video"),i=n.current.src??a??null,s=()=>n.current.reducedMotion??tt();let l=null,c=0;l=i?xe({host:t,layer:"over",look:()=>({mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.25,levels:"auto",fit:"cover",focus:{x:.5,y:.5},hover:"trail",trail:{strength:.9,radius:.35},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",source:i,label:n.current.label??"Video, drawn in characters",kit:n,ownPoster:!0,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{l=null,r.restore(),f()},onRelease:()=>{h=!1,u(),i instanceof HTMLVideoElement&&i.pause?.()},onMount:()=>{c++&&(l?.field.ready.then(()=>{h=!0,u()}),m&&i instanceof HTMLVideoElement&&i.play?.()?.catch?.(()=>{}))}}):null,l&&i instanceof HTMLVideoElement&&(t.contains(i)&&r.set(i,"opacity","0"),i.muted=!0,i.loop=!0,i.playsInline=!0);let d=null;n.current.poster&&i&&(d=Object.assign(document.createElement("img"),{alt:"",decoding:"async"}),d.className="ascii-video-poster",d.setAttribute("aria-hidden","true"),d.setAttribute("style",`${ze};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 h=!1;const u=()=>{d&&(d.style.opacity=l&&h&&(m||!s())?"0":"1")};let p=null;function f(){!p&&i&&(i instanceof HTMLVideoElement?p=i:(p=document.createElement("video"),p.src=i,p.setAttribute("style",ze),p.setAttribute("aria-label",n.current.label??"Video"),"static"===getComputedStyle(t).position&&r.set(t,"position","relative"),d?t.insertBefore(p,d):t.appendChild(p),o.push(p)),n.current.poster&&!p.poster&&(p.poster=n.current.poster),p.muted=!0,p.loop=!0,p.playsInline=!0,d&&(d.style.opacity="0"),m&&p.play?.()?.catch?.(()=>{}))}let m=n.current.autoplay??!(l?l.still():s());l?(l.field.ready.then(()=>{h=!0,m||l?.field.pause(),u()}),m&&i instanceof HTMLVideoElement&&i.play?.()?.catch?.(()=>{}),u()):f();const g=ye(()=>l,n,t=>{d&&t.poster&&d.getAttribute("src")!==t.poster&&(d.src=t.poster),p&&t.poster&&(p.poster=t.poster)},{toggle:()=>(m?g.pause():g.play(),m),get playing(){return m}},()=>{o.forEach(t=>t.remove()),r.restore()}),x=g.play,y=g.pause;return g.play=()=>{l&&!g.supported||(m=!0,l?x():p?.play?.()?.catch?.(()=>{}),u())},g.pause=()=>{l&&!g.supported||(m=!1,l?y():p?.pause?.(),u())},g},exports.aurora=Rr,exports.background=function(t,e){if(!e||!e.preset||"function"!=typeof e.preset.mount)throw new TypeError("background() needs a preset, such as `aurora` imported from asciify-engine/kit.");const n=e.preset;let r=e.poster;const o=t=>({...t,poster:t.preset===n?r:void 0}),a={current:o({...e})};let i=null,s=!1,l=!1;const c=new Set,d=()=>{const t=a.current,e=t.preset;return{speed:ar(t.speed,e.speed,0,5),cellSize:ar(t.cellSize,e.cellSize,3,96),charset:ir(t.charset),cursor:"none"!==t.look?.hover&&(t.cursor??e.cursor),mark:"glyph"===t.mark||"dot"===t.mark?t.mark:void 0,clear:t.clear??!1,dither:ar(t.dither,0,0,1),accent:t.accent,text:t.text?.trim()||"ASCIIFY",look:t.look}},h=t=>{const e=a.current,n=e.palette;return("string"==typeof n?n:n?.[t?"dark":"light"])??e.color??e.ink},u=()=>String(ar(a.current.opacity,a.current.preset.opacity??1,0,1)),p=()=>!!(a.current.reducedMotion??tt()),f=e=>{let n=null;if(n=a.current.preset.mount({host:t,kit:a,settings:d,ink:h,reducedMotion:()=>a.current.reducedMotion,onFail:()=>{i===n&&(i=null)}}),!n)return null;const r=n.canvas.style;return e&&(r.opacity="0",r.transition="opacity 320ms cubic-bezier(.16, 1, .3, 1)",n.canvas.offsetWidth),r.opacity=u(),s&&n.pause(),n},m={position:t.style.getPropertyValue("position"),isolation:t.style.getPropertyValue("isolation")},g=(e,n)=>{n?t.style.setProperty(e,n):t.style.removeProperty(e)};let x=!1;const y=e=>{x=!0,e.destroy(),i&&!l&&("function"==typeof getComputedStyle&&"static"===getComputedStyle(t).position&&t.style.setProperty("position","relative"),t.style.setProperty("isolation","isolate"))},v=t=>{if(l||!t||"function"!=typeof t.mount||t===a.current.preset)return;a.current=o({...a.current,preset:t});const e=i;i=f(!!e&&!p()),e&&(t=>{if(p())return void y(t);t.canvas.style.transition="opacity 320ms cubic-bezier(.16, 1, .3, 1)",t.canvas.style.opacity="0";const e={run:t,timer:setTimeout(()=>{c.delete(e),y(t)},340)};c.add(e)})(e)};return i=f(!1),{get supported(){return!!i&&!l},get field(){return l?null:i?.field??null},get preset(){return a.current.preset},update(t){if(l||!t)return;const{preset:e,...n}=t;"poster"in n&&(r=n.poster),a.current=o(ht(a.current,n)),n.poster&&a.current.poster&&G(a,n.poster),e&&e!==a.current.preset?v(e):i&&(i.canvas.style.opacity=u(),i.refresh())},play(){!l&&s&&(s=!1,i?.play())},pause(){l||(s=!0,i?.pause())},setPreset:v,destroy(){if(!l){l=!0;for(const t of c)clearTimeout(t.timer),t.run.destroy(),x=!0;c.clear(),i?.destroy(),i=null,x&&(g("position",m.position),g("isolation",m.isolation)),D(a)}}}},exports.backgroundCharset=ir,exports.beam=function(t,e={}){const n={current:{...xt,...e}};let r="idle",o=0,a=kt(n.current.palette),i=!1;const s=()=>"mono"===n.current.palette,l=()=>({..."glyphs"===n.current.grain?{mark:"glyph",charset:" ·.:-+*",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.6,glyphScale:1}:{mark:"dot",cellSize:3.5,cellAspect:1,dotScale:.82},color:s()?"ink":"source",saturation:1.25,shade:.55,contrast:2.4,brightness:.58,...n.current.look}),c=t=>{const e=!t.dark();t.canvas.style.opacity=e?"0.72":"",t.canvas.style.filter=e&&!s()?"brightness(1.45) saturate(.9)":""};let d=null,h=null,u=new Uint8Array(0),p="",f=0,m=null,g=0,x=.62,y=0,v=0,M=0,b=0,w=0,k=0;const S={rotate:0,pulse:0,progress:0};S[n.current.mode]=1;let A=null;A=ft({host:t,look:l,ink:t=>n.current.ink??(t?"#b3b1aa":"#8a8882"),kit:n,reducedMotion:()=>n.current.reducedMotion,onTheme:()=>A&&c(A),onFail:()=>{A=null},resolution:(t,e)=>[Math.max(1,Math.round(t)),Math.max(1,Math.round(e))],paint:e=>{const{pen:s,w:c,h:C,now:E,still:$,dark:L}=e,z=n.current,P=getComputedStyle(t),R=Math.min(t.clientWidth||c,t.clientHeight||C),F=Math.max(2,Math.min(z.depth,Math.min(parseFloat(P.paddingTop)||z.depth,parseFloat(P.paddingLeft)||z.depth)-2)),T=[P.borderTopLeftRadius,P.borderTopRightRadius,P.borderBottomRightRadius,P.borderBottomLeftRadius].map(t=>((t,e)=>t.endsWith("%")?parseFloat(t)/100*e:parseFloat(t)||0)(t??"",R)),I=l(),W="dot"!==I.mark,B=I.cellSize??(W?5:3.5),O=I.cellAspect??(W?.6:1),q=`${c}x${C}:${z.grain}:${F}:${T.join(",")}:${B}:${O}`;if(q!==p){p=q,A.canvas.style.clipPath=`inset(0 round ${T.map(t=>`${t}px`).join(" ")})`;const t=Math.min(globalThis.devicePixelRatio||1,I.maxPixelRatio??2),e=Math.max(2,Math.round(B*t)),n=Math.max(2,Math.round(e*O))/t,r=e/t;d=function(t,e,n,r,o,a,i){const s=Math.ceil(t/n),l=t/2,c=e/2,d=Math.min(l,c),[h,u,p,f]=[0,1,2,3].map(t=>Math.max(0,Math.min(a[t]??a[0]??0,d))),m=new Int32Array(s*Math.ceil(e/r)).fill(-1),g=[],x=[],y=[];for(let t=0;t<m.length;t++){const e=(t%s+.5)*n-l,a=(Math.floor(t/s)+.5)*r-c,d=e<0?a<0?h:f:a<0?u:p,v=Math.abs(e)-l+d,M=Math.abs(a)-c+d,b=-(Math.hypot(Math.max(v,0),Math.max(M,0))+Math.min(Math.max(v,M),0)-d),w=b>0?Math.min(Math.max(0,1-b/Math.max(1,o))**1.7,b/Math.max(.1,i)):0;if(w<.004)continue;m[t]=g.length,g.push(w);const k=Math.atan2(a/Math.max(1,c),e/Math.max(1,l))/(2*Math.PI)+.25,S=k-Math.floor(k);x.push(S),y.push(.78*J(Math.floor(46*S),5)+.22*J(t,9))}const v=Math.max(1,Math.round(t)),M=Math.max(1,Math.round(e)),b=[],w=[];for(let t=0;t<M;t++)for(let e=0;e<v;e++){const o=m[Math.min(s-1,Math.floor((e+.5)/n))+s*Math.floor((t+.5)/r)];o>=0&&(b.push(t*v+e),w.push(o))}return{W:v,H:M,weight:Float32Array.from(g),turn:Float32Array.from(x),crack:Float32Array.from(y),pixel:Int32Array.from(b),owner:Int32Array.from(w)}}(c,C,n,r,F,T,W?Math.min(n,r)/2:(I.dotScale??.82)*n/2),h=s.createImageData(d.W,d.H),u=new Uint8Array(3*d.weight.length)}const N=d,H=h.data,G=N.crack,D=(t,e,n,r,o)=>{u.fill(0);for(let i=0;i<N.weight.length;i++){const s=N.turn[i],l=_(N.weight[i]*t(s,i))*(L?1.12:.8);if(l<.03)continue;const c=4*(255&Math.floor(((s-e)%1+1)%1*256));let d=a[c],h=a[c+1],p=a[c+2],f=a[c+3];const m=o&&L?o(s):0;(r>0||n>0||m>0)&&(r>0&&(d+=(wt[0]-d)*r,h+=(wt[1]-h)*r,p+=(wt[2]-p)*r),n>0&&(d+=(bt[0]-d)*n,h+=(bt[1]-h)*n,p+=(bt[2]-p)*n),m>0&&(d+=(1-d)*m,h+=(1-h)*m,p+=(1-p)*m),f=.2126*d+.7152*h+.0722*p);const g=255*Math.min(1,(l+.12)/2.4/Math.max(f,.01));u[3*i]=d*g,u[3*i+1]=h*g,u[3*i+2]=p*g}H.fill(0);for(let t=0;t<N.pixel.length;t++){const e=4*N.pixel[t],n=3*N.owner[t];H[e]=u[n],H[e+1]=u[n+1],H[e+2]=u[n+2],H[e+3]=255}s.putImageData(h,0,0)};if($){const t="progress"===z.mode?t=>"running"===r||"error"===r?Ct(t,o):.14:t=>("running"===r?.75:.55)*(.7+.3*Math.cos(2*Math.PI*(t-.12)));return"success"===r?D(()=>.62,0,0,.9):"error"===r?D((e,n)=>.5*t(e)*Et(G[n],1),0,.9,0):D(t,0,0,0),!1}const j=f?Math.min(48,E-f):16;f=E,r!==m&&("running"===r&&"running"!==m&&(w=0),g=E,m=r);let U=E-g;"success"===r&&U>2700&&(r=m="idle",o=0,g=E,U=0);const X="running"===r,Y="error"===r,V="success"===r,K=z.hover&&i;for(const t of yt)S[t]+=((t===z.mode?1:0)-S[t])*(1-Math.exp(-j/260));if(Y)v=0;else{const t=(X?1500-500*o:"pulse"===z.mode?9e3:2600)/Math.max(.05,z.speed);v+=(1/t*(K?1.35:1)-v)*(1-Math.exp(-j/320)),x+=v*j,k+=j,y+=j/("pulse"===z.mode?14e3:26e3)*(1-S.progress),(X||V)&&(w+=((V?1:o)-w)*(1-Math.exp(-j/110)))}M+=((K?1:0)-M)*(1-Math.exp(-j/220)),b=Y?.9*Q(0,60,U):b*Math.exp(-j/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=X||V||Y,rt=t=>Z*(S.rotate*At(t-x)+S.pulse*(X||Y?At(t-x):tt*(.78+.22*Math.cos(2*Math.PI*(t-x))))+S.progress*(nt?Ct(t,w):et));if(V){const t=Q(0,260,U),e=_((U-240)/620),n=1-Q(860,1060,U),r=Q(780,1e3,U),o=Q(1350,2450,U),a=(L?.86:.55)*t*(1-r)+.62*r*(1-o),i=1-t*(1-Q(1900,2700,U)*(1-S.progress)),s=t=>{if(U<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 D(t=>Math.max(rt(t)*i,a*(.9+.1*Math.cos(2*Math.PI*(t-.1))),1.3*s(t),S.progress*et*o),y,0,.9*r*(1-o),t=>_(.8*s(t))),!0}if(Y){const t=U<90?1.2:U<170?.1:U<260?1.2:U<340?.1:1,e=Q(380,1150,U),n=1-.5*Q(700,1500,U),r=Math.floor(U/50);return D((o,a)=>{const i=Et(G[a],e);return i<=0?0:rt(o)*t*i*n*(1-1.4*e*(1-e)*J(a,r))},y,b,0),U<1600||Math.abs(M-(K?1:0))>.01}return D(rt,y,b,0),!0}});const C=()=>{i||(i=!0,A?.kick())},E=()=>{i=!1,A?.kick()},$=t=>{i=t.target?.matches?.(":focus-visible")??!1,A?.kick()};A&&(c(A),t.addEventListener("pointerenter",C),t.addEventListener("pointermove",C),t.addEventListener("pointerleave",E),t.addEventListener("focusin",$),t.addEventListener("focusout",E));const L=t=>{r=t,A?.kick()};return mt(()=>A,n,t=>{a=kt(t.palette),A?.refresh(),A&&c(A)},{progress(t){o=_(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",E),t.removeEventListener("focusin",$),t.removeEventListener("focusout",E)})},exports.beamPalette=kt,exports.blockChart=function(t,e={}){const n={current:{...wn,...e}};let r=n.current.values,o=null,a=[],i=0,s=!1,l=null,c=!1===n.current.intro?-1e9:performance.now(),d=[],h=[],u=[],p={cols:0,rows:0};const f=()=>n.current.values??[],m=()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:7,cellAspect:1,glyphScale:1.1,shade:.5,blend:"off",...n.current.look}),g=(t,e)=>{const{cellSize:n=7,maxPixelRatio:r=2}=m(),o=Math.min("number"==typeof devicePixelRatio&&devicePixelRatio>0?devicePixelRatio:1,r),a=Math.max(2,Math.round(n*o)),i=a/o,s=t=>{const e=Math.max(1,Math.floor(t*o/a));for(let t=e;t>1&&t>e-8;t--)if(Math.abs(t*i-Math.round(t*i))<.01)return t;return e},l=s(t),c=Math.max(2,s(e));return{cols:l,rows:c,cell:i,gw:Math.round(l*i),gh:Math.round(c*i)}};let x={left:0,cell:0};const y=(t,e)=>null===o?t===e-1?.8:kn:t===o?.8:.3,v=(t,e)=>Z((e-c-(h[t]??0))/n.current.duration),M=(t,e,r,o)=>{const a=((t,e,r,o)=>{const{bar:a,gap:i,left:s}=Sn(r,e.length),l=n.current.max??1.04*Math.max(...e,0),c=l>0?_(Math.max(0,e[t])/l)*(o-1):0,d=s+t*(a+i);return{x0:d,x1:d+a,h:c>0?Math.max(1,Math.round(c)):0}})(t,e,p.cols,p.rows);if(o)return a;const i=d[t]??{...a,h:0},s=v(t,r);return{x0:i.x0+(a.x0-i.x0)*s,x1:i.x1+(a.x1-i.x1)*s,h:i.h+(a.h-i.h)*s}};l=ft({host:t,look:m,ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:(t,e)=>{const{cell:n}=g(t,e);return[Math.max(2,2*Math.round(t/n)),Math.max(4,2*Math.round(e/n))]},onFail:()=>{l=null},paint:({pen:e,width:r,height:o,now:s,still:d})=>{const h=(()=>{const e=l?.canvas;if(!e||!t.offsetWidth)return!1;const{gw:n,gh:r,cell:o}=g(t.offsetWidth,t.offsetHeight),a=Math.round((t.offsetWidth-n)/2),i=[`${a}px`,t.offsetHeight-r+"px",`${n}px`,`${r}px`];x={left:a,cell:o};let s=!1;return["left","top","width","height"].forEach((t,n)=>{e.style[t]!==i[n]&&(e.style[t]=i[n],s=!0)}),s&&l?.field.resize(),s})(),m=r/2,b=o/2;p={cols:m,rows:b};const w=f(),k=w.length,S=i?Math.min(64,s-i):16;i=s;const A=new Float32Array(m*b),C=(t,e,n)=>{const r=(b-1-e)*m+t;n>A[r]&&(A[r]=n)};for(let t=0;t<m;t++)C(t,0,.16);const E=({x0:t,x1:e,h:n},r)=>{if(n<=.01)return;const o=Math.ceil(n)-1;for(let a=Math.max(0,Math.floor(t));a<Math.min(m,Math.ceil(e));a++){const i=_(Math.min(a+1,e)-Math.max(a,t));for(let t=0;t<=o&&t<b-1;t++)C(a,t+1,(t===o?Math.min(1,r+.2):r)*i*_(n-t))}};let $=!1;const L=d?1:Z((s-c)/n.current.duration);L<1&&($=!0);for(const t of u)E({...t,h:t.h*(1-L)},kn);L>=1&&(u=[]);for(let t=0;t<k;t++){!d&&v(t,s)<1&&($=!0);const e=y(t,k),n=a[t]??e;a[t]=d?e:n+(e-n)*(1-Math.exp(-S/70)),Math.abs(a[t]-e)>.004&&($=!0),E(M(t,w,s,d),a[t])}for(let t=0;t<A.length;t++){if(A[t]<=0)continue;const n=Math.round(255*A[t]);e.fillStyle=`rgb(${n} ${n} ${n})`,e.fillRect(t%m*2,2*Math.floor(t/m),2,2)}return h&&d&&l?.kick(),$||h}});const b=lt(),w=l?null:document.createElement("div"),k=()=>{if(!w)return;const t=f(),e=t.length,r=n.current.max??1.04*Math.max(...t,0);w.replaceChildren(...t.map((t,n)=>{const o=document.createElement("div");return o.setAttribute("style",`flex:1 1 0;height:${r>0?(100*_(t/r)).toFixed(2):0}%;margin:0 ${e<=7?22:18}%;background:currentColor;opacity:${.9*(.16+.84*y(n,e))}`),o}))};w&&("static"===getComputedStyle(t).position&&b.set(t,"position","relative"),w.setAttribute("aria-hidden","true"),w.setAttribute("style","position:absolute;inset:0;display:flex;align-items:flex-end;pointer-events:none"),t.appendChild(w));const S=document.createElement("table");S.setAttribute("style","position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0");const A=()=>{const t=n.current.format??(t=>t.toLocaleString()),e=n.current.labels??[],r=document.createElement("tbody");f().forEach((n,o)=>{const a=document.createElement("tr"),i=document.createElement("th"),s=document.createElement("td");i.setAttribute("scope","row"),i.setAttribute("style","font-weight:inherit"),i.textContent=e[o]??String(o+1),s.textContent=t(n),a.appendChild(i),a.appendChild(s),r.appendChild(a)}),S.replaceChildren(r)};A(),t.appendChild(S);const C=!t.hasAttribute("tabindex"),E=!t.hasAttribute("role");C&&(t.tabIndex=0),E&&t.setAttribute("role","group");const $=t=>{const e=f().length,r=null!==t&&e?Math.min(e-1,Math.max(0,Math.round(t))):null;r!==o&&(o=r,l?.kick(),k(),n.current.onHover?.(o,null===o?null:f()[o],null===o?null:n.current.labels?.[o]??null))},L=t=>n.current.stagger??(t<=7?45:12),z=(t,e)=>{const o=f(),i=n.current.labels,s=performance.now(),m=!!l?.still(),g=p.cols&&!m?t.map((e,n)=>M(n,t,s,!1)):[],x=m?[]:u.map(t=>({...t,h:t.h*(1-Z((s-c)/n.current.duration))})),y=new Map,v=(t,n,r)=>i&&e?r?.[t]??`#${t}`:"#"+(n-1-t);t.forEach((n,r)=>y.set(v(r,t.length,e),r));const b=new Set,w=a;let S=0;const A=o.length;d=o.map((t,e)=>{const n=y.get(v(e,A,i));return void 0!==n&&g[n]?(b.add(n),g[n]):null}),a=o.map((t,e)=>{const n=y.get(v(e,A,i));return void 0!==n?w[n]??kn:kn}),h=d.map(t=>t?0:S++*L(A)*.6),u=[...x,...g.filter((t,e)=>!b.has(e))].filter(t=>t.h>.01),r=o,c=s,l?.kick(),k()};k();const P=e=>{const n=t.getBoundingClientRect(),r=f().length;if(!n.width)return;const o=(e.clientX-n.left)/n.width,a=e.clientY-n.top;if(o<0||o>1||a<0||a>n.height)return void $(null);if(!p.cols)return void $(((t,e)=>e?Math.min(e-1,Math.max(0,Math.floor(t*e))):-1)(o,r));const{bar:i,gap:s,left:l}=Sn(p.cols,r);$(Math.round(((e.clientX-n.left-x.left)/x.cell-l-i/2)/Math.max(1,i+s)))},R=()=>$(null),F=t=>{const e=f().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(),$(n))};t.addEventListener("pointermove",P),t.addEventListener("pointerdown",P),t.addEventListener("pointerleave",R),t.addEventListener("pointercancel",R),t.addEventListener("keydown",F),t.addEventListener("blur",R);const T="function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{t?.isIntersecting&&!s&&(s=!0,!1!==n.current.intro&&(()=>{const t=f().length;r=f(),c=performance.now(),d=[],u=[],h=Array.from({length:t},(e,n)=>n*L(t)),a=f().map((t,e,n)=>y(e,n.length)),l?.kick(),k()})())},{threshold:.4}):null;T?.observe(t);let I=n.current.labels;return mt(()=>l,n,t=>{A(),t.values!==r&&(z(r,I),I=t.labels),l?.refresh()},{set(t,e){const a=r,i=I;n.current={...n.current,values:[...t],...e?{labels:[...e]}:{}},I=n.current.labels,null!==o&&o>=t.length&&$(null),A(),z(a,i)},highlight:$,get active(){return o},get values(){return f()}},()=>{T?.disconnect(),S.remove(),w?.remove(),b.restore(),t.removeEventListener("pointermove",P),t.removeEventListener("pointerdown",P),t.removeEventListener("pointerleave",R),t.removeEventListener("pointercancel",R),t.removeEventListener("keydown",F),t.removeEventListener("blur",R),C&&t.removeAttribute("tabindex"),E&&t.removeAttribute("role")})},exports.buttonLoading=function(e,n={}){const r={current:{...Rt,...n}},o=lt(),a=r.current.label??e,i=r.current.text??(a.textContent??"").trim(),s=[...a.childNodes],l=void 0!==r.current.icon?r.current.icon:i?null:e.querySelector("svg"),c=e.getAttribute("aria-label");let d="idle",h=i,u=-1e9,p=0,f=null,m={cw:9,ch:15,cellSize:15};const g=ct(i),x=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 v=()=>{const t=Math.min(globalThis.devicePixelRatio||1,2);m=function(t,e){const n=Math.max(3,3*Math.round(t*e/3));return{cw:n/3*2/e,ch:n/e,cellSize:n/e}}(parseFloat(getComputedStyle(a).fontSize)||15,t)},M=()=>{if(l)return x.replaceChildren(),f&&x.appendChild(f.canvas),x.style.width=`${m.cw}px`,void(x.style.height=`${m.ch}px`);const t=[...h];for(const t of[...x.children])"SPAN"===t.tagName&&t.remove();const n=f&&f.canvas.parentElement===x?f.canvas:null;for(const[e,r]of t.entries()){const t=document.createElement("span");t.textContent=r,t.setAttribute("style",`position:absolute;top:0;left:${e*m.cw}px;width:${m.cw}px;height:${m.ch}px;line-height:${m.ch}px;text-align:center`),n?x.insertBefore(t,n):x.appendChild(t)}f&&!n&&x.appendChild(f.canvas),x.style.width=t.length*m.cw+"px",x.style.height=`${m.ch}px`,g.textContent=h,p=Math.max(p,e.offsetWidth),p&&o.set(e,"min-width",`${p}px`)},b="undefined"!=typeof document&&t.isGlyphFieldSupported();if(b){v(),x.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"),x.setAttribute("style",t),y.setAttribute("style",`${t};display:grid;place-items:center;opacity:0;scale:.5`),e.appendChild(x),e.appendChild(y)):(x.setAttribute("style","display:inline-block;vertical-align:middle;position:relative;white-space:pre"),y.setAttribute("style","display:inline-grid;place-items:center;vertical-align:middle;overflow:hidden;width:0;opacity:0;scale:.5"),a.replaceChildren(g,y,x)),M()}f=b?ft({host:x,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:m.cellSize,cellAspect:2/3,glyphScale:.94,...r.current.look}),ink:()=>r.current.ink??getComputedStyle(a).color,kit:r,reducedMotion:()=>r.current.reducedMotion,resolution:(t,e)=>[Math.max(2,2*Math.round(t/m.cw)),Math.max(3,3*Math.round(e/m.ch))],onFail:()=>{f=null,x.remove(),y.remove(),o.restore(),l||(a.replaceChildren(...s),a.textContent=h)},paint:({pen:t,now:e,still:n})=>{const r=e-u;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=[...x.children].filter(t=>"SPAN"===t.tagName);let a="loading"===d&&!n;for(let e=0;e<o.length;e++){const i=n?0:Ft(e,r,o.length,"loading"===d,n,h.length);r<24*o.length+170&&(a=!0);const s=" "===h[e];if(o[e].style.visibility=i&&!s?"hidden":"",!i||s)continue;const l=Math.round(i/9*255);t.fillStyle=`rgb(${l} ${l} ${l})`,t.fillRect(2*e,0,2,3)}return a}}):null,b&&!f&&(x.remove(),y.remove(),l||a.replaceChildren(...s),o.restore());const w=(t,n)=>{d=t,h=l?"":n,e.dataset.state=t,"loading"===t?e.setAttribute("aria-busy","true"):e.removeAttribute("aria-busy"),l&&null!==c&&e.setAttribute("aria-label","idle"===t?c:n),r.current.announce&&(r.current.announce.textContent="idle"===t?"":n),f?(u=performance.now(),((t,e)=>{const n=e?"none":`opacity 160ms ${Tt} ${t?120:0}ms, scale 240ms ${Tt} ${t?120:0}ms`;if(y.style.transition=n,y.style.opacity=t?"1":"0",y.style.scale=t?"1":".5",l||(y.style.width=t?"1.1em":"0",y.style.marginRight=t?".45em":"0"),l&&"style"in l){const t="idle"!==d&&"error"!==d;o.set(l,"transition",n.replace(/ 120ms/g,"")),o.set(l,"opacity",t?e&&"loading"===d?".4":"0":"1"),o.set(l,"scale",t&&!e?".6":"1")}})(!("success"!==t||!l&&!r.current.check),f.still()),M(),f.kick(),"error"===t&&r.current.shake&&!f.still()&&"function"==typeof e.animate&&e.animate([{translate:"0"},{translate:"-4px 0"},{translate:"4px 0"},{translate:"-2px 0"},{translate:"0"}],{duration:280,easing:Tt})):l||(a.textContent=n)};return mt(()=>f,r,()=>{f&&(v(),M(),f.refresh())},{start(t=(l?c??"":`${i}…`)){w("loading",t)},succeed(t="Done"){w("success",t)},fail(t="Retry"){w("error",t)},reset(t=(l?c??"":i)){w("idle",t)},get state(){return d}},()=>{f&&(x.remove(),y.remove(),l||a.replaceChildren(...s)),l&&null!==c&&e.setAttribute("aria-label",c),delete e.dataset.state,e.removeAttribute("aria-busy"),o.restore()})},exports.cascade=zr,exports.caustics=Sr,exports.circuit=oo,exports.codeInput=function(t,e={}){const n={current:{...Bn,...e}},r=lt(),o=lt(),a=[],i=()=>!!(n.current.reducedMotion??tt()),s=()=>Math.max(1,Math.round(n.current.length));let l="",c="idle",d=!1,h=[],u="",p=-1e9,f="",m=-1e9,g=[],x=[],y=0,v=null;const M=new Map;"static"===getComputedStyle(t).position&&r.set(t,"position","relative");let b=t.querySelector("input");b||(b=document.createElement("input"),b.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(b),a.push(b));const w=b;w.setAttribute("inputmode","digits"===n.current.accept?"numeric":"text"),w.setAttribute("autocomplete","one-time-code"),w.setAttribute("maxlength",String(s())),"digits"===n.current.accept&&w.setAttribute("pattern","[0-9]*"),w.hasAttribute("aria-label")||w.hasAttribute("aria-labelledby")||w.setAttribute("aria-label",`Verification code, ${s()} ${"digits"===n.current.accept?"digits":"characters"}`);const k=()=>{const e=[...t.querySelectorAll(n.current.cells)];for(;e.length<s();){const n=document.createElement("span");n.dataset.cell="",n.setAttribute("aria-hidden","true"),w.parentElement===t?t.insertBefore(n,w):t.appendChild(n),a.push(n),e.push(n)}return e.slice(0,s())},S=t=>{let e=t.querySelector("[data-digit]");return e||(e=document.createElement("span"),e.dataset.digit="",t.appendChild(e),a.push(e)),e},A=(t,e,n,r,o,a,i,s=1,l=0,c=0,d=1)=>{const h=((t,e,n,r)=>{const o=`${t}|${Math.round(e)}x${Math.round(n)}|${r}`;let a=M.get(o);if(!a){a=document.createElement("canvas"),a.width=Math.max(2,Math.round(2*e)),a.height=Math.max(2,Math.round(2*n));const i=a.getContext("2d");i&&(i.scale(2,2),i.fillStyle="#fff",i.shadowColor="#fff",i.shadowBlur=3,i.font=`600 ${Math.round(.6*n)}px ${r}`,i.textAlign="center",i.textBaseline="middle",i.fillText(t,e/2,n/2+1)),M.set(o,a)}return a})(e,n.w,n.h,i);t.globalAlpha=s;const u=n.w*d,p=n.h*d,f=n.x+(n.w-u)/2+l,m=n.y+(n.h-p)/2+c;for(let e=0;e<n.h;e+=4)for(let i=0;i<n.w;i+=3){if(J(i+31*a,e)>1.3*r-.12)continue;const n=3*(1-r);t.drawImage(h,2*i,2*e,6,8,f+i*d+(J(i,e+o)-.5)*n,m+e*d+(J(e,i+o)-.5)*n,3*d,4*d)}t.globalAlpha=1},C=(t,e)=>{t.toggleAttribute("data-shown",e),o.set(S(t),"opacity",e?"1":"0")};v=ft({host:t,outset:16,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.92,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{v=null,o.restore(),k().forEach(t=>C(t,!0))},paint:({pen:e,w:n,h:r,now:o,still:a,box:i})=>{e.setTransform(2,0,0,2,0,0);const s=k(),x=a?0:Math.floor(o/110),y=getComputedStyle(t).fontFamily||"sans-serif";if("success"===c){const t=a?1:(o-m)/700,i=n/2,l=r/2;if(s.forEach(t=>C(t,!1)),t<.55){const n=(t/.55)**2;g.forEach((t,r)=>f[r]&&A(e,f[r],t,1,x,r,y,1-n**3,(i-t.x-t.w/2)*n,(l-t.y-t.h/2)*n,1-.65*n))}const c=_((t-.45)/.55);return c>0&&c<1&&(e.strokeStyle=qn(.55*(1-c)),e.lineWidth=3,e.beginPath(),e.arc(i,l,18+44*(t=>1-(1-_(t))**3)(c),0,2*Math.PI),e.stroke()),((t,e,n,r)=>{if(r<=0)return;const o=[[e-20,n+1],[e-7,n+14],[e+21,n-14]],a=Math.hypot(13,13),i=Math.hypot(28,28);let s=r*(a+i);t.strokeStyle="#fff",t.lineWidth=8,t.lineCap="round",t.lineJoin="round",t.shadowColor="#fff",t.shadowBlur=4,t.beginPath(),t.moveTo(o[0][0],o[0][1]);const l=Math.min(1,s/a);if(t.lineTo(o[0][0]+(o[1][0]-o[0][0])*l,o[0][1]+(o[1][1]-o[0][1])*l),s-=a,s>0){const e=Math.min(1,s/i);t.lineTo(o[1][0]+(o[2][0]-o[1][0])*e,o[1][1]+(o[2][1]-o[1][1])*e)}t.stroke(),t.shadowBlur=0})(e,i,l+1,Z(_((t-.4)/.45))),t<1}let v=!1;const M=o-p;return s.forEach((t,n)=>{const r=i(t),s=l[n];if(M<On&&u[n])return C(t,!1),A(e,u[n],r,1-M/On,x,n,y),void(v=!0);if(s){const i=a?1:(o-h[n])/300;if(C(t,i>=.7),i>=1)return;return v=!0,void(i>0&&A(e,s,r,i,x,n,y,i>.7?1-(i-.7)/.3:1))}if(C(t,!1),d&&n===l.length&&M>=On){const t=a?.6:.5-.5*Math.cos(o/1600*Math.PI*2);e.fillStyle=qn(.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(),v=!0}}),v}});const E=(t,e)=>{x.push(setTimeout(e,t))},$=()=>{x.forEach(clearTimeout),x=[]},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),v||C(t,!0),"success"===c&&v?(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),v?.kick()},z=t=>{$(),"idle"!==c&&(c="idle",m=-1e9),u="",p=-1e9;const e=((t,e,n="digits")=>("digits"===n?t.replace(/\D/g,""):t.replace(/[^a-z\d]/gi,"").toUpperCase()).slice(0,e))(t,s(),n.current.accept),r=performance.now();let o=0;for(let t=0;t<e.length;t++)e[t]!==l[t]&&(h[t]=i()?-1e9:r+y*o++);l=e,L(),e.length===s()&&E(i()||!v?0:300+y*Math.max(0,o-1)+80,()=>n.current.onComplete?.(e)),y=0},P=()=>z(w.value),R=()=>{y=55},F=()=>{d=!0,L()},T=()=>{d=!1,L()};return w.addEventListener("input",P),w.addEventListener("paste",R),w.addEventListener("focus",F),w.addEventListener("blur",T),w.value?z(w.value):L(),mt(()=>v,n,()=>{w.setAttribute("maxlength",String(s())),L(),v?.refresh()},{verify:e=>{$();const n=performance.now();if(e)return f=l,g=v?k().map(t=>v.box(t)):[],m=n,c="success",void L();u=l,p=i()||!v?n-On:n,c="error",L(),i()||"function"!=typeof t.animate||t.animate([{translate:"0"},{translate:"-9px"},{translate:"7px"},{translate:"-4px"},{translate:"2px"},{translate:"0"}],{duration:380,easing:"ease-out"});const r=l;E(i()||!v?0:On,()=>{u===r&&(u="",l="",L())})},clear:()=>{$(),u="",p=-1e9,m=-1e9,l="",c="idle",L()},fill(t){y=55,z(t)},get value(){return l},get state(){return c}},()=>{$(),w.removeEventListener("input",P),w.removeEventListener("paste",R),w.removeEventListener("focus",F),w.removeEventListener("blur",T),o.restore(),r.restore();for(const t of a)t.remove();for(const e of t.querySelectorAll(n.current.cells))e.removeAttribute("data-shown"),e.removeAttribute("data-active");delete t.dataset.state})},exports.commandPalette=function(t,e={}){const n={current:{...nn,...e}},r=lt(),o=()=>[...t.querySelectorAll(n.current.rows)],a=()=>t.querySelector(n.current.input),i=lt();let s=n.current.open??!t.hasAttribute("hidden"),l=0,c=null,d=!1,h=0,u=null,p=[],f=null,m=0,g=0;const x=new WeakMap,y=()=>!!(n.current.reducedMotion??tt());en("ascii-kit-command",ln),"static"===getComputedStyle(t).position&&i.set(t,"position","relative"),i.set(t,"isolation","isolate");const v=document.createElement("div");v.setAttribute("aria-hidden","true"),v.dataset.asciiCmdHighlight="",n.current.highlight&&t.insertBefore(v,t.firstElementChild);const M=e=>{if(void 0===e.offsetParent)return dt(t,e);let n=0,r=0;for(let o=e;o&&o!==t;o=o.offsetParent)n+=o.offsetLeft,r+=o.offsetTop;for(let o=e.parentElement;o&&o!==t;o=o.parentElement)n-=o.scrollLeft,r-=o.scrollTop;return{x:n,y:r,w:e.offsetWidth,h:e.offsetHeight}},b=t=>{const e=o()[l];if(!v.parentElement)return;if(!e||!s)return void delete v.dataset.on;const n=M(e),r=!t||void 0===v.dataset.on||y();r&&(v.style.transition="none"),v.style.translate=`${n.x}px ${n.y}px`,v.style.width=`${n.w}px`,v.style.height=`${n.h}px`,v.style.borderRadius=getComputedStyle(e).borderTopLeftRadius,v.dataset.on="",r&&(v.offsetWidth,v.style.removeProperty("transition"))};let w=null;const k=lt();u=ft({host:t,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{u=null},paint:({pen:e,now:r,still:a,box:i})=>{if(e.setTransform(2,0,0,2,0,0),c){const t=c,n=(r-t.start)/(t.closing?rn:260);if(!(n>=1||a)){const r=t.closing?1-1.02*Z(n):1.04*Z(n);return Ue(e,t.snap,t.blocks,t.order,r,(e,n)=>[(t.ox-e.x)*n*.9,(t.oy-e.y)*n*.9],t.closing?1:1-_((n-.72)/.28),.4),!0}c=null}if(!s||d)return!1;let h=!1;p=p.filter(n=>{const o=(r-n.start)/280;return(o>=.7||a)&&n.styles.restore(),o>=1||a||!t.contains(n.row)?(n.styles.restore(),!1):(h=!0,o>0&&Ue(e,n.snap,n.blocks,n.order,1.04*Z(o),(t,e)=>[14*e,0],1-_((o-.7)/.3),.42),!0)});const x=o()[l];if(x&&!a&&x.matches(n.current.ai)){x!==f&&(f=x,m=r+160);const n=r-m,o=n>=0?n%on/1100:-1;if(o>=0&&o<1&&!p.some(t=>t.row===x))((e,n,r,o,a)=>{const i=u,s=`${n.textContent}|${r.x}|${r.y}|${r.w}`;if(w?.row!==n||w.key!==s){const e=De(n,i.box,i.canvas.clientWidth||t.offsetWidth,i.canvas.clientHeight||t.offsetHeight,2);w={row:n,key:s,snap:e,blocks:je(e,2)}}const l=r.x-an+(r.w+80)*(t=>t<.5?4*t**3:1-(-2*t+2)**3/2)(o),c=Math.floor(a/70);for(const t of w.blocks){const n=(t.x+2-l)/an;if(n<=-1||n>=1)continue;const r=1-n*n;J(t.x+c,t.y)>.35+.65*r||(e.globalAlpha=Math.min(1,1.6*r),e.drawImage(w.snap,2*t.x,2*t.y,8,12,t.x,t.y,4,6))}e.globalAlpha=1;const d=l-r.x;k.set(n,"mask-image",`linear-gradient(90deg, #000 ${d-an}px, transparent ${d-14}px, transparent ${d+14}px, #000 ${d+an}px)`)})(e,x,i(x),o,r),h=!0;else{if(k.restore(),h)return!0;g&&clearTimeout(g);const t=n>=0?on-n%on:-n;g=setTimeout(()=>{g=0,u?.kick()},Math.max(16,t))}}else f=null,k.restore();return h}}),u&&(t.dataset.gpu="");const S=(t=!0)=>{const e=o();if(l=e.length?Math.min(Math.max(0,l),e.length-1):0,b(t),!n.current.manage)return;e.forEach((t,e)=>t.setAttribute("aria-selected",String(e===l)));const r=a(),i=e[l]?.id;r&&i&&r.setAttribute("aria-activedescendant",i)},A=()=>`inset(0 round ${getComputedStyle(t).borderTopLeftRadius||"0px"})`,C=()=>{const e=n.current.trigger,r=t.offsetWidth,o=t.offsetHeight;if(!e)return`inset(0 ${Math.max(0,r/2-40)}px ${Math.max(0,o-36)}px round 18px)`;const a=dt(t,e);return`inset(${a.y}px ${r-a.x-a.w}px ${o-a.y-a.h}px ${a.x}px round ${a.h/2}px)`},E=e=>{const r=u;if(!r)return;const o=t.offsetWidth,a=t.offsetHeight,i=De(t,r.box,o,a,2),s=je(i,2),l=n.current.trigger,d=l?r.box(l):{x:o/2,y:0,w:0,h:0},h=d.x+d.w/2,p=d.y+d.h/2,f=Math.hypot(o,a)||1;c={snap:i,blocks:s,order:Float32Array.from(s,t=>Math.hypot(t.x-h,t.y-p)/f*.7+.3*t.seed),ox:h,oy:p,start:performance.now(),closing:e},r.kick()},$=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()},L=(e,n,r="none")=>"function"!=typeof t.animate?null:t.animate(e.map(t=>({clipPath:t})),{duration:n,easing:sn,fill:r}),z=()=>{h&&clearTimeout(h),h=0},P=(e=!0)=>{!s||d?(z(),s=!0,d=!1,l=0,t.removeAttribute("hidden"),t.dataset.open="",n.current.trigger?.setAttribute("aria-expanded","true"),S(!1),(()=>{for(const t of o())x.set(t,M(t).y)})(),e&&a()?.focus({preventScroll:!0}),n.current.onOpenChange?.(!0),y()?u?.kick():(t.dataset.state="opening",L([C(),A()],260),u&&(d=!0,$(!0),E(!1)),h=setTimeout(()=>{h=0,delete t.dataset.state,d=!1,$(!1),u?.kick()},143))):e&&a()?.focus({preventScroll:!0})},R=()=>{if(!s)return;z();const e=t.contains(document.activeElement),r=()=>{h=0,d=!1,s=!1,c=null,delete t.dataset.state,delete t.dataset.open,$(!1),b(!1);for(const t of p)t.styles.restore();p=[],k.restore(),w=null,t.setAttribute("hidden",""),n.current.trigger?.setAttribute("aria-expanded","false"),e&&n.current.trigger?.focus({preventScroll:!0}),u?.kick(),n.current.onOpenChange?.(!1)};if(y())return void r();d=!0,t.dataset.state="closing",u&&(E(!0),$(!0));const o=L([A(),C()],rn,"forwards"),a="function"==typeof t.animate?t.animate([{opacity:1},{opacity:1,offset:.4},{opacity:0}],{duration:rn,fill:"forwards"}):null;h=setTimeout(()=>{r(),o?.cancel(),a?.cancel()},rn)},F=t=>{const e=o().length;e&&(l=(Math.round(t)%e+e)%e,S(),u?.kick())},T=(t=l)=>{const e=o()[t];if(!e||d)return;F(t),u?.field.pulse({element:e,strength:.6}),e.matches(n.current.ai)&&(f=e,m=performance.now()),e.dataset.run="",n.current.onRun?.(t,e);const r=()=>{delete e.dataset.run,n.current.closeOnRun&&R()};y()?r():setTimeout(r,240)},I=t=>{if(!n.current.manage)return;const e=o().length;if("Escape"===t.key&&s)return t.preventDefault(),t.stopPropagation(),void R();if(t.target!==a()&&!o().includes(t.target))return;const r="ArrowDown"===t.key?l+1:"ArrowUp"===t.key?l-1:"Home"===t.key?0:"End"===t.key?e-1:null;if(null!==r)return t.preventDefault(),void F(r);"Enter"===t.key&&(t.preventDefault(),T())},W=t=>{const e=t.target?.closest?.(n.current.rows);return e?o().indexOf(e):-1},B=t=>{if(!n.current.manage)return;const e=W(t);e<0||e!==l&&F(e)},O=t=>{if(!n.current.manage)return;const e=W(t);e>=0&&T(e)},q=()=>{n.current.manage&&(l=0,S(!1))},N="function"==typeof MutationObserver?new MutationObserver(()=>{s&&(S(!1),(()=>{const e=u,n=o(),r=n.filter(t=>{const e=M(t).y,n=x.get(t);return x.set(t,e),void 0===n||Math.abs(n-e)>1});for(const t of p)n.includes(t.row)&&!r.includes(t.row)||t.styles.restore();if(p=p.filter(t=>n.includes(t.row)&&!r.includes(t.row)),!e||!e.live||e.still()||d||!s)return;const a=e.canvas.clientWidth||t.offsetWidth,i=e.canvas.clientHeight||t.offsetHeight,l=performance.now();r.forEach((t,n)=>{const r=De(t,e.box,a,i,2),o=je(r,2);if(!o.length)return;const s=Math.min(...o.map(t=>t.x)),c=Math.max(1,Math.max(...o.map(t=>t.x))-s),d=lt();for(const e of[...t.children])d.set(e,"opacity","0");p.push({row:t,snap:r,blocks:o,order:Float32Array.from(o,t=>(t.x-s)/c*.72+.28*t.seed),start:l+28*n,styles:d})}),e.kick()})())}):null;N?.observe(t,{childList:!0,subtree:!0});const H="function"==typeof ResizeObserver?new ResizeObserver(()=>b(!1)):null;H?.observe(t);const G=()=>{s?R():P(!0)},D=t=>{const e=n.current.hotkey;e&&t.key?.toLowerCase()===e.toLowerCase()&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),s?document.activeElement===a()?R():a()?.focus():P(!0))},j=e=>{if(!n.current.manage||!s||d)return;const r=e.target;t.contains(r)||n.current.trigger?.contains(r)||R()};t.addEventListener("keydown",I),t.addEventListener("pointermove",B),t.addEventListener("click",O),t.addEventListener("input",q);const U=n.current.trigger;return U?.addEventListener("click",G),U?.setAttribute("aria-expanded",String(s)),U?.setAttribute("aria-haspopup","dialog"),document.addEventListener("keydown",D),document.addEventListener("pointerdown",j),s?t.dataset.open="":t.setAttribute("hidden",""),S(),mt(()=>u,n,()=>{S(),u?.refresh()},{open:P,close:R,select:F,run:T,toggle(){s?R():P(!0)},get isOpen(){return s},get selected(){return l}},()=>{z(),g&&clearTimeout(g),$(!1);for(const t of p)t.styles.restore();k.restore(),N?.disconnect(),H?.disconnect(),v.remove(),i.restore(),t.removeEventListener("keydown",I),t.removeEventListener("pointermove",B),t.removeEventListener("click",O),t.removeEventListener("input",q),U?.removeEventListener("click",G),document.removeEventListener("keydown",D),document.removeEventListener("pointerdown",j),delete t.dataset.gpu,delete t.dataset.state})},exports.compare=function(t,e){const n={current:{position:50,...e}},r=lt();let o=_(n.current.position,0,100),a=null,i=null,s={from:o,to:o,at:-1e9},l=0,c=!1;const d=[];let h=n.current.position;i=ft({host:t,layer:"under",look:()=>({blend:"coarse",mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:600,cellSize:6,cellAspect:.8,glyphScale:.96,color:"source",levels:"auto",saturation:1.3,contrast:1.45,gamma:.85,brightness:.14,hover:"trail",trail:{strength:.7,radius:.3},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:(t,e)=>{const n=Math.min(1600,Math.max(2,Math.round(2*t)));return[n,Math.max(2,Math.round(n*e/Math.max(1,t)))]},onFail:()=>{i=null},paint:({pen:t,width:e,height:n})=>(t.imageSmoothingQuality="high",a&&Ve(t,a,0,0,e,n),!1)});const u="string"==typeof n.current.image?Ye(n.current.image):n.current.image,p=t.querySelector('[role="slider"]'),f=t.querySelector("[data-compare-line]"),m=p??document.createElement("div"),g=f??document.createElement("span"),x=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`)},v=(t,e=!1)=>{if(t=_(t,0,100),!i)return void(o=t);if(l&&(cancelAnimationFrame(l),l=0),!e||i.still()||Math.abs(t-o)<.5)return o=t,y(),void n.current.onChange?.(o);s={from:o,to:t,at:performance.now()};const r=t=>{const e=_((t-s.at)/280);o=s.from+(s.to-s.from)*Z(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},b=e=>{if(0!==e.button)return;t.setPointerCapture?.(e.pointerId),c=!0,t.dataset.dragging="";const n=M(e.clientX);v(n,Math.abs(n-o)>3),m.focus({preventScroll:!0})},w=t=>{c&&v(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(),v(n,!0))};let A=()=>{};if(i){en("ascii-kit-compare","\n:where(.ascii-compare-photo){position:absolute;inset:0;width:100%;height:100%;object-fit:cover;pointer-events:none;clip-path:inset(0 calc(100% - var(--ascii-pos, 50%)) 0 0)}\n:where(.ascii-compare-line){position:absolute;top:0;bottom:0;left:var(--ascii-pos, 50%);width:2px;translate:-50% 0;background:#fff;box-shadow:0 0 0 .5px rgb(0 0 0 / .25),0 0 12px rgb(0 0 0 / .45);pointer-events:none}\n:where(.ascii-compare-handle){position:absolute;top:50%;left:var(--ascii-pos, 50%);display:grid;place-items:center;width:40px;height:40px;translate:-50% -50%;border-radius:50%;background:#fff;color:#111;box-shadow:0 0 0 1px rgb(0 0 0 / .08),0 4px 14px rgb(0 0 0 / .4);cursor:grab;touch-action:none}\n:where(.ascii-compare-handle:focus-visible){outline:2px solid #fff;outline-offset:3px}\n"),r.set(t,"overflow","hidden"),r.set(t,"touch-action","pan-y"),r.set(t,"user-select","none"),r.set(t,"cursor","ew-resize");const e={className:u.className,hidden:u.getAttribute("aria-hidden")};A=()=>{u.className=e.className,null===e.hidden?u.removeAttribute("aria-hidden"):u.setAttribute("aria-hidden",e.hidden)},u.className=(e.className?`${e.className} `:"")+"ascii-compare-photo",u.setAttribute("aria-hidden","true"),u.draggable=!1,f||(g.className="ascii-compare-line",g.setAttribute("aria-hidden","true")),p||(m.className="ascii-compare-handle",m.innerHTML='<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 7-5 5 5 5M15 7l5 5-5 5"/></svg>',m.setAttribute("role","slider"),m.tabIndex=0),x(n.current.label),m.setAttribute("aria-valuemin","0"),m.setAttribute("aria-valuemax","100"),m.setAttribute("aria-orientation","horizontal");for(const e of[u,g,m])t.contains(e)||(t.appendChild(e),d.push(e));y(),t.addEventListener("pointerdown",b),t.addEventListener("pointermove",w),t.addEventListener("pointerup",k),t.addEventListener("pointercancel",k),m.addEventListener("keydown",S),Xe(u).then(t=>{a=t,i?.kick()},()=>{})}else t.contains(u)||("static"===getComputedStyle(t).position&&r.set(t,"position","relative"),u.setAttribute("style","position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit"),t.appendChild(u),d.push(u));return mt(()=>i,n,t=>{x(t.label),t.position!==h&&(h=t.position,v(t.position,!0)),i?.refresh()},{set:v,get position(){return o}},()=>{l&&cancelAnimationFrame(l),t.removeEventListener("pointerdown",b),t.removeEventListener("pointermove",w),t.removeEventListener("pointerup",k),t.removeEventListener("pointercancel",k),m.removeEventListener("keydown",S),delete t.dataset.dragging,d.forEach(t=>t.remove()),A(),r.restore()})},exports.constellation=Pr,exports.contour=Ar,exports.decode=function(t,e={}){const n={current:{...$t,...e}},r=lt(),o=document.createElement("canvas"),a=document.createElement("canvas");let i=-1,s="",l=!1,c=!1,d=null;const h=(e,r)=>{const a=`${e}x${r}:${n.current.text??""}:${t.textContent}`;if(a===s)return;s=a,o.width=e,o.height=r;const i=o.getContext("2d");i.fillStyle="#000",i.fillRect(0,0,e,r),void 0!==n.current.text?function(t,e,n,r,o){const a=getComputedStyle(e),i=n.split("\n");t.fillStyle="#fff",t.textAlign="center",t.textBaseline="middle";const s=(parseFloat(a.letterSpacing)||0)/(parseFloat(a.fontSize)||16),l=e=>{"letterSpacing"in t&&(t.letterSpacing=s*e+"px")};t.font=`${a.fontWeight} 100px ${a.fontFamily}`,l(0);const c=Math.max(1,...i.map(e=>t.measureText(e).width)),d=Math.min(.94*r/c*100,.9*o/i.length);t.font=`${a.fontWeight} ${d}px ${a.fontFamily}`,l(d),i.forEach((e,n)=>t.fillText(e,r/2,o/2+(n-(i.length-1)/2)*d*1.04))}(i,t,n.current.text,e,r):function(t,e,n,r){const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),a=document.createRange();t.fillStyle="#fff",t.textAlign="left",t.textBaseline="alphabetic";for(let e=o.nextNode();e;e=o.nextNode()){const o=e.parentElement;if(!o)continue;const i=getComputedStyle(o);t.font=`${i.fontStyle} ${i.fontWeight} ${parseFloat(i.fontSize)*r}px ${i.fontFamily}`,"letterSpacing"in t&&(t.letterSpacing=(parseFloat(i.letterSpacing)||0)*r+"px");const s=t.measureText("Hg"),l=s.fontBoundingBoxAscent||parseFloat(i.fontSize)*r*.8,c=s.fontBoundingBoxDescent||parseFloat(i.fontSize)*r*.2,d="uppercase"===i.textTransform?t=>t.toUpperCase():"lowercase"===i.textTransform?t=>t.toLowerCase():t=>t;for(const o of e.data.matchAll(/\S+/g)){a.setStart(e,o.index),a.setEnd(e,o.index+o[0].length);const i=a.getClientRects()[0];if(!i)continue;const s=(i.top-n.top)*r,h=i.height*r;t.fillText(d(o[0]),(i.left-n.left)*r,s+(h-l-c)/2+l)}}a.detach?.()}(i,t,t.getBoundingClientRect(),e/(t.getBoundingClientRect().width||1))};d=ft({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})=>{h(e,r);const p=n.current,f="text"===p.settle;if(i<0||d)return!(!c&&"visible"===p.trigger&&!d)&&(f&&i>=0||t.drawImage(o,0,0),i>=0&&u(),!1);const m=s-i,g=.3*p.duration,x=.7*p.duration,y=Math.max(2,Math.ceil(e/20)),v=Math.max(2,Math.ceil(r/20));if(a.width===y&&a.height===v||(a.width=y,a.height=v),Lt(a,m/1e3),t.imageSmoothingEnabled=!0,m<g)return t.drawImage(a,0,0,e,r),l&&(t.globalAlpha=1-Z(m/g),t.drawImage(o,0,0),t.globalAlpha=1),!0;const M=Math.min(1,(m-g)/x),b=(1.18*M-.02)*e,w=.14*e,k=5.58,S=Math.floor(s/16);if(M>=1)return f||t.drawImage(o,0,0),u(),!1;t.drawImage(a,0,0,e,r),b>0&&t.drawImage(o,0,0,b,r,0,0,b,r);for(let e=Math.max(0,Math.floor(b/k)*k);e<b+w;e+=k){const n=(e-b)/w;for(let a=0;a<r;a+=9)J(e+13*S,a)<n||(t.globalAlpha=.35+.65*J(a+7*S,e),t.fillStyle="#000",t.fillRect(e,a,k,9),t.drawImage(o,e,a,k,9,e,a,k,9))}return t.globalAlpha=1,!0}});const u=()=>{i=-1,l="text"!==n.current.settle,l||r.restore()},p=()=>{d&&(r.set(t,"-webkit-text-fill-color","transparent"),c=!0,i=performance.now(),d.kick())};let f=!1;const m=d&&"visible"===n.current.trigger&&"function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{t.isIntersecting&&!f&&p(),f=t.isIntersecting},{threshold:.5}):null;d&&("text"!==n.current.settle&&r.set(t,"-webkit-text-fill-color","transparent"),l="text"!==n.current.settle&&"manual"===n.current.trigger,m?m.observe(t):"visible"===n.current.trigger&&p());let g=!1;const x=()=>{g||(g=!0,n.current.replayOnHover&&i<0&&p())},y=()=>{g=!1},v=e=>{!g||e.target instanceof Node&&t.contains(e.target)||(g=!1)};return d&&(t.addEventListener("pointerenter",x),t.addEventListener("pointermove",x),t.addEventListener("pointerleave",y),document.addEventListener("pointermove",v,!0)),d&&document.fonts?.ready.then(()=>{s="",d?.kick()}),mt(()=>d,n,()=>{s="",d?.refresh()},{replay:p},()=>{m?.disconnect(),t.removeEventListener("pointerenter",x),t.removeEventListener("pointermove",x),t.removeEventListener("pointerleave",y),document.removeEventListener("pointermove",v,!0),r.restore()})},exports.disintegrate=function(t,e={}){const n=er.get(t);if(n)return n;const r={...Zn,...e},o=lt(),a=t.offsetHeight,i=()=>{for(const e of t.children)o.set(e,"opacity","0");o.set(t,"color","transparent"),o.set(t,"pointer-events","none"),t.setAttribute("aria-hidden","true")},s=e=>{r.collapse&&(o.set(t,"box-sizing","border-box"),o.set(t,"overflow","hidden"),o.set(t,"min-height","0"),o.set(t,"height",`${(a*(1-e)).toFixed(2)}px`),e>=1&&(o.set(t,"padding-block","0"),o.set(t,"margin-block","0"),o.set(t,"border-width","0")))},l=r.host??t.parentElement??t;let c=0,d=!1,h=null,u={x:0,y:0,w:0,h:0},p=()=>{};const f=ft({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:()=>p(),paint:({pen:t,now:e,still:n,scale:o})=>{if(n)return queueMicrotask(p),!1;if(!h||!d)return!1;const a=e-c,i=_(a/r.duration);t.setTransform(o,0,0,o,0,0),a>=300&&s(Z(_((a-300)/260))),t.save(),t.globalAlpha=_(2.2*(1-i))*(1-.9*i*i),t.translate(8*i,-14*i),t.drawImage(h,0,0,h.width/2,h.height/2),t.globalCompositeOperation="destination-out";const l=u.x+u.w,f=l-(1.3*i-.3)*u.w,m=l-1.3*i*u.w,g=t.createLinearGradient(m,0,Math.max(m+1,f),0);g.addColorStop(0,"rgba(0,0,0,0)"),g.addColorStop(1,"rgba(0,0,0,1)"),t.globalAlpha=1,t.fillStyle=g,t.fillRect(u.x-tr,u.y-tr,u.w+32,u.h+32),t.restore();const x=a>=Math.max(r.duration,r.collapse?560:0);return x&&queueMicrotask(p),!x}}),m=new Promise(e=>{let n=!1;if(p=()=>{n||(n=!0,f?.destroy(),s(1),r.remove&&t.remove(),er.delete(t),e())},!f||f.still())return i(),void p();u=f.box(t),h=Ze(t,f.canvas.clientWidth||u.w+32,f.canvas.clientHeight||u.h+32,f.box).canvas;f.field.ready.then(()=>{n||d||(i(),d=!0,c=performance.now(),f.kick())},()=>{i(),p()})});return er.set(t,m),m},exports.dna=ao,exports.drift=xr,exports.dropzone=function(t,e={}){const n={current:{...Qn,...e}};let r="empty",o=null,a="",i="",s="image",l=0,c=0,d=!1,h=0,u=0,p=0,f=0,m=null,g=null,x=null,y=null,v=null;const M=ct("",!0),b=["left","top","width","height"],w=()=>{const e=y?.canvas;if(!e||!t.offsetWidth)return null;const n="empty"===r?function(t,e,n=Math.min(2,"number"==typeof devicePixelRatio&&devicePixelRatio>0?devicePixelRatio:1)){const r=Math.max(2,Math.round(6*n)),o=Math.max(2,Math.round(1*r)),a=(t,e)=>{const r=Math.floor(t*n/e);for(let t=r;t>1;t--){const o=t*e/n;if(Math.abs(o-Math.round(o))<.01||t<r-8)return{n:t,css:Math.round(o)}}return{n:1,css:Math.round(e/n)}},i=a(t,o),s=a(e,r);return{cols:i.n,rows:s.n,w:i.css,h:s.css,cw:o/n,ch:r/n}}(t.offsetWidth,t.offsetHeight):null,o=n?[`${Math.round((t.offsetWidth-n.w)/2)}px`,`${Math.round((t.offsetHeight-n.h)/2)}px`,`${n.w}px`,`${n.h}px`]:["0px","0px","100%","100%"];let a=!1;return b.forEach((t,n)=>{e.style[t]!==o[n]&&(e.style[t]=o[n],a=!0)}),v=n,a?(y?.field.resize(),y?.kick(),null):n},k=document.createElement("input"),S=[M,k];let A=null;const C=!t.children.length;y=ft({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}:{blend:"coarse",mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:6,cellAspect:.8,glyphScale:.8,background:st(t)?"transparent":"#0b0b0a",color:"source",saturation:1.15,contrast:1.15,levels:"auto",brightness:.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&&v?[2*v.cols,2*v.rows]:[Math.max(1,Math.round(t)),Math.max(1,Math.round(e))],onFail:()=>{y=null,a&&L(a)},paint:({pen:e,w:a,h:i,now:s,still:c})=>{if("empty"!==r){if(!o)return!1;const t=c?1:_((s-l)/n.current.develop),d=1-(1-t)**2;return Ve(e,o,0,0,a,i),"developing"===r&&d<1&&function(t,e,n,r,o){const a=Math.max(Math.hypot(r.x,r.y),Math.hypot(e-r.x,r.y),Math.hypot(r.x,n-r.y),Math.hypot(e-r.x,n-r.y)),i=Math.max(24,.22*Math.min(e,n)),s=o*(a+i),l=Math.max(0,s-i),c=t.createRadialGradient(r.x,r.y,l,r.x,r.y,Math.max(l+1,s));c.addColorStop(0,"rgb(0 0 0 / 0)"),c.addColorStop(1,"rgb(0 0 0 / 1)"),t.globalCompositeOperation="source-over",t.fillStyle=c,t.fillRect(0,0,e,n);const d=t.createRadialGradient(r.x,r.y,l,r.x,r.y,Math.max(l+1,s)),h=1-o*o;d.addColorStop(0,"rgb(255 255 255 / 0)"),d.addColorStop(.55,`rgb(255 255 255 / ${.5*h})`),d.addColorStop(1,"rgb(255 255 255 / 0)"),t.globalCompositeOperation="lighter",t.fillStyle=d,t.fillRect(0,0,e,n),t.globalCompositeOperation="source-over"}(e,a,i,x??{x:a/2,y:i/2},d),t>=1&&"developing"===r&&$(),t<1}const h=p?Math.min(64,s-p):16;p=s;const m=d?1:0;u=c?m:u+(m-u)*(1-Math.exp(-h/90)),!c&&u>.004&&(f+=h/1e3*14);const v=Math.max(4,(parseFloat(getComputedStyle(t).borderTopLeftRadius)||16)-6),M=w();if(M){const t=y.canvas.getBoundingClientRect(),n=g&&t.width?{x:(g.x-t.left)/t.width*M.cols,y:(g.y-t.top)/t.height*M.rows}:null;!function(t,e,n,r){const{cols:o,rows:a}=e,i=t.createImageData(2*o,2*a),s=i.data,{tone:l,glow:c=0,phase:d=0,near:h=null}=r,u=Math.max(1,n/e.cw),p=Math.max(1,n/e.ch),f=o-2,m=a-2,g=Math.max(0,f-1-2*u),x=Math.max(0,m-1-2*p),y=Math.PI/4*(u+p),v=.45*Math.hypot(o,a);for(let t=0;t<a;t++)for(let e=0;e<o;e++){const n=Math.max(1+u-e,0,e-(f-u)),r=Math.max(1+p-t,0,t-(m-p));let a;if(n>0&&r>0){const t=Math.hypot(n/u,r/p);a=Math.hypot(n,r)*(1-1/t)}else a=-Math.min(e-1,f-e,t-1,m-t);let i=0;if(Math.abs(a)<.5){if(i=l,c>0){const o=e>f-u,a=t>m-p,s=e<1+u,h=t<1+p,v=(t,e)=>Math.atan2(t,e)/(Math.PI/2);let M;M=!h||s||o?h&&o?g+y*v(n/u,r/p):!o||h||a?a&&o?g+y+x+y*v(r/p,n/u):a&&!s?g+2*y+x+(f-u-e):a&&s?2*g+2*y+x+y*v(n/u,r/p):s&&!h?2*g+3*y+x+(m-p-t):2*g+3*y+2*x+y*v(r/p,n/u):g+y+(t-(1+p)):e-(1+u);const b=((M-d)%9+9)%9;i=l+c*(.2+.32*Math.max(0,1-Math.abs(b-4.5)/2.2))}}else c>0&&a<-.5&&a>-3.5&&(i=c*(1-(-a-.5)/3)**1.6*(.1+.32*(h?Math.max(0,1-Math.hypot(e-h.x,t-h.y)/v):.4)));const M=Math.round(255*Math.min(1,i));for(let n=0;n<4;n++){const r=4*((2*t+(n>>1))*o*2+2*e+(1&n));s[r]=s[r+1]=s[r+2]=M,s[r+3]=255}}t.putImageData(i,0,0)}(e,M,v,{tone:.3,glow:u,phase:f,near:n})}const b=!c&&(d||Math.abs(m-u)>.004);return b||(p=0),b}});const E=e=>{const o=r;r=e,t.dataset.state=e,"empty"===o!=("empty"===e)&&(w(),y?.refresh()),o!==e&&n.current.onState?.(e,"empty"===e?"":s)},$=()=>{E("done"),M.textContent=`${s} ready`,o&&n.current.onImage?.({file:m,src:a,width:o.width,height:o.height})};function L(e){A??(A=Object.assign(document.createElement("img"),{className:"ascii-drop-img",alt:""})),A.src=e,A.parentElement!==t&&(t.prepend(A),S.push(A))}const z=async(t,e=null,n=null)=>{const d=++c;let h;x=n,i&&URL.revokeObjectURL(i),i="string"==typeof t?"":URL.createObjectURL(t),a=i||t,m=e??("undefined"!=typeof File&&t instanceof File?t:null),s=m?.name??("string"==typeof t&&t.split("/").pop()?.split("?")[0]||"image"),M.textContent=`Converting ${s}`;try{h=await Xe(Ye(a))}catch{return void(d===c&&(M.textContent=`Could not load ${s}`))}if(d===c){if(o=h,!y)return L(a),E("done"),void $();l=performance.now(),E(y.still()?"done":"developing"),y.field.pulse({strength:1}),y.kick(),"done"===r&&$()}},P=(t,e=null)=>{const r=e=>{M.textContent=e,n.current.onError?.(e,t)};return t.type.startsWith("image/")?t.size>n.current.maxBytes?r(`${t.name} is over ${Math.round(n.current.maxBytes/1024/1024)} MB.`):void z(t,t,e):r(`${t.name} isn’t an image.`)},R=()=>{c++,o=null,a="",m=null,i&&URL.revokeObjectURL(i),i="",A?.remove(),E("empty"),M.textContent="",y?.kick()},F=()=>k.click(),T=e=>new Promise(a=>{const i=y?.field;if(!i||!o||"done"!==r)return void a(null);const l=document.createElement("canvas");l.width=i.canvas.width,l.height=i.canvas.height;const c=l.getContext("2d");c?(c.fillStyle=getComputedStyle(t).backgroundColor||"#000",c.fillRect(0,0,l.width,l.height),i.redraw(),c.drawImage(i.canvas,0,0),l.toBlob(t=>{if(t){const r=document.createElement("a");r.href=URL.createObjectURL(t),r.download=e??n.current.filename??`${s.replace(/\.[^.]+$/,"")}-ascii.png`,r.click(),setTimeout(()=>URL.revokeObjectURL(r.href),1e3)}a(t)},"image/png")):a(null)}),I=()=>{p=0,y?.kick()},W=e=>{e.preventDefault(),h++,g={x:e.clientX,y:e.clientY},d||(d=!0,t.dataset.over="",I())},B=t=>{t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="copy"),g={x:t.clientX,y:t.clientY}},O=()=>{h=Math.max(0,h-1),!h&&d&&(d=!1,g=null,delete t.dataset.over,I())},q=e=>{e.preventDefault(),h=0,d=!1,g=null,delete t.dataset.over;const n=t.getBoundingClientRect(),r={x:e.clientX-n.left,y:e.clientY-n.top};y?.field.pulse({...r,strength:1});const o=e.dataTransfer?.files?.[0];o?P(o,r):I()},N=t=>{const e=t.target?.closest?.("[data-dropzone]")?.getAttribute("data-dropzone");"pick"===e?F():"clear"===e?R():"download"===e&&T()},H=()=>{const t=k.files?.[0];k.value="",t&&P(t)};en("ascii-kit-dropzone",'\n:where(.ascii-drop-empty){position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;height:100%;min-height:inherit;padding:24px;box-sizing:border-box;text-align:center}\n:where([data-ascii-dropzone]:not([data-state="empty"])) :where(.ascii-drop-empty){display:none}\n:where(.ascii-drop-title){margin:0;font-weight:500}\n:where(.ascii-drop-hint){margin:0;font-size:14px;opacity:.65}\n:where(.ascii-drop-pick){margin-top:8px;height:34px;padding:0 14px;border:0;border-radius:999px;background:currentColor;font:inherit;font-size:14px;cursor:pointer}\n:where(.ascii-drop-pick) > span{color:Canvas}\n:where(.ascii-drop-img){position:absolute;inset:0;width:100%;height:100%;object-fit:cover}\n'),t.dataset.asciiDropzone="",k.type="file",k.accept="image/*",k.tabIndex=-1,k.hidden=!0,k.setAttribute("aria-hidden","true"),C&&S.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 S)t.appendChild(e);return E("empty"),t.addEventListener("dragenter",W),t.addEventListener("dragover",B),t.addEventListener("dragleave",O),t.addEventListener("drop",q),t.addEventListener("click",N),k.addEventListener("change",H),mt(()=>y,n,()=>y?.refresh(),{setImage:t=>z(t),clear:R,pick:F,download:T,get state(){return r}},()=>{c++,i&&URL.revokeObjectURL(i),t.removeEventListener("dragenter",W),t.removeEventListener("dragover",B),t.removeEventListener("dragleave",O),t.removeEventListener("drop",q),t.removeEventListener("click",N),k.removeEventListener("change",H),S.forEach(t=>t.remove()),delete t.dataset.asciiDropzone,delete t.dataset.state,delete t.dataset.over})},exports.dune=lo,exports.etch=ho,exports.facet=po,exports.fieldBackground=function(t,e={}){const n={current:{...be,...e}},r=()=>"notFound"===n.current.preset;let o=0,a=!1,i=0;const s={x:-1e4,y:-1e4,at:-1e6},l=()=>function(t){const e=document.createElement("canvas").getContext("2d");e.font=ke;const n=Math.max(320,Math.ceil(e.measureText(t).width)+160),{canvas:r,pen:o}=ve(n,560);return o.fillStyle="#fff",o.textAlign="center",o.textBaseline="middle",o.font=ke,o.letterSpacing="-10px",o.fillText(t,n/2,296),r}(n.current.text);let c=null;c=xe({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?Ce:"brand"===t.preset?Ae({scale:Se()?1.4:1.6,brightness:.24,contrast:1.1,clear:r(.3)}):Ae({scale:Se()?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?.(ke).then(()=>{c&&r()&&!a&&c.field.setSource(l())},()=>{});const d=(t,e=1.4)=>{c&&!c.still()&&(i=performance.now()+1400,Me(c.field,t,e))},h=t=>{const e=n.current,o=performance.now();!c||r()||!e.ripple||c.still()||o<i||o-s.at<520||Math.hypot(t.clientX-s.x,t.clientY-s.y)<36||(Object.assign(s,{x:t.clientX,y:t.clientY,at:o}),Me(c.field,{x:t.clientX,y:t.clientY},.65))};c&&t.addEventListener("pointermove",h);let u=n.current.preset,p=n.current.text;return ye(()=>c,n,t=>{c&&((t.preset!==u||"notFound"===t.preset&&t.text!==p)&&(o++,a=!1,c.field.setSource("notFound"===t.preset?l():null)),u=t.preset,p=t.text)},{pulse:d,scatter:async t=>{const e=c?.field;if(!e)return;if(!r())return void d(t);if(t&&d(t,1.2),a||c.still())return;a=!0;const n=++o,i=l(),s=function(t){const e=t.getContext("2d").getImageData(0,0,t.width,t.height).data,n=[];for(let r=0;r<t.height;r+=we)for(let o=0;o<t.width;o+=we){let a=!1;for(let n=0;n<we&&!a;n+=4)for(let i=0;i<we&&!a;i+=4)a=(e[4*((r+n)*t.width+o+i)]??0)>40;if(!a)continue;const i=n.length,s=J(i,1)*Math.PI*2,l=120+420*J(i,2);n.push({x:o,y:r,dx:Math.cos(s)*l+.5*(o-t.width/2),dy:Math.sin(s)*l*.6,lag:.35*J(i,3)})}return n}(i),h=ve(i.width,i.height).canvas;for(const t of Ee){const r=performance.now();if($e(i,h,s,t),await e.setSource(h),await ge(Math.max(0,44-(performance.now()-r))),n!==o||!c)return void(a=!1)}await e.setSource(i),a=!1}},()=>{o++,t.removeEventListener("pointermove",h)})},exports.fire=fo,exports.fluid=kr,exports.getFieldBudget=()=>s,exports.getGlobalLook=()=>o,exports.grid=mo,exports.halftone=Fr,exports.halo=Er,exports.imageGenerate=function(t,e={}){const n={current:{...e}},r=lt(),o=document.createElement("canvas");let a="idle",i=0,s=0,l="",c=null;const d={from:{img:null,k:0,blur:ue},to:{img:null,k:0,blur:ue},at:-1e6},h=()=>void 0===n.current.image?t.querySelector("img"):n.current.image,u=(t,e)=>{const n=e?1:fe((t-d.at)/he),r="generating"===a&&!e&&d.to.img?1-.45*(1-Math.exp(-Math.max(0,t-d.at)/1600)):1,o=(d.from.blur+(d.to.blur-d.from.blur)*n)*r,i=(d.from.img?d.from.k:0)+((d.to.img?d.to.k:0)-(d.from.img?d.from.k:0))*n;return d.to.img??d.from.img?[{img:d.from.img,k:i,blur:o,mix:1},{img:d.to.img,k:i,blur:o,mix:d.from.img?n:1}].filter(t=>t.img):[]},p=(t,e,n)=>{const r=performance.now(),o=c?.still()?1:fe((r-d.at)/he),[a]=u(r,!!c?.still());d.from={img:(o>=.5?d.to.img:d.from.img)??d.to.img??d.from.img,k:a?.k??0,blur:a?.blur??ue},d.to={img:t,k:e,blur:n},d.at=r,c?.kick()};c=ft({host:t,layer:"under",look:()=>({blend:"coarse",mark:"glyph",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:7,cellAspect:.8,glyphScale:.8,contrast:1.4,drift:.5,speed:.6,hover:"trail",trail:{strength:.9,radius:.35},...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:(t,e)=>{const n=Math.min(480,Math.max(2,Math.round(t)));return[n,Math.max(2,Math.round(n*e/Math.max(1,t)))]},onFail:()=>{c=null,r.restore()},paint:({pen:t,width:e,height:r,now:s,still:l})=>{const c="generating"===a,h=l?0:(s-i)/1e3;c&&n.current.elapsed&&(n.current.elapsed.textContent=(t=>{const e=t/1e3;return e<60?`${e.toFixed(1)}s`:`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,"0")}`})(s-i));const p=c&&!l?1+.12*Math.sin(2.1*h)*(.7+.3*Math.sin(.37*h)):1,f=Math.max(2,Math.ceil(24*r/Math.max(1,e)));24===o.width&&o.height===f||(o.width=24,o.height=f),Lt(o,3.1+(c?.55*h:0),.35);const m=u(s,l),g=Math.min(1,m[0]?.k??0);t.imageSmoothingEnabled=!0,t.globalAlpha=Math.max(0,1-g),t.filter=`brightness(${1.7*p})`,t.drawImage(o,0,0,e,r);for(const{img:n,k:o,blur:a,mix:i=1}of m){if(!n||o<=0||i<=0)continue;const s=n.width,l=n.height,c=Math.min(l,s*r/e),d=Math.min(s,l*e/r);t.globalAlpha=Math.min(1,1.25*o)*i,t.filter=`brightness(1.3) blur(${a*e/480}px)`,t.drawImage(n,(s-d)/2,Math.max(0,.45*(l-c)),d,c,0,0,e,r)}const x=c&&!l?.6*Math.min(1,g)*(1-Math.max(0,g-.8)/.2):0;return x>.01&&(t.globalCompositeOperation="lighter",t.globalAlpha=x,t.filter=`brightness(${.9*p})`,t.drawImage(o,0,0,e,r),t.globalCompositeOperation="source-over"),t.filter="none",t.globalAlpha=1,c||s-d.at<he}});const f=(e,r)=>{a=e,t.dataset.state=e,t.setAttribute("aria-busy",String("generating"===e)),n.current.onState?.(e,r)},m=t=>{const e=h();e&&c&&(r.set(e,"transition",c.still()?"none":`opacity ${t?560:440}ms cubic-bezier(.45, 0, .25, 1)`),r.set(e,"opacity",t?"1":"0"))},g=t=>new Promise(e=>setTimeout(e,t)),x=t=>{const e=h();e&&(l&&URL.revokeObjectURL(l),l="string"==typeof t?"":URL.createObjectURL(t),e.src=l||t,c||r.set(e,"visibility","visible"))},y=async(t=n.current.stream)=>{if(!t)return a;const e=++s,r=()=>e===s,o=!!c?.still();i=performance.now(),f("generating"),m(!1),p(null,0,ue);let l=0;try{for await(const e of"function"==typeof t?t():t){if(!r())return a;if(!(e.final??e.preview))continue;if(e.final){x(e.final),c&&p(await me(e.final),pe.final.k,pe.final.blur);break}if(!c){x(e.preview);continue}const t=pe.preview[Math.min(l++,pe.preview.length-1)];p(await me(e.preview),t.k,t.blur)}if(await g(o?0:544),!r())return a;f("done"),m(!0),c?.kick()}catch(t){if(!r())return a;p(null,0,ue),await g(o?0:340),f("failed",t)}return a};{const t=h();t&&r.set(t,c?"opacity":"visibility",c?"0":t.getAttribute("src")?"visible":"hidden")}return n.current.stream&&y(),mt(()=>c,n,()=>c?.refresh(),{run:y,reset(){s++,p(null,0,ue),f("idle"),m(!1)},get state(){return a}},()=>{s++,l&&URL.revokeObjectURL(l),delete t.dataset.state,t.removeAttribute("aria-busy"),r.restore()})},exports.interference=$r,exports.likeBurst=function(t,e={}){const n={current:{...xn,...e}},r=lt(),o=()=>t.querySelector(n.current.icon)??t,a=()=>!!(n.current.reducedMotion??tt());let i="true"===t.getAttribute("aria-pressed"),s=[],l=[],c=null;c=ft({host:t,outset:n.current.outset,layer:n.current.layer,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.92,...n.current.look}),ink:t=>n.current.ink??("heart"===n.current.kind?`var(--ascii-like, ${t?"#ff6b70":"#e5484d"})`:"--ascii-ink-strong"),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{c=null},paint:({pen:t,w:e,now:r,box:a})=>{const i=a(o()),l=n.current.kind;s=s.filter(e=>{const n=(r-e.start)/("burst"===e.kind?560:300);if(n>=1)return!1;if(n<0)return!0;if(t.save(),"burst"===e.kind)bn(t,l,i,n,e.seed);else{const e=i.x+i.w/2,r=i.y+i.h/2+3*yn(n),o=i.h*(1+.12*yn(n));Mn(t,l,e,r,o,(1-n)**1.4),t.fillStyle="#000";for(let a=r-o/2;a<r+o/2;a+=3)for(let r=e-o/2;r<e+o/2;r+=2)J(r,a)<1.15*n&&t.fillRect(r,a,2,3)}return t.restore(),!0});const c=n.current.limit;if(c&&s.length){const n=a(c),r=n.y+n.h,o=t.createLinearGradient(0,r-2,0,r+8);o.addColorStop(0,"#000"),o.addColorStop(1,"rgb(0 0 0 / 0)"),t.fillStyle="#000",t.fillRect(0,0,e,r-2),t.fillStyle=o,t.fillRect(0,r-2,e,10)}return s.length>0}});const d=()=>{l.forEach(clearTimeout),l=[]},h=()=>{if(d(),r.restore(),!c||a())return;const e=performance.now(),n=o();s=s.filter(t=>"undo"!==t.kind),s.push({kind:"burst",start:e,seed:Math.floor(e)%97}),n!==t&&r.set(n,"opacity","0"),l.push(setTimeout(()=>{r.restore(),n!==t&&"function"==typeof n.animate&&n.animate({opacity:["0","1"],scale:[".7","1"]},{duration:220,easing:"cubic-bezier(.34, 1.42, .64, 1)"})},347.2)),c.kick()},u=()=>{d(),r.restore(),c&&!a()&&(s=s.filter(t=>"burst"!==t.kind),s.push({kind:"undo",start:performance.now(),seed:0}),c.kick())},p=(e=!i)=>{i=e,t.setAttribute("aria-pressed",String(i)),i?h():u()},f=()=>{n.current.manage&&(p(),n.current.onChange?.(i))};return!t.hasAttribute("aria-pressed")&&n.current.manage&&t.setAttribute("aria-pressed","false"),t.addEventListener("click",f),mt(()=>c,n,()=>c?.refresh(),{burst:h,undo:u,toggle:p,get pressed(){return i}},()=>{d(),r.restore(),t.removeEventListener("click",f)})},exports.mesh=Lr,exports.moire=xo,exports.morph=yo,exports.mountCanvas=Or,exports.mountSurface=ft,exports.noise=vo,exports.odometer=function(t,e={}){const n=parseFloat((t.textContent??"").replace(/[^\d.-]/g,"")),r={current:{...zt,...e,value:e.value??(Number.isFinite(n)?n:0)}},o=lt();let a=r.current.value,i=r.current.format(a),s={from:i,to:i,t0:-1e9,up:!0,first:-1},l=null;const c=ct(i,!0),d=document.createElement("span"),h=()=>{d.replaceChildren(...[...i].map(t=>Object.assign(document.createElement("span"),{textContent:t}))),c.textContent=i};l=ft({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:3,cellAspect:.66,glyphScale:1,shade:.2,contrast:1.1,...r.current.look}),ink:()=>r.current.ink??getComputedStyle(t).color,kit:r,reducedMotion:()=>r.current.reducedMotion,resolution:2,onFail:()=>{l=null,t.textContent=i,o.restore()},paint:({pen:t,now:e,still:n,box:o,scale:a})=>{const i=getComputedStyle(d),l=parseFloat(i.fontSize),c=parseFloat(i.letterSpacing)||0,h=`${i.fontStyle} ${i.fontWeight} ${i.fontSize} ${i.fontFamily}`;t.setTransform(a,0,0,a,0,0),t.font=h,t.textAlign="center",t.textBaseline="alphabetic";const u=t.measureText("0"),p=u.fontBoundingBoxAscent||.8*l,f=u.fontBoundingBoxDescent||.2*l,{from:m,to:g,t0:x,up:y,first:v}=s,M=[...d.children],b=r.current,w="glyph"===b.face,k=(t,e)=>t[t.length-1-e]??"";let S=!1;return M.forEach((r,a)=>{const i=M.length-1-a,s=o(r),d=s.x+(s.w-c)/2,u=s.y,A=s.h,C=u+(A-p-f)/2+p,E=k(g,i),$=v-i,L=!n&&v>=0&&$>=0&&/\d/.test(E)?_((e-x)/(b.duration+$*b.stagger)):1,z=Z(L),P=L<1&&!w?Q(.72,1,L).toFixed(3):"";if(r.style.opacity!==P&&(r.style.opacity=P),L>=1)return void(w&&(t.globalAlpha=1,t.font=h,t.fillStyle="#fff",t.fillText(E,d,C)));S=!0,t.globalAlpha=w?1:1-Q(.72,1,L);const R=5+2*$,F=[k(m,i),...Array.from({length:R},(t,e)=>b.glyphs[Math.floor(J(e+7*i,x)*b.glyphs.length)]??""),E];y||F.reverse();const T=(F.length-1)*A,I=y?z*T:T-z*T;t.save(),t.beginPath(),t.rect(d-s.w,u,2*s.w,A),t.clip(),F.forEach((e,n)=>{const r=C+n*A-I;if(r<u-A||r>u+2*A)return;const o=n>0&&n<F.length-1;t.font=o?`600 ${.84*l}px "Geist Mono", ui-monospace, monospace`:h,t.fillStyle=o?"#d0d0d0":"#fff",t.fillText(e,d,r)}),t.restore()}),t.globalAlpha=1,S}});const u=()=>{l&&o.set(d,"color","glyph"===r.current.face?"transparent":"inherit")};l&&(o.set(d,"display","inline-flex"),u(),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),h(),document.fonts?.ready.then(()=>l?.kick()));const p=e=>{if(!Number.isFinite(e))return;const n=a,o=i;a=r.current.value=e,i=r.current.format(e),l?o!==i&&(s={from:o,to:i,up:e>=n,first:Pt(o,i),t0:performance.now()},h(),l.kick()):t.textContent=i};return mt(()=>l,r,t=>{u(),t.value!==a?p(t.value):(i=t.format(a),h(),l?.refresh())},{set:p,get value(){return a}},()=>{l&&(t.textContent=i),o.restore()})},exports.pageDissolve=function(t,e={}){const n={current:{...An,...e}},r=lt();let o=null,a=0,i=0,s=Promise.resolve(),l=0,c=null;const d="function"==typeof matchMedia&&matchMedia("(pointer: coarse)").matches?1:2,h=t=>{t.handed(),t.landing(),t.done()};c=ft({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:8,cellAspect:.6,glyphScale:.9,contrast:1.15,shade:.55,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:{get current(){return{...n.current,poster:void 0}}},reducedMotion:()=>n.current.reducedMotion,resolution:d,onFail:()=>{c=null;const t=o;o=null,r.restore(),t&&h(t)},paint:({pen:t,width:e,height:n,now:r})=>{const s=o;if(!s)return!1;const l=r-s.start,d=l/s.outMs,h=s.next?(r-s.nextAt)/s.nextMs:0;var u;d<1&&Pn(t,s.out,1.12*$n(d),s.at,++i),s.next&&h>0&&Pn(t,s.next,.1+1.14*(u=h,1-(1-Math.min(1,Math.max(0,u)))**2),s.at,i,!0);const p=s.next?(r-s.nextAt-s.nextMs+s.hand)/s.hand:-1,f=Ln(l/s.hand)*(1-Ln(p));f<1&&(t.globalAlpha=1-f,t.fillStyle="#000",t.fillRect(0,0,e,n),t.globalAlpha=1);const m=Math.round(-160*$n(2*d)*(s.next?1-$n(h):1))/1e3;return m!==a&&(a=m,c?.field.update({brightness:m})),0===s.stage&&l>=s.hand&&(s.stage=1,s.handed()),1===s.stage&&p>=0&&(s.stage=2,s.landing()),!(p>=1)||(o=null,s.done(),!1)}});const u=(e,n)=>{if(e&&"getBoundingClientRect"in e){const t=n.box(e);return{x:(t.x+t.w/2)*d,y:(t.y+t.h/2)*d}}return e?{x:e.x*d,y:e.y*d}:{x:t.offsetWidth/2*d,y:0}},p=e=>De(t,e.box,t.offsetWidth,t.offsetHeight,d,{skip:e.canvas}),f=(e,n)=>{for(const o of[...t.children].filter(t=>void 0===t.dataset.asciiKit&&void 0===t.dataset.asciiPoster))r.set(o,"transition",n?`opacity ${n}ms cubic-bezier(.16, 1, .3, 1)`:"none"),r.set(o,"opacity",e?"1":"0")},m=async(e,i)=>{const s=c;if(!s||(n.current.reducedMotion??tt())||!s.live)return void await e();const{dissolve:l,condense:d}=n.current,h=Math.max(1,Math.min(110,l/2,d/2)),[m,g]=zn(),[x,y]=zn(),[v,M]=zn(),b=o={at:u(i??n.current.origin,s),start:performance.now(),hand:h,out:p(s),outMs:Math.max(1,l),next:null,nextAt:0,nextMs:Math.max(1,d),handed:g,landing:y,done:M,stage:0};if(t.dataset.state="out",f(!1,h),s.kick(),await m,o===b){try{await e()}catch(t){throw o===b&&(o=null,r.restore(),c?.field.update({brightness:0})),t}c&&o===b&&(s.canvas.isConnected&&s.canvas.parentElement===t||t.appendChild(s.canvas),f(!1,0),t.dataset.state="in",b.next=p(s),b.nextAt=performance.now(),s.kick(),await x,o===b&&f(!0,h),await v,r.restore(),a=0,c?.field.update({brightness:0}),c?.kick())}};return mt(()=>c,n,()=>c?.refresh(),{swap(e,n){l++;const r=s.then(()=>m(e,n)).finally(()=>{0===--l&&delete t.dataset.state});return s=r.catch(()=>{}),r},get busy(){return l>0}},()=>{const e=o;o=null,r.restore(),delete t.dataset.state,e&&h(e)})},exports.pill=function(t,e={}){const n={current:{...ee,...e}},r=t instanceof HTMLElement?[t]:[...t],o=1===r.length,a=o?r[0]:r.length?function(t){let e=t[0].parentElement;for(;e&&!t.every(t=>e.contains(t));)e=e.parentElement;return e??document.body}(r):null,i=lt(),s=new Map,l=new Map,c=new Map,d=new Map,h=[],u=t=>void 0!==t.dataset.count?"count":"new"===ce(t,n.current.tone)?"new":"status",p=t=>void 0!==t.dataset.live?"false"!==t.dataset.live:n.current.live,f=(t=-1e6)=>{for(const e of r){const r=ce(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 m=()=>M?.dark()??(!a||st(a))?"dark":"light",g=()=>({mark:"glyph",charset:ae[m()],font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:le,cellAspect:1,glyphScale:1,color:"source",saturation:1,shade:0,...n.current.look}),x=()=>{const{cellSize:t=le,cellAspect:e=1}=g(),n=Math.min(2,globalThis.devicePixelRatio||1),r=Math.max(2,Math.round(t*n));return{ch:r/n,cw:Math.max(2,Math.round(r*e))/n}};let y=[0,0];const v=new Map;let M=null,b="";function w(){for(;h.length;)h.pop()();i.restore()}M=a?ft({host:a,layer:o?"under":"over",look:g,ink:()=>n.current.ink,kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:(t,e)=>{const{cw:n,ch:r}=x();return[Math.max(2,Math.round(2*t/n)),Math.max(2,Math.round(2*e/r))]},onFail:()=>{M=null,w()},onTheme:()=>M?.field.update({charset:ae[m()]}),paint:({pen:t,now:e,still:o,dark:h,box:f,width:m,w:g})=>{const w=n.current,k=h?"dark":"light",S={...ne[k],...w.tones?.[k]},A=(t,e)=>((t,e,n=.5)=>{const r=re[t],o=r.findIndex(([,t])=>t===e),a=o>0?r[o-1][0]:0;return a+(Math.min(r[o][0],1)-a)*n})(k,t,e),{cw:C,ch:E}=x(),$=m/g,L=(e,n,r,o)=>{o<=0||(t.fillStyle=function(t,e){const n=Math.max(1,...t),r=t.map(t=>t/n*255),o=(.2126*r[0]+.7152*r[1]+.0722*r[2])/255,a=Math.min(1,e/Math.max(o,.01));return`rgb(${r.map(t=>Math.round(Math.max(0,Math.min(255,t*a)))).join(" ")})`}(r,o),t.fillRect(Math.round((e+.5)*C*$)-1,Math.round((n+.5)*E*$)-1,2,2))};let z=!1;const P=r.map(t=>"count"!==u(t)&&w.indicator?t.querySelector("[data-dot]"):null),R=r.map((t,e)=>{const n=f(t),r=P[e]?f(P[e]):null,[o,a]=v.get(t)??[0,0],i=t=>({...t,x:t.x+y[0]-o,y:t.y+y[1]-a});return{b:i(n),dot:r&&i(r)}}),F=R.find((t,e)=>t.dot&&"status"===u(r[e]))??R.find(t=>t.dot)??R[0];if(F){const t=(t,e)=>{const n=((t-e/2)%e+e)%e;return n>.001?n-e:0},e=[F.dot?t(F.dot.x+F.dot.w/2,C):0,t(F.b.y+F.b.h/2,E)];(Math.abs(e[0]-y[0])>.01||Math.abs(e[1]-y[1])>.01)&&(y=e,M.canvas.style.translate=`${y[0].toFixed(2)}px ${y[1].toFixed(2)}px`)}const T=M.canvas.style,I=(t,e,n)=>Math.max(1,Math.floor((t-e)/n))*n+"px",W=I(a.clientWidth,y[0],C),B=I(a.clientHeight,y[1],E);T.width===W&&T.height===B||(T.width=W,T.height=B,M.field.resize(),z=!0);const O=R.map((t,e)=>{const n=t=>({...t,x:t.x-y[0],y:t.y-y[1]});return((t,e,n,r,o)=>{const[a,s]=v.get(t)??[0,0],l=(t,e)=>Math.round((t-e/2)/e)*e+e/2-t,c=n?l(n.x+n.w/2,r):0,d=l(e.y+e.h/2,o);return(Math.abs(c-a)>.01||Math.abs(d-s)>.01)&&(v.set(t,[c,d]),i.set(t,"translate",`${c.toFixed(2)}px ${d.toFixed(2)}px`)),{b:{...e,x:e.x+c,y:e.y+d},dot:n&&{...n,x:n.x+c,y:n.y+d}}})(r[e],n(t.b),t.dot&&n(t.dot),C,E)}),q=O.map(t=>t.b).map(t=>function(t,e,n){return{x:t.x+2,y:Math.round((t.y+t.h/2)/n-.5)*n,w:Math.max(0,t.w-4)}}(t,0,E)),N=function(t,e){const n=t=>t.toFixed(2),r=e/2,o=t.filter(t=>t.w>2*r).map(({x:t,y:o,w:a})=>`M${n(t+r)} ${n(o)}H${n(t+a-r)}A${n(r)} ${n(r)} 0 0 1 ${n(t+a-r)} ${n(o+e)}H${n(t+r)}A${n(r)} ${n(r)} 0 0 1 ${n(t+r)} ${n(o)}Z`).join("");return o?`path("${o}")`:"inset(50%)"}(q,E);return N!==b&&(b=N,M.canvas.style.clipPath=N),r.forEach((t,n)=>{const r=q[n],a=u(t),i=Math.round(r.y/E),h=Math.ceil(r.x/C),m=Math.floor((r.x+r.w)/C)-1;var g,x,y;if(!(m<h))if("status"===a){const r=O[n].dot;if(!r)return;const a=s.get(t),l=e-a.at,c=o?1:K(l/240);c<1&&(z=!0);const d=(g=S[a.from],x=S[a.to],y=c,g.map((t,e)=>t+(x[e]-t)*y)),u=!o&&p(t),f=Math.floor((r.x+r.w/2)/C),v="light"===k?.55:.7,M="light"===k?.35:.25;let b="neutral"===a.to?A("○"):"amber"===a.to&&p(t)?A("◐"):A("●",v);"red"===a.to&&!o&&l<640?(z=!0,Math.floor(l/160)%2==0&&(b=A("○"))):u&&"amber"===a.to?(z=!0,b=A(ie[Math.floor((e+90*n)/130)%4])):u&&(z=!0,b=A("●",v-M*Math.cos((e+500*n)/2200*Math.PI*2))),f>=h&&f<=m&&L(f,i,d,b)}else if("new"===a){const r=O[n].dot;if(!r)return;const a=Math.max(0,(e-(l.get(t)??-1e6))/720),s=Math.floor((r.x+r.w/2)/C);a<1&&!o&&(z=!0),s>=h&&s<=m&&L(s,i,S.new,A(a<1&&!o?se[Math.floor(a*se.length)]:"✦"))}else{const n=c.get(t),r=d.get(t)?.digits.children;if(!r)return;if((n?(e-n.at)/600:1)>=1||o){for(const t of r)t.style.opacity="",t.style.translate="";return}z=!0,[...r].forEach((t,r)=>{if(!n.changed[r])return;const o=t,a=f(o),s=(e-n.at-70*r)/460,l=K((s-.72)/.28);if(o.style.opacity=String(l),o.style.translate=`0 ${3*(l-1)}px`,s<=0||s>=.78)return;const c=Math.min(m,Math.max(h,Math.floor((a.x+a.w/2)/C)));L(c,i,S.neutral,A(["·","•","○","●"][Math.floor(9*s)%4]))})}}),z}}):null;const k=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){if("count"===u(t)){const e=(t.textContent??"").trim(),n=[...t.childNodes],r=ct(e),o=document.createElement("span");o.setAttribute("aria-hidden","true"),i.set(o,"display","inline-flex"),o.replaceChildren(...k(e)),t.replaceChildren(r,o),d.set(t,{text:e,live:r,digits:o}),h.push(()=>{const r=d.get(t)?.text??e;r===e?t.replaceChildren(...n):t.textContent=r})}else if(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:${le}px;height:${le}px;margin-inline-end:4px;vertical-align:middle`),t.prepend(e),h.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),h.push(()=>{t.parentElement?.insertBefore(e,t),t.remove()}),S(t)}else e instanceof HTMLElement&&void 0===e.dataset.dot&&S(e)}d.size&&document.fonts?.ready.then(()=>M?.kick()),a.addEventListener("pointermove",E),a.addEventListener("pointerleave",$)}function S(t){"static"===getComputedStyle(t).position&&i.set(t,"position","relative"),i.set(t,"z-index","2")}function A(t){const e=performance.now();for(const n of t?[t]:r.filter(t=>"new"===u(t)))l.set(n,e);M?.kick()}let C=null;function E(t){const e=t.target,o=r.find(t=>e&&t.contains(e))??null;o!==C&&(C=o,o&&"new"===u(o)&&n.current.sheen&&A(o))}function $(){C=null}return mt(()=>M,n,()=>{f(performance.now()),M?.refresh()},{sheen:A,count:(t,e)=>{const n=e??r.find(t=>"count"===u(t));if(!n)return;const o=String(t),a=d.get(n);if(!a)return void(n.textContent=o);if(o===a.text)return;const i=Math.max(o.length,a.text.length),s=a.text.padStart(i," "),l=o.padStart(i," "),h=M?.still()??!0;a.text=o,a.live.textContent=o,a.digits.replaceChildren(...k(l)),c.set(n,{at:h?-1e6:performance.now(),changed:[...l].map((t,e)=>t!==s[e])}),M?.kick()},refresh:()=>{f(performance.now()),M?.kick()}},()=>{a?.removeEventListener("pointermove",E),a?.removeEventListener("pointerleave",$),w()})},exports.pricingGlow=function(t,e={}){const n={current:{...Pe,...e}},r=(e=n.current.saving)=>Re(t,e,(()=>{const e=n.current.price;return"string"==typeof e?t.querySelector(e):e??t.querySelector("[data-price]")})(),n.current.font);let o=null,a=0,i=0,s=0,l=null;l=xe({host:t,look:()=>({mark:"dot",scene:"drift",scale:"number"==typeof innerWidth&&innerWidth<760?1.7:1,cellSize:4,cellAspect:1,dotScale:.92,color:"ink",shade:0,fit:"cover",focus:{x:.5,y:.5},levels:"none",contrast:1.1,brightness:-.04,drift:.5,hover:"lantern",lantern:{radius:.26,strength:.4,trail:.7,follow:8},trail:{strength:.9,radius:.4},fluid:{radius:.09,refraction:.03,glow:.6},...n.current.look}),ink:t=>n.current.ink??(t?"#aeaca5":"#5c5a55"),source:o=r(),kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{l=null,c?.disconnect()}}),i=t.offsetWidth,s=t.offsetHeight;const c=l&&"function"==typeof ResizeObserver?new ResizeObserver(()=>{!l||Math.abs(t.offsetWidth-i)<2&&Math.abs(t.offsetHeight-s)<2||(i=t.offsetWidth,s=t.offsetHeight,a++,l.field.setSource(o=r()))}):null;c?.observe(t);const d=async t=>{const e=l?.field,n=o;if(o=t,!e)return;const r=++a;if(!n||l.still())return void await e.setSource(t);const i=ve(t.width,t.height),s=i.pen,c=t.width,d=t.height,h=.34*c;for(let o=1;o<=9&&r===a;o++){const r=performance.now(),a=o/9*(c+2*h)-h,l=Math.max(0,Math.min(c,a));s.globalCompositeOperation="source-over",s.drawImage(n,0,0,c,d),l>0&&s.drawImage(t,0,0,l,d,0,0,l,d);const u=s.createLinearGradient(a-h,0,a+.4*h,0);u.addColorStop(0,"rgb(0 0 0 / 0)"),u.addColorStop(.72,"rgb(255 255 255 / .5)"),u.addColorStop(1,"rgb(0 0 0 / 0)"),s.globalCompositeOperation="lighter",s.fillStyle=u,s.fillRect(0,0,c,d),await e.setSource(i.canvas),await ge(Math.max(0,48-(performance.now()-r)))}r===a&&l?.field===e&&await e.setSource(t)};return ye(()=>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()&&Me(l.field,t,e)}},()=>{a++,c?.disconnect()})},exports.pullRefresh=function(t,e){const n={current:{...nr,...e}},r=lt(),o=()=>n.current.content??t.children[0]??null,a=ct("",!0),i={x:0,v:0,to:0};let s="idle",l=!1,c=!1,d=0,h=-1,u=0,p=0,f=0,m=!0,g=0,x=null,y=[];const v=new WeakSet,M=t=>{a.textContent=t};x=ft({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:()=>{x=null},paint:({pen:t,w:e,now:a,still:c,scale:d,box:h})=>{const v=f?Math.min(1/30,(a-f)/1e3):1/60;f=a;let M=l;c?(i.x=i.to,i.v=0):l||(M=function(t,e,n=300,r=.86,o=.2){const a=2*Math.sqrt(n)*r,i=Math.max(1,Math.ceil(240*e)),s=e/i;for(let e=0;e<i;e++)t.v+=(-n*(t.x-t.to)-a*t.v)*s,t.x+=t.v*s;return!(Math.abs(t.x-t.to)<o&&Math.abs(t.v)<12*o&&(t.x=t.to,t.v=0,1))}(i,v)||M),"refreshing"===s&&(u+=6.5*v,M=!0),"done"===s&&a-p<320&&(M=!0);const b=o();b&&r.set(b,"translate",`0 ${Math.max(0,i.x).toFixed(2)}px`),t.setTransform(d,0,0,d,0,0);const k=n.current,S=Math.max(0,i.x),A=_(S/k.threshold),C=Math.min(k.threshold,48),E="idle"===s||"pulling"===s?Q(.1,.55,A):_(S/C),$=e/2,L=Math.min(S,C)/2+.25*Math.max(0,S-C);"pulling"===s&&A>=1&&!g&&(g=a),A<1&&(g=0);const z=g&&!c&&a-g<260?.14*Math.sin(Math.PI*((a-g)/260)):0;if(z&&(M=!0),S>.5&&E>.01){if(t.save(),t.beginPath(),t.rect(0,0,e,S),t.clip(),t.translate($,L),t.scale(E*(1+z),E*(1+z)),t.lineWidth=4,t.lineCap="round","idle"===s||"pulling"===s){const e=-Math.PI/2+.03*Math.max(0,S-k.threshold);t.strokeStyle=`rgba(255,255,255,${.55+.45*A})`,t.beginPath(),t.arc(0,0,11,e,e+2*Math.PI*Math.max(.02,A)),t.stroke()}else{const e="done"===s&&m?c?1:K((a-p)/300):0,n="refreshing"!==s||c?1:K((a-p)/240),r=24,o=2*Math.PI*(1-.22*n);for(let a=0;a<r;a++){const i=u-Math.PI/2+a/r*o,l=1-.85*n*(1-a/(r-1));t.strokeStyle=`rgba(255,255,255,${l*(1-e)*("done"!==s||m?1:.4)})`,t.beginPath(),t.arc(0,0,11,i,i+o/r+.02),t.stroke()}e>0&&function(t,e,n,r,o){if(o<=0)return;const a=[[-.82,.02],[-.26,.56],[.86,-.6]].map(([t,o])=>[e+t*r,n+o*r]),i=Math.hypot(a[1][0]-a[0][0],a[1][1]-a[0][1])+Math.hypot(a[2][0]-a[1][0],a[2][1]-a[1][1]);t.save(),t.strokeStyle="#fff",t.lineWidth=4.5,t.lineCap="round",t.lineJoin="round",t.setLineDash([i*o,i]),t.beginPath(),t.moveTo(a[0][0],a[0][1]),t.lineTo(a[1][0],a[1][1]),t.lineTo(a[2][0],a[2][1]),t.stroke(),t.restore()}(t,0,0,11,e)}t.restore()}return y=y.filter(e=>{if(!e.row.isConnected)return w(e,!0),!1;const n=c?1:(a-e.start)/760;if(n<0||!Number.isFinite(n))return M=M||Number.isFinite(n),!0;if(n>=rr&&w(e),n>=1)return w(e,!0),!1;const r=h(e.row);(!e.snap||Math.abs(e.snap.width/2-r.w)>.5||Math.abs(e.snap.height/2-r.h)>.5)&&(e.snap=Ze(e.row,r.w,r.h,t=>{const e=h(t);return{x:e.x-r.x,y:e.y-r.y,w:e.w,h:e.h}}).canvas,e.photos=[...e.row.querySelectorAll("img")]);const o=e.snap;return e.photos.length&&function(t,e,n){const r=e.getContext("2d"),o=n(t.row);t.photos=t.photos.filter(t=>{if(!t.complete)return!0;if(!r||!t.naturalWidth)return!1;const e=n(t),a=e.x-o.x,i=e.y-o.y,s=Math.min(parseFloat(getComputedStyle(t).borderTopLeftRadius)||0,e.w/2,e.h/2);return r.save(),r.setTransform(2,0,0,2,0,0),r.beginPath(),r.roundRect(a,i,e.w,e.h,s),r.clip(),r.fillStyle="#000",r.fillRect(a,i,e.w,e.h),Ve(r,_e({image:t,width:t.naturalWidth,height:t.naturalHeight},!x?.dark()),a,i,e.w,e.h),r.restore(),!1})}(e,o,h),t.globalAlpha=n<rr?K(n/rr,3):1-K((n-rr)/.7,3),t.drawImage(o,r.x,r.y,r.w,r.h),t.globalAlpha=1,M=!0,!0}),M||(f=0),M}});const b=()=>x?.kick();function w(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 k=(t,e)=>{if(x&&!x.still()){for(const n of t)n instanceof HTMLElement&&!v.has(n)&&(v.add(n),y.push({row:n,snap:null,start:e,opacity:n.style.opacity,transition:n.style.transition,shown:!1,photos:[...n.querySelectorAll("img")]}),n.style.transition="none",n.style.opacity="0");b()}},S=()=>{const t=performance.now();y.forEach(e=>{e.start===1/0&&(e.start=t)}),b()},A=t=>new Promise(e=>setTimeout(e,t)),C=async()=>{if("refreshing"===s||"done"===s)return;const e=n.current,r=!x||x.still();s="refreshing",l=c=!1,i.to=Math.min(e.threshold,48),p=performance.now(),t.setAttribute("aria-busy","true"),M(e.messages?.refreshing??"Refreshing."),b(),m=!0;try{await Promise.all([e.onRefresh(),A(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&&k(t.querySelectorAll(e.reveal),1/0)}s="done",p=performance.now(),M(m?e.messages?.done??"Updated.":e.messages?.failed??"Couldn’t refresh."),b(),await A(r?0:620),"done"===s?(s="idle",i.to=0,S(),t.removeAttribute("aria-busy"),b()):S()}},E=e=>{0!==e.button||"idle"!==s||t.scrollTop>0||(l=!0,c=!1,d=e.clientY,h=e.pointerId)},$=e=>{if(!l||e.pointerId!==h)return;e.clientY<d&&(d=e.clientY);const n=(e.clientY-d)/(t.getBoundingClientRect().height/(t.clientHeight||1)||1);if(!c){if(n<6)return;c=!0,s="pulling";try{t.setPointerCapture?.(e.pointerId)}catch{}}i.x=i.to=(t=>128*(1-Math.exp(-Math.max(0,t)/128)))(n-6),i.v=0,b()},L=()=>{if(l&&(l=!1,c)){if(c=!1,i.x>=n.current.threshold)return s="idle",void C();s="idle",i.to=0,b()}},z=t=>{c&&t.preventDefault()},P=t=>{l&&t.preventDefault()};return x?(r.set(t,"overscroll-behavior-y","contain"),t.appendChild(a),t.addEventListener("pointerdown",E),t.addEventListener("pointermove",$),t.addEventListener("pointerup",L),t.addEventListener("pointercancel",L),t.addEventListener("touchmove",z,{passive:!1}),t.addEventListener("dragstart",P),t.addEventListener("selectstart",P)):t.appendChild(a),mt(()=>x,n,()=>x?.refresh(),{refresh:C,revealRows:t=>k(t,performance.now()),get state(){return s}},()=>{s="idle",y.forEach(t=>{t.row.style.opacity=t.opacity,t.row.style.transition=t.transition}),y=[],t.removeEventListener("pointerdown",E),t.removeEventListener("pointermove",$),t.removeEventListener("pointerup",L),t.removeEventListener("pointercancel",L),t.removeEventListener("touchmove",z),t.removeEventListener("dragstart",P),t.removeEventListener("selectstart",P),t.removeAttribute("aria-busy"),a.remove(),r.restore()})},exports.pulse=Mo,exports.rain=bo,exports.resolveColor=nt,exports.ripple=Cr,exports.setFieldBudget=function(t){s=Number.isFinite(t)&&t>=1?Math.floor(t):12,B()},exports.setGlobalLook=function(t){const{charset:e,style:r}=t??{};o=t?{...e?{charset:e}:{},...n(r)?{style:r}:{}}:null;for(const t of i)t.relook();for(const t of[...a])t(o)},exports.silk=wo,exports.skeleton=function(t,e={}){const n={current:{..._t,...e}},r=lt();let o=0,a=null,i=null,s=null,l=null;const c=()=>[...t.querySelectorAll(n.current.blocks)].map((t,e)=>({el:t,kind:te(t),delay:void 0!==t.dataset.delay?Number(t.dataset.delay):80+e*n.current.stagger})),d=["mask-image","-webkit-mask-image"],h=()=>{r.restore(),t.removeAttribute("aria-busy"),i?.(),i=null};l=ft({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,h()},paint:({pen:t,now:e,still:i,box:s,w:l})=>{if(null!==a&&i)return h(),!1;const u=n.current,p=null===a?-1:e-a;if(null!==a&&p>Math.max(n.current.develop,...c().map(t=>t.delay+n.current.resolve))+16)return h(),!1;null!==a&&(t=>{for(const{el:e,kind:o,delay:a}of c()){const i=Kt(t,a,n.current.resolve);if(r.set(e,"opacity",String("text"===o?Math.min(1,1.6*i):i)),"text"===o){const t=128*i-14;for(const n of d)r.set(e,n,i>=1?"none":`linear-gradient(90deg, #000 ${t-14}%, transparent ${t+14}%)`)}}})(p);const f=Math.max(140,.42*l),m=l+f,g=-f+(i?.4:(e-o)/u.shimmer%1)*m,x=i?1:K((e-o)/280,3),y=t.createLinearGradient(g-m,0,g+m,.08*m);for(let t=0;t<=32;t++){const e=Math.abs(t/16-1)*m,n=Math.min(e,Math.abs(m-e)),r=n<f?.5+.5*Math.cos(n/f*Math.PI):0;y.addColorStop(t/32,Jt(.24+(.54-.24)*r))}const v=(e,n,r,o,a)=>{t.beginPath(),t.roundRect(e,n,Math.max(0,r),o,Math.min(a,o/2,Math.max(0,r)/2))};for(const{el:e,kind:n,delay:r}of c()){const{x:o,y:a,w:i,h:l}=s(e),c=e.getBoundingClientRect().width,d=Zt(e,n,c&&i?c/i:1),h=Kt(p,r,u.resolve);if(t.fillStyle=y,"photo"===n){const n=p<0?0:K(p/u.develop,4);t.globalAlpha=(1-h)*x,v(o,a,i,l,d.radius),t.fill();const r=e instanceof HTMLImageElement?e:e.querySelector("img");if(n>0&&r?.complete&&r.naturalWidth){const e=Math.max(i/r.naturalWidth,l/r.naturalHeight),s=r.naturalWidth*e,c=r.naturalHeight*e;t.save(),v(o,a,i,l,d.radius),t.clip(),t.globalAlpha=n*(1-h),t.drawImage(r,o+(i-s)/2,a+(l-c)/2,s,c),t.restore()}}else if("avatar"===n)t.globalAlpha=(1-h)*x,t.beginPath(),t.arc(o+i/2,a+l/2,Math.min(i,l)/2,0,2*Math.PI),t.fill();else{t.globalAlpha=x*(1-h);for(const e of d.lines){const n=o+e.x,r=n+e.w*h;v(r,a+e.y,n+e.w-r,e.h,d.radius),t.fill()}}t.globalAlpha=1}return!0}});const u=()=>{const e=null!==a;if(o=performance.now(),a=null,t.setAttribute("aria-busy","true"),l){if(e&&!l.still())for(const{el:t}of c())t.animate?.([{opacity:1},{opacity:0}],{duration:240,easing:"cubic-bezier(.16, 1, .3, 1)"});(()=>{for(const{el:t}of c()){r.set(t,"opacity","0");for(const e of d)t.style.removeProperty(e)}})(),l.kick()}};return u(),mt(()=>l,n,()=>l?.refresh(),{resolve:()=>l?(null!==a&&s||(a=performance.now(),s=new Promise(t=>{i=t}),l.kick()),s):(t.removeAttribute("aria-busy"),Promise.resolve()),reset(){i?.(),i=null,s=null,u()},get loading(){return null===a}},()=>{h()})},exports.slideToConfirm=function(t,e={}){const n={current:{...cn,...e}},r=lt(),o=t.querySelector(n.current.thumb)??t.firstElementChild,a=()=>t.querySelector(n.current.label),i=()=>!!(n.current.reducedMotion??tt());let s=pn(0,520,.8),l=pn(0,150,1),c=!1,d=0,h=!1,u=0,p=0,f=[],m=0,g=0,x=0,y="",v=-1,M=null;const b=()=>{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=>nt(n.current.ink??"--ascii-ink-strong",t)??nt(getComputedStyle(t).color,t)??(e?"#d8d6cf":"#1d1d1b");M=ft({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:a,still:i,dark:c,box:d})=>{const f=b();if(!f)return!1;const m=h?i?1:_((a-u)/dn):0,g=un(_(m/.5)),x=un(_((m-.36)/.3)),v=un(_((m-.46)/.4)),w=_((m-.5)/.5),S=1+.07*Math.sin(Math.PI*w)*(1-w),A=p?1-_((a-p)/260):1,C=n.current.mark?d(n.current.mark):{x:r/2-18,y:o/2-18,w:36,h:36},E=C.x+C.w/2,$=C.y+C.h/2,L=Math.min(C.w/2,o/2-2)*S,z=h?it(k(c),(e=>nt(n.current.color??"--ascii-success",t,e?"#3ccf7e":"#17844a"))(c),un(_(i?1:(a-u)/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 P=f.pad+s.x+f.size/2,R=h?1:l.x,F=hn(0,E-L,g),T=hn(P,E+L,g),I=hn(0,$-L,g),W=hn(o,$+L,g);if(T-F>1&&R>.004){const t=e.createLinearGradient(F,0,T,0);t.addColorStop(0,`rgba(255,255,255,${hn(.14,1,g)*R})`),t.addColorStop(.62,`rgba(255,255,255,${hn(.48,1,g)*R})`),t.addColorStop(1,`rgba(255,255,255,${R})`),e.fillStyle=t,e.globalAlpha=A*(1-.28*x),e.beginPath(),e.roundRect(F,I,T-F,W-I,hn(0,L,g)),e.fill()}return x>0&&(e.globalAlpha=1,e.fillStyle="#000",e.beginPath(),e.arc(E,$,Math.max(0,L-5)*x,0,2*Math.PI),e.fill()),e.restore(),v>0&&function(t,e,n,r,o,a,i){if(o<=0||a<=0)return;const s=[[-.82,.02],[-.26,.56],[.86,-.6]].map(([t,o])=>[e+t*r,n+o*r]),l=Math.hypot(s[1][0]-s[0][0],s[1][1]-s[0][1])+Math.hypot(s[2][0]-s[1][0],s[2][1]-s[1][1]);t.save(),t.globalAlpha=a,t.strokeStyle="#fff",t.lineWidth=i,t.lineCap="round",t.lineJoin="round",t.setLineDash([l*o,l]),t.beginPath(),t.moveTo(s[0][0],s[0][1]),t.lineTo(s[1][0],s[1][1]),t.lineTo(s[2][0],s[2][1]),t.stroke(),t.restore()}(e,E+.02*L,$+.07*L,.55*L,v,A,4.5),!1}});const S=()=>{const t=b();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*_(e))));const n=a();n&&r.set(n,"opacity",String(h?0:1-_(1.7*e)))},A=e=>{m=0;const n=Math.min(1/30,Math.max(0,(e-g)/1e3));g=e;let a=!c&&fn(s,n,.3);a=fn(l,n,.003)||a,p&&(e-p>=260||i())&&(p=0,h=!1,s=pn(0,520,.8),l=pn(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)),h&&e-u>302.4&&(t.dataset.confirmed=""),S(),M?.kick(),(a||c||h&&e-u<760||p>0)&&(m=requestAnimationFrame(A))},C=()=>{m||(g=performance.now(),m=requestAnimationFrame(A))},E=()=>{const e=b();if(!e||h)return;const a=e.max-s.x;c=!1,h=!0,s.to=e.max,l.to=1,u=performance.now()+(a>4?200:90),i()&&(mn(s),mn(l),u=-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")),x&&clearTimeout(x),n.current.resetAfter>0&&(x=setTimeout($,n.current.resetAfter)),S(),C(),n.current.onConfirm?.()};function $(){if(x&&clearTimeout(x),x=0,!h)return s.to=0,l.to=0,void C();p=performance.now(),t.dataset.state="resetting",o?.removeAttribute("aria-valuetext"),C()}const L=e=>{const r=b();if(!c||!r||void 0!==e&&void 0!==e.pointerId&&e.pointerId!==v)return;c=!1;const o=gn(f,performance.now());s.x>=r.max*n.current.threshold||o>900&&s.x>.5*r.max?E():(s.to=0,s.v=.25*_(o,-1500,1500),l.to=0,i()&&(mn(s),mn(l)),t.dataset.state="idle",C())},z=e=>{if(0===e.button&&!h&&o)if(o.contains(e.target)){try{o.setPointerCapture?.(e.pointerId)}catch{}v=e.pointerId,c=!0,d=e.clientX-s.x*w(),l.to=1,f=[],t.dataset.state="dragging",C()}else c||i()||(s.v+=420,l.to=0,C())},P=t=>{const e=b();c&&e&&t.pointerId===v&&(s.x=s.to=_((t.clientX-d)/w(),0,e.max),s.v=0,f.push([s.x,performance.now()]),f.length>8&&f.shift(),s.x>=e.max-.5?E():C())},R=t=>{const e=b();if(!e||h)return;if("Enter"===t.key||" "===t.key||"End"===t.key)return t.preventDefault(),void E();const n={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1}[t.key],r="Home"===t.key?0:void 0!==n?_(s.to+n*e.max/4,0,e.max):null;null!==r&&(t.preventDefault(),s.to=r,l.to=r>0?1:0,i()&&(mn(s),mn(l)),r>=e.max-.5?E():C())};o&&(o.hasAttribute("role")||o.setAttribute("role","slider"),o.hasAttribute("tabindex")||(o.tabIndex=0),o.hasAttribute("aria-label")||o.setAttribute("aria-label",a()?.textContent?.trim()||"Slide to confirm"),o.setAttribute("aria-valuemin","0"),o.setAttribute("aria-valuemax","100"),o.setAttribute("aria-valuenow","0"),r.set(o,"touch-action","none"),o.addEventListener("keydown",R));const F=t=>t.preventDefault();return t.dataset.state="idle",t.addEventListener("pointerdown",z),t.addEventListener("pointermove",P),t.addEventListener("pointerup",L),t.addEventListener("pointercancel",L),t.addEventListener("lostpointercapture",L),t.addEventListener("dragstart",F),mt(()=>M,n,()=>M?.refresh(),{confirm:E,reset:$,get confirmed(){return h}},()=>{m&&cancelAnimationFrame(m),x&&clearTimeout(x),m=x=0,o?.removeEventListener("keydown",R),t.removeEventListener("pointerdown",z),t.removeEventListener("pointermove",P),t.removeEventListener("pointerup",L),t.removeEventListener("pointercancel",L),t.removeEventListener("lostpointercapture",L),t.removeEventListener("dragstart",F),r.restore(),delete t.dataset.state,delete t.dataset.confirmed})},exports.stars=ko,exports.statusOrb=function(t,e={}){const n={current:{...It,...e}};let r="idle",o=0,a=0,i="",s="",l=-1e9,c="",d=null;const h=e=>{if(!n.current.colourByState||"idle"===r||"loading"===r)return(e=>nt(n.current.ink??"--ascii-ink-strong",t,e?"#d8d6cf":"#1d1d1b"))(e);const[o,a,i]=Wt[r];return nt(n.current.colors?.[r]??o,t,e?i:a)};d=ft({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=>h(t),kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:()=>[240,240],onFail:()=>{d=null},onTheme:()=>{l=-1e9,c=""},paint:({pen:t,now:e,still:u,dark:p})=>{const f=e-o;Vt(t,r,u?380:e,u?800:f,a,n.current.ring);const m=h(p);m!==s&&(i=s||m,s=m,l=e);const g=u?1:Gt(Math.min(1,(e-l)/200)),x=g<1?it(i,s,g):s;return x!==c&&(c=x,d?.field.update({ink:x})),"loading"===r||f<800||g<1}});const u=e=>{const n=performance.now();"loading"===r&&"loading"!==e&&(a=jt(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 mt(()=>d,n,()=>d?.refresh(),{idle:()=>u("idle"),loading:()=>u("loading"),success:()=>u("success"),warning:()=>u("warning"),error:()=>u("error"),get state(){return r}},()=>{delete t.dataset.state})},exports.streamText=function(t,e={}){const n={current:{...Xn,...e}},r=[...t.childNodes];let o="idle",a="",i=[],s=null,l=0,c=null,d=null,h=null;const u=()=>{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))}},p="roll"===n.current.transition;let f=null,m=null;const g=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))},x=t=>{t.span.style.removeProperty("color"),t.span.style.removeProperty("opacity")},y=()=>{i.forEach(x),i=[],"streaming"===o&&c&&g("done"),c?.(),c=null};if(h=ft({host:t,look:()=>{if(p){return{mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:u().size<24?2:3,cellAspect:.66,glyphScale:1,shade:.2,contrast:1.1,...n.current.look}}const{ch:t,cw:e}=u();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:()=>{h=null,y()},resolution:p?2:1,paint:({pen:e,now:r,still:a,box:l,scale:d})=>{if(p)return((e,r,a,l,d)=>{const h=getComputedStyle(t),p=parseFloat(h.fontSize)||15,{line:f}=u(),m=`${h.fontStyle} ${h.fontWeight} ${h.fontSize} ${h.fontFamily}`;e.setTransform(d,0,0,d,0,0),e.textAlign="left",e.textBaseline="alphabetic",e.font=m;const g=e.measureText("x"),v=g.fontBoundingBoxAscent||.8*p,M=g.fontBoundingBoxDescent||.2*p;a&&(i.forEach(x),i=[]);const b=n.current;if(i=i.filter(t=>{if(r>=t.at)return x(t),!1;const n=_((r-t.from)/Math.max(1,t.at-t.from)),o=Z(n),a=l(t.span);if(t.span.style.setProperty("opacity",Q(.72,1,n).toFixed(3)),n<=0)return!0;const i=a.y+(a.h-f)/2,s=i+(f-v-M)/2+v,c=3+t.seed%3,d=[...Array.from({length:c},(e,n)=>b.glyphs[Math.floor(J(n,t.seed)*b.glyphs.length)]??""),t.span.textContent??""],h=(1-o)*(d.length-1)*f;return e.save(),e.beginPath(),e.rect(a.x-2,i,a.w+4,f),e.clip(),e.globalAlpha=1-Q(.72,1,n),d.forEach((t,n)=>{const r=s+(n-(d.length-1))*f+h;if(r<i-f||r>i+2*f)return;const o=n===d.length-1;e.font=o?m:`600 ${.84*p}px "Geist Mono", ui-monospace, monospace`,e.fillStyle=o?"#fff":"#d0d0d0",e.fillText(t,a.x+(o?0:(a.w-e.measureText(t).width)/2),r)}),e.restore(),!0}),e.globalAlpha=1,!i.length&&c&&y(),b.caret&&"idle"!==o&&(s||"streaming"===o)){const t=i.find(t=>t.from>r),n=t?t.span.previousElementSibling:s,a=n?l(n):{x:0,y:0,w:0,h:f},c=a.y+(a.h-f)/2;e.fillStyle="streaming"===o?"#fff":"rgb(178.5 178.5 178.5)",e.fillRect(a.x+a.w+.18*p,c+.2*f,Math.max(2,.5*p),.6*f)}return i.length>0})(e,r,a,l,d);const{line:h,ch:f,cw:m,size:g}=u(),v=Math.floor(r/48),M=h/4,b=(t,n)=>{const r=Math.floor((t.y-M+t.h/2)/h)*h+M+(h-f)/2,o=Math.round(t.x/m),a=Math.round(255*n);e.fillStyle=`rgb(${a} ${a} ${a})`,e.fillRect(o*m,r,Math.max(1,Math.round((t.x+t.w)/m)-o)*m,f)};if(a&&(i.forEach(x),i=[]),i=i.filter(t=>r>=t.at?(x(t),!1):(b(l(t.span),.55+.45*J(v,t.seed)),!0)),!i.length&&c&&y(),n.current.caret&&"idle"!==o&&(s||"streaming"===o)){const t=s?l(s):{x:0,y:M,w:0,h:h},e=Math.round((t.x+t.w+.3*g)/m)*m;b({x:e,y:t.y,w:m,h:t.h},"streaming"===o?1:_n)}return i.length>0}}),h){const e=getComputedStyle(t),n=h.canvas.style,r=t=>parseFloat(t??"")||0,{line:o}=u(),a=r(e.paddingTop)-o/4,i=r(e.paddingRight)-o/2,s=r(e.paddingBottom)-o/4,l=r(e.paddingLeft);n.top=`${a}px`,n.left=`${l}px`,n.width=`calc(100% - ${l+i}px)`,n.height=`calc(100% - ${a+s}px)`}return mt(()=>h,n,()=>h?.refresh(),{write:e=>{if(!e)return;"streaming"!==o&&("idle"===o&&(t.replaceChildren(...Jn(t)),h&&t.appendChild(h.canvas)),d=null,g("streaming")),a+=e;const r=e=>t.appendChild(e);if(!h)return void r(document.createTextNode(e));const c=performance.now(),u=n.current,f=h.still();let m=0;for(const t of e.match(/\s+|\S/g)??[]){if(/^\s/.test(t)){r(document.createTextNode(t));continue}const e=document.createElement("span");if(e.textContent=t,!f)if(p){const t=i.length?i[i.length-1].from+u.stagger:c,n=Math.max(c,t);e.style.setProperty("opacity","0"),i.push({span:e,from:n,at:n+u.roll,seed:31*l+m})}else e.style.setProperty("color","transparent"),i.push({span:e,from:c,at:c+u.settle+m*u.stagger,seed:31*l+m});r(e),s=e,m++}l++,h.kick()},done:()=>d||("streaming"!==o?Promise.resolve():(d=new Promise(t=>{c=t}),h&&i.length?h.kick():y(),d)),stop(){if("idle"===o&&f)return d=null,g("stopped"),void h?.kick();"streaming"===o&&(i.forEach(x),i=[],g("stopped"),c?.(),c=null,h?.kick())},reasoning:e=>{if(!e||"undefined"==typeof document)return;if(!f||!m){en("ascii-kit-reasoning",Vn),f=document.createElement("div"),f.className="ascii-reasoning";const e=document.createElement("div");e.className="ascii-reasoning-in",m=document.createElement("ol"),e.appendChild(m),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 a=n.current.reducedMotion??tt();a||o.setAttribute("data-new",""),m.appendChild(o);const i=f,s=String(Math.max(0,m.children.length-r));a?i.style.setProperty("--ascii-reasoning-shift",s):(getComputedStyle(o).translate,requestAnimationFrame(()=>{o.removeAttribute("data-new"),i.style.setProperty("--ascii-reasoning-shift",s)}))},reset(){i=[],a="",s=null,l=0,f?.remove(),f=m=null,c?.(),c=null,d=null,t.replaceChildren(...Jn(t)),h&&t.appendChild(h.canvas),g("idle"),h?.kick()},get state(){return o},get text(){return a}},()=>{c?.(),c=null,f?.remove(),f=m=null,t.removeAttribute("aria-busy"),a?t.textContent=a:t.replaceChildren(...r)})},exports.subscribeGlobalLook=function(t){return a.add(t),()=>{a.delete(t)}},exports.swell=gr,exports.swipeDeck=function(t,e={}){const n={current:{...Fn,...e}},r=lt(),o=()=>!!(n.current.reducedMotion??tt()),a=()=>[...t.querySelectorAll(n.current.cards)];let i=0,s=In(0,380,.72),l=In(0,380,.8),c=In(0,260,.9),d=!1,h=0,u=0,p=null,f=[],m=0,g=0,x=-1,y=new Map,v=null,M=null;const b=t=>a()[k(t)]??null,w=()=>t.clientWidth||160,k=t=>{const e=a().length;return e?(t%e+e)%e:0},S=(e,r,o,i)=>{const s=b(e);if(!s||!n.current.loop&&e>=a().length)return null;const l="IMG"===s.tagName?s:s.querySelector("img"),c=`${l?.currentSrc||l?.src||""}|${l?.complete}|${Math.round(r)}x${Math.round(o)}|${i}`,d=y.get(s);if(d?.key===c)return d.canvas;const h=document.createElement("canvas");h.width=Math.max(1,Math.round(r)),h.height=Math.max(1,Math.round(o));const u=h.getContext("2d");if(!u)return null;const p=n.current.radius??(parseFloat(getComputedStyle(t).borderTopLeftRadius)||16);u.beginPath(),u.roundRect(0,0,h.width,h.height,Math.min(p,h.width/2,h.height/2)),u.clip();const f=l?function(t,e,n=.04){if(!t.complete||!t.naturalWidth)return null;const r=Math.min(1,420/Math.max(t.naturalWidth,t.naturalHeight)),o=document.createElement("canvas");o.width=Math.max(1,Math.round(t.naturalWidth*r)),o.height=Math.max(1,Math.round(t.naturalHeight*r));const a=o.getContext("2d",{willReadFrequently:!0});if(!a)return null;try{a.drawImage(t,0,0,o.width,o.height);const r=a.getImageData(0,0,o.width,o.height),i=r.data,s=new Uint32Array(256),l=i.length/4,c=t=>.2126*i[t]+.7152*i[t+1]+.0722*i[t+2];for(let t=0;t<i.length;t+=4)s[Math.round(c(t))]++;let d=0,h=255,u=0;for(let t=0;t<256;t++)if(u+=s[t],u>=.02*l){d=t;break}u=0;for(let t=255;t>=0;t--)if(u+=s[t],u>=.02*l){h=t;break}const p=Math.max(1,h-d);for(let t=0;t<i.length;t+=4){let r=_((c(t)-d)/p);e&&(r=1-r),i[t]=i[t+1]=i[t+2]=Math.round(255*(n+(1-n)*r)),i[t+3]=255}return a.putImageData(r,0,0),o}catch{return null}}(l,i):null;if(f){const t=Math.max(h.width/f.width,h.height/f.height),e=h.width/t,n=h.height/t;u.drawImage(f,(f.width-e)/2,(f.height-n)/2,e,n,0,0,h.width,h.height)}else u.fillStyle="rgb(60 60 60)",u.fillRect(0,0,h.width,h.height);return u.strokeStyle="rgb(150 150 150)",u.lineWidth=6,u.stroke(),y.set(s,{key:c,canvas:h}),h};function A(){const e=a(),o=i+(p?1:0),s=!n.current.loop&&o>=e.length?null:b(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=ft({host:t,outset:n.current.outset,look:()=>({blend:"coarse",mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:4,cellAspect:.62,glyphScale:.94,contrast:1.3,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{M=null,r.restore(),A()},onTheme:()=>{y=new Map},paint:({pen:e,w:n,now:r,dark:o,box:a})=>{const d=a(t),h=d.w,u=d.h,f=d.x+h/2,m=d.y+u/2,g=_(c.x),x=(t,n,r,a,i=0)=>{const s=S(t,h,u,!o);!s||a<=0||(e.save(),e.translate(f,m+r),e.scale(n,n),e.globalAlpha=a,e.drawImage(s,-h/2,-u/2),i>0&&(e.globalCompositeOperation="destination-out",e.globalAlpha=i,e.drawImage(((t,e)=>{let n=v;if(!n||n.width!==Math.round(t)||n.height!==Math.round(e)){n=v=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})(h,u),-h/2,-u/2)),e.restore())};x(i+2,Tn(.86,.93,g),Tn(24,12,g),Tn(.3,.55,g),.3),x(i+1,Tn(.93,1,g),Tn(12,0,g),Tn(.55,1,g),.4*(1-g));const y=S(i,h,u,!o);if(!y)return!1;const M=p?_((r-p.start)/620):0,b=p?.dir??1,w=p?p.x0+b*h*.9*(1-(1-M)**3):s.x,k=p?p.y0:l.x;if(e.save(),e.translate(f+w,m+k),e.rotate(.22*_(w/h,-1.6,1.6)),!p)return e.drawImage(y,-h/2,-u/2),e.restore(),!1;const A=Math.ceil(u/6);for(let t=0;t<A;t++){const r=Wn[t%Wn.length],o=_(1.55*M-.55*r);if(o>=1)continue;const a=b*o*o*h*(.5+.9*r),i=6*t,s=Math.min(6,u-i),l=b>0?f+w+a+.62*h:f+w+a-.62*h,c=b>0?n-4-l:l-4;e.globalAlpha=(1-o*o)*_(c/56),e.drawImage(y,0,i,h,s,-h/2+a,-u/2+i,h,s)}return e.restore(),!1}});const C=e=>{m=0;const o=Math.min(1/30,Math.max(0,(e-g)/1e3));g=e;let a=!1;d||p||(a=fn(s,o,.3),a=fn(l,o,.3)||a),a=fn(c,o,.002)||a,p&&e-p.start>=620&&(p=null,i+=1,$()),(()=>{(n.current.leanTarget??t).style.setProperty("--ascii-lean",String(p?0:_(s.x/(.4*w()),-1,1)));const e=b(i);!M&&e&&r.set(e,"transform",`translate(${s.x}px, ${l.x}px) rotate(${.22*_(s.x/w(),-1.6,1.6)}rad)`)})(),M?.kick(),(a||d||p)&&(m=requestAnimationFrame(C))},E=()=>{m||(g=performance.now(),m=requestAnimationFrame(C))},$=()=>{s=In(0,380,.72),l=In(0,380,.8),c=In(0,260,.9)},L=(t=1)=>{const e=a();if(p||!e.length||!n.current.loop&&i>=e.length)return!1;const h=b(i),u=k(i);return d=!1,o()||!M?(i+=1,$(),M||r.set(h,"transform","")):(p={dir:t,start:performance.now(),x0:s.x,y0:l.x},c.to=1),A(),E(),n.current.onSwipe?.(t,u,h),!0},z=t=>{if(!d||void 0!==t&&void 0!==t.pointerId&&t.pointerId!==x)return;d=!1;const e=gn(f,performance.now()),r=w();Math.abs(s.x)>r*n.current.threshold||Math.abs(e)>650&&Math.sign(e)===Math.sign(s.x)&&Math.abs(s.x)>16?L(s.x<0?-1:1):(s.to=0,l.to=0,c.to=0,s.v=.2*_(e,-1600,1600),o()&&(s.x=l.x=c.x=0,s.v=l.v=c.v=0),E())},P=()=>t.getBoundingClientRect().width/(t.clientWidth||1)||1,R=e=>{if(0!==e.button||p)return;try{t.setPointerCapture?.(e.pointerId)}catch{}x=e.pointerId;const n=P();d=!0,h=e.clientX-s.x*n,u=e.clientY-l.x/.3*n,f=[],E()},F=t=>{if(!d||t.pointerId!==x)return;const e=P();s.x=s.to=(t.clientX-h)/e,l.x=l.to=(t.clientY-u)/e*.3,s.v=l.v=0,c.to=.5*_(Math.abs(s.x)/w()),f.push([s.x,performance.now()]),f.length>8&&f.shift(),E()},T=t=>{"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||(t.preventDefault(),L("ArrowRight"===t.key?1:-1))},I=()=>M?.kick(),W=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",R),t.addEventListener("pointermove",F),t.addEventListener("pointerup",z),t.addEventListener("pointercancel",z),t.addEventListener("lostpointercapture",z),t.addEventListener("keydown",T),t.addEventListener("load",I,!0),t.addEventListener("dragstart",W),mt(()=>M,n,()=>{y=new Map,A(),M?.refresh()},{next:L,get index(){return k(i+(p?1:0))}},()=>{m&&cancelAnimationFrame(m),m=0,r.restore(),a().forEach(t=>{t.hidden=!1,t.removeAttribute("aria-hidden")}),(n.current.leanTarget??t).style.removeProperty("--ascii-lean"),t.removeAttribute("aria-roledescription"),t.removeEventListener("pointerdown",R),t.removeEventListener("pointermove",F),t.removeEventListener("pointerup",z),t.removeEventListener("pointercancel",z),t.removeEventListener("lostpointercapture",z),t.removeEventListener("keydown",T),t.removeEventListener("load",I,!0),t.removeEventListener("dragstart",W)})},exports.tabs=function(t,e={}){const n={current:{...de,...e}},r=()=>[...t.querySelectorAll(n.current.tabs)],o=r().findIndex(t=>"true"===t.getAttribute("aria-selected"));let a=Math.max(0,n.current.active??(o>=0?o:0)),i=-1e6,s=null,l=null;const c=lt(),d=()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:.62,glyphScale:.96,blend:"off",...n.current.look}),h=e=>{const n=dt(t,e);return{...n,x:n.x-t.clientLeft,y:n.y-t.clientTop}},u=e=>{l=e;const n=t=>Math.round(100*t)/100+"px";c.set(t,"--tabs-x",n(e.x)),c.set(t,"--tabs-y",n(e.y)),c.set(t,"--tabs-w",n(e.w)),c.set(t,"--tabs-h",n(e.h))},p=()=>{const t=r()[a];t&&u(h(t))};let f=null;f=ft({host:t,layer:"under",look:d,ink:()=>n.current.ink??"--ascii-ink",kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{f=null,p()},paint:({pen:t,now:e,still:o})=>{const l=r()[a];if(!l)return!1;const c=h(l),p=o||!s?1:_((e-i)/n.current.duration),m=p<1?function(t,e,n){const r=Math.sign(e.x+e.w/2-(t.x+t.w/2))||1,o=K(n/.78,4),a=K((n-.14)/.86,4);return{left:t.x+(e.x-t.x)*(r>0?a:o),right:t.x+t.w+(e.x+e.w-t.x-t.w)*(r>0?o:a),dir:r}}(s,c,p):{left:c.x,right:c.x+c.w,dir:1},g={x:m.left,y:c.y,w:m.right-m.left,h:c.h};u(g),p>=1&&(s=null);const x=d(),y=Math.min(2,globalThis.devicePixelRatio||1),v=Math.max(2,Math.round((x.cellSize??6)*y)),M=v/y,b=Math.max(2,Math.round(v*(x.cellAspect??.62)))/y,{n:w,x0:k}=function(t,e,n=20){const r=Math.max(0,Math.floor((t-2*n)/e));return{n:r,x0:(t-r*e)/2}}(g.w,b),S=t=>p<1?t:Math.round(t*y)/y,A=S(g.x+k),C=S(g.y+g.h-7-M),E=(A%b+b)%b-b,$=(C%M+M)%M-M,L=f.canvas,z=`${E.toFixed(3)}px ${$.toFixed(3)}px`;L.style.translate!==z&&(L.style.translate=z);const P=t=>`${Math.max(0,t).toFixed(2)}px`,R=A-E,F=C-$,T=`inset(${P(F)} ${P(L.clientWidth-R-w*b)} ${P(L.clientHeight-F-M)} ${P(R)})`;L.style.clipPath!==T&&(L.style.clipPath=T);const I=p<1?1-K(p,2):0;for(let e=0;e<w;e++){const n=w>1?e/(w-1):.5,r=m.dir>0?n:1-n,o=Q(0,.42,1-Math.abs(2*n-1))*(.5+I*(.5*r**1.4-.2));t.fillStyle=`rgb(${Math.round(255*o)} ${Math.round(255*o)} ${Math.round(255*o)})`,t.fillRect(A-E+e*b,C-$,b,M)}return p<1}});const m=()=>{const t=n.current;r().forEach((e,n)=>{const r=n===a;t.manage&&(e.setAttribute("aria-selected",String(r)),e.tabIndex=r?0:-1);const o=e.getAttribute("aria-controls")?document.getElementById(e.getAttribute("aria-controls")):null;o&&"none"!==t.panels&&("hidden"===t.panels?o.hidden=!r:o.toggleAttribute("data-active",r))})},g=(t,e=!1)=>{const o=r();if(!o.length)return;const c=(t%o.length+o.length)%o.length;e&&o[c].focus(),c!==a&&(s=l??h(o[a]),a=c,i=performance.now(),m(),f&&!f.still()||(s=null,p()),f.kick(),n.current.onChange?.(c,o[c]))},x=t=>{if(!n.current.manage)return;const e=t.target.closest?.(n.current.tabs),o=e?r().indexOf(e):-1;o>=0&&g(o)},y=t=>{if(!n.current.manage)return;const e={ArrowRight:a+1,ArrowLeft:a-1,Home:0,End:r().length-1};t.key in e&&(t.preventDefault(),g(e[t.key],!0))},v="function"==typeof ResizeObserver?new ResizeObserver(()=>{f?.live||p()}):null;return v?.observe(t),t.addEventListener("click",x),t.addEventListener("keydown",y),m(),p(),mt(()=>f,n,t=>{void 0!==t.active&&t.active!==a&&g(t.active),m(),f?.refresh()},{select:g,get active(){return a}},()=>{t.removeEventListener("click",x),t.removeEventListener("keydown",y),v?.disconnect(),c.restore()})},exports.terrain=So,exports.thinking=function(t,e={}){const n={current:{...jn,...e}},r=lt(),o=[...t.childNodes],a=n.current.label??null,i=a?[...a.childNodes]:[];let s="done",l=0,c=0,d=-1e9,h=0,u="",p=null;const f=a?ct("",!0):null,m=document.createElement("span");let g="",x="";const y=()=>n.current.reducedMotion??tt(),v=(t,e)=>{x=g,g=t,a&&(f&&(f.textContent=t),p?(m.replaceChildren(...[...t].map(t=>Object.assign(document.createElement("span"),{textContent:t}))),d=e?performance.now():-1e9,p.kick()):a.textContent=t)};a&&(p=ft({host:a,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:2,cellAspect:.66,glyphScale:1,shade:.2,contrast:1.1,...n.current.look}),ink:()=>n.current.ink??getComputedStyle(a).color,kit:n,reducedMotion:()=>n.current.reducedMotion,resolution:2,onFail:()=>{p=null,a.textContent=g,r.restore()},paint:({pen:t,now:e,still:r,box:o,scale:a})=>{const i=getComputedStyle(m),l=parseFloat(i.fontSize)||14,h=`${i.fontStyle} ${i.fontWeight} ${i.fontSize} ${i.fontFamily}`;t.setTransform(a,0,0,a,0,0),t.textAlign="center",t.textBaseline="alphabetic",t.font=h;const u=t.measureText("x"),p=u.fontBoundingBoxAscent||.8*l,f=u.fontBoundingBoxDescent||.2*l,g=n.current,y=[...m.children],v=e-d<g.roll+y.length*g.wave,M=y.length*g.wave+g.roll+420;let b=!1;return y.forEach((n,a)=>{let i=1;if(!r&&v)i=_((e-d-a*g.wave)/g.roll);else if(!r&&"thinking"===s){const t=(e-c)%M-a*g.wave;i=t<0||t>g.roll?1:t/g.roll}const u=i<1?Q(.7,1,i).toFixed(3):"";if(n.style.opacity!==u&&(n.style.opacity=u),i>=1||!n.textContent?.trim())return;b=!0;const m=o(n),y=m.y+(m.h-p-f)/2+p,w=m.x+m.w/2,k=v?x[a]??" ":n.textContent,S=n.textContent,A=[k,...Array.from({length:3},(t,e)=>g.glyphs[Math.floor(J(e+7*a,Math.floor(c))*g.glyphs.length)]??""),S],C=Z(i)*(A.length-1)*m.h;t.save(),t.beginPath(),t.rect(m.x-2,m.y,m.w+4,m.h),t.clip(),t.globalAlpha=1-Q(.7,1,i),A.forEach((e,n)=>{const r=y+n*m.h-C;if(r<m.y-m.h||r>m.y+2*m.h)return;const o=0===n||n===A.length-1;t.font=o?h:`600 ${.86*l}px "Geist Mono", ui-monospace, monospace`,t.fillStyle=o?"#fff":"#d0d0d0",t.fillText(e,w,r)}),t.restore()}),t.globalAlpha=1,b||!r&&("thinking"===s||v)}}),p&&f&&(r.set(m,"display","inline-flex"),r.set(m,"white-space","pre"),m.setAttribute("aria-hidden","true"),a.replaceChildren(f,m,p.canvas)));const M=document.createElement("span"),b=()=>{h++,s="thinking",c=performance.now(),u="",M.replaceChildren(),t.replaceChildren(M),t.setAttribute("aria-busy","true"),v(n.current.labels?.thinking??"Thinking…",!1),n.current.onState?.("thinking",0),p?.kick()};let w=0,k=0;return n.current.start&&b(),mt(()=>p,n,()=>p?.refresh(),{think:b,stream:async e=>{"thinking"!==s&&b();const o=h;w=0;let a="";const i=()=>{"thinking"===s&&(s="streaming",k=performance.now(),l=Math.max(1,Math.round((k-c)/1e3)),v((n.current.labels?.done??Un)(l),!0),n.current.onState?.("streaming",l))},d=(t,e)=>{a+=t;const o=e?a.length:a.search(/\s\S*$/)+1;o<=0||(i(),u+=a.slice(0,o),(t=>{const e=!y()&&!p?.still();for(const o of t.match(/\s+|\S+/g)??[]){if(/^\s/.test(o)){M.append(o);continue}const t=document.createElement("span");if(t.textContent=o,e){r.set(t,"opacity","0");const e=Math.max(0,w*n.current.stagger-(performance.now()-k));r.set(t,"transition",`opacity 260ms cubic-bezier(.16, 1, .3, 1) ${Math.round(e)}ms`),requestAnimationFrame(()=>requestAnimationFrame(()=>t.style.setProperty("opacity","1")))}w++,M.appendChild(t)}})(a.slice(0,o)),a=a.slice(o))};if("string"==typeof e)d(e,!0);else{for await(const t of e){if(o!==h)return;d(t,!1)}if(o!==h)return;d("",!0)}i();const f=y()?0:Math.max(0,w*n.current.stagger-(performance.now()-k))+260;await new Promise(t=>setTimeout(t,f)),o===h&&(s="done",t.setAttribute("aria-busy","false"),n.current.onState?.("done",l),p?.kick())},get state(){return s}},()=>{h++,r.restore(),t.removeAttribute("aria-busy"),u?t.textContent=u:t.replaceChildren(...o),a&&(g?a.textContent=g:a.replaceChildren(...i))})},exports.toastStack=function(t,e={}){const n={current:{...Nn,...e}},r=lt(),o=document.createElement("ol"),a=ct("",!1);a.setAttribute("role","status");let i=[],s=[],l=0,c=!1,d=!1,h=!1,u=!1,p=null;const f=[];en("ascii-kit-toast",Gn),o.className="ascii-toasts",o.setAttribute("aria-label",n.current.label),t.append(o,a);const m=new WeakSet,g=e=>{const r=nt(n.current.ink??"--ascii-ink-strong",t,st(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(_(+t,0,255)).toString(16).padStart(2,"0")).join("")}`,[o,a]=[Dn(r),Dn(e)].sort((t,e)=>e-t);return(o+.05)/(a+.05)<3}(getComputedStyle(e).backgroundColor,r)&&(m.add(e),e.style.setProperty("transition","none","important"),e.style.setProperty("background-color","transparent","important"),e.style.setProperty("box-shadow","none","important"))},x=t=>{delete t.dataset.forming,m.delete(t)&&(t.style.removeProperty("transition"),t.style.removeProperty("background-color"),t.style.removeProperty("box-shadow"))};p=ft({host:t,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,...n.current.look}),outset:24,resolution:2,ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,onFail:()=>{p=null,s=[];for(const t of i)x(t.node)},paint:({pen:t,now:e,scale:n,still:r,box:o})=>(t.setTransform(n,0,0,n,0,0),s=s.filter(n=>{const r=(e-n.start)/n.ms;if(n.form&&r>=.62&&x(n.node),r>=1)return!1;if(n.form)tn(t,n.snap,n.blocks,n.order,1.04*Z(r),(t,e)=>[70*(t.seed-.5)*e,(14+26*J(t.x,t.y))*e],1-_((r-.62)/.28));else{const e=n.dir;tn(t,n.snap,n.blocks,n.order,1-1.04*(1-(1-r)**3),(t,r)=>[e*(14+34*t.seed+.5*Math.abs(n.throw))*r,14*(J(t.y,t.x)-.35)*r],1-_((r-.75)/.25))}return!0}),s.length>0)}),p&&(p.canvas.style.zIndex="11");const y=()=>!!p&&p.live&&!p.still(),v=()=>{const t=i.filter(t=>void 0===t.node.dataset.gone);t.forEach((e,n)=>{const o=t.length-1-n;r.set(e.node,"--d",String(o)),0===o?(e.node.dataset.front="",delete e.node.dataset.back):(e.node.dataset.back="",delete e.node.dataset.front)})},M=(e,n,r=0)=>{if(!p)return;const o=Ze(e,p.canvas.clientWidth||t.clientWidth+48,p.canvas.clientHeight||t.clientHeight+48,p.box),a=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:J(o,t)}))}return n}(o.rects),i=Math.max(1,...a.map(t=>t.x)),l=r<0?-1:1,c=l>0?t=>t.x/i:t=>1-t.x/i,d=Float32Array.from(a,t=>n?t.x/i*.3+.7*t.seed:.62*c(t)+.38*t.seed);s.push({start:performance.now(),ms:n?340:440,snap:o.canvas,blocks:a,order:d,form:n,node:e,dir:l,throw:r}),p.kick()},b=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))},w=()=>(t=>{if(t!==c){c=t,t?o.dataset.open="":delete o.dataset.open;for(const e of i)t&&e.timer&&(clearTimeout(e.timer),e.timer=0,e.left=Math.max(400,e.left-(performance.now()-e.since))),t||b(e)}})(d||h),k=()=>{d=!0,w()},S=()=>{d=!1,w()},A=()=>{h=!0,w()},C=t=>{o.contains(t.relatedTarget)||(h=!1,w())};function E(t,e=0){const n=i.find(e=>e.id===t);if(!n||void 0!==n.node.dataset.gone)return;n.timer&&clearTimeout(n.timer);const r=()=>{i=i.filter(t=>t!==n),s=s.filter(t=>t.node!==n.node),n.node.remove(),v(),p?.kick(),i.some(t=>void 0===t.node.dataset.gone)||(d=h=!1,w())},o=i[i.length-1]===n;y()&&(o||c||e)?(x(n.node),M(n.node,!1,e),n.node.dataset.gone="",v(),f.push(setTimeout(r,220))):r()}o.addEventListener("pointerenter",k),o.addEventListener("pointerleave",S),o.addEventListener("focusin",A),o.addEventListener("focusout",C);let $=null;const L=t=>{if(!n.current.swipe||0!==t.button||$)return;const e=t.target;if(e?.closest?.('button, a, input, textarea, select, [role="button"]'))return;const r=e?.closest?.("[data-toast]"),o=r&&i.find(t=>t.node===r);o&&void 0===r.dataset.gone&&void 0===r.dataset.forming&&($={item:o,id:t.pointerId,x0:t.clientX,dx:0,t:performance.now(),v:0},r.dataset.swiping="",r.setPointerCapture?.(t.pointerId))},z=t=>{if(!$||t.pointerId!==$.id)return;const e=performance.now(),n=t.clientX-$.x0;$.v=(n-$.dx)/Math.max(1,e-$.t),$.dx=n,$.t=e,$.item.node.style.setProperty("transform",`translateX(${n}px)`),$.item.node.style.setProperty("opacity",String(_(1-Math.abs(n)/260,.2)))},P=t=>{if(!$||t.pointerId!==$.id)return;const{item:e,dx:n}=$,r=e.node,o=performance.now()-$.t>90?0:$.v;$=null,delete r.dataset.swiping;const a=Math.abs(n)>64||Math.abs(o)>.45&&Math.abs(n)>8;r.style.removeProperty("opacity"),a?(E(e.id,n||o),r.style.setProperty("transform",`translateX(${n+48*Math.sign(n||o)}px)`)):r.style.removeProperty("transform")};return o.addEventListener("pointerdown",L),o.addEventListener("pointermove",z),o.addEventListener("pointerup",P),o.addEventListener("pointercancel",P),mt(()=>p,n,t=>{o.setAttribute("aria-label",t.label),p?.refresh()},{push:t=>{if(u)return-1;const e=++l,r=i.filter(t=>void 0===t.node.dataset.gone),s=r.length+1-Math.max(1,n.current.max);s>0&&r.slice(0,s).forEach(t=>E(t.id));const c=n.current.render?n.current.render(t,e):function(t,e){const n=(t,e,n)=>{const r=document.createElement(t);return r.className=e,n&&(r.dataset.paint=n),r},r=n("li","ascii-toast");if(void 0!==t.icon){const e=n("span","ascii-toast-icon","tile");e.setAttribute("aria-hidden","true"),"string"==typeof t.icon?e.textContent=t.icon:e.appendChild(t.icon),r.appendChild(e)}const o=n("span","ascii-toast-text"),a=n("b","ascii-toast-title","strong");if(a.textContent=t.title,o.appendChild(a),t.body){const e=n("span","ascii-toast-body","meta");e.textContent=t.body,o.appendChild(e)}if(r.appendChild(o),t.action){const{label:o,onClick:a}=t.action,i=n("button","ascii-toast-action","text");i.type="button",i.textContent=o,i.addEventListener("click",()=>{a(),e()}),r.appendChild(i)}const i=n("button","ascii-toast-close","none");return i.type="button",i.setAttribute("aria-label",`Dismiss ${t.title}`),i.textContent="×",i.addEventListener("click",e),r.appendChild(i),r}(t,()=>E(e));c.dataset.toast=String(e);const d={id:e,node:c,timer:0,left:t.duration??n.current.duration,since:0,born:performance.now()};return i.push(d),o.appendChild(c),v(),a.textContent=t.body?`${t.title}. ${t.body}`:t.title,y()?(c.dataset.forming="",g(c),M(c,!0)):p?.kick(),b(d),e},dismiss:t=>E(t),clear(){[...i].forEach(t=>E(t.id))},get toasts(){return i.filter(t=>void 0===t.node.dataset.gone).map(t=>t.id)}},()=>{u=!0;for(const t of i)t.timer&&clearTimeout(t.timer);f.forEach(clearTimeout),o.removeEventListener("pointerenter",k),o.removeEventListener("pointerleave",S),o.removeEventListener("focusin",A),o.removeEventListener("focusout",C),o.removeEventListener("pointerdown",L),o.removeEventListener("pointermove",z),o.removeEventListener("pointerup",P),o.removeEventListener("pointercancel",P),i=[],s=[],o.remove(),a.remove(),r.restore()})},exports.veil=Co,exports.voiceOrb=function(t,e={}){const n={current:{...Te,...e}},r=lt();let o="idle",a=0,i=_(n.current.level??0),s=i,l=0,c=0,d=Ie(n.current.palette),h=null,u=null,p=0;const f=t=>{t.canvas.style.filter=!t.dark()&&d.length?"brightness(.68) saturate(1.35)":""},m=e=>{t.style.setProperty("--ascii-level",e.toFixed(3)),n.current.swell&&r.set(t,"scale",String(1+.1*e))};h=ft({host:t,outset:Math.round(.08*(t.offsetWidth||0)),look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:6,cellAspect:.62,glyphScale:.92,fit:"cover",color:d.length?"source":"ink",contrast:2.2,brightness:1.1-.5,saturation:1.4,...n.current.look}),ink:()=>n.current.ink??"--ascii-ink-strong",kit:n,reducedMotion:()=>n.current.reducedMotion,onTheme:()=>h&&f(h),onFail:()=>{h=null},paint:({pen:t,w:e,h:n,now:r,still:h})=>{const p=c?Math.min(64,r-c):16;c=r;const f=_((t=>"listening"===o?u?u.read():i:"thinking"===o?.2+.1*Math.sin((t-a)/120):"done"===o?l*(1-Z(_((t-a)/420))):i)(r));return h||"done"===o?s=f:s+=(f-s)*(1-(1-(f>s?.45:.12))**(p/16.7)),h||m(s),function(t,e,n,r,o,a){const i=t=>{const e=Math.round(255*_(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,h=r*(.25+.6*o),u=t.createRadialGradient(s,l,.92*c,s,l,1.3*c);u.addColorStop(0,i(.36*d)),u.addColorStop(1,"#000"),t.fillStyle=u,t.fillRect(0,0,e,n),t.save(),t.beginPath(),t.arc(s,l,c,0,2*Math.PI),t.clip();const p=s+.8*Math.cos(h)*c*.62,f=l-.55*c*.62,m=t.createRadialGradient(p,f,0,p,f,1.7*c);m.addColorStop(0,i(.95*d)),m.addColorStop(.55,i(.5*d)),m.addColorStop(1,i(.18)),t.fillStyle=m,t.fillRect(s-c,l-c,2*c,2*c),t.globalCompositeOperation="lighter",t.lineWidth=Math.max(1.5,.05*c);for(let e=0;e<6;e++){const n=e/6*Math.PI+.35*r,o=Math.sin(n);o<0||(t.strokeStyle=i(.16*o),t.beginPath(),t.ellipse(s,l,c*Math.abs(Math.cos(n)),c,0,0,2*Math.PI),t.stroke())}const g=t.createRadialGradient(s,l,.7*c,s,l,c);if(g.addColorStop(0,"#000"),g.addColorStop(1,i(.3)),t.fillStyle=g,t.fillRect(s-c,l-c,2*c,2*c),t.restore(),t.globalCompositeOperation="source-over",!a.length)return;t.globalCompositeOperation="color";const x=.4*r,y=.5*o,v=t.createLinearGradient(s-Math.cos(x)*c,l-Math.sin(x)*c,s+Math.cos(x)*c,l+Math.sin(x)*c);v.addColorStop(0,We(a,y)),v.addColorStop(.5,We(a,y+.25)),v.addColorStop(1,We(a,y+.5)),t.fillStyle=v,t.fillRect(0,0,e,n),t.globalCompositeOperation="source-over"}(t,e,n,h?0:r/1e3,s,d),!0}}),h&&f(h);const g=()=>{p++,u&&(u.stream.getTracks().forEach(t=>t.stop()),u.context.close().catch(()=>{}),u=null)},x=e=>{"listening"!==e&&g(),"done"===e&&(l=s),o=e,a=performance.now(),t.dataset.state=e,h||m("listening"===e?i:0),h?.kick()};return mt(()=>h,n,t=>{d=Ie(t.palette),void 0!==t.level&&(i=_(t.level)),h?.refresh(),h&&f(h)},{level(t){i=_(Number.isFinite(t)?t:0),h||"listening"!==o||m(i),h?.kick()},listen:()=>x("listening"),think:()=>x("thinking"),done:()=>x("done"),idle:()=>{i=0,x("idle")},async mic(){g();const t=p,e="undefined"!=typeof navigator?navigator.mediaDevices:void 0,n=globalThis.AudioContext;if(!e?.getUserMedia||!n)return!1;let r;try{r=await e.getUserMedia({audio:!0})}catch{return!1}if(t!==p)return r.getTracks().forEach(t=>t.stop()),!1;const o=new n,a=o.createAnalyser();a.fftSize=1024,o.createMediaStreamSource(r).connect(a);const i=new Uint8Array(a.fftSize);return u={stream:r,context:o,read(){a.getByteTimeDomainData(i);let t=0;for(const e of i)t+=((e-128)/128)**2;return 5*Math.sqrt(t/i.length)}},x("listening"),!0},get state(){return o},get current(){return s}},()=>{g(),r.restore(),t.style.removeProperty("--ascii-level"),delete t.dataset.state})},exports.voidWell=Eo,exports.wave=$o,exports.weave=zo,exports.wordField=yr,exports.wordmark=function(t,e={}){const n=(t.textContent??"").trim(),r={current:{...Le,...e}};let o=r.current.text??n;const a=lt(),i=()=>function(t,e=Le.font,n=Le.fontWeight,r=520){const{canvas:o,pen:a}=ve(1800,Math.max(1,Math.round(r))),i=Math.min(400,1700/Math.max(3,.56*[...t].length));return a.fillStyle="#fff",a.textAlign="center",a.textBaseline="middle",a.font=`${n} ${i}px ${e}`,a.fillText(t||" ",o.width/2,o.height/2+.05*i),o}(o,r.current.font,r.current.fontWeight,r.current.artHeight),s=!n;let l=null;l=xe({host:t,layer:"over",look:()=>({mark:"glyph",scene:"none",charset:" .:-=+*#%@",font:'"Geist", Arial, sans-serif',fontWeight:500,cellSize:7,cellAspect:.8,glyphScale:.8,color:"ink",shade:0,contrast:1.3,levels:"auto",fit:"contain",focus:{x:.5,y:.5},hover:"trail",trail:{strength:.62,radius:.22},...r.current.look}),ink:()=>r.current.ink??"--ascii-ink-strong",source:i(),label:s?r.current.label??o:void 0,kit:r,reducedMotion:()=>r.current.reducedMotion,onFail:()=>{l=null,a.restore()}}),l&&n&&a.set(t,"color","transparent"),l&&document.fonts?.load?.(`${r.current.fontWeight} 100px ${r.current.font}`).then(()=>{l&&l.field.setSource(i())},()=>{});const c=e=>{if(e!==o)if(o=e,void 0!==r.current.text&&(r.current={...r.current,text:o}),l)if(l.field.setSource(i()),s)l.field.update({label:r.current.label??(o||" ")});else{for(const e of[...t.childNodes])e!==l.canvas&&e.remove();t.prepend(document.createTextNode(o))}else n&&(t.textContent=o)};return ye(()=>l,r,t=>{void 0!==t.text&&t.text!==o?c(t.text):l&&l.field.setSource(i())},{setText:c,get text(){return o}},()=>a.restore())};//# sourceMappingURL=kit.cjs.map