ai-wrapped 1.14.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +1 -1
  2. package/bin/cli.ts +3 -2
  3. package/dist/assets/{BotAvatar-BGnVa_oL.js → BotAvatar-DF0epPmz.js} +1 -1
  4. package/dist/assets/{CrystalizedBall-DG4TTFHE.js → CrystalizedBall-8nXHKUrK.js} +1 -1
  5. package/dist/assets/{EchoText-nk9HB5gg.js → EchoText-BBpfwkNe.js} +1 -1
  6. package/dist/assets/{GlowCursor-Dhsq6ICq.js → GlowCursor-Cyc4E_Sy.js} +1 -1
  7. package/dist/assets/{Heatwave-BrwTlyGu.js → Heatwave-BRCZhums.js} +1 -1
  8. package/dist/assets/{LightTunnel-Cg8DoXsX.js → LightTunnel-BhYVyLW0.js} +1 -1
  9. package/dist/assets/{LineSpiral-BSjTRlhe.js → LineSpiral-DXvjTFr3.js} +1 -1
  10. package/dist/assets/{SideRays-BkWTYWvQ.js → SideRays-D3YRo98l.js} +1 -1
  11. package/dist/assets/{SlicedWaves-DoF0JtXo.js → SlicedWaves-_jMt9oC8.js} +1 -1
  12. package/dist/assets/{SplitFlapText-Bv5grL-j.js → SplitFlapText-Cm16Tvxb.js} +1 -1
  13. package/dist/assets/{Strands-DIWlBTYu.js → Strands-Bn08Tum0.js} +1 -1
  14. package/dist/assets/{TechText-0S0SKdOE.js → TechText-CQvGbyFP.js} +1 -1
  15. package/dist/assets/index-CH-7pBbW.js +161 -0
  16. package/dist/assets/{index-6HoOXh54.css → index-Dh3d1sc7.css} +1 -1
  17. package/dist/index.html +2 -2
  18. package/package.json +1 -1
  19. package/skills/ai-wrapped/SKILL.md +1 -0
  20. package/src/bun/activeMinutes.test.ts +27 -0
  21. package/src/bun/activeMinutes.ts +86 -0
  22. package/src/bun/aggregator.ts +7 -0
  23. package/src/bun/headless.ts +9 -2
  24. package/src/bun/local.ts +5 -2
  25. package/src/bun/queries.ts +4 -0
  26. package/src/bun/store.ts +14 -0
  27. package/src/shared/buildPayload.ts +1 -0
  28. package/src/shared/schema.ts +2 -0
  29. package/src/shared/shareData.ts +4 -1
  30. package/dist/assets/index-Dkr9bjPf.js +0 -161
@@ -1 +1 @@
1
- import{r as M,m as Yt,j as _}from"./index-Dkr9bjPf.js";const Wt=typeof window>"u"?M.useEffect:M.useLayoutEffect,a=(i,C,L)=>Math.min(Math.max(i,C),L),Tt={right:{x:1,y:0},left:{x:-1,y:0},up:{x:0,y:-1},down:{x:0,y:1},diagonal:{x:.72,y:.72}},Ft={linear:i=>i,"ease-out":i=>1-Math.pow(1-i,3),"ease-in-out":i=>i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2,snappy:i=>1-Math.pow(1-i,5)},Jt=7200,Kt=2600,Zt=1100,te=80,K=i=>i instanceof Element?[i.scrollLeft||0,i.scrollTop||0]:[window.scrollX,window.scrollY],ne=({text:i="Motion Echo",echoes:C=12,lag:L=.24,offset:Z=36,direction:tt="right",fade:et=.72,blur:nt=3,tint:ot="#7dd3fc",echoColors:P,echoStyle:Rt="solid",echoScale:rt=1,mode:Y="both",trail:S="pointer",clickBurst:j=!0,cursorRadius:st=320,duration:at=900,ease:it="ease-out",fontSize:Lt="clamp(3rem, 9vw, 7rem)",fontWeight:Nt=800,color:$t="currentColor",className:At="",style:kt})=>{const ct=M.useRef(null),lt=M.useRef(null),E=M.useRef([]),[B,It]=M.useState(!1),l=B?0:a(Math.round(C),0,24),_t=M.useMemo(()=>Array.from({length:l},(r,d)=>l-d),[l]),N=Array.isArray(P)&&P.length?P:null,Ct=j&&l>0,Pt=r=>{if(N){const d=l>1?(r-1)/(l-1):0;return`color-mix(in srgb, ${N[N.length-1]} ${Math.round(d*100)}%, ${N[0]})`}return ot?`color-mix(in srgb, ${ot} ${Math.min(72,18+r*5)}%, currentColor)`:void 0};M.useEffect(()=>{if(!window.matchMedia)return;const r=Yt(),d=()=>It(r.matches);return d(),()=>r.removeEventListener?.("change",d)},[]),Wt(()=>{const r=ct.current;if(!r||B||Yt().matches)return;const d=Tt[tt]||Tt.right,u=a(Number(Z)||0,0,120),dt=a(Number(st)||320,40,1200),D=a(Number(L)||.16,.02,.5),ht=a(Number(et)||.64,.1,.95),$=a(Number(nt)||0,0,16),Bt=a(Number(rt)||1,.25,2.5),ut=Math.max(0,Number(at)||0),Dt=Ft[it]||Ft["ease-out"],A=Y==="entrance"||Y==="both",O=Y==="pointer"||Y==="both",Ot=!!window.matchMedia?.("(hover: hover) and (pointer: fine)").matches,q=O&&S==="auto",G=O&&S==="scroll",ft=O&&Ot&&!G,qt=.12+D*1.1,Gt=a(u/36,.35,2.5),k=u*4,t={targetX:0,targetY:0,lastTargetX:0,lastTargetY:0,activity:A?1:0,positions:Array.from({length:l+1},(e,n)=>{const o=A?u*(n+.35):0;return{x:d.x*o,y:d.y*o}}),bends:Array.from({length:l+1},()=>({x:0,y:0})),startTime:performance.now(),lastTime:0,drift:0,phase:0,pointerNear:!1,pointerTime:-1/0,visible:!0,pushX:0,pushY:0,velocityX:0,velocityY:0,bursts:[]};let T=0;for(let e=1;e<=l;e+=1){const n=E.current[e];n&&(n.style.filter=$>0?`blur(${($*e/l).toFixed(2)}px)`:"none")}const Ut=e=>{t.bursts=t.bursts.filter(n=>{const o=e-n.start;let h=!1;return n.nodes.forEach((s,f)=>{const y=(o-f*te)/Zt;y<1&&(h=!0);const p=a(y,0,1),m=1-Math.pow(1-p,3),b=1+m*.34*Gt,g=.75*Math.pow(ht,f*.5),z=y<=0?0:Math.min(1,p*8)*Math.pow(1-p,1.5)*g;s.style.transform=`translate3d(${n.x.toFixed(2)}px, ${n.y.toFixed(2)}px, 0) scale(${b.toFixed(4)})`,s.style.opacity=z.toFixed(3),s.style.filter=$>0?`blur(${($*.3*m).toFixed(2)}px)`:"none"}),h||n.nodes.forEach(s=>s.remove()),h})},U=e=>{T=0;const n=t.lastTime?a(e-t.lastTime,0,64):16.67,o=n/16.67;t.lastTime=e;const h=e-t.startTime,s=A&&ut>0?a(h/ut,0,1):1,f=A?1-Dt(s):0,y=Math.hypot(t.targetX-t.lastTargetX,t.targetY-t.lastTargetY);if(t.lastTargetX=t.targetX,t.lastTargetY=t.targetY,q){const c=!ft||!t.pointerNear||e-t.pointerTime>Kt;t.drift+=((c?1:0)-t.drift)*(1-Math.pow(.965,o)),t.phase+=n/Jt*Math.PI*2}if(G){const c=1-Math.pow(.7,o);t.velocityX+=(t.pushX/Math.max(o,.25)-t.velocityX)*c,t.velocityY+=(t.pushY/Math.max(o,.25)-t.velocityY)*c,t.pushX=0,t.pushY=0}const p=Math.hypot(t.velocityX,t.velocityY),m=a(-t.velocityX*3.2,-k,k),b=a(-t.velocityY*3.2,-k,k),g=t.targetX*(1-t.drift),z=t.targetY*(1-t.drift);let H=0,Q=0;for(let c=0;c<=l;c+=1){const R=E.current[c],x=t.positions[c],v=t.bends[c];if(!R||!x||!v)continue;const w=l?c/l:0,vt=f*u*(c+.35);let W=g+d.x*vt,J=z+d.y*vt;if(t.drift>5e-4){const X=t.phase-c*qt,Xt=u*t.drift*(.25+.75*w);W+=Math.sin(X)*Xt,J+=Math.sin(X)*Math.cos(X)*Xt*1.3}const Mt=1-Math.pow(1-a(.34/(1+c*D*4.2),.018,.36),o),bt=1-Math.pow(1-.3/(1+w*(1+D*8)),o);x.x+=(W-x.x)*Mt,x.y+=(J-x.y)*Mt,v.x+=(m*w-v.x)*bt,v.y+=(b*w-v.y)*bt,Q=Math.max(Q,Math.abs(W-x.x),Math.abs(J-x.y),Math.abs(m*w-v.x),Math.abs(b*w-v.y));const wt=x.x+v.x,Et=x.y+v.y,Qt=1+(Bt-1)*w;if(R.style.transform=`translate3d(${wt.toFixed(3)}px, ${Et.toFixed(3)}px, 0) scale(${Qt.toFixed(4)})`,c>0){const X=t.positions[0];H=Math.max(H,Math.hypot(wt-X.x,Et-X.y))}}const Vt=u>0?a(H/(u*2.25),0,1):0,zt=u>0?a(y/(u*.35),0,1):0,Ht=Math.max(f,Vt,zt,t.drift*.9,a(p/5,0,1));t.activity+=(Ht-t.activity)*(1-Math.pow(.82,o)),Ut(e);const xt=s<1||t.activity>.002||Q>.05||p>.02||t.bursts.length>0||q&&t.visible;xt||(t.activity=0);for(let c=1;c<=l;c+=1){const R=E.current[c];R&&(R.style.opacity=String(Math.pow(ht,c)*t.activity))}xt&&(T=requestAnimationFrame(U))},F=()=>{T||(t.lastTime=0,T=requestAnimationFrame(U))},pt=e=>{const n=r.getBoundingClientRect();if(!n.width||!n.height)return;const o=e.clientX-(n.left+n.width/2),h=e.clientY-(n.top+n.height/2),s=Math.hypot(o,h),f=s>0?a(s/dt,0,1):0,y=s>0?o/s:0,p=s>0?h/s:0;t.targetX=y*f*u,t.targetY=p*f*u*.72,t.pointerNear=s<=dt,t.pointerTime=performance.now(),F()},mt=e=>{e.relatedTarget||(t.targetX=0,t.targetY=0,t.pointerNear=!1,F())},I=new WeakMap,yt=e=>{const n=e.target;if(!(n instanceof Document)&&!(n instanceof Element&&n.contains(r)))return;const[o,h]=K(n),s=I.get(n);I.set(n,[o,h]),s&&(t.pushX-=o-s[0],t.pushY-=h-s[1],F())},gt=e=>{const n=lt.current,o=r.getBoundingClientRect();if(!n||!l||!o.width||!o.height)return;const h=a((e.clientX-o.left)/o.width,0,1)*100,s=a((e.clientY-o.top)/o.height,0,1)*100,f=a(Math.round(l/3)+2,3,6),y=t.positions[0],p=[];for(let m=0;m<f;m+=1){const b=E.current[1+Math.round(m/Math.max(1,f-1)*(l-1))];if(!b)continue;const g=b.cloneNode(!0);g.removeAttribute("data-echo-index"),g.style.transformOrigin=`${h.toFixed(1)}% ${s.toFixed(1)}%`,g.style.opacity="0",n.appendChild(g),p.push(g)}for(t.bursts.push({start:performance.now(),x:y?.x||0,y:y?.y||0,nodes:p});t.bursts.length>4;)t.bursts.shift()?.nodes.forEach(m=>m.remove());F()};if(ft&&(window.addEventListener("pointermove",pt,{passive:!0}),document.addEventListener("pointerout",mt)),G){I.set(document,K(document));for(let e=r.parentElement;e;e=e.parentElement)I.set(e,K(e));document.addEventListener("scroll",yt,{capture:!0,passive:!0})}j&&r.addEventListener("click",gt);let V;return q&&typeof IntersectionObserver<"u"&&(V=new IntersectionObserver(e=>{t.visible=e[e.length-1].isIntersecting,t.visible&&F()}),V.observe(r)),U(t.startTime),()=>{cancelAnimationFrame(T),window.removeEventListener("pointermove",pt),document.removeEventListener("pointerout",mt),document.removeEventListener("scroll",yt,{capture:!0}),r.removeEventListener("click",gt),V?.disconnect(),t.bursts.forEach(e=>e.nodes.forEach(n=>n.remove()))}},[nt,j,st,tt,at,it,l,rt,et,L,Y,Z,B,S]);const St={fontSize:Lt,fontWeight:Nt,color:$t,cursor:Ct?"pointer":void 0,...kt},jt=["pointer-events-none absolute inset-0 block origin-center transform-gpu backface-hidden will-change-[transform,opacity] motion-reduce:hidden",Rt==="outline"?"[-webkit-text-fill-color:transparent] [-webkit-text-stroke:max(1px,0.014em)_currentColor]":""].join(" ").trim();return _.jsxs("span",{ref:ct,className:`relative inline-block whitespace-nowrap select-none leading-[0.9] tracking-[-0.04em] [contain:layout_style] [font-kerning:normal] [text-rendering:geometricPrecision] ${At}`.trim(),style:St,children:[_t.map(r=>_.jsx("span",{"aria-hidden":"true",className:jt,"data-echo-index":r,ref:d=>{E.current[r]=d},style:{color:Pt(r),opacity:0},children:i},`echo-${r}`)),_.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0",ref:lt}),_.jsx("span",{className:"pointer-events-none relative z-[2] block transform-gpu text-shadow-[0_0.035em_0_rgba(255,255,255,0.04)] will-change-transform motion-reduce:[transform:none]!","data-echo-index":"0",ref:r=>{E.current[0]=r},children:i})]})};export{ne as default};
1
+ import{r as M,m as Yt,j as _}from"./index-CH-7pBbW.js";const Wt=typeof window>"u"?M.useEffect:M.useLayoutEffect,a=(i,C,L)=>Math.min(Math.max(i,C),L),Tt={right:{x:1,y:0},left:{x:-1,y:0},up:{x:0,y:-1},down:{x:0,y:1},diagonal:{x:.72,y:.72}},Ft={linear:i=>i,"ease-out":i=>1-Math.pow(1-i,3),"ease-in-out":i=>i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2,snappy:i=>1-Math.pow(1-i,5)},Jt=7200,Kt=2600,Zt=1100,te=80,K=i=>i instanceof Element?[i.scrollLeft||0,i.scrollTop||0]:[window.scrollX,window.scrollY],ne=({text:i="Motion Echo",echoes:C=12,lag:L=.24,offset:Z=36,direction:tt="right",fade:et=.72,blur:nt=3,tint:ot="#7dd3fc",echoColors:P,echoStyle:Rt="solid",echoScale:rt=1,mode:Y="both",trail:S="pointer",clickBurst:j=!0,cursorRadius:st=320,duration:at=900,ease:it="ease-out",fontSize:Lt="clamp(3rem, 9vw, 7rem)",fontWeight:Nt=800,color:$t="currentColor",className:At="",style:kt})=>{const ct=M.useRef(null),lt=M.useRef(null),E=M.useRef([]),[B,It]=M.useState(!1),l=B?0:a(Math.round(C),0,24),_t=M.useMemo(()=>Array.from({length:l},(r,d)=>l-d),[l]),N=Array.isArray(P)&&P.length?P:null,Ct=j&&l>0,Pt=r=>{if(N){const d=l>1?(r-1)/(l-1):0;return`color-mix(in srgb, ${N[N.length-1]} ${Math.round(d*100)}%, ${N[0]})`}return ot?`color-mix(in srgb, ${ot} ${Math.min(72,18+r*5)}%, currentColor)`:void 0};M.useEffect(()=>{if(!window.matchMedia)return;const r=Yt(),d=()=>It(r.matches);return d(),()=>r.removeEventListener?.("change",d)},[]),Wt(()=>{const r=ct.current;if(!r||B||Yt().matches)return;const d=Tt[tt]||Tt.right,u=a(Number(Z)||0,0,120),dt=a(Number(st)||320,40,1200),D=a(Number(L)||.16,.02,.5),ht=a(Number(et)||.64,.1,.95),$=a(Number(nt)||0,0,16),Bt=a(Number(rt)||1,.25,2.5),ut=Math.max(0,Number(at)||0),Dt=Ft[it]||Ft["ease-out"],A=Y==="entrance"||Y==="both",O=Y==="pointer"||Y==="both",Ot=!!window.matchMedia?.("(hover: hover) and (pointer: fine)").matches,q=O&&S==="auto",G=O&&S==="scroll",ft=O&&Ot&&!G,qt=.12+D*1.1,Gt=a(u/36,.35,2.5),k=u*4,t={targetX:0,targetY:0,lastTargetX:0,lastTargetY:0,activity:A?1:0,positions:Array.from({length:l+1},(e,n)=>{const o=A?u*(n+.35):0;return{x:d.x*o,y:d.y*o}}),bends:Array.from({length:l+1},()=>({x:0,y:0})),startTime:performance.now(),lastTime:0,drift:0,phase:0,pointerNear:!1,pointerTime:-1/0,visible:!0,pushX:0,pushY:0,velocityX:0,velocityY:0,bursts:[]};let T=0;for(let e=1;e<=l;e+=1){const n=E.current[e];n&&(n.style.filter=$>0?`blur(${($*e/l).toFixed(2)}px)`:"none")}const Ut=e=>{t.bursts=t.bursts.filter(n=>{const o=e-n.start;let h=!1;return n.nodes.forEach((s,f)=>{const y=(o-f*te)/Zt;y<1&&(h=!0);const p=a(y,0,1),m=1-Math.pow(1-p,3),b=1+m*.34*Gt,g=.75*Math.pow(ht,f*.5),z=y<=0?0:Math.min(1,p*8)*Math.pow(1-p,1.5)*g;s.style.transform=`translate3d(${n.x.toFixed(2)}px, ${n.y.toFixed(2)}px, 0) scale(${b.toFixed(4)})`,s.style.opacity=z.toFixed(3),s.style.filter=$>0?`blur(${($*.3*m).toFixed(2)}px)`:"none"}),h||n.nodes.forEach(s=>s.remove()),h})},U=e=>{T=0;const n=t.lastTime?a(e-t.lastTime,0,64):16.67,o=n/16.67;t.lastTime=e;const h=e-t.startTime,s=A&&ut>0?a(h/ut,0,1):1,f=A?1-Dt(s):0,y=Math.hypot(t.targetX-t.lastTargetX,t.targetY-t.lastTargetY);if(t.lastTargetX=t.targetX,t.lastTargetY=t.targetY,q){const c=!ft||!t.pointerNear||e-t.pointerTime>Kt;t.drift+=((c?1:0)-t.drift)*(1-Math.pow(.965,o)),t.phase+=n/Jt*Math.PI*2}if(G){const c=1-Math.pow(.7,o);t.velocityX+=(t.pushX/Math.max(o,.25)-t.velocityX)*c,t.velocityY+=(t.pushY/Math.max(o,.25)-t.velocityY)*c,t.pushX=0,t.pushY=0}const p=Math.hypot(t.velocityX,t.velocityY),m=a(-t.velocityX*3.2,-k,k),b=a(-t.velocityY*3.2,-k,k),g=t.targetX*(1-t.drift),z=t.targetY*(1-t.drift);let H=0,Q=0;for(let c=0;c<=l;c+=1){const R=E.current[c],x=t.positions[c],v=t.bends[c];if(!R||!x||!v)continue;const w=l?c/l:0,vt=f*u*(c+.35);let W=g+d.x*vt,J=z+d.y*vt;if(t.drift>5e-4){const X=t.phase-c*qt,Xt=u*t.drift*(.25+.75*w);W+=Math.sin(X)*Xt,J+=Math.sin(X)*Math.cos(X)*Xt*1.3}const Mt=1-Math.pow(1-a(.34/(1+c*D*4.2),.018,.36),o),bt=1-Math.pow(1-.3/(1+w*(1+D*8)),o);x.x+=(W-x.x)*Mt,x.y+=(J-x.y)*Mt,v.x+=(m*w-v.x)*bt,v.y+=(b*w-v.y)*bt,Q=Math.max(Q,Math.abs(W-x.x),Math.abs(J-x.y),Math.abs(m*w-v.x),Math.abs(b*w-v.y));const wt=x.x+v.x,Et=x.y+v.y,Qt=1+(Bt-1)*w;if(R.style.transform=`translate3d(${wt.toFixed(3)}px, ${Et.toFixed(3)}px, 0) scale(${Qt.toFixed(4)})`,c>0){const X=t.positions[0];H=Math.max(H,Math.hypot(wt-X.x,Et-X.y))}}const Vt=u>0?a(H/(u*2.25),0,1):0,zt=u>0?a(y/(u*.35),0,1):0,Ht=Math.max(f,Vt,zt,t.drift*.9,a(p/5,0,1));t.activity+=(Ht-t.activity)*(1-Math.pow(.82,o)),Ut(e);const xt=s<1||t.activity>.002||Q>.05||p>.02||t.bursts.length>0||q&&t.visible;xt||(t.activity=0);for(let c=1;c<=l;c+=1){const R=E.current[c];R&&(R.style.opacity=String(Math.pow(ht,c)*t.activity))}xt&&(T=requestAnimationFrame(U))},F=()=>{T||(t.lastTime=0,T=requestAnimationFrame(U))},pt=e=>{const n=r.getBoundingClientRect();if(!n.width||!n.height)return;const o=e.clientX-(n.left+n.width/2),h=e.clientY-(n.top+n.height/2),s=Math.hypot(o,h),f=s>0?a(s/dt,0,1):0,y=s>0?o/s:0,p=s>0?h/s:0;t.targetX=y*f*u,t.targetY=p*f*u*.72,t.pointerNear=s<=dt,t.pointerTime=performance.now(),F()},mt=e=>{e.relatedTarget||(t.targetX=0,t.targetY=0,t.pointerNear=!1,F())},I=new WeakMap,yt=e=>{const n=e.target;if(!(n instanceof Document)&&!(n instanceof Element&&n.contains(r)))return;const[o,h]=K(n),s=I.get(n);I.set(n,[o,h]),s&&(t.pushX-=o-s[0],t.pushY-=h-s[1],F())},gt=e=>{const n=lt.current,o=r.getBoundingClientRect();if(!n||!l||!o.width||!o.height)return;const h=a((e.clientX-o.left)/o.width,0,1)*100,s=a((e.clientY-o.top)/o.height,0,1)*100,f=a(Math.round(l/3)+2,3,6),y=t.positions[0],p=[];for(let m=0;m<f;m+=1){const b=E.current[1+Math.round(m/Math.max(1,f-1)*(l-1))];if(!b)continue;const g=b.cloneNode(!0);g.removeAttribute("data-echo-index"),g.style.transformOrigin=`${h.toFixed(1)}% ${s.toFixed(1)}%`,g.style.opacity="0",n.appendChild(g),p.push(g)}for(t.bursts.push({start:performance.now(),x:y?.x||0,y:y?.y||0,nodes:p});t.bursts.length>4;)t.bursts.shift()?.nodes.forEach(m=>m.remove());F()};if(ft&&(window.addEventListener("pointermove",pt,{passive:!0}),document.addEventListener("pointerout",mt)),G){I.set(document,K(document));for(let e=r.parentElement;e;e=e.parentElement)I.set(e,K(e));document.addEventListener("scroll",yt,{capture:!0,passive:!0})}j&&r.addEventListener("click",gt);let V;return q&&typeof IntersectionObserver<"u"&&(V=new IntersectionObserver(e=>{t.visible=e[e.length-1].isIntersecting,t.visible&&F()}),V.observe(r)),U(t.startTime),()=>{cancelAnimationFrame(T),window.removeEventListener("pointermove",pt),document.removeEventListener("pointerout",mt),document.removeEventListener("scroll",yt,{capture:!0}),r.removeEventListener("click",gt),V?.disconnect(),t.bursts.forEach(e=>e.nodes.forEach(n=>n.remove()))}},[nt,j,st,tt,at,it,l,rt,et,L,Y,Z,B,S]);const St={fontSize:Lt,fontWeight:Nt,color:$t,cursor:Ct?"pointer":void 0,...kt},jt=["pointer-events-none absolute inset-0 block origin-center transform-gpu backface-hidden will-change-[transform,opacity] motion-reduce:hidden",Rt==="outline"?"[-webkit-text-fill-color:transparent] [-webkit-text-stroke:max(1px,0.014em)_currentColor]":""].join(" ").trim();return _.jsxs("span",{ref:ct,className:`relative inline-block whitespace-nowrap select-none leading-[0.9] tracking-[-0.04em] [contain:layout_style] [font-kerning:normal] [text-rendering:geometricPrecision] ${At}`.trim(),style:St,children:[_t.map(r=>_.jsx("span",{"aria-hidden":"true",className:jt,"data-echo-index":r,ref:d=>{E.current[r]=d},style:{color:Pt(r),opacity:0},children:i},`echo-${r}`)),_.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0",ref:lt}),_.jsx("span",{className:"pointer-events-none relative z-[2] block transform-gpu text-shadow-[0_0.035em_0_rgba(255,255,255,0.04)] will-change-transform motion-reduce:[transform:none]!","data-echo-index":"0",ref:r=>{E.current[0]=r},children:i})]})};export{ne as default};
@@ -1,4 +1,4 @@
1
- import{r as k,m as He,j as Q}from"./index-Dkr9bjPf.js";const We=`#version 300 es
1
+ import{r as k,m as He,j as Q}from"./index-CH-7pBbW.js";const We=`#version 300 es
2
2
  in vec2 aPosition;
3
3
  uniform vec2 uTexel;
4
4
  out vec2 vUv;
@@ -1,4 +1,4 @@
1
- import{r as C,m as Ke,j as pe}from"./index-Dkr9bjPf.js";const V=8,B=3,ge=2400,z=3.4,ve=2.8,xe=["#4a3a9c","#8eb2ea","#6e8c3c","#d6f2ef","#f2d48c"],Ue=`#version 300 es
1
+ import{r as C,m as Ke,j as pe}from"./index-CH-7pBbW.js";const V=8,B=3,ge=2400,z=3.4,ve=2.8,xe=["#4a3a9c","#8eb2ea","#6e8c3c","#d6f2ef","#f2d48c"],Ue=`#version 300 es
2
2
  void main() {
3
3
  vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
4
4
  gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
@@ -1,4 +1,4 @@
1
- import{r as k,m as Ne,j as re}from"./index-Dkr9bjPf.js";const _e=1.8,Ue=`#version 300 es
1
+ import{r as k,m as Ne,j as re}from"./index-CH-7pBbW.js";const _e=1.8,Ue=`#version 300 es
2
2
  in vec2 aPosition;
3
3
  void main() {
4
4
  gl_Position = vec4(aPosition, 0.0, 1.0);
@@ -1,4 +1,4 @@
1
- import{r as C,m as gt,j as Be}from"./index-Dkr9bjPf.js";const ge=8,ae=3,Ge=4,We=2400,xt=4,V=2.4,ze=2.2,Xe=["#f2f5ff","#7fb2ff","#2f6bff"],vt=`#version 300 es
1
+ import{r as C,m as gt,j as Be}from"./index-CH-7pBbW.js";const ge=8,ae=3,Ge=4,We=2400,xt=4,V=2.4,ze=2.2,Xe=["#f2f5ff","#7fb2ff","#2f6bff"],vt=`#version 300 es
2
2
  void main() {
3
3
  vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
4
4
  gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
@@ -1,4 +1,4 @@
1
- import{r as S,m as Me,j as oe}from"./index-Dkr9bjPf.js";const Ee=24e5,O=Math.PI*2,ne={"top-right":{flipX:0,flipY:0,side:0},"top-left":{flipX:1,flipY:0,side:0},"bottom-right":{flipX:0,flipY:1,side:0},"bottom-left":{flipX:1,flipY:1,side:0},right:{flipX:0,flipY:0,side:1},left:{flipX:1,flipY:0,side:1}},Fe=`#version 300 es
1
+ import{r as S,m as Me,j as oe}from"./index-CH-7pBbW.js";const Ee=24e5,O=Math.PI*2,ne={"top-right":{flipX:0,flipY:0,side:0},"top-left":{flipX:1,flipY:0,side:0},"bottom-right":{flipX:0,flipY:1,side:0},"bottom-left":{flipX:1,flipY:1,side:0},right:{flipX:0,flipY:0,side:1},left:{flipX:1,flipY:0,side:1}},Fe=`#version 300 es
2
2
  const vec2 corners[3] = vec2[3](vec2(-1.0, -1.0), vec2(3.0, -1.0), vec2(-1.0, 3.0));
3
3
  void main() {
4
4
  gl_Position = vec4(corners[gl_VertexID], 0.0, 1.0);
@@ -1,4 +1,4 @@
1
- import{r as D,m as ft,j as Be}from"./index-Dkr9bjPf.js";const ht=`#version 300 es
1
+ import{r as D,m as ft,j as Be}from"./index-CH-7pBbW.js";const ht=`#version 300 es
2
2
  in vec2 aCorner;
3
3
  in vec4 aShape;
4
4
  in vec4 aTop;
@@ -1,4 +1,4 @@
1
- import{r,j as n,m as pt}from"./index-Dkr9bjPf.js";const Ft=["LAUNCH READY","SYNC ONLINE","SIGNAL LIVE"],P={alpha:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",numeric:"0123456789"},Lt=`
1
+ import{r,j as n,m as pt}from"./index-CH-7pBbW.js";const Ft=["LAUNCH READY","SYNC ONLINE","SIGNAL LIVE"],P={alpha:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",alphanumeric:"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",numeric:"0123456789"},Lt=`
2
2
  .split-flap-text{gap:var(--split-flap-gap,6px);font-family:'SFMono-Regular','Roboto Mono','Cascadia Code','Liberation Mono',Menlo,monospace;font-size:var(--split-flap-font-size,52px);font-weight:760;line-height:1;letter-spacing:.035em;font-variant-numeric:tabular-nums}
3
3
  .split-flap-text__tile{position:relative;flex:none;width:.78em;height:1.08em;overflow:hidden;border-radius:var(--split-flap-radius,8px);background:radial-gradient(circle at 50% 0%,rgba(255,255,255,.16),transparent 44%),linear-gradient(180deg,color-mix(in srgb,var(--split-flap-tile-color,#111827) 82%,white),var(--split-flap-tile-color,#111827));box-shadow:0 .035em .08em rgba(255,255,255,.08) inset,0 -.05em .1em rgba(0,0,0,.38) inset,0 calc(.16em * var(--split-flap-lift,1)) calc(.38em * var(--split-flap-lift,1)) rgba(0,0,0,var(--split-flap-drop,.28));perspective:10em;transform-style:preserve-3d;isolation:isolate}
4
4
  .split-flap-text__tile::before{content:'';position:absolute;z-index:8;top:calc(50% - var(--split-flap-hinge,1px) / 2);left:0;width:100%;height:var(--split-flap-hinge,1px);background:linear-gradient(90deg,transparent,rgba(255,255,255,.18) 18%,rgba(0,0,0,var(--split-flap-hinge-shade,.64)) 50%,rgba(255,255,255,.14) 82%,transparent);box-shadow:0 -1px 0 rgba(255,255,255,.08),0 1px 0 rgba(0,0,0,.5);pointer-events:none}
@@ -1,4 +1,4 @@
1
- import{r as M,m as xe,j as be}from"./index-Dkr9bjPf.js";const R=8,C=7,ye=`#version 300 es
1
+ import{r as M,m as xe,j as be}from"./index-CH-7pBbW.js";const R=8,C=7,ye=`#version 300 es
2
2
  in vec2 position;
3
3
  void main() {
4
4
  gl_Position = vec4(position, 0.0, 1.0);
@@ -1 +1 @@
1
- import{r as ot,m as $e,j as Zt}from"./index-Dkr9bjPf.js";const te="10px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",ee=8,Ct=320,Pe=/^(currentcolor|inherit)$/i,Ie=.15,We=.62,D=(C,T,_,Q)=>C+(T-C)*(1-Math.exp(-_/Q)),ft=C=>Math.min(1,Math.max(0,Number(C)||0)),nt=(C,T,_)=>{const Q=ft((_-C)/(T-C));return Q*Q*(3-2*Q)},N=(...C)=>{let T=2166136261;for(const _ of C)T=Math.imul(T^(_|0),16777619),T^=T>>>13,T=Math.imul(T,1540483477),T^=T>>>15;return(T>>>0)/4294967296},oe=C=>C>0?`+${C}`:C<0?`−${-C}`:"0",He=({text:C="React Bits",fontFamily:T="",fontWeight:_=600,fontSize:Q=150,letterSpacing:ne=-.05,color:se="currentColor",accentColor:ae="currentColor",align:ie="center",reach:re=200,softness:ce=.7,dashLength:le=4,dashGap:fe=2,strokeWidth:de=1.5,lineStyle:ue="dashed",reveal:he="letter",specks:xe=15,selection:me=!0,labels:pe=!0,draggable:be=!0,bounce:ge=.4,sweep:ye=!0,speed:Me=1,clickKick:ve=!0,intro:Be="none",introDuration:we=2,guides:Ae=!1,className:ke="",style:Le})=>{const St=ot.useRef(null),Tt=ot.useRef(null),dt=ot.useRef(null),st=ot.useRef(()=>{});return ot.useEffect(()=>{dt.current={text:C,fontFamily:T,fontWeight:_,fontSize:Q,letterSpacing:ne,color:se,accentColor:ae,align:ie,reach:re,softness:ce,dashLength:le,dashGap:fe,strokeWidth:de,lineStyle:ue,reveal:he,specks:xe,selection:me,labels:pe,draggable:be,bounce:ge,sweep:ye,speed:Me,clickKick:ve,intro:Be,introDuration:we,guides:Ae},st.current()}),ot.useEffect(()=>{const y=St.current,O=Tt.current,n=O?.getContext("2d"),Y=document.createElement("canvas"),F=Y.getContext("2d");if(!y||!O||!n||!F)return;const gt=$e()?.matches;let K=1,at=1,b=1,it=0,yt=performance.now(),Mt=!1,vt=!0,Bt="",wt=!0,zt="",G=null,M=[],U=0,At=0,V=0,Ot=!1,L=-1,Dt="",kt=0,X="",z=!1,Ft=!document.fonts,Z=0;const q=[],P={x:0,y:0,time:0,index:-1},k={x:0,y:0,inside:!1},ut={x:0,y:0},I={x:0,y:0},f={x1:0,y1:0,x2:0,y2:0,alpha:0,index:-1},tt=()=>{Bt="",st.current()},$t=()=>{Ft=!0,tt()},Pt=t=>t.fontFamily||getComputedStyle(y).fontFamily||"sans-serif",It=(t,e)=>`${t.fontWeight} ${e}px ${Pt(t)}`,Ee=t=>{const e=getComputedStyle(y).color||"#000000",o=s=>!s||Pe.test(String(s).trim())?e:s;return{ink:o(t.color),accent:o(t.accentColor)}},Lt=(t,e,o)=>{t.font=It(e,o),"letterSpacing"in t&&(t.letterSpacing=`${e.letterSpacing*o}px`),t.textAlign="left",t.textBaseline="alphabetic"},Wt=(t,e,o,s,r)=>{const a=Math.ceil(t.strokeWidth*2+4),h=o.box.x1-a,l=o.box.y1-a,c=o.box.x2-o.box.x1+a*2,x=o.box.y2-o.box.y1+a*2,u=document.createElement("canvas");u.addEventListener("contextrestored",tt),u.width=Math.max(1,Math.ceil(c*b)),u.height=Math.max(1,Math.ceil(x*b));const d=u.getContext("2d");return d?(d.setTransform(b,0,0,b,-h*b,-l*b),Lt(d,t,e.size),s?(d.lineJoin="round",d.lineWidth=t.strokeWidth*2,d.lineCap="butt",d.strokeStyle=r,t.lineStyle!=="solid"&&d.setLineDash([Math.max(1,t.dashLength),Math.max(1,t.dashGap)]),d.strokeText(o.char,o.x,e.baseline),d.setLineDash([]),d.globalCompositeOperation="destination-out",d.fillStyle="#000000",d.fillText(o.char,o.x,e.baseline),d.globalCompositeOperation="source-over"):(d.fillStyle=r,d.fillText(o.char,o.x,e.baseline)),{image:u,left:h,top:l}):{image:u,left:h,top:l}},Re=(t,e)=>{const o=[t.text,Pt(t),t.fontWeight,t.fontSize,t.letterSpacing,t.align,e,t.dashLength,t.dashGap,t.strokeWidth,t.lineStyle,K,at,b].join("|");if(o===Bt&&G)return G;Bt=o;const s=It(t,64);document.fonts&&s!==zt&&(zt=s,document.fonts.load(s,t.text).then(tt,tt));const r=F;Lt(r,t,t.fontSize);let a=r.measureText(t.text);const h=Math.min(1,K*.9/Math.max(a.actualBoundingBoxLeft+a.actualBoundingBoxRight,1),at*.66/Math.max(a.actualBoundingBoxAscent+a.actualBoundingBoxDescent,1)),l=t.fontSize*h;Lt(r,t,l),a=r.measureText(t.text);const c=a.actualBoundingBoxLeft+a.actualBoundingBoxRight,x=a.actualBoundingBoxAscent+a.actualBoundingBoxDescent,u=K*.05,p=(t.align==="left"?u:t.align==="right"?K-u-c:(K-c)/2)+a.actualBoundingBoxLeft,m=(at-x)/2+a.actualBoundingBoxAscent,E=m-r.measureText("x").actualBoundingBoxAscent,A=m-r.measureText("H").actualBoundingBoxAscent,B=m-r.measureText("d").actualBoundingBoxAscent,R=m+r.measureText("p").actualBoundingBoxDescent,S=m-a.actualBoundingBoxAscent,i=m+a.actualBoundingBoxDescent,g=Math.min(S,A)-2,v=Math.max(i,m)+2,w={size:l,baseline:m,left:p-a.actualBoundingBoxLeft,right:p+a.actualBoundingBoxRight,top:S,bottom:i,lines:[{y:m,label:"baseline"},{y:E,label:"x-height"},{y:A,label:"cap height"},...A-B>Math.max(11,l*.06)?[{y:B,label:"ascender"}]:[],{y:R,label:"descender"}],bands:[{y0:E,y1:m,up:!0,order:0},{y0:A,y1:E,up:!0,order:1},{y0:g,y1:A,up:!0,order:2},{y0:m,y1:v,up:!1,order:1}].filter($=>$.y1-$.y0>.5)};G=w;const j=Array.from(t.text),H=M;M=[];let pt="";return j.forEach(($,ct)=>{pt+=$;const lt=r.measureText($),Et=p+r.measureText(pt).width-lt.width;if(!$.trim())return;const Rt={char:$,x:Et,box:{x1:Et-lt.actualBoundingBoxLeft,y1:m-lt.actualBoundingBoxAscent,x2:Et+lt.actualBoundingBoxRight,y2:m+lt.actualBoundingBoxDescent}},et=H[M.length],bt=et?.char===$&&et.index===ct;M.push({...Rt,offset:bt?et.offset:{x:0,y:0},velocity:bt?et.velocity:{x:0,y:0},outline:bt?et.outline:0,shown:bt?et.shown:1,cells:null,assembled:0,index:ct,fill:Wt(t,w,Rt,!1,e),dashes:Wt(t,w,Rt,!0,e)})}),L>=0&&M[L]?.index!==H[L]?.index&&(L=-1),f.index>=0&&M[f.index]?.char!==H[f.index]?.char&&(f.index=-1),w},jt=(t,e)=>{if(!G||e<G.top-24||e>G.bottom+24)return-1;let o=-1,s=1/0;return M.forEach((r,a)=>{const h=r.box.x1+r.offset.x,l=r.box.x2+r.offset.x,c=t<h?h-t:t>l?t-l:0;c<s&&(s=c,o=a)}),s<28?o:-1},Ht=(t,e,o,s,r,a)=>{const h=Math.min(1,Math.max(0,1-a)),l=t.createRadialGradient(e,o,0,e,o,s);if(l.addColorStop(0,`rgba(0, 0, 0, ${r})`),h>.995)return l.addColorStop(.995,`rgba(0, 0, 0, ${r})`),l.addColorStop(1,"rgba(0, 0, 0, 0)"),l;for(let c=0;c<=ee;c++){const x=c/ee,u=x*x*(3-2*x);l.addColorStop(h+(1-h)*x,`rgba(0, 0, 0, ${r*(1-u)})`)}return l},J=(t,e,o,s,r,a)=>{t.drawImage(e.image,Math.round((e.left+o)*b-r),Math.round((e.top+s)*b-a))},Ce=t=>{const e=t.reach*b,o=I.x*b,s=I.y*b;n.globalCompositeOperation="destination-out",n.fillStyle=Ht(n,o,s,e,U,t.softness),n.fillRect(o-e,s-e,e*2,e*2),n.globalCompositeOperation="source-over";const r=Math.max(0,Math.floor(o-e)),a=Math.max(0,Math.floor(s-e)),h=Math.min(O.width,Math.ceil(o+e)),l=Math.min(O.height,Math.ceil(s+e));if(h<=r||l<=a)return;const c=h-r,x=l-a;(Y.width<c||Y.height<x)&&(Y.width=Math.max(Y.width,c),Y.height=Math.max(Y.height,x)),F.setTransform(1,0,0,1,0,0),F.globalCompositeOperation="source-over",F.clearRect(0,0,c,x);for(const u of M)J(F,u.dashes,u.offset.x,u.offset.y,r,a);F.globalCompositeOperation="destination-in",F.fillStyle=Ht(F,o-r,s-a,e,1,t.softness),F.fillRect(0,0,c,x),F.globalCompositeOperation="source-over",n.globalAlpha=U,n.drawImage(Y,0,0,c,x,r,a,c,x),n.globalAlpha=1},rt=t=>(Math.round(t*b)+.5)/b,Nt=(t,e,o)=>{let s=(t%(2*(e+o))+2*(e+o))%(2*(e+o));return s<e?[f.x1+s,f.y1,0,-1]:(s-=e,s<o?[f.x2,f.y1+s,1,0]:(s-=o,s<e?[f.x2-s,f.y2,0,1]:(s-=e,[f.x1,f.y2-s,-1,0])))},Se=(t,e,o)=>{const s=f.x2-f.x1,r=f.y2-f.y1;if(s<2||r<2)return;const a=2*(s+r),h=f.index+1,l=3;n.fillStyle=o,n.strokeStyle=o;for(let c=0;c<t.specks;c++){const x=.5+N(h,c,11)*1.2,u=V/x+N(h,c,17),d=Math.floor(u),p=u-d;if(p>.7)continue;const[m,E,A,B]=Nt(N(h,c,d)*a,s,r),R=N(h,c,d,2),S=R<.46?2:R<.7?3:R<.84?5:R<.94?8:11,i=S>=8,g=(i?9:4)+Math.floor(N(h,c,d,1)*5)*l,v=f.x1+Math.round((m+A*g-f.x1)/l)*l,w=f.y1+Math.round((E+B*g-f.y1)/l)*l,j=N(h,c,d,3),H=p<.06||p>.32&&p<.36?.35:1,pt=e*(i?.3+.4*j:.3+.6*j)*H,$=Math.round(v-S/2),ct=Math.round(w-S/2);n.globalAlpha=pt,j<.26||i&&j<.78?(n.strokeRect($+.5,ct+.5,S,S),i&&j>.5&&n.fillRect(Math.round(v)-1,Math.round(w)-1,2,2)):n.fillRect($,ct,S,S)}for(let c=0;c<2;c++){const x=(V*.42*t.speed+c*.5)*a;for(let u=0;u<4;u++){const[d,p]=Nt(x-u*6,s,r),m=u===0?3:2;n.globalAlpha=e*[.95,.55,.32,.16][u],n.fillRect(Math.round(d-m/2),Math.round(p-m/2),m,m)}}n.globalAlpha=1},Te=(t,e)=>{const o=M[f.index];if(!o||f.alpha<.01)return;const s=f.alpha,r=rt(f.x1),a=rt(f.y1),h=rt(f.x2),l=rt(f.y2);n.setTransform(b,0,0,b,0,0),n.fillStyle=e,n.strokeStyle=e,n.lineWidth=1;const c=Math.hypot(o.offset.x,o.offset.y);if(c>1){const u=(o.box.x1+o.box.x2)/2,d=(o.box.y1+o.box.y2)/2;n.beginPath(),n.moveTo(u,d),n.lineTo(u+o.offset.x,d+o.offset.y),n.setLineDash([3,4]),n.globalAlpha=.45*s,n.stroke(),n.setLineDash([]),n.beginPath(),n.rect(Math.round(u)-2,Math.round(d)-2,4,4),n.globalAlpha=.7*s,n.fill()}n.beginPath(),n.rect(r,a,h-r,l-a),n.globalAlpha=.5*s,n.stroke(),n.beginPath();for(const[u,d]of[[r,a],[h,a],[h,l],[r,l]])n.rect(Math.round(u)-2,Math.round(d)-2,5,5);if(n.globalAlpha=.95*s,n.fill(),n.globalAlpha=1,t.specks>0&&Se(t,s,e),!t.labels)return;n.font=te,n.textAlign="left",n.textBaseline="bottom",n.fillStyle=e,n.globalAlpha=.62*s;const x=c>1?`${oe(Math.round(o.offset.x))}, ${oe(Math.round(-o.offset.y))}`:`${o.char} ${Math.round(o.box.x2-o.box.x1)} × ${Math.round(o.box.y2-o.box.y1)}`;n.fillText(x,Math.round(f.x1),Math.round(f.y1)-7),n.globalAlpha=1},Yt=(t,e,o,s,r)=>{const a=Math.max(12,e.size*.12),h=Math.round(e.left-a),l=Math.round(e.right+a),c=K-l>h;n.setTransform(b,0,0,b,0,0),n.strokeStyle=o,n.fillStyle=o,n.lineWidth=1,n.font=te,n.textBaseline="middle",n.textAlign=c?"left":"right",e.lines.forEach((x,u)=>{const d=r(u);if(d<=.001)return;const p=rt(x.y),m=h+(l-h)*d;n.globalAlpha=s*.4,n.beginPath(),n.moveTo(h,p),n.lineTo(m,p),n.stroke(),n.globalAlpha=s*.9,n.fillRect(h-1,Math.round(x.y)-1,3,3),n.fillRect(Math.round(m)-1,Math.round(x.y)-1,3,3),t.labels&&(n.globalAlpha=s*.62*nt(.7,1,d),n.fillText(x.label,c?l+8:h-8,Math.round(x.y)))}),n.textAlign="left",n.setTransform(1,0,0,1,0,0),n.globalAlpha=1},ze=(t,e)=>{if(t.cells)return t.cells;const o=t.fill,s=Math.max(3,Math.round(e.size/26)),r=o.image.width,a=o.image.height,h=o.image.getContext("2d"),l=[];if(t.cells=l,t.assembled=0,!h||r<2||a<2)return l;const c=h.getImageData(0,0,r,a).data,x=Math.floor(o.left/s)*s,u=Math.floor(o.top/s)*s,d=Math.ceil((o.left+r/b-x)/s)+1,p=Math.ceil((o.top+a/b-u)/s)+1,m=new Uint8Array(d*p);for(let B=0;B<a;B++)for(let R=0;R<r;R++){if(c[(B*r+R)*4+3]<24)continue;const S=Math.floor((o.left+R/b-x)/s),i=Math.floor((o.top+B/b-u)/s);m[i*d+S]=1}const E=(t.box.x1+t.box.x2)/2,A=ft((E-e.left)/Math.max(1,e.right-e.left));for(let B=0;B<m.length;B++){if(!m[B])continue;const R=N(t.index,B,1)*Math.PI*2,S=e.size*(.25+.6*N(t.index,B,2)),i=.03+.36*A+.12*N(t.index,B,3),g=i+.3+.14*N(t.index,B,4);l.push({x:x+B%d*s,y:u+Math.floor(B/d)*s,size:s,dx:Math.cos(R)*S,dy:Math.sin(R)*S*.7,start:i,land:g}),t.assembled=Math.max(t.assembled,g)}return l},Kt=(t,e,o)=>{const s=Math.round(t*b),r=Math.round(e*b);return[s,r,Math.round((t+o)*b)-s,Math.round((e+o)*b)-r]},Oe=(t,e,o)=>{const s=t.cells||[];n.save(),n.beginPath();let r=0;for(const a of s){if(e<a.land)continue;const[h,l,c,x]=Kt(a.x,a.y,a.size);n.rect(h,l,c,x),r++}r&&(n.clip(),J(n,t.fill,0,0,0,0)),n.restore(),n.fillStyle=o;for(const a of s){if(e<a.start||e>=a.land)continue;const h=(e-a.start)/(a.land-a.start),l=1-Math.pow(1-h,4),c=a.size*(.4+.6*l),x=a.x+(a.size-c)/2+a.dx*(1-l),u=a.y+(a.size-c)/2+a.dy*(1-l),[d,p,m,E]=Kt(x,u,c);n.globalAlpha=Math.min(1,h*4)*(.55+.45*l),n.fillRect(d,p,Math.max(1,m),Math.max(1,E))}n.globalAlpha=1},De=(t,e,o,s)=>{const r=t.fill,a=Math.floor(r.left*b),h=Math.floor(r.top*b),l=r.image.width+2,c=r.image.height+2,x=ft((o-.24-.28*e)/.48),u=[];for(const p of s.bands){const m=nt(.3*p.order,.3*p.order+.4,x);if(m<=0)continue;const E=(p.y1-p.y0)*m,A=Math.round((p.up?p.y1-E:p.y0)*b),B=Math.round((p.up?p.y1:p.y0+E)*b);B>A&&u.push([A,B-A])}const d=nt(.08+.2*e,.22+.2*e,o);if(d>.001){n.save(),n.beginPath(),n.rect(a-2,h-2,l+2,c+2);for(const[p,m]of u)n.rect(a-2,p,l+2,m);n.clip("evenodd"),n.globalAlpha=d,J(n,t.dashes,0,0,0,0),n.restore()}if(u.length){n.save(),n.beginPath();for(const[p,m]of u)n.rect(a-2,p,l+2,m);n.clip(),J(n,t.fill,0,0,0,0),n.restore()}n.globalAlpha=1},Fe=t=>{const e=(G?G.size:120)*11;q.push({index:t,at:V,velocity:e});for(let o=1;o<M.length;o++){const s=e*Math.pow(We,o);if(s<30)break;for(const r of[t-o,t+o])r>=0&&r<M.length&&q.push({index:r,at:V+o*.055,velocity:s})}st.current()},Gt=t=>{it=0;const e=dt.current;if(!e)return;if(wt){wt=!1,K=Math.max(1,y.clientWidth),at=Math.max(1,y.clientHeight),b=Math.min(window.devicePixelRatio||1,2);const i=Math.round(K*b),g=Math.round(at*b);O.width!==i&&(O.width=i),O.height!==g&&(O.height=g)}const o=Math.min(.05,Math.max(.001,(t-yt)/1e3));yt=t;const{ink:s,accent:r}=Ee(e),a=Re(e,s),h=2*Math.sqrt(Ct)*(1-ft(e.bounce)*.96);e.intro!==X&&(X=e.intro,kt=0);const l=X!=="none"&&!gt&&M.length>0;l&&Ft&&(kt+=o);const c=l?ft((kt-Ie)/Math.max(.3,e.introDuration)):1;z=l&&c<1;const x=!z&&e.sweep&&!gt&&!k.inside&&L<0;x&&(At+=o*e.speed),V+=o;let u=k.x,d=k.y;x&&(u=a.left+(a.right-a.left)*(.5-.5*Math.cos(At*.45)),d=a.top+(a.bottom-a.top)*(.45+.1*Math.sin(At*.8)));const p=!z&&(k.inside||x||L>=0);if(p&&!Ot&&(I.x=u,I.y=d),p){const i=k.inside?.05:.22;I.x=D(I.x,u,o,i),I.y=D(I.y,d,o,i)}Ot=p,U=D(U,e.reveal==="area"&&p&&L<0?1:0,o,.16);for(let i=q.length-1;i>=0;i--){if(q[i].at>V)continue;const g=M[q[i].index];g&&(g.velocity.y-=q[i].velocity),q.splice(i,1)}let m=!1;M.forEach((i,g)=>{if(g===L){i.offset.x=D(i.offset.x,k.x-ut.x,o,.03),i.offset.y=D(i.offset.y,k.y-ut.y,o,.03),i.velocity.x=0,i.velocity.y=0,m=!0;return}const{offset:v,velocity:w}=i;if(Math.abs(v.x)<.05&&Math.abs(v.y)<.05&&Math.hypot(w.x,w.y)<.5){v.x=0,v.y=0,w.x=0,w.y=0;return}w.x+=(-Ct*v.x-h*w.x)*o,w.y+=(-Ct*v.y-h*w.y)*o,v.x+=w.x*o,v.y+=w.y*o,m=!0});let E=-1;if(z&&X==="type"){const i=.86/M.length,g=Math.min(M.length-1,Math.floor(c/i));E=c<.93?g:-1,M.forEach((v,w)=>{v.shown=w<g?1:w===g?nt(0,i*.3,c-w*i):0})}else M.forEach(i=>{i.shown=1});const A=z?E:L>=0?L:p?jt(I.x,I.y):-1;if(A>=0&&e.selection){const i=M[A],g=i.box.x1+i.offset.x-6,v=i.box.y1+i.offset.y-6,w=i.box.x2+i.offset.x+6,j=i.box.y2+i.offset.y+6;(f.index<0||f.alpha<.02)&&(f.x1=g,f.y1=v,f.x2=w,f.y2=j);const H=A===L?.02:.08;f.x1=D(f.x1,g,o,H),f.y1=D(f.y1,v,o,H),f.x2=D(f.x2,w,o,H),f.y2=D(f.y2,j,o,H),f.index=A}f.alpha=D(f.alpha,A>=0&&e.selection?1:0,o,.1),M.forEach((i,g)=>{const v=z?X==="type"&&(g===E||E>=0&&g>E)?1:0:e.reveal==="letter"&&g===A&&g!==L?1:0;z&&i.shown===0&&(i.outline=v),i.outline=D(i.outline,v,o,.09),Math.abs(i.outline-v)>.002?m=!0:i.outline=v}),Z=D(Z,e.guides&&!z&&(A>=0||U>.4)?1:0,o,.14);const B=!z&&A>=0&&k.inside,R=L>=0?"grabbing":B&&e.draggable?"grab":B&&e.clickKick?"pointer":"";R!==Dt&&(Dt=R,y.style.cursor=R),n.setTransform(1,0,0,1,0,0),n.globalCompositeOperation="source-over",n.globalAlpha=1,n.clearRect(0,0,O.width,O.height);for(const i of M){const g=Math.hypot(i.offset.x,i.offset.y);g>1&&(n.globalAlpha=Math.min(1,g/24)*.55,J(n,i.dashes,0,0,0,0),n.globalAlpha=1)}z&&X==="metrics"?Yt(e,a,r,1-nt(.84,1,c),i=>nt(.02+.04*i,.2+.04*i,c)):Z>.005&&Yt(e,a,r,Z*.6,()=>1),M.forEach((i,g)=>{if(z&&X==="assemble"&&(ze(i,a),c<i.assembled)){Oe(i,c,r);return}if(z&&X==="metrics"){const v=M.length>1?g/(M.length-1):0;if(c<.72+.28*v){De(i,v,c,a);return}}i.shown<.001||(i.outline<.999&&(n.globalAlpha=(1-i.outline)*i.shown,J(n,i.fill,i.offset.x,i.offset.y,0,0)),i.outline>.001&&(n.globalAlpha=i.outline*i.shown,J(n,i.dashes,i.offset.x,i.offset.y,0,0)),n.globalAlpha=1)}),U>.001&&Ce(e),Te(e,r);const S=m||z||q.length>0||Z>.005&&Z<.995||Math.abs(U-(e.reveal==="area"&&p&&L<0?1:0))>.002||f.alpha>.01&&f.alpha<.99;(p||S)&&Mt&&vt&&(it=requestAnimationFrame(Gt))},W=()=>{it||!Mt||!vt||(yt=performance.now(),it=requestAnimationFrame(Gt))};st.current=W;const ht=()=>{wt=!0,W()},Xt=t=>{const e=y.getBoundingClientRect();k.x=t.clientX-e.left,k.y=t.clientY-e.top},xt=t=>{Xt(t),k.inside=!0,W()},qt=()=>{L>=0||(k.inside=!1,W())},_t=t=>{Xt(t),k.inside=!0;const e=dt.current,o=t.pointerType!=="mouse"||t.button===0,s=z||!o?-1:jt(k.x,k.y);P.x=k.x,P.y=k.y,P.time=performance.now(),P.index=s,e?.draggable&&s>=0&&(L=s,ut.x=k.x-M[s].offset.x,ut.y=k.y-M[s].offset.y,y.setPointerCapture?.(t.pointerId)),W()},mt=t=>{if(L>=0){L=-1,y.releasePointerCapture?.(t.pointerId);const e=y.getBoundingClientRect();k.inside=t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom}if(t.type==="pointerup"&&P.index>=0&&dt.current?.clickKick&&!gt&&performance.now()-P.time<450){const e=y.getBoundingClientRect();Math.hypot(t.clientX-e.left-P.x,t.clientY-e.top-P.y)<6&&Fe(P.index)}P.index=-1,W()};y.addEventListener("pointermove",xt,{passive:!0}),y.addEventListener("pointerenter",xt,{passive:!0}),y.addEventListener("pointerdown",_t,{passive:!0}),y.addEventListener("pointerup",mt,{passive:!0}),y.addEventListener("pointercancel",mt,{passive:!0}),y.addEventListener("pointerleave",qt,{passive:!0}),O.addEventListener("contextrestored",tt);const Qt=new ResizeObserver(ht);Qt.observe(y),window.addEventListener("resize",ht,{passive:!0});const Ut=new IntersectionObserver(([t])=>{Mt=t.isIntersecting,W()});Ut.observe(y);const Jt=new MutationObserver(W);for(const t of[document.documentElement,document.body])t&&Jt.observe(t,{attributes:!0,attributeFilter:["class","style","data-theme"]});const Vt=window.matchMedia?.("(prefers-color-scheme: dark)");return Vt?.addEventListener?.("change",W),document.fonts&&document.fonts.ready.then($t,$t),ht(),()=>{vt=!1,cancelAnimationFrame(it),st.current=()=>{},Qt.disconnect(),window.removeEventListener("resize",ht),Ut.disconnect(),Jt.disconnect(),Vt?.removeEventListener?.("change",W),y.style.cursor="",y.removeEventListener("pointermove",xt),y.removeEventListener("pointerenter",xt),y.removeEventListener("pointerdown",_t),y.removeEventListener("pointerup",mt),y.removeEventListener("pointercancel",mt),y.removeEventListener("pointerleave",qt),O.removeEventListener("contextrestored",tt)}},[]),Zt.jsx("div",{ref:St,className:`relative w-full h-full touch-pan-y select-none ${ke}`.trim(),style:Le,role:"img","aria-label":C,children:Zt.jsx("canvas",{ref:Tt,className:"block w-full h-full"})})};export{He as default};
1
+ import{r as ot,m as $e,j as Zt}from"./index-CH-7pBbW.js";const te="10px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",ee=8,Ct=320,Pe=/^(currentcolor|inherit)$/i,Ie=.15,We=.62,D=(C,T,_,Q)=>C+(T-C)*(1-Math.exp(-_/Q)),ft=C=>Math.min(1,Math.max(0,Number(C)||0)),nt=(C,T,_)=>{const Q=ft((_-C)/(T-C));return Q*Q*(3-2*Q)},N=(...C)=>{let T=2166136261;for(const _ of C)T=Math.imul(T^(_|0),16777619),T^=T>>>13,T=Math.imul(T,1540483477),T^=T>>>15;return(T>>>0)/4294967296},oe=C=>C>0?`+${C}`:C<0?`−${-C}`:"0",He=({text:C="React Bits",fontFamily:T="",fontWeight:_=600,fontSize:Q=150,letterSpacing:ne=-.05,color:se="currentColor",accentColor:ae="currentColor",align:ie="center",reach:re=200,softness:ce=.7,dashLength:le=4,dashGap:fe=2,strokeWidth:de=1.5,lineStyle:ue="dashed",reveal:he="letter",specks:xe=15,selection:me=!0,labels:pe=!0,draggable:be=!0,bounce:ge=.4,sweep:ye=!0,speed:Me=1,clickKick:ve=!0,intro:Be="none",introDuration:we=2,guides:Ae=!1,className:ke="",style:Le})=>{const St=ot.useRef(null),Tt=ot.useRef(null),dt=ot.useRef(null),st=ot.useRef(()=>{});return ot.useEffect(()=>{dt.current={text:C,fontFamily:T,fontWeight:_,fontSize:Q,letterSpacing:ne,color:se,accentColor:ae,align:ie,reach:re,softness:ce,dashLength:le,dashGap:fe,strokeWidth:de,lineStyle:ue,reveal:he,specks:xe,selection:me,labels:pe,draggable:be,bounce:ge,sweep:ye,speed:Me,clickKick:ve,intro:Be,introDuration:we,guides:Ae},st.current()}),ot.useEffect(()=>{const y=St.current,O=Tt.current,n=O?.getContext("2d"),Y=document.createElement("canvas"),F=Y.getContext("2d");if(!y||!O||!n||!F)return;const gt=$e()?.matches;let K=1,at=1,b=1,it=0,yt=performance.now(),Mt=!1,vt=!0,Bt="",wt=!0,zt="",G=null,M=[],U=0,At=0,V=0,Ot=!1,L=-1,Dt="",kt=0,X="",z=!1,Ft=!document.fonts,Z=0;const q=[],P={x:0,y:0,time:0,index:-1},k={x:0,y:0,inside:!1},ut={x:0,y:0},I={x:0,y:0},f={x1:0,y1:0,x2:0,y2:0,alpha:0,index:-1},tt=()=>{Bt="",st.current()},$t=()=>{Ft=!0,tt()},Pt=t=>t.fontFamily||getComputedStyle(y).fontFamily||"sans-serif",It=(t,e)=>`${t.fontWeight} ${e}px ${Pt(t)}`,Ee=t=>{const e=getComputedStyle(y).color||"#000000",o=s=>!s||Pe.test(String(s).trim())?e:s;return{ink:o(t.color),accent:o(t.accentColor)}},Lt=(t,e,o)=>{t.font=It(e,o),"letterSpacing"in t&&(t.letterSpacing=`${e.letterSpacing*o}px`),t.textAlign="left",t.textBaseline="alphabetic"},Wt=(t,e,o,s,r)=>{const a=Math.ceil(t.strokeWidth*2+4),h=o.box.x1-a,l=o.box.y1-a,c=o.box.x2-o.box.x1+a*2,x=o.box.y2-o.box.y1+a*2,u=document.createElement("canvas");u.addEventListener("contextrestored",tt),u.width=Math.max(1,Math.ceil(c*b)),u.height=Math.max(1,Math.ceil(x*b));const d=u.getContext("2d");return d?(d.setTransform(b,0,0,b,-h*b,-l*b),Lt(d,t,e.size),s?(d.lineJoin="round",d.lineWidth=t.strokeWidth*2,d.lineCap="butt",d.strokeStyle=r,t.lineStyle!=="solid"&&d.setLineDash([Math.max(1,t.dashLength),Math.max(1,t.dashGap)]),d.strokeText(o.char,o.x,e.baseline),d.setLineDash([]),d.globalCompositeOperation="destination-out",d.fillStyle="#000000",d.fillText(o.char,o.x,e.baseline),d.globalCompositeOperation="source-over"):(d.fillStyle=r,d.fillText(o.char,o.x,e.baseline)),{image:u,left:h,top:l}):{image:u,left:h,top:l}},Re=(t,e)=>{const o=[t.text,Pt(t),t.fontWeight,t.fontSize,t.letterSpacing,t.align,e,t.dashLength,t.dashGap,t.strokeWidth,t.lineStyle,K,at,b].join("|");if(o===Bt&&G)return G;Bt=o;const s=It(t,64);document.fonts&&s!==zt&&(zt=s,document.fonts.load(s,t.text).then(tt,tt));const r=F;Lt(r,t,t.fontSize);let a=r.measureText(t.text);const h=Math.min(1,K*.9/Math.max(a.actualBoundingBoxLeft+a.actualBoundingBoxRight,1),at*.66/Math.max(a.actualBoundingBoxAscent+a.actualBoundingBoxDescent,1)),l=t.fontSize*h;Lt(r,t,l),a=r.measureText(t.text);const c=a.actualBoundingBoxLeft+a.actualBoundingBoxRight,x=a.actualBoundingBoxAscent+a.actualBoundingBoxDescent,u=K*.05,p=(t.align==="left"?u:t.align==="right"?K-u-c:(K-c)/2)+a.actualBoundingBoxLeft,m=(at-x)/2+a.actualBoundingBoxAscent,E=m-r.measureText("x").actualBoundingBoxAscent,A=m-r.measureText("H").actualBoundingBoxAscent,B=m-r.measureText("d").actualBoundingBoxAscent,R=m+r.measureText("p").actualBoundingBoxDescent,S=m-a.actualBoundingBoxAscent,i=m+a.actualBoundingBoxDescent,g=Math.min(S,A)-2,v=Math.max(i,m)+2,w={size:l,baseline:m,left:p-a.actualBoundingBoxLeft,right:p+a.actualBoundingBoxRight,top:S,bottom:i,lines:[{y:m,label:"baseline"},{y:E,label:"x-height"},{y:A,label:"cap height"},...A-B>Math.max(11,l*.06)?[{y:B,label:"ascender"}]:[],{y:R,label:"descender"}],bands:[{y0:E,y1:m,up:!0,order:0},{y0:A,y1:E,up:!0,order:1},{y0:g,y1:A,up:!0,order:2},{y0:m,y1:v,up:!1,order:1}].filter($=>$.y1-$.y0>.5)};G=w;const j=Array.from(t.text),H=M;M=[];let pt="";return j.forEach(($,ct)=>{pt+=$;const lt=r.measureText($),Et=p+r.measureText(pt).width-lt.width;if(!$.trim())return;const Rt={char:$,x:Et,box:{x1:Et-lt.actualBoundingBoxLeft,y1:m-lt.actualBoundingBoxAscent,x2:Et+lt.actualBoundingBoxRight,y2:m+lt.actualBoundingBoxDescent}},et=H[M.length],bt=et?.char===$&&et.index===ct;M.push({...Rt,offset:bt?et.offset:{x:0,y:0},velocity:bt?et.velocity:{x:0,y:0},outline:bt?et.outline:0,shown:bt?et.shown:1,cells:null,assembled:0,index:ct,fill:Wt(t,w,Rt,!1,e),dashes:Wt(t,w,Rt,!0,e)})}),L>=0&&M[L]?.index!==H[L]?.index&&(L=-1),f.index>=0&&M[f.index]?.char!==H[f.index]?.char&&(f.index=-1),w},jt=(t,e)=>{if(!G||e<G.top-24||e>G.bottom+24)return-1;let o=-1,s=1/0;return M.forEach((r,a)=>{const h=r.box.x1+r.offset.x,l=r.box.x2+r.offset.x,c=t<h?h-t:t>l?t-l:0;c<s&&(s=c,o=a)}),s<28?o:-1},Ht=(t,e,o,s,r,a)=>{const h=Math.min(1,Math.max(0,1-a)),l=t.createRadialGradient(e,o,0,e,o,s);if(l.addColorStop(0,`rgba(0, 0, 0, ${r})`),h>.995)return l.addColorStop(.995,`rgba(0, 0, 0, ${r})`),l.addColorStop(1,"rgba(0, 0, 0, 0)"),l;for(let c=0;c<=ee;c++){const x=c/ee,u=x*x*(3-2*x);l.addColorStop(h+(1-h)*x,`rgba(0, 0, 0, ${r*(1-u)})`)}return l},J=(t,e,o,s,r,a)=>{t.drawImage(e.image,Math.round((e.left+o)*b-r),Math.round((e.top+s)*b-a))},Ce=t=>{const e=t.reach*b,o=I.x*b,s=I.y*b;n.globalCompositeOperation="destination-out",n.fillStyle=Ht(n,o,s,e,U,t.softness),n.fillRect(o-e,s-e,e*2,e*2),n.globalCompositeOperation="source-over";const r=Math.max(0,Math.floor(o-e)),a=Math.max(0,Math.floor(s-e)),h=Math.min(O.width,Math.ceil(o+e)),l=Math.min(O.height,Math.ceil(s+e));if(h<=r||l<=a)return;const c=h-r,x=l-a;(Y.width<c||Y.height<x)&&(Y.width=Math.max(Y.width,c),Y.height=Math.max(Y.height,x)),F.setTransform(1,0,0,1,0,0),F.globalCompositeOperation="source-over",F.clearRect(0,0,c,x);for(const u of M)J(F,u.dashes,u.offset.x,u.offset.y,r,a);F.globalCompositeOperation="destination-in",F.fillStyle=Ht(F,o-r,s-a,e,1,t.softness),F.fillRect(0,0,c,x),F.globalCompositeOperation="source-over",n.globalAlpha=U,n.drawImage(Y,0,0,c,x,r,a,c,x),n.globalAlpha=1},rt=t=>(Math.round(t*b)+.5)/b,Nt=(t,e,o)=>{let s=(t%(2*(e+o))+2*(e+o))%(2*(e+o));return s<e?[f.x1+s,f.y1,0,-1]:(s-=e,s<o?[f.x2,f.y1+s,1,0]:(s-=o,s<e?[f.x2-s,f.y2,0,1]:(s-=e,[f.x1,f.y2-s,-1,0])))},Se=(t,e,o)=>{const s=f.x2-f.x1,r=f.y2-f.y1;if(s<2||r<2)return;const a=2*(s+r),h=f.index+1,l=3;n.fillStyle=o,n.strokeStyle=o;for(let c=0;c<t.specks;c++){const x=.5+N(h,c,11)*1.2,u=V/x+N(h,c,17),d=Math.floor(u),p=u-d;if(p>.7)continue;const[m,E,A,B]=Nt(N(h,c,d)*a,s,r),R=N(h,c,d,2),S=R<.46?2:R<.7?3:R<.84?5:R<.94?8:11,i=S>=8,g=(i?9:4)+Math.floor(N(h,c,d,1)*5)*l,v=f.x1+Math.round((m+A*g-f.x1)/l)*l,w=f.y1+Math.round((E+B*g-f.y1)/l)*l,j=N(h,c,d,3),H=p<.06||p>.32&&p<.36?.35:1,pt=e*(i?.3+.4*j:.3+.6*j)*H,$=Math.round(v-S/2),ct=Math.round(w-S/2);n.globalAlpha=pt,j<.26||i&&j<.78?(n.strokeRect($+.5,ct+.5,S,S),i&&j>.5&&n.fillRect(Math.round(v)-1,Math.round(w)-1,2,2)):n.fillRect($,ct,S,S)}for(let c=0;c<2;c++){const x=(V*.42*t.speed+c*.5)*a;for(let u=0;u<4;u++){const[d,p]=Nt(x-u*6,s,r),m=u===0?3:2;n.globalAlpha=e*[.95,.55,.32,.16][u],n.fillRect(Math.round(d-m/2),Math.round(p-m/2),m,m)}}n.globalAlpha=1},Te=(t,e)=>{const o=M[f.index];if(!o||f.alpha<.01)return;const s=f.alpha,r=rt(f.x1),a=rt(f.y1),h=rt(f.x2),l=rt(f.y2);n.setTransform(b,0,0,b,0,0),n.fillStyle=e,n.strokeStyle=e,n.lineWidth=1;const c=Math.hypot(o.offset.x,o.offset.y);if(c>1){const u=(o.box.x1+o.box.x2)/2,d=(o.box.y1+o.box.y2)/2;n.beginPath(),n.moveTo(u,d),n.lineTo(u+o.offset.x,d+o.offset.y),n.setLineDash([3,4]),n.globalAlpha=.45*s,n.stroke(),n.setLineDash([]),n.beginPath(),n.rect(Math.round(u)-2,Math.round(d)-2,4,4),n.globalAlpha=.7*s,n.fill()}n.beginPath(),n.rect(r,a,h-r,l-a),n.globalAlpha=.5*s,n.stroke(),n.beginPath();for(const[u,d]of[[r,a],[h,a],[h,l],[r,l]])n.rect(Math.round(u)-2,Math.round(d)-2,5,5);if(n.globalAlpha=.95*s,n.fill(),n.globalAlpha=1,t.specks>0&&Se(t,s,e),!t.labels)return;n.font=te,n.textAlign="left",n.textBaseline="bottom",n.fillStyle=e,n.globalAlpha=.62*s;const x=c>1?`${oe(Math.round(o.offset.x))}, ${oe(Math.round(-o.offset.y))}`:`${o.char} ${Math.round(o.box.x2-o.box.x1)} × ${Math.round(o.box.y2-o.box.y1)}`;n.fillText(x,Math.round(f.x1),Math.round(f.y1)-7),n.globalAlpha=1},Yt=(t,e,o,s,r)=>{const a=Math.max(12,e.size*.12),h=Math.round(e.left-a),l=Math.round(e.right+a),c=K-l>h;n.setTransform(b,0,0,b,0,0),n.strokeStyle=o,n.fillStyle=o,n.lineWidth=1,n.font=te,n.textBaseline="middle",n.textAlign=c?"left":"right",e.lines.forEach((x,u)=>{const d=r(u);if(d<=.001)return;const p=rt(x.y),m=h+(l-h)*d;n.globalAlpha=s*.4,n.beginPath(),n.moveTo(h,p),n.lineTo(m,p),n.stroke(),n.globalAlpha=s*.9,n.fillRect(h-1,Math.round(x.y)-1,3,3),n.fillRect(Math.round(m)-1,Math.round(x.y)-1,3,3),t.labels&&(n.globalAlpha=s*.62*nt(.7,1,d),n.fillText(x.label,c?l+8:h-8,Math.round(x.y)))}),n.textAlign="left",n.setTransform(1,0,0,1,0,0),n.globalAlpha=1},ze=(t,e)=>{if(t.cells)return t.cells;const o=t.fill,s=Math.max(3,Math.round(e.size/26)),r=o.image.width,a=o.image.height,h=o.image.getContext("2d"),l=[];if(t.cells=l,t.assembled=0,!h||r<2||a<2)return l;const c=h.getImageData(0,0,r,a).data,x=Math.floor(o.left/s)*s,u=Math.floor(o.top/s)*s,d=Math.ceil((o.left+r/b-x)/s)+1,p=Math.ceil((o.top+a/b-u)/s)+1,m=new Uint8Array(d*p);for(let B=0;B<a;B++)for(let R=0;R<r;R++){if(c[(B*r+R)*4+3]<24)continue;const S=Math.floor((o.left+R/b-x)/s),i=Math.floor((o.top+B/b-u)/s);m[i*d+S]=1}const E=(t.box.x1+t.box.x2)/2,A=ft((E-e.left)/Math.max(1,e.right-e.left));for(let B=0;B<m.length;B++){if(!m[B])continue;const R=N(t.index,B,1)*Math.PI*2,S=e.size*(.25+.6*N(t.index,B,2)),i=.03+.36*A+.12*N(t.index,B,3),g=i+.3+.14*N(t.index,B,4);l.push({x:x+B%d*s,y:u+Math.floor(B/d)*s,size:s,dx:Math.cos(R)*S,dy:Math.sin(R)*S*.7,start:i,land:g}),t.assembled=Math.max(t.assembled,g)}return l},Kt=(t,e,o)=>{const s=Math.round(t*b),r=Math.round(e*b);return[s,r,Math.round((t+o)*b)-s,Math.round((e+o)*b)-r]},Oe=(t,e,o)=>{const s=t.cells||[];n.save(),n.beginPath();let r=0;for(const a of s){if(e<a.land)continue;const[h,l,c,x]=Kt(a.x,a.y,a.size);n.rect(h,l,c,x),r++}r&&(n.clip(),J(n,t.fill,0,0,0,0)),n.restore(),n.fillStyle=o;for(const a of s){if(e<a.start||e>=a.land)continue;const h=(e-a.start)/(a.land-a.start),l=1-Math.pow(1-h,4),c=a.size*(.4+.6*l),x=a.x+(a.size-c)/2+a.dx*(1-l),u=a.y+(a.size-c)/2+a.dy*(1-l),[d,p,m,E]=Kt(x,u,c);n.globalAlpha=Math.min(1,h*4)*(.55+.45*l),n.fillRect(d,p,Math.max(1,m),Math.max(1,E))}n.globalAlpha=1},De=(t,e,o,s)=>{const r=t.fill,a=Math.floor(r.left*b),h=Math.floor(r.top*b),l=r.image.width+2,c=r.image.height+2,x=ft((o-.24-.28*e)/.48),u=[];for(const p of s.bands){const m=nt(.3*p.order,.3*p.order+.4,x);if(m<=0)continue;const E=(p.y1-p.y0)*m,A=Math.round((p.up?p.y1-E:p.y0)*b),B=Math.round((p.up?p.y1:p.y0+E)*b);B>A&&u.push([A,B-A])}const d=nt(.08+.2*e,.22+.2*e,o);if(d>.001){n.save(),n.beginPath(),n.rect(a-2,h-2,l+2,c+2);for(const[p,m]of u)n.rect(a-2,p,l+2,m);n.clip("evenodd"),n.globalAlpha=d,J(n,t.dashes,0,0,0,0),n.restore()}if(u.length){n.save(),n.beginPath();for(const[p,m]of u)n.rect(a-2,p,l+2,m);n.clip(),J(n,t.fill,0,0,0,0),n.restore()}n.globalAlpha=1},Fe=t=>{const e=(G?G.size:120)*11;q.push({index:t,at:V,velocity:e});for(let o=1;o<M.length;o++){const s=e*Math.pow(We,o);if(s<30)break;for(const r of[t-o,t+o])r>=0&&r<M.length&&q.push({index:r,at:V+o*.055,velocity:s})}st.current()},Gt=t=>{it=0;const e=dt.current;if(!e)return;if(wt){wt=!1,K=Math.max(1,y.clientWidth),at=Math.max(1,y.clientHeight),b=Math.min(window.devicePixelRatio||1,2);const i=Math.round(K*b),g=Math.round(at*b);O.width!==i&&(O.width=i),O.height!==g&&(O.height=g)}const o=Math.min(.05,Math.max(.001,(t-yt)/1e3));yt=t;const{ink:s,accent:r}=Ee(e),a=Re(e,s),h=2*Math.sqrt(Ct)*(1-ft(e.bounce)*.96);e.intro!==X&&(X=e.intro,kt=0);const l=X!=="none"&&!gt&&M.length>0;l&&Ft&&(kt+=o);const c=l?ft((kt-Ie)/Math.max(.3,e.introDuration)):1;z=l&&c<1;const x=!z&&e.sweep&&!gt&&!k.inside&&L<0;x&&(At+=o*e.speed),V+=o;let u=k.x,d=k.y;x&&(u=a.left+(a.right-a.left)*(.5-.5*Math.cos(At*.45)),d=a.top+(a.bottom-a.top)*(.45+.1*Math.sin(At*.8)));const p=!z&&(k.inside||x||L>=0);if(p&&!Ot&&(I.x=u,I.y=d),p){const i=k.inside?.05:.22;I.x=D(I.x,u,o,i),I.y=D(I.y,d,o,i)}Ot=p,U=D(U,e.reveal==="area"&&p&&L<0?1:0,o,.16);for(let i=q.length-1;i>=0;i--){if(q[i].at>V)continue;const g=M[q[i].index];g&&(g.velocity.y-=q[i].velocity),q.splice(i,1)}let m=!1;M.forEach((i,g)=>{if(g===L){i.offset.x=D(i.offset.x,k.x-ut.x,o,.03),i.offset.y=D(i.offset.y,k.y-ut.y,o,.03),i.velocity.x=0,i.velocity.y=0,m=!0;return}const{offset:v,velocity:w}=i;if(Math.abs(v.x)<.05&&Math.abs(v.y)<.05&&Math.hypot(w.x,w.y)<.5){v.x=0,v.y=0,w.x=0,w.y=0;return}w.x+=(-Ct*v.x-h*w.x)*o,w.y+=(-Ct*v.y-h*w.y)*o,v.x+=w.x*o,v.y+=w.y*o,m=!0});let E=-1;if(z&&X==="type"){const i=.86/M.length,g=Math.min(M.length-1,Math.floor(c/i));E=c<.93?g:-1,M.forEach((v,w)=>{v.shown=w<g?1:w===g?nt(0,i*.3,c-w*i):0})}else M.forEach(i=>{i.shown=1});const A=z?E:L>=0?L:p?jt(I.x,I.y):-1;if(A>=0&&e.selection){const i=M[A],g=i.box.x1+i.offset.x-6,v=i.box.y1+i.offset.y-6,w=i.box.x2+i.offset.x+6,j=i.box.y2+i.offset.y+6;(f.index<0||f.alpha<.02)&&(f.x1=g,f.y1=v,f.x2=w,f.y2=j);const H=A===L?.02:.08;f.x1=D(f.x1,g,o,H),f.y1=D(f.y1,v,o,H),f.x2=D(f.x2,w,o,H),f.y2=D(f.y2,j,o,H),f.index=A}f.alpha=D(f.alpha,A>=0&&e.selection?1:0,o,.1),M.forEach((i,g)=>{const v=z?X==="type"&&(g===E||E>=0&&g>E)?1:0:e.reveal==="letter"&&g===A&&g!==L?1:0;z&&i.shown===0&&(i.outline=v),i.outline=D(i.outline,v,o,.09),Math.abs(i.outline-v)>.002?m=!0:i.outline=v}),Z=D(Z,e.guides&&!z&&(A>=0||U>.4)?1:0,o,.14);const B=!z&&A>=0&&k.inside,R=L>=0?"grabbing":B&&e.draggable?"grab":B&&e.clickKick?"pointer":"";R!==Dt&&(Dt=R,y.style.cursor=R),n.setTransform(1,0,0,1,0,0),n.globalCompositeOperation="source-over",n.globalAlpha=1,n.clearRect(0,0,O.width,O.height);for(const i of M){const g=Math.hypot(i.offset.x,i.offset.y);g>1&&(n.globalAlpha=Math.min(1,g/24)*.55,J(n,i.dashes,0,0,0,0),n.globalAlpha=1)}z&&X==="metrics"?Yt(e,a,r,1-nt(.84,1,c),i=>nt(.02+.04*i,.2+.04*i,c)):Z>.005&&Yt(e,a,r,Z*.6,()=>1),M.forEach((i,g)=>{if(z&&X==="assemble"&&(ze(i,a),c<i.assembled)){Oe(i,c,r);return}if(z&&X==="metrics"){const v=M.length>1?g/(M.length-1):0;if(c<.72+.28*v){De(i,v,c,a);return}}i.shown<.001||(i.outline<.999&&(n.globalAlpha=(1-i.outline)*i.shown,J(n,i.fill,i.offset.x,i.offset.y,0,0)),i.outline>.001&&(n.globalAlpha=i.outline*i.shown,J(n,i.dashes,i.offset.x,i.offset.y,0,0)),n.globalAlpha=1)}),U>.001&&Ce(e),Te(e,r);const S=m||z||q.length>0||Z>.005&&Z<.995||Math.abs(U-(e.reveal==="area"&&p&&L<0?1:0))>.002||f.alpha>.01&&f.alpha<.99;(p||S)&&Mt&&vt&&(it=requestAnimationFrame(Gt))},W=()=>{it||!Mt||!vt||(yt=performance.now(),it=requestAnimationFrame(Gt))};st.current=W;const ht=()=>{wt=!0,W()},Xt=t=>{const e=y.getBoundingClientRect();k.x=t.clientX-e.left,k.y=t.clientY-e.top},xt=t=>{Xt(t),k.inside=!0,W()},qt=()=>{L>=0||(k.inside=!1,W())},_t=t=>{Xt(t),k.inside=!0;const e=dt.current,o=t.pointerType!=="mouse"||t.button===0,s=z||!o?-1:jt(k.x,k.y);P.x=k.x,P.y=k.y,P.time=performance.now(),P.index=s,e?.draggable&&s>=0&&(L=s,ut.x=k.x-M[s].offset.x,ut.y=k.y-M[s].offset.y,y.setPointerCapture?.(t.pointerId)),W()},mt=t=>{if(L>=0){L=-1,y.releasePointerCapture?.(t.pointerId);const e=y.getBoundingClientRect();k.inside=t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom}if(t.type==="pointerup"&&P.index>=0&&dt.current?.clickKick&&!gt&&performance.now()-P.time<450){const e=y.getBoundingClientRect();Math.hypot(t.clientX-e.left-P.x,t.clientY-e.top-P.y)<6&&Fe(P.index)}P.index=-1,W()};y.addEventListener("pointermove",xt,{passive:!0}),y.addEventListener("pointerenter",xt,{passive:!0}),y.addEventListener("pointerdown",_t,{passive:!0}),y.addEventListener("pointerup",mt,{passive:!0}),y.addEventListener("pointercancel",mt,{passive:!0}),y.addEventListener("pointerleave",qt,{passive:!0}),O.addEventListener("contextrestored",tt);const Qt=new ResizeObserver(ht);Qt.observe(y),window.addEventListener("resize",ht,{passive:!0});const Ut=new IntersectionObserver(([t])=>{Mt=t.isIntersecting,W()});Ut.observe(y);const Jt=new MutationObserver(W);for(const t of[document.documentElement,document.body])t&&Jt.observe(t,{attributes:!0,attributeFilter:["class","style","data-theme"]});const Vt=window.matchMedia?.("(prefers-color-scheme: dark)");return Vt?.addEventListener?.("change",W),document.fonts&&document.fonts.ready.then($t,$t),ht(),()=>{vt=!1,cancelAnimationFrame(it),st.current=()=>{},Qt.disconnect(),window.removeEventListener("resize",ht),Ut.disconnect(),Jt.disconnect(),Vt?.removeEventListener?.("change",W),y.style.cursor="",y.removeEventListener("pointermove",xt),y.removeEventListener("pointerenter",xt),y.removeEventListener("pointerdown",_t),y.removeEventListener("pointerup",mt),y.removeEventListener("pointercancel",mt),y.removeEventListener("pointerleave",qt),O.removeEventListener("contextrestored",tt)}},[]),Zt.jsx("div",{ref:St,className:`relative w-full h-full touch-pan-y select-none ${ke}`.trim(),style:Le,role:"img","aria-label":C,children:Zt.jsx("canvas",{ref:Tt,className:"block w-full h-full"})})};export{He as default};