{"release_id":"01a1c502-4ad1-0000-ec62-adc54d3c69aa","chunk_id":"01a1c502-4c4c-70b3-b5ba-a8bf0006d6a0","file":"aMyurJGG.mjs","mappings":"icA4BO,MAAMA,EAAuB,qBACvBC,EAAsB,oBACtBC,EAAoB,kBAIpBC,EAAoBC,EAChC,qEACD,EAIO,SAASC,EAAaC,EAA6B,CACzD,GAAI,CAACA,EAAM,MAAO,IAClB,GAAI,CAACA,EAAK,WAAW,eAAe,EAAG,OAAOA,EAC9C,MAAMC,EAAO,IAAI,IAAID,EAAM,UAAU,EAAE,aAAa,IAAI,MAAM,EAC9D,OAAOC,GAAQA,EAAK,WAAW,GAAG,GAAK,CAACA,EAAK,WAAW,IAAI,EAAIA,EAAO,GACxE,CAKO,SAASC,EAAcC,EAOrB,CACRC,EAAmB,CAAE,QAASD,EAAK,OAAA,CAAS,EACxCA,EAAK,QAAQE,EAAWF,EAAK,OAAO,IAAKA,EAAK,OAAO,OAAO,EAChEG,EAAcH,EAAK,KAAM,QAAQA,EAAK,OAAO,GAAIA,EAAK,OAAO,CAC9D","names":["RESUME_ROLEPLAY_SEND","RESUME_ALBUM_UNLOCK","RESUME_ARENA_VOTE","RATER_GATE_DETAIL","msg","nextFromHref","href","next","hitSignInGate","opts","trackAuthGateShown","saveResume","openAuthSheet"],"sources":["../../../../../../src/lib/contextual-sign-in.ts"],"sourcesContent":["/** In-place, contextual sign-in (RAT-519). Client-safe.\n *\n *  Signed out, the rater DM, a roleplay send and an album unlock each sent the\n *  visitor to a generic /auth/sign-in page: the roleplay message they had typed\n *  was lost on the way, and the rater DM gate alone stopped 195 new users. The\n *  app-wide AuthSheet opens in place instead, says what the sign-in is for, and\n *  the action finishes once they are in — the message sends, the album\n *  unlocks, the DM opens. Synchronous, so a click handler decides on the spot.\n */\nimport { trackAuthGateShown } from '$lib/analytics';\nimport { msg } from '$lib/i18n/mark';\nimport { saveResume } from '$lib/oauth-resume';\nimport { openAuthSheet, type AuthSheetContext } from '$lib/stores/authSheet';\n\nexport type SignInGateSurface =\n\t| 'rater_dm'\n\t| 'profile_message'\n\t| 'roleplay_send'\n\t/** A roleplay gate that isn't a send: suggest, a photo, the controls. */\n\t| 'roleplay_action'\n\t| 'album_unlock'\n\t/** RAT-525, signed-out arena: a ✓ / ✗ or a swipe, and the swipes line. */\n\t| 'arena_vote'\n\t| 'arena_swipes';\n\n/** Where a gate keeps the action it will finish after sign-in. sessionStorage,\n *  via oauth-resume: it survives the round trip to Google and dies with the\n *  tab, so a shared phone never replays someone else's message. */\nexport const RESUME_ROLEPLAY_SEND = 'gate_roleplay_send';\nexport const RESUME_ALBUM_UNLOCK = 'gate_album_unlock';\nexport const RESUME_ARENA_VOTE = 'gate_arena_vote';\n\n/** What asking a rater is, in one line: true to the data (median 1.2 minutes to\n *  a rating, 93% of requests answered). */\nexport const RATER_GATE_DETAIL = msg(\n\t'send a pic and a real person rates it — most answer within minutes.'\n);\n\n/** Where a gated link was headed. A signed-out link may already point at the\n *  sign-in page with the destination in `next`; take that destination back. */\nexport function nextFromHref(href: string | null): string {\n\tif (!href) return '/';\n\tif (!href.startsWith('/auth/sign-in')) return href;\n\tconst next = new URL(href, 'http://x').searchParams.get('next');\n\treturn next && next.startsWith('/') && !next.startsWith('//') ? next : '/';\n}\n\n/** A signed-out visitor reached for something that needs an account: keeps\n *  what they were doing and opens the sheet in place. The caller stops the\n *  default navigation, if it had one. */\nexport function hitSignInGate(opts: {\n\tsurface: SignInGateSurface;\n\t/** Where to land once signed in. */\n\tnext: string;\n\tcontext: AuthSheetContext;\n\t/** The action to finish after sign-in. */\n\tresume?: { key: string; payload: Record<string, unknown> };\n}): void {\n\ttrackAuthGateShown({ surface: opts.surface });\n\tif (opts.resume) saveResume(opts.resume.key, opts.resume.payload);\n\topenAuthSheet(opts.next, `gate_${opts.surface}`, opts.context);\n}\n"],"version":3}