{"release_id":"01a1998d-9802-0000-b0f7-33a23307f4ed","chunk_id":"01a1998d-992b-7253-9e35-050a29579c35","file":"DBOX_5Md.mjs","mappings":"wVAaO,MAAMA,EAAoD,CAChE,YAAa,CACZC,EAAI,mBAAmB,EACvBA,EAAI,sCAAsC,EAC1CA,EAAI,0BAA0B,EAC9BA,EAAI,6BAA6B,CAAA,EAElC,MAAO,CACNA,EAAI,4BAA4B,EAChCA,EAAI,4BAA4B,EAChCA,EAAI,yCAAyC,EAC7CA,EAAI,qBAAqB,CAAA,EAE1B,GAAI,CACHA,EAAI,QAAQ,EACZA,EAAI,kCAAkC,EACtCA,EAAI,mCAAmC,EACvCA,EAAI,YAAY,CAAA,CAElB,EAYaC,EAAqB,qBACrBC,EAAwB,IAAS,IAIvC,SAASC,EAAkBC,EAAgBC,EAAoB,CACrE,GAAI,CACH,eAAe,QACdJ,EACA,KAAK,UAAU,CAAE,OAAAG,EAAQ,KAAAC,EAAM,GAAI,KAAK,KAAI,CAA2B,CAAA,CAEzE,MAAQ,CAER,CACD,CAIO,SAASC,EAAkBF,EAA+B,CAChE,IAAIG,EACJ,GAAI,CACHA,EAAM,eAAe,QAAQN,CAAkB,EAC/C,eAAe,WAAWA,CAAkB,CAC7C,MAAQ,CACP,OAAO,IACR,CACA,GAAI,CAACM,EAAK,OAAO,KACjB,GAAI,CACH,MAAMC,EAAI,KAAK,MAAMD,CAAG,EAExB,OADIC,EAAE,SAAWJ,GAAU,OAAOI,EAAE,MAAS,UAAY,OAAOA,EAAE,IAAO,UACrE,KAAK,IAAA,EAAQA,EAAE,GAAKN,EAA8B,KAC/CH,EAAQ,YAAY,SAASS,EAAE,IAAI,EAAIA,EAAE,KAAO,IACxD,MAAQ,CACP,OAAO,IACR,CACD","names":["OPENERS","msg","OPENER_HANDOFF_KEY","OPENER_HANDOFF_TTL_MS","saveOpenerHandoff","userId","text","takeOpenerHandoff","raw","h"],"sources":["../../../../../../src/lib/chat-openers.ts"],"sourcesContent":["/** One-tap openers, fitted to the context (RAT-522). Client-safe.\n *\n *  An empty DM offered four arena-themed icebreakers to everyone — a rater's DM\n *  included (\"so what brings you to the arena?\") — and a tap only filled the\n *  composer. 64% of matches get no message within 7 days, and about 23% of the\n *  people who open the DM after a match send nothing. The chips fit who is on\n *  the other side and a tap sends; the match overlay offers the same, so the\n *  first message can go before the chat even opens. */\n\nimport { msg } from '$lib/i18n/mark';\n\nexport type OpenerContext = 'arena_match' | 'rater' | 'dm';\n\nexport const OPENERS: Record<OpenerContext, readonly string[]> = {\n\tarena_match: [\n\t\tmsg('hey 👋 we matched'),\n\t\tmsg('ok your photo made me stop scrolling'),\n\t\tmsg('so… you liked me back 😏'),\n\t\tmsg('what are you up to tonight?')\n\t],\n\trater: [\n\t\tmsg('hey! could you rate me? 🙏'),\n\t\tmsg('be brutally honest with me'),\n\t\tmsg('first time getting rated — be gentle 😅'),\n\t\tmsg('how does this work?')\n\t],\n\tdm: [\n\t\tmsg('hey 👋'),\n\t\tmsg('saw your profile — had to say hi'),\n\t\tmsg('you seem fun — what are you into?'),\n\t\tmsg(\"what's up?\")\n\t]\n};\n\n/** A match is the stronger shared moment, so it wins over \"they rate\". */\nexport function openerContext(p: { isArenaMatch: boolean; isRater: boolean }): OpenerContext {\n\tif (p.isArenaMatch) return 'arena_match';\n\tif (p.isRater) return 'rater';\n\treturn 'dm';\n}\n\n/** The match overlay → DM handoff: the overlay keeps the opener that was\n *  tapped, keyed to the person, and the DM sends it on arrival. sessionStorage\n *  and only ever written by our own tap — a link can't make anyone send. */\nexport const OPENER_HANDOFF_KEY = 'arena_match_opener';\nexport const OPENER_HANDOFF_TTL_MS = 2 * 60 * 1000;\n\nexport type OpenerHandoff = { userId: string; text: string; at: number };\n\nexport function saveOpenerHandoff(userId: string, text: string): void {\n\ttry {\n\t\tsessionStorage.setItem(\n\t\t\tOPENER_HANDOFF_KEY,\n\t\t\tJSON.stringify({ userId, text, at: Date.now() } satisfies OpenerHandoff)\n\t\t);\n\t} catch {\n\t\t// Private mode / storage blocked: the DM just opens without it.\n\t}\n}\n\n/** Reads and clears the handoff; returns the text only if it is for `userId`,\n *  fresh, and one of the openers we offer (never arbitrary text). */\nexport function takeOpenerHandoff(userId: string): string | null {\n\tlet raw: string | null;\n\ttry {\n\t\traw = sessionStorage.getItem(OPENER_HANDOFF_KEY);\n\t\tsessionStorage.removeItem(OPENER_HANDOFF_KEY);\n\t} catch {\n\t\treturn null;\n\t}\n\tif (!raw) return null;\n\ttry {\n\t\tconst h = JSON.parse(raw) as Partial<OpenerHandoff>;\n\t\tif (h.userId !== userId || typeof h.text !== 'string' || typeof h.at !== 'number') return null;\n\t\tif (Date.now() - h.at > OPENER_HANDOFF_TTL_MS) return null;\n\t\treturn OPENERS.arena_match.includes(h.text) ? h.text : null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n"],"version":3}