import { bQ as r, gy as b, b9 as i, c9 as k, bR as c, V as t, gz as m, gA as u, gB as f, P as x, bh as v, a0 as w, bW as y, bT as g, f6 as C, ba as p, w as V } from "./684d2f28.js";
import { C as E } from "./9869e60a.js";
import { ColumnValueTooltip as D } from "./d404aae1.js";
import { useState as F } from "react";
import "react-dom";
import "./b1144c16.js";
import "./926d8ea1.js";
import "./d6402597.js";
r.extend(b);
const P = i(u)`
  transform: rotate(180deg);
`, T = i(f)`
  transform: rotate(180deg);
`, I = i(C)`
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  padding: 0;
  padding-left: 11px;
  .ant-picker-input {
    height: 100%;
  }
  input {
    padding-right: 18px;
    cursor: pointer;
  }
  &.ant-picker-focused .ant-picker-suffix svg g {
    stroke: ${(e) => e.$open && "#315EFB"};
  }
  .ant-picker-suffix {
    height: calc(100% - 1px);
    position: absolute;
    right: 0;
    top: 0.5px;
    display: flex;
    align-items: center;
    background: #fff;
    padding: 0 3px;
    border-left: 1px solid #d7d9e0;
  }
`, N = i.div`
  .ant-picker-header {
    padding: 0 12px;
    .ant-picker-header-super-prev-btn,
    .ant-picker-header-prev-btn,
    .ant-picker-header-next-btn,
    .ant-picker-header-super-next-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      svg {
        max-width: 12px;
        max-height: 12px;
      }
      &:hover svg g {
        fill: #315efb;
      }
    }
  }
  .ant-picker-date-panel .ant-picker-body {
    padding: 8px 16px;
  }
  .ant-picker-ranges {
    padding: 10px 16px;
  }
  .ant-picker-now-btn {
    color: #4965f2;
    &:hover {
      color: #315efb;
    }
  }
  .ant-picker-cell {
    color: #b8b9bf;
  }
  .ant-picker-cell-in-view {
    color: rgba(0, 0, 0, 0.85);
  }
  .ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner,
  .ant-picker-ok .ant-btn-primary {
    background: #4965f2;
    border: none;
    box-shadow: none;
    &:hover {
      background: #315efb;
      border: none;
      box-shadow: none;
    }
  }
  .ant-picker-cell:hover:not(.ant-picker-cell-in-view) .ant-picker-cell-inner,
  .ant-picker-cell:hover:not(.ant-picker-cell-selected):not(.ant-picker-cell-range-start):not(.ant-picker-cell-range-end):not(.ant-picker-cell-range-hover-start):not(.ant-picker-cell-range-hover-end)
    .ant-picker-cell-inner {
    background-color: #f2f7fc;
    color: #4965f2;
  }
  .ant-picker-year-panel,
  .ant-picker-month-panel {
    & + div .ant-picker-now {
      display: none;
    }
  }
`, R = i.div`
  background: transparent !important;
`;
function s(e, o) {
  let n = r(e);
  return k.isNumber(Number(e)) && e !== "" && (n = r(Number(e))), n.isValid() || (n = r.utc(e).local()), n.isValid() ? n.format(o) : "";
}
const S = {
  text: p,
  format: V(p, g)
}, d = (e) => e.text, B = (e) => {
  const [o, n] = F(!0);
  let l = r(e.value, c);
  return l.isValid() || (l = r(0, c)), /* @__PURE__ */ t(R, {
    onKeyDown: (a) => {
      a.key === "Enter" && !o && e.onChangeEnd();
    },
    children: /* @__PURE__ */ t(I, {
      $open: o,
      suffixIcon: /* @__PURE__ */ t(m, {}),
      prevIcon: /* @__PURE__ */ t(u, {}),
      nextIcon: /* @__PURE__ */ t(P, {}),
      superNextIcon: /* @__PURE__ */ t(T, {}),
      superPrevIcon: /* @__PURE__ */ t(f, {}),
      allowClear: !1,
      variant: "borderless",
      autoFocus: !0,
      defaultValue: l,
      showTime: e.showTime,
      showNow: !0,
      defaultOpen: !0,
      panelRender: (a) => /* @__PURE__ */ t(N, {
        children: a
      }),
      popupStyle: {
        borderRadius: "8px",
        boxShadow: "0 0 10px 0 rgba(0,0,0,0.10)",
        overflow: "hidden"
      },
      onOpenChange: (a) => n(a),
      onChange: (a, h) => e.onChange(h),
      onBlur: e.onChangeEnd
    })
  });
}, Q = function() {
  return new E(S, (e, o) => {
    const n = e.changeValue ?? d(e);
    return s(n, e.format);
  }, (e) => s(e.text.value, e.format.value), d).setEditViewFn((e) => /* @__PURE__ */ t(B, {
    value: e.value,
    onChange: e.onChange,
    onChangeEnd: e.onChangeEnd,
    showTime: !1
  })).setPropertyViewFn((e) => /* @__PURE__ */ x(v, {
    children: [e.text.propertyView({
      label: w("table.columnValue"),
      tooltip: D
    }), y({
      children: e,
      placeholder: g
    })]
  })).build();
}();
export {
  Q as DateComp,
  B as DateEdit,
  s as formatDate
};
