// Some LNURL clients (aqstr.com, 2026-12-04) append "?amount=…" to a callback // that already has a query, so "cb?domain=coinos.io" arrives as // "cb?domain=coinos.io?amount=21000": domain reads "coinos.io?amount=21000", // the name is unknown and the payer gets a 404. export function tolerantParams(search) { // a literal "?" inside a query is only ever this mistake: a real one in a // value arrives encoded (%3F). The first occurrence of a parameter wins. return new URLSearchParams(String(search || '').replace(/^\?/, '').replace(/\?/g, '&')); }