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,KAAIvB,EAAA,IAAA,CAAA,MAGpCuB,EAAE,4CAA2C,CAAI,KAAIvB,EAAA,IAAA,CAAA,sBACrC,EAAIuB,EAAE,0BAA0B,EAAIA,EAAE,8BAA6B,CAAI,EAACvB,EAAA,WAAA,CAAA,EASvF,IAAAsB,EAAA3B,CAAO,EAAG4B,EAAE,UAAU,EAAIA,EAAE,WAAW,EAOvC,IAAAA,EAAE,aAAa,MAIhBA,EAAE,qGAAoG,CAAI,KAAIvB,EAAA,SAAA,CAAA,IArClHwB,EAAA,QAAAnB,EAAA,YAAAoB,EAAA,4BAICD,EAAA,QAAAjB,EAIUH,GAAMA,EAAE,iBAAe,EAY9BoB,EAAA,QAAAR,EAESnB,CAAQ,EAMjB2B,EAAA,QAAAL,EAAA,YAAAM,EAAA,4BA5BJC,EAAAC,EAAAtB,CAAA,oCAPM","names":["joining","$.state","joinChat","$.set","res","$$props","body","goto","onKeydown","e","div","root_1","div_1","$.child","div_2","DuelAvatar","node_1","h2","$.sibling","p","div_3","button","text_2","$.reset","button_1","text_3","p_1","$.get","t","$.delegated","$$args","$.append","$$anchor"],"sources":["../../../../../../src/lib/components/niche/JoinNicheChatModal.svelte"],"sourcesContent":["<script lang=\"ts\">\n\timport { t } from '$lib/i18n';\n\t/**\n\t * RAT-346: reusable \"join the niche chat?\" modal.\n\t *\n\t * Originally lived inline on /n/[slug] (RAT-342); extracted here\n\t * so the discovery feed (/f Explore Niches tab) gets the same\n\t * prompt when users subscribe from a niche card.\n\t *\n\t * Caller controls `open` + supplies the niche slug/name + the\n\t * default room context (member count, code) for the social-proof\n\t * line + direct-route on join. On click → POST the join-chat\n\t * endpoint, navigate straight into the room on success.\n\t */\n\n\timport { goto } from '$app/navigation';\n\timport DuelAvatar from '$lib/components/duel/DuelAvatar.svelte';\n\n\ttype Props = {\n\t\topen: boolean;\n\t\tslug: string;\n\t\tnicheName: string;\n\t\tmemberCount: number;\n\t\troomCode: string | null;\n\t\tonClose: () => void;\n\t\tonJoined?: () => void;\n\t};\n\n\tlet { open, slug, nicheName, memberCount, roomCode, onClose, onJoined }: Props = $props();\n\n\tlet joining = $state(false);\n\n\tasync function joinChat() {\n\t\tif (joining) return;\n\t\tjoining = true;\n\t\ttry {\n\t\t\tconst res = await fetch(`/api/niches/${slug}/join-chat`, { method: 'POST' });\n\t\t\tif (!res.ok) return;\n\t\t\tconst body = (await res.json()) as { code: string };\n\t\t\tonJoined?.();\n\t\t\tonClose();\n\t\t\tgoto(`/g/${body.code}`);\n\t\t} catch {\n\t\t\t// silent\n\t\t} finally {\n\t\t\tjoining = false;\n\t\t}\n\t}\n\n\tfunction onKeydown(e: KeyboardEvent) {\n\t\tif (open && e.key === 'Escape') onClose();\n\t}\n</script>\n\n<svelte:window onkeydown={onKeydown} />\n\n{#if open}\n\t<!-- svelte-ignore a11y_click_events_have_key_events -->\n\t<!-- svelte-ignore a11y_no_static_element_interactions -->\n\t<div\n\t\tclass=\"fixed inset-0 z-[80] flex items-center justify-center bg-black/70 p-4\"\n\t\tonclick={onClose}\n\t>\n\t\t<div\n\t\t\trole=\"dialog\"\n\t\t\taria-modal=\"true\"\n\t\t\tclass=\"w-full max-w-sm rounded-2xl border border-border bg-bg p-6 shadow-2xl\"\n\t\t\tonclick={(e) => e.stopPropagation()}\n\t\t>\n\t\t\t<div class=\"flex flex-col items-center text-center\">\n\t\t\t\t<DuelAvatar nickname={slug} link={false} size={64} />\n\t\t\t\t<h2 class=\"mt-3 font-display text-xl font-bold tracking-tight\">\n\t\t\t\t\t{t('join the /n/{slug} chat?', { slug })}\n\t\t\t\t</h2>\n\t\t\t\t<p class=\"mt-2 text-sm text-muted leading-relaxed\">\n\t\t\t\t\t{t('real-time room for everyone in /n/{slug}.', { slug })}\n\t\t\t\t\t{memberCount === 1 ? t('1 member already inside.') : t('{n} members already inside.', { n: memberCount })}\n\t\t\t\t</p>\n\t\t\t\t<div class=\"mt-5 flex w-full flex-col gap-2\">\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonclick={joinChat}\n\t\t\t\t\t\tdisabled={joining || !roomCode}\n\t\t\t\t\t\tclass=\"w-full rounded-lg bg-accent py-2.5 font-display text-sm font-bold text-bg transition-opacity hover:opacity-90 disabled:opacity-60\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{joining ? t('joining…') : t('join chat')}\n\t\t\t\t\t</button>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonclick={onClose}\n\t\t\t\t\t\tclass=\"w-full rounded-lg border border-border bg-surface py-2.5 font-display text-sm font-semibold text-muted hover:text-text\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{t('maybe later')}\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<p class=\"mt-3 text-[10px] text-muted leading-snug\">\n\t\t\t\t\t{t(\"you can leave the chat anytime from the room's settings — independent of your {name} subscription.\", { name: nicheName })}\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n{/if}\n"],"version":3}