/**
 * Provides utility methods for working with [dates](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date).
 *
 * @since 4.21
 * @see [TimeExtent](https://developers.arcgis.com/javascript/latest/references/core/time/TimeExtent/)
 * @see [TimeInterval](https://developers.arcgis.com/javascript/latest/references/core/time/TimeInterval/)
 * @see [TimeSlider](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/)
 * @see [TimeSliderViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/TimeSliderViewModel/)
 */
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";
import type { TimeSliderSettings } from "../widgets/TimeSlider/types.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/references/core/layers/Layer/#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/references/core/time/TimeExtent/) with `start` and `end` set to `null`.
 * For [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) or [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/) 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/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/docs/Web/API/AbortController).
 * @returns Returns a promise that resolves to a [TimeExtent](https://developers.arcgis.com/javascript/latest/references/core/time/TimeExtent/).
 * @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/references/core/WebMap/) or [WebScene](https://developers.arcgis.com/javascript/latest/references/core/WebScene/) 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/references/core/widgets/TimeSlider/) or [TimeSliderViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/TimeSlider/TimeSliderViewModel/).
 * 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.
 * @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",
 *   }
 * });
 *
 * const timeUtils = await $arcgis.import("esri/support/timeUtils.js");
 * const timeSliderSettings = await timeUtils.getTimeSliderSettingsFromWebDocument(map);
 *
 * // Create a new TimeSlider using the settings from the web map.
 * const timeSlider = new TimeSlider({
 *   ...timeSliderSettings,
 *   view
 * });
 */
export function getTimeSliderSettingsFromWebDocument(document: Map | WebScene | WebMap | null | undefined, signal?: AbortSignal | null | undefined): Promise<TimeSliderSettings | null | undefined>;