/* ── Emotion presets, fallback detection, sleeve gradients ──────────────── */ export interface EmotionPreset { label: string; descriptor: string; hue: number; chroma: number; gradient: [string, string]; tracks: { title: string; artist: string; album: string; year: number; duration: string; }[]; } export const EMOTIONS: Record = { melancholy: { label: "Melancholy", descriptor: "a slow, drifting heaviness", hue: 285, chroma: 0.16, gradient: ["oklch(0.42 0.16 290)", "oklch(0.28 0.12 270)"], tracks: [ { title: "Re: Stacks", artist: "Bon Iver", album: "For Emma, Forever Ago", year: 2008, duration: "6:41" }, { title: "Black", artist: "Pearl Jam", album: "Ten", year: 1991, duration: "5:43" }, { title: "Motion Picture Soundtrack", artist: "Radiohead", album: "Kid A", year: 2000, duration: "7:01" }, { title: "Liability", artist: "Lorde", album: "Melodrama", year: 2017, duration: "2:52" }, { title: "Pink Moon", artist: "Nick Drake", album: "Pink Moon", year: 1972, duration: "2:08" }, { title: "Holocene", artist: "Bon Iver", album: "Bon Iver", year: 2011, duration: "5:36" }, { title: "The Night We Met", artist: "Lord Huron", album: "Strange Trails", year: 2015, duration: "3:28" }, { title: "Videotape", artist: "Radiohead", album: "In Rainbows", year: 2007, duration: "4:39" }, { title: "Skinny Love", artist: "Bon Iver", album: "For Emma, Forever Ago", year: 2007, duration: "3:58" }, { title: "I Will Follow You into the Dark", artist: "Death Cab for Cutie", album: "Plans", year: 2005, duration: "3:09" }, ], }, euphoric: { label: "Euphoric", descriptor: "a bright, unrestrained lift", hue: 45, chroma: 0.18, gradient: ["oklch(0.78 0.18 60)", "oklch(0.62 0.20 25)"], tracks: [ { title: "Dog Days Are Over", artist: "Florence + The Machine", album: "Lungs", year: 2008, duration: "4:13" }, { title: "Heroes", artist: "David Bowie", album: "Heroes", year: 1977, duration: "6:07" }, { title: "電球 (Lightbulb)", artist: "tricot", album: "AND", year: 2015, duration: "4:14" }, { title: "Sweet Disposition", artist: "The Temper Trap", album: "Conditions", year: 2009, duration: "3:53" }, { title: "Pursuit of Happiness", artist: "Kid Cudi", album: "Man on the Moon", year: 2009, duration: "4:53" }, { title: "Two Weeks", artist: "Grizzly Bear", album: "Veckatimest", year: 2009, duration: "4:03" }, { title: "Solar Power", artist: "Lorde", album: "Solar Power", year: 2021, duration: "3:12" }, { title: "Cherry-coloured Funk", artist: "Cocteau Twins", album: "Heaven or Las Vegas", year: 1990, duration: "3:13" }, { title: "Electric Feel", artist: "MGMT", album: "Oracular Spectacular", year: 2007, duration: "3:49" }, { title: "Float On", artist: "Modest Mouse", album: "Good News for People Who Love Bad News", year: 2004, duration: "3:28" }, ], }, anxious: { label: "Anxious", descriptor: "a tight, restless current", hue: 220, chroma: 0.12, gradient: ["oklch(0.55 0.14 230)", "oklch(0.32 0.10 250)"], tracks: [ { title: "Idioteque", artist: "Radiohead", album: "Kid A", year: 2000, duration: "5:09" }, { title: "Heads Will Roll", artist: "Yeah Yeah Yeahs", album: "It's Blitz!", year: 2009, duration: "3:42" }, { title: "Where Is My Mind?", artist: "Pixies", album: "Surfer Rosa", year: 1988, duration: "3:53" }, { title: "Climbing Up the Walls", artist: "Radiohead", album: "OK Computer", year: 1997, duration: "4:45" }, { title: "Take Me Out", artist: "Franz Ferdinand", album: "Franz Ferdinand", year: 2004, duration: "3:57" }, { title: "Stress", artist: "Justice", album: "✝", year: 2007, duration: "5:00" }, { title: "Black Skinhead", artist: "Kanye West", album: "Yeezus", year: 2013, duration: "3:08" }, { title: "Bodysnatchers", artist: "Radiohead", album: "In Rainbows", year: 2007, duration: "4:02" }, { title: "Maps", artist: "Yeah Yeah Yeahs", album: "Fever to Tell", year: 2003, duration: "3:39" }, { title: "Reptilia", artist: "The Strokes", album: "Room on Fire", year: 2003, duration: "3:38" }, ], }, lonely: { label: "Lonely", descriptor: "rooms emptier than they should be", hue: 250, chroma: 0.10, gradient: ["oklch(0.40 0.12 260)", "oklch(0.22 0.08 250)"], tracks: [ { title: "Asleep", artist: "The Smiths", album: "The World Won't Listen", year: 1985, duration: "4:08" }, { title: "Famous Blue Raincoat", artist: "Leonard Cohen", album: "Songs of Love and Hate", year: 1971, duration: "5:13" }, { title: "Nikes", artist: "Frank Ocean", album: "Blonde", year: 2016, duration: "5:14" }, { title: "Lua", artist: "Bright Eyes", album: "I'm Wide Awake, It's Morning", year: 2005, duration: "4:32" }, { title: "All Apologies", artist: "Nirvana", album: "In Utero", year: 1993, duration: "3:51" }, { title: "Nude", artist: "Radiohead", album: "In Rainbows", year: 2007, duration: "4:15" }, { title: "Mykonos", artist: "Fleet Foxes", album: "Sun Giant EP", year: 2008, duration: "4:33" }, { title: "How to Disappear Completely", artist: "Radiohead", album: "Kid A", year: 2000, duration: "5:56" }, { title: "Self Control", artist: "Frank Ocean", album: "Blonde", year: 2016, duration: "4:09" }, { title: "Roslyn", artist: "Bon Iver & St. Vincent", album: "Single", year: 2009, duration: "3:54" }, ], }, nostalgic: { label: "Nostalgic", descriptor: "an ache for what isn't there anymore", hue: 60, chroma: 0.13, gradient: ["oklch(0.62 0.13 70)", "oklch(0.38 0.10 50)"], tracks: [ { title: "Landslide", artist: "Fleetwood Mac", album: "Fleetwood Mac", year: 1975, duration: "3:19" }, { title: "Coney Island Baby", artist: "Tom Waits", album: "Blood Money", year: 2002, duration: "3:46" }, { title: "These Days", artist: "Nico", album: "Chelsea Girl", year: 1967, duration: "3:30" }, { title: "America", artist: "Simon & Garfunkel", album: "Bookends", year: 1968, duration: "3:34" }, { title: "Heart of Gold", artist: "Neil Young", album: "Harvest", year: 1972, duration: "3:07" }, { title: "Vincent", artist: "Don McLean", album: "American Pie", year: 1971, duration: "3:58" }, { title: "Both Sides Now", artist: "Joni Mitchell", album: "Clouds", year: 1969, duration: "4:34" }, { title: "Old Friends", artist: "Simon & Garfunkel", album: "Bookends", year: 1968, duration: "2:36" }, { title: "Famous Blue Raincoat", artist: "Leonard Cohen", album: "Songs of Love and Hate", year: 1971, duration: "5:13" }, { title: "Wichita Lineman", artist: "Glen Campbell", album: "Wichita Lineman", year: 1968, duration: "3:04" }, ], }, yearning: { label: "Yearning", descriptor: "wanting something just out of reach", hue: 330, chroma: 0.17, gradient: ["oklch(0.62 0.17 340)", "oklch(0.40 0.14 310)"], tracks: [ { title: "Wild Horses", artist: "The Rolling Stones", album: "Sticky Fingers", year: 1971, duration: "5:43" }, { title: "Pyramids", artist: "Frank Ocean", album: "Channel Orange", year: 2012, duration: "9:53" }, { title: "Nothing Compares 2 U", artist: "Sinéad O'Connor", album: "I Do Not Want What I Haven't Got", year: 1990, duration: "5:08" }, { title: "Crimson and Clover", artist: "Tommy James and the Shondells", album: "Crimson & Clover", year: 1968, duration: "5:31" }, { title: "I Want You", artist: "Mitski", album: "Bury Me at Makeout Creek", year: 2014, duration: "2:53" }, { title: "Cherry Wine", artist: "Hozier", album: "Hozier", year: 2014, duration: "4:01" }, { title: "First Love / Late Spring", artist: "Mitski", album: "Bury Me at Makeout Creek", year: 2014, duration: "4:42" }, { title: "Cellophane", artist: "FKA twigs", album: "Magdalene", year: 2019, duration: "3:40" }, { title: "Sea of Love", artist: "Cat Power", album: "The Greatest", year: 2006, duration: "2:21" }, { title: "Lover, You Should've Come Over", artist: "Jeff Buckley", album: "Grace", year: 1994, duration: "6:43" }, ], }, peaceful: { label: "Peaceful", descriptor: "a quiet settled in", hue: 160, chroma: 0.09, gradient: ["oklch(0.62 0.10 170)", "oklch(0.38 0.08 180)"], tracks: [ { title: "Weightless", artist: "Marconi Union", album: "Weightless", year: 2011, duration: "8:08" }, { title: "Gymnopédie No.1", artist: "Erik Satie", album: "Gymnopédies", year: 1888, duration: "3:11" }, { title: "An Ending (Ascent)", artist: "Brian Eno", album: "Apollo", year: 1983, duration: "4:19" }, { title: "Avril 14th", artist: "Aphex Twin", album: "Drukqs", year: 2001, duration: "2:05" }, { title: "Saturday Sun", artist: "Nick Drake", album: "Five Leaves Left", year: 1969, duration: "4:01" }, { title: "Spiegel im Spiegel", artist: "Arvo Pärt", album: "Alina", year: 1978, duration: "9:23" }, { title: "Re: Person I Knew", artist: "Bill Evans Trio", album: "Sunday at the Village Vanguard", year: 1961, duration: "5:00" }, { title: "Saudade Vem Correndo", artist: "Stan Getz", album: "Jazz Samba Encore!", year: 1963, duration: "5:30" }, { title: "Harvest Moon", artist: "Neil Young", album: "Harvest Moon", year: 1992, duration: "5:03" }, { title: "Stars of the Lid", artist: "Stars of the Lid", album: "The Tired Sounds Of", year: 2001, duration: "8:14" }, ], }, defiant: { label: "Defiant", descriptor: "teeth set against the world", hue: 15, chroma: 0.20, gradient: ["oklch(0.62 0.20 20)", "oklch(0.38 0.16 0)"], tracks: [ { title: "Killing in the Name", artist: "Rage Against the Machine", album: "Rage Against the Machine", year: 1992, duration: "5:14" }, { title: "Seven Nation Army", artist: "The White Stripes", album: "Elephant", year: 2003, duration: "3:51" }, { title: "Smells Like Teen Spirit", artist: "Nirvana", album: "Nevermind", year: 1991, duration: "5:01" }, { title: "Song 2", artist: "Blur", album: "Blur", year: 1997, duration: "2:02" }, { title: "My Hero", artist: "Foo Fighters", album: "The Colour and the Shape", year: 1997, duration: "4:20" }, { title: "Bulls on Parade", artist: "Rage Against the Machine", album: "Evil Empire", year: 1996, duration: "3:51" }, { title: "Lithium", artist: "Nirvana", album: "Nevermind", year: 1991, duration: "4:17" }, { title: "Bombtrack", artist: "Rage Against the Machine", album: "Rage Against the Machine", year: 1992, duration: "4:04" }, { title: "Bodies", artist: "Sex Pistols", album: "Never Mind the Bollocks", year: 1977, duration: "3:03" }, { title: "Search and Destroy", artist: "The Stooges", album: "Raw Power", year: 1973, duration: "3:30" }, ], }, }; export const EXAMPLE_PROMPTS = [ "I can't stop smiling", "Lying awake at 3am", "Driving with the windows down", "It still hurts to say her name", ]; /** * Maps backend DeBERTa emotion labels → New Frontend emotion keys. * Backend: joy, love, sadness, anger, fear, surprise, neutral, sarcasm * Frontend: melancholy, euphoric, anxious, lonely, nostalgic, yearning, peaceful, defiant */ export const BACKEND_EMOTION_MAP: Record = { joy: "euphoric", love: "yearning", sadness: "melancholy", anger: "defiant", fear: "anxious", surprise: "euphoric", neutral: "peaceful", sarcasm: "defiant", }; /** * Generative album-art gradient — seeded by track title so it's stable per render. */ export function sleeveGradient(seed: string, baseHue: number) { let h = 0; for (let i = 0; i < seed.length; i++) h = (h * 31 + seed.charCodeAt(i)) >>> 0; const hue1 = (baseHue + (h % 60) - 30 + 360) % 360; const hue2 = (hue1 + 40 + ((h >> 8) % 60)) % 360; const l1 = 0.45 + ((h >> 16) % 25) / 100; const l2 = 0.22 + ((h >> 20) % 18) / 100; const c = 0.12 + ((h >> 24) % 8) / 100; const angle = (h >> 12) % 360; return { background: `linear-gradient(${angle}deg, oklch(${l1} ${c} ${hue1}) 0%, oklch(${l2} ${c * 0.9} ${hue2}) 100%)`, glyph: String.fromCharCode(65 + (h % 26)), }; }