/**
 * Provides utility methods for working with [dates](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).
 *
 * @since 4.21
 * @see [TimeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-time-TimeExtent.html)
 * @see [TimeInterval](https://developers.arcgis.com/javascript/latest/api-reference/esri-time-TimeInterval.html)
 * @see [TimeSlider](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider.html)
 * @see [TimeSliderViewModel](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider-TimeSliderViewModel.html)
 */
import type Map from "../Map.js";
import type WebMap from "../WebMap.js";
import type WebScene from "../WebScene.js";
import type Layer from "../layers/Layer.js";
import type TimeExtent from "../time/TimeExtent.js";
import type { ReadonlyArrayOrCollection } from "../core/Collection.js";

/**
 * Returns the time extent of all layers which are "feature based" time-aware and/or have a "layer based" time-aware with [Layer.visibilityTimeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html#visibilityTimeExtent) set.
 * If the time extent of the layers is set, the method returns the union of the time extents of all layers.
 * If the time extent of a layer is not set, the method returns [TimeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-time-TimeExtent.html) with `start` and `end` set to `null`.
 * For [FeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) or [MapImageLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html) with `hasLiveData` set to `true`, the method fetches the time extent from the server.
 *
 * @param layers - An array or collection of layers to compute a time extent from.
 * @param signal - [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) allows for cancelable requests.
 * If canceled, the promise will be rejected with an error named `AbortError`.
 * See also [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
 * @returns Returns a promise that resolves to a [TimeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-time-TimeExtent.html).
 * @example
 * // Get the time extent of all layers in the view.
 * const fullTimeExtent = await getTimeExtentFromLayers(view.map.allLayers);
 * @example
 * // Get the time extent from an array of layers.
 * const timeExtent = await getTimeExtentFromLayers([
 *   earthquakes,
 *   emergencyCalls
 * ]);
 */
export function getTimeExtentFromLayers(layers: ReadonlyArrayOrCollection<Layer>, signal?: AbortSignal | null | undefined): Promise<TimeExtent>;

/**
 * Extracts time slider settings from a [WebMap](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebMap.html) or [WebScene](https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html) if the document contains a time slider widget definition.
 * Returns an object with properties that can be used to configure the [TimeSlider](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider.html) or [TimeSliderViewModel](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider-TimeSliderViewModel.html).
 * If a document does not contain a time slider definition then `null` is returned.
 *
 * @param document - An instance of a webmap or webscene to extract time slider settings from.
 * @param signal - Signal object that can be used to abort the asynchronous task.
 * @returns When resolved, returns an object with the following properties.
 *
 * Property | Type | Description
 * ---------|------|-------------
 * fullTimeExtent | [TimeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-time-TimeExtent.html)  | The temporal extent of the entire slider.
 * loop           | Boolean                              | When `true`, the time slider will play its animation in a loop.
 * mode           | "instant" \| "time-window" \| "cumulative-from-start" \| "cumulative-from-end" | The time slider mode.
 * playRate       | Number                               | The time (in milliseconds) between animation steps.
 * stops          | [StopsByDates](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider-types.html#StopsByDates) \| [StopsByCount](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider-types.html#StopsByCount) \| [StopsByInterval](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-TimeSlider-types.html#StopsByInterval) | Defines specific locations on the time slider where thumbs will snap to when manipulated.
 * timeExtent     | [TimeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-time-TimeExtent.html)  | The current time extent of the time slider.
 * @since 4.30
 * @see [Sample - Time-enabled bookmarks](https://developers.arcgis.com/javascript/latest/sample-code/widgets-bookmarks/)
 * @example
 * // Import and apply time slider settings stored in a webmap.
 * const map = new WebMap({
 *   portalItem: {
 *     id: "your-webmap-id",
 *   }
 * });
 *
 * timeUtils.getTimeSliderSettingsFromWebDocument(map).then((timeSliderSettings) => {
 *   const timeSlider = new TimeSlider({
 *     ...timeSliderSettings,
 *     view
 *   });
 * });
 */
export function getTimeSliderSettingsFromWebDocument(document: Map | WebScene | WebMap | null | undefined, signal?: AbortSignal | null | undefined): Promise<any | null | undefined>;