import{ls}from"../platform/platform.js";import*as Root from"../root/root.js";import{Toolbar}from"./Toolbar.js";import{ViewManager}from"./ViewManager.js";import{VBox,Widget}from"./Widget.js";export class View{viewId(){throw new Error("not implemented")}title(){throw new Error("not implemented")}isCloseable(){throw new Error("not implemented")}isTransient(){throw new Error("not implemented")}toolbarItems(){throw new Error("not implemented")}widget(){throw new Error("not implemented")}disposeView(){}}export class SimpleView extends VBox{constructor(e,t){super(t),this._title=e}viewId(){return this._title}title(){return this._title}isCloseable(){return!1}isTransient(){return!1}toolbarItems(){return Promise.resolve([])}widget(){return Promise.resolve(this)}revealView(){return ViewManager.instance().revealView(this)}disposeView(){}}class ProvidedViewExtensionDescriptor extends Root.Runtime.RuntimeExtensionDescriptor{constructor(){super(),this.id,this.persistence,this.actionIds,this.hasToolbar}}export class ProvidedView{constructor(e){this._extension=e}viewId(){return this._descriptor().id}title(){return ls(this._extension.title())}order(){return this._descriptor().order}isCloseable(){return"closeable"===this._descriptor().persistence}isTransient(){return"transient"===this._descriptor().persistence}toolbarItems(){const e=this._descriptor().actionIds;if(e){const t=e.split(",").map((e=>Toolbar.createActionButtonForId(e.trim())));return Promise.resolve(t)}return this._descriptor().hasToolbar?this.widget().then((e=>e.toolbarItems())):Promise.resolve([])}async widget(){this._widgetRequested=!0;const e=await this._extension.instance();if(!(e instanceof Widget))throw new Error("view className should point to a UI.Widget");return e}async disposeView(){if(!this._widgetRequested)return;const e=await this.widget();await e.ownerViewDisposed()}_descriptor(){return this._extension.descriptor()}}export class ViewLocation{appendApplicableItems(e){}appendView(e,t){}showView(e,t,r){throw new Error("not implemented")}removeView(e){}widget(){throw new Error("not implemented")}}export class TabbedViewLocation extends ViewLocation{tabbedPane(){throw new Error("not implemented")}enableMoreTabsButton(){throw new Error("not implemented")}}export class ViewLocationResolver{resolveLocation(e){throw new Error("not implemented")}}