asciify-engine 4.24.0 → 4.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +325 -0
- package/README.md +71 -718
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/field.cjs +1 -1
- package/dist/field.d.cts +132 -272
- package/dist/field.d.ts +132 -272
- package/dist/field.js +1 -1
- package/dist/glyph-field-C2fQIlnq.d.cts +292 -0
- package/dist/glyph-field-DRC-7uVf.d.ts +292 -0
- package/dist/hover.cjs +1 -1
- package/dist/hover.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/kit/chunk-2FH6GGV6.js +1 -0
- package/dist/kit/chunk-2GAV4OAK.js +1 -0
- package/dist/kit/{chunk-C4KZYCPF.js → chunk-2LBQ7QJT.js} +1 -1
- package/dist/kit/{chunk-BN7HL52Z.js → chunk-3LJ5C3U3.js} +1 -1
- package/dist/kit/{chunk-NURPDP3Y.js → chunk-3MHEDZLZ.js} +1 -1
- package/dist/kit/{chunk-BR6ZNJZW.js → chunk-3OD5BMF5.js} +1 -1
- package/dist/kit/{chunk-C3C7AYKL.js → chunk-3VEMKDBW.js} +1 -1
- package/dist/kit/{chunk-PFKYKAIP.js → chunk-42KMN727.js} +1 -1
- package/dist/kit/{chunk-2CF4PX6U.js → chunk-6G5MPND3.js} +1 -1
- package/dist/kit/{chunk-QALCXKU6.js → chunk-6WU247CB.js} +1 -1
- package/dist/kit/{chunk-YBRP6BFW.js → chunk-776H2BJ7.js} +1 -1
- package/dist/kit/chunk-7DXSG526.js +1 -0
- package/dist/kit/{chunk-H2UZBVKE.js → chunk-7M2FFUZ3.js} +1 -1
- package/dist/kit/{chunk-5BEBNKYM.js → chunk-7NVKRDKE.js} +1 -1
- package/dist/kit/{chunk-XB4DKPGL.js → chunk-AIGAJMNN.js} +1 -1
- package/dist/kit/{chunk-O7SGY4YJ.js → chunk-B3TY6UXJ.js} +1 -1
- package/dist/kit/{chunk-XDKKCIIL.js → chunk-BFBG3VHI.js} +1 -1
- package/dist/kit/{chunk-3A5LID2G.js → chunk-CG6SGQMY.js} +1 -1
- package/dist/kit/{chunk-T3GWGPST.js → chunk-CGSWUO67.js} +1 -1
- package/dist/kit/{chunk-DFOWXOZR.js → chunk-DAJSBX6H.js} +1 -1
- package/dist/kit/{chunk-IUKSHYED.js → chunk-DCLJHSWM.js} +1 -1
- package/dist/kit/{chunk-W2STAN6V.js → chunk-DMRPBFLW.js} +1 -1
- package/dist/kit/{chunk-XANKANGR.js → chunk-E3FPFANJ.js} +1 -1
- package/dist/kit/{chunk-VC2ZQG63.js → chunk-EKYEA7Z4.js} +1 -1
- package/dist/kit/{chunk-IQTGJRDX.js → chunk-F6F2C3RH.js} +1 -1
- package/dist/kit/chunk-FEAFQY7O.js +1 -0
- package/dist/kit/{chunk-FUI5AVIF.js → chunk-FHN3PPSI.js} +1 -1
- package/dist/kit/{chunk-QRCXXS5Z.js → chunk-FPCCX4FM.js} +1 -1
- package/dist/kit/{chunk-TTGMK4EA.js → chunk-FWODCYYJ.js} +1 -1
- package/dist/kit/{chunk-AIM3J2US.js → chunk-GBNV3GXG.js} +1 -1
- package/dist/kit/chunk-GF72XM4C.js +1 -0
- package/dist/kit/{chunk-SARCZMLN.js → chunk-GKR3ROYR.js} +1 -1
- package/dist/kit/{chunk-ROR6MG3K.js → chunk-H5KHXZWR.js} +1 -1
- package/dist/kit/{chunk-PCIAA2LL.js → chunk-I5R2347P.js} +1 -1
- package/dist/kit/{chunk-4QHFEMFS.js → chunk-IBNDCKEX.js} +1 -1
- package/dist/kit/{chunk-J2YZBT3N.js → chunk-ILXVBO7M.js} +1 -1
- package/dist/kit/{chunk-S62H7ZIU.js → chunk-JELJEEJO.js} +1 -1
- package/dist/kit/{chunk-2NVKPXPL.js → chunk-K6JX64AS.js} +1 -1
- package/dist/kit/{chunk-3473NPIN.js → chunk-KCEYRIU4.js} +1 -1
- package/dist/kit/{chunk-HTUGMGVA.js → chunk-KDROJANO.js} +1 -1
- package/dist/kit/{chunk-5QE6UMXN.js → chunk-KEE55QSD.js} +1 -1
- package/dist/kit/{chunk-MIZ2DUHU.js → chunk-KFXMLIVF.js} +1 -1
- package/dist/kit/{chunk-G57QACJG.js → chunk-KLRF3S7O.js} +1 -1
- package/dist/kit/{chunk-ENTDGT2V.js → chunk-KXI3T72F.js} +1 -1
- package/dist/kit/{chunk-4ZQFDFEH.js → chunk-KY5KCIZE.js} +1 -1
- package/dist/kit/{chunk-4OT66HSZ.js → chunk-LE53AVKR.js} +1 -1
- package/dist/kit/{chunk-WJLZM3DR.js → chunk-LVCGC3SO.js} +1 -1
- package/dist/kit/chunk-M5VVLYI2.js +1 -0
- package/dist/kit/{chunk-7ABNWOW4.js → chunk-MJJSZS23.js} +1 -1
- package/dist/kit/{chunk-VVW7LZT2.js → chunk-MZFK765W.js} +1 -1
- package/dist/kit/{chunk-5I4IZTL5.js → chunk-NF4WVWAC.js} +1 -1
- package/dist/kit/{chunk-PIU2BMFU.js → chunk-NW4U2YRE.js} +1 -1
- package/dist/kit/{chunk-5Z2EJAUV.js → chunk-ORSI57T2.js} +1 -1
- package/dist/kit/{chunk-UML6XQAR.js → chunk-QSTDYL35.js} +1 -1
- package/dist/kit/{chunk-K563CCOL.js → chunk-QVICL57J.js} +1 -1
- package/dist/kit/{chunk-MQJQIDO5.js → chunk-RXOPJJC4.js} +1 -1
- package/dist/kit/{chunk-SNCXU7KF.js → chunk-SDSW7422.js} +1 -1
- package/dist/kit/{chunk-DZ5XGHTJ.js → chunk-TRDA73HN.js} +1 -1
- package/dist/kit/{chunk-KWTF6Q5W.js → chunk-UOYBFLGJ.js} +1 -1
- package/dist/kit/chunk-UVLKCAKH.js +1 -0
- package/dist/kit/{chunk-YCWMOTYH.js → chunk-VBWG7HQA.js} +1 -1
- package/dist/kit/{chunk-FR3ZJNOY.js → chunk-VIUEAEBX.js} +1 -1
- package/dist/kit/{chunk-ZRJVOUWH.js → chunk-VV2KP7ZW.js} +1 -1
- package/dist/kit/chunk-VX2AD3M7.js +1 -0
- package/dist/kit/{chunk-RFLIFKZ4.js → chunk-W4U5CK6L.js} +1 -1
- package/dist/kit/{chunk-I4QVLLRQ.js → chunk-WI2AF2KE.js} +1 -1
- package/dist/kit/{chunk-MGVPLQ3Z.js → chunk-XUCYFWC3.js} +1 -1
- package/dist/kit/{chunk-BNVRKD3V.js → chunk-Z2FRNFMB.js} +1 -1
- package/dist/kit/{chunk-BQZCLGCY.js → chunk-Z3KD6CLE.js} +1 -1
- package/dist/kit/{chunk-E3TUOX2A.js → chunk-ZCXNGJGB.js} +1 -1
- package/dist/kit/{chunk-IPVN22ZM.js → chunk-ZWZZMU5P.js} +1 -1
- package/dist/kit.cjs +1 -1
- package/dist/kit.d.cts +4 -2
- package/dist/kit.d.ts +4 -2
- package/dist/kit.js +1 -1
- package/dist/studio-worker.js +1 -0
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +1 -1
- package/package.json +3 -1
- package/skills/asciify-engine/SKILL.md +2 -2
- package/skills/asciify-engine/references/applying-asciify.md +1 -1
- package/skills/asciify-engine/references/kit.md +2 -2
- package/skills/asciify-engine/references/performance.md +6 -3
- package/dist/kit/chunk-3PCKMO6I.js +0 -1
- package/dist/kit/chunk-4HWMQCAM.js +0 -1
- package/dist/kit/chunk-73M2OESE.js +0 -1
- package/dist/kit/chunk-BTD6EFAW.js +0 -1
- package/dist/kit/chunk-OWEZV7TQ.js +0 -1
- package/dist/kit/chunk-S7RZP2MT.js +0 -1
- package/dist/kit/chunk-UO7RB7RC.js +0 -1
- package/dist/kit/chunk-XM56OTYT.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{styleKeeper as t,mountSurface as e,handle as n,hash as r,house as o}from"./chunk-
|
|
1
|
+
import{styleKeeper as t,mountSurface as e,handle as n,hash as r,house as o}from"./chunk-GF72XM4C.js";var a={duration:800,trigger:"visible",replayOnHover:!0,settle:"glyphs"};function i(t,e,n=.82){const o=t.getContext("2d");if(!o)return;const a=t.width,i=t.height,l=o.createImageData(a,i),c=t=>t*t*(3-2*t),s=(t,e)=>{const n=Math.floor(t),o=Math.floor(e),a=c(t-n),i=c(e-o),l=r(n,o),s=r(n+1,o),f=r(n,o+1);return l+(s-l)*a+(f-l)*i+(l-s-f+r(n+1,o+1))*a*i};for(let t=0;t<i;t++)for(let r=0;r<a;r++){const o=.6*s(r/6+2.4*e,t/3.5-.8*e)+.4*s(r/2.5-3*e,t/2),c=Math.min(1,2.4*(1-Math.hypot(2*(r/a-.5),2*(t/i-.5))*n)),f=.72*Math.max(0,o-.42)*Math.max(0,c)*255,g=4*(t*a+r);l.data[g]=l.data[g+1]=l.data[g+2]=f,l.data[g+3]=255}o.putImageData(l,0,0)}function l(l,c={}){const s={current:{...a,...c}},f=t(),g=document.createElement("canvas"),d=document.createElement("canvas");let h=-1,p="",u=!1,m=!1,x=null;const v=(t,e)=>{const n=`${t}x${e}:${s.current.text??""}:${l.textContent}`;if(n===p)return;p=n,g.width=t,g.height=e;const r=g.getContext("2d");r.fillStyle="#000",r.fillRect(0,0,t,e),void 0!==s.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 l=(parseFloat(a.letterSpacing)||0)/(parseFloat(a.fontSize)||16),c=e=>{"letterSpacing"in t&&(t.letterSpacing=l*e+"px")};t.font=`${a.fontWeight} 100px ${a.fontFamily}`,c(0);const s=Math.max(1,...i.map(e=>t.measureText(e).width)),f=Math.min(.94*r/s*100,.9*o/i.length);t.font=`${a.fontWeight} ${f}px ${a.fontFamily}`,c(f),i.forEach((e,n)=>t.fillText(e,r/2,o/2+(n-(i.length-1)/2)*f*1.04))}(r,l,s.current.text,t,e):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 l=t.measureText("Hg"),c=l.fontBoundingBoxAscent||parseFloat(i.fontSize)*r*.8,s=l.fontBoundingBoxDescent||parseFloat(i.fontSize)*r*.2,f="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 l=(i.top-n.top)*r,g=i.height*r;t.fillText(f(o[0]),(i.left-n.left)*r,l+(g-c-s)/2+c)}}a.detach?.()}(r,l,l.getBoundingClientRect(),t/(l.getBoundingClientRect().width||1))};x=e({host:l,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},...s.current.look}),ink:()=>s.current.ink??getComputedStyle(l).color,kit:s,reducedMotion:()=>s.current.reducedMotion,resolution:2,onFail:()=>{x=null,f.restore()},paint:({pen:t,width:e,height:n,now:a,still:l})=>{v(e,n);const c=s.current,f="text"===c.settle;if(h<0||l)return!(!m&&"visible"===c.trigger&&!l)&&(f&&h>=0||t.drawImage(g,0,0),h>=0&&S(),!1);const p=a-h,x=.3*c.duration,w=.7*c.duration,y=Math.max(2,Math.ceil(e/20)),M=Math.max(2,Math.ceil(n/20));if(d.width===y&&d.height===M||(d.width=y,d.height=M),i(d,p/1e3),t.imageSmoothingEnabled=!0,p<x)return t.drawImage(d,0,0,e,n),u&&(t.globalAlpha=1-o(p/x),t.drawImage(g,0,0),t.globalAlpha=1),!0;const b=Math.min(1,(p-x)/w),E=(1.18*b-.02)*e,k=.14*e,I=5.58,$=Math.floor(a/16);if(b>=1)return f||t.drawImage(g,0,0),S(),!1;t.drawImage(d,0,0,e,n),E>0&&t.drawImage(g,0,0,E,n,0,0,E,n);for(let e=Math.max(0,Math.floor(E/I)*I);e<E+k;e+=I){const o=(e-E)/k;for(let a=0;a<n;a+=9)r(e+13*$,a)<o||(t.globalAlpha=.35+.65*r(a+7*$,e),t.fillStyle="#000",t.fillRect(e,a,I,9),t.drawImage(g,e,a,I,9,e,a,I,9))}return t.globalAlpha=1,!0}});const S=()=>{h=-1,u="text"!==s.current.settle,u||f.restore()},w=()=>{x&&(f.set(l,"-webkit-text-fill-color","transparent"),m=!0,h=performance.now(),x.kick())};let y=!1;const M=x&&"visible"===s.current.trigger&&"function"==typeof IntersectionObserver?new IntersectionObserver(([t])=>{t.isIntersecting&&!y&&w(),y=t.isIntersecting},{threshold:.5}):null;x&&("text"!==s.current.settle&&f.set(l,"-webkit-text-fill-color","transparent"),u="text"!==s.current.settle&&"manual"===s.current.trigger,M?M.observe(l):"visible"===s.current.trigger&&w());let b=!1;const E=()=>{b||(b=!0,s.current.replayOnHover&&h<0&&w())},k=()=>{b=!1},I=t=>{!b||t.target instanceof Node&&l.contains(t.target)||(b=!1)};return x&&(l.addEventListener("pointerenter",E),l.addEventListener("pointermove",E),l.addEventListener("pointerleave",k),document.addEventListener("pointermove",I,!0)),x&&document.fonts?.ready.then(()=>{p="",x?.kick()}),n(()=>x,s,()=>{p="",x?.refresh()},{replay:w},()=>{M?.disconnect(),l.removeEventListener("pointerenter",E),l.removeEventListener("pointermove",E),l.removeEventListener("pointerleave",k),document.removeEventListener("pointermove",I,!0),f.restore()})}var c=a;export{c as DECODE_DEFAULTS,l as decode,i as driftNoise};//# sourceMappingURL=chunk-VV2KP7ZW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{injectStyle as e}from"./chunk-LE53AVKR.js";import{drawBlocks as t,snapshot as n,blocksOf as r,BLOCK_W as o,BLOCK_H as s}from"./chunk-Z2FRNFMB.js";import{styleKeeper as i,mountSurface as a,house as c,clamp as l,handle as u,hash as d,boxIn as f,prefersReduced as p}from"./chunk-GF72XM4C.js";var h={input:"input",rows:'[role="option"]',hotkey:"k",manage:!0,closeOnRun:!0,highlight:!0,ai:"[data-ai]"},m=200,g=3600,y=40,v="cubic-bezier(.16, 1, .3, 1)",x=`\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 ${v},width 240ms ${v},height 240ms ${v},opacity 160ms ${v}}\n:where([data-ascii-cmd-highlight][data-on]){opacity:1}\n@media (prefers-reduced-motion:reduce){:where([data-ascii-cmd-highlight]){transition:none}}\n`;function k(k,w={}){const b={current:{...h,...w}},E=i(),$=()=>[...k.querySelectorAll(b.current.rows)],M=()=>k.querySelector(b.current.input),A=i();let L=b.current.open??!k.hasAttribute("hidden"),C=0,S=null,T=!1,O=0,R=null,W=[],H=null,F=0,z=0;const D=new WeakMap,P=()=>!!(b.current.reducedMotion??p());e("ascii-kit-command",x),"static"===getComputedStyle(k).position&&A.set(k,"position","relative"),A.set(k,"isolation","isolate");const K=document.createElement("div");K.setAttribute("aria-hidden","true"),K.dataset.asciiCmdHighlight="",b.current.highlight&&k.insertBefore(K,k.firstElementChild);const j=e=>{if(void 0===e.offsetParent)return f(k,e);let t=0,n=0;for(let r=e;r&&r!==k;r=r.offsetParent)t+=r.offsetLeft,n+=r.offsetTop;for(let r=e.parentElement;r&&r!==k;r=r.parentElement)t-=r.scrollLeft,n-=r.scrollTop;return{x:t,y:n,w:e.offsetWidth,h:e.offsetHeight}},N=e=>{const t=$()[C];if(!K.parentElement)return;if(!t||!L)return void delete K.dataset.on;const n=j(t),r=!e||void 0===K.dataset.on||P();r&&(K.style.transition="none"),K.style.translate=`${n.x}px ${n.y}px`,K.style.width=`${n.w}px`,K.style.height=`${n.h}px`,K.style.borderRadius=getComputedStyle(t).borderTopLeftRadius,K.dataset.on="",r&&(K.offsetWidth,K.style.removeProperty("transition"))};let q=null;const B=i();R=a({host:k,layer:"under",look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:5,cellAspect:.62,glyphScale:.92,...b.current.look}),ink:()=>b.current.ink??"--ascii-ink-strong",kit:b,reducedMotion:()=>b.current.reducedMotion,resolution:2,onFail:()=>{R=null},paint:({pen:e,now:i,still:a,box:u})=>{if(e.setTransform(2,0,0,2,0,0),S){const n=S,r=(i-n.start)/(n.closing?m:260);if(!(r>=1||a)){const o=n.closing?1-1.02*c(r):1.04*c(r);return t(e,n.snap,n.blocks,n.order,o,(e,t)=>[(n.ox-e.x)*t*.9,(n.oy-e.y)*t*.9],n.closing?1:1-l((r-.72)/.28),.4),!0}S=null}if(!L||T)return!1;let f=!1;W=W.filter(n=>{const r=(i-n.start)/280;return(r>=.7||a)&&n.styles.restore(),r>=1||a||!k.contains(n.row)?(n.styles.restore(),!1):(f=!0,r>0&&t(e,n.snap,n.blocks,n.order,1.04*c(r),(e,t)=>[14*t,0],1-l((r-.7)/.3),.42),!0)});const p=$()[C];if(p&&!a&&p.matches(b.current.ai)){p!==H&&(H=p,F=i+160);const t=i-F,a=t>=0?t%g/1100:-1;if(a>=0&&a<1&&!W.some(e=>e.row===p))((e,t,i,a,c)=>{const l=R,u=`${t.textContent}|${i.x}|${i.y}|${i.w}`;if(q?.row!==t||q.key!==u){const e=n(t,l.box,l.canvas.clientWidth||k.offsetWidth,l.canvas.clientHeight||k.offsetHeight,2);q={row:t,key:u,snap:e,blocks:r(e,2)}}const f=i.x-y+(i.w+80)*(e=>e<.5?4*e**3:1-(-2*e+2)**3/2)(a),p=Math.floor(c/70);for(const t of q.blocks){const n=(t.x+2-f)/y;if(n<=-1||n>=1)continue;const r=1-n*n;d(t.x+p,t.y)>.35+.65*r||(e.globalAlpha=Math.min(1,1.6*r),e.drawImage(q.snap,2*t.x,2*t.y,2*o,2*s,t.x,t.y,o,s))}e.globalAlpha=1;const h=f-i.x;B.set(t,"mask-image",`linear-gradient(90deg, #000 ${h-y}px, transparent ${h-14}px, transparent ${h+14}px, #000 ${h+y}px)`)})(e,p,u(p),a,i),f=!0;else{if(B.restore(),f)return!0;z&&clearTimeout(z);const e=t>=0?g-t%g:-t;z=setTimeout(()=>{z=0,R?.kick()},Math.max(16,e))}}else H=null,B.restore();return f}}),R&&(k.dataset.gpu="");const G=(e=!0)=>{const t=$();if(C=t.length?Math.min(Math.max(0,C),t.length-1):0,N(e),!b.current.manage)return;t.forEach((e,t)=>e.setAttribute("aria-selected",String(t===C)));const n=M(),r=t[C]?.id;n&&r&&n.setAttribute("aria-activedescendant",r)},V=()=>`inset(0 round ${getComputedStyle(k).borderTopLeftRadius||"0px"})`,I=()=>{const e=b.current.trigger,t=k.offsetWidth,n=k.offsetHeight;if(!e)return`inset(0 ${Math.max(0,t/2-40)}px ${Math.max(0,n-36)}px round 18px)`;const r=f(k,e);return`inset(${r.y}px ${t-r.x-r.w}px ${n-r.y-r.h}px ${r.x}px round ${r.h/2}px)`},U=e=>{const t=R;if(!t)return;const o=k.offsetWidth,s=k.offsetHeight,i=n(k,t.box,o,s,2),a=r(i,2),c=b.current.trigger,l=c?t.box(c):{x:o/2,y:0,w:0,h:0},u=l.x+l.w/2,d=l.y+l.h/2,f=Math.hypot(o,s)||1;S={snap:i,blocks:a,order:Float32Array.from(a,e=>Math.hypot(e.x-u,e.y-d)/f*.7+.3*e.seed),ox:u,oy:d,start:performance.now(),closing:e},t.kick()},X=e=>{if(e)for(const e of[...k.children])"CANVAS"===e.tagName&&void 0!==e.dataset.asciiKit||E.set(e,"opacity","0");else E.restore()},Z=(e,t,n="none")=>"function"!=typeof k.animate?null:k.animate(e.map(e=>({clipPath:e})),{duration:t,easing:v,fill:n}),J=()=>{O&&clearTimeout(O),O=0},Q=(e=!0)=>{!L||T?(J(),L=!0,T=!1,C=0,k.removeAttribute("hidden"),k.dataset.open="",b.current.trigger?.setAttribute("aria-expanded","true"),G(!1),(()=>{for(const e of $())D.set(e,j(e).y)})(),e&&M()?.focus({preventScroll:!0}),b.current.onOpenChange?.(!0),P()?R?.kick():(k.dataset.state="opening",Z([I(),V()],260),R&&(T=!0,X(!0),U(!1)),O=setTimeout(()=>{O=0,delete k.dataset.state,T=!1,X(!1),R?.kick()},143))):e&&M()?.focus({preventScroll:!0})},Y=()=>{if(!L)return;J();const e=k.contains(document.activeElement),t=()=>{O=0,T=!1,L=!1,S=null,delete k.dataset.state,delete k.dataset.open,X(!1),N(!1);for(const e of W)e.styles.restore();W=[],B.restore(),q=null,k.setAttribute("hidden",""),b.current.trigger?.setAttribute("aria-expanded","false"),e&&b.current.trigger?.focus({preventScroll:!0}),R?.kick(),b.current.onOpenChange?.(!1)};if(P())return void t();T=!0,k.dataset.state="closing",R&&(U(!0),X(!0));const n=Z([V(),I()],m,"forwards"),r="function"==typeof k.animate?k.animate([{opacity:1},{opacity:1,offset:.4},{opacity:0}],{duration:m,fill:"forwards"}):null;O=setTimeout(()=>{t(),n?.cancel(),r?.cancel()},m)},_=e=>{const t=$().length;t&&(C=(Math.round(e)%t+t)%t,G(),R?.kick())},ee=(e=C)=>{const t=$()[e];if(!t||T)return;_(e),R?.field.pulse({element:t,strength:.6}),t.matches(b.current.ai)&&(H=t,F=performance.now()),t.dataset.run="",b.current.onRun?.(e,t);const n=()=>{delete t.dataset.run,b.current.closeOnRun&&Y()};P()?n():setTimeout(n,240)},te=e=>{if(!b.current.manage)return;const t=$().length;if("Escape"===e.key&&L)return e.preventDefault(),e.stopPropagation(),void Y();if(e.target!==M()&&!$().includes(e.target))return;const n="ArrowDown"===e.key?C+1:"ArrowUp"===e.key?C-1:"Home"===e.key?0:"End"===e.key?t-1:null;if(null!==n)return e.preventDefault(),void _(n);"Enter"===e.key&&(e.preventDefault(),ee())},ne=e=>{const t=e.target?.closest?.(b.current.rows);return t?$().indexOf(t):-1},re=e=>{if(!b.current.manage)return;const t=ne(e);t<0||t!==C&&_(t)},oe=e=>{if(!b.current.manage)return;const t=ne(e);t>=0&&ee(t)},se=()=>{b.current.manage&&(C=0,G(!1))},ie="function"==typeof MutationObserver?new MutationObserver(()=>{L&&(G(!1),(()=>{const e=R,t=$(),o=t.filter(e=>{const t=j(e).y,n=D.get(e);return D.set(e,t),void 0===n||Math.abs(n-t)>1});for(const e of W)t.includes(e.row)&&!o.includes(e.row)||e.styles.restore();if(W=W.filter(e=>t.includes(e.row)&&!o.includes(e.row)),!e||!e.live||e.still()||T||!L)return;const s=e.canvas.clientWidth||k.offsetWidth,a=e.canvas.clientHeight||k.offsetHeight,c=performance.now();o.forEach((t,o)=>{const l=n(t,e.box,s,a,2),u=r(l,2);if(!u.length)return;const d=Math.min(...u.map(e=>e.x)),f=Math.max(1,Math.max(...u.map(e=>e.x))-d),p=i();for(const e of[...t.children])p.set(e,"opacity","0");W.push({row:t,snap:l,blocks:u,order:Float32Array.from(u,e=>(e.x-d)/f*.72+.28*e.seed),start:c+28*o,styles:p})}),e.kick()})())}):null;ie?.observe(k,{childList:!0,subtree:!0});const ae="function"==typeof ResizeObserver?new ResizeObserver(()=>N(!1)):null;ae?.observe(k);const ce=()=>{L?Y():Q(!0)},le=e=>{const t=b.current.hotkey;t&&e.key?.toLowerCase()===t.toLowerCase()&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),L?document.activeElement===M()?Y():M()?.focus():Q(!0))},ue=e=>{if(!b.current.manage||!L||T)return;const t=e.target;k.contains(t)||b.current.trigger?.contains(t)||Y()};k.addEventListener("keydown",te),k.addEventListener("pointermove",re),k.addEventListener("click",oe),k.addEventListener("input",se);const de=b.current.trigger;return de?.addEventListener("click",ce),de?.setAttribute("aria-expanded",String(L)),de?.setAttribute("aria-haspopup","dialog"),document.addEventListener("keydown",le),document.addEventListener("pointerdown",ue),L?k.dataset.open="":k.setAttribute("hidden",""),G(),u(()=>R,b,()=>{G(),R?.refresh()},{open:Q,close:Y,select:_,run:ee,toggle(){L?Y():Q(!0)},get isOpen(){return L},get selected(){return C}},()=>{J(),z&&clearTimeout(z),X(!1);for(const e of W)e.styles.restore();B.restore(),ie?.disconnect(),ae?.disconnect(),K.remove(),A.restore(),k.removeEventListener("keydown",te),k.removeEventListener("pointermove",re),k.removeEventListener("click",oe),k.removeEventListener("input",se),de?.removeEventListener("click",ce),document.removeEventListener("keydown",le),document.removeEventListener("pointerdown",ue),delete k.dataset.gpu,delete k.dataset.state})}var w=h;export{w as COMMAND_PALETTE_DEFAULTS,k as commandPalette};//# sourceMappingURL=chunk-VX2AD3M7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{renderMaterial as t}from"./chunk-XPXMCXYI.js";import{mountCanvas as e}from"./chunk-
|
|
1
|
+
import{renderMaterial as t}from"./chunk-XPXMCXYI.js";import{mountCanvas as e}from"./chunk-3OD5BMF5.js";var n=(t,e,n,i)=>{const r=.2*Math.sin(3*t+2*e+.2*i);return(.65*Math.pow(.5+.5*Math.sin(45*(t+r)),8)+.35*Math.pow(.5+.5*Math.sin(50*(e-.3*r)),10))*(.4+.6*Math.sin(2*e+.4))},i={id:"weave",name:"Weave",description:"Interlaced threads with a subtle change in tension.",cellSize:12,speed:1,cursor:!1,mount:i=>e(i,(e,i,r,h,o,a)=>t(n,e,i,r,h,{ditherStrength:a.ditherStrength,fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink}))};export{i as weave};//# sourceMappingURL=chunk-W4U5CK6L.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseColor as t,hash2 as o}from"./chunk-ZCHGV2CV.js";import{mountCanvas as c}from"./chunk-
|
|
1
|
+
import{parseColor as t,hash2 as o}from"./chunk-ZCHGV2CV.js";import{mountCanvas as c}from"./chunk-3OD5BMF5.js";function e(c,e,n,r,a={x:.5,y:.5},i={}){const{fontSize:l=12,chars:s="·-=+|/",accentColor:h,color:f,bands:d=3,speed:g=1,bandWidth:M=.12,glitch:m=!0,lightMode:p=!1}=i,$=h??(p?"#6b8700":"#d4ff00"),b=.62*l,x=1.4*l,u=Math.ceil(e/b),S=Math.ceil(n/x);c.clearRect(0,0,e,n),c.font=`${l}px monospace`,c.textBaseline="top";let z=255,C=255,k=255;if(p&&(z=55,C=55,k=55),f){const o=t(f);o&&(z=o.r,C=o.g,k=o.b)}let y=212,j=255,B=0;const G=t($);G&&(y=G.r,j=G.g,B=G.b);const V=r*g;for(let t=0;t<S;t++)for(let e=0;e<u;e++){const n=t/S,r=((n*d-.5*V)%1+1)%1,i=Math.max(0,1-r/M),l=.35*(.5*o(3*e,7*t)+.5);let h=0;if(m){const c=e/u-a.x,r=n-a.y,i=Math.sqrt(c*c+r*r);if(i<.18){const c=o(11*e+Math.floor(12*V),5*t);h=Math.max(0,1-i/.18)*(c>.5?c-.3:0)}}const f=Math.min(1,l+.8*i+.6*h);if(f<.04)continue;const g=s[Math.floor(f*(s.length-1))],$=i>.55,G=p?.82*f:.12*f;c.fillStyle=$?`rgba(${y},${j},${B},${p?.92:.28})`:`rgba(${z},${C},${k},${G})`,c.fillText(g,e*b,t*x)}}var n={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=>c(t,(t,o,c,n,r,a)=>e(t,o,c,n,r,{fontSize:a.fontSize,chars:a.chars,lightMode:a.lightMode,color:a.ink,accentColor:a.accent}))};export{n as grid,e as renderGridBackground};//# sourceMappingURL=chunk-WI2AF2KE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mountPageField as e,pageHandle as t,sleep as r,pulseAt as o}from"./chunk-
|
|
1
|
+
import{mountPageField as e,pageHandle as t,sleep as r,pulseAt as o}from"./chunk-7DXSG526.js";import{styleKeeper as a}from"./chunk-GF72XM4C.js";function n(n,l={}){const i={current:{...l}},c=a(),s=n.querySelector("img"),u=i.current.image??s??null;let d=null;d=u?e({host:n,look:()=>{const e=i.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:e.focus??{x:.5,y:.4},hover:"trail",trail:{strength:.95,radius:.42},clear:!!e.clear&&{element:e.clear,padding:8,feather:.12,shape:"rect"},...e.look}},ink:()=>i.current.ink??"--ascii-ink-strong",source:u,label:i.current.label??(u instanceof HTMLImageElement&&u.alt||void 0),kit:i,reducedMotion:()=>i.current.reducedMotion,onFail:()=>{d=null,c.restore()}}):null,d&&s&&u===s&&c.set(s,"opacity","0");let h=0,m=!1;return t(()=>d,i,()=>{},{pulse:(e,t=1)=>{d&&!d.still()&&o(d.field,e,t)},shimmer:e=>{const t=d?.field;if(!t||e===m||e&&d.still())return;const o=++h;m=e,e?(async()=>{let e;try{e=await(async()=>{if(u instanceof HTMLImageElement)return u.complete||await u.decode(),u;const e=new Image;return e.crossOrigin="anonymous",e.src=u,await e.decode(),e})()}catch{return}const a=Math.min(1,1400/Math.max(e.naturalWidth,e.naturalHeight,1)),n=Object.assign(document.createElement("canvas"),{width:Math.max(1,Math.round(e.naturalWidth*a)),height:Math.max(1,Math.round(e.naturalHeight*a))}),l=n.getContext("2d"),i=n.width,c=n.height,s=performance.now();for(;o===h&&d?.field===t;){const o=performance.now(),a=-.4*i+1.8*((o-s)/1100%1)*i;l.globalCompositeOperation="source-over",l.drawImage(e,0,0,i,c);const u=l.createLinearGradient(a-.22*i,.3*a,a+.22*i,.3*a+.3*c);u.addColorStop(0,"rgb(0 0 0 / 0)"),u.addColorStop(.5,"rgb(255 255 255 / .42)"),u.addColorStop(1,"rgb(0 0 0 / 0)"),l.globalCompositeOperation="lighter",l.fillStyle=u,l.fillRect(0,0,i,c),await t.setSource(n),await r(Math.max(0,48-(performance.now()-o)))}})():t.setSource(u)}},()=>{h++,c.restore()})}export{n as artPanel};//# sourceMappingURL=chunk-XUCYFWC3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hash as t,settledSource as e}from"./chunk-
|
|
1
|
+
import{hash as t,settledSource as e}from"./chunk-GF72XM4C.js";var o=t=>{const e=Math.round(255*Math.min(1,Math.max(0,t)));return`rgb(${e} ${e} ${e})`},n=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 o=/^rgba\([^)]*,\s*([\d.]+)\s*\)$/.exec(t);return o?parseFloat(o[1]):1},i=/^(IMG|PICTURE|VIDEO|CANVAS|SVG|svg)$/;function a(t,a,s,c){const d=(t,e)=>Math.max(0,Math.min(parseFloat(t.borderTopLeftRadius)||0,e.w/2,e.h/2)),f=[a,...a.querySelectorAll("*")];t.save();for(const l of f){if("CANVAS"===l.tagName&&void 0!==l.dataset?.asciiKit){if(!c||l===c.skip)continue;const o=s(l),n=o.w>0&&o.h>0?e(l):null;n&&(t.globalCompositeOperation="lighter",t.drawImage(n,o.x,o.y,o.w,o.h),t.globalCompositeOperation="source-over");continue}if(void 0!==l.dataset?.asciiPoster)continue;const f=s(l);if(f.w<=0||f.h<=0)continue;const h=getComputedStyle(l);if("hidden"===h.visibility||"none"===h.display)continue;const u=n(h.backgroundColor)>.03,g=(parseFloat(h.borderTopWidth)||0)>0&&n(h.borderTopColor)>.1;if(t.beginPath(),l===a)(u||g)&&(t.strokeStyle=o(.42),t.lineWidth=3,t.roundRect(f.x+1.5,f.y+1.5,f.w-3,f.h-3,d(h,f)),t.stroke());else{if(i.test(l.tagName)){t.fillStyle=o(.5),f.w<32&&f.h<32?t.arc(f.x+f.w/2,f.y+f.h/2,.36*Math.min(f.w,f.h),0,2*Math.PI):t.roundRect(f.x,f.y,f.w,f.h,d(h,f)),t.fill();continue}u?(t.fillStyle=o(.22),t.roundRect(f.x,f.y,f.w,f.h,d(h,f)),t.fill()):g&&(t.strokeStyle=o(.32),t.lineWidth=1.5,t.roundRect(f.x+.75,f.y+.75,f.w-1.5,f.h-1.5,d(h,f)),t.stroke())}if("INPUT"===l.tagName||"TEXTAREA"===l.tagName){const e=l,o=e.value||e.placeholder||"";o&&r(t,o,f.x+(parseFloat(h.paddingLeft)||0),f.y,f.h,h,e.value?.82:.5)}}!function(t,e,o){if("function"!=typeof document.createTreeWalker)return;const n=document.createTreeWalker(e,4),i=document.createRange(),a=o(e),s=e.getBoundingClientRect(),c=s.width/(e.offsetWidth||s.width||1)||1;let d=0;for(let o=n.nextNode();o&&d<2e3;o=n.nextNode()){const n=o.parentElement;if(!n)continue;const f=getComputedStyle(n);if("hidden"===f.visibility||l(n,e))continue;const h=(parseFloat(f.fontWeight)||400)>=600||/^H[1-6]$/.test(n.tagName)?1:.8;for(const e of o.data.matchAll(/\S+/g)){i.setStart(o,e.index),i.setEnd(o,e.index+e[0].length);const n=i.getClientRects()[0];n&&(d++,r(t,e[0],a.x+(n.left-s.left)/c,a.y+(n.top-s.top)/c,n.height/c,f,h))}}i.detach?.()}(t,a,s),t.restore()}function r(t,e,n,i,a,r,l){const s=Math.min(900,(parseFloat(r.fontWeight)||400)+200);t.font=`${r.fontStyle||"normal"} ${s} ${r.fontSize} ${r.fontFamily}`,t.fillStyle=o(l),t.shadowColor=o(l),t.shadowBlur=3,t.textBaseline="middle",t.fillText(e,n,i+a/2),t.shadowBlur=0}function l(t,e){for(;t&&t!==e;t=t.parentElement){const e=t,o=getComputedStyle(e);if(e.offsetWidth<=1&&e.offsetHeight<=1&&"hidden"===o.overflow)return!0;if("inset(50%)"===o.clipPath||"rect(0px, 0px, 0px, 0px)"===o.clip)return!0}return!1}function s(t,e,o,n,i=2,r){const l=document.createElement("canvas");l.width=Math.max(2,Math.round(o*i)),l.height=Math.max(2,Math.round(n*i));const s=l.getContext("2d",{willReadFrequently:!0});return s?(s.setTransform(i,0,0,i,0,0),s.fillStyle="#000",s.fillRect(0,0,o,n),a(s,t,e,r),l):l}var c=4,d=6;function f(e,o=2){const n=e.getContext("2d",{willReadFrequently:!0});if(!n)return[];const i=e.width,a=e.height,r=n.getImageData(0,0,i,a).data,l=[];for(let e=0;e<a/o;e+=6)for(let n=0;n<i/o;n+=4){let s=!1;for(let t=0;t<6*o&&!s;t+=3)for(let l=0;l<4*o&&!s;l+=2){const c=Math.round(n*o+l),d=Math.round(e*o+t);c<i&&d<a&&r[4*(d*i+c)]>10&&(s=!0)}s&&l.push({x:n,y:e,seed:t(n,e)})}return l}function h(t,e,o,n,i,a,r=1,l=.32,s=2){for(let c=0;c<o.length;c++){const d=o[c],f=(i-n[c]*(1-l))/l;if(f<=0)continue;const h=f>=1?0:1-f;let u=d.x,g=d.y;if(h>0){const[t,e]=a(d,h);u+=t,g+=e}t.globalAlpha=r*(1-h*h),t.drawImage(e,d.x*s,d.y*s,4*s,6*s,u,g,4,6)}t.globalAlpha=1}export{d as BLOCK_H,c as BLOCK_W,f as blocksOf,h as drawBlocks,s as snapshot};//# sourceMappingURL=chunk-Z2FRNFMB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{scenePreset as e}from"./chunk-
|
|
1
|
+
import{scenePreset as e}from"./chunk-3VEMKDBW.js";var t=e({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(e,t){const{host:n}=e;let r=-1e9,i=-1e4,o=-1e4;const s=n=>{const s=performance.now();if(!1===e.settings().cursor||s-r<260||Math.hypot(n.clientX-i,n.clientY-o)<48)return;r=s,i=n.clientX,o=n.clientY;const c=t.canvas.getBoundingClientRect();t.field?.pulse({x:n.clientX-c.left,y:n.clientY-c.top,strength:.5})};return n.addEventListener("pointermove",s,{passive:!0}),()=>n.removeEventListener("pointermove",s)}});export{t as ripple};//# sourceMappingURL=chunk-Z3KD6CLE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{renderMaterial as t}from"./chunk-XPXMCXYI.js";import{mountCanvas as i}from"./chunk-
|
|
1
|
+
import{renderMaterial as t}from"./chunk-XPXMCXYI.js";import{mountCanvas as i}from"./chunk-3OD5BMF5.js";var n=(t,i,n,e)=>{const r=7*i+.55*Math.sin(2.2*t+.09*e)+.22*Math.sin(4.8*t-.07*e),o=.5+.5*Math.sin(r);return Math.pow(o,5)*(.35+.65*i)+.08*Math.pow(.5+.5*Math.sin(17*r),3)*o},e={id:"dune",name:"Dune",description:"Layered sand ridges with slow-moving light and fine grain.",cellSize:12,speed:1,cursor:!1,mount:e=>i(e,(i,e,r,o,h,s)=>t(n,i,e,r,o,{ditherStrength:s.ditherStrength,fontSize:s.fontSize,chars:s.chars,lightMode:s.lightMode,color:s.ink}))};export{e as dune};//# sourceMappingURL=chunk-ZCXNGJGB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{styleKeeper as t,srOnly as e,mountSurface as n,clamp as o,smoothstep as r,hash as a,house as l,handle as i,prefersReduced as s}from"./chunk-
|
|
1
|
+
import{styleKeeper as t,srOnly as e,mountSurface as n,clamp as o,smoothstep as r,hash as a,house as l,handle as i,prefersReduced as s}from"./chunk-GF72XM4C.js";var c={start:!0,stagger:38,roll:520,wave:55,glyphs:"#%*+=-:"},h=t=>`Thought for ${t}s`;function u(u,p={}){const f={current:{...c,...p}},m=t(),g=[...u.childNodes],d=f.current.label??null,y=d?[...d.childNodes]:[];let x="done",k=0,C=0,b=-1e9,w=0,M="",S=null;const A=d?e("",!0):null,v=document.createElement("span");let $="",F="";const E=()=>f.current.reducedMotion??s(),T=(t,e)=>{F=$,$=t,d&&(A&&(A.textContent=t),S?(v.replaceChildren(...[...t].map(t=>Object.assign(document.createElement("span"),{textContent:t}))),b=e?performance.now():-1e9,S.kick()):d.textContent=t)};d&&(S=n({host:d,look:()=>({mark:"glyph",charset:" .:-=+*#%@",font:'"Geist Mono", ui-monospace, monospace',fontWeight:500,cellSize:2,cellAspect:.66,glyphScale:1,shade:.2,contrast:1.1,...f.current.look}),ink:()=>f.current.ink??getComputedStyle(d).color,kit:f,reducedMotion:()=>f.current.reducedMotion,resolution:2,onFail:()=>{S=null,d.textContent=$,m.restore()},paint:({pen:t,now:e,still:n,box:i,scale:s})=>{const c=getComputedStyle(v),h=parseFloat(c.fontSize)||14,u=`${c.fontStyle} ${c.fontWeight} ${c.fontSize} ${c.fontFamily}`;t.setTransform(s,0,0,s,0,0),t.textAlign="center",t.textBaseline="alphabetic",t.font=u;const p=t.measureText("x"),m=p.fontBoundingBoxAscent||.8*h,g=p.fontBoundingBoxDescent||.2*h,d=f.current,y=[...v.children],k=e-b<d.roll+y.length*d.wave,w=y.length*d.wave+d.roll+420;let M=!1;return y.forEach((s,c)=>{let p=1;if(!n&&k)p=o((e-b-c*d.wave)/d.roll);else if(!n&&"thinking"===x){const t=(e-C)%w-c*d.wave;p=t<0||t>d.roll?1:t/d.roll}const f=p<1?r(.7,1,p).toFixed(3):"";if(s.style.opacity!==f&&(s.style.opacity=f),p>=1||!s.textContent?.trim())return;M=!0;const y=i(s),S=y.y+(y.h-m-g)/2+m,A=y.x+y.w/2,v=k?F[c]??" ":s.textContent,$=s.textContent,E=[v,...Array.from({length:3},(t,e)=>d.glyphs[Math.floor(a(e+7*c,Math.floor(C))*d.glyphs.length)]??""),$],T=l(p)*(E.length-1)*y.h;t.save(),t.beginPath(),t.rect(y.x-2,y.y,y.w+4,y.h),t.clip(),t.globalAlpha=1-r(.7,1,p),E.forEach((e,n)=>{const o=S+n*y.h-T;if(o<y.y-y.h||o>y.y+2*y.h)return;const r=0===n||n===E.length-1;t.font=r?u:`600 ${.86*h}px "Geist Mono", ui-monospace, monospace`,t.fillStyle=r?"#fff":"#d0d0d0",t.fillText(e,A,o)}),t.restore()}),t.globalAlpha=1,M||!n&&("thinking"===x||k)}}),S&&A&&(m.set(v,"display","inline-flex"),m.set(v,"white-space","pre"),v.setAttribute("aria-hidden","true"),d.replaceChildren(A,v,S.canvas)));const B=document.createElement("span"),z=()=>{w++,x="thinking",C=performance.now(),M="",B.replaceChildren(),u.replaceChildren(B),u.setAttribute("aria-busy","true"),T(f.current.labels?.thinking??"Thinking…",!1),f.current.onState?.("thinking",0),S?.kick()};let G=0,P=0;return f.current.start&&z(),i(()=>S,f,()=>S?.refresh(),{think:z,stream:async t=>{"thinking"!==x&&z();const e=w;G=0;let n="";const o=()=>{"thinking"===x&&(x="streaming",P=performance.now(),k=Math.max(1,Math.round((P-C)/1e3)),T((f.current.labels?.done??h)(k),!0),f.current.onState?.("streaming",k))},r=(t,e)=>{n+=t;const r=e?n.length:n.search(/\s\S*$/)+1;r<=0||(o(),M+=n.slice(0,r),(t=>{const e=!E()&&!S?.still();for(const n of t.match(/\s+|\S+/g)??[]){if(/^\s/.test(n)){B.append(n);continue}const t=document.createElement("span");if(t.textContent=n,e){m.set(t,"opacity","0");const e=Math.max(0,G*f.current.stagger-(performance.now()-P));m.set(t,"transition",`opacity 260ms cubic-bezier(.16, 1, .3, 1) ${Math.round(e)}ms`),requestAnimationFrame(()=>requestAnimationFrame(()=>t.style.setProperty("opacity","1")))}G++,B.appendChild(t)}})(n.slice(0,r)),n=n.slice(r))};if("string"==typeof t)r(t,!0);else{for await(const n of t){if(e!==w)return;r(n,!1)}if(e!==w)return;r("",!0)}o();const a=E()?0:Math.max(0,G*f.current.stagger-(performance.now()-P))+260;await new Promise(t=>setTimeout(t,a)),e===w&&(x="done",u.setAttribute("aria-busy","false"),f.current.onState?.("done",k),S?.kick())},get state(){return x}},()=>{w++,m.restore(),u.removeAttribute("aria-busy"),M?u.textContent=M:u.replaceChildren(...g),d&&($?d.textContent=$:d.replaceChildren(...y))})}var p=c;export{p as THINKING_DEFAULTS,u as thinking};//# sourceMappingURL=chunk-ZWZZMU5P.js.map
|