function createProgressiveMyWork({ document, fetchSnapshot }) {
const list = document.querySelector('#my-work-list');
const status = document.querySelector('#my-work-status');
const filters = Array.from(document.querySelectorAll('[data-work-filter]'));
const listeners = [];
let items = [];
let active = 'all';
let stopped = false;
const escapeHtml = value => String(value || '').replace(/[&<>"']/g, character => ({
'&':'&', '<':'<', '>':'>', '"':'"', "'":''',
})[character]);
const safeUrl = value => {
try {
const url = new URL(String(value || ''), globalThis.location?.href || 'https://invalid.example/');
return ['http:', 'https:'].includes(url.protocol) ? url.href : '';
} catch (_error) { return ''; }
};
const visibleItems = () => active === 'all' ? items : items.filter(item =>
active === 'review' ? item.is_review :
active === 'update' ? item.has_update :
active === 'attention' ? item.needs_attention : item.kind === active
);
const render = () => {
if (stopped || !list) return;
const visible = visibleItems();
list.innerHTML = visible.length ? visible.map(item => {
const href = safeUrl(item.url);
const title = escapeHtml(item.title || item.key || 'Untitled work');
const context = escapeHtml(item.key || '');
const reason = escapeHtml(item.reason || 'Assigned to you');
return '