// Resolves the quick-capture URL from query params produced by the bookmarklet (`add`)
// or the PWA share-target (a link in `add`, or embedded in shared `addtext`).
export function resolveCaptureUrl(search: string): string | null {
  const params = new URLSearchParams(search);
  const add = params.get("add");
  if (add) return add;
  const addText = params.get("addtext");
  if (addText) return addText.match(/https?:\/\/\S+/)?.[0] ?? null;
  return null;
}
