export type MouseEvent = { button: number; x: number; y: number; press: boolean; motion: boolean } /** Ink strips the first escape; retain partial SGR reports across input chunks. */ export class MouseInput { private pending = "" read(input: string): MouseEvent[] | null { if (!this.pending && !/^(?:\x1b)?\[ 0 && y > 0) events.push({ button: raw & ~60, x, y, press: match[4] === "M", motion: (raw & 32) !== 0 }) rest = rest.slice(match[0].length) } return events } }