/**
 * Copyright 2018 The Pennsylvania State University
 * @license Apache-2.0, see License.md for full text.
 */
import{LitElement as t,html as e}from"../../../../../lit/index.js";import{store as i}from"../haxcms-site-store.js";import{autorun as s,toJS as a}from"../../../../../mobx/dist/mobx.esm.js";import"../../../../jwt-login/jwt-login.js";class HAXCMSBackendDemo extends t{static get tag(){return"haxcms-backend-demo"}render(){return e`
      <jwt-login
        auto
        id="jwt"
        jwt="${this.jwt}"
        @jwt-changed="${this.jwtChanged}"
      ></jwt-login>
    `}jwtChanged(t){this.jwt=t.detail.value,i.jwt=this.jwt,i.cmsSiteEditor&&i.cmsSiteEditor.instance&&(i.cmsSiteEditor.instance.jwt=this.jwt)}disconnectedCallback(){for(var t in this.__disposer)this.__disposer[t].dispose();super.disconnectedCallback()}static get properties(){return{jwt:{type:String}}}constructor(){super(),this.jwt=!1,this.__disposer=[],s((t=>{this.jwt=a(i.jwt),this.__disposer.push(t)}))}_jwtChanged(t){}updated(t){t.forEach(((t,e)=>{"jwt"==e&&this.jwt&&this._jwtChanged(this[e],t)}))}firstUpdated(t){setTimeout((()=>{if(globalThis.appSettings){let t=this.shadowRoot.querySelector("#jwt");t.url=globalThis.appSettings.login,t.refreshUrl=globalThis.appSettings.refreshUrl,t.logoutUrl=globalThis.appSettings.logout,t.redirectUrl=globalThis.appSettings.redirectUrl,globalThis.appSettings.jwt&&(this.jwt=globalThis.appSettings.jwt)}try{import("../haxcms-site-editor.js").then((t=>{i.cmsSiteEditorAvailability(),i.cmsSiteEditor.instance.jwt=this.jwt,i.jwt=this.jwt,i.cmsSiteEditor.instance.method="GET",i.cmsSiteEditor.instance.saveNodePath=globalThis.appSettings.saveNodePath,i.cmsSiteEditor.instance.saveManifestPath=globalThis.appSettings.saveManifestPath,i.cmsSiteEditor.instance.saveOutlinePath=globalThis.appSettings.saveOutlinePath,i.cmsSiteEditor.instance.getSiteFieldsPath=globalThis.appSettings.getSiteFieldsPath,i.cmsSiteEditor.instance.createNodePath=globalThis.appSettings.createNodePath,i.cmsSiteEditor.instance.deleteNodePath=globalThis.appSettings.deleteNodePath,i.cmsSiteEditor.instance.publishSitePath=globalThis.appSettings.publishSitePath,i.cmsSiteEditor.instance.syncSitePath=globalThis.appSettings.syncSitePath,i.cmsSiteEditor.instance.revertSitePath=globalThis.appSettings.revertSitePath,i.cmsSiteEditor.instance.getUserDataPath=globalThis.appSettings.getUserDataPath,i.cmsSiteEditor.instance.appStore=globalThis.appSettings.appStore}),(t=>{console.warn(t)}))}catch(t){}}),500)}}customElements.define(HAXCMSBackendDemo.tag,HAXCMSBackendDemo);export{HAXCMSBackendDemo};