import { html } from "lit";
import { when } from "lit/directives/when.js";
import { copyButtonClickHandler, getMessageSerializedContentAll, tokenMap } from "./utils.js";
const copyClickHandler = (event, message) => {
    // We use the whole message to support copying the files and/or sources
    const messageSerializedContentAll = getMessageSerializedContentAll(message);
    copyButtonClickHandler(event, messageSerializedContentAll);
};
export const customActionsRender = (message, chatRef) => {
    const { accessibleName } = chatRef.translations;
    const conditionToRender1 = message.role === "assistant" &&
        (message.status === "complete" || !message.status);
    const conditionToRender2 = message.role === "error";
    return when(conditionToRender1 || conditionToRender2, () => html `<div part="actions-container"><button aria-label="${accessibleName.copyMessageContent}" part="${tokenMap({
        [`action-button action-copy-message ${message.id}`]: true,
        ...(message.parts ? { [message.parts]: true } : {})
    })}" type="button" @click="${(e) => copyClickHandler(e, message)}"></button></div>`);
};
