import { defineComponent as V, useCssVars as D, ref as h, onMounted as T, createElementBlock as u, openBlock as f, createVNode as B, unref as C, normalizeStyle as E, withCtx as I, createElementVNode as i, createCommentVNode as w, Fragment as O, pushScopeId as N, popScopeId as R } from "vue";
import H from "@vuepic/vue-datepicker";
import { nanoid as g } from "nanoid";
import e from "dayjs";
import "dayjs/locale/zh-cn";
import j from "dayjs/plugin/relativeTime";
import { useDatePickerWatch as q } from "./hooks/useDatePickerWatch.mjs";
import "../../../../text-text-basic/index.mjs";
import "../../../../text-table-basic/index.mjs";
import "../../../../chart-other-gauge/index.mjs";
import "../../../../chart-other-gauge-stage/index.mjs";
import "../../../../chart-other-gauge-grade/index.mjs";
import "../../../../chart-other-word-cloud/index.mjs";
import "../../../../chart-other-liquidfill/index.mjs";
import "../../../../chart-other-funnel/index.mjs";
import "../../../../chart-other-force/index.mjs";
import "../../../../chart-other-radar/index.mjs";
import "../../../../chart-other-funnel-split/index.mjs";
import "../../../../chart-other-funnel-contrast/index.mjs";
import "../../../../chart-other-candlestick-basic/index.mjs";
import "../../../../chart-other-candlestick-shanghai/index.mjs";
import "../../../../chart-other-candlestick-demo/index.mjs";
import "../../../../chart-other-heatmap/index.mjs";
import "../../../../chart-other-force2/index.mjs";
import "../../../../chart-other-graph-basic/index.mjs";
import "../../../../chart-other-graph-basic2/index.mjs";
import "../../../../chart-other-graph-calendar/index.mjs";
import "../../../../chart-other-tree-line/index.mjs";
import "../../../../chart-other-treemap-basic/index.mjs";
import "../../../../chart-other-sunburst-basic/index.mjs";
import "../../../../chart-other-sunburst-basic2/index.mjs";
import "../../../../chart-other-sunburst-basic3/index.mjs";
import "../../../../chart-other-sunburst-basic4/index.mjs";
import "../../../../chart-other-sunburst-book/index.mjs";
import "../../../../chart-other-sunburst-radius/index.mjs";
import "../../../../chart-other-sunburst-flavors/index.mjs";
import "../../../../chart-other-parallel-basic/index.mjs";
import "../../../../chart-other-parallel-mul/index.mjs";
import "../../../../chart-other-circular-graph/index.mjs";
import "../../../../map-earth-basic/index.mjs";
import "../../../../map-earth-cool-tech/index.mjs";
import "../../../../map-earth-particle/index.mjs";
import "../../../../map-earth-hacker/index.mjs";
import "../../../../map-earth-fly-line/index.mjs";
import "../../../../chart-other-grid-percentage/index.mjs";
import "../../../../chart-other-radar-stack/index.mjs";
import "../../../../chart-other-funnel2/index.mjs";
import "../../../../chart-other-label-gauge/index.mjs";
import "../../../../chart-other-theme-river/index.mjs";
import "../../../../chart-other-tree/index.mjs";
import "../../../../chart-other-treemap/index.mjs";
import "../../../../commons-product-model/index.mjs";
import "../../../../commons-vr-photo/index.mjs";
import "../../../../commons-vr-video/index.mjs";
import "../../../../commons-three-loader/index.mjs";
import "../../../../commons-three-loader3/index.mjs";
import "../../../../commons-loop-iterator/index.mjs";
import "../../../../commons-gaussian-splatting-view/index.mjs";
import "../../../../commons-babylon/index.mjs";
import "../../../../commons-svg/index.mjs";
import "../../../../commons-weather/index.mjs";
import "../../../../commons-weather-dynamic/index.mjs";
import "../../../../media-wavesurfer/index.mjs";
import "../../../../interaction-tabs/index.mjs";
import "../../../../interaction-tabs2/index.mjs";
import "../../../../interaction-button/index.mjs";
import "../../../../interaction-button-image/index.mjs";
import "../../../../interaction-select/index.mjs";
import "../../../../interaction-input/index.mjs";
import "../../../../interaction-radio/index.mjs";
import "../../../../interaction-slider/index.mjs";
import "../../../../interaction-switch/index.mjs";
import "../../../../interaction-data-picker/index.mjs";
import "../../../../interaction-button-refresh/index.mjs";
import "../../../../media-image/index.mjs";
import "../../../../text-title/index.mjs";
import "../../../../commons-qrcode/index.mjs";
import "../../../../media-video/index.mjs";
import "../../../../media-audio/index.mjs";
import "../../../../text-real-time/index.mjs";
import "../../../../media-carousel/index.mjs";
import "../../../../media-carousel-slides/index.mjs";
import "../../../../media-iframe-carousel/index.mjs";
import "../../../../media-iframe/index.mjs";
import "../../../../media-m3u8/index.mjs";
import "../../../../media-m3u8-dynamic/index.mjs";
import "../../../../media-audio-dynamic/index.mjs";
import "../../../../media-video-dynamic/index.mjs";
import "../../../../media-image-dynamic/index.mjs";
import "../../../../media-iframe-dynamic/index.mjs";
import "../../../../media-flv/index.mjs";
import "../../../../commons-echarts/index.mjs";
import "../../../../text-over-number/index.mjs";
import "../../../../text-table-scroll/index.mjs";
import "../../../../text-carousel/index.mjs";
import "../../../../text-row-scroll/index.mjs";
import "../../../../text-text-dynamic/index.mjs";
import "../../../../text-count-down/index.mjs";
import "../../../../graphical-circle/index.mjs";
import "../../../../graphical-diamond/index.mjs";
import "../../../../graphical-hexagon/index.mjs";
import "../../../../graphical-isosceles-triangle/index.mjs";
import "../../../../graphical-pentagon/index.mjs";
import "../../../../graphical-rect/index.mjs";
import "../../../../graphical-right-triangle/index.mjs";
import "../../../../scene-map3d/index.mjs";
import "../../../../scene-amap2d/index.mjs";
import "../../../../scene-amap3d/index.mjs";
import "../../../../scene-vr/index.mjs";
import "../../../../scene-unity-iframe/index.mjs";
import "../../../../scene-unity-webgl/index.mjs";
import "../../../../scene-ue-iframe/index.mjs";
import "../../../../scene-ue-shj/index.mjs";
import "../../../../scene-default/index.mjs";
import "../../../tabs/index.mjs";
import "../../../tabs-icon/index.mjs";
import "../../../button/index.mjs";
import "../../src/date-picker/index.mjs";
import "../../src/date-picker-range/index.mjs";
import "../../../../text/list/index.mjs";
import "../../../../chart/src/bar/basic/index.mjs";
import "../../../../chart/src/bar/animation/index.mjs";
import "../../../../chart/src/bar/contrast/index.mjs";
import "../../../../chart/src/bar/contrast2/index.mjs";
import "../../../../chart/src/bar/contrast3/index.mjs";
import "../../../../chart/src/bar/gradient-column-chart/index.mjs";
import "../../../../chart/src/bar/horizontal/index.mjs";
import "../../../../chart/src/bar/horizontal-stack/index.mjs";
import "../../../../chart/src/bar/line-bar/index.mjs";
import "../../../../chart/src/bar/line-bar2/index.mjs";
import "../../../../chart/src/bar/loop/index.mjs";
import "../../../../chart/src/bar/mini/index.mjs";
import "../../../../chart/src/bar/polar/index.mjs";
import "../../../../chart/src/bar/polar-stack/index.mjs";
import "../../../../chart/src/bar/polar2/index.mjs";
import "../../../../chart/src/bar/radius-circle/index.mjs";
import "../../../../chart/src/bar/rank/index.mjs";
import "../../../../chart/src/bar/segmented-progress/index.mjs";
import "../../../../chart/src/bar/spire/index.mjs";
import "../../../../chart/src/bar/stack/index.mjs";
import "../../../../chart/src/bar/stack-line/index.mjs";
import "../../../../chart/src/bar/stack2/index.mjs";
import "../../../../chart/src/bar/stack3/index.mjs";
import "../../../../chart/src/bar/staggered/index.mjs";
import "../../../../chart/src/bar/three/index.mjs";
import "../../../../chart/src/bar/waterfall/index.mjs";
import "../../../../chart/src/bar/zebra/index.mjs";
import "../../../../chart/src/line/area-gradient/index.mjs";
import "../../../../chart/src/line/area-highlight/index.mjs";
import "../../../../chart/src/line/area-highlight2/index.mjs";
import "../../../../chart/src/line/basic/index.mjs";
import "../../../../chart/src/line/bump/index.mjs";
import "../../../../chart/src/line/dashed/index.mjs";
import "../../../../chart/src/line/ladder/index.mjs";
import "../../../../chart/src/line/logarithm/index.mjs";
import "../../../../chart/src/line/multix/index.mjs";
import "../../../../chart/src/line/polar-double/index.mjs";
import "../../../../chart/src/line/rain-flow/index.mjs";
import "../../../../chart/src/line/scale/index.mjs";
import "../../../../chart/src/line/smooth/index.mjs";
import "../../../../chart/src/line/smooth-area/index.mjs";
import "../../../../chart/src/line/stack/index.mjs";
import "../../../../chart/src/line/stack-area/index.mjs";
import "../../../../chart/src/line/temp/index.mjs";
import "../../../../chart/src/line/vertical/index.mjs";
import "../../../../chart/src/map/basic/index.mjs";
import "../../../../chart/src/map/bmap-basic/index.mjs";
import "../../../../chart/src/map/bmap-heatmap/index.mjs";
import "../../../../chart/src/map/bmap-rich/index.mjs";
import "../../../../chart/src/map/customize/index.mjs";
import "../../../../chart/src/map/lines/index.mjs";
import "../../../../chart/src/map/scatter/index.mjs";
import "../../../../chart/src/pie/3d/index.mjs";
import "../../../../chart/src/pie/basic/index.mjs";
import "../../../../chart/src/pie/basic2/index.mjs";
import "../../../../chart/src/pie/customized/index.mjs";
import "../../../../chart/src/pie/index/index.mjs";
import "../../../../chart/src/pie/interval/index.mjs";
import "../../../../chart/src/pie/legend-scroll/index.mjs";
import "../../../../chart/src/pie/radius/index.mjs";
import "../../../../chart/src/pie/rose/index.mjs";
import "../../../../chart/src/pie/round/index.mjs";
import "../../../../chart/src/pie/sunburst/index.mjs";
import "../../../../chart/src/scatter/basic/index.mjs";
import "../../../../chart/src/scatter/basic2/index.mjs";
import "../../../../chart/src/scatter/bubble/index.mjs";
import "../../../../chart/src/scatter/ripples/index.mjs";
/* empty css                                 */
/* empty css                                        */
import { SHJDatasourceV2 as z } from "../../../../../plugins/datasource/index.mjs";
import { SHJParseEvent as S } from "../../../../../plugins/event/index.mjs";
import "lodash";
import { Utils as F } from "../../../../../commons/utils/utils.mjs";
import "@vuepic/vue-datepicker/dist/main.css";
const p = (a) => (N("data-v-0d6f8ad9"), a = a(), R(), a), J = { class: "left-sidebar" }, U = /* @__PURE__ */ p(() => /* @__PURE__ */ i("span", null, "今天", -1)), A = [
  U
], K = /* @__PURE__ */ p(() => /* @__PURE__ */ i("span", null, "昨天", -1)), L = [
  K
], M = /* @__PURE__ */ p(() => /* @__PURE__ */ i("span", null, "前天", -1)), W = [
  M
], Y = /* @__PURE__ */ p(() => /* @__PURE__ */ i("span", null, "今日", -1)), G = [
  Y
], Q = /* @__PURE__ */ p(() => /* @__PURE__ */ i("span", null, "昨日", -1)), X = [
  Q
], Z = /* @__PURE__ */ p(() => /* @__PURE__ */ i("span", null, "前天", -1)), _ = [
  Z
], x = /* @__PURE__ */ p(() => /* @__PURE__ */ i("span", null, "本周", -1)), oo = [
  x
], to = /* @__PURE__ */ p(() => /* @__PURE__ */ i("span", null, "上一月", -1)), io = [
  to
], eo = /* @__PURE__ */ p(() => /* @__PURE__ */ i("span", null, "本月", -1)), ro = [
  eo
], po = /* @__PURE__ */ p(() => /* @__PURE__ */ i("span", null, "近7天", -1)), so = [
  po
], no = /* @__PURE__ */ p(() => /* @__PURE__ */ i("span", null, "近15天", -1)), mo = [
  no
], ao = /* @__PURE__ */ p(() => /* @__PURE__ */ i("span", null, "近30天", -1)), lo = [
  ao
], co = /* @__PURE__ */ p(() => /* @__PURE__ */ i("span", null, "近365天", -1)), uo = [
  co
], We = /* @__PURE__ */ V({
  __name: "index",
  props: {
    option: {},
    sources: {},
    useEvents: {},
    uuid: {}
  },
  emits: ["on-change"],
  setup(a, { expose: $, emit: P }) {
    D((o) => ({
      "3360c67f": o.option.css.dp.backgroundColor,
      "6948f540": o.option.css.dp.textColor,
      "5bd9699d": o.option.css.dp.hoverColor,
      "3b5c8920": o.option.css.dp.hoverTextColor,
      "3e2df9d2": o.option.css.dp.primaryColor,
      cbefdc0a: o.option.css.dp.primaryDisabledColor,
      "8ab7f02c": o.option.css.dp.primaryTextColor,
      "233a2965": o.option.css.dp.secondaryColor,
      f1c6897e: o.option.css.dp.borderColor,
      "56dbb13c": o.option.css.dp.menuBorderColor,
      "17b5fe7b": o.option.css.dp.borderColorHover,
      "17998a17": o.option.css.dp.borderColorFocus,
      "5f37e471": o.option.css.dp.disabledColor,
      "1b4f4b04": o.option.css.dp.scrollBarBackground,
      "4fad1813": o.option.css.dp.scrollBarColor,
      "07162c94": o.option.css.dp.successColor,
      "0e237252": o.option.css.dp.successColorDisabled,
      "3b73bbaa": o.option.css.dp.dangerColor,
      "7f05fd3e": o.option.css.dp.disabledColorText,
      f06fd3b6: o.option.css.dp.highlightColor,
      54563929: o.option.css.dp.loader,
      "3f6dbc86": o.option.css.dp.fontSize,
      "35f0177e": o.option.css.dp.inputBackgroundColor,
      "362d8a3b": o.option.css.dp.inputHeight
    })), e.extend(j), e.locale("zh-cn");
    const m = a, b = P, r = h(), v = h(g()), y = () => v.value = g(), d = () => {
      z.parse({
        tId: m.uuid,
        sources: m.sources,
        callback: ({ data: o }) => {
          try {
            r.value = o[0].data[0].date;
          } catch {
          }
        }
      });
    };
    T(() => d()), q(m, d, y), $({
      refresh: () => d(),
      refreshView: () => y(),
      refreshData: () => d()
    });
    const k = (o) => {
      if (r.value = o, m.option.range) {
        const l = {
          data: r.value,
          startTime: r.value[0],
          endTime: r.value[1]
        };
        b("on-change", l), S.parseEvents(m.useEvents, "on-change", l);
        return;
      }
      const t = { data: r.value };
      b("on-change", t), S.parseEvents(m.useEvents, "on-change", t);
    }, c = (o) => {
      o === "today" ? r.value = e() : o === "yesterday" ? r.value = e().subtract(1, "day") : o === "before-yesterday" && (r.value = e().subtract(2, "day"));
    }, n = (o) => {
      o === "today" ? r.value = [e().startOf("day"), e().endOf("day")] : o === "yesterday" ? r.value = [e().subtract(1, "day").startOf("day"), e().subtract(1, "day").endOf("day")] : o === "before-yesterday" ? r.value = [e().subtract(2, "day").startOf("day"), e().subtract(2, "day").endOf("day")] : o === "week" ? r.value = [e().startOf("week"), e().endOf("week")] : o === "last-month" ? r.value = [e().subtract(1, "month").startOf("month"), e().subtract(1, "month").endOf("month")] : o === "month" ? r.value = [e().startOf("month"), e().endOf("month")] : o === "last-7" ? r.value = [e().subtract(7, "day").startOf("day"), e().endOf("day")] : o === "last-15" ? r.value = [e().subtract(15, "day").startOf("day"), e().endOf("day")] : o === "last-30" ? r.value = [e().subtract(30, "day").startOf("day"), e().endOf("day")] : o === "last-365" && (r.value = [e().subtract(365, "day").startOf("day"), e().endOf("day")]), k(r.value);
    };
    return (o, t) => (f(), u("div", {
      key: v.value,
      class: "date-picker"
    }, [
      B(C(H), {
        modelValue: r.value,
        "onUpdate:modelValue": [
          t[13] || (t[13] = (l) => r.value = l),
          k
        ],
        range: o.option.range,
        "multi-calendars": o.option.multiCalendars,
        "month-picker": o.option.monthPicker,
        "time-picker": o.option.timePicker,
        "year-picker": o.option.yearPicker,
        "week-picker": o.option.weekPicker,
        "quarter-picker": o.option.quarterPicker,
        inline: o.option.inline,
        "auto-apply": o.option.autoApply,
        clearable: o.option.clearable,
        placeholder: o.option.placeholder,
        disabled: o.option.disabled,
        readonly: o.option.readonly,
        "action-row": {
          showNow: o.option.actionRow.showNow,
          showPreview: o.option.actionRow.showPreview,
          showSelect: o.option.actionRow.showSelect,
          showCancel: o.option.actionRow.showCancel
        },
        "disable-year-select": o.option.disableYearSelect,
        "enable-time-picker": o.option.enableTimePicker,
        "enable-seconds": o.option.enableSeconds,
        "time-picker-inline": o.option.timePickerInline,
        "now-button-label": o.option.nowButtonLabel,
        "cancel-text": o.option.cancelText,
        "select-text": o.option.selectText,
        "hide-input-icon": o.option.hideInputIcon,
        class: "date-picker-container",
        style: E(C(F).json2cssObject(o.option.css.dp, "dp"))
      }, {
        "left-sidebar": I((l) => [
          i("div", J, [
            o.option.range ? w("", !0) : (f(), u(O, { key: 0 }, [
              i("div", {
                class: "left-sidebar-item",
                onClick: t[0] || (t[0] = (s) => c("today"))
              }, A),
              i("div", {
                class: "left-sidebar-item",
                onClick: t[1] || (t[1] = (s) => c("yesterday"))
              }, L),
              i("div", {
                class: "left-sidebar-item",
                onClick: t[2] || (t[2] = (s) => c("before-yesterday"))
              }, W)
            ], 64)),
            o.option.range ? (f(), u(O, { key: 1 }, [
              i("div", {
                class: "left-sidebar-item",
                onClick: t[3] || (t[3] = (s) => n("today"))
              }, G),
              i("div", {
                class: "left-sidebar-item",
                onClick: t[4] || (t[4] = (s) => n("yesterday"))
              }, X),
              i("div", {
                class: "left-sidebar-item",
                onClick: t[5] || (t[5] = (s) => n("before-yesterday"))
              }, _),
              i("div", {
                class: "left-sidebar-item",
                onClick: t[6] || (t[6] = (s) => n("week"))
              }, oo),
              i("div", {
                class: "left-sidebar-item",
                onClick: t[7] || (t[7] = (s) => n("last-month"))
              }, io),
              i("div", {
                class: "left-sidebar-item",
                onClick: t[8] || (t[8] = (s) => n("month"))
              }, ro),
              i("div", {
                class: "left-sidebar-item",
                onClick: t[9] || (t[9] = (s) => n("last-7"))
              }, so),
              i("div", {
                class: "left-sidebar-item",
                onClick: t[10] || (t[10] = (s) => n("last-15"))
              }, mo),
              i("div", {
                class: "left-sidebar-item",
                onClick: t[11] || (t[11] = (s) => n("last-30"))
              }, lo),
              i("div", {
                class: "left-sidebar-item",
                onClick: t[12] || (t[12] = (s) => n("last-365"))
              }, uo)
            ], 64)) : w("", !0)
          ])
        ]),
        _: 1
      }, 8, ["modelValue", "range", "multi-calendars", "month-picker", "time-picker", "year-picker", "week-picker", "quarter-picker", "inline", "auto-apply", "clearable", "placeholder", "disabled", "readonly", "action-row", "disable-year-select", "enable-time-picker", "enable-seconds", "time-picker-inline", "now-button-label", "cancel-text", "select-text", "hide-input-icon", "style"])
    ]));
  }
});
export {
  We as default
};
