import*as UI from"../ui/ui.js";export class ExtensionView extends UI.Widget.Widget{constructor(e,i,t,s){super(),this.setHideOnDetach(),this.element.className="vbox flex-auto",this.element.tabIndex=-1,this._server=e,this._id=i,this._iframe=document.createElement("iframe"),this._iframe.addEventListener("load",this._onLoad.bind(this),!1),this._iframe.src=t,this._iframe.className=s,this.setDefaultFocusedElement(this.element),this.element.appendChild(this._iframe)}wasShown(){"number"===typeof this._frameIndex&&this._server.notifyViewShown(this._id,this._frameIndex)}willHide(){"number"===typeof this._frameIndex&&this._server.notifyViewHidden(this._id)}_onLoad(){const e=window.frames;this._frameIndex=Array.prototype.indexOf.call(e,this._iframe.contentWindow),this.isShowing()&&this._server.notifyViewShown(this._id,this._frameIndex)}}export class ExtensionNotifierView extends UI.Widget.VBox{constructor(e,i){super(),this._server=e,this._id=i}wasShown(){this._server.notifyViewShown(this._id)}willHide(){this._server.notifyViewHidden(this._id)}}