UNPKG

framer-motion

Version:

A simple and powerful React animation library

1 lines • 113 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Motion={},t.React)}(this,(function(t,e){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function r(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var o=r(e),i=n(e),a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var u=function(){return(u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function l(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}function c(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function f(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}var d=function(t){return{isEnabled:function(e){return t.some((function(t){return!!e[t]}))}}},p={measureLayout:d(["layout","layoutId","drag"]),animation:d(["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"]),exit:d(["exit"]),drag:d(["drag","dragControls"]),focus:d(["whileFocus"]),hover:d(["whileHover","onHoverStart","onHoverEnd"]),tap:d(["whileTap","onTap","onTapStart","onTapCancel"]),pan:d(["onPan","onPanStart","onPanSessionStart","onPanEnd"]),inView:d(["whileInView","onViewportEnter","onViewportLeave"])};function v(t){for(var e in t)null!==t[e]&&("projectionNodeConstructor"===e?p.projectionNodeConstructor=t[e]:p[e].Component=t[e])}var h=e.createContext({strict:!1}),m=Object.keys(p),y=m.length;var g=e.createContext({transformPagePoint:function(t){return t},isStatic:!1,reducedMotion:"never"}),x=e.createContext({});function b(){return e.useContext(x).visualElement}var E=e.createContext(null),w="undefined"!=typeof document,P=w?e.useLayoutEffect:e.useEffect,A={current:null},T=!1;function S(){return!T&&function(){if(T=!0,w)if(window.matchMedia){var t=window.matchMedia("(prefers-reduced-motion)"),e=function(){return A.current=t.matches};t.addListener(e),e()}else A.current=!1}(),c(e.useState(A.current),1)[0]}function V(){var t=S(),n=e.useContext(g).reducedMotion;return"never"!==n&&("always"===n||t)}function C(t){return"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}function M(t){return Array.isArray(t)}function R(t){return"string"==typeof t||M(t)}function L(t,e,n,r,o){var i;return void 0===r&&(r={}),void 0===o&&(o={}),"function"==typeof e&&(e=e(null!=n?n:t.custom,r,o)),"string"==typeof e&&(e=null===(i=t.variants)||void 0===i?void 0:i[e]),"function"==typeof e&&(e=e(null!=n?n:t.custom,r,o)),e}function O(t,e,n){var r=t.getProps();return L(r,e,null!=n?n:r.custom,function(t){var e={};return t.forEachValue((function(t,n){return e[n]=t.get()})),e}(t),function(t){var e={};return t.forEachValue((function(t,n){return e[n]=t.getVelocity()})),e}(t))}function D(t){var e;return"function"==typeof(null===(e=t.animate)||void 0===e?void 0:e.start)||R(t.initial)||R(t.animate)||R(t.whileHover)||R(t.whileDrag)||R(t.whileTap)||R(t.whileFocus)||R(t.exit)}function k(t){return Boolean(D(t)||t.variants)}function j(t){var n=function(t,e){if(D(t)){var n=t.initial,r=t.animate;return{initial:!1===n||R(n)?n:void 0,animate:R(r)?r:void 0}}return!1!==t.inherit?e:{}}(t,e.useContext(x)),r=n.initial,o=n.animate;return e.useMemo((function(){return{initial:r,animate:o}}),[F(r),F(o)])}function F(t){return Array.isArray(t)?t.join(" "):t}function I(t){var n=e.useRef(null);return null===n.current&&(n.current=t()),n.current}const U="undefined"!=typeof performance?()=>performance.now():()=>Date.now(),B="undefined"!=typeof window?t=>window.requestAnimationFrame(t):t=>setTimeout(()=>t(U()),1/60*1e3);let N=!0,z=!1,H=!1;const X={delta:0,timestamp:0},Y=["read","update","preRender","render","postRender"],W=Y.reduce((t,e)=>(t[e]=function(t){let e=[],n=[],r=0,o=!1,i=!1;const a=new WeakSet,s={schedule:(t,i=!1,s=!1)=>{const u=s&&o,l=u?e:n;return i&&a.add(t),-1===l.indexOf(t)&&(l.push(t),u&&o&&(r=e.length)),t},cancel:t=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1),a.delete(t)},process:u=>{if(o)i=!0;else{if(o=!0,[e,n]=[n,e],n.length=0,r=e.length,r)for(let n=0;n<r;n++){const r=e[n];r(u),a.has(r)&&(s.schedule(r),t())}o=!1,i&&(i=!1,s.process(u))}}};return s}(()=>z=!0),t),{}),G=Y.reduce((t,e)=>{const n=W[e];return t[e]=(t,e=!1,r=!1)=>(z||K(),n.schedule(t,e,r)),t},{}),_=Y.reduce((t,e)=>(t[e]=W[e].cancel,t),{}),q=Y.reduce((t,e)=>(t[e]=()=>W[e].process(X),t),{}),$=t=>W[t].process(X),Z=t=>{z=!1,X.delta=N?1/60*1e3:Math.max(Math.min(t-X.timestamp,40),1),X.timestamp=t,H=!0,Y.forEach($),H=!1,z&&(N=!1,B(Z))},K=()=>{z=!0,N=!0,H||B(Z)},J=()=>X,Q=(t,e,n)=>Math.min(Math.max(n,t),e);function tt({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,i,a=1-e;a=Q(.05,1,a),t=Q(.01,10,t/1e3),a<1?(o=e=>{const r=e*a,o=r*t;return.001-(r-n)/et(e,a)*Math.exp(-o)},i=e=>{const r=e*a*t,i=r*n+n,s=Math.pow(a,2)*Math.pow(e,2)*t,u=Math.exp(-r),l=et(Math.pow(e,2),a);return(.001-o(e)>0?-1:1)*((i-s)*u)/l}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-.001,i=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let n=1;n<12;n++)r-=t(r)/e(r);return r}(o,i,5/t);if(t*=1e3,isNaN(s))return{stiffness:100,damping:10,duration:t};{const e=Math.pow(s,2)*r;return{stiffness:e,damping:2*a*Math.sqrt(r*e),duration:t}}}function et(t,e){return t*Math.sqrt(1-e*e)}const nt=["duration","bounce"],rt=["stiffness","damping","mass"];function ot(t,e){return e.some(e=>void 0!==t[e])}function it(t){var{from:e=0,to:n=1,restSpeed:r=2,restDelta:o}=t,i=l(t,["from","to","restSpeed","restDelta"]);const a={done:!1,value:e};let{stiffness:s,damping:u,mass:c,velocity:f,duration:d,isResolvedFromDuration:p}=function(t){let e=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},t);if(!ot(t,rt)&&ot(t,nt)){const n=tt(t);e=Object.assign(Object.assign(Object.assign({},e),n),{velocity:0,mass:1}),e.isResolvedFromDuration=!0}return e}(i),v=at,h=at;function m(){const t=f?-f/1e3:0,r=n-e,i=u/(2*Math.sqrt(s*c)),a=Math.sqrt(s/c)/1e3;if(void 0===o&&(o=Math.min(Math.abs(n-e)/100,.4)),i<1){const e=et(a,i);v=o=>{const s=Math.exp(-i*a*o);return n-s*((t+i*a*r)/e*Math.sin(e*o)+r*Math.cos(e*o))},h=n=>{const o=Math.exp(-i*a*n);return i*a*o*(Math.sin(e*n)*(t+i*a*r)/e+r*Math.cos(e*n))-o*(Math.cos(e*n)*(t+i*a*r)-e*r*Math.sin(e*n))}}else if(1===i)v=e=>n-Math.exp(-a*e)*(r+(t+a*r)*e);else{const e=a*Math.sqrt(i*i-1);v=o=>{const s=Math.exp(-i*a*o),u=Math.min(e*o,300);return n-s*((t+i*a*r)*Math.sinh(u)+e*r*Math.cosh(u))/e}}}return m(),{next:t=>{const e=v(t);if(p)a.done=t>=d;else{const i=1e3*h(t),s=Math.abs(i)<=r,u=Math.abs(n-e)<=o;a.done=s&&u}return a.value=a.done?n:e,a},flipTarget:()=>{f=-f,[e,n]=[n,e],m()}}}it.needsInterpolation=(t,e)=>"string"==typeof t||"string"==typeof e;const at=t=>0,st=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},ut=(t,e,n)=>-n*t+n*e+t,lt=(t,e)=>n=>Math.max(Math.min(n,e),t),ct=t=>t%1?Number(t.toFixed(5)):t,ft=/(-)?([\d]*\.?[\d])+/g,dt=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,pt=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;function vt(t){return"string"==typeof t}const ht={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},mt=Object.assign(Object.assign({},ht),{transform:lt(0,1)}),yt=Object.assign(Object.assign({},ht),{default:1}),gt=t=>({test:e=>vt(e)&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),xt=gt("deg"),bt=gt("%"),Et=gt("px"),wt=gt("vh"),Pt=gt("vw"),At=Object.assign(Object.assign({},bt),{parse:t=>bt.parse(t)/100,transform:t=>bt.transform(100*t)}),Tt=(t,e)=>n=>Boolean(vt(n)&&pt.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),St=(t,e,n)=>r=>{if(!vt(r))return r;const[o,i,a,s]=r.match(ft);return{[t]:parseFloat(o),[e]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},Vt={test:Tt("hsl","hue"),parse:St("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+bt.transform(ct(e))+", "+bt.transform(ct(n))+", "+ct(mt.transform(r))+")"},Ct=lt(0,255),Mt=Object.assign(Object.assign({},ht),{transform:t=>Math.round(Ct(t))}),Rt={test:Tt("rgb","red"),parse:St("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Mt.transform(t)+", "+Mt.transform(e)+", "+Mt.transform(n)+", "+ct(mt.transform(r))+")"};const Lt={test:Tt("#"),parse:function(t){let e="",n="",r="",o="";return t.length>5?(e=t.substr(1,2),n=t.substr(3,2),r=t.substr(5,2),o=t.substr(7,2)):(e=t.substr(1,1),n=t.substr(2,1),r=t.substr(3,1),o=t.substr(4,1),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}},transform:Rt.transform},Ot={test:t=>Rt.test(t)||Lt.test(t)||Vt.test(t),parse:t=>Rt.test(t)?Rt.parse(t):Vt.test(t)?Vt.parse(t):Lt.parse(t),transform:t=>vt(t)?t:t.hasOwnProperty("red")?Rt.transform(t):Vt.transform(t)};function Dt(t){"number"==typeof t&&(t=""+t);const e=[];let n=0;const r=t.match(dt);r&&(n=r.length,t=t.replace(dt,"${c}"),e.push(...r.map(Ot.parse)));const o=t.match(ft);return o&&(t=t.replace(ft,"${n}"),e.push(...o.map(ht.parse))),{values:e,numColors:n,tokenised:t}}function kt(t){return Dt(t).values}function jt(t){const{values:e,numColors:n,tokenised:r}=Dt(t),o=e.length;return t=>{let e=r;for(let r=0;r<o;r++)e=e.replace(r<n?"${c}":"${n}",r<n?Ot.transform(t[r]):ct(t[r]));return e}}const Ft=t=>"number"==typeof t?0:t;const It={test:function(t){var e,n,r,o;return isNaN(t)&&vt(t)&&(null!==(n=null===(e=t.match(ft))||void 0===e?void 0:e.length)&&void 0!==n?n:0)+(null!==(o=null===(r=t.match(dt))||void 0===r?void 0:r.length)&&void 0!==o?o:0)>0},parse:kt,createTransformer:jt,getAnimatableNone:function(t){const e=kt(t);return jt(t)(e.map(Ft))}},Ut=new Set(["brightness","contrast","saturate","opacity"]);function Bt(t){let[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(ft)||[];if(!r)return t;const o=n.replace(r,"");let i=Ut.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+o+")"}const Nt=/([a-z-]*)\(.*?\)/g,zt=Object.assign(Object.assign({},It),{getAnimatableNone:t=>{const e=t.match(Nt);return e?e.map(Bt).join(" "):t}});function Ht(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 Xt({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let o=0,i=0,a=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,s=2*n-r;o=Ht(s,r,t+1/3),i=Ht(s,r,t),a=Ht(s,r,t-1/3)}else o=i=a=n;return{red:Math.round(255*o),green:Math.round(255*i),blue:Math.round(255*a),alpha:r}}const Yt=(t,e,n)=>{const r=t*t,o=e*e;return Math.sqrt(Math.max(0,n*(o-r)+r))},Wt=[Lt,Rt,Vt],Gt=t=>Wt.find(e=>e.test(t)),_t=(t,e)=>{let n=Gt(t),r=Gt(e),o=n.parse(t),i=r.parse(e);n===Vt&&(o=Xt(o),n=Rt),r===Vt&&(i=Xt(i),r=Rt);const a=Object.assign({},o);return t=>{for(const e in a)"alpha"!==e&&(a[e]=Yt(o[e],i[e],t));return a.alpha=ut(o.alpha,i.alpha,t),n.transform(a)}},qt=t=>"number"==typeof t,$t=(t,e)=>n=>e(t(n)),Zt=(...t)=>t.reduce($t);function Kt(t,e){return qt(t)?n=>ut(t,e,n):Ot.test(t)?_t(t,e):ee(t,e)}const Jt=(t,e)=>{const n=[...t],r=n.length,o=t.map((t,n)=>Kt(t,e[n]));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}},Qt=(t,e)=>{const n=Object.assign(Object.assign({},t),e),r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=Kt(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}};function te(t){const e=It.parse(t),n=e.length;let r=0,o=0,i=0;for(let t=0;t<n;t++)r||"number"==typeof e[t]?r++:void 0!==e[t].hue?i++:o++;return{parsed:e,numNumbers:r,numRGB:o,numHSL:i}}const ee=(t,e)=>{const n=It.createTransformer(e),r=te(t),o=te(e);return r.numHSL===o.numHSL&&r.numRGB===o.numRGB&&r.numNumbers>=o.numNumbers?Zt(Jt(r.parsed,o.parsed),n):n=>""+(n>0?e:t)},ne=(t,e)=>n=>ut(t,e,n);function re(t,e,n){const r=[],o=n||("number"==typeof(i=t[0])?ne:"string"==typeof i?Ot.test(i)?_t:ee:Array.isArray(i)?Jt:"object"==typeof i?Qt:void 0);var i;const a=t.length-1;for(let n=0;n<a;n++){let i=o(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]:e;i=Zt(t,i)}r.push(i)}return r}function oe(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const i=t.length;e.length,!r||!Array.isArray(r)||r.length,t[0]>t[i-1]&&(t=[].concat(t),e=[].concat(e),t.reverse(),e.reverse());const a=re(e,r,o),s=2===i?function([t,e],[n]){return r=>n(st(t,e,r))}(t,a):function(t,e){const n=t.length,r=n-1;return o=>{let i=0,a=!1;if(o<=t[0]?a=!0:o>=t[r]&&(i=r-1,a=!0),!a){let e=1;for(;e<n&&!(t[e]>o||e===r);e++);i=e-1}const s=st(t[i],t[i+1],o);return e[i](s)}}(t,a);return n?e=>s(Q(t[0],t[i-1],e)):s}const ie=t=>e=>1-t(1-e),ae=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,se=t=>e=>e*e*((t+1)*e-t),ue=t=>t,le=(ce=2,t=>Math.pow(t,ce));var ce;const fe=ie(le),de=ae(le),pe=t=>1-Math.sin(Math.acos(t)),ve=ie(pe),he=ae(ve),me=se(1.525),ye=ie(me),ge=ae(me),xe=(t=>{const e=se(t);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))})(1.525),be=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},Ee=ie(be);function we(t,e){return t.map(()=>e||de).splice(0,t.length-1)}function Pe({from:t=0,to:e=1,ease:n,offset:r,duration:o=300}){const i={done:!1,value:t},a=Array.isArray(e)?e:[t,e],s=function(t,e){return t.map(t=>t*e)}(r&&r.length===a.length?r:function(t){const e=t.length;return t.map((t,n)=>0!==n?n/(e-1):0)}(a),o);function u(){return oe(s,a,{ease:Array.isArray(n)?n:we(a,n)})}let l=u();return{next:t=>(i.value=l(t),i.done=t>=o,i),flipTarget:()=>{a.reverse(),l=u()}}}const Ae={keyframes:Pe,spring:it,decay:function({velocity:t=0,from:e=0,power:n=.8,timeConstant:r=350,restDelta:o=.5,modifyTarget:i}){const a={done:!1,value:e};let s=n*t;const u=e+s,l=void 0===i?u:i(u);return l!==u&&(s=l-e),{next:t=>{const e=-s*Math.exp(-t/r);return a.done=!(e>o||e<-o),a.value=a.done?l:l+e,a},flipTarget:()=>{}}}};function Te(t,e,n=0){return t-e-n}const Se=t=>{const e=({delta:e})=>t(e);return{start:()=>G.update(e,!0),stop:()=>_.update(e)}};function Ve(t){var e,n,{from:r,autoplay:o=!0,driver:i=Se,elapsed:a=0,repeat:s=0,repeatType:u="loop",repeatDelay:c=0,onPlay:f,onStop:d,onComplete:p,onRepeat:v,onUpdate:h}=t,m=l(t,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let y,g,x,{to:b}=m,E=0,w=m.duration,P=!1,A=!0;const T=function(t){if(Array.isArray(t.to))return Pe;if(Ae[t.type])return Ae[t.type];const e=new Set(Object.keys(t));return e.has("ease")||e.has("duration")&&!e.has("dampingRatio")?Pe:e.has("dampingRatio")||e.has("stiffness")||e.has("mass")||e.has("damping")||e.has("restSpeed")||e.has("restDelta")?it:Pe}(m);(null===(n=(e=T).needsInterpolation)||void 0===n?void 0:n.call(e,r,b))&&(x=oe([0,100],[r,b],{clamp:!1}),r=0,b=100);const S=T(Object.assign(Object.assign({},m),{from:r,to:b}));function V(){E++,"reverse"===u?(A=E%2==0,a=function(t,e,n=0,r=!0){return r?Te(e+-t,e,n):e-(t-e)+n}(a,w,c,A)):(a=Te(a,w,c),"mirror"===u&&S.flipTarget()),P=!1,v&&v()}function C(t){if(A||(t=-t),a+=t,!P){const t=S.next(Math.max(0,a));g=t.value,x&&(g=x(g)),P=A?t.done:a<=0}null==h||h(g),P&&(0===E&&(null!=w||(w=a)),E<s?function(t,e,n,r){return r?t>=e+n:t<=-n}(a,w,c,A)&&V():(y.stop(),p&&p()))}return o&&(null==f||f(),y=i(C),y.start()),{stop:()=>{null==d||d(),y.stop()}}}function Ce(t,e){return e?t*(1e3/e):0}const Me=t=>t.hasOwnProperty("x")&&t.hasOwnProperty("y"),Re=t=>Me(t)&&t.hasOwnProperty("z"),Le=(t,e)=>Math.abs(t-e);function Oe(t,e){if(qt(t)&&qt(e))return Le(t,e);if(Me(t)&&Me(e)){const n=Le(t.x,e.x),r=Le(t.y,e.y),o=Re(t)&&Re(e)?Le(t.z,e.z):0;return Math.sqrt(Math.pow(n,2)+Math.pow(r,2)+Math.pow(o,2))}}const De=(t,e,n)=>{const r=e-t;return((n-t)%r+r)%r+t},ke=(t,e)=>1-3*e+3*t,je=(t,e)=>3*e-6*t,Fe=t=>3*t,Ie=(t,e,n)=>((ke(e,n)*t+je(e,n))*t+Fe(e))*t,Ue=(t,e,n)=>3*ke(e,n)*t*t+2*je(e,n)*t+Fe(e);function Be(t,e,n,r){if(t===e&&n===r)return ue;const o=new Float32Array(11);for(let e=0;e<11;++e)o[e]=Ie(.1*e,t,n);function i(e){let r=0,i=1;for(;10!==i&&o[i]<=e;++i)r+=.1;--i;const a=r+.1*((e-o[i])/(o[i+1]-o[i])),s=Ue(a,t,n);return s>=.001?function(t,e,n,r){for(let o=0;o<8;++o){const o=Ue(e,n,r);if(0===o)return e;e-=(Ie(e,n,r)-t)/o}return e}(e,a,t,n):0===s?a:function(t,e,n,r,o){let i,a,s=0;do{a=e+(n-e)/2,i=Ie(a,r,o)-t,i>0?n=a:e=a}while(Math.abs(i)>1e-7&&++s<10);return a}(e,r,r+.1,t,n)}return t=>0===t||1===t?t:Ie(i(t),e,r)}function Ne(t,e){-1===t.indexOf(e)&&t.push(e)}function ze(t,e){var n=t.indexOf(e);n>-1&&t.splice(n,1)}var He=function(){function t(){this.subscriptions=[]}return t.prototype.add=function(t){var e=this;return Ne(this.subscriptions,t),function(){return ze(e.subscriptions,t)}},t.prototype.notify=function(t,e,n){var r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](t,e,n);else for(var o=0;o<r;o++){var i=this.subscriptions[o];i&&i(t,e,n)}},t.prototype.getSize=function(){return this.subscriptions.length},t.prototype.clear=function(){this.subscriptions.length=0},t}(),Xe=function(){function t(t){var e,n=this;this.timeDelta=0,this.lastUpdated=0,this.updateSubscribers=new He,this.velocityUpdateSubscribers=new He,this.renderSubscribers=new He,this.canTrackVelocity=!1,this.updateAndNotify=function(t,e){void 0===e&&(e=!0),n.prev=n.current,n.current=t;var r=J(),o=r.delta,i=r.timestamp;n.lastUpdated!==i&&(n.timeDelta=o,n.lastUpdated=i,G.postRender(n.scheduleVelocityCheck)),n.prev!==n.current&&n.updateSubscribers.notify(n.current),n.velocityUpdateSubscribers.getSize()&&n.velocityUpdateSubscribers.notify(n.getVelocity()),e&&n.renderSubscribers.notify(n.current)},this.scheduleVelocityCheck=function(){return G.postRender(n.velocityCheck)},this.velocityCheck=function(t){t.timestamp!==n.lastUpdated&&(n.prev=n.current,n.velocityUpdateSubscribers.notify(n.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e)))}return t.prototype.onChange=function(t){return this.updateSubscribers.add(t)},t.prototype.clearListeners=function(){this.updateSubscribers.clear()},t.prototype.onRenderRequest=function(t){return t(this.get()),this.renderSubscribers.add(t)},t.prototype.attach=function(t){this.passiveEffect=t},t.prototype.set=function(t,e){void 0===e&&(e=!0),e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)},t.prototype.get=function(){return this.current},t.prototype.getPrevious=function(){return this.prev},t.prototype.getVelocity=function(){return this.canTrackVelocity?Ce(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0},t.prototype.start=function(t){var e=this;return this.stop(),new Promise((function(n){e.hasAnimated=!0,e.stopAnimation=t(n)})).then((function(){return e.clearAnimation()}))},t.prototype.stop=function(){this.stopAnimation&&this.stopAnimation(),this.clearAnimation()},t.prototype.isAnimating=function(){return!!this.stopAnimation},t.prototype.clearAnimation=function(){this.stopAnimation=null},t.prototype.destroy=function(){this.updateSubscribers.clear(),this.renderSubscribers.clear(),this.stop()},t}();function Ye(t){return new Xe(t)}var We=function(t){return Boolean(null!==t&&"object"==typeof t&&t.getVelocity)},Ge=function(t){return 1e3*t},_e={linear:ue,easeIn:le,easeInOut:de,easeOut:fe,circIn:pe,circInOut:he,circOut:ve,backIn:me,backInOut:ge,backOut:ye,anticipate:xe,bounceIn:Ee,bounceInOut:t=>t<.5?.5*(1-be(1-2*t)):.5*be(2*t-1)+.5,bounceOut:be},qe=function(t){if(Array.isArray(t)){t.length;var e=c(t,4);return Be(e[0],e[1],e[2],e[3])}return"string"==typeof t?_e[t]:t},$e=function(t,e){return"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!It.test(e)||e.startsWith("url(")))},Ze=function(t){return Array.isArray(t)},Ke=function(){return{type:"spring",stiffness:500,damping:25,restSpeed:10}},Je=function(t){return{type:"spring",stiffness:550,damping:0===t?2*Math.sqrt(550):30,restSpeed:10}},Qe=function(){return{type:"keyframes",ease:"linear",duration:.3}},tn=function(t){return{type:"keyframes",duration:.8,values:t}},en={x:Ke,y:Ke,z:Ke,rotate:Ke,rotateX:Ke,rotateY:Ke,rotateZ:Ke,scaleX:Je,scaleY:Je,scale:Je,opacity:Qe,backgroundColor:Qe,color:Qe,default:Je},nn=u(u({},ht),{transform:Math.round}),rn={borderWidth:Et,borderTopWidth:Et,borderRightWidth:Et,borderBottomWidth:Et,borderLeftWidth:Et,borderRadius:Et,radius:Et,borderTopLeftRadius:Et,borderTopRightRadius:Et,borderBottomRightRadius:Et,borderBottomLeftRadius:Et,width:Et,maxWidth:Et,height:Et,maxHeight:Et,size:Et,top:Et,right:Et,bottom:Et,left:Et,padding:Et,paddingTop:Et,paddingRight:Et,paddingBottom:Et,paddingLeft:Et,margin:Et,marginTop:Et,marginRight:Et,marginBottom:Et,marginLeft:Et,rotate:xt,rotateX:xt,rotateY:xt,rotateZ:xt,scale:yt,scaleX:yt,scaleY:yt,scaleZ:yt,skew:xt,skewX:xt,skewY:xt,distance:Et,translateX:Et,translateY:Et,translateZ:Et,x:Et,y:Et,z:Et,perspective:Et,transformPerspective:Et,opacity:mt,originX:At,originY:At,originZ:Et,zIndex:nn,fillOpacity:mt,strokeOpacity:mt,numOctaves:nn},on=u(u({},rn),{color:Ot,backgroundColor:Ot,outlineColor:Ot,fill:Ot,stroke:Ot,borderColor:Ot,borderTopColor:Ot,borderRightColor:Ot,borderBottomColor:Ot,borderLeftColor:Ot,filter:zt,WebkitFilter:zt}),an=function(t){return on[t]};function sn(t,e){var n,r=an(t);return r!==zt&&(r=It),null===(n=r.getAnimatableNone)||void 0===n?void 0:n.call(r,e)}var un={current:!1},ln=function(t){return Ze(t)?t[t.length-1]||0:t};function cn(t){var e=t.ease,n=t.times,r=t.yoyo,o=t.flip,i=t.loop,a=l(t,["ease","times","yoyo","flip","loop"]),s=u({},a);return n&&(s.offset=n),a.duration&&(s.duration=Ge(a.duration)),a.repeatDelay&&(s.repeatDelay=Ge(a.repeatDelay)),e&&(s.ease=function(t){return Array.isArray(t)&&"number"!=typeof t[0]}(e)?e.map(qe):qe(e)),"tween"===a.type&&(s.type="keyframes"),(r||i||o)&&(r?s.repeatType="reverse":i?s.repeatType="loop":o&&(s.repeatType="mirror"),s.repeat=i||r||o||a.repeat),"spring"!==a.type&&(s.type="keyframes"),s}function fn(t,e,n){var r,o,i,a;return Array.isArray(e.to)&&(null!==(r=t.duration)&&void 0!==r||(t.duration=.8)),function(t){Array.isArray(t.to)&&null===t.to[0]&&(t.to=f([],c(t.to),!1),t.to[0]=t.from)}(e),function(t){t.when,t.delay,t.delayChildren,t.staggerChildren,t.staggerDirection,t.repeat,t.repeatType,t.repeatDelay,t.from;var e=l(t,["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from"]);return!!Object.keys(e).length}(t)||(t=u(u({},t),(o=n,i=e.to,a=Ze(i)?tn:en[o]||en.default,u({to:i},a(i))))),u(u({},e),cn(t))}function dn(t,e,n,r,o){var i,a=hn(r,t),s=null!==(i=a.from)&&void 0!==i?i:e.get(),l=$e(t,n);return"none"===s&&l&&"string"==typeof n?s=sn(t,n):pn(s)&&"string"==typeof n?s=vn(n):!Array.isArray(n)&&pn(n)&&"string"==typeof s&&(n=vn(s)),$e(t,s)&&l&&!1!==a.type?function(){var r={from:s,to:n,velocity:e.getVelocity(),onComplete:o,onUpdate:function(t){return e.set(t)}};return"inertia"===a.type||"decay"===a.type?function({from:t=0,velocity:e=0,min:n,max:r,power:o=.8,timeConstant:i=750,bounceStiffness:a=500,bounceDamping:s=10,restDelta:u=1,modifyTarget:l,driver:c,onUpdate:f,onComplete:d,onStop:p}){let v;function h(t){return void 0!==n&&t<n||void 0!==r&&t>r}function m(t){return void 0===n?r:void 0===r||Math.abs(n-t)<Math.abs(r-t)?n:r}function y(t){null==v||v.stop(),v=Ve(Object.assign(Object.assign({},t),{driver:c,onUpdate:e=>{var n;null==f||f(e),null===(n=t.onUpdate)||void 0===n||n.call(t,e)},onComplete:d,onStop:p}))}function g(t){y(Object.assign({type:"spring",stiffness:a,damping:s,restDelta:u},t))}if(h(t))g({from:t,velocity:e,to:m(t)});else{let r=o*e+t;void 0!==l&&(r=l(r));const a=m(r),s=a===n?-1:1;let c,f;const d=t=>{c=f,f=t,e=Ce(t-c,J().delta),(1===s&&t>a||-1===s&&t<a)&&g({from:t,to:a,velocity:e})};y({type:"decay",from:t,velocity:e,timeConstant:i,power:o,restDelta:u,modifyTarget:l,onUpdate:h(r)?d:void 0})}return{stop:()=>null==v?void 0:v.stop()}}(u(u({},r),a)):Ve(u(u({},fn(a,r,t)),{onUpdate:function(t){var e;r.onUpdate(t),null===(e=a.onUpdate)||void 0===e||e.call(a,t)},onComplete:function(){var t;r.onComplete(),null===(t=a.onComplete)||void 0===t||t.call(a)}}))}:function(){var t,r,i=ln(n);return e.set(i),o(),null===(t=null==a?void 0:a.onUpdate)||void 0===t||t.call(a,i),null===(r=null==a?void 0:a.onComplete)||void 0===r||r.call(a),{stop:function(){}}}}function pn(t){return 0===t||"string"==typeof t&&0===parseFloat(t)&&-1===t.indexOf(" ")}function vn(t){return"number"==typeof t?0:sn("",t)}function hn(t,e){return t[e]||t.default||t}function mn(t,e,n,r){return void 0===r&&(r={}),un.current&&(r={type:!1}),e.start((function(o){var i,a,s=dn(t,e,n,r,o),u=function(t,e){var n,r;return null!==(r=null!==(n=(hn(t,e)||{}).delay)&&void 0!==n?n:t.delay)&&void 0!==r?r:0}(r,t),l=function(){return a=s()};return u?i=window.setTimeout(l,Ge(u)):l(),function(){clearTimeout(i),null==a||a.stop()}}))}function yn(t,e,n){void 0===n&&(n={});var r=We(t)?t:Ye(t);return mn("",r,e,n),{stop:function(){return r.stop()},isAnimating:function(){return r.isAnimating()}}}var gn=["TopLeft","TopRight","BottomLeft","BottomRight"],xn=gn.length,bn=function(t){return"string"==typeof t?parseFloat(t):t},En=function(t){return"number"==typeof t||Et.test(t)};function wn(t,e){var n;return null!==(n=t[e])&&void 0!==n?n:t.borderRadius}var Pn=Tn(0,.5,ve),An=Tn(.5,.95,ue);function Tn(t,e,n){return function(r){return r<t?0:r>e?1:n(st(t,e,r))}}function Sn(t,e){t.min=e.min,t.max=e.max}function Vn(t,e){Sn(t.x,e.x),Sn(t.y,e.y)}function Cn(t){return void 0===t||1===t}function Mn(t){var e=t.scale,n=t.scaleX,r=t.scaleY;return!Cn(e)||!Cn(n)||!Cn(r)}function Rn(t){return Mn(t)||Ln(t.x)||Ln(t.y)||t.z||t.rotate||t.rotateX||t.rotateY}function Ln(t){return t&&"0%"!==t}function On(t,e,n){return n+e*(t-n)}function Dn(t,e,n,r,o){return void 0!==o&&(t=On(t,o,r)),On(t,n,r)+e}function kn(t,e,n,r,o){void 0===e&&(e=0),void 0===n&&(n=1),t.min=Dn(t.min,e,n,r,o),t.max=Dn(t.max,e,n,r,o)}function jn(t,e){var n=e.x,r=e.y;kn(t.x,n.translate,n.scale,n.originPoint),kn(t.y,r.translate,r.scale,r.originPoint)}function Fn(t,e){t.min=t.min+e,t.max=t.max+e}function In(t,e,n){var r=c(n,3),o=r[0],i=r[1],a=r[2],s=void 0!==e[a]?e[a]:.5,u=ut(t.min,t.max,s);kn(t,e[o],e[i],u,e.scale)}var Un=["x","scaleX","originX"],Bn=["y","scaleY","originY"];function Nn(t,e){In(t.x,e,Un),In(t.y,e,Bn)}function zn(t){return t.max-t.min}function Hn(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=.01),Oe(t,e)<n}function Xn(t,e,n,r){void 0===r&&(r=.5),t.origin=r,t.originPoint=ut(e.min,e.max,t.origin),t.scale=zn(n)/zn(e),(Hn(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=ut(n.min,n.max,t.origin)-t.originPoint,(Hn(t.translate)||isNaN(t.translate))&&(t.translate=0)}function Yn(t,e,n,r){Xn(t.x,e.x,n.x,null==r?void 0:r.originX),Xn(t.y,e.y,n.y,null==r?void 0:r.originY)}function Wn(t,e,n){t.min=n.min+e.min,t.max=t.min+zn(e)}function Gn(t,e,n){t.min=e.min-n.min,t.max=t.min+zn(e)}function _n(t,e,n){Gn(t.x,e.x,n.x),Gn(t.y,e.y,n.y)}function qn(t,e,n,r,o){return t=On(t-=e,1/n,r),void 0!==o&&(t=On(t,1/o,r)),t}function $n(t,e,n,r,o){var i=c(n,3),a=i[0],s=i[1],u=i[2];!function(t,e,n,r,o,i,a){if(void 0===e&&(e=0),void 0===n&&(n=1),void 0===r&&(r=.5),void 0===i&&(i=t),void 0===a&&(a=t),bt.test(e)&&(e=parseFloat(e),e=ut(a.min,a.max,e/100)-a.min),"number"==typeof e){var s=ut(i.min,i.max,r);t===i&&(s-=e),t.min=qn(t.min,e,n,s,o),t.max=qn(t.max,e,n,s,o)}}(t,e[a],e[s],e[u],e.scale,r,o)}var Zn=["x","scaleX","originX"],Kn=["y","scaleY","originY"];function Jn(t,e,n,r){$n(t.x,e,Zn,null==n?void 0:n.x,null==r?void 0:r.x),$n(t.y,e,Kn,null==n?void 0:n.y,null==r?void 0:r.y)}var Qn=function(){return{x:{min:0,max:0},y:{min:0,max:0}}};function tr(t){return 0===t.translate&&1===t.scale}function er(t){return tr(t.x)&&tr(t.y)}function nr(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}var rr=function(){function t(){this.members=[]}return t.prototype.add=function(t){Ne(this.members,t),t.scheduleRender()},t.prototype.remove=function(t){if(ze(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){var e=this.members[this.members.length-1];e&&this.promote(e)}},t.prototype.relegate=function(t){var e,n=this.members.findIndex((function(e){return t===e}));if(0===n)return!1;for(var r=n;r>=0;r--){var o=this.members[r];if(!1!==o.isPresent){e=o;break}}return!!e&&(this.promote(e),!0)},t.prototype.promote=function(t,e){var n,r=this.lead;t!==r&&(this.prevLead=r,this.lead=t,t.show(),r&&(r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,e&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues,t.snapshot.isShared=!0),(null===(n=t.root)||void 0===n?void 0:n.isUpdating)&&(t.isLayoutDirty=!0),!1===t.options.crossfade&&r.hide()))},t.prototype.exitAnimationComplete=function(){this.members.forEach((function(t){var e,n,r,o,i;null===(n=(e=t.options).onExitComplete)||void 0===n||n.call(e),null===(i=null===(r=t.resumingFrom)||void 0===r?void 0:(o=r.options).onExitComplete)||void 0===i||i.call(o)}))},t.prototype.scheduleRender=function(){this.members.forEach((function(t){t.instance&&t.scheduleRender(!1)}))},t.prototype.removeLeadSnapshot=function(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)},t}(),or={};function ir(t){Object.assign(or,t)}function ar(t,e,n){var r=t.x.translate/e.x,o=t.y.translate/e.y,i="translate3d(".concat(r,"px, ").concat(o,"px, 0) ");if(n){var a=n.rotate,s=n.rotateX,u=n.rotateY;a&&(i+="rotate(".concat(a,"deg) ")),s&&(i+="rotateX(".concat(s,"deg) ")),u&&(i+="rotateY(".concat(u,"deg) "))}return"translate3d(0px, 0px, 0) scale(1, 1)"===(i+="scale(".concat(t.x.scale,", ").concat(t.y.scale,")"))?"none":i}function sr(t){return[t("x"),t("y")]}var ur=["","X","Y","Z"],lr=["transformPerspective","x","y","z"];function cr(t,e){return lr.indexOf(t)-lr.indexOf(e)}["translate","scale","rotate","skew"].forEach((function(t){return ur.forEach((function(e){return lr.push(t+e)}))}));var fr=new Set(lr);function dr(t){return fr.has(t)}var pr=new Set(["originX","originY","originZ"]);function vr(t){return pr.has(t)}var hr=function(t,e){return t.depth-e.depth},mr=function(){function t(){this.children=[],this.isDirty=!1}return t.prototype.add=function(t){Ne(this.children,t),this.isDirty=!0},t.prototype.remove=function(t){ze(this.children,t),this.isDirty=!0},t.prototype.forEach=function(t){this.isDirty&&this.children.sort(hr),this.isDirty=!1,this.children.forEach(t)},t}();function yr(t){var e,n=We(t)?t.get():t;return e=n,Boolean(e&&"object"==typeof e&&e.mix&&e.toValue)?n.toValue():n}var gr={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function xr(t){var e=t.attachResizeListener,n=t.defaultParent,r=t.measureScroll,o=t.resetTransform;return function(){function t(t,e,r){var o=this;void 0===e&&(e={}),void 0===r&&(r=null==n?void 0:n()),this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.potentialNodes=new Map,this.checkUpdateFailed=function(){o.isUpdating&&(o.isUpdating=!1,o.clearAllSnapshots())},this.updateProjection=function(){o.nodes.forEach(Sr),o.nodes.forEach(Vr)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.id=t,this.latestValues=e,this.root=r?r.root||r:this,this.path=r?f(f([],c(r.path),!1),[r],!1):[],this.parent=r,this.depth=r?r.depth+1:0,t&&this.root.registerPotentialNode(t,this);for(var i=0;i<this.path.length;i++)this.path[i].shouldResetTransform=!0;this.root===this&&(this.nodes=new mr)}return t.prototype.addEventListener=function(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new He),this.eventHandlers.get(t).add(e)},t.prototype.notifyListeners=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=this.eventHandlers.get(t);null==r||r.notify.apply(r,f([],c(e),!1))},t.prototype.hasListeners=function(t){return this.eventHandlers.has(t)},t.prototype.registerPotentialNode=function(t,e){this.potentialNodes.set(t,e)},t.prototype.mount=function(t,n){var r,o=this;if(void 0===n&&(n=!1),!this.instance){this.isSVG=t instanceof SVGElement&&"svg"!==t.tagName,this.instance=t;var i=this.options,a=i.layoutId,s=i.layout,l=i.visualElement;if(l&&!l.getInstance()&&l.mount(t),this.root.nodes.add(this),null===(r=this.parent)||void 0===r||r.children.add(this),this.id&&this.root.potentialNodes.delete(this.id),n&&(s||a)&&(this.isLayoutDirty=!0),e){var c,f=function(){return o.root.updateBlockedByResize=!1};e(t,(function(){o.root.updateBlockedByResize=!0,clearTimeout(c),c=window.setTimeout(f,250),gr.hasAnimatedSinceResize&&(gr.hasAnimatedSinceResize=!1,o.nodes.forEach(Tr))}))}a&&this.root.registerSharedNode(a,this),!1!==this.options.animate&&l&&(a||s)&&this.addEventListener("didUpdate",(function(t){var e,n,r,i,a,s=t.delta,c=t.hasLayoutChanged,f=t.hasRelativeTargetChanged,d=t.layout;if(o.isTreeAnimationBlocked())return o.target=void 0,void(o.relativeTarget=void 0);var p=null!==(n=null!==(e=o.options.transition)&&void 0!==e?e:l.getDefaultTransition())&&void 0!==n?n:Dr,v=l.getProps(),h=v.onLayoutAnimationStart,m=v.onLayoutAnimationComplete,y=!o.targetLayout||!nr(o.targetLayout,d)||f,g=!c&&f;if((null===(r=o.resumeFrom)||void 0===r?void 0:r.instance)||g||c&&(y||!o.currentAnimation)){o.resumeFrom&&(o.resumingFrom=o.resumeFrom,o.resumingFrom.resumingFrom=void 0),o.setAnimationOrigin(s,g);var x=u(u({},hn(p,"layout")),{onPlay:h,onComplete:m});l.shouldReduceMotion&&(x.delay=0,x.type=!1),o.startAnimation(x)}else c||0!==o.animationProgress||o.finishAnimation(),o.isLead()&&(null===(a=(i=o.options).onExitComplete)||void 0===a||a.call(i));o.targetLayout=d}))}},t.prototype.unmount=function(){var t,e;this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this),null===(t=this.getStack())||void 0===t||t.remove(this),null===(e=this.parent)||void 0===e||e.children.delete(this),this.instance=void 0,_.preRender(this.updateProjection)},t.prototype.blockUpdate=function(){this.updateManuallyBlocked=!0},t.prototype.unblockUpdate=function(){this.updateManuallyBlocked=!1},t.prototype.isUpdateBlocked=function(){return this.updateManuallyBlocked||this.updateBlockedByResize},t.prototype.isTreeAnimationBlocked=function(){var t;return this.isAnimationBlocked||(null===(t=this.parent)||void 0===t?void 0:t.isTreeAnimationBlocked())||!1},t.prototype.startUpdate=function(){var t;this.isUpdateBlocked()||(this.isUpdating=!0,null===(t=this.nodes)||void 0===t||t.forEach(Cr))},t.prototype.willUpdate=function(t){var e,n,r;if(void 0===t&&(t=!0),this.root.isUpdateBlocked())null===(n=(e=this.options).onExitComplete)||void 0===n||n.call(e);else if(!this.root.isUpdating&&this.root.startUpdate(),!this.isLayoutDirty){this.isLayoutDirty=!0;for(var o=0;o<this.path.length;o++){var i=this.path[o];i.shouldResetTransform=!0,i.updateScroll()}var a=this.options,s=a.layoutId,u=a.layout;if(void 0!==s||u){var l=null===(r=this.options.visualElement)||void 0===r?void 0:r.getProps().transformTemplate;this.prevTransformTemplateValue=null==l?void 0:l(this.latestValues,""),this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}}},t.prototype.didUpdate=function(){if(this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(Pr);this.isUpdating&&(this.isUpdating=!1,this.potentialNodes.size&&(this.potentialNodes.forEach(kr),this.potentialNodes.clear()),this.nodes.forEach(Ar),this.nodes.forEach(br),this.nodes.forEach(Er),this.clearAllSnapshots(),q.update(),q.preRender(),q.render())},t.prototype.clearAllSnapshots=function(){this.nodes.forEach(wr),this.sharedNodes.forEach(Mr)},t.prototype.scheduleUpdateProjection=function(){G.preRender(this.updateProjection,!1,!0)},t.prototype.scheduleCheckAfterUnmount=function(){var t=this;G.postRender((function(){t.isLayoutDirty?t.root.didUpdate():t.root.checkUpdateFailed()}))},t.prototype.updateSnapshot=function(){if(!this.snapshot&&this.instance){var t=this.measure(),e=this.removeTransform(this.removeElementScroll(t));Fr(e),this.snapshot={measured:t,layout:e,latestValues:{}}}},t.prototype.updateLayout=function(){var t;if(this.instance&&(this.updateScroll(),this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty)){if(this.resumeFrom&&!this.resumeFrom.instance)for(var e=0;e<this.path.length;e++){this.path[e].updateScroll()}var n=this.measure();Fr(n);var r=this.layout;this.layout={measured:n,actual:this.removeElementScroll(n)},this.layoutCorrected={x:{min:0,max:0},y:{min:0,max:0}},this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.actual),null===(t=this.options.visualElement)||void 0===t||t.notifyLayoutMeasure(this.layout.actual,null==r?void 0:r.actual)}},t.prototype.updateScroll=function(){this.options.layoutScroll&&this.instance&&(this.scroll=r(this.instance))},t.prototype.resetTransform=function(){var t;if(o){var e=this.isLayoutDirty||this.shouldResetTransform,n=this.projectionDelta&&!er(this.projectionDelta),r=null===(t=this.options.visualElement)||void 0===t?void 0:t.getProps().transformTemplate,i=null==r?void 0:r(this.latestValues,""),a=i!==this.prevTransformTemplateValue;e&&(n||Rn(this.latestValues)||a)&&(o(this.instance,i),this.shouldResetTransform=!1,this.scheduleRender())}},t.prototype.measure=function(){var t=this.options.visualElement;if(!t)return{x:{min:0,max:0},y:{min:0,max:0}};var e=t.measureViewportBox(),n=this.root.scroll;return n&&(Fn(e.x,n.x),Fn(e.y,n.y)),e},t.prototype.removeElementScroll=function(t){var e={x:{min:0,max:0},y:{min:0,max:0}};Vn(e,t);for(var n=0;n<this.path.length;n++){var r=this.path[n],o=r.scroll,i=r.options;r!==this.root&&o&&i.layoutScroll&&(Fn(e.x,o.x),Fn(e.y,o.y))}return e},t.prototype.applyTransform=function(t,e){void 0===e&&(e=!1);var n={x:{min:0,max:0},y:{min:0,max:0}};Vn(n,t);for(var r=0;r<this.path.length;r++){var o=this.path[r];!e&&o.options.layoutScroll&&o.scroll&&o!==o.root&&Nn(n,{x:-o.scroll.x,y:-o.scroll.y}),Rn(o.latestValues)&&Nn(n,o.latestValues)}return Rn(this.latestValues)&&Nn(n,this.latestValues),n},t.prototype.removeTransform=function(t){var e,n={x:{min:0,max:0},y:{min:0,max:0}};Vn(n,t);for(var r=0;r<this.path.length;r++){var o=this.path[r];if(o.instance&&Rn(o.latestValues)){Mn(o.latestValues)&&o.updateSnapshot();var i={x:{min:0,max:0},y:{min:0,max:0}};Vn(i,o.measure()),Jn(n,o.latestValues,null===(e=o.snapshot)||void 0===e?void 0:e.layout,i)}}return Rn(this.latestValues)&&Jn(n,this.latestValues),n},t.prototype.setTargetDelta=function(t){this.targetDelta=t,this.root.scheduleUpdateProjection()},t.prototype.setOptions=function(t){var e;this.options=u(u(u({},this.options),t),{crossfade:null===(e=t.crossfade)||void 0===e||e})},t.prototype.clearMeasurements=function(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1},t.prototype.resolveTargetDelta=function(){var t,e,n,r,o=this.options,i=o.layout,a=o.layoutId;this.layout&&(i||a)&&(this.targetDelta||this.relativeTarget||(this.relativeParent=this.getClosestProjectingParent(),this.relativeParent&&this.relativeParent.layout&&(this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},_n(this.relativeTargetOrigin,this.layout.actual,this.relativeParent.layout.actual),Vn(this.relativeTarget,this.relativeTargetOrigin))),(this.relativeTarget||this.targetDelta)&&(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&(null===(t=this.relativeParent)||void 0===t?void 0:t.target)?(e=this.target,n=this.relativeTarget,r=this.relativeParent.target,Wn(e.x,n.x,r.x),Wn(e.y,n.y,r.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.actual):Vn(this.target,this.layout.actual),jn(this.target,this.targetDelta)):Vn(this.target,this.layout.actual),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.relativeParent=this.getClosestProjectingParent(),this.relativeParent&&Boolean(this.relativeParent.resumingFrom)===Boolean(this.resumingFrom)&&!this.relativeParent.options.layoutScroll&&this.relativeParent.target&&(this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},_n(this.relativeTargetOrigin,this.target,this.relativeParent.target),Vn(this.relativeTarget,this.relativeTargetOrigin)))))},t.prototype.getClosestProjectingParent=function(){if(this.parent&&!Rn(this.parent.latestValues))return(this.parent.relativeTarget||this.parent.targetDelta)&&this.parent.layout?this.parent:this.parent.getClosestProjectingParent()},t.prototype.calcProjection=function(){var t,e=this.options,n=e.layout,r=e.layoutId;if(this.isTreeAnimating=Boolean((null===(t=this.parent)||void 0===t?void 0:t.isTreeAnimating)||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),this.layout&&(n||r)){var o=this.getLead();Vn(this.layoutCorrected,this.layout.actual),function(t,e,n,r){var o,i;void 0===r&&(r=!1);var a=n.length;if(a){var s,u;e.x=e.y=1;for(var l=0;l<a;l++)u=(s=n[l]).projectionDelta,"contents"!==(null===(i=null===(o=s.instance)||void 0===o?void 0:o.style)||void 0===i?void 0:i.display)&&(r&&s.options.layoutScroll&&s.scroll&&s!==s.root&&Nn(t,{x:-s.scroll.x,y:-s.scroll.y}),u&&(e.x*=u.x.scale,e.y*=u.y.scale,jn(t,u)),r&&Rn(s.latestValues)&&Nn(t,s.latestValues))}}(this.layoutCorrected,this.treeScale,this.path,Boolean(this.resumingFrom)||this!==o);var i=o.target;if(i){this.projectionDelta||(this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}});var a=this.treeScale.x,s=this.treeScale.y,u=this.projectionTransform;Yn(this.projectionDelta,this.layoutCorrected,i,this.latestValues),this.projectionTransform=ar(this.projectionDelta,this.treeScale),this.projectionTransform===u&&this.treeScale.x===a&&this.treeScale.y===s||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",i))}}},t.prototype.hide=function(){this.isVisible=!1},t.prototype.show=function(){this.isVisible=!0},t.prototype.scheduleRender=function(t){var e,n,r;void 0===t&&(t=!0),null===(n=(e=this.options).scheduleRender)||void 0===n||n.call(e),t&&(null===(r=this.getStack())||void 0===r||r.scheduleRender()),this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)},t.prototype.setAnimationOrigin=function(t,e){var n,r=this;void 0===e&&(e=!1);var o=this.snapshot,i=(null==o?void 0:o.latestValues)||{},a=u({},this.latestValues),s={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeTarget=this.relativeTargetOrigin=void 0,this.attemptToResolveRelativeTarget=!e;var l={x:{min:0,max:0},y:{min:0,max:0}},c=null==o?void 0:o.isShared,f=((null===(n=this.getStack())||void 0===n?void 0:n.members.length)||0)<=1,d=Boolean(c&&!f&&!0===this.options.crossfade&&!this.path.some(Or));this.animationProgress=0,this.mixTargetDelta=function(e){var n,o,u,p,v,h=e/1e3;Rr(s.x,t.x,h),Rr(s.y,t.y,h),r.setTargetDelta(s),r.relativeTarget&&r.relativeTargetOrigin&&r.layout&&(null===(n=r.relativeParent)||void 0===n?void 0:n.layout)&&(_n(l,r.layout.actual,r.relativeParent.layout.actual),o=r.relativeTarget,u=r.relativeTargetOrigin,p=l,v=h,Lr(o.x,u.x,p.x,v),Lr(o.y,u.y,p.y,v)),c&&(r.animationValues=a,function(t,e,n,r,o,i){var a,s,u,l;o?(t.opacity=ut(0,null!==(a=n.opacity)&&void 0!==a?a:1,Pn(r)),t.opacityExit=ut(null!==(s=e.opacity)&&void 0!==s?s:1,0,An(r))):i&&(t.opacity=ut(null!==(u=e.opacity)&&void 0!==u?u:1,null!==(l=n.opacity)&&void 0!==l?l:1,r));for(var c=0;c<xn;c++){var f="border".concat(gn[c],"Radius"),d=wn(e,f),p=wn(n,f);if(void 0!==d||void 0!==p)d||(d=0),p||(p=0),0===d||0===p||En(d)===En(p)?(t[f]=Math.max(ut(bn(d),bn(p),r),0),(bt.test(p)||bt.test(d))&&(t[f]+="%")):t[f]=p}(e.rotate||n.rotate)&&(t.rotate=ut(e.rotate||0,n.rotate||0,r))}(a,i,r.latestValues,h,d,f)),r.root.scheduleUpdateProjection(),r.scheduleRender(),r.animationProgress=h},this.mixTargetDelta(0)},t.prototype.startAnimation=function(t){var e,n,r=this;this.notifyListeners("animationStart"),null===(e=this.currentAnimation)||void 0===e||e.stop(),this.resumingFrom&&(null===(n=this.resumingFrom.currentAnimation)||void 0===n||n.stop()),this.pendingAnimation&&(_.update(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=G.update((function(){gr.hasAnimatedSinceResize=!0,r.currentAnimation=yn(0,1e3,u(u({},t),{onUpdate:function(e){var n;r.mixTargetDelta(e),null===(n=t.onUpdate)||void 0===n||n.call(t,e)},onComplete:function(){var e;null===(e=t.onComplete)||void 0===e||e.call(t),r.completeAnimation()}})),r.resumingFrom&&(r.resumingFrom.currentAnimation=r.currentAnimation),r.pendingAnimation=void 0}))},t.prototype.completeAnimation=function(){var t;this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0),null===(t=this.getStack())||void 0===t||t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")},t.prototype.finishAnimation=function(){var t;this.currentAnimation&&(null===(t=this.mixTargetDelta)||void 0===t||t.call(this,1e3),this.currentAnimation.stop()),this.completeAnimation()},t.prototype.applyTransformsToTarget=function(){var t=this.getLead(),e=t.targetWithTransforms,n=t.target,r=t.layout,o=t.latestValues;e&&n&&r&&(Vn(e,n),Nn(e,o),Yn(this.projectionDeltaWithTransform,this.layoutCorrected,e,o))},t.prototype.registerSharedNode=function(t,e){var n,r,o;this.sharedNodes.has(t)||this.sharedNodes.set(t,new rr),this.sharedNodes.get(t).add(e),e.promote({transition:null===(n=e.options.initialPromotionConfig)||void 0===n?void 0:n.transition,preserveFollowOpacity:null===(o=null===(r=e.options.initialPromotionConfig)||void 0===r?void 0:r.shouldPreserveFollowOpacity)||void 0===o?void 0:o.call(r,e)})},t.prototype.isLead=function(){var t=this.getStack();return!t||t.lead===this},t.prototype.getLead=function(){var t;return this.options.layoutId&&(null===(t=this.getStack())||void 0===t?void 0:t.lead)||this},t.prototype.getPrevLead=function(){var t;return this.options.layoutId?null===(t=this.getStack())||void 0===t?void 0:t.prevLead:void 0},t.prototype.getStack=function(){var t=this.options.layoutId;if(t)return this.root.sharedNodes.get(t)},t.prototype.promote=function(t){var e=void 0===t?{}:t,n=e.needsReset,r=e.transition,o=e.preserveFollowOpacity,i=this.getStack();i&&i.promote(this,o),n&&(this.projectionDelta=void 0,this.needsReset=!0),r&&this.setOptions({transition:r})},t.prototype.relegate=function(){var t=this.getStack();return!!t&&t.relegate(this)},t.prototype.resetRotation=function(){var t=this.options.visualElement;if(t){for(var e=!1,n={},r=0;r<ur.length;r++){var o="rotate"+ur[r];t.getStaticValue(o)&&(e=!0,n[o]=t.getStaticValue(o),t.setStaticValue(o,0))}if(e){for(var o in null==t||t.syncRender(),n)t.setStaticValue(o,n[o]);t.scheduleRender()}}},t.prototype.getProjectionStyles=function(t){var e,n,r,o,i,a;void 0===t&&(t={});var s={};if(!this.instance||this.isSVG)return s;if(!this.isVisible)return{visibility:"hidden"};s.visibility="";var u=null===(e=this.options.visualElement)||void 0===e?void 0:e.getProps().transformTemplate;if(this.needsReset)return this.needsReset=!1,s.opacity="",s.pointerEvents=yr(t.pointerEvents)||"",s.transform=u?u(this.latestValues,""):"none",s;var l=this.getLead();if(!this.projectionDelta||!this.layout||!l.target){var c={};return this.options.layoutId&&(c.opacity=null!==(n=this.latestValues.opacity)&&void 0!==n?n:1,c.pointerEvents=yr(t.pointerEvents)||""),this.hasProjected&&!Rn(this.latestValues)&&(c.transform=u?u({},""):"none",this.hasProjected=!1),c}var f=l.animationValues||l.latestValues;this.applyTransformsToTarget(),s.transform=ar(this.projectionDeltaWithTransform,this.treeScale,f),u&&(s.transform=u(f,s.transform));var d=this.projectionDelta,p=d.x,v=d.y;for(var h in s.transformOrigin="".concat(100*p.origin,"% ").concat(100*v.origin,"% 0"),l.animationValues?s.opacity=l===this?null!==(o=null!==(r=f.opacity)&&void 0!==r?r:this.latestValues.opacity)&&void 0!==o?o:1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:s.opacity=l===this?null!==(i=f.opacity)&&void 0!==i?i:"":null!==(a=f.opacityExit)&&void 0!==a?a:0,or)if(void 0!==f[h]){var m=or[h],y=m.correct,g=m.applyTo,x=y(f[h],l);if(g)for(var b=g.length,E=0;E<b;E++)s[g[E]]=x;else s[h]=x}return this.options.layoutId&&(s.pointerEvents=l===this?yr(t.pointerEvents)||"":"none"),s},t.prototype.clearSn