import { b9 as h, P as b, V as a, bS as l, bT as d, a0 as c, bQ as o, bR as m, gp as C } from "./684d2f28.js";
import { getMobileStyle as v } from "./f2000b8a.js";
import { a as D } from "./6a1a7a3c.js";
import "react";
import "react-dom";
import "./d6402597.js";
const s = async (e) => {
  const n = (await import("./d3ecd46e.js")).default, f = o(e.minDate, m), r = o(e.maxDate, m), {
    disabledHours: y,
    disabledMinutes: w,
    disabledSeconds: x
  } = e.disabledTime();
  n.prompt({
    getContainer: () => document.querySelector(`#${C}`) || document.body,
    mouseWheel: !0,
    destroyOnClose: !0,
    closeOnMaskClick: !0,
    min: f.isValid() ? f.toDate() : void 0,
    max: r.isValid() ? r.toDate() : void 0,
    precision: e.showTime ? "second" : "day",
    defaultValue: e.value ? e.value.toDate() : void 0,
    filter: {
      hour: (t) => !y().includes(t),
      minute: (t, {
        date: i
      }) => !w(i.getHours()).includes(t),
      second: (t, {
        date: i
      }) => !x(i.getHours(), i.getMinutes()).includes(t)
    },
    onConfirm: (t) => {
      const i = o(t);
      e.onChange(i);
    },
    onClose: e.onBlur
  }), e.onFocus();
}, g = h.div`
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  background-color: #ffffff;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid #d7d9e0;
  ${(e) => e.$style && v(e.$style)}
`, u = h.div`
  overflow: hidden;
  white-space: nowrap;
  flex-grow: 1;
  display: flex;
  justify-content: center;
`, V = (e) => /* @__PURE__ */ b(g, {
  ref: e.viewRef,
  $style: e.$style,
  onClick: () => s(e),
  children: [/* @__PURE__ */ a(u, {
    children: e.value ? e.value.format(e.format || (e.showTime ? l : d)) : c("date.placeholder")
  }), e.suffixIcon]
}), j = (e) => /* @__PURE__ */ b(g, {
  ref: e.viewRef,
  $style: e.$style,
  children: [/* @__PURE__ */ a(u, {
    onClick: () => s({
      ...e,
      value: e.start,
      onChange: (n) => e.onChange(n, e.end)
    }),
    children: e.start ? e.start.format(e.format || (e.showTime ? l : d)) : c("date.startDate")
  }), /* @__PURE__ */ a(D, {}), /* @__PURE__ */ a(u, {
    onClick: () => s({
      ...e,
      value: e.end,
      onChange: (n) => e.onChange(e.start, n)
    }),
    children: e.end ? e.end.format(e.format || (e.showTime ? l : d)) : c("date.endDate")
  }), e.suffixIcon]
});
export {
  V as DateMobileUIView,
  j as DateRangeMobileUIView
};
