From 1710ebae195c27bfab73d853fd86f0553adab426 Mon Sep 17 00:00:00 2001 From: "mr. M" Date: Sat, 11 Jan 2025 21:33:06 +0100 Subject: [PATCH] Add motion animation support and refine UI transitions for workspace interactions --- src/browser/base/content/ZenUIManager.mjs | 4 +++ .../base/content/zen-assets.jar.inc.mn | 1 + .../content/zen-styles/zen-animations.css | 32 ------------------- .../base/content/zen-styles/zen-glance.css | 4 +-- .../base/content/zen-styles/zen-theme.css | 2 +- .../base/content/zen-vendor/motion.min.mjs | 7 ++++ .../base/zen-components/ZenGlanceManager.mjs | 26 +++++++++++---- .../base/zen-components/ZenWorkspaces.mjs | 4 +-- 8 files changed, 36 insertions(+), 44 deletions(-) create mode 100644 src/browser/base/content/zen-vendor/motion.min.mjs diff --git a/src/browser/base/content/ZenUIManager.mjs b/src/browser/base/content/ZenUIManager.mjs index 6e3fbd5d3..c0bbd8957 100644 --- a/src/browser/base/content/ZenUIManager.mjs +++ b/src/browser/base/content/ZenUIManager.mjs @@ -8,6 +8,10 @@ var gZenUIManager = { XPCOMUtils.defineLazyPreferenceGetter(this, 'sidebarHeightThrottle', 'zen.view.sidebar-height-throttle', 500); XPCOMUtils.defineLazyPreferenceGetter(this, 'contentElementSeparation', 'zen.theme.content-element-separation', 0); + ChromeUtils.defineLazyGetter(this, 'motion', () => { + return ChromeUtils.importESModule('chrome://browser/content/zen-vendor/motion.min.mjs', { global: "current" }); + }); + new ResizeObserver(gZenCommonActions.throttle(this.updateTabsToolbar.bind(this), this.sidebarHeightThrottle)).observe( document.getElementById('tabbrowser-tabs') ); diff --git a/src/browser/base/content/zen-assets.jar.inc.mn b/src/browser/base/content/zen-assets.jar.inc.mn index 1db5d1874..11ae40418 100644 --- a/src/browser/base/content/zen-assets.jar.inc.mn +++ b/src/browser/base/content/zen-assets.jar.inc.mn @@ -75,3 +75,4 @@ # JS Vendor content/browser/zen-vendor/tsparticles.confetti.bundle.min.js (content/zen-vendor/tsparticles.confetti.bundle.min.js) + content/browser/zen-vendor/motion.min.mjs (content/zen-vendor/motion.min.mjs) diff --git a/src/browser/base/content/zen-styles/zen-animations.css b/src/browser/base/content/zen-styles/zen-animations.css index 09b31494c..78fa7cfe1 100644 --- a/src/browser/base/content/zen-styles/zen-animations.css +++ b/src/browser/base/content/zen-styles/zen-animations.css @@ -252,38 +252,6 @@ } } -@keyframes zen-glance-content-animation { - /* make the box appear from initial width/height and x/y coordinates */ - 0% { - opacity: 0; - top: 50%; - left: 50%; - transform: translate(-50%, -50%) translateZ(0); - width: 0%; - height: 0%; - } - - 80% { - /* make the box grow to full width/height */ - opacity: 1; - transform: translate(-50%, -50%) translateZ(0); - top: 50%; - left: 50%; - width: 87%; - height: 102%; - } - - 100% { - /* make the box shrink to final width/height and x/y coordinates */ - transform: translate(-50%, -50%) translateZ(0); - opacity: 1; - width: 85%; - height: 100%; - top: 50%; - left: 50%; - } -} - @keyframes zen-glance-content-animation-out { 0% { /* make the box shrink to final width/height and x/y coordinates */ diff --git a/src/browser/base/content/zen-styles/zen-glance.css b/src/browser/base/content/zen-styles/zen-glance.css index 03396a3a7..ce2e4e2f0 100644 --- a/src/browser/base/content/zen-styles/zen-glance.css +++ b/src/browser/base/content/zen-styles/zen-glance.css @@ -105,7 +105,6 @@ height: 100%; opacity: 1; transition: opacity 0.2s ease-in-out; - transition-delay: 0.1s; } &[animate-full='true'] { @@ -118,7 +117,8 @@ } &[animate='true'] { - animation: zen-glance-content-animation 0.4s ease-in-out forwards; + position: absolute; + transform: translate(-50%, -50%); &:not([animate-end='true']) { pointer-events: none; diff --git a/src/browser/base/content/zen-styles/zen-theme.css b/src/browser/base/content/zen-styles/zen-theme.css index e311ca693..ca1bcc4e3 100644 --- a/src/browser/base/content/zen-styles/zen-theme.css +++ b/src/browser/base/content/zen-styles/zen-theme.css @@ -103,7 +103,7 @@ --zen-button-border-radius: 5px; --zen-button-padding: 0.6rem 1.2rem; - --zen-toolbar-element-bg: light-dark(rgba(255, 255, 255, 0.4), rgba(170, 170, 170, 0.2)); + --zen-toolbar-element-bg: light-dark(rgba(255, 255, 255, 0.65), rgba(170, 170, 170, 0.2)); /* Toolbar */ --zen-toolbar-height: 38px; diff --git a/src/browser/base/content/zen-vendor/motion.min.mjs b/src/browser/base/content/zen-vendor/motion.min.mjs new file mode 100644 index 000000000..915552945 --- /dev/null +++ b/src/browser/base/content/zen-vendor/motion.min.mjs @@ -0,0 +1,7 @@ +/** + * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.37.0. + * Original file: /npm/motion@11.17.0/dist/es/motion/lib/index.mjs + * + * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files + */ +const t=!1;function e(){return t}const n=t=>t;let s=n;const i=(t,e,n)=>{const s=e-t;return 0===s?1:(n-t)/s};function r(t){let e;return()=>(void 0===e&&(e=t()),e)}const o=r((()=>void 0!==window.ScrollTimeline));class a{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map((t=>"finished"in t?t.finished:t)))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;no()&&n.attachTimeline?n.attachTimeline(t):"function"==typeof e?e(n):void 0));return()=>{n.forEach(((t,e)=>{t&&t(),this.animations[e].stop()}))}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;ee[t]()))}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class l extends a{then(t,e){return Promise.all(this.animations).then(t).catch(e)}}const u=t=>1e3*t,c=t=>t/1e3,h=2e4;function d(t){let e=0;let n=t.next(e);for(;!n.done&&e=h?1/0:e}const p=(t,e,n=10)=>{let s="";const r=Math.max(Math.round(e/n),2);for(let e=0;en>e?e:n{const s=e*o,i=s*t,r=s-n,a=R(e,o),l=Math.exp(-i);return C-r/a*l},r=e=>{const s=e*o*t,r=s*n+n,a=Math.pow(o,2)*Math.pow(e,2)*t,l=Math.exp(-s),u=R(Math.pow(e,2),o);return(-i(e)+C>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 s=n;for(let n=1;nvoid 0!==t[e]))}function L(t=S,e=T){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:i}=n;const r=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:l,damping:m,mass:x,duration:M,velocity:P,isResolvedFromDuration:k}=function(t){let e={velocity:b,stiffness:y,damping:v,mass:w,isResolvedFromDuration:!1,...t};if(!D(t,I)&&D(t,B))if(t.visualDuration){const n=t.visualDuration,s=2*Math.PI/(1.2*n),i=s*s,r=2*f(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:w,stiffness:i,damping:r}}else{const n=E(t);e={...e,...n,mass:w},e.isResolvedFromDuration=!0}return e}({...n,velocity:-c(n.velocity||0)}),F=P||0,C=m/(2*Math.sqrt(l*x)),O=o-r,L=c(Math.sqrt(l/x)),W=Math.abs(O)<5;let N;if(s||(s=W?A.granular:A.default),i||(i=W?V.granular:V.default),C<1){const t=R(L,C);N=e=>{const n=Math.exp(-C*L*e);return o-n*((F+C*L*O)/t*Math.sin(t*e)+O*Math.cos(t*e))}}else if(1===C)N=t=>o-Math.exp(-L*t)*(O+(F+L*O)*t);else{const t=L*Math.sqrt(C*C-1);N=e=>{const n=Math.exp(-C*L*e),s=Math.min(t*e,300);return o-n*((F+C*L*O)*Math.sinh(s)+t*O*Math.cosh(s))/t}}const K={calculatedDuration:k&&M||null,next:t=>{const e=N(t);if(k)a.done=t>=M;else{let n=0;C<1&&(n=0===t?u(F):g(N,t,e));const r=Math.abs(n)<=s,l=Math.abs(o-e)<=i;a.done=r&&l}return a.value=a.done?o:e,a},toString:()=>{const t=Math.min(d(K),h),e=p((e=>K.next(t*e).value),t,30);return t+"ms "+e}};return K}function W(t,e=100,n){const s=n({...t,keyframes:[0,e]}),i=Math.min(d(s),h);return{type:"keyframes",ease:t=>s.next(i*t).value/e,duration:c(i)}}function N(t){return"function"==typeof t}const K=(t,e,n)=>{const s=e-t;return((n-t)%s+s)%s+t},$=t=>Array.isArray(t)&&"number"!=typeof t[0];function j(t,e){return $(t)?t[K(0,t.length,e)]:t}const z=(t,e,n)=>t+(e-t)*n;function H(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const r=i(0,e,s);t.push(z(n,1,r))}}function U(t){const e=[0];return H(e,t.length-1),e}const Y=t=>Boolean(t&&t.getVelocity);function q(t,e,n){var s;if(t instanceof Element)return[t];if("string"==typeof t){let i=document;e&&(i=e.current);const r=null!==(s=null==n?void 0:n[t])&&void 0!==s?s:i.querySelectorAll(t);return r?Array.from(r):[]}return Array.from(t)}function X(t){return"object"==typeof t&&!Array.isArray(t)}function G(t,e,n,s){return"string"==typeof t&&X(e)?q(t,n,s):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function Z(t,e,n){return t*(e+1)}function _(t,e,n,s){var i;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(i=s.get(e))&&void 0!==i?i:t}function J(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}function Q(t,e,n,s,i,r){!function(t,e,n){for(let s=0;se&&i.at"number"==typeof t,at=t=>t.every(ot),lt=new WeakMap;function ut(t,e){return t?t[e]||t.default||t:void 0}const ct=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ht=new Set(ct),dt=new Set(["width","height","top","left","right","bottom",...ct]),pt=t=>(t=>Array.isArray(t))(t)?t[t.length-1]||0:t,ft=!1;const mt=["read","resolveKeyframes","update","preRender","render","postRender"];const{schedule:gt,cancel:yt,state:vt,steps:wt}=function(t,e){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,o=mt.reduce(((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,s=!1,i=!1;const r=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(e){r.has(e)&&(l.schedule(e),t()),e(o)}const l={schedule:(t,i=!1,o=!1)=>{const a=o&&s?e:n;return i&&r.add(t),a.has(t)||a.add(t),t},cancel:t=>{n.delete(t),r.delete(t)},process:t=>{o=t,s?i=!0:(s=!0,[e,n]=[n,e],e.forEach(a),e.clear(),s=!1,i&&(i=!1,l.process(t)))}};return l}(r),t)),{}),{read:a,resolveKeyframes:l,update:u,preRender:c,render:h,postRender:d}=o,p=()=>{const r=performance.now();n=!1,i.delta=s?1e3/60:Math.max(Math.min(r-i.timestamp,40),1),i.timestamp=r,i.isProcessing=!0,a.process(i),l.process(i),u.process(i),c.process(i),h.process(i),d.process(i),i.isProcessing=!1,n&&e&&(s=!1,t(p))};return{schedule:mt.reduce(((e,r)=>{const a=o[r];return e[r]=(e,r=!1,o=!1)=>(n||(n=!0,s=!0,i.isProcessing||t(p)),a.schedule(e,r,o)),e}),{}),cancel:t=>{for(let e=0;e(void 0===bt&&Tt.set(vt.isProcessing||ft?vt.timestamp:performance.now()),bt),set:t=>{bt=t,queueMicrotask(xt)}};class St{constructor(){this.subscriptions=[]}add(t){var e,n;return e=this.subscriptions,n=t,-1===e.indexOf(n)&&e.push(n),()=>J(this.subscriptions,t)}notify(t,e,n){const s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](t,e,n);else for(let i=0;i{const n=Tt.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=Tt.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new St);const n=this.events[t].add(e);return"change"===t?()=>{n(),gt.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Tt.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return m(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Vt(t,e){return new At(t,e)}function Mt(t){const e=[{},{}];return null==t||t.values.forEach(((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()})),e}function Pt(t,e,n,s){if("function"==typeof e){const[i,r]=Mt(s);e=e(void 0!==n?n:t.custom,i,r)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[i,r]=Mt(s);e=e(void 0!==n?n:t.custom,i,r)}return e}function kt(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Vt(n))}function Ft(t,e){const n=function(t,e,n){const s=t.getProps();return Pt(s,e,void 0!==n?n:s.custom,t)}(t,e);let{transitionEnd:s={},transition:i={},...r}=n||{};r={...r,...s};for(const e in r){kt(t,e,pt(r[e]))}}function Ct(t,e){const n=t.getValue("willChange");if(s=n,Boolean(Y(s)&&s.add))return n.add(e);var s}const Et=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Ot="data-"+Et("framerAppearId");function Rt(t){return t.props[Ot]}function Bt(t,e){t.timeline=e,t.onfinish=null}const It=t=>Array.isArray(t)&&"number"==typeof t[0],Dt={linearEasing:void 0};function Lt(t,e){const n=r(t);return()=>{var t;return null!==(t=Dt[e])&&void 0!==t?t:n()}}const Wt=Lt((()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}),"linearEasing");function Nt(t){return Boolean("function"==typeof t&&Wt()||!t||"string"==typeof t&&(t in $t||Wt())||It(t)||Array.isArray(t)&&t.every(Nt))}const Kt=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,$t={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Kt([0,.65,.55,1]),circOut:Kt([.55,0,1,.45]),backIn:Kt([.31,.01,.66,-.59]),backOut:Kt([.33,1.53,.69,.99])};function jt(t,e){return t?"function"==typeof t&&Wt()?p(t,e):It(t)?Kt(t):Array.isArray(t)?t.map((t=>jt(t,e)||$t.easeOut)):$t[t]:void 0}const zt=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function Ht(t,e,s,i){if(t===e&&s===i)return n;const r=e=>function(t,e,n,s,i){let r,o,a=0;do{o=e+(n-e)/2,r=zt(o,s,i)-t,r>0?n=o:e=o}while(Math.abs(r)>1e-7&&++a<12);return o}(e,0,1,t,s);return t=>0===t||1===t?t:zt(r(t),e,i)}const Ut=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Yt=t=>e=>1-t(1-e),qt=Ht(.33,1.53,.69,.99),Xt=Yt(qt),Gt=Ut(Xt),Zt=t=>(t*=2)<1?.5*Xt(t):.5*(2-Math.pow(2,-10*(t-1))),_t=t=>1-Math.sin(Math.acos(t)),Jt=Yt(_t),Qt=Ut(_t),te=t=>/^0[^.\s]+$/u.test(t);const ee={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},ne={...ee,transform:t=>f(0,1,t)},se={...ee,default:1},ie=t=>Math.round(1e5*t)/1e5,re=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const oe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,ae=(t,e)=>n=>Boolean("string"==typeof n&&oe.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),le=(t,e,n)=>s=>{if("string"!=typeof s)return s;const[i,r,o,a]=s.match(re);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(o),alpha:void 0!==a?parseFloat(a):1}},ue={...ee,transform:t=>Math.round((t=>f(0,255,t))(t))},ce={test:ae("rgb","red"),parse:le("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+ue.transform(t)+", "+ue.transform(e)+", "+ue.transform(n)+", "+ie(ne.transform(s))+")"};const he={test:ae("#"),parse:function(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}},transform:ce.transform},de=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),pe=de("deg"),fe=de("%"),me=de("px"),ge=de("vh"),ye=de("vw"),ve={...fe,parse:t=>fe.parse(t)/100,transform:t=>fe.transform(100*t)},we={test:ae("hsl","hue"),parse:le("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+fe.transform(ie(e))+", "+fe.transform(ie(n))+", "+ie(ne.transform(s))+")"},be={test:t=>ce.test(t)||he.test(t)||we.test(t),parse:t=>ce.test(t)?ce.parse(t):we.test(t)?we.parse(t):he.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?ce.transform(t):we.transform(t)},xe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const Te="number",Se="color",Ae=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ve(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const o=e.replace(Ae,(t=>(be.test(t)?(s.color.push(r),i.push(Se),n.push(be.parse(t))):t.startsWith("var(")?(s.var.push(r),i.push("var"),n.push(t)):(s.number.push(r),i.push(Te),n.push(parseFloat(t))),++r,"${}"))).split("${}");return{values:n,split:o,indexes:s,types:i}}function Me(t){return Ve(t).values}function Pe(t){const{split:e,types:n}=Ve(t),s=e.length;return t=>{let i="";for(let r=0;r"number"==typeof t?0:t;const Fe={test:function(t){var e,n;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(re))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(xe))||void 0===n?void 0:n.length)||0)>0},parse:Me,createTransformer:Pe,getAnimatableNone:function(t){const e=Me(t);return Pe(t)(e.map(ke))}},Ce=new Set(["brightness","contrast","saturate","opacity"]);function Ee(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[s]=n.match(re)||[];if(!s)return t;const i=n.replace(s,"");let r=Ce.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const Oe=/\b([a-z-]*)\(.*?\)/gu,Re={...Fe,getAnimatableNone:t=>{const e=t.match(Oe);return e?e.map(Ee).join(" "):t}},Be={borderWidth:me,borderTopWidth:me,borderRightWidth:me,borderBottomWidth:me,borderLeftWidth:me,borderRadius:me,radius:me,borderTopLeftRadius:me,borderTopRightRadius:me,borderBottomRightRadius:me,borderBottomLeftRadius:me,width:me,maxWidth:me,height:me,maxHeight:me,top:me,right:me,bottom:me,left:me,padding:me,paddingTop:me,paddingRight:me,paddingBottom:me,paddingLeft:me,margin:me,marginTop:me,marginRight:me,marginBottom:me,marginLeft:me,backgroundPositionX:me,backgroundPositionY:me},Ie={rotate:pe,rotateX:pe,rotateY:pe,rotateZ:pe,scale:se,scaleX:se,scaleY:se,scaleZ:se,skew:pe,skewX:pe,skewY:pe,distance:me,translateX:me,translateY:me,translateZ:me,x:me,y:me,z:me,perspective:me,transformPerspective:me,opacity:ne,originX:ve,originY:ve,originZ:me},De={...ee,transform:Math.round},Le={...Be,...Ie,zIndex:De,size:me,fillOpacity:ne,strokeOpacity:ne,numOctaves:De},We={...Le,color:be,backgroundColor:be,outlineColor:be,fill:be,stroke:be,borderColor:be,borderTopColor:be,borderRightColor:be,borderBottomColor:be,borderLeftColor:be,filter:Re,WebkitFilter:Re},Ne=t=>We[t];function Ke(t,e){let n=Ne(t);return n!==Re&&(n=Fe),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const $e=new Set(["auto","none","0"]);const je=t=>t===ee||t===me,ze=(t,e)=>parseFloat(t.split(", ")[e]),He=(t,e)=>(n,{transform:s})=>{if("none"===s||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/u);if(i)return ze(i[1],e);{const e=s.match(/^matrix\((.+)\)$/u);return e?ze(e[1],t):0}},Ue=new Set(["x","y","z"]),Ye=ct.filter((t=>!Ue.has(t)));const qe={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:He(4,13),y:He(5,14)};qe.translateX=qe.x,qe.translateY=qe.y;const Xe=new Set;let Ge=!1,Ze=!1;function _e(){if(Ze){const t=Array.from(Xe).filter((t=>t.needsMeasurement)),e=new Set(t.map((t=>t.element))),n=new Map;e.forEach((t=>{const e=function(t){const e=[];return Ye.forEach((n=>{const s=t.getValue(n);void 0!==s&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))})),e}(t);e.length&&(n.set(t,e),t.render())})),t.forEach((t=>t.measureInitialState())),e.forEach((t=>{t.render();const e=n.get(t);e&&e.forEach((([e,n])=>{var s;null===(s=t.getValue(e))||void 0===s||s.set(n)}))})),t.forEach((t=>t.measureEndState())),t.forEach((t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)}))}Ze=!1,Ge=!1,Xe.forEach((t=>t.complete())),Xe.clear()}function Je(){Xe.forEach((t=>{t.readKeyframes(),t.needsMeasurement&&(Ze=!0)}))}class Qe{constructor(t,e,n,s,i,r=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=s,this.element=i,this.isAsync=r}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Xe.add(this),Ge||(Ge=!0,gt.read(Je),gt.resolveKeyframes(_e))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:s}=this;for(let i=0;i/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),en=t=>e=>"string"==typeof e&&e.startsWith(t),nn=en("--"),sn=en("var(--"),rn=t=>!!sn(t)&&on.test(t.split("/*")[0].trim()),on=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,an=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function ln(t,e,n=1){const[s,i]=function(t){const e=an.exec(t);if(!e)return[,];const[,n,s,i]=e;return[`--${null!=n?n:s}`,i]}(t);if(!s)return;const r=window.getComputedStyle(e).getPropertyValue(s);if(r){const t=r.trim();return tn(t)?parseFloat(t):t}return rn(i)?ln(i,e,n+1):i}const un=t=>e=>e.test(t),cn=[ee,me,fe,pe,ye,ge,{test:t=>"auto"===t,parse:t=>t}],hn=t=>cn.find(un(t));class dn extends Qe{constructor(t,e,n,s,i){super(t,e,n,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n{e.getValue(t).set(n)})),this.resolveNoneKeyframes()}}const pn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Fe.test(t)&&"0"!==t||t.startsWith("url(")));function fn(t,e,n,s){const i=t[0];if(null===i)return!1;if("display"===e||"visibility"===e)return!0;const r=t[t.length-1],o=pn(i,e),a=pn(r,e);return!(!o||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;nnull!==t;function gn(t,{repeat:e,repeatType:n="loop"},s){const i=t.filter(mn),r=e&&"loop"!==n&&e%2==1?0:i.length-1;return r&&void 0!==s?s:i[r]}class yn{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:r="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Tt.now(),this.options={autoplay:t,delay:e,type:n,repeat:s,repeatDelay:i,repeatType:r,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(Je(),_e()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=Tt.now(),this.hasAttemptedResolve=!0;const{name:n,type:s,velocity:i,delay:r,onComplete:o,onUpdate:a,isGenerator:l}=this.options;if(!l&&!fn(t,n,s,i)){if(!r)return null==a||a(gn(t,this.options,e)),null==o||o(),void this.resolveFinishedPromise();this.options.duration=0}const u=this.initPlayback(t,e);!1!==u&&(this._resolved={keyframes:t,finalKeyframe:e,...u},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}}function vn(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 wn(t,e){return n=>n>0?e:t}const bn=(t,e,n)=>{const s=t*t,i=n*(e*e-s)+s;return i<0?0:Math.sqrt(i)},xn=[he,ce,we];function Tn(t){const e=(n=t,xn.find((t=>t.test(n))));var n;if(!Boolean(e))return!1;let s=e.parse(t);return e===we&&(s=function({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,n/=100;let i=0,r=0,o=0;if(e/=100){const s=n<.5?n*(1+e):n+e-n*e,a=2*n-s;i=vn(a,s,t+1/3),r=vn(a,s,t),o=vn(a,s,t-1/3)}else i=r=o=n;return{red:Math.round(255*i),green:Math.round(255*r),blue:Math.round(255*o),alpha:s}}(s)),s}const Sn=(t,e)=>{const n=Tn(t),s=Tn(e);if(!n||!s)return wn(t,e);const i={...n};return t=>(i.red=bn(n.red,s.red,t),i.green=bn(n.green,s.green,t),i.blue=bn(n.blue,s.blue,t),i.alpha=z(n.alpha,s.alpha,t),ce.transform(i))},An=(t,e)=>n=>e(t(n)),Vn=(...t)=>t.reduce(An),Mn=new Set(["none","hidden"]);function Pn(t,e){return n=>z(t,e,n)}function kn(t){return"number"==typeof t?Pn:"string"==typeof t?rn(t)?wn:be.test(t)?Sn:En:Array.isArray(t)?Fn:"object"==typeof t?be.test(t)?Sn:Cn:wn}function Fn(t,e){const n=[...t],s=n.length,i=t.map(((t,n)=>kn(t)(t,e[n])));return t=>{for(let e=0;e{for(const e in s)n[e]=s[e](t);return n}}const En=(t,e)=>{const n=Fe.createTransformer(e),s=Ve(t),i=Ve(e);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?Mn.has(t)&&!i.values.length||Mn.has(e)&&!s.values.length?function(t,e){return Mn.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):Vn(Fn(function(t,e){var n;const s=[],i={color:0,var:0,number:0};for(let r=0;rvoid 0===a?l:void 0===l||Math.abs(a-t)-f*Math.exp(-t/s),w=t=>y+v(t),b=t=>{const e=v(t),n=w(t);d.done=Math.abs(e)<=u,d.value=d.done?y:n};let x,T;const S=t=>{var e;(e=d.value,void 0!==a&&el)&&(x=t,T=L({keyframes:[d.value,p(d.value)],velocity:g(w,t,d.value),damping:i,stiffness:r,restDelta:u,restSpeed:c}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return T||void 0!==x||(e=!0,b(t),S(t)),void 0!==x&&t>=x?T.next(t-x):(!e&&b(t),d)}}}const Bn=Ht(.42,0,1,1),In=Ht(0,0,.58,1),Dn=Ht(.42,0,.58,1),Ln={linear:n,easeIn:Bn,easeInOut:Dn,easeOut:In,circIn:_t,circInOut:Qt,circOut:Jt,backIn:Xt,backInOut:Gt,backOut:qt,anticipate:Zt},Wn=t=>{if(It(t)){s(4===t.length);const[e,n,i,r]=t;return Ht(e,n,i,r)}return"string"==typeof t?Ln[t]:t};function Nn(t,e,{clamp:r=!0,ease:o,mixer:a}={}){const l=t.length;if(s(l===e.length),1===l)return()=>e[0];if(2===l&&e[0]===e[1])return()=>e[1];const u=t[0]===t[1];t[0]>t[l-1]&&(t=[...t].reverse(),e=[...e].reverse());const c=function(t,e,s){const i=[],r=s||On,o=t.length-1;for(let s=0;s{if(u&&n1)for(;sd(f(t[0],t[l-1],e)):d}function Kn({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const i=$(s)?s.map(Wn):Wn(s),r={done:!1,value:e[0]},o=function(t,e){return t.map((t=>t*e))}(n&&n.length===e.length?n:U(e),t),a=Nn(o,e,{ease:Array.isArray(i)?i:(l=e,u=i,l.map((()=>u||Dn)).splice(0,l.length-1))});var l,u;return{calculatedDuration:t,next:e=>(r.value=a(e),r.done=e>=t,r)}}const $n=t=>{const e=({timestamp:e})=>t(e);return{start:()=>gt.update(e,!0),stop:()=>yt(e),now:()=>vt.isProcessing?vt.timestamp:Tt.now()}},jn={decay:Rn,inertia:Rn,tween:Kn,keyframes:Kn,spring:L},zn=t=>t/100;class Hn extends yn{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:n,element:s,keyframes:i}=this.options,r=(null==s?void 0:s.KeyframeResolver)||Qe;this.resolver=new r(i,((t,e)=>this.onKeyframesResolved(t,e)),e,n,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:e="keyframes",repeat:n=0,repeatDelay:s=0,repeatType:i,velocity:r=0}=this.options,o=N(e)?e:jn[e]||Kn;let a,l;o!==Kn&&"number"!=typeof t[0]&&(a=Vn(zn,On(t[0],t[1])),t=[0,100]);const u=o({...this.options,keyframes:t});"mirror"===i&&(l=o({...this.options,keyframes:[...t].reverse(),velocity:-r})),null===u.calculatedDuration&&(u.calculatedDuration=d(u));const{calculatedDuration:c}=u,h=c+s;return{generator:u,mirroredGenerator:l,mapPercentToKeyframes:a,calculatedDuration:c,resolvedDuration:h,totalDuration:h*(n+1)-s}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:n}=this;if(!n){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:r,mapPercentToKeyframes:o,keyframes:a,calculatedDuration:l,totalDuration:u,resolvedDuration:c}=n;if(null===this.startTime)return i.next(0);const{delay:h,repeat:d,repeatType:p,repeatDelay:m,onUpdate:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-u/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const y=this.currentTime-h*(this.speed>=0?1:-1),v=this.speed>=0?y<0:y>u;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=u);let w=this.currentTime,b=i;if(d){const t=Math.min(this.currentTime,u)/c;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,d+1);Boolean(e%2)&&("reverse"===p?(n=1-n,m&&(n-=m/c)):"mirror"===p&&(b=r)),w=f(0,1,n)*c}const x=v?{done:!1,value:a[0]}:b.next(w);o&&(x.value=o(x.value));let{done:T}=x;v||null===l||(T=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&T);return S&&void 0!==s&&(x.value=gn(a,this.options,s)),g&&g(x.value),S&&this.finish(),x}get duration(){const{resolved:t}=this;return t?c(t.calculatedDuration):0}get time(){return c(this.currentTime)}set time(t){t=u(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=c(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=$n,onPlay:e,startTime:n}=this.options;this.driver||(this.driver=t((t=>this.tick(t)))),e&&e();const s=this.driver.now();null!==this.holdTime?this.startTime=s-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=s):this.startTime=null!=n?n:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const Un=new Set(["opacity","clipPath","filter","transform"]);function Yn(t,e,n,{delay:s=0,duration:i=300,repeat:r=0,repeatType:o="loop",ease:a="easeInOut",times:l}={}){const u={[e]:n};l&&(u.offset=l);const c=jt(a,i);return Array.isArray(c)&&(u.easing=c),t.animate(u,{delay:s,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:r+1,direction:"reverse"===o?"alternate":"normal"})}const qn=r((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));const Xn={anticipate:Zt,backInOut:Gt,circInOut:Qt};class Gn extends yn{constructor(t){super(t);const{name:e,motionValue:n,element:s,keyframes:i}=this.options;this.resolver=new dn(i,((t,e)=>this.onKeyframesResolved(t,e)),e,n,s),this.resolver.scheduleResolve()}initPlayback(t,e){var n;let{duration:s=300,times:i,ease:r,type:o,motionValue:a,name:l,startTime:u}=this.options;if(!(null===(n=a.owner)||void 0===n?void 0:n.current))return!1;var c;if("string"==typeof r&&Wt()&&r in Xn&&(r=Xn[r]),N((c=this.options).type)||"spring"===c.type||!Nt(c.ease)){const{onComplete:e,onUpdate:n,motionValue:a,element:l,...u}=this.options,c=function(t,e){const n=new Hn({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:t[0]};const i=[];let r=0;for(;!s.done&&r<2e4;)s=n.sample(r),i.push(s.value),r+=10;return{times:void 0,keyframes:i,duration:r-10,ease:"linear"}}(t,u);1===(t=c.keyframes).length&&(t[1]=t[0]),s=c.duration,i=c.times,r=c.ease,o="keyframes"}const h=Yn(a.owner.current,l,t,{...this.options,duration:s,times:i,ease:r});return h.startTime=null!=u?u:this.calcStartTime(),this.pendingTimeline?(Bt(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:n}=this.options;a.set(gn(t,this.options,e)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:h,duration:s,times:i,type:o,ease:r,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return c(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return c(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.currentTime=u(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(t){if(this._resolved){const{resolved:e}=this;if(!e)return n;const{animation:s}=e;Bt(s,t)}else this.pendingTimeline=t;return n}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:n,duration:s,type:i,ease:r,times:o}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:a,element:l,...c}=this.options,h=new Hn({...c,keyframes:n,duration:s,type:i,ease:r,times:o,isGenerator:!0}),d=u(this.time);t.setWithVelocity(h.sample(d-10).value,h.sample(d).value,10)}const{onStop:a}=this.options;a&&a(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:n,repeatDelay:s,repeatType:i,damping:r,type:o}=t;return qn()&&n&&Un.has(n)&&e&&e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate&&!s&&"mirror"!==i&&0!==r&&"inertia"!==o}}const Zn={type:"spring",stiffness:500,damping:25,restSpeed:10},_n={type:"keyframes",duration:.8},Jn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Qn=(t,{keyframes:e})=>e.length>2?_n:ht.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Zn:Jn;const ts=(t,e,n,s={},i,r)=>o=>{const a=ut(s,t)||{},c=a.delay||s.delay||0;let{elapsed:h=0}=s;h-=u(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-h,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:r?void 0:i};(function({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:r,repeatType:o,repeatDelay:a,from:l,elapsed:u,...c}){return!!Object.keys(c).length})(a)||(d={...d,...Qn(t,d)}),d.duration&&(d.duration=u(d.duration)),d.repeatDelay&&(d.repeatDelay=u(d.repeatDelay)),void 0!==d.from&&(d.keyframes[0]=d.from);let p=!1;if((!1===d.type||0===d.duration&&!d.repeatDelay)&&(d.duration=0,0===d.delay&&(p=!0)),p&&!r&&void 0!==e.get()){const t=gn(d.keyframes,a);if(void 0!==t)return gt.update((()=>{d.onUpdate(t),d.onComplete()})),new l([])}return!r&&Gn.supports(d)?new Gn(d):new Hn(d)};function es({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,s}function ns(t,e,{delay:n=0,transitionOverride:s,type:i}={}){var r;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...l}=e;s&&(o=s);const u=[],c=i&&t.animationState&&t.animationState.getState()[i];for(const e in l){const s=t.getValue(e,null!==(r=t.latestValues[e])&&void 0!==r?r:null),i=l[e];if(void 0===i||c&&es(c,e))continue;const a={delay:n,...ut(o||{},e)};let h=!1;if(window.MotionHandoffAnimation){const n=Rt(t);if(n){const t=window.MotionHandoffAnimation(n,e,gt);null!==t&&(a.startTime=t,h=!0)}}Ct(t,e),s.start(ts(e,s,i,t.shouldReduceMotion&&dt.has(e)?{type:!1}:a,t,h));const d=s.animation;d&&u.push(d)}return a&&Promise.all(u).then((()=>{gt.update((()=>{a&&Ft(t,a)}))})),u}const ss=()=>({x:{min:0,max:0},y:{min:0,max:0}}),is={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},rs={};for(const t in is)rs[t]={isEnabled:e=>is[t].some((t=>!!e[t]))};const os="undefined"!=typeof window,as={current:null},ls={current:!1};const us=[...cn,be,Fe];const cs=["initial","animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"];function hs(t){return null!==(e=t.animate)&&"object"==typeof e&&"function"==typeof e.start||cs.some((e=>function(t){return"string"==typeof t||Array.isArray(t)}(t[e])));var e}const ds=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class ps{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:s,blockInitialAnimation:i,visualState:r},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Qe,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=Tt.now();this.renderScheduledAtthis.bindToMotionValue(e,t))),ls.current||function(){if(ls.current=!0,os)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>as.current=t.matches;t.addListener(e),e()}else as.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||as.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){lt.delete(this.current),this.projection&&this.projection.unmount(),yt(this.notifyUpdate),yt(this.render),this.valueSubscriptions.forEach((t=>t())),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=ht.has(t),s=e.on("change",(e=>{this.latestValues[t]=e,this.props.onUpdate&>.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),i=e.on("renderRequest",this.scheduleRender);let r;window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,(()=>{s(),i(),r&&r(),e.owner&&e.stop()}))}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in rs){const e=rs[t];if(!e)continue;const{isEnabled:n,Feature:s}=e;if(!this.features[t]&&s&&n(this.props)&&(this.features[t]=new s(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;ee.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=Vt(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){var n;let s=void 0===this.latestValues[t]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,t))&&void 0!==n?n:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var i;return null!=s&&("string"==typeof s&&(tn(s)||te(s))?s=parseFloat(s):(i=s,!us.find(un(i))&&Fe.test(e)&&(s=Ke(t,e))),this.setBaseTarget(t,Y(s)?s.get():s)),Y(s)?s.get():s}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props;let s;if("string"==typeof n||"object"==typeof n){const i=Pt(this.props,n,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);i&&(s=i[t])}if(n&&void 0!==s)return s;const i=this.getBaseTargetFromProps(this.props,t);return void 0===i||Y(i)?void 0!==this.initialValues[t]&&void 0===s?void 0:this.baseTarget[t]:i}on(t,e){return this.events[t]||(this.events[t]=new St),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class fs extends ps{constructor(){super(...arguments),this.KeyframeResolver=dn}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Y(t)&&(this.childSubscription=t.on("change",(t=>{this.current&&(this.current.textContent=`${t}`)})))}}const ms=(t,e)=>e&&"number"==typeof t?e.transform(t):t,gs={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ys=ct.length;function vs(t,e,n){const{style:s,vars:i,transformOrigin:r}=t;let o=!1,a=!1;for(const t in e){const n=e[t];if(ht.has(t))o=!0;else if(nn(t))i[t]=n;else{const e=ms(n,Le[t]);t.startsWith("origin")?(a=!0,r[t]=e):s[t]=e}}if(e.transform||(o||n?s.transform=function(t,e,n){let s="",i=!0;for(let r=0;r{const l=it(t),{delay:c=0,times:h=U(l),type:d="keyframes",repeat:m,repeatType:g,repeatDelay:v=0,...w}=n;let{ease:b=e.ease||"easeOut",duration:x}=n;const T="function"==typeof c?c(i,a):c,S=l.length,A=N(d)?d:null==r?void 0:r[d];if(S<=2&&A){let t=100;if(2===S&&at(l)){const e=l[1]-l[0];t=Math.abs(e)}const e={...w};void 0!==x&&(e.duration=u(x));const n=W(e,t,A);b=n.ease,x=n.duration}null!=x||(x=o);const V=p+T;1===h.length&&0===h[0]&&(h[1]=1);const M=h.length-l.length;if(M>0&&H(h,M),1===l.length&&l.unshift(null),m){x=Z(x,m);const t=[...l],e=[...h];b=Array.isArray(b)?[...b]:[b];const n=[...b];for(let s=0;s{for(const r in t){const o=t[r];o.sort(et);const l=[],u=[],c=[];for(let t=0;t{s.push(...Rs(n,t,e))})),s}function Is(t){return function(e,n,s){let i=[];var r;r=e,i=Array.isArray(r)&&r.some(Array.isArray)?Bs(e,n,t):Rs(e,n,s,t);const o=new l(i);return t&&t.animations.push(o),o}}const Ds=Is();class Ls{constructor(t){this.animation=t}get duration(){var t,e,n;const s=(null===(e=null===(t=this.animation)||void 0===t?void 0:t.effect)||void 0===e?void 0:e.getComputedTiming().duration)||(null===(n=this.options)||void 0===n?void 0:n.duration)||300;return c(Number(s))}get time(){var t;return this.animation?c((null===(t=this.animation)||void 0===t?void 0:t.currentTime)||0):0}set time(t){this.animation&&(this.animation.currentTime=u(t))}get speed(){return this.animation?this.animation.playbackRate:1}set speed(t){this.animation&&(this.animation.playbackRate=t)}get state(){return this.animation?this.animation.playState:"finished"}get startTime(){return this.animation?this.animation.startTime:null}get finished(){return this.animation?this.animation.finished:Promise.resolve()}play(){this.animation&&this.animation.play()}pause(){this.animation&&this.animation.pause()}stop(){this.animation&&"idle"!==this.state&&"finished"!==this.state&&(this.animation.commitStyles&&this.animation.commitStyles(),this.cancel())}flatten(){var t;this.animation&&(null===(t=this.animation.effect)||void 0===t||t.updateTiming({easing:"linear"}))}attachTimeline(t){return this.animation&&Bt(this.animation,t),n}complete(){this.animation&&this.animation.finish()}cancel(){try{this.animation&&this.animation.cancel()}catch(t){}}}function Ws(t,e,n){t.style.setProperty(`--${e}`,n)}function Ns(t,e,n){t.style[e]=n}const Ks=r((()=>{try{document.createElement("div").animate({opacity:[1]})}catch(t){return!1}return!0})),$s=new WeakMap;const js="easeOut";function zs(t){const e=$s.get(t)||new Map;return $s.set(t,e),$s.get(t)}class Hs extends Ls{constructor(t,e,n,i){const r=e.startsWith("--");s("string"!=typeof i.type);const o=zs(t).get(e);o&&o.stop();if(Array.isArray(n)||(n=[n]),function(t,e,n){for(let s=0;se.startsWith("--")?t.style.getPropertyValue(e):window.getComputedStyle(t)[e])),N(i.type)){const t=W(i,100,i.type);i.ease=Wt()?t.ease:js,i.duration=u(t.duration),i.type="keyframes"}else i.ease=i.ease||js;const a=()=>{this.setValue(t,e,gn(n,i)),this.cancel(),this.resolveFinishedPromise()},l=()=>{this.setValue=r?Ws:Ns,this.options=i,this.updateFinishedPromise(),this.removeAnimation=()=>{var n;return null===(n=$s.get(t))||void 0===n?void 0:n.delete(e)}};qn()?(super(Yn(t,e,n,i)),l(),!1===i.autoplay&&this.animation.pause(),this.animation.onfinish=a,zs(t).set(e,this)):(super(),l(),a())}then(t,e){return this.currentFinishedPromise.then(t,e)}updateFinishedPromise(){this.currentFinishedPromise=new Promise((t=>{this.resolveFinishedPromise=t}))}play(){"finished"===this.state&&this.updateFinishedPromise(),super.play()}cancel(){this.removeAnimation(),super.cancel()}}const Us=t=>function(e,n,s){return new l(function(t,e,n,s){const i=q(t,s),r=i.length,o=[];for(let t=0;t{const{currentTime:s}=e,i=(null===s?0:s.value)/100;n!==i&&t(i),n=i};return gt.update(s,!0),()=>yt(s)}const Xs=new WeakMap;let Gs;function Zs({target:t,contentRect:e,borderBoxSize:n}){var s;null===(s=Xs.get(t))||void 0===s||s.forEach((s=>{s({target:t,contentSize:e,get size(){return function(t,e){if(e){const{inlineSize:t,blockSize:n}=e[0];return{width:t,height:n}}return t instanceof SVGElement&&"getBBox"in t?t.getBBox():{width:t.offsetWidth,height:t.offsetHeight}}(t,n)}})}))}function _s(t){t.forEach(Zs)}function Js(t,e){Gs||"undefined"!=typeof ResizeObserver&&(Gs=new ResizeObserver(_s));const n=q(t);return n.forEach((t=>{let n=Xs.get(t);n||(n=new Set,Xs.set(t,n)),n.add(e),null==Gs||Gs.observe(t)})),()=>{n.forEach((t=>{const n=Xs.get(t);null==n||n.delete(e),(null==n?void 0:n.size)||null==Gs||Gs.unobserve(t)}))}}const Qs=new Set;let ti;function ei(t){return Qs.add(t),ti||(ti=()=>{const t={width:window.innerWidth,height:window.innerHeight},e={target:window,size:t,contentSize:t};Qs.forEach((t=>t(e)))},window.addEventListener("resize",ti)),()=>{Qs.delete(t),!Qs.size&&ti&&(ti=void 0)}}const ni={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function si(t,e,n,s){const r=n[e],{length:o,position:a}=ni[e],l=r.current,u=n.time;r.current=t[`scroll${a}`],r.scrollLength=t[`scroll${o}`]-t[`client${o}`],r.offset.length=0,r.offset[0]=0,r.offset[1]=r.scrollLength,r.progress=i(0,r.scrollLength,r.current);const c=s-u;r.velocity=c>50?0:m(r.current-l,c)}const ii={start:0,center:.5,end:1};function ri(t,e,n=0){let s=0;if(t in ii&&(t=ii[t]),"string"==typeof t){const e=parseFloat(t);t.endsWith("px")?s=e:t.endsWith("%")?t=e/100:t.endsWith("vw")?s=e/100*document.documentElement.clientWidth:t.endsWith("vh")?s=e/100*document.documentElement.clientHeight:t=e}return"number"==typeof t&&(s=e*t),n+s}const oi=[0,0];function ai(t,e,n,s){let i=Array.isArray(t)?t:oi,r=0,o=0;return"number"==typeof t?i=[t,t]:"string"==typeof t&&(i=(t=t.trim()).includes(" ")?t.split(" "):[t,ii[t]?t:"0"]),r=ri(i[0],n,s),o=ri(i[1],e),r-o}const li={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},ui={x:0,y:0};function ci(t,e,n){const{offset:s=li.All}=n,{target:i=t,axis:r="y"}=n,o="y"===r?"height":"width",a=i!==t?function(t,e){const n={x:0,y:0};let s=t;for(;s&&s!==e;)if(s instanceof HTMLElement)n.x+=s.offsetLeft,n.y+=s.offsetTop,s=s.offsetParent;else if("svg"===s.tagName){const t=s.getBoundingClientRect();s=s.parentElement;const e=s.getBoundingClientRect();n.x+=t.left-e.left,n.y+=t.top-e.top}else{if(!(s instanceof SVGGraphicsElement))break;{const{x:t,y:e}=s.getBBox();n.x+=t,n.y+=e;let i=null,r=s.parentNode;for(;!i;)"svg"===r.tagName&&(i=r),r=s.parentNode;s=i}}return n}(i,t):ui,l=i===t?{width:t.scrollWidth,height:t.scrollHeight}:function(t){return"getBBox"in t&&"svg"!==t.tagName?t.getBBox():{width:t.clientWidth,height:t.clientHeight}}(i),u={width:t.clientWidth,height:t.clientHeight};e[r].offset.length=0;let c=!e[r].interpolate;const h=s.length;for(let t=0;tfunction(t,e=t,n){if(n.x.targetOffset=0,n.y.targetOffset=0,e!==t){let s=e;for(;s&&s!==t;)n.x.targetOffset+=s.offsetLeft,n.y.targetOffset+=s.offsetTop,s=s.offsetParent}n.x.targetLength=e===t?e.scrollWidth:e.clientWidth,n.y.targetLength=e===t?e.scrollHeight:e.clientHeight,n.x.containerLength=t.clientWidth,n.y.containerLength=t.clientHeight}(t,s.target,n),update:e=>{!function(t,e,n){si(t,"x",e,n),si(t,"y",e,n),e.time=n}(t,n,e),(s.offset||s.target)&&ci(t,n,s)},notify:()=>e(n)}}const di=new WeakMap,pi=new WeakMap,fi=new WeakMap,mi=t=>t===document.documentElement?window:t;function gi(t,{container:e=document.documentElement,...n}={}){let s=fi.get(e);s||(s=new Set,fi.set(e,s));const i=hi(e,t,{time:0,x:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0},y:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}},n);if(s.add(i),!di.has(e)){const t=()=>{for(const t of s)t.measure()},n=()=>{for(const t of s)t.update(vt.timestamp)},i=()=>{for(const t of s)t.notify()},a=()=>{gt.read(t,!1,!0),gt.read(n,!1,!0),gt.update(i,!1,!0)};di.set(e,a);const l=mi(e);window.addEventListener("resize",a,{passive:!0}),e!==document.documentElement&&pi.set(e,(o=a,"function"==typeof(r=e)?ei(r):Js(r,o))),l.addEventListener("scroll",a,{passive:!0})}var r,o;const a=di.get(e);return gt.read(a,!1,!0),()=>{var t;yt(a);const n=fi.get(e);if(!n)return;if(n.delete(i),n.size)return;const s=di.get(e);di.delete(e),s&&(mi(e).removeEventListener("scroll",s),null===(t=pi.get(e))||void 0===t||t(),window.removeEventListener("resize",s))}}const yi=new Map;function vi({source:t,container:e=document.documentElement,axis:n="y"}={}){t&&(e=t),yi.has(e)||yi.set(e,{});const s=yi.get(e);return s[n]||(s[n]=o()?new ScrollTimeline({source:e,axis:n}):function({source:t,container:e,axis:n="y"}){t&&(e=t);const s={value:0},i=gi((t=>{s.value=100*t[n].progress}),{container:e,axis:n});return{currentTime:s,cancel:i}}({source:e,axis:n})),s[n]}function wi(t){return t&&(t.target||t.offset)}function bi(t,{axis:e="y",...s}={}){const i={axis:e,...s};return"function"==typeof t?function(t,e){return function(t){return 2===t.length}(t)||wi(e)?gi((n=>{t(n[e.axis].progress,n)}),e):qs(t,vi(e))}(t,i):function(t,e){if(t.flatten(),wi(e))return t.pause(),gi((n=>{t.time=t.duration*n[e.axis].progress}),e);{const s=vi(e);return t.attachTimeline?t.attachTimeline(s,(t=>(t.pause(),qs((e=>{t.time=t.duration*e}),s)))):n}}(t,i)}const xi={some:0,all:1};function Ti(t,e,{root:n,margin:s,amount:i="some"}={}){const r=q(t),o=new WeakMap,a=new IntersectionObserver((t=>{t.forEach((t=>{const n=o.get(t.target);if(t.isIntersecting!==Boolean(n))if(t.isIntersecting){const n=e(t);"function"==typeof n?o.set(t.target,n):a.unobserve(t.target)}else"function"==typeof n&&(n(t),o.delete(t.target))}))}),{root:n,rootMargin:s,threshold:"number"==typeof i?i:xi[i]});return r.forEach((t=>a.observe(t))),()=>a.disconnect()}function Si(t,e="end"){return n=>{const s=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,i="end"===e?Math.floor(s):Math.ceil(s);return f(0,1,i/t)}}function Ai(t=.1,{startDelay:e=0,from:n=0,ease:s}={}){return(i,r)=>{const o="number"==typeof n?n:function(t,e){if("first"===t)return 0;{const n=e-1;return"last"===t?n:n/2}}(n,r),a=Math.abs(o-i);let l=t*a;if(s){const e=r*t;l=Wn(s)(l/e)*e}return e+l}}function Vi(t,e){return function(t,e){const n=Tt.now(),s=({timestamp:i})=>{const r=i-n;r>=e&&(yt(s),t(r-e))};return gt.read(s,!0),()=>yt(s)}(t,u(e))}const Mi=(t,e)=>Math.abs(t-e);function Pi(t,e){const n=Mi(t.x,e.x),s=Mi(t.y,e.y);return Math.sqrt(n**2+s**2)}function ki(...t){const e=!Array.isArray(t[0]),n=e?0:-1,s=t[0+n],i=t[1+n],r=t[2+n],o=t[3+n],a=Nn(i,r,{mixer:(l=r[0],(t=>t&&"object"==typeof t&&t.mix)(l)?l.mix:void 0),...o});var l;return e?a(s):a}const Fi=gt,Ci=mt.reduce(((t,e)=>(t[e]=t=>yt(t),t)),{});export{At as MotionValue,Ds as animate,Ys as animateMini,Zt as anticipate,Xt as backIn,Gt as backInOut,qt as backOut,yt as cancelFrame,Ci as cancelSync,_t as circIn,Qt as circInOut,Jt as circOut,f as clamp,Is as createScopedAnimate,Ht as cubicBezier,Vi as delay,Mi as distance,Pi as distance2D,Bn as easeIn,Dn as easeInOut,In as easeOut,gt as frame,vt as frameData,wt as frameSteps,Ti as inView,Rn as inertia,Nn as interpolate,s as invariant,e as isDragActive,Kn as keyframes,Ut as mirrorEasing,On as mix,Vt as motionValue,n as noop,Vn as pipe,i as progress,Yt as reverseEasing,bi as scroll,gi as scrollInfo,L as spring,Ai as stagger,Si as steps,Fi as sync,Tt as time,ki as transform,K as wrap};export default null; diff --git a/src/browser/base/zen-components/ZenGlanceManager.mjs b/src/browser/base/zen-components/ZenGlanceManager.mjs index 847123425..a5c56c353 100644 --- a/src/browser/base/zen-components/ZenGlanceManager.mjs +++ b/src/browser/base/zen-components/ZenGlanceManager.mjs @@ -102,19 +102,30 @@ window.requestAnimationFrame(() => { this.quickOpenGlance(); - this.browserWrapper.style.setProperty('--initial-x', `${initialX}px`); - this.browserWrapper.style.setProperty('--initial-y', `${initialY}px`); - this.browserWrapper.style.setProperty('--initial-width', initialWidth + 'px'); - this.browserWrapper.style.setProperty('--initial-height', initialHeight + 'px'); - this.overlay.removeAttribute('fade-out'); this.browserWrapper.setAttribute('animate', true); - setTimeout(() => { + this.browserWrapper.style.top = `${initialY}px`; + this.browserWrapper.style.left = `${initialX}px`; + this.browserWrapper.style.width = `${initialWidth}px`; + this.browserWrapper.style.height = `${initialHeight}px`; + gZenUIManager.motion.animate(this.browserWrapper, { + top: [`${initialY}px`, '50%'], + left: [`${initialX}px`, '50%'], + width: [`${initialWidth}px`, '85%'], + height: [`${initialHeight}px`, '100%'], + opacity: [.8, 1], + }, { + duration: .5, + ease: "easeIn", + type: "spring", + bounce: 0.25 + }).then(() => { + this.browserWrapper.removeAttribute('animate'); this.browserWrapper.setAttribute('animate-end', true); this.browserWrapper.setAttribute('has-finished-animation', true); this._animating = false; this.animatingOpen = false; - }, 500); + }); }); } @@ -286,6 +297,7 @@ this.animatingFullOpen = true; this.currentParentTab._visuallySelected = false; + this.browserWrapper.removeAttribute('style'); this.browserWrapper.removeAttribute('has-finished-animation'); this.browserWrapper.setAttribute('animate-full', true); this.#currentTab.removeAttribute('zen-glance-tab'); diff --git a/src/browser/base/zen-components/ZenWorkspaces.mjs b/src/browser/base/zen-components/ZenWorkspaces.mjs index 70e076f0c..435839145 100644 --- a/src/browser/base/zen-components/ZenWorkspaces.mjs +++ b/src/browser/base/zen-components/ZenWorkspaces.mjs @@ -1335,7 +1335,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { if (out) { for (let tab of tabs) { tab.animate([{ transform: 'translateX(0)' }, { transform: `translateX(${direction === 'left' ? '-' : ''}100%)` }], { - duration: 150, + duration: 100, easing: 'ease', fill: 'both', }).onfinish = onAnimationEnd; @@ -1344,7 +1344,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { } for (let tab of tabs) { tab.animate([{ transform: `translateX(${direction === 'left' ? '-' : ''}100%)` }, { transform: 'translateX(0)' }], { - duration: 150, + duration: 100, easing: 'ease', fill: 'both', }).onfinish = onAnimationEnd;