import{autorun as s,toJS as t}from"../../../../mobx/dist/mobx.esm.js";import{store as a}from"./haxcms-site-store.js";import{RPGCharacterToast as o}from"../../../app-hax/lib/rpg-character-toast/rpg-character-toast.js";export class HAXCMSToast extends o{static get tag(){return"haxcms-toast"}constructor(){super(),this.windowControllers=new AbortController,s((()=>{this.userName=t(a.userData.userName)})),s((()=>{this.darkMode=t(a.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(s){this.alwaysvisible||(this.style.animation="forcedfadeout 0.6s .3s",this.awaitingMerlinInput=!1,setTimeout((()=>{this.hide()}),0))}disconnectedCallback(){this.windowControllers.abort(),super.disconnectedCallback()}}customElements.define(HAXCMSToast.tag,HAXCMSToast),globalThis.HAXCMSToast=globalThis.HAXCMSToast||{},globalThis.HAXCMSToast.requestAvailability=()=>(globalThis.HAXCMSToast.instance||(globalThis.HAXCMSToast.instance=globalThis.document.createElement(HAXCMSToast.tag),globalThis.document.body.appendChild(globalThis.HAXCMSToast.instance)),globalThis.HAXCMSToast.instance);export const HAXCMSToastInstance=globalThis.HAXCMSToast.requestAvailability();