import * as i18n from "../../core/i18n/i18n.js";
import * as UI from "../../ui/legacy/legacy.js";
import { StartView } from "./LighthouseStartView.js";
import { Events } from "./LighthouseController.js";
const UIStrings = {
  mode: "Mode",
  analyzeNavigation: "Analyze navigation",
  analyzeSnapshot: "Analyze snapshot",
  startTimespan: "Start timespan"
};
const str_ = i18n.i18n.registerUIStrings("panels/lighthouse/LighthouseStartViewFR.ts", UIStrings);
const i18nString = i18n.i18n.getLocalizedString.bind(void 0, str_);
export class StartViewFR extends StartView {
  render() {
    super.render();
    const fragment = UI.Fragment.Fragment.build`
  <div class="lighthouse-form-section">
  <div class="lighthouse-form-section-label">
  ${i18nString(UIStrings.mode)}
  </div>
  <div class="lighthouse-form-elements" $="mode-form-elements"></div>
  </div>
    `;
    const modeFormElements = fragment.$("mode-form-elements");
    this.populateRuntimeSettingAsRadio("lighthouse.mode", i18nString(UIStrings.mode), modeFormElements);
    const form = this.contentElement.querySelector("form");
    form?.appendChild(fragment.element());
    this.updateStartButton();
  }
  updateStartButton() {
    const { mode } = this.controller.getFlags();
    let label;
    let callback;
    if (mode === "timespan") {
      label = i18nString(UIStrings.startTimespan);
      callback = () => {
        this.controller.dispatchEventToListeners(Events.RequestLighthouseTimespanStart, this.startButton.matches(":focus-visible"));
      };
    } else if (mode === "snapshot") {
      label = i18nString(UIStrings.analyzeSnapshot);
      callback = () => {
        this.controller.dispatchEventToListeners(Events.RequestLighthouseStart, this.startButton.matches(":focus-visible"));
      };
    } else {
      label = i18nString(UIStrings.analyzeNavigation);
      callback = () => {
        this.controller.dispatchEventToListeners(Events.RequestLighthouseStart, this.startButton.matches(":focus-visible"));
      };
    }
    this.startButton = UI.UIUtils.createTextButton(label, callback, "", true);
    const startButtonContainer = this.contentElement.querySelector(".lighthouse-start-button-container");
    if (startButtonContainer) {
      startButtonContainer.textContent = "";
      startButtonContainer.appendChild(this.startButton);
    }
  }
}
//# sourceMappingURL=LighthouseStartViewFR.js.map
