{:then blobUrl}
{#if mime.startsWith("image/")}
{:else if mime.startsWith("video/")}
{:else if mime.startsWith("audio/")}
{/if}
{:catch}
{@const url = tag.find((v) => v.startsWith("url "))?.slice(4) || ""}
{truncUrl(url)}
{/await}
{/if}
{/each}
{#each plainMedia as media}
{#if media.mime.startsWith("image/")}
{:else if media.mime.startsWith("video/")}
{:else if media.mime.startsWith("audio/")}
{:else}
{truncUrl(media.url)}
{/if}
{/each}
{#each parts as { type, value }}
{#if type === "text"}
{value}
{:else if type === "newline"}
{:else if type === "link"}
{#if imetaUrls.has(value.url)}
{:else if isImage(value.url)}
{:else if isVideo(value.url)}
{:else if isAudio(value.url)}
{:else}
{truncUrl(value.url)}
{/if}
{:else if type === "topic"}
#{value}
{:else if type.match(/^nostr:n(profile|pub)$/)}
{#await resolveName(value.pubkey)}
@{value.pubkey.slice(0, 8)}...
{:then name}
{name}
{/await}
{:else if type === "nostr:note"}
nostr:{value.entity?.slice(0, 16)}...
{:else if type === "nostr:nevent"}
nostr:{value.entity?.slice(0, 16)}...
{/if}
{/each}