// Root todo.txt rail widget. Surfaces wiki-root/todo.txt at the top of the // left navigation rail (above the folder tree) and keeps it editable in place: // a plain read view paints first (fast, no dependency), then a minimal // CodeMirror instance (todo.txt highlighting from the bundle) always mounts — // lazily, off the critical path, so the bundle fetch never delays first paint. // Autosave is debounced + saves on blur via POST /_todo. While the tab is // visible the widget polls /_todo (conditional GET, ETag) and reloads when // another device changed the file — but only while the local buffer is clean, // so an active typist is never interrupted (last-write-wins on a real clash). // If the file is absent (GET /_todo → 404) the widget renders nothing and no // FAB is created; the file is only ever created out-of-band. Mobile: a // dedicated todo FAB opens the widget in the full-viewport Overlay // (overlay.js), saving on dismiss. (function () { var container = document.querySelector('[data-todo-rail]'); if (!container) return; var TODO_URL = '/_todo'; var DEBOUNCE_MS = 800; var RETRY_MS = 5000; var POLL_MS = 15000; // external-change check cadence (visible tab only) var view = null; // CM EditorView once mounted var fallback = null; //