@thednp/tween 0.0.4 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tween.min.js CHANGED
@@ -1,8 +1,8 @@
1
- /*! @thednp/tween UMD v0.0.4 | thednp © 2026 | MIT-License */
1
+ /*! @thednp/tween UMD v0.1.0 | thednp © 2026 | MIT-License */
2
2
  "use strict";
3
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.TWEEN={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let t=Object.freeze({Linear:Object.freeze({None(e){return e},In(e){return e},Out(e){return e},InOut(e){return e}}),Quadratic:Object.freeze({In(e){return e*e},Out(e){return e*(2-e)},InOut(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In(e){return e*e*e},Out(e){return--e*e*e+1},InOut(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In(e){return e*e*e*e},Out(e){return 1- --e*e*e*e},InOut(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In(e){return e*e*e*e*e},Out(e){return--e*e*e*e*e+1},InOut(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In(e){return 1-Math.sin((1-e)*Math.PI/2)},Out(e){return Math.sin(e*Math.PI/2)},InOut(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In(e){return e===0?0:1024**(e-1)},Out(e){return e===1?1:1-2**(-10*e)},InOut(e){return e===0?0:e===1?1:(e*=2)<1?.5*1024**(e-1):.5*(-(2**(-10*(e-1)))+2)}}),Circular:Object.freeze({In(e){return 1-Math.sqrt(1-e*e)},Out(e){return Math.sqrt(1- --e*e)},InOut(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In(e){return e===0?0:e===1?1:-(2**(10*(e-1)))*Math.sin((e-1.1)*5*Math.PI)},Out(e){return e===0?0:e===1?1:2**(-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*2**(10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*2**(-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In(e){let t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out(e){let t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut(e){let t=1.70158*1.525;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In(e){return 1-t.Bounce.Out(1-e)},Out(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut(e){return e<.5?t.Bounce.In(e*2)*.5:t.Bounce.Out(e*2-1)*.5+.5}}),pow(e=4){return e=e<2**-52?2**-52:e,e=e>1e4?1e4:e,{In(t){return t**e},Out(t){return 1-(1-t)**e},InOut(t){return t<.5?(t*2)**e/2:(1-(2-t*2)**e)/2+.5}}}}),n=e=>typeof e==`string`,r=e=>typeof e==`number`,i=e=>Array.isArray(e),a=e=>typeof e==`function`,o=e=>typeof e==`object`&&!!e&&Object.getPrototypeOf(e)===Object.prototype,s=e=>o(e)&&!i(e),c=e=>s(e)&&Object.values(e).some(s),l=typeof window>`u`,u=[`play`,`label`,`start`,`stop`,`pause`,`resume`,`reverse`,`use`,`clear`,`from`,`to`,`easing`,`delay`,`yoyo`,`repeat`,`update`,`repeatDelay`,`onStart`,`onUpdate`,`onComplete`,`onStop`,`onRepeat`],d={};function f(){return this}for(let e=0;e<u.length;e++)d[u[e]]=f;let p=(e,t)=>{let n=t>=1?10**t:1;return t>0?Math.round(e*n)/n:Math.round(e)},m=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),h=e=>e===`__proto__`||e===`constructor`||e===`prototype`;function g(e,t){let n=Object.keys(t),r=0,a=n.length;for(;r<a;){let a=n[r++];if(h(a)||!m(t,a))continue;let s=e[a],c=t[a];if(i(c)){let e=s,t=0,n=c.length;for(;t<n;){let n=c[t];if(i(n)){let r=e[t],i=0,a=n.length;for(;i<a;)r[i]=n[i],i++}else e[t]=n;t++}}else m(e,a)&&o(c)?g(s,c):e[a]=c}}let _=e=>{if(i(e))return e.map(_);if(s(e)){let t={};for(let n in e)m(e,n)&&(t[n]=_(e[n]));return t}return e};function v(e,t){let n=this.getErrors();if(!s(e)||Object.keys(e).length===0){n.set(`init`,`Initialization value is empty or not an object.`);return}let a=Object.keys(e);if(t&&a.some(e=>n.has(e)))return;let o=0;for(;o<a.length;){let s=a[o++],c=t?.[s],l=e[s];if(r(l))continue;if(l==null){n.set(s,`Property "${s}" is null/undefined.`);continue}if(t&&c===void 0){n.set(s,`Property "${s}" doesn't exist in state yet.`);continue}let u=this.getValidator(s);if(u){let[e,t]=u(s,l,c);e?n.delete(s):n.set(s,t);continue}if(t&&r(c)){r(l)||n.set(s,`Property "${s}" is not a number.`);continue}n.set(s,`Property "${s}" of type "${i(l)?`array`:typeof l}" is not supported yet.`)}n.delete(`init`)}let y=(e,t,n,r)=>{let i=n.length,a=0;for(;a<i;)e[a]=t[a]+(n[a]-t[a])*r,a+=1;return e},b=e=>i(e)&&e.every(r),x=(e,t,n)=>i(t)?b(t)?n&&n.length!==t.length?[!1,`Property "${String(e)}" is expecting an array of ${n.length} numbers.`]:[!0]:[!1,`Property "${String(e)}" is not a valid Array<number>.`]:[!1,`Property "${String(e)}" is not Array.`],S={interpolate:y,validate:x};function C(e,t=4){let n=e.length,r=e[0],i=``,a=0,o=0;for(;a<n;){r=e[a++],o=r.length,i+=r[0];let n=1;for(;n<o;)i+=p(r[n++],t),n!==o&&(i+=` `)}return i}let w=(e,t,n,r)=>{let i=n.length,a=0;for(;a<i;){let i=e[a],o=t[a],s=n[a];if(i[0]===`Z`){a++;continue}else i[0]===`C`?(i[1]=o[1]+(s[1]-o[1])*r,i[2]=o[2]+(s[2]-o[2])*r,i[3]=o[3]+(s[3]-o[3])*r,i[4]=o[4]+(s[4]-o[4])*r,i[5]=o[5]+(s[5]-o[5])*r,i[6]=o[6]+(s[6]-o[6])*r):(i[1]=o[1]+(s[1]-o[1])*r,i[2]=o[2]+(s[2]-o[2])*r);a++}return e},T=[`M`,`L`,`C`,`Z`],E=e=>i(e)&&e.some(e=>i(e)&&T.includes(e[0])),D=e=>E(e)&&e.length>1&&e.every(i)&&e.every(([e,...t])=>T.includes(e)&&([`M`,`L`].includes(e)&&t.length===2&&t.every(r)||e===`C`&&t.length===6&&t.every(r)||e===`Z`&&t.length===0)),O=(e,t,n)=>{if(!D(t))return[!1,`Property "${e}" is not a valid PathArray.`];if(n){if(n.length!==t.length)return[!1,`Property "${e}" is expecting an array of ${n.length} path segments, got ${t.length}.`];let r=0,i=n.length;for(;r<i;){let i=n[r],a=t[r],o=i[0],s=a[0],c=i.length,l=a.length;if(o!==s||c!==l)return[!1,`Property "${e}" mismatch at index ${r}. Segments don't match:\n> segment: "[${s}, ${a.slice(1)}]"\n> reference: "[${o}, ${i.slice(1)}]"`];r++}}return[!0]},k={interpolate:w,validate:O},A=(e,t,n,r)=>{let i=Object.keys(n),a=0;for(;a<i.length;){let o=i[a++],s=n[o],c=t[o];e[o]=c+(s-c)*r}return e},j=(e,t,n)=>{if(!s(t))return[!1,`Property "${e}" must be a plain object.`];let i=Object.keys(t),a=0,o=i.length;for(;a<o;){let o=i[a++],c=t[o];if(c==null)return[!1,`Property "${o}" from "${e}" is null/undefined.`];if(!r(c))return[!1,`Property "${o}" from "${e}" must be a number.${s(c)?` Deeper nested objects are not supported.`:` Unsupported value: "${typeof c}".`}`];if(n&&n[o]===void 0)return[!1,`Property "${o}" in "${e}" doesn't exist in the reference object.`]}return[!0]},M={interpolate:A,validate:j},N=(e,t=!1)=>{if(t){let t=new DOMMatrix,n=e.length,r=0;for(;r<n;){let n=e[r++];switch(n[0]){case`perspective`:{let e=new DOMMatrix;e.m34=-1/n[1],t.multiplySelf(e);break}case`translate`:t.translateSelf(n[1],n[2]||0,n[3]||0);break;case`rotate`:t.rotateSelf(n[1],n[2]||0,n[3]||0);break;case`rotateAxisAngle`:t.rotateAxisAngleSelf(n[1],n[2],n[3],n[4]);break;case`scale`:t.scaleSelf(n[1],n[2]||1,n[3]||1);break;case`skewX`:t.skewXSelf(n[1]);break;case`skewY`:t.skewYSelf(n[1]);break}}return t.toString()}let n=e.length,r=0,i=``;for(;r<n;){let t=e[r++];switch(t[0]){case`perspective`:i+=` perspective(${t[1]}px)`;break;case`translate`:i+=` translate3d(${t[1]}px, ${t[2]||0}px, ${t[3]||0}px)`;break;case`rotate`:{let[e,n,r]=t.slice(1);typeof e==`number`&&n===void 0&&r===void 0?i+=` rotate(${t[1]}deg)`:(i+=` rotateX(${t[1]}deg)`,t[2]!==void 0&&(i+=` rotateY(${t[2]}deg)`),t[3]!==void 0&&(i+=` rotateZ(${t[3]}deg)`));break}case`rotateAxisAngle`:i+=` rotate3d(${t[1]}, ${t[2]}, ${t[3]}, ${t[4]}deg)`;break;case`scale`:i+=` scale(${t[1]}, ${t[2]||t[1]}, ${t[3]||1})`;break;case`skewX`:i+=` skewX(${t[1]}deg)`;break;case`skewY`:i+=` skewY(${t[1]}deg)`;break}}return i.slice(1)},P=(e,t,n)=>I(F(e,t,n)),F=(e,t,n)=>{let r=Math.cos(e/2),i=Math.sin(e/2),a=Math.cos(t/2),o=Math.sin(t/2),s=Math.cos(n/2),c=Math.sin(n/2);return[r*a*s+i*o*c,i*a*s-r*o*c,r*o*s+i*a*c,r*a*c-i*o*s]},I=e=>{let[t,n,r,i]=e,a=Math.sqrt(n*n+r*r+i*i);if(a<1e-4)return[0,0,1,0];let o=2*Math.acos(Math.max(-1,Math.min(1,t)));return[n/a,r/a,i/a,o]},L=(e,t,n,r)=>{let i=n.length,a=0;for(;a<i;){let i=e[a],o=t[a],s=n[a];switch(i[0]){case`translate`:case`rotate`:case`scale`:case`rotateAxisAngle`:i[1]=o[1]+(s[1]-o[1])*r,typeof s[2]==`number`&&(i[2]=o[2]+(s[2]-o[2])*r),typeof s[3]==`number`&&(i[3]=o[3]+(s[3]-o[3])*r),typeof s[4]==`number`&&(i[4]=o[4]+(s[4]-o[4])*r);break;case`skewX`:case`skewY`:case`perspective`:i[1]=o[1]+(s[1]-o[1])*r;break}a++}return e},R=[`perspective`,`translate`,`rotate`,`rotateAxisAngle`,`scale`,`skewX`,`skewY`],z=e=>i(e)&&e.some(e=>i(e)&&R.includes(e[0])),B=e=>z(e)&&e.every(([e,...t])=>R.includes(e)&&([`translate`,`rotate`,`scale`].includes(e)&&t.length>0&&t.length<=3&&t.every(r)||e===`rotateAxisAngle`&&t.length===4&&t.every(r)||[`skewX`,`skewY`,`perspective`].includes(e)&&t.length===1&&r(t[0]))),V=(e,t,n)=>{if(!B(t))return[!1,`Property "${e}" must be an array of TransformStep.`];if(n){if(n.length!==t.length)return[!1,`Property "${e}" is expecting an array of ${n.length} transform steps, got ${t.length}.`];let r=0,i=t.length;for(;r<i;){let i=t[r],a=n[r],o=i[0],s=a[0];if(a&&(s!==o||a.length!==i.length))return[!1,`Property "${e}" mismatch at index ${r}":\n> step: ["${o}", ${i.slice(1)}]\n> reference: ["${s}", ${a.slice(1)}]`];r++}}return[!0]},H={interpolate:L,validate:V},U=()=>globalThis.performance.now(),W=()=>U();function G(e){U=e}let K=[],q=0,J=0;function Y(e=W()){let t=0;for(;t<J;)K[t]?.update(e)?t+=1:(K.splice(t,1),J--);J===0?(cancelAnimationFrame(q),q=0):q=requestAnimationFrame(Y)}function X(e){K.includes(e)||(K[J++]=e,q||Y())}function Z(e){let t=K.indexOf(e);t>-1&&K.splice(t,1)}var Q=class{state;_state;_startIsSet=!1;_repeat=0;_yoyo=!1;_reversed=!1;_initialRepeat=0;_startFired=!1;_propsStart={};_propsEnd={};_isPlaying=!1;_duration=1e3;_delay=0;_pauseStart=0;_repeatDelay=0;_startTime=0;_errors=new Map;_interpolators=new Map;_validators=new Map;_easing=e=>e;_onUpdate;_onComplete;_onStart;_onStop;_onPause;_onResume;_onRepeat;_runtime=[];constructor(e){return this.state={},v.call(this,e),this._errors.size?this._state=e:(this.state=e,this._state=_(e)),this}get isPlaying(){return this._isPlaying}get isPaused(){return this._pauseStart>0}get isValidState(){return Object.keys(this.state).length>0}get isValid(){return this._errors.size===0}getDuration(){return this._duration/1e3}get totalDuration(){let e=this._initialRepeat;return(this._delay+this._duration*(e+1)+this._repeatDelay*e)/1e3}getValidator(e){return this._validators.get(e)}getErrors(){return this._errors}start(e=W(),t=!1){return this._isPlaying?this:this._pauseStart?this.resume():this.isValid?(this._startTime&&!t&&this._resetState(),(!this._startIsSet||t)&&(this._startIsSet=!0,this._setProps(this.state,this._propsStart,this._propsEnd,t)),this._isPlaying=!0,this._startTime=e,this._startTime+=this._delay,X(this),this):(this._report(),this)}startFromLast(e=W()){return this.start(e,!0)}stop(){return this._isPlaying?(Z(this),this._isPlaying=!1,this._repeat=this._initialRepeat,this._reversed=!1,this._onStop?.(this.state),this):this}reverse(){if(!this._isPlaying)return this;let e=W(),t=e-this._startTime;return this._startTime=e-(this._duration-t),this._reversed=!this._reversed,this._initialRepeat>0&&(this._repeat=this._initialRepeat-this._repeat),this}pause(e=W()){return this._isPlaying?(this._pauseStart=e,this._isPlaying=!1,this._onPause?.(this.state),this):this}resume(e=W()){return this._pauseStart?(this._startTime+=e-this._pauseStart,this._pauseStart=0,this._isPlaying=!0,this._onResume?.(this.state),X(this),this):this}from(e){return!this.isValidState||this.isPlaying?this:(this._evaluate(e),this.isValid&&(Object.assign(this._propsStart,e),this._startIsSet=!1),this)}to(e){return!this.isValidState||this.isPlaying?this:(this._evaluate(e),this.isValid&&(this._propsEnd=e,this._startIsSet=!1),this)}duration(e=1){return this._duration=e*1e3,this}delay(e=0){return this._delay=e*1e3,this}repeat(e=0){return this._repeat=e,this._initialRepeat=e,this}repeatDelay(e=0){return this._repeatDelay=e*1e3,this}yoyo(e=!1){return this._yoyo=e,this}easing(e=e=>e){return this._easing=e,this}onStart(e){return this._onStart=e,this}onUpdate(e){return this._onUpdate=e,this}onComplete(e){return this._onComplete=e,this}onStop(e){return this._onStop=e,this}onPause(e){return this._onPause=e,this}onResume(e){return this._onResume=e,this}onRepeat(e){return this._onRepeat=e,this}update(e=W()){if(!this._isPlaying)return!1;if(e<this._startTime)return!0;this._startFired||=(this._onStart?.(this.state),!0);let t=this._reversed,n=this.state,r=this._runtime,i=(e-this._startTime)/this._duration;i>1&&(i=1);let a=this._easing(t?1-i:i);a=t?1-a:a;let o=r.length,s=0;for(;s<o;){let e=r[s++],i=e[0],o=e[1],c=e[2],l=t?e[4]:e[3],u=t?e[3]:e[4];typeof u==`number`?n[o]=l+(u-l)*a:c(i,l,u,a)}return this._onUpdate?.(n,i),i===1?this._repeat===0?(this._isPlaying=!1,this._repeat=this._initialRepeat,this._reversed=!1,this._onComplete?.(n),!1):(this._repeat!==1/0&&this._repeat--,this._yoyo&&(this._reversed=!t),this._startTime=e,this._startTime+=this._repeatDelay,this._onRepeat?.(n),!0):!0}use(e,{interpolate:t,validate:n}){return t&&!this._interpolators.has(e)&&this._interpolators.set(e,t),n&&!this._validators.has(e)&&this._validators.set(e,n),this._evaluate(),this}_resetState(){g(this.state,this._state)}clear(){return this._propsStart={},this._propsEnd={},this._runtime.length=0,this._startTime=0,this._pauseStart=0,this._repeat=0,this._initialRepeat=0,this}_setProps(e,t,n,r){let a=Object.keys(n),s=a.length;this._runtime.length=0;let c=0,l=0;for(;l<s;){let s=a[l++];if(t[s]===void 0||r){let r=e[s];o(r)||i(r)?t[s]=_(r):t[s]=r;let a=this._interpolators.get(s)||null;this._runtime[c++]=[r,s,a,t[s],n[s]]}}}_evaluate(e){if(this.isValidState)e&&v.call(this,e,this._state);else{let e=this._state;v.call(this,e),this.isValid&&(this.state=e,this._state=_(e))}return this}_report(){if(!this.isValid){let e=[`[Tween] failed validation:`,`- `+Array.from(this._errors.values()).join(`
3
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@thednp/dommatrix`)):typeof define==`function`&&define.amd?define([`exports`,`@thednp/dommatrix`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.TWEEN={},e._thednp_dommatrix))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let n=Object.freeze({Linear:Object.freeze({None(e){return e},In(e){return e},Out(e){return e},InOut(e){return e}}),Quadratic:Object.freeze({In(e){return e*e},Out(e){return e*(2-e)},InOut(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In(e){return e*e*e},Out(e){return--e*e*e+1},InOut(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In(e){return e*e*e*e},Out(e){return 1- --e*e*e*e},InOut(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In(e){return e*e*e*e*e},Out(e){return--e*e*e*e*e+1},InOut(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In(e){return 1-Math.sin((1-e)*Math.PI/2)},Out(e){return Math.sin(e*Math.PI/2)},InOut(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In(e){return e===0?0:1024**(e-1)},Out(e){return e===1?1:1-2**(-10*e)},InOut(e){return e===0?0:e===1?1:(e*=2)<1?.5*1024**(e-1):.5*(-(2**(-10*(e-1)))+2)}}),Circular:Object.freeze({In(e){return 1-Math.sqrt(1-e*e)},Out(e){return Math.sqrt(1- --e*e)},InOut(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In(e){return e===0?0:e===1?1:-(2**(10*(e-1)))*Math.sin((e-1.1)*5*Math.PI)},Out(e){return e===0?0:e===1?1:2**(-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*2**(10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*2**(-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In(e){let t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out(e){let t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut(e){let t=1.70158*1.525;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In(e){return 1-n.Bounce.Out(1-e)},Out(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut(e){return e<.5?n.Bounce.In(e*2)*.5:n.Bounce.Out(e*2-1)*.5+.5}}),pow(e=4){return e=e<2**-52?2**-52:e,e=e>1e4?1e4:e,{In(t){return t**e},Out(t){return 1-(1-t)**e},InOut(t){return t<.5?(t*2)**e/2:(1-(2-t*2)**e)/2+.5}}}}),r=e=>typeof e==`string`,i=e=>typeof e==`number`,a=e=>Array.isArray(e),o=e=>typeof e==`function`,s=e=>typeof e==`object`&&!!e&&Object.getPrototypeOf(e)===Object.prototype,c=e=>s(e)&&!a(e),l=e=>c(e)&&Object.values(e).some(c),u=typeof window>`u`,d=[`play`,`label`,`start`,`stop`,`pause`,`resume`,`reverse`,`use`,`clear`,`from`,`to`,`easing`,`delay`,`yoyo`,`repeat`,`update`,`repeatDelay`,`onStart`,`onUpdate`,`onComplete`,`onStop`,`onRepeat`],f={};function p(){return this}for(let e=0;e<d.length;e++)f[d[e]]=p;let m=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),h=e=>e===`__proto__`||e===`constructor`||e===`prototype`;function g(e,t){let n=Object.keys(t),r=0,i=n.length;for(;r<i;){let i=n[r++];if(h(i)||!m(t,i))continue;let o=e[i],c=t[i];if(a(c)){let e=o,t=0,n=c.length;for(;t<n;){let n=c[t];if(a(n)){let r=e[t],i=0,a=n.length;for(;i<a;)r[i]=n[i],i++}else e[t]=n;t++}}else m(e,i)&&s(c)?g(o,c):e[i]=c}}let _=e=>{if(a(e))return e.map(_);if(c(e)){let t={};for(let n in e)m(e,n)&&(t[n]=_(e[n]));return t}return e};function v(e,t){let n=this.getErrors();if(!c(e)||Object.keys(e).length===0){n.set(`init`,`Initialization value is empty or not an object.`);return}let r=Object.keys(e);if(t&&r.some(e=>n.has(e)))return;let o=0;for(;o<r.length;){let s=r[o++],c=t?.[s],l=e[s];if(i(l))continue;if(l==null){n.set(s,`Property "${s}" is null/undefined.`);continue}if(t&&c===void 0){n.set(s,`Property "${s}" doesn't exist in state yet.`);continue}let u=this.getValidator(s);if(u){let[e,t]=u(s,l,c);e?n.delete(s):n.set(s,t);continue}if(t&&i(c)){i(l)||n.set(s,`Property "${s}" is not a number.`);continue}n.set(s,`Property "${s}" of type "${a(l)?`array`:typeof l}" is not supported yet.`)}n.delete(`init`)}let y=(e,t,n,r)=>{let i=n.length,a=0;for(;a<i;)e[a]=t[a]+(n[a]-t[a])*r,a+=1;return e},b=e=>a(e)&&e.every(i),x=(e,t,n)=>a(t)?b(t)?n&&n.length!==t.length?[!1,`Property "${String(e)}" is expecting an array of ${n.length} numbers.`]:[!0]:[!1,`Property "${String(e)}" is not a valid Array<number>.`]:[!1,`Property "${String(e)}" is not Array.`],S={interpolate:y,validate:x},C=([e,t],[n,r],i)=>[e+(n-e)*i,t+(r-t)*i],w=(e,t)=>Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),T=(e,t,n,r)=>w([e,t],[n,r]),E=(e,t,n,r)=>{let{min:i,max:a}=Math;return[i(e,n),i(t,r),a(e,n),a(t,r)]},D=(e,t,n)=>{let r=n/2,i=Math.sin(r),a=Math.cos(r),o=e**2*i**2,s=t**2*a**2,c=Math.sqrt(o+s)*n;return Math.abs(c)},O=(e,t,n,r,i,a)=>{let{sin:o,cos:s}=Math,c=s(i),l=o(i),u=n*s(a),d=r*o(a);return[e+c*u-l*d,t+l*u+c*d]},k=(e,t)=>{let{x:n,y:r}=e,{x:i,y:a}=t,o=n*i+r*a,s=Math.sqrt((n**2+r**2)*(i**2+a**2));return(n*a-r*i<0?-1:1)*Math.acos(o/s)},ee=(e,t,n,r,i,a,o,s,c)=>{let{abs:l,sin:u,cos:d,sqrt:f,PI:p}=Math,m=l(n),h=l(r),g=(i%360+360)%360*(p/180);if(e===s&&t===c)return{rx:m,ry:h,startAngle:0,endAngle:0,center:{x:s,y:c}};if(m===0||h===0)return{rx:m,ry:h,startAngle:0,endAngle:0,center:{x:(s+e)/2,y:(c+t)/2}};let _=(e-s)/2,v=(t-c)/2,y={x:d(g)*_+u(g)*v,y:-u(g)*_+d(g)*v},b=y.x**2/m**2+y.y**2/h**2;b>1&&(m*=f(b),h*=f(b));let x=(m**2*h**2-m**2*y.y**2-h**2*y.x**2)/(m**2*y.y**2+h**2*y.x**2);x=x<0?0:x;let S=(a===o?-1:1)*f(x),C={x:S*(m*y.y/h),y:S*(-(h*y.x)/m)},w={x:d(g)*C.x-u(g)*C.y+(e+s)/2,y:u(g)*C.x+d(g)*C.y+(t+c)/2},T={x:(y.x-C.x)/m,y:(y.y-C.y)/h},E=k({x:1,y:0},T),D=k(T,{x:(-y.x-C.x)/m,y:(-y.y-C.y)/h});return!o&&D>0?D-=2*p:o&&D<0&&(D+=2*p),D%=2*p,{center:w,startAngle:E,endAngle:E+D,rx:m,ry:h}},A=(e,t,n,r,i,a,o,s,c)=>{let{rx:l,ry:u,startAngle:d,endAngle:f}=ee(e,t,n,r,i,a,o,s,c);return D(l,u,f-d)},j=(e,t,n,r,i,a,o,s,c)=>{let{center:l,rx:u,ry:d,startAngle:f,endAngle:p}=ee(e,t,n,r,i,a,o,s,c),m=p-f,{min:h,max:g,tan:_,atan2:v,PI:y}=Math,{x:b,y:x}=l,S=i*y/180,C=_(S),w=v(-d*C,u),T=w,E=w+y,D=v(d,u*C),k=D+y,A=[s],j=[c],M=h(e,s),N=g(e,s),P=h(t,c),F=g(t,c),I=O(b,x,u,d,S,p-m*1e-5),L=O(b,x,u,d,S,p-m*.99999);if(I[0]>N||L[0]>N){let e=O(b,x,u,d,S,T);A.push(e[0]),j.push(e[1])}if(I[0]<M||L[0]<M){let e=O(b,x,u,d,S,E);A.push(e[0]),j.push(e[1])}if(I[1]<P||L[1]<P){let e=O(b,x,u,d,S,k);A.push(e[0]),j.push(e[1])}if(I[1]>F||L[1]>F){let e=O(b,x,u,d,S,D);A.push(e[0]),j.push(e[1])}return M=h.apply([],A),P=h.apply([],j),N=g.apply([],A),F=g.apply([],j),[M,P,N,F]},M=[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],N=[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],P=e=>{let t=[];for(let n=e,r=n.length,i=r-1;r>1;--r,--i){let e=[];for(let t=0;t<i;t+=1)e.push({x:i*(n[t+1].x-n[t].x),y:i*(n[t+1].y-n[t].y),t:0});t.push(e),n=e}return t},F=(e,t)=>{if(t===0)return e[0].t=0,e[0];let n=e.length-1;if(t===1)return e[n].t=1,e[n];let r=1-t,i=e;if(n===0)return e[0].t=t,e[0];if(n===1)return{x:r*i[0].x+t*i[1].x,y:r*i[0].y+t*i[1].y,t};let a=r*r,o=t*t,s=0,c=0,l=0,u=0;return n===2?(i=[i[0],i[1],i[2],{x:0,y:0}],s=a,c=r*t*2,l=o):n===3&&(s=a*r,c=a*t*3,l=r*o*3,u=t*o),{x:s*i[0].x+c*i[1].x+l*i[2].x+u*i[3].x,y:s*i[0].y+c*i[1].y+l*i[2].y+u*i[3].y,t}},I=(e,t)=>{let n=e(t),r=n.x*n.x+n.y*n.y;return Math.sqrt(r)},L=e=>{let t=.5,n=M.length,r=0;for(let i=0,a;i<n;i++)a=t*M[i]+t,r+=N[i]*I(e,a);return t*r},te=e=>{let t=[];for(let n=0,r=e.length;n<r;n+=2)t.push({x:e[n],y:e[n+1]});let n=P(t);return L(e=>F(n[0],e))},ne=([e,t,n])=>{let r=Math.min(e,n),i=Math.max(e,n);if(t>=e?n>=t:n<=t)return[r,i];let a=(e*n-t*t)/(e-2*t+n);return a<r?[a,i]:[r,a]},re=([e,t,n,r])=>{let i=e-3*t+3*n-r;if(Math.abs(i)<1e-8)return e===r&&e===t?[e,r]:ne([e,-.5*e+1.5*t,e-3*t+3*n]);let a=-e*n+e*r-t*n-t*r+t*t+n*n;if(a<=0)return[Math.min(e,r),Math.max(e,r)];let o=Math.sqrt(a),s=Math.min(e,r),c=Math.max(e,r),l=e-2*t+n;for(let a=(l+o)/i,u=1;u<=2;a=(l-o)/i,u++)if(a>0&&a<1){let i=e*(1-a)*(1-a)*(1-a)+t*3*(1-a)*(1-a)*a+n*3*(1-a)*a*a+r*a*a*a;i<s&&(s=i),i>c&&(c=i)}return[s,c]},ie=(e,t,n,r,i,a,o,s)=>te([e,t,n,r,i,a,o,s]),ae=(e,t,n,r,i,a,o,s)=>{let c=re([e,n,i,o]),l=re([t,r,a,s]);return[c[0],l[0],c[1],l[1]]},oe=(e,t,n,r,i,a)=>te([e,t,n,r,i,a]),se=(e,t,n,r,i,a)=>{let o=ne([e,n,i]),s=ne([t,r,a]);return[o[0],s[0],o[1],s[1]]},R=e=>{let t=e.length,n=-1,r,i=e[t-1],a=0;for(;++n<t;)r=i,i=e[n],a+=r[1]*i[0]-r[0]*i[1];return a/2},ce=(e,t,n)=>{let{sin:r,cos:i}=Math;return{x:e*i(n)-t*r(n),y:e*r(n)+t*i(n)}},le=(e,t)=>{let n=t>=1?10**t:1;return t>0?Math.round(e*n)/n:Math.round(e)},z={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},ue=e=>{let t=e.pathValue[e.segmentStart],n=t.toLowerCase(),{data:r}=e;for(;r.length>=z[n]&&(n===`m`&&r.length>2?(e.segments.push([t].concat(r.splice(0,2))),n=`l`,t=t===`m`?`l`:`L`):e.segments.push([t].concat(r.splice(0,z[n]))),z[n]););},B=`SVGPathCommanderError`,de=e=>{let{index:t,pathValue:n}=e,r=n.charCodeAt(t);if(r===48){e.param=0,e.index+=1;return}if(r===49){e.param=1,e.index+=1;return}e.err=`${B}: invalid Arc flag "${n[t]}", expecting 0 or 1 at index ${t}`},V=e=>e>=48&&e<=57,H=`Invalid path value`,fe=e=>{let{max:t,pathValue:n,index:r}=e,i=r,a=!1,o=!1,s=!1,c=!1,l;if(i>=t){e.err=`${B}: ${H} at index ${i}, "pathValue" is missing param`;return}if(l=n.charCodeAt(i),(l===43||l===45)&&(i+=1,l=n.charCodeAt(i)),!V(l)&&l!==46){e.err=`${B}: ${H} at index ${i}, "${n[i]}" is not a number`;return}if(l!==46){if(a=l===48,i+=1,l=n.charCodeAt(i),a&&i<t&&l&&V(l)){e.err=`${B}: ${H} at index ${r}, "${n[r]}" illegal number`;return}for(;i<t&&V(n.charCodeAt(i));)i+=1,o=!0;l=n.charCodeAt(i)}if(l===46){for(c=!0,i+=1;V(n.charCodeAt(i));)i+=1,s=!0;l=n.charCodeAt(i)}if(l===101||l===69){if(c&&!o&&!s){e.err=`${B}: ${H} at index ${i}, "${n[i]}" invalid float exponent`;return}if(i+=1,l=n.charCodeAt(i),(l===43||l===45)&&(i+=1),i<t&&V(n.charCodeAt(i)))for(;i<t&&V(n.charCodeAt(i));)i+=1;else{e.err=`${B}: ${H} at index ${i}, "${n[i]}" invalid integer exponent`;return}}e.index=i,e.param=+e.pathValue.slice(r,i)},pe=e=>[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279,10,13,8232,8233,32,9,11,12,160].includes(e),U=e=>{let{pathValue:t,max:n}=e;for(;e.index<n&&pe(t.charCodeAt(e.index));)e.index+=1},me=e=>{switch(e|32){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}},he=e=>V(e)||e===43||e===45||e===46,ge=e=>(e|32)==97,_e=e=>{switch(e|32){case 109:case 77:return!0;default:return!1}},ve=e=>{let{max:t,pathValue:n,index:r,segments:i}=e,a=n.charCodeAt(r),o=z[n[r].toLowerCase()];if(e.segmentStart=r,!me(a)){e.err=`${B}: ${H} "${n[r]}" is not a path command at index ${r}`;return}let s=i[i.length-1];if(!_e(a)&&s?.[0]?.toLocaleLowerCase()===`z`){e.err=`${B}: ${H} "${n[r]}" is not a MoveTo path command at index ${r}`;return}if(e.index+=1,U(e),e.data=[],!o){ue(e);return}for(;;){for(let r=o;r>0;--r){if(ge(a)&&(r===3||r===4)?de(e):fe(e),e.err.length)return;e.data.push(e.param),U(e),e.index<t&&n.charCodeAt(e.index)===44&&(e.index+=1,U(e))}if(e.index>=e.max||!he(n.charCodeAt(e.index)))break}ue(e)};var ye=class{constructor(e){this.segments=[],this.pathValue=e,this.max=e.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=``}};let W=e=>{if(typeof e!=`string`)return e.slice(0);let t=new ye(e);for(U(t);t.index<t.max&&!t.err.length;)ve(t);if(!t.err.length)t.segments.length&&(t.segments[0][0]=`M`);else throw TypeError(t.err);return t.segments},be=(e,t,n,r)=>{let[i]=e,a=i.toUpperCase();if(t===0||a===i)return e;if(a===`A`)return[a,e[1],e[2],e[3],e[4],e[5],e[6]+n,e[7]+r];if(a===`V`)return[a,e[1]+r];if(a===`H`)return[a,e[1]+n];if(a===`L`)return[a,e[1]+n,e[2]+r];{let t=[],i=e.length;for(let a=1;a<i;a+=1)t.push(e[a]+(a%2?n:r));return[a].concat(t)}},G=(e,t)=>{let n=0,r=0,i=0,a=0,o=0;for(;o<e.length;){let s=e[o],[c]=s,l=c.toUpperCase(),u=l!==c,d=t(s,o,n,r);if(d===!1)break;if(l===`Z`)n=i,r=a;else if(l===`H`)n=s[1]+(u?n:0);else if(l===`V`)r=s[1]+(u?r:0);else{let e=s.length;n=s[e-2]+(u?n:0),r=s[e-1]+(u?r:0),l===`M`&&(i=n,a=r)}d&&(e[o]=d),o+=1}return e},xe=e=>G(W(e),be),Se=(e,t,n,r,i,a,o,s,c,l)=>{let u=e,d=t,f=n,p=r,m=s,h=c,g=Math.PI*120/180,_=Math.PI/180*(+i||0),v=[],y,b,x,S,C;if(l)[b,x,S,C]=l;else{y=ce(u,d,-_),u=y.x,d=y.y,y=ce(m,h,-_),m=y.x,h=y.y;let e=(u-m)/2,t=(d-h)/2,n=e*e/(f*f)+t*t/(p*p);n>1&&(n=Math.sqrt(n),f*=n,p*=n);let r=f*f,i=p*p,s=(a===o?-1:1)*Math.sqrt(Math.abs((r*i-r*t*t-i*e*e)/(r*t*t+i*e*e)));S=s*f*t/p+(u+m)/2,C=s*-p*e/f+(d+h)/2,b=Math.asin(((d-C)/p*10**9>>0)/10**9),x=Math.asin(((h-C)/p*10**9>>0)/10**9),b=u<S?Math.PI-b:b,x=m<S?Math.PI-x:x,b<0&&(b=Math.PI*2+b),x<0&&(x=Math.PI*2+x),o&&b>x&&(b-=Math.PI*2),!o&&x>b&&(x-=Math.PI*2)}let w=x-b;if(Math.abs(w)>g){let e=x,t=m,n=h;x=b+g*(o&&x>b?1:-1),m=S+f*Math.cos(x),h=C+p*Math.sin(x),v=Se(m,h,f,p,i,0,o,t,n,[x,e,S,C])}w=x-b;let T=Math.cos(b),E=Math.sin(b),D=Math.cos(x),O=Math.sin(x),k=Math.tan(w/4),ee=4/3*f*k,A=4/3*p*k,j=[u,d],M=[u+ee*E,d-A*T],N=[m+ee*O,h-A*D],P=[m,h];if(M[0]=2*j[0]-M[0],M[1]=2*j[1]-M[1],l)return[M[0],M[1],N[0],N[1],P[0],P[1]].concat(v);v=[M[0],M[1],N[0],N[1],P[0],P[1]].concat(v);let F=[];for(let e=0,t=v.length;e<t;e+=1)F[e]=e%2?ce(v[e-1],v[e],_).y:ce(v[e],v[e+1],_).x;return F},Ce=(e,t,n,r,i,a)=>{let o=1/3,s=2/3;return[o*e+s*n,o*t+s*r,o*i+s*n,o*a+s*r,i,a]},we=(e,t,n,r)=>{let i=C([e,t],[n,r],1/3),a=C([e,t],[n,r],2/3);return[i[0],i[1],a[0],a[1],n,r]},Te=(e,t)=>{let n=e[0],r=e.slice(1).map(Number),[i,a]=r,{x1:o,y1:s}=t;return`TQ`.includes(n)||(t.qx=null,t.qy=null),n===`M`?(t.mx=i,t.my=a,t.x=i,t.y=a,e):n===`A`?[`C`].concat(Se(o,s,r[0],r[1],r[2],r[3],r[4],r[5],r[6])):n===`Q`?(t.qx=i,t.qy=a,[`C`].concat(Ce(o,s,r[0],r[1],r[2],r[3]))):n===`L`?[`C`].concat(we(o,s,i,a)):n===`Z`?[`C`].concat(we(o,s,t.mx,t.my)):e},Ee=(e,t)=>{let[n]=e,r=n.toUpperCase(),i=n!==r,{x1:a,y1:o,x2:s,y2:c,x:l,y:u}=t,d=e.slice(1),f=d.map((e,t)=>e+(i?t%2?u:l:0));if(`TQ`.includes(r)||(t.qx=null,t.qy=null),r===`A`)return f=d.slice(0,-2).concat(d[5]+(i?l:0),d[6]+(i?u:0)),[`A`].concat(f);if(r===`H`)return[`L`,e[1]+(i?l:0),o];if(r===`V`)return[`L`,a,e[1]+(i?u:0)];if(r===`L`)return[`L`,e[1]+(i?l:0),e[2]+(i?u:0)];if(r===`M`)return[`M`,e[1]+(i?l:0),e[2]+(i?u:0)];if(r===`C`)return[`C`].concat(f);if(r===`S`){let e=a*2-s,n=o*2-c;return t.x1=e,t.y1=n,[`C`,e,n].concat(f)}else if(r===`T`){let e=a*2-(t.qx?t.qx:0),n=o*2-(t.qy?t.qy:0);return t.qx=e,t.qy=n,[`Q`,e,n].concat(f)}else if(r===`Q`){let[e,n]=f;return t.qx=e,t.qy=n,[`Q`].concat(f)}else if(r===`Z`)return[`Z`];return e},De={mx:0,my:0,x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null},Oe=e=>{let t={...De},n=W(e);return G(n,(e,r,i,a)=>{t.x=i,t.y=a;let o=Ee(e,t);o[0]===`M`&&(t.mx=o[1],t.my=o[2]);let s=Te(o,t);s[0]===`C`&&s.length>7&&(n.splice(r+1,0,[`C`].concat(s.slice(7))),s=s.slice(0,7));let c=s.length;return t.x1=+s[c-2],t.y1=+s[c-1],t.x2=+s[c-4]||t.x1,t.y2=+s[c-3]||t.y1,s})},ke={origin:[0,0,0],round:4},Ae=(e,t)=>{let n=e.length,{round:r}=ke,i=e[0],a=``;r=t===`off`||typeof t==`number`&&t>=0?t:typeof r==`number`&&r>=0?r:`off`;for(let t=0;t<n;t+=1){i=e[t];let[n]=i,o=i.slice(1);if(a+=n,r===`off`)a+=o.join(` `);else{let e=0,t=o.length;for(;e<t;)a+=le(o[e],r),e!==t-1&&(a+=` `),e+=1}}return a},je=e=>{if(!e)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};let t=W(e),n=`M`,r=0,i=0,{max:a,min:o}=Math,s=1/0,c=1/0,l=-1/0,u=-1/0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y=0,b=0;G(t,(e,t,x,S)=>{[n]=e;let C=n.toUpperCase(),w=C===n?e.slice(0):be(e,t,x,S),T=C===`V`?[`L`,x,w[1]]:C===`H`?[`L`,w[1],S]:w;if([n]=T,`TQ`.includes(C)||(y=0,b=0),n===`M`)[,r,i]=T,d=r,f=i,p=r,m=i;else if(n===`L`)[d,f,p,m]=E(x,S,T[1],T[2]);else if(n===`A`)[d,f,p,m]=j(x,S,T[1],T[2],T[3],T[4],T[5],T[6],T[7]);else if(n===`S`){let e=h*2-_,t=g*2-v;[d,f,p,m]=ae(x,S,e,t,T[1],T[2],T[3],T[4])}else n===`C`?[d,f,p,m]=ae(x,S,T[1],T[2],T[3],T[4],T[5],T[6]):n===`T`?(y=h*2-y,b=g*2-b,[d,f,p,m]=se(x,S,y,b,T[1],T[2])):n===`Q`?(y=T[1],b=T[2],[d,f,p,m]=se(x,S,T[1],T[2],T[3],T[4])):n===`Z`&&([d,f,p,m]=E(x,S,r,i));s=o(d,s),c=o(f,c),l=a(p,l),u=a(m,u),[h,g]=n===`Z`?[r,i]:T.slice(-2),[_,v]=n===`C`?[T[3],T[4]]:n===`S`?[T[1],T[2]]:[h,g]});let x=l-s,S=u-c;return{width:x,height:S,x:s,y:c,x2:l,y2:u,cx:s+x/2,cy:c+S/2,cz:Math.max(x,S)+Math.min(x,S)/2}},Me=e=>{let t=W(e),n=0,r=0,i=0,a=0,o=0,s=0,c=`M`,l=0,u=0,d=0;return G(t,(e,t,f,p)=>{[c]=e;let m=c.toUpperCase(),h=m===c?e.slice(0):be(e,t,f,p),g=m===`V`?[`L`,f,h[1]]:m===`H`?[`L`,h[1],p]:h;if([c]=g,`TQ`.includes(m)||(o=0,s=0),c===`M`)[,l,u]=g;else if(c===`L`)d+=T(f,p,g[1],g[2]);else if(c===`A`)d+=A(f,p,g[1],g[2],g[3],g[4],g[5],g[6],g[7]);else if(c===`S`){let e=n*2-i,t=r*2-a;d+=ie(f,p,e,t,g[1],g[2],g[3],g[4])}else c===`C`?d+=ie(f,p,g[1],g[2],g[3],g[4],g[5],g[6]):c===`T`?(o=n*2-o,s=r*2-s,d+=oe(f,p,o,s,g[1],g[2])):c===`Q`?(o=g[1],s=g[2],d+=oe(f,p,g[1],g[2],g[3],g[4])):c===`Z`&&(d+=T(f,p,l,u));[n,r]=c===`Z`?[l,u]:g.slice(-2),[i,a]=c===`C`?[g[3],g[4]]:c===`S`?[g[1],g[2]]:[n,r]}),d},K=e=>{let t=W(e),n={...De};return G(t,(e,t,r,i)=>{n.x=r,n.y=i;let a=Ee(e,n),o=a.length;return n.x1=+a[o-2],n.y1=+a[o-1],n.x2=+a[o-4]||n.x1,n.y2=+a[o-3]||n.y1,a})},Ne=e=>Array.isArray(e)&&e.every(e=>{let t=e[0].toLowerCase();return z[t]===e.length-1&&`achlmqstvz`.includes(t)&&e.slice(1).every(Number.isFinite)})&&e.length>0,Pe=e=>Ne(e)&&e.every(([e])=>e===e.toUpperCase()),Fe=e=>Pe(e)&&e.every(([e])=>`ACLMQZ`.includes(e)),Ie=e=>Fe(e)&&e.every(([e])=>`MLVHZ`.includes(e));function q(e){return Fe(e)&&e.every(([e])=>`MLVH`.includes(e))}let Le=e=>{if(typeof e==`string`){let t=e.match(/[Mm]/g);return t?t.length>1:!1}if(Ne(e)){let t=0;for(let n of e)if(n[0].toUpperCase()===`M`&&(t++,t>1))return!0;return!1}throw TypeError(B+`: expected string or PathArray`)},Re=e=>e[e.length-1][0].toUpperCase()===`Z`,ze=(e,t)=>{let n=e.slice(1).map(e=>le(e,t));return[e[0]].concat(n)},Be=e=>{let t=xe(e),n=K(t),r=t.length,i=t[r-1][0]===`Z`,a=G(t,(e,a)=>{let o=n[a],s=a&&t[a-1],c=s&&s[0],l=t[a+1],u=l&&l[0],d=e[0],[f,p]=n[a?a-1:r-1].slice(-2),m=e;switch(d){case`M`:m=i?[`Z`]:[d,f,p];break;case`A`:m=[d,e[1],e[2],e[3],e[4],e[5]===1?0:1,f,p];break;case`C`:m=l&&u===`S`?[`S`,e[1],e[2],f,p]:[d,e[3],e[4],e[1],e[2],f,p];break;case`S`:m=c&&`CS`.includes(c)&&(!l||u!==`S`)?[`C`,o[3],o[4],o[1],o[2],f,p]:[d,o[1],o[2],f,p];break;case`Q`:m=l&&u===`T`?[`T`,f,p]:[d,e[1],e[2],f,p];break;case`T`:m=c&&`QT`.includes(c)&&(!l||u!==`T`)?[`Q`,o[1],o[2],f,p]:[d,f,p];break;case`Z`:m=[`M`,f,p];break;case`H`:m=[d,f];break;case`V`:m=[d,p];break;default:m=[d].concat(e.slice(1,-2),f,p)}return m});return i?a.reverse():[a[0]].concat(a.slice(1).reverse())},Ve=e=>{let t=[],n=W(e),r=[],i=-1,a=0,o=0,s=0,c=0;return G(n,(e,n,l,u)=>{let d=e[0],f=d.toUpperCase(),p=d===d.toLowerCase(),m=e.slice(1);f===`M`?(i+=1,[a,o]=m,a+=p?l:0,o+=p?u:0,s=a,c=o,r=[p?[f,s,c]:e]):(f===`Z`?(a=s,o=c):f===`H`?([,a]=e,a+=p?l:0):f===`V`?([,o]=e,o+=p?u:0):([a,o]=e.slice(-2),a+=p?l:0,o+=p?u:0),r.push(e)),t[i]=r}),t},He=(e,t)=>{let{round:n}=ke;return n=t===`off`||typeof t==`number`&&t>=0?t:typeof n==`number`&&n>=0?n:`off`,n===`off`?e.slice(0):G(e,e=>ze(e,n))},Ue=e=>{let t=W(e);if(Re(t)){let e=K(t),n=t.length,r=n-2,[i,a]=e[0].slice(1),[o,s]=e[r].slice(-2);i===o&&a===s&&t.splice(n-1,1)}};function We(e,t,n,r,i,a,o,s,c){let[l,u]=C([e,t],[n,r],c),[d,f]=C([n,r],[i,a],c),[p,m]=C([i,a],[o,s],c),[h,g]=C([l,u],[d,f],c),[_,v]=C([d,f],[p,m],c),[y,b]=C([h,g],[_,v],c);return[[e,t,l,u,h,g,y,b],[y,b,_,v,p,m,o,s]]}let Ge=e=>{let t=K(e);if(!Ie(t)&&!q(t))throw TypeError(`${B}: pathValue is not a polyline/polygon`);if(!Re(t))return t;let n=[t[0]],[r,i]=t[0].slice(1);for(let e=1;e<t.length;e++){let a=t[e];a[0].toUpperCase()===`Z`?n.push([`L`,r,i]):n.push(a)}return n};function Ke(e,t,n,r,i){if(i<=1)return[[e,t,n,r]];let a=[],o=n-e,s=r-t,c=e,l=t,u=0;for(;u<i;){let n=1/(i-u),r=e+n*o,d=t+n*s;a.push([c,l,r,d]),c=r,l=d,u++}return a}function qe(e,t){if(t<=1)throw TypeError(`${B}: target must be >= 2`);let n=Me(e);if(n===0)return Array(e.length).fill(1);let r=n/t,i=q(e),a=[1],o=[0];G(e,(e,t,n,r)=>{if(t>0){let[t,s]=e.slice(-2),c=i?T(n,r,t,s):ie(n,r,e[1],e[2],e[3],e[4],e[5],e[6]);o.push(c),a.push(1)}});let s=1;for(let e=1;e<o.length;e++){let t=o[e],n=t>r?Math.round(t/r):1;a[e]=n,s+=n}let c=t-s;if(c!==0){let e=[];for(let t=1;t<o.length;t++)o[t]>0&&e.push([t,o[t]]);let t=e.length;if(c<0){e.sort((e,t)=>e[1]-t[1]);for(let n=0;n<t;n++){let r=e[n][0];if(a[r]>1&&e[n][1]>0&&(a[r]--,c++),c===0)break;n===t-1&&(n=0)}}else if(c>0){e.sort((e,t)=>t[1]-e[1]);for(let n=0;n<t;n++){let r=e[n][0];if(e[n][1]>0&&(a[r]++,c--),c===0)break;n===t-1&&(n=0)}}}return a}function Je(e,t){if(e.length<2||t<=1)return e;let n=qe(e,t),r=0,i=[e[0]],a=e.length,o=e[0][1],s=e[0][2];for(let t=1;t<a;t++){let[a,c]=e[t].slice(1),l=n[t];if(l>=1){let e=Ke(o,s,a,c,l);for(let t of e)i.push([`L`,t[2],t[3]]),r++}o=a,s=c}return i.length!==t&&console.warn(`${B}: requested ${t} segments, got ${i.length}. Adjusted on last segment.`),i}function Ye(e,t,n,r,i,a,o,s,c){if(c<=1)return[[e,t,n,r,i,a,o,s]];let l=[],u=e,d=t,f=n,p=r,m=i,h=a,g=o,_=s,v=0;for(;v<c;){let e=1/(c-v),[t,n]=We(u,d,f,p,m,h,g,_,e);l.push(t),[u,d,f,p,m,h,g,_]=n,v++}return l}function Xe(e,t){if(e.length<2||t<=1)return e;let n=qe(e,t),r=0,i=[e[0]],a=e.length,o=e[0][1],s=e[0][2];for(let t=1;t<a;t++){let a=e[t],[c,l]=a.slice(-2),u=n[t];if(u>=1){let e=Ye(o,s,a[1],a[2],a[3],a[4],a[5],a[6],u);for(let t of e)i.push([`C`,t[2],t[3],t[4],t[5],t[6],t[7]]),r++}o=c,s=l}return i.length!==t&&console.warn(`${B}: requested ${t} segments, got ${i.length}.`),i}function J(e){let t=[],[n,r]=[0,0];return G(e,e=>{let i=e[0];if(i===`M`)[n,r]=[e[1],e[2]],t.push([n,r]);else if(i===`L`)t.push([e[1],e[2]]);else if(i===`C`)t.push([e[5],e[6]]);else if(i===`A`)t.push([e[6],e[7]]);else if(i===`Z`)t.push([n,r]);else throw TypeError(`${B}: path command "${i}" is not supported`)}),t}function Ze(e){let t=e.length,n=t-1,r,i=[];for(let a=0;a<t;a++){r=[];for(let i=0;i<t;i++){let o=a+i,s;if(i===0||e[o]&&e[o][0]===`M`){s=e[o],r.push([`M`,...s.slice(-2)]);continue}o>=t&&(o-=n),r.push(e[o])}i.push(r)}return i}function Qe(e,t,n){let r=n||Ze(e);if(e.length!==t.length)throw TypeError(B+`: paths must have the same number of segments after equalization`);let i=0,a=1/0;for(let e=0;e<r.length;e++){let n=r[e],o=n.length,s=0;for(let e=0;e<o;e++){let r=n[e],i=t[e],a=r.slice(-2),o=i.slice(-2),c=a[0]-o[0],l=a[1]-o[1];s+=c*c+l*l}s<a&&(a=s,i=e)}return r[i]}let $e={mode:`auto`,sampleSize:10,roundValues:4,reverse:!0,close:!1,target:void 0},et=(e,t,n={})=>{let{close:r,mode:i,reverse:a,roundValues:o,target:s}=Object.assign($e,n),c=K(e),l=K(t);Ue(c),Ue(l);let u=(Ie(c)||q(c))&&(Ie(l)||q(l));u&&i===`auto`?(c=Ge(c),l=Ge(l)):(u=!1,c=Oe(c),l=Oe(l));let d=R(J(c)),f=R(J(l));a!==!1&&Math.sign(d)!==Math.sign(f)&&(l=Be(l));let p=c.length,m=l.length,h=Math.max(p,m),g=h;if(typeof s!=`number`){let e=(Me(c)+Me(l))/2,t=e/Math.max(p,m),n=Math.max(h,Math.round(e/Math.max(t,1)));g=Math.min(n,Math.max(p,m)*3)}else s>=h?g=s:console.warn(`equalizeSegments "target" option: `+s+`, expected >= `+h);let _=c,v=l;return u?(_=Je(c,g),v=Je(l,g)):(_=Xe(c,g),v=Xe(l,g)),v=Qe(v,_),typeof o==`number`&&o!==4&&(_=He(_,o),v=He(v,o)),r&&(_.push([`Z`]),v.push([`Z`])),[_,v]},Y=(e,[t,n])=>{let[r,i,a,o]=e;return t>=r&&t<=a&&n>=i&&n<=o},tt=(e,t)=>{let[n,r,i,a]=e,[o,s,c,l]=t;return Y(t,[n,r])||Y(t,[i,r])||Y(t,[n,a])||Y(t,[i,a])||Y(e,[o,s])||Y(e,[c,s])||Y(e,[o,l])||Y(e,[c,l])||(n<c&&n>o||o<i&&o>n)&&(r<l&&r>s||s<a&&s>r)},nt=([e,t])=>{let n=.001;return[[`M`,e,t],[`L`,e+n,t],[`L`,e+n,t+n],[`L`,e,t+n],[`L`,e,t],[`Z`]]};function rt(e,t){let n=e.bbox,r=[];for(let i=0;i<t.length;i++){let{bbox:a,size:o}=t[i],s=n.cx-a.cx,c=n.cy-a.cy,l=Math.sqrt(s*s+c*c),u=Math.abs(e.size-o)/Math.max(e.size,o,1e-6),d=Y([n.x,n.y,n.x2,n.y2],[a.cx,a.cy])||Y([a.x,a.y,a.x2,a.y2],[n.cx,n.cy]),f=tt([n.x,n.y,n.x2,n.y2],[a.x,a.y,a.x2,a.y2]);r.push({index:i,hasOverlap:d,boxIntersect:f,sizeDifference:u,centeredDistance:l})}let i=r.filter(e=>e.hasOverlap&&e.boxIntersect);if(i.length>0){let e=i[0];for(let t=1;t<i.length;t++)i[t].centeredDistance<e.centeredDistance&&(e=i[t]);return t.splice(e.index,1)[0]}return null}function it(e,t){let n=[];for(e.sort((e,t)=>t.size-e.size),t.sort((e,t)=>t.size-e.size);e.length>0;){let r=e.shift(),i=rt(r,t);if(i)n.push([r.path,i.path]);else{let e=[r.bbox.cx,r.bbox.cy];n.push([r.path,nt(e)])}}for(;t.length>0;){let e=t.shift(),r=[e.bbox.cx,e.bbox.cy];n.push([nt(r),e.path])}return n}let at=e=>{let t=[],n=[];for(let r of e){let e=R(J(r)),i=je(r),a={isPoly:Ie(r)||q(r),size:i.width*i.height,path:r,signedArea:e,area:Math.abs(e),bbox:i};e>0?t.push(a):n.push(a)}return{outers:t,inners:n}},ot={mode:`auto`,roundValues:4,close:!1,sampleSize:10},st=(e,t,n={})=>{let r=Object.assign(ot,n),i=K(e),a=K(t),o=Le(i),s=Le(a);if(!o&&!s)return et(i,a,r);let c=R(J(i)),l=R(J(a)),u=i,d=a;Math.sign(c)<0&&(u=Be(u)),Math.sign(l)<0&&(d=Be(d));let f=Ve(u),p=Ve(d),{outers:m,inners:h}=at(f),{outers:g,inners:_}=at(p),v=it(m,g),y=it(h,_),b=[];for(let[e,t]of[...v,...y]){let[n,i]=et(e,t,{...r,reverse:!1});b.push([n,i])}return[b.map(e=>e[0]).flat(),b.map(e=>e[1]).flat()]},ct=(e,t,n,r)=>{let i=n.length,a=0;for(;a<i;){let i=e[a],o=t[a],s=n[a];i[0]===`Z`?i[0]:i[0]===`C`?(i[1]=o[1]+(s[1]-o[1])*r,i[2]=o[2]+(s[2]-o[2])*r,i[3]=o[3]+(s[3]-o[3])*r,i[4]=o[4]+(s[4]-o[4])*r,i[5]=o[5]+(s[5]-o[5])*r,i[6]=o[6]+(s[6]-o[6])*r):(i[1]=o[1]+(s[1]-o[1])*r,i[2]=o[2]+(s[2]-o[2])*r),a++}return e},lt=[`M`,`L`,`C`,`Z`],ut=e=>a(e)&&e.some(e=>a(e)&&lt.includes(e[0])),dt=e=>ut(e)&&e.length>1&&e.every(a)&&e.every(([e,...t])=>lt.includes(e)&&([`M`,`L`].includes(e)&&t.length===2&&t.every(i)||e===`C`&&t.length===6&&t.every(i)||e===`Z`&&t.length===0)),ft=(e,t,n)=>{if(!dt(t))return[!1,`Property "${e}" is not a valid PathArray.`];if(n){if(n.length!==t.length)return[!1,`Property "${e}" is expecting an array of ${n.length} path segments, got ${t.length}.`];let r=0,i=n.length;for(;r<i;){let i=n[r],a=t[r],o=i[0],s=a[0],c=i.length,l=a.length;if(o!==s||c!==l)return[!1,`Property "${e}" mismatch at index ${r}. Segments don't match:\n> segment: "[${s}, ${a.slice(1)}]"\n> reference: "[${o}, ${i.slice(1)}]"`];r++}}return[!0]},pt={interpolate:ct,validate:ft},mt=(e,t,n,r)=>{let i=Object.keys(n),a=0;for(;a<i.length;){let o=i[a++],s=n[o],c=t[o];e[o]=c+(s-c)*r}return e},ht=(e,t,n)=>{if(!c(t))return[!1,`Property "${e}" must be a plain object.`];let r=Object.keys(t),a=0,o=r.length;for(;a<o;){let o=r[a++],s=t[o];if(s==null)return[!1,`Property "${o}" from "${e}" is null/undefined.`];if(!i(s))return[!1,`Property "${o}" from "${e}" must be a number.${c(s)?` Deeper nested objects are not supported.`:` Unsupported value: "${typeof s}".`}`];if(n&&n[o]===void 0)return[!1,`Property "${o}" in "${e}" doesn't exist in the reference object.`]}return[!0]},gt={interpolate:mt,validate:ht},_t=(e,t=!1)=>{if(t){let t=new DOMMatrix,n=e.length,r=0;for(;r<n;){let n=e[r++];switch(n[0]){case`perspective`:{let e=new DOMMatrix;e.m34=-1/n[1],t.multiplySelf(e);break}case`translate`:t.translateSelf(n[1],n[2]||0,n[3]||0);break;case`rotate`:t.rotateSelf(n[1],n[2]||0,n[3]||0);break;case`rotateAxisAngle`:t.rotateAxisAngleSelf(n[1],n[2],n[3],n[4]);break;case`scale`:t.scaleSelf(n[1],n[2]||1,n[3]||1);break;case`skewX`:t.skewXSelf(n[1]);break;case`skewY`:t.skewYSelf(n[1]);break}}return t.toString()}let n=e.length,r=0,i=``;for(;r<n;){let t=e[r++];switch(t[0]){case`perspective`:i+=` perspective(${t[1]}px)`;break;case`translate`:i+=` translate3d(${t[1]}px, ${t[2]||0}px, ${t[3]||0}px)`;break;case`rotate`:{let[e,n,r]=t.slice(1);typeof e==`number`&&n===void 0&&r===void 0?i+=` rotate(${t[1]}deg)`:(i+=` rotateX(${t[1]}deg)`,t[2]!==void 0&&(i+=` rotateY(${t[2]}deg)`),t[3]!==void 0&&(i+=` rotateZ(${t[3]}deg)`));break}case`rotateAxisAngle`:i+=` rotate3d(${t[1]}, ${t[2]}, ${t[3]}, ${t[4]}deg)`;break;case`scale`:i+=` scale(${t[1]}, ${t[2]||t[1]}, ${t[3]||1})`;break;case`skewX`:i+=` skewX(${t[1]}deg)`;break;case`skewY`:i+=` skewY(${t[1]}deg)`;break}}return i.slice(1)},vt=(e,t,n)=>bt(yt(e,t,n)),yt=(e,t,n)=>{let r=Math.cos(e/2),i=Math.sin(e/2),a=Math.cos(t/2),o=Math.sin(t/2),s=Math.cos(n/2),c=Math.sin(n/2);return[r*a*s+i*o*c,i*a*s-r*o*c,r*o*s+i*a*c,r*a*c-i*o*s]},bt=e=>{let[t,n,r,i]=e,a=Math.sqrt(n*n+r*r+i*i);if(a<1e-4)return[0,0,1,0];let o=2*Math.acos(Math.max(-1,Math.min(1,t)));return[n/a,r/a,i/a,o]},xt=(e,t,n,r)=>{let i=n.length,a=0;for(;a<i;){let i=e[a],o=t[a],s=n[a];switch(i[0]){case`translate`:case`rotate`:case`scale`:case`rotateAxisAngle`:i[1]=o[1]+(s[1]-o[1])*r,typeof s[2]==`number`&&(i[2]=o[2]+(s[2]-o[2])*r),typeof s[3]==`number`&&(i[3]=o[3]+(s[3]-o[3])*r),typeof s[4]==`number`&&(i[4]=o[4]+(s[4]-o[4])*r);break;case`skewX`:case`skewY`:case`perspective`:i[1]=o[1]+(s[1]-o[1])*r;break}a++}return e},St=[`perspective`,`translate`,`rotate`,`rotateAxisAngle`,`scale`,`skewX`,`skewY`],Ct=e=>a(e)&&e.some(e=>a(e)&&St.includes(e[0])),wt=e=>Ct(e)&&e.every(([e,...t])=>St.includes(e)&&([`translate`,`rotate`,`scale`].includes(e)&&t.length>0&&t.length<=3&&t.every(i)||e===`rotateAxisAngle`&&t.length===4&&t.every(i)||[`skewX`,`skewY`,`perspective`].includes(e)&&t.length===1&&i(t[0]))),Tt=(e,t,n)=>{if(!wt(t))return[!1,`Property "${e}" must be an array of TransformStep.`];if(n){if(n.length!==t.length)return[!1,`Property "${e}" is expecting an array of ${n.length} transform steps, got ${t.length}.`];let r=0,i=t.length;for(;r<i;){let i=t[r],a=n[r],o=i[0],s=a[0];if(a&&(s!==o||a.length!==i.length))return[!1,`Property "${e}" mismatch at index ${r}":\n> step: ["${o}", ${i.slice(1)}]\n> reference: ["${s}", ${a.slice(1)}]`];r++}}return[!0]},Et={interpolate:xt,validate:Tt},Dt=()=>globalThis.performance.now(),X=()=>Dt();function Ot(e){Dt=e}let Z=[],kt=0,Q=0;function At(e=X()){let t=0;for(;t<Q;)Z[t]?.update(e)?t+=1:(Z.splice(t,1),Q--);Q===0?(cancelAnimationFrame(kt),kt=0):kt=requestAnimationFrame(At)}function $(e){Z.includes(e)||(Z[Q++]=e,kt||At())}function jt(e){let t=Z.indexOf(e);t>-1&&(Z.splice(t,1),Q--)}var Mt=class{state;_state;_startIsSet=!1;_repeat=0;_yoyo=!1;_reversed=!1;_initialRepeat=0;_startFired=!1;_propsStart={};_propsEnd={};_isPlaying=!1;_duration=1e3;_delay=0;_pauseStart=0;_repeatDelay=0;_startTime=0;_errors=new Map;_interpolators=new Map;_validators=new Map;_easing=e=>e;_onUpdate;_onComplete;_onStart;_onStop;_onPause;_onResume;_onRepeat;_runtime=[];constructor(e){return this.state={},v.call(this,e),this._errors.size?this._state=e:(this.state=e,this._state=_(e)),this}get isPlaying(){return this._isPlaying}get isPaused(){return this._pauseStart>0}get isValidState(){return Object.keys(this.state).length>0}get isValid(){return this._errors.size===0}getDuration(){return this._duration/1e3}get totalDuration(){let e=this._initialRepeat;return(this._delay+this._duration*(e+1)+this._repeatDelay*e)/1e3}getValidator(e){return this._validators.get(e)}getErrors(){return this._errors}start(e=X(),t=!1){return this._isPlaying?this:this._pauseStart?this.resume():this.isValid?(this._startTime&&!t&&this._resetState(),(!this._startIsSet||t)&&(this._startIsSet=!0,this._setProps(this.state,this._propsStart,this._propsEnd,t)),this._isPlaying=!0,this._startTime=e,this._startTime+=this._delay,$(this),this):(this._report(),this)}startFromLast(e=X()){return this.start(e,!0)}stop(){return this._isPlaying?(jt(this),this._isPlaying=!1,this._repeat=this._initialRepeat,this._reversed=!1,this._onStop?.(this.state),this):this}reverse(){if(!this._isPlaying)return this;let e=X(),t=e-this._startTime;return this._startTime=e-(this._duration-t),this._reversed=!this._reversed,this._initialRepeat>0&&(this._repeat=this._initialRepeat-this._repeat),this}pause(e=X()){return this._isPlaying?(this._pauseStart=e,this._isPlaying=!1,this._onPause?.(this.state),this):this}resume(e=X()){return this._pauseStart?(this._startTime+=e-this._pauseStart,this._pauseStart=0,this._isPlaying=!0,this._onResume?.(this.state),$(this),this):this}from(e){return!this.isValidState||this.isPlaying?this:(this._evaluate(e),this.isValid&&(Object.assign(this._propsStart,e),this._startIsSet=!1),this)}to(e){return!this.isValidState||this.isPlaying?this:(this._evaluate(e),this.isValid&&(this._propsEnd=e,this._startIsSet=!1),this)}duration(e=1){return this._duration=e*1e3,this}delay(e=0){return this._delay=e*1e3,this}repeat(e=0){return this._repeat=e,this._initialRepeat=e,this}repeatDelay(e=0){return this._repeatDelay=e*1e3,this}yoyo(e=!1){return this._yoyo=e,this}easing(e=e=>e){return this._easing=e,this}onStart(e){return this._onStart=e,this}onUpdate(e){return this._onUpdate=e,this}onComplete(e){return this._onComplete=e,this}onStop(e){return this._onStop=e,this}onPause(e){return this._onPause=e,this}onResume(e){return this._onResume=e,this}onRepeat(e){return this._onRepeat=e,this}update(e=X()){if(!this._isPlaying)return!1;if(e<this._startTime)return!0;this._startFired||=(this._onStart?.(this.state),!0);let t=this._reversed,n=this.state,r=this._runtime,i=(e-this._startTime)/this._duration;i>1&&(i=1);let a=this._easing(t?1-i:i);a=t?1-a:a;let o=r.length,s=0;for(;s<o;){let e=r[s++],i=e[0],o=e[1],c=e[2],l=t?e[4]:e[3],u=t?e[3]:e[4];typeof u==`number`?n[o]=l+(u-l)*a:c(i,l,u,a)}return this._onUpdate?.(n,i),i===1?this._repeat===0?(this._isPlaying=!1,this._repeat=this._initialRepeat,this._reversed=!1,this._onComplete?.(n),!1):(this._repeat!==1/0&&this._repeat--,this._yoyo&&(this._reversed=!t),this._startTime=e,this._startTime+=this._repeatDelay,this._onRepeat?.(n),!0):!0}use(e,{interpolate:t,validate:n}){return t&&!this._interpolators.has(e)&&this._interpolators.set(e,t),n&&!this._validators.has(e)&&this._validators.set(e,n),this._evaluate(),this}_resetState(){g(this.state,this._state)}clear(){return this._propsStart={},this._propsEnd={},this._runtime.length=0,this._startTime=0,this._pauseStart=0,this._repeat=0,this._initialRepeat=0,this}_setProps(e,t,n,r){let i=Object.keys(n),o=i.length;this._runtime.length=0;let c=0,l=0;for(;l<o;){let o=i[l++],u=e[o];(t[o]===void 0||r)&&(s(u)||a(u)?t[o]=_(u):t[o]=u);let d=this._interpolators.get(o)||null;this._runtime[c++]=[u,o,d,t[o],n[o]]}}_evaluate(e){if(this.isValidState)e&&v.call(this,e,this._state);else{let e=this._state;v.call(this,e),this.isValid&&(this.state=e,this._state=_(e))}return this}_report(){if(!this.isValid){let e=[`[Tween] failed validation:`,`- `+Array.from(this._errors.values()).join(`
4
4
  - `)];console.warn(e.join(`
5
- `))}return this}},$=class{state;_state;_entries=[];_labels=new Map;_progress=0;_duration=0;_yoyo=!1;_reversed=!1;_time=0;_pauseTime=0;_lastTime=0;_isPlaying=!1;_repeat=0;_repeatDelay=0;_repeatDelayStart=0;_initialRepeat=0;_errors=new Map;_interpolators=new Map;_validators=new Map;_onStart;_onStop;_onPause;_onResume;_onUpdate;_onComplete;_onRepeat;constructor(e){return this.state={},v.call(this,e),this._errors.size?this._state=e:(this.state=e,this._state={...e}),this}get progress(){return this._progress}get duration(){return this._duration/1e3}get totalDuration(){let e=this._initialRepeat;return(this._duration*(e+1)+this._repeatDelay*e)/1e3}get isPlaying(){return this._isPlaying}get isPaused(){return!this._isPlaying&&this._pauseTime>0}get isValidState(){return Object.keys(this.state).length>0}get isValid(){return this._errors.size===0}getValidator(e){return this._validators.get(e)}getErrors(){return this._errors}play(e=W()){return this._pauseTime?this.resume():this._isPlaying?this:this.isValid?(this._time&&this._resetState(),this._isPlaying=!0,this._lastTime=e,this._time=0,this._onStart?.(this.state,0),X(this),this):(this._report(),this)}pause(e=W()){return this._isPlaying?(this._isPlaying=!1,this._pauseTime=e,this._onPause?.(this.state,this.progress),this):this}resume(e=W()){if(this._isPlaying)return this;this._isPlaying=!0;let t=e-this._pauseTime;return this._pauseTime=0,this._lastTime+=t,this._onResume?.(this.state,this.progress),X(this),this}reverse(){return this._isPlaying?(this._reversed=!this._reversed,this._time=this._duration-this._time,this._initialRepeat>0&&(this._repeat=this._initialRepeat-this._repeat),this):this}seek(e){return this._time=this._resolvePosition(e),this}stop(){return this._isPlaying?(this._isPlaying=!1,this._time=0,this._pauseTime=0,this._repeat=this._initialRepeat,this._reversed=!1,Z(this),this._onStop?.(this.state,this._progress),this):this}repeat(e=0){return this._repeat=e,this._initialRepeat=e,this}repeatDelay(e=0){return this._repeatDelay=e*1e3,this}yoyo(e=!1){return this._yoyo=e,this}label(e,t){return this._labels.set(e,this._resolvePosition(t)),this}to({duration:e=1,easing:t=e=>e,...n},r=`+=0`){if(!this.isValidState||this._isPlaying)return this;if(this._evaluate(n),this.isValid){let i=this._resolvePosition(r),a=n,o={},s=e*1e3;this._entries.push({from:o,to:a,runtime:[],startTime:i,duration:s,easing:t,isActive:!1});let c=i+s;this._duration=Math.max(this._duration,c)}return this}onStart(e){return this._onStart=e,this}onPause(e){return this._onPause=e,this}onResume(e){return this._onResume=e,this}onStop(e){return this._onStop=e,this}onUpdate(e){return this._onUpdate=e,this}onComplete(e){return this._onComplete=e,this}onRepeat(e){return this._onRepeat=e,this}use(e,{interpolate:t,validate:n}){return t&&!this._interpolators.has(e)&&this._interpolators.set(e,t),n&&!this._validators.has(e)&&this._validators.set(e,n),this._evaluate(),this}update(e=W()){if(!this._isPlaying)return!1;if(this._repeatDelayStart){if(e-this._repeatDelayStart<this._repeatDelay)return this._lastTime=e,!0;this._repeatDelayStart=0}let t=e-this._lastTime,n=this._reversed;this._lastTime=e,this._time+=t,this._progress=this._time>this._duration?1:this._time/this._duration;let r=this._entries,i=this.state,a=r.length,o=0;for(;o<a;){let e=r[o++],t=n?this._duration-e.startTime-e.duration:e.startTime,a=(this._time-t)/e.duration;if(a>1&&(a=1),a<0&&(a=0),!e.isActive&&a>0&&a<1&&(e.runtime.length===0&&this._setEntry(e,i),e.isActive=!0),e.isActive){let t=e.easing(n?1-a:a);t=n?1-t:t;let r=e.runtime,o=r.length,s=0;for(;s<o;){let e=r[s++],a=e[0],o=e[1],c=e[2],l=n?e[4]:e[3],u=n?e[3]:e[4];typeof u==`number`?i[o]=l+(u-l)*t:c(a,l,u,t)}a===1&&(e.isActive=!1)}}return this._onUpdate?.(i,this._progress),this._progress===1?this._repeat===0?(this._isPlaying=!1,this._repeat=this._initialRepeat,this._reversed=!1,this._onComplete?.(i,1),this._resetState(!0),!1):(this._repeat!==1/0&&this._repeat--,this._yoyo&&(this._reversed=!n),this._time=0,this._resetState(),this._onRepeat?.(i,this.progress),this._repeatDelay>0&&(this._repeatDelayStart=e),!0):!0}clear(){return this._entries.length=0,this._duration=0,this._labels.clear(),this._time=0,this._progress=0,this._pauseTime=0,this._lastTime=0,this._repeatDelay=0,this._repeat=this._initialRepeat,this._repeatDelayStart=0,this._reversed=!1,this}_setEntry(e,t){let n=e.from,r=e.to,a=Object.keys(r),s=a.length;e.runtime=Array(s);let c=0,l=0;for(;l<s;){let s=a[l++],u=t[s];o(u)||i(u)?n[s]=_(u):n[s]=u;let d=this._interpolators.get(s)||null;e.runtime[c++]=[u,s,d,n[s],r[s]]}}_resetState(e=!1){let t=0,n=this._entries.length;for(;t<n;){let e=this._entries[t++];e.isActive=!1}e||g(this.state,this._state)}_resolvePosition(e){if(typeof e==`number`)return Math.min(this._duration,Math.max(0,e*1e3));if(typeof e==`string`){let t=this._labels.get(e);if(t!==void 0)return t;if(e.startsWith(`+=`)||e.startsWith(`-=`)){let t=parseFloat(e.slice(2));return isNaN(t)&&(t=0),t*=1e3,e.startsWith(`+=`)?this._duration+t:Math.max(0,this._duration-t)}}return this._duration}_evaluate(e){if(this.isValidState)e&&v.call(this,e,this._state);else{let e=this._state;v.call(this,e),this.isValid&&(this.state=e,this._state=_(e))}return this}_report(){if(!this.isValid){let e=[`[Timeline] failed validation:`,`- `+Array.from(this._errors.values()).join(`
5
+ `))}return this}},Nt=class{state;_state;_entries=[];_labels=new Map;_progress=0;_duration=0;_yoyo=!1;_reversed=!1;_time=0;_pauseTime=0;_lastTime=0;_isPlaying=!1;_repeat=0;_repeatDelay=0;_repeatDelayStart=0;_initialRepeat=0;_errors=new Map;_interpolators=new Map;_validators=new Map;_onStart;_onStop;_onPause;_onResume;_onUpdate;_onComplete;_onRepeat;constructor(e){return this.state={},v.call(this,e),this._errors.size?this._state=e:(this.state=e,this._state={...e}),this}get progress(){return this._progress}get duration(){return this._duration/1e3}get totalDuration(){let e=this._initialRepeat;return(this._duration*(e+1)+this._repeatDelay*e)/1e3}get isPlaying(){return this._isPlaying}get isPaused(){return!this._isPlaying&&this._pauseTime>0}get isValidState(){return Object.keys(this.state).length>0}get isValid(){return this._errors.size===0}getValidator(e){return this._validators.get(e)}getErrors(){return this._errors}play(e=X()){return this._pauseTime?this.resume():this._isPlaying?this:this.isValid?(this._time&&this._resetState(),this._isPlaying=!0,this._lastTime=e,this._time=0,this._onStart?.(this.state,0),$(this),this):(this._report(),this)}pause(e=X()){return this._isPlaying?(this._isPlaying=!1,this._pauseTime=e,this._onPause?.(this.state,this.progress),this):this}resume(e=X()){if(this._isPlaying)return this;this._isPlaying=!0;let t=e-this._pauseTime;return this._pauseTime=0,this._lastTime+=t,this._onResume?.(this.state,this.progress),$(this),this}reverse(){return this._isPlaying?(this._reversed=!this._reversed,this._time=this._duration-this._time,this._initialRepeat>0&&(this._repeat=this._initialRepeat-this._repeat),this):this}seek(e){return this._time=this._resolvePosition(e),this}stop(){return this._isPlaying?(this._isPlaying=!1,this._time=0,this._pauseTime=0,this._repeat=this._initialRepeat,this._reversed=!1,jt(this),this._onStop?.(this.state,this._progress),this):this}repeat(e=0){return this._repeat=e,this._initialRepeat=e,this}repeatDelay(e=0){return this._repeatDelay=e*1e3,this}yoyo(e=!1){return this._yoyo=e,this}label(e,t){return this._labels.set(e,this._resolvePosition(t)),this}to({duration:e=1,easing:t=e=>e,...n},r=`+=0`){if(!this.isValidState||this._isPlaying)return this;if(this._evaluate(n),this.isValid){let i=this._resolvePosition(r),a=n,o={},s=e*1e3;this._entries.push({from:o,to:a,runtime:[],startTime:i,duration:s,easing:t,isActive:!1});let c=i+s;this._duration=Math.max(this._duration,c)}return this}onStart(e){return this._onStart=e,this}onPause(e){return this._onPause=e,this}onResume(e){return this._onResume=e,this}onStop(e){return this._onStop=e,this}onUpdate(e){return this._onUpdate=e,this}onComplete(e){return this._onComplete=e,this}onRepeat(e){return this._onRepeat=e,this}use(e,{interpolate:t,validate:n}){return t&&!this._interpolators.has(e)&&this._interpolators.set(e,t),n&&!this._validators.has(e)&&this._validators.set(e,n),this._evaluate(),this}update(e=X()){if(!this._isPlaying)return!1;if(this._repeatDelayStart){if(e-this._repeatDelayStart<this._repeatDelay)return this._lastTime=e,!0;this._repeatDelayStart=0}let t=e-this._lastTime,n=this._reversed;this._lastTime=e,this._time+=t,this._progress=this._time>this._duration?1:this._time/this._duration;let r=this._entries,i=this.state,a=r.length,o=0;for(;o<a;){let e=r[o++],t=n?this._duration-e.startTime-e.duration:e.startTime,a=(this._time-t)/e.duration;if(a>1&&(a=1),a<0&&(a=0),!e.isActive&&a>0&&a<1&&(e.runtime.length===0&&this._setEntry(e,i),e.isActive=!0),e.isActive){let t=e.easing(n?1-a:a);t=n?1-t:t;let r=e.runtime,o=r.length,s=0;for(;s<o;){let e=r[s++],a=e[0],o=e[1],c=e[2],l=n?e[4]:e[3],u=n?e[3]:e[4];typeof u==`number`?i[o]=l+(u-l)*t:c(a,l,u,t)}a===1&&(e.isActive=!1)}}return this._onUpdate?.(i,this._progress),this._progress===1?this._repeat===0?(this._isPlaying=!1,this._repeat=this._initialRepeat,this._reversed=!1,this._onComplete?.(i,1),this._resetState(!0),!1):(this._repeat!==1/0&&this._repeat--,this._yoyo&&(this._reversed=!n),this._time=0,this._resetState(),this._onRepeat?.(i,this.progress),this._repeatDelay>0&&(this._repeatDelayStart=e),!0):!0}clear(){return this._entries.length=0,this._duration=0,this._labels.clear(),this._time=0,this._progress=0,this._pauseTime=0,this._lastTime=0,this._repeatDelay=0,this._repeat=this._initialRepeat,this._repeatDelayStart=0,this._reversed=!1,this}_setEntry(e,t){let n=e.from,r=e.to,i=Object.keys(r),o=i.length;e.runtime=Array(o);let c=0,l=0;for(;l<o;){let o=i[l++],u=t[o];s(u)||a(u)?n[o]=_(u):n[o]=u;let d=this._interpolators.get(o)||null;e.runtime[c++]=[u,o,d,n[o],r[o]]}}_resetState(e=!1){let t=0,n=this._entries.length;for(;t<n;){let e=this._entries[t++];e.isActive=!1}e||g(this.state,this._state)}_resolvePosition(e){if(typeof e==`number`)return Math.min(this._duration,Math.max(0,e*1e3));if(typeof e==`string`){let t=this._labels.get(e);if(t!==void 0)return t;if(e.startsWith(`+=`)||e.startsWith(`-=`)){let t=parseFloat(e.slice(2));return isNaN(t)&&(t=0),t*=1e3,e.startsWith(`+=`)?this._duration+t:Math.max(0,this._duration-t)}}return this._duration}_evaluate(e){if(this.isValidState)e&&v.call(this,e,this._state);else{let e=this._state;v.call(this,e),this.isValid&&(this.state=e,this._state=_(e))}return this}_report(){if(!this.isValid){let e=[`[Timeline] failed validation:`,`- `+Array.from(this._errors.values()).join(`
6
6
  - `)].join(`
7
- `);console.warn(e)}return this}},ee=`0.0.4`;e.Easing=t,e.Queue=K,e.Runtime=Y,e.Timeline=$,e.Tween=Q,e.addToQueue=X,e.arrayConfig=S,e.deepAssign=g,e.deproxy=_,e.dummyInstance=d,e.eulerToAxisAngle=P,e.interpolateArray=y,e.interpolateObject=A,e.interpolatePath=w,e.interpolateTransform=L,e.isArray=i,e.isDeepObject=c,e.isFunction=a,e.isNumber=r,e.isObject=o,e.isPathLike=E,e.isPlainObject=s,e.isServer=l,e.isString=n,e.isTransformLike=z,e.isValidArray=b,e.isValidPath=D,e.isValidTransformArray=B,e.now=W,e.objectConfig=M,e.objectHasProp=m,e.pathArrayConfig=k,e.pathToString=C,e.removeFromQueue=Z,e.roundTo=p,e.setNow=G,e.transformConfig=H,e.transformToString=N,e.validateArray=x,e.validateObject=j,e.validatePath=O,e.validateTransform=V,e.validateValues=v,Object.defineProperty(e,`version`,{enumerable:!0,get:function(){return ee}})});
7
+ `);console.warn(e)}return this}},Pt=`0.1.0`;e.Easing=n,e.Queue=Z,e.Runtime=At,e.Timeline=Nt,e.Tween=Mt,e.addToQueue=$,e.arrayConfig=S,e.deepAssign=g,e.deproxy=_,e.dummyInstance=f,e.equalizePaths=st,e.equalizeSegments=et,e.eulerToAxisAngle=vt,e.interpolateArray=y,e.interpolateObject=mt,e.interpolatePath=ct,e.interpolateTransform=xt,e.isArray=a,e.isDeepObject=l,e.isFunction=o,e.isNumber=i,e.isObject=s,e.isPathLike=ut,e.isPlainObject=c,e.isServer=u,e.isString=r,e.isTransformLike=Ct,e.isValidArray=b,e.isValidPath=dt,e.isValidTransformArray=wt,e.now=X,e.objectConfig=gt,e.objectHasProp=m,e.pathArrayConfig=pt,e.pathToString=Ae,e.removeFromQueue=jt,e.setNow=Ot,e.transformConfig=Et,e.transformToString=_t,e.validateArray=x,e.validateObject=ht,e.validatePath=ft,e.validateTransform=Tt,e.validateValues=v,Object.defineProperty(e,`version`,{enumerable:!0,get:function(){return Pt}})});
8
8
  //# sourceMappingURL=tween.min.js.map