import { defineComponent as P, useCssVars as V, ref as C, onMounted as T, createElementBlock as v, openBlock as b, createVNode as D, unref as w, normalizeStyle as B, withCtx as I, createElementVNode as e, createCommentVNode as g, Fragment as O, pushScopeId as N, popScopeId as R } from "vue";
import H from "@vuepic/vue-datepicker";
import { nanoid as S } from "nanoid";
import r 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";
import "../../../../hj-componets/zv-hj-tree-list/index.mjs";
import "../../../../hj-componets/zv-hj-model-resource/index.mjs";
import "../../../../hj-componets/zv-hj-one-map-config/index.mjs";
import "../../../../hj-componets/zv-hj-video-control/index.mjs";
import "../../../../hj-componets/zv-hj-video-page/index.mjs";
import "../../../../hj-componets/zv-hj-password-input/index.mjs";
import "../../../../hj-componets/zv-hj-carousel/index.mjs";
import "../../../../hj-componets/zv-hj-video-monitor/index.mjs";
import "../../../../hj-componets/zv-hj-scene-amap2d/index.mjs";
import "../../../../hj-componets/zv-hj-scene-amap3d/index.mjs";
import "../../../../hj-componets/zv-hj-person-face/index.mjs";
import "../../../../hj-componets/zv-hj-resource-type-phone/index.mjs";
import "../../../../hj-componets/zv-hj-tree-list-phone/index.mjs";
import "../../../../hj-componets/zv-hj-video-page-phone/index.mjs";
import "../../../../hj-componets/zv-hj-model-resource-phone/index.mjs";
import "../../../../hj-componets/zv-hj-bottom-suspend/index.mjs";
import "../../../../hj-componets/zv-hj-pagination/index.mjs";
import "../../../../hj-componets/zv-hj-password-input-phone/index.mjs";
/* empty css                                 */
/* empty css                                        */
import { SHJDatasourceV2 as z } from "../../../../../plugins/datasource/index.mjs";
import { SHJParseEvent as u } 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-e0cf7f20"), a = a(), R(), a), J = { class: "left-sidebar" }, U = /* @__PURE__ */ p(() => /* @__PURE__ */ e("span", null, "今天", -1)), A = [
  U
], K = /* @__PURE__ */ p(() => /* @__PURE__ */ e("span", null, "昨天", -1)), L = [
  K
], M = /* @__PURE__ */ p(() => /* @__PURE__ */ e("span", null, "前天", -1)), W = [
  M
], Y = /* @__PURE__ */ p(() => /* @__PURE__ */ e("span", null, "今日", -1)), G = [
  Y
], Q = /* @__PURE__ */ p(() => /* @__PURE__ */ e("span", null, "昨日", -1)), X = [
  Q
], Z = /* @__PURE__ */ p(() => /* @__PURE__ */ e("span", null, "前天", -1)), _ = [
  Z
], x = /* @__PURE__ */ p(() => /* @__PURE__ */ e("span", null, "本周", -1)), oo = [
  x
], to = /* @__PURE__ */ p(() => /* @__PURE__ */ e("span", null, "上一月", -1)), eo = [
  to
], io = /* @__PURE__ */ p(() => /* @__PURE__ */ e("span", null, "本月", -1)), ro = [
  io
], po = /* @__PURE__ */ p(() => /* @__PURE__ */ e("span", null, "近7天", -1)), so = [
  po
], no = /* @__PURE__ */ p(() => /* @__PURE__ */ e("span", null, "近15天", -1)), mo = [
  no
], ao = /* @__PURE__ */ p(() => /* @__PURE__ */ e("span", null, "近30天", -1)), lo = [
  ao
], co = /* @__PURE__ */ p(() => /* @__PURE__ */ e("span", null, "近365天", -1)), uo = [
  co
], lr = /* @__PURE__ */ P({
  __name: "index",
  props: {
    option: {},
    sources: {},
    useEvents: {},
    uuid: {}
  },
  emits: ["on-change", "on-complete"],
  setup(a, { expose: $, emit: E }) {
    V((o) => ({
      "681ba034": o.option.css.dp.backgroundColor,
      "61f5c807": o.option.css.dp.textColor,
      cef10854: o.option.css.dp.hoverColor,
      "18ca0929": o.option.css.dp.hoverTextColor,
      ab4929e0: o.option.css.dp.primaryColor,
      de991e18: o.option.css.dp.primaryDisabledColor,
      "343fcb63": o.option.css.dp.primaryTextColor,
      "59b2771e": o.option.css.dp.secondaryColor,
      "3f9e1fb0": o.option.css.dp.borderColor,
      "6d2390c9": o.option.css.dp.menuBorderColor,
      dd5c7c18: o.option.css.dp.borderColorHover,
      dd9564e0: o.option.css.dp.borderColorFocus,
      "77db08d0": o.option.css.dp.disabledColor,
      b08e8f36: o.option.css.dp.scrollBarBackground,
      f3b53468: o.option.css.dp.scrollBarColor,
      "74315ca2": o.option.css.dp.successColor,
      "04ced14b": o.option.css.dp.successColorDisabled,
      d6f01ede: o.option.css.dp.dangerColor,
      "38e2a8e5": o.option.css.dp.disabledColorText,
      "837f3844": o.option.css.dp.highlightColor,
      c45f603c: o.option.css.dp.loader,
      "12bd08ff": o.option.css.dp.fontSize,
      "4899598c": o.option.css.dp.inputBackgroundColor,
      e17c81bc: o.option.css.dp.inputHeight
    })), r.extend(j), r.locale("zh-cn");
    const m = a, d = E, i = C(), y = C(S()), k = () => y.value = S(), c = () => {
      z.parse({
        tId: m.uuid,
        sources: m.sources,
        callback: ({ data: o }) => {
          try {
            if (i.value = o[0].data[0].date, m.option.range) {
              const t = {
                data: i.value,
                startTime: i.value[0],
                endTime: i.value[1]
              };
              d("on-complete", t), u.parseEvents(m.useEvents, "on-complete", t);
            } else {
              const t = { data: i.value };
              d("on-complete", t), u.parseEvents(m.useEvents, "on-complete", t);
            }
          } catch {
          }
        }
      });
    };
    T(() => c()), q(m, c, k), $({
      refresh: () => c(),
      refreshView: () => k(),
      refreshData: () => c()
    });
    const h = (o) => {
      if (i.value = o, m.option.range) {
        const l = {
          data: i.value,
          startTime: i.value[0],
          endTime: i.value[1]
        };
        d("on-change", l), u.parseEvents(m.useEvents, "on-change", l);
        return;
      }
      const t = { data: i.value };
      d("on-change", t), u.parseEvents(m.useEvents, "on-change", t);
    }, f = (o) => {
      o === "today" ? i.value = r() : o === "yesterday" ? i.value = r().subtract(1, "day") : o === "before-yesterday" && (i.value = r().subtract(2, "day"));
    }, n = (o) => {
      o === "today" ? i.value = [r().startOf("day"), r().endOf("day")] : o === "yesterday" ? i.value = [r().subtract(1, "day").startOf("day"), r().subtract(1, "day").endOf("day")] : o === "before-yesterday" ? i.value = [r().subtract(2, "day").startOf("day"), r().subtract(2, "day").endOf("day")] : o === "week" ? i.value = [r().startOf("week"), r().endOf("week")] : o === "last-month" ? i.value = [r().subtract(1, "month").startOf("month"), r().subtract(1, "month").endOf("month")] : o === "month" ? i.value = [r().startOf("month"), r().endOf("month")] : o === "last-7" ? i.value = [r().subtract(7, "day").startOf("day"), r().endOf("day")] : o === "last-15" ? i.value = [r().subtract(15, "day").startOf("day"), r().endOf("day")] : o === "last-30" ? i.value = [r().subtract(30, "day").startOf("day"), r().endOf("day")] : o === "last-365" && (i.value = [r().subtract(365, "day").startOf("day"), r().endOf("day")]), h(i.value);
    };
    return (o, t) => (b(), v("div", {
      key: y.value,
      class: "date-picker"
    }, [
      D(w(H), {
        modelValue: i.value,
        "onUpdate:modelValue": [
          t[13] || (t[13] = (l) => i.value = l),
          h
        ],
        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: B(w(F).json2cssObject(o.option.css.dp, "dp"))
      }, {
        "left-sidebar": I((l) => [
          e("div", J, [
            o.option.range ? g("", !0) : (b(), v(O, { key: 0 }, [
              e("div", {
                class: "left-sidebar-item",
                onClick: t[0] || (t[0] = (s) => f("today"))
              }, A),
              e("div", {
                class: "left-sidebar-item",
                onClick: t[1] || (t[1] = (s) => f("yesterday"))
              }, L),
              e("div", {
                class: "left-sidebar-item",
                onClick: t[2] || (t[2] = (s) => f("before-yesterday"))
              }, W)
            ], 64)),
            o.option.range ? (b(), v(O, { key: 1 }, [
              e("div", {
                class: "left-sidebar-item",
                onClick: t[3] || (t[3] = (s) => n("today"))
              }, G),
              e("div", {
                class: "left-sidebar-item",
                onClick: t[4] || (t[4] = (s) => n("yesterday"))
              }, X),
              e("div", {
                class: "left-sidebar-item",
                onClick: t[5] || (t[5] = (s) => n("before-yesterday"))
              }, _),
              e("div", {
                class: "left-sidebar-item",
                onClick: t[6] || (t[6] = (s) => n("week"))
              }, oo),
              e("div", {
                class: "left-sidebar-item",
                onClick: t[7] || (t[7] = (s) => n("last-month"))
              }, eo),
              e("div", {
                class: "left-sidebar-item",
                onClick: t[8] || (t[8] = (s) => n("month"))
              }, ro),
              e("div", {
                class: "left-sidebar-item",
                onClick: t[9] || (t[9] = (s) => n("last-7"))
              }, so),
              e("div", {
                class: "left-sidebar-item",
                onClick: t[10] || (t[10] = (s) => n("last-15"))
              }, mo),
              e("div", {
                class: "left-sidebar-item",
                onClick: t[11] || (t[11] = (s) => n("last-30"))
              }, lo),
              e("div", {
                class: "left-sidebar-item",
                onClick: t[12] || (t[12] = (s) => n("last-365"))
              }, uo)
            ], 64)) : g("", !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 {
  lr as default
};
