import "@johnlindquist/kit"
await jxa(`
Application("System Events")
.applicationProcesses.byName("NotificationCenter")
.windows[0]
.groups[0]
.scrollAreas[0]
.uiElements[0]
.groups()
.map(banner => banner.actions().slice(-1)[0])
.forEach(banner => banner.perform())
`)
async function jxa(script: string) {
await writeFile(kenvTmpPath("clear-macos-notifications.jxa"), script);
await execa("osascript", ["-l", "JavaScript", kenvTmpPath("clear-macos-notifications.jxa")]);
}