import '@das-fed/upf-ui/packages/components/autocomplete/style.css';
import { pushScopeId as Oe, popScopeId as Te, nextTick as ue, openBlock as k, createBlock as U, withScopeId as xe, markRaw as Ce, shallowReactive as Ne, resolveComponent as Pe, resolveDirective as Me, withDirectives as F, createElementBlock as E, normalizeClass as ee, renderSlot as j, createCommentVNode as te, resolveDynamicComponent as he, normalizeStyle as ie, withCtx as B, Fragment as Re, renderList as Se, mergeProps as se, toHandlers as Ee, createVNode as ne, defineComponent as Ae, computed as q, ref as x, watch as J, onMounted as Le, onUnmounted as De, withModifiers as me, unref as M, isRef as He, createSlots as Fe, createTextVNode as pe, toDisplayString as ve, createElementVNode as Be, vShow as ye } from "vue";
import { withInstall as je } from "@das-fed/upf-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/upf-ui/packages/components/input/index";
import { vDasTooltip as be } from "@das-fed/upf-ui/packages/components/text-tooltip/index";
import { vOverlay as Ke } from "@das-fed/upf-ui/packages/components/overlay/index";
import { DasTree as qe } from "@das-fed/upf-ui/packages/components/tree/index";
import "@das-fed/upf-ui/packages/components/virtual-tree/index";
import { useModelValue as Q } from "@das-fed/upf-utils/vue";
import "@das-fed/upf-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 r = e.indexOf("Edge/");
  return r > 0 ? parseInt(e.substring(r + 5, e.indexOf(".", r)), 10) : -1;
}
let Y;
function re() {
  re.init || (re.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() {
    re(), 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, r, 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 Ze(e.prototype, t), e;
}
function ge(e) {
  return tt(e) || it(e) || st(e) || nt();
}
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 nt() {
  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 rt(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, r, 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 === r)) {
      var R = i.leading;
      typeof R == "function" && (R = R(l, r)), (!s || l !== r) && R && e.apply(void 0, [l].concat(ge(u))), r = 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 r = this;
      if (this.observer && this.destroyObserver(), !this.frozen) {
        if (this.options = rt(i), this.callback = function(f, l) {
          r.options.callback(f, l), f && r.options.once && (r.frozen = !0, r.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 (r.callback) {
            var b = l.isIntersecting && l.intersectionRatio >= r.threshold;
            if (b === r.oldResult) return;
            r.oldResult = b, r.callback(b, l);
          }
        }, this.options.intersection), ue(function() {
          r.observer && r.observer.observe(r.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 Ie(e, t, i) {
  var s = t.value;
  if (s && !(typeof IntersectionObserver > "u")) {
    var r = new ot(e, s, i);
    e._vue_visibilityState = r;
  }
}
function at(e, t, i) {
  var s = t.value, r = t.oldValue;
  if (!ze(s, r)) {
    var u = e._vue_visibilityState;
    if (!s) {
      _e(e);
      return;
    }
    u ? u.createObserver(s, i) : Ie(e, {
      value: s
    }, i);
  }
}
function _e(e) {
  var t = e._vue_visibilityState;
  t && (t.destroyObserver(), delete e._vue_visibilityState);
}
var ut = {
  beforeMount: Ie,
  updated: at,
  unmounted: _e
}, 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 r = 1e4, u = 0, c;
        for (let f = 0, l = t.length; f < l; f++)
          c = t[f][i] || s, c < r && (r = c), u += c, e[f] = { accumulator: u, size: c };
        return this.$_computedMinItemSize = r, e;
      }
      return [];
    },
    simpleArray: pt,
    itemIndexByKey() {
      const { keyField: e, items: t } = this, i = {};
      for (let s = 0, r = t.length; s < r; 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, r) {
      const u = Ce({
        id: yt++,
        index: t,
        used: !0,
        key: s,
        type: r
      }), 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 r = i.get(s);
      r || (r = [], i.set(s, r)), r.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, r = 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, I, O;
      if (!h)
        w = m = I = O = p = 0;
      else if (this.$_prerender)
        w = I = 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)), I = w; I < h && y + b[I].accumulator < a.start; I++) ;
          for (O = I; 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), I = 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), I < 0 && (I = 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, _, 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;
        }
        _ = C[c];
        let y = R.get(_), g = !1;
        if (!d)
          A ? y && y.length ? d = y.pop() : d = this.addView(z, a, C, $, _) : (N = K.get(_) || 0, (!y || N >= y.length) && (d = this.addView(z, a, C, $, _), this.unuseView(d, !0), y = R.get(_)), d = y[N], K.set(_, N + 1)), V.delete(d.nr.key), d.nr.used = !0, d.nr.index = a, d.nr.key = $, d.nr.type = _, 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 * r);
      }
      return this.$_startIndex = w, this.$_endIndex = m, this.emitUpdate && this.$emit("update", w, m, I, 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 r = e.getBoundingClientRect(), u = i ? r.height : r.width;
        let c = -(i ? r.top : r.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, r;
      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, r = e + c + h;
      } else
        i = this.$el, s = t.scroll, r = e;
      i[s] = r;
    },
    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, r, u) {
  const c = Pe("ResizeObserver"), f = Me("observe-visibility");
  return F((k(), E(
    "div",
    {
      class: ee(["vue-recycle-scroller", {
        ready: r.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: ie({ [e.direction === "vertical" ? "minHeight" : "minWidth"]: r.totalSize + "px" }),
        class: ee(["vue-recycle-scroller__item-wrapper", i.listClass])
      }, {
        default: B(() => [
          (k(!0), E(
            Re,
            null,
            Se(r.pool, (l) => (k(), U(he(i.itemTag), se({
              key: l.nr.id,
              style: r.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 && r.hoverKey === l.nr.key
                }
              ]]
            }, Ee(i.skipHover ? {} : {
              mouseenter: () => {
                r.hoverKey = l.nr.key;
              },
              mouseleave: () => {
                r.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),
      ne(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" } }, It = {
  key: 1,
  class: "input-text-content"
}, _t = /* @__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, r = q(() => s.nodeKey || s.fieldNames.label), u = x("");
    J(
      () => s.path,
      (n) => {
        n && n !== u.value && (u.value = n);
      },
      { immediate: !0 }
    );
    const c = x(null);
    function f() {
      _.value = !1;
    }
    function l() {
      document.documentElement.click();
    }
    Le(() => {
      document.addEventListener("click", f);
    }), De(() => {
      document.removeEventListener("click", f);
    });
    const h = q(() => {
      var n;
      return ((n = s == null ? void 0 : s.treeOptions) == null ? void 0 : n.load) ?? void 0;
    }), b = q(() => {
      var n;
      return ((n = s == null ? void 0 : s.treeOptions) == null ? void 0 : n.lazy) ?? h.value;
    }), V = async (n) => {
      if (i("update:path", n.path || ""), s.mode === "tree") {
        if (b.value) {
          s.showFullPath ? p.value = n.pathName || "" : p.value = n.name || "";
          return;
        }
        let o = I.value.treeRef.getNode(n), 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 = n[s.fieldNames.label] || "";
        p.value = o;
      }
    }, R = (n) => {
      V(n), l(), i("node-click", n), 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,
      (n) => {
        n && l();
      }
    );
    const p = Q(s, "modelValue"), I = x(null), O = (n) => {
      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", n), i("input", n);
    }, d = (n) => {
      const o = String(n).replace(/^\s+|\s+$/g, "");
      i("change", o);
    }, A = () => {
      z.value = "", N.value = a(), setTimeout(() => {
        _.value = !0;
      });
    }, K = () => {
      if (s.showFullPath) {
        let n = p.value.split("/");
        z.value = n[n.length - 1] || "";
      } else
        z.value = p.value || "";
    }, C = (n) => {
      n.length > 0 ? (_.value = !m.value && !0, S.value = n) : _.value = !1;
    }, _ = x(!1), N = x(!1), a = () => p.value.length > 0, $ = () => {
      N.value = a(), l(), ke(), L().then((n) => {
        C(n);
      });
    }, y = async (n) => {
      n.disabled || (V(n), l(), i("node-click", n), i("update:modelValue", p.value), i("change", p.value));
    }, g = (n) => {
      let o = 0;
      switch (n) {
        case "table":
          o = 132;
          break;
        default:
          o = 230;
      }
      return o;
    }, P = (n, o) => {
      if (!o) return n;
      let T = [];
      for (let v = 0; v < n.length; v++)
        n[v][s.fieldNames.label].includes(o) && T.push(n[v]), n[v][s.fieldNames.children] && n[v][s.fieldNames.children].length > 0 && T.push(...P(n[v][s.fieldNames.children], o));
      return T;
    }, L = async () => {
      K();
      let n = [];
      if (!b.value)
        n = P(s.options, z.value);
      else if (!p.value)
        n = P([""], null);
      else {
        let o = await s.treeOptions.search(z.value);
        n = P(o, z.value);
      }
      return n;
    }, S = x([]), D = q(() => {
      var n;
      if (s.width) {
        const o = (n = s.width) == null ? void 0 : n.toString();
        return o.includes("%") || o.includes("px") ? o : o + "px";
      }
      return g(s.size);
    }), ce = x(), fe = x(""), ke = () => {
      var o;
      const n = (o = ce.value) == null ? void 0 : o.offsetWidth;
      fe.value = n ? n + "px" : D.value;
    };
    return J(
      () => s.options,
      () => {
        L().then((n) => {
          S.value = n;
        });
      }
    ), (n, o) => {
      const T = Ue;
      return k(), E(
        "div",
        {
          class: "das-ui-autocomplete",
          ref_key: "$completeEL",
          ref: ce,
          style: ie(`width:${D.value}`)
        },
        [
          ne(T, {
            ref_key: "domPopover",
            ref: W,
            visible: _.value,
            placement: e.placement,
            width: fe.value,
            "popper-class": "autocomplete-popover",
            "show-arrow": !1,
            offset: e.offset,
            "popper-options": e.popperOptions
          }, {
            reference: B(() => [
              e.showInputDom ? (k(), E("div", {
                key: 0,
                class: "slot-component-box",
                onClick: me($, ["stop"])
              }, [
                ne(M(We), se({
                  ref_key: "inputRef",
                  ref: c,
                  modelValue: M(p),
                  "onUpdate:modelValue": o[3] || (o[3] = (v) => He(p) ? p.value = v : null),
                  size: M(w),
                  width: D.value,
                  isView: M(m)
                }, n.$attrs, {
                  onClear: A,
                  onInput: O,
                  onChange: d
                }), Fe({
                  _: 2
                  /* DYNAMIC */
                }, [
                  Se(n.$slots, (v, H, Ve) => ({
                    name: H,
                    fn: B(() => [
                      j(n.$slots, H, {}, void 0, !0)
                    ])
                  }))
                ]), 1040, ["modelValue", "size", "width", "isView"])
              ])) : F((k(), E("div", It, [
                pe(
                  ve(M(p)),
                  1
                  /* TEXT */
                )
              ])), [
                [M(be)]
              ])
            ]),
            default: B(() => [
              F((k(), E(
                "div",
                {
                  class: "autocomplete-select-box",
                  style: ie(`max-height: ${32 * e.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": e.fieldNames.value || e.fieldNames.label,
                    class: "virtual-list"
                  }, {
                    default: B(({ item: v, index: H }) => [
                      Be("div", {
                        onClick: (Ve) => y(v),
                        class: ee([
                          "select-label",
                          { "current-select-label": v[e.fieldNames.label] === z.value },
                          { "is-disabled": v.disabled }
                        ])
                      }, [
                        F((k(), E("span", zt, [
                          pe(
                            ve(v[e.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), se({
                    key: 0,
                    width: "120px",
                    filterMode: "input",
                    "node-key": r.value,
                    ref_key: "treeRef",
                    ref: I,
                    "is-ellipsis": "",
                    data: s.options,
                    showFilterInput: !1
                  }, e.treeOptions, {
                    props: { ...e.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, r] of t)
    i[s] = r;
  return i;
}, kt = /* @__PURE__ */ $t(_t, [["__scopeId", "data-v-181754c4"]]), Dt = () => x(null), Ht = je(kt);
export {
  Ht as DasAutocomplete,
  Dt as DasAutocompleteRef,
  Ht as default
};
