// Where a face, a list, a page or an editor finds the verbs and the definitions:// the environment, set once at the root of the interpreter's surfaces.importSwiftUI/// Every table definition the app knows, by id.publicstructTableDefinitions: Sendable {publicvar all: [TableDefinition]privatevar byID: [String: TableDefinition]/// False for the bundled set a window holds until the shown database's/// own catalogue is read (`AppTables.core`, `DatabaseTableCatalog`): a/// board read through it read tables the database may not have.publiclet isRead: Bool/// The definitions as read, as one number (this process's hash of them):/// what a picture of a page was drawn under (`PagePictures`), so one drawn/// under other definitions is drawn again. Nil before the read.publiclet stamp: Int?publicinit(_ all: [TableDefinition], read: Bool = true) {self.all = allself.byID = Dictionary(all.map { ($0.id, $0) }, uniquingKeysWith: { first, _ in first }) isRead = read stamp = read ? all.hashValue : nil }publicsubscript(_ id: String?) -> TableDefinition? {guardlet id else { returnnil }return byID[id] }/// The table playing `role` (`role`), the first of them; nil where none/// does.publicfunc playing(_ role: TableRole) -> TableDefinition? { all.first { $0.role == role } }}privatestructRecordsKey: EnvironmentKey {staticlet defaultValue: (any Records)? = nil}privatestructTableDefinitionsKey: EnvironmentKey {/// No definitions handed down yet is no answer: unread, so nothing/// refuses a table on it (`UnknownTable`).staticlet defaultValue = TableDefinitions([], read: false)}extensionEnvironmentValues {publicvar records: (any Records)? { get { self[RecordsKey.self] } set { self[RecordsKey.self] = newValue } }publicvar tableDefinitions: TableDefinitions { get { self[TableDefinitionsKey.self] } set { self[TableDefinitionsKey.self] = newValue } }}