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K,IAAI,CACxD,CAGO,MAAMiB,EAAeC,GAC3B,uBAAuB,mBAAmBA,EAAE,UAAYA,EAAE,MAAM,CAAC,GAIlE,IAAIC,EAA6D,KAE1D,SAASC,EAAeC,EAAgBC,EAAoB,CAClEH,EAAQ,CAAE,OAAAE,EAAQ,KAAAC,EAAM,GAAI,KAAK,KAAI,CACtC,CAGO,SAASC,GAAyD,CACxE,MAAMC,EAAIL,EACV,OAAAA,EAAQ,KACDK,GAAK,KAAK,IAAA,EAAQA,EAAE,GAAK,KAAS,CAAE,OAAQA,EAAE,OAAQ,KAAMA,EAAE,MAAS,IAC/E","names":["BLOCK_SCOPES","ALL_SCOPES","BLOCK_SCOPE_COPY","msg","BLOCK_SCOPE_SHORT","scopesOnCount","s","k","blockedWhen","iso","now","at","day","d","n","LOCALE_INFO","locale","blockedAgo","w","t","blockedSince","scopeText","on","off","blockedHref","b","flash","flashUnblocked","userId","name","takeUnblocked","f"],"sources":["../../../../../../src/lib/block-scopes.ts","../../../../../../src/lib/components/p/blocked.ts"],"sourcesContent":["// What a block covers (fleet tasks/2026-11-29-block-everything). One catalogue shared by the\n// settings UI and the server (src/lib/server/block.ts), like $lib/staff/permissions. Each scope\n// is a boolean column on user_block (scope_<key>); a row either way blocks the pair for a scope\n// that's on. Client-safe: no $lib/server imports.\n\nimport { msg } from '$lib/i18n/mark';\n\nexport const BLOCK_SCOPES = ['messages', 'profile', 'posts', 'games', 'commerce'] as const;\nexport type BlockScope = (typeof BLOCK_SCOPES)[number];\nexport type BlockScopes = Record<BlockScope, boolean>;\n\n/** A new block: \"block everything\". */\nexport const ALL_SCOPES: Readonly<BlockScopes> = Object.freeze({\n\tmessages: true,\n\tprofile: true,\n\tposts: true,\n\tgames: true,\n\tcommerce: true\n});\n\nexport const isBlockScope = (v: unknown): v is BlockScope =>\n\ttypeof v === 'string' && (BLOCK_SCOPES as readonly string[]).includes(v);\n\n/** A client's scope set (\"choose what to block\"): exactly the five keys, each a boolean, at least\n *  one on. Anything else is null (the route answers 400). */\nexport function parseBlockScopes(v: unknown): BlockScopes | null {\n\tif (!v || typeof v !== 'object' || Array.isArray(v)) return null;\n\tconst o = v as Record<string, unknown>;\n\tconst keys = Object.keys(o);\n\tif (keys.length !== BLOCK_SCOPES.length || !keys.every(isBlockScope)) return null;\n\tif (!BLOCK_SCOPES.every((k) => typeof o[k] === 'boolean')) return null;\n\tconst s = Object.fromEntries(BLOCK_SCOPES.map((k) => [k, o[k] as boolean])) as BlockScopes;\n\treturn BLOCK_SCOPES.some((k) => s[k]) ? s : null;\n}\n\n/** Settings copy (English keys for t()): the row title and its sub-line. */\nexport const BLOCK_SCOPE_COPY: Record<BlockScope, { title: string; sub: string }> = {\n\tmessages: { title: msg('messages'), sub: msg('no DMs, gifts in chat or chat invites') },\n\tprofile: {\n\t\ttitle: msg('profile and sculpt'),\n\t\tsub: msg(\"they can't find you: profile, sculpt, search, lists\")\n\t},\n\tposts: {\n\t\ttitle: msg('posts and comments'),\n\t\tsub: msg('your posts, stories, comments, likes and mentions')\n\t},\n\tgames: { title: msg('games'), sub: msg('duels, beats, arena, clash, duet and other games') },\n\tcommerce: {\n\t\ttitle: msg('follows and purchases'),\n\t\tsub: msg('following you, albums, tips and paid rates')\n\t}\n};\n\n/** The short names the summary line uses. */\nexport const BLOCK_SCOPE_SHORT: Record<BlockScope, string> = {\n\tmessages: msg('messages'),\n\tprofile: msg('profile'),\n\tposts: msg('posts'),\n\tgames: msg('games'),\n\tcommerce: msg('follows and buys')\n};\n\nexport const scopesOnCount = (s: BlockScopes): number => BLOCK_SCOPES.filter((k) => s[k]).length;\n\n/** The list sub-line: 5 on \"everything\", 4 on \"everything but games\", 1-3 on the short names\n *  (\"messages, games\"). */\nexport function scopeSummary(s: BlockScopes): string {\n\tconst on = BLOCK_SCOPES.filter((k) => s[k]);\n\tif (on.length === BLOCK_SCOPES.length) return 'everything';\n\tif (on.length === BLOCK_SCOPES.length - 1) {\n\t\tconst off = BLOCK_SCOPES.find((k) => !s[k])!;\n\t\treturn `everything but ${BLOCK_SCOPE_SHORT[off]}`;\n\t}\n\treturn on.map((k) => BLOCK_SCOPE_SHORT[k]).join(', ');\n}\n","import { t, locale, LOCALE_INFO } from '$lib/i18n';\nimport { BLOCK_SCOPES, BLOCK_SCOPE_SHORT, type BlockScopes } from '$lib/block-scopes';\n\n// Blocked accounts (fleet tasks/2026-11-29-block-everything): the list and the detail page.\n\n/** When a block was made, in calendar days: today, yesterday, 2-6 days ago, then a date\n *  (month + day, the year only when it isn't this year). */\nexport type BlockedWhen =\n\t| { kind: 'today' }\n\t| { kind: 'yesterday' }\n\t| { kind: 'days'; n: number }\n\t| { kind: 'date'; date: string };\n\nexport function blockedWhen(iso: string, now = new Date()): BlockedWhen {\n\tconst at = new Date(iso);\n\tconst day = (d: Date) => Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()) / 86_400_000;\n\tconst n = day(now) - day(at);\n\tif (n <= 0) return { kind: 'today' };\n\tif (n === 1) return { kind: 'yesterday' };\n\tif (n <= 6) return { kind: 'days', n };\n\tconst date = at.toLocaleDateString(LOCALE_INFO[locale()].hreflang, {\n\t\tmonth: 'short',\n\t\tday: 'numeric',\n\t\t...(at.getFullYear() === now.getFullYear() ? {} : { year: 'numeric' })\n\t});\n\treturn { kind: 'date', date };\n}\n\n/** The list row's \"blocked 3 days ago\". */\nexport function blockedAgo(iso: string, now = new Date()): string {\n\tconst w = blockedWhen(iso, now);\n\tif (w.kind === 'today') return t('blocked today');\n\tif (w.kind === 'yesterday') return t('blocked yesterday');\n\tif (w.kind === 'days') return t('blocked {n} days ago', { n: w.n });\n\treturn t('blocked {date}', { date: w.date });\n}\n\n/** The detail page's \"Blocked 3 days ago.\" */\nexport function blockedSince(iso: string, now = new Date()): string {\n\tconst w = blockedWhen(iso, now);\n\tif (w.kind === 'today') return t('Blocked today.');\n\tif (w.kind === 'yesterday') return t('Blocked yesterday.');\n\tif (w.kind === 'days') return t('Blocked {n} days ago.', { n: w.n });\n\treturn t('Blocked {date}.', { date: w.date });\n}\n\n/** scopeSummary in the page's language: \"everything\", \"everything but games\", \"messages, games\". */\nexport function scopeText(s: BlockScopes): string {\n\tconst on = BLOCK_SCOPES.filter((k) => s[k]);\n\tif (on.length === BLOCK_SCOPES.length) return t('everything');\n\tif (on.length === BLOCK_SCOPES.length - 1) {\n\t\tconst off = BLOCK_SCOPES.find((k) => !s[k])!;\n\t\treturn t('everything but {scope}', { scope: t(BLOCK_SCOPE_SHORT[off]) });\n\t}\n\treturn on.map((k) => t(BLOCK_SCOPE_SHORT[k])).join(', ');\n}\n\n/** Where an account's detail page lives: by nickname, or by id for a deleted account. */\nexport const blockedHref = (b: { userId: string; nickname: string | null }) =>\n\t`/p/settings/blocked/${encodeURIComponent(b.nickname ?? b.userId)}`;\n\n// The detail page's unblock lands back on the list, which says so. Set only in a tap handler\n// (never on the server, so never shared across requests) and taken once by the list.\nlet flash: { userId: string; name: string; at: number } | null = null;\n\nexport function flashUnblocked(userId: string, name: string): void {\n\tflash = { userId, name, at: Date.now() };\n}\n\n/** The unblock just made (within 15s), once. */\nexport function takeUnblocked(): { userId: string; name: string } | null {\n\tconst f = flash;\n\tflash = null;\n\treturn f && Date.now() - f.at < 15_000 ? { userId: f.userId, name: f.name } : null;\n}\n"],"version":3}