async function selectdate() { log('selectdate()'); try { const { date } = await chrome.storage.local.get('date'); const dateBtn = await waitForCondition(() => { const buttons = Array.from(document.querySelectorAll('button')).filter(b => b.textContent.trim().match(/^([1-9]|[12][0-9]|3[01])$/)); let target = buttons.find(b => b.textContent.trim() === date.toString()); if (target && target.classList.contains('Mui-disabled')) target = buttons.find(b => !b.classList.contains('Mui-disabled')); return target; }, { timeout: 25000 }); log('selectdate → click', dateBtn?.textContent.trim()); nativeClick(dateBtn); await new Promise(r => setTimeout(r, 200)); selectTime(); } catch (err) { log('selectdate → waitForCondition failed:', err?.message || err); location.reload(); return; } }