/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
function e(e,n,t,r){const u=3*e,a=3*(t-e)-u,i=1-u-a,s=3*n,o=3*(r-n)-s,f=1-s-o;function c(e){return((i*e+a)*e+u)*e}function l(e){return((f*e+o)*e+s)*e}function b(e){return(3*i*e+2*a)*e+u}function p(e,n){let t,r,u,a,i,s;for(u=e,s=0;s<8;s++){if(a=c(u)-e,Math.abs(a)<n)return u;if(i=b(u),Math.abs(i)<1e-6)break;u-=a/i}if(t=0,r=1,u=e,u<t)return t;if(u>r)return r;for(;t<r;){if(a=c(u),Math.abs(a-e)<n)return u;e>a?t=u:r=u,u=.5*(r-t)+t}return u}return function(e,n=1e-6){return l(p(e,n))}}const n=/^cubic-bezier\((.*)\)/,t={ease:e(.25,.1,.25,1),linear:e(0,0,1,1),easeIn:e(.42,0,1,1),easeOut:e(0,0,.58,1),easeInOut:e(.42,0,.58,1)};function r(r){let u=t[r]||null;if(!u){const t=n.exec(r);if(t){const n=t[1].split(",").map(e=>parseFloat(e.trim()));4!==n.length||n.some(e=>isNaN(e))||(u=e.apply(e,n))}}return u}t["ease-in"]=t.easeIn,t["ease-out"]=t.easeOut,t["ease-in-out"]=t.easeInOut;export{t as easingFunctions,r as parse,e as unitBezier};
