/**
 * Generates a client-only, ephemeral identity for a draft list row (a
 * recipe's ingredient lines/steps while editing — see `RecipeFormPage`,
 * `StepListEditor`) — used purely as a React `key`/local identity to keep
 * each row's own input state stable across reorders, never sent to the
 * server or persisted anywhere.
 *
 * `crypto.randomUUID()` looks like the obvious choice, but the Web Crypto
 * API only defines it in a "secure context" — https, or the literal
 * hostname `localhost` — and throws `TypeError: crypto.randomUUID is not a
 * function` everywhere else: a LAN IP while testing on a real device, a
 * Capacitor WebView's `capacitor://` origin (this app's eventual mobile
 * wrapper — see `AllergySelect`'s doc comment for the same "mobile via
 * Capacitor" context), plain `http://` on a real domain before TLS is set
 * up. None of that matters for a value that only ever needs to be *unique
 * within this one render session*, not cryptographically random, so this
 * never touches `crypto` at all.
 */
let counter = 0;

export function makeClientKey(): string {
  counter += 1;
  return `${counter}-${Math.random().toString(36).slice(2)}`;
}
