{"release_id":"01a2309f-d47d-0000-29bc-a17a97e31fa5","chunk_id":"01a2309f-d573-7223-9e1c-9b7381f697f0","file":"B_nH_mFe.mjs","mappings":"qTAmEO,MAAMA,EAAe","names":["AGE_REQUIRED"],"sources":["../../../../../../src/lib/age-gate.ts"],"sourcesContent":["/** RAT-641: the 18+ age gate, client-safe half.\n *\n *  Other people's media reaches a viewer who hasn't passed the age check only\n *  as a blurred stand-in; the first tap opens the check, and once it passes\n *  everything opens everywhere. Your own uploads are always sharp. A photo\n *  uploaded after launch by someone who never took the check stays closed to\n *  everyone else until they do. */\n\nexport type AgeStatus = 'none' | 'pending' | 'in_review' | 'approved' | 'declined' | 'revoked';\n\n/** What a viewer gets for one piece of media.\n *  - 'sharp': the original.\n *  - 'blur': a blurred stand-in; the viewer can open it by taking the check.\n *  - 'uploader': a blurred stand-in that opens once its uploader takes the check. */\nexport type MediaGate = 'sharp' | 'blur' | 'uploader';\n\n/** Where the gate was raised, for analytics and for the sheet's wording. */\nexport type AgeGateSurface =\n\t| 'feed'\n\t| 'post'\n\t| 'profile'\n\t| 'landing'\n\t| 'duel'\n\t| 'beat'\n\t| 'arena'\n\t| 'album'\n\t| 'chat'\n\t| 'contest'\n\t| 'niche'\n\t| 'clan'\n\t| 'floor'\n\t| 'rate'\n\t| 'rater'\n\t| 'livecam'\n\t| 'roleplay'\n\t| 'publish_post'\n\t| 'publish_arena'\n\t| 'publish_album'\n\t| 'publish_chat'\n\t| 'publish_contest';\n\n/** Viewing someone else's media, or putting your own in front of others. */\nexport type AgeGateMode = 'view' | 'publish';\n\nexport interface MediaGateInput {\n\tviewerId: string | null;\n\tviewerVerified: boolean;\n\townerId: string | null | undefined;\n\t/** Undefined when the surface doesn't apply the uploader rule. */\n\townerVerified?: boolean;\n\tcreatedAt?: Date | string | null;\n\t/** Null or undefined turns the uploader rule off. */\n\tlaunchAt?: Date | null;\n}\n\nexport function decideMediaGate(i: MediaGateInput): MediaGate {\n\tif (i.ownerId && i.viewerId && i.ownerId === i.viewerId) return 'sharp';\n\tif (!i.viewerVerified) return 'blur';\n\tif (i.launchAt && i.ownerVerified === false && i.createdAt) {\n\t\tconst at = new Date(i.createdAt);\n\t\tif (!Number.isNaN(at.getTime()) && at >= i.launchAt) return 'uploader';\n\t}\n\treturn 'sharp';\n}\n\n/** The error code a gated server action answers with; the client opens the\n *  sheet on it instead of showing an error. */\nexport const AGE_REQUIRED = 'age_required';\n"],"version":3}