export function formatMillisecondsToSeconds(t,h){const i=Math.pow(10,3-h),s=Math.pow(10,Math.max(0,h));return Math.round(t/i)/s+" s"}export class Bounds{constructor(t,h,i,s){this._min=t,this._max=h,this._low=this._min,this._high=this._max,this._maxRange=i,this._minRange=s}get low(){return this._low}get high(){return this._high}get min(){return this._min}get max(){return this._max}get range(){return this._high-this._low}_reassertBounds(){let t=!0;for(;t;){if(t=!1,this.range<this._minRange){t=!0;const h=(this._minRange-this.range)/2;this._high+=h,this._low-=h}this._low<this._min&&(t=!0,this._low=this._min),this._high>this._max&&(t=!0,this._high=this._max)}}zoomOut(t,h){const i=this._high-this._low,s=i*Math.pow(1.1,t)-i,_=s*h,n=s-_;this._low-=_,this._high+=n,this._reassertBounds()}zoomIn(t,h){const i=this._high-this._low;if(this.range<=this._minRange)return;const s=i-i/Math.pow(1.1,t),_=s*h,n=s-_;this._low+=_,this._high-=n,this._reassertBounds()}addMax(t){const h=this._high-this._low,i=this._high===this._max,s=this._low===this._min||h>=this._maxRange;this._max+=t,i&&s&&(this._high=this._max),this._reassertBounds()}pushMaxAtLeastTo(t){return this._max<t&&(this.addMax(t-this._max),!0)}}