| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | * |
| 7 | * @flow |
| 8 | */ |
| 9 | |
| 10 | /* eslint-disable */ |
| 11 | |
| 12 | declare const __PROFILE__: boolean; |
| 13 | declare const __EXPERIMENTAL__: boolean; |
| 14 | declare const __VARIANT__: boolean; |
| 15 | |
| 16 | declare const __REACT_DEVTOOLS_GLOBAL_HOOK__: any; /*?{ |
| 17 | inject: ?((stuff: Object) => void) |
| 18 | };*/ |
| 19 | |
| 20 | declare const reportError: (error: mixed) => void; |
| 21 | |
| 22 | declare module 'create-react-class' { |
| 23 | declare const exports: $FlowFixMe; |
| 24 | } |
| 25 | |
| 26 | declare interface ConsoleTask { |
| 27 | run<T>(f: () => T): T; |
| 28 | } |
| 29 | |
| 30 | // $FlowFixMe[libdef-override] |
| 31 | declare var console: { |
| 32 | assert(condition: mixed, ...data: Array<any>): void, |
| 33 | clear(): void, |
| 34 | count(label?: string): void, |
| 35 | countReset(label?: string): void, |
| 36 | debug(...data: Array<any>): void, |
| 37 | dir(...data: Array<any>): void, |
| 38 | dirxml(...data: Array<any>): void, |
| 39 | error(...data: Array<any>): void, |
| 40 | _exception(...data: Array<any>): void, |
| 41 | group(...data: Array<any>): void, |
| 42 | groupCollapsed(...data: Array<any>): void, |
| 43 | groupEnd(): void, |
| 44 | info(...data: Array<any>): void, |
| 45 | log(...data: Array<any>): void, |
| 46 | profile(name?: string): void, |
| 47 | profileEnd(name?: string): void, |
| 48 | table( |
| 49 | tabularData: |
| 50 | | {[key: string]: any, ...} |
| 51 | | Array<{[key: string]: any, ...}> |
| 52 | | Array<Array<any>>, |
| 53 | ): void, |
| 54 | time(label?: string): void, |
| 55 | timeEnd(label: string): void, |
| 56 | timeStamp( |
| 57 | label?: string, |
| 58 | start?: string | number, |
| 59 | end?: string | number, |
| 60 | trackName?: string, |
| 61 | trackGroup?: string, |
| 62 | color?: string, |
| 63 | ): void, |
| 64 | timeLog(label?: string, ...data?: Array<any>): void, |
| 65 | trace(...data: Array<any>): void, |
| 66 | warn(...data: Array<any>): void, |
| 67 | createTask(label: string): ConsoleTask, |
| 68 | ... |
| 69 | }; |
| 70 | |
| 71 | type ScrollTimelineOptions = { |
| 72 | source: Element, |
| 73 | axis?: 'block' | 'inline' | 'x' | 'y', |
| 74 | ... |
| 75 | }; |
| 76 | |
| 77 | declare class ScrollTimeline extends AnimationTimeline { |
| 78 | constructor(options?: ScrollTimelineOptions): void; |
| 79 | axis: 'block' | 'inline' | 'x' | 'y'; |
| 80 | source: Element; |
| 81 | } |
| 82 | |
| 83 | // Flow hides the props of React$Element, this overrides it to unhide |
| 84 | // them for React internals. |
| 85 | // $FlowFixMe[libdef-override] |
| 86 | declare opaque type React$Element< |
| 87 | +ElementType: React$ElementType, |
| 88 | +P = React$ElementConfig<ElementType>, |
| 89 | >: { |
| 90 | +type: ElementType, |
| 91 | +props: P, |
| 92 | +key: React$Key | null, |
| 93 | +ref: any, |
| 94 | }; |
| 95 | |
| 96 | declare type React$CustomJSXFactory = any; |
| 97 | |
| 98 | declare const trustedTypes: { |
| 99 | isHTML: (value: any) => boolean, |
| 100 | isScript: (value: any) => boolean, |
| 101 | isScriptURL: (value: any) => boolean, |
| 102 | // TrustedURLs are deprecated and will be removed soon: https://github.com/WICG/trusted-types/pull/204 |
| 103 | isURL?: (value: any) => boolean, |
| 104 | }; |
| 105 | |
| 106 | // ReactFeatureFlags www fork |
| 107 | declare module 'ReactFeatureFlags' { |
| 108 | declare module.exports: any; |
| 109 | } |
| 110 | |
| 111 | // ReactFiberErrorDialog www fork |
| 112 | declare module 'ReactFiberErrorDialog' { |
| 113 | declare module.exports: {showErrorDialog: (error: mixed) => boolean, ...}; |
| 114 | } |
| 115 | |
| 116 | // EventListener www fork |
| 117 | declare module 'EventListener' { |
| 118 | declare module.exports: { |
| 119 | listen: ( |
| 120 | target: EventTarget, |
| 121 | type: string, |
| 122 | callback: Function, |
| 123 | priority?: number, |
| 124 | options?: {passive: boolean, ...}, |
| 125 | ) => mixed, |
| 126 | capture: (target: EventTarget, type: string, callback: Function) => mixed, |
| 127 | captureWithPassiveFlag: ( |
| 128 | target: EventTarget, |
| 129 | type: string, |
| 130 | callback: Function, |
| 131 | passive: boolean, |
| 132 | ) => mixed, |
| 133 | bubbleWithPassiveFlag: ( |
| 134 | target: EventTarget, |
| 135 | type: string, |
| 136 | callback: Function, |
| 137 | passive: boolean, |
| 138 | ) => mixed, |
| 139 | ... |
| 140 | }; |
| 141 | } |
| 142 | |
| 143 | declare function __webpack_chunk_load__(id: string): Promise<mixed>; |
| 144 | declare function __webpack_get_script_filename__(id: string): string; |
| 145 | declare const __webpack_require__: ((id: string) => any) & { |
| 146 | u: string => string, |
| 147 | }; |
| 148 | |
| 149 | // A chunk id is a plain filename, or a merged chunk emitted as |
| 150 | // `[mergedChunkFilename, componentChunkFilenames, componentChunkSizes]`. |
| 151 | declare function __turbopack_load_by_url__( |
| 152 | id: string | [string, Array<string>, Array<number>], |
| 153 | ): Promise<mixed>; |
| 154 | declare const __turbopack_require__: ((id: string) => any) & { |
| 155 | u: string => string, |
| 156 | }; |
| 157 | |
| 158 | declare var parcelRequire: { |
| 159 | (id: string): any, |
| 160 | load: (url: string) => Promise<mixed>, |
| 161 | extendImportMap: (importMap: {[string]: string}) => void, |
| 162 | meta: { |
| 163 | publicUrl: string, |
| 164 | devServer: string | null, |
| 165 | }, |
| 166 | }; |
| 167 | |
| 168 | declare module 'pg' { |
| 169 | declare const Pool: (options: mixed) => { |
| 170 | query: (query: string, values?: Array<mixed>) => void, |
| 171 | }; |
| 172 | } |
| 173 | |
| 174 | declare module 'busboy' { |
| 175 | import type {Writable, Readable} from 'stream'; |
| 176 | |
| 177 | declare interface Info { |
| 178 | encoding: string; |
| 179 | mimeType: string; |
| 180 | } |
| 181 | |
| 182 | declare interface FileInfo extends Info { |
| 183 | filename: string; |
| 184 | } |
| 185 | |
| 186 | declare interface FieldInfo extends Info { |
| 187 | nameTruncated: boolean; |
| 188 | valueTruncated: boolean; |
| 189 | } |
| 190 | |
| 191 | declare interface BusboyEvents { |
| 192 | file: (name: string, stream: Readable, info: FileInfo) => void; |
| 193 | field: (name: string, value: string, info: FieldInfo) => void; |
| 194 | partsLimit: () => void; |
| 195 | filesLimit: () => void; |
| 196 | fieldsLimit: () => void; |
| 197 | error: (error: mixed) => void; |
| 198 | close: () => void; |
| 199 | } |
| 200 | declare interface Busboy extends Writable { |
| 201 | addListener<Event: $Keys<BusboyEvents>>( |
| 202 | event: Event, |
| 203 | listener: BusboyEvents[Event], |
| 204 | ): this; |
| 205 | addListener(event: string, listener: Function): this; |
| 206 | |
| 207 | on<Event: $Keys<BusboyEvents>>( |
| 208 | event: Event, |
| 209 | listener: BusboyEvents[Event], |
| 210 | ): this; |
| 211 | on(event: string, listener: Function): this; |
| 212 | |
| 213 | once<Event: $Keys<BusboyEvents>>( |
| 214 | event: Event, |
| 215 | listener: BusboyEvents[Event], |
| 216 | ): this; |
| 217 | once(event: string, listener: Function): this; |
| 218 | |
| 219 | removeListener<Event: $Keys<BusboyEvents>>( |
| 220 | event: Event, |
| 221 | listener: BusboyEvents[Event], |
| 222 | ): this; |
| 223 | removeListener(event: string, listener: Function): this; |
| 224 | |
| 225 | off<Event: $Keys<BusboyEvents>>( |
| 226 | event: Event, |
| 227 | listener: BusboyEvents[Event], |
| 228 | ): this; |
| 229 | off(event: string, listener: Function): this; |
| 230 | |
| 231 | prependListener<Event: $Keys<BusboyEvents>>( |
| 232 | event: Event, |
| 233 | listener: BusboyEvents[Event], |
| 234 | ): this; |
| 235 | prependListener(event: string, listener: Function): this; |
| 236 | |
| 237 | prependOnceListener<Event: $Keys<BusboyEvents>>( |
| 238 | event: Event, |
| 239 | listener: BusboyEvents[Event], |
| 240 | ): this; |
| 241 | prependOnceListener(event: string, listener: Function): this; |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | declare module 'pg/lib/utils' { |
| 246 | declare module.exports: { |
| 247 | prepareValue(val: any): mixed, |
| 248 | }; |
| 249 | } |
| 250 | |
| 251 | // Node |
| 252 | declare module 'async_hooks' { |
| 253 | declare class AsyncLocalStorage<T> { |
| 254 | disable(): void; |
| 255 | getStore(): T | void; |
| 256 | run<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R; |
| 257 | enterWith(store: T): void; |
| 258 | } |
| 259 | declare class AsyncResource { |
| 260 | asyncId(): number; |
| 261 | } |
| 262 | declare function executionAsyncId(): number; |
| 263 | declare function executionAsyncResource(): AsyncResource; |
| 264 | declare function triggerAsyncId(): number; |
| 265 | declare type HookCallbacks = { |
| 266 | init?: ( |
| 267 | asyncId: number, |
| 268 | type: string, |
| 269 | triggerAsyncId: number, |
| 270 | resource: AsyncResource, |
| 271 | ) => void, |
| 272 | before?: (asyncId: number) => void, |
| 273 | after?: (asyncId: number) => void, |
| 274 | promiseResolve?: (asyncId: number) => void, |
| 275 | destroy?: (asyncId: number) => void, |
| 276 | }; |
| 277 | declare class AsyncHook { |
| 278 | enable(): this; |
| 279 | disable(): this; |
| 280 | } |
| 281 | declare function createHook(callbacks: HookCallbacks): AsyncHook; |
| 282 | } |
| 283 | |
| 284 | // Edge |
| 285 | declare class AsyncLocalStorage<T> { |
| 286 | disable(): void; |
| 287 | getStore(): T | void; |
| 288 | run<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R; |
| 289 | enterWith(store: T): void; |
| 290 | } |
| 291 | |
| 292 | declare const async_hooks: { |
| 293 | createHook(callbacks: any): any, |
| 294 | executionAsyncId(): number, |
| 295 | }; |
| 296 | |
| 297 | declare module 'jest-diff' { |
| 298 | declare type CompareKeys = ((a: string, b: string) => number) | void; |
| 299 | declare type DiffOptions = { |
| 300 | aAnnotation?: string, |
| 301 | aColor?: (arg: string) => string, |
| 302 | aIndicator?: string, |
| 303 | bAnnotation?: string, |
| 304 | bColor?: (arg: string) => string, |
| 305 | bIndicator?: string, |
| 306 | changeColor?: (arg: string) => string, |
| 307 | changeLineTrailingSpaceColor?: (arg: string) => string, |
| 308 | commonColor?: (arg: string) => string, |
| 309 | commonIndicator?: string, |
| 310 | commonLineTrailingSpaceColor?: (arg: string) => string, |
| 311 | contextLines?: number, |
| 312 | emptyFirstOrLastLinePlaceholder?: string, |
| 313 | expand?: boolean, |
| 314 | includeChangeCounts?: boolean, |
| 315 | omitAnnotationLines?: boolean, |
| 316 | patchColor?: (arg: string) => string, |
| 317 | compareKeys?: CompareKeys, |
| 318 | }; |
| 319 | declare function diff(a: any, b: any, options?: DiffOptions): string; |
| 320 | } |
| 321 | |
| 322 | declare const Bun: { |
| 323 | hash( |
| 324 | input: string | $TypedArray | DataView | ArrayBuffer | SharedArrayBuffer, |
| 325 | ): number, |
| 326 | }; |
| 327 | |
| 328 | // Navigation API |
| 329 | |
| 330 | declare const navigation: Navigation; |
| 331 | |
| 332 | interface NavigationResult { |
| 333 | committed: Promise<NavigationHistoryEntry>; |
| 334 | finished: Promise<NavigationHistoryEntry>; |
| 335 | } |
| 336 | |
| 337 | declare class Navigation extends EventTarget { |
| 338 | entries(): NavigationHistoryEntry[]; |
| 339 | +currentEntry: NavigationHistoryEntry | null; |
| 340 | updateCurrentEntry(options: NavigationUpdateCurrentEntryOptions): void; |
| 341 | +transition: NavigationTransition | null; |
| 342 | |
| 343 | +canGoBack: boolean; |
| 344 | +canGoForward: boolean; |
| 345 | |
| 346 | navigate(url: string, options?: NavigationNavigateOptions): NavigationResult; |
| 347 | reload(options?: NavigationReloadOptions): NavigationResult; |
| 348 | |
| 349 | traverseTo(key: string, options?: NavigationOptions): NavigationResult; |
| 350 | back(options?: NavigationOptions): NavigationResult; |
| 351 | forward(options?: NavigationOptions): NavigationResult; |
| 352 | |
| 353 | onnavigate: ((this: Navigation, ev: NavigateEvent) => any) | null; |
| 354 | onnavigatesuccess: ((this: Navigation, ev: Event) => any) | null; |
| 355 | onnavigateerror: ((this: Navigation, ev: ErrorEvent) => any) | null; |
| 356 | oncurrententrychange: |
| 357 | | ((this: Navigation, ev: NavigationCurrentEntryChangeEvent) => any) |
| 358 | | null; |
| 359 | |
| 360 | // TODO: Implement addEventListener overrides. Doesn't seem like Flow supports this. |
| 361 | } |
| 362 | |
| 363 | declare class NavigationTransition { |
| 364 | +navigationType: NavigationTypeString; |
| 365 | +from: NavigationHistoryEntry; |
| 366 | +finished: Promise<void>; |
| 367 | } |
| 368 | |
| 369 | interface NavigationHistoryEntryEventMap { |
| 370 | dispose: Event; |
| 371 | } |
| 372 | |
| 373 | interface NavigationHistoryEntry extends EventTarget { |
| 374 | +key: string; |
| 375 | +id: string; |
| 376 | +url: string | null; |
| 377 | +index: number; |
| 378 | +sameDocument: boolean; |
| 379 | |
| 380 | getState(): mixed; |
| 381 | |
| 382 | ondispose: ((this: NavigationHistoryEntry, ev: Event) => any) | null; |
| 383 | |
| 384 | // TODO: Implement addEventListener overrides. Doesn't seem like Flow supports this. |
| 385 | } |
| 386 | |
| 387 | declare var NavigationHistoryEntry: { |
| 388 | prototype: NavigationHistoryEntry, |
| 389 | new(): NavigationHistoryEntry, |
| 390 | }; |
| 391 | |
| 392 | type NavigationTypeString = 'reload' | 'push' | 'replace' | 'traverse'; |
| 393 | |
| 394 | interface NavigationUpdateCurrentEntryOptions { |
| 395 | state: mixed; |
| 396 | } |
| 397 | |
| 398 | interface NavigationOptions { |
| 399 | info?: mixed; |
| 400 | } |
| 401 | |
| 402 | interface NavigationNavigateOptions extends NavigationOptions { |
| 403 | state?: mixed; |
| 404 | history?: 'auto' | 'push' | 'replace'; |
| 405 | } |
| 406 | |
| 407 | interface NavigationReloadOptions extends NavigationOptions { |
| 408 | state?: mixed; |
| 409 | } |
| 410 | |
| 411 | declare class NavigationCurrentEntryChangeEvent extends Event { |
| 412 | constructor(type: string, eventInit?: any): void; |
| 413 | |
| 414 | +navigationType: NavigationTypeString | null; |
| 415 | +from: NavigationHistoryEntry; |
| 416 | } |
| 417 | |
| 418 | declare class NavigateEvent extends Event { |
| 419 | constructor(type: string, eventInit?: any): void; |
| 420 | |
| 421 | +navigationType: NavigationTypeString; |
| 422 | +canIntercept: boolean; |
| 423 | +userInitiated: boolean; |
| 424 | +hashChange: boolean; |
| 425 | +hasUAVisualTransition: boolean; |
| 426 | +destination: NavigationDestination; |
| 427 | +signal: AbortSignal; |
| 428 | +formData: FormData | null; |
| 429 | +downloadRequest: string | null; |
| 430 | +info?: mixed; |
| 431 | |
| 432 | intercept(options?: NavigationInterceptOptions): void; |
| 433 | scroll(): void; |
| 434 | } |
| 435 | |
| 436 | interface NavigationInterceptOptions { |
| 437 | handler?: () => Promise<void>; |
| 438 | focusReset?: 'after-transition' | 'manual'; |
| 439 | scroll?: 'after-transition' | 'manual'; |
| 440 | } |
| 441 | |
| 442 | declare class NavigationDestination { |
| 443 | +url: string; |
| 444 | +key: string | null; |
| 445 | +id: string | null; |
| 446 | +index: number; |
| 447 | +sameDocument: boolean; |
| 448 | |
| 449 | getState(): mixed; |
| 450 | } |
| 451 | |
| 452 | // Ported from definitely-typed |
| 453 | declare module 'rbush' { |
| 454 | declare interface BBox { |
| 455 | minX: number; |
| 456 | minY: number; |
| 457 | maxX: number; |
| 458 | maxY: number; |
| 459 | } |
| 460 | |
| 461 | declare export default class RBush<T> { |
| 462 | /** |
| 463 | * Constructs an `RBush`, a high-performance 2D spatial index for points and |
| 464 | * rectangles. Based on an optimized __R-tree__ data structure with |
| 465 | * __bulk-insertion__ support. |
| 466 | * |
| 467 | * @param maxEntries An optional argument to RBush defines the maximum |
| 468 | * number of entries in a tree node. `9` (used by default) |
| 469 | * is a reasonable choice for most applications. Higher |
| 470 | * value means faster insertion and slower search, and |
| 471 | * vice versa. |
| 472 | */ |
| 473 | constructor(maxEntries?: number): void; |
| 474 | |
| 475 | /** |
| 476 | * Inserts an item. To insert many items at once, use `load()`. |
| 477 | * |
| 478 | * @param item The item to insert. |
| 479 | */ |
| 480 | insert(item: T): RBush<T>; |
| 481 | |
| 482 | /** |
| 483 | * Bulk-inserts the given items into the tree. |
| 484 | * |
| 485 | * Bulk insertion is usually ~2-3 times faster than inserting items one by |
| 486 | * one. After bulk loading (bulk insertion into an empty tree), subsequent |
| 487 | * query performance is also ~20-30% better. |
| 488 | * |
| 489 | * Note that when you do bulk insertion into an existing tree, it bulk-loads |
| 490 | * the given data into a separate tree and inserts the smaller tree into the |
| 491 | * larger tree. This means that bulk insertion works very well for clustered |
| 492 | * data (where items in one update are close to each other), but makes query |
| 493 | * performance worse if the data is scattered. |
| 494 | * |
| 495 | * @param items The items to load. |
| 496 | */ |
| 497 | load(items: $ReadOnlyArray<T>): RBush<T>; |
| 498 | |
| 499 | /** |
| 500 | * Removes a previously inserted item, comparing by reference. |
| 501 | * |
| 502 | * To remove all items, use `clear()`. |
| 503 | * |
| 504 | * @param item The item to remove. |
| 505 | * @param equals A custom function that allows comparing by value instead. |
| 506 | * Useful when you have only a copy of the object you need |
| 507 | * removed (e.g. loaded from server). |
| 508 | */ |
| 509 | remove(item: T, equals?: (a: T, b: T) => boolean): RBush<T>; |
| 510 | |
| 511 | /** |
| 512 | * Removes all items. |
| 513 | */ |
| 514 | clear(): RBush<T>; |
| 515 | |
| 516 | /** |
| 517 | * Returns an array of data items (points or rectangles) that the given |
| 518 | * bounding box intersects. |
| 519 | * |
| 520 | * Note that the search method accepts a bounding box in `{minX, minY, maxX, |
| 521 | * maxY}` format regardless of the data format. |
| 522 | * |
| 523 | * @param box The bounding box in which to search. |
| 524 | */ |
| 525 | search(box: BBox): T[]; |
| 526 | |
| 527 | /** |
| 528 | * Returns all items contained in the tree. |
| 529 | */ |
| 530 | all(): T[]; |
| 531 | |
| 532 | /** |
| 533 | * Returns `true` if there are any items intersecting the given bounding |
| 534 | * box, otherwise `false`. |
| 535 | * |
| 536 | * @param box The bounding box in which to search. |
| 537 | */ |
| 538 | collides(box: BBox): boolean; |
| 539 | |
| 540 | /** |
| 541 | * Returns the bounding box for the provided item. |
| 542 | * |
| 543 | * By default, `RBush` assumes the format of data points to be an object |
| 544 | * with `minX`, `minY`, `maxX`, and `maxY`. However, you can specify a |
| 545 | * custom item format by overriding `toBBox()`, `compareMinX()`, and |
| 546 | * `compareMinY()`. |
| 547 | * |
| 548 | * @example |
| 549 | * class MyRBush<T> extends RBush<T> { |
| 550 | * toBBox([x, y]) { return { minX: x, minY: y, maxX: x, maxY: y }; } |
| 551 | * compareMinX(a, b) { return a.x - b.x; } |
| 552 | * compareMinY(a, b) { return a.y - b.y; } |
| 553 | * } |
| 554 | * const tree = new MyRBush<[number, number]>(); |
| 555 | * tree.insert([20, 50]); // accepts [x, y] points |
| 556 | * |
| 557 | * @param item The item whose bounding box should be returned. |
| 558 | */ |
| 559 | toBBox(item: T): BBox; |
| 560 | |
| 561 | /** |
| 562 | * Compares the minimum x coordinate of two items. Returns -1 if `a`'s |
| 563 | * x-coordinate is smaller, 1 if `b`'s x coordinate is smaller, or 0 if |
| 564 | * they're equal. |
| 565 | * |
| 566 | * By default, `RBush` assumes the format of data points to be an object |
| 567 | * with `minX`, `minY`, `maxX`, and `maxY`. However, you can specify a |
| 568 | * custom item format by overriding `toBBox()`, `compareMinX()`, and |
| 569 | * `compareMinY()`. |
| 570 | * |
| 571 | * @example |
| 572 | * class MyRBush<T> extends RBush<T> { |
| 573 | * toBBox([x, y]) { return { minX: x, minY: y, maxX: x, maxY: y }; } |
| 574 | * compareMinX(a, b) { return a.x - b.x; } |
| 575 | * compareMinY(a, b) { return a.y - b.y; } |
| 576 | * } |
| 577 | * const tree = new MyRBush<[number, number]>(); |
| 578 | * tree.insert([20, 50]); // accepts [x, y] points |
| 579 | * |
| 580 | * @param a The first item to compare. |
| 581 | * @param b The second item to compare. |
| 582 | */ |
| 583 | compareMinX(a: T, b: T): number; |
| 584 | |
| 585 | /** |
| 586 | * Compares the minimum y coordinate of two items. Returns -1 if `a`'s |
| 587 | * x-coordinate is smaller, 1 if `b`'s x coordinate is smaller, or 0 if |
| 588 | * they're equal. |
| 589 | * |
| 590 | * By default, `RBush` assumes the format of data points to be an object |
| 591 | * with `minX`, `minY`, `maxX`, and `maxY`. However, you can specify a |
| 592 | * custom item format by overriding `toBBox()`, `compareMinX()`, and |
| 593 | * `compareMinY()`. |
| 594 | * |
| 595 | * @example |
| 596 | * class MyRBush<T> extends RBush<T> { |
| 597 | * toBBox([x, y]) { return { minX: x, minY: y, maxX: x, maxY: y }; } |
| 598 | * compareMinX(a, b) { return a.x - b.x; } |
| 599 | * compareMinY(a, b) { return a.y - b.y; } |
| 600 | * } |
| 601 | * const tree = new MyRBush<[number, number]>(); |
| 602 | * tree.insert([20, 50]); // accepts [x, y] points |
| 603 | * |
| 604 | * @param a The first item to compare. |
| 605 | * @param b The second item to compare. |
| 606 | */ |
| 607 | compareMinY(a: T, b: T): number; |
| 608 | |
| 609 | /** |
| 610 | * Exports the tree's contents as a JSON object. |
| 611 | * |
| 612 | * Importing and exporting as JSON allows you to use RBush on both the |
| 613 | * server (using Node.js) and the browser combined, e.g. first indexing the |
| 614 | * data on the server and and then importing the resulting tree data on the |
| 615 | * client for searching. |
| 616 | * |
| 617 | * Note that the `maxEntries` option from the constructor must be the same |
| 618 | * in both trees for export/import to work properly. |
| 619 | */ |
| 620 | toJSON(): any; |
| 621 | |
| 622 | /** |
| 623 | * Imports previously exported data into the tree (i.e., data that was |
| 624 | * emitted by `toJSON()`). |
| 625 | * |
| 626 | * Importing and exporting as JSON allows you to use RBush on both the |
| 627 | * server (using Node.js) and the browser combined, e.g. first indexing the |
| 628 | * data on the server and and then importing the resulting tree data on the |
| 629 | * client for searching. |
| 630 | * |
| 631 | * Note that the `maxEntries` option from the constructor must be the same |
| 632 | * in both trees for export/import to work properly. |
| 633 | * |
| 634 | * @param data The previously exported JSON data. |
| 635 | */ |
| 636 | fromJSON(data: any): RBush<T>; |
| 637 | } |
| 638 | } |
| 639 | |
| 640 | declare class CSS { |
| 641 | static escape(str: string): string; |
| 642 | } |