var e={value:()=>{}};function t(){for(var e=0,t=arguments.length,r={},i;e<t;++e){if(!(i=arguments[e]+``)||i in r||/[\s.]/.test(i))throw Error(`illegal type: `+i);r[i]=[]}return new n(r)}function n(e){this._=e}function r(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}n.prototype=t.prototype={constructor:n,on:function(e,t){var n=this._,o=r(e+``,n),s,c=-1,l=o.length;if(arguments.length<2){for(;++c<l;)if((s=(e=o[c]).type)&&(s=i(n[s],e.name)))return s;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++c<l;)if(s=(e=o[c]).type)n[s]=a(n[s],e.name,t);else if(t==null)for(s in n)n[s]=a(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new n(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function i(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function a(t,n,r){for(var i=0,a=t.length;i<a;++i)if(t[i].name===n){t[i]=e,t=t.slice(0,i).concat(t.slice(i+1));break}return r!=null&&t.push({name:n,value:r}),t}var o=0,s=0,c=0,l=1e3,u,d,f=0,p=0,m=0,h=typeof performance==`object`&&performance.now?performance:Date,g=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function _(){return p||=(g(v),h.now()+m)}function v(){p=0}function y(){this._call=this._time=this._next=null}y.prototype=b.prototype={constructor:y,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?_():+n)+(t==null?0:+t),!this._next&&d!==this&&(d?d._next=this:u=this,d=this),this._call=e,this._time=n,T()},stop:function(){this._call&&(this._call=null,this._time=1/0,T())}};function b(e,t,n){var r=new y;return r.restart(e,t,n),r}function x(){_(),++o;for(var e=u,t;e;)(t=p-e._time)>=0&&e._call.call(void 0,t),e=e._next;--o}function S(){p=(f=h.now())+m,o=s=0;try{x()}finally{o=0,w(),p=0}}function C(){var e=h.now(),t=e-f;t>l&&(m-=t,f=e)}function w(){for(var e,t=u,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:u=n);d=e,T(r)}function T(e){o||(s&&=clearTimeout(s),e-p>24?(e<1/0&&(s=setTimeout(S,e-h.now()-m)),c&&=clearInterval(c)):(c||=(f=h.now(),setInterval(C,l)),o=1,g(S)))}export{t as i,_ as n,b as r,y as t};