import { a3 as C, ad as g, H as a, dU as u, a4 as s, h4 as M, cj as f, dT as h, h5 as w, cC as r } from "./56c67d3b.js";
import { getMobileStyle as T } from "./85fb0bcf.js";
import { a as j } from "./84393c9d.js";
import "react";
import "react-dom";
const k = (e = 1) => [...r.range(0, 24, e).map((t) => {
  const n = (t < 10 ? "0" : "") + t;
  return {
    label: n,
    value: n
  };
})], I = (e = 1) => [...r.range(0, 12, e).map((t) => {
  const n = (t < 10 ? "0" : "") + t;
  return {
    label: n,
    value: n
  };
})], b = (e = 1) => r.range(0, 60, e).map((t) => {
  const n = (t < 10 ? "0" : "") + t;
  return {
    label: n,
    value: n
  };
}), $ = [{
  label: "AM",
  value: "am"
}, {
  label: "PM",
  value: "pm"
}], c = async (e) => {
  const t = (await import("./deb0f6fb.js").then((l) => l.i)).default, {
    disabledHours: n,
    disabledMinutes: y,
    disabledSeconds: x
  } = e.disabledTime();
  t.prompt({
    getContainer: () => document.querySelector(`#${M}`) || document.body,
    mouseWheel: !0,
    destroyOnClose: !0,
    closeOnMaskClick: !0,
    columns: (l) => {
      const i = f(l.join(":"), h);
      return [(e.use12Hours ? I : k)(e.hourStep).filter(({
        label: m,
        value: o
      }) => !n().includes(Number(o) + (l[3] === "pm" ? 12 : 0))), b(e.minuteStep).filter(({
        label: m,
        value: o
      }) => !y(i.hour()).includes(Number(o))), b(e.secondStep).filter(({
        label: m,
        value: o
      }) => !x(i.hour(), i.minute()).includes(Number(o))), ...e.use12Hours ? [$] : []];
    },
    defaultValue: e.value ? e.value.format(e.use12Hours ? w : u).split(":") : void 0,
    onConfirm: (l) => {
      const i = f(l.join(":"), h);
      e.onChange(i);
    },
    onClose: e.onBlur
  }), e.onFocus();
}, v = C.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 && T(e.$style)}
`, d = C.div`
  overflow: hidden;
  white-space: nowrap;
  flex-grow: 1;
  display: flex;
  justify-content: center;
`, P = (e) => /* @__PURE__ */ g(v, {
  ref: e.viewRef,
  $style: e.$style,
  onClick: () => {
    c(e);
  },
  children: [/* @__PURE__ */ a(d, {
    children: e.value ? e.value.format(e.format || u) : s("time.placeholder")
  }), e.suffixIcon]
}), V = (e) => /* @__PURE__ */ g(v, {
  ref: e.viewRef,
  $style: e.$style,
  children: [/* @__PURE__ */ a(d, {
    onClick: () => c({
      ...e,
      value: e.start,
      onChange: (t) => e.onChange(t, e.end)
    }),
    children: e.start ? e.start.format(e.format || u) : s("time.startTime")
  }), /* @__PURE__ */ a(j, {}), /* @__PURE__ */ a(d, {
    onClick: () => c({
      ...e,
      value: e.end,
      onChange: (t) => e.onChange(e.start, t)
    }),
    children: e.end ? e.end.format(e.format || u) : s("time.endTime")
  }), e.suffixIcon]
});
export {
  P as TimeMobileUIView,
  V as TimeRangeMobileUIView
};
