2 lines
118 KiB
JavaScript
Raw Normal View History

import{r as P}from"./index-JhL3uwfD.js";import{j as Te}from"./jsx-runtime-D_zvdyIk.js";const Os=P.createContext({});function br(t){const e=P.useRef(null);return e.current===null&&(e.current=t()),e.current}const Ar=typeof window<"u",Vr=Ar?P.useLayoutEffect:P.useEffect,$e=P.createContext(null);function Ge(t,e){t.indexOf(e)===-1&&t.push(e)}function Gt(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const X=(t,e,n)=>n>e?e:n<t?t:n;let He=()=>{};const Y={},js=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function Ns(t){return typeof t=="object"&&t!==null}const Us=t=>/^0[^.\s]+$/u.test(t);function Ws(t){let e;return()=>(e===void 0&&(e=t()),e)}const W=t=>t,Cr=(t,e)=>n=>e(t(n)),Rt=(...t)=>t.reduce(Cr),Vt=(t,e,n)=>{const s=e-t;return s===0?1:(n-t)/s};class ze{constructor(){this.subscriptions=[]}add(e){return Ge(this.subscriptions,e),()=>Gt(this.subscriptions,e)}notify(e,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,n,s);else for(let o=0;o<i;o++){const r=this.subscriptions[o];r&&r(e,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const G=t=>t*1e3,U=t=>t/1e3;function Ks(t,e){return e?t*(1e3/e):0}const $s=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Mr=1e-7,Dr=12;function Er(t,e,n,s,i){let o,r,a=0;do r=e+(n-e)/2,o=$s(r,s,i)-t,o>0?n=r:e=r;while(Math.abs(o)>Mr&&++a<Dr);return r}function Lt(t,e,n,s){if(t===e&&n===s)return W;const i=o=>Er(o,0,1,t,n);return o=>o===0||o===1?o:$s(i(o),e,s)}const Gs=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Hs=t=>e=>1-t(1-e),zs=Lt(.33,1.53,.69,.99),_e=Hs(zs),_s=Gs(_e),Xs=t=>(t*=2)<1?.5*_e(t):.5*(2-Math.pow(2,-10*(t-1))),Xe=t=>1-Math.sin(Math.acos(t)),Ys=Hs(Xe),qs=Gs(Xe),Rr=Lt(.42,0,1,1),Lr=Lt(0,0,.58,1),Zs=Lt(.42,0,.58,1),kr=t=>Array.isArray(t)&&typeof t[0]!="number",Js=t=>Array.isArray(t)&&typeof t[0]=="number",Fr={linear:W,easeIn:Rr,easeInOut:Zs,easeOut:Lr,circIn:Xe,circInOut:qs,circOut:Ys,backIn:_e,backInOut:_s,backOut:zs,anticipate:Xs},Br=t=>typeof t=="string",Sn=t=>{if(Js(t)){He(t.length===4);const[e,n,s,i]=t;return Lt(e,n,s,i)}else if(Br(t))return Fr[t];return t},Bt=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Ir(t,e){let n=new Set,s=new Set,i=!1,o=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(c){r.has(c)&&(u.schedule(c),t()),c(a)}const u={schedule:(c,h=!1,f=!1)=>{const m=f&&i?n:s;return h&&r.add(c),m.has(c)||m.add(c),c},cancel:c=>{s.delete(c),r.delete(c)},process:c=>{if(a=c,i){o=!0;return}i=!0,[n,s]=[s,n],n.forEach(l),n.clear(),i=!1,o&&(o=!1,u.process(c))}};return u}const Or=40;function Qs(t,e){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,r=Bt.reduce((g,S)=>(g[S]=Ir(o),g),{}),{setup:a,read:l,resolveKeyframes:u,preUpdate:c,update:h,preRender:f,render:d,postRender:m}=r,p=()=>{const g=Y.useManualTiming?i.timestamp:performance.now();n=!1,Y.useManualTiming||(i.delta=s?1e3/60:Math.max(Math.min(g-i.timestamp,Or),1)),i.timestamp=g,i.isProcessing=!0,a.process(i),l.process(i),u.process(i),c.process(i),h.process(i),f.process(i),d.process(i),m.process(i),i.isProcessing=!1,n&&e&&(s=!1,t(p))},y=()=>{n=!0,s=!0,i.isProcessing||t(p)};return{schedule:Bt.reduce((g,S)=>{const w=r[S];return g[S]=(A,D=!1,b=!1)=>(n||y(),w.schedule(A,D,b)),g},{}),cancel:g=>{for(let S=0;S<Bt.length;S++)r[Bt[S]].cancel(g)},state:i,steps:r}}const{schedule:V,cancel:Q,state:k,steps:ne}=Qs(typeof requestAnimationFrame<"u"?requestAnimationFrame:W,!0);let jt;function jr(){jt=void 0}const I={now:()=>(jt===void 0&&I.set(k.isProcessing||Y.useManualTiming?k.timestamp:performance.now()),jt),set:t=>{jt=t,queueMicrotask(jr)}},ti=t=>e=>typeof e=="string"&&e.startsWith(t),ei=ti("--"),Nr=ti("var(--"),Ye=t=>Nr(t)?Ur.test(t.split("/*")[0].trim()):!1,Ur=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Pn(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const gt={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Ct={...gt,transform:t=>X(0,1,t)},It={...gt,default:1},St=t=>Math.round(t*1e5)/1e5,qe=/-?(?:\d+(?:\.\d+)?|\.\d