import{autorun as a,toJS as t}from"../../../../mobx/dist/mobx.esm.js";import{store as s}from"./AppHaxStore.js";import{RPGCharacterToast as o}from"../rpg-character-toast/rpg-character-toast.js";export class AppHaxToast extends o{static get tag(){return"app-hax-toast"}constructor(){super(),this.windowControllers=new AbortController,a((()=>{this.userName=t(s.user.name)})),a((()=>{this.darkMode=t(s.darkMode)}))}connectedCallback(){super.connectedCallback(),globalThis.addEventListener("haxcms-toast-hide",this.hideSimpleToast.bind(this),{signal:this.windowControllers.signal}),globalThis.addEventListener("haxcms-toast-show",this.showSimpleToast.bind(this),{signal:this.windowControllers.signal})}hideSimpleToast(a){this.hide()}disconnectedCallback(){this.windowControllers.abort(),super.disconnectedCallback()}}customElements.define(AppHaxToast.tag,AppHaxToast),globalThis.AppHaxToast=globalThis.AppHaxToast||{},globalThis.AppHaxToast.requestAvailability=()=>(globalThis.AppHaxToast.instance||(globalThis.AppHaxToast.instance=globalThis.document.createElement(AppHaxToast.tag),globalThis.document.body.appendChild(globalThis.AppHaxToast.instance)),globalThis.AppHaxToast.instance);export const AppHaxToastInstance=globalThis.AppHaxToast.requestAvailability();