// Metro module 8116 (f8117). import { createZustandStore } from "../../../lib/ZustandStore"; import { flattenSource } from "./MediaSourceUtil"; const zustandStore = (0, createZustandStore)(() => ({ sources: [], spoilerIndexes: new Set() })); export { zustandStore as MediaViewerSourcesStore }; export function setMediaViewerSources({ sources, initialIndex = null }) { let c16258_0 = initialIndex; const sources2 = []; let c16258_1 = sources2; const set = new Set(); let c16258_2 = set; sources.forEach((source, index) => { const r5 = flattenSource(source); if (r5 != null && (r5.spoiler || r5.obscure) && c16258_0 !== index) { c16258_2.add(index); } c16258_1.push(source); }); zustandStore.setState({ sources: sources2, spoilerIndexes: set }); } export function removeSpoiler(a0) { const field = zustandStore.getField("spoilerIndexes"); if (field.has(a0)) { const set = new Set(field); set.delete(a0); zustandStore.setState({ spoilerIndexes: set }); } } export function toggleSpoiler(a0) { const set = new Set(zustandStore.getField("spoilerIndexes")); if (set.has(a0)) { set.delete(a0); } else { set.add(a0); } zustandStore.setState({ spoilerIndexes: set }); }