1import { BG_WIDGET_IDS } from './bg_window_policy.mjs'; 2 3function parseDate(value) { 4 const date = new Date(value); 5 return Number.isFinite(date.getTime()) ? date : null; 6} 7 8export function createPendingBgSelection(widgetId, b0ISO, b1ISO) { 9 const scopedWidget = widgetId || null; 10 if (scopedWidget && !BG_WIDGET_IDS.includes(scopedWidget)) return null; 11 const start = parseDate(b0ISO); 12 const end = parseDate(b1ISO); 13 if (!start || !end || end <= start) return null; 14 return { 15 widgetId: scopedWidget, 16 b0ISO: start.toISOString(), 17 b1ISO: end.toISOString(), 18 }; 19} 20 21export function pendingBgScope(pending) { 22 return pending?.widgetId ? 'widget' : 'shared'; 23}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.