"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./mix/index.mjs.js"),t=require("../../../../motion-utils/dist/es/errors.mjs.js"),s=require("../../../../motion-utils/dist/es/clamp.mjs.js"),r=require("../../../../motion-utils/dist/es/noop.mjs.js"),i=require("../../../../motion-utils/dist/es/pipe.mjs.js"),n=require("../../../../motion-utils/dist/es/progress.mjs.js"),o=require("../../../../motion-utils/dist/es/global-config.mjs.js");exports.interpolate=function(u,l){let{clamp:m=!0,ease:p,mixer:a}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const g=u.length;if(t.invariant(g===l.length,"Both input and output ranges must be the same length","range-length"),1===g)return()=>l[0];if(2===g&&l[0]===l[1])return()=>l[1];const j=u[0]===u[1];u[0]>u[g-1]&&(u=[...u].reverse(),l=[...l].reverse());const c=function(t,s,n){const u=[],l=n||o.MotionGlobalConfig.mix||e.mix,m=t.length-1;for(let e=0;e<m;e++){let n=l(t[e],t[e+1]);if(s){const t=Array.isArray(s)?s[e]||r.noop:s;n=i.pipe(t,n)}u.push(n)}return u}(l,p,a),f=c.length,d=e=>{if(j&&e<u[0])return l[0];let t=0;if(f>1)for(;t<u.length-2&&!(e<u[t+1]);t++);const s=n.progress(u[t],u[t+1],e);return c[t](s)};return m?e=>d(s.clamp(u[0],u[g-1],e)):d};
//# sourceMappingURL=interpolate.mjs.js.map
