Clear all OSX Sonoma Notifications (14.1 > 14.9)

I have an old chunk of code that I found in this forum from 2019, and it used to clear persistent notifications really well in OS13. I upgraded to Sonoma (14.5) and now it throws errors and won't run. It's saying "Invalid Index", and I'm not sure how to fix it. Any advice? Thanks!

var app = Application("System Events");

var notificationCenter = app.processes.byName("Notification Center");

var group = notificationCenter.windows
.at(0)
.scrollAreas.at(0)
.uiElements.at(0)
.groups.at(0);

var actions = group.actions.whose({
_or: [{ description: "Clear All" }, { description: "Close" }],
});

try {
var uniqueNames = new Set();
var actionsToPerform = ; (This shows as a box, but it's two square brackets with a space)

actions().forEach((a) => {
if (!uniqueNames.has(a.name())) {
actionsToPerform.push(a);
}
uniqueNames.add(a.name());
});

var uniqueDescriptions = new Set(
actionsToPerform.map((a) => a.description())
);
if (uniqueDescriptions.has("Clear All")) {
var clearAll = actionsToPerform.filter(
(a) => a.description() === "Clear All"
)[0];
clearAll.perform();
} else {
actionsToPerform.forEach((a) => a.perform());
}
} catch (e) {
console.log(e.message);
}