import { esc } from '../utils.js';
import { createElement, User } from 'lucide';
function postImages(post) {
const embed = post?.embed;
if (!embed) return [];
if (embed.$type === 'app.bsky.embed.images#view') return embed.images || [];
if (embed.$type === 'app.bsky.embed.recordWithMedia#view') {
const media = embed.media;
if (media?.$type === 'app.bsky.embed.images#view') return media.images || [];
}
return [];
}
export function createCard(profile, hotkey, onClick, isFollowed = false) {
const card = document.createElement('div');
card.className = `border border-black dark:border-gray-600 p-3 cursor-pointer flex flex-col break-words${isFollowed ? ' opacity-60' : ''}`;
const hint = isFollowed ? ` unfollow` : '';
const keyHtml = `[${hotkey}]${hint}`;
const posts = (profile.topPosts || []).slice(0, 2);
const postsHtml = posts.length
? posts.map((p, i) => {
const lead = postImages(p)[0];
const leadHtml = lead
? ``
: '';
return `