/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.25/esri/copyright.txt for details. */ import t from"../../TimeExtent.js";import{clone as e}from"../../core/lang.js";import{isSome as n,isNone as r}from"../../core/maybe.js";import{getTimeExtentFromLayers as i}from"../../support/timeUtils.js";async function s(t,e){const{fullTimeExtent:n}=t.widgets.timeSlider;return n||i(t.allLayers,e)}function o(t){const e=t.numThumbs??2,i=t.currentTimeExtent;if(i){const{start:t,end:s}=i;return n(t)&&n(s)&&t.getTime()===s.getTime()?"instant":2===e?"time-window":r(t)||0===t.getTime()?"cumulative-from-start":"cumulative-from-end"}return 2===e?"time-window":"cumulative-from-start"}function u(t){const{numStops:n,stopInterval:r,stops:i}=t;return i?{dates:e(i)}:r?{interval:r.clone()}:{count:n??5}}function m(e,n){const r=e.currentTimeExtent;if(!r)return null;const{start:i,end:s}=r,o=i??s??null;switch(n){case"time-window":return new t({start:i,end:s});case"cumulative-from-start":return new t({start:null,end:o});case"cumulative-from-end":return new t({start:o,end:null});case"instant":return new t({start:o,end:o})}}export{s as getFullTimeExtentFromWebDocument,o as getModeFromTimeSlider,u as getStopsFromTimeSlider,m as getTimeExtentFromTimeSlider};