/* Export. The whole file is built in Rust and written by whichever door the platform has — the desktop's save dialog, the phone's create-document sheet — so all the command ever answers is where it went: a path there, the document's name here. The sanitiser is the Rust one, character for character (and written as a code-point test rather than a range, so nothing in this file is a control byte). A dismissed sheet (null) and a refusal are armed from the walk with `__ssMock.answer` / `.fail`, which `weather()` answers first. */ if (cmd === "playlist_export") { const p = plOf(args); if (!p) return Promise.reject(new Error("Playlist not found")); const fmt = String(args?.format ?? ""); if (!["m3u8", "xspf", "pls", "csv", "json"].includes(fmt)) return Promise.reject(new Error("Unknown export format " + fmt)); const safe = [...String(p.name)].map((c) => (/[<>:"\/\\|?*]/.test(c) || c.codePointAt(0) < 0x20 ? "_" : c)).join(""); return new Promise((r) => setTimeout(() => r(safe + "." + fmt), 120)); }