UNPKG

framer-motion

Version:

A simple and powerful React animation library

1 lines • 89.6 kB
import*as t from"react";import e,{createContext as n,useContext as o,useLayoutEffect as i,useEffect as r,useRef as s,useCallback as a,useMemo as l,forwardRef as u,createElement as c,useId as d}from"react";const h=n({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),p=n({});const m=n(null),f="undefined"!=typeof document,g=f?i:r,v=n({strict:!1});function y(t,e,n,i){const a=o(p).visualElement,l=o(v),u=o(m),c=o(h).reducedMotion,d=s(void 0);i=i||l.renderer,!d.current&&i&&(d.current=i(t,{visualState:e,parent:a,props:n,presenceId:u?u.id:void 0,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:c}));const f=d.current;return g(()=>{f&&f.syncRender()}),r(()=>{f&&f.animationState&&f.animationState.animateChanges()}),g(()=>()=>f&&f.notifyUnmount(),[]),f}function x(t){return"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}function b(t){return"string"==typeof t||Array.isArray(t)}function w(t){return"object"==typeof t&&"function"==typeof t.start}const P=["initial","animate","exit","whileHover","whileDrag","whileTap","whileFocus","whileInView"];function S(t){return w(t.animate)||P.some(e=>b(t[e]))}function A(t){return Boolean(S(t)||t.variants)}function T(t){const{initial:e,animate:n}=function(t,e){if(S(t)){const{initial:e,animate:n}=t;return{initial:!1===e||b(e)?e:void 0,animate:b(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,o(p));return l(()=>({initial:e,animate:n}),[E(e),E(n)])}function E(t){return Array.isArray(t)?t.join(" "):t}const V=t=>({isEnabled:e=>t.some(t=>!!e[t])}),C={measureLayout:V(["layout","layoutId","drag"]),animation:V(["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"]),exit:V(["exit"]),drag:V(["drag","dragControls"]),focus:V(["whileFocus"]),hover:V(["whileHover","onHoverStart","onHoverEnd"]),tap:V(["whileTap","onTap","onTapStart","onTapCancel"]),pan:V(["onPan","onPanStart","onPanSessionStart","onPanEnd"]),inView:V(["whileInView","onViewportEnter","onViewportLeave"])};function M(t){const e=s(null);return null===e.current&&(e.current=t()),e.current}const R={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let L=1;const D=n({});class k extends e.Component{getSnapshotBeforeUpdate(){const{visualElement:t,props:e}=this.props;return t&&t.setProps(e),null}componentDidUpdate(){}render(){return this.props.children}}const O=n({}),j=Symbol.for("motionComponentSymbol");function F({preloadedFeatures:e,createVisualElement:n,projectionNodeConstructor:i,useRender:r,useVisualState:s,Component:l}){e&&function(t){for(const e in t)"projectionNodeConstructor"===e?C.projectionNodeConstructor=t[e]:C[e].Component=t[e]}(e);const c=u((function(u,c){const d={...o(h),...u,layoutId:I(u)},{isStatic:m}=d;let g=null;const b=T(u),w=m?void 0:M(()=>{if(R.hasEverUpdated)return L++}),P=s(u,m);if(!m&&f){b.visualElement=y(l,P,d,n);const t=o(v).strict,r=o(O);b.visualElement&&(g=b.visualElement.loadFeatures(u,t,e,w,i||C.projectionNodeConstructor,r))}return t.createElement(k,{visualElement:b.visualElement,props:d},g,t.createElement(p.Provider,{value:b},r(l,u,w,function(t,e,n){return a(o=>{o&&t.mount&&t.mount(o),e&&(o?e.mount(o):e.unmount()),n&&("function"==typeof n?n(o):x(n)&&(n.current=o))},[e])}(P,b.visualElement,c),P,m,b.visualElement)))}));return c[j]=l,c}function I({layoutId:t}){const e=o(D).id;return e&&void 0!==t?e+"-"+t:t}function U(t){function e(e,n={}){return F(t(e,n))}if("undefined"==typeof Proxy)return e;const n=new Map;return new Proxy(e,{get:(t,o)=>(n.has(o)||n.set(o,e(o)),n.get(o))})}const B=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","svg","switch","symbol","text","tspan","use","view"];function N(t){return"string"==typeof t&&!t.includes("-")&&!!(B.indexOf(t)>-1||/[A-Z]/.test(t))}const $={};const z=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],H=new Set(z);function W(t,{layout:e,layoutId:n}){return H.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!$[t]||"opacity"===t)}const Y=t=>void 0!==t&&!!t.getVelocity,X={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},G=(t,e)=>z.indexOf(t)-z.indexOf(e);function q(t){return t.startsWith("--")}const Z=(t,e)=>e&&"number"==typeof t?e.transform(t):t,K=(t,e)=>n=>Math.max(Math.min(n,e),t),_=t=>t%1?Number(t.toFixed(5)):t,J=/(-)?([\d]*\.?[\d])+/g,Q=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,tt=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function et(t){return"string"==typeof t}const nt={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},ot=Object.assign(Object.assign({},nt),{transform:K(0,1)}),it=Object.assign(Object.assign({},nt),{default:1}),rt=t=>({test:e=>et(e)&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),st=rt("deg"),at=rt("%"),lt=rt("px"),ut=rt("vh"),ct=rt("vw"),dt=Object.assign(Object.assign({},at),{parse:t=>at.parse(t)/100,transform:t=>at.transform(100*t)}),ht=(t,e)=>n=>Boolean(et(n)&&tt.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),pt=(t,e,n)=>o=>{if(!et(o))return o;const[i,r,s,a]=o.match(J);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(s),alpha:void 0!==a?parseFloat(a):1}},mt={test:ht("hsl","hue"),parse:pt("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:o=1})=>"hsla("+Math.round(t)+", "+at.transform(_(e))+", "+at.transform(_(n))+", "+_(ot.transform(o))+")"},ft=K(0,255),gt=Object.assign(Object.assign({},nt),{transform:t=>Math.round(ft(t))}),vt={test:ht("rgb","red"),parse:pt("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:o=1})=>"rgba("+gt.transform(t)+", "+gt.transform(e)+", "+gt.transform(n)+", "+_(ot.transform(o))+")"};const yt={test:ht("#"),parse:function(t){let e="",n="",o="",i="";return t.length>5?(e=t.substr(1,2),n=t.substr(3,2),o=t.substr(5,2),i=t.substr(7,2)):(e=t.substr(1,1),n=t.substr(2,1),o=t.substr(3,1),i=t.substr(4,1),e+=e,n+=n,o+=o,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(o,16),alpha:i?parseInt(i,16)/255:1}},transform:vt.transform},xt={test:t=>vt.test(t)||yt.test(t)||mt.test(t),parse:t=>vt.test(t)?vt.parse(t):mt.test(t)?mt.parse(t):yt.parse(t),transform:t=>et(t)?t:t.hasOwnProperty("red")?vt.transform(t):mt.transform(t)};function bt(t){"number"==typeof t&&(t=""+t);const e=[];let n=0;const o=t.match(Q);o&&(n=o.length,t=t.replace(Q,"${c}"),e.push(...o.map(xt.parse)));const i=t.match(J);return i&&(t=t.replace(J,"${n}"),e.push(...i.map(nt.parse))),{values:e,numColors:n,tokenised:t}}function wt(t){return bt(t).values}function Pt(t){const{values:e,numColors:n,tokenised:o}=bt(t),i=e.length;return t=>{let e=o;for(let o=0;o<i;o++)e=e.replace(o<n?"${c}":"${n}",o<n?xt.transform(t[o]):_(t[o]));return e}}const St=t=>"number"==typeof t?0:t;const At={test:function(t){var e,n,o,i;return isNaN(t)&&et(t)&&(null!==(n=null===(e=t.match(J))||void 0===e?void 0:e.length)&&void 0!==n?n:0)+(null!==(i=null===(o=t.match(Q))||void 0===o?void 0:o.length)&&void 0!==i?i:0)>0},parse:wt,createTransformer:Pt,getAnimatableNone:function(t){const e=wt(t);return Pt(t)(e.map(St))}},Tt=new Set(["brightness","contrast","saturate","opacity"]);function Et(t){let[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[o]=n.match(J)||[];if(!o)return t;const i=n.replace(o,"");let r=Tt.has(e)?1:0;return o!==n&&(r*=100),e+"("+r+i+")"}const Vt=/([a-z-]*)\(.*?\)/g,Ct=Object.assign(Object.assign({},At),{getAnimatableNone:t=>{const e=t.match(Vt);return e?e.map(Et).join(" "):t}}),Mt={...nt,transform:Math.round},Rt={borderWidth:lt,borderTopWidth:lt,borderRightWidth:lt,borderBottomWidth:lt,borderLeftWidth:lt,borderRadius:lt,radius:lt,borderTopLeftRadius:lt,borderTopRightRadius:lt,borderBottomRightRadius:lt,borderBottomLeftRadius:lt,width:lt,maxWidth:lt,height:lt,maxHeight:lt,size:lt,top:lt,right:lt,bottom:lt,left:lt,padding:lt,paddingTop:lt,paddingRight:lt,paddingBottom:lt,paddingLeft:lt,margin:lt,marginTop:lt,marginRight:lt,marginBottom:lt,marginLeft:lt,rotate:st,rotateX:st,rotateY:st,rotateZ:st,scale:it,scaleX:it,scaleY:it,scaleZ:it,skew:st,skewX:st,skewY:st,distance:lt,translateX:lt,translateY:lt,translateZ:lt,x:lt,y:lt,z:lt,perspective:lt,transformPerspective:lt,opacity:ot,originX:dt,originY:dt,originZ:lt,zIndex:Mt,fillOpacity:ot,strokeOpacity:ot,numOctaves:Mt};function Lt(t,e,n,o){const{style:i,vars:r,transform:s,transformKeys:a,transformOrigin:l}=t;a.length=0;let u=!1,c=!1,d=!0;for(const t in e){const n=e[t];if(q(t)){r[t]=n;continue}const o=Rt[t],h=Z(n,o);if(H.has(t)){if(u=!0,s[t]=h,a.push(t),!d)continue;n!==(o.default||0)&&(d=!1)}else t.startsWith("origin")?(c=!0,l[t]=h):i[t]=h}if(u||o?i.transform=function({transform:t,transformKeys:e},{enableHardwareAcceleration:n=!0,allowTransformNone:o=!0},i,r){let s="";e.sort(G);for(const n of e)s+=`${X[n]||n}(${t[n]}) `;return n&&!t.z&&(s+="translateZ(0)"),s=s.trim(),r?s=r(t,i?"":s):o&&i&&(s="none"),s}(t,n,d,o):!e.transform&&i.transform&&(i.transform="none"),c){const{originX:t="50%",originY:e="50%",originZ:n=0}=l;i.transformOrigin=`${t} ${e} ${n}`}}const Dt=()=>({style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{}});function kt(t,e,n){for(const o in e)Y(e[o])||W(o,n)||(t[o]=e[o])}function Ot(t,e,n){const o={};return kt(o,t.style||{},t),Object.assign(o,function({transformTemplate:t},e,n){return l(()=>{const o={style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{}};return Lt(o,e,{enableHardwareAcceleration:!n},t),Object.assign({},o.vars,o.style)},[e])}(t,e,n)),t.transformValues?t.transformValues(o):o}function jt(t,e,n){const o={},i=Ot(t,e,n);return t.drag&&!1!==t.dragListener&&(o.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),o.style=i,o}const Ft=new Set(["initial","style","variants","transition","transformTemplate","transformValues","custom","inherit","layout","layoutId","layoutDependency","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","drag","dragControls","dragListener","dragConstraints","dragDirectionLock","dragSnapToOrigin","_dragX","_dragY","dragElastic","dragMomentum","dragPropagation","dragTransition","onHoverStart","onHoverEnd","layoutScroll","whileInView","onViewportEnter","onViewportLeave","viewport","whileTap","onTap","onTapStart","onTapCancel","animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView","onPan","onPanStart","onPanSessionStart","onPanEnd"]);function It(t){return Ft.has(t)}let Ut=t=>!It(t);try{(Bt=require("@emotion/is-prop-valid").default)&&(Ut=t=>t.startsWith("on")?!It(t):Bt(t))}catch(t){}var Bt;function Nt(t,e,n){return"string"==typeof t?t:lt.transform(e+n*t)}const $t={offset:"stroke-dashoffset",array:"stroke-dasharray"},zt={offset:"strokeDashoffset",array:"strokeDasharray"};function Ht(t,{attrX:e,attrY:n,originX:o,originY:i,pathLength:r,pathSpacing:s=1,pathOffset:a=0,...l},u,c){Lt(t,l,u,c),t.attrs=t.style,t.style={};const{attrs:d,style:h,dimensions:p}=t;d.transform&&(p&&(h.transform=d.transform),delete d.transform),p&&(void 0!==o||void 0!==i||h.transform)&&(h.transformOrigin=function(t,e,n){return`${Nt(e,t.x,t.width)} ${Nt(n,t.y,t.height)}`}(p,void 0!==o?o:.5,void 0!==i?i:.5)),void 0!==e&&(d.x=e),void 0!==n&&(d.y=n),void 0!==r&&function(t,e,n=1,o=0,i=!0){t.pathLength=1;const r=i?$t:zt;t[r.offset]=lt.transform(-o);const s=lt.transform(e),a=lt.transform(n);t[r.array]=`${s} ${a}`}(d,r,s,a,!1)}const Wt=()=>({style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{},attrs:{}});function Yt(t,e){const n=l(()=>{const n={style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{},attrs:{}};return Ht(n,e,{enableHardwareAcceleration:!1},t.transformTemplate),{...n.attrs,style:{...n.style}}},[e]);if(t.style){const e={};kt(e,t.style,t),n.style={...e,...n.style}}return n}function Xt(t=!1){return(e,n,o,i,{latestValues:r},s)=>{const a=(N(e)?Yt:jt)(n,r,s),l={...function(t,e,n){const o={};for(const i in t)(Ut(i)||!0===n&&It(i)||!e&&!It(i)||t.draggable&&i.startsWith("onDrag"))&&(o[i]=t[i]);return o}(n,"string"==typeof e,t),...a,ref:i};return o&&(l["data-projection-id"]=o),c(e,l)}}const Gt=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function qt(t,{style:e,vars:n},o,i){Object.assign(t.style,e,i&&i.getProjectionStyles(o));for(const e in n)t.style.setProperty(e,n[e])}const Zt=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength"]);function Kt(t,e,n,o){qt(t,e,void 0,o);for(const n in e.attrs)t.setAttribute(Zt.has(n)?n:Gt(n),e.attrs[n])}function _t(t){const{style:e}=t,n={};for(const o in e)(Y(e[o])||W(o,t))&&(n[o]=e[o]);return n}function Jt(t){const e=_t(t);for(const n in t)if(Y(t[n])){e["x"===n||"y"===n?"attr"+n.toUpperCase():n]=t[n]}return e}function Qt(t,e,n,o={},i={}){return"function"==typeof e&&(e=e(void 0!==n?n:t.custom,o,i)),"string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e&&(e=e(void 0!==n?n:t.custom,o,i)),e}const te=t=>Array.isArray(t),ee=t=>te(t)?t[t.length-1]||0:t;function ne(t){const e=Y(t)?t.get():t;return n=e,Boolean(n&&"object"==typeof n&&n.mix&&n.toValue)?e.toValue():e;var n}const oe=t=>(e,n)=>{const i=o(p),r=o(m),s=()=>function({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},o,i,r){const s={latestValues:ie(o,i,r,t),renderState:e()};return n&&(s.mount=t=>n(o,t,s)),s}(t,e,i,r);return n?s():M(s)};function ie(t,e,n,o){const i={},r=o(t);for(const t in r)i[t]=ne(r[t]);let{initial:s,animate:a}=t;const l=S(t),u=A(t);e&&u&&!l&&!1!==t.inherit&&(void 0===s&&(s=e.initial),void 0===a&&(a=e.animate));let c=!!n&&!1===n.initial;c=c||!1===s;const d=c?a:s;if(d&&"boolean"!=typeof d&&!w(d)){(Array.isArray(d)?d:[d]).forEach(e=>{const n=Qt(t,e);if(!n)return;const{transitionEnd:o,transition:r,...s}=n;for(const t in s){let e=s[t];if(Array.isArray(e)){e=e[c?e.length-1:0]}null!==e&&(i[t]=e)}for(const t in o)i[t]=o[t]})}return i}const re={useVisualState:oe({scrapeMotionValuesFromProps:Jt,createRenderState:Wt,onMount:(t,e,{renderState:n,latestValues:o})=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(t){n.dimensions={x:0,y:0,width:0,height:0}}Ht(n,o,{enableHardwareAcceleration:!1},t.transformTemplate),Kt(e,n)}})},se={useVisualState:oe({scrapeMotionValuesFromProps:_t,createRenderState:Dt})};function ae(t,{forwardMotionProps:e=!1},n,o,i){return{...N(t)?re:se,preloadedFeatures:n,useRender:Xt(e),createVisualElement:o,projectionNodeConstructor:i,Component:t}}var le;function ue(t,e,n,o={passive:!0}){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n)}function ce(t,e,n,o){r(()=>{const i=t.current;if(n&&i)return ue(i,e,n,o)},[t,e,n,o])}function de(t){return"undefined"!=typeof PointerEvent&&t instanceof PointerEvent?!("mouse"!==t.pointerType):t instanceof MouseEvent}function he(t){return!!t.touches}!function(t){t.Animate="animate",t.Hover="whileHover",t.Tap="whileTap",t.Drag="whileDrag",t.Focus="whileFocus",t.InView="whileInView",t.Exit="exit"}(le||(le={}));const pe={pageX:0,pageY:0};function me(t,e="page"){const n=t.touches[0]||t.changedTouches[0]||pe;return{x:n[e+"X"],y:n[e+"Y"]}}function fe(t,e="page"){return{x:t[e+"X"],y:t[e+"Y"]}}function ge(t,e="page"){return{point:he(t)?me(t,e):fe(t,e)}}const ve=(t,e=!1)=>{const n=e=>t(e,ge(e));return e?(o=n,t=>{const e=t instanceof MouseEvent;(!e||e&&0===t.button)&&o(t)}):n;var o},ye={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},xe={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function be(t){return f&&null===window.onpointerdown?t:f&&null===window.ontouchstart?xe[t]:f&&null===window.onmousedown?ye[t]:t}function we(t,e,n,o){return ue(t,be(e),ve(n,"pointerdown"===e),o)}function Pe(t,e,n,o){return ce(t,be(e),n&&ve(n,"pointerdown"===e),o)}function Se(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const Ae=Se("dragHorizontal"),Te=Se("dragVertical");function Ee(t){let e=!1;if("y"===t)e=Te();else if("x"===t)e=Ae();else{const t=Ae(),n=Te();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}function Ve(){const t=Ee(!0);return!t||(t(),!1)}function Ce(t,e,n){return(o,i)=>{de(o)&&!Ve()&&(t.animationState&&t.animationState.setActive(le.Hover,e),n&&n(o,i))}}const Me=(t,e)=>!!e&&(t===e||Me(t,e.parentElement));function Re(t){return r(()=>()=>t(),[])}function Le(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(t);i<o.length;i++)e.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(t,o[i])&&(n[o[i]]=t[o[i]])}return n}const De=(t,e,n)=>Math.min(Math.max(n,t),e);function ke({duration:t=800,bounce:e=.25,velocity:n=0,mass:o=1}){let i,r,s=1-e;s=De(.05,1,s),t=De(.01,10,t/1e3),s<1?(i=e=>{const o=e*s,i=o*t;return.001-(o-n)/Oe(e,s)*Math.exp(-i)},r=e=>{const o=e*s*t,r=o*n+n,a=Math.pow(s,2)*Math.pow(e,2)*t,l=Math.exp(-o),u=Oe(Math.pow(e,2),s);return(.001-i(e)>0?-1:1)*((r-a)*l)/u}):(i=e=>Math.exp(-e*t)*((e-n)*t+1)-.001,r=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let o=n;for(let n=1;n<12;n++)o-=t(o)/e(o);return o}(i,r,5/t);if(t*=1e3,isNaN(a))return{stiffness:100,damping:10,duration:t};{const e=Math.pow(a,2)*o;return{stiffness:e,damping:2*s*Math.sqrt(o*e),duration:t}}}function Oe(t,e){return t*Math.sqrt(1-e*e)}const je=["duration","bounce"],Fe=["stiffness","damping","mass"];function Ie(t,e){return e.some(e=>void 0!==t[e])}function Ue(t){var{from:e=0,to:n=1,restSpeed:o=2,restDelta:i}=t,r=Le(t,["from","to","restSpeed","restDelta"]);const s={done:!1,value:e};let{stiffness:a,damping:l,mass:u,velocity:c,duration:d,isResolvedFromDuration:h}=function(t){let e=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},t);if(!Ie(t,Fe)&&Ie(t,je)){const n=ke(t);e=Object.assign(Object.assign(Object.assign({},e),n),{velocity:0,mass:1}),e.isResolvedFromDuration=!0}return e}(r),p=Be,m=Be;function f(){const t=c?-c/1e3:0,o=n-e,r=l/(2*Math.sqrt(a*u)),s=Math.sqrt(a/u)/1e3;if(void 0===i&&(i=Math.min(Math.abs(n-e)/100,.4)),r<1){const e=Oe(s,r);p=i=>{const a=Math.exp(-r*s*i);return n-a*((t+r*s*o)/e*Math.sin(e*i)+o*Math.cos(e*i))},m=n=>{const i=Math.exp(-r*s*n);return r*s*i*(Math.sin(e*n)*(t+r*s*o)/e+o*Math.cos(e*n))-i*(Math.cos(e*n)*(t+r*s*o)-e*o*Math.sin(e*n))}}else if(1===r)p=e=>n-Math.exp(-s*e)*(o+(t+s*o)*e);else{const e=s*Math.sqrt(r*r-1);p=i=>{const a=Math.exp(-r*s*i),l=Math.min(e*i,300);return n-a*((t+r*s*o)*Math.sinh(l)+e*o*Math.cosh(l))/e}}}return f(),{next:t=>{const e=p(t);if(h)s.done=t>=d;else{const r=1e3*m(t),a=Math.abs(r)<=o,l=Math.abs(n-e)<=i;s.done=a&&l}return s.value=s.done?n:e,s},flipTarget:()=>{c=-c,[e,n]=[n,e],f()}}}Ue.needsInterpolation=(t,e)=>"string"==typeof t||"string"==typeof e;const Be=t=>0,Ne=(t,e,n)=>{const o=e-t;return 0===o?1:(n-t)/o},$e=(t,e,n)=>-n*t+n*e+t;function ze(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function He({hue:t,saturation:e,lightness:n,alpha:o}){t/=360,n/=100;let i=0,r=0,s=0;if(e/=100){const o=n<.5?n*(1+e):n+e-n*e,a=2*n-o;i=ze(a,o,t+1/3),r=ze(a,o,t),s=ze(a,o,t-1/3)}else i=r=s=n;return{red:Math.round(255*i),green:Math.round(255*r),blue:Math.round(255*s),alpha:o}}const We=(t,e,n)=>{const o=t*t,i=e*e;return Math.sqrt(Math.max(0,n*(i-o)+o))},Ye=[yt,vt,mt],Xe=t=>Ye.find(e=>e.test(t)),Ge=(t,e)=>{let n=Xe(t),o=Xe(e),i=n.parse(t),r=o.parse(e);n===mt&&(i=He(i),n=vt),o===mt&&(r=He(r),o=vt);const s=Object.assign({},i);return t=>{for(const e in s)"alpha"!==e&&(s[e]=We(i[e],r[e],t));return s.alpha=$e(i.alpha,r.alpha,t),n.transform(s)}},qe=t=>"number"==typeof t,Ze=(t,e)=>n=>e(t(n)),Ke=(...t)=>t.reduce(Ze);function _e(t,e){return qe(t)?n=>$e(t,e,n):xt.test(t)?Ge(t,e):en(t,e)}const Je=(t,e)=>{const n=[...t],o=n.length,i=t.map((t,n)=>_e(t,e[n]));return t=>{for(let e=0;e<o;e++)n[e]=i[e](t);return n}},Qe=(t,e)=>{const n=Object.assign(Object.assign({},t),e),o={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(o[i]=_e(t[i],e[i]));return t=>{for(const e in o)n[e]=o[e](t);return n}};function tn(t){const e=At.parse(t),n=e.length;let o=0,i=0,r=0;for(let t=0;t<n;t++)o||"number"==typeof e[t]?o++:void 0!==e[t].hue?r++:i++;return{parsed:e,numNumbers:o,numRGB:i,numHSL:r}}const en=(t,e)=>{const n=At.createTransformer(e),o=tn(t),i=tn(e);return o.numHSL===i.numHSL&&o.numRGB===i.numRGB&&o.numNumbers>=i.numNumbers?Ke(Je(o.parsed,i.parsed),n):n=>""+(n>0?e:t)},nn=(t,e)=>n=>$e(t,e,n);function on(t,e,n){const o=[],i=n||("number"==typeof(r=t[0])?nn:"string"==typeof r?xt.test(r)?Ge:en:Array.isArray(r)?Je:"object"==typeof r?Qe:void 0);var r;const s=t.length-1;for(let n=0;n<s;n++){let r=i(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]:e;r=Ke(t,r)}o.push(r)}return o}function rn(t,e,{clamp:n=!0,ease:o,mixer:i}={}){const r=t.length;e.length,!o||!Array.isArray(o)||o.length,t[0]>t[r-1]&&(t=[].concat(t),e=[].concat(e),t.reverse(),e.reverse());const s=on(e,o,i),a=2===r?function([t,e],[n]){return o=>n(Ne(t,e,o))}(t,s):function(t,e){const n=t.length,o=n-1;return i=>{let r=0,s=!1;if(i<=t[0]?s=!0:i>=t[o]&&(r=o-1,s=!0),!s){let e=1;for(;e<n&&!(t[e]>i||e===o);e++);r=e-1}const a=Ne(t[r],t[r+1],i);return e[r](a)}}(t,s);return n?e=>a(De(t[0],t[r-1],e)):a}const sn=t=>e=>1-t(1-e),an=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,ln=t=>e=>e*e*((t+1)*e-t),un=t=>t,cn=(dn=2,t=>Math.pow(t,dn));var dn;const hn=sn(cn),pn=an(cn),mn=t=>1-Math.sin(Math.acos(t)),fn=sn(mn),gn=an(fn),vn=ln(1.525),yn=sn(vn),xn=an(vn),bn=(t=>{const e=ln(t);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))})(1.525),wn=t=>{if(1===t||0===t)return t;const e=t*t;return t<4/11?7.5625*e:t<8/11?9.075*e-9.9*t+3.4:t<.9?4356/361*e-35442/1805*t+16061/1805:10.8*t*t-20.52*t+10.72},Pn=sn(wn);function Sn(t,e){return t.map(()=>e||pn).splice(0,t.length-1)}function An({from:t=0,to:e=1,ease:n,offset:o,duration:i=300}){const r={done:!1,value:t},s=Array.isArray(e)?e:[t,e],a=function(t,e){return t.map(t=>t*e)}(o&&o.length===s.length?o:function(t){const e=t.length;return t.map((t,n)=>0!==n?n/(e-1):0)}(s),i);function l(){return rn(a,s,{ease:Array.isArray(n)?n:Sn(s,n)})}let u=l();return{next:t=>(r.value=u(t),r.done=t>=i,r),flipTarget:()=>{s.reverse(),u=l()}}}const Tn={keyframes:An,spring:Ue,decay:function({velocity:t=0,from:e=0,power:n=.8,timeConstant:o=350,restDelta:i=.5,modifyTarget:r}){const s={done:!1,value:e};let a=n*t;const l=e+a,u=void 0===r?l:r(l);return u!==l&&(a=u-e),{next:t=>{const e=-a*Math.exp(-t/o);return s.done=!(e>i||e<-i),s.value=s.done?u:u+e,s},flipTarget:()=>{}}}};const En="undefined"!=typeof performance?()=>performance.now():()=>Date.now(),Vn="undefined"!=typeof window?t=>window.requestAnimationFrame(t):t=>setTimeout(()=>t(En()),1/60*1e3);let Cn=!0,Mn=!1,Rn=!1;const Ln={delta:0,timestamp:0},Dn=["read","update","preRender","render","postRender"],kn=Dn.reduce((t,e)=>(t[e]=function(t){let e=[],n=[],o=0,i=!1,r=!1;const s=new WeakSet,a={schedule:(t,r=!1,a=!1)=>{const l=a&&i,u=l?e:n;return r&&s.add(t),-1===u.indexOf(t)&&(u.push(t),l&&i&&(o=e.length)),t},cancel:t=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1),s.delete(t)},process:l=>{if(i)r=!0;else{if(i=!0,[e,n]=[n,e],n.length=0,o=e.length,o)for(let n=0;n<o;n++){const o=e[n];o(l),s.has(o)&&(a.schedule(o),t())}i=!1,r&&(r=!1,a.process(l))}}};return a}(()=>Mn=!0),t),{}),On=Dn.reduce((t,e)=>{const n=kn[e];return t[e]=(t,e=!1,o=!1)=>(Mn||Bn(),n.schedule(t,e,o)),t},{}),jn=Dn.reduce((t,e)=>(t[e]=kn[e].cancel,t),{}),Fn=Dn.reduce((t,e)=>(t[e]=()=>kn[e].process(Ln),t),{}),In=t=>kn[t].process(Ln),Un=t=>{Mn=!1,Ln.delta=Cn?1/60*1e3:Math.max(Math.min(t-Ln.timestamp,40),1),Ln.timestamp=t,Rn=!0,Dn.forEach(In),Rn=!1,Mn&&(Cn=!1,Vn(Un))},Bn=()=>{Mn=!0,Cn=!0,Rn||Vn(Un)},Nn=()=>Ln;function $n(t,e,n=0){return t-e-n}const zn=t=>{const e=({delta:e})=>t(e);return{start:()=>On.update(e,!0),stop:()=>jn.update(e)}};function Hn(t){var e,n,{from:o,autoplay:i=!0,driver:r=zn,elapsed:s=0,repeat:a=0,repeatType:l="loop",repeatDelay:u=0,onPlay:c,onStop:d,onComplete:h,onRepeat:p,onUpdate:m}=t,f=Le(t,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let g,v,y,{to:x}=f,b=0,w=f.duration,P=!1,S=!0;const A=function(t){if(Array.isArray(t.to))return An;if(Tn[t.type])return Tn[t.type];const e=new Set(Object.keys(t));return e.has("ease")||e.has("duration")&&!e.has("dampingRatio")?An:e.has("dampingRatio")||e.has("stiffness")||e.has("mass")||e.has("damping")||e.has("restSpeed")||e.has("restDelta")?Ue:An}(f);(null===(n=(e=A).needsInterpolation)||void 0===n?void 0:n.call(e,o,x))&&(y=rn([0,100],[o,x],{clamp:!1}),o=0,x=100);const T=A(Object.assign(Object.assign({},f),{from:o,to:x}));function E(){b++,"reverse"===l?(S=b%2==0,s=function(t,e,n=0,o=!0){return o?$n(e+-t,e,n):e-(t-e)+n}(s,w,u,S)):(s=$n(s,w,u),"mirror"===l&&T.flipTarget()),P=!1,p&&p()}function V(t){if(S||(t=-t),s+=t,!P){const t=T.next(Math.max(0,s));v=t.value,y&&(v=y(v)),P=S?t.done:s<=0}null==m||m(v),P&&(0===b&&(null!=w||(w=s)),b<a?function(t,e,n,o){return o?t>=e+n:t<=-n}(s,w,u,S)&&E():(g.stop(),h&&h()))}return i&&(null==c||c(),g=r(V),g.start()),{stop:()=>{null==d||d(),g.stop()}}}function Wn(t,e){return e?t*(1e3/e):0}const Yn=t=>t.hasOwnProperty("x")&&t.hasOwnProperty("y"),Xn=t=>Yn(t)&&t.hasOwnProperty("z"),Gn=(t,e)=>Math.abs(t-e);function qn(t,e){if(qe(t)&&qe(e))return Gn(t,e);if(Yn(t)&&Yn(e)){const n=Gn(t.x,e.x),o=Gn(t.y,e.y),i=Xn(t)&&Xn(e)?Gn(t.z,e.z):0;return Math.sqrt(Math.pow(n,2)+Math.pow(o,2)+Math.pow(i,2))}}const Zn=(t,e)=>1-3*e+3*t,Kn=(t,e)=>3*e-6*t,_n=t=>3*t,Jn=(t,e,n)=>((Zn(e,n)*t+Kn(e,n))*t+_n(e))*t,Qn=(t,e,n)=>3*Zn(e,n)*t*t+2*Kn(e,n)*t+_n(e);function to(t,e,n,o){if(t===e&&n===o)return un;const i=new Float32Array(11);for(let e=0;e<11;++e)i[e]=Jn(.1*e,t,n);function r(e){let o=0,r=1;for(;10!==r&&i[r]<=e;++r)o+=.1;--r;const s=o+.1*((e-i[r])/(i[r+1]-i[r])),a=Qn(s,t,n);return a>=.001?function(t,e,n,o){for(let i=0;i<8;++i){const i=Qn(e,n,o);if(0===i)return e;e-=(Jn(e,n,o)-t)/i}return e}(e,s,t,n):0===a?s:function(t,e,n,o,i){let r,s,a=0;do{s=e+(n-e)/2,r=Jn(s,o,i)-t,r>0?n=s:e=s}while(Math.abs(r)>1e-7&&++a<10);return s}(e,o,o+.1,t,n)}return t=>0===t||1===t?t:Jn(r(t),e,o)}const eo=("undefined"==typeof process||process.env,"production"),no=new Set;const oo=new WeakMap,io=new WeakMap,ro=t=>{const e=oo.get(t.target);e&&e(t)},so=t=>{t.forEach(ro)};function ao(t,e,n){const o=function({root:t,...e}){const n=t||document;io.has(n)||io.set(n,{});const o=io.get(n),i=JSON.stringify(e);return o[i]||(o[i]=new IntersectionObserver(so,{root:t,...e})),o[i]}(e);return oo.set(t,n),o.observe(t),()=>{oo.delete(t),o.unobserve(t)}}const lo={some:0,all:1};function uo(t,e,n,{root:o,margin:i,amount:s="some",once:a}){r(()=>{if(!t)return;const r={root:null==o?void 0:o.current,rootMargin:i,threshold:"number"==typeof s?s:lo[s]};return ao(n.getInstance(),r,t=>{const{isIntersecting:o}=t;if(e.isInView===o)return;if(e.isInView=o,a&&!o&&e.hasEnteredView)return;o&&(e.hasEnteredView=!0),n.animationState&&n.animationState.setActive(le.InView,o);const i=n.getProps(),r=o?i.onViewportEnter:i.onViewportLeave;r&&r(t)})},[t,o,i,s])}function co(t,e,n,{fallback:o=!0}){r(()=>{var i,r;t&&o&&("production"!==eo&&(i="IntersectionObserver not available on this device. whileInView animations will trigger on mount.",!1||no.has(i)||(console.warn(i),r&&console.warn(r),no.add(i))),requestAnimationFrame(()=>{e.hasEnteredView=!0;const{onViewportEnter:t}=n.getProps();t&&t(null),n.animationState&&n.animationState.setActive(le.InView,!0)}))},[t])}const ho=t=>e=>(t(e),null),po={inView:ho((function({visualElement:t,whileInView:e,onViewportEnter:n,onViewportLeave:o,viewport:i={}}){const r=s({hasEnteredView:!1,isInView:!1});let a=Boolean(e||n||o);i.once&&r.current.hasEnteredView&&(a=!1),("undefined"==typeof IntersectionObserver?co:uo)(a,r.current,t,i)})),tap:ho((function({onTap:t,onTapStart:e,onTapCancel:n,whileTap:o,visualElement:i}){const r=t||e||n||o,a=s(!1),l=s(null),u={passive:!(e||t||n||m)};function c(){l.current&&l.current(),l.current=null}function d(){return c(),a.current=!1,i.animationState&&i.animationState.setActive(le.Tap,!1),!Ve()}function h(e,o){d()&&(Me(i.getInstance(),e.target)?t&&t(e,o):n&&n(e,o))}function p(t,e){d()&&n&&n(t,e)}function m(t,n){c(),a.current||(a.current=!0,l.current=Ke(we(window,"pointerup",h,u),we(window,"pointercancel",p,u)),i.animationState&&i.animationState.setActive(le.Tap,!0),e&&e(t,n))}Pe(i,"pointerdown",r?m:void 0,u),Re(c)})),focus:ho((function({whileFocus:t,visualElement:e}){const{animationState:n}=e;ce(e,"focus",t?()=>{n&&n.setActive(le.Focus,!0)}:void 0),ce(e,"blur",t?()=>{n&&n.setActive(le.Focus,!1)}:void 0)})),hover:ho((function({onHoverStart:t,onHoverEnd:e,whileHover:n,visualElement:o}){Pe(o,"pointerenter",t||n?Ce(o,!0,t):void 0,{passive:!t}),Pe(o,"pointerleave",e||n?Ce(o,!1,e):void 0,{passive:!e})}))};function mo(){const t=o(m);if(null===t)return[!0,null];const{isPresent:e,onExitComplete:n,register:i}=t,s=d();r(()=>i(s),[]);return!e&&n?[!1,()=>n&&n(s)]:[!0]}function fo(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let o=0;o<n;o++)if(e[o]!==t[o])return!1;return!0}const go=t=>1e3*t,vo={linear:un,easeIn:cn,easeInOut:pn,easeOut:hn,circIn:mn,circInOut:gn,circOut:fn,backIn:vn,backInOut:xn,backOut:yn,anticipate:bn,bounceIn:Pn,bounceInOut:t=>t<.5?.5*(1-wn(1-2*t)):.5*wn(2*t-1)+.5,bounceOut:wn},yo=t=>{if(Array.isArray(t)){t.length;const[e,n,o,i]=t;return to(e,n,o,i)}return"string"==typeof t?vo[t]:t},xo=(t,e)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!At.test(e)||e.startsWith("url("))),bo=()=>({type:"spring",stiffness:500,damping:25,restSpeed:10}),wo=t=>({type:"spring",stiffness:550,damping:0===t?2*Math.sqrt(550):30,restSpeed:10}),Po=()=>({type:"keyframes",ease:"linear",duration:.3}),So=t=>({type:"keyframes",duration:.8,values:t}),Ao={x:bo,y:bo,z:bo,rotate:bo,rotateX:bo,rotateY:bo,rotateZ:bo,scaleX:wo,scaleY:wo,scale:wo,opacity:Po,backgroundColor:Po,color:Po,default:wo},To=(t,e)=>{let n;return n=te(e)?So:Ao[t]||Ao.default,{to:e,...n(e)}},Eo={...Rt,color:xt,backgroundColor:xt,outlineColor:xt,fill:xt,stroke:xt,borderColor:xt,borderTopColor:xt,borderRightColor:xt,borderBottomColor:xt,borderLeftColor:xt,filter:Ct,WebkitFilter:Ct},Vo=t=>Eo[t];function Co(t,e){var n;let o=Vo(t);return o!==Ct&&(o=At),null===(n=o.getAnimatableNone)||void 0===n?void 0:n.call(o,e)}const Mo=!1;function Ro({ease:t,times:e,yoyo:n,flip:o,loop:i,...r}){const s={...r};return e&&(s.offset=e),r.duration&&(s.duration=go(r.duration)),r.repeatDelay&&(s.repeatDelay=go(r.repeatDelay)),t&&(s.ease=(t=>Array.isArray(t)&&"number"!=typeof t[0])(t)?t.map(yo):yo(t)),"tween"===r.type&&(s.type="keyframes"),(n||i||o)&&(n?s.repeatType="reverse":i?s.repeatType="loop":o&&(s.repeatType="mirror"),s.repeat=i||n||o||r.repeat),"spring"!==r.type&&(s.type="keyframes"),s}function Lo(t,e,n){return Array.isArray(e.to)&&void 0===t.duration&&(t.duration=.8),function(t){Array.isArray(t.to)&&null===t.to[0]&&(t.to=[...t.to],t.to[0]=t.from)}(e),function({when:t,delay:e,delayChildren:n,staggerChildren:o,staggerDirection:i,repeat:r,repeatType:s,repeatDelay:a,from:l,...u}){return!!Object.keys(u).length}(t)||(t={...t,...To(n,e.to)}),{...e,...Ro(t)}}function Do(t,e,n,o,i){const r=jo(o,t)||{};let s=void 0!==r.from?r.from:e.get();const a=xo(t,n);"none"===s&&a&&"string"==typeof n?s=Co(t,n):ko(s)&&"string"==typeof n?s=Oo(n):!Array.isArray(n)&&ko(n)&&"string"==typeof s&&(n=Oo(s));return xo(t,s)&&a&&!1!==r.type?function(){const o={from:s,to:n,velocity:e.getVelocity(),onComplete:i,onUpdate:t=>e.set(t)};return"inertia"===r.type||"decay"===r.type?function({from:t=0,velocity:e=0,min:n,max:o,power:i=.8,timeConstant:r=750,bounceStiffness:s=500,bounceDamping:a=10,restDelta:l=1,modifyTarget:u,driver:c,onUpdate:d,onComplete:h,onStop:p}){let m;function f(t){return void 0!==n&&t<n||void 0!==o&&t>o}function g(t){return void 0===n?o:void 0===o||Math.abs(n-t)<Math.abs(o-t)?n:o}function v(t){null==m||m.stop(),m=Hn(Object.assign(Object.assign({},t),{driver:c,onUpdate:e=>{var n;null==d||d(e),null===(n=t.onUpdate)||void 0===n||n.call(t,e)},onComplete:h,onStop:p}))}function y(t){v(Object.assign({type:"spring",stiffness:s,damping:a,restDelta:l},t))}if(f(t))y({from:t,velocity:e,to:g(t)});else{let o=i*e+t;void 0!==u&&(o=u(o));const s=g(o),a=s===n?-1:1;let c,d;const h=t=>{c=d,d=t,e=Wn(t-c,Nn().delta),(1===a&&t>s||-1===a&&t<s)&&y({from:t,to:s,velocity:e})};v({type:"decay",from:t,velocity:e,timeConstant:r,power:i,restDelta:l,modifyTarget:u,onUpdate:f(o)?h:void 0})}return{stop:()=>null==m?void 0:m.stop()}}({...o,...r}):Hn({...Lo(r,o,t),onUpdate:t=>{o.onUpdate(t),r.onUpdate&&r.onUpdate(t)},onComplete:()=>{o.onComplete(),r.onComplete&&r.onComplete()}})}:function(){const t=ee(n);return e.set(t),i(),r.onUpdate&&r.onUpdate(t),r.onComplete&&r.onComplete(),{stop:()=>{}}}}function ko(t){return 0===t||"string"==typeof t&&0===parseFloat(t)&&-1===t.indexOf(" ")}function Oo(t){return"number"==typeof t?0:Co("",t)}function jo(t,e){return t[e]||t.default||t}function Fo(t,e,n,o={}){return Mo&&(o={type:!1}),e.start(i=>{let r,s;const a=Do(t,e,n,o,i),l=function(t,e){var n,o;return null!==(o=null!==(n=(jo(t,e)||{}).delay)&&void 0!==n?n:t.delay)&&void 0!==o?o:0}(o,t),u=()=>s=a();return l?r=window.setTimeout(u,go(l)):u(),()=>{clearTimeout(r),s&&s.stop()}})}const Io=t=>/^0[^.\s]+$/.test(t);function Uo(t,e){-1===t.indexOf(e)&&t.push(e)}function Bo(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class No{constructor(){this.subscriptions=[]}add(t){return Uo(this.subscriptions,t),()=>Bo(this.subscriptions,t)}notify(t,e,n){const o=this.subscriptions.length;if(o)if(1===o)this.subscriptions[0](t,e,n);else for(let i=0;i<o;i++){const o=this.subscriptions[i];o&&o(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}class $o{constructor(t){var e;this.version="7.3.2",this.timeDelta=0,this.lastUpdated=0,this.updateSubscribers=new No,this.velocityUpdateSubscribers=new No,this.renderSubscribers=new No,this.canTrackVelocity=!1,this.updateAndNotify=(t,e=!0)=>{this.prev=this.current,this.current=t;const{delta:n,timestamp:o}=Nn();this.lastUpdated!==o&&(this.timeDelta=n,this.lastUpdated=o,On.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.updateSubscribers.notify(this.current),this.velocityUpdateSubscribers.getSize()&&this.velocityUpdateSubscribers.notify(this.getVelocity()),e&&this.renderSubscribers.notify(this.current)},this.scheduleVelocityCheck=()=>On.postRender(this.velocityCheck),this.velocityCheck=({timestamp:t})=>{t!==this.lastUpdated&&(this.prev=this.current,this.velocityUpdateSubscribers.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e)))}onChange(t){return this.updateSubscribers.add(t)}clearListeners(){this.updateSubscribers.clear()}onRenderRequest(t){return t(this.get()),this.renderSubscribers.add(t)}attach(t){this.passiveEffect=t}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?Wn(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.stopAnimation=t(e)}).then(()=>this.clearAnimation())}stop(){this.stopAnimation&&this.stopAnimation(),this.clearAnimation()}isAnimating(){return!!this.stopAnimation}clearAnimation(){this.stopAnimation=null}destroy(){this.updateSubscribers.clear(),this.renderSubscribers.clear(),this.stop()}}function zo(t){return new $o(t)}const Ho=t=>e=>e.test(t),Wo=[nt,lt,at,st,ct,ut,{test:t=>"auto"===t,parse:t=>t}],Yo=t=>Wo.find(Ho(t)),Xo=[...Wo,xt,At],Go=t=>Xo.find(Ho(t));function qo(t,e,n){const o=t.getProps();return Qt(o,e,void 0!==n?n:o.custom,function(t){const e={};return t.forEachValue((t,n)=>e[n]=t.get()),e}(t),function(t){const e={};return t.forEachValue((t,n)=>e[n]=t.getVelocity()),e}(t))}function Zo(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,zo(n))}function Ko(t,e){if(!e)return;return(e[t]||e.default||e).from}function _o(t){return Boolean(Y(t)&&t.add)}function Jo(t,e,n={}){var o;const i=qo(t,e,n.custom);let{transition:r=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(r=n.transitionOverride);const s=i?()=>Qo(t,i,n):()=>Promise.resolve(),a=(null===(o=t.variantChildren)||void 0===o?void 0:o.size)?(o=0)=>{const{delayChildren:i=0,staggerChildren:s,staggerDirection:a}=r;return function(t,e,n=0,o=0,i=1,r){const s=[],a=(t.variantChildren.size-1)*o,l=1===i?(t=0)=>t*o:(t=0)=>a-t*o;return Array.from(t.variantChildren).sort(ti).forEach((t,o)=>{s.push(Jo(t,e,{...r,delay:n+l(o)}).then(()=>t.notifyAnimationComplete(e)))}),Promise.all(s)}(t,e,i+o,s,a,n)}:()=>Promise.resolve(),{when:l}=r;if(l){const[t,e]="beforeChildren"===l?[s,a]:[a,s];return t().then(e)}return Promise.all([s(),a(n.delay)])}function Qo(t,e,{delay:n=0,transitionOverride:o,type:i}={}){var r;let{transition:s=t.getDefaultTransition(),transitionEnd:a,...l}=t.makeTargetAnimatable(e);const u=t.getValue("willChange");o&&(s=o);const c=[],d=i&&(null===(r=t.animationState)||void 0===r?void 0:r.getState()[i]);for(const e in l){const o=t.getValue(e),i=l[e];if(!o||void 0===i||d&&ei(d,e))continue;let r={delay:n,...s};t.shouldReduceMotion&&H.has(e)&&(r={...r,type:!1,delay:0});let a=Fo(e,o,i,r);_o(u)&&(u.add(e),a=a.then(()=>u.remove(e))),c.push(a)}return Promise.all(c).then(()=>{a&&function(t,e){const n=qo(t,e);let{transitionEnd:o={},transition:i={},...r}=n?t.makeTargetAnimatable(n,!1):{};r={...r,...o};for(const e in r){Zo(t,e,ee(r[e]))}}(t,a)})}function ti(t,e){return t.sortNodePosition(e)}function ei({protectedKeys:t,needsAnimating:e},n){const o=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,o}const ni=[le.Animate,le.InView,le.Focus,le.Hover,le.Tap,le.Drag,le.Exit],oi=[...ni].reverse(),ii=ni.length;function ri(t){return e=>Promise.all(e.map(({animation:e,options:n})=>function(t,e,n={}){let o;if(t.notifyAnimationStart(e),Array.isArray(e)){const i=e.map(e=>Jo(t,e,n));o=Promise.all(i)}else if("string"==typeof e)o=Jo(t,e,n);else{const i="function"==typeof e?qo(t,e,n.custom):e;o=Qo(t,i,n)}return o.then(()=>t.notifyAnimationComplete(e))}(t,e,n)))}function si(t){let e=ri(t);const n={[le.Animate]:li(!0),[le.InView]:li(),[le.Hover]:li(),[le.Tap]:li(),[le.Drag]:li(),[le.Focus]:li(),[le.Exit]:li()};let o=!0;const i=(e,n)=>{const o=qo(t,n);if(o){const{transition:t,transitionEnd:n,...i}=o;e={...e,...i,...n}}return e};function r(r,s){var a;const l=t.getProps(),u=t.getVariantContext(!0)||{},c=[],d=new Set;let h={},p=1/0;for(let e=0;e<ii;e++){const m=oi[e],f=n[m],g=null!==(a=l[m])&&void 0!==a?a:u[m],v=b(g),y=m===s?f.isActive:null;!1===y&&(p=e);let x=g===u[m]&&g!==l[m]&&v;if(x&&o&&t.manuallyAnimateOnMount&&(x=!1),f.protectedKeys={...h},!f.isActive&&null===y||!g&&!f.prevProp||w(g)||"boolean"==typeof g)continue;const P=ai(f.prevProp,g);let S=P||m===s&&f.isActive&&!x&&v||e>p&&v;const A=Array.isArray(g)?g:[g];let T=A.reduce(i,{});!1===y&&(T={});const{prevResolvedValues:E={}}=f,V={...E,...T},C=t=>{S=!0,d.delete(t),f.needsAnimating[t]=!0};for(const t in V){const e=T[t],n=E[t];h.hasOwnProperty(t)||(e!==n?te(e)&&te(n)?!fo(e,n)||P?C(t):f.protectedKeys[t]=!0:void 0!==e?C(t):d.add(t):void 0!==e&&d.has(t)?C(t):f.protectedKeys[t]=!0)}f.prevProp=g,f.prevResolvedValues=T,f.isActive&&(h={...h,...T}),o&&t.blockInitialAnimation&&(S=!1),S&&!x&&c.push(...A.map(t=>({animation:t,options:{type:m,...r}})))}if(d.size){const e={};d.forEach(n=>{const o=t.getBaseTarget(n);void 0!==o&&(e[n]=o)}),c.push({animation:e})}let m=Boolean(c.length);return o&&!1===l.initial&&!t.manuallyAnimateOnMount&&(m=!1),o=!1,m?e(c):Promise.resolve()}return{animateChanges:r,setActive:function(e,o,i){var s;if(n[e].isActive===o)return Promise.resolve();null===(s=t.variantChildren)||void 0===s||s.forEach(t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,o)}),n[e].isActive=o;const a=r(i,e);for(const t in n)n[t].protectedKeys={};return a},setAnimateFunction:function(n){e=n(t)},getState:()=>n}}function ai(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!fo(e,t)}function li(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}const ui={animation:ho(({visualElement:t,animate:e})=>{t.animationState||(t.animationState=si(t)),w(e)&&r(()=>e.subscribe(t),[e])}),exit:ho(t=>{const{custom:e,visualElement:n}=t,[i,s]=mo(),a=o(m);r(()=>{n.isPresent=i;const t=n.animationState&&n.animationState.setActive(le.Exit,!i,{custom:a&&a.custom||e});t&&!i&&t.then(s)},[i])})};class ci{constructor(t,e,{transformPagePoint:n}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=pi(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,n=qn(t.offset,{x:0,y:0})>=3;if(!e&&!n)return;const{point:o}=t,{timestamp:i}=Nn();this.history.push({...o,timestamp:i});const{onStart:r,onMove:s}=this.handlers;e||(r&&r(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),s&&s(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=di(e,this.transformPagePoint),de(t)&&0===t.buttons?this.handlePointerUp(t,e):On.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:n,onSessionEnd:o}=this.handlers,i=pi(di(e,this.transformPagePoint),this.history);this.startEvent&&n&&n(t,i),o&&o(t,i)},he(t)&&t.touches.length>1)return;this.handlers=e,this.transformPagePoint=n;const o=di(ge(t),this.transformPagePoint),{point:i}=o,{timestamp:r}=Nn();this.history=[{...i,timestamp:r}];const{onSessionStart:s}=e;s&&s(t,pi(o,this.history)),this.removeListeners=Ke(we(window,"pointermove",this.handlePointerMove),we(window,"pointerup",this.handlePointerUp),we(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),jn.update(this.updatePoint)}}function di(t,e){return e?{point:e(t.point)}:t}function hi(t,e){return{x:t.x-e.x,y:t.y-e.y}}function pi({point:t},e){return{point:t,delta:hi(t,fi(e)),offset:hi(t,mi(e)),velocity:gi(e,.1)}}function mi(t){return t[0]}function fi(t){return t[t.length-1]}function gi(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,o=null;const i=fi(t);for(;n>=0&&(o=t[n],!(i.timestamp-o.timestamp>go(e)));)n--;if(!o)return{x:0,y:0};const r=(i.timestamp-o.timestamp)/1e3;if(0===r)return{x:0,y:0};const s={x:(i.x-o.x)/r,y:(i.y-o.y)/r};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function vi(t){return t.max-t.min}function yi(t,e=0,n=.01){return qn(t,e)<n}function xi(t,e,n,o=.5){t.origin=o,t.originPoint=$e(e.min,e.max,t.origin),t.scale=vi(n)/vi(e),(yi(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=$e(n.min,n.max,t.origin)-t.originPoint,(yi(t.translate)||isNaN(t.translate))&&(t.translate=0)}function bi(t,e,n,o){xi(t.x,e.x,n.x,null==o?void 0:o.originX),xi(t.y,e.y,n.y,null==o?void 0:o.originY)}function wi(t,e,n){t.min=n.min+e.min,t.max=t.min+vi(e)}function Pi(t,e,n){t.min=e.min-n.min,t.max=t.min+vi(e)}function Si(t,e,n){Pi(t.x,e.x,n.x),Pi(t.y,e.y,n.y)}function Ai(t,e,n){return{min:void 0!==e?t.min+e:void 0,max:void 0!==n?t.max+n-(t.max-t.min):void 0}}function Ti(t,e){let n=e.min-t.min,o=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,o]=[o,n]),{min:n,max:o}}const Ei=.35;function Vi(t,e,n){return{min:Ci(t,e),max:Ci(t,n)}}function Ci(t,e){var n;return"number"==typeof t?t:null!==(n=t[e])&&void 0!==n?n:0}function Mi(t){return[t("x"),t("y")]}function Ri({top:t,left:e,right:n,bottom:o}){return{x:{min:e,max:n},y:{min:t,max:o}}}function Li(t){return void 0===t||1===t}function Di({scale:t,scaleX:e,scaleY:n}){return!Li(t)||!Li(e)||!Li(n)}function ki(t){return Di(t)||Oi(t.x)||Oi(t.y)||t.z||t.rotate||t.rotateX||t.rotateY}function Oi(t){return t&&"0%"!==t}function ji(t,e,n){return n+e*(t-n)}function Fi(t,e,n,o,i){return void 0!==i&&(t=ji(t,i,o)),ji(t,n,o)+e}function Ii(t,e=0,n=1,o,i){t.min=Fi(t.min,e,n,o,i),t.max=Fi(t.max,e,n,o,i)}function Ui(t,{x:e,y:n}){Ii(t.x,e.translate,e.scale,e.originPoint),Ii(t.y,n.translate,n.scale,n.originPoint)}function Bi(t,e){t.min=t.min+e,t.max=t.max+e}function Ni(t,e,[n,o,i]){const r=void 0!==e[i]?e[i]:.5,s=$e(t.min,t.max,r);Ii(t,e[n],e[o],s,e.scale)}const $i=["x","scaleX","originX"],zi=["y","scaleY","originY"];function Hi(t,e){Ni(t.x,e,$i),Ni(t.y,e,zi)}function Wi(t,e){return Ri(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),o=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:o.y,right:o.x}}(t.getBoundingClientRect(),e))}const Yi=new WeakMap;class Xi{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.visualElement=t}start(t,{snapToCursor:e=!1}={}){if(!1===this.visualElement.isPresent)return;this.panSession=new ci(t,{onSessionStart:t=>{this.stopAnimation(),e&&this.snapToCursor(ge(t,"page").point)},onStart:(t,e)=>{var n;const{drag:o,dragPropagation:i,onDragStart:r}=this.getProps();(!o||i||(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Ee(o),this.openGlobalLock))&&(this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Mi(t=>{var e,n;let o=this.getAxisMotionValue(t).get()||0;if(at.test(o)){const i=null===(n=null===(e=this.visualElement.projection)||void 0===e?void 0:e.layout)||void 0===n?void 0:n.actual[t];if(i){o=vi(i)*(parseFloat(o)/100)}}this.originPoint[t]=o}),null==r||r(t,e),null===(n=this.visualElement.animationState)||void 0===n||n.setActive(le.Drag,!0))},onMove:(t,e)=>{const{dragPropagation:n,dragDirectionLock:o,onDirectionLock:i,onDrag:r}=this.getProps();if(!n&&!this.openGlobalLock)return;const{offset:s}=e;if(o&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let n=null;Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x");return n}(s),void(null!==this.currentDirection&&(null==i||i(this.currentDirection)));this.updateAxis("x",e.point,s),this.updateAxis("y",e.point,s),this.visualElement.syncRender(),null==r||r(t,e)},onSessionEnd:(t,e)=>this.stop(t,e)},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,e){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:o}=e;this.startAnimation(o);const{onDragEnd:i}=this.getProps();null==i||i(t,e)}cancel(){var t,e;this.isDragging=!1,this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!1),null===(t=this.panSession)||void 0===t||t.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),null===(e=this.visualElement.animationState)||void 0===e||e.setActive(le.Drag,!1)}updateAxis(t,e,n){const{drag:o}=this.getProps();if(!n||!Gi(t,o,this.currentDirection))return;const i=this.getAxisMotionValue(t);let r=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(r=function(t,{min:e,max:n},o){return void 0!==e&&t<e?t=o?$e(e,t,o.min):Math.max(t,e):void 0!==n&&t>n&&(t=o?$e(n,t,o.max):Math.min(t,n)),t}(r,this.constraints[t],this.elastic[t])),i.set(r)}resolveConstraints(){const{dragConstraints:t,dragElastic:e}=this.getProps(),{layout:n}=this.visualElement.projection||{},o=this.constraints;t&&x(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!n)&&function(t,{top:e,left:n,bottom:o,right:i}){return{x:Ai(t.x,n,i),y:Ai(t.y,e,o)}}(n.actual,t),this.elastic=function(t=Ei){return!1===t?t=0:!0===t&&(t=Ei),{x:Vi(t,"left","right"),y:Vi(t,"top","bottom")}}(e),o!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&Mi(t=>{this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const n={};return void 0!==e.min&&(n.min=e.min-t.min),void 0!==e.max&&(n.max=e.max-t.min),n}(n.actual[t],this.constraints[t]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!x(t))return!1;const n=t.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const i=function(t,e,n){const o=Wi(t,n),{scroll:i}=e;return i&&(Bi(o.x,i.x),Bi(o.y,i.y)),o}(n,o.root,this.visualElement.getTransformPagePoint());let r=function(t,e){return{x:Ti(t.x,e.x),y:Ti(t.y,e.y)}}(o.layout.actual,i);if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(r));this.hasMutatedConstraints=!!t,t&&(r=Ri(t))}return r}startAnimation(t){const{drag:e,dragMomentum:n,dragElastic:o,dragTransition:i,dragSnapToOrigin:r,onDragTransitionEnd:s}=this.getProps(),a=this.constraints||{},l=Mi(s=>{var l;if(!Gi(s,e,this.currentDirection))return;let u=null!==(l=null==a?void 0:a[s])&&void 0!==l?l:{};r&&(u={min:0,max:0});const c=o?200:1e6,d=o?40:1e7,h={type:"inertia",velocity:n?t[s]:0,bounceStiffness:c,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...i,...u};return this.startAxisValueAnimation(s,h)});return Promise.all(l).then(s)}startAxisValueAnimation(t,e){return Fo(t,this.getAxisMotionValue(t),0,e)}stopAnimation(){Mi(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){var e,n;const o="_drag"+t.toUpperCase(),i=this.visualElement.getProps