import Locator from '../services/Locator';
import Activity from './Activity';
import * as fgui from '@popiplay/fairygui-dom-fork';

/** Loads shared UI assets required for error popups. */
export default class LoadSystemAssets extends Activity
{
    constructor()
    {
        super('LoadSystemAssets');
    }

    override async execute(): Promise<void>
    {
        const baseUrl: string = Locator.network.baseAssetsUrl;
        const url = baseUrl.endsWith('/') ? `${baseUrl}system/ErrorPopups` : `${baseUrl}/system/ErrorPopups`;

        await fgui.UIPackage.loadPackage(url);
    }
}
