import { buildInteractiveResultCore, } from '../../core/interactive-result/headless-core-interactive-result.js';
/**
 * Creates a core `InteractiveCitation` controller instance.
 *
 * @param engine - The headless engine.
 * @param props - The configurable `InteractiveCitation` properties.
 * @returns An `InteractiveCitation` controller instance.
 */
export function buildInteractiveCitationCore(engine, analyticsClient, props) {
    let wasOpened = false;
    const logAnalyticsIfNeverOpened = () => {
        if (wasOpened) {
            return;
        }
        wasOpened = true;
        engine.dispatch(analyticsClient.logOpenGeneratedAnswerSource(props.options.citation.id, props.options.answerId));
    };
    const action = () => {
        logAnalyticsIfNeverOpened();
    };
    return buildInteractiveResultCore(engine, props, action);
}
