import type { DateNumber, Trip } from "@gb-transit/gtfs-loader"; import type { Network } from "./Network.js"; /** * Which trips run on which date, as a bit per trip per day. * * The scan checks this for every trip it considers, so the calendar is resolved up front rather * than evaluated during a query: the day of week, the date range and the exceptions are all folded * into the bit while the timetable is being built. * * Days are stored one after another, so the trips of a route sit next to each other within a day * and the check is a single byte read. */ export declare function createTripCalendar(trips: Trip[], startDate: DateNumber, endDate: DateNumber): TripCalendar; /** * The period a feed covers, taken from feed_info where it gives one. * * Both dates are optional and independent in GTFS, so a feed may give only the end of its period. * Anchoring the default length on whichever date it does give keeps the window over the feed * rather than over today. */ export declare function getCalendarWindow(startDate?: DateNumber, endDate?: DateNumber): [DateNumber, DateNumber]; /** * Byte offset of a date's slice of runs, or NOT_COVERED if the calendar does not reach it */ export declare function dayOffset(calendar: TripCalendar, date: DateNumber): number; /** * Returned by dayOffset for a date outside the period the calendar covers */ export declare const NOT_COVERED = -1; /** * Reject a date the timetable has no calendar for, rather than quietly finding nothing */ export declare function checkCovered(network: Network, date: DateNumber): void; export interface TripCalendar { /** First date the calendar covers */ startDate: DateNumber; /** Last date the calendar covers */ endDate: DateNumber; /** Bytes per day, which is one bit per trip rounded up */ stride: number; /** Day major bit per trip: runs[day * stride + (trip >> 3)] & (1 << (trip & 7)) */ runs: Uint8Array; }