<!-- source-hash: 4467cd3e4e4684bfc367e92c216ed7ad -->
Email domain validation utilities for SSO domain allowlist functionality. Provides validation, cleaning, and error handling for email domain formats used in auto-provisioning restrictions.

## Key Components

- **`isValidEmailDomain(domain: string): boolean`** - Core validation function using regex to check domain format
- **`validateEmailDomain(domain: string): EmailDomainValidationResult`** - Enhanced validation with detailed error messages and input cleaning
- **`validateEmailDomainList(domains: string[]): ValidationResult`** - Bulk validation for domain arrays with duplicate detection
- **`cleanEmailDomain(domain: string): string`** - Input sanitization removing common user mistakes
- **`EmailDomainValidationResult`** - Interface defining validation result structure

## Usage Example

```typescript
import { validateEmailDomain, validateEmailDomainList, cleanEmailDomain } from './validation-utils'

// Single domain validation with cleaning
const result = validateEmailDomain('@openframe.ai')
if (result.valid) {
  console.log('Clean domain:', result.cleanedDomain) // 'openframe.ai'
}

// Bulk validation
const domains = ['openframe.ai', 'company.com', 'invalid-domain']
const listResult = validateEmailDomainList(domains)
if (!listResult.valid) {
  console.error('Validation error:', listResult.error)
}

// Manual cleaning
const cleaned = cleanEmailDomain('https://www.example.com/path')
console.log(cleaned) // 'example.com'
```

The utilities handle common input mistakes like protocol prefixes, @ symbols, whitespace, and provide specific error messages for better user experience in SSO configuration workflows.