export class Progress{setTotalWork(e){}setTitle(e){}setWorked(e,t){}worked(e){}done(){}isCanceled(){return!1}}export class CompositeProgress{constructor(e){this._parent=e,this._children=[],this._childrenDone=0,this._parent.setTotalWork(1),this._parent.setWorked(0)}_childDone(){++this._childrenDone===this._children.length&&this._parent.done()}createSubProgress(e){const t=new SubProgress(this,e);return this._children.push(t),t}_update(){let e=0,t=0;for(let s=0;s<this._children.length;++s){const o=this._children[s];o._totalWork&&(t+=o._weight*o._worked/o._totalWork),e+=o._weight}this._parent.setWorked(t/e)}}export class SubProgress{constructor(e,t){this._composite=e,this._weight=t||1,this._worked=0,this._totalWork=0}isCanceled(){return this._composite._parent.isCanceled()}setTitle(e){this._composite._parent.setTitle(e)}done(){this.setWorked(this._totalWork),this._composite._childDone()}setTotalWork(e){this._totalWork=e,this._composite._update()}setWorked(e,t){this._worked=e,"undefined"!==typeof t&&this.setTitle(t),this._composite._update()}worked(e){this.setWorked(this._worked+(e||1))}}export class ProgressProxy{constructor(e,t){this._delegate=e,this._doneCallback=t}isCanceled(){return!!this._delegate&&this._delegate.isCanceled()}setTitle(e){this._delegate&&this._delegate.setTitle(e)}done(){this._delegate&&this._delegate.done(),this._doneCallback&&this._doneCallback()}setTotalWork(e){this._delegate&&this._delegate.setTotalWork(e)}setWorked(e,t){this._delegate&&this._delegate.setWorked(e,t)}worked(e){this._delegate&&this._delegate.worked(e)}}