"use client"; import { useEffect, useRef, useState } from "react"; import { dayPartAt, paletteFor, seasonAt, type DayPart, type Season } from "../../lib/palette"; import styles from "./world.module.css"; const DAY_PARTS: readonly DayPart[] = ["dawn", "day", "dusk", "night"]; const SEASONS: readonly Season[] = ["spring", "summer", "autumn", "winter"]; const TOWERS = [34, 52, 28, 70, 44, 86, 38, 58, 30, 64, 48, 76, 36, 54]; function attribute(name: string, allowed: readonly T[], clock: T): T { const value = document.documentElement.getAttribute(name); if (value === null) return clock; if (!allowed.includes(value as T)) throw new Error(`PixelWorld: unknown ${name} "${value}"`); return value as T; } function webglAvailable(): boolean { const gl = document.createElement("canvas").getContext("webgl2"); gl?.getExtension("WEBGL_lose_context")?.loseContext(); return gl !== null; } function Skyline() { return (