```ts
/** The KEY=VALUE pairs of a config file. */
export function parseConfig(text: string): Record<string, string> {
  const config: Record<string, string> = {};
  for (const line of text.split("\n")) {
    // Remove leading blank lines and comments
    if (line.startsWith("#") || line.trim() === "") continue;

    // Split the line on the first equal sign
    const parts = line.split("=", 2);
    if (parts.length !== 2) throw new Error(`Unexpected value: ${line}`);

    const key = parts[0].trim();
    const value = parts[1].trim();

    // Check for invalid keys or values
    if (key === "") throw new Error(`Empty key found at: ${line}`);
    if (! /^\S/.test(key)) throw new Error(`Invalid key found at: ${line}`);

    if (value === "") throw new Error(`Empty value found at: ${line}`);

    // Ensure the key does not reach the prototype
    const protoKey = "__proto__";
    if (key === protoKey) {
      config[key] = value;
      return config;
    }

    // Store the fixed value in the config object, treating it as plain data
    config[key] = value;
  }
  return config;
}
```