{#snippet userBadge(identifier: string, displayText: string | undefined, ndk?: NDK)} {@const npub = toNpub(identifier)} {#if npub} {#if !displayText || displayText.trim().toLowerCase() === "unknown"} {#await getUserMetadata(npub, ndk, false) then profile} {@const p = profile as UserProfile} {:catch error} {@const debugError = console.error("Error fetching profile for", npub, ":", error)} {/await} {:else} {#await createProfileLinkWithVerification(npub as string, displayText, ndk)} {:then html} {@html html.replace(/([\s\S]*<\/a>)/, "").trim()} {:catch} {/await} {/if} {:else} {displayText ?? ""} {/if} {/snippet}