import {requireEnglishSurface} from './document-localization.js';
// @requirements REQ-EU-NOTICE REQ-US-CA-CHOICES REQ-US-VA-RIGHTS
// @requirements REQ-PRODUCT-RIGHTS-CENTER REQ-PRODUCT-MOBILE REQ-PRODUCT-A11Y
import {isSafeLink,toPublicConfig} from './config.js';
import {escapeHtml,renderLegalLinks} from './documents.js';
import type {ValidationOptions} from './types.js';
export type RightsCenterRenderOptions=ValidationOptions&{idPrefix?:string;headingLevel?:1|2|3|4|5};
/** Script-free entry points. Following a link never means a request was submitted or fulfilled. */
export function renderRightsCenter(input:unknown,options:RightsCenterRenderOptions={}):string {
const mode=options.mode??'production';const config=toPublicConfig(input,{...options,mode}),center=config.rightsCenter;requireEnglishSurface(config,'Privacy request center');if(!center)throw new Error('Declare a rights center before rendering it.');
const id=options.idPrefix??'nb-rights';if(!/^[a-z][a-z0-9-]{0,79}$/u.test(id)||options.headingLevel!==undefined&&![1,2,3,4,5].includes(options.headingLevel))throw new Error('Use a unique lowercase ID prefix and a heading level from 1 to 5.');
const heading='h'+(options.headingLevel??2),sub='h'+((options.headingLevel??2)+1),e=escapeHtml;
return ` ${e(config.site.name)} · Your information ${e(center.intro)} Draft rights information — for review. ${e(action.description)} ${e(action.scope)}${center.nextSteps.map(step=>`