import { html } from "lit";
import { keyed } from "lit/directives/keyed.js";
import { when } from "lit-html/directives/when.js";
import { getCitationWithTitle } from "./generated-answer-utils.js";
import "../atomic-citation/atomic-citation.js";
const renderCitations = ({ props })=>{
    const { citations, i18n, buildInteractiveCitation, logCitationHover, disableCitationAnchoring } = props;
    return html`${when(citations && citations.length > 0, ()=>citations?.map((citation, index)=>{
            const interactiveCitation = buildInteractiveCitation(citation);
            return keyed(citation.id, html`
          <li class="max-w-full">
            <atomic-citation
              .citation=${getCitationWithTitle(citation, i18n)}
              .index=${index}
              .sendHoverEndEvent=${(citationHoverTimeMs)=>{
                logCitationHover(citation.id, citationHoverTimeMs);
            }}
              .interactiveCitation=${interactiveCitation}
              .disableCitationAnchoring=${disableCitationAnchoring ?? false}
              exportparts="citation,citation-popover"
            ></atomic-citation>
          </li>
        `);
        }))}`;
};
export { renderCitations };
