{"version":3,"file":"app-in-mainview-plugin.mjs","sources":["../src/ObserverMap.ts","../src/collector.ts","../src/const.ts","../src/componet/locale.ts","../src/componet/AppMenu.ts","../src/appManager.ts","../src/manager.ts","../src/plugin.ts"],"sourcesContent":["export type ObserverCallback<K, V> = (operation: 'add' | 'delete' | 'update', key: K, value: V) => void;\n\nexport class ObserverMap<K extends string | number | symbol, V> {\n  private _map: Map<K, V>;\n  private _observers: Set<ObserverCallback<K, V>> = new Set();\n\n  constructor(entries?: readonly (readonly [K, V])[] | null) {\n    this._map = new Map(entries);\n  }\n\n  private notifyObservers(operation: 'add' | 'delete' | 'update', key: K, value: V): void {\n    for (const observer of this._observers) {\n      observer(operation, key, value);\n    }\n  }\n\n  observe(callback: ObserverCallback<K, V>): void {\n    this._observers.add(callback);\n  }\n\n  unobserve(callback: ObserverCallback<K, V>): void {\n    this._observers.delete(callback);\n  }\n\n  get(key: K): V | undefined {\n    return this._map.get(key);\n  }\n\n  set(key: K, value: V): this {\n    const notifyKey = this._map.has(key) ? 'update' : 'add';\n    this._map.set(key, value);\n    this.notifyObservers(notifyKey, key, value);\n    return this;\n  }\n\n  has(key: K): boolean {\n    return this._map.has(key);\n  }\n\n  delete(key: K): boolean {\n    const value = this._map.get(key);\n    const bol = this._map.delete(key);\n    if (value) {\n      this.notifyObservers('delete', key, value);\n    }\n    return bol;\n  }\n\n  clear(): void {\n    this._map.clear();\n  }\n\n  get size(): number {\n    return this._map.size;\n  }\n\n  keys(): IterableIterator<K> {\n    return this._map.keys();\n  }\n\n  values(): IterableIterator<V> {\n    return this._map.values();\n  }\n\n  entries(): IterableIterator<[K, V]> {\n    return this._map.entries();\n  }\n\n  forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void {\n    this._map.forEach(callbackfn, thisArg);\n  }\n}\n","import type { AppInMainViewPlugin } from './plugin';\nimport type { AppInMainViewManager } from './manager';\nimport { AppId, AppInMainViewPluginAttributes, AppState } from './types';\nimport { autorun, toJS } from './external';\nimport { ObserverMap } from './ObserverMap';\nimport { isEqual } from 'lodash';\n\n\nexport const plainObjectKeys = Object.keys as <T>(o: T) => Array<Extract<keyof T, string>>;\n\nexport type CollectorProps = {\n  control: AppInMainViewManager;\n  plugin: AppInMainViewPlugin;\n}\n\nexport interface ICollector {\n  /** 状态存储器 */\n  storage: ObserverMap<AppId, AppState>;\n  /** 获取课件状态 */\n  getAppState(appId: AppId):AppState;\n  /** 添加课件状态 */\n  addAppState(appId: AppId, appState: AppState): void;\n  /** 删除课件状态 */\n  deleteAppState(appId: AppId): void;\n  /** 更新课件状态 */\n  updateAppState(appId: AppId, appState: AppState): void;\n  /** 销毁 */\n  destroy(): void;\n}\n\n/**\n * 服务端事件/状态同步收集器\n */ \nexport class Collector implements ICollector {\n  private control: AppInMainViewManager;\n  private plugin: AppInMainViewPlugin;\n  private storageObserver: ObserverMap<AppId, AppState>;\n  private stateDisposer: (() => void) | undefined;\n  constructor(props:CollectorProps){\n    this.control = props.control;\n    this.plugin = props.plugin;\n    this.storageObserver = new ObserverMap(Object.entries(this.getAttributes()));\n    this.storageObserver.observe((operation, key, value) => {\n      this.control.onAppStateChange(operation, key, value);\n    });\n    this.observeStorage();\n  }\n  get storage():ObserverMap<AppId, AppState>{\n    return this.storageObserver;\n  }\n  public getAppState(appId: AppId):AppState{\n    return this.storageObserver.get(appId) as AppState;\n  }\n  public addAppState(appId: AppId, appState: AppState): void {\n    if (this.control.isWritable) {\n      this.plugin?.updateAttributes([appId], appState);\n    }\n  }\n  public deleteAppState(appId: AppId): void {\n    if (this.control.isWritable) {\n      this.plugin?.updateAttributes([appId], undefined);\n    }\n  }\n  public updateAppState(appId: AppId, appState: AppState): void {\n    if (this.control.isWritable) {\n      this.plugin?.updateAttributes([appId], appState);\n    }\n  }\n  private getAttributes(): AppInMainViewPluginAttributes {\n    return (toJS(this.plugin.attributes) || {}) as AppInMainViewPluginAttributes;\n  }\n  private diff(newStorage:AppInMainViewPluginAttributes){\n    const newKeys = plainObjectKeys(newStorage);\n    for (const key of newKeys) {\n      if (!this.storageObserver.has(key)) {\n        this.storageObserver.set(key, newStorage[key]);\n      } else {\n        if (!isEqual(this.storageObserver.get(key), newStorage[key])) {\n          this.storageObserver.set(key, newStorage[key]);\n        }\n      }\n    }\n    for (const key of [...this.storageObserver.keys()]) {\n      if (!newKeys.includes(key)) {\n        this.storageObserver.delete(key);\n      }\n    }\n  }\n  private observeStorage(){\n    this.stateDisposer = autorun(async () => {\n      const newStorage = this.getAttributes();\n      this.diff(newStorage);\n    });\n  }\n  public destroy(): void {\n    this.stateDisposer?.();\n  }\n}","import { AppInMainViewOptions } from './types';\n\ndeclare let __NAME__: string, __VERSION__: string;\nexport const pkg_version = __VERSION__;\nexport const pkg_name = __NAME__;\n\nif (typeof window !== 'undefined') {\n  let str = (window as { __netlessUA?: string }).__netlessUA || '';\n  str += ` ${pkg_name}@${pkg_version}`;\n  (window as { __netlessUA?: string }).__netlessUA = str;\n}\n\nexport const DefaultAppInMainViewPluginOptions: Required<AppInMainViewOptions> = {\n  enableDefaultUI: true,\n  onlyShowHidden: false,\n  language: 'en',\n  theme: 'light',\n};\n\nexport const NameSpace = 'default-app-in-main-view-plugin';","export type Language = 'en' | 'zh-CN';\n\nexport type I18nData<T extends string> = Record<Language, Record<T, string>>;\n\n\nexport type I18nKey = 'show' | 'hidden';\n\nexport const I18n: I18nData<I18nKey> = {\n  'en': {\n    show: 'show all',\n    hidden: 'hidden all',\n  },\n  'zh-CN': {\n    show: '全部展开',\n    hidden: '全部收起',\n  },\n};","import { AppId } from '../types';\nimport './style.less';\nimport { AppManager, AppValue } from '../appManager';\nimport { I18n, I18nKey, Language } from './locale';\nimport { NameSpace } from '../const';\n\nexport interface AppMenuProps {\n  manager: AppManager;\n  onlyShowHidden: boolean;\n  language: Language;\n  theme: 'light' | 'dark';\n}\n\nexport class AppMenu {\n  private readonly namespace: string = NameSpace;\n  public readonly container: HTMLDivElement = document.createElement('div');\n  private readonly badge: HTMLDivElement = document.createElement('div');\n  private readonly menuView: HTMLDivElement = document.createElement('div');\n  private readonly manager: AppManager;\n  private readonly onlyShowHidden: boolean;\n  private readonly language: Language;\n  private i18n: Record<I18nKey, string>;\n  private theme: 'light' | 'dark';\n  private isBindContainer: boolean = false;\n\n  constructor(props: AppMenuProps) {\n    this.manager = props.manager;\n    this.onlyShowHidden = props.onlyShowHidden;\n    this.language = props.language;\n    this.i18n = I18n[this.language];\n    this.theme = props.theme;\n    this.init();\n    this.observe();\n  }\n\n  private c(className: string): string {\n    return `${this.namespace}-${className}`;\n  }\n\n  private containerClickHandler = (e: MouseEvent | TouchEvent) => {\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    if (this.manager.control.wm.readonly) {\n      return;\n    }\n    const isShowMenuView = getComputedStyle(this.menuView).display === 'flex';\n    if (isShowMenuView) {\n      this.menuView.style.display = 'none';\n    } else {\n      this.menuView.style.display = 'flex';\n    }\n  };\n\n  private menuViewClickHandler = (e: MouseEvent | TouchEvent) => {\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    const target = e.target as HTMLElement;\n    const id = target.getAttribute(`data-${this.c('app-id')}`);\n    if (id) {\n      this.manager.control.showApp(id);\n      return;\n    }\n    const type = target.getAttribute(`data-${this.c('btn-type')}`);\n    if (type === 'show-all') {\n      this.manager.control.showCurrentPageApps();\n      return;\n    } \n    if (type === 'hidden-all') {\n      this.manager.control.hiddenCurrentPageApps();\n      return;\n    }\n  };\n\n  private bindContainer(){\n    const collectorBtn = document.querySelector('button.telebox-collector') as HTMLButtonElement;\n    if (collectorBtn) {\n      collectorBtn.insertAdjacentElement('afterend', this.container);\n      this.isBindContainer = true;\n    }\n  }\n\n  private removeContainer(){\n    const parent = this.container.parentElement;\n    if (parent) {\n      parent.removeChild(this.container);\n      this.isBindContainer = false;\n    }\n  }\n\n  private createDefaultAppMenu(){\n    this.badge.classList.add(this.c('app-menu-badge'));\n    this.menuView.classList.add(this.c('app-menu-tooltip'));\n    this.container.classList.add(this.c('app-menu-container'), this.theme);\n    this.menuView.addEventListener('click', this.menuViewClickHandler);\n    this.container.addEventListener('click', this.containerClickHandler);\n    this.container.append(this.badge, this.menuView);\n    this.bindContainer();\n  }\n\n  private async init(){\n    const apps = await this.manager.getApps();\n    this.createDefaultAppMenu();\n    this.render(apps);\n  }\n\n  private appMenuChangeHandler = (apps: Map<AppId, AppValue>) => {\n    this.render(apps);\n  };\n\n  private onPrefersColorSchemeChangeHandler = () => {\n    this.container.classList.remove(this.theme);\n    this.theme = this.manager.control.wmTheme;\n    this.container.classList.add(this.theme);\n  };\n  \n\n  private onMainViewMountedHandler = () => {\n    if (!this.isBindContainer) {\n      this.bindContainer();\n    }\n  };\n\n  private onMainViewRebindHandler = () => {\n    this.removeContainer();\n    this.bindContainer();\n  };\n\n  private onFullscreenChangeHandler = (fullscreen: boolean) => {\n    if (fullscreen) {\n      this.container.style.display = 'none';\n    } else {\n      this.container.style.display = 'block';\n    }\n  };\n\n  observe() {\n    this.manager.control.publicEventEmitter.on('appMenuChange', this.appMenuChangeHandler);\n    this.manager.control.wm.emitter.on('prefersColorSchemeChange', this.onPrefersColorSchemeChangeHandler);\n    this.manager.control.wm.emitter.on('onMainViewMounted', this.onMainViewMountedHandler);\n    this.manager.control.wm.emitter.on('onMainViewRebind', this.onMainViewRebindHandler);\n    this.manager.control.wm.emitter.on('fullscreenChange', this.onFullscreenChangeHandler);\n  }\n  \n  unobserve(){\n    this.manager.control.publicEventEmitter.off('appMenuChange', this.appMenuChangeHandler);\n    this.manager.control.wm.emitter.off('prefersColorSchemeChange', this.onPrefersColorSchemeChangeHandler);\n    this.manager.control.wm.emitter.off('onMainViewMounted', this.onMainViewMountedHandler);\n    this.manager.control.wm.emitter.off('onMainViewRebind', this.onMainViewRebindHandler);\n    this.manager.control.wm.emitter.off('fullscreenChange', this.onFullscreenChangeHandler);\n  }\n\n  private createItem(appId: AppId, app: AppValue){\n    const appItem = document.createElement('div');\n    appItem.classList.add(this.c('app-menu-item'));\n    if (app.status === 'hidden') {\n      appItem.classList.add('active');\n    }\n    if (!this.onlyShowHidden) {\n      appItem.classList.add('has-dot');\n    }\n    appItem.setAttribute(`data-${this.c('app-id')}`, appId);\n    if (!this.onlyShowHidden && app.status === 'visible') {\n      const dotDiv = document.createElement('div');\n      dotDiv.classList.add(this.c('app-menu-item-dot'));\n      appItem.appendChild(dotDiv);\n    }\n    const titleDiv = document.createElement('div');\n    titleDiv.classList.add(this.c('app-menu-item-title'));\n    if (app.appInfo) {\n      const attr = app.appInfo.appAttributes;\n      const title = attr.options.title || appId;\n      titleDiv.innerText = title;\n    } else {\n      titleDiv.innerText = appId;\n    }\n    appItem.appendChild(titleDiv);\n    return appItem;\n  }\n\n  private createShowBtn(){\n    const showAllItem = document.createElement('div');\n    showAllItem.classList.add(this.c('app-menu-item'), 'show-all');\n    showAllItem.setAttribute(`data-${this.c('btn-type')}`, 'show-all');\n    const titleDiv = document.createElement('div');\n    titleDiv.classList.add(this.c('app-menu-item-title'));\n    titleDiv.innerText = this.i18n.show;\n    showAllItem.appendChild(titleDiv);\n    return showAllItem;\n\n  }\n  private createHidBtn(){\n    const hidAllItem = document.createElement('div');\n    hidAllItem.classList.add(this.c('app-menu-item'), 'hidden-all');\n    hidAllItem.setAttribute(`data-${this.c('btn-type')}`, 'hidden-all');\n    const titleDiv = document.createElement('div');\n    titleDiv.classList.add(this.c('app-menu-item-title'));\n    titleDiv.innerText = this.i18n.hidden;\n    hidAllItem.appendChild(titleDiv);\n    return hidAllItem;\n\n  }\n\n  private updateMenuView(apps: Map<AppId, AppValue>){\n    let isActiveShowAll = false;\n    let isActiveHidAll = false;\n    const currentPageApps = this.manager.control.getCurrentPageApps();\n    currentPageApps.forEach((status) => {\n      if (status === 'visible') {\n        isActiveHidAll = true;\n      } else {\n        isActiveShowAll = true;\n      }\n    });\n    const items: HTMLDivElement[] = [];\n    apps.forEach((app, appId) => {\n      items.push(this.createItem(appId, app));\n    });\n    const showAllItem = this.createShowBtn();\n    if (isActiveShowAll) {\n      showAllItem.classList.add('active');\n    }\n    const hidAllItem = this.createHidBtn();\n    if (isActiveHidAll) {\n      hidAllItem.classList.add('active');\n    }\n    this.menuView.append(...items, showAllItem, hidAllItem);\n  }\n\n  render(apps: Map<AppId, AppValue>) {\n    this.menuView.style.display = 'none';\n    this.badge.innerText = '';\n    this.menuView.innerHTML = '';\n    if (apps.size === 0) {\n      this.container.style.display = 'none';\n    } else {\n      this.badge.innerText = apps.size.toString();\n      this.updateMenuView(apps);\n      this.container.style.display = 'block';\n    }\n  }\n  destroy(){\n    this.unobserve();\n    this.badge.remove();\n    this.menuView.removeEventListener('click', this.menuViewClickHandler);\n    this.menuView.remove();\n    this.container.removeEventListener('click', this.containerClickHandler);\n    this.container.remove();\n    this.removeContainer();\n  }\n}\n\n","import type { WindowManager } from '@netless/window-manager';\nimport type { AppInMainViewManager } from './manager';\nimport { AppId, AppInMainViewOptions, AppState, AppStatus, OperationType } from './types';\nimport { DefaultAppInMainViewPluginOptions } from './const';\nimport { isBoolean } from 'lodash';\nimport { AppMenu } from './componet/AppMenu';\n\ntype AppProxy = NonNullable<WindowManager['appManager']>['appProxies'] extends Map<string, infer T> ? T : never;\n\nexport interface AppManagerProps {\n  control: AppInMainViewManager;\n  options: AppInMainViewOptions;\n}\n\nexport type AppValue = {\n  status: AppStatus;\n  appInfo?: AppProxy;\n}\n\nexport class AppManager{\n  private enableDefaultUI: boolean = DefaultAppInMainViewPluginOptions.enableDefaultUI;\n  private onlyShowHidden: boolean;\n  private apps: Map<AppId, AppValue>;\n  private scenePath?: string;\n  private resolvePublicEventEmitter?:(bol:boolean) => void;\n  private resolveTimer?: ReturnType<typeof setTimeout>;\n  private appMenu?: AppMenu;\n  private timer?: ReturnType<typeof setTimeout>;\n\n  readonly control: AppInMainViewManager;\n\n  get mainView(){\n    return this.control.wm.mainView;\n  }\n\n  get currentScenePath():string|undefined{\n    return this.mainView.focusScenePath;\n  }\n\n  get wmAppProxies():Map<AppId, AppProxy>{\n    return this.control.wm.appManager?.appProxies || new Map();\n  }\n\n  async getApps() {\n    if (this.checkAppChangeAllReady()) {\n      return this.apps;\n    }\n    await this.willAppInfoAllReady();\n    return this.apps;\n  }\n\n  constructor(props: AppManagerProps){\n    this.control = props.control;\n    this.enableDefaultUI = isBoolean(props.options.enableDefaultUI) ? props.options.enableDefaultUI : DefaultAppInMainViewPluginOptions.enableDefaultUI;\n    this.onlyShowHidden = isBoolean(props.options.onlyShowHidden) ? props.options.onlyShowHidden : DefaultAppInMainViewPluginOptions.onlyShowHidden;\n    this.scenePath = this.currentScenePath;\n    this.apps = this.getCurrentApps();\n    if (this.enableDefaultUI) {\n      this.appMenu = new AppMenu({\n        manager: this,\n        onlyShowHidden: this.onlyShowHidden,\n        language: props.options.language || DefaultAppInMainViewPluginOptions.language,\n        theme: props.options.theme || this.control.wmTheme,\n      });\n    }\n  }\n\n  updateAppInfo(appId: AppId){\n    const app = this.apps.get(appId);\n    if (app) {\n      app.appInfo = this.wmAppProxies.get(appId) as AppProxy;\n      if (this.resolvePublicEventEmitter && this.checkAppChangeAllReady()) {\n        this.resolvePublicEventEmitter(true);\n      }\n    }\n  }\n\n  async pageChangeHandler(scenePath: string, apps: Map<AppId, AppStatus>){\n    this.scenePath = scenePath;\n    this.apps = this.getCurrentApps(apps);\n    await this.willPublicEmitterMenuChange();\n  }\n\n  appChangeHandler(operation: OperationType, appId: AppId, value: AppState){\n    if(value.scenePath === this.scenePath){\n      if(this.onlyShowHidden && value.status === 'visible'){\n        this.apps.delete(appId);\n      } else if ((operation === 'add' || operation === 'update') && this.wmAppProxies.has(appId)) {\n        const appValue = {\n          status: value.status,\n          appInfo: this.wmAppProxies.get(appId) as AppProxy,\n        };\n        this.apps.set(appId, appValue);\n      } else if (operation === 'delete') {\n        this.apps.delete(appId);\n      }\n    }\n    if (this.timer) {\n      clearTimeout(this.timer);\n    }\n    this.timer = setTimeout(()=>{\n      this.timer = undefined;\n      this.willPublicEmitterMenuChange();\n    }, 100);\n  }\n\n  destroy(){\n    this.apps.clear();\n    this.appMenu?.destroy();\n    if (this.timer) {\n      clearTimeout(this.timer);\n    }\n    this.timer = undefined;\n    if (this.resolveTimer) {\n      clearTimeout(this.resolveTimer);\n    }\n    this.resolveTimer = undefined;\n  }\n\n  private getCurrentApps(_apps?: Map<AppId, AppStatus>):Map<AppId, AppValue>{\n    let currentApps = _apps;\n    if (!currentApps) {\n      currentApps = this.control.getCurrentPageApps();\n    }\n    const apps = new Map<AppId, AppValue>();\n    currentApps.forEach((status, appId) => {\n      if(this.onlyShowHidden && status === 'visible'){\n        return;\n      }\n      apps.set(appId, {\n        status,\n        appInfo: this.wmAppProxies.get(appId) as AppProxy,\n      });\n    });\n    return apps;\n  }\n\n  private checkAppChangeAllReady(){\n    for (const app of this.apps.values()) {\n      if (!app.appInfo) {\n        return false;\n      }\n    }\n    return true;\n  }\n\n  private async willAppInfoAllReady(callback?: () => void){\n    if (this.resolvePublicEventEmitter) {\n      this.resolvePublicEventEmitter(false);\n    }\n    if (this.checkAppChangeAllReady()) {\n      callback && callback();\n      return;\n    }\n    const bol = await new Promise<boolean>((resolve) => {\n      this.resolvePublicEventEmitter = resolve;\n      this.resolveTimer = setTimeout(() => {\n        this.resolveTimer=undefined;\n        if (this.resolvePublicEventEmitter) {\n          this.resolvePublicEventEmitter(true);\n        }\n      }, 2000);\n    });\n    if (this.resolveTimer) {\n      clearTimeout(this.resolveTimer);\n      this.resolveTimer = undefined;\n    }\n    this.resolvePublicEventEmitter = undefined;\n    if (bol) {\n      callback && callback();\n    }\n  }\n\n  private async willPublicEmitterMenuChange(){\n    await this.willAppInfoAllReady(()=>{\n      this.control.publicEventEmitter.emit('appMenuChange', this.apps);\n      this.control.logger.info('[AppInMainViewPlugin] emit appMenuChange');\n    });\n  }\n\n}\n","import type { WindowManager } from '@netless/window-manager';\nimport type { AppInMainViewPlugin } from './plugin';\nimport type { AppId, AppInMainViewOptions, AppState, AppStatus, Logger, OperationType, PublicEvent, TeleBoxStateType } from './types';\nimport EventEmitter2, { Listener } from 'eventemitter2';\nimport { Collector } from './collector';\nimport { AppManager } from './appManager';\nimport { DefaultAppInMainViewPluginOptions, NameSpace, pkg_version } from './const';\n\nexport class EventEmitter<T extends PublicEvent> extends EventEmitter2 {\n  public emit(event: T, ...args: any[]): boolean {\n    return super.emit(event, ...args);\n  }\n  public on(event: T, listener: (...args: any[]) => void): this | Listener {\n    return super.on(event, listener);\n  }\n}\n\nenum TeleBoxState {\n  Normal = 'normal',\n  Minimized = 'minimized',\n  Maximized = 'maximized'\n}\n\nexport class AppInMainViewManager {\n  readonly wm: WindowManager;\n  readonly publicEventEmitter: EventEmitter<PublicEvent> = new EventEmitter();\n  readonly logger: Logger;\n  readonly version: string = pkg_version;\n\n  private readonly pluginOptions: AppInMainViewOptions;\n  private readonly injectStyleId: string = `${NameSpace}-inject-style`;\n  private collector!: Collector;\n  private plugin!: AppInMainViewPlugin;\n  private isCurWritable:boolean = false;\n  private originSetBoxState!: (status: TeleBoxStateType) => void;\n  private originSetMinimized!: (minimized: boolean) => void;\n  private appMenuManager!: AppManager;\n  private focueTimer: ReturnType<typeof setTimeout> | undefined;\n  private titlebarTimer: ReturnType<typeof setTimeout> | undefined;\n\n  get isWritable(){\n    return this.isCurWritable;\n  }\n\n  get wmTheme(){\n    return this.wm.prefersColorScheme && this.wm.prefersColorScheme !== 'auto' ? this.wm.prefersColorScheme : DefaultAppInMainViewPluginOptions.theme;\n  }\n\n  constructor(props: {\n    windowManager: WindowManager;\n    options: AppInMainViewOptions;\n    logger: Logger;\n  }) {\n    this.wm = props.windowManager;\n    if (this.wm.room) {\n      this.isCurWritable = this.wm.room.isWritable;\n    }\n    this.logger = props.logger;\n    this.pluginOptions = props.options;\n    this.restrictedSetBoxState();\n  }\n\n  get topBoxId(){\n    const nodes = Array.from(document.querySelectorAll('div.telebox-box')) as Array<HTMLDivElement>;\n    if (!nodes.length) {\n      return undefined;\n    }\n    let maxZIndex = 0;\n    let topBoxId;\n    for (const node of nodes) {\n      if (getComputedStyle(node).display === 'none') {\n        continue;\n      }\n      const zIndex = Number(getComputedStyle(node).zIndex);\n      const id = node.getAttribute('data-tele-box-i-d');\n      if(zIndex > maxZIndex && id) {\n        maxZIndex = zIndex;\n        topBoxId = id;\n      }\n    }\n    return topBoxId;\n  }\n\n  get focused(){\n    return this.wm.focused;\n  }\n\n  private init(){\n    if (this.wm.room) {\n      ((this.wm.room as any).logger as Logger).info(`[AppInMainViewPlugin] appInMainViewManager init ${JSON.stringify(this.pluginOptions)}`);\n    }\n    this.initInjectStyle();\n    this.collector = new Collector({\n      control: this,\n      plugin: this.plugin,\n    });\n    this.observeWm();\n    this.appMenuManager = new AppManager({\n      control: this,\n      options: this.pluginOptions,\n    });\n  }\n\n  private initInjectStyle(){\n    this.removeInjectStyle();\n    const style = document.createElement('style');\n    style.id = this.injectStyleId; // 唯一标识\n    // 先添加到文档中，确保 style.sheet 可用\n    document.head.appendChild(style);\n    try {\n      if (!style.sheet) {\n        console.error('Style sheet is not available');\n        return;\n      }\n      const cssRule = '.telebox-titles .telebox-titles-tab[data-tele-box-i-d], .telebox-box[data-tele-box-i-d], .telebox-titlebar.telebox-max-titlebar { display: none; }';\n      // 尝试插入规则\n      style.sheet.insertRule(cssRule, style.sheet.cssRules.length);\n    } catch (error) {\n      console.warn('Failed to insert style rule:', error);\n      // 如果插入规则失败，使用 textContent 作为备选方案\n      style.textContent = '.telebox-titles .telebox-titles-tab[data-tele-box-i-d], .telebox-box[data-tele-box-i-d], .telebox-titlebar.telebox-max-titlebar { display: none; }';\n    }\n  }\n\n  private removeInjectStyle(){\n    const style = document.getElementById(this.injectStyleId) as HTMLStyleElement;\n    if (style) {\n      style.remove();\n    }\n  }\n\n  bindPlugin(plugin:AppInMainViewPlugin){\n    this.plugin = plugin;\n    this.init();\n  }\n\n  destroy(){\n    this.unobserveWm();\n    if (this.focueTimer) {\n      clearTimeout(this.focueTimer);\n      this.focueTimer = undefined;\n    }\n    if (this.titlebarTimer) {\n      clearTimeout(this.titlebarTimer);\n      this.titlebarTimer = undefined;\n    }\n    this.appMenuManager.destroy();\n    this.removeInjectStyle();\n    if (this.wm.room) {\n      ((this.wm.room as any).logger as Logger).info('[AppInMainViewPlugin] AppInMainViewManager has been destroyed');\n    }\n  }\n\n  private onWritableChange = () => {\n    const isWritable = (this.wm.displayer as any).isWritable;\n    this.isCurWritable = isWritable;\n  };\n\n  private setTitlebarNodeDisplay(display: 'flex' | 'none'){\n    const titleBar = document.querySelector('div.telebox-titlebar.telebox-max-titlebar') as HTMLDivElement;\n    if (titleBar) {\n      if (display === 'flex') {\n        titleBar.style.display = `${display}`;\n      } else {\n        titleBar.style.removeProperty('display');\n      }\n    }\n  }\n\n  private activeMaximizeBtn(app: AppId | HTMLDivElement, isActive: boolean=false){\n    let maximizeBtn;\n    if (app instanceof HTMLDivElement) {\n      maximizeBtn = app.querySelector('button.telebox-titlebar-icon-maximize') as HTMLButtonElement;\n    } else {\n      maximizeBtn = document.querySelector(`.telebox-box[data-tele-box-i-d=\"${app}\"] button.telebox-titlebar-icon-maximize`) as HTMLButtonElement;\n    }\n    if (!maximizeBtn) {\n      return;\n    }\n    if (isActive && !maximizeBtn.classList.contains('is-active')) {\n      maximizeBtn.classList.add('is-active');\n    } else if (!isActive && maximizeBtn.classList.contains('is-active')) {\n      maximizeBtn.classList.remove('is-active');\n    }\n  }\n\n  private setAppNodeDisplay(appId: AppId, display: 'block' | 'none', isRenderMaximizeBtn: boolean=false){\n    const appNodes = Array.from(document.querySelectorAll(`[data-tele-box-i-d=\"${appId}\"]`)) as Array<HTMLButtonElement | HTMLDivElement>;\n    if (!appNodes.length) {\n      return;\n    }\n    appNodes.forEach((node) => {\n      if (display === 'block') {\n        node.style.display = `${display}`;\n        if (isRenderMaximizeBtn && node instanceof HTMLDivElement) {\n          if (this.wm.boxState === TeleBoxState.Maximized) {\n            this.activeMaximizeBtn(node, true);\n          } else {\n            this.activeMaximizeBtn(node, false);\n          }\n        }\n      } else {\n        node.style.removeProperty('display');\n      }\n    });\n  }\n\n  observerFocusAppTimer(){\n    if (this.focueTimer) {\n      clearTimeout(this.focueTimer);\n    }\n    this.focueTimer = setTimeout(()=>{\n      this.focueTimer = undefined;\n      const boxState = this.wm.boxState;\n      if (boxState === TeleBoxState.Maximized) {\n        const topBoxId = this.topBoxId;\n        if (topBoxId && this.focused !== topBoxId) {\n          this.wm.focusApp(topBoxId);\n        }\n      }\n    }, 100);\n  }\n\n  observeTitlebarTimer(){\n    if (this.titlebarTimer) {\n      clearTimeout(this.titlebarTimer);\n    }\n    this.titlebarTimer = setTimeout(() => {\n      this.titlebarTimer = undefined;\n      this.observeTitlebarHandler();\n    }, 100);\n  }\n  private observeTitlebarHandler = () => {\n    const status = this.wm.boxState;\n    let isRenderTitlebar = false;\n    const currentApps = this.getCurrentPageVisibleApps();\n    if (status === TeleBoxState.Maximized) {\n      if (currentApps.size < 2) {\n        this.setTitlebarNodeDisplay('none');\n      } else {\n        this.setTitlebarNodeDisplay('flex');\n      }\n      isRenderTitlebar = true;\n    } else {\n      this.setTitlebarNodeDisplay('none');\n    }\n    for (const appId of currentApps) {\n      if (isRenderTitlebar) {\n        this.setAppNodeDisplay(appId, 'block', true);\n      } else {\n        this.activeMaximizeBtn(appId, false);\n      }\n    }\n  };\n\n  private observeBoxStateChangeHandler = () => {\n    if (!this.checkBoxState()) return;\n    this.observeTitlebarTimer();\n    if (this.wm.boxState === TeleBoxState.Maximized) {\n      this.observerFocusAppTimer();\n    }\n  };\n\n  private getTargetParent = (dom: HTMLElement):HTMLDivElement | null => {\n    if (dom.hasAttribute('data-tele-box-i-d')) {\n      return dom as HTMLDivElement;\n    } else if (dom.parentElement) {\n      return this.getTargetParent(dom.parentElement as HTMLElement);\n    }\n    return null;\n  };\n\n  private minimizeBtnClickHandler = (e:MouseEvent | TouchEvent) => {\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    if (this.wm.readonly) { \n      return;\n    }\n    const target = this.getTargetParent(e.target as HTMLElement);\n    if (target) {\n      const id = target.getAttribute('data-tele-box-i-d');\n      if (id) {\n        this.hideApp(id);\n      }\n    }\n  };\n\n  private observeAppSetupHandler = (appId: AppId) => {\n    const appElement = document.querySelector(`div.telebox-box[data-tele-box-i-d=\"${appId}\"]`) as HTMLDivElement;\n    if (appElement) {\n      const value = this.collector.getAppState(appId);\n      const scenePath = this.wm.mainView.focusScenePath;\n      if (!value) {\n        if (scenePath) {\n          this.collector.addAppState(appId, {\n            scenePath,\n            status: 'visible',\n          });\n        }\n      } else {\n        if (value.status === 'visible' && scenePath === value.scenePath) {\n          this.setAppNodeDisplay(appId, 'block');\n        } else if (value.status === 'hidden') {\n          this.setAppNodeDisplay(appId, 'none');\n        }\n        if (this.wm.boxState === TeleBoxState.Maximized) {\n          this.observeTitlebarTimer();\n          this.observerFocusAppTimer();\n        }\n      }\n      // bind minimize btn click event\n      const minimizeBtn = document.querySelector(`div[data-tele-box-i-d=\"${appId}\"] .telebox-titlebar-icon-minimize`) as HTMLButtonElement;\n      if (minimizeBtn) {\n        minimizeBtn.removeEventListener('click', this.minimizeBtnClickHandler);\n        minimizeBtn.addEventListener('click', this.minimizeBtnClickHandler);\n      }\n    }\n    this.appMenuManager.updateAppInfo(appId);\n  };\n\n  private observeBoxCloseHandler = (props: { appId: AppId }) => {\n    const isHas = this.collector.storage.has(props.appId);\n    if (isHas) {\n      this.collector.deleteAppState(props.appId);\n    }\n    const minimizeBtn = document.querySelector(`div[data-tele-box-i-d=\"${props.appId}\"] .telebox-titlebar-icon-minimize`) as HTMLButtonElement;\n    if (minimizeBtn) {\n      minimizeBtn.removeEventListener('click', this.minimizeBtnClickHandler);\n    }\n  };\n\n  private observeMainViewScenePathChangeHandler = (scenePath:string) => {\n    this.collector.storage.forEach((appState, appId) => {\n      if (appState.scenePath === scenePath && appState.status === 'visible') {\n        this.setAppNodeDisplay(appId, 'block');\n      } else {\n        this.setAppNodeDisplay(appId, 'none');\n      }\n    });\n    if (this.wm.boxState === TeleBoxState.Maximized ) {\n      this.observeTitlebarTimer();\n      this.observerFocusAppTimer();\n    }\n    const apps = this.getTargetPageApps(scenePath);\n    this.appMenuManager.pageChangeHandler(scenePath, apps);\n  };\n\n  private observeMaxStateMinimizeBtnClickHandler = (e: MouseEvent) => {\n    e.stopPropagation();\n    e.stopImmediatePropagation();\n    const topBoxId = this.topBoxId;\n    if (topBoxId) {\n      this.hideApp(topBoxId);\n    }\n  };\n\n  private restrictedSetBoxState(){\n    this.originSetBoxState = this.wm.setBoxState;\n    this.originSetMinimized = this.wm.setMinimized;\n    this.wm.setBoxState = (status: TeleBoxStateType) => {\n      if (status === TeleBoxState.Minimized) {\n        this.logger.warn('[AppInMainViewPlugin] when use appInMainViewManager, setBoxState can not set to minimized');\n        return;\n      }\n      this.originSetBoxState && this.originSetBoxState.call(this.wm, status);\n    };\n    this.wm.setMinimized = (minimized: boolean) => {\n      if (minimized) {\n        this.logger.warn('[AppInMainViewPlugin] when use appInMainViewManager, setMinimized can not set to minimized');\n        return;\n      }\n      this.originSetMinimized && this.originSetMinimized.call(this.wm, minimized);\n    };\n  }\n\n  private bindMaxStateMinimizeBtnClickHandler(){\n    const maxStateMinimizeBtn = document.querySelector('div.telebox-max-titlebar .telebox-titlebar-icon-minimize') as HTMLButtonElement;\n    if (maxStateMinimizeBtn) {\n      maxStateMinimizeBtn.addEventListener('click', this.observeMaxStateMinimizeBtnClickHandler);\n    }\n  }\n\n  private removeMaxStateMinimizeBtnClickHandler(){\n    const maxStateMinimizeBtn = document.querySelector('div.telebox-max-titlebar .telebox-titlebar-icon-minimize') as HTMLButtonElement;\n    if (maxStateMinimizeBtn) {\n      maxStateMinimizeBtn.removeEventListener('click', this.observeMaxStateMinimizeBtnClickHandler);\n    }\n  }\n\n  private observeMainViewMountedHandler = () => {\n    this.bindMaxStateMinimizeBtnClickHandler();\n  };\n\n  private observeMainViewRebindHandler = () => {\n    this.removeMaxStateMinimizeBtnClickHandler();\n    this.bindMaxStateMinimizeBtnClickHandler();\n  };\n\n  private checkBoxState(){\n    if (this.wm.boxState === TeleBoxState.Minimized) {\n      this.logger.warn('[AppInMainViewPlugin] when use appInMainViewManager boxState can not minimized, but boxState is minimized now');\n      if (this.isWritable) {\n        this.wm.setMinimized(false);\n      } else {\n        this.logger.error(`[AppInMainViewPlugin] when use appInMainViewManager boxState can not minimized, but boxState is ${this.wm.boxState} and isWritable is ${this.isWritable} now.`);\n      }\n      return false;\n    }\n    return true;\n  }\n\n  observeWm(){\n    this.bindMaxStateMinimizeBtnClickHandler();\n    this.wm.emitter.on('boxStateChange', this.observeBoxStateChangeHandler);\n    this.wm.emitter.on('onAppSetup', this.observeAppSetupHandler);\n    this.wm.emitter.on('onBoxClose', this.observeBoxCloseHandler);\n    this.wm.emitter.on('mainViewScenePathChange', this.observeMainViewScenePathChangeHandler);\n    this.wm.emitter.on('onMainViewMounted', this.observeMainViewMountedHandler);\n    this.wm.emitter.on('onMainViewRebind', this.observeMainViewRebindHandler);\n    this.wm.displayer.callbacks.on('onEnableWriteNowChanged', this.onWritableChange);\n    this.checkBoxState();\n  }\n  unobserveWm(){\n    this.wm.setBoxState = this.originSetBoxState;\n    this.wm.setMinimized = this.originSetMinimized;\n    this.wm.emitter.off('boxStateChange', this.observeBoxStateChangeHandler);\n    this.wm.emitter.off('onAppSetup', this.observeAppSetupHandler);\n    this.wm.emitter.off('onBoxClose', this.observeBoxCloseHandler);\n    this.wm.emitter.off('mainViewScenePathChange', this.observeMainViewScenePathChangeHandler);\n    this.wm.emitter.off('onMainViewMounted', this.observeMainViewMountedHandler);\n    this.wm.emitter.off('onMainViewRebind', this.observeMainViewRebindHandler);\n    this.wm.displayer.callbacks.off('onEnableWriteNowChanged', this.onWritableChange);\n    this.removeMaxStateMinimizeBtnClickHandler();\n  }\n\n  onAppStateChange(operation: OperationType, appId: AppId, value: AppState){\n    const scenePath = this.wm.mainView.focusScenePath;\n    if(!scenePath){\n      return;\n    }\n    if (value.scenePath !== scenePath){\n      this.setAppNodeDisplay(appId, 'none');\n    } else {\n      switch (operation) {\n        case 'add': {\n          this.setAppNodeDisplay(appId, 'block');\n          break;\n        }\n        case 'delete': {\n          this.setAppNodeDisplay(appId, 'none');\n          break;\n        }\n        case 'update': {\n          if (value.status === 'visible') {\n            this.setAppNodeDisplay(appId, 'block');\n          } else {\n            this.setAppNodeDisplay(appId, 'none');\n          }\n          break;\n        }\n      }\n      if (this.wm.boxState === TeleBoxState.Maximized) {\n        this.observeTitlebarTimer();\n        this.observerFocusAppTimer();\n      }\n    }\n    this.appMenuManager.appChangeHandler(operation, appId, value);\n  }\n\n  hideApp(appId: AppId){\n    const appState = this.collector.getAppState(appId);\n    if (appState && appState.status === 'visible') {\n      this.collector.updateAppState(appId, {\n        ...appState,\n        status: 'hidden',\n      });\n    }\n  }\n\n  showApp(appId: AppId){\n    const appState = this.collector.getAppState(appId);\n    if (appState && appState.status === 'hidden') {\n      this.collector.updateAppState(appId, {\n        ...appState,\n        status: 'visible',\n      });\n    }\n  }\n\n  showCurrentPageApps(){\n    const apps = this.getCurrentPageApps();\n    apps.forEach((appState, appId) => {\n      if (appState === 'hidden') {\n        this.showApp(appId);\n      }\n    });\n  }\n\n  hiddenCurrentPageApps(){\n    const apps = this.getCurrentPageVisibleApps();\n    apps.forEach((appId) => {\n      this.hideApp(appId);\n    });\n  }\n\n  get isCurrentPageAppsAllVisible(){\n    const apps = this.getCurrentPageApps();\n    return apps.values().every((appState) => {\n      return appState === 'visible';\n    });\n  }\n\n  get isCurrentPageAppsAllHidden(){\n    const apps = this.getCurrentPageApps();\n    return apps.values().every((appState) => {\n      return appState === 'hidden';\n    });\n  }\n\n  getTargetPageVisibleApps(scenePath: string){\n    const apps: Set<AppId> = new Set();\n    this.collector.storage.forEach((appState, appId)=>{\n      if (appState.scenePath === scenePath && appState.status === 'visible') {\n        apps.add(appId);\n      }\n    });\n    return apps;\n  }\n\n  getTargetPageApps(scenePath: string){\n    const apps: Map<AppId, AppStatus> = new Map();\n    this.collector.storage.forEach((appState, appId)=>{\n      if (appState.scenePath === scenePath) {\n        apps.set(appId, appState.status);\n      }\n    });\n    return apps;\n  }\n\n  getCurrentPageVisibleApps(){\n    const scenePath = this.wm.mainView.focusScenePath;\n    if (!scenePath) {\n      return new Set<AppId>();\n    }\n    return this.getTargetPageVisibleApps(scenePath);\n  }\n\n  getCurrentPageApps(){\n    const scenePath = this.wm.mainView.focusScenePath;\n    if (!scenePath) {\n      return new Map<AppId, AppStatus>();\n    }\n    return this.getTargetPageApps(scenePath);\n  }\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { isRoom, InvisiblePlugin } from './external';\nimport type { Displayer, Room, WindowManager } from '@netless/window-manager';\nimport { AppId, AppInMainViewInstance, AppInMainViewOptions, AppInMainViewPluginAttributes, AppStatus, Logger, PublicCallback, PublicEvent } from './types';\nimport { AppInMainViewManager } from './manager';\n\n\n/**\n * 多窗口教具\n */\nexport class AppInMainViewPlugin extends InvisiblePlugin<AppInMainViewPluginAttributes, any> {\n  static readonly kind: string = 'app-in-main-view-plugin';\n  static currentManager?: AppInMainViewManager;\n  static timer?: ReturnType<typeof setTimeout>;\n  public static logger: Logger = {\n    info: console.log,\n    warn: console.warn,\n    error: console.error,\n  };\n  public static async getInstance(wm: WindowManager, options?: AppInMainViewOptions, logger?: Logger): Promise<AppInMainViewInstance> {\n    if (logger) {\n      AppInMainViewPlugin.logger = logger;\n    }\n    const _d = wm.displayer;\n    let _AppInMainViewPlugin = _d.getInvisiblePlugin(AppInMainViewPlugin.kind) as AppInMainViewPlugin | undefined;\n    if (!AppInMainViewPlugin.currentManager) {\n      AppInMainViewPlugin.createCurrentManager(wm, options || {});\n    }\n    if (!_AppInMainViewPlugin) {\n      _AppInMainViewPlugin = await AppInMainViewPlugin.createAppInMainViewPlugin(_d, AppInMainViewPlugin.kind);\n    }\n    if (_AppInMainViewPlugin && AppInMainViewPlugin.currentManager) {\n      AppInMainViewPlugin.currentManager.bindPlugin(_AppInMainViewPlugin);\n    }\n    const origin:AppInMainViewInstance = {\n      displayer: _d,\n      windowManager: wm,\n      currentManager: AppInMainViewPlugin.currentManager,\n      destroy(){\n        if (AppInMainViewPlugin.currentManager) {\n          AppInMainViewPlugin.logger.info('[AppInMainViewPlugin] has been destroyed');\n          AppInMainViewPlugin.currentManager.destroy();\n          AppInMainViewPlugin.currentManager = undefined;\n        }\n      },\n      addListener: (eventName: PublicEvent, callback: PublicCallback<PublicEvent>) => {\n        // AppInMainViewPlugin.logger.info(`[AppInMainViewPlugin] addListener ${eventName}`);\n        AppInMainViewPlugin.currentManager?.publicEventEmitter.on(eventName, callback);\n      },\n      removeListener: (eventName: PublicEvent, callback: PublicCallback<PublicEvent>) => {\n        // AppInMainViewPlugin.logger.info(`[AppInMainViewPlugin] removeListener ${eventName}`);\n        AppInMainViewPlugin.currentManager?.publicEventEmitter.off(eventName, callback);\n      },\n      hideApp: (appId: AppId) => {\n        AppInMainViewPlugin.logger.info(`[AppInMainViewPlugin] hideApp ${appId}`);\n        AppInMainViewPlugin.currentManager?.hideApp(appId);\n      },\n      showApp: (appId: AppId) => {\n        AppInMainViewPlugin.logger.info(`[AppInMainViewPlugin] showApp ${appId}`);\n        AppInMainViewPlugin.currentManager?.showApp(appId);\n      },\n      showCurrentPageApps: () => {\n        AppInMainViewPlugin.logger.info('[AppInMainViewPlugin] showCurrentPageApps');\n        AppInMainViewPlugin.currentManager?.showCurrentPageApps();\n      },\n      hiddenCurrentPageApps: () => {\n        AppInMainViewPlugin.logger.info('[AppInMainViewPlugin] hiddenCurrentPageApps');\n        AppInMainViewPlugin.currentManager?.hiddenCurrentPageApps();\n      },\n    };\n    Object.defineProperty(origin, 'currentPageVisibleApps', {\n      get() {\n        if (!AppInMainViewPlugin.currentManager) {\n          return new Set<AppId>();\n        }\n        return AppInMainViewPlugin.currentManager.getCurrentPageVisibleApps();\n      },\n    });\n    Object.defineProperty(origin, 'currentPageApps', {\n      get() {\n        if (!AppInMainViewPlugin.currentManager) {\n          return new Map<AppId, AppStatus>();\n        }\n        return AppInMainViewPlugin.currentManager.getCurrentPageApps();\n      },\n    });\n    (wm as any)._appInMainViewPlugin = origin;\n    return (wm as any)._appInMainViewPlugin;\n  }\n  static onCreate(plugin: InvisiblePlugin<AppInMainViewPluginAttributes, any> ) {\n    if (plugin && AppInMainViewPlugin.currentManager) {\n      if (AppInMainViewPlugin.timer) {\n        clearTimeout(AppInMainViewPlugin.timer);\n        AppInMainViewPlugin.timer = undefined;\n      }\n      AppInMainViewPlugin.currentManager.bindPlugin(plugin as AppInMainViewPlugin);\n    }\n  }\n  static async createAppInMainViewPlugin(d:Displayer, kind:string):Promise<AppInMainViewPlugin> {\n    if (isRoom(d)) {\n      try {\n        if ((d as Room).isWritable) {\n          const plugin = await (d as Room).createInvisiblePlugin(AppInMainViewPlugin, {});\n          return plugin;\n        } else {\n          await (d as Room).setWritable(true);\n          const plugin = await AppInMainViewPlugin.createAppInMainViewPlugin(d,kind);\n          await (d as Room).setWritable(false);\n          return plugin;\n        }\n      } catch (error) {\n        AppInMainViewPlugin.logger.error('[AppInMainViewPlugin] createAppInMainViewPlugin error', error);\n      }\n    }\n    let _AppInMainViewPlugin = d.getInvisiblePlugin(kind) as AppInMainViewPlugin | undefined;\n    if (!_AppInMainViewPlugin) {\n      await new Promise((resolve) => {\n        if (AppInMainViewPlugin.timer) {\n          clearTimeout(AppInMainViewPlugin.timer);\n          AppInMainViewPlugin.timer = undefined;\n        }\n        AppInMainViewPlugin.timer = setTimeout(()=>{\n          AppInMainViewPlugin.timer = undefined;\n          resolve(true);\n        }, 1000 as unknown as number);\n      });\n      _AppInMainViewPlugin = await AppInMainViewPlugin.createAppInMainViewPlugin(d,kind);\n    }\n    return _AppInMainViewPlugin;\n  }\n  static createCurrentManager = (wm:WindowManager, options:AppInMainViewOptions) => {\n    if (AppInMainViewPlugin.currentManager) {\n      AppInMainViewPlugin.currentManager.destroy();\n    }\n    const props = {\n      windowManager: wm,\n      options,\n      logger: AppInMainViewPlugin.logger,\n    };\n    const appInMainViewManager = new AppInMainViewManager(props);\n    if (wm.room) {\n      AppInMainViewPlugin.logger.info('[AppInMainViewPlugin] new appInMainViewManager');\n    }\n    AppInMainViewPlugin.currentManager = appInMainViewManager;\n  };\n  override destroy(): void {\n    AppInMainViewPlugin.logger.info('[AppInMainViewPlugin] passive destroyed');\n    AppInMainViewPlugin.currentManager?.destroy();\n    AppInMainViewPlugin.currentManager = undefined;\n  }\n}\n"],"names":["ObserverMap","entries","__publicField","operation","key","value","observer","callback","notifyKey","bol","callbackfn","thisArg","plainObjectKeys","Collector","props","appId","appState","_a","toJS","newStorage","newKeys","isEqual","autorun","pkg_version","pkg_name","str","DefaultAppInMainViewPluginOptions","NameSpace","I18n","AppMenu","target","id","type","apps","fullscreen","className","collectorBtn","parent","app","appItem","dotDiv","titleDiv","title","showAllItem","hidAllItem","isActiveShowAll","isActiveHidAll","status","items","AppManager","isBoolean","scenePath","appValue","_apps","currentApps","resolve","EventEmitter","EventEmitter2","event","args","listener","AppInMainViewManager","isWritable","isRenderTitlebar","dom","minimizeBtn","topBoxId","nodes","maxZIndex","node","zIndex","style","error","plugin","display","titleBar","isActive","maximizeBtn","isRenderMaximizeBtn","appNodes","minimized","maxStateMinimizeBtn","_AppInMainViewPlugin","InvisiblePlugin","wm","options","logger","_d","origin","eventName","d","kind","isRoom","appInMainViewManager","AppInMainViewPlugin"],"mappings":";;;;;;AAEO,MAAMA,EAAmD;AAAA,EAI9D,YAAYC,GAA+C;AAHnD,IAAAC,EAAA;AACA,IAAAA,EAAA,wCAA8C,IAAI;AAGnD,SAAA,OAAO,IAAI,IAAID,CAAO;AAAA,EAAA;AAAA,EAGrB,gBAAgBE,GAAwCC,GAAQC,GAAgB;AAC3E,eAAAC,KAAY,KAAK;AACjB,MAAAA,EAAAH,GAAWC,GAAKC,CAAK;AAAA,EAChC;AAAA,EAGF,QAAQE,GAAwC;AACzC,SAAA,WAAW,IAAIA,CAAQ;AAAA,EAAA;AAAA,EAG9B,UAAUA,GAAwC;AAC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