import{UIString}from'../common/common.js';import{SDKModel,WebAuthnModel}from'../sdk/sdk.js';import{Widget,Toolbar}from'../ui/ui.js';class WebauthnPaneImpl extends Widget.VBox{constructor(){super(true);this.registerRequiredCSS('webauthn/webauthnPane.css');this._enabled=false;const topToolbarContainer=this.contentElement.createChild('div','webauthn-toolbar-container');const topToolbar=new Toolbar.Toolbar('webauthn-toolbar',topToolbarContainer);const enableCheckboxTitle=UIString.UIString('Enable Virtual Authenticator Environment');this._enableCheckbox=new Toolbar.ToolbarCheckbox(enableCheckboxTitle,enableCheckboxTitle,this.handleCheckboxToggle.bind(this));topToolbar.appendToolbarItem(this._enableCheckbox);const mainTarget=SDKModel.TargetManager.instance().mainTarget();if(mainTarget){this._model=mainTarget.model(WebAuthnModel.WebAuthnModel);}}
ownerViewDisposed(){this._enableCheckbox.setChecked(false);this._setVirtualAuthEnvEnabled(false);}
modelAdded(webAuthnModel){}
modelRemoved(webAuthnModel){}
_setVirtualAuthEnvEnabled(enable){this._enabled=enable;this._model.setVirtualAuthEnvEnabled(enable);}
handleCheckboxToggle(){this._setVirtualAuthEnvEnabled(!this._enabled);}}
var WebauthnPane=Object.freeze({__proto__:null,WebauthnPaneImpl:WebauthnPaneImpl});export{WebauthnPane};