import '@das-fed/ui/packages/components/autocomplete/style.css';
import { pushScopeId as Oe, popScopeId as Te, nextTick as ue, withScopeId as xe, createBlock as U, openBlock as k, markRaw as Ce, shallowReactive as Ne, resolveComponent as Pe, resolveDirective as Me, withDirectives as F, createElementBlock as E, normalizeClass as ee, createCommentVNode as te, createVNode as ie, renderSlot as j, resolveDynamicComponent as he, normalizeStyle as se, withCtx as B, Fragment as Re, renderList as Se, mergeProps as re, toHandlers as Ee, defineComponent as Ae, computed as q, ref as x, watch as J, onMounted as Le, onUnmounted as De, withModifiers as me, unref as M, createElementVNode as He, createTextVNode as pe, toDisplayString as ve, vShow as ye, isRef as Fe, createSlots as Be } from "vue";
import { withInstall as je } from "@das-fed/utils/with-install/index";
import { ElPopover as Ue } from "element-plus/es";
import "element-plus/es/components/base/style/css";
import "element-plus/es/components/popover/style/css";
import { DasInput as We } from "@das-fed/ui/packages/components/input/index";
import { vDasTooltip as be } from "@das-fed/ui/packages/components/text-tooltip/index";
import { vOverlay as Ke } from "@das-fed/ui/packages/components/overlay/index";
import { DasTree as qe } from "@das-fed/ui/packages/components/tree/index";
import { useModelValue as Q } from "@das-fed/utils/vue";
import "@das-fed/ui/packages/global/theme";
function Ye() {
  var e = window.navigator.userAgent, t = e.indexOf("MSIE ");
  if (t > 0)
    return parseInt(e.substring(t + 5, e.indexOf(".", t)), 10);
  var i = e.indexOf("Trident/");
  if (i > 0) {
    var s = e.indexOf("rv:");
    return parseInt(e.substring(s + 3, e.indexOf(".", s)), 10);
  }
  var n = e.indexOf("Edge/");
  return n > 0 ? parseInt(e.substring(n + 5, e.indexOf(".", n)), 10) : -1;
}
let Y;
function ne() {
  ne.init || (ne.init = !0, Y = Ye() !== -1);
}
var G = {
  name: "ResizeObserver",
  props: {
    emitOnMount: {
      type: Boolean,
      default: !1
    },
    ignoreWidth: {
      type: Boolean,
      default: !1
    },
    ignoreHeight: {
      type: Boolean,
      default: !1
    }
  },
  emits: [
    "notify"
  ],
  mounted() {
    ne(), ue(() => {
      this._w = this.$el.offsetWidth, this._h = this.$el.offsetHeight, this.emitOnMount && this.emitSize();
    });
    const e = document.createElement("object");
    this._resizeObject = e, e.setAttribute("aria-hidden", "true"), e.setAttribute("tabindex", -1), e.onload = this.addResizeHandlers, e.type = "text/html", Y && this.$el.appendChild(e), e.data = "about:blank", Y || this.$el.appendChild(e);
  },
  beforeUnmount() {
    this.removeResizeHandlers();
  },
  methods: {
    compareAndNotify() {
      (!this.ignoreWidth && this._w !== this.$el.offsetWidth || !this.ignoreHeight && this._h !== this.$el.offsetHeight) && (this._w = this.$el.offsetWidth, this._h = this.$el.offsetHeight, this.emitSize());
    },
    emitSize() {
      this.$emit("notify", {
        width: this._w,
        height: this._h
      });
    },
    addResizeHandlers() {
      this._resizeObject.contentDocument.defaultView.addEventListener("resize", this.compareAndNotify), this.compareAndNotify();
    },
    removeResizeHandlers() {
      this._resizeObject && this._resizeObject.onload && (!Y && this._resizeObject.contentDocument && this._resizeObject.contentDocument.defaultView.removeEventListener("resize", this.compareAndNotify), this.$el.removeChild(this._resizeObject), this._resizeObject.onload = null, this._resizeObject = null);
    }
  }
};
const Xe = /* @__PURE__ */ xe("data-v-b329ee4c");
Oe("data-v-b329ee4c");
const Ge = {
  class: "resize-observer",
  tabindex: "-1"
};
Te();
const Je = /* @__PURE__ */ Xe((e, t, i, s, n, u) => (k(), U("div", Ge)));
G.render = Je;
G.__scopeId = "data-v-b329ee4c";
G.__file = "src/components/ResizeObserver.vue";
function X(e) {
  "@babel/helpers - typeof";
  return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? X = function(t) {
    return typeof t;
  } : X = function(t) {
    return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
  }, X(e);
}
function Qe(e, t) {
  if (!(e instanceof t))
    throw new TypeError("Cannot call a class as a function");
}
function Ze(e, t) {
  for (var i = 0; i < t.length; i++) {
    var s = t[i];
    s.enumerable = s.enumerable || !1, s.configurable = !0, "value" in s && (s.writable = !0), Object.defineProperty(e, s.key, s);
  }
}
function et(e, t, i) {
  return t && Ze(e.prototype, t), e;
}
function ge(e) {
  return tt(e) || it(e) || st(e) || rt();
}
function tt(e) {
  if (Array.isArray(e)) return le(e);
}
function it(e) {
  if (typeof Symbol < "u" && Symbol.iterator in Object(e)) return Array.from(e);
}
function st(e, t) {
  if (e) {
    if (typeof e == "string") return le(e, t);
    var i = Object.prototype.toString.call(e).slice(8, -1);
    if (i === "Object" && e.constructor && (i = e.constructor.name), i === "Map" || i === "Set") return Array.from(e);
    if (i === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)) return le(e, t);
  }
}
function le(e, t) {
  (t == null || t > e.length) && (t = e.length);
  for (var i = 0, s = new Array(t); i < t; i++) s[i] = e[i];
  return s;
}
function rt() {
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function nt(e) {
  var t;
  return typeof e == "function" ? t = {
    callback: e
  } : t = e, t;
}
function lt(e, t) {
  var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, s, n, u, c = function(l) {
    for (var h = arguments.length, b = new Array(h > 1 ? h - 1 : 0), V = 1; V < h; V++)
      b[V - 1] = arguments[V];
    if (u = b, !(s && l === n)) {
      var R = i.leading;
      typeof R == "function" && (R = R(l, n)), (!s || l !== n) && R && e.apply(void 0, [l].concat(ge(u))), n = l, clearTimeout(s), s = setTimeout(function() {
        e.apply(void 0, [l].concat(ge(u))), s = 0;
      }, t);
    }
  };
  return c._clear = function() {
    clearTimeout(s), s = null;
  }, c;
}
function ze(e, t) {
  if (e === t) return !0;
  if (X(e) === "object") {
    for (var i in e)
      if (!ze(e[i], t[i]))
        return !1;
    return !0;
  }
  return !1;
}
var ot = /* @__PURE__ */ function() {
  function e(t, i, s) {
    Qe(this, e), this.el = t, this.observer = null, this.frozen = !1, this.createObserver(i, s);
  }
  return et(e, [{
    key: "createObserver",
    value: function(i, s) {
      var n = this;
      if (this.observer && this.destroyObserver(), !this.frozen) {
        if (this.options = nt(i), this.callback = function(f, l) {
          n.options.callback(f, l), f && n.options.once && (n.frozen = !0, n.destroyObserver());
        }, this.callback && this.options.throttle) {
          var u = this.options.throttleOptions || {}, c = u.leading;
          this.callback = lt(this.callback, this.options.throttle, {
            leading: function(l) {
              return c === "both" || c === "visible" && l || c === "hidden" && !l;
            }
          });
        }
        this.oldResult = void 0, this.observer = new IntersectionObserver(function(f) {
          var l = f[0];
          if (f.length > 1) {
            var h = f.find(function(V) {
              return V.isIntersecting;
            });
            h && (l = h);
          }
          if (n.callback) {
            var b = l.isIntersecting && l.intersectionRatio >= n.threshold;
            if (b === n.oldResult) return;
            n.oldResult = b, n.callback(b, l);
          }
        }, this.options.intersection), ue(function() {
          n.observer && n.observer.observe(n.el);
        });
      }
    }
  }, {
    key: "destroyObserver",
    value: function() {
      this.observer && (this.observer.disconnect(), this.observer = null), this.callback && this.callback._clear && (this.callback._clear(), this.callback = null);
    }
  }, {
    key: "threshold",
    get: function() {
      return this.options.intersection && typeof this.options.intersection.threshold == "number" ? this.options.intersection.threshold : 0;
    }
  }]), e;
}();
function _e(e, t, i) {
  var s = t.value;
  if (s && !(typeof IntersectionObserver > "u")) {
    var n = new ot(e, s, i);
    e._vue_visibilityState = n;
  }
}
function at(e, t, i) {
  var s = t.value, n = t.oldValue;
  if (!ze(s, n)) {
    var u = e._vue_visibilityState;
    if (!s) {
      Ie(e);
      return;
    }
    u ? u.createObserver(s, i) : _e(e, {
      value: s
    }, i);
  }
}
function Ie(e) {
  var t = e._vue_visibilityState;
  t && (t.destroyObserver(), delete e._vue_visibilityState);
}
var ut = {
  beforeMount: _e,
  updated: at,
  unmounted: Ie
}, dt = {
  itemsLimit: 1e3
}, ct = /(auto|scroll)/;
function $e(e, t) {
  return e.parentNode === null ? t : $e(e.parentNode, t.concat([e]));
}
var Z = function(t, i) {
  return getComputedStyle(t, null).getPropertyValue(i);
}, ft = function(t) {
  return Z(t, "overflow") + Z(t, "overflow-y") + Z(t, "overflow-x");
}, ht = function(t) {
  return ct.test(ft(t));
};
function we(e) {
  if (e instanceof HTMLElement || e instanceof SVGElement) {
    for (var t = $e(e.parentNode, []), i = 0; i < t.length; i += 1)
      if (ht(t[i]))
        return t[i];
    return document.scrollingElement || document.documentElement;
  }
}
function oe(e) {
  "@babel/helpers - typeof";
  return oe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
    return typeof t;
  } : function(t) {
    return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
  }, oe(e);
}
var mt = {
  items: {
    type: Array,
    required: !0
  },
  keyField: {
    type: String,
    default: "id"
  },
  direction: {
    type: String,
    default: "vertical",
    validator: function(t) {
      return ["vertical", "horizontal"].includes(t);
    }
  },
  listTag: {
    type: String,
    default: "div"
  },
  itemTag: {
    type: String,
    default: "div"
  }
};
function pt() {
  return this.items.length && oe(this.items[0]) !== "object";
}
var ae = !1;
if (typeof window < "u") {
  ae = !1;
  try {
    var vt = Object.defineProperty({}, "passive", {
      get: function() {
        ae = !0;
      }
    });
    window.addEventListener("test", null, vt);
  } catch {
  }
}
let yt = 0;
var de = {
  name: "RecycleScroller",
  components: {
    ResizeObserver: G
  },
  directives: {
    ObserveVisibility: ut
  },
  props: {
    ...mt,
    itemSize: {
      type: Number,
      default: null
    },
    gridItems: {
      type: Number,
      default: void 0
    },
    itemSecondarySize: {
      type: Number,
      default: void 0
    },
    minItemSize: {
      type: [Number, String],
      default: null
    },
    sizeField: {
      type: String,
      default: "size"
    },
    typeField: {
      type: String,
      default: "type"
    },
    buffer: {
      type: Number,
      default: 200
    },
    pageMode: {
      type: Boolean,
      default: !1
    },
    prerender: {
      type: Number,
      default: 0
    },
    emitUpdate: {
      type: Boolean,
      default: !1
    },
    updateInterval: {
      type: Number,
      default: 0
    },
    skipHover: {
      type: Boolean,
      default: !1
    },
    listTag: {
      type: String,
      default: "div"
    },
    itemTag: {
      type: String,
      default: "div"
    },
    listClass: {
      type: [String, Object, Array],
      default: ""
    },
    itemClass: {
      type: [String, Object, Array],
      default: ""
    }
  },
  emits: [
    "resize",
    "visible",
    "hidden",
    "update",
    "scroll-start",
    "scroll-end"
  ],
  data() {
    return {
      pool: [],
      totalSize: 0,
      ready: !1,
      hoverKey: null
    };
  },
  computed: {
    sizes() {
      if (this.itemSize === null) {
        const e = {
          "-1": { accumulator: 0 }
        }, t = this.items, i = this.sizeField, s = this.minItemSize;
        let n = 1e4, u = 0, c;
        for (let f = 0, l = t.length; f < l; f++)
          c = t[f][i] || s, c < n && (n = c), u += c, e[f] = { accumulator: u, size: c };
        return this.$_computedMinItemSize = n, e;
      }
      return [];
    },
    simpleArray: pt,
    itemIndexByKey() {
      const { keyField: e, items: t } = this, i = {};
      for (let s = 0, n = t.length; s < n; s++)
        i[t[s][e]] = s;
      return i;
    }
  },
  watch: {
    items() {
      this.updateVisibleItems(!0);
    },
    pageMode() {
      this.applyPageMode(), this.updateVisibleItems(!1);
    },
    sizes: {
      handler() {
        this.updateVisibleItems(!1);
      },
      deep: !0
    },
    gridItems() {
      this.updateVisibleItems(!0);
    },
    itemSecondarySize() {
      this.updateVisibleItems(!0);
    }
  },
  created() {
    this.$_startIndex = 0, this.$_endIndex = 0, this.$_views = /* @__PURE__ */ new Map(), this.$_unusedViews = /* @__PURE__ */ new Map(), this.$_scrollDirty = !1, this.$_lastUpdateScrollPosition = 0, this.prerender && (this.$_prerender = !0, this.updateVisibleItems(!1)), this.gridItems && this.itemSize;
  },
  mounted() {
    this.applyPageMode(), this.$nextTick(() => {
      this.$_prerender = !1, this.updateVisibleItems(!0), this.ready = !0;
    });
  },
  activated() {
    const e = this.$_lastUpdateScrollPosition;
    typeof e == "number" && this.$nextTick(() => {
      this.scrollToPosition(e);
    });
  },
  beforeUnmount() {
    this.removeListeners();
  },
  methods: {
    addView(e, t, i, s, n) {
      const u = Ce({
        id: yt++,
        index: t,
        used: !0,
        key: s,
        type: n
      }), c = Ne({
        item: i,
        position: 0,
        nr: u
      });
      return e.push(c), c;
    },
    unuseView(e, t = !1) {
      const i = this.$_unusedViews, s = e.nr.type;
      let n = i.get(s);
      n || (n = [], i.set(s, n)), n.push(e), t || (e.nr.used = !1, e.position = -9999);
    },
    handleResize() {
      this.$emit("resize"), this.ready && this.updateVisibleItems(!1);
    },
    handleScroll(e) {
      if (!this.$_scrollDirty) {
        if (this.$_scrollDirty = !0, this.$_updateTimeout) return;
        const t = () => requestAnimationFrame(() => {
          this.$_scrollDirty = !1;
          const { continuous: i } = this.updateVisibleItems(!1, !0);
          i || (clearTimeout(this.$_refreshTimout), this.$_refreshTimout = setTimeout(this.handleScroll, this.updateInterval + 100));
        });
        t(), this.updateInterval && (this.$_updateTimeout = setTimeout(() => {
          this.$_updateTimeout = 0, this.$_scrollDirty && t();
        }, this.updateInterval));
      }
    },
    handleVisibilityChange(e, t) {
      this.ready && (e || t.boundingClientRect.width !== 0 || t.boundingClientRect.height !== 0 ? (this.$emit("visible"), requestAnimationFrame(() => {
        this.updateVisibleItems(!1);
      })) : this.$emit("hidden"));
    },
    updateVisibleItems(e, t = !1) {
      const i = this.itemSize, s = this.gridItems || 1, n = this.itemSecondarySize || i, u = this.$_computedMinItemSize, c = this.typeField, f = this.simpleArray ? null : this.keyField, l = this.items, h = l.length, b = this.sizes, V = this.$_views, R = this.$_unusedViews, z = this.pool, W = this.itemIndexByKey;
      let w, m, p, _, O;
      if (!h)
        w = m = _ = O = p = 0;
      else if (this.$_prerender)
        w = _ = 0, m = O = Math.min(this.prerender, l.length), p = null;
      else {
        const a = this.getScroll();
        if (t) {
          let g = a.start - this.$_lastUpdateScrollPosition;
          if (g < 0 && (g = -g), i === null && g < u || g < i)
            return {
              continuous: !0
            };
        }
        this.$_lastUpdateScrollPosition = a.start;
        const $ = this.buffer;
        a.start -= $, a.end += $;
        let y = 0;
        if (this.$refs.before && (y = this.$refs.before.scrollHeight, a.start -= y), this.$refs.after) {
          const g = this.$refs.after.scrollHeight;
          a.end += g;
        }
        if (i === null) {
          let g, P = 0, L = h - 1, S = ~~(h / 2), D;
          do
            D = S, g = b[S].accumulator, g < a.start ? P = S : S < h - 1 && b[S + 1].accumulator > a.start && (L = S), S = ~~((P + L) / 2);
          while (S !== D);
          for (S < 0 && (S = 0), w = S, p = b[h - 1].accumulator, m = S; m < h && b[m].accumulator < a.end; m++) ;
          for (m === -1 ? m = l.length - 1 : (m++, m > h && (m = h)), _ = w; _ < h && y + b[_].accumulator < a.start; _++) ;
          for (O = _; O < h && y + b[O].accumulator < a.end; O++) ;
        } else {
          w = ~~(a.start / i * s);
          const g = w % s;
          w -= g, m = Math.ceil(a.end / i * s), _ = Math.max(0, Math.floor((a.start - y) / i * s)), O = Math.floor((a.end - y) / i * s), w < 0 && (w = 0), m > h && (m = h), _ < 0 && (_ = 0), O > h && (O = h), p = Math.ceil(h / s) * i;
        }
      }
      m - w > dt.itemsLimit && this.itemsLimitError(), this.totalSize = p;
      let d;
      const A = w <= this.$_endIndex && m >= this.$_startIndex;
      if (A)
        for (let a = 0, $ = z.length; a < $; a++)
          d = z[a], d.nr.used && (e && (d.nr.index = W[d.item[f]]), (d.nr.index == null || d.nr.index < w || d.nr.index >= m) && this.unuseView(d));
      const K = A ? null : /* @__PURE__ */ new Map();
      let C, I, N;
      for (let a = w; a < m; a++) {
        C = l[a];
        const $ = f ? C[f] : C;
        if ($ == null)
          throw new Error(`Key is ${$} on item (keyField is '${f}')`);
        if (d = V.get($), !i && !b[a].size) {
          d && this.unuseView(d);
          continue;
        }
        I = C[c];
        let y = R.get(I), g = !1;
        if (!d)
          A ? y && y.length ? d = y.pop() : d = this.addView(z, a, C, $, I) : (N = K.get(I) || 0, (!y || N >= y.length) && (d = this.addView(z, a, C, $, I), this.unuseView(d, !0), y = R.get(I)), d = y[N], K.set(I, N + 1)), V.delete(d.nr.key), d.nr.used = !0, d.nr.index = a, d.nr.key = $, d.nr.type = I, V.set($, d), g = !0;
        else if (!d.nr.used && (d.nr.used = !0, g = !0, y)) {
          const P = y.indexOf(d);
          P !== -1 && y.splice(P, 1);
        }
        d.item = C, g && (a === l.length - 1 && this.$emit("scroll-end"), a === 0 && this.$emit("scroll-start")), i === null ? (d.position = b[a - 1].accumulator, d.offset = 0) : (d.position = Math.floor(a / s) * i, d.offset = a % s * n);
      }
      return this.$_startIndex = w, this.$_endIndex = m, this.emitUpdate && this.$emit("update", w, m, _, O), clearTimeout(this.$_sortTimer), this.$_sortTimer = setTimeout(this.sortViews, this.updateInterval + 300), {
        continuous: A
      };
    },
    getListenerTarget() {
      let e = we(this.$el);
      return window.document && (e === window.document.documentElement || e === window.document.body) && (e = window), e;
    },
    getScroll() {
      const { $el: e, direction: t } = this, i = t === "vertical";
      let s;
      if (this.pageMode) {
        const n = e.getBoundingClientRect(), u = i ? n.height : n.width;
        let c = -(i ? n.top : n.left), f = i ? window.innerHeight : window.innerWidth;
        c < 0 && (f += c, c = 0), c + f > u && (f = u - c), s = {
          start: c,
          end: c + f
        };
      } else i ? s = {
        start: e.scrollTop,
        end: e.scrollTop + e.clientHeight
      } : s = {
        start: e.scrollLeft,
        end: e.scrollLeft + e.clientWidth
      };
      return s;
    },
    applyPageMode() {
      this.pageMode ? this.addListeners() : this.removeListeners();
    },
    addListeners() {
      this.listenerTarget = this.getListenerTarget(), this.listenerTarget.addEventListener("scroll", this.handleScroll, ae ? {
        passive: !0
      } : !1), this.listenerTarget.addEventListener("resize", this.handleResize);
    },
    removeListeners() {
      this.listenerTarget && (this.listenerTarget.removeEventListener("scroll", this.handleScroll), this.listenerTarget.removeEventListener("resize", this.handleResize), this.listenerTarget = null);
    },
    scrollToItem(e) {
      let t;
      const i = this.gridItems || 1;
      this.itemSize === null ? t = e > 0 ? this.sizes[e - 1].accumulator : 0 : t = Math.floor(e / i) * this.itemSize, this.scrollToPosition(t);
    },
    scrollToPosition(e) {
      const t = this.direction === "vertical" ? { scroll: "scrollTop", start: "top" } : { scroll: "scrollLeft", start: "left" };
      let i, s, n;
      if (this.pageMode) {
        const u = we(this.$el), c = u.tagName === "HTML" ? 0 : u[t.scroll], f = u.getBoundingClientRect(), h = this.$el.getBoundingClientRect()[t.start] - f[t.start];
        i = u, s = t.scroll, n = e + c + h;
      } else
        i = this.$el, s = t.scroll, n = e;
      i[s] = n;
    },
    itemsLimitError() {
      throw setTimeout(() => {
      }), new Error("Rendered items limit reached");
    },
    sortViews() {
      this.pool.sort((e, t) => e.nr.index - t.nr.index);
    }
  }
};
const bt = {
  key: 0,
  ref: "before",
  class: "vue-recycle-scroller__slot"
}, gt = {
  key: 1,
  ref: "after",
  class: "vue-recycle-scroller__slot"
};
function wt(e, t, i, s, n, u) {
  const c = Pe("ResizeObserver"), f = Me("observe-visibility");
  return F((k(), E(
    "div",
    {
      class: ee(["vue-recycle-scroller", {
        ready: n.ready,
        "page-mode": i.pageMode,
        [`direction-${e.direction}`]: !0
      }]),
      onScrollPassive: t[0] || (t[0] = (...l) => u.handleScroll && u.handleScroll(...l))
    },
    [
      e.$slots.before ? (k(), E(
        "div",
        bt,
        [
          j(e.$slots, "before")
        ],
        512
        /* NEED_PATCH */
      )) : te("v-if", !0),
      (k(), U(he(i.listTag), {
        ref: "wrapper",
        style: se({ [e.direction === "vertical" ? "minHeight" : "minWidth"]: n.totalSize + "px" }),
        class: ee(["vue-recycle-scroller__item-wrapper", i.listClass])
      }, {
        default: B(() => [
          (k(!0), E(
            Re,
            null,
            Se(n.pool, (l) => (k(), U(he(i.itemTag), re({
              key: l.nr.id,
              style: n.ready ? {
                transform: `translate${e.direction === "vertical" ? "Y" : "X"}(${l.position}px) translate${e.direction === "vertical" ? "X" : "Y"}(${l.offset}px)`,
                width: i.gridItems ? `${e.direction === "vertical" && i.itemSecondarySize || i.itemSize}px` : void 0,
                height: i.gridItems ? `${e.direction === "horizontal" && i.itemSecondarySize || i.itemSize}px` : void 0
              } : null,
              class: ["vue-recycle-scroller__item-view", [
                i.itemClass,
                {
                  hover: !i.skipHover && n.hoverKey === l.nr.key
                }
              ]]
            }, Ee(i.skipHover ? {} : {
              mouseenter: () => {
                n.hoverKey = l.nr.key;
              },
              mouseleave: () => {
                n.hoverKey = null;
              }
            })), {
              default: B(() => [
                j(e.$slots, "default", {
                  item: l.item,
                  index: l.nr.index,
                  active: l.nr.used
                })
              ]),
              _: 2
              /* DYNAMIC */
            }, 1040, ["style", "class"]))),
            128
            /* KEYED_FRAGMENT */
          )),
          j(e.$slots, "empty")
        ]),
        _: 3
        /* FORWARDED */
      }, 8, ["style", "class"])),
      e.$slots.after ? (k(), E(
        "div",
        gt,
        [
          j(e.$slots, "after")
        ],
        512
        /* NEED_PATCH */
      )) : te("v-if", !0),
      ie(c, { onNotify: u.handleResize }, null, 8, ["onNotify"])
    ],
    34
    /* CLASS, HYDRATE_EVENTS */
  )), [
    [f, u.handleVisibilityChange]
  ]);
}
de.render = wt;
de.__file = "src/components/RecycleScroller.vue";
const St = ["onClick"], zt = { style: { display: "inline-block" } }, _t = {
  key: 1,
  class: "input-text-content"
}, It = /* @__PURE__ */ Ae({
  __name: "index",
  props: {
    mode: { default: "tree" },
    modelValue: { default: "" },
    isView: { type: Boolean, default: !1 },
    width: { default: "" },
    size: { default: "default" },
    options: { default: () => [] },
    placement: { default: "bottom" },
    maxCount: { default: 6 },
    offset: { default: 0 },
    popperOptions: { default: () => ({}) },
    showFullPath: { type: Boolean, default: !1 },
    fieldNames: { default: () => ({
      label: "value",
      children: "children"
    }) },
    treeOptions: { default: () => ({}) },
    path: {},
    nodeKey: {},
    showInputDom: { type: Boolean, default: !0 }
  },
  emits: ["update:modelValue", "input", "change", "node-click", "update:path"],
  setup(e, { emit: t }) {
    const i = t, s = e, n = q(() => s.nodeKey || s.fieldNames.label), u = x("");
    J(
      () => s.path,
      (r) => {
        r && r !== u.value && (u.value = r);
      },
      { immediate: !0 }
    );
    const c = x(null);
    function f() {
      I.value = !1;
    }
    function l() {
      document.documentElement.click();
    }
    Le(() => {
      document.addEventListener("click", f);
    }), De(() => {
      document.removeEventListener("click", f);
    });
    const h = q(() => {
      var r;
      return ((r = s == null ? void 0 : s.treeOptions) == null ? void 0 : r.load) ?? void 0;
    }), b = q(() => {
      var r;
      return ((r = s == null ? void 0 : s.treeOptions) == null ? void 0 : r.lazy) ?? h.value;
    }), V = async (r) => {
      if (i("update:path", r.path || ""), s.mode === "tree") {
        if (b.value) {
          s.showFullPath ? p.value = r.pathName || "" : p.value = r.name || "";
          return;
        }
        let o = _.value.treeRef.getNode(r), T = [o.data[s.fieldNames.label] || ""];
        if (s.showFullPath)
          for (; o.parent && o.parent.data[s.fieldNames.label]; )
            o = o.parent, T.unshift(o.data[s.fieldNames.label]);
        p.value = T.join("/");
      } else {
        let o = r[s.fieldNames.label] || "";
        p.value = o;
      }
    }, R = (r) => {
      V(r), l(), i("node-click", r), i("update:modelValue", p.value), i("change", p.value);
    }, z = x(""), W = x(null), w = Q(s, "size"), m = Q(s, "isView");
    J(
      () => s.isView,
      (r) => {
        r && l();
      }
    );
    const p = Q(s, "modelValue"), _ = x(null), O = (r) => {
      N.value = a(), L().then((o) => {
        C(o), ue(() => {
          var T, v, H;
          (H = (v = (T = W.value) == null ? void 0 : T.popperRef) == null ? void 0 : v.popperInstanceRef) == null || H.forceUpdate();
        });
      }), i("update:modelValue", r), i("input", r);
    }, d = (r) => {
      r = r.replace(/^\s+|\s+$/g, ""), i("change", r);
    }, A = () => {
      z.value = "", N.value = a(), setTimeout(() => {
        I.value = !0;
      });
    }, K = () => {
      if (s.showFullPath) {
        let r = p.value.split("/");
        z.value = r[r.length - 1] || "";
      } else
        z.value = p.value || "";
    }, C = (r) => {
      r.length > 0 ? (I.value = !m.value && !0, S.value = r) : I.value = !1;
    }, I = x(!1), N = x(!1), a = () => p.value.length > 0, $ = () => {
      N.value = a(), l(), ke(), L().then((r) => {
        C(r);
      });
    }, y = async (r) => {
      r.disabled || (V(r), l(), i("node-click", r), i("update:modelValue", p.value), i("change", p.value));
    }, g = (r) => {
      let o = 0;
      switch (r) {
        case "table":
          o = 132;
          break;
        default:
          o = 230;
      }
      return o;
    }, P = (r, o) => {
      if (!o) return r;
      let T = [];
      for (let v = 0; v < r.length; v++)
        r[v][s.fieldNames.label].includes(o) && T.push(r[v]), r[v][s.fieldNames.children] && r[v][s.fieldNames.children].length > 0 && T.push(...P(r[v][s.fieldNames.children], o));
      return T;
    }, L = async () => {
      K();
      let r = [];
      if (!b.value)
        r = P(s.options, z.value);
      else if (!p.value)
        r = P([""], null);
      else {
        let o = await s.treeOptions.search(z.value);
        r = P(o, z.value);
      }
      return r;
    }, S = x([]), D = q(() => {
      var r;
      if (s.width) {
        const o = (r = s.width) == null ? void 0 : r.toString();
        return o.includes("%") || o.includes("px") ? o : o + "px";
      }
      return g(s.size);
    }), ce = x(), fe = x(""), ke = () => {
      var o;
      const r = (o = ce.value) == null ? void 0 : o.offsetWidth;
      fe.value = r ? r + "px" : D.value;
    };
    return J(
      () => s.options,
      () => {
        L().then((r) => {
          S.value = r;
        });
      }
    ), (r, o) => {
      const T = Ue;
      return k(), E(
        "div",
        {
          class: "das-ui-autocomplete",
          ref_key: "$completeEL",
          ref: ce,
          style: se(`width:${D.value}`)
        },
        [
          ie(T, {
            ref_key: "domPopover",
            ref: W,
            visible: I.value,
            placement: r.placement,
            width: fe.value,
            "popper-class": "autocomplete-popover",
            "show-arrow": !1,
            offset: r.offset,
            "popper-options": r.popperOptions
          }, {
            reference: B(() => [
              r.showInputDom ? (k(), E("div", {
                key: 0,
                class: "slot-component-box",
                onClick: me($, ["stop"])
              }, [
                ie(M(We), re({
                  ref_key: "inputRef",
                  ref: c,
                  modelValue: M(p),
                  "onUpdate:modelValue": o[3] || (o[3] = (v) => Fe(p) ? p.value = v : null),
                  size: M(w),
                  width: D.value,
                  isView: M(m)
                }, r.$attrs, {
                  onClear: A,
                  onInput: O,
                  onChange: d
                }), Be({
                  _: 2
                  /* DYNAMIC */
                }, [
                  Se(r.$slots, (v, H, Ve) => ({
                    name: H,
                    fn: B(() => [
                      j(r.$slots, H, {}, void 0, !0)
                    ])
                  }))
                ]), 1040, ["modelValue", "size", "width", "isView"])
              ])) : F((k(), E("div", _t, [
                pe(
                  ve(M(p)),
                  1
                  /* TEXT */
                )
              ])), [
                [M(be)]
              ])
            ]),
            default: B(() => [
              F((k(), E(
                "div",
                {
                  class: "autocomplete-select-box",
                  style: se(`max-height: ${32 * r.maxCount}px;`),
                  onClick: o[2] || (o[2] = me(() => {
                  }, ["stop"]))
                },
                [
                  F((k(), U(M(de), {
                    key: S.value.length,
                    items: S.value,
                    "item-size": 32,
                    "key-field": r.fieldNames.value || r.fieldNames.label,
                    class: "virtual-list"
                  }, {
                    default: B(({ item: v, index: H }) => [
                      He("div", {
                        onClick: (Ve) => y(v),
                        class: ee([
                          "select-label",
                          { "current-select-label": v[r.fieldNames.label] === z.value },
                          { "is-disabled": v.disabled }
                        ])
                      }, [
                        F((k(), E("span", zt, [
                          pe(
                            ve(v[r.fieldNames.label]),
                            1
                            /* TEXT */
                          )
                        ])), [
                          [M(be)]
                        ])
                      ], 10, St)
                    ]),
                    _: 1
                    /* STABLE */
                  }, 8, ["items", "key-field"])), [
                    [ye, s.mode === "list" || N.value]
                  ]),
                  s.mode === "tree" ? F((k(), U(M(qe), re({
                    key: 0,
                    width: "120px",
                    filterMode: "input",
                    "node-key": n.value,
                    ref_key: "treeRef",
                    ref: _,
                    "is-ellipsis": "",
                    data: s.options,
                    showFilterInput: !1
                  }, r.treeOptions, {
                    props: { ...r.fieldNames },
                    modelValue: z.value,
                    "onUpdate:modelValue": o[0] || (o[0] = (v) => z.value = v),
                    path: u.value,
                    "onUpdate:path": o[1] || (o[1] = (v) => u.value = v),
                    onNodeClick: R
                  }), null, 16, ["node-key", "data", "props", "modelValue", "path"])), [
                    [ye, !N.value]
                  ]) : te("v-if", !0)
                ],
                4
                /* STYLE */
              )), [
                [M(Ke)]
              ])
            ]),
            _: 3
            /* FORWARDED */
          }, 8, ["visible", "placement", "width", "offset", "popper-options"])
        ],
        4
        /* STYLE */
      );
    };
  }
}), $t = (e, t) => {
  const i = e.__vccOpts || e;
  for (const [s, n] of t)
    i[s] = n;
  return i;
}, kt = /* @__PURE__ */ $t(It, [["__scopeId", "data-v-dc63a23d"]]), Lt = () => x(null), Dt = je(kt);
export {
  Dt as DasAutocomplete,
  Lt as DasAutocompleteRef,
  Dt as default
};
