/** * Bundled by jsDelivr using Rollup v4.62.2 and esbuild v0.28.1. * Original file: /npm/d3-timer@3.0.1/src/index.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ var o=0,c=0,u=0,T=1e3,h,a,p=0,r=0,m=0,l=typeof performance=="object"&&performance.now?performance:Date,I=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function v(){return r||(I(A),r=l.now()+m)}function A(){r=0}function s(){this._call=this._time=this._next=null}s.prototype=F.prototype={constructor:s,restart:function(n,t,i){if(typeof n!="function")throw new TypeError("callback is not a function");i=(i==null?v():+i)+(t==null?0:+t),!this._next&&a!==this&&(a?a._next=this:h=this,a=this),this._call=n,this._time=i,k()},stop:function(){this._call&&(this._call=null,this._time=1/0,k())}};function F(n,t,i){var e=new s;return e.restart(n,t,i),e}function y(){v(),++o;for(var n=h,t;n;)(t=r-n._time)>=0&&n._call.call(void 0,t),n=n._next;--o}function b(){r=(p=l.now())+m,o=c=0;try{y()}finally{o=0,N(),r=0}}function D(){var n=l.now(),t=n-p;t>T&&(m-=t,p=n)}function N(){for(var n,t=h,i,e=1/0;t;)t._call?(e>t._time&&(e=t._time),n=t,t=t._next):(i=t._next,t._next=null,t=n?n._next=i:h=i);a=n,k(e)}function k(n){if(!o){c&&(c=clearTimeout(c));var t=n-r;t>24?(n<1/0&&(c=setTimeout(b,n-l.now()-m)),u&&(u=clearInterval(u))):(u||(p=l.now(),u=setInterval(D,T)),o=1,I(b))}}function $(n,t,i){var e=new s;return t=t==null?0:+t,e.restart(w=>{e.stop(),n(w+t)},t,i),e}function E(n,t,i){var e=new s,w=t;return t==null?(e.restart(n,t,i),e):(e._restart=e.restart,e.restart=function(j,_,f){_=+_,f=f==null?v():+f,e._restart(function q(x){x+=w,e._restart(q,w+=_,f),j(x)},_,f)},e.restart(n,t,i),e)}export{E as interval,v as now,$ as timeout,F as timer,y as timerFlush};