import '@kano/styles/typography.js';
import { EventEmitter } from '@kano/common/index.js';
import { BannerWidget } from '../../../../challenge/widget/banner.js';
import { _ } from '../../../../i18n/index.js';
export class BriefingFloatingMenu extends BannerWidget {
    constructor(text, nextChallenge) {
        super();
        this.subscriptions = [];
        this._onDidRequestReset = new EventEmitter();
        this._onDidEnd = new EventEmitter();
        this._onDidRequestNextChallenge = new EventEmitter();
        this.setText(text);
        const resetBtn = this.addButton(_('RESET_BUTTON', 'Reset'), false, true);
        resetBtn.onDidClick(() => { this._onDidRequestReset.fire(); });
        if (nextChallenge) {
            const nextChallengeButton = this.addButton(typeof nextChallenge === 'string' ? nextChallenge : _('NEXT_CHALLENGE_BUTTON', 'Next Challenge'));
            nextChallengeButton.onDidClick(() => {
                this._onDidRequestNextChallenge.fire();
            });
        }
        else {
            const endBtn = this.addButton(_('FINISH_BUTTON', 'Finish'));
            endBtn.onDidClick(() => { this._onDidEnd.fire(); });
        }
    }
    get onDidRequestReset() { return this._onDidRequestReset.event; }
    get onDidEnd() { return this._onDidEnd.event; }
    get onDidRequestNextChallenge() { return this._onDidRequestNextChallenge.event; }
    dispose() {
        this.subscriptions.forEach(d => d.dispose());
        this.subscriptions.length = 0;
    }
}
//# sourceMappingURL=floating-menu.js.map