import { html } from "/js/lib/lit-html.js";
import {
isBlockedPost,
isNotFoundPost,
isUnavailablePost,
getDisplayName,
doHideAuthorOnUnauthenticated,
} from "/js/dataHelpers.js";
import { noop } from "/js/utils.js";
import { linkToPost, linkToProfile } from "/js/navigation.js";
import { avatarTemplate } from "/js/templates/avatar.template.js";
import "/js/components/plugin-rich-text.js";
import { postEmbedTemplate } from "/js/templates/postEmbed.template.js";
import { postActionBarTemplate } from "/js/templates/postActionBar.template.js";
import { postHeaderTextTemplate } from "/js/templates/postHeaderText.template.js";
import { fillableIconTemplate } from "/js/templates/fillableIcon.template.js";
import { authorBadgesTemplate } from "/js/templates/labelBadges.template.js";
import { blockedPostTemplate } from "/js/templates/blockedPost.template.js";
import { notFoundPostTemplate } from "/js/templates/notFoundPost.template.js";
import { unavailablePostTemplate } from "/js/templates/unavailablePost.template.js";
import { moderationWarningTemplate } from "/js/templates/moderationWarning.template.js";
import "/js/components/lightbox-image-group.js";
import "/js/components/container-link.js";
import "/js/components/app-icon.js";
function contentWarningTemplate({
post,
ignoreContentWarning,
ignoreMuteWarning,
children,
}) {
const contentLabel = ignoreContentWarning ? null : post.contentLabel;
if (contentLabel && contentLabel.visibility !== "ignore") {
const isAuthorLabel = contentLabel.label.uri === post?.author?.did;
return moderationWarningTemplate({
className: "post-content-warning",
labelDefinition: contentLabel.labelDefinition,
labeler: contentLabel.labeler,
isAuthorLabel,
children,
});
}
if (!ignoreMuteWarning) {
// stop clicks here from bubbling to the surrounding post and triggering navigation
const stopClick = (e) => e.stopPropagation();
if (post.viewer?.hasMutedWord) {
return html`