Spot it. Save it. Free, local-first Chrome extension for images, videos and prompts. Explore 2,000+ curated cases and connect your library to AI Agents via MCP. 提示词导演
JavaScript ai-artai-videochrome-extensionclaude-codecodexhiggsfieldjimenglocal-firstmcpmidjourneymoodboardprompt-engineeringprompt-libraryprompt-managerreference-libraryseedancevisual-bookmarksweb-clipper
import { uniqueNames } from "./facets.js";
// A label edit made from an earlier view sends only what it added and removed. Applying that delta
// to the latest labels inside the write queue keeps a concurrent Agent or batch change. A plain
// customLabels list still replaces the labels for callers that read and send the whole list.
export function editedLabels(currentLabels, edit = {}) {
if (!Array.isArray(edit.addLabels) && !Array.isArray(edit.removeLabels)) return uniqueNames(edit.customLabels);
const removed = new Set(uniqueNames(edit.removeLabels));
return uniqueNames([...(currentLabels ?? []).filter(label => !removed.has(label)), ...uniqueNames(edit.addLabels)]);
}