UNPKG

mealcomes

Version:

MealComes 用于学习前端的组件库

2,955 lines 80.7 kB
import { defineComponent as W, computed as V, createElementBlock as K, openBlock as F, normalizeStyle as ke, normalizeClass as P, unref as d, renderSlot as H, ref as N, createBlock as Q, createCommentVNode as X, Fragment as pe, withCtx as x, resolveDynamicComponent as we, nextTick as De, createElementVNode as U, renderList as Se, toDisplayString as ue, createVNode as te, createTextVNode as ie, createSlots as Te, normalizeProps as tt, guardReactiveProps as nt, withDirectives as at, vModelCheckbox as st, provide as Ce, inject as Re, useSlots as Le, onMounted as ye, useAttrs as rt, watch as me, resolveComponent as ot, mergeProps as Fe, toRef as lt, reactive as it, withModifiers as $e, shallowRef as ut, withKeys as ct, onUpdated as dt, onBeforeMount as ft, h as pt } from "vue";
import mt from "async-validator";
function le(e, o, n, t) {
  return o && (e += `-${o}`), n && (e += `__${n}`), t && (e += `--${t}`), e;
}
function yt(e) {
  return {
    b: (m = "") => le(e, m, "", ""),
    e: (m = "") => m ? le(e, "", m, "") : "",
    m: (m = "") => m ? le(e, "", "", m) : "",
    be: (m = "", f = "") => m && f ? le(e, m, f, "") : "",
    bm: (m = "", f = "") => m && f ? le(e, m, "", f) : "",
    em: (m = "", f = "") => m && f ? le(e, "", m, f) : "",
    bem: (m = "", f = "", s = "") => m && f && s ? le(e, m, f, s) : "",
    is: (m, f) => f ? `is-${m}` : ""
  };
}
function G(e) {
  const o = `mc-${e}`;
  return yt(o);
}
/**
* @vue/shared v3.5.17
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
process.env.NODE_ENV !== "production" && Object.freeze({});
process.env.NODE_ENV !== "production" && Object.freeze([]);
const _e = (e) => typeof e == "string", ht = (e) => e !== null && typeof e == "object", vt = (e) => typeof e == "number", gt = (e) => _e(e) ? !Number.isNaN(Number(e)) : !1;
function ae(e) {
  return e.install = function(o) {
    const { name: n } = e;
    o.component(n, e);
  }, e;
}
function Oe(e, o = "px") {
  if (!e) return "";
  if (vt(e) || gt(e))
    return `${e}${o}`;
  if (_e(e))
    return e;
  console.warn("binding value must be a string or number");
}
const bt = {
  /**
   * 按钮大小
   */
  size: {
    type: String
  },
  /**
   * 按钮类型
   */
  type: {
    type: String,
    validator: (e) => [
      "primary",
      "success",
      "warning",
      "danger",
      "info",
      "default",
      ""
    ].includes(e)
  },
  /**
   * 圆角
   */
  round: {
    type: Boolean,
    default: !1
  },
  /**
   * 是否加载中
   */
  loading: {
    type: Boolean,
    default: !1
  },
  /**
   * 是否禁用
   */
  disabled: {
    type: Boolean,
    default: !1
  },
  /**
   * 原始类型
   */
  nativeType: {
    type: String,
    default: "button"
  },
  iconPlacement: {
    type: String,
    default: "left"
  }
}, wt = {
  /**
   * 点击事件
   */
  click: (e) => e instanceof MouseEvent,
  /**
   * 鼠标按下事件
   */
  mousedown: (e) => e instanceof MouseEvent
}, Ee = W({
  name: "mc-node-loading",
  render() {
    return /* @__PURE__ */ React.createElement(
      "svg",
      {
        focusable: "false",
        "data-icon": "loading",
        width: "1em",
        height: "1em",
        "aria-hidden": "true",
        viewBox: "0 0 1024 1024",
        class: "mc-icon-loading"
      },
      /* @__PURE__ */ React.createElement("path", { d: "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" })
    );
  }
}), $t = {
  color: String,
  size: [Number, String]
}, kt = /* @__PURE__ */ W({
  name: "mc-icon",
  __name: "icon",
  props: $t,
  setup(e) {
    const o = G("icon"), n = e, t = V(() => !n.size && !n.color ? {} : {
      ...n.size ? { "font-size": n.size + "px" } : {},
      ...n.color ? { color: n.color } : {}
    });
    return (r, i) => (F(), K("i", {
      class: P(d(o).b()),
      style: ke(t.value)
    }, [
      H(r.$slots, "default")
    ], 6));
  }
}), fe = ae(kt), St = /* @__PURE__ */ W({
  name: "mc-wave",
  __name: "wave",
  setup(e, { expose: o }) {
    const n = G("wave"), t = N();
    let r;
    function i() {
      var c, u;
      r && clearTimeout(r), (c = t.value) == null || c.classList.remove(n.is("waving", !0)), document.body.offsetHeight, (u = t.value) == null || u.classList.add(n.is("waving", !0)), r = setTimeout(() => {
        var h;
        (h = t.value) == null || h.classList.remove(n.is("waving", !0));
      }, 400);
    }
    return o({
      wave: i
    }), (c, u) => (F(), K("div", {
      ref_key: "waveRef",
      ref: t,
      class: P([d(n).b()])
    }, null, 2));
  }
}), Mt = ["type", "disabled"], Dt = { key: 2 }, Et = /* @__PURE__ */ W({
  name: "mc-button",
  inheritAttrs: !1,
  __name: "button",
  props: bt,
  emits: wt,
  setup(e, { emit: o }) {
    const n = G("button"), t = e, r = o, i = N(!1), c = N();
    let u;
    function h() {
      u && clearTimeout(u);
    }
    function m() {
      h(), i.value = !0, De(() => {
        var a;
        (a = c.value) == null || a.wave();
      }), u = setTimeout(() => {
        i.value = !1;
      }, 1e3);
    }
    function f(a) {
      t.loading || (m(), r("click", a));
    }
    function s(a) {
      r("mousedown", a);
    }
    return (a, C) => (F(), K("button", {
      class: P([
        d(n).b(),
        d(n).m(a.type),
        d(n).m(a.size),
        d(n).is("loading", a.loading),
        d(n).is("disabled", a.disabled),
        d(n).is("round", a.round)
      ]),
      type: a.nativeType,
      disabled: a.disabled || a.loading,
      onClick: f,
      onMousedown: s
    }, [
      a.loading && a.iconPlacement === "left" ? (F(), K(pe, { key: 0 }, [
        a.$slots.loading ? H(a.$slots, "loading", { key: 0 }) : (F(), Q(d(fe), { key: 1 }, {
          default: x(() => [
            (F(), Q(we(d(Ee))))
          ]),
          _: 1
        }))
      ], 64)) : a.$slots.icon && a.iconPlacement === "left" ? (F(), Q(d(fe), { key: 1 }, {
        default: x(() => [
          a.$slots.icon ? (F(), Q(we(a.$slots.icon), { key: 0 })) : H(a.$slots, "icon", { key: 1 })
        ]),
        _: 3
      })) : X("", !0),
      a.$slots.default ? (F(), K("span", Dt, [
        H(a.$slots, "default")
      ])) : X("", !0),
      a.loading && a.iconPlacement === "right" ? (F(), K(pe, { key: 3 }, [
        a.$slots.loading ? H(a.$slots, "loading", { key: 0 }) : (F(), Q(d(fe), { key: 1 }, {
          default: x(() => [
            (F(), Q(we(d(Ee))))
          ]),
          _: 1
        }))
      ], 64)) : a.$slots.icon && a.iconPlacement === "right" ? (F(), Q(d(fe), { key: 4 }, {
        default: x(() => [
          a.$slots.icon ? (F(), Q(we(a.$slots.icon), { key: 0 })) : H(a.$slots, "icon", { key: 1 })
        ]),
        _: 3
      })) : X("", !0),
      i.value ? (F(), Q(St, {
        key: 5,
        ref_key: "waveRef",
        ref: c
      }, null, 512)) : X("", !0)
    ], 42, Mt));
  }
}), de = ae(Et), Ct = {
  modelValue: {
    type: Date
  },
  /**
   * 时间范围
   */
  range: {
    type: Array
  },
  /**
   * 是否为缩小版
   */
  mini: {
    type: Boolean,
    default: !0
  }
}, Rt = {
  "update:modelValue": (e) => e instanceof Date
}, Lt = (e, o) => {
  const n = e.subtract(1, "month").endOf("month").date();
  return Array.from({ length: o }).map(
    (t, r) => n - (o - r - 1)
  );
}, Ft = (e) => {
  const o = e.daysInMonth();
  return Array.from({ length: o }).map((n, t) => t + 1);
}, Ot = (e) => Array.from({ length: e.length / 7 }).map((o, n) => {
  const t = n * 7;
  return e.slice(t, t + 7);
}), zt = {
  /**
   * 当前选中的天
   */
  selectedDay: {
    type: Object
  },
  /**
   * 日期范围
   */
  range: {
    type: Array
  },
  /**
   * 当前的日期
   */
  date: {
    type: Object,
    required: !0
  },
  /**
   * 隐藏头部
   */
  hideHeader: {
    type: Boolean
  }
}, At = {
  /**
   * 当选中了某个日期的时候触发
   */
  pick: (e) => ht(e)
};
var Ke = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Ve(e) {
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var Ie = { exports: {} };
(function(e, o) {
  (function(n, t) {
    e.exports = t();
  })(Ke, function() {
    var n = 1e3, t = 6e4, r = 36e5, i = "millisecond", c = "second", u = "minute", h = "hour", m = "day", f = "week", s = "month", a = "quarter", C = "year", w = "date", k = "Invalid Date", M = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, l = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, D = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(v) {
      var y = ["th", "st", "nd", "rd"], p = v % 100;
      return "[" + v + (y[(p - 20) % 10] || y[p] || y[0]) + "]";
    } }, b = function(v, y, p) {
      var E = String(v);
      return !E || E.length >= y ? v : "" + Array(y + 1 - E.length).join(p) + v;
    }, L = { s: b, z: function(v) {
      var y = -v.utcOffset(), p = Math.abs(y), E = Math.floor(p / 60), g = p % 60;
      return (y <= 0 ? "+" : "-") + b(E, 2, "0") + ":" + b(g, 2, "0");
    }, m: function v(y, p) {
      if (y.date() < p.date()) return -v(p, y);
      var E = 12 * (p.year() - y.year()) + (p.month() - y.month()), g = y.clone().add(E, s), z = p - g < 0, A = y.clone().add(E + (z ? -1 : 1), s);
      return +(-(E + (p - g) / (z ? g - A : A - g)) || 0);
    }, a: function(v) {
      return v < 0 ? Math.ceil(v) || 0 : Math.floor(v);
    }, p: function(v) {
      return { M: s, y: C, w: f, d: m, D: w, h, m: u, s: c, ms: i, Q: a }[v] || String(v || "").toLowerCase().replace(/s$/, "");
    }, u: function(v) {
      return v === void 0;
    } }, $ = "en", R = {};
    R[$] = D;
    var B = "$isDayjsObject", I = function(v) {
      return v instanceof S || !(!v || !v[B]);
    }, O = function v(y, p, E) {
      var g;
      if (!y) return $;
      if (typeof y == "string") {
        var z = y.toLowerCase();
        R[z] && (g = z), p && (R[z] = p, g = z);
        var A = y.split("-");
        if (!g && A.length > 1) return v(A[0]);
      } else {
        var q = y.name;
        R[q] = y, g = q;
      }
      return !E && g && ($ = g), g || !E && $;
    }, T = function(v, y) {
      if (I(v)) return v.clone();
      var p = typeof y == "object" ? y : {};
      return p.date = v, p.args = arguments, new S(p);
    }, _ = L;
    _.l = O, _.i = I, _.w = function(v, y) {
      return T(v, { locale: y.$L, utc: y.$u, x: y.$x, $offset: y.$offset });
    };
    var S = function() {
      function v(p) {
        this.$L = O(p.locale, null, !0), this.parse(p), this.$x = this.$x || p.x || {}, this[B] = !0;
      }
      var y = v.prototype;
      return y.parse = function(p) {
        this.$d = function(E) {
          var g = E.date, z = E.utc;
          if (g === null) return /* @__PURE__ */ new Date(NaN);
          if (_.u(g)) return /* @__PURE__ */ new Date();
          if (g instanceof Date) return new Date(g);
          if (typeof g == "string" && !/Z$/i.test(g)) {
            var A = g.match(M);
            if (A) {
              var q = A[2] - 1 || 0, Y = (A[7] || "0").substring(0, 3);
              return z ? new Date(Date.UTC(A[1], q, A[3] || 1, A[4] || 0, A[5] || 0, A[6] || 0, Y)) : new Date(A[1], q, A[3] || 1, A[4] || 0, A[5] || 0, A[6] || 0, Y);
            }
          }
          return new Date(g);
        }(p), this.init();
      }, y.init = function() {
        var p = this.$d;
        this.$y = p.getFullYear(), this.$M = p.getMonth(), this.$D = p.getDate(), this.$W = p.getDay(), this.$H = p.getHours(), this.$m = p.getMinutes(), this.$s = p.getSeconds(), this.$ms = p.getMilliseconds();
      }, y.$utils = function() {
        return _;
      }, y.isValid = function() {
        return this.$d.toString() !== k;
      }, y.isSame = function(p, E) {
        var g = T(p);
        return this.startOf(E) <= g && g <= this.endOf(E);
      }, y.isAfter = function(p, E) {
        return T(p) < this.startOf(E);
      }, y.isBefore = function(p, E) {
        return this.endOf(E) < T(p);
      }, y.$g = function(p, E, g) {
        return _.u(p) ? this[E] : this.set(g, p);
      }, y.unix = function() {
        return Math.floor(this.valueOf() / 1e3);
      }, y.valueOf = function() {
        return this.$d.getTime();
      }, y.startOf = function(p, E) {
        var g = this, z = !!_.u(E) || E, A = _.p(p), q = function(oe, ee) {
          var se = _.w(g.$u ? Date.UTC(g.$y, ee, oe) : new Date(g.$y, ee, oe), g);
          return z ? se : se.endOf(m);
        }, Y = function(oe, ee) {
          return _.w(g.toDate()[oe].apply(g.toDate("s"), (z ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(ee)), g);
        }, J = this.$W, Z = this.$M, ne = this.$D, ce = "set" + (this.$u ? "UTC" : "");
        switch (A) {
          case C:
            return z ? q(1, 0) : q(31, 11);
          case s:
            return z ? q(1, Z) : q(0, Z + 1);
          case f:
            var re = this.$locale().weekStart || 0, he = (J < re ? J + 7 : J) - re;
            return q(z ? ne - he : ne + (6 - he), Z);
          case m:
          case w:
            return Y(ce + "Hours", 0);
          case h:
            return Y(ce + "Minutes", 1);
          case u:
            return Y(ce + "Seconds", 2);
          case c:
            return Y(ce + "Milliseconds", 3);
          default:
            return this.clone();
        }
      }, y.endOf = function(p) {
        return this.startOf(p, !1);
      }, y.$set = function(p, E) {
        var g, z = _.p(p), A = "set" + (this.$u ? "UTC" : ""), q = (g = {}, g[m] = A + "Date", g[w] = A + "Date", g[s] = A + "Month", g[C] = A + "FullYear", g[h] = A + "Hours", g[u] = A + "Minutes", g[c] = A + "Seconds", g[i] = A + "Milliseconds", g)[z], Y = z === m ? this.$D + (E - this.$W) : E;
        if (z === s || z === C) {
          var J = this.clone().set(w, 1);
          J.$d[q](Y), J.init(), this.$d = J.set(w, Math.min(this.$D, J.daysInMonth())).$d;
        } else q && this.$d[q](Y);
        return this.init(), this;
      }, y.set = function(p, E) {
        return this.clone().$set(p, E);
      }, y.get = function(p) {
        return this[_.p(p)]();
      }, y.add = function(p, E) {
        var g, z = this;
        p = Number(p);
        var A = _.p(E), q = function(Z) {
          var ne = T(z);
          return _.w(ne.date(ne.date() + Math.round(Z * p)), z);
        };
        if (A === s) return this.set(s, this.$M + p);
        if (A === C) return this.set(C, this.$y + p);
        if (A === m) return q(1);
        if (A === f) return q(7);
        var Y = (g = {}, g[u] = t, g[h] = r, g[c] = n, g)[A] || 1, J = this.$d.getTime() + p * Y;
        return _.w(J, this);
      }, y.subtract = function(p, E) {
        return this.add(-1 * p, E);
      }, y.format = function(p) {
        var E = this, g = this.$locale();
        if (!this.isValid()) return g.invalidDate || k;
        var z = p || "YYYY-MM-DDTHH:mm:ssZ", A = _.z(this), q = this.$H, Y = this.$m, J = this.$M, Z = g.weekdays, ne = g.months, ce = g.meridiem, re = function(ee, se, ve, be) {
          return ee && (ee[se] || ee(E, z)) || ve[se].slice(0, be);
        }, he = function(ee) {
          return _.s(q % 12 || 12, ee, "0");
        }, oe = ce || function(ee, se, ve) {
          var be = ee < 12 ? "AM" : "PM";
          return ve ? be.toLowerCase() : be;
        };
        return z.replace(l, function(ee, se) {
          return se || function(ve) {
            switch (ve) {
              case "YY":
                return String(E.$y).slice(-2);
              case "YYYY":
                return _.s(E.$y, 4, "0");
              case "M":
                return J + 1;
              case "MM":
                return _.s(J + 1, 2, "0");
              case "MMM":
                return re(g.monthsShort, J, ne, 3);
              case "MMMM":
                return re(ne, J);
              case "D":
                return E.$D;
              case "DD":
                return _.s(E.$D, 2, "0");
              case "d":
                return String(E.$W);
              case "dd":
                return re(g.weekdaysMin, E.$W, Z, 2);
              case "ddd":
                return re(g.weekdaysShort, E.$W, Z, 3);
              case "dddd":
                return Z[E.$W];
              case "H":
                return String(q);
              case "HH":
                return _.s(q, 2, "0");
              case "h":
                return he(1);
              case "hh":
                return he(2);
              case "a":
                return oe(q, Y, !0);
              case "A":
                return oe(q, Y, !1);
              case "m":
                return String(Y);
              case "mm":
                return _.s(Y, 2, "0");
              case "s":
                return String(E.$s);
              case "ss":
                return _.s(E.$s, 2, "0");
              case "SSS":
                return _.s(E.$ms, 3, "0");
              case "Z":
                return A;
            }
            return null;
          }(ee) || A.replace(":", "");
        });
      }, y.utcOffset = function() {
        return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
      }, y.diff = function(p, E, g) {
        var z, A = this, q = _.p(E), Y = T(p), J = (Y.utcOffset() - this.utcOffset()) * t, Z = this - Y, ne = function() {
          return _.m(A, Y);
        };
        switch (q) {
          case C:
            z = ne() / 12;
            break;
          case s:
            z = ne();
            break;
          case a:
            z = ne() / 3;
            break;
          case f:
            z = (Z - J) / 6048e5;
            break;
          case m:
            z = (Z - J) / 864e5;
            break;
          case h:
            z = Z / r;
            break;
          case u:
            z = Z / t;
            break;
          case c:
            z = Z / n;
            break;
          default:
            z = Z;
        }
        return g ? z : _.a(z);
      }, y.daysInMonth = function() {
        return this.endOf(s).$D;
      }, y.$locale = function() {
        return R[this.$L];
      }, y.locale = function(p, E) {
        if (!p) return this.$L;
        var g = this.clone(), z = O(p, E, !0);
        return z && (g.$L = z), g;
      }, y.clone = function() {
        return _.w(this.$d, this);
      }, y.toDate = function() {
        return new Date(this.valueOf());
      }, y.toJSON = function() {
        return this.isValid() ? this.toISOString() : null;
      }, y.toISOString = function() {
        return this.$d.toISOString();
      }, y.toString = function() {
        return this.$d.toUTCString();
      }, v;
    }(), j = S.prototype;
    return T.prototype = j, [["$ms", i], ["$s", c], ["$m", u], ["$H", h], ["$W", m], ["$M", s], ["$y", C], ["$D", w]].forEach(function(v) {
      j[v[1]] = function(y) {
        return this.$g(y, v[0], v[1]);
      };
    }), T.extend = function(v, y) {
      return v.$i || (v(y, S, T), v.$i = !0), T;
    }, T.locale = O, T.isDayjs = I, T.unix = function(v) {
      return T(1e3 * v);
    }, T.en = R[$], T.Ls = R, T.p = {}, T;
  });
})(Ie);
var Pt = Ie.exports;
const ge = /* @__PURE__ */ Ve(Pt);
var je = { exports: {} };
(function(e, o) {
  (function(n, t) {
    e.exports = t();
  })(Ke, function() {
    return function(n, t, r) {
      var i = t.prototype, c = function(s) {
        return s && (s.indexOf ? s : s.s);
      }, u = function(s, a, C, w, k) {
        var M = s.name ? s : s.$locale(), l = c(M[a]), D = c(M[C]), b = l || D.map(function($) {
          return $.slice(0, w);
        });
        if (!k) return b;
        var L = M.weekStart;
        return b.map(function($, R) {
          return b[(R + (L || 0)) % 7];
        });
      }, h = function() {
        return r.Ls[r.locale()];
      }, m = function(s, a) {
        return s.formats[a] || function(C) {
          return C.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(w, k, M) {
            return k || M.slice(1);
          });
        }(s.formats[a.toUpperCase()]);
      }, f = function() {
        var s = this;
        return { months: function(a) {
          return a ? a.format("MMMM") : u(s, "months");
        }, monthsShort: function(a) {
          return a ? a.format("MMM") : u(s, "monthsShort", "months", 3);
        }, firstDayOfWeek: function() {
          return s.$locale().weekStart || 0;
        }, weekdays: function(a) {
          return a ? a.format("dddd") : u(s, "weekdays");
        }, weekdaysMin: function(a) {
          return a ? a.format("dd") : u(s, "weekdaysMin", "weekdays", 2);
        }, weekdaysShort: function(a) {
          return a ? a.format("ddd") : u(s, "weekdaysShort", "weekdays", 3);
        }, longDateFormat: function(a) {
          return m(s.$locale(), a);
        }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
      };
      i.localeData = function() {
        return f.bind(this)();
      }, r.localeData = function() {
        var s = h();
        return { firstDayOfWeek: function() {
          return s.weekStart || 0;
        }, weekdays: function() {
          return r.weekdays();
        }, weekdaysShort: function() {
          return r.weekdaysShort();
        }, weekdaysMin: function() {
          return r.weekdaysMin();
        }, months: function() {
          return r.months();
        }, monthsShort: function() {
          return r.monthsShort();
        }, longDateFormat: function(a) {
          return m(s, a);
        }, meridiem: s.meridiem, ordinal: s.ordinal };
      }, r.months = function() {
        return u(h(), "months");
      }, r.monthsShort = function() {
        return u(h(), "monthsShort", "months", 3);
      }, r.weekdays = function(s) {
        return u(h(), "weekdays", null, null, s);
      }, r.weekdaysShort = function(s) {
        return u(h(), "weekdaysShort", "weekdays", 3, s);
      }, r.weekdaysMin = function(s) {
        return u(h(), "weekdaysMin", "weekdays", 2, s);
      };
    };
  });
})(je);
var Bt = je.exports;
const Tt = /* @__PURE__ */ Ve(Bt), Yn = ["", "default", "small", "large"], xn = {
  large: 40,
  default: 32,
  small: 24
}, Me = [
  "星期日",
  "星期一",
  "星期二",
  "星期三",
  "星期四",
  "星期五",
  "星期六"
], _t = { key: 0 }, Kt = ["onClick"], Vt = /* @__PURE__ */ W({
  name: "date-table",
  __name: "date-table",
  props: zt,
  emits: At,
  setup(e, { emit: o }) {
    const n = G("calendar-table"), t = G("calendar-day"), r = e, i = o, c = ge();
    ge.extend(Tt);
    const u = ge.localeData().firstDayOfWeek(), h = V(() => {
      const k = u;
      return k === 0 ? Me.map((M) => M.slice(2)) : Me.slice(k).concat(Me.slice(0, k)).map((M) => M.slice(2));
    }), m = V(() => {
      let k = [];
      if (f.value) {
        const [M, l] = r.range, D = Array.from({
          length: l.date() - M.date() + 1
        }).map(($, R) => ({
          text: M.date() + R,
          type: "current"
        }));
        let b = D.length % 7;
        b = b === 0 ? 0 : 7 - b;
        const L = Array.from({
          length: b
        }).map(($, R) => ({
          text: R + 1,
          type: "next"
        }));
        k = D.concat(L);
      } else {
        const M = r.date.startOf("month").day(), l = Lt(
          r.date,
          (M - u + 7) % 7
        ).map(($) => ({
          text: $,
          type: "prev"
        })), D = Ft(
          r.date
        ).map(($) => ({
          text: $,
          type: "current"
        }));
        k = [...l, ...D];
        const b = 42 - k.length, L = Array.from({
          length: b
        }).map(($, R) => ({
          text: R + 1,
          type: "next"
        }));
        k = k.concat(L);
      }
      return Ot(k);
    }), f = V(() => !!r.range && !!r.range.length), s = (k, M) => {
      switch (M) {
        case "prev":
          return r.date.startOf("month").subtract(1, "month").date(k);
        case "next":
          return r.date.startOf("month").add(1, "month").date(k);
        case "current":
          return r.date.date(k);
      }
    }, a = ({ text: k, type: M }) => {
      const l = s(k, M);
      return {
        isSelected: l.isSame(r.selectedDay),
        type: `${M}-month`,
        day: l.format("YYYY-MM-DD"),
        date: l.toDate()
      };
    }, C = ({ text: k, type: M }) => {
      const l = [M];
      if (M === "current") {
        const D = s(k, M);
        D.isSame(r.selectedDay, "day") && l.push(t.is("selected", !0)), D.isSame(c, "day") && l.push(t.is("today", !0));
      }
      return l;
    }, w = ({ text: k, type: M }) => {
      const l = s(k, M);
      i("pick", l);
    };
    return (k, M) => (F(), K("table", {
      class: P([d(n).b(), d(n).is("range", f.value)]),
      cellspacing: "0",
      cellpadding: "0"
    }, [
      k.hideHeader ? X("", !0) : (F(), K("thead", _t, [
        U("tr", null, [
          (F(!0), K(pe, null, Se(h.value, (l) => (F(), K("th", {
            key: l,
            scope: "col"
          }, ue(l), 1))), 128))
        ])
      ])),
      U("tbody", null, [
        (F(!0), K(pe, null, Se(m.value, (l, D) => (F(), K("tr", {
          key: D,
          class: P({
            [d(n).e("row")]: !0,
            [d(n).em("row", "hide-border")]: D === 0 && k.hideHeader
          })
        }, [
          (F(!0), K(pe, null, Se(l, (b, L) => (F(), K("td", {
            key: L,
            class: P(C(b)),
            onClick: ($) => w(b)
          }, [
            U("div", {
              class: P(d(t).b())
            }, [
              H(k.$slots, "date-cell", {
                data: a(b)
              }, () => [
                U("span", null, ue(b.text), 1)
              ])
            ], 2)
          ], 10, Kt))), 128))
        ], 2))), 128))
      ])
    ], 2));
  }
}), It = /* @__PURE__ */ W({
  name: "mc-calendar",
  __name: "calendar",
  props: Ct,
  emits: Rt,
  setup(e, { expose: o, emit: n }) {
    const t = G("calendar"), r = e, i = n, c = ge(), u = N(), h = V(() => r.modelValue ? ge(r.modelValue) : c), m = V(
      () => `${h.value.year()} - ${h.value.format("M")}`
    ), f = V({
      get() {
        return r.modelValue ? h.value : u.value;
      },
      set(l) {
        if (!l) return;
        u.value = l;
        const D = l.toDate();
        i("update:modelValue", D);
      }
    }), s = (l) => {
      f.value = l;
    }, a = V(() => h.value.subtract(1, "month").date(1)), C = V(() => h.value.add(1, "month").date(1)), w = V(() => h.value.subtract(1, "year").date(1)), k = V(() => h.value.add(1, "year").date(1)), M = (l) => {
      const b = {
        "prev-month": a.value,
        "next-month": C.value,
        "prev-year": w.value,
        "next-year": k.value,
        today: c
      }[l];
      b.isSame(h.value, "day") || s(b);
    };
    return o({
      /** 当前选中的日期 */
      selectedDay: f,
      /** 选择指定的某一天 */
      pickDay: s,
      /** 选择日期 */
      selectDate: M
    }), (l, D) => (F(), K("div", {
      class: P([d(t).b(), d(t).is("mini", l.mini)])
    }, [
      U("div", {
        class: P(d(t).e("header"))
      }, [
        H(l.$slots, "header", { data: m.value }, () => [
          U("div", {
            class: P(d(t).e("title"))
          }, ue(m.value), 3),
          U("div", {
            class: P(d(t).e("button-group"))
          }, [
            te(d(de), {
              size: "small",
              onClick: D[0] || (D[0] = (b) => M("prev-year"))
            }, {
              default: x(() => D[5] || (D[5] = [
                ie("前一年")
              ])),
              _: 1,
              __: [5]
            }),
            te(d(de), {
              size: "small",
              onClick: D[1] || (D[1] = (b) => M("prev-month"))
            }, {
              default: x(() => D[6] || (D[6] = [
                ie("上个月")
              ])),
              _: 1,
              __: [6]
            }),
            te(d(de), {
              size: "small",
              onClick: D[2] || (D[2] = (b) => M("today"))
            }, {
              default: x(() => D[7] || (D[7] = [
                ie("今天")
              ])),
              _: 1,
              __: [7]
            }),
            te(d(de), {
              size: "small",
              onClick: D[3] || (D[3] = (b) => M("next-month"))
            }, {
              default: x(() => D[8] || (D[8] = [
                ie("下个月")
              ])),
              _: 1,
              __: [8]
            }),
            te(d(de), {
              size: "small",
              onClick: D[4] || (D[4] = (b) => M("next-year"))
            }, {
              default: x(() => D[9] || (D[9] = [
                ie("后一年")
              ])),
              _: 1,
              __: [9]
            })
          ], 2)
        ])
      ], 2),
      l.range ? X("", !0) : (F(), K("div", {
        key: 0,
        class: P(d(t).e("body"))
      }, [
        te(Vt, {
          class: P([d(t).is("mini", l.mini)]),
          date: h.value,
          "selected-day": f.value,
          onPick: s
        }, Te({ _: 2 }, [
          l.$slots["date-cell"] ? {
            name: "date-cell",
            fn: x((b) => [
              H(l.$slots, "date-cell", tt(nt(b)))
            ]),
            key: "0"
          } : void 0
        ]), 1032, ["class", "date", "selected-day"])
      ], 2))
    ], 2));
  }
}), jt = ae(It), Nt = {
  /**
   * 是否选中
   */
  modelValue: {
    type: [Boolean, String, Number]
  },
  /**
   * 是否半选
   */
  indeterminate: Boolean,
  /**
   * 是否禁用
   */
  disabled: {
    type: Boolean,
    default: !1
  },
  label: {
    type: String
  }
}, qt = {
  "update:modelValue": (e) => typeof e == "boolean",
  change: (e) => typeof e == "boolean"
}, Ht = ["disabled", "value"], Wt = { key: 0 }, Ut = /* @__PURE__ */ W({
  name: "mc-checkbox",
  __name: "checkbox",
  props: Nt,
  emits: qt,
  setup(e, { emit: o }) {
    const n = G("checkbox"), t = e, r = o, i = V({
      get() {
        return t.modelValue;
      },
      set(u) {
        t.disabled || r("update:modelValue", u);
      }
    });
    function c(u) {
      if (t.disabled) return;
      const h = u.target;
      r("change", h.checked);
    }
    return (u, h) => (F(), K("label", {
      class: P([d(n).b("wrapper"), d(n).is("checked", i.value), d(n).is("disabled", u.disabled)])
    }, [
      U("span", {
        class: P([
          d(n).b(),
          d(n).is("checked", i.value),
          d(n).is("disabled", u.disabled),
          d(n).is("indeterminate", u.indeterminate)
        ])
      }, [
        at(U("input", {
          type: "checkbox",
          "onUpdate:modelValue": h[0] || (h[0] = (m) => i.value = m),
          ref: "inputRef",
          disabled: u.disabled,
          value: u.label,
          onChange: c
        }, null, 40, Ht), [
          [st, i.value]
        ]),
        U("span", {
          class: P(d(n).m("inner"))
        }, null, 2)
      ], 2),
      u.$slots.default || u.label ? (F(), K("span", Wt, [
        H(u.$slots, "default"),
        u.$slots.default ? X("", !0) : (F(), K(pe, { key: 0 }, [
          ie(ue(u.label), 1)
        ], 64))
      ])) : X("", !0)
    ], 2));
  }
}), Ne = ae(Ut), Yt = {
  /**
   * 数据源
   */
  model: Object,
  /**
   * 表单校验规则
   */
  rules: {
    type: Object
  },
  /**
   * 表单是否展示错误信息
   */
  showMessage: {
    type: Boolean,
    default: !0
  }
}, qe = Symbol("_fc_k"), xt = /* @__PURE__ */ W({
  name: "mc-form",
  __name: "form",
  props: Yt,
  setup(e, { expose: o }) {
    const n = G("form"), t = e, r = [], c = {
      ...t,
      addField: (h) => {
        r.push(h);
      }
    };
    return Ce(qe, c), o({
      validate: async (h) => {
        let m = {};
        for (let f of r)
          try {
            await f.validate("");
          } catch (s) {
            m = {
              ...m,
              ...s
            };
          }
        return Object.keys(m).length === 0 ? h == null ? void 0 : h(!0) : h ? h == null ? void 0 : h(!1, m) : Promise.reject(m);
      }
    }), (h, m) => (F(), K("form", {
      class: P([d(n).b()])
    }, [
      H(h.$slots, "default")
    ], 2));
  }
}), Jn = [
  "success",
  "error",
  "validating",
  ""
], Qn = ["default", "small", "large"], He = {
  /**
   * 表单域 model 字段
   */
  prop: {
    type: String,
    default: ""
  },
  /**
   * 表单 label
   */
  label: {
    type: String,
    default: ""
  },
  /**
   * label 宽度
   */
  labelWidth: {
    type: [String, Number],
    default: ""
  },
  /**
   * 表单校验规则
   */
  rules: {
    type: [Object, Array],
    default: () => []
  },
  /**
   * 是否显示校验错误信息
   */
  showMessage: {
    type: Boolean,
    default: !0
  },
  size: {
    type: String,
    default: "default"
  }
}, We = Symbol("_fic_k");
function ze(e) {
  return e ? Array.isArray(e) ? e : [e] : [];
}
const Ue = /* @__PURE__ */ W({
  name: "mc-form-item",
  __name: "form-item",
  props: He,
  setup(e) {
    const o = G("form-item"), n = e, t = Re(qe), r = Le(), i = N("error"), c = N(""), u = V(
      () => i.value === "error" && // 表单项校验通过时不展示错误信息
      n.showMessage
    ), h = V(() => {
      const b = ze(n.rules), L = t == null ? void 0 : t.rules;
      if (L && n.prop) {
        const $ = L[n.prop];
        $ && b.push(...ze($));
      }
      return b;
    }), m = V(() => {
      const b = Oe(n.labelWidth || "");
      return b ? { width: b } : {};
    }), f = V(() => {
      if (!n.label && !n.labelWidth)
        return {};
      const b = Oe(n.labelWidth || "");
      return !n.label && !r.label ? { marginLeft: b } : {};
    }), s = V(() => !!(n.label || r.label));
    function a(b) {
      return h.value.filter(($) => !$.trigger || !b ? !0 : Array.isArray($.trigger) ? $.trigger.includes(b) : $.trigger === b);
    }
    function C(b) {
      i.value = b;
    }
    function w() {
      C("success");
    }
    function k(b) {
      var R;
      const { errors: L, fields: $ } = b;
      (!L || !$) && console.error(b), C("error"), c.value = L ? ((R = L == null ? void 0 : L[0]) == null ? void 0 : R.message) ?? `${n.prop} is required` : "";
    }
    const M = async (b) => {
      const L = n.prop, $ = new mt({
        [L]: b
      }), R = (t == null ? void 0 : t.model) || {};
      return $.validate({
        [L]: R[L]
      }).then(() => (w(), !0)).catch((B) => (k(B), Promise.reject(B)));
    }, D = {
      ...n,
      validate: async (b, L) => {
        const $ = typeof L == "function", R = a(b);
        return R.length === 0 ? (L == null || L(!0), !0) : (C("validating"), M(R).then(() => (L == null || L(!0), !0)).catch((B) => {
          const { fields: I } = B;
          return L == null || L(!1, I), $ ? !1 : Promise.reject(I);
        }));
      }
    };
    return Ce(We, D), ye(() => {
      t == null || t.addField(D);
    }), (b, L) => (F(), K("div", {
      class: P([
        d(o).b(),
        d(o).is("error", i.value === "error"),
        d(o).is("validating", i.value === "validating"),
        d(o).is("success", i.value === "success"),
        d(o).m(b.size)
      ])
    }, [
      s.value ? (F(), K("div", {
        key: 0,
        class: P([d(o).e("label-wrap")])
      }, [
        U("label", {
          class: P([d(o).e("label")]),
          style: ke(m.value)
        }, [
          H(b.$slots, "label", {}, () => [
            ie(ue(b.label), 1)
          ])
        ], 6)
      ], 2)) : X("", !0),
      U("div", {
        class: P([d(o).e("content")]),
        style: ke(f.value)
      }, [
        H(b.$slots, "default"),
        u.value ? H(b.$slots, "error", {
          key: 0,
          error: c.value
        }, () => [
          U("div", {
            class: P([d(o).e("error")])
          }, ue(c.value), 3)
        ]) : X("", !0)
      ], 6)
    ], 2));
  }
}), Ye = {
  /**
   * 输入框类型
   */
  type: {
    type: String,
    default: "text"
  },
  /**
   * 输入框值
   */
  modelValue: {
    type: [String, Number],
    default: ""
  },
  /**
   * 输入框占位符
   */
  placeholder: {
    type: String,
    default: ""
  },
  /**
   * 输入框是否可清空
   */
  clearable: {
    type: Boolean,
    default: !1
  },
  /**
   * 输入框是否显示密码图标
   */
  showPassword: {
    type: Boolean,
    default: !1
  },
  /**
   * 输入框是否禁用
   */
  disabled: {
    type: Boolean,
    default: !1
  },
  /**
   * 输入框是否只读
   */
  readonly: {
    type: Boolean,
    default: !1
  },
  /**
   * 等价于原生 input aria-label 属性
   */
  ariaLabel: {
    type: String,
    default: ""
  },
  size: {
    type: String,
    default: "default"
  },
  /**
   * 	原生 autocomplete 属性
   */
  autocomplete: {
    type: String,
    default: "off"
  }
}, xe = {
  /**
   * 输入框值变化时触发
   */
  "update:modelValue": (e) => typeof e == "string",
  /**
   * 输入框输入时触发
   */
  input: (e) => typeof e == "string",
  /**
   * 输入框失焦时触发
   */
  change: (e) => typeof e == "string",
  /**
   * 输入框聚焦时触发
   */
  focus: (e) => e instanceof FocusEvent,
  /**
   * 输入框失焦时触发
   */
  blur: (e) => e instanceof FocusEvent,
  /**
   * 输入框清空时触发
   */
  clear: () => !0,
  /**
   * 按键按下触发
   */
  keydown: (e) => e instanceof KeyboardEvent
};
function Ae(e, o) {
  const n = {};
  return Array.isArray(o) || (o = [o]), Object.keys(e).forEach((t) => {
    o.includes(t) || (n[t] = e[t]);
  }), n;
}
const Jt = {
  ...Ae(Ye, "size"),
  ...Ae(He, ["label", "labelWidth"]),
  /**
   * placeholder 为 label 时的宽度
   */
  labelWidth: {
    type: [String, Number],
    default: ""
  }
}, Qt = {
  ...xe
}, Xt = W({
  name: "mv-eye",
  render() {
    return /* @__PURE__ */ React.createElement(
      "svg",
      {
        focusable: "false",
        "data-icon": "eye",
        width: "1em",
        height: "1em",
        fill: "currentColor",
        "aria-hidden": "true",
        viewBox: "64 64 896 896"
      },
      /* @__PURE__ */ React.createElement("path", { d: "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" })
    );
  }
}), Zt = W({
  name: "mc-eye-closed",
  render() {
    return /* @__PURE__ */ React.createElement(
      "svg",
      {
        focusable: "false",
        "data-icon": "eye-invisible",
        width: "1em",
        height: "1em",
        fill: "currentColor",
        "aria-hidden": "true",
        viewBox: "64 64 896 896"
      },
      /* @__PURE__ */ React.createElement("path", { d: "M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z" }),
      /* @__PURE__ */ React.createElement("path", { d: "M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z" })
    );
  }
}), Gt = W({
  name: "mc-close-circle",
  render() {
    return /* @__PURE__ */ React.createElement(
      "svg",
      {
        focusable: "false",
        "data-icon": "close-circle",
        width: "1em",
        height: "1em",
        fill: "currentColor",
        "aria-hidden": "true",
        "fill-rule": "evenodd",
        viewBox: "64 64 896 896"
      },
      /* @__PURE__ */ React.createElement("path", { d: "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z" })
    );
  }
}), en = ["type", "autocomplete", "placeholder", "disabled", "readonly", "aria-label"], tn = /* @__PURE__ */ W({
  name: "mc-input",
  inheritAttrs: !1,
  __name: "input",
  props: Ye,
  emits: xe,
  setup(e, { emit: o }) {
    const n = rt(), t = G("input"), r = e, i = o, c = Le(), u = Re(We, void 0), h = V(
      () => !!c.suffix || D.value || r.showPassword
    ), m = N(), f = N(!1);
    me(
      () => r.modelValue,
      () => {
        u == null || u.validate("change").catch((O) => console.warn(O)), a();
      }
    );
    const s = V(
      () => r.modelValue === void 0 || r.modelValue === null ? "" : String(r.modelValue)
    );
    function a() {
      const O = m.value;
      !O || O.value === s.value || (O.value = s.value);
    }
    async function C() {
      var O;
      await De(), (O = m.value) == null || O.focus();
    }
    const w = V(() => (u == null ? void 0 : u.size) || r.size), k = N(!1);
    function M() {
      k.value = !k.value, C();
    }
    const l = V(() => !!r.modelValue && r.showPassword && !r.disabled && !r.readonly), D = V(() => !!r.modelValue && !r.disabled && !r.readonly && r.clearable);
    function b() {
      i("input", ""), i("update:modelValue", ""), i("clear"), C();
    }
    ye(() => {
      a();
    });
    const L = async (O) => {
      const { value: T } = O.target;
      if (T === s.value) {
        a();
        return;
      }
      i("input", T), i("update:modelValue", T), await De(), a();
    }, $ = (O) => {
      const T = O.target;
      i("change", T.value);
    }, R = (O) => {
      f.value = !0, i("focus", O);
    }, B = (O) => {
      u == null || u.validate("blur").catch((T) => console.warn(T)), f.value = !1, i("blur", O);
    }, I = (O) => {
      i("keydown", O);
    };
    return (O, T) => {
      const _ = ot("mc-icon");
      return F(), K("div", {
        class: P([
          d(t).b(),
          {
            [d(t).b("group")]: O.$slots.prepend || O.$slots.append,
            [d(t).bm("group", "append")]: O.$slots.append,
            [d(t).bm("group", "prepend")]: O.$slots.prepend
          },
          d(t).is("disabled", O.disabled),
          d(t).m(w.value)
        ])
      }, [
        O.$slots.prepend ? (F(), K("div", {
          key: 0,
          class: P([d(t).be("group", "prepend")])
        }, [
          H(O.$slots, "prepend")
        ], 2)) : X("", !0),
        U("div", {
          class: P([d(t).e("wrapper"), d(t).is("focus", f.value)])
        }, [
          O.$slots.prefix ? (F(), K("span", {
            key: 0,
            class: P([d(t).e("prefix")])
          }, [
            U("span", {
              class: P([d(t).e("prefix-inner")])
            }, [
              H(O.$slots, "prefix")
            ], 2)
          ], 2)) : X("", !0),
          U("input", Fe({
            ref_key: "inputRef",
            ref: m,
            type: O.showPassword ? k.value ? "text" : "password" : O.type,
            autocomplete: O.autocomplete,
            placeholder: O.placeholder,
            class: [d(t).e("inner")]
          }, d(n), {
            disabled: O.disabled,
            readonly: O.readonly,
            "aria-label": O.ariaLabel,
            onInput: L,
            onChange: $,
            onBlur: B,
            onFocus: R,
            onKeydown: I
          }), null, 16, en),
          h.value ? (F(), K("span", {
            key: 1,
            class: P([d(t).e("suffix")])
          }, [
            U("span", {
              class: P([d(t).e("suffix-inner")])
            }, [
              !D.value || !l.value ? H(O.$slots, "suffix", { key: 0 }) : X("", !0),
              D.value ? (F(), Q(_, {
                key: 1,
                class: P([d(t).e("clear"), d(t).e("icon")]),
                onClick: b
              }, {
                default: x(() => [
                  te(d(Gt))
                ]),
                _: 1
              }, 8, ["class"])) : X("", !0),
              l.value ? (F(), Q(_, {
                key: 2,
                class: P([d(t).e("password"), d(t).e("icon")]),
                onClick: M
              }, {
                default: x(() => [
                  k.value ? (F(), Q(d(Xt), { key: 0 })) : (F(), Q(d(Zt), { key: 1 }))
                ]),
                _: 1
              }, 8, ["class"])) : X("", !0)
            ], 2)
          ], 2)) : X("", !0)
        ], 2),
        O.$slots.append ? (F(), K("div", {
          key: 1,
          class: P([d(t).be("group", "append")])
        }, [
          H(O.$slots, "append")
        ], 2)) : X("", !0)
      ], 2);
    };
  }
}), Je = ae(tn), nn = /* @__PURE__ */ W({
  name: "mc-form-item-input",
  __name: "form-item-input",
  props: Jt,
  emits: Qt,
  setup(e, { emit: o }) {
    const n = e, t = o, r = G("form-item-input"), i = N(!1), c = N(), u = N(0);
    let h;
    const m = V(() => n.modelValue !== ""), f = (l) => {
      t("input", l), t("update:modelValue", l);
    }, s = (l) => {
      t("change", l);
    }, a = (l) => {
      i.value = !0, t("focus", l);
    }, C = (l) => {
      i.value = !1, t("blur", l);
    }, w = (l) => {
      t("keydown", l);
    };
    function k(l) {
      const D = l ? "active" : "inactive", b = l ? "inactive" : "active";
      c.value.classList.add(D), c.value.classList.remove(b);
      const L = l ? h : "0";
      u.value = L;
    }
    function M(l) {
      return new Promise((D) => {
        var L, $;
        const b = c.value.cloneNode(!0);
        b.style.visibility = "hidden", b.style.pointerEvents = "none", b.style.zIndex = "-999", ($ = (L = c.value) == null ? void 0 : L.parentElement) == null || $.appendChild(b), requestAnimationFrame(() => {
          b.classList.add(l), b.addEventListener(
            "transitionend",
            () => {
              var B, I;
              const R = b.getBoundingClientRect().width;
              (I = (B = c.value) == null ? void 0 : B.parentElement) == null || I.removeChild(b), D(R);
            },
            { once: !0 }
          );
        });
      });
    }
    return ye(async () => {
      n.labelWidth ? h = n.labelWidth : (h = await M("active"), h = `${h + 10}px`), me(
        () => m.value || i.value,
        (l) => {
          k(l || i.value);
        },
        {
          immediate: !0
        }
      );
    }), (l, D) => (F(), K("div", {
      class: P([d(r).b()])
    }, [
      te(Ue, {
        prop: l.prop,
        "label-width": u.value,
        rules: l.rules,
        "show-message": l.showMessage,
        size: l.size
      }, {
        default: x(() => [
          te(d(Je), {
            type: l.type,
            "model-value": l.modelValue,
            clearable: l.clearable,
            "show-password": l.showPassword,
            disabled: l.disabled,
            readonly: l.readonly,
            "aria-label": l.ariaLabel,
            autocomplete: l.autocomplete,
            onInput: f,
            onChange: s,
            onBlur: C,
            onFocus: a,
            onKeydown: w
          }, Te({ _: 2 }, [
            l.$slots.prefix ? {
              name: "prefix",
              fn: x(() => [
                H(l.$slots, "prefix")
              ]),
              key: "0"
            } : void 0,
            l.$slots.suffix ? {
              name: "suffix",
              fn: x(() => [
                H(l.$slots, "suffix")
              ]),
              key: "1"
            } : void 0,
            l.$slots.prepend ? {
              name: "prepend",
              fn: x(() => [
                H(l.$slots, "prepend")
              ]),
              key: "2"
            } : void 0,
            l.$slots.append ? {
              name: "append",
              fn: x(() => [
                H(l.$slots, "append")
              ]),
              key: "3"
            } : void 0
          ]), 1032, ["type", "model-value", "clearable", "show-password", "disabled", "readonly", "aria-label", "autocomplete"]),
          U("span", {
            ref_key: "labelRef",
            ref: c,
            class: P(d(r).e("form-label"))
          }, ue(l.placeholder), 3)
        ]),
        _: 3
      }, 8, ["prop", "label-width", "rules", "show-message", "size"])
    ], 2));
  }
}), an = ae(xt), sn = ae(Ue), rn = ae(nn), on = {
  /**
   * 传入的数据
   */
  data: {
    type: Array,
    default: () => []
  },
  /**
   * 默认展开的 keys
   */
  defaultExpandedKeys: {
    // 默认展开的 key
    type: Array,
    default: () => []
  },
  /**
   * label 字段名
   */
  labelField: {
    // data 属性中 label 字段名
    type: String,
    default: "label"
  },
  /**
   * key 字段名
   */
  keyField: {
    // data 属性中 key 字段名
    type: String,
    default: "key"
  },
  /**
   * 子树
   */
  childrenField: {
    // // data 属性中 children 字段名
    type: String,
    default: "children"
  },
  /**
   * 懒加载处理函数
   */
  onLoad: Function,
  /**
   * 被选中的 key
   */
  selectedKeys: {
    type: Array
  },
  /**
   * 是否可选
   */
  selectable: {
    type: Boolean,
    default: !1
  },
  /**
   * 是否可多选
   */
  multiple: {
    type: Boolean,
    default: !1
  },
  /**
   * 默认选中的选项
   */
  defaultCheckedKeys: {
    type: Array,
    default: () => []
  },
  /**
   * 是否展示 checkbox
   */
  showCheckbox: {
    type: Boolean,
    default: !1
  }
}, ln = {
  /**
   * 选择了的 key 更新
   */
  "update:selectedKeys": (e) => e
}, un = {
  /**
   * 节点
   */
  node: {
    type: Object,
    required: !0
  },
  /**
   * 是否展开
   */
  expanded: {
    type: Boolean,
    required: !0
  },
  /**
   * 处于加载中的 keys
   */
  loadingKeys: {
    type: Object,
    required: !0
  },
  /**
   * 被选中的 keys
   */
  selectedKeys: {
    type: Array,
    default: () => []
  },
  /**
   * 是否展示 checkbox
   */
  showCheckbox: {
    type: Boolean,
    default: !1
  },
  /**
   * 是否选中
   */
  checked: Boolean,
  /**
   * 是否禁用
   */
  disabled: Boolean,
  /**
   * 是否半选
   */
  indeterminate: Boolean
}, cn = {
  /**
   * 展开/折叠
   */
  toggle: (e) => e,
  /**
   * 节点选择
   */
  select: (e, o = !1) => e || o,
  check: (e, o) => typeof o == "boolean" && e
}, Qe = Symbol(), dn = {
  node: {
    type: Object,
    required: !0
  }
}, fn = W({
  name: "mc-node-switcher",
  render() {
    return /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32" }, /* @__PURE__ */ React.createElement("path", { d: "M12 8l10 8l-10 8z" }));
  }
}), pn = W({
  name: "MCTreeNodeContent",
  props: dn,
  setup(e) {
    const o = Re(Qe), n = lt(e, "node");
    return () => {
      var t;
      return o != null && o.slots.default ? o.slots.default({ node: n.value }) : (t = n.value) == null ? void 0 : t.label;
    };
  }
}), mn = /* @__PURE__ */ W({
  __name: "treeNode",
  props: un,
  emits: cn,
  setup(e, { emit: o }) {
    const n = G("tree-node"), t = e, r = o;
    function i() {
      r("toggle", t.node);
    }
    const c = V(() => t.loadingKeys.has(t.node.key)), u = V(() => t.selectedKeys.includes(t.node.key));
    function h(f) {
      t.node.disabled || t.showCheckbox || r("select", t.node, f.ctrlKey);
    }
    function m(f) {
      r("check", t.node, f);
    }
    return (f, s) => (F(), K("div", {
      class: P([d(n).b(), d(n).is("selected", u.value), d(n).is("disabled", f.node.disabled)])
    }, [
      U("span", {
        class: P(d(n).b("indent")),
        style: ke({ width: `${f.node.level * 24}px` })
      }, null, 6),
      U("span", {
        class: P([d(n).e("expand-icon"), { expanded: f.expanded && !f.node.isLeaf }, d(n).is("leaf", f.node.isLeaf)]),
        onClick: i
      }, [
        te(d(fe), {
          class: P(d(n).e("switcher")),
          size: "16",
          color: "#1F1F1F"
        }, {
          default: x(() => [
            c.value ? (F(), Q(d(Ee), { key: 1 })) : (F(), Q(d(fn), { key: 0 }))
          ]),
          _: 1
        }, 8, ["class"])
      ], 2),
      f.showCheckbox ? (F(), Q(d(Ne), {
        key: 0,
        style: { margin: "0 3px" },
        "model-value": f.checked,
        disabled: f.disabled,
        indeterminate: f.indeterminate,
        onChange: m
      }, null, 8, ["model-value", "disabled", "indeterminate"])) : X("", !0),
      U("span", {
        class: P(d(n).e("content")),
        onClick: h
      }, [
        te(d(pn), { node: f.node }, null, 8, ["node"])
      ], 2)
    ], 2));
  }
}), yn = {
  /**
   * 每一行的高度
   */
  size: {
    type: Number,
    default: 27
  },
  /**
   * 可视窗口展示的数据条数
   */
  remain: {
    type: Number,
    default: 8
  },
  /**
   * 数据
   */
  items: {
    type: Array,
    default: () => []
  }
}, hn = W({
  name: "mc-virtual-list",
  props: yn,
  setup(e, { slots: o }) {
    const n = G("virtual-list"), t = N(), r = N(), i = it({
      start: 0,
      end: e.remain
    }), c = V(() => Math.min(i.start, e.remain)), u = V(() => Math.min(e.items.length - i.end, e.remain)), h = V(
      () => e.items.slice(i.start - c.value, i.end + u.value)
    ), m = N(0);
    let f = !1;
    const s = () => {
      f || (requestAnimationFrame(() => {
        const C = t.value.scrollTop;
        i.start = Math.floor(C / e.size), i.end = i.start + e.remain, m.value = i.start * e.size - e.size * c.value, f = !1;
      }), f = !0);
    }, a = () => {
      t.value.style.height = e.remain * e.size + "px", r.value.style.height = e.items.length * e.size + "px";
    };
    return me(() => e.items, a), ye(() => {
      a();
    }), () => {
      var C;
      return /* @__PURE__ */ React.createElement("div", { class: n.b(), ref: t, onScroll: s }, /* @__PURE__ */ React.createElement("div", { class: n.e("scroll-bar"), ref: r }), /* @__PURE__ */ React.createElement(
        "div",
        {
          class: n.e("scroll-list"),
          style: {
            transform: `translate3d(0, ${m.value}px, 0)`
          }
        },
        (C = h.value) == null ? void 0 : C.map(
          (w) => o.default({ node: w })
        )
      ));
    };
  }
}), vn = ae(hn), gn = /* @__PURE__ */ W({
  name: "mc-tree",
  __name: "tree",
  props: on,
  emits: ln,
  setup(e, { emit: o }) {
    const n = G("tree"), t = e, r = o, i = N([]);
    function c(S, j, v) {
      return {
        getKey(y) {
          return y[S];
        },
        getLabel(y) {
          return y[j];
        },
        getChildren(y) {
          return y[v];
        }
      };
    }
    const u = c(
      t.keyField,
      t.labelField,
      t.childrenField
    );
    function h(S, j = null) {
      function v(p, E = null) {
        return p.map((g) => {
          const z = u.getChildren(g) || [], A = {
            key: u.getKey(g),
            label: u.getLabel(g),
            children: [],
            // 默认为空
            rawNode: g,
            level: E ? E.level + 1 : 0,
            disabled: !!g.disabled,
            // 以 node 属性 isLeaf 为准,其次是判断孩子是否为空
            // ?? 是对 || 的增强, 即只有 node.isLeaf 不存在的时候, 才会走到后面, 而不是为 false 时
            isLeaf: g.isLeaf ?? z.length == 0,
            parentKey: E == null ? void 0 : E.key
          };
          return z.length > 0 && (A.children = v(z, A)), A;
        });
      }
      return v(S, j);
    }
    me(
      () => t.data,
      (S) => {
        i.value = h(S);
      },
      {
        immediate: !0
      }
    );
    const m = N(new Set(t.defaultExpandedKeys)), f = V(() => {
      let S = m.value, j = [];
      const v = i.value || [], y = [];
      for (let p = v.length - 1; p >= 0; p--)
        y.push(v[p]);
      for (; y.length; ) {
        const p = y.pop();
        if (p && (j.push(p), S.has(p.key))) {
          const E = p.children;
          if (E)
            for (let g = E.length - 1; g >= 0; g--)
              y.push(E[g]);
        }
      }
      return j;
    });
    function s(S) {
      return f.value.find((j) => j.key === S);
    }
    function a(S) {
      return m.value.has(S.key);
    }
    function C(S) {
      m.value.delete(S.key);
    }
    const w = N(/* @__PURE__ */ new Set());
    function k(S) {
      if (!S.children.length && !S.isLeaf) {
        const j = w.value;
        if (!j.has(S.key)) {
          j.add(S.key);
          const v = t.onLoad;
          v && v(S.rawNode).then((y) => {
            S.rawNode.children = y, S.children = h(y, S), j.delete(S.key);
          }).catch(() => {
            S.isLeaf = !0;
          });
        }
      }
    }
    function M(S) {
      k(S), m.value.add(S.key);
    }
    function l(S) {
      m.value.has(S.key) && !w.value.has(S.key) ? C(S) : M(S);
    }
    const D = N([]);
    me(
      () => t.selectedKeys,
      (S) => {
        S && (D.value = S);
      },
      {
        immediate: !0
      }
    );
    function b(S, j) {
      let v = Array.from(D.value);
      if (t.selectable) {
        if (t.multiple && j) {
          let y = v.findIndex((p) => p === S.key);
          y > -1 ? v.splice(y, 1) : v.push(S.key);
        } else
          v.includes(S.key) ? v = [] : v = [S.key];
        r("update:selectedKeys", v);
      }
    }
    Ce(Qe, {
      slots: Le()
    });
    const L = N(new Set(t.defaultCheckedKeys));
    function $(S) {
      return L.value.has(S.key);
    }
    function R(S) {
      return !!S.disabled;
    }
    const B = N(/* @__PURE__ */ new Set());
    function I(S) {
      return B.value.has(S.key);
    }
    function O(S, j) {
      if (!S) return;
      const v = L.value;
      j && B.value.delete(S.key), v[j ? "add" : "delete"](S.key);
      const y = S.children;
      y && y.forEach((p) => {
        p.disabled || O(p, j);
      });
    }
    function T(S) {
      if (S.parentKey) {
        const v = s(S.parentKey);
        if (v) {
          let y = !0, p = !1;
          const E = v.children;
          for (let g of E)
            L.value.has(g.key) ? p = !0 : B.value.has(g.key) ? (y = !1, p = !0) : y = !1;
          y ? (L.value.add(v.key), B.value.delete(v.key)) : p ? (L.value.delete(v.key), B.value.add(v.key)) : (L.value.delete(v.key), B.value.delete(v.key)), T(v);
        }
      }
    }
    function _(S, j) {
      O(S, j), T(S);
    }
    return ye(() => {
      L.value.forEach((S) => {
        const j = s(S);
        j && _(j, !0);
      });
    }), (S, j) => (F(), K("div", {
      class: P(d(n).b())
    }, [
      te(d(vn), {
        items: f.value,
        remain: 8,
        size: 27
      }, {
        default: x(({ node: v }) => [
          (F(), Q(mn, {
            key: v.key,
            node: v,
            expanded: a(v),
            onToggle: l,
            loadingKeys: w.value,
            selectedKeys: D.value,
            onSelect: b,
            "show-checkbox": S.showCheckbox,
            checked: $(v),
            disabled: R(v),
            indeterminate: I(v),
            onCheck: _
          }, null, 8, ["node", "expanded", "loadingKeys", "selectedKeys", "show-checkbox", "checked", "disabled", "indeterminate"]))
        ]),
        _: 1
      }, 8, ["items"])
    ], 2));
  }
}), bn = ae(gn), wn = ["text", "picture", "picture-card"];
let $n = 1;
const kn = () => Date.now() + $n++, Xe = {
  /**
   * 文件列表
   */
  fileList: {
    type: Array,
    default: () => []
  },
  /**
   * 上传目标地址
   */
  action: {
    type: String,
    default: ""
  },
  /**
   * 是否可以多上传
   */
  multiple: {
    type: Boolean,
    default: !1
  },
  /**
   * 上传的文件字段名
   */
  name: {
    type: String,
    default: "file"
  },
  /**
   * 可接受的文件类型
   */
  accept: {
    type: String,
    default: ""
  },
  /**
   * 请求方法
   */
  method: {
    type: String,
    default: "post"
  },
  /**
   * 请求头
   */
  headers: {
    type: Object,
    default: () => ({})
  },
  /**
   * 	上传时附带的额外参数
   */
  data: {
    type: Object,
    default: () => ({})
  },
  /**
   * 是否自动上传文件
   */
  autoUpload: {
    type: Boolean,
    default: !0
  },
  /**
   * 文件列表的类型
   */
  listType: {
    type: String,
    values: wn,
    default: "text"
  },
  /**
   * 	允许上传文件的最大数量
   */
  limit: {
    type: Number
  },
  /**
   * 是否启用拖拽上传
   */
  drag: {
    type: Boolean,
    default: !1
  },
  /**
   * 是否支持上传文件夹
   */
  directory: {
    type: Boolean,
    default: !1
  },
  /**
   * 是否禁用
   */
  disabled: {
    type: Boolean,
    default: !1
  }
}, Ze = {
  ...Xe,
  /**
   * 上传文件之前的钩子
   */
  beforeUpload: {
    type: Function,
    default: () => {
    }
  },
  /**
   * 点击文件列表中已上传的文件时的钩子
   */
  onPreview: {
    type: Function,
    default: () => {
    }
  },
  /**
   * 文件状态改变钩子, 添加文件、上传成功和上传失败时都会被调用
   */
  onChange: {
    type: Function,
    default: () => {
    }
  },
  /**
   * 删除文件之前的钩子
   */
  beforeRemove: {
    type: Function,
    default: () => {
    }
  },
  /**
   * 文件上传时的钩子
   */
  onProgress: {
    type: Function,
    default: () => {
    }
  },
  /**
   * 文件列表移除文件时的钩子
   */
  onRemove: {
    type: Function,
    default: () => {
    }
  },
  /**
   * 文件上传成功时的钩子
   */
  onSuccess: {
    type: Function,
    default: () => {
    }
  },
  /**
   * 文件上传失败时的钩子
   */
  onError: {
    type: Function,
    default: () => {
    }
  },
  /**
   * 当超出限制时,执行的钩子函数
   */
  onExceed: {
    type: Function,
    default: () => {
    }
  }
}, Sn = {
  ...Xe,
  beforeUpload: Ze.beforeUpload,
  onStart: {
    type: Function,
    default: () => {
    }
  },
  onProgress: {
    type: Function,
    default: () => {
    }
  },
  onRemove: {
    type: Function,
    default: () => {
    }
  },
  onSuccess: {
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    type: Function,
    default: () => {
    }
  },
  onError: {
    type: Function,
    default: () => {
    }
  },
  onExceed: {
    type: Function,
    default: () => {
    }
  }
}, Mn = {
  directory: {
    type: Boolean,
    default: !1
  },
  accept: {
    type: String,
    default: ""
  },
  disabled: {
    type: Boolean,
    default: !1
  }
}, Dn = {
  /**
   * 拖拽上传文件事件
   */
  file: (e) => Array.isArray(e)
}, Ge = (e, o) => {
  if (e && o) {
    const n = Array.isArray(o) ? o : o.split(","), t = e.name || "", r = e.type || "", i = r.replace(/\/.*$/, "");
    return n.some((c) => {
      const u = c.trim();
      if (/^\*(\/\*)?$/.test(c))
        return !0;
      if (u.charAt(0) === ".") {
        const h = t.toLowerCase(), m = u.toLowerCase();
        let f = [m];
        return (m === ".jpg" || m === ".jpeg") && (f = [".jpg", ".jpeg"]), f.some((s) => h.endsWith(s));
      }
      return /\/\*$/.test(u) ? i === u.replace(/\/.*$/, "") : r === u ? !0 : /^\w+$/.test(u) ? (console.warn(
        `Upload takes an invalidate 'accept' type '${u}'.Skip for check.`
      ), !0) : !1;
    });
  }
  return !0;
};
function et(e) {
  if (!e) return Promise.reject();
  const o = e.createReader(), n = [], t = (r) => {
    const i = [".DS_Store", ".git", "desktop.ini"];
    return r.name.startsWith(".") || i.includes(r.name);
  };
  return new Promise((r) => {
    const i = () => {
      o.readEntries(async (c) => {
        if (c.length === 0) {
          r(n);
          return;
        }
        for (const u of c)
          if (u.isFile)
            await new Promise((h) => {
              u.file((m) => {
                t(m) || n.push(m), h();
              });
            });
          else if (u.isDirectory) {
            const h = await et(
              u
            );
            n.push(...h);
          }
        i();
      });
    };
    i();
  });
}
const En = /* @__PURE__ */ W({
  name: "mc-upload-dragger",
  __name: "upload-dragger",
  props: Mn,
  emits: Dn,
  setup(e, { emit: o }) {
    const n = o, t = e, r = G("upload"), i = N(!1), c = (f) => new Promise((s) => {
      et(f).then((a) => {
        s(a);
      }).catch((a) => {
        console.warn("read directory error: ", a.message);
      });
    }), u = async (f) => {
      var w;
      if (t.disabled) return;
      i.value = !1, f.stopPropagation();
      const s = Array.from(f.dataTransfer.files), a = [];
      if (t.directory) {
        const k = f.dataTransfer.items || [];
        for (let M = 0; M < s.length; M++) {
          const l = k[M], D = (w = l == null ? void 0 : l.webkitGetAsEntry) == null ? void 0 : w.call(l);
          if (D) {
            const b = await c(
              D
            );
            a.push(...b);
          } else
            console.warn(
              "API webkitGetAsEntry is unsupported in you Browser"
            ), alert("当前浏览器不支持拖拽读取文件夹!");
        }
      } else
        a.push(...s);
      const C = a.filter(
        (k) => Ge(k, t.accept)
      );
      n("file", C);
    }, h = () => {
      t.disabled || (i.value = !0);
    }, m = (f) => {
      f.currentTarget.contains(f.relatedTarget) || (i.value = !1);
    };
    return (f, s) => (F(), K("div", {
      class: P([d(r).b("dragger"), d(r).is("dragover", i.value)]),
      onDrop: $e(u, ["prevent"]),
      onDragover: $e(h, ["prevent"]),
      onDragleave: $e(m, ["prevent"])
    }, [
      H(f.$slots, "default")
    ], 34));
  }
});
class Cn extends Error {
  constructor(o, n, t, r) {
    super(o), this.name = "UploadAjaxError", this.status = n, this.method = t, this.url = r;
  }
}
function Pe(e, o, n) {
  let t;
  return n.response ? t = `${n.response.error || n.response}` : n.responseText ? t = `${n.responseText}` : t = `fail to ${o.method} ${e} ${n.status}`, new Cn(t, n.status, o.method, e);
}
function Rn(e) {
  const o = e.responseText || e.response;
  if (!o)
    return o;
  try {
    return JSON.parse(o);
  } catch {
    return o;
  }
}
function Ln(e) {
  if (typeof XMLHttpRequest > "u")
    throw new Error("XMLHttpRequest is undefined");
  const o = new XMLHttpRequest(), n = e.action;
  o.upload && o.upload.addEventListener("progress", (i) => {
    const c = i;
    c.percent = i.total > 0 ? i.loaded / i.total * 100 : 0, e.onProgress(c);
  });
  const t = new FormData();
  if (e.data)
    for (const [i, c] of Object.entries(e.data))
      Array.isArray(c) && c.length ? t.append(i, ...c) : t.append(i, c);
  t.append(e.filename, e.file, e.file.name), o.onerror = () => {
    e.onError(Pe(n, e, o));
  }, o.onload = () => {
    if (o.status < 200 || o.status >= 300)
      return e.onError(Pe(n, e, o));
    e.onSuccess(Rn(o));
  }, o.open(e.method, n, !0);
  const r = e.headers || {};
  if (r instanceof Headers)
    r.forEach((i, c) => o.setRequestHeader(c, i));
  else
    for (const [i, c] of Object.entries(r))
      o.setRequestHeader(i, String(c));
  return o.send(t), o;
}
const Fn = ["onKeydown"], On = ["name", "accept", "multiple"], zn = /* @__PURE__ */ W({
  name: "mc-upload-content",
  inheritAttrs: !1,
  __name: "upload-content",
  props: Sn,
  setup(e, { expose: o }) {
    const n = G("upload"), t = e, r = N(), i = ut(
      {}
    ), c = V(
      () => t.directory ? { directory: "directory", webkitdirectory: "webkitdirectory" } : {}
    ), u = (w) => {
      if (w.length === 0) return;
      const { autoUpload: k, limit: M, fileList: l, multiple: D, onStart: b, onExceed: L } = t;
      if (M && l.length + w.length > M) {
        L(w, l);
        return;
      }
      D || (w = w.slice(0, 1));
      for (const $ of w) {
        const R = $;
        R.uid = kn(), b(R), k && h(R);
      }
    }, h = async (w) => {
      if (r.value.value = "", !t.beforeUpload)
        return m(w);
      let k;
      try {
        k = await t.beforeUpload(w);
      } catch {
        k = !1;
      }
      if (k === !1) {
        t.onRemove(w);
        return;
      }
      m(w);
    }, m = async (w) => {
      const {
        headers: k,
        data: M,
        method: l,
        name: D,
        action: b,
        onProgress: L,
        onSuccess: $,
        onError: R
      } = t, { uid: B } = w, I = {
        headers: k || {},
        file: w,
        data: M,
        method: l,
        filename: D,
        action: b,
        onProgress: (T) => {
          L(T, w);
        },
        onSuccess: (T) => {
          $(T, w), delete i.value[B];
        },
        onError: (T) => {
          R(T, w), delete i.value[B];
        }
      }, O = Ln(I);
      i.value[B] = O, O instanceof Promise && O.then(I.onSuccess, I.onError);
    }, f = (w) => {
      const k = w.target.files;
      if (!k) return;
      const M = Array.from(k).filter(
        (l) => !t.directory || Ge(l, t.accept)
      );
      u(Array.from(M));
    }, s = () => {
      t.disabled || (r.value.value = "", r.value.click());
    }, a = () => {
      s();
    };
    return o({
      abort: (w) => {
        Object.entries(i.value).filter(
          w ? ([M]) => String(w.uid) === M : () => !0
        ).forEach(([M, l]) => {
          l instanceof XMLHttpRequest && l.abort(), delete i.value[M];
        });
      },
      upload: h
    }), (w, k) => (F(), K("div", {
      class: P([d(n).b(), d(n).is("drag", w.drag), d(n).is("disabled", w.disabled)]),
      onClick: s,
      onKeydown: ct($e(a, ["self"]), ["enter", "space"])
    }, [
      w.drag ? (F(), Q(En, {
        key: 0,
        onFile: u,
        disabled: w.disabled,
        accept: w.accept,
        directory: w.directory
      }, {
        default: x(() => [
          H(w.$slots, "default")
        ]),
        _: 3
      }, 8, ["disabled", "accept", "directory"])) : H(w.$slots, "default", { key: 1 }),
      U("input", Fe({
        ref_key: "inputRef",
        ref: r,
        type: "file",
        class: d(n).e("input"),
        name: w.name,
        accept: w.accept,
        multiple: w.multiple
      }, c.value, { onChange: f }), null, 16, On)
    ], 42, Fn));
  }
}), An = /* @__PURE__ */ W({
  name: "mc-upload",
  __name: "upload",
  props: Ze,
  emits: {
    "update:file-list": (e) => e instanceof Array
  },
  setup(e, { expose: o, emit: n }) {
    const t = e, r = n, i = N(), c = N(t.fileList);
    me(c, (s) => {
      r("update:file-list", s);
    });
    const u = (s) => c.value.find((a) => a.uid === s.uid);
    function h(s) {
      var a;
      (a = i.value) == null || a.abort(s);
    }
    function m() {
      c.value.filter(({ status: s }) => s === "ready").forEach(({ raw: s }) => {
        var a;
        return s && ((a = i.value) == null ? void 0 : a.upload(s));
      });
    }
    const f = V(() => ({
      ...t,
      /**
       * 正式开始往后端传文件之前会将包装后的文件信息存入 uploadFiles 列表中
       */
      onStart: (s) => {
        const a = {
          uid: s.uid,
          name: s.name,
          percentage: 0,
          raw: s,
          size: s.size,
          status: "ready"
        };
        if (t.listType === "picture-card" || t.listType === "picture")
          try {
            a.url = URL.createObjectURL(s);
          } catch (C) {
            console.warn(C.message), t.onError(C, a, c.value);
          }
        c.value = [...c.value, a], t.onChange(a, c.value);
      },
      onProgress: (s, a) => {
        const C = u(a);
        C && (t.onProgress(s, C, c.value), C.status = "uploading", C.percentage = Math.round(s.percent));
      },
      onSuccess: (s, a) => {
        const C = u(a);
        C && (C.status = "success", C.response = s, t.onSuccess(s, C, c.value), t.onChange(C, c.value));
      },
      onError: (s, a) => {
        const C = u(a);
        C && (console.error(s), C.status = "fail", c.value = c.value.filter(
          (w) => w.uid !== C.uid
        ), t.onError(s, C, c.value), t.onChange(C, c.value));
      },
      onRemove: async (s) => {
        const a = u(s);
        if (!a) throw new Error("file to be removed not found");
        const C = (w) => {
          h(w), c.value = c.value.filter(
            (k) => k.uid !== w.uid
          ), t.onRemove(w, c.value);
        };
        t.beforeRemove ? await t.beforeRemove(
          a,
          c.value
        ) !== !1 && C(a) : C(a);
      }
    }));
    return o({
      /** 取消上传请求 */
      abort: h,
      /** 上传文件列表 */
      submit: m
    }), (s, a) => (F(), K("div", null, [
      te(zn, Fe({
        ref_key: "uploadRef",
        ref: i
      }, f.value), {
        default: x(() => [
          H(s.$slots, "default")
        ]),
        _: 3
      }, 16)
    ]));
  }
}), Pn = ae(An), Bn = {
  /**
   * 数据源
   */
  dataSource: {
    type: Array,
    required: !0,
    default: () => []
  },
  /**
   * 每一项数据的 key
   */
  dataKey: {
    type: String,
    required: !0
  },
  /**
   * 渲染多少条数据 (存在真实 dom)
   */
  keeps: {
    type: Number,
    default: 30
  },
  /**
   * 每一条数据预估高度
   */
  estimatedRowHeight: {
    type: Number,
    default: 80
  },
  /**
   * 每一行的数据组件
   */
  dataComponent: {
    type: [Object, Function],
    required: !0
  },
  /**
   * 数据渲染缓冲区 (基于视口顶部 top 的数据所在位置, top ~ top + cache 为缓冲区)
   *
   * start = 10 cache = 5 end = 20
   * - 向下滚动时, 当 top 处于 10 ~ 15, 不做处理,
   * 当 top > 15, 将 start 赋为 15, 从而 end = 25(即往后渲染 cache 条数据)
   * - 向上滚动时, 当 top 处于 10 ~ 15, 不做处理,
   * 当 top < 10, 将 start 赋为 5, 从而 end = 15(即往前渲染 cache 条数据)
   */
  cache: {
    type: Number,
    default: 2
  }
}, Tn = {
  uniqueKey: {
    type: [String, Number],
    required: !0
  },
  source: {
    type: Object,
    required: !0
  },
  component: {
    type: [Object, Function]
  }
}, _n = {
  itemResize: (e, o) => typeof o == "number" && (typeof e == "number" || typeof e == "string")
};
function Kn(e, o) {
  const n = {
    start: 0,
    end: 0,
    padBehind: 0,
    padFront: 0
  };
  let t = 0;
  const r = /* @__PURE__ */ new Map();
  let i = "init", c = 0, u;
  function h() {
    return i === "fixed";
  }
  function m() {
    return h() ? c : u || e.estimatedRowHeight;
  }
  function f($) {
    if (!$) return 0;
    let R = 0;
    for (let B = 0; B < $; B++) {
      const I = r.get(e.uniqueIds[B]);
      R += typeof I == "number" ? I : m();
    }
    return R;
  }
  function s() {
    return h() ? m() * n.start : f(n.start);
  }
  function a() {
    return (e.uniqueIds.length - 1 - n.end) * m();
  }
  function C($, R) {
    n.start = $, n.end = R, n.padFront = s(), n.padBehind = a(), o({ ...n });
  }
  function w($, R) {
    const B = e.uniqueIds.length, I = e.keeps;
    B < I ? ($ = 0, R = B - 1) : R - $ < I - 1 && ($ = R - I + 1), C($, R);
  }
  function k() {
    if (h())
      return Math.floor(t / m());
    {
      let $ = 0, R = e.uniqueIds.length, B = 0, I = 0;
      for (; $ < R; ) {
        if (B = $ + Math.floor((R - $) / 2), I = f(B), I === t)
          return B;
        I < t ? $ = B + 1 : R = B - 1;
      }
      return $ > 0 ? --$ : 0;
    }
  }
  function M($) {
    const R = $ + e.keeps - 1;
    return Math.min(R, e.uniqueIds.length - 1);
  }
  function l() {
    const $ = k();
    if ($ > n.start)
      return;
    const R = Math.max(0, $ - e.cache);
    w(R, M(R));
  }
  function D() {
    const $ = k();
    $ < n.start + e.cache || w($, M($));
  }
  function b($) {
    const R = $ < t ? "front" : "behind";
    t = $, R === "front" ? l() : R === "behind" && D();
  }
  function L($, R) {
    r.set($, R), i === "init" ? (c = R, i = "fixed") : i === "fixed" && c !== R && (i = "dynamic", c = 0), i === "dynamic" && r.size < Math.min(e.keeps, e.uniqueIds.length) && (u = Math.round(
      [...r.values()].reduce((B, I) => B + I, 0) / r.size
    ));
  }
  return w(0, e.keeps - 1), {
    handleScroll: b,
    saveSize: L
  };
}
const Vn = W({
  name: "virtual-item",
  props: Tn,
  emits: _n,
  setup(e, { emit: o }) {
    const n = N();
    function t() {
      o("itemResize", e.uniqueKey, n.value.offsetHeight);
    }
    return ye(() => {
      t();
    }), dt(() => {
      t();
    }), () => {
      const { component: r, source: i, uniqueKey: c } = e;
      return r && /* @__PURE__ */ React.createElement("div", { key: c, ref: n }, /* @__PURE__ */ React.createElement(r, { source: i }));
    };
  }
}), In = W({
  name: "mc-virtual-scroll-list",
  props: Bn,
  setup(e) {
    const o = N(null);
    let n;
    const t = () => {
      const { dataSource: f, dataKey: s } = e;
      return f.map(
        (a) => a[s]
      );
    }, r = (f) => {
      o.value = f;
    }, i = () => {
      n = Kn(
        {
          keeps: e.keeps,
          cache: e.cache || Math.round(e.keeps / 3),
          uniqueIds: t(),
          estimatedRowHeight: e.estimatedRowHeight
        },
        r
      );
    };
    ft(() => {
      i();
    });
    function c(f, s) {
      n.saveSize(f, s);
    }
    function u() {
      const f = [], { start: s, end: a } = o.value, { dataSource: C, dataComponent: w, dataKey: k } = e;
      for (let M = s; M <= a; M++) {
        const l = C[M], D = l[k];
        l && f.push(
          pt(Vn, {
            uniqueKey: D,
            source: l,
            component: w,
            onItemResize: c
          })
        );
      }
      return f;
    }
    const h = N();
    function m() {
      if (h.value) {
        const f = h.value.scrollTop;
        n.handleScroll(f);
      }
    }
    return () => {
      const { padFront: f, padBehind: s } = o.value, a = {
        padding: `${f}px 0 ${s}px`
      };
      return /* @__PURE__ */ React.createElement(
        "div",
        {
          onScroll: m,
          ref: h,
          style: { overflowY: "scroll" }
        },
        /* @__PURE__ */ React.createElement("div", { style: a }, u())
      );
    };
  }
}), jn = ae(In), Nn = [
  de,
  jt,
  Ne,
  an,
  sn,
  rn,
  fe,
  Je,
  bn,
  Pn,
  jn
], Be = Symbol("INSTALLED_KEY"), qn = (e = []) => ({
  install: (n) => {
    n[Be] || (n[Be] = !0, e.forEach((t) => n.use(t)));
  }
}), Hn = qn(Nn), Xn = Hn.install;
export {
  de as McButton,
  jt as McCalendar,
  Ne as McCheckbox,
  an as McForm,
  sn as McFormItem,
  rn as McFormItemInput,
  fe as McIcon,
  Je as McInput,
  bn as McTree,
  Pn as McUpload,
  jn as McVirtualScrollList,
  Me as WEEK_DAYS,
  wt as buttonEmits,
  bt as buttonProps,
  Rt as calendarEmits,
  Ct as calendarProps,
  qt as checkboxEmits,
  Nt as checkboxProps,
  xn as componentSizeMap,
  Yn as componentSizes,
  Hn as default,
  qe as formContextKey,
  We as formItemContextKey,
  Qt as formItemInputEmits,
  Jt as formItemInputProps,
  He as formItemProps,
  Qn as formItemSize,
  Jn as formItemValidateState,
  Yt as formProps,
  kn as genFileId,
  $t as iconProps,
  Xn as install,
  qn as makeInstaller,
  ln as treeEmits,
  Qe as treeInjectKey,
  dn as treeNodeContentProps,
  cn as treeNodeEmits,
  un as treeNodeProps,
  on as treeProps,
  Xe as uploadBaseProps,
  wn as uploadListTypes,
  Ze as uploadProps
};
//# sourceMappingURL=index.es.js.map