import AppKit

// `AlienHUD --dump-html` prints the scene markup and exits, so the animation can be
// tweaked in a browser without rebuilding or waiting for a real meeting.
if CommandLine.arguments.contains("--dump-html") {
    print(Alien.html(eyebrow: Reminder.Kind.meeting.eyebrow,
                     line: "Strategy call with Bells in 5 minutes."))
    exit(0)
}

// Top-level code isn't main-actor isolated, but everything below touches AppKit —
// which only ever runs on the main thread here, so assert that and get on with it.
MainActor.assumeIsolated {
    let app = NSApplication.shared
    // `delegate` is a weak reference on NSApplication; this local keeps it alive,
    // which is fine because app.run() doesn't return until the process exits.
    let delegate = AppDelegate()
    app.delegate = delegate
    // .accessory = menu bar only, no Dock icon, never steals focus.
    app.setActivationPolicy(.accessory)
    app.run()
}
