@cliftonc/finius 0.1.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 (86) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +147 -0
  3. package/dist/branding.js +28 -0
  4. package/dist/cli/backfill.js +122 -0
  5. package/dist/cli/claude-settings.js +54 -0
  6. package/dist/cli/codex-config.js +60 -0
  7. package/dist/cli/codex.js +97 -0
  8. package/dist/cli/config.js +41 -0
  9. package/dist/cli/doctor.js +159 -0
  10. package/dist/cli/hook.js +70 -0
  11. package/dist/cli/identity.js +163 -0
  12. package/dist/cli/import.js +61 -0
  13. package/dist/cli/index.js +70 -0
  14. package/dist/cli/install.js +23 -0
  15. package/dist/cli/password.js +14 -0
  16. package/dist/cli/serve.js +63 -0
  17. package/dist/cli/setup.js +314 -0
  18. package/dist/cli/ui.js +15 -0
  19. package/dist/client/assets/TranscriptView-CBf7-4Bo.css +1 -0
  20. package/dist/client/assets/TranscriptView-CLCPX5bI.js +194 -0
  21. package/dist/client/assets/TranscriptView-D056GDHO.js +194 -0
  22. package/dist/client/assets/TranscriptView-MIgsAwMN.js +194 -0
  23. package/dist/client/assets/index-6OIY_8fO.css +1 -0
  24. package/dist/client/assets/index-9aN8py7_.js +1 -0
  25. package/dist/client/assets/index-B-sjMmTS.js +1636 -0
  26. package/dist/client/assets/index-B4HbP3X6.js +1 -0
  27. package/dist/client/assets/index-B9wgN1BV.js +1636 -0
  28. package/dist/client/assets/index-BHlFz1Th.js +1652 -0
  29. package/dist/client/assets/index-BJyvYca7.js +1636 -0
  30. package/dist/client/assets/index-BKBTeJLz.js +1 -0
  31. package/dist/client/assets/index-BN6CbirS.js +1444 -0
  32. package/dist/client/assets/index-BW4_7xR6.js +1460 -0
  33. package/dist/client/assets/index-BaLElA30.js +1 -0
  34. package/dist/client/assets/index-BaQ02V5d.css +1 -0
  35. package/dist/client/assets/index-Bh0dgUU-.js +1636 -0
  36. package/dist/client/assets/index-Bie86XRc.js +1 -0
  37. package/dist/client/assets/index-Bijt5al-.css +1 -0
  38. package/dist/client/assets/index-BikJP2HS.js +1636 -0
  39. package/dist/client/assets/index-BkwrvP-J.js +1 -0
  40. package/dist/client/assets/index-BwVuUJSv.js +1 -0
  41. package/dist/client/assets/index-BweXI4-D.css +1 -0
  42. package/dist/client/assets/index-BwqdHcDE.js +1 -0
  43. package/dist/client/assets/index-C-Z0w-tQ.js +1652 -0
  44. package/dist/client/assets/index-C2RmKzem.js +1636 -0
  45. package/dist/client/assets/index-CHz-iKIQ.js +1 -0
  46. package/dist/client/assets/index-CIGl5oW_.js +1646 -0
  47. package/dist/client/assets/index-CVYmd4Bm.js +1465 -0
  48. package/dist/client/assets/index-Ca9UVGK1.js +1 -0
  49. package/dist/client/assets/index-CeWDkmJN.js +1 -0
  50. package/dist/client/assets/index-CpsNq0zm.css +1 -0
  51. package/dist/client/assets/index-CrUS6abD.css +1 -0
  52. package/dist/client/assets/index-Ctq8vj2Z.js +1 -0
  53. package/dist/client/assets/index-D1ktp0pp.js +1 -0
  54. package/dist/client/assets/index-D3BoYpFi.css +1 -0
  55. package/dist/client/assets/index-D59GxlrT.js +1636 -0
  56. package/dist/client/assets/index-D5Wkww8x.css +1 -0
  57. package/dist/client/assets/index-DC94jMGe.js +1 -0
  58. package/dist/client/assets/index-DFcIBkv1.js +1652 -0
  59. package/dist/client/assets/index-DmKj5Jqc.css +1 -0
  60. package/dist/client/assets/index-Dx52i05H.js +1465 -0
  61. package/dist/client/assets/index-L3GnPzmU.css +1 -0
  62. package/dist/client/assets/index-OZADsKet.js +1652 -0
  63. package/dist/client/assets/index-Qt124kj1.js +1652 -0
  64. package/dist/client/assets/index-nHzwQ3EM.js +1 -0
  65. package/dist/client/assets/index-s9Mg6LTO.js +1 -0
  66. package/dist/client/assets/index-ye8oxz8P.js +1 -0
  67. package/dist/client/assets/index-yqJS7tUY.css +1 -0
  68. package/dist/client/favicon.svg +35 -0
  69. package/dist/client/finius-dashboard.png +0 -0
  70. package/dist/client/index.html +38 -0
  71. package/dist/server/app.js +285 -0
  72. package/dist/server/claude.js +124 -0
  73. package/dist/server/codex.js +94 -0
  74. package/dist/server/events.js +12 -0
  75. package/dist/server/index.js +119 -0
  76. package/dist/server/otel.js +231 -0
  77. package/dist/server/pricing-backfill.js +41 -0
  78. package/dist/server/pricing.js +138 -0
  79. package/dist/server/queue.js +35 -0
  80. package/dist/server/storage/blob.js +17 -0
  81. package/dist/server/storage/query-helpers.js +104 -0
  82. package/dist/server/storage/sqlite.js +1167 -0
  83. package/dist/server/transcripts.js +46 -0
  84. package/dist/server/types.js +1 -0
  85. package/dist/shared/api-types.js +1 -0
  86. package/package.json +72 -0
@@ -0,0 +1 @@
1
+ import{a6 as te,P as Pt,L as We,a4 as ne,ad as _e,I as Ue,H as kt,R as ve,m as Ve,o as je,c as ue,w as Me,ai as L,h as It,v as H,a3 as E,k as U,x as Ot,ag as K,ap as Ft,M as j,W as qe,B as be,N as Rt,ah as Kt,S as Lt,b as Et,a2 as Bt,K as ze,u as Gt,ab as $e,al as Te,Y as Nt,ac as Ht,ak as Wt,a5 as _t,U as Xe,a7 as Ut,a0 as jt,y as qt,t as Ce,p as De,a8 as X,X as Pe,T as zt,V as $t,s as Xt,aa as Yt,Q as Zt,d as Jt,ae as Qt,g as Ye,q as en,af as tn,e as nn,_ as sn,A as rn,$ as Ze,ao as Je,O as Qe,an as et,Z as on,a9 as an}from"./index-Dx52i05H.js";const se=(...t)=>t.reduce((e,n)=>s=>n(e(s))),tt=(t,e,n)=>{const s=e-t;return s?(n-t)/s:1},nt=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,cn=1e-7,ln=12;function un(t,e,n,s,i){let r,o,a=0;do o=e+(n-e)/2,r=nt(o,s,i)-t,r>0?n=o:e=o;while(Math.abs(r)>cn&&++a<ln);return o}function $(t,e,n,s){if(t===e&&n===s)return te;const i=r=>un(r,0,1,t,n);return r=>r===0||r===1?r:nt(i(r),e,s)}const st=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,it=t=>e=>1-t(1-e),rt=$(.33,1.53,.69,.99),Ae=it(rt),ot=st(Ae),at=t=>t>=1?1:(t*=2)<1?.5*Ae(t):.5*(2-Math.pow(2,-10*(t-1))),xe=t=>1-Math.sin(Math.acos(t)),fn=it(xe),ct=st(xe),dn=$(.42,0,1,1),hn=$(0,0,.58,1),lt=$(.42,0,.58,1),pn=t=>Array.isArray(t)&&typeof t[0]!="number",mn={linear:te,easeIn:dn,easeInOut:lt,easeOut:hn,circIn:xe,circInOut:ct,circOut:fn,backIn:Ae,backInOut:ot,backOut:rt,anticipate:at},gn=t=>typeof t=="string",ke=t=>{if(Pt(t)){We(t.length===4);const[e,n,s,i]=t;return $(e,n,s,i)}else if(gn(t))return mn[t];return t};function ie(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function yn({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,e/=100,n/=100;let i=0,r=0,o=0;if(!e)i=r=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,u=2*n-a;i=ie(u,a,t+1/3),r=ie(u,a,t),o=ie(u,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(r*255),blue:Math.round(o*255),alpha:s}}function Z(t,e){return n=>n>0?e:t}const re=(t,e,n)=>{const s=t*t,i=n*(e*e-s)+s;return i<0?0:Math.sqrt(i)},vn=[kt,_e,Ue],bn=t=>vn.find(e=>e.test(t));function Ie(t){const e=bn(t);if(!e)return!1;let n=e.parse(t);return e===Ue&&(n=yn(n)),n}const Oe=(t,e)=>{const n=Ie(t),s=Ie(e);if(!n||!s)return Z(t,e);const i={...n};return r=>(i.red=re(n.red,s.red,r),i.green=re(n.green,s.green,r),i.blue=re(n.blue,s.blue,r),i.alpha=ne(n.alpha,s.alpha,r),_e.transform(i))},fe=new Set(["none","hidden"]);function Tn(t,e){return fe.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function An(t,e){return n=>ne(t,e,n)}function we(t){return typeof t=="number"?An:typeof t=="string"?ve(t)?Z:Ve.test(t)?Oe:Sn:Array.isArray(t)?ut:typeof t=="object"?Ve.test(t)?Oe:xn:Z}function ut(t,e){const n=[...t],s=n.length,i=t.map((r,o)=>we(r)(r,e[o]));return r=>{for(let o=0;o<s;o++)n[o]=i[o](r);return n}}function xn(t,e){const n={...t,...e},s={};for(const i in n)t[i]!==void 0&&e[i]!==void 0&&(s[i]=we(t[i])(t[i],e[i]));return i=>{for(const r in s)n[r]=s[r](i);return n}}function wn(t,e){const n=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const r=e.types[i],o=t.indexes[r][s[r]],a=t.values[o]??0;n[i]=a,s[r]++}return n}const Sn=(t,e)=>{const n=je.createTransformer(e),s=ue(t),i=ue(e);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?fe.has(t)&&!i.values.length||fe.has(e)&&!s.values.length?Tn(t,e):se(ut(wn(s,i),i.values),n):Z(t,e)};function ft(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?ne(t,e,n):we(t)(t,e)}const Vn=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>H.update(e,n),stop:()=>It(e),now:()=>Me.isProcessing?Me.timestamp:L.now()}},J=2e4;function Se(t){let e=0;const n=50;let s=t.next(e);for(;!s.done&&e<J;)e+=n,s=t.next(e);return e>=J?1/0:e}function Mn(t,e=100,n){const s=n({...t,keyframes:[0,e]}),i=Math.min(Se(s),J);return{type:"keyframes",ease:r=>s.next(i*r).value/e,duration:E(i)}}const S={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function de(t,e){return t*Math.sqrt(1-e*e)}const Cn=12;function Dn(t,e,n){let s=n;for(let i=1;i<Cn;i++)s=s-t(s)/e(s);return s}const oe=.001;function Pn({duration:t=S.duration,bounce:e=S.bounce,velocity:n=S.velocity,mass:s=S.mass}){let i,r,o=1-e;o=U(S.minDamping,S.maxDamping,o),t=U(S.minDuration,S.maxDuration,E(t)),o<1?(i=l=>{const c=l*o,f=c*t,d=c-n,m=de(l,o),g=Math.exp(-f);return oe-d/m*g},r=l=>{const f=l*o*t,d=f*n+n,m=Math.pow(o,2)*Math.pow(l,2)*t,g=Math.exp(-f),y=de(Math.pow(l,2),o);return(-i(l)+oe>0?-1:1)*((d-m)*g)/y}):(i=l=>{const c=Math.exp(-l*t),f=(l-n)*t+1;return-oe+c*f},r=l=>{const c=Math.exp(-l*t),f=(n-l)*(t*t);return c*f});const a=5/t,u=Dn(i,r,a);if(t=K(t),isNaN(u))return{stiffness:S.stiffness,damping:S.damping,duration:t};{const l=Math.pow(u,2)*s;return{stiffness:l,damping:o*2*Math.sqrt(s*l),duration:t}}}const kn=["duration","bounce"],In=["stiffness","damping","mass"];function Fe(t,e){return e.some(n=>t[n]!==void 0)}function On(t){let e={velocity:S.velocity,stiffness:S.stiffness,damping:S.damping,mass:S.mass,isResolvedFromDuration:!1,...t};if(!Fe(t,In)&&Fe(t,kn))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,s=2*Math.PI/(n*1.2),i=s*s,r=2*U(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:S.mass,stiffness:i,damping:r}}else{const n=Pn({...t,velocity:0});e={...e,...n,mass:S.mass},e.isResolvedFromDuration=!0}return e}function Q(t=S.visualDuration,e=S.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:i}=n;const r=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:u,damping:l,mass:c,duration:f,velocity:d,isResolvedFromDuration:m}=On({...n,velocity:-E(n.velocity||0)}),g=d||0,y=l/(2*Math.sqrt(u*c)),h=o-r,p=E(Math.sqrt(u/c)),b=Math.abs(h)<5;s||(s=b?S.restSpeed.granular:S.restSpeed.default),i||(i=b?S.restDelta.granular:S.restDelta.default);let x,w,A,V,C,T;if(y<1)A=de(p,y),V=(g+y*p*h)/A,x=v=>{const M=Math.exp(-y*p*v);return o-M*(V*Math.sin(A*v)+h*Math.cos(A*v))},C=y*p*V+h*A,T=y*p*h-V*A,w=v=>Math.exp(-y*p*v)*(C*Math.sin(A*v)+T*Math.cos(A*v));else if(y===1){x=M=>o-Math.exp(-p*M)*(h+(g+p*h)*M);const v=g+p*h;w=M=>Math.exp(-p*M)*(p*v*M-g)}else{const v=p*Math.sqrt(y*y-1);x=O=>{const R=Math.exp(-y*p*O),F=Math.min(v*O,300);return o-R*((g+y*p*h)*Math.sinh(F)+v*h*Math.cosh(F))/v};const M=(g+y*p*h)/v,k=y*p*M-h*v,B=y*p*h-M*v;w=O=>{const R=Math.exp(-y*p*O),F=Math.min(v*O,300);return R*(k*Math.sinh(F)+B*Math.cosh(F))}}const D={calculatedDuration:m&&f||null,velocity:v=>K(w(v)),next:v=>{if(!m&&y<1){const k=Math.exp(-y*p*v),B=Math.sin(A*v),O=Math.cos(A*v),R=o-k*(V*B+h*O),F=K(k*(C*B+T*O));return a.done=Math.abs(F)<=s&&Math.abs(o-R)<=i,a.value=a.done?o:R,a}const M=x(v);if(m)a.done=v>=f;else{const k=K(w(v));a.done=Math.abs(k)<=s&&Math.abs(o-M)<=i}return a.value=a.done?o:M,a},toString:()=>{const v=Math.min(Se(D),J),M=Ot(k=>D.next(v*k).value,v,30);return v+"ms "+M},toTransition:()=>{}};return D}Q.applyToOptions=t=>{const e=Mn(t,100,Q);return t.ease=e.ease,t.duration=K(e.duration),t.type="keyframes",t};const Fn=5;function dt(t,e,n){const s=Math.max(e-Fn,0);return Ft(n-t(s),e-s)}function he({keyframes:t,velocity:e=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:r=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:c}){const f=t[0],d={done:!1,value:f},m=T=>a!==void 0&&T<a||u!==void 0&&T>u,g=T=>a===void 0?u:u===void 0||Math.abs(a-T)<Math.abs(u-T)?a:u;let y=n*e;const h=f+y,p=o===void 0?h:o(h);p!==h&&(y=p-f);const b=T=>-y*Math.exp(-T/s),x=T=>p+b(T),w=T=>{const D=b(T),v=x(T);d.done=Math.abs(D)<=l,d.value=d.done?p:v};let A,V;const C=T=>{m(d.value)&&(A=T,V=Q({keyframes:[d.value,g(d.value)],velocity:dt(x,T,d.value),damping:i,stiffness:r,restDelta:l,restSpeed:c}))};return C(0),{calculatedDuration:null,next:T=>{let D=!1;return!V&&A===void 0&&(D=!0,w(T),C(T)),A!==void 0&&T>=A?V.next(T-A):(!D&&w(T),d)}}}function Rn(t,e,n){const s=[],i=n||j.mix||ft,r=t.length-1;for(let o=0;o<r;o++){let a=i(t[o],t[o+1]);if(e){const u=Array.isArray(e)?e[o]||te:e;a=se(u,a)}s.push(a)}return s}function Kn(t,e,{clamp:n=!0,ease:s,mixer:i}={}){const r=t.length;if(We(r===e.length),r===1)return()=>e[0];if(r===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[r-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=Rn(e,s,i),u=a.length,l=c=>{if(o&&c<t[0])return e[0];let f=0;if(u>1)for(;f<t.length-2&&!(c<t[f+1]);f++);const d=tt(t[f],t[f+1],c);return a[f](d)};return n?c=>l(U(t[0],t[r-1],c)):l}function Ln(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const i=tt(0,e,s);t.push(ne(n,1,i))}}function En(t){const e=[0];return Ln(e,t.length-1),e}function Bn(t,e){return t.map(n=>n*e)}function Gn(t,e){return t.map(()=>e||lt).splice(0,t.length-1)}function z({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const i=pn(s)?s.map(ke):ke(s),r={done:!1,value:e[0]},o=Bn(n&&n.length===e.length?n:En(e),t),a=Kn(o,e,{ease:Array.isArray(i)?i:Gn(e,i)});return{calculatedDuration:t,next:u=>(r.value=a(u),r.done=u>=t,r)}}const Nn={decay:he,inertia:he,tween:z,keyframes:z,spring:Q};function ht(t){typeof t.type=="string"&&(t.type=Nn[t.type])}const Hn=t=>t/100;class ee extends qe{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var s,i;const{motionValue:n}=this.options;n&&n.updatedAt!==L.now()&&this.tick(L.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(i=(s=this.options).onStop)==null||i.call(s))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;ht(e);const{type:n=z,repeat:s=0,repeatDelay:i=0,repeatType:r,velocity:o=0}=e;let{keyframes:a}=e;const u=n||z;u!==z&&typeof a[0]!="number"&&(this.mixKeyframes=se(Hn,ft(a[0],a[1])),a=[0,100]);const l=u({...e,keyframes:a});r==="mirror"&&(this.mirroredGenerator=u({...e,keyframes:[...a].reverse(),velocity:-o})),l.calculatedDuration===null&&(l.calculatedDuration=Se(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+i,this.totalDuration=this.resolvedDuration*(s+1)-i,this.generator=l}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:s,totalDuration:i,mixKeyframes:r,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:u}=this;if(this.startTime===null)return s.next(0);const{delay:l=0,keyframes:c,repeat:f,repeatType:d,repeatDelay:m,type:g,onUpdate:y,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const p=this.currentTime-l*(this.playbackSpeed>=0?1:-1),b=this.playbackSpeed>=0?p<0:p>i;this.currentTime=Math.max(p,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let x=this.currentTime,w=s;if(f){const T=Math.min(this.currentTime,i)/a;let D=Math.floor(T),v=T%1;!v&&T>=1&&(v=1),v===1&&D--,D=Math.min(D,f+1),!!(D%2)&&(d==="reverse"?(v=1-v,m&&(v-=m/a)):d==="mirror"&&(w=o)),x=U(0,1,v)*a}let A;b?(this.delayState.value=c[0],A=this.delayState):A=w.next(x),r&&!b&&(A.value=r(A.value));let{done:V}=A;!b&&u!==null&&(V=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&V);return C&&g!==he&&(A.value=be(c,this.options,h,this.speed)),y&&y(A.value),C&&this.finish(),A}then(e,n){return this.finished.then(e,n)}get duration(){return E(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+E(e)}get time(){return E(this.currentTime)}set time(e){e=K(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const n=this.generator.next(e).value;return dt(s=>this.generator.next(s).value,e,n)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;n&&this.driver&&this.updateTime(L.now()),this.playbackSpeed=e,n&&this.driver&&(this.time=E(this.currentTime))}play(){var i,r;if(this.isStopped)return;const{driver:e=Vn,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(r=(i=this.options).onPlay)==null||r.call(i);const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=n??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(L.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(e=this.options).onComplete)==null||n.call(e)}cancel(){var e,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(e=this.options).onCancel)==null||n.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),e.observe(this)}}const pt={anticipate:at,backInOut:ot,circInOut:ct};function Wn(t){return t in pt}function _n(t){typeof t.ease=="string"&&Wn(t.ease)&&(t.ease=pt[t.ease])}const ae=10;class Un extends Rt{constructor(e){_n(e),ht(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:s,onComplete:i,element:r,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const a=new ee({...o,autoplay:!1}),u=Math.max(ae,L.now()-this.startTime),l=U(0,ae,u-ae),c=a.sample(u).value,{name:f}=this.options;r&&f&&Kt(r,f,c),n.setWithVelocity(a.sample(Math.max(0,u-l)).value,c,l),a.stop()}}const Re=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(je.test(t)||t==="0")&&!t.startsWith("url("));function jn(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function qn(t,e,n,s){const i=t[0];if(i===null)return!1;if(e==="display"||e==="visibility")return!0;const r=t[t.length-1],o=Re(i,e),a=Re(r,e);return!o||!a?!1:jn(t)||(n==="spring"||Lt(n))&&s}function pe(t){t.duration=0,t.type="keyframes"}const zn=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function $n(t){for(let e=0;e<t.length;e++)if(typeof t[e]=="string"&&zn.test(t[e]))return!0;return!1}const Xn=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Yn=Bt(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Zn(t){var f;const{motionValue:e,name:n,repeatDelay:s,repeatType:i,damping:r,type:o,keyframes:a}=t;if(!(((f=e==null?void 0:e.owner)==null?void 0:f.current)instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=e.owner.getProps();return Yn()&&n&&(Et.has(n)||Xn.has(n)&&$n(a))&&(n!=="transform"||!c)&&!l&&!s&&i!=="mirror"&&r!==0&&o!=="inertia"}const Jn=40;class Qn extends qe{constructor({autoplay:e=!0,delay:n=0,type:s="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:o="loop",keyframes:a,name:u,motionValue:l,element:c,...f}){var g;super(),this.stop=()=>{var y,h;this._animation&&(this._animation.stop(),(y=this.stopTimeline)==null||y.call(this)),(h=this.keyframeResolver)==null||h.cancel()},this.createdAt=L.now();const d={autoplay:e,delay:n,type:s,repeat:i,repeatDelay:r,repeatType:o,name:u,motionValue:l,element:c,...f},m=(c==null?void 0:c.KeyframeResolver)||ze;this.keyframeResolver=new m(a,(y,h,p)=>this.onKeyframesResolved(y,h,d,!p),u,l,c),(g=this.keyframeResolver)==null||g.scheduleResolve()}onKeyframesResolved(e,n,s,i){var p,b;this.keyframeResolver=void 0;const{name:r,type:o,velocity:a,delay:u,isHandoff:l,onUpdate:c}=s;this.resolvedAt=L.now();let f=!0;qn(e,r,o,a)||(f=!1,(j.instantAnimations||!u)&&(c==null||c(be(e,s,n))),e[0]=e[e.length-1],pe(s),s.repeat=0);const m={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>Jn?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:e},g=f&&!l&&Zn(m),y=(b=(p=m.motionValue)==null?void 0:p.owner)==null?void 0:b.current;let h;if(g)try{h=new Un({...m,element:y})}catch{h=new ee(m)}else h=new ee(m);h.finished.then(()=>{this.notifyFinished()}).catch(te),this.pendingTimeline&&(this.stopTimeline=h.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=h}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),Gt()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function mt(t,e,n,s=0,i=1){const r=Array.from(t).sort((l,c)=>l.sortNodePosition(c)).indexOf(e),o=t.size,a=(o-1)*s;return typeof n=="function"?n(r,o):i===1?r*s:a-r*s}function gt(t,e){const n=(t==null?void 0:t[e])??(t==null?void 0:t.default)??t;return n!==t?$e(n,t):n}const es={type:"spring",stiffness:500,damping:25,restSpeed:10},ts=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),ns={type:"keyframes",duration:.8},ss={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},is=(t,{keyframes:e})=>e.length>2?ns:Te.has(t)?t.startsWith("scale")?ts(e[1]):es:ss,rs=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function os(t){for(const e in t)if(!rs.has(e))return!0;return!1}const as=(t,e,n,s={},i,r)=>o=>{const a=gt(s,t)||{},u=a.delay||s.delay||0;let{elapsed:l=0}=s;l=l-K(u);const c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:d=>{e.set(d),a.onUpdate&&a.onUpdate(d)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:r?void 0:i};os(a)||Object.assign(c,is(t,c)),c.duration&&(c.duration=K(c.duration)),c.repeatDelay&&(c.repeatDelay=K(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let f=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(pe(c),c.delay===0&&(f=!0)),(j.instantAnimations||j.skipAnimations||i!=null&&i.shouldSkipAnimations||a.skipAnimations)&&(f=!0,pe(c),c.delay=0),c.allowFlatten=!a.type&&!a.ease,f&&!r&&e.get()!==void 0){const d=be(c.keyframes,a);if(d!==void 0){H.update(()=>{c.onUpdate(d),c.onComplete()});return}}return a.isSync?new ee(c):new Qn(c)},cs=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ls(t){const e=cs.exec(t);if(!e)return[,];const[,n,s,i]=e;return[`--${n??s}`,i]}function yt(t,e,n=1){const[s,i]=ls(t);if(!s)return;const r=window.getComputedStyle(e).getPropertyValue(s);if(r){const o=r.trim();return Nt(o)?parseFloat(o):o}return ve(i)?yt(i,e,n+1):i}function W(t,e,n){const s=t.getProps();return Ht(s,e,n!==void 0?n:s.custom,t)}const vt=new Set(["width","height","top","left","right","bottom",...Wt]),me=t=>Array.isArray(t);function us(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,_t(n))}function fs(t){return me(t)?t[t.length-1]||0:t}function ds(t,e){const n=W(t,e);let{transitionEnd:s={},transition:i={},...r}=n||{};r={...r,...s};for(const o in r){const a=fs(r[o]);us(t,o,a)}}function hs(t){return!!(Xe(t)&&t.add)}function ps(t,e){const n=t.getValue("willChange");if(hs(n))return n.add(e);if(!n&&j.WillChange){const s=new j.WillChange("auto");t.addValue("willChange",s),s.add(e)}}function ms(t){return t.props[Ut]}function gs({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,s}function bt(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:r,transitionEnd:o,...a}=e;const u=t.getDefaultTransition();r=r?$e(r,u):u;const l=r==null?void 0:r.reduceMotion,c=r==null?void 0:r.skipAnimations;s&&(r=s);const f=[],d=i&&t.animationState&&t.animationState.getState()[i],m=r==null?void 0:r.path;m&&m.animateVisualElement(t,a,r,n,f);for(const g in a){const y=t.getValue(g,t.latestValues[g]??null),h=a[g];if(h===void 0||d&&gs(d,g))continue;const p={delay:n,...gt(r||{},g)};c&&(p.skipAnimations=!0);const b=y.get();if(b!==void 0&&!y.isAnimating()&&!Array.isArray(h)&&h===b&&!p.velocity){H.update(()=>y.set(h));continue}let x=!1;if(window.MotionHandoffAnimation){const V=ms(t);if(V){const C=window.MotionHandoffAnimation(V,g,H);C!==null&&(p.startTime=C,x=!0)}}ps(t,g);const w=l??t.shouldReduceMotion;y.start(as(g,y,h,w&&vt.has(g)?{type:!1}:p,t,x));const A=y.animation;A&&f.push(A)}if(o){const g=()=>H.update(()=>{o&&ds(t,o)});f.length?Promise.all(f).then(g):g()}return f}function ge(t,e,n={}){var u;const s=W(t,e,n.type==="exit"?(u=t.presenceContext)==null?void 0:u.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const r=s?()=>Promise.all(bt(t,s,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:c=0,staggerChildren:f,staggerDirection:d}=i;return ys(t,e,l,c,f,d,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[l,c]=a==="beforeChildren"?[r,o]:[o,r];return l().then(()=>c())}else return Promise.all([r(),o(n.delay)])}function ys(t,e,n=0,s=0,i=0,r=1,o){const a=[];for(const u of t.variantChildren)u.notify("AnimationStart",e),a.push(ge(u,e,{...o,delay:n+(typeof s=="function"?0:s)+mt(t.variantChildren,u,s,i,r)}).then(()=>u.notify("AnimationComplete",e)));return Promise.all(a)}function vs(t,e,n={}){t.notify("AnimationStart",e);let s;if(Array.isArray(e)){const i=e.map(r=>ge(t,r,n));s=Promise.all(i)}else if(typeof e=="string")s=ge(t,e,n);else{const i=typeof e=="function"?W(t,e,n.custom):e;s=Promise.all(bt(t,i,n))}return s.then(()=>{t.notify("AnimationComplete",e)})}function bs(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||jt(t):!0}const Ts=new Set(["auto","none","0"]);function As(t,e,n){let s=0,i;for(;s<t.length&&!i;){const r=t[s];typeof r=="string"&&!Ts.has(r)&&ue(r).values.length&&(i=t[s]),s++}if(i&&n)for(const r of e)t[r]=qt(n,i)}class xs extends ze{constructor(e,n,s,i,r){super(e,n,s,i,r,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<e.length;c++){let f=e[c];if(typeof f=="string"&&(f=f.trim(),ve(f))){const d=yt(f,n.current);d!==void 0&&(e[c]=d),c===e.length-1&&(this.finalKeyframe=f)}}if(this.resolveNoneKeyframes(),!vt.has(s)||e.length!==2)return;const[i,r]=e,o=Ce(i),a=Ce(r),u=De(i),l=De(r);if(u!==l&&X[s]){this.needsMeasurement=!0;return}if(o!==a)if(Pe(o)&&Pe(a))for(let c=0;c<e.length;c++){const f=e[c];typeof f=="string"&&(e[c]=parseFloat(f))}else X[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,s=[];for(let i=0;i<e.length;i++)(e[i]===null||bs(e[i]))&&s.push(i);s.length&&As(e,s,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:s}=this;if(!e||!e.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=X[s](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&e.getValue(s,i).jump(i,!1)}measureEndState(){var a;const{element:e,name:n,unresolvedKeyframes:s}=this;if(!e||!e.current)return;const i=e.getValue(n);i&&i.jump(this.measuredOrigin,!1);const r=s.length-1,o=s[r];s[r]=X[n](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(a=this.removedTransforms)!=null&&a.length&&this.removedTransforms.forEach(([u,l])=>{e.getValue(u).set(l)}),this.resolveNoneKeyframes()}}function ws(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){let s=document;const i=(n==null?void 0:n[t])??s.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t).filter(s=>s!=null)}const Ss={y:!1};function Vs(){return Ss.y}function Tt(t,e){const n=ws(t),s=new AbortController,i={passive:!0,...e,signal:s.signal};return[n,i,()=>s.abort()]}function Ms(t){return!(t.pointerType==="touch"||Vs())}function Cs(t,e,n={}){const[s,i,r]=Tt(t,n);return s.forEach(o=>{let a=!1,u=!1,l;const c=()=>{o.removeEventListener("pointerleave",g)},f=h=>{l&&(l(h),l=void 0),c()},d=h=>{a=!1,window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d),u&&(u=!1,f(h))},m=()=>{a=!0,window.addEventListener("pointerup",d,i),window.addEventListener("pointercancel",d,i)},g=h=>{if(h.pointerType!=="touch"){if(a){u=!0;return}f(h)}},y=h=>{if(!Ms(h))return;u=!1;const p=e(o,h);typeof p=="function"&&(l=p,o.addEventListener("pointerleave",g,i))};o.addEventListener("pointerenter",y,i),o.addEventListener("pointerdown",m,i)}),r}const At=(t,e)=>e?t===e?!0:At(t,e.parentElement):!1,Ds=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Ps=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function ks(t){return Ps.has(t.tagName)||t.isContentEditable===!0}const Y=new WeakSet;function Ke(t){return e=>{e.key==="Enter"&&t(e)}}function ce(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Is=(t,e)=>{const n=t.currentTarget;if(!n)return;const s=Ke(()=>{if(Y.has(n))return;ce(n,"down");const i=Ke(()=>{ce(n,"up")}),r=()=>ce(n,"cancel");n.addEventListener("keyup",i,e),n.addEventListener("blur",r,e)});n.addEventListener("keydown",s,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),e)};function Le(t){return Ds(t)&&!0}const Ee=new WeakSet;function Os(t,e,n={}){const[s,i,r]=Tt(t,n),o=a=>{const u=a.currentTarget;if(!Le(a)||Ee.has(a))return;Y.add(u),n.stopPropagation&&Ee.add(a);const l=e(u,a),c=(m,g)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",d),Y.has(u)&&Y.delete(u),Le(m)&&typeof l=="function"&&l(m,{success:g})},f=m=>{c(m,u===window||u===document||n.useGlobalTarget||At(u,m.target))},d=m=>{c(m,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",d,i)};return s.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,i),zt(a)&&(a.addEventListener("focus",l=>Is(l,i)),!ks(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),r}class xt extends $t{constructor(){super(...arguments),this.KeyframeResolver=xs}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const s=e.style;return s?s[n]:void 0}removeValueFromRenderState(e,{vars:n,style:s}){delete n[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Xe(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class q{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Fs({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function Rs(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function Ks(t,e){return Fs(Rs(t.getBoundingClientRect(),e))}function wt(t,{style:e,vars:n},s,i){const r=t.style;let o;for(o in e)r[o]=e[o];i==null||i.applyProjectionStyles(r,s);for(o in n)r.setProperty(o,n[o])}function Ls(t){return window.getComputedStyle(t)}class Es extends xt{constructor(){super(...arguments),this.type="html",this.renderInstance=wt}readValueFromInstance(e,n){var s;if(Te.has(n))return(s=this.projection)!=null&&s.isProjecting?Xt(n):Yt(e,n);{const i=Ls(e),r=(Zt(n)?i.getPropertyValue(n):i[n])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Ks(e,n)}build(e,n,s){Jt(e,n,s.transformTemplate)}scrapeMotionValuesFromProps(e,n,s){return Qt(e,n,s)}}const St=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Bs(t,e,n,s){wt(t,e,void 0,s);for(const i in e.attrs)t.setAttribute(St.has(i)?i:Ye(i),e.attrs[i])}class Gs extends xt{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=en}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Te.has(n)){const s=rn(n);return s&&s.default||0}return n=St.has(n)?n:Ye(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,s){return tn(e,n,s)}build(e,n,s){nn(e,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(e,n,s,i){Bs(e,n,s,i)}mount(e){this.isSVGTag=sn(e.tagName),super.mount(e)}}const Ns=Je.length;function Vt(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?Vt(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<Ns;n++){const s=Je[n],i=t.props[s];(Ze(i)||i===!1)&&(e[s]=i)}return e}function Mt(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s<n;s++)if(e[s]!==t[s])return!1;return!0}const Hs=[...et].reverse(),Ws=et.length;function _s(t){return e=>Promise.all(e.map(({animation:n,options:s})=>vs(t,n,s)))}function Us(t){let e=_s(t),n=Be(),s=!0,i=!1;const r=l=>(c,f)=>{var m;const d=W(t,f,l==="exit"?(m=t.presenceContext)==null?void 0:m.custom:void 0);if(d){const{transition:g,transitionEnd:y,...h}=d;c={...c,...h,...y}}return c};function o(l){e=l(t)}function a(l){const{props:c}=t,f=Vt(t.parent)||{},d=[],m=new Set;let g={},y=1/0;for(let p=0;p<Ws;p++){const b=Hs[p],x=n[b],w=c[b]!==void 0?c[b]:f[b],A=Ze(w),V=b===l?x.isActive:null;V===!1&&(y=p);let C=w===f[b]&&w!==c[b]&&A;if(C&&(s||i)&&t.manuallyAnimateOnMount&&(C=!1),x.protectedKeys={...g},!x.isActive&&V===null||!w&&!x.prevProp||Qe(w)||typeof w=="boolean")continue;if(b==="exit"&&x.isActive&&V!==!0){x.prevResolvedValues&&(g={...g,...x.prevResolvedValues});continue}const T=js(x.prevProp,w);let D=T||b===l&&x.isActive&&!C&&A||p>y&&A,v=!1;const M=Array.isArray(w)?w:[w];let k=M.reduce(r(b),{});V===!1&&(k={});const{prevResolvedValues:B={}}=x,O={...B,...k},R=P=>{D=!0,m.has(P)&&(v=!0,m.delete(P)),x.needsAnimating[P]=!0;const I=t.getValue(P);I&&(I.liveStyle=!1)};for(const P in O){const I=k[P],G=B[P];if(g.hasOwnProperty(P))continue;let _=!1;me(I)&&me(G)?_=!Mt(I,G)||T:_=I!==G,_?I!=null?R(P):m.add(P):I!==void 0&&m.has(P)?R(P):x.protectedKeys[P]=!0}x.prevProp=w,x.prevResolvedValues=k,x.isActive&&(g={...g,...k}),(s||i)&&t.blockInitialAnimation&&(D=!1);const F=C&&T;D&&(!F||v)&&d.push(...M.map(P=>{const I={type:b};if(typeof P=="string"&&(s||i)&&!F&&t.manuallyAnimateOnMount&&t.parent){const{parent:G}=t,_=W(G,P);if(G.enteringChildren&&_){const{delayChildren:Dt}=_.transition||{};I.delay=mt(G.enteringChildren,t,Dt)}}return{animation:P,options:I}}))}if(m.size){const p={};if(typeof c.initial!="boolean"){const b=W(t,Array.isArray(c.initial)?c.initial[0]:c.initial);b&&b.transition&&(p.transition=b.transition)}m.forEach(b=>{const x=t.getBaseTarget(b),w=t.getValue(b);w&&(w.liveStyle=!0),p[b]=x??null}),d.push({animation:p})}let h=!!d.length;return s&&(c.initial===!1||c.initial===c.animate)&&!t.manuallyAnimateOnMount&&(h=!1),s=!1,i=!1,h?e(d):Promise.resolve()}function u(l,c){var d;if(n[l].isActive===c)return Promise.resolve();(d=t.variantChildren)==null||d.forEach(m=>{var g;return(g=m.animationState)==null?void 0:g.setActive(l,c)}),n[l].isActive=c;const f=a(l);for(const m in n)n[m].protectedKeys={};return f}return{animateChanges:a,setActive:u,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Be(),i=!0}}}function js(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Mt(e,t):!1}function N(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Be(){return{animate:N(!0),whileInView:N(),whileHover:N(),whileTap:N(),whileDrag:N(),whileFocus:N(),exit:N()}}function Ge(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}const qs=(t,e)=>e.isSVG??on(t)?new Gs(e):new Es(e,{allowProjection:t!==an.Fragment});class zs extends q{constructor(e){super(e),e.animationState||(e.animationState=Us(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Qe(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let $s=0;class Xs extends q{constructor(){super(...arguments),this.id=$s++,this.isExitComplete=!1}update(){var r;if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;if(e&&s===!1){if(this.isExitComplete){const{initial:o,custom:a}=this.node.getProps();if(typeof o=="string"||typeof o=="object"&&o!==null&&!Array.isArray(o)){const u=W(this.node,o,a);if(u){const{transition:l,transitionEnd:c,...f}=u;for(const d in f)(r=this.node.getValue(d))==null||r.jump(f[d])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const i=this.node.animationState.setActive("exit",!e);n&&!e&&i.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Ys={animation:{Feature:zs},exit:{Feature:Xs}};function Ct(t){return{point:{x:t.pageX,y:t.pageY}}}function Ne(t,e,n){const{props:s}=t;t.animationState&&s.whileHover&&t.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,r=s[i];r&&H.postRender(()=>r(e,Ct(e)))}class Zs extends q{mount(){const{current:e}=this.node;e&&(this.unmount=Cs(e,(n,s)=>(Ne(this.node,s,"Start"),i=>Ne(this.node,i,"End"))))}unmount(){}}class Js extends q{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=se(Ge(this.node.current,"focus",()=>this.onFocus()),Ge(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function He(t,e,n){const{props:s}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&s.whileTap&&t.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),r=s[i];r&&H.postRender(()=>r(e,Ct(e)))}class Qs extends q{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:s}=this.node.props;this.unmount=Os(e,(i,r)=>(He(this.node,r,"Start"),(o,{success:a})=>He(this.node,o,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(s==null?void 0:s.tap)===!1})}unmount(){}}const ye=new WeakMap,le=new WeakMap,ei=t=>{const e=ye.get(t.target);e&&e(t)},ti=t=>{t.forEach(ei)};function ni({root:t,...e}){const n=t||document;le.has(n)||le.set(n,{});const s=le.get(n),i=JSON.stringify(e);return s[i]||(s[i]=new IntersectionObserver(ti,{root:t,...e})),s[i]}function si(t,e,n){const s=ni(e);return ye.set(t,n),s.observe(t),()=>{ye.delete(t),s.unobserve(t)}}const ii={some:0,all:1};class ri extends q{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var u;(u=this.stopObserver)==null||u.call(this);const{viewport:e={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:r}=e,o={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:ii[i]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,r&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:f,onViewportLeave:d}=this.node.getProps(),m=c?f:d;m&&m(l)};this.stopObserver=si(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(oi(e,n))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function oi({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const ai={inView:{Feature:ri},tap:{Feature:Qs},focus:{Feature:Js},hover:{Feature:Zs}},ci={renderer:qs,...Ys,...ai};var fi=ci;export{fi as default};