import type { PathBuilderLike } from "path-ts"; import type { WOFRowRule } from "#adapters/wof/json-rows"; import type { WOFRecord } from "#utils"; /** * The key two spellings of one place name share: diacritics and case removed, ends trimmed. */ export declare function dualRoleKey(name: string): string; /** * One region or locality as the rule reads it. */ export interface DualRolePlace { id: number; name: string; placetype: string; country: string; /** * Ancestor ids, nearest first. */ ancestors: readonly number[]; latitude: number; longitude: number; /** * `[west, south, east, north]`, or `null` when the record states none. */ bbox: readonly [number, number, number, number] | null; population: number; } /** * The rule's view of a stored record: its label point, else its geometry point, else `0, 0`; * its `geom:bbox`; and `wof:population`, else `gn:population`, else 0. * * The gazetteer's admin build reads a record's point and population the same way. */ export declare function dualRolePlaceOf(record: WOFRecord, properties: Record): DualRolePlace; /** * Why a region's locality qualifies. */ export declare const DualRoleBasis: { readonly seat: "seat"; readonly largest: "largest"; }; export type DualRoleBasis = (typeof DualRoleBasis)[keyof typeof DualRoleBasis]; /** * A region and the same-name locality whose name it yields. */ export interface DualRolePair { regionID: number; localityID: number; country: string; name: string; basis: DualRoleBasis; } /** * The seats of the capitals reference, as `|` for each * entry's name and each of its keys. */ export type CapitalSeats = ReadonlySet; /** * The capitals reference `mailwoman gazetteer capitals` writes, from GeoNames' * national capitals and admin-1 seats. */ export declare function capitalsReferencePath(): string; /** * The seats {@linkcode capitalsReferencePath} lists. * * @throws When the file isn't a version 1 reference with entries, because an empty seat * set would qualify only the largest localities and look like a valid result. */ export declare function readCapitalSeats(path?: PathBuilderLike): Promise; /** * The qualifying pairs of `regions` and `localities`, which must hold every region * and locality the rule may pair. * * The regions are held, and the localities are read once, as they stream past. * * A region's largest locality is the one with the highest population that descends * from it, the lower id first on a tie. * A region whose localities state no population has no largest locality, so only a seat qualifies it. */ export declare function findDualRolePairs(regionPlaces: Iterable, localities: Iterable, seats: CapitalSeats): DualRolePair[]; /** * The row rule for `pairs`: drops bare ``, `, `, * and `, [, ]` rows whose region folds to a paired region's * name in that country without a `locality` beside it, and requires each paired * locality's canonical `, ` row. */ export declare function dualRoleRowRule(adapterID: string, pairs: readonly DualRolePair[]): WOFRowRule; //# sourceMappingURL=dual-role.d.ts.map