var Rs = class {
  constructor() {
    this.allSyncListeners = /* @__PURE__ */ new Map(), this.allAsyncListeners = /* @__PURE__ */ new Map(), this.globalSyncListeners = /* @__PURE__ */ new Set(), this.globalAsyncListeners = /* @__PURE__ */ new Set(), this.asyncFunctionsQueue = [], this.scheduled = !1, this.firedEvents = {};
  }
  setFrameworkOverrides(e) {
    this.frameworkOverrides = e;
  }
  getListeners(e, t, s) {
    const i = t ? this.allAsyncListeners : this.allSyncListeners;
    let r = i.get(e);
    return !r && s && (r = /* @__PURE__ */ new Set(), i.set(e, r)), r;
  }
  noRegisteredListenersExist() {
    return this.allSyncListeners.size === 0 && this.allAsyncListeners.size === 0 && this.globalSyncListeners.size === 0 && this.globalAsyncListeners.size === 0;
  }
  addEventListener(e, t, s = !1) {
    this.getListeners(e, s, !0).add(t);
  }
  removeEventListener(e, t, s = !1) {
    const i = this.getListeners(e, s, !1);
    i && (i.delete(t), i.size === 0 && (s ? this.allAsyncListeners : this.allSyncListeners).delete(e));
  }
  addGlobalListener(e, t = !1) {
    this.getGlobalListeners(t).add(e);
  }
  removeGlobalListener(e, t = !1) {
    this.getGlobalListeners(t).delete(e);
  }
  dispatchEvent(e) {
    this.dispatchToListeners(e, !0), this.dispatchToListeners(e, !1), this.firedEvents[e.type] = !0;
  }
  dispatchEventOnce(e) {
    this.firedEvents[e.type] || this.dispatchEvent(e);
  }
  dispatchToListeners(e, t) {
    const s = e.type;
    if (t && "event" in e) {
      const a = e.event;
      a instanceof Event && (e.eventPath = a.composedPath());
    }
    const { frameworkOverrides: i } = this, r = (a) => {
      const l = i ? () => i.wrapIncoming(a) : a;
      t ? this.dispatchAsync(l) : l();
    }, n = this.getListeners(s, t, !1);
    if (((n == null ? void 0 : n.size) ?? 0) > 0) {
      const a = new Set(n);
      for (const l of a)
        n != null && n.has(l) && r(() => l(e));
    }
    const o = this.getGlobalListeners(t);
    if (o.size > 0) {
      const a = new Set(o);
      for (const l of a)
        r(() => l(s, e));
    }
  }
  getGlobalListeners(e) {
    return e ? this.globalAsyncListeners : this.globalSyncListeners;
  }
  // this gets called inside the grid's thread, for each event that it
  // wants to set async. the grid then batches the events into one setTimeout()
  // because setTimeout() is an expensive operation. ideally we would have
  // each event in it's own setTimeout(), but we batch for performance.
  dispatchAsync(e) {
    if (this.asyncFunctionsQueue.push(e), !this.scheduled) {
      const t = () => {
        window.setTimeout(this.flushAsyncQueue.bind(this), 0);
      };
      this.frameworkOverrides ? this.frameworkOverrides.wrapIncoming(t) : t(), this.scheduled = !0;
    }
  }
  // this happens in the next VM turn only, and empties the queue of events
  flushAsyncQueue() {
    this.scheduled = !1;
    const e = this.asyncFunctionsQueue.slice();
    this.asyncFunctionsQueue = [], e.forEach((t) => t());
  }
};
function Ce(e) {
  return e == null || e === "" ? null : e;
}
function A(e) {
  return e != null && e !== "";
}
function ee(e) {
  return !A(e);
}
function ut(e) {
  return e != null && typeof e.toString == "function" ? e.toString() : null;
}
function Si(e, t) {
  const s = e ? JSON.stringify(e) : null, i = t ? JSON.stringify(t) : null;
  return s === i;
}
function vo(e, t, s = !1) {
  const i = e == null, r = t == null;
  if (e && e.toNumber && (e = e.toNumber()), t && t.toNumber && (t = t.toNumber()), i && r)
    return 0;
  if (i)
    return -1;
  if (r)
    return 1;
  function n(o, a) {
    return o > a ? 1 : o < a ? -1 : 0;
  }
  if (typeof e != "string" || !s)
    return n(e, t);
  try {
    return e.localeCompare(t);
  } catch {
    return n(e, t);
  }
}
var sw = /[&<>"']/g, iw = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;",
  "'": "&#39;"
};
function Nt(e) {
  return (e == null ? void 0 : e.toString().toString()) ?? null;
}
function bt(e) {
  var t;
  return ((t = Nt(e)) == null ? void 0 : t.replace(sw, (s) => iw[s])) ?? null;
}
function xi(e) {
  return e.eRootDiv.getRootNode();
}
function Q(e) {
  return xi(e).activeElement;
}
function me(e) {
  const { gos: t, eRootDiv: s } = e;
  let i = null;
  const r = t.get("getDocument");
  return r && A(r) ? i = r() : s && (i = s.ownerDocument), i && A(i) ? i : document;
}
function Jt(e) {
  const t = Q(e);
  return t === null || t === me(e).body;
}
function Pg(e) {
  return me(e).defaultView || window;
}
function Xo(e) {
  let t = null, s = null;
  try {
    t = me(e).fullscreenElement;
  } catch {
  } finally {
    t || (t = xi(e));
    const i = t.querySelector("body");
    i ? s = i : t instanceof ShadowRoot ? s = t : t instanceof Document ? s = t == null ? void 0 : t.documentElement : s = t;
  }
  return s;
}
function rw(e) {
  const t = Xo(e);
  return (t == null ? void 0 : t.clientWidth) ?? (window.innerWidth || -1);
}
function nw(e) {
  const t = Xo(e);
  return (t == null ? void 0 : t.clientHeight) ?? (window.innerHeight || -1);
}
function it(e, t, s) {
  s == null || typeof s == "string" && s == "" ? Ac(e, t) : Ft(e, t, s);
}
function Ft(e, t, s) {
  e.setAttribute(Eg(t), s.toString());
}
function Ac(e, t) {
  e.removeAttribute(Eg(t));
}
function Eg(e) {
  return `aria-${e}`;
}
function Ye(e, t) {
  t ? e.setAttribute("role", t) : e.removeAttribute("role");
}
function ow(e) {
  let t;
  return e === "asc" ? t = "ascending" : e === "desc" ? t = "descending" : e === "mixed" ? t = "other" : t = "none", t;
}
function aw(e) {
  return parseInt(e.getAttribute("aria-posinset"), 10);
}
function lw(e) {
  return e.getAttribute("aria-label");
}
function re(e, t) {
  it(e, "label", t);
}
function Js(e, t) {
  it(e, "labelledby", t);
}
function Zo(e, t) {
  it(e, "describedby", t);
}
function Tg(e, t) {
  it(e, "live", t);
}
function cw(e, t) {
  it(e, "atomic", t);
}
function dw(e, t) {
  it(e, "relevant", t);
}
function hw(e, t) {
  it(e, "invalid", t);
}
function Qo(e, t) {
  it(e, "level", t);
}
function wo(e, t) {
  it(e, "disabled", t);
}
function Ic(e, t) {
  it(e, "hidden", t);
}
function Mg(e, t) {
  it(e, "activedescendant", t);
}
function qe(e, t) {
  Ft(e, "expanded", t);
}
function Dg(e) {
  Ac(e, "expanded");
}
function Jo(e, t) {
  Ft(e, "setsize", t);
}
function ea(e, t) {
  Ft(e, "posinset", t);
}
function uw(e, t) {
  Ft(e, "multiselectable", t);
}
function gw(e, t) {
  Ft(e, "rowcount", t);
}
function en(e, t) {
  Ft(e, "rowindex", t);
}
function pw(e, t) {
  Ft(e, "rowspan", t);
}
function fw(e, t) {
  Ft(e, "colcount", t);
}
function Lc(e, t) {
  Ft(e, "colindex", t);
}
function Ag(e, t) {
  Ft(e, "colspan", t);
}
function mw(e, t) {
  Ft(e, "sort", t);
}
function Cw(e) {
  Ac(e, "sort");
}
function ta(e, t) {
  it(e, "selected", t);
}
function Ig(e, t) {
  Ft(e, "checked", t === void 0 ? "mixed" : t);
}
function Ol(e, t) {
  it(e, "controls", t);
}
function kc(e, t) {
  Ol(e, t.id), Js(t, e.id);
}
function hh(e, t) {
  it(e, "owns", t);
}
function vw(e, t) {
  it(e, "haspopup", t === !1 ? null : t);
}
function sa(e, t) {
  return t === void 0 ? e("ariaIndeterminate", "indeterminate") : t === !0 ? e("ariaChecked", "checked") : e("ariaUnchecked", "unchecked");
}
function bo(e, t, s) {
  const i = e.parentElement;
  let r = i && i.firstChild;
  for (; r; )
    t && r.classList.toggle(t, r === e), s && r.classList.toggle(s, r !== e), r = r.nextSibling;
}
var ww = "[tabindex], input, select, button, textarea, [href]", Lg = "[disabled], .ag-disabled:not(.ag-button), .ag-disabled *";
function Gc(e) {
  const t = Element.prototype.matches || Element.prototype.msMatchesSelector, i = t.call(e, "input, select, button, textarea"), r = t.call(e, Lg), n = Ze(e);
  return i && !r && n;
}
function O(e, t, s = {}) {
  const { skipAriaHidden: i } = s;
  e.classList.toggle("ag-hidden", !t), i || Ic(e, !t);
}
function kg(e, t, s = {}) {
  const { skipAriaHidden: i } = s;
  e.classList.toggle("ag-invisible", !t), i || Ic(e, !t);
}
function Fi(e, t) {
  const s = "disabled", i = t ? (n) => n.setAttribute(s, "") : (n) => n.removeAttribute(s);
  i(e);
  const r = e.querySelectorAll("input") ?? [];
  for (const n of r)
    i(n);
}
function mi(e, t, s) {
  let i = 0;
  for (; e; ) {
    if (e.classList.contains(t))
      return !0;
    if (e = e.parentElement, typeof s == "number") {
      if (++i > s)
        break;
    } else if (e === s)
      break;
  }
  return !1;
}
function Vi(e) {
  const {
    height: t,
    width: s,
    borderTopWidth: i,
    borderRightWidth: r,
    borderBottomWidth: n,
    borderLeftWidth: o,
    paddingTop: a,
    paddingRight: l,
    paddingBottom: c,
    paddingLeft: d,
    marginTop: h,
    marginRight: u,
    marginBottom: g,
    marginLeft: p,
    boxSizing: f
  } = window.getComputedStyle(e);
  return {
    height: parseFloat(t || "0"),
    width: parseFloat(s || "0"),
    borderTopWidth: parseFloat(i || "0"),
    borderRightWidth: parseFloat(r || "0"),
    borderBottomWidth: parseFloat(n || "0"),
    borderLeftWidth: parseFloat(o || "0"),
    paddingTop: parseFloat(a || "0"),
    paddingRight: parseFloat(l || "0"),
    paddingBottom: parseFloat(c || "0"),
    paddingLeft: parseFloat(d || "0"),
    marginTop: parseFloat(h || "0"),
    marginRight: parseFloat(u || "0"),
    marginBottom: parseFloat(g || "0"),
    marginLeft: parseFloat(p || "0"),
    boxSizing: f
  };
}
function ia(e) {
  const t = Vi(e);
  return t.boxSizing === "border-box" ? t.height - t.paddingTop - t.paddingBottom : t.height;
}
function hr(e) {
  const t = Vi(e);
  return t.boxSizing === "border-box" ? t.width - t.paddingLeft - t.paddingRight : t.width;
}
function ra(e) {
  const { height: t, marginBottom: s, marginTop: i } = Vi(e);
  return Math.floor(t + s + i);
}
function Ri(e) {
  const { width: t, marginLeft: s, marginRight: i } = Vi(e);
  return Math.floor(t + s + i);
}
function Gg(e) {
  const t = e.getBoundingClientRect(), { borderTopWidth: s, borderLeftWidth: i, borderRightWidth: r, borderBottomWidth: n } = Vi(e);
  return {
    top: t.top + (s || 0),
    left: t.left + (i || 0),
    right: t.right + (r || 0),
    bottom: t.bottom + (n || 0)
  };
}
function yo(e, t) {
  let s = e.scrollLeft;
  return t && (s = Math.abs(s)), s;
}
function So(e, t, s) {
  s && (t *= -1), e.scrollLeft = t;
}
function X(e) {
  for (; e && e.firstChild; )
    e.removeChild(e.firstChild);
}
function se(e) {
  e && e.parentNode && e.parentNode.removeChild(e);
}
function Og(e) {
  return !!e.offsetParent;
}
function Ze(e) {
  const t = e;
  return t.checkVisibility ? t.checkVisibility({ checkVisibilityCSS: !0 }) : !(!Og(e) || window.getComputedStyle(e).visibility !== "visible");
}
function Oc(e) {
  const t = document.createElement("div");
  return t.innerHTML = (e || "").trim(), t.firstChild;
}
function Vg(e, t, s) {
  s && s.nextSibling === t || (e.firstChild ? s ? s.nextSibling ? e.insertBefore(t, s.nextSibling) : e.appendChild(t) : e.firstChild && e.firstChild !== t && e.insertAdjacentElement("afterbegin", t) : e.appendChild(t));
}
function Bg(e, t) {
  for (let s = 0; s < t.length; s++) {
    const i = t[s], r = e.children[s];
    r !== i && e.insertBefore(i, r);
  }
}
function bw(e) {
  return e.replace(/[A-Z]/g, (t) => `-${t.toLocaleLowerCase()}`);
}
function fn(e, t) {
  if (t)
    for (const s of Object.keys(t)) {
      const i = t[s];
      if (!s || !s.length || i == null)
        continue;
      const r = bw(s), n = i.toString(), o = n.replace(/\s*!important/g, ""), a = o.length != n.length ? "important" : void 0;
      e.style.setProperty(r, o, a);
    }
}
function Ci(e) {
  return () => {
    const t = e();
    return t ? Vc(t) || Ng(t) : !0;
  };
}
function Vc(e) {
  return e.clientWidth < e.scrollWidth;
}
function Ng(e) {
  return e.clientHeight < e.scrollHeight;
}
function xo(e, t) {
  t === "flex" ? (e.style.removeProperty("width"), e.style.removeProperty("minWidth"), e.style.removeProperty("maxWidth"), e.style.flex = "1 1 auto") : Ot(e, t);
}
function Ot(e, t) {
  t = Bc(t), e.style.width = t, e.style.maxWidth = t, e.style.minWidth = t;
}
function Ur(e, t) {
  t = Bc(t), e.style.height = t, e.style.maxHeight = t, e.style.minHeight = t;
}
function Bc(e) {
  return typeof e == "number" ? `${e}px` : e;
}
function na(e) {
  return e instanceof Node || e instanceof HTMLElement;
}
function vt(e, t, s) {
  s == null || s === "" ? e.removeAttribute(t) : e.setAttribute(t, s.toString());
}
function os(e, t, s) {
  const r = Pg(e).ResizeObserver, n = r ? new r(s) : null;
  return n == null || n.observe(t), () => n == null ? void 0 : n.disconnect();
}
function xt(e, t) {
  const s = Pg(e);
  s.requestAnimationFrame ? s.requestAnimationFrame(t) : s.webkitRequestAnimationFrame ? s.webkitRequestAnimationFrame(t) : s.setTimeout(t, 0);
}
var Hg = "data-ref", Ha;
function uh() {
  return Ha ?? (Ha = document.createTextNode(" ")), Ha.cloneNode();
}
function mn(e) {
  const { attrs: t, children: s, cls: i, ref: r, role: n, tag: o } = e, a = document.createElement(o);
  if (i && (a.className = i), r && a.setAttribute(Hg, r), n && a.setAttribute("role", n), t)
    for (const l of Object.keys(t))
      a.setAttribute(l, t[l]);
  if (s)
    if (typeof s == "string")
      a.textContent = s;
    else {
      let l = !0;
      for (const c of s)
        c && (typeof c == "string" ? (a.appendChild(document.createTextNode(c)), l = !1) : typeof c == "function" ? a.appendChild(c()) : (l && (a.appendChild(uh()), l = !1), a.append(mn(c)), a.appendChild(uh())));
    }
  return a;
}
var yw = ["touchstart", "touchend", "touchmove", "touchcancel", "scroll"], Sw = ["wheel"], za = {}, zg = /* @__PURE__ */ (() => {
  const e = {
    select: "input",
    change: "input",
    submit: "form",
    reset: "form",
    error: "img",
    load: "img",
    abort: "img"
  };
  return (s) => {
    if (typeof za[s] == "boolean")
      return za[s];
    const i = document.createElement(e[s] || "div");
    return s = "on" + s, za[s] = s in i;
  };
})();
function Vl(e, t) {
  return !t || !e ? !1 : Fw(t).indexOf(e) >= 0;
}
function xw(e) {
  const t = [];
  let s = e.target;
  for (; s; )
    t.push(s), s = s.parentElement;
  return t;
}
function Fw(e) {
  const t = e;
  return t.path ? t.path : t.composedPath ? t.composedPath() : xw(t);
}
function Rw(e, t, s) {
  const i = Pw(t);
  let r;
  i != null && (r = { passive: i }), e.addEventListener(t, s, r);
}
var Pw = (e) => {
  const t = yw.includes(e), s = Sw.includes(e);
  if (t)
    return !0;
  if (s)
    return !1;
};
function Wg(e, t, s) {
  if (s === 0)
    return !1;
  const i = Math.abs(e.clientX - t.clientX), r = Math.abs(e.clientY - t.clientY);
  return Math.max(i, r) <= s;
}
function tn(e, t) {
  return e.gos.isElementInThisInstance(t.target);
}
function Bl(e, t, s) {
  const r = e.getBoundingClientRect().height, n = rw(s) - 2, o = nw(s) - 2;
  if (!e.offsetParent)
    return;
  const l = Gg(e.offsetParent), { clientY: c, clientX: d } = t;
  let h = c - l.top - r / 2, u = d - l.left - 10;
  const g = me(s), p = g.defaultView || window, f = p.pageYOffset || g.documentElement.scrollTop, m = p.pageXOffset || g.documentElement.scrollLeft;
  n > 0 && u + e.clientWidth > n + m && (u = n + m - e.clientWidth), u < 0 && (u = 0), o > 0 && h + e.clientHeight > o + f && (h = o + f - e.clientHeight), h < 0 && (h = 0), e.style.left = `${u}px`, e.style.top = `${h}px`;
}
function Ew(e, t) {
  return t;
}
function _g(e) {
  return (e == null ? void 0 : e.getLocaleTextFunc()) ?? Ew;
}
function Nc(e, t, s, i) {
  const r = t[s];
  return e.getLocaleTextFunc()(
    s,
    typeof r == "function" ? r(i) : r,
    i
  );
}
function Tw(e) {
  return (t, s, i) => e({
    key: t,
    defaultValue: s,
    variableValues: i
  });
}
function Mw(e) {
  return (t, s, i) => {
    let r = e && e[t];
    if (r && i && i.length) {
      let n = 0;
      for (; !(n >= i.length || r.indexOf("${variable}") === -1); )
        r = r.replace("${variable}", i[n++]);
    }
    return r ?? s;
  };
}
var as = class {
  constructor() {
    this.destroyFunctions = [], this.destroyed = !1, this.__v_skip = !0, this.propertyListenerId = 0, this.lastChangeSetIdLookup = {}, this.isAlive = () => !this.destroyed;
  }
  preWireBeans(e) {
    this.beans = e, this.stubContext = e.context, this.eventSvc = e.eventSvc, this.gos = e.gos;
  }
  // this was a test constructor niall built, when active, it prints after 5 seconds all beans/components that are
  // not destroyed. to use, create a new grid, then api.destroy() before 5 seconds. then anything that gets printed
  // points to a bean or component that was not properly disposed of.
  // constructor() {
  //     setTimeout(()=> {
  //         if (this.isAlive()) {
  //             let prototype: any = Object.getPrototypeOf(this);
  //             const constructor: any = prototype.constructor;
  //             const constructorString = constructor.toString();
  //             const beanName = constructorString.substring(9, constructorString.indexOf("("));
  //             console.log('is alive ' + beanName);
  //         }
  //     }, 5000);
  // }
  destroy() {
    const { destroyFunctions: e } = this;
    for (let t = 0; t < e.length; t++)
      e[t]();
    e.length = 0, this.destroyed = !0, this.dispatchLocalEvent({ type: "destroyed" });
  }
  /** Add a local event listener against this BeanStub */
  addEventListener(e, t, s) {
    this.localEventService || (this.localEventService = new Rs()), this.localEventService.addEventListener(e, t, s);
  }
  /** Remove a local event listener from this BeanStub */
  removeEventListener(e, t, s) {
    var i;
    (i = this.localEventService) == null || i.removeEventListener(e, t, s);
  }
  dispatchLocalEvent(e) {
    var t;
    (t = this.localEventService) == null || t.dispatchEvent(e);
  }
  addManagedElementListeners(e, t) {
    return this._setupListeners(e, t);
  }
  addManagedEventListeners(e) {
    return this._setupListeners(this.eventSvc, e);
  }
  addManagedListeners(e, t) {
    return this._setupListeners(e, t);
  }
  _setupListeners(e, t) {
    const s = [];
    for (const i of Object.keys(t)) {
      const r = t[i];
      r && s.push(this._setupListener(e, i, r));
    }
    return s;
  }
  _setupListener(e, t, s) {
    if (this.destroyed)
      return () => null;
    let i;
    if (Dw(e))
      e.__addEventListener(t, s), i = () => (e.__removeEventListener(t, s), null);
    else {
      const r = Aw(e);
      e instanceof HTMLElement ? Rw(e, t, s) : r ? e.addListener(t, s) : e.addEventListener(t, s), i = r ? () => (e.removeListener(t, s), null) : () => (e.removeEventListener(t, s), null);
    }
    return this.destroyFunctions.push(i), () => (i(), this.destroyFunctions = this.destroyFunctions.filter((r) => r !== i), null);
  }
  /**
   * Setup a managed property listener for the given property.
   * However, stores the destroy function in the beanStub so that if this bean
   * is a component the destroy function will be called when the component is destroyed
   * as opposed to being cleaned up only when the properties service is destroyed.
   */
  setupPropertyListener(e, t) {
    const { gos: s } = this;
    s.addPropertyEventListener(e, t);
    const i = () => (s.removePropertyEventListener(e, t), null);
    return this.destroyFunctions.push(i), () => (i(), this.destroyFunctions = this.destroyFunctions.filter((r) => r !== i), null);
  }
  /**
   * Setup a managed property listener for the given GridOption property.
   * @param event GridOption property to listen to changes for.
   * @param listener Listener to run when property value changes
   */
  addManagedPropertyListener(e, t) {
    return this.destroyed ? () => null : this.setupPropertyListener(e, t);
  }
  /**
   * Setup managed property listeners for the given set of GridOption properties.
   * The listener will be run if any of the property changes but will only run once if
   * multiple of the properties change within the same framework lifecycle event.
   * Works on the basis that GridOptionsService updates all properties *before* any property change events are fired.
   * @param events Array of GridOption properties to listen for changes too.
   * @param listener Shared listener to run if any of the properties change
   */
  addManagedPropertyListeners(e, t) {
    if (this.destroyed)
      return;
    const s = e.join("-") + this.propertyListenerId++, i = (r) => {
      if (r.changeSet) {
        if (r.changeSet && r.changeSet.id === this.lastChangeSetIdLookup[s])
          return;
        this.lastChangeSetIdLookup[s] = r.changeSet.id;
      }
      const n = {
        type: "propertyChanged",
        changeSet: r.changeSet,
        source: r.source
      };
      t(n);
    };
    e.forEach((r) => this.setupPropertyListener(r, i));
  }
  getLocaleTextFunc() {
    return _g(this.beans.localeSvc);
  }
  addDestroyFunc(e) {
    this.isAlive() ? this.destroyFunctions.push(e) : e();
  }
  /** doesn't throw an error if `bean` is undefined */
  createOptionalManagedBean(e, t) {
    return e ? this.createManagedBean(e, t) : void 0;
  }
  createManagedBean(e, t) {
    const s = this.createBean(e, t);
    return this.addDestroyFunc(this.destroyBean.bind(this, e, t)), s;
  }
  createBean(e, t, s) {
    return (t || this.stubContext).createBean(e, s);
  }
  /**
   * Destroys a bean and returns undefined to support destruction and clean up in a single line.
   * this.dateComp = this.context.destroyBean(this.dateComp);
   */
  destroyBean(e, t) {
    return (t || this.stubContext).destroyBean(e);
  }
  /**
   * Destroys an array of beans and returns an empty array to support destruction and clean up in a single line.
   * this.dateComps = this.context.destroyBeans(this.dateComps);
   */
  destroyBeans(e, t) {
    return (t || this.stubContext).destroyBeans(e);
  }
};
function Dw(e) {
  return e.__addEventListener !== void 0;
}
function Aw(e) {
  return e.eventServiceType === "global";
}
var R = class extends as {
}, gh = {};
function oa(e, t) {
  gh[t] || (e(), gh[t] = !0);
}
var Iw = {
  pending: !1,
  funcs: []
}, Lw = {
  pending: !1,
  funcs: []
};
function Fo(e, t = "setTimeout", s) {
  const i = t === "raf" ? Lw : Iw;
  if (i.funcs.push(e), i.pending)
    return;
  i.pending = !0;
  const r = () => {
    const n = i.funcs.slice();
    i.funcs.length = 0, i.pending = !1, n.forEach((o) => o());
  };
  t === "raf" ? xt(s, r) : window.setTimeout(r, 0);
}
function pe(e, t, s) {
  let i;
  return function(...r) {
    const n = this;
    window.clearTimeout(i), i = window.setTimeout(function() {
      e.isAlive() && t.apply(n, r);
    }, s);
  };
}
function ph(e, t) {
  let s = 0;
  return function(...i) {
    const r = this, n = Date.now();
    n - s < t || (s = n, e.apply(r, i));
  };
}
function Ug(e, t, s, i = 100) {
  const r = Date.now();
  let n = null, o = !1;
  const a = () => {
    n != null && (window.clearInterval(n), n = null);
  };
  e.addDestroyFunc(a);
  const l = () => {
    const c = Date.now() - r > i;
    (t() || c) && (s(), o = !0, a());
  };
  l(), o || (n = window.setInterval(l, 10));
}
var $g = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
function kw(e, t) {
  if (e != null) {
    if (Array.isArray(e)) {
      for (let s = 0; s < e.length; s++)
        t(s.toString(), e[s]);
      return;
    }
    for (const s of Object.keys(e).filter((i) => !$g.has(i)))
      t(s, e[s]);
  }
}
function Fe(e, t, s = !0, i = !1) {
  A(t) && kw(t, (r, n) => {
    let o = e[r];
    o !== n && (i && o == null && n != null && typeof n == "object" && n.constructor === Object && (o = {}, e[r] = o), fh(n) && fh(o) && !Array.isArray(o) ? Fe(o, n, s, i) : (s || n !== void 0) && (e[r] = n));
  });
}
function fh(e) {
  return typeof e == "object" && e !== null;
}
var Hc = class ai {
  /**
   * @param providedOptions
   * @returns Shallow copy of the provided options with global options merged in.
   */
  static applyGlobalGridOptions(t) {
    if (!ai.gridOptions)
      return { ...t };
    let s = {};
    return Fe(s, ai.gridOptions, !0, !0), ai.mergeStrategy === "deep" ? Fe(s, t, !0, !0) : s = { ...s, ...t }, ai.gridOptions.context && (s.context = ai.gridOptions.context), t.context && (ai.mergeStrategy === "deep" && s.context && Fe(t.context, s.context, !0, !0), s.context = t.context), s;
  }
};
Hc.gridOptions = void 0;
Hc.mergeStrategy = "shallow";
var Gw = Hc, Ow = {
  suppressContextMenu: !1,
  preventDefaultOnContextMenu: !1,
  allowContextMenuWithControlKey: !1,
  suppressMenuHide: !0,
  enableBrowserTooltips: !1,
  tooltipTrigger: "hover",
  tooltipShowDelay: 2e3,
  tooltipHideDelay: 1e4,
  tooltipMouseTrack: !1,
  tooltipShowMode: "standard",
  tooltipInteraction: !1,
  copyHeadersToClipboard: !1,
  copyGroupHeadersToClipboard: !1,
  clipboardDelimiter: "	",
  suppressCopyRowsToClipboard: !1,
  suppressCopySingleCellRanges: !1,
  suppressLastEmptyLineOnPaste: !1,
  suppressClipboardPaste: !1,
  suppressClipboardApi: !1,
  suppressCutToClipboard: !1,
  maintainColumnOrder: !1,
  enableStrictPivotColumnOrder: !1,
  suppressFieldDotNotation: !1,
  allowDragFromColumnsToolPanel: !1,
  suppressMovableColumns: !1,
  suppressColumnMoveAnimation: !1,
  suppressMoveWhenColumnDragging: !1,
  suppressDragLeaveHidesColumns: !1,
  suppressRowGroupHidesColumns: !1,
  suppressAutoSize: !1,
  autoSizePadding: 20,
  skipHeaderOnAutoSize: !1,
  singleClickEdit: !1,
  suppressClickEdit: !1,
  readOnlyEdit: !1,
  stopEditingWhenCellsLoseFocus: !1,
  enterNavigatesVertically: !1,
  enterNavigatesVerticallyAfterEdit: !1,
  enableCellEditingOnBackspace: !1,
  undoRedoCellEditing: !1,
  undoRedoCellEditingLimit: 10,
  suppressCsvExport: !1,
  suppressExcelExport: !1,
  cacheQuickFilter: !1,
  includeHiddenColumnsInQuickFilter: !1,
  excludeChildrenWhenTreeDataFiltering: !1,
  enableAdvancedFilter: !1,
  includeHiddenColumnsInAdvancedFilter: !1,
  enableCharts: !1,
  masterDetail: !1,
  keepDetailRows: !1,
  keepDetailRowsCount: 10,
  detailRowAutoHeight: !1,
  tabIndex: 0,
  rowBuffer: 10,
  valueCache: !1,
  valueCacheNeverExpires: !1,
  enableCellExpressions: !1,
  suppressTouch: !1,
  suppressFocusAfterRefresh: !1,
  suppressBrowserResizeObserver: !1,
  suppressPropertyNamesCheck: !1,
  suppressChangeDetection: !1,
  debug: !1,
  suppressLoadingOverlay: !1,
  suppressNoRowsOverlay: !1,
  pagination: !1,
  paginationPageSize: 100,
  paginationPageSizeSelector: !0,
  paginationAutoPageSize: !1,
  paginateChildRows: !1,
  suppressPaginationPanel: !1,
  pivotMode: !1,
  pivotPanelShow: "never",
  pivotDefaultExpanded: 0,
  pivotSuppressAutoColumn: !1,
  suppressExpandablePivotGroups: !1,
  functionsReadOnly: !1,
  suppressAggFuncInHeader: !1,
  alwaysAggregateAtRootLevel: !1,
  aggregateOnlyChangedColumns: !1,
  suppressAggFilteredOnly: !1,
  removePivotHeaderRowWhenSingleValueColumn: !1,
  animateRows: !0,
  cellFlashDuration: 500,
  cellFadeDuration: 1e3,
  allowShowChangeAfterFilter: !1,
  domLayout: "normal",
  ensureDomOrder: !1,
  enableRtl: !1,
  suppressColumnVirtualisation: !1,
  suppressMaxRenderedRowRestriction: !1,
  suppressRowVirtualisation: !1,
  rowDragManaged: !1,
  rowDragInsertDelay: 500,
  suppressRowDrag: !1,
  suppressMoveWhenRowDragging: !1,
  rowDragEntireRow: !1,
  rowDragMultiRow: !1,
  embedFullWidthRows: !1,
  groupDisplayType: "singleColumn",
  groupDefaultExpanded: 0,
  groupMaintainOrder: !1,
  groupSelectsChildren: !1,
  groupSuppressBlankHeader: !1,
  groupSelectsFiltered: !1,
  showOpenedGroup: !1,
  groupRemoveSingleChildren: !1,
  groupRemoveLowestSingleChildren: !1,
  groupHideOpenParents: !1,
  groupAllowUnbalanced: !1,
  rowGroupPanelShow: "never",
  suppressMakeColumnVisibleAfterUnGroup: !1,
  treeData: !1,
  rowGroupPanelSuppressSort: !1,
  suppressGroupRowsSticky: !1,
  rowModelType: "clientSide",
  asyncTransactionWaitMillis: 50,
  suppressModelUpdateAfterUpdateTransaction: !1,
  cacheOverflowSize: 1,
  infiniteInitialRowCount: 1,
  serverSideInitialRowCount: 1,
  cacheBlockSize: 100,
  maxBlocksInCache: -1,
  maxConcurrentDatasourceRequests: 2,
  blockLoadDebounceMillis: 0,
  purgeClosedRowNodes: !1,
  serverSideSortAllLevels: !1,
  serverSideOnlyRefreshFilteredGroups: !1,
  serverSidePivotResultFieldSeparator: "_",
  viewportRowModelPageSize: 5,
  viewportRowModelBufferSize: 5,
  alwaysShowHorizontalScroll: !1,
  alwaysShowVerticalScroll: !1,
  debounceVerticalScrollbar: !1,
  suppressHorizontalScroll: !1,
  suppressScrollOnNewData: !1,
  suppressScrollWhenPopupsAreOpen: !1,
  suppressAnimationFrame: !1,
  suppressMiddleClickScrolls: !1,
  suppressPreventDefaultOnMouseWheel: !1,
  rowMultiSelectWithClick: !1,
  suppressRowDeselection: !1,
  suppressRowClickSelection: !1,
  suppressCellFocus: !1,
  suppressHeaderFocus: !1,
  suppressMultiRangeSelection: !1,
  enableCellTextSelection: !1,
  enableRangeSelection: !1,
  enableRangeHandle: !1,
  enableFillHandle: !1,
  fillHandleDirection: "xy",
  suppressClearOnFillReduction: !1,
  accentedSort: !1,
  unSortIcon: !1,
  suppressMultiSort: !1,
  alwaysMultiSort: !1,
  suppressMaintainUnsortedOrder: !1,
  suppressRowHoverHighlight: !1,
  suppressRowTransform: !1,
  columnHoverHighlight: !1,
  deltaSort: !1,
  enableGroupEdit: !1,
  groupLockGroupColumns: 0,
  serverSideEnableClientSideSort: !1,
  suppressServerSideFullWidthLoadingRow: !1,
  pivotMaxGeneratedColumns: -1,
  columnMenu: "new",
  reactiveCustomComponents: !0,
  suppressSetFilterByDefault: !1,
  rowNumbers: !1,
  enableFilterHandlers: !1
}, Kg = "https://www.ag-grid.com";
function ei(e, t, ...s) {
  e.get("debug") && console.log("AG Grid: " + t, ...s);
}
function Zt(e, ...t) {
  oa(() => console.warn("AG Grid: " + e, ...t), e + (t == null ? void 0 : t.join("")));
}
function er(e, ...t) {
  oa(() => console.error("AG Grid: " + e, ...t), e + (t == null ? void 0 : t.join("")));
}
var B = "34.2.0", mh = 2e3, Ch = 100, jg = "_version_", to = null, tr = `${Kg}/javascript-data-grid`;
function Vw(e) {
  to = e;
}
function Bw(e) {
  tr = e;
}
function Yg(e, t, s) {
  return (to == null ? void 0 : to(e, t)) ?? [Ww(e, t, s)];
}
function zc(e, t, s, i, r) {
  e(`${i ? "warning" : "error"} #${t}`, ...Yg(t, s, r));
}
function Nw(e) {
  if (!e)
    return String(e);
  const t = {};
  for (const s of Object.keys(e))
    typeof e[s] != "object" && typeof e[s] != "function" && (t[s] = e[s]);
  return JSON.stringify(t);
}
function Hw(e) {
  let t = e;
  return e instanceof Error ? t = e.toString() : typeof e == "object" && (t = Nw(e)), t;
}
function Ro(e) {
  return e === void 0 ? "undefined" : e === null ? "null" : e;
}
function Nl(e, t) {
  return `${e}?${t.toString()}`;
}
function zw(e, t, s) {
  const i = Array.from(t.entries()).sort((n, o) => o[1].length - n[1].length);
  let r = Nl(e, t);
  for (const [n, o] of i) {
    if (n === jg)
      continue;
    const a = r.length - s;
    if (a <= 0)
      break;
    const l = "...", c = a + l.length, d = o.length - c > Ch ? o.slice(0, o.length - c) + l : o.slice(0, Ch) + l;
    t.set(n, d), r = Nl(e, t);
  }
  return r;
}
function qg(e, t) {
  const s = new URLSearchParams();
  if (s.append(jg, B), t)
    for (const n of Object.keys(t))
      s.append(n, Hw(t[n]));
  const i = `${tr}/errors/${e}`, r = Nl(i, s);
  return r.length <= mh ? r : zw(i, s, mh);
}
var Ww = (e, t, s) => {
  const i = qg(e, t);
  return `${s ? s + ` 
` : ""}Visit ${i}${s ? "" : ` 
  Alternatively register the ValidationModule to see the full message in the console.`}`;
};
function F(...e) {
  zc(Zt, e[0], e[1], !0);
}
function j(...e) {
  zc(er, e[0], e[1], !1);
}
function Nr(e, t, s) {
  zc(er, e, t, !1, s);
}
function Xg(e, t) {
  const s = t[0];
  return `error #${s} ` + Yg(s, t[1], e).join(" ");
}
function gt(...e) {
  return Xg(void 0, e);
}
function Zg(...e) {
  return Xg(`
`, e);
}
function Qg(e, t) {
  return e.get("rowModelType") === t;
}
function te(e, t) {
  return Qg(e, "clientSide");
}
function Le(e, t) {
  return Qg(e, "serverSide");
}
function Ie(e, t) {
  return e.get("domLayout") === t;
}
function wt(e) {
  return gr(e) !== void 0;
}
function Wc(e) {
  return typeof e.get("getRowHeight") == "function";
}
function _w(e, t) {
  return t ? !e.get("enableStrictPivotColumnOrder") : e.get("maintainColumnOrder");
}
function He(e, t, s = !1, i) {
  const { gos: r, environment: n } = e;
  if (i == null && (i = n.getDefaultRowHeight()), Wc(r)) {
    if (s)
      return { height: i, estimated: !0 };
    const l = {
      node: t,
      data: t.data
    }, c = r.getCallback("getRowHeight")(l);
    if (Hl(c))
      return c === 0 && F(23), { height: Math.max(1, c), estimated: !1 };
  }
  if (t.detail && r.get("masterDetail"))
    return Uw(r);
  const o = r.get("rowHeight");
  return { height: o && Hl(o) ? o : i, estimated: !1 };
}
function Uw(e) {
  if (e.get("detailRowAutoHeight"))
    return { height: 1, estimated: !1 };
  const t = e.get("detailRowHeight");
  return Hl(t) ? { height: t, estimated: !1 } : { height: 300, estimated: !1 };
}
function pt(e) {
  const { environment: t, gos: s } = e, i = s.get("rowHeight");
  if (!i || ee(i))
    return t.getDefaultRowHeight();
  const r = t.refreshRowHeightVariable();
  return r !== -1 ? r : (F(24), t.getDefaultRowHeight());
}
function Hl(e) {
  return !isNaN(e) && typeof e == "number" && isFinite(e);
}
function Jg(e, t, s) {
  const i = t[e.getDomDataKey()];
  return i ? i[s] : void 0;
}
function Pi(e, t, s, i) {
  const r = e.getDomDataKey();
  let n = t[r];
  ee(n) && (n = {}, t[r] = n), n[s] = i;
}
function sr(e) {
  return e.get("ensureDomOrder") ? !1 : e.get("animateRows");
}
function aa(e) {
  return !(e.get("paginateChildRows") || e.get("groupHideOpenParents") || Ie(e, "print"));
}
function Gt(e) {
  const t = e.get("autoGroupColumnDef");
  return !(t != null && t.comparator) && !e.get("treeData");
}
function sn(e) {
  const t = e.get("groupAggFiltering");
  if (typeof t == "function")
    return e.getCallback("groupAggFiltering");
  if (t === !0)
    return () => !0;
}
function wr(e) {
  return e.get("grandTotalRow");
}
function ur(e) {
  const t = e.get("groupTotalRow");
  return typeof t == "function" ? e.getCallback("groupTotalRow") : () => t ?? void 0;
}
function _c(e) {
  return e.get("groupHideOpenParents") ? !0 : e.get("groupDisplayType") === "multipleColumns";
}
function Uc(e, t) {
  return t ? !1 : e.get("groupDisplayType") === "groupRows";
}
function $c(e, t, s) {
  return !!t.group && !t.footer && Uc(e, s);
}
function es(e) {
  const t = e.getCallback("getRowId");
  return t === void 0 ? t : (s) => {
    let i = t(s);
    return typeof i != "string" && (oa(() => F(25, { id: i }), "getRowIdString"), i = String(i)), i;
  };
}
function $w(e, t) {
  const s = e.get("groupHideParentOfSingleChild");
  return !!(s === !0 || s === "leafGroupsOnly" && t.leafGroup || e.get("groupRemoveSingleChildren") || e.get("groupRemoveLowestSingleChildren") && t.leafGroup);
}
function ep(e) {
  const t = e.get("maxConcurrentDatasourceRequests");
  return t > 0 ? t : void 0;
}
function tp(e, t) {
  const s = e.get("suppressGroupChangesColumnVisibility");
  if (s === !0 || t && s === "suppressHideOnGroup" || !t && s === "suppressShowOnUngroup")
    return !1;
  const i = e.get("suppressRowGroupHidesColumns");
  if (t && i === !0)
    return !1;
  const r = e.get("suppressMakeColumnVisibleAfterUnGroup");
  return !(!t && r === !0);
}
function vi(e) {
  return (e == null ? void 0 : e.checkboxes) ?? !0;
}
function so(e) {
  return (e == null ? void 0 : e.mode) === "multiRow" && (e.headerCheckbox ?? !0);
}
function rn(e) {
  if (typeof e == "object")
    return e.checkboxLocation ?? "selectionColumn";
}
function Wa(e) {
  return (e == null ? void 0 : e.hideDisabledCheckboxes) ?? !1;
}
function Kc(e) {
  return typeof e.get("rowSelection") != "string";
}
function Kw(e) {
  return e.get("cellSelection") !== void 0;
}
function Ln(e) {
  const t = e.get("cellSelection");
  return t !== void 0 ? typeof t != "boolean" ? (t == null ? void 0 : t.suppressMultiRanges) ?? !1 : !1 : e.get("suppressMultiRangeSelection");
}
function et(e) {
  const t = e.get("cellSelection");
  return t !== void 0 ? !!t : e.get("enableRangeSelection");
}
function _a(e) {
  var i;
  const t = e.get("cellSelection");
  return t !== void 0 ? typeof t != "boolean" && ((i = t.handle) == null ? void 0 : i.mode) === "fill" ? t.handle : void 0 : {
    mode: "fill",
    setFillValue: e.get("fillOperation"),
    direction: e.get("fillHandleDirection"),
    suppressClearOnFillReduction: e.get("suppressClearOnFillReduction")
  };
}
function sp(e) {
  const t = e.get("rowSelection") ?? "single";
  if (typeof t == "string") {
    const s = e.get("suppressRowClickSelection"), i = e.get("suppressRowDeselection");
    return s && i ? !1 : s ? "enableDeselection" : i ? "enableSelection" : !0;
  }
  return t.mode === "singleRow" || t.mode === "multiRow" ? t.enableClickSelection ?? !1 : !1;
}
function jw(e) {
  const t = sp(e);
  return t === !0 || t === "enableSelection";
}
function Yw(e) {
  const t = sp(e);
  return t === !0 || t === "enableDeselection";
}
function zl(e) {
  const t = e.get("rowSelection");
  return typeof t == "string" ? e.get("isRowSelectable") : t == null ? void 0 : t.isRowSelectable;
}
function gr(e) {
  const t = "beanName" in e && e.beanName === "gos" ? e.get("rowSelection") : e.rowSelection;
  if (typeof t == "string")
    switch (t) {
      case "multiple":
        return "multiRow";
      case "single":
        return "singleRow";
      default:
        return;
    }
  switch (t == null ? void 0 : t.mode) {
    case "multiRow":
    case "singleRow":
      return t.mode;
    default:
      return;
  }
}
function Ps(e) {
  return gr(e) === "multiRow";
}
function qw(e) {
  const t = e.get("rowSelection");
  return typeof t == "string" ? e.get("rowMultiSelectWithClick") : (t == null ? void 0 : t.enableSelectionWithoutKeys) ?? !1;
}
function Po(e) {
  const t = e.get("rowSelection");
  if (typeof t == "string") {
    const s = e.get("groupSelectsChildren"), i = e.get("groupSelectsFiltered");
    return s && i ? "filteredDescendants" : s ? "descendants" : "self";
  }
  return (t == null ? void 0 : t.mode) === "multiRow" ? t.groupSelects : void 0;
}
function ip(e, t = !0) {
  const s = e.get("rowSelection");
  return typeof s != "object" ? t ? "all" : void 0 : s.mode === "multiRow" ? s.selectAll : "all";
}
function Ei(e) {
  const t = Po(e);
  return t === "descendants" || t === "filteredDescendants";
}
function vh(e) {
  const t = e.get("rowSelection");
  return typeof t == "object" && t.masterSelects || "self";
}
function rp(e) {
  return e.isModuleRegistered("SetFilter") && !e.get("suppressSetFilterByDefault");
}
function Ae(e) {
  return e.get("columnMenu") === "legacy";
}
function np(e) {
  return !Ae(e);
}
function Xw(e) {
  return !e || e.length < 2 ? e : "on" + e[0].toUpperCase() + e.substring(1);
}
function V(e, t) {
  return e.addCommon(t);
}
function jc(e) {
  return e.get("treeData") ? e.get("treeDataParentIdField") ? "treeSelfRef" : e.get("treeDataChildrenField") ? "treeNested" : "treePath" : "group";
}
function Wl({ gos: e }, t) {
  return t.button === 2 || t.ctrlKey && e.get("allowContextMenuWithControlKey");
}
var Zw = {
  resizable: !0,
  sortable: !0
}, Qw = 0;
function op() {
  return Qw++;
}
function ts(e) {
  return e instanceof Wt;
}
var Wt = class extends R {
  constructor(e, t, s, i) {
    super(), this.colDef = e, this.userProvidedColDef = t, this.colId = s, this.primary = i, this.isColumn = !0, this.instanceId = op(), this.autoHeaderHeight = null, this.moving = !1, this.resizing = !1, this.menuVisible = !1, this.lastLeftPinned = !1, this.firstRightPinned = !1, this.filterActive = !1, this.colEventSvc = new Rs(), this.tooltipEnabled = !1, this.rowGroupActive = !1, this.pivotActive = !1, this.aggregationActive = !1, this.flex = null, this.colIdSanitised = bt(s);
  }
  destroy() {
    var e;
    super.destroy(), (e = this.beans.rowSpanSvc) == null || e.deregister(this);
  }
  getInstanceId() {
    return this.instanceId;
  }
  setState() {
    const {
      colDef: e,
      beans: { sortSvc: t, pinnedCols: s, colFlex: i }
    } = this;
    t == null || t.initCol(this);
    const r = e.hide;
    r !== void 0 ? this.visible = !r : this.visible = !e.initialHide, s == null || s.initCol(this), i == null || i.initCol(this);
  }
  // gets called when user provides an alternative colDef, eg
  setColDef(e, t, s) {
    var r;
    const i = e.spanRows !== this.colDef.spanRows;
    this.colDef = e, this.userProvidedColDef = t, this.initMinAndMaxWidths(), this.initDotNotation(), this.initTooltip(), i && ((r = this.beans.rowSpanSvc) == null || r.deregister(this), this.initRowSpan()), this.dispatchColEvent("colDefChanged", s);
  }
  getUserProvidedColDef() {
    return this.userProvidedColDef;
  }
  getParent() {
    return this.parent;
  }
  getOriginalParent() {
    return this.originalParent;
  }
  // this is done after constructor as it uses gridOptionsService
  postConstruct() {
    this.setState(), this.initMinAndMaxWidths(), this.resetActualWidth("gridInitializing"), this.initDotNotation(), this.initTooltip(), this.initRowSpan(), this.addPivotListener();
  }
  initDotNotation() {
    const {
      gos: e,
      colDef: { field: t, tooltipField: s }
    } = this, i = e.get("suppressFieldDotNotation");
    this.fieldContainsDots = A(t) && t.indexOf(".") >= 0 && !i, this.tooltipFieldContainsDots = A(s) && s.indexOf(".") >= 0 && !i;
  }
  initMinAndMaxWidths() {
    const e = this.colDef;
    this.minWidth = e.minWidth ?? this.beans.environment.getDefaultColumnMinWidth(), this.maxWidth = e.maxWidth ?? Number.MAX_SAFE_INTEGER;
  }
  initTooltip() {
    var e;
    (e = this.beans.tooltipSvc) == null || e.initCol(this);
  }
  initRowSpan() {
    var e;
    this.colDef.spanRows && ((e = this.beans.rowSpanSvc) == null || e.register(this));
  }
  addPivotListener() {
    const e = this.beans.pivotColDefSvc, t = this.colDef.pivotValueColumn;
    !e || !t || this.addManagedListeners(t, {
      colDefChanged: (s) => {
        const i = e.recreateColDef(this.colDef);
        this.setColDef(i, i, s.source);
      }
    });
  }
  resetActualWidth(e) {
    const t = this.calculateColInitialWidth(this.colDef);
    this.setActualWidth(t, e, !0);
  }
  calculateColInitialWidth(e) {
    let t;
    const s = e.width, i = e.initialWidth;
    return s != null ? t = s : i != null ? t = i : t = 200, Math.max(Math.min(t, this.maxWidth), this.minWidth);
  }
  isEmptyGroup() {
    return !1;
  }
  isRowGroupDisplayed(e) {
    var t;
    return ((t = this.beans.showRowGroupCols) == null ? void 0 : t.isRowGroupDisplayed(this, e)) ?? !1;
  }
  isPrimary() {
    return this.primary;
  }
  isFilterAllowed() {
    return !!this.colDef.filter;
  }
  isFieldContainsDots() {
    return this.fieldContainsDots;
  }
  isTooltipEnabled() {
    return this.tooltipEnabled;
  }
  isTooltipFieldContainsDots() {
    return this.tooltipFieldContainsDots;
  }
  getHighlighted() {
    return this.highlighted;
  }
  __addEventListener(e, t) {
    this.colEventSvc.addEventListener(e, t);
  }
  __removeEventListener(e, t) {
    this.colEventSvc.removeEventListener(e, t);
  }
  /**
   * PUBLIC USE ONLY: for internal use within AG Grid use the `__addEventListener` and `__removeEventListener` methods.
   */
  addEventListener(e, t) {
    var i, r, n;
    this.frameworkEventListenerService = (r = (i = this.beans.frameworkOverrides).createLocalEventListenerWrapper) == null ? void 0 : r.call(
      i,
      this.frameworkEventListenerService,
      this.colEventSvc
    );
    const s = ((n = this.frameworkEventListenerService) == null ? void 0 : n.wrap(e, t)) ?? t;
    this.colEventSvc.addEventListener(e, s);
  }
  /**
   * PUBLIC USE ONLY: for internal use within AG Grid use the `__addEventListener` and `__removeEventListener` methods.
   */
  removeEventListener(e, t) {
    var i;
    const s = ((i = this.frameworkEventListenerService) == null ? void 0 : i.unwrap(e, t)) ?? t;
    this.colEventSvc.removeEventListener(e, s);
  }
  createColumnFunctionCallbackParams(e) {
    return V(this.gos, {
      node: e,
      data: e.data,
      column: this,
      colDef: this.colDef
    });
  }
  isSuppressNavigable(e) {
    var t;
    return ((t = this.beans.cellNavigation) == null ? void 0 : t.isSuppressNavigable(this, e)) ?? !1;
  }
  isCellEditable(e) {
    var t;
    return ((t = this.beans.editSvc) == null ? void 0 : t.isCellEditable({ rowNode: e, column: this })) ?? !1;
  }
  isSuppressFillHandle() {
    return !!this.colDef.suppressFillHandle;
  }
  isAutoHeight() {
    return !!this.colDef.autoHeight;
  }
  isAutoHeaderHeight() {
    return !!this.colDef.autoHeaderHeight;
  }
  isRowDrag(e) {
    return this.isColumnFunc(e, this.colDef.rowDrag);
  }
  isDndSource(e) {
    return this.isColumnFunc(e, this.colDef.dndSource);
  }
  isCellCheckboxSelection(e) {
    var t;
    return ((t = this.beans.selectionSvc) == null ? void 0 : t.isCellCheckboxSelection(this, e)) ?? !1;
  }
  isSuppressPaste(e) {
    var t;
    return this.isColumnFunc(e, ((t = this.colDef) == null ? void 0 : t.suppressPaste) ?? null);
  }
  isResizable() {
    return !!this.getColDefValue("resizable");
  }
  /** Get value from ColDef or default if it exists. */
  getColDefValue(e) {
    return this.colDef[e] ?? Zw[e];
  }
  isColumnFunc(e, t) {
    if (typeof t == "boolean")
      return t;
    if (typeof t == "function") {
      const s = this.createColumnFunctionCallbackParams(e);
      return t(s);
    }
    return !1;
  }
  createColumnEvent(e, t) {
    return V(this.gos, {
      type: e,
      column: this,
      columns: [this],
      source: t
    });
  }
  isMoving() {
    return this.moving;
  }
  getSort() {
    return this.sort;
  }
  isSortable() {
    return !!this.getColDefValue("sortable");
  }
  /** @deprecated v32 use col.getSort() === 'asc */
  isSortAscending() {
    return this.sort === "asc";
  }
  /** @deprecated v32 use col.getSort() === 'desc */
  isSortDescending() {
    return this.sort === "desc";
  }
  /** @deprecated v32 use col.getSort() === undefined */
  isSortNone() {
    return ee(this.sort);
  }
  /** @deprecated v32 use col.getSort() !== undefined */
  isSorting() {
    return A(this.sort);
  }
  getSortIndex() {
    return this.sortIndex;
  }
  isMenuVisible() {
    return this.menuVisible;
  }
  getAggFunc() {
    return this.aggFunc;
  }
  getLeft() {
    return this.left;
  }
  getOldLeft() {
    return this.oldLeft;
  }
  getRight() {
    return this.left + this.actualWidth;
  }
  setLeft(e, t) {
    this.oldLeft = this.left, this.left !== e && (this.left = e, this.dispatchColEvent("leftChanged", t));
  }
  isFilterActive() {
    return this.filterActive;
  }
  /** @deprecated v33 Use `api.isColumnHovered(column)` instead. */
  isHovered() {
    var e;
    return F(261), !!((e = this.beans.colHover) != null && e.isHovered(this));
  }
  setFirstRightPinned(e, t) {
    this.firstRightPinned !== e && (this.firstRightPinned = e, this.dispatchColEvent("firstRightPinnedChanged", t));
  }
  setLastLeftPinned(e, t) {
    this.lastLeftPinned !== e && (this.lastLeftPinned = e, this.dispatchColEvent("lastLeftPinnedChanged", t));
  }
  isFirstRightPinned() {
    return this.firstRightPinned;
  }
  isLastLeftPinned() {
    return this.lastLeftPinned;
  }
  isPinned() {
    return this.pinned === "left" || this.pinned === "right";
  }
  isPinnedLeft() {
    return this.pinned === "left";
  }
  isPinnedRight() {
    return this.pinned === "right";
  }
  getPinned() {
    return this.pinned;
  }
  setVisible(e, t) {
    const s = e === !0;
    this.visible !== s && (this.visible = s, this.dispatchColEvent("visibleChanged", t)), this.dispatchStateUpdatedEvent("hide");
  }
  isVisible() {
    return this.visible;
  }
  isSpanHeaderHeight() {
    return !this.getColDef().suppressSpanHeaderHeight;
  }
  /**
   * Returns the first parent that is not a padding group.
   */
  getFirstRealParent() {
    let e = this.getOriginalParent();
    for (; e && e.isPadding(); )
      e = e.getOriginalParent();
    return e;
  }
  getColumnGroupPaddingInfo() {
    let e = this.getParent();
    if (!e || !e.isPadding())
      return { numberOfParents: 0, isSpanningTotal: !1 };
    const t = e.getPaddingLevel() + 1;
    let s = !0;
    for (; e; ) {
      if (!e.isPadding()) {
        s = !1;
        break;
      }
      e = e.getParent();
    }
    return { numberOfParents: t, isSpanningTotal: s };
  }
  getColDef() {
    return this.colDef;
  }
  getDefinition() {
    return this.colDef;
  }
  getColumnGroupShow() {
    return this.colDef.columnGroupShow;
  }
  getColId() {
    return this.colId;
  }
  getId() {
    return this.colId;
  }
  getUniqueId() {
    return this.colId;
  }
  getActualWidth() {
    return this.actualWidth;
  }
  getAutoHeaderHeight() {
    return this.autoHeaderHeight;
  }
  /** Returns true if the header height has changed */
  setAutoHeaderHeight(e) {
    const t = e !== this.autoHeaderHeight;
    return this.autoHeaderHeight = e, t;
  }
  createBaseColDefParams(e) {
    return V(this.gos, {
      node: e,
      data: e.data,
      colDef: this.colDef,
      column: this
    });
  }
  getColSpan(e) {
    if (ee(this.colDef.colSpan))
      return 1;
    const t = this.createBaseColDefParams(e), s = this.colDef.colSpan(t);
    return Math.max(s, 1);
  }
  getRowSpan(e) {
    if (ee(this.colDef.rowSpan))
      return 1;
    const t = this.createBaseColDefParams(e), s = this.colDef.rowSpan(t);
    return Math.max(s, 1);
  }
  setActualWidth(e, t, s = !1) {
    e = Math.max(e, this.minWidth), e = Math.min(e, this.maxWidth), this.actualWidth !== e && (this.actualWidth = e, this.flex != null && t !== "flex" && t !== "gridInitializing" && (this.flex = null), s || this.fireColumnWidthChangedEvent(t)), this.dispatchStateUpdatedEvent("width");
  }
  fireColumnWidthChangedEvent(e) {
    this.dispatchColEvent("widthChanged", e);
  }
  isGreaterThanMax(e) {
    return e > this.maxWidth;
  }
  getMinWidth() {
    return this.minWidth;
  }
  getMaxWidth() {
    return this.maxWidth;
  }
  getFlex() {
    return this.flex;
  }
  isRowGroupActive() {
    return this.rowGroupActive;
  }
  isPivotActive() {
    return this.pivotActive;
  }
  isAnyFunctionActive() {
    return this.isPivotActive() || this.isRowGroupActive() || this.isValueActive();
  }
  isAnyFunctionAllowed() {
    return this.isAllowPivot() || this.isAllowRowGroup() || this.isAllowValue();
  }
  isValueActive() {
    return this.aggregationActive;
  }
  isAllowPivot() {
    return this.colDef.enablePivot === !0;
  }
  isAllowValue() {
    return this.colDef.enableValue === !0;
  }
  isAllowRowGroup() {
    return this.colDef.enableRowGroup === !0;
  }
  dispatchColEvent(e, t, s) {
    const i = this.createColumnEvent(e, t);
    s && Fe(i, s), this.colEventSvc.dispatchEvent(i);
  }
  dispatchStateUpdatedEvent(e) {
    this.colEventSvc.dispatchEvent({
      type: "columnStateUpdated",
      key: e
    });
  }
};
function oe(e) {
  return e instanceof ir;
}
var ir = class extends R {
  constructor(e, t, s, i) {
    super(), this.colGroupDef = e, this.groupId = t, this.padding = s, this.level = i, this.isColumn = !1, this.expandable = !1, this.instanceId = op(), this.expandableListenerRemoveCallback = null, this.expanded = !!(e != null && e.openByDefault);
  }
  destroy() {
    this.expandableListenerRemoveCallback && this.reset(null, void 0), super.destroy();
  }
  reset(e, t) {
    this.colGroupDef = e, this.level = t, this.originalParent = null, this.expandableListenerRemoveCallback && this.expandableListenerRemoveCallback(), this.children = void 0, this.expandable = void 0;
  }
  getInstanceId() {
    return this.instanceId;
  }
  getOriginalParent() {
    return this.originalParent;
  }
  getLevel() {
    return this.level;
  }
  isVisible() {
    return this.children ? this.children.some((e) => e.isVisible()) : !1;
  }
  isPadding() {
    return this.padding;
  }
  setExpanded(e) {
    this.expanded = e === void 0 ? !1 : e, this.dispatchLocalEvent({ type: "expandedChanged" });
  }
  isExpandable() {
    return this.expandable;
  }
  isExpanded() {
    return this.expanded;
  }
  getGroupId() {
    return this.groupId;
  }
  getId() {
    return this.getGroupId();
  }
  setChildren(e) {
    this.children = e;
  }
  getChildren() {
    return this.children;
  }
  getColGroupDef() {
    return this.colGroupDef;
  }
  getLeafColumns() {
    const e = [];
    return this.addLeafColumns(e), e;
  }
  forEachLeafColumn(e) {
    if (this.children)
      for (const t of this.children)
        ts(t) ? e(t) : oe(t) && t.forEachLeafColumn(e);
  }
  addLeafColumns(e) {
    this.children && this.children.forEach((t) => {
      ts(t) ? e.push(t) : oe(t) && t.addLeafColumns(e);
    });
  }
  getColumnGroupShow() {
    const e = this.colGroupDef;
    if (e)
      return e.columnGroupShow;
  }
  // need to check that this group has at least one col showing when both expanded and contracted.
  // if not, then we don't allow expanding and contracting on this group
  setupExpandable() {
    this.setExpandable(), this.expandableListenerRemoveCallback && this.expandableListenerRemoveCallback();
    const e = this.onColumnVisibilityChanged.bind(this);
    this.getLeafColumns().forEach((t) => t.__addEventListener("visibleChanged", e)), this.expandableListenerRemoveCallback = () => {
      this.getLeafColumns().forEach((t) => t.__removeEventListener("visibleChanged", e)), this.expandableListenerRemoveCallback = null;
    };
  }
  setExpandable() {
    if (this.isPadding())
      return;
    let e = !1, t = !1, s = !1;
    const i = this.findChildrenRemovingPadding();
    for (let n = 0, o = i.length; n < o; n++) {
      const a = i[n];
      if (!a.isVisible())
        continue;
      const l = a.getColumnGroupShow();
      l === "open" ? (e = !0, s = !0) : l === "closed" ? (t = !0, s = !0) : (e = !0, t = !0);
    }
    const r = e && t && s;
    this.expandable !== r && (this.expandable = r, this.dispatchLocalEvent({ type: "expandableChanged" }));
  }
  findChildrenRemovingPadding() {
    const e = [], t = (s) => {
      s.forEach((i) => {
        oe(i) && i.isPadding() ? t(i.children) : e.push(i);
      });
    };
    return t(this.children), e;
  }
  onColumnVisibilityChanged() {
    this.setExpandable();
  }
}, Jw = {
  numericColumn: {
    headerClass: "ag-right-aligned-header",
    cellClass: "ag-right-aligned-cell"
  },
  rightAligned: {
    headerClass: "ag-right-aligned-header",
    cellClass: "ag-right-aligned-cell"
  }
};
function _l(e, t, s) {
  const i = {}, r = e.gos;
  return Object.assign(i, r.get("defaultColGroupDef")), Object.assign(i, t), r.validateColDef(i, s), i;
}
var eb = class {
  constructor() {
    this.existingKeys = {};
  }
  addExistingKeys(e) {
    for (let t = 0; t < e.length; t++)
      this.existingKeys[e[t]] = !0;
  }
  getUniqueKey(e, t) {
    e = ut(e);
    let s = 0;
    for (; ; ) {
      let i = e ?? t;
      if (i ? s !== 0 && (i += "_" + s) : i = s, !this.existingKeys[i]) {
        const r = String(i);
        return e && s > 0 && F(273, { providedId: e, usedId: r }), this.existingKeys[r] = !0, r;
      }
      s++;
    }
  }
}, ps = Object.freeze([]);
function _(e) {
  if (e != null && e.length)
    return e[e.length - 1];
}
function Xe(e, t, s) {
  if (e === t)
    return !0;
  if (!e || !t)
    return e == null && t == null;
  const i = e.length;
  if (i !== t.length)
    return !1;
  for (let r = 0; r < i; r++)
    if (e[r] !== t[r] && !(s != null && s(e[r], t[r])))
      return !1;
  return !0;
}
function Rr(e, t) {
  if (e)
    for (const s of e)
      t(s);
}
function be(e, t) {
  const s = e.indexOf(t);
  s >= 0 && e.splice(s, 1);
}
function wh(e, t, s) {
  for (let i = 0; i < t.length; i++)
    be(e, t[i]);
  for (let i = t.length - 1; i >= 0; i--)
    e.splice(s, 0, t[i]);
}
function ap(e) {
  return [].concat.apply([], e);
}
var ti = "ag-Grid-AutoColumn", lp = "ag-Grid-SelectionColumn", Yc = "ag-Grid-RowNumbersColumn", tb = "ag-Grid-HierarchyColumn";
function qc(e) {
  const t = [], s = (i) => {
    for (let r = 0; r < i.length; r++) {
      const n = i[r];
      ts(n) ? t.push(n) : oe(n) && s(n.getChildren());
    }
  };
  return s(e), t;
}
function fs(e) {
  return e.reduce((t, s) => t + s.getActualWidth(), 0);
}
function Ht(e, t, s) {
  const i = {};
  if (!t)
    return;
  Qt(null, t, (n) => {
    i[n.getInstanceId()] = n;
  }), s && Qt(null, s, (n) => {
    i[n.getInstanceId()] = null;
  });
  const r = Object.values(i).filter((n) => n != null);
  e.context.destroyBeans(r);
}
function la(e) {
  return e.getId().startsWith(ti);
}
function Ds(e) {
  const t = typeof e == "string" ? e : "getColId" in e ? e.getColId() : e.colId;
  return (t == null ? void 0 : t.startsWith(lp)) ?? !1;
}
function Ke(e) {
  const t = typeof e == "string" ? e : "getColId" in e ? e.getColId() : e.colId;
  return (t == null ? void 0 : t.startsWith(Yc)) ?? !1;
}
function Xc(e) {
  return Ds(e) || Ke(e);
}
function Eo(e) {
  let t = [];
  return e instanceof Array ? t = e : typeof e == "string" && (t = e.split(",")), t;
}
function ca(e, t) {
  return Xe(e, t, (s, i) => s.getColId() === i.getColId());
}
function da(e) {
  e.map = {}, e.list.forEach((t) => e.map[t.getId()] = t);
}
function qs(e) {
  return e === "optionsUpdated" ? "gridOptionsChanged" : e;
}
function nn(e, t) {
  const s = e === t, i = e.getColDef() === t, r = e.getColId() == t;
  return s || i || r;
}
var sb = (e, t) => (s, i) => {
  const r = {
    value1: void 0,
    value2: void 0
  };
  let n = !1;
  return e && (e[s] !== void 0 && (r.value1 = e[s], n = !0), A(i) && e[i] !== void 0 && (r.value2 = e[i], n = !0)), !n && t && (t[s] !== void 0 && (r.value1 = t[s]), A(i) && t[i] !== void 0 && (r.value2 = t[i])), r;
};
function ib(e, t = null, s, i, r) {
  const { existingCols: n, existingGroups: o } = dp(i), a = new Map(n.map((m) => [m.getId(), m])), l = new Map(o.map((m) => [m.getId(), m]));
  let c = 0;
  const d = (m, C) => {
    var y;
    if (c = Math.max(c, C), pp(m)) {
      if (!e.colGroupSvc)
        return null;
      const P = m.groupId, E = l.get(P), M = _l(e, m, P), T = new ir(M, P, !1, C);
      return e.context.createBean(T), E && T.setExpanded(E.isExpanded()), T.setChildren(m.children.map((G) => d(G, C + 1))), T;
    }
    const v = m.colId;
    let w = a.get(v);
    const b = Ti(e, m, (w == null ? void 0 : w.getColId()) ?? v);
    return w ? (w.setColDef(b, m, r), gp(e, w, b, r)) : (w = new Wt(b, m, v, s), e.context.createBean(w)), (y = e.dataTypeSvc) == null || y.addColumnListeners(w), w;
  }, h = (t == null ? void 0 : t.map((m) => d(m, 0))) ?? [];
  let u = 0;
  const g = {
    getUniqueKey: (m, C) => String(++u)
  }, p = e.colGroupSvc ? e.colGroupSvc.balanceColumnTree(h, 0, c, g) : h;
  return Qt(null, p, (m, C) => {
    oe(m) && m.setupExpandable(), m.originalParent = C;
  }), {
    columnTree: p,
    treeDepth: c
  };
}
function cp(e, t = null, s, i, r) {
  const n = new eb(), { existingCols: o, existingGroups: a, existingColKeys: l } = dp(i);
  n.addExistingKeys(l);
  const c = hp(
    e,
    t,
    0,
    s,
    o,
    n,
    a,
    r
  ), { colGroupSvc: d } = e, h = (d == null ? void 0 : d.findMaxDepth(c, 0)) ?? 0, u = d ? d.balanceColumnTree(c, 0, h, n) : c;
  return Qt(null, u, (p, f) => {
    oe(p) && p.setupExpandable(), p.originalParent = f;
  }), {
    columnTree: u,
    treeDepth: h
  };
}
function dp(e) {
  const t = [], s = [], i = [];
  return e && Qt(null, e, (r) => {
    if (oe(r)) {
      const n = r;
      s.push(n);
    } else {
      const n = r;
      i.push(n.getId()), t.push(n);
    }
  }), { existingCols: t, existingGroups: s, existingColKeys: i };
}
function hp(e, t, s, i, r, n, o, a) {
  if (!t)
    return [];
  const { colGroupSvc: l } = e, c = new Array(t.length);
  for (let d = 0; d < c.length; d++) {
    const h = t[d];
    l && pp(h) ? c[d] = l.createProvidedColumnGroup(
      i,
      h,
      s,
      r,
      n,
      o,
      a
    ) : c[d] = rb(e, i, h, r, n, a);
  }
  return c;
}
function rb(e, t, s, i, r, n) {
  var l;
  const o = nb(s, i);
  o && (i == null || i.splice(o.idx, 1));
  let a = o == null ? void 0 : o.column;
  if (a) {
    const c = Ti(e, s, a.getColId());
    a.setColDef(c, s, n), gp(e, a, c, n);
  } else {
    const c = r.getUniqueKey(s.colId, s.field), d = Ti(e, s, c);
    a = new Wt(d, s, c, t), e.context.createBean(a);
  }
  return (l = e.dataTypeSvc) == null || l.addColumnListeners(a), a;
}
function up(e, t, s, i, r, n, o, a) {
  const { sortSvc: l, pinnedCols: c, colFlex: d } = e;
  s !== void 0 && t.setVisible(!s, a), l && (l.updateColSort(t, i, a), r !== void 0 && l.setColSortIndex(t, r)), n !== void 0 && (c == null || c.setColPinned(t, n)), o !== void 0 && (d == null || d.setColFlex(t, o));
}
function gp(e, t, s, i) {
  up(
    e,
    t,
    s.hide,
    s.sort,
    s.sortIndex,
    s.pinned,
    s.flex,
    i
  );
  const r = t.getFlex();
  if (!(r != null && r > 0))
    if (s.width != null)
      t.setActualWidth(s.width, i);
    else {
      const n = t.getActualWidth();
      t.setActualWidth(n, i);
    }
}
function nb(e, t) {
  if (t)
    for (let s = 0; s < t.length; s++) {
      const i = t[s].getUserProvidedColDef();
      if (!i)
        continue;
      if (e.colId != null) {
        if (t[s].getId() === e.colId)
          return { idx: s, column: t[s] };
        continue;
      }
      if (e.field != null) {
        if (i.field === e.field)
          return { idx: s, column: t[s] };
        continue;
      }
      if (i === e)
        return { idx: s, column: t[s] };
    }
}
function Ti(e, t, s, i) {
  const { gos: r, dataTypeSvc: n } = e, o = {}, a = r.get("defaultColDef");
  Fe(o, a, !1, !0);
  const l = ob(e, o, t, s);
  l && ab(e, l, o);
  const c = o.cellDataType;
  Fe(o, t, !1, !0), c !== void 0 && (o.cellDataType = c);
  const d = r.get("autoGroupColumnDef"), h = Gt(r);
  return t.rowGroup && d && h && Fe(
    o,
    { sort: d.sort, initialSort: d.initialSort },
    !1,
    !0
  ), n && (n.postProcess(o), n.validateColDef(o)), r.validateColDef(o, s, i), o;
}
function ob(e, t, s, i) {
  var o;
  const r = (o = e.dataTypeSvc) == null ? void 0 : o.updateColDefAndGetColumnType(t, s, i), n = s.type ?? r ?? t.type;
  return t.type = n, n ? Eo(n) : void 0;
}
function ab(e, t, s) {
  if (!t.length)
    return;
  const i = Object.assign({}, Jw), r = e.gos.get("columnTypes") || {};
  for (const n of Object.keys(r)) {
    const o = r[n];
    n in i ? F(34, { key: n }) : (o.type && F(35), i[n] = o);
  }
  t.forEach((n) => {
    const o = i[n.trim()];
    o ? Fe(s, o, !1, !0) : F(36, { t: n });
  });
}
function pp(e) {
  return e.children !== void 0;
}
function Qt(e, t, s) {
  if (t)
    for (let i = 0; i < t.length; i++) {
      const r = t[i];
      oe(r) && Qt(r, r.getChildren(), s), s(r, e);
    }
}
function fp(e, t) {
  const s = [], i = [], r = [];
  return e.forEach((o) => {
    const a = o.getColDef().lockPosition;
    a === "right" ? r.push(o) : a === "left" || a === !0 ? s.push(o) : i.push(o);
  }), t.get("enableRtl") ? [...r, ...i, ...s] : [...s, ...i, ...r];
}
function mp(e, t) {
  let s = !0;
  return Qt(null, t, (i) => {
    if (!oe(i))
      return;
    const r = i, n = r.getColGroupDef();
    if (!(n && n.marryChildren))
      return;
    const a = [];
    r.getLeafColumns().forEach((u) => {
      const g = e.indexOf(u);
      a.push(g);
    });
    const l = Math.max.apply(Math, a), c = Math.min.apply(Math, a), d = l - c, h = r.getLeafColumns().length - 1;
    d > h && (s = !1);
  }), s;
}
function Cp(e, t) {
  if (!e || e.length == 0)
    return;
  const s = t(e[0]);
  for (let i = 1; i < e.length; i++)
    if (s !== t(e[i]))
      return;
  return s;
}
function vp(e, t, s) {
  if (!t.length)
    return;
  const i = t.length === 1 ? t[0] : null, r = Cp(t, (n) => n.getPinned());
  e.dispatchEvent({
    type: "columnPinned",
    // mistake in typing, 'undefined' should be allowed, as 'null' means 'not pinned'
    pinned: r ?? null,
    columns: t,
    column: i,
    source: s
  });
}
function lb(e, t, s) {
  if (!t.length)
    return;
  const i = t.length === 1 ? t[0] : null, r = Cp(t, (n) => n.isVisible());
  e.dispatchEvent({
    type: "columnVisible",
    visible: r,
    columns: t,
    column: i,
    source: s
  });
}
function wp(e, t, s, i) {
  e.dispatchEvent({
    type: t,
    columns: s,
    column: s && s.length == 1 ? s[0] : null,
    source: i
  });
}
function pr(e, t, s, i, r = null) {
  t != null && t.length && e.dispatchEvent({
    type: "columnResized",
    columns: t,
    column: t.length === 1 ? t[0] : null,
    flexColumns: r,
    finished: s,
    source: i
  });
}
function je(e, t, s) {
  var y;
  const {
    colModel: i,
    rowGroupColsSvc: r,
    pivotColsSvc: n,
    autoColSvc: o,
    selectionColSvc: a,
    colAnimation: l,
    visibleCols: c,
    pivotResultCols: d,
    environment: h,
    valueColsSvc: u,
    eventSvc: g,
    gos: p
  } = e, f = i.getColDefCols() ?? [], m = a == null ? void 0 : a.getColumns();
  if (!f.length && !(m != null && m.length))
    return !1;
  if (t != null && t.state && !t.state.forEach)
    return F(32), !1;
  const C = (P, E, M, T, G) => {
    if (!P)
      return;
    const I = sb(E, t.defaultState), L = I("flex").value1;
    if (up(
      e,
      P,
      I("hide").value1,
      I("sort").value1,
      I("sortIndex").value1,
      I("pinned").value1,
      L,
      s
    ), L == null) {
      const $ = I("width").value1;
      if ($ != null) {
        const z = P.getColDef().minWidth ?? h.getDefaultColumnMinWidth();
        z != null && $ >= z && P.setActualWidth($, s);
      }
    }
    G || !P.isPrimary() || (u == null || u.syncColumnWithState(P, s, I), r == null || r.syncColumnWithState(P, s, I, M), n == null || n.syncColumnWithState(P, s, I, T));
  }, v = (P, E, M) => {
    var Ge, Te;
    const T = yp(e, s), G = E.slice(), I = {}, L = {}, $ = [], z = [], W = [];
    let H = 0;
    const J = (r == null ? void 0 : r.columns.slice()) ?? [], le = (n == null ? void 0 : n.columns.slice()) ?? [];
    P.forEach((Me) => {
      const Z = Me.colId;
      if (Z.startsWith(ti)) {
        $.push(Me), W.push(Me);
        return;
      }
      if (Ds(Z)) {
        z.push(Me), W.push(Me);
        return;
      }
      const Qe = M(Z);
      Qe ? (C(Qe, Me, I, L, !1), be(G, Qe)) : (W.push(Me), H += 1);
    });
    const fe = (Me) => C(Me, null, I, L, !1);
    G.forEach(fe), r == null || r.sortColumns(bh.bind(r, I, J)), n == null || n.sortColumns(bh.bind(n, L, le)), i.refreshCols(!1);
    const ve = (Me, Z, Lt = []) => {
      Z.forEach((Qe) => {
        const Wi = Me(Qe.colId);
        be(Lt, Wi), C(Wi, Qe, null, null, !0);
      }), Lt.forEach(fe);
    };
    return ve(
      (Me) => (o == null ? void 0 : o.getColumn(Me)) ?? null,
      $,
      (Ge = o == null ? void 0 : o.getColumns()) == null ? void 0 : Ge.slice()
    ), ve(
      (Me) => (a == null ? void 0 : a.getColumn(Me)) ?? null,
      z,
      (Te = a == null ? void 0 : a.getColumns()) == null ? void 0 : Te.slice()
    ), cb(t, i, p), c.refresh(s), g.dispatchEvent({
      type: "columnEverythingChanged",
      source: s
    }), T(), { unmatchedAndAutoStates: W, unmatchedCount: H };
  };
  l == null || l.start();
  let { unmatchedAndAutoStates: w, unmatchedCount: b } = v(
    t.state || [],
    f,
    (P) => i.getColDefCol(P)
  );
  if (w.length > 0 || A(t.defaultState)) {
    const P = ((y = d == null ? void 0 : d.getPivotResultCols()) == null ? void 0 : y.list) ?? [];
    b = v(
      w,
      P,
      (E) => (d == null ? void 0 : d.getPivotResultCol(E)) ?? null
    ).unmatchedCount;
  }
  return l == null || l.finish(), b === 0;
}
function bp(e, t) {
  var v, w;
  const { colModel: s, autoColSvc: i, selectionColSvc: r, eventSvc: n, gos: o } = e, a = s.getColDefCols();
  if (!(a != null && a.length))
    return;
  const l = s.getColDefColTree(), c = qc(l), d = [];
  let h = 1e3, u = 1e3;
  const g = (b) => {
    const y = Sp(b);
    ee(y.rowGroupIndex) && y.rowGroup && (y.rowGroupIndex = h++), ee(y.pivotIndex) && y.pivot && (y.pivotIndex = u++), d.push(y);
  };
  (v = i == null ? void 0 : i.getColumns()) == null || v.forEach(g), (w = r == null ? void 0 : r.getColumns()) == null || w.forEach(g), c == null || c.forEach(g), je(e, { state: d }, t);
  const p = (i == null ? void 0 : i.getColumns()) ?? [], C = [...(r == null ? void 0 : r.getColumns()) ?? [], ...p, ...a].map((b) => ({ colId: b.colId }));
  je(e, { state: C, applyOrder: !0 }, t), n.dispatchEvent(V(o, { type: "columnsReset", source: t }));
}
function yp(e, t) {
  const { rowGroupColsSvc: s, pivotColsSvc: i, valueColsSvc: r, colModel: n, sortSvc: o, eventSvc: a } = e, l = {
    rowGroupColumns: (s == null ? void 0 : s.columns.slice()) ?? [],
    pivotColumns: (i == null ? void 0 : i.columns.slice()) ?? [],
    valueColumns: (r == null ? void 0 : r.columns.slice()) ?? []
  }, c = To(e), d = {};
  return c.forEach((h) => {
    d[h.colId] = h;
  }), () => {
    const h = (P, E, M, T) => {
      const G = E.map(T), I = M.map(T);
      if (Xe(G, I))
        return;
      const $ = new Set(E);
      M.forEach((W) => {
        $.delete(W) || $.add(W);
      });
      const z = [...$];
      a.dispatchEvent({
        type: P,
        columns: z,
        column: z.length === 1 ? z[0] : null,
        source: t
      });
    }, u = (P) => {
      const E = [];
      return n.forAllCols((M) => {
        const T = d[M.getColId()];
        T && P(T, M) && E.push(M);
      }), E;
    }, g = (P) => P.getColId();
    h(
      "columnRowGroupChanged",
      l.rowGroupColumns,
      (s == null ? void 0 : s.columns) ?? [],
      g
    ), h(
      "columnPivotChanged",
      l.pivotColumns,
      (i == null ? void 0 : i.columns) ?? [],
      g
    );
    const f = u((P, E) => {
      const M = P.aggFunc != null, T = M != E.isValueActive(), G = M && P.aggFunc != E.getAggFunc();
      return T || G;
    });
    f.length > 0 && wp(a, "columnValueChanged", f, t), pr(a, u((P, E) => P.width != E.getActualWidth()), !0, t), vp(a, u((P, E) => P.pinned != E.getPinned()), t), lb(a, u((P, E) => P.hide == E.isVisible()), t);
    const b = u((P, E) => P.sort != E.getSort() || P.sortIndex != E.getSortIndex());
    b.length > 0 && (o == null || o.dispatchSortChangedEvents(t, b));
    const y = To(e);
    hb(c, y, t, n, a);
  };
}
function To(e) {
  const { colModel: t, rowGroupColsSvc: s, pivotColsSvc: i } = e, r = t.getColDefCols();
  if (ee(r) || !t.isAlive())
    return [];
  const n = s == null ? void 0 : s.columns, o = i == null ? void 0 : i.columns, a = [], l = (d) => {
    const h = d.isRowGroupActive() && n ? n.indexOf(d) : null, u = d.isPivotActive() && o ? o.indexOf(d) : null, g = d.isValueActive() ? d.getAggFunc() : null, p = d.getSort() != null ? d.getSort() : null, f = d.getSortIndex() != null ? d.getSortIndex() : null;
    a.push({
      colId: d.getColId(),
      width: d.getActualWidth(),
      hide: !d.isVisible(),
      pinned: d.getPinned(),
      sort: p,
      sortIndex: f,
      aggFunc: g,
      rowGroup: d.isRowGroupActive(),
      rowGroupIndex: h,
      pivot: d.isPivotActive(),
      pivotIndex: u,
      flex: d.getFlex() ?? null
    });
  };
  t.forAllCols((d) => l(d));
  const c = new Map(
    t.getCols().map((d, h) => [d.getColId(), h])
  );
  return a.sort((d, h) => {
    const u = c.has(d.colId) ? c.get(d.colId) : -1, g = c.has(h.colId) ? c.get(h.colId) : -1;
    return u - g;
  }), a;
}
function Sp(e) {
  const t = (p, f) => p ?? f ?? null, s = e.getColDef(), i = t(s.sort, s.initialSort), r = t(s.sortIndex, s.initialSortIndex), n = t(s.hide, s.initialHide), o = t(s.pinned, s.initialPinned), a = t(s.width, s.initialWidth), l = t(s.flex, s.initialFlex);
  let c = t(s.rowGroupIndex, s.initialRowGroupIndex), d = t(s.rowGroup, s.initialRowGroup);
  c == null && (d == null || d == !1) && (c = null, d = null);
  let h = t(s.pivotIndex, s.initialPivotIndex), u = t(s.pivot, s.initialPivot);
  h == null && (u == null || u == !1) && (h = null, u = null);
  const g = t(s.aggFunc, s.initialAggFunc);
  return {
    colId: e.getColId(),
    sort: i,
    sortIndex: r,
    hide: n,
    pinned: o,
    width: a,
    flex: l,
    rowGroup: d,
    rowGroupIndex: c,
    pivot: u,
    pivotIndex: h,
    aggFunc: g
  };
}
function cb(e, t, s) {
  if (!e.applyOrder || !e.state)
    return;
  const i = [];
  e.state.forEach((r) => {
    r.colId != null && i.push(r.colId);
  }), db(t.cols, i, t, s);
}
function db(e, t, s, i) {
  if (e == null)
    return;
  let r = [];
  const n = {};
  t.forEach((a) => {
    if (n[a])
      return;
    const l = e.map[a];
    l && (r.push(l), n[a] = !0);
  });
  let o = 0;
  if (e.list.forEach((a) => {
    const l = a.getColId();
    if (n[l] != null)
      return;
    l.startsWith(ti) ? r.splice(o++, 0, a) : r.push(a);
  }), r = fp(r, i), !mp(r, s.getColTree())) {
    F(39);
    return;
  }
  e.list = r;
}
function hb(e, t, s, i, r) {
  const n = {};
  t.forEach((d) => n[d.colId] = d);
  const o = {};
  e.forEach((d) => {
    n[d.colId] && (o[d.colId] = !0);
  });
  const a = e.filter((d) => o[d.colId]), l = t.filter((d) => o[d.colId]), c = [];
  l.forEach((d, h) => {
    const u = a && a[h];
    if (u && u.colId !== d.colId) {
      const g = i.getCol(u.colId);
      g && c.push(g);
    }
  }), c.length && r.dispatchEvent({
    type: "columnMoved",
    columns: c,
    column: c.length === 1 ? c[0] : null,
    finished: !0,
    source: s
  });
}
var bh = (e, t, s, i) => {
  const r = e[s.getId()], n = e[i.getId()], o = r != null, a = n != null;
  if (o && a)
    return r - n;
  if (o)
    return -1;
  if (a)
    return 1;
  const l = t.indexOf(s), c = t.indexOf(i), d = l >= 0, h = c >= 0;
  return d && h ? l - c : d ? -1 : 1;
}, ub = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colModel", this.pivotMode = !1, this.ready = !1, this.changeEventsDispatching = !1;
  }
  postConstruct() {
    this.pivotMode = this.gos.get("pivotMode"), this.addManagedPropertyListeners(
      [
        "groupDisplayType",
        "treeData",
        "treeDataDisplayType",
        "groupHideOpenParents",
        "rowNumbers",
        "hidePaddedHeaderRows"
      ],
      (e) => this.refreshAll(qs(e.source))
    ), this.addManagedPropertyListeners(
      ["defaultColDef", "defaultColGroupDef", "columnTypes", "suppressFieldDotNotation"],
      this.recreateColumnDefs.bind(this)
    ), this.addManagedPropertyListener(
      "pivotMode",
      (e) => this.setPivotMode(this.gos.get("pivotMode"), qs(e.source))
    );
  }
  // called from SyncService, when grid has finished initialising
  createColsFromColDefs(e) {
    var v, w, b;
    const { beans: t } = this, {
      valueCache: s,
      colAutosize: i,
      rowGroupColsSvc: r,
      pivotColsSvc: n,
      valueColsSvc: o,
      visibleCols: a,
      eventSvc: l,
      groupHierarchyColSvc: c
    } = t, d = this.colDefs ? yp(t, e) : void 0;
    s == null || s.expire();
    const h = (v = this.colDefCols) == null ? void 0 : v.list, u = (w = this.colDefCols) == null ? void 0 : w.tree, g = cp(t, this.colDefs, !0, u, e);
    Ht(t, (b = this.colDefCols) == null ? void 0 : b.tree, g.columnTree);
    const p = g.columnTree, f = g.treeDepth, m = qc(p), C = {};
    m.forEach((y) => C[y.getId()] = y), this.colDefCols = { tree: p, treeDepth: f, list: m, map: C }, this.createColumnsForService([c], this.colDefCols), r == null || r.extractCols(e, h), n == null || n.extractCols(e, h), o == null || o.extractCols(e, h), this.ready = !0, this.refreshCols(!0), a.refresh(e), l.dispatchEvent({
      type: "columnEverythingChanged",
      source: e
    }), d && (this.changeEventsDispatching = !0, d(), this.changeEventsDispatching = !1), l.dispatchEvent({
      type: "newColumnsLoaded",
      source: e
    }), e === "gridInitializing" && (i == null || i.applyAutosizeStrategy());
  }
  // called from: buildAutoGroupColumns (events 'groupDisplayType', 'treeData', 'treeDataDisplayType', 'groupHideOpenParents')
  // createColsFromColDefs (recreateColumnDefs, setColumnsDefs),
  // setPivotMode, applyColumnState,
  // functionColsService.setPrimaryColList, functionColsService.updatePrimaryColList,
  // pivotResultCols.setPivotResultCols
  refreshCols(e) {
    var f;
    if (!this.colDefCols)
      return;
    const t = (f = this.cols) == null ? void 0 : f.tree;
    this.saveColOrder();
    const {
      autoColSvc: s,
      selectionColSvc: i,
      rowNumbersSvc: r,
      quickFilter: n,
      pivotResultCols: o,
      showRowGroupCols: a,
      rowAutoHeight: l,
      visibleCols: c,
      colViewport: d,
      eventSvc: h
    } = this.beans, u = this.selectCols(o, this.colDefCols);
    this.createColumnsForService([s, i, r], u);
    const g = _w(this.gos, this.showingPivotResult);
    (!e || g) && this.restoreColOrder(u), this.positionLockedCols(u), a == null || a.refresh(), n == null || n.refreshCols(), this.setColSpanActive(), l == null || l.setAutoHeightActive(u), c.clear(), d.clear(), !Xe(t, this.cols.tree) && h.dispatchEvent({
      type: "gridColumnsChanged"
    });
  }
  createColumnsForService(e, t) {
    for (const s of e)
      s && (s.createColumns(t, (i) => {
        this.lastOrder = i(this.lastOrder), this.lastPivotOrder = i(this.lastPivotOrder);
      }), s.addColumns(t));
  }
  selectCols(e, t) {
    const s = (e == null ? void 0 : e.getPivotResultCols()) ?? null;
    this.showingPivotResult = s != null;
    const { map: i, list: r, tree: n, treeDepth: o } = s ?? t;
    return this.cols = {
      list: r.slice(),
      map: { ...i },
      tree: n.slice(),
      treeDepth: o
    }, s && (s.list.some((l) => {
      var c;
      return ((c = this.cols) == null ? void 0 : c.map[l.getColId()]) !== void 0;
    }) || (this.lastPivotOrder = null)), this.cols;
  }
  getColsToShow() {
    if (!this.cols)
      return [];
    const { valueColsSvc: e, selectionColSvc: t, gos: s } = this.beans, i = this.isPivotMode() && !this.showingPivotResult, r = t == null ? void 0 : t.isSelectionColumnEnabled(), n = s.get("rowNumbers"), o = e == null ? void 0 : e.columns;
    return this.cols.list.filter((l) => {
      const c = la(l);
      if (i) {
        const d = o == null ? void 0 : o.includes(l);
        return c || d || r && Ds(l) || n && Ke(l);
      } else
        return c || l.isVisible();
    });
  }
  // on events 'groupDisplayType', 'treeData', 'treeDataDisplayType', 'groupHideOpenParents'
  refreshAll(e) {
    this.ready && (this.refreshCols(!1), this.beans.visibleCols.refresh(e));
  }
  setColsVisible(e, t = !1, s) {
    je(
      this.beans,
      {
        state: e.map((i) => ({
          colId: typeof i == "string" ? i : i.getColId(),
          hide: !t
        }))
      },
      s
    );
  }
  /**
   * Restores provided columns order to the previous order in this.lastPivotOrder / this.lastOrder
   * If columns are not in the last order:
   *  - Check column groups, and apply column after the last column in the lowest shared group
   *  - If no sibling is found, apply the column at the end of the cols
   */
  restoreColOrder(e) {
    const t = this.showingPivotResult ? this.lastPivotOrder : this.lastOrder;
    if (!t)
      return;
    const s = t.filter((h) => e.map[h.getId()] != null);
    if (s.length === 0)
      return;
    if (s.length === e.list.length) {
      e.list = s;
      return;
    }
    const i = (h) => {
      const u = h.getOriginalParent();
      return u ? u.getChildren().length > 1 ? !0 : i(u) : !1;
    };
    if (!s.some((h) => i(h))) {
      const h = new Set(s);
      for (const u of e.list)
        h.has(u) || s.push(u);
      e.list = s;
      return;
    }
    const r = /* @__PURE__ */ new Map();
    for (let h = 0; h < s.length; h++) {
      const u = s[h];
      r.set(u, h);
    }
    const n = e.list.filter((h) => !r.has(h));
    if (n.length === 0) {
      e.list = s;
      return;
    }
    const o = (h, u) => {
      const g = u ? u.getOriginalParent() : h.getOriginalParent();
      if (!g)
        return null;
      let p = null, f = null;
      for (const m of g.getChildren())
        if (!(m === u || m === h)) {
          if (m instanceof Wt) {
            const C = r.get(m);
            if (C == null)
              continue;
            (p == null || p < C) && (p = C, f = m);
            continue;
          }
          m.forEachLeafColumn((C) => {
            const v = r.get(C);
            v != null && (p == null || p < v) && (p = v, f = C);
          });
        }
      return f ?? o(h, g);
    }, a = [], l = /* @__PURE__ */ new Map();
    for (const h of n) {
      const u = o(h, null);
      if (u == null) {
        a.push(h);
        continue;
      }
      const g = l.get(u);
      g === void 0 ? l.set(u, h) : Array.isArray(g) ? g.push(h) : l.set(u, [g, h]);
    }
    const c = new Array(e.list.length);
    let d = c.length - 1;
    for (let h = a.length - 1; h >= 0; h--)
      c[d--] = a[h];
    for (let h = s.length - 1; h >= 0; h--) {
      const u = s[h], g = l.get(u);
      if (g)
        if (Array.isArray(g))
          for (let p = g.length - 1; p >= 0; p--) {
            const f = g[p];
            c[d--] = f;
          }
        else
          c[d--] = g;
      c[d--] = u;
    }
    e.list = c;
  }
  positionLockedCols(e) {
    e.list = fp(e.list, this.gos);
  }
  saveColOrder() {
    var e, t;
    this.showingPivotResult ? this.lastPivotOrder = ((e = this.cols) == null ? void 0 : e.list) ?? null : this.lastOrder = ((t = this.cols) == null ? void 0 : t.list) ?? null;
  }
  getColumnDefs() {
    var e, t;
    return this.colDefCols ? (t = this.beans.colDefFactory) == null ? void 0 : t.getColumnDefs(
      this.colDefCols.list,
      this.showingPivotResult,
      this.lastOrder,
      ((e = this.cols) == null ? void 0 : e.list) ?? []
    ) : void 0;
  }
  setColSpanActive() {
    var e;
    this.colSpanActive = !!((e = this.cols) != null && e.list.some((t) => t.getColDef().colSpan != null));
  }
  isPivotMode() {
    return this.pivotMode;
  }
  setPivotMode(e, t) {
    if (e === this.pivotMode || (this.pivotMode = e, !this.ready))
      return;
    this.refreshCols(!1);
    const { visibleCols: s, eventSvc: i } = this.beans;
    s.refresh(t), i.dispatchEvent({
      type: "columnPivotModeChanged"
    });
  }
  // + clientSideRowModel
  isPivotActive() {
    var t;
    const e = (t = this.beans.pivotColsSvc) == null ? void 0 : t.columns;
    return this.pivotMode && !!(e != null && e.length);
  }
  // called when dataTypes change
  recreateColumnDefs(e) {
    var s;
    if (!this.cols)
      return;
    (s = this.beans.autoColSvc) == null || s.updateColumns(e);
    const t = qs(e.source);
    this.createColsFromColDefs(t);
  }
  setColumnDefs(e, t) {
    this.colDefs = e, this.createColsFromColDefs(t);
  }
  destroy() {
    var e;
    Ht(this.beans, (e = this.colDefCols) == null ? void 0 : e.tree), super.destroy();
  }
  getColTree() {
    var e;
    return ((e = this.cols) == null ? void 0 : e.tree) ?? [];
  }
  // + columnSelectPanel
  getColDefColTree() {
    var e;
    return ((e = this.colDefCols) == null ? void 0 : e.tree) ?? [];
  }
  // + clientSideRowController -> sorting, building quick filter text
  // + headerRenderer -> sorting (clearing icon)
  getColDefCols() {
    var e;
    return ((e = this.colDefCols) == null ? void 0 : e.list) ?? null;
  }
  // + moveColumnController
  getCols() {
    var e;
    return ((e = this.cols) == null ? void 0 : e.list) ?? [];
  }
  forAllCols(e) {
    var n, o, a, l, c;
    const { pivotResultCols: t, autoColSvc: s, selectionColSvc: i, groupHierarchyColSvc: r } = this.beans;
    Rr((n = this.colDefCols) == null ? void 0 : n.list, e), Rr((o = s == null ? void 0 : s.columns) == null ? void 0 : o.list, e), Rr((a = i == null ? void 0 : i.columns) == null ? void 0 : a.list, e), Rr((l = r == null ? void 0 : r.columns) == null ? void 0 : l.list, e), Rr((c = t == null ? void 0 : t.getPivotResultCols()) == null ? void 0 : c.list, e);
  }
  getColsForKeys(e) {
    return e ? e.map((t) => this.getCol(t)).filter((t) => t != null) : [];
  }
  getColDefCol(e) {
    var t;
    return (t = this.colDefCols) != null && t.list ? this.getColFromCollection(e, this.colDefCols) : null;
  }
  getCol(e) {
    return e == null ? null : this.getColFromCollection(e, this.cols);
  }
  /**
   * Get column exclusively by ID.
   *
   * Note getCol/getColFromCollection have poor performance when col has been removed.
   */
  getColById(e) {
    var t;
    return ((t = this.cols) == null ? void 0 : t.map[e]) ?? null;
  }
  getColFromCollection(e, t) {
    if (t == null)
      return null;
    const { map: s, list: i } = t;
    if (typeof e == "string" && s[e])
      return s[e];
    for (let a = 0; a < i.length; a++)
      if (nn(i[a], e))
        return i[a];
    const { autoColSvc: r, selectionColSvc: n, groupHierarchyColSvc: o } = this.beans;
    return (r == null ? void 0 : r.getColumn(e)) ?? (n == null ? void 0 : n.getColumn(e)) ?? (o == null ? void 0 : o.getColumn(e)) ?? null;
  }
}, Zc = class extends R {
  constructor() {
    super(...arguments), this.dispatchColumnChangedEvent = wp, this.columns = [], this.columnIndexMap = {}, this.updateIndexMap = () => {
      this.columnIndexMap = {}, this.columns.forEach((e, t) => this.columnIndexMap[e.getId()] = t);
    };
  }
  wireBeans(e) {
    this.colModel = e.colModel, this.aggFuncSvc = e.aggFuncSvc, this.visibleCols = e.visibleCols, this.groupHierarchCols = e.groupHierarchyColSvc;
  }
  sortColumns(e) {
    const { groupHierarchCols: t } = this;
    this.columns.sort((s, i) => (t == null ? void 0 : t.compareVirtualColumns(s, i)) ?? e(s, i)), this.updateIndexMap();
  }
  setColumns(e, t) {
    this.setColList(e, this.columns, this.eventName, !0, !0, this.columnProcessors.set, t);
  }
  addColumns(e, t) {
    this.updateColList(e, this.columns, !0, !0, this.columnProcessors.add, this.eventName, t);
  }
  removeColumns(e, t) {
    this.updateColList(e, this.columns, !1, !0, this.columnProcessors.remove, this.eventName, t);
  }
  getColumnIndex(e) {
    return this.columnIndexMap[e];
  }
  setColList(e = [], t, s, i, r, n, o) {
    const a = this.colModel.getCols();
    if (!a || a.length === 0)
      return;
    const l = /* @__PURE__ */ new Map();
    t.forEach((d, h) => l.set(d, h)), t.length = 0, A(e) && e.forEach((d) => {
      const h = this.colModel.getColDefCol(d);
      h && t.push(h);
    }), t.forEach((d, h) => {
      const u = l.get(d);
      if (u === void 0) {
        l.set(d, 0);
        return;
      }
      i && u !== h || l.delete(d);
    }), this.updateIndexMap();
    const c = this.colModel.getColDefCols();
    c == null || c.forEach((d) => {
      const h = t.indexOf(d) >= 0;
      n(d, h, o);
    }), r && this.colModel.refreshCols(!1), this.visibleCols.refresh(o), this.dispatchColumnChangedEvent(this.eventSvc, s, [...l.keys()], o);
  }
  updateColList(e = [], t, s, i, r, n, o) {
    if (!e || e.length === 0)
      return;
    let a = !1;
    const l = /* @__PURE__ */ new Set();
    if (e.forEach((d) => {
      if (!d)
        return;
      const h = this.colModel.getColDefCol(d);
      if (h) {
        if (l.add(h), s) {
          if (t.indexOf(h) >= 0)
            return;
          t.push(h);
        } else {
          const u = t.indexOf(h);
          if (u < 0)
            return;
          for (let g = u + 1; g < t.length; g++)
            l.add(t[g]);
          be(t, h);
        }
        r(h, s, o), a = !0;
      }
    }), !a)
      return;
    this.updateIndexMap(), i && this.colModel.refreshCols(!1), this.visibleCols.refresh(o);
    const c = Array.from(l);
    this.eventSvc.dispatchEvent({
      type: n,
      columns: c,
      column: c.length === 1 ? c[0] : null,
      source: o
    });
  }
  extractCols(e, t = []) {
    const s = this.columns, i = [], r = [], { setFlagFunc: n, getIndexFunc: o, getInitialIndexFunc: a, getValueFunc: l, getInitialValueFunc: c } = this.columnExtractors, d = this.colModel.getColDefCols();
    d == null || d.forEach((g) => {
      const p = !t.includes(g), f = g.getColDef(), m = l(f), C = c(f), v = o(f), w = a(f);
      let b;
      m !== void 0 ? b = m : v !== void 0 ? v === null ? b = !1 : b = v >= 0 : p ? C !== void 0 ? b = C : w !== void 0 ? b = w != null && w >= 0 : b = !1 : b = s.indexOf(g) >= 0, b && ((p ? v != null || w != null : v != null) ? i.push(g) : r.push(g));
    });
    const h = (g) => {
      const p = g.getColDef();
      return o(p) ?? a(p);
    };
    i.sort((g, p) => h(g) - h(p));
    const u = [...i];
    return s.forEach((g) => {
      var p;
      r.indexOf(g) >= 0 && ((p = this.groupHierarchCols) == null || p.expandColumnInto(u, g));
    }), r.forEach((g) => {
      u.indexOf(g) < 0 && u.push(g);
    }), s.forEach((g) => {
      u.indexOf(g) < 0 && n(g, !1, e);
    }), u.forEach((g) => {
      s.indexOf(g) < 0 && n(g, !0, e);
    }), this.columns = u, this.updateIndexMap(), this.columns;
  }
  restoreColumnOrder(e, t) {
    const s = this.columns, i = this.colModel.getColDefCols();
    if (!s.length || !i)
      return e;
    const r = Object.keys(t), n = new Set(r), o = new Set(r), a = new Set(
      s.map((w) => {
        const b = w.getColId();
        return o.delete(b), b;
      }).concat(r)
    ), l = [], c = {};
    let d = 0;
    for (let w = 0; w < i.length; w++) {
      const b = i[w].getColId();
      a.has(b) && (l.push(b), c[b] = d++);
    }
    let h = 1e3, u = !1, g = 0;
    const p = this.columnOrdering.enableProp, f = this.columnOrdering.initialEnableProp, m = this.columnOrdering.indexProp, C = this.columnOrdering.initialIndexProp, v = (w) => {
      const b = c[w];
      for (let y = g; y < b; y++) {
        const P = l[y];
        o.has(P) && (t[P][m] = h++, o.delete(P));
      }
      g = b;
    };
    return s.forEach((w) => {
      const b = w.getColId();
      if (n.has(b))
        v(b), t[b][m] = h++;
      else {
        const y = w.getColDef();
        (y[m] === null || y[m] === void 0 && y[C] == null) && (u || (y[p] || y[p] === void 0 && y[f] ? v(b) : (o.forEach((M) => {
          t[M][m] = h + c[M];
        }), h += l.length, u = !0)), e[b] || (e[b] = { colId: b }), e[b][m] = h++);
      }
    }), e;
  }
}, xp = class {
  constructor() {
    this.existingIds = {};
  }
  getInstanceIdForKey(e) {
    const t = this.existingIds[e];
    let s;
    return typeof t != "number" ? s = 0 : s = t + 1, this.existingIds[e] = s, s;
  }
};
function Cn(e, t, s) {
  return s && e.addDestroyFunc(() => t.destroyBean(s)), s ?? e;
}
var x = null;
function Mo(e) {
  return typeof (e == null ? void 0 : e.getGui) == "function";
}
var Fp = class {
  constructor(e) {
    this.cssClassStates = {}, this.getGui = e;
  }
  toggleCss(e, t) {
    var i;
    if (!e)
      return;
    if (e.indexOf(" ") >= 0) {
      const r = (e || "").split(" ");
      if (r.length > 1) {
        r.forEach((n) => this.toggleCss(n, t));
        return;
      }
    }
    this.cssClassStates[e] !== t && e.length && ((i = this.getGui()) == null || i.classList.toggle(e, t), this.cssClassStates[e] = t);
  }
}, gb = 0, vn = class extends as {
  constructor(e, t) {
    super(), this.suppressDataRefValidation = !1, this.displayed = !0, this.visible = !0, this.compId = gb++, this.cssManager = new Fp(() => this.eGui), this.componentSelectors = new Map((t ?? []).map((s) => [s.selector, s])), e && this.setTemplate(e);
  }
  preConstruct() {
    var t, s, i;
    this.wireTemplate(this.getGui());
    const e = "component-" + ((s = (t = Object.getPrototypeOf(this)) == null ? void 0 : t.constructor) == null ? void 0 : s.name);
    (i = this.css) == null || i.forEach((r) => this.beans.environment.addGlobalCSS(r, e));
  }
  wireTemplate(e, t) {
    e && this.gos && (this.applyElementsToComponent(e), this.createChildComponentsFromTags(e, t));
  }
  getCompId() {
    return this.compId;
  }
  getDataRefAttribute(e) {
    return e.getAttribute ? e.getAttribute(Hg) : null;
  }
  applyElementsToComponent(e, t, s, i = null) {
    if (t === void 0 && (t = this.getDataRefAttribute(e)), t) {
      const r = this[t];
      if (r === x)
        this[t] = i ?? e;
      else {
        const n = s && s[t];
        if (!this.suppressDataRefValidation && !n)
          throw new Error(`data-ref: ${t} on ${this.constructor.name} with ${r}`);
      }
    }
  }
  // for registered components only, eg creates AgCheckbox instance from ag-checkbox HTML tag
  createChildComponentsFromTags(e, t) {
    const s = [];
    for (const i of e.childNodes ?? [])
      s.push(i);
    s.forEach((i) => {
      if (!(i instanceof HTMLElement))
        return;
      const r = this.createComponentFromElement(
        i,
        (n) => {
          const o = n.getGui();
          if (o)
            for (const a of i.attributes ?? [])
              o.setAttribute(a.name, a.value);
        },
        t
      );
      if (r) {
        if (r.addItems && i.children.length) {
          this.createChildComponentsFromTags(i, t);
          const n = Array.prototype.slice.call(i.children);
          r.addItems(n);
        }
        this.swapComponentForNode(r, e, i);
      } else i.childNodes && this.createChildComponentsFromTags(i, t);
    });
  }
  createComponentFromElement(e, t, s) {
    const i = e.nodeName, r = this.getDataRefAttribute(e), n = i.indexOf("AG-") === 0, o = n ? this.componentSelectors.get(i) : null;
    let a = null;
    if (o) {
      const l = s && r ? s[r] : void 0;
      a = new o.component(l), a.setParentComponent(
        this
      ), this.createBean(a, null, t);
    } else if (n)
      throw new Error(`selector: ${i}`);
    return this.applyElementsToComponent(e, r, s, a), a;
  }
  swapComponentForNode(e, t, s) {
    const i = e.getGui();
    t.replaceChild(i, s), t.insertBefore(document.createComment(s.nodeName), i), this.addDestroyFunc(this.destroyBean.bind(this, e));
  }
  activateTabIndex(e) {
    const t = this.gos.get("tabIndex");
    e || (e = []), e.length || e.push(this.getGui()), e.forEach((s) => s.setAttribute("tabindex", t.toString()));
  }
  setTemplate(e, t, s) {
    let i;
    typeof e == "string" || e == null ? i = Oc(e) : i = mn(e), this.setTemplateFromElement(i, t, s);
  }
  setTemplateFromElement(e, t, s, i = !1) {
    if (this.eGui = e, this.suppressDataRefValidation = i, t)
      for (let r = 0; r < t.length; r++) {
        const n = t[r];
        this.componentSelectors.set(n.selector, n);
      }
    this.wireTemplate(e, s);
  }
  getGui() {
    return this.eGui;
  }
  getFocusableElement() {
    return this.eGui;
  }
  getAriaElement() {
    return this.getFocusableElement();
  }
  setParentComponent(e) {
    this.parentComponent = e;
  }
  getParentComponent() {
    return this.parentComponent;
  }
  // this method is for older code, that wants to provide the gui element,
  // it is not intended for this to be in ag-Stack
  setGui(e) {
    this.eGui = e;
  }
  queryForHtmlElement(e) {
    return this.eGui.querySelector(e);
  }
  getContainerAndElement(e, t) {
    let s = t;
    return e == null ? null : (s || (s = this.eGui), na(e) ? {
      element: e,
      parent: s
    } : {
      element: e.getGui(),
      parent: s
    });
  }
  prependChild(e, t) {
    const { element: s, parent: i } = this.getContainerAndElement(e, t) || {};
    !s || !i || i.insertAdjacentElement("afterbegin", s);
  }
  appendChild(e, t) {
    const { element: s, parent: i } = this.getContainerAndElement(e, t) || {};
    !s || !i || i.appendChild(s);
  }
  isDisplayed() {
    return this.displayed;
  }
  setVisible(e, t = {}) {
    if (e !== this.visible) {
      this.visible = e;
      const { skipAriaHidden: s } = t;
      kg(this.eGui, e, { skipAriaHidden: s });
    }
  }
  setDisplayed(e, t = {}) {
    if (e !== this.displayed) {
      this.displayed = e;
      const { skipAriaHidden: s } = t;
      O(this.eGui, e, { skipAriaHidden: s });
      const i = {
        type: "displayChanged",
        visible: this.displayed
      };
      this.dispatchLocalEvent(i);
    }
  }
  destroy() {
    this.parentComponent && (this.parentComponent = void 0), super.destroy();
  }
  addGuiEventListener(e, t, s) {
    this.eGui.addEventListener(e, t, s), this.addDestroyFunc(() => this.eGui.removeEventListener(e, t));
  }
  addCss(e) {
    this.cssManager.toggleCss(e, !0);
  }
  removeCss(e) {
    this.cssManager.toggleCss(e, !1);
  }
  toggleCss(e, t) {
    this.cssManager.toggleCss(e, t);
  }
  registerCSS(e) {
    this.css || (this.css = []), this.css.push(e);
  }
}, D = class extends vn {
};
function Rp(e) {
  return typeof e == "object" && !!e.component;
}
function pb(e) {
  return typeof e.then == "function";
}
function fb(e, t) {
  return new U((s) => {
    s(window.setInterval(e, t));
  });
}
var U = class Hr {
  constructor(t) {
    this.status = 0, this.resolution = null, this.waiters = [], t(
      (s) => this.onDone(s),
      (s) => this.onReject(s)
    );
  }
  static all(t) {
    return t.length ? new Hr((s) => {
      let i = t.length;
      const r = new Array(i);
      t.forEach((n, o) => {
        n.then((a) => {
          r[o] = a, i--, i === 0 && s(r);
        });
      });
    }) : Hr.resolve();
  }
  static resolve(t = null) {
    return new Hr((s) => s(t));
  }
  then(t) {
    return new Hr((s) => {
      this.status === 1 ? s(t(this.resolution)) : this.waiters.push((i) => s(t(i)));
    });
  }
  onDone(t) {
    this.status = 1, this.resolution = t, this.waiters.forEach((s) => s(t));
  }
  onReject(t) {
  }
};
function mb(e) {
  return e ? e.prototype && "getGui" in e.prototype : !1;
}
function Pp(e, t, s, i) {
  const { name: r } = s;
  let n, o, a, l, c, d;
  if (t) {
    const h = t, u = h[r + "Selector"], g = u ? u(i) : null, p = (f) => {
      typeof f == "string" ? n = f : f != null && f !== !0 && (e.isFrameworkComponent(f) ? a = f : o = f);
    };
    g ? (p(g.component), l = g.params, c = g.popup, d = g.popupPosition) : p(h[r]);
  }
  return { compName: n, jsComp: o, fwComp: a, paramsFromSelector: l, popupFromSelector: c, popupPositionFromSelector: d };
}
var Cb = class extends R {
  constructor() {
    super(...arguments), this.beanName = "userCompFactory";
  }
  wireBeans(e) {
    this.agCompUtils = e.agCompUtils, this.registry = e.registry, this.frameworkCompWrapper = e.frameworkCompWrapper, this.gridOptions = e.gridOptions;
  }
  getCompDetailsFromGridOptions(e, t, s, i = !1) {
    return this.getCompDetails(this.gridOptions, e, t, s, i);
  }
  getCompDetails(e, t, s, i, r = !1) {
    var w;
    const { name: n, cellRenderer: o } = t;
    let { compName: a, jsComp: l, fwComp: c, paramsFromSelector: d, popupFromSelector: h, popupPositionFromSelector: u } = Pp(this.beans.frameworkOverrides, e, t, i), g, p;
    const f = (b) => {
      const y = this.registry.getUserComponent(n, b);
      y && (l = y.componentFromFramework ? void 0 : y.component, c = y.componentFromFramework ? y.component : void 0, g = y.params, p = y.processParams);
    };
    if (a != null && f(a), l == null && c == null && s != null && f(s), l && o && !mb(l) && (l = (w = this.agCompUtils) == null ? void 0 : w.adaptFunction(t, l)), !l && !c) {
      const { validation: b } = this.beans;
      r && (a !== s || !s) ? a ? b != null && b.isProvidedUserComp(a) || j(50, { compName: a }) : s ? b || j(260, {
        ...this.gos.getModuleErrorParams(),
        propName: n,
        compName: s
      }) : j(216, { name: n }) : s && !b && j(146, { comp: s });
      return;
    }
    const m = this.mergeParams(
      e,
      t,
      i,
      d,
      g,
      p
    ), C = l == null, v = l ?? c;
    return {
      componentFromFramework: C,
      componentClass: v,
      params: m,
      type: t,
      popupFromSelector: h,
      popupPositionFromSelector: u,
      newAgStackInstance: () => this.newAgStackInstance(v, C, m, t)
    };
  }
  newAgStackInstance(e, t, s, i) {
    var a;
    const r = !t;
    let n;
    r ? n = new e() : n = this.frameworkCompWrapper.wrap(
      e,
      i.mandatoryMethods,
      i.optionalMethods,
      i
    ), this.createBean(n);
    const o = (a = n.init) == null ? void 0 : a.call(n, s);
    return o == null ? U.resolve(n) : o.then(() => n);
  }
  /**
   * merges params with application provided params
   * used by Floating Filter
   */
  mergeParams(e, t, s, i = null, r, n) {
    const o = { ...s, ...r }, a = e, l = a && a[t.name + "Params"];
    if (typeof l == "function") {
      const c = l(s);
      Fe(o, c);
    } else typeof l == "object" && Fe(o, l);
    return Fe(o, i), n ? n(o) : o;
  }
}, vb = {
  name: "dateComponent",
  mandatoryMethods: ["getDate", "setDate"],
  optionalMethods: ["afterGuiAttached", "setInputPlaceholder", "setInputAriaLabel", "setDisabled", "refresh"]
}, wb = {
  name: "dragAndDropImageComponent",
  mandatoryMethods: ["setIcon", "setLabel"]
}, bb = { name: "headerComponent", optionalMethods: ["refresh"] }, yb = { name: "innerHeaderComponent" }, Sb = { name: "innerHeaderGroupComponent" }, xb = { name: "headerGroupComponent" }, Fb = {
  name: "innerRenderer",
  cellRenderer: !0,
  optionalMethods: ["afterGuiAttached"]
}, Rb = {
  name: "cellRenderer",
  optionalMethods: ["refresh", "afterGuiAttached"],
  cellRenderer: !0
}, Pb = {
  name: "cellRenderer",
  optionalMethods: ["refresh", "afterGuiAttached"]
}, Eb = { name: "loadingCellRenderer", cellRenderer: !0 }, Tb = {
  name: "cellEditor",
  mandatoryMethods: ["getValue"],
  optionalMethods: [
    "isPopup",
    "isCancelBeforeStart",
    "isCancelAfterEnd",
    "getPopupPosition",
    "focusIn",
    "focusOut",
    "afterGuiAttached",
    "refresh"
  ]
}, Mb = { name: "loadingOverlayComponent", optionalMethods: ["refresh"] }, Db = { name: "noRowsOverlayComponent", optionalMethods: ["refresh"] }, Ab = { name: "tooltipComponent" }, Qc = {
  name: "filter",
  mandatoryMethods: ["isFilterActive", "doesFilterPass", "getModel", "setModel"],
  optionalMethods: [
    "afterGuiAttached",
    "afterGuiDetached",
    "onNewRowsLoaded",
    "getModelAsString",
    "onFloatingFilterChanged",
    "onAnyFilterChanged",
    "refresh"
  ]
}, Ib = {
  name: "floatingFilterComponent",
  mandatoryMethods: ["onParentModelChanged"],
  optionalMethods: ["afterGuiAttached", "refresh"]
}, Lb = {
  name: "fullWidthCellRenderer",
  optionalMethods: ["refresh", "afterGuiAttached"],
  cellRenderer: !0
}, kb = { name: "loadingCellRenderer", cellRenderer: !0 }, Gb = {
  name: "groupRowRenderer",
  optionalMethods: ["afterGuiAttached"],
  cellRenderer: !0
}, Ob = { name: "detailCellRenderer", optionalMethods: ["refresh"], cellRenderer: !0 };
function Vb(e, t) {
  return e.getCompDetailsFromGridOptions(wb, "agDragAndDropImage", t, !0);
}
function kn(e, t, s) {
  return e.getCompDetails(t, Fb, void 0, s);
}
function Bb(e, t, s) {
  return e.getCompDetails(t, bb, "agColumnHeader", s);
}
function Nb(e, t, s) {
  return e.getCompDetails(t, yb, void 0, s);
}
function Hb(e, t) {
  const s = t.columnGroup.getColGroupDef();
  return e.getCompDetails(s, xb, "agColumnGroupHeader", t);
}
function zb(e, t, s) {
  return e.getCompDetails(t, Sb, void 0, s);
}
function Wb(e, t) {
  return e.getCompDetailsFromGridOptions(Lb, void 0, t, !0);
}
function _b(e, t) {
  return e.getCompDetailsFromGridOptions(kb, "agLoadingCellRenderer", t, !0);
}
function Ub(e, t) {
  return e.getCompDetailsFromGridOptions(Gb, "agGroupRowRenderer", t, !0);
}
function $b(e, t) {
  return e.getCompDetailsFromGridOptions(Ob, "agDetailCellRenderer", t, !0);
}
function fr(e, t, s) {
  return e.getCompDetails(t, Rb, void 0, s);
}
function Ep(e, t, s) {
  return e.getCompDetails(
    t,
    Pb,
    void 0,
    s
  );
}
function yh(e, t, s) {
  return e.getCompDetails(t, Eb, "agSkeletonCellRenderer", s, !0);
}
function Tp(e, t, s) {
  return e.getCompDetails(t, Tb, "agCellEditor", s, !0);
}
function Mp(e, t, s, i) {
  const r = t.filter;
  return Rp(r) && (t = {
    filter: r.component,
    filterParams: t.filterParams
  }), e.getCompDetails(t, Qc, i, s, !0);
}
function Kb(e, t, s) {
  return e.getCompDetails(t, vb, "agDateInput", s, !0);
}
function jb(e, t) {
  return e.getCompDetailsFromGridOptions(Mb, "agLoadingOverlay", t, !0);
}
function Yb(e, t) {
  return e.getCompDetailsFromGridOptions(Db, "agNoRowsOverlay", t, !0);
}
function qb(e, t) {
  return e.getCompDetails(t.colDef, Ab, "agTooltipComponent", t, !0);
}
function Dp(e, t, s, i) {
  return e.getCompDetails(t, Ib, i, s);
}
function Ap(e, t) {
  return Pp(e, t, Qc);
}
function Ua(e, t, s) {
  return e.mergeParams(t, Qc, s);
}
function Mi(e) {
  const t = e;
  return t != null && t.getFrameworkComponentInstance != null ? t.getFrameworkComponentInstance() : e;
}
function Xb(e) {
  return typeof e == "object" && !!e.getComp;
}
var S = {
  BACKSPACE: "Backspace",
  TAB: "Tab",
  ENTER: "Enter",
  ESCAPE: "Escape",
  SPACE: " ",
  LEFT: "ArrowLeft",
  UP: "ArrowUp",
  RIGHT: "ArrowRight",
  DOWN: "ArrowDown",
  DELETE: "Delete",
  F2: "F2",
  PAGE_UP: "PageUp",
  PAGE_DOWN: "PageDown",
  PAGE_HOME: "Home",
  PAGE_END: "End",
  // these should be used with `event.code` instead of `event.key`
  // as `event.key` changes when non-latin keyboards are used
  A: "KeyA",
  C: "KeyC",
  D: "KeyD",
  V: "KeyV",
  X: "KeyX",
  Y: "KeyY",
  Z: "KeyZ"
}, ha = class extends vn {
  isPopup() {
    return !0;
  }
  setParentComponent(e) {
    e.addCss("ag-has-popup"), super.setParentComponent(e);
  }
  destroy() {
    const e = this.parentComponent;
    e && e.isAlive() && e.getGui().classList.remove("ag-has-popup"), super.destroy();
  }
}, $a, Ka, ja, Ya, Ul, $l, qa;
function As() {
  return $a === void 0 && ($a = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)), $a;
}
function Jc() {
  return Ka === void 0 && (Ka = /(firefox)/i.test(navigator.userAgent)), Ka;
}
function Ip() {
  return ja === void 0 && (ja = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)), ja;
}
function Xs() {
  return Ya === void 0 && (Ya = /iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1), Ya;
}
function Kl(e) {
  if (!e)
    return null;
  const t = e.tabIndex, s = e.getAttribute("tabIndex");
  return t === -1 && (s === null || s === "" && !Jc()) ? null : t.toString();
}
function Zb() {
  if (qa !== void 0)
    return qa;
  if (!document.body)
    return -1;
  let e = 1e6;
  const t = Jc() ? 6e6 : 1e9, s = document.createElement("div");
  for (document.body.appendChild(s); ; ) {
    const i = e * 2;
    if (s.style.height = i + "px", i > t || s.clientHeight !== i)
      break;
    e = i;
  }
  return document.body.removeChild(s), qa = e, e;
}
function Qb() {
  return $l == null && Lp(), $l;
}
function Lp() {
  const e = document.body, t = document.createElement("div");
  t.style.width = t.style.height = "100px", t.style.opacity = "0", t.style.overflow = "scroll", t.style.msOverflowStyle = "scrollbar", t.style.position = "absolute", e.appendChild(t);
  let s = t.offsetWidth - t.clientWidth;
  s === 0 && t.clientWidth === 0 && (s = null), t.parentNode && t.parentNode.removeChild(t), s != null && ($l = s, Ul = s === 0);
}
function kp() {
  return Ul == null && Lp(), Ul;
}
var ed = "T", Jb = new RegExp(`[${ed} ]`), ey = new RegExp(`^\\d{4}-\\d{2}-\\d{2}(${ed}\\d{2}:\\d{2}:\\d{2}\\D?)?`);
function jt(e, t) {
  return e.toString().padStart(t, "0");
}
function tt(e, t = !0, s = ed) {
  if (!e)
    return null;
  let i = [e.getFullYear(), e.getMonth() + 1, e.getDate()].map((r) => jt(r, 2)).join("-");
  return t && (i += s + [e.getHours(), e.getMinutes(), e.getSeconds()].map((r) => jt(r, 2)).join(":")), i;
}
function Xi(e, t = !0) {
  return e ? t ? [
    String(e.getFullYear()),
    String(e.getMonth() + 1),
    jt(e.getDate(), 2),
    jt(e.getHours(), 2),
    `:${jt(e.getMinutes(), 2)}`,
    `:${jt(e.getSeconds(), 2)}`
  ] : [e.getFullYear(), e.getMonth() + 1, jt(e.getDate(), 2)].map(String) : null;
}
var Xa = (e) => {
  if (e > 3 && e < 21)
    return "th";
  switch (e % 10) {
    case 1:
      return "st";
    case 2:
      return "nd";
    case 3:
      return "rd";
  }
  return "th";
}, Do = [
  "January",
  "February",
  "March",
  "April",
  "May",
  "June",
  "July",
  "August",
  "September",
  "October",
  "November",
  "December"
], Za = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
function jl(e, t) {
  if (t == null)
    return tt(e, !1);
  const s = jt(e.getFullYear(), 4), i = {
    YYYY: () => s.slice(s.length - 4, s.length),
    YY: () => s.slice(s.length - 2, s.length),
    Y: () => `${e.getFullYear()}`,
    MMMM: () => Do[e.getMonth()],
    MMM: () => Do[e.getMonth()].slice(0, 3),
    MM: () => jt(e.getMonth() + 1, 2),
    Mo: () => `${e.getMonth() + 1}${Xa(e.getMonth() + 1)}`,
    M: () => `${e.getMonth() + 1}`,
    Do: () => `${e.getDate()}${Xa(e.getDate())}`,
    DD: () => jt(e.getDate(), 2),
    D: () => `${e.getDate()}`,
    dddd: () => Za[e.getDay()],
    ddd: () => Za[e.getDay()].slice(0, 3),
    dd: () => Za[e.getDay()].slice(0, 2),
    do: () => `${e.getDay()}${Xa(e.getDay())}`,
    d: () => `${e.getDay()}`
  }, r = new RegExp(Object.keys(i).join("|"), "g");
  return t.replace(r, (n) => n in i ? i[n]() : n);
}
function io(e, t = !1) {
  return !!ke(e, t);
}
function ty(e) {
  return io(e, !0);
}
function ke(e, t = !1, s) {
  if (!e || !s && !ey.test(e))
    return null;
  const [i, r] = e.split(Jb);
  if (!i)
    return null;
  const n = i.split("-").map((g) => parseInt(g, 10));
  if (n.filter((g) => !isNaN(g)).length !== 3)
    return null;
  const [o, a, l] = n, c = new Date(o, a - 1, l);
  if (c.getFullYear() !== o || c.getMonth() !== a - 1 || c.getDate() !== l || !r && t)
    return null;
  if (!r || r === "00:00:00")
    return c;
  const [d, h, u] = r.split(":").map((g) => parseInt(g, 10));
  if (d >= 0 && d < 24)
    c.setHours(d);
  else if (t)
    return null;
  if (h >= 0 && h < 60)
    c.setMinutes(h);
  else if (t)
    return null;
  if (u >= 0 && u < 60)
    c.setSeconds(u);
  else if (t)
    return null;
  return c;
}
function on(e) {
  const { inputValue: t, allSuggestions: s, hideIrrelevant: i, filterByPercentageOfBestMatch: r } = e;
  let n = (s ?? []).map(
    (l, c) => ({
      value: l,
      relevance: sy(t, l),
      idx: c
    })
  );
  if (n.sort((l, c) => l.relevance - c.relevance), i && (n = n.filter(
    (l) => l.relevance < Math.max(l.value.length, t.length)
  )), n.length > 0 && r && r > 0) {
    const c = n[0].relevance * r;
    n = n.filter((d) => c - d.relevance < 0);
  }
  const o = [], a = [];
  for (const l of n)
    o.push(l.value), a.push(l.idx);
  return { values: o, indices: a };
}
function sy(e, t) {
  e.length < t.length && ([e, t] = [t, e]);
  let s = [], i = [];
  const r = e.length, n = t.length;
  for (let a = 0; a <= n; a++)
    s[a] = a;
  let o = 0;
  for (let a = 1; a <= r; a++) {
    i[0] = a;
    for (let l = 1; l <= n; l++) {
      const c = e[a - 1], d = t[l - 1];
      if (c.toLocaleLowerCase() === d.toLocaleLowerCase())
        ++o, c === d && ++o, a > 1 && l > 1 && e[a - 2].toLocaleLowerCase() === t[l - 2].toLocaleLowerCase() && (++o, e[a - 2] === t[l - 2] && ++o), a < r / 2 - 10 && ++o, i[l] = s[l - 1];
      else {
        const h = i[l - 1], u = s[l], g = s[l - 1];
        i[l] = 1 + Math.min(h, u, g);
      }
    }
    [s, i] = [i, s];
  }
  return s[n] / (o + 1);
}
function td(e) {
  var s;
  return e.altKey || e.ctrlKey || e.metaKey ? !1 : ((s = e.key) == null ? void 0 : s.length) === 1;
}
var Yl = !1, Ao = 0;
function iy(e) {
  Ao > 0 || (e.addEventListener("keydown", Io), e.addEventListener("mousedown", Io));
}
function ry(e) {
  Ao > 0 || (e.removeEventListener("keydown", Io), e.removeEventListener("mousedown", Io));
}
function Io(e) {
  const t = Yl, s = e.type === "keydown";
  s && (e.ctrlKey || e.metaKey || e.altKey) || t !== s && (Yl = s);
}
function ny(e) {
  const t = me(e);
  return iy(t), Ao++, () => {
    Ao--, ry(t);
  };
}
function ua() {
  return Yl;
}
function Vt(e, t, s = !1) {
  const i = ww;
  let r = Lg;
  t && (r += ", " + t), s && (r += ', [tabindex="-1"]');
  const n = Array.prototype.slice.apply(e.querySelectorAll(i)).filter((l) => Ze(l)), o = Array.prototype.slice.apply(e.querySelectorAll(r));
  return o.length ? ((l, c) => l.filter((d) => c.indexOf(d) === -1))(n, o) : n;
}
function ye(e, t = !1, s = !1, i = !1) {
  const r = Vt(
    e,
    i ? ".ag-tab-guard" : null,
    s
  ), n = t ? _(r) : r[0];
  return n ? (n.focus({ preventScroll: !0 }), !0) : !1;
}
function ze(e, t, s, i) {
  const r = Vt(t, s ? ':not([tabindex="-1"])' : null), n = Q(e);
  let o;
  s ? o = r.findIndex((l) => l.contains(n)) : o = r.indexOf(n);
  const a = o + (i ? -1 : 1);
  return a < 0 || a >= r.length ? null : r[a];
}
function sd(e, t = 5) {
  let s = 0;
  for (; e && Kl(e) === null && ++s <= t; )
    e = e.parentElement;
  return Kl(e) === null ? null : e;
}
var oy = (
  /*css*/
  ".ag-label{white-space:nowrap}:where(.ag-ltr) .ag-label{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-label{margin-left:var(--ag-spacing)}:where(.ag-label-align-right) .ag-label{order:1}:where(.ag-ltr) :where(.ag-label-align-right) .ag-label{margin-left:var(--ag-spacing)}:where(.ag-rtl) :where(.ag-label-align-right) .ag-label{margin-right:var(--ag-spacing)}.ag-label-align-right>*{flex:none}.ag-label-align-top{align-items:flex-start;flex-direction:column;>*{align-self:stretch}}.ag-label-ellipsis{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:where(.ag-label-align-top) .ag-label{margin-bottom:calc(var(--ag-spacing)*.5)}"
), id = class extends vn {
  constructor(e, t, s) {
    super(t, s), this.labelSeparator = "", this.labelAlignment = "left", this.disabled = !1, this.label = "", this.config = e || {}, this.registerCSS(oy);
  }
  postConstruct() {
    this.addCss("ag-labeled"), this.eLabel.classList.add("ag-label");
    const { labelSeparator: e, label: t, labelWidth: s, labelAlignment: i, disabled: r } = this.config;
    r != null && this.setDisabled(r), e != null && this.setLabelSeparator(e), t != null && this.setLabel(t), s != null && this.setLabelWidth(s), this.setLabelAlignment(i || this.labelAlignment), this.refreshLabel();
  }
  refreshLabel() {
    const { label: e, eLabel: t } = this;
    X(t), typeof e == "string" ? t.innerText = e + this.labelSeparator : e && t.appendChild(e), e === "" ? (O(t, !1), Ye(t, "presentation")) : (O(t, !0), Ye(t, null));
  }
  setLabelSeparator(e) {
    return this.labelSeparator === e ? this : (this.labelSeparator = e, this.label != null && this.refreshLabel(), this);
  }
  getLabelId() {
    const e = this.eLabel;
    return e.id = e.id || `ag-${this.getCompId()}-label`, e.id;
  }
  getLabel() {
    return this.label;
  }
  setLabel(e) {
    return this.label === e ? this : (this.label = e, this.refreshLabel(), this);
  }
  setLabelAlignment(e) {
    const s = this.getGui().classList;
    return s.toggle("ag-label-align-left", e === "left"), s.toggle("ag-label-align-right", e === "right"), s.toggle("ag-label-align-top", e === "top"), this;
  }
  setLabelEllipsis(e) {
    return this.eLabel.classList.toggle("ag-label-ellipsis", e), this;
  }
  setLabelWidth(e) {
    return this.label == null ? this : (xo(this.eLabel, e), this);
  }
  setDisabled(e) {
    e = !!e;
    const t = this.getGui();
    return Fi(t, e), t.classList.toggle("ag-disabled", e), this.disabled = e, this;
  }
  isDisabled() {
    return !!this.disabled;
  }
}, Gp = class extends id {
  constructor(e, t, s, i) {
    super(e, t, s), this.className = i;
  }
  postConstruct() {
    super.postConstruct();
    const { width: e, value: t, onValueChange: s } = this.config;
    e != null && this.setWidth(e), t != null && this.setValue(t), s != null && this.onValueChange(s), this.className && this.addCss(this.className), this.refreshAriaLabelledBy();
  }
  setLabel(e) {
    return super.setLabel(e), this.refreshAriaLabelledBy(), this;
  }
  refreshAriaLabelledBy() {
    const e = this.getAriaElement(), t = this.getLabelId(), s = this.getLabel();
    s == null || s == "" || lw(e) !== null ? Js(e, "") : Js(e, t ?? "");
  }
  setAriaLabel(e) {
    return re(this.getAriaElement(), e), this.refreshAriaLabelledBy(), this;
  }
  onValueChange(e) {
    return this.addManagedListeners(this, { fieldValueChanged: () => e(this.getValue()) }), this;
  }
  getWidth() {
    return this.getGui().clientWidth;
  }
  setWidth(e) {
    return Ot(this.getGui(), e), this;
  }
  getPreviousValue() {
    return this.previousValue;
  }
  getValue() {
    return this.value;
  }
  setValue(e, t) {
    return this.value === e ? this : (this.previousValue = this.value, this.value = e, t || this.dispatchLocalEvent({ type: "fieldValueChanged" }), this);
  }
};
function ay(e) {
  return {
    tag: "div",
    role: "presentation",
    children: [
      { tag: "div", ref: "eLabel", cls: "ag-input-field-label" },
      {
        tag: "div",
        ref: "eWrapper",
        cls: "ag-wrapper ag-input-wrapper",
        role: "presentation",
        children: [{ tag: e, ref: "eInput", cls: "ag-input-field-input" }]
      }
    ]
  };
}
var Ks = class extends Gp {
  constructor(e, t, s = "text", i = "input") {
    super(e, (e == null ? void 0 : e.template) ?? ay(i), [], t), this.inputType = s, this.displayFieldTag = i, this.eLabel = x, this.eWrapper = x, this.eInput = x;
  }
  postConstruct() {
    super.postConstruct(), this.setInputType(this.inputType);
    const { eLabel: e, eWrapper: t, eInput: s, className: i } = this;
    e.classList.add(`${i}-label`), t.classList.add(`${i}-input-wrapper`), s.classList.add(`${i}-input`), this.addCss("ag-input-field"), s.id = s.id || `ag-${this.getCompId()}-input`;
    const { inputName: r, inputWidth: n } = this.config;
    r != null && this.setInputName(r), n != null && this.setInputWidth(n), this.addInputListeners(), this.activateTabIndex([s]);
  }
  addInputListeners() {
    this.addManagedElementListeners(this.eInput, {
      input: (e) => this.setValue(e.target.value)
    });
  }
  setInputType(e) {
    this.displayFieldTag === "input" && (this.inputType = e, vt(this.eInput, "type", e));
  }
  getInputElement() {
    return this.eInput;
  }
  setInputWidth(e) {
    return xo(this.eWrapper, e), this;
  }
  setInputName(e) {
    return this.getInputElement().setAttribute("name", e), this;
  }
  getFocusableElement() {
    return this.eInput;
  }
  setMaxLength(e) {
    const t = this.eInput;
    return t.maxLength = e, this;
  }
  setInputPlaceholder(e) {
    return vt(this.eInput, "placeholder", e), this;
  }
  setInputAriaLabel(e) {
    return re(this.eInput, e), this.refreshAriaLabelledBy(), this;
  }
  setDisabled(e) {
    return Fi(this.eInput, e), super.setDisabled(e);
  }
  setAutoComplete(e) {
    if (e === !0)
      vt(this.eInput, "autocomplete", null);
    else {
      const t = typeof e == "string" ? e : "off";
      vt(this.eInput, "autocomplete", t);
    }
    return this;
  }
}, Bi = class extends Ks {
  constructor(e, t = "ag-checkbox", s = "checkbox") {
    super(e, t, s), this.labelAlignment = "right", this.selected = !1, this.readOnly = !1, this.passive = !1;
  }
  postConstruct() {
    super.postConstruct();
    const { readOnly: e, passive: t } = this.config;
    typeof e == "boolean" && this.setReadOnly(e), typeof t == "boolean" && this.setPassive(t);
  }
  addInputListeners() {
    this.addManagedElementListeners(this.eInput, { click: this.onCheckboxClick.bind(this) }), this.addManagedElementListeners(this.eLabel, { click: this.toggle.bind(this) });
  }
  getNextValue() {
    return this.selected === void 0 ? !0 : !this.selected;
  }
  setPassive(e) {
    this.passive = e;
  }
  isReadOnly() {
    return this.readOnly;
  }
  setReadOnly(e) {
    this.eWrapper.classList.toggle("ag-disabled", e), this.eInput.disabled = e, this.readOnly = e;
  }
  setDisabled(e) {
    return this.eWrapper.classList.toggle("ag-disabled", e), super.setDisabled(e);
  }
  toggle() {
    if (this.eInput.disabled)
      return;
    const e = this.isSelected(), t = this.getNextValue();
    this.passive ? this.dispatchChange(t, e) : this.setValue(t);
  }
  getValue() {
    return this.isSelected();
  }
  setValue(e, t) {
    return this.refreshSelectedClass(e), this.setSelected(e, t), this;
  }
  setName(e) {
    const t = this.getInputElement();
    return t.name = e, this;
  }
  isSelected() {
    return this.selected;
  }
  setSelected(e, t) {
    if (this.isSelected() === e)
      return;
    this.previousValue = this.isSelected(), e = this.selected = typeof e == "boolean" ? e : void 0;
    const s = this.eInput;
    s.checked = e, s.indeterminate = e === void 0, t || this.dispatchChange(this.selected, this.previousValue);
  }
  dispatchChange(e, t, s) {
    this.dispatchLocalEvent({ type: "fieldValueChanged", selected: e, previousValue: t, event: s });
    const i = this.getInputElement();
    this.eventSvc.dispatchEvent({
      type: "checkboxChanged",
      id: i.id,
      name: i.name,
      selected: e,
      previousValue: t
    });
  }
  onCheckboxClick(e) {
    if (this.passive || this.eInput.disabled)
      return;
    const t = this.isSelected(), s = this.selected = e.target.checked;
    this.refreshSelectedClass(s), this.dispatchChange(s, t, e);
  }
  refreshSelectedClass(e) {
    const t = this.eWrapper.classList;
    t.toggle("ag-checked", e === !0), t.toggle("ag-indeterminate", e == null);
  }
}, _t = {
  selector: "AG-CHECKBOX",
  component: Bi
}, ly = class extends Bi {
  constructor(e) {
    super(e, "ag-radio-button", "radio");
  }
  isSelected() {
    return this.eInput.checked;
  }
  toggle() {
    this.eInput.disabled || this.isSelected() || this.setValue(!0);
  }
  addInputListeners() {
    super.addInputListeners(), this.addManagedEventListeners({ checkboxChanged: this.onChange.bind(this) });
  }
  /**
   * This ensures that if another radio button in the same named group is selected, we deselect this radio button.
   * By default the browser does this for you, but we are managing classes ourselves in order to ensure input
   * elements are styled correctly in IE11, and the DOM 'changed' event is only fired when a button is selected,
   * not deselected, so we need to use our own event.
   */
  onChange(e) {
    const t = this.eInput;
    e.selected && e.name && t.name && t.name === e.name && e.id && t.id !== e.id && this.setValue(!1, !0);
  }
}, cy = (
  /*css*/
  '.ag-toggle-button{flex:none;min-width:unset;width:unset}.ag-toggle-button-input-wrapper{background-color:var(--ag-toggle-button-off-background-color);border-radius:calc(var(--ag-toggle-button-height)*.5);flex:none;height:var(--ag-toggle-button-height);max-width:var(--ag-toggle-button-width);min-width:var(--ag-toggle-button-width);position:relative;transition:background-color .1s;:where(.ag-toggle-button-input){-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;display:block;height:var(--ag-toggle-button-height);margin:0;max-width:var(--ag-toggle-button-width);min-width:var(--ag-toggle-button-width);opacity:0}&:before{background-color:var(--ag-toggle-button-switch-background-color);border-radius:100%;content:"";display:block;height:calc(var(--ag-toggle-button-height) - var(--ag-toggle-button-switch-inset)*2);left:var(--ag-toggle-button-switch-inset);pointer-events:none;position:absolute;top:var(--ag-toggle-button-switch-inset);transition:left .1s;width:calc(var(--ag-toggle-button-height) - var(--ag-toggle-button-switch-inset)*2)}&.ag-checked{background-color:var(--ag-toggle-button-on-background-color);&:before{left:calc(100% - var(--ag-toggle-button-height) + var(--ag-toggle-button-switch-inset))}}&:focus-within{box-shadow:var(--ag-focus-shadow)}&.ag-disabled{opacity:.5}}'
), br = class extends Bi {
  constructor(e) {
    super(e, "ag-toggle-button"), this.registerCSS(cy);
  }
  setValue(e, t) {
    return super.setValue(e, t), this.toggleCss("ag-selected", this.getValue()), this;
  }
}, dy = {
  selector: "AG-TOGGLE-BUTTON",
  component: br
}, yt = class extends Ks {
  constructor(e, t = "ag-text-field", s = "text") {
    super(e, t, s);
  }
  postConstruct() {
    super.postConstruct(), this.config.allowedCharPattern && this.preventDisallowedCharacters();
  }
  setValue(e, t) {
    const s = this.eInput;
    return s.value !== e && (s.value = A(e) ? e : ""), super.setValue(e, t);
  }
  /** Used to set an initial value into the input without necessarily setting `this.value` or triggering events (e.g. to set an invalid value) */
  setStartValue(e) {
    this.setValue(e, !0);
  }
  preventDisallowedCharacters() {
    const e = new RegExp(`[${this.config.allowedCharPattern}]`), t = (s) => {
      td(s) && s.key && !e.test(s.key) && s.preventDefault();
    };
    this.addManagedListeners(this.eInput, {
      keydown: t,
      paste: (s) => {
        var r;
        const i = (r = s.clipboardData) == null ? void 0 : r.getData("text");
        i && i.split("").some((n) => !e.test(n)) && s.preventDefault();
      }
    });
  }
}, It = {
  selector: "AG-INPUT-TEXT-FIELD",
  component: yt
}, hy = class extends Ks {
  constructor(e) {
    super(e, "ag-text-area", null, "textarea");
  }
  setValue(e, t) {
    const s = super.setValue(e, t);
    return this.eInput.value = e, s;
  }
  setCols(e) {
    return this.eInput.cols = e, this;
  }
  setRows(e) {
    return this.eInput.rows = e, this;
  }
}, uy = {
  selector: "AG-INPUT-TEXT-AREA",
  component: hy
}, ga = class extends yt {
  constructor(e) {
    super(e, "ag-number-field", "number");
  }
  postConstruct() {
    super.postConstruct();
    const e = this.eInput;
    this.addManagedListeners(e, {
      blur: () => {
        const n = parseFloat(e.value), o = isNaN(n) ? "" : this.normalizeValue(n.toString());
        this.value !== o && this.setValue(o);
      },
      wheel: this.onWheel.bind(this)
    }), e.step = "any";
    const { precision: t, min: s, max: i, step: r } = this.config;
    typeof t == "number" && this.setPrecision(t), typeof s == "number" && this.setMin(s), typeof i == "number" && this.setMax(i), typeof r == "number" && this.setStep(r);
  }
  onWheel(e) {
    Q(this.beans) === this.eInput && e.preventDefault();
  }
  normalizeValue(e) {
    return e === "" ? "" : (this.precision != null && (e = this.adjustPrecision(e)), e);
  }
  adjustPrecision(e, t) {
    const s = this.precision;
    if (s == null)
      return e;
    if (t) {
      const r = parseFloat(e).toFixed(s);
      return parseFloat(r).toString();
    }
    const i = String(e).split(".");
    if (i.length > 1) {
      if (i[1].length <= s)
        return e;
      if (s > 0)
        return `${i[0]}.${i[1].slice(0, s)}`;
    }
    return i[0];
  }
  setMin(e) {
    return this.min === e ? this : (this.min = e, vt(this.eInput, "min", e), this);
  }
  setMax(e) {
    return this.max === e ? this : (this.max = e, vt(this.eInput, "max", e), this);
  }
  setPrecision(e) {
    return this.precision = e, this;
  }
  setStep(e) {
    return this.step === e ? this : (this.step = e, vt(this.eInput, "step", e), this);
  }
  setValue(e, t) {
    return this.setValueOrInputValue(
      (s) => super.setValue(s, t),
      () => this,
      e
    );
  }
  setStartValue(e) {
    return this.setValueOrInputValue(
      (t) => super.setValue(t, !0),
      (t) => {
        this.eInput.value = t;
      },
      e
    );
  }
  setValueOrInputValue(e, t, s) {
    if (A(s)) {
      let i = this.isScientificNotation(s);
      if (i && this.eInput.validity.valid)
        return e(s);
      if (!i) {
        s = this.adjustPrecision(s);
        const r = this.normalizeValue(s);
        i = s != r;
      }
      if (i)
        return t(s);
    }
    return e(s);
  }
  getValue() {
    const e = this.eInput;
    if (!e.validity.valid)
      return;
    const t = e.value;
    return this.isScientificNotation(t) ? this.adjustPrecision(t, !0) : super.getValue();
  }
  isScientificNotation(e) {
    return typeof e == "string" && e.includes("e");
  }
}, pa = {
  selector: "AG-INPUT-NUMBER-FIELD",
  component: ga
}, zr = class extends yt {
  constructor(e) {
    super(e, "ag-date-field", "date");
  }
  postConstruct() {
    super.postConstruct();
    const e = As();
    this.addManagedListeners(this.eInput, {
      wheel: this.onWheel.bind(this),
      mousedown: () => {
        this.isDisabled() || e || this.eInput.focus();
      }
    }), this.eInput.step = "any";
  }
  onWheel(e) {
    Q(this.beans) === this.eInput && e.preventDefault();
  }
  setMin(e) {
    const t = e instanceof Date ? tt(e ?? null, !!this.includeTime) ?? void 0 : e;
    return this.min === t ? this : (this.min = t, vt(this.eInput, "min", t), this);
  }
  setMax(e) {
    const t = e instanceof Date ? tt(e ?? null, !!this.includeTime) ?? void 0 : e;
    return this.max === t ? this : (this.max = t, vt(this.eInput, "max", t), this);
  }
  setStep(e) {
    return this.step === e ? this : (this.step = e, vt(this.eInput, "step", e), this);
  }
  setIncludeTime(e) {
    return this.includeTime === e ? this : (this.includeTime = e, super.setInputType(e ? "datetime-local" : "date"), e && this.setStep(1), this);
  }
  getDate() {
    if (this.eInput.validity.valid)
      return ke(this.getValue()) ?? void 0;
  }
  setDate(e, t) {
    this.setValue(tt(e ?? null, this.includeTime), t);
  }
}, Op = {
  selector: "AG-INPUT-DATE-FIELD",
  component: zr
}, gy = (
  /*css*/
  ".ag-list-item{align-items:center;display:flex;height:var(--ag-list-item-height);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;&.ag-active-item{background-color:var(--ag-row-hover-color)}}"
), py = "ag-active-item", fy = (e, t) => ({
  tag: "div",
  cls: `ag-list-item ag-${e}-list-item`,
  attrs: { role: "option" },
  children: [
    {
      tag: "span",
      ref: "eText",
      children: t
    }
  ]
}), my = class extends vn {
  constructor(e, t, s) {
    super(fy(e, t)), this.label = t, this.value = s, this.eText = x;
  }
  postConstruct() {
    this.createTooltip(), this.addEventListeners();
  }
  setHighlighted(e) {
    const t = this.getGui();
    t.classList.toggle(py, e), ta(t, e), this.dispatchLocalEvent({
      type: "itemHighlighted",
      highlighted: e
    });
  }
  getHeight() {
    return this.getGui().clientHeight;
  }
  setIndex(e, t) {
    const s = this.getGui();
    ea(s, e), Jo(s, t);
  }
  createTooltip() {
    const e = {
      getTooltipValue: () => this.label,
      getGui: () => this.getGui(),
      getLocation: () => "UNKNOWN",
      // only show tooltips for items where the text cannot be fully displayed
      shouldDisplayTooltip: () => Vc(this.eText)
    }, t = this.createOptionalManagedBean(
      this.beans.registry.createDynamicBean(
        "highlightTooltipFeature",
        !1,
        e,
        this
      )
    );
    t && (this.tooltipFeature = t);
  }
  addEventListeners() {
    const e = this.getParentComponent();
    e && (this.addGuiEventListener("mouseover", () => {
      e.highlightItem(this);
    }), this.addGuiEventListener("mousedown", (t) => {
      t.preventDefault(), t.stopPropagation(), e.setValue(this.value);
    }));
  }
}, Cy = class extends vn {
  constructor(e = "default") {
    super({ tag: "div", cls: `ag-list ag-${e}-list` }), this.cssIdentifier = e, this.options = [], this.listItems = [], this.highlightedItem = null, this.registerCSS(gy);
  }
  postConstruct() {
    const e = this.getGui();
    this.addManagedElementListeners(e, { mouseleave: () => this.clearHighlighted() });
  }
  handleKeyDown(e) {
    const t = e.key;
    switch (t) {
      case S.ENTER:
        if (!this.highlightedItem)
          this.setValue(this.getValue());
        else {
          const s = this.listItems.indexOf(this.highlightedItem);
          this.setValueByIndex(s);
        }
        break;
      case S.DOWN:
      case S.UP:
        e.preventDefault(), this.navigate(t);
        break;
      case S.PAGE_DOWN:
      case S.PAGE_UP:
      case S.PAGE_HOME:
      case S.PAGE_END:
        e.preventDefault(), this.navigateToPage(t);
        break;
    }
  }
  addOptions(e) {
    return e.forEach((t) => this.addOption(t)), this;
  }
  addOption(e) {
    const { value: t, text: s } = e, i = s ?? t;
    return this.options.push({ value: t, text: i }), this.renderOption(t, i), this.updateIndices(), this;
  }
  clearOptions() {
    this.options = [], this.reset(!0), this.listItems.forEach((e) => {
      e.destroy();
    }), X(this.getGui()), this.listItems = [], this.refreshAriaRole();
  }
  setValue(e, t) {
    if (this.value === e)
      return this.fireItemSelected(), this;
    if (e == null)
      return this.reset(t), this;
    const s = this.options.findIndex((i) => i.value === e);
    if (s !== -1) {
      const i = this.options[s];
      this.value = i.value, this.displayValue = i.text, this.highlightItem(this.listItems[s]), t || this.fireChangeEvent();
    }
    return this;
  }
  setValueByIndex(e) {
    return this.setValue(this.options[e].value);
  }
  getValue() {
    return this.value;
  }
  getDisplayValue() {
    return this.displayValue;
  }
  refreshHighlighted() {
    this.clearHighlighted();
    const e = this.options.findIndex((t) => t.value === this.value);
    e !== -1 && this.highlightItem(this.listItems[e]);
  }
  highlightItem(e) {
    const t = e.getGui();
    if (!Ze(t))
      return;
    this.clearHighlighted(), e.setHighlighted(!0), this.highlightedItem = e;
    const s = this.getGui(), { scrollTop: i, clientHeight: r } = s, { offsetTop: n, offsetHeight: o } = t;
    (n + o > i + r || n < i) && t.scrollIntoView({ block: "nearest" });
  }
  hideItemTooltip() {
    var e, t;
    (t = (e = this.highlightedItem) == null ? void 0 : e.tooltipFeature) == null || t.attemptToHideTooltip();
  }
  destroy() {
    this.hideItemTooltip(), super.destroy();
  }
  reset(e) {
    this.value = null, this.displayValue = null, this.clearHighlighted(), e || this.fireChangeEvent();
  }
  clearHighlighted() {
    var e;
    (e = this.highlightedItem) == null || e.setHighlighted(!1), this.highlightedItem = null;
  }
  renderOption(e, t) {
    const s = new my(this.cssIdentifier, t, e);
    s.setParentComponent(this);
    const i = this.createManagedBean(s);
    this.listItems.push(i), this.getGui().appendChild(i.getGui());
  }
  navigate(e) {
    const t = e === S.DOWN;
    let s;
    const { listItems: i, highlightedItem: r } = this;
    if (!r)
      s = t ? i[0] : _(i);
    else {
      let o = i.indexOf(r) + (t ? 1 : -1);
      o = Math.min(Math.max(o, 0), i.length - 1), s = i[o];
    }
    this.highlightItem(s);
  }
  navigateToPage(e) {
    const { listItems: t, highlightedItem: s } = this;
    if (!s || t.length === 0)
      return;
    const i = t.indexOf(s), r = this.options.length - 1, n = t[0].getHeight(), o = Math.floor(this.getGui().clientHeight / n);
    let a = -1;
    e === S.PAGE_HOME ? a = 0 : e === S.PAGE_END ? a = r : e === S.PAGE_DOWN ? a = Math.min(i + o, r) : e === S.PAGE_UP && (a = Math.max(i - o, 0)), a !== -1 && this.highlightItem(t[a]);
  }
  refreshAriaRole() {
    Ye(this.getGui(), this.options.length === 0 ? "presentation" : "listbox");
  }
  updateIndices() {
    this.refreshAriaRole();
    const e = this.listItems, t = e.length;
    e.forEach((s, i) => {
      s.setIndex(i + 1, t);
    });
  }
  fireChangeEvent() {
    this.dispatchLocalEvent({ type: "fieldValueChanged" }), this.fireItemSelected();
  }
  fireItemSelected() {
    this.dispatchLocalEvent({ type: "selectedItem" });
  }
}, vy = (
  /*css*/
  ".ag-picker-field-display{flex:1 1 auto}.ag-picker-field{align-items:center;display:flex}.ag-picker-field-icon{border:0;cursor:pointer;display:flex;margin:0;padding:0}.ag-picker-field-wrapper{background-color:var(--ag-picker-button-background-color);border:var(--ag-picker-button-border);border-radius:5px;min-height:max(var(--ag-list-item-height),calc(var(--ag-spacing)*4));overflow:hidden;&:where(.ag-picker-has-focus),&:where(:focus-within){background-color:var(--ag-picker-button-focus-background-color);border:var(--ag-picker-button-focus-border);box-shadow:var(--ag-focus-shadow);&:where(.invalid){box-shadow:var(--ag-focus-error-shadow)}}&:where(.invalid){background-color:var(--ag-input-invalid-background-color);border:var(--ag-input-invalid-border);color:var(--ag-input-invalid-text-color)}&:disabled{opacity:.5}}"
), wy = {
  tag: "div",
  cls: "ag-picker-field",
  role: "presentation",
  children: [
    { tag: "div", ref: "eLabel" },
    {
      tag: "div",
      ref: "eWrapper",
      cls: "ag-wrapper ag-picker-field-wrapper ag-picker-collapsed",
      children: [
        { tag: "div", ref: "eDisplayField", cls: "ag-picker-field-display" },
        { tag: "div", ref: "eIcon", cls: "ag-picker-field-icon", attrs: { "aria-hidden": "true" } }
      ]
    }
  ]
}, rd = class extends Gp {
  constructor(e) {
    if (super(e, (e == null ? void 0 : e.template) || wy, (e == null ? void 0 : e.agComponents) || [], e == null ? void 0 : e.className), this.isPickerDisplayed = !1, this.skipClick = !1, this.pickerGap = 4, this.hideCurrentPicker = null, this.eLabel = x, this.eWrapper = x, this.eDisplayField = x, this.eIcon = x, this.registerCSS(vy), this.ariaRole = e == null ? void 0 : e.ariaRole, this.onPickerFocusIn = this.onPickerFocusIn.bind(this), this.onPickerFocusOut = this.onPickerFocusOut.bind(this), !e)
      return;
    const { pickerGap: t, maxPickerHeight: s, variableWidth: i, minPickerWidth: r, maxPickerWidth: n } = e;
    t != null && (this.pickerGap = t), this.variableWidth = !!i, s != null && this.setPickerMaxHeight(s), r != null && this.setPickerMinWidth(r), n != null && this.setPickerMaxWidth(n);
  }
  postConstruct() {
    super.postConstruct(), this.setupAria();
    const e = `ag-${this.getCompId()}-display`;
    this.eDisplayField.setAttribute("id", e);
    const t = this.getAriaElement();
    this.addManagedElementListeners(t, { keydown: this.onKeyDown.bind(this) }), this.addManagedElementListeners(this.eLabel, { mousedown: this.onLabelOrWrapperMouseDown.bind(this) }), this.addManagedElementListeners(this.eWrapper, { mousedown: this.onLabelOrWrapperMouseDown.bind(this) });
    const { pickerIcon: s, inputWidth: i } = this.config;
    if (s) {
      const r = this.beans.iconSvc.createIconNoSpan(s);
      r && this.eIcon.appendChild(r);
    }
    i != null && this.setInputWidth(i);
  }
  setupAria() {
    const e = this.getAriaElement();
    e.setAttribute("tabindex", this.gos.get("tabIndex").toString()), qe(e, !1), this.ariaRole && Ye(e, this.ariaRole);
  }
  onLabelOrWrapperMouseDown(e) {
    if (e) {
      const t = this.getFocusableElement();
      if (t !== this.eWrapper && (e == null ? void 0 : e.target) === t)
        return;
      e.preventDefault(), this.getFocusableElement().focus();
    }
    if (this.skipClick) {
      this.skipClick = !1;
      return;
    }
    this.isDisabled() || (this.isPickerDisplayed ? this.hidePicker() : this.showPicker());
  }
  onKeyDown(e) {
    switch (e.key) {
      case S.UP:
      case S.DOWN:
      case S.ENTER:
      case S.SPACE:
        e.preventDefault(), this.onLabelOrWrapperMouseDown();
        break;
      case S.ESCAPE:
        this.isPickerDisplayed && (e.preventDefault(), e.stopPropagation(), this.hideCurrentPicker && this.hideCurrentPicker());
        break;
    }
  }
  showPicker() {
    this.isPickerDisplayed = !0, this.pickerComponent || (this.pickerComponent = this.createPickerComponent());
    const e = this.pickerComponent.getGui();
    e.addEventListener("focusin", this.onPickerFocusIn), e.addEventListener("focusout", this.onPickerFocusOut), this.hideCurrentPicker = this.renderAndPositionPicker(), this.toggleExpandedStyles(!0);
  }
  renderAndPositionPicker() {
    const e = this.pickerComponent.getGui();
    this.gos.get("suppressScrollWhenPopupsAreOpen") || ([this.destroyMouseWheelFunc] = this.addManagedEventListeners({
      bodyScroll: () => {
        this.hidePicker();
      }
    }));
    const t = this.getLocaleTextFunc(), {
      config: { pickerAriaLabelKey: s, pickerAriaLabelValue: i, modalPicker: r = !0 },
      maxPickerHeight: n,
      minPickerWidth: o,
      maxPickerWidth: a,
      variableWidth: l,
      beans: c,
      eWrapper: d
    } = this, h = {
      modal: r,
      eChild: e,
      closeOnEsc: !0,
      closedCallback: () => {
        const f = Jt(c);
        this.beforeHidePicker(), f && this.isAlive() && this.getFocusableElement().focus();
      },
      ariaLabel: t(s, i),
      anchorToElement: d
    };
    e.style.position = "absolute";
    const u = c.popupSvc, g = u.addPopup(h);
    l ? (o && (e.style.minWidth = o), e.style.width = Bc(Ri(d)), a && (e.style.maxWidth = a)) : xo(e, a ?? Ri(d));
    const p = n ?? `${ia(u.getPopupParent())}px`;
    return e.style.setProperty("max-height", p), this.alignPickerToComponent(), g.hideFunc;
  }
  alignPickerToComponent() {
    if (!this.pickerComponent)
      return;
    const {
      pickerGap: e,
      config: { pickerType: t },
      beans: { popupSvc: s, gos: i },
      eWrapper: r,
      pickerComponent: n
    } = this, o = i.get("enableRtl") ? "right" : "left";
    s.positionPopupByComponent({
      type: t,
      eventSource: r,
      ePopup: n.getGui(),
      position: "under",
      alignSide: o,
      keepWithinBounds: !0,
      nudgeY: e
    });
  }
  beforeHidePicker() {
    this.destroyMouseWheelFunc && (this.destroyMouseWheelFunc(), this.destroyMouseWheelFunc = void 0), this.toggleExpandedStyles(!1);
    const e = this.pickerComponent.getGui();
    e.removeEventListener("focusin", this.onPickerFocusIn), e.removeEventListener("focusout", this.onPickerFocusOut), this.isPickerDisplayed = !1, this.pickerComponent = void 0, this.hideCurrentPicker = null;
  }
  toggleExpandedStyles(e) {
    if (!this.isAlive())
      return;
    const t = this.getAriaElement();
    qe(t, e);
    const s = this.eWrapper.classList;
    s.toggle("ag-picker-expanded", e), s.toggle("ag-picker-collapsed", !e);
  }
  onPickerFocusIn() {
    this.togglePickerHasFocus(!0);
  }
  onPickerFocusOut(e) {
    var t;
    (t = this.pickerComponent) != null && t.getGui().contains(e.relatedTarget) || this.togglePickerHasFocus(!1);
  }
  togglePickerHasFocus(e) {
    this.pickerComponent && this.eWrapper.classList.toggle("ag-picker-has-focus", e);
  }
  hidePicker() {
    this.hideCurrentPicker && (this.hideCurrentPicker(), this.dispatchLocalEvent({
      type: "pickerHidden"
    }));
  }
  setInputWidth(e) {
    return xo(this.eWrapper, e), this;
  }
  getFocusableElement() {
    return this.eWrapper;
  }
  setPickerGap(e) {
    return this.pickerGap = e, this;
  }
  setPickerMinWidth(e) {
    return typeof e == "number" && (e = `${e}px`), this.minPickerWidth = e ?? void 0, this;
  }
  setPickerMaxWidth(e) {
    return typeof e == "number" && (e = `${e}px`), this.maxPickerWidth = e ?? void 0, this;
  }
  setPickerMaxHeight(e) {
    return typeof e == "number" && (e = `${e}px`), this.maxPickerHeight = e ?? void 0, this;
  }
  destroy() {
    this.hidePicker(), super.destroy();
  }
}, by = (
  /*css*/
  ".ag-select{align-items:center;display:flex;&.ag-disabled{opacity:.5}}:where(.ag-select){.ag-picker-field-wrapper{cursor:default}&.ag-disabled .ag-picker-field-wrapper:focus{box-shadow:none}&:not(.ag-cell-editor,.ag-label-align-top){min-height:var(--ag-list-item-height)}.ag-picker-field-display{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-picker-field-icon{align-items:center;display:flex}}:where(.ag-ltr) :where(.ag-select){.ag-picker-field-wrapper{padding-left:calc(var(--ag-cell-horizontal-padding)/2);padding-right:var(--ag-spacing)}}:where(.ag-rtl) :where(.ag-select){.ag-picker-field-wrapper{padding-left:var(--ag-spacing);padding-right:calc(var(--ag-cell-horizontal-padding)/2)}}.ag-select-list{background-color:var(--ag-picker-list-background-color);border:var(--ag-picker-list-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dropdown-shadow);overflow:hidden auto}.ag-select-list-item{cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;:where(span){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}:where(.ag-ltr) .ag-select-list-item{padding-left:calc(var(--ag-cell-horizontal-padding)/2)}:where(.ag-rtl) .ag-select-list-item{padding-right:calc(var(--ag-cell-horizontal-padding)/2)}"
), st = class extends rd {
  constructor(e) {
    super({
      pickerAriaLabelKey: "ariaLabelSelectField",
      pickerAriaLabelValue: "Select Field",
      pickerType: "ag-list",
      className: "ag-select",
      pickerIcon: "selectOpen",
      ariaRole: "combobox",
      ...e
    }), this.registerCSS(by);
  }
  postConstruct() {
    this.tooltipFeature = this.createOptionalManagedBean(
      this.beans.registry.createDynamicBean(
        "tooltipFeature",
        !1,
        {
          shouldDisplayTooltip: Ci(() => this.eDisplayField),
          getGui: () => this.getGui()
        }
      )
    ), super.postConstruct(), this.createListComponent(), this.eWrapper.tabIndex = this.gos.get("tabIndex");
    const { options: e, value: t, placeholder: s } = this.config;
    e != null && this.addOptions(e), t != null && this.setValue(t, !0), s && t == null && (this.eDisplayField.textContent = s), this.addManagedElementListeners(this.eWrapper, { focusout: this.onWrapperFocusOut.bind(this) });
  }
  onWrapperFocusOut(e) {
    this.eWrapper.contains(e.relatedTarget) || this.hidePicker();
  }
  createListComponent() {
    const e = this.createBean(
      new Cy("select")
    );
    this.listComponent = e, e.setParentComponent(this);
    const t = e.getAriaElement(), s = `ag-select-list-${e.getCompId()}`;
    t.setAttribute("id", s), kc(this.getAriaElement(), t), e.addManagedElementListeners(e.getGui(), {
      mousedown: (i) => {
        i == null || i.preventDefault();
      }
    }), e.addManagedListeners(e, {
      selectedItem: () => {
        this.hidePicker(), this.dispatchLocalEvent({ type: "selectedItem" });
      },
      fieldValueChanged: () => {
        this.listComponent && (this.setValue(this.listComponent.getValue(), !1, !0), this.hidePicker());
      }
    });
  }
  createPickerComponent() {
    return this.listComponent;
  }
  beforeHidePicker() {
    var e;
    (e = this.listComponent) == null || e.hideItemTooltip(), super.beforeHidePicker();
  }
  onKeyDown(e) {
    var s;
    const { key: t } = e;
    switch (t === S.TAB && this.hidePicker(), t) {
      case S.ENTER:
      case S.UP:
      case S.DOWN:
      case S.PAGE_UP:
      case S.PAGE_DOWN:
      case S.PAGE_HOME:
      case S.PAGE_END:
        e.preventDefault(), this.isPickerDisplayed ? (s = this.listComponent) == null || s.handleKeyDown(e) : super.onKeyDown(e);
        break;
      case S.ESCAPE:
        super.onKeyDown(e);
        break;
      case S.SPACE:
        this.isPickerDisplayed ? e.preventDefault() : super.onKeyDown(e);
        break;
    }
  }
  showPicker() {
    const e = this.listComponent;
    e && (super.showPicker(), e.refreshHighlighted());
  }
  addOptions(e) {
    return e.forEach((t) => this.addOption(t)), this;
  }
  addOption(e) {
    return this.listComponent.addOption(e), this;
  }
  clearOptions() {
    var e;
    return (e = this.listComponent) == null || e.clearOptions(), this.setValue(void 0, !0), this;
  }
  setValue(e, t, s) {
    const {
      listComponent: i,
      config: { placeholder: r },
      eDisplayField: n,
      tooltipFeature: o
    } = this;
    if (this.value === e || !i)
      return this;
    if (s || i.setValue(e, !0), i.getValue() === this.getValue())
      return this;
    let l = i.getDisplayValue();
    return l == null && r && (l = r), n.textContent = l, o == null || o.setTooltipAndRefresh(l ?? null), super.setValue(e, t);
  }
  destroy() {
    this.listComponent = this.destroyBean(this.listComponent), super.destroy();
  }
}, Ni = {
  selector: "AG-SELECT",
  component: st
}, Vp = /* @__PURE__ */ ((e) => (e[e.Vertical = 0] = "Vertical", e[e.Horizontal = 1] = "Horizontal", e))(Vp || {}), yy = (
  /*css*/
  ':where(.ag-root-wrapper,.ag-external,.ag-popup,.ag-dnd-ghost,.ag-chart),:where(.ag-root-wrapper,.ag-external,.ag-popup,.ag-dnd-ghost,.ag-chart) :where([class^=ag-]){box-sizing:border-box;&:after,&:before{box-sizing:border-box}&:where(div,span,label):focus-visible{box-shadow:inset var(--ag-focus-shadow);outline:none;&:where(.invalid){box-shadow:inset var(--ag-focus-error-shadow)}}&:where(button){color:inherit}}:where(.ag-root-wrapper,ag-external,.ag-popup,.ag-dnd-ghost,.ag-chart) :where([class^=ag-]) ::-ms-clear{display:none}.ag-hidden{display:none!important}.ag-invisible{visibility:hidden!important}.ag-popup-child{top:0;z-index:5;&:where(:not(.ag-tooltip-custom)){box-shadow:var(--ag-popup-shadow)}}.ag-input-wrapper,.ag-picker-field-wrapper{align-items:center;display:flex;flex:1 1 auto;line-height:normal;position:relative}.ag-input-field{align-items:center;display:flex;flex-direction:row}.ag-input-field-input:where(:not([type=checkbox],[type=radio])){flex:1 1 auto;min-width:0;width:100%}.ag-chart,.ag-dnd-ghost,.ag-external,.ag-popup,.ag-root-wrapper{cursor:default;line-height:normal;white-space:normal;-webkit-font-smoothing:antialiased;background-color:var(--ag-background-color);color:var(--ag-text-color);color-scheme:var(--ag-browser-color-scheme);font-family:var(--ag-font-family);font-size:var(--ag-font-size);--ag-indentation-level:0}:where(.ag-icon):before{align-items:center;background-color:currentcolor;color:inherit;content:"";display:flex;font-family:inherit;font-size:var(--ag-icon-size);font-style:normal;font-variant:normal;height:var(--ag-icon-size);justify-content:center;line-height:var(--ag-icon-size);-webkit-mask-size:contain;mask-size:contain;text-transform:none;width:var(--ag-icon-size)}.ag-icon{background-position:50%;background-repeat:no-repeat;background-size:contain;color:var(--ag-icon-color);display:block;height:var(--ag-icon-size);position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ag-icon-size)}.ag-disabled,[disabled]{.ag-icon{opacity:.5}&.ag-icon-grip{opacity:.35}}.ag-resizer{pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:1}:where(.ag-resizer){&.ag-resizer-topLeft{cursor:nwse-resize;height:5px;left:0;top:0;width:5px}&.ag-resizer-top{cursor:ns-resize;height:5px;left:5px;right:5px;top:0}&.ag-resizer-topRight{cursor:nesw-resize;height:5px;right:0;top:0;width:5px}&.ag-resizer-right{bottom:5px;cursor:ew-resize;right:0;top:5px;width:5px}&.ag-resizer-bottomRight{bottom:0;cursor:nwse-resize;height:5px;right:0;width:5px}&.ag-resizer-bottom{bottom:0;cursor:ns-resize;height:5px;left:5px;right:5px}&.ag-resizer-bottomLeft{bottom:0;cursor:nesw-resize;height:5px;left:0;width:5px}&.ag-resizer-left{bottom:5px;cursor:ew-resize;left:0;top:5px;width:5px}}'
), Fg, Rg, nd = typeof window != "object" || !((Rg = (Fg = window == null ? void 0 : window.document) == null ? void 0 : Fg.fonts) != null && Rg.forEach), mr = (e, t, s, i, r, n) => {
  if (nd)
    return;
  i && (e = `@layer ${CSS.escape(i)} { ${e} }`);
  let o = rr.map.get(t);
  if (o || (o = [], rr.map.set(t, o)), o.find((d) => d.css === e))
    return;
  const a = document.createElement("style");
  n && a.setAttribute("nonce", n), a.dataset.agGlobalCss = s, a.textContent = e;
  const l = { css: e, el: a, priority: r };
  let c;
  for (const d of o) {
    if (d.priority > r)
      break;
    c = d;
  }
  if (c) {
    c.el.insertAdjacentElement("afterend", a);
    const d = o.indexOf(c);
    o.splice(d + 1, 0, l);
  } else
    t.insertBefore(a, t.querySelector(":not(title, meta)")), o.push(l);
}, Bp = (e, t, s, i) => {
  mr(yy, e, "shared", t, 0, s), i == null || i.forEach(
    (r, n) => r.forEach((o) => mr(o, e, n, t, 0, s))
  );
}, Sy = (e) => {
  rr.grids.add(e);
}, xy = (e) => {
  if (rr.grids.delete(e), rr.grids.size === 0) {
    rr.map = /* @__PURE__ */ new WeakMap();
    for (const t of document.head.querySelectorAll("style[data-ag-global-css]"))
      t.remove();
  }
}, Sh, rr = (Sh = typeof window == "object" ? window : {}).agStyleInjectionState ?? (Sh.agStyleInjectionState = {
  map: /* @__PURE__ */ new WeakMap(),
  grids: /* @__PURE__ */ new Set()
}), ss = (e) => new Np(e), zs = "$default", Fy = 0, Np = class {
  constructor({ feature: e, params: t, modeParams: s = {}, css: i, cssImports: r }) {
    this.feature = e, this.css = i, this.cssImports = r, this.modeParams = {
      // NOTE: it's important that default is defined first, putting it
      // first in iteration order, because when merging params the default
      // params override any prior modal params, so modal params in this
      // part need to come after default params to prevent them from being
      // immediately overridden.
      [zs]: {
        ...s[zs] ?? {},
        ...t ?? {}
      },
      ...s
    };
  }
  use(e, t, s) {
    let i = this._inject;
    if (i == null) {
      let { css: r } = this;
      if (r) {
        const n = `ag-theme-${this.feature ?? "part"}-${++Fy}`;
        typeof r == "function" && (r = r()), r = `:where(.${n}) {
${r}
}
`;
        for (const o of this.cssImports ?? [])
          r = `@import url(${JSON.stringify(o)});
${r}`;
        i = { css: r, class: n };
      } else
        i = !1;
      this._inject = i;
    }
    return i && e && mr(i.css, e, i.class, t, 1, s), i ? i.class : !1;
  }
}, Ry = (e) => e.replace(/[A-Z]/g, (t) => `-${t}`).toLowerCase(), Hp = (e) => `--ag-${Ry(e)}`, is = (e) => `var(${Hp(e)})`, Py = (e, t, s) => Math.max(t, Math.min(s, e)), Ey = (e) => {
  const t = /* @__PURE__ */ new Map();
  return (s) => {
    const i = s;
    return t.has(i) || t.set(i, e(s)), t.get(i);
  };
}, $t = (e) => ({ ref: "accentColor", mix: e }), Pt = (e) => ({ ref: "foregroundColor", mix: e }), Tt = (e) => ({
  ref: "foregroundColor",
  mix: e,
  onto: "backgroundColor"
}), Ty = (e) => ({
  ref: "foregroundColor",
  mix: e,
  onto: "headerBackgroundColor"
}), ht = { ref: "backgroundColor" }, Zi = { ref: "foregroundColor" }, Cs = { ref: "accentColor" }, Lo = {
  backgroundColor: "#fff",
  foregroundColor: "#181d1f",
  borderColor: Pt(0.15),
  chromeBackgroundColor: Tt(0.02),
  browserColorScheme: "light"
}, My = {
  ...Lo,
  textColor: Zi,
  accentColor: "#2196f3",
  invalidColor: "#e02525",
  fontFamily: [
    "-apple-system",
    "BlinkMacSystemFont",
    "Segoe UI",
    "Roboto",
    "Oxygen-Sans",
    "Ubuntu",
    "Cantarell",
    "Helvetica Neue",
    "sans-serif"
  ],
  subtleTextColor: {
    ref: "textColor",
    mix: 0.5
  },
  borderWidth: 1,
  borderRadius: 4,
  spacing: 8,
  fontSize: 14,
  focusShadow: {
    spread: 3,
    color: $t(0.5)
  },
  focusErrorShadow: {
    spread: 3,
    color: {
      ref: "invalidColor",
      onto: "backgroundColor",
      mix: 0.5
    }
  },
  popupShadow: "0 0 16px #00000026",
  cardShadow: "0 1px 4px 1px #00000018",
  dropdownShadow: { ref: "cardShadow" },
  listItemHeight: {
    calc: "max(iconSize, dataFontSize) + widgetVerticalSpacing"
  },
  dragAndDropImageBackgroundColor: ht,
  dragAndDropImageBorder: !0,
  dragAndDropImageNotAllowedBorder: {
    color: {
      ref: "invalidColor",
      onto: "dragAndDropImageBackgroundColor",
      mix: 0.5
    }
  },
  dragAndDropImageShadow: {
    ref: "popupShadow"
  },
  iconSize: 16,
  iconColor: "inherit",
  toggleButtonWidth: 28,
  toggleButtonHeight: 18,
  toggleButtonOnBackgroundColor: Cs,
  toggleButtonOffBackgroundColor: Tt(0.3),
  toggleButtonSwitchBackgroundColor: ht,
  toggleButtonSwitchInset: 2,
  tooltipBackgroundColor: {
    ref: "chromeBackgroundColor"
  },
  tooltipErrorBackgroundColor: {
    ref: "invalidColor",
    onto: "backgroundColor",
    mix: 0.1
  },
  tooltipTextColor: {
    ref: "textColor"
  },
  tooltipErrorTextColor: {
    ref: "invalidColor"
  },
  tooltipBorder: !0,
  tooltipErrorBorder: {
    color: {
      ref: "invalidColor",
      onto: "backgroundColor",
      mix: 0.25
    }
  }
}, Dy = [
  "colorScheme",
  "color",
  "length",
  "scale",
  "borderStyle",
  "border",
  "shadow",
  "image",
  "fontFamily",
  "fontWeight",
  "duration"
], Ay = Ey((e) => (e = e.toLowerCase(), Dy.find((t) => e.endsWith(t.toLowerCase())) ?? "length")), fa = (e) => typeof e == "object" && (e != null && e.ref) ? is(e.ref) : typeof e == "string" ? e : typeof e == "number" ? String(e) : !1, od = (e) => {
  if (typeof e == "string")
    return e;
  if (e && "ref" in e) {
    const t = is(e.ref);
    return e.mix == null ? t : `color-mix(in srgb, ${e.onto ? is(e.onto) : "transparent"}, ${t} ${Py(e.mix * 100, 0, 100)}%)`;
  }
  return !1;
}, Iy = fa, Qi = (e) => typeof e == "string" ? e : typeof e == "number" ? `${e}px` : e && "calc" in e ? `calc(${e.calc.replace(/ ?[*/+] ?/g, " $& ").replace(/-?\b[a-z][a-z0-9]*\b(?![-(])/gi, (s) => s[0] === "-" ? s : ` ${is(s)} `)})` : e && "ref" in e ? is(e.ref) : !1, Ly = fa, ql = (e, t) => typeof e == "string" ? e : e === !0 ? ql({}, t) : e === !1 ? t === "columnBorder" ? ql({ color: "transparent" }, t) : "none" : e && "ref" in e ? is(e.ref) : zp(e.style ?? "solid") + " " + Qi(e.width ?? { ref: "borderWidth" }) + " " + od(e.color ?? { ref: "borderColor" }), ky = (e) => typeof e == "string" ? e : e === !1 ? "none" : e && "ref" in e ? is(e.ref) : [
  Qi(e.offsetX ?? 0),
  Qi(e.offsetY ?? 0),
  Qi(e.radius ?? 0),
  Qi(e.spread ?? 0),
  od(e.color ?? { ref: "foregroundColor" })
].join(" "), zp = fa, Wp = (e) => typeof e == "string" ? e.includes(",") ? e : xh(e) : e && "googleFont" in e ? Wp(e.googleFont) : e && "ref" in e ? is(e.ref) : Array.isArray(e) ? e.map((t) => (typeof t == "object" && "googleFont" in t && (t = t.googleFont), xh(t))).join(", ") : !1, xh = (e) => (
  // don't quote var() expressions or quote safe identifier names, so that
  // people can specify fonts like sans-serif which are keywords not strings,
  // or var(--my-var)
  /^[\w-]+$|\w\(/.test(e) ? e : JSON.stringify(e)
), Gy = fa, _p = (e) => typeof e == "string" ? e : e && "url" in e ? `url(${JSON.stringify(e.url)})` : e && "svg" in e ? _p({ url: `data:image/svg+xml,${encodeURIComponent(e.svg)}` }) : e && "ref" in e ? is(e.ref) : !1, Oy = (e, t, s) => typeof e == "string" ? e : typeof e == "number" ? (e >= 10 && s.warn(104, { value: e, param: t }), `${e}s`) : e && "ref" in e ? is(e.ref) : !1, Vy = {
  color: od,
  colorScheme: Iy,
  length: Qi,
  scale: Ly,
  border: ql,
  borderStyle: zp,
  shadow: ky,
  image: _p,
  fontFamily: Wp,
  fontWeight: Gy,
  duration: Oy
}, By = (e, t, s) => {
  const i = Ay(e);
  return Vy[i](t, e, s);
}, Ny = (e) => new Up(e), Up = class $p {
  constructor(t, s = []) {
    this.themeLogger = t, this.parts = s;
  }
  withPart(t) {
    return typeof t == "function" && (t = t()), t instanceof Np ? new $p(this.themeLogger, [...this.parts, t]) : (this.themeLogger.preInitErr(259, "Invalid part", { part: t }), this);
  }
  withoutPart(t) {
    return this.withPart(ss({ feature: t }));
  }
  withParams(t, s = zs) {
    return this.withPart(
      ss({
        modeParams: { [s]: t }
      })
    );
  }
  /**
   * Called by a grid instance when it starts using the theme. This installs
   * the theme's parts into document head, or the shadow DOM if the provided
   * container is within a shadow root.
   */
  _startUse({ styleContainer: t, cssLayer: s, nonce: i, loadThemeGoogleFonts: r, moduleCss: n }) {
    if (nd)
      return;
    zy(), Bp(t, s, i, n);
    const o = Hy(this);
    if (o.length > 0)
      for (const a of o)
        r && _y(a, i);
    for (const a of this.parts)
      a.use(t, s, i);
  }
  /**
   * Return CSS that that applies the params of this theme to elements with
   * the provided class name
   */
  _getCssClass() {
    return this._cssClassCache ?? (this._cssClassCache = Fh(this.parts).map((t) => t.use(void 0, void 0, void 0)).filter(Boolean).join(" "));
  }
  _getModeParams() {
    let t = this._paramsCache;
    if (!t) {
      const s = {
        // NOTE: defining the default mode here is important, it ensures
        // that the default mode is first in iteration order, which puts
        // it first in outputted CSS, allowing other modes to override it
        [zs]: { ...My }
      };
      for (const i of Fh(this.parts))
        for (const r of Object.keys(i.modeParams)) {
          const n = i.modeParams[r];
          if (n) {
            const o = s[r] ?? (s[r] = {}), a = /* @__PURE__ */ new Set();
            for (const l of Object.keys(n)) {
              const c = n[l];
              c !== void 0 && (o[l] = c, a.add(l));
            }
            if (r === zs)
              for (const l of Object.keys(s)) {
                const c = s[l];
                if (l !== zs)
                  for (const d of a)
                    delete c[d];
              }
          }
        }
      this._paramsCache = t = s;
    }
    return t;
  }
  /**
   * Return the CSS chunk that is inserted into the grid DOM, and will
   * therefore be removed automatically when the grid is destroyed or it
   * starts to use a new theme.
   *
   * @param className a unique class name on the grid wrapper used to scope the returned CSS to the grid instance
   */
  _getPerInstanceCss(t) {
    const s = "##SELECTOR##";
    let i = this._paramsCssCache;
    if (!i) {
      let r = "", n = "";
      const o = this._getModeParams();
      for (const l of Object.keys(o)) {
        const c = o[l];
        if (l !== zs) {
          const h = `:where([data-ag-theme-mode="${typeof CSS == "object" ? CSS.escape(l) : l}"]) & {
`;
          r += h, n += h;
        }
        for (const d of Object.keys(c).sort()) {
          const h = c[d], u = By(d, h, this.themeLogger);
          if (u === !1)
            this.themeLogger.error(107, { key: d, value: h });
          else {
            const g = Hp(d), p = g.replace("--ag-", "--ag-inherited-");
            r += `	${g}: var(${p}, ${u});
`, n += `	${p}: var(${g});
`;
          }
        }
        l !== zs && (r += `}
`, n += `}
`);
      }
      let a = `${s} {
${r}}
`;
      a += `:has(> ${s}):not(${s}) {
${n}}
`, this._paramsCssCache = i = a;
    }
    return i.replaceAll(s, `:where(.${t})`);
  }
}, Fh = (e) => {
  const t = /* @__PURE__ */ new Map();
  for (const i of e)
    t.set(i.feature, i);
  const s = [];
  for (const i of e)
    (!i.feature || t.get(i.feature) === i) && s.push(i);
  return s;
}, Hy = (e) => {
  const t = /* @__PURE__ */ new Set(), s = (n) => {
    if (Array.isArray(n))
      n.forEach(s);
    else {
      const o = n == null ? void 0 : n.googleFont;
      typeof o == "string" && t.add(o);
    }
  };
  return Object.values(e._getModeParams()).flatMap((n) => Object.values(n)).forEach(s), Array.from(t).sort();
}, Rh = !1, zy = () => {
  if (!Rh) {
    Rh = !0;
    for (const e of Array.from(document.head.querySelectorAll('style[data-ag-scope="legacy"]')))
      e.remove();
  }
}, Wy = /* @__PURE__ */ new Set(), _y = async (e, t) => {
  Wy.add(e);
  const s = `@import url('https://${Uy}/css2?family=${encodeURIComponent(e)}:wght@100;200;300;400;500;600;700;800;900&display=swap');
`;
  mr(s, document.head, `googleFont:${e}`, void 0, 0, t);
}, Uy = "fonts.googleapis.com", $y = 1, Ky = class {
  constructor(e) {
    this.beans = {}, this.createdBeans = [], this.destroyed = !1, this.instanceId = $y++, !(!e || !e.beanClasses) && (this.beanDestroyComparator = e.beanDestroyComparator, this.init(e));
  }
  init(e) {
    var t;
    this.id = e.id, this.beans.context = this, this.destroyCallback = e.destroyCallback;
    for (const s of Object.keys(e.providedBeanInstances))
      this.beans[s] = e.providedBeanInstances[s];
    e.beanClasses.forEach((s) => {
      const i = new s();
      i.beanName ? this.beans[i.beanName] = i : console.error(`Bean ${s.name} is missing beanName`), this.createdBeans.push(i);
    }), (t = e.derivedBeans) == null || t.forEach((s) => {
      const { beanName: i, bean: r } = s(this);
      this.beans[i] = r, this.createdBeans.push(r);
    }), e.beanInitComparator && this.createdBeans.sort(e.beanInitComparator), this.initBeans(this.createdBeans);
  }
  getBeanInstances() {
    return Object.values(this.beans);
  }
  createBean(e, t) {
    return this.initBeans([e], t), e;
  }
  initBeans(e, t) {
    const s = this.beans;
    e.forEach((i) => {
      var r, n;
      (r = i.preWireBeans) == null || r.call(i, s), (n = i.wireBeans) == null || n.call(i, s);
    }), e.forEach((i) => {
      var r;
      return (r = i.preConstruct) == null ? void 0 : r.call(i);
    }), t && e.forEach(t), e.forEach((i) => {
      var r;
      return (r = i.postConstruct) == null ? void 0 : r.call(i);
    });
  }
  getBeans() {
    return this.beans;
  }
  getBean(e) {
    return this.beans[e];
  }
  getId() {
    return this.id;
  }
  destroy() {
    var t;
    if (this.destroyed)
      return;
    this.destroyed = !0;
    const e = this.getBeanInstances();
    this.beanDestroyComparator && e.sort(this.beanDestroyComparator), this.destroyBeans(e), this.beans = {}, this.createdBeans = [], (t = this.destroyCallback) == null || t.call(this);
  }
  /**
   * Destroys a bean and returns undefined to support destruction and clean up in a single line.
   * this.dateComp = this.context.destroyBean(this.dateComp);
   */
  destroyBean(e) {
    var t;
    (t = e == null ? void 0 : e.destroy) == null || t.call(e);
  }
  /**
   * Destroys an array of beans and returns an empty array to support destruction and clean up in a single line.
   * this.dateComps = this.context.destroyBeans(this.dateComps);
   */
  destroyBeans(e) {
    if (e)
      for (let t = 0; t < e.length; t++)
        this.destroyBean(e[t]);
    return [];
  }
  isDestroyed() {
    return this.destroyed;
  }
}, jy = 0, Yy = class extends as {
  constructor() {
    super(...arguments), this.beanName = "environment", this.paramsClass = `ag-theme-params-${++jy}`, this.globalCSS = [];
  }
  wireBeans(e) {
    this.eRootDiv = e.eRootDiv;
  }
  postConstruct() {
    const { gos: e, eRootDiv: t } = this;
    e.setInstanceDomData(t), this.eStyleContainer = e.get("themeStyleContainer") ?? (t.getRootNode() === document ? document.head : t), this.cssLayer = e.get("themeCssLayer"), this.styleNonce = e.get("styleNonce"), this.addManagedPropertyListener("theme", () => this.handleThemeChange()), this.handleThemeChange(), this.initVariables(), this.addDestroyFunc(() => xy(this)), this.mutationObserver = new MutationObserver(() => {
      this.fireStylesChangedEvent("themeChanged");
    }), this.addDestroyFunc(() => this.mutationObserver.disconnect());
  }
  applyThemeClasses(e, t = []) {
    const { theme: s } = this;
    let i;
    s ? i = `${this.paramsClass} ${s._getCssClass()}` : i = this.applyLegacyThemeClasses();
    for (const r of Array.from(e.classList))
      r.startsWith("ag-theme-") && e.classList.remove(r);
    if (i) {
      const r = e.className;
      e.className = `${r}${r ? " " : ""}${i}${t != null && t.length ? ` ${t.join(" ")}` : ""}`;
    }
  }
  applyLegacyThemeClasses() {
    let e = "";
    this.mutationObserver.disconnect();
    let t = this.eRootDiv;
    for (; t; ) {
      let s = !1;
      for (const i of Array.from(t.classList))
        i.startsWith("ag-theme-") && (s = !0, e = e ? `${e} ${i}` : i);
      s && this.mutationObserver.observe(t, {
        attributes: !0,
        attributeFilter: ["class"]
      }), t = t.parentElement;
    }
    return e;
  }
  addGlobalCSS(e, t) {
    this.theme ? mr(e, this.eStyleContainer, t, this.cssLayer, 0, this.styleNonce) : this.globalCSS.push([e, t]);
  }
  handleThemeChange() {
    const { gos: e, theme: t } = this, s = e.get("theme");
    let i;
    if (s === "legacy")
      i = void 0;
    else {
      const r = s ?? this.getDefaultTheme();
      r instanceof Up ? i = r : this.themeError(r);
    }
    i !== t && this.handleNewTheme(i), this.postProcessThemeChange(i, s);
  }
  handleNewTheme(e) {
    const { gos: t, eRootDiv: s, globalCSS: i } = this, r = this.getAdditionalCss();
    if (e) {
      Sy(this), Bp(this.eStyleContainer, this.cssLayer, this.styleNonce, r);
      for (const [o, a] of i)
        mr(o, this.eStyleContainer, a, this.cssLayer, 0, this.styleNonce);
      i.length = 0;
    }
    this.theme = e, e == null || e._startUse({
      loadThemeGoogleFonts: t.get("loadThemeGoogleFonts"),
      styleContainer: this.eStyleContainer,
      cssLayer: this.cssLayer,
      nonce: this.styleNonce,
      moduleCss: r
    });
    let n = this.eParamsStyle;
    if (!n) {
      n = this.eParamsStyle = mn({ tag: "style" });
      const o = t.get("styleNonce");
      o && n.setAttribute("nonce", o), s.appendChild(n);
    }
    nd || (n.textContent = (e == null ? void 0 : e._getPerInstanceCss(this.paramsClass)) || ""), this.applyThemeClasses(s), this.fireStylesChangedEvent("themeChanged");
  }
}, qy = class extends as {
  constructor() {
    super(...arguments), this.beanName = "registry";
  }
  registerDynamicBeans(e) {
    if (e) {
      this.dynamicBeans ?? (this.dynamicBeans = {});
      for (const t of Object.keys(e))
        this.dynamicBeans[t] = e[t];
    }
  }
  createDynamicBean(e, t, ...s) {
    if (!this.dynamicBeans)
      throw new Error(this.getDynamicError(e, !0));
    const i = this.dynamicBeans[e];
    if (i == null) {
      if (t)
        throw new Error(this.getDynamicError(e, !1));
      return;
    }
    return new i(...s);
  }
}, Xy = class extends as {
  constructor() {
    super(...arguments), this.beanName = "eventSvc", this.eventServiceType = "global", this.globalSvc = new Rs();
  }
  addListener(e, t, s) {
    this.globalSvc.addEventListener(e, t, s);
  }
  removeListener(e, t, s) {
    this.globalSvc.removeEventListener(e, t, s);
  }
  addGlobalListener(e, t = !1) {
    this.globalSvc.addGlobalListener(e, t);
  }
  removeGlobalListener(e, t = !1) {
    this.globalSvc.removeGlobalListener(e, t);
  }
  dispatchEvent(e) {
    this.globalSvc.dispatchEvent(this.gos.addCommon(e));
  }
  dispatchEventOnce(e) {
    this.globalSvc.dispatchEventOnce(this.gos.addCommon(e));
  }
}, Kp = class extends as {
  constructor(e, t) {
    super(), this.ctrl = e, t && (this.beans = t);
  }
  postConstruct() {
    this.refreshTooltip();
  }
  /**
   *
   * @param tooltip The tooltip value
   * @param allowEmptyString Set it to true to allow the title to be set to `''`. This is necessary
   * when the browser adds a default tooltip the element and the tooltip service will be displayed
   * next to a browser tooltip causing confusion.
   */
  setBrowserTooltip(e, t) {
    const s = "title", i = this.ctrl.getGui();
    i && (e != null && (e != "" || t) ? i.setAttribute(s, e) : i.removeAttribute(s));
  }
  updateTooltipText() {
    const { getTooltipValue: e } = this.ctrl;
    e && (this.tooltip = e());
  }
  createTooltipFeatureIfNeeded() {
    if (this.tooltipManager == null) {
      const e = this.beans.registry.createDynamicBean("tooltipStateManager", !0, this.ctrl, () => this.tooltip);
      e && (this.tooltipManager = this.createBean(e, this.beans.context));
    }
  }
  attemptToShowTooltip() {
    var e;
    (e = this.tooltipManager) == null || e.prepareToShowTooltip();
  }
  attemptToHideTooltip() {
    var e;
    (e = this.tooltipManager) == null || e.hideTooltip();
  }
  setTooltipAndRefresh(e) {
    this.tooltip = e, this.refreshTooltip();
  }
  refreshTooltip(e) {
    this.browserTooltips = this.beans.gos.get("enableBrowserTooltips"), this.updateTooltipText(), this.browserTooltips ? (this.setBrowserTooltip(this.tooltip), this.tooltipManager = this.destroyBean(this.tooltipManager, this.beans.context)) : (this.setBrowserTooltip(e ? "" : null, e), this.createTooltipFeatureIfNeeded());
  }
  destroy() {
    this.tooltipManager = this.destroyBean(this.tooltipManager, this.beans.context), super.destroy();
  }
}, Zy = 1e3, Qy = 1e3, Ph = 100, Eh, Gn = !1, Jy = class extends as {
  constructor(e, t) {
    super(), this.tooltipCtrl = e, this.getTooltipValue = t, this.interactionEnabled = !1, this.isInteractingWithTooltip = !1, this.state = 0, this.tooltipInstanceCount = 0, this.tooltipMouseTrack = !1;
  }
  wireBeans(e) {
    this.popupSvc = e.popupSvc;
  }
  postConstruct() {
    this.gos.get("tooltipInteraction") && (this.interactionEnabled = !0), this.tooltipTrigger = this.getTooltipTrigger(), this.tooltipMouseTrack = this.gos.get("tooltipMouseTrack");
    const e = this.tooltipCtrl.getGui();
    this.tooltipTrigger === 0 && this.addManagedListeners(e, {
      mouseenter: this.onMouseEnter.bind(this),
      mouseleave: this.onMouseLeave.bind(this)
    }), this.tooltipTrigger === 1 && this.addManagedListeners(e, {
      focusin: this.onFocusIn.bind(this),
      focusout: this.onFocusOut.bind(this)
    }), this.addManagedListeners(e, { mousemove: this.onMouseMove.bind(this) }), this.interactionEnabled || this.addManagedListeners(e, {
      mousedown: this.onMouseDown.bind(this),
      keydown: this.onKeyDown.bind(this)
    });
  }
  getGridOptionsTooltipDelay(e) {
    const t = this.gos.get(e);
    return Math.max(200, t);
  }
  getTooltipDelay(e) {
    var t, s, i, r;
    return e === "show" ? ((s = (t = this.tooltipCtrl).getTooltipShowDelayOverride) == null ? void 0 : s.call(t)) ?? this.getGridOptionsTooltipDelay("tooltipShowDelay") : ((r = (i = this.tooltipCtrl).getTooltipHideDelayOverride) == null ? void 0 : r.call(i)) ?? this.getGridOptionsTooltipDelay("tooltipHideDelay");
  }
  destroy() {
    this.setToDoNothing(), super.destroy();
  }
  getTooltipTrigger() {
    const e = this.gos.get("tooltipTrigger");
    return !e || e === "hover" ? 0 : 1;
  }
  onMouseEnter(e) {
    this.interactionEnabled && this.interactiveTooltipTimeoutId && (this.unlockService(), this.startHideTimeout()), !Xs() && (Gn ? this.showTooltipTimeoutId = window.setTimeout(() => {
      this.prepareToShowTooltip(e);
    }, Ph) : this.prepareToShowTooltip(e));
  }
  onMouseMove(e) {
    this.lastMouseEvent && (this.lastMouseEvent = e), this.tooltipMouseTrack && this.state === 2 && this.tooltipComp && this.positionTooltip();
  }
  onMouseDown() {
    this.setToDoNothing();
  }
  onMouseLeave() {
    this.interactionEnabled ? this.lockService() : this.setToDoNothing();
  }
  onFocusIn() {
    this.prepareToShowTooltip();
  }
  onFocusOut(e) {
    var r;
    const t = e.relatedTarget, s = this.tooltipCtrl.getGui(), i = (r = this.tooltipComp) == null ? void 0 : r.getGui();
    this.isInteractingWithTooltip || s.contains(t) || this.interactionEnabled && (i != null && i.contains(t)) || this.setToDoNothing();
  }
  onKeyDown() {
    this.isInteractingWithTooltip && (this.isInteractingWithTooltip = !1), this.setToDoNothing();
  }
  prepareToShowTooltip(e) {
    if (this.state != 0 || Gn)
      return;
    let t = 0;
    e && (t = this.isLastTooltipHiddenRecently() ? 200 : this.getTooltipDelay("show")), this.lastMouseEvent = e || null, this.showTooltipTimeoutId = window.setTimeout(this.showTooltip.bind(this), t), this.state = 1;
  }
  isLastTooltipHiddenRecently() {
    return Date.now() - Eh < Zy;
  }
  setToDoNothing(e) {
    !e && this.state === 2 && this.hideTooltip(), this.onBodyScrollEventCallback && (this.onBodyScrollEventCallback(), this.onBodyScrollEventCallback = void 0), this.clearEventHandlers(), this.onDocumentKeyDownCallback && (this.onDocumentKeyDownCallback(), this.onDocumentKeyDownCallback = void 0), this.clearTimeouts(), this.state = 0, this.lastMouseEvent = null;
  }
  showTooltip() {
    var r, n;
    const e = this.getTooltipValue(), t = this.tooltipCtrl;
    if (!A(e) || t.shouldDisplayTooltip && !t.shouldDisplayTooltip()) {
      this.setToDoNothing();
      return;
    }
    const s = this.gos.addCommon({
      location: ((r = t.getLocation) == null ? void 0 : r.call(t)) ?? "UNKNOWN",
      value: e,
      hideTooltipCallback: () => this.hideTooltip(!0),
      ...(n = t.getAdditionalParams) == null ? void 0 : n.call(t)
    });
    this.state = 2, this.tooltipInstanceCount++;
    const i = this.newTooltipComponentCallback.bind(this, this.tooltipInstanceCount);
    this.createTooltipComp(s, i);
  }
  hideTooltip(e) {
    !e && this.isInteractingWithTooltip || (this.tooltipComp && (this.destroyTooltipComp(), Eh = Date.now()), this.eventSvc.dispatchEvent({
      type: "tooltipHide",
      parentGui: this.tooltipCtrl.getGui()
    }), e && (this.isInteractingWithTooltip = !1), this.setToDoNothing(!0));
  }
  newTooltipComponentCallback(e, t) {
    var o;
    if (this.state !== 2 || this.tooltipInstanceCount !== e) {
      this.destroyBean(t);
      return;
    }
    const i = t.getGui();
    this.tooltipComp = t, i.classList.contains("ag-tooltip") || i.classList.add("ag-tooltip-custom"), this.tooltipTrigger === 0 && i.classList.add("ag-tooltip-animate"), this.interactionEnabled && i.classList.add("ag-tooltip-interactive");
    const r = this.getLocaleTextFunc(), n = (o = this.popupSvc) == null ? void 0 : o.addPopup({
      eChild: i,
      ariaLabel: r("ariaLabelTooltip", "Tooltip")
    });
    if (n && (this.tooltipPopupDestroyFunc = n.hideFunc), this.positionTooltip(), this.tooltipTrigger === 1) {
      const a = () => this.setToDoNothing();
      [this.onBodyScrollEventCallback] = this.addManagedEventListeners({
        bodyScroll: a
      }), this.setEventHandlers(a);
    }
    this.interactionEnabled && ([this.tooltipMouseEnterListener, this.tooltipMouseLeaveListener] = this.addManagedElementListeners(i, {
      mouseenter: this.onTooltipMouseEnter.bind(this),
      mouseleave: this.onTooltipMouseLeave.bind(this)
    }), [this.onDocumentKeyDownCallback] = this.addManagedElementListeners(me(this.beans), {
      keydown: (a) => {
        i.contains(a == null ? void 0 : a.target) || this.onKeyDown();
      }
    }), this.tooltipTrigger === 1 && ([this.tooltipFocusInListener, this.tooltipFocusOutListener] = this.addManagedElementListeners(i, {
      focusin: this.onTooltipFocusIn.bind(this),
      focusout: this.onTooltipFocusOut.bind(this)
    }))), this.eventSvc.dispatchEvent({
      type: "tooltipShow",
      tooltipGui: i,
      parentGui: this.tooltipCtrl.getGui()
    }), this.startHideTimeout();
  }
  onTooltipMouseEnter() {
    this.isInteractingWithTooltip = !0, this.unlockService();
  }
  onTooltipMouseLeave() {
    this.isTooltipFocused() || (this.isInteractingWithTooltip = !1, this.lockService());
  }
  onTooltipFocusIn() {
    this.isInteractingWithTooltip = !0;
  }
  isTooltipFocused() {
    var s;
    const e = (s = this.tooltipComp) == null ? void 0 : s.getGui(), t = Q(this.beans);
    return !!e && e.contains(t);
  }
  onTooltipFocusOut(e) {
    const t = this.tooltipCtrl.getGui();
    this.isTooltipFocused() || (this.isInteractingWithTooltip = !1, t.contains(e.relatedTarget) ? this.startHideTimeout() : this.hideTooltip());
  }
  positionTooltip() {
    var t, s;
    const e = {
      type: "tooltip",
      ePopup: this.tooltipComp.getGui(),
      nudgeY: 18,
      skipObserver: this.tooltipMouseTrack
    };
    this.lastMouseEvent ? (t = this.popupSvc) == null || t.positionPopupUnderMouseEvent({
      ...e,
      mouseEvent: this.lastMouseEvent
    }) : (s = this.popupSvc) == null || s.positionPopupByComponent({
      ...e,
      eventSource: this.tooltipCtrl.getGui(),
      position: "under",
      keepWithinBounds: !0,
      nudgeY: 5
    });
  }
  destroyTooltipComp() {
    this.tooltipComp.getGui().classList.add("ag-tooltip-hiding");
    const e = this.tooltipPopupDestroyFunc, t = this.tooltipComp, s = this.tooltipTrigger === 0 ? Qy : 0;
    window.setTimeout(() => {
      e(), this.destroyBean(t);
    }, s), this.clearTooltipListeners(), this.tooltipPopupDestroyFunc = void 0, this.tooltipComp = void 0;
  }
  clearTooltipListeners() {
    [
      this.tooltipMouseEnterListener,
      this.tooltipMouseLeaveListener,
      this.tooltipFocusInListener,
      this.tooltipFocusOutListener
    ].forEach((e) => {
      e && e();
    }), this.tooltipMouseEnterListener = this.tooltipMouseLeaveListener = this.tooltipFocusInListener = this.tooltipFocusOutListener = null;
  }
  lockService() {
    Gn = !0, this.interactiveTooltipTimeoutId = window.setTimeout(() => {
      this.unlockService(), this.setToDoNothing();
    }, Ph);
  }
  unlockService() {
    Gn = !1, this.clearInteractiveTimeout();
  }
  startHideTimeout() {
    this.clearHideTimeout(), this.hideTooltipTimeoutId = window.setTimeout(this.hideTooltip.bind(this), this.getTooltipDelay("hide"));
  }
  clearShowTimeout() {
    this.showTooltipTimeoutId && (window.clearTimeout(this.showTooltipTimeoutId), this.showTooltipTimeoutId = void 0);
  }
  clearHideTimeout() {
    this.hideTooltipTimeoutId && (window.clearTimeout(this.hideTooltipTimeoutId), this.hideTooltipTimeoutId = void 0);
  }
  clearInteractiveTimeout() {
    this.interactiveTooltipTimeoutId && (window.clearTimeout(this.interactiveTooltipTimeoutId), this.interactiveTooltipTimeoutId = void 0);
  }
  clearTimeouts() {
    this.clearShowTimeout(), this.clearHideTimeout(), this.clearInteractiveTimeout();
  }
}, eS = class extends Kp {
  constructor(e, t, s) {
    super(e, s), this.highlightTracker = t, this.onHighlight = this.onHighlight.bind(this);
  }
  postConstruct() {
    super.postConstruct(), this.wireHighlightListeners();
  }
  wireHighlightListeners() {
    this.addManagedPropertyListener("tooltipTrigger", ({ currentValue: e }) => {
      this.setTooltipMode(e);
    }), this.setTooltipMode(this.gos.get("tooltipTrigger")), this.highlightTracker.addEventListener("itemHighlighted", this.onHighlight);
  }
  onHighlight(e) {
    this.tooltipMode === 1 && (e.highlighted ? this.attemptToShowTooltip() : this.attemptToHideTooltip());
  }
  setTooltipMode(e = "focus") {
    this.tooltipMode = e === "focus" ? 1 : 0;
  }
  destroy() {
    this.highlightTracker.removeEventListener("itemHighlighted", this.onHighlight), super.destroy();
  }
}, On = 0, tS = 200, sS = class extends as {
  constructor() {
    super(...arguments), this.beanName = "popupSvc", this.popupList = [];
  }
  getPopupParent() {
    const e = this.gos.get("popupParent");
    return e || this.getDefaultPopupParent();
  }
  positionPopupUnderMouseEvent(e) {
    const { ePopup: t, nudgeX: s, nudgeY: i, skipObserver: r } = e;
    this.positionPopup({
      ePopup: t,
      nudgeX: s,
      nudgeY: i,
      keepWithinBounds: !0,
      skipObserver: r,
      updatePosition: () => this.calculatePointerAlign(e.mouseEvent),
      postProcessCallback: () => this.callPostProcessPopup(e, e.type, e.ePopup, null, e.mouseEvent)
    });
  }
  calculatePointerAlign(e) {
    const t = this.getParentRect();
    return {
      x: e.clientX - t.left,
      y: e.clientY - t.top
    };
  }
  positionPopupByComponent(e) {
    const {
      ePopup: t,
      nudgeX: s,
      nudgeY: i,
      keepWithinBounds: r,
      eventSource: n,
      alignSide: o = "left",
      position: a = "over",
      type: l
    } = e, c = n.getBoundingClientRect(), d = this.getParentRect();
    this.setAlignedTo(n, t);
    const h = () => {
      let u = c.left - d.left;
      o === "right" && (u -= t.offsetWidth - c.width);
      let g;
      return a === "over" ? (g = c.top - d.top, this.setAlignedStyles(t, "over")) : (this.setAlignedStyles(t, "under"), this.shouldRenderUnderOrAbove(t, c, d, e.nudgeY || 0) === "under" ? g = c.top - d.top + c.height : g = c.top - t.offsetHeight - (i || 0) * 2 - d.top), { x: u, y: g };
    };
    this.positionPopup({
      ePopup: t,
      nudgeX: s,
      nudgeY: i,
      keepWithinBounds: r,
      updatePosition: h,
      postProcessCallback: () => this.callPostProcessPopup(e, l, t, n, null)
    });
  }
  shouldRenderUnderOrAbove(e, t, s, i) {
    const r = s.bottom - t.bottom, n = t.top - s.top, o = e.offsetHeight + i;
    return r > o ? "under" : n > o || n > r ? "above" : "under";
  }
  setAlignedStyles(e, t) {
    const s = this.getPopupIndex(e);
    if (s === -1)
      return;
    const i = this.popupList[s], { alignedToElement: r } = i;
    !r || (["right", "left", "over", "above", "under"].forEach((o) => {
      r.classList.remove(`ag-has-popup-positioned-${o}`), e.classList.remove(`ag-popup-positioned-${o}`);
    }), !t) || (r.classList.add(`ag-has-popup-positioned-${t}`), e.classList.add(`ag-popup-positioned-${t}`));
  }
  setAlignedTo(e, t) {
    const s = this.getPopupIndex(t);
    if (s !== -1) {
      const i = this.popupList[s];
      i.alignedToElement = e;
    }
  }
  positionPopup(e) {
    const { ePopup: t, keepWithinBounds: s, nudgeX: i, nudgeY: r, skipObserver: n, updatePosition: o } = e, a = { width: 0, height: 0 }, l = (c = !1) => {
      let { x: d, y: h } = o();
      c && t.clientWidth === a.width && t.clientHeight === a.height || (a.width = t.clientWidth, a.height = t.clientHeight, i && (d += i), r && (h += r), s && (d = this.keepXYWithinBounds(
        t,
        d,
        1
        /* Horizontal */
      ), h = this.keepXYWithinBounds(
        t,
        h,
        0
        /* Vertical */
      )), t.style.left = `${d}px`, t.style.top = `${h}px`, e.postProcessCallback && e.postProcessCallback());
    };
    if (l(), !n) {
      const c = os(this.beans, t, () => l(!0));
      setTimeout(() => c(), tS);
    }
  }
  getParentRect() {
    const e = me(this.beans);
    let t = this.getPopupParent();
    return t === e.body ? t = e.documentElement : getComputedStyle(t).position === "static" && (t = t.offsetParent), Gg(t);
  }
  keepXYWithinBounds(e, t, s) {
    const i = s === 0, r = i ? "clientHeight" : "clientWidth", n = i ? "top" : "left", o = i ? "height" : "width", a = i ? "scrollTop" : "scrollLeft", l = me(this.beans), c = l.documentElement, d = this.getPopupParent(), h = e.getBoundingClientRect(), u = d.getBoundingClientRect(), g = l.documentElement.getBoundingClientRect(), p = d === l.body, f = Math.ceil(h[o]);
    let C = p ? (i ? ra : Ri)(c) + c[a] : d[r];
    p && (C -= Math.abs(g[n] - u[n]));
    const v = C - f;
    return Math.min(Math.max(t, 0), Math.abs(v));
  }
  addPopup(e) {
    const { eChild: t, ariaLabel: s, ariaOwns: i, alwaysOnTop: r, positionCallback: n, anchorToElement: o } = e, a = this.getPopupIndex(t);
    if (a !== -1)
      return { hideFunc: this.popupList[a].hideFunc };
    this.initialisePopupPosition(t);
    const l = this.createPopupWrapper(t, !!r, s, i), c = this.addEventListenersToPopup({ ...e, wrapperEl: l });
    return n && n(), this.addPopupToPopupList(t, l, c, o), {
      hideFunc: c
    };
  }
  initialisePopupPosition(e) {
    const s = this.getPopupParent().getBoundingClientRect();
    A(e.style.top) || (e.style.top = `${s.top * -1}px`), A(e.style.left) || (e.style.left = `${s.left * -1}px`);
  }
  createPopupWrapper(e, t, s, i) {
    const r = this.getPopupParent(), { environment: n, gos: o } = this.beans, a = mn({ tag: "div" });
    return n.applyThemeClasses(a), a.classList.add("ag-popup"), e.classList.add(o.get("enableRtl") ? "ag-rtl" : "ag-ltr", "ag-popup-child"), e.hasAttribute("role") || Ye(e, "dialog"), s ? re(e, s) : i && (e.id || (e.id = `popup-component-${On}`), hh(i, e.id)), a.appendChild(e), r.appendChild(a), t ? this.setAlwaysOnTop(e, !0) : this.bringPopupToFront(e), a;
  }
  addEventListenersToPopup(e) {
    const t = this.beans, s = me(t), i = this.getPopupParent(), { wrapperEl: r, eChild: n, closedCallback: o, afterGuiAttached: a, closeOnEsc: l, modal: c, ariaOwns: d } = e;
    let h = !1;
    const u = (m) => {
      if (!r.contains(Q(t)))
        return;
      m.key === S.ESCAPE && !this.isStopPropagation(m) && f({ keyboardEvent: m });
    }, g = (m) => f({ mouseEvent: m }), p = (m) => f({ touchEvent: m }), f = (m = {}) => {
      const { mouseEvent: C, touchEvent: v, keyboardEvent: w, forceHide: b } = m;
      !b && // we don't hide popup if the event was on the child, or any
      // children of this child
      (this.isEventFromCurrentPopup({ mouseEvent: C, touchEvent: v }, n) || // this method should only be called once. the client can have different
      // paths, each one wanting to close, so this method may be called multiple times.
      h) || (h = !0, i.removeChild(r), s.removeEventListener("keydown", u), s.removeEventListener("mousedown", g), s.removeEventListener("touchstart", p), s.removeEventListener("contextmenu", g), this.eventSvc.removeListener("dragStarted", g), o && o(C || v || w), this.removePopupFromPopupList(n, d));
    };
    return a && a({ hidePopup: f }), window.setTimeout(() => {
      l && s.addEventListener("keydown", u), c && (s.addEventListener("mousedown", g), this.eventSvc.addListener("dragStarted", g), s.addEventListener("touchstart", p), s.addEventListener("contextmenu", g));
    }, 0), f;
  }
  addPopupToPopupList(e, t, s, i) {
    this.popupList.push({
      element: e,
      wrapper: t,
      hideFunc: s,
      instanceId: On,
      isAnchored: !!i
    }), i && this.setPopupPositionRelatedToElement(e, i), On = On + 1;
  }
  getPopupIndex(e) {
    return this.popupList.findIndex((t) => t.element === e);
  }
  setPopupPositionRelatedToElement(e, t) {
    const s = this.getPopupIndex(e);
    if (s === -1)
      return;
    const i = this.popupList[s];
    if (i.stopAnchoringPromise && i.stopAnchoringPromise.then((n) => n && n()), i.stopAnchoringPromise = void 0, i.isAnchored = !1, !t)
      return;
    const r = this.keepPopupPositionedRelativeTo({
      element: t,
      ePopup: e,
      hidePopup: i.hideFunc
    });
    return i.stopAnchoringPromise = r, i.isAnchored = !0, r;
  }
  removePopupFromPopupList(e, t) {
    this.setAlignedStyles(e, null), this.setPopupPositionRelatedToElement(e, null), t && hh(t, null), this.popupList = this.popupList.filter((s) => s.element !== e);
  }
  keepPopupPositionedRelativeTo(e) {
    const t = this.getPopupParent(), s = t.getBoundingClientRect(), { element: i, ePopup: r } = e, n = i.getBoundingClientRect(), o = (h) => parseInt(h.substring(0, h.length - 1), 10), a = (h, u) => {
      const g = s[h] - n[h], p = o(r.style[h]);
      return {
        initialDiff: g,
        lastDiff: g,
        initial: p,
        last: p,
        direction: u
      };
    }, l = a(
      "top",
      0
      /* Vertical */
    ), c = a(
      "left",
      1
      /* Horizontal */
    ), d = this.beans.frameworkOverrides;
    return new U((h) => {
      d.wrapIncoming(() => {
        fb(() => {
          const u = t.getBoundingClientRect(), g = i.getBoundingClientRect();
          if (g.top == 0 && g.left == 0 && g.height == 0 && g.width == 0) {
            e.hidePopup();
            return;
          }
          const f = (m, C) => {
            const v = o(r.style[C]);
            m.last !== v && (m.initial = v, m.last = v);
            const w = u[C] - g[C];
            if (w != m.lastDiff) {
              const b = this.keepXYWithinBounds(
                r,
                m.initial + m.initialDiff - w,
                m.direction
              );
              r.style[C] = `${b}px`, m.last = b;
            }
            m.lastDiff = w;
          };
          f(l, "top"), f(c, "left");
        }, 200).then((u) => {
          h(() => {
            u != null && window.clearInterval(u);
          });
        });
      }, "popupPositioning");
    });
  }
  isEventFromCurrentPopup(e, t) {
    const { mouseEvent: s, touchEvent: i } = e, r = s || i;
    if (!r)
      return !1;
    const n = this.getPopupIndex(t);
    if (n === -1)
      return !1;
    for (let o = n; o < this.popupList.length; o++) {
      const a = this.popupList[o];
      if (Vl(a.element, r))
        return !0;
    }
    return this.isElementWithinCustomPopup(r.target);
  }
  isElementWithinCustomPopup(e) {
    const t = me(this.beans);
    for (; e && e !== t.body; ) {
      if (e.classList.contains("ag-custom-component-popup") || e.parentElement === null)
        return !0;
      e = e.parentElement;
    }
    return !1;
  }
  getWrapper(e) {
    for (; !e.classList.contains("ag-popup") && e.parentElement; )
      e = e.parentElement;
    return e.classList.contains("ag-popup") ? e : null;
  }
  setAlwaysOnTop(e, t) {
    const s = this.getWrapper(e);
    s && (s.classList.toggle("ag-always-on-top", !!t), t && this.bringPopupToFront(s));
  }
  /** @returns true if moved */
  bringPopupToFront(e) {
    const t = this.getPopupParent(), s = Array.prototype.slice.call(t.querySelectorAll(".ag-popup")), i = s.length, r = this.getWrapper(e);
    if (!r || i <= 1 || !t.contains(e))
      return;
    const n = [], o = [];
    for (const u of s)
      u !== r && (u.classList.contains("ag-always-on-top") ? o.push(u) : n.push(u));
    const a = [], l = o.length, h = r.classList.contains("ag-always-on-top") || !l ? [...n, ...o, r] : [...n, r, ...o];
    for (let u = 0; u <= i; u++) {
      const g = h[u];
      if (s[u] === h[u] || g === r)
        continue;
      g.querySelectorAll("div").forEach((f) => {
        f.scrollTop !== 0 && a.push([f, f.scrollTop]);
      }), u === 0 ? t.insertAdjacentElement("afterbegin", g) : h[u - 1].insertAdjacentElement("afterend", g);
    }
    for (; a.length; ) {
      const u = a.pop();
      u[0].scrollTop = u[1];
    }
  }
}, iS = class extends ha {
  constructor() {
    super({ tag: "div", cls: "ag-tooltip" });
  }
  // will need to type params
  init(e) {
    const { value: t } = e, s = this.getGui();
    s.textContent = Nt(t);
    const i = e.location.replace(/([a-z])([A-Z0-9])/g, "$1-$2").toLowerCase();
    s.classList.add(`ag-${i}-tooltip`);
  }
}, rS = class extends as {
  constructor() {
    super(...arguments), this.beanName = "dragSvc", this.dragEndFunctions = [], this.dragSources = [];
  }
  destroy() {
    const { dragSources: e } = this;
    e.forEach(this.removeListener.bind(this)), e.length = 0, super.destroy();
  }
  removeListener(e) {
    const t = e.dragSource.eElement, s = e.mouseDownListener;
    if (t.removeEventListener("mousedown", s), e.touchEnabled) {
      const i = e.touchStartListener;
      t.removeEventListener("touchstart", i, { passive: !0 });
    }
  }
  removeDragSource(e) {
    const { dragSources: t } = this, s = t.find((i) => i.dragSource === e);
    s && (this.removeListener(s), be(t, s));
  }
  addDragSource(e) {
    const t = this.onMouseDown.bind(this, e), { eElement: s, includeTouch: i, stopPropagationForTouch: r } = e;
    s.addEventListener("mousedown", t);
    let n = null;
    const o = this.gos.get("suppressTouch");
    i && !o && (n = (a) => {
      Gc(a.target) || (r && a.stopPropagation(), this.onTouchStart(e, a));
    }, s.addEventListener("touchstart", n, { passive: !1 })), this.dragSources.push({
      dragSource: e,
      mouseDownListener: t,
      touchStartListener: n,
      touchEnabled: !!i
    });
  }
  // gets called whenever mouse down on any drag source
  onTouchStart(e, t) {
    this.currentDragParams = e, this.dragging = !1;
    const s = t.touches[0];
    this.touchLastTime = s, this.touchStart = s;
    const i = (l) => this.onTouchMove(l, e.eElement), r = (l) => this.onTouchUp(l, e.eElement), n = (l) => {
      l.cancelable && l.preventDefault();
    }, o = t.target, a = [
      // Prevents the page document from moving while we are dragging items around.
      // preventDefault needs to be called in the touchmove listener and never inside the
      // touchstart, because using touchstart causes the click event to be cancelled on touch devices.
      {
        target: xi(this.beans),
        type: "touchmove",
        listener: n,
        options: { passive: !1 }
      },
      { target: o, type: "touchmove", listener: i, options: { passive: !0 } },
      { target: o, type: "touchend", listener: r, options: { passive: !0 } },
      { target: o, type: "touchcancel", listener: r, options: { passive: !0 } }
    ];
    this.addTemporaryEvents(a), e.dragStartPixels === 0 && this.onCommonMove(s, this.touchStart, e.eElement);
  }
  // gets called whenever mouse down on any drag source
  onMouseDown(e, t) {
    const s = t;
    if (e.skipMouseEvent && e.skipMouseEvent(t) || s._alreadyProcessedByDragService || (s._alreadyProcessedByDragService = !0, t.button !== 0))
      return;
    this.shouldPreventMouseEvent(t) && t.preventDefault(), this.currentDragParams = e, this.dragging = !1, this.mouseStartEvent = t, this.startTarget = t.target;
    const i = (c) => this.onMouseMove(c, e.eElement), r = (c) => this.onMouseUp(c, e.eElement), n = (c) => c.preventDefault(), o = (c) => {
      c.key === S.ESCAPE && this.cancelDrag(e.eElement);
    }, a = xi(this.beans), l = [
      { target: a, type: "mousemove", listener: i },
      { target: a, type: "mouseup", listener: r },
      { target: a, type: "contextmenu", listener: n },
      { target: a, type: "keydown", listener: o }
    ];
    this.addTemporaryEvents(l), e.dragStartPixels === 0 && this.onMouseMove(t, e.eElement);
  }
  addTemporaryEvents(e) {
    e.forEach((t) => {
      const { target: s, type: i, listener: r, options: n } = t;
      s.addEventListener(i, r, n);
    }), this.dragEndFunctions.push(() => {
      e.forEach((t) => {
        const { target: s, type: i, listener: r, options: n } = t;
        s.removeEventListener(i, r, n);
      });
    });
  }
  // returns true if the event is close to the original event by X pixels either vertically or horizontally.
  // we only start dragging after X pixels so this allows us to know if we should start dragging yet.
  isEventNearStartEvent(e, t) {
    const { dragStartPixels: s } = this.currentDragParams, i = A(s) ? s : 4;
    return Wg(e, t, i);
  }
  getFirstActiveTouch(e) {
    for (let t = 0; t < e.length; t++)
      if (e[t].identifier === this.touchStart.identifier)
        return e[t];
    return null;
  }
  onCommonMove(e, t, s) {
    var i;
    if (!this.dragging) {
      if (this.isEventNearStartEvent(e, t))
        return;
      if (this.dragging = !0, this.eventSvc.dispatchEvent({
        type: "dragStarted",
        target: s
      }), this.currentDragParams.onDragStart(t), !this.currentDragParams) {
        this.dragging = !1;
        return;
      }
      this.currentDragParams.onDragging(t);
    }
    (i = this.currentDragParams) == null || i.onDragging(e);
  }
  onTouchMove(e, t) {
    const s = this.getFirstActiveTouch(e.touches);
    s && this.onCommonMove(s, this.touchStart, t);
  }
  // only gets called after a mouse down - as this is only added after mouseDown
  // and is removed when mouseUp happens
  onMouseMove(e, t) {
    var s;
    As() && ((s = me(this.beans).getSelection()) == null || s.removeAllRanges()), this.shouldPreventMouseEvent(e) && e.preventDefault(), this.onCommonMove(e, this.mouseStartEvent, t);
  }
  shouldPreventMouseEvent(e) {
    const t = e.type === "mousemove", s = (i) => {
      const r = i.target, n = r == null ? void 0 : r.tagName.toLocaleLowerCase();
      return !!(n != null && n.match("^a$|textarea|input|select|button"));
    };
    return t && e.cancelable && tn(this.beans, e) && !s(e);
  }
  onTouchUp(e, t) {
    let s = this.getFirstActiveTouch(e.changedTouches);
    s || (s = this.touchLastTime), this.onUpCommon(s, t);
  }
  onMouseUp(e, t) {
    this.onUpCommon(e, t);
  }
  onUpCommon(e, t) {
    this.dragging && (this.dragging = !1, this.currentDragParams.onDragStop(e), this.eventSvc.dispatchEvent({
      type: "dragStopped",
      target: t
    })), this.resetDragProperties();
  }
  cancelDrag(e) {
    var t, s;
    this.eventSvc.dispatchEvent({
      type: "dragCancelled",
      target: e
    }), (s = (t = this.currentDragParams) == null ? void 0 : t.onDragCancel) == null || s.call(t), this.resetDragProperties();
  }
  resetDragProperties() {
    this.mouseStartEvent = null, this.startTarget = null, this.touchStart = null, this.touchLastTime = null, this.currentDragParams = null;
    const { dragEndFunctions: e } = this;
    e.forEach((t) => t()), e.length = 0;
  }
}, nS = class extends as {
  constructor() {
    super(...arguments), this.beanName = "dragAndDrop", this.dragSourceAndParamsList = [], this.dragItem = null, this.lastMouseEvent = null, this.lastDraggingEvent = null, this.dragSource = null, this.dragImageParent = null, this.dragImageCompPromise = null, this.dragImageComp = null, this.dragImageLastIcon = void 0, this.dragImageLastLabel = void 0, this.dropTargets = [], this.lastDropTarget = null;
  }
  addDragSource(e, t = !1) {
    const s = {
      dragSource: e,
      eElement: e.eElement,
      dragStartPixels: e.dragStartPixels,
      onDragStart: (i) => this.onDragStart(e, i),
      onDragStop: this.onDragStop.bind(this),
      onDragging: this.onDragging.bind(this),
      onDragCancel: this.onDragCancel.bind(this),
      includeTouch: t
    };
    this.dragSourceAndParamsList.push(s), this.beans.dragSvc.addDragSource(s);
  }
  setDragImageCompIcon(e, t = !1) {
    const s = this.dragImageComp;
    s && (t || this.dragImageLastIcon !== e) && (this.dragImageLastIcon = e, s.setIcon(e, t));
  }
  removeDragSource(e) {
    var r;
    const { dragSourceAndParamsList: t, beans: s } = this, i = t.find((n) => n.dragSource === e);
    i && ((r = s.dragSvc) == null || r.removeDragSource(i), be(t, i));
  }
  destroy() {
    const { dragSourceAndParamsList: e, dropTargets: t, beans: s } = this, i = s.dragSvc;
    for (const r of e)
      i == null || i.removeDragSource(r);
    e.length = 0, t.length = 0, this.clearDragAndDropProperties(), super.destroy();
  }
  nudge() {
    const e = this.lastMouseEvent;
    e && this.onDragging(e, !0);
  }
  onDragStart(e, t) {
    var s;
    this.lastMouseEvent = t, this.dragSource = e, this.dragItem = e.getDragItem(), (s = e.onDragStarted) == null || s.call(e), this.createAndUpdateDragImageComp(e);
  }
  onDragStop(e) {
    var i, r;
    const { dragSource: t, lastDropTarget: s } = this;
    if ((i = t == null ? void 0 : t.onDragStopped) == null || i.call(t), s) {
      const n = this.dropTargetEvent(s, e, !1);
      (r = s.onDragStop) == null || r.call(s, n);
    }
    this.clearDragAndDropProperties();
  }
  onDragCancel() {
    var i, r;
    const { dragSource: e, lastDropTarget: t, lastMouseEvent: s } = this;
    if ((i = e == null ? void 0 : e.onDragCancelled) == null || i.call(e), t && s) {
      const n = this.dropTargetEvent(t, s, !1);
      (r = t.onDragCancel) == null || r.call(t, n);
    }
    this.clearDragAndDropProperties();
  }
  onDragging(e, t = !1) {
    var a, l, c;
    this.positionDragImageComp(e);
    const s = this.findCurrentDropTarget(e), { lastDropTarget: i, dragSource: r, dragItem: n } = this;
    let o = !1;
    if (s !== i) {
      if (o = !0, i) {
        const d = this.dropTargetEvent(i, e, t);
        (a = i.onDragLeave) == null || a.call(i, d);
      }
      if (i !== null && !s ? this.handleExit(r, n) : i === null && s && this.handleEnter(r, n), s) {
        const d = this.dropTargetEvent(s, e, t);
        (l = s.onDragEnter) == null || l.call(s, d);
      }
      this.lastDropTarget = s;
    } else if (s) {
      const d = this.dropTargetEvent(s, e, t);
      (c = s.onDragging) == null || c.call(s, d), d != null && d.changed && (o = !0);
    }
    this.lastMouseEvent = e, o && this.updateDragImageComp();
  }
  clearDragAndDropProperties() {
    this.removeDragImageComp(this.dragImageComp), this.dragImageCompPromise = null, this.dragImageParent = null, this.dragImageLastIcon = void 0, this.dragImageLastLabel = void 0, this.lastMouseEvent = null, this.lastDraggingEvent = null, this.lastDropTarget = null, this.dragItem = null, this.dragSource = null;
  }
  getAllContainersFromDropTarget(e) {
    const t = e.getSecondaryContainers ? e.getSecondaryContainers() : null, s = [[e.getContainer()]];
    return t ? s.concat(t) : s;
  }
  // checks if the mouse is on the drop target. it checks eContainer and eSecondaryContainers
  isMouseOnDropTarget(e, t) {
    const s = this.getAllContainersFromDropTarget(t);
    let i = !1;
    const r = (a, l) => {
      for (const c of l) {
        const { width: d, height: h, left: u, right: g, top: p, bottom: f } = c.getBoundingClientRect();
        if (d === 0 || h === 0)
          return !1;
        const m = a.clientX >= u && a.clientX < g, C = a.clientY >= p && a.clientY < f;
        if (!m || !C)
          return !1;
      }
      return !0;
    };
    for (const a of s)
      if (r(e, a)) {
        i = !0;
        break;
      }
    const { eElement: n, type: o } = this.dragSource;
    return t.targetContainsSource && !t.getContainer().contains(n) ? !1 : i && t.isInterestedIn(o, n);
  }
  findCurrentDropTarget(e) {
    const t = this.dropTargets.filter((n) => this.isMouseOnDropTarget(e, n)), s = t.length;
    if (s === 0)
      return null;
    if (s === 1)
      return t[0];
    const r = xi(this.beans).elementsFromPoint(e.clientX, e.clientY);
    for (const n of r)
      for (const o of t)
        if (this.getAllContainersFromDropTarget(o).flatMap((l) => l).indexOf(n) !== -1)
          return o;
    return null;
  }
  addDropTarget(e) {
    this.dropTargets.push(e);
  }
  removeDropTarget(e) {
    this.dropTargets = this.dropTargets.filter((t) => t.getContainer() !== e.getContainer());
  }
  hasExternalDropZones() {
    return this.dropTargets.some((e) => e.external);
  }
  findExternalZone(e) {
    return this.dropTargets.find((t) => t.external && t.getContainer() === e) || null;
  }
  dropTargetEvent(e, t, s) {
    const { dragSource: i, dragItem: r, lastDraggingEvent: n, lastMouseEvent: o } = this, a = e.getContainer(), l = a.getBoundingClientRect(), { clientX: c, clientY: d } = t, h = c - ((o == null ? void 0 : o.clientX) || 0), u = d - ((o == null ? void 0 : o.clientY) || 0), g = this.createEvent({
      event: t,
      x: c - l.left,
      // relative x
      y: d - l.top,
      // relative y
      vDirection: u > 0 ? "down" : u < 0 ? "up" : null,
      hDirection: h < 0 ? "left" : h > 0 ? "right" : null,
      dragSource: i,
      fromNudge: s,
      dragItem: r,
      dropZoneTarget: a,
      dropTarget: (n == null ? void 0 : n.dropTarget) ?? null,
      // updated by rowDragFeature
      changed: !!(n != null && n.changed)
    });
    return this.lastDraggingEvent = g, g;
  }
  positionDragImageComp(e) {
    var s;
    const t = (s = this.dragImageComp) == null ? void 0 : s.getGui();
    t && Bl(t, e, this.beans);
  }
  removeDragImageComp(e) {
    var t;
    if (this.dragImageComp === e && (this.dragImageComp = null), e) {
      const s = e.getGui();
      (t = this.dragImageParent) == null || t.removeChild(s), this.destroyBean(e);
    }
  }
  createAndUpdateDragImageComp(e) {
    const t = this.createDragImageComp(e) ?? null;
    this.dragImageCompPromise = t, t == null || t.then((s) => {
      if (t !== this.dragImageCompPromise || !this.lastMouseEvent || !this.isAlive()) {
        this.destroyBean(s);
        return;
      }
      this.dragImageCompPromise = null, this.dragImageLastIcon = void 0, this.dragImageLastLabel = void 0;
      const i = this.dragImageComp;
      i !== s && (this.dragImageComp = s, this.removeDragImageComp(i)), s && (this.appendDragImageComp(s), this.updateDragImageComp());
    });
  }
  appendDragImageComp(e) {
    const t = e.getGui(), s = t.style;
    s.setProperty("position", "absolute"), s.setProperty("z-index", "9999"), this.gos.setInstanceDomData(t), this.beans.environment.applyThemeClasses(t), s.top = "20px", s.left = "20px";
    const i = Xo(this.beans);
    this.dragImageParent = i, i ? i.appendChild(t) : this.warnNoBody();
  }
  updateDragImageComp() {
    var o;
    const { dragImageComp: e, dragSource: t, lastDropTarget: s, lastDraggingEvent: i, dragImageLastLabel: r } = this;
    if (!e)
      return;
    this.setDragImageCompIcon(((o = s == null ? void 0 : s.getIconName) == null ? void 0 : o.call(s, i)) ?? null);
    let n = t == null ? void 0 : t.dragItemName;
    typeof n == "function" && (n = n(i)), n || (n = ""), r !== n && (this.dragImageLastLabel = n, e.setLabel(n));
  }
}, zt = /* @__PURE__ */ ((e) => (e[e.ToolPanel = 0] = "ToolPanel", e[e.HeaderCell = 1] = "HeaderCell", e[e.RowDrag = 2] = "RowDrag", e[e.ChartPanel = 3] = "ChartPanel", e[e.AdvancedFilterBuilder = 4] = "AdvancedFilterBuilder", e))(zt || {}), oS = class extends nS {
  createEvent(e) {
    return V(this.gos, e);
  }
  createDragImageComp(e) {
    const { gos: t, beans: s } = this, i = Vb(
      s.userCompFactory,
      V(t, {
        dragSource: e
      })
    );
    return i == null ? void 0 : i.newAgStackInstance();
  }
  handleEnter(e, t) {
    var s;
    (s = e == null ? void 0 : e.onGridEnter) == null || s.call(e, t);
  }
  handleExit(e, t) {
    var s;
    (s = e == null ? void 0 : e.onGridExit) == null || s.call(e, t);
  }
  warnNoBody() {
    F(54);
  }
  isDropZoneWithinThisGrid(e) {
    return this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody.contains(e.dropZoneTarget);
  }
  registerGridDropTarget(e, t) {
    const s = {
      getContainer: e,
      isInterestedIn: (i) => i === 1 || i === 0,
      getIconName: () => "notAllowed"
    };
    this.addDropTarget(s), t.addDestroyFunc(() => this.removeDropTarget(s));
  }
};
function jp(e, t) {
  return e + "_" + t;
}
function we(e) {
  return e instanceof an;
}
var an = class extends R {
  constructor(e, t, s, i) {
    super(), this.providedColumnGroup = e, this.groupId = t, this.partId = s, this.pinned = i, this.isColumn = !1, this.displayedChildren = [], this.autoHeaderHeight = null, this.parent = null, this.colIdSanitised = bt(this.getUniqueId());
  }
  // as the user is adding and removing columns, the groups are recalculated.
  // this reset clears out all children, ready for children to be added again
  reset() {
    this.parent = null, this.children = null, this.displayedChildren = null;
  }
  getParent() {
    return this.parent;
  }
  getUniqueId() {
    return jp(this.groupId, this.partId);
  }
  isEmptyGroup() {
    return this.displayedChildren.length === 0;
  }
  isMoving() {
    const e = this.getProvidedColumnGroup().getLeafColumns();
    return !e || e.length === 0 ? !1 : e.every((t) => t.isMoving());
  }
  checkLeft() {
    if (this.displayedChildren.forEach((e) => {
      we(e) && e.checkLeft();
    }), this.displayedChildren.length > 0)
      if (this.gos.get("enableRtl")) {
        const t = _(this.displayedChildren).getLeft();
        this.setLeft(t);
      } else {
        const e = this.displayedChildren[0].getLeft();
        this.setLeft(e);
      }
    else
      this.setLeft(null);
  }
  getLeft() {
    return this.left;
  }
  getOldLeft() {
    return this.oldLeft;
  }
  setLeft(e) {
    this.oldLeft = this.left, this.left !== e && (this.left = e, this.dispatchLocalEvent({ type: "leftChanged" }));
  }
  getPinned() {
    return this.pinned;
  }
  getGroupId() {
    return this.groupId;
  }
  getPartId() {
    return this.partId;
  }
  getActualWidth() {
    var t;
    let e = 0;
    return (t = this.displayedChildren) == null || t.forEach((s) => {
      e += s.getActualWidth();
    }), e;
  }
  isResizable() {
    if (!this.displayedChildren)
      return !1;
    let e = !1;
    return this.displayedChildren.forEach((t) => {
      t.isResizable() && (e = !0);
    }), e;
  }
  getMinWidth() {
    let e = 0;
    return this.displayedChildren.forEach((t) => {
      e += t.getMinWidth();
    }), e;
  }
  addChild(e) {
    this.children || (this.children = []), this.children.push(e);
  }
  getDisplayedChildren() {
    return this.displayedChildren;
  }
  getLeafColumns() {
    const e = [];
    return this.addLeafColumns(e), e;
  }
  getDisplayedLeafColumns() {
    const e = [];
    return this.addDisplayedLeafColumns(e), e;
  }
  getDefinition() {
    return this.providedColumnGroup.getColGroupDef();
  }
  getColGroupDef() {
    return this.providedColumnGroup.getColGroupDef();
  }
  isPadding() {
    return this.providedColumnGroup.isPadding();
  }
  isExpandable() {
    return this.providedColumnGroup.isExpandable();
  }
  isExpanded() {
    return this.providedColumnGroup.isExpanded();
  }
  setExpanded(e) {
    this.providedColumnGroup.setExpanded(e);
  }
  isAutoHeaderHeight() {
    var e;
    return !!((e = this.getColGroupDef()) != null && e.autoHeaderHeight);
  }
  getAutoHeaderHeight() {
    return this.autoHeaderHeight;
  }
  /** Returns true if the header height has changed */
  setAutoHeaderHeight(e) {
    const t = e !== this.autoHeaderHeight;
    return this.autoHeaderHeight = e, t;
  }
  addDisplayedLeafColumns(e) {
    this.displayedChildren.forEach((t) => {
      ts(t) ? e.push(t) : we(t) && t.addDisplayedLeafColumns(e);
    });
  }
  addLeafColumns(e) {
    this.children.forEach((t) => {
      ts(t) ? e.push(t) : we(t) && t.addLeafColumns(e);
    });
  }
  getChildren() {
    return this.children;
  }
  getColumnGroupShow() {
    return this.providedColumnGroup.getColumnGroupShow();
  }
  getProvidedColumnGroup() {
    return this.providedColumnGroup;
  }
  getPaddingLevel() {
    const e = this.getParent();
    return !this.isPadding() || !e || !e.isPadding() ? 0 : 1 + e.getPaddingLevel();
  }
  calculateDisplayedColumns() {
    this.displayedChildren = [];
    let e = this;
    for (; e != null && e.isPadding(); )
      e = e.getParent();
    if (!(e ? e.getProvidedColumnGroup().isExpandable() : !1)) {
      this.displayedChildren = this.children, this.dispatchLocalEvent({ type: "displayedChildrenChanged" });
      return;
    }
    this.children.forEach((s) => {
      var n;
      if (we(s) && !((n = s.displayedChildren) != null && n.length))
        return;
      switch (s.getColumnGroupShow()) {
        case "open":
          e.getProvidedColumnGroup().isExpanded() && this.displayedChildren.push(s);
          break;
        case "closed":
          e.getProvidedColumnGroup().isExpanded() || this.displayedChildren.push(s);
          break;
        default:
          this.displayedChildren.push(s);
          break;
      }
    }), this.dispatchLocalEvent({ type: "displayedChildrenChanged" });
  }
}, ko = "row-group-", ad = "t-", ld = "b-", aS = 0, ft = class {
  constructor(e) {
    this.master = !1, this.detail = void 0, this.rowIndex = null, this.key = null, this.sourceRowIndex = -1, this.childrenMapped = null, this.treeParent = null, this.treeNodeFlags = 0, this.displayed = !1, this.rowTop = null, this.oldRowTop = null, this.selectable = !0, this.__objectId = aS++, this.alreadyRendered = !1, this.hovered = !1, this.__selected = !1, this.beans = e;
  }
  /**
   * Replaces the data on the `rowNode`. When this method is called, the grid refreshes the entire rendered row if it is displayed.
   */
  setData(e) {
    this.setDataCommon(e, !1);
  }
  // similar to setRowData, however it is expected that the data is the same data item. this
  // is intended to be used with Redux type stores, where the whole data can be changed. we are
  // guaranteed that the data is the same entity (so grid doesn't need to worry about the id of the
  // underlying data changing, hence doesn't need to worry about selection). the grid, upon receiving
  // dataChanged event, refreshes the cells rather than rip them all out (so user can show transitions).
  /**
   * Updates the data on the `rowNode`. When this method is called, the grid refreshes the entire rendered row if it is displayed.
   */
  updateData(e) {
    this.setDataCommon(e, !0);
  }
  setDataCommon(e, t) {
    var a, l, c;
    const { valueCache: s, eventSvc: i } = this.beans, r = this.data;
    this.data = e, s == null || s.onDataChanged(), this.updateDataOnDetailNode(), this.resetQuickFilterAggregateText();
    const n = this.createDataChangedEvent(e, r, t);
    if ((a = this.__localEventService) == null || a.dispatchEvent(n), this.sibling) {
      this.sibling.data = e;
      const d = this.sibling.createDataChangedEvent(e, r, t);
      (l = this.sibling.__localEventService) == null || l.dispatchEvent(d);
    }
    i.dispatchEvent({ type: "rowNodeDataChanged", node: this });
    const o = this.pinnedSibling;
    o && (o.data = e, (c = o.__localEventService) == null || c.dispatchEvent(
      o.createDataChangedEvent(e, r, t)
    ), i.dispatchEvent({ type: "rowNodeDataChanged", node: o }));
  }
  // when we are doing master / detail, the detail node is lazy created, but then kept around.
  // so if we show / hide the detail, the same detail rowNode is used. so we need to keep the data
  // in sync, otherwise expand/collapse of the detail would still show the old values.
  updateDataOnDetailNode() {
    this.detailNode && (this.detailNode.data = this.data);
  }
  createDataChangedEvent(e, t, s) {
    return {
      type: "dataChanged",
      node: this,
      oldData: t,
      newData: e,
      update: s
    };
  }
  getRowIndexString() {
    return this.rowIndex == null ? (j(13), null) : this.rowPinned === "top" ? ad + this.rowIndex : this.rowPinned === "bottom" ? ld + this.rowIndex : this.rowIndex.toString();
  }
  setDataAndId(e, t) {
    var o, a;
    const { selectionSvc: s } = this.beans, i = (o = s == null ? void 0 : s.createDaemonNode) == null ? void 0 : o.call(s, this), r = this.data;
    this.data = e, this.updateDataOnDetailNode(), this.setId(t), s && (s.updateRowSelectable(this), s.syncInRowNode(this, i));
    const n = this.createDataChangedEvent(e, r, !1);
    (a = this.__localEventService) == null || a.dispatchEvent(n);
  }
  setId(e) {
    var s;
    const t = es(this.beans.gos);
    if (t)
      if (this.data) {
        const i = ((s = this.parent) == null ? void 0 : s.getRoute()) ?? [];
        this.id = t({
          data: this.data,
          parentKeys: i.length > 0 ? i : void 0,
          level: this.level,
          rowPinned: this.rowPinned
        }), this.id.startsWith(ko) && j(14, {
          groupPrefix: ko
        });
      } else
        this.id = void 0;
    else
      this.id = e;
  }
  setRowTop(e) {
    this.oldRowTop = this.rowTop, this.rowTop !== e && (this.rowTop = e, this.dispatchRowEvent("topChanged"), this.setDisplayed(e !== null));
  }
  clearRowTopAndRowIndex() {
    this.oldRowTop = null, this.setRowTop(null), this.setRowIndex(null);
  }
  setHovered(e) {
    this.hovered = e;
  }
  isHovered() {
    return this.hovered;
  }
  /**
   * Sets the row height.
   * Call if you want to change the height initially assigned to the row.
   * After calling, you must call `api.onRowHeightChanged()` so the grid knows it needs to work out the placement of the rows. */
  setRowHeight(e, t = !1) {
    this.rowHeight = e, this.rowHeightEstimated = t, this.dispatchRowEvent("heightChanged");
  }
  setExpanded(e, t, s) {
    var i;
    (i = this.beans.expansionSvc) == null || i.setExpanded(this, e, t, s);
  }
  /**
   * Replaces the value on the `rowNode` for the specified column. When complete,
   * the grid refreshes the rendered cell on the required row only.
   * **Note**: This method only fires `onCellEditRequest` when the Grid is in **Read Only** mode.
   * **Note**: This method defers to EditModule if available and batches the edit when `fullRow` or `batchEdit` is enabled.
   *
   * @param colKey The column where the value should be updated
   * @param newValue The new value
   * @param eventSource The source of the event
   * @returns `true` if the value was changed, otherwise `false`.
   */
  setDataValue(e, t, s) {
    const { colModel: i, valueSvc: r, gos: n, editSvc: o } = this.beans, a = typeof e != "string" ? e : i.getCol(e) ?? i.getColDefCol(e);
    if (!a)
      return !1;
    const l = r.getValueForDisplay(a, this, void 0, void 0, "api").value;
    if (n.get("readOnlyEdit")) {
      const {
        beans: { eventSvc: h },
        data: u,
        rowIndex: g,
        rowPinned: p
      } = this;
      return h.dispatchEvent({
        type: "cellEditRequest",
        event: null,
        rowIndex: g,
        rowPinned: p,
        column: a,
        colDef: a.colDef,
        data: u,
        node: this,
        oldValue: l,
        newValue: t,
        value: t,
        source: s
      }), !1;
    }
    if (o && !o.committing) {
      const h = o.setDataValue({ rowNode: this, column: a }, t, s);
      if (h != null)
        return h;
    }
    const c = r.setValue(this, a, t, s);
    this.dispatchCellChangedEvent(a, t, l);
    const d = this.pinnedSibling;
    return d && c && d.dispatchCellChangedEvent(a, t, l), c;
  }
  updateHasChildren() {
    let e = this.group && !this.footer || this.childrenAfterGroup && this.childrenAfterGroup.length > 0;
    const { rowChildrenSvc: t } = this.beans;
    t && (e = t.getHasChildrenValue(this)), e !== this.__hasChildren && (this.__hasChildren = !!e, this.dispatchRowEvent("hasChildrenChanged"));
  }
  hasChildren() {
    return this.__hasChildren == null && this.updateHasChildren(), this.__hasChildren;
  }
  dispatchCellChangedEvent(e, t, s) {
    var r;
    const i = {
      type: "cellChanged",
      node: this,
      column: e,
      newValue: t,
      oldValue: s
    };
    (r = this.__localEventService) == null || r.dispatchEvent(i);
  }
  /**
   * The first time `quickFilter` runs, the grid creates a one-off string representation of the row.
   * This string is then used for the quick filter instead of hitting each column separately.
   * When you edit, using grid editing, this string gets cleared down.
   * However, if you edit without using grid editing, you need to clear this string down for the row to be updated with the new values.
   * Otherwise, new values would not work with the `quickFilter`. */
  resetQuickFilterAggregateText() {
    this.quickFilterAggregateText = null;
  }
  /** Returns:
   * - `true` if the node can be expanded, i.e it is a group or master row.
   * - `false` if the node cannot be expanded
   */
  isExpandable() {
    var e;
    return ((e = this.beans.expansionSvc) == null ? void 0 : e.isExpandable(this)) ?? !1;
  }
  /** Returns:
   * - `true` if node is selected,
   * - `false` if the node isn't selected
   * - `undefined` if it's partially selected (group where not all children are selected). */
  isSelected() {
    return this.footer ? this.sibling.isSelected() : this.rowPinned && this.pinnedSibling ? this.pinnedSibling.isSelected() : this.__selected;
  }
  /** Perform a depth-first search of this node and its children. */
  depthFirstSearch(e) {
    var t;
    (t = this.childrenAfterGroup) == null || t.forEach((s) => s.depthFirstSearch(e)), e(this);
  }
  dispatchRowEvent(e) {
    var t;
    (t = this.__localEventService) == null || t.dispatchEvent({
      type: e,
      node: this
    });
  }
  /**
   * Select (or deselect) the node.
   * @param newValue -`true` for selection, `false` for deselection.
   * @param clearSelection - If selecting, then passing `true` selects the node exclusively (i.e. NOT do multi select). If doing deselection, `clearSelection` has no impact.
   * @param source - Source property that appears in the `selectionChanged` event.
   */
  setSelected(e, t = !1, s = "api") {
    var i;
    (i = this.beans.selectionSvc) == null || i.setNodesSelected({
      nodes: [this],
      newValue: e,
      clearSelection: t,
      source: s
    });
  }
  /**
   * Returns:
   * - `true` if node is either pinned to the `top` or `bottom`
   * - `false` if the node isn't pinned
   */
  isRowPinned() {
    return !!this.rowPinned;
  }
  __addEventListener(e, t) {
    this.__localEventService || (this.__localEventService = new Rs()), this.__localEventService.addEventListener(e, t);
  }
  __removeEventListener(e, t) {
    this.removeLocalListener(e, t);
  }
  /**
   * PUBLIC USE ONLY: for internal use within AG Grid use the `__addEventListener` and `__removeEventListener` methods.
   */
  addEventListener(e, t) {
    var i, r, n, o;
    (i = this.beans.validation) == null || i.checkRowEvents(e), this.__localEventService || (this.__localEventService = new Rs()), this.frameworkEventListenerService = (n = (r = this.beans.frameworkOverrides).createLocalEventListenerWrapper) == null ? void 0 : n.call(
      r,
      this.frameworkEventListenerService,
      this.__localEventService
    );
    const s = ((o = this.frameworkEventListenerService) == null ? void 0 : o.wrap(e, t)) ?? t;
    this.__localEventService.addEventListener(e, s);
  }
  /**
   * PUBLIC USE ONLY: for internal use within AG Grid use the `__addEventListener` and `__removeEventListener` methods.
   */
  removeEventListener(e, t) {
    var i;
    const s = ((i = this.frameworkEventListenerService) == null ? void 0 : i.unwrap(e, t)) ?? t;
    this.removeLocalListener(e, s);
  }
  removeLocalListener(e, t) {
    var s, i;
    (s = this.__localEventService) == null || s.removeEventListener(e, t), (i = this.__localEventService) != null && i.noRegisteredListenersExist() && (this.__localEventService = null);
  }
  /**
   * @deprecated v32.2.0 Check `node.detail` then user provided callback `isFullWidthRow` instead.
   *
   * Returns:
   * - `true` if the node is a full width cell
   * - `false` if the node is not a full width cell
   */
  isFullWidthCell() {
    if (F(61), this.detail)
      return !0;
    const e = this.beans.gos.getCallback("isFullWidthRow");
    return e ? e({ rowNode: this }) : !1;
  }
  /**
   * Returns the route of keys to the row node. Returns undefined if the node has no key.
   */
  getRoute() {
    if (this.level === -1)
      return [];
    if (this.key == null)
      return;
    const e = [];
    let t = this;
    for (; t && t.key != null; )
      e.push(t.key), t = t.parent;
    return e.reverse();
  }
  setDisplayed(e) {
    this.displayed !== e && (this.displayed = e, this.dispatchRowEvent("displayedChanged"));
  }
  setRowIndex(e) {
    this.rowIndex !== e && (this.rowIndex = e, this.dispatchRowEvent("rowIndexChanged"));
  }
  setAllChildrenCount(e) {
    this.allChildrenCount !== e && (this.allChildrenCount = e, this.dispatchRowEvent("allChildrenCountChanged"));
  }
  setUiLevel(e) {
    this.uiLevel !== e && (this.uiLevel = e, this.dispatchRowEvent("uiLevelChanged"));
  }
  getFirstChild() {
    var e;
    return this.childStore ? this.childStore.getFirstNode() : ((e = this.childrenAfterSort) == null ? void 0 : e[0]) ?? null;
  }
};
function Yp(e, t, s) {
  return V(t, {
    type: s,
    node: e,
    data: e.data,
    rowIndex: e.rowIndex,
    rowPinned: e.rowPinned
  });
}
var lS = /* @__PURE__ */ new Set(["__localEventService", "__objectId", "sticky", "__autoHeights", "__checkAutoHeightsDebounced", "childStore"]);
function qp(e, t) {
  const s = new ft(t);
  return Object.keys(e).forEach((i) => {
    lS.has(i) || (s[i] = e[i]);
  }), s.oldRowTop = null, s;
}
var Xp = {
  agSetColumnFilter: "agSetColumnFilterHandler",
  agMultiColumnFilter: "agMultiColumnFilterHandler",
  agGroupColumnFilter: "agGroupColumnFilterHandler",
  agNumberColumnFilter: "agNumberColumnFilterHandler",
  agDateColumnFilter: "agDateColumnFilterHandler",
  agTextColumnFilter: "agTextColumnFilterHandler"
}, cS = new Set(Object.values(Xp));
function ks(e, t) {
  const s = e.filterUi;
  if (!s)
    return null;
  if (s.created)
    return s.promise;
  if (t)
    return null;
  const i = s.create(s.refreshed), r = s;
  return r.created = !0, r.promise = i, i;
}
function Xl(e, t, s, i, r, n) {
  var o;
  return (o = t.refresh) == null || o.call(t, { ...s, model: i, source: n }), e().then((a) => {
    if (a) {
      const { filter: l, filterParams: c } = a;
      ma(l, c, i, r, n);
    }
  });
}
function ma(e, t, s, i, r) {
  var n;
  (n = e == null ? void 0 : e.refresh) == null || n.call(e, {
    ...t,
    model: s,
    state: i,
    source: r
  });
}
function Zp(e, t, s) {
  const i = e();
  i != null && i.created && i.promise.then((r) => {
    const n = t();
    ma(r, i.filterParams, n, s() ?? { model: n }, "ui");
  });
}
function Zl(e, t, s, i, r, n, o) {
  let a, l = !1, c;
  switch (e) {
    case "apply": {
      const d = i();
      c = (d == null ? void 0 : d.model) ?? null, o && (c = o(c)), a = {
        // keep the other UI state
        state: d == null ? void 0 : d.state,
        model: c
      }, l = !0;
      break;
    }
    case "clear": {
      a = {
        // wipe other UI state
        model: null
      };
      break;
    }
    case "reset": {
      a = {
        // wipe other UI state
        model: null
      }, l = !0, c = null;
      break;
    }
    case "cancel": {
      a = {
        // wipe other UI state
        model: s()
      };
      break;
    }
  }
  r(a), l ? n(c) : Zp(t, s, i);
}
function Pe(e, t) {
  return e[t] ?? null;
}
function K(e) {
  return mn(e);
}
function dS(e) {
  return {
    tag: "div",
    cls: e
  };
}
var Ca = class extends D {
  constructor(e) {
    const { className: t = "ag-filter-apply-panel" } = e ?? {};
    super(dS(t)), this.listeners = [], this.validationMessage = null, this.className = t;
  }
  updateButtons(e, t) {
    const s = this.buttons;
    if (this.buttons = e, s === e)
      return;
    const i = this.getGui();
    X(i);
    let r;
    this.destroyListeners();
    const n = document.createDocumentFragment(), o = this.className, a = ({ type: c, label: d }) => {
      const h = (C) => {
        this.dispatchLocalEvent({
          type: c,
          event: C
        });
      };
      ["apply", "clear", "reset", "cancel"].includes(c) || F(75);
      const u = c === "apply", p = K({
        tag: "button",
        attrs: { type: u && t ? "submit" : "button" },
        ref: `${c}FilterButton`,
        cls: `ag-button ag-standard-button ${o}-button${u ? " " + o + "-apply-button" : ""}`,
        children: d
      });
      this.activateTabIndex([p]), u && (r = p);
      const f = (C) => {
        C.key === S.ENTER && (C.preventDefault(), h(C));
      }, m = this.listeners;
      p.addEventListener("click", h), m.push(() => p.removeEventListener("click", h)), p.addEventListener("keydown", f), m.push(() => p.removeEventListener("keydown", f)), n.append(p);
    };
    e.forEach((c) => a(c)), this.eApply = r;
    const l = this.validationTooltipFeature;
    r && !l ? this.validationTooltipFeature = this.createOptionalManagedBean(
      this.beans.registry.createDynamicBean("tooltipFeature", !1, {
        getGui: () => this.eApply,
        getLocation: () => "advancedFilter",
        getTooltipShowDelayOverride: () => 1e3
      })
    ) : !r && l && (this.validationTooltipFeature = this.destroyBean(l)), i.append(n);
  }
  getApplyButton() {
    return this.eApply;
  }
  updateValidity(e, t = null) {
    var i;
    const s = this.eApply;
    s && (Fi(s, e === !1), this.validationMessage = t ?? null, (i = this.validationTooltipFeature) == null || i.setTooltipAndRefresh(this.validationMessage));
  }
  destroyListeners() {
    this.listeners.forEach((e) => e()), this.listeners = [];
  }
  destroy() {
    this.destroyListeners(), super.destroy();
  }
}, hS = {
  selector: "AG-FILTER-BUTTON",
  component: Ca
}, uS = {
  applyFilter: "Apply",
  clearFilter: "Clear",
  resetFilter: "Reset",
  cancelFilter: "Cancel",
  textFilter: "Text Filter",
  numberFilter: "Number Filter",
  dateFilter: "Date Filter",
  setFilter: "Set Filter",
  filterOoo: "Filter...",
  empty: "Choose one",
  equals: "Equals",
  notEqual: "Does not equal",
  lessThan: "Less than",
  greaterThan: "Greater than",
  inRange: "Between",
  inRangeStart: "From",
  inRangeEnd: "To",
  lessThanOrEqual: "Less than or equal to",
  greaterThanOrEqual: "Greater than or equal to",
  contains: "Contains",
  notContains: "Does not contain",
  startsWith: "Begins with",
  endsWith: "Ends with",
  blank: "Blank",
  notBlank: "Not blank",
  before: "Before",
  after: "After",
  andCondition: "AND",
  orCondition: "OR",
  dateFormatOoo: "yyyy-mm-dd",
  filterSummaryInactive: "is (All)",
  filterSummaryContains: "contains",
  filterSummaryNotContains: "does not contain",
  filterSummaryTextEquals: "equals",
  filterSummaryTextNotEqual: "does not equal",
  filterSummaryStartsWith: "begins with",
  filterSummaryEndsWith: "ends with",
  filterSummaryBlank: "is blank",
  filterSummaryNotBlank: "is not blank",
  filterSummaryEquals: "=",
  filterSummaryNotEqual: "!=",
  filterSummaryGreaterThan: ">",
  filterSummaryGreaterThanOrEqual: ">=",
  filterSummaryLessThan: "<",
  filterSummaryLessThanOrEqual: "<=",
  filterSummaryInRange: "between",
  filterSummaryInRangeValues: (e) => `(${e[0]}, ${e[1]})`,
  filterSummaryTextQuote: (e) => `"${e[0]}"`
};
function vs(e, t, s) {
  return Nc(e, uS, t, s);
}
function cd(e, t) {
  const { debounceMs: s } = e;
  return wn(e) ? (s != null && F(71), 0) : s ?? t;
}
function wn(e) {
  var t;
  return (((t = e.buttons) == null ? void 0 : t.indexOf("apply")) ?? -1) >= 0;
}
var Qp = class extends D {
  constructor(e, t, s, i, r, n) {
    super(), this.column = e, this.wrapper = t, this.eventParent = s, this.updateModel = i, this.isGlobalButtons = r, this.enableGlobalButtonCheck = n, this.hidePopup = null, this.applyActive = !1;
  }
  postConstruct() {
    const { comp: e, params: t } = this.wrapper, s = t, i = s.useForm, r = i ? "form" : "div";
    this.setTemplate({
      tag: r,
      cls: "ag-filter-wrapper"
    }), i && this.addManagedElementListeners(this.getGui(), {
      submit: (n) => {
        n == null || n.preventDefault();
      },
      keydown: this.handleKeyDown.bind(this)
    }), this.appendChild(e.getGui()), this.params = s, this.resetButtonsPanel(s), this.addManagedListeners(this.eventParent, {
      filterParamsChanged: ({ column: n, params: o }) => {
        n === this.column && this.resetButtonsPanel(o, this.params);
      },
      filterStateChanged: ({ column: n, state: o }) => {
        var a;
        n === this.column && ((a = this.eButtons) == null || a.updateValidity(o.valid !== !1));
      },
      filterAction: ({ column: n, action: o, event: a }) => {
        n === this.column && this.afterAction(o, a);
      },
      ...this.enableGlobalButtonCheck ? {
        filterGlobalButtons: ({ isGlobal: n }) => {
          if (n !== this.isGlobalButtons) {
            this.isGlobalButtons = n;
            const o = this.params;
            this.resetButtonsPanel(o, o, !0);
          }
        }
      } : void 0
    });
  }
  afterGuiAttached(e) {
    e && (this.hidePopup = e.hidePopup);
  }
  resetButtonsPanel(e, t, s) {
    const { buttons: i, readOnly: r } = t ?? {}, { buttons: n, readOnly: o, useForm: a } = e;
    if (!s && r === o && Si(i, n))
      return;
    const l = n && n.length > 0 && !e.readOnly && !this.isGlobalButtons;
    let c = this.eButtons;
    if (l) {
      const d = n.map((h) => {
        const u = `${h}Filter`;
        return { type: h, label: vs(this, u) };
      });
      if (this.applyActive = wn(this.params), !c) {
        c = this.createBean(new Ca()), this.appendChild(c.getGui());
        const h = this.column, u = (g) => ({ event: p }) => {
          this.updateModel(h, g), this.afterAction(g, p);
        };
        c == null || c.addManagedListeners(c, {
          apply: u("apply"),
          clear: u("clear"),
          reset: u("reset"),
          cancel: u("cancel")
        }), this.eButtons = c;
      }
      c.updateButtons(d, a);
    } else
      this.applyActive = !1, c && (se(c.getGui()), this.eButtons = this.destroyBean(c));
  }
  close(e) {
    const t = this.hidePopup;
    if (!t)
      return;
    const s = e, i = s && s.key;
    let r;
    (i === S.ENTER || i === S.SPACE) && (r = { keyboardEvent: s }), t(r), this.hidePopup = null;
  }
  afterAction(e, t) {
    const { params: s, applyActive: i } = this, r = s == null ? void 0 : s.closeOnApply;
    switch (e) {
      case "apply": {
        t == null || t.preventDefault(), r && i && this.close(t);
        break;
      }
      case "reset": {
        r && i && this.close();
        break;
      }
      case "cancel": {
        r && this.close(t);
        break;
      }
    }
  }
  handleKeyDown(e) {
    !e.defaultPrevented && e.key === S.ENTER && this.applyActive && (this.updateModel(this.column, "apply"), this.afterAction("apply", e));
  }
  destroy() {
    this.hidePopup = null, this.eButtons = this.destroyBean(this.eButtons);
  }
}, gS = { tag: "div", cls: "ag-filter" }, bn = class extends D {
  constructor(e, t, s) {
    super(gS), this.column = e, this.source = t, this.enableGlobalButtonCheck = s, this.wrapper = null;
  }
  postConstruct() {
    var e;
    (e = this.beans.colFilter) == null || e.activeFilterComps.add(this), this.createFilter(!0), this.addManagedEventListeners({ filterDestroyed: this.onFilterDestroyed.bind(this) });
  }
  hasFilter() {
    return this.wrapper != null;
  }
  getFilter() {
    var e;
    return ((e = this.wrapper) == null ? void 0 : e.then((t) => t.comp)) ?? null;
  }
  afterInit() {
    var e;
    return ((e = this.wrapper) == null ? void 0 : e.then(() => {
    })) ?? U.resolve();
  }
  afterGuiAttached(e) {
    var t;
    this.afterGuiAttachedParams = e, (t = this.wrapper) == null || t.then((s) => {
      var i, r, n;
      (i = this.comp) == null || i.afterGuiAttached(e), (n = (r = s == null ? void 0 : s.comp) == null ? void 0 : r.afterGuiAttached) == null || n.call(r, e);
    });
  }
  afterGuiDetached() {
    var e;
    (e = this.wrapper) == null || e.then((t) => {
      var s, i;
      (i = (s = t == null ? void 0 : t.comp) == null ? void 0 : s.afterGuiDetached) == null || i.call(s);
    });
  }
  createFilter(e) {
    const {
      column: t,
      source: s,
      beans: { colFilter: i }
    } = this, r = i.getFilterUiForDisplay(t) ?? null;
    this.wrapper = r, r == null || r.then((n) => {
      var c;
      if (!n)
        return;
      const { isHandler: o, comp: a } = n;
      let l;
      if (o) {
        const d = !!this.enableGlobalButtonCheck, h = this.createBean(
          new Qp(
            t,
            n,
            i,
            i.updateModel.bind(i),
            d && i.isGlobalButtons,
            d
          )
        );
        this.comp = h, l = h.getGui();
      } else
        l = a.getGui(), A(l) || F(69, { guiFromFilter: l });
      this.appendChild(l), e ? this.eventSvc.dispatchEvent({
        type: "filterOpened",
        column: t,
        source: s,
        eGui: this.getGui()
      }) : (c = a.afterGuiAttached) == null || c.call(a, this.afterGuiAttachedParams);
    });
  }
  onFilterDestroyed(e) {
    const { source: t, column: s } = e;
    (t === "api" || t === "paramsUpdated") && s.getId() === this.column.getId() && this.beans.colModel.getColDefCol(this.column) && (X(this.getGui()), this.comp = this.destroyBean(this.comp), this.createFilter());
  }
  destroy() {
    var e;
    (e = this.beans.colFilter) == null || e.activeFilterComps.delete(this), this.eventSvc.dispatchEvent({
      type: "filterClosed",
      column: this.column
    }), this.wrapper = null, this.comp = this.destroyBean(this.comp), this.afterGuiAttachedParams = void 0, super.destroy();
  }
}, Th = {
  january: "January",
  february: "February",
  march: "March",
  april: "April",
  may: "May",
  june: "June",
  july: "July",
  august: "August",
  september: "September",
  october: "October",
  november: "November",
  december: "December"
}, Mh = [
  "january",
  "february",
  "march",
  "april",
  "may",
  "june",
  "july",
  "august",
  "september",
  "october",
  "november",
  "december"
];
function pS(e, t) {
  return e == null ? -1 : t == null ? 1 : parseFloat(e) - parseFloat(t);
}
function Dh(e) {
  return e instanceof Date && !isNaN(e.getTime());
}
var Ql = {
  number: () => {
  },
  boolean: () => ({
    maxNumConditions: 1,
    debounceMs: 0,
    filterOptions: [
      "empty",
      {
        displayKey: "true",
        displayName: "True",
        predicate: (e, t) => t,
        numberOfInputs: 0
      },
      {
        displayKey: "false",
        displayName: "False",
        predicate: (e, t) => t === !1,
        numberOfInputs: 0
      }
    ]
  }),
  date: () => ({ isValidDate: Dh }),
  dateString: ({ dataTypeDefinition: e }) => ({
    comparator: (t, s) => {
      const i = e.dateParser(s);
      return s == null || i < t ? -1 : i > t ? 1 : 0;
    },
    isValidDate: (t) => typeof t == "string" && Dh(e.dateParser(t))
  }),
  dateTime: (e) => Ql.date(e),
  dateTimeString: (e) => Ql.dateString(e),
  object: () => {
  },
  text: () => {
  }
}, Jl = {
  number: () => ({ comparator: pS }),
  boolean: ({ t: e }) => ({
    valueFormatter: (t) => A(t.value) ? e(String(t.value), t.value ? "True" : "False") : e("blanks", "(Blanks)")
  }),
  date: ({ formatValue: e, t }) => ({
    valueFormatter: (s) => {
      const i = e(s);
      return A(i) ? i : t("blanks", "(Blanks)");
    },
    treeList: !0,
    treeListFormatter: (s, i) => {
      if (s === "NaN")
        return t("invalidDate", "Invalid Date");
      if (i === 1 && s != null) {
        const r = Mh[Number(s) - 1];
        return t(r, Th[r]);
      }
      return s ?? t("blanks", "(Blanks)");
    },
    treeListPathGetter: (s) => Xi(s, !1)
  }),
  dateString: ({ formatValue: e, dataTypeDefinition: t, t: s }) => ({
    valueFormatter: (i) => {
      const r = e(i);
      return A(r) ? r : s("blanks", "(Blanks)");
    },
    treeList: !0,
    treeListPathGetter: (i) => Xi(t.dateParser(i ?? void 0), !1),
    treeListFormatter: (i, r) => {
      if (r === 1 && i != null) {
        const n = Mh[Number(i) - 1];
        return s(n, Th[n]);
      }
      return i ?? s("blanks", "(Blanks)");
    }
  }),
  dateTime: (e) => {
    const t = Jl.date(e);
    return t.treeListPathGetter = Xi, t;
  },
  dateTimeString(e) {
    const t = e.dataTypeDefinition.dateParser, s = Jl.dateString(e);
    return s.treeListPathGetter = (i) => Xi(t(i ?? void 0)), s;
  },
  object: ({ formatValue: e, t }) => ({
    valueFormatter: (s) => {
      const i = e(s);
      return A(i) ? i : t("blanks", "(Blanks)");
    }
  }),
  text: () => {
  }
};
function dd(e, t, s, i, r, n, o) {
  let a = t, l = s;
  const c = e === "agSetColumnFilter";
  !l && i.baseDataType === "object" && !c && (l = ({ column: g, node: p }) => r({ column: g, node: p, value: n.valueSvc.getValue(g, p) }));
  const h = (c ? Jl : Ql)[i.baseDataType], u = h({ dataTypeDefinition: i, formatValue: r, t: o });
  return a = typeof t == "object" ? {
    ...u,
    ...t
  } : u, { filterParams: a, filterValueGetter: l };
}
var fS = {
  boolean: "agTextColumnFilter",
  date: "agDateColumnFilter",
  dateString: "agDateColumnFilter",
  dateTime: "agDateColumnFilter",
  dateTimeString: "agDateColumnFilter",
  number: "agNumberColumnFilter",
  object: "agTextColumnFilter",
  text: "agTextColumnFilter"
}, mS = {
  boolean: "agTextColumnFloatingFilter",
  date: "agDateColumnFloatingFilter",
  dateString: "agDateColumnFloatingFilter",
  dateTime: "agDateColumnFloatingFilter",
  dateTimeString: "agDateColumnFloatingFilter",
  number: "agNumberColumnFloatingFilter",
  object: "agTextColumnFloatingFilter",
  text: "agTextColumnFloatingFilter"
};
function hd(e, t = !1) {
  return (t ? mS : fS)[e ?? "text"];
}
var Jp = "ag-resizer-wrapper", Gs = (e, t) => ({
  tag: "div",
  ref: `${e}Resizer`,
  cls: `ag-resizer ag-resizer-${t}`
}), CS = {
  tag: "div",
  cls: Jp,
  children: [
    Gs("eTopLeft", "topLeft"),
    Gs("eTop", "top"),
    Gs("eTopRight", "topRight"),
    Gs("eRight", "right"),
    Gs("eBottomRight", "bottomRight"),
    Gs("eBottom", "bottom"),
    Gs("eBottomLeft", "bottomLeft"),
    Gs("eLeft", "left")
  ]
}, va = class extends R {
  constructor(e, t) {
    super(), this.element = e, this.dragStartPosition = {
      x: 0,
      y: 0
    }, this.position = {
      x: 0,
      y: 0
    }, this.lastSize = {
      width: -1,
      height: -1
    }, this.positioned = !1, this.resizersAdded = !1, this.resizeListeners = [], this.boundaryEl = null, this.isResizing = !1, this.isMoving = !1, this.resizable = {}, this.movable = !1, this.currentResizer = null, this.config = Object.assign({}, { popup: !1 }, t);
  }
  wireBeans(e) {
    this.popupSvc = e.popupSvc, this.dragSvc = e.dragSvc;
  }
  center(e) {
    const { clientHeight: t, clientWidth: s } = this.offsetParent, i = s / 2 - this.getWidth() / 2, r = t / 2 - this.getHeight() / 2;
    this.offsetElement(i, r, e);
  }
  initialisePosition(e) {
    if (this.positioned)
      return;
    const { centered: t, forcePopupParentAsOffsetParent: s, minWidth: i, width: r, minHeight: n, height: o, x: a, y: l } = this.config;
    this.offsetParent || this.setOffsetParent();
    let c = 0, d = 0;
    const h = Ze(this.element);
    if (h) {
      const u = this.findBoundaryElement(), g = window.getComputedStyle(u);
      if (g.minWidth != null) {
        const p = u.offsetWidth - this.element.offsetWidth;
        d = parseInt(g.minWidth, 10) - p;
      }
      if (g.minHeight != null) {
        const p = u.offsetHeight - this.element.offsetHeight;
        c = parseInt(g.minHeight, 10) - p;
      }
    }
    if (this.minHeight = n || c, this.minWidth = i || d, r && this.setWidth(r), o && this.setHeight(o), (!r || !o) && this.refreshSize(), t)
      this.center(e);
    else if (a || l)
      this.offsetElement(a, l, e);
    else if (h && s) {
      let u = this.boundaryEl, g = !0;
      if (u || (u = this.findBoundaryElement(), g = !1), u) {
        const p = parseFloat(u.style.top), f = parseFloat(u.style.left);
        g ? this.offsetElement(isNaN(f) ? 0 : f, isNaN(p) ? 0 : p, e) : this.setPosition(f, p);
      }
    }
    this.positioned = !!this.offsetParent;
  }
  isPositioned() {
    return this.positioned;
  }
  getPosition() {
    return this.position;
  }
  setMovable(e, t) {
    var i, r;
    if (!this.config.popup || e === this.movable)
      return;
    this.movable = e;
    const s = this.moveElementDragListener || {
      eElement: t,
      onDragStart: this.onMoveStart.bind(this),
      onDragging: this.onMove.bind(this),
      onDragStop: this.onMoveEnd.bind(this)
    };
    e ? ((i = this.dragSvc) == null || i.addDragSource(s), this.moveElementDragListener = s) : ((r = this.dragSvc) == null || r.removeDragSource(s), this.moveElementDragListener = void 0);
  }
  setResizable(e) {
    if (this.clearResizeListeners(), e ? this.addResizers() : this.removeResizers(), typeof e == "boolean") {
      if (e === !1)
        return;
      e = {
        topLeft: e,
        top: e,
        topRight: e,
        right: e,
        bottomRight: e,
        bottom: e,
        bottomLeft: e,
        left: e
      };
    }
    Object.keys(e).forEach((t) => {
      var o;
      const i = !!e[t], r = this.getResizerElement(t), n = {
        dragStartPixels: 0,
        eElement: r,
        onDragStart: (a) => this.onResizeStart(a, t),
        onDragging: this.onResize.bind(this),
        onDragStop: (a) => this.onResizeEnd(a, t)
      };
      (i || !this.isAlive() && !i) && (i ? ((o = this.dragSvc) == null || o.addDragSource(n), this.resizeListeners.push(n), r.style.pointerEvents = "all") : r.style.pointerEvents = "none", this.resizable[t] = i);
    });
  }
  removeSizeFromEl() {
    this.element.style.removeProperty("height"), this.element.style.removeProperty("width"), this.element.style.removeProperty("flex");
  }
  restoreLastSize() {
    this.element.style.flex = "0 0 auto";
    const { height: e, width: t } = this.lastSize;
    t !== -1 && (this.element.style.width = `${t}px`), e !== -1 && (this.element.style.height = `${e}px`);
  }
  getHeight() {
    return this.element.offsetHeight;
  }
  setHeight(e) {
    const { popup: t } = this.config, s = this.element;
    let i = !1;
    if (typeof e == "string" && e.indexOf("%") !== -1)
      Ur(s, e), e = ra(s), i = !0;
    else if (e = Math.max(this.minHeight, e), this.positioned) {
      const r = this.getAvailableHeight();
      r && e > r && (e = r);
    }
    this.getHeight() !== e && (i ? (s.style.maxHeight = "unset", s.style.minHeight = "unset") : t ? Ur(s, e) : (s.style.height = `${e}px`, s.style.flex = "0 0 auto", this.lastSize.height = typeof e == "number" ? e : parseFloat(e)));
  }
  getAvailableHeight() {
    const { popup: e, forcePopupParentAsOffsetParent: t } = this.config;
    this.positioned || this.initialisePosition();
    const { clientHeight: s } = this.offsetParent;
    if (!s)
      return null;
    const i = this.element.getBoundingClientRect(), r = this.offsetParent.getBoundingClientRect(), n = e ? this.position.y : i.top, o = e ? 0 : r.top;
    let a = 0;
    if (t) {
      const c = this.element.parentElement;
      if (c) {
        const { bottom: d } = c.getBoundingClientRect();
        a = d - i.bottom;
      }
    }
    return s + o - n - a;
  }
  getWidth() {
    return this.element.offsetWidth;
  }
  setWidth(e) {
    const t = this.element, { popup: s } = this.config;
    let i = !1;
    if (typeof e == "string" && e.indexOf("%") !== -1)
      Ot(t, e), e = Ri(t), i = !0;
    else if (this.positioned) {
      e = Math.max(this.minWidth, e);
      const { clientWidth: r } = this.offsetParent, n = s ? this.position.x : this.element.getBoundingClientRect().left;
      r && e + n > r && (e = r - n);
    }
    this.getWidth() !== e && (i ? (t.style.maxWidth = "unset", t.style.minWidth = "unset") : this.config.popup ? Ot(t, e) : (t.style.width = `${e}px`, t.style.flex = " unset", this.lastSize.width = typeof e == "number" ? e : parseFloat(e)));
  }
  offsetElement(e = 0, t = 0, s) {
    var n;
    const { forcePopupParentAsOffsetParent: i } = this.config, r = i ? this.boundaryEl : this.element;
    r && ((n = this.popupSvc) == null || n.positionPopup({
      ePopup: r,
      keepWithinBounds: !0,
      skipObserver: this.movable || this.isResizable(),
      updatePosition: () => ({ x: e, y: t }),
      postProcessCallback: s
    }), this.setPosition(parseFloat(r.style.left), parseFloat(r.style.top)));
  }
  constrainSizeToAvailableHeight(e) {
    var s, i;
    if (!this.config.forcePopupParentAsOffsetParent)
      return;
    const t = () => {
      const r = this.getAvailableHeight();
      this.element.style.setProperty("max-height", `${r}px`);
    };
    e && this.popupSvc ? ((s = this.resizeObserverSubscriber) == null || s.call(this), this.resizeObserverSubscriber = os(
      this.beans,
      (i = this.popupSvc) == null ? void 0 : i.getPopupParent(),
      t
    )) : (this.element.style.removeProperty("max-height"), this.resizeObserverSubscriber && (this.resizeObserverSubscriber(), this.resizeObserverSubscriber = void 0));
  }
  setPosition(e, t) {
    this.position.x = e, this.position.y = t;
  }
  updateDragStartPosition(e, t) {
    this.dragStartPosition = { x: e, y: t };
  }
  calculateMouseMovement(e) {
    const { e: t, isLeft: s, isTop: i, anywhereWithin: r, topBuffer: n } = e, o = t.clientX - this.dragStartPosition.x, a = t.clientY - this.dragStartPosition.y, l = this.shouldSkipX(t, !!s, !!r, o) ? 0 : o, c = this.shouldSkipY(t, !!i, n, a) ? 0 : a;
    return { movementX: l, movementY: c };
  }
  shouldSkipX(e, t, s, i) {
    const r = this.element.getBoundingClientRect(), n = this.offsetParent.getBoundingClientRect(), o = this.boundaryEl.getBoundingClientRect(), a = this.config.popup ? this.position.x : r.left;
    let l = a <= 0 && n.left >= e.clientX || n.right <= e.clientX && n.right <= o.right;
    return l ? !0 : (t ? l = // skip if we are moving to the left and the cursor
    // is positioned to the right of the left side anchor
    i < 0 && e.clientX > a + n.left || // skip if we are moving to the right and the cursor
    // is positioned to the left of the dialog
    i > 0 && e.clientX < a + n.left : s ? l = i < 0 && e.clientX > o.right || i > 0 && e.clientX < a + n.left : l = // if the movement is bound to the right side of the dialog
    // we skip if we are moving to the left and the cursor
    // is to the right of the dialog
    i < 0 && e.clientX > o.right || // or skip if we are moving to the right and the cursor
    // is to the left of the right side anchor
    i > 0 && e.clientX < o.right, l);
  }
  shouldSkipY(e, t, s = 0, i) {
    const r = this.element.getBoundingClientRect(), n = this.offsetParent.getBoundingClientRect(), o = this.boundaryEl.getBoundingClientRect(), a = this.config.popup ? this.position.y : r.top;
    let l = a <= 0 && n.top >= e.clientY || n.bottom <= e.clientY && n.bottom <= o.bottom;
    return l ? !0 : (t ? l = // skip if we are moving to towards top and the cursor is
    // below the top anchor + topBuffer
    // note: topBuffer is used when moving the dialog using the title bar
    i < 0 && e.clientY > a + n.top + s || // skip if we are moving to the bottom and the cursor is
    // above the top anchor
    i > 0 && e.clientY < a + n.top : l = // skip if we are moving towards the top and the cursor
    // is below the bottom anchor
    i < 0 && e.clientY > o.bottom || // skip if we are moving towards the bottom and the cursor
    // is above the bottom anchor
    i > 0 && e.clientY < o.bottom, l);
  }
  createResizeMap() {
    const e = (t) => ({
      element: this.element.querySelector(`[data-ref=${t}Resizer]`)
    });
    this.resizerMap = {
      topLeft: e("eTopLeft"),
      top: e("eTop"),
      topRight: e("eTopRight"),
      right: e("eRight"),
      bottomRight: e("eBottomRight"),
      bottom: e("eBottom"),
      bottomLeft: e("eBottomLeft"),
      left: e("eLeft")
    };
  }
  addResizers() {
    if (this.resizersAdded)
      return;
    const e = this.element;
    e && (e.appendChild(K(CS)), this.createResizeMap(), this.resizersAdded = !0);
  }
  removeResizers() {
    this.resizerMap = void 0;
    const e = this.element.querySelector(`.${Jp}`);
    e && this.element.removeChild(e), this.resizersAdded = !1;
  }
  getResizerElement(e) {
    return this.resizerMap[e].element;
  }
  onResizeStart(e, t) {
    this.boundaryEl = this.findBoundaryElement(), this.positioned || this.initialisePosition(), this.currentResizer = {
      isTop: !!t.match(/top/i),
      isRight: !!t.match(/right/i),
      isBottom: !!t.match(/bottom/i),
      isLeft: !!t.match(/left/i)
    }, this.element.classList.add("ag-resizing"), this.resizerMap[t].element.classList.add("ag-active");
    const { popup: s, forcePopupParentAsOffsetParent: i } = this.config;
    !s && !i && this.applySizeToSiblings(this.currentResizer.isBottom || this.currentResizer.isTop), this.isResizing = !0, this.updateDragStartPosition(e.clientX, e.clientY);
  }
  getSiblings() {
    const t = this.element.parentElement;
    return t ? Array.prototype.slice.call(t.children).filter((s) => !s.classList.contains("ag-hidden")) : null;
  }
  getMinSizeOfSiblings() {
    const e = this.getSiblings() || [];
    let t = 0, s = 0;
    for (let i = 0; i < e.length; i++) {
      const r = e[i], n = !!r.style.flex && r.style.flex !== "0 0 auto";
      if (r === this.element)
        continue;
      let o = this.minHeight || 0, a = this.minWidth || 0;
      if (n) {
        const l = window.getComputedStyle(r);
        l.minHeight && (o = parseInt(l.minHeight, 10)), l.minWidth && (a = parseInt(l.minWidth, 10));
      } else
        o = r.offsetHeight, a = r.offsetWidth;
      t += o, s += a;
    }
    return { height: t, width: s };
  }
  applySizeToSiblings(e) {
    let t = null;
    const s = this.getSiblings();
    if (s) {
      for (let i = 0; i < s.length; i++) {
        const r = s[i];
        r !== t && (e ? r.style.height = `${r.offsetHeight}px` : r.style.width = `${r.offsetWidth}px`, r.style.flex = "0 0 auto", r === this.element && (t = s[i + 1]));
      }
      t && (t.style.removeProperty("height"), t.style.removeProperty("min-height"), t.style.removeProperty("max-height"), t.style.flex = "1 1 auto");
    }
  }
  isResizable() {
    return Object.values(this.resizable).some((e) => e);
  }
  onResize(e) {
    if (!this.isResizing || !this.currentResizer)
      return;
    const { popup: t, forcePopupParentAsOffsetParent: s } = this.config, { isTop: i, isRight: r, isBottom: n, isLeft: o } = this.currentResizer, a = r || o, l = n || i, { movementX: c, movementY: d } = this.calculateMouseMovement({ e, isLeft: o, isTop: i }), h = this.position.x, u = this.position.y;
    let g = 0, p = 0;
    if (a && c) {
      const f = o ? -1 : 1, m = this.getWidth(), C = m + c * f;
      let v = !1;
      o && (g = m - C, (h + g <= 0 || C <= this.minWidth) && (v = !0, g = 0)), v || this.setWidth(C);
    }
    if (l && d) {
      const f = i ? -1 : 1, m = this.getHeight(), C = m + d * f;
      let v = !1;
      i ? (p = m - C, (u + p <= 0 || C <= this.minHeight) && (v = !0, p = 0)) : !this.config.popup && !this.config.forcePopupParentAsOffsetParent && m < C && this.getMinSizeOfSiblings().height + C > this.element.parentElement.offsetHeight && (v = !0), v || this.setHeight(C);
    }
    this.updateDragStartPosition(e.clientX, e.clientY), ((t || s) && g || p) && this.offsetElement(h + g, u + p);
  }
  onResizeEnd(e, t) {
    this.isResizing = !1, this.currentResizer = null, this.boundaryEl = null, this.element.classList.remove("ag-resizing"), this.resizerMap[t].element.classList.remove("ag-active"), this.dispatchLocalEvent({ type: "resize" });
  }
  refreshSize() {
    const e = this.element;
    this.config.popup && (this.config.width || this.setWidth(e.offsetWidth), this.config.height || this.setHeight(e.offsetHeight));
  }
  onMoveStart(e) {
    this.boundaryEl = this.findBoundaryElement(), this.positioned || this.initialisePosition(), this.isMoving = !0, this.element.classList.add("ag-moving"), this.updateDragStartPosition(e.clientX, e.clientY);
  }
  onMove(e) {
    if (!this.isMoving)
      return;
    const { x: t, y: s } = this.position;
    let i;
    this.config.calculateTopBuffer && (i = this.config.calculateTopBuffer());
    const { movementX: r, movementY: n } = this.calculateMouseMovement({
      e,
      isTop: !0,
      anywhereWithin: !0,
      topBuffer: i
    });
    this.offsetElement(t + r, s + n), this.updateDragStartPosition(e.clientX, e.clientY);
  }
  onMoveEnd() {
    this.isMoving = !1, this.boundaryEl = null, this.element.classList.remove("ag-moving");
  }
  setOffsetParent() {
    this.config.forcePopupParentAsOffsetParent && this.popupSvc ? this.offsetParent = this.popupSvc.getPopupParent() : this.offsetParent = this.element.offsetParent;
  }
  findBoundaryElement() {
    let e = this.element;
    for (; e; ) {
      if (window.getComputedStyle(e).position !== "static")
        return e;
      e = e.parentElement;
    }
    return this.element;
  }
  clearResizeListeners() {
    var e;
    for (; this.resizeListeners.length; ) {
      const t = this.resizeListeners.pop();
      (e = this.dragSvc) == null || e.removeDragSource(t);
    }
  }
  destroy() {
    var e;
    super.destroy(), this.moveElementDragListener && ((e = this.dragSvc) == null || e.removeDragSource(this.moveElementDragListener)), this.constrainSizeToAvailableHeight(!1), this.clearResizeListeners(), this.removeResizers();
  }
}, ef = "__ag_Grid_Stop_Propagation";
function he(e) {
  e[ef] = !0;
}
function St(e) {
  return e[ef] === !0;
}
var tf = "ag-focus-managed", ii = class extends R {
  constructor(e, t = {}) {
    super(), this.eFocusable = e, this.callbacks = t, this.callbacks = {
      shouldStopEventPropagation: () => !1,
      onTabKeyDown: (s) => {
        if (s.defaultPrevented)
          return;
        const i = ze(this.beans, this.eFocusable, !1, s.shiftKey);
        i && (i.focus(), s.preventDefault());
      },
      ...t
    };
  }
  postConstruct() {
    const {
      eFocusable: e,
      callbacks: { onFocusIn: t, onFocusOut: s }
    } = this;
    e.classList.add(tf), this.addKeyDownListeners(e), t && this.addManagedElementListeners(e, { focusin: t }), s && this.addManagedElementListeners(e, { focusout: s });
  }
  addKeyDownListeners(e) {
    this.addManagedElementListeners(e, {
      keydown: (t) => {
        if (t.defaultPrevented || St(t))
          return;
        const { callbacks: s } = this;
        if (s.shouldStopEventPropagation(t)) {
          he(t);
          return;
        }
        t.key === S.TAB ? s.onTabKeyDown(t) : s.handleKeyDown && s.handleKeyDown(t);
      }
    });
  }
}, wa = class extends D {
  constructor(e, t) {
    super(), this.filterNameKey = e, this.cssIdentifier = t, this.applyActive = !1, this.debouncePending = !1, this.defaultDebounceMs = 0;
  }
  postConstruct() {
    const e = {
      tag: "div",
      cls: `ag-filter-body-wrapper ag-${this.cssIdentifier}-body-wrapper`,
      children: [this.createBodyTemplate()]
    };
    this.setTemplate(e, this.getAgComponents()), this.createManagedBean(
      new ii(this.getFocusableElement(), {
        handleKeyDown: this.handleKeyDown.bind(this)
      })
    ), this.positionableFeature = this.createBean(
      new va(this.getPositionableElement(), {
        forcePopupParentAsOffsetParent: !0
      })
    );
  }
  handleKeyDown(e) {
  }
  init(e) {
    const t = e;
    this.setParams(t), this.setModelIntoUi(t.state.model, !0).then(() => this.updateUiVisibility());
  }
  refresh(e) {
    const t = e, s = this.params;
    this.params = t, t.source === "colDef" && this.updateParams(t, s);
    const r = t.state, n = this.state;
    return this.state = r, (r.model !== n.model || r.state !== n.state) && this.setModelIntoUi(r.model), !0;
  }
  /** Called on init only. Override in subclasses */
  setParams(e) {
    this.params = e, this.state = e.state, this.commonUpdateParams(e);
  }
  /** Called on refresh only. Override in subclasses */
  updateParams(e, t) {
    this.commonUpdateParams(e, t);
  }
  commonUpdateParams(e, t) {
    this.applyActive = wn(e), this.setupApplyDebounced();
  }
  /**
   * @deprecated v34 Use the same method on the filter handler (`api.getColumnFilterHandler()`) instead.
   */
  doesFilterPass(e) {
    F(283);
    const { getHandler: t, model: s, column: i } = this.params;
    return t().doesFilterPass({
      ...e,
      model: s,
      handlerParams: this.beans.colFilter.getHandlerParams(i)
    });
  }
  getFilterTitle() {
    return this.translate(this.filterNameKey);
  }
  /**
   * @deprecated v34 Filters are active when they have a model. Use `api.getColumnFilterModel()` instead.
   */
  isFilterActive() {
    return F(284), this.params.model != null;
  }
  setupApplyDebounced() {
    const e = cd(this.params, this.defaultDebounceMs), t = pe(this, this.checkApplyDebounce.bind(this), e);
    this.applyDebounced = () => {
      this.debouncePending = !0, t();
    };
  }
  checkApplyDebounce() {
    this.debouncePending && (this.debouncePending = !1, this.doApplyModel());
  }
  /**
   * @deprecated v34 Use (`api.getColumnFilterModel()`) instead.
   */
  getModel() {
    return F(285), this.params.model;
  }
  /**
   * @deprecated v34 Use (`api.setColumnFilterModel()`) instead.
   */
  setModel(e) {
    F(286);
    const { beans: t, params: s } = this;
    return t.colFilter.setModelForColumnLegacy(s.column, e);
  }
  /**
   * Applies changes made in the UI to the filter, and returns true if the model has changed.
   */
  applyModel(e = "api") {
    return this.doApplyModel();
  }
  canApply(e) {
    return !0;
  }
  doApplyModel(e) {
    const { params: t, state: s } = this, i = !this.areModelsEqual(t.model, s.model);
    return i && t.onAction("apply", e), i;
  }
  /**
   * @deprecated v34 Internal method - should only be called by the grid.
   */
  onNewRowsLoaded() {
  }
  /**
   * By default, if the change came from a floating filter it will be applied immediately, otherwise if there is no
   * apply button it will be applied after a debounce, otherwise it will not be applied at all. This behaviour can
   * be adjusted by using the apply parameter.
   */
  onUiChanged(e, t = !1) {
    this.updateUiVisibility();
    const s = this.getModelFromUi(), i = {
      model: s,
      state: this.getState(),
      valid: this.canApply(s)
    };
    this.state = i;
    const r = this.params;
    r.onStateChange(i), r.onUiChange(this.getUiChangeEventParams()), this.gos.get("enableFilterHandlers") || this.eventSvc.dispatchEvent({
      type: "filterModified",
      column: r.column,
      filterInstance: this
    }), e ?? (e = this.applyActive ? void 0 : "debounce"), e === "immediately" ? this.doApplyModel({ afterFloatingFilter: t, afterDataChange: !1 }) : e === "debounce" && this.applyDebounced();
  }
  getState() {
  }
  getUiChangeEventParams() {
  }
  afterGuiAttached(e) {
    this.lastContainerType = e == null ? void 0 : e.container, this.refreshFilterResizer(e == null ? void 0 : e.container);
  }
  refreshFilterResizer(e) {
    const { positionableFeature: t, gos: s } = this;
    if (!t)
      return;
    const i = e === "floatingFilter" || e === "columnFilter";
    i ? (t.restoreLastSize(), t.setResizable(
      s.get("enableRtl") ? { bottom: !0, bottomLeft: !0, left: !0 } : { bottom: !0, bottomRight: !0, right: !0 }
    )) : (t.removeSizeFromEl(), t.setResizable(!1)), t.constrainSizeToAvailableHeight(i);
  }
  afterGuiDetached() {
    var e;
    this.checkApplyDebounce(), (e = this.positionableFeature) == null || e.constrainSizeToAvailableHeight(!1);
  }
  destroy() {
    this.positionableFeature = this.destroyBean(this.positionableFeature), super.destroy();
  }
  translate(e) {
    return vs(this, e);
  }
  // override to control positionable feature
  getPositionableElement() {
    return this.getGui();
  }
  areModelsEqual(e, t) {
    return e === t || e == null && t == null ? !0 : e == null || t == null ? !1 : this.areNonNullModelsEqual(e, t);
  }
};
function sf(e) {
  return !!e.operator;
}
function rf(e, t, s) {
  if (t == null)
    return null;
  let i = null;
  const { compName: r, jsComp: n, fwComp: o } = Ap(e, t);
  return r ? i = {
    agSetColumnFilter: "agSetColumnFloatingFilter",
    agMultiColumnFilter: "agMultiColumnFloatingFilter",
    agGroupColumnFilter: "agGroupColumnFloatingFilter",
    agNumberColumnFilter: "agNumberColumnFloatingFilter",
    agDateColumnFilter: "agDateColumnFloatingFilter",
    agTextColumnFilter: "agTextColumnFloatingFilter"
  }[r] : n == null && o == null && t.filter === !0 && (i = s()), i;
}
var kt = {
  AUTO_HEIGHT: "ag-layout-auto-height",
  NORMAL: "ag-layout-normal",
  PRINT: "ag-layout-print"
}, ud = class extends R {
  constructor(e) {
    super(), this.view = e;
  }
  postConstruct() {
    this.addManagedPropertyListener("domLayout", this.updateLayoutClasses.bind(this)), this.updateLayoutClasses();
  }
  updateLayoutClasses() {
    const e = this.gos.get("domLayout"), t = {
      autoHeight: e === "autoHeight",
      normal: e === "normal",
      print: e === "print"
    }, s = t.autoHeight ? kt.AUTO_HEIGHT : t.print ? kt.PRINT : kt.NORMAL;
    this.view.updateLayoutClasses(s, t);
  }
}, Os = "Viewport", Ah = "fakeVScrollComp", Qa = [
  "fakeHScrollComp",
  "centerHeader",
  "topCenter",
  "bottomCenter",
  "stickyTopCenter",
  "stickyBottomCenter"
], Ih = 100, Ja = 150, vS = class extends R {
  constructor(e) {
    super(), this.clearRetryListenerFncs = [], this.lastScrollSource = [null, null], this.scrollLeft = -1, this.nextScrollTop = -1, this.scrollTop = -1, this.lastOffsetHeight = -1, this.lastScrollTop = -1, this.lastIsHorizontalScrollShowing = !1, this.scrollTimer = 0, this.isScrollActive = !1, this.isVerticalPositionInvalidated = !0, this.isHorizontalPositionInvalidated = !0, this.eBodyViewport = e, this.resetLastHScrollDebounced = pe(
      this,
      () => this.lastScrollSource[
        1
        /* Horizontal */
      ] = null,
      Ja
    ), this.resetLastVScrollDebounced = pe(
      this,
      () => this.lastScrollSource[
        0
        /* Vertical */
      ] = null,
      Ja
    );
  }
  wireBeans(e) {
    this.ctrlsSvc = e.ctrlsSvc, this.animationFrameSvc = e.animationFrameSvc, this.visibleCols = e.visibleCols;
  }
  destroy() {
    super.destroy(), this.clearRetryListenerFncs = [], window.clearTimeout(this.scrollTimer);
  }
  postConstruct() {
    this.enableRtl = this.gos.get("enableRtl");
    const e = this.invalidateVerticalScroll.bind(this), t = this.invalidateHorizontalScroll.bind(this);
    this.addManagedEventListeners({
      displayedColumnsWidthChanged: this.onDisplayedColumnsWidthChanged.bind(this),
      gridSizeChanged: e,
      // We only invalidate horizontal scrolling when the viewport switches
      // between scrollable and non-scrollable, avoiding unnecessary
      // invalidation on every gridSizeChanged event. If more properties
      // require invalidation, read/write DOM cycles may be needed.
      scrollGapChanged: t
    }), this.addManagedElementListeners(this.eBodyViewport, {
      scroll: e
    }), this.ctrlsSvc.whenReady(this, (s) => {
      this.centerRowsCtrl = s.center, this.onDisplayedColumnsWidthChanged(), this.addScrollListener();
    });
  }
  invalidateHorizontalScroll() {
    this.isHorizontalPositionInvalidated = !0;
  }
  invalidateVerticalScroll() {
    this.isVerticalPositionInvalidated = !0;
  }
  addScrollListener() {
    this.addHorizontalScrollListeners(), this.addVerticalScrollListeners();
  }
  addHorizontalScrollListeners() {
    this.addManagedElementListeners(this.centerRowsCtrl.eViewport, {
      scroll: this.onHScroll.bind(this, Os)
    });
    for (const e of Qa) {
      const t = this.ctrlsSvc.get(e);
      this.registerScrollPartner(t, this.onHScroll.bind(this, e));
    }
  }
  addVerticalScrollListeners() {
    const e = this.ctrlsSvc.get("fakeVScrollComp"), t = this.gos.get("debounceVerticalScrollbar"), s = t ? pe(this, this.onVScroll.bind(this, Os), Ih) : this.onVScroll.bind(this, Os), i = t ? pe(this, this.onVScroll.bind(this, Ah), Ih) : this.onVScroll.bind(this, Ah);
    this.addManagedElementListeners(this.eBodyViewport, { scroll: s }), this.registerScrollPartner(e, i);
  }
  registerScrollPartner(e, t) {
    e.onScrollCallback(t);
  }
  onDisplayedColumnsWidthChanged() {
    this.enableRtl && this.horizontallyScrollHeaderCenterAndFloatingCenter();
  }
  horizontallyScrollHeaderCenterAndFloatingCenter(e) {
    this.centerRowsCtrl != null && (e === void 0 && (e = this.centerRowsCtrl.getCenterViewportScrollLeft()), this.setScrollLeftForAllContainersExceptCurrent(Math.abs(e)));
  }
  setScrollLeftForAllContainersExceptCurrent(e) {
    for (const t of [...Qa, Os]) {
      if (this.lastScrollSource[
        1
        /* Horizontal */
      ] === t)
        continue;
      const s = this.getViewportForSource(t);
      So(s, e, this.enableRtl);
    }
  }
  getViewportForSource(e) {
    return e === Os ? this.centerRowsCtrl.eViewport : this.ctrlsSvc.get(e).eViewport;
  }
  isControllingScroll(e, t) {
    return this.lastScrollSource[t] == null ? (t === 0 ? this.lastScrollSource[0] = e : this.lastScrollSource[1] = e, !0) : this.lastScrollSource[t] === e;
  }
  onHScroll(e) {
    if (!this.isControllingScroll(
      e,
      1
      /* Horizontal */
    ))
      return;
    const t = this.centerRowsCtrl.eViewport, { scrollLeft: s } = t;
    if (this.shouldBlockScrollUpdate(1, s, !0))
      return;
    const i = yo(this.getViewportForSource(e), this.enableRtl);
    this.doHorizontalScroll(i), this.resetLastHScrollDebounced();
  }
  onVScroll(e) {
    if (!this.isControllingScroll(
      e,
      0
      /* Vertical */
    ))
      return;
    let t;
    if (e === Os ? t = this.eBodyViewport.scrollTop : t = this.ctrlsSvc.get("fakeVScrollComp").getScrollPosition(), this.shouldBlockScrollUpdate(0, t, !0))
      return;
    const { animationFrameSvc: s } = this;
    s == null || s.setScrollTop(t), this.nextScrollTop = t, e === Os ? this.ctrlsSvc.get("fakeVScrollComp").setScrollPosition(t) : this.eBodyViewport.scrollTop = t, s != null && s.active ? s.schedule() : this.scrollGridIfNeeded(!0), this.resetLastVScrollDebounced();
  }
  doHorizontalScroll(e) {
    const t = this.ctrlsSvc.get("fakeHScrollComp").getScrollPosition();
    this.scrollLeft === e && e === t || (this.scrollLeft = e, this.fireScrollEvent(
      1
      /* Horizontal */
    ), this.horizontallyScrollHeaderCenterAndFloatingCenter(e), this.centerRowsCtrl.onHorizontalViewportChanged(!0));
  }
  isScrolling() {
    return this.isScrollActive;
  }
  fireScrollEvent(e) {
    const t = {
      type: "bodyScroll",
      direction: e === 1 ? "horizontal" : "vertical",
      left: this.scrollLeft,
      top: this.scrollTop
    };
    this.isScrollActive = !0, this.eventSvc.dispatchEvent(t), window.clearTimeout(this.scrollTimer), this.scrollTimer = window.setTimeout(() => {
      this.scrollTimer = 0, this.isScrollActive = !1, this.eventSvc.dispatchEvent({
        ...t,
        type: "bodyScrollEnd"
      });
    }, Ja);
  }
  shouldBlockScrollUpdate(e, t, s = !1) {
    return s && !Xs() ? !1 : e === 0 ? this.shouldBlockVerticalScroll(t) : this.shouldBlockHorizontalScroll(t);
  }
  shouldBlockVerticalScroll(e) {
    const t = ia(this.eBodyViewport), { scrollHeight: s } = this.eBodyViewport;
    return e < 0 || e + t > s;
  }
  shouldBlockHorizontalScroll(e) {
    const t = this.centerRowsCtrl.getCenterWidth(), { scrollWidth: s } = this.centerRowsCtrl.eViewport;
    if (this.enableRtl) {
      if (e > 0)
        return !0;
    } else if (e < 0)
      return !0;
    return Math.abs(e) + t > s;
  }
  redrawRowsAfterScroll() {
    this.fireScrollEvent(
      0
      /* Vertical */
    );
  }
  // this is to cater for AG-3274, where grid is removed from the dom and then inserted back in again.
  // (which happens with some implementations of tabbing). this can result in horizontal scroll getting
  // reset back to the left, however no scroll event is fired. so we need to get header to also scroll
  // back to the left to be kept in sync.
  // adding and removing the grid from the DOM both resets the scroll position and
  // triggers a resize event, so notify listeners if the scroll position has changed
  checkScrollLeft() {
    const e = this.scrollLeft;
    let t = !1;
    for (const s of Qa)
      if (this.getViewportForSource(s).scrollLeft !== e) {
        t = !0;
        break;
      }
    t && this.onHScroll(Os);
  }
  scrollGridIfNeeded(e = !1) {
    const t = this.scrollTop != this.nextScrollTop;
    return t && (this.scrollTop = this.nextScrollTop, e && this.invalidateVerticalScroll(), this.redrawRowsAfterScroll()), t;
  }
  // called by scrollHorizontally method and alignedGridsService
  setHorizontalScrollPosition(e, t = !1) {
    const i = this.centerRowsCtrl.eViewport.scrollWidth - this.centerRowsCtrl.getCenterWidth();
    !t && this.shouldBlockScrollUpdate(1, e) && (this.enableRtl ? e = e > 0 ? 0 : i : e = Math.min(Math.max(e, 0), i)), So(this.centerRowsCtrl.eViewport, Math.abs(e), this.enableRtl), this.doHorizontalScroll(e);
  }
  setVerticalScrollPosition(e) {
    this.invalidateVerticalScroll(), this.eBodyViewport.scrollTop = e;
  }
  getVScrollPosition() {
    if (!this.isVerticalPositionInvalidated) {
      const { lastOffsetHeight: s, lastScrollTop: i } = this;
      return {
        top: i,
        bottom: i + s
      };
    }
    this.isVerticalPositionInvalidated = !1;
    const { scrollTop: e, offsetHeight: t } = this.eBodyViewport;
    return this.lastScrollTop = e, this.lastOffsetHeight = t, {
      top: e,
      bottom: e + t
    };
  }
  /** Get an approximate scroll position that returns the last real value read.
   * This is useful for avoiding repeated DOM reads that force the browser to recalculate styles.
   * This can have big performance improvements but may not be 100% accurate so only use if this is acceptable.
   */
  getApproximateVScollPosition() {
    return this.lastScrollTop >= 0 && this.lastOffsetHeight >= 0 ? {
      top: this.scrollTop,
      bottom: this.scrollTop + this.lastOffsetHeight
    } : this.getVScrollPosition();
  }
  getHScrollPosition() {
    return this.centerRowsCtrl.getHScrollPosition();
  }
  isHorizontalScrollShowing() {
    return this.isHorizontalPositionInvalidated && (this.lastIsHorizontalScrollShowing = this.centerRowsCtrl.isHorizontalScrollShowing(), this.isHorizontalPositionInvalidated = !1), this.lastIsHorizontalScrollShowing;
  }
  // called by the headerRootComp and moveColumnController
  scrollHorizontally(e) {
    const t = this.centerRowsCtrl.eViewport.scrollLeft;
    return this.setHorizontalScrollPosition(t + e), this.centerRowsCtrl.eViewport.scrollLeft - t;
  }
  // gets called by rowRenderer when new data loaded, as it will want to scroll to the top
  scrollToTop() {
    this.eBodyViewport.scrollTop = 0;
  }
  // Valid values for position are bottom, middle and top
  ensureNodeVisible(e, t = null) {
    const { rowModel: s } = this.beans, i = s.getRowCount();
    let r = -1;
    for (let n = 0; n < i; n++) {
      const o = s.getRow(n);
      if (typeof e == "function") {
        if (o && e(o)) {
          r = n;
          break;
        }
      } else if (e === o || e === o.data) {
        r = n;
        break;
      }
    }
    r >= 0 && this.ensureIndexVisible(r, t);
  }
  // Valid values for position are bottom, middle and top
  // position should be {'top','middle','bottom', or undefined/null}.
  // if undefined/null, then the grid will to the minimal amount of scrolling,
  // eg if grid needs to scroll up, it scrolls until row is on top,
  //    if grid needs to scroll down, it scrolls until row is on bottom,
  //    if row is already in view, grid does not scroll
  ensureIndexVisible(e, t, s = 0) {
    if (Ie(this.gos, "print"))
      return;
    const { rowModel: i } = this.beans, r = i.getRowCount();
    if (typeof e != "number" || e < 0 || e >= r) {
      F(88, { index: e });
      return;
    }
    this.clearRetryListeners();
    const { frameworkOverrides: n, pageBounds: o, rowContainerHeight: a, rowRenderer: l } = this.beans;
    n.wrapIncoming(() => {
      var p, f;
      const c = this.ctrlsSvc.getGridBodyCtrl(), d = i.getRow(e);
      let h, u, g = 0;
      this.invalidateVerticalScroll();
      do {
        const { stickyTopHeight: m, stickyBottomHeight: C } = c, v = d.rowTop, w = d.rowHeight, b = o.getPixelOffset(), y = d.rowTop - b, P = y + d.rowHeight, E = this.getVScrollPosition(), M = a.divStretchOffset, T = E.top + M, G = E.bottom + M, I = G - T, L = a.getScrollPositionForPixel(y), $ = a.getScrollPositionForPixel(P - I), z = Math.min((L + $) / 2, y), W = T + m > y, H = G - C < P;
        let J = null;
        t === "top" ? J = L - m : t === "bottom" ? J = $ + C : t === "middle" ? J = z : W ? J = L - m : H && ($ - L > I ? J = L - m : J = $ + C), J !== null && (this.setVerticalScrollPosition(J), l.redraw({ afterScroll: !0 })), h = v !== d.rowTop || w !== d.rowHeight, u = m !== c.stickyTopHeight || C !== c.stickyBottomHeight, g++;
      } while ((h || u) && g < 10);
      if ((p = this.animationFrameSvc) == null || p.flushAllFrames(), s < 10 && (d != null && d.stub || !((f = this.beans.rowAutoHeight) != null && f.areRowsMeasured()))) {
        const m = this.getVScrollPosition().top;
        this.clearRetryListenerFncs = this.addManagedEventListeners({
          bodyScroll: () => {
            const C = this.getVScrollPosition().top;
            m !== C && this.clearRetryListeners();
          },
          modelUpdated: () => {
            this.clearRetryListeners(), !(e >= i.getRowCount()) && this.ensureIndexVisible(e, t, s + 1);
          }
        });
      }
    });
  }
  clearRetryListeners() {
    this.clearRetryListenerFncs.forEach((e) => e()), this.clearRetryListenerFncs = [];
  }
  ensureColumnVisible(e, t = "auto") {
    const { colModel: s, frameworkOverrides: i } = this.beans, r = s.getCol(e);
    if (!r || r.isPinned() || !this.visibleCols.isColDisplayed(r))
      return;
    const n = this.getPositionedHorizontalScroll(r, t);
    i.wrapIncoming(() => {
      var o;
      n !== null && this.centerRowsCtrl.setCenterViewportScrollLeft(n), this.centerRowsCtrl.onHorizontalViewportChanged(), (o = this.animationFrameSvc) == null || o.flushAllFrames();
    });
  }
  getPositionedHorizontalScroll(e, t) {
    const { columnBeforeStart: s, columnAfterEnd: i } = this.isColumnOutsideViewport(e), r = this.centerRowsCtrl.getCenterWidth() < e.getActualWidth(), n = this.centerRowsCtrl.getCenterWidth(), o = this.enableRtl;
    let a = (o ? s : i) || r, l = o ? i : s;
    t !== "auto" && (a = t === "start", l = t === "end");
    const c = t === "middle";
    if (a || l || c) {
      const { colLeft: d, colMiddle: h, colRight: u } = this.getColumnBounds(e);
      return c ? h - n / 2 : a ? o ? u : d : o ? d - n : u - n;
    }
    return null;
  }
  isColumnOutsideViewport(e) {
    const { start: t, end: s } = this.getViewportBounds(), { colLeft: i, colRight: r } = this.getColumnBounds(e), n = this.enableRtl, o = n ? t > r : s < r, a = n ? s < i : t > i;
    return { columnBeforeStart: o, columnAfterEnd: a };
  }
  getColumnBounds(e) {
    const t = this.enableRtl, s = this.visibleCols.bodyWidth, i = e.getActualWidth(), r = e.getLeft(), n = t ? -1 : 1, o = t ? s - r : r, a = o + i * n, l = o + i / 2 * n;
    return { colLeft: o, colMiddle: l, colRight: a };
  }
  getViewportBounds() {
    const e = this.centerRowsCtrl.getCenterWidth(), t = this.centerRowsCtrl.getCenterViewportScrollLeft(), s = t, i = e + t;
    return { start: s, end: i, width: e };
  }
}, gd = class extends R {
  constructor(e, t = !1) {
    super(), this.callback = e, this.addSpacer = t;
  }
  postConstruct() {
    const e = this.setWidth.bind(this);
    this.addManagedPropertyListener("domLayout", e), this.addManagedEventListeners({
      columnContainerWidthChanged: e,
      displayedColumnsChanged: e,
      leftPinnedWidthChanged: e
    }), this.addSpacer && this.addManagedEventListeners({
      rightPinnedWidthChanged: e,
      scrollVisibilityChanged: e,
      scrollbarWidthChanged: e
    }), this.setWidth();
  }
  setWidth() {
    const e = Ie(this.gos, "print"), { visibleCols: t, scrollVisibleSvc: s } = this.beans, i = t.bodyWidth, r = t.getColsLeftWidth(), n = t.getDisplayedColumnsRightWidth();
    let o;
    e ? o = i + r + n : (o = i, this.addSpacer && (this.gos.get("enableRtl") ? r : n) === 0 && s.verticalScrollShowing && (o += s.getScrollbarWidth())), this.callback(o);
  }
}, wS = class extends R {
  constructor(e) {
    super(), this.centerContainerCtrl = e;
  }
  wireBeans(e) {
    this.scrollVisibleSvc = e.scrollVisibleSvc;
  }
  postConstruct() {
    this.beans.ctrlsSvc.whenReady(this, (e) => {
      this.gridBodyCtrl = e.gridBodyCtrl, this.listenForResize();
    }), this.addManagedEventListeners({ scrollbarWidthChanged: this.onScrollbarWidthChanged.bind(this) }), this.addManagedPropertyListeners(["alwaysShowHorizontalScroll", "alwaysShowVerticalScroll"], () => {
      this.checkViewportAndScrolls();
    });
  }
  listenForResize() {
    const { beans: e, centerContainerCtrl: t, gridBodyCtrl: s } = this, i = () => {
      xt(e, () => {
        this.onCenterViewportResized();
      });
    };
    t.registerViewportResizeListener(i), s.registerBodyViewportResizeListener(i);
  }
  onScrollbarWidthChanged() {
    this.checkViewportAndScrolls();
  }
  onCenterViewportResized() {
    if (this.scrollVisibleSvc.updateScrollGap(), this.centerContainerCtrl.isViewportInTheDOMTree()) {
      const { pinnedCols: e, colFlex: t } = this.beans;
      e == null || e.keepPinnedColumnsNarrowerThanViewport(), this.checkViewportAndScrolls();
      const s = this.centerContainerCtrl.getCenterWidth();
      s !== this.centerWidth && (this.centerWidth = s, t == null || t.refreshFlexedColumns({
        viewportWidth: this.centerWidth,
        updateBodyWidths: !0,
        fireResizedEvent: !0
      }));
    } else
      this.bodyHeight = 0;
  }
  // gets called every time the viewport size changes. we use this to check visibility of scrollbars
  // in the grid panel, and also to check size and position of viewport for row and column virtualisation.
  checkViewportAndScrolls() {
    this.updateScrollVisibleService(), this.checkBodyHeight(), this.onHorizontalViewportChanged(), this.gridBodyCtrl.scrollFeature.checkScrollLeft();
  }
  getBodyHeight() {
    return this.bodyHeight;
  }
  checkBodyHeight() {
    const e = this.gridBodyCtrl.eBodyViewport, t = ia(e);
    this.bodyHeight !== t && (this.bodyHeight = t, this.eventSvc.dispatchEvent({
      type: "bodyHeightChanged"
    }));
  }
  updateScrollVisibleService() {
    this.updateScrollVisibleServiceImpl(), setTimeout(this.updateScrollVisibleServiceImpl.bind(this), 500);
  }
  updateScrollVisibleServiceImpl() {
    if (!this.isAlive())
      return;
    const e = {
      horizontalScrollShowing: this.centerContainerCtrl.isHorizontalScrollShowing(),
      verticalScrollShowing: this.gridBodyCtrl.isVerticalScrollShowing()
    };
    this.scrollVisibleSvc.setScrollsVisible(e);
  }
  // this gets called whenever a change in the viewport, so we can inform column controller it has to work
  // out the virtual columns again. gets called from following locations:
  // + ensureColVisible, scroll, init, layoutChanged, displayedColumnsChanged
  onHorizontalViewportChanged() {
    const e = this.centerContainerCtrl.getCenterWidth(), t = this.centerContainerCtrl.getViewportScrollLeft();
    this.beans.colViewport.setScrollPosition(e, t);
  }
};
function ro(e, t, s, i) {
  var n;
  const r = (n = t.getColDef().cellRendererParams) == null ? void 0 : n.suppressMouseEventHandling;
  return nf(e, t, s, i, r);
}
function bS(e, t, s, i) {
  const r = t == null ? void 0 : t.suppressMouseEventHandling;
  return nf(e, void 0, s, i, r);
}
function nf(e, t, s, i, r) {
  return r ? r(
    V(e, {
      column: t,
      node: s,
      event: i
    })
  ) : !1;
}
function of(e, t, s) {
  let i = t;
  for (; i; ) {
    const r = Jg(e, i, s);
    if (r)
      return r;
    i = i.parentElement;
  }
  return null;
}
var Go = "cellCtrl";
function ba(e, t) {
  return of(e, t, Go);
}
var Oo = "renderedRow";
function af(e, t) {
  return of(e, t, Oo);
}
function ec(e, t, s, i, r) {
  const n = i ? i.getColDef().suppressKeyboardEvent : void 0;
  if (!n)
    return !1;
  const o = V(e, {
    event: t,
    editing: r,
    column: i,
    node: s,
    data: s.data,
    colDef: i.getColDef()
  });
  return !!(n && n(o));
}
function lf(e) {
  const { pinnedRowModel: t, rowModel: s } = e, [i, r] = [
    (t == null ? void 0 : t.isEmpty("top")) ?? !0,
    (t == null ? void 0 : t.isEmpty("bottom")) ?? !0
  ], n = i ? null : "top";
  let o, a;
  r ? (o = null, a = s.getRowCount() - 1) : (o = "bottom", a = (t == null ? void 0 : t.getPinnedBottomRowCount()) ?? -1);
  const { visibleCols: l, rangeSvc: c } = e, d = l.allCols;
  !c || !(d != null && d.length) || c.setCellRange({
    rowStartIndex: 0,
    rowStartPinned: n,
    rowEndIndex: a,
    rowEndPinned: o
  });
}
var yS = 65, SS = 67, xS = 86, FS = 68, RS = 90, PS = 89;
function ES(e) {
  const { keyCode: t } = e;
  let s;
  switch (t) {
    case yS:
      s = S.A;
      break;
    case SS:
      s = S.C;
      break;
    case xS:
      s = S.V;
      break;
    case FS:
      s = S.D;
      break;
    case RS:
      s = S.Z;
      break;
    case PS:
      s = S.Y;
      break;
    default:
      s = e.code;
  }
  return s;
}
var TS = class extends R {
  constructor(e) {
    super(), this.element = e;
  }
  postConstruct() {
    var e;
    this.addKeyboardListeners(), this.addMouseListeners(), (e = this.beans.touchSvc) == null || e.mockRowContextMenu(this), this.editSvc = this.beans.editSvc;
  }
  addKeyboardListeners() {
    const e = "keydown", t = this.processKeyboardEvent.bind(this, e);
    this.addManagedElementListeners(this.element, { [e]: t });
  }
  addMouseListeners() {
    ["dblclick", "contextmenu", "mouseover", "mouseout", "click", zg("touchstart") ? "touchstart" : "mousedown"].forEach((s) => {
      const i = this.processMouseEvent.bind(this, s);
      this.addManagedElementListeners(this.element, { [s]: i });
    });
  }
  processMouseEvent(e, t) {
    var r;
    if (!tn(this.beans, t) || St(t))
      return;
    const { cellCtrl: s, rowCtrl: i } = this.getControlsForEventTarget(t.target);
    e === "contextmenu" ? (s != null && s.column && s.dispatchCellContextMenuEvent(t), (r = this.beans.contextMenuSvc) == null || r.handleContextMenuMouseEvent(t, void 0, i, s)) : (s && s.onMouseEvent(e, t), i && i.onMouseEvent(e, t));
  }
  getControlsForEventTarget(e) {
    const { gos: t } = this;
    return {
      cellCtrl: ba(t, e),
      rowCtrl: af(t, e)
    };
  }
  processKeyboardEvent(e, t) {
    const { cellCtrl: s, rowCtrl: i } = this.getControlsForEventTarget(t.target);
    t.defaultPrevented || (s ? this.processCellKeyboardEvent(s, e, t) : i != null && i.isFullWidth() && this.processFullWidthRowKeyboardEvent(i, e, t));
  }
  processCellKeyboardEvent(e, t, s) {
    var n, o;
    const i = ((n = this.editSvc) == null ? void 0 : n.isEditing(e, { withOpenEditor: !0 })) ?? !1;
    !ec(
      this.gos,
      s,
      e.rowNode,
      e.column,
      i
    ) && t === "keydown" && (!i && ((o = this.beans.navigation) != null && o.handlePageScrollingKey(s)) || e.onKeyDown(s), this.doGridOperations(s, i), td(s) && e.processCharacter(s)), t === "keydown" && this.eventSvc.dispatchEvent(e.createEvent(s, "cellKeyDown"));
  }
  processFullWidthRowKeyboardEvent(e, t, s) {
    const { rowNode: i } = e, { focusSvc: r, navigation: n } = this.beans, o = r.getFocusedCell(), a = o == null ? void 0 : o.column;
    if (!ec(this.gos, s, i, a, !1)) {
      const c = s.key;
      if (t === "keydown")
        switch (c) {
          case S.PAGE_HOME:
          case S.PAGE_END:
          case S.PAGE_UP:
          case S.PAGE_DOWN:
            n == null || n.handlePageScrollingKey(s, !0);
            break;
          case S.LEFT:
          case S.RIGHT:
            if (!this.gos.get("embedFullWidthRows"))
              break;
          case S.UP:
          case S.DOWN:
            e.onKeyboardNavigate(s);
            break;
          case S.TAB:
            e.onTabKeyDown(s);
            break;
        }
    }
    t === "keydown" && this.eventSvc.dispatchEvent(e.createRowEvent("cellKeyDown", s));
  }
  doGridOperations(e, t) {
    if (!e.ctrlKey && !e.metaKey || t || !tn(this.beans, e))
      return;
    const s = ES(e), { clipboardSvc: i, undoRedo: r } = this.beans;
    if (s === S.A)
      return this.onCtrlAndA(e);
    if (s === S.C)
      return this.onCtrlAndC(i, e);
    if (s === S.D)
      return this.onCtrlAndD(i, e);
    if (s === S.V)
      return this.onCtrlAndV(i, e);
    if (s === S.X)
      return this.onCtrlAndX(i, e);
    if (s === S.Y)
      return this.onCtrlAndY(r);
    if (s === S.Z)
      return this.onCtrlAndZ(r, e);
  }
  onCtrlAndA(e) {
    const {
      beans: { rowModel: t, rangeSvc: s, selectionSvc: i },
      gos: r
    } = this;
    s && et(r) && t.isRowsToRender() ? lf(this.beans) : i && (i == null || i.selectAllRowNodes({ source: "keyboardSelectAll", selectAll: ip(r) })), e.preventDefault();
  }
  onCtrlAndC(e, t) {
    var i;
    if (!e || this.gos.get("enableCellTextSelection"))
      return;
    const { cellCtrl: s } = this.getControlsForEventTarget(t.target);
    (i = this.editSvc) != null && i.isEditing(s, { withOpenEditor: !0 }) || (t.preventDefault(), e.copyToClipboard());
  }
  onCtrlAndX(e, t) {
    var i;
    if (!e || this.gos.get("enableCellTextSelection") || this.gos.get("suppressCutToClipboard"))
      return;
    const { cellCtrl: s } = this.getControlsForEventTarget(t.target);
    (i = this.editSvc) != null && i.isEditing(s, { withOpenEditor: !0 }) || (t.preventDefault(), e.cutToClipboard(void 0, "ui"));
  }
  onCtrlAndV(e, t) {
    var i;
    const { cellCtrl: s } = this.getControlsForEventTarget(t.target);
    (i = this.editSvc) != null && i.isEditing(s, { withOpenEditor: !0 }) || e && !this.gos.get("suppressClipboardPaste") && e.pasteFromClipboard();
  }
  onCtrlAndD(e, t) {
    e && !this.gos.get("suppressClipboardPaste") && e.copyRangeDown(), t.preventDefault();
  }
  onCtrlAndZ(e, t) {
    !this.gos.get("undoRedoCellEditing") || !e || (t.preventDefault(), t.shiftKey ? e.redo("ui") : e.undo("ui"));
  }
  onCtrlAndY(e) {
    e == null || e.redo("ui");
  }
}, cf = class extends R {
  constructor(e, t) {
    super(), this.eContainer = e, this.eViewport = t;
  }
  postConstruct() {
    this.addManagedEventListeners({
      rowContainerHeightChanged: this.onHeightChanged.bind(this, this.beans.rowContainerHeight)
    });
  }
  onHeightChanged(e) {
    const t = e.uiContainerHeight, s = t != null ? `${t}px` : "";
    this.eContainer.style.height = s, this.eViewport && (this.eViewport.style.height = s);
  }
}, Vn = (e) => e.topRowCtrls, Bn = (e) => e.getStickyTopRowCtrls(), Nn = (e) => e.getStickyBottomRowCtrls(), Hn = (e) => e.bottomRowCtrls, zn = (e) => e.allRowCtrls, el = (e) => e.getCtrls("top"), tl = (e) => e.getCtrls("center"), sl = (e) => e.getCtrls("bottom"), MS = {
  center: {
    type: "center",
    name: "center-cols",
    getRowCtrls: zn,
    getSpannedRowCtrls: tl
  },
  left: {
    type: "left",
    name: "pinned-left-cols",
    pinnedType: "left",
    getRowCtrls: zn,
    getSpannedRowCtrls: tl
  },
  right: {
    type: "right",
    name: "pinned-right-cols",
    pinnedType: "right",
    getRowCtrls: zn,
    getSpannedRowCtrls: tl
  },
  fullWidth: {
    type: "fullWidth",
    name: "full-width",
    fullWidth: !0,
    getRowCtrls: zn
  },
  topCenter: {
    type: "center",
    name: "floating-top",
    getRowCtrls: Vn,
    getSpannedRowCtrls: el
  },
  topLeft: {
    type: "left",
    name: "pinned-left-floating",
    container: "ag-pinned-left-floating-top",
    pinnedType: "left",
    getRowCtrls: Vn,
    getSpannedRowCtrls: el
  },
  topRight: {
    type: "right",
    name: "pinned-right-floating",
    container: "ag-pinned-right-floating-top",
    pinnedType: "right",
    getRowCtrls: Vn,
    getSpannedRowCtrls: el
  },
  topFullWidth: {
    type: "fullWidth",
    name: "floating-top-full-width",
    fullWidth: !0,
    getRowCtrls: Vn
  },
  stickyTopCenter: {
    type: "center",
    name: "sticky-top",
    getRowCtrls: Bn
  },
  stickyTopLeft: {
    type: "left",
    name: "pinned-left-sticky-top",
    container: "ag-pinned-left-sticky-top",
    pinnedType: "left",
    getRowCtrls: Bn
  },
  stickyTopRight: {
    type: "right",
    name: "pinned-right-sticky-top",
    container: "ag-pinned-right-sticky-top",
    pinnedType: "right",
    getRowCtrls: Bn
  },
  stickyTopFullWidth: {
    type: "fullWidth",
    name: "sticky-top-full-width",
    fullWidth: !0,
    getRowCtrls: Bn
  },
  stickyBottomCenter: {
    type: "center",
    name: "sticky-bottom",
    getRowCtrls: Nn
  },
  stickyBottomLeft: {
    type: "left",
    name: "pinned-left-sticky-bottom",
    container: "ag-pinned-left-sticky-bottom",
    pinnedType: "left",
    getRowCtrls: Nn
  },
  stickyBottomRight: {
    type: "right",
    name: "pinned-right-sticky-bottom",
    container: "ag-pinned-right-sticky-bottom",
    pinnedType: "right",
    getRowCtrls: Nn
  },
  stickyBottomFullWidth: {
    type: "fullWidth",
    name: "sticky-bottom-full-width",
    fullWidth: !0,
    getRowCtrls: Nn
  },
  bottomCenter: {
    type: "center",
    name: "floating-bottom",
    getRowCtrls: Hn,
    getSpannedRowCtrls: sl
  },
  bottomLeft: {
    type: "left",
    name: "pinned-left-floating-bottom",
    container: "ag-pinned-left-floating-bottom",
    pinnedType: "left",
    getRowCtrls: Hn,
    getSpannedRowCtrls: sl
  },
  bottomRight: {
    type: "right",
    name: "pinned-right-floating-bottom",
    container: "ag-pinned-right-floating-bottom",
    pinnedType: "right",
    getRowCtrls: Hn,
    getSpannedRowCtrls: sl
  },
  bottomFullWidth: {
    type: "fullWidth",
    name: "floating-bottom-full-width",
    fullWidth: !0,
    getRowCtrls: Hn
  }
};
function df(e) {
  return `ag-${yn(e).name}-viewport`;
}
function no(e) {
  const t = yn(e);
  return t.container ?? `ag-${t.name}-container`;
}
function DS(e) {
  return `ag-${yn(e).name}-spanned-cells-container`;
}
function yn(e) {
  return MS[e];
}
var AS = ["topCenter", "topLeft", "topRight"], IS = ["bottomCenter", "bottomLeft", "bottomRight"], LS = ["center", "left", "right"], kS = ["center", "left", "right", "fullWidth"], GS = ["stickyTopCenter", "stickyBottomCenter", "center", "topCenter", "bottomCenter"], OS = ["left", "bottomLeft", "topLeft", "stickyTopLeft", "stickyBottomLeft"], VS = ["right", "bottomRight", "topRight", "stickyTopRight", "stickyBottomRight"], hf = ["stickyTopCenter", "stickyTopLeft", "stickyTopRight"], uf = ["stickyBottomCenter", "stickyBottomLeft", "stickyBottomRight"], BS = [
  ...hf,
  "stickyTopFullWidth",
  ...uf,
  "stickyBottomFullWidth"
], NS = [
  ...AS,
  ...IS,
  ...LS,
  ...hf,
  ...uf
], HS = class extends R {
  constructor(e) {
    super(), this.name = e, this.visible = !0, this.EMPTY_CTRLS = [], this.options = yn(e);
  }
  postConstruct() {
    this.enableRtl = this.gos.get("enableRtl"), this.forContainers(["center"], () => {
      this.viewportSizeFeature = this.createManagedBean(new wS(this)), this.addManagedEventListeners({
        stickyTopOffsetChanged: this.onStickyTopOffsetChanged.bind(this)
      });
    });
  }
  onStickyTopOffsetChanged(e) {
    this.comp.setOffsetTop(`${e.offset}px`);
  }
  registerWithCtrlsService() {
    this.options.fullWidth || this.beans.ctrlsSvc.register(this.name, this);
  }
  forContainers(e, t) {
    e.indexOf(this.name) >= 0 && t();
  }
  setComp(e, t, s, i) {
    this.comp = e, this.eContainer = t, this.eSpannedContainer = s, this.eViewport = i, this.createManagedBean(new TS(this.eViewport ?? this.eContainer)), this.addPreventScrollWhileDragging(), this.listenOnDomOrder();
    const { pinnedCols: r, rangeSvc: n } = this.beans, o = () => this.onPinnedWidthChanged();
    this.forContainers(OS, () => {
      this.pinnedWidthFeature = this.createOptionalManagedBean(
        r == null ? void 0 : r.createPinnedWidthFeature(!0, this.eContainer, this.eSpannedContainer)
      ), this.addManagedEventListeners({ leftPinnedWidthChanged: o });
    }), this.forContainers(VS, () => {
      this.pinnedWidthFeature = this.createOptionalManagedBean(
        r == null ? void 0 : r.createPinnedWidthFeature(!1, this.eContainer, this.eSpannedContainer)
      ), this.addManagedEventListeners({ rightPinnedWidthChanged: o });
    }), this.forContainers(
      kS,
      () => this.createManagedBean(
        new cf(this.eContainer, this.name === "center" ? i : void 0)
      )
    ), n && this.forContainers(
      NS,
      () => this.createManagedBean(n.createDragListenerFeature(this.eContainer))
    ), this.forContainers(
      GS,
      () => this.createManagedBean(new gd((a) => this.comp.setContainerWidth(`${a}px`)))
    ), this.visible = this.isContainerVisible(), this.addListeners(), this.registerWithCtrlsService();
  }
  onScrollCallback(e) {
    this.addManagedElementListeners(this.eViewport, { scroll: e });
  }
  addListeners() {
    const { spannedRowRenderer: e, gos: t } = this.beans, s = this.onDisplayedColumnsChanged.bind(this);
    this.addManagedEventListeners({
      displayedColumnsChanged: s,
      displayedColumnsWidthChanged: s,
      displayedRowsChanged: (i) => this.onDisplayedRowsChanged(i.afterScroll)
    }), s(), this.onDisplayedRowsChanged(), e && this.options.getSpannedRowCtrls && t.get("enableCellSpan") && this.addManagedListeners(e, {
      spannedRowsUpdated: () => {
        const i = this.options.getSpannedRowCtrls(e);
        i && this.comp.setSpannedRowCtrls(i, !1);
      }
    });
  }
  listenOnDomOrder() {
    if (BS.indexOf(this.name) >= 0) {
      this.comp.setDomOrder(!0);
      return;
    }
    const t = () => {
      const s = this.gos.get("ensureDomOrder"), i = Ie(this.gos, "print");
      this.comp.setDomOrder(s || i);
    };
    this.addManagedPropertyListener("domLayout", t), t();
  }
  onDisplayedColumnsChanged() {
    this.forContainers(["center"], () => this.onHorizontalViewportChanged());
  }
  // this methods prevents the grid views from being scrolled while the dragService is being used
  // eg. the view should not scroll up and down while dragging rows using the rowDragComp.
  addPreventScrollWhileDragging() {
    const { dragSvc: e } = this.beans;
    if (!e)
      return;
    const t = (s) => {
      e.dragging && s.cancelable && s.preventDefault();
    };
    this.eContainer.addEventListener("touchmove", t, { passive: !1 }), this.addDestroyFunc(() => this.eContainer.removeEventListener("touchmove", t));
  }
  // this gets called whenever a change in the viewport, so we can inform column controller it has to work
  // out the virtual columns again. gets called from following locations:
  // + ensureColVisible, scroll, init, layoutChanged, displayedColumnsChanged
  onHorizontalViewportChanged(e = !1) {
    const t = this.getCenterWidth(), s = this.getCenterViewportScrollLeft();
    this.beans.colViewport.setScrollPosition(t, s, e);
  }
  hasHorizontalScrollGap() {
    return this.eContainer.clientWidth - this.eViewport.clientWidth < 0;
  }
  hasVerticalScrollGap() {
    return this.eContainer.clientHeight - this.eViewport.clientHeight < 0;
  }
  getCenterWidth() {
    return hr(this.eViewport);
  }
  getCenterViewportScrollLeft() {
    return yo(this.eViewport, this.enableRtl);
  }
  registerViewportResizeListener(e) {
    const t = os(this.beans, this.eViewport, e);
    this.addDestroyFunc(() => t());
  }
  isViewportInTheDOMTree() {
    return Og(this.eViewport);
  }
  getViewportScrollLeft() {
    return yo(this.eViewport, this.enableRtl);
  }
  isHorizontalScrollShowing() {
    return this.gos.get("alwaysShowHorizontalScroll") || Vc(this.eViewport);
  }
  setHorizontalScroll(e) {
    this.comp.setHorizontalScroll(e);
  }
  getHScrollPosition() {
    return {
      left: this.eViewport.scrollLeft,
      right: this.eViewport.scrollLeft + this.eViewport.offsetWidth
    };
  }
  setCenterViewportScrollLeft(e) {
    So(this.eViewport, e, this.enableRtl);
  }
  isContainerVisible() {
    return !(this.options.pinnedType != null) || !!this.pinnedWidthFeature && this.pinnedWidthFeature.getWidth() > 0;
  }
  onPinnedWidthChanged() {
    const e = this.isContainerVisible();
    this.visible != e && (this.visible = e, this.onDisplayedRowsChanged());
  }
  onDisplayedRowsChanged(e = !1) {
    const t = this.options.getRowCtrls(this.beans.rowRenderer);
    if (!this.visible || t.length === 0) {
      this.comp.setRowCtrls({ rowCtrls: this.EMPTY_CTRLS });
      return;
    }
    const s = Ie(this.gos, "print"), r = this.gos.get("embedFullWidthRows") || s, n = t.filter((o) => {
      const a = o.isFullWidth();
      return this.options.fullWidth ? !r && a : r || !a;
    });
    this.comp.setRowCtrls({ rowCtrls: n, useFlushSync: e });
  }
}, gf = "ag-force-vertical-scroll", zS = "ag-selectable", WS = "ag-column-moving", _S = class extends R {
  constructor() {
    super(...arguments), this.stickyTopHeight = 0, this.stickyBottomHeight = 0;
  }
  wireBeans(e) {
    this.ctrlsSvc = e.ctrlsSvc, this.colModel = e.colModel, this.scrollVisibleSvc = e.scrollVisibleSvc, this.pinnedRowModel = e.pinnedRowModel, this.filterManager = e.filterManager, this.rowGroupColsSvc = e.rowGroupColsSvc;
  }
  setComp(e, t, s, i, r, n, o) {
    var a, l;
    this.comp = e, this.eGridBody = t, this.eBodyViewport = s, this.eTop = i, this.eBottom = r, this.eStickyTop = n, this.eStickyBottom = o, this.eCenterColsViewport = s.querySelector(`.${df("center")}`), this.eFullWidthContainer = s.querySelector(`.${no("fullWidth")}`), this.eStickyTopFullWidthContainer = n.querySelector(
      `.${no("stickyTopFullWidth")}`
    ), this.eStickyBottomFullWidthContainer = o.querySelector(
      `.${no("stickyBottomFullWidth")}`
    ), this.setCellTextSelection(this.gos.get("enableCellTextSelection")), this.addManagedPropertyListener(
      "enableCellTextSelection",
      (c) => this.setCellTextSelection(c.currentValue)
    ), this.createManagedBean(new ud(this.comp)), this.scrollFeature = this.createManagedBean(new vS(s)), (a = this.beans.rowDragSvc) == null || a.setupRowDrag(s, this), this.setupRowAnimationCssClass(), this.addEventListeners(), this.addFocusListeners([i, s, r, n, o]), this.setGridRootRole(), this.onGridColumnsChanged(), this.addBodyViewportListener(), this.setFloatingHeights(), this.disableBrowserDragging(), this.addStopEditingWhenGridLosesFocus(), this.updateScrollingClasses(), (l = this.filterManager) == null || l.setupAdvFilterHeaderComp(i), this.ctrlsSvc.register("gridBodyCtrl", this);
  }
  addEventListeners() {
    const e = this.setFloatingHeights.bind(this), t = this.setGridRootRole.bind(this), s = this.toggleRowResizeStyles.bind(this);
    this.addManagedEventListeners({
      gridColumnsChanged: this.onGridColumnsChanged.bind(this),
      scrollVisibilityChanged: this.onScrollVisibilityChanged.bind(this),
      scrollGapChanged: this.updateScrollingClasses.bind(this),
      pinnedRowDataChanged: e,
      pinnedHeightChanged: e,
      pinnedRowsChanged: e,
      headerHeightChanged: this.setStickyTopOffsetTop.bind(this),
      columnRowGroupChanged: t,
      columnPivotChanged: t,
      rowResizeStarted: s,
      rowResizeEnded: s
    }), this.addManagedPropertyListener("treeData", t);
  }
  toggleRowResizeStyles(e) {
    const t = e.type === "rowResizeStarted";
    this.eBodyViewport.classList.toggle("ag-prevent-animation", t);
  }
  onGridColumnsChanged() {
    const e = this.beans.colModel.getCols();
    this.comp.setColumnCount(e.length);
  }
  onScrollVisibilityChanged() {
    const { scrollVisibleSvc: e } = this, t = e.verticalScrollShowing;
    this.setVerticalScrollPaddingVisible(t), this.setStickyWidth(t), this.setStickyBottomOffsetBottom();
    const s = t && e.getScrollbarWidth() || 0, i = kp() ? 16 : 0, r = `calc(100% + ${s + i}px)`;
    xt(this.beans, () => this.comp.setBodyViewportWidth(r)), this.updateScrollingClasses();
  }
  setGridRootRole() {
    const { rowGroupColsSvc: e, colModel: t } = this;
    let s = this.gos.get("treeData");
    if (!s) {
      const i = t.isPivotMode();
      s = (e ? e.columns.length : 0) >= (i ? 2 : 1);
    }
    this.comp.setGridRootRole(s ? "treegrid" : "grid");
  }
  addFocusListeners(e) {
    e.forEach((t) => {
      this.addManagedElementListeners(t, {
        focusin: (s) => {
          const { target: i } = s, r = mi(i, "ag-root", t);
          t.classList.toggle("ag-has-focus", !r);
        },
        focusout: (s) => {
          const { target: i, relatedTarget: r } = s, n = t.contains(r), o = mi(
            r,
            "ag-root",
            t
          );
          mi(i, "ag-root", t) || (!n || o) && t.classList.remove("ag-has-focus");
        }
      });
    });
  }
  // used by ColumnAnimationService
  setColumnMovingCss(e) {
    this.comp.setColumnMovingCss(WS, e);
  }
  setCellTextSelection(e = !1) {
    this.comp.setCellSelectableCss(zS, e);
  }
  updateScrollingClasses() {
    const {
      eGridBody: { classList: e },
      scrollVisibleSvc: t
    } = this;
    e.toggle("ag-body-vertical-content-no-gap", !t.verticalScrollGap), e.toggle("ag-body-horizontal-content-no-gap", !t.horizontalScrollGap);
  }
  // if we do not do this, then the user can select a pic in the grid (eg an image in a custom cell renderer)
  // and then that will start the browser native drag n' drop, which messes up with our own drag and drop.
  disableBrowserDragging() {
    this.addManagedElementListeners(this.eGridBody, {
      dragstart: (e) => {
        if (e.target instanceof HTMLImageElement)
          return e.preventDefault(), !1;
      }
    });
  }
  addStopEditingWhenGridLosesFocus() {
    var e;
    (e = this.beans.editSvc) == null || e.addStopEditingWhenGridLosesFocus([
      this.eBodyViewport,
      this.eBottom,
      this.eTop,
      this.eStickyTop,
      this.eStickyBottom
    ]);
  }
  updateRowCount() {
    var r, n;
    const e = (((r = this.ctrlsSvc.getHeaderRowContainerCtrl()) == null ? void 0 : r.getRowCount()) ?? 0) + (((n = this.filterManager) == null ? void 0 : n.getHeaderRowCount()) ?? 0), { rowModel: t } = this.beans, s = t.isLastRowIndexKnown() ? t.getRowCount() : -1, i = s === -1 ? -1 : e + s;
    this.comp.setRowCount(i);
  }
  registerBodyViewportResizeListener(e) {
    this.comp.registerBodyViewportResizeListener(e);
  }
  setVerticalScrollPaddingVisible(e) {
    const t = e ? "scroll" : "hidden";
    this.comp.setPinnedTopBottomOverflowY(t);
  }
  isVerticalScrollShowing() {
    const e = this.gos.get("alwaysShowVerticalScroll"), t = e ? gf : null, s = Ie(this.gos, "normal");
    return this.comp.setAlwaysVerticalScrollClass(t, e), e || s && Ng(this.eBodyViewport);
  }
  setupRowAnimationCssClass() {
    const { rowContainerHeight: e, environment: t } = this.beans;
    let s = t.sizesMeasured;
    const i = () => {
      const r = s && sr(this.gos) && !e.stretching, n = r ? "ag-row-animation" : "ag-row-no-animation";
      this.comp.setRowAnimationCssOnBodyViewport(n, r);
    };
    i(), this.addManagedEventListeners({ heightScaleChanged: i }), this.addManagedPropertyListener("animateRows", i), this.addManagedEventListeners({
      gridStylesChanged: () => {
        !s && t.sizesMeasured && (s = !0, i());
      }
    });
  }
  addBodyViewportListener() {
    const {
      eBodyViewport: e,
      eStickyTop: t,
      eStickyBottom: s,
      eTop: i,
      eBottom: r,
      beans: { popupSvc: n, touchSvc: o }
    } = this, a = this.onBodyViewportContextMenu.bind(this);
    this.addManagedElementListeners(e, { contextmenu: a }), o == null || o.mockBodyContextMenu(this, a), this.addManagedElementListeners(e, {
      wheel: this.onBodyViewportWheel.bind(this, n)
    });
    const l = this.onStickyWheel.bind(this);
    for (const d of [t, s, i, r])
      this.addManagedElementListeners(d, { wheel: l });
    const c = this.onHorizontalWheel.bind(this);
    for (const d of ["left", "right", "topLeft", "topRight", "bottomLeft", "bottomRight"])
      this.addManagedElementListeners(this.ctrlsSvc.get(d).eContainer, {
        wheel: c
      });
    this.addFullWidthContainerWheelListener();
  }
  addFullWidthContainerWheelListener() {
    this.addManagedElementListeners(this.eFullWidthContainer, {
      wheel: (e) => this.onFullWidthContainerWheel(e)
    });
  }
  onFullWidthContainerWheel(e) {
    const { deltaX: t, deltaY: s, shiftKey: i } = e;
    (i || Math.abs(t) > Math.abs(s)) && tn(this.beans, e) && this.scrollGridBodyToMatchEvent(e);
  }
  onStickyWheel(e) {
    const { deltaY: t } = e;
    this.scrollVertically(t) > 0 && e.preventDefault();
  }
  onHorizontalWheel(e) {
    const { deltaX: t, deltaY: s, shiftKey: i } = e;
    (i || Math.abs(t) > Math.abs(s)) && this.scrollGridBodyToMatchEvent(e);
  }
  scrollGridBodyToMatchEvent(e) {
    const { deltaX: t, deltaY: s } = e;
    e.preventDefault(), this.eCenterColsViewport.scrollBy({ left: t || s });
  }
  onBodyViewportContextMenu(e, t, s) {
    var r;
    if (!e && !s)
      return;
    this.gos.get("preventDefaultOnContextMenu") && (e || s).preventDefault();
    const { target: i } = e || t;
    (i === this.eBodyViewport || i === this.ctrlsSvc.get("center").eViewport) && ((r = this.beans.contextMenuSvc) == null || r.showContextMenu({
      mouseEvent: e,
      touchEvent: s,
      value: null,
      anchorToElement: this.eGridBody,
      source: "ui"
    }));
  }
  onBodyViewportWheel(e, t) {
    this.gos.get("suppressScrollWhenPopupsAreOpen") && e != null && e.hasAnchoredPopup() && t.preventDefault();
  }
  // called by rowDragFeature
  scrollVertically(e) {
    const t = this.eBodyViewport.scrollTop;
    return this.scrollFeature.setVerticalScrollPosition(t + e), this.eBodyViewport.scrollTop - t;
  }
  setFloatingHeights() {
    const {
      pinnedRowModel: e,
      beans: { environment: t }
    } = this, s = e == null ? void 0 : e.getPinnedTopTotalHeight(), i = e == null ? void 0 : e.getPinnedBottomTotalHeight(), r = t.getPinnedRowBorderWidth(), n = t.getRowBorderWidth(), o = r - n, a = s ? o + s : 0, l = i ? o + i : 0;
    this.comp.setTopHeight(a), this.comp.setBottomHeight(l), this.comp.setTopInvisible(a <= 0), this.comp.setBottomInvisible(l <= 0), this.setStickyTopOffsetTop(), this.setStickyBottomOffsetBottom();
  }
  setStickyTopHeight(e = 0) {
    this.comp.setStickyTopHeight(`${e}px`), this.stickyTopHeight = e;
  }
  setStickyBottomHeight(e = 0) {
    this.comp.setStickyBottomHeight(`${e}px`), this.stickyBottomHeight = e;
  }
  setStickyWidth(e) {
    if (!e)
      this.comp.setStickyTopWidth("100%"), this.comp.setStickyBottomWidth("100%");
    else {
      const t = this.scrollVisibleSvc.getScrollbarWidth();
      this.comp.setStickyTopWidth(`calc(100% - ${t}px)`), this.comp.setStickyBottomWidth(`calc(100% - ${t}px)`);
    }
  }
  setStickyTopOffsetTop() {
    var r, n;
    const t = this.ctrlsSvc.get("gridHeaderCtrl").headerHeight + (((r = this.filterManager) == null ? void 0 : r.getHeaderHeight()) ?? 0), s = ((n = this.pinnedRowModel) == null ? void 0 : n.getPinnedTopTotalHeight()) ?? 0;
    let i = 0;
    t > 0 && (i += t), s > 0 && (i += s), i > 0 && (i += 1), this.comp.setStickyTopTop(`${i}px`);
  }
  setStickyBottomOffsetBottom() {
    const { pinnedRowModel: e, scrollVisibleSvc: t, comp: s } = this, i = (e == null ? void 0 : e.getPinnedBottomTotalHeight()) ?? 0, n = t.horizontalScrollShowing && t.getScrollbarWidth() || 0, o = i + n;
    s.setStickyBottomBottom(`${o}px`);
  }
};
function pf(e, t) {
  var s;
  return ((s = ba(e, t.target)) == null ? void 0 : s.getFocusedCellPosition()) ?? null;
}
function Vo(e, t) {
  const s = Ie(e.gos, "normal"), i = t;
  let r, n;
  i.clientX != null || i.clientY != null ? (r = i.clientX, n = i.clientY) : (r = i.x, n = i.y);
  const { pageFirstPixel: o } = e.pageBounds.getCurrentPagePixelRange();
  if (n += o, s) {
    const a = e.ctrlsSvc.getScrollFeature(), l = a.getVScrollPosition(), c = a.getHScrollPosition();
    r += c.left, n += l.top;
  }
  return { x: r, y: n };
}
var ff = class extends D {
  constructor(e, t) {
    super(), this.direction = t, this.eViewport = x, this.eContainer = x, this.hideTimeout = 0, this.setTemplate(e);
  }
  postConstruct() {
    this.addManagedEventListeners({
      scrollVisibilityChanged: this.onScrollVisibilityChanged.bind(this)
    }), this.onScrollVisibilityChanged(), this.toggleCss("ag-apple-scrollbar", Ip() || Xs());
  }
  destroy() {
    super.destroy(), window.clearTimeout(this.hideTimeout);
  }
  initialiseInvisibleScrollbar() {
    this.invisibleScrollbar === void 0 && (this.invisibleScrollbar = kp(), this.invisibleScrollbar && (this.hideAndShowInvisibleScrollAsNeeded(), this.addActiveListenerToggles()));
  }
  addActiveListenerToggles() {
    const e = this.getGui(), t = () => this.toggleCss("ag-scrollbar-active", !0), s = () => this.toggleCss("ag-scrollbar-active", !1);
    this.addManagedListeners(e, {
      mouseenter: t,
      mousedown: t,
      touchstart: t,
      mouseleave: s,
      touchend: s
    });
  }
  onScrollVisibilityChanged() {
    this.invisibleScrollbar === void 0 && this.initialiseInvisibleScrollbar(), xt(this.beans, () => this.setScrollVisible());
  }
  hideAndShowInvisibleScrollAsNeeded() {
    this.addManagedEventListeners({
      bodyScroll: (e) => {
        e.direction === this.direction && (this.hideTimeout && (window.clearTimeout(this.hideTimeout), this.hideTimeout = 0), this.toggleCss("ag-scrollbar-scrolling", !0));
      },
      bodyScrollEnd: () => {
        this.hideTimeout = window.setTimeout(() => {
          this.toggleCss("ag-scrollbar-scrolling", !1), this.hideTimeout = 0;
        }, 400);
      }
    });
  }
  attemptSettingScrollPosition(e) {
    const t = this.eViewport;
    Ug(
      this,
      () => Ze(t),
      () => this.setScrollPosition(e),
      100
    );
  }
  onScrollCallback(e) {
    this.addManagedElementListeners(this.eViewport, { scroll: e });
  }
}, US = {
  tag: "div",
  cls: "ag-body-horizontal-scroll",
  attrs: { "aria-hidden": "true" },
  children: [
    { tag: "div", ref: "eLeftSpacer", cls: "ag-horizontal-left-spacer" },
    {
      tag: "div",
      ref: "eViewport",
      cls: "ag-body-horizontal-scroll-viewport",
      children: [{ tag: "div", ref: "eContainer", cls: "ag-body-horizontal-scroll-container" }]
    },
    { tag: "div", ref: "eRightSpacer", cls: "ag-horizontal-right-spacer" }
  ]
}, $S = class extends ff {
  constructor() {
    super(US, "horizontal"), this.eLeftSpacer = x, this.eRightSpacer = x, this.setScrollVisibleDebounce = 0;
  }
  wireBeans(e) {
    this.visibleCols = e.visibleCols, this.scrollVisibleSvc = e.scrollVisibleSvc;
  }
  postConstruct() {
    super.postConstruct();
    const e = this.setFakeHScrollSpacerWidths.bind(this);
    this.addManagedEventListeners({
      displayedColumnsChanged: e,
      displayedColumnsWidthChanged: e,
      pinnedRowDataChanged: this.refreshCompBottom.bind(this)
    }), this.addManagedPropertyListener("domLayout", e), this.beans.ctrlsSvc.register("fakeHScrollComp", this), this.createManagedBean(new gd((t) => this.eContainer.style.width = `${t}px`)), this.addManagedPropertyListeners(["suppressHorizontalScroll"], this.onScrollVisibilityChanged.bind(this));
  }
  destroy() {
    window.clearTimeout(this.setScrollVisibleDebounce), super.destroy();
  }
  initialiseInvisibleScrollbar() {
    this.invisibleScrollbar === void 0 && (this.enableRtl = this.gos.get("enableRtl"), super.initialiseInvisibleScrollbar(), this.invisibleScrollbar && this.refreshCompBottom());
  }
  refreshCompBottom() {
    var t;
    if (!this.invisibleScrollbar)
      return;
    const e = ((t = this.beans.pinnedRowModel) == null ? void 0 : t.getPinnedBottomTotalHeight()) ?? 0;
    this.getGui().style.bottom = `${e}px`;
  }
  onScrollVisibilityChanged() {
    super.onScrollVisibilityChanged(), this.setFakeHScrollSpacerWidths();
  }
  setFakeHScrollSpacerWidths() {
    const e = this.scrollVisibleSvc.verticalScrollShowing;
    let t = this.visibleCols.getDisplayedColumnsRightWidth();
    const s = !this.enableRtl && e, i = this.scrollVisibleSvc.getScrollbarWidth();
    s && (t += i), Ot(this.eRightSpacer, t), this.eRightSpacer.classList.toggle("ag-scroller-corner", t <= i);
    let r = this.visibleCols.getColsLeftWidth();
    this.enableRtl && e && (r += i), Ot(this.eLeftSpacer, r), this.eLeftSpacer.classList.toggle("ag-scroller-corner", r <= i);
  }
  setScrollVisible() {
    const e = this.scrollVisibleSvc.horizontalScrollShowing, t = this.invisibleScrollbar, s = this.gos.get("suppressHorizontalScroll"), i = e && this.scrollVisibleSvc.getScrollbarWidth() || 0, n = s ? 0 : i === 0 && t ? 16 : i, o = () => {
      this.setScrollVisibleDebounce = 0, this.toggleCss("ag-scrollbar-invisible", t), Ur(this.getGui(), n), Ur(this.eViewport, n), Ur(this.eContainer, n), n || this.eContainer.style.setProperty("min-height", "1px"), this.setVisible(e, { skipAriaHidden: !0 });
    };
    window.clearTimeout(this.setScrollVisibleDebounce), e ? this.setScrollVisibleDebounce = window.setTimeout(o, 100) : o();
  }
  getScrollPosition() {
    return yo(this.eViewport, this.enableRtl);
  }
  setScrollPosition(e) {
    Ze(this.eViewport) || this.attemptSettingScrollPosition(e), So(this.eViewport, e, this.enableRtl);
  }
}, KS = {
  selector: "AG-FAKE-HORIZONTAL-SCROLL",
  component: $S
}, jS = {
  tag: "div",
  cls: "ag-body-vertical-scroll",
  attrs: { "aria-hidden": "true" },
  children: [
    {
      tag: "div",
      ref: "eViewport",
      cls: "ag-body-vertical-scroll-viewport",
      children: [{ tag: "div", ref: "eContainer", cls: "ag-body-vertical-scroll-container" }]
    }
  ]
}, YS = class extends ff {
  constructor() {
    super(jS, "vertical");
  }
  postConstruct() {
    super.postConstruct(), this.createManagedBean(new cf(this.eContainer));
    const { ctrlsSvc: e } = this.beans;
    e.register("fakeVScrollComp", this), this.addManagedEventListeners({
      rowContainerHeightChanged: this.onRowContainerHeightChanged.bind(this, e)
    });
  }
  setScrollVisible() {
    const { scrollVisibleSvc: e } = this.beans, t = e.verticalScrollShowing, s = this.invisibleScrollbar, i = t && e.getScrollbarWidth() || 0, r = i === 0 && s ? 16 : i;
    this.toggleCss("ag-scrollbar-invisible", s), Ot(this.getGui(), r), Ot(this.eViewport, r), Ot(this.eContainer, r), this.setDisplayed(t, { skipAriaHidden: !0 });
  }
  onRowContainerHeightChanged(e) {
    const s = e.getGridBodyCtrl().eBodyViewport, i = this.getScrollPosition(), r = s.scrollTop;
    i != r && this.setScrollPosition(r, !0);
  }
  getScrollPosition() {
    return this.eViewport.scrollTop;
  }
  setScrollPosition(e, t) {
    !t && !Ze(this.eViewport) && this.attemptSettingScrollPosition(e), this.eViewport.scrollTop = e;
  }
}, qS = {
  selector: "AG-FAKE-VERTICAL-SCROLL",
  component: YS
}, XS = "ag-column-first", ZS = "ag-column-last";
function pd(e, t, s, i) {
  return ee(e) ? [] : vf(e.headerClass, e, t, s, i);
}
function mf(e, t, s, i) {
  return ee(e) ? [] : vf(e.toolPanelClass, e, t, s, i);
}
function Cf(e, t, s) {
  e.toggleCss(XS, s.isColAtEdge(t, "first")), e.toggleCss(ZS, s.isColAtEdge(t, "last"));
}
function QS(e, t, s, i) {
  return V(t, {
    // bad naming, as colDef here can be a group or a column,
    // however most people won't appreciate the difference,
    // so keeping it as colDef to avoid confusion.
    colDef: e,
    column: s,
    columnGroup: i
  });
}
function vf(e, t, s, i, r) {
  if (ee(e))
    return [];
  let n;
  if (typeof e == "function") {
    const o = QS(t, s, i, r);
    n = e(o);
  } else
    n = e;
  return typeof n == "string" ? [n] : Array.isArray(n) ? [...n] : [];
}
function wf(e, t, s) {
  t.addManagedElementListeners(s, {
    keydown: (i) => {
      if (!i.defaultPrevented && i.key === S.TAB) {
        const r = i.shiftKey;
        ze(e, s, !1, r) || rs(e, r) && i.preventDefault();
      }
    }
  });
}
function bf(e, t) {
  return e.ctrlsSvc.get("gridCtrl").focusInnerElement(t);
}
function wi(e) {
  var t;
  return e.gos.get("suppressHeaderFocus") || !!((t = e.overlays) != null && t.isExclusive());
}
function ya(e) {
  var t;
  return e.gos.get("suppressCellFocus") || !!((t = e.overlays) != null && t.isExclusive());
}
function rs(e, t, s = !1) {
  const i = e.ctrlsSvc.get("gridCtrl");
  return !s && i.focusNextInnerContainer(t) ? !0 : ((s || !t && !i.isDetailGrid()) && i.forceFocusOutOfContainer(t), !1);
}
function JS(e) {
  return e.cols ? e.cols.treeDepth + 1 : -1;
}
function Yt(e) {
  var t;
  return ((t = e.ctrlsSvc.getHeaderRowContainerCtrl()) == null ? void 0 : t.getRowCount()) ?? 0;
}
function fd(e) {
  const t = [], s = e.ctrlsSvc.getHeaderRowContainerCtrls();
  for (const i of s) {
    if (!i)
      continue;
    const r = i.getGroupRowCount() || 0;
    for (let n = 0; n < r; n++) {
      const o = i.getGroupRowCtrlAtIndex(n), a = t[n];
      if (o) {
        const l = ex(e, o);
        (a == null || l > a) && (t[n] = l);
      }
    }
  }
  return t;
}
function ex(e, t) {
  let i = e.colModel.isPivotMode() ? sx(e) : yf(e);
  const r = t.getHeaderCellCtrls();
  for (const n of r) {
    const { column: o } = n, a = o.getAutoHeaderHeight();
    a != null && a > i && o.isAutoHeaderHeight() && (i = a);
  }
  return i;
}
function md(e) {
  let s = e.colModel.isPivotMode() ? tx(e) : Sn(e);
  return e.colModel.forAllCols((i) => {
    const r = i.getAutoHeaderHeight();
    r != null && r > s && i.isAutoHeaderHeight() && (s = r);
  }), s;
}
function Sn(e) {
  return e.gos.get("headerHeight") ?? e.environment.getDefaultHeaderHeight();
}
function Cd(e) {
  return e.gos.get("floatingFiltersHeight") ?? Sn(e);
}
function yf(e) {
  return e.gos.get("groupHeaderHeight") ?? Sn(e);
}
function tx(e) {
  return e.gos.get("pivotHeaderHeight") ?? Sn(e);
}
function sx(e) {
  return e.gos.get("pivotGroupHeaderHeight") ?? yf(e);
}
var ix = class extends R {
  setComp(e, t, s) {
    this.comp = e, this.eGui = t;
    const { beans: i } = this, { headerNavigation: r, touchSvc: n, ctrlsSvc: o } = i;
    r && this.createManagedBean(
      new ii(s, {
        onTabKeyDown: this.onTabKeyDown.bind(this),
        handleKeyDown: this.handleKeyDown.bind(this),
        onFocusOut: this.onFocusOut.bind(this)
      })
    ), this.addManagedEventListeners({
      columnPivotModeChanged: this.onPivotModeChanged.bind(this, i),
      displayedColumnsChanged: this.onDisplayedColumnsChanged.bind(this, i)
    }), this.onPivotModeChanged(i), this.setupHeaderHeight();
    const a = this.onHeaderContextMenu.bind(this);
    this.addManagedElementListeners(this.eGui, { contextmenu: a }), n == null || n.mockHeaderContextMenu(this, a), o.register("gridHeaderCtrl", this);
  }
  setupHeaderHeight() {
    const e = this.setHeaderHeight.bind(this);
    e(), this.addManagedPropertyListeners(
      [
        "headerHeight",
        "pivotHeaderHeight",
        "groupHeaderHeight",
        "pivotGroupHeaderHeight",
        "floatingFiltersHeight"
      ],
      e
    ), this.addManagedEventListeners({
      headerRowsChanged: e,
      columnHeaderHeightChanged: e,
      // add this to the animation frame to avoid a feedback loop
      columnGroupHeaderHeightChanged: () => xt(this.beans, () => e()),
      gridStylesChanged: e,
      advancedFilterEnabledChanged: e
    });
  }
  setHeaderHeight() {
    var n;
    const { beans: e } = this;
    let t = 0;
    const s = fd(e).reduce((o, a) => o + a, 0), i = md(e);
    if ((n = e.filterManager) != null && n.hasFloatingFilters() && (t += Cd(e)), t += s, t += i, this.headerHeight === t)
      return;
    this.headerHeight = t;
    const r = `${t + 1}px`;
    this.comp.setHeightAndMinHeight(r), this.eventSvc.dispatchEvent({
      type: "headerHeightChanged"
    });
  }
  onPivotModeChanged(e) {
    const t = e.colModel.isPivotMode();
    this.comp.toggleCss("ag-pivot-on", t), this.comp.toggleCss("ag-pivot-off", !t);
  }
  onDisplayedColumnsChanged(e) {
    const s = e.visibleCols.allCols.some((i) => i.isSpanHeaderHeight());
    this.comp.toggleCss("ag-header-allow-overflow", s);
  }
  onTabKeyDown(e) {
    const t = this.gos.get("enableRtl"), s = e.shiftKey, i = s !== t ? "LEFT" : "RIGHT", { beans: r } = this, { headerNavigation: n, focusSvc: o } = r;
    (n.navigateHorizontally(i, !0, e) || !s && o.focusOverlay(!1) || rs(r, s, !0)) && e.preventDefault();
  }
  handleKeyDown(e) {
    let t = null;
    const { headerNavigation: s } = this.beans;
    switch (e.key) {
      case S.LEFT:
        t = "LEFT";
      case S.RIGHT: {
        A(t) || (t = "RIGHT"), s.navigateHorizontally(t, !1, e) && e.preventDefault();
        break;
      }
      case S.UP:
        t = "UP";
      case S.DOWN: {
        A(t) || (t = "DOWN"), s.navigateVertically(t, e) && e.preventDefault();
        break;
      }
      default:
        return;
    }
  }
  onFocusOut(e) {
    const { relatedTarget: t } = e, { eGui: s, beans: i } = this;
    !t && s.contains(Q(i)) || s.contains(t) || (i.focusSvc.focusedHeader = null);
  }
  onHeaderContextMenu(e, t, s) {
    var o;
    const { menuSvc: i, ctrlsSvc: r } = this.beans;
    if (!e && !s || !(i != null && i.isHeaderContextMenuEnabled()))
      return;
    const { target: n } = e ?? t;
    (n === this.eGui || n === ((o = r.getHeaderRowContainerCtrl()) == null ? void 0 : o.eViewport)) && i.showHeaderContextMenu(void 0, e, s);
  }
}, vd = class extends D {
  constructor(e, t) {
    super(e), this.ctrl = t;
  }
  getCtrl() {
    return this.ctrl;
  }
}, rx = {
  tag: "div",
  cls: "ag-header-cell",
  role: "columnheader",
  children: [
    { tag: "div", ref: "eResize", cls: "ag-header-cell-resize", role: "presentation" },
    { tag: "div", ref: "eHeaderCompWrapper", cls: "ag-header-cell-comp-wrapper", role: "presentation" }
  ]
}, nx = class extends vd {
  constructor(e) {
    super(rx, e), this.eResize = x, this.eHeaderCompWrapper = x, this.headerCompVersion = 0;
  }
  postConstruct() {
    const e = this.getGui(), t = () => {
      const i = this.ctrl.getSelectAllGui();
      i && (this.eResize.insertAdjacentElement("afterend", i), this.addDestroyFunc(() => i.remove()));
    }, s = {
      setWidth: (i) => e.style.width = i,
      toggleCss: (i, r) => this.toggleCss(i, r),
      setUserStyles: (i) => fn(e, i),
      setAriaSort: (i) => i ? mw(e, i) : Cw(e),
      setUserCompDetails: (i) => this.setUserCompDetails(i),
      getUserCompInstance: () => this.headerComp,
      refreshSelectAllGui: t,
      removeSelectAllGui: () => {
        var i;
        return (i = this.ctrl.getSelectAllGui()) == null ? void 0 : i.remove();
      }
    };
    this.ctrl.setComp(s, this.getGui(), this.eResize, this.eHeaderCompWrapper, void 0), t();
  }
  destroy() {
    this.destroyHeaderComp(), super.destroy();
  }
  destroyHeaderComp() {
    this.headerComp && (this.eHeaderCompWrapper.removeChild(this.headerCompGui), this.headerComp = this.destroyBean(this.headerComp), this.headerCompGui = void 0);
  }
  setUserCompDetails(e) {
    this.headerCompVersion++;
    const t = this.headerCompVersion;
    e.newAgStackInstance().then((s) => this.afterCompCreated(t, s));
  }
  afterCompCreated(e, t) {
    if (e != this.headerCompVersion || !this.isAlive()) {
      this.destroyBean(t);
      return;
    }
    this.destroyHeaderComp(), this.headerComp = t, this.headerCompGui = t.getGui(), this.eHeaderCompWrapper.appendChild(this.headerCompGui), this.ctrl.setDragSource(this.getGui());
  }
}, ox = {
  tag: "div",
  cls: "ag-header-group-cell",
  role: "columnheader",
  children: [
    { tag: "div", ref: "eHeaderCompWrapper", cls: "ag-header-cell-comp-wrapper", role: "presentation" },
    { tag: "div", ref: "eResize", cls: "ag-header-cell-resize", role: "presentation" }
  ]
}, ax = class extends vd {
  constructor(e) {
    super(ox, e), this.eResize = x, this.eHeaderCompWrapper = x;
  }
  postConstruct() {
    const e = this.getGui(), t = (i, r) => r != null ? e.setAttribute(i, r) : e.removeAttribute(i), s = {
      toggleCss: (i, r) => this.toggleCss(i, r),
      setUserStyles: (i) => fn(e, i),
      setHeaderWrapperHidden: (i) => {
        i ? this.eHeaderCompWrapper.style.setProperty("display", "none") : this.eHeaderCompWrapper.style.removeProperty("display");
      },
      setHeaderWrapperMaxHeight: (i) => {
        i != null ? this.eHeaderCompWrapper.style.setProperty("max-height", `${i}px`) : this.eHeaderCompWrapper.style.removeProperty("max-height"), this.eHeaderCompWrapper.classList.toggle("ag-header-cell-comp-wrapper-limited-height", i != null);
      },
      setResizableDisplayed: (i) => O(this.eResize, i),
      setWidth: (i) => e.style.width = i,
      setAriaExpanded: (i) => t("aria-expanded", i),
      setUserCompDetails: (i) => this.setUserCompDetails(i),
      getUserCompInstance: () => this.headerGroupComp
    };
    this.ctrl.setComp(s, e, this.eResize, this.eHeaderCompWrapper, void 0);
  }
  setUserCompDetails(e) {
    e.newAgStackInstance().then((t) => this.afterHeaderCompCreated(t));
  }
  afterHeaderCompCreated(e) {
    const t = () => this.destroyBean(e);
    if (!this.isAlive()) {
      t();
      return;
    }
    const s = this.getGui(), i = e.getGui();
    this.eHeaderCompWrapper.appendChild(i), this.addDestroyFunc(t), this.headerGroupComp = e, this.ctrl.setDragSource(s);
  }
}, lx = {
  tag: "div",
  cls: "ag-header-cell ag-floating-filter",
  role: "gridcell",
  children: [
    { tag: "div", ref: "eFloatingFilterBody", role: "presentation" },
    {
      tag: "div",
      ref: "eButtonWrapper",
      cls: "ag-floating-filter-button ag-hidden",
      role: "presentation",
      children: [
        {
          tag: "button",
          ref: "eButtonShowMainFilter",
          cls: "ag-button ag-floating-filter-button-button",
          attrs: { type: "button", tabindex: "-1" }
        }
      ]
    }
  ]
}, cx = class extends vd {
  constructor(e) {
    super(lx, e), this.eFloatingFilterBody = x, this.eButtonWrapper = x, this.eButtonShowMainFilter = x;
  }
  postConstruct() {
    const e = this.getGui(), t = {
      toggleCss: (s, i) => this.toggleCss(s, i),
      setUserStyles: (s) => fn(e, s),
      addOrRemoveBodyCssClass: (s, i) => this.eFloatingFilterBody.classList.toggle(s, i),
      setButtonWrapperDisplayed: (s) => O(this.eButtonWrapper, s),
      setCompDetails: (s) => this.setCompDetails(s),
      getFloatingFilterComp: () => this.compPromise,
      setWidth: (s) => e.style.width = s,
      setMenuIcon: (s) => this.eButtonShowMainFilter.appendChild(s)
    };
    this.ctrl.setComp(t, e, this.eButtonShowMainFilter, this.eFloatingFilterBody, void 0);
  }
  setCompDetails(e) {
    if (!e) {
      this.destroyFloatingFilterComp(), this.compPromise = null;
      return;
    }
    this.compPromise = e.newAgStackInstance(), this.compPromise.then((t) => this.afterCompCreated(t));
  }
  destroy() {
    this.destroyFloatingFilterComp(), super.destroy();
  }
  destroyFloatingFilterComp() {
    this.floatingFilterComp && (this.eFloatingFilterBody.removeChild(this.floatingFilterComp.getGui()), this.floatingFilterComp = this.destroyBean(this.floatingFilterComp));
  }
  afterCompCreated(e) {
    if (e) {
      if (!this.isAlive()) {
        this.destroyBean(e);
        return;
      }
      this.destroyFloatingFilterComp(), this.floatingFilterComp = e, this.eFloatingFilterBody.appendChild(e.getGui()), e.afterGuiAttached && e.afterGuiAttached();
    }
  }
}, dx = class extends D {
  constructor(e) {
    super({ tag: "div", cls: e.headerRowClass, role: "row" }), this.ctrl = e, this.headerComps = {};
  }
  postConstruct() {
    this.getGui().setAttribute("tabindex", String(this.gos.get("tabIndex"))), en(this.getGui(), this.ctrl.getAriaRowIndex());
    const t = {
      setHeight: (s) => this.getGui().style.height = s,
      setTop: (s) => this.getGui().style.top = s,
      setHeaderCtrls: (s, i) => this.setHeaderCtrls(s, i),
      setWidth: (s) => this.getGui().style.width = s,
      setRowIndex: (s) => en(this.getGui(), s)
    };
    this.ctrl.setComp(t, void 0);
  }
  destroy() {
    this.setHeaderCtrls([], !1), super.destroy();
  }
  setHeaderCtrls(e, t) {
    if (!this.isAlive())
      return;
    const s = this.headerComps;
    if (this.headerComps = {}, e.forEach((i) => {
      const r = i.instanceId;
      let n = s[r];
      delete s[r], n == null && (n = this.createHeaderComp(i), this.getGui().appendChild(n.getGui())), this.headerComps[r] = n;
    }), Object.values(s).forEach((i) => {
      this.getGui().removeChild(i.getGui()), this.destroyBean(i);
    }), t) {
      const i = Object.values(this.headerComps);
      i.sort(
        (n, o) => {
          const a = n.getCtrl().column.getLeft(), l = o.getCtrl().column.getLeft();
          return a - l;
        }
      );
      const r = i.map((n) => n.getGui());
      Bg(this.getGui(), r);
    }
  }
  createHeaderComp(e) {
    let t;
    switch (this.ctrl.type) {
      case "group":
        t = new ax(e);
        break;
      case "filter":
        t = new cx(e);
        break;
      default:
        t = new nx(e);
        break;
    }
    return this.createBean(t), t.setParentComponent(this), t;
  }
}, wd = class extends R {
  constructor(e, t, s, i) {
    super(), this.columnOrGroup = e, this.eCell = t, this.colsSpanning = i, this.columnOrGroup = e, this.ariaEl = t.querySelector("[role=columnheader]") || t, this.beans = s;
  }
  setColsSpanning(e) {
    this.colsSpanning = e, this.onLeftChanged();
  }
  getColumnOrGroup() {
    const { beans: e, colsSpanning: t } = this;
    return e.gos.get("enableRtl") && t ? _(t) : this.columnOrGroup;
  }
  postConstruct() {
    const e = this.onLeftChanged.bind(this);
    this.addManagedListeners(this.columnOrGroup, { leftChanged: e }), this.setLeftFirstTime(), this.addManagedEventListeners({ displayedColumnsWidthChanged: e }), this.addManagedPropertyListener("domLayout", e);
  }
  setLeftFirstTime() {
    const { gos: e, colAnimation: t } = this.beans, s = e.get("suppressColumnMoveAnimation"), i = A(this.columnOrGroup.getOldLeft());
    (t == null ? void 0 : t.isActive()) && i && !s ? this.animateInLeft() : this.onLeftChanged();
  }
  animateInLeft() {
    const e = this.getColumnOrGroup(), t = this.modifyLeftForPrintLayout(e, e.getOldLeft()), s = this.modifyLeftForPrintLayout(e, e.getLeft());
    this.setLeft(t), this.actualLeft = s, this.beans.colAnimation.executeNextVMTurn(() => {
      this.actualLeft === s && this.setLeft(s);
    });
  }
  onLeftChanged() {
    const e = this.getColumnOrGroup(), t = e.getLeft();
    this.actualLeft = this.modifyLeftForPrintLayout(e, t), this.setLeft(this.actualLeft);
  }
  modifyLeftForPrintLayout(e, t) {
    const { gos: s, visibleCols: i } = this.beans;
    if (!Ie(s, "print") || e.getPinned() === "left")
      return t;
    const n = i.getColsLeftWidth();
    if (e.getPinned() === "right") {
      const o = i.bodyWidth;
      return n + o + t;
    }
    return n + t;
  }
  setLeft(e) {
    if (A(e) && (this.eCell.style.left = `${e}px`), we(this.columnOrGroup)) {
      const t = this.columnOrGroup.getLeafColumns();
      if (!t.length)
        return;
      t.length > 1 && Ag(this.ariaEl, t.length);
    }
  }
}, hx = 0, Sf = "headerCtrl", bd = class extends R {
  constructor(e, t) {
    super(), this.column = e, this.rowCtrl = t, this.resizeToggleTimeout = 0, this.resizeMultiplier = 1, this.resizeFeature = null, this.lastFocusEvent = null, this.dragSource = null, this.reAttemptToFocus = !1, this.instanceId = e.getUniqueId() + "-" + hx++;
  }
  postConstruct() {
    const e = this.refreshTabIndex.bind(this);
    this.addManagedPropertyListeners(["suppressHeaderFocus"], e), this.addManagedEventListeners({
      overlayExclusiveChanged: e
    });
  }
  setComp(e, t, s, i, r) {
    t.setAttribute("col-id", this.column.colIdSanitised), this.wireComp(e, t, s, i, r), this.reAttemptToFocus && (this.reAttemptToFocus = !1, this.focus(this.lastFocusEvent ?? void 0));
  }
  shouldStopEventPropagation(e) {
    const { headerRowIndex: t, column: s } = this.beans.focusSvc.focusedHeader, i = s.getDefinition(), r = i && i.suppressHeaderKeyboardEvent;
    if (!A(r))
      return !1;
    const n = V(this.gos, {
      colDef: i,
      column: s,
      headerRowIndex: t,
      event: e
    });
    return !!r(n);
  }
  getWrapperHasFocus() {
    return Q(this.beans) === this.eGui;
  }
  setGui(e, t) {
    this.eGui = e, this.addDomData(t), t.addManagedListeners(this.beans.eventSvc, {
      displayedColumnsChanged: this.onDisplayedColumnsChanged.bind(this)
    }), t.addManagedElementListeners(this.eGui, {
      focus: this.onGuiFocus.bind(this)
    }), this.onDisplayedColumnsChanged(), this.refreshTabIndex();
  }
  refreshHeaderStyles() {
    const e = this.column.getDefinition();
    if (!e)
      return;
    const { headerStyle: t } = e;
    let s;
    if (typeof t == "function") {
      const i = this.getHeaderClassParams();
      s = t(i);
    } else
      s = t;
    s && this.comp.setUserStyles(s);
  }
  onGuiFocus() {
    this.eventSvc.dispatchEvent({
      type: "headerFocused",
      column: this.column
    });
  }
  setupAutoHeight(e) {
    const { wrapperElement: t, checkMeasuringCallback: s, compBean: i } = e, { beans: r } = this, n = (h) => {
      if (!this.isAlive() || !i.isAlive())
        return;
      const { paddingTop: u, paddingBottom: g, borderBottomWidth: p, borderTopWidth: f } = Vi(this.eGui), m = u + g + p + f, v = t.offsetHeight + m;
      if (h < 5) {
        const w = me(r), b = !w || !w.contains(t), y = v == 0;
        if (b || y) {
          Fo(() => n(h + 1), "raf", r);
          return;
        }
      }
      this.setColHeaderHeight(this.column, v);
    };
    let o = !1, a;
    const l = () => {
      const h = this.column.isAutoHeaderHeight();
      h && !o && c(), !h && o && d();
    }, c = () => {
      o = !0, this.comp.toggleCss("ag-header-cell-auto-height", !0), n(0), a = os(this.beans, t, () => n(0));
    }, d = () => {
      o = !1, a && a(), this.comp.toggleCss("ag-header-cell-auto-height", !1), a = void 0;
    };
    l(), i.addDestroyFunc(() => d()), i.addManagedListeners(this.column, { widthChanged: () => o && n(0) }), i.addManagedEventListeners({
      sortChanged: () => {
        o && window.setTimeout(() => n(0));
      }
    }), s && s(l);
  }
  onDisplayedColumnsChanged() {
    const { comp: e, column: t, beans: s, eGui: i } = this;
    !e || !t || !i || (Cf(e, t, s.visibleCols), Lc(i, s.visibleCols.getAriaColIndex(t)));
  }
  addResizeAndMoveKeyboardListeners(e) {
    e.addManagedListeners(this.eGui, {
      keydown: this.onGuiKeyDown.bind(this),
      keyup: this.onGuiKeyUp.bind(this)
    });
  }
  refreshTabIndex() {
    const e = wi(this.beans);
    this.eGui && vt(this.eGui, "tabindex", e ? null : "-1");
  }
  onGuiKeyDown(e) {
    var n;
    const t = Q(this.beans), s = e.key === S.LEFT || e.key === S.RIGHT;
    if (this.isResizing && (e.preventDefault(), e.stopImmediatePropagation()), // if elements within the header are focused, we don't process the event
    t !== this.eGui || // if shiftKey and altKey are not pressed, it's cell navigation so we don't process the event
    !e.shiftKey && !e.altKey || ((this.isResizing || s) && (e.preventDefault(), e.stopImmediatePropagation()), !s))
      return;
    const r = e.key === S.LEFT !== this.gos.get("enableRtl") ? "left" : "right";
    if (e.altKey) {
      this.isResizing = !0, this.resizeMultiplier += 1;
      const o = this.getViewportAdjustedResizeDiff(e);
      this.resizeHeader(o, e.shiftKey), (n = this.resizeFeature) == null || n.toggleColumnResizing(!0);
    } else
      this.moveHeader(r);
  }
  moveHeader(e) {
    var t;
    (t = this.beans.colMoves) == null || t.moveHeader(e, this.eGui, this.column, this.rowCtrl.pinned, this);
  }
  getViewportAdjustedResizeDiff(e) {
    const t = this.getResizeDiff(e), { pinnedCols: s } = this.beans;
    return s ? s.getHeaderResizeDiff(t, this.column) : t;
  }
  getResizeDiff(e) {
    const { gos: t, column: s } = this;
    let i = e.key === S.LEFT !== t.get("enableRtl");
    const r = s.getPinned(), n = t.get("enableRtl");
    return r && n !== (r === "right") && (i = !i), (i ? -1 : 1) * this.resizeMultiplier;
  }
  onGuiKeyUp() {
    this.isResizing && (this.resizeToggleTimeout && (window.clearTimeout(this.resizeToggleTimeout), this.resizeToggleTimeout = 0), this.isResizing = !1, this.resizeMultiplier = 1, this.resizeToggleTimeout = window.setTimeout(() => {
      var e;
      (e = this.resizeFeature) == null || e.toggleColumnResizing(!1);
    }, 150));
  }
  handleKeyDown(e) {
    const t = this.getWrapperHasFocus();
    switch (e.key) {
      case S.PAGE_DOWN:
      case S.PAGE_UP:
      case S.PAGE_HOME:
      case S.PAGE_END:
        t && e.preventDefault();
    }
  }
  addDomData(e) {
    const t = Sf, { eGui: s, gos: i } = this;
    Pi(i, s, t, this), e.addDestroyFunc(() => Pi(i, s, t, null));
  }
  focus(e) {
    if (!this.isAlive())
      return !1;
    const { eGui: t } = this;
    return t ? (t.focus(), this.lastFocusEvent = e || null) : this.reAttemptToFocus = !0, !0;
  }
  focusThis() {
    this.beans.focusSvc.focusedHeader = { headerRowIndex: this.rowCtrl.rowIndex, column: this.column };
  }
  removeDragSource() {
    var e;
    this.dragSource && ((e = this.beans.dragAndDrop) == null || e.removeDragSource(this.dragSource), this.dragSource = null);
  }
  handleContextMenuMouseEvent(e, t, s) {
    const i = e ?? t, { menuSvc: r, gos: n } = this.beans;
    n.get("preventDefaultOnContextMenu") && i.preventDefault(), r != null && r.isHeaderContextMenuEnabled(s) && r.showHeaderContextMenu(s, e, t), this.dispatchColumnMouseEvent("columnHeaderContextMenu", s);
  }
  dispatchColumnMouseEvent(e, t) {
    this.eventSvc.dispatchEvent({
      type: e,
      column: t
    });
  }
  setColHeaderHeight(e, t) {
    if (!e.setAutoHeaderHeight(t))
      return;
    const { eventSvc: s } = this;
    e.isColumn ? s.dispatchEvent({
      type: "columnHeaderHeightChanged",
      column: e,
      columns: [e],
      source: "autosizeColumnHeaderHeight"
    }) : s.dispatchEvent({
      type: "columnGroupHeaderHeightChanged",
      columnGroup: e,
      source: "autosizeColumnGroupHeaderHeight"
    });
  }
  clearComponent() {
    this.removeDragSource(), this.resizeFeature = null, this.comp = null, this.eGui = null;
  }
  destroy() {
    super.destroy(), this.column = null, this.lastFocusEvent = null, this.rowCtrl = null;
  }
}, ux = class extends bd {
  constructor() {
    super(...arguments), this.refreshFunctions = {}, this.userHeaderClasses = /* @__PURE__ */ new Set(), this.ariaDescriptionProperties = /* @__PURE__ */ new Map();
  }
  wireComp(e, t, s, i, r) {
    this.comp = e;
    const { rowCtrl: n, column: o, beans: a } = this, { colResize: l, context: c, colHover: d, rangeSvc: h } = a, u = Cn(this, c, r);
    this.setGui(t, u), this.updateState(), this.setupWidth(u), this.setupMovingCss(u), this.setupMenuClass(u), this.setupSortableClass(u), this.setupWrapTextClass(), this.refreshSpanHeaderHeight(), this.setupAutoHeight({
      wrapperElement: i,
      checkMeasuringCallback: (p) => this.setRefreshFunction("measuring", p),
      compBean: u
    }), this.addColumnHoverListener(u), this.setupFilterClass(u), this.setupStylesFromColDef(), this.setupClassesFromColDef(), this.setupTooltip(), this.addActiveHeaderMouseListeners(u), this.setupSelectAll(u), this.setupUserComp(), this.refreshAria(), l ? this.resizeFeature = u.createManagedBean(
      l.createResizeFeature(n.pinned, o, s, e, this)
    ) : O(s, !1), d == null || d.createHoverFeature(u, [o], t), h == null || h.createRangeHighlightFeature(u, o, e), u.createManagedBean(new wd(o, t, a)), u.createManagedBean(
      new ii(t, {
        shouldStopEventPropagation: (p) => this.shouldStopEventPropagation(p),
        onTabKeyDown: () => null,
        handleKeyDown: this.handleKeyDown.bind(this),
        onFocusIn: this.onFocusIn.bind(this),
        onFocusOut: this.onFocusOut.bind(this)
      })
    ), this.addResizeAndMoveKeyboardListeners(u), u.addManagedPropertyListeners(
      ["suppressMovableColumns", "suppressMenuHide", "suppressAggFuncInHeader", "enableAdvancedFilter"],
      () => this.refresh()
    ), u.addManagedListeners(o, { colDefChanged: () => this.refresh() }), u.addManagedListeners(o, { headerHighlightChanged: this.onHeaderHighlightChanged.bind(this) });
    const g = () => this.checkDisplayName();
    u.addManagedEventListeners({
      columnValueChanged: g,
      columnRowGroupChanged: g,
      columnPivotChanged: g,
      headerHeightChanged: this.onHeaderHeightChanged.bind(this)
    }), u.addDestroyFunc(() => {
      this.refreshFunctions = {}, this.selectAllFeature = null, this.dragSourceElement = void 0, this.userCompDetails = null, this.userHeaderClasses.clear(), this.ariaDescriptionProperties.clear(), this.clearComponent();
    });
  }
  resizeHeader(e, t) {
    var s;
    (s = this.beans.colResize) == null || s.resizeHeader(this.column, e, t);
  }
  getHeaderClassParams() {
    const { column: e, beans: t } = this, s = e.colDef;
    return V(t.gos, {
      colDef: s,
      column: e,
      floatingFilter: !1
    });
  }
  setupUserComp() {
    const e = this.lookupUserCompDetails();
    e && this.setCompDetails(e);
  }
  setCompDetails(e) {
    this.userCompDetails = e, this.comp.setUserCompDetails(e);
  }
  lookupUserCompDetails() {
    const e = this.createParams(), t = this.column.getColDef();
    return Bb(this.beans.userCompFactory, t, e);
  }
  createParams() {
    const { menuSvc: e, sortSvc: t, colFilter: s, gos: i } = this.beans;
    return V(i, {
      column: this.column,
      displayName: this.displayName,
      enableSorting: this.column.isSortable(),
      enableMenu: this.menuEnabled,
      enableFilterButton: this.openFilterEnabled && !!(e != null && e.isHeaderFilterButtonEnabled(this.column)),
      enableFilterIcon: !!s && (!this.openFilterEnabled || Ae(this.gos)),
      showColumnMenu: (n, o) => {
        e == null || e.showColumnMenu({
          column: this.column,
          buttonElement: n,
          positionBy: "button",
          onClosedCallback: o
        });
      },
      showColumnMenuAfterMouseClick: (n, o) => {
        e == null || e.showColumnMenu({
          column: this.column,
          mouseEvent: n,
          positionBy: "mouse",
          onClosedCallback: o
        });
      },
      showFilter: (n) => {
        e == null || e.showFilterMenu({
          column: this.column,
          buttonElement: n,
          containerType: "columnFilter",
          positionBy: "button"
        });
      },
      progressSort: (n) => {
        t == null || t.progressSort(this.column, !!n, "uiColumnSorted");
      },
      setSort: (n, o) => {
        t == null || t.setSortForColumn(this.column, n, !!o, "uiColumnSorted");
      },
      eGridHeader: this.eGui,
      setTooltip: (n, o) => {
        i.assertModuleRegistered("Tooltip", 3), this.setupTooltip(n, o);
      }
    });
  }
  setupSelectAll(e) {
    var s;
    const { selectionSvc: t } = this.beans;
    t && (this.selectAllFeature = e.createOptionalManagedBean(t.createSelectAllFeature(this.column)), (s = this.selectAllFeature) == null || s.setComp(this), e.addManagedPropertyListener("rowSelection", () => {
      var r;
      const i = t.createSelectAllFeature(this.column);
      i && !this.selectAllFeature ? (this.selectAllFeature = e.createManagedBean(i), (r = this.selectAllFeature) == null || r.setComp(this), this.comp.refreshSelectAllGui()) : this.selectAllFeature && !i && (this.comp.removeSelectAllGui(), this.selectAllFeature = this.destroyBean(this.selectAllFeature));
    }));
  }
  getSelectAllGui() {
    var e;
    return (e = this.selectAllFeature) == null ? void 0 : e.getCheckboxGui();
  }
  handleKeyDown(e) {
    var t;
    super.handleKeyDown(e), e.key === S.SPACE && ((t = this.selectAllFeature) == null || t.onSpaceKeyDown(e)), e.key === S.ENTER && this.onEnterKeyDown(e), e.key === S.DOWN && e.altKey && this.showMenuOnKeyPress(e, !1);
  }
  onEnterKeyDown(e) {
    var t;
    e.ctrlKey || e.metaKey ? this.showMenuOnKeyPress(e, !0) : this.sortable && ((t = this.beans.sortSvc) == null || t.progressSort(this.column, e.shiftKey, "uiColumnSorted"));
  }
  showMenuOnKeyPress(e, t) {
    const s = this.comp.getUserCompInstance();
    Lh(s) && s.onMenuKeyboardShortcut(t) && e.preventDefault();
  }
  onFocusIn(e) {
    this.eGui.contains(e.relatedTarget) || (this.focusThis(), this.announceAriaDescription()), ua() && this.setActiveHeader(!0);
  }
  onFocusOut(e) {
    this.eGui.contains(e.relatedTarget) || this.setActiveHeader(!1);
  }
  setupTooltip(e, t) {
    var s;
    this.tooltipFeature = (s = this.beans.tooltipSvc) == null ? void 0 : s.setupHeaderTooltip(
      this.tooltipFeature,
      this,
      e,
      t
    );
  }
  setupStylesFromColDef() {
    this.setRefreshFunction("headerStyles", this.refreshHeaderStyles.bind(this)), this.refreshHeaderStyles();
  }
  setupClassesFromColDef() {
    const e = () => {
      const t = this.column.getColDef(), s = pd(t, this.gos, this.column, null), i = this.userHeaderClasses;
      this.userHeaderClasses = new Set(s), s.forEach((r) => {
        i.has(r) ? i.delete(r) : this.comp.toggleCss(r, !0);
      }), i.forEach((r) => this.comp.toggleCss(r, !1));
    };
    this.setRefreshFunction("headerClasses", e), e();
  }
  setDragSource(e) {
    var t;
    this.dragSourceElement = e, this.removeDragSource(), !(!e || !this.draggable) && (this.dragSource = ((t = this.beans.colMoves) == null ? void 0 : t.setDragSourceForHeader(e, this.column, this.displayName)) ?? null);
  }
  updateState() {
    const { menuSvc: e } = this.beans;
    this.menuEnabled = !!(e != null && e.isColumnMenuInHeaderEnabled(this.column)), this.openFilterEnabled = !!(e != null && e.isFilterMenuInHeaderEnabled(this.column)), this.sortable = this.column.isSortable(), this.displayName = this.calculateDisplayName(), this.draggable = this.workOutDraggable();
  }
  setRefreshFunction(e, t) {
    this.refreshFunctions[e] = t;
  }
  refresh() {
    this.updateState(), this.refreshHeaderComp(), this.refreshAria(), Object.values(this.refreshFunctions).forEach((e) => e());
  }
  refreshHeaderComp() {
    const e = this.lookupUserCompDetails();
    if (!e)
      return;
    (this.comp.getUserCompInstance() != null && this.userCompDetails.componentClass == e.componentClass ? this.attemptHeaderCompRefresh(e.params) : !1) ? this.setDragSource(this.dragSourceElement) : this.setCompDetails(e);
  }
  attemptHeaderCompRefresh(e) {
    const t = this.comp.getUserCompInstance();
    return !t || !t.refresh ? !1 : t.refresh(e);
  }
  calculateDisplayName() {
    return this.beans.colNames.getDisplayNameForColumn(this.column, "header", !0);
  }
  checkDisplayName() {
    this.displayName !== this.calculateDisplayName() && this.refresh();
  }
  workOutDraggable() {
    const e = this.column.getColDef();
    return !!(!this.gos.get("suppressMovableColumns") && !e.suppressMovable && !e.lockPosition) || !!e.enableRowGroup || !!e.enablePivot;
  }
  setupWidth(e) {
    const t = () => {
      const s = this.column.getActualWidth();
      this.comp.setWidth(`${s}px`);
    };
    e.addManagedListeners(this.column, { widthChanged: t }), t();
  }
  setupMovingCss(e) {
    const t = () => {
      this.comp.toggleCss("ag-header-cell-moving", this.column.isMoving());
    };
    e.addManagedListeners(this.column, { movingChanged: t }), t();
  }
  setupMenuClass(e) {
    const t = () => {
      var s;
      (s = this.comp) == null || s.toggleCss("ag-column-menu-visible", this.column.isMenuVisible());
    };
    e.addManagedListeners(this.column, { menuVisibleChanged: t }), t();
  }
  setupSortableClass(e) {
    const t = () => {
      this.comp.toggleCss("ag-header-cell-sortable", !!this.sortable);
    };
    t(), this.setRefreshFunction("updateSortable", t), e.addManagedEventListeners({ sortChanged: this.refreshAriaSort.bind(this) });
  }
  setupFilterClass(e) {
    const t = () => {
      const s = this.column.isFilterActive();
      this.comp.toggleCss("ag-header-cell-filtered", s), this.refreshAria();
    };
    e.addManagedListeners(this.column, { filterActiveChanged: t }), t();
  }
  setupWrapTextClass() {
    const e = () => {
      const t = !!this.column.getColDef().wrapHeaderText;
      this.comp.toggleCss("ag-header-cell-wrap-text", t);
    };
    e(), this.setRefreshFunction("wrapText", e);
  }
  onHeaderHighlightChanged() {
    const e = this.column.getHighlighted(), t = e === 0, s = e === 1;
    this.comp.toggleCss("ag-header-highlight-before", t), this.comp.toggleCss("ag-header-highlight-after", s);
  }
  onDisplayedColumnsChanged() {
    super.onDisplayedColumnsChanged(), this.isAlive() && this.onHeaderHeightChanged();
  }
  onHeaderHeightChanged() {
    this.refreshSpanHeaderHeight();
  }
  refreshSpanHeaderHeight() {
    var u;
    const { eGui: e, column: t, comp: s, beans: i } = this, r = fd(this.beans), n = r.reduce((g, p) => g += p, 0) === 0;
    if (s.toggleCss("ag-header-parent-hidden", n), !t.isSpanHeaderHeight()) {
      e.style.removeProperty("top"), e.style.removeProperty("height"), s.toggleCss("ag-header-span-height", !1), s.toggleCss("ag-header-span-total", !1);
      return;
    }
    const { numberOfParents: o, isSpanningTotal: a } = this.column.getColumnGroupPaddingInfo();
    s.toggleCss("ag-header-span-height", o > 0);
    const l = md(i);
    if (o === 0) {
      s.toggleCss("ag-header-span-total", !1), e.style.setProperty("top", "0px"), e.style.setProperty("height", `${l}px`);
      return;
    }
    s.toggleCss("ag-header-span-total", a);
    const c = (((u = this.column.getFirstRealParent()) == null ? void 0 : u.getLevel()) ?? -1) + 1, d = r.length - c;
    let h = 0;
    for (let g = 0; g < d; g++)
      h += r[r.length - 1 - g];
    e.style.setProperty("top", `${-h}px`), e.style.setProperty("height", `${l + h}px`);
  }
  refreshAriaSort() {
    var e;
    if (this.sortable) {
      const t = this.getLocaleTextFunc(), s = ((e = this.beans.sortSvc) == null ? void 0 : e.getDisplaySortForColumn(this.column)) || null;
      this.comp.setAriaSort(ow(s)), this.setAriaDescriptionProperty("sort", t("ariaSortableColumn", "Press ENTER to sort"));
    } else
      this.comp.setAriaSort(), this.setAriaDescriptionProperty("sort", null);
  }
  refreshAriaMenu() {
    if (this.menuEnabled) {
      const e = this.getLocaleTextFunc();
      this.setAriaDescriptionProperty("menu", e("ariaMenuColumn", "Press ALT DOWN to open column menu"));
    } else
      this.setAriaDescriptionProperty("menu", null);
  }
  refreshAriaFilterButton() {
    if (this.openFilterEnabled && !Ae(this.gos)) {
      const e = this.getLocaleTextFunc();
      this.setAriaDescriptionProperty(
        "filterButton",
        e("ariaFilterColumn", "Press CTRL ENTER to open filter")
      );
    } else
      this.setAriaDescriptionProperty("filterButton", null);
  }
  refreshAriaFiltered() {
    const e = this.getLocaleTextFunc();
    this.column.isFilterActive() ? this.setAriaDescriptionProperty("filter", e("ariaColumnFiltered", "Column Filtered")) : this.setAriaDescriptionProperty("filter", null);
  }
  setAriaDescriptionProperty(e, t) {
    t != null ? this.ariaDescriptionProperties.set(e, t) : this.ariaDescriptionProperties.delete(e);
  }
  announceAriaDescription() {
    var t;
    if (!this.eGui.contains(Q(this.beans)))
      return;
    const e = Array.from(this.ariaDescriptionProperties.keys()).sort((s, i) => s === "filter" ? -1 : i.charCodeAt(0) - s.charCodeAt(0)).map((s) => this.ariaDescriptionProperties.get(s)).join(". ");
    (t = this.beans.ariaAnnounce) == null || t.announceValue(e, "columnHeader");
  }
  refreshAria() {
    this.refreshAriaSort(), this.refreshAriaMenu(), this.refreshAriaFilterButton(), this.refreshAriaFiltered();
  }
  addColumnHoverListener(e) {
    var t;
    (t = this.beans.colHover) == null || t.addHeaderColumnHoverListener(e, this.comp, this.column);
  }
  addActiveHeaderMouseListeners(e) {
    const t = (r) => this.handleMouseOverChange(r.type === "mouseenter"), s = () => {
      this.setActiveHeader(!0), this.dispatchColumnMouseEvent("columnHeaderClicked", this.column);
    }, i = (r) => this.handleContextMenuMouseEvent(r, void 0, this.column);
    e.addManagedListeners(this.eGui, {
      mouseenter: t,
      mouseleave: t,
      click: s,
      contextmenu: i
    });
  }
  handleMouseOverChange(e) {
    this.setActiveHeader(e), this.eventSvc.dispatchEvent({
      type: e ? "columnHeaderMouseOver" : "columnHeaderMouseLeave",
      column: this.column
    });
  }
  setActiveHeader(e) {
    this.comp.toggleCss("ag-header-active", e);
  }
  getAnchorElementForMenu(e) {
    const t = this.comp.getUserCompInstance();
    return Lh(t) ? t.getAnchorElementForMenu(e) : this.eGui;
  }
  destroy() {
    this.tooltipFeature = this.destroyBean(this.tooltipFeature), super.destroy();
  }
};
function Lh(e) {
  return typeof (e == null ? void 0 : e.getAnchorElementForMenu) == "function" && typeof e.onMenuKeyboardShortcut == "function";
}
var gx = 0, il = class extends R {
  constructor(e, t, s) {
    super(), this.rowIndex = e, this.pinned = t, this.type = s, this.instanceId = gx++, this.comp = null, this.allCtrls = [];
    let i = "ag-header-row-column";
    s === "group" ? i = "ag-header-row-group" : s === "filter" && (i = "ag-header-row-filter"), this.headerRowClass = `ag-header-row ${i}`;
  }
  setRowIndex(e) {
    var t;
    this.rowIndex = e, (t = this.comp) == null || t.setRowIndex(this.getAriaRowIndex()), this.onRowHeightChanged();
  }
  postConstruct() {
    this.isPrintLayout = Ie(this.gos, "print"), this.isEnsureDomOrder = this.gos.get("ensureDomOrder");
  }
  /** Checks that every header cell that is currently visible has been rendered.
   * Can only be false under some circumstances when using React
   */
  areCellsRendered() {
    return this.comp ? this.allCtrls.every((e) => e.eGui != null) : !1;
  }
  /**
   *
   * @param comp Proxy to the actual component
   * @param initCompState Should the component be initialised with the current state of the controller. Default: true
   */
  setComp(e, t, s = !0) {
    this.comp = e, t = Cn(this, this.beans.context, t), s && (this.setRowIndex(this.rowIndex), this.onVirtualColumnsChanged()), this.setWidth(), this.addEventListeners(t);
  }
  getAriaRowIndex() {
    return this.rowIndex + 1;
  }
  addEventListeners(e) {
    const t = this.onRowHeightChanged.bind(this), s = this.onDisplayedColumnsChanged.bind(this);
    e.addManagedEventListeners({
      columnResized: this.setWidth.bind(this),
      displayedColumnsChanged: s,
      virtualColumnsChanged: (i) => this.onVirtualColumnsChanged(i.afterScroll),
      columnGroupHeaderHeightChanged: t,
      columnHeaderHeightChanged: t,
      gridStylesChanged: t,
      advancedFilterEnabledChanged: t
    }), e.addManagedPropertyListener("domLayout", s), e.addManagedPropertyListener("ensureDomOrder", (i) => this.isEnsureDomOrder = i.currentValue), e.addManagedPropertyListeners(
      [
        "headerHeight",
        "pivotHeaderHeight",
        "groupHeaderHeight",
        "pivotGroupHeaderHeight",
        "floatingFiltersHeight"
      ],
      t
    );
  }
  onDisplayedColumnsChanged() {
    this.isPrintLayout = Ie(this.gos, "print"), this.onVirtualColumnsChanged(), this.setWidth(), this.onRowHeightChanged();
  }
  setWidth() {
    if (!this.comp)
      return;
    const e = this.getWidthForRow();
    this.comp.setWidth(`${e}px`);
  }
  getWidthForRow() {
    const { visibleCols: e } = this.beans;
    return this.isPrintLayout ? this.pinned != null ? 0 : e.getContainerWidth("right") + e.getContainerWidth("left") + e.getContainerWidth(null) : e.getContainerWidth(this.pinned);
  }
  onRowHeightChanged() {
    if (!this.comp)
      return;
    const { topOffset: e, rowHeight: t } = this.getTopAndHeight();
    this.comp.setTop(e + "px"), this.comp.setHeight(t + "px");
  }
  getTopAndHeight() {
    let e = 0;
    const t = fd(this.beans);
    for (let r = 0; r < t.length; r++) {
      if (r === this.rowIndex && this.type === "group")
        return { topOffset: e, rowHeight: t[r] };
      e += t[r];
    }
    const s = md(this.beans);
    if (this.type === "column")
      return { topOffset: e, rowHeight: s };
    e += s;
    const i = Cd(this.beans);
    return { topOffset: e, rowHeight: i };
  }
  onVirtualColumnsChanged(e = !1) {
    if (!this.comp)
      return;
    const t = this.getUpdatedHeaderCtrls(), s = this.isEnsureDomOrder || this.isPrintLayout;
    this.comp.setHeaderCtrls(t, s, e);
  }
  /**
   * Recycles the header cell ctrls and creates new ones for the columns in the viewport
   * @returns The updated header cell ctrls
   */
  getUpdatedHeaderCtrls() {
    const e = this.ctrlsById;
    this.ctrlsById = /* @__PURE__ */ new Map();
    const t = this.getColumnsInViewport();
    for (const i of t)
      this.recycleAndCreateHeaderCtrls(i, this.ctrlsById, e);
    const s = (i) => {
      const { focusSvc: r, visibleCols: n } = this.beans;
      return r.isHeaderWrapperFocused(i) ? n.isVisible(i.column) : !1;
    };
    if (e)
      for (const [i, r] of e)
        s(r) ? this.ctrlsById.set(i, r) : this.destroyBean(r);
    return this.allCtrls = Array.from(this.ctrlsById.values()), this.allCtrls;
  }
  /** Get the current header cell ctrls */
  getHeaderCellCtrls() {
    return this.allCtrls;
  }
  recycleAndCreateHeaderCtrls(e, t, s) {
    if (e.isEmptyGroup())
      return;
    const i = e.getUniqueId();
    let r;
    if (s && (r = s.get(i), s.delete(i)), r && r.column != e && (this.destroyBean(r), r = void 0), r == null)
      switch (this.type) {
        case "filter": {
          r = this.createBean(
            this.beans.registry.createDynamicBean(
              "headerFilterCellCtrl",
              !0,
              e,
              this
            )
          );
          break;
        }
        case "group":
          r = this.createBean(
            this.beans.registry.createDynamicBean(
              "headerGroupCellCtrl",
              !0,
              e,
              this
            )
          );
          break;
        default:
          r = this.createBean(new ux(e, this));
          break;
      }
    t.set(i, r);
  }
  getColumnsInViewport() {
    if (!this.isPrintLayout)
      return this.getComponentsToRender();
    if (this.pinned)
      return [];
    const e = [];
    return ["left", null, "right"].forEach((t) => {
      e.push(...this.getComponentsToRender(t));
    }), e;
  }
  getComponentsToRender(e = this.pinned) {
    return this.type === "group" ? this.beans.colViewport.getHeadersToRender(e, this.rowIndex) : this.beans.colViewport.getColumnHeadersToRender(e);
  }
  focusHeader(e, t) {
    const s = this.allCtrls.find((r) => r.column == e);
    return s ? s.focus(t) : !1;
  }
  destroy() {
    this.allCtrls = this.destroyBeans(this.allCtrls), this.ctrlsById = void 0, this.comp = null, super.destroy();
  }
}, px = class extends R {
  constructor(e) {
    super(), this.pinned = e, this.hidden = !1, this.includeFloatingFilter = !1, this.groupsRowCtrls = [];
  }
  setComp(e, t) {
    this.comp = e, this.eViewport = t;
    const { pinnedCols: s, ctrlsSvc: i, colModel: r, colMoves: n } = this.beans;
    this.setupCenterWidth(), s == null || s.setupHeaderPinnedWidth(this), this.setupDragAndDrop(n, this.eViewport);
    const o = this.refresh.bind(this, !0);
    this.addManagedEventListeners({
      displayedColumnsChanged: o,
      advancedFilterEnabledChanged: o
    });
    const a = `${typeof this.pinned == "string" ? this.pinned : "center"}Header`;
    i.register(a, this), r.ready && this.refresh();
  }
  getAllCtrls() {
    const e = [...this.groupsRowCtrls];
    return this.columnsRowCtrl && e.push(this.columnsRowCtrl), this.filtersRowCtrl && e.push(this.filtersRowCtrl), e;
  }
  refresh(e = !1) {
    const { focusSvc: t, filterManager: s, visibleCols: i } = this.beans;
    let r = 0;
    const n = t.getFocusHeaderToUseAfterRefresh(), o = () => {
      const h = i.headerGroupRowCount;
      r = h;
      const u = this.groupsRowCtrls.length;
      if (u !== h) {
        if (u > h) {
          for (let g = h; g < u; g++)
            this.destroyBean(this.groupsRowCtrls[g]);
          this.groupsRowCtrls.length = h;
          return;
        }
        for (let g = u; g < h; g++) {
          const p = this.createBean(new il(g, this.pinned, "group"));
          this.groupsRowCtrls.push(p);
        }
      }
    }, a = () => {
      const h = r++;
      if (this.hidden) {
        this.columnsRowCtrl = this.destroyBean(this.columnsRowCtrl);
        return;
      }
      this.columnsRowCtrl == null || !e ? (this.columnsRowCtrl = this.destroyBean(this.columnsRowCtrl), this.columnsRowCtrl = this.createBean(new il(h, this.pinned, "column"))) : this.columnsRowCtrl.rowIndex !== h && this.columnsRowCtrl.setRowIndex(h);
    }, l = () => {
      this.includeFloatingFilter = !!(s != null && s.hasFloatingFilters()) && !this.hidden;
      const h = () => {
        this.filtersRowCtrl = this.destroyBean(this.filtersRowCtrl);
      };
      if (!this.includeFloatingFilter) {
        h();
        return;
      }
      e || h();
      const u = r++;
      this.filtersRowCtrl ? this.filtersRowCtrl.rowIndex !== u && this.filtersRowCtrl.setRowIndex(u) : this.filtersRowCtrl = this.createBean(new il(u, this.pinned, "filter"));
    }, c = this.getAllCtrls();
    o(), a(), l();
    const d = this.getAllCtrls();
    this.comp.setCtrls(d), this.restoreFocusOnHeader(t, n), c.length !== d.length && this.beans.eventSvc.dispatchEvent({
      type: "headerRowsChanged"
    });
  }
  getHeaderCtrlForColumn(e) {
    const t = (s) => s == null ? void 0 : s.getHeaderCellCtrls().find((i) => i.column === e);
    if (ts(e))
      return t(this.columnsRowCtrl);
    if (this.groupsRowCtrls.length !== 0)
      for (let s = 0; s < this.groupsRowCtrls.length; s++) {
        const i = t(this.groupsRowCtrls[s]);
        if (i)
          return i;
      }
  }
  getHtmlElementForColumnHeader(e) {
    var t;
    return ((t = this.getHeaderCtrlForColumn(e)) == null ? void 0 : t.eGui) ?? null;
  }
  getRowType(e) {
    var t;
    return (t = this.getAllCtrls()[e]) == null ? void 0 : t.type;
  }
  focusHeader(e, t, s) {
    const r = this.getAllCtrls()[e];
    return r ? r.focusHeader(t, s) : !1;
  }
  getGroupRowCount() {
    return this.groupsRowCtrls.length;
  }
  getGroupRowCtrlAtIndex(e) {
    return this.groupsRowCtrls[e];
  }
  getRowCount() {
    return this.groupsRowCtrls.length + (this.columnsRowCtrl ? 1 : 0) + (this.filtersRowCtrl ? 1 : 0);
  }
  setHorizontalScroll(e) {
    this.comp.setViewportScrollLeft(e);
  }
  onScrollCallback(e) {
    this.addManagedElementListeners(this.eViewport, { scroll: e });
  }
  destroy() {
    this.filtersRowCtrl = this.destroyBean(this.filtersRowCtrl), this.columnsRowCtrl = this.destroyBean(this.columnsRowCtrl), this.groupsRowCtrls = this.destroyBeans(this.groupsRowCtrls), super.destroy();
  }
  setupDragAndDrop(e, t) {
    const s = e == null ? void 0 : e.createBodyDropTarget(this.pinned, t);
    s && this.createManagedBean(s);
  }
  restoreFocusOnHeader(e, t) {
    if (!t)
      return;
    const { column: s } = t;
    s.getPinned() == this.pinned && e.focusHeaderPosition({ headerPosition: t });
  }
  setupCenterWidth() {
    this.pinned == null && this.createManagedBean(new gd((e) => this.comp.setCenterWidth(`${e}px`), !0));
  }
}, fx = class extends R {
  constructor() {
    super(...arguments), this.beanName = "menuSvc";
  }
  postConstruct() {
    const { enterpriseMenuFactory: e, filterMenuFactory: t } = this.beans;
    this.activeMenuFactory = e ?? t;
  }
  showColumnMenu(e) {
    this.showColumnMenuCommon(this.activeMenuFactory, e, "columnMenu");
  }
  showFilterMenu(e) {
    this.showColumnMenuCommon(kh(this.beans), e, e.containerType, !0);
  }
  showHeaderContextMenu(e, t, s) {
    var i;
    (i = this.activeMenuFactory) == null || i.showMenuAfterContextMenuEvent(e, t, s);
  }
  hidePopupMenu() {
    var e, t;
    (e = this.beans.contextMenuSvc) == null || e.hideActiveMenu(), (t = this.activeMenuFactory) == null || t.hideActiveMenu();
  }
  hideFilterMenu() {
    var e;
    (e = kh(this.beans)) == null || e.hideActiveMenu();
  }
  isColumnMenuInHeaderEnabled(e) {
    var s;
    const { suppressHeaderMenuButton: t } = e.getColDef();
    return !t && !!((s = this.activeMenuFactory) != null && s.isMenuEnabled(e)) && (Ae(this.gos) || !!this.beans.enterpriseMenuFactory);
  }
  isFilterMenuInHeaderEnabled(e) {
    var t;
    return !e.getColDef().suppressHeaderFilterButton && !!((t = this.beans.filterManager) != null && t.isFilterAllowed(e));
  }
  isHeaderContextMenuEnabled(e) {
    const t = e && ts(e) ? e.getColDef() : e == null ? void 0 : e.getColGroupDef();
    return !(t != null && t.suppressHeaderContextMenu) && this.gos.get("columnMenu") === "new";
  }
  isHeaderMenuButtonAlwaysShowEnabled() {
    return this.isSuppressMenuHide();
  }
  isHeaderMenuButtonEnabled() {
    const e = !this.isSuppressMenuHide();
    return !(Xs() && e);
  }
  isHeaderFilterButtonEnabled(e) {
    return this.isFilterMenuInHeaderEnabled(e) && !Ae(this.gos) && !this.isFloatingFilterButtonDisplayed(e);
  }
  isFilterMenuItemEnabled(e) {
    var t;
    return !!((t = this.beans.filterManager) != null && t.isFilterAllowed(e)) && !Ae(this.gos) && !this.isFilterMenuInHeaderEnabled(e) && !this.isFloatingFilterButtonDisplayed(e);
  }
  isFloatingFilterButtonEnabled(e) {
    return !e.getColDef().suppressFloatingFilterButton;
  }
  isFloatingFilterButtonDisplayed(e) {
    return !!e.getColDef().floatingFilter && this.isFloatingFilterButtonEnabled(e);
  }
  isSuppressMenuHide() {
    const e = this.gos, t = e.get("suppressMenuHide");
    return Ae(e) ? e.exists("suppressMenuHide") ? t : !1 : t;
  }
  showColumnMenuCommon(e, t, s, i) {
    const { positionBy: r, onClosedCallback: n } = t, o = t.column;
    if (r === "button") {
      const { buttonElement: a } = t;
      e == null || e.showMenuAfterButtonClick(o, a, s, n, i);
    } else if (r === "mouse") {
      const { mouseEvent: a } = t;
      e == null || e.showMenuAfterMouseEvent(o, a, s, n, i);
    } else if (o) {
      const a = this.beans, l = a.ctrlsSvc;
      l.getScrollFeature().ensureColumnVisible(o, "auto"), xt(a, () => {
        var d;
        const c = (d = l.getHeaderRowContainerCtrl(o.getPinned())) == null ? void 0 : d.getHeaderCtrlForColumn(o);
        c && (e == null || e.showMenuAfterButtonClick(
          o,
          c.getAnchorElementForMenu(i),
          s,
          n,
          i
        ));
      });
    }
  }
};
function Bo(e, t, s) {
  e.menuVisible !== t && (e.menuVisible = t, e.dispatchColEvent("menuVisibleChanged", s));
}
function kh(e) {
  const { enterpriseMenuFactory: t, filterMenuFactory: s, gos: i } = e;
  return t && Ae(i) ? t : s;
}
var xn = class extends ha {
  constructor() {
    super(...arguments), this.errorMessages = null;
  }
  init(e) {
    this.params = e, this.initialiseEditor(e), this.eEditor.onValueChange(() => e.validate());
  }
  destroy() {
    this.errorMessages = null;
  }
}, xf = class extends D {
  constructor() {
    super();
  }
}, mx = {
  tag: "span",
  cls: "ag-overlay-loading-center"
}, Cx = class extends xf {
  init() {
    var t;
    const e = Ce((t = this.gos.get("overlayLoadingTemplate")) == null ? void 0 : t.trim());
    if (this.setTemplate(e ?? mx), !e) {
      const i = this.getLocaleTextFunc()("loadingOoo", "Loading...");
      this.getGui().textContent = i, this.beans.ariaAnnounce.announceValue(i, "overlay");
    }
  }
}, vx = { tag: "span", cls: "ag-overlay-no-rows-center" }, wx = class extends xf {
  init() {
    var t;
    const e = Ce((t = this.gos.get("overlayNoRowsTemplate")) == null ? void 0 : t.trim());
    if (this.setTemplate(e ?? vx), !e) {
      const i = this.getLocaleTextFunc()("noRowsToShow", "No Rows To Show");
      this.getGui().textContent = i, this.beans.ariaAnnounce.announceValue(i, "overlay");
    }
  }
};
function Bt(e, t, s) {
  const i = N(e, t, s);
  if (i) {
    const { className: n } = i;
    if (typeof n == "string" && n.indexOf("ag-icon") > -1 || typeof n == "object" && n["ag-icon"])
      return i;
  }
  const r = K({ tag: "span" });
  return r.appendChild(i), r;
}
function N(e, t, s) {
  var n;
  let i = null;
  e === "smallDown" ? F(262) : e === "smallLeft" ? F(263) : e === "smallRight" && F(264);
  const r = s && s.getColDef().icons;
  if (r && (i = r[e]), t.gos && !i) {
    const o = t.gos.get("icons");
    o && (i = o[e]);
  }
  if (i) {
    let o;
    if (typeof i == "function")
      o = i();
    else if (typeof i == "string")
      o = i;
    else {
      F(38, { iconName: e });
      return;
    }
    if (typeof o == "string")
      return Oc(o);
    if (na(o))
      return o;
    F(133, { iconName: e });
    return;
  } else {
    const o = t.registry.getIcon(e);
    return o || (n = t.validation) == null || n.validateIcon(e), K({
      tag: "span",
      cls: `ag-icon ag-icon-${o ?? e}`,
      role: "presentation",
      attrs: { unselectable: "on" }
    });
  }
}
var bx = (
  /*css*/
  ".ag-dnd-ghost{align-items:center;background-color:var(--ag-drag-and-drop-image-background-color);border:var(--ag-drag-and-drop-image-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-drag-and-drop-image-shadow);color:var(--ag-text-color);cursor:move;display:flex;font-weight:500;gap:var(--ag-cell-widget-spacing);height:var(--ag-header-height);overflow:hidden;padding-left:var(--ag-cell-horizontal-padding);padding-right:var(--ag-cell-horizontal-padding);text-overflow:ellipsis;transform:translateY(calc(var(--ag-spacing)*2));white-space:nowrap}.ag-dnd-ghost-not-allowed{border:var(--ag-drag-and-drop-image-not-allowed-border)}"
), yx = {
  tag: "div",
  children: [
    {
      tag: "div",
      ref: "eGhost",
      cls: "ag-dnd-ghost ag-unselectable",
      children: [
        { tag: "span", ref: "eIcon", cls: "ag-dnd-ghost-icon ag-shake-left-to-right" },
        { tag: "div", ref: "eLabel", cls: "ag-dnd-ghost-label" }
      ]
    }
  ]
}, Sx = class extends D {
  constructor() {
    super(), this.dragSource = null, this.eIcon = x, this.eLabel = x, this.eGhost = x, this.registerCSS(bx);
  }
  postConstruct() {
    const e = (t) => Bt(t, this.beans, null);
    this.dropIconMap = {
      pinned: e("columnMovePin"),
      hide: e("columnMoveHide"),
      move: e("columnMoveMove"),
      left: e("columnMoveLeft"),
      right: e("columnMoveRight"),
      group: e("columnMoveGroup"),
      aggregate: e("columnMoveValue"),
      pivot: e("columnMovePivot"),
      notAllowed: e("dropNotAllowed")
    };
  }
  init(e) {
    this.dragSource = e.dragSource, this.setTemplate(yx), this.beans.environment.applyThemeClasses(this.eGhost);
  }
  destroy() {
    this.dragSource = null, super.destroy();
  }
  setIcon(e, t) {
    const { eGhost: s, eIcon: i, dragSource: r, dropIconMap: n, gos: o } = this;
    X(i);
    let a = null;
    e || (e = r != null && r.getDefaultIconName ? r.getDefaultIconName() : "notAllowed"), a = n[e], s.classList.toggle("ag-dnd-ghost-not-allowed", e === "notAllowed"), i.classList.toggle("ag-shake-left-to-right", t), !(a === n.hide && o.get("suppressDragLeaveHidesColumns")) && a && i.appendChild(a);
  }
  setLabel(e) {
    this.eLabel.textContent = e;
  }
}, xx = (
  /*css*/
  ".ag-checkbox-cell{height:100%}"
), Fx = {
  tag: "div",
  cls: "ag-cell-wrapper ag-checkbox-cell",
  role: "presentation",
  children: [
    {
      tag: "ag-checkbox",
      ref: "eCheckbox",
      role: "presentation"
    }
  ]
}, Rx = class extends D {
  constructor() {
    super(Fx, [_t]), this.eCheckbox = x, this.registerCSS(xx);
  }
  init(e) {
    this.refresh(e);
    const { eCheckbox: t, beans: s } = this, i = t.getInputElement();
    i.setAttribute("tabindex", "-1"), Tg(i, "polite"), this.addManagedListeners(i, {
      click: (r) => {
        if (he(r), t.isDisabled())
          return;
        const n = t.getValue();
        this.onCheckboxChanged(n);
      },
      dblclick: (r) => {
        he(r);
      }
    }), this.addManagedElementListeners(e.eGridCell, {
      keydown: (r) => {
        if (r.key === S.SPACE && !t.isDisabled()) {
          e.eGridCell === Q(s) && t.toggle();
          const n = t.getValue();
          this.onCheckboxChanged(n), r.preventDefault();
        }
      }
    });
  }
  refresh(e) {
    return this.params = e, this.updateCheckbox(e), !0;
  }
  updateCheckbox(e) {
    let t, s = !0;
    const { value: i, column: r, node: n } = e;
    if (n.group && r)
      if (typeof i == "boolean")
        t = i;
      else {
        const h = r.getColId();
        h.startsWith(ti) ? t = i == null || i === "" ? void 0 : i === "true" : n.aggData && n.aggData[h] !== void 0 || n.sourceRowIndex >= 0 ? t = i ?? void 0 : s = !1;
      }
    else
      t = i ?? void 0;
    const { eCheckbox: o } = this;
    if (!s) {
      o.setDisplayed(!1);
      return;
    }
    o.setValue(t);
    const a = e.disabled ?? !(r != null && r.isCellEditable(n));
    o.setDisabled(a);
    const l = this.getLocaleTextFunc(), c = sa(l, t), d = a ? c : `${l("ariaToggleCellValue", "Press SPACE to toggle cell value")} (${c})`;
    o.setInputAriaLabel(d);
  }
  onCheckboxChanged(e) {
    var o, a, l, c;
    const { params: t } = this, { column: s, node: i, value: r } = t;
    (a = (o = this.beans) == null ? void 0 : o.editSvc) == null || a.setEditingCells(
      [
        {
          column: s,
          colId: s.getColId(),
          rowIndex: i.rowIndex,
          rowPinned: i.rowPinned,
          state: "changed",
          oldValue: r,
          newValue: r
        }
      ],
      { update: !0, forceRefreshOfEditCellsOnly: !0 }
    );
    const n = i.setDataValue(s, e, "renderer");
    (c = this.beans.editSvc) == null || c.stopEditing(
      {
        rowNode: i,
        column: s
      },
      { source: (l = this.beans.editSvc) != null && l.isBatchEditing() ? "ui" : "api" }
    ), n || this.updateCheckbox(t);
  }
}, Gh = class {
  constructor(e, t) {
    this.beans = e, this.floating = t, this.all = /* @__PURE__ */ new Set(), this.visible = /* @__PURE__ */ new Set(), this.order = [], this.queued = /* @__PURE__ */ new Set();
  }
  size() {
    return this.visible.size;
  }
  add(e) {
    const { all: t, visible: s, order: i } = this;
    t.has(e) || (t.add(e), s.add(e), i.push(e), this.sort());
  }
  delete(e) {
    this.all.delete(e), this.visible.delete(e), this.queued.delete(e.id), be(this.order, e);
  }
  has(e) {
    return this.visible.has(e);
  }
  forEach(e) {
    this.order.forEach(e);
  }
  getByIndex(e) {
    return this.order[e];
  }
  getById(e) {
    for (const t of this.visible)
      if (t.id == e)
        return t;
  }
  clear() {
    const { all: e, visible: t, order: s, queued: i } = this;
    e.clear(), i.clear(), t.clear(), s.length = 0;
  }
  sort() {
    const { sortSvc: e, rowNodeSorter: t, gos: s } = this.beans, i = (e == null ? void 0 : e.getSortOptions()) ?? [], r = Tx(this.order);
    if (this.order.sort((o, a) => {
      var l, c;
      return (((l = o.pinnedSibling) == null ? void 0 : l.rowIndex) ?? 0) - (((c = a.pinnedSibling) == null ? void 0 : c.rowIndex) ?? 0);
    }), this.order = (t == null ? void 0 : t.doFullSort(this.order, i)) ?? this.order, !r)
      return;
    const n = wr(s);
    n === "bottom" || n === "pinnedBottom" ? this.order.push(r) : this.order.unshift(r);
  }
  hide(e) {
    const { all: t, visible: s } = this;
    t.forEach((i) => e(i) ? s.delete(i) : s.add(i)), this.order = Array.from(s), this.sort();
  }
  queue(e) {
    this.queued.add(e);
  }
  unqueue(e) {
    this.queued.delete(e);
  }
  forEachQueued(e) {
    this.queued.forEach(e);
  }
};
function Ff(e) {
  var s;
  if (e.level === -1)
    return !0;
  const t = e.parent;
  return (s = t == null ? void 0 : t.childrenAfterSort) != null && s.some((i) => i == e) ? Ff(t) : !1;
}
function rl(e, t) {
  const { gos: s, rowModel: i, filterManager: r } = e;
  return Le(s) ? !i.getRowNode(t.id) : r != null && r.isAnyFilterPresent() ? !Ff(t) : s.get("pivotMode") ? !t.group : !1;
}
function Px(e) {
  return !!e.footer && e.level === -1;
}
function Ex(e) {
  return !!e.pinnedSibling && Px(e.pinnedSibling);
}
function Tx(e) {
  var s;
  const t = e.findIndex(Ex);
  if (t > -1)
    return (s = e.splice(t, 1)) == null ? void 0 : s[0];
}
var Oh = class extends R {
  postConstruct() {
    const { gos: e, beans: t } = this;
    this.top = new Gh(t, "top"), this.bottom = new Gh(t, "bottom");
    const s = (r) => rl(t, r.pinnedSibling), i = () => {
      const r = e.get("isRowPinned");
      r && e.get("enableRowPinning") && t.rowModel.forEachNode((n) => this.pinRow(n, r(n)), !0), this.refreshRowPositions(), this.dispatchRowPinnedEvents();
    };
    this.addManagedEventListeners({
      gridStylesChanged: this.onGridStylesChanges.bind(this),
      modelUpdated: ({ keepRenderedRows: r }) => {
        this.tryToEmptyQueues(), this.pinGrandTotalRow(), this.forContainers((o) => o.hide(s));
        const n = this.refreshRowPositions();
        (!r || n) && this.dispatchRowPinnedEvents();
      },
      columnRowGroupChanged: () => {
        this.forContainers(Dx), this.refreshRowPositions();
      },
      rowNodeDataChanged: ({ node: r }) => {
        const n = e.get("isRowPinnable");
        ((n == null ? void 0 : n(r)) ?? !0) || this.pinRow(r, null);
      },
      firstDataRendered: i
    }), this.addManagedPropertyListener("pivotMode", () => {
      this.forContainers((r) => r.hide(s)), this.dispatchRowPinnedEvents();
    }), this.addManagedPropertyListener("grandTotalRow", ({ currentValue: r }) => {
      this._grandTotalPinned = r === "pinnedBottom" ? "bottom" : r === "pinnedTop" ? "top" : null;
    }), this.addManagedPropertyListener("isRowPinned", i);
  }
  destroy() {
    this.reset(!1), super.destroy();
  }
  reset(e = !0) {
    this.forContainers((t) => {
      const s = [];
      t.forEach((i) => s.push(i)), s.forEach((i) => this.pinRow(i, null)), t.clear();
    }), e && this.dispatchRowPinnedEvents();
  }
  pinRow(e, t, s) {
    var o;
    if (e.footer && e.level > -1)
      return;
    if (e.footer && e.level === -1) {
      this._grandTotalPinned = t, Ix(this.beans);
      return;
    }
    const i = e.rowPinned ?? ((o = e.pinnedSibling) == null ? void 0 : o.rowPinned);
    if (i != null && t != null && t != i) {
      const a = e.rowPinned ? e : e.pinnedSibling, l = e.rowPinned ? e.pinnedSibling : e;
      this.pinRow(a, null, s), this.pinRow(l, t, s);
      return;
    }
    const n = s && Ax(this.beans, e, s);
    if (n) {
      n.forEach((a) => this.pinRow(a, t));
      return;
    }
    if (t == null) {
      const a = e.rowPinned ? e : e.pinnedSibling, l = this.findPinnedRowNode(a);
      if (!l)
        return;
      l.delete(a);
      const c = a.pinnedSibling;
      nl(a), this.refreshRowPositions(t), this.dispatchRowPinnedEvents(c);
    } else {
      const a = Vh(this.beans, e, t), l = this.getContainer(t);
      l.add(a), rl(this.beans, e) && l.hide((c) => rl(this.beans, c.pinnedSibling)), this.refreshRowPositions(t), this.dispatchRowPinnedEvents(e);
    }
  }
  isManual() {
    return !0;
  }
  isEmpty(e) {
    return this.getContainer(e).size() === 0;
  }
  isRowsToRender(e) {
    return !this.isEmpty(e);
  }
  ensureRowHeightsValid() {
    let e = !1, t = 0;
    const s = (i) => {
      if (i.rowHeightEstimated) {
        const r = He(this.beans, i);
        i.setRowTop(t), i.setRowHeight(r.height), t += r.height, e = !0;
      }
    };
    return this.bottom.forEach(s), t = 0, this.top.forEach(s), this.eventSvc.dispatchEvent({
      type: "pinnedHeightChanged"
    }), e;
  }
  getPinnedTopTotalHeight() {
    return Bh(this.top);
  }
  getPinnedBottomTotalHeight() {
    return Bh(this.bottom);
  }
  getPinnedTopRowCount() {
    return this.top.size();
  }
  getPinnedBottomRowCount() {
    return this.bottom.size();
  }
  getPinnedTopRow(e) {
    return this.top.getByIndex(e);
  }
  getPinnedBottomRow(e) {
    return this.bottom.getByIndex(e);
  }
  getPinnedRowById(e, t) {
    return this.getContainer(t).getById(e);
  }
  forEachPinnedRow(e, t) {
    this.getContainer(e).forEach(t);
  }
  getPinnedState() {
    const e = (t) => {
      const s = [];
      return this.forEachPinnedRow(t, (i) => s.push(i.pinnedSibling.id)), s;
    };
    return {
      top: e("top"),
      bottom: e("bottom")
    };
  }
  setPinnedState(e) {
    this.forContainers((t, s) => {
      for (const i of e[s]) {
        const r = this.beans.rowModel.getRowNode(i);
        r ? this.pinRow(r, s) : t.queue(i);
      }
    });
  }
  getGrandTotalPinned() {
    return this._grandTotalPinned;
  }
  setGrandTotalPinned(e) {
    this._grandTotalPinned = e;
  }
  tryToEmptyQueues() {
    this.forContainers((e, t) => {
      const s = /* @__PURE__ */ new Set();
      e.forEachQueued((i) => {
        const r = this.beans.rowModel.getRowNode(i);
        r && s.add(r);
      });
      for (const i of s)
        e.unqueue(i.id), this.pinRow(i, t);
    });
  }
  pinGrandTotalRow() {
    var a;
    const { gos: e, beans: t, _grandTotalPinned: s } = this, i = t.rowModel;
    if (!te(e))
      return;
    const r = (a = i.rootNode) == null ? void 0 : a.sibling;
    if (!r)
      return;
    const n = r.pinnedSibling, o = n && this.findPinnedRowNode(n);
    if (s) {
      if (o && o.floating !== s && (o.delete(n), nl(n)), !o || o.floating !== s) {
        const l = Vh(t, r, s);
        this.getContainer(s).add(l);
      }
    } else {
      if (!o)
        return;
      o.delete(n), nl(n);
    }
  }
  onGridStylesChanges(e) {
    e.rowHeightChanged && this.forContainers(
      (t) => t.forEach((s) => s.setRowHeight(s.rowHeight, !0))
    );
  }
  getContainer(e) {
    return e === "top" ? this.top : this.bottom;
  }
  findPinnedRowNode(e) {
    if (this.top.has(e))
      return this.top;
    if (this.bottom.has(e))
      return this.bottom;
  }
  refreshRowPositions(e) {
    const t = (i) => Mx(this.beans, i);
    if (e)
      return t(this.getContainer(e));
    let s = !1;
    return this.forContainers((i) => {
      const r = t(i);
      s || (s = r);
    }), s;
  }
  forContainers(e) {
    e(this.top, "top"), e(this.bottom, "bottom");
  }
  dispatchRowPinnedEvents(e) {
    this.eventSvc.dispatchEvent({ type: "pinnedRowsChanged" }), e == null || e.dispatchRowEvent("rowPinned");
  }
};
function Mx(e, t) {
  let s = 0, i = !1;
  return t.forEach((r, n) => {
    if (i || (i = r.rowTop !== s), r.setRowTop(s), r.rowHeightEstimated || r.rowHeight == null) {
      const o = He(e, r).height;
      i || (i = r.rowHeight !== o), r.setRowHeight(o);
    }
    r.setRowIndex(n), s += r.rowHeight;
  }), i;
}
function Vh(e, t, s) {
  if (t.pinnedSibling)
    return t.pinnedSibling;
  const i = qp(t, e);
  i.setRowTop(null), i.setRowIndex(null), i.rowPinned = s;
  const r = s === "top" ? ad : ld;
  return i.id = `${r}${s}-${t.id}`, i.pinnedSibling = t, t.pinnedSibling = i, i;
}
function nl(e) {
  if (!e.pinnedSibling)
    return;
  e.rowPinned = null, e.setRowTop(null), e.setRowIndex(null);
  const t = e.pinnedSibling;
  e.pinnedSibling = void 0, t && (t.pinnedSibling = void 0, t.rowPinned = null);
}
function Dx(e) {
  const t = /* @__PURE__ */ new Set();
  e.forEach((s) => {
    s.group && t.add(s);
  }), t.forEach((s) => e.delete(s));
}
function Ax(e, t, s) {
  var n;
  const { rowSpanSvc: i } = e, r = (s && (i == null ? void 0 : i.isCellSpanning(s, t))) ?? !1;
  if (s && r)
    return (n = i == null ? void 0 : i.getCellSpan(s, t)) == null ? void 0 : n.spannedNodes;
}
function Bh(e) {
  const t = e.size();
  if (t === 0)
    return 0;
  const s = e.getByIndex(t - 1);
  return s === void 0 ? 0 : s.rowTop + s.rowHeight;
}
function Ix({ gos: e, rowModel: t }) {
  te(e) && t.refreshModel({ step: "map" });
}
var Nh = class extends R {
  constructor() {
    super(...arguments), this.nextId = 0, this.pinnedTopRows = { cache: {}, order: [] }, this.pinnedBottomRows = { cache: {}, order: [] };
  }
  postConstruct() {
    const e = this.gos;
    this.setPinnedRowData(e.get("pinnedTopRowData"), "top"), this.setPinnedRowData(e.get("pinnedBottomRowData"), "bottom"), this.addManagedPropertyListener("pinnedTopRowData", (t) => this.setPinnedRowData(t.currentValue, "top")), this.addManagedPropertyListener("pinnedBottomRowData", (t) => this.setPinnedRowData(t.currentValue, "bottom")), this.addManagedEventListeners({ gridStylesChanged: this.onGridStylesChanges.bind(this) });
  }
  reset() {
  }
  isEmpty(e) {
    return this.getCache(e).order.length === 0;
  }
  isRowsToRender(e) {
    return !this.isEmpty(e);
  }
  isManual() {
    return !1;
  }
  pinRow(e, t) {
  }
  onGridStylesChanges(e) {
    if (e.rowHeightChanged) {
      const t = (s) => {
        s.setRowHeight(s.rowHeight, !0);
      };
      Pr(this.pinnedBottomRows, t), Pr(this.pinnedTopRows, t);
    }
  }
  ensureRowHeightsValid() {
    let e = !1, t = 0;
    const s = (i) => {
      if (i.rowHeightEstimated) {
        const r = He(this.beans, i);
        i.setRowTop(t), i.setRowHeight(r.height), t += r.height, e = !0;
      }
    };
    return Pr(this.pinnedBottomRows, s), t = 0, Pr(this.pinnedTopRows, s), this.eventSvc.dispatchEvent({
      type: "pinnedHeightChanged"
    }), e;
  }
  setPinnedRowData(e, t) {
    this.updateNodesFromRowData(e, t), this.eventSvc.dispatchEvent({
      type: "pinnedRowDataChanged"
    });
  }
  /**
   * Updates existing RowNode instances and creates new ones if necessary
   *
   * Setting data as `undefined` will clear row nodes
   */
  updateNodesFromRowData(e, t) {
    const s = this.getCache(t);
    if (e === void 0) {
      s.order.length = 0, s.cache = {};
      return;
    }
    const i = es(this.gos), r = t === "top" ? ad : ld, n = new Set(s.order), o = [], a = /* @__PURE__ */ new Set();
    let l = 0, c = -1;
    for (const d of e) {
      const h = (i == null ? void 0 : i({ data: d, level: 0, rowPinned: t })) ?? r + this.nextId++;
      if (a.has(h)) {
        F(96, { id: h, data: d });
        continue;
      }
      c++, a.add(h), o.push(h);
      const u = $r(s, h);
      if (u !== void 0)
        u.data !== d && u.updateData(d), l += this.setRowTopAndRowIndex(u, l, c), n.delete(h);
      else {
        const g = new ft(this.beans);
        g.id = h, g.data = d, g.rowPinned = t, l += this.setRowTopAndRowIndex(g, l, c), s.cache[h] = g, s.order.push(h);
      }
    }
    n.forEach((d) => {
      var h;
      (h = $r(s, d)) == null || h.clearRowTopAndRowIndex(), delete s.cache[d];
    }), s.order = o;
  }
  setRowTopAndRowIndex(e, t, s) {
    return e.setRowTop(t), e.setRowHeight(He(this.beans, e).height), e.setRowIndex(s), e.rowHeight;
  }
  getPinnedTopTotalHeight() {
    return Hh(this.pinnedTopRows);
  }
  getPinnedBottomTotalHeight() {
    return Hh(this.pinnedBottomRows);
  }
  getPinnedTopRowCount() {
    return sc(this.pinnedTopRows);
  }
  getPinnedBottomRowCount() {
    return sc(this.pinnedBottomRows);
  }
  getPinnedTopRow(e) {
    return tc(this.pinnedTopRows, e);
  }
  getPinnedBottomRow(e) {
    return tc(this.pinnedBottomRows, e);
  }
  getPinnedRowById(e, t) {
    return $r(this.getCache(t), e);
  }
  forEachPinnedRow(e, t) {
    return Pr(this.getCache(e), t);
  }
  getCache(e) {
    return e === "top" ? this.pinnedTopRows : this.pinnedBottomRows;
  }
  getPinnedState() {
    return { top: [], bottom: [] };
  }
  setPinnedState() {
  }
  getGrandTotalPinned() {
  }
  setGrandTotalPinned() {
  }
};
function Hh(e) {
  const t = sc(e);
  if (t === 0)
    return 0;
  const s = tc(e, t - 1);
  return s === void 0 ? 0 : s.rowTop + s.rowHeight;
}
function $r(e, t) {
  return e.cache[t];
}
function tc(e, t) {
  return $r(e, e.order[t]);
}
function Pr(e, t) {
  e.order.forEach((s, i) => {
    const r = $r(e, s);
    r && t(r, i);
  });
}
function sc(e) {
  return e.order.length;
}
var Lx = class extends R {
  constructor() {
    super(...arguments), this.beanName = "pinnedRowModel";
  }
  postConstruct() {
    const { gos: e } = this, t = () => {
      const s = e.get("enableRowPinning"), i = wr(e), n = !!s || (i === "pinnedBottom" || i === "pinnedTop"), o = n ? this.inner instanceof Nh : this.inner instanceof Oh;
      this.inner && o && this.destroyBean(this.inner), (o || !this.inner) && (this.inner = this.createManagedBean(
        n ? new Oh() : new Nh()
      ));
    };
    this.addManagedPropertyListeners(["enableRowPinning", "grandTotalRow"], t), t();
  }
  reset() {
    return this.inner.reset();
  }
  isEmpty(e) {
    return this.inner.isEmpty(e);
  }
  isManual() {
    return this.inner.isManual();
  }
  isRowsToRender(e) {
    return this.inner.isRowsToRender(e);
  }
  pinRow(e, t, s) {
    return this.inner.pinRow(e, t, s);
  }
  ensureRowHeightsValid() {
    return this.inner.ensureRowHeightsValid();
  }
  getPinnedRowById(e, t) {
    return this.inner.getPinnedRowById(e, t);
  }
  getPinnedTopTotalHeight() {
    return this.inner.getPinnedTopTotalHeight();
  }
  getPinnedBottomTotalHeight() {
    return this.inner.getPinnedBottomTotalHeight();
  }
  getPinnedTopRowCount() {
    return this.inner.getPinnedTopRowCount();
  }
  getPinnedBottomRowCount() {
    return this.inner.getPinnedBottomRowCount();
  }
  getPinnedTopRow(e) {
    return this.inner.getPinnedTopRow(e);
  }
  getPinnedBottomRow(e) {
    return this.inner.getPinnedBottomRow(e);
  }
  forEachPinnedRow(e, t) {
    return this.inner.forEachPinnedRow(e, t);
  }
  getPinnedState() {
    return this.inner.getPinnedState();
  }
  setPinnedState(e) {
    return this.inner.setPinnedState(e);
  }
  setGrandTotalPinned(e) {
    return this.inner.setGrandTotalPinned(e);
  }
  getGrandTotalPinned() {
    return this.inner.getGrandTotalPinned();
  }
}, kx = "ROOT_NODE_ID", Rf = class extends R {
  constructor() {
    super(...arguments), this.nextId = 0, this.allNodesMap = {}, this.rootNode = null;
  }
  getRowNode(e) {
    return this.allNodesMap[e];
  }
  extractRowData() {
    var e, t;
    return (t = (e = this.rootNode) == null ? void 0 : e.allLeafChildren) == null ? void 0 : t.map((s) => s.data);
  }
  activate(e) {
    this.rootNode = e, e.group = !0, e.level = -1, e.id = kx, e.allLeafChildren = [], e.childrenAfterGroup = [], e.childrenAfterSort = [], e.childrenAfterAggFilter = [], e.childrenAfterFilter = [], this.updateRootSiblingArrays(e);
  }
  deactivate() {
    this.rootNode && (this.allNodesMap = {}, this.rootNode = null);
  }
  destroy() {
    super.destroy(), this.allNodesMap = {}, this.rootNode = null;
  }
  setNewRowData(e) {
    const t = this.rootNode;
    t && (this.dispatchRowDataUpdateStartedEvent(e), t.childrenAfterFilter = null, t.childrenAfterGroup = null, t.childrenAfterAggFilter = null, t.childrenAfterSort = null, t.childrenMapped = null, t.updateHasChildren(), this.allNodesMap = {}, this.nextId = 0, this.loadNewRowData(e), this.updateRootSiblingArrays(t));
  }
  updateRootSiblingArrays(e) {
    const t = e.sibling;
    t && (t.childrenAfterFilter = e.childrenAfterFilter, t.childrenAfterGroup = e.childrenAfterGroup, t.childrenAfterAggFilter = e.childrenAfterAggFilter, t.childrenAfterSort = e.childrenAfterSort, t.childrenMapped = e.childrenMapped, t.allLeafChildren = e.allLeafChildren);
  }
  loadNewRowData(e) {
    this.rootNode.allLeafChildren = (e == null ? void 0 : e.map((t, s) => this.createRowNode(t, s))) ?? [];
  }
  setImmutableRowData(e, t) {
    var p;
    const s = es(this.gos), i = !this.gos.get("suppressMaintainUnsortedOrder"), r = e.changedRowNodes, n = /* @__PURE__ */ new Set(), o = this.rootNode, a = o.allLeafChildren, l = a.length;
    let c = !1, d = !1, h = !1, u = !1;
    for (let f = 0, m = -1, C = t.length; f < C; f++) {
      const v = t[f];
      let w = this.getRowNode(
        s({ data: v, level: 0 })
      );
      if (!w)
        c = !0, w = this.createRowNode(v, -1), r.add(w);
      else {
        if (i) {
          const b = w.sourceRowIndex;
          u || (u = b <= m || // A node was moved up, so order changed
          c), m = b;
        }
        w.data !== v && (h = !0, w.updateData(v), r.update(w));
      }
      n.add(w);
    }
    const g = [];
    for (let f = 0; f < l; f++) {
      const m = a[f];
      n.has(m) || (d = !0, m.isSelected() && g.push(m), m.pinnedSibling && ((p = this.beans.pinnedRowModel) == null || p.pinRow(m.pinnedSibling, null)), this.rowNodeDeleted(m), r.remove(m));
    }
    if (c || d || u) {
      const f = new Array(n.size);
      let m = 0;
      if (!i)
        for (let v = 0; v < l; ++v) {
          const w = a[v];
          n.delete(w) && (w.sourceRowIndex = m, f[m++] = w);
        }
      for (const v of n)
        v.sourceRowIndex = m, f[m++] = v;
      o.allLeafChildren = f;
      const C = o.sibling;
      C && (C.allLeafChildren = f), e.rowNodesOrderChanged || (e.rowNodesOrderChanged = u);
    }
    (c || d || u || h) && (this.deselectNodes(g), e.rowDataUpdated = !0);
  }
  /** Called when a node needs to be deleted */
  rowNodeDeleted(e) {
    e.clearRowTopAndRowIndex();
    const t = e.id, s = this.allNodesMap;
    s[t] === e && delete s[t];
  }
  updateRowData(e, t) {
    this.dispatchRowDataUpdateStartedEvent(e.add);
    const s = {
      changedRowNodes: t,
      rowNodeTransaction: { remove: [], update: [], add: [] },
      rowsInserted: !1
    }, i = [], r = es(this.gos);
    return this.executeRemove(r, e, s, i), this.executeUpdate(r, e, s, i), this.executeAdd(e, s), this.deselectNodes(i), s;
  }
  executeAdd(e, t) {
    const s = e.add;
    if (!(s != null && s.length))
      return;
    let i = this.rootNode.allLeafChildren, r = i.length;
    if (typeof e.addIndex == "number" && (r = this.sanitizeAddIndex(e.addIndex), r > 0 && this.gos.get("treeData") && this.gos.get("getDataPath")))
      for (let h = 0; h < i.length; h++) {
        const u = i[h];
        if ((u == null ? void 0 : u.rowIndex) == r - 1) {
          r = h + 1;
          break;
        }
      }
    const n = s.length, o = t.changedRowNodes, a = new Array(n);
    for (let d = 0; d < n; d++) {
      const h = this.createRowNode(s[d], r + d);
      o.add(h), a[d] = h;
    }
    const l = this.rootNode;
    if (r < i.length) {
      const d = i.slice(0, r), h = i.slice(r, i.length), u = d.length + a.length;
      for (let g = 0, p = h.length; g < p; ++g)
        h[g].sourceRowIndex = u + g;
      i = [...d, ...a, ...h], t.rowsInserted = !0;
    } else
      i = i.concat(a);
    l.allLeafChildren = i;
    const c = l.sibling;
    c && (c.allLeafChildren = i), t.rowNodeTransaction.add = a;
  }
  executeRemove(e, t, { changedRowNodes: s, rowNodeTransaction: i }, r) {
    var c, d;
    const { remove: n } = t;
    if (!(n != null && n.length))
      return;
    const o = {};
    n.forEach((h) => {
      var g;
      const u = this.lookupRowNode(e, h);
      u && (u.isSelected() && r.push(u), u.pinnedSibling && ((g = this.beans.pinnedRowModel) == null || g.pinRow(u.pinnedSibling, null)), u.clearRowTopAndRowIndex(), o[u.id] = !0, delete this.allNodesMap[u.id], i.remove.push(u), s.remove(u));
    });
    const a = this.rootNode;
    a.allLeafChildren = ((c = a.allLeafChildren) == null ? void 0 : c.filter((h) => !o[h.id])) ?? null, (d = a.allLeafChildren) == null || d.forEach((h, u) => {
      h.sourceRowIndex = u;
    });
    const l = a.sibling;
    l && (l.allLeafChildren = a.allLeafChildren);
  }
  executeUpdate(e, t, { changedRowNodes: s, rowNodeTransaction: i }, r) {
    const { update: n } = t;
    n != null && n.length && n.forEach((o) => {
      const a = this.lookupRowNode(e, o);
      a && (a.updateData(o), !a.selectable && a.isSelected() && r.push(a), i.update.push(a), s.update(a));
    });
  }
  dispatchRowDataUpdateStartedEvent(e) {
    this.eventSvc.dispatchEvent({
      type: "rowDataUpdateStarted",
      firstRowData: e != null && e.length ? e[0] : null
    });
  }
  deselectNodes(e) {
    var r;
    const t = "rowDataChanged", s = this.beans.selectionSvc, i = e.length > 0;
    i && (s == null || s.setNodesSelected({
      newValue: !1,
      nodes: e,
      suppressFinishActions: !0,
      source: t
    })), (r = s == null ? void 0 : s.updateGroupsFromChildrenSelections) == null || r.call(s, t), i && this.eventSvc.dispatchEvent({
      type: "selectionChanged",
      source: t,
      selectedNodes: (s == null ? void 0 : s.getSelectedNodes()) ?? null,
      serverSideState: null
    });
  }
  sanitizeAddIndex(e) {
    var s;
    const t = ((s = this.rootNode.allLeafChildren) == null ? void 0 : s.length) ?? 0;
    return e < 0 || e >= t || Number.isNaN(e) ? t : Math.ceil(e);
  }
  createRowNode(e, t) {
    const s = new ft(this.beans);
    return s.parent = this.rootNode, s.level = 0, s.group = !1, s.expanded = !1, s.sourceRowIndex = t, s.setDataAndId(e, String(this.nextId)), this.allNodesMap[s.id] && F(2, { nodeId: s.id }), this.allNodesMap[s.id] = s, this.nextId++, s;
  }
  lookupRowNode(e, t) {
    var i, r;
    let s;
    if (e) {
      const n = e({ data: t, level: 0 });
      if (s = this.allNodesMap[n], !s)
        return j(4, { id: n }), null;
    } else if (s = (r = (i = this.rootNode) == null ? void 0 : i.allLeafChildren) == null ? void 0 : r.find((n) => n.data === t), !s)
      return j(5, { data: t }), null;
    return s || null;
  }
}, Kt = /* @__PURE__ */ ((e) => (e.Applied = "Applied", e.StoreNotFound = "StoreNotFound", e.StoreLoading = "StoreLoading", e.StoreWaitingToLoad = "StoreWaitingToLoad", e.StoreLoadingFailed = "StoreLoadingFailed", e.StoreWrongType = "StoreWrongType", e.Cancelled = "Cancelled", e.StoreNotStarted = "StoreNotStarted", e))(Kt || {});
function Fn(e) {
  return !!(e.rowPinned && e.pinnedSibling);
}
function Et(e, t, s, i) {
  const r = t === "top";
  if (!s)
    return Et(
      e,
      t,
      r ? e.getPinnedTopRow(0) : e.getPinnedBottomRow(0),
      i
    );
  if (!i) {
    const l = r ? e.getPinnedTopRowCount() : e.getPinnedBottomRowCount();
    return Et(
      e,
      t,
      s,
      r ? e.getPinnedTopRow(l - 1) : e.getPinnedBottomRow(l - 1)
    );
  }
  let n = !1, o = !1;
  const a = [];
  return e.forEachPinnedRow(t, (l) => {
    if (l === s && !n) {
      n = !0, a.push(l);
      return;
    }
    if (n && l === i) {
      o = !0, a.push(l);
      return;
    }
    n && !o && a.push(l);
  }), a;
}
var Gx = {
  tag: "div",
  cls: "ag-selection-checkbox",
  role: "presentation",
  children: [
    {
      tag: "ag-checkbox",
      ref: "eCheckbox",
      role: "presentation"
    }
  ]
}, Ox = class extends D {
  constructor() {
    super(Gx, [_t]), this.eCheckbox = x;
  }
  postConstruct() {
    this.eCheckbox.setPassive(!0);
  }
  onDataChanged() {
    this.onSelectionChanged();
  }
  onSelectableChanged() {
    this.showOrHideSelect();
  }
  onSelectionChanged() {
    const e = this.getLocaleTextFunc(), { rowNode: t, eCheckbox: s } = this, i = t.isSelected(), r = sa(e, i), [n, o] = t.selectable ? ["ariaRowToggleSelection", "Press Space to toggle row selection"] : ["ariaRowSelectionDisabled", "Row Selection is disabled for this row"], a = e(n, o);
    s.setValue(i, !0), s.setInputAriaLabel(`${a} (${r})`);
  }
  init(e) {
    if (this.rowNode = e.rowNode, this.column = e.column, this.overrides = e.overrides, this.onSelectionChanged(), this.addManagedListeners(this.eCheckbox.getInputElement(), {
      // we don't want double click on this icon to open a group
      dblclick: he,
      click: (i) => {
        var r;
        he(i), (r = this.beans.selectionSvc) == null || r.handleSelectionEvent(i, this.rowNode, "checkboxSelected");
      }
    }), this.addManagedListeners(this.rowNode, {
      rowSelected: this.onSelectionChanged.bind(this),
      dataChanged: this.onDataChanged.bind(this),
      selectableChanged: this.onSelectableChanged.bind(this)
    }), this.addManagedPropertyListener("rowSelection", ({ currentValue: i, previousValue: r }) => {
      const n = typeof i == "object" ? Wa(i) : void 0, o = typeof r == "object" ? Wa(r) : void 0;
      n !== o && this.onSelectableChanged();
    }), zl(this.gos) || typeof this.getIsVisible() == "function") {
      const i = this.showOrHideSelect.bind(this);
      this.addManagedEventListeners({ displayedColumnsChanged: i }), this.addManagedListeners(this.rowNode, {
        dataChanged: i,
        cellChanged: i
      }), this.showOrHideSelect();
    }
    this.eCheckbox.getInputElement().setAttribute("tabindex", "-1");
  }
  showOrHideSelect() {
    const { column: e, rowNode: t, overrides: s, gos: i } = this, r = t.selectable, n = this.getIsVisible();
    let o;
    if (typeof n == "function") {
      const h = s == null ? void 0 : s.callbackParams;
      if (!e)
        o = n({ ...h, node: t, data: t.data });
      else {
        const u = e.createColumnFunctionCallbackParams(t);
        o = n({ ...h, ...u });
      }
    } else
      o = n ?? !1;
    const a = r && !o || !r && o, l = r || o, c = i.get("rowSelection"), d = c && typeof c != "string" ? !Wa(c) : !!(e != null && e.getColDef().showDisabledCheckboxes);
    if (this.setVisible(l && (a ? d : !0)), this.setDisplayed(l && (a ? d : !0)), l && this.eCheckbox.setDisabled(a), s != null && s.removeHidden) {
      this.setDisplayed(l);
      return;
    }
  }
  getIsVisible() {
    var s, i;
    const e = this.overrides;
    if (e)
      return e.isVisible;
    const t = this.gos.get("rowSelection");
    return t && typeof t != "string" ? vi(t) : (i = (s = this.column) == null ? void 0 : s.getColDef()) == null ? void 0 : i.checkboxSelection;
  }
}, Vx = class {
  constructor(e, t) {
    this.rowModel = e, this.pinnedRowModel = t, this.selectAll = !1, this.rootId = null, this.endId = null, this.cachedRange = [];
  }
  reset() {
    this.rootId = null, this.endId = null, this.cachedRange.length = 0;
  }
  setRoot(e) {
    this.rootId = e.id, this.endId = null, this.cachedRange.length = 0;
  }
  setEndRange(e) {
    this.endId = e.id, this.cachedRange.length = 0;
  }
  getRange() {
    if (this.cachedRange.length === 0) {
      const e = this.getRoot(), t = this.getEnd();
      if (e == null || t == null)
        return this.cachedRange;
      this.cachedRange = this.getNodesInRange(e, t) ?? [];
    }
    return this.cachedRange;
  }
  isInRange(e) {
    return this.rootId === null ? !1 : this.getRange().some((t) => t.id === e.id);
  }
  getRoot(e) {
    if (this.rootId)
      return this.getRowNode(this.rootId);
    if (e)
      return this.setRoot(e), e;
  }
  getEnd() {
    if (this.endId)
      return this.getRowNode(this.endId);
  }
  getRowNode(e) {
    let t;
    const { rowModel: s, pinnedRowModel: i } = this;
    return t ?? (t = s.getRowNode(e)), i != null && i.isManual() && (t ?? (t = i.getPinnedRowById(e, "top")), t ?? (t = i.getPinnedRowById(e, "bottom"))), t;
  }
  /**
   * Truncates the range to the given node (assumed to be within the current range).
   * Returns nodes that remain in the current range and those that should be removed
   *
   * @param node - Node at which to truncate the range
   * @returns Object of nodes to either keep or discard (i.e. deselect) from the range
   */
  truncate(e) {
    const t = this.getRange();
    if (t.length === 0)
      return { keep: [], discard: [] };
    const s = t[0].id === this.rootId, i = t.findIndex((r) => r.id === e.id);
    if (i > -1) {
      const r = t.slice(0, i), n = t.slice(i + 1);
      return this.setEndRange(e), s ? { keep: r, discard: n } : { keep: n, discard: r };
    } else
      return { keep: t, discard: [] };
  }
  /**
   * Extends the range to the given node. Returns nodes that remain in the current range
   * and those that should be removed.
   *
   * @param node - Node marking the new end of the range
   * @returns Object of nodes to either keep or discard (i.e. deselect) from the range
   */
  extend(e, t = !1) {
    const s = this.getRoot();
    if (s == null) {
      const r = this.getRange().slice();
      return t && e.depthFirstSearch((n) => !n.group && r.push(n)), r.push(e), this.setRoot(e), { keep: r, discard: [] };
    }
    const i = this.getNodesInRange(s, e);
    if (!i)
      return this.setRoot(e), { keep: [e], discard: [] };
    if (i.find((r) => r.id === this.endId))
      return this.setEndRange(e), { keep: this.getRange(), discard: [] };
    {
      const r = this.getRange().slice();
      return this.setEndRange(e), { keep: this.getRange(), discard: r };
    }
  }
  getNodesInRange(e, t) {
    const { pinnedRowModel: s, rowModel: i } = this;
    if (!(s != null && s.isManual()))
      return i.getNodesInRangeForSelection(e, t);
    if (e.rowPinned === "top" && !t.rowPinned)
      return Et(s, "top", e, void 0).concat(i.getNodesInRangeForSelection(i.getRow(0), t) ?? []);
    if (e.rowPinned === "bottom" && !t.rowPinned) {
      const r = Et(s, "bottom", void 0, e), n = i.getRowCount(), o = i.getRow(n - 1);
      return (i.getNodesInRangeForSelection(t, o) ?? []).concat(r);
    }
    if (!e.rowPinned && !t.rowPinned)
      return i.getNodesInRangeForSelection(e, t);
    if (e.rowPinned === "top" && t.rowPinned === "top")
      return Et(s, "top", e, t);
    if (e.rowPinned === "bottom" && t.rowPinned === "top") {
      const r = Et(s, "top", t, void 0), n = Et(s, "bottom", void 0, e), o = i.getRow(0), a = i.getRow(i.getRowCount() - 1);
      return r.concat(i.getNodesInRangeForSelection(o, a) ?? []).concat(n);
    }
    if (!e.rowPinned && t.rowPinned === "top")
      return Et(s, "top", t, void 0).concat(i.getNodesInRangeForSelection(i.getRow(0), e) ?? []);
    if (e.rowPinned === "top" && t.rowPinned === "bottom") {
      const r = Et(s, "top", e, void 0), n = Et(s, "bottom", void 0, t), o = i.getRow(0), a = i.getRow(i.getRowCount() - 1);
      return r.concat(i.getNodesInRangeForSelection(o, a) ?? []).concat(n);
    }
    if (e.rowPinned === "bottom" && t.rowPinned === "bottom")
      return Et(s, "bottom", e, t);
    if (!e.rowPinned && t.rowPinned === "bottom") {
      const r = Et(s, "bottom", void 0, t), n = i.getRow(i.getRowCount());
      return (i.getNodesInRangeForSelection(e, n) ?? []).concat(r);
    }
    return null;
  }
}, Bx = class extends R {
  constructor(e) {
    super(), this.column = e, this.cbSelectAllVisible = !1, this.processingEventFromCheckbox = !1;
  }
  onSpaceKeyDown(e) {
    const t = this.cbSelectAll;
    t.isDisplayed() && !t.getGui().contains(Q(this.beans)) && (e.preventDefault(), t.setValue(!t.getValue()));
  }
  getCheckboxGui() {
    return this.cbSelectAll.getGui();
  }
  setComp(e) {
    this.headerCellCtrl = e;
    const t = this.createManagedBean(new Bi());
    this.cbSelectAll = t, t.addCss("ag-header-select-all"), Ye(t.getGui(), "presentation"), this.showOrHideSelectAll();
    const s = this.updateStateOfCheckbox.bind(this);
    this.addManagedEventListeners({
      newColumnsLoaded: () => this.showOrHideSelectAll(),
      displayedColumnsChanged: this.onDisplayedColumnsChanged.bind(this),
      selectionChanged: s,
      paginationChanged: s,
      modelUpdated: s
    }), this.addManagedPropertyListener("rowSelection", ({ currentValue: i, previousValue: r }) => {
      const n = (o) => typeof o == "string" || !o || o.mode === "singleRow" ? void 0 : o.selectAll;
      n(i) !== n(r) && this.showOrHideSelectAll(), this.updateStateOfCheckbox();
    }), this.addManagedListeners(t, { fieldValueChanged: this.onCbSelectAll.bind(this) }), t.getInputElement().setAttribute("tabindex", "-1"), this.refreshSelectAllLabel();
  }
  onDisplayedColumnsChanged(e) {
    this.isAlive() && this.showOrHideSelectAll(e.source === "uiColumnMoved");
  }
  showOrHideSelectAll(e = !1) {
    const t = this.isCheckboxSelection();
    this.cbSelectAllVisible = t, this.cbSelectAll.setDisplayed(t), t && (this.checkRightRowModelType("selectAllCheckbox"), this.checkSelectionType("selectAllCheckbox"), this.updateStateOfCheckbox()), this.refreshSelectAllLabel(e);
  }
  updateStateOfCheckbox() {
    if (!this.cbSelectAllVisible || this.processingEventFromCheckbox)
      return;
    this.processingEventFromCheckbox = !0;
    const e = this.getSelectAllMode(), t = this.beans.selectionSvc, s = this.cbSelectAll, i = t.getSelectAllState(e);
    s.setValue(i);
    const r = t.hasNodesToSelect(e);
    s.setDisabled(!r), this.refreshSelectAllLabel(), this.processingEventFromCheckbox = !1;
  }
  refreshSelectAllLabel(e = !1) {
    const t = this.getLocaleTextFunc(), { headerCellCtrl: s, cbSelectAll: i, cbSelectAllVisible: r } = this, n = i.getValue(), o = sa(t, n), a = t("ariaRowSelectAll", "Press Space to toggle all rows selection");
    s.setAriaDescriptionProperty(
      "selectAll",
      r ? `${a} (${o})` : null
    ), i.setInputAriaLabel(t("ariaHeaderSelection", "Column with Header Selection")), e || s.announceAriaDescription();
  }
  checkSelectionType(e) {
    return Ps(this.gos) ? !0 : (F(128, { feature: e }), !1);
  }
  checkRightRowModelType(e) {
    const { gos: t, rowModel: s } = this.beans;
    return te(t) || Le(t) ? !0 : (F(129, { feature: e, rowModel: s.getType() }), !1);
  }
  onCbSelectAll() {
    if (this.processingEventFromCheckbox || !this.cbSelectAllVisible)
      return;
    const e = this.cbSelectAll.getValue(), t = this.getSelectAllMode();
    let s = "uiSelectAll";
    t === "currentPage" ? s = "uiSelectAllCurrentPage" : t === "filtered" && (s = "uiSelectAllFiltered");
    const i = { source: s, selectAll: t }, r = this.beans.selectionSvc;
    e ? r.selectAllRowNodes(i) : r.deselectAllRowNodes(i);
  }
  /**
   * Checkbox is enabled when either the `headerCheckbox` option is enabled in the new selection API
   * or `headerCheckboxSelection` is enabled in the legacy API.
   */
  isCheckboxSelection() {
    const { column: e, gos: t, beans: s } = this, n = typeof t.get("rowSelection") == "object" ? "headerCheckbox" : "headerCheckboxSelection";
    return Pf(s, e) && this.checkRightRowModelType(n) && this.checkSelectionType(n);
  }
  getSelectAllMode() {
    const e = ip(this.gos, !1);
    if (e)
      return e;
    const { headerCheckboxSelectionCurrentPageOnly: t, headerCheckboxSelectionFilteredOnly: s } = this.column.getColDef();
    return t ? "currentPage" : s ? "filtered" : "all";
  }
  destroy() {
    super.destroy(), this.cbSelectAll = void 0, this.headerCellCtrl = void 0;
  }
};
function Pf({ gos: e, selectionColSvc: t }, s) {
  const i = e.get("rowSelection"), r = s.getColDef(), { headerCheckboxSelection: n } = r;
  let o = !1;
  if (typeof i == "object") {
    const l = Ds(s), c = la(s);
    (rn(i) === "autoGroupColumn" && c || l && (t != null && t.isSelectionColumnEnabled())) && (o = so(i));
  } else
    typeof n == "function" ? o = n(V(e, { column: s, colDef: r })) : o = !!n;
  return o;
}
var Ef = class extends R {
  postConstruct() {
    const { gos: e, beans: t } = this;
    this.selectionCtx = new Vx(t.rowModel, t.pinnedRowModel), this.addManagedPropertyListeners(["isRowSelectable", "rowSelection"], () => {
      const s = zl(e);
      s !== this.isRowSelectable && (this.isRowSelectable = s, this.updateSelectable());
    }), this.isRowSelectable = zl(e), this.addManagedEventListeners({
      cellValueChanged: (s) => this.updateRowSelectable(s.node),
      rowNodeDataChanged: (s) => this.updateRowSelectable(s.node)
    });
  }
  destroy() {
    super.destroy(), this.selectionCtx.reset();
  }
  createCheckboxSelectionComponent() {
    return new Ox();
  }
  createSelectAllFeature(e) {
    if (Pf(this.beans, e))
      return new Bx(e);
  }
  isMultiSelect() {
    return Ps(this.gos);
  }
  onRowCtrlSelected(e, t, s) {
    const i = !!e.rowNode.isSelected();
    e.forEachGui(s, (r) => {
      r.rowComp.toggleCss("ag-row-selected", i);
      const n = r.element;
      ta(n, i), n.contains(Q(this.beans)) && t(r);
    });
  }
  announceAriaRowSelection(e) {
    var r;
    if (this.isRowSelectionBlocked(e))
      return;
    const t = e.isSelected();
    if (!e.selectable)
      return;
    const i = this.getLocaleTextFunc()(
      t ? "ariaRowDeselect" : "ariaRowSelect",
      `Press SPACE to ${t ? "deselect" : "select"} this row`
    );
    (r = this.beans.ariaAnnounce) == null || r.announceValue(i, "rowSelection");
  }
  isRowSelectionBlocked(e) {
    return !e.selectable || e.rowPinned && !Fn(e) || !wt(this.gos);
  }
  updateRowSelectable(e, t) {
    var i;
    const s = e.rowPinned && e.pinnedSibling ? (
      // If row node is pinned sibling, copy selectable status over from sibling row node
      e.pinnedSibling.selectable
    ) : (
      // otherwise calculate selectable state directly
      ((i = this.isRowSelectable) == null ? void 0 : i.call(this, e)) ?? !0
    );
    return this.setRowSelectable(e, s, t), s;
  }
  setRowSelectable(e, t, s) {
    if (e.selectable !== t) {
      if (e.selectable = t, e.dispatchRowEvent("selectableChanged"), s)
        return;
      if (Ei(this.gos)) {
        const r = this.calculateSelectedFromChildren(e);
        this.setNodesSelected({ nodes: [e], newValue: r ?? !1, source: "selectableChanged" });
        return;
      }
      e.isSelected() && !e.selectable && this.setNodesSelected({ nodes: [e], newValue: !1, source: "selectableChanged" });
    }
  }
  calculateSelectedFromChildren(e) {
    var i;
    let t = !1, s = !1;
    if (!((i = e.childrenAfterGroup) != null && i.length))
      return e.selectable ? e.__selected : null;
    for (let r = 0; r < e.childrenAfterGroup.length; r++) {
      const n = e.childrenAfterGroup[r];
      let o = n.isSelected();
      if (!n.selectable) {
        const a = this.calculateSelectedFromChildren(n);
        if (a === null)
          continue;
        o = a;
      }
      switch (o) {
        case !0:
          t = !0;
          break;
        case !1:
          s = !0;
          break;
        default:
          return;
      }
    }
    if (!(t && s))
      return t ? !0 : s ? !1 : e.selectable ? e.__selected : null;
  }
  selectRowNode(e, t, s, i = "api") {
    const r = !e.selectable && t, n = e.__selected === t;
    if (r || n)
      return !1;
    e.__selected = t, e.dispatchRowEvent("rowSelected");
    const o = e.sibling;
    o && o.footer && o.__localEventService && o.dispatchRowEvent("rowSelected");
    const a = e.pinnedSibling;
    return a && a.rowPinned && a.__localEventService && a.dispatchRowEvent("rowSelected"), this.eventSvc.dispatchEvent({
      ...Yp(e, this.gos, "rowSelected"),
      event: s || null,
      source: i
    }), !0;
  }
  isCellCheckboxSelection(e, t) {
    const s = this.gos.get("rowSelection");
    if (s && typeof s != "string") {
      const i = Ds(e) && vi(s);
      return e.isColumnFunc(t, i);
    } else
      return e.isColumnFunc(t, e.colDef.checkboxSelection);
  }
  inferNodeSelections(e, t, s, i) {
    const { gos: r, selectionCtx: n } = this, o = e.isSelected(), a = Ei(r), l = jw(r), c = Yw(r), d = this.isMultiSelect(), h = i === "rowClicked";
    if (h && !(l || c))
      return null;
    if (t && s && d) {
      const u = n.getRoot();
      if (u)
        if (u.isSelected()) {
          const g = n.isInRange(e) ? n.truncate(e) : n.extend(e, a);
          return {
            deselect: g.discard,
            select: g.keep,
            reset: !1
          };
        } else {
          const g = n.extend(e, a);
          return {
            select: [],
            deselect: g.keep,
            reset: !1
          };
        }
      else return null;
    } else if (t && d) {
      const u = n.selectAll ? this.beans.rowModel.getRow(0) : void 0, g = n.getRoot(u), p = n.isInRange(e) ? n.truncate(e) : n.extend(e, a);
      return {
        select: p.keep,
        deselect: p.discard,
        reset: n.selectAll || !!(g && !g.isSelected())
      };
    } else if (s) {
      if (h) {
        const u = !o;
        return u && !l || !u && !c ? null : (n.setRoot(e), {
          node: e,
          newValue: u,
          clearSelection: !1
        });
      }
      return n.setRoot(e), {
        node: e,
        newValue: !o,
        clearSelection: !d
      };
    } else {
      n.setRoot(e);
      const u = qw(r), g = Po(r) === "filteredDescendants", p = h && (!u || !l);
      if (g && o === void 0 && te(r))
        return {
          node: e,
          newValue: !1,
          checkFilteredNodes: !0,
          clearSelection: !d || p
        };
      if (h) {
        const f = o ? !u : l;
        return f === o && !p || f && !l || !f && !c ? null : {
          node: e,
          newValue: f,
          clearSelection: !d || p,
          keepDescendants: e.group && a
        };
      }
      return {
        node: e,
        newValue: !o,
        clearSelection: !d || p
      };
    }
  }
}, oo = {
  TAB_GUARD: "ag-tab-guard",
  TAB_GUARD_TOP: "ag-tab-guard-top",
  TAB_GUARD_BOTTOM: "ag-tab-guard-bottom"
}, Nx = class extends R {
  constructor(e) {
    super(), this.skipTabGuardFocus = !1, this.forcingFocusOut = !1, this.allowFocus = !1;
    const {
      comp: t,
      eTopGuard: s,
      eBottomGuard: i,
      focusTrapActive: r,
      forceFocusOutWhenTabGuardsAreEmpty: n,
      isFocusableContainer: o,
      focusInnerElement: a,
      onFocusIn: l,
      onFocusOut: c,
      shouldStopEventPropagation: d,
      onTabKeyDown: h,
      handleKeyDown: u,
      isEmpty: g,
      eFocusableElement: p
    } = e;
    this.comp = t, this.eTopGuard = s, this.eBottomGuard = i, this.providedFocusInnerElement = a, this.eFocusableElement = p, this.focusTrapActive = !!r, this.forceFocusOutWhenTabGuardsAreEmpty = !!n, this.isFocusableContainer = !!o, this.providedFocusIn = l, this.providedFocusOut = c, this.providedShouldStopEventPropagation = d, this.providedOnTabKeyDown = h, this.providedHandleKeyDown = u, this.providedIsEmpty = g;
  }
  postConstruct() {
    this.createManagedBean(
      new ii(this.eFocusableElement, {
        shouldStopEventPropagation: () => this.shouldStopEventPropagation(),
        onTabKeyDown: (e) => this.onTabKeyDown(e),
        handleKeyDown: (e) => this.handleKeyDown(e),
        onFocusIn: (e) => this.onFocusIn(e),
        onFocusOut: (e) => this.onFocusOut(e)
      })
    ), this.activateTabGuards(), [this.eTopGuard, this.eBottomGuard].forEach(
      (e) => this.addManagedElementListeners(e, { focus: this.onFocus.bind(this) })
    );
  }
  handleKeyDown(e) {
    this.providedHandleKeyDown && this.providedHandleKeyDown(e);
  }
  tabGuardsAreActive() {
    return !!this.eTopGuard && this.eTopGuard.hasAttribute("tabIndex");
  }
  shouldStopEventPropagation() {
    return this.providedShouldStopEventPropagation ? this.providedShouldStopEventPropagation() : !1;
  }
  activateTabGuards() {
    if (this.forcingFocusOut)
      return;
    const e = this.gos.get("tabIndex");
    this.comp.setTabIndex(e.toString());
  }
  deactivateTabGuards() {
    this.comp.setTabIndex();
  }
  onFocus(e) {
    if (this.isFocusableContainer && !this.eFocusableElement.contains(e.relatedTarget) && !this.allowFocus) {
      this.findNextElementOutsideAndFocus(e.target === this.eBottomGuard);
      return;
    }
    if (this.skipTabGuardFocus) {
      this.skipTabGuardFocus = !1;
      return;
    }
    if (this.forceFocusOutWhenTabGuardsAreEmpty && (this.providedIsEmpty ? this.providedIsEmpty() : Vt(this.eFocusableElement, ".ag-tab-guard").length === 0)) {
      this.findNextElementOutsideAndFocus(e.target === this.eBottomGuard);
      return;
    }
    if (this.isFocusableContainer && this.eFocusableElement.contains(e.relatedTarget))
      return;
    const t = e.target === this.eBottomGuard;
    !(this.providedFocusInnerElement ? this.providedFocusInnerElement(t) : this.focusInnerElement(t)) && this.forceFocusOutWhenTabGuardsAreEmpty && this.findNextElementOutsideAndFocus(e.target === this.eBottomGuard);
  }
  findNextElementOutsideAndFocus(e) {
    var l;
    const t = me(this.beans), s = Vt(t.body, null, !0), i = s.indexOf(e ? this.eTopGuard : this.eBottomGuard);
    if (i === -1)
      return;
    let r, n;
    e ? (r = 0, n = i) : (r = i + 1, n = s.length);
    const o = s.slice(r, n), a = this.gos.get("tabIndex");
    o.sort((c, d) => {
      const h = parseInt(c.getAttribute("tabindex") || "0"), u = parseInt(d.getAttribute("tabindex") || "0");
      return u === a ? 1 : h === a ? -1 : h === 0 ? 1 : u === 0 ? -1 : h - u;
    }), (l = o[e ? o.length - 1 : 0]) == null || l.focus();
  }
  onFocusIn(e) {
    this.focusTrapActive || this.forcingFocusOut || (this.providedFocusIn && this.providedFocusIn(e), this.isFocusableContainer || this.deactivateTabGuards());
  }
  onFocusOut(e) {
    this.focusTrapActive || (this.providedFocusOut && this.providedFocusOut(e), this.eFocusableElement.contains(e.relatedTarget) || this.activateTabGuards());
  }
  onTabKeyDown(e) {
    if (this.providedOnTabKeyDown) {
      this.providedOnTabKeyDown(e);
      return;
    }
    if (this.focusTrapActive || e.defaultPrevented)
      return;
    const t = this.tabGuardsAreActive();
    t && this.deactivateTabGuards();
    const s = this.getNextFocusableElement(e.shiftKey);
    t && setTimeout(() => this.activateTabGuards(), 0), s && (s.focus(), e.preventDefault());
  }
  focusInnerElement(e = !1) {
    const t = Vt(this.eFocusableElement);
    return this.tabGuardsAreActive() && (t.splice(0, 1), t.splice(t.length - 1, 1)), t.length ? (t[e ? t.length - 1 : 0].focus({ preventScroll: !0 }), !0) : !1;
  }
  getNextFocusableElement(e) {
    return ze(this.beans, this.eFocusableElement, !1, e);
  }
  forceFocusOutOfContainer(e = !1) {
    if (this.forcingFocusOut)
      return;
    const t = e ? this.eTopGuard : this.eBottomGuard;
    this.activateTabGuards(), this.skipTabGuardFocus = !0, this.forcingFocusOut = !0, t.focus(), window.setTimeout(() => {
      this.forcingFocusOut = !1, this.activateTabGuards();
    });
  }
  isTabGuard(e, t) {
    return e === this.eTopGuard && !t || e === this.eBottomGuard && (t ?? !0);
  }
  setAllowFocus(e) {
    this.allowFocus = e;
  }
}, Tf = class extends R {
  constructor(e) {
    super(), this.comp = e;
  }
  initialiseTabGuard(e) {
    this.eTopGuard = this.createTabGuard("top"), this.eBottomGuard = this.createTabGuard("bottom"), this.eFocusableElement = this.comp.getFocusableElement();
    const { eTopGuard: t, eBottomGuard: s, eFocusableElement: i } = this, r = [t, s], n = {
      setTabIndex: (m) => {
        r.forEach(
          (C) => m != null ? C.setAttribute("tabindex", m) : C.removeAttribute("tabindex")
        );
      }
    };
    this.addTabGuards(t, s);
    const {
      focusTrapActive: o = !1,
      onFocusIn: a,
      onFocusOut: l,
      focusInnerElement: c,
      handleKeyDown: d,
      onTabKeyDown: h,
      shouldStopEventPropagation: u,
      isEmpty: g,
      forceFocusOutWhenTabGuardsAreEmpty: p,
      isFocusableContainer: f
    } = e;
    this.tabGuardCtrl = this.createManagedBean(
      new Nx({
        comp: n,
        focusTrapActive: o,
        eTopGuard: t,
        eBottomGuard: s,
        eFocusableElement: i,
        onFocusIn: a,
        onFocusOut: l,
        focusInnerElement: c,
        handleKeyDown: d,
        onTabKeyDown: h,
        shouldStopEventPropagation: u,
        isEmpty: g,
        forceFocusOutWhenTabGuardsAreEmpty: p,
        isFocusableContainer: f
      })
    );
  }
  getTabGuardCtrl() {
    return this.tabGuardCtrl;
  }
  createTabGuard(e) {
    const t = me(this.beans).createElement("div"), s = e === "top" ? oo.TAB_GUARD_TOP : oo.TAB_GUARD_BOTTOM;
    return t.classList.add(oo.TAB_GUARD, s), Ye(t, "presentation"), t;
  }
  addTabGuards(e, t) {
    const s = this.eFocusableElement;
    s.insertAdjacentElement("afterbegin", e), s.insertAdjacentElement("beforeend", t);
  }
  removeAllChildrenExceptTabGuards() {
    const e = [this.eTopGuard, this.eBottomGuard];
    X(this.comp.getFocusableElement()), this.addTabGuards(...e);
  }
  forceFocusOutOfContainer(e = !1) {
    this.tabGuardCtrl.forceFocusOutOfContainer(e);
  }
  appendChild(e, t, s) {
    na(t) || (t = t.getGui());
    const { eBottomGuard: i } = this;
    i ? i.insertAdjacentElement("beforebegin", t) : e(t, s);
  }
  destroy() {
    const { eTopGuard: e, eBottomGuard: t } = this;
    se(e), se(t), super.destroy();
  }
}, ls = class extends D {
  initialiseTabGuard(e) {
    this.tabGuardFeature = this.createManagedBean(new Tf(this)), this.tabGuardFeature.initialiseTabGuard(e);
  }
  forceFocusOutOfContainer(e = !1) {
    this.tabGuardFeature.forceFocusOutOfContainer(e);
  }
  appendChild(e, t) {
    this.tabGuardFeature.appendChild(super.appendChild.bind(this), e, t);
  }
}, ms = class {
  constructor(e, t = !1) {
    this.DOUBLE_TAP_MILLIS = 500, this.destroyFuncs = [], this.touching = !1, this.localEventService = new Rs(), this.preventMouseClick = t;
    const s = this.onTouchStart.bind(this), i = this.onTouchMove.bind(this), r = this.onTouchEnd.bind(this);
    e.addEventListener("touchstart", s, { passive: !0 }), e.addEventListener("touchmove", i, { passive: !0 }), e.addEventListener("touchend", r, { passive: !1 }), this.destroyFuncs.push(() => {
      e.removeEventListener("touchstart", s, { passive: !0 }), e.removeEventListener("touchmove", i, { passive: !0 }), e.removeEventListener("touchend", r, { passive: !1 });
    });
  }
  getActiveTouch(e) {
    for (let t = 0; t < e.length; t++)
      if (e[t].identifier === this.touchStart.identifier)
        return e[t];
    return null;
  }
  addEventListener(e, t) {
    this.localEventService.addEventListener(e, t);
  }
  removeEventListener(e, t) {
    this.localEventService.removeEventListener(e, t);
  }
  onTouchStart(e) {
    if (this.touching)
      return;
    this.touchStart = e.touches[0], this.touching = !0, this.moved = !1;
    const t = this.touchStart;
    window.setTimeout(() => {
      const s = this.touchStart === t;
      if (this.touching && s && !this.moved) {
        this.moved = !0;
        const i = {
          type: "longTap",
          touchStart: this.touchStart,
          touchEvent: e
        };
        this.localEventService.dispatchEvent(i);
      }
    }, 500);
  }
  onTouchMove(e) {
    if (!this.touching)
      return;
    const t = this.getActiveTouch(e.touches);
    if (!t)
      return;
    !Wg(t, this.touchStart, 4) && (this.moved = !0);
  }
  onTouchEnd(e) {
    if (this.touching) {
      if (!this.moved) {
        const t = {
          type: "tap",
          touchStart: this.touchStart
        };
        this.localEventService.dispatchEvent(t), this.checkForDoubleTap();
      }
      this.preventMouseClick && e.cancelable && e.preventDefault(), this.touching = !1;
    }
  }
  checkForDoubleTap() {
    const e = Date.now();
    if (this.lastTapTime && this.lastTapTime > 0)
      if (e - this.lastTapTime > this.DOUBLE_TAP_MILLIS) {
        const s = {
          type: "doubleTap",
          touchStart: this.touchStart
        };
        this.localEventService.dispatchEvent(s), this.lastTapTime = null;
      } else
        this.lastTapTime = e;
    else
      this.lastTapTime = e;
  }
  destroy() {
    this.destroyFuncs.forEach((e) => e());
  }
}, Mt = /* @__PURE__ */ ((e) => (e[e.VALUE = 0] = "VALUE", e[e.DIMENSION = 1] = "DIMENSION", e))(Mt || {}), yd = class {
  constructor(e) {
    this.tickingInterval = null, this.onScrollCallback = null, this.scrollContainer = e.scrollContainer, this.scrollHorizontally = e.scrollAxis.indexOf("x") !== -1, this.scrollVertically = e.scrollAxis.indexOf("y") !== -1, this.scrollByTick = e.scrollByTick != null ? e.scrollByTick : 20, e.onScrollCallback && (this.onScrollCallback = e.onScrollCallback), this.scrollVertically && (this.getVerticalPosition = e.getVerticalPosition, this.setVerticalPosition = e.setVerticalPosition), this.scrollHorizontally && (this.getHorizontalPosition = e.getHorizontalPosition, this.setHorizontalPosition = e.setHorizontalPosition), this.shouldSkipVerticalScroll = e.shouldSkipVerticalScroll || (() => !1), this.shouldSkipHorizontalScroll = e.shouldSkipHorizontalScroll || (() => !1);
  }
  check(e, t = !1) {
    const s = t || this.shouldSkipVerticalScroll();
    if (s && this.shouldSkipHorizontalScroll())
      return;
    const i = this.scrollContainer.getBoundingClientRect(), r = this.scrollByTick;
    this.tickLeft = e.clientX < i.left + r, this.tickRight = e.clientX > i.right - r, this.tickUp = e.clientY < i.top + r && !s, this.tickDown = e.clientY > i.bottom - r && !s, this.tickLeft || this.tickRight || this.tickUp || this.tickDown ? this.ensureTickingStarted() : this.ensureCleared();
  }
  ensureTickingStarted() {
    this.tickingInterval === null && (this.tickingInterval = window.setInterval(this.doTick.bind(this), 100), this.tickCount = 0);
  }
  doTick() {
    this.tickCount++;
    const e = this.tickCount > 20 ? 200 : this.tickCount > 10 ? 80 : 40;
    if (this.scrollVertically) {
      const t = this.getVerticalPosition();
      this.tickUp && this.setVerticalPosition(t - e), this.tickDown && this.setVerticalPosition(t + e);
    }
    if (this.scrollHorizontally) {
      const t = this.getHorizontalPosition();
      this.tickLeft && this.setHorizontalPosition(t - e), this.tickRight && this.setHorizontalPosition(t + e);
    }
    this.onScrollCallback && this.onScrollCallback();
  }
  ensureCleared() {
    this.tickingInterval && (window.clearInterval(this.tickingInterval), this.tickingInterval = null);
  }
}, Hx = class {
  constructor(e = "javascript") {
    this.frameworkName = e, this.renderingEngine = "vanilla", this.batchFrameworkComps = !1, this.wrapIncoming = (t) => t(), this.wrapOutgoing = (t) => t(), this.baseDocLink = `${Kg}/${this.frameworkName}-data-grid`, Bw(this.baseDocLink);
  }
  frameworkComponent(e) {
    return null;
  }
  isFrameworkComponent(e) {
    return !1;
  }
  getDocLink(e) {
    return `${this.baseDocLink}${e ? `/${e}` : ""}`;
  }
};
function zx(e) {
  return {
    beanName: "gridApi",
    bean: e.getBean("apiFunctionSvc").api
  };
}
var Wx = [
  // Validate license first
  "licenseManager",
  // core beans only
  "environment",
  "eventSvc",
  "gos",
  "paginationAutoPageSizeSvc",
  "apiFunctionSvc",
  "gridApi",
  "registry",
  "agCompUtils",
  "userCompFactory",
  "rowContainerHeight",
  "horizontalResizeSvc",
  "localeSvc",
  "pinnedRowModel",
  "dragSvc",
  "colGroupSvc",
  "visibleCols",
  "popupSvc",
  "selectionSvc",
  "colFilter",
  "quickFilter",
  "filterManager",
  "colModel",
  "headerNavigation",
  "pageBounds",
  "pagination",
  "pageBoundsListener",
  "rowSpanSvc",
  "stickyRowSvc",
  "rowRenderer",
  "expressionSvc",
  "alignedGridsSvc",
  "navigation",
  "valueCache",
  "valueSvc",
  "autoWidthCalc",
  "filterMenuFactory",
  "dragAndDrop",
  "focusSvc",
  "cellNavigation",
  "cellStyles",
  "scrollVisibleSvc",
  "sortSvc",
  "colHover",
  "colAnimation",
  "autoColSvc",
  "selectionColSvc",
  "changeDetectionSvc",
  "animationFrameSvc",
  "undoRedo",
  "colDefFactory",
  "rowStyleSvc",
  "rowNodeBlockLoader",
  "rowNodeSorter",
  "ctrlsSvc",
  "pinnedCols",
  "dataTypeSvc",
  "syncSvc",
  "overlays",
  "stateSvc",
  "expansionSvc",
  "apiEventSvc",
  "ariaAnnounce",
  "menuSvc",
  "colMoves",
  "colAutosize",
  "colFlex",
  "colResize",
  "pivotColsSvc",
  "valueColsSvc",
  "rowGroupColsSvc",
  "colNames",
  "colViewport",
  "pivotResultCols",
  "showRowGroupCols",
  "validation"
  // Have validations run last
], zh = Object.fromEntries(
  Wx.map((e, t) => [e, t])
);
function _x(e, t) {
  const s = (e.beanName ? zh[e.beanName] : void 0) ?? Number.MAX_SAFE_INTEGER, i = (t.beanName ? zh[t.beanName] : void 0) ?? Number.MAX_SAFE_INTEGER;
  return s - i;
}
function Ux(e, t) {
  return (e == null ? void 0 : e.beanName) === "gridDestroySvc" ? -1 : (t == null ? void 0 : t.beanName) === "gridDestroySvc" ? 1 : 0;
}
var $x = { tag: "div", cls: "ag-pinned-left-header", role: "rowgroup" }, Kx = { tag: "div", cls: "ag-pinned-right-header", role: "rowgroup" }, jx = {
  tag: "div",
  cls: "ag-header-viewport",
  role: "rowgroup",
  attrs: { tabindex: "-1" },
  children: [{ tag: "div", ref: "eCenterContainer", cls: "ag-header-container", role: "presentation" }]
}, ol = class extends D {
  constructor(e) {
    super(), this.eCenterContainer = x, this.headerRowComps = {}, this.rowCompsList = [], this.pinned = e;
  }
  postConstruct() {
    this.selectAndSetTemplate();
    const e = {
      setDisplayed: (s) => this.setDisplayed(s),
      setCtrls: (s) => this.setCtrls(s),
      // only gets called for center section
      setCenterWidth: (s) => this.eCenterContainer.style.width = s,
      setViewportScrollLeft: (s) => this.getGui().scrollLeft = s,
      // only gets called for pinned sections
      setPinnedContainerWidth: (s) => {
        const i = this.getGui();
        i.style.width = s, i.style.maxWidth = s, i.style.minWidth = s;
      }
    };
    this.createManagedBean(new px(this.pinned)).setComp(e, this.getGui());
  }
  selectAndSetTemplate() {
    const e = this.pinned == "left", t = this.pinned == "right", s = e ? $x : t ? Kx : jx;
    this.setTemplate(s), this.eRowContainer = this.eCenterContainer !== x ? this.eCenterContainer : this.getGui();
  }
  destroy() {
    this.setCtrls([]), super.destroy();
  }
  destroyRowComp(e) {
    this.destroyBean(e), this.eRowContainer.removeChild(e.getGui());
  }
  setCtrls(e) {
    const t = this.headerRowComps;
    this.headerRowComps = {}, this.rowCompsList = [];
    let s;
    const i = (r) => {
      const n = r.getGui();
      n.parentElement != this.eRowContainer && this.eRowContainer.appendChild(n), s && Vg(this.eRowContainer, n, s), s = n;
    };
    e.forEach((r) => {
      const n = r.instanceId, o = t[n];
      delete t[n];
      const a = o || this.createBean(new dx(r));
      this.headerRowComps[n] = a, this.rowCompsList.push(a), i(a);
    }), Object.values(t).forEach((r) => this.destroyRowComp(r));
  }
}, Yx = { tag: "div", cls: "ag-header", role: "presentation" }, qx = class extends D {
  constructor() {
    super(Yx);
  }
  postConstruct() {
    const e = {
      toggleCss: (i, r) => this.toggleCss(i, r),
      setHeightAndMinHeight: (i) => {
        this.getGui().style.height = i, this.getGui().style.minHeight = i;
      }
    };
    this.createManagedBean(new ix()).setComp(e, this.getGui(), this.getFocusableElement());
    const s = (i) => {
      this.createManagedBean(i), this.appendChild(i);
    };
    s(new ol("left")), s(new ol(null)), s(new ol("right"));
  }
}, Xx = {
  selector: "AG-HEADER-ROOT",
  component: qx
}, Zx = class extends D {
  constructor(e, t, s, i, r) {
    super(), this.cellCtrl = t, this.rendererVersion = 0, this.editorVersion = 0, this.beans = e, this.gos = e.gos, this.column = t.column, this.rowNode = t.rowNode, this.eRow = i;
    const n = K({
      tag: "div",
      role: t.getCellAriaRole(),
      attrs: {
        "comp-id": `${this.getCompId()}`,
        "col-id": t.column.colIdSanitised
      }
    });
    this.eCell = n;
    let o;
    t.isCellSpanning() ? (o = K({
      tag: "div",
      cls: "ag-spanned-cell-wrapper",
      role: "presentation"
    }), o.appendChild(n), this.setTemplateFromElement(o)) : this.setTemplateFromElement(n), this.cellCssManager = new Fp(() => n), this.forceWrapper = t.isForceWrapper(), this.refreshWrapper(!1);
    const a = {
      toggleCss: (l, c) => this.cellCssManager.toggleCss(l, c),
      setUserStyles: (l) => fn(n, l),
      getFocusableElement: () => n,
      setIncludeSelection: (l) => this.includeSelection = l,
      setIncludeRowDrag: (l) => this.includeRowDrag = l,
      setIncludeDndSource: (l) => this.includeDndSource = l,
      setRenderDetails: (l, c, d) => this.setRenderDetails(l, c, d),
      setEditDetails: (l, c, d) => this.setEditDetails(l, c, d),
      getCellEditor: () => this.cellEditor || null,
      getCellRenderer: () => this.cellRenderer || null,
      getParentOfValue: () => this.getParentOfValue(),
      refreshEditStyles: (l, c) => this.refreshEditStyles(l, c)
    };
    t.setComp(a, n, o, this.eCellWrapper, s, r, void 0);
  }
  getParentOfValue() {
    return this.eCellValue ?? this.eCellWrapper ?? this.eCell;
  }
  setRenderDetails(e, t, s) {
    var n;
    if (this.cellEditor && !this.cellEditorPopupWrapper)
      return;
    this.firstRender = this.firstRender == null;
    const r = this.refreshWrapper(!1);
    this.refreshEditStyles(!1), e ? !(s || r) && this.refreshCellRenderer(e) || (this.destroyRenderer(), this.createCellRendererInstance(e)) : (this.destroyRenderer(), this.insertValueWithoutCellRenderer(t)), (n = this.rowDraggingComp) == null || n.refreshVisibility();
  }
  setEditDetails(e, t, s) {
    e ? this.createCellEditorInstance(e, t, s) : this.destroyEditor();
  }
  removeControls() {
    const e = this.beans.context;
    this.checkboxSelectionComp = e.destroyBean(this.checkboxSelectionComp), this.dndSourceComp = e.destroyBean(this.dndSourceComp), this.rowDraggingComp = e.destroyBean(this.rowDraggingComp);
  }
  // returns true if wrapper was changed
  refreshWrapper(e) {
    const t = this.includeRowDrag || this.includeDndSource || this.includeSelection, s = t || this.forceWrapper, i = s && this.eCellWrapper == null;
    i && (this.eCellWrapper = K({ tag: "div", cls: "ag-cell-wrapper", role: "presentation" }), this.eCell.appendChild(this.eCellWrapper));
    const r = !s && this.eCellWrapper != null;
    r && (se(this.eCellWrapper), this.eCellWrapper = void 0), this.cellCssManager.toggleCss("ag-cell-value", !s);
    const n = !e && s, o = n && this.eCellValue == null;
    o && (this.eCellValue = K({ tag: "span", cls: "ag-cell-value", role: "presentation" }), this.eCellWrapper.appendChild(this.eCellValue));
    const a = !n && this.eCellValue != null;
    a && (se(this.eCellValue), this.eCellValue = void 0);
    const l = i || r || o || a;
    return l && this.removeControls(), !e && t && this.addControls(), l;
  }
  addControls() {
    const { cellCtrl: e, eCellWrapper: t, eCellValue: s, includeRowDrag: i, includeDndSource: r, includeSelection: n } = this, o = (a) => {
      a && t.insertBefore(a.getGui(), s);
    };
    i && this.rowDraggingComp == null && (this.rowDraggingComp = e.createRowDragComp(), o(this.rowDraggingComp)), r && this.dndSourceComp == null && (this.dndSourceComp = e.createDndSource(), o(this.dndSourceComp)), n && this.checkboxSelectionComp == null && (this.checkboxSelectionComp = e.createSelectionCheckbox(), o(this.checkboxSelectionComp));
  }
  createCellEditorInstance(e, t, s) {
    const i = this.editorVersion, r = e.newAgStackInstance(), { params: n } = e;
    r.then((a) => this.afterCellEditorCreated(i, a, n, t, s)), ee(this.cellEditor) && n.cellStartedEdit && this.cellCtrl.focusCell(!0);
  }
  insertValueWithoutCellRenderer(e) {
    const t = this.getParentOfValue();
    X(t);
    const s = Nt(e);
    s != null && (t.textContent = s);
  }
  destroyRenderer() {
    const { context: e } = this.beans;
    this.cellRenderer = e.destroyBean(this.cellRenderer), se(this.cellRendererGui), this.cellRendererGui = null, this.rendererVersion++;
  }
  destroyEditor() {
    var s, i;
    const { context: e } = this.beans;
    (((s = this.cellEditorPopupWrapper) == null ? void 0 : s.getGui().contains(Q(this.beans))) || this.cellCtrl.hasBrowserFocus()) && this.eCell.focus({ preventScroll: !0 }), (i = this.hideEditorPopup) == null || i.call(this), this.hideEditorPopup = void 0, this.cellEditor = e.destroyBean(this.cellEditor), this.cellEditorPopupWrapper = e.destroyBean(this.cellEditorPopupWrapper), se(this.cellEditorGui), this.cellCtrl.disableEditorTooltipFeature(), this.cellEditorGui = null, this.editorVersion++;
  }
  refreshCellRenderer(e) {
    var s;
    if (((s = this.cellRenderer) == null ? void 0 : s.refresh) == null || this.cellRendererClass !== e.componentClass)
      return !1;
    const t = this.cellRenderer.refresh(e.params);
    return t === !0 || t === void 0;
  }
  createCellRendererInstance(e) {
    var n;
    const t = this.rendererVersion, s = (o) => (a) => {
      if (this.rendererVersion !== t || !this.isAlive())
        return;
      const c = o.newAgStackInstance(), d = this.afterCellRendererCreated.bind(
        this,
        t,
        o.componentClass
      );
      c == null || c.then(d);
    }, { animationFrameSvc: i } = this.beans;
    let r;
    if (i != null && i.active && this.firstRender ? r = (o, a = !1) => {
      i.createTask(
        s(o),
        this.rowNode.rowIndex,
        "p2",
        o.componentFromFramework,
        a
      );
    } : r = (o) => s(o)(), (n = e.params) != null && n.deferRender && !this.cellCtrl.rowNode.group) {
      const { loadingComp: o, onReady: a } = this.cellCtrl.getDeferLoadingCellRenderer();
      o && (r(o), a.then(() => r(e, !0)));
    } else
      r(e);
  }
  afterCellRendererCreated(e, t, s) {
    if (!this.isAlive() || e !== this.rendererVersion) {
      this.beans.context.destroyBean(s);
      return;
    }
    this.cellRenderer = s, this.cellRendererClass = t;
    const r = s.getGui();
    if (this.cellRendererGui = r, r != null) {
      const n = this.getParentOfValue();
      X(n), n.appendChild(r);
    }
  }
  afterCellEditorCreated(e, t, s, i, r) {
    var c;
    const n = e !== this.editorVersion, { context: o } = this.beans;
    if (n) {
      o.destroyBean(t);
      return;
    }
    if (t.isCancelBeforeStart && t.isCancelBeforeStart()) {
      o.destroyBean(t), this.cellCtrl.stopEditing(!0);
      return;
    }
    if (!t.getGui) {
      F(97, { colId: this.column.getId() }), o.destroyBean(t);
      return;
    }
    this.cellEditor = t, this.cellEditorGui = t.getGui();
    const l = i || t.isPopup !== void 0 && t.isPopup();
    l ? this.addPopupCellEditor(s, r) : this.addInCellEditor(), this.refreshEditStyles(!0, l), (c = t.afterGuiAttached) == null || c.call(t), this.cellCtrl.enableEditorTooltipFeature(t), this.cellCtrl.cellEditorAttached();
  }
  refreshEditStyles(e, t) {
    const { cellCssManager: s } = this;
    s.toggleCss("ag-cell-inline-editing", e && !t), s.toggleCss("ag-cell-popup-editing", e && !!t), s.toggleCss("ag-cell-not-inline-editing", !e || !!t);
  }
  addInCellEditor() {
    const { eCell: e } = this;
    e.contains(Q(this.beans)) && e.focus(), this.destroyRenderer(), this.refreshWrapper(!0), X(this.getParentOfValue()), this.cellEditorGui && this.getParentOfValue().appendChild(this.cellEditorGui);
  }
  addPopupCellEditor(e, t) {
    var b;
    const { gos: s, context: i, popupSvc: r, editSvc: n } = this.beans;
    s.get("editType") === "fullRow" && F(98);
    const o = this.cellEditorPopupWrapper = i.createBean(
      n.createPopupEditorWrapper(e)
    ), { cellEditor: a, cellEditorGui: l, eCell: c, rowNode: d, column: h, cellCtrl: u } = this, g = o.getGui();
    l && g.appendChild(l);
    const p = s.get("stopEditingWhenCellsLoseFocus"), f = t ?? ((b = a.getPopupPosition) == null ? void 0 : b.call(a)) ?? "over", m = s.get("enableRtl"), C = {
      ePopup: g,
      column: h,
      rowNode: d,
      type: "popupCellEditor",
      eventSource: c,
      position: f,
      alignSide: m ? "right" : "left",
      keepWithinBounds: !0
    }, v = r.positionPopupByComponent.bind(r, C), w = r.addPopup({
      modal: p,
      eChild: g,
      closeOnEsc: !0,
      closedCallback: () => {
        u.onPopupEditorClosed();
      },
      anchorToElement: c,
      positionCallback: v,
      ariaOwns: c
    });
    w && (this.hideEditorPopup = w.hideFunc);
  }
  detach() {
    this.eRow.removeChild(this.getGui());
  }
  // if the row is also getting destroyed, then we don't need to remove from dom,
  // as the row will also get removed, so no need to take out the cells from the row
  // if the row is going (removing is an expensive operation, so only need to remove
  // the top part)
  //
  // note - this is NOT called by context, as we don't wire / unwire the CellComp for performance reasons.
  destroy() {
    this.destroyRenderer(), this.destroyEditor(), this.removeControls(), super.destroy();
  }
}, Qx = class extends D {
  constructor(e, t, s) {
    super(), this.cellComps = /* @__PURE__ */ new Map(), this.beans = t, this.rowCtrl = e;
    const i = K({ tag: "div", role: "row", attrs: { "comp-id": `${this.getCompId()}` } });
    this.setInitialStyle(i, s), this.setTemplateFromElement(i);
    const r = i.style;
    this.domOrder = this.rowCtrl.getDomOrder();
    const n = {
      setDomOrder: (o) => this.domOrder = o,
      setCellCtrls: (o) => this.setCellCtrls(o),
      showFullWidth: (o) => this.showFullWidth(o),
      getFullWidthCellRenderer: () => this.fullWidthCellRenderer,
      getFullWidthCellRendererParams: () => this.fullWidthCellRendererParams,
      toggleCss: (o, a) => this.toggleCss(o, a),
      setUserStyles: (o) => fn(i, o),
      setTop: (o) => r.top = o,
      setTransform: (o) => r.transform = o,
      setRowIndex: (o) => i.setAttribute("row-index", o),
      setRowId: (o) => i.setAttribute("row-id", o),
      setRowBusinessKey: (o) => i.setAttribute("row-business-key", o),
      refreshFullWidth: (o) => {
        var l, c;
        const a = o();
        return this.fullWidthCellRendererParams = a, ((c = (l = this.fullWidthCellRenderer) == null ? void 0 : l.refresh) == null ? void 0 : c.call(l, a)) ?? !1;
      }
    };
    e.setComp(n, this.getGui(), s, void 0), this.addDestroyFunc(() => {
      e.unsetComp(s);
    });
  }
  setInitialStyle(e, t) {
    const s = this.rowCtrl.getInitialTransform(t);
    if (s)
      e.style.setProperty("transform", s);
    else {
      const i = this.rowCtrl.getInitialRowTop(t);
      i && e.style.setProperty("top", i);
    }
  }
  showFullWidth(e) {
    const t = (i) => {
      if (this.isAlive()) {
        const r = i.getGui();
        this.getGui().appendChild(r), this.rowCtrl.setupDetailRowAutoHeight(r), this.setFullWidthRowComp(i, e.params);
      } else
        this.beans.context.destroyBean(i);
    };
    e.newAgStackInstance().then(t);
  }
  setCellCtrls(e) {
    const t = new Map(this.cellComps);
    for (const s of e) {
      const i = s.instanceId;
      this.cellComps.has(i) ? t.delete(i) : this.newCellComp(s);
    }
    this.destroyCells(t), this.ensureDomOrder(e);
  }
  ensureDomOrder(e) {
    if (!this.domOrder)
      return;
    const t = [];
    for (const s of e) {
      const i = this.cellComps.get(s.instanceId);
      i && t.push(i.getGui());
    }
    Bg(this.getGui(), t);
  }
  newCellComp(e) {
    var i;
    const t = ((i = this.beans.editSvc) == null ? void 0 : i.isEditing(e, { withOpenEditor: !0 })) ?? !1, s = new Zx(this.beans, e, this.rowCtrl.printLayout, this.getGui(), t);
    this.cellComps.set(e.instanceId, s), this.getGui().appendChild(s.getGui());
  }
  destroy() {
    super.destroy(), this.destroyCells(this.cellComps);
  }
  setFullWidthRowComp(e, t) {
    this.fullWidthCellRenderer = e, this.fullWidthCellRendererParams = t, this.addDestroyFunc(() => {
      this.fullWidthCellRenderer = this.beans.context.destroyBean(this.fullWidthCellRenderer), this.fullWidthCellRendererParams = void 0;
    });
  }
  destroyCells(e) {
    for (const t of e.values()) {
      if (!t)
        return;
      const s = t.cellCtrl.instanceId;
      if (this.cellComps.get(s) !== t)
        return;
      t.detach(), t.destroy(), this.cellComps.delete(s);
    }
  }
};
function Jx(e, t, s) {
  const i = !!s.gos.get("enableCellSpan") && !!t.getSpannedRowCtrls, r = {
    tag: "div",
    ref: "eContainer",
    cls: no(e),
    role: "rowgroup"
  };
  if (t.type === "center" || i) {
    const n = {
      tag: "div",
      ref: "eSpannedContainer",
      cls: `ag-spanning-container ${DS(e)}`,
      role: "presentation"
    };
    return r.role = "presentation", {
      tag: "div",
      ref: "eViewport",
      cls: `ag-viewport ${df(e)}`,
      role: "rowgroup",
      children: [r, i ? n : null]
    };
  }
  return r;
}
var eF = class extends D {
  constructor(e) {
    super(), this.eViewport = x, this.eContainer = x, this.eSpannedContainer = x, this.rowCompsNoSpan = {}, this.rowCompsWithSpan = {}, this.name = e == null ? void 0 : e.name, this.options = yn(this.name);
  }
  postConstruct() {
    this.setTemplate(Jx(this.name, this.options, this.beans));
    const e = {
      setHorizontalScroll: (s) => this.eViewport.scrollLeft = s,
      setViewportHeight: (s) => this.eViewport.style.height = s,
      setRowCtrls: ({ rowCtrls: s }) => this.setRowCtrls(s),
      setSpannedRowCtrls: (s) => this.setRowCtrls(s, !0),
      setDomOrder: (s) => {
        this.domOrder = s;
      },
      setContainerWidth: (s) => {
        this.eContainer.style.width = s, this.eSpannedContainer && (this.eSpannedContainer.style.width = s);
      },
      setOffsetTop: (s) => {
        const i = `translateY(${s})`;
        this.eContainer.style.transform = i, this.eSpannedContainer && (this.eSpannedContainer.style.transform = i);
      }
    };
    this.createManagedBean(new HS(this.name)).setComp(e, this.eContainer, this.eSpannedContainer, this.eViewport);
  }
  destroy() {
    this.setRowCtrls([]), this.setRowCtrls([], !0), super.destroy(), this.lastPlacedElement = null;
  }
  setRowCtrls(e, t) {
    const { beans: s, options: i } = this, r = t ? this.eSpannedContainer : this.eContainer, n = t ? { ...this.rowCompsWithSpan } : { ...this.rowCompsNoSpan }, o = {};
    t ? this.rowCompsWithSpan = o : this.rowCompsNoSpan = o, this.lastPlacedElement = null;
    const a = [];
    for (const l of e) {
      const c = l.instanceId, d = n[c];
      let h;
      if (d)
        h = d, delete n[c];
      else {
        if (!l.rowNode.displayed)
          continue;
        h = new Qx(l, s, i.type);
      }
      o[c] = h, a.push([h, !d]);
    }
    this.removeOldRows(Object.values(n), r), this.addRowNodes(a, r);
  }
  addRowNodes(e, t) {
    const { domOrder: s } = this;
    for (const [i, r] of e) {
      const n = i.getGui();
      s ? this.ensureDomOrder(n, t) : r && t.appendChild(n);
    }
  }
  removeOldRows(e, t) {
    for (const s of e)
      t.removeChild(s.getGui()), s.destroy();
  }
  ensureDomOrder(e, t) {
    Vg(t, e, this.lastPlacedElement), this.lastPlacedElement = e;
  }
}, tF = {
  selector: "AG-ROW-CONTAINER",
  component: eF
};
function Er(e, t) {
  return t.map((s) => {
    const i = `e${s[0].toUpperCase() + s.substring(1)}RowContainer`;
    return e[i] = { name: s }, {
      tag: "ag-row-container",
      ref: i,
      attrs: { name: s }
    };
  });
}
function sF(e) {
  const t = {}, s = {
    tag: "div",
    ref: "eGridRoot",
    cls: "ag-root ag-unselectable",
    children: [
      { tag: "ag-header-root" },
      {
        tag: "div",
        ref: "eTop",
        cls: "ag-floating-top",
        role: "presentation",
        children: Er(t, ["topLeft", "topCenter", "topRight", "topFullWidth"])
      },
      {
        tag: "div",
        ref: "eBody",
        cls: "ag-body",
        role: "presentation",
        children: [
          {
            tag: "div",
            ref: "eBodyViewport",
            cls: "ag-body-viewport",
            role: "presentation",
            children: Er(t, ["left", "center", "right", "fullWidth"])
          },
          { tag: "ag-fake-vertical-scroll" }
        ]
      },
      {
        tag: "div",
        ref: "eStickyTop",
        cls: "ag-sticky-top",
        role: "presentation",
        children: Er(t, [
          "stickyTopLeft",
          "stickyTopCenter",
          "stickyTopRight",
          "stickyTopFullWidth"
        ])
      },
      {
        tag: "div",
        ref: "eStickyBottom",
        cls: "ag-sticky-bottom",
        role: "presentation",
        children: Er(t, [
          "stickyBottomLeft",
          "stickyBottomCenter",
          "stickyBottomRight",
          "stickyBottomFullWidth"
        ])
      },
      {
        tag: "div",
        ref: "eBottom",
        cls: "ag-floating-bottom",
        role: "presentation",
        children: Er(t, [
          "bottomLeft",
          "bottomCenter",
          "bottomRight",
          "bottomFullWidth"
        ])
      },
      { tag: "ag-fake-horizontal-scroll" },
      e ? { tag: "ag-overlay-wrapper" } : null
    ]
  };
  return { paramsMap: t, elementParams: s };
}
var iF = class extends D {
  constructor() {
    super(...arguments), this.eGridRoot = x, this.eBodyViewport = x, this.eStickyTop = x, this.eStickyBottom = x, this.eTop = x, this.eBottom = x, this.eBody = x;
  }
  postConstruct() {
    const { overlays: e, rangeSvc: t } = this.beans, s = e == null ? void 0 : e.getOverlayWrapperSelector(), { paramsMap: i, elementParams: r } = sF(!!s);
    this.setTemplate(
      r,
      [
        ...s ? [s] : [],
        KS,
        qS,
        Xx,
        tF
      ],
      i
    );
    const n = (a, l) => {
      const c = `${a}px`;
      l.style.minHeight = c, l.style.height = c;
    }, o = {
      setRowAnimationCssOnBodyViewport: (a, l) => this.setRowAnimationCssOnBodyViewport(a, l),
      setColumnCount: (a) => fw(this.getGui(), a),
      setRowCount: (a) => gw(this.getGui(), a),
      setTopHeight: (a) => n(a, this.eTop),
      setBottomHeight: (a) => n(a, this.eBottom),
      setTopInvisible: (a) => this.eTop.classList.toggle("ag-invisible", a),
      setBottomInvisible: (a) => this.eBottom.classList.toggle("ag-invisible", a),
      setStickyTopHeight: (a) => this.eStickyTop.style.height = a,
      setStickyTopTop: (a) => this.eStickyTop.style.top = a,
      setStickyTopWidth: (a) => this.eStickyTop.style.width = a,
      setStickyBottomHeight: (a) => {
        this.eStickyBottom.style.height = a, this.eStickyBottom.classList.toggle("ag-invisible", a === "0px");
      },
      setStickyBottomBottom: (a) => this.eStickyBottom.style.bottom = a,
      setStickyBottomWidth: (a) => this.eStickyBottom.style.width = a,
      setColumnMovingCss: (a, l) => this.toggleCss(a, l),
      updateLayoutClasses: (a, l) => {
        const c = [this.eBodyViewport.classList, this.eBody.classList];
        for (const d of c)
          d.toggle(kt.AUTO_HEIGHT, l.autoHeight), d.toggle(kt.NORMAL, l.normal), d.toggle(kt.PRINT, l.print);
        this.toggleCss(kt.AUTO_HEIGHT, l.autoHeight), this.toggleCss(kt.NORMAL, l.normal), this.toggleCss(kt.PRINT, l.print);
      },
      setAlwaysVerticalScrollClass: (a, l) => this.eBodyViewport.classList.toggle(gf, l),
      registerBodyViewportResizeListener: (a) => {
        const l = os(this.beans, this.eBodyViewport, a);
        this.addDestroyFunc(() => l());
      },
      setPinnedTopBottomOverflowY: (a) => this.eTop.style.overflowY = this.eBottom.style.overflowY = a,
      setCellSelectableCss: (a, l) => {
        [this.eTop, this.eBodyViewport, this.eBottom].forEach(
          (c) => c.classList.toggle(a, l)
        );
      },
      setBodyViewportWidth: (a) => this.eBodyViewport.style.width = a,
      setGridRootRole: (a) => Ye(this.eGridRoot, a)
    };
    this.ctrl = this.createManagedBean(new _S()), this.ctrl.setComp(
      o,
      this.getGui(),
      this.eBodyViewport,
      this.eTop,
      this.eBottom,
      this.eStickyTop,
      this.eStickyBottom
    ), (t && et(this.gos) || Ps(this.gos)) && uw(this.getGui(), !0);
  }
  setRowAnimationCssOnBodyViewport(e, t) {
    const s = this.eBodyViewport.classList;
    s.toggle("ag-row-animation", t), s.toggle("ag-row-no-animation", !t);
  }
}, rF = {
  selector: "AG-GRID-BODY",
  component: iF
}, nF = class extends R {
  constructor() {
    super(...arguments), this.additionalFocusableContainers = /* @__PURE__ */ new Set();
  }
  setComp(e, t, s) {
    this.view = e, this.eGridHostDiv = t, this.eGui = s, this.eGui.setAttribute("grid-id", this.beans.context.getId());
    const { dragAndDrop: i, ctrlsSvc: r } = this.beans;
    i == null || i.registerGridDropTarget(() => this.eGui, this), this.createManagedBean(new ud(this.view)), this.view.setRtlClass(this.gos.get("enableRtl") ? "ag-rtl" : "ag-ltr");
    const n = os(this.beans, this.eGridHostDiv, this.onGridSizeChanged.bind(this));
    this.addDestroyFunc(() => n()), r.register("gridCtrl", this);
  }
  isDetailGrid() {
    var t;
    const e = sd(this.getGui());
    return ((t = e == null ? void 0 : e.getAttribute("row-id")) == null ? void 0 : t.startsWith("detail")) || !1;
  }
  getOptionalSelectors() {
    var t, s, i, r, n;
    const e = this.beans;
    return {
      paginationSelector: (t = e.pagination) == null ? void 0 : t.getPaginationSelector(),
      gridHeaderDropZonesSelector: (s = e.registry) == null ? void 0 : s.getSelector("AG-GRID-HEADER-DROP-ZONES"),
      sideBarSelector: (i = e.sideBar) == null ? void 0 : i.getSelector(),
      statusBarSelector: (r = e.registry) == null ? void 0 : r.getSelector("AG-STATUS-BAR"),
      watermarkSelector: (n = e.licenseManager) == null ? void 0 : n.getWatermarkSelector()
    };
  }
  onGridSizeChanged() {
    this.eventSvc.dispatchEvent({
      type: "gridSizeChanged",
      clientWidth: this.eGridHostDiv.clientWidth,
      clientHeight: this.eGridHostDiv.clientHeight
    });
  }
  destroyGridUi() {
    this.view.destroyGridUi();
  }
  getGui() {
    return this.eGui;
  }
  setResizeCursor(e) {
    const { view: t } = this;
    if (e === !1)
      t.setCursor(null);
    else {
      const s = e === 1 ? "ew-resize" : "ns-resize";
      t.setCursor(s);
    }
  }
  disableUserSelect(e) {
    this.view.setUserSelect(e ? "none" : null);
  }
  focusNextInnerContainer(e) {
    const t = this.getFocusableContainers(), { indexWithFocus: s, nextIndex: i } = this.getNextFocusableIndex(t, e);
    if (i < 0 || i >= t.length)
      return !1;
    if (i === 0) {
      if (s > 0) {
        const { visibleCols: r, focusSvc: n } = this.beans, o = r.allCols, a = _(o);
        if (n.focusGridView({ column: a, backwards: !0 }))
          return !0;
      }
      return !1;
    }
    return this.focusContainer(t[i], e);
  }
  focusInnerElement(e) {
    const t = this.gos.getCallback("focusGridInnerElement");
    if (t && t({ fromBottom: !!e }))
      return !0;
    const s = this.getFocusableContainers(), { focusSvc: i, visibleCols: r } = this.beans, n = r.allCols;
    if (e) {
      if (s.length > 1)
        return this.focusContainer(_(s), e);
      const o = _(n);
      if (i.focusGridView({ column: o, backwards: e }))
        return !0;
    }
    if (this.gos.get("headerHeight") === 0 || wi(this.beans)) {
      if (i.focusGridView({ column: n[0], backwards: e }))
        return !0;
      for (let o = 1; o < s.length; o++)
        if (ye(s[o].getGui(), e))
          return !0;
      return !1;
    }
    return i.focusFirstHeader();
  }
  forceFocusOutOfContainer(e = !1) {
    this.view.forceFocusOutOfContainer(e);
  }
  addFocusableContainer(e) {
    this.additionalFocusableContainers.add(e);
  }
  removeFocusableContainer(e) {
    this.additionalFocusableContainers.delete(e);
  }
  allowFocusForNextCoreContainer(e) {
    var n;
    const t = this.view.getFocusableContainers(), { nextIndex: s, indexWithFocus: i } = this.getNextFocusableIndex(t, e);
    if (i === -1 || s < 0 || s >= t.length)
      return;
    const r = t[s];
    (n = r.setAllowFocus) == null || n.call(r, !0), setTimeout(() => {
      var o;
      (o = r.setAllowFocus) == null || o.call(r, !1);
    });
  }
  isFocusable() {
    var t, s;
    const e = this.beans;
    return !ya(e) || !wi(e) || !!((s = (t = e.sideBar) == null ? void 0 : t.comp) != null && s.isDisplayed());
  }
  getNextFocusableIndex(e, t) {
    const s = Q(this.beans), i = e.findIndex((n) => n.getGui().contains(s)), r = i + (t ? -1 : 1);
    return {
      indexWithFocus: i,
      nextIndex: r
    };
  }
  focusContainer(e, t) {
    var i, r;
    (i = e.setAllowFocus) == null || i.call(e, !0);
    const s = ye(e.getGui(), t, !1, !0);
    return (r = e.setAllowFocus) == null || r.call(e, !1), s;
  }
  getFocusableContainers() {
    return [...this.view.getFocusableContainers(), ...this.additionalFocusableContainers];
  }
  destroy() {
    this.additionalFocusableContainers.clear(), super.destroy();
  }
}, oF = class extends ls {
  constructor(e) {
    super(), this.gridBody = x, this.sideBar = x, this.pagination = x, this.rootWrapperBody = x, this.eGridDiv = e;
  }
  postConstruct() {
    const e = {
      destroyGridUi: () => this.destroyBean(this),
      setRtlClass: (n) => this.addCss(n),
      forceFocusOutOfContainer: this.forceFocusOutOfContainer.bind(this),
      updateLayoutClasses: this.updateLayoutClasses.bind(this),
      getFocusableContainers: this.getFocusableContainers.bind(this),
      setUserSelect: (n) => {
        this.getGui().style.userSelect = n ?? "", this.getGui().style.webkitUserSelect = n ?? "";
      },
      setCursor: (n) => {
        this.getGui().style.cursor = n ?? "";
      }
    }, t = this.createManagedBean(new nF()), s = t.getOptionalSelectors(), i = this.createTemplate(s), r = [rF, ...Object.values(s).filter((n) => !!n)];
    this.setTemplate(i, r), t.setComp(e, this.eGridDiv, this.getGui()), this.insertGridIntoDom(), this.initialiseTabGuard({
      // we want to override the default behaviour to do nothing for onTabKeyDown
      onTabKeyDown: () => {
      },
      focusInnerElement: (n) => t.focusInnerElement(n),
      forceFocusOutWhenTabGuardsAreEmpty: !0,
      isEmpty: () => !t.isFocusable()
    });
  }
  insertGridIntoDom() {
    const e = this.getGui();
    this.eGridDiv.appendChild(e), this.addDestroyFunc(() => {
      this.eGridDiv.removeChild(e), ei(this.gos, "Grid removed from DOM");
    });
  }
  updateLayoutClasses(e, t) {
    const s = this.rootWrapperBody.classList, { AUTO_HEIGHT: i, NORMAL: r, PRINT: n } = kt, { autoHeight: o, normal: a, print: l } = t;
    s.toggle(i, o), s.toggle(r, a), s.toggle(n, l), this.toggleCss(i, o), this.toggleCss(r, a), this.toggleCss(n, l);
  }
  createTemplate(e) {
    const t = e.gridHeaderDropZonesSelector ? { tag: "ag-grid-header-drop-zones" } : null, s = e.sideBarSelector ? {
      tag: "ag-side-bar",
      ref: "sideBar"
    } : null, i = e.statusBarSelector ? { tag: "ag-status-bar" } : null, r = e.watermarkSelector ? { tag: "ag-watermark" } : null, n = e.paginationSelector ? { tag: "ag-pagination", ref: "pagination" } : null;
    return {
      tag: "div",
      cls: "ag-root-wrapper",
      role: "presentation",
      children: [
        t,
        {
          tag: "div",
          ref: "rootWrapperBody",
          cls: "ag-root-wrapper-body",
          role: "presentation",
          children: [{ tag: "ag-grid-body", ref: "gridBody" }, s]
        },
        i,
        n,
        r
      ]
    };
  }
  getFocusableElement() {
    return this.rootWrapperBody;
  }
  forceFocusOutOfContainer(e = !1) {
    var t;
    if (!e && ((t = this.pagination) != null && t.isDisplayed())) {
      this.pagination.forceFocusOutOfContainer(e);
      return;
    }
    super.forceFocusOutOfContainer(e);
  }
  getFocusableContainers() {
    const e = [this.gridBody];
    return [this.sideBar, this.pagination].forEach((t) => {
      t && e.push(t);
    }), e.filter((t) => Ze(t.getGui()));
  }
}, q = (e, t) => {
  for (const s of Object.keys(t))
    t[s] = e;
  return t;
}, Wh = {
  dispatchEvent: "CommunityCore",
  // this is always registered
  ...q("CommunityCore", {
    destroy: 0,
    getGridId: 0,
    getGridOption: 0,
    isDestroyed: 0,
    setGridOption: 0,
    updateGridOptions: 0,
    isModuleRegistered: 0
  }),
  ...q("GridState", {
    getState: 0,
    setState: 0
  }),
  ...q("SharedRowSelection", {
    setNodesSelected: 0,
    selectAll: 0,
    deselectAll: 0,
    selectAllFiltered: 0,
    deselectAllFiltered: 0,
    selectAllOnCurrentPage: 0,
    deselectAllOnCurrentPage: 0,
    getSelectedNodes: 0,
    getSelectedRows: 0
  }),
  ...q("RowApi", {
    redrawRows: 0,
    setRowNodeExpanded: 0,
    getRowNode: 0,
    addRenderedRowListener: 0,
    getRenderedNodes: 0,
    forEachNode: 0,
    getFirstDisplayedRowIndex: 0,
    getLastDisplayedRowIndex: 0,
    getDisplayedRowAtIndex: 0,
    getDisplayedRowCount: 0
  }),
  ...q("ScrollApi", {
    getVerticalPixelRange: 0,
    getHorizontalPixelRange: 0,
    ensureColumnVisible: 0,
    ensureIndexVisible: 0,
    ensureNodeVisible: 0
  }),
  ...q("KeyboardNavigation", {
    getFocusedCell: 0,
    clearFocusedCell: 0,
    setFocusedCell: 0,
    tabToNextCell: 0,
    tabToPreviousCell: 0,
    setFocusedHeader: 0
  }),
  ...q("EventApi", {
    addEventListener: 0,
    addGlobalListener: 0,
    removeEventListener: 0,
    removeGlobalListener: 0
  }),
  ...q("ValueCache", {
    expireValueCache: 0
  }),
  ...q("CellApi", {
    getCellValue: 0
  }),
  ...q("SharedMenu", {
    showColumnMenu: 0,
    hidePopupMenu: 0
  }),
  ...q("Sort", {
    onSortChanged: 0
  }),
  ...q("PinnedRow", {
    getPinnedTopRowCount: 0,
    getPinnedBottomRowCount: 0,
    getPinnedTopRow: 0,
    getPinnedBottomRow: 0,
    forEachPinnedRow: 0
  }),
  ...q("Overlay", {
    showLoadingOverlay: 0,
    showNoRowsOverlay: 0,
    hideOverlay: 0
  }),
  ...q("RenderApi", {
    setGridAriaProperty: 0,
    refreshCells: 0,
    refreshHeader: 0,
    isAnimationFrameQueueEmpty: 0,
    flushAllAnimationFrames: 0,
    getSizesForCurrentTheme: 0,
    getCellRendererInstances: 0
  }),
  ...q("HighlightChanges", {
    flashCells: 0
  }),
  ...q("RowDrag", {
    addRowDropZone: 0,
    removeRowDropZone: 0,
    getRowDropZoneParams: 0,
    getRowDropPositionIndicator: 0,
    setRowDropPositionIndicator: 0
  }),
  ...q("ColumnApi", {
    getColumnDefs: 0,
    getColumnDef: 0,
    getDisplayNameForColumn: 0,
    getColumn: 0,
    getColumns: 0,
    applyColumnState: 0,
    getColumnState: 0,
    resetColumnState: 0,
    isPinning: 0,
    isPinningLeft: 0,
    isPinningRight: 0,
    getDisplayedColAfter: 0,
    getDisplayedColBefore: 0,
    setColumnsVisible: 0,
    setColumnsPinned: 0,
    getAllGridColumns: 0,
    getDisplayedLeftColumns: 0,
    getDisplayedCenterColumns: 0,
    getDisplayedRightColumns: 0,
    getAllDisplayedColumns: 0,
    getAllDisplayedVirtualColumns: 0
  }),
  ...q("ColumnAutoSize", {
    sizeColumnsToFit: 0,
    autoSizeColumns: 0,
    autoSizeAllColumns: 0
  }),
  ...q("ColumnGroup", {
    setColumnGroupOpened: 0,
    getColumnGroup: 0,
    getProvidedColumnGroup: 0,
    getDisplayNameForColumnGroup: 0,
    getColumnGroupState: 0,
    setColumnGroupState: 0,
    resetColumnGroupState: 0,
    getLeftDisplayedColumnGroups: 0,
    getCenterDisplayedColumnGroups: 0,
    getRightDisplayedColumnGroups: 0,
    getAllDisplayedColumnGroups: 0
  }),
  ...q("ColumnMove", {
    moveColumnByIndex: 0,
    moveColumns: 0
  }),
  ...q("ColumnResize", {
    setColumnWidths: 0
  }),
  ...q("ColumnHover", {
    isColumnHovered: 0
  }),
  ...q("EditCore", {
    getCellEditorInstances: 0,
    getEditingCells: 0,
    getEditRowValues: 0,
    stopEditing: 0,
    startEditingCell: 0,
    isEditing: 0,
    validateEdit: 0
  }),
  ...q("BatchEdit", {
    startBatchEdit: 0,
    cancelBatchEdit: 0,
    commitBatchEdit: 0,
    isBatchEditing: 0
  }),
  ...q("UndoRedoEdit", {
    undoCellEditing: 0,
    redoCellEditing: 0,
    getCurrentUndoSize: 0,
    getCurrentRedoSize: 0
  }),
  ...q("FilterCore", {
    isAnyFilterPresent: 0,
    onFilterChanged: 0
  }),
  ...q("ColumnFilter", {
    isColumnFilterPresent: 0,
    getColumnFilterInstance: 0,
    destroyFilter: 0,
    setFilterModel: 0,
    getFilterModel: 0,
    getColumnFilterModel: 0,
    setColumnFilterModel: 0,
    showColumnFilter: 0,
    hideColumnFilter: 0,
    getColumnFilterHandler: 0,
    doFilterAction: 0
  }),
  ...q("QuickFilter", {
    isQuickFilterPresent: 0,
    getQuickFilter: 0,
    resetQuickFilter: 0
  }),
  ...q("Find", {
    findGetActiveMatch: 0,
    findGetTotalMatches: 0,
    findGoTo: 0,
    findNext: 0,
    findPrevious: 0,
    findGetNumMatches: 0,
    findGetParts: 0,
    findClearActive: 0,
    findRefresh: 0
  }),
  ...q("Pagination", {
    paginationIsLastPageFound: 0,
    paginationGetPageSize: 0,
    paginationGetCurrentPage: 0,
    paginationGetTotalPages: 0,
    paginationGetRowCount: 0,
    paginationGoToNextPage: 0,
    paginationGoToPreviousPage: 0,
    paginationGoToFirstPage: 0,
    paginationGoToLastPage: 0,
    paginationGoToPage: 0
  }),
  ...q("CsrmSsrmSharedApi", {
    expandAll: 0,
    collapseAll: 0
  }),
  ...q("SsrmInfiniteSharedApi", {
    setRowCount: 0,
    getCacheBlockState: 0,
    isLastRowIndexKnown: 0
  }),
  ...q("ClientSideRowModelApi", {
    onGroupExpandedOrCollapsed: 0,
    refreshClientSideRowModel: 0,
    isRowDataEmpty: 0,
    forEachLeafNode: 0,
    forEachNodeAfterFilter: 0,
    forEachNodeAfterFilterAndSort: 0,
    applyTransaction: 0,
    applyTransactionAsync: 0,
    flushAsyncTransactions: 0,
    getBestCostNodeSelection: 0,
    onRowHeightChanged: 0,
    resetRowHeights: 0
  }),
  ...q("CsvExport", {
    getDataAsCsv: 0,
    exportDataAsCsv: 0
  }),
  ...q("InfiniteRowModel", {
    refreshInfiniteCache: 0,
    purgeInfiniteCache: 0,
    getInfiniteRowCount: 0
  }),
  ...q("AdvancedFilter", {
    getAdvancedFilterModel: 0,
    setAdvancedFilterModel: 0,
    showAdvancedFilterBuilder: 0,
    hideAdvancedFilterBuilder: 0
  }),
  ...q("IntegratedCharts", {
    getChartModels: 0,
    getChartRef: 0,
    getChartImageDataURL: 0,
    downloadChart: 0,
    openChartToolPanel: 0,
    closeChartToolPanel: 0,
    createRangeChart: 0,
    createPivotChart: 0,
    createCrossFilterChart: 0,
    updateChart: 0,
    restoreChart: 0
  }),
  ...q("Clipboard", {
    copyToClipboard: 0,
    cutToClipboard: 0,
    copySelectedRowsToClipboard: 0,
    copySelectedRangeToClipboard: 0,
    copySelectedRangeDown: 0,
    pasteFromClipboard: 0
  }),
  ...q("ExcelExport", {
    getDataAsExcel: 0,
    exportDataAsExcel: 0,
    getSheetDataForExcel: 0,
    getMultipleSheetsAsExcel: 0,
    exportMultipleSheetsAsExcel: 0
  }),
  ...q("SharedMasterDetail", {
    addDetailGridInfo: 0,
    removeDetailGridInfo: 0,
    getDetailGridInfo: 0,
    forEachDetailGridInfo: 0
  }),
  ...q("ContextMenu", {
    showContextMenu: 0
  }),
  ...q("ColumnMenu", {
    showColumnChooser: 0,
    hideColumnChooser: 0
  }),
  ...q("CellSelection", {
    getCellRanges: 0,
    addCellRange: 0,
    clearRangeSelection: 0,
    clearCellSelection: 0
  }),
  ...q("SharedRowGrouping", {
    setRowGroupColumns: 0,
    removeRowGroupColumns: 0,
    addRowGroupColumns: 0,
    getRowGroupColumns: 0,
    moveRowGroupColumn: 0
  }),
  ...q("SharedAggregation", {
    addAggFuncs: 0,
    clearAggFuncs: 0,
    setColumnAggFunc: 0
  }),
  ...q("SharedPivot", {
    isPivotMode: 0,
    getPivotResultColumn: 0,
    setValueColumns: 0,
    getValueColumns: 0,
    removeValueColumns: 0,
    addValueColumns: 0,
    setPivotColumns: 0,
    removePivotColumns: 0,
    addPivotColumns: 0,
    getPivotColumns: 0,
    setPivotResultColumns: 0,
    getPivotResultColumns: 0
  }),
  ...q("ServerSideRowModelApi", {
    getServerSideSelectionState: 0,
    setServerSideSelectionState: 0,
    applyServerSideTransaction: 0,
    applyServerSideTransactionAsync: 0,
    applyServerSideRowData: 0,
    retryServerSideLoads: 0,
    flushServerSideAsyncTransactions: 0,
    refreshServerSide: 0,
    getServerSideGroupLevelState: 0,
    onRowHeightChanged: 0,
    resetRowHeights: 0
  }),
  ...q("SideBar", {
    isSideBarVisible: 0,
    setSideBarVisible: 0,
    setSideBarPosition: 0,
    openToolPanel: 0,
    closeToolPanel: 0,
    getOpenedToolPanel: 0,
    refreshToolPanel: 0,
    isToolPanelShowing: 0,
    getToolPanelInstance: 0,
    getSideBar: 0
  }),
  ...q("StatusBar", {
    getStatusPanel: 0
  })
}, al = {
  isDestroyed: () => !0,
  destroy() {
  },
  preConstruct() {
  },
  postConstruct() {
  },
  preWireBeans() {
  },
  wireBeans() {
  }
}, aF = (e, t) => e.eventSvc.dispatchEvent(t), Mf = class {
};
Reflect.defineProperty(Mf, "name", { value: "GridApi" });
var lF = class extends R {
  constructor() {
    super(), this.beanName = "apiFunctionSvc", this.api = new Mf(), this.fns = {
      ...al,
      // dispatchEvent is used by frameworks, also used by aligned grids to identify a grid api instance
      dispatchEvent: aF
    }, this.preDestroyLink = "";
    const { api: e } = this;
    for (const t of Object.keys(Wh))
      e[t] = this.makeApi(t)[t];
  }
  postConstruct() {
    this.preDestroyLink = this.beans.frameworkOverrides.getDocLink("grid-lifecycle/#grid-pre-destroyed");
  }
  addFunction(e, t) {
    var r;
    const { fns: s, beans: i } = this;
    s !== al && (s[e] = ((r = i == null ? void 0 : i.validation) == null ? void 0 : r.validateApiFunction(e, t)) ?? t);
  }
  makeApi(e) {
    return {
      [e]: (...t) => {
        const {
          beans: s,
          fns: { [e]: i }
        } = this;
        return i ? i(s, ...t) : this.apiNotFound(e);
      }
    };
  }
  apiNotFound(e) {
    const { beans: t, gos: s, preDestroyLink: i } = this;
    if (!t)
      F(26, { fnName: e, preDestroyLink: i });
    else {
      const r = Wh[e];
      s.assertModuleRegistered(r, `api.${e}`) && F(27, { fnName: e, module: r });
    }
  }
  destroy() {
    super.destroy(), this.fns = al, this.beans = null;
  }
};
function cF(e) {
  return e.context.getId();
}
function dF(e) {
  e.gridDestroySvc.destroy();
}
function hF(e) {
  return e.gridDestroySvc.destroyCalled;
}
function uF(e, t) {
  return e.gos.get(t);
}
function gF(e, t, s) {
  Df(e, { [t]: s });
}
function Df(e, t) {
  e.gos.updateGridOptions({ options: t });
}
function pF(e, t) {
  const s = t.replace(/Module$/, "");
  return e.gos.isModuleRegistered(s);
}
var fF = { tag: "div", cls: "ag-drag-handle ag-row-drag", attrs: { draggable: "true" } }, mF = class extends D {
  constructor(e, t, s) {
    super(fF), this.rowNode = e, this.column = t, this.eCell = s;
  }
  postConstruct() {
    this.getGui().appendChild(N("rowDrag", this.beans, null)), this.addGuiEventListener("mousedown", (t) => {
      t.stopPropagation();
    }), this.addDragSource(), this.checkVisibility();
  }
  addDragSource() {
    this.addGuiEventListener("dragstart", this.onDragStart.bind(this));
  }
  onDragStart(e) {
    const { rowNode: t, column: s, eCell: i, gos: r } = this, n = s.getColDef().dndSourceOnRowDrag, o = e.dataTransfer;
    if (o.setDragImage(i, 0, 0), n) {
      const a = V(r, {
        rowNode: t,
        dragEvent: e
      });
      n(a);
    } else
      try {
        const a = JSON.stringify(t.data);
        o.setData("application/json", a), o.setData("text/plain", a);
      } catch {
      }
  }
  checkVisibility() {
    const e = this.column.isDndSource(this.rowNode);
    this.setDisplayed(e);
  }
};
function CF(e, t) {
  var s, i;
  (i = (s = e.rowDragSvc) == null ? void 0 : s.rowDragFeature) == null || i.addRowDropZone(t);
}
function vF(e, t) {
  var i, r;
  const s = (i = e.dragAndDrop) == null ? void 0 : i.findExternalZone(t.getContainer());
  s && ((r = e.dragAndDrop) == null || r.removeDropTarget(s));
}
function wF(e, t) {
  var s, i;
  return (i = (s = e.rowDragSvc) == null ? void 0 : s.rowDragFeature) == null ? void 0 : i.getRowDropZone(t);
}
function bF(e) {
  const t = e.rowDropHighlightSvc;
  return t ? { row: t.row, dropIndicatorPosition: t.position } : { row: null, dropIndicatorPosition: "none" };
}
function yF(e, t) {
  const s = e.rowDropHighlightSvc;
  if (!s)
    return;
  const i = t == null ? void 0 : t.row;
  let r = t == null ? void 0 : t.dropIndicatorPosition;
  r !== "above" && r !== "below" && r !== "inside" && (r = "none");
  const n = i == null ? void 0 : i.rowIndex;
  n == null || r === "none" ? s.clear() : s.set(i, r);
}
var SF = class extends rS {
  shouldPreventMouseEvent(e) {
    return this.gos.get("enableCellTextSelection") && super.shouldPreventMouseEvent(e);
  }
}, xF = class extends R {
  constructor() {
    super(...arguments), this.beanName = "horizontalResizeSvc";
  }
  addResizeBar(e) {
    const t = {
      dragStartPixels: e.dragStartPixels || 0,
      eElement: e.eResizeBar,
      onDragStart: this.onDragStart.bind(this, e),
      onDragStop: this.onDragStop.bind(this, e),
      onDragging: this.onDragging.bind(this, e),
      onDragCancel: this.onDragStop.bind(this, e),
      includeTouch: !0,
      stopPropagationForTouch: !0
    }, { dragSvc: s } = this.beans;
    return s.addDragSource(t), () => s.removeDragSource(t);
  }
  onDragStart(e, t) {
    this.dragStartX = t.clientX, this.setResizeIcons();
    const s = t instanceof MouseEvent && t.shiftKey === !0;
    e.onResizeStart(s);
  }
  setResizeIcons() {
    const e = this.beans.ctrlsSvc.get("gridCtrl");
    e.setResizeCursor(
      1
      /* Horizontal */
    ), e.disableUserSelect(!0);
  }
  onDragStop(e) {
    e.onResizeEnd(this.resizeAmount), this.resetIcons();
  }
  resetIcons() {
    const e = this.beans.ctrlsSvc.get("gridCtrl");
    e.setResizeCursor(!1), e.disableUserSelect(!1);
  }
  onDragging(e, t) {
    this.resizeAmount = t.clientX - this.dragStartX, e.onResizing(this.resizeAmount);
  }
}, FF = {
  tag: "div",
  cls: "ag-drag-handle ag-row-drag",
  attrs: { "aria-hidden": "true" }
}, RF = class extends D {
  constructor(e, t, s, i, r, n = !1) {
    super(), this.cellValueFn = e, this.rowNode = t, this.column = s, this.customGui = i, this.dragStartPixels = r, this.alwaysVisible = n, this.dragSource = null;
  }
  isCustomGui() {
    return this.customGui != null;
  }
  postConstruct() {
    const { beans: e, customGui: t } = this;
    t ? this.setDragElement(t, this.dragStartPixels) : (this.setTemplate(FF), this.getGui().appendChild(N("rowDrag", e, null)), this.addDragSource()), this.alwaysVisible || this.initCellDrag();
  }
  initCellDrag() {
    const { beans: e, gos: t, rowNode: s } = this, i = this.refreshVisibility.bind(this);
    this.addManagedPropertyListener("suppressRowDrag", i), this.addManagedListeners(s, {
      dataChanged: i,
      cellChanged: i
    }), this.addManagedListeners(
      e.eventSvc,
      // For managed row drag, we do not show the component if sort, filter or grouping is active
      t.get("rowDragManaged") ? {
        sortChanged: i,
        filterChanged: i,
        columnRowGroupChanged: i,
        newColumnsLoaded: i
      } : { newColumnsLoaded: i }
    );
  }
  setDragElement(e, t) {
    this.setTemplateFromElement(e, void 0, void 0, !0), this.addDragSource(t);
  }
  refreshVisibility() {
    if (this.alwaysVisible)
      return;
    const e = { skipAriaHidden: !0 };
    if (this.isNeverDisplayed()) {
      this.setDisplayed(!1, e);
      return;
    }
    const t = this.column;
    let s = typeof (t == null ? void 0 : t.getColDef().rowDrag) == "function", i = !t || this.isCustomGui() || t.isRowDrag(this.rowNode);
    i && this.rowNode.footer && this.gos.get("rowDragManaged") && (i = !1, s = !0), this.setDisplayed(s || i, e), this.setVisible(i, e);
  }
  isNeverDisplayed() {
    var s, i;
    const { gos: e, beans: t } = this;
    return !!(e.get("suppressRowDrag") || e.get("rowDragManaged") && ((s = t.rowDragSvc.rowDragFeature) != null && s.shouldPreventRowMove()) && !((i = t.dragAndDrop) != null && i.hasExternalDropZones()));
  }
  getSelectedNodes() {
    var i;
    const e = this.rowNode;
    if (!this.gos.get("rowDragMultiRow"))
      return [e];
    const s = ((i = this.beans.selectionSvc) == null ? void 0 : i.getSelectedNodes()) ?? [];
    return s.indexOf(e) !== -1 ? s : [e];
  }
  getDragItem() {
    const { column: e, rowNode: t } = this;
    return {
      rowNode: t,
      rowNodes: this.getSelectedNodes(),
      columns: e ? [e] : void 0,
      defaultTextValue: this.cellValueFn()
    };
  }
  getRowDragText(e) {
    if (e) {
      const t = e.getColDef();
      if (t.rowDragText)
        return t.rowDragText;
    }
    return this.gos.get("rowDragText");
  }
  addDragSource(e = 4) {
    if (this.dragSource && this.removeDragSource(), this.gos.get("rowDragManaged") && this.rowNode.footer)
      return;
    const t = this.getGui();
    this.gos.get("enableCellTextSelection") && (this.removeMouseDownListener(), this.mouseDownListener = this.addManagedElementListeners(t, {
      mousedown: (i) => {
        i == null || i.preventDefault();
      }
    })[0]);
    const s = this.getLocaleTextFunc();
    this.dragSource = {
      type: 2,
      eElement: t,
      dragItemName: (i) => {
        var a, l;
        const r = (i == null ? void 0 : i.dragItem) || this.getDragItem(), n = (((a = i == null ? void 0 : i.dropTarget) == null ? void 0 : a.rows.length) ?? ((l = r.rowNodes) == null ? void 0 : l.length)) || 1, o = this.getRowDragText(this.column);
        return o ? o(r, n) : n === 1 ? this.cellValueFn() : `${n} ${s("rowDragRows", "rows")}`;
      },
      getDragItem: () => this.getDragItem(),
      dragStartPixels: e,
      dragSourceDomDataKey: this.gos.getDomDataKey()
    }, this.beans.dragAndDrop.addDragSource(this.dragSource, !0);
  }
  destroy() {
    this.removeDragSource(), this.removeMouseDownListener(), super.destroy();
  }
  removeDragSource() {
    this.dragSource && (this.beans.dragAndDrop.removeDragSource(this.dragSource), this.dragSource = null);
  }
  removeMouseDownListener() {
    this.mouseDownListener && (this.mouseDownListener(), this.mouseDownListener = void 0);
  }
};
function cs(e) {
  const t = e.rowModel;
  return t.getType() === "clientSide" ? t : void 0;
}
function Sa(e) {
  const t = e.rowModel;
  return t.getType() === "infinite" ? t : void 0;
}
function Rn(e) {
  const t = e.rowModel;
  return t.getType() === "serverSide" ? t : void 0;
}
function Ws(e) {
  const { rowIndex: t, rowPinned: s, column: i } = e;
  return `${t}.${s ?? "null"}.${i.getId()}`;
}
function Pn(e, t) {
  const s = e.column === t.column, i = e.rowPinned === t.rowPinned, r = e.rowIndex === t.rowIndex;
  return s && i && r;
}
function Be(e, t) {
  switch (e.rowPinned) {
    case "top":
      if (t.rowPinned !== "top")
        return !0;
      break;
    case "bottom":
      if (t.rowPinned !== "bottom")
        return !1;
      break;
    default:
      if (A(t.rowPinned))
        return t.rowPinned !== "top";
      break;
  }
  return e.rowIndex < t.rowIndex;
}
function xe(e, t) {
  return !e && !t ? !0 : e && !t || !e && t ? !1 : e.rowIndex === t.rowIndex && e.rowPinned == t.rowPinned;
}
function Af(e) {
  let t = 0, s;
  const { pinnedRowModel: i, rowModel: r, pageBounds: n } = e;
  return i != null && i.getPinnedTopRowCount() ? s = "top" : r.getRowCount() ? (s = null, t = n.getFirstRow()) : i != null && i.getPinnedBottomRowCount() && (s = "bottom"), s === void 0 ? null : { rowIndex: t, rowPinned: s };
}
function If(e) {
  let t, s = null;
  const { pinnedRowModel: i, pageBounds: r } = e, n = i == null ? void 0 : i.getPinnedBottomRowCount(), o = i == null ? void 0 : i.getPinnedTopRowCount();
  return n ? (s = "bottom", t = n - 1) : e.rowModel.getRowCount() ? (s = null, t = r.getLastRow()) : o && (s = "top", t = o - 1), t === void 0 ? null : { rowIndex: t, rowPinned: s };
}
function Ee(e, t) {
  var s, i;
  switch (t.rowPinned) {
    case "top":
      return (s = e.pinnedRowModel) == null ? void 0 : s.getPinnedTopRow(t.rowIndex);
    case "bottom":
      return (i = e.pinnedRowModel) == null ? void 0 : i.getPinnedBottomRow(t.rowIndex);
    default:
      return e.rowModel.getRow(t.rowIndex);
  }
}
function qt(e, t) {
  var r;
  const s = (r = e.spannedRowRenderer) == null ? void 0 : r.getCellByPosition(t);
  if (s)
    return s;
  const i = e.rowRenderer.getRowByPosition(t);
  return i ? i.getCellCtrl(t.column) : null;
}
function PF(e, t, s) {
  const { rowModel: i, pinnedRowModel: r } = e;
  let n;
  return n ?? (n = i == null ? void 0 : i.getRowNode(t)), s ? n ?? (n = r == null ? void 0 : r.getPinnedRowById(t, s)) : (n ?? (n = r == null ? void 0 : r.getPinnedRowById(t, "top")), n ?? (n = r == null ? void 0 : r.getPinnedRowById(t, "bottom"))), n;
}
function xs(e, t, s = !1) {
  const { rowIndex: i, rowPinned: r } = t, { pageBounds: n, pinnedRowModel: o, rowModel: a } = e;
  if (i === 0)
    return r === "top" ? null : r === "bottom" && a.isRowsToRender() ? { rowIndex: n.getLastRow(), rowPinned: null } : o != null && o.isRowsToRender("top") ? { rowIndex: o.getPinnedTopRowCount() - 1, rowPinned: "top" } : null;
  if (s) {
    const l = r ? void 0 : a.getRow(i);
    return Lf(e, l, !0) ?? { rowIndex: i - 1, rowPinned: r };
  }
  return { rowIndex: i - 1, rowPinned: r };
}
function _h(e, t) {
  const { pinnedRowModel: s, rowModel: i } = e, r = (s == null ? void 0 : s.getPinnedTopRowCount()) ?? 0, n = i.getRowCount(), { rowPinned: o, rowIndex: a } = t;
  return o === "top" ? a : o === "bottom" ? r + n + a : r + a;
}
function dt(e, t, s = !1) {
  const { rowIndex: i, rowPinned: r } = t, { pageBounds: n, pinnedRowModel: o, rowModel: a } = e;
  if (EF(e, t))
    return r === "bottom" ? null : r === "top" && a.isRowsToRender() ? { rowIndex: n.getFirstRow(), rowPinned: null } : o != null && o.isRowsToRender("bottom") ? { rowIndex: 0, rowPinned: "bottom" } : null;
  if (s) {
    const l = r ? void 0 : a.getRow(i);
    return Lf(e, l) ?? { rowIndex: i + 1, rowPinned: r };
  }
  return { rowIndex: i + 1, rowPinned: r };
}
function Lf(e, t, s = !1) {
  const { gos: i, rowRenderer: r } = e;
  if (!(t != null && t.sticky) || !aa(i))
    return;
  const n = r.getStickyTopRowCtrls(), o = r.getStickyBottomRowCtrls(), a = !o.some((h) => h.rowNode.rowIndex === t.rowIndex), l = a ? n : o, c = (s ? -1 : 1) * (a ? -1 : 1);
  let d;
  for (let h = 0; h < l.length; h++)
    if (l[h].rowNode.rowIndex === t.rowIndex) {
      d = l[h + c];
      break;
    }
  return d ? { rowIndex: d.rowNode.rowIndex, rowPinned: null } : void 0;
}
function EF(e, t) {
  const { rowPinned: s, rowIndex: i } = t, { pinnedRowModel: r, pageBounds: n } = e;
  return s === "top" ? ((r == null ? void 0 : r.getPinnedTopRowCount()) ?? 0) - 1 <= i : s === "bottom" ? ((r == null ? void 0 : r.getPinnedBottomRowCount()) ?? 0) - 1 <= i : n.getLastRow() <= i;
}
var Di = class {
  constructor(e, t) {
    this.active = !0, this.nodeIdsToColumns = {}, this.mapToItems = {}, this.keepingColumns = e, this.pathRoot = {
      rowNode: t,
      children: null
    }, this.mapToItems[t.id] = this.pathRoot;
  }
  depthFirstSearchChangedPath(e, t) {
    const { rowNode: s, children: i } = e;
    if (i)
      for (let r = 0; r < i.length; ++r)
        this.depthFirstSearchChangedPath(i[r], t);
    t(s);
  }
  depthFirstSearchEverything(e, t, s) {
    const i = e.childrenAfterGroup;
    if (i)
      for (let r = 0, n = i.length; r < n; ++r) {
        const o = i[r];
        o.childrenAfterGroup ? this.depthFirstSearchEverything(o, t, s) : s && t(o);
      }
    t(e);
  }
  // traverseLeafNodes -> used when NOT doing changed path, ie traversing everything. the callback
  // will be called for child nodes in addition to parent nodes.
  forEachChangedNodeDepthFirst(e, t = !1, s = !1) {
    this.active && !s ? this.depthFirstSearchChangedPath(this.pathRoot, e) : this.depthFirstSearchEverything(this.pathRoot.rowNode, e, t);
  }
  executeFromRootNode(e) {
    e(this.pathRoot.rowNode);
  }
  createPathItems(e) {
    let t = e, s = 0;
    for (; !this.mapToItems[t.id]; ) {
      const i = {
        rowNode: t,
        children: null
      };
      this.mapToItems[t.id] = i, s++, t = t.parent;
    }
    return s;
  }
  populateColumnsMap(e, t) {
    if (!this.keepingColumns || !t)
      return;
    let s = e;
    for (; s; )
      this.nodeIdsToColumns[s.id] || (this.nodeIdsToColumns[s.id] = {}), t.forEach((i) => this.nodeIdsToColumns[s.id][i.getId()] = !0), s = s.parent;
  }
  linkPathItems(e, t) {
    let s = e;
    for (let i = 0; i < t; i++) {
      const r = this.mapToItems[s.id], n = this.mapToItems[s.parent.id];
      n.children || (n.children = []), n.children.push(r), s = s.parent;
    }
  }
  // called by
  // 1) change detection (provides cols) and
  // 2) groupStage if doing transaction update (doesn't provide cols)
  addParentNode(e, t) {
    if (!e || e.isRowPinned())
      return;
    const s = this.createPathItems(e);
    this.linkPathItems(e, s), this.populateColumnsMap(e, t);
  }
  canSkip(e) {
    return this.active && !this.mapToItems[e.id];
  }
  getValueColumnsForNode(e, t) {
    if (!this.keepingColumns)
      return t;
    const s = this.nodeIdsToColumns[e.id];
    return t.filter((r) => s[r.getId()]);
  }
  getNotValueColumnsForNode(e, t) {
    if (!this.keepingColumns)
      return null;
    const s = this.nodeIdsToColumns[e.id];
    return t.filter((r) => !s[r.getId()]);
  }
}, TF = class {
  constructor(e, t) {
    this.beans = e, this.groupThrottled = !1, this.oldVScroll = null, this.groupTimer = null, this.groupTarget = null, this.onGroupThrottle = () => {
      var i;
      this.groupTimer = null, this.groupThrottled = !0, (i = this.beans.dragAndDrop) == null || i.nudge();
    };
    const s = () => t.scrollFeature.getVScrollPosition().top;
    this.autoScroll = new yd({
      scrollContainer: t.eBodyViewport,
      scrollAxis: "y",
      getVerticalPosition: s,
      setVerticalPosition: (i) => t.scrollFeature.setVerticalScrollPosition(i),
      onScrollCallback: () => {
        var n;
        const i = s(), r = this.oldVScroll;
        this.oldVScroll = i, r !== null && r !== i && ((n = this.beans.dragAndDrop) == null || n.nudge());
      }
    });
  }
  updateGroup(e, t) {
    var s, i;
    this.groupTarget && this.groupTarget !== e && this.clearGroup(), e && (t && this.groupThrottled && !e.expanded && ((s = e.childrenAfterSort) != null && s.length) && e.isExpandable() && e.setExpanded(!0, void 0, !0), e.expanded && ((i = e.childrenAfterSort) != null && i.length) && (this.groupThrottled = !0, this.groupTarget = e));
  }
  startGroup(e) {
    this.groupTarget = e, this.groupTimer === null && (this.groupTimer = window.setTimeout(this.onGroupThrottle, this.beans.gos.get("rowDragInsertDelay")));
  }
  clearGroup() {
    this.groupThrottled = !1, this.groupTarget = null;
    const e = this.groupTimer;
    e !== null && (this.groupTimer = null, window.clearTimeout(e));
  }
  clear() {
    this.clearGroup(), this.autoScroll.ensureCleared(), this.oldVScroll = null;
  }
}, MF = class extends R {
  constructor(e) {
    super(), this.eContainer = e, this.lastDraggingEvent = null, this.nudger = null;
  }
  postConstruct() {
    const e = this.beans;
    this.clientSideRowModel = cs(e), e.ctrlsSvc.whenReady(this, (t) => {
      this.nudger = new TF(e, t.gridBodyCtrl);
    });
  }
  destroy() {
    var e;
    super.destroy(), (e = this.nudger) == null || e.clear(), this.nudger = null, this.lastDraggingEvent = null, this.eContainer = null;
  }
  getContainer() {
    return this.eContainer;
  }
  isInterestedIn(e) {
    return e === 2;
  }
  getIconName(e) {
    var t;
    return ((t = e == null ? void 0 : e.dropTarget) == null ? void 0 : t.allowed) === !1 || this.gos.get("rowDragManaged") && this.shouldPreventRowMove() ? "notAllowed" : "move";
  }
  shouldPreventRowMove() {
    const { rowGroupColsSvc: e, filterManager: t, sortSvc: s } = this.beans;
    return !!(((e == null ? void 0 : e.columns) ?? []).length || (t == null ? void 0 : t.isAnyFilterPresent()) || (s == null ? void 0 : s.isSortActive()));
  }
  getRowNodes(e) {
    var s;
    if (!this.isFromThisGrid(e))
      return e.dragItem.rowNodes || [];
    const t = e.dragItem.rowNode;
    if (this.gos.get("rowDragMultiRow")) {
      const i = (s = this.beans.selectionSvc) == null ? void 0 : s.getSelectedNodes();
      if (i && i.indexOf(t) >= 0)
        return i.slice().sort(IF);
    }
    return [t];
  }
  onDragEnter(e) {
    this.dragging(e, !0);
  }
  onDragging(e) {
    this.dragging(e, !1);
  }
  dragging(e, t) {
    var o, a;
    const { lastDraggingEvent: s, beans: i } = this;
    if (t) {
      const l = this.getRowNodes(e);
      e.dragItem.rowNodes = l, Kh(l, !0);
    }
    this.lastDraggingEvent = e;
    const r = e.fromNudge, n = this.makeRowsDrop(s, e, r, !1);
    (o = i.rowDropHighlightSvc) == null || o.fromDrag(e), t && this.dispatchGridEvent("rowDragEnter", e), this.dispatchGridEvent("rowDragMove", e), !r && (n != null && n.rowDragManaged) && n.moved && n.allowed && n.sameGrid && !n.suppressMoveWhenRowDragging && this.dropRows(n), (a = this.nudger) == null || a.autoScroll.check(e.event);
  }
  isFromThisGrid(e) {
    return e.dragSource.dragSourceDomDataKey === this.gos.getDomDataKey();
  }
  makeRowsDrop(e, t, s, i) {
    var b;
    const { beans: r, gos: n, clientSideRowModel: o } = this, a = this.newRowsDrop(t, i);
    if (t.dropTarget = a, t.changed = !1, !a)
      return null;
    let { sameGrid: l, rootNode: c, source: d, target: h, rows: u } = a;
    h ?? (h = o.getRow(o.getRowCount() - 1) ?? null);
    const p = (
      // We don't yet support drag and drop with grouping
      jc(n) !== "group" && // We don't yet support moving tree rows from a different grid in a structured way
      l
    );
    let f = null;
    if (h != null && h.footer) {
      const y = ao(o, -1, h) ?? ao(o, 1, h);
      f = h.sibling ?? c, h = y ?? null;
    }
    h != null && h.detail && (h = h.parent), a.moved && (a.moved = d !== h);
    let m = 0.5;
    if (h && (l && a.moved && (f || !p) ? m = d.rowIndex > h.rowIndex ? -0.5 : 0.5 : m = (a.y - h.rowTop - h.rowHeight / 2) / h.rowHeight || 0), !p && l && h && a.moved) {
      const y = LF(o, a);
      y && (m = d.rowIndex > y.rowIndex ? -0.5 : 0.5, h = y, a.moved && (a.moved = d !== h));
    }
    const C = this.nudger;
    C == null || C.updateGroup(h, s), p && !f && C && (!h || m >= 0.5 && h.rowIndex === r.pageBounds.getLastRow() ? f = c : a.moved && this.targetShouldBeParent(h, m, u) && (C.groupThrottled && (f = h), !s && (!f || h && !h.expanded && ((b = h.childrenAfterSort) != null && b.length)) && C.startGroup(h)), f ?? (f = (h == null ? void 0 : h.parent) ?? c));
    let v = !1;
    if (f) {
      if (f === h && f !== c) {
        const y = f.expanded ? ao(o, 1, h) : null;
        (y == null ? void 0 : y.parent) === f ? (h = y, m = -0.5) : v = !0;
      }
      if (h && !v) {
        let y = h;
        for (; y && y !== c && y !== f; )
          h = y, y = y.parent;
      }
    }
    a.target = h, a.newParent = f, a.moved && (a.moved = d !== h);
    const w = m < 0 ? "above" : "below";
    return a.position = a.moved ? v ? "inside" : w : "none", this.validateRowsDrop(a, p, w, i), t.changed || (t.changed = AF(e == null ? void 0 : e.dropTarget, a)), a;
  }
  newRowsDrop(e, t) {
    const { beans: s, gos: i, clientSideRowModel: r } = this, n = r.rootNode, o = i.get("rowDragManaged"), a = i.get("suppressMoveWhenRowDragging"), l = this.isFromThisGrid(e);
    let { rowNode: c, rowNodes: d } = e.dragItem;
    if (d || (d = c ? [c] : []), c || (c = d[0]), !c || !n)
      return null;
    const h = this.beans.dragAndDrop.isDropZoneWithinThisGrid(e);
    let u = !0;
    o && (!d.length || this.shouldPreventRowMove() || (a || !l) && !h) && (u = !1);
    const g = Vo(s, e).y, p = this.getOverNode(g);
    return {
      api: s.gridApi,
      context: s.gridOptions.context,
      draggingEvent: e,
      rowDragManaged: o,
      suppressMoveWhenRowDragging: a,
      sameGrid: l,
      withinGrid: h,
      rootNode: n,
      moved: c !== p,
      y: g,
      overNode: p,
      overIndex: (p == null ? void 0 : p.rowIndex) ?? -1,
      position: "none",
      source: c,
      target: p ?? null,
      newParent: null,
      rows: d,
      allowed: u,
      highlight: !t && o && a && (h || !l)
    };
  }
  validateRowsDrop(e, t, s, i) {
    const { rowDragManaged: r, suppressMoveWhenRowDragging: n } = e;
    t || (e.newParent = null), n && !e.moved && (e.allowed = !1);
    const o = (!r || e.allowed) && this.gos.get("isRowValidDropPosition");
    if (o) {
      t && e.newParent && Uh(e.rows, e.newParent) && (e.newParent = null);
      const a = o(e);
      if (!a)
        e.allowed = !1;
      else if (typeof a == "object") {
        a.rows !== void 0 && (e.rows = a.rows ?? []), t && a.newParent !== void 0 && (e.newParent = a.newParent), a.target !== void 0 && (e.target = a.target), a.position && (e.position = a.position), a.allowed !== void 0 ? e.allowed = a.allowed : r || (e.allowed = !0);
        const l = e.draggingEvent;
        a.changed && l && (l.changed = !0), !i && a.highlight !== void 0 && (e.highlight = a.highlight);
      }
    }
    r && (e.rows = this.filterRows(e)), t && e.newParent && Uh(e.rows, e.newParent) && (e.newParent = null), n && (!e.rows.length || e.position === "none") && (e.allowed = !1), (!e.allowed || !e.newParent) && e.position === "inside" && (e.position = s);
  }
  targetShouldBeParent(e, t, s) {
    const i = e.rowIndex, r = 0.25;
    if (t < -0.5 + r)
      return !1;
    if (t < 0.5 - r)
      return !0;
    let n, o = i + 1;
    const a = this.clientSideRowModel;
    do
      n = a.getRow(o++);
    while (n && n.footer);
    const l = e.childrenAfterGroup;
    if (n && n.parent === e && (l != null && l.length)) {
      const c = new Set(s);
      for (const d of l)
        if (d.rowIndex !== null && !c.has(d))
          return !0;
    }
    return !1;
  }
  addRowDropZone(e) {
    if (!e.getContainer()) {
      F(55);
      return;
    }
    const t = this.beans.dragAndDrop;
    if (t.findExternalZone(e.getContainer())) {
      F(56);
      return;
    }
    const s = e.fromGrid ? e : {
      getContainer: e.getContainer,
      onDragEnter: e.onDragEnter && ((r) => e.onDragEnter(this.rowDragEvent("rowDragEnter", r))),
      onDragLeave: e.onDragLeave && ((r) => e.onDragLeave(this.rowDragEvent("rowDragLeave", r))),
      onDragging: e.onDragging && ((r) => e.onDragging(this.rowDragEvent("rowDragMove", r))),
      onDragStop: e.onDragStop && ((r) => e.onDragStop(this.rowDragEvent("rowDragEnd", r))),
      onDragCancel: e.onDragCancel && ((r) => e.onDragCancel(this.rowDragEvent("rowDragCancel", r)))
    }, i = {
      isInterestedIn: (r) => r === 2,
      getIconName: () => "move",
      external: !0,
      ...s
    };
    t.addDropTarget(i), this.addDestroyFunc(() => t.removeDropTarget(i));
  }
  getRowDropZone(e) {
    return {
      getContainer: this.getContainer.bind(this),
      onDragEnter: (s) => {
        var i;
        this.onDragEnter(s), (i = e == null ? void 0 : e.onDragEnter) == null || i.call(e, this.rowDragEvent("rowDragEnter", s));
      },
      onDragLeave: (s) => {
        var i;
        this.onDragLeave(s), (i = e == null ? void 0 : e.onDragLeave) == null || i.call(e, this.rowDragEvent("rowDragLeave", s));
      },
      onDragging: (s) => {
        var i;
        this.onDragging(s), (i = e == null ? void 0 : e.onDragging) == null || i.call(e, this.rowDragEvent("rowDragMove", s));
      },
      onDragStop: (s) => {
        var i;
        this.onDragStop(s), (i = e == null ? void 0 : e.onDragStop) == null || i.call(e, this.rowDragEvent("rowDragEnd", s));
      },
      onDragCancel: (s) => {
        var i;
        this.onDragCancel(s), (i = e == null ? void 0 : e.onDragCancel) == null || i.call(e, this.rowDragEvent("rowDragCancel", s));
      },
      fromGrid: !0
    };
  }
  getOverNode(e) {
    const { pageBounds: t, rowModel: s } = this.beans, r = e > t.getCurrentPagePixelRange().pageLastPixel ? -1 : s.getRowIndexAtPixel(e);
    return r >= 0 ? s.getRow(r) : void 0;
  }
  rowDragEvent(e, t) {
    const s = this.beans, { dragItem: i, dropTarget: r, event: n, vDirection: o } = t, a = (r == null ? void 0 : r.rootNode) === this.clientSideRowModel.rootNode, l = a ? r.y : Vo(s, t).y, c = a ? r.overNode : this.getOverNode(l), d = a ? r.overIndex : (c == null ? void 0 : c.rowIndex) ?? -1;
    return {
      api: s.gridApi,
      context: s.gridOptions.context,
      type: e,
      event: n,
      node: i.rowNode,
      nodes: i.rowNodes,
      overIndex: d,
      overNode: c,
      y: l,
      vDirection: o,
      rowsDrop: r
    };
  }
  dispatchGridEvent(e, t) {
    const s = this.rowDragEvent(e, t);
    this.eventSvc.dispatchEvent(s);
  }
  onDragLeave(e) {
    this.dispatchGridEvent("rowDragLeave", e), this.stopDragging(e);
  }
  onDragStop(e) {
    const t = this.makeRowsDrop(this.lastDraggingEvent, e, !1, !0);
    this.dispatchGridEvent("rowDragEnd", e), t != null && t.allowed && t.rowDragManaged && (t.suppressMoveWhenRowDragging || !t.sameGrid) && this.dropRows(t), this.stopDragging(e);
  }
  onDragCancel(e) {
    this.dispatchGridEvent("rowDragCancel", e), this.stopDragging(e);
  }
  stopDragging(e) {
    var t, s;
    (t = this.nudger) == null || t.clear(), (s = this.beans.rowDropHighlightSvc) == null || s.fromDrag(null), Kh(e.dragItem.rowNodes, !1);
  }
  /** Drag and drop. Returns false if at least a row was moved, otherwise true */
  dropRows(e) {
    return e.sameGrid ? this.moveRows(e) : this.addRows(e);
  }
  addRows({ position: e, target: t, rows: s }) {
    const i = es(this.gos), r = this.clientSideRowModel, n = s.filter(
      ({ data: a, rowPinned: l }) => !r.getRowNode((i == null ? void 0 : i({ data: a, level: 0, rowPinned: l })) ?? a.id)
    ).map(({ data: a }) => a);
    if (n.length === 0)
      return !1;
    const o = t ? $h(t) + (e === "above" ? 0 : 1) : void 0;
    return r.updateRowData({ add: n, addIndex: o }), !0;
  }
  filterRows({ newParent: e, rows: t }) {
    const s = this.clientSideRowModel;
    let i;
    for (let r = 0, n = t.length; r < n; ++r) {
      let o = !0;
      const a = t[r];
      !a || a.footer || a.rowTop === null && a !== s.getRowNode(a.id) || e && a.parent !== e && DF(a, e) ? o = !1 : ic(a) || (o = !1), o ? i == null || i.push(a) : i ?? (i = t.slice(0, r));
    }
    return i ?? t;
  }
  moveRows({ position: e, target: t, rows: s, newParent: i, rootNode: r }) {
    let n = !1;
    const o = /* @__PURE__ */ new Set();
    for (const d of s) {
      i && d.parent !== i && (d.treeParent = i, n = !0);
      const h = ic(d);
      h && o.add(h);
    }
    if (!n && o.size === 0)
      return !1;
    const a = this.beans.focusSvc, l = a.getFocusedCell(), c = l && qt(this.beans, l);
    return o.size && this.reorderLeafChildren(o, ...this.getMoveRowsBounds(o, t, e === "above")) && (n = !0), n ? (this.clientSideRowModel.refreshModel({
      step: "group",
      keepRenderedRows: !0,
      animate: !this.gos.get("suppressAnimationFrame"),
      changedPath: new Di(!1, r),
      rowNodesOrderChanged: !0
    }), c ? c.focusCell() : a.clearFocusedCell(), !0) : !1;
  }
  /** For reorderLeafChildren, returns min index of the rows to move, the target index and the max index of the rows to move. */
  getMoveRowsBounds(e, t, s) {
    var a;
    const i = ((a = this.clientSideRowModel.rootNode) == null ? void 0 : a.allLeafChildren.length) ?? 0;
    let r = $h(t);
    r < 0 || r >= i ? r = i : s || ++r;
    let n = r, o = Math.min(r, i - 1);
    for (const l of e) {
      const c = l.sourceRowIndex;
      c < n && (n = c), c > o && (o = c);
    }
    return [n, r, o];
  }
  /** Reorders the children of the root node, so that the rows to move are in the correct order.
   * @param leafs The valid set of rows to move, as returned by getValidRowsToMove
   * @param firstAffectedLeafIdx The first index of the rows to move
   * @param targetPositionIdx The target index, where the rows will be moved
   * @param lastAffectedLeafIndex The last index of the rows to move
   * @returns True if the order of the rows changed, false otherwise
   */
  reorderLeafChildren(e, t, s, i) {
    var l;
    let r = !1;
    const n = (l = this.clientSideRowModel.rootNode) == null ? void 0 : l.allLeafChildren;
    if (!e.size || !n)
      return !1;
    let o = t;
    for (let c = t; c < s; ++c) {
      const d = n[c];
      e.has(d) || (d.sourceRowIndex !== o && (d.sourceRowIndex = o, n[o] = d, r = !0), ++o);
    }
    let a = i;
    for (let c = i; c >= s; --c) {
      const d = n[c];
      e.has(d) || (d.sourceRowIndex !== a && (d.sourceRowIndex = a, n[a] = d, r = !0), --a);
    }
    for (const c of e)
      c.sourceRowIndex !== o && (c.sourceRowIndex = o, n[o] = c, r = !0), ++o;
    return r;
  }
}, ao = (e, t, s) => {
  if (s) {
    const i = e.getRowCount();
    let r = s.rowIndex + t;
    for (; r >= 0 && r < i; ) {
      const n = e.getRow(r);
      if (!n || !n.footer && !n.detail)
        return n;
      r += t;
    }
  }
}, DF = (e, t) => {
  let s = t;
  for (; s; ) {
    if (s === e)
      return !0;
    s = s.parent;
  }
  return !1;
}, Uh = (e, t) => {
  for (let s = 0, i = e.length; s < i; ++s)
    if (e[s].parent !== t)
      return !1;
  return !0;
}, $h = (e) => {
  const t = ic(e);
  return t !== void 0 ? t.sourceRowIndex : -1;
}, ic = (e) => {
  for (; e; ) {
    if (e.sourceRowIndex >= 0)
      return e;
    const t = e.childrenAfterGroup;
    if (!(t != null && t.length))
      return;
    e = t[0];
  }
}, AF = (e, t) => e !== t && (!e || e.sameGrid !== t.sameGrid || e.allowed !== t.allowed || e.position !== t.position || e.target !== t.target || e.source !== t.source || e.newParent !== t.newParent || !Xe(e.rows, t.rows)), IF = ({ rowIndex: e }, { rowIndex: t }) => e !== null && t !== null ? e - t : 0, Kh = (e, t) => {
  for (let s = 0, i = (e == null ? void 0 : e.length) || 0; s < i; ++s) {
    const r = e[s];
    r.dragging !== t && (r.dragging = t, r.dispatchRowEvent("draggingChanged"));
  }
}, LF = (e, t) => {
  let s = null, i = t.target;
  if (i && t.rows.indexOf(i) < 0)
    return null;
  const r = t.source;
  if (!i || !r)
    return null;
  let n = i.rowIndex - r.rowIndex;
  const o = n < 0 ? -1 : 1;
  n = t.suppressMoveWhenRowDragging ? Math.abs(n) : 1;
  const a = new Set(t.rows);
  do {
    const l = ao(e, o, i);
    if (!l)
      break;
    a.has(l) || (s = l, --n), i = l;
  } while (n > 0);
  return s;
}, kF = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rowDragSvc";
  }
  setupRowDrag(e, t) {
    const s = t.createManagedBean(new MF(e)), i = this.beans.dragAndDrop;
    i.addDropTarget(s), t.addDestroyFunc(() => i.removeDropTarget(s)), this.rowDragFeature = s;
  }
  createRowDragComp(e, t, s, i, r, n) {
    return new RF(e, t, s, i, r, n);
  }
  createRowDragCompForRow(e, t) {
    if (et(this.gos))
      return;
    const s = this.getLocaleTextFunc();
    return this.createRowDragComp(
      () => `1 ${s("rowDragRow", "row")}`,
      e,
      void 0,
      t,
      void 0,
      !0
    );
  }
  createRowDragCompForCell(e, t, s, i, r, n) {
    const o = this.gos;
    return o.get("rowDragManaged") && (!te(o) || o.get("pagination")) ? void 0 : this.createRowDragComp(
      s,
      e,
      t,
      i,
      r,
      n
    );
  }
}, GF = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rowDropHighlightSvc", this.uiLevel = 0, this.dragging = !1, this.row = null, this.position = "none";
  }
  postConstruct() {
    this.addManagedEventListeners({
      modelUpdated: this.onModelUpdated.bind(this)
    });
  }
  onModelUpdated() {
    const e = this.row, t = this.dragging;
    !e || e.rowIndex === null || this.position === "none" ? this.clear() : this.set(e, this.position), this.dragging = t;
  }
  destroy() {
    this.clear(), super.destroy();
  }
  clear() {
    const e = this.row;
    this.dragging = !1, e && (this.uiLevel = 0, this.position = "none", this.row = null, e.dispatchRowEvent("rowHighlightChanged"));
  }
  set(e, t) {
    const s = e !== this.row, i = e.uiLevel, r = t !== this.position, n = i !== this.uiLevel;
    this.dragging = !1, (s || r || n) && (s && this.clear(), this.uiLevel = i, this.position = t, this.row = e, e.dispatchRowEvent("rowHighlightChanged"));
  }
  fromDrag(e) {
    const t = e == null ? void 0 : e.dropTarget;
    if (t) {
      const { highlight: s, target: i, position: r } = t;
      if (s && i && r !== "none") {
        this.set(i, r), this.dragging = !0;
        return;
      }
    }
    this.dragging && this.clear();
  }
}, Sd = {
  moduleName: "Drag",
  version: B,
  beans: [SF]
}, OF = {
  moduleName: "DragAndDrop",
  version: B,
  dynamicBeans: {
    dndSourceComp: mF
  },
  icons: {
    // drag handle used to pick up draggable rows
    rowDrag: "grip"
  }
}, Hi = {
  moduleName: "SharedDragAndDrop",
  version: B,
  beans: [oS],
  dependsOn: [Sd],
  userComponents: {
    agDragAndDropImage: Sx
  },
  icons: {
    // shown on drag and drop image component icon while dragging column to the side of the grid to pin
    columnMovePin: "pin",
    // shown on drag and drop image component icon while dragging over part of the page that is not a drop zone
    columnMoveHide: "eye-slash",
    // shown on drag and drop image component icon while dragging columns to reorder
    columnMoveMove: "arrows",
    // animating icon shown when dragging a column to the right of the grid causes horizontal scrolling
    columnMoveLeft: "left",
    // animating icon shown when dragging a column to the left of the grid causes horizontal scrolling
    columnMoveRight: "right",
    // shown on drag and drop image component icon while dragging over Row Groups drop zone
    columnMoveGroup: "group",
    // shown on drag and drop image component icon while dragging over Values drop zone
    columnMoveValue: "aggregation",
    // shown on drag and drop image component icon while dragging over pivot drop zone
    columnMovePivot: "pivot",
    // shown on drag and drop image component icon while dragging over drop zone that doesn't support it, e.g.
    // string column over aggregation drop zone
    dropNotAllowed: "not-allowed",
    // drag handle used to pick up draggable rows
    rowDrag: "grip"
  }
}, VF = {
  moduleName: "RowDrag",
  version: B,
  beans: [GF, kF],
  apiFunctions: {
    addRowDropZone: CF,
    removeRowDropZone: vF,
    getRowDropZoneParams: wF,
    getRowDropPositionIndicator: bF,
    setRowDropPositionIndicator: yF
  },
  dependsOn: [Hi]
}, kf = {
  moduleName: "HorizontalResize",
  version: B,
  beans: [xF],
  dependsOn: [Sd]
}, BF = (
  /*css*/
  ":where(.ag-ltr) :where(.ag-column-moving){.ag-cell,.ag-header-cell,.ag-spanned-cell-wrapper{transition:left .2s}.ag-header-group-cell{transition:left .2s,width .2s}}:where(.ag-rtl) :where(.ag-column-moving){.ag-cell,.ag-header-cell,.ag-spanned-cell-wrapper{transition:right .2s}.ag-header-group-cell{transition:right .2s,width .2s}}"
), NF = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colAnimation", this.executeNextFuncs = [], this.executeLaterFuncs = [], this.active = !1, this.activeNext = !1, this.suppressAnimation = !1, this.animationThreadCount = 0;
  }
  postConstruct() {
    this.beans.ctrlsSvc.whenReady(this, (e) => this.gridBodyCtrl = e.gridBodyCtrl);
  }
  isActive() {
    return this.active && !this.suppressAnimation;
  }
  setSuppressAnimation(e) {
    this.suppressAnimation = e;
  }
  start() {
    if (this.active)
      return;
    const { gos: e } = this;
    e.get("suppressColumnMoveAnimation") || e.get("enableRtl") || (this.ensureAnimationCssClassPresent(), this.active = !0, this.activeNext = !0);
  }
  finish() {
    this.active && this.flush(
      () => this.activeNext = !1,
      () => this.active = !1
    );
  }
  executeNextVMTurn(e) {
    this.activeNext ? this.executeNextFuncs.push(e) : e();
  }
  executeLaterVMTurn(e) {
    this.active ? this.executeLaterFuncs.push(e) : e();
  }
  ensureAnimationCssClassPresent() {
    this.animationThreadCount++;
    const e = this.animationThreadCount, { gridBodyCtrl: t } = this;
    t.setColumnMovingCss(!0), this.executeLaterFuncs.push(() => {
      this.animationThreadCount === e && t.setColumnMovingCss(!1);
    });
  }
  flush(e, t) {
    const { executeNextFuncs: s, executeLaterFuncs: i } = this;
    if (s.length === 0 && i.length === 0) {
      e(), t();
      return;
    }
    const r = (n) => {
      for (; n.length; ) {
        const o = n.pop();
        o && o();
      }
    };
    this.beans.frameworkOverrides.wrapIncoming(() => {
      window.setTimeout(() => {
        e(), r(s);
      }, 0), window.setTimeout(() => {
        t(), r(i);
      }, 200);
    });
  }
};
function HF(e, t, s) {
  var i;
  (i = e.colMoves) == null || i.moveColumnByIndex(t, s, "api");
}
function zF(e, t, s) {
  var i;
  (i = e.colMoves) == null || i.moveColumns(t, s, "api");
}
var WF = class extends R {
  constructor(e) {
    super(), this.pinned = e, this.columnsToAggregate = [], this.columnsToGroup = [], this.columnsToPivot = [];
  }
  /** Callback for when drag enters */
  onDragEnter(e) {
    if (this.clearColumnsList(), this.gos.get("functionsReadOnly"))
      return;
    const t = e.dragItem.columns;
    t && t.forEach((s) => {
      s.isPrimary() && (s.isAnyFunctionActive() || (s.isAllowValue() ? this.columnsToAggregate.push(s) : s.isAllowRowGroup() ? this.columnsToGroup.push(s) : s.isAllowPivot() && this.columnsToPivot.push(s)));
    });
  }
  getIconName() {
    return this.columnsToAggregate.length + this.columnsToGroup.length + this.columnsToPivot.length > 0 ? this.pinned ? "pinned" : "move" : null;
  }
  /** Callback for when drag leaves */
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  onDragLeave(e) {
    this.clearColumnsList();
  }
  clearColumnsList() {
    this.columnsToAggregate.length = 0, this.columnsToGroup.length = 0, this.columnsToPivot.length = 0;
  }
  /** Callback for when dragging */
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  onDragging(e) {
  }
  /** Callback for when drag stops */
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  onDragStop(e) {
    const { valueColsSvc: t, rowGroupColsSvc: s, pivotColsSvc: i } = this.beans;
    this.columnsToAggregate.length > 0 && (t == null || t.addColumns(this.columnsToAggregate, "toolPanelDragAndDrop")), this.columnsToGroup.length > 0 && (s == null || s.addColumns(this.columnsToGroup, "toolPanelDragAndDrop")), this.columnsToPivot.length > 0 && (i == null || i.addColumns(this.columnsToPivot, "toolPanelDragAndDrop"));
  }
  onDragCancel() {
    this.clearColumnsList();
  }
};
function _F(e, t) {
  !t || t.length <= 1 || t.filter((i) => e.indexOf(i) < 0).length > 0 || t.sort((i, r) => {
    const n = e.indexOf(i), o = e.indexOf(r);
    return n - o;
  });
}
function UF(e) {
  const t = [...e];
  return e.forEach((s) => {
    var n;
    let i = null, r = s.getParent();
    for (; r != null && r.getDisplayedLeafColumns().length === 1; )
      i = r, r = r.getParent();
    i != null && (!!((n = i.getColGroupDef()) != null && n.marryChildren) ? (
      // when marry children is true, we also have to move hidden
      // columns within the group, so grab them from the `providedColumnGroup`
      i.getProvidedColumnGroup().getLeafColumns()
    ) : i.getLeafColumns()).forEach((l) => {
      t.includes(l) || t.push(l);
    });
  }), t;
}
function $F(e, t, s, i) {
  const r = i.allCols;
  let n = null, o = null;
  for (let a = 0; a < e.length; a++) {
    const l = e[a], c = s.getProposedColumnOrder(t, l);
    if (!s.doesOrderPassRules(c))
      continue;
    const d = c.filter((u) => r.includes(u));
    if (o === null)
      o = d;
    else if (!Xe(d, o))
      break;
    const h = jF(c);
    (n === null || h < n.fragCount) && (n = { move: l, fragCount: h });
  }
  return n;
}
function Gf(e) {
  const { isFromHeader: t, fromLeft: s, xPosition: i, fromEnter: r, fakeEvent: n, pinned: o, gos: a, colModel: l, colMoves: c, visibleCols: d } = e;
  let { allMovingColumns: h } = e;
  t && (h = UF(h));
  const u = h.slice();
  _F(l.getCols(), u);
  const g = qF({
    movingCols: u,
    draggingRight: s,
    xPosition: i,
    pinned: o,
    gos: a,
    colModel: l,
    visibleCols: d
  }), p = KF(u, l);
  if (g.length === 0)
    return;
  const f = g[0];
  if (p !== null && (t || !r) && !n && (!s && f >= p || s && f <= p))
    return;
  const C = $F(g, u, c, d);
  if (!C)
    return;
  const v = C.move;
  if (!(v > l.getCols().length - u.length))
    return { columns: u, toIndex: v };
}
function Of(e) {
  const { columns: t, toIndex: s } = Gf(e) || {}, { finished: i, colMoves: r } = e;
  return !t || s == null ? null : (r.moveColumns(t, s, "uiColumnMoved", i), i ? null : { columns: t, toIndex: s });
}
function KF(e, t) {
  const s = t.getCols(), i = e.map((l) => s.indexOf(l)).sort((l, c) => l - c), r = i[0];
  return _(i) - r !== i.length - 1 ? null : r;
}
function jF(e) {
  function t(i) {
    const r = [];
    let n = i.getOriginalParent();
    for (; n != null; )
      r.push(n), n = n.getOriginalParent();
    return r;
  }
  let s = 0;
  for (let i = 0; i < e.length - 1; i++) {
    let r = t(e[i]), n = t(e[i + 1]);
    [r, n] = r.length > n.length ? [r, n] : [n, r], r.forEach((o) => {
      n.indexOf(o) === -1 && s++;
    });
  }
  return s;
}
function YF(e, t) {
  switch (t) {
    case "left":
      return e.leftCols;
    case "right":
      return e.rightCols;
    default:
      return e.centerCols;
  }
}
function qF(e) {
  const { movingCols: t, draggingRight: s, xPosition: i, pinned: r, gos: n, colModel: o, visibleCols: a } = e;
  if (n.get("suppressMovableColumns") || t.some((w) => w.getColDef().suppressMovable))
    return [];
  const c = YF(a, r), d = o.getCols(), h = c.filter((w) => t.includes(w)), u = c.filter((w) => !t.includes(w)), g = d.filter((w) => !t.includes(w));
  let p = 0, f = i;
  if (s) {
    let w = 0;
    h.forEach((b) => w += b.getActualWidth()), f -= w;
  }
  if (f > 0) {
    for (let w = 0; w < u.length; w++) {
      const b = u[w];
      if (f -= b.getActualWidth(), f < 0)
        break;
      p++;
    }
    s && p++;
  }
  let m;
  if (p > 0) {
    const w = u[p - 1];
    m = g.indexOf(w) + 1;
  } else
    m = g.indexOf(u[0]), m === -1 && (m = 0);
  const C = [m], v = (w, b) => w - b;
  if (s) {
    let w = m + 1;
    const b = d.length - 1;
    for (; w <= b; )
      C.push(w), w++;
    C.sort(v);
  } else {
    let w = m;
    const b = d.length - 1;
    let y = d[w];
    for (; w <= b && c.indexOf(y) < 0; )
      w++, C.push(w), y = d[w];
    w = m - 1;
    const P = 0;
    for (; w >= P; )
      C.push(w), w--;
    C.sort(v).reverse();
  }
  return C;
}
function rc(e) {
  var c;
  const { pinned: t, fromKeyboard: s, gos: i, ctrlsSvc: r, useHeaderRow: n, skipScrollPadding: o } = e;
  let a = (c = r.getHeaderRowContainerCtrl(t)) == null ? void 0 : c.eViewport, { x: l } = e;
  return a ? (s && (l -= a.getBoundingClientRect().left), i.get("enableRtl") && (n && (a = a.querySelector(".ag-header-row")), l = a.clientWidth - l), t == null && !o && (l += r.get("center").getCenterViewportScrollLeft()), l) : 0;
}
function ll(e, t) {
  for (const s of e)
    s.moving = t, s.dispatchColEvent("movingChanged", "uiColumnMoved");
}
var jh = 7, nc = 100, Wn = nc / 2, XF = 5, ZF = 100, QF = class extends R {
  constructor(e) {
    super(), this.pinned = e, this.needToMoveLeft = !1, this.needToMoveRight = !1, this.lastMovedInfo = null, this.isCenterContainer = !A(e);
  }
  postConstruct() {
    this.beans.ctrlsSvc.whenReady(this, (e) => {
      this.gridBodyCon = e.gridBodyCtrl;
    });
  }
  getIconName() {
    const { pinned: e, lastDraggingEvent: t } = this, { dragItem: s } = t || {}, i = (s == null ? void 0 : s.columns) ?? [];
    for (const r of i) {
      const n = r.getPinned();
      if (r.getColDef().lockPinned) {
        if (n == e)
          return "move";
        continue;
      }
      const o = s == null ? void 0 : s.containerType;
      if (o === e || !e)
        return "move";
      if (e && (!n || o !== e))
        return "pinned";
    }
    return "notAllowed";
  }
  onDragEnter(e) {
    const t = e.dragItem, s = t.columns;
    if (e.dragSource.type === 0)
      this.setColumnsVisible(s, !0, "uiColumnDragged");
    else {
      const r = t.visibleState, n = (s || []).filter(
        (o) => r[o.getId()] && !o.isVisible()
      );
      this.setColumnsVisible(n, !0, "uiColumnDragged");
    }
    this.gos.get("suppressMoveWhenColumnDragging") || this.attemptToPinColumns(s, this.pinned), this.onDragging(e, !0, !0);
  }
  onDragging(e = this.lastDraggingEvent, t = !1, s = !1, i = !1) {
    const { gos: r, ctrlsSvc: n } = this.beans, o = r.get("suppressMoveWhenColumnDragging");
    if (i && !o) {
      this.finishColumnMoving();
      return;
    }
    if (this.lastDraggingEvent = e, !e || !i && ee(e.hDirection))
      return;
    const a = rc({
      x: e.x,
      pinned: this.pinned,
      gos: r,
      ctrlsSvc: n
    });
    t || this.checkCenterForScrolling(a), o ? this.handleColumnDragWhileSuppressingMovement(e, t, s, a, i) : this.handleColumnDragWhileAllowingMovement(e, t, s, a, i);
  }
  onDragLeave() {
    this.ensureIntervalCleared(), this.clearHighlighted(), this.updateDragItemContainerType(), this.lastMovedInfo = null;
  }
  onDragStop() {
    this.onDragging(this.lastDraggingEvent, !1, !0, !0), this.ensureIntervalCleared(), this.lastMovedInfo = null;
  }
  onDragCancel() {
    this.clearHighlighted(), this.ensureIntervalCleared(), this.lastMovedInfo = null;
  }
  setColumnsVisible(e, t, s) {
    if (!(e != null && e.length))
      return;
    const i = e.filter((r) => !r.getColDef().lockVisible);
    i.length && this.beans.colModel.setColsVisible(i, t, s);
  }
  finishColumnMoving() {
    this.clearHighlighted();
    const e = this.lastMovedInfo;
    if (!e)
      return;
    const { columns: t, toIndex: s } = e;
    this.beans.colMoves.moveColumns(t, s, "uiColumnMoved", !0);
  }
  updateDragItemContainerType() {
    const { lastDraggingEvent: e } = this;
    if (this.gos.get("suppressMoveWhenColumnDragging") || !e)
      return;
    const t = e.dragItem;
    t && (t.containerType = this.pinned);
  }
  handleColumnDragWhileSuppressingMovement(e, t, s, i, r) {
    const n = this.getAllMovingColumns(e, !0);
    if (r) {
      const o = this.isAttemptingToPin(n);
      o && this.attemptToPinColumns(n, void 0, !0);
      const { fromLeft: a, xPosition: l } = this.getNormalisedXPositionInfo(n, o) || {};
      if (a == null || l == null) {
        this.finishColumnMoving();
        return;
      }
      this.moveColumnsAfterHighlight({
        allMovingColumns: n,
        xPosition: l,
        fromEnter: t,
        fakeEvent: s,
        fromLeft: a
      });
    } else {
      if (!this.beans.dragAndDrop.isDropZoneWithinThisGrid(e))
        return;
      this.highlightHoveredColumn(n, i);
    }
  }
  handleColumnDragWhileAllowingMovement(e, t, s, i, r) {
    const n = this.getAllMovingColumns(e), o = this.normaliseDirection(e.hDirection) === "right", a = e.dragSource.type === 1, l = this.getMoveColumnParams({
      allMovingColumns: n,
      isFromHeader: a,
      xPosition: i,
      fromLeft: o,
      fromEnter: t,
      fakeEvent: s
    }), c = Of({ ...l, finished: r });
    c && (this.lastMovedInfo = c);
  }
  getAllMovingColumns(e, t = !1) {
    const s = e.dragSource.getDragItem();
    let i = null;
    t ? (i = s.columnsInSplit, i || (i = s.columns)) : i = s.columns;
    const r = (n) => n.getColDef().lockPinned ? n.getPinned() == this.pinned : !0;
    return i ? i.filter(r) : [];
  }
  getMoveColumnParams(e) {
    const { allMovingColumns: t, isFromHeader: s, xPosition: i, fromLeft: r, fromEnter: n, fakeEvent: o } = e, { gos: a, colModel: l, colMoves: c, visibleCols: d } = this.beans;
    return {
      allMovingColumns: t,
      isFromHeader: s,
      fromLeft: r,
      xPosition: i,
      pinned: this.pinned,
      fromEnter: n,
      fakeEvent: o,
      gos: a,
      colModel: l,
      colMoves: c,
      visibleCols: d
    };
  }
  highlightHoveredColumn(e, t) {
    var d;
    const { gos: s, colModel: i } = this.beans, r = s.get("enableRtl"), n = i.getCols().filter((h) => h.isVisible() && h.getPinned() === this.pinned);
    let o = null, a = null, l = null;
    for (const h of n) {
      if (a = h.getActualWidth(), o = this.getNormalisedColumnLeft(h, 0, r), o != null) {
        const u = o + a;
        if (o <= t && u >= t) {
          l = h;
          break;
        }
      }
      o = null, a = null;
    }
    if (l)
      e.indexOf(l) !== -1 && (l = null);
    else {
      for (let h = n.length - 1; h >= 0; h--) {
        const u = n[h], g = n[h].getParent();
        if (!g) {
          l = u;
          break;
        }
        const p = g == null ? void 0 : g.getDisplayedLeafColumns();
        if (p.length) {
          l = _(p);
          break;
        }
      }
      if (!l)
        return;
      o = this.getNormalisedColumnLeft(l, 0, r), a = l.getActualWidth();
    }
    if (((d = this.lastHighlightedColumn) == null ? void 0 : d.column) !== l && this.clearHighlighted(), l == null || o == null || a == null)
      return;
    let c;
    t - o < a / 2 !== r ? c = 0 : c = 1, Yh(l, c), this.lastHighlightedColumn = { column: l, position: c };
  }
  getNormalisedXPositionInfo(e, t) {
    const { gos: s, visibleCols: i } = this.beans, r = s.get("enableRtl"), { firstMovingCol: n, column: o, position: a } = this.getColumnMoveAndTargetInfo(
      e,
      t,
      r
    );
    if (!n || !o || a == null)
      return;
    const l = i.allCols, c = l.indexOf(n), d = l.indexOf(o), h = a === 0 !== r, u = c < d || c === d && !h;
    let g = 0;
    if (h ? u && (g -= 1) : u || (g += 1), d + g === c)
      return;
    const p = l[d + g];
    if (!p)
      return;
    const f = this.getNormalisedColumnLeft(p, 20, r);
    return { fromLeft: u, xPosition: f };
  }
  getColumnMoveAndTargetInfo(e, t, s) {
    const i = this.lastHighlightedColumn || {}, { firstMovingCol: r, lastMovingCol: n } = JF(e);
    if (!r || !n || i.column || !t)
      return {
        firstMovingCol: r,
        ...i
      };
    const a = this.getPinDirection() === "left";
    return {
      firstMovingCol: r,
      position: a ? 1 : 0,
      column: a !== s ? r : n
    };
  }
  normaliseDirection(e) {
    if (this.gos.get("enableRtl"))
      switch (e) {
        case "left":
          return "right";
        case "right":
          return "left";
      }
    return e;
  }
  getNormalisedColumnLeft(e, t, s) {
    const { gos: i, ctrlsSvc: r } = this.beans, n = e.getLeft();
    if (n == null)
      return null;
    const o = e.getActualWidth();
    return rc({
      x: s ? n + o - t : n + t,
      pinned: e.getPinned(),
      useHeaderRow: s,
      skipScrollPadding: !0,
      gos: i,
      ctrlsSvc: r
    });
  }
  isAttemptingToPin(e) {
    const t = this.needToMoveLeft || this.needToMoveRight, s = this.failedMoveAttempts > jh;
    return t && s || e.some((i) => i.getPinned() !== this.pinned);
  }
  moveColumnsAfterHighlight(e) {
    const { allMovingColumns: t, xPosition: s, fromEnter: i, fakeEvent: r, fromLeft: n } = e, o = this.getMoveColumnParams({
      allMovingColumns: t,
      isFromHeader: !0,
      xPosition: s,
      fromLeft: n,
      fromEnter: i,
      fakeEvent: r
    }), { columns: a, toIndex: l } = Gf(o) || {};
    a && l != null && (this.lastMovedInfo = {
      columns: a,
      toIndex: l
    }), this.finishColumnMoving();
  }
  clearHighlighted() {
    const { lastHighlightedColumn: e } = this;
    e && (Yh(e.column, null), this.lastHighlightedColumn = null);
  }
  checkCenterForScrolling(e) {
    if (!this.isCenterContainer)
      return;
    const t = this.beans.ctrlsSvc.get("center"), s = t.getCenterViewportScrollLeft(), i = s + t.getCenterWidth();
    let r, n;
    this.gos.get("enableRtl") ? (r = e < s + Wn, n = e > i - Wn) : (n = e < s + Wn, r = e > i - Wn), this.needToMoveRight = r, this.needToMoveLeft = n, n || r ? this.ensureIntervalStarted() : this.ensureIntervalCleared();
  }
  ensureIntervalStarted() {
    this.movingIntervalId || (this.intervalCount = 0, this.failedMoveAttempts = 0, this.movingIntervalId = window.setInterval(this.moveInterval.bind(this), ZF), this.beans.dragAndDrop.setDragImageCompIcon(this.needToMoveLeft ? "left" : "right", !0));
  }
  ensureIntervalCleared() {
    this.movingIntervalId && (window.clearInterval(this.movingIntervalId), this.movingIntervalId = null, this.failedMoveAttempts = 0, this.beans.dragAndDrop.setDragImageCompIcon(this.getIconName()));
  }
  moveInterval() {
    var i;
    let e;
    this.intervalCount++, e = 10 + this.intervalCount * XF, e > nc && (e = nc);
    let t = null;
    const s = this.gridBodyCon.scrollFeature;
    if (this.needToMoveLeft ? t = s.scrollHorizontally(-e) : this.needToMoveRight && (t = s.scrollHorizontally(e)), t !== 0)
      this.onDragging(this.lastDraggingEvent), this.failedMoveAttempts = 0;
    else {
      this.failedMoveAttempts++;
      const { pinnedCols: r, dragAndDrop: n, gos: o } = this.beans;
      if (this.failedMoveAttempts <= jh + 1 || !r)
        return;
      if (n.setDragImageCompIcon("pinned"), !o.get("suppressMoveWhenColumnDragging")) {
        const a = (i = this.lastDraggingEvent) == null ? void 0 : i.dragItem.columns;
        this.attemptToPinColumns(a, void 0, !0);
      }
    }
  }
  getPinDirection() {
    if (this.needToMoveLeft || this.pinned === "left")
      return "left";
    if (this.needToMoveRight || this.pinned === "right")
      return "right";
  }
  attemptToPinColumns(e, t, s = !1) {
    const i = (e || []).filter((o) => !o.getColDef().lockPinned);
    if (!i.length)
      return 0;
    s && (t = this.getPinDirection());
    const { pinnedCols: r, dragAndDrop: n } = this.beans;
    return r == null || r.setColsPinned(i, t, "uiColumnDragged"), s && n.nudge(), i.length;
  }
  destroy() {
    super.destroy(), this.lastDraggingEvent = null, this.clearHighlighted(), this.lastMovedInfo = null;
  }
};
function Yh(e, t) {
  e.highlighted !== t && (e.highlighted = t, e.dispatchColEvent("headerHighlightChanged", "uiColumnMoved"));
}
function JF(e) {
  const t = e.length;
  let s, i;
  for (let r = 0; r < t; r++) {
    if (!s) {
      const n = e[r];
      n.getLeft() != null && (s = n);
    }
    if (!i) {
      const n = e[t - 1 - r];
      n.getLeft() != null && (i = n);
    }
    if (s && i)
      break;
  }
  return { firstMovingCol: s, lastMovingCol: i };
}
var eR = class extends R {
  constructor(e, t) {
    super(), this.pinned = e, this.eContainer = t;
  }
  postConstruct() {
    const { ctrlsSvc: e, dragAndDrop: t } = this.beans, s = this.pinned;
    e.whenReady(this, (i) => {
      let r;
      const n = i.gridBodyCtrl.eBodyViewport;
      switch (s) {
        case "left":
          r = [
            [n, i.left.eContainer],
            [i.bottomLeft.eContainer],
            [i.topLeft.eContainer]
          ];
          break;
        case "right":
          r = [
            [n, i.right.eContainer],
            [i.bottomRight.eContainer],
            [i.topRight.eContainer]
          ];
          break;
        default:
          r = [
            [n, i.center.eViewport],
            [i.bottomCenter.eViewport],
            [i.topCenter.eViewport]
          ];
          break;
      }
      this.eSecondaryContainers = r;
    }), this.moveColumnFeature = this.createManagedBean(new QF(s)), this.bodyDropPivotTarget = this.createManagedBean(new WF(s)), t.addDropTarget(this), this.addDestroyFunc(() => t.removeDropTarget(this));
  }
  isInterestedIn(e) {
    return e === 1 || e === 0 && this.gos.get("allowDragFromColumnsToolPanel");
  }
  getSecondaryContainers() {
    return this.eSecondaryContainers;
  }
  getContainer() {
    return this.eContainer;
  }
  getIconName() {
    return this.currentDropListener.getIconName();
  }
  // we want to use the bodyPivotTarget if the user is dragging columns in from the toolPanel
  // and we are in pivot mode, as it has to logic to set pivot/value/group on the columns when
  // dropped into the grid's body.
  isDropColumnInPivotMode(e) {
    return this.beans.colModel.isPivotMode() && e.dragSource.type === 0;
  }
  onDragEnter(e) {
    this.currentDropListener = this.isDropColumnInPivotMode(e) ? this.bodyDropPivotTarget : this.moveColumnFeature, this.currentDropListener.onDragEnter(e);
  }
  onDragLeave(e) {
    this.currentDropListener.onDragLeave(e);
  }
  onDragging(e) {
    this.currentDropListener.onDragging(e);
  }
  onDragStop(e) {
    this.currentDropListener.onDragStop(e);
  }
  onDragCancel() {
    this.currentDropListener.onDragCancel();
  }
}, tR = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colMoves";
  }
  moveColumnByIndex(e, t, s) {
    const i = this.beans.colModel.getCols();
    if (!i)
      return;
    const r = i[e];
    this.moveColumns([r], t, s);
  }
  moveColumns(e, t, s, i = !0) {
    const { colModel: r, colAnimation: n, visibleCols: o, eventSvc: a } = this.beans, l = r.getCols();
    if (!l)
      return;
    if (t > l.length - e.length) {
      F(30, { toIndex: t });
      return;
    }
    n == null || n.start();
    const c = r.getColsForKeys(e);
    this.doesMovePassRules(c, t) && (wh(r.getCols(), c, t), o.refresh(s), a.dispatchEvent({
      type: "columnMoved",
      columns: c,
      column: c.length === 1 ? c[0] : null,
      toIndex: t,
      finished: i,
      source: s
    })), n == null || n.finish();
  }
  doesMovePassRules(e, t) {
    const s = this.getProposedColumnOrder(e, t);
    return this.doesOrderPassRules(s);
  }
  doesOrderPassRules(e) {
    const { colModel: t, gos: s } = this.beans;
    return !(!mp(e, t.getColTree()) || !((r) => {
      const n = (c) => c ? c === "left" || c === !0 ? -1 : 1 : 0, o = s.get("enableRtl");
      let a = o ? 1 : -1, l = !0;
      return r.forEach((c) => {
        const d = n(c.getColDef().lockPosition);
        o ? d > a && (l = !1) : d < a && (l = !1), a = d;
      }), l;
    })(e));
  }
  getProposedColumnOrder(e, t) {
    const i = this.beans.colModel.getCols().slice();
    return wh(i, e, t), i;
  }
  createBodyDropTarget(e, t) {
    return new eR(e, t);
  }
  moveHeader(e, t, s, i, r) {
    const { ctrlsSvc: n, gos: o, colModel: a, visibleCols: l, focusSvc: c } = this.beans, d = t.getBoundingClientRect(), h = d.left, u = we(s), g = u ? d.width : s.getActualWidth(), p = e === "left" !== o.get("enableRtl"), f = rc({
      x: p ? h - 20 : h + g + 20,
      pinned: i,
      fromKeyboard: !0,
      gos: o,
      ctrlsSvc: n
    }), m = c.focusedHeader;
    Of({
      allMovingColumns: u ? s.getLeafColumns() : [s],
      isFromHeader: !0,
      fromLeft: e === "right",
      xPosition: f,
      pinned: i,
      fromEnter: !1,
      fakeEvent: !1,
      gos: o,
      colModel: a,
      colMoves: this,
      visibleCols: l,
      finished: !0
    });
    let C;
    if (u) {
      const v = s.getDisplayedLeafColumns();
      C = p ? v[0] : _(v);
    } else
      C = s;
    if (n.getScrollFeature().ensureColumnVisible(C, "auto"), (!r.isAlive() || o.get("ensureDomOrder")) && m) {
      let v;
      if (u) {
        const w = s.getGroupId(), b = s.getLeafColumns();
        if (!b.length)
          return;
        const y = b[0].getParent();
        if (!y)
          return;
        v = sR(y, w);
      } else
        v = s;
      v && c.focusHeaderPosition({
        headerPosition: {
          ...m,
          column: v
        }
      });
    }
  }
  setDragSourceForHeader(e, t, s) {
    const { gos: i, colModel: r, dragAndDrop: n, visibleCols: o } = this.beans;
    let a = !i.get("suppressDragLeaveHidesColumns");
    const l = we(t), c = l ? t.getProvidedColumnGroup().getLeafColumns() : [t], h = {
      type: 1,
      eElement: e,
      getDefaultIconName: () => a ? "hide" : "notAllowed",
      getDragItem: l ? () => rR(t, o.allCols) : () => iR(t),
      dragItemName: s,
      onDragStarted: () => {
        a = !i.get("suppressDragLeaveHidesColumns"), ll(c, !0);
      },
      onDragStopped: () => ll(c, !1),
      onDragCancelled: () => ll(c, !1),
      onGridEnter: (u) => {
        if (a) {
          const { columns: g = [], visibleState: p } = u ?? {}, f = l ? (C) => !p || p[C.getColId()] : () => !0, m = g.filter(
            (C) => !C.getColDef().lockVisible && f(C)
          );
          r.setColsVisible(m, !0, "uiColumnMoved");
        }
      },
      onGridExit: (u) => {
        var g;
        if (a) {
          const p = ((g = u == null ? void 0 : u.columns) == null ? void 0 : g.filter((f) => !f.getColDef().lockVisible)) || [];
          r.setColsVisible(p, !1, "uiColumnMoved");
        }
      }
    };
    return n.addDragSource(h, !0), h;
  }
};
function sR(e, t) {
  for (; e; ) {
    if (e.getGroupId() === t)
      return e;
    e = e.getParent();
  }
}
function iR(e) {
  const t = {};
  return t[e.getId()] = e.isVisible(), {
    columns: [e],
    visibleState: t,
    containerType: e.pinned
  };
}
function rR(e, t) {
  var a;
  const s = e.getProvidedColumnGroup().getLeafColumns(), i = {};
  s.forEach((l) => i[l.getId()] = l.isVisible());
  const r = [];
  t.forEach((l) => {
    s.indexOf(l) >= 0 && (r.push(l), be(s, l));
  }), s.forEach((l) => r.push(l));
  const n = [], o = e.getLeafColumns();
  for (const l of r)
    o.indexOf(l) !== -1 && n.push(l);
  return {
    columns: r,
    columnsInSplit: n,
    visibleState: i,
    containerType: (a = n[0]) == null ? void 0 : a.pinned
  };
}
var xd = {
  moduleName: "ColumnMove",
  version: B,
  beans: [tR, NF],
  apiFunctions: {
    moveColumnByIndex: HF,
    moveColumns: zF
  },
  dependsOn: [Hi],
  css: [BF]
}, nR = class extends R {
  constructor() {
    super(...arguments), this.beanName = "autoWidthCalc";
  }
  postConstruct() {
    this.beans.ctrlsSvc.whenReady(this, (e) => {
      this.centerRowContainerCtrl = e.center;
    });
  }
  // this is the trick: we create a dummy container and clone all the cells
  // into the dummy, then check the dummy's width. then destroy the dummy
  // as we don't need it any more.
  // drawback: only the cells visible on the screen are considered
  getPreferredWidthForColumn(e, t) {
    const s = this.getHeaderCellForColumn(e);
    if (!s)
      return -1;
    const i = this.beans.rowRenderer.getAllCellsNotSpanningForColumn(e);
    return t || i.push(s), this.getPreferredWidthForElements(i);
  }
  getPreferredWidthForColumnGroup(e) {
    const t = this.getHeaderCellForColumn(e);
    return t ? this.getPreferredWidthForElements([t]) : -1;
  }
  getPreferredWidthForElements(e, t) {
    const s = document.createElement("form");
    s.style.position = "fixed";
    const i = this.centerRowContainerCtrl.eContainer;
    e.forEach((n) => this.cloneItemIntoDummy(n, s)), i.appendChild(s);
    const r = s.offsetWidth;
    return i.removeChild(s), t = t ?? this.gos.get("autoSizePadding"), r + t;
  }
  getHeaderCellForColumn(e) {
    let t = null;
    return this.beans.ctrlsSvc.getHeaderRowContainerCtrls().forEach((s) => {
      const i = s.getHtmlElementForColumnHeader(e);
      i != null && (t = i);
    }), t;
  }
  cloneItemIntoDummy(e, t) {
    const s = e.cloneNode(!0);
    s.style.width = "", s.style.position = "static", s.style.left = "";
    const i = document.createElement("div"), r = i.classList;
    ["ag-header-cell", "ag-header-group-cell"].some((a) => s.classList.contains(a)) ? (r.add("ag-header", "ag-header-row"), i.style.position = "static") : r.add("ag-row");
    let o = e.parentElement;
    for (; o; ) {
      if (["ag-header-row", "ag-row"].some((l) => o.classList.contains(l))) {
        for (let l = 0; l < o.classList.length; l++) {
          const c = o.classList[l];
          c != "ag-row-position-absolute" && r.add(c);
        }
        break;
      }
      o = o.parentElement;
    }
    i.appendChild(s), t.appendChild(i);
  }
}, Vf = {
  moduleName: "AutoWidth",
  version: B,
  beans: [nR]
};
function oR(e, t, s = !0, i = "api") {
  var r;
  (r = e.colResize) == null || r.setColumnWidths(t, !1, s, i);
}
var aR = class extends R {
  constructor(e, t, s, i) {
    super(), this.comp = e, this.eResize = t, this.pinned = s, this.columnGroup = i;
  }
  postConstruct() {
    if (!this.columnGroup.isResizable()) {
      this.comp.setResizableDisplayed(!1);
      return;
    }
    const { horizontalResizeSvc: e, gos: t, colAutosize: s } = this.beans, i = e.addResizeBar({
      eResizeBar: this.eResize,
      onResizeStart: this.onResizeStart.bind(this),
      onResizing: this.onResizing.bind(this, !1),
      onResizeEnd: this.onResizing.bind(this, !0)
    });
    this.addDestroyFunc(i), !t.get("suppressAutoSize") && s && this.addDestroyFunc(
      s.addColumnGroupResize(
        this.eResize,
        this.columnGroup,
        () => this.resizeLeafColumnsToFit("uiColumnResized")
      )
    );
  }
  onResizeStart(e) {
    const {
      columnsToResize: t,
      resizeStartWidth: s,
      resizeRatios: i,
      groupAfterColumns: r,
      groupAfterStartWidth: n,
      groupAfterRatios: o
    } = this.getInitialValues(e);
    this.resizeCols = t, this.resizeStartWidth = s, this.resizeRatios = i, this.resizeTakeFromCols = r, this.resizeTakeFromStartWidth = n, this.resizeTakeFromRatios = o, this.toggleColumnResizing(!0);
  }
  onResizing(e, t, s = "uiColumnResized") {
    const i = this.normaliseDragChange(t), r = this.resizeStartWidth + i;
    this.resizeColumnsFromLocalValues(r, s, e);
  }
  getInitialValues(e) {
    var l;
    const t = (c) => c.reduce((d, h) => d + h.getActualWidth(), 0), s = (c, d) => c.map((h) => h.getActualWidth() / d), i = this.getColumnsToResize(), r = t(i), n = s(i, r), o = {
      columnsToResize: i,
      resizeStartWidth: r,
      resizeRatios: n
    };
    let a = null;
    if (e && (a = ((l = this.beans.colGroupSvc) == null ? void 0 : l.getGroupAtDirection(this.columnGroup, "After")) ?? null), a) {
      const c = a.getDisplayedLeafColumns(), d = o.groupAfterColumns = c.filter(
        (u) => u.isResizable()
      ), h = o.groupAfterStartWidth = t(d);
      o.groupAfterRatios = s(d, h);
    } else
      o.groupAfterColumns = void 0, o.groupAfterStartWidth = void 0, o.groupAfterRatios = void 0;
    return o;
  }
  resizeLeafColumnsToFit(e) {
    const t = this.beans.autoWidthCalc.getPreferredWidthForColumnGroup(this.columnGroup), s = this.getInitialValues();
    t > s.resizeStartWidth && this.resizeColumns(s, t, e, !0);
  }
  resizeColumnsFromLocalValues(e, t, s = !0) {
    if (!this.resizeCols || !this.resizeRatios)
      return;
    const i = {
      columnsToResize: this.resizeCols,
      resizeStartWidth: this.resizeStartWidth,
      resizeRatios: this.resizeRatios,
      groupAfterColumns: this.resizeTakeFromCols,
      groupAfterStartWidth: this.resizeTakeFromStartWidth,
      groupAfterRatios: this.resizeTakeFromRatios
    };
    this.resizeColumns(i, e, t, s);
  }
  resizeColumns(e, t, s, i = !0) {
    var h;
    const {
      columnsToResize: r,
      resizeStartWidth: n,
      resizeRatios: o,
      groupAfterColumns: a,
      groupAfterStartWidth: l,
      groupAfterRatios: c
    } = e, d = [];
    if (d.push({
      columns: r,
      ratios: o,
      width: t
    }), a) {
      const u = t - n;
      d.push({
        columns: a,
        ratios: c,
        width: l - u
      });
    }
    (h = this.beans.colResize) == null || h.resizeColumnSets({
      resizeSets: d,
      finished: i,
      source: s
    }), i && this.toggleColumnResizing(!1);
  }
  toggleColumnResizing(e) {
    this.comp.toggleCss("ag-column-resizing", e);
  }
  getColumnsToResize() {
    return this.columnGroup.getDisplayedLeafColumns().filter((t) => t.isResizable());
  }
  // optionally inverts the drag, depending on pinned and RTL
  // note - this method is duplicated in RenderedHeaderCell - should refactor out?
  normaliseDragChange(e) {
    let t = e;
    return this.gos.get("enableRtl") ? this.pinned !== "left" && (t *= -1) : this.pinned === "right" && (t *= -1), t;
  }
  destroy() {
    super.destroy(), this.resizeCols = void 0, this.resizeRatios = void 0, this.resizeTakeFromCols = void 0, this.resizeTakeFromRatios = void 0;
  }
}, lR = class extends R {
  constructor(e, t, s, i, r) {
    super(), this.pinned = e, this.column = t, this.eResize = s, this.comp = i, this.ctrl = r;
  }
  postConstruct() {
    const e = [];
    let t, s;
    const i = () => {
      if (O(this.eResize, t), !t)
        return;
      const { horizontalResizeSvc: o, colAutosize: a } = this.beans, l = o.addResizeBar({
        eResizeBar: this.eResize,
        onResizeStart: this.onResizeStart.bind(this),
        onResizing: this.onResizing.bind(this, !1),
        onResizeEnd: this.onResizing.bind(this, !0)
      });
      e.push(l), s && a && e.push(a.addColumnAutosize(this.eResize, this.column));
    }, r = () => {
      e.forEach((o) => o()), e.length = 0;
    }, n = () => {
      const o = this.column.isResizable(), a = !this.gos.get("suppressAutoSize") && !this.column.getColDef().suppressAutoSize;
      (o !== t || a !== s) && (t = o, s = a, r(), i());
    };
    n(), this.addDestroyFunc(r), this.ctrl.setRefreshFunction("resize", n);
  }
  onResizing(e, t) {
    const { column: s, lastResizeAmount: i, resizeStartWidth: r, beans: n } = this, o = this.normaliseResizeAmount(t), a = r + o, l = [{ key: s, newWidth: a }], { pinnedCols: c, ctrlsSvc: d, colResize: h } = n;
    if (this.column.getPinned()) {
      const u = (c == null ? void 0 : c.leftWidth) ?? 0, g = (c == null ? void 0 : c.rightWidth) ?? 0, p = hr(d.getGridBodyCtrl().eBodyViewport) - 50;
      if (u + g + (o - i) > p)
        return;
    }
    this.lastResizeAmount = o, h == null || h.setColumnWidths(l, this.resizeWithShiftKey, e, "uiColumnResized"), e && this.toggleColumnResizing(!1);
  }
  onResizeStart(e) {
    this.resizeStartWidth = this.column.getActualWidth(), this.lastResizeAmount = 0, this.resizeWithShiftKey = e, this.toggleColumnResizing(!0);
  }
  toggleColumnResizing(e) {
    this.column.resizing = e, this.comp.toggleCss("ag-column-resizing", e);
  }
  // optionally inverts the drag, depending on pinned and RTL
  // note - this method is duplicated in RenderedHeaderGroupCell - should refactor out?
  normaliseResizeAmount(e) {
    let t = e;
    const s = this.pinned !== "left", i = this.pinned === "right";
    return this.gos.get("enableRtl") ? s && (t *= -1) : i && (t *= -1), t;
  }
}, cR = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colResize";
  }
  setColumnWidths(e, t, s, i) {
    const r = [], { colModel: n, gos: o, visibleCols: a } = this.beans;
    e.forEach((l) => {
      const c = n.getColDefCol(l.key) || n.getCol(l.key);
      if (!c)
        return;
      if (r.push({
        width: l.newWidth,
        ratios: [1],
        columns: [c]
      }), o.get("colResizeDefault") === "shift" && (t = !t), t) {
        const h = a.getColAfter(c);
        if (!h)
          return;
        const u = c.getActualWidth() - l.newWidth, g = h.getActualWidth() + u;
        r.push({
          width: g,
          ratios: [1],
          columns: [h]
        });
      }
    }), r.length !== 0 && this.resizeColumnSets({
      resizeSets: r,
      finished: s,
      source: i
    });
  }
  // method takes sets of columns and resizes them. either all sets will be resized, or nothing
  // be resized. this is used for example when user tries to resize a group and holds shift key,
  // then both the current group (grows), and the adjacent group (shrinks), will get resized,
  // so that's two sets for this method.
  resizeColumnSets(e) {
    const { resizeSets: t, finished: s, source: i } = e;
    if (!(!t || t.every((d) => dR(d)))) {
      if (s) {
        const d = t && t.length > 0 ? t[0].columns : null;
        pr(this.eventSvc, d, s, i);
      }
      return;
    }
    const n = [], o = [];
    t.forEach((d) => {
      const { width: h, columns: u, ratios: g } = d, p = {}, f = {};
      u.forEach((v) => o.push(v));
      let m = !0, C = 0;
      for (; m; ) {
        if (C++, C > 1e3) {
          j(31);
          break;
        }
        m = !1;
        const v = [];
        let w = 0, b = h;
        u.forEach((P, E) => {
          if (f[P.getId()])
            b -= p[P.getId()];
          else {
            v.push(P);
            const T = g[E];
            w += T;
          }
        });
        const y = 1 / w;
        v.forEach((P, E) => {
          const M = E === v.length - 1;
          let T;
          M ? T = b : (T = Math.round(g[E] * h * y), b -= T);
          const G = P.getMinWidth(), I = P.getMaxWidth();
          T < G ? (T = G, f[P.getId()] = !0, m = !0) : I > 0 && T > I && (T = I, f[P.getId()] = !0, m = !0), p[P.getId()] = T;
        });
      }
      u.forEach((v) => {
        const w = p[v.getId()];
        v.getActualWidth() !== w && (v.setActualWidth(w, i), n.push(v));
      });
    });
    const a = n.length > 0;
    let l = [];
    if (a) {
      const { colFlex: d, visibleCols: h, colViewport: u } = this.beans;
      l = (d == null ? void 0 : d.refreshFlexedColumns({
        resizingCols: o,
        skipSetLeft: !0
      })) ?? [], h.setLeftValues(i), h.updateBodyWidths(), u.checkViewportColumns();
    }
    const c = o.concat(l);
    (a || s) && pr(this.eventSvc, c, s, i, l);
  }
  resizeHeader(e, t, s) {
    if (!e.isResizable())
      return;
    const i = e.getActualWidth(), r = e.getMinWidth(), n = e.getMaxWidth(), o = Math.min(Math.max(i + t, r), n);
    this.setColumnWidths([{ key: e, newWidth: o }], s, !0, "uiColumnResized");
  }
  createResizeFeature(e, t, s, i, r) {
    return new lR(e, t, s, i, r);
  }
  createGroupResizeFeature(e, t, s, i) {
    return new aR(e, t, s, i);
  }
};
function dR(e) {
  const { columns: t, width: s } = e;
  let i = 0, r = 0, n = !0;
  t.forEach((l) => {
    const c = l.getMinWidth();
    i += c || 0;
    const d = l.getMaxWidth();
    d > 0 ? r += d : n = !1;
  });
  const o = s >= i, a = !n || s <= r;
  return o && a;
}
var hR = {
  moduleName: "ColumnResize",
  version: B,
  beans: [cR],
  apiFunctions: {
    setColumnWidths: oR
  },
  dependsOn: [kf, Vf]
}, uR = class extends R {
  constructor(e, t) {
    super(), this.removeChildListenersFuncs = [], this.columnGroup = t, this.comp = e;
  }
  postConstruct() {
    this.addListenersToChildrenColumns(), this.addManagedListeners(this.columnGroup, {
      displayedChildrenChanged: this.onDisplayedChildrenChanged.bind(this)
    }), this.onWidthChanged(), this.addDestroyFunc(this.removeListenersOnChildrenColumns.bind(this));
  }
  addListenersToChildrenColumns() {
    this.removeListenersOnChildrenColumns();
    const e = this.onWidthChanged.bind(this);
    this.columnGroup.getLeafColumns().forEach((t) => {
      t.__addEventListener("widthChanged", e), t.__addEventListener("visibleChanged", e), this.removeChildListenersFuncs.push(() => {
        t.__removeEventListener("widthChanged", e), t.__removeEventListener("visibleChanged", e);
      });
    });
  }
  removeListenersOnChildrenColumns() {
    this.removeChildListenersFuncs.forEach((e) => e()), this.removeChildListenersFuncs = [];
  }
  onDisplayedChildrenChanged() {
    this.addListenersToChildrenColumns(), this.onWidthChanged();
  }
  onWidthChanged() {
    const e = this.columnGroup.getActualWidth();
    this.comp.setWidth(`${e}px`), this.comp.toggleCss("ag-hidden", e === 0);
  }
}, gR = class extends bd {
  constructor() {
    super(...arguments), this.onSuppressColMoveChange = () => {
      !this.isAlive() || this.isSuppressMoving() ? this.removeDragSource() : this.dragSource || this.setDragSource(this.eGui);
    };
  }
  wireComp(e, t, s, i, r) {
    const { column: n, beans: o } = this, { context: a, colNames: l, colHover: c, rangeSvc: d, colResize: h } = o;
    this.comp = e, r = Cn(this, a, r), this.setGui(t, r), this.displayName = l.getDisplayNameForColumnGroup(n, "header"), this.refreshHeaderStyles(), this.addClasses(), this.setupMovingCss(r), this.setupExpandable(r), this.setupTooltip(), this.setupAutoHeight({
      wrapperElement: i,
      compBean: r
    }), this.setupUserComp(), this.addHeaderMouseListeners(r), this.addManagedPropertyListener("groupHeaderHeight", this.refreshMaxHeaderHeight.bind(this)), this.refreshMaxHeaderHeight();
    const u = this.rowCtrl.pinned, g = n.getProvidedColumnGroup().getLeafColumns();
    c == null || c.createHoverFeature(r, g, t), d == null || d.createRangeHighlightFeature(r, n, e), r.createManagedBean(new wd(n, t, o)), r.createManagedBean(new uR(e, n)), h ? this.resizeFeature = r.createManagedBean(
      h.createGroupResizeFeature(e, s, u, n)
    ) : e.setResizableDisplayed(!1), r.createManagedBean(
      new ii(t, {
        shouldStopEventPropagation: this.shouldStopEventPropagation.bind(this),
        onTabKeyDown: () => {
        },
        handleKeyDown: this.handleKeyDown.bind(this),
        onFocusIn: this.onFocusIn.bind(this)
      })
    ), this.addHighlightListeners(r, g), r.addManagedPropertyListener("suppressMovableColumns", this.onSuppressColMoveChange), this.addResizeAndMoveKeyboardListeners(r), r.addDestroyFunc(() => this.clearComponent());
  }
  getHeaderClassParams() {
    const { column: e, beans: t } = this, s = e.getDefinition();
    return V(t.gos, {
      colDef: s,
      columnGroup: e,
      floatingFilter: !1
    });
  }
  refreshMaxHeaderHeight() {
    const { gos: e, comp: t } = this, s = e.get("groupHeaderHeight");
    s != null ? s === 0 ? t.setHeaderWrapperHidden(!0) : t.setHeaderWrapperMaxHeight(s) : (t.setHeaderWrapperHidden(!1), t.setHeaderWrapperMaxHeight(null));
  }
  addHighlightListeners(e, t) {
    if (this.beans.gos.get("suppressMoveWhenColumnDragging"))
      for (const s of t)
        e.addManagedListeners(s, {
          headerHighlightChanged: this.onLeafColumnHighlightChanged.bind(this, s)
        });
  }
  onLeafColumnHighlightChanged(e) {
    const t = this.column.getDisplayedLeafColumns(), s = t[0] === e, i = _(t) === e;
    if (!s && !i)
      return;
    const r = e.getHighlighted(), n = !!this.rowCtrl.getHeaderCellCtrls().find((l) => l.column.isMoving());
    let o = !1, a = !1;
    if (n) {
      const l = this.beans.gos.get("enableRtl"), c = r === 1, d = r === 0;
      s && (l ? a = c : o = d), i && (l ? o = d : a = c);
    }
    this.comp.toggleCss("ag-header-highlight-before", o), this.comp.toggleCss("ag-header-highlight-after", a);
  }
  resizeHeader(e, t) {
    const { resizeFeature: s } = this;
    if (!s)
      return;
    const i = s.getInitialValues(t);
    s.resizeColumns(i, i.resizeStartWidth + e, "uiColumnResized", !0);
  }
  resizeLeafColumnsToFit(e) {
    var t;
    (t = this.resizeFeature) == null || t.resizeLeafColumnsToFit(e);
  }
  setupUserComp() {
    const { colGroupSvc: e, userCompFactory: t, gos: s, enterpriseMenuFactory: i } = this.beans, r = this.column, n = r.getProvidedColumnGroup(), o = V(s, {
      displayName: this.displayName,
      columnGroup: r,
      setExpanded: (l) => {
        e.setColumnGroupOpened(n, l, "gridInitializing");
      },
      setTooltip: (l, c) => {
        s.assertModuleRegistered("Tooltip", 3), this.setupTooltip(l, c);
      },
      showColumnMenu: (l, c) => i == null ? void 0 : i.showMenuAfterButtonClick(
        n,
        l,
        "columnMenu",
        c
      ),
      showColumnMenuAfterMouseClick: (l, c) => i == null ? void 0 : i.showMenuAfterMouseEvent(
        n,
        l,
        "columnMenu",
        c
      ),
      eGridHeader: this.eGui
    }), a = Hb(t, o);
    a && this.comp.setUserCompDetails(a);
  }
  addHeaderMouseListeners(e) {
    const t = (r) => this.handleMouseOverChange(r.type === "mouseenter"), s = () => this.dispatchColumnMouseEvent("columnHeaderClicked", this.column.getProvidedColumnGroup()), i = (r) => this.handleContextMenuMouseEvent(r, void 0, this.column.getProvidedColumnGroup());
    e.addManagedListeners(this.eGui, {
      mouseenter: t,
      mouseleave: t,
      click: s,
      contextmenu: i
    });
  }
  handleMouseOverChange(e) {
    this.eventSvc.dispatchEvent({
      type: e ? "columnHeaderMouseOver" : "columnHeaderMouseLeave",
      column: this.column.getProvidedColumnGroup()
    });
  }
  setupTooltip(e, t) {
    var s;
    this.tooltipFeature = (s = this.beans.tooltipSvc) == null ? void 0 : s.setupHeaderGroupTooltip(
      this.tooltipFeature,
      this,
      e,
      t
    );
  }
  setupExpandable(e) {
    const t = this.column.getProvidedColumnGroup();
    this.refreshExpanded();
    const s = this.refreshExpanded.bind(this);
    e.addManagedListeners(t, {
      expandedChanged: s,
      expandableChanged: s
    });
  }
  refreshExpanded() {
    const { column: e } = this;
    this.expandable = e.isExpandable();
    const t = e.isExpanded();
    this.expandable ? this.comp.setAriaExpanded(t ? "true" : "false") : this.comp.setAriaExpanded(void 0), this.refreshHeaderStyles();
  }
  addClasses() {
    const { column: e } = this, t = e.getColGroupDef(), s = pd(t, this.gos, null, e);
    e.isPadding() ? (s.push("ag-header-group-cell-no-group"), e.getLeafColumns().every((r) => r.isSpanHeaderHeight()) && s.push("ag-header-span-height")) : (s.push("ag-header-group-cell-with-group"), t != null && t.wrapHeaderText && s.push("ag-header-cell-wrap-text")), s.forEach((i) => this.comp.toggleCss(i, !0));
  }
  setupMovingCss(e) {
    const { column: t } = this, i = t.getProvidedColumnGroup().getLeafColumns(), r = () => this.comp.toggleCss("ag-header-cell-moving", t.isMoving());
    i.forEach((n) => {
      e.addManagedListeners(n, { movingChanged: r });
    }), r();
  }
  onFocusIn(e) {
    this.eGui.contains(e.relatedTarget) || this.focusThis();
  }
  handleKeyDown(e) {
    super.handleKeyDown(e);
    const t = this.getWrapperHasFocus();
    if (!(!this.expandable || !t) && e.key === S.ENTER) {
      const s = this.column, i = !s.isExpanded();
      this.beans.colGroupSvc.setColumnGroupOpened(
        s.getProvidedColumnGroup(),
        i,
        "uiColumnExpanded"
      );
    }
  }
  // unlike columns, this will only get called once, as we don't react on props on column groups
  // (we will always destroy and recreate this comp if something changes)
  setDragSource(e) {
    var t;
    !this.isAlive() || this.isSuppressMoving() || (this.removeDragSource(), e && (this.dragSource = ((t = this.beans.colMoves) == null ? void 0 : t.setDragSourceForHeader(e, this.column, this.displayName)) ?? null));
  }
  isSuppressMoving() {
    return this.gos.get("suppressMovableColumns") || this.column.getLeafColumns().some((e) => e.getColDef().suppressMovable || e.getColDef().lockPosition);
  }
  destroy() {
    this.tooltipFeature = this.destroyBean(this.tooltipFeature), super.destroy();
  }
};
function pR(e, t, s) {
  var i;
  (i = e.colGroupSvc) == null || i.setColumnGroupOpened(t, s, "api");
}
function fR(e, t, s) {
  var i;
  return ((i = e.colGroupSvc) == null ? void 0 : i.getColumnGroup(t, s)) ?? null;
}
function mR(e, t) {
  var s;
  return ((s = e.colGroupSvc) == null ? void 0 : s.getProvidedColGroup(t)) ?? null;
}
function CR(e, t, s) {
  return e.colNames.getDisplayNameForColumnGroup(t, s) || "";
}
function vR(e) {
  var t;
  return ((t = e.colGroupSvc) == null ? void 0 : t.getColumnGroupState()) ?? [];
}
function wR(e, t) {
  var s;
  (s = e.colGroupSvc) == null || s.setColumnGroupState(t, "api");
}
function bR(e) {
  var t;
  (t = e.colGroupSvc) == null || t.resetColumnGroupState("api");
}
function yR(e) {
  return e.visibleCols.treeLeft;
}
function SR(e) {
  return e.visibleCols.treeCenter;
}
function xR(e) {
  return e.visibleCols.treeRight;
}
function FR(e) {
  return e.visibleCols.getAllTrees();
}
function RR(e, t) {
  for (let s = 0; s < t.length; s++) {
    const i = e.indexOf(t[s]);
    i >= 0 && (e[i] = e[e.length - 1], e.pop());
  }
}
var PR = class extends R {
  constructor() {
    super(...arguments), this.beanName = "visibleCols", this.colsAndGroupsMap = {}, this.leftCols = [], this.rightCols = [], this.centerCols = [], this.allCols = [], this.headerGroupRowCount = 0, this.bodyWidth = 0, this.leftWidth = 0, this.rightWidth = 0, this.isBodyWidthDirty = !0;
  }
  refresh(e, t = !1) {
    const { colFlex: s, colModel: i, colGroupSvc: r, colViewport: n, selectionColSvc: o } = this.beans;
    t || this.buildTrees(i, r), r == null || r.updateOpenClosedVisibility(), this.leftCols = cl(this.treeLeft), this.centerCols = cl(this.treeCenter), this.rightCols = cl(this.treeRight), o == null || o.refreshVisibility(this.leftCols, this.centerCols, this.rightCols), this.joinColsAriaOrder(i), this.joinCols(), this.headerGroupRowCount = this.getHeaderRowCount(), this.setLeftValues(e), this.autoHeightCols = this.allCols.filter((a) => a.isAutoHeight()), s == null || s.refreshFlexedColumns(), this.updateBodyWidths(), this.setFirstRightAndLastLeftPinned(i, this.leftCols, this.rightCols, e), n.checkViewportColumns(!1), this.eventSvc.dispatchEvent({
      type: "displayedColumnsChanged",
      source: e
    });
  }
  getHeaderRowCount() {
    if (!this.gos.get("hidePaddedHeaderRows"))
      return this.beans.colModel.cols.treeDepth;
    let e = 0;
    for (const t of this.allCols) {
      let s = t.getParent();
      for (; s; ) {
        if (!s.isPadding()) {
          const i = s.getProvidedColumnGroup().getLevel() + 1;
          i > e && (e = i);
          break;
        }
        s = s.getParent();
      }
    }
    return e;
  }
  // after setColumnWidth or updateGroupsAndPresentedCols
  updateBodyWidths() {
    const e = fs(this.centerCols), t = fs(this.leftCols), s = fs(this.rightCols);
    this.isBodyWidthDirty = this.bodyWidth !== e, (this.bodyWidth !== e || this.leftWidth !== t || this.rightWidth !== s) && (this.bodyWidth = e, this.leftWidth = t, this.rightWidth = s, this.eventSvc.dispatchEvent({
      type: "columnContainerWidthChanged"
    }), this.eventSvc.dispatchEvent({
      type: "displayedColumnsWidthChanged"
    }));
  }
  // sets the left pixel position of each column
  setLeftValues(e) {
    this.setLeftValuesOfCols(e), this.setLeftValuesOfGroups();
  }
  setFirstRightAndLastLeftPinned(e, t, s, i) {
    let r, n;
    this.gos.get("enableRtl") ? (r = t ? t[0] : null, n = s ? _(s) : null) : (r = t ? _(t) : null, n = s ? s[0] : null), e.getCols().forEach((o) => {
      o.setLastLeftPinned(o === r, i), o.setFirstRightPinned(o === n, i);
    });
  }
  buildTrees(e, t) {
    const s = e.getColsToShow(), i = s.filter((l) => l.getPinned() == "left"), r = s.filter((l) => l.getPinned() == "right"), n = s.filter((l) => l.getPinned() != "left" && l.getPinned() != "right"), o = new xp(), a = (l) => t ? t.createColumnGroups(l) : l.columns;
    this.treeLeft = a({
      columns: i,
      idCreator: o,
      pinned: "left",
      oldDisplayedGroups: this.treeLeft
    }), this.treeRight = a({
      columns: r,
      idCreator: o,
      pinned: "right",
      oldDisplayedGroups: this.treeRight
    }), this.treeCenter = a({
      columns: n,
      idCreator: o,
      pinned: null,
      oldDisplayedGroups: this.treeCenter
    }), this.updateColsAndGroupsMap();
  }
  clear() {
    this.leftCols = [], this.rightCols = [], this.centerCols = [], this.allCols = [], this.ariaOrderColumns = [];
  }
  joinColsAriaOrder(e) {
    const t = e.getCols(), s = [], i = [], r = [];
    for (const n of t) {
      const o = n.getPinned();
      o ? o === !0 || o === "left" ? s.push(n) : r.push(n) : i.push(n);
    }
    this.ariaOrderColumns = s.concat(i).concat(r);
  }
  getAriaColIndex(e) {
    let t;
    return we(e) ? t = e.getLeafColumns()[0] : t = e, this.ariaOrderColumns.indexOf(t) + 1;
  }
  setLeftValuesOfGroups() {
    [this.treeLeft, this.treeRight, this.treeCenter].forEach((e) => {
      e.forEach((t) => {
        we(t) && t.checkLeft();
      });
    });
  }
  setLeftValuesOfCols(e) {
    const { colModel: t } = this.beans;
    if (!t.getColDefCols())
      return;
    const i = t.getCols().slice(0), r = this.gos.get("enableRtl");
    [this.leftCols, this.rightCols, this.centerCols].forEach((n) => {
      if (r) {
        let o = fs(n);
        n.forEach((a) => {
          o -= a.getActualWidth(), a.setLeft(o, e);
        });
      } else {
        let o = 0;
        n.forEach((a) => {
          a.setLeft(o, e), o += a.getActualWidth();
        });
      }
      RR(i, n);
    }), i.forEach((n) => {
      n.setLeft(null, e);
    });
  }
  joinCols() {
    this.gos.get("enableRtl") ? this.allCols = this.rightCols.concat(this.centerCols).concat(this.leftCols) : this.allCols = this.leftCols.concat(this.centerCols).concat(this.rightCols);
  }
  getAllTrees() {
    return this.treeLeft && this.treeRight && this.treeCenter ? this.treeLeft.concat(this.treeCenter).concat(this.treeRight) : null;
  }
  // gridPanel -> ensureColumnVisible
  isColDisplayed(e) {
    return this.allCols.indexOf(e) >= 0;
  }
  getLeftColsForRow(e) {
    const {
      leftCols: t,
      beans: { colModel: s }
    } = this;
    return s.colSpanActive ? this.getColsForRow(e, t) : t;
  }
  getRightColsForRow(e) {
    const {
      rightCols: t,
      beans: { colModel: s }
    } = this;
    return s.colSpanActive ? this.getColsForRow(e, t) : t;
  }
  getColsForRow(e, t, s, i) {
    const r = [];
    let n = null;
    for (let o = 0; o < t.length; o++) {
      const a = t[o], l = t.length - o, c = Math.min(a.getColSpan(e), l), d = [a];
      if (c > 1) {
        const u = c - 1;
        for (let g = 1; g <= u; g++)
          d.push(t[o + g]);
        o += u;
      }
      let h;
      s ? (h = !1, d.forEach((u) => {
        s(u) && (h = !0);
      })) : h = !0, h && (r.length === 0 && n && (i && i(a)) && r.push(n), r.push(a)), n = a;
    }
    return r;
  }
  getContainerWidth(e) {
    switch (e) {
      case "left":
        return this.leftWidth;
      case "right":
        return this.rightWidth;
      default:
        return this.bodyWidth;
    }
  }
  getColBefore(e) {
    const t = this.allCols, s = t.indexOf(e);
    return s > 0 ? t[s - 1] : null;
  }
  isPinningLeft() {
    return this.leftCols.length > 0;
  }
  isPinningRight() {
    return this.rightCols.length > 0;
  }
  updateColsAndGroupsMap() {
    this.colsAndGroupsMap = {};
    const e = (t) => {
      this.colsAndGroupsMap[t.getUniqueId()] = t;
    };
    bi(this.treeCenter, !1, e), bi(this.treeLeft, !1, e), bi(this.treeRight, !1, e);
  }
  isVisible(e) {
    return this.colsAndGroupsMap[e.getUniqueId()] === e;
  }
  getFirstColumn() {
    const e = this.gos.get("enableRtl"), t = ["leftCols", "centerCols", "rightCols"];
    e && t.reverse();
    for (let s = 0; s < t.length; s++) {
      const i = this[t[s]];
      if (i.length)
        return e ? _(i) : i[0];
    }
    return null;
  }
  // used by:
  // + rowRenderer -> for navigation
  getColAfter(e) {
    const t = this.allCols, s = t.indexOf(e);
    return s < t.length - 1 ? t[s + 1] : null;
  }
  // used by:
  // + angularGrid -> setting pinned body width
  // note: this should be cached
  getColsLeftWidth() {
    return fs(this.leftCols);
  }
  // note: this should be cached
  getDisplayedColumnsRightWidth() {
    return fs(this.rightCols);
  }
  isColAtEdge(e, t) {
    const s = this.allCols;
    if (!s.length)
      return !1;
    const i = t === "first";
    let r;
    if (we(e)) {
      const n = e.getDisplayedLeafColumns();
      if (!n.length)
        return !1;
      r = i ? n[0] : _(n);
    } else
      r = e;
    return (i ? s[0] : _(s)) === r;
  }
};
function bi(e, t, s) {
  if (e)
    for (let i = 0; i < e.length; i++) {
      const r = e[i];
      if (we(r)) {
        const n = t ? r.getDisplayedChildren() : r.getChildren();
        bi(n, t, s);
      }
      s(r);
    }
}
function cl(e) {
  const t = [];
  return bi(e, !0, (s) => {
    ts(s) && t.push(s);
  }), t;
}
var ER = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colGroupSvc";
  }
  getColumnGroupState() {
    const e = [], t = this.beans.colModel.getColTree();
    return Qt(null, t, (s) => {
      oe(s) && e.push({
        groupId: s.getGroupId(),
        open: s.isExpanded()
      });
    }), e;
  }
  resetColumnGroupState(e) {
    const t = this.beans.colModel.getColDefColTree();
    if (!t)
      return;
    const s = [];
    Qt(null, t, (i) => {
      if (oe(i)) {
        const r = i.getColGroupDef(), n = {
          groupId: i.getGroupId(),
          open: r ? r.openByDefault : void 0
        };
        s.push(n);
      }
    }), this.setColumnGroupState(s, e);
  }
  setColumnGroupState(e, t) {
    const { colModel: s, colAnimation: i, visibleCols: r, eventSvc: n } = this.beans;
    if (!s.getColTree().length)
      return;
    i == null || i.start();
    const a = [];
    e.forEach((l) => {
      const c = l.groupId, d = l.open, h = this.getProvidedColGroup(c);
      h && h.isExpanded() !== d && (h.setExpanded(d), a.push(h));
    }), r.refresh(t, !0), a.length && n.dispatchEvent({
      type: "columnGroupOpened",
      columnGroup: a.length === 1 ? a[0] : void 0,
      columnGroups: a
    }), i == null || i.finish();
  }
  // called by headerRenderer - when a header is opened or closed
  setColumnGroupOpened(e, t, s) {
    let i;
    oe(e) ? i = e.getId() : i = e || "", this.setColumnGroupState([{ groupId: i, open: t }], s);
  }
  getProvidedColGroup(e) {
    let t = null;
    return Qt(null, this.beans.colModel.getColTree(), (s) => {
      oe(s) && s.getId() === e && (t = s);
    }), t;
  }
  getGroupAtDirection(e, t) {
    const s = e.getProvidedColumnGroup().getLevel() + e.getPaddingLevel(), i = e.getDisplayedLeafColumns(), r = t === "After" ? _(i) : i[0], n = `getCol${t}`;
    for (; ; ) {
      const o = this.beans.visibleCols[n](r);
      if (!o)
        return null;
      const a = this.getColGroupAtLevel(o, s);
      if (a !== e)
        return a;
    }
  }
  getColGroupAtLevel(e, t) {
    let s = e.getParent(), i, r;
    for (; i = s.getProvidedColumnGroup().getLevel(), r = s.getPaddingLevel(), !(i + r <= t); )
      s = s.getParent();
    return s;
  }
  updateOpenClosedVisibility() {
    const e = this.beans.visibleCols.getAllTrees();
    bi(e, !1, (t) => {
      we(t) && t.calculateDisplayedColumns();
    });
  }
  // returns the group with matching colId and instanceId. If instanceId is missing,
  // matches only on the colId.
  getColumnGroup(e, t) {
    if (!e)
      return null;
    if (we(e))
      return e;
    const s = this.beans.visibleCols.getAllTrees(), i = typeof t == "number";
    let r = null;
    return bi(s, !1, (n) => {
      if (we(n)) {
        const o = n;
        let a;
        i ? a = e === o.getGroupId() && t === o.getPartId() : a = e === o.getGroupId(), a && (r = o);
      }
    }), r;
  }
  createColumnGroups(e) {
    const { columns: t, idCreator: s, pinned: i, oldDisplayedGroups: r, isStandaloneStructure: n } = e, o = this.mapOldGroupsById(r), a = [];
    let l = t;
    for (; l.length; ) {
      const c = l;
      l = [];
      let d = 0;
      const h = (u) => {
        const g = d;
        d = u;
        const p = c[g], m = (we(p) ? p.getProvidedColumnGroup() : p).getOriginalParent();
        if (m == null) {
          for (let v = g; v < u; v++)
            a.push(c[v]);
          return;
        }
        const C = this.createColumnGroup(
          m,
          s,
          o,
          i,
          n
        );
        for (let v = g; v < u; v++)
          C.addChild(c[v]);
        l.push(C);
      };
      for (let u = 1; u < c.length; u++) {
        const g = c[u], f = (we(g) ? g.getProvidedColumnGroup() : g).getOriginalParent(), m = c[d], v = (we(m) ? m.getProvidedColumnGroup() : m).getOriginalParent();
        f !== v && h(u);
      }
      d < c.length && h(c.length);
    }
    return n || this.setupParentsIntoCols(a, null), a;
  }
  createProvidedColumnGroup(e, t, s, i, r, n, o) {
    const a = r.getUniqueKey(t.groupId || null, null), l = _l(this.beans, t, a), c = new ir(l, a, !1, s);
    this.createBean(c);
    const d = this.findExistingGroup(t, n);
    d && n.splice(d.idx, 1);
    const h = d == null ? void 0 : d.group;
    h && c.setExpanded(h.isExpanded());
    const u = hp(
      this.beans,
      l.children,
      s + 1,
      e,
      i,
      r,
      n,
      o
    );
    return c.setChildren(u), c;
  }
  balanceColumnTree(e, t, s, i) {
    const r = [];
    for (let n = 0; n < e.length; n++) {
      const o = e[n];
      if (oe(o)) {
        const a = o, l = this.balanceColumnTree(
          a.getChildren(),
          t + 1,
          s,
          i
        );
        a.setChildren(l), r.push(a);
      } else {
        let a, l;
        for (let c = t; c < s; c++) {
          const d = i.getUniqueKey(null, null), h = _l(this.beans, null, d), u = new ir(h, d, !0, c);
          this.createBean(u), l && l.setChildren([u]), l = u, a || (a = l);
        }
        if (a && l)
          if (r.push(a), e.some((d) => oe(d))) {
            l.setChildren([o]);
            continue;
          } else {
            l.setChildren(e);
            break;
          }
        r.push(o);
      }
    }
    return r;
  }
  findDepth(e) {
    let t = 0, s = e;
    for (; s && s[0] && oe(s[0]); )
      t++, s = s[0].getChildren();
    return t;
  }
  findMaxDepth(e, t) {
    let s = t;
    for (let i = 0; i < e.length; i++) {
      const r = e[i];
      if (oe(r)) {
        const n = r, o = this.findMaxDepth(n.getChildren(), t + 1);
        s < o && (s = o);
      }
    }
    return s;
  }
  /**
   * Inserts dummy group columns in the hierarchy above auto-generated columns
   * in order to ensure auto-generated columns are leaf nodes (and therefore are
   * displayed correctly)
   */
  balanceTreeForAutoCols(e, t) {
    const s = [];
    return e.forEach((i) => {
      let r = i;
      for (let n = t - 1; n >= 0; n--) {
        const o = new ir(null, `FAKE_PATH_${i.getId()}}_${n}`, !0, n);
        this.createBean(o), o.setChildren([r]), r.originalParent = o, r = o;
      }
      t === 0 && (i.originalParent = null), s.push(r);
    }), s;
  }
  findExistingGroup(e, t) {
    if (e.groupId != null)
      for (let i = 0; i < t.length; i++) {
        const r = t[i];
        if (r.getColGroupDef() && r.getId() === e.groupId)
          return { idx: i, group: r };
      }
  }
  createColumnGroup(e, t, s, i, r) {
    const n = e.getGroupId(), o = t.getInstanceIdForKey(n), a = jp(n, o);
    let l = s[a];
    return l && l.getProvidedColumnGroup() !== e && (l = null), A(l) ? l.reset() : (l = new an(e, n, o, i), r || this.createBean(l)), l;
  }
  // returns back a 2d map of ColumnGroup as follows: groupId -> instanceId -> ColumnGroup
  mapOldGroupsById(e) {
    const t = {}, s = (i) => {
      i.forEach((r) => {
        if (we(r)) {
          const n = r;
          t[r.getUniqueId()] = n, s(n.getChildren());
        }
      });
    };
    return e && s(e), t;
  }
  setupParentsIntoCols(e, t) {
    e.forEach((s) => {
      if (s.parent !== t && (this.beans.colViewport.colsWithinViewportHash = ""), s.parent = t, we(s)) {
        const i = s;
        this.setupParentsIntoCols(i.getChildren(), i);
      }
    });
  }
}, Bf = {
  moduleName: "ColumnGroup",
  version: B,
  dynamicBeans: { headerGroupCellCtrl: gR },
  beans: [ER],
  apiFunctions: {
    getAllDisplayedColumnGroups: FR,
    getCenterDisplayedColumnGroups: SR,
    getColumnGroup: fR,
    getColumnGroupState: vR,
    getDisplayNameForColumnGroup: CR,
    getLeftDisplayedColumnGroups: yR,
    getProvidedColumnGroup: mR,
    getRightDisplayedColumnGroups: xR,
    resetColumnGroupState: bR,
    setColumnGroupOpened: pR,
    setColumnGroupState: wR
  }
}, TR = { tag: "div", cls: "ag-skeleton-container" }, MR = class extends D {
  constructor() {
    super(TR);
  }
  init(e) {
    const t = `ag-cell-skeleton-renderer-${this.getCompId()}`;
    this.getGui().setAttribute("id", t), this.addDestroyFunc(() => Js(e.eParentOfValue)), Js(e.eParentOfValue, t), e.deferRender ? this.setupLoading(e) : e.node.failedLoad ? this.setupFailed() : this.setupLoading(e);
  }
  setupFailed() {
    const e = this.getLocaleTextFunc();
    this.getGui().textContent = e("loadingError", "ERR");
    const t = e("ariaSkeletonCellLoadingFailed", "Row failed to load");
    re(this.getGui(), t);
  }
  setupLoading(e) {
    const t = K({
      tag: "div",
      cls: "ag-skeleton-effect"
    }), s = e.node.rowIndex;
    if (s != null) {
      const n = 75 + 25 * (s % 2 === 0 ? Math.sin(s) : Math.cos(s));
      t.style.width = `${n}%`;
    }
    this.getGui().appendChild(t);
    const i = this.getLocaleTextFunc(), r = e.deferRender ? i("ariaDeferSkeletonCellLoading", "Cell is loading") : i("ariaSkeletonCellLoading", "Row data is loading");
    re(this.getGui(), r);
  }
  refresh(e) {
    return !1;
  }
}, DR = {
  moduleName: "CheckboxCellRenderer",
  version: B,
  userComponents: {
    agCheckboxCellRenderer: Rx
  }
}, AR = {
  moduleName: "SkeletonCellRenderer",
  version: B,
  userComponents: {
    agSkeletonCellRenderer: MR
  }
};
function IR(e, t) {
  const s = e.colModel.getColDefCol(t);
  return s ? s.getColDef() : null;
}
function LR(e) {
  return e.colModel.getColumnDefs();
}
function kR(e, t, s) {
  return e.colNames.getDisplayNameForColumn(t, s) || "";
}
function GR(e, t) {
  return e.colModel.getColDefCol(t);
}
function OR(e) {
  return e.colModel.getColDefCols();
}
function VR(e, t) {
  return je(e, t, "api");
}
function BR(e) {
  return To(e);
}
function NR(e) {
  bp(e, "api");
}
function HR(e) {
  return e.visibleCols.isPinningLeft() || e.visibleCols.isPinningRight();
}
function zR(e) {
  return e.visibleCols.isPinningLeft();
}
function WR(e) {
  return e.visibleCols.isPinningRight();
}
function _R(e, t) {
  return e.visibleCols.getColAfter(t);
}
function UR(e, t) {
  return e.visibleCols.getColBefore(t);
}
function $R(e, t, s) {
  e.colModel.setColsVisible(t, s, "api");
}
function KR(e, t, s) {
  var i;
  (i = e.pinnedCols) == null || i.setColsPinned(t, s, "api");
}
function jR(e) {
  return e.colModel.getCols();
}
function YR(e) {
  return e.visibleCols.leftCols;
}
function qR(e) {
  return e.visibleCols.centerCols;
}
function XR(e) {
  return e.visibleCols.rightCols;
}
function ZR(e) {
  return e.visibleCols.allCols;
}
function QR(e) {
  return e.colViewport.getViewportColumns();
}
function oc(e, t) {
  if (!e)
    return;
  const s = e, i = {};
  return Object.keys(s).forEach((r) => {
    if (t && t.indexOf(r) >= 0 || $g.has(r))
      return;
    const n = s[r];
    typeof n == "object" && n !== null && n.constructor === Object ? i[r] = oc(n) : i[r] = n;
  }), i;
}
var JR = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colDefFactory";
  }
  wireBeans(e) {
    this.rowGroupColsSvc = e.rowGroupColsSvc, this.pivotColsSvc = e.pivotColsSvc;
  }
  getColumnDefs(e, t, s, i) {
    var a, l;
    const r = e.slice();
    t ? r.sort((c, d) => s.indexOf(c) - s.indexOf(d)) : s && r.sort((c, d) => i.indexOf(c) - i.indexOf(d));
    const n = (a = this.rowGroupColsSvc) == null ? void 0 : a.columns, o = (l = this.pivotColsSvc) == null ? void 0 : l.columns;
    return this.buildColumnDefs(r, n, o);
  }
  buildColumnDefs(e, t = [], s = []) {
    const i = [], r = {};
    return e.forEach((n) => {
      const o = this.createDefFromColumn(n, t, s);
      let a = !0, l = o, c = n.getOriginalParent(), d = null;
      for (; c; ) {
        let h = null;
        if (c.isPadding()) {
          c = c.getOriginalParent();
          continue;
        }
        const u = r[c.getGroupId()];
        if (u) {
          u.children.push(l), a = !1;
          break;
        }
        if (h = this.createDefFromGroup(c), h && (h.children = [l], r[h.groupId] = h, l = h, c = c.getOriginalParent()), c != null && d === c) {
          a = !1;
          break;
        }
        d = c;
      }
      a && i.push(l);
    }), i;
  }
  createDefFromGroup(e) {
    const t = oc(e.getColGroupDef(), ["children"]);
    return t && (t.groupId = e.getGroupId()), t;
  }
  createDefFromColumn(e, t, s) {
    const i = oc(e.getColDef());
    return i.colId = e.getColId(), i.width = e.getActualWidth(), i.rowGroup = e.isRowGroupActive(), i.rowGroupIndex = e.isRowGroupActive() ? t.indexOf(e) : null, i.pivot = e.isPivotActive(), i.pivotIndex = e.isPivotActive() ? s.indexOf(e) : null, i.aggFunc = e.isValueActive() ? e.getAggFunc() : null, i.hide = e.isVisible() ? void 0 : !0, i.pinned = e.isPinned() ? e.getPinned() : null, i.sort = e.getSort() ? e.getSort() : null, i.sortIndex = e.getSortIndex() != null ? e.getSortIndex() : null, i;
  }
}, eP = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colFlex";
  }
  refreshFlexedColumns(e = {}) {
    const t = e.source ?? "flex";
    e.viewportWidth != null && (this.flexViewportWidth = e.viewportWidth);
    const s = this.flexViewportWidth, { visibleCols: i, colDelayRenderSvc: r } = this.beans, n = i.centerCols;
    let o = -1;
    if (e.resizingCols) {
      const f = new Set(e.resizingCols);
      for (let m = n.length - 1; m >= 0; m--)
        if (f.has(n[m])) {
          o = m;
          break;
        }
    }
    let a = !1;
    const l = n.map((f, m) => {
      const C = f.getFlex(), v = C != null && C > 0 && m > o;
      return a || (a = v), {
        col: f,
        isFlex: v,
        flex: Math.max(0, C ?? 0),
        initialSize: f.getActualWidth(),
        min: f.getMinWidth(),
        max: f.getMaxWidth(),
        targetSize: 0
      };
    });
    if (a && (r == null || r.hideColumns("colFlex")), !s || !a)
      return [];
    let c = l.length, d = l.reduce((f, m) => f + m.flex, 0), h = s;
    const u = (f, m) => {
      f.frozenSize = m, f.col.setActualWidth(m, t), h -= m, d -= f.flex, c -= 1;
    }, g = (f) => f.frozenSize != null;
    for (const f of l)
      f.isFlex || u(f, f.initialSize);
    for (; c > 0; ) {
      const f = Math.round(d < 1 ? h * d : h);
      let m, C = 0, v = 0;
      for (const y of l) {
        if (g(y))
          continue;
        m = y, v += f * (y.flex / d);
        const P = v - C, E = Math.round(P);
        y.targetSize = E, C += E;
      }
      m && (m.targetSize += f - C);
      let w = 0;
      for (const y of l) {
        if (g(y))
          continue;
        const P = y.targetSize, E = Math.min(Math.max(P, y.min), y.max);
        w += E - P, y.violationType = E === P ? void 0 : E < P ? "max" : "min", y.targetSize = E;
      }
      const b = w === 0 ? "all" : w > 0 ? "min" : "max";
      for (const y of l)
        g(y) || (b === "all" || y.violationType === b) && u(y, y.targetSize);
    }
    e.skipSetLeft || i.setLeftValues(t), e.updateBodyWidths && i.updateBodyWidths();
    const p = l.filter((f) => f.isFlex && !f.violationType).map((f) => f.col);
    if (e.fireResizedEvent) {
      const f = l.filter((C) => C.initialSize !== C.frozenSize).map((C) => C.col), m = l.filter((C) => C.flex).map((C) => C.col);
      pr(this.eventSvc, f, !0, t, m);
    }
    return r == null || r.revealColumns("colFlex"), p;
  }
  initCol(e) {
    const { flex: t, initialFlex: s } = e.colDef;
    t !== void 0 ? e.flex = t : s !== void 0 && (e.flex = s);
  }
  // this method should only be used by the colModel to
  // change flex when required by the applyColumnState method.
  setColFlex(e, t) {
    e.flex = t ?? null, e.dispatchStateUpdatedEvent("flex");
  }
};
function Kr(e, t, s) {
  if (!t || !e)
    return;
  if (!s)
    return e[t];
  const i = t.split(".");
  let r = e;
  for (let n = 0; n < i.length; n++) {
    if (r == null)
      return;
    r = r[i[n]];
  }
  return r;
}
var tP = [
  "dateTimeString",
  "dateString",
  "text",
  "number",
  "boolean",
  "date"
], sP = class extends R {
  constructor() {
    super(...arguments), this.beanName = "dataTypeSvc", this.dataTypeDefinitions = {}, this.isPendingInference = !1, this.isColumnTypeOverrideInDataTypeDefinitions = !1, this.columnStateUpdatesPendingInference = {}, this.columnStateUpdateListenerDestroyFuncs = [], this.columnDefinitionPropsPerDataType = {
      number() {
        return { cellEditor: "agNumberCellEditor" };
      },
      boolean() {
        return {
          cellEditor: "agCheckboxCellEditor",
          cellRenderer: "agCheckboxCellRenderer",
          getFindText: () => null,
          suppressKeyboardEvent: (e) => !!e.colDef.editable && e.event.key === S.SPACE
        };
      },
      date({ formatValue: e }) {
        return { cellEditor: "agDateCellEditor", keyCreator: e };
      },
      dateString({ formatValue: e }) {
        return { cellEditor: "agDateStringCellEditor", keyCreator: e };
      },
      dateTime(e) {
        return this.date(e);
      },
      dateTimeString(e) {
        return this.dateString(e);
      },
      object({ formatValue: e, colModel: t, colId: s }) {
        return {
          cellEditorParams: {
            useFormatter: !0
          },
          comparator: (i, r) => {
            const n = t.getColDefCol(s), o = n == null ? void 0 : n.getColDef();
            if (!n || !o)
              return 0;
            const a = i == null ? "" : e({ column: n, node: null, value: i }), l = r == null ? "" : e({ column: n, node: null, value: r });
            return a === l ? 0 : a > l ? 1 : -1;
          },
          keyCreator: e
        };
      },
      text() {
        return {};
      }
    };
  }
  wireBeans(e) {
    this.colModel = e.colModel;
  }
  postConstruct() {
    this.processDataTypeDefinitions(), this.addManagedPropertyListener("dataTypeDefinitions", (e) => {
      this.processDataTypeDefinitions(), this.colModel.recreateColumnDefs(e);
    });
  }
  processDataTypeDefinitions() {
    const e = this.getDefaultDataTypes(), t = {}, s = {}, i = (d) => (h) => {
      const { column: u, node: g, value: p } = h;
      let f = u.getColDef().valueFormatter;
      return f === d.groupSafeValueFormatter && (f = d.valueFormatter), this.beans.valueSvc.formatValue(u, g, p, f);
    };
    for (const d of Object.keys(e)) {
      const h = e[d], u = {
        ...h,
        groupSafeValueFormatter: Zh(h, this.gos)
      };
      t[d] = u, s[d] = i(u);
    }
    const r = this.gos.get("dataTypeDefinitions") ?? {}, n = {};
    for (const d of Object.keys(r)) {
      const h = r[d], u = this.processDataTypeDefinition(
        h,
        r,
        [d],
        e
      );
      u && (t[d] = u, h.dataTypeMatcher && (n[d] = h.dataTypeMatcher), s[d] = i(u));
    }
    const { valueParser: o, valueFormatter: a } = e.object, { valueParser: l, valueFormatter: c } = t.object;
    this.hasObjectValueParser = l !== o, this.hasObjectValueFormatter = c !== a, this.formatValueFuncs = s, this.dataTypeDefinitions = t, this.dataTypeMatchers = this.sortKeysInMatchers(n, e);
  }
  /**
   * Sorts the keys in the matchers object.
   * Does not mutate the original object, creates a copy of it with sorted keys instead.
   */
  sortKeysInMatchers(e, t) {
    const s = { ...e };
    for (const i of tP)
      delete s[i], s[i] = e[i] ?? t[i].dataTypeMatcher;
    return s;
  }
  processDataTypeDefinition(e, t, s, i) {
    let r;
    const n = e.extendsDataType;
    if (e.columnTypes && (this.isColumnTypeOverrideInDataTypeDefinitions = !0), e.extendsDataType === e.baseDataType) {
      let o = i[n];
      const a = t[n];
      if (o && a && (o = a), !Xh(e, o, n))
        return;
      r = qh(o, e);
    } else {
      if (s.includes(n)) {
        F(44);
        return;
      }
      const o = t[n];
      if (!Xh(e, o, n))
        return;
      const a = this.processDataTypeDefinition(
        o,
        t,
        [...s, n],
        i
      );
      if (!a)
        return;
      r = qh(a, e);
    }
    return {
      ...r,
      groupSafeValueFormatter: Zh(r, this.gos)
    };
  }
  updateColDefAndGetColumnType(e, t, s) {
    let { cellDataType: i } = t;
    const { field: r } = t;
    if (i === void 0 && (i = e.cellDataType), (i == null || i === !0) && (i = this.canInferCellDataType(e, t) ? this.inferCellDataType(r, s) : !1), !i) {
      e.cellDataType = !1;
      return;
    }
    const n = this.dataTypeDefinitions[i];
    if (!n) {
      F(47, { cellDataType: i });
      return;
    }
    return e.cellDataType = i, n.groupSafeValueFormatter && (e.valueFormatter = n.groupSafeValueFormatter), n.valueParser && (e.valueParser = n.valueParser), n.suppressDefaultProperties || this.setColDefPropertiesForBaseDataType(e, i, n, s), n.columnTypes;
  }
  addColumnListeners(e) {
    if (!this.isPendingInference)
      return;
    const t = this.columnStateUpdatesPendingInference[e.getColId()];
    if (!t)
      return;
    const s = (i) => {
      t.add(i.key);
    };
    e.__addEventListener("columnStateUpdated", s), this.columnStateUpdateListenerDestroyFuncs.push(
      () => e.__removeEventListener("columnStateUpdated", s)
    );
  }
  canInferCellDataType(e, t) {
    const { gos: s } = this;
    if (!te(s))
      return !1;
    const i = { cellRenderer: !0, valueGetter: !0, valueParser: !0, refData: !0 };
    if (dl(t, i))
      return !1;
    const r = t.type === null ? e.type : t.type;
    if (r) {
      const n = s.get("columnTypes") ?? {};
      if (Eo(r).some((a) => {
        const l = n[a.trim()];
        return l && dl(l, i);
      }))
        return !1;
    }
    return !dl(e, i);
  }
  inferCellDataType(e, t) {
    if (!e)
      return;
    let s;
    const i = this.getInitialData();
    if (i) {
      const n = e.indexOf(".") >= 0 && !this.gos.get("suppressFieldDotNotation");
      s = Kr(i, e, n);
    } else
      this.initWaitForRowData(t);
    return s == null ? void 0 : Object.keys(this.dataTypeMatchers).find(
      (n) => this.dataTypeMatchers[n](s)
    ) ?? "object";
  }
  getInitialData() {
    var t;
    const e = this.gos.get("rowData");
    if (e != null && e.length)
      return e[0];
    if (this.initialData)
      return this.initialData;
    {
      const s = (t = this.beans.rowModel.rootNode) == null ? void 0 : t.allLeafChildren;
      if (s != null && s.length)
        return s[0].data;
    }
    return null;
  }
  initWaitForRowData(e) {
    if (this.columnStateUpdatesPendingInference[e] = /* @__PURE__ */ new Set(), this.isPendingInference)
      return;
    this.isPendingInference = !0;
    const t = this.isColumnTypeOverrideInDataTypeDefinitions, { colAutosize: s, eventSvc: i } = this.beans;
    t && s && (s.shouldQueueResizeOperations = !0);
    const [r] = this.addManagedEventListeners({
      rowDataUpdateStarted: (n) => {
        const { firstRowData: o } = n;
        o && (r == null || r(), this.isPendingInference = !1, this.processColumnsPendingInference(o, t), this.columnStateUpdatesPendingInference = {}, t && (s == null || s.processResizeOperations()), i.dispatchEvent({
          type: "dataTypesInferred"
        }));
      }
    });
  }
  processColumnsPendingInference(e, t) {
    this.initialData = e;
    const s = [];
    this.destroyColumnStateUpdateListeners();
    const i = {}, r = {};
    for (const n of Object.keys(this.columnStateUpdatesPendingInference)) {
      const o = this.columnStateUpdatesPendingInference[n], a = this.colModel.getCol(n);
      if (!a)
        return;
      const l = a.getColDef();
      if (!this.resetColDefIntoCol(a, "cellDataTypeInferred"))
        return;
      const c = a.getColDef();
      if (t && c.type && c.type !== l.type) {
        const d = rP(a, o);
        d.rowGroup && d.rowGroupIndex == null && (i[n] = d), d.pivot && d.pivotIndex == null && (r[n] = d), s.push(d);
      }
    }
    t && s.push(
      ...this.generateColumnStateForRowGroupAndPivotIndexes(
        i,
        r
      )
    ), s.length && je(this.beans, { state: s }, "cellDataTypeInferred"), this.initialData = null;
  }
  generateColumnStateForRowGroupAndPivotIndexes(e, t) {
    const s = {}, { rowGroupColsSvc: i, pivotColsSvc: r } = this.beans;
    return i == null || i.restoreColumnOrder(s, e), r == null || r.restoreColumnOrder(s, t), Object.values(s);
  }
  resetColDefIntoCol(e, t) {
    const s = e.getUserProvidedColDef();
    if (!s)
      return !1;
    const i = Ti(this.beans, s, e.getColId());
    return e.setColDef(i, s, t), !0;
  }
  getDateStringTypeDefinition(e) {
    const { dateString: t } = this.dataTypeDefinitions;
    return e ? this.getDataTypeDefinition(e) ?? t : t;
  }
  getDateParserFunction(e) {
    return this.getDateStringTypeDefinition(e).dateParser;
  }
  getDateFormatterFunction(e) {
    return this.getDateStringTypeDefinition(e).dateFormatter;
  }
  getDateIncludesTimeFlag(e) {
    return e === "dateTime" || e === "dateTimeString";
  }
  getDataTypeDefinition(e) {
    const t = e.getColDef();
    if (t.cellDataType)
      return this.dataTypeDefinitions[t.cellDataType];
  }
  getBaseDataType(e) {
    var t;
    return (t = this.getDataTypeDefinition(e)) == null ? void 0 : t.baseDataType;
  }
  checkType(e, t) {
    var i;
    if (t == null)
      return !0;
    const s = (i = this.getDataTypeDefinition(e)) == null ? void 0 : i.dataTypeMatcher;
    return s ? s(t) : !0;
  }
  validateColDef(e) {
    const t = (s) => F(48, { property: s });
    if (e.cellDataType === "object") {
      const { object: s } = this.dataTypeDefinitions;
      e.valueFormatter === s.groupSafeValueFormatter && !this.hasObjectValueFormatter && t("Formatter"), e.editable && e.valueParser === s.valueParser && !this.hasObjectValueParser && t("Parser");
    }
  }
  postProcess(e) {
    var o;
    const t = e.cellDataType;
    if (!t || typeof t != "string")
      return;
    const { dataTypeDefinitions: s, beans: i, formatValueFuncs: r } = this, n = s[t];
    n && ((o = i.colFilter) == null || o.setColDefPropsForDataType(e, n, r[t]));
  }
  // noinspection JSUnusedGlobalSymbols
  getFormatValue(e) {
    return this.formatValueFuncs[e];
  }
  isColPendingInference(e) {
    return this.isPendingInference && !!this.columnStateUpdatesPendingInference[e];
  }
  setColDefPropertiesForBaseDataType(e, t, s, i) {
    const r = this.formatValueFuncs[t], n = this.columnDefinitionPropsPerDataType[s.baseDataType]({
      colDef: e,
      cellDataType: t,
      colModel: this.colModel,
      dataTypeDefinition: s,
      colId: i,
      formatValue: r
    });
    Object.assign(e, n);
  }
  getDateObjectTypeDef(e) {
    const t = this.getLocaleTextFunc(), s = this.getDateIncludesTimeFlag(e);
    return {
      baseDataType: e,
      valueParser: (i) => ke(i.newValue && String(i.newValue)),
      valueFormatter: (i) => i.value == null ? "" : !(i.value instanceof Date) || isNaN(i.value.getTime()) ? t("invalidDate", "Invalid Date") : tt(i.value, s) ?? "",
      dataTypeMatcher: (i) => i instanceof Date
    };
  }
  getDateStringTypeDef(e) {
    const t = this.getDateIncludesTimeFlag(e);
    return {
      baseDataType: e,
      dateParser: (s) => ke(s) ?? void 0,
      dateFormatter: (s) => tt(s ?? null, t) ?? void 0,
      valueParser: (s) => io(String(s.newValue)) ? s.newValue : null,
      valueFormatter: (s) => io(String(s.value)) ? String(s.value) : "",
      dataTypeMatcher: (s) => typeof s == "string" && io(s)
    };
  }
  getDefaultDataTypes() {
    const e = this.getLocaleTextFunc();
    return {
      number: {
        baseDataType: "number",
        // can be empty space with legacy copy
        valueParser: (t) => {
          var s, i;
          return ((i = (s = t.newValue) == null ? void 0 : s.trim) == null ? void 0 : i.call(s)) === "" ? null : Number(t.newValue);
        },
        valueFormatter: (t) => t.value == null ? "" : typeof t.value != "number" || isNaN(t.value) ? e("invalidNumber", "Invalid Number") : String(t.value),
        dataTypeMatcher: (t) => typeof t == "number"
      },
      text: {
        baseDataType: "text",
        valueParser: (t) => t.newValue === "" ? null : ut(t.newValue),
        dataTypeMatcher: (t) => typeof t == "string"
      },
      boolean: {
        baseDataType: "boolean",
        valueParser: (t) => {
          var s, i;
          return t.newValue == null ? t.newValue : ((i = (s = t.newValue) == null ? void 0 : s.trim) == null ? void 0 : i.call(s)) === "" ? null : String(t.newValue).toLowerCase() === "true";
        },
        valueFormatter: (t) => t.value == null ? "" : String(t.value),
        dataTypeMatcher: (t) => typeof t == "boolean"
      },
      date: this.getDateObjectTypeDef("date"),
      dateString: this.getDateStringTypeDef("dateString"),
      dateTime: this.getDateObjectTypeDef("dateTime"),
      dateTimeString: {
        ...this.getDateStringTypeDef("dateTimeString"),
        dataTypeMatcher: (t) => typeof t == "string" && ty(t)
      },
      object: {
        baseDataType: "object",
        valueParser: () => null,
        valueFormatter: (t) => ut(t.value) ?? ""
      }
    };
  }
  destroyColumnStateUpdateListeners() {
    this.columnStateUpdateListenerDestroyFuncs.forEach((e) => e()), this.columnStateUpdateListenerDestroyFuncs = [];
  }
  destroy() {
    this.dataTypeDefinitions = {}, this.dataTypeMatchers = {}, this.formatValueFuncs = {}, this.columnStateUpdatesPendingInference = {}, this.destroyColumnStateUpdateListeners(), super.destroy();
  }
};
function qh(e, t) {
  const s = {
    ...e,
    ...t
  };
  return e.columnTypes && t.columnTypes && t.appendColumnTypes && (s.columnTypes = [
    ...Eo(e.columnTypes),
    ...Eo(t.columnTypes)
  ]), s;
}
function Xh(e, t, s) {
  return t ? t.baseDataType !== e.baseDataType ? (F(46), !1) : !0 : (F(45, { parentCellDataType: s }), !1);
}
function Zh(e, t) {
  if (e.valueFormatter)
    return (s) => {
      var i, r;
      if ((i = s.node) != null && i.group) {
        const n = (s.colDef.pivotValueColumn ?? s.column).getAggFunc();
        if (n) {
          if (n === "first" || n === "last")
            return e.valueFormatter(s);
          if (e.baseDataType === "number" && n !== "count") {
            if (typeof s.value == "number")
              return e.valueFormatter(s);
            if (typeof s.value == "object") {
              if (!s.value)
                return;
              if ("toNumber" in s.value)
                return e.valueFormatter({
                  ...s,
                  value: s.value.toNumber()
                });
              if ("value" in s.value)
                return e.valueFormatter({
                  ...s,
                  value: s.value.value
                });
            }
          }
          return;
        }
      } else if (t.get("groupHideOpenParents") && s.column.isRowGroupActive() && typeof s.value == "string" && !((r = e.dataTypeMatcher) != null && r.call(e, s.value)))
        return;
      return e.valueFormatter(s);
    };
}
function iP(e, t, s, i) {
  if (!t[s])
    return !1;
  const r = e[s];
  return r === null ? (t[s] = !1, !1) : i === void 0 ? !!r : r === i;
}
function dl(e, t) {
  return [
    ["cellRenderer", "agSparklineCellRenderer"],
    ["valueGetter", void 0],
    ["valueParser", void 0],
    ["refData", void 0]
  ].some(
    ([s, i]) => iP(e, t, s, i)
  );
}
function rP(e, t) {
  const s = Sp(e);
  return t.forEach((i) => {
    delete s[i], i === "rowGroup" ? delete s.rowGroupIndex : i === "pivot" && delete s.pivotIndex;
  }), s;
}
var nP = {
  moduleName: "DataType",
  version: B,
  beans: [sP],
  dependsOn: [DR]
}, oP = {
  moduleName: "ColumnFlex",
  version: B,
  beans: [eP]
}, Nf = {
  moduleName: "ColumnApi",
  version: B,
  beans: [JR],
  apiFunctions: {
    getColumnDef: IR,
    getDisplayNameForColumn: kR,
    getColumn: GR,
    getColumns: OR,
    applyColumnState: VR,
    getColumnState: BR,
    resetColumnState: NR,
    isPinning: HR,
    isPinningLeft: zR,
    isPinningRight: WR,
    getDisplayedColAfter: _R,
    getDisplayedColBefore: UR,
    setColumnsVisible: $R,
    setColumnsPinned: KR,
    getAllGridColumns: jR,
    getDisplayedLeftColumns: YR,
    getDisplayedCenterColumns: qR,
    getDisplayedRightColumns: XR,
    getAllDisplayedColumns: ZR,
    getAllDisplayedVirtualColumns: QR,
    getColumnDefs: LR
  }
};
function aP(e) {
  if (!e || e == null)
    return null;
  const t = /([a-z])([A-Z])/g, s = /([A-Z]+)([A-Z])([a-z])/g;
  return e.replace(t, "$1 $2").replace(s, "$1 $2$3").replace(/\./g, " ").split(" ").map((r) => r.substring(0, 1).toUpperCase() + (r.length > 1 ? r.substring(1, r.length) : "")).join(" ");
}
var lP = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colNames";
  }
  getDisplayNameForColumn(e, t, s = !1) {
    if (!e)
      return null;
    const i = this.getHeaderName(e.getColDef(), e, null, null, t), { aggColNameSvc: r } = this.beans;
    return s && r ? r.getHeaderName(e, i) : i;
  }
  getDisplayNameForProvidedColumnGroup(e, t, s) {
    const i = t == null ? void 0 : t.getColGroupDef();
    return i ? this.getHeaderName(i, null, e, t, s) : null;
  }
  getDisplayNameForColumnGroup(e, t) {
    return this.getDisplayNameForProvidedColumnGroup(e, e.getProvidedColumnGroup(), t);
  }
  // location is where the column is going to appear, ie who is calling us
  getHeaderName(e, t, s, i, r) {
    var o;
    const n = e.headerValueGetter;
    if (n) {
      const a = V(this.gos, {
        colDef: e,
        column: t,
        columnGroup: s,
        providedColumnGroup: i,
        location: r
      });
      return typeof n == "function" ? n(a) : typeof n == "string" ? ((o = this.beans.expressionSvc) == null ? void 0 : o.evaluate(n, a)) ?? null : "";
    } else {
      if (e.headerName != null)
        return e.headerName;
      if (e.field)
        return aP(e.field);
    }
    return "";
  }
}, cP = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colViewport", this.colsWithinViewport = [], this.headerColsWithinViewport = [], this.colsWithinViewportHash = "", this.rowsOfHeadersToRenderLeft = {}, this.rowsOfHeadersToRenderRight = {}, this.rowsOfHeadersToRenderCenter = {}, this.columnsToRenderLeft = [], this.columnsToRenderRight = [], this.columnsToRenderCenter = [];
  }
  wireBeans(e) {
    this.visibleCols = e.visibleCols, this.colModel = e.colModel;
  }
  postConstruct() {
    this.suppressColumnVirtualisation = this.gos.get("suppressColumnVirtualisation");
  }
  setScrollPosition(e, t, s = !1) {
    const { visibleCols: i } = this, r = i.isBodyWidthDirty;
    if (!(e === this.scrollWidth && t === this.scrollPosition && !r)) {
      if (this.scrollWidth = e, this.scrollPosition = t, i.isBodyWidthDirty = !0, this.gos.get("enableRtl")) {
        const o = i.bodyWidth;
        this.viewportLeft = o - t - e, this.viewportRight = o - t;
      } else
        this.viewportLeft = t, this.viewportRight = e + t;
      this.colModel.ready && this.checkViewportColumns(s);
    }
  }
  /**
   * Returns the columns that are currently rendered in the viewport.
   */
  getColumnHeadersToRender(e) {
    switch (e) {
      case "left":
        return this.columnsToRenderLeft;
      case "right":
        return this.columnsToRenderRight;
      default:
        return this.columnsToRenderCenter;
    }
  }
  /**
   * Returns the column groups that are currently rendered in the viewport at a specific header row index.
   */
  getHeadersToRender(e, t) {
    let s;
    switch (e) {
      case "left":
        s = this.rowsOfHeadersToRenderLeft[t];
        break;
      case "right":
        s = this.rowsOfHeadersToRenderRight[t];
        break;
      default:
        s = this.rowsOfHeadersToRenderCenter[t];
        break;
    }
    return s ?? [];
  }
  extractViewportColumns() {
    const e = this.visibleCols.centerCols;
    this.isColumnVirtualisationSuppressed() ? (this.colsWithinViewport = e, this.headerColsWithinViewport = e) : (this.colsWithinViewport = e.filter(this.isColumnInRowViewport.bind(this)), this.headerColsWithinViewport = e.filter(this.isColumnInHeaderViewport.bind(this)));
  }
  isColumnVirtualisationSuppressed() {
    return this.suppressColumnVirtualisation || this.viewportRight === 0;
  }
  clear() {
    this.rowsOfHeadersToRenderLeft = {}, this.rowsOfHeadersToRenderRight = {}, this.rowsOfHeadersToRenderCenter = {}, this.colsWithinViewportHash = "";
  }
  isColumnInHeaderViewport(e) {
    return e.isAutoHeaderHeight() || dP(e) ? !0 : this.isColumnInRowViewport(e);
  }
  isColumnInRowViewport(e) {
    if (e.isAutoHeight())
      return !0;
    const t = e.getLeft() || 0, s = t + e.getActualWidth(), i = this.viewportLeft - 200, r = this.viewportRight + 200, n = t < i && s < i, o = t > r && s > r;
    return !n && !o;
  }
  // used by Grid API only
  getViewportColumns() {
    const { leftCols: e, rightCols: t } = this.visibleCols;
    return this.colsWithinViewport.concat(e).concat(t);
  }
  // + rowRenderer
  // if we are not column spanning, this just returns back the virtual centre columns,
  // however if we are column spanning, then different rows can have different virtual
  // columns, so we have to work out the list for each individual row.
  getColsWithinViewport(e) {
    if (!this.colModel.colSpanActive)
      return this.colsWithinViewport;
    const t = (n) => {
      const o = n.getLeft();
      return A(o) && o > this.viewportLeft;
    }, s = this.isColumnVirtualisationSuppressed() ? void 0 : this.isColumnInRowViewport.bind(this), { visibleCols: i } = this, r = i.centerCols;
    return i.getColsForRow(e, r, s, t);
  }
  // checks what columns are currently displayed due to column virtualisation. dispatches an event
  // if the list of columns has changed.
  // + setColumnWidth(), setViewportPosition(), setColumnDefs(), sizeColumnsToFit()
  checkViewportColumns(e = !1) {
    this.extractViewport() && this.eventSvc.dispatchEvent({
      type: "virtualColumnsChanged",
      afterScroll: e
    });
  }
  calculateHeaderRows() {
    const { leftCols: e, rightCols: t } = this.visibleCols;
    this.columnsToRenderLeft = e, this.columnsToRenderRight = t, this.columnsToRenderCenter = this.colsWithinViewport;
    const s = (i) => {
      const r = /* @__PURE__ */ new Set(), n = {};
      for (const o of i) {
        let a = o.getParent();
        const l = o.isSpanHeaderHeight();
        for (; a && !r.has(a); ) {
          if (l && a.isPadding()) {
            a = a.getParent();
            continue;
          }
          const d = a.getProvidedColumnGroup().getLevel();
          n[d] ?? (n[d] = []), n[d].push(a), r.add(a), a = a.getParent();
        }
      }
      return n;
    };
    this.rowsOfHeadersToRenderLeft = s(e), this.rowsOfHeadersToRenderRight = s(t), this.rowsOfHeadersToRenderCenter = s(this.headerColsWithinViewport);
  }
  extractViewport() {
    const e = (i) => `${i.getId()}-${i.getPinned() || "normal"}`;
    this.extractViewportColumns();
    const t = this.getViewportColumns().map(e).join("#"), s = this.colsWithinViewportHash !== t;
    return s && (this.colsWithinViewportHash = t, this.calculateHeaderRows()), s;
  }
};
function dP(e) {
  for (; e; ) {
    if (e.isAutoHeaderHeight())
      return !0;
    e = e.getParent();
  }
  return !1;
}
var hP = class extends R {
  constructor() {
    super(...arguments), this.beanName = "agCompUtils";
  }
  adaptFunction(e, t) {
    if (!e.cellRenderer)
      return null;
    class s {
      refresh() {
        return !1;
      }
      getGui() {
        return this.eGui;
      }
      init(r) {
        const n = t(r), o = typeof n;
        if (o === "string" || o === "number" || o === "boolean") {
          this.eGui = Oc("<span>" + n + "</span>");
          return;
        }
        if (n == null) {
          this.eGui = K({ tag: "span" });
          return;
        }
        this.eGui = n;
      }
    }
    return s;
  }
}, uP = {
  moduleName: "CellRendererFunction",
  version: B,
  beans: [hP]
}, gP = class extends qy {
  constructor() {
    super(...arguments), this.agGridDefaults = {}, this.agGridDefaultOverrides = {}, this.jsComps = {}, this.selectors = {}, this.icons = {};
  }
  postConstruct() {
    const e = this.gos.get("components");
    if (e != null)
      for (const t of Object.keys(e))
        this.jsComps[t] = e[t];
  }
  registerModule(e) {
    const { icons: t, userComponents: s, dynamicBeans: i, selectors: r } = e;
    if (s) {
      const n = (o, a, l, c) => {
        this.agGridDefaults[o] = a, (l || c) && (this.agGridDefaultOverrides[o] = { params: l, processParams: c });
      };
      for (const o of Object.keys(s)) {
        let a = s[o];
        if (Xb(a) && (a = a.getComp(this.beans)), typeof a == "object") {
          const { classImp: l, params: c, processParams: d } = a;
          n(o, l, c, d);
        } else
          n(o, a);
      }
    }
    if (this.registerDynamicBeans(i), r == null || r.forEach((n) => {
      this.selectors[n.selector] = n;
    }), t)
      for (const n of Object.keys(t))
        this.icons[n] = t[n];
  }
  getUserComponent(e, t) {
    var a;
    const s = (l, c, d, h) => ({
      componentFromFramework: c,
      component: l,
      params: d,
      processParams: h
    }), { frameworkOverrides: i } = this.beans, r = i.frameworkComponent(t, this.gos.get("components"));
    if (r != null)
      return s(r, !0);
    const n = this.jsComps[t];
    if (n) {
      const l = i.isFrameworkComponent(n);
      return s(n, l);
    }
    const o = this.agGridDefaults[t];
    if (o) {
      const l = this.agGridDefaultOverrides[t];
      return s(o, !1, l == null ? void 0 : l.params, l == null ? void 0 : l.processParams);
    }
    return (a = this.beans.validation) == null || a.missingUserComponent(e, t, this.agGridDefaults, this.jsComps), null;
  }
  getSelector(e) {
    return this.selectors[e];
  }
  getIcon(e) {
    return this.icons[e];
  }
  getDynamicError(e, t) {
    var s;
    return t ? gt(279, { name: e }) : ((s = this.beans.validation) == null ? void 0 : s.missingDynamicBean(e)) ?? gt(256);
  }
}, pP = 23, fP = class extends R {
  constructor() {
    super(...arguments), this.beanName = "ctrlsSvc", this.params = {}, this.ready = !1, this.readyCallbacks = [];
  }
  postConstruct() {
    var e, t;
    this.addEventListener(
      "ready",
      () => {
        this.updateReady(), this.ready && (this.readyCallbacks.forEach((s) => s(this.params)), this.readyCallbacks.length = 0);
      },
      ((t = (e = this.beans.frameworkOverrides).runWhenReadyAsync) == null ? void 0 : t.call(e)) ?? !1
    );
  }
  updateReady() {
    const e = Object.values(this.params);
    this.ready = e.length === pP && e.every((t) => (t == null ? void 0 : t.isAlive()) ?? !1);
  }
  whenReady(e, t) {
    this.ready ? t(this.params) : this.readyCallbacks.push(t), e.addDestroyFunc(() => {
      const s = this.readyCallbacks.indexOf(t);
      s >= 0 && this.readyCallbacks.splice(s, 1);
    });
  }
  register(e, t) {
    this.params[e] = t, this.updateReady(), this.ready && this.dispatchLocalEvent({ type: "ready" }), t.addDestroyFunc(() => {
      this.updateReady();
    });
  }
  get(e) {
    return this.params[e];
  }
  getGridBodyCtrl() {
    return this.params.gridBodyCtrl;
  }
  getHeaderRowContainerCtrls() {
    const { leftHeader: e, centerHeader: t, rightHeader: s } = this.params;
    return [e, s, t];
  }
  getHeaderRowContainerCtrl(e) {
    const t = this.params;
    switch (e) {
      case "left":
        return t.leftHeader;
      case "right":
        return t.rightHeader;
      default:
        return t.centerHeader;
    }
  }
  getScrollFeature() {
    return this.getGridBodyCtrl().scrollFeature;
  }
}, Hf = /* @__PURE__ */ new Set(), No = {}, yi = {}, lo, zf = !1, Wf = !1, mP = !1;
function CP(e) {
  const [t, s] = e.version.split(".") || [], [i, r] = lo.split(".") || [];
  return t === i && s === r;
}
function vP(e) {
  lo || (lo = e.version);
  const t = (s) => `You are using incompatible versions of AG Grid modules. Major and minor versions should always match across modules. ${s} Please update all modules to the same version.`;
  if (e.version ? CP(e) || er(
    t(
      `'${e.moduleName}' is version ${e.version} but the other modules are version ${lo}.`
    )
  ) : er(t(`'${e.moduleName}' is incompatible.`)), e.validate) {
    const s = e.validate();
    s.isValid || er(`${s.message}`);
  }
}
function ln(e, t, s = !1) {
  s || (zf = !0), vP(e);
  const i = e.rowModels ?? ["all"];
  Hf.add(e);
  let r;
  t !== void 0 ? (Wf = !0, yi[t] === void 0 && (yi[t] = {}), r = yi[t]) : r = No, i.forEach((n) => {
    r[n] === void 0 && (r[n] = {}), r[n][e.moduleName] = e;
  }), e.dependsOn && e.dependsOn.forEach((n) => ln(n, t, s));
}
function wP(e) {
  delete yi[e];
}
function ac(e, t, s) {
  const i = (r) => {
    var n, o, a;
    return !!((n = No[r]) != null && n[e]) || !!((a = (o = yi[t]) == null ? void 0 : o[r]) != null && a[e]);
  };
  return i(s) || i("all");
}
function Fd() {
  return Wf;
}
function bP(e, t) {
  const s = yi[e] ?? {};
  return [
    ...Object.values(No.all ?? {}),
    ...Object.values(s.all ?? {}),
    ...Object.values(No[t] ?? {}),
    ...Object.values(s[t] ?? {})
  ];
}
function yP() {
  return new Set(Hf);
}
function SP(e, t) {
  const s = yi[e] ?? {};
  return [...Object.values(s.all ?? {}), ...Object.values(s[t] ?? {})];
}
function xP() {
  return zf;
}
function FP() {
  return mP;
}
var RP = class {
  /**
   * @deprecated v33 Use `registerModules([module])` instead.
   */
  static register(e) {
    ln(e, void 0);
  }
  /**
   * Globally register the given modules for all grids.
   * @param modules - modules to register
   */
  static registerModules(e) {
    e.forEach((t) => ln(t, void 0));
  }
}, PP = (
  /*css*/
  '.ag-aria-description-container{border:0;z-index:9999;clip:rect(1px,1px,1px,1px);height:1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.ag-unselectable{-webkit-user-select:none;-moz-user-select:none;user-select:none}.ag-selectable{-webkit-user-select:text;-moz-user-select:text;user-select:text}.ag-tab-guard{display:block;height:0;position:absolute;width:0}:where(.ag-virtual-list-viewport) .ag-tab-guard{position:sticky}.ag-tab-guard-top{top:1px}.ag-tab-guard-bottom{bottom:1px}.ag-shake-left-to-right{animation-direction:alternate;animation-duration:.2s;animation-iteration-count:infinite;animation-name:ag-shake-left-to-right}@keyframes ag-shake-left-to-right{0%{padding-left:6px;padding-right:2px}to{padding-left:2px;padding-right:6px}}.ag-body-horizontal-scroll-viewport,.ag-body-vertical-scroll-viewport,.ag-body-viewport,.ag-center-cols-viewport,.ag-floating-bottom-viewport,.ag-floating-top-viewport,.ag-header-viewport,.ag-sticky-bottom-viewport,.ag-sticky-top-viewport,.ag-virtual-list-viewport{flex:1 1 auto;height:100%;min-width:0;overflow:hidden;position:relative}.ag-viewport{position:relative}.ag-spanning-container{position:absolute;top:0;z-index:1}.ag-body-viewport,.ag-center-cols-viewport,.ag-floating-bottom-viewport,.ag-floating-top-viewport,.ag-header-viewport,.ag-sticky-bottom-viewport,.ag-sticky-top-viewport{overflow-x:auto;-ms-overflow-style:none!important;scrollbar-width:none!important;&::-webkit-scrollbar{display:none!important}}.ag-body-viewport{display:flex;overflow-x:hidden;&:where(.ag-layout-normal){overflow-y:auto;-webkit-overflow-scrolling:touch}}.ag-floating-bottom-container,.ag-floating-top-container,.ag-sticky-bottom-container,.ag-sticky-top-container{min-height:1px}.ag-center-cols-viewport{min-height:100%;width:100%}.ag-body-horizontal-scroll-viewport{overflow-x:scroll}.ag-body-vertical-scroll-viewport{overflow-y:scroll}.ag-virtual-list-viewport{overflow:auto;width:100%}.ag-body-container,.ag-body-horizontal-scroll-container,.ag-body-vertical-scroll-container,.ag-center-cols-container,.ag-floating-bottom-container,.ag-floating-bottom-full-width-container,.ag-floating-top-container,.ag-full-width-container,.ag-header-container,.ag-pinned-left-cols-container,.ag-pinned-right-cols-container,.ag-sticky-bottom-container,.ag-sticky-top-container,.ag-virtual-list-container{position:relative}.ag-floating-bottom-container,.ag-floating-top-container,.ag-header-container,.ag-pinned-left-floating-bottom,.ag-pinned-left-floating-top,.ag-pinned-right-floating-bottom,.ag-pinned-right-floating-top,.ag-sticky-bottom-container,.ag-sticky-top-container{height:100%;white-space:nowrap}.ag-center-cols-container,.ag-pinned-right-cols-container{display:block}.ag-body-horizontal-scroll-container{height:100%}.ag-body-vertical-scroll-container{width:100%}.ag-floating-bottom-full-width-container,.ag-floating-top-full-width-container,.ag-full-width-container,.ag-sticky-bottom-full-width-container,.ag-sticky-top-full-width-container{pointer-events:none;position:absolute;top:0}:where(.ag-ltr) .ag-floating-bottom-full-width-container,:where(.ag-ltr) .ag-floating-top-full-width-container,:where(.ag-ltr) .ag-full-width-container,:where(.ag-ltr) .ag-sticky-bottom-full-width-container,:where(.ag-ltr) .ag-sticky-top-full-width-container{left:0}:where(.ag-rtl) .ag-floating-bottom-full-width-container,:where(.ag-rtl) .ag-floating-top-full-width-container,:where(.ag-rtl) .ag-full-width-container,:where(.ag-rtl) .ag-sticky-bottom-full-width-container,:where(.ag-rtl) .ag-sticky-top-full-width-container{right:0}.ag-full-width-container{width:100%}.ag-floating-bottom-full-width-container,.ag-floating-top-full-width-container{display:inline-block;height:100%;overflow:hidden;width:100%}.ag-virtual-list-container{overflow:hidden}.ag-body{display:flex;flex:1 1 auto;flex-direction:row!important;min-height:0;position:relative}.ag-body-horizontal-scroll,.ag-body-vertical-scroll{display:flex;min-height:0;min-width:0;position:relative;&:where(.ag-scrollbar-invisible){bottom:0;position:absolute;&:where(.ag-apple-scrollbar){opacity:0;transition:opacity .4s;visibility:hidden;&:where(.ag-scrollbar-scrolling,.ag-scrollbar-active){opacity:1;visibility:visible}}}}.ag-body-horizontal-scroll{width:100%;&:where(.ag-scrollbar-invisible){left:0;right:0}}.ag-body-vertical-scroll{height:100%;&:where(.ag-scrollbar-invisible){top:0;z-index:10}}:where(.ag-ltr) .ag-body-vertical-scroll{&:where(.ag-scrollbar-invisible){right:0}}:where(.ag-rtl) .ag-body-vertical-scroll{&:where(.ag-scrollbar-invisible){left:0}}.ag-force-vertical-scroll{overflow-y:scroll!important}.ag-horizontal-left-spacer,.ag-horizontal-right-spacer{height:100%;min-width:0;overflow-x:scroll;&:where(.ag-scroller-corner){overflow-x:hidden}}:where(.ag-row-animation) .ag-row{transition:transform .4s,top .4s,opacity .2s;&:where(.ag-after-created){transition:transform .4s,top .4s,height .4s,opacity .2s}}:where(.ag-row-animation.ag-prevent-animation) .ag-row{transition:none!important;&:where(.ag-row.ag-after-created){transition:none!important}}:where(.ag-row-no-animation) .ag-row{transition:none}.ag-row-loading{align-items:center;display:flex}.ag-row-position-absolute{position:absolute}.ag-row-position-relative{position:relative}.ag-full-width-row{overflow:hidden;pointer-events:all}.ag-row-inline-editing{z-index:1}.ag-row-dragging{z-index:2}.ag-stub-cell{align-items:center;display:flex}.ag-cell{display:inline-block;height:100%;position:absolute;white-space:nowrap;&:focus-visible{box-shadow:none}}.ag-cell-value{flex:1 1 auto}.ag-cell-value,.ag-group-value{overflow:hidden;text-overflow:ellipsis}.ag-cell-wrap-text{white-space:normal;word-break:break-word}:where(.ag-cell) .ag-icon{display:inline-block;vertical-align:middle}.ag-floating-top{display:flex;overflow:hidden;position:relative;white-space:nowrap;width:100%}:where(.ag-floating-top:not(.ag-invisible)){border-bottom:var(--ag-pinned-row-border)}.ag-floating-bottom{display:flex;overflow:hidden;position:relative;white-space:nowrap;width:100%}:where(.ag-floating-bottom:not(.ag-invisible)){border-top:var(--ag-pinned-row-border)}.ag-sticky-bottom,.ag-sticky-top{background-color:var(--ag-background-color);display:flex;height:0;overflow:hidden;position:absolute;width:100%;z-index:1}.ag-opacity-zero{opacity:0!important}.ag-cell-label-container{align-items:center;display:flex;flex-direction:row-reverse;height:100%;justify-content:space-between;width:100%}:where(.ag-right-aligned-header){.ag-cell-label-container{flex-direction:row}.ag-header-cell-text{text-align:end}}.ag-column-group-icons{display:block;>*{cursor:pointer}}:where(.ag-ltr){direction:ltr;.ag-body,.ag-body-horizontal-scroll,.ag-body-viewport,.ag-floating-bottom,.ag-floating-top,.ag-header,.ag-sticky-bottom,.ag-sticky-top{flex-direction:row}}:where(.ag-rtl){direction:rtl;text-align:right;.ag-body,.ag-body-horizontal-scroll,.ag-body-viewport,.ag-floating-bottom,.ag-floating-top,.ag-header,.ag-sticky-bottom,.ag-sticky-top{flex-direction:row-reverse}.ag-icon-contracted,.ag-icon-expanded,.ag-icon-tree-closed{display:block}}:where(.ag-rtl){.ag-icon-contracted,.ag-icon-expanded,.ag-icon-tree-closed{transform:rotate(180deg)}}:where(.ag-rtl){.ag-icon-contracted,.ag-icon-expanded,.ag-icon-tree-closed{transform:rotate(-180deg)}}.ag-measurement-container{height:0;overflow:hidden;visibility:hidden;width:0}.ag-measurement-element-border{display:inline-block;&:before{border-left:var(--ag-internal-measurement-border);content:"";display:block}}.ag-group{position:relative;width:100%}.ag-group-title-bar{align-items:center;display:flex;padding:var(--ag-spacing)}.ag-group-title{display:inline;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:where(.ag-group-title-bar) .ag-group-title{cursor:default}.ag-group-toolbar{align-items:center;display:flex;padding:var(--ag-spacing)}.ag-group-container{display:flex}.ag-disabled .ag-group-container{pointer-events:none}.ag-disabled-group-container,.ag-disabled-group-title-bar{opacity:.5}.ag-group-container-horizontal{flex-flow:row wrap}.ag-group-container-vertical{flex-direction:column}.ag-group-title-bar-icon{cursor:pointer;flex:none}:where(.ag-ltr) .ag-group-title-bar-icon{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-group-title-bar-icon{margin-left:var(--ag-spacing)}:where(.ag-group-item-alignment-stretch) .ag-group-item{align-items:stretch}:where(.ag-group-item-alignment-start) .ag-group-item{align-items:flex-start}:where(.ag-group-item-alignment-end) .ag-group-item{align-items:flex-end}:where(.ag-ltr) .ag-row:not(.ag-row-level-0) .ag-pivot-leaf-group{margin-left:var(--ag-row-group-indent-size)}:where(.ag-rtl) .ag-row:not(.ag-row-level-0) .ag-pivot-leaf-group{margin-right:var(--ag-row-group-indent-size)}:where(.ag-ltr) .ag-row-group-leaf-indent{margin-left:calc(var(--ag-cell-widget-spacing) + var(--ag-icon-size))}:where(.ag-rtl) .ag-row-group-leaf-indent{margin-right:calc(var(--ag-cell-widget-spacing) + var(--ag-icon-size))}.ag-value-change-delta{padding:0 2px}.ag-value-change-delta-up{color:var(--ag-value-change-delta-up-color)}.ag-value-change-delta-down{color:var(--ag-value-change-delta-down-color)}.ag-value-change-value{background-color:transparent;border-radius:1px;padding-left:1px;padding-right:1px;transition:background-color 1s}.ag-value-change-value-highlight{background-color:var(--ag-value-change-value-highlight-background-color);transition:background-color .1s}.ag-cell-data-changed{background-color:var(--ag-value-change-value-highlight-background-color)!important}.ag-cell-data-changed-animation{background-color:transparent}.ag-cell-highlight{background-color:var(--ag-range-selection-highlight-color)!important}.ag-row,.ag-spanned-row{color:var(--ag-cell-text-color);font-family:var(--ag-cell-font-family);font-size:var(--ag-data-font-size);white-space:nowrap;--ag-internal-content-line-height:calc(min(var(--ag-row-height), var(--ag-line-height, 1000px)) - var(--ag-internal-row-border-width, 1px) - 2px)}.ag-row{background-color:var(--ag-background-color);border-bottom:var(--ag-row-border);height:var(--ag-row-height);width:100%;&.ag-row-editing-invalid{background-color:var(--ag-full-row-edit-invalid-background-color)}}:where(.ag-body-vertical-content-no-gap>div>div>div,.ag-body-vertical-content-no-gap>div>div>div>div)>.ag-row-last{border-bottom-color:transparent}.ag-sticky-bottom{border-top:var(--ag-row-border);box-sizing:content-box!important}.ag-group-contracted,.ag-group-expanded{cursor:pointer}.ag-cell,.ag-full-width-row .ag-cell-wrapper.ag-row-group{border:1px solid transparent;line-height:var(--ag-internal-content-line-height);-webkit-font-smoothing:subpixel-antialiased}:where(.ag-ltr) .ag-cell{border-right:var(--ag-column-border)}:where(.ag-rtl) .ag-cell{border-left:var(--ag-column-border)}.ag-spanned-cell-wrapper{background-color:var(--ag-background-color);position:absolute}.ag-spanned-cell-wrapper>.ag-spanned-cell{display:block;position:relative}:where(.ag-ltr) :where(.ag-body-horizontal-content-no-gap) .ag-column-last{border-right-color:transparent}:where(.ag-rtl) :where(.ag-body-horizontal-content-no-gap) .ag-column-last{border-left-color:transparent}.ag-cell-wrapper{align-items:center;display:flex;>:where(:not(.ag-cell-value,.ag-group-value)){align-items:center;display:flex;height:var(--ag-internal-content-line-height)}&:where(.ag-row-group){align-items:flex-start}:where(.ag-full-width-row) &:where(.ag-row-group){align-items:center;height:100%}}:where(.ag-ltr) .ag-cell-wrapper{padding-left:calc(var(--ag-indentation-level)*var(--ag-row-group-indent-size))}:where(.ag-rtl) .ag-cell-wrapper{padding-right:calc(var(--ag-indentation-level)*var(--ag-row-group-indent-size))}:where(.ag-cell-wrap-text:not(.ag-cell-auto-height)) .ag-cell-wrapper{align-items:normal;height:100%;:where(.ag-cell-value){height:100%}}:where(.ag-ltr) .ag-row>.ag-cell-wrapper.ag-row-group{padding-left:calc(var(--ag-cell-horizontal-padding) + var(--ag-row-group-indent-size)*var(--ag-indentation-level))}:where(.ag-rtl) .ag-row>.ag-cell-wrapper.ag-row-group{padding-right:calc(var(--ag-cell-horizontal-padding) + var(--ag-row-group-indent-size)*var(--ag-indentation-level))}.ag-cell-focus:not(.ag-cell-range-selected):focus-within,.ag-cell-range-single-cell,.ag-cell-range-single-cell.ag-cell-range-handle,.ag-context-menu-open .ag-cell-focus:not(.ag-cell-range-selected),.ag-context-menu-open .ag-full-width-row.ag-row-focus .ag-cell-wrapper.ag-row-group,.ag-full-width-row.ag-row-focus:focus .ag-cell-wrapper.ag-row-group{border:1px solid;border-color:var(--ag-range-selection-border-color);border-style:var(--ag-range-selection-border-style);outline:initial}.ag-full-width-row.ag-row-focus:focus{box-shadow:none}:where(.ag-ltr) .ag-group-contracted,:where(.ag-ltr) .ag-group-expanded,:where(.ag-ltr) .ag-row-drag,:where(.ag-ltr) .ag-selection-checkbox{margin-right:var(--ag-cell-widget-spacing)}:where(.ag-rtl) .ag-group-contracted,:where(.ag-rtl) .ag-group-expanded,:where(.ag-rtl) .ag-row-drag,:where(.ag-rtl) .ag-selection-checkbox{margin-left:var(--ag-cell-widget-spacing)}:where(.ag-ltr) .ag-group-child-count{margin-left:3px}:where(.ag-rtl) .ag-group-child-count{margin-right:3px}.ag-row-highlight-above:after,.ag-row-highlight-below:after,.ag-row-highlight-inside:after{background-color:var(--ag-range-selection-border-color);content:"";height:1px;pointer-events:none;position:absolute;width:calc(100% - 1px)}:where(.ag-ltr) .ag-row-highlight-above:after,:where(.ag-ltr) .ag-row-highlight-below:after,:where(.ag-ltr) .ag-row-highlight-inside:after{left:1px}:where(.ag-rtl) .ag-row-highlight-above:after,:where(.ag-rtl) .ag-row-highlight-below:after,:where(.ag-rtl) .ag-row-highlight-inside:after{right:1px}.ag-row-highlight-above:after{top:0}.ag-row-highlight-below:after{bottom:0}.ag-row-highlight-indent:after{display:block;width:auto}:where(.ag-ltr) .ag-row-highlight-indent:after{left:calc((var(--ag-cell-widget-spacing) + var(--ag-icon-size))*2 + var(--ag-cell-horizontal-padding) + var(--ag-row-highlight-level)*var(--ag-row-group-indent-size));right:1px}:where(.ag-rtl) .ag-row-highlight-indent:after{left:1px;right:calc((var(--ag-cell-widget-spacing) + var(--ag-icon-size))*2 + var(--ag-cell-horizontal-padding) + var(--ag-row-highlight-level)*var(--ag-row-group-indent-size))}.ag-row-highlight-inside:after{background-color:var(--ag-selected-row-background-color);border:1px solid var(--ag-range-selection-border-color);display:block;height:auto;inset:0;width:auto}.ag-row-odd{background-color:var(--ag-odd-row-background-color)}.ag-row-selected:before{background-color:var(--ag-selected-row-background-color);content:"";display:block;inset:0;pointer-events:none;position:absolute}.ag-row-hover.ag-full-width-row.ag-row-group:before,.ag-row-hover:not(.ag-full-width-row):before{background-color:var(--ag-row-hover-color);content:"";display:block;inset:0;pointer-events:none;position:absolute}.ag-row-hover.ag-row-selected:before{background-color:var(--ag-row-hover-color);background-image:linear-gradient(var(--ag-selected-row-background-color),var(--ag-selected-row-background-color))}.ag-row.ag-full-width-row.ag-row-group>*{position:relative}.ag-column-hover{background-color:var(--ag-column-hover-color)}.ag-header-range-highlight{background-color:var(--ag-range-header-highlight-color)}.ag-right-aligned-cell{font-variant-numeric:tabular-nums}:where(.ag-ltr) .ag-right-aligned-cell{text-align:right}:where(.ag-rtl) .ag-right-aligned-cell{text-align:left}.ag-right-aligned-cell .ag-cell-value,.ag-right-aligned-cell .ag-group-value{margin-left:auto}:where(.ag-ltr) .ag-cell:not(.ag-cell-inline-editing),:where(.ag-ltr) .ag-full-width-row .ag-cell-wrapper.ag-row-group{padding-left:calc(var(--ag-cell-horizontal-padding) - 1px + var(--ag-row-group-indent-size)*var(--ag-indentation-level));padding-right:calc(var(--ag-cell-horizontal-padding) - 1px)}:where(.ag-rtl) .ag-cell:not(.ag-cell-inline-editing),:where(.ag-rtl) .ag-full-width-row .ag-cell-wrapper.ag-row-group{padding-left:calc(var(--ag-cell-horizontal-padding) - 1px);padding-right:calc(var(--ag-cell-horizontal-padding) - 1px + var(--ag-row-group-indent-size)*var(--ag-indentation-level))}.ag-row>.ag-cell-wrapper{padding-left:calc(var(--ag-cell-horizontal-padding) - 1px);padding-right:calc(var(--ag-cell-horizontal-padding) - 1px)}.ag-row-dragging{cursor:move;opacity:.5}.ag-details-row{background-color:var(--ag-background-color);padding:calc(var(--ag-spacing)*3.75)}.ag-layout-auto-height,.ag-layout-print{.ag-center-cols-container,.ag-center-cols-viewport{min-height:150px}}.ag-overlay-loading-wrapper{background-color:var(--ag-modal-overlay-background-color)}.ag-skeleton-container{align-content:center;height:100%;width:100%}.ag-skeleton-effect{animation:ag-skeleton-loading 1.5s ease-in-out .5s infinite;background-color:var(--ag-row-loading-skeleton-effect-color);border-radius:.25rem;height:1em;width:100%}:where(.ag-ltr) .ag-right-aligned-cell .ag-skeleton-effect{margin-left:auto}:where(.ag-rtl) .ag-right-aligned-cell .ag-skeleton-effect{margin-right:auto}@keyframes ag-skeleton-loading{0%{background-color:var(--ag-row-loading-skeleton-effect-color)}50%{background-color:color-mix(in srgb,transparent,var(--ag-row-loading-skeleton-effect-color) 40%)}to{background-color:var(--ag-row-loading-skeleton-effect-color)}}.ag-loading{align-items:center;display:flex;height:100%}:where(.ag-ltr) .ag-loading{padding-left:var(--ag-cell-horizontal-padding)}:where(.ag-rtl) .ag-loading{padding-right:var(--ag-cell-horizontal-padding)}:where(.ag-ltr) .ag-loading-icon{padding-right:var(--ag-cell-widget-spacing)}:where(.ag-rtl) .ag-loading-icon{padding-left:var(--ag-cell-widget-spacing)}.ag-icon-loading{animation-duration:1s;animation-iteration-count:infinite;animation-name:spin;animation-timing-function:linear}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.ag-header{background-color:var(--ag-header-background-color);border-bottom:var(--ag-header-row-border);color:var(--ag-header-text-color);display:flex;font-family:var(--ag-header-font-family);font-size:var(--ag-header-font-size);font-weight:var(--ag-header-font-weight);overflow:hidden;white-space:nowrap;width:100%}.ag-header-row{height:var(--ag-header-height);position:absolute}.ag-floating-filter-button-button,.ag-header-cell-filter-button,.ag-header-cell-menu-button,.ag-header-expand-icon,.ag-panel-title-bar-button,:where(.ag-header-cell-sortable) .ag-header-cell-label{cursor:pointer}:where(.ag-ltr) .ag-header-expand-icon{margin-left:4px}:where(.ag-rtl) .ag-header-expand-icon{margin-right:4px}.ag-header-row:where(:not(:first-child)){:where(.ag-header-cell:not(.ag-header-span-height.ag-header-span-total,.ag-header-parent-hidden),.ag-header-group-cell.ag-header-group-cell-with-group){border-top:var(--ag-header-row-border)}}.ag-header-row:where(:not(.ag-header-row-column-group)){overflow:hidden}:where(.ag-header.ag-header-allow-overflow) .ag-header-row{overflow:visible}.ag-header-cell{display:inline-flex;overflow:hidden}.ag-header-group-cell{contain:paint;display:flex}.ag-header-cell,.ag-header-group-cell{align-items:center;gap:var(--ag-cell-widget-spacing);height:100%;padding:0 var(--ag-cell-horizontal-padding);position:absolute}@property --ag-internal-moving-color{syntax:"<color>";inherits:false;initial-value:transparent}@property --ag-internal-hover-color{syntax:"<color>";inherits:false;initial-value:transparent}.ag-header-cell:where(:not(.ag-floating-filter)),.ag-header-group-cell{&:before{background-image:linear-gradient(var(--ag-internal-hover-color),var(--ag-internal-hover-color)),linear-gradient(var(--ag-internal-moving-color),var(--ag-internal-moving-color));content:"";inset:0;position:absolute;--ag-internal-moving-color:transparent;--ag-internal-hover-color:transparent;transition:--ag-internal-moving-color var(--ag-header-cell-background-transition-duration),--ag-internal-hover-color var(--ag-header-cell-background-transition-duration)}&:where(:hover):before{--ag-internal-hover-color:var(--ag-header-cell-hover-background-color)}&:where(.ag-header-cell-moving):before{--ag-internal-moving-color:var(--ag-header-cell-moving-background-color);--ag-internal-hover-color:var(--ag-header-cell-hover-background-color)}}:where(.ag-header-cell:not(.ag-floating-filter) *,.ag-header-group-cell *){position:relative;z-index:1}.ag-header-cell-menu-button:where(:not(.ag-header-menu-always-show)){opacity:0;transition:opacity .2s}.ag-header-cell-filter-button,:where(.ag-header-cell.ag-header-active) .ag-header-cell-menu-button{opacity:1}.ag-header-cell-label,.ag-header-group-cell-label{align-items:center;align-self:stretch;display:flex;flex:1 1 auto;overflow:hidden;padding:5px 0}:where(.ag-ltr) .ag-sort-indicator-icon{padding-left:var(--ag-spacing)}:where(.ag-rtl) .ag-sort-indicator-icon{padding-right:var(--ag-spacing)}.ag-header-cell-label{text-overflow:ellipsis}.ag-header-group-cell-label.ag-sticky-label{flex:none;max-width:100%;overflow:visible;position:sticky}:where(.ag-ltr) .ag-header-group-cell-label.ag-sticky-label{left:var(--ag-cell-horizontal-padding)}:where(.ag-rtl) .ag-header-group-cell-label.ag-sticky-label{right:var(--ag-cell-horizontal-padding)}.ag-header-cell-text,.ag-header-group-text{overflow:hidden;text-overflow:ellipsis}.ag-header-cell-text{word-break:break-word}.ag-header-cell-comp-wrapper{width:100%}:where(.ag-header-group-cell) .ag-header-cell-comp-wrapper{display:flex}:where(.ag-header-cell:not(.ag-header-cell-auto-height)) .ag-header-cell-comp-wrapper{align-items:center;display:flex;height:100%}.ag-header-cell-wrap-text .ag-header-cell-comp-wrapper{white-space:normal}.ag-header-cell-comp-wrapper-limited-height>*{overflow:hidden}:where(.ag-right-aligned-header) .ag-header-cell-label{flex-direction:row-reverse}:where(.ag-ltr) :where(.ag-header-cell:not(.ag-right-aligned-header)){.ag-header-label-icon,.ag-header-menu-icon{margin-left:var(--ag-spacing)}}:where(.ag-rtl) :where(.ag-header-cell:not(.ag-right-aligned-header)){.ag-header-label-icon,.ag-header-menu-icon{margin-right:var(--ag-spacing)}}:where(.ag-ltr) :where(.ag-header-cell.ag-right-aligned-header){.ag-header-label-icon,.ag-header-menu-icon{margin-right:var(--ag-spacing)}}:where(.ag-rtl) :where(.ag-header-cell.ag-right-aligned-header){.ag-header-label-icon,.ag-header-menu-icon{margin-left:var(--ag-spacing)}}.ag-header-cell:after,.ag-header-group-cell:where(:not(.ag-header-span-height.ag-header-group-cell-no-group)):after{content:"";height:var(--ag-header-column-border-height);position:absolute;top:calc(50% - var(--ag-header-column-border-height)*.5);z-index:1}:where(.ag-ltr) .ag-header-cell:after,:where(.ag-ltr) .ag-header-group-cell:where(:not(.ag-header-span-height.ag-header-group-cell-no-group)):after{border-right:var(--ag-header-column-border);right:0}:where(.ag-rtl) .ag-header-cell:after,:where(.ag-rtl) .ag-header-group-cell:where(:not(.ag-header-span-height.ag-header-group-cell-no-group)):after{border-left:var(--ag-header-column-border);left:0}.ag-header-highlight-after:after,.ag-header-highlight-before:after{background-color:var(--ag-accent-color);content:"";height:100%;position:absolute;width:1px}:where(.ag-ltr) .ag-header-highlight-before:after{left:0}:where(.ag-rtl) .ag-header-highlight-before:after{right:0}:where(.ag-ltr) .ag-header-highlight-after:after{right:0;:where(.ag-pinned-left-header) &{right:1px}}:where(.ag-rtl) .ag-header-highlight-after:after{left:0;:where(.ag-pinned-left-header) &{left:1px}}.ag-header-cell-resize{align-items:center;cursor:ew-resize;display:flex;height:100%;position:absolute;top:0;width:8px;z-index:2;&:after{background-color:var(--ag-header-column-resize-handle-color);content:"";height:var(--ag-header-column-resize-handle-height);position:absolute;top:calc(50% - var(--ag-header-column-resize-handle-height)*.5);width:var(--ag-header-column-resize-handle-width);z-index:1}}:where(.ag-ltr) .ag-header-cell-resize{right:-3px;&:after{left:calc(50% - var(--ag-header-column-resize-handle-width))}}:where(.ag-rtl) .ag-header-cell-resize{left:-3px;&:after{right:calc(50% - var(--ag-header-column-resize-handle-width))}}:where(.ag-header-cell.ag-header-span-height) .ag-header-cell-resize:after{height:calc(100% - var(--ag-spacing)*4);top:calc(var(--ag-spacing)*2)}.ag-header-group-cell-no-group:where(.ag-header-span-height){display:none}.ag-sort-indicator-container{display:flex;gap:var(--ag-spacing)}.ag-layout-print{&.ag-body{display:block;height:unset}&.ag-root-wrapper{display:inline-block}.ag-body-horizontal-scroll,.ag-body-vertical-scroll{display:none}&.ag-force-vertical-scroll{overflow-y:visible!important}}@media print{.ag-root-wrapper.ag-layout-print{display:table;.ag-body-horizontal-scroll-viewport,.ag-body-viewport,.ag-center-cols-container,.ag-center-cols-viewport,.ag-root,.ag-root-wrapper-body,.ag-virtual-list-viewport{display:block!important;height:auto!important;overflow:hidden!important}.ag-cell,.ag-row{-moz-column-break-inside:avoid;break-inside:avoid}}}ag-grid,ag-grid-angular{display:block}.ag-root-wrapper{border:var(--ag-wrapper-border);border-radius:var(--ag-wrapper-border-radius);display:flex;flex-direction:column;overflow:hidden;position:relative;&.ag-layout-normal{height:100%}}.ag-root-wrapper-body{display:flex;flex-direction:row;&.ag-layout-normal{flex:1 1 auto;height:0;min-height:0}}.ag-root{display:flex;flex-direction:column;position:relative;&.ag-layout-auto-height,&.ag-layout-normal{flex:1 1 auto;overflow:hidden;width:0}&.ag-layout-normal{height:100%}}.ag-virtual-list-item{height:var(--ag-list-item-height);position:absolute;width:100%}.ag-list-item-hovered:after{background-color:var(--ag-accent-color);content:"";height:1px;left:0;position:absolute;right:0}.ag-item-highlight-top:after{top:0}.ag-item-highlight-bottom:after{bottom:0}.ag-drag-handle{color:var(--ag-drag-handle-color);cursor:grab;:where(.ag-icon){color:var(--ag-drag-handle-color)}}.ag-chart-menu-icon,.ag-chart-settings-next,.ag-chart-settings-prev,.ag-column-group-icons,.ag-column-select-header-icon,.ag-filter-toolpanel-expand,.ag-floating-filter-button-button,.ag-group-title-bar-icon,.ag-header-cell-filter-button,.ag-header-cell-menu-button,.ag-header-expand-icon,.ag-panel-title-bar-button,.ag-panel-title-bar-button-icon,.ag-set-filter-group-icons,:where(.ag-group-contracted) .ag-icon,:where(.ag-group-expanded) .ag-icon{background-color:var(--ag-icon-button-background-color);border-radius:var(--ag-icon-button-border-radius);box-shadow:0 0 0 var(--ag-icon-button-background-spread) var(--ag-icon-button-background-color);color:var(--ag-icon-button-color);&:hover{background-color:var(--ag-icon-button-hover-background-color);box-shadow:0 0 0 var(--ag-icon-button-background-spread) var(--ag-icon-button-hover-background-color);color:var(--ag-icon-button-hover-color)}}.ag-filter-active{background-image:linear-gradient(var(--ag-icon-button-active-background-color),var(--ag-icon-button-active-background-color));border-radius:1px;outline:solid var(--ag-icon-button-background-spread) var(--ag-icon-button-active-background-color);position:relative;&:after{background-color:var(--ag-icon-button-active-indicator-color);border-radius:50%;content:"";height:6px;position:absolute;top:-1px;width:6px}:where(.ag-icon-filter){clip-path:path("M8,0C8,4.415 11.585,8 16,8L16,16L0,16L0,0L8,0Z");color:var(--ag-icon-button-active-color)}}:where(.ag-ltr) .ag-filter-active{&:after{right:-1px}}:where(.ag-rtl) .ag-filter-active{&:after{left:-1px}}.ag-menu{background-color:var(--ag-menu-background-color);border:var(--ag-menu-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-menu-shadow);color:var(--ag-menu-text-color);max-height:100%;overflow-y:auto;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}'
), EP = {
  wrapperBorder: !0,
  rowBorder: !0,
  headerRowBorder: !0,
  footerRowBorder: {
    ref: "rowBorder"
  },
  columnBorder: {
    style: "solid",
    width: 1,
    color: "transparent"
  },
  headerColumnBorder: !1,
  headerColumnBorderHeight: "100%",
  pinnedColumnBorder: !0,
  pinnedRowBorder: !0,
  sidePanelBorder: !0,
  sideBarPanelWidth: 250,
  sideBarBackgroundColor: {
    ref: "chromeBackgroundColor"
  },
  sideButtonBarBackgroundColor: {
    ref: "sideBarBackgroundColor"
  },
  sideButtonBarTopPadding: 0,
  sideButtonSelectedUnderlineWidth: 2,
  sideButtonSelectedUnderlineColor: "transparent",
  sideButtonSelectedUnderlineTransitionDuration: 0,
  sideButtonBackgroundColor: "transparent",
  sideButtonTextColor: { ref: "textColor" },
  sideButtonHoverBackgroundColor: { ref: "sideButtonBackgroundColor" },
  sideButtonHoverTextColor: { ref: "sideButtonTextColor" },
  sideButtonSelectedBackgroundColor: ht,
  sideButtonSelectedTextColor: { ref: "sideButtonTextColor" },
  sideButtonBorder: "solid 1px transparent",
  sideButtonSelectedBorder: !0,
  sideButtonLeftPadding: { ref: "spacing" },
  sideButtonRightPadding: { ref: "spacing" },
  sideButtonVerticalPadding: { calc: "spacing * 3" },
  headerBackgroundColor: {
    ref: "chromeBackgroundColor"
  },
  headerFontFamily: {
    ref: "fontFamily"
  },
  cellFontFamily: {
    ref: "fontFamily"
  },
  headerFontWeight: 500,
  headerFontSize: {
    ref: "fontSize"
  },
  dataFontSize: {
    ref: "fontSize"
  },
  headerTextColor: {
    ref: "textColor"
  },
  headerCellHoverBackgroundColor: "transparent",
  headerCellMovingBackgroundColor: { ref: "headerCellHoverBackgroundColor" },
  headerCellBackgroundTransitionDuration: "0.2s",
  cellTextColor: {
    ref: "textColor"
  },
  rangeSelectionBorderStyle: "solid",
  rangeSelectionBorderColor: Cs,
  rangeSelectionBackgroundColor: $t(0.2),
  rangeSelectionChartBackgroundColor: "#0058FF1A",
  rangeSelectionChartCategoryBackgroundColor: "#00FF841A",
  rangeSelectionHighlightColor: $t(0.5),
  rangeHeaderHighlightColor: Ty(0.08),
  rowNumbersSelectedColor: $t(0.5),
  rowHoverColor: $t(0.08),
  columnHoverColor: $t(0.05),
  selectedRowBackgroundColor: $t(0.12),
  modalOverlayBackgroundColor: {
    ref: "backgroundColor",
    mix: 0.66
  },
  oddRowBackgroundColor: ht,
  wrapperBorderRadius: 8,
  cellHorizontalPadding: {
    calc: "spacing * 2 * cellHorizontalPaddingScale"
  },
  cellWidgetSpacing: {
    calc: "spacing * 1.5"
  },
  cellHorizontalPaddingScale: 1,
  rowGroupIndentSize: {
    calc: "cellWidgetSpacing + iconSize"
  },
  valueChangeDeltaUpColor: "#43a047",
  valueChangeDeltaDownColor: "#e53935",
  valueChangeValueHighlightBackgroundColor: "#16a08580",
  rowHeight: {
    calc: "max(iconSize, dataFontSize) + spacing * 3.25 * rowVerticalPaddingScale"
  },
  rowVerticalPaddingScale: 1,
  headerHeight: {
    calc: "max(iconSize, dataFontSize) + spacing * 4 * headerVerticalPaddingScale"
  },
  headerVerticalPaddingScale: 1,
  paginationPanelHeight: {
    ref: "rowHeight",
    calc: "max(rowHeight, 22px)"
  },
  dragHandleColor: Pt(0.7),
  headerColumnResizeHandleHeight: "30%",
  headerColumnResizeHandleWidth: 2,
  headerColumnResizeHandleColor: {
    ref: "borderColor"
  },
  widgetContainerHorizontalPadding: {
    calc: "spacing * 1.5"
  },
  widgetContainerVerticalPadding: {
    calc: "spacing * 1.5"
  },
  widgetHorizontalSpacing: {
    calc: "spacing * 1.5"
  },
  widgetVerticalSpacing: {
    ref: "spacing"
  },
  iconButtonColor: { ref: "iconColor" },
  iconButtonBackgroundColor: "transparent",
  iconButtonBackgroundSpread: 4,
  iconButtonBorderRadius: 1,
  iconButtonHoverColor: { ref: "iconButtonColor" },
  iconButtonHoverBackgroundColor: Pt(0.1),
  iconButtonActiveColor: Cs,
  iconButtonActiveBackgroundColor: $t(0.28),
  iconButtonActiveIndicatorColor: Cs,
  menuBorder: {
    color: Pt(0.2)
  },
  menuBackgroundColor: Tt(0.03),
  menuTextColor: Tt(0.95),
  menuShadow: {
    ref: "popupShadow"
  },
  menuSeparatorColor: {
    ref: "borderColor"
  },
  setFilterIndentSize: {
    ref: "iconSize"
  },
  chartMenuPanelWidth: 260,
  chartMenuLabelColor: Pt(0.8),
  dialogShadow: {
    ref: "popupShadow"
  },
  cellEditingBorder: {
    color: Cs
  },
  cellEditingShadow: { ref: "cardShadow" },
  fullRowEditInvalidBackgroundColor: {
    ref: "invalidColor",
    onto: "backgroundColor",
    mix: 0.25
  },
  dialogBorder: {
    color: Pt(0.2)
  },
  panelBackgroundColor: ht,
  panelTitleBarBackgroundColor: {
    ref: "headerBackgroundColor"
  },
  panelTitleBarIconColor: {
    ref: "headerTextColor"
  },
  panelTitleBarTextColor: {
    ref: "headerTextColor"
  },
  panelTitleBarFontWeight: {
    ref: "headerFontWeight"
  },
  panelTitleBarBorder: !0,
  columnSelectIndentSize: {
    ref: "iconSize"
  },
  toolPanelSeparatorBorder: !0,
  columnDropCellBackgroundColor: Pt(0.07),
  columnDropCellTextColor: {
    ref: "textColor"
  },
  columnDropCellDragHandleColor: {
    ref: "textColor"
  },
  columnDropCellBorder: {
    color: Pt(0.13)
  },
  selectCellBackgroundColor: Pt(0.07),
  selectCellBorder: {
    color: Pt(0.13)
  },
  advancedFilterBuilderButtonBarBorder: !0,
  advancedFilterBuilderIndentSize: {
    calc: "spacing * 2 + iconSize"
  },
  advancedFilterBuilderJoinPillColor: "#f08e8d",
  advancedFilterBuilderColumnPillColor: "#a6e194",
  advancedFilterBuilderOptionPillColor: "#f3c08b",
  advancedFilterBuilderValuePillColor: "#85c0e4",
  filterPanelApplyButtonColor: ht,
  filterPanelApplyButtonBackgroundColor: Cs,
  filterPanelCardSubtleColor: {
    ref: "textColor",
    mix: 0.7
  },
  filterPanelCardSubtleHoverColor: { ref: "textColor" },
  findMatchColor: Zi,
  findMatchBackgroundColor: "#ffff00",
  findActiveMatchColor: Zi,
  findActiveMatchBackgroundColor: "#ffa500",
  filterToolPanelGroupIndent: {
    ref: "spacing"
  },
  rowLoadingSkeletonEffectColor: Pt(0.15),
  statusBarLabelColor: Zi,
  statusBarLabelFontWeight: 500,
  statusBarValueColor: Zi,
  statusBarValueFontWeight: 500,
  pinnedSourceRowTextColor: {
    ref: "textColor"
  },
  pinnedSourceRowBackgroundColor: {
    ref: "backgroundColor"
  },
  pinnedSourceRowFontWeight: 600,
  pinnedRowFontWeight: 600,
  pinnedRowBackgroundColor: {
    ref: "backgroundColor"
  },
  pinnedRowTextColor: {
    ref: "textColor"
  }
}, TP = (
  /*css*/
  ".ag-cell-batch-edit{background-color:var(--ag-cell-batch-edit-background-color);color:var(--ag-cell-batch-edit-text-color);display:inherit}.ag-row-batch-edit{background-color:var(--ag-row-batch-edit-background-color);color:var(--ag-row-batch-edit-text-color)}"
), _f = {
  cellBatchEditBackgroundColor: "rgba(220 181 139 / 16%)",
  cellBatchEditTextColor: "#422f00",
  rowBatchEditBackgroundColor: {
    ref: "cellBatchEditBackgroundColor"
  },
  rowBatchEditTextColor: {
    ref: "cellBatchEditTextColor"
  }
}, MP = {
  ..._f,
  cellBatchEditTextColor: "#f3d0b3"
}, DP = () => ss({
  feature: "batchEditStyle",
  params: _f,
  css: TP
}), AP = /* @__PURE__ */ DP(), IP = (
  /*css*/
  ":where(.ag-button){background:none;border:none;color:inherit;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0;text-indent:inherit;text-shadow:inherit;text-transform:inherit;word-spacing:inherit;&:disabled{cursor:default}&:focus-visible{box-shadow:var(--ag-focus-shadow);outline:none}}.ag-standard-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--ag-button-background-color);border:var(--ag-button-border);border-radius:var(--ag-button-border-radius);color:var(--ag-button-text-color);cursor:pointer;font-weight:var(--ag-button-font-weight);padding:var(--ag-button-vertical-padding) var(--ag-button-horizontal-padding);&:hover{background-color:var(--ag-button-hover-background-color);border:var(--ag-button-hover-border);color:var(--ag-button-hover-text-color)}&:active{background-color:var(--ag-button-active-background-color);border:var(--ag-button-active-border);color:var(--ag-button-active-text-color)}&:disabled{background-color:var(--ag-button-disabled-background-color);border:var(--ag-button-disabled-border);color:var(--ag-button-disabled-text-color)}}"
), LP = {
  buttonTextColor: "inherit",
  buttonFontWeight: "normal",
  buttonBackgroundColor: "transparent",
  buttonBorder: !1,
  buttonBorderRadius: { ref: "borderRadius" },
  buttonHorizontalPadding: { calc: "spacing * 2" },
  buttonVerticalPadding: { ref: "spacing" },
  buttonHoverTextColor: { ref: "buttonTextColor" },
  buttonHoverBackgroundColor: { ref: "buttonBackgroundColor" },
  buttonHoverBorder: { ref: "buttonBorder" },
  buttonActiveTextColor: { ref: "buttonHoverTextColor" },
  buttonActiveBackgroundColor: { ref: "buttonHoverBackgroundColor" },
  buttonActiveBorder: { ref: "buttonHoverBorder" },
  buttonDisabledTextColor: { ref: "inputDisabledTextColor" },
  buttonDisabledBackgroundColor: { ref: "inputDisabledBackgroundColor" },
  buttonDisabledBorder: { ref: "inputDisabledBorder" }
}, kP = () => ss({
  feature: "buttonStyle",
  params: {
    ...LP,
    buttonBackgroundColor: ht,
    buttonBorder: !0,
    buttonHoverBackgroundColor: { ref: "rowHoverColor" },
    buttonActiveBorder: { color: Cs }
  },
  css: IP
}), GP = /* @__PURE__ */ kP(), OP = (
  /*css*/
  ".ag-column-drop-vertical-empty-message{align-items:center;border:dashed var(--ag-border-width);border-color:var(--ag-border-color);display:flex;inset:0;justify-content:center;margin:calc(var(--ag-spacing)*1.5) calc(var(--ag-spacing)*2);overflow:hidden;padding:calc(var(--ag-spacing)*2);position:absolute}"
), VP = () => ss({
  feature: "columnDropStyle",
  css: OP
}), Uf = /* @__PURE__ */ VP(), BP = {
  warn: (...e) => {
    F(e[0], e[1]);
  },
  error: (...e) => {
    j(e[0], e[1]);
  },
  preInitErr: (...e) => {
    Nr(e[0], e[2], e[1]);
  }
}, NP = () => Ny(BP).withParams(EP).withPart(GP).withPart(Uf).withPart(AP), HP = (
  /*css*/
  '.ag-checkbox-input-wrapper,.ag-radio-button-input-wrapper{background-color:var(--ag-checkbox-unchecked-background-color);border:solid var(--ag-checkbox-border-width) var(--ag-checkbox-unchecked-border-color);flex:none;height:var(--ag-icon-size);position:relative;width:var(--ag-icon-size);:where(input){-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;display:block;height:var(--ag-icon-size);margin:0;opacity:0;width:var(--ag-icon-size)}&:after{content:"";display:block;inset:0;-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;pointer-events:none;position:absolute}&:where(.ag-checked){background-color:var(--ag-checkbox-checked-background-color);border-color:var(--ag-checkbox-checked-border-color);&:after{background-color:var(--ag-checkbox-checked-shape-color)}}&:where(:focus-within,:active){box-shadow:var(--ag-focus-shadow)}&:where(.ag-disabled){filter:grayscale();opacity:.5}}.ag-checkbox-input-wrapper{border-radius:var(--ag-checkbox-border-radius);&:where(.ag-checked):after{-webkit-mask-image:var(--ag-checkbox-checked-shape-image);mask-image:var(--ag-checkbox-checked-shape-image)}&:where(.ag-indeterminate){background-color:var(--ag-checkbox-indeterminate-background-color);border-color:var(--ag-checkbox-indeterminate-border-color);&:after{background-color:var(--ag-checkbox-indeterminate-shape-color);-webkit-mask-image:var(--ag-checkbox-indeterminate-shape-image);mask-image:var(--ag-checkbox-indeterminate-shape-image)}}}.ag-cell-editing-error .ag-checkbox-input-wrapper:focus-within{box-shadow:var(--ag-focus-error-shadow)}.ag-radio-button-input-wrapper{border-radius:100%;&:where(.ag-checked):after{-webkit-mask-image:var(--ag-radio-checked-shape-image);mask-image:var(--ag-radio-checked-shape-image)}}'
), zP = () => ss({
  feature: "checkboxStyle",
  params: {
    checkboxBorderWidth: 1,
    checkboxBorderRadius: {
      ref: "borderRadius"
    },
    checkboxUncheckedBackgroundColor: ht,
    checkboxUncheckedBorderColor: Tt(0.3),
    checkboxCheckedBackgroundColor: Cs,
    checkboxCheckedBorderColor: { ref: "checkboxCheckedBackgroundColor" },
    checkboxCheckedShapeImage: {
      svg: '<svg xmlns="http://www.w3.org/2000/svg" width="10" height="7" fill="none"><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.75" d="M1 3.5 3.5 6l5-5"/></svg>'
    },
    checkboxCheckedShapeColor: ht,
    checkboxIndeterminateBackgroundColor: Tt(0.3),
    checkboxIndeterminateBorderColor: { ref: "checkboxIndeterminateBackgroundColor" },
    checkboxIndeterminateShapeImage: {
      svg: '<svg xmlns="http://www.w3.org/2000/svg" width="10" height="2" fill="none"><rect width="10" height="2" fill="#000" rx="1"/></svg>'
    },
    checkboxIndeterminateShapeColor: ht,
    radioCheckedShapeImage: {
      svg: '<svg xmlns="http://www.w3.org/2000/svg" width="6" height="6" fill="none"><circle cx="3" cy="3" r="3" fill="#000"/></svg>'
    }
  },
  css: HP
}), WP = /* @__PURE__ */ zP(), $f = () => ({
  ...Lo,
  ...MP,
  backgroundColor: "hsl(217, 0%, 17%)",
  foregroundColor: "#FFF",
  chromeBackgroundColor: Tt(0.05),
  rowHoverColor: $t(0.15),
  selectedRowBackgroundColor: $t(0.2),
  menuBackgroundColor: Tt(0.1),
  browserColorScheme: "dark",
  popupShadow: "0 0px 20px #000A",
  cardShadow: "0 1px 4px 1px #000A",
  advancedFilterBuilderJoinPillColor: "#7a3a37",
  advancedFilterBuilderColumnPillColor: "#355f2d",
  advancedFilterBuilderOptionPillColor: "#5a3168",
  advancedFilterBuilderValuePillColor: "#374c86",
  filterPanelApplyButtonColor: Zi,
  findMatchColor: ht,
  findActiveMatchColor: ht,
  checkboxUncheckedBorderColor: Tt(0.4),
  toggleButtonOffBackgroundColor: Tt(0.4),
  rowBatchEditBackgroundColor: Tt(0.1)
}), _P = () => ({
  ...$f(),
  backgroundColor: "#1f2836"
}), UP = () => ss({
  feature: "colorScheme",
  params: Lo,
  modeParams: {
    light: Lo,
    dark: $f(),
    "dark-blue": _P()
  }
}), $P = /* @__PURE__ */ UP(), Kf = {
  aggregation: '<path d="M18 7V4H6l6 8-6 8h12v-3"/>',
  arrows: '<polyline points="5 9 2 12 5 15"/><polyline points="9 5 12 2 15 5"/><polyline points="15 19 12 22 9 19"/><polyline points="19 9 22 12 19 15"/><line x1="2" x2="22" y1="12" y2="12"/><line x1="12" x2="12" y1="2" y2="22"/>',
  asc: '<path d="m5 12 7-7 7 7"/><path d="M12 19V5"/>',
  cancel: '<path d="m18 6-12 12"/><path d="m6 6 12 12"/>',
  chart: '<line x1="18" x2="18" y1="20" y2="10"/><line x1="12" x2="12" y1="20" y2="4"/><line x1="6" x2="6" y1="20" y2="14"/>',
  "color-picker": '<path d="m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z"/><path d="m5 2 5 5"/><path d="M2 13h15"/><path d="M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z"/>',
  columns: '<path d="M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18"/>',
  contracted: '<path d="m9 18 6-6-6-6"/>',
  copy: '<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',
  cross: '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
  csv: '<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><path d="M8 13h2"/><path d="M8 17h2"/><path d="M14 13h2"/><path d="M14 17h2"/>',
  cut: '<circle cx="6" cy="6" r="3"/><path d="M8.12 8.12 12 12"/><path d="M20 4 8.12 15.88"/><circle cx="6" cy="18" r="3"/><path d="M14.8 14.8 20 20"/>',
  desc: '<path d="M12 5v14"/><path d="m19 12-7 7-7-7"/>',
  down: '<path d="M12 5v14"/><path d="m19 12-7 7-7-7"/>',
  excel: '<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/><polyline points="14 2 14 8 20 8"/><path d="M8 13h2"/><path d="M8 17h2"/><path d="M14 13h2"/><path d="M14 17h2"/>',
  expanded: '<path d="m15 18-6-6 6-6"/>',
  "eye-slash": '<path d="M9.88 9.88a3 3 0 1 0 4.24 4.24"/><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><line x1="2" x2="22" y1="2" y2="22"/>',
  eye: '<path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/>',
  filter: '<path d="M3 6h18"/><path d="M7 12h10"/><path d="M10 18h4"/>',
  first: '<path d="m17 18-6-6 6-6"/><path d="M7 6v12"/>',
  group: '<path d="M16 12H3"/><path d="M16 18H3"/><path d="M10 6H3"/><path d="M21 18V8a2 2 0 0 0-2-2h-5"/><path d="m16 8-2-2 2-2"/>',
  last: '<path d="m7 18 6-6-6-6"/><path d="M17 6v12"/>',
  left: '<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>',
  linked: '<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 1 1 0 10h-2"/><line x1="8" x2="16" y1="12" y2="12"/>',
  loading: '<line x1="12" x2="12" y1="2" y2="6"/><line x1="12" x2="12" y1="18" y2="22"/><line x1="4.93" x2="7.76" y1="4.93" y2="7.76"/><line x1="16.24" x2="19.07" y1="16.24" y2="19.07"/><line x1="2" x2="6" y1="12" y2="12"/><line x1="18" x2="22" y1="12" y2="12"/><line x1="4.93" x2="7.76" y1="19.07" y2="16.24"/><line x1="16.24" x2="19.07" y1="7.76" y2="4.93"/>',
  maximize: '<polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" x2="14" y1="3" y2="10"/><line x1="3" x2="10" y1="21" y2="14"/>',
  menu: '<line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/>',
  "menu-alt": '<circle cx="12" cy="5" r="0.75" fill="#D9D9D9"/><circle cx="12" cy="12" r="0.75" fill="#D9D9D9"/><circle cx="12" cy="19" r="0.75" fill="#D9D9D9"/>',
  minimize: '<polyline points="4 14 10 14 10 20"/><polyline points="20 10 14 10 14 4"/><line x1="14" x2="21" y1="10" y2="3"/><line x1="3" x2="10" y1="21" y2="14"/>',
  minus: '<circle cx="12" cy="12" r="10"/><path d="M8 12h8"/>',
  next: '<path d="m9 18 6-6-6-6"/>',
  none: '<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>',
  "not-allowed": '<circle cx="12" cy="12" r="10"/><path d="m4.9 4.9 14.2 14.2"/>',
  paste: '<path d="M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z"/><path d="M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10"/><path d="m17 10 4 4-4 4"/>',
  pin: '<line x1="12" x2="12" y1="17" y2="22"/><path d="M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"/>',
  pivot: '<path d="M15 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M21 9H3"/><path d="M21 15H3"/>',
  plus: '<circle cx="12" cy="12" r="10"/><path d="M8 12h8"/><path d="M12 8v8"/>',
  previous: '<path d="m15 18-6-6 6-6"/>',
  right: '<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',
  save: '<path d="M12 17V3"/><path d="m6 11 6 6 6-6"/><path d="M19 21H5"/>',
  "small-left": '<path d="m15 18-6-6 6-6"/>',
  "small-right": '<path d="m9 18 6-6-6-6"/>',
  tick: '<path d="M20 6 9 17l-5-5"/>',
  "tree-closed": '<path d="m9 18 6-6-6-6"/>',
  "tree-indeterminate": '<path d="M5 12h14"/>',
  "tree-open": '<path d="m6 9 6 6 6-6"/>',
  unlinked: '<path d="M9 17H7A5 5 0 0 1 7 7"/><path d="M15 7h2a5 5 0 0 1 4 8"/><line x1="8" x2="12" y1="12" y2="12"/><line x1="2" x2="22" y1="2" y2="22"/>',
  up: '<path d="m5 12 7-7 7 7"/><path d="M12 19V5"/>',
  grip: '<circle cx="5" cy="8" r="0.5"/><circle cx="12" cy="8" r="0.5"/><circle cx="19" cy="8" r="0.5"/><circle cx="5" cy="16" r="0.5"/><circle cx="12" cy="16" r="0.5"/><circle cx="19" cy="16" r="0.5"/><g stroke="none" fill="currentColor"><circle cx="5" cy="8" r="1"/><circle cx="12" cy="8" r="1"/><circle cx="19" cy="8" r="1"/><circle cx="5" cy="16" r="1"/><circle cx="12" cy="16" r="1"/><circle cx="19" cy="16" r="1"/></g>',
  settings: '<path d="M20 7h-9"/><path d="M14 17H5"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/>'
}, jf = {
  "column-arrow": '<svg xmlns="http://www.w3.org/2000/svg" class="ag-icon" fill="none" viewBox="0 0 32 32"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 26C0 28.2092 1.79086 30 4 30H14C16.2091 30 18 28.2092 18 26V15H25.8786L24.4394 16.4393C23.8536 17.0251 23.8536 17.9749 24.4394 18.5607C25.0252 19.1464 25.9748 19.1464 26.5606 18.5607L30.5606 14.5607C31.1464 13.9749 31.1464 13.0251 30.5606 12.4393L26.5606 8.43934C25.9748 7.85356 25.0252 7.85356 24.4394 8.43934C23.8536 9.02512 23.8536 9.97488 24.4394 10.5607L25.8786 12H18V6C18 3.79086 16.2091 2 14 2H4C1.79086 2 0 3.79086 0 6V26ZM14 5H10.5V12H15V6C15 5.44772 14.5523 5 14 5ZM4 5H7.5V12H3V6C3 5.44772 3.44772 5 4 5ZM10.5 15H15V26C15 26.5522 14.5523 27 14 27H10.5V15ZM4 27H7.5V15H3V26C3 26.5522 3.44772 27 4 27Z" fill="currentColor"/></svg>',
  "small-down": '<svg xmlns="http://www.w3.org/2000/svg" class="ag-icon" fill="black" stroke="none" viewBox="0 0 32 32"><path d="M7.334 10.667 16 21.334l8.667-10.667H7.334Z"/></svg>',
  "small-up": '<svg xmlns="http://www.w3.org/2000/svg" class="ag-icon" fill="black" stroke="none" viewBox="0 0 32 32"><path d="M7.334 21.333 16 10.666l8.667 10.667H7.334Z"/></svg>',
  "pinned-top": '<svg xmlns="http://www.w3.org/2000/svg" class="ag-icon" fill="none" viewBox="0 0 16 16"><path fill="currentColor" d="M12.53 3.72A.75.75 0 0 1 12 5H4a.75.75 0 0 1 0-1.5h8a.75.75 0 0 1 .53.22ZM3.269 10.744a.75.75 0 0 1 .2-.524l4-4a.75.75 0 0 1 1.06 0l4 4a.75.75 0 1 1-1.06 1.06L8.75 8.56V14a.75.75 0 0 1-1.5 0V8.56l-2.72 2.72a.75.75 0 0 1-1.26-.536Z"/></svg>',
  "pinned-bottom": '<svg xmlns="http://www.w3.org/2000/svg" fill="none" class="ag-icon" viewBox="0 0 16 16"><path fill="currentColor" d="M3.47 12.28A.75.75 0 0 1 4 11h8a.75.75 0 0 1 0 1.5H4a.75.75 0 0 1-.53-.22ZM12.731 5.256a.75.75 0 0 1-.2.524l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06l2.72 2.72V2a.75.75 0 0 1 1.5 0v5.44l2.72-2.72a.75.75 0 0 1 1.26.536Z"/></svg>',
  "un-pin": '<svg xmlns="http://www.w3.org/2000/svg" fill="none" class="ag-icon" viewBox="0 0 16 16"><path fill="currentColor" d="M8 11a.75.75 0 0 0-.75.75v3.333a.75.75 0 1 0 1.5 0V11.75A.75.75 0 0 0 8 11Z"/><path fill="currentColor" d="M13.11 1.436a.75.75 0 0 0-1.22-.872l-10 14a.75.75 0 1 0 1.22.872L5.207 12.5h7.376a.75.75 0 0 0 .75-.75v-1.174a2.08 2.08 0 0 0-1.153-1.863l-1.185-.599-.005-.002a.58.58 0 0 1-.323-.522V5.165a2.083 2.083 0 0 0 1.854-2.904l.589-.825Zm-3.943 5.52v.634a2.08 2.08 0 0 0 1.153 1.863l1.185.6.005.002a.58.58 0 0 1 .323.522V11H6.28l2.887-4.044ZM9.277 1H5.25a2.084 2.084 0 0 0-.083 4.165v1.676l1.5-2.132v-.292a.75.75 0 0 0-.75-.75H5.25a.584.584 0 0 1 0-1.167h2.972L9.277 1Z"/></svg>',
  "chevron-down": '<svg width="16" height="16" viewBox="0 0 16 16" class="ag-icon" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 6L8 10L4 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',
  "chevron-up": '<svg width="16" height="16" viewBox="0 0 16 16" class="ag-icon" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 10L8 6L12 10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',
  "chevron-left": '<svg width="16" height="16" viewBox="0 0 16 16" class="ag-icon" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 12L6 8L10 4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',
  "chevron-right": '<svg width="16" height="16" viewBox="0 0 16 16" class="ag-icon" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6 12L10 8L6 4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',
  "filter-add": '<svg width="16" height="16" viewBox="0 0 16 16" class="ag-icon" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.12126 7.75L10.8517 7.75" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/><path d="M6.65934 11.748L9.32778 11.748" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/><path d="M12.2943 1.04872V6.19184M14.9886 3.74341H9.68478" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/><path d="M8.25488 3C8.04799 3.18323 7.91706 3.45099 7.91699 3.74902C7.91713 4.04868 8.04988 4.31681 8.25879 4.5H2C1.58579 4.5 1.25 4.16421 1.25 3.75C1.25 3.33579 1.58579 3 2 3H8.25488Z" fill="currentColor"/></svg>',
  edit: '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 10.6262V12.5012H5.375L10.905 6.97122L9.03 5.09622L3.5 10.6262ZM12.355 5.52122C12.4014 5.47497 12.4381 5.42002 12.4632 5.35953C12.4883 5.29905 12.5012 5.23421 12.5012 5.16872C12.5012 5.10324 12.4883 5.0384 12.4632 4.97791C12.4381 4.91742 12.4014 4.86248 12.355 4.81622L11.185 3.64622C11.1387 3.59987 11.0838 3.5631 11.0233 3.53801C10.9628 3.51291 10.898 3.5 10.8325 3.5C10.767 3.5 10.7022 3.51291 10.6417 3.53801C10.5812 3.5631 10.5263 3.59987 10.48 3.64622L9.565 4.56122L11.44 6.43622L12.355 5.52122Z" fill="currentColor"/></svg>'
}, KP = (e = {}) => {
  let t = "";
  for (const s of [...Object.keys(Kf), ...Object.keys(jf)]) {
    const i = jP(s, e.strokeWidth);
    t += `.ag-icon-${s}::before { mask-image: url('data:image/svg+xml,${encodeURIComponent(i)}'); }
`;
  }
  return t;
}, jP = (e, t = 1.5) => {
  const s = jf[e];
  if (s)
    return s;
  const i = Kf[e];
  if (!i)
    throw new Error(`Missing icon data for ${e}`);
  return `<svg xmlns="http://www.w3.org/2000/svg" class="ag-icon" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="black" stroke-width="${t}" viewBox="0 0 24 24"><style>* { vector-effect: non-scaling-stroke; }</style>` + i + "</svg>";
}, YP = (e = {}) => ss({
  feature: "iconSet",
  css: () => KP(e)
}), qP = /* @__PURE__ */ YP(), XP = (
  /*css*/
  ':where(.ag-input-field-input[type=number]:not(.ag-number-field-input-stepper)){-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}}.ag-input-field-input:where(input:not([type]),input[type=text],input[type=number],input[type=tel],input[type=date],input[type=datetime-local],textarea){background-color:var(--ag-input-background-color);border:var(--ag-input-border);border-radius:var(--ag-input-border-radius);color:var(--ag-input-text-color);font-family:inherit;font-size:inherit;line-height:inherit;margin:0;min-height:var(--ag-input-height);padding:0;&:where(:disabled){background-color:var(--ag-input-disabled-background-color);border:var(--ag-input-disabled-border);color:var(--ag-input-disabled-text-color)}&:where(:focus){background-color:var(--ag-input-focus-background-color);border:var(--ag-input-focus-border);box-shadow:var(--ag-input-focus-shadow);color:var(--ag-input-focus-text-color);outline:none}&:where(:invalid){background-color:var(--ag-input-invalid-background-color);border:var(--ag-input-invalid-border);color:var(--ag-input-invalid-text-color)}&:where(.invalid){background-color:var(--ag-input-invalid-background-color);border:var(--ag-input-invalid-border);color:var(--ag-input-invalid-text-color)}&::-moz-placeholder{color:var(--ag-input-placeholder-text-color)}&::placeholder{color:var(--ag-input-placeholder-text-color)}}:where(.ag-ltr) .ag-input-field-input:where(input:not([type]),input[type=text],input[type=number],input[type=tel],input[type=date],input[type=datetime-local],textarea){padding-left:var(--ag-input-padding-start)}:where(.ag-rtl) .ag-input-field-input:where(input:not([type]),input[type=text],input[type=number],input[type=tel],input[type=date],input[type=datetime-local],textarea){padding-right:var(--ag-input-padding-start)}:where(.ag-column-select-header-filter-wrapper,.ag-filter-toolpanel-search,.ag-mini-filter,.ag-filter-filter,.ag-filter-add-select){.ag-input-wrapper:before{background-color:currentcolor;color:var(--ag-input-icon-color);content:"";display:block;height:12px;-webkit-mask-image:url("data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMiIgaGVpZ2h0PSIxMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMS41Ij48cGF0aCBkPSJNNS4zIDlhMy43IDMuNyAwIDEgMCAwLTcuNSAzLjcgMy43IDAgMCAwIDAgNy41Wk0xMC41IDEwLjUgOC4zIDguMiIvPjwvc3ZnPg==");mask-image:url("data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMiIgaGVpZ2h0PSIxMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMS41Ij48cGF0aCBkPSJNNS4zIDlhMy43IDMuNyAwIDEgMCAwLTcuNSAzLjcgMy43IDAgMCAwIDAgNy41Wk0xMC41IDEwLjUgOC4zIDguMiIvPjwvc3ZnPg==");-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;opacity:.5;position:absolute;width:12px}}:where(.ag-ltr) :where(.ag-column-select-header-filter-wrapper,.ag-filter-toolpanel-search,.ag-mini-filter,.ag-filter-filter,.ag-filter-add-select){.ag-input-wrapper:before{margin-left:var(--ag-spacing)}.ag-number-field-input,.ag-text-field-input{padding-left:calc(var(--ag-spacing)*1.5 + 12px)}}:where(.ag-rtl) :where(.ag-column-select-header-filter-wrapper,.ag-filter-toolpanel-search,.ag-mini-filter,.ag-filter-filter,.ag-filter-add-select){.ag-input-wrapper:before{margin-right:var(--ag-spacing)}.ag-number-field-input,.ag-text-field-input{padding-right:calc(var(--ag-spacing)*1.5 + 12px)}}'
), ZP = (
  /*css*/
  ".ag-input-field-input:where(input:not([type]),input[type=text],input[type=number],input[type=tel],input[type=date],input[type=datetime-local],textarea){&:focus{box-shadow:var(--ag-focus-shadow);&:where(.invalid),&:where(:invalid){box-shadow:var(--ag-focus-error-shadow)}}}"
), QP = {
  inputBackgroundColor: "transparent",
  inputBorder: !1,
  inputBorderRadius: 0,
  inputTextColor: {
    ref: "textColor"
  },
  inputPlaceholderTextColor: {
    ref: "inputTextColor",
    mix: 0.5
  },
  inputPaddingStart: 0,
  inputHeight: {
    calc: "max(iconSize, fontSize) + spacing * 2"
  },
  inputFocusBackgroundColor: {
    ref: "inputBackgroundColor"
  },
  inputFocusBorder: {
    ref: "inputBorder"
  },
  inputFocusShadow: "none",
  inputFocusTextColor: {
    ref: "inputTextColor"
  },
  inputDisabledBackgroundColor: {
    ref: "inputBackgroundColor"
  },
  inputDisabledBorder: {
    ref: "inputBorder"
  },
  inputDisabledTextColor: {
    ref: "inputTextColor"
  },
  inputInvalidBackgroundColor: {
    ref: "inputBackgroundColor"
  },
  inputInvalidBorder: {
    ref: "inputBorder"
  },
  inputInvalidTextColor: {
    ref: "inputTextColor"
  },
  inputIconColor: {
    ref: "inputTextColor"
  },
  pickerButtonBorder: !1,
  pickerButtonFocusBorder: { ref: "inputFocusBorder" },
  pickerButtonBackgroundColor: { ref: "backgroundColor" },
  pickerButtonFocusBackgroundColor: { ref: "backgroundColor" },
  pickerListBorder: !1,
  pickerListBackgroundColor: { ref: "backgroundColor" },
  colorPickerThumbSize: 18,
  colorPickerTrackSize: 12,
  colorPickerThumbBorderWidth: 3,
  colorPickerTrackBorderRadius: 12,
  colorPickerColorBorderRadius: 4
}, JP = () => ss({
  feature: "inputStyle",
  params: {
    ...QP,
    inputBackgroundColor: ht,
    inputBorder: !0,
    inputBorderRadius: {
      ref: "borderRadius"
    },
    inputPaddingStart: {
      ref: "spacing"
    },
    inputFocusBorder: {
      color: Cs
    },
    inputFocusShadow: {
      ref: "focusShadow"
    },
    inputDisabledBackgroundColor: Tt(0.06),
    inputDisabledTextColor: {
      ref: "textColor",
      mix: 0.5
    },
    inputInvalidBorder: {
      color: { ref: "invalidColor" }
    },
    pickerButtonBorder: !0,
    pickerListBorder: !0
  },
  css: () => XP + ZP
}), eE = /* @__PURE__ */ JP(), tE = (
  /*css*/
  '.ag-tabs-header{background-color:var(--ag-tab-bar-background-color);border-bottom:var(--ag-tab-bar-border);display:flex;flex:1;gap:var(--ag-tab-spacing);padding:var(--ag-tab-bar-top-padding) var(--ag-tab-bar-horizontal-padding) 0}.ag-tabs-header-wrapper{display:flex}.ag-tabs-close-button-wrapper{align-items:center;border:0;display:flex;padding:var(--ag-spacing)}:where(.ag-ltr) .ag-tabs-close-button-wrapper{border-right:solid var(--ag-border-width) var(--ag-border-color)}:where(.ag-rtl) .ag-tabs-close-button-wrapper{border-left:solid var(--ag-border-width) var(--ag-border-color)}.ag-tabs-close-button{background-color:unset;border:0;cursor:pointer;padding:0}.ag-tab{align-items:center;background-color:var(--ag-tab-background-color);border-left:var(--ag-tab-selected-border-width) solid transparent;border-right:var(--ag-tab-selected-border-width) solid transparent;color:var(--ag-tab-text-color);cursor:pointer;display:flex;flex:1;justify-content:center;padding:var(--ag-tab-top-padding) var(--ag-tab-horizontal-padding) var(--ag-tab-bottom-padding);position:relative;&:hover{background-color:var(--ag-tab-hover-background-color);color:var(--ag-tab-hover-text-color)}&.ag-tab-selected{background-color:var(--ag-tab-selected-background-color);color:var(--ag-tab-selected-text-color)}&:after{background-color:var(--ag-tab-selected-underline-color);bottom:0;content:"";display:block;height:var(--ag-tab-selected-underline-width);left:0;opacity:0;position:absolute;right:0;transition:opacity var(--ag-tab-selected-underline-transition-duration)}&.ag-tab-selected:after{opacity:1}}:where(.ag-ltr) .ag-tab{&.ag-tab-selected{&:where(:not(:first-of-type)){border-left-color:var(--ag-tab-selected-border-color)}&:where(:not(:last-of-type)){border-right-color:var(--ag-tab-selected-border-color)}}}:where(.ag-rtl) .ag-tab{&.ag-tab-selected{&:where(:not(:first-of-type)){border-right-color:var(--ag-tab-selected-border-color)}&:where(:not(:last-of-type)){border-left-color:var(--ag-tab-selected-border-color)}}}'
), sE = {
  tabBarBackgroundColor: "transparent",
  tabBarHorizontalPadding: 0,
  tabBarTopPadding: 0,
  tabBackgroundColor: "transparent",
  tabTextColor: {
    ref: "textColor"
  },
  tabHorizontalPadding: {
    ref: "spacing"
  },
  tabTopPadding: {
    ref: "spacing"
  },
  tabBottomPadding: {
    ref: "spacing"
  },
  tabSpacing: "0",
  tabHoverBackgroundColor: {
    ref: "tabBackgroundColor"
  },
  tabHoverTextColor: {
    ref: "tabTextColor"
  },
  tabSelectedBackgroundColor: {
    ref: "tabBackgroundColor"
  },
  tabSelectedTextColor: {
    ref: "tabTextColor"
  },
  tabSelectedBorderWidth: { ref: "borderWidth" },
  tabSelectedBorderColor: "transparent",
  tabSelectedUnderlineColor: "transparent",
  tabSelectedUnderlineWidth: 0,
  tabSelectedUnderlineTransitionDuration: 0,
  tabBarBorder: !1
}, iE = () => ss({
  feature: "tabStyle",
  params: {
    ...sE,
    tabBarBorder: !0,
    tabBarBackgroundColor: Pt(0.05),
    tabTextColor: {
      ref: "textColor",
      mix: 0.7
    },
    tabSelectedTextColor: {
      ref: "textColor"
    },
    tabHoverTextColor: {
      ref: "textColor"
    },
    tabSelectedBorderColor: {
      ref: "borderColor"
    },
    tabSelectedBackgroundColor: ht
  },
  css: tE
}), rE = /* @__PURE__ */ iE(), nE = () => NP().withPart(WP).withPart($P).withPart(qP).withPart(rE).withPart(eE).withPart(Uf).withParams({
  fontFamily: [
    { googleFont: "IBM Plex Sans" },
    "-apple-system",
    "BlinkMacSystemFont",
    "Segoe UI",
    "Roboto",
    "Oxygen-Sans",
    "Ubuntu"
  ]
}), Yf = /* @__PURE__ */ nE(), oE = {
  cssName: "--ag-cell-horizontal-padding",
  changeKey: "cellHorizontalPaddingChanged",
  defaultValue: 16
}, aE = {
  cssName: "--ag-indentation-level",
  changeKey: "indentationLevelChanged",
  defaultValue: 0,
  noWarn: !0,
  cacheDefault: !0
}, lE = {
  cssName: "--ag-row-group-indent-size",
  changeKey: "rowGroupIndentSizeChanged",
  defaultValue: 0
}, Qh = {
  cssName: "--ag-row-height",
  changeKey: "rowHeightChanged",
  defaultValue: 42
}, Jh = {
  cssName: "--ag-header-height",
  changeKey: "headerHeightChanged",
  defaultValue: 48
}, eu = {
  cssName: "--ag-list-item-height",
  changeKey: "listItemHeightChanged",
  defaultValue: 24
}, hl = {
  cssName: "--ag-row-border",
  changeKey: "rowBorderWidthChanged",
  defaultValue: 1,
  border: !0
}, tu = {
  cssName: "--ag-pinned-row-border",
  changeKey: "pinnedRowBorderWidthChanged",
  defaultValue: 1,
  border: !0
};
function cE(e, t) {
  t.sort((s, i) => s.moduleName.localeCompare(i.moduleName)).forEach((s) => {
    const i = s.css;
    i && e.set(`module-${s.moduleName}`, i);
  });
}
var dE = class extends Yy {
  constructor() {
    super(...arguments), this.sizeEls = /* @__PURE__ */ new Map(), this.lastKnownValues = /* @__PURE__ */ new Map(), this.sizesMeasured = !1;
  }
  initVariables() {
    this.addManagedPropertyListener("rowHeight", () => this.refreshRowHeightVariable()), this.getSizeEl(Qh), this.getSizeEl(Jh), this.getSizeEl(eu), this.getSizeEl(hl), this.getSizeEl(tu), this.refreshRowBorderWidthVariable();
  }
  getPinnedRowBorderWidth() {
    return this.getCSSVariablePixelValue(tu);
  }
  getRowBorderWidth() {
    return this.getCSSVariablePixelValue(hl);
  }
  getDefaultRowHeight() {
    return this.getCSSVariablePixelValue(Qh);
  }
  getDefaultHeaderHeight() {
    return this.getCSSVariablePixelValue(Jh);
  }
  getDefaultCellHorizontalPadding() {
    return this.getCSSVariablePixelValue(oE);
  }
  getCellPaddingLeft() {
    const e = this.getDefaultCellHorizontalPadding(), t = this.getCSSVariablePixelValue(aE), s = this.getCSSVariablePixelValue(lE);
    return e - 1 + s * t;
  }
  getCellPadding() {
    const e = this.getDefaultCellHorizontalPadding() - 1;
    return this.getCellPaddingLeft() + e;
  }
  getDefaultColumnMinWidth() {
    return Math.min(36, this.getDefaultRowHeight());
  }
  getDefaultListItemHeight() {
    return this.getCSSVariablePixelValue(eu);
  }
  refreshRowHeightVariable() {
    const { eRootDiv: e } = this, t = e.style.getPropertyValue("--ag-line-height").trim(), s = this.gos.get("rowHeight");
    if (s == null || isNaN(s) || !isFinite(s))
      return t !== null && e.style.setProperty("--ag-line-height", null), -1;
    const i = `${s}px`;
    return t != i ? (e.style.setProperty("--ag-line-height", i), s) : t != "" ? parseFloat(t) : -1;
  }
  getCSSVariablePixelValue(e) {
    const t = this.lastKnownValues.get(e);
    if (t != null)
      return t;
    const s = this.measureSizeEl(e);
    return s === "detached" || s === "no-styles" ? (e.cacheDefault && this.lastKnownValues.set(e, e.defaultValue), e.defaultValue) : (this.lastKnownValues.set(e, s), s);
  }
  measureSizeEl(e) {
    const t = this.getSizeEl(e);
    if (t.offsetParent == null)
      return "detached";
    const s = t.offsetWidth;
    return s === ul ? "no-styles" : (this.sizesMeasured = !0, s);
  }
  getMeasurementContainer() {
    let e = this.eMeasurementContainer;
    return e || (e = this.eMeasurementContainer = K({ tag: "div", cls: "ag-measurement-container" }), this.eRootDiv.appendChild(e)), e;
  }
  getSizeEl(e) {
    let t = this.sizeEls.get(e);
    if (t)
      return t;
    const s = this.getMeasurementContainer();
    t = K({ tag: "div" });
    const { border: i, noWarn: r } = e;
    i ? (t.className = "ag-measurement-element-border", t.style.setProperty(
      "--ag-internal-measurement-border",
      `var(${e.cssName}, solid ${ul}px)`
    )) : t.style.width = `var(${e.cssName}, ${ul}px)`, s.appendChild(t), this.sizeEls.set(e, t);
    let n = this.measureSizeEl(e);
    n === "no-styles" && !r && F(9, { variable: e });
    const o = os(this.beans, t, () => {
      const a = this.measureSizeEl(e);
      a === "detached" || a === "no-styles" || (this.lastKnownValues.set(e, a), a !== n && (n = a, this.fireStylesChangedEvent(e.changeKey)));
    });
    return this.addDestroyFunc(() => o()), t;
  }
  fireStylesChangedEvent(e) {
    e === "rowBorderWidthChanged" && this.refreshRowBorderWidthVariable(), this.eventSvc.dispatchEvent({
      type: "gridStylesChanged",
      [e]: !0
    });
  }
  refreshRowBorderWidthVariable() {
    const e = this.getCSSVariablePixelValue(hl);
    this.eRootDiv.style.setProperty("--ag-internal-row-border-width", `${e}px`);
  }
  postProcessThemeChange(e, t) {
    e && getComputedStyle(this.getMeasurementContainer()).getPropertyValue("--ag-legacy-styles-loaded") && j(t ? 106 : 239);
  }
  getAdditionalCss() {
    const e = /* @__PURE__ */ new Map();
    return e.set("core", [PP]), cE(e, Array.from(yP())), e;
  }
  getDefaultTheme() {
    return Yf;
  }
  themeError(e) {
    j(240, { theme: e });
  }
}, ul = 15538, hE = class extends Xy {
  postConstruct() {
    const { globalListener: e, globalSyncListener: t } = this.beans;
    e && this.addGlobalListener(e, !0), t && this.addGlobalListener(t, !1);
  }
};
function qf(e, t, s) {
  const i = e.visibleCols.headerGroupRowCount;
  if (s >= i)
    return {
      column: t,
      headerRowIndex: s
    };
  let r = t.getParent();
  for (; r && r.getProvidedColumnGroup().getLevel() > s; )
    r = r.getParent();
  const n = t.isSpanHeaderHeight();
  return !r || n && r.isPadding() ? {
    column: t,
    headerRowIndex: i
  } : {
    column: r,
    headerRowIndex: r.getProvidedColumnGroup().getLevel()
  };
}
var uE = class extends R {
  constructor() {
    super(...arguments), this.beanName = "headerNavigation", this.currentHeaderRowWithoutSpan = -1;
  }
  postConstruct() {
    const e = this.beans;
    e.ctrlsSvc.whenReady(this, (s) => {
      this.gridBodyCon = s.gridBodyCtrl;
    });
    const t = me(e);
    this.addManagedElementListeners(t, {
      mousedown: () => {
        this.currentHeaderRowWithoutSpan = -1;
      }
    });
  }
  getHeaderPositionForColumn(e, t) {
    let s;
    const { colModel: i, colGroupSvc: r, ctrlsSvc: n } = this.beans;
    if (typeof e == "string" ? (s = i.getCol(e), s || (s = (r == null ? void 0 : r.getColumnGroup(e)) ?? null)) : s = e, !s)
      return null;
    const o = n.getHeaderRowContainerCtrl(), a = o == null ? void 0 : o.getAllCtrls(), l = _(a || []).type === "filter", c = Yt(this.beans) - 1;
    let d = -1, h = s;
    for (; h; )
      d++, h = h.getParent();
    let u = d;
    return t && l && u === c - 1 && u++, u === -1 ? null : {
      headerRowIndex: u,
      column: s
    };
  }
  /*
   * This method navigates grid header vertically
   * @return {boolean} true to preventDefault on the event that caused this navigation.
   */
  navigateVertically(e, t) {
    const { focusSvc: s, visibleCols: i } = this.beans, { focusedHeader: r } = s;
    if (!r)
      return !1;
    const { headerRowIndex: n } = r, o = r.column, a = Yt(this.beans), l = this.getHeaderRowType(n), c = i.headerGroupRowCount;
    let {
      headerRowIndex: d,
      column: h,
      headerRowIndexWithoutSpan: u
    } = e === "UP" ? gE(l, o, n) : pE(o, n, c), g = !1;
    return d < 0 && (d = 0, h = o, g = !0), d >= a ? (d = -1, this.currentHeaderRowWithoutSpan = -1) : u !== void 0 && (this.currentHeaderRowWithoutSpan = u), !g && !h ? !1 : s.focusHeaderPosition({
      headerPosition: { headerRowIndex: d, column: h },
      allowUserOverride: !0,
      event: t
    });
  }
  /*
   * This method navigates grid header horizontally
   * @returns {boolean} true to preventDefault on the event that caused this navigation.
   */
  navigateHorizontally(e, t = !1, s) {
    const { focusSvc: i, gos: r } = this.beans, n = { ...i.focusedHeader };
    let o, a;
    this.currentHeaderRowWithoutSpan !== -1 ? n.headerRowIndex = this.currentHeaderRowWithoutSpan : this.currentHeaderRowWithoutSpan = n.headerRowIndex, e === "LEFT" !== r.get("enableRtl") ? (a = "Before", o = this.findHeader(n, a)) : (a = "After", o = this.findHeader(n, a));
    const l = r.getCallback("tabToNextHeader");
    if (t && l) {
      const c = i.focusHeaderPositionFromUserFunc({
        userFunc: l,
        headerPosition: o,
        direction: a
      });
      if (c) {
        const { headerRowIndex: d } = i.focusedHeader || {};
        d != null && d != n.headerRowIndex && (this.currentHeaderRowWithoutSpan = d);
      }
      return c;
    }
    return o || !t ? i.focusHeaderPosition({
      headerPosition: o,
      direction: a,
      fromTab: t,
      allowUserOverride: !0,
      event: s
    }) : this.focusNextHeaderRow(n, a, s);
  }
  focusNextHeaderRow(e, t, s) {
    const i = this.beans, r = e.headerRowIndex;
    let n = null, o;
    const a = Yt(i), l = this.beans.visibleCols.allCols;
    if (t === "Before") {
      if (r <= 0)
        return !1;
      n = _(l), o = r - 1, this.currentHeaderRowWithoutSpan -= 1;
    } else
      n = l[0], o = r + 1, this.currentHeaderRowWithoutSpan < a ? this.currentHeaderRowWithoutSpan += 1 : this.currentHeaderRowWithoutSpan = -1;
    let { column: c, headerRowIndex: d } = qf(this.beans, n, o);
    return d >= a && (d = -1), i.focusSvc.focusHeaderPosition({
      headerPosition: { column: c, headerRowIndex: d },
      direction: t,
      fromTab: !0,
      allowUserOverride: !0,
      event: s
    });
  }
  scrollToColumn(e, t = "After") {
    if (e.getPinned())
      return;
    let s;
    if (we(e)) {
      const i = e.getDisplayedLeafColumns();
      s = t === "Before" ? _(i) : i[0];
    } else
      s = e;
    this.gridBodyCon.scrollFeature.ensureColumnVisible(s);
  }
  findHeader(e, t) {
    const { colGroupSvc: s, visibleCols: i } = this.beans;
    let r = e.column;
    if (r instanceof an) {
      const l = r.getDisplayedLeafColumns();
      r = t === "Before" ? l[0] : l[l.length - 1];
    }
    const n = t === "Before" ? i.getColBefore(r) : i.getColAfter(r);
    if (!n)
      return;
    const o = i.headerGroupRowCount;
    if (e.headerRowIndex >= o)
      return {
        headerRowIndex: e.headerRowIndex,
        column: n
      };
    const a = s == null ? void 0 : s.getColGroupAtLevel(n, e.headerRowIndex);
    return a ? a.isPadding() && n.isSpanHeaderHeight() ? {
      headerRowIndex: i.headerGroupRowCount,
      column: n
    } : {
      headerRowIndex: e.headerRowIndex,
      column: a ?? n
    } : {
      headerRowIndex: n instanceof Wt && n.isSpanHeaderHeight() ? i.headerGroupRowCount : e.headerRowIndex,
      column: n
    };
  }
  getHeaderRowType(e) {
    const t = this.beans.ctrlsSvc.getHeaderRowContainerCtrl();
    if (t)
      return t.getRowType(e);
  }
};
function gE(e, t, s) {
  const i = s - 1;
  if (e !== "filter") {
    const r = t instanceof Wt && t.isSpanHeaderHeight();
    let n = t.getParent();
    for (; n && // skip if row isn't visible or col is padding and spanned
    (n.getProvidedColumnGroup().getLevel() > i || r && n.isPadding()); )
      n = n.getParent();
    if (n)
      return r ? {
        column: n,
        headerRowIndex: n.getProvidedColumnGroup().getLevel(),
        headerRowIndexWithoutSpan: i
      } : {
        column: n,
        headerRowIndex: i,
        headerRowIndexWithoutSpan: i
      };
  }
  return {
    column: t,
    headerRowIndex: i,
    headerRowIndexWithoutSpan: i
  };
}
function pE(e, t, s) {
  const i = t + 1, r = {
    column: e,
    headerRowIndex: i,
    headerRowIndexWithoutSpan: i
  };
  if (e instanceof an) {
    if (i >= s)
      return {
        column: e.getDisplayedLeafColumns()[0],
        headerRowIndex: s,
        headerRowIndexWithoutSpan: i
      };
    let o = e.getDisplayedChildren()[0];
    if (o instanceof an && o.isPadding()) {
      const l = o.getDisplayedLeafColumns()[0];
      l.isSpanHeaderHeight() && (o = l);
    }
    r.column = o, o instanceof Wt && o.isSpanHeaderHeight() && (r.headerRowIndex = s, r.headerRowIndexWithoutSpan = i);
  }
  return r;
}
var fE = class extends R {
  constructor() {
    super(...arguments), this.beanName = "focusSvc", this.focusFallbackTimeout = null, this.needsFocusRestored = !1;
  }
  wireBeans(e) {
    this.colModel = e.colModel, this.visibleCols = e.visibleCols, this.rowRenderer = e.rowRenderer, this.navigation = e.navigation, this.filterManager = e.filterManager, this.overlays = e.overlays;
  }
  postConstruct() {
    const e = this.clearFocusedCell.bind(this);
    this.addManagedEventListeners({
      columnPivotModeChanged: e,
      newColumnsLoaded: this.onColumnEverythingChanged.bind(this),
      columnGroupOpened: e,
      columnRowGroupChanged: e
    }), this.addDestroyFunc(ny(this.beans));
  }
  attemptToRecoverFocus() {
    this.needsFocusRestored = !0, this.focusFallbackTimeout != null && clearTimeout(this.focusFallbackTimeout), this.focusFallbackTimeout = window.setTimeout(this.setFocusRecovered.bind(this), 100);
  }
  setFocusRecovered() {
    this.needsFocusRestored = !1, this.focusFallbackTimeout != null && (clearTimeout(this.focusFallbackTimeout), this.focusFallbackTimeout = null);
  }
  /**
   * Specifies whether to take focus, as grid either already has focus, or lost it due
   * to a destroyed cell
   * @returns true if the grid should re-take focus, otherwise false
   */
  shouldTakeFocus() {
    return this.gos.get("suppressFocusAfterRefresh") ? (this.setFocusRecovered(), !1) : this.needsFocusRestored ? (this.setFocusRecovered(), !0) : this.doesRowOrCellHaveBrowserFocus();
  }
  onColumnEverythingChanged() {
    if (!this.focusedCell)
      return;
    const e = this.focusedCell.column, t = this.colModel.getCol(e.getId());
    e !== t && this.clearFocusedCell();
  }
  // we check if the browser is focusing something, and if it is, and
  // it's the cell we think is focused, then return the cell. so this
  // methods returns the cell if a) we think it has focus and b) the
  // browser thinks it has focus. this then returns nothing if we
  // first focus a cell, then second click outside the grid, as then the
  // grid cell will still be focused as far as the grid is concerned,
  // however the browser focus will have moved somewhere else.
  getFocusCellToUseAfterRefresh() {
    const { gos: e, focusedCell: t } = this;
    return e.get("suppressFocusAfterRefresh") || e.get("suppressCellFocus") || !t || !this.doesRowOrCellHaveBrowserFocus() ? null : t;
  }
  getFocusHeaderToUseAfterRefresh() {
    return this.gos.get("suppressFocusAfterRefresh") || !this.focusedHeader || !this.isDomDataPresentInHierarchy(Q(this.beans), Sf) ? null : this.focusedHeader;
  }
  /**
   * Check for both cells and rows, as a row might be destroyed and the dom data removed before the cell if the
   * row is animating out.
   */
  doesRowOrCellHaveBrowserFocus() {
    const e = Q(this.beans);
    return this.isDomDataPresentInHierarchy(e, Go) ? !0 : this.isDomDataPresentInHierarchy(e, Oo);
  }
  isDomDataPresentInHierarchy(e, t) {
    let s = e;
    for (; s; ) {
      if (Jg(this.gos, s, t))
        return !0;
      s = s.parentNode;
    }
    return !1;
  }
  getFocusedCell() {
    return this.focusedCell;
  }
  getFocusEventParams(e) {
    const { rowIndex: t, rowPinned: s, column: i } = e, r = {
      rowIndex: t,
      rowPinned: s,
      column: i,
      isFullWidthCell: !1
    }, n = this.rowRenderer.getRowByPosition({ rowIndex: t, rowPinned: s });
    return n && (r.isFullWidthCell = n.isFullWidth()), r;
  }
  clearFocusedCell() {
    if (this.focusedCell == null)
      return;
    const e = this.getFocusEventParams(this.focusedCell);
    this.focusedCell = null, this.eventSvc.dispatchEvent({
      type: "cellFocusCleared",
      ...e
    });
  }
  setFocusedCell(e) {
    this.setFocusRecovered();
    const {
      column: t,
      rowIndex: s,
      rowPinned: i,
      forceBrowserFocus: r = !1,
      preventScrollOnBrowserFocus: n = !1,
      sourceEvent: o
    } = e, a = this.colModel.getCol(t);
    if (!a) {
      this.focusedCell = null;
      return;
    }
    this.focusedCell = {
      rowIndex: s,
      rowPinned: Ce(i),
      column: a
    };
    const l = this.getFocusEventParams(this.focusedCell);
    this.eventSvc.dispatchEvent({
      type: "cellFocused",
      ...l,
      ...this.previousCellFocusParams && { previousParams: this.previousCellFocusParams },
      forceBrowserFocus: r,
      preventScrollOnBrowserFocus: n,
      sourceEvent: o
    }), this.previousCellFocusParams = l;
  }
  isCellFocused(e) {
    return this.focusedCell == null ? !1 : Pn(e, this.focusedCell);
  }
  isHeaderWrapperFocused(e) {
    if (this.focusedHeader == null)
      return !1;
    const {
      column: t,
      rowCtrl: { rowIndex: s, pinned: i }
    } = e, { column: r, headerRowIndex: n } = this.focusedHeader;
    return t === r && s === n && i == r.getPinned();
  }
  focusHeaderPosition(e) {
    var l;
    if (this.setFocusRecovered(), wi(this.beans))
      return !1;
    const { direction: t, fromTab: s, allowUserOverride: i, event: r, fromCell: n, rowWithoutSpanValue: o } = e;
    let { headerPosition: a } = e;
    if (n && ((l = this.filterManager) != null && l.isAdvFilterHeaderActive()))
      return this.focusAdvancedFilter(a);
    if (i) {
      const c = this.focusedHeader, d = Yt(this.beans);
      if (s) {
        const h = this.gos.getCallback("tabToNextHeader");
        h && (a = this.getHeaderPositionFromUserFunc({
          userFunc: h,
          direction: t,
          currentPosition: c,
          headerPosition: a,
          headerRowCount: d
        }));
      } else {
        const h = this.gos.getCallback("navigateToNextHeader");
        if (h && r) {
          const u = {
            key: r.key,
            previousHeaderPosition: c,
            nextHeaderPosition: a,
            headerRowCount: d,
            event: r
          };
          a = h(u);
        }
      }
    }
    return a ? this.focusProvidedHeaderPosition({
      headerPosition: a,
      direction: t,
      event: r,
      fromCell: n,
      rowWithoutSpanValue: o
    }) : !1;
  }
  focusHeaderPositionFromUserFunc(e) {
    if (wi(this.beans))
      return !1;
    const { userFunc: t, headerPosition: s, direction: i, event: r } = e, n = this.focusedHeader, o = Yt(this.beans), a = this.getHeaderPositionFromUserFunc({
      userFunc: t,
      direction: i,
      currentPosition: n,
      headerPosition: s,
      headerRowCount: o
    });
    return !!a && this.focusProvidedHeaderPosition({
      headerPosition: a,
      direction: i,
      event: r
    });
  }
  getHeaderPositionFromUserFunc(e) {
    const { userFunc: t, direction: s, currentPosition: i, headerPosition: r, headerRowCount: n } = e, a = t({
      backwards: s === "Before",
      previousHeaderPosition: i,
      nextHeaderPosition: r,
      headerRowCount: n
    });
    return a === !0 ? i : a === !1 ? null : a;
  }
  focusProvidedHeaderPosition(e) {
    const { headerPosition: t, direction: s, fromCell: i, rowWithoutSpanValue: r, event: n } = e, { column: o, headerRowIndex: a } = t, { filterManager: l, ctrlsSvc: c, headerNavigation: d } = this.beans;
    if (a === -1)
      return l != null && l.isAdvFilterHeaderActive() ? this.focusAdvancedFilter(t) : this.focusGridView({ column: o, event: n });
    d == null || d.scrollToColumn(o, s);
    const h = c.getHeaderRowContainerCtrl(o.getPinned()), u = (h == null ? void 0 : h.focusHeader(t.headerRowIndex, o, n)) || !1;
    return d && u && (r != null || i) && (d.currentHeaderRowWithoutSpan = r ?? -1), u;
  }
  focusFirstHeader() {
    var s;
    if ((s = this.overlays) != null && s.isExclusive() && this.focusOverlay())
      return !0;
    const e = this.visibleCols.allCols[0];
    if (!e)
      return !1;
    const t = qf(this.beans, e, 0);
    return this.focusHeaderPosition({
      headerPosition: t,
      rowWithoutSpanValue: 0
    });
  }
  focusLastHeader(e) {
    var i;
    if ((i = this.overlays) != null && i.isExclusive() && this.focusOverlay(!0))
      return !0;
    const t = Yt(this.beans) - 1, s = _(this.visibleCols.allCols);
    return this.focusHeaderPosition({
      headerPosition: { headerRowIndex: t, column: s },
      rowWithoutSpanValue: -1,
      event: e
    });
  }
  focusPreviousFromFirstCell(e) {
    var t;
    return (t = this.filterManager) != null && t.isAdvFilterHeaderActive() ? this.focusAdvancedFilter(null) : this.focusLastHeader(e);
  }
  isAnyCellFocused() {
    return !!this.focusedCell;
  }
  isRowFocused(e, t) {
    return this.focusedCell == null ? !1 : this.focusedCell.rowIndex === e && this.focusedCell.rowPinned === Ce(t);
  }
  focusOverlay(e) {
    var s, i;
    const t = ((s = this.overlays) == null ? void 0 : s.isVisible()) && ((i = this.overlays.eWrapper) == null ? void 0 : i.getGui());
    return !!t && ye(t, e);
  }
  focusGridView(e) {
    var n, o, a, l, c, d;
    const { backwards: t = !1, canFocusOverlay: s = !0, event: i } = e;
    if ((n = this.overlays) != null && n.isExclusive())
      return s && this.focusOverlay(t);
    if (ya(this.beans))
      return t && !wi(this.beans) ? this.focusLastHeader() : s && this.focusOverlay(t) ? !0 : t ? !1 : rs(this.beans, t);
    const r = t ? If(this.beans) : Af(this.beans);
    if (r) {
      const h = e.column ?? ((o = this.focusedHeader) == null ? void 0 : o.column), { rowIndex: u, rowPinned: g } = r, p = Ee(this.beans, r);
      if (!h || !p || u == null)
        return !1;
      if (h.isSuppressNavigable(p)) {
        const f = this.gos.get("enableRtl");
        let m;
        return !i || i.key === S.TAB ? m = f ? S.LEFT : S.RIGHT : m = i.key, (a = this.beans.navigation) == null || a.navigateToNextCell(
          null,
          m,
          { rowIndex: u, column: h, rowPinned: g || null },
          !0
        ), !0;
      }
      if ((l = this.navigation) == null || l.ensureCellVisible({ rowIndex: u, column: h, rowPinned: g }), t) {
        const f = this.rowRenderer.getRowByPosition(r);
        if (f != null && f.isFullWidth() && ((c = this.navigation) != null && c.tryToFocusFullWidthRow(r, t)))
          return !0;
      }
      return this.setFocusedCell({
        rowIndex: u,
        column: h,
        rowPinned: Ce(g),
        forceBrowserFocus: !0
      }), (d = this.beans.rangeSvc) == null || d.setRangeToCell({ rowIndex: u, rowPinned: g, column: h }), !0;
    }
    return !!(s && this.focusOverlay(t) || t && this.focusLastHeader());
  }
  focusAdvancedFilter(e) {
    var t;
    return this.advFilterFocusColumn = e == null ? void 0 : e.column, ((t = this.beans.advancedFilter) == null ? void 0 : t.getCtrl().focusHeaderComp()) ?? !1;
  }
  focusNextFromAdvancedFilter(e, t) {
    var i;
    const s = (t ? void 0 : this.advFilterFocusColumn) ?? ((i = this.visibleCols.allCols) == null ? void 0 : i[0]);
    return e ? this.focusHeaderPosition({
      headerPosition: {
        column: s,
        headerRowIndex: Yt(this.beans) - 1
      }
    }) : this.focusGridView({ column: s });
  }
  clearAdvancedFilterColumn() {
    this.advFilterFocusColumn = void 0;
  }
}, mE = class extends R {
  constructor() {
    super(...arguments), this.beanName = "scrollVisibleSvc";
  }
  wireBeans(e) {
    this.ctrlsSvc = e.ctrlsSvc, this.colAnimation = e.colAnimation;
  }
  postConstruct() {
    this.horizontalScrollShowing = this.gos.get("alwaysShowHorizontalScroll") === !0, this.verticalScrollShowing = this.gos.get("alwaysShowVerticalScroll") === !0, this.getScrollbarWidth(), this.addManagedEventListeners({
      displayedColumnsChanged: this.updateScrollVisible.bind(this),
      displayedColumnsWidthChanged: this.updateScrollVisible.bind(this)
    });
  }
  updateScrollVisible() {
    const { colAnimation: e } = this;
    e != null && e.isActive() ? e.executeLaterVMTurn(() => {
      e.executeLaterVMTurn(() => this.updateScrollVisibleImpl());
    }) : this.updateScrollVisibleImpl();
  }
  updateScrollVisibleImpl() {
    var s;
    const e = this.ctrlsSvc.get("center");
    if (!e || (s = this.colAnimation) != null && s.isActive())
      return;
    const t = {
      horizontalScrollShowing: e.isHorizontalScrollShowing(),
      verticalScrollShowing: this.verticalScrollShowing
    };
    this.setScrollsVisible(t), this.updateScrollGap();
  }
  updateScrollGap() {
    const e = this.ctrlsSvc.get("center"), t = e.hasHorizontalScrollGap(), s = e.hasVerticalScrollGap();
    (this.horizontalScrollGap !== t || this.verticalScrollGap !== s) && (this.horizontalScrollGap = t, this.verticalScrollGap = s, this.eventSvc.dispatchEvent({
      type: "scrollGapChanged"
    }));
  }
  setScrollsVisible(e) {
    (this.horizontalScrollShowing !== e.horizontalScrollShowing || this.verticalScrollShowing !== e.verticalScrollShowing) && (this.horizontalScrollShowing = e.horizontalScrollShowing, this.verticalScrollShowing = e.verticalScrollShowing, this.eventSvc.dispatchEvent({
      type: "scrollVisibilityChanged"
    }));
  }
  // the user might be using some non-standard scrollbar, eg a scrollbar that has zero
  // width and overlays (like the Safari scrollbar, but presented in Chrome). so we
  // allow the user to provide the scroll width before we work it out.
  getScrollbarWidth() {
    if (this.scrollbarWidth == null) {
      const e = this.gos.get("scrollbarWidth"), s = typeof e == "number" && e >= 0 ? e : Qb();
      s != null && (this.scrollbarWidth = s, this.eventSvc.dispatchEvent({
        type: "scrollbarWidthChanged"
      }));
    }
    return this.scrollbarWidth;
  }
}, CE = class extends R {
  constructor() {
    super(...arguments), this.beanName = "gridDestroySvc", this.destroyCalled = !1;
  }
  destroy() {
    var i;
    if (this.destroyCalled)
      return;
    const { stateSvc: e, ctrlsSvc: t, context: s } = this.beans;
    this.eventSvc.dispatchEvent({
      type: "gridPreDestroyed",
      state: (e == null ? void 0 : e.getState()) ?? {}
    }), this.destroyCalled = !0, (i = t.get("gridCtrl")) == null || i.destroyGridUi(), s.destroy(), super.destroy();
  }
}, co = /* @__PURE__ */ new Set(["gridPreDestroyed", "fillStart", "pasteStart"]), vE = [
  "columnEverythingChanged",
  "newColumnsLoaded",
  "columnPivotModeChanged",
  "pivotMaxColumnsExceeded",
  "columnRowGroupChanged",
  "expandOrCollapseAll",
  "columnPivotChanged",
  "gridColumnsChanged",
  "columnValueChanged",
  "columnMoved",
  "columnVisible",
  "columnPinned",
  "columnGroupOpened",
  "columnResized",
  "displayedColumnsChanged",
  "virtualColumnsChanged",
  "columnHeaderMouseOver",
  "columnHeaderMouseLeave",
  "columnHeaderClicked",
  "columnHeaderContextMenu",
  "asyncTransactionsFlushed",
  "rowGroupOpened",
  "rowDataUpdated",
  "pinnedRowDataChanged",
  "pinnedRowsChanged",
  "rangeSelectionChanged",
  "cellSelectionChanged",
  "chartCreated",
  "chartRangeSelectionChanged",
  "chartOptionsChanged",
  "chartDestroyed",
  "toolPanelVisibleChanged",
  "toolPanelSizeChanged",
  "modelUpdated",
  "cutStart",
  "cutEnd",
  "pasteStart",
  "pasteEnd",
  "fillStart",
  "fillEnd",
  "cellSelectionDeleteStart",
  "cellSelectionDeleteEnd",
  "rangeDeleteStart",
  "rangeDeleteEnd",
  "undoStarted",
  "undoEnded",
  "redoStarted",
  "redoEnded",
  "cellClicked",
  "cellDoubleClicked",
  "cellMouseDown",
  "cellContextMenu",
  "cellValueChanged",
  "cellEditRequest",
  "rowValueChanged",
  "headerFocused",
  "cellFocused",
  "rowSelected",
  "selectionChanged",
  "tooltipShow",
  "tooltipHide",
  "cellKeyDown",
  "cellMouseOver",
  "cellMouseOut",
  "filterChanged",
  "filterModified",
  "filterUiChanged",
  "filterOpened",
  "floatingFilterUiChanged",
  "advancedFilterBuilderVisibleChanged",
  "sortChanged",
  "virtualRowRemoved",
  "rowClicked",
  "rowDoubleClicked",
  "gridReady",
  "gridPreDestroyed",
  "gridSizeChanged",
  "viewportChanged",
  "firstDataRendered",
  "dragStarted",
  "dragStopped",
  "dragCancelled",
  "rowEditingStarted",
  "rowEditingStopped",
  "cellEditingStarted",
  "cellEditingStopped",
  "bodyScroll",
  "bodyScrollEnd",
  "paginationChanged",
  "componentStateChanged",
  "storeRefreshed",
  "stateUpdated",
  "columnMenuVisibleChanged",
  "contextMenuVisibleChanged",
  "rowDragEnter",
  "rowDragMove",
  "rowDragLeave",
  "rowDragEnd",
  "rowDragCancel",
  "findChanged",
  "rowResizeStarted",
  "rowResizeEnded",
  "columnsReset",
  "bulkEditingStarted",
  "bulkEditingStopped",
  "batchEditingStarted",
  "batchEditingStopped"
], Rd = vE.reduce(
  (e, t) => (e[t] = Xw(t), e),
  {}
), Tr = (e, t) => ({
  tag: "span",
  ref: `eSort${e}`,
  cls: `ag-sort-indicator-icon ag-sort-${t} ag-hidden`,
  attrs: { "aria-hidden": "true" }
}), wE = {
  tag: "span",
  cls: "ag-sort-indicator-container",
  children: [
    Tr("Order", "order"),
    Tr("Asc", "ascending-icon"),
    Tr("Desc", "descending-icon"),
    Tr("Mixed", "mixed-icon"),
    Tr("None", "none-icon")
  ]
}, Pd = class extends D {
  constructor(e) {
    super(), this.eSortOrder = x, this.eSortAsc = x, this.eSortDesc = x, this.eSortMixed = x, this.eSortNone = x, e || this.setTemplate(wE);
  }
  attachCustomElements(e, t, s, i, r) {
    this.eSortOrder = e, this.eSortAsc = t, this.eSortDesc = s, this.eSortMixed = i, this.eSortNone = r;
  }
  setupSort(e, t = !1) {
    if (this.column = e, this.suppressOrder = t, this.setupMultiSortIndicator(), !e.isSortable() && !e.getColDef().showRowGroup)
      return;
    this.addInIcon("sortAscending", this.eSortAsc, e), this.addInIcon("sortDescending", this.eSortDesc, e), this.addInIcon("sortUnSort", this.eSortNone, e);
    const s = this.updateIcons.bind(this), i = this.onSortChanged.bind(this);
    this.addManagedPropertyListener("unSortIcon", s), this.addManagedEventListeners({
      newColumnsLoaded: s,
      // Watch global events, as row group columns can effect their display column.
      sortChanged: i,
      // when grouping changes so can sort indexes and icons
      columnRowGroupChanged: i
    }), this.onSortChanged();
  }
  addInIcon(e, t, s) {
    if (t == null)
      return;
    const i = N(e, this.beans, s);
    i && t.appendChild(i);
  }
  onSortChanged() {
    this.updateIcons(), this.suppressOrder || this.updateSortOrder();
  }
  updateIcons() {
    const { eSortAsc: e, eSortDesc: t, eSortNone: s, column: i, gos: r, beans: n } = this, o = n.sortSvc.getDisplaySortForColumn(i);
    if (e && O(e, o === "asc", { skipAriaHidden: !0 }), t && O(t, o === "desc", { skipAriaHidden: !0 }), s) {
      const a = !i.getColDef().unSortIcon && !r.get("unSortIcon"), l = o == null;
      O(s, !a && l, { skipAriaHidden: !0 });
    }
  }
  setupMultiSortIndicator() {
    const { eSortMixed: e, column: t, gos: s } = this;
    this.addInIcon("sortUnSort", e, t);
    const i = t.getColDef().showRowGroup;
    Gt(s) && i && (this.addManagedEventListeners({
      // Watch global events, as row group columns can effect their display column.
      sortChanged: this.updateMultiSortIndicator.bind(this),
      // when grouping changes so can sort indexes and icons
      columnRowGroupChanged: this.updateMultiSortIndicator.bind(this)
    }), this.updateMultiSortIndicator());
  }
  updateMultiSortIndicator() {
    const { eSortMixed: e, beans: t, column: s } = this;
    if (e) {
      const i = t.sortSvc.getDisplaySortForColumn(s) === "mixed";
      O(e, i, { skipAriaHidden: !0 });
    }
  }
  // we listen here for global sort events, NOT column sort events, as we want to do this
  // when sorting has been set on all column (if we listened just for our col (where we
  // set the asc / desc icons) then it's possible other cols are yet to get their sorting state.
  updateSortOrder() {
    const {
      eSortOrder: e,
      column: t,
      beans: { sortSvc: s }
    } = this;
    if (!e)
      return;
    const i = s.getColumnsWithSortingOrdered(), r = s.getDisplaySortIndexForColumn(t) ?? -1, n = i.some(
      (a) => s.getDisplaySortIndexForColumn(a) ?? !1
    ), o = r >= 0 && n;
    O(e, o, { skipAriaHidden: !0 }), r >= 0 ? e.textContent = (r + 1).toString() : X(e);
  }
}, bE = {
  selector: "AG-SORT-INDICATOR",
  component: Pd
}, cn = ["asc", "desc", null], yE = class extends R {
  constructor() {
    super(...arguments), this.beanName = "sortSvc";
  }
  progressSort(e, t, s) {
    const i = this.getNextSortDirection(e);
    this.setSortForColumn(e, i, t, s);
  }
  progressSortFromEvent(e, t) {
    const i = this.gos.get("multiSortKey") === "ctrl" ? t.ctrlKey || t.metaKey : t.shiftKey;
    this.progressSort(e, i, "uiColumnSorted");
  }
  setSortForColumn(e, t, s, i) {
    var d;
    t !== "asc" && t !== "desc" && (t = null);
    const { gos: r, showRowGroupCols: n } = this.beans, o = Gt(r);
    let a = [e];
    if (o && e.getColDef().showRowGroup) {
      const h = (d = n == null ? void 0 : n.getSourceColumnsForGroupColumn) == null ? void 0 : d.call(n, e), u = h == null ? void 0 : h.filter((g) => g.isSortable());
      u && (a = [e, ...u]);
    }
    a.forEach((h) => this.setColSort(h, t, i));
    const l = (s || r.get("alwaysMultiSort")) && !r.get("suppressMultiSort"), c = [];
    if (!l) {
      const h = this.clearSortBarTheseColumns(a, i);
      c.push(...h);
    }
    this.updateSortIndex(e), c.push(...a), this.dispatchSortChangedEvents(i, c);
  }
  updateSortIndex(e) {
    const { gos: t, colModel: s, showRowGroupCols: i } = this.beans, r = Gt(t), n = i == null ? void 0 : i.getShowRowGroupCol(e.getId()), o = r && n || e, a = this.getColumnsWithSortingOrdered();
    s.forAllCols((d) => this.setColSortIndex(d, null));
    const l = a.filter((d) => r && d.getColDef().showRowGroup ? !1 : d !== o);
    (o.getSort() ? [...l, o] : l).forEach((d, h) => this.setColSortIndex(d, h));
  }
  // gets called by API, so if data changes, use can call this, which will end up
  // working out the sort order again of the rows.
  onSortChanged(e, t) {
    this.dispatchSortChangedEvents(e, t);
  }
  isSortActive() {
    let e = !1;
    return this.beans.colModel.forAllCols((t) => {
      t.getSort() && (e = !0);
    }), e;
  }
  dispatchSortChangedEvents(e, t) {
    const s = {
      type: "sortChanged",
      source: e
    };
    t && (s.columns = t), this.eventSvc.dispatchEvent(s);
  }
  clearSortBarTheseColumns(e, t) {
    const s = [];
    return this.beans.colModel.forAllCols((i) => {
      e.includes(i) || (i.getSort() && s.push(i), this.setColSort(i, void 0, t));
    }), s;
  }
  getNextSortDirection(e) {
    const t = e.getColDef().sortingOrder ?? this.gos.get("sortingOrder") ?? cn, s = t.indexOf(e.getSort()), i = s < 0, r = s == t.length - 1;
    return i || r ? t[0] : t[s + 1];
  }
  /**
   * @returns a map of sort indexes for every sorted column, if groups sort primaries then they will have equivalent indices
   */
  getIndexedSortMap() {
    const { gos: e, colModel: t, showRowGroupCols: s, rowGroupColsSvc: i } = this.beans;
    let r = [];
    if (t.forAllCols((c) => {
      c.getSort() && r.push(c);
    }), t.isPivotMode()) {
      const c = Gt(e);
      r = r.filter((d) => {
        const h = !!d.getAggFunc(), u = !d.isPrimary(), g = c ? s == null ? void 0 : s.getShowRowGroupCol(d.getId()) : d.getColDef().showRowGroup;
        return h || u || g;
      });
    }
    const n = (i == null ? void 0 : i.columns.filter((c) => !!c.getSort())) ?? [], o = {};
    r.forEach((c, d) => o[c.getId()] = d), r.sort((c, d) => {
      const h = c.getSortIndex(), u = d.getSortIndex();
      if (h != null && u != null)
        return h - u;
      if (h == null && u == null) {
        const g = o[c.getId()], p = o[d.getId()];
        return g > p ? 1 : -1;
      } else return u == null ? -1 : 1;
    });
    const a = Gt(e) && !!n.length;
    a && (r = [
      ...new Set(
        // if linked sorting, replace all columns with the display group column for index purposes, and ensure uniqueness
        r.map((c) => (s == null ? void 0 : s.getShowRowGroupCol(c.getId())) ?? c)
      )
    ]);
    const l = /* @__PURE__ */ new Map();
    return r.forEach((c, d) => l.set(c, d)), a && n.forEach((c) => {
      const d = s.getShowRowGroupCol(c.getId());
      l.set(c, l.get(d));
    }), l;
  }
  getColumnsWithSortingOrdered() {
    return [...this.getIndexedSortMap().entries()].sort(([, e], [, t]) => e - t).map(([e]) => e);
  }
  // used by server side row models, to sent sort to server
  getSortModel() {
    return this.getColumnsWithSortingOrdered().filter((e) => e.getSort()).map((e) => ({
      sort: e.getSort(),
      colId: e.getId()
    }));
  }
  getSortOptions() {
    return this.getColumnsWithSortingOrdered().filter((e) => e.getSort()).map((e) => ({
      sort: e.getSort(),
      column: e
    }));
  }
  canColumnDisplayMixedSort(e) {
    const t = Gt(this.gos), s = !!e.getColDef().showRowGroup;
    return t && s;
  }
  getDisplaySortForColumn(e) {
    var o;
    const t = (o = this.beans.showRowGroupCols) == null ? void 0 : o.getSourceColumnsForGroupColumn(e);
    if (!this.canColumnDisplayMixedSort(e) || !(t != null && t.length))
      return e.getSort();
    const i = e.getColDef().field != null || !!e.getColDef().valueGetter ? [e, ...t] : t, r = i[0].getSort();
    return i.every((a) => a.getSort() == r) ? r : "mixed";
  }
  getDisplaySortIndexForColumn(e) {
    return this.getIndexedSortMap().get(e);
  }
  setupHeader(e, t, s) {
    let i = 0;
    e.addManagedListeners(t, {
      movingChanged: () => {
        i = Date.now();
      }
    }), s && e.addManagedElementListeners(s, {
      click: (n) => {
        const o = t.isMoving(), l = Date.now() - i < 50;
        o || l || this.progressSortFromEvent(t, n);
      }
    });
    const r = () => {
      var o;
      const n = t.getSort();
      if (e.toggleCss("ag-header-cell-sorted-asc", n === "asc"), e.toggleCss("ag-header-cell-sorted-desc", n === "desc"), e.toggleCss("ag-header-cell-sorted-none", !n), t.getColDef().showRowGroup) {
        const a = (o = this.beans.showRowGroupCols) == null ? void 0 : o.getSourceColumnsForGroupColumn(t), c = !(a == null ? void 0 : a.every(
          (d) => t.getSort() == d.getSort()
        ));
        e.toggleCss("ag-header-cell-sorted-mixed", c);
      }
    };
    e.addManagedEventListeners({
      sortChanged: r,
      columnRowGroupChanged: r
    });
  }
  initCol(e) {
    const { sort: t, initialSort: s, sortIndex: i, initialSortIndex: r } = e.colDef;
    t !== void 0 ? (t === "asc" || t === "desc") && (e.sort = t) : (s === "asc" || s === "desc") && (e.sort = s), i !== void 0 ? i !== null && (e.sortIndex = i) : r !== null && (e.sortIndex = r);
  }
  updateColSort(e, t, s) {
    t !== void 0 && (t === "desc" || t === "asc" ? this.setColSort(e, t, s) : this.setColSort(e, void 0, s));
  }
  setColSort(e, t, s) {
    e.sort !== t && (e.sort = t, e.dispatchColEvent("sortChanged", s)), e.dispatchStateUpdatedEvent("sort");
  }
  setColSortIndex(e, t) {
    e.sortIndex = t, e.dispatchStateUpdatedEvent("sortIndex");
  }
  createSortIndicator(e) {
    return new Pd(e);
  }
  getSortIndicatorSelector() {
    return bE;
  }
}, nr = {
  agSetColumnFilter: "SetFilter",
  agSetColumnFloatingFilter: "SetFilter",
  agMultiColumnFilter: "MultiFilter",
  agMultiColumnFloatingFilter: "MultiFilter",
  agGroupColumnFilter: "GroupFilter",
  agGroupColumnFloatingFilter: "GroupFilter",
  agGroupCellRenderer: "GroupCellRenderer",
  agGroupRowRenderer: "GroupCellRenderer",
  agRichSelect: "RichSelect",
  agRichSelectCellEditor: "RichSelect",
  agDetailCellRenderer: "SharedMasterDetail",
  agSparklineCellRenderer: "Sparklines",
  agDragAndDropImage: "SharedDragAndDrop",
  agColumnHeader: "ColumnHeaderComp",
  agColumnGroupHeader: "ColumnGroupHeaderComp",
  agSortIndicator: "Sort",
  agAnimateShowChangeCellRenderer: "HighlightChanges",
  agAnimateSlideCellRenderer: "HighlightChanges",
  agLoadingCellRenderer: "LoadingCellRenderer",
  agSkeletonCellRenderer: "SkeletonCellRenderer",
  agCheckboxCellRenderer: "CheckboxCellRenderer",
  agLoadingOverlay: "Overlay",
  agNoRowsOverlay: "Overlay",
  agTooltipComponent: "Tooltip",
  agReadOnlyFloatingFilter: "CustomFilter",
  agTextColumnFilter: "TextFilter",
  agNumberColumnFilter: "NumberFilter",
  agDateColumnFilter: "DateFilter",
  agDateInput: "DateFilter",
  agTextColumnFloatingFilter: "TextFilter",
  agNumberColumnFloatingFilter: "NumberFilter",
  agDateColumnFloatingFilter: "DateFilter",
  agCellEditor: "TextEditor",
  agSelectCellEditor: "SelectEditor",
  agTextCellEditor: "TextEditor",
  agNumberCellEditor: "NumberEditor",
  agDateCellEditor: "DateEditor",
  agDateStringCellEditor: "DateEditor",
  agCheckboxCellEditor: "CheckboxEditor",
  agLargeTextCellEditor: "LargeTextEditor",
  agMenuItem: "MenuItem",
  agColumnsToolPanel: "ColumnsToolPanel",
  agFiltersToolPanel: "FiltersToolPanel",
  agNewFiltersToolPanel: "NewFiltersToolPanel",
  agAggregationComponent: "StatusBar",
  agSelectedRowCountComponent: "StatusBar",
  agTotalRowCountComponent: "StatusBar",
  agFilteredRowCountComponent: "StatusBar",
  agTotalAndFilteredRowCountComponent: "StatusBar",
  agFindCellRenderer: "Find"
}, SE = () => ({
  checkboxSelection: { version: "32.2", message: "Use `rowSelection.checkboxes` in `GridOptions` instead." },
  headerCheckboxSelection: {
    version: "32.2",
    message: "Use `rowSelection.headerCheckbox = true` in `GridOptions` instead."
  },
  headerCheckboxSelectionFilteredOnly: {
    version: "32.2",
    message: 'Use `rowSelection.selectAll = "filtered"` in `GridOptions` instead.'
  },
  headerCheckboxSelectionCurrentPageOnly: {
    version: "32.2",
    message: 'Use `rowSelection.selectAll = "currentPage"` in `GridOptions` instead.'
  },
  showDisabledCheckboxes: {
    version: "32.2",
    message: "Use `rowSelection.hideDisabledCheckboxes = true` in `GridOptions` instead."
  }
}), xE = {
  aggFunc: "SharedAggregation",
  autoHeight: "RowAutoHeight",
  cellClass: "CellStyle",
  cellClassRules: "CellStyle",
  cellEditor: ({ cellEditor: e, editable: t }) => t ? typeof e == "string" ? nr[e] ?? "CustomEditor" : "CustomEditor" : null,
  cellRenderer: ({ cellRenderer: e }) => typeof e != "string" ? null : nr[e],
  cellStyle: "CellStyle",
  columnChooserParams: "ColumnMenu",
  contextMenuItems: "ContextMenu",
  dndSource: "DragAndDrop",
  dndSourceOnRowDrag: "DragAndDrop",
  editable: ({ editable: e, cellEditor: t }) => e && !t ? "TextEditor" : null,
  enableCellChangeFlash: "HighlightChanges",
  enablePivot: "SharedPivot",
  enableRowGroup: "SharedRowGrouping",
  enableValue: "SharedAggregation",
  filter: ({ filter: e }) => e && typeof e != "string" && typeof e != "boolean" ? "CustomFilter" : typeof e == "string" ? nr[e] ?? "ColumnFilter" : "ColumnFilter",
  floatingFilter: "ColumnFilter",
  getQuickFilterText: "QuickFilter",
  headerTooltip: "Tooltip",
  mainMenuItems: "ColumnMenu",
  menuTabs: (e) => {
    var s;
    const t = ["columnsMenuTab", "generalMenuTab"];
    return (s = e.menuTabs) != null && s.some((i) => t.includes(i)) ? "ColumnMenu" : null;
  },
  pivot: "SharedPivot",
  pivotIndex: "SharedPivot",
  rowDrag: "RowDrag",
  rowGroup: "SharedRowGrouping",
  rowGroupIndex: "SharedRowGrouping",
  tooltipField: "Tooltip",
  tooltipValueGetter: "Tooltip",
  spanRows: "CellSpan",
  rowGroupingHierarchy: "SharedRowGrouping"
}, FE = () => ({
  autoHeight: {
    supportedRowModels: ["clientSide", "serverSide"],
    validate: (t, { paginationAutoPageSize: s }) => s ? "colDef.autoHeight is not supported with paginationAutoPageSize." : null
  },
  cellRendererParams: {
    validate: (t) => (t.rowGroup != null || t.rowGroupIndex != null || t.cellRenderer === "agGroupCellRenderer") && "checkbox" in t.cellRendererParams ? 'Since v33.0, `cellRendererParams.checkbox` has been deprecated. Use `rowSelection.checkboxLocation = "autoGroupColumn"` instead.' : null
  },
  flex: {
    validate: (t, s) => s.autoSizeStrategy ? "colDef.flex is not supported with gridOptions.autoSizeStrategy" : null
  },
  headerCheckboxSelection: {
    supportedRowModels: ["clientSide", "serverSide"],
    validate: (t, { rowSelection: s }) => s === "multiple" ? null : "headerCheckboxSelection is only supported with rowSelection=multiple"
  },
  headerCheckboxSelectionCurrentPageOnly: {
    supportedRowModels: ["clientSide"],
    validate: (t, { rowSelection: s }) => s === "multiple" ? null : "headerCheckboxSelectionCurrentPageOnly is only supported with rowSelection=multiple"
  },
  headerCheckboxSelectionFilteredOnly: {
    supportedRowModels: ["clientSide"],
    validate: (t, { rowSelection: s }) => s === "multiple" ? null : "headerCheckboxSelectionFilteredOnly is only supported with rowSelection=multiple"
  },
  headerValueGetter: {
    validate: (t) => {
      const s = t.headerValueGetter;
      return typeof s == "function" || typeof s == "string" ? null : "headerValueGetter must be a function or a valid string expression";
    }
  },
  icons: {
    validate: ({ icons: t }) => {
      if (t) {
        if (t.smallDown)
          return gt(262);
        if (t.smallLeft)
          return gt(263);
        if (t.smallRight)
          return gt(264);
      }
      return null;
    }
  },
  sortingOrder: {
    validate: (t) => {
      const s = t.sortingOrder;
      if (Array.isArray(s) && s.length > 0) {
        const i = s.filter((r) => !cn.includes(r));
        if (i.length > 0)
          return `sortingOrder must be an array with elements from [${cn.map(Ro).join()}], currently it includes [${i.map(Ro).join()}]`;
      } else if (!Array.isArray(s) || s.length <= 0)
        return `sortingOrder must be an array with at least one element, currently it's ${s}`;
      return null;
    }
  },
  type: {
    validate: (t) => {
      const s = t.type;
      return s instanceof Array ? s.some((r) => typeof r != "string") ? "if colDef.type is supplied an array it should be of type 'string[]'" : null : typeof s == "string" ? null : "colDef.type should be of type 'string' | 'string[]'";
    }
  },
  rowSpan: {
    validate: (t, { suppressRowTransform: s }) => s ? null : "colDef.rowSpan requires suppressRowTransform to be enabled."
  },
  spanRows: {
    dependencies: {
      editable: { required: [!1, void 0] },
      rowDrag: { required: [!1, void 0] },
      colSpan: { required: [void 0] },
      rowSpan: { required: [void 0] }
    },
    validate: (t, {
      rowSelection: s,
      cellSelection: i,
      suppressRowTransform: r,
      enableCellSpan: n,
      rowDragEntireRow: o,
      enableCellTextSelection: a
    }) => typeof s == "object" && (s == null ? void 0 : s.mode) === "singleRow" && s != null && s.enableClickSelection ? "colDef.spanRows is not supported with rowSelection.clickSelection" : i ? "colDef.spanRows is not supported with cellSelection." : r ? "colDef.spanRows is not supported with suppressRowTransform." : n ? o ? "colDef.spanRows is not supported with rowDragEntireRow." : a ? "colDef.spanRows is not supported with enableCellTextSelection." : null : "colDef.spanRows requires enableCellSpan to be enabled."
  },
  rowGroupingHierarchy: {
    validate(t, { groupHierarchyConfig: s = {} }, i) {
      var o;
      const r = /* @__PURE__ */ new Set([
        "year",
        "quarter",
        "month",
        "formattedMonth",
        "day",
        "hour",
        "minute",
        "second"
      ]), n = [];
      if ((o = t.rowGroupingHierarchy) == null || o.forEach((a) => {
        var l;
        if (typeof a == "object")
          return (l = i.validation) == null || l.validateColDef(a), null;
        !r.has(a) && !(a in s) && n.push(a);
      }), n.length > 0) {
        const a = `The following parts of colDef.rowGroupingHierarchy are not recognised: ${n.map((c) => `"${c}"`).join(", ")}.`, l = `Choose one of ${[...r].map((c) => `"${c}"`).join(", ")}, or define your own parts in gridOptions.groupHierarchyConfig.`;
        return `${a}
${l}`;
      }
      return null;
    }
  }
}), RE = {
  headerName: void 0,
  columnGroupShow: void 0,
  headerStyle: void 0,
  headerClass: void 0,
  toolPanelClass: void 0,
  headerValueGetter: void 0,
  pivotKeys: void 0,
  groupId: void 0,
  colId: void 0,
  sort: void 0,
  initialSort: void 0,
  field: void 0,
  type: void 0,
  cellDataType: void 0,
  tooltipComponent: void 0,
  tooltipField: void 0,
  headerTooltip: void 0,
  cellClass: void 0,
  showRowGroup: void 0,
  filter: void 0,
  initialAggFunc: void 0,
  defaultAggFunc: void 0,
  aggFunc: void 0,
  pinned: void 0,
  initialPinned: void 0,
  chartDataType: void 0,
  cellAriaRole: void 0,
  cellEditorPopupPosition: void 0,
  headerGroupComponent: void 0,
  headerGroupComponentParams: void 0,
  cellStyle: void 0,
  cellRenderer: void 0,
  cellRendererParams: void 0,
  cellEditor: void 0,
  cellEditorParams: void 0,
  filterParams: void 0,
  pivotValueColumn: void 0,
  headerComponent: void 0,
  headerComponentParams: void 0,
  floatingFilterComponent: void 0,
  floatingFilterComponentParams: void 0,
  tooltipComponentParams: void 0,
  refData: void 0,
  columnChooserParams: void 0,
  children: void 0,
  sortingOrder: void 0,
  allowedAggFuncs: void 0,
  menuTabs: void 0,
  pivotTotalColumnIds: void 0,
  cellClassRules: void 0,
  icons: void 0,
  sortIndex: void 0,
  initialSortIndex: void 0,
  flex: void 0,
  initialFlex: void 0,
  width: void 0,
  initialWidth: void 0,
  minWidth: void 0,
  maxWidth: void 0,
  rowGroupIndex: void 0,
  initialRowGroupIndex: void 0,
  pivotIndex: void 0,
  initialPivotIndex: void 0,
  suppressColumnsToolPanel: void 0,
  suppressFiltersToolPanel: void 0,
  openByDefault: void 0,
  marryChildren: void 0,
  suppressStickyLabel: void 0,
  hide: void 0,
  initialHide: void 0,
  rowGroup: void 0,
  initialRowGroup: void 0,
  pivot: void 0,
  initialPivot: void 0,
  checkboxSelection: void 0,
  showDisabledCheckboxes: void 0,
  headerCheckboxSelection: void 0,
  headerCheckboxSelectionFilteredOnly: void 0,
  headerCheckboxSelectionCurrentPageOnly: void 0,
  suppressHeaderMenuButton: void 0,
  suppressMovable: void 0,
  lockPosition: void 0,
  lockVisible: void 0,
  lockPinned: void 0,
  unSortIcon: void 0,
  suppressSizeToFit: void 0,
  suppressAutoSize: void 0,
  enableRowGroup: void 0,
  enablePivot: void 0,
  enableValue: void 0,
  editable: void 0,
  suppressPaste: void 0,
  suppressNavigable: void 0,
  enableCellChangeFlash: void 0,
  rowDrag: void 0,
  dndSource: void 0,
  autoHeight: void 0,
  wrapText: void 0,
  sortable: void 0,
  resizable: void 0,
  singleClickEdit: void 0,
  floatingFilter: void 0,
  cellEditorPopup: void 0,
  suppressFillHandle: void 0,
  wrapHeaderText: void 0,
  autoHeaderHeight: void 0,
  dndSourceOnRowDrag: void 0,
  valueGetter: void 0,
  valueSetter: void 0,
  filterValueGetter: void 0,
  keyCreator: void 0,
  valueFormatter: void 0,
  valueParser: void 0,
  comparator: void 0,
  equals: void 0,
  pivotComparator: void 0,
  suppressKeyboardEvent: void 0,
  suppressHeaderKeyboardEvent: void 0,
  colSpan: void 0,
  rowSpan: void 0,
  spanRows: void 0,
  getQuickFilterText: void 0,
  onCellValueChanged: void 0,
  onCellClicked: void 0,
  onCellDoubleClicked: void 0,
  onCellContextMenu: void 0,
  rowDragText: void 0,
  tooltipValueGetter: void 0,
  cellRendererSelector: void 0,
  cellEditorSelector: void 0,
  suppressSpanHeaderHeight: void 0,
  useValueFormatterForExport: void 0,
  useValueParserForImport: void 0,
  mainMenuItems: void 0,
  contextMenuItems: void 0,
  suppressFloatingFilterButton: void 0,
  suppressHeaderFilterButton: void 0,
  suppressHeaderContextMenu: void 0,
  loadingCellRenderer: void 0,
  loadingCellRendererParams: void 0,
  loadingCellRendererSelector: void 0,
  context: void 0,
  dateComponent: void 0,
  dateComponentParams: void 0,
  getFindText: void 0,
  rowGroupingHierarchy: void 0
}, PE = () => Object.keys(RE), EE = () => ({
  objectName: "colDef",
  allProperties: PE(),
  docsUrl: "column-properties/",
  deprecations: SE(),
  validations: FE()
}), TE = [
  "overlayLoadingTemplate",
  "overlayNoRowsTemplate",
  "gridId",
  "quickFilterText",
  "rowModelType",
  "editType",
  "domLayout",
  "clipboardDelimiter",
  "rowGroupPanelShow",
  "multiSortKey",
  "pivotColumnGroupTotals",
  "pivotRowTotals",
  "pivotPanelShow",
  "fillHandleDirection",
  "groupDisplayType",
  "treeDataDisplayType",
  "treeDataChildrenField",
  "treeDataParentIdField",
  "colResizeDefault",
  "tooltipTrigger",
  "serverSidePivotResultFieldSeparator",
  "columnMenu",
  "tooltipShowMode",
  "invalidEditValueMode",
  "grandTotalRow",
  "themeCssLayer",
  "findSearchValue",
  "styleNonce",
  "renderingMode"
], ME = [
  "components",
  "rowStyle",
  "context",
  "autoGroupColumnDef",
  "localeText",
  "icons",
  "datasource",
  "dragAndDropImageComponentParams",
  "serverSideDatasource",
  "viewportDatasource",
  "groupRowRendererParams",
  "aggFuncs",
  "fullWidthCellRendererParams",
  "defaultColGroupDef",
  "defaultColDef",
  "defaultCsvExportParams",
  "defaultExcelExportParams",
  "columnTypes",
  "rowClassRules",
  "detailCellRendererParams",
  "loadingCellRendererParams",
  "loadingOverlayComponentParams",
  "noRowsOverlayComponentParams",
  "popupParent",
  "themeStyleContainer",
  "statusBar",
  "chartThemeOverrides",
  "customChartThemes",
  "chartToolPanelsDef",
  "dataTypeDefinitions",
  "advancedFilterParent",
  "advancedFilterBuilderParams",
  "advancedFilterParams",
  "initialState",
  "autoSizeStrategy",
  "selectionColumnDef",
  "findOptions",
  "filterHandlers",
  "groupHierarchyConfig"
], DE = [
  "sortingOrder",
  "alignedGrids",
  "rowData",
  "columnDefs",
  "excelStyles",
  "pinnedTopRowData",
  "pinnedBottomRowData",
  "chartThemes",
  "rowClass",
  "paginationPageSizeSelector"
], Xf = [
  "rowHeight",
  "detailRowHeight",
  "rowBuffer",
  "headerHeight",
  "groupHeaderHeight",
  "groupLockGroupColumns",
  "floatingFiltersHeight",
  "pivotHeaderHeight",
  "pivotGroupHeaderHeight",
  "groupDefaultExpanded",
  "pivotDefaultExpanded",
  "viewportRowModelPageSize",
  "viewportRowModelBufferSize",
  "autoSizePadding",
  "maxBlocksInCache",
  "maxConcurrentDatasourceRequests",
  "tooltipShowDelay",
  "tooltipHideDelay",
  "cacheOverflowSize",
  "paginationPageSize",
  "cacheBlockSize",
  "infiniteInitialRowCount",
  "serverSideInitialRowCount",
  "scrollbarWidth",
  "asyncTransactionWaitMillis",
  "blockLoadDebounceMillis",
  "keepDetailRowsCount",
  "undoRedoCellEditingLimit",
  "cellFlashDuration",
  "cellFadeDuration",
  "tabIndex",
  "pivotMaxGeneratedColumns",
  "rowDragInsertDelay"
], AE = ["theme", "rowSelection"], IE = [
  "cellSelection",
  "sideBar",
  "rowNumbers",
  "suppressGroupChangesColumnVisibility",
  "groupAggFiltering",
  "suppressStickyTotalRow",
  "groupHideParentOfSingleChild",
  "enableRowPinning"
], Zf = [
  "loadThemeGoogleFonts",
  "suppressMakeColumnVisibleAfterUnGroup",
  "suppressRowClickSelection",
  "suppressCellFocus",
  "suppressHeaderFocus",
  "suppressHorizontalScroll",
  "groupSelectsChildren",
  "alwaysShowHorizontalScroll",
  "alwaysShowVerticalScroll",
  "debug",
  "enableBrowserTooltips",
  "enableCellExpressions",
  "groupSuppressBlankHeader",
  "suppressMenuHide",
  "suppressRowDeselection",
  "unSortIcon",
  "suppressMultiSort",
  "alwaysMultiSort",
  "singleClickEdit",
  "suppressLoadingOverlay",
  "suppressNoRowsOverlay",
  "suppressAutoSize",
  "skipHeaderOnAutoSize",
  "suppressColumnMoveAnimation",
  "suppressMoveWhenColumnDragging",
  "suppressMovableColumns",
  "suppressFieldDotNotation",
  "enableRangeSelection",
  "enableRangeHandle",
  "enableFillHandle",
  "suppressClearOnFillReduction",
  "deltaSort",
  "suppressTouch",
  "allowContextMenuWithControlKey",
  "suppressContextMenu",
  "suppressDragLeaveHidesColumns",
  "suppressRowGroupHidesColumns",
  "suppressMiddleClickScrolls",
  "suppressPreventDefaultOnMouseWheel",
  "suppressCopyRowsToClipboard",
  "copyHeadersToClipboard",
  "copyGroupHeadersToClipboard",
  "pivotMode",
  "suppressAggFuncInHeader",
  "suppressColumnVirtualisation",
  "alwaysAggregateAtRootLevel",
  "suppressFocusAfterRefresh",
  "functionsReadOnly",
  "animateRows",
  "groupSelectsFiltered",
  "groupRemoveSingleChildren",
  "groupRemoveLowestSingleChildren",
  "enableRtl",
  "enableCellSpan",
  "suppressClickEdit",
  "rowDragEntireRow",
  "rowDragManaged",
  "suppressRowDrag",
  "suppressMoveWhenRowDragging",
  "rowDragMultiRow",
  "enableGroupEdit",
  "embedFullWidthRows",
  "suppressPaginationPanel",
  "groupHideOpenParents",
  "groupAllowUnbalanced",
  "pagination",
  "paginationAutoPageSize",
  "suppressScrollOnNewData",
  "suppressScrollWhenPopupsAreOpen",
  "purgeClosedRowNodes",
  "cacheQuickFilter",
  "includeHiddenColumnsInQuickFilter",
  "ensureDomOrder",
  "accentedSort",
  "suppressChangeDetection",
  "valueCache",
  "valueCacheNeverExpires",
  "aggregateOnlyChangedColumns",
  "suppressAnimationFrame",
  "suppressExcelExport",
  "suppressCsvExport",
  "includeHiddenColumnsInAdvancedFilter",
  "suppressMultiRangeSelection",
  "enterNavigatesVerticallyAfterEdit",
  "enterNavigatesVertically",
  "suppressPropertyNamesCheck",
  "rowMultiSelectWithClick",
  "suppressRowHoverHighlight",
  "suppressRowTransform",
  "suppressClipboardPaste",
  "suppressLastEmptyLineOnPaste",
  "enableCharts",
  "suppressMaintainUnsortedOrder",
  "enableCellTextSelection",
  "suppressBrowserResizeObserver",
  "suppressMaxRenderedRowRestriction",
  "excludeChildrenWhenTreeDataFiltering",
  "tooltipMouseTrack",
  "tooltipInteraction",
  "keepDetailRows",
  "paginateChildRows",
  "preventDefaultOnContextMenu",
  "undoRedoCellEditing",
  "allowDragFromColumnsToolPanel",
  "pivotSuppressAutoColumn",
  "suppressExpandablePivotGroups",
  "debounceVerticalScrollbar",
  "detailRowAutoHeight",
  "serverSideSortAllLevels",
  "serverSideEnableClientSideSort",
  "serverSideOnlyRefreshFilteredGroups",
  "suppressAggFilteredOnly",
  "showOpenedGroup",
  "suppressClipboardApi",
  "suppressModelUpdateAfterUpdateTransaction",
  "stopEditingWhenCellsLoseFocus",
  "groupMaintainOrder",
  "columnHoverHighlight",
  "readOnlyEdit",
  "suppressRowVirtualisation",
  "enableCellEditingOnBackspace",
  "resetRowDataOnUpdate",
  "removePivotHeaderRowWhenSingleValueColumn",
  "suppressCopySingleCellRanges",
  "suppressGroupRowsSticky",
  "suppressCutToClipboard",
  "rowGroupPanelSuppressSort",
  "allowShowChangeAfterFilter",
  "enableAdvancedFilter",
  "masterDetail",
  "treeData",
  "reactiveCustomComponents",
  "applyQuickFilterBeforePivotOrAgg",
  "suppressServerSideFullWidthLoadingRow",
  "suppressAdvancedFilterEval",
  "loading",
  "maintainColumnOrder",
  "enableStrictPivotColumnOrder",
  "suppressSetFilterByDefault",
  "enableFilterHandlers",
  "suppressStartEditOnTab",
  "hidePaddedHeaderRows",
  "ssrmExpandAllAffectsAllRows"
], LE = [
  "doesExternalFilterPass",
  "processPivotResultColDef",
  "processPivotResultColGroupDef",
  "getBusinessKeyForNode",
  "isRowSelectable",
  "rowDragText",
  "groupRowRenderer",
  "dragAndDropImageComponent",
  "fullWidthCellRenderer",
  "loadingCellRenderer",
  "loadingOverlayComponent",
  "noRowsOverlayComponent",
  "detailCellRenderer",
  "quickFilterParser",
  "quickFilterMatcher",
  "getLocaleText",
  "isExternalFilterPresent",
  "getRowHeight",
  "getRowClass",
  "getRowStyle",
  "getFullRowEditValidationErrors",
  "getContextMenuItems",
  "getMainMenuItems",
  "processRowPostCreate",
  "processCellForClipboard",
  "getGroupRowAgg",
  "isFullWidthRow",
  "sendToClipboard",
  "focusGridInnerElement",
  "navigateToNextHeader",
  "tabToNextHeader",
  "navigateToNextCell",
  "tabToNextCell",
  "processCellFromClipboard",
  "getDocument",
  "postProcessPopup",
  "getChildCount",
  "getDataPath",
  "isRowMaster",
  "postSortRows",
  "processHeaderForClipboard",
  "processUnpinnedColumns",
  "processGroupHeaderForClipboard",
  "paginationNumberFormatter",
  "processDataFromClipboard",
  "getServerSideGroupKey",
  "isServerSideGroup",
  "createChartContainer",
  "getChartToolbarItems",
  "fillOperation",
  "isApplyServerSideTransaction",
  "getServerSideGroupLevelParams",
  "isServerSideGroupOpenByDefault",
  "isGroupOpenByDefault",
  "initialGroupOrderComparator",
  "loadingCellRendererSelector",
  "getRowId",
  "chartMenuItems",
  "groupTotalRow",
  "alwaysPassFilter",
  "isRowPinnable",
  "isRowPinned",
  "isRowValidDropPosition"
], kE = () => [
  ...DE,
  ...ME,
  ...TE,
  ...Xf,
  ...LE,
  ...Zf,
  ...IE,
  ...AE
], GE = () => ({
  suppressLoadingOverlay: { version: "32", message: "Use `loading`=false instead." },
  enableFillHandle: { version: "32.2", message: "Use `cellSelection.handle` instead." },
  enableRangeHandle: { version: "32.2", message: "Use `cellSelection.handle` instead." },
  enableRangeSelection: { version: "32.2", message: "Use `cellSelection = true` instead." },
  suppressMultiRangeSelection: {
    version: "32.2",
    message: "Use `cellSelection.suppressMultiRanges` instead."
  },
  suppressClearOnFillReduction: {
    version: "32.2",
    message: "Use `cellSelection.handle.suppressClearOnFillReduction` instead."
  },
  fillHandleDirection: { version: "32.2", message: "Use `cellSelection.handle.direction` instead." },
  fillOperation: { version: "32.2", message: "Use `cellSelection.handle.setFillValue` instead." },
  suppressRowClickSelection: {
    version: "32.2",
    message: "Use `rowSelection.enableClickSelection` instead."
  },
  suppressRowDeselection: { version: "32.2", message: "Use `rowSelection.enableClickSelection` instead." },
  rowMultiSelectWithClick: {
    version: "32.2",
    message: "Use `rowSelection.enableSelectionWithoutKeys` instead."
  },
  groupSelectsChildren: {
    version: "32.2",
    message: 'Use `rowSelection.groupSelects = "descendants"` instead.'
  },
  groupSelectsFiltered: {
    version: "32.2",
    message: 'Use `rowSelection.groupSelects = "filteredDescendants"` instead.'
  },
  isRowSelectable: { version: "32.2", message: "Use `selectionOptions.isRowSelectable` instead." },
  suppressCopySingleCellRanges: { version: "32.2", message: "Use `rowSelection.copySelectedRows` instead." },
  suppressCopyRowsToClipboard: { version: "32.2", message: "Use `rowSelection.copySelectedRows` instead." },
  onRangeSelectionChanged: { version: "32.2", message: "Use `onCellSelectionChanged` instead." },
  onRangeDeleteStart: { version: "32.2", message: "Use `onCellSelectionDeleteStart` instead." },
  onRangeDeleteEnd: { version: "32.2", message: "Use `onCellSelectionDeleteEnd` instead." },
  suppressBrowserResizeObserver: {
    version: "32.2",
    message: "The grid always uses the browser's ResizeObserver, this grid option has no effect."
  },
  onColumnEverythingChanged: {
    version: "32.2",
    message: "Either use `onDisplayedColumnsChanged` which is fired at the same time, or use one of the more specific column events."
  },
  groupRemoveSingleChildren: {
    version: "33",
    message: "Use `groupHideParentOfSingleChild` instead."
  },
  groupRemoveLowestSingleChildren: {
    version: "33",
    message: 'Use `groupHideParentOfSingleChild: "leafGroupsOnly"` instead.'
  },
  suppressRowGroupHidesColumns: {
    version: "33",
    message: 'Use `suppressGroupChangesColumnVisibility: "suppressHideOnGroup"` instead.'
  },
  suppressMakeColumnVisibleAfterUnGroup: {
    version: "33",
    message: 'Use `suppressGroupChangesColumnVisibility: "suppressShowOnUngroup"` instead.'
  },
  unSortIcon: { version: "33", message: "Use `defaultColDef.unSortIcon` instead." },
  sortingOrder: { version: "33", message: "Use `defaultColDef.sortingOrder` instead." },
  suppressPropertyNamesCheck: {
    version: "33",
    message: "`gridOptions` and `columnDefs` both have a `context` property that should be used for arbitrary user data. This means that column definitions and gridOptions should only contain valid properties making this property redundant."
  },
  suppressAdvancedFilterEval: {
    version: "34",
    message: "Advanced filter no longer uses function evaluation, so this option has no effect."
  }
});
function Ut(e, t, s) {
  return typeof t == "number" || t == null ? t == null || t >= s ? null : `${e}: value should be greater than or equal to ${s}` : `${e}: value should be a number`;
}
var OE = {
  alignedGrids: "AlignedGrids",
  allowContextMenuWithControlKey: "ContextMenu",
  autoSizeStrategy: "ColumnAutoSize",
  cellSelection: "CellSelection",
  columnHoverHighlight: "ColumnHover",
  datasource: "InfiniteRowModel",
  doesExternalFilterPass: "ExternalFilter",
  editType: "EditCore",
  invalidEditValueMode: "EditCore",
  enableAdvancedFilter: "AdvancedFilter",
  enableCellSpan: "CellSpan",
  enableCharts: "IntegratedCharts",
  enableRangeSelection: "CellSelection",
  enableRowPinning: "PinnedRow",
  findSearchValue: "Find",
  getFullRowEditValidationErrors: "EditCore",
  getContextMenuItems: "ContextMenu",
  getLocaleText: "Locale",
  getMainMenuItems: "ColumnMenu",
  getRowClass: "RowStyle",
  getRowStyle: "RowStyle",
  groupTotalRow: "SharedRowGrouping",
  grandTotalRow: "SharedRowGrouping",
  initialState: "GridState",
  isExternalFilterPresent: "ExternalFilter",
  isRowPinnable: "PinnedRow",
  isRowPinned: "PinnedRow",
  localeText: "Locale",
  masterDetail: "SharedMasterDetail",
  pagination: "Pagination",
  pinnedBottomRowData: "PinnedRow",
  pinnedTopRowData: "PinnedRow",
  pivotMode: "SharedPivot",
  pivotPanelShow: "RowGroupingPanel",
  quickFilterText: "QuickFilter",
  rowClass: "RowStyle",
  rowClassRules: "RowStyle",
  rowData: "ClientSideRowModel",
  rowDragManaged: "RowDrag",
  rowGroupPanelShow: "RowGroupingPanel",
  rowNumbers: "RowNumbers",
  rowSelection: "SharedRowSelection",
  rowStyle: "RowStyle",
  serverSideDatasource: "ServerSideRowModel",
  sideBar: "SideBar",
  statusBar: "StatusBar",
  treeData: "SharedTreeData",
  undoRedoCellEditing: "UndoRedoEdit",
  valueCache: "ValueCache",
  viewportDatasource: "ViewportRowModel"
}, VE = () => {
  const e = {
    autoSizePadding: {
      validate({ autoSizePadding: s }) {
        return Ut("autoSizePadding", s, 0);
      }
    },
    cacheBlockSize: {
      supportedRowModels: ["serverSide", "infinite"],
      validate({ cacheBlockSize: s }) {
        return Ut("cacheBlockSize", s, 1);
      }
    },
    cacheOverflowSize: {
      validate({ cacheOverflowSize: s }) {
        return Ut("cacheOverflowSize", s, 1);
      }
    },
    datasource: {
      supportedRowModels: ["infinite"]
    },
    domLayout: {
      validate: (s) => {
        const i = s.domLayout, r = ["autoHeight", "normal", "print"];
        return i && !r.includes(i) ? `domLayout must be one of [${r.join()}], currently it's ${i}` : null;
      }
    },
    enableFillHandle: {
      dependencies: {
        enableRangeSelection: { required: [!0] }
      }
    },
    enableRangeHandle: {
      dependencies: {
        enableRangeSelection: { required: [!0] }
      }
    },
    enableRangeSelection: {
      dependencies: {
        rowDragEntireRow: { required: [!1, void 0] }
      }
    },
    enableRowPinning: {
      supportedRowModels: ["clientSide"],
      validate({ enableRowPinning: s, pinnedTopRowData: i, pinnedBottomRowData: r }) {
        return s && (i || r) ? "Manual row pinning cannot be used together with pinned row data. Either set `enableRowPinning` to `false`, or remove `pinnedTopRowData` and `pinnedBottomRowData`." : null;
      }
    },
    isRowPinnable: {
      supportedRowModels: ["clientSide"],
      validate({ enableRowPinning: s, isRowPinnable: i, pinnedTopRowData: r, pinnedBottomRowData: n }) {
        return i && (r || n) ? "Manual row pinning cannot be used together with pinned row data. Either remove `isRowPinnable`, or remove `pinnedTopRowData` and `pinnedBottomRowData`." : !s && i ? "`isRowPinnable` requires `enableRowPinning` to be set." : null;
      }
    },
    isRowPinned: {
      supportedRowModels: ["clientSide"],
      validate({ enableRowPinning: s, isRowPinned: i, pinnedTopRowData: r, pinnedBottomRowData: n }) {
        return i && (r || n) ? "Manual row pinning cannot be used together with pinned row data. Either remove `isRowPinned`, or remove `pinnedTopRowData` and `pinnedBottomRowData`." : !s && i ? "`isRowPinned` requires `enableRowPinning` to be set." : null;
      }
    },
    groupDefaultExpanded: {
      supportedRowModels: ["clientSide"]
    },
    groupHideOpenParents: {
      supportedRowModels: ["clientSide", "serverSide"],
      dependencies: {
        groupTotalRow: { required: [void 0, "bottom"] },
        treeData: {
          required: [void 0, !1],
          reason: "Tree Data has values at the group level so it doesn't make sense to hide them."
        }
      }
    },
    groupHideParentOfSingleChild: {
      dependencies: {
        groupHideOpenParents: { required: [void 0, !1] }
      }
    },
    groupRemoveLowestSingleChildren: {
      dependencies: {
        groupHideOpenParents: { required: [void 0, !1] },
        groupRemoveSingleChildren: { required: [void 0, !1] }
      }
    },
    groupRemoveSingleChildren: {
      dependencies: {
        groupHideOpenParents: { required: [void 0, !1] },
        groupRemoveLowestSingleChildren: { required: [void 0, !1] }
      }
    },
    groupSelectsChildren: {
      dependencies: {
        rowSelection: { required: ["multiple"] }
      }
    },
    groupHierarchyConfig: {
      validate({ groupHierarchyConfig: s = {} }, i, r) {
        var n;
        for (const o of Object.keys(s))
          (n = r.validation) == null || n.validateColDef(s[o]);
        return null;
      }
    },
    icons: {
      validate: ({ icons: s }) => {
        if (s) {
          if (s.smallDown)
            return gt(262);
          if (s.smallLeft)
            return gt(263);
          if (s.smallRight)
            return gt(264);
        }
        return null;
      }
    },
    infiniteInitialRowCount: {
      validate({ infiniteInitialRowCount: s }) {
        return Ut("infiniteInitialRowCount", s, 1);
      }
    },
    initialGroupOrderComparator: {
      supportedRowModels: ["clientSide"]
    },
    ssrmExpandAllAffectsAllRows: {
      validate: (s) => {
        if (typeof s.ssrmExpandAllAffectsAllRows == "boolean") {
          if (s.rowModelType !== "serverSide")
            return "'ssrmExpandAllAffectsAllRows' is only supported with the Server Side Row Model.";
          if (s.ssrmExpandAllAffectsAllRows && typeof s.getRowId != "function")
            return "'getRowId' callback must be provided for Server Side Row Model grouping to work correctly.";
        }
        return null;
      }
    },
    keepDetailRowsCount: {
      validate({ keepDetailRowsCount: s }) {
        return Ut("keepDetailRowsCount", s, 1);
      }
    },
    paginationPageSize: {
      validate({ paginationPageSize: s }) {
        return Ut("paginationPageSize", s, 1);
      }
    },
    paginationPageSizeSelector: {
      validate: (s) => {
        const i = s.paginationPageSizeSelector;
        return typeof i == "boolean" || i == null || i.length ? null : `'paginationPageSizeSelector' cannot be an empty array.
                    If you want to hide the page size selector, set paginationPageSizeSelector to false.`;
      }
    },
    pivotMode: {
      dependencies: {
        treeData: {
          required: [!1, void 0],
          reason: "Pivot Mode is not supported with Tree Data."
        }
      }
    },
    quickFilterText: {
      supportedRowModels: ["clientSide"]
    },
    rowBuffer: {
      validate({ rowBuffer: s }) {
        return Ut("rowBuffer", s, 0);
      }
    },
    rowClass: {
      validate: (s) => typeof s.rowClass == "function" ? "rowClass should not be a function, please use getRowClass instead" : null
    },
    rowData: {
      supportedRowModels: ["clientSide"]
    },
    rowDragManaged: {
      supportedRowModels: ["clientSide"],
      dependencies: {
        pagination: {
          required: [!1, void 0]
        }
      }
    },
    rowSelection: {
      validate({ rowSelection: s }) {
        return s && typeof s == "string" ? 'As of version 32.2.1, using `rowSelection` with the values "single" or "multiple" has been deprecated. Use the object value instead.' : s && typeof s != "object" ? "Expected `RowSelectionOptions` object for the `rowSelection` property." : s && s.mode !== "multiRow" && s.mode !== "singleRow" ? `Selection mode "${s.mode}" is invalid. Use one of 'singleRow' or 'multiRow'.` : null;
      }
    },
    rowStyle: {
      validate: (s) => {
        const i = s.rowStyle;
        return i && typeof i == "function" ? "rowStyle should be an object of key/value styles, not be a function, use getRowStyle() instead" : null;
      }
    },
    serverSideDatasource: {
      supportedRowModels: ["serverSide"]
    },
    serverSideInitialRowCount: {
      supportedRowModels: ["serverSide"],
      validate({ serverSideInitialRowCount: s }) {
        return Ut("serverSideInitialRowCount", s, 1);
      }
    },
    serverSideOnlyRefreshFilteredGroups: {
      supportedRowModels: ["serverSide"]
    },
    serverSideSortAllLevels: {
      supportedRowModels: ["serverSide"]
    },
    sortingOrder: {
      validate: (s) => {
        const i = s.sortingOrder;
        if (Array.isArray(i) && i.length > 0) {
          const r = i.filter((n) => !cn.includes(n));
          if (r.length > 0)
            return `sortingOrder must be an array with elements from [${cn.map(Ro).join()}], currently it includes [${r.map(Ro).join()}]`;
        } else if (!Array.isArray(i) || i.length <= 0)
          return `sortingOrder must be an array with at least one element, currently it's ${i}`;
        return null;
      }
    },
    tooltipHideDelay: {
      validate: (s) => s.tooltipHideDelay && s.tooltipHideDelay < 0 ? "tooltipHideDelay should not be lower than 0" : null
    },
    tooltipShowDelay: {
      validate: (s) => s.tooltipShowDelay && s.tooltipShowDelay < 0 ? "tooltipShowDelay should not be lower than 0" : null
    },
    treeData: {
      supportedRowModels: ["clientSide", "serverSide"],
      validate: (s) => {
        const i = s.rowModelType ?? "clientSide";
        switch (i) {
          case "clientSide": {
            const { treeDataChildrenField: r, treeDataParentIdField: n, getDataPath: o, getRowId: a } = s;
            if (!r && !n && !o)
              return "treeData requires either 'treeDataChildrenField' or 'treeDataParentIdField' or 'getDataPath' in the clientSide row model.";
            if (r) {
              if (o)
                return "Cannot use both 'treeDataChildrenField' and 'getDataPath' at the same time.";
              if (n)
                return "Cannot use both 'treeDataChildrenField' and 'treeDataParentIdField' at the same time.";
            }
            if (n) {
              if (!a)
                return "getRowId callback not provided, tree data with parent id cannot be built.";
              if (o)
                return "Cannot use both 'treeDataParentIdField' and 'getDataPath' at the same time.";
            }
            return null;
          }
          case "serverSide": {
            const r = `treeData requires 'isServerSideGroup' and 'getServerSideGroupKey' in the ${i} row model.`;
            return s.isServerSideGroup && s.getServerSideGroupKey ? null : r;
          }
        }
        return null;
      }
    },
    viewportDatasource: {
      supportedRowModels: ["viewport"]
    },
    viewportRowModelBufferSize: {
      validate({ viewportRowModelBufferSize: s }) {
        return Ut("viewportRowModelBufferSize", s, 0);
      }
    },
    viewportRowModelPageSize: {
      validate({ viewportRowModelPageSize: s }) {
        return Ut("viewportRowModelPageSize", s, 1);
      }
    },
    rowDragEntireRow: {
      dependencies: {
        cellSelection: { required: [void 0] }
      }
    },
    autoGroupColumnDef: {
      validate({ autoGroupColumnDef: s, showOpenedGroup: i }) {
        return s != null && s.field && i ? "autoGroupColumnDef.field and showOpenedGroup are not supported when used together." : s != null && s.valueGetter && i ? "autoGroupColumnDef.valueGetter and showOpenedGroup are not supported when used together." : null;
      }
    },
    renderingMode: {
      validate: (s) => {
        const i = s.renderingMode, r = ["default", "legacy"];
        return i && !r.includes(i) ? `renderingMode must be one of [${r.join()}], currently it's ${i}` : null;
      }
    }
  }, t = {};
  return Zf.forEach((s) => {
    t[s] = { expectedType: "boolean" };
  }), Xf.forEach((s) => {
    t[s] = { expectedType: "number" };
  }), Fe(t, e), t;
}, BE = () => ({
  objectName: "gridOptions",
  allProperties: [...kE(), ...Object.values(Rd)],
  propertyExceptions: ["api"],
  docsUrl: "grid-options/",
  deprecations: GE(),
  validations: VE()
}), NE = 0, HE = 0, su = "__ag_grid_instance", zE = class extends R {
  constructor() {
    super(...arguments), this.beanName = "gos", this.domDataKey = "__AG_" + Math.random().toString(), this.instanceId = HE++, this.gridReadyFired = !1, this.queueEvents = [], this.propEventSvc = new Rs(), this.globalEventHandlerFactory = (e) => (t, s) => {
      if (!this.isAlive())
        return;
      const i = co.has(t);
      if (i && !e || !i && e || !WE(t))
        return;
      const r = (n, o) => {
        const a = Rd[n], l = this.gridOptions[a];
        typeof l == "function" && this.beans.frameworkOverrides.wrapOutgoing(() => l(o));
      };
      if (this.gridReadyFired)
        r(t, s);
      else if (t === "gridReady") {
        r(t, s), this.gridReadyFired = !0;
        for (const n of this.queueEvents)
          r(n.eventName, n.event);
        this.queueEvents = [];
      } else
        this.queueEvents.push({ eventName: t, event: s });
    };
  }
  wireBeans(e) {
    this.gridOptions = e.gridOptions, this.validation = e.validation, this.api = e.gridApi, this.gridId = e.context.getId();
  }
  // This is quicker then having code call gridOptionsService.get('context')
  get gridOptionsContext() {
    return this.gridOptions.context;
  }
  postConstruct() {
    this.validateGridOptions(this.gridOptions), this.eventSvc.addGlobalListener(this.globalEventHandlerFactory().bind(this), !0), this.eventSvc.addGlobalListener(this.globalEventHandlerFactory(!0).bind(this), !1), this.propEventSvc.setFrameworkOverrides(this.beans.frameworkOverrides), this.addManagedEventListeners({
      gridOptionsChanged: ({ options: e }) => {
        this.updateGridOptions({ options: e, force: !0, source: "optionsUpdated" });
      }
    });
  }
  destroy() {
    super.destroy(), this.queueEvents = [];
  }
  /**
   * Get the raw value of the GridOptions property provided.
   * @param property
   */
  get(e) {
    return this.gridOptions[e] ?? Ow[e];
  }
  /**
   * Get the GridOption callback but wrapped so that the common params of api and context are automatically applied to the params.
   * @param property GridOption callback properties based on the fact that this property has a callback with params extending AgGridCommon
   */
  getCallback(e) {
    return this.mergeGridCommonParams(this.gridOptions[e]);
  }
  /**
   * Returns `true` if a value has been specified for this GridOption.
   * @param property GridOption property
   */
  exists(e) {
    return A(this.gridOptions[e]);
  }
  /**
   * Wrap the user callback and attach the api and context to the params object on the way through.
   * @param callback User provided callback
   * @returns Wrapped callback where the params object not require api and context
   */
  mergeGridCommonParams(e) {
    return e && ((s) => e(this.addCommon(s)));
  }
  updateGridOptions({
    options: e,
    force: t,
    source: s = "api"
  }) {
    const i = { id: NE++, properties: [] }, r = [], { gridOptions: n, validation: o } = this;
    for (const a of Object.keys(e)) {
      const l = e[a];
      o == null || o.warnOnInitialPropertyUpdate(s, a);
      const c = t || typeof l == "object" && s === "api", d = n[a];
      if (c || d !== l) {
        n[a] = l;
        const h = {
          type: a,
          currentValue: l,
          previousValue: d,
          changeSet: i,
          source: s
        };
        r.push(h);
      }
    }
    this.validateGridOptions(this.gridOptions), i.properties = r.map((a) => a.type), r.forEach((a) => {
      ei(this, `Updated property ${a.type} from`, a.previousValue, " to ", a.currentValue), this.propEventSvc.dispatchEvent(a);
    });
  }
  addPropertyEventListener(e, t) {
    this.propEventSvc.addEventListener(e, t);
  }
  removePropertyEventListener(e, t) {
    this.propEventSvc.removeEventListener(e, t);
  }
  getDomDataKey() {
    return this.domDataKey;
  }
  /** Prefer _addGridCommonParams from gridOptionsUtils for bundle size savings */
  addCommon(e) {
    return e.api = this.api, e.context = this.gridOptionsContext, e;
  }
  validateOptions(e, t) {
    for (const s of Object.keys(e)) {
      const i = e[s];
      if (i == null || i === !1)
        continue;
      let r = t[s];
      typeof r == "function" && (r = r(e, this.gridOptions, this.beans)), r && this.assertModuleRegistered(r, s);
    }
  }
  validateGridOptions(e) {
    var t;
    this.validateOptions(e, OE), (t = this.validation) == null || t.processGridOptions(e);
  }
  validateColDef(e, t, s) {
    var i, r;
    (s || !((i = this.beans.dataTypeSvc) != null && i.isColPendingInference(t))) && (this.validateOptions(e, xE), (r = this.validation) == null || r.validateColDef(e));
  }
  assertModuleRegistered(e, t) {
    const s = Array.isArray(e) ? e.some((i) => this.isModuleRegistered(i)) : this.isModuleRegistered(e);
    return s || j(200, {
      ...this.getModuleErrorParams(),
      moduleName: e,
      reasonOrId: t
    }), s;
  }
  getModuleErrorParams() {
    return {
      gridId: this.gridId,
      gridScoped: Fd(),
      rowModelType: this.get("rowModelType"),
      isUmd: FP()
    };
  }
  isModuleRegistered(e) {
    return ac(e, this.gridId, this.get("rowModelType"));
  }
  setInstanceDomData(e) {
    e[su] = this.instanceId;
  }
  isElementInThisInstance(e) {
    let t = e;
    for (; t; ) {
      const s = t[su];
      if (A(s))
        return s === this.instanceId;
      t = t.parentElement;
    }
    return !1;
  }
};
function WE(e) {
  return !!Rd[e];
}
function Qf(e) {
  const t = { "aria-hidden": "true" };
  return {
    tag: "div",
    cls: "ag-cell-label-container",
    role: "presentation",
    children: [
      {
        tag: "span",
        ref: "eMenu",
        cls: "ag-header-icon ag-header-cell-menu-button",
        attrs: t
      },
      {
        tag: "span",
        ref: "eFilterButton",
        cls: "ag-header-icon ag-header-cell-filter-button",
        attrs: t
      },
      {
        tag: "div",
        ref: "eLabel",
        cls: "ag-header-cell-label",
        role: "presentation",
        children: [
          { tag: "span", ref: "eText", cls: "ag-header-cell-text" },
          {
            tag: "span",
            ref: "eFilter",
            cls: "ag-header-icon ag-header-label-icon ag-filter-icon",
            attrs: t
          },
          e ? { tag: "ag-sort-indicator", ref: "eSortIndicator" } : null
        ]
      }
    ]
  };
}
var _E = Qf(!0), UE = Qf(!1), $E = class extends D {
  constructor() {
    super(...arguments), this.eFilter = x, this.eFilterButton = x, this.eSortIndicator = x, this.eMenu = x, this.eLabel = x, this.eText = x, this.eSortOrder = x, this.eSortAsc = x, this.eSortDesc = x, this.eSortMixed = x, this.eSortNone = x, this.isLoadingInnerComponent = !1;
  }
  refresh(e) {
    var s, i, r;
    const t = this.params;
    if (this.params = e, this.workOutTemplate(e, !!((s = this.beans) != null && s.sortSvc)) != this.currentTemplate || this.workOutShowMenu() != this.currentShowMenu || e.enableSorting != this.currentSort || this.currentSuppressMenuHide != null && this.shouldSuppressMenuHide() != this.currentSuppressMenuHide || t.enableFilterButton != e.enableFilterButton || t.enableFilterIcon != e.enableFilterIcon)
      return !1;
    if (this.innerHeaderComponent) {
      const n = { ...e };
      Fe(n, e.innerHeaderComponentParams), (r = (i = this.innerHeaderComponent).refresh) == null || r.call(i, n);
    } else
      this.setDisplayName(e);
    return !0;
  }
  workOutTemplate(e, t) {
    const s = e.template;
    return s ? s != null && s.trim ? s.trim() : s : t ? _E : UE;
  }
  init(e) {
    this.params = e;
    const { sortSvc: t, touchSvc: s, rowNumbersSvc: i, userCompFactory: r } = this.beans, n = t == null ? void 0 : t.getSortIndicatorSelector();
    this.currentTemplate = this.workOutTemplate(e, !!n), this.setTemplate(this.currentTemplate, n ? [n] : void 0), s == null || s.setupForHeader(this), this.setMenu(), this.setupSort(), i == null || i.setupForHeader(this), this.setupFilterIcon(), this.setupFilterButton(), this.workOutInnerHeaderComponent(r, e), this.setDisplayName(e);
  }
  workOutInnerHeaderComponent(e, t) {
    const s = Nb(e, t, t);
    s && (this.isLoadingInnerComponent = !0, s.newAgStackInstance().then((i) => {
      this.isLoadingInnerComponent = !1, i && (this.isAlive() ? (this.innerHeaderComponent = i, this.eText && this.eText.appendChild(i.getGui())) : this.destroyBean(i));
    }));
  }
  setDisplayName(e) {
    const { displayName: t } = e, s = this.currentDisplayName;
    this.currentDisplayName = t, !(!this.eText || s === t || this.innerHeaderComponent || this.isLoadingInnerComponent) && (this.eText.textContent = Nt(t));
  }
  addInIcon(e, t, s) {
    const i = N(e, this.beans, s);
    i && t.appendChild(i);
  }
  workOutShowMenu() {
    var e;
    return this.params.enableMenu && !!((e = this.beans.menuSvc) != null && e.isHeaderMenuButtonEnabled());
  }
  shouldSuppressMenuHide() {
    var e;
    return !!((e = this.beans.menuSvc) != null && e.isHeaderMenuButtonAlwaysShowEnabled());
  }
  setMenu() {
    if (!this.eMenu)
      return;
    if (this.currentShowMenu = this.workOutShowMenu(), !this.currentShowMenu) {
      se(this.eMenu), this.eMenu = void 0;
      return;
    }
    const { gos: e, eMenu: t, params: s } = this, i = Ae(e);
    this.addInIcon(i ? "menu" : "menuAlt", t, s.column), t.classList.toggle("ag-header-menu-icon", !i);
    const r = this.shouldSuppressMenuHide();
    this.currentSuppressMenuHide = r, this.addManagedElementListeners(t, { click: () => this.showColumnMenu(this.eMenu) }), this.toggleMenuAlwaysShow(r);
  }
  toggleMenuAlwaysShow(e) {
    var t;
    (t = this.eMenu) == null || t.classList.toggle("ag-header-menu-always-show", e);
  }
  showColumnMenu(e) {
    const { currentSuppressMenuHide: t, params: s } = this;
    t || this.toggleMenuAlwaysShow(!0), s.showColumnMenu(e, () => {
      t || this.toggleMenuAlwaysShow(!1);
    });
  }
  onMenuKeyboardShortcut(e) {
    var l;
    const { params: t, gos: s, beans: i, eMenu: r, eFilterButton: n } = this, o = t.column, a = Ae(s);
    if (e && !a) {
      if ((l = i.menuSvc) != null && l.isFilterMenuInHeaderEnabled(o))
        return t.showFilter(n ?? r ?? this.getGui()), !0;
    } else if (t.enableMenu)
      return this.showColumnMenu(r ?? n ?? this.getGui()), !0;
    return !1;
  }
  setupSort() {
    const { sortSvc: e } = this.beans;
    if (!e)
      return;
    const { enableSorting: t, column: s } = this.params;
    if (this.currentSort = t, !this.eSortIndicator) {
      this.eSortIndicator = this.createBean(e.createSortIndicator(!0));
      const { eSortIndicator: i, eSortOrder: r, eSortAsc: n, eSortDesc: o, eSortMixed: a, eSortNone: l } = this;
      i.attachCustomElements(r, n, o, a, l);
    }
    this.eSortIndicator.setupSort(s), this.currentSort && e.setupHeader(this, s, this.eLabel);
  }
  setupFilterIcon() {
    const { eFilter: e, params: t } = this;
    if (!e)
      return;
    const s = () => {
      const i = t.column.isFilterActive();
      O(e, i, { skipAriaHidden: !0 });
    };
    this.configureFilter(t.enableFilterIcon, e, s, "filterActive");
  }
  setupFilterButton() {
    const { eFilterButton: e, params: t } = this;
    if (!e)
      return;
    this.configureFilter(
      t.enableFilterButton,
      e,
      this.onFilterChangedButton.bind(this),
      "filter"
    ) ? this.addManagedElementListeners(e, {
      click: () => t.showFilter(e)
    }) : this.eFilterButton = void 0;
  }
  configureFilter(e, t, s, i) {
    if (!e)
      return se(t), !1;
    const r = this.params.column;
    return this.addInIcon(i, t, r), this.addManagedListeners(r, { filterChanged: s }), s(), !0;
  }
  onFilterChangedButton() {
    const e = this.params.column.isFilterActive();
    this.eFilterButton.classList.toggle("ag-filter-active", e);
  }
  getAnchorElementForMenu(e) {
    const { eFilterButton: t, eMenu: s } = this;
    return e ? t ?? s ?? this.getGui() : s ?? t ?? this.getGui();
  }
  destroy() {
    super.destroy(), this.innerHeaderComponent && (this.destroyBean(this.innerHeaderComponent), this.innerHeaderComponent = void 0);
  }
}, KE = {
  tag: "div",
  cls: "ag-header-group-cell-label",
  role: "presentation",
  children: [
    { tag: "span", ref: "agLabel", cls: "ag-header-group-text", role: "presentation" },
    { tag: "span", ref: "agOpened", cls: "ag-header-icon ag-header-expand-icon ag-header-expand-icon-expanded" },
    { tag: "span", ref: "agClosed", cls: "ag-header-icon ag-header-expand-icon ag-header-expand-icon-collapsed" }
  ]
}, jE = class extends D {
  constructor() {
    super(KE), this.agOpened = x, this.agClosed = x, this.agLabel = x, this.isLoadingInnerComponent = !1;
  }
  init(e) {
    const { userCompFactory: t, touchSvc: s } = this.beans;
    this.params = e, this.checkWarnings(), this.workOutInnerHeaderGroupComponent(t, e), this.setupLabel(e), this.addGroupExpandIcon(e), this.setupExpandIcons(), s == null || s.setupForHeaderGroup(this);
  }
  checkWarnings() {
    this.params.template && F(89);
  }
  workOutInnerHeaderGroupComponent(e, t) {
    const s = zb(e, t, t);
    s && (this.isLoadingInnerComponent = !0, s.newAgStackInstance().then((i) => {
      this.isLoadingInnerComponent = !1, i && (this.isAlive() ? (this.innerHeaderGroupComponent = i, this.agLabel.appendChild(i.getGui())) : this.destroyBean(i));
    }));
  }
  setupExpandIcons() {
    const {
      agOpened: e,
      agClosed: t,
      params: { columnGroup: s },
      beans: i
    } = this;
    this.addInIcon("columnGroupOpened", e), this.addInIcon("columnGroupClosed", t);
    const r = (l) => {
      if (St(l))
        return;
      const c = !s.isExpanded();
      i.colGroupSvc.setColumnGroupOpened(
        s.getProvidedColumnGroup(),
        c,
        "uiColumnExpanded"
      );
    };
    this.addTouchAndClickListeners(i, t, r), this.addTouchAndClickListeners(i, e, r);
    const n = (l) => {
      he(l);
    };
    this.addManagedElementListeners(t, { dblclick: n }), this.addManagedElementListeners(e, { dblclick: n }), this.addManagedElementListeners(this.getGui(), { dblclick: r }), this.updateIconVisibility();
    const o = s.getProvidedColumnGroup(), a = this.updateIconVisibility.bind(this);
    this.addManagedListeners(o, {
      expandedChanged: a,
      expandableChanged: a
    });
  }
  addTouchAndClickListeners(e, t, s) {
    var i;
    (i = e.touchSvc) == null || i.setupForHeaderGroupElement(this, t, s), this.addManagedElementListeners(t, { click: s });
  }
  updateIconVisibility() {
    const {
      agOpened: e,
      agClosed: t,
      params: { columnGroup: s }
    } = this;
    if (s.isExpandable()) {
      const i = s.isExpanded();
      O(e, i), O(t, !i);
    } else
      O(e, !1), O(t, !1);
  }
  addInIcon(e, t) {
    const s = N(e, this.beans, null);
    s && t.appendChild(s);
  }
  addGroupExpandIcon(e) {
    if (!e.columnGroup.isExpandable()) {
      const { agOpened: t, agClosed: s } = this;
      O(t, !1), O(s, !1);
      return;
    }
  }
  setupLabel(e) {
    var r;
    const { displayName: t, columnGroup: s } = e, i = this.innerHeaderGroupComponent || this.isLoadingInnerComponent;
    A(t) && !i && (this.agLabel.textContent = Nt(t)), this.toggleCss("ag-sticky-label", !((r = s.getColGroupDef()) != null && r.suppressStickyLabel));
  }
  destroy() {
    super.destroy(), this.innerHeaderGroupComponent && (this.destroyBean(this.innerHeaderGroupComponent), this.innerHeaderGroupComponent = void 0);
  }
}, YE = {
  moduleName: "ColumnHeaderComp",
  version: B,
  userComponents: {
    agColumnHeader: $E
  },
  icons: {
    // button to launch legacy column menu
    menu: "menu",
    // button to launch new enterprise column menu
    menuAlt: "menu-alt"
  }
}, qE = {
  moduleName: "ColumnGroupHeaderComp",
  version: B,
  userComponents: {
    agColumnGroupHeader: jE
  },
  icons: {
    // header column group shown when expanded (click to contract)
    columnGroupOpened: "expanded",
    // header column group shown when contracted (click to expand)
    columnGroupClosed: "contracted"
  }
}, XE = class extends R {
  constructor() {
    super(...arguments), this.beanName = "animationFrameSvc", this.p1 = { list: [], sorted: !1 }, this.p2 = { list: [], sorted: !1 }, this.f1 = { list: [], sorted: !1 }, this.destroyTasks = [], this.ticking = !1, this.scrollGoingDown = !0, this.lastScrollTop = 0, this.taskCount = 0;
  }
  setScrollTop(e) {
    this.scrollGoingDown = e >= this.lastScrollTop, e === 0 && (this.scrollGoingDown = !0), this.lastScrollTop = e;
  }
  postConstruct() {
    this.active = !this.gos.get("suppressAnimationFrame"), this.batchFrameworkComps = this.beans.frameworkOverrides.batchFrameworkComps;
  }
  // this method is for our AG Grid sanity only - if animation frames are turned off,
  // then no place in the code should be looking to add any work to be done in animation
  // frames. this stops bugs - where some code is asking for a frame to be executed
  // when it should not.
  verify() {
    this.active === !1 && F(92);
  }
  createTask(e, t, s, i, r = !1) {
    this.verify();
    let n = s;
    i && this.batchFrameworkComps && (n = "f1");
    const o = { task: e, index: t, createOrder: ++this.taskCount, deferred: r };
    this.addTaskToList(this[n], o), this.schedule();
  }
  addTaskToList(e, t) {
    e.list.push(t), e.sorted = !1;
  }
  sortTaskList(e) {
    if (e.sorted)
      return;
    const t = this.scrollGoingDown ? 1 : -1;
    e.list.sort((s, i) => s.deferred !== i.deferred ? s.deferred ? -1 : 1 : s.index !== i.index ? t * (i.index - s.index) : i.createOrder - s.createOrder), e.sorted = !0;
  }
  addDestroyTask(e) {
    this.verify(), this.destroyTasks.push(e), this.schedule();
  }
  executeFrame(e) {
    const { p1: t, p2: s, f1: i, destroyTasks: r, beans: n } = this, { ctrlsSvc: o, frameworkOverrides: a } = n, l = t.list, c = s.list, d = i.list, h = Date.now();
    let u = 0;
    const g = e <= 0, p = o.getScrollFeature();
    for (; g || u < e; ) {
      if (!p.scrollGridIfNeeded()) {
        let m;
        if (l.length)
          this.sortTaskList(t), m = l.pop().task;
        else if (c.length)
          this.sortTaskList(s), m = c.pop().task;
        else if (d.length)
          a.wrapOutgoing(() => {
            for (; (g || u < e) && !p.scrollGridIfNeeded(); ) {
              if (d.length)
                this.sortTaskList(i), m = d.pop().task, m();
              else
                break;
              u = Date.now() - h;
            }
          }), m = () => {
          };
        else if (r.length)
          m = r.pop();
        else
          break;
        m();
      }
      u = Date.now() - h;
    }
    l.length || c.length || d.length || r.length ? this.requestFrame() : this.ticking = !1;
  }
  flushAllFrames() {
    this.active && this.executeFrame(-1);
  }
  schedule() {
    this.active && (this.ticking || (this.ticking = !0, this.requestFrame()));
  }
  requestFrame() {
    const e = this.executeFrame.bind(this, 60);
    xt(this.beans, e);
  }
  isQueueEmpty() {
    return !this.ticking;
  }
}, ZE = {
  moduleName: "AnimationFrame",
  version: B,
  beans: [XE]
}, QE = class extends R {
  constructor() {
    super(...arguments), this.beanName = "iconSvc";
  }
  createIconNoSpan(e, t) {
    return N(e, this.beans, t == null ? void 0 : t.column);
  }
}, JE = class extends R {
  constructor() {
    super(...arguments), this.beanName = "touchSvc";
  }
  mockBodyContextMenu(e, t) {
    this.mockContextMenu(e, e.eBodyViewport, t);
  }
  mockHeaderContextMenu(e, t) {
    this.mockContextMenu(e, e.eGui, t);
  }
  mockRowContextMenu(e) {
    if (!Xs())
      return;
    const t = (s, i, r) => {
      var a;
      const { rowCtrl: n, cellCtrl: o } = e.getControlsForEventTarget((r == null ? void 0 : r.target) ?? null);
      o != null && o.column && o.dispatchCellContextMenuEvent(r ?? null), (a = this.beans.contextMenuSvc) == null || a.handleContextMenuMouseEvent(void 0, r, n, o);
    };
    this.mockContextMenu(e, e.element, t);
  }
  handleCellDoubleClick(e, t) {
    return (() => {
      if (!Xs() || zg("dblclick"))
        return !1;
      const i = Date.now(), r = i - e.lastIPadMouseClickEvent < 200;
      return e.lastIPadMouseClickEvent = i, r;
    })() ? (e.onCellDoubleClicked(t), t.preventDefault(), !0) : !1;
  }
  setupForHeader(e) {
    const { gos: t, sortSvc: s, menuSvc: i } = this.beans;
    if (t.get("suppressTouch"))
      return;
    const { params: r, eMenu: n, eFilterButton: o } = e, a = new ms(e.getGui(), !0), l = e.shouldSuppressMenuHide(), c = l && A(n) && r.enableMenu, d = c ? new ms(n, !0) : a;
    if (r.enableMenu || i != null && i.isHeaderContextMenuEnabled(r.column)) {
      const h = c ? "tap" : "longTap", u = (g) => r.showColumnMenuAfterMouseClick(g.touchStart);
      e.addManagedListeners(d, { [h]: u });
    }
    if (r.enableSorting) {
      const h = (u) => {
        const g = u.touchStart.target;
        l && (n != null && n.contains(g) || o != null && o.contains(g)) || s == null || s.progressSort(r.column, !1, "uiColumnSorted");
      };
      e.addManagedListeners(a, { tap: h });
    }
    if (r.enableFilterButton && o) {
      const h = new ms(o, !0);
      e.addManagedListeners(h, {
        tap: () => r.showFilter(o)
      }), e.addDestroyFunc(() => h.destroy());
    }
    e.addDestroyFunc(() => a.destroy()), c && e.addDestroyFunc(() => d.destroy());
  }
  setupForHeaderGroup(e) {
    var s;
    const t = e.params;
    if ((s = this.beans.menuSvc) != null && s.isHeaderContextMenuEnabled(
      t.columnGroup.getProvidedColumnGroup()
    )) {
      const i = new ms(t.eGridHeader, !0), r = (n) => t.showColumnMenuAfterMouseClick(n.touchStart);
      e.addManagedListeners(i, { longTap: r }), e.addDestroyFunc(() => i.destroy());
    }
  }
  setupForHeaderGroupElement(e, t, s) {
    const i = new ms(t, !0);
    e.addManagedListeners(i, { tap: s }), e.addDestroyFunc(() => i.destroy());
  }
  mockContextMenu(e, t, s) {
    if (!Xs())
      return;
    const i = new ms(t), r = (n) => {
      tn(this.beans, n.touchEvent) && s(void 0, n.touchStart, n.touchEvent);
    };
    e.addManagedListeners(i, { longTap: r }), e.addDestroyFunc(() => i.destroy());
  }
}, eT = {
  moduleName: "Touch",
  version: B,
  beans: [JE]
}, tT = class extends R {
  constructor() {
    super(...arguments), this.beanName = "cellNavigation";
  }
  wireBeans(e) {
    this.rowSpanSvc = e.rowSpanSvc;
  }
  // returns null if no cell to focus on, ie at the end of the grid
  getNextCellToFocus(e, t, s = !1) {
    return s ? this.getNextCellToFocusWithCtrlPressed(e, t) : this.getNextCellToFocusWithoutCtrlPressed(e, t);
  }
  getNextCellToFocusWithCtrlPressed(e, t) {
    const s = e === S.UP, i = e === S.DOWN, r = e === S.LEFT;
    let n, o;
    const { pageBounds: a, gos: l, visibleCols: c, pinnedRowModel: d } = this.beans, { rowPinned: h } = t;
    if (s || i)
      h && d ? s ? o = 0 : o = h === "top" ? d.getPinnedTopRowCount() - 1 : d.getPinnedBottomRowCount() - 1 : o = s ? a.getFirstRow() : a.getLastRow(), n = t.column;
    else {
      const u = l.get("enableRtl");
      o = t.rowIndex, n = (r !== u ? c.allCols : [...c.allCols].reverse()).find(
        (p) => this.isCellGoodToFocusOn({
          rowIndex: o,
          rowPinned: null,
          column: p
        })
      );
    }
    return n ? {
      rowIndex: o,
      rowPinned: h,
      column: n
    } : null;
  }
  getNextCellToFocusWithoutCtrlPressed(e, t) {
    let s = t, i = !1;
    for (; !i; ) {
      switch (e) {
        case S.UP:
          s = this.getCellAbove(s);
          break;
        case S.DOWN:
          s = this.getCellBelow(s);
          break;
        case S.RIGHT:
          s = this.gos.get("enableRtl") ? this.getCellToLeft(s) : this.getCellToRight(s);
          break;
        case S.LEFT:
          s = this.gos.get("enableRtl") ? this.getCellToRight(s) : this.getCellToLeft(s);
          break;
        default:
          s = null, F(8, { key: e });
          break;
      }
      s ? i = this.isCellGoodToFocusOn(s) : i = !0;
    }
    return s;
  }
  isCellGoodToFocusOn(e) {
    const t = e.column;
    let s;
    const { pinnedRowModel: i, rowModel: r } = this.beans;
    switch (e.rowPinned) {
      case "top":
        s = i == null ? void 0 : i.getPinnedTopRow(e.rowIndex);
        break;
      case "bottom":
        s = i == null ? void 0 : i.getPinnedBottomRow(e.rowIndex);
        break;
      default:
        s = r.getRow(e.rowIndex);
        break;
    }
    return s ? !this.isSuppressNavigable(t, s) : !1;
  }
  getCellToLeft(e) {
    if (!e)
      return null;
    const t = this.beans.visibleCols.getColBefore(e.column);
    return t ? {
      rowIndex: e.rowIndex,
      column: t,
      rowPinned: e.rowPinned
    } : null;
  }
  getCellToRight(e) {
    if (!e)
      return null;
    const t = this.beans.visibleCols.getColAfter(e.column);
    return t ? {
      rowIndex: e.rowIndex,
      column: t,
      rowPinned: e.rowPinned
    } : null;
  }
  getCellBelow(e) {
    var i;
    if (!e)
      return null;
    const t = ((i = this.rowSpanSvc) == null ? void 0 : i.getCellEnd(e)) ?? e, s = dt(this.beans, t, !0);
    return s ? {
      rowIndex: s.rowIndex,
      column: e.column,
      rowPinned: s.rowPinned
    } : null;
  }
  getCellAbove(e) {
    var i;
    if (!e)
      return null;
    const t = ((i = this.rowSpanSvc) == null ? void 0 : i.getCellStart(e)) ?? e, s = xs(
      this.beans,
      {
        rowIndex: t.rowIndex,
        rowPinned: t.rowPinned
      },
      !0
    );
    return s ? {
      rowIndex: s.rowIndex,
      column: e.column,
      rowPinned: s.rowPinned
    } : null;
  }
  getNextTabbedCell(e, t) {
    return t ? this.getNextTabbedCellBackwards(e) : this.getNextTabbedCellForwards(e);
  }
  getNextTabbedCellForwards(e) {
    const { visibleCols: t, pagination: s } = this.beans, i = t.allCols;
    let r = e.rowIndex, n = e.rowPinned, o = t.getColAfter(e.column);
    if (!o) {
      o = i[0];
      const a = dt(this.beans, e, !0);
      if (ee(a) || !a.rowPinned && !((s == null ? void 0 : s.isRowInPage(a.rowIndex)) ?? !0))
        return null;
      r = a ? a.rowIndex : null, n = a ? a.rowPinned : null;
    }
    return { rowIndex: r, column: o, rowPinned: n };
  }
  getNextTabbedCellBackwards(e) {
    const { beans: t } = this, { visibleCols: s, pagination: i } = t, r = s.allCols;
    let n = e.rowIndex, o = e.rowPinned, a = s.getColBefore(e.column);
    if (!a) {
      a = _(r);
      const l = xs(t, { rowIndex: e.rowIndex, rowPinned: e.rowPinned }, !0);
      if (ee(l) || !l.rowPinned && !((i == null ? void 0 : i.isRowInPage(l.rowIndex)) ?? !0))
        return null;
      n = l ? l.rowIndex : null, o = l ? l.rowPinned : null;
    }
    return { rowIndex: n, column: a, rowPinned: o };
  }
  isSuppressNavigable(e, t) {
    const { suppressNavigable: s } = e.colDef;
    if (typeof s == "boolean")
      return s;
    if (typeof s == "function") {
      const i = e.createColumnFunctionCallbackParams(t);
      return s(i);
    }
    return !1;
  }
};
function sT(e) {
  return e.focusSvc.getFocusedCell();
}
function iT(e) {
  return e.focusSvc.clearFocusedCell();
}
function rT(e, t, s, i) {
  e.focusSvc.setFocusedCell({ rowIndex: t, column: s, rowPinned: i, forceBrowserFocus: !0 });
}
function nT(e, t) {
  var s;
  return ((s = e.navigation) == null ? void 0 : s.tabToNextCell(!1, t)) ?? !1;
}
function oT(e, t) {
  var s;
  return ((s = e.navigation) == null ? void 0 : s.tabToNextCell(!0, t)) ?? !1;
}
function aT(e, t, s = !1) {
  var r;
  const i = (r = e.headerNavigation) == null ? void 0 : r.getHeaderPositionForColumn(t, s);
  i && e.focusSvc.focusHeaderPosition({ headerPosition: i });
}
var lT = class extends R {
  constructor() {
    super(...arguments), this.beanName = "editModelSvc", this.edits = /* @__PURE__ */ new Map(), this.cellValidations = new Jf(), this.rowValidations = new em(), this.suspendEdits = !1;
  }
  suspend(e) {
    this.suspendEdits = e;
  }
  removeEdits({ rowNode: e, column: t }) {
    if (!this.hasEdits({ rowNode: e }) || !e)
      return;
    const s = this.getEditRow(e);
    t ? s.delete(t) : s.clear(), s.size === 0 && this.edits.delete(e);
  }
  getEditRow(e, t = {}) {
    if (this.suspendEdits || this.edits.size === 0)
      return;
    const s = e && this.edits.get(e);
    if (s)
      return s;
    if (t.checkSiblings) {
      const i = e.pinnedSibling;
      if (i)
        return this.getEditRow(i);
    }
  }
  getEditRowDataValue(e, { checkSiblings: t } = {}) {
    if (!e || this.edits.size === 0)
      return;
    const s = this.getEditRow(e), i = e.pinnedSibling, r = t && i && this.getEditRow(i);
    if (!s && !r)
      return;
    const n = Object.assign({}, e.data), o = (a, l) => a.forEach(({ pendingValue: c }, d) => {
      c !== Dt && (l[d.getColId()] = c);
    });
    return s && o(s, n), r && o(r, n), n;
  }
  getEdit(e, t) {
    const s = this._getEdit(e);
    return t && s ? { ...s } : s;
  }
  _getEdit(e) {
    var t;
    if (!this.suspendEdits && this.edits.size !== 0)
      return e.rowNode && e.column && ((t = this.getEditRow(e.rowNode)) == null ? void 0 : t.get(e.column));
  }
  getEditMap(e = !0) {
    if (this.suspendEdits || this.edits.size === 0)
      return /* @__PURE__ */ new Map();
    if (!e)
      return this.edits;
    const t = /* @__PURE__ */ new Map();
    return this.edits.forEach((s, i) => {
      const r = /* @__PURE__ */ new Map();
      s.forEach(
        ({ editorState: n, ...o }, a) => (
          // Ensure we copy the cell data to avoid reference issues
          r.set(a, { ...o })
        )
      ), t.set(i, r);
    }), t;
  }
  setEditMap(e) {
    this.edits.clear(), e.forEach((t, s) => {
      const i = /* @__PURE__ */ new Map();
      t.forEach(
        (r, n) => (
          // Ensure we copy the cell data to avoid reference issues
          i.set(n, { ...r })
        )
      ), this.edits.set(s, i);
    });
  }
  setEdit(e, t) {
    (this.edits.size === 0 || !this.edits.has(e.rowNode)) && this.edits.set(e.rowNode, /* @__PURE__ */ new Map());
    const s = this._getEdit(e), i = Object.assign({
      editorState: {
        isCancelAfterEnd: void 0,
        isCancelBeforeStart: void 0
      },
      ...s,
      ...t
    });
    return this.getEditRow(e.rowNode).set(e.column, i), i;
  }
  clearEditValue(e) {
    var i;
    const { rowNode: t, column: s } = e;
    if (t)
      if (s) {
        const r = this._getEdit(e);
        r && (r.editorValue = void 0, r.pendingValue = r.sourceValue, r.state = "changed");
      } else
        (i = this.getEditRow(t)) == null || i.forEach((r) => {
          r.editorValue = void 0, r.pendingValue = r.sourceValue, r.state = "changed";
        });
  }
  getState(e) {
    var t;
    if (!this.suspendEdits)
      return (t = this.getEdit(e)) == null ? void 0 : t.state;
  }
  getEditPositions(e) {
    if (this.suspendEdits || (e ?? this.edits).size === 0)
      return [];
    const t = [];
    return (e ?? this.edits).forEach((s, i) => {
      for (const r of s.keys()) {
        const { editorState: n, ...o } = s.get(r);
        t.push({
          rowNode: i,
          column: r,
          ...o
        });
      }
    }), t;
  }
  hasRowEdits(e, t) {
    return this.suspendEdits || this.edits.size === 0 ? !1 : !!this.getEditRow(e, t);
  }
  hasEdits(e = {}, t = {}) {
    var n;
    if (this.suspendEdits || this.edits.size === 0)
      return !1;
    const { rowNode: s, column: i } = e, { withOpenEditor: r } = t;
    if (s) {
      const o = this.getEditRow(s, t);
      return o ? i ? r ? ((n = this.getEdit(e)) == null ? void 0 : n.state) === "editing" : o.has(i) ?? !1 : o.size !== 0 ? r ? Array.from(o.values()).some(({ state: a }) => a === "editing") : !0 : !1 : !1;
    }
    return r ? this.getEditPositions().some(({ state: o }) => o === "editing") : this.edits.size > 0;
  }
  start(e) {
    const t = this.getEditRow(e.rowNode) ?? /* @__PURE__ */ new Map(), { rowNode: s, column: i } = e;
    i && !t.has(i) && t.set(i, {
      editorValue: void 0,
      pendingValue: Dt,
      sourceValue: this.beans.valueSvc.getValue(i, s, !1, "api"),
      state: "editing",
      editorState: {
        isCancelAfterEnd: void 0,
        isCancelBeforeStart: void 0
      }
    }), this.edits.set(s, t);
  }
  stop(e) {
    this.hasEdits(e) && (e ? this.removeEdits(e) : this.clear());
  }
  clear() {
    for (const e of this.edits.values())
      e.clear();
    this.edits.clear();
  }
  getCellValidationModel() {
    return this.cellValidations;
  }
  getRowValidationModel() {
    return this.rowValidations;
  }
  setCellValidationModel(e) {
    this.cellValidations = e;
  }
  setRowValidationModel(e) {
    this.rowValidations = e;
  }
  destroy() {
    super.destroy(), this.clear();
  }
}, Jf = class {
  constructor() {
    this.cellValidations = /* @__PURE__ */ new Map();
  }
  getCellValidation(e) {
    var i, r;
    const { rowNode: t, column: s } = e || {};
    return (r = (i = this.cellValidations) == null ? void 0 : i.get(t)) == null ? void 0 : r.get(s);
  }
  hasCellValidation(e) {
    return !e || !e.rowNode || !e.column ? this.cellValidations.size > 0 : !!this.getCellValidation(e);
  }
  setCellValidation(e, t) {
    const { rowNode: s, column: i } = e;
    this.cellValidations.has(s) || this.cellValidations.set(s, /* @__PURE__ */ new Map()), this.cellValidations.get(s).set(i, t);
  }
  clearCellValidation(e) {
    var i;
    const { rowNode: t, column: s } = e;
    (i = this.cellValidations.get(t)) == null || i.delete(s);
  }
  setCellValidationMap(e) {
    this.cellValidations = e;
  }
  getCellValidationMap() {
    return this.cellValidations;
  }
  clearCellValidationMap() {
    this.cellValidations.clear();
  }
}, em = class {
  constructor() {
    this.rowValidations = /* @__PURE__ */ new Map();
  }
  getRowValidation(e) {
    const { rowNode: t } = e || {};
    return this.rowValidations.get(t);
  }
  hasRowValidation(e) {
    return !e || !e.rowNode ? this.rowValidations.size > 0 : !!this.getRowValidation(e);
  }
  setRowValidation({ rowNode: e }, t) {
    this.rowValidations.set(e, t);
  }
  clearRowValidation({ rowNode: e }) {
    this.rowValidations.delete(e);
  }
  setRowValidationMap(e) {
    this.rowValidations = e;
  }
  getRowValidationMap() {
    return this.rowValidations;
  }
  clearRowValidationMap() {
    this.rowValidations.clear();
  }
};
function Ed(e, t = {}) {
  var c;
  const { rowIndex: s, rowId: i, rowCtrl: r, rowPinned: n } = t;
  if (r)
    return r;
  const { rowModel: o, rowRenderer: a } = e;
  let { rowNode: l } = t;
  return l || (i ? l = PF(e, i, n) : s != null && (l = o.getRow(s))), (c = a.getRowCtrls(l ? [l] : [])) == null ? void 0 : c[0];
}
function ge(e, t = {}) {
  var d;
  const { cellCtrl: s, colId: i, columnId: r, column: n } = t;
  if (s)
    return s;
  const o = e.colModel.getCol(i ?? r ?? lc(n)), a = t.rowCtrl ?? Ed(e, t), l = (a == null ? void 0 : a.getCellCtrl(o)) ?? void 0;
  if (l)
    return l;
  const c = t.rowNode ?? (a == null ? void 0 : a.rowNode);
  if (c)
    return (d = e.rowRenderer.getCellCtrls([c], [o])) == null ? void 0 : d[0];
}
function iu(e) {
  const { editSvc: t } = e;
  t != null && t.isBatchEditing() ? or(e) : t == null || t.stopEditing(void 0, { source: "api" });
}
function cT(e, t, s) {
  const { gos: i, popupSvc: r } = t;
  if (!i.get("stopEditingWhenCellsLoseFocus"))
    return;
  const n = (o) => {
    const a = o.relatedTarget;
    if (Kl(a) === null) {
      iu(t);
      return;
    }
    let l = (
      // see if click came from inside the viewports
      s.some((c) => c.contains(a)) && // and also that it's not from a detail grid
      i.isElementInThisInstance(a)
    );
    l || (l = !!r && (r.getActivePopups().some((c) => c.contains(a)) || r.isElementWithinCustomPopup(a))), l || iu(t);
  };
  s.forEach((o) => e.addManagedElementListeners(o, { focusout: n }));
}
function lc(e) {
  if (e)
    return typeof e == "string" ? e : e.getColId();
}
var Dt = Symbol("unedited");
function tm(e, t = {}) {
  var r;
  const s = [], i = e.rowRenderer.getCellCtrls(t.rowNodes, t.columns);
  for (const n of i) {
    const o = (r = n.comp) == null ? void 0 : r.getCellEditor();
    o && s.push({
      ctrl: n,
      editor: Mi(o)
    });
  }
  return s;
}
var dT = (e, t = {}) => tm(e, t).map((s) => s.editor);
function hT(e, t, s, i, r, n) {
  var h;
  t.length === 0 && (s != null && s.rowNode) && (s != null && s.column) && Cr(e, s, { key: i, event: r, cellStartedEdit: n });
  const { valueSvc: o, editSvc: a, editModelSvc: l } = e, { rowNode: c, column: d } = s ?? {};
  for (const u of t) {
    const { rowNode: g, column: p } = u, f = ge(e, u);
    if (!f) {
      if (g && p) {
        const C = o.getValue(p, g, void 0, "api"), b = ((s == null ? void 0 : s.rowNode) === g && (s == null ? void 0 : s.column) === p && i || void 0) ?? (a == null ? void 0 : a.getCellDataValue(u, !1)) ?? ((h = o.getValueForDisplay(p, g)) == null ? void 0 : h.value) ?? C ?? Dt;
        l == null || l.setEdit(u, {
          pendingValue: b,
          sourceValue: C,
          state: "editing"
        });
      }
      continue;
    }
    const m = n && c === f.rowNode && f.column === d;
    Cr(
      e,
      { rowNode: c, column: f.column },
      {
        key: m ? i : null,
        event: m ? r : null,
        cellStartedEdit: m && n
      }
    );
  }
}
function ys({
  pendingValue: e,
  sourceValue: t
}) {
  return e === Dt && (e = t), e !== t;
}
function Cr(e, t, s) {
  var C, v, w, b, y, P, E, M, T, G;
  const i = e.gos.get("enableGroupEdit"), { key: r, event: n, cellStartedEdit: o, silent: a } = s ?? {}, l = ge(e, t), c = (C = l == null ? void 0 : l.comp) == null ? void 0 : C.getCellEditor(), d = im(e, t, r, o && !a), h = (v = e.editModelSvc) == null ? void 0 : v.getEdit(t);
  let u = d.value;
  if (u === void 0 && (u = h == null ? void 0 : h.sourceValue), (w = e.editModelSvc) == null || w.setEdit(t, {
    editorValue: u,
    state: "editing"
  }), c) {
    (b = c.refresh) == null || b.call(c, d);
    return;
  }
  const g = t.column.getColDef(), p = Tp(e.userCompFactory, g, d), f = (p == null ? void 0 : p.popupFromSelector) != null ? p.popupFromSelector : !!g.cellEditorPopup, m = (p == null ? void 0 : p.popupPositionFromSelector) != null ? p.popupPositionFromSelector : g.cellEditorPopupPosition;
  if (rm(p.params, n), l) {
    l.editCompDetails = p, (y = l.comp) == null || y.setEditDetails(p, f, m, e.gos.get("reactiveCustomComponents")), (P = l == null ? void 0 : l.rowCtrl) == null || P.refreshRow({ suppressFlash: !0 });
    const I = (E = e.editModelSvc) == null ? void 0 : E.getEdit(t, !0);
    !a && !((M = I == null ? void 0 : I.editorState) != null && M.cellStartedEditing) && ((T = e.editSvc) == null || T.dispatchCellEvent(
      t,
      n,
      "cellEditingStarted",
      i ? { value: u } : {}
    ), (G = e.editModelSvc) == null || G.setEdit(t, { editorState: { cellStartedEditing: !0 } }));
  }
}
function sm(e, t, s) {
  var n, o;
  const i = { editorValueExists: !1 };
  if (Td(e)) {
    const a = (n = t.getValidationErrors) == null ? void 0 : n.call(t);
    if (((a == null ? void 0 : a.length) ?? 0) > 0)
      return i;
  }
  if (s != null && s.isCancelling)
    return i;
  if (s != null && s.isStopping) {
    const a = (o = t == null ? void 0 : t.isCancelAfterEnd) == null ? void 0 : o.call(t);
    if (a)
      return { ...i, isCancelAfterEnd: a };
  }
  return {
    editorValue: t.getValue(),
    editorValueExists: !0
  };
}
function im(e, t, s, i) {
  var C, v, w, b;
  const { valueSvc: r, gos: n, editSvc: o } = e, a = e.gos.get("enableGroupEdit"), l = ge(e, t), c = ((C = t.rowNode) == null ? void 0 : C.rowIndex) ?? void 0, d = o == null ? void 0 : o.isBatchEditing(), h = e.colModel.getCol(t.column.getId()), { rowNode: u, column: g } = t, p = (v = l.comp) == null ? void 0 : v.getCellEditor(), f = (o == null ? void 0 : o.getCellDataValue(t, !1)) ?? (p ? (w = sm(e, p)) == null ? void 0 : w.editorValue : void 0), m = f === Dt ? (b = r.getValueForDisplay(h, u)) == null ? void 0 : b.value : f;
  return V(n, {
    value: a ? f : m,
    eventKey: s ?? null,
    column: g,
    colDef: g.getColDef(),
    rowIndex: c,
    node: u,
    data: u.data,
    cellStartedEdit: i ?? !1,
    onKeyDown: l == null ? void 0 : l.onKeyDown.bind(l),
    stopEditing: (y) => {
      o.stopEditing(t, { source: d ? "ui" : "api", suppressNavigateAfterEdit: y }), Ho(e, t);
    },
    eGridCell: l == null ? void 0 : l.eGui,
    parseValue: (y) => r.parseValue(h, u, y, l == null ? void 0 : l.value),
    formatValue: l == null ? void 0 : l.formatValue.bind(l),
    validate: () => {
      o == null || o.validateEdit();
    }
  });
}
function cc(e, t) {
  const { editModelSvc: s } = e;
  s == null || s.getEditMap().forEach((i, r) => {
    i.forEach((n, o) => {
      !t && (n.state === "editing" || n.pendingValue === Dt) || !ys(n) && (n.state !== "editing" || t) && (s == null || s.removeEdits({ rowNode: r, column: o }));
    });
  });
}
function uT(e, t) {
  var c;
  const s = (c = t.comp) == null ? void 0 : c.getCellEditor();
  if (!(s != null && s.refresh))
    return;
  const { eventKey: i, cellStartedEdit: r } = t.editCompDetails.params, { column: n } = t, o = im(e, t, i, r), a = n.getColDef(), l = Tp(e.userCompFactory, a, o);
  s.refresh(rm(l.params, i));
}
function rm(e, t) {
  var s;
  return t instanceof KeyboardEvent && e.column.getColDef().cellEditor === "agNumberCellEditor" ? e.suppressPreventDefault = ["-", "+", ".", "e"].includes((t == null ? void 0 : t.key) ?? "") || e.suppressPreventDefault : (s = t == null ? void 0 : t.preventDefault) == null || s.call(t), e;
}
function ui(e, t) {
  var s;
  (s = e.editModelSvc) == null || s.getEditPositions().forEach((i) => {
    var c, d;
    const r = ge(e, i);
    if (!r)
      return;
    const n = (c = r.comp) == null ? void 0 : c.getCellEditor();
    if (!n)
      return;
    const { editorValue: o, editorValueExists: a, isCancelAfterEnd: l } = sm(e, n, t);
    l && ((d = e.editModelSvc) == null || d.setEdit(i, { editorState: { isCancelAfterEnd: l } })), ho(e, i, o, void 0, !a, t);
  });
}
function ho(e, t, s, i, r, n) {
  const { editModelSvc: o, valueSvc: a } = e;
  if (!o)
    return;
  const { rowNode: l, column: c } = t;
  if (!(l && c))
    return;
  let d = o.getEdit(t, !0);
  d != null && d.sourceValue || (d = o.setEdit(t, {
    sourceValue: a.getValue(c, l, void 0, "api"),
    pendingValue: d ? d.editorValue : Dt
  })), o.setEdit(t, {
    editorValue: r ? d.sourceValue : s
  }), n != null && n.persist && gT(e, t);
}
function gT(e, t) {
  const { editModelSvc: s } = e, i = s == null ? void 0 : s.getEdit(t, !0);
  s == null || s.setEdit(t, {
    pendingValue: i == null ? void 0 : i.editorValue
  });
}
function or(e, t, s) {
  var i;
  t || (t = (i = e.editModelSvc) == null ? void 0 : i.getEditPositions()), t.forEach((r) => Ho(e, r, s));
}
function Ho(e, t, s) {
  var c, d;
  const i = e.gos.get("enableGroupEdit"), { editModelSvc: r } = e, n = ge(e, t), o = r == null ? void 0 : r.getEdit(t, !0);
  if (!n) {
    o && (r == null || r.setEdit(t, { state: "changed" }));
    return;
  }
  const { comp: a } = n;
  if (a && !a.getCellEditor()) {
    if (n == null || n.refreshCell(), o) {
      r == null || r.setEdit(t, { state: "changed" });
      const h = i ? ru(s, o) : {
        valueChanged: !1,
        newValue: void 0,
        oldValue: o.sourceValue
      };
      nu(e, t, h, s);
    }
    return;
  }
  if (Td(e)) {
    const h = (d = (c = a == null ? void 0 : a.getCellEditor()) == null ? void 0 : c.getValidationErrors) == null ? void 0 : d.call(c), u = r == null ? void 0 : r.getCellValidationModel();
    h != null && h.length ? u == null || u.setCellValidation(t, { errorMessages: h }) : u == null || u.clearCellValidation(t);
  }
  r == null || r.setEdit(t, { state: "changed" }), a == null || a.setEditDetails(), a == null || a.refreshEditStyles(!1, !1), n == null || n.refreshCell({ force: !0, suppressFlash: !0 });
  const l = r == null ? void 0 : r.getEdit(t);
  if (l && l.state === "changed") {
    const h = i ? ru(s, l) : {
      valueChanged: ys(l) && !(s != null && s.cancel),
      newValue: s != null && s.cancel || l.editorState.isCancelAfterEnd ? void 0 : (l == null ? void 0 : l.editorValue) ?? (o == null ? void 0 : o.pendingValue),
      oldValue: l == null ? void 0 : l.sourceValue
    };
    nu(e, t, h, s);
  }
}
function ru(e, t) {
  return e != null && e.cancel ? {
    valueChanged: !1,
    oldValue: t.sourceValue,
    newValue: void 0,
    value: t.sourceValue
  } : {
    valueChanged: !1,
    oldValue: t.sourceValue,
    newValue: t.pendingValue,
    value: t.sourceValue
  };
}
function nu(e, t, s, { silent: i, event: r } = {}) {
  const { editSvc: n, editModelSvc: o } = e, a = o == null ? void 0 : o.getEdit(t), { editorState: l } = a || {}, { isCancelBeforeStart: c } = l || {};
  !i && !c && (n == null || n.dispatchCellEvent(t, r, "cellEditingStopped", s), o == null || o.setEdit(t, { editorState: { cellStoppedEditing: !0 } }));
}
function Td(e) {
  var o;
  const { gos: t, colModel: s } = e, i = !!t.get("getFullRowEditValidationErrors"), r = (o = s.getColumnDefs()) == null ? void 0 : o.filter((a) => a.editable).some(({ cellEditorParams: a }) => {
    const { minLength: l, maxLength: c, getValidationErrors: d, min: h, max: u } = a || {};
    return l !== void 0 || c !== void 0 || d !== void 0 || h !== void 0 || u !== void 0;
  }), n = e.gridApi.getCellEditorInstances().some((a) => a.getValidationElement || a.getValidationErrors);
  return r || i || n;
}
function Ai(e, t) {
  var u, g, p, f, m, C, v, w;
  if (!(t || Td(e)))
    return;
  const s = tm(e), i = new Jf(), { ariaAnnounce: r, localeSvc: n, editModelSvc: o, gos: a } = e, l = a.get("editType") === "fullRow", d = _g(n)("ariaValidationErrorPrefix", "Cell Editor Validation");
  for (const b of s) {
    const { ctrl: y, editor: P } = b, { rowNode: E, column: M } = y, T = ((u = P.getValidationErrors) == null ? void 0 : u.call(P)) ?? [], G = ((g = P.getValidationElement) == null ? void 0 : g.call(P, !1)) || !((p = P.isPopup) != null && p.call(P)) && y.eGui;
    if (G) {
      const I = T != null && T.length > 0, L = I ? T.join(". ") : "";
      hw(G, I), I && r.announceValue(`${d} ${T}`, "editorValidation"), G instanceof HTMLInputElement ? G.setCustomValidity(L) : G.classList.toggle("invalid", I);
    }
    (T == null ? void 0 : T.length) > 0 && i.setCellValidation(
      {
        rowNode: E,
        column: M
      },
      {
        errorMessages: T
      }
    );
  }
  ui(e, { persist: !1 }), o == null || o.setCellValidationModel(i);
  const h = /* @__PURE__ */ new Set();
  for (const { ctrl: b } of s)
    h.add(b.rowCtrl);
  if (l) {
    const b = pT(e);
    o == null || o.setRowValidationModel(b);
  }
  for (const b of h.values()) {
    (f = b.rowEditStyleFeature) == null || f.applyRowStyles();
    for (const y of b.getAllCellCtrls())
      (m = y.tooltipFeature) == null || m.refreshTooltip(!0), (C = y.editorTooltipFeature) == null || C.refreshTooltip(!0), (w = (v = y.editStyleFeature) == null ? void 0 : v.applyCellStyles) == null || w.call(v);
  }
}
var pT = (e) => {
  var r;
  const t = new em(), s = e.gos.get("getFullRowEditValidationErrors"), i = (r = e.editModelSvc) == null ? void 0 : r.getEditMap();
  if (!i)
    return t;
  for (const n of i.keys()) {
    const o = i.get(n);
    if (!o)
      continue;
    const a = [], { rowIndex: l, rowPinned: c } = n;
    for (const h of o.keys()) {
      const u = o.get(h);
      if (!u)
        continue;
      const { editorValue: g, pendingValue: p, sourceValue: f } = u, m = g ?? (p === Dt ? void 0 : p) ?? f;
      a.push({
        column: h,
        colId: h.getColId(),
        rowIndex: l,
        rowPinned: c,
        oldValue: f,
        newValue: m
      });
    }
    const d = (s == null ? void 0 : s({ editorsState: a })) ?? [];
    d.length > 0 && t.setRowValidation(
      {
        rowNode: n
      },
      { errorMessages: d }
    );
  }
  return t;
};
function fT(e) {
  var i;
  Ai(e, !0);
  const t = (i = e.editModelSvc) == null ? void 0 : i.getCellValidationModel().getCellValidationMap();
  if (!t)
    return null;
  const s = [];
  return t.forEach((r, n) => {
    r.forEach(({ errorMessages: o }, a) => {
      s.push({
        column: a,
        rowIndex: n.rowIndex,
        rowPinned: n.rowPinned,
        messages: o ?? null
      });
    });
  }), s;
}
function mT(e, t, s, { rowNode: i, column: r }, n) {
  return V(e.gos, {
    type: s,
    node: i,
    data: i.data,
    value: n,
    column: r,
    colDef: r.getColDef(),
    rowPinned: i.rowPinned,
    event: t,
    rowIndex: i.rowIndex
  });
}
function CT(e, t = !1) {
  return e === S.DELETE ? !0 : !t && e === S.BACKSPACE ? Ip() : !1;
}
var vT = class extends R {
  constructor(e, t, s, i) {
    super(), this.cellCtrl = e, this.rowNode = s, this.rowCtrl = i, this.beans = t;
  }
  init() {
    this.eGui = this.cellCtrl.eGui;
  }
  onKeyDown(e) {
    const t = e.key;
    switch (t) {
      case S.ENTER:
        this.onEnterKeyDown(e);
        break;
      case S.F2:
        this.onF2KeyDown(e);
        break;
      case S.ESCAPE:
        this.onEscapeKeyDown(e);
        break;
      case S.TAB:
        this.onTabKeyDown(e);
        break;
      case S.BACKSPACE:
      case S.DELETE:
        this.onBackspaceOrDeleteKeyDown(t, e);
        break;
      case S.DOWN:
      case S.UP:
      case S.RIGHT:
      case S.LEFT:
        this.onNavigationKeyDown(e, t);
        break;
    }
  }
  onNavigationKeyDown(e, t) {
    var r, n;
    const { cellCtrl: s, beans: i } = this;
    if (!((r = i.editSvc) != null && r.isEditing(s, { withOpenEditor: !0 }))) {
      if (e.shiftKey && s.isRangeSelectionEnabled())
        this.onShiftRangeSelect(e);
      else {
        const o = s.getFocusedCellPosition();
        (n = i.navigation) == null || n.navigateToNextCell(e, t, o, !0);
      }
      e.preventDefault();
    }
  }
  onShiftRangeSelect(e) {
    const { rangeSvc: t, navigation: s } = this.beans;
    if (!t)
      return;
    const i = t.extendLatestRangeInDirection(e);
    i && (e.key === S.LEFT || e.key === S.RIGHT ? s == null || s.ensureColumnVisible(i.column) : s == null || s.ensureRowVisible(i.rowIndex));
  }
  onTabKeyDown(e) {
    var t;
    (t = this.beans.navigation) == null || t.onTabKeyDown(this.cellCtrl, e);
  }
  onBackspaceOrDeleteKeyDown(e, t) {
    var c;
    const { cellCtrl: s, beans: i, rowNode: r } = this, { gos: n, rangeSvc: o, eventSvc: a, editSvc: l } = i;
    if (a.dispatchEvent({ type: "keyShortcutChangedCellStart" }), CT(e, n.get("enableCellEditingOnBackspace")) && !(l != null && l.isEditing(s, { withOpenEditor: !0 }))) {
      if (o && et(n))
        o.clearCellRangeCellValues({ dispatchWrapperEvents: !0, wrapperEventSource: "deleteKey" });
      else if (s.isCellEditable()) {
        const { column: d } = s, h = this.beans.valueSvc.getDeleteValue(d, r);
        r.setDataValue(d, h, "cellClear");
      }
    } else l != null && l.isEditing(s, { withOpenEditor: !0 }) || (c = i.editSvc) == null || c.startEditing(s, { startedEdit: !0, event: t });
    a.dispatchEvent({ type: "keyShortcutChangedCellEnd" });
  }
  onEnterKeyDown(e) {
    var c;
    const { cellCtrl: t, beans: s } = this, { editSvc: i, navigation: r } = s, n = i == null ? void 0 : i.isEditing(t, { withOpenEditor: !0 }), o = t.rowNode, a = i == null ? void 0 : i.isRowEditing(o, { withOpenEditor: !0 }), l = (d) => {
      (i == null ? void 0 : i.startEditing(d, {
        startedEdit: !0,
        event: e,
        source: "edit"
      })) && e.preventDefault();
    };
    if (n || a) {
      if (this.isCtrlEnter(e)) {
        i == null || i.applyBulkEdit(t, ((c = s == null ? void 0 : s.rangeSvc) == null ? void 0 : c.getCellRanges()) || []);
        return;
      }
      if (Ai(s), (i == null ? void 0 : i.checkNavWithValidation(void 0, e)) === "block-stop")
        return;
      i != null && i.isEditing(t, { withOpenEditor: !0 }) ? i == null || i.stopEditing(t, {
        event: e,
        source: "edit"
      }) : a && !t.isCellEditable() ? i == null || i.stopEditing({ rowNode: o }, { event: e, source: "edit" }) : l(t);
    } else if (s.gos.get("enterNavigatesVertically")) {
      const d = e.shiftKey ? S.UP : S.DOWN;
      r == null || r.navigateToNextCell(null, d, t.cellPosition, !1);
    } else {
      if (i != null && i.hasValidationErrors())
        return;
      i != null && i.hasValidationErrors(t) && i.revertSingleCellEdit(t, !0), l(t);
    }
  }
  isCtrlEnter(e) {
    return (e.ctrlKey || e.metaKey) && e.key === S.ENTER;
  }
  onF2KeyDown(e) {
    const {
      cellCtrl: t,
      beans: { editSvc: s }
    } = this;
    s != null && s.isEditing() && (Ai(this.beans), (s == null ? void 0 : s.checkNavWithValidation(void 0, e)) === "block-stop") || s == null || s.startEditing(t, { startedEdit: !0, event: e });
  }
  onEscapeKeyDown(e) {
    const {
      cellCtrl: t,
      beans: { editSvc: s }
    } = this;
    (s == null ? void 0 : s.checkNavWithValidation(t, e)) === "block-stop" && s.revertSingleCellEdit(t), s == null || s.stopEditing(t, {
      event: e,
      cancel: !0
    });
  }
  processCharacter(e) {
    var o;
    const s = e.target !== this.eGui, {
      beans: { editSvc: i },
      cellCtrl: r
    } = this;
    if (s || i != null && i.isEditing(r, { withOpenEditor: !0 }))
      return;
    if (e.key === S.SPACE)
      this.onSpaceKeyDown(e);
    else if (i != null && i.isCellEditable(r, "ui")) {
      if (i != null && i.hasValidationErrors() && !(i != null && i.hasValidationErrors(r)))
        return;
      i == null || i.startEditing(r, { startedEdit: !0, event: e, source: "api" });
      const a = r.editCompDetails;
      !((o = a == null ? void 0 : a.params) != null && o.suppressPreventDefault) && e.preventDefault();
    }
  }
  onSpaceKeyDown(e) {
    var r;
    const { gos: t, editSvc: s } = this.beans, { rowNode: i } = this.cellCtrl;
    !(s != null && s.isEditing(this.cellCtrl, { withOpenEditor: !0 })) && wt(t) && ((r = this.beans.selectionSvc) == null || r.handleSelectionEvent(e, i, "spaceKey")), e.preventDefault();
  }
}, wT = class extends R {
  constructor(e, t, s) {
    super(), this.cellCtrl = e, this.column = s, this.beans = t;
  }
  onMouseEvent(e, t) {
    if (!St(t))
      switch (e) {
        case "click":
          this.onCellClicked(t);
          break;
        case "mousedown":
        case "touchstart":
          this.onMouseDown(t);
          break;
        case "dblclick":
          this.onCellDoubleClicked(t);
          break;
        case "mouseout":
          this.onMouseOut(t);
          break;
        case "mouseover":
          this.onMouseOver(t);
          break;
      }
  }
  onCellClicked(e) {
    var f;
    if ((f = this.beans.touchSvc) != null && f.handleCellDoubleClick(this, e))
      return;
    const { eventSvc: t, rangeSvc: s, editSvc: i, editModelSvc: r, frameworkOverrides: n, gos: o } = this.beans, a = e.ctrlKey || e.metaKey, { cellCtrl: l } = this, { column: c, cellPosition: d, rowNode: h } = l, u = ro(o, c, h, e);
    s && a && !u && s.getCellRangeCount(d) > 1 && s.intersectLastRange(!0);
    const g = l.createEvent(e, "cellClicked");
    g.isEventHandlingSuppressed = u, t.dispatchEvent(g);
    const p = c.getColDef();
    if (p.onCellClicked && window.setTimeout(() => {
      n.wrapOutgoing(() => {
        p.onCellClicked(g);
      });
    }, 0), !u && (r == null ? void 0 : r.getState(l)) !== "editing") {
      const m = i == null ? void 0 : i.isEditing(), C = (r == null ? void 0 : r.getCellValidationModel().getCellValidationMap().size) ?? 0, v = (r == null ? void 0 : r.getRowValidationModel().getRowValidationMap().size) ?? 0;
      if (m && (C > 0 || v > 0))
        return;
      i != null && i.shouldStartEditing(l, e) ? i == null || i.startEditing(l, { event: e }) : i != null && i.shouldStopEditing(l, e) && (this.beans.gos.get("editType") === "fullRow" ? i == null || i.stopEditing(l, {
        event: e,
        source: "edit"
      }) : i == null || i.stopEditing(void 0, {
        event: e,
        source: "edit"
      }));
    }
  }
  onCellDoubleClicked(e) {
    const { column: t, beans: s, cellCtrl: i } = this, { eventSvc: r, frameworkOverrides: n, editSvc: o, editModelSvc: a, gos: l } = s, c = ro(l, i.column, i.rowNode, e), d = t.getColDef(), h = i.createEvent(
      e,
      "cellDoubleClicked"
    );
    if (h.isEventHandlingSuppressed = c, r.dispatchEvent(h), typeof d.onCellDoubleClicked == "function" && window.setTimeout(() => {
      n.wrapOutgoing(() => {
        d.onCellDoubleClicked(h);
      });
    }, 0), !c && o != null && o.shouldStartEditing(i, e) && (a == null ? void 0 : a.getState(i)) !== "editing") {
      const u = o == null ? void 0 : o.isEditing(), g = (a == null ? void 0 : a.getCellValidationModel().getCellValidationMap().size) ?? 0, p = (a == null ? void 0 : a.getRowValidationModel().getRowValidationMap().size) ?? 0;
      if (u && (g > 0 || p > 0))
        return;
      o == null || o.startEditing(i, { event: e });
    }
  }
  onMouseDown(e) {
    const { ctrlKey: t, metaKey: s, shiftKey: i } = e, r = e.target, { cellCtrl: n, beans: o } = this, { eventSvc: a, rangeSvc: l, rowNumbersSvc: c, focusSvc: d, gos: h, editSvc: u } = o, { column: g, rowNode: p, cellPosition: f } = n, m = ro(h, g, p, e), C = () => {
      const y = n.createEvent(e, "cellMouseDown");
      y.isEventHandlingSuppressed = m, a.dispatchEvent(y);
    };
    if (m) {
      C();
      return;
    }
    if (this.isRightClickInExistingRange(e))
      return;
    const v = l && !l.isEmpty(), w = this.containsWidget(r), b = Ke(g);
    if (c && b && !c.handleMouseDownOnCell(f, e)) {
      l && e.preventDefault(), e.stopImmediatePropagation();
      return;
    }
    if (!i || !v) {
      const y = u == null ? void 0 : u.isEditing(n), E = h.get("enableCellTextSelection") && e.defaultPrevented, M = (As() || E) && !y && !Gc(r) && !w;
      n.focusCell(M, e);
    }
    if (i && v && !d.isCellFocused(f)) {
      e.preventDefault();
      const y = d.getFocusedCell();
      if (y) {
        const { column: P, rowIndex: E, rowPinned: M } = y;
        u != null && u.isEditing(y) && (u == null || u.stopEditing(y)), d.setFocusedCell({
          column: P,
          rowIndex: E,
          rowPinned: M,
          forceBrowserFocus: !0,
          preventScrollOnBrowserFocus: !0,
          sourceEvent: e
        });
      }
    }
    if (!w) {
      if (l) {
        b && e.preventDefault();
        const y = Wl(o, e) && b;
        if (i)
          l.extendLatestRangeToCell(f);
        else if (!y) {
          const P = t || s;
          l.setRangeToCell(f, P);
        }
      }
      C();
    }
  }
  isRightClickInExistingRange(e) {
    const { rangeSvc: t } = this.beans;
    if (t) {
      const s = t.isCellInAnyRange(this.cellCtrl.cellPosition), i = Wl(this.beans, e);
      if (s && i)
        return !0;
    }
    return !1;
  }
  containsWidget(e) {
    return mi(e, "ag-selection-checkbox", 3) || mi(e, "ag-drag-handle", 3);
  }
  onMouseOut(e) {
    if (this.mouseStayingInsideCell(e))
      return;
    const { eventSvc: t, colHover: s } = this.beans;
    t.dispatchEvent(this.cellCtrl.createEvent(e, "cellMouseOut")), s == null || s.clearMouseOver();
  }
  onMouseOver(e) {
    if (this.mouseStayingInsideCell(e))
      return;
    const { eventSvc: t, colHover: s } = this.beans;
    t.dispatchEvent(this.cellCtrl.createEvent(e, "cellMouseOver")), s == null || s.setMouseOver([this.column]);
  }
  mouseStayingInsideCell(e) {
    if (!e.target || !e.relatedTarget)
      return !1;
    const t = this.cellCtrl.eGui, s = t.contains(e.target), i = t.contains(e.relatedTarget);
    return s && i;
  }
}, bT = class extends R {
  constructor(e, t) {
    super(), this.cellCtrl = e, this.beans = t, this.column = e.column, this.rowNode = e.rowNode;
  }
  setupRowSpan() {
    this.rowSpan = this.column.getRowSpan(this.rowNode), this.addManagedListeners(this.beans.eventSvc, { newColumnsLoaded: () => this.onNewColumnsLoaded() });
  }
  init() {
    this.eSetLeft = this.cellCtrl.getRootElement(), this.eContent = this.cellCtrl.eGui;
    const e = this.cellCtrl.getCellSpan();
    if (e || (this.setupColSpan(), this.setupRowSpan()), this.onLeftChanged(), this.onWidthChanged(), e || this._legacyApplyRowSpan(), e) {
      const t = this.refreshSpanHeight.bind(this, e);
      t(), this.addManagedListeners(this.beans.eventSvc, {
        paginationChanged: t,
        recalculateRowBounds: t,
        pinnedHeightChanged: t
      });
    }
  }
  refreshSpanHeight(e) {
    const t = e.getCellHeight();
    t != null && (this.eContent.style.height = `${t}px`);
  }
  onNewColumnsLoaded() {
    const e = this.column.getRowSpan(this.rowNode);
    this.rowSpan !== e && (this.rowSpan = e, this._legacyApplyRowSpan(!0));
  }
  onDisplayColumnsChanged() {
    const e = this.getColSpanningList();
    Xe(this.colsSpanning, e) || (this.colsSpanning = e, this.onWidthChanged(), this.onLeftChanged());
  }
  setupColSpan() {
    this.column.getColDef().colSpan != null && (this.colsSpanning = this.getColSpanningList(), this.addManagedListeners(this.beans.eventSvc, {
      // because we are col spanning, a reorder of the cols can change what cols we are spanning over
      displayedColumnsChanged: this.onDisplayColumnsChanged.bind(this),
      // because we are spanning over multiple cols, we check for width any time any cols width changes.
      // this is expensive - really we should be explicitly checking only the cols we are spanning over
      // instead of every col, however it would be tricky code to track the cols we are spanning over, so
      // because hardly anyone will be using colSpan, am favouring this easier way for more maintainable code.
      displayedColumnsWidthChanged: this.onWidthChanged.bind(this)
    }));
  }
  onWidthChanged() {
    if (!this.eContent)
      return;
    const e = this.getCellWidth();
    this.eContent.style.width = `${e}px`;
  }
  getCellWidth() {
    return this.colsSpanning ? this.colsSpanning.reduce((e, t) => e + t.getActualWidth(), 0) : this.column.getActualWidth();
  }
  getColSpanningList() {
    const { column: e, rowNode: t } = this, s = e.getColSpan(t), i = [];
    if (s === 1)
      i.push(e);
    else {
      let r = e;
      const n = e.getPinned();
      for (let o = 0; r && o < s && (i.push(r), r = this.beans.visibleCols.getColAfter(r), !(!r || ee(r) || n !== r.getPinned())); o++)
        ;
    }
    return i;
  }
  onLeftChanged() {
    if (!this.eSetLeft)
      return;
    const e = this.modifyLeftForPrintLayout(this.getCellLeft());
    this.eSetLeft.style.left = e + "px";
  }
  getCellLeft() {
    let e;
    return this.beans.gos.get("enableRtl") && this.colsSpanning ? e = _(this.colsSpanning) : e = this.column, e.getLeft();
  }
  modifyLeftForPrintLayout(e) {
    if (!this.cellCtrl.printLayout || this.column.getPinned() === "left")
      return e;
    const { visibleCols: t } = this.beans, s = t.getColsLeftWidth();
    if (this.column.getPinned() === "right") {
      const i = t.bodyWidth;
      return s + i + (e || 0);
    }
    return s + (e || 0);
  }
  _legacyApplyRowSpan(e) {
    if (this.rowSpan === 1 && !e)
      return;
    const s = pt(this.beans) * this.rowSpan;
    this.eContent.style.height = `${s}px`, this.eContent.style.zIndex = "1";
  }
  // overriding to make public, as we don't dispose this bean via context
  destroy() {
    super.destroy();
  }
}, yT = "ag-cell", ST = "ag-cell-auto-height", xT = "ag-cell-normal-height", FT = "ag-cell-focus", RT = "ag-cell-first-right-pinned", PT = "ag-cell-last-left-pinned", ET = "ag-cell-not-inline-editing", TT = "ag-cell-wrap-text", MT = 0, ar = class extends R {
  constructor(e, t, s, i) {
    super(), this.column = e, this.rowNode = t, this.rowCtrl = i, this.rangeFeature = void 0, this.rowResizeFeature = void 0, this.positionFeature = void 0, this.customStyleFeature = void 0, this.editStyleFeature = void 0, this.mouseListener = void 0, this.keyboardListener = void 0, this.suppressRefreshCell = !1, this.onCompAttachedFuncs = [], this.onEditorAttachedFuncs = [], this.focusEventWhileNotReady = null, this.hasBeenFocused = !1, this.hasEdit = !1, this.tooltipFeature = void 0, this.editorTooltipFeature = void 0, this.beans = s, this.gos = s.gos, this.editSvc = s.editSvc, this.hasEdit = !!s.editSvc;
    const { colId: r } = e;
    this.instanceId = r + "-" + MT++, this.createCellPosition(), this.updateAndFormatValue(!1);
  }
  addFeatures() {
    var i, r;
    const { beans: e } = this;
    this.positionFeature = new bT(this, e), this.customStyleFeature = (i = e.cellStyles) == null ? void 0 : i.createCellCustomStyleFeature(this, e), this.editStyleFeature = (r = e.editSvc) == null ? void 0 : r.createCellStyleFeature(this, e), this.mouseListener = new wT(this, e, this.column), this.keyboardListener = new vT(this, e, this.rowNode, this.rowCtrl), this.enableTooltipFeature();
    const { rangeSvc: t } = e;
    t && et(e.gos) && (this.rangeFeature = t.createCellRangeFeature(e, this)), Ke(this.column) && (this.rowResizeFeature = this.beans.rowNumbersSvc.createRowNumbersRowResizerFeature(e, this));
  }
  isCellSpanning() {
    return !1;
  }
  getCellSpan() {
  }
  removeFeatures() {
    const e = this.beans.context;
    this.positionFeature = e.destroyBean(this.positionFeature), this.editorTooltipFeature = e.destroyBean(this.editorTooltipFeature), this.customStyleFeature = e.destroyBean(this.customStyleFeature), this.editStyleFeature = e.destroyBean(this.editStyleFeature), this.mouseListener = e.destroyBean(this.mouseListener), this.keyboardListener = e.destroyBean(this.keyboardListener), this.rangeFeature = e.destroyBean(this.rangeFeature), this.rowResizeFeature = e.destroyBean(this.rowResizeFeature), this.disableTooltipFeature();
  }
  enableTooltipFeature(e, t) {
    var s;
    this.tooltipFeature = (s = this.beans.tooltipSvc) == null ? void 0 : s.enableCellTooltipFeature(this, e, t);
  }
  disableTooltipFeature() {
    this.tooltipFeature = this.beans.context.destroyBean(this.tooltipFeature);
  }
  enableEditorTooltipFeature(e) {
    var t;
    this.editorTooltipFeature && this.disableEditorTooltipFeature(), this.editorTooltipFeature = (t = this.beans.tooltipSvc) == null ? void 0 : t.setupCellEditorTooltip(this, e), Ai(this.beans);
  }
  disableEditorTooltipFeature() {
    this.editorTooltipFeature = this.beans.context.destroyBean(this.editorTooltipFeature);
  }
  setComp(e, t, s, i, r, n, o) {
    var a, l, c, d, h, u, g, p, f;
    this.comp = e, this.eGui = t, this.printLayout = r, o ?? (o = this), this.addDomData(o), this.addFeatures(), o.addDestroyFunc(() => this.removeFeatures()), this.onSuppressCellFocusChanged(this.beans.gos.get("suppressCellFocus")), this.setupFocus(), this.applyStaticCssClasses(), this.setWrapText(), this.onFirstRightPinnedChanged(), this.onLastLeftPinnedChanged(), this.onColumnHover(), this.setupControlComps(), this.setupAutoHeight(i, o), this.refreshFirstAndLastStyles(), this.refreshAriaColIndex(), (a = this.positionFeature) == null || a.init(), (l = this.customStyleFeature) == null || l.setComp(e), (c = this.editStyleFeature) == null || c.setComp(e), (d = this.tooltipFeature) == null || d.refreshTooltip(), (h = this.keyboardListener) == null || h.init(), (u = this.rangeFeature) == null || u.setComp(e), (g = this.rowResizeFeature) == null || g.refreshRowResizer(), n && this.isCellEditable() || this.hasEdit && ((p = this.editSvc) != null && p.isEditing(this, { withOpenEditor: !0 })) ? (f = this.editSvc) == null || f.startEditing(this, {
      startedEdit: !1,
      source: "api",
      silent: !0,
      continueEditing: !0
    }) : this.showValue(!1, !0), this.onCompAttachedFuncs.length && (this.onCompAttachedFuncs.forEach((m) => m()), this.onCompAttachedFuncs = []);
  }
  setupAutoHeight(e, t) {
    var s;
    this.isAutoHeight = ((s = this.beans.rowAutoHeight) == null ? void 0 : s.setupCellAutoHeight(this, e, t)) ?? !1;
  }
  getCellAriaRole() {
    return this.column.getColDef().cellAriaRole ?? "gridcell";
  }
  isCellRenderer() {
    const e = this.column.getColDef();
    return e.cellRenderer != null || e.cellRendererSelector != null;
  }
  getValueToDisplay() {
    return this.valueFormatted ?? this.value;
  }
  getDeferLoadingCellRenderer() {
    var l, c;
    const { beans: e, column: t } = this, { userCompFactory: s, ctrlsSvc: i, eventSvc: r } = e, n = t.getColDef(), o = this.createCellRendererParams();
    o.deferRender = !0;
    const a = yh(s, n, o);
    if ((c = (l = i.getGridBodyCtrl()) == null ? void 0 : l.scrollFeature) != null && c.isScrolling()) {
      let d;
      const h = new U((u) => {
        d = u;
      });
      return this.addManagedListeners(r, {
        bodyScrollEnd: () => d()
      }), { loadingComp: a, onReady: h };
    }
    return { loadingComp: a, onReady: U.resolve() };
  }
  showValue(e, t) {
    var h, u, g, p;
    const { beans: s, column: i, rowNode: r, rangeFeature: n } = this, { userCompFactory: o } = s;
    let a = this.getValueToDisplay(), l;
    const c = r.stub && ((h = r.groupData) == null ? void 0 : h[i.getId()]) == null, d = i.getColDef();
    if (c || this.isCellRenderer()) {
      const f = this.createCellRendererParams();
      !c || Ke(i) ? l = fr(o, d, f) : l = yh(o, d, f);
    }
    if (!l && !c && ((u = s.findSvc) != null && u.isMatch(r, i))) {
      const f = this.createCellRendererParams();
      l = fr(
        o,
        { ...i.getColDef(), cellRenderer: "agFindCellRenderer" },
        f
      );
    }
    if (this.hasEdit && this.editSvc.isBatchEditing() && this.editSvc.isRowEditing(r, { checkSiblings: !0 })) {
      const f = this.editSvc.prepDetailsDuringBatch(this, { compDetails: l, valueToDisplay: a });
      f && (f.compDetails ? l = f.compDetails : f.valueToDisplay && (a = f.valueToDisplay));
    }
    this.comp.setRenderDetails(l, a, e), (g = this.customRowDragComp) == null || g.refreshVisibility(), !t && n && xt(s, () => n == null ? void 0 : n.refreshHandle()), (p = this.rowResizeFeature) == null || p.refreshRowResizer();
  }
  setupControlComps() {
    const e = this.column.getColDef();
    this.includeSelection = this.isIncludeControl(this.isCheckboxSelection(e), !0), this.includeRowDrag = this.isIncludeControl(e.rowDrag), this.includeDndSource = this.isIncludeControl(e.dndSource), this.comp.setIncludeSelection(this.includeSelection), this.comp.setIncludeDndSource(this.includeDndSource), this.comp.setIncludeRowDrag(this.includeRowDrag);
  }
  isForceWrapper() {
    return this.beans.gos.get("enableCellTextSelection") || this.column.isAutoHeight();
  }
  /**
   * Wrapper providing general conditions under which control elements (e.g. checkboxes and drag handles)
   * are rendered for a particular cell.
   * @param value Whether to render the control in the specific context of the caller
   * @param allowManuallyPinned Whether manually pinned rows are permitted this form of control element
   */
  // eslint-disable-next-line @typescript-eslint/ban-types
  isIncludeControl(e, t = !1) {
    return (this.rowNode.rowPinned == null || t && Fn(this.rowNode)) && !!e;
  }
  isCheckboxSelection(e) {
    const { rowSelection: t, groupDisplayType: s } = this.beans.gridOptions, i = rn(t), r = Ds(this.column);
    return s === "custom" && i !== "selectionColumn" && r ? !1 : e.checkboxSelection || r && typeof t == "object" && vi(t);
  }
  refreshShouldDestroy() {
    const e = this.column.getColDef(), t = this.includeSelection != this.isIncludeControl(this.isCheckboxSelection(e), !0), s = this.includeRowDrag != this.isIncludeControl(e.rowDrag), i = this.includeDndSource != this.isIncludeControl(e.dndSource), r = this.isAutoHeight != this.column.isAutoHeight();
    return t || s || i || r;
  }
  onPopupEditorClosed() {
    const { editSvc: e } = this.beans;
    e != null && e.isEditing(this, { withOpenEditor: !0 }) && (e == null || e.stopEditing(this, { source: e != null && e.isBatchEditing() ? "ui" : "api" }));
  }
  /**
   * Ends the Cell Editing
   * @param cancel `True` if the edit process is being canceled.
   * @returns `True` if the value of the `GridCell` has been updated, otherwise `False`.
   */
  stopEditing(e = !1) {
    const { editSvc: t } = this.beans;
    return (t == null ? void 0 : t.stopEditing(this, { cancel: e, source: t != null && t.isBatchEditing() ? "ui" : "api" })) ?? !1;
  }
  createCellRendererParams() {
    const {
      value: e,
      valueFormatted: t,
      column: s,
      rowNode: i,
      comp: r,
      eGui: n,
      beans: { valueSvc: o, gos: a, editSvc: l }
    } = this;
    return V(a, {
      value: e,
      valueFormatted: t,
      getValue: () => o.getValueForDisplay(s, i).value,
      setValue: (d) => (l == null ? void 0 : l.setDataValue({ rowNode: i, column: s }, d)) || i.setDataValue(s, d),
      formatValue: this.formatValue.bind(this),
      data: i.data,
      node: i,
      pinned: s.getPinned(),
      colDef: s.getColDef(),
      column: s,
      refreshCell: this.refreshCell.bind(this),
      eGridCell: n,
      eParentOfValue: r.getParentOfValue(),
      registerRowDragger: (d, h, u, g) => this.registerRowDragger(d, h, g),
      setTooltip: (d, h) => {
        var u;
        a.assertModuleRegistered("Tooltip", 3), this.tooltipFeature && this.disableTooltipFeature(), this.enableTooltipFeature(d, h), (u = this.tooltipFeature) == null || u.refreshTooltip();
      }
    });
  }
  onCellChanged(e) {
    e.column === this.column && this.refreshCell({});
  }
  refreshOrDestroyCell(e) {
    var t;
    if (this.refreshShouldDestroy() ? (t = this.rowCtrl) == null || t.recreateCell(this) : this.refreshCell(e), this.hasEdit && this.editCompDetails) {
      const { editSvc: s, comp: i } = this;
      !(i != null && i.getCellEditor()) && s.isEditing(this, { withOpenEditor: !0 }) && s.startEditing(this, { startedEdit: !1, source: "api", silent: !0 });
    }
  }
  // + stop editing {force: true, suppressFlash: true}
  // + event cellChanged {}
  // + cellRenderer.params.refresh() {} -> method passes 'as is' to the cellRenderer, so params could be anything
  // + rowCtrl: event dataChanged {suppressFlash: !update, newData: !update}
  // + rowCtrl: api refreshCells() {animate: true/false}
  // + rowRenderer: api softRefreshView() {}
  refreshCell({ force: e, suppressFlash: t, newData: s } = {}) {
    var c, d, h, u, g, p, f, m;
    if (this.suppressRefreshCell)
      return;
    const i = this.column.getColDef(), r = i.field == null && i.valueGetter == null && i.showRowGroup == null, n = e || r || s, o = !!this.comp, a = this.updateAndFormatValue(o), l = n || a;
    if (o) {
      if (l) {
        this.showValue(!!s, !1);
        const C = (c = this.beans.filterManager) == null ? void 0 : c.isSuppressFlashingCellsBecauseFiltering();
        !t && !C && i.enableCellChangeFlash && ((d = this.beans.cellFlashSvc) == null || d.flashCell(this)), (u = (h = this.editStyleFeature) == null ? void 0 : h.applyCellStyles) == null || u.call(h), (g = this.customStyleFeature) == null || g.applyUserStyles(), (p = this.customStyleFeature) == null || p.applyClassesFromColDef();
      }
      (f = this.tooltipFeature) == null || f.refreshTooltip(), (m = this.customStyleFeature) == null || m.applyCellClassRules();
    }
  }
  isCellEditable() {
    return this.column.isCellEditable(this.rowNode);
  }
  formatValue(e) {
    return this.callValueFormatter(e) ?? e;
  }
  callValueFormatter(e) {
    return this.beans.valueSvc.formatValue(this.column, this.rowNode, e);
  }
  updateAndFormatValue(e) {
    const t = this.value, s = this.valueFormatted, { value: i, valueFormatted: r } = this.beans.valueSvc.getValueForDisplay(this.column, this.rowNode, !0);
    return this.value = i, this.valueFormatted = r, e ? !this.valuesAreEqual(t, this.value) || this.valueFormatted != s : !0;
  }
  valuesAreEqual(e, t) {
    const s = this.column.getColDef();
    return s.equals ? s.equals(e, t) : e === t;
  }
  addDomData(e) {
    const t = this.eGui;
    Pi(this.beans.gos, t, Go, this), e.addDestroyFunc(() => Pi(this.beans.gos, t, Go, null));
  }
  createEvent(e, t) {
    const { rowNode: s, column: i, value: r, beans: n } = this;
    return mT(n, e, t, { rowNode: s, column: i }, r);
  }
  processCharacter(e) {
    var t;
    (t = this.keyboardListener) == null || t.processCharacter(e);
  }
  onKeyDown(e) {
    var t;
    (t = this.keyboardListener) == null || t.onKeyDown(e);
  }
  onMouseEvent(e, t) {
    var s;
    (s = this.mouseListener) == null || s.onMouseEvent(e, t);
  }
  getColSpanningList() {
    var e;
    return ((e = this.positionFeature) == null ? void 0 : e.getColSpanningList()) ?? [];
  }
  onLeftChanged() {
    var e;
    this.comp && ((e = this.positionFeature) == null || e.onLeftChanged());
  }
  onDisplayedColumnsChanged() {
    this.eGui && (this.refreshAriaColIndex(), this.refreshFirstAndLastStyles());
  }
  refreshFirstAndLastStyles() {
    const { comp: e, column: t, beans: s } = this;
    Cf(e, t, s.visibleCols);
  }
  refreshAriaColIndex() {
    const e = this.beans.visibleCols.getAriaColIndex(this.column);
    Lc(this.eGui, e);
  }
  onWidthChanged() {
    var e;
    return (e = this.positionFeature) == null ? void 0 : e.onWidthChanged();
  }
  getRowPosition() {
    const { rowIndex: e, rowPinned: t } = this.cellPosition;
    return {
      rowIndex: e,
      rowPinned: t
    };
  }
  updateRangeBordersIfRangeCount() {
    var e;
    this.comp && ((e = this.rangeFeature) == null || e.updateRangeBordersIfRangeCount());
  }
  onCellSelectionChanged() {
    var e;
    this.comp && ((e = this.rangeFeature) == null || e.onCellSelectionChanged());
  }
  isRangeSelectionEnabled() {
    return this.rangeFeature != null;
  }
  focusCell(e = !1, t) {
    var i;
    const s = (i = this.editSvc) == null ? void 0 : i.allowedFocusTargetOnValidation(this);
    s && s !== this || this.beans.focusSvc.setFocusedCell({
      ...this.getFocusedCellPosition(),
      forceBrowserFocus: e,
      sourceEvent: t
    });
  }
  /**
   * Restores focus to the cell, if it should have it
   * @param waitForRender if the cell has just setComp, it may not be rendered yet, so we wait for the next render
   */
  restoreFocus(e = !1) {
    const {
      beans: { editSvc: t, focusSvc: s },
      comp: i
    } = this;
    if (!i || t != null && t.isEditing(this) || !this.isCellFocused() || !s.shouldTakeFocus())
      return;
    const r = () => {
      if (!this.isAlive())
        return;
      const n = i.getFocusableElement();
      this.isCellFocused() && n.focus({ preventScroll: !0 });
    };
    if (e) {
      setTimeout(r, 0);
      return;
    }
    r();
  }
  onRowIndexChanged() {
    var e, t;
    this.createCellPosition(), this.onCellFocused(), this.restoreFocus(), (e = this.rangeFeature) == null || e.onCellSelectionChanged(), (t = this.rowResizeFeature) == null || t.refreshRowResizer();
  }
  onSuppressCellFocusChanged(e) {
    const t = this.eGui;
    t && (Ke(this.column) && (e = !0), vt(t, "tabindex", e ? void 0 : -1));
  }
  onFirstRightPinnedChanged() {
    if (!this.comp)
      return;
    const e = this.column.isFirstRightPinned();
    this.comp.toggleCss(RT, e);
  }
  onLastLeftPinnedChanged() {
    if (!this.comp)
      return;
    const e = this.column.isLastLeftPinned();
    this.comp.toggleCss(PT, e);
  }
  /**
   * Returns whether cell is focused by the focusSvc, overridden by spannedCellCtrl
   */
  checkCellFocused() {
    return this.beans.focusSvc.isCellFocused(this.cellPosition);
  }
  isCellFocused() {
    const e = this.checkCellFocused();
    return this.hasBeenFocused || (this.hasBeenFocused = e), e;
  }
  setupFocus() {
    this.restoreFocus(!0), this.onCellFocused(this.focusEventWhileNotReady ?? void 0);
  }
  onCellFocused(e) {
    var r;
    const { beans: t } = this;
    if (ya(t))
      return;
    if (!this.comp) {
      e && (this.focusEventWhileNotReady = e);
      return;
    }
    const s = this.isCellFocused(), i = ((r = t.editSvc) == null ? void 0 : r.isEditing(this)) ?? !1;
    if (this.comp.toggleCss(FT, s), s && e && e.forceBrowserFocus) {
      let n = this.comp.getFocusableElement();
      if (i) {
        const o = Vt(n, null, !0);
        o.length && (n = o[0]);
      }
      n.focus({ preventScroll: !!e.preventScrollOnBrowserFocus });
    }
    s && this.rowCtrl.announceDescription();
  }
  createCellPosition() {
    const { rowIndex: e, rowPinned: t } = this.rowNode;
    this.cellPosition = {
      rowIndex: e,
      rowPinned: Ce(t),
      column: this.column
    };
  }
  // CSS Classes that only get applied once, they never change
  applyStaticCssClasses() {
    const { comp: e } = this;
    e.toggleCss(yT, !0), e.toggleCss(ET, !0);
    const t = this.column.isAutoHeight() == !0;
    e.toggleCss(ST, t), e.toggleCss(xT, !t);
  }
  onColumnHover() {
    var e;
    (e = this.beans.colHover) == null || e.onCellColumnHover(this.column, this.comp);
  }
  onColDefChanged() {
    var e, t;
    this.comp && (this.column.isTooltipEnabled() ? (this.disableTooltipFeature(), this.enableTooltipFeature()) : this.disableTooltipFeature(), this.setWrapText(), (e = this.editSvc) != null && e.isEditing(this) ? (t = this.editSvc) == null || t.handleColDefChanged(this) : this.refreshOrDestroyCell({ force: !0, suppressFlash: !0 }));
  }
  setWrapText() {
    const e = this.column.getColDef().wrapText == !0;
    this.comp.toggleCss(TT, e);
  }
  dispatchCellContextMenuEvent(e) {
    const t = this.column.getColDef(), s = this.createEvent(e, "cellContextMenu"), { beans: i } = this;
    i.eventSvc.dispatchEvent(s), t.onCellContextMenu && window.setTimeout(() => {
      i.frameworkOverrides.wrapOutgoing(() => {
        t.onCellContextMenu(s);
      });
    }, 0);
  }
  getCellRenderer() {
    var e;
    return ((e = this.comp) == null ? void 0 : e.getCellRenderer()) ?? null;
  }
  destroy() {
    this.onCompAttachedFuncs = [], this.onEditorAttachedFuncs = [], this.isCellFocused() && this.hasBrowserFocus() && this.beans.focusSvc.attemptToRecoverFocus(), super.destroy();
  }
  hasBrowserFocus() {
    var e;
    return ((e = this.eGui) == null ? void 0 : e.contains(Q(this.beans))) ?? !1;
  }
  createSelectionCheckbox() {
    var t;
    const e = (t = this.beans.selectionSvc) == null ? void 0 : t.createCheckboxSelectionComponent();
    if (e)
      return this.beans.context.createBean(e), e.init({ rowNode: this.rowNode, column: this.column }), e;
  }
  createDndSource() {
    const e = this.beans.registry.createDynamicBean(
      "dndSourceComp",
      !1,
      this.rowNode,
      this.column,
      this.eGui
    );
    return e && this.beans.context.createBean(e), e;
  }
  registerRowDragger(e, t, s) {
    if (this.customRowDragComp) {
      this.customRowDragComp.setDragElement(e, t);
      return;
    }
    const i = this.createRowDragComp(e, t, s);
    i && (this.customRowDragComp = i, this.addDestroyFunc(() => {
      this.beans.context.destroyBean(i), this.customRowDragComp = null;
    }), i.refreshVisibility());
  }
  createRowDragComp(e, t, s) {
    var r;
    const i = (r = this.beans.rowDragSvc) == null ? void 0 : r.createRowDragCompForCell(
      this.rowNode,
      this.column,
      () => this.value,
      e,
      t,
      s
    );
    if (i)
      return this.beans.context.createBean(i), i;
  }
  cellEditorAttached() {
    this.onEditorAttachedFuncs.forEach((e) => e()), this.onEditorAttachedFuncs = [];
  }
  setFocusedCellPosition(e) {
  }
  getFocusedCellPosition() {
    return this.cellPosition;
  }
  // used by spannedCellCtrl
  refreshAriaRowIndex() {
  }
  /**
   * Returns the root element of the cell, could be a span container rather than the cell element.
   * @returns The root element of the cell.
   */
  getRootElement() {
    return this.eGui;
  }
};
function Md(e, t, s, i, r, n) {
  if (s == null && t == null)
    return;
  const o = {}, a = {}, l = (c, d) => {
    c.split(" ").forEach((h) => {
      h.trim() != "" && d(h);
    });
  };
  if (s) {
    const c = Object.keys(s);
    for (let d = 0; d < c.length; d++) {
      const h = c[d], u = s[h];
      let g;
      typeof u == "string" ? g = e ? e.evaluate(u, i) : !0 : typeof u == "function" && (g = u(i)), l(h, (p) => {
        g ? o[p] = !0 : a[p] = !0;
      });
    }
  }
  t && n && Object.keys(t).forEach(
    (c) => l(c, (d) => {
      o[d] || (a[d] = !0);
    })
  ), n && Object.keys(a).forEach(n), Object.keys(o).forEach(r);
}
function ou(e) {
  if (e.group)
    return e.level;
  const t = e.parent;
  return t ? t.level + 1 : 0;
}
var DT = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rowStyleSvc";
  }
  processClassesFromGridOptions(e, t) {
    const s = this.gos, i = (o) => {
      typeof o == "string" ? e.push(o) : Array.isArray(o) && o.forEach((a) => e.push(a));
    }, r = s.get("rowClass");
    r && i(r);
    const n = s.getCallback("getRowClass");
    if (n) {
      const o = {
        data: t.data,
        node: t,
        rowIndex: t.rowIndex
      }, a = n(o);
      i(a);
    }
  }
  preProcessRowClassRules(e, t) {
    this.processRowClassRules(
      t,
      (s) => {
        e.push(s);
      },
      () => {
      }
    );
  }
  processRowClassRules(e, t, s) {
    const { gos: i, expressionSvc: r } = this.beans, n = V(i, {
      data: e.data,
      node: e,
      rowIndex: e.rowIndex
    });
    Md(
      r,
      void 0,
      i.get("rowClassRules"),
      n,
      t,
      s
    );
  }
  processStylesFromGridOptions(e) {
    const t = this.gos, s = t.get("rowStyle"), i = t.getCallback("getRowStyle");
    let r;
    if (i) {
      const n = {
        data: e.data,
        node: e,
        rowIndex: e.rowIndex
      };
      r = i(n);
    }
    if (r || s)
      return Object.assign({}, s, r);
  }
}, AT = 0, zo = class extends R {
  constructor(e, t, s, i, r) {
    var n, o;
    super(), this.rowNode = e, this.useAnimationFrameForCreate = i, this.printLayout = r, this.allRowGuis = [], this.active = !0, this.centerCellCtrls = { list: [], map: {} }, this.leftCellCtrls = { list: [], map: {} }, this.rightCellCtrls = { list: [], map: {} }, this.slideInAnimation = {
      left: !1,
      center: !1,
      right: !1,
      fullWidth: !1
    }, this.fadeInAnimation = {
      left: !1,
      center: !1,
      right: !1,
      fullWidth: !1
    }, this.rowDragComps = [], this.lastMouseDownOnDragger = !1, this.emptyStyle = {}, this.updateColumnListsPending = !1, this.rowId = null, this.businessKey = null, this.beans = t, this.gos = t.gos, this.paginationPage = ((n = t.pagination) == null ? void 0 : n.getCurrentPage()) ?? 0, this.suppressRowTransform = this.gos.get("suppressRowTransform"), this.instanceId = e.id + "-" + AT++, this.rowId = bt(e.id), this.initRowBusinessKey(), this.rowFocused = t.focusSvc.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned), this.rowLevel = ou(this.rowNode), this.setRowType(), this.setAnimateFlags(s), this.rowStyles = this.processStylesFromGridOptions(), this.rowEditStyleFeature = (o = t.editSvc) == null ? void 0 : o.createRowStyleFeature(this, t), this.addListeners();
  }
  initRowBusinessKey() {
    this.businessKeyForNodeFunc = this.gos.get("getBusinessKeyForNode"), this.updateRowBusinessKey();
  }
  updateRowBusinessKey() {
    if (typeof this.businessKeyForNodeFunc != "function")
      return;
    const e = this.businessKeyForNodeFunc(this.rowNode);
    this.businessKey = bt(e);
  }
  updateGui(e, t) {
    e === "left" ? this.leftGui = t : e === "right" ? this.rightGui = t : e === "fullWidth" ? this.fullWidthGui = t : this.centerGui = t;
  }
  setComp(e, t, s, i) {
    var h, u;
    const { context: r, focusSvc: n } = this.beans;
    i = Cn(this, r, i);
    const o = { rowComp: e, element: t, containerType: s, compBean: i };
    this.allRowGuis.push(o), this.updateGui(s, o), this.initialiseRowComp(o);
    const a = this.rowNode, l = this.rowType === "FullWidthLoading" || a.stub, c = !a.data && this.beans.rowModel.getType() === "infinite";
    !l && !c && !a.rowPinned && this.beans.rowRenderer.dispatchFirstDataRenderedEvent();
    const d = (h = this.fullWidthGui) == null ? void 0 : h.element;
    d && !((u = this.beans.editSvc) != null && u.isEditing(this)) && n.isRowFocused(a.rowIndex, a.rowPinned) && n.shouldTakeFocus() && setTimeout(() => d.focus({ preventScroll: !0 }), 0);
  }
  unsetComp(e) {
    this.allRowGuis = this.allRowGuis.filter((t) => t.containerType !== e), this.updateGui(e, void 0);
  }
  isCacheable() {
    return this.rowType === "FullWidthDetail" && this.gos.get("keepDetailRows");
  }
  setCached(e) {
    const t = e ? "none" : "";
    this.allRowGuis.forEach((s) => s.element.style.display = t);
  }
  initialiseRowComp(e) {
    const t = this.gos;
    this.onSuppressCellFocusChanged(this.beans.gos.get("suppressCellFocus")), this.listenOnDomOrder(e), this.onRowHeightChanged(e), this.updateRowIndexes(e), this.setFocusedClasses(e), this.setStylesFromGridOptions(!1, e), wt(t) && this.rowNode.selectable && this.onRowSelected(e), this.updateColumnLists(!this.useAnimationFrameForCreate);
    const s = e.rowComp;
    this.getInitialRowClasses(e.containerType).forEach((r) => s.toggleCss(r, !0)), this.executeSlideAndFadeAnimations(e), this.rowNode.group && qe(e.element, this.rowNode.expanded == !0), this.setRowCompRowId(s), this.setRowCompRowBusinessKey(s), Pi(t, e.element, Oo, this), e.compBean.addDestroyFunc(() => Pi(t, e.element, Oo, null)), this.useAnimationFrameForCreate ? this.beans.animationFrameSvc.createTask(
      this.addHoverFunctionality.bind(this, e),
      this.rowNode.rowIndex,
      "p2",
      !1
    ) : this.addHoverFunctionality(e), this.isFullWidth() && this.setupFullWidth(e), t.get("rowDragEntireRow") && this.addRowDraggerToRow(e), this.useAnimationFrameForCreate && this.beans.animationFrameSvc.addDestroyTask(() => {
      this.isAlive() && e.rowComp.toggleCss("ag-after-created", !0);
    }), this.executeProcessRowPostCreateFunc();
  }
  setRowCompRowBusinessKey(e) {
    this.businessKey != null && e.setRowBusinessKey(this.businessKey);
  }
  setRowCompRowId(e) {
    const t = bt(this.rowNode.id);
    this.rowId = t, t != null && e.setRowId(t);
  }
  executeSlideAndFadeAnimations(e) {
    const { containerType: t } = e;
    this.slideInAnimation[t] && (Fo(() => {
      this.onTopChanged();
    }), this.slideInAnimation[t] = !1), this.fadeInAnimation[t] && (Fo(() => {
      e.rowComp.toggleCss("ag-opacity-zero", !1);
    }), this.fadeInAnimation[t] = !1);
  }
  addRowDraggerToRow(e) {
    var i;
    const t = (i = this.beans.rowDragSvc) == null ? void 0 : i.createRowDragCompForRow(this.rowNode, e.element);
    if (!t)
      return;
    const s = this.createBean(t, this.beans.context);
    this.rowDragComps.push(s), e.compBean.addDestroyFunc(() => {
      this.rowDragComps = this.rowDragComps.filter((r) => r !== s), this.rowEditStyleFeature = this.destroyBean(this.rowEditStyleFeature, this.beans.context), this.destroyBean(s, this.beans.context);
    });
  }
  setupFullWidth(e) {
    const t = this.getPinnedForContainer(e.containerType), s = this.createFullWidthCompDetails(e.element, t);
    e.rowComp.showFullWidth(s);
  }
  getFullWidthCellRenderers() {
    var e, t;
    return this.gos.get("embedFullWidthRows") ? this.allRowGuis.map((s) => {
      var i;
      return (i = s == null ? void 0 : s.rowComp) == null ? void 0 : i.getFullWidthCellRenderer();
    }) : [(t = (e = this.fullWidthGui) == null ? void 0 : e.rowComp) == null ? void 0 : t.getFullWidthCellRenderer()];
  }
  executeProcessRowPostCreateFunc() {
    const e = this.gos.getCallback("processRowPostCreate");
    if (!e || !this.areAllContainersReady())
      return;
    const t = {
      // areAllContainersReady asserts that centerGui is not null
      eRow: this.centerGui.element,
      ePinnedLeftRow: this.leftGui ? this.leftGui.element : void 0,
      ePinnedRightRow: this.rightGui ? this.rightGui.element : void 0,
      node: this.rowNode,
      rowIndex: this.rowNode.rowIndex,
      addRenderedRowListener: this.addEventListener.bind(this)
    };
    e(t);
  }
  areAllContainersReady() {
    const {
      leftGui: e,
      centerGui: t,
      rightGui: s,
      beans: { visibleCols: i }
    } = this, r = !!e || !i.isPinningLeft(), n = !!t, o = !!s || !i.isPinningRight();
    return r && n && o;
  }
  isNodeFullWidthCell() {
    if (this.rowNode.detail)
      return !0;
    const e = this.beans.gos.getCallback("isFullWidthRow");
    return e ? e({ rowNode: this.rowNode }) : !1;
  }
  setRowType() {
    const e = this.rowNode.stub && !this.gos.get("suppressServerSideFullWidthLoadingRow") && !this.gos.get("groupHideOpenParents"), t = this.isNodeFullWidthCell(), s = this.gos.get("masterDetail") && this.rowNode.detail, i = this.beans.colModel.isPivotMode(), r = $c(this.gos, this.rowNode, i);
    e ? this.rowType = "FullWidthLoading" : s ? this.rowType = "FullWidthDetail" : t ? this.rowType = "FullWidth" : r ? this.rowType = "FullWidthGroup" : this.rowType = "Normal";
  }
  updateColumnLists(e = !1, t = !1) {
    if (this.isFullWidth())
      return;
    const { animationFrameSvc: s } = this.beans;
    if (!(s != null && s.active) || e || this.printLayout) {
      this.updateColumnListsImpl(t);
      return;
    }
    this.updateColumnListsPending || (s.createTask(
      () => {
        this.active && this.updateColumnListsImpl(!0);
      },
      this.rowNode.rowIndex,
      "p1",
      !1
    ), this.updateColumnListsPending = !0);
  }
  /**
   * Overridden by SpannedRowCtrl
   */
  getNewCellCtrl(e) {
    var s;
    if (!((s = this.beans.rowSpanSvc) != null && s.isCellSpanning(e, this.rowNode)))
      return new ar(e, this.rowNode, this.beans, this);
  }
  /**
   * Overridden by SpannedRowCtrl, if span context changes cell needs rebuilt
   */
  isCorrectCtrlForSpan(e) {
    var t;
    return !((t = this.beans.rowSpanSvc) != null && t.isCellSpanning(e.column, this.rowNode));
  }
  createCellCtrls(e, t, s = null) {
    const i = {
      list: [],
      map: {}
    }, r = (c, d, h) => {
      h != null ? i.list.splice(h, 0, d) : i.list.push(d), i.map[c] = d;
    }, n = [];
    for (const c of t) {
      const d = c.getInstanceId();
      let h = e.map[d];
      h && !this.isCorrectCtrlForSpan(h) && (h.destroy(), h = void 0), h || (h = this.getNewCellCtrl(c)), h && r(d, h);
    }
    for (const c of e.list) {
      const d = c.column.getInstanceId();
      if (i.map[d] != null)
        continue;
      !this.isCellEligibleToBeRemoved(c, s) ? n.push([d, c]) : c.destroy();
    }
    if (n.length)
      for (const [c, d] of n) {
        const h = i.list.findIndex((g) => g.column.getLeft() > d.column.getLeft()), u = h === -1 ? void 0 : Math.max(h - 1, 0);
        r(c, d, u);
      }
    const { focusSvc: o, visibleCols: a } = this.beans, l = o.getFocusedCell();
    if (l && l.column.getPinned() == s) {
      const c = l.column.getInstanceId();
      if (!i.map[c] && a.allCols.includes(l.column)) {
        const h = this.createFocusedCellCtrl();
        if (h) {
          const u = i.list.findIndex((p) => p.column.getLeft() > h.column.getLeft()), g = u === -1 ? void 0 : Math.max(u - 1, 0);
          r(c, h, g);
        }
      }
    }
    return i;
  }
  /**
   * Creates a new cell ctrl for the focused cell, if this is the correct row ctrl.
   * @returns a CellCtrl for the focused cell, if required.
   */
  createFocusedCellCtrl() {
    const { focusSvc: e, rowSpanSvc: t } = this.beans, s = e.getFocusedCell();
    if (!s)
      return;
    const i = t == null ? void 0 : t.getCellSpan(s.column, this.rowNode);
    if (i) {
      if (i.firstNode !== this.rowNode || !i.doesSpanContain(s))
        return;
    } else if (!e.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned))
      return;
    return this.getNewCellCtrl(s.column);
  }
  updateColumnListsImpl(e) {
    this.updateColumnListsPending = !1, this.createAllCellCtrls(), this.setCellCtrls(e);
  }
  setCellCtrls(e) {
    this.allRowGuis.forEach((t) => {
      const s = this.getCellCtrlsForContainer(t.containerType);
      t.rowComp.setCellCtrls(s, e);
    });
  }
  getCellCtrlsForContainer(e) {
    switch (e) {
      case "left":
        return this.leftCellCtrls.list;
      case "right":
        return this.rightCellCtrls.list;
      case "fullWidth":
        return [];
      case "center":
        return this.centerCellCtrls.list;
    }
  }
  createAllCellCtrls() {
    const e = this.beans.colViewport, t = this.beans.visibleCols;
    if (this.printLayout)
      this.centerCellCtrls = this.createCellCtrls(this.centerCellCtrls, t.allCols), this.leftCellCtrls = { list: [], map: {} }, this.rightCellCtrls = { list: [], map: {} };
    else {
      const s = e.getColsWithinViewport(this.rowNode);
      this.centerCellCtrls = this.createCellCtrls(this.centerCellCtrls, s);
      const i = t.getLeftColsForRow(this.rowNode);
      this.leftCellCtrls = this.createCellCtrls(this.leftCellCtrls, i, "left");
      const r = t.getRightColsForRow(this.rowNode);
      this.rightCellCtrls = this.createCellCtrls(this.rightCellCtrls, r, "right");
    }
  }
  isCellEligibleToBeRemoved(e, t) {
    const { column: r } = e;
    if (r.getPinned() != t || !this.isCorrectCtrlForSpan(e))
      return !0;
    const { visibleCols: n, editSvc: o } = this.beans, a = o == null ? void 0 : o.isEditing(e), l = e.isCellFocused();
    return a || l ? !(n.allCols.indexOf(r) >= 0) : !0;
  }
  getDomOrder() {
    return this.gos.get("ensureDomOrder") || Ie(this.gos, "print");
  }
  listenOnDomOrder(e) {
    const t = () => {
      e.rowComp.setDomOrder(this.getDomOrder());
    };
    e.compBean.addManagedPropertyListeners(["domLayout", "ensureDomOrder"], t);
  }
  setAnimateFlags(e) {
    if (this.rowNode.sticky || !e)
      return;
    const t = A(this.rowNode.oldRowTop), { visibleCols: s } = this.beans, i = s.isPinningLeft(), r = s.isPinningRight();
    if (t) {
      const { slideInAnimation: n } = this;
      if (this.isFullWidth() && !this.gos.get("embedFullWidthRows")) {
        n.fullWidth = !0;
        return;
      }
      n.center = !0, n.left = i, n.right = r;
    } else {
      const { fadeInAnimation: n } = this;
      if (this.isFullWidth() && !this.gos.get("embedFullWidthRows")) {
        n.fullWidth = !0;
        return;
      }
      n.center = !0, n.left = i, n.right = r;
    }
  }
  isFullWidth() {
    return this.rowType !== "Normal";
  }
  refreshFullWidth() {
    const e = (o, a) => o ? o.rowComp.refreshFullWidth(() => this.createFullWidthCompDetails(o.element, a).params) : !0, t = e(this.fullWidthGui, null), s = e(this.centerGui, null), i = e(this.leftGui, "left"), r = e(this.rightGui, "right");
    return t && s && i && r;
  }
  addListeners() {
    const { beans: e, gos: t, rowNode: s } = this, { expansionSvc: i, eventSvc: r, context: n, rowSpanSvc: o } = e;
    this.addManagedListeners(this.rowNode, {
      heightChanged: () => this.onRowHeightChanged(),
      rowSelected: () => this.onRowSelected(),
      rowIndexChanged: this.onRowIndexChanged.bind(this),
      topChanged: this.onTopChanged.bind(this),
      ...(i == null ? void 0 : i.getRowExpandedListeners(this)) ?? {}
    }), s.detail && this.addManagedListeners(s.parent, { dataChanged: this.onRowNodeDataChanged.bind(this) }), this.addManagedListeners(s, {
      dataChanged: this.onRowNodeDataChanged.bind(this),
      cellChanged: this.postProcessCss.bind(this),
      rowHighlightChanged: this.onRowNodeHighlightChanged.bind(this),
      draggingChanged: this.postProcessRowDragging.bind(this),
      uiLevelChanged: this.onUiLevelChanged.bind(this),
      rowPinned: this.onRowPinned.bind(this)
    }), this.addManagedListeners(r, {
      paginationPixelOffsetChanged: this.onPaginationPixelOffsetChanged.bind(this),
      heightScaleChanged: this.onTopChanged.bind(this),
      displayedColumnsChanged: this.onDisplayedColumnsChanged.bind(this),
      virtualColumnsChanged: this.onVirtualColumnsChanged.bind(this),
      cellFocused: this.onCellFocusChanged.bind(this),
      cellFocusCleared: this.onCellFocusChanged.bind(this),
      paginationChanged: this.onPaginationChanged.bind(this),
      modelUpdated: this.refreshFirstAndLastRowStyles.bind(this),
      columnMoved: () => this.updateColumnLists()
    }), o && this.addManagedListeners(o, {
      spannedCellsUpdated: ({ pinned: a }) => {
        a && !s.rowPinned || this.updateColumnLists();
      }
    }), this.addDestroyFunc(() => {
      this.rowDragComps = this.destroyBeans(this.rowDragComps, n), this.tooltipFeature = this.destroyBean(this.tooltipFeature, n), this.rowEditStyleFeature = this.destroyBean(this.rowEditStyleFeature, n);
    }), this.addManagedPropertyListeners(
      ["rowStyle", "getRowStyle", "rowClass", "getRowClass", "rowClassRules"],
      this.postProcessCss.bind(this)
    ), this.addManagedPropertyListener("rowDragEntireRow", () => {
      if (t.get("rowDragEntireRow")) {
        this.allRowGuis.forEach((l) => {
          this.addRowDraggerToRow(l);
        });
        return;
      }
      this.rowDragComps = this.destroyBeans(this.rowDragComps, n);
    }), this.addListenersForCellComps();
  }
  addListenersForCellComps() {
    this.addManagedListeners(this.rowNode, {
      rowIndexChanged: () => this.getAllCellCtrls().forEach((e) => e.onRowIndexChanged()),
      cellChanged: (e) => this.getAllCellCtrls().forEach((t) => t.onCellChanged(e))
    });
  }
  /** Should only ever be triggered on source rows (i.e. not on pinned siblings) */
  onRowPinned() {
    for (const e of this.allRowGuis)
      e.rowComp.toggleCss("ag-row-pinned-source", !!this.rowNode.pinnedSibling);
  }
  onRowNodeDataChanged(e) {
    this.refreshRow({
      suppressFlash: !e.update,
      newData: !e.update
    });
  }
  refreshRow(e) {
    if (this.isFullWidth() !== !!this.isNodeFullWidthCell()) {
      this.beans.rowRenderer.redrawRow(this.rowNode);
      return;
    }
    if (this.isFullWidth()) {
      this.refreshFullWidth() || this.beans.rowRenderer.redrawRow(this.rowNode);
      return;
    }
    this.getAllCellCtrls().forEach((s) => s.refreshCell(e)), this.allRowGuis.forEach((s) => {
      this.setRowCompRowId(s.rowComp), this.updateRowBusinessKey(), this.setRowCompRowBusinessKey(s.rowComp);
    }), this.onRowSelected(), this.postProcessCss();
  }
  postProcessCss() {
    var e;
    this.setStylesFromGridOptions(!0), this.postProcessClassesFromGridOptions(), this.postProcessRowClassRules(), (e = this.rowEditStyleFeature) == null || e.applyRowStyles(), this.postProcessRowDragging();
  }
  onRowNodeHighlightChanged() {
    const e = this.beans.rowDropHighlightSvc, t = (e == null ? void 0 : e.row) === this.rowNode ? e.position : "none", s = t === "above", i = t === "inside", r = t === "below", o = this.gos.get("treeData") && (r || s), a = this.rowNode.uiLevel.toString();
    this.allRowGuis.forEach((l) => {
      const c = l.rowComp;
      c.toggleCss("ag-row-highlight-above", s), c.toggleCss("ag-row-highlight-inside", i), c.toggleCss("ag-row-highlight-below", r), c.toggleCss("ag-row-highlight-indent", o), o ? l.element.style.setProperty("--ag-row-highlight-level", a) : l.element.style.removeProperty("--ag-row-highlight-level");
    });
  }
  postProcessRowDragging() {
    const e = this.rowNode.dragging;
    this.allRowGuis.forEach((t) => t.rowComp.toggleCss("ag-row-dragging", e));
  }
  onDisplayedColumnsChanged() {
    var e;
    this.updateColumnLists(!0), (e = this.beans.rowAutoHeight) == null || e.requestCheckAutoHeight();
  }
  onVirtualColumnsChanged() {
    this.updateColumnLists(!1, !0);
  }
  getRowPosition() {
    return {
      rowPinned: Ce(this.rowNode.rowPinned),
      rowIndex: this.rowNode.rowIndex
    };
  }
  onKeyboardNavigate(e) {
    const t = this.findFullWidthInfoForEvent(e);
    if (!t)
      return;
    const { rowGui: s, column: i } = t;
    if (!(s.element === e.target))
      return;
    const o = this.rowNode, { focusSvc: a, navigation: l } = this.beans, c = a.getFocusedCell(), d = {
      rowIndex: o.rowIndex,
      rowPinned: o.rowPinned,
      column: (c == null ? void 0 : c.column) ?? i
    };
    l == null || l.navigateToNextCell(e, e.key, d, !0), e.preventDefault();
  }
  onTabKeyDown(e) {
    var a;
    if (e.defaultPrevented || St(e))
      return;
    const t = this.allRowGuis.find(
      (l) => l.element.contains(e.target)
    ), s = t ? t.element : null, i = s === e.target, r = Q(this.beans);
    let n = !1;
    s && r && (n = s.contains(r) && r.classList.contains("ag-cell"));
    let o = null;
    !i && !n && (o = ze(this.beans, s, !1, e.shiftKey)), (this.isFullWidth() && i || !o) && ((a = this.beans.navigation) == null || a.onTabKeyDown(this, e));
  }
  getFullWidthElement() {
    return this.fullWidthGui ? this.fullWidthGui.element : null;
  }
  getRowYPosition() {
    var t;
    const e = (t = this.allRowGuis.find((s) => Ze(s.element))) == null ? void 0 : t.element;
    return e ? e.getBoundingClientRect().top : 0;
  }
  onSuppressCellFocusChanged(e) {
    const t = this.isFullWidth() && e ? void 0 : this.gos.get("tabIndex");
    this.allRowGuis.forEach((s) => {
      vt(s.element, "tabindex", t);
    });
  }
  onFullWidthRowFocused(e) {
    var r, n, o;
    const t = this.rowNode, s = e ? this.isFullWidth() && e.rowIndex === t.rowIndex && e.rowPinned == t.rowPinned : !1;
    let i;
    if (this.fullWidthGui)
      i = this.fullWidthGui.element;
    else {
      const a = this.beans.colModel.getCol(e == null ? void 0 : e.column), l = a == null ? void 0 : a.pinned;
      l ? i = l === "right" ? (r = this.rightGui) == null ? void 0 : r.element : (n = this.leftGui) == null ? void 0 : n.element : i = (o = this.centerGui) == null ? void 0 : o.element;
    }
    i && (i.classList.toggle("ag-full-width-focus", s), s && (e != null && e.forceBrowserFocus) && i.focus({ preventScroll: !0 }));
  }
  recreateCell(e) {
    this.centerCellCtrls = this.removeCellCtrl(this.centerCellCtrls, e), this.leftCellCtrls = this.removeCellCtrl(this.leftCellCtrls, e), this.rightCellCtrls = this.removeCellCtrl(this.rightCellCtrls, e), e.destroy(), this.updateColumnLists();
  }
  removeCellCtrl(e, t) {
    const s = {
      list: [],
      map: {}
    };
    return e.list.forEach((i) => {
      i !== t && (s.list.push(i), s.map[i.column.getInstanceId()] = i);
    }), s;
  }
  onMouseEvent(e, t) {
    switch (e) {
      case "dblclick":
        this.onRowDblClick(t);
        break;
      case "click":
        this.onRowClick(t);
        break;
      case "touchstart":
      case "mousedown":
        this.onRowMouseDown(t);
        break;
    }
  }
  createRowEvent(e, t) {
    const { rowNode: s } = this;
    return V(this.gos, {
      type: e,
      node: s,
      data: s.data,
      rowIndex: s.rowIndex,
      rowPinned: s.rowPinned,
      event: t
    });
  }
  createRowEventWithSource(e, t) {
    const s = this.createRowEvent(e, t);
    return s.source = this, s;
  }
  onRowDblClick(e) {
    if (St(e))
      return;
    const t = this.createRowEventWithSource("rowDoubleClicked", e);
    t.isEventHandlingSuppressed = this.isSuppressMouseEvent(e), this.beans.eventSvc.dispatchEvent(t);
  }
  findFullWidthInfoForEvent(e) {
    if (!e)
      return;
    const t = this.findFullWidthRowGui(e.target), s = this.getColumnForFullWidth(t);
    if (!(!t || !s))
      return { rowGui: t, column: s };
  }
  findFullWidthRowGui(e) {
    return this.allRowGuis.find((t) => t.element.contains(e));
  }
  getColumnForFullWidth(e) {
    const { visibleCols: t } = this.beans;
    switch (e == null ? void 0 : e.containerType) {
      case "center":
        return t.centerCols[0];
      case "left":
        return t.leftCols[0];
      case "right":
        return t.rightCols[0];
      default:
        return t.allCols[0];
    }
  }
  onRowMouseDown(e) {
    if (this.lastMouseDownOnDragger = mi(e.target, "ag-row-drag", 3), !this.isFullWidth() || this.isSuppressMouseEvent(e))
      return;
    const { rangeSvc: t, focusSvc: s } = this.beans;
    t == null || t.removeAllCellRanges();
    const i = this.findFullWidthInfoForEvent(e);
    if (!i)
      return;
    const { rowGui: r, column: n } = i, o = r.element, a = e.target, l = this.rowNode;
    let c = e.defaultPrevented || As();
    o && o.contains(a) && Gc(a) && (c = !1), s.setFocusedCell({
      rowIndex: l.rowIndex,
      column: n,
      rowPinned: l.rowPinned,
      forceBrowserFocus: c
    });
  }
  isSuppressMouseEvent(e) {
    const { gos: t, rowNode: s } = this;
    if (this.isFullWidth()) {
      const r = this.findFullWidthRowGui(e.target);
      return bS(
        t,
        r == null ? void 0 : r.rowComp.getFullWidthCellRendererParams(),
        s,
        e
      );
    }
    const i = ba(t, e.target);
    return i != null && ro(t, i.column, s, e);
  }
  onRowClick(e) {
    if (St(e) || this.lastMouseDownOnDragger)
      return;
    const s = this.isSuppressMouseEvent(e), { eventSvc: i, selectionSvc: r } = this.beans, n = this.createRowEventWithSource("rowClicked", e);
    n.isEventHandlingSuppressed = s, i.dispatchEvent(n), !s && (r == null || r.handleSelectionEvent(e, this.rowNode, "rowClicked"));
  }
  setupDetailRowAutoHeight(e) {
    var t;
    this.rowType === "FullWidthDetail" && ((t = this.beans.masterDetailSvc) == null || t.setupDetailRowAutoHeight(this, e));
  }
  createFullWidthCompDetails(e, t) {
    const { gos: s, rowNode: i } = this, r = V(s, {
      fullWidth: !0,
      data: i.data,
      node: i,
      value: i.key,
      valueFormatted: i.key,
      // these need to be taken out, as part of 'afterAttached' now
      eGridCell: e,
      eParentOfValue: e,
      pinned: t,
      addRenderedRowListener: this.addEventListener.bind(this),
      // This is not on the type of ICellRendererParams
      registerRowDragger: (o, a, l, c) => this.addFullWidthRowDragging(o, a, l, c),
      setTooltip: (o, a) => {
        s.assertModuleRegistered("Tooltip", 3), this.setupFullWidthRowTooltip(o, a);
      }
    }), n = this.beans.userCompFactory;
    switch (this.rowType) {
      case "FullWidthDetail":
        return $b(n, r);
      case "FullWidthGroup": {
        const { value: o, valueFormatted: a } = this.beans.valueSvc.getValueForDisplay(void 0, this.rowNode, !0);
        return r.value = o, r.valueFormatted = a, Ub(n, r);
      }
      case "FullWidthLoading":
        return _b(n, r);
      default:
        return Wb(n, r);
    }
  }
  setupFullWidthRowTooltip(e, t) {
    var s;
    this.fullWidthGui && (this.tooltipFeature = (s = this.beans.tooltipSvc) == null ? void 0 : s.setupFullWidthRowTooltip(
      this.tooltipFeature,
      this,
      e,
      t
    ));
  }
  addFullWidthRowDragging(e, t, s = "", i) {
    const { rowDragSvc: r, context: n } = this.beans;
    if (!r || !this.isFullWidth())
      return;
    const o = r.createRowDragComp(
      () => s,
      this.rowNode,
      void 0,
      e,
      t,
      i
    );
    this.createBean(o, n), this.addDestroyFunc(() => {
      this.destroyBean(o, n);
    });
  }
  onUiLevelChanged() {
    const e = ou(this.rowNode);
    if (this.rowLevel != e) {
      const t = "ag-row-level-" + e, s = "ag-row-level-" + this.rowLevel;
      this.allRowGuis.forEach((i) => {
        i.rowComp.toggleCss(t, !0), i.rowComp.toggleCss(s, !1);
      });
    }
    this.rowLevel = e;
  }
  isFirstRowOnPage() {
    return this.rowNode.rowIndex === this.beans.pageBounds.getFirstRow();
  }
  isLastRowOnPage() {
    return this.rowNode.rowIndex === this.beans.pageBounds.getLastRow();
  }
  refreshFirstAndLastRowStyles() {
    const e = this.isFirstRowOnPage(), t = this.isLastRowOnPage();
    this.firstRowOnPage !== e && (this.firstRowOnPage = e, this.allRowGuis.forEach((s) => s.rowComp.toggleCss("ag-row-first", e))), this.lastRowOnPage !== t && (this.lastRowOnPage = t, this.allRowGuis.forEach((s) => s.rowComp.toggleCss("ag-row-last", t)));
  }
  getAllCellCtrls() {
    return this.leftCellCtrls.list.length === 0 && this.rightCellCtrls.list.length === 0 ? this.centerCellCtrls.list : [...this.centerCellCtrls.list, ...this.leftCellCtrls.list, ...this.rightCellCtrls.list];
  }
  postProcessClassesFromGridOptions() {
    var t;
    const e = [];
    (t = this.beans.rowStyleSvc) == null || t.processClassesFromGridOptions(e, this.rowNode), e.length && e.forEach((s) => {
      this.allRowGuis.forEach((i) => i.rowComp.toggleCss(s, !0));
    });
  }
  postProcessRowClassRules() {
    var e;
    (e = this.beans.rowStyleSvc) == null || e.processRowClassRules(
      this.rowNode,
      (t) => {
        this.allRowGuis.forEach((s) => s.rowComp.toggleCss(t, !0));
      },
      (t) => {
        this.allRowGuis.forEach((s) => s.rowComp.toggleCss(t, !1));
      }
    );
  }
  setStylesFromGridOptions(e, t) {
    e && (this.rowStyles = this.processStylesFromGridOptions()), this.forEachGui(t, (s) => s.rowComp.setUserStyles(this.rowStyles));
  }
  getPinnedForContainer(e) {
    return e === "left" || e === "right" ? e : null;
  }
  getInitialRowClasses(e) {
    var a, l;
    const t = this.getPinnedForContainer(e), s = this.isFullWidth(), { rowNode: i, beans: r } = this, n = [];
    n.push("ag-row"), n.push(this.rowFocused ? "ag-row-focus" : "ag-row-no-focus"), this.fadeInAnimation[e] && n.push("ag-opacity-zero"), n.push(i.rowIndex % 2 === 0 ? "ag-row-even" : "ag-row-odd"), i.isRowPinned() && (n.push("ag-row-pinned"), (a = r.pinnedRowModel) != null && a.isManual() && n.push("ag-row-pinned-manual")), !i.isRowPinned() && i.pinnedSibling && n.push("ag-row-pinned-source"), i.isSelected() && n.push("ag-row-selected"), i.footer && n.push("ag-row-footer"), n.push("ag-row-level-" + this.rowLevel), i.stub && n.push("ag-row-loading"), s && n.push("ag-full-width-row"), (l = r.expansionSvc) == null || l.addExpandedCss(n, i), i.dragging && n.push("ag-row-dragging");
    const { rowStyleSvc: o } = r;
    return o && (o.processClassesFromGridOptions(n, i), o.preProcessRowClassRules(n, i)), n.push(this.printLayout ? "ag-row-position-relative" : "ag-row-position-absolute"), this.isFirstRowOnPage() && n.push("ag-row-first"), this.isLastRowOnPage() && n.push("ag-row-last"), s && (t === "left" && n.push("ag-cell-last-left-pinned"), t === "right" && n.push("ag-cell-first-right-pinned")), n;
  }
  processStylesFromGridOptions() {
    var e;
    return ((e = this.beans.rowStyleSvc) == null ? void 0 : e.processStylesFromGridOptions(this.rowNode)) ?? this.emptyStyle;
  }
  onRowSelected(e) {
    var t;
    (t = this.beans.selectionSvc) == null || t.onRowCtrlSelected(
      this,
      (s) => {
        (s === this.centerGui || s === this.fullWidthGui) && this.announceDescription();
      },
      e
    );
  }
  announceDescription() {
    var e;
    (e = this.beans.selectionSvc) == null || e.announceAriaRowSelection(this.rowNode);
  }
  addHoverFunctionality(e) {
    if (!this.active)
      return;
    const { element: t, compBean: s } = e, { rowNode: i, beans: r, gos: n } = this;
    s.addManagedListeners(t, {
      // We use pointer events here instead of mouse events, as pointer events
      // are more reliable for hover detection, especially with touch devices
      // or hybrid touch + mouse devices.
      pointerenter: (o) => {
        o.pointerType === "mouse" && i.dispatchRowEvent("mouseEnter");
      },
      pointerleave: (o) => {
        o.pointerType === "mouse" && i.dispatchRowEvent("mouseLeave");
      }
    }), s.addManagedListeners(i, {
      mouseEnter: () => {
        var o;
        !((o = r.dragSvc) != null && o.dragging) && !n.get("suppressRowHoverHighlight") && (t.classList.add("ag-row-hover"), i.setHovered(!0));
      },
      mouseLeave: () => {
        this.resetHoveredStatus(t);
      }
    });
  }
  resetHoveredStatus(e) {
    const t = e ? [e] : this.allRowGuis.map((s) => s.element);
    for (const s of t)
      s.classList.remove("ag-row-hover");
    this.rowNode.setHovered(!1);
  }
  // for animation, we don't want to animate entry or exit to a very far away pixel,
  // otherwise the row would move so fast, it would appear to disappear. so this method
  // moves the row closer to the viewport if it is far away, so the row slide in / out
  // at a speed the user can see.
  roundRowTopToBounds(e) {
    const t = this.beans.ctrlsSvc.getScrollFeature().getApproximateVScollPosition(), s = this.applyPaginationOffset(t.top, !0) - 100, i = this.applyPaginationOffset(t.bottom, !0) + 100;
    return Math.min(Math.max(s, e), i);
  }
  forEachGui(e, t) {
    e ? t(e) : this.allRowGuis.forEach(t);
  }
  isRowRendered() {
    return this.allRowGuis.length > 0;
  }
  onRowHeightChanged(e) {
    if (this.rowNode.rowHeight == null)
      return;
    const t = this.rowNode.rowHeight, s = this.beans.environment.getDefaultRowHeight(), r = Wc(this.gos) ? He(this.beans, this.rowNode).height : void 0, n = r ? `${Math.min(s, r) - 2}px` : void 0;
    this.forEachGui(e, (o) => {
      o.element.style.height = `${t}px`, n && o.element.style.setProperty("--ag-line-height", n);
    });
  }
  // note - this is NOT called by context, as we don't wire / unwire the CellComp for performance reasons.
  destroyFirstPass(e = !1) {
    var i;
    this.active = !1;
    const { rowNode: t } = this;
    if (!e && sr(this.gos) && !t.sticky)
      if (t.rowTop != null) {
        const n = this.roundRowTopToBounds(t.rowTop);
        this.setRowTop(n);
      } else
        this.allRowGuis.forEach((n) => n.rowComp.toggleCss("ag-opacity-zero", !0));
    (i = this.fullWidthGui) != null && i.element.contains(Q(this.beans)) && this.beans.focusSvc.attemptToRecoverFocus(), t.setHovered(!1);
    const s = this.createRowEvent("virtualRowRemoved");
    this.dispatchLocalEvent(s), this.beans.eventSvc.dispatchEvent(s), super.destroy();
  }
  destroySecondPass() {
    this.allRowGuis.length = 0;
    const e = (t) => (t.list.forEach((s) => s.destroy()), { list: [], map: {} });
    this.centerCellCtrls = e(this.centerCellCtrls), this.leftCellCtrls = e(this.leftCellCtrls), this.rightCellCtrls = e(this.rightCellCtrls);
  }
  setFocusedClasses(e) {
    this.forEachGui(e, (t) => {
      t.rowComp.toggleCss("ag-row-focus", this.rowFocused), t.rowComp.toggleCss("ag-row-no-focus", !this.rowFocused);
    });
  }
  onCellFocusChanged() {
    const { focusSvc: e } = this.beans, t = e.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned);
    t !== this.rowFocused && (this.rowFocused = t, this.setFocusedClasses());
  }
  onPaginationChanged() {
    var t;
    const e = ((t = this.beans.pagination) == null ? void 0 : t.getCurrentPage()) ?? 0;
    this.paginationPage !== e && (this.paginationPage = e, this.onTopChanged()), this.refreshFirstAndLastRowStyles();
  }
  onTopChanged() {
    this.setRowTop(this.rowNode.rowTop);
  }
  onPaginationPixelOffsetChanged() {
    this.onTopChanged();
  }
  // applies pagination offset, eg if on second page, and page height is 500px, then removes
  // 500px from the top position, so a row with rowTop 600px is displayed at location 100px.
  // reverse will take the offset away rather than add.
  applyPaginationOffset(e, t = !1) {
    if (this.rowNode.isRowPinned() || this.rowNode.sticky)
      return e;
    const s = this.beans.pageBounds.getPixelOffset();
    return e + s * (t ? 1 : -1);
  }
  setRowTop(e) {
    if (!this.printLayout && A(e)) {
      const t = this.applyPaginationOffset(e), r = `${this.rowNode.isRowPinned() || this.rowNode.sticky ? t : this.beans.rowContainerHeight.getRealPixelPosition(t)}px`;
      this.setRowTopStyle(r);
    }
  }
  // the top needs to be set into the DOM element when the element is created, not updated afterwards.
  // otherwise the transition would not work, as it would be transitioning from zero (the unset value).
  // for example, suppose a row that is outside the viewport, then user does a filter to remove other rows
  // and this row now appears in the viewport, and the row moves up (ie it was under the viewport and not rendered,
  // but now is in the viewport) then a new RowComp is created, however it should have it's position initialised
  // to below the viewport, so the row will appear to animate up. if we didn't set the initial position at creation
  // time, the row would animate down (ie from position zero).
  getInitialRowTop(e) {
    return this.suppressRowTransform ? this.getInitialRowTopShared(e) : void 0;
  }
  getInitialTransform(e) {
    return this.suppressRowTransform ? void 0 : `translateY(${this.getInitialRowTopShared(e)})`;
  }
  getInitialRowTopShared(e) {
    if (this.printLayout)
      return "";
    const t = this.rowNode;
    let s;
    if (t.sticky)
      s = t.stickyRowTop;
    else {
      const i = this.slideInAnimation[e] ? this.roundRowTopToBounds(t.oldRowTop) : t.rowTop, r = this.applyPaginationOffset(i);
      s = t.isRowPinned() ? r : this.beans.rowContainerHeight.getRealPixelPosition(r);
    }
    return s + "px";
  }
  setRowTopStyle(e) {
    this.allRowGuis.forEach(
      (t) => this.suppressRowTransform ? t.rowComp.setTop(e) : t.rowComp.setTransform(`translateY(${e})`)
    );
  }
  getCellCtrl(e, t = !1) {
    let s = null;
    return this.getAllCellCtrls().forEach((i) => {
      i.column == e && (s = i);
    }), s != null || t || this.getAllCellCtrls().forEach((i) => {
      (i == null ? void 0 : i.getColSpanningList().indexOf(e)) >= 0 && (s = i);
    }), s;
  }
  onRowIndexChanged() {
    this.rowNode.rowIndex != null && (this.onCellFocusChanged(), this.updateRowIndexes(), this.postProcessCss());
  }
  updateRowIndexes(e) {
    var n, o;
    const t = this.rowNode.getRowIndexString();
    if (t === null)
      return;
    const s = (((n = this.beans.ctrlsSvc.getHeaderRowContainerCtrl()) == null ? void 0 : n.getRowCount()) ?? 0) + (((o = this.beans.filterManager) == null ? void 0 : o.getHeaderRowCount()) ?? 0), i = this.rowNode.rowIndex % 2 === 0, r = s + this.rowNode.rowIndex + 1;
    this.forEachGui(e, (a) => {
      a.rowComp.setRowIndex(t), a.rowComp.toggleCss("ag-row-even", i), a.rowComp.toggleCss("ag-row-odd", !i), en(a.element, r);
    });
  }
}, IT = class extends R {
  constructor() {
    super(), this.beanName = "navigation", this.onPageDown = ph(this.onPageDown, 100), this.onPageUp = ph(this.onPageUp, 100);
  }
  postConstruct() {
    this.beans.ctrlsSvc.whenReady(this, (e) => {
      this.gridBodyCon = e.gridBodyCtrl;
    });
  }
  handlePageScrollingKey(e, t = !1) {
    const s = e.key, i = e.altKey, r = e.ctrlKey || e.metaKey, n = !!this.beans.rangeSvc && e.shiftKey, o = pf(this.gos, e);
    let a = !1;
    switch (s) {
      case S.PAGE_HOME:
      case S.PAGE_END:
        !r && !i && (this.onHomeOrEndKey(s), a = !0);
        break;
      case S.LEFT:
      case S.RIGHT:
      case S.UP:
      case S.DOWN:
        if (!o)
          return !1;
        r && !i && !n && (this.onCtrlUpDownLeftRight(s, o), a = !0);
        break;
      case S.PAGE_DOWN:
      case S.PAGE_UP:
        !r && !i && (a = this.handlePageUpDown(s, o, t));
        break;
    }
    return a && e.preventDefault(), a;
  }
  handlePageUpDown(e, t, s) {
    return s && (t = this.beans.focusSvc.getFocusedCell()), t ? (e === S.PAGE_UP ? this.onPageUp(t) : this.onPageDown(t), !0) : !1;
  }
  navigateTo({
    scrollIndex: e,
    scrollType: t,
    scrollColumn: s,
    focusIndex: i,
    focusColumn: r,
    isAsync: n,
    rowPinned: o
  }) {
    const { scrollFeature: a } = this.gridBodyCon;
    A(s) && !s.isPinned() && a.ensureColumnVisible(s), A(e) && a.ensureIndexVisible(e, t), n || a.ensureIndexVisible(i);
    const { focusSvc: l, rangeSvc: c } = this.beans;
    l.setFocusedCell({
      rowIndex: i,
      column: r,
      rowPinned: o,
      forceBrowserFocus: !0
    }), c == null || c.setRangeToCell({ rowIndex: i, rowPinned: o, column: r });
  }
  // this method is throttled, see the `constructor`
  onPageDown(e) {
    const t = this.beans, s = gl(t), i = this.getViewportHeight(), { pageBounds: r, rowModel: n, rowAutoHeight: o } = t, a = r.getPixelOffset(), l = s.top + i, c = n.getRowIndexAtPixel(l + a);
    o != null && o.active ? this.navigateToNextPageWithAutoHeight(e, c) : this.navigateToNextPage(e, c);
  }
  // this method is throttled, see the `constructor`
  onPageUp(e) {
    const t = this.beans, s = gl(t), { pageBounds: i, rowModel: r, rowAutoHeight: n } = t, o = i.getPixelOffset(), a = s.top, l = r.getRowIndexAtPixel(a + o);
    n != null && n.active ? this.navigateToNextPageWithAutoHeight(e, l, !0) : this.navigateToNextPage(e, l, !0);
  }
  navigateToNextPage(e, t, s = !1) {
    const { pageBounds: i, rowModel: r } = this.beans, n = this.getViewportHeight(), o = i.getFirstRow(), a = i.getLastRow(), l = i.getPixelOffset(), c = r.getRow(e.rowIndex), d = s ? (
      // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
      (c == null ? void 0 : c.rowHeight) - n - l
    ) : n - l, h = (c == null ? void 0 : c.rowTop) + d;
    let u = r.getRowIndexAtPixel(h + l);
    if (u === e.rowIndex) {
      const p = s ? -1 : 1;
      t = u = e.rowIndex + p;
    }
    let g;
    s ? (g = "bottom", u < o && (u = o), t < o && (t = o)) : (g = "top", u > a && (u = a), t > a && (t = a)), this.isRowTallerThanView(r.getRow(u)) && (t = u, g = "top"), this.navigateTo({
      scrollIndex: t,
      scrollType: g,
      scrollColumn: null,
      focusIndex: u,
      focusColumn: e.column
    });
  }
  navigateToNextPageWithAutoHeight(e, t, s = !1) {
    this.navigateTo({
      scrollIndex: t,
      scrollType: s ? "bottom" : "top",
      scrollColumn: null,
      focusIndex: t,
      focusColumn: e.column
    }), setTimeout(() => {
      const i = this.getNextFocusIndexForAutoHeight(e, s);
      this.navigateTo({
        scrollIndex: t,
        scrollType: s ? "bottom" : "top",
        scrollColumn: null,
        focusIndex: i,
        focusColumn: e.column,
        isAsync: !0
      });
    }, 50);
  }
  getNextFocusIndexForAutoHeight(e, t = !1) {
    const s = t ? -1 : 1, i = this.getViewportHeight(), { pageBounds: r, rowModel: n } = this.beans, o = r.getLastRow();
    let a = 0, l = e.rowIndex;
    for (; l >= 0 && l <= o; ) {
      const c = n.getRow(l);
      if (c) {
        const d = c.rowHeight ?? 0;
        if (a + d > i)
          break;
        a += d;
      }
      l += s;
    }
    return Math.max(0, Math.min(l, o));
  }
  getViewportHeight() {
    const e = this.beans, t = gl(e), s = this.beans.scrollVisibleSvc.getScrollbarWidth();
    let i = t.bottom - t.top;
    return e.ctrlsSvc.get("center").isHorizontalScrollShowing() && (i -= s), i;
  }
  isRowTallerThanView(e) {
    if (!e)
      return !1;
    const t = e.rowHeight;
    return typeof t != "number" ? !1 : t > this.getViewportHeight();
  }
  onCtrlUpDownLeftRight(e, t) {
    const s = this.beans.cellNavigation.getNextCellToFocus(e, t, !0), i = this.getNormalisedPosition(s), { rowIndex: r, rowPinned: n, column: o } = i ?? s, a = o;
    this.navigateTo({
      scrollIndex: r,
      scrollType: null,
      scrollColumn: a,
      focusIndex: r,
      focusColumn: a,
      rowPinned: n
    });
  }
  // home brings focus to top left cell, end brings focus to bottom right, grid scrolled to bring
  // same cell into view (which means either scroll all the way up, or all the way down).
  onHomeOrEndKey(e) {
    const t = e === S.PAGE_HOME, { visibleCols: s, pageBounds: i, rowModel: r } = this.beans, n = s.allCols, o = t ? i.getFirstRow() : i.getLastRow(), a = r.getRow(o);
    if (!a)
      return;
    const l = (t ? n : [...n].reverse()).find(
      (c) => !c.isSuppressNavigable(a)
    );
    l && this.navigateTo({
      scrollIndex: o,
      scrollType: null,
      scrollColumn: l,
      focusIndex: o,
      focusColumn: l
    });
  }
  // result of keyboard event
  onTabKeyDown(e, t) {
    const s = t.shiftKey, i = this.tabToNextCellCommon(e, s, t), r = this.beans, { ctrlsSvc: n, pageBounds: o, focusSvc: a, gos: l } = r;
    if (i !== !1) {
      i ? t.preventDefault() : i === null && n.get("gridCtrl").allowFocusForNextCoreContainer(s);
      return;
    }
    if (s) {
      const { rowIndex: c, rowPinned: d } = e.getRowPosition();
      (d ? c === 0 : c === o.getFirstRow()) && (l.get("headerHeight") === 0 || wi(r) ? rs(r, !0, !0) : (t.preventDefault(), a.focusPreviousFromFirstCell(t)));
    } else
      e instanceof ar && e.focusCell(!0), (!s && a.focusOverlay(!1) || rs(r, s)) && t.preventDefault();
  }
  // comes from API
  tabToNextCell(e, t) {
    const s = this.beans, { focusSvc: i, rowRenderer: r } = s, n = i.getFocusedCell();
    if (!n)
      return !1;
    let o = qt(s, n);
    return !o && (o = r.getRowByPosition(n), !o || !o.isFullWidth()) ? !1 : !!this.tabToNextCellCommon(o, e, t, "api");
  }
  tabToNextCellCommon(e, t, s, i = "ui") {
    var l;
    const { editSvc: r, focusSvc: n } = this.beans;
    let o;
    const a = e instanceof ar ? e : (l = e.getAllCellCtrls()) == null ? void 0 : l[0];
    return r != null && r.isEditing() ? o = r == null ? void 0 : r.moveToNextCell(a, t, s, i) : o = this.moveToNextCellNotEditing(e, t, s), o === null ? o : o || !!n.focusedHeader;
  }
  // returns null if no navigation should be performed
  moveToNextCellNotEditing(e, t, s) {
    const i = this.beans.visibleCols.allCols;
    let r;
    if (e instanceof zo) {
      if (r = {
        ...e.getRowPosition(),
        column: t ? i[0] : _(i)
      }, this.gos.get("embedFullWidthRows") && s) {
        const o = e.findFullWidthInfoForEvent(s);
        o && (r.column = o.column);
      }
    } else
      r = e.getFocusedCellPosition();
    const n = this.findNextCellToFocusOn(r, { backwards: t, startEditing: !1 });
    if (n === !1)
      return null;
    if (n instanceof ar)
      n.focusCell(!0);
    else if (n)
      return this.tryToFocusFullWidthRow(n, t);
    return A(n);
  }
  /**
   * called by the cell, when tab is pressed while editing.
   * @returns RenderedCell when navigation successful, false if navigation should not be performed, otherwise null
   */
  findNextCellToFocusOn(e, { backwards: t, startEditing: s, skipToNextEditableCell: i }) {
    let r = e;
    const n = this.beans, { cellNavigation: o, gos: a, focusSvc: l, rowRenderer: c, rangeSvc: d } = n;
    for (; ; ) {
      e !== r && (e = r), t || (r = this.getLastCellOfColSpan(r)), r = o.getNextTabbedCell(r, t);
      const h = a.getCallback("tabToNextCell");
      if (A(h)) {
        const f = h({
          backwards: t,
          editing: s,
          previousCellPosition: e,
          nextCellPosition: r || null
        });
        if (f === !0)
          r = e;
        else {
          if (f === !1)
            return !1;
          r = {
            rowIndex: f.rowIndex,
            column: f.column,
            rowPinned: f.rowPinned
          };
        }
      }
      if (!r)
        return null;
      if (r.rowIndex < 0) {
        const p = Yt(n);
        return l.focusHeaderPosition({
          headerPosition: {
            headerRowIndex: p + r.rowIndex,
            column: r.column
          },
          fromCell: !0
        }), null;
      }
      const u = a.get("editType") === "fullRow";
      if (s && (!u || i) && !this.isCellEditable(r))
        continue;
      this.ensureCellVisible(r);
      const g = qt(n, r);
      if (!g) {
        const p = c.getRowByPosition(r);
        if (!p || !p.isFullWidth() || s)
          continue;
        return { ...p.getRowPosition(), column: r == null ? void 0 : r.column };
      }
      if (!o.isSuppressNavigable(g.column, g.rowNode))
        return g.setFocusedCellPosition(r), d == null || d.setRangeToCell(r), g;
    }
  }
  isCellEditable(e) {
    const t = this.lookupRowNodeForCell(e);
    return t ? e.column.isCellEditable(t) : !1;
  }
  lookupRowNodeForCell({ rowIndex: e, rowPinned: t }) {
    const { pinnedRowModel: s, rowModel: i } = this.beans;
    return t === "top" ? s == null ? void 0 : s.getPinnedTopRow(e) : t === "bottom" ? s == null ? void 0 : s.getPinnedBottomRow(e) : i.getRow(e);
  }
  // we use index for rows, but column object for columns, as the next column (by index) might not
  // be visible (header grouping) so it's not reliable, so using the column object instead.
  navigateToNextCell(e, t, s, i) {
    let r = s, n = !1;
    const o = this.beans, { cellNavigation: a, focusSvc: l, gos: c } = o;
    for (; r && (r === s || !this.isValidNavigateCell(r)); )
      c.get("enableRtl") ? t === S.LEFT && (r = this.getLastCellOfColSpan(r)) : t === S.RIGHT && (r = this.getLastCellOfColSpan(r)), r = a.getNextCellToFocus(t, r), n = ee(r);
    if (n && e && e.key === S.UP && (r = {
      rowIndex: -1,
      rowPinned: null,
      column: s.column
    }), i) {
      const h = c.getCallback("navigateToNextCell");
      if (A(h)) {
        const g = h({
          key: t,
          previousCellPosition: s,
          nextCellPosition: r || null,
          event: e
        });
        A(g) ? r = {
          rowPinned: g.rowPinned,
          rowIndex: g.rowIndex,
          column: g.column
        } : r = null;
      }
    }
    if (!r)
      return;
    if (r.rowIndex < 0) {
      const h = Yt(o);
      l.focusHeaderPosition({
        headerPosition: { headerRowIndex: h + r.rowIndex, column: s.column },
        event: e || void 0,
        fromCell: !0
      });
      return;
    }
    const d = this.getNormalisedPosition(r);
    d ? this.focusPosition(d) : this.tryToFocusFullWidthRow(r);
  }
  getNormalisedPosition(e) {
    var i;
    if (!!((i = this.beans.spannedRowRenderer) != null && i.getCellByPosition(e)))
      return e;
    this.ensureCellVisible(e);
    const s = qt(this.beans, e);
    return s ? (e = s.getFocusedCellPosition(), this.ensureCellVisible(e), e) : null;
  }
  tryToFocusFullWidthRow(e, t) {
    const { visibleCols: s, rowRenderer: i, focusSvc: r, eventSvc: n } = this.beans, o = s.allCols, a = i.getRowByPosition(e);
    if (!a || !a.isFullWidth())
      return !1;
    const l = r.getFocusedCell(), c = {
      rowIndex: e.rowIndex,
      rowPinned: e.rowPinned,
      column: e.column || (t ? _(o) : o[0])
    };
    this.focusPosition(c);
    const d = t ?? (l != null && Be(c, l));
    return n.dispatchEvent({
      type: "fullWidthRowFocused",
      rowIndex: c.rowIndex,
      rowPinned: c.rowPinned,
      column: c.column,
      isFullWidthCell: !0,
      fromBelow: d
    }), !0;
  }
  focusPosition(e) {
    const { focusSvc: t, rangeSvc: s } = this.beans;
    t.setFocusedCell({
      rowIndex: e.rowIndex,
      column: e.column,
      rowPinned: e.rowPinned,
      forceBrowserFocus: !0
    }), s == null || s.setRangeToCell(e);
  }
  isValidNavigateCell(e) {
    return !!Ee(this.beans, e);
  }
  getLastCellOfColSpan(e) {
    const t = qt(this.beans, e);
    if (!t)
      return e;
    const s = t.getColSpanningList();
    return s.length === 1 ? e : {
      rowIndex: e.rowIndex,
      column: _(s),
      rowPinned: e.rowPinned
    };
  }
  ensureCellVisible(e) {
    const t = aa(this.gos), s = this.beans.rowModel.getRow(e.rowIndex), i = t && (s == null ? void 0 : s.sticky), { scrollFeature: r } = this.gridBodyCon;
    !i && ee(e.rowPinned) && r.ensureIndexVisible(e.rowIndex), e.column.isPinned() || r.ensureColumnVisible(e.column);
  }
  ensureColumnVisible(e) {
    const t = this.gridBodyCon.scrollFeature;
    e.isPinned() || t.ensureColumnVisible(e);
  }
  ensureRowVisible(e) {
    this.gridBodyCon.scrollFeature.ensureIndexVisible(e);
  }
};
function gl(e) {
  return e.ctrlsSvc.getScrollFeature().getVScrollPosition();
}
var xa = {
  moduleName: "KeyboardNavigation",
  version: B,
  beans: [IT, tT, uE],
  apiFunctions: {
    getFocusedCell: sT,
    clearFocusedCell: iT,
    setFocusedCell: rT,
    setFocusedHeader: aT,
    tabToNextCell: nT,
    tabToPreviousCell: oT
  }
}, LT = class extends R {
  constructor() {
    super(...arguments), this.beanName = "pageBoundsListener";
  }
  postConstruct() {
    this.addManagedEventListeners({
      modelUpdated: this.onModelUpdated.bind(this),
      recalculateRowBounds: this.calculatePages.bind(this)
    }), this.onModelUpdated();
  }
  onModelUpdated(e) {
    this.calculatePages(), this.eventSvc.dispatchEvent({
      type: "paginationChanged",
      animate: (e == null ? void 0 : e.animate) ?? !1,
      newData: (e == null ? void 0 : e.newData) ?? !1,
      newPage: (e == null ? void 0 : e.newPage) ?? !1,
      newPageSize: (e == null ? void 0 : e.newPageSize) ?? !1,
      keepRenderedRows: (e == null ? void 0 : e.keepRenderedRows) ?? !1
    });
  }
  calculatePages() {
    const { pageBounds: e, pagination: t, rowModel: s } = this.beans;
    t ? t.calculatePages() : e.calculateBounds(0, s.getRowCount() - 1);
  }
}, kT = class extends R {
  constructor() {
    super(...arguments), this.beanName = "pageBounds", this.pixelOffset = 0;
  }
  getFirstRow() {
    var e;
    return ((e = this.topRowBounds) == null ? void 0 : e.rowIndex) ?? -1;
  }
  getLastRow() {
    var e;
    return ((e = this.bottomRowBounds) == null ? void 0 : e.rowIndex) ?? -1;
  }
  getCurrentPageHeight() {
    const { topRowBounds: e, bottomRowBounds: t } = this;
    return !e || !t ? 0 : Math.max(t.rowTop + t.rowHeight - e.rowTop, 0);
  }
  getCurrentPagePixelRange() {
    const { topRowBounds: e, bottomRowBounds: t } = this, s = (e == null ? void 0 : e.rowTop) ?? 0, i = t ? t.rowTop + t.rowHeight : 0;
    return { pageFirstPixel: s, pageLastPixel: i };
  }
  calculateBounds(e, t) {
    const { rowModel: s } = this.beans, i = s.getRowBounds(e);
    i && (i.rowIndex = e), this.topRowBounds = i;
    const r = s.getRowBounds(t);
    r && (r.rowIndex = t), this.bottomRowBounds = r, this.calculatePixelOffset();
  }
  getPixelOffset() {
    return this.pixelOffset;
  }
  calculatePixelOffset() {
    var t;
    const e = ((t = this.topRowBounds) == null ? void 0 : t.rowTop) ?? 0;
    this.pixelOffset !== e && (this.pixelOffset = e, this.eventSvc.dispatchEvent({ type: "paginationPixelOffsetChanged" }));
  }
}, GT = (
  /*css*/
  ".ag-pinned-left-floating-bottom,.ag-pinned-left-floating-top,.ag-pinned-right-floating-bottom,.ag-pinned-right-floating-top{min-width:0;overflow:hidden;position:relative}.ag-pinned-left-sticky-top,.ag-pinned-right-sticky-top{height:100%;overflow:hidden;position:relative}.ag-sticky-bottom-full-width-container,.ag-sticky-top-full-width-container{height:100%;overflow:hidden;width:100%}.ag-pinned-left-header,.ag-pinned-right-header{display:inline-block;height:100%;overflow:hidden;position:relative}.ag-body-horizontal-scroll:not(.ag-scrollbar-invisible){.ag-horizontal-left-spacer:not(.ag-scroller-corner){border-right:var(--ag-pinned-column-border)}.ag-horizontal-right-spacer:not(.ag-scroller-corner){border-left:var(--ag-pinned-column-border)}}.ag-pinned-right-header{border-left:var(--ag-pinned-column-border)}.ag-pinned-left-header{border-right:var(--ag-pinned-column-border)}.ag-cell.ag-cell-first-right-pinned:not(.ag-cell-range-left,.ag-cell-range-single-cell,.ag-cell-focus:not(.ag-cell-range-selected):focus-within){border-left:var(--ag-pinned-column-border)}.ag-cell.ag-cell-last-left-pinned:not(.ag-cell-range-right,.ag-cell-range-single-cell,.ag-cell-focus:not(.ag-cell-range-selected):focus-within){border-right:var(--ag-pinned-column-border)}.ag-pinned-left-header .ag-header-cell-resize:after{left:calc(50% - var(--ag-header-column-resize-handle-width))}.ag-pinned-right-header .ag-header-cell-resize:after{left:50%}.ag-pinned-left-header .ag-header-cell-resize{right:-3px}.ag-pinned-right-header .ag-header-cell-resize{left:-3px}"
), OT = class extends R {
  constructor(e, t) {
    super(), this.isLeft = e, this.elements = t, this.getWidth = e ? () => this.beans.pinnedCols.leftWidth : () => this.beans.pinnedCols.rightWidth;
  }
  postConstruct() {
    this.addManagedEventListeners({
      [`${this.isLeft ? "left" : "right"}PinnedWidthChanged`]: this.onPinnedWidthChanged.bind(this)
    });
  }
  onPinnedWidthChanged() {
    const e = this.getWidth(), t = e > 0;
    for (const s of this.elements)
      s && (O(s, t), Ot(s, e));
  }
}, VT = class extends R {
  constructor() {
    super(...arguments), this.beanName = "pinnedCols";
  }
  postConstruct() {
    this.beans.ctrlsSvc.whenReady(this, (t) => {
      this.gridBodyCtrl = t.gridBodyCtrl;
    });
    const e = this.checkContainerWidths.bind(this);
    this.addManagedEventListeners({
      displayedColumnsChanged: e,
      displayedColumnsWidthChanged: e
    }), this.addManagedPropertyListener("domLayout", e);
  }
  checkContainerWidths() {
    const { gos: e, visibleCols: t, eventSvc: s } = this.beans, i = Ie(e, "print"), r = i ? 0 : t.getColsLeftWidth(), n = i ? 0 : t.getDisplayedColumnsRightWidth();
    r != this.leftWidth && (this.leftWidth = r, s.dispatchEvent({ type: "leftPinnedWidthChanged" })), n != this.rightWidth && (this.rightWidth = n, s.dispatchEvent({ type: "rightPinnedWidthChanged" }));
  }
  keepPinnedColumnsNarrowerThanViewport() {
    const e = this.gridBodyCtrl.eBodyViewport, t = hr(e);
    if (t <= 50)
      return;
    const s = this.getPinnedColumnsOverflowingViewport(t - 50), i = this.gos.getCallback("processUnpinnedColumns"), { columns: r, hasLockedPinned: n } = s;
    let o = r;
    !o.length && !n || (i && (o = i({
      columns: o,
      viewportWidth: t
    })), !(!o || !o.length) && (o = o.filter((a) => !Ke(a)), this.setColsPinned(o, null, "viewportSizeFeature")));
  }
  createPinnedWidthFeature(e, ...t) {
    return new OT(e, t);
  }
  setColsPinned(e, t, s) {
    const { colModel: i, colAnimation: r, visibleCols: n, gos: o } = this.beans;
    if (!i.cols || !(e != null && e.length))
      return;
    if (Ie(o, "print")) {
      F(37);
      return;
    }
    r == null || r.start();
    let a;
    t === !0 || t === "left" ? a = "left" : t === "right" ? a = "right" : a = null;
    const l = [];
    e.forEach((c) => {
      if (!c)
        return;
      const d = i.getCol(c);
      d && d.getPinned() !== a && (this.setColPinned(d, a), l.push(d));
    }), l.length && (n.refresh(s), vp(this.eventSvc, l, s)), r == null || r.finish();
  }
  initCol(e) {
    const { pinned: t, initialPinned: s } = e.colDef;
    t !== void 0 ? this.setColPinned(e, t) : this.setColPinned(e, s);
  }
  setColPinned(e, t) {
    t === !0 || t === "left" ? e.pinned = "left" : t === "right" ? e.pinned = "right" : e.pinned = null, e.dispatchStateUpdatedEvent("pinned");
  }
  setupHeaderPinnedWidth(e) {
    const { scrollVisibleSvc: t } = this.beans;
    if (e.pinned == null)
      return;
    const s = e.pinned === "left", i = e.pinned === "right";
    e.hidden = !0;
    const r = () => {
      const n = s ? this.leftWidth : this.rightWidth;
      if (n == null)
        return;
      const o = n == 0, a = e.hidden !== o, l = this.gos.get("enableRtl"), c = t.getScrollbarWidth(), h = t.verticalScrollShowing && (l && s || !l && i) ? n + c : n;
      e.comp.setPinnedContainerWidth(`${h}px`), e.comp.setDisplayed(!o), a && (e.hidden = o, e.refresh());
    };
    e.addManagedEventListeners({
      leftPinnedWidthChanged: r,
      rightPinnedWidthChanged: r,
      scrollVisibilityChanged: r,
      scrollbarWidthChanged: r
    });
  }
  getHeaderResizeDiff(e, t) {
    if (t.getPinned()) {
      const { leftWidth: i, rightWidth: r } = this, n = hr(this.beans.ctrlsSvc.getGridBodyCtrl().eBodyViewport) - 50;
      if (i + r + e > n)
        if (n > i + r)
          e = n - i - r;
        else
          return 0;
    }
    return e;
  }
  getPinnedColumnsOverflowingViewport(e) {
    const t = this.rightWidth ?? 0, s = this.leftWidth ?? 0, i = t + s;
    let r = !1;
    if (i < e)
      return { columns: [], hasLockedPinned: r };
    const { visibleCols: n } = this.beans, o = [...n.leftCols], a = [...n.rightCols];
    let l = 0, c = 0;
    const d = 0, h = [];
    let u = i - d - e;
    for (; (c < o.length || l < a.length) && u > 0; ) {
      if (l < a.length) {
        const g = a[l++];
        if (g.colDef.lockPinned) {
          r = !0;
          continue;
        }
        u -= g.getActualWidth(), h.push(g);
      }
      if (c < o.length && u > 0) {
        const g = o[c++];
        if (g.colDef.lockPinned) {
          r = !0;
          continue;
        }
        u -= g.getActualWidth(), h.push(g);
      }
    }
    return { columns: h, hasLockedPinned: r };
  }
}, BT = {
  moduleName: "PinnedColumn",
  version: B,
  beans: [VT],
  css: [GT]
}, NT = class extends R {
  constructor() {
    super(), this.beanName = "ariaAnnounce", this.descriptionContainer = null, this.pendingAnnouncements = /* @__PURE__ */ new Map(), this.lastAnnouncement = "", this.updateAnnouncement = pe(this, this.updateAnnouncement.bind(this), 200);
  }
  postConstruct() {
    const e = this.beans, t = me(e), s = this.descriptionContainer = t.createElement("div");
    s.classList.add("ag-aria-description-container"), Tg(s, "polite"), dw(s, "additions text"), cw(s, !0), e.eGridDiv.appendChild(s);
  }
  /**
   * @param key used for debouncing calls
   */
  announceValue(e, t) {
    this.pendingAnnouncements.set(t, e), this.updateAnnouncement();
  }
  updateAnnouncement() {
    if (!this.descriptionContainer)
      return;
    const e = Array.from(this.pendingAnnouncements.values()).join(". ");
    this.pendingAnnouncements.clear(), this.descriptionContainer.textContent = "", setTimeout(() => {
      this.handleAnnouncementUpdate(e);
    }, 50);
  }
  handleAnnouncementUpdate(e) {
    if (!this.isAlive() || !this.descriptionContainer)
      return;
    let t = e;
    if (t == null || t.replace(/[ .]/g, "") == "") {
      this.lastAnnouncement = "";
      return;
    }
    this.lastAnnouncement === t && (t = `${t}​`), this.lastAnnouncement = t, this.descriptionContainer.textContent = t;
  }
  destroy() {
    var t;
    super.destroy();
    const { descriptionContainer: e } = this;
    e && (X(e), (t = e.parentElement) == null || t.removeChild(e)), this.descriptionContainer = null, this.pendingAnnouncements.clear();
  }
}, HT = {
  moduleName: "Aria",
  version: B,
  beans: [NT]
}, zT = (
  /*css*/
  ":where(.ag-delay-render){.ag-cell,.ag-header-cell,.ag-header-group-cell,.ag-row,.ag-spanned-cell-wrapper{visibility:hidden}}"
), au = "ag-delay-render", WT = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colDelayRenderSvc", this.hideRequested = !1, this.alreadyRevealed = !1, this.timesRetried = 0, this.requesters = /* @__PURE__ */ new Set();
  }
  hideColumns(e) {
    this.alreadyRevealed || this.requesters.has(e) || (this.requesters.add(e), this.hideRequested || (this.beans.ctrlsSvc.whenReady(this, (t) => {
      t.gridBodyCtrl.eGridBody.classList.add(au);
    }), this.hideRequested = !0));
  }
  revealColumns(e) {
    if (this.alreadyRevealed || !this.isAlive() || (this.requesters.delete(e), this.requesters.size > 0))
      return;
    const { renderStatus: t, ctrlsSvc: s } = this.beans;
    if (t) {
      if (!t.areHeaderCellsRendered() && this.timesRetried < 5) {
        this.timesRetried++, setTimeout(() => this.revealColumns(e));
        return;
      }
      this.timesRetried = 0;
    }
    s.getGridBodyCtrl().eGridBody.classList.remove(au), this.alreadyRevealed = !0;
  }
}, _T = {
  moduleName: "ColumnDelayRender",
  version: B,
  beans: [WT],
  css: [zT]
};
function UT(e) {
  var t;
  (t = e.overlays) == null || t.showLoadingOverlay();
}
function $T(e) {
  var t;
  (t = e.overlays) == null || t.showNoRowsOverlay();
}
function KT(e) {
  var t;
  (t = e.overlays) == null || t.hideOverlay();
}
var jT = (
  /*css*/
  ".ag-overlay{inset:0;pointer-events:none;position:absolute;z-index:2}.ag-overlay-panel,.ag-overlay-wrapper{display:flex;height:100%;width:100%}.ag-overlay-wrapper{align-items:center;flex:none;justify-content:center;text-align:center}.ag-overlay-loading-wrapper{pointer-events:all}.ag-overlay-loading-center{background:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:var(--ag-border-radius);box-shadow:var(--ag-popup-shadow);padding:var(--ag-spacing)}"
), YT = {
  tag: "div",
  cls: "ag-overlay",
  role: "presentation",
  children: [
    {
      tag: "div",
      cls: "ag-overlay-panel",
      role: "presentation",
      children: [{ tag: "div", ref: "eOverlayWrapper", cls: "ag-overlay-wrapper", role: "presentation" }]
    }
  ]
}, nm = class extends D {
  constructor() {
    super(YT), this.eOverlayWrapper = x, this.activePromise = null, this.activeOverlay = null, this.updateListenerDestroyFunc = null, this.activeCssClass = null, this.elToFocusAfter = null, this.registerCSS(jT);
  }
  handleKeyDown(e) {
    if (e.key !== S.TAB || e.defaultPrevented || St(e))
      return;
    const t = this.beans;
    if (ze(t, this.eOverlayWrapper, !1, e.shiftKey))
      return;
    let i = !1;
    e.shiftKey ? i = t.focusSvc.focusGridView({
      column: _(t.visibleCols.allCols),
      backwards: !0,
      canFocusOverlay: !1
    }) : i = rs(t, !1), i && e.preventDefault();
  }
  updateLayoutClasses(e, t) {
    const s = this.eOverlayWrapper.classList, { AUTO_HEIGHT: i, NORMAL: r, PRINT: n } = kt;
    s.toggle(i, t.autoHeight), s.toggle(r, t.normal), s.toggle(n, t.print);
  }
  postConstruct() {
    this.createManagedBean(new ud(this)), this.setDisplayed(!1, { skipAriaHidden: !0 }), this.beans.overlays.setOverlayWrapperComp(this), this.addManagedElementListeners(this.getFocusableElement(), { keydown: this.handleKeyDown.bind(this) });
  }
  setWrapperTypeClass(e) {
    const t = this.eOverlayWrapper.classList;
    this.activeCssClass && t.toggle(this.activeCssClass, !1), this.activeCssClass = e, t.toggle(e, !0);
  }
  showOverlay(e, t, s, i) {
    if (this.setWrapperTypeClass(t), this.destroyActiveOverlay(), this.elToFocusAfter = null, this.activePromise = e, !!e) {
      if (this.setDisplayed(!0, { skipAriaHidden: !0 }), s && this.isGridFocused()) {
        const r = Q(this.beans);
        r && !Jt(this.beans) && (this.elToFocusAfter = r);
      }
      e.then((r) => {
        if (this.activePromise !== e) {
          this.activeOverlay !== r && (this.destroyBean(r), r = null);
          return;
        }
        if (this.activePromise = null, !!r) {
          if (this.activeOverlay !== r && (this.eOverlayWrapper.appendChild(r.getGui()), this.activeOverlay = r, i)) {
            const n = r;
            this.updateListenerDestroyFunc = this.addManagedPropertyListener(i, ({ currentValue: o }) => {
              var a;
              (a = n.refresh) == null || a.call(n, V(this.gos, { ...o ?? {} }));
            });
          }
          s && this.isGridFocused() && ye(this.eOverlayWrapper);
        }
      });
    }
  }
  updateOverlayWrapperPaddingTop(e) {
    this.eOverlayWrapper.style.setProperty("padding-top", `${e}px`);
  }
  destroyActiveOverlay() {
    var i;
    this.activePromise = null;
    const e = this.activeOverlay;
    if (!e)
      return;
    let t = this.elToFocusAfter;
    this.activeOverlay = null, this.elToFocusAfter = null, t && !this.isGridFocused() && (t = null);
    const s = this.updateListenerDestroyFunc;
    s && (s(), this.updateListenerDestroyFunc = null), this.destroyBean(e), X(this.eOverlayWrapper), (i = t == null ? void 0 : t.focus) == null || i.call(t, { preventScroll: !0 });
  }
  hideOverlay() {
    this.destroyActiveOverlay(), this.setDisplayed(!1, { skipAriaHidden: !0 });
  }
  isGridFocused() {
    const e = Q(this.beans);
    return !!e && this.beans.eGridDiv.contains(e);
  }
  destroy() {
    this.elToFocusAfter = null, this.destroyActiveOverlay(), this.beans.overlays.setOverlayWrapperComp(void 0), super.destroy();
  }
}, qT = {
  selector: "AG-OVERLAY-WRAPPER",
  component: nm
}, XT = class extends R {
  constructor() {
    super(...arguments), this.beanName = "overlays", this.state = 0, this.showInitialOverlay = !0, this.wrapperPadding = 0;
  }
  postConstruct() {
    this.isClientSide = te(this.gos), this.isServerSide = !this.isClientSide && Le(this.gos);
    const e = () => this.updateOverlayVisibility();
    this.addManagedEventListeners({
      newColumnsLoaded: e,
      rowDataUpdated: e,
      gridSizeChanged: this.refreshWrapperPadding.bind(this),
      rowCountReady: () => {
        this.showInitialOverlay = !1, this.updateOverlayVisibility();
      }
    }), this.addManagedPropertyListener("loading", e);
  }
  setOverlayWrapperComp(e) {
    this.eWrapper = e, this.updateOverlayVisibility();
  }
  /** Returns true if the overlay is visible. */
  isVisible() {
    return this.state !== 0 && !!this.eWrapper;
  }
  /** Returns true if the overlay is visible and is exclusive (popup over the grid) */
  isExclusive() {
    return this.state === 1 && !!this.eWrapper;
  }
  showLoadingOverlay() {
    this.showInitialOverlay = !1;
    const e = this.gos, t = e.get("loading");
    !t && (t !== void 0 || e.get("suppressLoadingOverlay")) || this.doShowLoadingOverlay();
  }
  showNoRowsOverlay() {
    this.showInitialOverlay = !1;
    const e = this.gos;
    e.get("loading") || e.get("suppressNoRowsOverlay") || this.doShowNoRowsOverlay();
  }
  hideOverlay() {
    if (this.showInitialOverlay = !1, this.gos.get("loading")) {
      F(99);
      return;
    }
    this.doHideOverlay();
  }
  getOverlayWrapperSelector() {
    return qT;
  }
  getOverlayWrapperCompClass() {
    return nm;
  }
  updateOverlayVisibility() {
    if (!this.eWrapper) {
      this.state = 0;
      return;
    }
    const {
      state: e,
      isClientSide: t,
      isServerSide: s,
      beans: { gos: i, colModel: r, rowModel: n }
    } = this;
    let o = this.gos.get("loading");
    o !== void 0 && (this.showInitialOverlay = !1), this.showInitialOverlay && o === void 0 && !i.get("suppressLoadingOverlay") && (o = !i.get("columnDefs") || !r.ready || !i.get("rowData") && t), o ? e !== 1 && this.doShowLoadingOverlay() : (this.showInitialOverlay = !1, t && n.isEmpty() && !i.get("suppressNoRowsOverlay") ? e !== 2 && this.doShowNoRowsOverlay() : (e === 1 || !s && e !== 0) && this.doHideOverlay());
  }
  doShowLoadingOverlay() {
    this.eWrapper && (this.state = 1, this.showOverlay(
      jb(this.beans.userCompFactory, V(this.gos, {})),
      "ag-overlay-loading-wrapper",
      "loadingOverlayComponentParams"
    ), this.updateExclusive());
  }
  doShowNoRowsOverlay() {
    this.eWrapper && (this.state = 2, this.showOverlay(
      Yb(this.beans.userCompFactory, V(this.gos, {})),
      "ag-overlay-no-rows-wrapper",
      "noRowsOverlayComponentParams"
    ), this.updateExclusive());
  }
  doHideOverlay() {
    this.eWrapper && (this.state = 0, this.eWrapper.hideOverlay(), this.updateExclusive());
  }
  showOverlay(e, t, s) {
    var r;
    const i = (e == null ? void 0 : e.newAgStackInstance()) ?? null;
    (r = this.eWrapper) == null || r.showOverlay(i, t, this.isExclusive(), s), this.refreshWrapperPadding();
  }
  updateExclusive() {
    const e = this.exclusive;
    this.exclusive = this.isExclusive(), this.exclusive !== e && this.eventSvc.dispatchEvent({
      type: "overlayExclusiveChanged"
    });
  }
  refreshWrapperPadding() {
    const e = this.eWrapper;
    if (!e)
      return;
    let t = 0;
    if (this.state === 2) {
      const s = this.beans.ctrlsSvc.get("gridHeaderCtrl");
      t = (s == null ? void 0 : s.headerHeight) || 0;
    } else this.wrapperPadding !== 0 && (t = 0);
    this.wrapperPadding !== t && (this.wrapperPadding = t, e.updateOverlayWrapperPaddingTop(t));
  }
}, ZT = {
  moduleName: "Overlay",
  version: B,
  userComponents: {
    agLoadingOverlay: Cx,
    agNoRowsOverlay: wx
  },
  apiFunctions: {
    showLoadingOverlay: UT,
    showNoRowsOverlay: $T,
    hideOverlay: KT
  },
  beans: [XT]
}, QT = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rowContainerHeight", this.scrollY = 0, this.uiBodyHeight = 0;
  }
  postConstruct() {
    this.addManagedEventListeners({ bodyHeightChanged: this.updateOffset.bind(this) }), this.maxDivHeight = Zb(), ei(this.gos, "RowContainerHeightService - maxDivHeight = " + this.maxDivHeight);
  }
  updateOffset() {
    if (!this.stretching)
      return;
    const e = this.beans.ctrlsSvc.getScrollFeature().getVScrollPosition().top, t = this.getUiBodyHeight();
    (e !== this.scrollY || t !== this.uiBodyHeight) && (this.scrollY = e, this.uiBodyHeight = t, this.calculateOffset());
  }
  calculateOffset() {
    this.setUiContainerHeight(this.maxDivHeight), this.pixelsToShave = this.modelHeight - this.uiContainerHeight, this.maxScrollY = this.uiContainerHeight - this.uiBodyHeight;
    const e = this.scrollY / this.maxScrollY, t = e * this.pixelsToShave;
    ei(
      this.gos,
      `RowContainerHeightService - Div Stretch Offset = ${t} (${this.pixelsToShave} * ${e})`
    ), this.setDivStretchOffset(t);
  }
  setUiContainerHeight(e) {
    e !== this.uiContainerHeight && (this.uiContainerHeight = e, this.eventSvc.dispatchEvent({ type: "rowContainerHeightChanged" }));
  }
  clearOffset() {
    this.setUiContainerHeight(this.modelHeight), this.pixelsToShave = 0, this.setDivStretchOffset(0);
  }
  setDivStretchOffset(e) {
    const t = typeof e == "number" ? Math.floor(e) : null;
    this.divStretchOffset !== t && (this.divStretchOffset = t, this.eventSvc.dispatchEvent({ type: "heightScaleChanged" }));
  }
  setModelHeight(e) {
    this.modelHeight = e, this.stretching = e != null && // null happens when in print layout
    this.maxDivHeight > 0 && e > this.maxDivHeight, this.stretching ? this.calculateOffset() : this.clearOffset();
  }
  getRealPixelPosition(e) {
    return e - this.divStretchOffset;
  }
  getUiBodyHeight() {
    const e = this.beans.ctrlsSvc.getScrollFeature().getVScrollPosition();
    return e.bottom - e.top;
  }
  getScrollPositionForPixel(e) {
    if (this.pixelsToShave <= 0)
      return e;
    const t = this.modelHeight - this.getUiBodyHeight(), s = e / t;
    return this.maxScrollY * s;
  }
}, JT = 400, eM = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rowRenderer", this.destroyFuncsForColumnListeners = [], this.rowCtrlsByRowIndex = {}, this.zombieRowCtrls = {}, this.allRowCtrls = [], this.topRowCtrls = [], this.bottomRowCtrls = [], this.refreshInProgress = !1, this.dataFirstRenderedFired = !1, this.setupRangeSelectionListeners = () => {
      const e = () => {
        this.getAllCellCtrls().forEach((n) => n.onCellSelectionChanged());
      }, t = () => {
        this.getAllCellCtrls().forEach((n) => n.updateRangeBordersIfRangeCount());
      }, s = () => {
        this.eventSvc.addListener("cellSelectionChanged", e), this.eventSvc.addListener("columnMoved", t), this.eventSvc.addListener("columnPinned", t), this.eventSvc.addListener("columnVisible", t);
      }, i = () => {
        this.eventSvc.removeListener("cellSelectionChanged", e), this.eventSvc.removeListener("columnMoved", t), this.eventSvc.removeListener("columnPinned", t), this.eventSvc.removeListener("columnVisible", t);
      };
      this.addDestroyFunc(() => i()), this.addManagedPropertyListeners(["enableRangeSelection", "cellSelection"], () => {
        et(this.gos) ? s() : i();
      }), et(this.gos) && s();
    };
  }
  wireBeans(e) {
    this.pageBounds = e.pageBounds, this.colModel = e.colModel, this.pinnedRowModel = e.pinnedRowModel, this.rowModel = e.rowModel, this.focusSvc = e.focusSvc, this.rowContainerHeight = e.rowContainerHeight, this.ctrlsSvc = e.ctrlsSvc, this.editSvc = e.editSvc;
  }
  postConstruct() {
    this.ctrlsSvc.whenReady(this, (e) => {
      this.gridBodyCtrl = e.gridBodyCtrl, this.initialise();
    });
  }
  initialise() {
    this.addManagedEventListeners({
      paginationChanged: this.onPageLoaded.bind(this),
      pinnedRowDataChanged: this.onPinnedRowDataChanged.bind(this),
      pinnedRowsChanged: this.onPinnedRowsChanged.bind(this),
      displayedColumnsChanged: this.onDisplayedColumnsChanged.bind(this),
      bodyScroll: this.onBodyScroll.bind(this),
      bodyHeightChanged: this.redraw.bind(this, {})
    }), this.addManagedPropertyListeners(["domLayout", "embedFullWidthRows"], () => this.onDomLayoutChanged()), this.addManagedPropertyListeners(["suppressMaxRenderedRowRestriction", "rowBuffer"], () => this.redraw()), this.addManagedPropertyListener("suppressCellFocus", (i) => this.onSuppressCellFocusChanged(i.currentValue)), this.addManagedPropertyListeners(
      [
        "groupSuppressBlankHeader",
        "getBusinessKeyForNode",
        "fullWidthCellRenderer",
        "fullWidthCellRendererParams",
        "suppressStickyTotalRow",
        "groupRowRenderer",
        "groupRowRendererParams",
        // maybe only needs to refresh FW rows...
        "loadingCellRenderer",
        "loadingCellRendererParams",
        "detailCellRenderer",
        "detailCellRendererParams",
        "enableRangeSelection",
        "enableCellTextSelection"
      ],
      () => this.redrawRows()
    ), this.addManagedPropertyListener("cellSelection", ({ currentValue: i, previousValue: r }) => {
      (!r && i || r && !i) && this.redrawRows();
    });
    const { stickyRowSvc: e, gos: t, showRowGroupCols: s } = this.beans;
    if (s && this.addManagedPropertyListener("showOpenedGroup", () => {
      const i = s.getShowRowGroupCols();
      i.length && this.refreshCells({ columns: i, force: !0 });
    }), e)
      this.stickyRowFeature = e.createStickyRowFeature(
        this,
        this.createRowCon.bind(this),
        this.destroyRowCtrls.bind(this)
      );
    else {
      const i = this.gridBodyCtrl;
      i.setStickyTopHeight(0), i.setStickyBottomHeight(0);
    }
    this.registerCellEventListeners(), this.initialiseCache(), this.printLayout = Ie(t, "print"), this.embedFullWidthRows = this.printLayout || t.get("embedFullWidthRows"), this.redrawAfterModelUpdate();
  }
  initialiseCache() {
    if (this.gos.get("keepDetailRows")) {
      const e = this.getKeepDetailRowsCount(), t = e ?? 3;
      this.cachedRowCtrls = new tM(t);
    }
  }
  getKeepDetailRowsCount() {
    return this.gos.get("keepDetailRowsCount");
  }
  getStickyTopRowCtrls() {
    var e;
    return ((e = this.stickyRowFeature) == null ? void 0 : e.stickyTopRowCtrls) ?? [];
  }
  getStickyBottomRowCtrls() {
    var e;
    return ((e = this.stickyRowFeature) == null ? void 0 : e.stickyBottomRowCtrls) ?? [];
  }
  updateAllRowCtrls() {
    var i;
    const e = Object.values(this.rowCtrlsByRowIndex), t = Object.values(this.zombieRowCtrls), s = ((i = this.cachedRowCtrls) == null ? void 0 : i.getEntries()) ?? [];
    t.length > 0 || s.length > 0 ? this.allRowCtrls = [...e, ...t, ...s] : this.allRowCtrls = e;
  }
  /**
   * Checks if the cell is rendered or not. Also returns true if row ctrl is present but has not rendered
   * cells yet.
   * @returns true if cellCtrl is present, or if the row is present but has not rendered rows yet
   */
  isCellBeingRendered(e, t) {
    var r;
    const s = this.rowCtrlsByRowIndex[e];
    return !t || !s ? !!s : s.isFullWidth() ? !0 : !!((r = this.beans.spannedRowRenderer) == null ? void 0 : r.getCellByPosition({ rowIndex: e, column: t, rowPinned: null })) || !!s.getCellCtrl(t) || !s.isRowRendered();
  }
  /**
   * Notifies all row and cell controls of any change in focused cell.
   * @param event cell focused event
   */
  updateCellFocus(e) {
    this.getAllCellCtrls().forEach((t) => t.onCellFocused(e)), this.getFullWidthRowCtrls().forEach((t) => t.onFullWidthRowFocused(e));
  }
  /**
   * Called when a new cell is focused in the grid
   * - if the focused cell isn't rendered; re-draw rows to dry to render it
   * - subsequently updates all cell and row controls with the new focused cell
   * @param event cell focused event
   */
  onCellFocusChanged(e) {
    if (e && e.rowIndex != null && !e.rowPinned) {
      const t = this.beans.colModel.getCol(e.column) ?? void 0;
      this.isCellBeingRendered(e.rowIndex, t) || this.redraw();
    }
    this.updateCellFocus(e);
  }
  onSuppressCellFocusChanged(e) {
    this.getAllCellCtrls().forEach((t) => t.onSuppressCellFocusChanged(e)), this.getFullWidthRowCtrls().forEach((t) => t.onSuppressCellFocusChanged(e));
  }
  // in a clean design, each cell would register for each of these events. however when scrolling, all the cells
  // registering and de-registering for events is a performance bottleneck. so we register here once and inform
  // all active cells.
  registerCellEventListeners() {
    this.addManagedEventListeners({
      cellFocused: (e) => this.onCellFocusChanged(e),
      cellFocusCleared: () => this.updateCellFocus(),
      flashCells: (e) => {
        const { cellFlashSvc: t } = this.beans;
        t && this.getAllCellCtrls().forEach((s) => t.onFlashCells(s, e));
      },
      columnHoverChanged: () => {
        this.getAllCellCtrls().forEach((e) => e.onColumnHover());
      },
      displayedColumnsChanged: () => {
        this.getAllCellCtrls().forEach((e) => e.onDisplayedColumnsChanged());
      },
      displayedColumnsWidthChanged: () => {
        this.printLayout && this.getAllCellCtrls().forEach((e) => e.onLeftChanged());
      }
    }), this.setupRangeSelectionListeners(), this.refreshListenersToColumnsForCellComps(), this.addManagedEventListeners({
      gridColumnsChanged: this.refreshListenersToColumnsForCellComps.bind(this)
    }), this.addDestroyFunc(this.removeGridColumnListeners.bind(this));
  }
  // executes all functions in destroyFuncsForColumnListeners and then clears the list
  removeGridColumnListeners() {
    this.destroyFuncsForColumnListeners.forEach((e) => e()), this.destroyFuncsForColumnListeners.length = 0;
  }
  // this function adds listeners onto all the grid columns, which are the column that we could have cellComps for.
  // when the grid columns change, we add listeners again. in an ideal design, each CellComp would just register to
  // the column it belongs to on creation, however this was a bottleneck with the number of cells, so do it here
  // once instead.
  refreshListenersToColumnsForCellComps() {
    this.removeGridColumnListeners(), this.colModel.getCols().forEach((t) => {
      const s = (l) => {
        this.getAllCellCtrls().forEach((c) => {
          c.column === t && l(c);
        });
      }, i = () => {
        s((l) => l.onLeftChanged());
      }, r = () => {
        s((l) => l.onWidthChanged());
      }, n = () => {
        s((l) => l.onFirstRightPinnedChanged());
      }, o = () => {
        s((l) => l.onLastLeftPinnedChanged());
      }, a = () => {
        s((l) => l.onColDefChanged());
      };
      t.__addEventListener("leftChanged", i), t.__addEventListener("widthChanged", r), t.__addEventListener("firstRightPinnedChanged", n), t.__addEventListener("lastLeftPinnedChanged", o), t.__addEventListener("colDefChanged", a), this.destroyFuncsForColumnListeners.push(() => {
        t.__removeEventListener("leftChanged", i), t.__removeEventListener("widthChanged", r), t.__removeEventListener("firstRightPinnedChanged", n), t.__removeEventListener("lastLeftPinnedChanged", o), t.__removeEventListener("colDefChanged", a);
      });
    });
  }
  onDomLayoutChanged() {
    const e = Ie(this.gos, "print"), t = e || this.gos.get("embedFullWidthRows"), s = t !== this.embedFullWidthRows || this.printLayout !== e;
    this.printLayout = e, this.embedFullWidthRows = t, s && this.redrawAfterModelUpdate({ domLayoutChanged: !0 });
  }
  // for row models that have datasources, when we update the datasource, we need to force the rowRenderer
  // to redraw all rows. otherwise the old rows from the old datasource will stay displayed.
  datasourceChanged() {
    this.firstRenderedRow = 0, this.lastRenderedRow = -1;
    const e = Object.keys(this.rowCtrlsByRowIndex);
    this.removeRowCtrls(e);
  }
  onPageLoaded(e) {
    const t = {
      recycleRows: e.keepRenderedRows,
      animate: e.animate,
      newData: e.newData,
      newPage: e.newPage,
      // because this is a model updated event (not pinned rows), we
      // can skip updating the pinned rows. this is needed so that if user
      // is doing transaction updates, the pinned rows are not getting constantly
      // trashed - or editing cells in pinned rows are not refreshed and put into read mode
      onlyBody: !0
    };
    this.redrawAfterModelUpdate(t);
  }
  /**
   * @param column AgColumn
   * @returns An array with HTMLElement for every cell of the column passed as param.
   * If the cell is spanning across multiple columns, it only returns the html element
   * if the column passed is the first column of the span (used for auto width calculation).
   */
  getAllCellsNotSpanningForColumn(e) {
    const t = [];
    return this.getAllRowCtrls().forEach((s) => {
      var r;
      const i = (r = s.getCellCtrl(e, !0)) == null ? void 0 : r.eGui;
      i && t.push(i);
    }), t;
  }
  refreshFloatingRowComps(e = !0) {
    this.refreshFloatingRows(this.topRowCtrls, "top", e), this.refreshFloatingRows(this.bottomRowCtrls, "bottom", e);
  }
  /**
   * Determines which row controllers need to be destroyed and re-created vs which ones can
   * be re-used.
   *
   * This is operation is to pinned/floating rows as `this.recycleRows` is to normal/body rows.
   *
   * All `RowCtrl` instances in `rowCtrls` that don't correspond to `RowNode` instances in `rowNodes` are destroyed.
   * All `RowNode` instances in `rowNodes` that don't correspond to `RowCtrl` instances in `rowCtrls` are created.
   * All instances in `rowCtrls` must be in the same order as their corresponding nodes in `rowNodes`.
   *
   * @param rowCtrls The list of existing row controllers
   * @param rowNodes The canonical list of row nodes that should have associated controllers
   */
  refreshFloatingRows(e, t, s) {
    const { pinnedRowModel: i, beans: r, printLayout: n } = this, o = Object.fromEntries(e.map((l) => [l.rowNode.id, l]));
    i == null || i.forEachPinnedRow(t, (l, c) => {
      const d = e[c];
      d && i.getPinnedRowById(d.rowNode.id, t) === void 0 && (d.destroyFirstPass(), d.destroySecondPass()), l.id in o && s ? (e[c] = o[l.id], delete o[l.id]) : e[c] = new zo(l, r, !1, !1, n);
    });
    const a = (t === "top" ? i == null ? void 0 : i.getPinnedTopRowCount() : i == null ? void 0 : i.getPinnedBottomRowCount()) ?? 0;
    e.length = a;
  }
  onPinnedRowDataChanged() {
    const e = {
      recycleRows: !0
    };
    this.redrawAfterModelUpdate(e);
  }
  onPinnedRowsChanged() {
    this.redrawAfterModelUpdate({ recycleRows: !0 });
  }
  redrawRow(e, t = !1) {
    var s, i;
    if (e.sticky)
      (s = this.stickyRowFeature) == null || s.refreshStickyNode(e);
    else if ((i = this.cachedRowCtrls) != null && i.has(e)) {
      this.cachedRowCtrls.removeRow(e);
      return;
    } else {
      const r = (n) => {
        const o = n[e.rowIndex];
        o && o.rowNode === e && (o.destroyFirstPass(), o.destroySecondPass(), n[e.rowIndex] = this.createRowCon(e, !1, !1));
      };
      switch (e.rowPinned) {
        case "top":
          r(this.topRowCtrls);
          break;
        case "bottom":
          r(this.bottomRowCtrls);
          break;
        default:
          r(this.rowCtrlsByRowIndex), this.updateAllRowCtrls();
      }
    }
    t || this.dispatchDisplayedRowsChanged(!1);
  }
  redrawRows(e) {
    const { editSvc: t } = this.beans;
    if (t != null && t.isEditing() && (t.isBatchEditing() ? t.cleanupEditors() : t.stopEditing(void 0, { source: "api" })), e != null) {
      e == null || e.forEach((i) => this.redrawRow(i, !0)), this.dispatchDisplayedRowsChanged(!1);
      return;
    }
    this.redrawAfterModelUpdate();
  }
  // gets called from:
  // +) initialisation (in registerGridComp) params = null
  // +) onDomLayoutChanged, params = null
  // +) onPageLoaded, recycleRows, animate, newData, newPage from event, onlyBody=true
  // +) onPinnedRowDataChanged, recycleRows = true
  // +) redrawRows (from Grid API), recycleRows = true/false
  redrawAfterModelUpdate(e = {}) {
    var a;
    this.getLockOnRefresh();
    const t = (a = this.beans.focusSvc) == null ? void 0 : a.getFocusCellToUseAfterRefresh();
    this.updateContainerHeights(), this.scrollToTopIfNewData(e);
    const s = !e.domLayoutChanged && !!e.recycleRows, i = e.animate && sr(this.gos), r = s ? this.getRowsToRecycle() : null;
    s || this.removeAllRowComps(), this.workOutFirstAndLastRowsToRender();
    const { stickyRowFeature: n, gos: o } = this;
    if (n) {
      n.checkStickyRows();
      const l = n.extraTopHeight + n.extraBottomHeight;
      l && this.updateContainerHeights(l);
    }
    this.recycleRows(r, i), this.gridBodyCtrl.updateRowCount(), e.onlyBody || this.refreshFloatingRowComps(o.get("enableRowPinning") ? s : void 0), this.dispatchDisplayedRowsChanged(), t != null && this.restoreFocusedCell(t), this.releaseLockOnRefresh();
  }
  scrollToTopIfNewData(e) {
    var i;
    const t = e.newData || e.newPage, s = this.gos.get("suppressScrollOnNewData");
    t && !s && (this.gridBodyCtrl.scrollFeature.scrollToTop(), (i = this.stickyRowFeature) == null || i.resetOffsets());
  }
  updateContainerHeights(e = 0) {
    const { rowContainerHeight: t } = this;
    if (this.printLayout) {
      t.setModelHeight(null);
      return;
    }
    let s = this.pageBounds.getCurrentPageHeight();
    s === 0 && (s = 1), t.setModelHeight(s + e);
  }
  getLockOnRefresh() {
    var e, t;
    if (this.refreshInProgress)
      throw new Error(gt(252));
    this.refreshInProgress = !0, (t = (e = this.beans.frameworkOverrides).getLockOnRefresh) == null || t.call(e);
  }
  releaseLockOnRefresh() {
    var e, t;
    this.refreshInProgress = !1, (t = (e = this.beans.frameworkOverrides).releaseLockOnRefresh) == null || t.call(e);
  }
  isRefreshInProgress() {
    return this.refreshInProgress;
  }
  // sets the focus to the provided cell, if the cell is provided. this way, the user can call refresh without
  // worry about the focus been lost. this is important when the user is using keyboard navigation to do edits
  // and the cellEditor is calling 'refresh' to get other cells to update (as other cells might depend on the
  // edited cell).
  restoreFocusedCell(e) {
    if (!e)
      return;
    const t = this.beans.focusSvc, s = this.findPositionToFocus(e);
    if (!s) {
      t.focusHeaderPosition({
        headerPosition: {
          headerRowIndex: Yt(this.beans) - 1,
          column: e.column
        }
      });
      return;
    }
    if (e.rowIndex !== s.rowIndex || e.rowPinned != s.rowPinned) {
      t.setFocusedCell({
        ...s,
        preventScrollOnBrowserFocus: !0,
        forceBrowserFocus: !0
      });
      return;
    }
    t.doesRowOrCellHaveBrowserFocus() || this.updateCellFocus(
      V(this.gos, {
        ...s,
        forceBrowserFocus: !0,
        preventScrollOnBrowserFocus: !0,
        type: "cellFocused"
      })
    );
  }
  findPositionToFocus(e) {
    const { pagination: t, pageBounds: s } = this.beans;
    let i = e;
    for (i.rowPinned == null && t && s && !t.isRowInPage(i.rowIndex) && (i = { rowPinned: null, rowIndex: s.getFirstRow() }); i; ) {
      if (i.rowPinned == null && s)
        if (i.rowIndex < s.getFirstRow()) {
          if (i = xs(this.beans, { rowPinned: null, rowIndex: 0 }), !i)
            return null;
        } else i.rowIndex > s.getLastRow() && (i = { rowPinned: null, rowIndex: s.getLastRow() });
      const r = this.getRowByPosition(i);
      if (r != null && r.isAlive())
        return { ...r.getRowPosition(), column: e.column };
      i = xs(this.beans, i);
    }
    return null;
  }
  getAllCellCtrls() {
    const e = [], t = this.getAllRowCtrls(), s = t.length;
    for (let i = 0; i < s; i++) {
      const r = t[i].getAllCellCtrls(), n = r.length;
      for (let o = 0; o < n; o++)
        e.push(r[o]);
    }
    return e;
  }
  getAllRowCtrls() {
    const { spannedRowRenderer: e } = this.beans, t = this.getStickyTopRowCtrls(), s = this.getStickyBottomRowCtrls();
    return [
      ...this.topRowCtrls,
      ...this.bottomRowCtrls,
      ...t,
      ...s,
      ...(e == null ? void 0 : e.getCtrls("top")) ?? [],
      ...(e == null ? void 0 : e.getCtrls("bottom")) ?? [],
      ...(e == null ? void 0 : e.getCtrls("center")) ?? [],
      ...Object.values(this.rowCtrlsByRowIndex)
    ];
  }
  addRenderedRowListener(e, t, s) {
    const i = this.rowCtrlsByRowIndex[t];
    i && i.addEventListener(e, s);
  }
  refreshCells({ rowNodes: e, columns: t, force: s, suppressFlash: i } = {}) {
    const r = {
      force: s,
      newData: !1,
      suppressFlash: i
    };
    for (const n of this.getCellCtrls(e, t))
      n.refreshOrDestroyCell(r);
    this.refreshFullWidth(e);
  }
  refreshRows(e = {}) {
    this.getRowCtrls(e.rowNodes).forEach((t) => t.refreshRow(e)), this.refreshFullWidth(e.rowNodes);
  }
  refreshFullWidth(e) {
    if (!e)
      return;
    let t = !1;
    for (const s of this.getRowCtrls(e)) {
      if (!s.isFullWidth())
        continue;
      s.refreshFullWidth() || (t = !0, this.redrawRow(s.rowNode, !0));
    }
    t && this.dispatchDisplayedRowsChanged(!1);
  }
  /**
   * @param rowNodes if provided, returns the RowCtrls for the provided rowNodes. otherwise returns all RowCtrls.
   */
  getRowCtrls(e) {
    const t = dc(e), s = this.getAllRowCtrls();
    return !e || !t ? s : s.filter((i) => {
      const r = i.rowNode;
      return hc(r, t);
    });
  }
  // returns CellCtrl's that match the provided rowNodes and columns. eg if one row node
  // and two columns provided, that identifies 4 cells, so 4 CellCtrl's returned.
  getCellCtrls(e, t) {
    let s;
    A(t) && (s = {}, t.forEach((r) => {
      const n = this.colModel.getCol(r);
      A(n) && (s[n.getId()] = !0);
    }));
    const i = [];
    return this.getRowCtrls(e).forEach((r) => {
      r.getAllCellCtrls().forEach((n) => {
        const o = n.column.getId();
        s && !s[o] || i.push(n);
      });
    }), i;
  }
  destroy() {
    this.removeAllRowComps(!0), super.destroy();
  }
  removeAllRowComps(e = !1) {
    var s;
    const t = Object.keys(this.rowCtrlsByRowIndex);
    this.removeRowCtrls(t, e), (s = this.stickyRowFeature) == null || s.destroyStickyCtrls();
  }
  getRowsToRecycle() {
    const e = [];
    for (const s of Object.keys(this.rowCtrlsByRowIndex))
      this.rowCtrlsByRowIndex[s].rowNode.id == null && e.push(s);
    this.removeRowCtrls(e);
    const t = {};
    for (const s of Object.values(this.rowCtrlsByRowIndex)) {
      const i = s.rowNode;
      t[i.id] = s;
    }
    return this.rowCtrlsByRowIndex = {}, t;
  }
  // takes array of row indexes
  removeRowCtrls(e, t = !1) {
    e.forEach((s) => {
      const i = this.rowCtrlsByRowIndex[s];
      i && (i.destroyFirstPass(t), i.destroySecondPass()), delete this.rowCtrlsByRowIndex[s];
    });
  }
  onBodyScroll(e) {
    e.direction === "vertical" && this.redraw({ afterScroll: !0 });
  }
  // gets called when rows don't change, but viewport does, so after:
  // 1) height of grid body changes, ie number of displayed rows has changed
  // 2) grid scrolled to new position
  // 3) ensure index visible (which is a scroll)
  redraw(e = {}) {
    const { focusSvc: t, animationFrameSvc: s } = this.beans, { afterScroll: i } = e;
    let r;
    const n = this.stickyRowFeature;
    n && (r = (t == null ? void 0 : t.getFocusCellToUseAfterRefresh()) || void 0);
    const o = this.firstRenderedRow, a = this.lastRenderedRow;
    this.workOutFirstAndLastRowsToRender();
    let l = !1;
    if (n) {
      l = n.checkStickyRows();
      const d = n.extraTopHeight + n.extraBottomHeight;
      d && this.updateContainerHeights(d);
    }
    const c = this.firstRenderedRow !== o || this.lastRenderedRow !== a;
    if (!(i && !l && !c) && (this.getLockOnRefresh(), this.recycleRows(null, !1, i), this.releaseLockOnRefresh(), this.dispatchDisplayedRowsChanged(i && !l), r != null)) {
      const d = t == null ? void 0 : t.getFocusCellToUseAfterRefresh();
      r != null && d == null && (s == null || s.flushAllFrames(), this.restoreFocusedCell(r));
    }
  }
  removeRowCompsNotToDraw(e, t) {
    const s = {};
    e.forEach((n) => s[n] = !0);
    const r = Object.keys(this.rowCtrlsByRowIndex).filter((n) => !s[n]);
    this.removeRowCtrls(r, t);
  }
  calculateIndexesToDraw(e) {
    var o, a;
    const t = [];
    for (let l = this.firstRenderedRow; l <= this.lastRenderedRow; l++)
      t.push(l);
    const s = this.beans.pagination, i = (a = (o = this.beans.focusSvc) == null ? void 0 : o.getFocusedCell()) == null ? void 0 : a.rowIndex;
    i != null && (i < this.firstRenderedRow || i > this.lastRenderedRow) && (!s || s.isRowInPage(i)) && i < this.rowModel.getRowCount() && t.push(i);
    const r = (l) => {
      const c = l.rowNode.rowIndex;
      c == null || c === i || (c < this.firstRenderedRow || c > this.lastRenderedRow) && this.doNotUnVirtualiseRow(l) && t.push(c);
    };
    for (const l of Object.values(this.rowCtrlsByRowIndex))
      r(l);
    if (e)
      for (const l of Object.values(e))
        r(l);
    t.sort((l, c) => l - c);
    const n = [];
    for (let l = 0; l < t.length; l++) {
      const c = t[l], d = this.rowModel.getRow(c);
      d && !d.sticky && n.push(c);
    }
    return n;
  }
  recycleRows(e, t = !1, s = !1) {
    const i = this.calculateIndexesToDraw(e);
    if ((this.printLayout || s) && (t = !1), this.removeRowCompsNotToDraw(i, !t), i.forEach((r) => {
      this.createOrUpdateRowCtrl(r, e, t, s);
    }), e) {
      const { animationFrameSvc: r } = this.beans;
      (r == null ? void 0 : r.active) && s && !this.printLayout ? r.addDestroyTask(() => {
        this.destroyRowCtrls(e, t), this.updateAllRowCtrls(), this.dispatchDisplayedRowsChanged();
      }) : this.destroyRowCtrls(e, t);
    }
    this.updateAllRowCtrls();
  }
  dispatchDisplayedRowsChanged(e = !1) {
    this.eventSvc.dispatchEvent({
      type: "displayedRowsChanged",
      afterScroll: e
    });
  }
  onDisplayedColumnsChanged() {
    const { visibleCols: e } = this.beans, t = e.isPinningLeft(), s = e.isPinningRight();
    (this.pinningLeft !== t || s !== this.pinningRight) && (this.pinningLeft = t, this.pinningRight = s, this.embedFullWidthRows && this.redrawFullWidthEmbeddedRows());
  }
  // when embedding, what gets showed in each section depends on what is pinned. eg if embedding group expand / collapse,
  // then it should go into the pinned left area if pinning left, or the center area if not pinning.
  redrawFullWidthEmbeddedRows() {
    const e = [];
    this.getFullWidthRowCtrls().forEach((t) => {
      const s = t.rowNode.rowIndex;
      e.push(s.toString());
    }), this.refreshFloatingRowComps(), this.removeRowCtrls(e), this.redraw({ afterScroll: !0 });
  }
  getFullWidthRowCtrls(e) {
    const t = dc(e);
    return this.getAllRowCtrls().filter((s) => {
      if (!s.isFullWidth())
        return !1;
      const i = s.rowNode;
      return !(t != null && !hc(i, t));
    });
  }
  createOrUpdateRowCtrl(e, t, s, i) {
    let r, n = this.rowCtrlsByRowIndex[e];
    if (n || (r = this.rowModel.getRow(e), A(r) && A(t) && t[r.id] && r.alreadyRendered && (n = t[r.id], t[r.id] = null)), !n)
      if (r || (r = this.rowModel.getRow(e)), A(r))
        n = this.createRowCon(r, s, i);
      else
        return;
    return r && (r.alreadyRendered = !0), this.rowCtrlsByRowIndex[e] = n, n;
  }
  destroyRowCtrls(e, t) {
    const s = [];
    if (e) {
      for (const i of Object.values(e))
        if (i) {
          if (this.cachedRowCtrls && i.isCacheable()) {
            this.cachedRowCtrls.addRow(i);
            continue;
          }
          if (i.destroyFirstPass(!t), t) {
            const r = i.instanceId;
            this.zombieRowCtrls[r] = i, s.push(() => {
              i.destroySecondPass(), delete this.zombieRowCtrls[r];
            });
          } else
            i.destroySecondPass();
        }
    }
    t && (s.push(() => {
      this.isAlive() && (this.updateAllRowCtrls(), this.dispatchDisplayedRowsChanged());
    }), window.setTimeout(() => s.forEach((i) => i()), JT));
  }
  getRowBuffer() {
    return this.gos.get("rowBuffer");
  }
  getRowBufferInPixels() {
    const e = this.getRowBuffer(), t = pt(this.beans);
    return e * t;
  }
  workOutFirstAndLastRowsToRender() {
    const { rowContainerHeight: e, pageBounds: t, rowModel: s } = this;
    e.updateOffset();
    let i, r;
    if (!s.isRowsToRender())
      i = 0, r = -1;
    else if (this.printLayout)
      this.beans.environment.refreshRowHeightVariable(), i = t.getFirstRow(), r = t.getLastRow();
    else {
      const d = this.getRowBufferInPixels(), h = this.ctrlsSvc.getScrollFeature(), u = this.gos.get("suppressRowVirtualisation");
      let g = !1, p, f;
      do {
        const b = t.getPixelOffset(), { pageFirstPixel: y, pageLastPixel: P } = t.getCurrentPagePixelRange(), E = e.divStretchOffset, M = h.getVScrollPosition(), T = M.top, G = M.bottom;
        u ? (p = y + E, f = P + E) : (p = Math.max(T + b - d, y) + E, f = Math.min(G + b + d, P) + E), this.firstVisibleVPixel = Math.max(T + b, y) + E, this.lastVisibleVPixel = Math.min(G + b, P) + E, g = this.ensureAllRowsInRangeHaveHeightsCalculated(p, f);
      } while (g);
      let m = s.getRowIndexAtPixel(p), C = s.getRowIndexAtPixel(f);
      const v = t.getFirstRow(), w = t.getLastRow();
      m < v && (m = v), C > w && (C = w), i = m, r = C;
    }
    const n = Ie(this.gos, "normal"), o = this.gos.get("suppressMaxRenderedRowRestriction"), a = Math.max(this.getRowBuffer(), 500);
    n && !o && r - i > a && (r = i + a);
    const l = i !== this.firstRenderedRow, c = r !== this.lastRenderedRow;
    (l || c) && (this.firstRenderedRow = i, this.lastRenderedRow = r, this.eventSvc.dispatchEvent({
      type: "viewportChanged",
      firstRow: i,
      lastRow: r
    }));
  }
  /**
   * This event will only be fired once, and is queued until after the browser next renders.
   * This allows us to fire an event during the start of the render cycle, when we first see data being rendered
   * but not execute the event until all of the data has finished being rendered to the dom.
   */
  dispatchFirstDataRenderedEvent() {
    this.dataFirstRenderedFired || (this.dataFirstRenderedFired = !0, xt(this.beans, () => {
      this.beans.eventSvc.dispatchEvent({
        type: "firstDataRendered",
        firstRow: this.firstRenderedRow,
        lastRow: this.lastRenderedRow
      });
    }));
  }
  ensureAllRowsInRangeHaveHeightsCalculated(e, t) {
    var a, l;
    const s = (a = this.pinnedRowModel) == null ? void 0 : a.ensureRowHeightsValid(), i = (l = this.stickyRowFeature) == null ? void 0 : l.ensureRowHeightsValid(), { pageBounds: r, rowModel: n } = this, o = n.ensureRowHeightsValid(
      e,
      t,
      r.getFirstRow(),
      r.getLastRow()
    );
    return (o || i) && this.eventSvc.dispatchEvent({
      type: "recalculateRowBounds"
    }), i || o || s ? (this.updateContainerHeights(), !0) : !1;
  }
  // check that none of the rows to remove are editing or focused as:
  // a) if editing, we want to keep them, otherwise the user will loose the context of the edit,
  //    eg user starts editing, enters some text, then scrolls down and then up, next time row rendered
  //    the edit is reset - so we want to keep it rendered.
  // b) if focused, we want ot keep keyboard focus, so if user ctrl+c, it goes to clipboard,
  //    otherwise the user can range select and drag (with focus cell going out of the viewport)
  //    and then ctrl+c, nothing will happen if cell is removed from dom.
  // c) if detail record of master detail, as users complained that the context of detail rows
  //    was getting lost when detail row out of view. eg user expands to show detail row,
  //    then manipulates the detail panel (eg sorts the detail grid), then context is lost
  //    after detail panel is scrolled out of / into view.
  doNotUnVirtualiseRow(e) {
    var c;
    const i = e.rowNode, r = this.focusSvc.isRowFocused(i.rowIndex, i.rowPinned), n = (c = this.editSvc) == null ? void 0 : c.isEditing(e), o = i.detail;
    return r || n || o ? !!this.isRowPresent(i) : !1;
  }
  isRowPresent(e) {
    var t;
    return this.rowModel.isRowPresent(e) ? ((t = this.beans.pagination) == null ? void 0 : t.isRowInPage(e.rowIndex)) ?? !0 : !1;
  }
  createRowCon(e, t, s) {
    var o, a;
    const i = ((o = this.cachedRowCtrls) == null ? void 0 : o.getRow(e)) ?? null;
    if (i)
      return i;
    const r = s && !this.printLayout && !!((a = this.beans.animationFrameSvc) != null && a.active);
    return new zo(e, this.beans, t, r, this.printLayout);
  }
  getRenderedNodes() {
    const e = Object.values(this.rowCtrlsByRowIndex).map((i) => i.rowNode), t = this.getStickyTopRowCtrls().map((i) => i.rowNode), s = this.getStickyBottomRowCtrls().map((i) => i.rowNode);
    return [...t, ...e, ...s];
  }
  getRowByPosition(e) {
    let t;
    const { rowIndex: s } = e;
    switch (e.rowPinned) {
      case "top":
        t = this.topRowCtrls[s];
        break;
      case "bottom":
        t = this.bottomRowCtrls[s];
        break;
      default:
        t = this.rowCtrlsByRowIndex[s], t || (t = this.getStickyTopRowCtrls().find((i) => i.rowNode.rowIndex === s) || null, t || (t = this.getStickyBottomRowCtrls().find((i) => i.rowNode.rowIndex === s) || null));
        break;
    }
    return t;
  }
  // returns true if any row between startIndex and endIndex is rendered. used by
  // SSRM or IRM, as they don't want to purge visible blocks from cache.
  isRangeInRenderedViewport(e, t) {
    if (e == null || t == null)
      return !1;
    const i = e > this.lastRenderedRow;
    return !(t < this.firstRenderedRow) && !i;
  }
}, tM = class {
  constructor(e) {
    this.entriesMap = {}, this.entriesList = [], this.maxCount = e;
  }
  addRow(e) {
    if (this.entriesMap[e.rowNode.id] = e, this.entriesList.push(e), e.setCached(!0), this.entriesList.length > this.maxCount) {
      const t = this.entriesList[0];
      t.destroyFirstPass(), t.destroySecondPass(), this.removeFromCache(t);
    }
  }
  getRow(e) {
    if (e == null || e.id == null)
      return null;
    const t = this.entriesMap[e.id];
    return t ? (this.removeFromCache(t), t.setCached(!1), t.rowNode != e ? null : t) : null;
  }
  has(e) {
    return this.entriesMap[e.id] != null;
  }
  removeRow(e) {
    const t = e.id, s = this.entriesMap[t];
    delete this.entriesMap[t], be(this.entriesList, s);
  }
  removeFromCache(e) {
    const t = e.rowNode.id;
    delete this.entriesMap[t], be(this.entriesList, e);
  }
  getEntries() {
    return this.entriesList;
  }
};
function dc(e) {
  if (!e)
    return;
  const t = {
    top: {},
    bottom: {},
    normal: {}
  };
  return e.forEach((s) => {
    const i = s.id;
    switch (s.rowPinned) {
      case "top":
        t.top[i] = s;
        break;
      case "bottom":
        t.bottom[i] = s;
        break;
      default:
        t.normal[i] = s;
        break;
    }
  }), t;
}
function hc(e, t) {
  const s = e.id;
  switch (e.rowPinned) {
    case "top":
      return t.top[s] != null;
    case "bottom":
      return t.bottom[s] != null;
    default:
      return t.normal[s] != null;
  }
}
var sM = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rowNodeSorter";
  }
  postConstruct() {
    const { gos: e } = this;
    this.isAccentedSort = e.get("accentedSort"), this.primaryColumnsSortGroups = Gt(e), this.addManagedPropertyListener(
      "accentedSort",
      (t) => this.isAccentedSort = t.currentValue
    ), this.addManagedPropertyListener(
      "autoGroupColumnDef",
      () => this.primaryColumnsSortGroups = Gt(e)
    );
  }
  doFullSort(e, t) {
    const s = e.map((i, r) => ({
      currentPos: r,
      rowNode: i
    }));
    return s.sort(this.compareRowNodes.bind(this, t)), s.map((i) => i.rowNode);
  }
  compareRowNodes(e, t, s) {
    const i = t.rowNode, r = s.rowNode;
    for (let n = 0, o = e.length; n < o; n++) {
      const a = e[n], l = a.sort === "desc", c = this.getValue(i, a.column), d = this.getValue(r, a.column);
      let h;
      const u = this.getComparator(a, i);
      if (u ? h = u(c, d, i, r, l) : h = vo(c, d, this.isAccentedSort), !isNaN(h) && h !== 0)
        return a.sort === "asc" ? h : h * -1;
    }
    return t.currentPos - s.currentPos;
  }
  getComparator(e, t) {
    const s = e.column, i = s.getColDef().comparator;
    if (i != null)
      return i;
    if (!s.getColDef().showRowGroup)
      return;
    const r = !t.group && s.getColDef().field;
    if (!r)
      return;
    const n = this.beans.colModel.getColDefCol(r);
    if (n)
      return n.getColDef().comparator;
  }
  getValue(e, t) {
    var a, l;
    const { valueSvc: s, colModel: i, showRowGroupCols: r, gos: n } = this.beans;
    if (!this.primaryColumnsSortGroups)
      return s.getValue(t, e, !1);
    if (e.rowGroupColumn === t) {
      if (Uc(n, i.isPivotActive())) {
        const h = (a = e.allLeafChildren) == null ? void 0 : a[0];
        return h ? s.getValue(t, h, !1) : void 0;
      }
      const d = r == null ? void 0 : r.getShowRowGroupCol(t.getId());
      return d ? (l = e.groupData) == null ? void 0 : l[d.getId()] : void 0;
    }
    if (!(e.group && t.getColDef().showRowGroup))
      return s.getValue(t, e, !1);
  }
};
function iM(e) {
  var t;
  (t = e.sortSvc) == null || t.onSortChanged("api");
}
var Dd = {
  moduleName: "Sort",
  version: B,
  beans: [yE, sM],
  apiFunctions: {
    onSortChanged: iM
  },
  userComponents: {
    agSortIndicator: Pd
  },
  icons: {
    // show on column header when column is sorted ascending
    sortAscending: "asc",
    // show on column header when column is sorted descending
    sortDescending: "desc",
    // show on column header when column has no sort, only when enabled with gridOptions.unSortIcon=true
    sortUnSort: "none"
  }
}, rM = class extends R {
  constructor() {
    super(...arguments), this.beanName = "syncSvc", this.waitingForColumns = !1;
  }
  postConstruct() {
    this.addManagedPropertyListener("columnDefs", (e) => this.setColumnDefs(e));
  }
  start() {
    this.beans.ctrlsSvc.whenReady(this, () => {
      const e = this.gos.get("columnDefs");
      e ? this.setColumnsAndData(e) : this.waitingForColumns = !0, this.gridReady();
    });
  }
  setColumnsAndData(e) {
    const { colModel: t, rowModel: s } = this.beans;
    t.setColumnDefs(e ?? [], "gridInitializing"), s.start();
  }
  gridReady() {
    const { eventSvc: e, gos: t } = this;
    e.dispatchEvent({
      type: "gridReady"
    }), ei(t, `initialised successfully, enterprise = ${t.isModuleRegistered("EnterpriseCore")}`);
  }
  setColumnDefs(e) {
    const t = this.gos.get("columnDefs");
    if (t) {
      if (this.waitingForColumns) {
        this.waitingForColumns = !1, this.setColumnsAndData(t);
        return;
      }
      this.beans.colModel.setColumnDefs(t, qs(e.source));
    }
  }
};
function nM(e) {
  var t;
  (t = e.valueCache) == null || t.expire();
}
function oM(e, t) {
  const { colKey: s, rowNode: i, useFormatter: r } = t, n = e.colModel.getColDefCol(s) ?? e.colModel.getCol(s);
  if (ee(n))
    return null;
  const o = e.valueSvc.getValueForDisplay(n, i, r);
  return r ? o.valueFormatted ?? Nt(o.value) : o.value;
}
var aM = "paste", lM = class extends R {
  constructor() {
    super(...arguments), this.beanName = "changeDetectionSvc", this.clientSideRowModel = null;
  }
  postConstruct() {
    const { gos: e, rowModel: t } = this.beans;
    te(e) && (this.clientSideRowModel = t), this.addManagedEventListeners({ cellValueChanged: this.onCellValueChanged.bind(this) });
  }
  onCellValueChanged(e) {
    const { gos: t, rowRenderer: s } = this.beans;
    if (e.source === aM || t.get("suppressChangeDetection"))
      return;
    const i = e.node, r = [i], n = this.clientSideRowModel, o = n == null ? void 0 : n.rootNode;
    if (o && !i.isRowPinned()) {
      const a = t.get("aggregateOnlyChangedColumns"), l = new Di(a, o);
      l.addParentNode(i.parent, [e.column]), n.doAggregate(l), l.forEachChangedNodeDepthFirst((c) => {
        r.push(c), c.sibling && r.push(c.sibling);
      });
    }
    s.refreshCells({ rowNodes: r });
  }
}, cM = class extends R {
  constructor() {
    super(...arguments), this.beanName = "expressionSvc", this.cache = {};
  }
  evaluate(e, t) {
    if (typeof e == "string")
      return this.evaluateExpression(e, t);
    j(15, { expression: e });
  }
  evaluateExpression(e, t) {
    try {
      return this.createExpressionFunction(e)(
        t.value,
        t.context,
        t.oldValue,
        t.newValue,
        t.value,
        t.node,
        t.data,
        t.colDef,
        t.rowIndex,
        t.api,
        t.getValue,
        t.column,
        t.columnGroup
      );
    } catch (s) {
      return j(16, { expression: e, params: t, e: s }), null;
    }
  }
  createExpressionFunction(e) {
    const t = this.cache;
    if (t[e])
      return t[e];
    const s = this.createFunctionBody(e), i = new Function(
      "x, ctx, oldValue, newValue, value, node, data, colDef, rowIndex, api, getValue, column, columnGroup",
      s
    );
    return t[e] = i, i;
  }
  createFunctionBody(e) {
    return e.indexOf("return") >= 0 ? e : "return " + e + ";";
  }
}, dM = class extends R {
  constructor() {
    super(...arguments), this.beanName = "valueCache", this.cacheVersion = 0;
  }
  postConstruct() {
    const e = this.gos;
    this.active = e.get("valueCache"), this.neverExpires = e.get("valueCacheNeverExpires");
  }
  onDataChanged() {
    this.neverExpires || this.expire();
  }
  expire() {
    this.cacheVersion++;
  }
  setValue(e, t, s) {
    if (this.active) {
      const i = this.cacheVersion;
      e.__cacheVersion !== i && (e.__cacheVersion = i, e.__cacheData = {}), e.__cacheData[t] = s;
    }
  }
  getValue(e, t) {
    if (!(!this.active || e.__cacheVersion !== this.cacheVersion))
      return e.__cacheData[t];
  }
}, hM = {
  moduleName: "ValueCache",
  version: B,
  beans: [dM],
  apiFunctions: {
    expireValueCache: nM
  }
}, uM = {
  moduleName: "Expression",
  version: B,
  beans: [cM]
}, gM = {
  moduleName: "ChangeDetection",
  version: B,
  beans: [lM]
}, pM = {
  moduleName: "CellApi",
  version: B,
  apiFunctions: {
    getCellValue: oM
  }
}, fM = class extends R {
  constructor() {
    super(...arguments), this.beanName = "valueSvc", this.hasEditSvc = !1, this.initialised = !1, this.isSsrm = !1;
  }
  wireBeans(e) {
    this.expressionSvc = e.expressionSvc, this.colModel = e.colModel, this.valueCache = e.valueCache, this.dataTypeSvc = e.dataTypeSvc, this.editSvc = e.editSvc, this.hasEditSvc = !!e.editSvc;
  }
  postConstruct() {
    this.initialised || this.init();
  }
  init() {
    this.executeValueGetter = this.valueCache ? this.executeValueGetterWithValueCache.bind(this) : this.executeValueGetterWithoutValueCache.bind(this), this.isSsrm = Le(this.gos), this.cellExpressions = this.gos.get("enableCellExpressions"), this.isTreeData = this.gos.get("treeData"), this.initialised = !0;
    const e = (t) => this.callColumnCellValueChangedHandler(t);
    this.eventSvc.addListener("cellValueChanged", e, !0), this.addDestroyFunc(() => this.eventSvc.removeListener("cellValueChanged", e, !0)), this.addManagedPropertyListener("treeData", (t) => this.isTreeData = t.currentValue);
  }
  /**
   * Use this function to get a displayable cell value.
   * The values from this function are not used for sorting, filtering, or aggregation purposes.
   * Handles: groupHideOpenParents, showOpenedGroup and groupSuppressBlankHeader behaviours
   */
  getValueForDisplay(e, t, s = !1, i = !1, r = "ui") {
    const { showRowGroupColValueSvc: n } = this.beans, o = !e && t.group, a = e == null ? void 0 : e.colDef.showRowGroup, l = !this.isTreeData || t.footer;
    if (n && l && (o || a)) {
      const f = n.getGroupValue(t, e);
      if (f == null)
        return {
          value: null,
          valueFormatted: null
        };
      if (!s)
        return {
          value: f.value,
          valueFormatted: null
        };
      const m = n.formatAndPrefixGroupColValue(f, e, i);
      return {
        value: f.value,
        valueFormatted: m
      };
    }
    if (!e)
      return {
        value: t.key,
        valueFormatted: null
      };
    const c = t.leafGroup && this.colModel.isPivotMode(), d = t.group && t.expanded && !t.footer && !c, h = this.gos.get("groupSuppressBlankHeader") || !t.sibling, u = d && !h, g = this.getValue(e, t, u, r), p = s && !(i && e.colDef.useValueFormatterForExport === !1);
    return {
      value: g,
      valueFormatted: p ? this.formatValue(e, t, g) : null
    };
  }
  getValue(e, t, s = !1, i = "ui") {
    var f;
    if (this.initialised || this.init(), !t)
      return;
    const r = e.getColDef(), n = r.field, o = e.getColId(), a = t.data;
    if (this.hasEditSvc && i === "ui") {
      const m = this.editSvc;
      if (m.isEditing()) {
        const C = m.getCellDataValue({ rowNode: t, column: e }, !0);
        if (C !== void 0)
          return C;
      }
    }
    let l;
    const c = r.showRowGroup;
    if (typeof c == "string" && (((f = this.beans.rowGroupColsSvc) == null ? void 0 : f.getColumnIndex(c)) ?? -1) > t.level)
      return null;
    const d = typeof c != "string" || !t.group, h = t.groupData && o in t.groupData, u = !s && t.aggData && t.aggData[o] !== void 0, g = this.isSsrm && s && !!r.aggFunc, p = this.isSsrm && t.footer && t.field && (r.showRowGroup === !0 || r.showRowGroup === t.field);
    if (this.isTreeData && u)
      l = t.aggData[o];
    else if (this.isTreeData && r.valueGetter)
      l = this.executeValueGetter(r.valueGetter, a, e, t);
    else if (this.isTreeData && n && a)
      l = Kr(a, n, e.isFieldContainsDots());
    else if (h)
      l = t.groupData[o];
    else if (u)
      l = t.aggData[o];
    else if (r.valueGetter && !g) {
      if (!d)
        return l;
      l = this.executeValueGetter(r.valueGetter, a, e, t);
    } else if (p)
      l = Kr(a, t.field, e.isFieldContainsDots());
    else if (n && a && !g) {
      if (!d)
        return l;
      l = Kr(a, n, e.isFieldContainsDots());
    }
    if (this.cellExpressions && typeof l == "string" && l.indexOf("=") === 0) {
      const m = l.substring(1);
      l = this.executeValueGetter(m, a, e, t);
    }
    return l;
  }
  parseValue(e, t, s, i) {
    var o;
    const r = e.getColDef(), n = r.valueParser;
    if (A(n)) {
      const a = V(this.gos, {
        node: t,
        data: t == null ? void 0 : t.data,
        oldValue: i,
        newValue: s,
        colDef: r,
        column: e
      });
      return typeof n == "function" ? n(a) : (o = this.expressionSvc) == null ? void 0 : o.evaluate(n, a);
    }
    return s;
  }
  getDeleteValue(e, t) {
    return A(e.getColDef().valueParser) ? this.parseValue(e, t, "", this.getValueForDisplay(e, t).value) ?? null : null;
  }
  formatValue(e, t, s, i, r = !0) {
    const { expressionSvc: n } = this.beans;
    let o = null, a;
    const l = e.getColDef();
    if (i ? a = i : r && (a = l.valueFormatter), a) {
      const c = t ? t.data : null, d = V(this.gos, {
        value: s,
        node: t,
        data: c,
        colDef: l,
        column: e
      });
      typeof a == "function" ? o = a(d) : o = n ? n.evaluate(a, d) : null;
    } else if (l.refData)
      return l.refData[s] || "";
    return o == null && Array.isArray(s) && (o = s.join(", ")), o;
  }
  /**
   * Sets the value of a GridCell
   * @param rowNode The `RowNode` to be updated
   * @param colKey The `Column` to be updated
   * @param newValue The new value to be set
   * @param eventSource The event source
   * @returns `True` if the value has been updated, otherwise`False`.
   */
  setValue(e, t, s, i) {
    var d, h;
    const r = this.colModel.getColDefCol(t);
    if (!e || !r)
      return !1;
    ee(e.data) && (e.data = {});
    const { field: n, valueSetter: o } = r.getColDef();
    if (ee(n) && ee(o))
      return F(17), !1;
    if (this.dataTypeSvc && !this.dataTypeSvc.checkType(r, s))
      return F(135), !1;
    const a = V(this.gos, {
      node: e,
      data: e.data,
      oldValue: this.getValue(r, e, void 0, i),
      newValue: s,
      colDef: r.getColDef(),
      column: r
    });
    a.newValue = s;
    let l;
    if (A(o) ? typeof o == "function" ? l = o(a) : l = (d = this.expressionSvc) == null ? void 0 : d.evaluate(o, a) : l = this.setValueUsingField(e.data, n, s, r.isFieldContainsDots()), l === void 0 && (l = !0), !l)
      return !1;
    e.resetQuickFilterAggregateText(), (h = this.valueCache) == null || h.onDataChanged();
    const c = this.getValue(r, e);
    return this.dispatchCellValueChangedEvent(e, a, c, i), e.pinnedSibling && this.dispatchCellValueChangedEvent(e.pinnedSibling, a, c, i), !0;
  }
  dispatchCellValueChangedEvent(e, t, s, i) {
    this.eventSvc.dispatchEvent({
      type: "cellValueChanged",
      event: null,
      rowIndex: e.rowIndex,
      rowPinned: e.rowPinned,
      column: t.column,
      colDef: t.colDef,
      data: e.data,
      node: e,
      oldValue: t.oldValue,
      newValue: s,
      value: s,
      source: i
    });
  }
  callColumnCellValueChangedHandler(e) {
    const t = e.colDef.onCellValueChanged;
    typeof t == "function" && this.beans.frameworkOverrides.wrapOutgoing(() => {
      t({
        node: e.node,
        data: e.data,
        oldValue: e.oldValue,
        newValue: e.newValue,
        colDef: e.colDef,
        column: e.column,
        api: e.api,
        context: e.context
      });
    });
  }
  setValueUsingField(e, t, s, i) {
    if (!t)
      return !1;
    let r = !1;
    if (!i)
      r = e[t] === s, r || (e[t] = s);
    else {
      const n = t.split(".");
      let o = e;
      for (; n.length > 0 && o; ) {
        const a = n.shift();
        n.length === 0 ? (r = o[a] === s, r || (o[a] = s)) : o = o[a];
      }
    }
    return !r;
  }
  executeValueGetterWithValueCache(e, t, s, i) {
    const r = s.getColId(), n = this.valueCache.getValue(i, r);
    if (n !== void 0)
      return n;
    const o = this.executeValueGetterWithoutValueCache(e, t, s, i);
    return this.valueCache.setValue(i, r, o), o;
  }
  executeValueGetterWithoutValueCache(e, t, s, i) {
    var o;
    const r = V(this.gos, {
      data: t,
      node: i,
      column: s,
      colDef: s.getColDef(),
      getValue: this.getValueCallback.bind(this, i)
    });
    let n;
    return typeof e == "function" ? n = e(r) : n = (o = this.expressionSvc) == null ? void 0 : o.evaluate(e, r), n;
  }
  getValueCallback(e, t) {
    const s = this.colModel.getColDefCol(t);
    return s ? this.getValue(s, e) : null;
  }
  // used by row grouping and pivot, to get key for a row. col can be a pivot col or a row grouping col
  getKeyForNode(e, t) {
    const s = this.getValue(e, t), i = e.getColDef().keyCreator;
    let r = s;
    if (i) {
      const n = V(this.gos, {
        value: s,
        colDef: e.getColDef(),
        column: e,
        node: t,
        data: t.data
      });
      r = i(n);
    }
    return typeof r == "string" || r == null || (r = String(r), r === "[object Object]" && F(121)), r;
  }
}, mM = {
  moduleName: "CommunityCore",
  version: B,
  beans: [
    CE,
    lF,
    gP,
    Cb,
    QT,
    PR,
    hE,
    zE,
    ub,
    kT,
    LT,
    eM,
    fM,
    fE,
    dE,
    mE,
    fP,
    rM,
    lP,
    cP,
    QE
  ],
  icons: {
    // icon on select dropdowns (select cell editor, charts tool panels)
    selectOpen: "small-down",
    /** @deprecated v33 */
    smallDown: "small-down",
    /** @deprecated v33 */
    colorPicker: "color-picker",
    /** @deprecated v33 */
    smallUp: "small-up",
    /** @deprecated v33 */
    checkboxChecked: "small-up",
    /** @deprecated v33 */
    checkboxIndeterminate: "checkbox-indeterminate",
    /** @deprecated v33 */
    checkboxUnchecked: "checkbox-unchecked",
    /** @deprecated v33 */
    radioButtonOn: "radio-button-on",
    /** @deprecated v33 */
    radioButtonOff: "radio-button-off",
    /** @deprecated v33 */
    smallLeft: "small-left",
    /** @deprecated v33 */
    smallRight: "small-right"
  },
  apiFunctions: {
    getGridId: cF,
    destroy: dF,
    isDestroyed: hF,
    getGridOption: uF,
    setGridOption: gF,
    updateGridOptions: Df,
    isModuleRegistered: pF
  },
  dependsOn: [
    nP,
    xd,
    hR,
    Dd,
    YE,
    Bf,
    qE,
    ZT,
    gM,
    ZE,
    xa,
    BT,
    HT,
    eT,
    uP,
    oP,
    uM,
    AR,
    _T
  ]
}, om = {
  AdvancedFilter: 1,
  AllEnterprise: 1,
  BatchEdit: 1,
  CellSelection: 1,
  Clipboard: 1,
  ColumnMenu: 1,
  ColumnsToolPanel: 1,
  ContextMenu: 1,
  ExcelExport: 1,
  FiltersToolPanel: 1,
  Find: 1,
  GridCharts: 1,
  IntegratedCharts: 1,
  GroupFilter: 1,
  MasterDetail: 1,
  Menu: 1,
  MultiFilter: 1,
  NewFiltersToolPanel: 1,
  Pivot: 1,
  RangeSelection: 1,
  RichSelect: 1,
  RowNumbers: 1,
  RowGrouping: 1,
  RowGroupingPanel: 1,
  ServerSideRowModelApi: 1,
  ServerSideRowModel: 1,
  SetFilter: 1,
  SideBar: 1,
  Sparklines: 1,
  StatusBar: 1,
  TreeData: 1,
  ViewportRowModel: 1
}, pl = [
  "TextFilter",
  "NumberFilter",
  "DateFilter",
  "SetFilter",
  "MultiFilter",
  "GroupFilter",
  "CustomFilter"
], CM = {
  EditCore: [
    "TextEditor",
    "NumberEditor",
    "DateEditor",
    "CheckboxEditor",
    "LargeTextEditor",
    "SelectEditor",
    "RichSelect",
    "CustomEditor"
  ],
  CheckboxCellRenderer: ["AllCommunity"],
  ClientSideRowModelHierarchy: ["RowGrouping", "Pivot", "TreeData"],
  ColumnFilter: pl,
  ColumnGroupHeaderComp: ["AllCommunity"],
  ColumnGroup: ["AllCommunity"],
  ColumnHeaderComp: ["AllCommunity"],
  ColumnMove: ["AllCommunity"],
  ColumnResize: ["AllCommunity"],
  CommunityCore: ["AllCommunity"],
  CsrmSsrmSharedApi: ["ClientSideRowModelApi", "ServerSideRowModelApi"],
  RowModelSharedApi: ["ClientSideRowModelApi", "ServerSideRowModelApi"],
  EnterpriseCore: ["AllEnterprise"],
  FilterCore: [...pl, "QuickFilter", "ExternalFilter", "AdvancedFilter"],
  GroupCellRenderer: ["RowGrouping", "Pivot", "TreeData", "MasterDetail", "ServerSideRowModel"],
  KeyboardNavigation: ["AllCommunity"],
  LoadingCellRenderer: ["ServerSideRowModel"],
  MenuCore: ["ColumnMenu", "ContextMenu"],
  MenuItem: ["ColumnMenu", "ContextMenu", "MultiFilter", "IntegratedCharts", "ColumnsToolPanel"],
  Overlay: ["AllCommunity"],
  PinnedColumn: ["AllCommunity"],
  SharedAggregation: ["RowGrouping", "Pivot", "TreeData", "ServerSideRowModel"],
  SharedDragAndDrop: ["AllCommunity"],
  SharedMasterDetail: ["MasterDetail", "ServerSideRowModel"],
  SharedMenu: [...pl, "ColumnMenu", "ContextMenu"],
  SharedPivot: ["Pivot", "ServerSideRowModel"],
  SharedRowGrouping: ["RowGrouping", "ServerSideRowModel"],
  SharedRowSelection: ["RowSelection", "ServerSideRowModel"],
  SkeletonCellRenderer: ["ServerSideRowModel"],
  Sort: ["AllCommunity"],
  SsrmInfiniteSharedApi: ["InfiniteRowModel", "ServerSideRowModelApi"],
  SharedTreeData: ["TreeData", "ServerSideRowModel"]
}, vM = {
  InfiniteRowModel: "infinite",
  ClientSideRowModelApi: "clientSide",
  ClientSideRowModel: "clientSide",
  ServerSideRowModelApi: "serverSide",
  ServerSideRowModel: "serverSide",
  ViewportRowModel: "viewport"
};
function wM(e, t) {
  const s = [];
  return (Array.isArray(e) ? e : [e]).forEach((i) => {
    const r = CM[i];
    r ? r.forEach((n) => {
      const o = vM[n];
      (!o || o === t) && s.push(n);
    }) : s.push(i);
  }), s;
}
var am = () => `No AG Grid modules are registered! It is recommended to start with all Community features via the AllCommunityModule:
                    
    import { ModuleRegistry, AllCommunityModule } from 'ag-grid-community';
    
    ModuleRegistry.registerModules([ AllCommunityModule ]);
    `, bM = (e) => {
  const t = e.map(
    (i) => `import { ${jr(i)} } from '${om[i] ? "ag-grid-enterprise" : "ag-grid-community"}';`
  );
  return e.some((i) => i === "IntegratedCharts" || i === "Sparklines") && t.push("import { AgChartsEnterpriseModule } from 'ag-charts-enterprise';"), `import { ModuleRegistry } from 'ag-grid-community'; 
${t.join(` 
`)} 

ModuleRegistry.registerModules([ ${e.map((i) => jr(i, !0)).join(", ")} ]); 

For more info see: ${tr}/modules/`;
};
function jr(e, t = !1) {
  return t && (e === "IntegratedCharts" || e === "Sparklines") ? `${e}Module.with(AgChartsEnterpriseModule)` : `${e}Module`;
}
function yM(e, t) {
  const s = t.filter((n) => n === "IntegratedCharts" || n === "Sparklines");
  let i = "";
  return !(globalThis == null ? void 0 : globalThis.agCharts) && s.length > 0 ? i = `Unable to use ${e} as either the ag-charts-community or ag-charts-enterprise script needs to be included alongside ag-grid-enterprise.
` : t.some((n) => om[n]) && (i = i + `Unable to use ${e} as that requires the ag-grid-enterprise script to be included.
`), i;
}
function lm({
  moduleName: e,
  rowModelType: t
}) {
  return `To use the ${e}Module you must set the gridOption "rowModelType='${t}'"`;
}
var lu = ({
  reasonOrId: e,
  moduleName: t,
  gridScoped: s,
  gridId: i,
  rowModelType: r,
  additionalText: n,
  isUmd: o
}) => {
  const a = wM(t, r), l = typeof e == "string" ? e : RM[e];
  if (o)
    return yM(l, a);
  const c = a.filter((u) => u === "IntegratedCharts" || u === "Sparklines"), d = c.length > 0 ? `${c.map((u) => jr(u)).join()} must be initialised with an AG Charts module. One of 'AgChartsCommunityModule' / 'AgChartsEnterpriseModule'.` : "";
  return `${`Unable to use ${l} as ${a.length > 1 ? "one of " + a.map((u) => jr(u)).join(", ") : jr(a[0])} is not registered${s ? " for gridId: " + i : ""}. ${d} Check if you have registered the module:
`}
${bM(a)}` + (n ? ` 

${n}` : "");
}, cu = (e) => `${e} must be initialised with an AG Charts module. One of 'AgChartsCommunityModule' / 'AgChartsEnterpriseModule'.

import { AgChartsEnterpriseModule } from 'ag-charts-enterprise';
import { ModuleRegistry } from 'ag-grid-community';
import { ${e} } from 'ag-grid-enterprise';
    
ModuleRegistry.registerModules([${e}.with(AgChartsEnterpriseModule)]);
    `, SM = (e) => `AG Grid: Unable to use the Clipboard API (navigator.clipboard.${e}()). The reason why it could not be used has been logged in the previous line. For this reason the grid has defaulted to using a workaround which doesn't perform as well. Either fix why Clipboard API is blocked, OR stop this message from appearing by setting grid property suppressClipboardApi=true (which will default the grid to using the workaround rather than the API.`, xM = {
  1: () => "`rowData` must be an array",
  2: ({ nodeId: e }) => `Duplicate node id '${e}' detected from getRowId callback, this could cause issues in your grid.`,
  3: () => "Calling gridApi.resetRowHeights() makes no sense when using Auto Row Height.",
  4: ({ id: e }) => `Could not find row id=${e}, data item was not found for this id`,
  5: ({ data: e }) => [
    "Could not find data item as object was not found.",
    e,
    " Consider using getRowId to help the Grid find matching row data"
  ],
  6: () => "'groupHideOpenParents' only works when specifying specific columns for 'colDef.showRowGroup'",
  7: () => "Pivoting is not supported with aligned grids as it may produce different columns in each grid.",
  8: ({ key: e }) => `Unknown key for navigation ${e}`,
  9: ({ variable: e }) => `No value for ${e == null ? void 0 : e.cssName}. This usually means that the grid has been initialised before styles have been loaded. The default value of ${e == null ? void 0 : e.defaultValue} will be used and updated when styles load.`,
  10: ({ eventType: e }) => `As of v33, the '${e}' event is deprecated. Use the global 'modelUpdated' event to determine when row children have changed.`,
  11: () => "No gridOptions provided to createGrid",
  12: ({ colKey: e }) => ["column ", e, " not found"],
  13: () => "Could not find rowIndex, this means tasks are being executed on a rowNode that has been removed from the grid.",
  14: ({ groupPrefix: e }) => `Row IDs cannot start with ${e}, this is a reserved prefix for AG Grid's row grouping feature.`,
  15: ({ expression: e }) => ["value should be either a string or a function", e],
  16: ({ expression: e, params: t, e: s }) => [
    "Processing of the expression failed",
    "Expression = ",
    e,
    "Params = ",
    t,
    "Exception = ",
    s
  ],
  17: () => "you need either field or valueSetter set on colDef for editing to work",
  18: () => "alignedGrids contains an undefined option.",
  19: () => "alignedGrids - No api found on the linked grid.",
  20: () => `You may want to configure via a callback to avoid setup race conditions:
                     "alignedGrids: () => [linkedGrid]"`,
  21: () => "pivoting is not supported with aligned grids. You can only use one of these features at a time in a grid.",
  22: ({ key: e }) => `${e} is an initial property and cannot be updated.`,
  23: () => "The return of `getRowHeight` cannot be zero. If the intention is to hide rows, use a filter instead.",
  24: () => "row height must be a number if not using standard row model",
  25: ({ id: e }) => ["The getRowId callback must return a string. The ID ", e, " is being cast to a string."],
  26: ({ fnName: e, preDestroyLink: t }) => `Grid API function ${e}() cannot be called as the grid has been destroyed.
 Either clear local references to the grid api, when it is destroyed, or check gridApi.isDestroyed() to avoid calling methods against a destroyed grid.
 To run logic when the grid is about to be destroyed use the gridPreDestroy event. See: ${t}`,
  27: ({ fnName: e, module: t }) => `API function '${e}' not registered to module '${t}'`,
  28: () => "setRowCount cannot be used while using row grouping.",
  29: () => "tried to call sizeColumnsToFit() but the grid is coming back with zero width, maybe the grid is not visible yet on the screen?",
  30: ({ toIndex: e }) => [
    "tried to insert columns in invalid location, toIndex = ",
    e,
    "remember that you should not count the moving columns when calculating the new index"
  ],
  31: () => "infinite loop in resizeColumnSets",
  32: () => "applyColumnState() - the state attribute should be an array, however an array was not found. Please provide an array of items (one for each col you want to change) for state.",
  33: () => "stateItem.aggFunc must be a string. if using your own aggregation functions, register the functions first before using them in get/set state. This is because it is intended for the column state to be stored and retrieved as simple JSON.",
  34: ({ key: e }) => `the column type '${e}' is a default column type and cannot be overridden.`,
  35: () => "Column type definitions 'columnTypes' with a 'type' attribute are not supported because a column type cannot refer to another column type. Only column definitions 'columnDefs' can use the 'type' attribute to refer to a column type.",
  36: ({ t: e }) => "colDef.type '" + e + "' does not correspond to defined gridOptions.columnTypes",
  37: () => "Changing the column pinning status is not allowed with domLayout='print'",
  38: ({ iconName: e }) => `provided icon '${e}' needs to be a string or a function`,
  39: () => "Applying column order broke a group where columns should be married together. Applying new order has been discarded.",
  40: ({ e, method: t }) => `${e}
${SM(t)}`,
  41: () => "Browser did not allow document.execCommand('copy'). Ensure 'api.copySelectedRowsToClipboard() is invoked via a user event, i.e. button click, otherwise the browser will prevent it for security reasons.",
  42: () => "Browser does not support document.execCommand('copy') for clipboard operations",
  43: ({ iconName: e }) => `As of v33, icon '${e}' is deprecated. Use the icon CSS name instead.`,
  44: () => 'Data type definition hierarchies (via the "extendsDataType" property) cannot contain circular references.',
  45: ({ parentCellDataType: e }) => `The data type definition ${e} does not exist.`,
  46: () => 'The "baseDataType" property of a data type definition must match that of its parent.',
  47: ({ cellDataType: e }) => `Missing data type definition - "${e}"`,
  48: ({ property: e }) => `Cell data type is "object" but no Value ${e} has been provided. Please either provide an object data type definition with a Value ${e}, or set "colDef.value${e}"`,
  49: ({ methodName: e }) => `Framework component is missing the method ${e}()`,
  50: ({ compName: e }) => `Could not find component ${e}, did you forget to configure this component?`,
  51: () => "Export cancelled. Export is not allowed as per your configuration.",
  52: () => "There is no `window` associated with the current `document`",
  53: () => "unknown value type during csv conversion",
  54: () => "Could not find document body, it is needed for drag and drop and context menu.",
  55: () => "addRowDropZone - A container target needs to be provided",
  56: () => "addRowDropZone - target already exists in the list of DropZones. Use `removeRowDropZone` before adding it again.",
  57: () => "unable to show popup filter, filter instantiation failed",
  58: () => "no values found for select cellEditor",
  59: () => "cannot select pinned rows",
  60: () => "cannot select node until it has finished loading",
  61: () => "since version v32.2.0, rowNode.isFullWidthCell() has been deprecated. Instead check `rowNode.detail` followed by the user provided `isFullWidthRow` grid option.",
  62: ({ colId: e }) => `setFilterModel() - no column found for colId: ${e}`,
  63: ({ colId: e }) => `setFilterModel() - unable to fully apply model, filtering disabled for colId: ${e}`,
  64: ({ colId: e }) => `setFilterModel() - unable to fully apply model, unable to create filter for colId: ${e}`,
  65: () => "filter missing setModel method, which is needed for setFilterModel",
  66: () => "filter API missing getModel method, which is needed for getFilterModel",
  67: () => "Filter is missing isFilterActive() method",
  68: () => "Column Filter API methods have been disabled as Advanced Filters are enabled.",
  69: ({ guiFromFilter: e }) => `getGui method from filter returned ${e}; it should be a DOM element.`,
  70: ({ newFilter: e }) => `Grid option quickFilterText only supports string inputs, received: ${typeof e}`,
  71: () => "debounceMs is ignored when apply button is present",
  72: ({ keys: e }) => ["ignoring FilterOptionDef as it doesn't contain one of ", e],
  73: () => "invalid FilterOptionDef supplied as it doesn't contain a 'displayKey'",
  74: () => "no filter options for filter",
  75: () => "Unknown button type specified",
  76: ({ filterModelType: e }) => [
    'Unexpected type of filter "',
    e,
    '", it looks like the filter was configured with incorrect Filter Options'
  ],
  77: () => "Filter model is missing 'conditions'",
  78: () => 'Filter Model contains more conditions than "filterParams.maxNumConditions". Additional conditions have been ignored.',
  79: () => '"filterParams.maxNumConditions" must be greater than or equal to zero.',
  80: () => '"filterParams.numAlwaysVisibleConditions" must be greater than or equal to zero.',
  81: () => '"filterParams.numAlwaysVisibleConditions" cannot be greater than "filterParams.maxNumConditions".',
  82: ({ param: e }) => `DateFilter ${e} is not a number`,
  83: () => "DateFilter minValidYear should be <= maxValidYear",
  84: () => "DateFilter minValidDate should be <= maxValidDate",
  85: () => "DateFilter should not have both minValidDate and minValidYear parameters set at the same time! minValidYear will be ignored.",
  86: () => "DateFilter should not have both maxValidDate and maxValidYear parameters set at the same time! maxValidYear will be ignored.",
  87: () => "DateFilter parameter minValidDate should always be lower than or equal to parameter maxValidDate.",
  88: ({ index: e }) => `Invalid row index for ensureIndexVisible: ${e}`,
  89: () => "A template was provided for Header Group Comp - templates are only supported for Header Comps (not groups)",
  90: () => "datasource is missing getRows method",
  91: () => "Filter is missing method doesFilterPass",
  92: () => "AnimationFrameService called but animation frames are off",
  93: () => "cannot add multiple ranges when `cellSelection.suppressMultiRanges = true`",
  94: ({
    paginationPageSizeOption: e,
    pageSizeSet: t,
    pageSizesSet: s,
    pageSizeOptions: i
  }) => `'paginationPageSize=${e}'${t ? "" : " (default value)"}, but ${e} is not included in${s ? "" : " the default"} paginationPageSizeSelector=[${i == null ? void 0 : i.join(", ")}].`,
  95: ({
    paginationPageSizeOption: e,
    paginationPageSizeSelector: t
  }) => `Either set '${t}' to an array that includes ${e} or to 'false' to disable the page size selector.`,
  96: ({ id: e, data: t }) => [
    "Duplicate ID",
    e,
    "found for pinned row with data",
    t,
    "When `getRowId` is defined, it must return unique IDs for all pinned rows. Use the `rowPinned` parameter."
  ],
  97: ({ colId: e }) => `cellEditor for column ${e} is missing getGui() method`,
  98: () => "popup cellEditor does not work with fullRowEdit - you cannot use them both - either turn off fullRowEdit, or stop using popup editors.",
  99: () => "Since v32, `api.hideOverlay()` does not hide the loading overlay when `loading=true`. Set `loading=false` instead.",
  // 100: ({ rowModelType }: { rowModelType: RowModelType }) =>
  //     `selectAll only available when rowModelType='clientSide', ie not ${rowModelType}` as const,
  101: ({
    propertyName: e,
    componentName: t,
    agGridDefaults: s,
    jsComps: i
  }) => {
    const r = [], n = [
      // Don't include the old names / internals in potential suggestions
      ...Object.keys(s ?? []).filter(
        (a) => !["agCellEditor", "agGroupRowRenderer", "agSortIndicator"].includes(a)
      ),
      ...Object.keys(i ?? []).filter((a) => !!i[a])
    ], o = on({
      inputValue: t,
      allSuggestions: n,
      hideIrrelevant: !0,
      filterByPercentageOfBestMatch: 0.8
    }).values;
    return r.push(
      `Could not find '${t}' component. It was configured as "${e}: '${t}'" but it wasn't found in the list of registered components.
`
    ), o.length > 0 && r.push(`         Did you mean: [${o.slice(0, 3)}]?
`), r.push("If using a custom component check it has been registered correctly."), r;
  },
  102: () => "selectAll: 'filtered' only works when gridOptions.rowModelType='clientSide'",
  103: () => "Invalid selection state. When using client-side row model, the state must conform to `string[]`.",
  104: ({ value: e, param: t }) => `Numeric value ${e} passed to ${t} param will be interpreted as ${e} seconds. If this is intentional use "${e}s" to silence this warning.`,
  105: ({ e }) => ["chart rendering failed", e],
  106: () => `Theming API and Legacy Themes are both used in the same page. A Theming API theme has been provided to the 'theme' grid option, but the file (ag-grid.css) is also included and will cause styling issues. Remove ag-grid.css from the page. See the migration guide: ${tr}/theming-migration/`,
  107: ({ key: e, value: t }) => `Invalid value for theme param ${e} - ${t}`,
  108: ({ e }) => ["chart update failed", e],
  109: ({ inputValue: e, allSuggestions: t }) => {
    const s = on({
      inputValue: e,
      allSuggestions: t,
      hideIrrelevant: !0,
      filterByPercentageOfBestMatch: 0.8
    }).values;
    return [
      `Could not find '${e}' aggregate function. It was configured as "aggFunc: '${e}'" but it wasn't found in the list of registered aggregations.`,
      s.length > 0 ? `         Did you mean: [${s.slice(0, 3)}]?` : "",
      "If using a custom aggregation function check it has been registered correctly."
    ].join(`
`);
  },
  110: () => "groupHideOpenParents only works when specifying specific columns for colDef.showRowGroup",
  111: () => "Invalid selection state. When `groupSelects` is enabled, the state must conform to `IServerSideGroupSelectionState`.",
  113: () => "Set Filter cannot initialise because you are using a row model that does not contain all rows in the browser. Either use a different filter type, or configure Set Filter such that you provide it with values",
  114: ({ component: e }) => `Could not find component with name of ${e}. Is it in Vue.components?`,
  // 115: () => 'The provided selection state should be an object.' as const,
  116: () => "Invalid selection state. The state must conform to `IServerSideSelectionState`.",
  117: () => "selectAll must be of boolean type.",
  118: () => "Infinite scrolling must be enabled in order to set the row count.",
  119: () => "Unable to instantiate filter",
  120: () => "MultiFloatingFilterComp expects MultiFilter as its parent",
  121: () => "a column you are grouping or pivoting by has objects as values. If you want to group by complex objects then either a) use a colDef.keyCreator (see AG Grid docs) or b) to toString() on the object to return a key",
  122: () => "could not find the document, document is empty",
  123: () => "Advanced Filter is only supported with the Client-Side Row Model or Server-Side Row Model.",
  124: () => "No active charts to update.",
  125: ({ chartId: e }) => `Unable to update chart. No active chart found with ID: ${e}.`,
  126: () => "unable to restore chart as no chart model is provided",
  127: ({ allRange: e }) => `unable to create chart as ${e ? "there are no columns in the grid" : "no range is selected"}.`,
  128: ({ feature: e }) => `${e} is only available if using 'multiRow' selection mode.`,
  129: ({ feature: e, rowModel: t }) => `${e} is only available if using 'clientSide' or 'serverSide' rowModelType, you are using ${t}.`,
  130: () => 'cannot multi select unless selection mode is "multiRow"',
  // 131: () => 'cannot range select while selecting multiple rows' as const,
  132: () => "Row selection features are not available unless `rowSelection` is enabled.",
  133: ({ iconName: e }) => `icon '${e}' function should return back a string or a dom object`,
  134: ({ iconName: e }) => `Did not find icon '${e}'`,
  135: () => "Data type of the new value does not match the cell data type of the column",
  136: () => "Unable to update chart as the 'type' is missing. It must be either 'rangeChartUpdate', 'pivotChartUpdate', or 'crossFilterChartUpdate'.",
  137: ({ type: e, currentChartType: t }) => `Unable to update chart as a '${e}' update type is not permitted on a ${t}.`,
  138: ({ chartType: e }) => `invalid chart type supplied: ${e}`,
  139: ({ customThemeName: e }) => `a custom chart theme with the name ${e} has been supplied but not added to the 'chartThemes' list`,
  140: ({ name: e }) => `no stock theme exists with the name '${e}' and no custom chart theme with that name was supplied to 'customChartThemes'`,
  141: () => "cross filtering with row grouping is not supported.",
  142: () => "cross filtering is only supported in the client side row model.",
  143: ({ panel: e }) => `'${e}' is not a valid Chart Tool Panel name`,
  144: ({ type: e }) => `Invalid charts data panel group name supplied: '${e}'`,
  145: ({ group: e }) => `As of v32, only one charts customize panel group can be expanded at a time. '${e}' will not be expanded.`,
  146: ({ comp: e }) => `Unable to instantiate component '${e}' as its module hasn't been loaded. Add 'ValidationModule' to see which module is required.`,
  147: ({ group: e }) => `Invalid charts customize panel group name supplied: '${e}'`,
  148: ({ group: e }) => `invalid chartGroupsDef config '${e}'`,
  149: ({ group: e, chartType: t }) => `invalid chartGroupsDef config '${e}.${t}'`,
  150: () => "'seriesChartTypes' are required when the 'customCombo' chart type is specified.",
  151: ({ chartType: e }) => `invalid chartType '${e}' supplied in 'seriesChartTypes', converting to 'line' instead.`,
  152: ({ colId: e }) => `no 'seriesChartType' found for colId = '${e}', defaulting to 'line'.`,
  153: ({ chartDataType: e }) => `unexpected chartDataType value '${e}' supplied, instead use 'category', 'series' or 'excluded'`,
  154: ({ colId: e }) => `cross filtering requires a 'agSetColumnFilter' or 'agMultiColumnFilter' to be defined on the column with id: ${e}`,
  155: ({ option: e }) => `'${e}' is not a valid Chart Toolbar Option`,
  156: ({ panel: e }) => `Invalid panel in chartToolPanelsDef.panels: '${e}'`,
  157: ({ unrecognisedGroupIds: e }) => ["unable to find group(s) for supplied groupIds:", e],
  158: () => "can not expand a column item that does not represent a column group header",
  159: () => "Invalid params supplied to createExcelFileForExcel() - `ExcelExportParams.data` is empty.",
  160: () => "Export cancelled. Export is not allowed as per your configuration.",
  161: () => "The Excel Exporter is currently on Multi Sheet mode. End that operation by calling 'api.getMultipleSheetAsExcel()' or 'api.exportMultipleSheetsAsExcel()'",
  162: ({ id: e, dataType: t }) => `Unrecognized data type for excel export [${e}.dataType=${t}]`,
  163: ({ featureName: e }) => `Excel table export does not work with ${e}. The exported Excel file will not contain any Excel tables.
 Please turn off ${e} to enable Excel table exports.`,
  164: () => "Unable to add data table to Excel sheet: A table already exists.",
  165: () => "Unable to add data table to Excel sheet: Missing required parameters.",
  166: ({ unrecognisedGroupIds: e }) => ["unable to find groups for these supplied groupIds:", e],
  167: ({ unrecognisedColIds: e }) => ["unable to find columns for these supplied colIds:", e],
  168: () => "detailCellRendererParams.template should be function or string",
  169: () => 'Reference to eDetailGrid was missing from the details template. Please add data-ref="eDetailGrid" to the template.',
  170: ({ providedStrategy: e }) => `invalid cellRendererParams.refreshStrategy = ${e} supplied, defaulting to refreshStrategy = 'rows'.`,
  171: () => "could not find detail grid options for master detail, please set gridOptions.detailCellRendererParams.detailGridOptions",
  172: () => "could not find getDetailRowData for master / detail, please set gridOptions.detailCellRendererParams.getDetailRowData",
  173: ({ group: e }) => `invalid chartGroupsDef config '${e}'`,
  174: ({ group: e, chartType: t }) => `invalid chartGroupsDef config '${e}.${t}'`,
  175: ({ menuTabName: e, itemsToConsider: t }) => [
    `Trying to render an invalid menu item '${e}'. Check that your 'menuTabs' contains one of `,
    t
  ],
  176: ({ key: e }) => `unknown menu item type ${e}`,
  177: () => "valid values for cellSelection.handle.direction are 'x', 'y' and 'xy'. Default to 'xy'.",
  178: ({ colId: e }) => `column ${e} is not visible`,
  179: () => "totalValueGetter should be either a function or a string (expression)",
  180: () => "agRichSelectCellEditor requires cellEditorParams.values to be set",
  181: () => "agRichSelectCellEditor cannot have `multiSelect` and `allowTyping` set to `true`. AllowTyping has been turned off.",
  182: () => 'you cannot mix groupDisplayType = "multipleColumns" with treeData, only one column can be used to display groups when doing tree data',
  183: () => "Group Column Filter only works on group columns. Please use a different filter.",
  184: ({ parentGroupData: e, childNodeData: t }) => ["duplicate group keys for row data, keys should be unique", [e, t]],
  185: ({ data: e }) => ["getDataPath() should not return an empty path", [e]],
  186: ({
    rowId: e,
    rowData: t,
    duplicateRowsData: s
  }) => [
    "duplicate group keys for row data, keys should be unique",
    e,
    t,
    ...s ?? []
  ],
  187: ({ rowId: e, firstData: t, secondData: s }) => [
    `Duplicate node id ${e}. Row IDs are provided via the getRowId() callback. Please modify the getRowId() callback code to provide unique row id values.`,
    "first instance",
    t,
    "second instance",
    s
  ],
  188: (e) => `getRowId callback must be provided for Server Side Row Model ${(e == null ? void 0 : e.feature) || "selection"} to work correctly.`,
  189: ({ startRow: e }) => `invalid value ${e} for startRow, the value should be >= 0`,
  190: ({ rowGroupId: e, data: t }) => [
    "null and undefined values are not allowed for server side row model keys",
    e ? `column = ${e}` : "",
    "data is ",
    t
  ],
  // 191: () => `cannot multi select unless selection mode is 'multiRow'` as const,
  // 192: () => `cannot use range selection when multi selecting rows` as const,
  // 193: () => "cannot multi select unless selection mode is 'multiRow'" as const,
  194: ({ method: e }) => `calling gridApi.${e}() is only possible when using rowModelType=\`clientSide\`.`,
  195: ({ justCurrentPage: e }) => `selecting just ${e ? "current page" : "filtered"} only works when gridOptions.rowModelType='clientSide'`,
  196: ({ key: e }) => `Provided ids must be of string type. Invalid id provided: ${e}`,
  197: () => "`toggledNodes` must be an array of string ids.",
  // 198: () => `cannot multi select unless selection mode is 'multiRow'` as const,
  199: () => "getSelectedNodes and getSelectedRows functions cannot be used with select all functionality with the server-side row model. Use `api.getServerSideSelectionState()` instead.",
  200: lu,
  201: ({ rowModelType: e }) => `Could not find row model for rowModelType = ${e}`,
  202: () => "`getSelectedNodes` and `getSelectedRows` functions cannot be used with `groupSelectsChildren` and the server-side row model. Use `api.getServerSideSelectionState()` instead.",
  203: () => "Server Side Row Model does not support Dynamic Row Height and Cache Purging. Either a) remove getRowHeight() callback or b) remove maxBlocksInCache property. Purging has been disabled.",
  204: () => "Server Side Row Model does not support Auto Row Height and Cache Purging. Either a) remove colDef.autoHeight or b) remove maxBlocksInCache property. Purging has been disabled.",
  205: ({ duplicateIdText: e }) => `Unable to display rows as duplicate row ids (${e}) were returned by the getRowId callback. Please modify the getRowId callback to provide unique ids.`,
  206: () => "getRowId callback must be implemented for transactions to work. Transaction was ignored.",
  207: () => 'The Set Filter Parameter "defaultToNothingSelected" value was ignored because it does not work when "excelMode" is used.',
  208: () => "Set Filter Value Formatter must return string values. Please ensure the Set Filter Value Formatter returns string values for complex objects.",
  209: () => `Set Filter Key Creator is returning null for provided values and provided values are primitives. Please provide complex objects. See ${tr}/filter-set-filter-list/#filter-value-types`,
  210: () => "Set Filter has a Key Creator, but provided values are primitives. Did you mean to provide complex objects?",
  211: () => "property treeList=true for Set Filter params, but you did not provide a treeListPathGetter or values of type Date.",
  212: () => "please review all your toolPanel components, it seems like at least one of them doesn't have an id",
  213: () => "Advanced Filter does not work with Filters Tool Panel. Filters Tool Panel has been disabled.",
  214: ({ key: e }) => `unable to lookup Tool Panel as invalid key supplied: ${e}`,
  215: ({ key: e, defaultByKey: t }) => `the key ${e} is not a valid key for specifying a tool panel, valid keys are: ${Object.keys(t ?? {}).join(",")}`,
  216: ({ name: e }) => `Missing component for '${e}'`,
  217: ({ invalidColIds: e }) => ["unable to find grid columns for the supplied colDef(s):", e],
  218: ({ property: e, defaultOffset: t }) => `${e} must be a number, the value you provided is not a valid number. Using the default of ${t}px.`,
  219: ({ property: e }) => `Property ${e} does not exist on the target object.`,
  220: ({ lineDash: e }) => `'${e}' is not a valid 'lineDash' option.`,
  221: () => "agAggregationComponent should only be used with the client and server side row model.",
  222: () => "agFilteredRowCountComponent should only be used with the client side row model.",
  223: () => "agSelectedRowCountComponent should only be used with the client and server side row model.",
  224: () => "agTotalAndFilteredRowCountComponent should only be used with the client side row model.",
  225: () => "agTotalRowCountComponent should only be used with the client side row model.",
  226: () => "viewport is missing init method.",
  227: () => "menu item icon must be DOM node or string",
  228: ({ menuItemOrString: e }) => `unrecognised menu item ${e}`,
  229: ({ index: e }) => ["invalid row index for ensureIndexVisible: ", e],
  230: () => "detailCellRendererParams.template is not supported by AG Grid React. To change the template, provide a Custom Detail Cell Renderer. See https://www.ag-grid.com/react-data-grid/master-detail-custom-detail/",
  // @deprecated v32 mark for removal as part of v32 deprecated features
  231: () => "As of v32, using custom components with `reactiveCustomComponents = false` is deprecated.",
  232: () => "Using both rowData and v-model. rowData will be ignored.",
  233: ({ methodName: e }) => `Framework component is missing the method ${e}()`,
  234: () => 'Group Column Filter does not work with the colDef property "field". This property will be ignored.',
  235: () => 'Group Column Filter does not work with the colDef property "filterValueGetter". This property will be ignored.',
  236: () => 'Group Column Filter does not work with the colDef property "filterParams". This property will be ignored.',
  237: () => "Group Column Filter does not work with Tree Data enabled. Please disable Tree Data, or use a different filter.",
  238: () => "setRowCount can only accept a positive row count.",
  239: () => 'Theming API and CSS File Themes are both used in the same page. In v33 we released the Theming API as the new default method of styling the grid. See the migration docs https://www.ag-grid.com/react-data-grid/theming-migration/. Because no value was provided to the `theme` grid option it defaulted to themeQuartz. But the file (ag-grid.css) is also included and will cause styling issues. Either pass the string "legacy" to the theme grid option to use v32 style themes, or remove ag-grid.css from the page to use Theming API.',
  240: ({ theme: e }) => `theme grid option must be a Theming API theme object or the string "legacy", received: ${e}`,
  // 241: () => `cannot select multiple rows when rowSelection.mode is set to 'singleRow'` as const,
  // 242: () => 'cannot select multiple rows when using rangeSelect' as const,
  243: () => "Failed to deserialize state - each provided state object must be an object.",
  244: () => "Failed to deserialize state - `selectAllChildren` must be a boolean value or undefined.",
  245: () => "Failed to deserialize state - `toggledNodes` must be an array.",
  246: () => "Failed to deserialize state - Every `toggledNode` requires an associated string id.",
  247: () => `Row selection state could not be parsed due to invalid data. Ensure all child state has toggledNodes or does not conform with the parent rule. 
Please rebuild the selection state and reapply it.`,
  248: () => "SetFloatingFilter expects SetFilter as its parent",
  249: () => "Must supply a Value Formatter in Set Filter params when using a Key Creator",
  250: () => "Must supply a Key Creator in Set Filter params when `treeList = true` on a group column, and Tree Data or Row Grouping is enabled.",
  251: ({ chartType: e }) => `AG Grid: Unable to create chart as an invalid chartType = '${e}' was supplied.`,
  252: () => `cannot get grid to draw rows when it is in the middle of drawing rows. 
Your code probably called a grid API method while the grid was in the render stage. 
To overcome this, put the API call into a timeout, e.g. instead of api.redrawRows(), call setTimeout(function() { api.redrawRows(); }, 0). 
To see what part of your code that caused the refresh check this stacktrace.`,
  253: ({ version: e }) => ["Illegal version string: ", e],
  254: () => "Cannot create chart: no chart themes available.",
  255: ({ point: e }) => `Lone surrogate U+${e == null ? void 0 : e.toString(16).toUpperCase()} is not a scalar value`,
  256: () => "Unable to initialise. See validation error, or load ValidationModule if missing.",
  257: () => cu("IntegratedChartsModule"),
  258: () => cu("SparklinesModule"),
  259: ({ part: e }) => `the argument to theme.withPart must be a Theming API part object, received: ${e}`,
  260: ({
    propName: e,
    compName: t,
    gridScoped: s,
    gridId: i,
    rowModelType: r
  }) => lu({
    reasonOrId: `AG Grid '${e}' component: ${t}`,
    moduleName: nr[t],
    gridId: i,
    gridScoped: s,
    rowModelType: r
  }),
  261: () => "As of v33, `column.isHovered()` is deprecated. Use `api.isColumnHovered(column)` instead.",
  262: () => 'As of v33, icon key "smallDown" is deprecated. Use "advancedFilterBuilderSelect" for Advanced Filter Builder dropdown, "selectOpen" for Select cell editor and dropdowns (e.g. Integrated Charts menu), "richSelectOpen" for Rich Select cell editor.',
  263: () => 'As of v33, icon key "smallLeft" is deprecated. Use "panelDelimiterRtl" for Row Group Panel / Pivot Panel, "subMenuOpenRtl" for sub-menus.',
  264: () => 'As of v33, icon key "smallRight" is deprecated. Use "panelDelimiter" for Row Group Panel / Pivot Panel, "subMenuOpen" for sub-menus.',
  265: ({ colId: e }) => `Unable to infer chart data type for column '${e}' if first data entry is null. Please specify "chartDataType", or a "cellDataType" in the column definition. For more information, see ${tr}/integrated-charts-range-chart#coldefchartdatatype .`,
  266: () => 'As of v33.1, using "keyCreator" with the Rich Select Editor has been deprecated. It now requires the "formatValue" callback to convert complex data to strings.',
  267: () => "Detail grids can not use a different theme to the master grid, the `theme` detail grid option will be ignored.",
  268: () => "Transactions aren't supported with tree data when using treeDataChildrenField",
  269: () => "When `masterSelects: 'detail'`, detail grids must be configured with multi-row selection",
  270: ({ id: e, parentId: t }) => `Cycle detected for row with id='${e}' and parent id='${t}'. Resetting the parent for row with id='${e}' and showing it as a root-level node.`,
  271: ({ id: e, parentId: t }) => `Parent row not found for row with id='${e}' and parent id='${t}'. Showing row with id='${e}' as a root-level node.`,
  272: () => am(),
  273: ({ providedId: e, usedId: t }) => `Provided column id '${e}' was already in use, ensure all column and group ids are unique. Using '${t}' instead.`,
  274: ({ prop: e }) => {
    let t = `Since v33, ${e} has been deprecated.`;
    switch (e) {
      case "maxComponentCreationTimeMs":
        t += " This property is no longer required and so will be removed in a future version.";
        break;
      case "setGridApi":
        t += " This method is not called by AG Grid. To access the GridApi see: https://ag-grid.com/react-data-grid/grid-interface/#grid-api ";
        break;
      case "children":
        t += " For multiple versions AgGridReact does not support children.";
        break;
    }
    return t;
  },
  275: lm,
  276: () => "Row Numbers Row Resizer cannot be used when Grid Columns have `autoHeight` enabled.",
  277: ({ colId: e }) => `'enableFilterHandlers' is set to true, but column '${e}' does not have 'filter.doesFilterPass' or 'filter.handler' set.`,
  278: ({ colId: e }) => `Unable to create filter handler for column '${e}'`,
  279: (e) => {
  },
  // `Unable to create dynamic bean '${name}' during module init lifecycle, dynamic beans must be initialised on first use.` as const,
  280: ({ colId: e }) => `'name' must be provided for custom filter components for column '${e}`,
  281: ({ colId: e }) => `Filter for column '${e}' does not have 'filterParams.buttons', but the new Filters Tool Panel has buttons configured. Either configure buttons for the filter, or disable buttons on the Filters Tool Panel.`,
  282: () => "New filter tool panel requires `enableFilterHandlers: true`.",
  283: () => "As of v34, use the same method on the filter handler (`api.getColumnFilterHandler(colKey)`) instead.",
  284: () => "As of v34, filters are active when they have a model. Use `api.getColumnFilterModel()` instead.",
  285: () => "As of v34, use (`api.getColumnFilterModel()`) instead.",
  286: () => "As of v34, use (`api.setColumnFilterModel()`) instead.",
  287: () => "`api.doFilterAction()` requires `enableFilterHandlers = true",
  288: () => "`api.getColumnFilterModel(key, true)` requires `enableFilterHandlers = true",
  289: ({ rowModelType: e }) => `Row Model '${e}' is not supported with Batch Editing`,
  290: ({ rowIndex: e, rowPinned: t }) => `Row with index '${e}' and pinned state '${t}' not found`
};
function FM(e, t) {
  const s = xM[e];
  if (!s)
    return [`Missing error text for error id ${e}!`];
  const i = s(t), n = `
See ${qg(e, t)}`;
  return Array.isArray(i) ? i.concat(n) : [i, n];
}
var RM = {
  1: "Charting Aggregation",
  2: "pivotResultFields",
  3: "setTooltip"
}, du = /* @__PURE__ */ new WeakMap(), hu = /* @__PURE__ */ new WeakMap();
function cm(e, t, s) {
  if (!t)
    return j(11), {};
  const i = s;
  let r;
  if (!(i != null && i.setThemeOnGridDiv)) {
    const o = K({ tag: "div" });
    o.style.height = "100%", e.appendChild(o), e = o, r = () => e.remove();
  }
  return new EM().create(
    e,
    t,
    (o) => {
      const a = new oF(e);
      o.createBean(a);
    },
    void 0,
    s,
    r
  );
}
var PM = 1, EM = class {
  create(e, t, s, i, r, n) {
    const o = Gw.applyGlobalGridOptions(t), a = o.gridId ?? String(PM++), l = this.getRegisteredModules(r, a, o.rowModelType), c = this.createBeansList(o.rowModelType, l, a), d = this.createProvidedBeans(e, o, r);
    if (!c)
      return;
    const u = {
      providedBeanInstances: d,
      beanClasses: c,
      id: a,
      beanInitComparator: _x,
      beanDestroyComparator: Ux,
      derivedBeans: [zx],
      destroyCallback: () => {
        hu.delete(p), du.delete(e), wP(a), n == null || n();
      }
    }, g = new Ky(u);
    this.registerModuleFeatures(g, l), s(g), g.getBean("syncSvc").start(), i == null || i(g);
    const p = g.getBean("gridApi");
    return du.set(e, p), hu.set(p, e), p;
  }
  getRegisteredModules(e, t, s) {
    var i;
    return ln(mM, void 0, !0), (i = e == null ? void 0 : e.modules) == null || i.forEach((r) => ln(r, t)), bP(t, uu(s));
  }
  registerModuleFeatures(e, t) {
    const s = e.getBean("registry"), i = e.getBean("apiFunctionSvc");
    t.forEach((r) => {
      s.registerModule(r);
      const n = r.apiFunctions;
      n && Object.keys(n).forEach((a) => {
        i == null || i.addFunction(a, n[a]);
      });
    });
  }
  createProvidedBeans(e, t, s) {
    let i = s ? s.frameworkOverrides : null;
    ee(i) && (i = new Hx());
    const r = {
      gridOptions: t,
      eGridDiv: e,
      eRootDiv: e,
      globalListener: s ? s.globalListener : null,
      globalSyncListener: s ? s.globalSyncListener : null,
      frameworkOverrides: i
    };
    return s && s.providedBeanInstances && Object.assign(r, s.providedBeanInstances), r;
  }
  createBeansList(e, t, s) {
    const i = {
      clientSide: "ClientSideRowModel",
      infinite: "InfiniteRowModel",
      serverSide: "ServerSideRowModel",
      viewport: "ViewportRowModel"
    }, r = uu(e), n = i[r];
    if (!n) {
      Nr(201, { rowModelType: r }, `Unknown rowModelType ${r}.`);
      return;
    }
    if (!xP()) {
      Nr(272, void 0, am());
      return;
    }
    if (!e) {
      const a = Object.entries(i).filter(
        ([l, c]) => ac(c, s, l)
      );
      if (a.length == 1) {
        const [l, c] = a[0];
        if (l !== r) {
          const d = {
            moduleName: c,
            rowModelType: l
          };
          Nr(275, d, lm(d));
          return;
        }
      }
    }
    if (!ac(n, s, r)) {
      Nr(
        200,
        {
          reasonOrId: `rowModelType = '${r}'`,
          moduleName: n,
          gridScoped: Fd(),
          gridId: s,
          rowModelType: r
        },
        `Missing module ${n}Module for rowModelType ${r}.`
      );
      return;
    }
    const o = /* @__PURE__ */ new Set();
    return t.forEach((a) => {
      var l;
      return (l = a.beans) == null ? void 0 : l.forEach((c) => o.add(c));
    }), Array.from(o);
  }
};
function uu(e) {
  return e ?? "clientSide";
}
var TM = class extends R {
  constructor() {
    super(...arguments), this.beanName = "localeSvc";
  }
  getLocaleTextFunc() {
    const e = this.gos, t = e.getCallback("getLocaleText");
    return t ? Tw(t) : Mw(e.get("localeText"));
  }
};
function MM(e, t = !1) {
  const s = [], i = [], r = [], n = [], o = [], a = [], l = [], c = [], d = [];
  let h = 0;
  for (let u = 0; u < e.length; u++) {
    const {
      colId: g,
      sort: p,
      sortIndex: f,
      rowGroup: m,
      rowGroupIndex: C,
      aggFunc: v,
      pivot: w,
      pivotIndex: b,
      pinned: y,
      hide: P,
      width: E,
      flex: M
    } = e[u];
    d.push(g), p && (s[f ?? h++] = { colId: g, sort: p }), m && (i[C ?? 0] = g), typeof v == "string" && r.push({ colId: g, aggFunc: v }), w && (n[b ?? 0] = g), y && (y === "right" ? a : o).push(g), P && l.push(g), (M != null || E) && c.push({ colId: g, flex: M ?? void 0, width: E });
  }
  return {
    sort: s.length ? { sortModel: s } : void 0,
    rowGroup: i.length ? { groupColIds: i } : void 0,
    aggregation: r.length ? { aggregationModel: r } : void 0,
    pivot: n.length || t ? { pivotMode: t, pivotColIds: n } : void 0,
    columnPinning: o.length || a.length ? { leftColIds: o, rightColIds: a } : void 0,
    columnVisibility: l.length ? { hiddenColIds: l } : void 0,
    columnSizing: c.length ? { columnSizingModel: c } : void 0,
    columnOrder: d.length ? { orderedColIds: d } : void 0
  };
}
function DM(e) {
  const t = [];
  return e.forEach(({ groupId: s, open: i }) => {
    i && t.push(s);
  }), t.length ? { openColumnGroupIds: t } : void 0;
}
function Yr(e) {
  return e.get("tooltipShowMode") === "whenTruncated";
}
function Fa(e, t) {
  return Yr(e) ? Ci(t) : void 0;
}
function Ii(e, t) {
  if (typeof e != "number")
    return "";
  const s = t(), i = s("thousandSeparator", ","), r = s("decimalSeparator", ".");
  return e.toString().replace(".", r).replace(/(\d)(?=(\d{3})+(?!\d))/g, `$1${i}`);
}
var dm = class extends R {
  getFileName(e) {
    const t = this.getDefaultFileExtension();
    return (e == null || !e.length) && (e = this.getDefaultFileName()), e.indexOf(".") === -1 ? `${e}.${t}` : e;
  }
  getData(e) {
    const t = this.createSerializingSession(e);
    return this.beans.gridSerializer.serialize(t, e);
  }
  getDefaultFileName() {
    return `export.${this.getDefaultFileExtension()}`;
  }
}, hm = class {
  constructor(e) {
    const {
      colModel: t,
      rowGroupColsSvc: s,
      colNames: i,
      valueSvc: r,
      gos: n,
      processCellCallback: o,
      processHeaderCallback: a,
      processGroupHeaderCallback: l,
      processRowGroupCallback: c
    } = e;
    this.colModel = t, this.rowGroupColsSvc = s, this.colNames = i, this.valueSvc = r, this.gos = n, this.processCellCallback = o, this.processHeaderCallback = a, this.processGroupHeaderCallback = l, this.processRowGroupCallback = c;
  }
  prepare(e) {
  }
  extractHeaderValue(e) {
    return this.getHeaderName(this.processHeaderCallback, e) ?? "";
  }
  extractRowCellValue(e, t, s, i, r) {
    var u;
    const n = t === 0 && $c(this.gos, r, this.colModel.isPivotMode());
    if (this.processRowGroupCallback && (this.gos.get("treeData") || r.group) && (e.isRowGroupDisplayed(((u = r.rowGroupColumn) == null ? void 0 : u.getColId()) ?? "") || n))
      return { value: this.processRowGroupCallback(V(this.gos, { column: e, node: r })) ?? "" };
    if (this.processCellCallback)
      return {
        value: this.processCellCallback(
          V(this.gos, {
            accumulatedRowIndex: s,
            column: e,
            node: r,
            value: this.valueSvc.getValueForDisplay(e, r, void 0, void 0).value,
            type: i,
            parseValue: (g) => this.valueSvc.parseValue(
              e,
              r,
              g,
              this.valueSvc.getValue(e, r, void 0)
            ),
            formatValue: (g) => this.valueSvc.formatValue(e, r, g) ?? g
          })
        ) ?? ""
      };
    const o = this.gos.get("treeData"), a = this.valueSvc, l = r.level === -1 && r.footer, c = e.colDef.showRowGroup === !0 && (r.group || o);
    if (!l && (n || c)) {
      let g = "", p = r;
      for (; p && p.level !== -1; ) {
        const { value: f, valueFormatted: m } = a.getValueForDisplay(
          n ? void 0 : e,
          // full width group doesn't have a column
          p,
          !0,
          !0
        );
        g = ` -> ${m ?? f ?? ""}${g}`, p = p.parent;
      }
      return {
        value: g,
        // don't return the unformatted value; as if the grid detects number it'll not use the concatenated string
        valueFormatted: g
      };
    }
    const { value: d, valueFormatted: h } = a.getValueForDisplay(e, r, !0, !0);
    return {
      value: d ?? "",
      valueFormatted: h
    };
  }
  getHeaderName(e, t) {
    return e ? e(V(this.gos, { column: t })) : this.colNames.getDisplayNameForColumn(t, "csv", !0);
  }
};
function Ad(e, t) {
  const s = document.defaultView || window;
  if (!s) {
    F(52);
    return;
  }
  const i = document.createElement("a"), r = s.URL.createObjectURL(t);
  i.setAttribute("href", r), i.setAttribute("download", e), i.style.display = "none", document.body.appendChild(i), i.dispatchEvent(
    new MouseEvent("click", {
      bubbles: !1,
      cancelable: !0,
      view: s
    })
  ), document.body.removeChild(i), s.setTimeout(() => {
    s.URL.revokeObjectURL(r);
  }, 0);
}
var AM = {
  enableBrowserTooltips: !0,
  tooltipTrigger: !0,
  tooltipMouseTrack: !0,
  tooltipShowMode: !0,
  tooltipInteraction: !0,
  defaultColGroupDef: !0,
  suppressAutoSize: !0,
  skipHeaderOnAutoSize: !0,
  autoSizeStrategy: !0,
  components: !0,
  stopEditingWhenCellsLoseFocus: !0,
  undoRedoCellEditing: !0,
  undoRedoCellEditingLimit: !0,
  excelStyles: !0,
  cacheQuickFilter: !0,
  customChartThemes: !0,
  chartThemeOverrides: !0,
  chartToolPanelsDef: !0,
  loadingCellRendererSelector: !0,
  localeText: !0,
  keepDetailRows: !0,
  keepDetailRowsCount: !0,
  detailRowHeight: !0,
  detailRowAutoHeight: !0,
  tabIndex: !0,
  valueCache: !0,
  valueCacheNeverExpires: !0,
  enableCellExpressions: !0,
  suppressTouch: !0,
  suppressBrowserResizeObserver: !0,
  suppressPropertyNamesCheck: !0,
  debug: !0,
  dragAndDropImageComponent: !0,
  loadingOverlayComponent: !0,
  suppressLoadingOverlay: !0,
  noRowsOverlayComponent: !0,
  paginationPageSizeSelector: !0,
  paginateChildRows: !0,
  pivotPanelShow: !0,
  pivotSuppressAutoColumn: !0,
  suppressExpandablePivotGroups: !0,
  aggFuncs: !0,
  allowShowChangeAfterFilter: !0,
  ensureDomOrder: !0,
  enableRtl: !0,
  suppressColumnVirtualisation: !0,
  suppressMaxRenderedRowRestriction: !0,
  suppressRowVirtualisation: !0,
  rowDragText: !0,
  groupLockGroupColumns: !0,
  suppressGroupRowsSticky: !0,
  rowModelType: !0,
  cacheOverflowSize: !0,
  infiniteInitialRowCount: !0,
  serverSideInitialRowCount: !0,
  maxBlocksInCache: !0,
  maxConcurrentDatasourceRequests: !0,
  blockLoadDebounceMillis: !0,
  serverSideOnlyRefreshFilteredGroups: !0,
  serverSidePivotResultFieldSeparator: !0,
  viewportRowModelPageSize: !0,
  viewportRowModelBufferSize: !0,
  debounceVerticalScrollbar: !0,
  suppressAnimationFrame: !0,
  suppressPreventDefaultOnMouseWheel: !0,
  scrollbarWidth: !0,
  icons: !0,
  suppressRowTransform: !0,
  gridId: !0,
  enableGroupEdit: !0,
  initialState: !0,
  processUnpinnedColumns: !0,
  createChartContainer: !0,
  getLocaleText: !0,
  getRowId: !0,
  reactiveCustomComponents: !0,
  renderingMode: !0,
  columnMenu: !0,
  suppressSetFilterByDefault: !0,
  getDataPath: !0,
  enableCellSpan: !0,
  enableFilterHandlers: !0,
  filterHandlers: !0
}, ot = "clientSide", We = "serverSide", $i = "infinite", IM = {
  onGroupExpandedOrCollapsed: [ot],
  refreshClientSideRowModel: [ot],
  isRowDataEmpty: [ot],
  forEachLeafNode: [ot],
  forEachNodeAfterFilter: [ot],
  forEachNodeAfterFilterAndSort: [ot],
  resetRowHeights: [ot, We],
  applyTransaction: [ot],
  applyTransactionAsync: [ot],
  flushAsyncTransactions: [ot],
  getBestCostNodeSelection: [ot],
  getServerSideSelectionState: [We],
  setServerSideSelectionState: [We],
  applyServerSideTransaction: [We],
  applyServerSideTransactionAsync: [We],
  applyServerSideRowData: [We],
  retryServerSideLoads: [We],
  flushServerSideAsyncTransactions: [We],
  refreshServerSide: [We],
  getServerSideGroupLevelState: [We],
  refreshInfiniteCache: [$i],
  purgeInfiniteCache: [$i],
  getInfiniteRowCount: [$i],
  isLastRowIndexKnown: [$i, We],
  expandAll: [ot, We],
  collapseAll: [ot, We],
  onRowHeightChanged: [ot, We],
  setRowCount: [$i, We],
  getCacheBlockState: [$i, We]
}, LM = {
  showLoadingOverlay: {
    version: "v32",
    message: '`showLoadingOverlay` is deprecated. Use the grid option "loading"=true instead or setGridOption("loading", true).'
  },
  clearRangeSelection: {
    version: "v32.2",
    message: "Use `clearCellSelection` instead."
  },
  getInfiniteRowCount: {
    version: "v32.2",
    old: "getInfiniteRowCount()",
    new: "getDisplayedRowCount()"
  },
  selectAllFiltered: {
    version: "v33",
    old: "selectAllFiltered()",
    new: 'selectAll("filtered")'
  },
  deselectAllFiltered: {
    version: "v33",
    old: "deselectAllFiltered()",
    new: 'deselectAll("filtered")'
  },
  selectAllOnCurrentPage: {
    version: "v33",
    old: "selectAllOnCurrentPage()",
    new: 'selectAll("currentPage")'
  },
  deselectAllOnCurrentPage: {
    version: "v33",
    old: "deselectAllOnCurrentPage()",
    new: 'deselectAll("currentPage")'
  }
};
function kM(e, t, s) {
  const i = LM[e];
  if (i) {
    const { version: n, new: o, old: a, message: l } = i, c = a ?? e;
    return (...d) => {
      const h = o ? `Please use ${o} instead. ` : "";
      return Zt(`Since ${n} api.${c} is deprecated. ${h}${l ?? ""}`), t.apply(t, d);
    };
  }
  const r = IM[e];
  return r ? (...n) => {
    const o = s.rowModel.getType();
    if (!r.includes(o)) {
      er(
        `api.${e} can only be called when gridOptions.rowModelType is ${r.join(" or ")}`
      );
      return;
    }
    return t.apply(t, n);
  } : t;
}
var GM = {
  detailCellRendererCtrl: "SharedMasterDetail",
  dndSourceComp: "DragAndDrop",
  fillHandle: "CellSelection",
  groupCellRendererCtrl: "GroupCellRenderer",
  headerFilterCellCtrl: "ColumnFilter",
  headerGroupCellCtrl: "ColumnGroup",
  rangeHandle: "CellSelection",
  tooltipFeature: "Tooltip",
  highlightTooltipFeature: "Tooltip",
  tooltipStateManager: "Tooltip",
  groupStrategy: "RowGrouping",
  treeGroupStrategy: "TreeData",
  rowNumberRowResizer: "RowNumbers",
  singleCell: "EditCore",
  fullRow: "EditCore",
  agSetColumnFilterHandler: "SetFilter",
  agMultiColumnFilterHandler: "MultiFilter",
  agGroupColumnFilterHandler: "GroupFilter",
  agNumberColumnFilterHandler: "NumberFilter",
  agDateColumnFilterHandler: "DateFilter",
  agTextColumnFilterHandler: "TextFilter"
}, OM = {
  expanded: 1,
  contracted: 1,
  "tree-closed": 1,
  "tree-open": 1,
  "tree-indeterminate": 1,
  pin: 1,
  "eye-slash": 1,
  arrows: 1,
  left: 1,
  right: 1,
  group: 1,
  aggregation: 1,
  pivot: 1,
  "not-allowed": 1,
  chart: 1,
  cross: 1,
  cancel: 1,
  tick: 1,
  first: 1,
  previous: 1,
  next: 1,
  last: 1,
  linked: 1,
  unlinked: 1,
  "color-picker": 1,
  loading: 1,
  menu: 1,
  "menu-alt": 1,
  filter: 1,
  "filter-add": 1,
  columns: 1,
  maximize: 1,
  minimize: 1,
  copy: 1,
  cut: 1,
  paste: 1,
  grip: 1,
  save: 1,
  csv: 1,
  excel: 1,
  "small-down": 1,
  "small-left": 1,
  "small-right": 1,
  "small-up": 1,
  asc: 1,
  desc: 1,
  none: 1,
  up: 1,
  down: 1,
  plus: 1,
  minus: 1,
  settings: 1,
  "checkbox-checked": 1,
  "checkbox-indeterminate": 1,
  "checkbox-unchecked": 1,
  "radio-button-on": 1,
  "radio-button-off": 1,
  eye: 1,
  "column-arrow": 1,
  "un-pin": 1,
  "pinned-top": 1,
  "pinned-bottom": 1,
  "chevron-up": 1,
  "chevron-down": 1,
  "chevron-left": 1,
  "chevron-right": 1,
  edit: 1
}, VM = {
  chart: "MenuCore",
  cancel: "EnterpriseCore",
  first: "Pagination",
  previous: "Pagination",
  next: "Pagination",
  last: "Pagination",
  linked: "IntegratedCharts",
  loadingMenuItems: "MenuCore",
  unlinked: "IntegratedCharts",
  menu: "ColumnHeaderComp",
  legacyMenu: "ColumnMenu",
  filter: "ColumnFilter",
  filterActive: "ColumnFilter",
  filterAdd: "NewFiltersToolPanel",
  filterCardCollapse: "NewFiltersToolPanel",
  filterCardExpand: "NewFiltersToolPanel",
  filterCardEditing: "NewFiltersToolPanel",
  filterTab: "ColumnMenu",
  filtersToolPanel: "FiltersToolPanel",
  columns: ["MenuCore"],
  columnsToolPanel: ["ColumnsToolPanel"],
  maximize: "EnterpriseCore",
  minimize: "EnterpriseCore",
  save: "MenuCore",
  columnGroupOpened: "ColumnGroupHeaderComp",
  columnGroupClosed: "ColumnGroupHeaderComp",
  accordionOpen: "EnterpriseCore",
  accordionClosed: "EnterpriseCore",
  accordionIndeterminate: "EnterpriseCore",
  columnSelectClosed: ["ColumnsToolPanel", "ColumnMenu"],
  columnSelectOpen: ["ColumnsToolPanel", "ColumnMenu"],
  columnSelectIndeterminate: ["ColumnsToolPanel", "ColumnMenu"],
  columnMovePin: "SharedDragAndDrop",
  columnMoveHide: "SharedDragAndDrop",
  columnMoveMove: "SharedDragAndDrop",
  columnMoveLeft: "SharedDragAndDrop",
  columnMoveRight: "SharedDragAndDrop",
  columnMoveGroup: "SharedDragAndDrop",
  columnMoveValue: "SharedDragAndDrop",
  columnMovePivot: "SharedDragAndDrop",
  dropNotAllowed: "SharedDragAndDrop",
  ensureColumnVisible: ["ColumnsToolPanel", "ColumnMenu"],
  groupContracted: "GroupCellRenderer",
  groupExpanded: "GroupCellRenderer",
  setFilterGroupClosed: "SetFilter",
  setFilterGroupOpen: "SetFilter",
  setFilterGroupIndeterminate: "SetFilter",
  setFilterLoading: "SetFilter",
  close: "EnterpriseCore",
  check: "MenuItem",
  colorPicker: "CommunityCore",
  groupLoading: "LoadingCellRenderer",
  menuAlt: "ColumnHeaderComp",
  menuPin: "MenuCore",
  menuValue: "MenuCore",
  menuAddRowGroup: ["MenuCore", "ColumnsToolPanel"],
  menuRemoveRowGroup: ["MenuCore", "ColumnsToolPanel"],
  clipboardCopy: "MenuCore",
  clipboardCut: "MenuCore",
  clipboardPaste: "MenuCore",
  pivotPanel: ["ColumnsToolPanel", "RowGroupingPanel"],
  rowGroupPanel: ["ColumnsToolPanel", "RowGroupingPanel"],
  valuePanel: "ColumnsToolPanel",
  columnDrag: "EnterpriseCore",
  rowDrag: ["RowDrag", "DragAndDrop"],
  csvExport: "MenuCore",
  excelExport: "MenuCore",
  smallDown: "CommunityCore",
  selectOpen: "CommunityCore",
  richSelectOpen: "RichSelect",
  richSelectRemove: "RichSelect",
  smallLeft: "CommunityCore",
  smallRight: "CommunityCore",
  subMenuOpen: "MenuItem",
  subMenuOpenRtl: "MenuItem",
  panelDelimiter: "RowGroupingPanel",
  panelDelimiterRtl: "RowGroupingPanel",
  smallUp: "CommunityCore",
  sortAscending: ["MenuCore", "Sort"],
  sortDescending: ["MenuCore", "Sort"],
  sortUnSort: ["MenuCore", "Sort"],
  advancedFilterBuilder: "AdvancedFilter",
  advancedFilterBuilderDrag: "AdvancedFilter",
  advancedFilterBuilderInvalid: "AdvancedFilter",
  advancedFilterBuilderMoveUp: "AdvancedFilter",
  advancedFilterBuilderMoveDown: "AdvancedFilter",
  advancedFilterBuilderAdd: "AdvancedFilter",
  advancedFilterBuilderRemove: "AdvancedFilter",
  advancedFilterBuilderSelectOpen: "AdvancedFilter",
  chartsMenu: "IntegratedCharts",
  chartsMenuEdit: "IntegratedCharts",
  chartsMenuAdvancedSettings: "IntegratedCharts",
  chartsMenuAdd: "IntegratedCharts",
  chartsColorPicker: "IntegratedCharts",
  chartsThemePrevious: "IntegratedCharts",
  chartsThemeNext: "IntegratedCharts",
  chartsDownload: "IntegratedCharts",
  checkboxChecked: "CommunityCore",
  checkboxIndeterminate: "CommunityCore",
  checkboxUnchecked: "CommunityCore",
  radioButtonOn: "CommunityCore",
  radioButtonOff: "CommunityCore",
  rowPin: "PinnedRow",
  rowUnpin: "PinnedRow",
  rowPinBottom: "PinnedRow",
  rowPinTop: "PinnedRow"
}, BM = /* @__PURE__ */ new Set([
  "colorPicker",
  "smallUp",
  "checkboxChecked",
  "checkboxIndeterminate",
  "checkboxUnchecked",
  "radioButtonOn",
  "radioButtonOff",
  "smallDown",
  "smallLeft",
  "smallRight"
]), NM = class extends R {
  constructor() {
    super(...arguments), this.beanName = "validation";
  }
  wireBeans(e) {
    this.gridOptions = e.gridOptions, Vw(FM);
  }
  warnOnInitialPropertyUpdate(e, t) {
    e === "api" && AM[t] && F(22, { key: t });
  }
  processGridOptions(e) {
    this.processOptions(e, BE());
  }
  validateApiFunction(e, t) {
    return kM(e, t, this.beans);
  }
  missingUserComponent(e, t, s, i) {
    const r = nr[t];
    r ? this.gos.assertModuleRegistered(
      r,
      `AG Grid '${e}' component: ${t}`
    ) : F(101, {
      propertyName: e,
      componentName: t,
      agGridDefaults: s,
      jsComps: i
    });
  }
  missingDynamicBean(e) {
    const t = GM[e];
    return t ? gt(200, {
      ...this.gos.getModuleErrorParams(),
      moduleName: t,
      reasonOrId: e
    }) : void 0;
  }
  checkRowEvents(e) {
    zM.has(e) && F(10, { eventType: e });
  }
  validateIcon(e) {
    if (BM.has(e) && F(43, { iconName: e }), OM[e])
      return;
    const t = VM[e];
    if (t) {
      j(200, {
        reasonOrId: `icon '${e}'`,
        moduleName: t,
        gridScoped: Fd(),
        gridId: this.beans.context.getId(),
        rowModelType: this.gos.get("rowModelType"),
        additionalText: "Alternatively, use the CSS icon name directly."
      });
      return;
    }
    F(134, { iconName: e });
  }
  isProvidedUserComp(e) {
    return !!nr[e];
  }
  /** Should only be called via the GridOptionsService */
  validateColDef(e) {
    this.processOptions(e, EE());
  }
  processOptions(e, t) {
    const { validations: s, deprecations: i, allProperties: r, propertyExceptions: n, objectName: o, docsUrl: a } = t;
    r && this.gridOptions.suppressPropertyNamesCheck !== !0 && this.checkProperties(
      e,
      [...n ?? [], ...Object.keys(i)],
      r,
      o,
      a
    );
    const l = /* @__PURE__ */ new Set();
    Object.keys(e).forEach((d) => {
      const h = i[d];
      if (h) {
        const { message: v, version: w } = h;
        l.add(`As of v${w}, ${String(d)} is deprecated. ${v ?? ""}`);
      }
      const u = e[d];
      if (u == null || u === !1)
        return;
      const g = s[d];
      if (!g)
        return;
      const { dependencies: p, validate: f, supportedRowModels: m, expectedType: C } = g;
      if (C) {
        const v = typeof u;
        if (v !== C) {
          l.add(
            `${String(d)} should be of type '${C}' but received '${v}' (${u}).`
          );
          return;
        }
      }
      if (m) {
        const v = this.gridOptions.rowModelType ?? "clientSide";
        if (!m.includes(v)) {
          l.add(
            `${String(d)} is not supported with the '${v}' row model. It is only valid with: ${m.join(", ")}.`
          );
          return;
        }
      }
      if (p) {
        const v = this.checkForRequiredDependencies(d, p, e);
        if (v) {
          l.add(v);
          return;
        }
      }
      if (f) {
        const v = f(e, this.gridOptions, this.beans);
        if (v) {
          l.add(v);
          return;
        }
      }
    }), l.size > 0 && l.forEach((d) => {
      Zt(d);
    });
  }
  checkForRequiredDependencies(e, t, s) {
    const r = Object.entries(t).filter(([n, o]) => {
      const a = s[n];
      return !o.required.includes(a);
    });
    return r.length === 0 ? null : r.map(
      ([n, o]) => `'${String(e)}' requires '${n}' to be one of [${o.required.map((a) => a === null ? "null" : a === void 0 ? "undefined" : a).join(", ")}]. ${o.reason ?? ""}`
    ).join(`
           `);
  }
  checkProperties(e, t, s, i, r) {
    const n = ["__ob__", "__v_skip", "__metadata__"], o = HM(
      Object.getOwnPropertyNames(e),
      [...n, ...t, ...s],
      s
    ), a = Object.keys(o);
    for (const l of a) {
      const c = o[l];
      let d = `invalid ${i} property '${l}' did you mean any of these: ${c.slice(0, 8).join(", ")}.`;
      s.includes("context") && (d += `
If you are trying to annotate ${i} with application data, use the '${i}.context' property instead.`), Zt(d);
    }
    if (a.length > 0 && r) {
      const l = this.beans.frameworkOverrides.getDocLink(r);
      Zt(`to see all the valid ${i} properties please check: ${l}`);
    }
  }
};
function HM(e, t, s) {
  const i = {}, r = e.filter(
    (n) => !t.some((o) => o === n)
  );
  return r.length > 0 && r.forEach(
    (n) => i[n] = on({ inputValue: n, allSuggestions: s }).values
  ), i;
}
var zM = /* @__PURE__ */ new Set([
  "firstChildChanged",
  "lastChildChanged",
  "childIndexChanged"
]), WM = {
  moduleName: "Validation",
  version: B,
  beans: [NM]
};
function um(e) {
  e.sibling && (e.sibling.childrenAfterFilter = e.childrenAfterFilter);
}
var _M = class extends R {
  constructor() {
    super(...arguments), this.beanName = "filterStage", this.refreshProps = /* @__PURE__ */ new Set(["excludeChildrenWhenTreeDataFiltering"]), this.step = "filter";
  }
  wireBeans(e) {
    this.filterManager = e.filterManager;
  }
  execute(e) {
    const { changedPath: t } = e;
    this.filter(t);
  }
  filter(e) {
    var s;
    const t = !!((s = this.filterManager) != null && s.isChildFilterPresent());
    this.filterNodes(t, e);
  }
  filterNodes(e, t) {
    const s = (i, r) => {
      i.hasChildren() && e && !r ? i.childrenAfterFilter = i.childrenAfterGroup.filter((n) => {
        const o = n.childrenAfterFilter && n.childrenAfterFilter.length > 0, a = n.data && this.filterManager.doesRowPassFilter({ rowNode: n });
        return o || a;
      }) : i.childrenAfterFilter = i.childrenAfterGroup, um(i);
    };
    if (this.doingTreeDataFiltering()) {
      const i = (n, o) => {
        if (n.childrenAfterGroup)
          for (let a = 0; a < n.childrenAfterGroup.length; a++) {
            const l = n.childrenAfterGroup[a], c = o || this.filterManager.doesRowPassFilter({ rowNode: l });
            l.childrenAfterGroup ? i(n.childrenAfterGroup[a], c) : s(l, c);
          }
        s(n, o);
      }, r = (n) => i(n, !1);
      t.executeFromRootNode(r);
    } else {
      const i = (r) => s(r, !1);
      t.forEachChangedNodeDepthFirst(i, !0);
    }
  }
  doingTreeDataFiltering() {
    return this.gos.get("treeData") && !this.gos.get("excludeChildrenWhenTreeDataFiltering");
  }
}, UM = class extends bd {
  constructor() {
    super(...arguments), this.iconCreated = !1;
  }
  wireComp(e, t, s, i, r) {
    this.comp = e;
    const n = Cn(this, this.beans.context, r);
    this.eButtonShowMainFilter = s, this.eFloatingFilterBody = i, this.setGui(t, n), this.setupActive(), this.refreshHeaderStyles(), this.setupWidth(n), this.setupLeft(n), this.setupHover(n), this.setupFocus(n), this.setupAria(), this.setupFilterButton(), this.setupUserComp(), this.setupSyncWithFilter(n), this.setupUi(), n.addManagedElementListeners(this.eButtonShowMainFilter, { click: this.showParentFilter.bind(this) }), this.setupFilterChangedListener(n);
    const o = () => this.onColDefChanged(n);
    n.addManagedListeners(this.column, { colDefChanged: o }), n.addManagedEventListeners({
      filterSwitched: ({ column: a }) => {
        a === this.column && o();
      }
    }), n.addDestroyFunc(() => {
      this.eButtonShowMainFilter = null, this.eFloatingFilterBody = null, this.userCompDetails = null, this.clearComponent();
    });
  }
  // empty abstract method
  resizeHeader() {
  }
  moveHeader() {
  }
  getHeaderClassParams() {
    const { column: e, beans: t } = this, s = e.colDef;
    return V(t.gos, {
      colDef: s,
      column: e,
      floatingFilter: !0
    });
  }
  setupActive() {
    const e = this.column.getColDef(), t = !!e.filter, s = !!e.floatingFilter;
    this.active = t && s;
  }
  setupUi() {
    if (this.comp.setButtonWrapperDisplayed(!this.suppressFilterButton && this.active), this.comp.addOrRemoveBodyCssClass("ag-floating-filter-full-body", this.suppressFilterButton), this.comp.addOrRemoveBodyCssClass("ag-floating-filter-body", !this.suppressFilterButton), !this.active || this.iconCreated)
      return;
    const e = N("filter", this.beans, this.column);
    e && (this.iconCreated = !0, this.eButtonShowMainFilter.appendChild(e));
  }
  setupFocus(e) {
    e.createManagedBean(
      new ii(this.eGui, {
        shouldStopEventPropagation: this.shouldStopEventPropagation.bind(this),
        onTabKeyDown: this.onTabKeyDown.bind(this),
        handleKeyDown: this.handleKeyDown.bind(this),
        onFocusIn: this.onFocusIn.bind(this)
      })
    );
  }
  setupAria() {
    const e = this.getLocaleTextFunc();
    re(this.eButtonShowMainFilter, e("ariaFilterMenuOpen", "Open Filter Menu"));
  }
  onTabKeyDown(e) {
    var o;
    const { beans: t } = this;
    if (Q(t) === this.eGui)
      return;
    const r = ze(t, this.eGui, null, e.shiftKey);
    if (r) {
      (o = t.headerNavigation) == null || o.scrollToColumn(this.column), e.preventDefault(), r.focus();
      return;
    }
    const n = this.findNextColumnWithFloatingFilter(e.shiftKey);
    n && t.focusSvc.focusHeaderPosition({
      headerPosition: {
        headerRowIndex: this.rowCtrl.rowIndex,
        column: n
      },
      event: e
    }) && e.preventDefault();
  }
  findNextColumnWithFloatingFilter(e) {
    const t = this.beans.visibleCols;
    let s = this.column;
    do
      if (s = e ? t.getColBefore(s) : t.getColAfter(s), !s)
        break;
    while (!s.getColDef().filter || !s.getColDef().floatingFilter);
    return s;
  }
  handleKeyDown(e) {
    super.handleKeyDown(e);
    const t = this.getWrapperHasFocus();
    switch (e.key) {
      case S.UP:
      case S.DOWN:
      case S.LEFT:
      case S.RIGHT:
        if (t)
          return;
        he(e);
      case S.ENTER:
        t && ye(this.eGui) && e.preventDefault();
        break;
      case S.ESCAPE:
        t || this.eGui.focus();
    }
  }
  onFocusIn(e) {
    if (this.eGui.contains(e.relatedTarget))
      return;
    const s = !!e.relatedTarget && !e.relatedTarget.classList.contains("ag-floating-filter"), i = !!e.relatedTarget && mi(e.relatedTarget, "ag-floating-filter");
    if (s && i && e.target === this.eGui) {
      const r = this.lastFocusEvent, n = !!(r && r.key === S.TAB);
      if (r && n) {
        const o = r.shiftKey;
        ye(this.eGui, o);
      }
    }
    this.focusThis();
  }
  setupHover(e) {
    var t;
    (t = this.beans.colHover) == null || t.addHeaderFilterColumnHoverListener(e, this.comp, this.column, this.eGui);
  }
  setupLeft(e) {
    const t = new wd(this.column, this.eGui, this.beans);
    e.createManagedBean(t);
  }
  setupFilterButton() {
    var e;
    this.suppressFilterButton = !((e = this.beans.menuSvc) != null && e.isFloatingFilterButtonEnabled(this.column)), this.highlightFilterButtonWhenActive = !Ae(this.gos);
  }
  setupUserComp() {
    var t;
    if (!this.active)
      return;
    const e = (t = this.beans.colFilter) == null ? void 0 : t.getFloatingFilterCompDetails(
      this.column,
      () => this.showParentFilter()
    );
    e && this.setCompDetails(e);
  }
  setCompDetails(e) {
    this.userCompDetails = e, this.comp.setCompDetails(e);
  }
  showParentFilter() {
    var t;
    const e = this.suppressFilterButton ? this.eFloatingFilterBody : this.eButtonShowMainFilter;
    (t = this.beans.menuSvc) == null || t.showFilterMenu({
      column: this.column,
      buttonElement: e,
      containerType: "floatingFilter",
      positionBy: "button"
    });
  }
  setupSyncWithFilter(e) {
    if (!this.active)
      return;
    const {
      beans: { colFilter: t },
      column: s,
      gos: i
    } = this, r = (n) => {
      if ((n == null ? void 0 : n.source) === "filterDestroyed" && (!this.isAlive() || !(t != null && t.isAlive())))
        return;
      const o = this.comp.getFloatingFilterComp();
      o && o.then((a) => {
        if (a) {
          if (i.get("enableFilterHandlers")) {
            const d = n;
            let h = "filter";
            d != null && d.afterFloatingFilter ? h = "ui" : d != null && d.afterDataChange ? h = "dataChanged" : (n == null ? void 0 : n.source) === "api" && (h = "api"), this.updateFloatingFilterParams(this.userCompDetails, h);
            return;
          }
          const l = t == null ? void 0 : t.getCurrentFloatingFilterParentModel(s), c = n ? {
            // event can have additional params like `afterDataChange` which need to be passed through
            ...n,
            columns: n.columns ?? [],
            source: n.source === "api" ? "api" : "columnFilter"
          } : null;
          a.onParentModelChanged(l, c);
        }
      });
    };
    [this.destroySyncListener] = e.addManagedListeners(s, { filterChanged: r }), t != null && t.isFilterActive(s) && r(null);
  }
  setupWidth(e) {
    const t = () => {
      const s = `${this.column.getActualWidth()}px`;
      this.comp.setWidth(s);
    };
    e.addManagedListeners(this.column, { widthChanged: t }), t();
  }
  setupFilterChangedListener(e) {
    this.active && ([this.destroyFilterChangedListener] = e.addManagedListeners(this.column, {
      filterChanged: this.updateFilterButton.bind(this)
    }), this.updateFilterButton());
  }
  updateFilterButton() {
    var e;
    if (!this.suppressFilterButton && this.comp) {
      const t = !!((e = this.beans.filterManager) != null && e.isFilterAllowed(this.column));
      this.comp.setButtonWrapperDisplayed(t), this.highlightFilterButtonWhenActive && t && this.eButtonShowMainFilter.classList.toggle("ag-filter-active", this.column.isFilterActive());
    }
  }
  onColDefChanged(e) {
    const t = this.active;
    this.setupActive();
    const s = !t && this.active;
    t && !this.active && (this.destroySyncListener(), this.destroyFilterChangedListener());
    const i = this.beans.colFilter, r = this.active ? i == null ? void 0 : i.getFloatingFilterCompDetails(this.column, () => this.showParentFilter()) : null, n = this.comp.getFloatingFilterComp();
    !n || !r ? this.updateCompDetails(e, r, s) : n.then((o) => {
      !o || i != null && i.areFilterCompsDifferent(this.userCompDetails ?? null, r) ? this.updateCompDetails(e, r, s) : this.updateFloatingFilterParams(r, "colDef");
    });
  }
  updateCompDetails(e, t, s) {
    this.isAlive() && (this.setCompDetails(t), this.setupFilterButton(), this.setupUi(), s && (this.setupSyncWithFilter(e), this.setupFilterChangedListener(e)));
  }
  updateFloatingFilterParams(e, t) {
    var i;
    if (!e)
      return;
    let s = e.params;
    (i = this.comp.getFloatingFilterComp()) == null || i.then((r) => {
      var n;
      typeof (r == null ? void 0 : r.refresh) == "function" && (this.gos.get("enableFilterHandlers") && (s = {
        ...s,
        model: Pe(((n = this.beans.colFilter) == null ? void 0 : n.model) ?? {}, this.column.getColId()),
        source: t
      }), r.refresh(s));
    });
  }
  addResizeAndMoveKeyboardListeners() {
  }
  destroy() {
    super.destroy(), this.destroySyncListener = null, this.destroyFilterChangedListener = null;
  }
};
function $M(e, t) {
  var i;
  const s = e.colModel.getCol(t);
  if (!s) {
    j(12, { colKey: t });
    return;
  }
  (i = e.menuSvc) == null || i.showColumnMenu({
    column: s,
    positionBy: "auto"
  });
}
function KM(e) {
  var t;
  (t = e.menuSvc) == null || t.hidePopupMenu();
}
var gm = {
  moduleName: "SharedMenu",
  version: B,
  beans: [fx],
  apiFunctions: {
    showColumnMenu: $M,
    hidePopupMenu: KM
  }
}, jM = class extends sS {
  postConstruct() {
    this.beans.ctrlsSvc.whenReady(this, (e) => {
      this.gridCtrl = e.gridCtrl;
    }), this.addManagedEventListeners({ gridStylesChanged: this.handleThemeChange.bind(this) });
  }
  getDefaultPopupParent() {
    return this.gridCtrl.getGui();
  }
  positionPopupForMenu(e) {
    const { eventSource: t, ePopup: s, event: i } = e, r = t.getBoundingClientRect(), n = this.getParentRect();
    this.setAlignedTo(t, s);
    let o = !1;
    const a = () => {
      const l = this.keepXYWithinBounds(
        s,
        r.top - n.top,
        0
        /* Vertical */
      ), c = s.clientWidth > 0 ? s.clientWidth : 200;
      o || (s.style.minWidth = `${c}px`, o = !0);
      const h = n.right - n.left - c;
      let u;
      return this.gos.get("enableRtl") ? (u = p(), u < 0 && (u = g(), this.setAlignedStyles(s, "left")), u > h && (u = 0, this.setAlignedStyles(s, "right"))) : (u = g(), u > h && (u = p(), this.setAlignedStyles(s, "right")), u < 0 && (u = 0, this.setAlignedStyles(s, "left"))), { x: u, y: l };
      function g() {
        return r.right - n.left - 2;
      }
      function p() {
        return r.left - n.left - c;
      }
    };
    this.positionPopup({
      ePopup: s,
      keepWithinBounds: !0,
      updatePosition: a,
      postProcessCallback: () => this.callPostProcessPopup(
        e,
        "subMenu",
        s,
        t,
        i instanceof MouseEvent ? i : void 0
      )
    });
  }
  callPostProcessPopup(e, t, s, i, r) {
    const n = this.gos.getCallback("postProcessPopup");
    if (n) {
      const { column: o, rowNode: a } = e;
      n({
        column: o,
        rowNode: a,
        ePopup: s,
        type: t,
        eventSource: i,
        mouseEvent: r
      });
    }
  }
  getActivePopups() {
    return this.popupList.map((e) => e.element);
  }
  handleThemeChange(e) {
    if (e.themeChanged) {
      const t = this.beans.environment;
      for (const s of this.popupList)
        t.applyThemeClasses(s.wrapper);
    }
  }
  hasAnchoredPopup() {
    return this.popupList.some((e) => e.isAnchored);
  }
  isStopPropagation(e) {
    return St(e);
  }
}, Is = {
  moduleName: "Popup",
  version: B,
  beans: [jM]
}, YM = (
  /*css*/
  ".ag-set-filter{--ag-indentation-level:0}.ag-set-filter-item{align-items:center;display:flex;height:100%}:where(.ag-ltr) .ag-set-filter-item{padding-left:calc(var(--ag-widget-container-horizontal-padding) + var(--ag-indentation-level)*var(--ag-set-filter-indent-size))}:where(.ag-rtl) .ag-set-filter-item{padding-right:calc(var(--ag-widget-container-horizontal-padding) + var(--ag-indentation-level)*var(--ag-set-filter-indent-size))}.ag-set-filter-item-checkbox{display:flex;height:100%;width:100%}.ag-set-filter-group-icons{display:block;>*{cursor:pointer}}:where(.ag-ltr) .ag-set-filter-group-icons{margin-right:var(--ag-widget-container-horizontal-padding)}:where(.ag-rtl) .ag-set-filter-group-icons{margin-left:var(--ag-widget-container-horizontal-padding)}.ag-filter-body-wrapper{display:flex;flex-direction:column}:where(.ag-menu:not(.ag-tabs) .ag-filter) .ag-filter-body-wrapper,:where(.ag-menu:not(.ag-tabs) .ag-filter)>:not(.ag-filter-wrapper){min-width:180px}.ag-filter-filter{flex:1 1 0px}.ag-filter-condition{display:flex;justify-content:center}.ag-floating-filter-body{display:flex;flex:1 1 auto;height:100%;position:relative}.ag-floating-filter-full-body{align-items:center;display:flex;flex:1 1 auto;height:100%;overflow:hidden;width:100%}:where(.ag-floating-filter-full-body)>div{flex:1 1 auto}.ag-floating-filter-input{align-items:center;display:flex;width:100%;>*{flex:1 1 auto}:where(.ag-input-field-input[type=date]),:where(.ag-input-field-input[type=datetime-local]){width:1px}}.ag-floating-filter-button{display:flex;flex:none}.ag-date-floating-filter-wrapper{display:flex}.ag-set-floating-filter-input :where(input)[disabled]{pointer-events:none}.ag-floating-filter-button-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;height:var(--ag-icon-size);width:var(--ag-icon-size)}.ag-filter-loading{align-items:unset;background-color:var(--ag-chrome-background-color);height:100%;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);position:absolute;width:100%;z-index:1;:where(.ag-menu) &{background-color:var(--ag-menu-background-color)}}.ag-filter-separator{border-top:solid var(--ag-border-width) var(--menu-separator-color)}:where(.ag-filter-select) .ag-picker-field-wrapper{width:0}.ag-filter-condition-operator{height:17px}:where(.ag-ltr) .ag-filter-condition-operator-or{margin-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-filter-condition-operator-or{margin-right:calc(var(--ag-spacing)*2)}.ag-set-filter-select-all{padding-top:var(--ag-widget-container-vertical-padding)}.ag-filter-no-matches,.ag-set-filter-list{height:calc(var(--ag-list-item-height)*6)}.ag-filter-no-matches{padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding)}.ag-set-filter-tree-list{height:calc(var(--ag-list-item-height)*10)}.ag-set-filter-filter{margin-left:var(--ag-widget-container-horizontal-padding);margin-right:var(--ag-widget-container-horizontal-padding);margin-top:var(--ag-widget-container-vertical-padding)}.ag-filter-to{margin-top:var(--ag-widget-vertical-spacing)}.ag-mini-filter{margin:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding)}:where(.ag-ltr) .ag-set-filter-add-group-indent{margin-left:calc(var(--ag-icon-size) + var(--ag-widget-container-horizontal-padding))}:where(.ag-rtl) .ag-set-filter-add-group-indent{margin-right:calc(var(--ag-icon-size) + var(--ag-widget-container-horizontal-padding))}:where(.ag-filter-menu) .ag-set-filter-list{min-width:200px}.ag-filter-virtual-list-item:focus-visible{box-shadow:inset var(--ag-focus-shadow)}.ag-filter-apply-panel{display:flex;justify-content:flex-end;overflow:hidden;padding:var(--ag-widget-vertical-spacing) var(--ag-widget-container-horizontal-padding) var(--ag-widget-container-vertical-padding)}.ag-filter-apply-panel-button{line-height:1.5}:where(.ag-ltr) .ag-filter-apply-panel-button{margin-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-filter-apply-panel-button{margin-right:calc(var(--ag-spacing)*2)}.ag-simple-filter-body-wrapper{display:flex;flex-direction:column;min-height:calc(var(--ag-list-item-height) + var(--ag-widget-container-vertical-padding) + var(--ag-widget-vertical-spacing));overflow-y:auto;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);padding-bottom:calc(var(--ag-widget-container-vertical-padding) - var(--ag-widget-vertical-spacing));&>*{margin-bottom:var(--ag-widget-vertical-spacing)}:where(.ag-resizer-wrapper){margin:0}}.ag-multi-filter-menu-item{margin:var(--ag-spacing) 0}.ag-multi-filter-group-title-bar{background-color:transparent;color:var(--ag-header-text-color);font-weight:500;padding:calc(var(--ag-spacing)*1.5) var(--ag-spacing)}.ag-group-filter-field-select-wrapper{display:flex;flex-direction:column;gap:var(--ag-widget-vertical-spacing);padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding)}"
);
function qM(e) {
  const t = e.filterManager;
  return !!(t != null && t.isColumnFilterPresent()) || !!(t != null && t.isAggregateFilterPresent());
}
function XM(e, t) {
  var s;
  return ((s = e.filterManager) == null ? void 0 : s.getColumnFilterInstance(t)) ?? Promise.resolve(void 0);
}
function ZM(e, t) {
  var i;
  const s = e.colModel.getColDefCol(t);
  if (s)
    return (i = e.colFilter) == null ? void 0 : i.destroyFilter(s, "api");
}
function QM(e, t) {
  e.frameworkOverrides.wrapIncoming(() => {
    var s;
    return (s = e.filterManager) == null ? void 0 : s.setFilterModel(t);
  });
}
function JM(e) {
  var t;
  return ((t = e.filterManager) == null ? void 0 : t.getFilterModel()) ?? {};
}
function eD(e, t, s) {
  const { gos: i, colModel: r, colFilter: n } = e;
  s && !i.get("enableFilterHandlers") && (F(288), s = !1);
  const o = r.getColDefCol(t);
  return o ? (n == null ? void 0 : n.getModelForColumn(o, s)) ?? null : null;
}
function tD(e, t, s) {
  var i;
  return ((i = e.filterManager) == null ? void 0 : i.setColumnFilterModel(t, s)) ?? Promise.resolve();
}
function sD(e, t) {
  var i;
  const s = e.colModel.getCol(t);
  if (!s) {
    j(12, { colKey: t });
    return;
  }
  (i = e.menuSvc) == null || i.showFilterMenu({
    column: s,
    containerType: "columnFilter",
    positionBy: "auto"
  });
}
function iD(e) {
  var t;
  (t = e.menuSvc) == null || t.hideFilterMenu();
}
function rD(e, t) {
  var i;
  const s = e.colModel.getCol(t);
  if (!s) {
    j(12, { colKey: t });
    return;
  }
  return (i = e.colFilter) == null ? void 0 : i.getHandler(s, !0);
}
function nD(e, t) {
  const { colModel: s, colFilter: i, gos: r } = e;
  if (!r.get("enableFilterHandlers")) {
    F(287);
    return;
  }
  const { colId: n, action: o } = t;
  if (n) {
    const a = s.getColById(n);
    a && (i == null || i.updateModel(a, o));
  } else
    i == null || i.updateAllModels(o);
}
var oD = {
  filterHandler: () => ({
    doesFilterPass: () => !0
  })
}, aD = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colFilter", this.allColumnFilters = /* @__PURE__ */ new Map(), this.allColumnListeners = /* @__PURE__ */ new Map(), this.activeAggregateFilters = [], this.activeColumnFilters = [], this.processingFilterChange = !1, this.modelUpdates = [], this.columnModelUpdates = [], this.state = /* @__PURE__ */ new Map(), this.handlerMap = {
      ...Xp
    }, this.isGlobalButtons = !1, this.activeFilterComps = /* @__PURE__ */ new Set();
  }
  postConstruct() {
    var s, i;
    this.addManagedEventListeners({
      gridColumnsChanged: this.onColumnsChanged.bind(this),
      dataTypesInferred: this.processFilterModelUpdateQueue.bind(this)
    });
    const e = this.gos, t = {
      ...((i = (s = e.get("initialState")) == null ? void 0 : s.filter) == null ? void 0 : i.filterModel) ?? {}
    };
    this.initialModel = t, this.model = {
      ...t
    }, e.get("enableFilterHandlers") || delete this.handlerMap.agMultiColumnFilter;
  }
  refreshModel() {
    this.onNewRowsLoaded("rowDataUpdated");
  }
  setModel(e, t = "api", s) {
    const { colModel: i, dataTypeSvc: r, filterManager: n } = this.beans;
    if (r != null && r.isPendingInference) {
      this.modelUpdates.push({ model: e, source: t });
      return;
    }
    const o = [], a = this.getModel(!0);
    if (e) {
      const l = new Set(Object.keys(e));
      this.allColumnFilters.forEach((c, d) => {
        const h = e[d];
        o.push(this.setModelOnFilterWrapper(c, h)), l.delete(d);
      }), l.forEach((c) => {
        const d = i.getColDefCol(c) || i.getCol(c);
        if (!d) {
          F(62, { colId: c });
          return;
        }
        if (!d.isFilterAllowed()) {
          F(63, { colId: c });
          return;
        }
        const h = this.getOrCreateFilterWrapper(d, !0);
        if (!h) {
          F(64, { colId: c });
          return;
        }
        o.push(this.setModelOnFilterWrapper(h, e[c], !0));
      });
    } else
      this.model = {}, this.allColumnFilters.forEach((l) => {
        o.push(this.setModelOnFilterWrapper(l, null));
      });
    U.all(o).then(() => {
      const l = this.getModel(!0), c = [];
      this.allColumnFilters.forEach((d, h) => {
        const u = a ? a[h] : null, g = l ? l[h] : null;
        Si(u, g) || c.push(d.column);
      }), c.length > 0 ? n == null || n.onFilterChanged({ columns: c, source: t }) : s && this.updateActive("filterChanged");
    });
  }
  getModel(e) {
    var n;
    const t = {}, {
      allColumnFilters: s,
      initialModel: i,
      beans: { colModel: r }
    } = this;
    if (s.forEach((o, a) => {
      const l = this.getModelFromFilterWrapper(o);
      A(l) && (t[a] = l);
    }), !e)
      for (const o of Object.keys(i)) {
        const a = i[o];
        A(a) && !s.has(o) && ((n = r.getCol(o)) != null && n.isFilterAllowed()) && (t[o] = a);
      }
    return t;
  }
  setState(e, t, s = "api") {
    if (this.state.clear(), t)
      for (const i of Object.keys(t)) {
        const r = t[i];
        this.state.set(i, {
          model: Pe(this.model, i),
          state: r
        });
      }
    this.setModel(e, s, !0);
  }
  getState() {
    const e = this.state;
    if (!e.size)
      return;
    const t = {};
    let s = !1;
    return e.forEach((i, r) => {
      const n = i.state;
      n != null && (s = !0, t[r] = n);
    }), s ? t : void 0;
  }
  getModelFromFilterWrapper(e) {
    const s = e.column.getColId();
    if (e.isHandler)
      return Pe(this.model, s);
    const i = e.filter;
    return i ? typeof i.getModel != "function" ? (F(66), null) : i.getModel() : Pe(this.initialModel, s);
  }
  isFilterPresent() {
    return this.activeColumnFilters.length > 0;
  }
  isAggFilterPresent() {
    return !!this.activeAggregateFilters.length;
  }
  disableFilters() {
    this.initialModel = {};
    const { allColumnFilters: e } = this;
    return e.size ? (e.forEach(
      (t) => this.disposeFilterWrapper(t, "advancedFilterEnabled")
    ), !0) : !1;
  }
  updateActiveFilters() {
    const e = (c) => c ? c.isFilterActive ? c.isFilterActive() : (F(67), !1) : !1, { colModel: t, gos: s } = this.beans, i = !!sn(s), r = (c) => {
      if (!c.isPrimary())
        return !0;
      const h = !t.isPivotActive();
      return !c.isValueActive() || !h ? !1 : t.isPivotMode() ? !0 : i;
    }, n = [], o = [], a = (c, d, h) => {
      d && (r(c) ? n.push(h) : o.push(h));
    }, l = [];
    return this.allColumnFilters.forEach((c) => {
      const d = c.column, h = d.getColId();
      if (c.isHandler)
        l.push(
          U.resolve().then(() => {
            a(d, this.isHandlerActive(d), {
              colId: h,
              isHandler: !0,
              handler: c.handler,
              handlerParams: c.handlerParams
            });
          })
        );
      else {
        const u = ks(c);
        u && l.push(
          u.then((g) => {
            a(d, e(g), {
              colId: h,
              isHandler: !1,
              comp: g
            });
          })
        );
      }
    }), U.all(l).then(() => {
      this.activeAggregateFilters = n, this.activeColumnFilters = o;
    });
  }
  updateFilterFlagInColumns(e, t) {
    var i;
    const s = [];
    return this.allColumnFilters.forEach((r) => {
      const n = r.column;
      if (r.isHandler)
        s.push(
          U.resolve().then(() => {
            this.setColFilterActive(
              n,
              this.isHandlerActive(n),
              e,
              t
            );
          })
        );
      else {
        const o = ks(r);
        o && s.push(
          o.then((a) => {
            this.setColFilterActive(
              n,
              a.isFilterActive(),
              e,
              t
            );
          })
        );
      }
    }), (i = this.beans.groupFilter) == null || i.updateFilterFlags(e, t), U.all(s);
  }
  doFiltersPass(e, t, s) {
    const { data: i, aggData: r } = e, n = s ? this.activeAggregateFilters : this.activeColumnFilters, o = s ? r : i, a = this.model;
    for (let l = 0; l < n.length; l++) {
      const c = n[l], { colId: d, isHandler: h } = c;
      if (d !== t)
        if (h) {
          const { handler: u, handlerParams: g } = c;
          if (!u.doesFilterPass({
            node: e,
            data: o,
            model: Pe(a, d),
            handlerParams: g
          }))
            return !1;
        } else {
          const u = c.comp;
          if (typeof u.doesFilterPass != "function") {
            j(91);
            continue;
          }
          if (!u.doesFilterPass({ node: e, data: o }))
            return !1;
        }
    }
    return !0;
  }
  getHandlerParams(e) {
    const t = this.allColumnFilters.get(e.getColId());
    return t != null && t.isHandler ? t.handlerParams : void 0;
  }
  // sometimes (especially in React) the filter can call onFilterChanged when we are in the middle
  // of a render cycle. this would be bad, so we wait for render cycle to complete when this happens.
  // this happens in react when we change React State in the grid (eg setting RowCtrl's in RowContainer)
  // which results in React State getting applied in the main application, triggering a useEffect() to
  // be kicked off adn then the application calling the grid's API. in AG-6554, the custom filter was
  // getting it's useEffect() triggered in this way.
  callOnFilterChangedOutsideRenderCycle(e) {
    const { rowRenderer: t, filterManager: s } = this.beans, i = () => {
      this.isAlive() && (s == null || s.onFilterChanged(e));
    };
    t.isRefreshInProgress() ? setTimeout(i, 0) : i();
  }
  updateBeforeFilterChanged(e = {}) {
    const { column: t, additionalEventAttributes: s } = e, i = t == null ? void 0 : t.getColId();
    return this.updateActiveFilters().then(
      () => this.updateFilterFlagInColumns("filterChanged", s).then(() => {
        this.allColumnFilters.forEach((r) => {
          var a, l, c;
          const { column: n, isHandler: o } = r;
          i !== n.getColId() && (o && ((l = (a = r.handler).onAnyFilterChanged) == null || l.call(a)), (c = ks(r, o)) == null || c.then((d) => {
            typeof (d == null ? void 0 : d.onAnyFilterChanged) == "function" && d.onAnyFilterChanged();
          }));
        }), this.processingFilterChange = !0;
      })
    );
  }
  updateAfterFilterChanged() {
    this.processingFilterChange = !1;
  }
  isSuppressFlashingCellsBecauseFiltering() {
    return !(this.gos.get("allowShowChangeAfterFilter") ?? !1) && this.processingFilterChange;
  }
  onNewRowsLoaded(e) {
    const t = [];
    this.allColumnFilters.forEach((s) => {
      var n, o;
      const i = s.isHandler;
      i && ((o = (n = s.handler).onNewRowsLoaded) == null || o.call(n));
      const r = ks(s, i);
      r && t.push(
        r.then((a) => {
          var l;
          (l = a.onNewRowsLoaded) == null || l.call(a);
        })
      );
    }), U.all(t).then(() => this.updateActive(e, { afterDataChange: !0 }));
  }
  updateActive(e, t) {
    this.updateFilterFlagInColumns(e, t).then(() => this.updateActiveFilters());
  }
  createGetValue(e, t) {
    const { filterValueSvc: s, colModel: i } = this.beans;
    return (r, n) => {
      const o = n ? i.getCol(n) : e;
      return o ? s.getValue(o, r, t) : void 0;
    };
  }
  isFilterActive(e) {
    const t = this.cachedFilter(e);
    if (t != null && t.isHandler)
      return this.isHandlerActive(e);
    const s = t == null ? void 0 : t.filter;
    return s ? s.isFilterActive() : Pe(this.initialModel, e.getColId()) != null;
  }
  isHandlerActive(e) {
    const t = A(Pe(this.model, e.getColId()));
    if (t)
      return t;
    const s = this.beans.groupFilter;
    return s != null && s.isGroupFilter(e) ? s.isFilterActive(e) : !1;
  }
  getOrCreateFilterUi(e) {
    const t = this.getOrCreateFilterWrapper(e, !0);
    return t ? ks(t) : null;
  }
  getFilterUiForDisplay(e) {
    const t = this.getOrCreateFilterWrapper(e, !0);
    if (!t)
      return null;
    const s = ks(t);
    return s ? s.then((i) => ({
      comp: i,
      params: t.filterUi.filterParams,
      isHandler: t.isHandler
    })) : null;
  }
  getHandler(e, t) {
    const s = this.getOrCreateFilterWrapper(e, t);
    return s != null && s.isHandler ? s.handler : void 0;
  }
  getOrCreateFilterWrapper(e, t) {
    if (!e.isFilterAllowed())
      return;
    let s = this.cachedFilter(e);
    return !s && t && (s = this.createFilterWrapper(e), this.setColumnFilterWrapper(e, s)), s;
  }
  cachedFilter(e) {
    return this.allColumnFilters.get(e.getColId());
  }
  getDefaultFilter(e, t = !1) {
    return this.getDefaultFilterFromDataType(() => {
      var s;
      return (s = this.beans.dataTypeSvc) == null ? void 0 : s.getBaseDataType(e);
    }, t);
  }
  getDefaultFilterFromDataType(e, t = !1) {
    return rp(this.gos) ? t ? "agSetColumnFloatingFilter" : "agSetColumnFilter" : hd(e(), t);
  }
  getDefaultFloatingFilter(e) {
    return this.getDefaultFilter(e, !0);
  }
  createFilterComp(e, t, s, i, r, n) {
    const o = () => {
      const c = this.createFilterCompParams(e, r, n), d = i(c, r);
      return Mp(this.beans.userCompFactory, t, d, s);
    }, a = o();
    return a ? {
      compDetails: a,
      createFilterUi: (c) => (c ? o() : a).newAgStackInstance()
    } : null;
  }
  createFilterInstance(e, t, s, i) {
    var h, u;
    const r = this.beans.selectableFilter;
    r != null && r.isSelectable(t) && (t = r.getFilterDef(e, t));
    const { handler: n, handlerParams: o, handlerGenerator: a } = this.createHandler(e, t, s) ?? {}, l = this.createFilterComp(
      e,
      t,
      s,
      i,
      !!n,
      "init"
    );
    if (!l)
      return {
        compDetails: null,
        createFilterUi: null,
        handler: n,
        handlerGenerator: a,
        handlerParams: o
      };
    const { compDetails: c, createFilterUi: d } = l;
    return this.isGlobalButtons && ((u = (h = c.params) == null ? void 0 : h.buttons) != null && u.length || F(281, { colId: e.getColId() })), {
      compDetails: c,
      handler: n,
      handlerGenerator: a,
      handlerParams: o,
      createFilterUi: d
    };
  }
  createBaseFilterParams(e, t) {
    const { filterManager: s, rowModel: i } = this.beans;
    return V(this.gos, {
      column: e,
      colDef: e.getColDef(),
      getValue: this.createGetValue(e),
      doesRowPassOtherFilter: t ? () => !0 : (r) => (s == null ? void 0 : s.doesRowPassOtherFilters(e.getColId(), r)) ?? !0,
      // to avoid breaking changes to `filterParams` defined as functions
      // we need to provide the below options even though they are not valid for handlers
      rowModel: i
    });
  }
  createFilterCompParams(e, t, s, i) {
    const r = this.filterChangedCallbackFactory(e), n = this.createBaseFilterParams(e, i);
    if (n.filterChangedCallback = r, n.filterModifiedCallback = i ? () => {
    } : (o) => this.filterModified(e, o), t) {
      const o = n, a = e.getColId(), l = Pe(this.model, a);
      o.model = l, o.state = this.state.get(a) ?? {
        model: l
      }, o.onModelChange = (c, d) => {
        this.updateStoredModel(a, c), this.refreshHandlerAndUi(e, c, "ui").then(() => {
          r({ ...d, source: "columnFilter" });
        });
      }, o.onStateChange = (c) => {
        this.updateState(e, c), this.updateOrRefreshFilterUi(e);
      }, o.onAction = (c, d, h) => {
        this.updateModel(e, c, d), this.dispatchLocalEvent({
          type: "filterAction",
          column: e,
          action: c,
          event: h
        });
      }, o.getHandler = () => this.getHandler(e, !0), o.onUiChange = (c) => this.filterUiChanged(e, c), o.source = s;
    }
    return n;
  }
  createFilterUiForHandler(e, t) {
    return t ? {
      created: !1,
      create: t,
      filterParams: e.params,
      compDetails: e
    } : null;
  }
  createFilterUiLegacy(e, t, s) {
    const i = t(), r = {
      created: !0,
      create: t,
      filterParams: e.params,
      compDetails: e,
      promise: i
    };
    return i.then(s), r;
  }
  createFilterWrapper(e) {
    var a;
    const { compDetails: t, handler: s, handlerGenerator: i, handlerParams: r, createFilterUi: n } = this.createFilterInstance(
      e,
      e.getColDef(),
      this.getDefaultFilter(e),
      (l) => l
    ), o = e.getColId();
    if (s)
      return delete this.initialModel[o], (a = s.init) == null || a.call(s, {
        ...r,
        source: "init",
        model: Pe(this.model, o)
      }), {
        column: e,
        isHandler: !0,
        handler: s,
        handlerGenerator: i,
        handlerParams: r,
        filterUi: this.createFilterUiForHandler(t, n)
      };
    if (n) {
      const l = {
        column: e,
        filterUi: null,
        isHandler: !1
      };
      return l.filterUi = this.createFilterUiLegacy(t, n, (c) => {
        l.filter = c ?? void 0;
      }), l;
    }
    return {
      column: e,
      filterUi: null,
      isHandler: !1
    };
  }
  createHandlerFunc(e, t, s) {
    var g;
    const { gos: i, frameworkOverrides: r, registry: n } = this.beans;
    let o;
    const a = (p) => {
      const f = p.filter;
      if (Rp(f)) {
        const m = f.handler;
        return m || (o = f.doesFilterPass, o ? () => ({
          doesFilterPass: o
        }) : void 0);
      }
      return typeof f == "string" ? f : void 0;
    }, l = i.get("enableFilterHandlers"), c = l ? a(t) : void 0, d = (p) => () => this.createBean(n.createDynamicBean(p, !0));
    let h, u;
    if (typeof c == "string") {
      const p = (g = i.get("filterHandlers")) == null ? void 0 : g[c];
      p != null ? h = p : cS.has(c) && (h = d(c), u = c);
    } else
      h = c;
    if (!h) {
      let p;
      const { compName: f, jsComp: m, fwComp: C } = Ap(r, t);
      f ? p = f : m == null && C == null && t.filter === !0 && (p = s), u = this.handlerMap[p], u && (h = d(u));
    }
    return h ? { filterHandler: h, handlerNameOrCallback: o ?? u } : l ? (te(i) && F(277, { colId: e.getColId() }), oD) : void 0;
  }
  createHandler(e, t, s) {
    const i = this.createHandlerFunc(e, t, s);
    if (!i)
      return;
    const r = Ua(
      this.beans.userCompFactory,
      t,
      this.createFilterCompParams(e, !0, "init")
    ), { handlerNameOrCallback: n, filterHandler: o } = i, { handler: a, handlerParams: l } = this.createHandlerFromFunc(e, o, r);
    return {
      handler: a,
      handlerParams: l,
      handlerGenerator: n ?? o
    };
  }
  createHandlerFromFunc(e, t, s) {
    const i = e.getColDef(), r = t(V(this.gos, { column: e, colDef: i })), n = this.createHandlerParams(e, s);
    return { handler: r, handlerParams: n };
  }
  createHandlerParams(e, t) {
    const s = e.getColDef(), i = e.getColId(), r = this.filterChangedCallbackFactory(e);
    return V(this.gos, {
      colDef: s,
      column: e,
      getValue: this.createGetValue(e),
      doesRowPassOtherFilter: (n) => {
        var o;
        return ((o = this.beans.filterManager) == null ? void 0 : o.doesRowPassOtherFilters(i, n)) ?? !0;
      },
      onModelChange: (n, o) => {
        this.updateStoredModel(i, n), this.refreshHandlerAndUi(e, n, "handler").then(() => {
          r({ ...o, source: "columnFilter" });
        });
      },
      filterParams: t
    });
  }
  onColumnsChanged() {
    const e = [], { colModel: t, filterManager: s, groupFilter: i } = this.beans;
    this.allColumnFilters.forEach((n, o) => {
      let a;
      n.column.isPrimary() ? a = t.getColDefCol(o) : a = t.getCol(o), !(a && a === n.column) && (e.push(n.column), this.disposeFilterWrapper(n, "columnChanged"), this.disposeColumnListener(o));
    });
    const r = i && e.every((n) => i.isGroupFilter(n));
    e.length > 0 && !r && (s == null || s.onFilterChanged({ columns: e, source: "api" }));
  }
  isFilterAllowed(e) {
    if (!e.isFilterAllowed())
      return !1;
    const s = this.beans.groupFilter;
    return s != null && s.isGroupFilter(e) ? s.isFilterAllowed(e) : !0;
  }
  getFloatingFilterCompDetails(e, t) {
    const { userCompFactory: s, frameworkOverrides: i, selectableFilter: r } = this.beans, n = (u) => {
      const g = this.getOrCreateFilterUi(e);
      g != null && g.then((p) => {
        u(Mi(p));
      });
    }, o = e.getColDef(), a = r != null && r.isSelectable(o) ? r.getFilterDef(e, o) : o, l = rf(i, a, () => this.getDefaultFloatingFilter(e)) ?? "agReadOnlyFloatingFilter", c = this.gos.get("enableFilterHandlers"), d = Ua(
      s,
      a,
      this.createFilterCompParams(e, c, "init", !0)
    ), h = V(this.gos, {
      column: e,
      filterParams: d,
      currentParentModel: () => this.getCurrentFloatingFilterParentModel(e),
      parentFilterInstance: n,
      showParentFilter: t
    });
    if (c) {
      const u = h, g = e.getColId(), p = this.filterChangedCallbackFactory(e);
      u.onUiChange = (f) => this.floatingFilterUiChanged(e, f), u.model = Pe(this.model, g), u.onModelChange = (f, m) => {
        this.updateStoredModel(g, f), this.refreshHandlerAndUi(e, f, "floating", !0).then(() => {
          p({ ...m, source: "columnFilter" });
        });
      }, u.getHandler = () => this.getHandler(e, !0), u.source = "init";
    }
    return Dp(s, o, h, l);
  }
  getCurrentFloatingFilterParentModel(e) {
    return this.getModelFromFilterWrapper(this.cachedFilter(e) ?? { column: e });
  }
  destroyFilterUi(e, t, s, i) {
    if (e.isHandler) {
      const r = t.getColId();
      delete this.initialModel[r], this.state.delete(r);
      const n = e.filterUi, o = this.createFilterUiForHandler(s, i);
      e.filterUi = o, n != null && n.created && n.promise.then((a) => {
        this.destroyBean(a), this.eventSvc.dispatchEvent({
          type: "filterDestroyed",
          source: "paramsUpdated",
          column: e.column
        });
      });
    } else
      this.destroyFilter(t, "paramsUpdated");
  }
  // destroys the filter, so it no longer takes part
  destroyFilter(e, t = "api") {
    const s = e.getColId(), i = this.allColumnFilters.get(s);
    this.disposeColumnListener(s), delete this.initialModel[s], i && this.disposeFilterWrapper(i, t).then((r) => {
      var n;
      r && this.isAlive() && ((n = this.beans.filterManager) == null || n.onFilterChanged({
        columns: [e],
        source: "api"
      }));
    });
  }
  disposeColumnListener(e) {
    const t = this.allColumnListeners.get(e);
    t && (this.allColumnListeners.delete(e), t());
  }
  disposeFilterWrapper(e, t) {
    let s = !1;
    const { column: i, isHandler: r, filterUi: n } = e, o = i.getColId();
    r && (s = this.isHandlerActive(i), this.destroyBean(e.handler), delete this.model[o], this.state.delete(o));
    const a = () => {
      this.setColFilterActive(i, !1, "filterDestroyed"), this.allColumnFilters.delete(o), this.eventSvc.dispatchEvent({
        type: "filterDestroyed",
        source: t,
        column: i
      });
    };
    if (n) {
      if (n.created)
        return n.promise.then((l) => (s = r ? s : !!(l != null && l.isFilterActive()), this.destroyBean(l), a(), s));
      a();
    }
    return U.resolve(s);
  }
  filterChangedCallbackFactory(e) {
    return (t) => {
      this.callOnFilterChangedOutsideRenderCycle({
        additionalEventAttributes: t,
        columns: [e],
        column: e,
        source: (t == null ? void 0 : t.source) ?? "columnFilter"
      });
    };
  }
  filterParamsChanged(e, t = "api") {
    var m, C, v, w, b, y;
    const s = this.allColumnFilters.get(e);
    if (!s)
      return;
    const i = this.beans, r = s.column, n = r.getColDef(), o = r.isFilterAllowed(), a = this.getDefaultFilter(r), l = i.selectableFilter, c = l != null && l.isSelectable(n) ? l.getFilterDef(r, n) : n, d = o ? this.createHandlerFunc(r, c, this.getDefaultFilter(r)) : void 0, h = !!d, u = s.isHandler;
    if (u != h) {
      this.destroyFilter(r, "paramsUpdated");
      return;
    }
    const { compDetails: g, createFilterUi: p } = (o ? this.createFilterComp(r, c, a, (P) => P, h, "colDef") : null) ?? { compDetails: null, createFilterUi: null }, f = (g == null ? void 0 : g.params) ?? Ua(
      i.userCompFactory,
      c,
      this.createFilterCompParams(r, h, "colDef")
    );
    if (u) {
      const P = (d == null ? void 0 : d.handlerNameOrCallback) ?? (d == null ? void 0 : d.filterHandler), E = Pe(this.model, e);
      if (s.handlerGenerator != P) {
        const M = s.handler, { handler: T, handlerParams: G } = this.createHandlerFromFunc(
          r,
          d.filterHandler,
          f
        );
        s.handler = T, s.handlerParams = G, s.handlerGenerator = P, delete this.model[e], (m = T.init) == null || m.call(T, { ...G, source: "init", model: null }), this.destroyBean(M), E != null && ((C = this.beans.filterManager) == null || C.onFilterChanged({
          columns: [r],
          source: t
        }));
      } else {
        const M = this.createHandlerParams(r, g == null ? void 0 : g.params);
        s.handlerParams = M, (w = (v = s.handler).refresh) == null || w.call(v, {
          ...M,
          source: "colDef",
          model: E
        });
      }
    }
    if (this.areFilterCompsDifferent(((b = s.filterUi) == null ? void 0 : b.compDetails) ?? null, g) || !s.filterUi || !g) {
      this.destroyFilterUi(s, r, g, p);
      return;
    }
    s.filterUi.filterParams = f, (y = ks(s, u)) == null || y.then((P) => {
      (P != null && P.refresh ? P.refresh(f) : !0) === !1 ? this.destroyFilterUi(s, r, g, p) : this.dispatchLocalEvent({
        type: "filterParamsChanged",
        column: r,
        params: f
      });
    });
  }
  refreshHandlerAndUi(e, t, s, i) {
    const r = this.cachedFilter(e);
    if (!r)
      return i && this.getOrCreateFilterWrapper(e, !0), U.resolve();
    if (!r.isHandler)
      return U.resolve();
    const { filterUi: n, handler: o, handlerParams: a } = r;
    return Xl(
      () => {
        if (n) {
          const { created: l, filterParams: c } = n;
          if (l)
            return n.promise.then((d) => d ? { filter: d, filterParams: c } : void 0);
          n.refreshed = !0;
        }
        return U.resolve(void 0);
      },
      o,
      a,
      t,
      this.state.get(e.getColId()) ?? { model: t },
      s
    );
  }
  setColumnFilterWrapper(e, t) {
    const s = e.getColId();
    this.allColumnFilters.set(s, t), this.allColumnListeners.set(
      s,
      this.addManagedListeners(e, { colDefChanged: () => this.filterParamsChanged(s) })[0]
    );
  }
  areFilterCompsDifferent(e, t) {
    if (!t || !e)
      return !0;
    const { componentClass: s } = e, { componentClass: i } = t;
    return !(s === i || // react hooks returns new wrappers, so check nested render method
    (s == null ? void 0 : s.render) && (i == null ? void 0 : i.render) && s.render === i.render);
  }
  hasFloatingFilters() {
    return this.beans.colModel.getCols().some((t) => t.getColDef().floatingFilter);
  }
  getFilterInstance(e) {
    const t = this.beans.colModel.getColDefCol(e);
    if (!t)
      return Promise.resolve(void 0);
    const s = this.getOrCreateFilterUi(t);
    return s ? new Promise((i) => {
      s.then((r) => {
        i(Mi(r));
      });
    }) : Promise.resolve(null);
  }
  processFilterModelUpdateQueue() {
    this.modelUpdates.forEach(({ model: e, source: t }) => this.setModel(e, t)), this.modelUpdates = [], this.columnModelUpdates.forEach(({ key: e, model: t, resolve: s }) => {
      this.setModelForColumn(e, t).then(() => s());
    }), this.columnModelUpdates = [];
  }
  getModelForColumn(e, t) {
    if (t) {
      const { state: i, model: r } = this, n = e.getColId(), o = i.get(n);
      return o ? o.model ?? null : Pe(r, n);
    }
    const s = this.cachedFilter(e);
    return s ? this.getModelFromFilterWrapper(s) : null;
  }
  setModelForColumn(e, t) {
    var s;
    if ((s = this.beans.dataTypeSvc) != null && s.isPendingInference) {
      let i = () => {
      };
      const r = new Promise((n) => {
        i = n;
      });
      return this.columnModelUpdates.push({ key: e, model: t, resolve: i }), r;
    }
    return new Promise((i) => {
      this.setModelForColumnLegacy(e, t).then((r) => i(r));
    });
  }
  getStateForColumn(e) {
    return this.state.get(e) ?? {
      model: Pe(this.model, e)
    };
  }
  setModelForColumnLegacy(e, t) {
    const s = this.beans.colModel.getColDefCol(e), i = s ? this.getOrCreateFilterWrapper(s, !0) : null;
    return i ? this.setModelOnFilterWrapper(i, t) : U.resolve();
  }
  setColDefPropsForDataType(e, t, s) {
    var d;
    const i = e.filter, r = i === !0 ? this.getDefaultFilterFromDataType(() => t.baseDataType) : i;
    if (typeof r != "string")
      return;
    let n, o;
    const a = this.beans, { filterParams: l, filterValueGetter: c } = e;
    r === "agMultiColumnFilter" ? { filterParams: n, filterValueGetter: o } = ((d = a.multiFilter) == null ? void 0 : d.getParamsForDataType(
      l,
      c,
      t,
      s
    )) ?? {} : { filterParams: n, filterValueGetter: o } = dd(
      r,
      l,
      c,
      t,
      s,
      a,
      this.getLocaleTextFunc()
    ), e.filterParams = n, o && (e.filterValueGetter = o);
  }
  // additionalEventAttributes is used by provided simple floating filter, so it can add 'floatingFilter=true' to the event
  setColFilterActive(e, t, s, i) {
    e.filterActive !== t && (e.filterActive = t, e.dispatchColEvent("filterActiveChanged", s)), e.dispatchColEvent("filterChanged", s, i);
  }
  setModelOnFilterWrapper(e, t, s) {
    return new U((i) => {
      if (e.isHandler) {
        const n = e.column, o = n.getColId(), a = this.model[o];
        if (this.updateStoredModel(o, t), s && t === a) {
          i();
          return;
        }
        this.refreshHandlerAndUi(n, t, "api").then(() => i());
        return;
      }
      const r = ks(e);
      if (r) {
        r.then((n) => {
          if (typeof (n == null ? void 0 : n.setModel) != "function") {
            F(65), i();
            return;
          }
          (n.setModel(t) || U.resolve()).then(() => i());
        });
        return;
      }
      i();
    });
  }
  /** for handlers only */
  updateStoredModel(e, t) {
    A(t) ? this.model[e] = t : delete this.model[e];
    const s = this.state.get(e), i = {
      model: t,
      state: s == null ? void 0 : s.state
    };
    this.state.set(e, i);
  }
  filterModified(e, t) {
    var s;
    (s = this.getOrCreateFilterUi(e)) == null || s.then((i) => {
      this.eventSvc.dispatchEvent({
        type: "filterModified",
        column: e,
        filterInstance: i,
        ...t
      });
    });
  }
  filterUiChanged(e, t) {
    this.gos.get("enableFilterHandlers") && this.eventSvc.dispatchEvent({
      type: "filterUiChanged",
      column: e,
      ...t
    });
  }
  floatingFilterUiChanged(e, t) {
    this.gos.get("enableFilterHandlers") && this.eventSvc.dispatchEvent({
      type: "floatingFilterUiChanged",
      column: e,
      ...t
    });
  }
  updateModel(e, t, s) {
    var o;
    const i = e.getColId(), r = this.cachedFilter(e), n = () => r == null ? void 0 : r.filterUi;
    Zl(
      t,
      n,
      () => Pe(this.model, i),
      () => this.state.get(i),
      (a) => this.updateState(e, a),
      (a) => {
        var l, c;
        return (c = (l = n()) == null ? void 0 : l.filterParams) == null ? void 0 : c.onModelChange(a, s);
      },
      r != null && r.isHandler ? (o = r.handler.processModelToApply) == null ? void 0 : o.bind(r.handler) : void 0
    );
  }
  updateAllModels(e, t) {
    const s = [];
    this.allColumnFilters.forEach((i, r) => {
      var o;
      const n = this.beans.colModel.getColDefCol(r);
      n && Zl(
        e,
        () => i.filterUi,
        () => Pe(this.model, r),
        () => this.state.get(r),
        (a) => this.updateState(n, a),
        (a) => {
          this.updateStoredModel(r, a), this.dispatchLocalEvent({
            type: "filterAction",
            column: n,
            action: e
          }), s.push(this.refreshHandlerAndUi(n, a, "ui"));
        },
        i != null && i.isHandler ? (o = i.handler.processModelToApply) == null ? void 0 : o.bind(i.handler) : void 0
      );
    }), s.length && U.all(s).then(() => {
      this.callOnFilterChangedOutsideRenderCycle({
        source: "columnFilter",
        additionalEventAttributes: t,
        columns: []
      });
    });
  }
  updateOrRefreshFilterUi(e) {
    const t = e.getColId();
    Zp(
      () => {
        var s;
        return (s = this.cachedFilter(e)) == null ? void 0 : s.filterUi;
      },
      () => Pe(this.model, t),
      () => this.state.get(t)
    );
  }
  updateState(e, t) {
    this.state.set(e.getColId(), t), this.dispatchLocalEvent({
      type: "filterStateChanged",
      column: e,
      state: t
    });
  }
  // for tool panel only
  canApplyAll() {
    const { state: e, model: t, activeFilterComps: s } = this;
    for (const r of s)
      if (r.source === "COLUMN_MENU")
        return !1;
    let i = !1;
    for (const r of e.keys()) {
      const n = e.get(r);
      if (n.valid === !1)
        return !1;
      (n.model ?? null) !== Pe(t, r) && (i = !0);
    }
    return i;
  }
  hasUnappliedModel(e) {
    var i;
    const { model: t, state: s } = this;
    return (((i = s.get(e)) == null ? void 0 : i.model) ?? null) !== Pe(t, e);
  }
  setGlobalButtons(e) {
    this.isGlobalButtons = e, this.dispatchLocalEvent({
      type: "filterGlobalButtons",
      isGlobal: e
    });
  }
  shouldKeepStateOnDetach(e, t) {
    if (t === "newFiltersToolPanel")
      return !0;
    const s = this.beans.filterPanelSvc;
    return s != null && s.isActive ? !!s.getState(e.getColId()) : !1;
  }
  destroy() {
    super.destroy(), this.allColumnFilters.forEach((e) => this.disposeFilterWrapper(e, "gridDestroyed")), this.allColumnListeners.clear(), this.state.clear(), this.activeFilterComps.clear();
  }
};
function lD(e) {
  var t;
  return !!((t = e.filterManager) != null && t.isAnyFilterPresent());
}
function cD(e, t = "api") {
  var s;
  (s = e.filterManager) == null || s.onFilterChanged({ source: t });
}
var dD = class extends R {
  constructor() {
    super(...arguments), this.beanName = "filterManager", this.advFilterModelUpdateQueue = [];
  }
  wireBeans(e) {
    this.quickFilter = e.quickFilter, this.advancedFilter = e.advancedFilter, this.colFilter = e.colFilter;
  }
  postConstruct() {
    const e = this.refreshFiltersForAggregations.bind(this), t = this.updateAdvFilterColumns.bind(this);
    this.addManagedEventListeners({
      columnValueChanged: e,
      columnPivotChanged: e,
      columnPivotModeChanged: e,
      newColumnsLoaded: t,
      columnVisible: t,
      advancedFilterEnabledChanged: ({ enabled: i }) => this.onAdvFilterEnabledChanged(i),
      dataTypesInferred: this.processFilterModelUpdateQueue.bind(this)
    }), this.externalFilterPresent = this.isExternalFilterPresentCallback(), this.addManagedPropertyListeners(["isExternalFilterPresent", "doesExternalFilterPass"], () => {
      this.onFilterChanged({ source: "api" });
    }), this.updateAggFiltering(), this.addManagedPropertyListener("groupAggFiltering", () => {
      this.updateAggFiltering(), this.onFilterChanged();
    }), this.quickFilter && this.addManagedListeners(this.quickFilter, {
      quickFilterChanged: () => this.onFilterChanged({ source: "quickFilter" })
    });
    const { gos: s } = this;
    this.alwaysPassFilter = s.get("alwaysPassFilter"), this.addManagedPropertyListener("alwaysPassFilter", () => {
      this.alwaysPassFilter = s.get("alwaysPassFilter"), this.onFilterChanged({ source: "api" });
    });
  }
  isExternalFilterPresentCallback() {
    const e = this.gos.getCallback("isExternalFilterPresent");
    return typeof e == "function" && e({});
  }
  doesExternalFilterPass(e) {
    const t = this.gos.get("doesExternalFilterPass");
    return typeof t == "function" && t(e);
  }
  setFilterState(e, t, s = "api") {
    var i;
    this.isAdvFilterEnabled() || (i = this.colFilter) == null || i.setState(e, t, s);
  }
  setFilterModel(e, t = "api", s) {
    var i;
    if (this.isAdvFilterEnabled()) {
      s || this.warnAdvFilters();
      return;
    }
    (i = this.colFilter) == null || i.setModel(e, t);
  }
  getFilterModel() {
    var e;
    return ((e = this.colFilter) == null ? void 0 : e.getModel()) ?? {};
  }
  getFilterState() {
    var e;
    return (e = this.colFilter) == null ? void 0 : e.getState();
  }
  isColumnFilterPresent() {
    var e;
    return !!((e = this.colFilter) != null && e.isFilterPresent());
  }
  isAggregateFilterPresent() {
    var e;
    return !!((e = this.colFilter) != null && e.isAggFilterPresent());
  }
  isChildFilterPresent() {
    return this.isColumnFilterPresent() || this.isQuickFilterPresent() || this.externalFilterPresent || this.isAdvFilterPresent();
  }
  isAnyFilterPresent() {
    return this.isChildFilterPresent() || this.isAggregateFilterPresent();
  }
  isAdvFilterPresent() {
    return this.isAdvFilterEnabled() && this.advancedFilter.isFilterPresent();
  }
  onAdvFilterEnabledChanged(e) {
    var t, s;
    e ? (t = this.colFilter) != null && t.disableFilters() && this.onFilterChanged({ source: "advancedFilter" }) : (s = this.advancedFilter) != null && s.isFilterPresent() && (this.advancedFilter.setModel(null), this.onFilterChanged({ source: "advancedFilter" }));
  }
  isAdvFilterEnabled() {
    var e;
    return !!((e = this.advancedFilter) != null && e.isEnabled());
  }
  isAdvFilterHeaderActive() {
    return this.isAdvFilterEnabled() && this.advancedFilter.isHeaderActive();
  }
  refreshFiltersForAggregations() {
    sn(this.gos) && this.isAnyFilterPresent() && this.onFilterChanged();
  }
  onFilterChanged(e = {}) {
    const { source: t, additionalEventAttributes: s, columns: i = [] } = e;
    this.externalFilterPresent = this.isExternalFilterPresentCallback(), (this.colFilter ? this.colFilter.updateBeforeFilterChanged(e) : U.resolve()).then(() => {
      var n;
      const r = {
        source: t,
        type: "filterChanged",
        columns: i
      };
      s && Fe(r, s), this.eventSvc.dispatchEvent(r), (n = this.colFilter) == null || n.updateAfterFilterChanged();
    });
  }
  isSuppressFlashingCellsBecauseFiltering() {
    var e;
    return !!((e = this.colFilter) != null && e.isSuppressFlashingCellsBecauseFiltering());
  }
  isQuickFilterPresent() {
    var e;
    return !!((e = this.quickFilter) != null && e.isFilterPresent());
  }
  updateAggFiltering() {
    this.aggFiltering = !!sn(this.gos);
  }
  isAggregateQuickFilterPresent() {
    return this.isQuickFilterPresent() && this.shouldApplyQuickFilterAfterAgg();
  }
  isNonAggregateQuickFilterPresent() {
    return this.isQuickFilterPresent() && !this.shouldApplyQuickFilterAfterAgg();
  }
  shouldApplyQuickFilterAfterAgg() {
    return (this.aggFiltering || this.beans.colModel.isPivotMode()) && !this.gos.get("applyQuickFilterBeforePivotOrAgg");
  }
  doesRowPassOtherFilters(e, t) {
    return this.doesRowPassFilter({ rowNode: t, colIdToSkip: e });
  }
  doesRowPassAggregateFilters(e) {
    var s;
    const { rowNode: t } = e;
    return (s = this.alwaysPassFilter) != null && s.call(this, t) ? !0 : !(this.isAggregateQuickFilterPresent() && !this.quickFilter.doesRowPass(t) || this.isAggregateFilterPresent() && !this.colFilter.doFiltersPass(t, e.colIdToSkip, !0));
  }
  doesRowPassFilter(e) {
    var s;
    const { rowNode: t } = e;
    return (s = this.alwaysPassFilter) != null && s.call(this, t) ? !0 : !(this.isNonAggregateQuickFilterPresent() && !this.quickFilter.doesRowPass(t) || this.externalFilterPresent && !this.doesExternalFilterPass(t) || this.isColumnFilterPresent() && !this.colFilter.doFiltersPass(t, e.colIdToSkip) || this.isAdvFilterPresent() && !this.advancedFilter.doesFilterPass(t));
  }
  // for group filters, can change dynamically whether they are allowed or not
  isFilterAllowed(e) {
    var t;
    return this.isAdvFilterEnabled() ? !1 : !!((t = this.colFilter) != null && t.isFilterAllowed(e));
  }
  getAdvFilterModel() {
    return this.isAdvFilterEnabled() ? this.advancedFilter.getModel() : null;
  }
  setAdvFilterModel(e, t = "api") {
    var s;
    if (this.isAdvFilterEnabled()) {
      if ((s = this.beans.dataTypeSvc) != null && s.isPendingInference) {
        this.advFilterModelUpdateQueue.push(e);
        return;
      }
      this.advancedFilter.setModel(e ?? null), this.onFilterChanged({ source: t });
    }
  }
  toggleAdvFilterBuilder(e, t) {
    this.isAdvFilterEnabled() && this.advancedFilter.getCtrl().toggleFilterBuilder({ source: t, force: e });
  }
  updateAdvFilterColumns() {
    this.isAdvFilterEnabled() && this.advancedFilter.updateValidity() && this.onFilterChanged({ source: "advancedFilter" });
  }
  hasFloatingFilters() {
    var e;
    return this.isAdvFilterEnabled() ? !1 : !!((e = this.colFilter) != null && e.hasFloatingFilters());
  }
  getColumnFilterInstance(e) {
    var t;
    return this.isAdvFilterEnabled() ? (this.warnAdvFilters(), Promise.resolve(void 0)) : ((t = this.colFilter) == null ? void 0 : t.getFilterInstance(e)) ?? Promise.resolve(void 0);
  }
  warnAdvFilters() {
    F(68);
  }
  setupAdvFilterHeaderComp(e) {
    var t;
    (t = this.advancedFilter) == null || t.getCtrl().setupHeaderComp(e);
  }
  getHeaderRowCount() {
    return this.isAdvFilterHeaderActive() ? 1 : 0;
  }
  getHeaderHeight() {
    return this.isAdvFilterHeaderActive() ? this.advancedFilter.getCtrl().getHeaderHeight() : 0;
  }
  processFilterModelUpdateQueue() {
    this.advFilterModelUpdateQueue.forEach((e) => this.setAdvFilterModel(e)), this.advFilterModelUpdateQueue = [];
  }
  setColumnFilterModel(e, t) {
    var s;
    return this.isAdvFilterEnabled() ? (this.warnAdvFilters(), Promise.resolve()) : ((s = this.colFilter) == null ? void 0 : s.setModelForColumn(e, t)) ?? Promise.resolve();
  }
}, hD = class extends R {
  constructor() {
    super(...arguments), this.beanName = "filterMenuFactory";
  }
  wireBeans(e) {
    this.popupSvc = e.popupSvc;
  }
  hideActiveMenu() {
    var e;
    (e = this.hidePopup) == null || e.call(this);
  }
  showMenuAfterMouseEvent(e, t, s, i) {
    e && !e.isColumn || this.showPopup(
      e,
      (r) => {
        var n;
        (n = this.popupSvc) == null || n.positionPopupUnderMouseEvent({
          column: e,
          type: s,
          mouseEvent: t,
          ePopup: r
        });
      },
      s,
      t.target,
      Ae(this.gos),
      i
    );
  }
  showMenuAfterButtonClick(e, t, s, i) {
    if (e && !e.isColumn)
      return;
    let r = -1, n = "left";
    const o = Ae(this.gos);
    !o && this.gos.get("enableRtl") && (r = 1, n = "right");
    const a = o ? void 0 : 4 * r, l = o ? void 0 : 4;
    this.showPopup(
      e,
      (c) => {
        var d;
        (d = this.popupSvc) == null || d.positionPopupByComponent({
          type: s,
          eventSource: t,
          ePopup: c,
          nudgeX: a,
          nudgeY: l,
          alignSide: n,
          keepWithinBounds: !0,
          position: "under",
          column: e
        });
      },
      s,
      t,
      o,
      i
    );
  }
  showPopup(e, t, s, i, r, n) {
    var f;
    const o = e ? this.createBean(new bn(e, "COLUMN_MENU")) : void 0;
    if (this.activeMenu = o, !(o != null && o.hasFilter()) || !e) {
      j(57);
      return;
    }
    const a = K({
      tag: "div",
      cls: `ag-menu${r ? "" : " ag-filter-menu"}`,
      role: "presentation"
    });
    [this.tabListener] = this.addManagedElementListeners(a, {
      keydown: (m) => this.trapFocusWithin(m, a)
    }), a.appendChild(o == null ? void 0 : o.getGui());
    let l;
    const c = () => o == null ? void 0 : o.afterGuiDetached(), d = np(this.gos) ? i ?? this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody : void 0, h = (m) => {
      Bo(e, !1, "contextMenu");
      const C = m instanceof KeyboardEvent;
      if (this.tabListener && (this.tabListener = this.tabListener()), C && i && Ze(i)) {
        const v = sd(i);
        v == null || v.focus({ preventScroll: !0 });
      }
      c(), this.destroyBean(this.activeMenu), this.dispatchVisibleChangedEvent(!1, s, e), n == null || n();
    }, u = this.getLocaleTextFunc(), g = r && s !== "columnFilter" ? u("ariaLabelColumnMenu", "Column Menu") : u("ariaLabelColumnFilter", "Column Filter"), p = (f = this.popupSvc) == null ? void 0 : f.addPopup({
      modal: !0,
      eChild: a,
      closeOnEsc: !0,
      closedCallback: h,
      positionCallback: () => t(a),
      anchorToElement: d,
      ariaLabel: g
    });
    p && (this.hidePopup = l = p.hideFunc), o.afterInit().then(() => {
      t(a), o.afterGuiAttached({ container: s, hidePopup: l });
    }), Bo(e, !0, "contextMenu"), this.dispatchVisibleChangedEvent(!0, s, e);
  }
  trapFocusWithin(e, t) {
    e.key !== S.TAB || e.defaultPrevented || ze(this.beans, t, !1, e.shiftKey) || (e.preventDefault(), ye(t, e.shiftKey));
  }
  dispatchVisibleChangedEvent(e, t, s) {
    this.eventSvc.dispatchEvent({
      type: "columnMenuVisibleChanged",
      visible: e,
      switchingTab: !1,
      key: t,
      column: s ?? null,
      columnGroup: null
    });
  }
  isMenuEnabled(e) {
    return e.isFilterAllowed() && (e.getColDef().menuTabs ?? ["filterMenuTab"]).includes("filterMenuTab");
  }
  showMenuAfterContextMenuEvent() {
  }
  destroy() {
    this.destroyBean(this.activeMenu), super.destroy();
  }
}, uD = class extends R {
  constructor() {
    super(...arguments), this.beanName = "filterValueSvc";
  }
  getValue(e, t, s) {
    if (!t)
      return;
    const i = e.getColDef(), { selectableFilter: r, valueSvc: n } = this.beans, o = s ?? (r == null ? void 0 : r.getFilterValueGetter(e.getColId())) ?? i.filterValueGetter;
    return o ? this.executeFilterValueGetter(o, t.data, e, t, i) : n.getValue(e, t);
  }
  executeFilterValueGetter(e, t, s, i, r) {
    const { expressionSvc: n, valueSvc: o } = this.beans, a = V(this.gos, {
      data: t,
      node: i,
      column: s,
      colDef: r,
      getValue: o.getValueCallback.bind(o, i)
    });
    return typeof e == "function" ? e(a) : n == null ? void 0 : n.evaluate(e, a);
  }
}, gD = {
  tag: "div",
  cls: "ag-floating-filter-input",
  role: "presentation",
  children: [
    {
      tag: "ag-input-text-field",
      ref: "eFloatingFilterText"
    }
  ]
}, pD = class extends D {
  constructor() {
    super(gD, [It]), this.eFloatingFilterText = x;
  }
  init(e) {
    this.params = e;
    const t = this.beans.colNames.getDisplayNameForColumn(e.column, "header", !0);
    if (this.eFloatingFilterText.setDisabled(!0).setInputAriaLabel(`${t} ${this.getLocaleTextFunc()("ariaFilterInput", "Filter Input")}`), this.gos.get("enableFilterHandlers")) {
      const s = e, i = s.getHandler();
      if (i.getModelAsString) {
        const r = i.getModelAsString(s.model);
        this.eFloatingFilterText.setValue(r);
      }
    }
  }
  onParentModelChanged(e) {
    if (e == null) {
      this.eFloatingFilterText.setValue("");
      return;
    }
    this.params.parentFilterInstance((t) => {
      if (t.getModelAsString) {
        const s = t.getModelAsString(e);
        this.eFloatingFilterText.setValue(s);
      }
    });
  }
  refresh(e) {
    this.init(e);
  }
}, Id = class {
  constructor() {
    this.customFilterOptions = {};
  }
  init(e, t) {
    this.filterOptions = e.filterOptions ?? t, this.mapCustomOptions(), this.defaultOption = this.getDefaultItem(e.defaultOption);
  }
  refresh(e, t) {
    const s = e.filterOptions ?? t;
    this.filterOptions !== s && (this.filterOptions = s, this.customFilterOptions = {}, this.mapCustomOptions()), this.defaultOption = this.getDefaultItem(e.defaultOption);
  }
  mapCustomOptions() {
    const { filterOptions: e } = this;
    e && e.forEach((t) => {
      if (typeof t == "string")
        return;
      const s = [["displayKey"], ["displayName"], ["predicate", "test"]], i = (r) => r.some((n) => t[n] != null) ? !0 : (F(72, { keys: r }), !1);
      if (!s.every(i)) {
        this.filterOptions = e.filter((r) => r === t) || [];
        return;
      }
      this.customFilterOptions[t.displayKey] = t;
    });
  }
  getDefaultItem(e) {
    const { filterOptions: t } = this;
    if (e)
      return e;
    if (t.length >= 1) {
      const s = t[0];
      if (typeof s == "string")
        return s;
      if (s.displayKey)
        return s.displayKey;
      F(73);
    } else
      F(74);
  }
  getCustomOption(e) {
    return this.customFilterOptions[e];
  }
};
function qr(e, t, s) {
  return s == null ? e.splice(t) : e.splice(t, s);
}
function Wo(e) {
  return e == null || typeof e == "string" && e.trim().length === 0;
}
function fD(e) {
  return e === "AND" || e === "OR" ? e : "AND";
}
function mD(e, t, s) {
  if (e == null)
    return;
  const { predicate: i } = e;
  if (i != null && !t.some((r) => r == null))
    return i(t, s);
}
function CD(e, t) {
  let s = e.length;
  return s > t && (e.splice(t), F(78), s = t), s;
}
function dn(e, t) {
  const s = t.getCustomOption(e);
  if (s) {
    const { numberOfInputs: r } = s;
    return r ?? 1;
  }
  return e && ["empty", "notBlank", "blank"].indexOf(e) >= 0 ? 0 : e === "inRange" ? 2 : 1;
}
var Ld = class extends wa {
  constructor(e, t, s) {
    super(e, "simple-filter"), this.mapValuesFromModel = t, this.defaultOptions = s, this.eTypes = [], this.eJoinPanels = [], this.eJoinAnds = [], this.eJoinOrs = [], this.eConditionBodies = [], this.listener = () => this.onUiChanged(), this.lastUiCompletePosition = null, this.joinOperatorId = 0;
  }
  setParams(e) {
    super.setParams(e);
    const t = new Id();
    this.optionsFactory = t, t.init(e, this.defaultOptions), this.commonUpdateSimpleParams(e), this.createOption(), this.createMissingConditionsAndOperators();
  }
  updateParams(e, t) {
    this.optionsFactory.refresh(e, this.defaultOptions), super.updateParams(e, t), this.commonUpdateSimpleParams(e);
  }
  commonUpdateSimpleParams(e) {
    this.setNumConditions(e), this.defaultJoinOperator = fD(e.defaultJoinOperator), this.filterPlaceholder = e.filterPlaceholder, this.createFilterListOptions();
    const t = this.getGui();
    this.isReadOnly() ? t.setAttribute("tabindex", "-1") : t.removeAttribute("tabindex");
  }
  // floating filter calls this when user applies filter from floating filter
  onFloatingFilterChanged(e, t) {
    this.setTypeFromFloatingFilter(e), this.setValueFromFloatingFilter(t), this.onUiChanged("immediately", !0);
  }
  setTypeFromFloatingFilter(e) {
    this.eTypes.forEach((t, s) => {
      const i = s === 0 ? e : this.optionsFactory.defaultOption;
      t.setValue(i, !0);
    });
  }
  getModelFromUi() {
    const e = this.getUiCompleteConditions();
    return e.length === 0 ? null : this.maxNumConditions > 1 && e.length > 1 ? {
      filterType: this.filterType,
      operator: this.getJoinOperator(),
      conditions: e
    } : e[0];
  }
  getConditionTypes() {
    return this.eTypes.map((e) => e.getValue());
  }
  getConditionType(e) {
    return this.eTypes[e].getValue();
  }
  getJoinOperator() {
    const { eJoinOrs: e, defaultJoinOperator: t } = this;
    return e.length === 0 ? t : e[0].getValue() === !0 ? "OR" : "AND";
  }
  areNonNullModelsEqual(e, t) {
    const s = !e.operator, i = !t.operator;
    if (!s && i || s && !i)
      return !1;
    let n;
    if (s) {
      const o = e, a = t;
      n = this.areSimpleModelsEqual(o, a);
    } else {
      const o = e, a = t;
      n = o.operator === a.operator && Xe(
        o.conditions,
        a.conditions,
        (l, c) => this.areSimpleModelsEqual(l, c)
      );
    }
    return n;
  }
  setModelIntoUi(e, t) {
    if (e == null)
      return this.resetUiToDefaults(t), U.resolve();
    if (e.operator) {
      const i = e;
      let r = i.conditions;
      r == null && (r = [], F(77));
      const n = CD(r, this.maxNumConditions), o = this.getNumConditions();
      if (n < o)
        this.removeConditionsAndOperators(n);
      else if (n > o)
        for (let l = o; l < n; l++)
          this.createJoinOperatorPanel(), this.createOption();
      const a = i.operator === "OR";
      this.eJoinAnds.forEach((l) => l.setValue(!a, !0)), this.eJoinOrs.forEach((l) => l.setValue(a, !0)), r.forEach((l, c) => {
        this.eTypes[c].setValue(l.type, !0), this.setConditionIntoUi(l, c);
      });
    } else {
      const i = e;
      this.getNumConditions() > 1 && this.removeConditionsAndOperators(1), this.eTypes[0].setValue(i.type, !0), this.setConditionIntoUi(i, 0);
    }
    return this.lastUiCompletePosition = this.getNumConditions() - 1, this.createMissingConditionsAndOperators(), this.updateUiVisibility(), t || this.params.onUiChange(this.getUiChangeEventParams()), U.resolve();
  }
  setNumConditions(e) {
    let t = e.maxNumConditions ?? 2;
    t < 1 && (F(79), t = 1), this.maxNumConditions = t;
    let s = e.numAlwaysVisibleConditions ?? 1;
    s < 1 && (F(80), s = 1), s > t && (F(81), s = t), this.numAlwaysVisibleConditions = s;
  }
  createOption() {
    const e = this.getGui(), t = this.createManagedBean(new st());
    this.eTypes.push(t), t.addCss("ag-filter-select"), e.appendChild(t.getGui());
    const s = this.createEValue();
    this.eConditionBodies.push(s), e.appendChild(s), this.putOptionsIntoDropdown(t), this.resetType(t);
    const i = this.getNumConditions() - 1;
    this.forEachPositionInput(i, (r) => this.resetInput(r)), this.addChangedListeners(t, i);
  }
  createJoinOperatorPanel() {
    const e = K({ tag: "div", cls: "ag-filter-condition" });
    this.eJoinPanels.push(e);
    const t = this.createJoinOperator(this.eJoinAnds, e, "and"), s = this.createJoinOperator(this.eJoinOrs, e, "or");
    this.getGui().appendChild(e);
    const i = this.eJoinPanels.length - 1, r = this.joinOperatorId++;
    this.resetJoinOperatorAnd(t, i, r), this.resetJoinOperatorOr(s, i, r), this.isReadOnly() || (t.onValueChange(this.listener), s.onValueChange(this.listener));
  }
  createJoinOperator(e, t, s) {
    const i = this.createManagedBean(new ly());
    e.push(i);
    const r = "ag-filter-condition-operator";
    return i.addCss(r), i.addCss(`${r}-${s}`), t.appendChild(i.getGui()), i;
  }
  createFilterListOptions() {
    this.filterListOptions = this.optionsFactory.filterOptions.map(
      (e) => typeof e == "string" ? this.createBoilerplateListOption(e) : this.createCustomListOption(e)
    );
  }
  putOptionsIntoDropdown(e) {
    const { filterListOptions: t } = this;
    t.forEach((s) => {
      e.addOption(s);
    }), e.setDisabled(t.length <= 1);
  }
  createBoilerplateListOption(e) {
    return { value: e, text: this.translate(e) };
  }
  createCustomListOption(e) {
    const { displayKey: t } = e, s = this.optionsFactory.getCustomOption(e.displayKey);
    return {
      value: t,
      text: s ? this.getLocaleTextFunc()(s.displayKey, s.displayName) : this.translate(t)
    };
  }
  createBodyTemplate() {
    return null;
  }
  getAgComponents() {
    return [];
  }
  updateUiVisibility() {
    const e = this.getJoinOperator();
    this.updateNumConditions(), this.updateConditionStatusesAndValues(this.lastUiCompletePosition, e);
  }
  updateNumConditions() {
    let e = -1, t = !0;
    for (let s = 0; s < this.getNumConditions(); s++)
      this.isConditionUiComplete(s) ? e = s : t = !1;
    if (this.shouldAddNewConditionAtEnd(t))
      this.createJoinOperatorPanel(), this.createOption();
    else {
      const s = this.lastUiCompletePosition ?? this.getNumConditions() - 2;
      if (e < s) {
        this.removeConditionsAndOperators(s + 1);
        const i = e + 1, r = s - i;
        r > 0 && this.removeConditionsAndOperators(i, r), this.createMissingConditionsAndOperators();
      }
    }
    this.lastUiCompletePosition = e;
  }
  updateConditionStatusesAndValues(e, t) {
    this.eTypes.forEach((i, r) => {
      const n = this.isConditionDisabled(r, e);
      i.setDisabled(n || this.filterListOptions.length <= 1), r === 1 && (Fi(this.eJoinPanels[0], n), this.eJoinAnds[0].setDisabled(n), this.eJoinOrs[0].setDisabled(n));
    }), this.eConditionBodies.forEach((i, r) => {
      O(i, this.isConditionBodyVisible(r));
    });
    const s = (t ?? this.getJoinOperator()) === "OR";
    this.eJoinAnds.forEach((i) => {
      i.setValue(!s, !0);
    }), this.eJoinOrs.forEach((i) => {
      i.setValue(s, !0);
    }), this.forEachInput((i, r, n, o) => {
      this.setElementDisplayed(i, r < o), this.setElementDisabled(i, this.isConditionDisabled(n, e));
    }), this.resetPlaceholder();
  }
  shouldAddNewConditionAtEnd(e) {
    return e && this.getNumConditions() < this.maxNumConditions && !this.isReadOnly();
  }
  removeConditionsAndOperators(e, t) {
    if (e >= this.getNumConditions())
      return;
    const {
      eTypes: s,
      eConditionBodies: i,
      eJoinPanels: r,
      eJoinAnds: n,
      eJoinOrs: o
    } = this;
    this.removeComponents(s, e, t), this.removeElements(i, e, t), this.removeEValues(e, t);
    const a = Math.max(e - 1, 0);
    this.removeElements(r, a, t), this.removeComponents(n, a, t), this.removeComponents(o, a, t);
  }
  removeElements(e, t, s) {
    qr(e, t, s).forEach((r) => se(r));
  }
  removeComponents(e, t, s) {
    qr(e, t, s).forEach((r) => {
      se(r.getGui()), this.destroyBean(r);
    });
  }
  afterGuiAttached(e) {
    var t;
    if (super.afterGuiAttached(e), this.resetPlaceholder(), !(e != null && e.suppressFocus)) {
      let s;
      if (!this.isReadOnly()) {
        const i = this.getInputs(0)[0];
        i instanceof Ks && this.isConditionBodyVisible(0) ? s = i.getInputElement() : s = (t = this.eTypes[0]) == null ? void 0 : t.getFocusableElement();
      }
      (s ?? this.getGui()).focus({ preventScroll: !0 });
    }
  }
  afterGuiDetached() {
    var o;
    super.afterGuiDetached();
    const e = this.params;
    if ((o = this.beans.colFilter) != null && o.shouldKeepStateOnDetach(e.column))
      return;
    e.onStateChange({
      model: e.model
    });
    let t = -1, s = -1, i = !1;
    const r = this.getJoinOperator();
    for (let a = this.getNumConditions() - 1; a >= 0; a--)
      if (this.isConditionUiComplete(a))
        t === -1 && (t = a, s = a);
      else {
        const l = a >= this.numAlwaysVisibleConditions && !this.isConditionUiComplete(a - 1), c = a < t;
        (l || c) && (this.removeConditionsAndOperators(a, 1), i = !0, c && s--);
      }
    let n = !1;
    this.getNumConditions() < this.numAlwaysVisibleConditions && (this.createMissingConditionsAndOperators(), n = !0), this.shouldAddNewConditionAtEnd(s === this.getNumConditions() - 1) && (this.createJoinOperatorPanel(), this.createOption(), n = !0), n && this.updateConditionStatusesAndValues(s, r), i && this.updateJoinOperatorsDisabled(), this.lastUiCompletePosition = s;
  }
  getModelAsString(e) {
    var t, s;
    return ((s = (t = this.params.getHandler()) == null ? void 0 : t.getModelAsString) == null ? void 0 : s.call(t, e)) ?? "";
  }
  getPlaceholderText(e, t) {
    let s = this.translate(e);
    if (typeof this.filterPlaceholder == "function") {
      const i = this.eTypes[t].getValue(), r = this.translate(i);
      s = this.filterPlaceholder({
        filterOptionKey: i,
        filterOption: r,
        placeholder: s
      });
    } else typeof this.filterPlaceholder == "string" && (s = this.filterPlaceholder);
    return s;
  }
  // allow sub-classes to reset HTML placeholders after UI update.
  resetPlaceholder() {
    const e = this.getLocaleTextFunc();
    this.forEachInput((t, s, i, r) => {
      if (!(t instanceof Ks))
        return;
      const n = s === 0 && r > 1 ? "inRangeStart" : s === 0 ? "filterOoo" : "inRangeEnd", o = s === 0 && r > 1 ? e("ariaFilterFromValue", "Filter from value") : s === 0 ? e("ariaFilterValue", "Filter Value") : e("ariaFilterToValue", "Filter to Value");
      t.setInputPlaceholder(this.getPlaceholderText(n, i)), t.setInputAriaLabel(o);
    });
  }
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  setElementValue(e, t, s) {
    e instanceof Ks && e.setValue(t != null ? String(t) : null, !0);
  }
  setElementDisplayed(e, t) {
    Mo(e) && O(e.getGui(), t);
  }
  setElementDisabled(e, t) {
    Mo(e) && Fi(e.getGui(), t);
  }
  attachElementOnChange(e, t) {
    e instanceof Ks && e.onValueChange(t);
  }
  forEachInput(e) {
    this.getConditionTypes().forEach((t, s) => {
      this.forEachPositionTypeInput(s, t, e);
    });
  }
  forEachPositionInput(e, t) {
    const s = this.getConditionType(e);
    this.forEachPositionTypeInput(e, s, t);
  }
  forEachPositionTypeInput(e, t, s) {
    const i = dn(t, this.optionsFactory), r = this.getInputs(e);
    for (let n = 0; n < r.length; n++) {
      const o = r[n];
      o != null && s(o, n, e, i);
    }
  }
  isConditionDisabled(e, t) {
    return this.isReadOnly() ? !0 : e === 0 ? !1 : e > t + 1;
  }
  isConditionBodyVisible(e) {
    const t = this.getConditionType(e);
    return dn(t, this.optionsFactory) > 0;
  }
  // returns true if the UI represents a working filter, eg all parts are filled out.
  // eg if text filter and textfield blank then returns false.
  isConditionUiComplete(e) {
    return !(e >= this.getNumConditions() || this.getConditionType(e) === "empty" || this.getValues(e).some((s) => s == null));
  }
  getNumConditions() {
    return this.eTypes.length;
  }
  getUiCompleteConditions() {
    const e = [];
    for (let t = 0; t < this.getNumConditions(); t++)
      this.isConditionUiComplete(t) && e.push(this.createCondition(t));
    return e;
  }
  createMissingConditionsAndOperators() {
    if (!this.isReadOnly())
      for (let e = this.getNumConditions(); e < this.numAlwaysVisibleConditions; e++)
        this.createJoinOperatorPanel(), this.createOption();
  }
  resetUiToDefaults(e) {
    this.removeConditionsAndOperators(this.isReadOnly() ? 1 : this.numAlwaysVisibleConditions), this.eTypes.forEach((t) => this.resetType(t)), this.eJoinAnds.forEach(
      (t, s) => this.resetJoinOperatorAnd(t, s, this.joinOperatorId + s)
    ), this.eJoinOrs.forEach(
      (t, s) => this.resetJoinOperatorOr(t, s, this.joinOperatorId + s)
    ), this.joinOperatorId++, this.forEachInput((t) => this.resetInput(t)), this.resetPlaceholder(), this.createMissingConditionsAndOperators(), this.lastUiCompletePosition = null, this.updateUiVisibility(), e || this.params.onUiChange(this.getUiChangeEventParams());
  }
  resetType(e) {
    const s = this.getLocaleTextFunc()("ariaFilteringOperator", "Filtering operator");
    e.setValue(this.optionsFactory.defaultOption, !0).setAriaLabel(s).setDisabled(this.isReadOnly() || this.filterListOptions.length <= 1);
  }
  resetJoinOperatorAnd(e, t, s) {
    this.resetJoinOperator(
      e,
      t,
      this.defaultJoinOperator === "AND",
      this.translate("andCondition"),
      s
    );
  }
  resetJoinOperatorOr(e, t, s) {
    this.resetJoinOperator(
      e,
      t,
      this.defaultJoinOperator === "OR",
      this.translate("orCondition"),
      s
    );
  }
  resetJoinOperator(e, t, s, i, r) {
    this.updateJoinOperatorDisabled(
      e.setValue(s, !0).setName(`ag-simple-filter-and-or-${this.getCompId()}-${r}`).setLabel(i),
      t
    );
  }
  updateJoinOperatorsDisabled() {
    const e = (t, s) => this.updateJoinOperatorDisabled(t, s);
    this.eJoinAnds.forEach(e), this.eJoinOrs.forEach(e);
  }
  updateJoinOperatorDisabled(e, t) {
    e.setDisabled(this.isReadOnly() || t > 0);
  }
  resetInput(e) {
    this.setElementValue(e, null), this.setElementDisabled(e, this.isReadOnly());
  }
  // puts model values into the UI
  setConditionIntoUi(e, t) {
    const s = this.mapValuesFromModel(e, this.optionsFactory);
    this.forEachInput((i, r, n) => {
      n === t && this.setElementValue(i, s[r] != null ? s[r] : null);
    });
  }
  // after floating filter changes, this sets the 'value' section. this is implemented by the base class
  // (as that's where value is controlled), the 'type' part from the floating filter is dealt with in this class.
  setValueFromFloatingFilter(e) {
    this.forEachInput((t, s, i) => {
      this.setElementValue(t, s === 0 && i === 0 ? e : null, !0);
    });
  }
  addChangedListeners(e, t) {
    this.isReadOnly() || (e.onValueChange(this.listener), this.forEachPositionInput(t, (s) => {
      this.attachElementOnChange(s, this.listener);
    }));
  }
  hasInvalidInputs() {
    return !1;
  }
  isReadOnly() {
    return !!this.params.readOnly;
  }
}, pm = class {
  constructor(e, t, s, i, r, n) {
    this.alive = !0, this.context = e, this.eParent = r;
    const o = Kb(t, s, i);
    o && o.newAgStackInstance().then((a) => {
      var d, h;
      if (!this.alive) {
        e.destroyBean(a);
        return;
      }
      if (this.dateComp = a, !a)
        return;
      r.appendChild(a.getGui()), (d = a == null ? void 0 : a.afterGuiAttached) == null || d.call(a);
      const { tempValue: l, disabled: c } = this;
      l && a.setDate(l), c != null && ((h = a.setDisabled) == null || h.call(a, c)), n == null || n(this);
    });
  }
  destroy() {
    this.alive = !1, this.dateComp = this.context.destroyBean(this.dateComp);
  }
  getDate() {
    return this.dateComp ? this.dateComp.getDate() : this.tempValue;
  }
  setDate(e) {
    const t = this.dateComp;
    t ? t.setDate(e) : this.tempValue = e;
  }
  setDisabled(e) {
    var s;
    const t = this.dateComp;
    t ? (s = t.setDisabled) == null || s.call(t, e) : this.disabled = e;
  }
  setDisplayed(e) {
    O(this.eParent, e);
  }
  setInputPlaceholder(e) {
    var t, s;
    (s = (t = this.dateComp) == null ? void 0 : t.setInputPlaceholder) == null || s.call(t, e);
  }
  setInputAriaLabel(e) {
    var t, s;
    (s = (t = this.dateComp) == null ? void 0 : t.setInputAriaLabel) == null || s.call(t, e);
  }
  afterGuiAttached(e) {
    var t, s;
    (s = (t = this.dateComp) == null ? void 0 : t.afterGuiAttached) == null || s.call(t, e);
  }
  updateParams(e) {
    var t, s;
    (s = (t = this.dateComp) == null ? void 0 : t.refresh) == null || s.call(t, e);
  }
}, kd = [
  "equals",
  "notEqual",
  "lessThan",
  "greaterThan",
  "inRange",
  "blank",
  "notBlank"
];
function fm(e, t) {
  const { dateFrom: s, dateTo: i, type: r } = e || {};
  return [
    s && ke(s, void 0, !0) || null,
    i && ke(i, void 0, !0) || null
  ].slice(0, dn(r, t));
}
var gu = 1e3, pu = 1 / 0, vD = class extends Ld {
  constructor() {
    super("dateFilter", fm, kd), this.eConditionPanelsFrom = [], this.eConditionPanelsTo = [], this.dateConditionFromComps = [], this.dateConditionToComps = [], this.minValidYear = gu, this.maxValidYear = pu, this.minValidDate = null, this.maxValidDate = null, this.filterType = "date";
  }
  afterGuiAttached(e) {
    super.afterGuiAttached(e), this.dateConditionFromComps[0].afterGuiAttached(e);
  }
  commonUpdateSimpleParams(e) {
    super.commonUpdateSimpleParams(e);
    const t = (l, c) => {
      const d = e[l];
      if (d != null)
        if (isNaN(d))
          F(82, { param: l });
        else
          return d == null ? c : Number(d);
      return c;
    }, s = t("minValidYear", gu), i = t("maxValidYear", pu);
    this.minValidYear = s, this.maxValidYear = i, s > i && F(83);
    const { minValidDate: r, maxValidDate: n } = e, o = r instanceof Date ? r : ke(r);
    this.minValidDate = o;
    const a = n instanceof Date ? n : ke(n);
    this.maxValidDate = a, o && a && o > a && F(84);
  }
  createDateCompWrapper(e) {
    const {
      beans: { userCompFactory: t, context: s, gos: i },
      params: r
    } = this, n = new pm(
      s,
      t,
      r.colDef,
      V(i, {
        onDateChanged: () => this.onUiChanged(),
        filterParams: r,
        location: "filter"
      }),
      e
    );
    return this.addDestroyFunc(() => n.destroy()), n;
  }
  setElementValue(e, t) {
    e.setDate(t);
  }
  setElementDisplayed(e, t) {
    e.setDisplayed(t);
  }
  setElementDisabled(e, t) {
    e.setDisabled(t);
  }
  createEValue() {
    const e = K({ tag: "div", cls: "ag-filter-body" });
    return this.createFromToElement(e, this.eConditionPanelsFrom, this.dateConditionFromComps, "from"), this.createFromToElement(e, this.eConditionPanelsTo, this.dateConditionToComps, "to"), e;
  }
  createFromToElement(e, t, s, i) {
    const r = K({ tag: "div", cls: `ag-filter-${i} ag-filter-date-${i}` });
    t.push(r), e.appendChild(r), s.push(this.createDateCompWrapper(r));
  }
  removeEValues(e, t) {
    this.removeDateComps(this.dateConditionFromComps, e, t), this.removeDateComps(this.dateConditionToComps, e, t), qr(this.eConditionPanelsFrom, e, t), qr(this.eConditionPanelsTo, e, t);
  }
  removeDateComps(e, t, s) {
    qr(e, t, s).forEach((r) => r.destroy());
  }
  isValidDateValue(e) {
    if (e === null)
      return !1;
    const { minValidDate: t, maxValidDate: s, minValidYear: i, maxValidYear: r } = this;
    if (t) {
      if (e < t)
        return !1;
    } else if (e.getUTCFullYear() < i)
      return !1;
    if (s) {
      if (e > s)
        return !1;
    } else if (e.getUTCFullYear() > r)
      return !1;
    return !0;
  }
  isConditionUiComplete(e) {
    if (!super.isConditionUiComplete(e))
      return !1;
    let t = !0;
    return this.forEachInput((s, i, r, n) => {
      r !== e || !t || i >= n || (t = t && this.isValidDateValue(s.getDate()));
    }), t;
  }
  areSimpleModelsEqual(e, t) {
    return e.dateFrom === t.dateFrom && e.dateTo === t.dateTo && e.type === t.type;
  }
  createCondition(e) {
    const t = this.getConditionType(e), s = {}, i = this.getValues(e), r = this.params.useIsoSeparator ? "T" : " ";
    return i.length > 0 && (s.dateFrom = tt(i[0], !0, r)), i.length > 1 && (s.dateTo = tt(i[1], !0, r)), {
      dateFrom: null,
      dateTo: null,
      filterType: this.filterType,
      type: t,
      ...s
    };
  }
  resetPlaceholder() {
    const e = this.getLocaleTextFunc(), t = this.translate("dateFormatOoo"), s = e("ariaFilterValue", "Filter Value");
    this.forEachInput((i) => {
      i.setInputPlaceholder(t), i.setInputAriaLabel(s);
    });
  }
  getInputs(e) {
    const { dateConditionFromComps: t, dateConditionToComps: s } = this;
    return e >= t.length ? [null, null] : [t[e], s[e]];
  }
  getValues(e) {
    const t = [];
    return this.forEachPositionInput(e, (s, i, r, n) => {
      i < n && t.push(s.getDate());
    }), t;
  }
  translate(e) {
    return e === "lessThan" ? super.translate("before") : e === "greaterThan" ? super.translate("after") : super.translate(e);
  }
}, mm = class extends R {
  constructor(e, t) {
    super(), this.mapValuesFromModel = e, this.defaultOptions = t;
  }
  init(e) {
    const t = e.filterParams, s = new Id();
    this.optionsFactory = s, s.init(t, this.defaultOptions), this.filterModelFormatter = this.createManagedBean(
      new this.FilterModelFormatterClass(s, t)
    ), this.updateParams(e), this.validateModel(e);
  }
  refresh(e) {
    if (e.source === "colDef") {
      const t = e.filterParams, s = this.optionsFactory;
      s.refresh(t, this.defaultOptions), this.filterModelFormatter.updateParams({ optionsFactory: s, filterParams: t }), this.updateParams(e);
    }
    this.validateModel(e);
  }
  updateParams(e) {
    this.params = e;
  }
  doesFilterPass(e) {
    const t = e.model;
    if (t == null)
      return !0;
    const { operator: s } = t, i = [];
    if (s) {
      const o = t;
      i.push(...o.conditions ?? []);
    } else
      i.push(t);
    const r = s && s === "OR" ? "some" : "every", n = this.params.getValue(e.node);
    return i[r]((o) => this.individualConditionPasses(e, o, n));
  }
  getModelAsString(e, t) {
    return this.filterModelFormatter.getModelAsString(e, t) ?? "";
  }
  validateModel(e) {
    const {
      model: t,
      filterParams: { filterOptions: s, maxNumConditions: i }
    } = e;
    if (t == null)
      return;
    let n = sf(t) ? t.conditions : [t];
    const o = (s == null ? void 0 : s.map((d) => typeof d == "string" ? d : d.displayKey)) ?? this.defaultOptions;
    if (!(!n || n.every((d) => o.find((h) => h === d.type) !== void 0))) {
      this.params = {
        ...e,
        model: null
      }, e.onModelChange(null);
      return;
    }
    let l = !1;
    const c = this.filterType;
    if ((n && !n.every((d) => d.filterType === c) || t.filterType !== c) && (n = n.map((d) => ({ ...d, filterType: c })), l = !0), typeof i == "number" && n && n.length > i && (n = n.slice(0, i), l = !0), l) {
      const d = n.length > 1 ? {
        ...t,
        filterType: c,
        conditions: n
      } : {
        ...n[0],
        filterType: c
      };
      this.params = {
        ...e,
        model: d
      }, e.onModelChange(d);
      return;
    }
  }
  /** returns true if the row passes the said condition */
  individualConditionPasses(e, t, s) {
    const i = this.optionsFactory, r = this.mapValuesFromModel(t, i), n = i.getCustomOption(t.type), o = mD(n, r, s);
    return o ?? (s == null ? this.evaluateNullValue(t.type) : this.evaluateNonNullValue(r, s, t, e));
  }
}, Cm = class extends mm {
  evaluateNullValue(e) {
    const {
      includeBlanksInEquals: t,
      includeBlanksInNotEqual: s,
      includeBlanksInGreaterThan: i,
      includeBlanksInLessThan: r,
      includeBlanksInRange: n
    } = this.params.filterParams;
    switch (e) {
      case "equals":
        if (t)
          return !0;
        break;
      case "notEqual":
        if (s)
          return !0;
        break;
      case "greaterThan":
      case "greaterThanOrEqual":
        if (i)
          return !0;
        break;
      case "lessThan":
      case "lessThanOrEqual":
        if (r)
          return !0;
        break;
      case "inRange":
        if (n)
          return !0;
        break;
      case "blank":
        return !0;
      case "notBlank":
        return !1;
    }
    return !1;
  }
  evaluateNonNullValue(e, t, s) {
    const i = s.type;
    if (!this.isValid(t))
      return i === "notEqual" || i === "notBlank";
    const r = this.comparator(), n = e[0] != null ? r(e[0], t) : 0;
    switch (i) {
      case "equals":
        return n === 0;
      case "notEqual":
        return n !== 0;
      case "greaterThan":
        return n > 0;
      case "greaterThanOrEqual":
        return n >= 0;
      case "lessThan":
        return n < 0;
      case "lessThanOrEqual":
        return n <= 0;
      case "inRange": {
        const o = r(e[1], t);
        return this.params.filterParams.inRangeInclusive ? n >= 0 && o <= 0 : n > 0 && o < 0;
      }
      case "blank":
        return Wo(t);
      case "notBlank":
        return !Wo(t);
      default:
        return F(76, { filterModelType: i }), !0;
    }
  }
}, vm = {
  equals: "Equals",
  notEqual: "NotEqual",
  greaterThan: "GreaterThan",
  greaterThanOrEqual: "GreaterThanOrEqual",
  lessThan: "LessThan",
  lessThanOrEqual: "LessThanOrEqual",
  inRange: "InRange"
}, wD = {
  contains: "Contains",
  notContains: "NotContains",
  equals: "TextEquals",
  notEqual: "TextNotEqual",
  startsWith: "StartsWith",
  endsWith: "EndsWith",
  inRange: "InRange"
}, Gd = class extends R {
  constructor(e, t, s) {
    super(), this.optionsFactory = e, this.filterParams = t, this.valueFormatter = s;
  }
  // used by:
  // 1) NumberFloatingFilter & TextFloatingFilter: Always, for both when editable and read only.
  // 2) DateFloatingFilter: Only when read only (as we show text rather than a date picker when read only)
  getModelAsString(e, t) {
    const s = this.getLocaleTextFunc(), i = t === "filterToolPanel";
    if (!e)
      return i ? vs(this, "filterSummaryInactive") : null;
    if (e.operator != null) {
      const n = e, a = (n.conditions ?? []).map((c) => this.getModelAsString(c, t)), l = n.operator === "AND" ? "andCondition" : "orCondition";
      return a.join(` ${vs(this, l)} `);
    } else {
      if (e.type === "blank" || e.type === "notBlank")
        return i ? vs(this, e.type === "blank" ? "filterSummaryBlank" : "filterSummaryNotBlank") : s(e.type, e.type);
      {
        const n = e, o = this.optionsFactory.getCustomOption(n.type), { displayKey: a, displayName: l, numberOfInputs: c } = o || {};
        return a && l && c === 0 ? s(a, l) : this.conditionToString(
          n,
          i,
          n.type === "inRange" || c === 2,
          a,
          l
        );
      }
    }
  }
  updateParams(e) {
    const { optionsFactory: t, filterParams: s } = e;
    this.optionsFactory = t, this.filterParams = s;
  }
  conditionForToolPanel(e, t, s, i, r, n) {
    let o;
    const a = this.getTypeKey(e);
    return a && (o = vs(this, a)), r && n && (o = this.getLocaleTextFunc()(r, n)), o != null ? t ? `${o} ${vs(this, "filterSummaryInRangeValues", [s(), i()])}` : `${o} ${s()}` : null;
  }
  getTypeKey(e) {
    const t = this.filterTypeKeys[e];
    return t ? `filterSummary${t}` : null;
  }
  formatValue(e) {
    const t = this.valueFormatter;
    return t ? t(e ?? null) ?? "" : String(e);
  }
}, wm = class extends Gd {
  constructor(e, t) {
    super(e, t, (s) => {
      const { dataTypeSvc: i, valueSvc: r } = this.beans, n = t.column, o = i == null ? void 0 : i.getDateFormatterFunction(n), a = o == null ? void 0 : o(s ?? void 0);
      return r.formatValue(n, null, a);
    }), this.filterTypeKeys = vm;
  }
  conditionToString(e, t, s, i, r) {
    const { type: n } = e, o = ke(e.dateFrom), a = ke(e.dateTo), l = this.filterParams.inRangeFloatingFilterDateFormat, c = t ? this.formatValue.bind(this) : (u) => jl(u, l), d = () => o !== null ? c(o) : "null", h = () => a !== null ? c(a) : "null";
    if (t) {
      const u = this.conditionForToolPanel(
        n,
        s,
        d,
        h,
        i,
        r
      );
      if (u != null)
        return u;
    }
    return s ? `${d()}-${h()}` : o != null ? c(o) : `${n}`;
  }
};
function bD(e, t) {
  const s = t;
  return s < e ? -1 : s > e ? 1 : 0;
}
var yD = class extends Cm {
  constructor() {
    super(fm, kd), this.filterType = "date", this.FilterModelFormatterClass = wm;
  }
  comparator() {
    return this.params.filterParams.comparator ?? bD;
  }
  isValid(e) {
    const t = this.params.filterParams.isValidDate;
    return !t || t(e);
  }
}, bm = class extends D {
  constructor() {
    super(...arguments), this.defaultDebounceMs = 0;
  }
  setLastTypeFromModel(e) {
    if (!e) {
      this.lastType = this.optionsFactory.defaultOption;
      return;
    }
    const t = e.operator;
    let s;
    t ? s = e.conditions[0] : s = e, this.lastType = s.type;
  }
  canWeEditAfterModelFromParentFilter(e) {
    if (!e)
      return this.isTypeEditable(this.lastType);
    if (e.operator)
      return !1;
    const s = e;
    return this.isTypeEditable(s.type);
  }
  init(e) {
    this.params = e;
    const t = this.gos.get("enableFilterHandlers");
    if (this.reactive = t, this.setParams(e), t) {
      const s = e;
      this.onModelUpdated(s.model);
    }
  }
  setParams(e) {
    const t = new Id();
    this.optionsFactory = t, t.init(e.filterParams, this.defaultOptions), this.filterModelFormatter = this.createManagedBean(
      new this.FilterModelFormatterClass(t, e.filterParams)
    ), this.setSimpleParams(e, !1);
  }
  setSimpleParams(e, t = !0) {
    const s = this.optionsFactory.defaultOption;
    t || (this.lastType = s), this.readOnly = !!e.filterParams.readOnly;
    const i = this.isTypeEditable(s);
    this.setEditable(i);
  }
  refresh(e) {
    this.params = e;
    const t = e, s = this.reactive;
    if ((!s || t.source === "colDef") && this.updateParams(e), s) {
      const { source: i, model: r } = t;
      if (i === "dataChanged" || i === "ui")
        return;
      this.onModelUpdated(r);
    }
  }
  updateParams(e) {
    const t = this.optionsFactory;
    t.refresh(e.filterParams, this.defaultOptions), this.setSimpleParams(e), this.filterModelFormatter.updateParams({
      optionsFactory: t,
      filterParams: e.filterParams
    });
  }
  onParentModelChanged(e, t) {
    t != null && t.afterFloatingFilter || t != null && t.afterDataChange || this.onModelUpdated(e);
  }
  hasSingleInput(e) {
    var s;
    const t = (s = this.optionsFactory.getCustomOption(e)) == null ? void 0 : s.numberOfInputs;
    return t == null || t == 1;
  }
  isTypeEditable(e) {
    const t = ["inRange", "empty", "blank", "notBlank"];
    return !!e && !this.readOnly && this.hasSingleInput(e) && t.indexOf(e) < 0;
  }
  getAriaLabel(e) {
    return `${this.beans.colNames.getDisplayNameForColumn(e.column, "header", !0)} ${this.getLocaleTextFunc()("ariaFilterInput", "Filter Input")}`;
  }
}, SD = {
  tag: "div",
  cls: "ag-floating-filter-input",
  role: "presentation",
  children: [
    {
      tag: "ag-input-text-field",
      ref: "eReadOnlyText"
    },
    { tag: "div", ref: "eDateWrapper", cls: "ag-date-floating-filter-wrapper" }
  ]
}, xD = class extends bm {
  constructor() {
    super(SD, [It]), this.eReadOnlyText = x, this.eDateWrapper = x, this.FilterModelFormatterClass = wm, this.filterType = "date", this.defaultOptions = kd;
  }
  setParams(e) {
    super.setParams(e), this.createDateComponent();
    const t = this.getLocaleTextFunc();
    this.eReadOnlyText.setDisabled(!0).setInputAriaLabel(t("ariaDateFilterInput", "Date Filter Input"));
  }
  updateParams(e) {
    super.updateParams(e), this.dateComp.updateParams(this.getDateComponentParams()), this.updateCompOnModelChange(e.currentParentModel());
  }
  updateCompOnModelChange(e) {
    const t = !this.readOnly && this.canWeEditAfterModelFromParentFilter(e);
    if (this.setEditable(t), t) {
      const s = e ? ke(e.dateFrom) : null;
      this.dateComp.setDate(s), this.eReadOnlyText.setValue("");
    } else
      this.eReadOnlyText.setValue(this.filterModelFormatter.getModelAsString(e)), this.dateComp.setDate(null);
  }
  setEditable(e) {
    O(this.eDateWrapper, e), O(this.eReadOnlyText.getGui(), !e);
  }
  onModelUpdated(e) {
    super.setLastTypeFromModel(e), this.updateCompOnModelChange(e);
  }
  onDateChanged() {
    const e = this.dateComp.getDate();
    if (this.reactive) {
      const t = this.params;
      t.onUiChange();
      const s = t.model, i = tt(e), r = i == null ? null : {
        ...s ?? {
          filterType: this.filterType,
          type: this.lastType ?? this.optionsFactory.defaultOption
        },
        dateFrom: i
      };
      t.onModelChange(r, { afterFloatingFilter: !0 });
    } else
      this.params.parentFilterInstance((t) => {
        t == null || t.onFloatingFilterChanged(this.lastType || null, e);
      });
  }
  getDateComponentParams() {
    const { filterParams: e } = this.params, t = cd(e, this.defaultDebounceMs);
    return V(this.gos, {
      onDateChanged: pe(this, this.onDateChanged.bind(this), t),
      filterParams: e,
      location: "floatingFilter"
    });
  }
  createDateComponent() {
    const {
      beans: { context: e, userCompFactory: t },
      eDateWrapper: s,
      params: i
    } = this;
    this.dateComp = new pm(
      e,
      t,
      i.column.getColDef(),
      this.getDateComponentParams(),
      s,
      (r) => {
        r.setInputAriaLabel(this.getAriaLabel(i));
      }
    ), this.addDestroyFunc(() => this.dateComp.destroy());
  }
}, FD = {
  tag: "div",
  cls: "ag-filter-filter",
  children: [
    {
      tag: "ag-input-text-field",
      ref: "eDateInput",
      cls: "ag-date-filter"
    }
  ]
}, RD = class extends D {
  constructor() {
    super(FD, [It]), this.eDateInput = x, this.isApply = !1, this.applyOnFocusOut = !1;
  }
  init(e) {
    this.params = e, this.setParams(e);
    const t = this.eDateInput.getInputElement();
    this.addManagedListeners(t, {
      // ensures that the input element is focussed when a clear button is clicked,
      // unless using safari as there is no clear button and focus does not work properly
      mouseDown: () => {
        this.eDateInput.isDisabled() || this.usingSafariDatePicker || t.focus({ preventScroll: !0 });
      },
      input: this.handleInput.bind(this, !1),
      change: this.handleInput.bind(this, !0),
      focusout: this.handleFocusOut.bind(this)
    });
  }
  handleInput(e) {
    if (!this.eDateInput.isDisabled()) {
      if (this.isApply) {
        this.applyOnFocusOut = !e, e && this.params.onDateChanged();
        return;
      }
      e || this.params.onDateChanged();
    }
  }
  handleFocusOut() {
    this.applyOnFocusOut && (this.applyOnFocusOut = !1, this.params.onDateChanged());
  }
  setParams(e) {
    var u;
    const t = this.eDateInput.getInputElement(), s = this.shouldUseBrowserDatePicker(e);
    this.usingSafariDatePicker = s && As();
    const { minValidYear: i, maxValidYear: r, minValidDate: n, maxValidDate: o, buttons: a, includeTime: l, colDef: c } = e.filterParams || {}, d = this.beans.dataTypeSvc, h = l ?? ((u = d == null ? void 0 : d.getDateIncludesTimeFlag) == null ? void 0 : u.call(d, c.cellDataType)) ?? !1;
    if (s ? h ? (t.type = "datetime-local", t.step = "1") : t.type = "date" : t.type = "text", n && i && F(85), o && r && F(86), n && o) {
      const [g, p] = [n, o].map(
        (f) => f instanceof Date ? f : ke(f)
      );
      g && p && g.getTime() > p.getTime() && F(87);
    }
    n ? n instanceof Date ? t.min = jl(n) : t.min = n : i && (t.min = `${i}-01-01`), o ? o instanceof Date ? t.max = jl(o) : t.max = o : r && (t.max = `${r}-12-31`), this.isApply = e.location === "floatingFilter" && !!(a != null && a.includes("apply"));
  }
  refresh(e) {
    this.params = e, this.setParams(e);
  }
  getDate() {
    return ke(this.eDateInput.getValue());
  }
  setDate(e) {
    var i;
    const t = this.params.filterParams.colDef.cellDataType, s = ((i = this.beans.dataTypeSvc) == null ? void 0 : i.getDateIncludesTimeFlag(t)) ?? !1;
    this.eDateInput.setValue(tt(e, s));
  }
  setInputPlaceholder(e) {
    this.eDateInput.setInputPlaceholder(e);
  }
  setInputAriaLabel(e) {
    this.eDateInput.setAriaLabel(e);
  }
  setDisabled(e) {
    this.eDateInput.setDisabled(e);
  }
  afterGuiAttached(e) {
    (!e || !e.suppressFocus) && this.eDateInput.getInputElement().focus({ preventScroll: !0 });
  }
  shouldUseBrowserDatePicker(e) {
    var t;
    return ((t = e == null ? void 0 : e.filterParams) == null ? void 0 : t.browserDatePicker) ?? !0;
  }
}, Od = [
  "equals",
  "notEqual",
  "greaterThan",
  "greaterThanOrEqual",
  "lessThan",
  "lessThanOrEqual",
  "inRange",
  "blank",
  "notBlank"
];
function uc(e) {
  const { allowedCharPattern: t } = e ?? {};
  return t ?? null;
}
function gc(e) {
  return e == null || isNaN(e) ? null : e;
}
function ym(e, t) {
  const { filter: s, filterTo: i, type: r } = e || {};
  return [gc(s), gc(i)].slice(
    0,
    dn(r, t)
  );
}
var PD = class extends Ld {
  constructor() {
    super("numberFilter", ym, Od), this.eValuesFrom = [], this.eValuesTo = [], this.filterType = "number", this.defaultDebounceMs = 500;
  }
  setElementValue(e, t, s) {
    const { numberFormatter: i } = this.params, r = !s && i ? i(t ?? null) : t;
    super.setElementValue(e, r);
  }
  createEValue() {
    const e = uc(this.params), t = K({ tag: "div", cls: "ag-filter-body", role: "presentation" });
    return this.createFromToElement(t, this.eValuesFrom, "from", e), this.createFromToElement(t, this.eValuesTo, "to", e), t;
  }
  createFromToElement(e, t, s, i) {
    const r = this.createManagedBean(
      i ? new yt({ allowedCharPattern: i }) : new ga()
    );
    r.addCss(`ag-filter-${s}`), r.addCss("ag-filter-filter"), t.push(r), e.appendChild(r.getGui());
  }
  removeEValues(e, t) {
    const s = (i) => this.removeComponents(i, e, t);
    s(this.eValuesFrom), s(this.eValuesTo);
  }
  getValues(e) {
    const t = [];
    return this.forEachPositionInput(e, (s, i, r, n) => {
      i < n && t.push(gc(this.stringToFloat(s.getValue())));
    }), t;
  }
  areSimpleModelsEqual(e, t) {
    return e.filter === t.filter && e.filterTo === t.filterTo && e.type === t.type;
  }
  stringToFloat(e) {
    if (typeof e == "number")
      return e;
    let t = Ce(e);
    t != null && t.trim() === "" && (t = null);
    const s = this.params.numberParser;
    return s ? s(t) : t == null || t.trim() === "-" ? null : parseFloat(t);
  }
  createCondition(e) {
    const t = this.getConditionType(e), s = {
      filterType: this.filterType,
      type: t
    }, i = this.getValues(e);
    return i.length > 0 && (s.filter = i[0]), i.length > 1 && (s.filterTo = i[1]), s;
  }
  getInputs(e) {
    const { eValuesFrom: t, eValuesTo: s } = this;
    return e >= t.length ? [null, null] : [t[e], s[e]];
  }
  hasInvalidInputs() {
    let e = !1;
    return this.forEachInput((t) => {
      if (!t.getInputElement().validity.valid) {
        e = !0;
        return;
      }
    }), e;
  }
}, Sm = class extends Gd {
  constructor(e, t) {
    super(e, t, t.numberFormatter), this.filterTypeKeys = vm;
  }
  conditionToString(e, t, s, i, r) {
    const { filter: n, filterTo: o, type: a } = e, l = this.formatValue.bind(this);
    if (t) {
      const c = this.conditionForToolPanel(
        a,
        s,
        () => l(n),
        () => l(o),
        i,
        r
      );
      if (c != null)
        return c;
    }
    return s ? `${l(n)}-${l(o)}` : n != null ? l(n) : `${a}`;
  }
}, ED = class extends Cm {
  constructor() {
    super(ym, Od), this.filterType = "number", this.FilterModelFormatterClass = Sm;
  }
  comparator() {
    return (e, t) => e === t ? 0 : e < t ? 1 : -1;
  }
  isValid(e) {
    return !isNaN(e);
  }
}, xm = class extends R {
  constructor(e) {
    super(), this.params = e, this.eInput = x, this.onValueChanged = () => {
    };
  }
  setupGui(e) {
    var i;
    this.eInput = this.createManagedBean(new yt((i = this.params) == null ? void 0 : i.config));
    const t = this.eInput.getGui();
    e.appendChild(t);
    const s = (r) => this.onValueChanged(r);
    this.addManagedListeners(t, {
      input: s,
      keydown: s
    });
  }
  setEditable(e) {
    this.eInput.setDisabled(!e);
  }
  getValue() {
    return this.eInput.getValue();
  }
  setValue(e, t) {
    this.eInput.setValue(e, t);
  }
  setValueChangedListener(e) {
    this.onValueChanged = e;
  }
  setParams({ ariaLabel: e, autoComplete: t }) {
    const { eInput: s } = this;
    s.setInputAriaLabel(e), t !== void 0 && s.setAutoComplete(t);
  }
};
function pc(e) {
  const t = e == null ? void 0 : e.trim();
  return t === "" ? e : t;
}
function Fm(e, t) {
  const { filter: s, filterTo: i, type: r } = e || {};
  return [s || null, i || null].slice(0, dn(r, t));
}
var TD = {
  tag: "div",
  ref: "eFloatingFilterInputContainer",
  cls: "ag-floating-filter-input",
  role: "presentation"
}, Rm = class extends bm {
  constructor() {
    super(...arguments), this.eFloatingFilterInputContainer = x, this.defaultDebounceMs = 500;
  }
  postConstruct() {
    this.setTemplate(TD);
  }
  onModelUpdated(e) {
    this.setLastTypeFromModel(e), this.setEditable(this.canWeEditAfterModelFromParentFilter(e)), this.inputSvc.setValue(this.filterModelFormatter.getModelAsString(e));
  }
  setParams(e) {
    this.setupFloatingFilterInputService(e), super.setParams(e), this.setTextInputParams(e);
  }
  setupFloatingFilterInputService(e) {
    this.inputSvc = this.createFloatingFilterInputService(e), this.inputSvc.setupGui(this.eFloatingFilterInputContainer);
  }
  setTextInputParams(e) {
    const t = e.browserAutoComplete ?? !1, { inputSvc: s, defaultDebounceMs: i, readOnly: r } = this;
    if (s.setParams({
      ariaLabel: this.getAriaLabel(e),
      autoComplete: t
    }), this.applyActive = wn(e.filterParams), !r) {
      const n = cd(e.filterParams, i), o = pe(
        this,
        this.syncUpWithParentFilter.bind(this),
        n
      );
      s.setValueChangedListener(o);
    }
  }
  updateParams(e) {
    super.updateParams(e), this.setTextInputParams(e);
  }
  recreateFloatingFilterInputService(e) {
    const { inputSvc: t } = this, s = t.getValue();
    X(this.eFloatingFilterInputContainer), this.destroyBean(t), this.setupFloatingFilterInputService(e), t.setValue(s, !0);
  }
  syncUpWithParentFilter(e) {
    const t = e.key === S.ENTER, s = this.reactive;
    if (s && this.params.onUiChange(), this.applyActive && !t)
      return;
    const { inputSvc: i, params: r, lastType: n } = this;
    let o = i.getValue();
    if (r.filterParams.trimInput && (o = pc(o), i.setValue(o, !0)), s) {
      const a = r, l = a.model, c = this.convertValue(o), d = c == null ? null : {
        ...l ?? {
          filterType: this.filterType,
          type: n ?? this.optionsFactory.defaultOption
        },
        filter: c
      };
      a.onModelChange(d, { afterFloatingFilter: !0 });
    } else
      r.parentFilterInstance((a) => {
        a == null || a.onFloatingFilterChanged(n || null, o || null);
      });
  }
  convertValue(e) {
    return e || null;
  }
  setEditable(e) {
    this.inputSvc.setEditable(e);
  }
}, MD = class extends R {
  constructor() {
    super(...arguments), this.onValueChanged = () => {
    }, this.numberInputActive = !0;
  }
  setupGui(e) {
    this.eNumberInput = this.createManagedBean(new ga()), this.eTextInput = this.createManagedBean(new yt()), this.eTextInput.setDisabled(!0);
    const t = this.eNumberInput.getGui(), s = this.eTextInput.getGui();
    e.appendChild(t), e.appendChild(s), this.setupListeners(t, (i) => this.onValueChanged(i)), this.setupListeners(s, (i) => this.onValueChanged(i));
  }
  setEditable(e) {
    this.numberInputActive = e, this.eNumberInput.setDisplayed(this.numberInputActive), this.eTextInput.setDisplayed(!this.numberInputActive);
  }
  setAutoComplete(e) {
    this.eNumberInput.setAutoComplete(e), this.eTextInput.setAutoComplete(e);
  }
  getValue() {
    return this.getActiveInputElement().getValue();
  }
  setValue(e, t) {
    this.getActiveInputElement().setValue(e, t);
  }
  getActiveInputElement() {
    return this.numberInputActive ? this.eNumberInput : this.eTextInput;
  }
  setValueChangedListener(e) {
    this.onValueChanged = e;
  }
  setupListeners(e, t) {
    this.addManagedListeners(e, {
      input: t,
      keydown: t
    });
  }
  setParams(e) {
    this.setAriaLabel(e.ariaLabel), e.autoComplete !== void 0 && this.setAutoComplete(e.autoComplete);
  }
  setAriaLabel(e) {
    this.eNumberInput.setInputAriaLabel(e), this.eTextInput.setInputAriaLabel(e);
  }
}, DD = class extends Rm {
  constructor() {
    super(...arguments), this.FilterModelFormatterClass = Sm, this.filterType = "number", this.defaultOptions = Od;
  }
  updateParams(e) {
    uc(e.filterParams) !== this.allowedCharPattern && this.recreateFloatingFilterInputService(e), super.updateParams(e);
  }
  createFloatingFilterInputService(e) {
    return this.allowedCharPattern = uc(e.filterParams), this.allowedCharPattern ? this.createManagedBean(
      new xm({
        config: { allowedCharPattern: this.allowedCharPattern }
      })
    ) : this.createManagedBean(new MD());
  }
  convertValue(e) {
    return e ? Number(e) : null;
  }
}, Vd = [
  "contains",
  "notContains",
  "equals",
  "notEqual",
  "startsWith",
  "endsWith",
  "blank",
  "notBlank"
], AD = class extends Ld {
  constructor() {
    super("textFilter", Fm, Vd), this.filterType = "text", this.eValuesFrom = [], this.eValuesTo = [], this.defaultDebounceMs = 500;
  }
  createCondition(e) {
    const t = this.getConditionType(e), s = {
      filterType: this.filterType,
      type: t
    }, i = this.getValues(e);
    return i.length > 0 && (s.filter = i[0]), i.length > 1 && (s.filterTo = i[1]), s;
  }
  areSimpleModelsEqual(e, t) {
    return e.filter === t.filter && e.filterTo === t.filterTo && e.type === t.type;
  }
  getInputs(e) {
    const { eValuesFrom: t, eValuesTo: s } = this;
    return e >= t.length ? [null, null] : [t[e], s[e]];
  }
  getValues(e) {
    const t = [];
    return this.forEachPositionInput(e, (s, i, r, n) => {
      i < n && t.push(Ce(s.getValue()));
    }), t;
  }
  createEValue() {
    const e = K({ tag: "div", cls: "ag-filter-body", role: "presentation" }), { eValuesFrom: t, eValuesTo: s } = this;
    return this.createFromToElement(e, t, "from"), this.createFromToElement(e, s, "to"), e;
  }
  createFromToElement(e, t, s) {
    const i = this.createManagedBean(new yt());
    i.addCss(`ag-filter-${s}`), i.addCss("ag-filter-filter"), t.push(i), e.appendChild(i.getGui());
  }
  removeEValues(e, t) {
    const s = (n) => this.removeComponents(n, e, t), { eValuesFrom: i, eValuesTo: r } = this;
    s(i), s(r);
  }
}, Pm = class extends Gd {
  constructor() {
    super(...arguments), this.filterTypeKeys = wD;
  }
  conditionToString(e, t, s, i, r) {
    const { filter: n, filterTo: o, type: a } = e;
    if (t) {
      const l = (d) => () => vs(this, "filterSummaryTextQuote", [d]), c = this.conditionForToolPanel(
        a,
        s,
        l(n),
        l(o),
        i,
        r
      );
      if (c != null)
        return c;
    }
    return s ? `${n}-${o}` : n != null ? `${n}` : `${a}`;
  }
}, ID = ({ filterOption: e, value: t, filterText: s }) => {
  if (s == null)
    return !1;
  switch (e) {
    case "contains":
      return t.indexOf(s) >= 0;
    case "notContains":
      return t.indexOf(s) < 0;
    case "equals":
      return t === s;
    case "notEqual":
      return t != s;
    case "startsWith":
      return t.indexOf(s) === 0;
    case "endsWith": {
      const i = t.lastIndexOf(s);
      return i >= 0 && i === t.length - s.length;
    }
    default:
      return !1;
  }
}, LD = (e) => e, kD = (e) => e == null ? null : e.toString().toLowerCase(), GD = class extends mm {
  constructor() {
    super(Fm, Vd), this.filterType = "text", this.FilterModelFormatterClass = Pm;
  }
  updateParams(e) {
    super.updateParams(e);
    const t = e.filterParams;
    this.matcher = t.textMatcher ?? ID, this.formatter = t.textFormatter ?? (t.caseSensitive ? LD : kD);
  }
  evaluateNullValue(e) {
    return e ? ["notEqual", "notContains", "blank"].indexOf(e) >= 0 : !1;
  }
  evaluateNonNullValue(e, t, s, i) {
    const r = e.map((u) => this.formatter(u)) || [], n = this.formatter(t), {
      api: o,
      colDef: a,
      column: l,
      context: c,
      filterParams: { textFormatter: d }
    } = this.params;
    if (s.type === "blank")
      return Wo(t);
    if (s.type === "notBlank")
      return !Wo(t);
    const h = {
      api: o,
      colDef: a,
      column: l,
      context: c,
      node: i.node,
      data: i.data,
      filterOption: s.type,
      value: n,
      textFormatter: d
    };
    return r.some((u) => this.matcher({ ...h, filterText: u }));
  }
  processModelToApply(e) {
    if (e && this.params.filterParams.trimInput) {
      const t = (s) => {
        const i = {
          ...s
        }, { filter: r, filterTo: n } = s;
        return r && (i.filter = pc(r) ?? null), n && (i.filterTo = pc(n) ?? null), i;
      };
      return sf(e) ? {
        ...e,
        conditions: e.conditions.map(t)
      } : t(e);
    }
    return e;
  }
}, OD = class extends Rm {
  constructor() {
    super(...arguments), this.FilterModelFormatterClass = Pm, this.filterType = "text", this.defaultOptions = Vd;
  }
  createFloatingFilterInputService() {
    return this.createManagedBean(new xm());
  }
};
function VD(e) {
  var t;
  return !!((t = e.quickFilter) != null && t.isFilterPresent());
}
function BD(e) {
  var t;
  return (t = e.quickFilter) == null ? void 0 : t.getText();
}
function ND(e) {
  var t;
  (t = e.quickFilter) == null || t.resetCache();
}
var HD = class extends R {
  constructor() {
    super(...arguments), this.beanName = "quickFilter", this.quickFilter = null, this.quickFilterParts = null;
  }
  postConstruct() {
    const e = this.resetCache.bind(this), t = this.gos;
    this.addManagedEventListeners({
      columnPivotModeChanged: e,
      newColumnsLoaded: e,
      columnRowGroupChanged: e,
      columnVisible: () => {
        t.get("includeHiddenColumnsInQuickFilter") || this.resetCache();
      }
    }), this.addManagedPropertyListener("quickFilterText", (s) => this.setFilter(s.currentValue)), this.addManagedPropertyListeners(
      ["includeHiddenColumnsInQuickFilter", "applyQuickFilterBeforePivotOrAgg"],
      () => this.onColumnConfigChanged()
    ), this.quickFilter = this.parseFilter(t.get("quickFilterText")), this.parser = t.get("quickFilterParser"), this.matcher = t.get("quickFilterMatcher"), this.setFilterParts(), this.addManagedPropertyListeners(["quickFilterMatcher", "quickFilterParser"], () => this.setParserAndMatcher());
  }
  // if we are using autoGroupCols, then they should be included for quick filter. this covers the
  // following scenarios:
  // a) user provides 'field' into autoGroupCol of normal grid, so now because a valid col to filter leafs on
  // b) using tree data and user depends on autoGroupCol for first col, and we also want to filter on this
  //    (tree data is a bit different, as parent rows can be filtered on, unlike row grouping)
  refreshCols() {
    var l;
    const { autoColSvc: e, colModel: t, gos: s, pivotResultCols: i } = this.beans, r = t.isPivotMode(), n = e == null ? void 0 : e.getColumns(), o = t.getColDefCols();
    let a = (r && !s.get("applyQuickFilterBeforePivotOrAgg") ? (l = i == null ? void 0 : i.getPivotResultCols()) == null ? void 0 : l.list : o) ?? [];
    n && (a = a.concat(n)), this.colsToUse = s.get("includeHiddenColumnsInQuickFilter") ? a : a.filter((c) => c.isVisible() || c.isRowGroupActive());
  }
  isFilterPresent() {
    return this.quickFilter !== null;
  }
  doesRowPass(e) {
    const t = this.gos.get("cacheQuickFilter");
    return this.matcher ? this.doesRowPassMatcher(t, e) : this.quickFilterParts.every(
      (s) => t ? this.doesRowPassCache(e, s) : this.doesRowPassNoCache(e, s)
    );
  }
  resetCache() {
    this.beans.rowModel.forEachNode((e) => e.quickFilterAggregateText = null);
  }
  getText() {
    return this.gos.get("quickFilterText");
  }
  setFilterParts() {
    const { quickFilter: e, parser: t } = this;
    e ? this.quickFilterParts = t ? t(e) : e.split(" ") : this.quickFilterParts = null;
  }
  parseFilter(e) {
    return A(e) ? e.toUpperCase() : null;
  }
  setFilter(e) {
    if (e != null && typeof e != "string") {
      F(70, { newFilter: e });
      return;
    }
    const t = this.parseFilter(e);
    this.quickFilter !== t && (this.quickFilter = t, this.setFilterParts(), this.dispatchLocalEvent({ type: "quickFilterChanged" }));
  }
  setParserAndMatcher() {
    const e = this.gos.get("quickFilterParser"), t = this.gos.get("quickFilterMatcher"), s = e !== this.parser || t !== this.matcher;
    this.parser = e, this.matcher = t, s && (this.setFilterParts(), this.dispatchLocalEvent({ type: "quickFilterChanged" }));
  }
  onColumnConfigChanged() {
    this.refreshCols(), this.resetCache(), this.isFilterPresent() && this.dispatchLocalEvent({ type: "quickFilterChanged" });
  }
  doesRowPassNoCache(e, t) {
    return this.colsToUse.some((s) => {
      const i = this.getTextForColumn(s, e);
      return A(i) && i.indexOf(t) >= 0;
    });
  }
  doesRowPassCache(e, t) {
    return this.checkGenerateAggText(e), e.quickFilterAggregateText.indexOf(t) >= 0;
  }
  doesRowPassMatcher(e, t) {
    let s;
    e ? (this.checkGenerateAggText(t), s = t.quickFilterAggregateText) : s = this.getAggText(t);
    const { quickFilterParts: i, matcher: r } = this;
    return r(i, s);
  }
  checkGenerateAggText(e) {
    e.quickFilterAggregateText || (e.quickFilterAggregateText = this.getAggText(e));
  }
  getTextForColumn(e, t) {
    let s = this.beans.filterValueSvc.getValue(e, t);
    const i = e.getColDef();
    if (i.getQuickFilterText) {
      const r = V(this.gos, {
        value: s,
        node: t,
        data: t.data,
        column: e,
        colDef: i
      });
      s = i.getQuickFilterText(r);
    }
    return A(s) ? s.toString().toUpperCase() : null;
  }
  getAggText(e) {
    const t = [];
    return this.colsToUse.forEach((s) => {
      const i = this.getTextForColumn(s, e);
      A(i) && t.push(i);
    }), t.join(`
`);
  }
}, zD = {
  moduleName: "ClientSideRowModelFilter",
  version: B,
  rowModels: ["clientSide"],
  beans: [_M]
}, Ra = {
  moduleName: "FilterCore",
  version: B,
  beans: [dD],
  apiFunctions: {
    isAnyFilterPresent: lD,
    onFilterChanged: cD
  },
  css: [YM],
  dependsOn: [zD]
}, Bd = {
  moduleName: "FilterValue",
  version: B,
  beans: [uD]
}, Ls = {
  moduleName: "ColumnFilter",
  version: B,
  beans: [aD, hD],
  dynamicBeans: { headerFilterCellCtrl: UM },
  icons: {
    // open filter button - header, floating filter, menu
    filter: "filter",
    // filter is applied - header (legacy column menu), filter tool panel
    filterActive: "filter"
  },
  apiFunctions: {
    isColumnFilterPresent: qM,
    getColumnFilterInstance: XM,
    destroyFilter: ZM,
    setFilterModel: QM,
    getFilterModel: JM,
    getColumnFilterModel: eD,
    setColumnFilterModel: tD,
    showColumnFilter: sD,
    hideColumnFilter: iD,
    getColumnFilterHandler: rD,
    doFilterAction: nD
  },
  dependsOn: [Ra, Is, Bd, gm]
}, WD = {
  moduleName: "CustomFilter",
  version: B,
  userComponents: { agReadOnlyFloatingFilter: pD },
  dependsOn: [Ls]
}, _D = {
  moduleName: "TextFilter",
  version: B,
  dependsOn: [Ls],
  userComponents: {
    agTextColumnFilter: {
      classImp: AD,
      params: {
        useForm: !0
      }
    },
    agTextColumnFloatingFilter: OD
  },
  dynamicBeans: {
    agTextColumnFilterHandler: GD
  }
}, UD = {
  moduleName: "NumberFilter",
  version: B,
  dependsOn: [Ls],
  userComponents: {
    agNumberColumnFilter: {
      classImp: PD,
      params: {
        useForm: !0
      }
    },
    agNumberColumnFloatingFilter: DD
  },
  dynamicBeans: {
    agNumberColumnFilterHandler: ED
  }
}, $D = {
  moduleName: "DateFilter",
  version: B,
  dependsOn: [Ls],
  userComponents: {
    agDateColumnFilter: {
      classImp: vD,
      params: {
        useForm: !0
      }
    },
    agDateInput: RD,
    agDateColumnFloatingFilter: xD
  },
  dynamicBeans: {
    agDateColumnFilterHandler: yD
  }
}, KD = {
  moduleName: "QuickFilterCore",
  version: B,
  rowModels: ["clientSide"],
  beans: [HD],
  dependsOn: [Ra, Bd]
}, jD = {
  moduleName: "QuickFilter",
  version: B,
  apiFunctions: {
    isQuickFilterPresent: VD,
    getQuickFilter: BD,
    resetQuickFilter: ND
  },
  dependsOn: [KD]
}, YD = {
  moduleName: "ExternalFilter",
  version: B,
  dependsOn: [Ra]
}, qD = (
  /*css*/
  ".ag-tooltip{background-color:var(--ag-tooltip-background-color);border:var(--ag-tooltip-border);border-radius:var(--ag-border-radius);color:var(--ag-tooltip-text-color);padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);position:absolute;white-space:normal;z-index:99999;&:where(.ag-cell-editor-tooltip){background-color:var(--ag-tooltip-error-background-color);border:var(--ag-tooltip-error-border);color:var(--ag-tooltip-error-text-color);font-weight:500}}.ag-tooltip-custom{position:absolute;z-index:99999}.ag-tooltip-custom:where(:not(.ag-tooltip-interactive)),.ag-tooltip:where(:not(.ag-tooltip-interactive)){pointer-events:none}.ag-tooltip-animate{transition:opacity 1s;&:where(.ag-tooltip-hiding){opacity:0}}"
), fl = (e, t, s) => {
  var a, l, c;
  const { editModelSvc: i } = e, r = (l = (a = i == null ? void 0 : i.getCellValidationModel()) == null ? void 0 : a.getCellValidation(t)) == null ? void 0 : l.errorMessages, n = (c = i == null ? void 0 : i.getRowValidationModel().getRowValidation(t)) == null ? void 0 : c.errorMessages, o = r || n;
  return o && o.length ? o.join(s("tooltipValidationErrorSeparator", ". ")) : void 0;
}, XD = class extends R {
  constructor() {
    super(...arguments), this.beanName = "tooltipSvc";
  }
  setupHeaderTooltip(e, t, s, i) {
    e && t.destroyBean(e);
    const r = Yr(this.gos), { column: n, eGui: o } = t, a = n.getColDef();
    !i && r && !a.headerComponent && (i = Ci(
      () => o.querySelector(".ag-header-cell-text")
    ));
    const l = {
      getGui: () => o,
      getLocation: () => "header",
      getTooltipValue: () => s ?? n.getColDef().headerTooltip,
      shouldDisplayTooltip: i,
      getAdditionalParams: () => ({
        column: n,
        colDef: n.getColDef()
      })
    };
    let c = this.createTooltipFeature(l);
    return c && (c = t.createBean(c), t.setRefreshFunction("tooltip", () => c.refreshTooltip())), c;
  }
  setupHeaderGroupTooltip(e, t, s, i) {
    e && t.destroyBean(e);
    const r = Yr(this.gos), { column: n, eGui: o } = t, a = n.getColGroupDef();
    !i && r && !(a != null && a.headerGroupComponent) && (i = Ci(
      () => o.querySelector(".ag-header-group-text")
    ));
    const l = {
      getGui: () => o,
      getLocation: () => "headerGroup",
      getTooltipValue: () => s ?? (a && a.headerTooltip),
      shouldDisplayTooltip: i,
      getAdditionalParams: () => {
        const d = {
          column: n
        };
        return a && (d.colDef = a), d;
      }
    }, c = this.createTooltipFeature(l);
    return c && t.createBean(c);
  }
  enableCellTooltipFeature(e, t, s) {
    const { beans: i } = this, { gos: r, editSvc: n } = i, { column: o, rowNode: a } = e;
    let l = "cell";
    const c = () => {
      const g = !!!(n != null && n.isEditing(e)) && fl(i, e, this.getLocaleTextFunc());
      if (g)
        return l = "cellEditor", g;
      l = "cell";
      const p = o.getColDef(), f = a.data;
      if (p.tooltipField && A(f))
        return Kr(f, p.tooltipField, o.isTooltipFieldContainsDots());
      const m = p.tooltipValueGetter;
      return m ? m(
        V(r, {
          location: "cell",
          colDef: o.getColDef(),
          column: o,
          rowIndex: e.cellPosition.rowIndex,
          node: a,
          data: a.data,
          value: e.value,
          valueFormatted: e.valueFormatted
        })
      ) : null;
    }, d = Yr(r);
    s || (d && !e.isCellRenderer() ? s = () => {
      const u = !!(n != null && n.isEditing(e));
      if (!u && fl(i, e, this.getLocaleTextFunc()))
        return !0;
      if (!o.isTooltipEnabled())
        return !1;
      const f = Ci(() => {
        const m = e.eGui;
        return m.children.length === 0 ? m : m.querySelector(".ag-cell-value");
      });
      return !u && f();
    } : s = () => !(n != null && n.isEditing(e)));
    const h = {
      getGui: () => e.eGui,
      getLocation: () => l,
      getTooltipValue: t != null ? () => t : c,
      shouldDisplayTooltip: s,
      getAdditionalParams: () => ({
        column: o,
        colDef: o.getColDef(),
        rowIndex: e.cellPosition.rowIndex,
        node: a,
        data: a.data,
        valueFormatted: e.valueFormatted
      })
    };
    return this.createTooltipFeature(h, i);
  }
  setupFullWidthRowTooltip(e, t, s, i) {
    const r = {
      getGui: () => t.getFullWidthElement(),
      getTooltipValue: () => s,
      getLocation: () => "fullWidthRow",
      shouldDisplayTooltip: i
    }, n = this.beans, o = n.context;
    e && t.destroyBean(e, o);
    const a = this.createTooltipFeature(r, n);
    if (a)
      return t.createBean(a, o);
  }
  setupCellEditorTooltip(e, t) {
    var a, l;
    const { beans: s } = this, { context: i } = s, r = ((a = t.getValidationElement) == null ? void 0 : a.call(t, !0)) || !((l = t.isPopup) != null && l.call(t)) && e.eGui;
    if (!r)
      return;
    const n = {
      getGui: () => r,
      getTooltipValue: () => fl(s, e, this.getLocaleTextFunc()),
      getLocation: () => "cellEditor",
      shouldDisplayTooltip: () => {
        var p, f;
        const { editModelSvc: c } = s, d = (p = c == null ? void 0 : c.getRowValidationModel()) == null ? void 0 : p.getRowValidationMap(), h = (f = c == null ? void 0 : c.getCellValidationModel()) == null ? void 0 : f.getCellValidationMap(), u = !!d && d.size > 0, g = !!h && h.size > 0;
        return u || g;
      }
    }, o = this.createTooltipFeature(n, s);
    if (o)
      return e.createBean(o, i);
  }
  initCol(e) {
    const { colDef: t } = e;
    e.tooltipEnabled = A(t.tooltipField) || A(t.tooltipValueGetter) || A(t.tooltipComponent);
  }
  createTooltipFeature(e, t) {
    return this.beans.registry.createDynamicBean("tooltipFeature", !1, e, t);
  }
}, ZD = class extends Jy {
  createTooltipComp(e, t) {
    const s = qb(this.beans.userCompFactory, e);
    s == null || s.newAgStackInstance().then(t);
  }
  setEventHandlers(e) {
    [this.onColumnMovedEventCallback] = this.addManagedEventListeners({
      columnMoved: e
    });
  }
  clearEventHandlers() {
    var e;
    (e = this.onColumnMovedEventCallback) == null || e.call(this), this.onColumnMovedEventCallback = void 0;
  }
}, Nd = {
  moduleName: "Tooltip",
  version: B,
  beans: [XD],
  dynamicBeans: {
    tooltipFeature: Kp,
    highlightTooltipFeature: eS,
    tooltipStateManager: ZD
  },
  userComponents: {
    agTooltipComponent: iS
  },
  dependsOn: [Is],
  css: [qD]
}, qi = class {
  constructor(e) {
    this.cellValueChanges = e;
  }
}, ml = class extends qi {
  constructor(e, t, s, i) {
    super(e), this.initialRange = t, this.finalRange = s, this.ranges = i;
  }
}, QD = 10, fu = class {
  constructor(e) {
    this.actionStack = [], this.maxStackSize = e || QD, this.actionStack = new Array(this.maxStackSize);
  }
  pop() {
    return this.actionStack.pop();
  }
  push(e) {
    e.cellValueChanges && e.cellValueChanges.length > 0 && (this.actionStack.length === this.maxStackSize && this.actionStack.shift(), this.actionStack.push(e));
  }
  clear() {
    this.actionStack = [];
  }
  getCurrentStackSize() {
    return this.actionStack.length;
  }
}, JD = class extends R {
  constructor() {
    super(...arguments), this.beanName = "undoRedo", this.cellValueChanges = [], this.activeCellEdit = null, this.activeRowEdit = null, this.isPasting = !1, this.isRangeInAction = !1, this.batchEditing = !1, this.bulkEditing = !1, this.onCellValueChanged = (e) => {
      const t = { column: e.column, rowIndex: e.rowIndex, rowPinned: e.rowPinned }, s = this.activeCellEdit !== null && Pn(this.activeCellEdit, t), i = this.activeRowEdit !== null && xe(this.activeRowEdit, t);
      if (!(s || i || this.isPasting || this.isRangeInAction))
        return;
      const { rowPinned: n, rowIndex: o, column: a, oldValue: l, value: c } = e, d = {
        rowPinned: n,
        rowIndex: o,
        columnId: a.getColId(),
        newValue: c,
        oldValue: l
      };
      this.cellValueChanges.push(d);
    }, this.clearStacks = () => {
      this.undoStack.clear(), this.redoStack.clear();
    };
  }
  postConstruct() {
    const { gos: e, ctrlsSvc: t } = this.beans;
    if (!e.get("undoRedoCellEditing"))
      return;
    const s = e.get("undoRedoCellEditingLimit");
    if (s <= 0)
      return;
    this.undoStack = new fu(s), this.redoStack = new fu(s), this.addListeners();
    const i = this.clearStacks.bind(this);
    this.addManagedEventListeners({
      cellValueChanged: this.onCellValueChanged.bind(this),
      // undo / redo is restricted to actual editing so we clear the stacks when other operations are
      // performed that change the order of the row / cols.
      modelUpdated: (r) => {
        r.keepUndoRedoStack || this.clearStacks();
      },
      columnPivotModeChanged: i,
      newColumnsLoaded: i,
      columnGroupOpened: i,
      columnRowGroupChanged: i,
      columnMoved: i,
      columnPinned: i,
      columnVisible: i,
      rowDragEnd: i
    }), t.whenReady(this, (r) => {
      this.gridBodyCtrl = r.gridBodyCtrl;
    });
  }
  getCurrentUndoStackSize() {
    var e;
    return ((e = this.undoStack) == null ? void 0 : e.getCurrentStackSize()) ?? 0;
  }
  getCurrentRedoStackSize() {
    var e;
    return ((e = this.redoStack) == null ? void 0 : e.getCurrentStackSize()) ?? 0;
  }
  undo(e) {
    const { eventSvc: t, undoStack: s, redoStack: i } = this;
    t.dispatchEvent({
      type: "undoStarted",
      source: e
    });
    const r = this.undoRedo(s, i, "initialRange", "oldValue", "undo");
    t.dispatchEvent({
      type: "undoEnded",
      source: e,
      operationPerformed: r
    });
  }
  redo(e) {
    const { eventSvc: t, undoStack: s, redoStack: i } = this;
    t.dispatchEvent({
      type: "redoStarted",
      source: e
    });
    const r = this.undoRedo(i, s, "finalRange", "newValue", "redo");
    t.dispatchEvent({
      type: "redoEnded",
      source: e,
      operationPerformed: r
    });
  }
  undoRedo(e, t, s, i, r) {
    if (!e)
      return !1;
    const n = e.pop();
    return !n || !n.cellValueChanges ? !1 : (this.processAction(
      n,
      (o) => o[i],
      r
    ), n instanceof ml ? this.processRange(n.ranges || [n[s]]) : this.processCell(n.cellValueChanges), t.push(n), !0);
  }
  processAction(e, t, s) {
    e.cellValueChanges.forEach((i) => {
      const { rowIndex: r, rowPinned: n, columnId: o } = i, a = { rowIndex: r, rowPinned: n }, l = Ee(this.beans, a);
      l.displayed && l.setDataValue(o, t(i), s);
    });
  }
  processRange(e) {
    let t;
    const s = this.beans.rangeSvc;
    s.removeAllCellRanges(!0), e.forEach((i, r) => {
      if (!i)
        return;
      const n = i.startRow, o = i.endRow;
      r === e.length - 1 && (t = {
        rowPinned: n.rowPinned,
        rowIndex: n.rowIndex,
        columnId: i.startColumn.getColId()
      }, this.setLastFocusedCell(t));
      const a = {
        rowStartIndex: n.rowIndex,
        rowStartPinned: n.rowPinned,
        rowEndIndex: o.rowIndex,
        rowEndPinned: o.rowPinned,
        columnStart: i.startColumn,
        columns: i.columns
      };
      s.addCellRange(a);
    });
  }
  processCell(e) {
    const t = e[0], { rowIndex: s, rowPinned: i } = t, r = { rowIndex: s, rowPinned: i }, n = Ee(this.beans, r), o = {
      rowPinned: t.rowPinned,
      rowIndex: n.rowIndex,
      columnId: t.columnId
    };
    this.setLastFocusedCell(o);
  }
  setLastFocusedCell(e) {
    const { rowIndex: t, columnId: s, rowPinned: i } = e, { colModel: r, focusSvc: n, rangeSvc: o } = this.beans, a = r.getCol(s);
    if (!a)
      return;
    const { scrollFeature: l } = this.gridBodyCtrl;
    l.ensureIndexVisible(t), l.ensureColumnVisible(a);
    const c = { rowIndex: t, column: a, rowPinned: i };
    n.setFocusedCell({ ...c, forceBrowserFocus: !0 }), o == null || o.setRangeToCell(c);
  }
  addListeners() {
    this.addManagedEventListeners({
      rowEditingStarted: (e) => {
        this.activeRowEdit = { rowIndex: e.rowIndex, rowPinned: e.rowPinned };
      },
      rowEditingStopped: () => {
        const e = new qi(this.cellValueChanges);
        this.pushActionsToUndoStack(e), this.activeRowEdit = null;
      },
      cellEditingStarted: (e) => {
        this.activeCellEdit = { column: e.column, rowIndex: e.rowIndex, rowPinned: e.rowPinned };
      },
      cellEditingStopped: (e) => {
        if (this.activeCellEdit = null, e.valueChanged && !this.activeRowEdit && !this.isPasting && !this.isRangeInAction) {
          const s = new qi(this.cellValueChanges);
          this.pushActionsToUndoStack(s);
        }
      },
      pasteStart: () => {
        this.isPasting = !0;
      },
      pasteEnd: () => {
        const e = new qi(this.cellValueChanges);
        this.pushActionsToUndoStack(e), this.isPasting = !1;
      },
      fillStart: () => {
        this.isRangeInAction = !0;
      },
      fillEnd: (e) => {
        const t = new ml(this.cellValueChanges, e.initialRange, e.finalRange);
        this.pushActionsToUndoStack(t), this.isRangeInAction = !1;
      },
      keyShortcutChangedCellStart: () => {
        this.isRangeInAction = !0;
      },
      keyShortcutChangedCellEnd: () => {
        let e;
        const { rangeSvc: t, gos: s } = this.beans;
        t && et(s) ? e = new ml(this.cellValueChanges, void 0, void 0, [
          ...t.getCellRanges()
        ]) : e = new qi(this.cellValueChanges), this.pushActionsToUndoStack(e), this.isRangeInAction = !1;
      },
      batchEditingStarted: () => this.startBigChange("batchEditing"),
      batchEditingStopped: ({ changes: e }) => this.stopBigChange("batchEditing", e),
      bulkEditingStarted: () => this.startBigChange("bulkEditing"),
      bulkEditingStopped: ({ changes: e }) => this.stopBigChange("bulkEditing", e)
    });
  }
  startBigChange(e) {
    this[e] = !0;
  }
  stopBigChange(e, t) {
    if (!this[e] || (this[e] = !1, (t == null ? void 0 : t.length) === 0))
      return;
    const s = new qi(t ?? []);
    this.pushActionsToUndoStack(s), this.cellValueChanges = [];
  }
  pushActionsToUndoStack(e) {
    this.undoStack.push(e), this.cellValueChanges = [], this.redoStack.clear();
  }
}, e0 = (
  /*css*/
  ".ag-cell-inline-editing{border:var(--ag-cell-editing-border)!important;border-radius:var(--ag-border-radius);box-shadow:var(--ag-cell-editing-shadow);padding:0;z-index:1;.ag-cell-edit-wrapper,.ag-cell-editor,.ag-cell-wrapper,:where(.ag-cell-editor) .ag-input-field-input,:where(.ag-cell-editor) .ag-wrapper{height:100%;line-height:normal;min-height:100%;width:100%}&.ag-cell-editing-error{border-color:var(--ag-invalid-color)!important}}:where(.ag-popup-editor) .ag-large-text{background-color:var(--ag-background-color);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dropdown-shadow);padding:0}.ag-large-text-input{display:block;height:auto;padding:var(--ag-cell-horizontal-padding)}:where(.ag-rtl .ag-large-text-input) textarea{resize:none}:where(.ag-ltr) .ag-checkbox-edit{padding-left:var(--ag-cell-horizontal-padding)}:where(.ag-rtl) .ag-checkbox-edit{padding-right:var(--ag-cell-horizontal-padding)}:where(.ag-row.ag-row-editing-invalid .ag-cell-inline-editing){opacity:.8}.ag-popup-editor{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}"
), t0 = {
  tag: "div",
  cls: "ag-cell-wrapper ag-cell-edit-wrapper ag-checkbox-edit",
  children: [
    {
      tag: "ag-checkbox",
      ref: "eEditor",
      role: "presentation"
    }
  ]
}, s0 = class extends xn {
  constructor() {
    super(t0, [_t]), this.eEditor = x;
  }
  initialiseEditor(e) {
    const t = e.value ?? void 0, s = this.eEditor;
    s.setValue(t), s.getInputElement().setAttribute("tabindex", "-1"), this.setAriaLabel(t), this.addManagedListeners(s, {
      fieldValueChanged: (r) => this.setAriaLabel(r.selected)
    });
  }
  getValue() {
    return this.eEditor.getValue();
  }
  focusIn() {
    this.eEditor.getFocusableElement().focus();
  }
  afterGuiAttached() {
    this.params.cellStartedEdit && this.focusIn();
  }
  isPopup() {
    return !1;
  }
  setAriaLabel(e) {
    const t = this.getLocaleTextFunc(), s = sa(t, e), i = t("ariaToggleCellValue", "Press SPACE to toggle cell value");
    this.eEditor.setInputAriaLabel(`${i} (${s})`);
  }
  getValidationElement(e) {
    return e ? this.params.eGridCell : this.eEditor.getInputElement();
  }
  getValidationErrors() {
    const { params: e } = this, { getValidationErrors: t } = e, s = this.getValue();
    return t ? t({
      value: s,
      internalErrors: null,
      cellEditorParams: e
    }) : null;
  }
}, Pa = class extends xn {
  constructor(e) {
    super(), this.cellEditorInput = e, this.eEditor = x;
  }
  initialiseEditor(e) {
    const { cellEditorInput: t } = this;
    this.setTemplate(
      { tag: "div", cls: "ag-cell-edit-wrapper", children: [t.getTemplate()] },
      t.getAgComponents()
    );
    const { eEditor: s } = this, { cellStartedEdit: i, eventKey: r, suppressPreventDefault: n } = e;
    s.getInputElement().setAttribute("title", ""), t.init(s, e);
    let o, a = !0;
    i ? (this.focusAfterAttached = !0, r === S.BACKSPACE || r === S.DELETE ? o = "" : r && r.length === 1 ? n ? a = !1 : o = r : (o = t.getStartValue(), r !== S.F2 && (this.highlightAllOnFocus = !0))) : (this.focusAfterAttached = !1, o = t.getStartValue()), a && o != null && s.setStartValue(o), this.addGuiEventListener("keydown", (l) => {
      const { key: c } = l;
      (c === S.PAGE_UP || c === S.PAGE_DOWN) && l.preventDefault();
    });
  }
  afterGuiAttached() {
    var i, r;
    const e = this.getLocaleTextFunc(), t = this.eEditor;
    if (t.setInputAriaLabel(e("ariaInputEditor", "Input Editor")), !this.focusAfterAttached)
      return;
    As() || t.getFocusableElement().focus();
    const s = t.getInputElement();
    this.highlightAllOnFocus ? s.select() : (r = (i = this.cellEditorInput).setCaret) == null || r.call(i);
  }
  // gets called when tabbing through cells and in full row edit mode
  focusIn() {
    const { eEditor: e } = this, t = e.getFocusableElement(), s = e.getInputElement();
    t.focus(), s.select();
  }
  getValue() {
    return this.cellEditorInput.getValue();
  }
  isPopup() {
    return !1;
  }
  getValidationElement() {
    return this.eEditor.getInputElement();
  }
  getValidationErrors() {
    return this.cellEditorInput.getValidationErrors();
  }
}, i0 = {
  tag: "ag-input-date-field",
  ref: "eEditor",
  cls: "ag-cell-editor"
}, r0 = class {
  constructor(e, t) {
    this.getDataTypeService = e, this.getLocaleTextFunc = t;
  }
  getTemplate() {
    return i0;
  }
  getAgComponents() {
    return [Op];
  }
  init(e, t) {
    var o, a;
    this.eEditor = e, this.params = t;
    const { min: s, max: i, step: r, colDef: n } = t;
    s != null && e.setMin(s), i != null && e.setMax(i), r != null && e.setStep(r), this.includeTime = t.includeTime ?? ((a = (o = this.getDataTypeService()) == null ? void 0 : o.getDateIncludesTimeFlag) == null ? void 0 : a.call(o, n.cellDataType)), this.includeTime != null && e.setIncludeTime(this.includeTime);
  }
  getValidationErrors() {
    const t = this.eEditor.getInputElement().valueAsDate, { params: s } = this, { min: i, max: r, getValidationErrors: n } = s;
    let o = [];
    const a = this.getLocaleTextFunc();
    if (t instanceof Date && !isNaN(t.getTime())) {
      if (i) {
        const l = i instanceof Date ? i : new Date(i);
        if (t < l) {
          const c = l.toLocaleDateString();
          o.push(
            a("minDateValidation", `Date must be after ${c}`, [c])
          );
        }
      }
      if (r) {
        const l = r instanceof Date ? r : new Date(r);
        if (t > l) {
          const c = l.toLocaleDateString();
          o.push(
            a("maxDateValidation", `Date must be before ${c}`, [c])
          );
        }
      }
    }
    return o.length || (o = null), n ? n({ value: t, cellEditorParams: s, internalErrors: o }) : o;
  }
  getValue() {
    const { eEditor: e, params: t } = this, s = e.getDate();
    return !A(s) && !A(t.value) ? t.value : s ?? null;
  }
  getStartValue() {
    const { value: e } = this.params;
    if (e instanceof Date)
      return tt(e, this.includeTime ?? !1);
  }
}, n0 = class extends Pa {
  constructor() {
    super(
      new r0(
        () => this.beans.dataTypeSvc,
        () => this.getLocaleTextFunc()
      )
    );
  }
}, o0 = {
  tag: "ag-input-date-field",
  ref: "eEditor",
  cls: "ag-cell-editor"
}, a0 = class {
  constructor(e, t) {
    this.getDataTypeService = e, this.getLocaleTextFunc = t;
  }
  getTemplate() {
    return o0;
  }
  getAgComponents() {
    return [Op];
  }
  init(e, t) {
    var o, a;
    this.eEditor = e, this.params = t;
    const { min: s, max: i, step: r, colDef: n } = t;
    s != null && e.setMin(s), i != null && e.setMax(i), r != null && e.setStep(r), this.includeTime = t.includeTime ?? ((a = (o = this.getDataTypeService()) == null ? void 0 : o.getDateIncludesTimeFlag) == null ? void 0 : a.call(o, n.cellDataType)), this.includeTime != null && e.setIncludeTime(this.includeTime);
  }
  getValidationErrors() {
    const { eEditor: e, params: t } = this, s = e.getInputElement().value, i = this.formatDate(this.parseDate(s ?? void 0)), { min: r, max: n, getValidationErrors: o } = t;
    let a = [];
    if (i) {
      const l = new Date(i), c = this.getLocaleTextFunc();
      if (r) {
        const d = new Date(r);
        if (l < d) {
          const h = d.toLocaleDateString();
          a.push(
            c("minDateValidation", `Date must be after ${h}`, [h])
          );
        }
      }
      if (n) {
        const d = new Date(n);
        if (l > d) {
          const h = d.toLocaleDateString();
          a.push(
            c("maxDateValidation", `Date must be before ${h}`, [h])
          );
        }
      }
    }
    return a.length || (a = null), o ? o({
      value: this.getValue(),
      cellEditorParams: t,
      internalErrors: a
    }) : a;
  }
  getValue() {
    const { params: e, eEditor: t } = this, s = this.formatDate(t.getDate());
    return !A(s) && !A(e.value) ? e.value : e.parseValue(s ?? "");
  }
  getStartValue() {
    return tt(this.parseDate(this.params.value ?? void 0) ?? null, this.includeTime ?? !1);
  }
  parseDate(e) {
    const t = this.getDataTypeService();
    return t ? t.getDateParserFunction(this.params.column)(e) : ke(e) ?? void 0;
  }
  formatDate(e) {
    const t = this.getDataTypeService();
    return t ? t.getDateFormatterFunction(this.params.column)(e) : tt(e ?? null, this.includeTime ?? !1) ?? void 0;
  }
}, l0 = class extends Pa {
  constructor() {
    super(
      new a0(
        () => this.beans.dataTypeSvc,
        () => this.getLocaleTextFunc()
      )
    );
  }
}, c0 = {
  tag: "div",
  cls: "ag-large-text",
  children: [
    {
      tag: "ag-input-text-area",
      ref: "eEditor",
      cls: "ag-large-text-input"
    }
  ]
}, d0 = class extends xn {
  constructor() {
    super(c0, [uy]), this.eEditor = x;
  }
  initialiseEditor(e) {
    const { eEditor: t } = this, { cellStartedEdit: s, eventKey: i, maxLength: r, cols: n, rows: o } = e;
    this.focusAfterAttached = s, t.getInputElement().setAttribute("title", ""), t.setMaxLength(r || 200).setCols(n || 60).setRows(o || 10);
    let a;
    s ? (this.focusAfterAttached = !0, i === S.BACKSPACE || i === S.DELETE ? a = "" : i && i.length === 1 ? a = i : (a = this.getStartValue(e), i !== S.F2 && (this.highlightAllOnFocus = !0))) : (this.focusAfterAttached = !1, a = this.getStartValue(e)), a != null && t.setValue(a, !0), this.addGuiEventListener("keydown", this.onKeyDown.bind(this)), this.activateTabIndex();
  }
  getStartValue(e) {
    const { value: t } = e;
    return (t == null ? void 0 : t.toString()) ?? t;
  }
  onKeyDown(e) {
    const t = e.key;
    (t === S.LEFT || t === S.UP || t === S.RIGHT || t === S.DOWN || e.shiftKey && t === S.ENTER) && e.stopPropagation();
  }
  afterGuiAttached() {
    const { eEditor: e, focusAfterAttached: t, highlightAllOnFocus: s } = this, i = this.getLocaleTextFunc();
    e.setInputAriaLabel(i("ariaInputEditor", "Input Editor")), t && (e.getFocusableElement().focus(), s && e.getInputElement().select());
  }
  getValue() {
    const { eEditor: e, params: t } = this, { value: s } = t, i = e.getValue();
    return !A(i) && !A(s) ? s : t.parseValue(i);
  }
  getValidationElement() {
    return this.eEditor.getInputElement();
  }
  getValidationErrors() {
    const { params: e } = this, { maxLength: t, getValidationErrors: s } = e, i = this.getLocaleTextFunc(), r = this.getValue();
    let n = [];
    return typeof r == "string" && t != null && r.length > t && n.push(
      i("maxLengthValidation", `Must be ${t} characters or fewer.`, [String(t)])
    ), n.length || (n = null), s ? s({
      value: r,
      internalErrors: n,
      cellEditorParams: e
    }) : n;
  }
}, h0 = {
  tag: "ag-input-number-field",
  ref: "eEditor",
  cls: "ag-cell-editor"
}, u0 = class {
  constructor(e) {
    this.getLocaleTextFunc = e;
  }
  getTemplate() {
    return h0;
  }
  getAgComponents() {
    return [pa];
  }
  init(e, t) {
    this.eEditor = e, this.params = t;
    const { max: s, min: i, precision: r, step: n } = t;
    s != null && e.setMax(s), i != null && e.setMin(i), r != null && e.setPrecision(r), n != null && e.setStep(n);
    const o = e.getInputElement();
    t.preventStepping ? e.addManagedElementListeners(o, { keydown: this.preventStepping }) : t.showStepperButtons && o.classList.add("ag-number-field-input-stepper");
  }
  getValidationErrors() {
    const { params: e } = this, { min: t, max: s, getValidationErrors: i } = e, n = this.eEditor.getInputElement().valueAsNumber, o = this.getLocaleTextFunc();
    let a = [];
    return typeof n == "number" && (t != null && n < t && a.push(
      o("minValueValidation", `Must be greater than or equal to ${t}.`, [String(t)])
    ), s != null && n > s && a.push(
      o("maxValueValidation", `Must be less than or equal to ${s}.`, [String(s)])
    )), a.length || (a = null), i ? i({
      value: n,
      cellEditorParams: e,
      internalErrors: a
    }) : a;
  }
  preventStepping(e) {
    (e.key === S.UP || e.key === S.DOWN) && e.preventDefault();
  }
  getValue() {
    const { eEditor: e, params: t } = this, s = e.getValue();
    if (!A(s) && !A(t.value))
      return t.value;
    let i = t.parseValue(s);
    if (i == null)
      return i;
    if (typeof i == "string") {
      if (i === "")
        return null;
      i = Number(i);
    }
    return isNaN(i) ? null : i;
  }
  getStartValue() {
    return this.params.value;
  }
  setCaret() {
    As() && this.eEditor.getInputElement().focus({ preventScroll: !0 });
  }
}, g0 = class extends Pa {
  constructor() {
    super(new u0(() => this.getLocaleTextFunc()));
  }
}, p0 = {
  tag: "div",
  cls: "ag-cell-edit-wrapper",
  children: [
    {
      tag: "ag-select",
      ref: "eEditor",
      cls: "ag-cell-editor"
    }
  ]
}, f0 = class extends xn {
  constructor() {
    super(p0, [Ni]), this.eEditor = x, this.startedByEnter = !1;
  }
  wireBeans(e) {
    this.valueSvc = e.valueSvc;
  }
  initialiseEditor(e) {
    this.focusAfterAttached = e.cellStartedEdit;
    const { eEditor: t, valueSvc: s, gos: i } = this, { values: r, value: n, eventKey: o } = e;
    if (ee(r)) {
      F(58);
      return;
    }
    this.startedByEnter = o != null ? o === S.ENTER : !1;
    let a = !1;
    r.forEach((h) => {
      const u = { value: h }, g = s.formatValue(e.column, null, h), p = g != null;
      u.text = p ? g : h, t.addOption(u), a = a || n === h;
    }), a ? t.setValue(e.value, !0) : e.values.length && t.setValue(e.values[0], !0);
    const { valueListGap: l, valueListMaxWidth: c, valueListMaxHeight: d } = e;
    l != null && t.setPickerGap(l), d != null && t.setPickerMaxHeight(d), c != null && t.setPickerMaxWidth(c), i.get("editType") !== "fullRow" && this.addManagedListeners(this.eEditor, { selectedItem: () => e.stopEditing() });
  }
  afterGuiAttached() {
    this.focusAfterAttached && this.eEditor.getFocusableElement().focus(), this.startedByEnter && setTimeout(() => {
      this.isAlive() && this.eEditor.showPicker();
    });
  }
  focusIn() {
    this.eEditor.getFocusableElement().focus();
  }
  getValue() {
    return this.eEditor.getValue();
  }
  isPopup() {
    return !1;
  }
  getValidationElement() {
    return this.eEditor.getAriaElement();
  }
  getValidationErrors() {
    const { params: e } = this, { values: t, getValidationErrors: s } = e, i = this.getValue();
    let r = [];
    if (t && !t.includes(i)) {
      const n = this.getLocaleTextFunc();
      r.push(n("invalidSelectionValidation", "Invalid selection."));
    } else
      r = null;
    return s ? s({
      value: i,
      internalErrors: r,
      cellEditorParams: e
    }) : r;
  }
}, m0 = {
  tag: "ag-input-text-field",
  ref: "eEditor",
  cls: "ag-cell-editor"
}, C0 = class {
  constructor(e) {
    this.getLocaleTextFunc = e;
  }
  getTemplate() {
    return m0;
  }
  getAgComponents() {
    return [It];
  }
  init(e, t) {
    this.eEditor = e, this.params = t;
    const s = t.maxLength;
    s != null && e.setMaxLength(s);
  }
  getValidationErrors() {
    const { params: e } = this, { maxLength: t, getValidationErrors: s } = e, i = this.getValue(), r = this.getLocaleTextFunc();
    let n = [];
    return t != null && typeof i == "string" && i.length > t && n.push(
      r("maxLengthValidation", `Must be ${t} characters or fewer.`, [String(t)])
    ), n.length || (n = null), s ? s({ value: i, cellEditorParams: e, internalErrors: n }) : n;
  }
  getValue() {
    const { eEditor: e, params: t } = this, s = e.getValue();
    return !A(s) && !A(t.value) ? t.value : t.parseValue(s);
  }
  getStartValue() {
    const e = this.params;
    return e.useFormatter || e.column.getColDef().refData ? e.formatValue(e.value) : e.value;
  }
  setCaret() {
    As() && this.eEditor.getInputElement().focus({ preventScroll: !0 });
    const e = this.eEditor, t = e.getValue(), s = A(t) && t.length || 0;
    s && e.getInputElement().setSelectionRange(s, s);
  }
}, mu = class extends Pa {
  constructor() {
    super(new C0(() => this.getLocaleTextFunc()));
  }
};
function v0(e) {
  return e.ctrlsSvc.getScrollFeature().getVScrollPosition();
}
function w0(e) {
  return e.ctrlsSvc.getScrollFeature().getHScrollPosition();
}
function Em(e, t, s = "auto") {
  e.frameworkOverrides.wrapIncoming(
    () => e.ctrlsSvc.getScrollFeature().ensureColumnVisible(t, s),
    "ensureVisible"
  );
}
function Tm(e, t, s) {
  e.frameworkOverrides.wrapIncoming(
    () => e.ctrlsSvc.getScrollFeature().ensureIndexVisible(t, s),
    "ensureVisible"
  );
}
function b0(e, t, s = null) {
  e.frameworkOverrides.wrapIncoming(
    () => e.ctrlsSvc.getScrollFeature().ensureNodeVisible(t, s),
    "ensureVisible"
  );
}
function y0(e) {
  var t;
  (t = e.undoRedo) == null || t.undo("api");
}
function S0(e) {
  var t;
  (t = e.undoRedo) == null || t.redo("api");
}
function x0(e, t) {
  var s;
  return (s = e.editModelSvc) == null ? void 0 : s.getEditRowDataValue(t, { checkSiblings: !0 });
}
function F0(e) {
  var i;
  const t = (i = e.editModelSvc) == null ? void 0 : i.getEditMap(), s = [];
  return t == null || t.forEach((r, n) => {
    const { rowIndex: o, rowPinned: a } = n;
    r.forEach((l, c) => {
      const { editorValue: d, pendingValue: h, sourceValue: u, state: g } = l, p = ys(l);
      let f = d ?? h;
      f === Dt && (f = void 0);
      const m = {
        newValue: f,
        oldValue: u,
        state: g,
        column: c,
        colId: c.getColId(),
        colKey: c.getColId(),
        rowIndex: o,
        rowPinned: a
      };
      (g === "editing" || g === "changed" && p) && s.push(m);
    });
  }), s;
}
function R0(e, t = !1) {
  var i;
  const { editSvc: s } = e;
  s != null && s.isBatchEditing() ? (t ? (i = e.editModelSvc) == null || i.getEditPositions().forEach((r) => {
    r.state === "editing" && s.revertSingleCellEdit(r);
  }) : ui(e, { persist: !0 }), or(e, void 0, { cancel: t })) : s == null || s.stopEditing(void 0, { cancel: t, source: "edit", forceStop: !t, forceCancel: t });
}
function P0(e, t) {
  var i;
  const s = ge(e, t);
  return ((i = e.editSvc) == null ? void 0 : i.isEditing(s)) ?? !1;
}
function E0(e, t) {
  const { key: s, colKey: i, rowIndex: r, rowPinned: n } = t, { editSvc: o, colModel: a } = e, l = a.getCol(i);
  if (!l) {
    F(12, { colKey: i });
    return;
  }
  const d = Ee(e, {
    rowIndex: r,
    rowPinned: n || null
  });
  if (!d) {
    F(290, { rowIndex: r, rowPinned: n });
    return;
  }
  if (!l.isCellEditable(d))
    return;
  n == null && Tm(e, r), Em(e, i), o == null || o.startEditing(
    {
      rowNode: d,
      column: l
    },
    {
      event: s ? new KeyboardEvent("keydown", { key: s }) : void 0,
      source: "api"
    }
  );
}
function T0(e) {
  var t;
  return ((t = e.editSvc) == null ? void 0 : t.validateEdit()) || null;
}
function M0(e) {
  var t;
  return ((t = e.undoRedo) == null ? void 0 : t.getCurrentUndoStackSize()) ?? 0;
}
function D0(e) {
  var t;
  return ((t = e.undoRedo) == null ? void 0 : t.getCurrentRedoStackSize()) ?? 0;
}
var A0 = { tag: "div", cls: "ag-popup-editor", attrs: { tabindex: "-1" } }, I0 = class extends ha {
  constructor(e) {
    super(A0), this.params = e;
  }
  postConstruct() {
    Pi(this.gos, this.getGui(), "popupEditorWrapper", !0), this.addKeyDownListener();
  }
  addKeyDownListener() {
    const e = this.getGui(), t = this.params, s = (i) => {
      ec(this.gos, i, t.node, t.column, !0) || t.onKeyDown(i);
    };
    this.addManagedElementListeners(e, { keydown: s });
  }
};
function L0(e, { column: t }, s, i, r = "ui") {
  var c;
  if (s instanceof KeyboardEvent && (s.key === S.TAB || s.key === S.ENTER || s.key === S.F2 || s.key === S.BACKSPACE && i))
    return !0;
  if ((s == null ? void 0 : s.shiftKey) && ((c = e.rangeSvc) == null ? void 0 : c.getCellRanges().length) != 0)
    return !1;
  const o = t == null ? void 0 : t.getColDef(), a = k0(e.gos, o), l = s == null ? void 0 : s.type;
  return l === "click" && (s == null ? void 0 : s.detail) === 1 && a === 1 || l === "dblclick" && (s == null ? void 0 : s.detail) === 2 && a === 2 ? !0 : r === "api" ? i ?? !1 : !1;
}
function k0(e, t) {
  return e.get("suppressClickEdit") === !0 ? 0 : e.get("singleClickEdit") === !0 || t != null && t.singleClickEdit ? 1 : 2;
}
function fc(e, { rowNode: t, column: s }, i = "ui") {
  const r = s.getColDef().editable, n = e.editModelSvc;
  return s.isColumnFunc(t, r) || !!n && n.hasEdits({ rowNode: t, column: s }, { withOpenEditor: !0 });
}
function G0(e, t, s = "ui") {
  const i = fc(e, t, s);
  return i === !0 || s === "ui" ? i : e.colModel.getCols().some((n) => fc(e, { rowNode: t.rowNode, column: n }, s));
}
var _o = (e, t = !1) => {
  if (e !== void 0)
    return ys(e) || t && e.state === "editing";
};
function Mm(e, t, s = !1) {
  var i;
  return _o((i = e.editModelSvc) == null ? void 0 : i.getEdit(t), s);
}
function Dm(e, t) {
  const { editModelSvc: s } = e, { column: i, rowNode: r } = t;
  if (e.gos.get("groupTotalRow") && !(r != null && r.footer))
    return !1;
  for (const n of (r == null ? void 0 : r.allLeafChildren) ?? [])
    if (_o(s == null ? void 0 : s.getEdit({ rowNode: n, column: i })) || _o(s == null ? void 0 : s.getEdit({ rowNode: n.pinnedSibling, column: i })))
      return !0;
}
function Am(e, { rowNode: t, column: s }) {
  var i;
  if (t = t.pinnedSibling, !!t)
    return _o(
      (i = e.editModelSvc) == null ? void 0 : i.getEdit({
        rowNode: t,
        column: s
      })
    );
}
var O0 = class extends R {
  constructor(e, t) {
    super(), this.cellCtrl = e, this.beans = t, this.editSvc = t.editSvc, this.editModelSvc = t.editModelSvc;
  }
  setComp(e) {
    this.cellComp = e, this.applyCellStyles();
  }
  applyCellStyles() {
    var r;
    const { cellCtrl: e, editSvc: t, beans: s } = this;
    if (t != null && t.isBatchEditing() && t.isEditing()) {
      const n = Mm(s, e) || Dm(s, e) || Am(s, e);
      this.applyBatchingStyle(n);
    } else
      this.applyBatchingStyle(!1);
    const i = !!((r = this.editModelSvc) != null && r.getCellValidationModel().hasCellValidation(this.cellCtrl));
    this.cellComp.toggleCss("ag-cell-editing-error", i);
  }
  applyBatchingStyle(e) {
    var t;
    this.cellComp.toggleCss("ag-cell-editing", e ?? !1), this.cellComp.toggleCss("ag-cell-batch-edit", (e && ((t = this.editSvc) == null ? void 0 : t.isBatchEditing())) ?? !1);
  }
}, V0 = class extends R {
  constructor(e, t) {
    super(), this.rowCtrl = e, this.beans = t, this.gos = t.gos, this.editSvc = t.editSvc, this.editModelSvc = t.editModelSvc;
  }
  applyRowStyles() {
    var o;
    const { rowCtrl: e, editModelSvc: t, beans: s } = this;
    let i = e.rowNode, r = t == null ? void 0 : t.getEditRow(i);
    const n = (o = this.editModelSvc) == null ? void 0 : o.getRowValidationModel().hasRowValidation({ rowNode: i });
    if (!r && i.pinnedSibling && (i = i.pinnedSibling, r = t == null ? void 0 : t.getEditRow(i)), r) {
      const a = Array.from(r.keys()).some((l) => {
        const c = { rowNode: i, column: l };
        return Mm(s, c, !0) || Dm(s, c) || Am(s, c);
      });
      this.applyStyle(n, a);
      return;
    }
    this.applyStyle(n);
  }
  applyStyle(e = !1, t = !1) {
    var r, n;
    const s = ((r = this.editSvc) == null ? void 0 : r.isBatchEditing()) ?? !1, i = this.gos.get("editType") === "fullRow";
    (n = this.rowCtrl) == null || n.forEachGui(void 0, ({ rowComp: o }) => {
      o.toggleCss("ag-row-editing", i && t), o.toggleCss("ag-row-batch-edit", i && t && s), o.toggleCss("ag-row-inline-editing", t), o.toggleCss("ag-row-not-inline-editing", !t), o.toggleCss("ag-row-editing-invalid", i && t && e);
    });
  }
}, B0 = ({ rowModel: e, pinnedRowModel: t, editModelSvc: s }, i) => {
  const r = /* @__PURE__ */ new Set();
  return e.forEachNode((n) => i.has(n) && r.add(n)), t == null || t.forEachPinnedRow("top", (n) => i.has(n) && r.add(n)), t == null || t.forEachPinnedRow("bottom", (n) => i.has(n) && r.add(n)), i.forEach((n) => {
    r.has(n) || s.removeEdits({ rowNode: n });
  }), r;
}, N0 = ({ editModelSvc: e }, t, s) => {
  t.forEach(
    (i) => {
      var r;
      return (r = e == null ? void 0 : e.getEditRow(i)) == null ? void 0 : r.forEach((n, o) => !s.has(o) && e.removeEdits({ rowNode: i, column: o }));
    }
  );
}, H0 = (e) => () => {
  const t = new Set(e.colModel.getCols()), s = e.editModelSvc.getEditMap(!0), i = new Set(s.keys());
  N0(e, B0(e, i), t);
}, z0 = /* @__PURE__ */ new Set(["undo", "redo", "paste", "bulk", "rangeSvc"]), W0 = /* @__PURE__ */ new Set(["ui", "api"]), Im = {
  paste: "api",
  rangeSvc: "api",
  fillHandle: "api",
  cellClear: "api",
  bulk: "api"
}, _0 = new Set(Object.keys(Im)), U0 = /* @__PURE__ */ new Set([
  "paste",
  "rangeSvc",
  "renderer",
  "cellClear",
  "redo",
  "undo"
]), _n = { cancel: !0, source: "api" }, $0 = { cancel: !1, source: "api" }, Ki = { checkSiblings: !0 }, Mr = { force: !0, suppressFlash: !0 }, K0 = class extends R {
  constructor() {
    super(...arguments), this.beanName = "editSvc", this.batch = !1, this.stopping = !1, this.committing = !1;
  }
  postConstruct() {
    const { beans: e } = this;
    this.model = e.editModelSvc, this.valueSvc = e.valueSvc, this.rangeSvc = e.rangeSvc, this.addManagedPropertyListener("editType", ({ currentValue: i }) => {
      this.stopEditing(void 0, _n), this.createStrategy(i);
    });
    const t = H0(e), s = () => {
      const i = this.model.getCellValidationModel().getCellValidationMap().size > 0, r = this.model.getRowValidationModel().getRowValidationMap().size > 0;
      return i || r ? this.stopEditing(void 0, _n) : this.isEditing() && (this.isBatchEditing() ? or(e, this.model.getEditPositions()) : this.stopEditing(void 0, $0)), !1;
    };
    this.addManagedEventListeners({
      columnPinned: t,
      columnVisible: t,
      columnRowGroupChanged: t,
      rowExpansionStateChanged: t,
      pinnedRowsChanged: t,
      displayedRowsChanged: t,
      sortChanged: s,
      filterChanged: s,
      cellFocused: this.onCellFocused.bind(this)
    });
  }
  isBatchEditing() {
    return this.batch;
  }
  setBatchEditing(e) {
    e ? (this.batch = !0, this.stopEditing(void 0, _n)) : (this.stopEditing(void 0, _n), this.batch = !1);
  }
  createStrategy(e) {
    const { beans: t, gos: s, strategy: i } = this, r = Cu(s, e);
    if (i) {
      if (i.beanName === r)
        return i;
      this.destroyStrategy();
    }
    return this.strategy = this.createOptionalManagedBean(
      t.registry.createDynamicBean(r, !0)
    );
  }
  destroyStrategy() {
    this.strategy && (this.strategy.destroy(), this.strategy = this.destroyBean(this.strategy));
  }
  shouldStartEditing(e, t, s, i = "ui") {
    const r = L0(this.beans, e, t, s, i);
    return r && (this.strategy ?? (this.strategy = this.createStrategy())), r;
  }
  shouldStopEditing(e, t, s = "ui") {
    var i;
    return ((i = this.strategy) == null ? void 0 : i.shouldStop(e, t, s)) ?? null;
  }
  shouldCancelEditing(e, t, s = "ui") {
    var i;
    return ((i = this.strategy) == null ? void 0 : i.shouldCancel(e, t, s)) ?? null;
  }
  validateEdit() {
    return fT(this.beans);
  }
  isEditing(e, t) {
    return this.model.hasEdits(e, t ?? Ki);
  }
  isRowEditing(e, t) {
    return (e && this.model.hasRowEdits(e, t)) ?? !1;
  }
  /** @returns whether to prevent default on event */
  startEditing(e, t) {
    const { startedEdit: s = !0, event: i = null, source: r = "ui", ignoreEventKey: n = !1, silent: o } = t;
    if (this.strategy ?? (this.strategy = this.createStrategy()), !this.isCellEditable(e, "api"))
      return;
    const a = ge(this.beans, e);
    if (a && !a.comp) {
      a.onCompAttachedFuncs.push(() => this.startEditing(e, t));
      return;
    }
    const l = this.shouldStartEditing(e, i, s, r);
    if (l === !1 && r !== "api") {
      this.isEditing(e) && this.stopEditing();
      return;
    }
    !this.batch && this.shouldStopEditing(e, void 0, r) && !t.continueEditing && this.stopEditing(void 0, { source: r }), l && this.isBatchEditing() && this.dispatchBatchEvent("batchEditingStarted", /* @__PURE__ */ new Map()), this.strategy.start({
      position: e,
      event: i,
      source: r,
      ignoreEventKey: n,
      startedEdit: s,
      silent: o
    });
  }
  stopEditing(e, t) {
    var C, v, w;
    const { event: s, cancel: i, source: r = "ui", suppressNavigateAfterEdit: n, forceCancel: o, forceStop: a } = t || {}, { beans: l, model: c } = this;
    if (_0.has(r) && this.isBatchEditing())
      return this.bulkRefresh(e), !1;
    const d = this.committing ? Im[r] : r;
    if (!(this.committing || this.isEditing(e) || this.isBatchEditing() && c.hasEdits(e, Ki)) || !this.strategy || this.stopping)
      return !1;
    this.stopping = !0;
    const u = ge(l, e);
    u && (u.onEditorAttachedFuncs = []);
    let g = c.getEditMap(!0), p = !1;
    const f = !i && (!!this.shouldStopEditing(e, s, d) || this.committing && !this.batch) || (a ?? !1), m = i && !!this.shouldCancelEditing(e, s, d) || (o ?? !1);
    if (f || m) {
      ui(l, { persist: !0, isCancelling: m || i, isStopping: f });
      const b = c.getEditMap(), y = this.processEdits(b, i, r);
      (C = this.strategy) == null || C.stop(i, s), y.forEach((P) => {
        c.clearEditValue(P);
      }), this.bulkRefresh(void 0, g), c.getEditPositions(b).forEach((P) => {
        const E = ge(l, P), M = ys(P);
        E == null || E.refreshCell({ force: !0, suppressFlash: !M });
      }), g = b, p || (p = f);
    } else if (s instanceof KeyboardEvent && this.batch && ((v = this.strategy) != null && v.midBatchInputsAllowed(e)) && this.isEditing(e, { withOpenEditor: !0 })) {
      const b = s.key, y = b === S.ENTER, P = b === S.ESCAPE, E = b === S.TAB;
      (y || E || P) && (y || E ? ui(l, { persist: !0 }) : P && this.revertSingleCellEdit(u), this.isBatchEditing() ? (w = this.strategy) == null || w.cleanupEditors() : or(l, c.getEditPositions(), { event: s, cancel: P }), s.preventDefault(), this.bulkRefresh(e, g, { suppressFlash: !0 }), g = c.getEditMap());
    } else
      ui(l, { persist: !0 }), g = c.getEditMap();
    return p && e && this.model.removeEdits(e), !n && u && this.navigateAfterEdit(s instanceof KeyboardEvent && s.shiftKey, u.cellPosition), cc(l), this.model.hasEdits() || (this.model.getCellValidationModel().clearCellValidationMap(), this.model.getRowValidationModel().clearRowValidationMap()), this.bulkRefresh(), m && this.beans.rowRenderer.refreshRows({ rowNodes: Array.from(g.keys()) }), this.isBatchEditing() && (this.beans.rowRenderer.refreshRows({ suppressFlash: !0, force: !0 }), p && f && this.dispatchBatchEvent("batchEditingStopped", g)), this.stopping = !1, p;
  }
  navigateAfterEdit(e, t) {
    var i;
    if (this.gos.get("enterNavigatesVerticallyAfterEdit")) {
      const r = e ? S.UP : S.DOWN;
      (i = this.beans.navigation) == null || i.navigateToNextCell(null, r, t, !1);
    }
  }
  processEdits(e, t = !1, s) {
    const i = Array.from(e.keys()), r = this.model.getCellValidationModel().getCellValidationMap().size > 0 || this.model.getRowValidationModel().getRowValidationMap().size > 0, n = [];
    for (const o of i) {
      const a = e.get(o);
      for (const l of a.keys()) {
        const c = a.get(l), d = { rowNode: o, column: l }, h = ys(c);
        !t && h && !r && (this.setNodeDataValue(o, l, c.pendingValue, void 0, s) || n.push(d));
      }
    }
    return n;
  }
  setNodeDataValue(e, t, s, i, r = "edit") {
    const { beans: n } = this, o = ge(n, { rowNode: e, column: t }), a = W0.has(r) ? "edit" : r;
    o && (o.suppressRefreshCell = !0), this.commitNextEdit();
    const l = e.setDataValue(t, s, a);
    return o && (o.suppressRefreshCell = !1), i && (o == null || o.refreshCell(Mr)), l;
  }
  setEditMap(e, t) {
    var i;
    this.strategy ?? (this.strategy = this.createStrategy()), (i = this.strategy) == null || i.setEditMap(e, t), this.bulkRefresh();
    let s = Mr;
    t != null && t.forceRefreshOfEditCellsOnly && (s = {
      ...j0(e),
      ...Mr
    }), this.beans.rowRenderer.refreshCells(s);
  }
  dispatchEditValuesChanged({ rowNode: e, column: t }, s = {}) {
    if (!e || !t || !s)
      return;
    const { pendingValue: i, sourceValue: r } = s, { rowIndex: n, rowPinned: o, data: a } = e;
    this.beans.eventSvc.dispatchEvent({
      type: "cellEditValuesChanged",
      node: e,
      rowIndex: n,
      rowPinned: o,
      column: t,
      source: "api",
      data: a,
      newValue: i,
      oldValue: r,
      value: i,
      colDef: t.getColDef()
    });
  }
  bulkRefresh(e = {}, t, s = {}) {
    var a;
    const { beans: i, gos: r } = this, { editModelSvc: n, rowModel: o } = i;
    te(r) && (e.rowNode && e.column ? this.refCell(e, this.model.getEdit(e), s) : t && ((a = n == null ? void 0 : n.getEditMap(!1)) == null || a.forEach((l, c) => {
      for (const d of l.keys())
        this.refCell({ rowNode: c, column: d }, l.get(d), s);
    })));
  }
  refCell({ rowNode: e, column: t }, s, i = {}) {
    var h;
    const { beans: r, gos: n } = this, o = /* @__PURE__ */ new Set([e]), a = /* @__PURE__ */ new Set(), l = e.pinnedSibling;
    l && o.add(l);
    const c = e.sibling;
    c && a.add(c);
    let d = e.parent;
    for (; d; )
      (h = d.sibling) != null && h.footer && n.get("groupTotalRow") || !d.parent && d.sibling && n.get("grandTotalRow") ? a.add(d.sibling) : a.add(d), d = d.parent;
    o.forEach((u) => this.dispatchEditValuesChanged({ rowNode: u, column: t }, s)), o.forEach((u) => {
      var g;
      return (g = ge(r, { rowNode: u, column: t })) == null ? void 0 : g.refreshCell(i);
    }), a.forEach((u) => {
      var g;
      return (g = ge(r, { rowNode: u, column: t })) == null ? void 0 : g.refreshCell(i);
    });
  }
  stopAllEditing(e = !1, t = "ui") {
    this.isEditing() && this.stopEditing(void 0, { cancel: e, source: t });
  }
  isCellEditable(e, t = "ui") {
    const { rowNode: s } = e, { gos: i, beans: r } = this;
    if (s.group) {
      if (i.get("treeData")) {
        if (!s.data && !i.get("enableGroupEdit"))
          return !1;
      } else if (!i.get("enableGroupEdit"))
        return !1;
    }
    const n = Cu(i) === "fullRow" ? G0(r, e, t) : fc(r, e, t);
    return n && (this.strategy ?? (this.strategy = this.createStrategy())), n;
  }
  cellEditingInvalidCommitBlocks() {
    return this.gos.get("invalidEditValueMode") === "block";
  }
  checkNavWithValidation(e, t, s = !0) {
    var i, r, n, o;
    if (this.hasValidationErrors(e)) {
      const a = ge(this.beans, e);
      return this.cellEditingInvalidCommitBlocks() ? ((i = t == null ? void 0 : t.preventDefault) == null || i.call(t), s && (!(a != null && a.hasBrowserFocus()) && (a == null || a.focusCell()), (o = (n = (r = a == null ? void 0 : a.comp) == null ? void 0 : r.getCellEditor()) == null ? void 0 : n.focusIn) == null || o.call(n)), "block-stop") : (a && this.revertSingleCellEdit(a), "revert-continue");
    }
    return "continue";
  }
  revertSingleCellEdit(e, t = !1) {
    var i, r, n, o, a;
    const s = ge(this.beans, e);
    (i = s == null ? void 0 : s.comp) != null && i.getCellEditor() && (or(this.beans, [e], { silent: !0 }), this.model.clearEditValue(e), Cr(this.beans, e, { silent: !0 }), Ai(this.beans), s == null || s.refreshCell(Mr), (r = s.rowCtrl.rowEditStyleFeature) == null || r.applyRowStyles(), t && (s == null || s.focusCell(), (a = (o = (n = s == null ? void 0 : s.comp) == null ? void 0 : n.getCellEditor()) == null ? void 0 : o.focusIn) == null || a.call(o)));
  }
  hasValidationErrors(e) {
    var i;
    Ai(this.beans);
    const t = ge(this.beans, e);
    t && (t.refreshCell(Mr), (i = t.rowCtrl.rowEditStyleFeature) == null || i.applyRowStyles());
    let s = !1;
    return e != null && e.rowNode ? (s || (s = this.model.getRowValidationModel().hasRowValidation({ rowNode: e.rowNode })), e.column && (s || (s = this.model.getCellValidationModel().hasCellValidation({ rowNode: e.rowNode, column: e.column })))) : (s || (s = this.model.getCellValidationModel().getCellValidationMap().size > 0), s || (s = this.model.getRowValidationModel().getRowValidationMap().size > 0)), s;
  }
  moveToNextCell(e, t, s, i = "ui") {
    var a;
    let r;
    const n = this.isEditing(), o = n && this.checkNavWithValidation(void 0, s) === "block-stop";
    return e instanceof ar && n && (r = (a = this.strategy) == null ? void 0 : a.moveToNextEditingCell(e, t, s, i, o)), r === null || (r = r || !!this.beans.focusSvc.focusedHeader, r === !1 && !o && this.stopEditing()), r;
  }
  getCellDataValue({ rowNode: e, column: t }, s = !0) {
    if (!e || !t)
      return;
    let i = this.model.getEdit({ rowNode: e, column: t });
    const r = e.pinnedSibling;
    if (r) {
      const o = this.model.getEdit({ rowNode: r, column: t });
      o && (i = o);
    }
    const n = s ? (i == null ? void 0 : i.editorValue) ?? (i == null ? void 0 : i.pendingValue) : i == null ? void 0 : i.pendingValue;
    return n === Dt || !i ? (i == null ? void 0 : i.sourceValue) ?? this.valueSvc.getValue(t, e, !1, "api") : n;
  }
  addStopEditingWhenGridLosesFocus(e) {
    cT(this, this.beans, e);
  }
  createPopupEditorWrapper(e) {
    return new I0(e);
  }
  commitNextEdit() {
    this.committing = !0;
  }
  setDataValue(e, t, s) {
    var i;
    try {
      if ((!this.isEditing() || this.committing) && !U0.has(s))
        return;
      const { beans: r } = this;
      this.strategy ?? (this.strategy = this.createStrategy());
      const n = this.isBatchEditing() ? "ui" : this.committing ? s ?? "api" : "api";
      if (!s || z0.has(s))
        return ho(r, e, t, s, void 0, { persist: !0 }), this.setNodeDataValue(e.rowNode, e.column, t, !0, s);
      const o = this.model.getEdit(e);
      if (o) {
        if (o.pendingValue === t)
          return !1;
        if (o.sourceValue !== t)
          return ho(r, e, t, s, void 0, { persist: !0 }), this.stopEditing(e, { source: n, suppressNavigateAfterEdit: !0 }), !0;
        if (o.sourceValue === t)
          return (i = r.editModelSvc) == null || i.removeEdits(e), this.dispatchEditValuesChanged(e, {
            ...o,
            pendingValue: t
          }), !0;
      }
      return ho(r, e, t, s, void 0, { persist: !0 }), this.stopEditing(e, { source: n, suppressNavigateAfterEdit: !0 }), !0;
    } finally {
      this.committing = !1;
    }
  }
  handleColDefChanged(e) {
    uT(this.beans, e);
  }
  destroy() {
    this.model.clear(), this.destroyStrategy(), super.destroy();
  }
  prepDetailsDuringBatch(e, t) {
    if (!this.batch || !this.model.hasRowEdits(e.rowNode, Ki))
      return;
    const { rowNode: i, column: r } = e, { compDetails: n, valueToDisplay: o } = t;
    if (n) {
      const { params: l } = n;
      return l.data = this.model.getEditRowDataValue(i, Ki), { compDetails: n };
    }
    const a = this.model.getEditRow(e.rowNode, Ki);
    if (o !== void 0 && (a != null && a.has(r)))
      return { valueToDisplay: this.valueSvc.getValue(r, i) };
  }
  cleanupEditors() {
    var e;
    (e = this.strategy) == null || e.cleanupEditors();
  }
  dispatchCellEvent(e, t, s, i) {
    var r;
    (r = this.strategy) == null || r.dispatchCellEvent(e, t, s, i);
  }
  dispatchBatchEvent(e, t) {
    this.eventSvc.dispatchEvent(this.createBatchEditEvent(e, t));
  }
  createBatchEditEvent(e, t) {
    return V(this.gos, {
      type: e,
      ...e === "batchEditingStopped" ? {
        changes: this.toEventChangeList(t)
      } : {}
    });
  }
  toEventChangeList(e) {
    return this.model.getEditPositions(e).map((t) => ({
      rowIndex: t.rowNode.rowIndex,
      rowPinned: t.rowNode.rowPinned,
      columnId: t.column.getColId(),
      newValue: t.pendingValue,
      oldValue: t.sourceValue
    }));
  }
  applyBulkEdit({ rowNode: e, column: t }, s) {
    var c, d;
    if (!s || s.length === 0)
      return;
    const { beans: i, rangeSvc: r, valueSvc: n } = this;
    ui(i, { persist: !0 });
    const o = this.model.getEditMap(!0), a = (d = (c = o.get(e)) == null ? void 0 : c.get(t)) == null ? void 0 : d.pendingValue;
    this.batch || this.eventSvc.dispatchEvent({ type: "bulkEditingStarted" }), s.forEach((h) => {
      if (r == null || r.forEachRowInRange(h, (u) => {
        const g = Ee(i, u);
        if (g === void 0)
          return;
        const p = o.get(g) ?? /* @__PURE__ */ new Map();
        for (const f of h.columns)
          if (f && this.isCellEditable({ rowNode: g, column: f }, "api")) {
            const m = n.getValue(f, g, !0, "api");
            let C = n.parseValue(
              f,
              g ?? null,
              a,
              m
            );
            Number.isNaN(C) && (C = null), p.set(f, {
              editorValue: void 0,
              pendingValue: C,
              sourceValue: m,
              state: "changed",
              editorState: {
                isCancelAfterEnd: void 0,
                isCancelBeforeStart: void 0
              }
            });
          }
        p.size > 0 && o.set(g, p);
      }), this.setEditMap(o), this.batch) {
        this.cleanupEditors(), cc(i), this.bulkRefresh();
        return;
      }
      this.commitNextEdit(), this.stopEditing(void 0, { source: "bulk" }), this.eventSvc.dispatchEvent({ type: "bulkEditingStopped", changes: this.toEventChangeList(o) });
    }), this.bulkRefresh();
    const l = ge(i, { rowNode: e, column: t });
    l && l.focusCell(!0);
  }
  createCellStyleFeature(e, t) {
    return new O0(e, t);
  }
  createRowStyleFeature(e, t) {
    return new V0(e, t);
  }
  setEditingCells(e, t) {
    const { beans: s } = this, { colModel: i, valueSvc: r } = s, n = /* @__PURE__ */ new Map();
    e.forEach(({ colId: o, column: a, colKey: l, rowIndex: c, rowPinned: d, newValue: h, state: u }) => {
      const g = o ? i.getCol(o) : l ? i.getCol(l) : a;
      if (!g)
        return;
      const p = Ee(s, { rowIndex: c, rowPinned: d });
      if (!p)
        return;
      const f = r.getValue(g, p, !0, "api");
      if (!(t != null && t.forceRefreshOfEditCellsOnly) && !ys({ pendingValue: h, sourceValue: f }) && u !== "editing")
        return;
      let m = n.get(p);
      m || (m = /* @__PURE__ */ new Map(), n.set(p, m)), h === void 0 && (h = Dt), m.set(g, {
        editorValue: void 0,
        pendingValue: h,
        sourceValue: f,
        state: u ?? "changed",
        editorState: {
          isCancelAfterEnd: void 0,
          isCancelBeforeStart: void 0
        }
      });
    }), this.setEditMap(n, t);
  }
  onCellFocused(e) {
    var n;
    const t = ge(this.beans, e);
    if (!t || !this.isEditing(t, Ki))
      return;
    const s = this.model.getEdit(t);
    if (!s || !ys(s))
      return;
    const r = this.getLocaleTextFunc()("ariaPendingChange", "Pending Change");
    (n = this.beans.ariaAnnounce) == null || n.announceValue(r, "pendingChange");
  }
  allowedFocusTargetOnValidation(e) {
    return ge(this.beans, e);
  }
};
function j0(e) {
  return {
    rowNodes: e ? Array.from(e.keys()) : void 0,
    columns: e ? [...new Set(Array.from(e.values()).flatMap((t) => Array.from(t.keys())))] : void 0
  };
}
function Cu(e, t) {
  return t ?? e.get("editType") ?? "singleCell";
}
var Lm = class extends R {
  postConstruct() {
    var e, t;
    this.model = this.beans.editModelSvc, this.editSvc = this.beans.editSvc, this.addManagedEventListeners({
      cellFocused: (e = this.onCellFocusChanged) == null ? void 0 : e.bind(this),
      cellFocusCleared: (t = this.onCellFocusChanged) == null ? void 0 : t.bind(this)
    });
  }
  clearEdits(e) {
    this.model.clearEditValue(e);
  }
  onCellFocusChanged(e) {
    let t;
    const s = e.previousParams, { editSvc: i, beans: r } = this, n = e.type === "cellFocused" ? e.sourceEvent : null;
    s && (t = ge(r, s));
    const { gos: o, editModelSvc: a } = r, l = e.type === "cellFocusCleared";
    if (i.isEditing(void 0, { withOpenEditor: !0 })) {
      const { column: c, rowIndex: d, rowPinned: h } = e, u = {
        column: c,
        rowNode: Ee(r, { rowIndex: d, rowPinned: h })
      }, g = o.get("invalidEditValueMode") === "block";
      if (g)
        return;
      const p = !g, f = !!(a != null && a.getCellValidationModel().hasCellValidation(u)), m = p && f;
      (s || l ? i.stopEditing(void 0, {
        cancel: m,
        source: l && p ? "api" : void 0,
        event: n
      }) : !0) || (i.isBatchEditing() ? i.cleanupEditors() : i.stopEditing(void 0, { source: "api" }));
    }
    t == null || t.refreshCell({ suppressFlash: !0, force: !0 });
  }
  stop(e, t) {
    const s = this.model.getEditPositions(), i = { all: [], pass: [], fail: [] };
    if (s.forEach((n) => {
      var a;
      i.all.push(n);
      const o = this.model.getCellValidationModel().getCellValidation(n);
      if ((((a = o == null ? void 0 : o.errorMessages) == null ? void 0 : a.length) ?? 0) > 0) {
        i.fail.push(n);
        return;
      }
      i.pass.push(n);
    }), e)
      return s.forEach((n) => {
        Ho(this.beans, n, { cancel: e }), this.model.stop(n);
      }), !0;
    const r = this.processValidationResults(i);
    return r.destroy.length > 0 && r.destroy.forEach((n) => {
      Ho(this.beans, n, { event: t, cancel: e }), this.model.stop(n);
    }), r.keep.length > 0 && r.keep.forEach((n) => {
      var a;
      const o = ge(this.beans, n);
      (a = this.editSvc) != null && a.cellEditingInvalidCommitBlocks() || o && this.editSvc.revertSingleCellEdit(o);
    }), !0;
  }
  cleanupEditors({ rowNode: e } = {}, t) {
    ui(this.beans, { persist: !1 });
    const s = this.model.getEditPositions(), i = [];
    e ? s.forEach((r) => {
      !e || r.rowNode === e || i.push(r);
    }) : s.forEach((r) => {
      i.push(r);
    }), or(this.beans, i), cc(this.beans, t);
  }
  setFocusOutOnEditor(e) {
    var t, s, i;
    (i = (s = (t = e.comp) == null ? void 0 : t.getCellEditor()) == null ? void 0 : s.focusOut) == null || i.call(s);
  }
  setFocusInOnEditor(e) {
    const t = e.comp, s = t == null ? void 0 : t.getCellEditor();
    if (s != null && s.focusIn)
      s.focusIn();
    else {
      const i = this.beans.gos.get("editType") === "fullRow";
      e.focusCell(i), e.onEditorAttachedFuncs.push(() => {
        var r, n;
        return (n = (r = t == null ? void 0 : t.getCellEditor()) == null ? void 0 : r.focusIn) == null ? void 0 : n.call(r);
      });
    }
  }
  setupEditors(e) {
    const { event: t, ignoreEventKey: s = !1, startedEdit: i, position: r, cells: n = this.model.getEditPositions() } = e, o = t instanceof KeyboardEvent && !s && t.key || void 0;
    hT(this.beans, n, r, o, t, i);
  }
  dispatchCellEvent(e, t, s, i) {
    const r = ge(this.beans, e);
    r && this.eventSvc.dispatchEvent({ ...r.createEvent(t ?? null, s), ...i });
  }
  dispatchRowEvent(e, t, s) {
    if (s)
      return;
    const i = Ed(this.beans, e);
    i && this.eventSvc.dispatchEvent(i.createRowEvent(t));
  }
  shouldStop(e, t, s = "ui") {
    const i = this.editSvc.isBatchEditing();
    return i && s === "api" ? !0 : i && (s === "ui" || s === "edit") ? !1 : s === "api" ? !0 : t instanceof KeyboardEvent && !i ? t.key === S.ENTER : null;
  }
  shouldCancel(e, t, s = "ui") {
    const i = this.editSvc.isBatchEditing();
    return !!(t instanceof KeyboardEvent && !i && t.key === S.ESCAPE || i && s === "api" || s === "api");
  }
  setEditMap(e, t) {
    var i;
    t != null && t.update || this.editSvc.stopEditing(void 0, { cancel: !0, source: "api" });
    const s = [];
    if (e.forEach((r, n) => {
      r.forEach((o, a) => {
        o.state === "editing" && s.push({ ...o, rowNode: n, column: a });
      });
    }), t != null && t.update && (e = new Map([...this.model.getEditMap(), ...e])), (i = this.model) == null || i.setEditMap(e), s.length > 0) {
      const r = s.at(-1), n = r.pendingValue === Dt ? void 0 : r.pendingValue;
      this.start({ position: r, event: new KeyboardEvent("keydown", { key: n }), source: "api" });
      const o = ge(this.beans, r);
      o && this.setFocusInOnEditor(o);
    }
  }
  destroy() {
    this.cleanupEditors(), super.destroy();
  }
}, Y0 = class extends Lm {
  constructor() {
    super(...arguments), this.beanName = "fullRow", this.startedRows = [];
  }
  shouldStop(e, t, s = "ui") {
    const { rowNode: i } = e || {};
    if (!Ed(this.beans, {
      rowNode: this.rowNode
    }))
      return !0;
    const n = super.shouldStop({ rowNode: this.rowNode }, t, s);
    return n !== null ? n : this.rowNode ? i !== this.rowNode : !1;
  }
  midBatchInputsAllowed({ rowNode: e }) {
    return e ? this.model.hasEdits({ rowNode: e }) : !1;
  }
  clearEdits(e) {
    this.model.clearEditValue(e);
  }
  start(e) {
    const { position: t, silent: s, startedEdit: i, event: r, ignoreEventKey: n } = e, { rowNode: o } = t;
    this.rowNode !== o && super.cleanupEditors(t), this.dispatchRowEvent({ rowNode: o }, "rowEditingStarted", s), this.startedRows.push(o);
    const a = this.beans.visibleCols.allCols, l = [];
    a.forEach((c) => {
      if (!c.isCellEditable(o))
        return;
      const d = {
        rowNode: o,
        column: c
      };
      l.push(d), this.model.hasEdits(d) || this.model.start(d);
    }), this.rowNode = o, this.setupEditors({ cells: l, position: t, startedEdit: i, event: r, ignoreEventKey: n });
  }
  processValidationResults(e) {
    return e.fail.length > 0 && this.editSvc.cellEditingInvalidCommitBlocks() ? {
      destroy: [],
      keep: e.all
    } : {
      destroy: e.all,
      keep: []
    };
  }
  stop(e, t) {
    var r;
    const { rowNode: s } = this;
    if (s && !this.model.hasRowEdits(s))
      return !1;
    const i = [];
    return e || this.model.getEditMap().forEach((n, o) => {
      if (!(!n || n.size === 0)) {
        for (const a of n.values())
          if (ys(a)) {
            i.push(o);
            break;
          }
      }
    }), Ai(this.beans), !e && ((r = this.editSvc) == null ? void 0 : r.checkNavWithValidation({ rowNode: s })) === "block-stop" ? !1 : (super.stop(e, t), i.forEach((n) => this.dispatchRowEvent({ rowNode: n }, "rowValueChanged")), this.cleanupEditors({ rowNode: s }, !0), this.rowNode = void 0, !0);
  }
  onCellFocusChanged(e) {
    const { rowIndex: t } = e, s = e.previousParams;
    if ((s == null ? void 0 : s.rowIndex) === t || e.sourceEvent instanceof KeyboardEvent)
      return;
    const i = ge(this.beans, s);
    this.gos.get("invalidEditValueMode") === "block" && i && (this.model.getCellValidationModel().getCellValidation(i) || this.model.getRowValidationModel().getRowValidation(i)) || super.onCellFocusChanged(e);
  }
  cleanupEditors(e = {}, t) {
    super.cleanupEditors(e, t), this.startedRows.forEach((s) => this.dispatchRowEvent({ rowNode: s }, "rowEditingStopped")), this.startedRows.length = 0;
  }
  // returns null if no navigation should be performed
  moveToNextEditingCell(e, t, s, i = "ui", r = !1) {
    var u, g, p, f;
    const n = e.cellPosition;
    let o;
    this.model.suspend(!0);
    try {
      o = (u = this.beans.navigation) == null ? void 0 : u.findNextCellToFocusOn(n, {
        backwards: t,
        startEditing: !0,
        // Default behaviour for fullRow is skip to the next cell,
        // editable or not. FullRow editing might have some editable
        // and some not editable cells in the row.
        // More complex logic needed to skip to the
        // next FullRow editable cell,
        skipToNextEditableCell: !1
      });
    } finally {
      this.model.suspend(!1);
    }
    if (o === !1)
      return null;
    if (o == null)
      return !1;
    const a = o.cellPosition, l = e.isCellEditable(), c = o.isCellEditable(), d = a && n.rowIndex === a.rowIndex && n.rowPinned === a.rowPinned;
    l && this.setFocusOutOnEditor(e), this.restoreEditors();
    const h = this.gos.get("suppressStartEditOnTab");
    return c && !r ? h ? o.focusCell(!0, s) : ((g = o.comp) != null && g.getCellEditor() || Cr(this.beans, o, { event: s, cellStartedEdit: !0 }), this.setFocusInOnEditor(o), o.focusCell(!1, s)) : (c && r && this.setFocusInOnEditor(o), o.focusCell(!0, s)), !d && !r && ((p = this.editSvc) == null || p.stopEditing({ rowNode: e.rowNode }, { event: s }), this.cleanupEditors(o, !0), h ? o.focusCell(!0, s) : this.editSvc.startEditing(o, { startedEdit: !0, event: s, source: i, ignoreEventKey: !0 })), (f = e.rowCtrl) == null || f.refreshRow({ suppressFlash: !0, force: !0 }), !0;
  }
  restoreEditors() {
    this.model.getEditMap().forEach(
      (e, t) => e.forEach(({ state: s }, i) => {
        var n;
        if (s !== "editing")
          return;
        const r = ge(this.beans, {
          rowNode: t,
          column: i
        });
        r && !((n = r.comp) != null && n.getCellEditor()) && Cr(this.beans, r, { silent: !0 });
      })
    );
  }
  destroy() {
    super.destroy(), this.rowNode = void 0, this.startedRows.length = 0;
  }
}, q0 = class extends Lm {
  constructor() {
    super(...arguments), this.beanName = "singleCell";
  }
  shouldStop(e, t, s = "ui") {
    const i = super.shouldStop(e, t, s);
    if (i !== null)
      return i;
    const { rowNode: r, column: n } = e || {};
    return (!this.rowNode || !this.column) && r && n ? null : this.rowNode !== r || this.column !== n;
  }
  midBatchInputsAllowed(e) {
    return this.model.hasEdits(e);
  }
  start(e) {
    const { position: t, startedEdit: s, event: i, ignoreEventKey: r } = e;
    (this.rowNode !== t.rowNode || this.column !== t.column) && super.cleanupEditors(), this.rowNode = t.rowNode, this.column = t.column, this.model.start(t), this.setupEditors({ cells: [t], position: t, startedEdit: s, event: i, ignoreEventKey: r });
  }
  dispatchRowEvent(e, t, s) {
  }
  processValidationResults(e) {
    return e.fail.length > 0 && this.editSvc.cellEditingInvalidCommitBlocks() ? {
      destroy: [],
      keep: e.all
    } : {
      destroy: e.all,
      keep: []
    };
  }
  stop(e, t) {
    return super.stop(e, t), this.rowNode = void 0, this.column = void 0, !0;
  }
  onCellFocusChanged(e) {
    const { colModel: t, editSvc: s } = this.beans, { rowIndex: i, column: r, rowPinned: n } = e, o = Ee(this.beans, { rowIndex: i, rowPinned: n }), a = lc(r), l = t.getCol(a), c = e.previousParams;
    if (c) {
      const d = lc(c.column);
      if ((c == null ? void 0 : c.rowIndex) === i && d === a && (c == null ? void 0 : c.rowPinned) === n)
        return;
    }
    s != null && s.isEditing({ rowNode: o, column: l }, { withOpenEditor: !0 }) && e.type === "cellFocused" || super.onCellFocusChanged(e);
  }
  // returns null if no navigation should be performed
  moveToNextEditingCell(e, t, s, i = "ui", r = !1) {
    var p, f, m, C, v, w;
    const n = this.beans.focusSvc.getFocusedCell();
    n && (e = qt(this.beans, n) ?? e);
    const o = e.cellPosition;
    let a;
    const l = this.beans.gos.get("editType") === "fullRow";
    l && this.model.suspend(!0), r || (e.eGui.focus(), (f = this.editSvc) == null || f.stopEditing(e, { source: (p = this.editSvc) != null && p.isBatchEditing() ? "ui" : "api", event: s }));
    try {
      a = (m = this.beans.navigation) == null ? void 0 : m.findNextCellToFocusOn(o, {
        backwards: t,
        startEditing: !0
        // Default behaviour for fullRow is skip to the next cell,
        // editable or not. FullRow editing might have some editable
        // and some not editable cells in the row.
        // More complex logic needed to skip to the
        // next FullRow editable cell,
        // skipToNextEditableCell: false,
      });
    } finally {
      l && this.model.suspend(!1);
    }
    if (a === !1)
      return null;
    if (a == null)
      return !1;
    const c = a.cellPosition, d = e.isCellEditable(), h = a.isCellEditable(), u = c && o.rowIndex === c.rowIndex && o.rowPinned === c.rowPinned;
    d && !r && this.setFocusOutOnEditor(e);
    const g = this.gos.get("suppressStartEditOnTab");
    if (!u && !r && (super.cleanupEditors(a, !0), g ? a.focusCell(!0, s) : this.editSvc.startEditing(a, { startedEdit: !0, event: s, source: i, ignoreEventKey: !0 })), h && !r) {
      if (a.focusCell(!1, s), g)
        a.focusCell(!0, s);
      else if (!((C = a.comp) != null && C.getCellEditor())) {
        const b = (v = this.editSvc) == null ? void 0 : v.isEditing(a, { withOpenEditor: !0 });
        Cr(this.beans, a, { event: s, cellStartedEdit: !0, silent: b }), this.setFocusInOnEditor(a), this.cleanupEditors(a);
      }
    } else
      h && r && this.setFocusInOnEditor(a), a.focusCell(!0, s);
    return (w = e.rowCtrl) == null || w.refreshRow({ suppressFlash: !0, force: !0 }), !0;
  }
  destroy() {
    super.destroy(), this.rowNode = void 0, this.column = void 0;
  }
}, ds = {
  moduleName: "EditCore",
  version: B,
  beans: [lT, K0],
  apiFunctions: {
    getEditingCells: F0,
    getEditRowValues: x0,
    getCellEditorInstances: dT,
    startEditingCell: E0,
    stopEditing: R0,
    isEditing: P0,
    validateEdit: T0
  },
  dynamicBeans: {
    singleCell: q0,
    fullRow: Y0
  },
  dependsOn: [Is, Nd],
  css: [e0]
}, X0 = {
  moduleName: "UndoRedoEdit",
  version: B,
  beans: [JD],
  apiFunctions: {
    undoCellEditing: y0,
    redoCellEditing: S0,
    getCurrentUndoSize: M0,
    getCurrentRedoSize: D0
  },
  dependsOn: [ds]
}, Z0 = {
  moduleName: "TextEditor",
  version: B,
  userComponents: { agCellEditor: mu, agTextCellEditor: mu },
  dependsOn: [ds]
}, Q0 = {
  moduleName: "NumberEditor",
  version: B,
  userComponents: {
    agNumberCellEditor: {
      classImp: g0
    }
  },
  dependsOn: [ds]
}, J0 = {
  moduleName: "DateEditor",
  version: B,
  userComponents: {
    agDateCellEditor: n0,
    agDateStringCellEditor: l0
  },
  dependsOn: [ds]
}, eA = {
  moduleName: "CheckboxEditor",
  version: B,
  userComponents: {
    agCheckboxCellEditor: s0
  },
  dependsOn: [ds]
}, tA = {
  moduleName: "SelectEditor",
  version: B,
  userComponents: { agSelectCellEditor: f0 },
  dependsOn: [ds]
}, sA = {
  moduleName: "LargeTextEditor",
  version: B,
  userComponents: { agLargeTextCellEditor: d0 },
  dependsOn: [ds]
}, iA = {
  moduleName: "CustomEditor",
  version: B,
  dependsOn: [ds]
}, rA = class extends R {
  constructor() {
    super(...arguments), this.beanName = "selectionColSvc";
  }
  postConstruct() {
    this.addManagedPropertyListener("rowSelection", (e) => {
      this.onSelectionOptionsChanged(
        e.currentValue,
        e.previousValue,
        qs(e.source)
      );
    }), this.addManagedPropertyListener("selectionColumnDef", this.updateColumns.bind(this));
  }
  addColumns(e) {
    const t = this.columns;
    t != null && (e.list = t.list.concat(e.list), e.tree = t.tree.concat(e.tree), da(e));
  }
  createColumns(e, t) {
    var u, g;
    const s = () => {
      var p;
      Ht(this.beans, (p = this.columns) == null ? void 0 : p.tree), this.columns = null;
    }, i = e.treeDepth, n = (((u = this.columns) == null ? void 0 : u.treeDepth) ?? -1) == i, o = this.generateSelectionCols();
    if (ca(o, ((g = this.columns) == null ? void 0 : g.list) ?? []) && n)
      return;
    s();
    const { colGroupSvc: l } = this.beans, c = (l == null ? void 0 : l.findDepth(e.tree)) ?? 0, d = (l == null ? void 0 : l.balanceTreeForAutoCols(o, c)) ?? [];
    this.columns = {
      list: o,
      tree: d,
      treeDepth: c,
      map: {}
    }, t((p) => {
      if (!p)
        return null;
      const f = p.filter((m) => !Ds(m));
      return [...o, ...f];
    });
  }
  updateColumns(e) {
    var s;
    const t = qs(e.source);
    (s = this.columns) == null || s.list.forEach((i) => {
      const r = this.createSelectionColDef(e.currentValue);
      i.setColDef(r, null, t), je(this.beans, { state: [{ ...r, colId: i.getColId() }] }, t);
    });
  }
  getColumn(e) {
    var t;
    return ((t = this.columns) == null ? void 0 : t.list.find((s) => nn(s, e))) ?? null;
  }
  getColumns() {
    var e;
    return ((e = this.columns) == null ? void 0 : e.list) ?? null;
  }
  isSelectionColumnEnabled() {
    var o, a;
    const { gos: e, beans: t } = this, s = e.get("rowSelection");
    if (typeof s != "object" || !wt(e))
      return !1;
    const i = (((a = (o = t.autoColSvc) == null ? void 0 : o.getColumns()) == null ? void 0 : a.length) ?? 0) > 0;
    if (s.checkboxLocation === "autoGroupColumn" && i)
      return !1;
    const r = !!vi(s), n = so(s);
    return r || n;
  }
  createSelectionColDef(e) {
    const { gos: t } = this, s = e ?? t.get("selectionColumnDef"), i = t.get("enableRtl"), { rowSpan: r, spanRows: n, ...o } = s ?? {};
    return {
      // overridable properties
      width: 50,
      resizable: !1,
      suppressHeaderMenuButton: !0,
      sortable: !1,
      suppressMovable: !0,
      lockPosition: i ? "right" : "left",
      comparator(a, l, c, d) {
        const h = c.isSelected(), u = d.isSelected();
        return h === u ? 0 : h ? 1 : -1;
      },
      editable: !1,
      suppressFillHandle: !0,
      pinned: null,
      // overrides
      ...o,
      // non-overridable properties
      colId: lp,
      chartDataType: "excluded"
    };
  }
  generateSelectionCols() {
    if (!this.isSelectionColumnEnabled())
      return [];
    const e = this.createSelectionColDef(), t = e.colId;
    this.gos.validateColDef(e, t, !0);
    const s = new Wt(e, null, t, !1);
    return this.createBean(s), [s];
  }
  onSelectionOptionsChanged(e, t, s) {
    const i = t && typeof t != "string" ? vi(t) : void 0, r = e && typeof e != "string" ? vi(e) : void 0, n = i !== r, o = t && typeof t != "string" ? so(t) : void 0, a = e && typeof e != "string" ? so(e) : void 0, l = o !== a, c = rn(e), d = rn(t);
    (n || l || c !== d) && this.beans.colModel.refreshAll(s);
  }
  destroy() {
    var e;
    Ht(this.beans, (e = this.columns) == null ? void 0 : e.tree), super.destroy();
  }
  /**
   * Refreshes visibility of the selection column based on which columns are currently visible.
   * Called by the VisibleColsService with the columns that are currently visible in left/center/right
   * containers. This method *MUTATES* those arrays directly.
   *
   * The selection column should be visible if all of the following are true
   * - The selection column is not disabled
   * - The number of visible columns excluding the selection column and row numbers column is greater than 0
   * @param leftCols Visible columns in the left-pinned container
   * @param centerCols Visible columns in the center viewport
   * @param rightCols Visible columns in the right-pinned container
   */
  refreshVisibility(e, t, s) {
    var l, c;
    if (!((l = this.columns) != null && l.list.length))
      return;
    const i = e.length + t.length + s.length;
    if (i === 0)
      return;
    const r = this.columns.list[0];
    if (!r.isVisible())
      return;
    const n = () => {
      let d;
      switch (r.pinned) {
        case "left":
        case !0:
          d = e;
          break;
        case "right":
          d = s;
          break;
        default:
          d = t;
      }
      d && be(d, r);
    };
    (((c = this.beans.rowNumbersSvc) == null ? void 0 : c.getColumn(Yc)) ? 2 : 1) === i && n();
  }
};
function nA(e, t) {
  var o;
  if (!t.nodes.every((a) => a.rowPinned && !Fn(a) ? (F(59), !1) : a.id === void 0 ? (F(60), !1) : !0))
    return;
  const { nodes: i, source: r, newValue: n } = t;
  (o = e.selectionSvc) == null || o.setNodesSelected({ nodes: i, source: r ?? "api", newValue: n });
}
function oA(e, t, s = "apiSelectAll") {
  var i;
  (i = e.selectionSvc) == null || i.selectAllRowNodes({ source: s, selectAll: t });
}
function aA(e, t, s = "apiSelectAll") {
  var i;
  (i = e.selectionSvc) == null || i.deselectAllRowNodes({ source: s, selectAll: t });
}
function lA(e, t = "apiSelectAllFiltered") {
  var s;
  (s = e.selectionSvc) == null || s.selectAllRowNodes({ source: t, selectAll: "filtered" });
}
function cA(e, t = "apiSelectAllFiltered") {
  var s;
  (s = e.selectionSvc) == null || s.deselectAllRowNodes({ source: t, selectAll: "filtered" });
}
function dA(e, t = "apiSelectAllCurrentPage") {
  var s;
  (s = e.selectionSvc) == null || s.selectAllRowNodes({ source: t, selectAll: "currentPage" });
}
function hA(e, t = "apiSelectAllCurrentPage") {
  var s;
  (s = e.selectionSvc) == null || s.deselectAllRowNodes({ source: t, selectAll: "currentPage" });
}
function uA(e) {
  var t;
  return ((t = e.selectionSvc) == null ? void 0 : t.getSelectedNodes()) ?? [];
}
function gA(e) {
  var t;
  return ((t = e.selectionSvc) == null ? void 0 : t.getSelectedRows()) ?? [];
}
var pA = class extends Ef {
  constructor() {
    super(...arguments), this.beanName = "selectionSvc", this.selectedNodes = /* @__PURE__ */ new Map(), this.detailSelection = /* @__PURE__ */ new Map(), this.masterSelectsDetail = !1;
  }
  postConstruct() {
    super.postConstruct();
    const { gos: e } = this;
    this.mode = gr(e), this.groupSelectsDescendants = Ei(e), this.groupSelectsFiltered = Po(e) === "filteredDescendants", this.masterSelectsDetail = vh(e) === "detail", this.addManagedPropertyListeners(["groupSelectsChildren", "groupSelectsFiltered", "rowSelection"], () => {
      const t = Ei(e), s = gr(e), i = Po(e) === "filteredDescendants";
      this.masterSelectsDetail = vh(e) === "detail", (t !== this.groupSelectsDescendants || i !== this.groupSelectsFiltered || s !== this.mode) && (this.deselectAllRowNodes({ source: "api" }), this.groupSelectsDescendants = t, this.groupSelectsFiltered = i, this.mode = s);
    }), this.addManagedEventListeners({ rowSelected: this.onRowSelected.bind(this) });
  }
  destroy() {
    super.destroy(), this.resetNodes();
  }
  handleSelectionEvent(e, t, s) {
    if (this.isRowSelectionBlocked(t))
      return 0;
    const i = this.inferNodeSelections(t, e.shiftKey, e.metaKey || e.ctrlKey, s);
    if (i == null)
      return 0;
    if (this.selectionCtx.selectAll = !1, "select" in i)
      return i.reset ? this.resetNodes() : this.selectRange(i.deselect, !1, s), this.selectRange(i.select, !0, s);
    {
      const r = i.checkFilteredNodes ? Gm(i.node) : i.newValue;
      return this.setNodesSelected({
        nodes: [i.node],
        newValue: r,
        clearSelection: i.clearSelection,
        keepDescendants: i.keepDescendants,
        event: e,
        source: s
      });
    }
  }
  setNodesSelected({
    newValue: e,
    clearSelection: t,
    suppressFinishActions: s,
    nodes: i,
    event: r,
    source: n,
    keepDescendants: o = !1
  }) {
    var c;
    const { gos: a } = this;
    if (!wt(a) && e)
      return F(132), 0;
    if (i.length === 0)
      return 0;
    if (i.length > 1 && !this.isMultiSelect())
      return F(130), 0;
    let l = 0;
    for (let d = 0; d < i.length; d++) {
      const h = i[d], u = ji(h);
      if (u.rowPinned && !Fn(u)) {
        F(59);
        continue;
      }
      if (u.id === void 0) {
        F(60);
        continue;
      }
      this.groupSelectsFiltered && u.group && !a.get("treeData") || this.selectRowNode(u, e, r, n) && (this.detailSelection.delete(u.id), l++), this.groupSelectsDescendants && ((c = u.childrenAfterGroup) != null && c.length) && (l += this.selectChildren(u, e, n));
    }
    return s || (i.length === 1 && n === "api" && this.selectionCtx.setRoot(ji(i[0])), e && (t || !this.isMultiSelect()) && (l += this.clearOtherNodes(ji(i[0]), o, n)), l > 0 && (this.updateGroupsFromChildrenSelections(n), this.dispatchSelectionChanged(n))), l;
  }
  // not to be mixed up with 'cell range selection' where you drag the mouse, this is row range selection, by
  // holding down 'shift'.
  selectRange(e, t, s) {
    let i = 0;
    return e.forEach((r) => {
      const n = ji(r);
      if (n.group && this.groupSelectsDescendants)
        return;
      this.selectRowNode(n, t, void 0, s) && i++;
    }), i > 0 && (this.updateGroupsFromChildrenSelections(s), this.dispatchSelectionChanged(s)), i;
  }
  selectChildren(e, t, s) {
    const i = this.groupSelectsFiltered ? e.childrenAfterAggFilter : e.childrenAfterGroup;
    return i ? this.setNodesSelected({
      newValue: t,
      clearSelection: !1,
      suppressFinishActions: !0,
      source: s,
      nodes: i
    }) : 0;
  }
  getSelectedNodes() {
    return Array.from(this.selectedNodes.values());
  }
  getSelectedRows() {
    const e = [];
    return this.selectedNodes.forEach((t) => t.data && e.push(t.data)), e;
  }
  getSelectionCount() {
    return this.selectedNodes.size;
  }
  /**
   * This method is used by the CSRM to remove groups which are being disposed of,
   * events do not need fired in this case
   */
  filterFromSelection(e) {
    const t = /* @__PURE__ */ new Map();
    this.selectedNodes.forEach((s, i) => {
      e(s) && t.set(i, s);
    }), this.selectedNodes = t;
  }
  updateGroupsFromChildrenSelections(e, t) {
    if (!this.groupSelectsDescendants)
      return !1;
    const { gos: s, rowModel: i } = this.beans;
    if (!te(s))
      return !1;
    const r = i.rootNode;
    if (!r)
      return !1;
    t || (t = new Di(!0, r), t.active = !1);
    let n = !1;
    return t.forEachChangedNodeDepthFirst((o) => {
      if (o !== r) {
        const a = this.calculateSelectedFromChildren(o);
        n = this.selectRowNode(o, a === null ? !1 : a, void 0, e) || n;
      }
    }), n;
  }
  clearOtherNodes(e, t, s) {
    const i = /* @__PURE__ */ new Map();
    let r = 0;
    return this.selectedNodes.forEach((n) => {
      const o = n.id == e.id;
      if ((t ? !mA(e, n) : !0) && !o) {
        const l = this.selectedNodes.get(n.id);
        r += this.setNodesSelected({
          nodes: [l],
          newValue: !1,
          clearSelection: !1,
          suppressFinishActions: !0,
          source: s
        }), this.groupSelectsDescendants && n.parent && i.set(n.parent.id, n.parent);
      }
    }), i.forEach((n) => {
      const o = this.calculateSelectedFromChildren(n);
      this.selectRowNode(n, o === null ? !1 : o, void 0, s);
    }), r;
  }
  onRowSelected(e) {
    const t = e.node;
    this.groupSelectsDescendants && t.group || (t.isSelected() ? this.selectedNodes.set(t.id, t) : this.selectedNodes.delete(t.id));
  }
  syncInRowNode(e, t) {
    this.syncInOldRowNode(e, t), this.syncInNewRowNode(e);
  }
  createDaemonNode(e) {
    if (!e.id)
      return;
    const t = new ft(this.beans);
    return t.id = e.id, t.data = e.data, t.__daemon = !0, t.__selected = e.__selected, t.level = e.level, t;
  }
  // if the id has changed for the node, then this means the rowNode
  // is getting used for a different data item, which breaks
  // our selectedNodes, as the node now is mapped by the old id
  // which is inconsistent. so to keep the old node as selected,
  // we swap in the clone (with the old id and old data). this means
  // the oldNode is effectively a daemon we keep a reference to,
  // so if client calls api.getSelectedNodes(), it gets the daemon
  // in the result. when the client un-selects, the reference to the
  // daemon is removed. the daemon, because it's an oldNode, is not
  // used by the grid for rendering, it's a copy of what the node used
  // to be like before the id was changed.
  syncInOldRowNode(e, t) {
    t && e.id !== t.id && this.selectedNodes.get(t.id) == e && this.selectedNodes.set(t.id, t);
  }
  syncInNewRowNode(e) {
    this.selectedNodes.has(e.id) ? (e.__selected = !0, this.selectedNodes.set(e.id, e)) : e.__selected = !1;
  }
  reset(e) {
    const t = this.getSelectionCount();
    this.resetNodes(), t && this.dispatchSelectionChanged(e);
  }
  resetNodes() {
    this.selectedNodes.forEach((e) => {
      this.selectRowNode(e, !1);
    }), this.selectedNodes.clear();
  }
  // returns a list of all nodes at 'best cost' - a feature to be used
  // with groups / trees. if a group has all it's children selected,
  // then the group appears in the result, but not the children.
  // Designed for use with 'children' as the group selection type,
  // where groups don't actually appear in the selection normally.
  getBestCostNodeSelection() {
    const { gos: e, rowModel: t } = this.beans;
    if (!te(e))
      return;
    const s = t.getTopLevelNodes();
    if (s === null)
      return;
    const i = [];
    function r(n) {
      for (let o = 0, a = n.length; o < a; o++) {
        const l = n[o];
        l.isSelected() ? i.push(l) : l.group && l.childrenAfterGroup && r(l.childrenAfterGroup);
      }
    }
    return r(s), i;
  }
  isEmpty() {
    return this.getSelectionCount() === 0;
  }
  deselectAllRowNodes({ source: e, selectAll: t }) {
    const s = te(this.gos);
    let i = !1;
    const r = (n) => {
      const o = this.selectRowNode(ji(n), !1, void 0, e);
      i || (i = o);
    };
    if (t === "currentPage" || t === "filtered") {
      if (!s) {
        j(102);
        return;
      }
      this.getNodesToSelect(t).forEach(r);
    } else
      this.selectedNodes.forEach(r), this.reset(e);
    if (this.selectionCtx.selectAll = !1, s && this.groupSelectsDescendants) {
      const n = this.updateGroupsFromChildrenSelections(e);
      i || (i = n);
    }
    i && this.dispatchSelectionChanged(e);
  }
  getSelectedCounts(e) {
    let t = 0, s = 0;
    return this.getNodesToSelect(e).forEach((i) => {
      this.groupSelectsDescendants && i.group || (i.isSelected() ? t++ : i.selectable && s++);
    }), { selectedCount: t, notSelectedCount: s };
  }
  getSelectAllState(e) {
    const { selectedCount: t, notSelectedCount: s } = this.getSelectedCounts(e);
    return km(t, s) ?? null;
  }
  hasNodesToSelect(e) {
    return this.getNodesToSelect(e).filter((t) => t.selectable).length > 0;
  }
  /**
   * @param selectAll See `MultiRowSelectionOptions.selectAll`
   * @returns all nodes including unselectable nodes which are the target of this selection attempt
   */
  getNodesToSelect(e) {
    if (!this.canSelectAll())
      return [];
    const t = [], s = (r) => t.push(r);
    if (e === "currentPage")
      return this.forEachNodeOnPage((r) => {
        if (!r.group) {
          s(r);
          return;
        }
        if (!r.expanded && !r.footer) {
          const n = (o) => {
            var a;
            s(o), (a = o.childrenAfterFilter) == null || a.forEach(n);
          };
          n(r);
          return;
        }
        this.groupSelectsDescendants || s(r);
      }), t;
    const i = this.beans.rowModel;
    return e === "filtered" ? (i.forEachNodeAfterFilter(s), t) : (i.forEachNode(s), t);
  }
  forEachNodeOnPage(e) {
    const { pageBounds: t, rowModel: s } = this.beans, i = t.getFirstRow(), r = t.getLastRow();
    for (let n = i; n <= r; n++) {
      const o = s.getRow(n);
      o && e(o);
    }
  }
  selectAllRowNodes(e) {
    const { gos: t, selectionCtx: s } = this;
    if (!wt(t)) {
      F(132);
      return;
    }
    if (Kc(t) && !Ps(t)) {
      F(130);
      return;
    }
    if (!this.canSelectAll())
      return;
    const { source: i, selectAll: r } = e;
    let n = !1;
    if (this.getNodesToSelect(r).forEach((o) => {
      const a = this.selectRowNode(ji(o), !0, void 0, i);
      n || (n = a);
    }), s.selectAll = !0, te(t) && this.groupSelectsDescendants) {
      const o = this.updateGroupsFromChildrenSelections(i);
      n || (n = o);
    }
    n && this.dispatchSelectionChanged(i);
  }
  getSelectionState() {
    return this.isEmpty() ? null : Array.from(this.selectedNodes.keys());
  }
  setSelectionState(e, t, s) {
    if (e || (e = []), !Array.isArray(e)) {
      j(103);
      return;
    }
    const i = new Set(e), r = [];
    this.beans.rowModel.forEachNode((n) => {
      i.has(n.id) && r.push(n);
    }), s && this.resetNodes(), this.setNodesSelected({
      newValue: !0,
      nodes: r,
      source: t
    });
  }
  canSelectAll() {
    const { gos: e } = this.beans;
    return !!te(e);
  }
  /**
   * Updates the selectable state for a node by invoking isRowSelectable callback.
   * If the node is not selectable, it will be deselected.
   *
   * Callers:
   *  - property isRowSelectable changed
   *  - after grouping / treeData via `updateSelectableAfterGrouping`
   */
  updateSelectable(e) {
    var l;
    const { gos: t, rowModel: s } = this.beans;
    if (!wt(t))
      return;
    const i = "selectableChanged", r = e !== void 0, n = te(t) && this.groupSelectsDescendants, o = [], a = (c) => {
      var h;
      if (r && !c.group)
        return;
      if (n && c.group) {
        const u = ((h = c.childrenAfterGroup) == null ? void 0 : h.some((g) => g.selectable)) ?? !1;
        this.setRowSelectable(c, u, !0);
        return;
      }
      !this.updateRowSelectable(c, !0) && c.isSelected() && o.push(c);
    };
    if (n) {
      if (e === void 0) {
        const c = s.rootNode;
        e = c ? new Di(!1, c) : void 0;
      }
      e == null || e.forEachChangedNodeDepthFirst(a, !r, !r);
    } else
      s.forEachNode(a);
    o.length && this.setNodesSelected({
      nodes: o,
      newValue: !1,
      source: i
    }), !r && n && ((l = this.updateGroupsFromChildrenSelections) == null || l.call(this, i));
  }
  // only called by CSRM
  updateSelectableAfterGrouping(e) {
    var t;
    this.updateSelectable(e), this.groupSelectsDescendants && ((t = this.updateGroupsFromChildrenSelections) != null && t.call(this, "rowGroupChanged", e)) && this.dispatchSelectionChanged("rowGroupChanged");
  }
  refreshMasterNodeState(e, t) {
    var n, o;
    if (!this.masterSelectsDetail)
      return;
    const s = (o = (n = e.detailNode) == null ? void 0 : n.detailGridInfo) == null ? void 0 : o.api;
    if (!s)
      return;
    const i = fA(s);
    if (e.isSelected() !== i && this.selectRowNode(e, i, t, "masterDetail") && this.dispatchSelectionChanged("masterDetail"), !i) {
      const a = this.detailSelection.get(e.id) ?? /* @__PURE__ */ new Set();
      for (const l of s.getSelectedNodes())
        a.add(l.id);
      this.detailSelection.set(e.id, a);
    }
  }
  setDetailSelectionState(e, t, s) {
    if (this.masterSelectsDetail) {
      if (!Ps(t)) {
        F(269);
        return;
      }
      switch (e.isSelected()) {
        case !0: {
          s.selectAll();
          break;
        }
        case !1: {
          s.deselectAll();
          break;
        }
        case void 0: {
          const i = this.detailSelection.get(e.id);
          if (i) {
            const r = [];
            for (const n of i) {
              const o = s.getRowNode(n);
              o && r.push(o);
            }
            s.setNodesSelected({ nodes: r, newValue: !0, source: "masterDetail" });
          }
          break;
        }
      }
    }
  }
  dispatchSelectionChanged(e) {
    this.eventSvc.dispatchEvent({
      type: "selectionChanged",
      source: e,
      selectedNodes: this.getSelectedNodes(),
      serverSideState: null
    });
  }
};
function ji(e) {
  return Fn(e) ? e.pinnedSibling : e.footer ? e.sibling : e;
}
function fA(e) {
  let t = 0, s = 0;
  return e.forEachNode((i) => {
    i.isSelected() ? t++ : i.selectable && s++;
  }), km(t, s);
}
function km(e, t) {
  if (e === 0 && t === 0)
    return !1;
  if (!(e > 0 && t > 0))
    return e > 0;
}
function mA(e, t) {
  let s = t.parent;
  for (; s; ) {
    if (s === e)
      return !0;
    s = s.parent;
  }
  return !1;
}
function Gm(e) {
  var i;
  const t = e.isSelected() === !1, s = ((i = e.childrenAfterFilter) == null ? void 0 : i.some(Gm)) ?? !1;
  return t || s;
}
var Om = {
  moduleName: "SharedRowSelection",
  version: B,
  beans: [rA],
  apiFunctions: {
    setNodesSelected: nA,
    selectAll: oA,
    deselectAll: aA,
    selectAllFiltered: lA,
    deselectAllFiltered: cA,
    selectAllOnCurrentPage: dA,
    deselectAllOnCurrentPage: hA,
    getSelectedNodes: uA,
    getSelectedRows: gA
  }
}, CA = {
  moduleName: "RowSelection",
  version: B,
  rowModels: ["clientSide", "infinite", "viewport"],
  beans: [pA],
  dependsOn: [Om]
};
function vA(e) {
  var t;
  (t = e.expansionSvc) == null || t.expandAll(!0);
}
function wA(e) {
  var t;
  (t = e.expansionSvc) == null || t.expandAll(!1);
}
function Hd(e) {
  var t;
  (t = e.rowModel) == null || t.onRowHeightChanged();
}
function zd(e) {
  var t, s;
  if ((t = e.rowAutoHeight) != null && t.active) {
    F(3);
    return;
  }
  (s = e.rowModel) == null || s.resetRowHeights();
}
function bA(e, t, s) {
  var n;
  const i = Rn(e);
  if (i) {
    if (((n = e.rowGroupColsSvc) == null ? void 0 : n.columns.length) === 0) {
      if (t < 0) {
        j(238);
        return;
      }
      i.setRowCount(t, s);
      return;
    }
    j(28);
    return;
  }
  const r = Sa(e);
  if (r) {
    r.setRowCount(t, s);
    return;
  }
}
function yA(e) {
  var t;
  return Le(e.gos) ? e.rowModel.getBlockStates() : ((t = e.rowNodeBlockLoader) == null ? void 0 : t.getBlockState()) ?? {};
}
function SA(e) {
  return e.rowModel.isLastRowIndexKnown();
}
var Vm = {
  moduleName: "CsrmSsrmSharedApi",
  version: B,
  apiFunctions: { expandAll: vA, collapseAll: wA }
}, Bm = {
  moduleName: "RowModelSharedApi",
  version: B,
  apiFunctions: { onRowHeightChanged: Hd, resetRowHeights: zd }
}, Nm = {
  moduleName: "SsrmInfiniteSharedApi",
  version: B,
  apiFunctions: {
    setRowCount: bA,
    getCacheBlockState: yA,
    isLastRowIndexKnown: SA
  }
}, xA = class extends R {
  constructor() {
    super(...arguments), this.beanName = "alignedGridsSvc", this.consuming = !1;
  }
  getAlignedGridApis() {
    let e = this.gos.get("alignedGrids") ?? [];
    const t = typeof e == "function";
    return typeof e == "function" && (e = e()), e.map((i) => {
      var n;
      if (!i) {
        j(18), t || j(20);
        return;
      }
      if (this.isGridApi(i))
        return i;
      const r = i;
      return "current" in r ? (n = r.current) == null ? void 0 : n.api : (r.api || j(19), r.api);
    }).filter((i) => !!i && !i.isDestroyed());
  }
  isGridApi(e) {
    return !!e && !!e.dispatchEvent;
  }
  postConstruct() {
    const e = this.fireColumnEvent.bind(this);
    this.addManagedEventListeners({
      columnMoved: e,
      columnVisible: e,
      columnPinned: e,
      columnGroupOpened: e,
      columnResized: e,
      bodyScroll: this.fireScrollEvent.bind(this),
      alignedGridColumn: ({ event: t }) => this.onColumnEvent(t),
      alignedGridScroll: ({ event: t }) => this.onScrollEvent(t)
    });
  }
  // common logic across all the fire methods
  fireEvent(e) {
    this.consuming || this.getAlignedGridApis().forEach((t) => {
      t.isDestroyed() || t.dispatchEvent(e);
    });
  }
  // common logic across all consume methods. very little common logic, however extracting
  // guarantees consistency across the methods.
  onEvent(e) {
    this.consuming = !0, e(), this.consuming = !1;
  }
  fireColumnEvent(e) {
    this.fireEvent({
      type: "alignedGridColumn",
      event: e
    });
  }
  fireScrollEvent(e) {
    e.direction === "horizontal" && this.fireEvent({
      type: "alignedGridScroll",
      event: e
    });
  }
  onScrollEvent(e) {
    this.onEvent(() => {
      this.beans.ctrlsSvc.getScrollFeature().setHorizontalScrollPosition(e.left, !0);
    });
  }
  extractDataFromEvent(e, t) {
    const s = [];
    return e.columns ? e.columns.forEach((i) => {
      s.push(t(i));
    }) : e.column && s.push(t(e.column)), s;
  }
  getMasterColumns(e) {
    return this.extractDataFromEvent(e, (t) => t);
  }
  getColumnIds(e) {
    return this.extractDataFromEvent(e, (t) => t.getColId());
  }
  onColumnEvent(e) {
    this.onEvent(() => {
      switch (e.type) {
        case "columnMoved":
        case "columnVisible":
        case "columnPinned":
        case "columnResized": {
          this.processColumnEvent(e);
          break;
        }
        case "columnGroupOpened": {
          this.processGroupOpenedEvent(e);
          break;
        }
        case "columnPivotChanged":
          F(21);
          break;
      }
    });
  }
  processGroupOpenedEvent(e) {
    const { colGroupSvc: t } = this.beans;
    t && e.columnGroups.forEach((s) => {
      let i = null;
      s && (i = t.getProvidedColGroup(s.getGroupId())), !(s && !i) && t.setColumnGroupOpened(i, s.isExpanded(), "alignedGridChanged");
    });
  }
  processColumnEvent(e) {
    var d;
    const t = e.column;
    let s = null;
    const i = this.beans, { colResize: r, ctrlsSvc: n, colModel: o } = i;
    if (t && (s = o.getColDefCol(t.getColId())), t && !s)
      return;
    const a = this.getMasterColumns(e);
    switch (e.type) {
      case "columnMoved":
        {
          const u = e.api.getColumnState().map((g) => ({ colId: g.colId }));
          je(i, { state: u, applyOrder: !0 }, "alignedGridChanged");
        }
        break;
      case "columnVisible":
        {
          const u = e.api.getColumnState().map((g) => ({ colId: g.colId, hide: g.hide }));
          je(i, { state: u }, "alignedGridChanged");
        }
        break;
      case "columnPinned":
        {
          const u = e.api.getColumnState().map((g) => ({ colId: g.colId, pinned: g.pinned }));
          je(i, { state: u }, "alignedGridChanged");
        }
        break;
      case "columnResized": {
        const h = e, u = {};
        a.forEach((g) => {
          u[g.getId()] = { key: g.getColId(), newWidth: g.getActualWidth() };
        }), (d = h.flexColumns) == null || d.forEach((g) => {
          u[g.getId()] && delete u[g.getId()];
        }), r == null || r.setColumnWidths(
          Object.values(u),
          !1,
          h.finished,
          "alignedGridChanged"
        );
        break;
      }
    }
    const c = n.getGridBodyCtrl().isVerticalScrollShowing();
    this.getAlignedGridApis().forEach((h) => {
      h.setGridOption("alwaysShowVerticalScroll", c);
    });
  }
}, FA = {
  moduleName: "AlignedGrids",
  version: B,
  beans: [xA],
  dependsOn: [Nf]
}, RA = class extends Rf {
  constructor() {
    super(...arguments), this.beanName = "csrmNodeSvc";
  }
}, Cl = class {
  constructor() {
    this.removals = /* @__PURE__ */ new Set(), this.updates = /* @__PURE__ */ new Set(), this.adds = /* @__PURE__ */ new Set();
  }
  /** Marks a row as removed. Order of operations is: remove, update, add */
  remove(e) {
    this.adds.delete(e) || (this.updates.delete(e), this.removals.add(e));
  }
  /** Marks a row as updated. Order of operations is: remove, update, add */
  update(e) {
    this.adds.has(e) || this.updates.add(e);
  }
  /** Marks a row as added. Order of operation is: remove, update, add */
  add(e) {
    this.adds.add(e);
  }
}, Hm = (e) => {
  const t = e.childrenAfterSort, s = e.sibling;
  if (s && (s.childrenAfterSort = t), !!t)
    for (let i = 0, r = t.length - 1; i <= r; i++) {
      const n = t[i], o = i === 0, a = i === r;
      n.firstChild !== o && (n.firstChild = o, n.dispatchRowEvent("firstChildChanged")), n.lastChild !== a && (n.lastChild = a, n.dispatchRowEvent("lastChildChanged")), n.childIndex !== i && (n.childIndex = i, n.dispatchRowEvent("childIndexChanged"));
    }
}, PA = class extends R {
  constructor() {
    super(...arguments), this.beanName = "sortStage", this.refreshProps = /* @__PURE__ */ new Set(["postSortRows", "groupDisplayType", "accentedSort"]), this.step = "sort";
  }
  execute(e) {
    const t = this.beans.sortSvc.getSortOptions(), s = t.length > 0 && !!e.changedRowNodes && // in time we can remove this check, so that delta sort is always
    // on if transactions are present. it's off for now so that we can
    // selectively turn it on and test it with some select users before
    // rolling out to everyone.
    this.gos.get("deltaSort");
    this.sort(t, s, e.changedRowNodes, e.changedPath);
  }
  sort(e, t, s, i) {
    const { gos: r, colModel: n, rowGroupColsSvc: o, rowNodeSorter: a, rowRenderer: l, showRowGroupCols: c } = this.beans, d = r.get("groupMaintainOrder"), h = n.getCols().some((v) => v.isRowGroupActive()), u = o == null ? void 0 : o.columns, g = n.isPivotMode(), p = r.getCallback("postSortRows");
    let f = !1, m;
    const C = (v) => {
      var P, E;
      const w = g && v.leafGroup;
      let b = d && h && !v.leafGroup;
      b && (m ?? (m = this.shouldSortContainsGroupCols(e)), b && (b = !m));
      let y = null;
      if (b) {
        let M = !1;
        if (u) {
          const T = v.level + 1;
          T < u.length && (M = u[T].getSort() === null);
        }
        M || (y = MA(v));
      } else !e.length || w ? y = null : t && s ? y = EA(a, v, s, i, e) : y = a.doFullSort(v.childrenAfterAggFilter, e);
      if (y || (y = ((P = v.childrenAfterAggFilter) == null ? void 0 : P.slice(0)) ?? []), f || (f = ((E = v.childrenAfterSort) == null ? void 0 : E[0]) !== y[0]), v.childrenAfterSort = y, Hm(v), p) {
        const M = { nodes: v.childrenAfterSort };
        p(M);
      }
    };
    if (i == null || i.forEachChangedNodeDepthFirst(C), f && r.get("groupHideOpenParents")) {
      const v = c == null ? void 0 : c.getShowRowGroupCols();
      v != null && v.length && l.refreshCells({ columns: v, force: !0 });
    }
  }
  shouldSortContainsGroupCols(e) {
    const t = e.length;
    if (!t)
      return !1;
    if (Gt(this.gos)) {
      for (let s = 0; s < t; ++s) {
        const i = e[s].column;
        if (i.isPrimary() && i.isRowGroupActive())
          return !0;
      }
      return !1;
    }
    for (let s = 0; s < t; ++s)
      if (e[s].column.getColDef().showRowGroup)
        return !0;
    return !1;
  }
}, EA = (e, t, s, i, r) => {
  const n = t.childrenAfterAggFilter, o = t.childrenAfterSort;
  if (!o)
    return e.doFullSort(n, r);
  const a = /* @__PURE__ */ new Set(), l = [], { updates: c, adds: d } = s;
  for (let u = 0, g = n.length; u < g; ++u) {
    const p = n[u];
    c.has(p) || d.has(p) || i && !i.canSkip(p) ? l.push({
      currentPos: l.length,
      rowNode: p
    }) : a.add(p);
  }
  const h = o.filter((u) => a.has(u)).map((u, g) => ({ currentPos: g, rowNode: u }));
  return l.sort((u, g) => e.compareRowNodes(r, u, g)), TA(e, r, l, h);
}, TA = (e, t, s, i) => {
  let r = 0, n = 0;
  const o = s.length, a = i.length, l = new Array(o + a);
  let c = 0;
  for (; r < o && n < a; ) {
    const d = s[r], h = i[n];
    e.compareRowNodes(t, d, h) < 0 ? (l[c++] = d.rowNode, ++r) : (l[c++] = h.rowNode, ++n);
  }
  for (; r < o; )
    l[c++] = s[r++].rowNode;
  for (; n < a; )
    l[c++] = i[n++].rowNode;
  return l;
}, MA = (e) => {
  const t = e.childrenAfterSort, s = e.childrenAfterAggFilter, i = t == null ? void 0 : t.length, r = s == null ? void 0 : s.length;
  if (!i || !r)
    return null;
  const n = new Array(r), o = /* @__PURE__ */ new Set();
  for (let l = 0; l < r; ++l)
    o.add(s[l]);
  let a = 0;
  for (let l = 0; l < i; ++l) {
    const c = t[l];
    o.delete(c) && (n[a++] = c);
  }
  if (o.size === 0 && a === i)
    return t;
  for (const l of o)
    n[a++] = l;
  return n.length = a, n;
}, DA = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rowModel", this.rootNode = null, this.rowsToDisplay = [], this.rowDataUpdatedPending = !1, this.started = !1, this.isRefreshingModel = !1, this.rowNodesCountReady = !1, this.rowCountReady = !1, this.onRowHeightChanged_debounced = pe(this, this.onRowHeightChanged.bind(this), 100);
  }
  wireBeans(e) {
    this.colModel = e.colModel, this.valueCache = e.valueCache, this.filterStage = e.filterStage, this.sortStage = e.sortStage, this.flattenStage = e.flattenStage, this.groupStage = e.groupStage, this.aggStage = e.aggStage, this.pivotStage = e.pivotStage, this.filterAggStage = e.filterAggStage;
  }
  postConstruct() {
    this.orderedStages = [
      this.groupStage,
      this.filterStage,
      this.pivotStage,
      this.aggStage,
      this.sortStage,
      this.filterAggStage,
      this.flattenStage
    ].filter((i) => !!i);
    const e = this.refreshModel.bind(this, { step: "group" }), t = this.refreshModel.bind(this, {
      step: "group",
      // after cols change, row grouping (the first stage) could of changed
      afterColumnsChanged: !0,
      keepRenderedRows: !0,
      // we want animations cos sorting or filtering could be applied
      animate: !this.gos.get("suppressAnimationFrame")
    });
    this.addManagedEventListeners({
      newColumnsLoaded: t,
      columnRowGroupChanged: e,
      columnValueChanged: this.onValueChanged.bind(this),
      columnPivotChanged: this.refreshModel.bind(this, { step: "pivot" }),
      filterChanged: this.onFilterChanged.bind(this),
      sortChanged: this.onSortChanged.bind(this),
      columnPivotModeChanged: e,
      gridStylesChanged: this.onGridStylesChanges.bind(this),
      gridReady: this.onGridReady.bind(this),
      rowExpansionStateChanged: this.onRowGroupOpened.bind(this)
    }), this.addPropertyListeners(), this.rootNode = new ft(this.beans);
    const s = this.getNewNodeManager();
    this.nodeManager = s, s.activate(this.rootNode);
  }
  getNewNodeManager() {
    const { gos: e, beans: t } = this;
    return jc(e) === "treeNested" && t.csrmChildrenTreeNodeSvc || t.csrmNodeSvc;
  }
  addPropertyListeners() {
    const e = [
      "treeData",
      "treeDataChildrenField",
      ...this.orderedStages.flatMap(({ refreshProps: t }) => [...t])
    ];
    this.addManagedPropertyListeners(e, (t) => {
      var i;
      const s = (i = t.changeSet) == null ? void 0 : i.properties;
      s && this.onPropChange(s);
    }), this.addManagedPropertyListener("rowData", () => this.onPropChange(["rowData"])), this.addManagedPropertyListener("rowHeight", () => this.resetRowHeights());
  }
  start() {
    this.started = !0, this.rowNodesCountReady ? this.refreshModel({ step: "group", rowDataUpdated: !0, newData: !0 }) : this.setInitialData();
  }
  setInitialData() {
    this.gos.get("rowData") && this.onPropChange(["rowData"]);
  }
  ensureRowHeightsValid(e, t, s, i) {
    let r, n = !1;
    do {
      r = !1;
      const o = this.getRowIndexAtPixel(e), a = this.getRowIndexAtPixel(t), l = Math.max(o, s), c = Math.min(a, i);
      for (let d = l; d <= c; d++) {
        const h = this.getRow(d);
        if (h.rowHeightEstimated) {
          const u = He(this.beans, h);
          h.setRowHeight(u.height), r = !0, n = !0;
        }
      }
      r && this.setRowTopAndRowIndex();
    } while (r);
    return n;
  }
  onPropChange(e) {
    if (!this.rootNode)
      return;
    const t = this.gos, s = new Set(e), i = {
      step: "nothing",
      changedProps: s
    }, r = s.has("rowData"), n = this.nodeManager, o = this.getNewNodeManager(), a = n !== o || r && s.has("treeData") && t.get("treeData") || s.has("treeDataChildrenField") && t.get("treeData");
    let l;
    if ((a || r) && (l = t.get("rowData"), l != null && !Array.isArray(l) && (l = null, F(1))), a && (r || (l = (n == null ? void 0 : n.extractRowData()) ?? l), n !== o && (n == null || n.deactivate(), this.nodeManager = o), o.activate(this.rootNode)), l)
      if (!a && !this.isEmpty() && l.length > 0 && t.exists("getRowId") && // this property is a backwards compatibility property, for those who want
      // the old behaviour of Row IDs but NOT Immutable Data.
      !t.get("resetRowDataOnUpdate"))
        i.keepRenderedRows = !0, i.animate = !this.gos.get("suppressAnimationFrame"), i.changedRowNodes = new Cl(), o.setImmutableRowData(i, l);
      else {
        i.rowDataUpdated = !0, i.newData = !0;
        const { selectionSvc: d, pinnedRowModel: h } = this.beans;
        d == null || d.reset("rowDataChanged"), h != null && h.isManual() && h.reset(), this.rowNodesCountReady = !0, o.setNewRowData(l);
      }
    if (i.rowDataUpdated)
      i.step = "group";
    else if (i.step === "nothing") {
      for (const { refreshProps: c, step: d } of this.orderedStages)
        if (e.some((h) => c.has(h))) {
          i.step = d;
          break;
        }
    }
    i.step !== "nothing" && this.refreshModel(i);
  }
  setRowTopAndRowIndex() {
    const { beans: e, rowsToDisplay: t } = this, s = e.environment.getDefaultRowHeight();
    let i = 0;
    const r = /* @__PURE__ */ new Set(), n = Ie(this.gos, "normal");
    for (let o = 0, a = t.length; o < a; ++o) {
      const l = t[o];
      if (l.id != null && r.add(l.id), l.rowHeight == null) {
        const c = He(e, l, n, s);
        l.setRowHeight(c.height, c.estimated);
      }
      l.setRowTop(i), l.setRowIndex(o), i += l.rowHeight;
    }
    return r;
  }
  clearRowTopAndRowIndex(e, t) {
    const s = e.active, i = (n) => {
      n && n.id != null && !t.has(n.id) && n.clearRowTopAndRowIndex();
    }, r = (n) => {
      if (n !== null && (i(n), i(n.detailNode), i(n.sibling), n.hasChildren() && n.childrenAfterGroup)) {
        const o = n.level == -1;
        s && !o && !n.expanded || n.childrenAfterGroup.forEach(r);
      }
    };
    r(this.rootNode);
  }
  isLastRowIndexKnown() {
    return !0;
  }
  getRowCount() {
    return this.rowsToDisplay ? this.rowsToDisplay.length : 0;
  }
  /**
   * Returns the number of rows with level === 1
   */
  getTopLevelRowCount() {
    const e = this.rootNode;
    if (!e || this.rowsToDisplay.length === 0)
      return 0;
    if (this.rowsToDisplay && this.rowsToDisplay[0] === e)
      return 1;
    const s = e.childrenAfterSort, i = e.sibling && e.sibling.displayed ? 1 : 0;
    return (s ? s.length : 0) + i;
  }
  /**
   * Get the row display index by the top level index
   * top level index is the index of rows with level === 1
   */
  getTopLevelRowDisplayedIndex(e) {
    const { rootNode: t, rowsToDisplay: s } = this;
    if (!t || !s.length || s[0] === t)
      return e;
    const { childrenAfterSort: r } = t, n = (a) => {
      let l = r[a];
      if (this.gos.get("groupHideOpenParents"))
        for (; l.expanded && l.childrenAfterSort && l.childrenAfterSort.length > 0; )
          l = l.childrenAfterSort[0];
      return l.rowIndex;
    }, { footerSvc: o } = this.beans;
    return o ? o.getTopDisplayIndex(s, e, r, n) : n(e);
  }
  /**
   * The opposite of `getTopLevelRowDisplayedIndex`
   */
  getTopLevelIndexFromDisplayedIndex(e) {
    var o;
    const { rootNode: t, rowsToDisplay: s } = this;
    if (!t || !s.length || s[0] === t)
      return e;
    let r = this.getRow(e);
    for (r.footer && (r = r.sibling); r.parent && r.parent !== t; )
      r = r.parent;
    const n = (o = t.childrenAfterSort) == null ? void 0 : o.findIndex((a) => a === r);
    return n === -1 ? e : n ?? e;
  }
  getRowBounds(e) {
    const t = this.rowsToDisplay[e];
    return t ? {
      rowTop: t.rowTop,
      rowHeight: t.rowHeight
    } : null;
  }
  onRowGroupOpened() {
    const e = sr(this.gos);
    this.refreshModel({ step: "map", keepRenderedRows: !0, animate: e });
  }
  onFilterChanged(e) {
    if (e.afterDataChange)
      return;
    const t = sr(this.gos), i = e.columns.length === 0 || e.columns.some((r) => r.isPrimary()) ? "filter" : "filter_aggregates";
    this.refreshModel({ step: i, keepRenderedRows: !0, animate: t });
  }
  onSortChanged() {
    const e = sr(this.gos);
    this.refreshModel({
      step: "sort",
      keepRenderedRows: !0,
      animate: e
    });
  }
  getType() {
    return "clientSide";
  }
  onValueChanged() {
    this.refreshModel({ step: this.colModel.isPivotActive() ? "pivot" : "aggregate" });
  }
  createChangePath(e) {
    const t = new Di(!1, this.rootNode);
    return e || (t.active = !1), t;
  }
  isSuppressModelUpdateAfterUpdateTransaction(e) {
    if (!this.gos.get("suppressModelUpdateAfterUpdateTransaction"))
      return !1;
    const { changedRowNodes: t, newData: s, rowDataUpdated: i } = e;
    return !(!t || s || !i || t.removals.size || t.adds.size);
  }
  refreshModel(e) {
    var n, o, a;
    if (!this.rootNode)
      return;
    const t = this.beans;
    let s = !!e.rowDataUpdated;
    const i = e.changedPath ?? (e.changedPath = this.createChangePath(!e.newData && s));
    if (this.started && s && this.eventSvc.dispatchEvent({ type: "rowDataUpdated" }), !this.started || this.isRefreshingModel || this.colModel.changeEventsDispatching || this.isSuppressModelUpdateAfterUpdateTransaction(e)) {
      this.rowDataUpdatedPending || (this.rowDataUpdatedPending = s);
      return;
    }
    switch (this.rowDataUpdatedPending && (this.rowDataUpdatedPending = !1, e.rowDataUpdated = s = !0, e.step = "group"), this.isRefreshingModel = !0, (n = t.masterDetailSvc) == null || n.refreshModel(e), s && e.step !== "group" && ((o = t.colFilter) == null || o.refreshModel()), e.step) {
      case "group":
        (this.doRowGrouping(e) || s) && ((a = t.colFilter) == null || a.refreshModel()), !this.rowCountReady && this.rowNodesCountReady && (this.rowCountReady = !0, this.eventSvc.dispatchEventOnce({ type: "rowCountReady" }));
      case "filter":
        this.doFilter(i);
      case "pivot":
        this.doPivot(i);
      case "aggregate":
        this.doAggregate(i);
      case "filter_aggregates":
        this.doFilterAggregates(i);
      case "sort":
        this.doSort(e.changedRowNodes, i);
      case "map":
        this.doRowsToDisplay();
    }
    const r = this.setRowTopAndRowIndex();
    this.clearRowTopAndRowIndex(i, r), this.isRefreshingModel = !1, this.eventSvc.dispatchEvent({
      type: "modelUpdated",
      animate: e.animate,
      keepRenderedRows: e.keepRenderedRows,
      newData: e.newData,
      newPage: !1,
      keepUndoRedoStack: e.keepUndoRedoStack
    });
  }
  isEmpty() {
    var e, t, s;
    return !((t = (e = this.rootNode) == null ? void 0 : e.allLeafChildren) != null && t.length) || !((s = this.colModel) != null && s.ready);
  }
  isRowsToRender() {
    return this.rowsToDisplay.length > 0;
  }
  getNodesInRangeForSelection(e, t) {
    let s = !1, i = !1;
    const r = [], n = Ei(this.gos);
    return this.forEachNodeAfterFilterAndSort((o) => {
      if (i)
        return;
      if (s && (o === t || o === e) && (i = !0, o.group && n)) {
        r.push(...o.allLeafChildren);
        return;
      }
      if (!s) {
        if (o !== t && o !== e)
          return;
        s = !0, t === e && (i = !0);
      }
      if (!o.group || !n) {
        r.push(o);
        return;
      }
    }), r;
  }
  getTopLevelNodes() {
    var e;
    return ((e = this.rootNode) == null ? void 0 : e.childrenAfterGroup) ?? null;
  }
  getRow(e) {
    return this.rowsToDisplay[e];
  }
  isRowPresent(e) {
    return this.rowsToDisplay.indexOf(e) >= 0;
  }
  getRowIndexAtPixel(e) {
    const t = this.rowsToDisplay;
    if (this.isEmpty() || t.length === 0)
      return -1;
    let s = 0, i = t.length - 1;
    if (e <= 0)
      return 0;
    if (_(t).rowTop <= e)
      return t.length - 1;
    let n = -1, o = -1;
    for (; ; ) {
      const a = Math.floor((s + i) / 2), l = t[a];
      if (this.isRowInPixel(l, e) || (l.rowTop < e ? s = a + 1 : l.rowTop > e && (i = a - 1), n === s && o === i))
        return a;
      n = s, o = i;
    }
  }
  isRowInPixel(e, t) {
    const s = e.rowTop, i = e.rowTop + e.rowHeight;
    return s <= t && i > t;
  }
  forEachLeafNode(e) {
    var t, s;
    (s = (t = this.rootNode) == null ? void 0 : t.allLeafChildren) == null || s.forEach((i, r) => e(i, r));
  }
  forEachNode(e, t = !1) {
    this.depthFirstSearchRowNodes(e, t);
  }
  forEachDisplayedNode(e) {
    this.rowsToDisplay.forEach(e);
  }
  forEachNodeAfterFilter(e, t = !1) {
    this.depthFirstSearchRowNodes(e, t, (s) => s.childrenAfterAggFilter);
  }
  forEachNodeAfterFilterAndSort(e, t = !1) {
    this.depthFirstSearchRowNodes(e, t, (s) => s.childrenAfterSort);
  }
  forEachPivotNode(e, t = !1, s = !1) {
    const { colModel: i, rowGroupColsSvc: r } = this.beans;
    if (!i.isPivotMode())
      return;
    if (!(r != null && r.columns.length)) {
      e(this.rootNode, 0);
      return;
    }
    const n = s ? "childrenAfterSort" : "childrenAfterGroup";
    this.depthFirstSearchRowNodes(
      e,
      t,
      (o) => o.leafGroup ? null : o[n]
    );
  }
  /**
   * Iterate through each node and all of its children
   * @param callback the function to execute for each node
   * @param includeFooterNodes whether to also iterate over footer nodes
   * @param nodes the nodes to start iterating over
   * @param getChildren a function to determine the recursion strategy
   * @param startIndex the index to start from
   * @returns the index ended at
   */
  depthFirstSearchRowNodes(e, t = !1, s = (n) => n.childrenAfterGroup, i = this.rootNode, r = 0) {
    let n = r;
    if (!i)
      return n;
    const o = i === this.rootNode;
    o || e(i, n++);
    const { footerSvc: a } = this.beans;
    if (i.hasChildren() && !i.footer) {
      const l = s(i);
      if (l) {
        n = (a == null ? void 0 : a.addTotalRows(n, i, e, t, o, "top")) ?? n;
        for (const c of l)
          n = this.depthFirstSearchRowNodes(e, t, s, c, n);
        return (a == null ? void 0 : a.addTotalRows(n, i, e, t, o, "bottom")) ?? n;
      }
    }
    return n;
  }
  // it's possible to recompute the aggregate without doing the other parts
  // + api.refreshClientSideRowModel('aggregate')
  doAggregate(e) {
    var s;
    const t = this.rootNode;
    t && ((s = this.aggStage) == null || s.execute({ rowNode: t, changedPath: e }));
  }
  doFilterAggregates(e) {
    const t = this.rootNode;
    this.filterAggStage ? this.filterAggStage.execute({ rowNode: t, changedPath: e }) : t.childrenAfterAggFilter = t.childrenAfterFilter;
  }
  doSort(e, t) {
    this.sortStage ? this.sortStage.execute({
      rowNode: this.rootNode,
      changedRowNodes: e,
      changedPath: t
    }) : t.forEachChangedNodeDepthFirst((s) => {
      s.childrenAfterSort = s.childrenAfterAggFilter.slice(0), Hm(s);
    });
  }
  doRowGrouping(e) {
    var r;
    const t = this.rootNode, s = (r = this.groupStage) == null ? void 0 : r.execute({
      rowNode: t,
      changedRowNodes: e.changedRowNodes,
      changedPath: e.changedPath,
      rowNodesOrderChanged: !!e.rowNodesOrderChanged,
      afterColumnsChanged: !!e.afterColumnsChanged
    });
    if (s !== void 0)
      return s;
    const i = t.sibling;
    return t.childrenAfterGroup = t.allLeafChildren, i && (i.childrenAfterGroup = t.childrenAfterGroup), t.updateHasChildren(), !1;
  }
  doFilter(e) {
    this.filterStage ? this.filterStage.execute({ rowNode: this.rootNode, changedPath: e }) : e.forEachChangedNodeDepthFirst((t) => {
      t.childrenAfterFilter = t.childrenAfterGroup, um(t);
    }, !0);
  }
  doPivot(e) {
    var t;
    (t = this.pivotStage) == null || t.execute({ rowNode: this.rootNode, changedPath: e });
  }
  getRowNode(e) {
    var i;
    const t = this.nodeManager.getRowNode(e);
    return typeof t == "object" ? t : typeof e == "string" && e.indexOf(ko) === 0 ? (i = this.groupStage) == null ? void 0 : i.getNode(e) : void 0;
  }
  batchUpdateRowData(e, t) {
    if (this.applyAsyncTransactionsTimeout == null) {
      this.rowDataTransactionBatch = [];
      const s = this.gos.get("asyncTransactionWaitMillis");
      this.applyAsyncTransactionsTimeout = window.setTimeout(() => {
        this.isAlive() && this.executeBatchUpdateRowData();
      }, s);
    }
    this.rowDataTransactionBatch.push({ rowDataTransaction: e, callback: t });
  }
  flushAsyncTransactions() {
    this.applyAsyncTransactionsTimeout != null && (clearTimeout(this.applyAsyncTransactionsTimeout), this.executeBatchUpdateRowData());
  }
  executeBatchUpdateRowData() {
    var r, n;
    (r = this.valueCache) == null || r.onDataChanged();
    const e = [], t = [], s = new Cl();
    let i = !1;
    (n = this.rowDataTransactionBatch) == null || n.forEach((o) => {
      this.rowNodesCountReady = !0;
      const { rowNodeTransaction: a, rowsInserted: l } = this.nodeManager.updateRowData(
        o.rowDataTransaction,
        s
      );
      l && (i = !0), t.push(a), o.callback && e.push(o.callback.bind(null, a));
    }), this.commitTransactions(i, s), e.length > 0 && window.setTimeout(() => {
      e.forEach((o) => o());
    }, 0), t.length > 0 && this.eventSvc.dispatchEvent({
      type: "asyncTransactionsFlushed",
      results: t
    }), this.rowDataTransactionBatch = null, this.applyAsyncTransactionsTimeout = void 0;
  }
  /**
   * Used to apply transaction changes.
   * Called by gridApi & rowDragFeature
   */
  updateRowData(e) {
    var r;
    (r = this.valueCache) == null || r.onDataChanged(), this.rowNodesCountReady = !0;
    const t = new Cl(), { rowNodeTransaction: s, rowsInserted: i } = this.nodeManager.updateRowData(e, t);
    return this.commitTransactions(i, t), s;
  }
  /**
   * Common to:
   * - executeBatchUpdateRowData (batch transactions)
   * - updateRowData (single transaction)
   * - setImmutableRowData (generated transaction)
   *
   * @param rowNodeTrans - the transactions to apply
   * @param orderChanged - whether the order of the rows has changed, either via generated transaction or user provided addIndex
   */
  commitTransactions(e, t) {
    this.refreshModel({
      step: "group",
      rowDataUpdated: !0,
      rowNodesOrderChanged: e,
      keepRenderedRows: !0,
      animate: !this.gos.get("suppressAnimationFrame"),
      changedRowNodes: t,
      changedPath: this.createChangePath(!0)
    });
  }
  doRowsToDisplay() {
    const { flattenStage: e, rootNode: t } = this;
    let s;
    if (e)
      s = e.execute({ rowNode: t });
    else {
      s = (t == null ? void 0 : t.childrenAfterSort) ?? [];
      for (const i of s)
        i.setUiLevel(0);
    }
    this.rowsToDisplay = s;
  }
  onRowHeightChanged() {
    this.refreshModel({
      step: "map",
      keepRenderedRows: !0,
      keepUndoRedoStack: !0
    });
  }
  resetRowHeights() {
    const e = this.rootNode;
    if (!e)
      return;
    const t = this.resetRowHeightsForAllRowNodes();
    e.setRowHeight(e.rowHeight, !0), e.sibling && e.sibling.setRowHeight(e.sibling.rowHeight, !0), t && this.onRowHeightChanged();
  }
  resetRowHeightsForAllRowNodes() {
    let e = !1;
    return this.forEachNode((t) => {
      t.setRowHeight(t.rowHeight, !0);
      const s = t.detailNode;
      s && s.setRowHeight(s.rowHeight, !0), t.sibling && t.sibling.setRowHeight(t.sibling.rowHeight, !0), e = !0;
    }), e;
  }
  onGridStylesChanges(e) {
    var t;
    if (e.rowHeightChanged) {
      if ((t = this.beans.rowAutoHeight) != null && t.active)
        return;
      this.resetRowHeights();
    }
  }
  onGridReady() {
    this.started || this.setInitialData();
  }
  isRowDataLoaded() {
    return this.rowCountReady;
  }
  destroy() {
    super.destroy(), this.started = !1, this.rootNode = null, this.nodeManager = null, this.rowDataTransactionBatch = null, this.orderedStages = ps, this.rowsToDisplay = ps;
  }
  /**
   * @deprecated v33.1
   */
  onRowHeightChangedDebounced() {
    this.onRowHeightChanged_debounced();
  }
};
function AA(e) {
  var t;
  (t = e.expansionSvc) == null || t.onGroupExpandedOrCollapsed();
}
function IA(e, t) {
  const s = cs(e);
  s && ((!t || t === "everything") && (t = "group"), s.refreshModel({
    step: t,
    keepRenderedRows: !0,
    animate: !e.gos.get("suppressAnimationFrame")
  }));
}
function LA(e) {
  var t;
  return ((t = cs(e)) == null ? void 0 : t.isEmpty()) ?? !0;
}
function kA(e, t) {
  var s;
  (s = cs(e)) == null || s.forEachLeafNode(t);
}
function GA(e, t) {
  var s;
  (s = cs(e)) == null || s.forEachNodeAfterFilter(t);
}
function OA(e, t) {
  var s;
  (s = cs(e)) == null || s.forEachNodeAfterFilterAndSort(t);
}
function VA(e, t) {
  return e.frameworkOverrides.wrapIncoming(
    () => {
      var s;
      return (s = cs(e)) == null ? void 0 : s.updateRowData(t);
    }
  );
}
function BA(e, t, s) {
  e.frameworkOverrides.wrapIncoming(
    () => {
      var i;
      return (i = cs(e)) == null ? void 0 : i.batchUpdateRowData(t, s);
    }
  );
}
function NA(e) {
  e.frameworkOverrides.wrapIncoming(() => {
    var t;
    return (t = cs(e)) == null ? void 0 : t.flushAsyncTransactions();
  });
}
function HA(e) {
  var t;
  return (t = e.selectionSvc) == null ? void 0 : t.getBestCostNodeSelection();
}
var zA = {
  moduleName: "ClientSideRowModel",
  version: B,
  rowModels: ["clientSide"],
  beans: [RA, DA, PA],
  dependsOn: [Dd]
}, WA = {
  moduleName: "ClientSideRowModelApi",
  version: B,
  apiFunctions: {
    onGroupExpandedOrCollapsed: AA,
    refreshClientSideRowModel: IA,
    isRowDataEmpty: LA,
    forEachLeafNode: kA,
    forEachNodeAfterFilter: GA,
    forEachNodeAfterFilterAndSort: OA,
    applyTransaction: VA,
    applyTransactionAsync: BA,
    flushAsyncTransactions: NA,
    getBestCostNodeSelection: HA,
    resetRowHeights: zd,
    onRowHeightChanged: Hd
  },
  dependsOn: [Vm, Bm]
}, _A = class extends R {
  constructor() {
    super(...arguments), this.beanName = "gridSerializer";
  }
  wireBeans(e) {
    this.visibleCols = e.visibleCols, this.colModel = e.colModel, this.rowModel = e.rowModel, this.pinnedRowModel = e.pinnedRowModel;
  }
  serialize(e, t = {}) {
    const { allColumns: s, columnKeys: i, skipRowGroups: r, exportRowNumbers: n } = t, o = this.getColumnsToExport({
      allColumns: s,
      skipRowGroups: r,
      columnKeys: i,
      exportRowNumbers: n
    });
    return [
      // first pass, put in the header names of the cols
      this.prepareSession(o),
      this.prependContent(t),
      this.exportColumnGroups(t, o),
      this.exportHeaders(t, o),
      this.processPinnedTopRows(t, o),
      this.processRows(t, o),
      this.processPinnedBottomRows(t, o),
      this.appendContent(t)
    ].reduce((a, l) => l(a), e).parse();
  }
  processRow(e, t, s, i) {
    var p;
    const r = t.shouldRowBeSkipped || (() => !1), o = t.rowPositions != null || !!t.onlySelected, a = this.gos.get("groupHideOpenParents") && !o, l = this.colModel.isPivotMode() ? i.leafGroup : !i.group, c = !!i.footer, d = i.allChildrenCount === 1 && ((p = i.childrenAfterGroup) == null ? void 0 : p.length) === 1 && $w(this.gos, i);
    if (!l && !c && (t.skipRowGroups || d || a) || t.onlySelected && !i.isSelected() || t.skipPinnedTop && i.rowPinned === "top" || t.skipPinnedBottom && i.rowPinned === "bottom" || i.stub || i.level === -1 && !l && !c || r(V(this.gos, { node: i })))
      return;
    const g = e.onNewBodyRow(i);
    if (s.forEach((f, m) => {
      g.onColumn(f, m, i);
    }), t.getCustomContentBelowRow) {
      const f = t.getCustomContentBelowRow(V(this.gos, { node: i }));
      f && e.addCustomContent(f);
    }
  }
  appendContent(e) {
    return (t) => {
      const s = e.appendContent;
      return s && t.addCustomContent(s), t;
    };
  }
  prependContent(e) {
    return (t) => {
      const s = e.prependContent;
      return s && t.addCustomContent(s), t;
    };
  }
  prepareSession(e) {
    return (t) => (t.prepare(e), t);
  }
  exportColumnGroups(e, t) {
    return (s) => {
      if (!e.skipColumnGroupHeaders) {
        const i = new xp(), { colGroupSvc: r } = this.beans, n = r ? r.createColumnGroups({
          columns: t,
          idCreator: i,
          pinned: null,
          isStandaloneStructure: !0
        }) : t;
        this.recursivelyAddHeaderGroups(
          n,
          s,
          e.processGroupHeaderCallback
        );
      }
      return s;
    };
  }
  exportHeaders(e, t) {
    return (s) => {
      if (!e.skipColumnHeaders) {
        const i = s.onNewHeaderRow();
        t.forEach((r, n) => {
          i.onColumn(r, n, void 0);
        });
      }
      return s;
    };
  }
  processPinnedTopRows(e, t) {
    return (s) => {
      var r, n;
      const i = this.processRow.bind(this, s, e, t);
      return e.rowPositions ? e.rowPositions.filter((o) => o.rowPinned === "top").sort((o, a) => o.rowIndex - a.rowIndex).map((o) => {
        var a;
        return (a = this.pinnedRowModel) == null ? void 0 : a.getPinnedTopRow(o.rowIndex);
      }).forEach(i) : (r = this.pinnedRowModel) != null && r.isManual() || (n = this.pinnedRowModel) == null || n.forEachPinnedRow("top", i), s;
    };
  }
  processRows(e, t) {
    return (s) => {
      var c;
      const i = this.rowModel, r = te(this.gos), n = Le(this.gos), o = !r && e.onlySelected, a = this.processRow.bind(this, s, e, t), { exportedRows: l = "filteredAndSorted" } = e;
      if (e.rowPositions)
        return e.rowPositions.filter((d) => d.rowPinned == null).sort((d, h) => d.rowIndex - h.rowIndex).map((d) => i.getRow(d.rowIndex)).forEach(a), s;
      if (this.colModel.isPivotMode())
        return r ? i.forEachPivotNode(a, !0, l === "filteredAndSorted") : n ? i.forEachNodeAfterFilterAndSort(a, !0) : i.forEachNode(a), s;
      if (e.onlySelectedAllPages || o) {
        const d = ((c = this.beans.selectionSvc) == null ? void 0 : c.getSelectedNodes()) ?? [];
        this.replicateSortedOrder(d), d.forEach(a);
      } else
        l === "all" ? i.forEachNode(a) : r || n ? i.forEachNodeAfterFilterAndSort(a, !0) : i.forEachNode(a);
      return s;
    };
  }
  replicateSortedOrder(e) {
    const { sortSvc: t, rowNodeSorter: s } = this.beans;
    if (!t || !s)
      return;
    const i = t.getSortOptions(), r = (n, o) => {
      var a, l;
      return n.rowIndex != null && o.rowIndex != null ? n.rowIndex - o.rowIndex : n.level === o.level ? ((a = n.parent) == null ? void 0 : a.id) === ((l = o.parent) == null ? void 0 : l.id) ? s.compareRowNodes(
        i,
        {
          rowNode: n,
          currentPos: n.rowIndex ?? -1
        },
        {
          rowNode: o,
          currentPos: o.rowIndex ?? -1
        }
      ) : r(n.parent, o.parent) : n.level > o.level ? r(n.parent, o) : r(n, o.parent);
    };
    e.sort(r);
  }
  processPinnedBottomRows(e, t) {
    return (s) => {
      var r, n;
      const i = this.processRow.bind(this, s, e, t);
      return e.rowPositions ? e.rowPositions.filter((o) => o.rowPinned === "bottom").sort((o, a) => o.rowIndex - a.rowIndex).map((o) => {
        var a;
        return (a = this.pinnedRowModel) == null ? void 0 : a.getPinnedBottomRow(o.rowIndex);
      }).forEach(i) : (r = this.pinnedRowModel) != null && r.isManual() || (n = this.pinnedRowModel) == null || n.forEachPinnedRow("bottom", i), s;
    };
  }
  getColumnsToExport(e) {
    const { allColumns: t = !1, skipRowGroups: s = !1, exportRowNumbers: i = !1, columnKeys: r } = e, { colModel: n, gos: o, visibleCols: a } = this, l = n.isPivotMode(), c = (u) => Ds(u) ? !1 : !Ke(u) || i;
    if (r && r.length)
      return n.getColsForKeys(r).filter(c);
    const d = o.get("treeData");
    let h = [];
    return t && !l ? h = n.getCols() : h = a.allCols, h = h.filter(
      (u) => c(u) && (s && !d ? !la(u) : !0)
    ), h;
  }
  recursivelyAddHeaderGroups(e, t, s) {
    const i = [];
    e.forEach((r) => {
      const n = r;
      n.getChildren && n.getChildren().forEach((o) => i.push(o));
    }), e.length > 0 && we(e[0]) && this.doAddHeaderHeader(t, e, s), i && i.length > 0 && this.recursivelyAddHeaderGroups(
      i,
      t,
      s
    );
  }
  doAddHeaderHeader(e, t, s) {
    const i = e.onNewHeaderGroupingRow();
    let r = 0;
    t.forEach((n) => {
      const o = n;
      let a;
      s ? a = s(
        V(this.gos, {
          columnGroup: o
        })
      ) : a = this.beans.colNames.getDisplayNameForColumnGroup(o, "header");
      const c = (o.isExpandable() ? o.getLeafColumns() : []).reduce(
        (d, h, u, g) => {
          let p = _(d);
          return h.getColumnGroupShow() === "open" ? (!p || p[1] != null) && (p = [u], d.push(p)) : p && p[1] == null && (p[1] = u - 1), u === g.length - 1 && p && p[1] == null && (p[1] = u), d;
        },
        []
      );
      i.onColumn(
        o,
        a || "",
        r++,
        o.getLeafColumns().length - 1,
        c
      );
    });
  }
}, zm = {
  moduleName: "SharedExport",
  version: B,
  beans: [_A]
}, vu = `\r
`, UA = class extends hm {
  constructor(e) {
    super(e), this.config = e, this.isFirstLine = !0, this.result = "";
    const { suppressQuotes: t, columnSeparator: s } = e;
    this.suppressQuotes = t, this.columnSeparator = s;
  }
  addCustomContent(e) {
    e && (typeof e == "string" ? (/^\s*\n/.test(e) || this.beginNewLine(), e = e.replace(/\r?\n/g, vu), this.result += e) : e.forEach((t) => {
      this.beginNewLine(), t.forEach((s, i) => {
        i !== 0 && (this.result += this.columnSeparator), this.result += this.putInQuotes(s.data.value || ""), s.mergeAcross && this.appendEmptyCells(s.mergeAcross);
      });
    }));
  }
  onNewHeaderGroupingRow() {
    return this.beginNewLine(), {
      onColumn: this.onNewHeaderGroupingRowColumn.bind(this)
    };
  }
  onNewHeaderGroupingRowColumn(e, t, s, i) {
    s != 0 && (this.result += this.columnSeparator), this.result += this.putInQuotes(t), this.appendEmptyCells(i);
  }
  appendEmptyCells(e) {
    for (let t = 1; t <= e; t++)
      this.result += this.columnSeparator + this.putInQuotes("");
  }
  onNewHeaderRow() {
    return this.beginNewLine(), {
      onColumn: this.onNewHeaderRowColumn.bind(this)
    };
  }
  onNewHeaderRowColumn(e, t) {
    t != 0 && (this.result += this.columnSeparator), this.result += this.putInQuotes(this.extractHeaderValue(e));
  }
  onNewBodyRow() {
    return this.beginNewLine(), {
      onColumn: this.onNewBodyRowColumn.bind(this)
    };
  }
  onNewBodyRowColumn(e, t, s) {
    t != 0 && (this.result += this.columnSeparator);
    const i = this.extractRowCellValue(e, t, t, "csv", s);
    this.result += this.putInQuotes(i.valueFormatted ?? i.value);
  }
  putInQuotes(e) {
    if (this.suppressQuotes)
      return e;
    if (e == null)
      return '""';
    let t;
    return typeof e == "string" ? t = e : typeof e.toString == "function" ? t = e.toString() : (F(53), t = ""), '"' + t.replace(/"/g, '""') + '"';
  }
  parse() {
    return this.result;
  }
  beginNewLine() {
    this.isFirstLine || (this.result += vu), this.isFirstLine = !1;
  }
}, $A = class extends dm {
  constructor() {
    super(...arguments), this.beanName = "csvCreator";
  }
  wireBeans(e) {
    this.colModel = e.colModel, this.colNames = e.colNames, this.rowGroupColsSvc = e.rowGroupColsSvc, this.valueSvc = e.valueSvc;
  }
  getMergedParams(e) {
    const t = this.gos.get("defaultCsvExportParams");
    return Object.assign({}, t, e);
  }
  export(e) {
    if (this.isExportSuppressed()) {
      F(51);
      return;
    }
    const t = this.getMergedParams(e), s = this.getData(t), i = new Blob(["\uFEFF", s], { type: "text/plain" }), r = typeof t.fileName == "function" ? t.fileName(V(this.gos, {})) : t.fileName;
    Ad(this.getFileName(r), i);
  }
  exportDataAsCsv(e) {
    this.export(e);
  }
  getDataAsCsv(e, t = !1) {
    const s = t ? Object.assign({}, e) : this.getMergedParams(e);
    return this.getData(s);
  }
  getDefaultFileExtension() {
    return "csv";
  }
  createSerializingSession(e) {
    const { colModel: t, colNames: s, rowGroupColsSvc: i, valueSvc: r, gos: n } = this, {
      processCellCallback: o,
      processHeaderCallback: a,
      processGroupHeaderCallback: l,
      processRowGroupCallback: c,
      suppressQuotes: d,
      columnSeparator: h
    } = e;
    return new UA({
      colModel: t,
      colNames: s,
      valueSvc: r,
      gos: n,
      processCellCallback: o || void 0,
      processHeaderCallback: a || void 0,
      processGroupHeaderCallback: l || void 0,
      processRowGroupCallback: c || void 0,
      suppressQuotes: d || !1,
      columnSeparator: h || ",",
      rowGroupColsSvc: i
    });
  }
  isExportSuppressed() {
    return this.gos.get("suppressCsvExport");
  }
};
function KA(e, t) {
  var s;
  return (s = e.csvCreator) == null ? void 0 : s.getDataAsCsv(t);
}
function jA(e, t) {
  var s;
  (s = e.csvCreator) == null || s.exportDataAsCsv(t);
}
var Wm = {
  moduleName: "CsvExport",
  version: B,
  beans: [$A],
  apiFunctions: {
    getDataAsCsv: KA,
    exportDataAsCsv: jA
  },
  dependsOn: [zm]
}, YA = class extends R {
  constructor(e, t, s) {
    super(), this.id = e, this.parentCache = t, this.params = s, this.state = "needsLoading", this.version = 0, this.startRow = e * s.blockSize, this.endRow = this.startRow + s.blockSize;
  }
  load() {
    this.state = "loading", this.loadFromDatasource();
  }
  setStateWaitingToLoad() {
    this.version++, this.state = "needsLoading";
  }
  pageLoadFailed(e) {
    this.isRequestMostRecentAndLive(e) && (this.state = "failed"), this.dispatchLocalEvent({ type: "loadComplete" });
  }
  pageLoaded(e, t, s) {
    this.successCommon(e, { rowData: t, rowCount: s });
  }
  isRequestMostRecentAndLive(e) {
    const t = e === this.version, s = this.isAlive();
    return t && s;
  }
  successCommon(e, t) {
    this.dispatchLocalEvent({ type: "loadComplete" }), this.isRequestMostRecentAndLive(e) && (this.state = "loaded", this.processServerResult(t));
  }
  postConstruct() {
    this.rowNodes = [];
    const {
      params: { blockSize: e, rowHeight: t },
      startRow: s,
      beans: i,
      rowNodes: r
    } = this;
    for (let n = 0; n < e; n++) {
      const o = s + n, a = new ft(i);
      a.setRowHeight(t), a.uiLevel = 0, a.setRowIndex(o), a.setRowTop(t * o), r.push(a);
    }
  }
  getBlockStateJson() {
    const { id: e, startRow: t, endRow: s, state: i } = this;
    return {
      id: "" + e,
      state: {
        blockNumber: e,
        startRow: t,
        endRow: s,
        pageStatus: i
      }
    };
  }
  setDataAndId(e, t, s) {
    A(t) ? e.setDataAndId(t, s.toString()) : e.setDataAndId(void 0, void 0);
  }
  loadFromDatasource() {
    const e = this.createLoadParams();
    if (ee(this.params.datasource.getRows)) {
      F(90);
      return;
    }
    window.setTimeout(() => {
      this.params.datasource.getRows(e);
    }, 0);
  }
  createLoadParams() {
    const {
      startRow: e,
      endRow: t,
      version: s,
      params: { sortModel: i, filterModel: r },
      gos: n
    } = this;
    return {
      startRow: e,
      endRow: t,
      successCallback: this.pageLoaded.bind(this, s),
      failCallback: this.pageLoadFailed.bind(this, s),
      sortModel: i,
      filterModel: r,
      context: V(n, {}).context
    };
  }
  forEachNode(e, t, s) {
    this.rowNodes.forEach((i, r) => {
      this.startRow + r < s && e(i, t.value++);
    });
  }
  getRow(e, t = !1) {
    t || (this.lastAccessed = this.params.lastAccessedSequence.value++);
    const s = e - this.startRow;
    return this.rowNodes[s];
  }
  processServerResult(e) {
    const { rowNodes: t, beans: s } = this;
    t.forEach((r, n) => {
      const o = e.rowData ? e.rowData[n] : void 0;
      !r.id && r.alreadyRendered && o && (t[n] = new ft(s), t[n].setRowIndex(r.rowIndex), t[n].setRowTop(r.rowTop), t[n].setRowHeight(r.rowHeight), r.clearRowTopAndRowIndex()), this.setDataAndId(t[n], o, this.startRow + n);
    });
    const i = e.rowCount != null && e.rowCount >= 0 ? e.rowCount : void 0;
    this.parentCache.pageLoaded(this, i);
  }
  destroy() {
    this.rowNodes.forEach((e) => {
      e.clearRowTopAndRowIndex();
    }), super.destroy();
  }
}, qA = 2, XA = class extends R {
  constructor(e) {
    super(), this.params = e, this.lastRowIndexKnown = !1, this.blocks = {}, this.blockCount = 0, this.rowCount = e.initialRowCount;
  }
  // the rowRenderer will not pass dontCreatePage, meaning when rendering the grid,
  // it will want new pages in the cache as it asks for rows. only when we are inserting /
  // removing rows via the api is dontCreatePage set, where we move rows between the pages.
  getRow(e, t = !1) {
    const s = Math.floor(e / this.params.blockSize);
    let i = this.blocks[s];
    if (!i) {
      if (t)
        return;
      i = this.createBlock(s);
    }
    return i.getRow(e);
  }
  createBlock(e) {
    const t = this.params, s = this.createBean(new YA(e, this, t));
    return this.blocks[s.id] = s, this.blockCount++, this.purgeBlocksIfNeeded(s), t.rowNodeBlockLoader.addBlock(s), s;
  }
  // we have this on infinite row model only, not server side row model,
  // because for server side, it would leave the children in inconsistent
  // state - eg if a node had children, but after the refresh it had data
  // for a different row, then the children would be with the wrong row node.
  refreshCache() {
    if (this.blockCount == 0) {
      this.purgeCache();
      return;
    }
    this.getBlocksInOrder().forEach((t) => t.setStateWaitingToLoad()), this.params.rowNodeBlockLoader.checkBlockToLoad();
  }
  destroy() {
    this.getBlocksInOrder().forEach((e) => this.destroyBlock(e)), super.destroy();
  }
  getRowCount() {
    return this.rowCount;
  }
  isLastRowIndexKnown() {
    return this.lastRowIndexKnown;
  }
  // block calls this, when page loaded
  pageLoaded(e, t) {
    this.isAlive() && (ei(this.gos, `InfiniteCache - onPageLoaded: page = ${e.id}, lastRow = ${t}`), this.checkRowCount(e, t), this.onCacheUpdated());
  }
  purgeBlocksIfNeeded(e) {
    const t = this.getBlocksInOrder().filter((o) => o != e), s = (o, a) => a.lastAccessed - o.lastAccessed;
    t.sort(s);
    const i = this.params.maxBlocksInCache > 0, r = i ? this.params.maxBlocksInCache - 1 : null, n = qA - 1;
    t.forEach((o, a) => {
      const l = o.state === "needsLoading" && a >= n, c = i ? a >= r : !1;
      if (l || c) {
        if (this.isBlockCurrentlyDisplayed(o) || this.isBlockFocused(o))
          return;
        this.removeBlockFromCache(o);
      }
    });
  }
  isBlockFocused(e) {
    const t = this.beans.focusSvc.getFocusCellToUseAfterRefresh();
    if (!t || t.rowPinned != null)
      return !1;
    const { startRow: s, endRow: i } = e;
    return t.rowIndex >= s && t.rowIndex < i;
  }
  isBlockCurrentlyDisplayed(e) {
    const { startRow: t, endRow: s } = e;
    return this.beans.rowRenderer.isRangeInRenderedViewport(t, s - 1);
  }
  removeBlockFromCache(e) {
    e && this.destroyBlock(e);
  }
  checkRowCount(e, t) {
    if (typeof t == "number" && t >= 0)
      this.rowCount = t, this.lastRowIndexKnown = !0;
    else if (!this.lastRowIndexKnown) {
      const { blockSize: s, overflowSize: i } = this.params, n = (e.id + 1) * s + i;
      this.rowCount < n && (this.rowCount = n);
    }
  }
  setRowCount(e, t) {
    this.rowCount = e, A(t) && (this.lastRowIndexKnown = t), this.lastRowIndexKnown || this.rowCount % this.params.blockSize === 0 && this.rowCount++, this.onCacheUpdated();
  }
  forEachNodeDeep(e) {
    const t = { value: 0 };
    this.getBlocksInOrder().forEach((s) => s.forEachNode(e, t, this.rowCount));
  }
  getBlocksInOrder() {
    const e = (s, i) => s.id - i.id;
    return Object.values(this.blocks).sort(e);
  }
  destroyBlock(e) {
    delete this.blocks[e.id], this.destroyBean(e), this.blockCount--, this.params.rowNodeBlockLoader.removeBlock(e);
  }
  // gets called 1) row count changed 2) cache purged 3) items inserted
  onCacheUpdated() {
    this.isAlive() && (this.destroyAllBlocksPastVirtualRowCount(), this.eventSvc.dispatchEvent({
      type: "storeUpdated"
    }));
  }
  destroyAllBlocksPastVirtualRowCount() {
    const e = [];
    this.getBlocksInOrder().forEach((t) => {
      t.id * this.params.blockSize >= this.rowCount && e.push(t);
    }), e.length > 0 && e.forEach((t) => this.destroyBlock(t));
  }
  purgeCache() {
    this.getBlocksInOrder().forEach((e) => this.removeBlockFromCache(e)), this.lastRowIndexKnown = !1, this.rowCount === 0 && (this.rowCount = this.params.initialRowCount), this.onCacheUpdated();
  }
  getRowNodesInRange(e, t) {
    const s = [];
    let i = -1, r = !1;
    const n = { value: 0 };
    let o = !1;
    return this.getBlocksInOrder().forEach((l) => {
      if (!o) {
        if (r && i + 1 !== l.id) {
          o = !0;
          return;
        }
        i = l.id, l.forEachNode(
          (c) => {
            const d = c === e || c === t;
            (r || d) && s.push(c), d && (r = !r);
          },
          n,
          this.rowCount
        );
      }
    }), o || r ? [] : s;
  }
}, ZA = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rowModel";
  }
  getRowBounds(e) {
    return {
      rowHeight: this.rowHeight,
      rowTop: this.rowHeight * e
    };
  }
  // we don't implement as lazy row heights is not supported in this row model
  ensureRowHeightsValid() {
    return !1;
  }
  postConstruct() {
    this.gos.get("rowModelType") === "infinite" && (this.rowHeight = pt(this.beans), this.addEventListeners(), this.addDestroyFunc(() => this.destroyCache()));
  }
  start() {
    this.setDatasource(this.gos.get("datasource"));
  }
  destroy() {
    this.destroyDatasource(), super.destroy();
  }
  destroyDatasource() {
    this.datasource && (this.destroyBean(this.datasource), this.beans.rowRenderer.datasourceChanged(), this.datasource = null);
  }
  addEventListeners() {
    this.addManagedEventListeners({
      filterChanged: this.reset.bind(this),
      sortChanged: this.reset.bind(this),
      newColumnsLoaded: this.onColumnEverything.bind(this),
      storeUpdated: this.dispatchModelUpdatedEvent.bind(this)
    }), this.addManagedPropertyListener("datasource", () => this.setDatasource(this.gos.get("datasource"))), this.addManagedPropertyListener("cacheBlockSize", () => this.resetCache()), this.addManagedPropertyListener("rowHeight", () => {
      this.rowHeight = pt(this.beans), this.cacheParams.rowHeight = this.rowHeight, this.updateRowHeights();
    });
  }
  onColumnEverything() {
    var t;
    let e;
    this.cacheParams ? e = !Si(this.cacheParams.sortModel, ((t = this.beans.sortSvc) == null ? void 0 : t.getSortModel()) ?? []) : e = !0, e && this.reset();
  }
  getType() {
    return "infinite";
  }
  setDatasource(e) {
    this.destroyDatasource(), this.datasource = e, e && this.reset();
  }
  isEmpty() {
    return !this.infiniteCache;
  }
  isRowsToRender() {
    return !!this.infiniteCache;
  }
  getNodesInRangeForSelection(e, t) {
    var s;
    return ((s = this.infiniteCache) == null ? void 0 : s.getRowNodesInRange(e, t)) ?? [];
  }
  reset() {
    var s;
    if (!this.datasource)
      return;
    es(this.gos) != null || (s = this.beans.selectionSvc) == null || s.reset("rowDataChanged"), this.resetCache();
  }
  dispatchModelUpdatedEvent() {
    this.eventSvc.dispatchEvent({
      type: "modelUpdated",
      // not sure if these should all be false - noticed if after implementing,
      // maybe they should be true?
      newPage: !1,
      newPageSize: !1,
      newData: !1,
      keepRenderedRows: !0,
      animate: !1
    });
  }
  resetCache() {
    this.destroyCache();
    const e = this.beans, { filterManager: t, sortSvc: s, rowNodeBlockLoader: i, eventSvc: r, gos: n } = e;
    this.cacheParams = {
      // the user provided datasource
      datasource: this.datasource,
      // sort and filter model
      filterModel: (t == null ? void 0 : t.getFilterModel()) ?? {},
      sortModel: (s == null ? void 0 : s.getSortModel()) ?? [],
      rowNodeBlockLoader: i,
      // properties - this way we take a snapshot of them, so if user changes any, they will be
      // used next time we create a new cache, which is generally after a filter or sort change,
      // or a new datasource is set
      initialRowCount: n.get("infiniteInitialRowCount"),
      maxBlocksInCache: n.get("maxBlocksInCache"),
      rowHeight: pt(e),
      // if user doesn't provide overflow, we use default overflow of 1, so user can scroll past
      // the current page and request first row of next page
      overflowSize: n.get("cacheOverflowSize"),
      // page size needs to be 1 or greater. having it at 1 would be silly, as you would be hitting the
      // server for one page at a time. so the default if not specified is 100.
      blockSize: n.get("cacheBlockSize"),
      // the cache could create this, however it is also used by the pages, so handy to create it
      // here as the settings are also passed to the pages
      lastAccessedSequence: { value: 0 }
    }, this.infiniteCache = this.createBean(new XA(this.cacheParams)), r.dispatchEventOnce({
      type: "rowCountReady"
    }), this.dispatchModelUpdatedEvent();
  }
  updateRowHeights() {
    this.forEachNode((e) => {
      e.setRowHeight(this.rowHeight), e.setRowTop(this.rowHeight * e.rowIndex);
    }), this.dispatchModelUpdatedEvent();
  }
  destroyCache() {
    this.infiniteCache = this.destroyBean(this.infiniteCache);
  }
  getRow(e) {
    const t = this.infiniteCache;
    if (t && !(e >= t.getRowCount()))
      return t.getRow(e);
  }
  getRowNode(e) {
    let t;
    return this.forEachNode((s) => {
      s.id === e && (t = s);
    }), t;
  }
  forEachNode(e) {
    var t;
    (t = this.infiniteCache) == null || t.forEachNodeDeep(e);
  }
  getTopLevelRowCount() {
    return this.getRowCount();
  }
  getTopLevelRowDisplayedIndex(e) {
    return e;
  }
  getRowIndexAtPixel(e) {
    if (this.rowHeight !== 0) {
      const t = Math.floor(e / this.rowHeight), s = this.getRowCount() - 1;
      return t > s ? s : t;
    }
    return 0;
  }
  getRowCount() {
    return this.infiniteCache ? this.infiniteCache.getRowCount() : 0;
  }
  isRowPresent(e) {
    return !!this.getRowNode(e.id);
  }
  refreshCache() {
    var e;
    (e = this.infiniteCache) == null || e.refreshCache();
  }
  purgeCache() {
    var e;
    (e = this.infiniteCache) == null || e.purgeCache();
  }
  // for iRowModel
  isLastRowIndexKnown() {
    var e;
    return ((e = this.infiniteCache) == null ? void 0 : e.isLastRowIndexKnown()) ?? !1;
  }
  setRowCount(e, t) {
    var s;
    (s = this.infiniteCache) == null || s.setRowCount(e, t);
  }
  resetRowHeights() {
  }
  onRowHeightChanged() {
  }
};
function QA(e) {
  var t;
  (t = Sa(e)) == null || t.refreshCache();
}
function JA(e) {
  var t;
  (t = Sa(e)) == null || t.purgeCache();
}
function eI(e) {
  var t;
  return (t = Sa(e)) == null ? void 0 : t.getRowCount();
}
var tI = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rowNodeBlockLoader", this.activeBlockLoadsCount = 0, this.blocks = [], this.active = !0;
  }
  postConstruct() {
    this.maxConcurrentRequests = ep(this.gos);
    const e = this.gos.get("blockLoadDebounceMillis");
    e && e > 0 && (this.checkBlockToLoadDebounce = pe(
      this,
      this.performCheckBlocksToLoad.bind(this),
      e
    ));
  }
  addBlock(e) {
    this.blocks.push(e), e.addEventListener("loadComplete", this.loadComplete.bind(this)), this.checkBlockToLoad();
  }
  removeBlock(e) {
    be(this.blocks, e);
  }
  destroy() {
    super.destroy(), this.active = !1;
  }
  loadComplete() {
    this.activeBlockLoadsCount--, this.checkBlockToLoad();
  }
  checkBlockToLoad() {
    this.checkBlockToLoadDebounce ? this.checkBlockToLoadDebounce() : this.performCheckBlocksToLoad();
  }
  performCheckBlocksToLoad() {
    if (!this.active)
      return;
    if (this.printCacheStatus(), this.maxConcurrentRequests != null && this.activeBlockLoadsCount >= this.maxConcurrentRequests) {
      ei(this.gos, "RowNodeBlockLoader - checkBlockToLoad: max loads exceeded");
      return;
    }
    const e = this.maxConcurrentRequests != null ? this.maxConcurrentRequests - this.activeBlockLoadsCount : 1, t = this.blocks.filter((s) => s.state === "needsLoading").slice(0, e);
    this.activeBlockLoadsCount += t.length, t.forEach((s) => s.load()), this.printCacheStatus();
  }
  getBlockState() {
    const e = {};
    return this.blocks.forEach((t) => {
      const { id: s, state: i } = t.getBlockStateJson();
      e[s] = i;
    }), e;
  }
  printCacheStatus() {
    ei(
      this.gos,
      `RowNodeBlockLoader - printCacheStatus: activePageLoadsCount = ${this.activeBlockLoadsCount}, blocks = ${JSON.stringify(this.getBlockState())}`
    );
  }
}, sI = {
  moduleName: "InfiniteRowModelCore",
  version: B,
  rowModels: ["infinite"],
  beans: [ZA, tI]
}, iI = {
  moduleName: "InfiniteRowModel",
  version: B,
  apiFunctions: {
    refreshInfiniteCache: QA,
    purgeInfiniteCache: JA,
    getInfiniteRowCount: eI
  },
  dependsOn: [sI, Nm]
}, rI = "↑", nI = "↓", oI = {
  tag: "span",
  children: [
    { tag: "span", ref: "eDelta", cls: "ag-value-change-delta" },
    { tag: "span", ref: "eValue", cls: "ag-value-change-value" }
  ]
}, aI = class extends D {
  constructor() {
    super(oI), this.eValue = x, this.eDelta = x, this.refreshCount = 0;
  }
  init(e) {
    this.refresh(e, !0);
  }
  showDelta(e, t) {
    const s = Math.abs(t), i = e.formatValue(s), r = A(i) ? i : s, n = t >= 0, o = this.eDelta;
    n ? o.textContent = rI + r : o.textContent = nI + r, o.classList.toggle("ag-value-change-delta-up", n), o.classList.toggle("ag-value-change-delta-down", !n);
  }
  setTimerToRemoveDelta() {
    this.refreshCount++;
    const e = this.refreshCount;
    this.beans.frameworkOverrides.wrapIncoming(() => {
      window.setTimeout(() => {
        e === this.refreshCount && this.hideDeltaValue();
      }, 2e3);
    });
  }
  hideDeltaValue() {
    this.eValue.classList.remove("ag-value-change-value-highlight"), X(this.eDelta);
  }
  refresh(e, t = !1) {
    var c;
    const { value: s, valueFormatted: i } = e, { eValue: r, lastValue: n, beans: o } = this;
    if (s === n || (A(i) ? r.textContent = i : A(s) ? r.textContent = s : X(r), (c = o.filterManager) != null && c.isSuppressFlashingCellsBecauseFiltering()))
      return !1;
    const a = s && typeof s == "object" && "toNumber" in s ? s.toNumber() : s, l = n && typeof n == "object" && "toNumber" in n ? n.toNumber() : n;
    if (a === l)
      return !1;
    if (typeof a == "number" && typeof l == "number") {
      const d = a - l;
      this.showDelta(e, d);
    }
    return n && r.classList.add("ag-value-change-value-highlight"), t || this.setTimerToRemoveDelta(), this.lastValue = s, !0;
  }
}, lI = (
  /*css*/
  ".ag-value-slide-out{opacity:1}:where(.ag-ltr) .ag-value-slide-out{margin-right:5px;transition:opacity 3s,margin-right 3s}:where(.ag-rtl) .ag-value-slide-out{margin-left:5px;transition:opacity 3s,margin-left 3s}:where(.ag-ltr,.ag-rtl) .ag-value-slide-out{transition-timing-function:linear}.ag-value-slide-out-end{opacity:0}:where(.ag-ltr) .ag-value-slide-out-end{margin-right:10px}:where(.ag-rtl) .ag-value-slide-out-end{margin-left:10px}"
), cI = {
  tag: "span",
  children: [{ tag: "span", ref: "eCurrent", cls: "ag-value-slide-current" }]
}, dI = class extends D {
  constructor() {
    super(cI), this.eCurrent = x, this.refreshCount = 0, this.registerCSS(lI);
  }
  init(e) {
    this.refresh(e, !0);
  }
  addSlideAnimation() {
    this.refreshCount++;
    const e = this.refreshCount;
    this.ePrevious && this.getGui().removeChild(this.ePrevious);
    const { beans: t, eCurrent: s } = this, i = K({ tag: "span", cls: "ag-value-slide-previous ag-value-slide-out" });
    this.ePrevious = i, i.textContent = s.textContent, this.getGui().insertBefore(i, s), t.frameworkOverrides.wrapIncoming(() => {
      window.setTimeout(() => {
        e === this.refreshCount && this.ePrevious.classList.add("ag-value-slide-out-end");
      }, 50), window.setTimeout(() => {
        e === this.refreshCount && (this.getGui().removeChild(this.ePrevious), this.ePrevious = null);
      }, 3e3);
    });
  }
  refresh(e, t = !1) {
    var r;
    let s = e.value;
    if (ee(s) && (s = ""), s === this.lastValue || (r = this.beans.filterManager) != null && r.isSuppressFlashingCellsBecauseFiltering())
      return !1;
    t || this.addSlideAnimation(), this.lastValue = s;
    const i = this.eCurrent;
    return A(e.valueFormatted) ? i.textContent = e.valueFormatted : A(e.value) ? i.textContent = s : X(i), !0;
  }
}, hI = class extends R {
  constructor() {
    super(...arguments), this.beanName = "cellFlashSvc", this.nextAnimationTime = null, this.nextAnimationCycle = null, this.animations = {
      highlight: /* @__PURE__ */ new Map(),
      "data-changed": /* @__PURE__ */ new Map()
    };
  }
  animateCell(e, t, s = this.beans.gos.get("cellFlashDuration"), i = this.beans.gos.get("cellFadeDuration")) {
    const r = this.animations[t];
    r.delete(e);
    const n = Date.now(), o = n + s, a = n + s + i, l = {
      phase: "flash",
      flashEndTime: o,
      fadeEndTime: a
    };
    r.set(e, l);
    const c = `ag-cell-${t}`, d = `${c}-animation`, {
      comp: h,
      eGui: { style: u }
    } = e;
    h.toggleCss(c, !0), h.toggleCss(d, !1), u.removeProperty("transition"), u.removeProperty("transition-delay"), this.nextAnimationTime && o + 15 < this.nextAnimationTime && (clearTimeout(this.nextAnimationCycle), this.nextAnimationCycle = null, this.nextAnimationTime = null), this.nextAnimationCycle || (this.beans.frameworkOverrides.wrapIncoming(() => {
      this.nextAnimationCycle = setTimeout(this.advanceAnimations.bind(this), s);
    }), this.nextAnimationTime = o);
  }
  advanceAnimations() {
    const e = Date.now();
    let t = null;
    for (const s of Object.keys(this.animations)) {
      const i = this.animations[s], r = `ag-cell-${s}`, n = `${r}-animation`;
      for (const [o, a] of i) {
        if (!o.isAlive() || !o.comp) {
          i.delete(o);
          continue;
        }
        const { phase: l, flashEndTime: c, fadeEndTime: d } = a, h = l === "flash" ? c : d;
        if (!(e + 15 >= h)) {
          t = Math.min(h, t ?? 1 / 0);
          continue;
        }
        const {
          comp: g,
          eGui: { style: p }
        } = o;
        switch (l) {
          case "flash":
            g.toggleCss(r, !1), g.toggleCss(n, !0), p.transition = `background-color ${d - c}ms`, p.transitionDelay = `${c - e}ms`, t = Math.min(d, t ?? 1 / 0), a.phase = "fade";
            break;
          case "fade":
            g.toggleCss(r, !1), g.toggleCss(n, !1), p.removeProperty("transition"), p.removeProperty("transition-delay"), i.delete(o);
            break;
        }
      }
    }
    t == null ? (this.nextAnimationTime = null, this.nextAnimationCycle = null) : t && (this.nextAnimationCycle = setTimeout(this.advanceAnimations.bind(this), t - e), this.nextAnimationTime = t);
  }
  onFlashCells(e, t) {
    if (!e.comp)
      return;
    const s = Ws(e.cellPosition);
    t.cells[s] && this.animateCell(e, "highlight");
  }
  flashCell(e, t) {
    this.animateCell(e, "data-changed", t == null ? void 0 : t.flashDuration, t == null ? void 0 : t.fadeDuration);
  }
  destroy() {
    for (const e of Object.keys(this.animations))
      this.animations[e].clear();
  }
};
function uI(e, t = {}) {
  const { cellFlashSvc: s } = e;
  s && e.frameworkOverrides.wrapIncoming(() => {
    e.rowRenderer.getCellCtrls(t.rowNodes, t.columns).forEach((i) => s.flashCell(i, t));
  });
}
var _m = {
  moduleName: "HighlightChanges",
  version: B,
  beans: [hI],
  userComponents: {
    agAnimateShowChangeCellRenderer: aI,
    agAnimateSlideCellRenderer: dI
  },
  apiFunctions: {
    flashCells: uI
  }
};
function gI(e) {
  var t;
  return ((t = e.stateSvc) == null ? void 0 : t.getState()) ?? {};
}
function pI(e, t, s) {
  var i;
  return (i = e.stateSvc) == null ? void 0 : i.setState(t, s);
}
function wu(e) {
  switch (e = { ...e }, e.version || (e.version = "32.1.0"), e.version) {
    case "32.1.0":
      e = fI(e);
  }
  return e.version = B, e;
}
function fI(e) {
  return e.cellSelection = mI(e, "rangeSelection"), e;
}
function mI(e, t) {
  if (e && typeof e == "object")
    return e[t];
}
var CI = class extends R {
  constructor() {
    super(...arguments), this.beanName = "stateSvc", this.updateRowGroupExpansionStateTimer = 0, this.suppressEvents = !0, this.queuedUpdateSources = /* @__PURE__ */ new Set(), this.dispatchStateUpdateEventDebounced = pe(this, () => this.dispatchQueuedStateUpdateEvents(), 0), this.onRowGroupOpenedDebounced = pe(
      this,
      () => {
        this.beans.gos.get("ssrmExpandAllAffectsAllRows") ? (this.updateCachedState("ssrmRowGroupExpansion", this.getRowGroupExpansionState()), this.updateCachedState("rowGroupExpansion", void 0)) : (this.updateCachedState("rowGroupExpansion", this.getRowGroupExpansionState()), this.updateCachedState("ssrmRowGroupExpansion", void 0));
      },
      0
    ), this.onRowSelectedDebounced = pe(
      this,
      () => {
        this.staleStateKeys.delete("rowSelection"), this.updateCachedState("rowSelection", this.getRowSelectionState());
      },
      0
    ), this.staleStateKeys = /* @__PURE__ */ new Set();
  }
  postConstruct() {
    const { gos: e, ctrlsSvc: t, colDelayRenderSvc: s } = this.beans;
    this.isClientSideRowModel = te(e);
    const i = wu(e.get("initialState") ?? {}), r = i.partialColumnState;
    delete i.partialColumnState, this.cachedState = i;
    const n = this.suppressEventsAndDispatchInitEvent.bind(this);
    t.whenReady(
      this,
      () => n(() => this.setupStateOnGridReady(i))
    ), (i.columnOrder || i.columnVisibility || i.columnSizing || i.columnPinning || i.columnGroup) && (s == null || s.hideColumns("columnState"));
    const [o, a, l] = this.addManagedEventListeners({
      newColumnsLoaded: ({ source: c }) => {
        c === "gridInitializing" && (o(), n(() => {
          this.setupStateOnColumnsInitialised(i, !!r), s == null || s.revealColumns("columnState");
        }));
      },
      rowCountReady: () => {
        a == null || a(), n(() => this.setupStateOnRowCountReady(i));
      },
      firstDataRendered: () => {
        l == null || l(), n(() => this.setupStateOnFirstDataRendered(i));
      }
    });
  }
  destroy() {
    super.destroy(), clearTimeout(this.updateRowGroupExpansionStateTimer), this.queuedUpdateSources.clear();
  }
  getState() {
    return this.staleStateKeys.size && this.refreshStaleState(), this.cachedState;
  }
  setState(e, t) {
    const s = wu(e);
    delete s.partialColumnState, this.cachedState = s, this.startSuppressEvents();
    const i = "api", r = t ? new Set(t) : void 0;
    this.setGridReadyState(s, i, r), this.setColumnsInitialisedState(s, i, !1, r), this.setRowCountState(s, i, r), setTimeout(() => {
      this.isAlive() && this.setFirstDataRenderedState(s, i, r), this.stopSuppressEvents(i);
    });
  }
  setGridReadyState(e, t, s) {
    var i, r;
    t === "api" && !(s != null && s.has("sideBar")) && ((r = (i = this.beans.sideBar) == null ? void 0 : i.comp) == null || r.setState(e.sideBar)), this.updateCachedState("sideBar", this.getSideBarState());
  }
  setupStateOnGridReady(e) {
    this.setGridReadyState(e, "gridInitializing");
    const t = () => this.updateCachedState("sideBar", this.getSideBarState());
    this.addManagedEventListeners({
      toolPanelVisibleChanged: t,
      sideBarUpdated: t
    });
  }
  updateColumnAndGroupState() {
    this.updateColumnState([
      "aggregation",
      "columnOrder",
      "columnPinning",
      "columnSizing",
      "columnVisibility",
      "pivot",
      "rowGroup",
      "sort"
    ]), this.updateCachedState("columnGroup", this.getColumnGroupState());
  }
  setColumnsInitialisedState(e, t, s, i) {
    this.setColumnState(e, t, s, i), this.setColumnGroupState(e, t, i), this.updateColumnAndGroupState();
  }
  setupStateOnColumnsInitialised(e, t) {
    this.setColumnsInitialisedState(e, "gridInitializing", t);
    const s = (i) => () => this.updateColumnState([i]);
    this.addManagedEventListeners({
      columnValueChanged: s("aggregation"),
      columnMoved: s("columnOrder"),
      columnPinned: s("columnPinning"),
      columnResized: s("columnSizing"),
      columnVisible: s("columnVisibility"),
      columnPivotChanged: s("pivot"),
      columnPivotModeChanged: s("pivot"),
      columnRowGroupChanged: s("rowGroup"),
      sortChanged: s("sort"),
      newColumnsLoaded: this.updateColumnAndGroupState.bind(this),
      columnGroupOpened: () => this.updateCachedState("columnGroup", this.getColumnGroupState())
    });
  }
  setRowCountState(e, t, s) {
    const {
      filter: i,
      rowGroupExpansion: r,
      ssrmRowGroupExpansion: n,
      rowSelection: o,
      pagination: a
    } = e, l = (d, h) => !(s != null && s.has(d)) && (h || t === "api");
    l("filter", i) && this.setFilterState(i), l("rowGroupExpansion", r) && this.setRowGroupExpansionState(n, r, t), l("rowSelection", o) && this.setRowSelectionState(o, t), l("pagination", a) && this.setPaginationState(a, t);
    const c = this.updateCachedState.bind(this);
    c("filter", this.getFilterState()), this.beans.gos.get("ssrmExpandAllAffectsAllRows") ? (c("ssrmRowGroupExpansion", this.getRowGroupExpansionState()), c("rowGroupExpansion", void 0)) : (c("rowGroupExpansion", this.getRowGroupExpansionState()), c("ssrmRowGroupExpansion", void 0)), c("rowSelection", this.getRowSelectionState()), c("pagination", this.getPaginationState());
  }
  setupStateOnRowCountReady(e) {
    this.setRowCountState(e, "gridInitializing");
    const t = this.updateCachedState.bind(this), s = () => {
      this.updateRowGroupExpansionStateTimer = 0, this.beans.gos.get("ssrmExpandAllAffectsAllRows") ? (t("ssrmRowGroupExpansion", this.getRowGroupExpansionState()), t("rowGroupExpansion", void 0)) : (t("rowGroupExpansion", this.getRowGroupExpansionState()), t("ssrmRowGroupExpansion", void 0));
    }, i = () => t("filter", this.getFilterState()), { gos: r, colFilter: n } = this.beans;
    this.addManagedEventListeners({
      filterChanged: i,
      rowExpansionStateChanged: this.onRowGroupOpenedDebounced,
      expandOrCollapseAll: s,
      // `groupDefaultExpanded`/`isGroupOpenByDefault` updates expansion state without an expansion event
      columnRowGroupChanged: s,
      rowDataUpdated: () => {
        (r.get("groupDefaultExpanded") !== 0 || r.get("isGroupOpenByDefault")) && (this.updateRowGroupExpansionStateTimer || (this.updateRowGroupExpansionStateTimer = setTimeout(s)));
      },
      selectionChanged: () => {
        this.staleStateKeys.add("rowSelection"), this.onRowSelectedDebounced();
      },
      paginationChanged: (o) => {
        (o.newPage || o.newPageSize) && t("pagination", this.getPaginationState());
      }
    }), n && this.addManagedListeners(n, {
      filterStateChanged: i
    });
  }
  setFirstDataRenderedState(e, t, s) {
    const {
      scroll: i,
      cellSelection: r,
      focusedCell: n,
      columnOrder: o,
      rowPinning: a
    } = e, l = (h, u) => !(s != null && s.has(h)) && (u || t === "api");
    l("focusedCell", n) && this.setFocusedCellState(n), l("cellSelection", r) && this.setCellSelectionState(r), l("scroll", i) && this.setScrollState(i), l("rowPinning", a) && this.setRowPinningState(a), this.setColumnPivotState(!!(o != null && o.orderedColIds), t);
    const c = this.updateCachedState.bind(this);
    c("sideBar", this.getSideBarState()), c("focusedCell", this.getFocusedCellState());
    const d = this.getRangeSelectionState();
    c("rangeSelection", d), c("cellSelection", d), c("scroll", this.getScrollState());
  }
  setupStateOnFirstDataRendered(e) {
    this.setFirstDataRenderedState(e, "gridInitializing");
    const t = this.updateCachedState.bind(this), s = () => t("focusedCell", this.getFocusedCellState());
    this.addManagedEventListeners({
      cellFocused: s,
      cellFocusCleared: s,
      cellSelectionChanged: (i) => {
        if (i.finished) {
          const r = this.getRangeSelectionState();
          t("rangeSelection", r), t("cellSelection", r);
        }
      },
      bodyScrollEnd: () => t("scroll", this.getScrollState()),
      pinnedRowsChanged: () => t("rowPinning", this.getRowPinningState())
    });
  }
  getColumnState() {
    const e = this.beans;
    return MM(To(e), e.colModel.isPivotMode());
  }
  setColumnState(e, t, s, i) {
    const {
      sort: r,
      rowGroup: n,
      aggregation: o,
      pivot: a,
      columnPinning: l,
      columnVisibility: c,
      columnSizing: d,
      columnOrder: h
    } = e;
    let u = !1;
    const g = (I, L) => {
      const $ = !(i != null && i.has(I)) && !!(L || t === "api");
      return u || (u = $), $;
    }, p = {}, f = (I) => {
      let L = p[I];
      return L || (L = { colId: I }, p[I] = L, L);
    }, m = {}, C = g("sort", r);
    C && (r == null || r.sortModel.forEach(({ colId: I, sort: L }, $) => {
      const z = f(I);
      z.sort = L, z.sortIndex = $;
    })), (C || !s) && (m.sort = null, m.sortIndex = null);
    const v = g("rowGroup", n);
    v && (n == null || n.groupColIds.forEach((I, L) => {
      const $ = f(I);
      $.rowGroup = !0, $.rowGroupIndex = L;
    })), (v || !s) && (m.rowGroup = null, m.rowGroupIndex = null);
    const w = g("aggregation", o);
    w && (o == null || o.aggregationModel.forEach(({ colId: I, aggFunc: L }) => {
      f(I).aggFunc = L;
    })), (w || !s) && (m.aggFunc = null);
    const b = g("pivot", a);
    b && (a == null || a.pivotColIds.forEach((I, L) => {
      const $ = f(I);
      $.pivot = !0, $.pivotIndex = L;
    }), this.gos.updateGridOptions({
      options: { pivotMode: !!(a != null && a.pivotMode) },
      source: t
    })), (b || !s) && (m.pivot = null, m.pivotIndex = null);
    const y = g("columnPinning", l);
    y && (l == null || l.leftColIds.forEach((I) => {
      f(I).pinned = "left";
    }), l == null || l.rightColIds.forEach((I) => {
      f(I).pinned = "right";
    })), (y || !s) && (m.pinned = null);
    const P = g("columnVisibility", c);
    P && (c == null || c.hiddenColIds.forEach((I) => {
      f(I).hide = !0;
    })), (P || !s) && (m.hide = null);
    const E = g("columnSizing", d);
    E && (d == null || d.columnSizingModel.forEach(({ colId: I, flex: L, width: $ }) => {
      const z = f(I);
      z.flex = L ?? null, z.width = $;
    })), (E || !s) && (m.flex = null);
    const M = h == null ? void 0 : h.orderedColIds, T = !!(M != null && M.length) && !(i != null && i.has("columnOrder")), G = T ? M.map((I) => f(I)) : Object.values(p);
    (G.length || u) && (this.columnStates = G, je(
      this.beans,
      {
        state: G,
        applyOrder: T,
        defaultState: m
      },
      t
    ));
  }
  setColumnPivotState(e, t) {
    const s = this.columnStates;
    this.columnStates = void 0;
    const i = this.columnGroupStates;
    this.columnGroupStates = void 0;
    const r = this.beans, { pivotResultCols: n, colGroupSvc: o } = r;
    if (n != null && n.isPivotResultColsPresent()) {
      if (s) {
        const a = [];
        for (const l of s)
          n.getPivotResultCol(l.colId) && a.push(l);
        je(
          r,
          {
            state: a,
            applyOrder: e
          },
          t
        );
      }
      i && (o == null || o.setColumnGroupState(i, t));
    }
  }
  getColumnGroupState() {
    const e = this.beans.colGroupSvc;
    if (!e)
      return;
    const t = e.getColumnGroupState();
    return DM(t);
  }
  setColumnGroupState(e, t, s) {
    var a;
    const i = this.beans.colGroupSvc;
    if (!i || s != null && s.has("columnGroup") || t !== "api" && !Object.prototype.hasOwnProperty.call(e, "columnGroup"))
      return;
    const r = new Set((a = e.columnGroup) == null ? void 0 : a.openColumnGroupIds), o = i.getColumnGroupState().map(({ groupId: l }) => {
      const c = r.has(l);
      return c && r.delete(l), {
        groupId: l,
        open: c
      };
    });
    r.forEach((l) => {
      o.push({
        groupId: l,
        open: !0
      });
    }), o.length && (this.columnGroupStates = o), i.setColumnGroupState(o, t);
  }
  getFilterState() {
    const e = this.beans.filterManager;
    let t = e == null ? void 0 : e.getFilterModel();
    t && Object.keys(t).length === 0 && (t = void 0);
    const s = e == null ? void 0 : e.getFilterState(), i = (e == null ? void 0 : e.getAdvFilterModel()) ?? void 0;
    return t || i || s ? { filterModel: t, columnFilterState: s, advancedFilterModel: i } : void 0;
  }
  setFilterState(e) {
    const t = this.beans.filterManager, { filterModel: s, columnFilterState: i, advancedFilterModel: r } = e ?? {
      filterModel: null,
      columnFilterState: null,
      advancedFilterModel: null
    };
    (s !== void 0 || i !== void 0) && (t == null || t.setFilterState(s ?? null, i ?? null, "columnFilter")), r !== void 0 && (t == null || t.setAdvFilterModel(r ?? null, "advancedFilter"));
  }
  getRangeSelectionState() {
    var t;
    const e = (t = this.beans.rangeSvc) == null ? void 0 : t.getCellRanges().map((s) => {
      const { id: i, type: r, startRow: n, endRow: o, columns: a, startColumn: l } = s;
      return {
        id: i,
        type: r,
        startRow: n,
        endRow: o,
        colIds: a.map((c) => c.getColId()),
        startColId: l.getColId()
      };
    });
    return e != null && e.length ? { cellRanges: e } : void 0;
  }
  setCellSelectionState(e) {
    const { gos: t, rangeSvc: s, colModel: i, visibleCols: r } = this.beans;
    if (!et(t) || !s)
      return;
    const n = [];
    e == null || e.cellRanges.forEach((o) => {
      const a = [];
      if (o.colIds.forEach((c) => {
        const d = i.getCol(c);
        d && a.push(d);
      }), !a.length)
        return;
      let l = i.getCol(o.startColId);
      if (!l) {
        const c = r.allCols, d = new Set(a);
        l = c.find((h) => d.has(h));
      }
      n.push({
        ...o,
        columns: a,
        startColumn: l
      });
    }), s.setCellRanges(n);
  }
  getScrollState() {
    if (!this.isClientSideRowModel)
      return;
    const e = this.beans.ctrlsSvc.getScrollFeature(), { left: t } = (e == null ? void 0 : e.getHScrollPosition()) ?? { left: 0 }, { top: s } = (e == null ? void 0 : e.getVScrollPosition()) ?? { top: 0 };
    return s || t ? {
      top: s,
      left: t
    } : void 0;
  }
  setScrollState(e) {
    if (!this.isClientSideRowModel)
      return;
    const { top: t, left: s } = e ?? { top: 0, left: 0 }, { frameworkOverrides: i, rowRenderer: r, animationFrameSvc: n, ctrlsSvc: o } = this.beans;
    i.wrapIncoming(() => {
      var a;
      o.get("center").setCenterViewportScrollLeft(s), (a = o.getScrollFeature()) == null || a.setVerticalScrollPosition(t), r.redraw({ afterScroll: !0 }), n == null || n.flushAllFrames();
    });
  }
  getSideBarState() {
    var e, t;
    return (t = (e = this.beans.sideBar) == null ? void 0 : e.comp) == null ? void 0 : t.getState();
  }
  getFocusedCellState() {
    if (!this.isClientSideRowModel)
      return;
    const e = this.beans.focusSvc.getFocusedCell();
    if (e) {
      const { column: t, rowIndex: s, rowPinned: i } = e;
      return {
        colId: t.getColId(),
        rowIndex: s,
        rowPinned: i
      };
    }
  }
  setFocusedCellState(e) {
    if (!this.isClientSideRowModel)
      return;
    const { focusSvc: t, colModel: s } = this.beans;
    if (!e) {
      t.clearFocusedCell();
      return;
    }
    const { colId: i, rowIndex: r, rowPinned: n } = e;
    t.setFocusedCell({
      column: s.getCol(i),
      rowIndex: r,
      rowPinned: n,
      forceBrowserFocus: !0,
      preventScrollOnBrowserFocus: !0
    });
  }
  getPaginationState() {
    const { pagination: e, gos: t } = this.beans;
    if (!e)
      return;
    const s = e.getCurrentPage(), i = t.get("paginationAutoPageSize") ? void 0 : e.getPageSize();
    if (!(!s && !i))
      return { page: s, pageSize: i };
  }
  setPaginationState(e, t) {
    const { pagination: s, gos: i } = this.beans;
    if (!s)
      return;
    const { pageSize: r, page: n } = e ?? { page: 0, pageSize: i.get("paginationPageSize") }, o = t === "gridInitializing";
    r && !i.get("paginationAutoPageSize") && s.setPageSize(r, o ? "initialState" : "pageSizeSelector"), typeof n == "number" && (o ? s.setPage(n) : s.goToPage(n));
  }
  getRowSelectionState() {
    var i;
    const e = this.beans.selectionSvc;
    if (!e)
      return;
    const t = e.getSelectionState();
    return !t || !Array.isArray(t) && (t.selectAll === !1 || t.selectAllChildren === !1) && !((i = t == null ? void 0 : t.toggledNodes) != null && i.length) ? void 0 : t;
  }
  setRowSelectionState(e, t) {
    var s;
    (s = this.beans.selectionSvc) == null || s.setSelectionState(e, t, t === "api");
  }
  getRowGroupExpansionState() {
    const { expansionSvc: e } = this.beans;
    if (e)
      return e.getExpansionState();
  }
  getRowPinningState() {
    var e;
    return (e = this.beans.pinnedRowModel) == null ? void 0 : e.getPinnedState();
  }
  setRowPinningState(e) {
    const t = this.beans.pinnedRowModel;
    e ? t == null || t.setPinnedState(e) : t == null || t.reset();
  }
  setRowGroupExpansionState(e, t, s) {
    const i = this.beans.expansionSvc;
    if (!i)
      return;
    const r = t ?? { expandedRowGroupIds: [], collapsedRowGroupIds: [] };
    i.setExpansionState(r, s);
  }
  updateColumnState(e) {
    const t = this.getColumnState();
    let s = !1;
    const i = this.cachedState;
    for (const r of Object.keys(t)) {
      const n = t[r];
      Si(n, i[r]) || (s = !0);
    }
    this.cachedState = {
      ...i,
      ...t
    }, s && this.dispatchStateUpdateEvent(e);
  }
  updateCachedState(e, t) {
    const s = this.cachedState[e];
    this.setCachedStateValue(e, t), Si(t, s) || this.dispatchStateUpdateEvent([e]);
  }
  setCachedStateValue(e, t) {
    this.cachedState = {
      ...this.cachedState,
      [e]: t
    };
  }
  refreshStaleState() {
    const e = this.staleStateKeys;
    e.forEach((t) => {
      switch (t) {
        case "rowSelection":
          this.setCachedStateValue(t, this.getRowSelectionState());
          break;
      }
    }), e.clear();
  }
  dispatchStateUpdateEvent(e) {
    this.suppressEvents || (e.forEach((t) => this.queuedUpdateSources.add(t)), this.dispatchStateUpdateEventDebounced());
  }
  dispatchQueuedStateUpdateEvents() {
    const e = this.queuedUpdateSources, t = Array.from(e);
    e.clear(), this.eventSvc.dispatchEvent({
      type: "stateUpdated",
      sources: t,
      state: this.cachedState
    });
  }
  startSuppressEvents() {
    var e;
    this.suppressEvents = !0, (e = this.beans.colAnimation) == null || e.setSuppressAnimation(!0);
  }
  stopSuppressEvents(e) {
    setTimeout(() => {
      var t;
      this.suppressEvents = !1, this.queuedUpdateSources.clear(), this.isAlive() && ((t = this.beans.colAnimation) == null || t.setSuppressAnimation(!1), this.dispatchStateUpdateEvent([e]));
    });
  }
  suppressEventsAndDispatchInitEvent(e) {
    this.startSuppressEvents(), e(), this.stopSuppressEvents("gridInitializing");
  }
}, vI = {
  moduleName: "GridState",
  version: B,
  beans: [CI],
  apiFunctions: {
    getState: gI,
    setState: pI
  }
};
function wI(e) {
  return e.rowModel.isLastRowIndexKnown();
}
function bI(e) {
  var t;
  return ((t = e.pagination) == null ? void 0 : t.getPageSize()) ?? 100;
}
function yI(e) {
  var t;
  return ((t = e.pagination) == null ? void 0 : t.getCurrentPage()) ?? 0;
}
function SI(e) {
  var t;
  return ((t = e.pagination) == null ? void 0 : t.getTotalPages()) ?? 1;
}
function xI(e) {
  return e.pagination ? e.pagination.getMasterRowCount() : e.rowModel.getRowCount();
}
function FI(e) {
  var t;
  (t = e.pagination) == null || t.goToNextPage();
}
function RI(e) {
  var t;
  (t = e.pagination) == null || t.goToPreviousPage();
}
function PI(e) {
  var t;
  (t = e.pagination) == null || t.goToFirstPage();
}
function EI(e) {
  var t;
  (t = e.pagination) == null || t.goToLastPage();
}
function TI(e, t) {
  var s;
  (s = e.pagination) == null || s.goToPage(t);
}
var MI = class extends R {
  constructor() {
    super(...arguments), this.beanName = "paginationAutoPageSizeSvc";
  }
  postConstruct() {
    this.beans.ctrlsSvc.whenReady(this, (e) => {
      this.centerRowsCtrl = e.center;
      const t = this.checkPageSize.bind(this);
      this.addManagedEventListeners({
        bodyHeightChanged: t,
        scrollVisibilityChanged: t
      }), this.addManagedPropertyListener("paginationAutoPageSize", this.onPaginationAutoSizeChanged.bind(this)), this.checkPageSize();
    });
  }
  notActive() {
    return !this.gos.get("paginationAutoPageSize") || this.centerRowsCtrl == null;
  }
  onPaginationAutoSizeChanged() {
    this.notActive() ? this.beans.pagination.unsetAutoCalculatedPageSize() : this.checkPageSize();
  }
  checkPageSize() {
    if (this.notActive())
      return;
    const e = this.centerRowsCtrl.viewportSizeFeature.getBodyHeight();
    if (e > 0) {
      const t = this.beans, s = () => {
        const i = Math.max(pt(t), 1), r = Math.floor(e / i);
        t.pagination.setPageSize(r, "autoCalculated");
      };
      this.isBodyRendered ? pe(this, s, 50)() : (s(), this.isBodyRendered = !0);
    } else
      this.isBodyRendered = !1;
  }
}, Dr = "paginationPageSizeSelector", DI = { tag: "span", cls: "ag-paging-page-size" }, AI = class extends D {
  constructor() {
    super(DI), this.hasEmptyOption = !1, this.handlePageSizeItemSelected = () => {
      if (!this.selectPageSizeComp)
        return;
      const e = this.selectPageSizeComp.getValue();
      if (!e)
        return;
      const t = Number(e);
      isNaN(t) || t < 1 || t === this.pagination.getPageSize() || (this.pagination.setPageSize(t, "pageSizeSelector"), this.hasEmptyOption && this.toggleSelectDisplay(!0), this.selectPageSizeComp.getFocusableElement().focus());
    };
  }
  wireBeans(e) {
    this.pagination = e.pagination;
  }
  postConstruct() {
    this.addManagedPropertyListener(Dr, () => {
      this.onPageSizeSelectorValuesChange();
    }), this.addManagedEventListeners({ paginationChanged: (e) => this.handlePaginationChanged(e) });
  }
  handlePaginationChanged(e) {
    if (!this.selectPageSizeComp || !(e != null && e.newPageSize))
      return;
    const t = this.pagination.getPageSize();
    this.getPageSizeSelectorValues().includes(t) ? this.selectPageSizeComp.setValue(t.toString()) : this.hasEmptyOption ? this.selectPageSizeComp.setValue("") : this.toggleSelectDisplay(!0);
  }
  toggleSelectDisplay(e) {
    this.selectPageSizeComp && !e && this.reset(), e && (this.reloadPageSizesSelector(), this.selectPageSizeComp);
  }
  reset() {
    X(this.getGui()), this.selectPageSizeComp && (this.selectPageSizeComp = this.destroyBean(this.selectPageSizeComp));
  }
  onPageSizeSelectorValuesChange() {
    this.selectPageSizeComp && this.shouldShowPageSizeSelector() && this.reloadPageSizesSelector();
  }
  shouldShowPageSizeSelector() {
    return this.gos.get("pagination") && !this.gos.get("suppressPaginationPanel") && !this.gos.get("paginationAutoPageSize") && this.gos.get(Dr) !== !1;
  }
  reloadPageSizesSelector() {
    const e = this.getPageSizeSelectorValues(), t = this.pagination.getPageSize(), s = !t || !e.includes(t);
    if (s) {
      const r = this.gos.exists("paginationPageSize"), n = this.gos.get(Dr) !== !0;
      F(94, { pageSizeSet: r, pageSizesSet: n, pageSizeOptions: e, paginationPageSizeOption: t }), n || F(95, { paginationPageSizeOption: t, paginationPageSizeSelector: Dr }), e.unshift("");
    }
    const i = String(s ? "" : t);
    this.selectPageSizeComp ? (Xe(this.pageSizeOptions, e) || (this.selectPageSizeComp.clearOptions().addOptions(this.createPageSizeSelectOptions(e)), this.pageSizeOptions = e), this.selectPageSizeComp.setValue(i, !0)) : this.createPageSizeSelectorComp(e, i), this.hasEmptyOption = s;
  }
  createPageSizeSelectOptions(e) {
    return e.map((t) => ({
      value: String(t)
    }));
  }
  createPageSizeSelectorComp(e, t) {
    const s = this.getLocaleTextFunc(), i = s("pageSizeSelectorLabel", "Page Size:"), r = s("ariaPageSizeSelectorLabel", "Page Size");
    this.selectPageSizeComp = this.createManagedBean(new st()).addOptions(this.createPageSizeSelectOptions(e)).setValue(t).setAriaLabel(r).setLabel(i).onValueChange(() => this.handlePageSizeItemSelected()), this.appendChild(this.selectPageSizeComp);
  }
  getPageSizeSelectorValues() {
    const e = [20, 50, 100], t = this.gos.get(Dr);
    return !Array.isArray(t) || !(t != null && t.length) ? e : [...t].sort((s, i) => s - i);
  }
  destroy() {
    this.toggleSelectDisplay(!1), super.destroy();
  }
}, II = {
  selector: "AG-PAGE-SIZE-SELECTOR",
  component: AI
}, LI = (
  /*css*/
  ".ag-paging-panel{align-items:center;border-top:var(--ag-footer-row-border);display:flex;gap:calc(var(--ag-spacing)*4);height:var(--ag-pagination-panel-height);justify-content:flex-end;padding:0 var(--ag-cell-horizontal-padding)}:where(.ag-paging-page-size) .ag-wrapper{min-width:50px}.ag-paging-page-summary-panel{align-items:center;display:flex;gap:var(--ag-cell-widget-spacing);.ag-disabled &{pointer-events:none}}.ag-paging-button{cursor:pointer;position:relative;&.ag-disabled{cursor:default;opacity:.5}}.ag-paging-number,.ag-paging-row-summary-panel-number{font-weight:500}"
), kI = class extends ls {
  constructor() {
    super(), this.btFirst = x, this.btPrevious = x, this.btNext = x, this.btLast = x, this.lbRecordCount = x, this.lbFirstRowOnPage = x, this.lbLastRowOnPage = x, this.lbCurrent = x, this.lbTotal = x, this.pageSizeComp = x, this.previousAndFirstButtonsDisabled = !1, this.nextButtonDisabled = !1, this.lastButtonDisabled = !1, this.areListenersSetup = !1, this.allowFocusInnerElement = !1, this.registerCSS(LI);
  }
  wireBeans(e) {
    this.rowModel = e.rowModel, this.pagination = e.pagination, this.ariaAnnounce = e.ariaAnnounce;
  }
  postConstruct() {
    const e = this.gos.get("enableRtl");
    this.setTemplate(this.getTemplate(), [II]);
    const { btFirst: t, btPrevious: s, btNext: i, btLast: r } = this;
    this.activateTabIndex([t, s, i, r]), t.insertAdjacentElement("afterbegin", N(e ? "last" : "first", this.beans)), s.insertAdjacentElement("afterbegin", N(e ? "next" : "previous", this.beans)), i.insertAdjacentElement("afterbegin", N(e ? "previous" : "next", this.beans)), r.insertAdjacentElement("afterbegin", N(e ? "first" : "last", this.beans)), this.addManagedPropertyListener("pagination", this.onPaginationChanged.bind(this)), this.addManagedPropertyListener("suppressPaginationPanel", this.onPaginationChanged.bind(this)), this.addManagedPropertyListeners(
      ["paginationPageSizeSelector", "paginationAutoPageSize", "suppressPaginationPanel"],
      () => this.onPageSizeRelatedOptionsChange()
    ), this.pageSizeComp.toggleSelectDisplay(this.pageSizeComp.shouldShowPageSizeSelector()), this.initialiseTabGuard({
      // prevent tab guard default logic
      onTabKeyDown: () => {
      },
      focusInnerElement: (n) => this.allowFocusInnerElement ? this.tabGuardFeature.getTabGuardCtrl().focusInnerElement(n) : bf(this.beans, n),
      forceFocusOutWhenTabGuardsAreEmpty: !0
    }), this.onPaginationChanged();
  }
  setAllowFocus(e) {
    this.allowFocusInnerElement = e;
  }
  onPaginationChanged() {
    const t = this.gos.get("pagination") && !this.gos.get("suppressPaginationPanel");
    this.setDisplayed(t), t && (this.setupListeners(), this.enableOrDisableButtons(), this.updateLabels(), this.onPageSizeRelatedOptionsChange());
  }
  onPageSizeRelatedOptionsChange() {
    this.pageSizeComp.toggleSelectDisplay(this.pageSizeComp.shouldShowPageSizeSelector());
  }
  setupListeners() {
    this.areListenersSetup || (this.addManagedEventListeners({ paginationChanged: this.onPaginationChanged.bind(this) }), [
      { el: this.btFirst, fn: this.onBtFirst.bind(this) },
      { el: this.btPrevious, fn: this.onBtPrevious.bind(this) },
      { el: this.btNext, fn: this.onBtNext.bind(this) },
      { el: this.btLast, fn: this.onBtLast.bind(this) }
    ].forEach((e) => {
      const { el: t, fn: s } = e;
      this.addManagedListeners(t, {
        click: s,
        keydown: (i) => {
          (i.key === S.ENTER || i.key === S.SPACE) && (i.preventDefault(), s());
        }
      });
    }), wf(this.beans, this, this.getGui()), this.areListenersSetup = !0);
  }
  onBtFirst() {
    this.previousAndFirstButtonsDisabled || this.pagination.goToFirstPage();
  }
  formatNumber(e) {
    const t = this.gos.getCallback("paginationNumberFormatter");
    return t ? t({ value: e }) : Ii(e, this.getLocaleTextFunc.bind(this));
  }
  getTemplate() {
    const e = this.getLocaleTextFunc(), t = `ag-${this.getCompId()}`;
    return {
      tag: "div",
      cls: "ag-paging-panel ag-unselectable",
      attrs: { id: `${t}` },
      children: [
        {
          tag: "ag-page-size-selector",
          ref: "pageSizeComp"
        },
        {
          tag: "span",
          cls: "ag-paging-row-summary-panel",
          children: [
            {
              tag: "span",
              ref: "lbFirstRowOnPage",
              cls: "ag-paging-row-summary-panel-number",
              attrs: { id: `${t}-first-row` }
            },
            { tag: "span", attrs: { id: `${t}-to` }, children: e("to", "to") },
            {
              tag: "span",
              ref: "lbLastRowOnPage",
              cls: "ag-paging-row-summary-panel-number",
              attrs: { id: `${t}-last-row` }
            },
            { tag: "span", attrs: { id: `${t}-of` }, children: e("of", "of") },
            {
              tag: "span",
              ref: "lbRecordCount",
              cls: "ag-paging-row-summary-panel-number",
              attrs: { id: `${t}-row-count` }
            }
          ]
        },
        {
          tag: "span",
          cls: "ag-paging-page-summary-panel",
          role: "presentation",
          children: [
            {
              tag: "div",
              ref: "btFirst",
              cls: "ag-button ag-paging-button",
              role: "button",
              attrs: { "aria-label": e("firstPage", "First Page") }
            },
            {
              tag: "div",
              ref: "btPrevious",
              cls: "ag-button ag-paging-button",
              role: "button",
              attrs: { "aria-label": e("previousPage", "Previous Page") }
            },
            {
              tag: "span",
              cls: "ag-paging-description",
              children: [
                {
                  tag: "span",
                  attrs: {
                    id: `${t}-start-page`
                  },
                  children: e("page", "Page")
                },
                {
                  tag: "span",
                  ref: "lbCurrent",
                  cls: "ag-paging-number",
                  attrs: { id: `${t}-start-page-number` }
                },
                {
                  tag: "span",
                  attrs: {
                    id: `${t}-of-page`
                  },
                  children: e("of", "of")
                },
                {
                  tag: "span",
                  ref: "lbTotal",
                  cls: "ag-paging-number",
                  attrs: { id: `${t}-of-page-number` }
                }
              ]
            },
            {
              tag: "div",
              ref: "btNext",
              cls: "ag-button ag-paging-button",
              role: "button",
              attrs: { "aria-label": e("nextPage", "Next Page") }
            },
            {
              tag: "div",
              ref: "btLast",
              cls: "ag-button ag-paging-button",
              role: "button",
              attrs: { "aria-label": e("lastPage", "Last Page") }
            }
          ]
        }
      ]
    };
  }
  onBtNext() {
    this.nextButtonDisabled || this.pagination.goToNextPage();
  }
  onBtPrevious() {
    this.previousAndFirstButtonsDisabled || this.pagination.goToPreviousPage();
  }
  onBtLast() {
    this.lastButtonDisabled || this.pagination.goToLastPage();
  }
  enableOrDisableButtons() {
    const e = this.pagination.getCurrentPage(), t = this.rowModel.isLastRowIndexKnown(), s = this.pagination.getTotalPages();
    this.previousAndFirstButtonsDisabled = e === 0, this.toggleButtonDisabled(this.btFirst, this.previousAndFirstButtonsDisabled), this.toggleButtonDisabled(this.btPrevious, this.previousAndFirstButtonsDisabled);
    const i = this.isZeroPagesToDisplay(), r = e === s - 1;
    this.nextButtonDisabled = r || i, this.lastButtonDisabled = !t || i || e === s - 1, this.toggleButtonDisabled(this.btNext, this.nextButtonDisabled), this.toggleButtonDisabled(this.btLast, this.lastButtonDisabled);
  }
  toggleButtonDisabled(e, t) {
    wo(e, t), e.classList.toggle("ag-disabled", t);
  }
  isZeroPagesToDisplay() {
    const e = this.rowModel.isLastRowIndexKnown(), t = this.pagination.getTotalPages();
    return e && t === 0;
  }
  updateLabels() {
    const e = this.rowModel.isLastRowIndexKnown(), t = this.pagination.getTotalPages(), s = this.pagination.getMasterRowCount(), i = e ? s : null, r = this.pagination.getCurrentPage(), n = this.pagination.getPageSize();
    let o, a;
    this.isZeroPagesToDisplay() ? o = a = 0 : (o = n * r + 1, a = o + n - 1, e && a > i && (a = i));
    const l = o + n - 1, c = !e && s < l, d = this.formatNumber(o);
    this.lbFirstRowOnPage.textContent = d;
    let h;
    const u = this.getLocaleTextFunc();
    c ? h = u("pageLastRowUnknown", "?") : h = this.formatNumber(a), this.lbLastRowOnPage.textContent = h;
    const p = t > 0 ? r + 1 : 0, f = this.formatNumber(p);
    this.lbCurrent.textContent = f;
    let m, C;
    if (e)
      m = this.formatNumber(t), C = this.formatNumber(i);
    else {
      const v = u("more", "more");
      m = v, C = v;
    }
    this.lbTotal.textContent = m, this.lbRecordCount.textContent = C, this.announceAriaStatus(d, h, C, f, m);
  }
  announceAriaStatus(e, t, s, i, r) {
    var h, u;
    const n = this.getLocaleTextFunc(), o = n("page", "Page"), a = n("to", "to"), l = n("of", "of"), c = `${e} ${a} ${t} ${l} ${s}`, d = `${o} ${i} ${l} ${r}`;
    c !== this.ariaRowStatus && (this.ariaRowStatus = c, (h = this.ariaAnnounce) == null || h.announceValue(c, "paginationRow")), d !== this.ariaPageStatus && (this.ariaPageStatus = d, (u = this.ariaAnnounce) == null || u.announceValue(d, "paginationPage"));
  }
}, GI = {
  selector: "AG-PAGINATION",
  component: kI
}, OI = class extends R {
  constructor() {
    super(...arguments), this.beanName = "pagination", this.currentPage = 0, this.topDisplayedRowIndex = 0, this.bottomDisplayedRowIndex = 0, this.masterRowCount = 0;
  }
  postConstruct() {
    const e = this.gos;
    this.active = e.get("pagination"), this.pageSizeFromGridOptions = e.get("paginationPageSize"), this.paginateChildRows = this.isPaginateChildRows(), this.addManagedPropertyListener("pagination", this.onPaginationGridOptionChanged.bind(this)), this.addManagedPropertyListener("paginationPageSize", this.onPageSizeGridOptionChanged.bind(this));
  }
  getPaginationSelector() {
    return GI;
  }
  isPaginateChildRows() {
    const e = this.gos;
    return e.get("groupHideParentOfSingleChild") || // following two properties deprecated v32.3.0
    e.get("groupRemoveSingleChildren") || e.get("groupRemoveLowestSingleChildren") ? !0 : e.get("paginateChildRows");
  }
  onPaginationGridOptionChanged() {
    this.active = this.gos.get("pagination"), this.calculatePages(), this.dispatchPaginationChangedEvent({ keepRenderedRows: !0 });
  }
  onPageSizeGridOptionChanged() {
    this.setPageSize(this.gos.get("paginationPageSize"), "gridOptions");
  }
  goToPage(e) {
    const t = this.currentPage;
    if (!this.active || t === e || typeof t != "number")
      return;
    const { editSvc: s } = this.beans;
    s != null && s.isEditing() && (s.isBatchEditing() ? s.cleanupEditors() : s.stopEditing(void 0, { source: "api" })), this.currentPage = e, this.calculatePages(), this.dispatchPaginationChangedEvent({ newPage: !0 });
  }
  goToPageWithIndex(e) {
    var s, i;
    if (!this.active)
      return;
    let t = e;
    this.paginateChildRows || (t = ((i = (s = this.beans.rowModel).getTopLevelIndexFromDisplayedIndex) == null ? void 0 : i.call(s, e)) ?? e), this.goToPage(Math.floor(t / this.pageSize));
  }
  isRowInPage(e) {
    return this.active ? e >= this.topDisplayedRowIndex && e <= this.bottomDisplayedRowIndex : !0;
  }
  getCurrentPage() {
    return this.currentPage;
  }
  goToNextPage() {
    this.goToPage(this.currentPage + 1);
  }
  goToPreviousPage() {
    this.goToPage(this.currentPage - 1);
  }
  goToFirstPage() {
    this.goToPage(0);
  }
  goToLastPage() {
    const e = this.beans.rowModel.getRowCount(), t = Math.floor(e / this.pageSize);
    this.goToPage(t);
  }
  getPageSize() {
    return this.pageSize;
  }
  getTotalPages() {
    return this.totalPages;
  }
  /** This is only for state setting before data has been loaded */
  setPage(e) {
    this.currentPage = e;
  }
  get pageSize() {
    return A(this.pageSizeAutoCalculated) && this.gos.get("paginationAutoPageSize") ? this.pageSizeAutoCalculated : A(this.pageSizeFromPageSizeSelector) ? this.pageSizeFromPageSizeSelector : A(this.pageSizeFromInitialState) ? this.pageSizeFromInitialState : A(this.pageSizeFromGridOptions) ? this.pageSizeFromGridOptions : this.defaultPageSize;
  }
  calculatePages() {
    this.active ? this.paginateChildRows ? this.calculatePagesAllRows() : this.calculatePagesMasterRowsOnly() : this.calculatedPagesNotActive(), this.beans.pageBounds.calculateBounds(this.topDisplayedRowIndex, this.bottomDisplayedRowIndex);
  }
  unsetAutoCalculatedPageSize() {
    if (this.pageSizeAutoCalculated === void 0)
      return;
    const e = this.pageSizeAutoCalculated;
    this.pageSizeAutoCalculated = void 0, this.pageSize !== e && (this.calculatePages(), this.dispatchPaginationChangedEvent({ newPageSize: !0 }));
  }
  setPageSize(e, t) {
    const s = this.pageSize;
    switch (t) {
      case "autoCalculated":
        this.pageSizeAutoCalculated = e;
        break;
      case "pageSizeSelector":
        this.pageSizeFromPageSizeSelector = e, this.currentPage !== 0 && this.goToFirstPage();
        break;
      case "initialState":
        this.pageSizeFromInitialState = e;
        break;
      case "gridOptions":
        this.pageSizeFromGridOptions = e, this.pageSizeFromInitialState = void 0, this.pageSizeFromPageSizeSelector = void 0, this.currentPage !== 0 && this.goToFirstPage();
        break;
    }
    s !== this.pageSize && (this.calculatePages(), this.dispatchPaginationChangedEvent({ newPageSize: !0, keepRenderedRows: !0 }));
  }
  setZeroRows() {
    this.masterRowCount = 0, this.topDisplayedRowIndex = 0, this.bottomDisplayedRowIndex = -1, this.currentPage = 0, this.totalPages = 0;
  }
  adjustCurrentPageIfInvalid() {
    const e = this.totalPages;
    this.currentPage >= e && (this.currentPage = e - 1);
    const t = this.currentPage;
    (!isFinite(t) || isNaN(t) || t < 0) && (this.currentPage = 0);
  }
  calculatePagesMasterRowsOnly() {
    const e = this.beans.rowModel, t = e.getTopLevelRowCount();
    if (this.masterRowCount = t, t <= 0) {
      this.setZeroRows();
      return;
    }
    const s = this.pageSize, i = t - 1;
    this.totalPages = Math.floor(i / s) + 1, this.adjustCurrentPageIfInvalid();
    const r = this.currentPage, n = s * r;
    let o = s * (r + 1) - 1;
    if (o > i && (o = i), this.topDisplayedRowIndex = e.getTopLevelRowDisplayedIndex(n), o === i)
      this.bottomDisplayedRowIndex = e.getRowCount() - 1;
    else {
      const a = e.getTopLevelRowDisplayedIndex(o + 1);
      this.bottomDisplayedRowIndex = a - 1;
    }
  }
  getMasterRowCount() {
    return this.masterRowCount;
  }
  calculatePagesAllRows() {
    const e = this.beans.rowModel.getRowCount();
    if (this.masterRowCount = e, e === 0) {
      this.setZeroRows();
      return;
    }
    const { pageSize: t, currentPage: s } = this, i = e - 1;
    this.totalPages = Math.floor(i / t) + 1, this.adjustCurrentPageIfInvalid(), this.topDisplayedRowIndex = t * s, this.bottomDisplayedRowIndex = t * (s + 1) - 1, this.bottomDisplayedRowIndex > i && (this.bottomDisplayedRowIndex = i);
  }
  calculatedPagesNotActive() {
    this.setPageSize(void 0, "autoCalculated"), this.totalPages = 1, this.currentPage = 0, this.topDisplayedRowIndex = 0, this.bottomDisplayedRowIndex = this.beans.rowModel.getRowCount() - 1;
  }
  dispatchPaginationChangedEvent(e) {
    const { keepRenderedRows: t = !1, newPage: s = !1, newPageSize: i = !1 } = e;
    this.eventSvc.dispatchEvent({
      type: "paginationChanged",
      animate: !1,
      newData: !1,
      newPage: s,
      newPageSize: i,
      keepRenderedRows: t
    });
  }
}, VI = {
  moduleName: "Pagination",
  version: B,
  beans: [OI, MI],
  icons: {
    // "go to first" button in pagination controls
    first: "first",
    // "go to previous" button in pagination controls
    previous: "previous",
    // "go to next" button in pagination controls
    next: "next",
    // "go to last" button in pagination controls
    last: "last"
  },
  apiFunctions: {
    paginationIsLastPageFound: wI,
    paginationGetPageSize: bI,
    paginationGetCurrentPage: yI,
    paginationGetTotalPages: SI,
    paginationGetRowCount: xI,
    paginationGoToNextPage: FI,
    paginationGoToPreviousPage: RI,
    paginationGoToFirstPage: PI,
    paginationGoToLastPage: EI,
    paginationGoToPage: TI
  },
  dependsOn: [Is]
};
function BI(e, t = {}) {
  const s = t ? t.rowNodes : void 0;
  e.frameworkOverrides.wrapIncoming(() => e.rowRenderer.redrawRows(s));
}
function Um(e, t, s, i, r) {
  t && (i && t.parent && t.parent.level !== -1 && Um(e, t.parent, s, i, r), t.setExpanded(s, void 0, r));
}
function NI(e, t) {
  return e.rowModel.getRowNode(t);
}
function HI(e, t, s, i) {
  e.rowRenderer.addRenderedRowListener(t, s, i);
}
function zI(e) {
  return e.rowRenderer.getRenderedNodes();
}
function WI(e, t, s) {
  e.rowModel.forEachNode(t, s);
}
function _I(e) {
  return e.rowRenderer.firstRenderedRow;
}
function UI(e) {
  return e.rowRenderer.lastRenderedRow;
}
function $I(e, t) {
  return e.rowModel.getRow(t);
}
function KI(e) {
  return e.rowModel.getRowCount();
}
var jI = {
  moduleName: "RowApi",
  version: B,
  apiFunctions: {
    redrawRows: BI,
    setRowNodeExpanded: Um,
    getRowNode: NI,
    addRenderedRowListener: HI,
    getRenderedNodes: zI,
    forEachNode: WI,
    getFirstDisplayedRowIndex: _I,
    getLastDisplayedRowIndex: UI,
    getDisplayedRowAtIndex: $I,
    getDisplayedRowCount: KI
  }
}, YI = {
  moduleName: "ScrollApi",
  version: B,
  apiFunctions: {
    getVerticalPixelRange: v0,
    getHorizontalPixelRange: w0,
    ensureColumnVisible: Em,
    ensureIndexVisible: Tm,
    ensureNodeVisible: b0
  }
};
function qI(e, t, s) {
  if (!t)
    return;
  const i = e.ctrlsSvc.getGridBodyCtrl().eGridBody, r = `aria-${t}`;
  s === null ? i.removeAttribute(r) : i.setAttribute(r, s);
}
function XI(e, t = {}) {
  e.frameworkOverrides.wrapIncoming(() => e.rowRenderer.refreshCells(t));
}
function ZI(e) {
  e.frameworkOverrides.wrapIncoming(
    () => e.ctrlsSvc.getHeaderRowContainerCtrls().forEach((t) => t.refresh())
  );
}
function QI(e) {
  var t;
  return ((t = e.animationFrameSvc) == null ? void 0 : t.isQueueEmpty()) ?? !0;
}
function JI(e) {
  var t;
  (t = e.animationFrameSvc) == null || t.flushAllFrames();
}
function eL(e) {
  return {
    rowHeight: pt(e),
    headerHeight: Sn(e)
  };
}
function tL(e, t = {}) {
  var n;
  const s = [];
  if (e.rowRenderer.getCellCtrls(t.rowNodes, t.columns).forEach((o) => {
    const a = o.getCellRenderer();
    a != null && s.push(Mi(a));
  }), (n = t.columns) != null && n.length)
    return s;
  const i = [], r = dc(t.rowNodes);
  return e.rowRenderer.getAllRowCtrls().forEach((o) => {
    if (r && !hc(o.rowNode, r) || !o.isFullWidth())
      return;
    const a = o.getFullWidthCellRenderers();
    for (let l = 0; l < a.length; l++) {
      const c = a[l];
      c != null && i.push(Mi(c));
    }
  }), [...i, ...s];
}
var sL = {
  moduleName: "RenderApi",
  version: B,
  apiFunctions: {
    setGridAriaProperty: qI,
    refreshCells: XI,
    refreshHeader: ZI,
    isAnimationFrameQueueEmpty: QI,
    flushAllAnimationFrames: JI,
    getSizesForCurrentTheme: eL,
    getCellRendererInstances: tL
  }
};
function iL(e, t) {
  var s, i;
  typeof t == "number" ? (s = e.colAutosize) == null || s.sizeColumnsToFit(t, "api") : (i = e.colAutosize) == null || i.sizeColumnsToFitGridBody(t);
}
function $m({ colAutosize: e, visibleCols: t }, s, i) {
  Array.isArray(s) ? e == null || e.autoSizeCols({ colKeys: s, skipHeader: i, source: "api" }) : e == null || e.autoSizeCols({
    colKeys: s.colIds ?? t.allCols,
    skipHeader: s.skipHeader,
    defaultMaxWidth: s.defaultMaxWidth,
    defaultMinWidth: s.defaultMinWidth,
    columnLimits: s.columnLimits,
    source: "api"
  });
}
function rL(e, t) {
  var s;
  t && typeof t == "object" ? $m(e, t) : (s = e.colAutosize) == null || s.autoSizeAllColumns({ source: "api", skipHeader: t });
}
var nL = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colAutosize", this.timesDelayed = 0, this.shouldQueueResizeOperations = !1, this.resizeOperationQueue = [];
  }
  postConstruct() {
    var t;
    const e = this.gos.get("autoSizeStrategy");
    if (e) {
      let s = !1;
      const i = e.type;
      i === "fitGridWidth" || i === "fitProvidedWidth" ? s = !0 : i === "fitCellContents" && this.addManagedEventListeners({ firstDataRendered: () => this.onFirstDataRendered(e) }), s && ((t = this.beans.colDelayRenderSvc) == null || t.hideColumns(i));
    }
  }
  autoSizeCols(e) {
    if (this.shouldQueueResizeOperations) {
      this.pushResizeOperation(() => this.autoSizeCols(e));
      return;
    }
    const {
      colKeys: t,
      skipHeader: s,
      skipHeaderGroups: i,
      stopAtGroup: r,
      defaultMaxWidth: n,
      defaultMinWidth: o,
      columnLimits: a = [],
      source: l = "api"
    } = e, { animationFrameSvc: c, renderStatus: d, colModel: h, autoWidthCalc: u, visibleCols: g } = this.beans;
    if (c == null || c.flushAllFrames(), this.timesDelayed < 5 && d && (!d.areHeaderCellsRendered() || !d.areCellsRendered())) {
      this.timesDelayed++, setTimeout(() => {
        this.isAlive() && this.autoSizeCols(e);
      });
      return;
    }
    this.timesDelayed = 0;
    const p = [];
    let f = -1;
    const m = Object.fromEntries(
      a.map(({ colId: w, maxWidth: b, minWidth: y }) => [w, { maxWidth: b, minWidth: y }])
    ), C = s ?? this.gos.get("skipHeaderOnAutoSize"), v = i ?? C;
    for (; f !== 0; ) {
      f = 0;
      const w = [];
      t.forEach((b) => {
        if (!b || Xc(b))
          return;
        const y = h.getCol(b);
        if (!y || p.indexOf(y) >= 0)
          return;
        const P = u.getPreferredWidthForColumn(y, C);
        if (P > 0) {
          const E = m[y.colId] ?? {};
          E.minWidth ?? (E.minWidth = o), E.maxWidth ?? (E.maxWidth = n);
          const M = oL(y, P, E);
          y.setActualWidth(M, l), p.push(y), f++;
        }
        w.push(y);
      }), w.length && g.refresh(l);
    }
    v || this.autoSizeColumnGroupsByColumns(t, l, r), pr(this.eventSvc, p, !0, "autosizeColumns");
  }
  autoSizeColumn(e, t, s) {
    e && this.autoSizeCols({ colKeys: [e], skipHeader: s, skipHeaderGroups: !0, source: t });
  }
  autoSizeColumnGroupsByColumns(e, t, s) {
    const { colModel: i, ctrlsSvc: r } = this.beans, n = /* @__PURE__ */ new Set();
    i.getColsForKeys(e).forEach((c) => {
      let d = c.getParent();
      for (; d && d != s; )
        d.isPadding() || n.add(d), d = d.getParent();
    });
    let a;
    const l = [];
    for (const c of n) {
      for (const d of r.getHeaderRowContainerCtrls())
        if (a = d.getHeaderCtrlForColumn(c), a)
          break;
      a && a.resizeLeafColumnsToFit(t);
    }
    return l;
  }
  autoSizeAllColumns(e) {
    if (this.shouldQueueResizeOperations) {
      this.pushResizeOperation(() => this.autoSizeAllColumns(e));
      return;
    }
    const t = this.beans.visibleCols.allCols;
    this.autoSizeCols({ colKeys: t, ...e });
  }
  addColumnAutosize(e, t) {
    const s = this.gos.get("skipHeaderOnAutoSize"), i = () => {
      this.autoSizeColumn(t, "uiColumnResized", s);
    };
    e.addEventListener("dblclick", i);
    const r = new ms(e);
    return r.addEventListener("doubleTap", i), () => {
      e.removeEventListener("dblclick", i), r.removeEventListener("doubleTap", i), r.destroy();
    };
  }
  addColumnGroupResize(e, t, s) {
    const i = this.gos.get("skipHeaderOnAutoSize"), r = () => {
      const n = [];
      t.getDisplayedLeafColumns().forEach((a) => {
        a.getColDef().suppressAutoSize || n.push(a.getColId());
      }), n.length > 0 && this.autoSizeCols({
        colKeys: n,
        skipHeader: i,
        stopAtGroup: t,
        source: "uiColumnResized"
      }), s();
    };
    return e.addEventListener("dblclick", r), () => e.removeEventListener("dblclick", r);
  }
  // method will call itself if no available width. this covers if the grid
  // isn't visible, but is just about to be visible.
  sizeColumnsToFitGridBody(e, t) {
    if (!this.isAlive())
      return;
    const { ctrlsSvc: s, scrollVisibleSvc: i } = this.beans, r = s.getGridBodyCtrl(), o = r.isVerticalScrollShowing() ? i.getScrollbarWidth() : 0, l = hr(r.eGridBody) - o;
    if (l > 0) {
      this.sizeColumnsToFit(l, "sizeColumnsToFit", !1, e);
      return;
    }
    t === void 0 ? window.setTimeout(() => {
      this.sizeColumnsToFitGridBody(e, 100);
    }, 0) : t === 100 ? window.setTimeout(() => {
      this.sizeColumnsToFitGridBody(e, 500);
    }, 100) : t === 500 ? window.setTimeout(() => {
      this.sizeColumnsToFitGridBody(e, -1);
    }, 500) : F(29);
  }
  // called from api
  sizeColumnsToFit(e, t = "sizeColumnsToFit", s, i) {
    var g;
    if (this.shouldQueueResizeOperations) {
      this.pushResizeOperation(() => this.sizeColumnsToFit(e, t, s, i));
      return;
    }
    const r = {};
    i && ((g = i == null ? void 0 : i.columnLimits) == null || g.forEach(({ key: p, ...f }) => {
      r[typeof p == "string" ? p : p.getColId()] = f;
    }));
    const n = this.beans.visibleCols.allCols;
    if (e <= 0 || !n.length || e === fs(n) && n.every((f) => {
      if (f.colDef.suppressSizeToFit)
        return !0;
      const m = r == null ? void 0 : r[f.getId()], C = (m == null ? void 0 : m.minWidth) ?? (i == null ? void 0 : i.defaultMinWidth), v = (m == null ? void 0 : m.maxWidth) ?? (i == null ? void 0 : i.defaultMaxWidth), w = f.getActualWidth();
      return (C == null || w >= C) && (v == null || w <= v);
    }))
      return;
    const a = [], l = [];
    n.forEach((p) => {
      p.getColDef().suppressSizeToFit === !0 ? l.push(p) : a.push(p);
    });
    const c = a.slice(0);
    let d = !1;
    const h = (p) => {
      be(a, p), l.push(p);
    };
    for (a.forEach((p) => {
      p.resetActualWidth(t);
      const f = r == null ? void 0 : r[p.getId()], m = (f == null ? void 0 : f.minWidth) ?? (i == null ? void 0 : i.defaultMinWidth), C = (f == null ? void 0 : f.maxWidth) ?? (i == null ? void 0 : i.defaultMaxWidth), v = p.getActualWidth();
      typeof m == "number" && v < m ? p.setActualWidth(m, t, !0) : typeof C == "number" && v > C && p.setActualWidth(C, t, !0);
    }); !d; ) {
      d = !0;
      const p = e - fs(l);
      if (p <= 0)
        a.forEach((f) => {
          var C;
          const m = ((C = r == null ? void 0 : r[f.getId()]) == null ? void 0 : C.minWidth) ?? (i == null ? void 0 : i.defaultMinWidth);
          if (typeof m == "number") {
            f.setActualWidth(m, t, !0);
            return;
          }
          f.setActualWidth(f.minWidth, t);
        });
      else {
        const f = p / fs(a);
        let m = p;
        for (let C = a.length - 1; C >= 0; C--) {
          const v = a[C], w = r == null ? void 0 : r[v.getId()], b = (w == null ? void 0 : w.minWidth) ?? (i == null ? void 0 : i.defaultMinWidth), y = (w == null ? void 0 : w.maxWidth) ?? (i == null ? void 0 : i.defaultMaxWidth), P = v.getMinWidth(), E = v.getMaxWidth(), M = typeof b == "number" && b > P ? b : P, T = typeof y == "number" && y < E ? y : E;
          let G = Math.round(v.getActualWidth() * f);
          G < M ? (G = M, h(v), d = !1) : G > T ? (G = T, h(v), d = !1) : C === 0 && (G = m), v.setActualWidth(G, t, !0), m -= G;
        }
      }
    }
    c.forEach((p) => {
      p.fireColumnWidthChangedEvent(t);
    });
    const u = this.beans.visibleCols;
    u.setLeftValues(t), u.updateBodyWidths(), !s && pr(this.eventSvc, c, !0, t);
  }
  applyAutosizeStrategy() {
    const { gos: e, colDelayRenderSvc: t } = this.beans, s = e.get("autoSizeStrategy");
    !s || s.type === "fitCellContents" || setTimeout(() => {
      if (!this.isAlive())
        return;
      const i = s.type;
      if (i === "fitGridWidth") {
        const { columnLimits: r, defaultMinWidth: n, defaultMaxWidth: o } = s, a = r == null ? void 0 : r.map(({ colId: l, minWidth: c, maxWidth: d }) => ({
          key: l,
          minWidth: c,
          maxWidth: d
        }));
        this.sizeColumnsToFitGridBody({
          defaultMinWidth: n,
          defaultMaxWidth: o,
          columnLimits: a
        });
      } else i === "fitProvidedWidth" && this.sizeColumnsToFit(s.width, "sizeColumnsToFit");
      t == null || t.revealColumns(i);
    });
  }
  onFirstDataRendered(e) {
    const { colIds: t, skipHeader: s, defaultMaxWidth: i, defaultMinWidth: r, columnLimits: n } = e;
    setTimeout(() => {
      if (!this.isAlive())
        return;
      const o = {
        skipHeader: s,
        source: "autosizeColumns",
        defaultMaxWidth: i,
        defaultMinWidth: r,
        columnLimits: n
      };
      t ? this.autoSizeCols({ colKeys: t, ...o }) : this.autoSizeAllColumns(o);
    });
  }
  processResizeOperations() {
    this.shouldQueueResizeOperations = !1, this.resizeOperationQueue.forEach((e) => e()), this.resizeOperationQueue = [];
  }
  pushResizeOperation(e) {
    this.resizeOperationQueue.push(e);
  }
  destroy() {
    this.resizeOperationQueue.length = 0, super.destroy();
  }
};
function oL(e, t, s = {}) {
  const i = s.minWidth ?? e.getMinWidth();
  t < i && (t = i);
  const r = s.maxWidth ?? e.getMaxWidth();
  return t > r && (t = r), t;
}
var aL = {
  moduleName: "ColumnAutoSize",
  version: B,
  beans: [nL],
  apiFunctions: {
    sizeColumnsToFit: iL,
    autoSizeColumns: $m,
    autoSizeAllColumns: rL
  },
  dependsOn: [Vf]
}, lL = (
  /*css*/
  ".ag-row-pinned-source{background-color:var(--ag-pinned-source-row-background-color);color:var(--ag-pinned-source-row-text-color);font-weight:var(--ag-pinned-source-row-font-weight)}.ag-row-pinned-manual{background-color:var(--ag-pinned-row-background-color);color:var(--ag-pinned-row-text-color);font-weight:var(--ag-pinned-row-font-weight)}"
);
function cL(e) {
  var t;
  return ((t = e.pinnedRowModel) == null ? void 0 : t.getPinnedTopRowCount()) ?? 0;
}
function dL(e) {
  var t;
  return ((t = e.pinnedRowModel) == null ? void 0 : t.getPinnedBottomRowCount()) ?? 0;
}
function hL(e, t) {
  var s;
  return (s = e.pinnedRowModel) == null ? void 0 : s.getPinnedTopRow(t);
}
function uL(e, t) {
  var s;
  return (s = e.pinnedRowModel) == null ? void 0 : s.getPinnedBottomRow(t);
}
function gL(e, t, s) {
  var i;
  return (i = e.pinnedRowModel) == null ? void 0 : i.forEachPinnedRow(t, s);
}
var pL = {
  moduleName: "PinnedRow",
  version: B,
  beans: [Lx],
  css: [lL],
  apiFunctions: {
    getPinnedTopRowCount: cL,
    getPinnedBottomRowCount: dL,
    getPinnedTopRow: hL,
    getPinnedBottomRow: uL,
    forEachPinnedRow: gL
  },
  icons: {
    rowPin: "pin",
    rowPinTop: "pinned-top",
    rowPinBottom: "pinned-bottom",
    rowUnpin: "un-pin"
  }
}, fL = class extends ar {
  constructor(e, t, s) {
    super(e.col, e.firstNode, s, t), this.cellSpan = e, this.SPANNED_CELL_CSS_CLASS = "ag-spanned-cell";
  }
  setComp(e, t, s, i, r, n, o) {
    this.eWrapper = s, super.setComp(e, t, s, i, r, n, o), this.setAriaRowSpan(), this.refreshAriaRowIndex();
  }
  isCellSpanning() {
    return !0;
  }
  getCellSpan() {
    return this.cellSpan;
  }
  /**
   * When cell is spanning, ensure row index is also available on the cell
   */
  refreshAriaRowIndex() {
    this.rowNode.rowIndex != null && en(this.eGui, this.rowNode.rowIndex);
  }
  /**
   * When cell is spanning, ensure row index is also available on the cell
   */
  setAriaRowSpan() {
    pw(this.eGui, this.cellSpan.spannedNodes.size);
  }
  // not ideal, for tabbing need to force the focused position
  setFocusedCellPosition(e) {
    this.focusedCellPosition = e;
  }
  getFocusedCellPosition() {
    return this.focusedCellPosition ?? this.cellPosition;
  }
  checkCellFocused() {
    const e = this.beans.focusSvc.getFocusedCell();
    return !!e && this.cellSpan.doesSpanContain(e);
  }
  applyStaticCssClasses() {
    super.applyStaticCssClasses(), this.comp.toggleCss(this.SPANNED_CELL_CSS_CLASS, !0);
  }
  onCellFocused(e) {
    const { beans: t } = this;
    if (ya(t)) {
      this.focusedCellPosition = void 0;
      return;
    }
    const s = this.isCellFocused();
    s || (this.focusedCellPosition = void 0), e && s && (this.focusedCellPosition = {
      rowIndex: e.rowIndex,
      rowPinned: e.rowPinned,
      column: e.column
      // fix
    }), super.onCellFocused(e);
  }
  getRootElement() {
    return this.eWrapper;
  }
}, mL = class extends zo {
  onRowIndexChanged() {
    super.onRowIndexChanged(), this.getAllCellCtrls().forEach((e) => e.refreshAriaRowIndex());
  }
  getInitialRowClasses(e) {
    return ["ag-spanned-row"];
  }
  getNewCellCtrl(e) {
    var i;
    const t = (i = this.beans.rowSpanSvc) == null ? void 0 : i.getCellSpan(e, this.rowNode);
    if (!(!t || t.firstNode !== this.rowNode))
      return new fL(t, this, this.beans);
  }
  isCorrectCtrlForSpan(e) {
    var i;
    const t = (i = this.beans.rowSpanSvc) == null ? void 0 : i.getCellSpan(e.column, this.rowNode);
    return !t || t.firstNode !== this.rowNode ? !1 : e.getCellSpan() === t;
  }
  /**
   * Below overrides are explicitly disabling styling and other unwanted behaviours for spannedRowCtrl
   */
  // row height should be 0 in spanned row - they're only included for purpose of aria
  onRowHeightChanged() {
  }
  // no styling spanned rows
  refreshFirstAndLastRowStyles() {
  }
  // no hover functionality for spanned rows
  addHoverFunctionality() {
  }
  resetHoveredStatus() {
  }
}, CL = class extends R {
  constructor() {
    super(...arguments), this.beanName = "spannedRowRenderer", this.topCtrls = /* @__PURE__ */ new Map(), this.bottomCtrls = /* @__PURE__ */ new Map(), this.centerCtrls = /* @__PURE__ */ new Map();
  }
  postConstruct() {
    this.addManagedEventListeners({
      displayedRowsChanged: this.createAllCtrls.bind(this)
    });
  }
  createAllCtrls() {
    this.createCtrls("top"), this.createCtrls("bottom"), this.createCtrls("center");
  }
  /**
   * When displayed rows or cols change, the spanned cell ctrls need to update
   */
  createCtrls(e) {
    const { rowSpanSvc: t } = this.beans, s = `${e}Ctrls`, i = this[s], r = i.size, n = this.getAllRelevantRowControls(e), o = /* @__PURE__ */ new Map();
    let a = !1;
    for (const c of n)
      c.isAlive() && (t == null || t.forEachSpannedColumn(c.rowNode, (d, h) => {
        if (o.has(h.firstNode))
          return;
        const u = i.get(h.firstNode);
        if (u) {
          o.set(h.firstNode, u), i.delete(h.firstNode);
          return;
        }
        a = !0;
        const g = new mL(h.firstNode, this.beans, !1, !1, !1);
        o.set(h.firstNode, g);
      }));
    this[s] = o;
    const l = o.size === r;
    if (!(!a && l)) {
      for (const c of i.values())
        c.destroyFirstPass(!0), c.destroySecondPass();
      this.dispatchLocalEvent({
        type: "spannedRowsUpdated",
        ctrlsKey: e
      });
    }
  }
  // cannot use getAllRowCtrls as it returns this services row ctrls.
  getAllRelevantRowControls(e) {
    const { rowRenderer: t } = this.beans;
    switch (e) {
      case "top":
        return t.topRowCtrls;
      case "bottom":
        return t.bottomRowCtrls;
      case "center":
        return t.allRowCtrls;
    }
  }
  getCellByPosition(e) {
    const { rowSpanSvc: t } = this.beans, s = t == null ? void 0 : t.getCellSpanByPosition(e);
    if (!s)
      return;
    const i = `${Km(e.rowPinned)}Ctrls`, r = this[i].get(s.firstNode);
    if (r)
      return r.getAllCellCtrls().find((n) => n.column === e.column);
  }
  getCtrls(e) {
    const t = `${e}Ctrls`;
    return [...this[t].values()];
  }
  destroyRowCtrls(e) {
    const t = `${e}Ctrls`;
    for (const s of this[t].values())
      s.destroyFirstPass(!0), s.destroySecondPass();
    this[t] = /* @__PURE__ */ new Map();
  }
  destroy() {
    super.destroy(), this.destroyRowCtrls("top"), this.destroyRowCtrls("bottom"), this.destroyRowCtrls("center");
  }
}, Km = (e) => e ?? "center", vL = class {
  constructor(e, t) {
    this.col = e, this.firstNode = t, this.cellSpan = !0, this.spannedNodes = /* @__PURE__ */ new Set(), this.addSpannedNode(t);
  }
  /**
   * Reset the span leaving only the head.
   * Head is used as a comparison as this is the row used to render this cell
   * Even if the row data changes, the cell will properly reflect the correct value.
   */
  reset() {
    this.spannedNodes.clear(), this.addSpannedNode(this.firstNode);
  }
  addSpannedNode(e) {
    this.spannedNodes.add(e), this.lastNode = e;
  }
  getLastNode() {
    return this.lastNode;
  }
  getCellHeight() {
    return this.lastNode.rowTop + this.lastNode.rowHeight - this.firstNode.rowTop - 1;
  }
  doesSpanContain(e) {
    return e.column !== this.col || e.rowPinned != this.firstNode.rowPinned ? !1 : this.firstNode.rowIndex <= e.rowIndex && e.rowIndex <= this.lastNode.rowIndex;
  }
  /**
   * Gets the auto height value for last node in the spanned cell.
   * The first node is used to store the auto height for the cell, but the additional height for this cell
   * needs applied to the last row in the span.
   */
  getLastNodeAutoHeight() {
    var s;
    const e = (s = this.firstNode.__autoHeights) == null ? void 0 : s[this.col.getColId()];
    if (e == null)
      return;
    let t = 0;
    return this.spannedNodes.forEach((i) => {
      i !== this.lastNode && (t += i.rowHeight);
    }), e - t;
  }
}, wL = class extends R {
  constructor(e) {
    super(), this.column = e;
  }
  buildCache(e) {
    var w;
    const {
      column: t,
      beans: { gos: s, pinnedRowModel: i, rowModel: r, valueSvc: n, pagination: o }
    } = this, { colDef: a } = t, l = this[`${e}ValueNodeMap`], c = /* @__PURE__ */ new Map(), d = s.getCallback("isFullWidthRow"), h = a.equals, u = a.spanRows, g = typeof u == "function";
    let p = null, f = null, m;
    const C = (b, y) => {
      p = b, f = null, m = y;
    }, v = (b) => {
      const y = !b.isExpandable() && !b.group && !b.detail && (d ? !d({ rowNode: b }) : !0);
      if (b.rowIndex == null || !y) {
        C(null, null);
        return;
      }
      if (p == null || b.level !== p.level || // no span across groups
      b.footer || f && b.rowIndex - 1 !== (f == null ? void 0 : f.getLastNode().rowIndex)) {
        C(b, n.getValue(t, b));
        return;
      }
      const P = n.getValue(t, b);
      if (g) {
        const E = V(s, {
          valueA: m,
          nodeA: p,
          valueB: P,
          nodeB: b,
          column: t,
          colDef: a
        });
        if (!u(E)) {
          C(b, P);
          return;
        }
      } else if (h ? !h(m, P) : m !== P) {
        C(b, P);
        return;
      }
      if (!f) {
        const E = l == null ? void 0 : l.get(p);
        (E == null ? void 0 : E.firstNode) === p ? (E.reset(), f = E) : f = new vL(t, p), c.set(p, f);
      }
      f.addSpannedNode(b), c.set(b, f);
    };
    switch (e) {
      case "center":
        (w = r.forEachDisplayedNode) == null || w.call(r, (b) => {
          (!o || o.isRowInPage(b.rowIndex)) && v(b);
        });
        break;
      case "top":
        i == null || i.forEachPinnedRow("top", v);
        break;
      case "bottom":
        i == null || i.forEachPinnedRow("bottom", v);
        break;
    }
    this[`${e}ValueNodeMap`] = c;
  }
  isCellSpanning(e) {
    return !!this.getCellSpan(e);
  }
  getCellSpan(e) {
    return this[`${Km(e.rowPinned)}ValueNodeMap`].get(e);
  }
}, bL = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rowSpanSvc", this.spanningColumns = /* @__PURE__ */ new Map(), this.debouncePinnedEvent = pe(this, this.dispatchCellsUpdatedEvent.bind(this, !0), 0), this.debounceModelEvent = pe(this, this.dispatchCellsUpdatedEvent.bind(this, !1), 0), this.pinnedTimeout = null, this.modelTimeout = null;
  }
  postConstruct() {
    const e = this.onRowDataUpdated.bind(this), t = this.buildPinnedCaches.bind(this);
    this.addManagedEventListeners({
      paginationChanged: this.buildModelCaches.bind(this),
      pinnedRowDataChanged: t,
      pinnedRowsChanged: t,
      rowNodeDataChanged: e,
      cellValueChanged: e
    });
  }
  /**
   * When a new column is created with spanning (or spanning changes for a column)
   * @param column column that is now spanning
   */
  register(e) {
    const { gos: t } = this.beans;
    if (!t.get("enableCellSpan") || this.spanningColumns.has(e))
      return;
    const s = this.createManagedBean(new wL(e));
    this.spanningColumns.set(e, s), s.buildCache("top"), s.buildCache("bottom"), s.buildCache("center"), this.debouncePinnedEvent(), this.debounceModelEvent();
  }
  dispatchCellsUpdatedEvent(e) {
    this.dispatchLocalEvent({ type: "spannedCellsUpdated", pinned: e });
  }
  /**
   * When a new column is destroyed with spanning (or spanning changes for a column)
   * @param column column that is now spanning
   */
  deregister(e) {
    this.spanningColumns.delete(e);
  }
  // called when data changes, as this could be a hot path it's debounced
  // it uses timeouts instead of debounce so that it can be cancelled by `modelUpdated`
  // which is expected to run immediately (to exec before the rowRenderer)
  onRowDataUpdated({ node: e }) {
    const { spannedRowRenderer: t } = this.beans;
    if (e.rowPinned) {
      if (this.pinnedTimeout != null)
        return;
      this.pinnedTimeout = window.setTimeout(() => {
        this.pinnedTimeout = null, this.buildPinnedCaches(), t == null || t.createCtrls("top"), t == null || t.createCtrls("bottom");
      }, 0);
      return;
    }
    this.modelTimeout == null && (this.modelTimeout = window.setTimeout(() => {
      this.modelTimeout = null, this.buildModelCaches(), t == null || t.createCtrls("center");
    }, 0));
  }
  buildModelCaches() {
    this.modelTimeout != null && clearTimeout(this.modelTimeout), this.spanningColumns.forEach((e) => e.buildCache("center")), this.debounceModelEvent();
  }
  buildPinnedCaches() {
    this.pinnedTimeout != null && clearTimeout(this.pinnedTimeout), this.spanningColumns.forEach((e) => {
      e.buildCache("top"), e.buildCache("bottom");
    }), this.debouncePinnedEvent();
  }
  isCellSpanning(e, t) {
    const s = this.spanningColumns.get(e);
    return s ? s.isCellSpanning(t) : !1;
  }
  getCellSpanByPosition(e) {
    const { pinnedRowModel: t, rowModel: s } = this.beans, i = e.column, r = e.rowIndex, n = this.spanningColumns.get(i);
    if (!n)
      return;
    let o;
    switch (e.rowPinned) {
      case "top":
        o = t == null ? void 0 : t.getPinnedTopRow(r);
        break;
      case "bottom":
        o = t == null ? void 0 : t.getPinnedBottomRow(r);
        break;
      default:
        o = s.getRow(r);
    }
    if (o)
      return n.getCellSpan(o);
  }
  getCellStart(e) {
    const t = this.getCellSpanByPosition(e);
    return t ? { ...e, rowIndex: t.firstNode.rowIndex } : e;
  }
  getCellEnd(e) {
    const t = this.getCellSpanByPosition(e);
    return t ? { ...e, rowIndex: t.getLastNode().rowIndex } : e;
  }
  /**
   * Look-up a spanned cell given a col and node as position indicators
   *
   * @param col a column to lookup a span at this position
   * @param rowNode a node that may be spanned at this position
   * @returns the CellSpan object if one exists
   */
  getCellSpan(e, t) {
    const s = this.spanningColumns.get(e);
    if (s)
      return s.getCellSpan(t);
  }
  forEachSpannedColumn(e, t) {
    for (const [s, i] of this.spanningColumns)
      if (i.isCellSpanning(e)) {
        const r = i.getCellSpan(e);
        t(s, r);
      }
  }
  destroy() {
    super.destroy(), this.spanningColumns.clear();
  }
}, yL = {
  moduleName: "CellSpan",
  version: B,
  beans: [bL, CL]
}, SL = class extends R {
  constructor(e, t) {
    super(), this.cellCtrl = e, this.staticClasses = [], this.beans = t, this.column = e.column;
  }
  setComp(e) {
    this.cellComp = e, this.applyUserStyles(), this.applyCellClassRules(), this.applyClassesFromColDef();
  }
  applyCellClassRules() {
    const { column: e, cellComp: t } = this, s = e.colDef, i = s.cellClassRules, r = this.getCellClassParams(e, s);
    Md(
      this.beans.expressionSvc,
      // if current was previous, skip
      i === this.cellClassRules ? void 0 : this.cellClassRules,
      i,
      r,
      (n) => t.toggleCss(n, !0),
      (n) => t.toggleCss(n, !1)
    ), this.cellClassRules = i;
  }
  applyUserStyles() {
    const e = this.column, t = e.colDef, s = t.cellStyle;
    if (!s)
      return;
    let i;
    if (typeof s == "function") {
      const r = this.getCellClassParams(e, t);
      i = s(r);
    } else
      i = s;
    i && this.cellComp.setUserStyles(i);
  }
  applyClassesFromColDef() {
    const { column: e, cellComp: t } = this, s = e.colDef, i = this.getCellClassParams(e, s);
    this.staticClasses.forEach((n) => t.toggleCss(n, !1));
    const r = this.beans.cellStyles.getStaticCellClasses(s, i);
    this.staticClasses = r, r.forEach((n) => t.toggleCss(n, !0));
  }
  getCellClassParams(e, t) {
    const { value: s, rowNode: i } = this.cellCtrl;
    return V(this.beans.gos, {
      value: s,
      data: i.data,
      node: i,
      colDef: t,
      column: e,
      rowIndex: i.rowIndex
    });
  }
}, xL = class extends R {
  constructor() {
    super(...arguments), this.beanName = "cellStyles";
  }
  processAllCellClasses(e, t, s, i) {
    Md(
      this.beans.expressionSvc,
      void 0,
      e.cellClassRules,
      t,
      s,
      i
    ), this.processStaticCellClasses(e, t, s);
  }
  getStaticCellClasses(e, t) {
    const { cellClass: s } = e;
    if (!s)
      return [];
    let i;
    return typeof s == "function" ? i = s(t) : i = s, typeof i == "string" && (i = [i]), i || [];
  }
  createCellCustomStyleFeature(e, t) {
    return new SL(e, t);
  }
  processStaticCellClasses(e, t, s) {
    this.getStaticCellClasses(e, t).forEach((r) => {
      s(r);
    });
  }
}, jm = {
  moduleName: "CellStyle",
  version: B,
  beans: [xL]
}, FL = {
  moduleName: "RowStyle",
  version: B,
  beans: [DT]
};
function RL(e, t) {
  var s;
  return !!((s = e.colHover) != null && s.isHovered(t));
}
var PL = class extends R {
  constructor(e, t) {
    super(), this.columns = e, this.element = t, this.destroyManagedListeners = [], this.enableFeature = (s) => {
      const { beans: i, gos: r, element: n, columns: o } = this, a = i.colHover;
      s ?? !!r.get("columnHoverHighlight") ? this.destroyManagedListeners = this.addManagedElementListeners(n, {
        mouseover: a.setMouseOver.bind(a, o),
        mouseout: a.clearMouseOver.bind(a)
      }) : (this.destroyManagedListeners.forEach((c) => c()), this.destroyManagedListeners = []);
    };
  }
  postConstruct() {
    this.addManagedPropertyListener("columnHoverHighlight", ({ currentValue: e }) => {
      this.enableFeature(e);
    }), this.enableFeature();
  }
  destroy() {
    super.destroy(), this.destroyManagedListeners = null;
  }
}, EL = "ag-column-hover", TL = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colHover";
  }
  postConstruct() {
    this.addManagedPropertyListener("columnHoverHighlight", ({ currentValue: e }) => {
      e || this.clearMouseOver();
    });
  }
  setMouseOver(e) {
    this.updateState(e);
  }
  clearMouseOver() {
    this.updateState(null);
  }
  isHovered(e) {
    if (!this.gos.get("columnHoverHighlight"))
      return !1;
    const t = this.selectedColumns;
    return !!t && t.indexOf(e) >= 0;
  }
  addHeaderColumnHoverListener(e, t, s) {
    const i = () => {
      const r = this.isHovered(s);
      t.toggleCss("ag-column-hover", r);
    };
    e.addManagedEventListeners({ columnHoverChanged: i }), i();
  }
  onCellColumnHover(e, t) {
    if (!t)
      return;
    const s = this.isHovered(e);
    t.toggleCss(EL, s);
  }
  addHeaderFilterColumnHoverListener(e, t, s, i) {
    this.createHoverFeature(e, [s], i);
    const r = () => {
      const n = this.isHovered(s);
      t.toggleCss("ag-column-hover", n);
    };
    e.addManagedEventListeners({ columnHoverChanged: r }), r();
  }
  createHoverFeature(e, t, s) {
    e.createManagedBean(new PL(t, s));
  }
  updateState(e) {
    this.selectedColumns = e, this.eventSvc.dispatchEvent({
      type: "columnHoverChanged"
    });
  }
}, ML = {
  moduleName: "ColumnHover",
  version: B,
  beans: [TL],
  apiFunctions: {
    isColumnHovered: RL
  }
}, DL = class extends R {
  constructor() {
    super(...arguments), this.beanName = "apiEventSvc", this.syncListeners = /* @__PURE__ */ new Map(), this.asyncListeners = /* @__PURE__ */ new Map(), this.syncGlobalListeners = /* @__PURE__ */ new Set(), this.globalListenerPairs = /* @__PURE__ */ new Map();
  }
  postConstruct() {
    var e, t;
    this.wrapSvc = (t = (e = this.beans.frameworkOverrides).createGlobalEventListenerWrapper) == null ? void 0 : t.call(e);
  }
  addListener(e, t) {
    var n;
    const s = ((n = this.wrapSvc) == null ? void 0 : n.wrap(e, t)) ?? t, i = !co.has(e), r = i ? this.asyncListeners : this.syncListeners;
    r.has(e) || r.set(e, /* @__PURE__ */ new Set()), r.get(e).add(s), this.eventSvc.addListener(e, s, i);
  }
  removeListener(e, t) {
    var n, o;
    const s = ((n = this.wrapSvc) == null ? void 0 : n.unwrap(e, t)) ?? t, i = this.asyncListeners.get(e), r = !!(i != null && i.delete(s));
    r || (o = this.syncListeners.get(e)) == null || o.delete(s), this.eventSvc.removeListener(e, s, r);
  }
  addGlobalListener(e) {
    var n;
    const t = ((n = this.wrapSvc) == null ? void 0 : n.wrapGlobal(e)) ?? e, s = (o, a) => {
      co.has(o) && t(o, a);
    }, i = (o, a) => {
      co.has(o) || t(o, a);
    };
    this.globalListenerPairs.set(e, { syncListener: s, asyncListener: i });
    const r = this.eventSvc;
    r.addGlobalListener(s, !1), r.addGlobalListener(i, !0);
  }
  removeGlobalListener(e) {
    const { eventSvc: t, wrapSvc: s, globalListenerPairs: i } = this, r = (s == null ? void 0 : s.unwrapGlobal(e)) ?? e;
    if (i.has(r)) {
      const { syncListener: o, asyncListener: a } = i.get(r);
      t.removeGlobalListener(o, !1), t.removeGlobalListener(a, !0), i.delete(e);
    } else
      this.syncGlobalListeners.delete(r), t.removeGlobalListener(r, !1);
  }
  destroyEventListeners(e, t) {
    e.forEach((s, i) => {
      s.forEach((r) => this.eventSvc.removeListener(i, r, t)), s.clear();
    }), e.clear();
  }
  destroyGlobalListeners(e, t) {
    e.forEach((s) => this.eventSvc.removeGlobalListener(s, t)), e.clear();
  }
  destroy() {
    super.destroy(), this.destroyEventListeners(this.syncListeners, !1), this.destroyEventListeners(this.asyncListeners, !0), this.destroyGlobalListeners(this.syncGlobalListeners, !1);
    const { globalListenerPairs: e, eventSvc: t } = this;
    e.forEach(({ syncListener: s, asyncListener: i }) => {
      t.removeGlobalListener(s, !1), t.removeGlobalListener(i, !0);
    }), e.clear();
  }
};
function AL(e, t, s) {
  var i;
  (i = e.apiEventSvc) == null || i.addListener(t, s);
}
function IL(e, t, s) {
  var i;
  (i = e.apiEventSvc) == null || i.removeListener(t, s);
}
function LL(e, t) {
  var s;
  (s = e.apiEventSvc) == null || s.addGlobalListener(t);
}
function kL(e, t) {
  var s;
  (s = e.apiEventSvc) == null || s.removeGlobalListener(t);
}
var Ym = {
  moduleName: "EventApi",
  version: B,
  apiFunctions: {
    addEventListener: AL,
    addGlobalListener: LL,
    removeEventListener: IL,
    removeGlobalListener: kL
  },
  beans: [DL]
}, GL = {
  moduleName: "Locale",
  version: B,
  beans: [TM]
}, OL = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rowAutoHeight", this.wasEverActive = !1, this._debouncedCalculateRowHeights = pe(this, this.calculateRowHeights.bind(this), 1);
  }
  /**
   * If row height has been active, request a refresh of the row heights.
   */
  requestCheckAutoHeight() {
    this.wasEverActive && this._debouncedCalculateRowHeights();
  }
  calculateRowHeights() {
    var a, l, c, d;
    const { visibleCols: e, rowModel: t, rowSpanSvc: s, pinnedRowModel: i } = this.beans, r = e.autoHeightCols;
    let n = !1;
    const o = (h) => {
      var p;
      const u = h.__autoHeights;
      let g = He(this.beans, h).height;
      for (const f of r) {
        let m = u == null ? void 0 : u[f.getColId()];
        const C = s == null ? void 0 : s.getCellSpan(f, h);
        if (C) {
          if (C.getLastNode() !== h)
            continue;
          if (m = (p = s == null ? void 0 : s.getCellSpan(f, h)) == null ? void 0 : p.getLastNodeAutoHeight(), !m)
            return;
        }
        if (m == null) {
          if (this.colSpanSkipCell(f, h))
            continue;
          return;
        }
        g = Math.max(m, g);
      }
      g !== h.rowHeight && (h.setRowHeight(g), n = !0);
    };
    (a = i == null ? void 0 : i.forEachPinnedRow) == null || a.call(i, "top", o), (l = i == null ? void 0 : i.forEachPinnedRow) == null || l.call(i, "bottom", o), (c = t.forEachDisplayedNode) == null || c.call(t, o), n && ((d = t.onRowHeightChanged) == null || d.call(t));
  }
  /**
   * Set the cell height into the row node, and request a refresh of the row heights if there's been a change.
   * @param rowNode the node to set the auto height on
   * @param cellHeight the height to set, undefined if the cell has just been destroyed
   * @param column the column of the cell
   */
  setRowAutoHeight(e, t, s) {
    if (e.__autoHeights ?? (e.__autoHeights = {}), t == null) {
      delete e.__autoHeights[s.getId()];
      return;
    }
    const i = e.__autoHeights[s.getId()];
    e.__autoHeights[s.getId()] = t, i !== t && this.requestCheckAutoHeight();
  }
  /**
   * If using col span, then cells which have been spanned over do not need an auto height value
   * @param col the column of the cell
   * @param node the node of the cell
   * @returns whether the row needs auto height value for that column
   */
  colSpanSkipCell(e, t) {
    const { colModel: s, colViewport: i, visibleCols: r } = this.beans;
    if (!s.colSpanActive)
      return !1;
    let n = [];
    switch (e.getPinned()) {
      case "left":
        n = r.getLeftColsForRow(t);
        break;
      case "right":
        n = r.getRightColsForRow(t);
        break;
      case null:
        n = i.getColsWithinViewport(t);
        break;
    }
    return !n.includes(e);
  }
  /**
   * If required, sets up observers to continuously measure changes in the cell height.
   * @param cellCtrl the cellCtrl of the cell
   * @param eCellWrapper the HTMLElement to track the height of
   * @param compBean the component bean to add the destroy/cleanup function to
   * @returns whether or not auto height has been set up on this cell
   */
  setupCellAutoHeight(e, t, s) {
    if (!e.column.isAutoHeight() || !t)
      return !1;
    this.wasEverActive = !0;
    const i = t.parentElement, { rowNode: r, column: n } = e, o = this.beans, a = (d) => {
      var v;
      if ((v = this.beans.editSvc) != null && v.isEditing(e) || !e.isAlive() || !s.isAlive())
        return;
      const { paddingTop: h, paddingBottom: u, borderBottomWidth: g, borderTopWidth: p } = Vi(i), f = h + u + g + p, C = t.offsetHeight + f;
      if (d < 5) {
        const w = me(o), b = !w || !w.contains(t), y = C == 0;
        if (b || y) {
          window.setTimeout(() => a(d + 1), 0);
          return;
        }
      }
      this.setRowAutoHeight(r, C, n);
    }, l = () => a(0);
    l();
    const c = os(o, t, l);
    return s.addDestroyFunc(() => {
      c(), this.setRowAutoHeight(r, void 0, n);
    }), !0;
  }
  setAutoHeightActive(e) {
    this.active = e.list.some((t) => t.isVisible() && t.isAutoHeight());
  }
  /**
   * Determines if the row auto height service has cells to grow.
   * @returns true if all of the rendered rows are at least as tall as their rendered cells.
   */
  areRowsMeasured() {
    if (!this.active)
      return !0;
    const e = this.beans.rowRenderer.getAllRowCtrls();
    let t = null;
    for (const { rowNode: s } of e)
      if ((!t || this.beans.colModel.colSpanActive) && (t = this.beans.colViewport.getColsWithinViewport(s).filter((r) => r.isAutoHeight())), t.length !== 0) {
        if (!s.__autoHeights)
          return !1;
        for (const i of t) {
          const r = s.__autoHeights[i.getColId()];
          if (!r || s.rowHeight < r)
            return !1;
        }
      }
    return !0;
  }
}, VL = {
  moduleName: "RowAutoHeight",
  version: B,
  beans: [OL]
}, qm = {
  moduleName: "AllCommunity",
  version: B,
  dependsOn: [
    zA,
    Wm,
    iI,
    WM,
    Z0,
    Q0,
    J0,
    eA,
    tA,
    sA,
    iA,
    X0,
    _D,
    UD,
    $D,
    WD,
    jD,
    YD,
    vI,
    FA,
    VI,
    Nf,
    jI,
    YI,
    sL,
    aL,
    VF,
    pL,
    CA,
    hM,
    jm,
    ML,
    FL,
    Ym,
    pM,
    _m,
    Nd,
    GL,
    VL,
    OF,
    WA,
    yL
  ]
}, BL = class {
  constructor() {
    this.ieCompatibility = !1;
  }
  init() {
    this.ieCompatibility = this.md5("hello") != "5d41402abc4b2a76b9719d911017c592";
  }
  md5cycle(e, t) {
    let s = e[0], i = e[1], r = e[2], n = e[3];
    s = this.ff(s, i, r, n, t[0], 7, -680876936), n = this.ff(n, s, i, r, t[1], 12, -389564586), r = this.ff(r, n, s, i, t[2], 17, 606105819), i = this.ff(i, r, n, s, t[3], 22, -1044525330), s = this.ff(s, i, r, n, t[4], 7, -176418897), n = this.ff(n, s, i, r, t[5], 12, 1200080426), r = this.ff(r, n, s, i, t[6], 17, -1473231341), i = this.ff(i, r, n, s, t[7], 22, -45705983), s = this.ff(s, i, r, n, t[8], 7, 1770035416), n = this.ff(n, s, i, r, t[9], 12, -1958414417), r = this.ff(r, n, s, i, t[10], 17, -42063), i = this.ff(i, r, n, s, t[11], 22, -1990404162), s = this.ff(s, i, r, n, t[12], 7, 1804603682), n = this.ff(n, s, i, r, t[13], 12, -40341101), r = this.ff(r, n, s, i, t[14], 17, -1502002290), i = this.ff(i, r, n, s, t[15], 22, 1236535329), s = this.gg(s, i, r, n, t[1], 5, -165796510), n = this.gg(n, s, i, r, t[6], 9, -1069501632), r = this.gg(r, n, s, i, t[11], 14, 643717713), i = this.gg(i, r, n, s, t[0], 20, -373897302), s = this.gg(s, i, r, n, t[5], 5, -701558691), n = this.gg(n, s, i, r, t[10], 9, 38016083), r = this.gg(r, n, s, i, t[15], 14, -660478335), i = this.gg(i, r, n, s, t[4], 20, -405537848), s = this.gg(s, i, r, n, t[9], 5, 568446438), n = this.gg(n, s, i, r, t[14], 9, -1019803690), r = this.gg(r, n, s, i, t[3], 14, -187363961), i = this.gg(i, r, n, s, t[8], 20, 1163531501), s = this.gg(s, i, r, n, t[13], 5, -1444681467), n = this.gg(n, s, i, r, t[2], 9, -51403784), r = this.gg(r, n, s, i, t[7], 14, 1735328473), i = this.gg(i, r, n, s, t[12], 20, -1926607734), s = this.hh(s, i, r, n, t[5], 4, -378558), n = this.hh(n, s, i, r, t[8], 11, -2022574463), r = this.hh(r, n, s, i, t[11], 16, 1839030562), i = this.hh(i, r, n, s, t[14], 23, -35309556), s = this.hh(s, i, r, n, t[1], 4, -1530992060), n = this.hh(n, s, i, r, t[4], 11, 1272893353), r = this.hh(r, n, s, i, t[7], 16, -155497632), i = this.hh(i, r, n, s, t[10], 23, -1094730640), s = this.hh(s, i, r, n, t[13], 4, 681279174), n = this.hh(n, s, i, r, t[0], 11, -358537222), r = this.hh(r, n, s, i, t[3], 16, -722521979), i = this.hh(i, r, n, s, t[6], 23, 76029189), s = this.hh(s, i, r, n, t[9], 4, -640364487), n = this.hh(n, s, i, r, t[12], 11, -421815835), r = this.hh(r, n, s, i, t[15], 16, 530742520), i = this.hh(i, r, n, s, t[2], 23, -995338651), s = this.ii(s, i, r, n, t[0], 6, -198630844), n = this.ii(n, s, i, r, t[7], 10, 1126891415), r = this.ii(r, n, s, i, t[14], 15, -1416354905), i = this.ii(i, r, n, s, t[5], 21, -57434055), s = this.ii(s, i, r, n, t[12], 6, 1700485571), n = this.ii(n, s, i, r, t[3], 10, -1894986606), r = this.ii(r, n, s, i, t[10], 15, -1051523), i = this.ii(i, r, n, s, t[1], 21, -2054922799), s = this.ii(s, i, r, n, t[8], 6, 1873313359), n = this.ii(n, s, i, r, t[15], 10, -30611744), r = this.ii(r, n, s, i, t[6], 15, -1560198380), i = this.ii(i, r, n, s, t[13], 21, 1309151649), s = this.ii(s, i, r, n, t[4], 6, -145523070), n = this.ii(n, s, i, r, t[11], 10, -1120210379), r = this.ii(r, n, s, i, t[2], 15, 718787259), i = this.ii(i, r, n, s, t[9], 21, -343485551), e[0] = this.add32(s, e[0]), e[1] = this.add32(i, e[1]), e[2] = this.add32(r, e[2]), e[3] = this.add32(n, e[3]);
  }
  cmn(e, t, s, i, r, n) {
    return t = this.add32(this.add32(t, e), this.add32(i, n)), this.add32(t << r | t >>> 32 - r, s);
  }
  ff(e, t, s, i, r, n, o) {
    return this.cmn(t & s | ~t & i, e, t, r, n, o);
  }
  gg(e, t, s, i, r, n, o) {
    return this.cmn(t & i | s & ~i, e, t, r, n, o);
  }
  hh(e, t, s, i, r, n, o) {
    return this.cmn(t ^ s ^ i, e, t, r, n, o);
  }
  ii(e, t, s, i, r, n, o) {
    return this.cmn(s ^ (t | ~i), e, t, r, n, o);
  }
  md51(e) {
    const t = e.length, s = [1732584193, -271733879, -1732584194, 271733878];
    let i;
    for (i = 64; i <= e.length; i += 64)
      this.md5cycle(s, this.md5blk(e.substring(i - 64, i)));
    e = e.substring(i - 64);
    const r = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
    for (i = 0; i < e.length; i++)
      r[i >> 2] |= e.charCodeAt(i) << (i % 4 << 3);
    if (r[i >> 2] |= 128 << (i % 4 << 3), i > 55)
      for (this.md5cycle(s, r), i = 0; i < 16; i++)
        r[i] = 0;
    return r[14] = t * 8, this.md5cycle(s, r), s;
  }
  /* there needs to be support for Unicode here, * unless we pretend that we can redefine the MD-5
   * algorithm for multi-byte characters (perhaps by adding every four 16-bit characters and
   * shortening the sum to 32 bits). Otherwise I suthis.ggest performing MD-5 as if every character
   * was two bytes--e.g., 0040 0025 = @%--but then how will an ordinary MD-5 sum be matched?
   * There is no way to standardize text to something like UTF-8 before transformation; speed cost is
   * utterly prohibitive. The JavaScript standard itself needs to look at this: it should start
   * providing access to strings as preformed UTF-8 8-bit unsigned value arrays.
   */
  md5blk(e) {
    const t = [];
    for (let s = 0; s < 64; s += 4)
      t[s >> 2] = e.charCodeAt(s) + (e.charCodeAt(s + 1) << 8) + (e.charCodeAt(s + 2) << 16) + (e.charCodeAt(s + 3) << 24);
    return t;
  }
  rhex(e) {
    const t = "0123456789abcdef".split("");
    let s = "", i = 0;
    for (; i < 4; i++)
      s += t[e >> i * 8 + 4 & 15] + t[e >> i * 8 & 15];
    return s;
  }
  hex(e) {
    for (let t = 0; t < e.length; t++)
      e[t] = this.rhex(e[t]);
    return e.join("");
  }
  md5(e) {
    return this.hex(this.md51(e));
  }
  add32(e, t) {
    return this.ieCompatibility ? this.add32Compat(e, t) : this.add32Std(e, t);
  }
  /* this function is much faster, so if possible we use it. Some IEs are the only ones I know of that
   need the idiotic second function, generated by an if clause.  */
  add32Std(e, t) {
    return e + t & 4294967295;
  }
  add32Compat(e, t) {
    const s = (e & 65535) + (t & 65535);
    return (e >> 16) + (t >> 16) + (s >> 16) << 16 | s & 65535;
  }
}, Un = {
  "01": "GRID",
  "02": "CHARTS",
  "0102": "BOTH"
}, bu = "https://www.ag-grid.com/licensing/", Xm = class lt {
  constructor(t) {
    this.watermarkMessage = void 0, this.totalMessageLength = 124, this.document = t, this.md5 = new BL(), this.md5.init();
  }
  validateLicense() {
    const t = this.getLicenseDetails(lt.licenseKey), s = `AG Grid ${t.currentLicenseType === "BOTH" ? "and AG Charts " : ""}Enterprise`, i = t.suppliedLicenseType === void 0 ? "" : `AG ${t.suppliedLicenseType === "BOTH" ? "Grid and AG Charts" : t.suppliedLicenseType === "GRID" ? "Grid" : "Charts"} Enterprise`;
    if (t.missing)
      (!this.isWebsiteUrl() || this.isForceWatermark()) && this.outputMissingLicenseKey(s);
    else if (t.expired) {
      const r = lt.getGridReleaseDate(), n = lt.formatDate(r);
      this.outputExpiredKey(t.expiry, n, s, i);
    } else t.valid ? t.isTrial && t.trialExpired && this.outputExpiredTrialKey(t.expiry, s, i) : this.outputInvalidLicenseKey(
      !!t.incorrectLicenseType,
      s,
      i
    );
  }
  static extractExpiry(t) {
    const s = t.substring(t.lastIndexOf("_") + 1, t.length);
    return new Date(parseInt(lt.decode(s), 10));
  }
  static extractLicenseComponents(t) {
    let s = t.replace(/[\u200B-\u200D\uFEFF]/g, "");
    if (s = s.replace(/\r?\n|\r/g, ""), t.length <= 32)
      return { md5: null, license: t, version: null, isTrial: null };
    const i = s.length - 32, r = s.substring(i), n = s.substring(0, i), [o, a, l] = lt.extractBracketedInformation(s);
    return { md5: r, license: n, version: o, isTrial: a, type: l };
  }
  getLicenseDetails(t) {
    const s = lt.chartsLicenseManager ? "BOTH" : "GRID";
    if (!(t != null && t.length))
      return {
        licenseKey: t,
        valid: !1,
        missing: !0,
        currentLicenseType: s
      };
    const i = lt.getGridReleaseDate(), { md5: r, license: n, version: o, isTrial: a, type: l } = lt.extractLicenseComponents(t);
    let c = r === this.md5.md5(n) && t.indexOf("For_Trialing_ag-Grid_Only") === -1, d, h, u = null, g = !1, p;
    function f() {
      d = u < /* @__PURE__ */ new Date(), h = void 0;
    }
    if (c && (u = lt.extractExpiry(n), c = !isNaN(u.getTime()), c))
      switch (h = i > u, o) {
        case "legacy":
        case "2": {
          a && f();
          break;
        }
        case "3":
          l != null && l.length ? (p = l, l !== Un["01"] && l !== Un["0102"] || s === "BOTH" && p !== "BOTH" ? (c = !1, g = !0) : a && f()) : c = !1;
      }
    return c ? {
      licenseKey: t,
      valid: c,
      expiry: lt.formatDate(u),
      expired: h,
      version: o,
      isTrial: a,
      trialExpired: d,
      incorrectLicenseType: g,
      currentLicenseType: s,
      suppliedLicenseType: p
    } : {
      licenseKey: t,
      valid: c,
      incorrectLicenseType: g,
      currentLicenseType: s,
      suppliedLicenseType: p
    };
  }
  isDisplayWatermark() {
    var t;
    return this.isForceWatermark() || !this.isLocalhost() && !this.isWebsiteUrl() && !!((t = this.watermarkMessage) != null && t.length);
  }
  getWatermarkMessage() {
    return this.watermarkMessage || "";
  }
  getHostname() {
    const s = (this.document.defaultView || window).location, { hostname: i = "" } = s;
    return i;
  }
  isForceWatermark() {
    const s = (this.document.defaultView || window).location, { pathname: i } = s;
    return i ? i.indexOf("forceWatermark") !== -1 : !1;
  }
  isWebsiteUrl() {
    return this.getHostname().match(/^((?:[\w-]+\.)?ag-grid\.com)$/) !== null;
  }
  isLocalhost() {
    return this.getHostname().match(/^(?:127\.0\.0\.1|localhost)$/) !== null;
  }
  static formatDate(t) {
    const s = [
      "January",
      "February",
      "March",
      "April",
      "May",
      "June",
      "July",
      "August",
      "September",
      "October",
      "November",
      "December"
    ], i = t.getDate(), r = t.getMonth(), n = t.getFullYear();
    return i + " " + s[r] + " " + n;
  }
  static getGridReleaseDate() {
    return new Date(parseInt(lt.decode(lt.RELEASE_INFORMATION), 10));
  }
  static decode(t) {
    const s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    let i = "", r, n, o, a, l, c, d, h = 0;
    const u = t.replace(/[^A-Za-z0-9+/=]/g, "");
    for (; h < u.length; )
      a = s.indexOf(u.charAt(h++)), l = s.indexOf(u.charAt(h++)), c = s.indexOf(u.charAt(h++)), d = s.indexOf(u.charAt(h++)), r = a << 2 | l >> 4, n = (l & 15) << 4 | c >> 2, o = (c & 3) << 6 | d, i = i + String.fromCharCode(r), c != 64 && (i = i + String.fromCharCode(n)), d != 64 && (i = i + String.fromCharCode(o));
    return i = lt.utf8_decode(i), i;
  }
  static utf8_decode(t) {
    t = t.replace(/rn/g, "n");
    let s = "";
    for (let i = 0; i < t.length; i++) {
      const r = t.charCodeAt(i);
      r < 128 ? s += String.fromCharCode(r) : r > 127 && r < 2048 ? (s += String.fromCharCode(r >> 6 | 192), s += String.fromCharCode(r & 63 | 128)) : (s += String.fromCharCode(r >> 12 | 224), s += String.fromCharCode(r >> 6 & 63 | 128), s += String.fromCharCode(r & 63 | 128));
    }
    return s;
  }
  static setChartsLicenseManager(t) {
    var s;
    this.chartsLicenseManager = t, (s = this.chartsLicenseManager) == null || s.setLicenseKey(this.licenseKey, !0);
  }
  static setLicenseKey(t) {
    var s;
    this.licenseKey = t, (s = this.chartsLicenseManager) == null || s.setLicenseKey(t, !0);
  }
  static extractBracketedInformation(t) {
    if (!t.includes("["))
      return ["legacy", !1, void 0];
    const s = t.match(/\[(.*?)\]/g).map((a) => a.replace("[", "").replace("]", ""));
    if (!s || s.length === 0)
      return ["legacy", !1, void 0];
    const i = s.filter((a) => a === "TRIAL").length === 1, r = s.filter((a) => a.indexOf("v") === 0)[0], n = r ? r.replace("v", "") : "legacy", o = Un[s.filter((a) => Un[a])[0]];
    return [n, i, o];
  }
  centerPadAndOutput(t) {
    const s = this.totalMessageLength - t.length;
    console.error(t.padStart(s / 2 + t.length, "*").padEnd(this.totalMessageLength, "*"));
  }
  padAndOutput(t, s = "*", i = "") {
    console.error(
      t.padEnd(this.totalMessageLength - i.length, s) + i
    );
  }
  outputInvalidLicenseKey(t, s, i) {
    t ? (this.centerPadAndOutput(""), this.centerPadAndOutput(` ${s} License `), this.centerPadAndOutput(" Incompatible License Key "), this.padAndOutput(
      `* Your license key is for ${i} only and does not cover you for ${s}.`,
      " ",
      "*"
    ), this.padAndOutput(`* To troubleshoot your license key visit ${bu}.`, " ", "*"), this.centerPadAndOutput(""), this.centerPadAndOutput("")) : (this.centerPadAndOutput(""), this.centerPadAndOutput(` ${s} License `), this.centerPadAndOutput(" Invalid License Key "), this.padAndOutput("* Your license key is not valid.", " ", "*"), this.padAndOutput(`* To troubleshoot your license key visit ${bu}.`, " ", "*"), this.centerPadAndOutput(""), this.centerPadAndOutput("")), this.watermarkMessage = "Invalid License";
  }
  outputExpiredTrialKey(t, s, i) {
    this.centerPadAndOutput(""), this.centerPadAndOutput(` ${s} License `), this.centerPadAndOutput(" Trial Period Expired. "), this.padAndOutput(
      `* Your trial only license for ${i} expired on ${t}.`,
      " ",
      "*"
    ), this.padAndOutput("* Please email info@ag-grid.com to purchase a license.", " ", "*"), this.centerPadAndOutput(""), this.centerPadAndOutput(""), this.watermarkMessage = "Trial Period Expired";
  }
  outputMissingLicenseKey(t) {
    this.centerPadAndOutput(""), this.centerPadAndOutput(` ${t} License `), this.centerPadAndOutput(" License Key Not Found "), this.padAndOutput(`* All ${t} features are unlocked for trial.`, " ", "*"), this.padAndOutput(
      "* If you want to hide the watermark please email info@ag-grid.com for a trial license key.",
      " ",
      "*"
    ), this.centerPadAndOutput(""), this.centerPadAndOutput(""), this.watermarkMessage = "For Trial Use Only";
  }
  outputExpiredKey(t, s, i, r) {
    this.centerPadAndOutput(""), this.centerPadAndOutput(` ${i} License `), this.centerPadAndOutput(" Incompatible Software Version "), this.padAndOutput(
      `* Your license key works with versions${r == "" ? "" : ` of ${r}`} released before ${t}.`,
      " ",
      "*"
    ), this.padAndOutput(`* The version you are trying to use was released on ${s}.`, " ", "*"), this.padAndOutput("* Please contact info@ag-grid.com to renew your license key.", " ", "*"), this.centerPadAndOutput(""), this.centerPadAndOutput(""), this.watermarkMessage = "License Expired";
  }
};
Xm.RELEASE_INFORMATION = "MTc1NzA4ODUwMDMzNw==";
var Wr = Xm, NL = (
  /*css*/
  '.ag-watermark{bottom:20px;color:#9b9b9b;opacity:.7;position:absolute;transition:opacity 1s ease-out 3s;&:before{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDkiIGhlaWdodD0iMzYiIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyMDkgMzYiPjxwYXRoIGZpbGw9IiM5YjliOWIiIGQ9Ik0xOTIuOTkzIDIzLjY1OHYtNy45NDZoLTEzLjU0MWwtNy45NDcgNy45NDZ6TTIwOC4yNSAzLjk1aC0xNi45NzRsLTguMDEgNy45NDdoMjQuOTg0ek0xNjMuNjIyIDMxLjYwNWw0LjA2OS00LjA2OWgxMy43MzJ2Ny45NDdoLTE3LjgwMXoiLz48cGF0aCBmaWxsPSIjOWI5YjliIiBkPSJNMTY2LjYxIDE5Ljc4aDguNzczbDguMDEtNy45NDZIMTY2LjYxek0xNTcuMDExIDMxLjYwNWg2LjYxMWw3Ljg4My03Ljk0N2gtMTQuNDk0ek0xOTEuMjc2IDMuOTVsLTQuMDY4IDQuMDdIMTYxLjI3Vi4wNzJoMzAuMDA2ek0yMC44NCAzMC4yMDZIOC4zNzhsLTIuMTYyIDUuMzRILjc1TDEyLjI1NyA4LjU5Mmg0Ljc2OEwyOC41MyAzNS41NDZoLTUuNTN6bS0xLjcxNy00LjI2TDE0LjYwOSAxNC45NWwtNC41MTQgMTAuOTk4ek0xMDQuNDM3IDE4LjUwOWMxLjU4OS0yLjM1MiA1LjU5NC0yLjYwNyA3LjI0Ny0yLjYwN3Y0LjU3OGMtMi4wMzQgMC00LjA2OS4wNjMtNS4yNzcuOTUzLTEuMjA3Ljg5LTEuODQzIDIuMDk4LTEuODQzIDMuNTZ2MTAuNTUzaC00Ljk1OVYxNS45MDJoNC43Njh6TTExOS4zNzYgMTUuOTAyaC00Ljk1OHYxOS42NDRoNC45NTh6TTExOS4zNzYgNy4xM2gtNC45NTh2NS44NDhoNC45NTh6TTE0My45NzkgNy4xM3YyOC40MTZoLTQuNzY4bC0uMTI3LTIuOTg4YTguMyA4LjMgMCAwIDEtMi42NyAyLjQ4Yy0xLjA4MS41NzItMi40MTYuODktMy45NDIuODktMS4zMzUgMC0yLjYwNi0uMjU1LTMuNjg3LS43LTEuMTQ0LS41MDgtMi4xNjItMS4xNDQtMi45ODgtMi4wMzRhOS42IDkuNiAwIDAgMS0xLjk3MS0zLjE3OWMtLjUwOC0xLjIwNy0uNjk5LTIuNjA2LS42OTktNC4xMzJzLjI1NC0yLjkyNC42OTktNC4xOTZjLjUwOS0xLjI3MSAxLjE0NS0yLjM1MiAxLjk3MS0zLjI0MnMxLjg0NC0xLjU4OSAyLjk4OC0yLjA5OCAyLjM1Mi0uNzYzIDMuNjg3LS43NjNjMS41MjYgMCAyLjc5Ny4yNTUgMy44NzguODI3czEuOTcxIDEuMzM1IDIuNjcgMi40MTZWNy4xOTNoNC45NTl6bS0xMC40MjYgMjQuNTM4YzEuNjUzIDAgMi45MjQtLjU3MiAzLjk0MS0xLjY1M3MxLjUyNi0yLjU0MyAxLjUyNi00LjMyMy0uNTA5LTMuMTc4LTEuNTI2LTQuMzIyYy0xLjAxNy0xLjA4MS0yLjI4OC0xLjY1My0zLjk0MS0xLjY1My0xLjU5IDAtMi45MjUuNTcyLTMuODc4IDEuNjUzLTEuMDE3IDEuMDgtMS41MjYgMi41NDMtMS41MjYgNC4zMjIgMCAxLjc4LjUwOSAzLjE4IDEuNTI2IDQuMjYgMS4wMTcgMS4xNDQgMi4yODggMS43MTYgMy44NzggMS43MTZNNTcuMjAyIDIwLjM1M0g0NC45MzN2NC4yNTloNi45OTNjLS4xOSAyLjE2MS0xLjAxNyAzLjgxNC0yLjQxNiA1LjE1LTEuMzk4IDEuMjctMy4xNzggMS45MDYtNS40NjcgMS45MDYtMS4yNzEgMC0yLjQ4LS4yNTQtMy40OTYtLjY5OWE3IDcgMCAwIDEtMi43MzQtMS45N2MtLjc2My0uODI3LTEuMzM1LTEuODQ0LTEuNzgtMy4wNTJzLS42MzYtMi40OC0uNjM2LTMuOTQyLjE5LTIuNzMzLjYzNi0zLjk0MWMuMzgxLTEuMjA4IDEuMDE3LTIuMTYyIDEuNzgtMy4wNTIuNzYzLS44MjYgMS42NTMtMS40NjIgMi43MzMtMS45N2E5LjEgOS4xIDAgMCAxIDMuNTYtLjdxNC4wMDUgMCA2LjEwMyAxLjkwN2wzLjMwNi0zLjMwNWMtMi40OC0xLjkwNy01LjY1OC0yLjkyNS05LjQwOS0yLjkyNS0yLjA5NyAwLTQuMDA0LjMxOC01LjcyMSAxLjAxOC0xLjcxNi42OTktMy4xNzkgMS41ODktNC4zODYgMi43OTdBMTIuMSAxMi4xIDAgMCAwIDMxLjIgMTYuMjJjLS42MzUgMS43MTctLjk1MyAzLjYyNC0uOTUzIDUuNjU4cy4zMTggMy45NDIgMS4wMTcgNS42NThjLjcgMS43MTcgMS41OSAzLjE3OSAyLjc5NyA0LjM4N2ExMi4xIDEyLjEgMCAwIDAgNC4zODcgMi43OTdjMS43MTYuNyAzLjYyMyAxLjAxNyA1LjY1NyAxLjAxNyAyLjAzNSAwIDMuODc4LS4zMTggNS41MzEtMS4wMTcgMS42NTMtLjcgMy4wNTItMS41OSA0LjE5Ni0yLjc5N3ExLjcxNi0xLjgxMiAyLjY3LTQuMzg3Yy42MzYtMS43MTYuOTU0LTMuNjIzLjk1NC01LjY1OHYtLjgyNmMtLjE5MS0uMTI3LS4yNTUtLjQ0NS0uMjU1LS43TTk1Ljk4MiAyMC4zNTNoLTEyLjI3djQuMjU5aDYuOTkzYy0uMTkgMi4xNjEtMS4wMTcgMy44MTQtMi40MTYgNS4xNS0xLjM5OCAxLjI3LTMuMTc4IDEuOTA2LTUuNDY3IDEuOTA2LTEuMjcxIDAtMi40OC0uMjU0LTMuNDk2LS42OTlhNyA3IDAgMCAxLTIuNzM0LTEuOTdjLS43NjMtLjgyNy0xLjMzNS0xLjg0NC0xLjc4LTMuMDUycy0uNjM2LTIuNDgtLjYzNi0zLjk0Mi4xOS0yLjczMy42MzYtMy45NDFjLjM4MS0xLjIwOCAxLjAxNy0yLjE2MiAxLjc4LTMuMDUyLjc2My0uODI2IDEuNjUzLTEuNDYyIDIuNzM0LTEuOTdhOS4xIDkuMSAwIDAgMSAzLjU2LS43cTQuMDA1IDAgNi4xMDMgMS45MDdsMy4zMDUtMy4zMDVjLTIuNDc5LTEuOTA3LTUuNjU4LTIuOTI1LTkuNDA4LTIuOTI1LTIuMDk4IDAtNC4wMDUuMzE4LTUuNzIyIDEuMDE4LTEuNzE2LjY5OS0zLjE3OCAxLjU4OS00LjM4NiAyLjc5N2ExMi4xIDEyLjEgMCAwIDAtMi43OTcgNC4zODZjLS42MzYgMS43MTctLjk1NCAzLjYyNC0uOTU0IDUuNjU4cy4zMTggMy45NDIgMS4wMTcgNS42NThjLjcgMS43MTcgMS41OSAzLjE3OSAyLjc5NyA0LjM4N2ExMi4xIDEyLjEgMCAwIDAgNC4zODcgMi43OTdjMS43MTYuNyAzLjYyMyAxLjAxNyA1LjY1OCAxLjAxNyAyLjAzNCAwIDMuODc4LS4zMTggNS41My0xLjAxNyAxLjY1My0uNyAzLjA1Mi0xLjU5IDQuMTk2LTIuNzk3cTEuNzE4LTEuODEyIDIuNjctNC4zODdjLjYzNi0xLjcxNi45NTQtMy42MjMuOTU0LTUuNjU4di0uODI2Yy0uMTktLjEyNy0uMjU1LS40NDUtLjI1NS0uNyIvPjwvc3ZnPg==");background-repeat:no-repeat;background-size:170px 40px;content:"";display:block;height:40px;width:170px}}:where(.ag-ltr) .ag-watermark{right:25px}:where(.ag-rtl) .ag-watermark{left:25px}.ag-watermark-text{font-family:Impact,sans-serif;font-size:19px;font-weight:700;opacity:.5}:where(.ag-ltr) .ag-watermark-text{padding-left:.7rem}:where(.ag-rtl) .ag-watermark-text{padding-right:.7rem}'
), HL = {
  tag: "div",
  cls: "ag-watermark",
  children: [{ tag: "div", ref: "eLicenseTextRef", cls: "ag-watermark-text" }]
}, zL = class extends D {
  constructor() {
    super(HL), this.eLicenseTextRef = x, this.registerCSS(NL);
  }
  wireBeans(e) {
    this.licenseManager = e.licenseManager;
  }
  postConstruct() {
    const e = this.shouldDisplayWatermark();
    this.setDisplayed(e), e && (this.eLicenseTextRef.textContent = this.licenseManager.getWatermarkMessage(), window.setTimeout(() => this.addCss("ag-opacity-zero"), 0), window.setTimeout(() => this.setDisplayed(!1), 5e3));
  }
  shouldDisplayWatermark() {
    return this.licenseManager.isDisplayWatermark();
  }
}, WL = {
  selector: "AG-WATERMARK",
  component: zL
}, _L = class extends R {
  constructor() {
    super(...arguments), this.beanName = "licenseManager";
  }
  postConstruct() {
    this.validateLicense();
  }
  validateLicense() {
    this.licenseManager = new Wr(me(this.beans)), this.licenseManager.validateLicense();
  }
  static getLicenseDetails(e) {
    return new Wr(null).getLicenseDetails(e);
  }
  getWatermarkSelector() {
    return WL;
  }
  isDisplayWatermark() {
    return this.licenseManager.isDisplayWatermark();
  }
  getWatermarkMessage() {
    return this.licenseManager.getWatermarkMessage();
  }
  static setLicenseKey(e) {
    Wr.setLicenseKey(e);
  }
  static setChartsLicenseManager(e) {
    Wr.setChartsLicenseManager(e);
  }
}, UL = 9525, yu = {
  0: 1,
  "0.00": 2,
  "#,##0": 3,
  "#,##0.00": 4,
  "0%": 9,
  "0.00%": 10,
  "0.00E+00": 11,
  "# ?/?": 12,
  "# ??/??": 13,
  "mm-dd-yy": 14,
  "d-mmm-yy": 15,
  "d-mmm": 16,
  "mmm-yy": 17,
  "h:mm AM/PM": 18,
  "h:mm:ss AM/PM": 19,
  "h:mm": 20,
  "h:mm:ss": 21,
  "m/d/yy h:mm": 22,
  "#,##0 ;(#,##0)": 37,
  "#,##0 ;[Red](#,##0)": 38,
  "#,##0.00;(#,##0.00)": 39,
  "#,##0.00;[Red](#,##0.00)": 40,
  "mm:ss": 45,
  "[h]:mm:ss": 46,
  "mmss.0": 47,
  "##0.0E+0": 48,
  "@": 49
}, $n = `\r
`;
function Su(e, t, s) {
  return !t && t !== "" && t !== 0 ? "" : ` ${e}="${t}"`;
}
function $L(e = {}) {
  const t = "<?", s = "?>", i = ["version"];
  e.version || (e.version = "1.0"), e.encoding && i.push("encoding"), e.standalone && i.push("standalone");
  const r = i.map((n) => `${n}="${e[n]}"`).join(" ");
  return `${t}xml ${r} ${s}`;
}
function Zm(e, t) {
  let s = "";
  e.properties && (e.properties.prefixedAttributes && e.properties.prefixedAttributes.forEach((r) => {
    Object.keys(r.map).forEach((n) => {
      s += Su(
        r.prefix + n,
        r.map[n]
      );
    });
  }), e.properties.rawMap && Object.keys(e.properties.rawMap).forEach((r) => {
    s += Su(r, e.properties.rawMap[r]);
  }));
  let i = "<" + e.name + s;
  return !e.children && e.textNode == null ? i + "/>" + $n : e.textNode != null ? i + ">" + e.textNode + "</" + e.name + ">" + $n : (i += ">" + $n, e.children && e.children.forEach((r) => {
    i += Zm(r);
  }), i + "</" + e.name + ">" + $n);
}
var KL = (e) => Math.round(e * 96 / 72), Yi = (e) => Math.ceil(e * UL), jL = (e) => {
  if (e === void 0)
    return;
  const s = ["Automatic", "Roman", "Swiss", "Modern", "Script", "Decorative"].indexOf(e || "Automatic");
  return Math.max(s, 0);
}, uo = (e, t) => {
  if (!t)
    return;
  let s;
  return typeof t == "number" ? s = t : s = t({ rowIndex: e }), s;
}, YL = (e, t) => {
  const { colSpan: s, column: i } = e.position;
  if (e.width)
    if (s) {
      const r = t.slice(i - 1, i + s - 1);
      let n = 0;
      for (let o = 0; o < r.length; o++) {
        const a = r[o].getActualWidth();
        if (e.width < n + a) {
          e.position.colSpan = o + 1, e.totalWidth = e.width, e.width = e.totalWidth - n;
          break;
        }
        n += a;
      }
    } else
      e.totalWidth = e.width;
}, qL = (e, t) => {
  const { rowSpan: s, row: i } = e.position;
  if (e.height)
    if (s) {
      let r = 0, n = 0;
      for (let o = i; o < i + s; o++) {
        const a = KL(uo(o, t) || 20);
        if (e.height < r + a) {
          e.position.rowSpan = n + 1, e.totalHeight = e.height, e.height = e.totalHeight - r;
          break;
        }
        r += a, n++;
      }
    } else
      e.totalHeight = e.height;
}, rt = (e, t) => {
  const s = $L({
    encoding: "UTF-8",
    standalone: "yes"
  }), i = Zm(e);
  return t ? i : `${s}${i}`;
}, Li = (e) => {
  const i = String.fromCharCode, r = Math.floor(e / 26), n = e % 26;
  return !r || e === 26 ? i(65 + e - 1) : n ? r < 26 ? i(65 + r - 1) + i(65 + n - 1) : Li(r) + i(65 + n - 1) : Li(r - 1) + "Z";
}, XL = (e) => e.replaceAll(`
`, "_x000a_"), mc = (e) => {
  if (e == null)
    return null;
  let t = "";
  for (let s = 0; s < e.length; s++) {
    const i = e.charCodeAt(s);
    if (i >= 0 && i <= 31 && i !== 10) {
      const o = `_x${i.toString(16).toUpperCase().padStart(4, "0")}_`;
      t += o;
    } else
      t += e[s];
  }
  return t;
}, ZL = (e) => {
  const t = [];
  for (const s of e.keys()) {
    const i = s.toString(), r = {
      name: "t",
      textNode: bt(mc(i))
    };
    i.trim().length !== i.length && (r.properties = {
      rawMap: {
        "xml:space": "preserve"
      }
    }), t.push({
      name: "si",
      children: [r]
    });
  }
  return t;
}, QL = {
  getTemplate(e) {
    const { name: t, ContentType: s, Extension: i, PartName: r } = e;
    return {
      name: t,
      properties: {
        rawMap: {
          Extension: i,
          PartName: r,
          ContentType: s
        }
      }
    };
  }
}, JL = QL, Ea = (e) => e === "jpg" ? "jpeg" : e, ek = {
  getTemplate(e) {
    const t = new Array(e).fill(void 0).map((c, d) => ({
      name: "Override",
      ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
      PartName: `/xl/worksheets/sheet${d + 1}.xml`
    })), s = Gi.size, i = si.size, r = {};
    vr.forEach((c) => {
      r[Ea(c.type)] = !0;
    });
    const n = new Array(s).fill(void 0).map((c, d) => ({
      name: "Override",
      ContentType: "application/vnd.openxmlformats-officedocument.drawing+xml",
      PartName: `/xl/drawings/drawing${d + 1}.xml`
    })), o = [];
    Ts.forEach(({ name: c }) => {
      o.push({
        name: "Override",
        ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",
        PartName: `/xl/tables/${c}.xml`
      });
    });
    const a = Object.keys(r).map((c) => ({
      name: "Default",
      ContentType: `image/${c}`,
      Extension: c
    }));
    i && a.push({
      name: "Default",
      Extension: "vml",
      ContentType: "application/vnd.openxmlformats-officedocument.vmlDrawing"
    });
    const l = [
      ...a,
      {
        name: "Default",
        Extension: "rels",
        ContentType: "application/vnd.openxmlformats-package.relationships+xml"
      },
      {
        name: "Default",
        ContentType: "application/xml",
        Extension: "xml"
      },
      {
        name: "Override",
        ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
        PartName: "/xl/workbook.xml"
      },
      ...t,
      {
        name: "Override",
        ContentType: "application/vnd.openxmlformats-officedocument.theme+xml",
        PartName: "/xl/theme/theme1.xml"
      },
      {
        name: "Override",
        ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
        PartName: "/xl/styles.xml"
      },
      {
        name: "Override",
        ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
        PartName: "/xl/sharedStrings.xml"
      },
      ...n,
      ...o,
      {
        name: "Override",
        ContentType: "application/vnd.openxmlformats-package.core-properties+xml",
        PartName: "/docProps/core.xml"
      }
    ].map((c) => JL.getTemplate(c));
    return {
      name: "Types",
      properties: {
        rawMap: {
          xmlns: "http://schemas.openxmlformats.org/package/2006/content-types"
        }
      },
      children: l
    };
  }
}, tk = ek, sk = {
  getTemplate(e) {
    const s = (/* @__PURE__ */ new Date()).toJSON();
    return {
      name: "cp:coreProperties",
      properties: {
        prefixedAttributes: [
          {
            prefix: "xmlns:",
            map: {
              cp: "http://schemas.openxmlformats.org/package/2006/metadata/core-properties",
              dc: "http://purl.org/dc/elements/1.1/",
              dcterms: "http://purl.org/dc/terms/",
              dcmitype: "http://purl.org/dc/dcmitype/",
              xsi: "http://www.w3.org/2001/XMLSchema-instance"
            }
          }
        ]
      },
      children: [
        {
          name: "dc:creator",
          textNode: e
        },
        {
          name: "dc:title",
          textNode: "Workbook"
        },
        {
          name: "dcterms:created",
          properties: {
            rawMap: {
              "xsi:type": "dcterms:W3CDTF"
            }
          },
          textNode: s
        },
        {
          name: "dcterms:modified",
          properties: {
            rawMap: {
              "xsi:type": "dcterms:W3CDTF"
            }
          },
          textNode: s
        }
      ]
    };
  }
}, ik = sk, xu = (e, t) => ({
  name: `xdr:${e}`,
  children: [
    {
      name: "xdr:col",
      textNode: t.col.toString()
    },
    {
      name: "xdr:colOff",
      textNode: t.offsetX.toString()
    },
    {
      name: "xdr:row",
      textNode: t.row.toString()
    },
    {
      name: "xdr:rowOff",
      textNode: t.offsetY.toString()
    }
  ]
}), rk = (e) => {
  const t = [
    {
      name: "a:ext",
      properties: {
        rawMap: {
          uri: "{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}"
        }
      },
      children: [
        {
          name: "a16:creationId",
          properties: {
            rawMap: {
              id: "{822E6D20-D7BC-2841-A643-D49A6EF008A2}",
              "xmlns:a16": "http://schemas.microsoft.com/office/drawing/2014/main"
            }
          }
        }
      ]
    }
  ];
  switch (e.recolor && e.recolor.toLowerCase()) {
    case "grayscale":
    case "sepia":
    case "washout":
      t.push({
        name: "a:ext",
        properties: {
          rawMap: {
            uri: "{C183D7F6-B498-43B3-948B-1728B52AA6E4}"
          }
        },
        children: [
          {
            name: "adec:decorative",
            properties: {
              rawMap: {
                val: "0",
                "xmlns:adec": "http://schemas.microsoft.com/office/drawing/2017/decorative"
              }
            }
          }
        ]
      });
  }
  return {
    name: "a:extLst",
    children: t
  };
}, nk = (e, t) => ({
  name: "xdr:nvPicPr",
  children: [
    {
      name: "xdr:cNvPr",
      properties: {
        rawMap: {
          id: t,
          name: e.id,
          descr: e.altText != null ? e.altText : void 0
        }
      },
      children: [rk(e)]
    },
    {
      name: "xdr:cNvPicPr",
      properties: {
        rawMap: {
          preferRelativeResize: "0"
        }
      },
      children: [
        {
          name: "a:picLocks"
        }
      ]
    }
  ]
}), Fu = (e) => {
  if (!e.saturation && !e.tint)
    return;
  const t = [];
  return e.saturation && t.push({
    name: "a:satMod",
    properties: {
      rawMap: {
        val: e.saturation * 1e3
      }
    }
  }), e.tint && t.push({
    name: "a:tint",
    properties: {
      rawMap: {
        val: e.tint * 1e3
      }
    }
  }), t;
}, ok = (e, t) => ({
  name: "a:duotone",
  children: [
    {
      name: "a:prstClr",
      properties: {
        rawMap: {
          val: e.color
        }
      },
      children: Fu(e)
    },
    {
      name: "a:srgbClr",
      properties: {
        rawMap: {
          val: t.color
        }
      },
      children: Fu(t)
    }
  ]
}), ak = (e, t) => {
  let s;
  if (e.transparency) {
    const i = Math.min(Math.max(e.transparency, 0), 100);
    s = [
      {
        name: "a:alphaModFix",
        properties: {
          rawMap: {
            amt: 1e5 - Math.round(i * 1e3)
          }
        }
      }
    ];
  }
  if (e.recolor)
    switch (s || (s = []), e.recolor.toLocaleLowerCase()) {
      case "grayscale":
        s.push({ name: "a:grayscl" });
        break;
      case "sepia":
        s.push(ok({ color: "black" }, { color: "D9C3A5", tint: 50, saturation: 180 }));
        break;
      case "washout":
        s.push({
          name: "a:lum",
          properties: {
            rawMap: {
              bright: "70000",
              contrast: "-70000"
            }
          }
        });
        break;
    }
  return {
    name: "xdr:blipFill",
    children: [
      {
        name: "a:blip",
        properties: {
          rawMap: {
            cstate: "print",
            "r:embed": `rId${t}`,
            "xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
          }
        },
        children: s
      },
      {
        name: "a:stretch",
        children: [
          {
            name: "a:fillRect"
          }
        ]
      }
    ]
  };
}, lk = (e, t) => {
  const s = {
    name: "a:xfrm",
    children: [
      {
        name: "a:off",
        properties: {
          rawMap: {
            x: 0,
            y: 0
          }
        }
      },
      {
        name: "a:ext",
        properties: {
          rawMap: {
            cx: t.width,
            cy: t.height
          }
        }
      }
    ]
  };
  if (e.rotation) {
    const n = e.rotation;
    s.properties = {
      rawMap: {
        rot: Math.min(Math.max(n, 0), 360) * 6e4
      }
    };
  }
  return {
    name: "xdr:spPr",
    children: [s, {
      name: "a:prstGeom",
      properties: {
        rawMap: {
          prst: "rect"
        }
      },
      children: [{ name: "a:avLst" }]
    }]
  };
}, ck = (e) => {
  e.fitCell = !!e.fitCell || !e.width || !e.height;
  const { position: t = {}, fitCell: s, width: i = 0, height: r = 0, totalHeight: n, totalWidth: o } = e, { offsetX: a = 0, offsetY: l = 0, row: c = 1, rowSpan: d = 1, column: h = 1, colSpan: u = 1 } = t;
  return {
    from: {
      row: c - 1,
      col: h - 1,
      offsetX: Yi(a),
      offsetY: Yi(l)
    },
    to: {
      row: c - 1 + (s ? 1 : d - 1),
      col: h - 1 + (s ? 1 : u - 1),
      offsetX: Yi(i + a),
      offsetY: Yi(r + l)
    },
    height: Yi(n || r),
    width: Yi(o || i)
  };
}, dk = (e, t, s, i) => ({
  name: "xdr:pic",
  children: [
    nk(e, t + 1),
    ak(e, s + 1),
    lk(e, i)
  ]
}), hk = {
  getTemplate(e) {
    const { sheetIndex: t } = e, s = Gi.get(t), i = hn.get(t), r = s.map((n, o) => {
      const a = ck(n);
      return {
        name: "xdr:twoCellAnchor",
        properties: {
          rawMap: {
            editAs: "absolute"
          }
        },
        children: [
          xu("from", a.from),
          xu("to", a.to),
          dk(n, o, i.get(n.id).index, a),
          { name: "xdr:clientData" }
        ]
      };
    });
    return {
      name: "xdr:wsDr",
      properties: {
        rawMap: {
          "xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
          "xmlns:xdr": "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
        }
      },
      children: r
    };
  }
}, uk = hk, gk = {
  getTemplate(e) {
    const { Id: t, Type: s, Target: i } = e;
    return {
      name: "Relationship",
      properties: {
        rawMap: {
          Id: t,
          Type: s,
          Target: i
        }
      }
    };
  }
}, pk = gk, fk = {
  getTemplate(e) {
    const t = e.map((s) => pk.getTemplate(s));
    return {
      name: "Relationships",
      properties: {
        rawMap: {
          xmlns: "http://schemas.openxmlformats.org/package/2006/relationships"
        }
      },
      children: t
    };
  }
}, En = fk, mk = {
  getTemplate(e) {
    return {
      name: "sst",
      properties: {
        rawMap: {
          xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
          count: e.size,
          uniqueCount: e.size
        }
      },
      children: ZL(e)
    };
  }
}, Ck = mk, vk = (e) => {
  switch (e) {
    case 1:
      return "thin";
    case 2:
      return "medium";
    case 3:
      return "thick";
    default:
      return "hair";
  }
}, wk = {
  None: "None",
  Dot: "Dotted",
  Dash: "Dashed",
  Double: "Double",
  DashDot: "DashDot",
  DashDotDot: "DashDotDot",
  SlantDashDot: "SlantDashDot",
  Continuous: "Continuous"
}, bk = ["Dashed", "DashDot", "DashDotDot"], yk = {
  None: "none",
  Solid: "solid",
  Gray50: "mediumGray",
  Gray75: "darkGray",
  Gray25: "lightGray",
  HorzStripe: "darkHorizontal",
  VertStripe: "darkVertical",
  ReverseDiagStripe: "darkDown",
  DiagStripe: "darkUp",
  DiagCross: "darkGrid",
  ThickDiagCross: "darkTrellis",
  ThinHorzStripe: "lightHorizontal",
  ThinVertStripe: "lightVertical",
  ThinReverseDiagStripe: "lightDown",
  ThinDiagStripe: "lightUp",
  ThinHorzCross: "lightGrid",
  ThinDiagCross: "lightTrellis",
  Gray125: "gray125",
  Gray0625: "gray0625"
}, Sk = {
  Automatic: "general",
  Left: "left",
  Center: "center",
  Right: "right",
  Fill: "fill",
  Justify: "justify",
  CenterAcrossSelection: "centerContinuous",
  Distributed: "distributed",
  JustifyDistributed: "justify"
}, xk = {
  Automatic: void 0,
  Top: "top",
  Bottom: "bottom",
  Center: "center",
  Justify: "justify",
  Distributed: "distributed",
  JustifyDistributed: "justify"
}, Fk = (e) => e ? yk[e] || e : "none", js = (e) => e == null ? e : (e.charAt(0) === "#" && (e = e.substring(1)), e.length === 6 ? "FF" + e : e), Kn = (e, t) => {
  if (!e)
    return "thin";
  const s = vk(t);
  if (e === "Continuous")
    return s;
  const i = wk[e];
  return s === "medium" && bk.some((r) => r === i) ? `medium${i}` : `${i.charAt(0).toLowerCase()}${i.substring(1)}`;
}, Rk = (e) => Sk[e] || "general", Pk = (e) => xk[e] || void 0, Ar = (e) => ({
  name: "color",
  properties: {
    rawMap: {
      rgb: js(e || "#000000")
    }
  }
}), Ek = {
  getTemplate(e) {
    const { left: t, right: s, top: i, bottom: r, diagonal: n } = e, o = t ? [Ar(t.color)] : void 0, a = s ? [Ar(s.color)] : void 0, l = i ? [Ar(i.color)] : void 0, c = r ? [Ar(r.color)] : void 0, d = n ? [Ar(n.color)] : void 0;
    return {
      name: "border",
      children: [
        {
          name: "left",
          properties: { rawMap: { style: t && t.style } },
          children: o
        },
        {
          name: "right",
          properties: { rawMap: { style: s && s.style } },
          children: a
        },
        {
          name: "top",
          properties: { rawMap: { style: i && i.style } },
          children: l
        },
        {
          name: "bottom",
          properties: { rawMap: { style: r && r.style } },
          children: c
        },
        {
          name: "diagonal",
          properties: { rawMap: { style: n && n.style } },
          children: d
        }
      ]
    };
  }
}, Tk = Ek, Mk = {
  getTemplate(e) {
    return {
      name: "borders",
      properties: {
        rawMap: {
          count: e.length
        }
      },
      children: e.map((t) => Tk.getTemplate(t))
    };
  }
}, Dk = Mk, Ak = (e) => {
  const s = ["Context", "LeftToRight", "RightToLeft"].indexOf(e);
  return Math.max(s, 0);
}, Ik = {
  getTemplate(e) {
    const { horizontal: t, indent: s, readingOrder: i, rotate: r, shrinkToFit: n, vertical: o, wrapText: a } = e;
    return {
      name: "alignment",
      properties: {
        rawMap: {
          horizontal: t && Rk(t),
          indent: s,
          readingOrder: i && Ak(i),
          textRotation: r,
          shrinkToFit: n,
          vertical: o && Pk(o),
          wrapText: a
        }
      }
    };
  }
}, Lk = Ik, kk = {
  getTemplate(e) {
    const t = e.protected === !1 ? 0 : 1;
    return {
      name: "protection",
      properties: {
        rawMap: {
          hidden: e.hideFormula === !0 ? 1 : 0,
          locked: t
        }
      }
    };
  }
}, Gk = kk, Ok = {
  getTemplate(e) {
    const { alignment: t, borderId: s, fillId: i, fontId: r, numFmtId: n, protection: o, quotePrefix: a, xfId: l } = e, c = [];
    return t && c.push(Lk.getTemplate(t)), o && c.push(Gk.getTemplate(o)), {
      name: "xf",
      properties: {
        rawMap: {
          applyAlignment: t ? 1 : void 0,
          applyProtection: o ? 1 : void 0,
          applyBorder: s ? 1 : void 0,
          applyFill: i ? 1 : void 0,
          borderId: s,
          fillId: i,
          applyFont: r ? 1 : void 0,
          fontId: r,
          applyNumberFormat: n ? 1 : void 0,
          numFmtId: n,
          quotePrefix: a ? 1 : void 0,
          xfId: l
        }
      },
      children: c.length ? c : void 0
    };
  }
}, Qm = Ok, Vk = {
  getTemplate(e) {
    return {
      name: "cellStyleXfs",
      properties: {
        rawMap: {
          count: e.length
        }
      },
      children: e.map((t) => Qm.getTemplate(t))
    };
  }
}, Bk = Vk, Nk = {
  getTemplate(e) {
    const { builtinId: t, name: s, xfId: i } = e;
    return {
      name: "cellStyle",
      properties: {
        rawMap: {
          builtinId: t,
          name: s,
          xfId: i
        }
      }
    };
  }
}, Hk = Nk, zk = {
  getTemplate(e) {
    return {
      name: "cellStyles",
      properties: {
        rawMap: {
          count: e.length
        }
      },
      children: e.map((t) => Hk.getTemplate(t))
    };
  }
}, Wk = zk, _k = {
  getTemplate(e) {
    return {
      name: "cellXfs",
      properties: {
        rawMap: {
          count: e.length
        }
      },
      children: e.map((t) => Qm.getTemplate(t))
    };
  }
}, Uk = _k, $k = {
  getTemplate(e) {
    const { patternType: t, fgTheme: s, fgTint: i, fgRgb: r, bgRgb: n, bgIndexed: o } = e, a = {
      name: "patternFill",
      properties: {
        rawMap: {
          patternType: t
        }
      }
    };
    return (s || i || r) && (a.children = [
      {
        name: "fgColor",
        properties: {
          rawMap: {
            theme: s,
            tint: i,
            rgb: r
          }
        }
      }
    ]), (o || n) && (a.children || (a.children = []), a.children.push({
      name: "bgColor",
      properties: {
        rawMap: {
          indexed: o,
          rgb: n
        }
      }
    })), {
      name: "fill",
      children: [a]
    };
  }
}, Kk = $k, jk = {
  getTemplate(e) {
    return {
      name: "fills",
      properties: {
        rawMap: {
          count: e.length
        }
      },
      children: e.map((t) => Kk.getTemplate(t))
    };
  }
}, Yk = jk, qk = {
  getTemplate(e) {
    const {
      size: t,
      colorTheme: s,
      color: i = "FF000000",
      fontName: r = "Calibri",
      family: n,
      scheme: o,
      italic: a,
      bold: l,
      strikeThrough: c,
      outline: d,
      shadow: h,
      underline: u,
      verticalAlign: g
    } = e, p = [
      { name: "sz", properties: { rawMap: { val: t } } },
      { name: "color", properties: { rawMap: { theme: s, rgb: i } } },
      { name: "name", properties: { rawMap: { val: r } } }
    ];
    return n && p.push({ name: "family", properties: { rawMap: { val: n } } }), o && p.push({ name: "scheme", properties: { rawMap: { val: o } } }), a && p.push({ name: "i" }), l && p.push({ name: "b" }), c && p.push({ name: "strike" }), d && p.push({ name: "outline" }), h && p.push({ name: "shadow" }), u && p.push({ name: "u", properties: { rawMap: { val: u } } }), g && p.push({ name: "vertAlign", properties: { rawMap: { val: g } } }), { name: "font", children: p };
  }
}, Xk = qk, Zk = {
  getTemplate(e) {
    return {
      name: "fonts",
      properties: {
        rawMap: {
          count: e.length
        }
      },
      children: e.map((t) => Xk.getTemplate(t))
    };
  }
}, Qk = Zk;
function Jk(e) {
  const t = e.split(/(\[[^\]]*\])/);
  for (let s = 0; s < t.length; s++) {
    let i = t[s];
    i.length && (i.startsWith("[") || (i = i.replace(/\$/g, '"$"')), t[s] = bt(i));
  }
  return t.join("");
}
var eG = {
  getTemplate(e) {
    let { formatCode: t, numFmtId: s } = e;
    return t.length && (t = Jk(t)), {
      name: "numFmt",
      properties: {
        rawMap: {
          formatCode: t,
          numFmtId: s
        }
      }
    };
  }
}, tG = eG, sG = {
  getTemplate(e) {
    return {
      name: "numFmts",
      properties: {
        rawMap: {
          count: e.length
        }
      },
      children: e.map((t) => tG.getTemplate(t))
    };
  }
}, iG = sG, Uo, Ji, Xr, Zr, Qr, Jm, $o, eC, Cc, tC = (e, t) => (e.indexOf("mixedStyle") !== -1 && t > 1 && (e += `_${t}`), e), sC = () => {
  Uo = { base: 0 }, Ji = [], Xr = [{ fontName: "Calibri", colorTheme: "1", family: "2", scheme: "minor" }], Zr = [{ patternType: "none" }, { patternType: "gray125" }], Qr = [{ left: void 0, right: void 0, top: void 0, bottom: void 0, diagonal: void 0 }], Jm = [{ borderId: 0, fillId: 0, fontId: 0, numFmtId: 0 }], $o = [{ borderId: 0, fillId: 0, fontId: 0, numFmtId: 0, xfId: 0 }], eC = [{ builtinId: 0, name: "Normal", xfId: 0 }];
}, rG = (e) => {
  const t = Fk(e.pattern), s = js(e.color), i = js(e.patternColor);
  let r = Zr.findIndex((n) => {
    const { patternType: o, fgRgb: a, bgRgb: l } = n;
    return !(o != t || a != s || l != i);
  });
  return r === -1 && (r = Zr.length, Zr.push({
    patternType: t,
    fgRgb: s,
    bgRgb: i
  })), r;
}, nG = (e) => {
  if (yu[e])
    return yu[e];
  let t = Ji.findIndex((s) => s.formatCode === e);
  return t === -1 ? (t = Ji.length + 164, Ji.push({ formatCode: e, numFmtId: t })) : t = Ji[t].numFmtId, t;
}, oG = (e) => {
  const { borderBottom: t, borderTop: s, borderLeft: i, borderRight: r } = e;
  let n, o, a, l, c, d, h, u;
  i && (a = Kn(i.lineStyle, i.weight), h = js(i.color)), r && (l = Kn(r.lineStyle, r.weight), u = js(r.color)), t && (n = Kn(t.lineStyle, t.weight), c = js(t.color)), s && (o = Kn(s.lineStyle, s.weight), d = js(s.color));
  let g = Qr.findIndex((p) => {
    const { left: f, right: m, top: C, bottom: v } = p;
    if (!f && (a || h) || !m && (l || u) || !C && (o || d) || !v && (n || c))
      return !1;
    const { style: w, color: b } = f || {}, { style: y, color: P } = m || {}, { style: E, color: M } = C || {}, { style: T, color: G } = v || {};
    return !(w != a || b != h || y != l || P != u || E != o || M != d || T != n || G != c);
  });
  return g === -1 && (g = Qr.length, Qr.push({
    left: {
      style: a,
      color: h
    },
    right: {
      style: l,
      color: u
    },
    top: {
      style: o,
      color: d
    },
    bottom: {
      style: n,
      color: c
    },
    diagonal: {
      style: void 0,
      color: void 0
    }
  })), g;
}, aG = (e) => {
  const {
    fontName: t = "Calibri",
    color: s,
    size: i,
    bold: r,
    italic: n,
    outline: o,
    shadow: a,
    strikeThrough: l,
    underline: c,
    family: d,
    verticalAlign: h
  } = e, u = js(s), g = jL(d), p = c ? c.toLocaleLowerCase() : void 0, f = h ? h.toLocaleLowerCase() : void 0;
  let m = Xr.findIndex((C) => !(C.fontName != t || C.color != u || C.size != i || C.bold != r || C.italic != n || C.outline != o || C.shadow != a || C.strikeThrough != l || C.underline != p || C.verticalAlign != f || C.family != g));
  return m === -1 && (m = Xr.length, Xr.push({
    fontName: t,
    color: u,
    size: i,
    bold: r,
    italic: n,
    outline: o,
    shadow: a,
    strikeThrough: l,
    underline: p,
    verticalAlign: f,
    family: g != null ? g.toString() : void 0
  })), m;
}, lG = (e) => {
  const { alignment: t, borders: s, font: i, interior: r, numberFormat: n, protection: o, quotePrefix: a } = e;
  let { id: l } = e, c = 0, d = 0, h = 0, u = 0;
  l && (l = tC(l, Cc), Uo[l] == null && (r && (c = rG(r)), s && (d = oG(s)), i && (h = aG(i)), n && (u = nG(n.format)), Uo[l] = $o.length, $o.push({
    alignment: t,
    borderId: d || 0,
    fillId: c || 0,
    fontId: h || 0,
    numFmtId: u || 0,
    protection: o,
    quotePrefix: a,
    xfId: 0
  })));
}, cG = {
  getTemplate(e) {
    const t = iG.getTemplate(Ji), s = Qk.getTemplate(
      Xr.map((l) => ({ ...l, size: l.size != null ? l.size : e }))
    ), i = Yk.getTemplate(Zr), r = Dk.getTemplate(Qr), n = Bk.getTemplate(Jm), o = Uk.getTemplate($o), a = Wk.getTemplate(eC);
    return sC(), {
      name: "styleSheet",
      properties: {
        rawMap: {
          "mc:Ignorable": "x14ac x16r2 xr",
          xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
          "xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
          "xmlns:x14ac": "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac",
          "xmlns:x16r2": "http://schemas.microsoft.com/office/spreadsheetml/2015/02/main",
          "xmlns:xr": "http://schemas.microsoft.com/office/spreadsheetml/2014/revision"
        }
      },
      children: [
        t,
        s,
        i,
        r,
        n,
        o,
        a,
        {
          name: "tableStyles",
          properties: {
            rawMap: {
              count: 0,
              defaultPivotStyle: "PivotStyleLight16",
              defaultTableStyle: "TableStyleMedium2"
            }
          }
        }
      ]
    };
  }
}, dG = (e, t) => Uo[tC(e, t)] || 0, hG = (e, t) => {
  Cc = t, Cc === 1 && sC(), e.forEach(lG);
}, uG = cG, gG = {
  getTemplate(e, t) {
    const {
      name: s,
      columns: i,
      rowRange: r,
      displayName: n,
      showRowStripes: o,
      showColumnStripes: a,
      showFilterButtons: l,
      highlightFirstColumn: c,
      highlightLastColumn: d
    } = e || {}, h = !r || r[0] - r[1] === 0;
    if (!e || !s || !Array.isArray(i) || !i.length || h)
      return { name: "table" };
    const u = i.map((v, w) => ({
      name: "filterColumn",
      properties: {
        rawMap: {
          colId: w.toString(),
          // For filters, this should start with 0
          hiddenButton: l[w] ? 0 : 1
        }
      }
    })), g = `A${r[0]}`, p = `${Li(i.length)}${r[1]}`, f = `${g}:${p}`, m = `${t + 1}`, C = t ? `${n}_${m}` : n;
    return {
      name: "table",
      properties: {
        rawMap: {
          xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
          "xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
          "mc:Ignorable": "xr xr3",
          "xmlns:xr": "http://schemas.microsoft.com/office/spreadsheetml/2014/revision",
          "xmlns:xr3": "http://schemas.microsoft.com/office/spreadsheetml/2016/revision3",
          name: s,
          displayName: C,
          ref: f,
          totalsRowShown: 0,
          id: m
        }
      },
      children: [
        {
          name: "autoFilter",
          properties: {
            rawMap: {
              ref: f
            }
          },
          children: u
        },
        {
          name: "tableColumns",
          properties: {
            rawMap: {
              count: i.length
            }
          },
          children: i.map((v, w) => ({
            name: "tableColumn",
            properties: {
              rawMap: {
                id: (w + 1).toString(),
                name: bt(XL(v)),
                dataCellStyle: "Normal"
              }
            }
          }))
        },
        {
          name: "tableStyleInfo",
          properties: {
            rawMap: {
              name: "TableStyleLight1",
              showFirstColumn: c ? 1 : 0,
              showLastColumn: d ? 1 : 0,
              showRowStripes: o ? 1 : 0,
              showColumnStripes: a ? 1 : 0
            }
          }
        }
      ]
    };
  }
}, pG = gG, Rt = (e) => {
  const [t, s, i, r] = e;
  return {
    name: `a:${t}`,
    children: [
      {
        name: `a:${s}`,
        properties: {
          rawMap: {
            val: i,
            lastClr: r
          }
        }
      }
    ]
  };
}, fG = {
  getTemplate() {
    return {
      name: "a:clrScheme",
      properties: {
        rawMap: {
          name: "Office"
        }
      },
      children: [
        Rt(["dk1", "sysClr", "windowText", "000000"]),
        Rt(["lt1", "sysClr", "window", "FFFFFF"]),
        Rt(["dk2", "srgbClr", "44546A"]),
        Rt(["lt2", "srgbClr", "E7E6E6"]),
        Rt(["accent1", "srgbClr", "4472C4"]),
        Rt(["accent2", "srgbClr", "ED7D31"]),
        Rt(["accent3", "srgbClr", "A5A5A5"]),
        Rt(["accent4", "srgbClr", "FFC000"]),
        Rt(["accent5", "srgbClr", "5B9BD5"]),
        Rt(["accent6", "srgbClr", "70AD47"]),
        Rt(["hlink", "srgbClr", "0563C1"]),
        Rt(["folHlink", "srgbClr", "954F72"])
      ]
    };
  }
}, mG = fG, k = (e) => {
  const [t, s, i, r] = e;
  return {
    name: `a:${t}`,
    properties: {
      rawMap: {
        script: i,
        typeface: s,
        panose: r
      }
    }
  };
}, CG = {
  getTemplate() {
    return {
      name: "a:fontScheme",
      properties: {
        rawMap: {
          name: "Office"
        }
      },
      children: [
        {
          name: "a:majorFont",
          children: [
            k(["latin", "Calibri Light", void 0, "020F0302020204030204"]),
            k(["ea", ""]),
            k(["cs", ""]),
            k(["font", "游ゴシック Light", "Jpan"]),
            k(["font", "맑은 고딕", "Hang"]),
            k(["font", "等线 Light", "Hans"]),
            k(["font", "新細明體", "Hant"]),
            k(["font", "Times New Roman", "Arab"]),
            k(["font", "Times New Roman", "Hebr"]),
            k(["font", "Tahoma", "Thai"]),
            k(["font", "Nyala", "Ethi"]),
            k(["font", "Vrinda", "Beng"]),
            k(["font", "Shruti", "Gujr"]),
            k(["font", "MoolBoran", "Khmr"]),
            k(["font", "Tunga", "Knda"]),
            k(["font", "Raavi", "Guru"]),
            k(["font", "Euphemia", "Cans"]),
            k(["font", "Plantagenet Cherokee", "Cher"]),
            k(["font", "Microsoft Yi Baiti", "Yiii"]),
            k(["font", "Microsoft Himalaya", "Tibt"]),
            k(["font", "MV Boli", "Thaa"]),
            k(["font", "Mangal", "Deva"]),
            k(["font", "Gautami", "Telu"]),
            k(["font", "Latha", "Taml"]),
            k(["font", "Estrangelo Edessa", "Syrc"]),
            k(["font", "Kalinga", "Orya"]),
            k(["font", "Kartika", "Mlym"]),
            k(["font", "DokChampa", "Laoo"]),
            k(["font", "Iskoola Pota", "Sinh"]),
            k(["font", "Mongolian Baiti", "Mong"]),
            k(["font", "Times New Roman", "Viet"]),
            k(["font", "Microsoft Uighur", "Uigh"]),
            k(["font", "Sylfaen", "Geor"]),
            k(["font", "Arial", "Armn"]),
            k(["font", "Leelawadee UI", "Bugi"]),
            k(["font", "Microsoft JhengHei", "Bopo"]),
            k(["font", "Javanese Text", "Java"]),
            k(["font", "Segoe UI", "Lisu"]),
            k(["font", "Myanmar Text", "Mymr"]),
            k(["font", "Ebrima", "Nkoo"]),
            k(["font", "Nirmala UI", "Olck"]),
            k(["font", "Ebrima", "Osma"]),
            k(["font", "Phagspa", "Phag"]),
            k(["font", "Estrangelo Edessa", "Syrn"]),
            k(["font", "Estrangelo Edessa", "Syrj"]),
            k(["font", "Estrangelo Edessa", "Syre"]),
            k(["font", "Nirmala UI", "Sora"]),
            k(["font", "Microsoft Tai Le", "Tale"]),
            k(["font", "Microsoft New Tai Lue", "Talu"]),
            k(["font", "Ebrima", "Tfng"])
          ]
        },
        {
          name: "a:minorFont",
          children: [
            k(["latin", "Calibri", void 0, "020F0502020204030204"]),
            k(["ea", ""]),
            k(["cs", ""]),
            k(["font", "游ゴシック", "Jpan"]),
            k(["font", "맑은 고딕", "Hang"]),
            k(["font", "等线", "Hans"]),
            k(["font", "新細明體", "Hant"]),
            k(["font", "Arial", "Arab"]),
            k(["font", "Arial", "Hebr"]),
            k(["font", "Tahoma", "Thai"]),
            k(["font", "Nyala", "Ethi"]),
            k(["font", "Vrinda", "Beng"]),
            k(["font", "Shruti", "Gujr"]),
            k(["font", "DaunPenh", "Khmr"]),
            k(["font", "Tunga", "Knda"]),
            k(["font", "Raavi", "Guru"]),
            k(["font", "Euphemia", "Cans"]),
            k(["font", "Plantagenet Cherokee", "Cher"]),
            k(["font", "Microsoft Yi Baiti", "Yiii"]),
            k(["font", "Microsoft Himalaya", "Tibt"]),
            k(["font", "MV Boli", "Thaa"]),
            k(["font", "Mangal", "Deva"]),
            k(["font", "Gautami", "Telu"]),
            k(["font", "Latha", "Taml"]),
            k(["font", "Estrangelo Edessa", "Syrc"]),
            k(["font", "Kalinga", "Orya"]),
            k(["font", "Kartika", "Mlym"]),
            k(["font", "DokChampa", "Laoo"]),
            k(["font", "Iskoola Pota", "Sinh"]),
            k(["font", "Mongolian Baiti", "Mong"]),
            k(["font", "Arial", "Viet"]),
            k(["font", "Microsoft Uighur", "Uigh"]),
            k(["font", "Sylfaen", "Geor"]),
            k(["font", "Arial", "Armn"]),
            k(["font", "Leelawadee UI", "Bugi"]),
            k(["font", "Microsoft JhengHei", "Bopo"]),
            k(["font", "Javanese Text", "Java"]),
            k(["font", "Segoe UI", "Lisu"]),
            k(["font", "Myanmar Text", "Mymr"]),
            k(["font", "Ebrima", "Nkoo"]),
            k(["font", "Nirmala UI", "Olck"]),
            k(["font", "Ebrima", "Osma"]),
            k(["font", "Phagspa", "Phag"]),
            k(["font", "Estrangelo Edessa", "Syrn"]),
            k(["font", "Estrangelo Edessa", "Syrj"]),
            k(["font", "Estrangelo Edessa", "Syre"]),
            k(["font", "Nirmala UI", "Sora"]),
            k(["font", "Microsoft Tai Le", "Tale"]),
            k(["font", "Microsoft New Tai Lue", "Talu"]),
            k(["font", "Ebrima", "Tfng"])
          ]
        }
      ]
    };
  }
}, vG = CG, Xt = (e, t, s) => ({
  name: `a:${e}`,
  properties: {
    rawMap: {
      val: t
    }
  },
  children: s
}), vl = (e) => {
  const [t, s, i, r, n, o] = e, a = [];
  return a.push(Xt("satMod", i)), r && a.push(Xt("lumMod", r)), n && a.push(Xt("tint", n)), o && a.push(Xt("shade", o)), {
    name: "a:gs",
    properties: {
      rawMap: {
        pos: t
      }
    },
    children: [
      {
        name: "a:schemeClr",
        properties: {
          rawMap: {
            val: s
          }
        },
        children: a
      }
    ]
  };
}, Ko = (e, t) => ({
  name: "a:solidFill",
  children: [Xt("schemeClr", e, t)]
}), vc = (e) => {
  const [t, s, i, r, n] = e, [o, a] = n;
  return {
    name: "a:gradFill",
    properties: {
      rawMap: {
        rotWithShape: t
      }
    },
    children: [
      {
        name: "a:gsLst",
        children: [vl(s), vl(i), vl(r)]
      },
      {
        name: "a:lin",
        properties: {
          rawMap: {
            ang: o,
            scaled: a
          }
        }
      }
    ]
  };
}, wl = (e) => {
  const [t, s, i, r] = e;
  return {
    name: "a:ln",
    properties: {
      rawMap: { w: t, cap: s, cmpd: i, algn: r }
    },
    children: [
      Ko("phClr"),
      Xt("prstDash", "solid"),
      {
        name: "a:miter",
        properties: {
          rawMap: {
            lim: "800000"
          }
        }
      }
    ]
  };
}, bl = (e) => {
  const t = [];
  if (e) {
    const [s, i, r, n, o] = e;
    t.push({
      name: "a:outerShdw",
      properties: {
        rawMap: { blurRad: s, dist: i, dir: r, algn: n, rotWithShape: o }
      },
      children: [Xt("srgbClr", "000000", [Xt("alpha", "63000")])]
    });
  }
  return {
    name: "a:effectStyle",
    children: [
      Object.assign(
        {},
        {
          name: "a:effectLst"
        },
        t.length ? { children: t } : {}
      )
    ]
  };
}, wG = () => ({
  name: "a:fillStyleLst",
  children: [
    Ko("phClr"),
    vc([
      "1",
      ["0", "phClr", "105000", "110000", "67000"],
      ["50000", "phClr", "103000", "105000", "73000"],
      ["100000", "phClr", "109000", "105000", "81000"],
      ["5400000", "0"]
    ]),
    vc([
      "1",
      ["0", "phClr", "103000", "102000", "94000"],
      ["50000", "phClr", "110000", "100000", void 0, "100000"],
      ["100000", "phClr", "120000", "99000", void 0, "78000"],
      ["5400000", "0"]
    ])
  ]
}), bG = () => ({
  name: "a:lnStyleLst",
  children: [
    wl(["6350", "flat", "sng", "ctr"]),
    wl(["12700", "flat", "sng", "ctr"]),
    wl(["19050", "flat", "sng", "ctr"])
  ]
}), yG = () => ({
  name: "a:effectStyleLst",
  children: [bl(), bl(), bl(["57150", "19050", "5400000", "ctr", "0"])]
}), SG = () => ({
  name: "a:bgFillStyleLst",
  children: [
    Ko("phClr"),
    Ko("phClr", [Xt("tint", "95000"), Xt("satMod", "170000")]),
    vc([
      "1",
      ["0", "phClr", "150000", "102000", "93000", "98000"],
      ["50000", "phClr", "130000", "103000", "98000", "90000"],
      ["100000", "phClr", "120000", void 0, void 0, "63000"],
      ["5400000", "0"]
    ])
  ]
}), xG = {
  getTemplate() {
    return {
      name: "a:fmtScheme",
      properties: {
        rawMap: {
          name: "Office"
        }
      },
      children: [wG(), bG(), yG(), SG()]
    };
  }
}, FG = xG, RG = {
  getTemplate() {
    return {
      name: "a:themeElements",
      children: [mG.getTemplate(), vG.getTemplate(), FG.getTemplate()]
    };
  }
}, PG = RG, EG = {
  getTemplate() {
    return {
      name: "a:theme",
      properties: {
        prefixedAttributes: [
          {
            prefix: "xmlns:",
            map: {
              a: "http://schemas.openxmlformats.org/drawingml/2006/main"
            }
          }
        ],
        rawMap: {
          name: "Office Theme"
        }
      },
      children: [
        PG.getTemplate(),
        {
          name: "a:objectDefaults"
        },
        {
          name: "a:extraClrSchemeLst"
        }
      ]
    };
  }
}, TG = EG, MG = () => ({
  name: "o:shapelayout",
  properties: {
    prefixedAttributes: [
      {
        prefix: "v:",
        map: {
          ext: "edit"
        }
      }
    ]
  },
  children: [
    {
      name: "o:idmap",
      properties: {
        prefixedAttributes: [
          {
            prefix: "v:",
            map: {
              ext: "edit"
            }
          }
        ],
        rawMap: {
          data: "1"
        }
      }
    }
  ]
}), DG = () => ({
  name: "v:stroke",
  properties: {
    rawMap: {
      joinstyle: "miter"
    }
  }
}), AG = (e) => ({
  name: "v:formulas",
  children: e.map((t) => ({
    name: "v:f",
    properties: {
      rawMap: {
        eqn: t
      }
    }
  }))
}), IG = () => ({
  name: "v:path",
  properties: {
    prefixedAttributes: [
      {
        prefix: "o:",
        map: {
          connecttype: "rect",
          extrusionok: "f"
        }
      }
    ],
    rawMap: {
      gradientshapeok: "t"
    }
  }
}), iC = (e) => {
  const { aspectratio: t, rotation: s } = e || {}, i = {};
  return t && (i.aspectratio = "t"), s && (i.rotation = "t"), {
    name: "o:lock",
    properties: {
      prefixedAttributes: [
        {
          prefix: "v:",
          map: {
            ext: "edit"
          }
        }
      ],
      rawMap: i
    }
  };
};
function LG(e, t, s, i, r) {
  return (e - t) / (s - t) * (r - i) + i;
}
var kG = (e, t) => {
  let s;
  const { recolor: i, brightness: r, contrast: n, id: o } = e;
  if (i && (s = {}, (i === "Washout" || i === "Grayscale") && (s.gain = "19661f", s.blacklevel = "22938f"), (i === "Black & White" || i === "Grayscale") && (s.grayscale = "t", i === "Black & White" && (s.bilevel = "t"))), !i || i === "Grayscale") {
    if (s || (s = {}), n != null && n !== 50) {
      let a = "1";
      n >= 0 && (n < 50 ? a = String(n / 50) : n < 100 ? a = String(50 / (100 - n)) : n === 100 && (a = "2147483647f")), s.gain = a;
    }
    r != null && r !== 50 && (s.blacklevel = LG(r, 0, 100, -0.5, 0.5).toString());
  }
  return {
    name: "v:imagedata",
    properties: {
      prefixedAttributes: [
        {
          prefix: "o:",
          map: {
            relid: `rId${t}`,
            title: o
          }
        }
      ],
      rawMap: s
    }
  };
}, GG = () => {
  const e = [
    "if lineDrawn pixelLineWidth 0",
    "sum @0 1 0",
    "sum 0 0 @1",
    "prod @2 1 2",
    "prod @3 21600 pixelWidth",
    "prod @3 21600 pixelHeight",
    "sum @0 0 1",
    "prod @6 1 2",
    "prod @7 21600 pixelWidth",
    "sum @8 21600 0",
    "prod @7 21600 pixelHeight",
    "sum @10 21600 0"
  ];
  return {
    name: "v:shapetype",
    properties: {
      prefixedAttributes: [
        {
          prefix: "o:",
          map: {
            spt: "75",
            preferrelative: "t"
          }
        }
      ],
      rawMap: {
        coordsize: "21600,21600",
        filled: "f",
        id: "_x0000_t75",
        path: "m@4@5l@4@11@9@11@9@5xe",
        stroked: "f"
      }
    },
    children: [DG(), AG(e), IG(), iC({ aspectratio: !0 })]
  };
}, Ru = (e) => Math.floor((e ?? 0) * 0.74999943307122), OG = (e, t) => {
  const { width: s = 0, height: i = 0, altText: r } = e, n = Ru(s), o = Ru(i);
  return {
    name: "v:shape",
    properties: {
      rawMap: {
        id: e.headerFooterPosition,
        "o:spid": "_x0000_s1025",
        style: `position: absolute; margin-left: 0; margin-top: 10in; margin-bottom: 0; margin-right: 0; width: ${n}pt; height: ${o}pt; z-index: ${t + 1}`,
        type: "#_x0000_t75",
        alt: r
      }
    },
    children: [kG(e, t + 1), iC({ rotation: !0 })]
  };
}, VG = {
  getTemplate(e) {
    const t = si.get(e.sheetIndex) || [], s = [
      MG(),
      GG(),
      ...t.map((i, r) => OG(i, r))
    ];
    return {
      name: "xml",
      properties: {
        prefixedAttributes: [
          {
            prefix: "xmlns:",
            map: {
              v: "urn:schemas-microsoft-com:vml",
              o: "urn:schemas-microsoft-com:office:office",
              x: "urn:schemas-microsoft-com:office:excel"
            }
          }
        ]
      },
      children: s
    };
  }
}, BG = VG, NG = {
  getTemplate(e, t) {
    const s = (t + 1).toString();
    return {
      name: "sheet",
      properties: {
        rawMap: {
          name: e,
          sheetId: s,
          "r:id": `rId${s}`
        }
      }
    };
  }
}, HG = NG, zG = {
  getTemplate(e) {
    return {
      name: "sheets",
      children: e.map((t, s) => HG.getTemplate(t, s))
    };
  }
}, WG = zG, _G = {
  getTemplate(e, t) {
    return {
      name: "workbook",
      properties: {
        prefixedAttributes: [
          {
            prefix: "xmlns:",
            map: {
              r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
            }
          }
        ],
        rawMap: {
          xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
        }
      },
      children: [
        {
          name: "bookViews",
          children: [
            {
              name: "workbookView",
              properties: {
                rawMap: {
                  activeTab: t
                }
              }
            }
          ]
        },
        WG.getTemplate(e)
      ]
    };
  }
}, UG = _G, $G = (e) => Math.ceil((e - 12) / 7 + 1), KG = {
  getTemplate(e) {
    const { min: t, max: s, outlineLevel: i, s: r, width: n, hidden: o, bestFit: a } = e;
    let l = 1, c = "0";
    return n > 1 && (l = $G(n), c = "1"), {
      name: "col",
      properties: {
        rawMap: {
          min: t,
          max: s,
          outlineLevel: i ?? void 0,
          width: l,
          style: r,
          hidden: o ? "1" : "0",
          bestFit: a ? "1" : "0",
          customWidth: c
        }
      }
    };
  }
}, jG = KG, YG = {
  getTemplate(e) {
    return {
      name: "mergeCell",
      properties: {
        rawMap: {
          ref: e
        }
      }
    };
  }
}, qG = YG, XG = (e) => {
  const t = e.charAt(0).toLowerCase();
  return t === "s" ? "inlineStr" : t;
}, ZG = {
  getTemplate(e, t, s) {
    const { ref: i, data: r, styleId: n } = e, { type: o, value: a } = r || { type: "empty", value: null };
    let l = o;
    o === "f" ? l = "str" : o.charAt(0) === o.charAt(0).toUpperCase() && (l = XG(o));
    const c = {
      name: "c",
      properties: {
        rawMap: {
          r: i,
          t: l === "empty" ? void 0 : l,
          s: n ? dG(n, s) : void 0
        }
      }
    };
    if (l === "empty")
      return c;
    let d;
    return l === "str" && o === "f" ? d = [
      {
        name: "f",
        textNode: bt(mc(a))
      }
    ] : l === "inlineStr" ? d = [
      {
        name: "is",
        children: [
          {
            name: "t",
            textNode: bt(mc(a))
          }
        ]
      }
    ] : d = [
      {
        name: "v",
        textNode: a
      }
    ], Object.assign({}, c, { children: d });
  }
}, QG = ZG, JG = (e, t) => {
  const s = [];
  let i = 0;
  for (let r = 0; r < e.length; r++) {
    const n = e[r];
    n.mergeAcross && (s.push({
      pos: r,
      excelPos: i
    }), i += n.mergeAcross), i++;
  }
  if (s.length)
    for (let r = s.length - 1; r >= 0; r--) {
      const n = [], o = e[s[r].pos];
      for (let a = 1; a <= o.mergeAcross; a++)
        n.push({
          ref: `${Li(s[r].excelPos + 1 + a)}${t + 1}`,
          styleId: o.styleId,
          data: { type: "empty", value: null }
        });
      n.length && e.splice(s[r].pos + 1, 0, ...n);
    }
}, eO = (e) => {
  var t;
  return ((t = e.data) == null ? void 0 : t.value) !== "" || e.styleId !== void 0;
}, tO = {
  getTemplate(e, t, s) {
    const { collapsed: i, hidden: r, height: n, outlineLevel: o, cells: a = [] } = e;
    JG(a, t);
    const l = a.filter(eO).map((c, d) => QG.getTemplate(c, d, s));
    return {
      name: "row",
      properties: {
        rawMap: {
          r: t + 1,
          collapsed: i ? "1" : "0",
          hidden: r ? "1" : "0",
          ht: n,
          customHeight: n != null ? "1" : "0",
          spans: "1:1",
          outlineLevel: o || void 0
        }
      },
      children: l
    };
  }
}, sO = tO, iO = (e, t, s) => {
  const i = [], r = [];
  e.forEach((a, l) => {
    const c = a.cells;
    let d = 0, h;
    c.forEach((u, g) => {
      const p = g + d + 1, f = Li(p), m = l + 1;
      if (u.mergeAcross) {
        d += u.mergeAcross;
        const v = Li(g + d + 1);
        i.push(`${f}${m}:${v}${m}`);
      }
      t[p - 1] || (t[p - 1] = {});
      const { collapsibleRanges: C } = u;
      C && C.forEach((v) => {
        r.push([p + v[0], p + v[1]]);
      }), h = t[p - 1], h.min = p, h.max = p, u.ref = `${f}${m}`;
    });
  }), r.sort((a, l) => a[0] !== l[0] ? a[0] - l[0] : l[1] - a[1]);
  const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
  return r.filter((a) => {
    const l = a.toString();
    return n.get(l) ? !1 : (n.set(l, !0), !0);
  }).forEach((a) => {
    const l = t.find((d) => d.min == a[0] && d.max == a[1]), c = o.get(a[0]);
    t.push({
      min: a[0],
      max: a[1],
      outlineLevel: s ? void 0 : c || 1,
      width: (l || { width: 100 }).width
    }), o.set(a[0], (c || 0) + 1);
  }), i;
}, rO = (e) => !e || e !== "Portrait" && e !== "Landscape" ? "portrait" : e.toLocaleLowerCase(), nO = (e) => {
  if (e == null)
    return 1;
  const s = [
    "Letter",
    "Letter Small",
    "Tabloid",
    "Ledger",
    "Legal",
    "Statement",
    "Executive",
    "A3",
    "A4",
    "A4 Small",
    "A5",
    "A6",
    "B4",
    "B5",
    "Folio",
    "Envelope",
    "Envelope DL",
    "Envelope C5",
    "Envelope B5",
    "Envelope C3",
    "Envelope C4",
    "Envelope C6",
    "Envelope Monarch",
    "Japanese Postcard",
    "Japanese Double Postcard"
  ].indexOf(e);
  return s === -1 ? 1 : s + 1;
}, oO = (e) => {
  const t = {
    "&[Page]": "&P",
    "&[Pages]": "&N",
    "&[Date]": "&D",
    "&[Time]": "&T",
    "&[Tab]": "&A",
    "&[Path]": "&Z",
    "&[File]": "&F",
    "&[Picture]": "&G"
  };
  for (const s of Object.keys(t))
    e = e.replace(s, t[s]);
  return e;
}, aO = (e) => e === "Center" ? "C" : e === "Right" ? "R" : "L", lO = (e, t) => (t && (e += "&amp;&quot;", e += t.fontName || "Calibri", t.bold !== t.italic ? e += t.bold ? ",Bold" : ",Italic" : t.bold ? e += ",Bold Italic" : e += ",Regular", e += "&quot;", t.size && (e += `&amp;${t.size}`), t.strikeThrough && (e += "&amp;S"), t.underline && (e += `&amp;${t.underline === "Double" ? "E" : "U"}`), t.color && (e += `&amp;K${t.color.replace("#", "").toUpperCase()}`)), e), cO = (e, t, s) => e.reduce((i, r, n) => {
  const o = aO(r.position), a = lO(`${i}&amp;${o}`, r.font), l = ["Left", "Center", "Right"];
  r.position || (r.position = l[n]);
  const { image: c } = r;
  if (r.value === "&[Picture]" && c) {
    const d = `${o}${t}${s}`;
    LO(c, d);
  }
  return `${a}${bt(oO(r.value))}`;
}, ""), dO = (e) => {
  const t = ["all", "first", "even"], s = [];
  return t.forEach((i) => {
    const r = e[i], n = i === "all" ? "odd" : i;
    if (r)
      for (const o of Object.keys(r)) {
        const a = r[o], l = `${o.charAt(0).toUpperCase()}${o.slice(1)}`, c = o[0].toUpperCase();
        if (a) {
          const d = i === "all" ? "" : i.toUpperCase();
          s.push({
            name: `${n}${l}`,
            properties: {
              rawMap: { "xml:space": "preserve" }
            },
            textNode: cO(a, c, d)
          });
        }
      }
  }), s;
}, hO = (e) => (t) => (e.length && t.children.push({
  name: "cols",
  children: e.map((s) => jG.getTemplate(s))
}), t), uO = (e, t) => (s) => (e.length && s.children.push({
  name: "sheetData",
  children: e.map((i, r) => sO.getTemplate(i, r, t))
}), s), gO = (e) => (t) => (e.length && t.children.push({
  name: "mergeCells",
  properties: {
    rawMap: {
      count: e.length
    }
  },
  children: e.map((s) => qG.getTemplate(s))
}), t), pO = (e) => (t) => {
  const { top: s = 0.75, right: i = 0.7, bottom: r = 0.75, left: n = 0.7, header: o = 0.3, footer: a = 0.3 } = e;
  return t.children.push({
    name: "pageMargins",
    properties: {
      rawMap: { bottom: r, footer: a, header: o, left: n, right: i, top: s }
    }
  }), t;
}, fO = (e) => (t) => (e && t.children.push({
  name: "pageSetup",
  properties: {
    rawMap: {
      horizontalDpi: 0,
      verticalDpi: 0,
      orientation: rO(e.orientation),
      paperSize: nO(e.pageSize)
    }
  }
}), t), mO = (e) => (t) => {
  if (!e)
    return t;
  const s = e.first != null ? 1 : 0, i = e.even != null ? 1 : 0;
  return t.children.push({
    name: "headerFooter",
    properties: {
      rawMap: {
        differentFirst: s,
        differentOddEven: i
      }
    },
    children: dO(e)
  }), t;
}, CO = (e) => (t) => (e && t.children.push({
  name: "tableParts",
  properties: {
    rawMap: {
      count: "1"
    }
  },
  children: [
    {
      name: "tablePart",
      properties: {
        rawMap: {
          "r:id": `rId${++t.rIdCounter}`
        }
      }
    }
  ]
}), t), vO = (e) => (t) => {
  const s = Gi.get(e);
  return s != null && s.length && t.children.push({
    name: "drawing",
    properties: {
      rawMap: {
        "r:id": `rId${++t.rIdCounter}`
      }
    }
  }), t;
}, wO = (e) => (t) => (si.get(e) && t.children.push({
  name: "legacyDrawingHF",
  properties: {
    rawMap: {
      "r:id": `rId${++t.rIdCounter}`
    }
  }
}), t), bO = (e = 0, t = 0) => {
  const s = e > 0 || t > 0;
  return s ? [
    {
      name: "pane",
      properties: {
        rawMap: {
          state: s ? "frozen" : void 0,
          topLeftCell: s ? `${Li(e + 1)}${t + 1}` : void 0,
          xSplit: e === 0 ? void 0 : e,
          ySplit: t === 0 ? void 0 : t
        }
      }
    }
  ] : void 0;
}, yO = (e = !1, t, s) => (i) => (i.children.push({
  name: "sheetViews",
  children: [
    {
      name: "sheetView",
      properties: {
        rawMap: {
          rightToLeft: e === !0 ? "1" : "0",
          workbookViewId: "0"
        }
      },
      children: bO(t, s)
    }
  ]
}), i), SO = () => (e) => (e.children.push({
  name: "sheetPr",
  children: [
    {
      name: "outlinePr",
      properties: {
        rawMap: {
          summaryBelow: 0
        }
      }
    }
  ]
}), e), xO = (e) => (t) => {
  const s = e.reduce((i, r) => r.outlineLevel && r.outlineLevel > i ? r.outlineLevel : i, 0);
  return t.children.push({
    name: "sheetFormatPr",
    properties: {
      rawMap: {
        baseColWidth: 10,
        defaultRowHeight: 16,
        outlineLevelRow: s || void 0
      }
    }
  }), t;
}, FO = {
  getTemplate(e) {
    const { worksheet: t, currentSheet: s, config: i } = e, {
      margins: r = {},
      pageSetup: n,
      headerFooterConfig: o,
      suppressColumnOutline: a,
      rightToLeft: l,
      frozenRowCount: c,
      frozenColumnCount: d
    } = i, { table: h } = t, { rows: u, columns: g } = h, p = g && g.length ? iO(u, g, !!a) : [], f = Ts.get(s), { children: m } = [
      SO(),
      yO(l, d, c),
      xO(u),
      hO(g),
      uO(u, s + 1),
      gO(p),
      pO(r),
      fO(n),
      mO(o),
      vO(s),
      wO(s),
      CO(f)
    ].reduce((C, v) => v(C), { children: [], rIdCounter: 0 });
    return {
      name: "worksheet",
      properties: {
        prefixedAttributes: [
          {
            prefix: "xmlns:",
            map: {
              r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
            }
          }
        ],
        rawMap: {
          xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
        }
      },
      children: m
    };
  }
}, RO = FO, di = /* @__PURE__ */ new Map(), Es = [], ki = /* @__PURE__ */ new Map(), Gi = /* @__PURE__ */ new Map(), si = /* @__PURE__ */ new Map(), vr = /* @__PURE__ */ new Map(), hn = /* @__PURE__ */ new Map(), Ts = /* @__PURE__ */ new Map(), PO = "AG-GRID-TABLE", Wd = "SINGLE_SHEET";
function EO() {
  return Wd;
}
function TO(e) {
  Wd = e;
}
function MO(e, t, s) {
  GO(t), hG(e, Es.length);
  const i = Object.assign({}, s);
  return s.exportAsExcelTable && s.colModel.isPivotActive() && (F(163, { featureName: "pivot mode" }), i.exportAsExcelTable = !1), IO(t, i), XO(t, i);
}
function DO(e) {
  return e.replace(/^[^a-zA-Z_]+/, "_").replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, "_");
}
function AO(e, t) {
  if (Ts.has(e)) {
    F(164);
    return;
  }
  Ts.set(e, t);
}
function IO(e, t) {
  const { exportAsExcelTable: s, prependContent: i, appendContent: r, colModel: n } = t;
  if (!s)
    return;
  const o = typeof s == "boolean" ? {} : s, {
    name: a,
    showColumnStripes: l,
    showRowStripes: c,
    showFilterButton: d,
    highlightFirstColumn: h,
    highlightLastColumn: u
  } = o, g = DO(a || PO), p = Es.length - 1, { table: f } = e, { rows: m, columns: C } = f, v = JS(n), w = i ? i.length : 0, b = r ? r.length : 0, y = m.length, P = C.length, E = [], M = [];
  for (let T = 0; T < P; T++) {
    const G = C[T];
    E.push(G.displayName || ""), M.push(
      d === "match" || d === void 0 ? G.filterAllowed ?? !1 : d
    );
  }
  if (!E || !E.length || !y || !g) {
    F(165);
    return;
  }
  AO(p, {
    name: `table${Ts.size + 1}`,
    displayName: g,
    columns: E,
    showFilterButtons: M,
    rowRange: [v + w, v + (y - v) - b],
    showRowStripes: c ?? !0,
    showColumnStripes: l ?? !1,
    highlightFirstColumn: h ?? !1,
    highlightLastColumn: u ?? !1
  });
}
function LO(e, t) {
  const s = Es.length - 1, i = e;
  i.headerFooterPosition = t, rC({ imageToAdd: i, idx: s });
  let r = si.get(s);
  r || (r = [], si.set(s, r)), r.find((n) => n.id === e.id) || r.push(e);
}
function kO(e, t, s, i, r) {
  const n = Es.length, { row: o, column: a } = e.position || {}, l = e;
  i && (t != null && s != null && (!o || !a) && (e.position || (e.position = {}), e.position = Object.assign({}, e.position, {
    row: t,
    column: i.indexOf(s) + 1
  })), YL(l, i), qL(l, r)), rC({ imageToAdd: l, idx: n });
  let c = hn.get(n);
  c || (c = /* @__PURE__ */ new Map(), hn.set(n, c));
  const d = Gi.get(n);
  d ? d.push(l) : Gi.set(n, [l]), c.get(e.id) || c.set(e.id, { index: c.size, type: e.imageType });
}
function rC(e) {
  const { imageToAdd: t, idx: s } = e, i = ki.get(t.id);
  if (i) {
    const r = i.find((n) => n.sheetId === s);
    r ? r.image.push(t) : i.push({
      sheetId: s,
      image: [t]
    });
  } else
    ki.set(t.id, [{ sheetId: s, image: [t] }]), vr.set(t.id, {
      type: t.imageType,
      index: vr.size
    });
}
function GO(e) {
  const t = bt(e.name) || "";
  let s = "";
  for (; Es.indexOf(`${t}${s}`) !== -1; )
    s === "" ? s = "_1" : s = `_${parseInt(s.slice(1), 10) + 1}`;
  e.name = `${t}${s}`, Es.push(e.name);
}
function Pu(e) {
  return di.has(e) ? di.get(e) : (di.set(e, di.size), di.size - 1);
}
function Eu() {
  di.clear(), ki.clear(), Gi.clear(), si.clear(), vr.clear(), hn.clear(), Ts.clear(), Es = [], Wd = "SINGLE_SHEET";
}
function OO(e) {
  return rt(UG.getTemplate(Es, e));
}
function VO(e) {
  return rt(uG.getTemplate(e));
}
function BO() {
  return rt(Ck.getTemplate(di));
}
function NO(e) {
  return rt(ik.getTemplate(e));
}
function HO(e) {
  return rt(tk.getTemplate(e));
}
function zO() {
  const e = En.getTemplate([
    {
      Id: "rId1",
      Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",
      Target: "xl/workbook.xml"
    },
    {
      Id: "rId2",
      Type: "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",
      Target: "docProps/core.xml"
    }
  ]);
  return rt(e);
}
function WO() {
  return rt(TG.getTemplate());
}
function _O(e, t) {
  return rt(pG.getTemplate(e, t));
}
function UO(e) {
  const t = new Array(e).fill(void 0).map((i, r) => ({
    Id: `rId${r + 1}`,
    Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",
    Target: `worksheets/sheet${r + 1}.xml`
  })), s = En.getTemplate([
    ...t,
    {
      Id: `rId${e + 1}`,
      Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",
      Target: "theme/theme1.xml"
    },
    {
      Id: `rId${e + 2}`,
      Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",
      Target: "styles.xml"
    },
    {
      Id: `rId${e + 3}`,
      Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",
      Target: "sharedStrings.xml"
    }
  ]);
  return rt(s);
}
function $O(e) {
  return rt(uk.getTemplate({ sheetIndex: e }));
}
function KO(e) {
  const t = hn.get(e) || [], s = [];
  for (const [i, r] of t) {
    const { index: n, type: o } = r;
    s.push({
      Id: `rId${n + 1}`,
      Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
      Target: `../media/image${vr.get(i).index + 1}.${Ea(o)}`
    });
  }
  return rt(En.getTemplate(s));
}
function jO(e) {
  return rt(BG.getTemplate({ sheetIndex: e }), !0);
}
function YO(e) {
  const t = si.get(e) || [], s = [];
  for (let i = 0; i < t.length; i++) {
    const r = t[i], n = vr.get(r.id);
    if (!n)
      continue;
    const { index: o, type: a } = n;
    s.push({
      Id: `rId${i + 1}`,
      Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
      Target: `../media/image${o + 1}.${Ea(a)}`
    });
  }
  return rt(En.getTemplate(s));
}
function qO({
  drawingIndex: e,
  vmlDrawingIndex: t,
  tableName: s
} = {}) {
  if (e === void 0 && t === void 0 && s === void 0)
    return "";
  const i = [];
  e != null && i.push({
    Id: `rId${i.length + 1}`,
    Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",
    Target: `../drawings/drawing${e + 1}.xml`
  }), t != null && i.push({
    Id: `rId${i.length + 1}`,
    Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",
    Target: `../drawings/vmlDrawing${t + 1}.vml`
  }), s != null && i.push({
    Id: `rId${i.length + 1}`,
    Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",
    Target: `../tables/${s}.xml`
  });
  const r = En.getTemplate(i);
  return rt(r);
}
function XO(e, t) {
  return rt(
    RO.getTemplate({
      worksheet: e,
      currentSheet: Es.length - 1,
      config: t
    })
  );
}
var ZO = class extends hm {
  constructor(e) {
    super(e), this.mixedStyles = {}, this.mixedStyleCounter = 0, this.rows = [], this.frozenRowCount = 0, this.skipFrozenRows = !1, this.frozenColumnCount = 0, this.skipFrozenColumns = !1, this.config = Object.assign({}, e), this.stylesByIds = {}, this.config.baseExcelStyles.forEach((t) => {
      this.stylesByIds[t.id] = t;
    }), this.excelStyles = [...this.config.baseExcelStyles, { id: "_quotePrefix", quotePrefix: 1 }];
  }
  addCustomContent(e) {
    e.forEach((t) => {
      const s = this.rows.length + 1;
      let i;
      !this.config.suppressRowOutline && t.outlineLevel != null && (i = t.outlineLevel);
      const r = {
        height: uo(s, t.height || this.config.rowHeight),
        cells: (t.cells || []).map((n, o) => {
          var u, g;
          const a = this.addImage(s, this.columnsToExport[o], (u = n.data) == null ? void 0 : u.value);
          let l = null;
          n.styleId && (l = typeof n.styleId == "string" ? [n.styleId] : n.styleId);
          const c = this.getStyleId(l);
          if (a)
            return this.createCell(
              c,
              this.getDataTypeForValue(a.value),
              a.value == null ? "" : a.value
            );
          const d = ((g = n.data) == null ? void 0 : g.value) ?? "", h = this.getDataTypeForValue(d);
          return n.mergeAcross ? this.createMergedCell(c, h, d, n.mergeAcross) : this.createCell(c, h, d);
        }),
        outlineLevel: i
      };
      t.collapsed != null && (r.collapsed = t.collapsed), t.hidden != null && (r.hidden = t.hidden), this.rows.push(r);
    });
  }
  onNewHeaderGroupingRow() {
    const e = [], { freezeRows: t, headerRowHeight: s } = this.config;
    return this.rows.push({
      cells: e,
      height: uo(this.rows.length + 1, s)
    }), t && this.frozenRowCount++, {
      onColumn: (i, r, n, o, a) => {
        const l = this.config.styleLinker({
          rowType: "HEADER_GROUPING",
          rowIndex: 1,
          value: `grouping-${r}`,
          columnGroup: i
        });
        e.push({
          ...this.createMergedCell(
            this.getStyleId(l),
            this.getDataTypeForValue("string"),
            r,
            o
          ),
          collapsibleRanges: a
        });
      }
    };
  }
  onNewHeaderRow() {
    const { freezeRows: e, headerRowHeight: t } = this.config;
    return e && this.frozenRowCount++, this.onNewRow(this.onNewHeaderColumn, t);
  }
  onNewBodyRow(e) {
    const { freezeRows: t, rowHeight: s } = this.config;
    this.skipFrozenRows || (t === "headersAndPinnedRows" && (e == null ? void 0 : e.rowPinned) === "top" ? this.frozenRowCount++ : typeof t == "function" ? t(V(this.gos, { node: e })) ? this.frozenRowCount++ : this.skipFrozenRows = !0 : this.skipFrozenRows = !0);
    const i = this.onNewRow(this.onNewBodyColumn, s);
    return e && this.addRowOutlineIfNecessary(e), i;
  }
  prepare(e) {
    super.prepare(e), this.columnsToExport = [...e], this.cols = e.map((t, s) => this.convertColumnToExcel(t, s));
  }
  parse() {
    const e = this.rows.reduce((r, n) => Math.max(r, n.cells.length), 0);
    for (; this.cols.length < e; )
      this.cols.push(this.convertColumnToExcel(null, this.cols.length + 1));
    const { config: t } = this;
    let s;
    if (t.sheetName != null) {
      const { sheetName: r } = t, n = typeof r == "function" ? r(V(this.gos, {})) : r;
      s = String(n).substring(0, 31);
    } else
      s = "ag-grid";
    const i = {
      name: s,
      table: {
        columns: this.cols,
        rows: this.rows
      }
    };
    return this.createExcel(i);
  }
  addRowOutlineIfNecessary(e) {
    const { gos: t, suppressRowOutline: s, rowGroupExpandState: i = "expanded" } = this.config;
    if (t.get("groupHideOpenParents") || s || e.level == null)
      return;
    const n = e.footer ? 1 : 0, o = _(this.rows);
    if (e.uiLevel == null || e.level === e.uiLevel) {
      const l = Math.min(e.level + n, 7);
      o.outlineLevel = l;
    }
    if (i === "expanded")
      return;
    const a = i === "collapsed";
    if (e.isExpandable()) {
      const l = !a && e.expanded;
      o.collapsed = !l;
    }
    o.hidden = // always show the node if there is no parent to be expanded
    !!e.parent && // or if it is a child of the root node
    e.parent.level !== -1 && (a || this.isAnyParentCollapsed(e.parent));
  }
  isAnyParentCollapsed(e) {
    for (; e && e.level !== -1; ) {
      if (!e.expanded)
        return !0;
      e = e.parent;
    }
    return !1;
  }
  convertColumnToExcel(e, t) {
    const s = this.config.columnWidth, r = (e ? this.extractHeaderValue(e) : void 0) ?? "", n = e ? e.isFilterAllowed() : !1;
    return s ? typeof s == "number" ? { width: s, displayName: r, filterAllowed: n } : { width: s({ column: e, index: t }), displayName: r, filterAllowed: n } : e ? { width: Math.max(e.getActualWidth(), 75), displayName: r, filterAllowed: n } : {
      displayName: r,
      filterAllowed: n
    };
  }
  onNewHeaderColumn(e, t) {
    return (s) => {
      const i = this.extractHeaderValue(s), r = this.config.styleLinker({
        rowType: "HEADER",
        rowIndex: e,
        value: i,
        column: s
      });
      t.push(
        this.createCell(this.getStyleId(r), this.getDataTypeForValue("string"), i)
      );
    };
  }
  onNewBodyColumn(e, t) {
    let s = 0;
    const { freezeColumns: i, rightToLeft: r } = this.config;
    return (n, o, a) => {
      if (s > 0) {
        s -= 1;
        return;
      }
      if (!this.skipFrozenColumns) {
        const p = n.getPinned();
        i === "pinned" && p && (p === !0 || p === "left") !== r ? this.frozenColumnCount++ : typeof i == "function" && i(V(this.gos, { column: n })) ? this.frozenColumnCount++ : this.skipFrozenColumns = !0;
      }
      const { value: l, valueFormatted: c } = this.extractRowCellValue(
        n,
        o,
        e,
        "excel",
        a
      ), d = this.config.styleLinker({
        rowType: "BODY",
        rowIndex: e,
        value: l,
        column: n,
        node: a
      }), h = this.getStyleId(d), u = n.getColSpan(a), g = this.addImage(e, n, l);
      g ? t.push(
        this.createCell(
          h,
          this.getDataTypeForValue(g.value),
          g.value == null ? "" : g.value
        )
      ) : u > 1 ? (s = u - 1, t.push(
        this.createMergedCell(
          h,
          this.getDataTypeForValue(l),
          l,
          u - 1
        )
      )) : t.push(
        this.createCell(h, this.getDataTypeForValue(l), l, c)
      );
    };
  }
  onNewRow(e, t) {
    const s = [];
    return this.rows.push({
      cells: s,
      height: uo(this.rows.length + 1, t)
    }), {
      onColumn: e.bind(this, this.rows.length, s)()
    };
  }
  createExcel(e) {
    const { excelStyles: t, config: s } = this;
    return this.frozenColumnCount && (s.frozenColumnCount = this.frozenColumnCount), this.frozenRowCount && (s.frozenRowCount = this.frozenRowCount), MO(t, e, s);
  }
  getDataTypeForValue(e) {
    if (e === void 0)
      return "empty";
    let t = "s";
    try {
      this.isNumerical(e) && (t = "n");
    } catch {
    }
    return t;
  }
  getTypeFromStyle(e, t) {
    if (this.isFormula(t))
      return "f";
    if (e && e.dataType)
      switch (e.dataType.toLocaleLowerCase()) {
        case "formula":
          return "f";
        case "string":
          return "s";
        case "number":
          return "n";
        case "datetime":
          return "d";
        case "error":
          return "e";
        case "boolean":
          return "b";
        default:
          F(162, { id: e.id, dataType: e.dataType });
      }
    return null;
  }
  addImage(e, t, s) {
    if (!this.config.addImageToCell)
      return;
    const i = this.config.addImageToCell(e, t, s);
    if (i)
      return kO(i.image, e, t, this.columnsToExport, this.config.rowHeight), i;
  }
  createCell(e, t, s, i) {
    const r = this.getStyleById(e);
    !(r != null && r.dataType) && t === "s" && i != null && (s = i);
    const n = this.getTypeFromStyle(r, s) || t, { value: o, escaped: a } = this.getCellValue(n, s), l = [];
    return r && l.push(e), a && l.push("_quotePrefix"), e = this.getStyleId(l) || void 0, {
      styleId: e,
      data: {
        type: n,
        value: o
      }
    };
  }
  createMergedCell(e, t, s, i) {
    const r = s ?? "";
    return {
      styleId: this.getStyleById(e) ? e : void 0,
      data: {
        type: t,
        value: t === "s" ? Pu(r).toString() : s
      },
      mergeAcross: i
    };
  }
  getCellValue(e, t) {
    let s = !1;
    if (t == null || e === "s" && t === "")
      return { value: "", escaped: !1 };
    if (e === "s")
      t && t[0] === "'" && (s = !0, t = t.slice(1)), t = Pu(t).toString();
    else if (e === "f")
      t = t.slice(1);
    else if (e === "n") {
      const i = Number(t);
      isNaN(i) ? t = "" : t !== "" && (t = i.toString());
    }
    return { value: t, escaped: s };
  }
  getStyleId(e) {
    if (!e || !e.length)
      return null;
    if (e.length === 1)
      return e[0];
    const t = e.join("-");
    return this.mixedStyles[t] || this.addNewMixedStyle(e), this.mixedStyles[t].excelID;
  }
  deepCloneObject(e) {
    return JSON.parse(JSON.stringify(e));
  }
  addNewMixedStyle(e) {
    this.mixedStyleCounter += 1;
    const t = `mixedStyle${this.mixedStyleCounter}`, s = {};
    for (const r of e)
      for (const n of this.excelStyles)
        n.id === r && Fe(s, this.deepCloneObject(n));
    s.id = t;
    const i = e.join("-");
    this.mixedStyles[i] = {
      excelID: t,
      key: i,
      result: s
    }, this.excelStyles.push(s), this.stylesByIds[t] = s;
  }
  isFormula(e) {
    return e == null ? !1 : this.config.autoConvertFormulas && e.toString().startsWith("=");
  }
  isNumerical(e) {
    return typeof e == "bigint" ? !0 : isFinite(e) && e !== "" && !isNaN(parseFloat(e));
  }
  getStyleById(e) {
    return e == null ? null : this.stylesByIds[e] || null;
  }
}, QO = async (e) => {
  let t = 0;
  const s = [], i = new WritableStream({
    write: (o) => {
      s.push(o), t += o.length;
    }
  }), r = new ReadableStream({
    start: (o) => {
      const a = new FileReader();
      a.onload = (l) => {
        var c;
        (c = l.target) != null && c.result && o.enqueue(l.target.result), o.close();
      }, a.readAsArrayBuffer(e);
    }
  }), n = new window.CompressionStream("deflate-raw");
  return await r.pipeThrough(n).pipeTo(i), {
    size: t,
    content: new Blob(s)
  };
}, JO = async (e) => {
  const t = new Blob([e]), { size: s, content: i } = await QO(t), r = new Uint8Array(await i.arrayBuffer());
  return {
    size: s,
    content: r
  };
}, e1 = (e) => {
  let t = e.getHours();
  return t <<= 6, t = t | e.getMinutes(), t <<= 5, t = t | e.getSeconds() / 2, t;
}, t1 = (e) => {
  let t = e.getFullYear() - 1980;
  return t <<= 4, t = t | e.getMonth() + 1, t <<= 5, t = t | e.getDate(), t;
};
function $e(e, t) {
  let s = "";
  for (let i = 0; i < t; i++)
    s += String.fromCharCode(e & 255), e >>>= 8;
  return s;
}
var Tu = (e) => {
  if (!e.length)
    return 0;
  let t = -1, s = 0, i = 0, r = 0;
  for (let n = 0; n < e.length; n++)
    s = e[n], i = (t ^ s) & 255, r = s1[i], t = t >>> 8 ^ r;
  return t ^ -1;
}, Mu = (e) => e.length ? Tu(typeof e == "string" ? new TextEncoder().encode(e) : e) : 0, s1 = /* @__PURE__ */ new Uint32Array([
  0,
  1996959894,
  3993919788,
  2567524794,
  124634137,
  1886057615,
  3915621685,
  2657392035,
  249268274,
  2044508324,
  3772115230,
  2547177864,
  162941995,
  2125561021,
  3887607047,
  2428444049,
  498536548,
  1789927666,
  4089016648,
  2227061214,
  450548861,
  1843258603,
  4107580753,
  2211677639,
  325883990,
  1684777152,
  4251122042,
  2321926636,
  335633487,
  1661365465,
  4195302755,
  2366115317,
  997073096,
  1281953886,
  3579855332,
  2724688242,
  1006888145,
  1258607687,
  3524101629,
  2768942443,
  901097722,
  1119000684,
  3686517206,
  2898065728,
  853044451,
  1172266101,
  3705015759,
  2882616665,
  651767980,
  1373503546,
  3369554304,
  3218104598,
  565507253,
  1454621731,
  3485111705,
  3099436303,
  671266974,
  1594198024,
  3322730930,
  2970347812,
  795835527,
  1483230225,
  3244367275,
  3060149565,
  1994146192,
  31158534,
  2563907772,
  4023717930,
  1907459465,
  112637215,
  2680153253,
  3904427059,
  2013776290,
  251722036,
  2517215374,
  3775830040,
  2137656763,
  141376813,
  2439277719,
  3865271297,
  1802195444,
  476864866,
  2238001368,
  4066508878,
  1812370925,
  453092731,
  2181625025,
  4111451223,
  1706088902,
  314042704,
  2344532202,
  4240017532,
  1658658271,
  366619977,
  2362670323,
  4224994405,
  1303535960,
  984961486,
  2747007092,
  3569037538,
  1256170817,
  1037604311,
  2765210733,
  3554079995,
  1131014506,
  879679996,
  2909243462,
  3663771856,
  1141124467,
  855842277,
  2852801631,
  3708648649,
  1342533948,
  654459306,
  3188396048,
  3373015174,
  1466479909,
  544179635,
  3110523913,
  3462522015,
  1591671054,
  702138776,
  2966460450,
  3352799412,
  1504918807,
  783551873,
  3082640443,
  3233442989,
  3988292384,
  2596254646,
  62317068,
  1957810842,
  3939845945,
  2647816111,
  81470997,
  1943803523,
  3814918930,
  2489596804,
  225274430,
  2053790376,
  3826175755,
  2466906013,
  167816743,
  2097651377,
  4027552580,
  2265490386,
  503444072,
  1762050814,
  4150417245,
  2154129355,
  426522225,
  1852507879,
  4275313526,
  2312317920,
  282753626,
  1742555852,
  4189708143,
  2394877945,
  397917763,
  1622183637,
  3604390888,
  2714866558,
  953729732,
  1340076626,
  3518719985,
  2797360999,
  1068828381,
  1219638859,
  3624741850,
  2936675148,
  906185462,
  1090812512,
  3747672003,
  2825379669,
  829329135,
  1181335161,
  3412177804,
  3160834842,
  628085408,
  1382605366,
  3423369109,
  3138078467,
  570562233,
  1426400815,
  3317316542,
  2998733608,
  733239954,
  1555261956,
  3268935591,
  3050360625,
  752459403,
  1541320221,
  2607071920,
  3965973030,
  1969922972,
  40735498,
  2617837225,
  3943577151,
  1913087877,
  83908371,
  2512341634,
  3803740692,
  2075208622,
  213261112,
  2463272603,
  3855990285,
  2094854071,
  198958881,
  2262029012,
  4057260610,
  1759359992,
  534414190,
  2176718541,
  4139329115,
  1873836001,
  414664567,
  2282248934,
  4279200368,
  1711684554,
  285281116,
  2405801727,
  4167216745,
  1634467795,
  376229701,
  2685067896,
  3608007406,
  1308918612,
  956543938,
  2808555105,
  3495958263,
  1231636301,
  1047427035,
  2932959818,
  3654703836,
  1088359270,
  936918e3,
  2847714899,
  3736837829,
  1202900863,
  817233897,
  3183342108,
  3401237130,
  1404277552,
  615818150,
  3134207493,
  3453421203,
  1423857449,
  601450431,
  3009837614,
  3294710456,
  1567103746,
  711928724,
  3020668471,
  3272380065,
  1510334235,
  755167117
]);
function i1(e) {
  const t = String.fromCharCode;
  function s(h) {
    const u = [];
    if (!h)
      return [];
    const g = h.length;
    let p = 0, f, m;
    for (; p < g; )
      f = h.charCodeAt(p++), f >= 55296 && f <= 56319 && p < g ? (m = h.charCodeAt(p++), (m & 64512) == 56320 ? u.push(((f & 1023) << 10) + (m & 1023) + 65536) : (u.push(f), p--)) : u.push(f);
    return u;
  }
  function i(h) {
    if (h >= 55296 && h <= 57343)
      throw Error(gt(255, { point: h }));
  }
  function r(h, u) {
    return t(h >> u & 63 | 128);
  }
  function n(h) {
    if (!(h & 4294967168))
      return t(h);
    let u = "";
    return h & 4294965248 ? h & 4294901760 ? h & 4292870144 || (u = t(h >> 18 & 7 | 240), u += r(h, 12), u += r(h, 6)) : (i(h), u = t(h >> 12 & 15 | 224), u += r(h, 6)) : u = t(h >> 6 & 31 | 192), u += t(h & 63 | 128), u;
  }
  const o = s(e), a = o.length;
  let l = -1, c, d = "";
  for (; ++l < a; )
    c = o[l], d += n(c);
  return d;
}
var nC = (e, t, s, i, r, n) => {
  const { content: o, path: a, created: l } = e, c = e1(l), d = t1(l), h = Mu(r), u = n !== void 0 ? n : i, g = i1(a), p = g !== a;
  let f = "";
  if (p) {
    const w = $e(1, 1) + $e(Mu(g), 4) + g;
    f = "up" + $e(w.length, 2) + w;
  }
  const m = "\0" + // version needed to extract
  (p ? "\0\b" : "\0\0") + // Language encoding flag (EFS) (12th bit turned on)
  $e(t ? 8 : 0, 2) + // As per ECMA-376 Part 2 specs
  $e(c, 2) + // last modified time
  $e(d, 2) + // last modified date
  $e(u ? h : 0, 4) + $e(n ?? i, 4) + // compressed size
  $e(i, 4) + // uncompressed size
  $e(g.length, 2) + // file name length
  $e(f.length, 2), C = "PK" + m + g + f, v = "PK\0" + m + // file header
  "\0\0\0\0\0\0" + (o ? "\0\0\0\0" : "\0\0\0") + // external file attributes
  $e(s, 4) + // relative offset of local header
  g + // file name
  f;
  return {
    localFileHeader: Uint8Array.from(C, (w) => w.charCodeAt(0)),
    centralDirectoryHeader: Uint8Array.from(v, (w) => w.charCodeAt(0))
  };
}, oC = (e) => {
  let t;
  if (typeof e == "string") {
    const s = atob(e.split(";base64,")[1]);
    t = Uint8Array.from(s, (i) => i.charCodeAt(0));
  } else
    t = e;
  return {
    size: t.length,
    content: t
  };
}, r1 = async (e, t) => {
  const { content: s } = e, { size: i, content: r } = s ? oC(s) : { size: 0, content: Uint8Array.from([]) };
  let n, o, a = !1;
  if (e.type === "file" && r && i > 0) {
    const d = await JO(r);
    n = d.content, o = d.size, a = !0;
  }
  return {
    ...nC(e, a, t, i, r, o),
    content: n || r,
    isCompressed: a
  };
}, n1 = (e, t) => {
  const { content: s } = e, { content: i } = s ? oC(s) : { content: Uint8Array.from([]) };
  return {
    ...nC(e, !1, t, i.length, i, void 0),
    content: i,
    isCompressed: !1
  };
}, o1 = (e, t, s) => {
  const i = "PK\0\0\0\0" + $e(e, 2) + // total number of entries in the central folder
  $e(e, 2) + // total number of entries in the central folder
  $e(t, 4) + // size of the central folder
  $e(s, 4) + // central folder start offset
  "\0\0";
  return Uint8Array.from(i, (r) => r.charCodeAt(0));
}, aC = class {
  constructor() {
    this.folders = [], this.files = [];
  }
  addFolders(e) {
    e.forEach(this.addFolder.bind(this));
  }
  addFolder(e) {
    this.folders.push({
      path: e,
      created: /* @__PURE__ */ new Date(),
      isBase64: !1,
      type: "folder"
    });
  }
  addFile(e, t, s = !1) {
    this.files.push({
      path: e,
      created: /* @__PURE__ */ new Date(),
      content: s ? t : new TextEncoder().encode(t),
      isBase64: s,
      type: "file"
    });
  }
  async getZipFile(e = "application/zip") {
    const t = await this.buildCompressedFileStream();
    return this.clearStream(), new Blob([t], { type: e });
  }
  getUncompressedZipFile(e = "application/zip") {
    const t = this.buildFileStream();
    return this.clearStream(), new Blob([t], { type: e });
  }
  clearStream() {
    this.folders = [], this.files = [];
  }
  packageFiles(e) {
    let t = 0, s = 0;
    for (const c of e) {
      const { localFileHeader: d, centralDirectoryHeader: h, content: u } = c;
      t += d.length + u.length, s += h.length;
    }
    const i = new Uint8Array(t), r = new Uint8Array(s);
    let n = 0, o = 0;
    for (const c of e) {
      const { localFileHeader: d, centralDirectoryHeader: h, content: u } = c;
      i.set(d, n), n += d.length, i.set(u, n), n += u.length, r.set(h, o), o += h.length;
    }
    const a = o1(e.length, s, t), l = new Uint8Array(i.length + r.length + a.length);
    return l.set(i), l.set(r, i.length), l.set(a, i.length + r.length), l;
  }
  async buildCompressedFileStream() {
    const e = [...this.folders, ...this.files], t = [];
    let s = 0;
    for (const i of e) {
      const r = await r1(i, s), { localFileHeader: n, content: o } = r;
      t.push(r), s += n.length + o.length;
    }
    return this.packageFiles(t);
  }
  buildFileStream() {
    const e = [...this.folders, ...this.files], t = [];
    let s = 0;
    for (const i of e) {
      const r = n1(i, s), { localFileHeader: n, content: o } = r;
      t.push(r), s += n.length + o.length;
    }
    return this.packageFiles(t);
  }
}, a1 = (e) => {
  if (e.addFolders(["_rels/", "docProps/", "xl/", "xl/theme/", "xl/_rels/", "xl/worksheets/"]), !ki.size)
    return;
  e.addFolders(["xl/worksheets/_rels", "xl/drawings/", "xl/drawings/_rels", "xl/media/"]);
  let t = 0;
  ki.forEach((s) => {
    const i = s[0].image[0], { base64: r, imageType: n } = i;
    e.addFile(`xl/media/image${++t}.${Ea(n)}`, r, !0);
  });
}, l1 = (e, t) => {
  let s = 0, i = 0;
  for (let r = 0; r < t.length; r++) {
    const n = t[r];
    e.addFile(`xl/worksheets/sheet${r + 1}.xml`, n, !1);
    const o = ki.size > 0 && Gi.has(r), a = Ts.size > 0 && Ts.get(r), l = ki.size && si.has(r);
    if (!o && !a && !l)
      continue;
    let c, d, h;
    o && (c1(e, r, s), d = s, s++), l && (d1(e, r, i), h = i, i++), a && (c = a.name);
    const u = `xl/worksheets/_rels/sheet${r + 1}.xml.rels`;
    e.addFile(
      u,
      qO({
        tableName: c,
        drawingIndex: d,
        vmlDrawingIndex: h
      })
    );
  }
}, c1 = (e, t, s) => {
  const i = "xl/drawings", r = `${i}/drawing${s + 1}.xml`, n = `${i}/_rels/drawing${s + 1}.xml.rels`;
  e.addFile(n, KO(t)), e.addFile(r, $O(t));
}, d1 = (e, t, s) => {
  const i = "xl/drawings", r = `${i}/vmlDrawing${s + 1}.vml`, n = `${i}/_rels/vmlDrawing${s + 1}.vml.rels`;
  e.addFile(r, jO(t)), e.addFile(n, YO(t));
}, h1 = (e) => {
  const t = Ts, s = Array.from(t.keys());
  for (let i = 0; i < s.length; i++) {
    const r = s[i], n = t.get(r);
    n && e.addFile(`xl/tables/${n.name}.xml`, _O(n, i));
  }
}, u1 = (e, t, s, i, r) => {
  e.addFile("xl/workbook.xml", OO(r)), e.addFile("xl/styles.xml", VO(t)), e.addFile("xl/sharedStrings.xml", BO()), e.addFile("xl/theme/theme1.xml", WO()), e.addFile("xl/_rels/workbook.xml.rels", UO(i)), e.addFile("docProps/core.xml", NO(s)), e.addFile("[Content_Types].xml", HO(i)), e.addFile("_rels/.rels", zO());
}, lC = (e, t, s = {}) => {
  if (!t || t.length === 0)
    return F(159), Eu(), !1;
  const { fontSize: i = 11, author: r = "AG Grid", activeTab: n = 0 } = s, o = t.length, a = Math.max(Math.min(n, o - 1), 0);
  return a1(e), h1(e), l1(e, t), u1(e, i, r, o, a), Eu(), !0;
}, cC = (e) => {
  const { data: t, fontSize: s, author: i, activeSheetIndex: r } = e, n = e.mimeType || "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", o = new aC();
  return lC(o, t, {
    author: i,
    fontSize: s,
    activeTab: r
  }) ? o.getZipFile(n) : Promise.resolve(void 0);
}, Du = (e) => {
  const { data: t, fontSize: s, author: i, activeSheetIndex: r } = e, n = e.mimeType || "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", o = new aC();
  if (lC(o, t, {
    author: i,
    fontSize: s,
    activeTab: r
  }))
    return o.getUncompressedZipFile(n);
}, g1 = (e) => {
  const { fileName: t = "export.xlsx" } = e;
  cC(e).then((s) => {
    if (s) {
      const i = typeof t == "function" ? t() : t;
      Ad(i, s);
    }
  });
}, p1 = class extends dm {
  constructor() {
    super(...arguments), this.beanName = "excelCreator";
  }
  getMergedParams(e) {
    const t = this.gos.get("defaultExcelExportParams");
    return Object.assign({}, t, e);
  }
  export(e) {
    if (this.isExportSuppressed()) {
      F(160);
      return;
    }
    const t = this.getMergedParams(e), i = {
      data: [this.getData(t)],
      fontSize: t.fontSize,
      author: t.author,
      mimeType: t.mimeType
    };
    this.packageCompressedFile(i).then((r) => {
      if (r) {
        const { fileName: n } = t, o = typeof n == "function" ? n(V(this.gos, {})) : n;
        Ad(this.getFileName(o), r);
      }
    });
  }
  exportDataAsExcel(e) {
    this.export(e);
  }
  getDataAsExcel(e) {
    const t = this.getMergedParams(e), i = {
      data: [this.getData(t)],
      fontSize: t.fontSize,
      author: t.author,
      mimeType: t.mimeType
    };
    return this.packageFile(i);
  }
  setFactoryMode(e) {
    TO(e);
  }
  getFactoryMode() {
    return EO();
  }
  getSheetDataForExcel(e) {
    const t = this.getMergedParams(e);
    return this.getData(t);
  }
  getMultipleSheetsAsExcel(e) {
    return Du(e);
  }
  exportMultipleSheetsAsExcel(e) {
    g1(e);
  }
  getDefaultFileExtension() {
    return "xlsx";
  }
  createSerializingSession(e) {
    const { colModel: t, colNames: s, rowGroupColsSvc: i, valueSvc: r, gos: n } = this.beans, o = {
      ...e,
      colModel: t,
      colNames: s,
      rowGroupColsSvc: i,
      valueSvc: r,
      gos: n,
      suppressRowOutline: e.suppressRowOutline || e.skipRowGroups,
      headerRowHeight: e.headerRowHeight || e.rowHeight,
      baseExcelStyles: n.get("excelStyles") || [],
      rightToLeft: e.rightToLeft ?? n.get("enableRtl"),
      styleLinker: this.styleLinker.bind(this)
    };
    return new ZO(o);
  }
  styleLinker(e) {
    const { rowType: t, rowIndex: s, value: i, column: r, columnGroup: n, node: o } = e, a = t === "HEADER", l = t === "HEADER_GROUPING", c = a ? r : n;
    let d = [];
    const { gos: h, cellStyles: u } = this.beans;
    if (a || l)
      return d.push("header"), l && d.push("headerGroup"), c && (d = d.concat(
        pd(
          c.getDefinition(),
          h,
          r || null,
          n || null
        )
      )), d;
    const g = h.get("excelStyles"), p = ["cell"];
    if (!g || !g.length)
      return p;
    const f = g.map((C) => C.id), m = r.getDefinition();
    return u == null || u.processAllCellClasses(
      m,
      V(h, {
        value: i,
        data: o.data,
        node: o,
        colDef: m,
        column: r,
        rowIndex: s
      }),
      (C) => {
        f.indexOf(C) > -1 && p.push(C);
      }
    ), p.sort((C, v) => f.indexOf(C) < f.indexOf(v) ? -1 : 1);
  }
  isExportSuppressed() {
    return this.gos.get("suppressExcelExport");
  }
  packageCompressedFile(e) {
    return cC(e);
  }
  packageFile(e) {
    return Du(e);
  }
}, Y = "34.2.0", ie = {
  moduleName: "EnterpriseCore",
  version: Y,
  beans: [_L],
  icons: {
    // accordion open (filter tool panel group, charts group)
    accordionOpen: "tree-open",
    // accordion closed (filter tool panel group, charts group)
    accordionClosed: "tree-closed",
    // accordion indeterminate - shown when some children are expanded and
    //     others are collapsed (filter tool panel group, charts group)
    accordionIndeterminate: "tree-indeterminate",
    // dialog title bar
    close: "cross",
    // X (remove) on column 'pill' after adding it to a drop zone list
    cancel: "cancel",
    // button in chart regular size window title bar (click to maximise)
    maximize: "maximize",
    // button in chart maximised window title bar (click to make regular size)
    minimize: "minimize",
    // drag handle used to pick up draggable columns
    columnDrag: "grip"
  },
  dependsOn: []
}, f1 = (
  /*css*/
  '.ag-advanced-filter-header{align-items:center;background-color:var(--ag-header-background-color);border-bottom:var(--ag-header-row-border);display:flex;position:relative}.ag-advanced-filter{align-items:center;display:flex;width:100%}.ag-advanced-filter-buttons{display:contents}.ag-advanced-filter-header-cell{height:100%;padding-left:var(--ag-cell-horizontal-padding);padding-right:var(--ag-cell-horizontal-padding)}.ag-advanced-filter-apply-button,.ag-advanced-filter-builder-button{align-items:center;background-color:unset;border:0;display:flex;font-size:var(--ag-font-size);font-weight:600;line-height:normal;padding:var(--ag-spacing);white-space:nowrap;&:where(:not(:disabled)){cursor:pointer;&:hover{background-color:var(--ag-row-hover-color)}}}:where(.ag-ltr) .ag-advanced-filter-apply-button,:where(.ag-ltr) .ag-advanced-filter-builder-button{margin-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-advanced-filter-apply-button,:where(.ag-rtl) .ag-advanced-filter-builder-button{margin-right:calc(var(--ag-spacing)*2)}:where(.ag-ltr) .ag-advanced-filter-builder-button-label{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-advanced-filter-builder-button-label{margin-right:var(--ag-spacing)}.ag-advanced-filter-builder{display:flex;flex-direction:column;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.ag-advanced-filter-builder-list{flex:1;overflow:auto}.ag-advanced-filter-builder-button-panel{border-top:var(--ag-advanced-filter-builder-button-bar-border);display:flex;justify-content:flex-end;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding)}:where(.ag-ltr) .ag-advanced-filter-builder-apply-button,:where(.ag-ltr) .ag-advanced-filter-builder-cancel-button{margin-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-advanced-filter-builder-apply-button,:where(.ag-rtl) .ag-advanced-filter-builder-cancel-button{margin-right:calc(var(--ag-spacing)*2)}.ag-advanced-filter-builder-item-wrapper{align-items:center;display:flex;flex:1 1 auto;justify-content:space-between;overflow:hidden}:where(.ag-ltr) .ag-advanced-filter-builder-item-wrapper{padding-left:calc(var(--ag-icon-size)/2);padding-right:var(--ag-icon-size)}:where(.ag-rtl) .ag-advanced-filter-builder-item-wrapper{padding-left:var(--ag-icon-size);padding-right:calc(var(--ag-icon-size)/2)}:where(.ag-virtual-list-viewport .ag-advanced-filter-builder-item-wrapper) .ag-tab-guard{position:absolute}.ag-advanced-filter-builder-item-tree-lines>*{width:var(--ag-advanced-filter-builder-indent-size)}.ag-advanced-filter-builder-item-tree-line-root{width:var(--ag-icon-size);&:before{height:50%;top:50%}}.ag-advanced-filter-builder-item-tree-line-horizontal,.ag-advanced-filter-builder-item-tree-line-vertical,.ag-advanced-filter-builder-item-tree-line-vertical-bottom,.ag-advanced-filter-builder-item-tree-line-vertical-top{align-items:center;display:flex;height:100%;position:relative;&:after,&:before{content:"";height:100%;position:absolute}}.ag-advanced-filter-builder-item-tree-line-horizontal:after{border-bottom:var(--ag-border-width) solid var(--ag-border-color);height:50%;top:0;width:calc(var(--ag-advanced-filter-builder-indent-size) - var(--ag-icon-size))}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-horizontal:after{left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-horizontal:after{right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-tree-line-vertical:before{top:0;width:calc(var(--ag-advanced-filter-builder-indent-size) - var(--ag-icon-size)/2)}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-vertical:before{border-left:var(--ag-border-width) solid var(--ag-border-color);left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-vertical:before{border-right:var(--ag-border-width) solid var(--ag-border-color);right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-tree-line-vertical-top:before{height:50%;top:0;width:calc(var(--ag-advanced-filter-builder-indent-size) - var(--ag-icon-size)/2)}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-vertical-top:before{border-left:var(--ag-border-width) solid var(--ag-border-color);left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-vertical-top:before{border-right:var(--ag-border-width) solid var(--ag-border-color);right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-tree-line-vertical-bottom:before{height:calc(50% - var(--ag-icon-size)*1.5/2);top:calc(50% + var(--ag-icon-size)*1.5/2);width:calc(var(--ag-icon-size)/2)}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-vertical-bottom:before{border-left:var(--ag-border-width) solid var(--ag-border-color);left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-vertical-bottom:before{border-right:var(--ag-border-width) solid var(--ag-border-color);right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-condition{padding-bottom:var(--ag-spacing);padding-top:var(--ag-spacing)}.ag-advanced-filter-builder-item,.ag-advanced-filter-builder-item-buttons,.ag-advanced-filter-builder-item-condition,.ag-advanced-filter-builder-item-tree-lines,.ag-advanced-filter-builder-pill,.ag-advanced-filter-builder-pill-wrapper{align-items:center;display:flex;height:100%}.ag-advanced-filter-builder-pill-wrapper{margin:0 var(--ag-spacing)}.ag-advanced-filter-builder-pill{border-radius:var(--ag-border-radius);min-height:calc(100% - var(--ag-spacing)*3);min-width:calc(var(--ag-spacing)*2);padding:var(--ag-spacing) calc(var(--ag-spacing)*2);position:relative}:where(.ag-advanced-filter-builder-pill){.ag-advanced-filter-builder-value-number{font-family:monospace;font-weight:700}.ag-advanced-filter-builder-value-empty{color:var(--ag-subtle-text-color)}}:where(.ag-ltr) :where(.ag-advanced-filter-builder-pill){.ag-picker-field-display{margin-right:var(--ag-spacing)}}:where(.ag-rtl) :where(.ag-advanced-filter-builder-pill){.ag-picker-field-display{margin-left:var(--ag-spacing)}}.ag-advanced-filter-builder-pill-display{font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-advanced-filter-builder-join-pill{background-color:var(--ag-advanced-filter-builder-join-pill-color);cursor:pointer}.ag-advanced-filter-builder-column-pill{background-color:var(--ag-advanced-filter-builder-column-pill-color);cursor:pointer}.ag-advanced-filter-builder-option-pill{background-color:var(--ag-advanced-filter-builder-option-pill-color);cursor:pointer}.ag-advanced-filter-builder-value-pill{background-color:var(--ag-advanced-filter-builder-value-pill-color);cursor:text;max-width:140px;:where(.ag-advanced-filter-builder-pill-display){display:block}}.ag-advanced-filter-builder-item-buttons>*{margin:0 calc(var(--ag-spacing)*.5)}.ag-advanced-filter-builder-item-button{color:var(--ag-subtle-text-color);cursor:pointer;position:relative}.ag-advanced-filter-builder-item-button,.ag-advanced-filter-builder-pill{&:focus-visible{box-shadow:var(--ag-focus-shadow)}}.ag-advanced-filter-builder-item-button-disabled{cursor:default;opacity:.5}.ag-advanced-filter-builder-virtual-list-container{top:var(--ag-spacing)}.ag-advanced-filter-builder-virtual-list-item{cursor:default;display:flex;height:var(--ag-list-item-height);&:hover{background-color:var(--ag-row-hover-color);:where(.ag-advanced-filter-builder-item-button){opacity:1}}}.ag-advanced-filter-builder-invalid{color:var(--ag-subtle-text-color);cursor:default;margin:0 var(--ag-spacing)}:where(.ag-advanced-filter-builder-validation) .ag-advanced-filter-builder-invalid{color:var(--ag-invalid-color)}:where(.ag-advanced-filter-builder-virtual-list-item-highlight) .ag-advanced-filter-builder-item-button:focus-visible{opacity:1}'
);
function m1(e) {
  var t;
  return ((t = e.filterManager) == null ? void 0 : t.getAdvFilterModel()) ?? null;
}
function C1(e, t) {
  var s;
  (s = e.filterManager) == null || s.setAdvFilterModel(t);
}
function v1(e) {
  var t;
  (t = e.filterManager) == null || t.toggleAdvFilterBuilder(!0, "api");
}
function w1(e) {
  var t;
  (t = e.filterManager) == null || t.toggleAdvFilterBuilder(!1, "api");
}
var b1 = {
  ariaAdvancedFilterBuilderItem: (e) => `${e[0]}. Level ${e[1]}. Press ENTER to edit`,
  ariaAdvancedFilterBuilderItemValidation: (e) => `${e[0]}. Level ${e[1]}. ${e[2]} Press ENTER to edit`,
  ariaAdvancedFilterBuilderList: "Advanced Filter Builder List",
  ariaAdvancedFilterBuilderFilterItem: "Filter Condition",
  ariaAdvancedFilterBuilderGroupItem: "Filter Group",
  ariaAdvancedFilterBuilderColumn: "Column",
  ariaAdvancedFilterBuilderOption: "Option",
  ariaAdvancedFilterBuilderValue: "Value",
  ariaAdvancedFilterBuilderJoinOperator: "Join Operator",
  ariaAdvancedFilterInput: "Advanced Filter Input",
  ariaLabelAdvancedFilterAutocomplete: "Advanced Filter Autocomplete",
  advancedFilterContains: "contains",
  advancedFilterNotContains: "does not contain",
  advancedFilterTextEquals: "equals",
  advancedFilterTextNotEqual: "does not equal",
  advancedFilterStartsWith: "begins with",
  advancedFilterEndsWith: "ends with",
  advancedFilterBlank: "is blank",
  advancedFilterNotBlank: "is not blank",
  advancedFilterEquals: "=",
  advancedFilterNotEqual: "!=",
  advancedFilterGreaterThan: ">",
  advancedFilterGreaterThanOrEqual: ">=",
  advancedFilterLessThan: "<",
  advancedFilterLessThanOrEqual: "<=",
  advancedFilterTrue: "is true",
  advancedFilterFalse: "is false",
  advancedFilterAnd: "AND",
  advancedFilterOr: "OR",
  advancedFilterApply: "Apply",
  advancedFilterReset: "Reset",
  advancedFilterCancel: "Cancel",
  advancedFilterClear: "Clear",
  advancedFilterBuilder: "Builder",
  advancedFilterValidationMissingColumn: "Column is missing",
  advancedFilterValidationMissingOption: "Option is missing",
  advancedFilterValidationMissingValue: "Value is missing",
  advancedFilterValidationInvalidColumn: "Column not found",
  advancedFilterValidationInvalidOption: "Option not found",
  advancedFilterValidationMissingQuote: "Value is missing an end quote",
  advancedFilterValidationNotANumber: "Value is not a number",
  advancedFilterValidationInvalidDate: "Value is not a valid date",
  advancedFilterValidationMissingCondition: "Condition is missing",
  advancedFilterValidationJoinOperatorMismatch: "Join operators within a condition must be the same",
  advancedFilterValidationInvalidJoinOperator: "Join operator not found",
  advancedFilterValidationMissingEndBracket: "Missing end bracket",
  advancedFilterValidationExtraEndBracket: "Too many end brackets",
  advancedFilterValidationMessage: (e) => `Expression has an error. ${e[0]} - ${e[1]}.`,
  advancedFilterValidationMessageAtEnd: (e) => `Expression has an error. ${e[0]} at end of expression.`,
  advancedFilterBuilderTitle: "Advanced Filter",
  advancedFilterBuilderApply: "Apply",
  advancedFilterBuilderCancel: "Cancel",
  advancedFilterBuilderClear: "Clear",
  advancedFilterBuilderReset: "Reset",
  advancedFilterBuilderAddButtonTooltip: "Add Filter or Group",
  advancedFilterBuilderRemoveButtonTooltip: "Remove",
  advancedFilterBuilderMoveUpButtonTooltip: "Move Up",
  advancedFilterBuilderMoveDownButtonTooltip: "Move Down",
  advancedFilterBuilderAddJoin: "Add Group",
  advancedFilterBuilderAddCondition: "Add Filter",
  advancedFilterBuilderSelectColumn: "Select a column",
  advancedFilterBuilderSelectOption: "Select an option",
  advancedFilterBuilderEnterValue: "Enter a value...",
  advancedFilterBuilderValidationAlreadyApplied: "Current filter already applied.",
  advancedFilterBuilderValidationIncomplete: "Not all conditions are complete.",
  advancedFilterBuilderValidationSelectColumn: "Must select a column.",
  advancedFilterBuilderValidationSelectOption: "Must select an option.",
  advancedFilterBuilderValidationEnterValue: "Must enter a value."
};
function wc(e, t, s) {
  if (!e)
    return "";
  const i = s - t;
  return i ? e.slice(0, e.length - i) : e;
}
function Zs(e, t, s, i, r, n, o) {
  const a = s + (!e.length || o ? 0 : 1);
  let l = 0;
  return r && (e[a] === " " ? l = 1 : (i += " ", n && (i += '"'))), { updatedValue: e.slice(0, t) + i + e.slice(a), updatedPosition: t + i.length + l };
}
function y1(e, t, s) {
  let i = t;
  for (; i < s && e[i] === " "; )
    i++;
  return i;
}
function bc(e, t, s, i) {
  let r = t, n = !1;
  for (; r < e.length; ) {
    const o = e[r];
    if (o === "(") {
      i && e[r - 1] === " " ? n = !0 : r = r - 1;
      break;
    } else if (o === " " || s && o === ")") {
      r = r - 1;
      break;
    }
    r++;
  }
  return { endPosition: r, isEmpty: n };
}
function _d(e, t, s, i) {
  s !== t && (e.expression = Zs(
    e.expression,
    i - t.length + 1,
    i,
    s
  ).updatedValue);
}
var S1 = class {
  constructor(e, t) {
    this.params = e, this.startPosition = t, this.type = "column", this.valid = !0, this.hasStartChar = !1, this.hasEndChar = !1, this.colName = "";
  }
  parse(e, t) {
    if (e === yc && !this.colName)
      this.hasStartChar = !0;
    else if (e === Sc && this.hasStartChar) {
      if (this.parseColumn(!1, t))
        return this.hasEndChar = !0, !1;
      this.colName += e;
    } else
      this.colName += e;
  }
  getDisplayValue() {
    return (this.hasStartChar ? yc : "") + this.colName + (this.hasEndChar ? Sc : "");
  }
  getColId() {
    return this.colId;
  }
  complete(e) {
    this.parseColumn(!0, e);
  }
  getValidationError() {
    return this.valid ? null : {
      message: this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidColumn"),
      startPosition: this.startPosition,
      endPosition: this.endPosition ?? this.params.expression.length - 1
    };
  }
  parseColumn(e, t) {
    var i;
    this.endPosition = t;
    const s = this.params.advFilterExpSvc.getColId(this.colName);
    return s && this.hasStartChar && (this.colId = s.colId, _d(this.params, this.colName, s.columnName, t - 1), this.colName = s.columnName, this.column = this.params.colModel.getColDefCol(this.colId), this.column) ? (this.baseCellDataType = ((i = this.params.dataTypeSvc) == null ? void 0 : i.getBaseDataType(this.column)) ?? "text", !0) : (e && (this.valid = !1), this.baseCellDataType = "text", !1);
  }
}, x1 = class {
  constructor(e, t, s) {
    this.params = e, this.startPosition = t, this.baseCellDataType = s, this.type = "operator", this.valid = !0, this.expectedNumOperands = 0, this.operator = "";
  }
  parse(e, t) {
    if (e === " " || e === ")") {
      if (this.parseOperator(!1, t - 1))
        return !0;
      this.operator += e;
    } else
      this.operator += e;
  }
  complete(e) {
    this.parseOperator(!0, e);
  }
  getValidationError() {
    return this.valid ? null : {
      message: this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidOption"),
      startPosition: this.startPosition,
      endPosition: this.endPosition ?? this.params.expression.length - 1
    };
  }
  getDisplayValue() {
    return this.operator;
  }
  getOperatorKey() {
    return this.parsedOperator;
  }
  parseOperator(e, t) {
    const s = this.params.advFilterExpSvc.getDataTypeExpressionOperator(this.baseCellDataType), i = s.findOperator(this.operator);
    if (this.endPosition = t, i) {
      this.parsedOperator = i;
      const n = s.operators[i];
      this.expectedNumOperands = n.numOperands;
      const o = n.displayValue;
      return _d(this.params, this.operator, o, t), this.operator = o, !0;
    }
    return (e || !(i === null)) && (this.valid = !1), !1;
  }
}, F1 = class {
  constructor(e, t, s, i) {
    this.params = e, this.startPosition = t, this.baseCellDataType = s, this.column = i, this.type = "operand", this.valid = !0, this.operand = "", this.validationMessage = null, this.filterValidationSetters = {
      number: () => {
        (this.quotes || isNaN(this.modelValue)) && (this.valid = !1, this.validationMessage = this.params.advFilterExpSvc.translate("advancedFilterValidationNotANumber"));
      },
      date: (r) => {
        r == null && (this.valid = !1, this.validationMessage = this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidDate"));
      },
      dateString: (...r) => this.filterValidationSetters.date(...r),
      dateTime: (...r) => this.filterValidationSetters.date(...r),
      dateTimeString: (...r) => this.filterValidationSetters.date(...r),
      boolean() {
      },
      object() {
      },
      text() {
      }
    };
  }
  parse(e, t) {
    if (e === " ")
      if (this.quotes)
        this.operand += e;
      else
        return this.parseOperand(!1, t), !0;
    else if (e === ")") {
      if (this.baseCellDataType === "number" || !this.quotes)
        return this.parseOperand(!1, t - 1), !0;
      this.operand += e;
    } else if (!this.operand && !this.quotes && (e === "'" || e === '"'))
      this.quotes = e;
    else {
      if (this.quotes && e === this.quotes)
        return this.parseOperand(!1, t), !1;
      this.operand += e;
    }
  }
  complete(e) {
    this.parseOperand(!0, e);
  }
  getValidationError() {
    return this.validationMessage ? {
      message: this.validationMessage,
      startPosition: this.startPosition,
      endPosition: this.endPosition ?? this.params.expression.length - 1
    } : null;
  }
  getRawValue() {
    return this.operand;
  }
  getModelValue() {
    return this.modelValue;
  }
  parseOperand(e, t) {
    const { advFilterExpSvc: s } = this.params;
    if (this.endPosition = t, this.modelValue = this.operand, e && this.quotes)
      this.valid = !1, this.validationMessage = s.translate("advancedFilterValidationMissingQuote");
    else if (this.modelValue === "")
      this.valid = !1, this.validationMessage = s.translate("advancedFilterValidationMissingValue");
    else {
      const i = s.getOperandModelValue(this.operand, this.baseCellDataType, this.column);
      i != null && (this.modelValue = i), this.filterValidationSetters[this.baseCellDataType](i);
    }
  }
}, yc = "[", Sc = "]", R1 = class {
  constructor(e, t) {
    this.params = e, this.startPosition = t, this.isAwaiting = !0, this.operandValueGetters = {
      number: Number,
      date: (s) => this.params.valueSvc.parseValue(this.columnParser.column, null, s, void 0),
      dateString: (...s) => this.operandValueGetters.date(...s),
      dateTime: (...s) => this.operandValueGetters.date(...s),
      dateTimeString: (...s) => this.operandValueGetters.date(...s),
      boolean: (s) => s,
      object: (s) => s,
      text: (s) => s
    };
  }
  parseExpression() {
    var s, i;
    let e = this.startPosition;
    const { expression: t } = this.params;
    for (; e < t.length; ) {
      const r = t[e];
      if (!(r === " " && this.isAwaiting)) {
        if (this.isAwaiting = !1, !this.parser) {
          let o;
          this.columnParser ? this.operatorParser ? (this.operandParser = new F1(
            this.params,
            e,
            this.columnParser.baseCellDataType,
            this.columnParser.column
          ), o = this.operandParser) : (this.operatorParser = new x1(this.params, e, this.columnParser.baseCellDataType), o = this.operatorParser) : (this.columnParser = new S1(this.params, e), o = this.columnParser), this.parser = o;
        }
        const n = this.parser.parse(r, e);
        if (n != null) {
          if (this.isComplete())
            return this.returnEndPosition(n ? e - 1 : e, !0);
          this.parser = void 0, this.isAwaiting = !0;
        }
      }
      e++;
    }
    return (i = (s = this.parser) == null ? void 0 : s.complete) == null || i.call(s, e - 1), this.returnEndPosition(e);
  }
  isValid() {
    return this.isComplete() && this.columnParser.valid && this.operatorParser.valid && (!this.operandParser || this.operandParser.valid);
  }
  getValidationError() {
    var i, r, n;
    const e = ((i = this.columnParser) == null ? void 0 : i.getValidationError()) ?? ((r = this.operatorParser) == null ? void 0 : r.getValidationError()) ?? ((n = this.operandParser) == null ? void 0 : n.getValidationError());
    if (e)
      return e;
    const t = this.params.expression.length;
    let s;
    return this.columnParser ? this.operatorParser ? this.operatorParser.expectedNumOperands && !this.operandParser && (s = "advancedFilterValidationMissingValue") : s = "advancedFilterValidationMissingOption" : s = "advancedFilterValidationMissingColumn", s ? {
      message: this.params.advFilterExpSvc.translate(s),
      startPosition: t,
      endPosition: t
    } : null;
  }
  getFunction(e) {
    return this.getFunctionCommon(e, (t, s, i, r) => (n, o, a) => a.operators[s].evaluator(
      n.getValue(i, o),
      o,
      a.evaluatorParams[r],
      t == null ? void 0 : a.operands[t]
    ));
  }
  getAutocompleteListParams(e) {
    if (this.isColumnPosition(e))
      return this.getColumnAutocompleteListParams(e);
    if (this.isOperatorPosition(e))
      return this.getOperatorAutocompleteListParams(e);
    if (!this.isBeyondEndPosition(e))
      return { enabled: !1 };
  }
  updateExpression(e, t, s) {
    var r, n, o;
    const { expression: i } = this.params;
    if (this.isColumnPosition(e))
      return Zs(
        this.params.expression,
        this.startPosition,
        (r = this.columnParser) != null && r.getColId() ? this.columnParser.endPosition : bc(i, e).endPosition,
        this.params.advFilterExpSvc.getColumnValue(t),
        !0
      );
    if (this.isOperatorPosition(e)) {
      const a = this.getBaseCellDataTypeFromOperatorAutocompleteType(s), l = this.hasOperand(a, t.key), c = l && this.doesOperandNeedQuotes(a);
      let d;
      if (((n = this.operatorParser) == null ? void 0 : n.startPosition) != null && e < this.operatorParser.startPosition)
        d = Zs(
          i,
          e,
          e,
          t.displayValue ?? t.key,
          l,
          c
        );
      else {
        let h, u = !1;
        if ((o = this.operatorParser) != null && o.getOperatorKey())
          h = this.operatorParser.endPosition;
        else {
          const { endPosition: g, isEmpty: p } = bc(
            i,
            e,
            !0,
            !0
          );
          h = g, u = p;
        }
        d = Zs(
          i,
          y1(i, this.columnParser.endPosition + 1, h),
          h,
          t.displayValue ?? t.key,
          l,
          c,
          u
        );
      }
      return { ...d, hideAutocomplete: !l };
    }
    return null;
  }
  getModel() {
    const e = this.columnParser.getColId(), t = {
      filterType: this.columnParser.baseCellDataType,
      colId: e,
      type: this.operatorParser.getOperatorKey()
    };
    return this.operatorParser.expectedNumOperands && (t.filter = this.operandParser.getModelValue()), t;
  }
  getFunctionCommon(e, t) {
    var u, g;
    const s = this.columnParser.getColId(), i = (u = this.operatorParser) == null ? void 0 : u.getOperatorKey(), { operators: r, evaluatorParams: n, operands: o } = e, a = this.params.advFilterExpSvc.getExpressionOperator(
      this.columnParser.baseCellDataType,
      i
    ), l = this.addToListAndGetIndex(r, a), c = this.params.advFilterExpSvc.getExpressionEvaluatorParams(s), d = this.addToListAndGetIndex(n, c), h = ((g = this.operatorParser) == null ? void 0 : g.expectedNumOperands) === 0 ? void 0 : this.addToListAndGetIndex(o, this.getOperandValue());
    return t(h, l, s, d);
  }
  getOperandValue() {
    var i;
    const { baseCellDataType: e, column: t } = this.columnParser, s = this.operandValueGetters[e](this.operandParser.getRawValue());
    return e === "dateString" || e === "dateTimeString" ? ((i = this.params.dataTypeSvc) == null ? void 0 : i.getDateParserFunction(t)(s)) ?? s : s;
  }
  isComplete() {
    return !!(this.operatorParser && (!this.operatorParser.expectedNumOperands || this.operatorParser.expectedNumOperands && this.operandParser));
  }
  isColumnPosition(e) {
    return !this.columnParser || this.columnParser.endPosition == null || e <= this.columnParser.endPosition + 1;
  }
  isOperatorPosition(e) {
    return !this.operatorParser || this.operatorParser.endPosition == null || e <= this.operatorParser.endPosition + 1;
  }
  isBeyondEndPosition(e) {
    return this.isComplete() && this.endPosition != null && e > this.endPosition + 1 && this.endPosition + 1 < this.params.expression.length;
  }
  returnEndPosition(e, t) {
    return this.endPosition = t ? e : e - 1, e;
  }
  getColumnAutocompleteListParams(e) {
    return this.params.advFilterExpSvc.generateAutocompleteListParams(
      this.params.advFilterExpSvc.getColumnAutocompleteEntries(),
      "column",
      this.getColumnSearchString(e)
    );
  }
  getColumnSearchString(e) {
    var n, o, a, l;
    const t = ((n = this.columnParser) == null ? void 0 : n.getDisplayValue()) ?? "", s = wc(
      t,
      e,
      ((o = this.columnParser) == null ? void 0 : o.endPosition) == null ? this.params.expression.length : this.columnParser.endPosition + 1
    ), i = ((a = this.columnParser) == null ? void 0 : a.hasStartChar) && s.length > 0, r = ((l = this.columnParser) == null ? void 0 : l.hasEndChar) && s.length === t.length + 2;
    return i ? s.slice(1, r ? -1 : void 0) : s;
  }
  getOperatorAutocompleteListParams(e) {
    var r, n, o, a;
    const t = (r = this.columnParser) == null ? void 0 : r.column;
    if (!t)
      return { enabled: !1 };
    const s = this.columnParser.baseCellDataType, i = ((n = this.operatorParser) == null ? void 0 : n.startPosition) != null && e < this.operatorParser.startPosition ? "" : wc(
      ((o = this.operatorParser) == null ? void 0 : o.getDisplayValue()) ?? "",
      e,
      ((a = this.operatorParser) == null ? void 0 : a.endPosition) == null ? this.params.expression.length : this.operatorParser.endPosition + 1
    );
    return this.params.advFilterExpSvc.generateAutocompleteListParams(
      this.params.advFilterExpSvc.getOperatorAutocompleteEntries(t, s),
      `operator-${s}`,
      i
    );
  }
  getBaseCellDataTypeFromOperatorAutocompleteType(e) {
    return e == null ? void 0 : e.replace("operator-", "");
  }
  hasOperand(e, t) {
    var s;
    return !e || !t || (((s = this.params.advFilterExpSvc.getExpressionOperator(e, t)) == null ? void 0 : s.numOperands) ?? 0) > 0;
  }
  doesOperandNeedQuotes(e) {
    return e !== "number";
  }
  addToListAndGetIndex(e, t) {
    const s = e.length;
    return e.push(t), s;
  }
};
function Ta(e, t, s) {
  let i = !1;
  const r = e.toLocaleLowerCase(), n = r + " ", o = Object.keys(t).find((a) => {
    const l = t[a], c = s(l).toLocaleLowerCase();
    return c.startsWith(n) && (i = !0), c === r;
  });
  return o || (i ? null : void 0);
}
function Ud(e, t) {
  return (t ?? Object.keys(e)).map((i) => ({
    key: i,
    displayValue: e[i].displayValue
  }));
}
var Au = class {
  constructor(e) {
    this.params = e, this.initOperators();
  }
  getEntries(e) {
    return Ud(this.operators, e);
  }
  findOperator(e) {
    return Ta(e, this.operators, ({ displayValue: t }) => t);
  }
  initOperators() {
    const { translate: e } = this.params;
    this.operators = {
      contains: {
        displayValue: e("advancedFilterContains"),
        evaluator: (t, s, i, r) => this.evaluateExpression(t, s, i, r, !1, (n, o) => n.includes(o)),
        numOperands: 1
      },
      notContains: {
        displayValue: e("advancedFilterNotContains"),
        evaluator: (t, s, i, r) => this.evaluateExpression(t, s, i, r, !0, (n, o) => !n.includes(o)),
        numOperands: 1
      },
      equals: {
        displayValue: e("advancedFilterTextEquals"),
        evaluator: (t, s, i, r) => this.evaluateExpression(t, s, i, r, !1, (n, o) => n === o),
        numOperands: 1
      },
      notEqual: {
        displayValue: e("advancedFilterTextNotEqual"),
        evaluator: (t, s, i, r) => this.evaluateExpression(t, s, i, r, !0, (n, o) => n != o),
        numOperands: 1
      },
      startsWith: {
        displayValue: e("advancedFilterStartsWith"),
        evaluator: (t, s, i, r) => this.evaluateExpression(t, s, i, r, !1, (n, o) => n.startsWith(o)),
        numOperands: 1
      },
      endsWith: {
        displayValue: e("advancedFilterEndsWith"),
        evaluator: (t, s, i, r) => this.evaluateExpression(t, s, i, r, !1, (n, o) => n.endsWith(o)),
        numOperands: 1
      },
      blank: {
        displayValue: e("advancedFilterBlank"),
        evaluator: (t) => t == null || typeof t == "string" && t.trim().length === 0,
        numOperands: 0
      },
      notBlank: {
        displayValue: e("advancedFilterNotBlank"),
        evaluator: (t) => t != null && (typeof t != "string" || t.trim().length > 0),
        numOperands: 0
      }
    };
  }
  evaluateExpression(e, t, s, i, r, n) {
    return e == null ? r : s.caseSensitive ? n(s.valueConverter(e, t), i) : n(s.valueConverter(e, t).toLocaleLowerCase(), i.toLocaleLowerCase());
  }
}, Ir = class {
  constructor(e) {
    this.params = e, this.initOperators();
  }
  getEntries(e) {
    return Ud(this.operators, e);
  }
  findOperator(e) {
    return Ta(e, this.operators, ({ displayValue: t }) => t);
  }
  initOperators() {
    const { translate: e, equals: t } = this.params;
    this.operators = {
      equals: {
        displayValue: e("advancedFilterEquals"),
        evaluator: (s, i, r, n) => this.evaluateSingleOperandExpression(
          s,
          i,
          r,
          n,
          !!r.includeBlanksInEquals,
          t
        ),
        numOperands: 1
      },
      notEqual: {
        displayValue: e("advancedFilterNotEqual"),
        evaluator: (s, i, r, n) => this.evaluateSingleOperandExpression(
          s,
          i,
          r,
          n,
          !!r.includeBlanksInEquals,
          (o, a) => !t(o, a)
        ),
        numOperands: 1
      },
      greaterThan: {
        displayValue: e("advancedFilterGreaterThan"),
        evaluator: (s, i, r, n) => this.evaluateSingleOperandExpression(
          s,
          i,
          r,
          n,
          !!r.includeBlanksInGreaterThan,
          (o, a) => o > a
        ),
        numOperands: 1
      },
      greaterThanOrEqual: {
        displayValue: e("advancedFilterGreaterThanOrEqual"),
        evaluator: (s, i, r, n) => this.evaluateSingleOperandExpression(
          s,
          i,
          r,
          n,
          !!r.includeBlanksInGreaterThan,
          (o, a) => o >= a
        ),
        numOperands: 1
      },
      lessThan: {
        displayValue: e("advancedFilterLessThan"),
        evaluator: (s, i, r, n) => this.evaluateSingleOperandExpression(
          s,
          i,
          r,
          n,
          !!r.includeBlanksInLessThan,
          (o, a) => o < a
        ),
        numOperands: 1
      },
      lessThanOrEqual: {
        displayValue: e("advancedFilterLessThanOrEqual"),
        evaluator: (s, i, r, n) => this.evaluateSingleOperandExpression(
          s,
          i,
          r,
          n,
          !!r.includeBlanksInLessThan,
          (o, a) => o <= a
        ),
        numOperands: 1
      },
      blank: {
        displayValue: e("advancedFilterBlank"),
        evaluator: (s) => s == null,
        numOperands: 0
      },
      notBlank: {
        displayValue: e("advancedFilterNotBlank"),
        evaluator: (s) => s != null,
        numOperands: 0
      }
    };
  }
  evaluateSingleOperandExpression(e, t, s, i, r, n) {
    return e == null ? r : n(s.valueConverter(e, t), i);
  }
}, P1 = class {
  constructor(e) {
    this.params = e, this.initOperators();
  }
  getEntries(e) {
    return Ud(this.operators, e);
  }
  findOperator(e) {
    return Ta(e, this.operators, ({ displayValue: t }) => t);
  }
  initOperators() {
    const { translate: e } = this.params;
    this.operators = {
      true: {
        displayValue: e("advancedFilterTrue"),
        evaluator: (t) => !!t,
        numOperands: 0
      },
      false: {
        displayValue: e("advancedFilterFalse"),
        evaluator: (t) => t === !1,
        numOperands: 0
      },
      blank: {
        displayValue: e("advancedFilterBlank"),
        evaluator: (t) => t == null,
        numOperands: 0
      },
      notBlank: {
        displayValue: e("advancedFilterNotBlank"),
        evaluator: (t) => t != null,
        numOperands: 0
      }
    };
  }
}, E1 = class extends R {
  constructor() {
    super(...arguments), this.beanName = "advFilterExpSvc", this.filterOperandGetters = {
      number: (e) => ut(e.filter) ?? "",
      date: (e) => {
        const t = this.colModel.getColDefCol(e.colId);
        return t ? this.valueSvc.formatValue(t, null, ke(e.filter)) : null;
      },
      dateTime: (e) => this.filterOperandGetters.date(e),
      dateString: (e) => {
        var n;
        const t = this.colModel.getColDefCol(e.colId);
        if (!t)
          return null;
        const { filter: s } = e, i = (n = this.dataTypeSvc) == null ? void 0 : n.getDateFormatterFunction(t), r = (i == null ? void 0 : i(ke(s) ?? void 0)) ?? s;
        return this.valueSvc.formatValue(t, null, r);
      },
      dateTimeString: (e) => this.filterOperandGetters.dateString(e),
      boolean: () => null,
      object: () => null,
      text: () => null
    }, this.operandModelValueGetters = {
      number: (e) => A(e) ? Number(e) : null,
      date: (e, t, s) => {
        var i;
        return tt(
          this.valueSvc.parseValue(t, null, e, void 0),
          !!((i = this.dataTypeSvc) != null && i.getDateIncludesTimeFlag(s))
        );
      },
      dateTime: (...e) => this.operandModelValueGetters.date(...e),
      dateString: (e, t, s) => {
        const i = this.valueSvc.parseValue(t, null, e, void 0);
        return this.dataTypeSvc ? tt(
          this.dataTypeSvc.getDateParserFunction(t)(i) ?? null,
          this.dataTypeSvc.getDateIncludesTimeFlag(s)
        ) : i;
      },
      dateTimeString: (...e) => this.operandModelValueGetters.dateString(...e),
      boolean: (e) => e,
      object: (e) => e,
      text: (e) => e
    }, this.columnNameToIdMap = {}, this.columnAutocompleteEntries = null, this.expressionEvaluatorParams = {};
  }
  wireBeans(e) {
    this.valueSvc = e.valueSvc, this.colModel = e.colModel, this.colNames = e.colNames, this.dataTypeSvc = e.dataTypeSvc;
  }
  postConstruct() {
    this.expressionJoinOperators = this.generateExpressionJoinOperators(), this.expressionOperators = this.generateExpressionOperators();
  }
  parseJoinOperator(e) {
    const { type: t } = e;
    return this.expressionJoinOperators[t] ?? t;
  }
  getColumnDisplayValue(e) {
    const { colId: t } = e, i = this.getColumnAutocompleteEntries().find(({ key: n }) => n === t);
    let r;
    return i ? (r = i.displayValue, this.columnNameToIdMap[r.toLocaleUpperCase()] = { colId: t, columnName: r }) : r = t, r;
  }
  getOperatorDisplayValue(e) {
    var t;
    return ((t = this.getExpressionOperator(e.filterType, e.type)) == null ? void 0 : t.displayValue) ?? e.type;
  }
  getOperandModelValue(e, t, s) {
    return this.operandModelValueGetters[t](e, s, t);
  }
  getOperandDisplayValue(e, t) {
    const { filter: s } = e;
    if (s == null)
      return "";
    let i = this.filterOperandGetters[e.filterType](e);
    return e.filterType !== "number" && (i ?? (i = ut(s) ?? ""), t || (i = `"${i}"`)), t ? i : ` ${i}`;
  }
  parseColumnFilterModel(e) {
    const t = this.getColumnDisplayValue(e) ?? "", s = this.getOperatorDisplayValue(e) ?? "", i = this.getOperandDisplayValue(e);
    return `[${t}] ${s}${i}`;
  }
  updateAutocompleteCache(e, t) {
    if (t === "column") {
      const { key: s, displayValue: i } = e;
      this.columnNameToIdMap[e.displayValue.toLocaleUpperCase()] = {
        colId: s,
        columnName: i
      };
    }
  }
  translate(e, t) {
    let s = b1[e];
    return typeof s == "function" && (s = s(t)), this.getLocaleTextFunc()(e, s, t);
  }
  generateAutocompleteListParams(e, t, s) {
    return {
      enabled: !0,
      type: t,
      searchString: s,
      entries: e
    };
  }
  getColumnAutocompleteEntries() {
    if (this.columnAutocompleteEntries)
      return this.columnAutocompleteEntries;
    const e = this.colModel.getColDefCols() ?? [], t = [], s = this.gos.get("includeHiddenColumnsInAdvancedFilter");
    return e.forEach((i) => {
      i.getColDef().filter && (s || i.isVisible() || i.isRowGroupActive()) && t.push({
        key: i.getColId(),
        displayValue: this.colNames.getDisplayNameForColumn(i, "advancedFilter")
      });
    }), t.sort((i, r) => {
      const n = i.displayValue ?? "", o = r.displayValue ?? "";
      return n < o ? -1 : o > n ? 1 : 0;
    }), t;
  }
  getOperatorAutocompleteEntries(e, t) {
    const s = this.getActiveOperators(e);
    return this.getDataTypeExpressionOperator(t).getEntries(s);
  }
  getJoinOperatorAutocompleteEntries() {
    return Object.entries(this.expressionJoinOperators).map(([e, t]) => ({ key: e, displayValue: t }));
  }
  getDefaultAutocompleteListParams(e) {
    return this.generateAutocompleteListParams(this.getColumnAutocompleteEntries(), "column", e);
  }
  getDataTypeExpressionOperator(e) {
    return this.expressionOperators[e];
  }
  getExpressionOperator(e, t) {
    var s, i;
    return (i = (s = this.getDataTypeExpressionOperator(e)) == null ? void 0 : s.operators) == null ? void 0 : i[t];
  }
  getExpressionJoinOperators() {
    return this.expressionJoinOperators;
  }
  getColId(e) {
    const t = e.toLocaleUpperCase(), s = this.columnNameToIdMap[t];
    if (s)
      return s;
    const r = this.getColumnAutocompleteEntries().find(
      ({ displayValue: n }) => n.toLocaleUpperCase() === t
    );
    if (r) {
      const { key: n, displayValue: o } = r, a = { colId: n, columnName: o };
      return this.columnNameToIdMap[t] = a, a;
    }
    return null;
  }
  getExpressionEvaluatorParams(e) {
    var n, o;
    let t = this.expressionEvaluatorParams[e];
    if (t)
      return t;
    const s = this.colModel.getColDefCol(e);
    if (!s)
      return { valueConverter: (a) => a };
    switch ((n = this.dataTypeSvc) == null ? void 0 : n.getBaseDataType(s)) {
      case "dateTimeString":
      case "dateString":
        t = {
          valueConverter: ((o = this.dataTypeSvc) == null ? void 0 : o.getDateParserFunction(s)) ?? ((a) => a)
        };
        break;
      case "object":
        s.getColDef().filterValueGetter ? t = { valueConverter: (a) => a } : t = {
          valueConverter: (a, l) => this.valueSvc.formatValue(s, l, a) ?? (typeof a.toString == "function" ? a.toString() : "")
        };
        break;
      case "text":
      case void 0:
        t = { valueConverter: (a) => ut(a) };
        break;
      default:
        t = { valueConverter: (a) => a };
        break;
    }
    const { filterParams: r } = s.getColDef();
    return r && ["caseSensitive", "includeBlanksInEquals", "includeBlanksInLessThan", "includeBlanksInGreaterThan"].forEach(
      (a) => {
        const l = r[a];
        l && (t[a] = l);
      }
    ), this.expressionEvaluatorParams[e] = t, t;
  }
  getColumnDetails(e) {
    var i;
    const t = this.colModel.getColDefCol(e) ?? void 0, s = (t ? (i = this.dataTypeSvc) == null ? void 0 : i.getBaseDataType(t) : void 0) ?? "text";
    return { column: t, baseCellDataType: s };
  }
  generateExpressionOperators() {
    const e = (s, i) => this.translate(s, i), t = {
      translate: e,
      equals: (s, i) => s.getTime() === i.getTime()
    };
    return {
      text: new Au({ translate: e }),
      boolean: new P1({ translate: e }),
      object: new Au({ translate: e }),
      number: new Ir({ translate: e, equals: (s, i) => s === i }),
      date: new Ir(t),
      dateString: new Ir(t),
      dateTime: new Ir(t),
      dateTimeString: new Ir(t)
    };
  }
  getColumnValue({ displayValue: e }) {
    return `${yc}${e}${Sc}`;
  }
  generateExpressionJoinOperators() {
    return {
      AND: this.translate("advancedFilterAnd"),
      OR: this.translate("advancedFilterOr")
    };
  }
  getActiveOperators(e) {
    var i;
    const t = (i = e.getColDef().filterParams) == null ? void 0 : i.filterOptions;
    return t && t.every((r) => typeof r == "string") ? t : void 0;
  }
  resetColumnCaches() {
    this.columnAutocompleteEntries = null, this.columnNameToIdMap = {}, this.expressionEvaluatorParams = {};
  }
}, T1 = (
  /*css*/
  ".ag-panel{background-color:var(--ag-panel-background-color);display:flex;flex-direction:column;overflow:hidden;position:relative}.ag-dialog{border:var(--ag-dialog-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dialog-shadow);position:absolute}.ag-panel-title-bar{align-items:center;background-color:var(--ag-panel-title-bar-background-color);border-bottom:var(--ag-panel-title-bar-border);color:var(--ag-panel-title-bar-text-color);cursor:default;display:flex;flex:none;font-weight:var(--ag-panel-title-bar-font-weight);height:var(--ag-header-height);padding:var(--ag-spacing) var(--ag-cell-horizontal-padding)}.ag-panel-title-bar-button{cursor:pointer;:where(.ag-icon){color:var(--ag-panel-title-bar-icon-color)}}:where(.ag-ltr) .ag-panel-title-bar-button{margin-left:calc(var(--ag-spacing)*2);margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-panel-title-bar-button{margin-left:var(--ag-spacing);margin-right:calc(var(--ag-spacing)*2)}.ag-panel-title-bar-title{flex:1 1 auto}.ag-panel-title-bar-buttons{display:flex}.ag-panel-content-wrapper{display:flex;flex:1 1 auto;overflow:hidden;position:relative}:where(.ag-dragging-fill-handle) .ag-dialog,:where(.ag-dragging-range-handle) .ag-dialog{opacity:.7;pointer-events:none}"
);
function M1(e) {
  const t = e.cssIdentifier || "default";
  return {
    tag: "div",
    cls: `ag-panel ag-${t}-panel`,
    attrs: { tabindex: "-1" },
    children: [
      {
        tag: "div",
        ref: "eTitleBar",
        cls: `ag-panel-title-bar ag-${t}-panel-title-bar ag-unselectable`,
        children: [
          {
            tag: "span",
            ref: "eTitle",
            cls: `ag-panel-title-bar-title ag-${t}-panel-title-bar-title`
          },
          {
            tag: "div",
            ref: "eTitleBarButtons",
            cls: `ag-panel-title-bar-buttons ag-${t}-panel-title-bar-buttons`
          }
        ]
      },
      {
        tag: "div",
        ref: "eContentWrapper",
        cls: `ag-panel-content-wrapper ag-${t}-panel-content-wrapper`
      }
    ]
  };
}
var dC = class extends D {
  constructor(e) {
    super(M1(e)), this.config = e, this.closable = !0, this.eContentWrapper = x, this.eTitleBar = x, this.eTitleBarButtons = x, this.eTitle = x, this.registerCSS(T1);
  }
  postConstruct() {
    const {
      component: e,
      closable: t,
      hideTitleBar: s,
      title: i,
      minWidth: r = 250,
      width: n,
      minHeight: o = 250,
      height: a,
      centered: l,
      popup: c,
      x: d,
      y: h,
      postProcessPopupParams: u
    } = this.config, g = this.beans, p = this.createManagedBean(
      new va(this.getGui(), {
        minWidth: r,
        width: n,
        minHeight: o,
        height: a,
        centered: l,
        x: d,
        y: h,
        popup: c,
        calculateTopBuffer: () => this.positionableFeature.getHeight() - this.getBodyHeight()
      })
    );
    this.positionableFeature = p;
    const f = this.getGui();
    if (e && this.setBodyComponent(e), s ? O(this.eTitleBar, !1) : (i && this.setTitle(i), this.setClosable(t ?? this.closable)), this.addManagedElementListeners(this.eTitleBar, {
      mousedown: (C) => {
        if (f.contains(C.relatedTarget) || f.contains(Q(g)) || this.eTitleBarButtons.contains(C.target)) {
          C.preventDefault();
          return;
        }
        const v = this.eContentWrapper.querySelector(
          "button, [href], input, select, textarea, [tabindex]"
        );
        v && v.focus();
      }
    }), c && p.isPositioned())
      return;
    this.renderComponent && this.renderComponent();
    let m;
    if (u) {
      const { type: C, eventSource: v, mouseEvent: w } = u;
      m = () => {
        var b;
        return (b = g.popupSvc) == null ? void 0 : b.callPostProcessPopup(u, C, f, v, w);
      };
    }
    p.initialisePosition(m), this.eContentWrapper.style.height = "0";
  }
  renderComponent() {
    const e = this.getGui();
    e.focus(), this.close = () => {
      e.parentElement.removeChild(e), this.destroy();
    };
  }
  getHeight() {
    return this.positionableFeature.getHeight();
  }
  setHeight(e) {
    this.positionableFeature.setHeight(e);
  }
  getWidth() {
    return this.positionableFeature.getWidth();
  }
  setWidth(e) {
    this.positionableFeature.setWidth(e);
  }
  setClosable(e) {
    if (e !== this.closable && (this.closable = e), e) {
      const t = this.closeButtonComp = new D({ tag: "div", cls: "ag-button" });
      this.createBean(t);
      const s = t.getGui(), i = N("close", this.beans);
      i.classList.add("ag-panel-title-bar-button-icon"), s.appendChild(i), this.addTitleBarButton(t), t.addManagedElementListeners(s, { click: this.onBtClose.bind(this) });
    } else if (this.closeButtonComp) {
      const t = this.closeButtonComp.getGui();
      t.parentElement.removeChild(t), this.closeButtonComp = this.destroyBean(this.closeButtonComp);
    }
  }
  setBodyComponent(e) {
    e.setParentComponent(this), this.eContentWrapper.appendChild(e.getGui());
  }
  addTitleBarButton(e, t) {
    const s = this.eTitleBarButtons, i = s.children, r = i.length;
    t == null && (t = r), t = Math.max(0, Math.min(t, r)), e.addCss("ag-panel-title-bar-button");
    const n = e.getGui();
    t === 0 ? s.insertAdjacentElement("afterbegin", n) : t === r ? s.insertAdjacentElement("beforeend", n) : i[t - 1].insertAdjacentElement("afterend", n), e.setParentComponent(this);
  }
  getBodyHeight() {
    return ia(this.eContentWrapper);
  }
  getBodyWidth() {
    return hr(this.eContentWrapper);
  }
  setTitle(e) {
    this.eTitle.innerText = e;
  }
  // called when user hits the 'x' in the top right
  onBtClose() {
    this.close();
  }
  destroy() {
    this.closeButtonComp && (this.closeButtonComp = this.destroyBean(this.closeButtonComp));
    const e = this.getGui();
    e && Ze(e) && this.close(), super.destroy();
  }
}, Tn = class extends dC {
  constructor(e) {
    super({ ...e, popup: !0 }), this.isMaximizable = !1, this.isMaximized = !1, this.maximizeListeners = [], this.resizeListenerDestroy = null, this.lastPosition = {
      x: 0,
      y: 0,
      width: 0,
      height: 0
    };
  }
  wireBeans(e) {
    this.popupSvc = e.popupSvc;
  }
  postConstruct() {
    const e = this.getGui(), { movable: t, resizable: s, maximizable: i, modal: r } = this.config;
    if (this.addCss("ag-dialog"), super.postConstruct(), this.tabGuardFeature = this.createManagedBean(new Tf(this)), this.tabGuardFeature.initialiseTabGuard({
      isFocusableContainer: !0,
      onFocusIn: () => {
        var n;
        (n = this.popupSvc) == null || n.bringPopupToFront(e);
      },
      onTabKeyDown: (n) => {
        if (r)
          return;
        const o = n.shiftKey, a = ze(this.beans, e, !1, o);
        (!a || this.tabGuardFeature.getTabGuardCtrl().isTabGuard(a)) && rs(this.beans, o) && n.preventDefault();
      }
    }), t && this.setMovable(t), i && this.setMaximizable(i), s && this.setResizable(s), !this.config.modal) {
      const n = this.beans.ctrlsSvc.get("gridCtrl");
      n.addFocusableContainer(this), this.addDestroyFunc(() => n.removeFocusableContainer(this));
    }
  }
  setAllowFocus(e) {
    this.tabGuardFeature.getTabGuardCtrl().setAllowFocus(e);
  }
  renderComponent() {
    var a;
    const e = this.getGui(), { alwaysOnTop: t, modal: s, title: i, afterGuiAttached: r } = this.config, n = this.getLocaleTextFunc(), o = (a = this.popupSvc) == null ? void 0 : a.addPopup({
      modal: s,
      eChild: e,
      closeOnEsc: !0,
      closedCallback: this.onClosed.bind(this),
      alwaysOnTop: t,
      ariaLabel: i || n("ariaLabelDialog", "Dialog"),
      afterGuiAttached: r
    });
    o && (this.close = o.hideFunc);
  }
  onClosed(e) {
    var t, s;
    this.destroy(), (s = (t = this.config).closedCallback) == null || s.call(t, e);
  }
  setMaximized(e) {
    this.isMaximizable && e !== this.isMaximized && this.toggleMaximize();
  }
  toggleMaximize() {
    const e = this.positionableFeature.getPosition();
    if (this.isMaximized) {
      const { x: t, y: s, width: i, height: r } = this.lastPosition;
      this.setWidth(i), this.setHeight(r), this.positionableFeature.offsetElement(t, s);
    } else
      this.lastPosition.width = this.getWidth(), this.lastPosition.height = this.getHeight(), this.lastPosition.x = e.x, this.lastPosition.y = e.y, this.positionableFeature.offsetElement(0, 0), this.setHeight("100%"), this.setWidth("100%");
    this.isMaximized = !this.isMaximized, this.refreshMaximizeIcon();
  }
  refreshMaximizeIcon() {
    O(this.maximizeIcon, !this.isMaximized), O(this.minimizeIcon, this.isMaximized);
  }
  clearMaximizebleListeners() {
    this.maximizeListeners.length && (this.maximizeListeners.forEach((e) => e()), this.maximizeListeners.length = 0), this.resizeListenerDestroy && (this.resizeListenerDestroy(), this.resizeListenerDestroy = null);
  }
  destroy() {
    this.maximizeButtonComp = this.destroyBean(this.maximizeButtonComp), this.clearMaximizebleListeners(), super.destroy();
  }
  setResizable(e) {
    this.positionableFeature.setResizable(e);
  }
  setMovable(e) {
    this.positionableFeature.setMovable(e, this.eTitleBar);
  }
  setMaximizable(e) {
    if (!e) {
      this.clearMaximizebleListeners(), this.maximizeButtonComp && (this.destroyBean(this.maximizeButtonComp), this.maximizeButtonComp = this.maximizeIcon = this.minimizeIcon = void 0);
      return;
    }
    const t = this.eTitleBar;
    if (!t || e === this.isMaximizable)
      return;
    this.isMaximizable = e;
    const s = this.buildMaximizeAndMinimizeElements();
    this.refreshMaximizeIcon(), s.addManagedElementListeners(s.getGui(), {
      click: this.toggleMaximize.bind(this)
    }), this.addTitleBarButton(s, 0), this.maximizeListeners.push(
      ...this.addManagedElementListeners(t, {
        dblclick: this.toggleMaximize.bind(this)
      })
    ), [this.resizeListenerDestroy] = this.addManagedListeners(this.positionableFeature, {
      resize: () => {
        this.isMaximized = !1, this.refreshMaximizeIcon();
      }
    });
  }
  buildMaximizeAndMinimizeElements() {
    const e = this.maximizeButtonComp = this.createBean(
      new D({ tag: "div", cls: "ag-dialog-button" })
    ), t = e.getGui();
    return this.maximizeIcon = N("maximize", this.beans), t.appendChild(this.maximizeIcon), this.maximizeIcon.classList.add("ag-panel-title-bar-button-icon"), this.minimizeIcon = N("minimize", this.beans), t.appendChild(this.minimizeIcon), this.minimizeIcon.classList.add("ag-panel-title-bar-button-icon"), e;
  }
}, D1 = (
  /*css*/
  ".ag-autocomplete{align-items:center;display:flex;width:100%;>*{flex:1 1 auto}}.ag-autocomplete-list-popup{background-color:var(--ag-background-color);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dropdown-shadow);padding:0;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ag-autocomplete-list{height:calc(var(--ag-row-height)*6.5);min-width:200px;position:relative;width:100%}.ag-autocomplete-virtual-list-item{cursor:default;display:flex;height:var(--ag-list-item-height);&:focus-visible:after{content:none}&:hover{background-color:var(--ag-row-hover-color)}}.ag-autocomplete-row{align-items:center;display:flex;flex:1 1 auto;overflow:hidden}.ag-autocomplete-row-label{margin:0 var(--ag-widget-container-horizontal-padding);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-autocomplete-row-selected{background-color:var(--ag-selected-row-background-color)}"
);
function A1(e) {
  return {
    tag: "div",
    cls: `ag-virtual-list-viewport ag-${e}-virtual-list-viewport`,
    role: "presentation",
    children: [
      {
        tag: "div",
        ref: "eContainer",
        cls: `ag-virtual-list-container ag-${e}-virtual-list-container`
      }
    ]
  };
}
var yr = class extends ls {
  constructor(e) {
    super(A1((e == null ? void 0 : e.cssIdentifier) || "default")), this.renderedRows = /* @__PURE__ */ new Map(), this.rowHeight = 20, this.pageSize = -1, this.isScrolling = !1, this.isHeightFromTheme = !0, this.eContainer = x, this.awaitStableCallbacks = [];
    const { cssIdentifier: t = "default", ariaRole: s = "listbox", listName: i, moveItemCallback: r } = e || {};
    this.cssIdentifier = t, this.ariaRole = s, this.listName = i, this.moveItemCallback = r;
  }
  wireBeans(e) {
    this.environment = e.environment;
  }
  postConstruct() {
    this.addScrollListener(), this.rowHeight = this.getItemHeight(), this.addResizeObserver(), this.initialiseTabGuard({
      onFocusIn: (e) => this.onFocusIn(e),
      onFocusOut: (e) => this.onFocusOut(e),
      focusInnerElement: (e) => this.focusInnerElement(e),
      onTabKeyDown: (e) => this.onTabKeyDown(e),
      handleKeyDown: (e) => this.handleKeyDown(e)
    }), this.refreshAriaProperties(), this.addManagedEventListeners({ gridStylesChanged: this.onGridStylesChanged.bind(this) });
  }
  onGridStylesChanged(e) {
    e.listItemHeightChanged && (this.rowHeight = this.getItemHeight(), this.refresh());
  }
  refreshAriaProperties() {
    var i;
    const t = this.getLocaleTextFunc()("ariaDefaultListName", this.listName || "List"), s = this.eContainer;
    Ye(s, ((i = this.model) == null ? void 0 : i.getRowCount()) > 0 ? this.ariaRole : "presentation"), re(s, t);
  }
  addResizeObserver() {
    const e = () => xt(this.beans, () => this.drawVirtualRows()), t = os(this.beans, this.getGui(), e);
    this.addDestroyFunc(t);
  }
  focusInnerElement(e) {
    return this.focusRow(e ? this.model.getRowCount() - 1 : 0), !0;
  }
  onFocusIn(e) {
    const t = e.target;
    t.classList.contains("ag-virtual-list-item") && (this.lastFocusedRowIndex = aw(t) - 1);
  }
  onFocusOut(e) {
    this.getFocusableElement().contains(e.relatedTarget) || (this.lastFocusedRowIndex = null);
  }
  handleKeyDown(e) {
    const { key: t, shiftKey: s } = e;
    switch (t) {
      case S.UP:
      case S.DOWN:
        {
          const i = t === S.UP;
          e.preventDefault(), s ? this.moveItem(i) : this.navigate(i);
        }
        break;
      case S.PAGE_HOME:
      case S.PAGE_END:
      case S.PAGE_UP:
      case S.PAGE_DOWN:
        this.navigateToPage(t) !== null && e.preventDefault();
        break;
    }
  }
  onTabKeyDown(e) {
    he(e), this.forceFocusOutOfContainer(e.shiftKey);
  }
  getNextRow(e) {
    if (this.lastFocusedRowIndex == null)
      return;
    const t = this.lastFocusedRowIndex + (e ? -1 : 1);
    if (!(t < 0 || t >= this.model.getRowCount()))
      return t;
  }
  moveItem(e) {
    if (!this.moveItemCallback)
      return;
    const t = this.getComponentAt(this.lastFocusedRowIndex);
    t && this.moveItemCallback(t, e);
  }
  navigate(e) {
    const t = this.getNextRow(e);
    t !== void 0 && this.focusRow(t);
  }
  navigateToPage(e, t = "focused") {
    let s = !1;
    t === "focused" && (t = this.getLastFocusedRow(), s = !0);
    const i = this.model.getRowCount() - 1;
    let r = -1;
    return e === S.PAGE_HOME ? r = 0 : e === S.PAGE_END ? r = i : e === S.PAGE_DOWN ? r = Math.min(t + this.pageSize, i) : e === S.PAGE_UP && (r = Math.max(t - this.pageSize, 0)), r === -1 ? null : (s ? this.focusRow(r) : this.ensureIndexVisible(r), r);
  }
  getLastFocusedRow() {
    return this.lastFocusedRowIndex;
  }
  focusRow(e) {
    this.isScrolling || (this.isScrolling = !0, this.ensureIndexVisible(e), xt(this.beans, () => {
      if (this.isScrolling = !1, !this.isAlive())
        return;
      const t = this.renderedRows.get(e);
      t && t.eDiv.focus();
    }));
  }
  getComponentAt(e) {
    const t = this.renderedRows.get(e);
    return t && t.rowComponent;
  }
  forEachRenderedRow(e) {
    this.renderedRows.forEach((t, s) => e(t.rowComponent, s));
  }
  getItemHeight() {
    return this.isHeightFromTheme ? this.environment.getDefaultListItemHeight() : this.rowHeight;
  }
  /**
   * Returns true if the view had to be scrolled, otherwise, false.
   */
  ensureIndexVisible(e, t = !0) {
    const s = this.model.getRowCount();
    if (typeof e != "number" || e < 0 || e >= s)
      return F(229, { index: e }), !1;
    const i = e * this.rowHeight, r = i + this.rowHeight, n = this.getGui(), o = n.scrollTop, a = n.offsetHeight, l = o + a, c = t ? 0 : this.rowHeight, d = o > i + c, h = l < r - c;
    if (d)
      return n.scrollTop = i, !0;
    if (h) {
      const u = r - a;
      return n.scrollTop = u, !0;
    }
    return !1;
  }
  setComponentCreator(e) {
    this.componentCreator = e;
  }
  setComponentUpdater(e) {
    this.componentUpdater = e;
  }
  getRowHeight() {
    return this.rowHeight;
  }
  getScrollTop() {
    return this.getGui().scrollTop;
  }
  setRowHeight(e) {
    this.isHeightFromTheme = !1, this.rowHeight = e, this.refresh();
  }
  refresh(e) {
    if (this.model == null || !this.isAlive())
      return;
    const t = this.model.getRowCount();
    this.eContainer.style.height = `${t * this.rowHeight}px`, this.refreshAriaProperties(), this.awaitStable(() => {
      this.isAlive() && (this.canSoftRefresh(e) ? this.drawVirtualRows(!0) : (this.clearVirtualRows(), this.drawVirtualRows()));
    });
  }
  awaitStable(e) {
    if (this.awaitStableCallbacks.push(e), this.awaitStableCallbacks.length > 1)
      return;
    const t = this.model.getRowCount();
    Ug(
      this,
      () => this.eContainer.clientHeight >= t * this.rowHeight,
      () => {
        if (!this.isAlive())
          return;
        const s = this.awaitStableCallbacks;
        this.awaitStableCallbacks = [], s.forEach((i) => i());
      }
    );
  }
  canSoftRefresh(e) {
    return !!(e && this.renderedRows.size && typeof this.model.areRowsEqual == "function" && this.componentUpdater);
  }
  clearVirtualRows() {
    this.renderedRows.forEach((e, t) => this.removeRow(t));
  }
  drawVirtualRows(e) {
    if (!this.isAlive() || !this.model)
      return;
    const t = this.getGui(), s = t.scrollTop, i = s + t.offsetHeight;
    if (s === i)
      this.clearVirtualRows();
    else {
      const r = Math.floor(s / this.rowHeight), n = Math.floor(i / this.rowHeight);
      this.pageSize = Math.floor((i - s) / this.rowHeight), this.ensureRowsRendered(r, n, e);
    }
  }
  ensureRowsRendered(e, t, s) {
    this.renderedRows.forEach((i, r) => {
      (r < e || r > t) && r !== this.lastFocusedRowIndex && this.removeRow(r);
    }), s && this.refreshRows();
    for (let i = e; i <= t; i++)
      this.renderedRows.has(i) || i < this.model.getRowCount() && this.insertRow(i);
  }
  insertRow(e) {
    const t = this.model.getRow(e), s = this.ariaRole === "tree" ? "treeitem" : "option", i = K({
      tag: "div",
      cls: `ag-virtual-list-item ag-${this.cssIdentifier}-virtual-list-item`,
      role: s,
      attrs: { tabindex: "-1" }
    });
    Jo(i, this.model.getRowCount()), ea(i, e + 1), i.style.height = `${this.rowHeight}px`, i.style.top = `${this.rowHeight * e}px`;
    const r = this.componentCreator(t, i);
    r.addGuiEventListener("focusin", () => this.lastFocusedRowIndex = e), i.appendChild(r.getGui()), this.renderedRows.has(e - 1) ? this.renderedRows.get(e - 1).eDiv.insertAdjacentElement("afterend", i) : this.renderedRows.has(e + 1) ? this.renderedRows.get(e + 1).eDiv.insertAdjacentElement("beforebegin", i) : this.eContainer.appendChild(i), this.renderedRows.set(e, { rowComponent: r, eDiv: i, value: t });
  }
  removeRow(e) {
    const t = this.renderedRows.get(e);
    this.eContainer.removeChild(t.eDiv), this.destroyBean(t.rowComponent), this.renderedRows.delete(e);
  }
  refreshRows() {
    const e = this.model.getRowCount();
    this.renderedRows.forEach((t, s) => {
      var i, r;
      if (s >= e)
        this.removeRow(s);
      else {
        const n = this.model.getRow(s);
        (r = (i = this.model).areRowsEqual) != null && r.call(i, t.value, n) ? this.componentUpdater(n, t.rowComponent) : this.removeRow(s);
      }
    });
  }
  addScrollListener() {
    this.addGuiEventListener("scroll", () => this.drawVirtualRows(), { passive: !0 });
  }
  setModel(e) {
    this.model = e;
  }
  getAriaElement() {
    return this.eContainer;
  }
  destroy() {
    this.isAlive() && (this.clearVirtualRows(), this.awaitStableCallbacks.length = 0, super.destroy());
  }
}, I1 = {
  tag: "div",
  cls: "ag-autocomplete-row",
  role: "presentation",
  children: [{ tag: "div", cls: "ag-autocomplete-row-label" }]
}, L1 = class extends D {
  constructor() {
    super(I1), this.hasHighlighting = !1;
  }
  setState(e, t) {
    this.value = e, this.render(), this.updateSelected(t);
  }
  updateSelected(e) {
    this.toggleCss("ag-autocomplete-row-selected", e);
  }
  setSearchString(e) {
    let t = !1;
    const { value: s } = this;
    if (s && A(e)) {
      const i = s.toLocaleLowerCase().indexOf(e.toLocaleLowerCase());
      if (i >= 0) {
        t = !0, this.hasHighlighting = !0;
        const r = i + e.length, n = this.getGui().lastElementChild;
        X(n), n.append(
          // Start part
          s.slice(0, i),
          // Highlighted part wrapped in bold tag
          K({ tag: "b", children: s.slice(i, r) }),
          // End part
          s.slice(r)
        );
      }
    }
    !t && this.hasHighlighting && (this.hasHighlighting = !1, this.render());
  }
  render() {
    this.getGui().lastElementChild.textContent = this.value ?? " ";
  }
}, k1 = {
  tag: "div",
  cls: "ag-autocomplete-list-popup",
  children: [
    {
      tag: "div",
      ref: "eList",
      cls: "ag-autocomplete-list"
    }
  ]
}, G1 = class extends ha {
  constructor(e) {
    super(k1), this.params = e, this.eList = x, this.searchString = "";
  }
  postConstruct() {
    this.autocompleteEntries = this.params.autocompleteEntries, this.virtualList = this.createManagedBean(new yr({ cssIdentifier: "autocomplete" })), this.virtualList.setComponentCreator(this.createRowComponent.bind(this)), this.eList.appendChild(this.virtualList.getGui()), this.virtualList.setModel({
      getRowCount: () => this.autocompleteEntries.length,
      getRow: (t) => this.autocompleteEntries[t]
    });
    const e = this.virtualList.getGui();
    this.addManagedListeners(e, {
      click: () => this.params.onConfirmed(),
      mousemove: this.onMouseMove.bind(this),
      mousedown: (t) => t.preventDefault()
    }), this.setSelectedValue(0);
  }
  onNavigationKeyDown(e, t) {
    e.preventDefault();
    const s = this.autocompleteEntries.indexOf(this.selectedValue), i = t === S.UP ? s - 1 : s + 1;
    this.checkSetSelectedValue(i);
  }
  setSearch(e) {
    this.searchString = e, A(e) ? this.runSearch() : (this.autocompleteEntries = this.params.autocompleteEntries, this.virtualList.refresh(), this.checkSetSelectedValue(0)), this.updateSearchInList();
  }
  runContainsSearch(e, t) {
    let s, i = !1;
    const r = e.toLocaleLowerCase(), n = t.filter((o) => {
      const l = o.toLocaleLowerCase().indexOf(r), c = l === 0, d = l >= 0;
      return d && (!s || !i && c || i === c && o.length < s.length) && (s = o, i = c), d;
    });
    return !s && n.length && (s = n[0]), { topMatch: s, allMatches: n };
  }
  runSearch() {
    const { autocompleteEntries: e, useFuzzySearch: t, forceLastSelection: s } = this.params, i = e.map((l) => l.displayValue ?? l.key);
    let r, n;
    if (t)
      r = on({
        inputValue: this.searchString,
        allSuggestions: i,
        hideIrrelevant: !0
      }).values, n = r.length ? r[0] : void 0;
    else {
      const l = this.runContainsSearch(this.searchString, i);
      r = l.allMatches, n = l.topMatch;
    }
    let o = e.filter(
      ({ key: l, displayValue: c }) => r.includes(c ?? l)
    );
    if (!o.length && this.selectedValue && (s != null && s(this.selectedValue, this.searchString)) && (o = [this.selectedValue]), this.autocompleteEntries = o, this.virtualList.refresh(), !n)
      return;
    const a = r.indexOf(n);
    this.checkSetSelectedValue(a);
  }
  updateSearchInList() {
    this.virtualList.forEachRenderedRow((e) => e.setSearchString(this.searchString));
  }
  checkSetSelectedValue(e) {
    e >= 0 && e < this.autocompleteEntries.length && this.setSelectedValue(e);
  }
  setSelectedValue(e) {
    const t = this.autocompleteEntries[e];
    this.selectedValue !== t && (this.selectedValue = t, this.virtualList.ensureIndexVisible(e), this.virtualList.forEachRenderedRow((s, i) => {
      s.updateSelected(e === i);
    }));
  }
  createRowComponent(e) {
    const t = new L1();
    return this.createBean(t), t.setState(e.displayValue ?? e.key, e === this.selectedValue), t;
  }
  onMouseMove(e) {
    const t = this.virtualList, s = t.getGui().getBoundingClientRect(), i = t.getScrollTop(), r = e.clientY - s.top + i, n = Math.floor(r / t.getRowHeight());
    this.checkSetSelectedValue(n);
  }
  afterGuiAttached() {
    this.virtualList.refresh();
  }
  getSelectedValue() {
    return this.autocompleteEntries.length ? this.selectedValue ?? null : null;
  }
}, O1 = {
  tag: "div",
  cls: "ag-autocomplete",
  role: "presentation",
  children: [
    {
      tag: "ag-input-text-field",
      ref: "eAutocompleteInput"
    }
  ]
}, V1 = class extends D {
  constructor() {
    super(O1, [It]), this.eAutocompleteInput = x, this.isListOpen = !1, this.lastPosition = 0, this.valid = !0, this.registerCSS(D1);
  }
  wireBeans(e) {
    this.popupSvc = e.popupSvc;
  }
  postConstruct() {
    this.eAutocompleteInput.onValueChange((e) => this.onValueChanged(e)), this.eAutocompleteInput.getInputElement().setAttribute("autocomplete", "off"), this.addGuiEventListener("keydown", this.onKeyDown.bind(this)), this.addGuiEventListener("click", this.updatePositionAndList.bind(this)), this.addDestroyFunc(() => {
      this.destroyBean(this.autocompleteList);
    }), this.addGuiEventListener("focusout", () => this.onFocusOut());
  }
  onValueChanged(e) {
    const t = Ce(e);
    this.updateValue(t), this.updateAutocompleteList(t);
  }
  updateValue(e) {
    this.updateLastPosition(), this.dispatchLocalEvent({
      type: "eventValueChanged",
      value: e
    }), this.validate(e);
  }
  updateAutocompleteList(e) {
    var i, r;
    const t = ((i = this.listGenerator) == null ? void 0 : i.call(this, e, this.lastPosition)) ?? { enabled: !1 };
    (!t.type || t.type !== ((r = this.autocompleteListParams) == null ? void 0 : r.type)) && this.isListOpen && this.closeList();
    const s = this.isListOpen;
    if (this.autocompleteListParams = t, t != null && t.enabled) {
      s || this.openList();
      const { searchString: n } = t;
      this.autocompleteList.setSearch(n ?? "");
    } else
      s && this.closeList();
  }
  onKeyDown(e) {
    const t = e.key;
    switch (this.updateLastPosition(), t) {
      case S.ENTER:
        this.onEnterKeyDown(e);
        break;
      case S.TAB:
        this.onTabKeyDown(e);
        break;
      case S.DOWN:
      case S.UP:
        this.onUpDownKeyDown(e, t);
        break;
      case S.LEFT:
      case S.RIGHT:
      case S.PAGE_HOME:
      case S.PAGE_END:
        setTimeout(() => {
          this.updatePositionAndList();
        });
        break;
      case S.ESCAPE:
        this.onEscapeKeyDown(e);
        break;
      case S.SPACE:
        e.ctrlKey && !this.isListOpen && (e.preventDefault(), this.forceOpenList());
        break;
    }
  }
  confirmSelection() {
    var t;
    const e = (t = this.autocompleteList) == null ? void 0 : t.getSelectedValue();
    e && (this.closeList(), this.dispatchLocalEvent({
      type: "eventOptionSelected",
      value: this.getValue(),
      position: this.lastPosition,
      updateEntry: e,
      autocompleteType: this.autocompleteListParams.type
    }));
  }
  onTabKeyDown(e) {
    this.isListOpen && (e.preventDefault(), e.stopPropagation(), this.confirmSelection());
  }
  onEnterKeyDown(e) {
    e.preventDefault(), this.isListOpen ? this.confirmSelection() : this.onCompleted();
  }
  onUpDownKeyDown(e, t) {
    var s;
    e.preventDefault(), this.isListOpen ? (s = this.autocompleteList) == null || s.onNavigationKeyDown(e, t) : this.forceOpenList();
  }
  onEscapeKeyDown(e) {
    this.isListOpen && (e.preventDefault(), e.stopPropagation(), this.closeList(), this.setCaret(this.lastPosition, !0));
  }
  onFocusOut() {
    this.isListOpen && this.closeList();
  }
  updatePositionAndList() {
    this.updateLastPosition(), this.updateAutocompleteList(this.eAutocompleteInput.getValue() ?? null);
  }
  setCaret(e, t) {
    (t || Jt(this.beans)) && this.eAutocompleteInput.getFocusableElement().focus();
    const s = this.eAutocompleteInput.getInputElement();
    s.setSelectionRange(e, e), e === s.value.length && (s.scrollLeft = s.scrollWidth);
  }
  forceOpenList() {
    this.onValueChanged(this.eAutocompleteInput.getValue());
  }
  updateLastPosition() {
    this.lastPosition = this.eAutocompleteInput.getInputElement().selectionStart ?? 0;
  }
  validate(e) {
    if (!this.validator)
      return;
    const t = this.validationMessage = this.validator(e);
    this.eAutocompleteInput.getInputElement().setCustomValidity(t ?? ""), this.valid = !t, this.dispatchLocalEvent({
      type: "eventValidChanged",
      isValid: this.valid,
      validationMessage: t
    });
  }
  openList() {
    this.isListOpen = !0, this.autocompleteList = this.createBean(
      new G1({
        autocompleteEntries: this.autocompleteListParams.entries,
        onConfirmed: () => this.confirmSelection(),
        forceLastSelection: this.forceLastSelection
      })
    );
    const e = this.autocompleteList.getGui(), t = {
      ePopup: e,
      type: "autocomplete",
      eventSource: this.getGui(),
      position: "under",
      alignSide: this.gos.get("enableRtl") ? "right" : "left",
      keepWithinBounds: !0
    }, s = this.popupSvc.addPopup({
      eChild: e,
      anchorToElement: this.getGui(),
      positionCallback: () => this.popupSvc.positionPopupByComponent(t),
      ariaLabel: this.listAriaLabel
    });
    this.hidePopup = s.hideFunc, this.autocompleteList.afterGuiAttached();
  }
  closeList() {
    this.isListOpen = !1, this.hidePopup(), this.destroyBean(this.autocompleteList), this.autocompleteList = null;
  }
  onCompleted() {
    this.isListOpen && this.closeList(), this.dispatchLocalEvent({
      type: "eventValueConfirmed",
      value: this.getValue(),
      isValid: this.isValid()
    });
  }
  getValue() {
    return Ce(this.eAutocompleteInput.getValue());
  }
  setInputPlaceholder(e) {
    return this.eAutocompleteInput.setInputPlaceholder(e), this;
  }
  setInputAriaLabel(e) {
    return this.eAutocompleteInput.setInputAriaLabel(e), this;
  }
  setListAriaLabel(e) {
    return this.listAriaLabel = e, this;
  }
  setListGenerator(e) {
    return this.listGenerator = e, this;
  }
  setValidator(e) {
    return this.validator = e, this;
  }
  isValid() {
    return this.valid;
  }
  setValue(e) {
    const { value: t, position: s, silent: i, updateListOnlyIfOpen: r, restoreFocus: n } = e;
    this.eAutocompleteInput.setValue(t, !0), this.setCaret(s ?? this.lastPosition, n), i || this.updateValue(t), (!r || this.isListOpen) && this.updateAutocompleteList(t);
  }
  setForceLastSelection(e) {
    return this.forceLastSelection = e, this;
  }
  setInputDisabled(e) {
    return this.eAutocompleteInput.setDisabled(e), this;
  }
}, B1 = {
  selector: "AG-AUTOCOMPLETE",
  component: V1
}, yl = {
  buttons: ["apply"],
  suppressBuilderButton: !1
}, Iu = {
  apply: "advancedFilterApply",
  clear: "advancedFilterClear",
  cancel: "advancedFilterCancel",
  reset: "advancedFilterReset"
}, N1 = {
  tag: "div",
  cls: "ag-advanced-filter",
  role: "presentation",
  attrs: { tabindex: "-1" },
  children: [
    { tag: "ag-autocomplete", ref: "eAutocomplete" },
    {
      tag: "ag-filter-button",
      ref: "eButtons",
      cls: "ag-advanced-filter-buttons"
    },
    {
      tag: "button",
      ref: "eBuilderFilterButton",
      cls: "ag-button ag-advanced-filter-builder-button",
      children: [
        { tag: "span", ref: "eBuilderFilterButtonIcon", attrs: { "aria-hidden": "true" } },
        { tag: "span", ref: "eBuilderFilterButtonLabel", cls: "ag-advanced-filter-builder-button-label" }
      ]
    }
  ]
}, hC = class extends D {
  constructor() {
    super(N1, [B1, hS]), this.eAutocomplete = x, this.eButtons = x, this.eBuilderFilterButton = x, this.eBuilderFilterButtonIcon = x, this.eBuilderFilterButtonLabel = x, this.expressionParser = null, this.isApplyDisabled = !0, this.builderOpen = !1;
  }
  wireBeans(e) {
    this.advFilterExpSvc = e.advFilterExpSvc, this.advancedFilter = e.advancedFilter, this.filterManager = e.filterManager, this.registry = e.registry;
  }
  postConstruct() {
    this.tooltipFeature = this.createOptionalManagedBean(
      this.registry.createDynamicBean("tooltipFeature", !1, {
        getGui: () => this.getGui(),
        getTooltipShowDelayOverride: () => 1e3,
        getLocation: () => "advancedFilter"
      })
    ), this.eAutocomplete.setListGenerator((s, i) => this.generateAutocompleteListParams(i)).setValidator(() => this.validateValue()).setForceLastSelection(
      (s, i) => this.forceLastSelection(s, i)
    ).setInputAriaLabel(this.advFilterExpSvc.translate("ariaAdvancedFilterInput")).setListAriaLabel(this.advFilterExpSvc.translate("ariaLabelAdvancedFilterAutocomplete")), this.refresh(), this.addManagedListeners(this.eAutocomplete, {
      eventValueChanged: ({ value: s }) => this.onValueChanged(s),
      eventValueConfirmed: ({ isValid: s }) => this.onValueConfirmed(s),
      eventOptionSelected: ({ position: s, updateEntry: i, autocompleteType: r }) => this.onOptionSelected(s, i, r),
      eventValidChanged: ({ isValid: s, validationMessage: i }) => this.onValidChanged(s, i)
    });
    const { buttons: e, suppressBuilderButton: t } = {
      ...yl,
      ...this.gos.get("advancedFilterParams")
    };
    this.setupButtons(e), this.setupBuilderButton(t), this.beans.gos.addManagedPropertyListener("advancedFilterParams", (s) => {
      const i = { ...yl, ...s.currentValue }, r = { ...yl, ...s.previousValue };
      if (i.buttons !== r.buttons) {
        const n = i.buttons.map((o) => ({
          type: o,
          label: this.advFilterExpSvc.translate(Iu[o])
        }));
        this.eButtons.updateButtons(n);
      }
      i.suppressBuilderButton !== r.suppressBuilderButton && O(this.eBuilderFilterButton, !i.suppressBuilderButton);
    });
  }
  refresh() {
    const e = this.advancedFilter.getExpressionDisplayValue();
    this.eAutocomplete.setValue({
      value: e ?? "",
      position: e == null ? void 0 : e.length,
      updateListOnlyIfOpen: !0
    });
  }
  setInputDisabled(e) {
    this.eAutocomplete.setInputDisabled(e), this.eButtons.updateValidity(
      !e && !this.isApplyDisabled && !this.advancedFilter.isCurrentExpressionApplied()
    );
  }
  setupButtons(e) {
    const t = e.map((i) => ({
      type: i,
      label: this.advFilterExpSvc.translate(Iu[i])
    })), s = (i) => () => {
      this.updateModel(i);
    };
    this.eButtons.addManagedListeners(this.eButtons, {
      apply: s("apply"),
      clear: s("clear"),
      reset: s("reset"),
      cancel: s("cancel")
    }), this.eButtons.updateButtons(t);
  }
  updateModel(e) {
    var t, s;
    switch (e) {
      case "apply":
        this.onValueConfirmed(this.eAutocomplete.isValid());
        break;
      case "reset":
        this.advancedFilter.setModel(null), (t = this.filterManager) == null || t.onFilterChanged({ source: "advancedFilter" });
        break;
      case "cancel":
        this.advancedFilter.setModel(this.advancedFilter.getModel()), (s = this.filterManager) == null || s.onFilterChanged({ source: "advancedFilter" });
        break;
      case "clear":
        this.eAutocomplete.setValue({
          value: "",
          restoreFocus: !0
        });
        break;
    }
  }
  setupBuilderButton(e) {
    this.eBuilderFilterButtonIcon.appendChild(N("advancedFilterBuilder", this.beans)), this.eBuilderFilterButtonLabel.textContent = this.advFilterExpSvc.translate("advancedFilterBuilder"), this.activateTabIndex([this.eBuilderFilterButton]), this.addManagedElementListeners(this.eBuilderFilterButton, { click: () => this.openBuilder() }), this.addManagedListeners(this.advancedFilter.getCtrl(), {
      advancedFilterBuilderClosed: () => this.closeBuilder()
    }), O(this.eBuilderFilterButton, !e);
  }
  onValueChanged(e) {
    var s;
    e = Ce(e), this.advancedFilter.setExpressionDisplayValue(e), this.expressionParser = this.advancedFilter.createExpressionParser(e);
    const t = (s = this.expressionParser) == null ? void 0 : s.parseExpression();
    t && t !== e && this.eAutocomplete.setValue({ value: t, silent: !0, restoreFocus: !0 });
  }
  onValueConfirmed(e) {
    var t, s;
    !e || this.isApplyDisabled || ((t = this.eButtons) == null || t.updateValidity(!1), this.advancedFilter.applyExpression(), (s = this.filterManager) == null || s.onFilterChanged({ source: "advancedFilter" }));
  }
  onOptionSelected(e, t, s) {
    const { updatedValue: i, updatedPosition: r, hideAutocomplete: n } = this.updateExpression(e, t, s);
    this.eAutocomplete.setValue({
      value: i,
      position: r,
      updateListOnlyIfOpen: n,
      restoreFocus: !0
    });
  }
  validateValue() {
    var e, t;
    return (e = this.expressionParser) != null && e.isValid() ? null : ((t = this.expressionParser) == null ? void 0 : t.getValidationMessage()) ?? null;
  }
  onValidChanged(e, t) {
    var s;
    this.isApplyDisabled = !e || this.advancedFilter.isCurrentExpressionApplied(), this.eButtons.updateValidity(!this.isApplyDisabled), (s = this.tooltipFeature) == null || s.setTooltipAndRefresh(t);
  }
  generateAutocompleteListParams(e) {
    return this.expressionParser ? this.expressionParser.getAutocompleteListParams(e) : this.advFilterExpSvc.getDefaultAutocompleteListParams("");
  }
  updateExpression(e, t, s) {
    var i;
    return this.advFilterExpSvc.updateAutocompleteCache(t, s), ((i = this.expressionParser) == null ? void 0 : i.updateExpression(e, t, s)) ?? this.advancedFilter.getDefaultExpression(t);
  }
  forceLastSelection({ key: e, displayValue: t }, s) {
    return !!s.toLocaleLowerCase().match(`^${(t ?? e).toLocaleLowerCase()}\\s*$`);
  }
  openBuilder() {
    this.builderOpen || (this.builderOpen = !0, Fi(this.eBuilderFilterButton, !0), this.advancedFilter.getCtrl().toggleFilterBuilder({ source: "ui", eventSource: this.eBuilderFilterButton }));
  }
  closeBuilder() {
    this.builderOpen && (this.builderOpen = !1, Fi(this.eBuilderFilterButton, !1), this.eBuilderFilterButton.focus());
  }
}, H1 = {
  tag: "div",
  cls: "ag-advanced-filter-header",
  role: "row"
}, z1 = class extends D {
  constructor(e) {
    super(H1), this.enabled = e;
  }
  wireBeans(e) {
    this.colModel = e.colModel, this.focusSvc = e.focusSvc, this.ctrlsSvc = e.ctrlsSvc;
  }
  postConstruct() {
    this.setupAdvancedFilter(this.enabled), this.addDestroyFunc(() => this.destroyBean(this.eAdvancedFilter));
    const e = () => {
      this.enabled && this.setEnabledHeight();
    };
    this.addManagedEventListeners({
      gridColumnsChanged: () => this.onGridColumnsChanged(),
      columnHeaderHeightChanged: e,
      gridStylesChanged: e
    }), this.addManagedPropertyListener("headerHeight", e), this.addManagedPropertyListener("floatingFiltersHeight", e), this.addGuiEventListener("keydown", (t) => this.onKeyDown(t)), this.addGuiEventListener("focusout", (t) => {
      this.getFocusableElement().contains(t.relatedTarget) || this.focusSvc.clearAdvancedFilterColumn();
    });
  }
  getFocusableElement() {
    var e;
    return ((e = this.eAdvancedFilter) == null ? void 0 : e.getGui()) ?? this.getGui();
  }
  setEnabled(e) {
    e !== this.enabled && this.setupAdvancedFilter(e);
  }
  refresh() {
    var e;
    (e = this.eAdvancedFilter) == null || e.refresh();
  }
  getHeight() {
    return this.height;
  }
  setInputDisabled(e) {
    var t;
    (t = this.eAdvancedFilter) == null || t.setInputDisabled(e);
  }
  setupAdvancedFilter(e) {
    const t = this.getGui();
    if (e) {
      this.eAdvancedFilter = this.createBean(new hC());
      const s = this.eAdvancedFilter.getGui();
      this.eAdvancedFilter.addCss("ag-advanced-filter-header-cell"), this.setEnabledHeight(), this.setAriaRowIndex(), Ye(s, "gridcell"), Lc(s, 1), this.setAriaColumnCount(s), t.appendChild(s);
    } else
      X(t), this.destroyBean(this.eAdvancedFilter), this.height = 0;
    O(t, e), this.enabled = e;
  }
  setEnabledHeight() {
    const e = this.getGui();
    this.height = Cd(this.beans);
    const t = `${this.height}px`;
    e.style.height = t, e.style.minHeight = t;
  }
  setAriaColumnCount(e) {
    Ag(e, this.colModel.getCols().length);
  }
  setAriaRowIndex() {
    var e;
    en(this.getGui(), ((e = this.ctrlsSvc.getHeaderRowContainerCtrl()) == null ? void 0 : e.getRowCount()) ?? 0);
  }
  onGridColumnsChanged() {
    this.eAdvancedFilter && (this.setAriaColumnCount(this.eAdvancedFilter.getGui()), this.setAriaRowIndex());
  }
  onKeyDown(e) {
    switch (e.key) {
      case S.ENTER: {
        this.hasFocus() && ye(this.getFocusableElement()) && e.preventDefault();
        break;
      }
      case S.ESCAPE:
        this.hasFocus() || this.getFocusableElement().focus();
        break;
      case S.UP:
        this.navigateUpDown(!0, e);
        break;
      case S.DOWN:
        this.navigateUpDown(!1, e);
        break;
      case S.TAB:
        if (this.hasFocus())
          this.navigateLeftRight(e);
        else {
          const t = ze(
            this.beans,
            this.getFocusableElement(),
            null,
            e.shiftKey
          );
          t ? (e.preventDefault(), t.focus()) : this.navigateLeftRight(e);
        }
        break;
    }
  }
  navigateUpDown(e, t) {
    this.hasFocus() && this.focusSvc.focusNextFromAdvancedFilter(e) && t.preventDefault();
  }
  navigateLeftRight(e) {
    (e.shiftKey ? this.focusSvc.focusLastHeader() : this.focusSvc.focusNextFromAdvancedFilter(!1, !0)) && e.preventDefault();
  }
  hasFocus() {
    return Q(this.beans) === this.getFocusableElement();
  }
}, Sl = "ag-list-item-hovered", uC = class extends R {
  constructor(e, t, s) {
    super(), this.comp = e, this.virtualList = t, this.params = s, this.currentDragValue = null, this.lastHoveredListItem = null;
  }
  wireBeans(e) {
    this.dragAndDrop = e.dragAndDrop;
  }
  postConstruct() {
    this.addManagedListeners(this.params.eventSource, {
      [this.params.listItemDragStartEvent]: this.listItemDragStart.bind(this),
      [this.params.listItemDragEndEvent]: this.listItemDragEnd.bind(this)
    }), this.createDropTarget(), this.createAutoScrollService();
  }
  listItemDragStart(e) {
    this.currentDragValue = this.params.getCurrentDragValue(e), this.moveBlocked = this.params.isMoveBlocked(this.currentDragValue);
  }
  listItemDragEnd() {
    window.setTimeout(() => {
      this.currentDragValue = null, this.moveBlocked = !1;
    }, 10);
  }
  createDropTarget() {
    var t;
    const e = {
      isInterestedIn: (s) => s === this.params.dragSourceType,
      getIconName: () => this.moveBlocked ? "pinned" : "move",
      getContainer: () => this.comp.getGui(),
      onDragging: (s) => this.onDragging(s),
      onDragStop: () => this.onDragStop(),
      onDragLeave: () => this.onDragLeave(),
      onDragCancel: () => this.onDragCancel()
    };
    (t = this.dragAndDrop) == null || t.addDropTarget(e);
  }
  createAutoScrollService() {
    const e = this.virtualList.getGui();
    this.autoScrollService = new yd({
      scrollContainer: e,
      scrollAxis: "y",
      getVerticalPosition: () => e.scrollTop,
      setVerticalPosition: (t) => e.scrollTop = t
    });
  }
  onDragging(e) {
    if (!this.currentDragValue || this.moveBlocked)
      return;
    const t = this.getListDragItem(e), s = this.virtualList.getComponentAt(t.rowIndex);
    if (!s)
      return;
    const i = s.getGui().parentElement;
    this.lastHoveredListItem && this.lastHoveredListItem.rowIndex === t.rowIndex && this.lastHoveredListItem.position === t.position || (this.autoScrollService.check(e.event), this.clearHoveredItems(), this.lastHoveredListItem = t, bo(i, Sl), bo(i, `ag-item-highlight-${t.position}`));
  }
  getListDragItem(e) {
    const t = this.virtualList.getGui(), s = parseFloat(window.getComputedStyle(t).paddingTop), i = this.virtualList.getRowHeight(), r = this.virtualList.getScrollTop(), n = Math.max(0, (e.y - s + r) / i), o = this.params.getNumRows(this.comp) - 1, a = Math.min(o, n) | 0;
    return {
      rowIndex: a,
      position: Math.round(n) > n || n > o ? "bottom" : "top",
      component: this.virtualList.getComponentAt(a)
    };
  }
  onDragStop() {
    this.moveBlocked || (this.params.moveItem(this.currentDragValue, this.lastHoveredListItem), this.clearDragProperties());
  }
  onDragCancel() {
    this.clearDragProperties();
  }
  onDragLeave() {
    this.clearDragProperties();
  }
  clearDragProperties() {
    this.clearHoveredItems(), this.autoScrollService.ensureCleared();
  }
  clearHoveredItems() {
    this.virtualList.getGui().querySelectorAll(`.${Sl}`).forEach((t) => {
      [Sl, "ag-item-highlight-top", "ag-item-highlight-bottom"].forEach((s) => {
        t.classList.remove(s);
      });
    }), this.lastHoveredListItem = null;
  }
}, W1 = class extends R {
  constructor(e, t) {
    super(), this.comp = e, this.virtualList = t;
  }
  postConstruct() {
    this.createManagedBean(
      new uC(this.comp, this.virtualList, {
        dragSourceType: zt.AdvancedFilterBuilder,
        listItemDragStartEvent: "advancedFilterBuilderDragStarted",
        listItemDragEndEvent: "advancedFilterBuilderDragEnded",
        eventSource: this,
        getCurrentDragValue: (e) => this.getCurrentDragValue(e),
        isMoveBlocked: () => !1,
        getNumRows: (e) => e.getNumItems(),
        moveItem: (e, t) => this.moveItem(e, t)
      })
    );
  }
  getCurrentDragValue(e) {
    return e.item;
  }
  moveItem(e, t) {
    this.comp.moveItem(e, t);
  }
}, _1 = {
  tag: "div",
  cls: "ag-pill",
  role: "option",
  children: [
    {
      tag: "span",
      ref: "eText",
      cls: "ag-pill-text"
    },
    {
      tag: "span",
      ref: "eButton",
      cls: "ag-button ag-pill-button",
      role: "presentation"
    }
  ]
}, U1 = class extends D {
  constructor(e) {
    super(_1), this.config = e, this.eText = x, this.eButton = x;
  }
  postConstruct() {
    const { config: e, eButton: t } = this, { onKeyDown: s, onButtonClick: i } = e;
    this.getGui().setAttribute("tabindex", String(this.gos.get("tabIndex"))), this.addGuiEventListener("focus", () => {
      this.eButton.focus();
    }), s && this.addGuiEventListener("keydown", s), i && this.addManagedElementListeners(t, {
      click: i
    });
  }
  toggleCloseButtonClass(e, t) {
    this.eButton.classList.toggle(e, t);
  }
  setText(e) {
    this.eText.textContent = e;
  }
  getText() {
    return this.eText.textContent;
  }
}, $1 = {
  tag: "div",
  cls: "ag-pill-container"
}, K1 = class extends D {
  constructor() {
    super($1), this.pills = [];
  }
  init(e) {
    this.params = e, this.refresh();
  }
  refresh() {
    this.clearPills();
    const { params: e, onPillKeyDown: t } = this;
    let s = e.getValue();
    if (!Array.isArray(s)) {
      if (s == null)
        return;
      s = [s];
    }
    const i = e.valueFormatter ?? ((n) => String(n)), r = s.length;
    Ye(this.getGui(), r === 0 ? "presentation" : "listbox");
    for (let n = 0; n < r; n++) {
      const o = s[n], a = this.createBean(
        new U1({
          onButtonClick: () => this.onPillButtonClick(a),
          onKeyDown: t.bind(this)
        })
      ), l = a.getGui();
      ea(l, n + 1), Jo(l, r), e.onPillMouseDown && a.addGuiEventListener("mousedown", e.onPillMouseDown), e.announceItemFocus && a.addGuiEventListener("focus", e.announceItemFocus), a.setText(i(o) ?? ""), a.toggleCloseButtonClass("ag-icon-cancel", !0), this.appendChild(l), this.pills.push(a);
    }
  }
  onNavigationKeyDown(e) {
    const { key: t } = e;
    if (!this.pills.length || t !== S.LEFT && t !== S.RIGHT)
      return;
    e.preventDefault();
    const { params: s, beans: i } = this, r = Q(i), n = this.getGui();
    if (n.contains(r)) {
      const o = ze(i, n, !1, t === S.LEFT);
      o ? o.focus() : s.eWrapper && s.eWrapper.focus();
    } else {
      const o = Vt(n);
      o.length > 0 && o[t === S.RIGHT ? 0 : o.length - 1].focus();
    }
  }
  clearPills() {
    const e = this.getGui();
    e.contains(Q(this.beans)) && this.params.eWrapper && this.params.eWrapper.focus(), X(e), this.destroyBeans(this.pills), this.pills = [];
  }
  onPillButtonClick(e) {
    this.deletePill(e);
  }
  onPillKeyDown(e) {
    const t = e.key;
    if (t !== S.DELETE && t !== S.BACKSPACE)
      return;
    e.preventDefault();
    const s = me(this.beans), i = this.pills.findIndex((n) => n.getGui().contains(s.activeElement));
    if (i === -1)
      return;
    const r = this.pills[i];
    r && this.deletePill(r, i);
  }
  deletePill(e, t) {
    const s = e.getText(), i = (this.params.getValue() || []).filter((r) => r !== s);
    if (this.params.setValue(i), !i.length && this.params.eWrapper)
      this.params.eWrapper.focus();
    else if (t != null) {
      const r = this.pills[Math.min(t, this.pills.length - 1)];
      r && r.getFocusableElement().focus();
    }
  }
  destroy() {
    this.clearPills(), super.destroy();
  }
}, j1 = (
  /*css*/
  ".ag-rich-select{cursor:default;height:100%}.ag-rich-select-value{align-items:center;background-color:var(--ag-picker-button-background-color);display:flex;height:100%;padding:var(--ag-spacing);:where(.ag-picker-field-display){overflow:hidden;text-overflow:ellipsis;&:where(.ag-display-as-placeholder){opacity:.5}}}.ag-rich-select-list{background-color:var(--ag-picker-list-background-color);border:var(--ag-picker-list-border);border-radius:var(--ag-input-border-radius);box-shadow:var(--ag-dropdown-shadow);height:auto;position:relative;width:100%;:where(.ag-loading-text){padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding)}}.ag-rich-select-row{align-items:center;display:flex;flex:1 1 auto;height:100%;overflow:hidden;padding:0 var(--ag-spacing);white-space:nowrap}.ag-rich-select-row-selected{background-color:var(--ag-selected-row-background-color)}.ag-rich-select-row-highlighted,.ag-rich-select-row:hover{background-image:linear-gradient(var(--ag-row-hover-color),var(--ag-row-hover-color))}.ag-rich-select-row-text-highlight{font-weight:700}.ag-rich-select-field-input{flex:1 1 auto;:where(.ag-input-field-input){border:none!important;box-shadow:none!important;padding:0!important;text-overflow:ellipsis;&::-moz-placeholder{opacity:.8}&::placeholder{opacity:.8}}}:where(.ag-ltr) .ag-rich-select-field-input{left:var(--ag-spacing)}:where(.ag-rtl) .ag-rich-select-field-input{right:var(--ag-spacing)}:where(.ag-popup-editor) .ag-rich-select-value{height:var(--ag-row-height);min-width:200px}.ag-rich-select-virtual-list-item{cursor:default;height:var(--ag-list-item-height)}.ag-pill-container{display:flex;flex-wrap:nowrap;gap:.25rem}.ag-pill{align-items:center;background:var(--ag-select-cell-background-color);border:var(--ag-select-cell-border);border-radius:var(--ag-border-radius);display:flex;padding:0 .25rem;white-space:nowrap}.ag-pill-button{border:none;padding:0;&:hover{color:var(--ag-accent-color);cursor:pointer}}:where(.ag-ltr) .ag-pill-button{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-pill-button{margin-right:var(--ag-spacing)}"
), Y1 = { tag: "div", cls: "ag-rich-select-row", role: "presentation" }, q1 = class extends D {
  constructor(e) {
    super(Y1), this.params = e;
  }
  wireBeans(e) {
    this.userCompFactory = e.userCompFactory, this.registry = e.registry;
  }
  postConstruct() {
    this.tooltipFeature = this.createOptionalManagedBean(
      this.registry.createDynamicBean(
        "highlightTooltipFeature",
        !1,
        {
          getGui: () => this.getGui(),
          shouldDisplayTooltip: () => {
            var e;
            return ((e = this.shouldDisplayTooltip) == null ? void 0 : e.call(this)) ?? !0;
          }
        },
        this
      )
    );
  }
  setState(e) {
    var r;
    const { params: t } = this, s = ((r = t.valueFormatter) == null ? void 0 : r.call(t, e)) ?? "";
    this.populateWithRenderer(e, s) || this.populateWithoutRenderer(e, s), this.value = e;
  }
  highlightString(e) {
    const { parsedValue: t, params: s } = this;
    if (s.cellRenderer || !A(t))
      return;
    let i = A(e);
    if (i) {
      const r = t == null ? void 0 : t.toLocaleLowerCase().indexOf(e.toLocaleLowerCase());
      if (r >= 0) {
        const n = r + e.length, o = this.getGui().querySelector("span");
        o && (X(o), o.append(
          // Start part
          t.slice(0, r),
          // Highlighted part wrapped in bold tag
          K({
            tag: "span",
            cls: "ag-rich-select-row-text-highlight",
            children: t.slice(r, n)
          }),
          // End part
          t.slice(n)
        ));
      } else
        i = !1;
    }
    i || this.renderValueWithoutRenderer(t);
  }
  updateSelected(e) {
    const t = this.getGui();
    ta(t.parentElement, e), this.toggleCss("ag-rich-select-row-selected", e);
  }
  getValue() {
    return this.value;
  }
  toggleHighlighted(e) {
    this.toggleCss("ag-rich-select-row-highlighted", e), this.dispatchLocalEvent({
      type: "itemHighlighted",
      highlighted: e
    });
  }
  populateWithoutRenderer(e, t) {
    var n;
    const s = this.getGui(), i = K({ tag: "span" });
    i.style.overflow = "hidden", i.style.textOverflow = "ellipsis";
    const r = Nt(A(t) ? t : e);
    this.parsedValue = A(r) ? r : null, s.appendChild(i), this.renderValueWithoutRenderer(r), this.shouldDisplayTooltip = Ci(() => i), (n = this.tooltipFeature) == null || n.setTooltipAndRefresh(this.parsedValue);
  }
  renderValueWithoutRenderer(e) {
    const t = this.getGui().querySelector("span");
    t && (t.textContent = A(e) ? e : " ");
  }
  populateWithRenderer(e, t) {
    var r;
    let s, i;
    if (this.params.cellRenderer) {
      const n = (r = this.getParentComponent()) == null ? void 0 : r.getParentComponent();
      i = Ep(
        this.userCompFactory,
        this.params,
        V(this.gos, {
          value: e,
          valueFormatted: t,
          getValue: () => n == null ? void 0 : n.getValue(),
          setValue: (o) => {
            n == null || n.setValue(o, !0);
          },
          setTooltip: (o, a) => {
            var l;
            this.gos.assertModuleRegistered("Tooltip", 3), this.shouldDisplayTooltip = a, (l = this.tooltipFeature) == null || l.setTooltipAndRefresh(o);
          }
        })
      );
    }
    return i && (s = i.newAgStackInstance()), s && gC(s, this.getGui()), s ? (s.then((n) => {
      this.addDestroyFunc(() => {
        this.destroyBean(n);
      });
    }), !0) : !1;
  }
}, Lu = "ag-rich-select-list", ku = "ag-rich-select-row", X1 = class extends yr {
  constructor(e, t, s) {
    super({ cssIdentifier: "rich-select" }), this.params = e, this.richSelectWrapper = t, this.getSearchString = s, this.lastRowHovered = -1, this.selectedItems = /* @__PURE__ */ new Set(), this.params = e, this.setComponentCreator(this.createRowComponent.bind(this)), this.setComponentUpdater(() => {
    });
  }
  postConstruct() {
    super.postConstruct(), this.eLoading = K({
      tag: "div",
      cls: "ag-loading-text",
      children: this.getLocaleTextFunc()("loadingOoo", "Loading...")
    });
    const { cellRowHeight: e, pickerAriaLabelKey: t, pickerAriaLabelValue: s } = this.params;
    e && this.setRowHeight(e);
    const i = this.getGui(), r = this.getAriaElement();
    this.addManagedListeners(i, {
      mousemove: this.onMouseMove.bind(this),
      mouseout: this.onMouseOut.bind(this),
      mousedown: this.onMouseDown.bind(this),
      click: this.onClick.bind(this)
    }), i.classList.add(Lu);
    const n = `${Lu}-${this.getCompId()}`;
    r.setAttribute("id", n);
    const a = this.getLocaleTextFunc()(t, s);
    re(r, a), kc(this.richSelectWrapper, r);
  }
  navigateToPage(e) {
    const t = super.navigateToPage(e, this.lastRowHovered);
    return t != null && xt(this.beans, () => {
      if (!this.isAlive())
        return null;
      this.highlightIndex(t);
    }), t;
  }
  drawVirtualRows(e) {
    super.drawVirtualRows(e), this.refreshSelectedItems();
  }
  highlightFilterMatch(e) {
    this.forEachRenderedRow((t) => {
      t.highlightString(e);
    });
  }
  onNavigationKeyDown(e, t) {
    xt(this.beans, () => {
      if (!this.currentList || !this.isAlive())
        return;
      const s = this.currentList.length, i = this.lastRowHovered, r = e === S.DOWN ? 1 : -1, n = Math.min(Math.max(i === -1 ? 0 : i + r, 0), s - 1);
      this.highlightIndex(n), t();
    });
  }
  selectValue(e) {
    var i, r;
    if (!this.currentList)
      return this.eLoading && this.appendChild(this.eLoading), !1;
    if ((i = this.eLoading) != null && i.offsetParent && ((r = this.eLoading.parentElement) == null || r.removeChild(this.eLoading)), e == null)
      return !1;
    const t = this.getIndicesForValues(e), s = t.length > 0;
    return s && (this.refresh(), this.ensureIndexVisible(t[0]), this.refresh(!0)), this.selectListItems(Array.isArray(e) ? e : [e]), s;
  }
  selectListItems(e, t = !1) {
    t || this.selectedItems.clear();
    for (let s = 0; s < e.length; s++) {
      const i = e[s];
      this.findItemInSelected(i) === void 0 && this.selectedItems.add(i);
    }
    this.refreshSelectedItems();
  }
  getCurrentList() {
    return this.currentList;
  }
  setCurrentList(e) {
    this.currentList = e, this.setModel({
      getRowCount: () => e.length,
      getRow: (t) => e[t],
      areRowsEqual: (t, s) => t === s
    });
  }
  getSelectedItems() {
    return this.selectedItems;
  }
  getLastItemHovered() {
    return this.currentList[this.lastRowHovered];
  }
  highlightIndex(e, t) {
    this.currentList && (e < 0 || e >= this.currentList.length ? this.lastRowHovered = -1 : (this.lastRowHovered = e, this.ensureIndexVisible(e, !t) && !t && this.refresh(!0)), this.forEachRenderedRow((s, i) => {
      const r = e === i;
      if (s.toggleHighlighted(r), r) {
        const n = `${ku}-${s.getCompId()}`;
        Mg(this.richSelectWrapper, n), this.richSelectWrapper.setAttribute("data-active-option", n);
      }
    }));
  }
  getIndicesForValues(e) {
    const { currentList: t } = this;
    if (!t || t.length === 0 || e == null)
      return [];
    if (Array.isArray(e) || (e = [e]), e.length === 0)
      return [];
    const { valueFormatter: s } = this.params, i = [], r = typeof e[0] == "object", n = t.map(s);
    for (const o of e) {
      let a = -1;
      r ? a = n.indexOf(s(o)) : a = t.indexOf(o), a >= 0 && i.push(a);
    }
    return i;
  }
  toggleListItemSelection(e) {
    const t = this.findItemInSelected(e);
    t !== void 0 ? this.selectedItems.delete(t) : this.selectedItems.add(e), this.refreshSelectedItems(), this.dispatchValueSelected();
  }
  refreshSelectedItems() {
    this.forEachRenderedRow((e) => {
      const t = this.findItemInSelected(e.getValue()) !== void 0;
      e.updateSelected(t);
    });
  }
  findItemInSelected(e) {
    if (typeof e == "object") {
      const t = this.params.valueFormatter, s = t(e);
      for (const i of this.selectedItems)
        if (t(i) === s)
          return i;
    } else
      return this.selectedItems.has(e) ? e : void 0;
  }
  createRowComponent(e, t) {
    const s = new q1(this.params);
    t.setAttribute("id", `${ku}-${s.getCompId()}`), s.setParentComponent(this), this.createBean(s), s.setState(e);
    const { highlightMatch: i, searchType: r = "fuzzy" } = this.params;
    return i && r !== "fuzzy" && s.highlightString(this.getSearchString()), s;
  }
  getRowForMouseEvent(e) {
    if (!this.model)
      return -1;
    const s = this.getGui().getBoundingClientRect(), i = this.getScrollTop(), r = e.clientY - s.top + i;
    return Math.min(Math.floor(r / this.getRowHeight()), this.model.getRowCount() - 1);
  }
  onMouseMove(e) {
    const t = this.getRowForMouseEvent(e);
    t !== -1 && t != this.lastRowHovered && (this.lastRowHovered = t, this.highlightIndex(t, !0));
  }
  onMouseDown(e) {
    e.preventDefault();
  }
  onMouseOut(e) {
    this.getGui().contains(e.relatedTarget) || this.highlightIndex(-1);
  }
  onClick(e) {
    const { multiSelect: t } = this.params;
    if (!this.currentList)
      return;
    const s = this.getRowForMouseEvent(e), i = this.currentList[s];
    t ? this.toggleListItemSelection(i) : (this.selectListItems([i]), this.dispatchValueSelected());
  }
  dispatchValueSelected() {
    this.dispatchLocalEvent({
      type: "richSelectListRowSelected",
      fromEnterKey: !1,
      value: this.selectedItems
    });
  }
  destroy() {
    super.destroy(), this.eLoading = void 0;
  }
}, Z1 = {
  tag: "div",
  cls: "ag-picker-field",
  role: "presentation",
  children: [
    { tag: "div", ref: "eLabel" },
    {
      tag: "div",
      ref: "eWrapper",
      cls: "ag-wrapper ag-picker-field-wrapper ag-rich-select-value ag-picker-collapsed",
      children: [
        { tag: "span", ref: "eDisplayField", cls: "ag-picker-field-display" },
        { tag: "ag-input-text-field", ref: "eInput", cls: "ag-rich-select-field-input" },
        {
          tag: "span",
          ref: "eDeselect",
          cls: "ag-rich-select-deselect-button ag-picker-field-icon",
          role: "presentation"
        },
        { tag: "span", ref: "eIcon", cls: "ag-picker-field-icon", attrs: { "aria-hidden": "true" } }
      ]
    }
  ]
}, Ma = class extends rd {
  constructor(e) {
    super({
      pickerAriaLabelKey: "ariaLabelRichSelectField",
      pickerAriaLabelValue: "Rich Select Field",
      pickerType: "ag-list",
      className: "ag-rich-select",
      pickerIcon: "richSelectOpen",
      ariaRole: "combobox",
      template: (e == null ? void 0 : e.template) ?? Z1,
      agComponents: [It],
      modalPicker: !1,
      ...e,
      // maxPickerHeight needs to be set after expanding `config`
      maxPickerHeight: (e == null ? void 0 : e.maxPickerHeight) ?? "calc(var(--ag-row-height) * 6.5)"
    }), this.searchString = "", this.searchStringCreator = null, this.eInput = x, this.eDeselect = x, this.skipWrapperAnnouncement = !1;
    const { value: t, valueList: s, searchStringCreator: i } = e || {};
    t !== void 0 && (this.value = t), i && (this.searchStringCreator = i), s != null && this.setValues(s), this.registerCSS(j1);
  }
  wireBeans(e) {
    this.userCompFactory = e.userCompFactory, this.ariaAnnounce = e.ariaAnnounce, this.registry = e.registry;
  }
  postConstruct() {
    this.tooltipFeature = this.createOptionalManagedBean(
      this.registry.createDynamicBean("tooltipFeature", !1, {
        getGui: () => this.getGui(),
        shouldDisplayTooltip: () => {
          var r;
          return ((r = this.shouldDisplayTooltip) == null ? void 0 : r.call(this)) ?? !0;
        }
      })
    ), super.postConstruct(), this.createListComponent(), this.eDeselect.appendChild(N("richSelectRemove", this.beans));
    const { allowTyping: e, placeholder: t, suppressDeselectAll: s } = this.config;
    this.eDeselect.classList.add("ag-hidden"), e ? (this.eInput.setAutoComplete(!1).setInputPlaceholder(t), this.eDisplayField.classList.add("ag-hidden")) : this.eInput.setDisplayed(!1), this.setupAriaProperties();
    const { searchDebounceDelay: i = 300 } = this.config;
    this.clearSearchString = pe(this, this.clearSearchString.bind(this), i), this.renderSelectedValue(), e && this.eInput.onValueChange((r) => this.searchTextFromString(r)), this.addManagedElementListeners(this.eWrapper, { focus: this.onWrapperFocus.bind(this) }), this.addManagedElementListeners(this.eWrapper, { focusout: this.onWrapperFocusOut.bind(this) }), s || this.addManagedElementListeners(this.eDeselect, {
      mousedown: this.onDeselectAllMouseDown.bind(this),
      click: this.onDeselectAllClick.bind(this)
    });
  }
  setupAriaProperties() {
    const { eWrapper: e, gos: t } = this;
    e.tabIndex = t.get("tabIndex");
    const s = this.getLocaleTextFunc();
    this.ariaDeleteSelection = s("ariaLabelRichSelectDeleteSelection", "Press DELETE to deselect item"), this.ariaDeselectAllItems = s(
      "ariaLabelRichSelectDeselectAllItems",
      "Press DELETE to deselect all items"
    ), this.ariaToggleSelection = s("ariaLabelRichSelectToggleSelection", "Press SPACE to toggle selection");
  }
  createListComponent() {
    this.listComponent = this.createBean(
      new X1(this.config, this.getFocusableElement(), () => this.searchString)
    ), this.listComponent.setParentComponent(this), this.addManagedListeners(this.listComponent, {
      richSelectListRowSelected: (e) => {
        this.onListValueSelected(e.value, e.fromEnterKey);
      }
    });
  }
  renderSelectedValue() {
    var p;
    const { value: e, eDisplayField: t, config: s, gos: i } = this, {
      allowTyping: r,
      cellRenderer: n,
      initialInputValue: o,
      multiSelect: a,
      suppressDeselectAll: l,
      suppressMultiSelectPillRenderer: c,
      valueFormatter: d
    } = s, h = Gu(e, d);
    if (r) {
      this.eInput.setValue(o ?? h);
      return;
    }
    if (a && !l) {
      const f = e == null || Array.isArray(e) && e.length === 0;
      this.eDeselect.classList.toggle("ag-hidden", f);
    }
    let u;
    if (a && !c) {
      this.createOrUpdatePillContainer(t);
      return;
    }
    n && (u = Ep(
      this.userCompFactory,
      s,
      V(this.gos, {
        value: e,
        valueFormatted: h,
        getValue: () => this.getValue(),
        setValue: (f) => {
          this.setValue(f, !0);
        },
        setTooltip: (f, m) => {
          var C;
          i.assertModuleRegistered("Tooltip", 3), this.shouldDisplayTooltip = m, (C = this.tooltipFeature) == null || C.setTooltipAndRefresh(f);
        }
      })
    ));
    let g;
    if (u && (g = u.newAgStackInstance()), g)
      X(t), gC(g, t), g.then((f) => {
        this.addDestroyFunc(() => this.destroyBean(f));
      });
    else {
      if (A(this.value))
        t.innerText = h, t.classList.remove("ag-display-as-placeholder");
      else {
        const { placeholder: f } = s;
        A(f) ? (t.textContent = f, t.classList.add("ag-display-as-placeholder")) : X(t);
      }
      this.shouldDisplayTooltip = Ci(() => this.eDisplayField), (p = this.tooltipFeature) == null || p.setTooltipAndRefresh(h ?? null);
    }
  }
  createPickerComponent() {
    const { values: e } = this;
    return e && this.setValueList({ valueList: e }), this.listComponent;
  }
  setSearchStringCreator(e) {
    this.searchStringCreator = e;
  }
  setValueList(e) {
    const { valueList: t, refresh: s } = e;
    !this.listComponent || this.listComponent.getCurrentList() === t || (this.listComponent.setCurrentList(t), s && (this.values ? this.listComponent.refresh(!0) : (this.setValues(t), this.isPickerDisplayed && (this.listComponent.selectValue(this.value) || this.listComponent.refresh())), this.alignPickerToComponent()));
  }
  /**
   * This method updates the list of values
   */
  setValues(e) {
    this.values = e, this.searchStrings = this.getSearchStringsFromValues(e);
  }
  showPicker() {
    var i;
    super.showPicker();
    const { listComponent: e, value: t } = this;
    if (!e)
      return;
    let s = null;
    e.selectValue(this.value), this.value != null && (s = e.getIndicesForValues(Array.isArray(t) ? t : [t])[0]), s != null ? ((i = this.tooltipFeature) == null || i.attemptToHideTooltip(), e.highlightIndex(s)) : e.refresh(), this.displayOrHidePicker();
  }
  createOrUpdatePillContainer(e) {
    if (!this.pillContainer) {
      const t = this.pillContainer = this.createBean(new K1());
      this.addDestroyFunc(() => {
        this.destroyBean(this.pillContainer), this.pillContainer = null;
      }), X(e), e.appendChild(t.getGui());
      const { config: s, eWrapper: i, ariaDeleteSelection: r } = this, { valueFormatter: n } = s;
      t.init({
        eWrapper: i,
        valueFormatter: n,
        onPillMouseDown: (o) => {
          o.stopImmediatePropagation();
        },
        announceItemFocus: () => {
          this.announceAriaValue(r);
        },
        getValue: () => this.getValue(),
        setValue: (o) => this.setValue(o, !0)
      });
    }
    this.doWhileBlockingAnnouncement(() => {
      var t;
      return (t = this.pillContainer) == null ? void 0 : t.refresh();
    });
  }
  doWhileBlockingAnnouncement(e) {
    this.skipWrapperAnnouncement = !0, e(), this.skipWrapperAnnouncement = !1;
  }
  onWrapperFocus() {
    const { eInput: e, config: t } = this, { allowTyping: s, multiSelect: i, suppressDeselectAll: r } = t;
    if (s) {
      const n = e.getFocusableElement();
      n.focus(), n.select();
    } else i && !r && !this.skipWrapperAnnouncement && this.announceAriaValue(this.ariaDeselectAllItems);
  }
  onWrapperFocusOut(e) {
    this.eWrapper.contains(e.relatedTarget) || this.hidePicker();
  }
  onDeselectAllMouseDown(e) {
    e.stopImmediatePropagation();
  }
  onDeselectAllClick() {
    this.setValue([], !0);
  }
  buildSearchStringFromKeyboardEvent(e) {
    let { key: t } = e;
    if (t === S.BACKSPACE)
      this.searchString = this.searchString.slice(0, -1), t = "";
    else if (!td(e))
      return;
    e.preventDefault(), this.searchTextFromCharacter(t);
  }
  searchTextFromCharacter(e) {
    this.searchString += e, this.runSearch(), this.clearSearchString();
  }
  searchTextFromString(e) {
    e == null && (e = ""), this.searchString = e, this.runSearch();
  }
  getSearchStringsFromValues(e) {
    const {
      config: { valueFormatter: t }
    } = this;
    return typeof e[0] == "object" && this.searchStringCreator ? this.searchStringCreator(e) : e.map((s) => Gu(s, t));
  }
  filterListModel(e) {
    const { filterList: t } = this.config;
    t && this.setValueList({ valueList: e, refresh: !0 });
  }
  runSearch() {
    var l;
    if (!this.listComponent)
      return;
    const { values: e } = this, t = this.searchStrings;
    if (!t) {
      this.listComponent.highlightIndex(-1);
      return;
    }
    const { suggestions: s, filteredValues: i } = this.getSuggestionsAndFilteredValues(this.searchString, t), { filterList: r, highlightMatch: n, searchType: o = "fuzzy" } = this.config, a = !!(r && this.searchString !== "");
    this.filterListModel(a ? i : e), this.highlightEmptyValue() || this.highlightListValue(s, i, a), n && o !== "fuzzy" && ((l = this.listComponent) == null || l.highlightFilterMatch(this.searchString)), this.displayOrHidePicker();
  }
  highlightEmptyValue() {
    var e, t;
    if (this.searchString === "") {
      const s = (e = this.searchStrings) == null ? void 0 : e.indexOf("");
      if (s !== void 0 && s !== -1)
        return (t = this.listComponent) == null || t.highlightIndex(s), !0;
    }
    return !1;
  }
  highlightListValue(e, t, s) {
    var i, r, n, o, a;
    if (e.length) {
      const l = s ? 0 : (i = this.searchStrings) == null ? void 0 : i.indexOf(e[0]);
      l !== void 0 && ((r = this.listComponent) == null || r.highlightIndex(l));
    } else if ((n = this.listComponent) == null || n.highlightIndex(-1), !s || t.length)
      (o = this.listComponent) == null || o.ensureIndexVisible(0);
    else if (s) {
      this.getAriaElement().removeAttribute("data-active-option");
      const l = (a = this.listComponent) == null ? void 0 : a.getAriaElement();
      l && Mg(l, null);
    }
  }
  getSuggestionsAndFilteredValues(e, t) {
    let s = [];
    const i = [];
    if (!e.length)
      return { suggestions: s, filteredValues: i };
    const { searchType: r = "fuzzy", filterList: n } = this.config;
    if (r === "fuzzy") {
      const o = on({
        inputValue: e,
        allSuggestions: t,
        hideIrrelevant: !0
      });
      s = o.values;
      const a = o.indices;
      if (n && a.length)
        for (let l = 0; l < a.length; l++)
          i.push(this.values[a[l]]);
    } else
      s = t.filter((o, a) => {
        const l = o.toLocaleLowerCase(), c = this.searchString.toLocaleLowerCase(), d = r === "match" ? l.startsWith(c) : l.indexOf(c) !== -1;
        return n && d && i.push(this.values[a]), d;
      });
    return { suggestions: s, filteredValues: i };
  }
  displayOrHidePicker() {
    if (!this.listComponent)
      return;
    const e = this.listComponent.getGui(), t = this.listComponent.getCurrentList(), s = t ? t.length === 0 : !1;
    e.classList.toggle("ag-hidden", s);
  }
  clearSearchString() {
    this.searchString = "";
  }
  setValue(e, t, s, i) {
    var n, o;
    if (this.value === e)
      return this;
    const r = Array.isArray(e);
    if (e != null) {
      if (!r) {
        const a = (n = this.listComponent) == null ? void 0 : n.getCurrentList();
        if ((a ? a.indexOf(e) : -1) === -1)
          return this;
      }
      s || (o = this.listComponent) == null || o.selectValue(e);
    }
    return super.setValue(e, t), i || this.renderSelectedValue(), this;
  }
  onNavigationKeyDown(e, t, s) {
    var r;
    e.preventDefault();
    const i = t === S.DOWN;
    if (!this.isPickerDisplayed && i) {
      this.showPicker();
      return;
    }
    (r = this.listComponent) == null || r.onNavigationKeyDown(t, s);
  }
  onEnterKeyDown(e) {
    var t;
    if (this.isPickerDisplayed && (e.preventDefault(), (t = this.listComponent) != null && t.getCurrentList())) {
      const s = this.listComponent.getLastItemHovered();
      this.config.multiSelect || s == null ? this.dispatchPickerEventAndHidePicker(this.value, !0) : this.onListValueSelected(/* @__PURE__ */ new Set([s]), !0);
    }
  }
  onDeleteKeyDown(e) {
    const { eWrapper: t, beans: s } = this;
    Q(s) === t && (e.preventDefault(), this.setValue([], !0));
  }
  onTabKeyDown() {
    const { config: e, isPickerDisplayed: t, listComponent: s } = this, { multiSelect: i } = e;
    if (!(!t || !s)) {
      if (i) {
        const r = this.getValueFromSet(s.getSelectedItems());
        r && this.setValue(r, !1, !0, !0);
      } else {
        const r = s.getLastItemHovered();
        r && this.setValue(r, !1, !0);
      }
      this.hidePicker();
    }
  }
  getValueFromSet(e) {
    const { multiSelect: t } = this.config;
    let s = null;
    for (const i of e) {
      if (e.size === 1 && !t) {
        s = i;
        break;
      }
      s || (s = []), s.push(i);
    }
    return Array.isArray(s) && s.sort(), s;
  }
  onListValueSelected(e, t) {
    const s = this.getValueFromSet(e);
    this.setValue(s, !1, !0), this.config.multiSelect || this.dispatchPickerEventAndHidePicker(s, t);
  }
  dispatchPickerEventAndHidePicker(e, t) {
    const s = {
      type: "fieldPickerValueSelected",
      fromEnterKey: t,
      value: e
    };
    this.dispatchLocalEvent(s), this.hidePicker();
  }
  getFocusableElement() {
    const { allowTyping: e } = this.config;
    return e ? this.eInput.getFocusableElement() : super.getFocusableElement();
  }
  onKeyDown(e) {
    var c;
    const { key: t, isComposing: s } = e, {
      isPickerDisplayed: i,
      config: { allowTyping: r, multiSelect: n, suppressDeselectAll: o },
      listComponent: a,
      pickerComponent: l
    } = this;
    switch (t) {
      case S.LEFT:
      case S.RIGHT:
        (!r || this.pillContainer) && (e.preventDefault(), this.pillContainer && ((c = this.listComponent) == null || c.highlightIndex(-1), this.pillContainer.onNavigationKeyDown(e)));
        break;
      case S.PAGE_HOME:
      case S.PAGE_END:
        if (r) {
          e.preventDefault();
          const d = this.eInput.getInputElement(), h = t === S.PAGE_HOME ? 0 : d.value.length;
          d.setSelectionRange(h, h);
          break;
        }
      case S.PAGE_UP:
      case S.PAGE_DOWN:
        e.preventDefault(), l && (a == null || a.navigateToPage(t));
        break;
      case S.DOWN:
      case S.UP:
        s || this.onNavigationKeyDown(e, t, () => {
          n && (this.doWhileBlockingAnnouncement(() => this.eWrapper.focus()), this.announceAriaValue(this.ariaToggleSelection));
        });
        break;
      case S.ESCAPE:
        i && (Ze(this.listComponent.getGui()) && (e.preventDefault(), he(e)), this.hidePicker());
        break;
      case S.ENTER:
        s ? e.preventDefault() : this.onEnterKeyDown(e);
        break;
      case S.SPACE:
        if ((!r || s) && e.preventDefault(), !s && i && n && a) {
          const d = a.getLastItemHovered();
          d && a.toggleListItemSelection(d);
        }
        break;
      case S.TAB:
        this.onTabKeyDown();
        break;
      case S.DELETE:
        n && !o && this.onDeleteKeyDown(e);
        break;
      default:
        r || this.buildSearchStringFromKeyboardEvent(e);
    }
  }
  announceAriaValue(e) {
    var t;
    (t = this.ariaAnnounce) == null || t.announceValue(e, "richSelect");
  }
  destroy() {
    this.listComponent && (this.listComponent = this.destroyBean(this.listComponent)), this.searchStrings = void 0, super.destroy();
  }
}, Gu = (e, t) => (t == null ? void 0 : t(e)) ?? String(e ?? "");
function gC(e, t) {
  e.then((s) => {
    const i = s.getGui();
    i != null && t.appendChild(i);
  });
}
var Q1 = {
  tag: "div",
  cls: "ag-picker-field",
  role: "presentation",
  children: [
    { tag: "div", ref: "eLabel" },
    {
      tag: "div",
      ref: "eWrapper",
      cls: "ag-wrapper ag-picker-collapsed",
      children: [
        { tag: "div", ref: "eDisplayField", cls: "ag-picker-field-display" },
        { tag: "ag-input-text-field", ref: "eInput", cls: "ag-rich-select-field-input" },
        {
          tag: "span",
          ref: "eDeselect",
          cls: "ag-rich-select-deselect-button ag-picker-field-icon",
          role: "presentation"
        },
        { tag: "div", ref: "eIcon", cls: "ag-picker-field-icon", attrs: { "aria-hidden": "true" } }
      ]
    }
  ]
}, pC = class extends Ma {
  constructor(e) {
    super({
      ...e,
      template: Q1,
      agComponents: [It]
    }), this.params = e;
  }
  showPicker() {
    setTimeout(() => super.showPicker());
  }
  hidePicker() {
    setTimeout(() => super.hidePicker());
  }
  postConstruct() {
    super.postConstruct();
    const { wrapperClassName: e, ariaLabel: t } = this.params;
    O(this.eDisplayField, !1), e && this.eWrapper.classList.add(e), Js(this.eWrapper, ""), re(this.eWrapper, t);
  }
  onEnterKeyDown(e) {
    he(e), this.isPickerDisplayed ? super.onEnterKeyDown(e) : (e.preventDefault(), this.showPicker());
  }
}, fC = class extends R {
  constructor(e, t, s) {
    super(), this.eGui = e, this.focusWrapper = t, this.eFocusableComp = s;
  }
  postConstruct() {
    this.addManagedElementListeners(this.eGui, {
      keydown: (t) => {
        switch (t.key) {
          case S.TAB:
            t.defaultPrevented || he(t);
            break;
          case S.UP:
          case S.DOWN:
            he(t);
            break;
          case S.ESCAPE:
            if (St(t))
              return;
            this.eGui.contains(Q(this.beans)) && (t.preventDefault(), he(t), this.focusWrapper.focus());
            break;
        }
      }
    });
    const e = "ag-advanced-filter-builder-virtual-list-item-highlight";
    this.addManagedListeners(this.focusWrapper, {
      keydown: (t) => {
        switch (t.key) {
          case S.ENTER:
            if (St(t))
              return;
            Q(this.beans) === this.focusWrapper && (t.preventDefault(), he(t), this.eFocusableComp.getFocusableElement().focus());
            break;
        }
      },
      focusin: () => {
        this.focusWrapper.classList.add(e);
      },
      focusout: (t) => {
        this.focusWrapper.contains(t.relatedTarget) || this.focusWrapper.classList.remove(e);
      }
    });
  }
};
function mC(e, t) {
  return {
    pickerAriaLabelKey: "ariaLabelAdvancedFilterBuilderAddField",
    pickerAriaLabelValue: "Advanced Filter Builder Add Field",
    pickerType: "ag-list",
    valueList: [
      {
        key: "condition",
        displayValue: e("advancedFilterBuilderAddCondition")
      },
      {
        key: "join",
        displayValue: e("advancedFilterBuilderAddJoin")
      }
    ],
    valueFormatter: (s) => s == null ? "" : s.displayValue ?? s.key,
    pickerIcon: "advancedFilterBuilderAdd",
    maxPickerWidth: `${t ?? 120}px`,
    wrapperClassName: "ag-advanced-filter-builder-item-button",
    ariaLabel: e("advancedFilterBuilderAddButtonTooltip")
  };
}
var J1 = {
  tag: "div",
  cls: "ag-advanced-filter-builder-item-wrapper",
  role: "presentation",
  children: [
    {
      tag: "div",
      ref: "eItem",
      cls: "ag-advanced-filter-builder-item",
      role: "presentation",
      children: [
        {
          tag: "div",
          cls: "ag-advanced-filter-builder-item-tree-lines",
          attrs: { "aria-hidden": "true" },
          children: [
            {
              tag: "div",
              cls: "ag-advanced-filter-builder-item-tree-line-vertical-top ag-advanced-filter-builder-item-tree-line-horizontal"
            }
          ]
        }
      ]
    }
  ]
}, eV = class extends D {
  constructor(e, t) {
    super(J1), this.item = e, this.focusWrapper = t, this.eItem = x;
  }
  wireBeans(e) {
    this.advFilterExpSvc = e.advFilterExpSvc, this.registry = e.registry;
  }
  postConstruct() {
    var s;
    Qo(this.focusWrapper, 2);
    const e = mC(
      (i) => this.advFilterExpSvc.translate(i),
      (s = this.gos.get("advancedFilterBuilderParams")) == null ? void 0 : s.addSelectWidth
    ), t = this.createManagedBean(new pC(e));
    this.addManagedListeners(t, {
      fieldPickerValueSelected: ({ value: i }) => {
        this.dispatchLocalEvent({
          type: "advancedFilterBuilderAdded",
          item: this.item,
          isJoin: i.key === "join"
        });
      }
    }), this.eItem.appendChild(t.getGui()), this.createOptionalManagedBean(
      this.registry.createDynamicBean("tooltipFeature", !1, {
        getGui: () => t.getGui(),
        getLocation: () => "advancedFilter",
        getTooltipValue: () => this.advFilterExpSvc.translate("advancedFilterBuilderAddButtonTooltip")
      })
    ), this.createManagedBean(
      new fC(this.getGui(), this.focusWrapper, t)
    ), re(
      this.focusWrapper,
      this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderItem", [
        this.advFilterExpSvc.translate("advancedFilterBuilderAddButtonTooltip"),
        `${this.item.level + 1}`
      ])
    );
  }
  afterAdd() {
  }
}, tV = class extends D {
  constructor() {
    super({ tag: "div", cls: "ag-advanced-filter-builder-item-condition", role: "presentation" }), this.validationMessage = null;
  }
  wireBeans(e) {
    this.advFilterExpSvc = e.advFilterExpSvc;
  }
  init(e) {
    const { item: t, createPill: s } = e;
    this.item = t, this.createPill = s, this.filterModel = t.filterModel, this.setupColumnCondition(this.filterModel), this.validate(), this.addDestroyFunc(() => this.destroyBeans([this.eColumnPill, this.eOperatorPill, this.eOperandPill]));
  }
  getDragName() {
    return this.filterModel.colId ? this.advFilterExpSvc.parseColumnFilterModel(this.filterModel) : this.getDefaultColumnDisplayValue();
  }
  getAriaLabel() {
    return `${this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderFilterItem")} ${this.getDragName()}`;
  }
  getValidationMessage() {
    return this.validationMessage;
  }
  getFocusableElement() {
    return this.eColumnPill.getFocusableElement();
  }
  setupColumnCondition(e) {
    const t = this.advFilterExpSvc.getColumnDetails(e.colId);
    this.baseCellDataType = t.baseCellDataType, this.column = t.column, this.numOperands = this.getNumOperands(this.getOperatorKey()), this.eColumnPill = this.createPill({
      key: this.getColumnKey(),
      displayValue: this.getColumnDisplayValue() ?? this.getDefaultColumnDisplayValue(),
      cssClass: "ag-advanced-filter-builder-column-pill",
      isSelect: !0,
      getEditorParams: () => ({ values: this.advFilterExpSvc.getColumnAutocompleteEntries() }),
      update: (s) => this.setColumnKey(s),
      pickerAriaLabelKey: "ariaLabelAdvancedFilterBuilderColumnSelectField",
      pickerAriaLabelValue: "Advanced Filter Builder Column Select Field",
      ariaLabel: this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderColumn")
    }), this.getGui().appendChild(this.eColumnPill.getGui()), A(this.getColumnKey()) && (this.createOperatorPill(), this.hasOperand() && this.createOperandPill());
  }
  createOperatorPill() {
    this.eOperatorPill = this.createPill({
      key: this.getOperatorKey(),
      displayValue: this.getOperatorDisplayValue() ?? this.getDefaultOptionSelectValue(),
      cssClass: "ag-advanced-filter-builder-option-pill",
      isSelect: !0,
      getEditorParams: () => ({ values: this.getOperatorAutocompleteEntries() }),
      update: (e) => this.setOperatorKey(e),
      pickerAriaLabelKey: "ariaLabelAdvancedFilterBuilderOptionSelectField",
      pickerAriaLabelValue: "Advanced Filter Builder Option Select Field",
      ariaLabel: this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderOption")
    }), this.eColumnPill.getGui().insertAdjacentElement("afterend", this.eOperatorPill.getGui());
  }
  createOperandPill() {
    const { filter: e } = this.filterModel, t = (typeof e == "number" ? ut(e) : e) ?? "";
    this.eOperandPill = this.createPill({
      key: t,
      // Convert from the input format to display format.
      // Input format matches model format except for numbers, but these get stringified anyway
      valueFormatter: (s) => this.advFilterExpSvc.getOperandDisplayValue({ ...this.filterModel, filter: s }, !0),
      baseCellDataType: this.baseCellDataType,
      cssClass: "ag-advanced-filter-builder-value-pill",
      isSelect: !1,
      update: (s) => this.setOperand(s),
      ariaLabel: this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderValue")
    }), this.getGui().appendChild(this.eOperandPill.getGui());
  }
  getColumnKey() {
    return this.filterModel.colId;
  }
  getColumnDisplayValue() {
    return this.advFilterExpSvc.getColumnDisplayValue(this.filterModel);
  }
  getOperatorKey() {
    return this.filterModel.type;
  }
  getOperatorDisplayValue() {
    return this.advFilterExpSvc.getOperatorDisplayValue(this.filterModel);
  }
  getOperandDisplayValue() {
    return this.advFilterExpSvc.getOperandDisplayValue(this.filterModel, !0);
  }
  hasOperand() {
    return this.numOperands > 0;
  }
  getOperatorAutocompleteEntries() {
    return this.column ? this.advFilterExpSvc.getOperatorAutocompleteEntries(this.column, this.baseCellDataType) : [];
  }
  setColumnKey(e) {
    this.eOperatorPill || this.createOperatorPill();
    const t = this.advFilterExpSvc.getColumnDetails(e);
    this.column = t.column;
    const s = t.baseCellDataType;
    this.baseCellDataType !== s && (this.baseCellDataType = s, this.setOperatorKey(void 0), this.eOperatorPill && (se(this.eOperatorPill.getGui()), this.destroyBean(this.eOperatorPill), this.createOperatorPill()), this.validate()), this.filterModel.colId = e, this.filterModel.filterType = this.baseCellDataType;
  }
  setOperatorKey(e) {
    const t = this.getNumOperands(e);
    t !== this.numOperands && (this.numOperands = t, t === 0 ? this.destroyOperandPill() : (this.createOperandPill(), this.baseCellDataType !== "number" && this.setOperand(""))), this.filterModel.type = e, this.validate();
  }
  setOperand(e) {
    let t = e;
    this.baseCellDataType === "number" && (t = A(e) ? Number(e) : ""), this.filterModel.filter = t, this.validate();
  }
  getNumOperands(e) {
    var t;
    return ((t = this.advFilterExpSvc.getExpressionOperator(this.baseCellDataType, e)) == null ? void 0 : t.numOperands) ?? 0;
  }
  destroyOperandPill() {
    delete this.filterModel.filter, this.getGui().removeChild(this.eOperandPill.getGui()), this.destroyBean(this.eOperandPill), this.eOperandPill = void 0;
  }
  validate() {
    let e = null;
    A(this.getColumnKey()) ? A(this.getOperatorKey()) ? this.numOperands > 0 && !A(this.getOperandDisplayValue()) && (e = this.advFilterExpSvc.translate("advancedFilterBuilderValidationEnterValue")) : e = this.advFilterExpSvc.translate("advancedFilterBuilderValidationSelectOption") : e = this.advFilterExpSvc.translate("advancedFilterBuilderValidationSelectColumn"), this.item.valid = !e, e !== this.validationMessage && (this.validationMessage = e, this.dispatchLocalEvent({
      type: "advancedFilterBuilderValidChanged"
    }));
  }
  getDefaultColumnDisplayValue() {
    return this.advFilterExpSvc.translate("advancedFilterBuilderSelectColumn");
  }
  getDefaultOptionSelectValue() {
    return this.advFilterExpSvc.translate("advancedFilterBuilderSelectOption");
  }
}, sV = {
  number: [ga],
  boolean: [yt],
  object: [yt],
  text: [yt],
  date: [zr],
  dateString: [zr],
  dateTime: [zr, (e) => e.setIncludeTime(!0)],
  dateTimeString: [zr, (e) => e.setIncludeTime(!0)]
}, iV = {
  tag: "div",
  cls: "ag-advanced-filter-builder-pill-wrapper",
  role: "presentation",
  children: [
    {
      tag: "div",
      ref: "ePill",
      cls: "ag-advanced-filter-builder-pill",
      role: "button",
      children: [
        {
          tag: "span",
          ref: "eLabel",
          cls: "ag-advanced-filter-builder-pill-display"
        }
      ]
    }
  ]
}, rV = class extends D {
  constructor(e) {
    super(iV), this.params = e, this.ePill = x, this.eLabel = x;
    const { value: t, valueFormatter: s } = e;
    this.value = t, this.displayValue = s(t);
  }
  wireBeans(e) {
    this.advFilterExpSvc = e.advFilterExpSvc;
  }
  postConstruct() {
    const { cssClass: e, ariaLabel: t } = this.params;
    this.ePill.classList.add(e), this.activateTabIndex([this.ePill]), this.eLabel.id = `${this.getCompId()}`, Zo(this.ePill, this.eLabel.id), re(this.ePill, t), this.renderValue(), this.addManagedListeners(this.ePill, {
      click: (s) => {
        s.preventDefault(), this.showEditor();
      },
      keydown: (s) => {
        switch (s.key) {
          case S.ENTER:
            s.preventDefault(), he(s), this.showEditor();
            break;
        }
      }
    }), this.addDestroyFunc(() => this.destroyBean(this.eEditor));
  }
  getFocusableElement() {
    return this.ePill;
  }
  showEditor() {
    if (this.eEditor)
      return;
    O(this.ePill, !1), this.eEditor = this.createEditorComp(this.params.type), this.eEditor.setValue(this.value);
    const e = this.eEditor.getGui();
    this.eEditor.addManagedElementListeners(e, {
      keydown: (t) => {
        switch (t.key) {
          case S.ENTER:
            t.preventDefault(), he(t), this.updateValue(!0);
            break;
          case S.ESCAPE:
            t.preventDefault(), he(t), this.hideEditor(!0);
            break;
        }
      },
      focusout: () => this.updateValue(!1)
    }), this.getGui().appendChild(e), this.eEditor.getFocusableElement().focus();
  }
  /**
   * Responsible for instantiating an InputField and calling some of the setup methods
   */
  createEditorComp(e) {
    const [t, s] = sV[e], i = this.createBean(new t());
    return s && s(i), i;
  }
  hideEditor(e) {
    const { eEditor: t } = this;
    t && (this.eEditor = void 0, this.getGui().removeChild(t.getGui()), this.destroyBean(t), O(this.ePill, !0), e && this.ePill.focus());
  }
  renderValue() {
    let e;
    const { displayValue: t, eLabel: s } = this, { classList: i } = s;
    i.remove(
      "ag-advanced-filter-builder-value-empty",
      "ag-advanced-filter-builder-value-number",
      "ag-advanced-filter-builder-value-text"
    ), A(t) ? this.params.type === "number" ? (e = t, i.add("ag-advanced-filter-builder-value-number")) : (e = `"${t}"`, i.add("ag-advanced-filter-builder-value-text")) : (e = this.advFilterExpSvc.translate("advancedFilterBuilderEnterValue"), i.add("ag-advanced-filter-builder-value-empty")), s.textContent = e;
  }
  updateValue(e) {
    if (!this.eEditor)
      return;
    const t = this.eEditor.getValue() ?? "";
    this.dispatchLocalEvent({
      type: "fieldValueChanged",
      value: t
    }), this.value = t, this.displayValue = this.params.valueFormatter(t), this.renderValue(), this.hideEditor(e);
  }
}, nV = class extends D {
  wireBeans(e) {
    this.advFilterExpSvc = e.advFilterExpSvc;
  }
  constructor() {
    super({
      tag: "div",
      cls: "ag-advanced-filter-builder-item-condition",
      role: "presentation"
    });
  }
  init(e) {
    const { item: t, createPill: s } = e, i = t.filterModel;
    this.filterModel = i, this.ePill = s({
      key: i.type,
      displayValue: this.advFilterExpSvc.parseJoinOperator(i),
      cssClass: "ag-advanced-filter-builder-join-pill",
      isSelect: !0,
      getEditorParams: () => ({
        values: this.advFilterExpSvc.getJoinOperatorAutocompleteEntries()
      }),
      update: (r) => i.type = r,
      pickerAriaLabelKey: "ariaLabelAdvancedFilterBuilderJoinSelectField",
      pickerAriaLabelValue: "Advanced Filter Builder Join Operator Select Field",
      ariaLabel: this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderJoinOperator")
    }), this.getGui().appendChild(this.ePill.getGui()), this.addDestroyFunc(() => this.destroyBean(this.ePill));
  }
  getDragName() {
    return this.advFilterExpSvc.parseJoinOperator(this.filterModel);
  }
  getAriaLabel() {
    return `${this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderGroupItem")} ${this.getDragName()}`;
  }
  getValidationMessage() {
    return null;
  }
  getFocusableElement() {
    return this.ePill.getFocusableElement();
  }
}, oV = {
  tag: "div",
  cls: "ag-picker-field ag-advanced-filter-builder-pill-wrapper",
  role: "presentation",
  children: [
    { tag: "div", ref: "eLabel" },
    {
      tag: "div",
      ref: "eWrapper",
      cls: "ag-wrapper ag-advanced-filter-builder-pill ag-picker-collapsed",
      children: [
        {
          tag: "div",
          ref: "eDisplayField",
          cls: "ag-picker-field-display ag-advanced-filter-builder-pill-display"
        },
        { tag: "ag-input-text-field", ref: "eInput", cls: "ag-rich-select-field-input" },
        {
          tag: "span",
          ref: "eDeselect",
          cls: "ag-rich-select-deselect-button ag-picker-field-icon",
          role: "presentation"
        },
        { tag: "div", ref: "eIcon", cls: "ag-picker-field-icon", attrs: { "aria-hidden": "true" } }
      ]
    }
  ]
}, aV = class extends Ma {
  constructor(e) {
    super({
      ...e,
      template: oV,
      agComponents: [It]
    }), this.params = e;
  }
  getFocusableElement() {
    return this.eWrapper;
  }
  showPicker() {
    setTimeout(() => super.showPicker());
  }
  hidePicker() {
    setTimeout(() => super.hidePicker());
  }
  postConstruct() {
    super.postConstruct();
    const { wrapperClassName: e, ariaLabel: t } = this.params;
    this.eWrapper.classList.add(e), Js(this.eWrapper, ""), re(this.eWrapper, t);
  }
  createPickerComponent() {
    if (!this.values) {
      const { values: e } = this.params.getEditorParams();
      this.values = e;
      const t = this.value.key, s = e.find((i) => i.key === t) ?? {
        key: t,
        displayValue: this.value.displayValue
      };
      this.value = s;
    }
    return super.createPickerComponent();
  }
  onEnterKeyDown(e) {
    he(e), this.isPickerDisplayed ? super.onEnterKeyDown(e) : (e.preventDefault(), this.showPicker());
  }
}, lV = {
  tag: "div",
  cls: "ag-advanced-filter-builder-item-wrapper",
  role: "presentation",
  children: [
    {
      tag: "div",
      cls: "ag-advanced-filter-builder-item",
      role: "presentation",
      children: [
        {
          tag: "div",
          ref: "eTreeLines",
          cls: "ag-advanced-filter-builder-item-tree-lines",
          attrs: { "aria-hidden": "true" }
        },
        {
          tag: "span",
          ref: "eDragHandle",
          cls: "ag-drag-handle",
          attrs: { "aria-hidden": "true" }
        },
        {
          tag: "span",
          ref: "eValidation",
          cls: "ag-advanced-filter-builder-item-button ag-advanced-filter-builder-invalid",
          attrs: { "aria-hidden": "true" }
        }
      ]
    },
    {
      tag: "div",
      ref: "eButtons",
      cls: "ag-advanced-filter-builder-item-buttons",
      children: [
        { tag: "span", ref: "eMoveUpButton", cls: "ag-advanced-filter-builder-item-button", role: "button" },
        { tag: "span", ref: "eMoveDownButton", cls: "ag-advanced-filter-builder-item-button", role: "button" },
        { tag: "div", ref: "eAddButton", role: "presentation" },
        { tag: "span", ref: "eRemoveButton", cls: "ag-advanced-filter-builder-item-button", role: "button" }
      ]
    }
  ]
}, xl = class extends ls {
  constructor(e, t, s) {
    super(lV), this.item = e, this.dragFeature = t, this.focusWrapper = s, this.eTreeLines = x, this.eDragHandle = x, this.eButtons = x, this.eValidation = x, this.eMoveUpButton = x, this.eMoveDownButton = x, this.eAddButton = x, this.eRemoveButton = x, this.moveUpDisabled = !1, this.moveDownDisabled = !1;
  }
  wireBeans(e) {
    this.dragAndDrop = e.dragAndDrop, this.advFilterExpSvc = e.advFilterExpSvc, this.registry = e.registry;
  }
  postConstruct() {
    const { filterModel: e, level: t, showMove: s } = this.item, i = e.filterType === "join";
    if (this.ePillWrapper = this.createManagedBean(i ? new nV() : new tV()), this.ePillWrapper.init({ item: this.item, createPill: (r) => this.createPill(r) }), this.eDragHandle.insertAdjacentElement("afterend", this.ePillWrapper.getGui()), t === 0) {
      const r = K({
        tag: "div",
        cls: "ag-advanced-filter-builder-item-tree-line-vertical-bottom ag-advanced-filter-builder-item-tree-line-root"
      });
      this.eTreeLines.appendChild(r), O(this.eDragHandle, !1), O(this.eButtons, !1), qe(this.focusWrapper, !0);
    } else
      this.setupTreeLines(t), this.eDragHandle.appendChild(N("advancedFilterBuilderDrag", this.beans)), this.setupValidation(), this.setupMoveButtons(s), this.setupAddButton(), this.setupRemoveButton(), this.setupDragging(), this.updateAriaExpanded();
    Qo(this.focusWrapper, t + 1), this.initialiseTabGuard({}), this.createManagedBean(
      new fC(this.getGui(), this.focusWrapper, this.ePillWrapper)
    ), this.updateAriaLabel(), this.addManagedListeners(this.ePillWrapper, {
      advancedFilterBuilderValueChanged: () => this.dispatchLocalEvent({
        type: "advancedFilterBuilderValueChanged"
      }),
      advancedFilterBuilderValidChanged: () => this.updateValidity()
    });
  }
  setState(e) {
    var a, l;
    const { level: t } = this.item;
    if (t === 0)
      return;
    const { showMove: s } = this.item, { disableMoveUp: i, disableMoveDown: r, treeLines: n, showStartTreeLine: o } = e;
    this.updateTreeLines(n, o), this.updateAriaExpanded(), s && (this.moveUpDisabled = !!i, this.moveDownDisabled = !!r, this.eMoveUpButton.classList.toggle("ag-advanced-filter-builder-item-button-disabled", i), this.eMoveDownButton.classList.toggle("ag-advanced-filter-builder-item-button-disabled", r), wo(this.eMoveUpButton, !!i), wo(this.eMoveDownButton, !!r), (a = this.moveUpTooltipFeature) == null || a.refreshTooltip(), (l = this.moveDownTooltipFeature) == null || l.refreshTooltip());
  }
  focusMoveButton(e) {
    (e ? this.eMoveUpButton : this.eMoveDownButton).focus();
  }
  afterAdd() {
    this.ePillWrapper.getFocusableElement().focus();
  }
  setupTreeLines(e) {
    for (let t = 0; t < e; t++)
      this.eTreeLines.appendChild(K({ tag: "div" }));
  }
  updateTreeLines(e, t) {
    const s = e.length - 1, { children: i } = this.eTreeLines;
    for (let n = 0; n < s; n++) {
      const o = i.item(n);
      o && o.classList.toggle("ag-advanced-filter-builder-item-tree-line-vertical", !e[n]);
    }
    const r = i.item(s);
    if (r) {
      r.classList.add("ag-advanced-filter-builder-item-tree-line-horizontal");
      const n = e[s];
      r.classList.toggle("ag-advanced-filter-builder-item-tree-line-vertical-top", n), r.classList.toggle("ag-advanced-filter-builder-item-tree-line-vertical", !n);
    }
    this.eDragHandle.classList.toggle(
      "ag-advanced-filter-builder-item-tree-line-vertical-bottom",
      t
    );
  }
  setupValidation() {
    this.eValidation.appendChild(N("advancedFilterBuilderInvalid", this.beans)), this.validationTooltipFeature = this.createOptionalManagedBean(
      this.registry.createDynamicBean("tooltipFeature", !1, {
        getGui: () => this.eValidation,
        getLocation: () => "advancedFilter",
        getTooltipValue: () => this.ePillWrapper.getValidationMessage(),
        getTooltipShowDelayOverride: () => 1e3
      })
    ), this.updateValidity();
  }
  setupAddButton() {
    var s;
    const e = mC(
      (i) => this.advFilterExpSvc.translate(i),
      (s = this.gos.get("advancedFilterBuilderParams")) == null ? void 0 : s.addSelectWidth
    ), t = this.createManagedBean(new pC(e));
    this.addManagedListeners(t, {
      fieldPickerValueSelected: ({ value: i }) => this.dispatchLocalEvent({
        type: "advancedFilterBuilderAdded",
        item: this.item,
        isJoin: i.key === "join"
      })
    }), this.eAddButton.appendChild(t.getGui()), this.createOptionalManagedBean(
      this.registry.createDynamicBean("tooltipFeature", !1, {
        getGui: () => this.eAddButton,
        getLocation: () => "advancedFilter",
        getTooltipValue: () => this.advFilterExpSvc.translate("advancedFilterBuilderAddButtonTooltip")
      })
    );
  }
  setupRemoveButton() {
    this.eRemoveButton.appendChild(N("advancedFilterBuilderRemove", this.beans)), this.addManagedListeners(this.eRemoveButton, {
      click: () => this.removeItem(),
      keydown: (e) => {
        switch (e.key) {
          case S.ENTER:
            e.preventDefault(), he(e), this.removeItem();
            break;
        }
      }
    }), this.createOptionalManagedBean(
      this.registry.createDynamicBean("tooltipFeature", !1, {
        getGui: () => this.eRemoveButton,
        getLocation: () => "advancedFilter",
        getTooltipValue: () => this.advFilterExpSvc.translate("advancedFilterBuilderRemoveButtonTooltip")
      })
    ), re(this.eRemoveButton, this.advFilterExpSvc.translate("advancedFilterBuilderRemoveButtonTooltip")), this.activateTabIndex([this.eRemoveButton]);
  }
  setupMoveButtons(e) {
    e ? (this.eMoveUpButton.appendChild(N("advancedFilterBuilderMoveUp", this.beans)), this.addManagedListeners(this.eMoveUpButton, {
      click: () => this.moveItem(!0),
      keydown: (t) => {
        switch (t.key) {
          case S.ENTER:
            t.preventDefault(), he(t), this.moveItem(!0);
            break;
        }
      }
    }), this.moveUpTooltipFeature = this.createOptionalManagedBean(
      this.registry.createDynamicBean("tooltipFeature", !1, {
        getGui: () => this.eMoveUpButton,
        getLocation: () => "advancedFilter",
        getTooltipValue: () => this.moveUpDisabled ? null : this.advFilterExpSvc.translate("advancedFilterBuilderMoveUpButtonTooltip")
      })
    ), re(
      this.eMoveUpButton,
      this.advFilterExpSvc.translate("advancedFilterBuilderMoveUpButtonTooltip")
    ), this.eMoveDownButton.appendChild(N("advancedFilterBuilderMoveDown", this.beans)), this.addManagedListeners(this.eMoveDownButton, {
      click: () => this.moveItem(!1),
      keydown: (t) => {
        switch (t.key) {
          case S.ENTER:
            t.preventDefault(), he(t), this.moveItem(!1);
            break;
        }
      }
    }), this.moveDownTooltipFeature = this.createOptionalManagedBean(
      this.registry.createDynamicBean("tooltipFeature", !1, {
        getGui: () => this.eMoveDownButton,
        getLocation: () => "advancedFilter",
        getTooltipValue: () => this.moveDownDisabled ? null : this.advFilterExpSvc.translate("advancedFilterBuilderMoveDownButtonTooltip")
      })
    ), re(
      this.eMoveDownButton,
      this.advFilterExpSvc.translate("advancedFilterBuilderMoveDownButtonTooltip")
    ), this.activateTabIndex([this.eMoveUpButton, this.eMoveDownButton])) : (O(this.eMoveUpButton, !1), O(this.eMoveDownButton, !1));
  }
  updateValidity() {
    var e;
    kg(this.eValidation, !this.item.valid), (e = this.validationTooltipFeature) == null || e.refreshTooltip(), this.updateAriaLabel();
  }
  createPill(e) {
    const { key: t, cssClass: s, update: i, ariaLabel: r } = e, n = (o) => {
      o != null && (i(o), this.dispatchLocalEvent({
        type: "advancedFilterBuilderValueChanged"
      }));
    };
    if (e.isSelect) {
      const { getEditorParams: o, pickerAriaLabelKey: a, pickerAriaLabelValue: l, displayValue: c } = e, d = this.gos.get("advancedFilterBuilderParams"), h = `${(d == null ? void 0 : d.pillSelectMinWidth) ?? 140}px`, u = `${(d == null ? void 0 : d.pillSelectMaxWidth) ?? 200}px`, g = this.createBean(
        new aV({
          pickerAriaLabelKey: a,
          pickerAriaLabelValue: l,
          pickerType: "ag-list",
          value: {
            key: t,
            displayValue: c
          },
          valueFormatter: (p) => p == null ? "" : p.displayValue ?? p.key,
          variableWidth: !0,
          minPickerWidth: h,
          maxPickerWidth: u,
          getEditorParams: o,
          wrapperClassName: s,
          ariaLabel: r,
          pickerIcon: "advancedFilterBuilderSelectOpen"
        })
      );
      return this.addManagedListeners(g, {
        fieldPickerValueSelected: ({ value: p }) => n(p == null ? void 0 : p.key)
      }), g;
    } else {
      const { baseCellDataType: o, valueFormatter: a } = e, l = this.createBean(
        new rV({
          value: t,
          valueFormatter: a,
          cssClass: s,
          type: o,
          ariaLabel: r
        })
      );
      return this.addManagedListeners(l, { fieldValueChanged: ({ value: c }) => n(c) }), l;
    }
  }
  setupDragging() {
    const e = {
      type: zt.AdvancedFilterBuilder,
      eElement: this.eDragHandle,
      dragItemName: () => this.ePillWrapper.getDragName(),
      getDefaultIconName: () => "notAllowed",
      getDragItem: () => ({}),
      onDragStarted: () => this.dragFeature.dispatchLocalEvent({
        type: "advancedFilterBuilderDragStarted",
        item: this.item
      }),
      onDragStopped: () => this.dragFeature.dispatchLocalEvent({
        type: "advancedFilterBuilderDragEnded"
      })
    };
    this.dragAndDrop.addDragSource(e, !0), this.addDestroyFunc(() => this.dragAndDrop.removeDragSource(e));
  }
  updateAriaLabel() {
    const e = this.ePillWrapper.getAriaLabel(), t = `${this.item.level + 1}`, s = this.ePillWrapper.getValidationMessage();
    let i;
    s ? i = this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderItemValidation", [
      e,
      t,
      s
    ]) : i = this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderItem", [e, t]), re(this.focusWrapper, i);
  }
  updateAriaExpanded() {
    Dg(this.focusWrapper);
    const { filterModel: e } = this.item;
    (e == null ? void 0 : e.filterType) === "join" && e.conditions.length && qe(this.focusWrapper, !0);
  }
  removeItem() {
    this.dispatchLocalEvent({
      type: "advancedFilterBuilderRemoved",
      item: this.item
    });
  }
  moveItem(e) {
    this.dispatchLocalEvent({
      type: "advancedFilterBuilderMoved",
      item: this.item,
      backwards: e
    });
  }
}, cV = {
  apply: "advancedFilterBuilderApply",
  clear: "advancedFilterBuilderClear",
  cancel: "advancedFilterBuilderCancel",
  reset: "advancedFilterBuilderReset"
}, dV = {
  tag: "div",
  cls: "ag-advanced-filter-builder",
  role: "presentation",
  attrs: { tabindex: "-1" },
  children: [
    {
      tag: "div",
      ref: "eList",
      cls: "ag-advanced-filter-builder-list",
      role: "presentation"
    }
  ]
}, hV = class extends D {
  constructor() {
    super(dV), this.eList = x;
  }
  wireBeans(e) {
    this.filterManager = e.filterManager, this.advancedFilter = e.advancedFilter, this.advFilterExpSvc = e.advFilterExpSvc;
  }
  postConstruct() {
    const e = this.gos.get("advancedFilterBuilderParams");
    this.params = { buttons: ["apply", "cancel"], ...e }, this.addManagedPropertyListener("advancedFilterBuilderParams", ({ currentValue: t }) => {
      this.params.showMoveButtons = !!(t != null && t.showMoveButtons), this.params.buttons = (t == null ? void 0 : t.buttons) ?? ["apply", "cancel"], this.refreshList(!1);
    }), this.filterModel = this.setupFilterModel(), this.setupVirtualList(), this.dragFeature = this.createManagedBean(new W1(this, this.virtualList)), this.resetButtonsPanel(this.params.buttons);
  }
  refresh() {
    const e = this.virtualList;
    let t = e.getLastFocusedRow();
    this.setupFilterModel(), this.validateItems(), this.refreshList(!1), t != null && (e.getComponentAt(t) || (t = 0), e.focusRow(t));
  }
  getNumItems() {
    return this.items.length;
  }
  moveItem(e, t) {
    !t || !e || this.moveItemToIndex(e, t.rowIndex, t.position);
  }
  afterGuiAttached() {
    this.virtualList.awaitStable(() => this.virtualList.focusRow(0));
  }
  setupVirtualList() {
    const e = this.virtualList = this.createManagedBean(
      new yr({
        cssIdentifier: "advanced-filter-builder",
        ariaRole: "tree",
        listName: this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderList"),
        moveItemCallback: this.virtualListMoveItemCallback.bind(this)
      })
    );
    e.setComponentCreator(this.createItemComponent.bind(this)), e.setComponentUpdater(this.updateItemComponent.bind(this)), e.setRowHeight(40), this.eList.appendChild(e.getGui()), e.setModel({
      getRowCount: () => {
        var t;
        return ((t = this.items) == null ? void 0 : t.length) || 0;
      },
      getRow: (t) => this.items[t],
      areRowsEqual: (t, s) => t === s
    }), this.buildList(), e.refresh();
  }
  resetButtonsPanel(e) {
    const t = e && e.length > 0;
    let s = this.eButtons;
    if (t) {
      const i = e.map((n) => ({
        type: n,
        label: this.advFilterExpSvc.translate(cV[n])
      }));
      if (!s) {
        s = this.createBean(new Ca()), this.appendChild(s.getGui());
        const n = (o) => ({ event: a }) => {
          this.updateModel(o), this.afterAction(o, a);
        };
        s.addManagedListeners(s, {
          apply: n("apply"),
          clear: n("clear"),
          reset: n("reset"),
          cancel: n("cancel")
        }), this.eButtons = s;
      }
      s.updateButtons(i);
      const r = s.getApplyButton();
      if (r) {
        const n = (o) => this.toggleCss("ag-advanced-filter-builder-validation", o);
        this.addManagedElementListeners(r, {
          mouseenter: () => n(!0),
          mouseleave: () => n(!1)
        });
      }
    } else
      s && (se(s.getGui()), this.eButtons = this.destroyBean(s));
  }
  updateModel(e) {
    var t, s;
    switch (e) {
      case "apply":
        this.advancedFilter.setModel(this.filterModel), (t = this.filterManager) == null || t.onFilterChanged({ source: "advancedFilter" });
        break;
      case "reset":
        this.advancedFilter.setModel(null), (s = this.filterManager) == null || s.onFilterChanged({ source: "advancedFilter" });
        break;
      case "cancel":
        break;
      case "clear":
        this.filterModel = this.formatFilterModel(null), this.refreshList(!1);
        break;
    }
  }
  afterAction(e, t) {
    switch (e) {
      case "apply": {
        t == null || t.preventDefault(), this.close();
        break;
      }
      case "reset": {
        this.close();
        break;
      }
      case "cancel": {
        this.close();
        break;
      }
    }
  }
  removeItemFromParent(e) {
    const t = e.parent.conditions.indexOf(e.filterModel);
    return e.parent.conditions.splice(t, 1), t;
  }
  moveItemToIndex(e, t, s) {
    var a;
    const i = this.items[t], r = ((a = i.filterModel) == null ? void 0 : a.filterType) === "join" && s === "bottom", n = r ? i.filterModel : i.parent;
    if (!n || this.isChildOrSelf(n, e.filterModel) || i === e)
      return;
    this.removeItemFromParent(e);
    let o;
    r ? o = 0 : (o = n.conditions.indexOf(i.filterModel), o === -1 ? o = n.conditions.length : s === "bottom" && (o += 1)), n.conditions.splice(o, 0, e.filterModel), this.refreshList(!1);
  }
  isChildOrSelf(e, t) {
    return e === t || t.filterType === "join" && t.conditions.some((s) => this.isChildOrSelf(e, s));
  }
  setupFilterModel() {
    const e = this.formatFilterModel(this.advancedFilter.getModel());
    return this.stringifiedModel = JSON.stringify(e), e;
  }
  formatFilterModel(e) {
    return e = e ?? {
      filterType: "join",
      type: "AND",
      conditions: []
    }, e.filterType !== "join" && (e = {
      filterType: "join",
      type: "AND",
      conditions: [e]
    }), e;
  }
  buildList() {
    const e = (t, s, i, r) => {
      s.push({ filterModel: t, level: i, parent: r, valid: !0, showMove: this.params.showMoveButtons }), t.filterType === "join" && (t.conditions.forEach(
        (n) => e(n, s, i + 1, t)
      ), i === 0 && s.push({ filterModel: null, level: i + 1, parent: t, valid: !0 }));
    };
    this.items = [], e(this.filterModel, this.items, 0);
  }
  refreshList(e) {
    if (!e) {
      const t = [];
      this.items.forEach((s) => {
        s.valid || t.push(s.filterModel);
      }), this.buildList(), t.length && this.items.forEach((s) => {
        s.filterModel && t.includes(s.filterModel) && (s.valid = !1);
      });
    }
    this.virtualList.refresh(e), this.validate();
  }
  updateItemComponent(e, t) {
    const s = this.items.indexOf(e), i = (a, l) => {
      const c = this.items.find((h) => h.filterModel === a), d = c == null ? void 0 : c.parent;
      if (d) {
        const { conditions: h } = d;
        i(d, l), l.push(h[h.length - 1] === a);
      }
    }, r = [], { filterModel: n } = e;
    n && (i(n, r), r[0] = !1);
    const o = (n == null ? void 0 : n.filterType) === "join" && !!n.conditions.length;
    t.setState({
      disableMoveUp: s === 1,
      disableMoveDown: !this.canMoveDown(e, s),
      treeLines: r,
      showStartTreeLine: o
    });
  }
  createItemComponent(e, t) {
    const s = this.createBean(
      e.filterModel ? new xl(e, this.dragFeature, t) : new eV(e, t)
    );
    return s.addManagedListeners(s, {
      advancedFilterBuilderRemoved: ({ item: i }) => this.removeItem(i),
      advancedFilterBuilderValueChanged: () => this.validate(),
      advancedFilterBuilderAdded: ({ item: i, isJoin: r }) => this.addItem(i, r),
      advancedFilterBuilderMoved: ({ item: i, backwards: r }) => this.moveItemUpDown(i, r)
    }), s instanceof xl && this.updateItemComponent(e, s), s;
  }
  addItem(e, t) {
    var h;
    const { parent: s, level: i, filterModel: r } = e, n = (r == null ? void 0 : r.filterType) === "join", o = t ? {
      filterType: "join",
      type: "AND",
      conditions: []
    } : {}, a = n ? r : s;
    let l = n ? 0 : a.conditions.indexOf(r);
    l >= 0 ? (n || (l += 1), a.conditions.splice(l, 0, o)) : a.conditions.push(o);
    let c = this.items.indexOf(e);
    const d = c >= 0;
    if (d) {
      e.filterModel && c++;
      const u = [
        {
          filterModel: o,
          level: n ? i + 1 : i,
          parent: a,
          valid: t,
          showMove: this.params.showMoveButtons
        }
      ];
      this.items.splice(c, 0, ...u);
    }
    this.refreshList(d), d && ((h = this.virtualList.getComponentAt(c)) == null || h.afterAdd());
  }
  removeItem(e) {
    var a;
    const t = e.parent, { filterModel: s } = e, i = t.conditions.indexOf(s);
    t.conditions.splice(i, 1);
    const r = ((a = e.filterModel) == null ? void 0 : a.filterType) === "join", n = this.items.indexOf(e), o = !r && n >= 0;
    o && this.items.splice(n, 1), this.refreshList(o), n >= 0 && this.virtualList.focusRow(n);
  }
  moveItemUpDown(e, t, s) {
    const i = this.items.indexOf(e), r = t ? i - 1 : i + 1;
    if (r === 0 || !t && !this.canMoveDown(e, i))
      return;
    const n = this.items[r], o = this.removeItemFromParent(e), { level: a, filterModel: l, parent: c } = e, {
      level: d,
      filterModel: h,
      parent: u
    } = n;
    if (t)
      if (d === a && h.filterType === "join")
        h.conditions.push(l);
      else if (d <= a) {
        const f = u.conditions.indexOf(h);
        u.conditions.splice(f, 0, l);
      } else
        c.conditions[o - 1].conditions.push(l);
    else if (d === a)
      if (h.filterType === "join")
        h.conditions.splice(0, 0, l);
      else {
        const f = u.conditions.indexOf(h);
        u.conditions.splice(f + 1, 0, l);
      }
    else if (o < c.conditions.length)
      c.conditions.splice(o + 1, 0, l);
    else {
      const f = this.items.find((C) => C.filterModel === c), m = f.parent.conditions.indexOf(f.filterModel) + 1;
      f.parent.conditions.splice(m, 0, l);
    }
    this.refreshList(!1);
    const g = this.items.findIndex(
      ({ filterModel: f }) => f === l
    );
    if (g < 0)
      return;
    const p = this.virtualList.getComponentAt(g);
    p instanceof xl && (s || p.focusMoveButton(t));
  }
  virtualListMoveItemCallback(e, t) {
    const s = e.item, i = this.items.indexOf(s);
    i <= 0 || i === this.items.length - 1 || t && i === 1 || !t && !this.canMoveDown(s, i) || (this.moveItemUpDown(s, t, !0), this.virtualList.focusRow(i + (t ? -1 : 1)));
  }
  canMoveDown(e, t) {
    return !(e.level === 1 && t === this.items.length - 2 || e.level === 1 && e.parent.conditions[e.parent.conditions.length - 1] === e.filterModel);
  }
  close() {
    this.advancedFilter.getCtrl().toggleFilterBuilder({ source: "ui" });
  }
  validate() {
    var s;
    let e = this.items.every(({ valid: i }) => i), t = null;
    e ? (e = JSON.stringify(this.filterModel) !== this.stringifiedModel, e ? t = null : t = this.advFilterExpSvc.translate("advancedFilterBuilderValidationAlreadyApplied")) : t = this.advFilterExpSvc.translate("advancedFilterBuilderValidationIncomplete"), (s = this.eButtons) == null || s.updateValidity(e, t);
  }
  validateItems() {
    const e = (s) => {
      s.type = void 0;
    }, t = (s) => {
      delete s.filter;
    };
    this.items.forEach((s) => {
      if (!s.valid || !s.filterModel || s.filterModel.filterType === "join")
        return;
      const { filterModel: i } = s, { colId: r } = i, n = this.advFilterExpSvc.getColumnAutocompleteEntries().find(({ key: c }) => c === r), o = this.advFilterExpSvc.getColumnDetails(i.colId);
      if (!n || !o.column) {
        s.valid = !1, i.colId = void 0, e(i), t(i);
        return;
      }
      const l = this.advFilterExpSvc.getDataTypeExpressionOperator(o.baseCellDataType).operators[i.type];
      if (!l) {
        s.valid = !1, e(i), t(i);
        return;
      }
      if (l.numOperands > 0 && !A(i.filter)) {
        s.valid = !1;
        return;
      }
    });
  }
}, uV = class extends R {
  constructor(e) {
    super(), this.enabled = e;
  }
  wireBeans(e) {
    this.ctrlsSvc = e.ctrlsSvc, this.popupSvc = e.popupSvc, this.advFilterExpSvc = e.advFilterExpSvc, this.environment = e.environment;
  }
  postConstruct() {
    this.hasAdvancedFilterParent = !!this.gos.get("advancedFilterParent"), this.ctrlsSvc.whenReady(this, () => this.setAdvancedFilterComp()), this.addManagedEventListeners({
      advancedFilterEnabledChanged: ({ enabled: e }) => this.onEnabledChanged(e)
    }), this.addManagedPropertyListener("advancedFilterParent", () => this.updateComps()), this.addManagedPropertyListener("advancedFilterBuilderParams", (e) => {
      var t, s, i, r;
      ((t = e.currentValue) == null ? void 0 : t.suppressFullScreenButton) !== ((s = e.previousValue) == null ? void 0 : s.suppressFullScreenButton) && ((r = this.eBuilderDialog) == null || r.setMaximizable(((i = e.currentValue) == null ? void 0 : i.suppressFullScreenButton) ?? !0));
    }), this.addDestroyFunc(() => {
      this.destroyAdvancedFilterComp(), this.destroyBean(this.eBuilderComp), this.eBuilderDialog && this.eBuilderDialog.isAlive() && this.destroyBean(this.eBuilderDialog);
    });
  }
  setupHeaderComp(e) {
    var t;
    this.eHeaderComp && ((t = this.eHeaderComp) == null || t.getGui().remove(), this.destroyBean(this.eHeaderComp)), this.eHeaderComp = this.createManagedBean(
      new z1(this.enabled && !this.hasAdvancedFilterParent)
    ), e.insertAdjacentElement("beforebegin", this.eHeaderComp.getGui());
  }
  focusHeaderComp() {
    return this.eHeaderComp ? (this.eHeaderComp.getFocusableElement().focus(), !0) : !1;
  }
  refreshComp() {
    var e, t;
    (e = this.eFilterComp) == null || e.refresh(), (t = this.eHeaderComp) == null || t.refresh();
  }
  refreshBuilderComp() {
    var e;
    (e = this.eBuilderComp) == null || e.refresh();
  }
  getHeaderHeight() {
    var e;
    return ((e = this.eHeaderComp) == null ? void 0 : e.getHeight()) ?? 0;
  }
  setInputDisabled(e) {
    var t, s;
    (t = this.eFilterComp) == null || t.setInputDisabled(e), (s = this.eHeaderComp) == null || s.setInputDisabled(e);
  }
  toggleFilterBuilder(e) {
    const { source: t, force: s, eventSource: i } = e;
    if (s && this.eBuilderDialog || s === !1 && !this.eBuilderDialog)
      return;
    if (this.eBuilderDialog) {
      this.builderDestroySource = t, this.destroyBean(this.eBuilderDialog);
      return;
    }
    this.setInputDisabled(!0);
    const { width: r, height: n, minWidth: o } = this.getBuilderDialogSize(), { suppressFullScreenButton: a } = {
      suppressFullScreenButton: !1,
      ...this.gos.get("advancedFilterBuilderParams")
    };
    this.eBuilderComp = this.createBean(new hV()), this.eBuilderDialog = this.createBean(
      new Tn({
        title: this.advFilterExpSvc.translate("advancedFilterBuilderTitle"),
        component: this.eBuilderComp,
        width: r,
        height: n,
        resizable: !0,
        movable: !0,
        maximizable: !a,
        centered: !0,
        closable: !0,
        minWidth: o,
        afterGuiAttached: () => {
          var l;
          return (l = this.eBuilderComp) == null ? void 0 : l.afterGuiAttached();
        },
        postProcessPopupParams: {
          type: "advancedFilterBuilder",
          eventSource: i
        }
      })
    ), this.dispatchFilterBuilderVisibleChangedEvent(t, !0), this.eBuilderDialog.addEventListener("destroyed", () => {
      this.destroyBean(this.eBuilderComp), this.eBuilderComp = void 0, this.eBuilderDialog = void 0, this.setInputDisabled(!1), this.dispatchLocalEvent({
        type: "advancedFilterBuilderClosed"
      }), this.dispatchFilterBuilderVisibleChangedEvent(this.builderDestroySource ?? "ui", !1), this.builderDestroySource = void 0;
    });
  }
  dispatchFilterBuilderVisibleChangedEvent(e, t) {
    this.eventSvc.dispatchEvent({
      type: "advancedFilterBuilderVisibleChanged",
      source: e,
      visible: t
    });
  }
  getBuilderDialogSize() {
    var o;
    const e = ((o = this.gos.get("advancedFilterBuilderParams")) == null ? void 0 : o.minWidth) ?? 500, t = this.popupSvc.getPopupParent(), s = Math.round(Ri(t)) - 2, i = Math.round(ra(t) * 0.75) - 2, r = Math.min(Math.max(700, e), s), n = Math.min(600, i);
    return { width: r, height: n, minWidth: e };
  }
  onEnabledChanged(e) {
    this.enabled = e, this.updateComps();
  }
  updateComps() {
    this.setAdvancedFilterComp(), this.setHeaderCompEnabled(), this.eventSvc.dispatchEvent({
      type: "headerHeightChanged"
    });
  }
  setAdvancedFilterComp() {
    if (this.destroyAdvancedFilterComp(), !this.enabled)
      return;
    const e = this.gos.get("advancedFilterParent");
    if (this.hasAdvancedFilterParent = !!e, e) {
      const t = this.createBean(new hC()), s = t.getGui();
      this.environment.applyThemeClasses(s), s.classList.add(this.gos.get("enableRtl") ? "ag-rtl" : "ag-ltr"), e.appendChild(s), this.eFilterComp = t;
    }
  }
  setHeaderCompEnabled() {
    var e;
    (e = this.eHeaderComp) == null || e.setEnabled(this.enabled && !this.hasAdvancedFilterParent);
  }
  destroyAdvancedFilterComp() {
    this.eFilterComp && (se(this.eFilterComp.getGui()), this.destroyBean(this.eFilterComp));
  }
}, gV = class {
  constructor(e) {
    this.params = e, this.operators = [], this.operatorStartPositions = [], this.operatorEndPositions = [], this.activeOperator = 0, this.validationError = null;
  }
  parseExpression(e) {
    this.operators.push(""), this.operatorStartPositions.push(e), this.operatorEndPositions.push(void 0);
    const { expression: t } = this.params;
    for (; e < t.length; ) {
      const s = t[e];
      if (s === " ") {
        if (this.parseOperator(e - 1))
          return this.activeOperator++, e - 1;
        this.operators[this.activeOperator] += s;
      } else
        this.operators[this.activeOperator] += s;
      e++;
    }
    return this.parseOperator(e - 1), e;
  }
  isValid() {
    return !this.validationError && (!this.operators.length || !!this.parsedOperator);
  }
  getValidationError() {
    return this.validationError;
  }
  getFunction() {
    return this.parsedOperator === "OR" ? "||" : "&&";
  }
  getModel() {
    return this.parsedOperator === "OR" ? "OR" : "AND";
  }
  getAutocompleteListParams(e, t) {
    let s;
    if (t == null)
      s = "";
    else {
      const r = this.operators[t], n = this.operatorEndPositions[t];
      s = wc(
        r,
        e,
        n == null ? this.params.expression.length : n + 1
      );
    }
    let i = this.params.advFilterExpSvc.getJoinOperatorAutocompleteEntries();
    return (t || t == null && this.activeOperator) && (i = i.filter(({ key: r }) => r === this.parsedOperator)), this.params.advFilterExpSvc.generateAutocompleteListParams(i, "join", s);
  }
  updateExpression(e, t, s) {
    let { expression: i } = this.params;
    const r = t.displayValue ?? t.key;
    if (s === 0)
      for (let a = this.operatorEndPositions.length - 1; a > 0; a--) {
        const l = this.operatorEndPositions[a];
        l != null && (i = Zs(
          i,
          this.operatorStartPositions[a],
          l,
          r
        ).updatedValue);
      }
    const n = this.operatorStartPositions.length > s ? this.operatorStartPositions[s] : e, o = (this.operatorEndPositions.length > s ? this.operatorEndPositions[s] : void 0) ?? bc(i, e, !0).endPosition;
    return Zs(i, n, o, r, !0);
  }
  getNumOperators() {
    return this.operators.length;
  }
  getLastOperatorEndPosition() {
    return this.operatorEndPositions[this.operatorEndPositions.length - 1];
  }
  parseOperator(e) {
    const t = this.operators.length > this.activeOperator ? this.operators[this.activeOperator] : "", s = this.params.advFilterExpSvc.getExpressionJoinOperators(), i = Ta(t, s, (r) => r);
    if (i) {
      this.operatorEndPositions[this.activeOperator] = e;
      const r = s[i];
      if (this.activeOperator) {
        if (i !== this.parsedOperator)
          return this.validationError || (this.validationError = {
            message: this.params.advFilterExpSvc.translate(
              "advancedFilterValidationJoinOperatorMismatch"
            ),
            startPosition: e - t.length + 1,
            endPosition: e
          }), !1;
      } else
        this.parsedOperator = i;
      return t !== r && (_d(this.params, t, r, e), this.operators[this.activeOperator] = r), !0;
    } else return i === null ? !1 : (this.validationError || (this.validationError = {
      message: this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidJoinOperator"),
      startPosition: e - t.length + 1,
      endPosition: e
    }), !0);
  }
}, pV = class CC {
  constructor(t, s) {
    this.params = t, this.startPosition = s, this.expectingExpression = !0, this.expectingOperator = !1, this.expressionParsers = [], this.operatorParser = new gV(this.params), this.missingEndBracket = !1, this.extraEndBracket = !1;
  }
  parseExpression() {
    let t = this.startPosition;
    const { expression: s } = this.params;
    for (; t < s.length; ) {
      const i = s[t];
      if (i === "(" && !this.expectingOperator) {
        const r = new CC(this.params, t + 1);
        t = r.parseExpression(), this.expressionParsers.push(r), this.expectingExpression = !1, this.expectingOperator = !0;
      } else {
        if (i === ")")
          return this.endPosition = t - 1, this.startPosition === 0 && (this.extraEndBracket = !0), t;
        if (i !== " ") if (this.expectingExpression) {
          const r = new R1(this.params, t);
          t = r.parseExpression(), this.expressionParsers.push(r), this.expectingExpression = !1, this.expectingOperator = !0;
        } else this.expectingOperator && (t = this.operatorParser.parseExpression(t), this.expectingOperator = !1, this.expectingExpression = !0);
      }
      t++;
    }
    return this.startPosition > 0 && (this.missingEndBracket = !0), t;
  }
  isValid() {
    return !this.missingEndBracket && !this.extraEndBracket && this.expressionParsers.length === this.operatorParser.getNumOperators() + 1 && this.operatorParser.isValid() && this.expressionParsers.every((t) => t.isValid());
  }
  getValidationError() {
    const t = this.operatorParser.getValidationError();
    for (let i = 0; i < this.expressionParsers.length; i++) {
      const r = this.expressionParsers[i].getValidationError();
      if (r)
        return t && t.startPosition < r.startPosition ? t : r;
    }
    if (t)
      return t;
    if (this.extraEndBracket)
      return {
        message: this.params.advFilterExpSvc.translate("advancedFilterValidationExtraEndBracket"),
        startPosition: this.endPosition + 1,
        endPosition: this.endPosition + 1
      };
    let s;
    return this.expressionParsers.length === this.operatorParser.getNumOperators() ? s = "advancedFilterValidationMissingCondition" : this.missingEndBracket && (s = "advancedFilterValidationMissingEndBracket"), s ? {
      message: this.params.advFilterExpSvc.translate(s),
      startPosition: this.params.expression.length,
      endPosition: this.params.expression.length
    } : null;
  }
  getFunction(t) {
    const s = this.operatorParser.getFunction(), i = this.expressionParsers.map((n) => n.getFunction(t)), r = s === "&&" ? "every" : "some";
    return (n, o, a) => i[r]((l) => l(n, o, a));
  }
  getAutocompleteListParams(t) {
    if (this.endPosition != null && t > this.endPosition + 1)
      return;
    if (!this.expressionParsers.length)
      return this.getColumnAutocompleteListParams();
    const s = this.getExpressionParserIndex(t);
    if (s == null)
      return this.params.expression[t] === "(" ? { enabled: !1 } : this.getColumnAutocompleteListParams();
    const r = this.expressionParsers[s].getAutocompleteListParams(t);
    if (!r) {
      if (s < this.expressionParsers.length - 1)
        return this.operatorParser.getAutocompleteListParams(t, s);
      if (this.expressionParsers.length === this.operatorParser.getNumOperators()) {
        const n = this.operatorParser.getLastOperatorEndPosition();
        return n == null || t <= n + 1 ? this.operatorParser.getAutocompleteListParams(t, this.operatorParser.getNumOperators() - 1) : this.getColumnAutocompleteListParams();
      }
      return this.params.expression[t - 1] === ")" ? { enabled: !1 } : this.operatorParser.getAutocompleteListParams(t);
    }
    return r;
  }
  updateExpression(t, s, i) {
    const r = this.params.expression, n = this.getExpressionParserIndex(t);
    if (n == null) {
      const l = i === "column" ? this.params.advFilterExpSvc.getColumnValue(s) : s.displayValue ?? s.key;
      return Zs(r, this.startPosition, this.startPosition, l, !0);
    }
    const a = this.expressionParsers[n].updateExpression(t, s, i);
    return a ?? (i === "column" ? Zs(
      r,
      t,
      r.length - 1,
      this.params.advFilterExpSvc.getColumnValue(s),
      !0
    ) : this.endPosition != null && t > this.endPosition + 1 ? null : this.operatorParser.updateExpression(t, s, n));
  }
  getModel() {
    return this.expressionParsers.length > 1 ? {
      filterType: "join",
      type: this.operatorParser.getModel(),
      conditions: this.expressionParsers.map((t) => t.getModel())
    } : this.expressionParsers[0].getModel();
  }
  getColumnAutocompleteListParams() {
    return this.params.advFilterExpSvc.generateAutocompleteListParams(
      this.params.advFilterExpSvc.getColumnAutocompleteEntries(),
      "column",
      ""
    );
  }
  getExpressionParserIndex(t) {
    let s;
    for (let i = 0; i < this.expressionParsers.length && !(this.expressionParsers[i].startPosition > t); i++)
      s = i;
    return s;
  }
}, fV = class {
  constructor(e) {
    this.params = e, this.valid = !1;
  }
  parseExpression() {
    this.joinExpressionParser = new pV(this.params, 0);
    const e = this.joinExpressionParser.parseExpression();
    return this.valid = e >= this.params.expression.length - 1 && this.joinExpressionParser.isValid(), this.params.expression;
  }
  isValid() {
    return this.valid;
  }
  getValidationMessage() {
    const e = this.joinExpressionParser.getValidationError();
    if (!e)
      return null;
    const { message: t, startPosition: s, endPosition: i } = e;
    return s < this.params.expression.length ? this.params.advFilterExpSvc.translate("advancedFilterValidationMessage", [
      t,
      this.params.expression.slice(s, i + 1).trim()
    ]) : this.params.advFilterExpSvc.translate("advancedFilterValidationMessageAtEnd", [t]);
  }
  getFunction() {
    const e = this.createFunctionParams();
    return {
      expressionFunction: this.joinExpressionParser.getFunction(e),
      params: e
    };
  }
  getAutocompleteListParams(e) {
    return this.joinExpressionParser.getAutocompleteListParams(e) ?? { enabled: !1 };
  }
  updateExpression(e, t, s) {
    return this.joinExpressionParser.updateExpression(e, t, s);
  }
  getModel() {
    return this.isValid() ? this.joinExpressionParser.getModel() : null;
  }
  createFunctionParams() {
    return {
      operands: [],
      operators: [],
      evaluatorParams: []
    };
  }
}, mV = class extends R {
  constructor() {
    super(...arguments), this.beanName = "advancedFilter", this.appliedExpression = null, this.expression = null, this.isValid = !0;
  }
  wireBeans(e) {
    this.valueSvc = e.valueSvc, this.colModel = e.colModel, this.dataTypeSvc = e.dataTypeSvc, this.advFilterExpSvc = e.advFilterExpSvc, this.filterValueSvc = e.filterValueSvc, this.filterManager = e.filterManager;
  }
  postConstruct() {
    this.setEnabled(this.gos.get("enableAdvancedFilter"), !0), this.ctrl = this.createManagedBean(new uV(this.enabled)), this.expressionProxy = {
      getValue: (e, t) => {
        const s = this.colModel.getColDefCol(e);
        return s ? this.filterValueSvc.getValue(s, t) : void 0;
      }
    }, this.addManagedPropertyListener("enableAdvancedFilter", (e) => this.setEnabled(!!e.currentValue)), this.addManagedEventListeners({
      newColumnsLoaded: (e) => this.onNewColumnsLoaded(e)
    }), this.addManagedPropertyListener("includeHiddenColumnsInAdvancedFilter", () => {
      var t;
      this.updateValidity() && ((t = this.filterManager) == null || t.onFilterChanged({ source: "advancedFilter" }));
    });
  }
  isEnabled() {
    return this.enabled;
  }
  isFilterPresent() {
    return !!this.expressionFunction;
  }
  doesFilterPass(e) {
    return this.expressionFunction(this.expressionProxy, e, this.expressionParams);
  }
  getModel() {
    const e = this.createExpressionParser(this.appliedExpression);
    return e == null || e.parseExpression(), (e == null ? void 0 : e.getModel()) ?? null;
  }
  setModel(e) {
    const t = (i, r) => {
      if (i.filterType === "join") {
        const n = this.advFilterExpSvc.parseJoinOperator(i), o = i.conditions.map((a) => t(a)).filter((a) => A(a)).join(` ${n} `);
        return r || i.conditions.length <= 1 ? o : `(${o})`;
      } else
        return this.advFilterExpSvc.parseColumnFilterModel(i);
    }, s = e ? t(e, !0) : null;
    this.setExpressionDisplayValue(s), this.applyExpression(), this.ctrl.refreshComp(), this.ctrl.refreshBuilderComp();
  }
  getExpressionDisplayValue() {
    return this.expression;
  }
  setExpressionDisplayValue(e) {
    this.expression = e;
  }
  isCurrentExpressionApplied() {
    return this.appliedExpression === this.expression;
  }
  createExpressionParser(e) {
    return e ? new fV({
      expression: e,
      colModel: this.colModel,
      dataTypeSvc: this.dataTypeSvc,
      valueSvc: this.valueSvc,
      advFilterExpSvc: this.advFilterExpSvc
    }) : null;
  }
  getDefaultExpression(e) {
    const t = this.advFilterExpSvc.getColumnValue(e) + " ";
    return {
      updatedValue: t,
      updatedPosition: t.length
    };
  }
  isHeaderActive() {
    return !this.gos.get("advancedFilterParent");
  }
  getCtrl() {
    return this.ctrl;
  }
  setEnabled(e, t) {
    const s = this.enabled, i = te(this.gos) || Le(this.gos);
    e && !i && F(123), this.enabled = e && i, !t && this.enabled !== s && this.eventSvc.dispatchEvent({
      type: "advancedFilterEnabledChanged",
      enabled: this.enabled
    });
  }
  applyExpression() {
    const e = this.createExpressionParser(this.expression);
    e == null || e.parseExpression(), this.applyExpressionFromParser(e);
  }
  getAppliedExpressionDisplayValue() {
    return this.appliedExpression;
  }
  applyExpressionFromParser(e) {
    if (this.isValid = !e || e.isValid(), !e || !this.isValid) {
      this.expressionFunction = null, this.expressionParams = null, this.appliedExpression = null;
      return;
    }
    const { expressionFunction: t, params: s } = e.getFunction();
    this.expressionFunction = t, this.expressionParams = s, this.appliedExpression = this.expression;
  }
  updateValidity() {
    this.advFilterExpSvc.resetColumnCaches();
    const e = this.createExpressionParser(this.expression);
    e == null || e.parseExpression();
    const s = (!e || e.isValid()) !== this.isValid;
    return this.applyExpressionFromParser(e), this.ctrl.refreshComp(), this.ctrl.refreshBuilderComp(), s;
  }
  onNewColumnsLoaded(e) {
    var s;
    if (e.source !== "gridInitializing" || !((s = this.dataTypeSvc) != null && s.isPendingInference))
      return;
    this.ctrl.setInputDisabled(!0);
    const [t] = this.addManagedEventListeners({
      dataTypesInferred: () => {
        t == null || t(), this.ctrl.setInputDisabled(!1);
      }
    });
  }
}, CV = {
  moduleName: "AdvancedFilter",
  version: Y,
  beans: [mV, E1],
  icons: {
    // Builder button in Advanced Filter
    advancedFilterBuilder: "group",
    // drag handle used to pick up Advanced Filter Builder rows
    advancedFilterBuilderDrag: "grip",
    // Advanced Filter Builder row validation error
    advancedFilterBuilderInvalid: "not-allowed",
    // shown on Advanced Filter Builder rows to move them up
    advancedFilterBuilderMoveUp: "up",
    // shown on Advanced Filter Builder rows to move them down
    advancedFilterBuilderMoveDown: "down",
    // shown on Advanced Filter Builder rows to add new rows
    advancedFilterBuilderAdd: "plus",
    // shown on Advanced Filter Builder rows to remove row
    advancedFilterBuilderRemove: "minus",
    // shown on Advanced Filter Builder selection pills
    advancedFilterBuilderSelectOpen: "small-down",
    // remove for rich select editor pills
    richSelectRemove: "cancel"
  },
  apiFunctions: {
    getAdvancedFilterModel: m1,
    setAdvancedFilterModel: C1,
    showAdvancedFilterBuilder: v1,
    hideAdvancedFilterBuilder: w1
  },
  dependsOn: [
    ie,
    Ra,
    Hi,
    Is,
    Bd,
    Nd
  ],
  css: [f1]
};
function vV(e) {
  var t;
  return ((t = e.sideBar) == null ? void 0 : t.comp.isDisplayed()) ?? !1;
}
function wV(e, t) {
  var s;
  (s = e.sideBar) == null || s.comp.setDisplayed(t);
}
function bV(e, t) {
  var s;
  (s = e.sideBar) == null || s.comp.setSideBarPosition(t);
}
function yV(e, t, s) {
  var i;
  (i = e.sideBar) == null || i.comp.openToolPanel(t, "api", s);
}
function SV(e) {
  var t;
  (t = e.sideBar) == null || t.comp.close("api");
}
function xV(e) {
  var t;
  return ((t = e.sideBar) == null ? void 0 : t.comp.openedItem()) ?? null;
}
function FV(e) {
  var t;
  (t = e.sideBar) == null || t.comp.refresh();
}
function RV(e) {
  var t;
  return ((t = e.sideBar) == null ? void 0 : t.comp.isToolPanelShowing()) ?? !1;
}
function PV(e, t) {
  var i;
  const s = (i = e.sideBar) == null ? void 0 : i.comp.getToolPanelInstance(t);
  return Mi(s);
}
function EV(e) {
  var t;
  return (t = e.sideBar) == null ? void 0 : t.comp.getDef();
}
function xc(e, t) {
  if (!t)
    return null;
  const s = Vt(e), i = s.indexOf(t);
  if (i === -1)
    return null;
  let r = -1;
  for (let n = i - 1; n >= 0; n--)
    if (s[n].classList.contains(oo.TAB_GUARD_TOP)) {
      r = n;
      break;
    }
  return r <= 0 ? null : s[r - 1];
}
function vC(e, t) {
  if (!t)
    return !1;
  const s = e.querySelectorAll(`.${tf}`);
  if (!s.length)
    return !1;
  for (let i = 0; i < s.length; i++)
    if (s[i].contains(t))
      return !0;
  return !1;
}
var TV = (
  /*css*/
  '.ag-tool-panel-wrapper{display:flex;overflow:hidden auto;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ag-side-bar-panel-width)}.ag-tool-panel-external{display:flex;flex-direction:row}:where(.ag-tool-panel-external) .ag-tool-panel-wrapper{flex-grow:1}.ag-select-agg-func-item{align-items:center;display:flex;flex:1 1 auto;flex-flow:row nowrap;height:100%;overflow:hidden;position:relative;text-overflow:ellipsis;white-space:nowrap;>*{flex:none}}.ag-tool-panel-horizontal-resize{cursor:ew-resize;height:100%;position:absolute;top:0;width:5px;z-index:1}.ag-side-bar{background-color:var(--ag-side-bar-background-color);display:flex;flex-direction:row-reverse;position:relative}:where(.ag-ltr) :where(.ag-side-bar-left) .ag-tool-panel-horizontal-resize{right:-3px}:where(.ag-rtl) :where(.ag-side-bar-left) .ag-tool-panel-horizontal-resize{left:-3px}:where(.ag-ltr) :where(.ag-side-bar-right) .ag-tool-panel-horizontal-resize{left:-3px}:where(.ag-rtl) :where(.ag-side-bar-right) .ag-tool-panel-horizontal-resize{right:-3px}.ag-side-bar-left{flex-direction:row;order:-1}.ag-side-buttons{background-color:var(--ag-side-button-bar-background-color);padding-top:var(--ag-side-button-bar-top-padding);position:relative}.ag-side-button{background-color:var(--ag-side-button-background-color);border-bottom:var(--ag-side-button-border);border-top:var(--ag-side-button-border);color:var(--ag-side-button-text-color);margin-top:-1px;position:relative;&:before{background-color:transparent;bottom:0;content:"";display:block;position:absolute;top:0;transition:background-color var(--ag-side-button-selected-underline-transition-duration);width:var(--ag-side-button-selected-underline-width)}&:hover{background-color:var(--ag-side-button-hover-background-color);color:var(--ag-side-button-hover-text-color)}&.ag-selected{background-color:var(--ag-side-button-selected-background-color);border-bottom:var(--ag-side-button-selected-border);border-top:var(--ag-side-button-selected-border);color:var(--ag-side-button-selected-text-color);&:before{background-color:var(--ag-side-button-selected-underline-color)}}}:where(.ag-ltr) .ag-side-button{&:before{left:0}}:where(.ag-rtl) .ag-side-button{&:before{right:0}}.ag-side-button-button{align-items:center;display:flex;flex-direction:column;gap:var(--ag-spacing);position:relative;white-space:nowrap;width:100%;&:focus{box-shadow:none}}:where(.ag-ltr) .ag-side-button-button{padding:var(--ag-side-button-vertical-padding) var(--ag-side-button-right-padding) var(--ag-side-button-vertical-padding) var(--ag-side-button-left-padding)}:where(.ag-rtl) .ag-side-button-button{padding:var(--ag-side-button-vertical-padding) var(--ag-side-button-left-padding) var(--ag-side-button-vertical-padding) var(--ag-side-button-right-padding)}.ag-side-button-button:focus-visible{box-shadow:inset var(--ag-focus-shadow)}.ag-side-button-label{writing-mode:vertical-lr}@media (resolution <= 1.5x){.ag-side-button-label{font-family:"Segoe UI",var(--ag-font-family)}:where(.ag-ltr) .ag-side-button-label{transform:rotate(.05deg)}:where(.ag-rtl) .ag-side-button-label{transform:rotate(-.05deg)}}:where(.ag-ltr) .ag-side-bar-left,:where(.ag-rtl) .ag-side-bar-right{border-right:var(--ag-side-panel-border);:where(.ag-tool-panel-wrapper){border-left:var(--ag-side-panel-border)}}:where(.ag-ltr) .ag-side-bar-right,:where(.ag-rtl) .ag-side-bar-left{border-left:var(--ag-side-panel-border);:where(.ag-tool-panel-wrapper){border-right:var(--ag-side-panel-border)}}'
), MV = {
  tag: "div",
  cls: "ag-side-button",
  role: "presentation",
  children: [
    {
      tag: "button",
      ref: "eToggleButton",
      cls: "ag-button ag-side-button-button",
      role: "tab",
      attrs: { type: "button", tabindex: "-1", "aria-expanded": "false" },
      children: [
        {
          tag: "div",
          ref: "eIconWrapper",
          cls: "ag-side-button-icon-wrapper",
          attrs: { "aria-hidden": "true" }
        },
        { tag: "span", ref: "eLabel", cls: "ag-side-button-label" }
      ]
    }
  ]
}, DV = class extends D {
  constructor(e) {
    super(), this.toolPanelDef = e, this.eToggleButton = x, this.eIconWrapper = x, this.eLabel = x;
  }
  getToolPanelId() {
    return this.toolPanelDef.id;
  }
  postConstruct() {
    this.setTemplate(MV, []), this.setLabel(), this.setIcon(), this.addManagedElementListeners(this.eToggleButton, { click: this.onButtonPressed.bind(this) }), this.eToggleButton.setAttribute("id", `ag-${this.getCompId()}-button`);
  }
  setLabel() {
    const e = this.toolPanelDef, t = this.getLocaleTextFunc()(e.labelKey, e.labelDefault);
    this.eLabel.textContent = t;
  }
  setIcon() {
    this.eIconWrapper.insertAdjacentElement(
      "afterbegin",
      N(this.toolPanelDef.iconKey, this.beans)
    );
  }
  onButtonPressed() {
    this.dispatchLocalEvent({ type: "toggleButtonClicked" });
  }
  setSelected(e) {
    this.toggleCss("ag-selected", e), qe(this.eToggleButton, e);
  }
}, AV = { tag: "div", cls: "ag-side-buttons", role: "tablist" }, IV = class extends D {
  constructor() {
    super(AV), this.buttonComps = [];
  }
  postConstruct() {
    this.addManagedElementListeners(this.getFocusableElement(), { keydown: this.handleKeyDown.bind(this) });
  }
  handleKeyDown(e) {
    if (!(e.key !== S.TAB || !e.shiftKey)) {
      if (rs(this.beans, !0)) {
        e.preventDefault();
        return;
      }
      he(e);
    }
  }
  setActiveButton(e) {
    this.buttonComps.forEach((t) => {
      t.setSelected(e === t.getToolPanelId());
    });
  }
  addButtonComp(e) {
    const t = this.createBean(new DV(e));
    return this.buttonComps.push(t), this.appendChild(t), t.addEventListener("toggleButtonClicked", () => {
      this.dispatchLocalEvent({
        type: "sideBarButtonClicked",
        toolPanelId: e.id
      });
    }), t;
  }
  clearButtons() {
    this.buttonComps = this.destroyBeans(this.buttonComps), X(this.getGui());
  }
  destroy() {
    this.clearButtons(), super.destroy();
  }
}, LV = {
  selector: "AG-SIDE-BAR-BUTTONS",
  component: IV
}, wC = {
  id: "columns",
  labelDefault: "Columns",
  labelKey: "columns",
  iconKey: "columnsToolPanel",
  toolPanel: "agColumnsToolPanel"
}, bC = {
  id: "filters",
  labelDefault: "Filters",
  labelKey: "filters",
  iconKey: "filtersToolPanel",
  toolPanel: "agFiltersToolPanel"
}, kV = {
  id: "filters-new",
  labelDefault: "Filters",
  labelKey: "filters",
  iconKey: "filtersToolPanel",
  toolPanel: "agNewFiltersToolPanel"
}, Jr = {
  columns: wC,
  filters: bC,
  "filters-new": kV
};
function Fc(e) {
  if (e) {
    if (e === !0)
      return {
        toolPanels: [wC, bC],
        defaultToolPanel: "columns"
      };
    if (typeof e == "string")
      return Fc([e]);
    if (Array.isArray(e)) {
      const t = [];
      return e.forEach((s) => {
        const i = Jr[s];
        if (!i) {
          F(215, { key: s, defaultByKey: Jr });
          return;
        }
        t.push(i);
      }), t.length === 0 ? void 0 : {
        toolPanels: t,
        defaultToolPanel: t[0].id
      };
    }
    return {
      toolPanels: GV(e.toolPanels),
      defaultToolPanel: e.defaultToolPanel,
      hiddenByDefault: e.hiddenByDefault,
      position: e.position,
      hideButtons: e.hideButtons
    };
  }
}
function GV(e) {
  const t = [];
  return e && e.forEach((s) => {
    const i = yC(s);
    i && t.push(i);
  }), t;
}
function yC(e) {
  return typeof e != "string" ? e : Jr[e] ? Jr[e] : (F(215, { key: e, defaultByKey: Jr }), null);
}
var OV = class extends D {
  constructor() {
    super({ tag: "div", cls: "ag-tool-panel-horizontal-resize" }), this.minWidth = 100, this.maxWidth = null;
  }
  postConstruct() {
    const e = this.beans.horizontalResizeSvc.addResizeBar({
      eResizeBar: this.getGui(),
      dragStartPixels: 1,
      onResizeStart: this.onResizeStart.bind(this),
      onResizing: this.onResizing.bind(this),
      onResizeEnd: this.onResizeEnd.bind(this)
    });
    this.addDestroyFunc(e), this.inverted = this.gos.get("enableRtl");
  }
  dispatchResizeEvent(e, t, s) {
    this.eventSvc.dispatchEvent({
      type: "toolPanelSizeChanged",
      width: s,
      started: e,
      ended: t
    });
  }
  onResizeStart() {
    this.startingWidth = this.elementToResize.offsetWidth, this.dispatchResizeEvent(!0, !1, this.startingWidth);
  }
  onResizeEnd(e) {
    return this.onResizing(e, !0);
  }
  onResizing(e, t = !1) {
    const s = this.inverted ? -1 : 1;
    let i = Math.max(this.minWidth, Math.floor(this.startingWidth - e * s));
    this.maxWidth != null && (i = Math.min(this.maxWidth, i)), this.elementToResize.style.width = `${i}px`, this.dispatchResizeEvent(!1, t, i);
  }
};
function VV(e, t, s) {
  return e.getCompDetails(t, BV, void 0, s, !0);
}
var BV = {
  name: "toolPanel",
  optionalMethods: ["refresh", "getState"]
}, NV = {
  tag: "div",
  cls: "ag-tool-panel-wrapper",
  role: "tabpanel"
}, HV = class extends D {
  constructor() {
    super(NV);
  }
  postConstruct() {
    const e = this.getGui(), t = this.resizeBar = this.createManagedBean(new OV());
    e.setAttribute("id", `ag-${this.getCompId()}`), t.elementToResize = e, this.appendChild(t);
  }
  getToolPanelId() {
    return this.toolPanelId;
  }
  setToolPanelDef(e, t) {
    const { id: s, minWidth: i, maxWidth: r, width: n } = e;
    this.toolPanelId = s, this.width = n;
    const o = VV(this.beans.userCompFactory, e, t);
    if (o == null)
      return !1;
    const a = o.newAgStackInstance();
    this.params = o.params, a.then(this.setToolPanelComponent.bind(this));
    const l = this.resizeBar;
    return i != null && (l.minWidth = i), r != null && (l.maxWidth = r), !0;
  }
  setToolPanelComponent(e) {
    this.toolPanelCompInstance = e, this.appendChild(e.getGui()), this.addDestroyFunc(() => {
      this.destroyBean(e);
    });
    const t = this.width;
    t && (this.getGui().style.width = `${t}px`);
  }
  getToolPanelInstance() {
    return this.toolPanelCompInstance;
  }
  setResizerSizerSide(e) {
    const t = this.gos.get("enableRtl"), s = e === "left", i = t ? s : !s;
    this.resizeBar.inverted = i;
  }
  refresh() {
    var e;
    (e = this.toolPanelCompInstance) == null || e.refresh(this.params);
  }
}, zV = {
  tag: "div",
  cls: "ag-side-bar ag-unselectable",
  children: [
    {
      tag: "ag-side-bar-buttons",
      ref: "sideBarButtons"
    }
  ]
}, WV = class extends D {
  constructor() {
    super(zV, [LV]), this.sideBarButtons = x, this.toolPanelWrappers = [], this.registerCSS(TV);
  }
  postConstruct() {
    this.sideBarButtons.addEventListener("sideBarButtonClicked", this.onToolPanelButtonClicked.bind(this));
    const { beans: e, gos: t } = this, { sideBar: s } = t.get("initialState") ?? {};
    this.setSideBarDef({
      sideBarDef: Fc(t.get("sideBar")),
      sideBarState: s
    }), this.addManagedPropertyListener("sideBar", () => this.setState()), e.sideBar.comp = this;
    const i = this.getFocusableElement();
    this.createManagedBean(
      new ii(i, {
        onTabKeyDown: this.onTabKeyDown.bind(this),
        handleKeyDown: this.handleKeyDown.bind(this)
      })
    ), wf(e, this, i);
  }
  onTabKeyDown(e) {
    if (e.defaultPrevented)
      return;
    const { beans: t, sideBarButtons: s } = this, i = this.getGui(), r = s.getGui(), n = Q(t), o = i.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)"), a = e.target, l = e.shiftKey;
    if (!o)
      return rs(t, l) ? (e.preventDefault(), !0) : rs(t, l, !0);
    if (r.contains(n)) {
      ye(o, l) && e.preventDefault();
      return;
    }
    if (!l)
      return;
    let c = null;
    o.contains(n) ? c = ze(t, o, void 0, !0) : vC(o, a) && (c = xc(o, a)), c || (c = r.querySelector(".ag-selected button"), c = Ze(c) ? c : null), c && c !== e.target && (e.preventDefault(), c.focus());
  }
  handleKeyDown(e) {
    const t = Q(this.beans), s = this.sideBarButtons;
    if (!s.getGui().contains(t))
      return;
    const i = s.getGui(), r = Array.prototype.slice.call(i.querySelectorAll(".ag-side-button")), n = r.findIndex((l) => l.contains(t));
    let o = null;
    switch (e.key) {
      case S.LEFT:
      case S.UP:
        o = Math.max(0, n - 1);
        break;
      case S.RIGHT:
      case S.DOWN:
        o = Math.min(n + 1, r.length - 1);
        break;
    }
    if (o === null)
      return;
    const a = r[o].querySelector("button");
    a && (a.focus(), e.preventDefault());
  }
  onToolPanelButtonClicked(e) {
    const t = e.toolPanelId;
    this.openedItem() === t ? this.openToolPanel(void 0, "sideBarButtonClicked") : this.openToolPanel(t, "sideBarButtonClicked");
  }
  clearDownUi() {
    this.sideBarButtons.clearButtons(), this.destroyToolPanelWrappers();
  }
  setSideBarDef({
    sideBarDef: e,
    sideBarState: t,
    existingToolPanelWrappers: s
  }) {
    if (this.setDisplayed(!1), this.sideBar = e, e && this.sideBarButtons.setDisplayed(!e.hideButtons), e != null && e.toolPanels) {
      const i = e.toolPanels;
      if (this.createToolPanelsAndSideButtons(i, t, s), !this.toolPanelWrappers.length)
        return;
      const r = t ? t.visible : !e.hiddenByDefault;
      if (this.setDisplayed(r), this.setSideBarPosition(t ? t.position : e.position), r)
        if (t) {
          const { openToolPanel: n } = t;
          n && this.openToolPanel(n, "sideBarInitializing");
        } else
          this.openToolPanel(e.defaultToolPanel, "sideBarInitializing");
    }
  }
  getDef() {
    return this.sideBar;
  }
  setSideBarPosition(e) {
    e || (e = "right"), this.position = e;
    const t = e === "left", s = t ? "right" : "left";
    return this.toggleCss("ag-side-bar-left", t), this.toggleCss("ag-side-bar-right", !t), this.toolPanelWrappers.forEach((i) => {
      i.setResizerSizerSide(s);
    }), this.dispatchSideBarUpdated(), this;
  }
  setDisplayed(e, t) {
    super.setDisplayed(e, t), this.dispatchSideBarUpdated();
  }
  getState() {
    const e = {};
    return this.toolPanelWrappers.forEach((t) => {
      var s, i;
      e[t.getToolPanelId()] = (i = (s = t.getToolPanelInstance()) == null ? void 0 : s.getState) == null ? void 0 : i.call(s);
    }), {
      visible: this.isDisplayed(),
      position: this.position,
      openToolPanel: this.openedItem(),
      toolPanels: e
    };
  }
  createToolPanelsAndSideButtons(e, t, s) {
    var i;
    for (const r of e)
      this.createToolPanelAndSideButton(
        r,
        (i = t == null ? void 0 : t.toolPanels) == null ? void 0 : i[r.id],
        s == null ? void 0 : s[r.id]
      );
  }
  validateDef(e) {
    var i;
    const { id: t, toolPanel: s } = e;
    return t == null ? (F(212), !1) : (s === "agFiltersToolPanel" || s === "agNewFiltersToolPanel") && (i = this.beans.filterManager) != null && i.isAdvFilterEnabled() ? (F(213), !1) : !0;
  }
  createToolPanelAndSideButton(e, t, s) {
    if (!this.validateDef(e))
      return;
    let i;
    if (s)
      i = s;
    else if (i = this.createBean(new HV()), !i.setToolPanelDef(
      e,
      V(this.gos, {
        initialState: t,
        onStateUpdated: () => this.dispatchSideBarUpdated()
      })
    ))
      return;
    i.setDisplayed(!1);
    const r = i.getGui(), n = e.parent instanceof HTMLElement ? e.parent : this;
    n === e.parent && (this.beans.environment.applyThemeClasses(n, ["ag-external", "ag-tool-panel-external"]), r.classList.add(this.gos.get("enableRtl") ? "ag-rtl" : "ag-ltr")), n.appendChild(r), this.toolPanelWrappers.push(i);
    const o = this.sideBarButtons.addButtonComp(e);
    kc(o.eToggleButton, r);
  }
  refresh() {
    this.toolPanelWrappers.forEach((e) => e.refresh());
  }
  renderToolPanelUnderParent(e, t) {
    var i, r, n, o;
    const s = (r = (i = this.sideBar) == null ? void 0 : i.toolPanels) == null ? void 0 : r.find((a) => (typeof a == "string" ? a : a.id) === e);
    if (s) {
      const a = yC(s);
      if (a) {
        const l = (o = (n = (this.gos.get("initialState") ?? {}).sideBar) == null ? void 0 : n.toolPanels) == null ? void 0 : o[a.id];
        a.parent = t;
        const c = this.toolPanelWrappers.find((d) => d.getToolPanelId() === e);
        this.createToolPanelAndSideButton(a, l, c);
      }
    }
  }
  openToolPanel(e, t = "api", s) {
    s && e && this.renderToolPanelUnderParent(e, s);
    const i = this.openedItem();
    if (i === e)
      return;
    this.toolPanelWrappers.forEach((o) => {
      const a = e === o.getToolPanelId();
      o.setDisplayed(a);
    });
    const r = this.openedItem();
    i !== r && (this.sideBarButtons.setActiveButton(e), this.raiseToolPanelVisibleEvent(e, i ?? void 0, t));
  }
  getToolPanelInstance(e) {
    const t = this.toolPanelWrappers.filter((s) => s.getToolPanelId() === e)[0];
    if (!t) {
      F(214, { key: e });
      return;
    }
    return t.getToolPanelInstance();
  }
  raiseToolPanelVisibleEvent(e, t, s) {
    const i = !!e && !!t, r = this.eventSvc;
    t && r.dispatchEvent({
      type: "toolPanelVisibleChanged",
      source: s,
      key: t,
      visible: !1,
      switchingToolPanel: i
    }), e && r.dispatchEvent({
      type: "toolPanelVisibleChanged",
      source: s,
      key: e,
      visible: !0,
      switchingToolPanel: i
    });
  }
  close(e = "api") {
    this.openToolPanel(void 0, e);
  }
  isToolPanelShowing() {
    return !!this.openedItem();
  }
  openedItem() {
    let e = null;
    return this.toolPanelWrappers.forEach((t) => {
      t.isDisplayed() && (e = t.getToolPanelId());
    }), e;
  }
  setState(e) {
    var i;
    const t = Fc(this.gos.get("sideBar")), s = {};
    t && this.sideBar && ((i = t.toolPanels) == null || i.forEach((r) => {
      var d, h;
      const { id: n } = r;
      if (!n)
        return;
      const o = (d = this.sideBar.toolPanels) == null ? void 0 : d.find(
        (u) => u.id === n
      );
      if (!o || r.toolPanel !== o.toolPanel)
        return;
      const a = this.toolPanelWrappers.find((u) => u.getToolPanelId() === n);
      if (!a)
        return;
      const l = V(this.gos, {
        ...r.toolPanelParams ?? {},
        onStateUpdated: () => this.dispatchSideBarUpdated()
      });
      ((h = a.getToolPanelInstance()) == null ? void 0 : h.refresh(l)) === !0 && (this.toolPanelWrappers = this.toolPanelWrappers.filter((u) => u !== a), se(a.getGui()), s[n] = a);
    })), this.clearDownUi(), this.setSideBarDef({ sideBarDef: t, sideBarState: e, existingToolPanelWrappers: s });
  }
  dispatchSideBarUpdated() {
    this.eventSvc.dispatchEvent({ type: "sideBarUpdated" });
  }
  destroyToolPanelWrappers() {
    this.toolPanelWrappers.forEach((e) => {
      se(e.getGui()), this.destroyBean(e);
    }), this.toolPanelWrappers.length = 0;
  }
  destroy() {
    this.destroyToolPanelWrappers(), super.destroy();
  }
}, _V = {
  selector: "AG-SIDE-BAR",
  component: WV
}, UV = class extends R {
  constructor() {
    super(...arguments), this.beanName = "sideBar";
  }
  getSelector() {
    return _V;
  }
}, Da = {
  moduleName: "SideBar",
  version: Y,
  beans: [UV],
  apiFunctions: {
    isSideBarVisible: vV,
    setSideBarVisible: wV,
    setSideBarPosition: bV,
    openToolPanel: yV,
    closeToolPanel: SV,
    getOpenedToolPanel: xV,
    refreshToolPanel: FV,
    isToolPanelShowing: RV,
    getToolPanelInstance: PV,
    getSideBar: EV
  },
  dependsOn: [ie, kf]
}, $V = { tag: "div" }, SC = class extends D {
  constructor() {
    super($V);
  }
  init(e) {
    this.params = e, this.cssClassPrefix = this.params.cssClassPrefix ?? "ag-menu-option", this.addAriaAttributes(), this.addIcon(), this.addName(), this.addShortcut(), this.addSubMenu();
  }
  configureDefaults() {
    return !0;
  }
  addAriaAttributes() {
    const { checked: e, subMenu: t } = this.params, s = this.getGui();
    e && Ig(s, e), t && qe(s, !1);
  }
  addIcon() {
    if (this.params.isCompact)
      return;
    const e = K({
      tag: "span",
      ref: "eIcon",
      cls: `${this.getClassName("part")} ${this.getClassName("icon")}`,
      role: "presentation"
    }), { checked: t, icon: s } = this.params;
    t ? e.appendChild(N("check", this.beans)) : s && (na(s) ? e.appendChild(s) : typeof s == "string" ? e.innerHTML = s : F(227)), this.getGui().appendChild(e);
  }
  addName() {
    const e = K({
      tag: "span",
      ref: "eName",
      cls: `${this.getClassName("part")} ${this.getClassName("text")}`,
      children: this.params.name || ""
    });
    this.getGui().appendChild(e);
  }
  addShortcut() {
    if (this.params.isCompact)
      return;
    const e = K({
      tag: "span",
      ref: "eShortcut",
      cls: `${this.getClassName("part")} ${this.getClassName("shortcut")}`,
      children: this.params.shortcut || ""
    });
    this.getGui().appendChild(e);
  }
  addSubMenu() {
    const e = K({
      tag: "span",
      ref: "ePopupPointer",
      cls: `${this.getClassName("part")} ${this.getClassName("popup-pointer")}`
    }), t = this.getGui();
    if (this.params.subMenu) {
      const s = this.gos.get("enableRtl") ? "subMenuOpenRtl" : "subMenuOpen";
      e.appendChild(N(s, this.beans));
    }
    t.appendChild(e);
  }
  getClassName(e) {
    return `${this.cssClassPrefix}-${e}`;
  }
}, KV = (
  /*css*/
  '.ag-menu-list{cursor:default;display:table;padding:var(--ag-spacing) 0;width:100%}.ag-menu-option,.ag-menu-separator{display:table-row}.ag-menu-option-part,.ag-menu-separator-part{display:table-cell;vertical-align:middle}.ag-menu-option{cursor:pointer;font-weight:500}:where(.ag-ltr) :where(.ag-menu-option-popup-pointer) .ag-icon{text-align:right}:where(.ag-rtl) :where(.ag-menu-option-popup-pointer) .ag-icon{text-align:left}.ag-menu-option-text{white-space:nowrap}.ag-menu-option-custom{display:contents}.ag-compact-menu-option{display:flex;flex-wrap:nowrap;width:100%}.ag-compact-menu-option-text{flex:1 1 auto;white-space:nowrap}.ag-menu-separator{height:calc(var(--ag-spacing)*2 + 1px)}.ag-menu-separator-part:after{border-top:solid var(--ag-border-width) var(--ag-menu-separator-color);content:"";display:block}.ag-compact-menu-option-active,.ag-menu-option-active{background-color:var(--ag-row-hover-color)}.ag-compact-menu-option-part,.ag-menu-option-part{line-height:var(--ag-icon-size);padding:calc(var(--ag-spacing) + 2px) 0}.ag-compact-menu-option-disabled,.ag-menu-option-disabled{cursor:not-allowed;opacity:.5}.ag-compact-menu-option-icon,.ag-menu-option-icon{width:var(--ag-icon-size)}:where(.ag-ltr) .ag-compact-menu-option-icon,:where(.ag-ltr) .ag-menu-option-icon{padding-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-compact-menu-option-icon,:where(.ag-rtl) .ag-menu-option-icon{padding-right:calc(var(--ag-spacing)*2)}.ag-compact-menu-option-text,.ag-menu-option-text{padding-left:calc(var(--ag-spacing)*2);padding-right:calc(var(--ag-spacing)*2)}:where(.ag-ltr) .ag-compact-menu-option-shortcut,:where(.ag-ltr) .ag-menu-option-shortcut{padding-right:var(--ag-spacing)}:where(.ag-rtl) .ag-compact-menu-option-shortcut,:where(.ag-rtl) .ag-menu-option-shortcut{padding-left:var(--ag-spacing)}:where(.ag-ltr) .ag-compact-menu-option-popup-pointer,:where(.ag-ltr) .ag-menu-option-popup-pointer{padding-right:var(--ag-spacing)}:where(.ag-rtl) .ag-compact-menu-option-popup-pointer,:where(.ag-rtl) .ag-menu-option-popup-pointer{padding-left:var(--ag-spacing)}.ag-menu-column-select-wrapper{height:265px;overflow:auto;:where(.ag-column-select){height:100%}}.ag-menu:where(.ag-tabs){min-width:290px}.ag-context-menu-loading-icon{pointer-events:none;position:absolute}'
), Aa = {
  moduleName: "MenuItem",
  version: Y,
  userComponents: {
    agMenuItem: SC
  },
  icons: {
    // indicates the currently active pin state in the "Pin column" sub-menu of the column menu
    check: "tick",
    // icon for sub menu item
    subMenuOpen: "small-right",
    // version of subMenuOpen used in RTL mode
    subMenuOpenRtl: "small-left"
  },
  css: [KV]
}, jV = (
  /*css*/
  ".ag-column-select{display:flex;flex:3 1 0px;flex-direction:column;overflow:hidden;position:relative}.ag-column-select-header{align-items:center;display:flex;flex:none;gap:var(--ag-widget-horizontal-spacing);height:var(--ag-header-height);padding-left:var(--ag-widget-container-horizontal-padding);padding-right:var(--ag-widget-container-horizontal-padding);position:relative}.ag-column-select-column,.ag-column-select-column-group{align-items:center;display:flex;gap:var(--ag-widget-horizontal-spacing);height:100%;position:relative;&:where(:not(:last-child)){margin-bottom:var(--ag-widget-vertical-spacing)}}:where(.ag-ltr) .ag-column-select-column,:where(.ag-ltr) .ag-column-select-column-group{padding-left:calc(var(--ag-indentation-level)*var(--ag-column-select-indent-size))}:where(.ag-rtl) .ag-column-select-column,:where(.ag-rtl) .ag-column-select-column-group{padding-right:calc(var(--ag-indentation-level)*var(--ag-column-select-indent-size))}.ag-column-select-header-icon{border-radius:var(--ag-border-radius);cursor:pointer;height:var(--ag-icon-size);position:relative;width:var(--ag-icon-size);&:focus-visible{box-shadow:var(--ag-focus-shadow)}}.ag-column-select-header-filter-wrapper{flex:1 1 auto}.ag-column-select-header-filter{width:100%}.ag-column-select-list{flex:1 1 0px;overflow:hidden}:where(.ag-ltr) .ag-column-select-add-group-indent{margin-left:calc(var(--ag-icon-size) + var(--ag-spacing)*1.5)}:where(.ag-rtl) .ag-column-select-add-group-indent{margin-right:calc(var(--ag-icon-size) + var(--ag-spacing)*1.5)}.ag-column-select-column-group-readonly,.ag-column-select-column-readonly{opacity:.5;pointer-events:none;.ag-icon{opacity:.5}&.ag-icon-grip{opacity:.35}}.ag-column-select-column-readonly{&.ag-icon-grip,.ag-icon-grip{opacity:.35}}.ag-column-select-virtual-list-viewport{padding:calc(var(--ag-widget-container-vertical-padding)*.5) 0}.ag-column-select-virtual-list-item{padding:0 var(--ag-widget-container-horizontal-padding)}.ag-column-select-column-label{flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-column-select-checkbox{display:flex}"
), YV = 300, qV = {
  tag: "div",
  cls: "ag-column-select-header",
  role: "presentation",
  children: [
    { tag: "div", ref: "eExpand", cls: "ag-column-select-header-icon" },
    { tag: "ag-checkbox", ref: "eSelect", cls: "ag-column-select-header-checkbox" },
    { tag: "ag-input-text-field", ref: "eFilterTextField", cls: "ag-column-select-header-filter-wrapper" }
  ]
}, XV = class extends D {
  constructor() {
    super(qV, [_t, It]), this.eExpand = x, this.eSelect = x, this.eFilterTextField = x;
  }
  postConstruct() {
    this.createExpandIcons(), this.addManagedListeners(this.eExpand, {
      click: this.onExpandClicked.bind(this),
      keydown: (t) => {
        t.key === S.SPACE && (t.preventDefault(), this.onExpandClicked());
      }
    }), this.addManagedElementListeners(this.eSelect.getInputElement(), { click: this.onSelectClicked.bind(this) }), this.addManagedPropertyListener("functionsReadOnly", () => this.onFunctionsReadOnlyPropChanged()), this.eFilterTextField.setAutoComplete(!1).onValueChange(() => this.onFilterTextChanged()), this.addManagedEventListeners({ newColumnsLoaded: this.showOrHideOptions.bind(this) });
    const e = this.getLocaleTextFunc();
    this.eSelect.setInputAriaLabel(e("ariaColumnSelectAll", "Toggle All Columns Visibility")), this.eFilterTextField.setInputAriaLabel(e("ariaFilterColumnsInput", "Filter Columns Input")), this.activateTabIndex([this.eExpand]);
  }
  onFunctionsReadOnlyPropChanged() {
    const e = this.gos.get("functionsReadOnly");
    this.eSelect.setReadOnly(e), this.eSelect.toggleCss("ag-column-select-column-readonly", e);
  }
  init(e) {
    this.params = e;
    const t = this.gos.get("functionsReadOnly");
    this.eSelect.setReadOnly(t), this.eSelect.toggleCss("ag-column-select-column-readonly", t), this.beans.colModel.ready && this.showOrHideOptions();
  }
  createExpandIcons() {
    const e = this.beans;
    this.eExpand.appendChild(this.eExpandChecked = N("columnSelectOpen", e)), this.eExpand.appendChild(this.eExpandUnchecked = N("columnSelectClosed", e)), this.eExpand.appendChild(this.eExpandIndeterminate = N("columnSelectIndeterminate", e)), this.setExpandState(
      0
      /* EXPANDED */
    );
  }
  // we only show expand / collapse if we are showing columns
  showOrHideOptions() {
    var o;
    const e = this.params, t = !e.suppressColumnFilter, s = !e.suppressColumnSelectAll, i = !e.suppressColumnExpandAll, r = !!((o = this.beans.colModel.colDefCols) != null && o.treeDepth), n = this.getLocaleTextFunc();
    this.eFilterTextField.setInputPlaceholder(n("searchOoo", "Search...")), O(this.eFilterTextField.getGui(), t), O(this.eSelect.getGui(), s), O(this.eExpand, i && r);
  }
  onFilterTextChanged() {
    this.onFilterTextChangedDebounced || (this.onFilterTextChangedDebounced = pe(
      this,
      () => {
        const e = this.eFilterTextField.getValue();
        this.dispatchLocalEvent({ type: "filterChanged", filterText: e });
      },
      YV
    )), this.onFilterTextChangedDebounced();
  }
  onSelectClicked() {
    this.dispatchLocalEvent({ type: this.selectState ? "unselectAll" : "selectAll" });
  }
  onExpandClicked() {
    this.dispatchLocalEvent({ type: this.expandState === 0 ? "collapseAll" : "expandAll" });
  }
  setExpandState(e) {
    this.expandState = e, O(
      this.eExpandChecked,
      e === 0
      /* EXPANDED */
    ), O(
      this.eExpandUnchecked,
      e === 1
      /* COLLAPSED */
    ), O(
      this.eExpandIndeterminate,
      e === 2
      /* INDETERMINATE */
    );
  }
  setSelectionState(e) {
    this.selectState = e, this.eSelect.setValue(this.selectState);
  }
}, ZV = {
  selector: "AG-PRIMARY-COLS-HEADER",
  component: XV
};
function lr(e) {
  return !!e && typeof e.children < "u";
}
function _s(e) {
  return lr(e) ? e.groupId : e.colId;
}
function xC(e, t, s) {
  const i = (o, a) => {
    const c = o.children.map(_s).includes(_s(a)), d = _(o.children), h = d && _s(d) !== _s(a);
    return c && h;
  };
  if (!lr(e))
    return !0;
  const r = e, n = s;
  if (i(r, n) || r.groupId === t && !r.children.map(_s).includes(_s(n)))
    return r.children.push(n), !0;
  for (let o = r.children.length - 1; o >= 0 && !xC(r.children[o], t, s); o--)
    ;
  return !1;
}
function QV(e) {
  const t = (r, n) => lr(r) && lr(n) && _s(r) === _s(n), s = (r, n) => {
    if (!lr(n))
      return r;
    const o = r, a = n;
    return a.children && a.groupId && xC(o, a.groupId, a.children[0]) || a.children.forEach((l) => s(o, l)), o;
  }, i = [];
  for (let r = 1; r <= e.length; r++) {
    const n = e[r - 1], o = e[r];
    t(n, o) ? e[r] = s(n, o) : i.push(n);
  }
  return i;
}
function FC(e, t) {
  const s = [], i = (n, o) => {
    if (lr(n)) {
      const a = n, l = typeof a.groupId < "u" ? a.groupId : a.headerName, c = new ir(a, l, !1, o), d = [];
      return a.children.forEach((h) => {
        const u = i(h, o + 1);
        u && d.push(u);
      }), c.setChildren(d), c;
    } else {
      const a = n, l = a.colId ? a.colId : a.field, c = e.getColDefCol(l);
      return c || s.push(a), c;
    }
  }, r = [];
  return t.forEach((n) => {
    const o = i(n, 0);
    o && r.push(o);
  }), s.length > 0 && F(217, { invalidColIds: s }), r;
}
function RC(e, t) {
  const s = JV(e), i = QV(s);
  t(i);
}
function JV(e) {
  const t = (r, n) => {
    let o;
    if (oe(r))
      if (r.isPadding())
        o = n;
      else {
        const l = Object.assign({}, r.getColGroupDef());
        l.groupId = r.getGroupId(), l.children = [n], o = l;
      }
    else {
      const l = Object.assign({}, r.getColDef());
      l.colId = r.getColId(), o = l;
    }
    const a = r.getOriginalParent();
    return a ? t(a, o) : o;
  };
  return e.getCols().filter((r) => {
    const n = r.getColDef();
    return r.isPrimary() && !n.showRowGroup;
  }).map((r) => t(r, r.getColDef()));
}
var Ou = class {
  constructor(e, t, s, i = !1, r) {
    this.displayName = e, this.depth = s, this.group = i, this.localEventService = new Rs(), i ? (this.columnGroup = t, this._expanded = r, this.children = []) : this.column = t;
  }
  get expanded() {
    return !!this._expanded;
  }
  set expanded(e) {
    e !== this._expanded && (this._expanded = e, this.localEventService.dispatchEvent({ type: "expandedChanged" }));
  }
  addEventListener(e, t) {
    this.localEventService.addEventListener(e, t);
  }
  removeEventListener(e, t) {
    this.localEventService.removeEventListener(e, t);
  }
};
function PC(e, t, s, i) {
  const r = eB(t);
  EC(e, r, s, i);
}
function EC(e, t, s, i) {
  e.colModel.isPivotMode() ? sB(e, t, s, i) : tB(e, t, s, i);
}
function eB(e) {
  const t = [], s = (i) => {
    i.forEach((r) => {
      r.passesFilter && (r.group ? s(r.children) : t.push(r.column));
    });
  };
  return s(e), t;
}
function tB(e, t, s, i) {
  const r = [];
  t.forEach((n) => {
    n.getColDef().lockVisible || n.isVisible() != s && r.push({
      colId: n.getId(),
      hide: !s
    });
  }), r.length > 0 && je(e, { state: r }, i);
}
function sB(e, t, s, i) {
  iB(e, t, s, i);
}
function iB(e, t, s, i) {
  const r = [], a = s ? (l) => {
    var c;
    if (!l.isAnyFunctionActive())
      if (l.isAllowValue()) {
        const d = typeof l.getAggFunc() == "string" ? l.getAggFunc() : (c = e.aggFuncSvc) == null ? void 0 : c.getDefaultAggFunc(l);
        r.push({
          colId: l.getId(),
          aggFunc: d
        });
      } else l.isAllowRowGroup() ? r.push({
        colId: l.getId(),
        rowGroup: !0
      }) : l.isAllowPivot() && r.push({
        colId: l.getId(),
        pivot: !0
      });
  } : (l) => {
    (l.isPivotActive() || l.isRowGroupActive() || l.isValueActive()) && r.push({
      colId: l.getId(),
      pivot: !1,
      rowGroup: !1,
      aggFunc: null
    });
  };
  t.forEach(a), r.length > 0 && je(e, { state: r }, i);
}
function TC(e, t) {
  const { columns: s, visibleState: i, pivotState: r, eventType: n } = t, o = s.map((a) => {
    const l = a.getColId();
    if (e.colModel.isPivotMode()) {
      const c = r == null ? void 0 : r[l];
      return {
        colId: l,
        pivot: c == null ? void 0 : c.pivot,
        rowGroup: c == null ? void 0 : c.rowGroup,
        aggFunc: c == null ? void 0 : c.aggFunc
      };
    } else
      return {
        colId: l,
        hide: !(i != null && i[l])
      };
  });
  je(e, { state: o }, n);
}
function MC(e) {
  return {
    pivot: e.isPivotActive(),
    rowGroup: e.isRowGroupActive(),
    aggFunc: e.isValueActive() ? e.getAggFunc() : void 0
  };
}
function Vu(e, t, s, i) {
  const r = t.getCol(s);
  e.groupData || (e.groupData = {});
  const n = r.getColId(), o = e.groupData[n];
  o !== i && (e.groupData[n] = i, e.dispatchCellChangedEvent(r, i, o));
}
function DC(e, t, s) {
  var i;
  e.group !== s && (e.group && !s && (e.expanded = !1), e.group = s, e.updateHasChildren(), (i = t.selectionSvc) == null || i.updateRowSelectable(e), e.dispatchRowEvent("groupChanged"));
}
function un(e, t) {
  const { gos: s, rowGroupColsSvc: i } = t;
  if (!i || !e)
    return !1;
  const r = s.get("groupLockGroupColumns");
  if (!e.isRowGroupActive() || r === 0)
    return !1;
  if (r === -1)
    return !0;
  const n = i.columns.findIndex((o) => o.getColId() === e.getColId());
  return r > n;
}
function rB(e) {
  const t = xi(e), s = "getSelection" in t ? t.getSelection() : null, i = [];
  for (let r = 0; r < ((s == null ? void 0 : s.rangeCount) ?? 0); r++) {
    const n = s == null ? void 0 : s.getRangeAt(r);
    n && i.push(n);
  }
  return { selection: s, ranges: i };
}
function Ia(e, t) {
  if (!e.gos.get("enableCellTextSelection") || !Jc() && !As())
    return t();
  const { selection: i, ranges: r } = rB(e);
  t(), i == null || i.removeAllRanges();
  for (const n of r)
    i == null || i.addRange(n);
}
var nB = class extends ls {
  constructor(e) {
    super(), this.setTemplateFromElement(e.getGui(), void 0, void 0, !0);
  }
  postConstruct() {
    this.initialiseTabGuard({
      onTabKeyDown: (e) => this.onTabKeyDown(e),
      handleKeyDown: (e) => this.handleKeyDown(e)
    });
  }
  handleKeyDown(e) {
    e.key === S.ESCAPE && this.closePanel();
  }
  onTabKeyDown(e) {
    e.defaultPrevented || (this.closePanel(), e.preventDefault());
  }
  closePanel() {
    const e = this.parentComponent;
    e.closeSubMenu(), setTimeout(() => e.getGui().focus(), 0);
  }
};
function oB(e, t, s) {
  return e.getCompDetails(t, aB, "agMenuItem", s, !0);
}
var aB = {
  name: "menuItem",
  optionalMethods: ["setActive", "select", "setExpanded", "configureDefaults"]
}, lB = { tag: "div", cls: "ag-menu", role: "presentation" }, Rc = class extends R {
  constructor() {
    super(...arguments), this.ACTIVATION_DELAY = 80, this.isActive = !1, this.subMenuIsOpen = !1, this.subMenuIsOpening = !1, this.suppressRootStyles = !0, this.suppressAria = !0, this.suppressFocus = !0;
  }
  wireBeans(e) {
    this.popupSvc = e.popupSvc, this.userCompFactory = e.userCompFactory, this.registry = e.registry;
  }
  init(e) {
    var a;
    const { menuItemDef: t, isAnotherSubMenuOpen: s, level: i, childComponent: r, contextParams: n } = e;
    this.params = e.menuItemDef, this.level = i, this.isAnotherSubMenuOpen = s, this.childComponent = r, this.contextParams = n, this.cssClassPrefix = ((a = this.params.menuItemParams) == null ? void 0 : a.cssClassPrefix) ?? "ag-menu-option";
    const o = oB(
      this.userCompFactory,
      this.params,
      V(this.gos, {
        ...t,
        level: i,
        isAnotherSubMenuOpen: s,
        openSubMenu: (l) => this.openSubMenu(l),
        closeSubMenu: () => this.closeSubMenu(),
        closeMenu: (l) => this.closeMenu(l),
        updateTooltip: (l, c) => this.refreshTooltip(l, c),
        onItemActivated: () => this.onItemActivated()
      })
    );
    return (o == null ? void 0 : o.newAgStackInstance().then((l) => {
      var d;
      this.menuItemComp = l;
      const c = (d = l.configureDefaults) == null ? void 0 : d.call(l);
      c && this.configureDefaults(c === !0 ? void 0 : c);
    })) ?? U.resolve();
  }
  addListeners(e, t) {
    t != null && t.suppressClick || this.addManagedElementListeners(e, { click: (s) => this.onItemSelected(s) }), t != null && t.suppressKeyboardSelect || this.addManagedElementListeners(e, {
      keydown: (s) => {
        (s.key === S.ENTER || s.key === S.SPACE) && (s.preventDefault(), this.onItemSelected(s));
      }
    }), t != null && t.suppressMouseDown || this.addManagedElementListeners(e, {
      mousedown: (s) => {
        s.stopPropagation(), s.preventDefault();
      }
    }), t != null && t.suppressMouseOver || this.addManagedElementListeners(e, {
      mouseenter: () => this.onMouseEnter(),
      mouseleave: () => this.onMouseLeave()
    });
  }
  isDisabled() {
    return !!this.params.disabled;
  }
  openSubMenu(e = !1, t) {
    var c, d;
    if (this.closeSubMenu(), !this.params.subMenu)
      return;
    this.subMenuIsOpening = !0;
    const s = K(lB);
    this.eSubMenuGui = s;
    let i, r = () => {
      this.subMenuIsOpening = !1;
    };
    if (this.childComponent) {
      const h = this.createBean(new nB(this.childComponent));
      h.setParentComponent(this);
      const u = h.getGui(), g = "mouseenter", p = () => this.cancelDeactivate();
      u.addEventListener(g, p), i = () => {
        u.removeEventListener(g, p), this.destroyBean(h);
      }, s.appendChild(u), this.childComponent.afterGuiAttached && (r = () => {
        this.childComponent.afterGuiAttached(), this.subMenuIsOpening = !1;
      });
    } else if (this.params.subMenu) {
      const h = this.createBean(new Mn(this.level + 1, this.contextParams));
      h.setParentComponent(this), h.addMenuItems(this.params.subMenu), s.appendChild(h.getGui()), this.addManagedListeners(h, { closeMenu: (u) => this.dispatchLocalEvent(u) }), h.addGuiEventListener("mouseenter", () => this.cancelDeactivate()), i = () => this.destroyBean(h), e && (r = () => {
        h.activateFirstItem(), this.subMenuIsOpening = !1;
      });
    }
    const { popupSvc: n } = this, o = () => {
      const h = this.eGui, { column: u, node: g } = this.contextParams;
      n == null || n.positionPopupForMenu({
        eventSource: h,
        ePopup: s,
        event: t instanceof MouseEvent ? t : void 0,
        column: u,
        rowNode: g
      });
    }, a = this.getLocaleTextFunc(), l = n == null ? void 0 : n.addPopup({
      modal: !0,
      eChild: s,
      positionCallback: o,
      anchorToElement: this.eGui,
      ariaLabel: a("ariaLabelSubMenu", "SubMenu"),
      afterGuiAttached: r
    });
    this.subMenuIsOpen = !0, this.setAriaExpanded(!0), this.hideSubMenu = () => {
      var h, u;
      l && l.hideFunc(), this.subMenuIsOpen = !1, this.setAriaExpanded(!1), i(), (u = (h = this.menuItemComp).setExpanded) == null || u.call(h, !1), this.eSubMenuGui = void 0;
    }, (d = (c = this.menuItemComp).setExpanded) == null || d.call(c, !0);
  }
  setAriaExpanded(e) {
    this.suppressAria || qe(this.eGui, e);
  }
  closeSubMenu() {
    this.hideSubMenu && (this.hideSubMenu(), this.hideSubMenu = null, this.setAriaExpanded(!1));
  }
  isSubMenuOpen() {
    return this.subMenuIsOpen;
  }
  isSubMenuOpening() {
    return this.subMenuIsOpening;
  }
  activate(e, t) {
    var s, i;
    this.cancelActivate(), !(this.params.disabled && !t) && (this.isActive = !0, this.suppressRootStyles || this.eGui.classList.add(`${this.cssClassPrefix}-active`), (i = (s = this.menuItemComp).setActive) == null || i.call(s, !0), this.suppressFocus || Ia(this.beans, () => this.eGui.focus({ preventScroll: !t })), e && this.params.subMenu && window.setTimeout(() => {
      this.isAlive() && this.isActive && this.openSubMenu();
    }, 300), this.onItemActivated());
  }
  deactivate() {
    var e, t;
    this.cancelDeactivate(), this.suppressRootStyles || this.eGui.classList.remove(`${this.cssClassPrefix}-active`), (t = (e = this.menuItemComp).setActive) == null || t.call(e, !1), this.isActive = !1, this.subMenuIsOpen && this.closeSubMenu();
  }
  getGui() {
    return this.menuItemComp.getGui();
  }
  getParentComponent() {
    return this.parentComponent;
  }
  setParentComponent(e) {
    this.parentComponent = e;
  }
  getSubMenuGui() {
    return this.eSubMenuGui;
  }
  onItemSelected(e) {
    var t, s;
    (s = (t = this.menuItemComp).select) == null || s.call(t), this.params.action ? this.beans.frameworkOverrides.wrapOutgoing(
      () => this.params.action(
        V(this.gos, {
          ...this.contextParams
        })
      )
    ) : this.openSubMenu(e && e.type === "keydown", e), !(this.params.subMenu && !this.params.action || this.params.suppressCloseOnSelect) && this.closeMenu(e);
  }
  closeMenu(e) {
    const t = {
      type: "closeMenu"
    };
    e && (e instanceof MouseEvent ? t.mouseEvent = e : t.keyboardEvent = e), this.dispatchLocalEvent(t);
  }
  onItemActivated() {
    const e = {
      type: "menuItemActivated",
      menuItem: this
    };
    this.dispatchLocalEvent(e);
  }
  cancelActivate() {
    this.activateTimeoutId && (window.clearTimeout(this.activateTimeoutId), this.activateTimeoutId = 0);
  }
  cancelDeactivate() {
    this.deactivateTimeoutId && (window.clearTimeout(this.deactivateTimeoutId), this.deactivateTimeoutId = 0);
  }
  onMouseEnter() {
    this.cancelDeactivate(), this.isAnotherSubMenuOpen() ? this.activateTimeoutId = window.setTimeout(() => this.activate(!0), this.ACTIVATION_DELAY) : this.activate(!0);
  }
  onMouseLeave() {
    this.cancelActivate(), this.isSubMenuOpen() ? this.deactivateTimeoutId = window.setTimeout(() => this.deactivate(), this.ACTIVATION_DELAY) : this.deactivate();
  }
  refreshRootElementGui(e) {
    var o, a;
    let t = this.menuItemComp.getGui();
    const {
      cssClassPrefix: s,
      params: { cssClasses: i, disabled: r }
    } = this, n = (a = (o = this.menuItemComp).getRootElement) == null ? void 0 : a.call(o);
    return n && (e || t.classList.add("ag-menu-option-custom"), t = n), this.suppressRootStyles = !!e, this.suppressRootStyles || (t.classList.add(s), i == null || i.forEach((l) => t.classList.add(l)), r && t.classList.add(`${s}-disabled`)), t;
  }
  applyAriaProperties(e) {
    const {
      params: { checked: t, subMenu: s, subMenuRole: i, disabled: r }
    } = this, n = t != null;
    Ye(e, n ? "menuitemcheckbox" : "menuitem"), s && vw(e, i ?? "menu"), r && wo(e, !0);
  }
  configureDefaults(e) {
    if (!this.menuItemComp) {
      setTimeout(() => this.configureDefaults(e));
      return;
    }
    const { suppressRootStyles: t, suppressTooltip: s, suppressAria: i, suppressTabIndex: r, suppressFocus: n } = e || {}, {
      params: { tooltip: o, disabled: a }
    } = this, l = this.eGui = this.refreshRootElementGui(!!t);
    this.suppressAria = !!i, i || this.applyAriaProperties(l), r || l.setAttribute("tabindex", "-1"), s || this.refreshTooltip(o), a || this.addListeners(l, e), this.suppressFocus = !!n;
  }
  refreshTooltip(e, t) {
    if (this.tooltip = e, this.tooltipFeature = this.destroyBean(this.tooltipFeature), !e || !this.menuItemComp)
      return;
    const s = this.registry.createDynamicBean("tooltipFeature", !1, {
      getGui: () => this.getGui(),
      getTooltipValue: () => this.tooltip,
      getLocation: () => "menu",
      shouldDisplayTooltip: t
    });
    s && (this.tooltipFeature = this.createBean(s));
  }
  destroy() {
    var e, t;
    this.tooltipFeature = this.destroyBean(this.tooltipFeature), (t = (e = this.menuItemComp) == null ? void 0 : e.destroy) == null || t.call(e), super.destroy();
  }
}, Mn = class extends ls {
  constructor(e = 0, t) {
    super({ tag: "div", cls: "ag-menu-list", role: "menu" }), this.level = e, this.menuItems = [], this.params = t ?? {
      column: null,
      node: null,
      value: null
    };
  }
  postConstruct() {
    this.initialiseTabGuard({
      onTabKeyDown: (e) => this.onTabKeyDown(e),
      handleKeyDown: (e) => Ia(this.beans, () => this.handleKeyDown(e)),
      onFocusIn: (e) => this.handleFocusIn(e),
      onFocusOut: (e) => this.handleFocusOut(e)
    });
  }
  onTabKeyDown(e) {
    var i;
    const t = this.getParentComponent();
    ((i = t == null ? void 0 : t.getGui()) == null ? void 0 : i.classList.contains("ag-focus-managed")) || e.preventDefault(), e.shiftKey && this.closeIfIsChild(e);
  }
  handleKeyDown(e) {
    switch (e.key) {
      case S.UP:
      case S.RIGHT:
      case S.DOWN:
      case S.LEFT:
        e.preventDefault(), this.handleNavKey(e.key);
        break;
      case S.ESCAPE:
        this.closeIfIsChild() && he(e);
        break;
    }
  }
  handleFocusIn(e) {
    var s, i;
    const t = e.relatedTarget;
    !this.tabGuardFeature.getTabGuardCtrl().isTabGuard(t) && (this.getGui().contains(t) || (i = (s = this.activeMenuItem) == null ? void 0 : s.getSubMenuGui()) != null && i.contains(t)) || (this.activeMenuItem ? this.activeMenuItem.activate() : this.activateFirstItem());
  }
  handleFocusOut(e) {
    var s;
    const t = e.relatedTarget;
    !this.activeMenuItem || this.getGui().contains(t) || (s = this.activeMenuItem.getSubMenuGui()) != null && s.contains(t) || this.activeMenuItem.isSubMenuOpening() || this.activeMenuItem.deactivate();
  }
  clearActiveItem() {
    this.activeMenuItem && (this.activeMenuItem.deactivate(), this.activeMenuItem = null);
  }
  addMenuItems(e) {
    e != null && U.all(
      e.map((t) => t === "separator" ? U.resolve({ eGui: this.createSeparator() }) : typeof t == "string" ? (F(228, { menuItemOrString: t }), U.resolve({ eGui: null })) : this.addItem(t))
    ).then((t) => {
      (t ?? []).forEach((s) => {
        s != null && s.eGui && (this.appendChild(s.eGui), s.comp && this.menuItems.push(s.comp));
      });
    });
  }
  addItem(e) {
    const t = this.createManagedBean(new Rc());
    return t.init({
      menuItemDef: e,
      isAnotherSubMenuOpen: () => this.menuItems.some((s) => s.isSubMenuOpen()),
      level: this.level,
      contextParams: this.params
    }).then(() => (t.setParentComponent(this), this.addManagedListeners(t, {
      closeMenu: (s) => {
        this.dispatchLocalEvent(s);
      },
      menuItemActivated: (s) => {
        this.activeMenuItem && this.activeMenuItem !== s.menuItem && this.activeMenuItem.deactivate(), this.activeMenuItem = s.menuItem;
      }
    }), {
      comp: t,
      eGui: t.getGui()
    }));
  }
  activateFirstItem() {
    const e = this.menuItems.filter((t) => !t.isDisabled())[0];
    e && e.activate();
  }
  createSeparator() {
    const e = { tag: "div", cls: "ag-menu-separator-part" };
    return K({
      tag: "div",
      cls: "ag-menu-separator",
      attrs: {
        "aria-hidden": "true"
      },
      children: [e, e, e, e]
    });
  }
  handleNavKey(e) {
    switch (e) {
      case S.UP:
      case S.DOWN: {
        const s = this.findNextItem(e === S.UP);
        s && s !== this.activeMenuItem && s.activate(!1, !0);
        return;
      }
    }
    const t = this.gos.get("enableRtl") ? S.RIGHT : S.LEFT;
    e === t ? this.closeIfIsChild() : this.openChild();
  }
  closeIfIsChild(e) {
    const t = this.getParentComponent();
    return t && t instanceof Rc ? (e && e.preventDefault(), t.closeSubMenu(), t.getGui().focus(), !0) : !1;
  }
  openChild() {
    this.activeMenuItem && this.activeMenuItem.openSubMenu(!0);
  }
  findNextItem(e) {
    const t = [...this.menuItems];
    if (!t.length)
      return;
    if (!this.activeMenuItem)
      return e ? _(t) : t[0];
    e && t.reverse();
    let s, i = !1;
    for (const r of t) {
      if (!i) {
        r === this.activeMenuItem && (i = !0);
        continue;
      }
      s = r;
      break;
    }
    return i && !s ? t[0] : s || this.activeMenuItem;
  }
  destroy() {
    this.clearActiveItem(), super.destroy();
  }
}, AC = class extends D {
  constructor(e, t, s) {
    super({ tag: "div", cls: "ag-menu" }), this.column = e, this.mouseEvent = t, this.parentEl = s, this.displayName = null;
  }
  postConstruct() {
    const {
      column: e,
      beans: { colNames: t }
    } = this;
    this.initializeProperties(e);
    let s;
    if (ts(e) ? s = t.getDisplayNameForColumn(e, "columnToolPanel") : s = t.getDisplayNameForProvidedColumnGroup(null, e, "columnToolPanel"), this.displayName = s, this.buildMenuItemMap(), this.isActive()) {
      this.mouseEvent.preventDefault();
      const i = this.getMappedMenuItems();
      if (i.length === 0)
        return;
      this.displayContextMenu(i);
    }
  }
  initializeProperties(e) {
    let t;
    oe(e) ? t = e.getLeafColumns() : t = [e], this.columns = t;
    const s = this.beans.colModel.isPivotMode();
    this.allowScrollIntoView = !s && t.some(this.isColumnValidForScrollIntoView), this.allowGrouping = t.some((i) => i.isPrimary() && i.isAllowRowGroup()), this.allowValues = t.some((i) => i.isPrimary() && i.isAllowValue()), this.allowPivoting = s && t.some((i) => i.isPrimary() && i.isAllowPivot());
  }
  buildMenuItemMap() {
    const e = this.getLocaleTextFunc(), { beans: t, displayName: s } = this, { rowGroupColsSvc: i, valueColsSvc: r, pivotColsSvc: n, colModel: o } = t, a = /* @__PURE__ */ new Map();
    this.menuItemMap = a;
    const l = o.isPivotMode();
    a.set("scrollIntoView", {
      allowedFunction: (c) => !c.isPinned() && !l && this.isColumnValidForScrollIntoView(c),
      activeFunction: () => !1,
      activateLabel: () => e("scrollColumnIntoView", `Scroll ${s} into View`, [s]),
      activateFunction: () => {
        const c = this.columns.find(this.isColumnValidForScrollIntoView);
        c && this.beans.ctrlsSvc.getScrollFeature().ensureColumnVisible(c);
      },
      deActivateFunction: () => {
      },
      addIcon: "ensureColumnVisible"
    }), a.set("rowGroup", {
      allowedFunction: (c) => c.isPrimary() && c.isAllowRowGroup() && !un(c, t),
      activeFunction: (c) => c.isRowGroupActive(),
      activateLabel: () => `${e("groupBy", "Group by")} ${s}`,
      deactivateLabel: () => `${e("ungroupBy", "Un-Group by")} ${s}`,
      activateFunction: () => i == null ? void 0 : i.setColumns(this.addColumnsToList(i.columns), "toolPanelUi"),
      deActivateFunction: () => i == null ? void 0 : i.setColumns(this.removeColumnsFromList(i.columns), "toolPanelUi"),
      addIcon: "menuAddRowGroup",
      removeIcon: "menuRemoveRowGroup"
    }), a.set("value", {
      allowedFunction: (c) => c.isPrimary() && c.isAllowValue(),
      activeFunction: (c) => c.isValueActive(),
      activateLabel: () => e("addToValues", `Add ${s} to values`, [s]),
      deactivateLabel: () => e("removeFromValues", `Remove ${s} from values`, [s]),
      activateFunction: () => r == null ? void 0 : r.setColumns(this.addColumnsToList(r.columns), "toolPanelUi"),
      deActivateFunction: () => r == null ? void 0 : r.setColumns(this.removeColumnsFromList(r.columns), "toolPanelUi"),
      addIcon: "valuePanel",
      removeIcon: "valuePanel"
    }), a.set("pivot", {
      allowedFunction: (c) => l && c.isPrimary() && c.isAllowPivot(),
      activeFunction: (c) => c.isPivotActive(),
      activateLabel: () => e("addToLabels", `Add ${s} to labels`, [s]),
      deactivateLabel: () => e("removeFromLabels", `Remove ${s} from labels`, [s]),
      activateFunction: () => n == null ? void 0 : n.setColumns(this.addColumnsToList(n.columns), "toolPanelUi"),
      deActivateFunction: () => n == null ? void 0 : n.setColumns(this.removeColumnsFromList(n.columns), "toolPanelUi"),
      addIcon: "pivotPanel",
      removeIcon: "pivotPanel"
    });
  }
  isColumnValidForScrollIntoView(e) {
    var i;
    if (!e.isVisible())
      return !1;
    const s = e.getParent();
    return s ? ((i = s.getDisplayedChildren()) == null ? void 0 : i.indexOf(e)) !== -1 : !0;
  }
  addColumnsToList(e) {
    return [...e].concat(this.columns.filter((t) => e.indexOf(t) === -1));
  }
  removeColumnsFromList(e) {
    return e.filter((t) => this.columns.indexOf(t) === -1);
  }
  displayContextMenu(e) {
    const t = this.getGui(), s = this.createBean(new Mn()), i = this.getLocaleTextFunc();
    let r = () => {
    };
    t.appendChild(s.getGui()), s.addMenuItems(e), s.addManagedListeners(s, {
      closeMenu: () => {
        this.parentEl.focus(), r();
      }
    });
    const n = this.beans.popupSvc, o = n.addPopup({
      modal: !0,
      eChild: t,
      closeOnEsc: !0,
      afterGuiAttached: () => ye(s.getGui()),
      ariaLabel: i("ariaLabelContextMenu", "Context Menu"),
      closedCallback: (a) => {
        a instanceof KeyboardEvent && this.parentEl.focus(), this.destroyBean(s);
      }
    });
    o && (r = o.hideFunc), n.positionPopupUnderMouseEvent({
      type: "columnContextMenu",
      mouseEvent: this.mouseEvent,
      ePopup: t
    });
  }
  isActive() {
    return this.allowScrollIntoView || this.allowGrouping || this.allowValues || this.allowPivoting;
  }
  getMappedMenuItems() {
    const e = [], { menuItemMap: t, columns: s, displayName: i, beans: r } = this;
    for (const n of t.values()) {
      const o = s.some((l) => n.allowedFunction(l) && !n.activeFunction(l)), a = s.some((l) => n.allowedFunction(l) && n.activeFunction(l));
      o && e.push({
        name: n.activateLabel(i),
        icon: N(n.addIcon, r, null),
        action: () => n.activateFunction()
      }), a && n.removeIcon && n.deactivateLabel && e.push({
        name: n.deactivateLabel(i),
        icon: N(n.removeIcon, r, null),
        action: () => {
          var l;
          return (l = n.deActivateFunction) == null ? void 0 : l.call(n);
        }
      });
    }
    return e;
  }
}, cB = {
  tag: "div",
  cls: "ag-column-select-column-group",
  children: [
    {
      tag: "span",
      ref: "eColumnGroupIcons",
      cls: "ag-column-group-icons",
      children: [
        { tag: "span", ref: "eGroupClosedIcon", cls: "ag-column-group-closed-icon" },
        { tag: "span", ref: "eGroupOpenedIcon", cls: "ag-column-group-opened-icon" }
      ]
    },
    { tag: "ag-checkbox", ref: "cbSelect", cls: "ag-column-select-checkbox" },
    { tag: "span", ref: "eLabel", cls: "ag-column-select-column-label" }
  ]
}, IC = class extends D {
  constructor(e, t, s, i) {
    super(), this.modelItem = e, this.allowDragging = t, this.eventType = s, this.focusWrapper = i, this.cbSelect = x, this.eLabel = x, this.eGroupOpenedIcon = x, this.eGroupClosedIcon = x, this.eColumnGroupIcons = x, this.processingColumnStateChange = !1;
    const { columnGroup: r, depth: n, displayName: o } = e;
    this.columnGroup = r, this.columnDepth = n, this.displayName = o;
  }
  postConstruct() {
    this.setTemplate(cB, [_t]);
    const { beans: e, cbSelect: t, eLabel: s, displayName: i, columnDepth: r, modelItem: n, focusWrapper: o, columnGroup: a } = this, { registry: l, gos: c } = e, d = N("columnDrag", e);
    this.eDragHandle = d, d.classList.add("ag-drag-handle", "ag-column-select-column-group-drag-handle");
    const h = t.getGui(), u = t.getInputElement();
    h.insertAdjacentElement("afterend", d), u.setAttribute("tabindex", "-1"), s.textContent = i ?? "", this.setupExpandContract(), this.addCss("ag-column-select-indent-" + r), this.getGui().style.setProperty("--ag-indentation-level", String(r)), this.tooltipFeature = this.createOptionalManagedBean(
      l.createDynamicBean("tooltipFeature", !1, {
        getGui: () => this.focusWrapper,
        getLocation: () => "columnToolPanelColumnGroup",
        shouldDisplayTooltip: Fa(c, () => s)
      })
    ), this.addManagedEventListeners({ columnPivotModeChanged: this.onColumnStateChanged.bind(this) }), this.addManagedElementListeners(s, { click: this.onLabelClicked.bind(this) }), this.addManagedListeners(t, { fieldValueChanged: this.onCheckboxChanged.bind(this) }), this.addManagedListeners(n, { expandedChanged: this.onExpandChanged.bind(this) }), this.addManagedListeners(o, {
      keydown: this.handleKeyDown.bind(this),
      contextmenu: this.onContextMenu.bind(this)
    }), this.setOpenClosedIcons(), this.setupDragging(), this.onColumnStateChanged(), this.addVisibilityListenersToAllChildren(), this.refreshAriaExpanded(), this.refreshAriaLabel(), this.setupTooltip(), mf(a.getColGroupDef(), c, null, a).forEach((p) => this.toggleCss(p, !0));
  }
  getColumns() {
    return this.columnGroup.getLeafColumns();
  }
  setupTooltip() {
    const e = this.columnGroup.getColGroupDef();
    if (!e)
      return;
    const t = () => {
      var s;
      return (s = this.tooltipFeature) == null ? void 0 : s.setTooltipAndRefresh(e.headerTooltip);
    };
    t(), this.addManagedEventListeners({ newColumnsLoaded: t });
  }
  handleKeyDown(e) {
    switch (e.key) {
      case S.LEFT:
        e.preventDefault(), this.modelItem.expanded = !1;
        break;
      case S.RIGHT:
        e.preventDefault(), this.modelItem.expanded = !0;
        break;
      case S.SPACE:
        e.preventDefault(), this.isSelectable() && this.onSelectAllChanged(!this.isSelected());
        break;
    }
  }
  onContextMenu(e) {
    const { columnGroup: t, gos: s } = this;
    if (s.get("functionsReadOnly"))
      return;
    const i = this.createBean(new AC(t, e, this.focusWrapper));
    this.addDestroyFunc(() => {
      i.isAlive() && this.destroyBean(i);
    });
  }
  addVisibilityListenersToAllChildren() {
    const e = this.onColumnStateChanged.bind(this);
    this.columnGroup.getLeafColumns().forEach((t) => {
      this.addManagedListeners(t, {
        visibleChanged: e,
        columnValueChanged: e,
        columnPivotChanged: e,
        columnRowGroupChanged: e
      });
    });
  }
  setupDragging() {
    if (!this.allowDragging) {
      O(this.eDragHandle, !1);
      return;
    }
    const e = this.beans, { gos: t, eventSvc: s, dragAndDrop: i } = e;
    let r = !t.get("suppressDragLeaveHidesColumns");
    const n = {
      type: zt.ToolPanel,
      eElement: this.eDragHandle,
      dragItemName: this.displayName,
      getDefaultIconName: () => r ? "hide" : "notAllowed",
      getDragItem: () => this.createDragItem(),
      onDragStarted: () => {
        r = !t.get("suppressDragLeaveHidesColumns"), s.dispatchEvent({
          type: "columnPanelItemDragStart",
          column: this.columnGroup
        });
      },
      onDragStopped: () => {
        s.dispatchEvent({
          type: "columnPanelItemDragEnd"
        });
      },
      onGridEnter: (o) => {
        r && TC(e, {
          columns: this.columnGroup.getLeafColumns(),
          visibleState: o == null ? void 0 : o.visibleState,
          pivotState: o == null ? void 0 : o.pivotState,
          eventType: this.eventType
        });
      },
      onGridExit: () => {
        r && this.onChangeCommon(!1);
      }
    };
    i.addDragSource(n, !0), this.addDestroyFunc(() => i.removeDragSource(n));
  }
  createDragItem() {
    const e = this.columnGroup.getLeafColumns(), t = {}, s = {};
    return e.forEach((i) => {
      const r = i.getId();
      t[r] = i.isVisible(), s[r] = MC(i);
    }), {
      columns: e,
      visibleState: t,
      pivotState: s
    };
  }
  setupExpandContract() {
    const { beans: e, eGroupClosedIcon: t, eGroupOpenedIcon: s, eColumnGroupIcons: i } = this;
    t.appendChild(Bt("columnSelectClosed", e, null)), s.appendChild(Bt("columnSelectOpen", e, null));
    const r = this.onExpandOrContractClicked.bind(this);
    this.addManagedElementListeners(t, { click: r }), this.addManagedElementListeners(s, { click: r });
    const n = new ms(i, !0);
    this.addManagedListeners(n, { tap: r }), this.addDestroyFunc(n.destroy.bind(n));
  }
  onLabelClicked() {
    const e = !this.cbSelect.getValue();
    this.onChangeCommon(e);
  }
  onCheckboxChanged(e) {
    this.onChangeCommon(e.selected);
  }
  getVisibleLeafColumns() {
    const e = [], t = (s) => {
      s.forEach((i) => {
        i.passesFilter && (i.group ? t(i.children) : e.push(i.column));
      });
    };
    return t(this.modelItem.children), e;
  }
  onChangeCommon(e) {
    this.refreshAriaLabel(), !this.processingColumnStateChange && PC(this.beans, this.modelItem.children, e, this.eventType);
  }
  refreshAriaLabel() {
    const { cbSelect: e, focusWrapper: t, displayName: s } = this, i = this.getLocaleTextFunc(), r = i("ariaColumnGroup", "Column Group"), n = e.getValue(), o = n === void 0 ? i("ariaIndeterminate", "indeterminate") : n ? i("ariaVisible", "visible") : i("ariaHidden", "hidden"), a = i("ariaToggleVisibility", "Press SPACE to toggle visibility");
    re(t, `${s} ${r}`), e.setInputAriaLabel(`${a} (${o})`), Zo(t, e.getInputElement().id);
  }
  onColumnStateChanged() {
    const e = this.workOutSelectedValue(), t = this.workOutReadOnlyValue();
    this.processingColumnStateChange = !0;
    const s = this.cbSelect;
    s.setValue(e), s.setReadOnly(t), this.toggleCss("ag-column-select-column-group-readonly", t), this.processingColumnStateChange = !1;
  }
  workOutSelectedValue() {
    const e = this.beans.colModel.isPivotMode(), t = this.getVisibleLeafColumns();
    let s = 0, i = 0;
    if (t.forEach((r) => {
      !e && r.getColDef().lockVisible || (this.isColumnChecked(r, e) ? s++ : i++);
    }), !(s > 0 && i > 0))
      return s > 0;
  }
  workOutReadOnlyValue() {
    const e = this.beans.colModel.isPivotMode();
    let t = 0;
    return this.columnGroup.getLeafColumns().forEach((s) => {
      e ? s.isAnyFunctionAllowed() && t++ : s.getColDef().lockVisible || t++;
    }), t === 0;
  }
  isColumnChecked(e, t) {
    if (t) {
      const s = e.isPivotActive(), i = e.isRowGroupActive(), r = e.isValueActive();
      return s || i || r;
    }
    return e.isVisible();
  }
  onExpandOrContractClicked() {
    const e = this.modelItem, t = e.expanded;
    e.expanded = !t;
  }
  onExpandChanged() {
    this.setOpenClosedIcons(), this.refreshAriaExpanded();
  }
  setOpenClosedIcons() {
    const e = this.modelItem.expanded;
    O(this.eGroupClosedIcon, !e), O(this.eGroupOpenedIcon, e);
  }
  refreshAriaExpanded() {
    qe(this.focusWrapper, this.modelItem.expanded);
  }
  getDisplayName() {
    return this.displayName;
  }
  onSelectAllChanged(e) {
    const t = this.cbSelect, s = t.getValue();
    !t.isReadOnly() && (e && !s || !e && s) && t.toggle();
  }
  isSelected() {
    return this.cbSelect.getValue();
  }
  isSelectable() {
    return !this.cbSelect.isReadOnly();
  }
  setSelected(e) {
    this.cbSelect.setValue(e, !0);
  }
}, Fl = (e) => oe(e) ? e.getLeafColumns() : e ? [e] : [], dB = (e, t, s, i) => {
  if (!s || !t)
    return null;
  const r = e.colModel.getCols(), n = r.indexOf(s), o = i ? n : n + 1, a = hB(r, t, o);
  return o - a;
}, hB = (e, t, s) => {
  if (!t)
    return 0;
  const i = t[0], r = t.length;
  return e.indexOf(i) < s ? r : 0;
}, Bu = (e, t, s) => e.get("suppressMovableColumns") || t.colModel.isPivotMode() ? !0 : !!s.find(({ colDef: n }) => !!n.suppressMovable || !!n.lockPosition), Nu = (e, t, s) => {
  var a;
  if (!s)
    return;
  const { component: i } = s;
  let r = null, n = s.position === "top";
  if (i instanceof IC ? (r = i.getColumns()[0], n = !0) : i && (r = i.column), !r)
    return;
  const o = dB(e, t, r, n);
  o != null && ((a = e.colMoves) == null || a.moveColumns(t, o, "toolPanelUi"));
}, uB = (e) => e.column, gB = {
  tag: "div",
  cls: "ag-column-select-column",
  children: [
    { tag: "ag-checkbox", ref: "cbSelect", cls: "ag-column-select-checkbox" },
    { tag: "span", ref: "eLabel", cls: "ag-column-select-column-label" }
  ]
}, pB = class extends D {
  constructor(e, t, s, i) {
    super(), this.modelItem = e, this.allowDragging = t, this.groupsExist = s, this.focusWrapper = i, this.eLabel = x, this.cbSelect = x, this.processingColumnStateChange = !1;
    const { column: r, depth: n, displayName: o } = e;
    this.column = r, this.columnDepth = n, this.displayName = o;
  }
  postConstruct() {
    this.setTemplate(gB, [_t]);
    const {
      beans: e,
      cbSelect: t,
      displayName: s,
      eLabel: i,
      columnDepth: r,
      groupsExist: n,
      column: o,
      gos: a,
      focusWrapper: l
    } = this, c = N("columnDrag", e);
    this.eDragHandle = c, c.classList.add("ag-drag-handle", "ag-column-select-column-drag-handle");
    const d = t.getGui(), h = t.getInputElement();
    d.insertAdjacentElement("afterend", c), h.setAttribute("tabindex", "-1"), i.textContent = s, n && this.addCss("ag-column-select-add-group-indent"), this.addCss(`ag-column-select-indent-${r}`), this.getGui().style.setProperty("--ag-indentation-level", String(r)), this.tooltipFeature = this.createOptionalManagedBean(
      e.registry.createDynamicBean("tooltipFeature", !1, {
        getGui: () => this.focusWrapper,
        getLocation: () => "columnToolPanelColumn",
        shouldDisplayTooltip: Fa(a, () => i),
        getAdditionalParams: () => ({
          colDef: o.getColDef()
        })
      })
    ), this.setupDragging();
    const u = this.onColumnStateChanged.bind(this);
    this.addManagedEventListeners({ columnPivotModeChanged: u }), this.addManagedListeners(o, {
      columnValueChanged: u,
      columnPivotChanged: u,
      columnRowGroupChanged: u,
      visibleChanged: u
    }), this.addManagedListeners(l, {
      keydown: this.handleKeyDown.bind(this),
      contextmenu: this.onContextMenu.bind(this)
    }), this.addManagedPropertyListener("functionsReadOnly", this.onColumnStateChanged.bind(this)), this.addManagedListeners(t, { fieldValueChanged: this.onCheckboxChanged.bind(this) }), this.addManagedElementListeners(i, { click: this.onLabelClicked.bind(this) }), this.onColumnStateChanged(), this.refreshAriaLabel(), this.setupTooltip(), mf(o.getColDef(), a, o, null).forEach((p) => this.toggleCss(p, !0));
  }
  getColumn() {
    return this.column;
  }
  setupTooltip() {
    const e = () => {
      var t;
      return (t = this.tooltipFeature) == null ? void 0 : t.setTooltipAndRefresh(this.column.getColDef().headerTooltip);
    };
    e(), this.addManagedEventListeners({ newColumnsLoaded: e });
  }
  onContextMenu(e) {
    const { column: t, gos: s } = this;
    if (s.get("functionsReadOnly"))
      return;
    const i = this.createBean(new AC(t, e, this.focusWrapper));
    this.addDestroyFunc(() => {
      i.isAlive() && this.destroyBean(i);
    });
  }
  handleKeyDown(e) {
    e.key === S.SPACE && (e.preventDefault(), this.isSelectable() && this.onSelectAllChanged(!this.isSelected()));
  }
  onLabelClicked() {
    if (this.gos.get("functionsReadOnly"))
      return;
    const e = !this.cbSelect.getValue();
    this.onChangeCommon(e);
  }
  onCheckboxChanged(e) {
    this.onChangeCommon(e.selected);
  }
  onChangeCommon(e) {
    this.cbSelect.isReadOnly() || (this.refreshAriaLabel(), !this.processingColumnStateChange && EC(this.beans, [this.column], e, "toolPanelUi"));
  }
  refreshAriaLabel() {
    const { cbSelect: e, focusWrapper: t, displayName: s } = this, i = this.getLocaleTextFunc(), r = i("ariaColumn", "Column"), n = e.getValue() ? i("ariaVisible", "visible") : i("ariaHidden", "hidden"), o = i("ariaToggleVisibility", "Press SPACE to toggle visibility");
    re(t, `${s} ${r}`), this.cbSelect.setInputAriaLabel(`${o} (${n})`), Zo(t, e.getInputElement().id);
  }
  setupDragging() {
    const e = this.eDragHandle;
    if (!this.allowDragging) {
      O(e, !1);
      return;
    }
    const t = this.beans, { gos: s, eventSvc: i, dragAndDrop: r } = t;
    let n = !s.get("suppressDragLeaveHidesColumns");
    const o = {
      type: zt.ToolPanel,
      eElement: e,
      dragItemName: this.displayName,
      getDefaultIconName: () => n ? "hide" : "notAllowed",
      getDragItem: () => this.createDragItem(),
      onDragStarted: () => {
        n = !s.get("suppressDragLeaveHidesColumns"), i.dispatchEvent({
          type: "columnPanelItemDragStart",
          column: this.column
        });
      },
      onDragStopped: () => {
        i.dispatchEvent({
          type: "columnPanelItemDragEnd"
        });
      },
      onGridEnter: (a) => {
        n && TC(t, {
          columns: [this.column],
          visibleState: a == null ? void 0 : a.visibleState,
          pivotState: a == null ? void 0 : a.pivotState,
          eventType: "toolPanelUi"
        });
      },
      onGridExit: () => {
        n && this.onChangeCommon(!1);
      }
    };
    r.addDragSource(o, !0), this.addDestroyFunc(() => r.removeDragSource(o));
  }
  createDragItem() {
    const e = this.column.getColId(), t = { [e]: this.column.isVisible() }, s = { [e]: MC(this.column) };
    return {
      columns: [this.column],
      visibleState: t,
      pivotState: s
    };
  }
  onColumnStateChanged() {
    this.processingColumnStateChange = !0;
    const e = this.beans.colModel.isPivotMode();
    if (e) {
      const i = this.column.isAnyFunctionActive();
      this.cbSelect.setValue(i);
    } else
      this.cbSelect.setValue(this.column.isVisible());
    let t = !0, s = !0;
    if (e) {
      const i = this.gos.get("functionsReadOnly"), r = !this.column.isAnyFunctionAllowed();
      t = !i && !r, s = t;
    } else {
      const { enableRowGroup: i, enableValue: r, lockPosition: n, suppressMovable: o, lockVisible: a } = this.column.getColDef(), l = !!i || !!r, c = !!n || !!o;
      t = !a, s = l || !c;
    }
    this.cbSelect.setReadOnly(!t), this.eDragHandle.classList.toggle("ag-column-select-column-readonly", !s), this.toggleCss("ag-column-select-column-readonly", !s && !t), this.cbSelect.setPassive(!1), this.processingColumnStateChange = !1;
  }
  getDisplayName() {
    return this.displayName;
  }
  onSelectAllChanged(e) {
    const t = this.cbSelect;
    e !== t.getValue() && (t.isReadOnly() || t.toggle());
  }
  isSelected() {
    return this.cbSelect.getValue();
  }
  isSelectable() {
    return !this.cbSelect.isReadOnly();
  }
  isExpandable() {
    return !1;
  }
  setExpanded(e) {
    F(158);
  }
}, fB = class {
  constructor(e) {
    this.items = e;
  }
  getRowCount() {
    return this.items.length;
  }
  getRow(e) {
    return this.items[e];
  }
}, mB = "ag-column-select-list", CB = class extends D {
  constructor() {
    super({ tag: "div", cls: mB, role: "presentation" }), this.destroyColumnItemFuncs = [], this.hasLoadedInitialState = !1, this.isInitialState = !1, this.skipRefocus = !1;
  }
  wireBeans(e) {
    this.colModel = e.colModel;
  }
  destroy() {
    this.destroyColumnTree(), super.destroy();
  }
  destroyColumnTree() {
    this.allColsTree = [], this.destroyColumnItemFuncs.forEach((e) => e()), this.destroyColumnItemFuncs = [];
  }
  init(e, t, s) {
    this.params = e;
    const { suppressSyncLayoutWithGrid: i, contractColumnSelection: r, suppressColumnMove: n } = e;
    this.allowDragging = t, this.eventType = s, i || this.addManagedEventListeners({ columnMoved: this.onColumnsChanged.bind(this) }), this.addManagedEventListeners({
      newColumnsLoaded: this.onColumnsChanged.bind(this)
    });
    const o = this.fireSelectionChangedEvent.bind(this);
    this.addManagedEventListeners({
      columnPivotChanged: o,
      columnPivotModeChanged: o,
      columnRowGroupChanged: o,
      columnValueChanged: o,
      columnVisible: o,
      newColumnsLoaded: o
    }), this.expandGroupsByDefault = !r;
    const a = n || i, l = this.createManagedBean(
      new yr({
        cssIdentifier: "column-select",
        ariaRole: "tree",
        moveItemCallback: (c, d) => {
          a || this.moveItems(c, d);
        }
      })
    );
    this.virtualList = l, this.appendChild(l.getGui()), l.setComponentCreator((c, d) => (Qo(d, c.depth + 1), this.createComponentFromItem(c, d))), this.colModel.ready && this.onColumnsChanged(), !a && this.createItemDragFeature();
  }
  createItemDragFeature() {
    const { gos: e, beans: t, eventSvc: s, virtualList: i } = this;
    this.createManagedBean(
      new uC(this, i, {
        dragSourceType: zt.ToolPanel,
        listItemDragStartEvent: "columnPanelItemDragStart",
        listItemDragEndEvent: "columnPanelItemDragEnd",
        eventSource: s,
        getCurrentDragValue: (r) => uB(r),
        isMoveBlocked: (r) => Bu(e, t, Fl(r)),
        getNumRows: (r) => r.getDisplayedColsList().length,
        moveItem: (r, n) => Nu(t, Fl(r), n)
      })
    );
  }
  moveItems(e, t) {
    var p;
    const { gos: s, beans: i } = this, { modelItem: r } = e, { group: n, columnGroup: o, column: a, expanded: l } = r, c = Fl(n ? o : a);
    if (Bu(s, i, c))
      return;
    const d = this.displayedColsList.indexOf(r), h = t ? -1 : 1;
    let u = 0;
    if (t) {
      const f = e.columnDepth > 0 && ((p = a.getParent()) == null ? void 0 : p.getChildren());
      f && f.length && a === f[0] && (u = -1);
    } else n && (u = l ? r.children.length : 0);
    const g = Math.min(Math.max(d + u + h, 0), this.displayedColsList.length - 1);
    this.skipRefocus = !0, Nu(i, c, {
      position: t ? "top" : "bottom",
      component: this.virtualList.getComponentAt(g)
    }), this.focusRowIfAlive(g - u).then(() => {
      this.skipRefocus = !1;
    });
  }
  createComponentFromItem(e, t) {
    const s = this.allowDragging;
    if (e.group) {
      const r = new IC(e, s, this.eventType, t);
      return this.createBean(r), r;
    }
    const i = new pB(e, s, this.groupsExist, t);
    return this.createBean(i), i;
  }
  onColumnsChanged() {
    const e = this.params;
    this.hasLoadedInitialState || (this.hasLoadedInitialState = !0, this.isInitialState = !!e.initialState);
    const t = this.getExpandedStates(), s = this.colModel.isPivotMode();
    !e.suppressSyncLayoutWithGrid && !s ? this.buildTreeFromWhatGridIsDisplaying() : this.buildTreeFromProvidedColumnDefs(), this.setExpandedStates(t), this.markFilteredColumns(), this.flattenAndFilterModel(), this.isInitialState = !1;
  }
  getDisplayedColsList() {
    return this.displayedColsList;
  }
  getExpandedStates() {
    const e = {};
    if (this.isInitialState) {
      const { expandedGroupIds: t } = this.params.initialState;
      return t.forEach((s) => {
        e[s] = !0;
      }), e;
    }
    return this.allColsTree ? (this.forEachItem((t) => {
      if (!t.group)
        return;
      const s = t.columnGroup;
      s && (e[s.getId()] = t.expanded);
    }), e) : {};
  }
  setExpandedStates(e) {
    if (!this.allColsTree)
      return;
    const { isInitialState: t } = this;
    this.forEachItem((s) => {
      if (!s.group)
        return;
      const i = s.columnGroup;
      if (i) {
        const r = e[i.getId()];
        (r != null || t) && (s.expanded = !!r);
      }
    });
  }
  buildTreeFromWhatGridIsDisplaying() {
    RC(this.colModel, this.setColumnLayout.bind(this));
  }
  setColumnLayout(e) {
    const t = FC(this.colModel, e);
    this.buildListModel(t), this.groupsExist = e.some((s) => s && typeof s.children < "u"), this.markFilteredColumns(), this.flattenAndFilterModel();
  }
  buildTreeFromProvidedColumnDefs() {
    var t;
    const e = this.colModel;
    this.buildListModel(e.getColDefColTree()), this.groupsExist = !!((t = e.colDefCols) != null && t.treeDepth);
  }
  buildListModel(e) {
    const t = this.onColumnExpanded.bind(this), s = (a) => {
      a.addEventListener("expandedChanged", t);
      const l = a.removeEventListener.bind(a, "expandedChanged", t);
      this.destroyColumnItemFuncs.push(l);
    }, i = this.beans.colNames, r = (a, l, c) => {
      a.forEach((d) => {
        oe(d) ? n(d, l, c) : o(d, l, c);
      });
    }, n = (a, l, c) => {
      const d = a.getColGroupDef();
      if (d && d.suppressColumnsToolPanel)
        return;
      if (a.isPadding()) {
        r(a.getChildren(), l, c);
        return;
      }
      const u = i.getDisplayNameForProvidedColumnGroup(null, a, "columnToolPanel"), g = new Ou(
        u,
        a,
        l,
        !0,
        this.expandGroupsByDefault
      );
      c.push(g), s(g), r(a.getChildren(), l + 1, g.children);
    }, o = (a, l, c) => {
      if (a.getColDef() && a.getColDef().suppressColumnsToolPanel)
        return;
      const h = i.getDisplayNameForColumn(a, "columnToolPanel");
      c.push(new Ou(h, a, l));
    };
    this.destroyColumnTree(), r(e, 0, this.allColsTree);
  }
  onColumnExpanded() {
    this.flattenAndFilterModel();
  }
  flattenAndFilterModel() {
    this.displayedColsList = [];
    const e = (i) => {
      i.passesFilter && (this.displayedColsList.push(i), i.group && i.expanded && i.children.forEach(e));
    }, t = this.virtualList;
    this.allColsTree.forEach(e), t.setModel(new fB(this.displayedColsList));
    let s = null;
    this.skipRefocus || (s = t.getLastFocusedRow()), t.refresh(), s != null && this.focusRowIfAlive(s), this.notifyListeners(), this.refreshAriaLabel();
  }
  refreshAriaLabel() {
    const e = this.getLocaleTextFunc(), t = e("ariaColumnPanelList", "Column List"), s = e("columns", "Columns"), i = this.displayedColsList.length;
    re(this.virtualList.getAriaElement(), `${t} ${i} ${s}`);
  }
  focusRowIfAlive(e) {
    return e === -1 ? Promise.resolve() : new Promise((t) => {
      window.setTimeout(() => {
        this.isAlive() && this.virtualList.focusRow(e), t();
      }, 0);
    });
  }
  forEachItem(e) {
    const t = (i) => {
      i.forEach((r) => {
        e(r), r.group && t(r.children);
      });
    }, s = this.allColsTree;
    s && t(s);
  }
  doSetExpandedAll(e) {
    this.forEachItem((t) => {
      t.group && (t.expanded = e);
    });
  }
  setGroupsExpanded(e, t) {
    if (!t) {
      this.doSetExpandedAll(e);
      return;
    }
    const s = [];
    this.forEachItem((r) => {
      if (!r.group)
        return;
      const n = r.columnGroup.getId();
      t.indexOf(n) >= 0 && (r.expanded = e, s.push(n));
    });
    const i = t.filter((r) => !s.includes(r));
    i.length > 0 && F(157, { unrecognisedGroupIds: i });
  }
  getExpandState() {
    let e = 0, t = 0;
    return this.forEachItem((s) => {
      s.group && (s.expanded ? e++ : t++);
    }), e > 0 && t > 0 ? 2 : t > 0 ? 1 : 0;
  }
  doSetSelectedAll(e) {
    PC(this.beans, this.allColsTree, e, this.eventType);
  }
  getSelectionState() {
    let e = 0, t = 0;
    const s = this.colModel.isPivotMode();
    if (this.forEachItem((i) => {
      if (i.group || !i.passesFilter)
        return;
      const r = i.column, n = r.getColDef();
      let o;
      if (s) {
        if (!r.isAllowPivot() && !r.isAllowRowGroup() && !r.isAllowValue())
          return;
        o = r.isValueActive() || r.isPivotActive() || r.isRowGroupActive();
      } else {
        if (n.lockVisible)
          return;
        o = r.isVisible();
      }
      o ? e++ : t++;
    }), !(e > 0 && t > 0))
      return !(e === 0 || t > 0);
  }
  setFilterText(e) {
    this.filterText = A(e) ? e.toLowerCase() : null, this.markFilteredColumns(), this.flattenAndFilterModel();
  }
  markFilteredColumns() {
    const e = (s) => {
      if (!A(this.filterText))
        return !0;
      const i = s.displayName;
      return i == null || i.toLowerCase().indexOf(this.filterText) !== -1;
    }, t = (s, i) => {
      let r = !1;
      if (s.group) {
        const o = e(s);
        s.children.forEach((a) => {
          const l = t(a, o || i);
          l && (r = l);
        });
      }
      const n = i || r ? !0 : e(s);
      return s.passesFilter = n, n;
    };
    this.allColsTree.forEach((s) => t(s, !1));
  }
  notifyListeners() {
    this.fireGroupExpandedEvent(), this.fireSelectionChangedEvent();
  }
  fireGroupExpandedEvent() {
    const e = this.getExpandState();
    this.dispatchLocalEvent({ type: "groupExpanded", state: e });
  }
  fireSelectionChangedEvent() {
    if (!this.allColsTree)
      return;
    const e = this.getSelectionState();
    this.dispatchLocalEvent({ type: "selectionChanged", state: e });
  }
  getExpandedGroups() {
    const e = [];
    return this.allColsTree && this.forEachItem((t) => {
      t.group && t.expanded && e.push(t.columnGroup.getId());
    }), e;
  }
}, vB = {
  selector: "AG-PRIMARY-COLS-LIST",
  component: CB
}, wB = {
  tag: "div",
  cls: "ag-column-select",
  children: [
    { tag: "ag-primary-cols-header", ref: "primaryColsHeaderPanel" },
    { tag: "ag-primary-cols-list", ref: "primaryColsListPanel" }
  ]
}, LC = class extends D {
  constructor() {
    super(wB, [ZV, vB]), this.primaryColsHeaderPanel = x, this.primaryColsListPanel = x, this.registerCSS(jV);
  }
  // we allow dragging in the toolPanel, but not when this component appears in the column menu
  init(e, t, s) {
    const { primaryColsHeaderPanel: i, primaryColsListPanel: r } = this;
    i.init(t);
    const n = t.suppressColumnFilter, o = t.suppressColumnSelectAll;
    t.suppressColumnExpandAll && n && o && i.setDisplayed(!1), this.addManagedListeners(r, {
      groupExpanded: (l) => {
        i.setExpandState(l.state), t.onStateUpdated();
      },
      selectionChanged: (l) => i.setSelectionState(l.state)
    }), r.init(t, e, s), this.addManagedListeners(i, {
      expandAll: r.doSetExpandedAll.bind(r, !0),
      collapseAll: r.doSetExpandedAll.bind(r, !1),
      selectAll: r.doSetSelectedAll.bind(r, !0),
      unselectAll: r.doSetSelectedAll.bind(r, !1),
      filterChanged: (l) => r.setFilterText(l.filterText)
    }), this.positionableFeature = this.createManagedBean(new va(this.getGui(), { minHeight: 100 }));
  }
  toggleResizable(e) {
    this.positionableFeature.setResizable(e ? { bottom: !0 } : !1);
  }
  expandGroups(e) {
    this.primaryColsListPanel.setGroupsExpanded(!0, e);
  }
  collapseGroups(e) {
    this.primaryColsListPanel.setGroupsExpanded(!1, e);
  }
  setColumnLayout(e) {
    this.primaryColsListPanel.setColumnLayout(e);
  }
  syncLayoutWithGrid() {
    this.primaryColsListPanel.onColumnsChanged();
  }
  getExpandedGroups() {
    return this.primaryColsListPanel.getExpandedGroups();
  }
}, bB = (
  /*css*/
  ".ag-column-panel{display:flex;flex:1 1 auto;flex-direction:column;overflow:hidden}.ag-pivot-mode-panel{display:flex;height:var(--ag-header-height)}.ag-pivot-mode-select{align-items:center;display:flex}:where(.ag-ltr) .ag-pivot-mode-select{margin-left:var(--ag-widget-container-horizontal-padding)}:where(.ag-rtl) .ag-pivot-mode-select{margin-right:var(--ag-widget-container-horizontal-padding)}.ag-column-panel-column-select{border-bottom:var(--ag-tool-panel-separator-border)}.ag-column-panel-column-select:where(:nth-child(n+2 of :not(.ag-hidden))){border-top:var(--ag-tool-panel-separator-border)}:where(.ag-column-panel) .ag-column-drop-vertical{flex:1 1 0px;min-height:50px;&:where(:not(.ag-last-column-drop)){border-bottom:var(--ag-tool-panel-separator-border)}}"
), yB = class extends D {
  constructor() {
    super({ tag: "div", cls: "ag-column-panel" }), this.initialised = !1, this.childDestroyFuncs = [], this.registerCSS(bB);
  }
  wireBeans(e) {
    this.colToolPanelFactory = e.colToolPanelFactory;
  }
  // lazy initialise the panel
  setVisible(e) {
    super.setDisplayed(e), e && !this.initialised && this.init(this.params);
  }
  init(e) {
    const s = {
      ...V(this.gos, {
        suppressColumnMove: !1,
        suppressColumnSelectAll: !1,
        suppressColumnFilter: !1,
        suppressColumnExpandAll: !1,
        contractColumnSelection: !1,
        suppressPivotMode: !1,
        suppressRowGroups: !1,
        suppressValues: !1,
        suppressPivots: !1,
        suppressSyncLayoutWithGrid: !1
      }),
      ...e
    };
    this.params = s;
    const { childDestroyFuncs: i, colToolPanelFactory: r, gos: n } = this, o = n.isModuleRegistered("SharedPivot"), a = o || n.isModuleRegistered("SharedRowGrouping");
    !s.suppressPivotMode && r && o && (this.pivotModePanel = r.createPivotModePanel(this, i));
    const l = this.createBean(new LC());
    if (this.primaryColsPanel = l, i.push(() => this.destroyBean(this.primaryColsPanel)), l.init(!0, s, "toolPanelUi"), l.addCss("ag-column-panel-column-select"), this.appendChild(l), r) {
      !s.suppressRowGroups && a && (this.rowGroupDropZonePanel = r.createRowGroupPanel(this, i)), !s.suppressValues && a && (this.valuesDropZonePanel = r.createValuesPanel(this, i)), !s.suppressPivots && o && (this.pivotDropZonePanel = r.createPivotPanel(this, i)), this.setLastVisible();
      const [c] = this.addManagedEventListeners({
        columnPivotModeChanged: () => {
          this.resetChildrenHeight(), this.setLastVisible();
        }
      });
      i.push(() => c());
    }
    this.initialised = !0;
  }
  setPivotModeSectionVisible(e) {
    const t = this.colToolPanelFactory;
    t && (this.pivotModePanel = t.setPanelVisible(
      this.pivotModePanel,
      e,
      t.createPivotModePanel.bind(t, this, this.childDestroyFuncs, !0)
    ), this.setLastVisible());
  }
  setRowGroupsSectionVisible(e) {
    const t = this.colToolPanelFactory;
    t && (this.rowGroupDropZonePanel = t.setPanelVisible(
      this.rowGroupDropZonePanel,
      e,
      t.createRowGroupPanel.bind(t, this, this.childDestroyFuncs)
    ), this.setLastVisible());
  }
  setValuesSectionVisible(e) {
    const t = this.colToolPanelFactory;
    t && (this.valuesDropZonePanel = t.setPanelVisible(
      this.valuesDropZonePanel,
      e,
      t.createValuesPanel.bind(t, this, this.childDestroyFuncs)
    ), this.setLastVisible());
  }
  setPivotSectionVisible(e) {
    var s;
    const t = this.colToolPanelFactory;
    t && (this.pivotDropZonePanel = t.setPanelVisible(
      this.pivotDropZonePanel,
      e,
      t.createPivotPanel.bind(t, this, this.childDestroyFuncs)
    ), (s = this.pivotDropZonePanel) == null || s.setDisplayed(e), this.setLastVisible());
  }
  setResizers() {
    [this.primaryColsPanel, this.rowGroupDropZonePanel, this.valuesDropZonePanel, this.pivotDropZonePanel].forEach(
      (e) => {
        if (!e)
          return;
        const t = e.getGui();
        e.toggleResizable(
          !t.classList.contains("ag-last-column-drop") && !t.classList.contains("ag-hidden")
        );
      }
    );
  }
  setLastVisible() {
    const e = this.getGui();
    Array.prototype.slice.call(e.querySelectorAll(".ag-column-drop")).forEach((r) => r.classList.remove("ag-last-column-drop"));
    const s = e.querySelectorAll(".ag-column-drop:not(.ag-hidden)"), i = _(s);
    i && i.classList.add("ag-last-column-drop"), this.setResizers();
  }
  resetChildrenHeight() {
    const t = this.getGui().children;
    for (let s = 0; s < t.length; s++) {
      const { style: i } = t[s];
      i.removeProperty("height"), i.removeProperty("flex");
    }
  }
  expandColumnGroups(e) {
    this.primaryColsPanel.expandGroups(e);
  }
  collapseColumnGroups(e) {
    this.primaryColsPanel.collapseGroups(e);
  }
  setColumnLayout(e) {
    this.primaryColsPanel.setColumnLayout(e);
  }
  syncLayoutWithGrid() {
    this.primaryColsPanel.syncLayoutWithGrid();
  }
  destroyChildren() {
    const e = this.childDestroyFuncs;
    e.forEach((t) => t()), e.length = 0, X(this.getGui());
  }
  refresh(e) {
    return this.destroyChildren(), this.init(e), !0;
  }
  getState() {
    return {
      expandedGroupIds: this.primaryColsPanel.getExpandedGroups()
    };
  }
  destroy() {
    this.destroyChildren(), super.destroy();
  }
}, SB = (
  /*css*/
  ".ag-column-drop{align-items:center;display:inline-flex;overflow:auto;position:relative;width:100%}.ag-column-drop-list{align-items:center;display:flex}.ag-column-drop-cell{align-items:center;background-color:var(--ag-column-drop-cell-background-color);border:var(--ag-column-drop-cell-border);border-radius:500px;color:var(--ag-column-drop-cell-text-color);display:flex;padding:calc(var(--ag-spacing)*.25);position:relative;&:focus-visible{box-shadow:var(--ag-focus-shadow)}:where(.ag-drag-handle){color:var(--ag-column-drop-cell-drag-handle-color)}}:where(.ag-ltr) .ag-column-drop-cell{padding-left:calc(var(--ag-spacing)*.75)}:where(.ag-rtl) .ag-column-drop-cell{padding-right:calc(var(--ag-spacing)*.75)}.ag-column-drop-cell-text{flex:1 1 auto;margin:0 var(--ag-spacing);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-column-drop-vertical{align-items:stretch;display:flex;flex-direction:column;min-height:75px;overflow:hidden}.ag-column-drop-vertical-title-bar{align-items:center;display:flex;flex:none;padding:var(--ag-widget-container-vertical-padding) calc(var(--ag-spacing)*2) 0}.ag-column-drop-vertical-list{align-items:stretch;flex-direction:column;flex-grow:1;overflow-x:auto;padding-bottom:var(--ag-spacing);padding-left:var(--ag-spacing);padding-right:var(--ag-spacing);position:relative;>*{flex:none}}:where(.ag-column-drop-empty) .ag-column-drop-vertical-list{overflow:hidden}.ag-column-drop-cell-button{cursor:pointer;min-width:0;opacity:.75;&:hover{opacity:1}}:where(.ag-ltr) .ag-column-drop-cell-button{margin-right:calc(var(--ag-spacing)/4)}:where(.ag-rtl) .ag-column-drop-cell-button{margin-left:calc(var(--ag-spacing)/4)}:where(.ag-ltr) .ag-column-drop-cell-drag-handle{margin-left:calc(var(--ag-spacing)/4)}:where(.ag-rtl) .ag-column-drop-cell-drag-handle{margin-right:calc(var(--ag-spacing)/4)}.ag-column-drop-wrapper{display:flex}.ag-column-drop-horizontal-half-width{width:50%!important}.ag-column-drop-cell-ghost{opacity:.5}.ag-column-drop-horizontal{background-color:var(--ag-header-background-color);border-bottom:var(--ag-header-row-border);gap:var(--ag-cell-widget-spacing);height:var(--ag-header-height);overflow:hidden;white-space:nowrap}:where(.ag-ltr) .ag-column-drop-horizontal{padding-left:var(--ag-cell-horizontal-padding)}:where(.ag-rtl) .ag-column-drop-horizontal{padding-right:var(--ag-cell-horizontal-padding)}.ag-column-drop-horizontal-list{gap:var(--ag-cell-widget-spacing)}.ag-column-drop-vertical-cell{margin-top:var(--ag-spacing)}:where(.ag-ltr) .ag-column-drop-vertical-icon{margin-right:var(--ag-widget-horizontal-spacing)}:where(.ag-rtl) .ag-column-drop-vertical-icon{margin-left:var(--ag-widget-horizontal-spacing)}.ag-select-agg-func-popup{background:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dropdown-shadow);height:calc(var(--ag-spacing)*5*3.5);padding:0;position:absolute}.ag-select-agg-func-virtual-list-item{cursor:default;&:hover{background-color:var(--ag-selected-row-background-color)}}:where(.ag-ltr) .ag-select-agg-func-virtual-list-item{padding-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-select-agg-func-virtual-list-item{padding-right:calc(var(--ag-spacing)*2)}:where(.ag-ltr) .ag-column-drop-horizontal-half-width:where(:not(:last-child)){border-right:solid var(--ag-border-width) var(--ag-border-color)}:where(.ag-rtl) .ag-column-drop-horizontal-half-width:where(:not(:last-child)){border-left:solid var(--ag-border-width) var(--ag-border-color)}"
);
function Hu(e, t, s) {
  e == null || t == null || e.splice(s, 0, ...t);
}
var xB = { tag: "div", cls: "ag-unselectable", role: "presentation" }, kC = class extends D {
  constructor(e) {
    super(xB), this.horizontal = e, this.state = "notDragging", this.guiDestroyFunctions = [], this.childPillComponents = [], this.resizeEnabled = !1, this.addElementClasses(this.getGui()), this.ePillDropList = K({ tag: "div" }), this.addElementClasses(this.ePillDropList, "list"), this.registerCSS(SB);
  }
  toggleResizable(e) {
    this.positionableFeature.setResizable(e ? { bottom: !0 } : !1), this.resizeEnabled = e;
  }
  isSourceEventFromTarget(e) {
    const { dropZoneTarget: t, dragSource: s } = e;
    return t.contains(s.eElement);
  }
  destroy() {
    this.destroyGui(), super.destroy();
  }
  destroyGui() {
    this.guiDestroyFunctions.forEach((e) => e()), this.guiDestroyFunctions.length = 0, this.childPillComponents.length = 0, X(this.getGui()), X(this.ePillDropList);
  }
  init(e) {
    this.params = e ?? {}, this.createManagedBean(
      new ii(this.getFocusableElement(), {
        onTabKeyDown: this.onTabKeyDown.bind(this),
        handleKeyDown: this.onKeyDown.bind(this)
      })
    ), this.setupDropTarget(), this.positionableFeature = new va(this.getGui()), this.createManagedBean(this.positionableFeature), this.refreshGui(), re(this.ePillDropList, this.getAriaLabel());
  }
  onTabKeyDown(e) {
    const t = Vt(this.getFocusableElement(), null, !0), s = t.length;
    if (s === 0)
      return;
    const { shiftKey: i } = e, r = Q(this.beans), n = r === t[0], o = r === _(t);
    s === 1 || n && i || o && !i || t[i ? 0 : s - 1].focus();
  }
  onKeyDown(e) {
    const { key: t } = e, s = !this.horizontal;
    let i = t === S.DOWN, r = t === S.UP;
    if (!s) {
      const n = this.gos.get("enableRtl");
      i = !n && t === S.RIGHT || n && t === S.LEFT, r = !n && t === S.LEFT || n && t === S.RIGHT;
    }
    if (!(!i && !r))
      if (e.preventDefault(), e.shiftKey)
        this.moveFocusedItem(r);
      else {
        const n = ze(this.beans, this.getFocusableElement(), !1, r);
        n && n.focus();
      }
  }
  moveFocusedItem(e) {
    const t = this.getFocusedItem();
    if (t === -1)
      return;
    const s = e ? -1 : 1;
    if (!this.normalizeAndUpdateInsertIndex(t, t + s))
      return;
    const r = this.childPillComponents[t];
    if (!r.isMovable())
      return;
    const n = r.getItem();
    this.focusItemAtIndex(this.insertIndex), this.rearrangeItems([n], !0);
  }
  addElementClasses(e, t) {
    t = t ? `-${t}` : "";
    const s = this.horizontal ? "horizontal" : "vertical";
    e.classList.add(`ag-column-drop${t}`, `ag-column-drop-${s}${t}`);
  }
  setupDropTarget() {
    var e;
    this.dropTarget = {
      getContainer: this.getGui.bind(this),
      getIconName: this.getIconName.bind(this),
      onDragging: this.onDragging.bind(this),
      onDragEnter: this.onDragEnter.bind(this),
      onDragLeave: this.onDragLeave.bind(this),
      onDragStop: this.onDragStop.bind(this),
      onDragCancel: this.onDragCancel.bind(this),
      isInterestedIn: this.isInterestedIn.bind(this)
    }, (e = this.beans.dragAndDrop) == null || e.addDropTarget(this.dropTarget);
  }
  minimumAllowedNewInsertIndex() {
    return 0;
  }
  checkInsertIndex(e) {
    const t = this.getNewInsertIndex(e);
    return t < 0 ? !1 : this.normalizeAndUpdateInsertIndex(this.insertIndex, t);
  }
  normalizeAndUpdateInsertIndex(e, t) {
    const s = this.minimumAllowedNewInsertIndex(), i = Math.max(s, t), r = i !== e;
    return r && (this.insertIndex = i), r;
  }
  getNewInsertIndex(e) {
    const t = e.event, s = this.horizontal ? t.clientX : t.clientY, i = this.childPillComponents.map((n) => n.getGui().getBoundingClientRect()), r = i.findIndex(
      (n) => this.horizontal ? n.right > s && n.left < s : n.top < s && n.bottom > s
    );
    if (r === -1) {
      const n = this.gos.get("enableRtl");
      return i.every((l) => s > (this.horizontal ? l.right : l.bottom)) ? n && this.horizontal ? 0 : this.childPillComponents.length : i.every((l) => s < (this.horizontal ? l.left : l.top)) ? n && this.horizontal ? this.childPillComponents.length : 0 : this.insertIndex;
    }
    return this.insertIndex <= r ? r + 1 : r;
  }
  checkDragStartedBySelf(e) {
    this.state === "notDragging" && (this.state = "rearrangeItems", this.potentialDndItems = this.getItems(e.dragSource.getDragItem()), this.refreshGui(), this.checkInsertIndex(e), this.refreshGui());
  }
  onDragging(e) {
    this.checkDragStartedBySelf(e), this.checkInsertIndex(e) && this.refreshGui();
  }
  handleDragEnterEnd(e) {
  }
  onDragEnter(e) {
    const t = this.getItems(e.dragSource.getDragItem());
    this.state = "newItemsIn";
    const s = t.filter((r) => this.isItemDroppable(r, e)), i = s.every(
      (r) => this.childPillComponents.map((n) => n.getItem()).indexOf(r) !== -1
    );
    if (s.length !== 0) {
      if (this.potentialDndItems = s, i) {
        this.state = "notDragging";
        return;
      }
      this.handleDragEnterEnd(e), this.checkInsertIndex(e), this.refreshGui();
    }
  }
  isPotentialDndItems() {
    var e;
    return !!((e = this.potentialDndItems) != null && e.length);
  }
  handleDragLeaveEnd(e) {
  }
  onDragLeave(e) {
    if (this.state === "rearrangeItems") {
      const t = this.getItems(e.dragSource.getDragItem());
      this.removeItems(t);
    }
    this.isPotentialDndItems() && (this.handleDragLeaveEnd(e), this.potentialDndItems = [], this.refreshGui()), this.state = "notDragging";
  }
  onDragCancel(e) {
    this.isPotentialDndItems() && (this.state === "newItemsIn" && this.handleDragLeaveEnd(e), this.potentialDndItems = [], this.refreshGui()), this.state = "notDragging";
  }
  onDragStop() {
    this.isPotentialDndItems() && (this.state === "newItemsIn" ? this.addItems(this.potentialDndItems) : this.rearrangeItems(this.potentialDndItems), this.potentialDndItems = [], this.refreshGui()), this.state = "notDragging";
  }
  removeItems(e) {
    const t = this.getExistingItems().filter((s) => !e.includes(s));
    this.updateItems(t);
  }
  addItems(e) {
    if (!e)
      return;
    const t = this.getExistingItems().slice(), s = e.filter((i) => t.indexOf(i) < 0);
    Hu(t, s, this.insertIndex), this.updateItems(t);
  }
  addItem(e) {
    this.insertIndex = this.getExistingItems().length, this.addItems([e]), this.refreshGui();
  }
  rearrangeItems(e, t) {
    let s;
    return t ? s = this.getExistingItems().filter((i) => e.indexOf(i) === -1) : s = this.getNonGhostItems().slice(), Hu(s, e, this.insertIndex), Xe(s, this.getExistingItems()) ? !1 : (this.updateItems(s), !0);
  }
  refreshGui() {
    let e = 0;
    this.horizontal || (e = this.ePillDropList.scrollTop);
    const t = this.resizeEnabled, s = this.getFocusedItem(), { eGridDiv: i } = this.beans, r = ua();
    let n = null;
    r && (n = ze(this.beans, i) ?? ze(this.beans, i, !1, !0)), this.toggleResizable(!1), this.destroyGui(), this.addIconAndTitleToGui(), this.addEmptyMessageToGui(), this.addItemsToGui(), e !== 0 && (this.ePillDropList.scrollTop = e), t && this.toggleResizable(t), r && this.restoreFocus(s, n);
  }
  getFocusedItem() {
    const e = this.getGui(), t = Q(this.beans);
    return e.contains(t) ? Array.from(e.querySelectorAll(".ag-column-drop-cell")).indexOf(t) : -1;
  }
  focusItemAtIndex(e) {
    const t = this.getGui(), i = Array.from(t.querySelectorAll(".ag-column-drop-cell"))[e];
    i && i.focus({ preventScroll: !0 });
  }
  restoreFocus(e, t) {
    const s = this.getGui(), i = Array.from(s.querySelectorAll(".ag-column-drop-cell"));
    if (e === -1)
      return;
    i.length === 0 && t.focus();
    const r = Math.min(i.length - 1, e), n = i[r];
    n && n.focus();
  }
  focusList(e) {
    const t = e ? this.childPillComponents.length - 1 : 0;
    this.restoreFocus(t, this.getFocusableElement());
  }
  getNonGhostItems() {
    const e = this.getExistingItems();
    return this.isPotentialDndItems() ? e.filter((t) => !this.potentialDndItems.includes(t)) : e;
  }
  addItemsToGui() {
    const t = this.getNonGhostItems().map((s) => this.createItemComponent(s, !1));
    if (this.isPotentialDndItems()) {
      const s = this.potentialDndItems.map((i) => this.createItemComponent(i, !0));
      this.insertIndex >= t.length ? t.push(...s) : t.splice(this.insertIndex, 0, ...s);
    }
    this.appendChild(this.ePillDropList), t.forEach((s, i) => {
      i > 0 && this.addArrow(this.ePillDropList), this.ePillDropList.appendChild(s.getGui());
    }), this.addAriaLabelsToComponents();
  }
  addAriaLabelsToComponents() {
    const { childPillComponents: e, ePillDropList: t } = this, s = e.length;
    Ye(t, s === 0 ? "presentation" : "listbox");
    for (let i = 0; i < s; i++) {
      const n = e[i].getGui();
      ea(n, i + 1), Jo(n, s);
    }
  }
  createItemComponent(e, t) {
    const s = this.createPillComponent(e, this.dropTarget, t, this.horizontal);
    return s.addEventListener("columnRemove", this.removeItems.bind(this, [e])), this.createBean(s), this.guiDestroyFunctions.push(() => this.destroyBean(s)), t || this.childPillComponents.push(s), s;
  }
  addIconAndTitleToGui() {
    const { title: e, icon: t } = this.params;
    if (!e || !t)
      return;
    const s = K({ tag: "div" });
    if (Ic(s, !0), this.addElementClasses(s, "title-bar"), this.addElementClasses(t, "icon"), this.toggleCss("ag-column-drop-empty", this.isExistingItemsEmpty()), s.appendChild(t), !this.horizontal) {
      const i = K({ tag: "span" });
      this.addElementClasses(i, "title"), i.textContent = e, s.appendChild(i);
    }
    this.appendChild(s);
  }
  isExistingItemsEmpty() {
    return this.getExistingItems().length === 0;
  }
  addEmptyMessageToGui() {
    const { emptyMessage: e } = this.params;
    if (!e || !this.isExistingItemsEmpty() || this.isPotentialDndItems())
      return;
    const t = K({ tag: "span" });
    t.textContent = e, this.addElementClasses(t, "empty-message"), this.ePillDropList.appendChild(t);
  }
  addArrow(e) {
    if (this.horizontal) {
      const t = this.gos.get("enableRtl"), s = N(t ? "panelDelimiterRtl" : "panelDelimiter", this.beans);
      this.addElementClasses(s, "cell-separator"), e.appendChild(s);
    }
  }
}, FB = {
  tag: "span",
  role: "option",
  children: [
    {
      tag: "span",
      ref: "eDragHandle",
      cls: "ag-drag-handle ag-column-drop-cell-drag-handle",
      role: "presentation"
    },
    { tag: "span", ref: "eText", cls: "ag-column-drop-cell-text", attrs: { "aria-hidden": "true" } },
    { tag: "span", ref: "eButton", cls: "ag-column-drop-cell-button", role: "presentation" }
  ]
}, GC = class extends D {
  constructor(e, t, s, i, r) {
    super(), this.dragSourceDropTarget = e, this.ghost = t, this.horizontal = s, this.template = i, this.agComponents = r, this.eText = x, this.eDragHandle = x, this.eButton = x;
  }
  postConstruct() {
    this.setTemplate(this.template ?? FB, this.agComponents);
    const e = this.getGui(), { beans: t, eDragHandle: s, eText: i, eButton: r } = this;
    this.addElementClasses(e), this.addElementClasses(s, "drag-handle"), this.addElementClasses(i, "text"), this.addElementClasses(r, "button"), s.appendChild(N("columnDrag", t)), r.appendChild(N("cancel", t)), this.tooltipFeature = this.createOptionalManagedBean(
      t.registry.createDynamicBean("tooltipFeature", !1, {
        getGui: () => this.getGui()
      })
    ), this.setupComponents(), !this.ghost && this.isDraggable() && this.addDragSource(), this.setupAria(), this.setupTooltip(), this.activateTabIndex(), this.refreshDraggable();
  }
  isDraggable() {
    return !0;
  }
  refreshDraggable() {
    this.eDragHandle.classList.toggle("ag-column-select-column-readonly", !this.isDraggable());
  }
  setupAria() {
    const e = this.getLocaleTextFunc(), t = [this.getAriaDisplayName()];
    this.addAdditionalAriaInstructions(t, e), re(this.getGui(), t.join(". "));
  }
  addAdditionalAriaInstructions(e, t) {
    if (this.isRemovable()) {
      const s = t("ariaDropZoneColumnComponentDescription", "Press DELETE to remove");
      e.push(s);
    }
  }
  setupTooltip() {
    const e = () => {
      var t;
      return (t = this.tooltipFeature) == null ? void 0 : t.setTooltipAndRefresh(this.getTooltip());
    };
    e(), this.addManagedEventListeners({ newColumnsLoaded: e });
  }
  getDragSourceId() {
  }
  getDefaultIconName() {
    return "notAllowed";
  }
  addDragSource() {
    const {
      beans: { dragAndDrop: e },
      eDragHandle: t
    } = this, s = this.createGetDragItem(), i = this.getDefaultIconName(), r = {
      type: this.getDragSourceType(),
      sourceId: this.getDragSourceId(),
      eElement: t,
      getDefaultIconName: () => i,
      getDragItem: s,
      dragItemName: this.getDisplayName()
    };
    e == null || e.addDragSource(r, !0), this.addDestroyFunc(() => e == null ? void 0 : e.removeDragSource(r));
  }
  setupComponents() {
    this.eText.textContent = this.getDisplayValue(), this.setupRemove(), this.ghost && this.addCss("ag-column-drop-cell-ghost");
  }
  isRemovable() {
    return !0;
  }
  refreshRemove() {
    O(this.eButton, this.isRemovable());
  }
  setupRemove() {
    this.refreshRemove();
    const e = { type: "columnRemove" };
    this.addGuiEventListener("keydown", (s) => this.onKeyDown(s)), this.addManagedElementListeners(this.eButton, {
      click: (s) => {
        this.dispatchLocalEvent(e), s.stopPropagation();
      }
    });
    const t = new ms(this.eButton);
    this.addManagedListeners(t, {
      tap: () => this.dispatchLocalEvent(e)
    }), this.addDestroyFunc(t.destroy.bind(t));
  }
  onKeyDown(e) {
    e.key === S.DELETE && this.isRemovable() && (e.preventDefault(), this.dispatchLocalEvent({ type: "columnRemove" }));
  }
  getDisplayValue() {
    return this.getDisplayName();
  }
  addElementClasses(e, t) {
    t = t ? `-${t}` : "";
    const s = this.horizontal ? "horizontal" : "vertical";
    e.classList.add(`ag-column-drop-cell${t}`, `ag-column-drop-${s}-cell${t}`);
  }
  destroy() {
    super.destroy(), this.dragSourceDropTarget = null;
  }
}, RB = class extends GC {
  constructor(e, t, s, i, r) {
    super(t, s, r), this.column = e, this.dropZonePurpose = i, this.eSortIndicator = x, this.popupShowing = !1;
  }
  postConstruct() {
    const { sortSvc: e, colNames: t } = this.beans;
    this.template = {
      tag: "span",
      role: "option",
      children: [
        {
          tag: "span",
          ref: "eDragHandle",
          cls: "ag-drag-handle ag-column-drop-cell-drag-handle",
          role: "presentation"
        },
        { tag: "span", ref: "eText", cls: "ag-column-drop-cell-text", attrs: { "aria-hidden": "true" } },
        e ? { tag: "ag-sort-indicator", ref: "eSortIndicator" } : void 0,
        { tag: "span", ref: "eButton", cls: "ag-column-drop-cell-button", role: "presentation" }
      ]
    }, e && (this.agComponents = [e.getSortIndicatorSelector()]), this.displayName = t.getDisplayNameForColumn(this.column, "columnDrop"), super.postConstruct(), e && (this.setupSort(), this.addManagedEventListeners({
      sortChanged: () => {
        this.setupAria();
      }
    })), this.isGroupingZone() && this.addManagedPropertyListener("groupLockGroupColumns", () => {
      this.refreshRemove(), this.refreshDraggable(), this.setupAria();
    });
  }
  getItem() {
    return this.column;
  }
  getDisplayName() {
    return this.displayName;
  }
  getTooltip() {
    return this.column.getColDef().headerTooltip;
  }
  addAdditionalAriaInstructions(e, t) {
    const s = this.gos.get("rowGroupPanelSuppressSort"), i = this.gos.get("functionsReadOnly");
    if (this.isAggregationZone() && !i) {
      const r = t(
        "ariaDropZoneColumnValueItemDescription",
        "Press ENTER to change the aggregation type"
      );
      e.push(r);
    }
    if (this.isGroupingZone() && this.column.isSortable() && !s) {
      const r = t("ariaDropZoneColumnGroupItemDescription", "Press ENTER to sort");
      e.push(r);
    }
    super.addAdditionalAriaInstructions(e, t);
  }
  isMovable() {
    return this.isDraggable();
  }
  isDraggable() {
    return this.isReadOnly();
  }
  isRemovable() {
    return this.isReadOnly();
  }
  isReadOnly() {
    return !this.isGroupingAndLocked() && !this.gos.get("functionsReadOnly");
  }
  getAriaDisplayName() {
    const e = this.getLocaleTextFunc(), { name: t, aggFuncName: s } = this.getColumnAndAggFuncName(), i = e("ariaDropZoneColumnComponentAggFuncSeparator", " of "), r = {
      asc: e("ariaDropZoneColumnComponentSortAscending", "ascending"),
      desc: e("ariaDropZoneColumnComponentSortDescending", "descending")
    }, n = this.column.getSort(), o = this.gos.get("rowGroupPanelSuppressSort");
    return [
      s && `${s}${i}`,
      t,
      this.isGroupingZone() && !o && n && `, ${r[n]}`
    ].filter((a) => !!a).join("");
  }
  getColumnAndAggFuncName() {
    const e = this.displayName;
    let t = "";
    if (this.isAggregationZone()) {
      const s = this.column.getAggFunc(), i = typeof s == "string" ? s : "agg";
      t = this.getLocaleTextFunc()(i, i);
    }
    return { name: e, aggFuncName: t };
  }
  setupSort() {
    if (!(!this.column.isSortable() || !this.isGroupingZone()) && !this.gos.get("rowGroupPanelSuppressSort")) {
      this.eSortIndicator.setupSort(this.column, !0);
      const e = (t) => {
        t.preventDefault(), this.beans.sortSvc.progressSortFromEvent(this.column, t);
      };
      this.addGuiEventListener("click", e), this.addGuiEventListener("keydown", (t) => {
        t.key === S.ENTER && this.isGroupingZone() && e(t);
      });
    }
  }
  getDefaultIconName() {
    return "hide";
  }
  createGetDragItem() {
    const { column: e } = this;
    return () => {
      const t = {};
      return t[e.getId()] = e.isVisible(), {
        columns: [e],
        visibleState: t
      };
    };
  }
  setupComponents() {
    super.setupComponents(), this.isAggregationZone() && !this.gos.get("functionsReadOnly") && this.addGuiEventListener("click", this.onShowAggFuncSelection.bind(this));
  }
  onKeyDown(e) {
    super.onKeyDown(e), e.key === S.ENTER && this.isAggregationZone() && !this.gos.get("functionsReadOnly") && (e.preventDefault(), this.onShowAggFuncSelection());
  }
  getDisplayValue() {
    const { name: e, aggFuncName: t } = this.getColumnAndAggFuncName();
    return this.isAggregationZone() ? `${t}(${e})` : e;
  }
  onShowAggFuncSelection() {
    if (this.popupShowing)
      return;
    this.popupShowing = !0;
    const { aggFuncSvc: e, popupSvc: t } = this.beans, s = new yr({ cssIdentifier: "select-agg-func" }), i = e.getFuncNames(this.column), r = this.getGui(), n = s.getGui();
    s.setModel({
      getRow: function(u) {
        return i[u];
      },
      getRowCount: function() {
        return i.length;
      }
    }), this.createBean(s);
    const o = K({ tag: "div", cls: "ag-select-agg-func-popup" });
    o.style.top = "0px", o.style.left = "0px", o.appendChild(n), o.style.width = `${r.clientWidth}px`;
    const [a] = this.addManagedElementListeners(o, {
      focusout: (u) => {
        !o.contains(u.relatedTarget) && d && d.hideFunc();
      }
    }), l = (u) => {
      this.destroyBean(s), this.popupShowing = !1, (u == null ? void 0 : u.key) === "Escape" && r.focus(), a && a();
    }, c = this.getLocaleTextFunc(), d = t.addPopup({
      modal: !0,
      eChild: o,
      closeOnEsc: !0,
      closedCallback: l,
      ariaLabel: c("ariaLabelAggregationFunction", "Aggregation Function")
    });
    d && s.setComponentCreator(this.createAggSelect.bind(this, d.hideFunc)), s.addGuiEventListener("keydown", (u) => {
      if (u.key === S.ENTER || u.key === S.SPACE) {
        const g = s.getLastFocusedRow();
        if (g == null)
          return;
        const p = s.getComponentAt(g);
        p && p.selectItem();
      }
    }), t.positionPopupByComponent({
      type: "aggFuncSelect",
      eventSource: r,
      ePopup: o,
      keepWithinBounds: !0,
      column: this.column,
      position: "under"
    }), s.refresh();
    let h = i.findIndex((u) => u === this.column.getAggFunc());
    h === -1 && (h = 0), s.focusRow(h);
  }
  createAggSelect(e, t) {
    const s = () => {
      var a, l;
      e(), this.getGui().focus(), (l = (a = this.beans.valueColsSvc) == null ? void 0 : a.setColumnAggFunc) == null || l.call(a, this.column, t, "toolPanelDragAndDrop");
    }, i = this.getLocaleTextFunc(), r = t.toString(), n = i(r, r);
    return new PB(s, n);
  }
  isGroupingAndLocked() {
    return this.isGroupingZone() && un(this.column, this.beans);
  }
  isAggregationZone() {
    return this.dropZonePurpose === "aggregation";
  }
  isGroupingZone() {
    return this.dropZonePurpose === "rowGroup";
  }
  getDragSourceType() {
    return zt.ToolPanel;
  }
  destroy() {
    super.destroy(), this.column = null;
  }
}, PB = class extends D {
  constructor(e, t) {
    super({ tag: "div", cls: "ag-select-agg-func-item", children: t }), this.selectItem = e, this.addGuiEventListener("click", this.selectItem);
  }
}, $d = class extends kC {
  constructor(e, t) {
    super(e), this.dropZonePurpose = t, this.addElementClasses(this.getGui(), this.dropZonePurpose.toLowerCase());
  }
  init(e) {
    super.init(e), this.addManagedEventListeners({ newColumnsLoaded: this.refreshGui.bind(this) }), this.addManagedPropertyListeners(
      ["functionsReadOnly", "rowGroupPanelSuppressSort", "groupLockGroupColumns"],
      this.refreshGui.bind(this)
    );
  }
  getItems(e) {
    return e.columns ?? [];
  }
  isInterestedIn(e) {
    return e === zt.HeaderCell || e === zt.ToolPanel;
  }
  minimumAllowedNewInsertIndex() {
    const { gos: e, rowGroupColsSvc: t } = this.beans, s = e.get("groupLockGroupColumns"), i = (t == null ? void 0 : t.columns.length) ?? 0;
    return s === -1 ? i : Math.min(s, i);
  }
  showOrHideColumnOnExit(e) {
    return this.isRowGroupPanel() && tp(this.gos, !0) && !e.fromNudge;
  }
  handleDragEnterEnd(e) {
    if (this.showOrHideColumnOnExit(e)) {
      const i = e.dragSource.getDragItem().columns;
      this.setColumnsVisible(i, !1, "uiColumnDragged");
    }
  }
  handleDragLeaveEnd(e) {
    if (this.showOrHideColumnOnExit(e)) {
      const s = e.dragSource.getDragItem();
      this.setColumnsVisible(s.columns, !0, "uiColumnDragged");
    }
  }
  setColumnsVisible(e, t, s) {
    if (e) {
      const i = e.filter((r) => !r.getColDef().lockVisible);
      this.beans.colModel.setColsVisible(i, t, s);
    }
  }
  isRowGroupPanel() {
    return this.dropZonePurpose === "rowGroup";
  }
  createPillComponent(e, t, s, i) {
    return new RB(e, t, s, this.dropZonePurpose, i);
  }
}, OC = class extends $d {
  constructor(e) {
    super(e, "pivot");
  }
  postConstruct() {
    const e = this.getLocaleTextFunc(), t = e("pivotColumnsEmptyMessage", "Drag here to set column labels"), s = e("pivots", "Column Labels");
    super.init({
      icon: N("pivotPanel", this.beans, null),
      emptyMessage: t,
      title: s
    }), this.addManagedEventListeners({
      newColumnsLoaded: this.refresh.bind(this),
      columnPivotChanged: this.refresh.bind(this),
      columnPivotModeChanged: this.checkVisibility.bind(this)
    }), this.refresh();
  }
  getAriaLabel() {
    return this.getLocaleTextFunc()("ariaPivotDropZonePanelLabel", "Column Labels");
  }
  refresh() {
    this.checkVisibility(), this.refreshGui();
  }
  checkVisibility() {
    const e = this.beans.colModel, t = e.isPivotMode();
    if (this.horizontal)
      switch (this.gos.get("pivotPanelShow")) {
        case "always":
          this.setDisplayed(t);
          break;
        case "onlyWhenPivoting": {
          const s = e.isPivotActive();
          this.setDisplayed(t && s);
          break;
        }
        default:
          this.setDisplayed(!1);
          break;
      }
    else
      this.setDisplayed(t);
  }
  isItemDroppable(e, t) {
    return this.gos.get("functionsReadOnly") || !e.isPrimary() ? !1 : e.isAllowPivot() && (!e.isPivotActive() || this.isSourceEventFromTarget(t));
  }
  updateItems(e) {
    var t;
    (t = this.beans.pivotColsSvc) == null || t.setColumns(e, "toolPanelUi");
  }
  getIconName() {
    return this.isPotentialDndItems() ? "pivot" : "notAllowed";
  }
  getExistingItems() {
    var e;
    return ((e = this.beans.pivotColsSvc) == null ? void 0 : e.columns) ?? [];
  }
}, VC = class extends $d {
  constructor(e) {
    super(e, "rowGroup");
  }
  postConstruct() {
    const e = this.getLocaleTextFunc(), t = e("rowGroupColumnsEmptyMessage", "Drag here to set row groups"), s = e("groups", "Row Groups");
    super.init({
      icon: N("rowGroupPanel", this.beans, null),
      emptyMessage: t,
      title: s
    }), this.addManagedEventListeners({ columnRowGroupChanged: this.refreshGui.bind(this) });
  }
  getAriaLabel() {
    return this.getLocaleTextFunc()("ariaRowGroupDropZonePanelLabel", "Row Groups");
  }
  isItemDroppable(e, t) {
    return this.gos.get("functionsReadOnly") || !e.isPrimary() || e.colDef.showRowGroup ? !1 : e.isAllowRowGroup() && (!e.isRowGroupActive() || this.isSourceEventFromTarget(t));
  }
  updateItems(e) {
    var t;
    (t = this.beans.rowGroupColsSvc) == null || t.setColumns(e, "toolPanelUi");
  }
  getIconName() {
    return this.isPotentialDndItems() ? "group" : "notAllowed";
  }
  getExistingItems() {
    var e;
    return ((e = this.beans.rowGroupColsSvc) == null ? void 0 : e.columns) ?? [];
  }
}, EB = class extends $d {
  constructor(e) {
    super(e, "aggregation");
  }
  postConstruct() {
    const e = this.getLocaleTextFunc(), t = e("valueColumnsEmptyMessage", "Drag here to aggregate"), s = e("values", "Values");
    super.init({
      icon: N("valuePanel", this.beans, null),
      emptyMessage: t,
      title: s
    }), this.addManagedEventListeners({ columnValueChanged: this.refreshGui.bind(this) });
  }
  getAriaLabel() {
    return this.getLocaleTextFunc()("ariaValuesDropZonePanelLabel", "Values");
  }
  getIconName() {
    return this.isPotentialDndItems() ? "aggregate" : "notAllowed";
  }
  isItemDroppable(e, t) {
    return this.gos.get("functionsReadOnly") || !e.isPrimary() ? !1 : e.isAllowValue() && (!e.isValueActive() || this.isSourceEventFromTarget(t));
  }
  updateItems(e) {
    var t;
    (t = this.beans.valueColsSvc) == null || t.setColumns(e, "toolPanelUi");
  }
  getExistingItems() {
    var e;
    return ((e = this.beans.valueColsSvc) == null ? void 0 : e.columns) ?? [];
  }
}, TB = {
  tag: "div",
  cls: "ag-pivot-mode-panel",
  children: [
    {
      tag: "ag-toggle-button",
      ref: "cbPivotMode",
      cls: "ag-pivot-mode-select"
    }
  ]
}, MB = class extends D {
  constructor() {
    super(...arguments), this.cbPivotMode = x;
  }
  postConstruct() {
    this.setTemplate(TB, [dy]);
    const e = this.cbPivotMode, { colModel: t, ctrlsSvc: s, gos: i } = this.beans;
    e.setValue(t.isPivotMode());
    const r = this.getLocaleTextFunc();
    e.setLabel(r("pivotMode", "Pivot Mode"));
    const n = () => {
      const a = !!e.getValue();
      a !== t.isPivotMode() && (i.updateGridOptions({ options: { pivotMode: a }, source: "toolPanelUi" }), s.getHeaderRowContainerCtrls().forEach((l) => l.refresh()));
    }, o = () => {
      const a = t.isPivotMode();
      e.setValue(a);
    };
    this.addManagedListeners(e, { fieldValueChanged: n }), this.addManagedEventListeners({
      newColumnsLoaded: o,
      columnPivotModeChanged: o
    });
  }
}, DB = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colToolPanelFactory";
  }
  setPanelVisible(e, t, s) {
    return e ? e.setDisplayed(t) : t && (e = s()), e;
  }
  createRowGroupPanel(e, t) {
    return this.createPanel(e, t, new VC(!1));
  }
  createValuesPanel(e, t) {
    return this.createPanel(e, t, new EB(!1));
  }
  createPivotPanel(e, t) {
    return this.createPanel(e, t, new OC(!1));
  }
  createPivotModePanel(e, t, s) {
    return this.createPanel(e, t, new MB(), s);
  }
  createPanel(e, t, s, i) {
    return s = e.createBean(s), t.push(() => e.destroyBean(s)), i ? e.prependChild(s) : e.appendChild(s), s;
  }
}, AB = {
  moduleName: "ColumnsToolPanel",
  version: Y,
  beans: [DB],
  userComponents: { agColumnsToolPanel: yB },
  icons: {
    ensureColumnVisible: "column-arrow",
    // column tool panel tab
    columnsToolPanel: "columns",
    // "Group by {column-name}" item in column header menu
    menuAddRowGroup: "group",
    // "Un-Group by {column-name}" item in column header menu
    menuRemoveRowGroup: "group",
    // identifies the pivot drop zone
    pivotPanel: "pivot",
    // "Row groups" drop zone in column tool panel
    rowGroupPanel: "group",
    // columns tool panel Values drop zone
    valuePanel: "aggregation",
    // column tool panel column group contracted (click to expand)
    columnSelectClosed: "tree-closed",
    // column tool panel column group expanded (click to contract)
    columnSelectOpen: "tree-open",
    // column tool panel header expand/collapse all button, shown when some children are expanded and
    //     others are collapsed
    columnSelectIndeterminate: "tree-indeterminate"
  },
  dependsOn: [
    ie,
    Da,
    xd,
    Hi,
    Is,
    Aa
  ]
}, IB = class extends R {
  constructor() {
    super(...arguments), this.beanName = "chartMenuItemMapper";
  }
  getChartItems(e) {
    var c, d;
    const t = this.beans, s = t.chartSvc, i = e === "pivotChart";
    if (!s)
      return null;
    const r = this.getLocaleTextFunc.bind(this), n = i ? new LB(t, s, r) : new kB(t, s, r), o = s.isEnterprise();
    let a = n.getMenuItem();
    if (a && a.subMenu && !o) {
      const h = (u) => {
        var g;
        return {
          ...u,
          subMenu: (g = u.subMenu) == null ? void 0 : g.filter((p) => !p._enterprise).map((p) => h(p))
        };
      };
      a = h(a);
    }
    const l = (d = (c = this.gos.get("chartToolPanelsDef")) == null ? void 0 : c.settingsPanel) == null ? void 0 : d.chartGroupsDef;
    return l && (a = this.filterAndOrderChartMenu(
      a,
      l,
      n.getConfigLookup()
    )), this.cleanInternals(a);
  }
  // Remove our internal _key and _enterprise properties so this does not leak out of the class on the menu items.
  cleanInternals(e) {
    if (!e)
      return e;
    const t = (s) => {
      var i;
      return s == null || delete s._key, s == null || delete s._enterprise, (i = s == null ? void 0 : s.subMenu) == null || i.forEach((r) => t(r)), s;
    };
    return t(e);
  }
  buildLookup(e) {
    const t = {}, s = (i) => {
      t[i._key] = i, i.subMenu && i.subMenu.forEach((r) => s(r));
    };
    return s(e), t;
  }
  /**
   * Make the MenuItem match the charts provided and their ordering on the ChartGroupsDef config object as provided by the user.
   */
  filterAndOrderChartMenu(e, t, s) {
    var n, o, a;
    const i = this.buildLookup(e), r = { ...e, subMenu: [] };
    for (const l of Object.keys(t)) {
      const c = t[l], d = s[l];
      if (d === null)
        continue;
      if (d == null) {
        F(173, { group: l });
        continue;
      }
      const h = i[d._key];
      if (h)
        if (h.subMenu) {
          const u = c.map((g) => {
            const p = d[g];
            if (p == null) {
              F(174, { group: l, chartType: g });
              return;
            }
            return i[p];
          }).filter((g) => g !== void 0);
          u.length > 0 && (h.subMenu = u, (n = r.subMenu) == null || n.push(h));
        } else
          (o = r.subMenu) == null || o.push(h);
    }
    return ((a = r.subMenu) == null ? void 0 : a.length) == 0 ? null : r;
  }
}, LB = class {
  constructor(e, t, s) {
    this.beans = e, this.chartSvc = t, this.getLocaleTextFunc = s;
  }
  getMenuItem() {
    const e = this.getLocaleTextFunc(), t = (s, i, r, n, o = !1) => ({
      // will have a LRM character appended to ensure correct display in RTL languages
      name: e(s, i + "‎"),
      action: () => this.chartSvc.createPivotChart({ chartType: r }),
      _key: n,
      _enterprise: o
    });
    return {
      name: e("pivotChart", "Pivot Chart"),
      _key: "pivotChart",
      subMenu: [
        {
          _key: "pivotColumnChart",
          name: e("columnChart", "Column"),
          subMenu: [
            t("groupedColumn", "Grouped", "groupedColumn", "pivotGroupedColumn"),
            t("stackedColumn", "Stacked", "stackedColumn", "pivotStackedColumn"),
            t("normalizedColumn", "100% Stacked", "normalizedColumn", "pivotNormalizedColumn")
          ]
        },
        {
          _key: "pivotBarChart",
          name: e("barChart", "Bar"),
          subMenu: [
            t("groupedBar", "Grouped", "groupedBar", "pivotGroupedBar"),
            t("stackedBar", "Stacked", "stackedBar", "pivotStackedBar"),
            t("normalizedBar", "100% Stacked", "normalizedBar", "pivotNormalizedBar")
          ]
        },
        {
          _key: "pivotPieChart",
          name: e("pieChart", "Pie"),
          subMenu: [
            t("pie", "Pie", "pie", "pivotPie"),
            t("donut", "Donut", "donut", "pivotDonut")
          ]
        },
        {
          _key: "pivotLineChart",
          name: e("lineChart", "Line"),
          subMenu: [
            t("lineChart", "Line", "line", "pivotLineChart"),
            t("stackedLine", "Stacked", "stackedLine", "pivotStackedLine"),
            t("normalizedLine", "100% Stacked", "normalizedLine", "pivotNormalizedLine")
          ]
        },
        {
          _key: "pivotAreaChart",
          name: e("areaChart", "Area"),
          subMenu: [
            t("areaChart", "Area", "area", "pivotArea"),
            t("stackedArea", "Stacked", "stackedArea", "pivotStackedArea"),
            t("normalizedArea", "100% Stacked", "normalizedArea", "pivotNormalizedArea")
          ]
        },
        {
          _key: "pivotXYChart",
          name: e("xyChart", "X Y (Scatter)"),
          subMenu: [
            t("scatter", "Scatter", "scatter", "pivotScatter"),
            t("bubble", "Bubble", "bubble", "pivotBubble")
          ]
        },
        {
          _key: "pivotStatisticalChart",
          _enterprise: !1,
          // histogram chart is available in both community and enterprise distributions
          name: e("statisticalChart", "Statistical"),
          subMenu: [t("histogramChart", "Histogram", "histogram", "pivotHistogram", !1)]
        },
        {
          _key: "pivotHierarchicalChart",
          _enterprise: !0,
          name: e("hierarchicalChart", "Hierarchical"),
          subMenu: [
            t("treemapChart", "Treemap", "treemap", "pivotTreemap", !0),
            t("sunburstChart", "Sunburst", "sunburst", "pivotSunburst", !0)
          ]
        },
        {
          _key: "pivotFunnel",
          name: e("funnel", "Funnel"),
          subMenu: [
            t("funnel", "Funnel", "funnel", "pivotFunnel"),
            t("coneFunnel", "Cone Funnel", "coneFunnel", "pivotConeFunnel"),
            t("pyramid", "Pyramid", "pyramid", "pivotPyramid")
          ]
        },
        {
          _key: "pivotCombinationChart",
          name: e("combinationChart", "Combination"),
          subMenu: [
            t("columnLineCombo", "Column & Line", "columnLineCombo", "pivotColumnLineCombo"),
            t("AreaColumnCombo", "Area & Column", "areaColumnCombo", "pivotAreaColumnCombo")
          ]
        }
      ],
      icon: N("chart", this.beans, void 0)
    };
  }
  getConfigLookup() {
    return {
      columnGroup: {
        _key: "pivotColumnChart",
        column: "pivotGroupedColumn",
        stackedColumn: "pivotStackedColumn",
        normalizedColumn: "pivotNormalizedColumn"
      },
      barGroup: {
        _key: "pivotBarChart",
        bar: "pivotGroupedBar",
        stackedBar: "pivotStackedBar",
        normalizedBar: "pivotNormalizedBar"
      },
      pieGroup: {
        _key: "pivotPieChart",
        pie: "pivotPie",
        donut: "pivotDonut",
        doughnut: "pivotDonut"
      },
      lineGroup: {
        _key: "pivotLineChart",
        line: "pivotLineChart",
        stackedLine: "pivotStackedLine",
        normalizedLine: "pivotNormalizedLine"
      },
      areaGroup: {
        _key: "pivotAreaChart",
        area: "pivotArea",
        stackedArea: "pivotStackedArea",
        normalizedArea: "pivotNormalizedArea"
      },
      scatterGroup: {
        _key: "pivotXYChart",
        bubble: "pivotBubble",
        scatter: "pivotScatter"
      },
      combinationGroup: {
        _key: "pivotCombinationChart",
        columnLineCombo: "pivotColumnLineCombo",
        areaColumnCombo: "pivotAreaColumnCombo",
        customCombo: null
        // Not currently supported
      },
      hierarchicalGroup: {
        _key: "pivotHierarchicalChart",
        treemap: "pivotTreemap",
        sunburst: "pivotSunburst"
      },
      statisticalGroup: {
        _key: "pivotStatisticalChart",
        histogram: "pivotHistogram",
        // Some statistical charts do not currently support pivot mode
        rangeBar: null,
        rangeArea: null,
        boxPlot: null
      },
      funnelGroup: {
        _key: "pivotFunnel",
        funnel: "pivotFunnel",
        coneFunnel: "pivotConeFunnel",
        pyramid: "pivotPyramid"
      },
      // Polar charts do not support pivot mode
      polarGroup: null,
      // Specialized charts do not currently support pivot mode
      specializedGroup: null
    };
  }
}, kB = class {
  constructor(e, t, s) {
    this.beans = e, this.chartSvc = t, this.getLocaleTextFunc = s;
  }
  getMenuItem() {
    const e = this.getLocaleTextFunc(), t = (s, i, r, n, o = !1) => ({
      name: e(s, i),
      action: () => this.chartSvc.createChartFromCurrentRange(r),
      _key: n,
      _enterprise: o
    });
    return {
      name: e("chartRange", "Chart Range"),
      _key: "chartRange",
      subMenu: [
        {
          name: e("columnChart", "Column"),
          subMenu: [
            t("groupedColumn", "Grouped", "groupedColumn", "rangeGroupedColumn"),
            t("stackedColumn", "Stacked", "stackedColumn", "rangeStackedColumn"),
            t("normalizedColumn", "100% Stacked", "normalizedColumn", "rangeNormalizedColumn")
          ],
          _key: "rangeColumnChart"
        },
        {
          name: e("barChart", "Bar"),
          subMenu: [
            t("groupedBar", "Grouped", "groupedBar", "rangeGroupedBar"),
            t("stackedBar", "Stacked", "stackedBar", "rangeStackedBar"),
            t("normalizedBar", "100% Stacked", "normalizedBar", "rangeNormalizedBar")
          ],
          _key: "rangeBarChart"
        },
        {
          name: e("pieChart", "Pie"),
          subMenu: [
            t("pie", "Pie", "pie", "rangePie"),
            t("donut", "Donut", "donut", "rangeDonut")
          ],
          _key: "rangePieChart"
        },
        {
          name: e("lineChart", "Line"),
          subMenu: [
            t("lineChart", "Line", "line", "rangeLineChart"),
            t("stackedLine", "Stacked", "stackedLine", "rangeStackedLine"),
            t("normalizedLine", "100% Stacked", "normalizedLine", "rangeNormalizedLine")
          ],
          _key: "rangeLineChart"
        },
        {
          name: e("areaChart", "Area"),
          subMenu: [
            t("areaChart", "Area", "area", "rangeArea"),
            t("stackedArea", "Stacked", "stackedArea", "rangeStackedArea"),
            t("normalizedArea", "100% Stacked", "normalizedArea", "rangeNormalizedArea")
          ],
          _key: "rangeAreaChart"
        },
        {
          name: e("xyChart", "X Y (Scatter)"),
          subMenu: [
            t("scatter", "Scatter", "scatter", "rangeScatter"),
            t("bubble", "Bubble", "bubble", "rangeBubble")
          ],
          _key: "rangeXYChart"
        },
        {
          name: e("polarChart", "Polar"),
          subMenu: [
            t("radarLine", "Radar Line", "radarLine", "rangeRadarLine"),
            t("radarArea", "Radar Area", "radarArea", "rangeRadarArea"),
            t("nightingale", "Nightingale", "nightingale", "rangeNightingale"),
            t("radialColumn", "Radial Column", "radialColumn", "rangeRadialColumn"),
            t("radialBar", "Radial Bar", "radialBar", "rangeRadialBar")
          ],
          _key: "rangePolarChart",
          _enterprise: !0
        },
        {
          name: e("statisticalChart", "Statistical"),
          subMenu: [
            t("boxPlot", "Box Plot", "boxPlot", "rangeBoxPlot", !0),
            t("histogramChart", "Histogram", "histogram", "rangeHistogram", !1),
            t("rangeBar", "Range Bar", "rangeBar", "rangeRangeBar", !0),
            t("rangeArea", "Range Area", "rangeArea", "rangeRangeArea", !0)
          ],
          _key: "rangeStatisticalChart",
          _enterprise: !1
          // histogram chart is available in both community and enterprise distributions
        },
        {
          name: e("hierarchicalChart", "Hierarchical"),
          subMenu: [
            t("treemap", "Treemap", "treemap", "rangeTreemap"),
            t("sunburst", "Sunburst", "sunburst", "rangeSunburst")
          ],
          _key: "rangeHierarchicalChart",
          _enterprise: !0
        },
        {
          name: e("specializedChart", "Specialized"),
          subMenu: [
            t("heatmap", "Heatmap", "heatmap", "rangeHeatmap"),
            t("waterfall", "Waterfall", "waterfall", "rangeWaterfall")
          ],
          _key: "rangeSpecializedChart",
          _enterprise: !0
        },
        {
          name: e("funnel", "Funnel"),
          subMenu: [
            t("funnel", "Funnel", "funnel", "rangeFunnel"),
            t("coneFunnel", "Cone Funnel", "coneFunnel", "rangeConeFunnel"),
            t("pyramid", "Pyramid", "pyramid", "rangePyramid")
          ],
          _key: "rangeFunnel",
          _enterprise: !0
        },
        {
          name: e("combinationChart", "Combination"),
          subMenu: [
            t("columnLineCombo", "Column & Line", "columnLineCombo", "rangeColumnLineCombo"),
            t("AreaColumnCombo", "Area & Column", "areaColumnCombo", "rangeAreaColumnCombo")
          ],
          _key: "rangeCombinationChart"
        }
      ],
      icon: N("chart", this.beans, void 0)
    };
  }
  getConfigLookup() {
    return {
      columnGroup: {
        _key: "rangeColumnChart",
        column: "rangeGroupedColumn",
        stackedColumn: "rangeStackedColumn",
        normalizedColumn: "rangeNormalizedColumn"
      },
      barGroup: {
        _key: "rangeBarChart",
        bar: "rangeGroupedBar",
        stackedBar: "rangeStackedBar",
        normalizedBar: "rangeNormalizedBar"
      },
      pieGroup: {
        _key: "rangePieChart",
        pie: "rangePie",
        donut: "rangeDonut",
        doughnut: "rangeDonut"
      },
      lineGroup: {
        _key: "rangeLineChart",
        line: "rangeLineChart",
        stackedLine: "rangeStackedLine",
        normalizedLine: "rangeNormalizedLine"
      },
      areaGroup: {
        _key: "rangeAreaChart",
        area: "rangeArea",
        stackedArea: "rangeStackedArea",
        normalizedArea: "rangeNormalizedArea"
      },
      scatterGroup: {
        _key: "rangeXYChart",
        bubble: "rangeBubble",
        scatter: "rangeScatter"
      },
      polarGroup: {
        _key: "rangePolarChart",
        radarLine: "rangeRadarLine",
        radarArea: "rangeRadarArea",
        nightingale: "rangeNightingale",
        radialColumn: "rangeRadialColumn",
        radialBar: "rangeRadialBar"
      },
      statisticalGroup: {
        _key: "rangeStatisticalChart",
        boxPlot: "rangeBoxPlot",
        histogram: "rangeHistogram",
        rangeBar: "rangeRangeBar",
        rangeArea: "rangeRangeArea"
      },
      hierarchicalGroup: {
        _key: "rangeHierarchicalChart",
        treemap: "rangeTreemap",
        sunburst: "rangeSunburst"
      },
      specializedGroup: {
        _key: "rangeSpecializedChart",
        heatmap: "rangeHeatmap",
        waterfall: "rangeWaterfall"
      },
      funnelGroup: {
        _key: "rangeFunnel",
        funnel: "rangeFunnel",
        coneFunnel: "rangeConeFunnel",
        pyramid: "rangePyramid"
      },
      combinationGroup: {
        _key: "rangeCombinationChart",
        columnLineCombo: "rangeColumnLineCombo",
        areaColumnCombo: "rangeAreaColumnCombo",
        customCombo: null
        // Not currently supported
      }
    };
  }
}, GB = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colChooserFactory";
  }
  createColumnSelectPanel(e, t, s, i) {
    const r = e.createManagedBean(new LC()), n = i ?? (t == null ? void 0 : t.getColDef().columnChooserParams) ?? {}, {
      contractColumnSelection: o,
      suppressColumnExpandAll: a,
      suppressColumnFilter: l,
      suppressColumnSelectAll: c,
      suppressSyncLayoutWithGrid: d,
      columnLayout: h
    } = n;
    return r.init(
      !!s,
      V(this.gos, {
        suppressColumnMove: !1,
        suppressValues: !1,
        suppressPivots: !1,
        suppressRowGroups: !1,
        suppressPivotMode: !1,
        contractColumnSelection: !!o,
        suppressColumnExpandAll: !!a,
        suppressColumnFilter: !!l,
        suppressColumnSelectAll: !!c,
        suppressSyncLayoutWithGrid: !!h || !!d,
        onStateUpdated: () => {
        }
      }),
      "columnMenu"
    ), h && r.setColumnLayout(h), r;
  }
  showColumnChooser({
    column: e,
    chooserParams: t,
    eventSource: s,
    headerPosition: i
  }) {
    this.hideActiveColumnChooser();
    const r = this.createColumnSelectPanel(this, e, !0, t), n = this.getLocaleTextFunc(), o = this.beans, { visibleCols: a, focusSvc: l, menuUtils: c } = o, d = a.allCols.indexOf(e), h = e ? l.focusedHeader ?? i ?? null : null;
    this.activeColumnChooserDialog = this.createBean(
      new Tn({
        title: n("chooseColumns", "Choose Columns"),
        component: r,
        width: 300,
        height: 300,
        resizable: !0,
        movable: !0,
        centered: !0,
        closable: !0,
        afterGuiAttached: () => {
          var u;
          (u = ze(o, r.getGui())) == null || u.focus({
            preventScroll: !0
          }), this.dispatchVisibleChangedEvent(!0, e);
        },
        closedCallback: (u) => {
          const g = this.activeColumnChooser.getGui();
          this.destroyBean(this.activeColumnChooser), this.activeColumnChooser = void 0, this.activeColumnChooserDialog = void 0, this.dispatchVisibleChangedEvent(!1, e), e && c.restoreFocusOnClose(
            { column: e, headerPosition: h, columnIndex: d, eventSource: s },
            g,
            u,
            !0
          );
        },
        postProcessPopupParams: {
          type: "columnChooser",
          column: e,
          eventSource: s
        }
      })
    ), this.activeColumnChooser = r;
  }
  hideActiveColumnChooser() {
    this.destroyBean(this.activeColumnChooserDialog);
  }
  dispatchVisibleChangedEvent(e, t) {
    this.eventSvc.dispatchEvent({
      type: "columnMenuVisibleChanged",
      visible: e,
      switchingTab: !1,
      key: "columnChooser",
      column: t ?? null
    });
  }
}, OB = {
  pinSubMenu: "PinnedColumn",
  pinLeft: "PinnedColumn",
  pinRight: "PinnedColumn",
  clearPinned: "PinnedColumn",
  pinRowSubMenu: "PinnedRow",
  pinBottom: "PinnedRow",
  pinTop: "PinnedRow",
  unpinRow: "PinnedRow",
  valueAggSubMenu: "SharedAggregation",
  autoSizeThis: "ColumnAutoSize",
  autoSizeAll: "ColumnAutoSize",
  rowGroup: "SharedRowGrouping",
  rowUnGroup: "SharedRowGrouping",
  resetColumns: "CommunityCore",
  expandAll: ["ClientSideRowModelHierarchy", "ServerSideRowModel"],
  contractAll: ["ClientSideRowModelHierarchy", "ServerSideRowModel"],
  copy: "Clipboard",
  copyWithHeaders: "Clipboard",
  copyWithGroupHeaders: "Clipboard",
  cut: "Clipboard",
  paste: "Clipboard",
  export: ["CsvExport", "ExcelExport"],
  csvExport: "CsvExport",
  excelExport: "ExcelExport",
  separator: "CommunityCore",
  pivotChart: "IntegratedCharts",
  chartRange: "IntegratedCharts",
  columnFilter: "ColumnFilter",
  columnChooser: "ColumnMenu",
  sortAscending: "Sort",
  sortDescending: "Sort",
  sortUnSort: "Sort"
};
function VB(e, t) {
  const s = OB[t];
  s && e.assertModuleRegistered(s, `menu item '${t}'`);
}
var li = "separator";
function BC(e, t) {
  if (e)
    for (let s = e.length - 2; s >= 0; s--) {
      const i = e[s] === t, r = e[s + 1] === t;
      i && r && e.splice(s + 1, 1);
    }
}
var BB = class extends R {
  constructor() {
    super(...arguments), this.beanName = "menuItemMapper";
  }
  mapWithStockItems(e, t, s, i, r) {
    if (!e)
      return [];
    const n = [], o = this.getLocaleTextFunc(), { beans: a, gos: l } = this, {
      pinnedCols: c,
      colAutosize: d,
      aggFuncSvc: h,
      rowGroupColsSvc: u,
      colNames: g,
      colModel: p,
      clipboardSvc: f,
      expansionSvc: m,
      focusSvc: C,
      csvCreator: v,
      excelCreator: w,
      menuSvc: b,
      colChooserFactory: y,
      sortSvc: P,
      chartMenuItemMapper: E,
      valueColsSvc: M,
      pinnedRowModel: T
    } = a, G = (I, L, $, z) => {
      var W;
      switch (VB(l, I), I) {
        case "pinSubMenu":
          return c && L ? {
            name: o("pinColumn", "Pin Column"),
            icon: N("menuPin", a, null),
            subMenu: ["clearPinned", "pinLeft", "pinRight"]
          } : null;
        case "pinLeft":
          return c && L ? {
            name: o("pinLeft", "Pin Left"),
            action: () => c.setColsPinned([L], "left", z),
            checked: !!L && L.isPinnedLeft()
          } : null;
        case "pinRight":
          return c && L ? {
            name: o("pinRight", "Pin Right"),
            action: () => c.setColsPinned([L], "right", z),
            checked: !!L && L.isPinnedRight()
          } : null;
        case "clearPinned":
          return c && L ? {
            name: o("noPin", "No Pin"),
            action: () => c.setColsPinned([L], null, z),
            checked: !!L && !L.isPinned()
          } : null;
        case "pinRowSubMenu": {
          const H = l.get("enableRowPinning"), J = [], le = (s == null ? void 0 : s.rowPinned) ?? ((W = s == null ? void 0 : s.pinnedSibling) == null ? void 0 : W.rowPinned);
          return le && J.push("unpinRow"), H && H !== "bottom" && le != "top" && J.push("pinTop"), H && H !== "top" && le != "bottom" && J.push("pinBottom"), T != null && T.isManual() ? {
            name: o("pinRow", "Pin Row"),
            icon: N("rowPin", a, L),
            subMenu: J
          } : null;
        }
        case "pinTop":
          return T != null && T.isManual() ? {
            name: o("pinTop", "Pin to Top"),
            icon: N("rowPinTop", a, L),
            action: ({ node: H, column: J }) => H && T.pinRow(H, "top", J)
          } : null;
        case "pinBottom":
          return T != null && T.isManual() ? {
            name: o("pinBottom", "Pin to Bottom"),
            icon: N("rowPinBottom", a, L),
            action: ({ node: H, column: J }) => H && T.pinRow(H, "bottom", J)
          } : null;
        case "unpinRow":
          return T != null && T.isManual() ? {
            name: o("unpinRow", "Unpin Row"),
            icon: N("rowUnpin", a, L),
            action: ({ node: H, column: J }) => H && T.pinRow(H, null, J)
          } : null;
        case "valueAggSubMenu":
          return h && M && (L != null && L.isPrimary() || L != null && L.getColDef().pivotValueColumn) ? {
            name: o("valueAggregation", "Value Aggregation"),
            icon: N("menuValue", a, null),
            subMenu: NB(L, h, M, o),
            disabled: l.get("functionsReadOnly")
          } : null;
        case "autoSizeThis":
          return d ? {
            name: o("autosizeThisColumn", "Autosize This Column"),
            action: () => d.autoSizeColumn(L, z, l.get("skipHeaderOnAutoSize"))
          } : null;
        case "autoSizeAll":
          return d ? {
            name: o("autosizeAllColumns", "Autosize All Columns"),
            action: () => d.autoSizeAllColumns({
              source: z,
              skipHeader: l.get("skipHeaderOnAutoSize")
            })
          } : null;
        case "rowGroup":
          return u ? {
            name: o("groupBy", "Group by") + " " + g.getDisplayNameForColumn(L, "header"),
            disabled: l.get("functionsReadOnly") || (L == null ? void 0 : L.isRowGroupActive()) || !(L != null && L.getColDef().enableRowGroup),
            action: () => u.addColumns([L], z),
            icon: N("menuAddRowGroup", a, null)
          } : null;
        case "rowUnGroup":
          if (u && l.isModuleRegistered("SharedRowGrouping")) {
            const H = L == null ? void 0 : L.getColDef().showRowGroup, J = l.get("groupLockGroupColumns");
            let le, fe, ve;
            if (H === !0)
              le = o("ungroupAll", "Un-Group All"), fe = l.get("functionsReadOnly") || J === -1 || J >= (u.columns.length ?? 0), ve = () => u.setColumns(u.columns.slice(0, J), z);
            else if (typeof H == "string") {
              const Ge = p.getColDefCol(H), Te = Ge != null ? g.getDisplayNameForColumn(Ge, "header") : H;
              le = o("ungroupBy", "Un-Group by") + " " + Te, fe = l.get("functionsReadOnly") || un(Ge, a), ve = () => {
                u.removeColumns([H], z);
              };
            } else
              le = o("ungroupBy", "Un-Group by") + " " + g.getDisplayNameForColumn(L, "header"), fe = l.get("functionsReadOnly") || !(L != null && L.isRowGroupActive()) || !(L != null && L.getColDef().enableRowGroup) || un(L, a), ve = () => u.removeColumns([L], z);
            return {
              name: le,
              disabled: fe,
              action: ve,
              icon: N("menuRemoveRowGroup", a, null)
            };
          } else
            return null;
        case "resetColumns":
          return {
            name: o("resetColumns", "Reset Columns"),
            action: () => bp(a, z)
          };
        case "expandAll":
          return m ? {
            name: o("expandAll", "Expand All Row Groups"),
            action: () => m.expandAll(!0)
          } : null;
        case "contractAll":
          return m ? {
            name: o("collapseAll", "Collapse All Row Groups"),
            action: () => m.expandAll(!1)
          } : null;
        case "copy":
          return f ? {
            name: o("copy", "Copy"),
            shortcut: o("ctrlC", "Ctrl+C"),
            icon: N("clipboardCopy", a, null),
            action: () => f.copyToClipboard()
          } : null;
        case "copyWithHeaders":
          return f ? {
            name: o("copyWithHeaders", "Copy with Headers"),
            // shortcut: localeTextFunc('ctrlC','Ctrl+C'),
            icon: N("clipboardCopy", a, null),
            action: () => f.copyToClipboard({ includeHeaders: !0 })
          } : null;
        case "copyWithGroupHeaders":
          return f ? {
            name: o("copyWithGroupHeaders", "Copy with Group Headers"),
            // shortcut: localeTextFunc('ctrlC','Ctrl+C'),
            icon: N("clipboardCopy", a, null),
            action: () => f.copyToClipboard({ includeHeaders: !0, includeGroupHeaders: !0 })
          } : null;
        case "cut":
          if (f) {
            const H = C.getFocusedCell(), J = H ? Ee(a, H) : null, le = J ? H == null ? void 0 : H.column.isCellEditable(J) : !1;
            return {
              name: o("cut", "Cut"),
              shortcut: o("ctrlX", "Ctrl+X"),
              icon: N("clipboardCut", a, null),
              disabled: !le || l.get("suppressCutToClipboard"),
              action: () => f.cutToClipboard(void 0, "contextMenu")
            };
          } else
            return null;
        case "paste":
          if (f) {
            const H = l.get("suppressClipboardApi") || l.get("suppressClipboardPaste") || !L || !s || !L.isCellEditable(s) || L.isSuppressPaste(s);
            return {
              name: o("paste", "Paste"),
              shortcut: o("ctrlV", "Ctrl+V"),
              icon: N("clipboardPaste", a, null),
              disabled: H,
              action: () => f.pasteFromClipboard()
            };
          } else
            return null;
        case "export": {
          const H = [];
          return !l.get("suppressCsvExport") && v && H.push("csvExport"), !l.get("suppressExcelExport") && w && H.push("excelExport"), H.length ? {
            name: o("export", "Export"),
            subMenu: H,
            icon: N("save", a, null)
          } : null;
        }
        case "csvExport":
          return v ? {
            name: o("csvExport", "CSV Export"),
            icon: N("csvExport", a, null),
            action: () => v.exportDataAsCsv()
          } : null;
        case "excelExport":
          return w ? {
            name: o("excelExport", "Excel Export"),
            icon: N("excelExport", a, null),
            action: () => w.exportDataAsExcel()
          } : null;
        case "separator":
          return I;
        case "pivotChart":
        case "chartRange":
          return E.getChartItems(I);
        case "columnFilter":
          return b && L ? {
            name: o("columnFilter", "Column Filter"),
            icon: N("filter", a, null),
            action: () => b.showFilterMenu({
              column: L,
              buttonElement: $(),
              containerType: "columnFilter",
              positionBy: "button"
            })
          } : null;
        case "columnChooser": {
          const H = C.focusedHeader;
          return y ? {
            name: o("columnChooser", "Choose Columns"),
            icon: N("columns", a, null),
            action: () => y.showColumnChooser({
              column: L,
              eventSource: $(),
              headerPosition: H
            })
          } : null;
        }
        case "sortAscending":
          return P ? {
            name: o("sortAscending", "Sort Ascending"),
            icon: N("sortAscending", a, null),
            action: () => P.setSortForColumn(L, "asc", !1, z)
          } : null;
        case "sortDescending":
          return P ? {
            name: o("sortDescending", "Sort Descending"),
            icon: N("sortDescending", a, null),
            action: () => P.setSortForColumn(L, "desc", !1, z)
          } : null;
        case "sortUnSort":
          return P ? {
            name: o("sortUnSort", "Clear Sort"),
            icon: N("sortUnSort", a, null),
            action: () => P.setSortForColumn(L, null, !1, z)
          } : null;
        default:
          return F(176, { key: I }), null;
      }
    };
    return e.forEach((I) => {
      let L;
      if (typeof I == "string" ? L = G(I, t, i, r) : L = { ...I }, !L)
        return;
      const $ = L, { subMenu: z } = $;
      z && z instanceof Array && ($.subMenu = this.mapWithStockItems(
        z,
        t,
        s,
        i,
        r
      )), L != null && n.push(L);
    }), BC(n, li), n;
  }
};
function NB(e, t, s, i) {
  let r;
  if (e.isPrimary())
    r = e;
  else {
    const o = e.getColDef().pivotValueColumn;
    r = A(o) ? o : void 0;
  }
  const n = [];
  if (r) {
    const o = r.isValueActive(), a = t.getFuncNames(r);
    n.push({
      name: i("noAggregation", "None"),
      action: () => {
        s.removeColumns([r], "contextMenu"), s.setColumnAggFunc(r, void 0, "contextMenu");
      },
      checked: !o
    }), a.forEach((l) => {
      n.push({
        name: i(l, t.getDefaultFuncLabel(l)),
        action: () => {
          s.setColumnAggFunc(r, l, "contextMenu"), s.addColumns([r], "contextMenu");
        },
        checked: o && r.getAggFunc() === l
      });
    });
  }
  return n;
}
var HB = class extends R {
  constructor() {
    super(...arguments), this.beanName = "colMenuFactory";
  }
  createMenu(e, t, s, i) {
    const r = e.createManagedBean(
      new Mn(0, {
        column: s ?? null,
        node: null,
        value: null
      })
    ), n = this.beans.menuItemMapper.mapWithStockItems(
      t,
      s ?? null,
      null,
      i,
      "columnMenu"
    );
    return r.addMenuItems(n), r;
  }
  getMenuItems(e = null, t = null) {
    var n;
    const s = this.getDefaultMenuOptions(e);
    let i;
    const r = (n = (e == null ? void 0 : e.getColDef()) ?? (t == null ? void 0 : t.getColGroupDef())) == null ? void 0 : n.mainMenuItems;
    if (Array.isArray(r))
      i = r;
    else if (typeof r == "function")
      i = r(
        V(this.gos, {
          column: e,
          columnGroup: t,
          defaultItems: s
        })
      );
    else {
      const o = this.gos.getCallback("getMainMenuItems");
      o ? i = o({
        column: e,
        columnGroup: t,
        defaultItems: s
      }) : i = s;
    }
    return BC(i, li), i;
  }
  getDefaultMenuOptions(e) {
    const t = [], { beans: s, gos: i } = this, {
      colChooserFactory: r,
      rowGroupColsSvc: n,
      colModel: o,
      expansionSvc: a,
      sortSvc: l,
      menuSvc: c,
      pinnedCols: d,
      aggFuncSvc: h,
      colAutosize: u
    } = s, g = Ae(i), p = () => {
      !g && r && t.push("columnChooser"), t.push("resetColumns");
    };
    if (!e)
      return p(), t;
    const { colDef: f } = e, m = d && !f.lockPinned, C = (n == null ? void 0 : n.columns.length) ?? 0, v = C > 0, w = e.isPrimary(), b = h && // if primary, then only allow aggValue if grouping and it's a value columns
    w && v && e.isAllowValue() || // secondary columns can always have aggValue, as it means it's a pivot value column
    !w;
    if (l && !g && e.isSortable()) {
      const y = e.getSort();
      y !== "asc" && t.push("sortAscending"), y !== "desc" && t.push("sortDescending"), y && t.push("sortUnSort"), t.push(li);
    }
    if (c != null && c.isFilterMenuItemEnabled(e) && (t.push("columnFilter"), t.push(li)), m && t.push("pinSubMenu"), b && t.push("valueAggSubMenu"), (m || b) && t.push(li), u && (t.push("autoSizeThis"), t.push("autoSizeAll"), t.push(li)), n && i.isModuleRegistered("SharedRowGrouping")) {
      const y = t.length;
      f.showRowGroup ? t.push("rowUnGroup") : e.isAllowRowGroup() && w && (e.isRowGroupActive() ? un(e, s) || t.push("rowUnGroup") : t.push("rowGroup")), t.length > y && t.push(li);
    }
    return p(), a && (te(i) || i.get("ssrmExpandAllAffectsAllRows")) && (i.get("treeData") || C > (o.isPivotMode() ? 1 : 0)) && (t.push("expandAll"), t.push("contractAll")), t;
  }
}, zB = "ag-menu", zu = "ag-context-menu-open", WB = "ag-context-menu-loading-icon", _B = class extends R {
  constructor() {
    super(...arguments), this.beanName = "contextMenuSvc", this.destroyLoadingSpinner = null, this.lastPromise = 0;
  }
  hideActiveMenu() {
    this.destroyBean(this.activeMenu);
  }
  getMenuItems(e, t, s, i) {
    const r = [], { clipboardSvc: n, chartSvc: o, csvCreator: a, excelCreator: l, colModel: c, rangeSvc: d, gos: h } = this.beans;
    if (A(e) && n && t && (h.get("suppressCutToClipboard") || r.push("cut"), r.push("copy", "copyWithHeaders", "copyWithGroupHeaders", "paste", "separator")), h.get("enableCharts") && o && (c.isPivotMode() && r.push("pivotChart"), d && !d.isEmpty() && r.push("chartRange")), A(e)) {
      const f = h.get("enableRowPinning"), m = h.get("isRowPinnable");
      if (f) {
        const y = e.level > -1 && e.footer, P = e.level === -1 && e.footer, E = wr(h);
        (P && !(E === "pinnedBottom" || E === "pinnedTop") || !P && !y) && ((m == null ? void 0 : m(e)) ?? !0) && r.push("pinRowSubMenu");
      }
      const C = h.get("suppressExcelExport") || !l, v = h.get("suppressCsvExport") || !a;
      !Xs() && (!C || !v) && r.push("export");
    }
    const u = r.length ? r : void 0, g = t == null ? void 0 : t.getColDef().contextMenuItems;
    if (Array.isArray(g))
      return g;
    if (typeof g == "function")
      return g(
        V(h, {
          column: t,
          node: e,
          value: s,
          defaultItems: u,
          event: i
        })
      );
    const p = h.getCallback("getContextMenuItems");
    return (p == null ? void 0 : p({ column: t, node: e, value: s, defaultItems: u, event: i })) ?? r;
  }
  getContextMenuPosition(e, t) {
    const s = this.getRowCtrl(e), i = this.getCellGui(s, t);
    if (!i)
      return { x: 0, y: (s == null ? void 0 : s.getRowYPosition()) ?? 0 };
    const r = i.getBoundingClientRect();
    return {
      x: r.x + r.width / 2,
      y: r.y + r.height / 2
    };
  }
  showContextMenu(e) {
    const t = e.rowNode ?? null, s = e.column ?? null;
    let { anchorToElement: i, value: r, source: n } = e;
    t && s && r == null && (r = this.beans.valueSvc.getValueForDisplay(s, t).value), i == null && (i = this.getContextMenuAnchorElement(t, s)), this.beans.menuUtils.onContextMenu({
      mouseEvent: e.mouseEvent ?? null,
      touchEvent: e.touchEvent ?? null,
      showMenuCallback: (o) => this.showMenu(t, s, r, o, i),
      source: n
    });
  }
  handleContextMenuMouseEvent(e, t, s, i) {
    var h;
    const r = (i == null ? void 0 : i.rowNode) ?? (s == null ? void 0 : s.rowNode) ?? null, n = (i == null ? void 0 : i.column) ?? ((h = s == null ? void 0 : s.findFullWidthInfoForEvent(e || t)) == null ? void 0 : h.column) ?? null, { valueSvc: o, ctrlsSvc: a } = this.beans, l = n ? o.getValue(n, r) : null, c = a.getGridBodyCtrl(), d = i ? i.eGui : c.eGridBody;
    this.showContextMenu({
      mouseEvent: e,
      touchEvent: t,
      rowNode: r,
      column: n,
      value: l,
      anchorToElement: d,
      source: "ui"
    });
  }
  showMenu(e, t, s, i, r) {
    const n = this.getMenuItems(e, t, s, i);
    if (pb(n)) {
      const o = this.lastPromise + 1;
      return this.lastPromise = o, this.destroyLoadingSpinner || this.createLoadingIcon(i), n.then((a) => {
        var h, u;
        if (this.lastPromise !== o)
          return;
        const { target: l } = i, c = !l;
        // check if there are actual menu items to be displayed
        a && a.length && // check if the element that triggered the context menu was removed from the DOM
        (c || Ze(l)) && // overlay was displayed
        !((h = this.beans.overlays) != null && h.isExclusive()) && this.createContextMenu({ menuItems: a, node: e, column: t, value: s, mouseEvent: i, anchorToElement: r }), (u = this.destroyLoadingSpinner) == null || u.call(this);
      }), !0;
    }
    return n === void 0 || !(n != null && n.length) ? !1 : (this.createContextMenu({ menuItems: n, node: e, column: t, value: s, mouseEvent: i, anchorToElement: r }), !0);
  }
  createLoadingIcon(e) {
    var l;
    const { beans: t } = this, s = this.getLocaleTextFunc(), i = N("loadingMenuItems", t), r = K({ tag: "div", cls: WB });
    r.appendChild(i);
    const n = xi(t), o = Xo(t);
    if (!o) {
      F(54);
      return;
    }
    o.appendChild(r), (l = t.ariaAnnounce) == null || l.announceValue(
      s("ariaLabelLoadingContextMenu", "Loading Context Menu"),
      "contextmenu"
    ), t.environment.applyThemeClasses(r), Bl(r, e, t);
    const a = (c) => {
      Bl(r, c, t);
    };
    n.addEventListener("mousemove", a), this.destroyLoadingSpinner = () => {
      n.removeEventListener("mousemove", a), o.removeChild(r), this.destroyLoadingSpinner = null;
    };
  }
  createContextMenu(e) {
    const { menuItems: t, node: s, column: i, value: r, mouseEvent: n, anchorToElement: o } = e, { ctrlsSvc: a, focusSvc: l, popupSvc: c } = this.beans, d = a.getGridBodyCtrl().eGridBody, h = new UB(t, i, s, r);
    this.createBean(h);
    const u = h.getGui();
    i || l.clearFocusedCell();
    const g = {
      column: i,
      rowNode: s,
      type: "contextMenu",
      mouseEvent: n,
      ePopup: u,
      // move one pixel away so that accidentally double clicking
      // won't show the browser's contextmenu
      nudgeY: 1
    }, p = this.getLocaleTextFunc(), f = c == null ? void 0 : c.addPopup({
      modal: !0,
      eChild: u,
      closeOnEsc: !0,
      closedCallback: (C) => {
        Ia(this.beans, () => {
          d.classList.remove(zu), this.destroyBean(h), this.dispatchVisibleChangedEvent(!1, C === void 0 ? "api" : "ui");
        });
      },
      click: n,
      positionCallback: () => {
        const C = this.gos.get("enableRtl");
        c == null || c.positionPopupUnderMouseEvent({
          ...g,
          nudgeX: C ? (u.offsetWidth + 1) * -1 : 1
        });
      },
      // so when browser is scrolled down, or grid is scrolled, context menu stays with cell
      anchorToElement: o,
      ariaLabel: p("ariaLabelContextMenu", "Context Menu")
    });
    f && (d.classList.add(zu), h.afterGuiAttached({ container: "contextMenu", hidePopup: f.hideFunc })), this.activeMenu && this.hideActiveMenu(), this.activeMenu = h, h.addEventListener("destroyed", () => {
      this.activeMenu === h && (this.activeMenu = null);
    }), f && h.addEventListener(
      "closeMenu",
      (C) => f.hideFunc({
        mouseEvent: C.mouseEvent ?? void 0,
        keyboardEvent: C.keyboardEvent ?? void 0,
        forceHide: !0
      })
    );
    const m = n && n instanceof MouseEvent && n.type === "mousedown";
    this.dispatchVisibleChangedEvent(!0, m ? "api" : "ui");
  }
  dispatchVisibleChangedEvent(e, t = "ui") {
    this.eventSvc.dispatchEvent({
      type: "contextMenuVisibleChanged",
      visible: e,
      source: t
    });
  }
  getRowCtrl(e) {
    const { rowIndex: t, rowPinned: s } = e || {};
    if (t != null)
      return this.beans.rowRenderer.getRowByPosition({ rowIndex: t, rowPinned: s }) || void 0;
  }
  getCellGui(e, t) {
    if (!e || !t)
      return;
    const s = e.getCellCtrl(t);
    return (s == null ? void 0 : s.eGui) || void 0;
  }
  getContextMenuAnchorElement(e, t) {
    const s = this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody, i = this.getRowCtrl(e);
    if (!i)
      return s;
    const r = this.getCellGui(i, t);
    return r || (i.isFullWidth() ? i.getFullWidthElement() : s);
  }
  destroy() {
    var e;
    (e = this.destroyLoadingSpinner) == null || e.call(this), super.destroy();
  }
}, UB = class extends D {
  constructor(e, t, s, i) {
    super({ tag: "div", cls: zB, role: "presentation" }), this.menuItems = e, this.column = t, this.node = s, this.value = i, this.menuList = null, this.focusedCell = null;
  }
  postConstruct() {
    const e = this.createManagedBean(
      new Mn(0, {
        column: this.column,
        node: this.node,
        value: this.value
      })
    ), t = this.beans.menuItemMapper.mapWithStockItems(
      this.menuItems,
      this.column,
      this.node,
      () => this.getGui(),
      "contextMenu"
    );
    e.addMenuItems(t), this.appendChild(e), this.menuList = e, e.addEventListener("closeMenu", (s) => this.dispatchLocalEvent(s));
  }
  afterGuiAttached({ hidePopup: e }) {
    e && this.addDestroyFunc(e), this.focusedCell = this.beans.focusSvc.getFocusedCell();
    const t = this.menuList;
    t && Ia(this.beans, () => ye(t.getGui()));
  }
  restoreFocusedCell() {
    const { beans: e, focusedCell: t } = this, s = e.focusSvc, i = s.getFocusedCell();
    if (i && t && Pn(i, t)) {
      const { rowIndex: r, rowPinned: n, column: o } = t;
      Jt(e) && s.setFocusedCell({
        rowIndex: r,
        column: o,
        rowPinned: n,
        forceBrowserFocus: !0,
        preventScrollOnBrowserFocus: !ua()
      });
    }
  }
  destroy() {
    super.destroy(), this.restoreFocusedCell();
  }
};
function $B(e) {
  return {
    tag: "div",
    cls: `ag-tabs ${e}`,
    children: [
      { tag: "div", ref: "eHeader" },
      {
        tag: "div",
        ref: "eBody",
        role: "presentation",
        cls: `ag-tabs-body ${e ? `${e}-body` : ""}`
      }
    ]
  };
}
var NC = class extends ls {
  constructor(e) {
    super($B(e.cssClass)), this.eHeader = x, this.eBody = x, this.items = [], this.tabbedItemScrollMap = /* @__PURE__ */ new Map(), this.params = e;
  }
  postConstruct() {
    this.setupHeader(), this.params.items && this.params.items.forEach((e) => this.addItem(e)), this.initialiseTabGuard({
      onTabKeyDown: this.onTabKeyDown.bind(this),
      handleKeyDown: this.handleKeyDown.bind(this),
      focusInnerElement: this.focusInnerElement.bind(this),
      focusTrapActive: !0
    }), this.addDestroyFunc(() => {
      var e, t, s;
      return (s = (t = (e = this.activeItem) == null ? void 0 : e.tabbedItem) == null ? void 0 : t.afterDetachedCallback) == null ? void 0 : s.call(t);
    });
  }
  setupHeader() {
    const { enableCloseButton: e, cssClass: t } = this.params, s = (i, r) => {
      i.classList.add(`ag-tabs-${r}`), t && i.classList.add(`${t}-${r}`);
    };
    e ? (this.setupCloseButton(s), this.eTabHeader = K({ tag: "div", role: "presentation" }), s(this.eHeader, "header-wrapper"), this.eHeader.appendChild(this.eTabHeader)) : this.eTabHeader = this.eHeader, Ye(this.eTabHeader, "tablist"), s(this.eTabHeader, "header");
  }
  setupCloseButton(e) {
    const t = K({ tag: "button" });
    e(t, "close-button");
    const s = N("close", this.beans);
    re(t, this.params.closeButtonAriaLabel), t.appendChild(s), this.addManagedElementListeners(t, { click: () => {
      var r, n;
      return (n = (r = this.params).onCloseClicked) == null ? void 0 : n.call(r);
    } });
    const i = K({ tag: "div", role: "presentation" });
    e(i, "close-button-wrapper"), i.appendChild(t), this.eHeader.appendChild(i), this.eCloseButton = t;
  }
  handleKeyDown(e) {
    switch (e.key) {
      case S.RIGHT:
      case S.LEFT: {
        if (!this.eTabHeader.contains(Q(this.beans)))
          return;
        const t = e.key === S.RIGHT, s = this.gos.get("enableRtl"), i = this.items.indexOf(this.activeItem), r = t !== s ? Math.min(i + 1, this.items.length - 1) : Math.max(i - 1, 0);
        if (i === r)
          return;
        e.preventDefault();
        const n = this.items[r];
        this.showItemWrapper(n), n.eHeaderButton.focus();
        break;
      }
      case S.UP:
      case S.DOWN:
        e.stopPropagation();
        break;
    }
  }
  onTabKeyDown(e) {
    var u, g, p, f;
    if (e.defaultPrevented)
      return;
    const { beans: t, eHeader: s, eBody: i, activeItem: r, params: n } = this, { suppressTrapFocus: o, enableCloseButton: a } = n, l = Q(t), c = e.target, d = e.shiftKey;
    if (s.contains(l)) {
      e.preventDefault(), a && d && !((u = this.eCloseButton) != null && u.contains(l)) ? (g = this.eCloseButton) == null || g.focus() : o && d ? (p = xc(me(t).body, c)) == null || p.focus() : this.focusBody(e.shiftKey);
      return;
    }
    let h = null;
    if (vC(i, c) && (d && (h = xc(i, c)), !h && !o && (h = r.eHeaderButton)), !h && i.contains(l) && (h = ze(t, i, !1, d), !h)) {
      o && !d ? this.forceFocusOutOfContainer(d) : a && !d ? (e.preventDefault(), (f = this.eCloseButton) == null || f.focus()) : (e.preventDefault(), this.focusHeader());
      return;
    }
    h && (e.preventDefault(), h.focus());
  }
  focusInnerElement(e) {
    return e ? this.focusBody(!0) : (this.focusHeader(), !0);
  }
  focusHeader(e) {
    this.activeItem.eHeaderButton.focus({ preventScroll: e });
  }
  focusBody(e) {
    return ye(this.eBody, e);
  }
  setAfterAttachedParams(e) {
    this.afterAttachedParams = e;
  }
  showFirstItem() {
    this.items.length > 0 && this.showItemWrapper(this.items[0]);
  }
  addItem(e) {
    const t = K({
      tag: "span",
      cls: "ag-tab",
      role: "tab",
      attrs: { tabindex: "-1" }
    });
    t.appendChild(e.title), this.eTabHeader.appendChild(t), re(t, e.titleLabel);
    const s = {
      tabbedItem: e,
      eHeaderButton: t
    };
    this.items.push(s), t.addEventListener("click", this.showItemWrapper.bind(this, s));
  }
  showItem(e) {
    const t = this.items.find((s) => s.tabbedItem === e);
    t && this.showItemWrapper(t);
  }
  showItemWrapper(e) {
    var i, r, n, o, a, l;
    const { tabbedItem: t, eHeaderButton: s } = e;
    if ((r = (i = this.params).onItemClicked) == null || r.call(i, { item: t }), this.activeItem === e) {
      (o = (n = this.params).onActiveItemClicked) == null || o.call(n);
      return;
    }
    this.lastScrollListener && (this.lastScrollListener = this.lastScrollListener()), X(this.eBody), t.bodyPromise.then((c) => {
      this.eBody.appendChild(c);
      const d = !ua();
      if (this.params.suppressFocusBodyOnOpen || ye(this.eBody, !1, d), t.afterAttachedCallback && t.afterAttachedCallback(this.afterAttachedParams), this.params.keepScrollPosition) {
        const h = t.getScrollableContainer && t.getScrollableContainer() || c;
        [this.lastScrollListener] = this.addManagedElementListeners(h, {
          scroll: () => {
            this.tabbedItemScrollMap.set(t.name, h.scrollTop);
          }
        });
        const u = this.tabbedItemScrollMap.get(t.name);
        u !== void 0 && setTimeout(() => {
          h.scrollTop = u;
        }, 0);
      }
    }), this.activeItem && (this.activeItem.eHeaderButton.classList.remove("ag-tab-selected"), (l = (a = this.activeItem.tabbedItem).afterDetachedCallback) == null || l.call(a)), s.classList.add("ag-tab-selected"), this.activeItem = e;
  }
}, Us = "filterMenuTab", $s = "generalMenuTab", ci = "columnsMenuTab", go = [$s, Us, ci], KB = class extends R {
  constructor() {
    super(...arguments), this.beanName = "enterpriseMenuFactory";
  }
  hideActiveMenu() {
    this.destroyBean(this.activeMenu);
  }
  showMenuAfterMouseEvent(e, t, s, i, r) {
    const { column: n, columnGroup: o } = this.splitColumnOrGroup(e), a = r ? "filterMenuTab" : void 0;
    this.showMenu(
      n,
      o,
      (l) => {
        var d;
        const c = l.getGui();
        this.beans.popupSvc.positionPopupUnderMouseEvent({
          type: s,
          column: n,
          mouseEvent: t,
          ePopup: c
        }), a && ((d = l.showTab) == null || d.call(l, a)), this.dispatchVisibleChangedEvent(!0, !1, n, o, a);
      },
      s,
      a,
      void 0,
      t.target,
      i
    );
  }
  splitColumnOrGroup(e) {
    const t = e && ts(e);
    return { column: t ? e : void 0, columnGroup: t ? void 0 : e };
  }
  showMenuAfterButtonClick(e, t, s, i, r) {
    let n = -1, o = "left";
    this.gos.get("enableRtl") && (n = 1, o = "right");
    const a = r ? "filterMenuTab" : void 0, l = a ? [a] : void 0, c = Ae(this.gos), d = (c ? 9 : 4) * n, h = c ? -23 : 4, { column: u, columnGroup: g } = this.splitColumnOrGroup(e);
    this.showMenu(
      u,
      g,
      (p) => {
        var m;
        const f = p.getGui();
        this.beans.popupSvc.positionPopupByComponent({
          type: s,
          column: u,
          eventSource: t,
          ePopup: f,
          alignSide: o,
          nudgeX: d,
          nudgeY: h,
          position: "under",
          keepWithinBounds: !0
        }), a && ((m = p.showTab) == null || m.call(p, a)), this.dispatchVisibleChangedEvent(!0, !1, u, g, a);
      },
      s,
      a,
      l,
      t,
      i
    );
  }
  showMenu(e, t, s, i, r, n, o, a) {
    var C;
    const l = this.getMenuParams(e, t, n, o);
    if (!l)
      return;
    const { menu: c, eMenuGui: d, anchorToElement: h, restoreFocusParams: u } = l, g = [], { menuUtils: p, popupSvc: f } = this.beans;
    g.push((v) => {
      const w = c.getGui();
      this.destroyBean(c), e && (Bo(e, !1, "contextMenu"), p.restoreFocusOnClose(u, w, v)), a == null || a();
    });
    const m = this.getLocaleTextFunc();
    if (f.addPopup({
      modal: !0,
      eChild: d,
      closeOnEsc: !0,
      closedCallback: (v) => {
        g.forEach((w) => w(v)), this.dispatchVisibleChangedEvent(!1, !1, e, t, r);
      },
      afterGuiAttached: (v) => c.afterGuiAttached(Object.assign({}, { container: i }, v)),
      // if defaultTab is not present, positionCallback will be called
      // after `showTabBasedOnPreviousSelection` is called.
      positionCallback: r ? () => s(c) : void 0,
      ariaLabel: m("ariaLabelColumnMenu", "Column Menu")
    }), r || ((C = c.showTabBasedOnPreviousSelection) == null || C.call(c), s(c)), np(this.gos)) {
      const v = f.setPopupPositionRelatedToElement(d, h);
      v && e && this.addStopAnchoring(v, e, g);
    }
    c.addEventListener("tabSelected", (v) => {
      this.dispatchVisibleChangedEvent(!1, !0, e), this.lastSelectedTab = v.key, this.dispatchVisibleChangedEvent(!0, !0, e);
    }), e && Bo(e, !0, "contextMenu"), this.activeMenu = c, c.addEventListener("destroyed", () => {
      this.activeMenu === c && (this.activeMenu = null);
    });
  }
  addStopAnchoring(e, t, s) {
    e.then((i) => {
      t.__addEventListener("leftChanged", i), t.__addEventListener("visibleChanged", i), s.push(() => {
        t.__removeEventListener("leftChanged", i), t.__removeEventListener("visibleChanged", i);
      });
    });
  }
  getMenuParams(e, t, s, i) {
    const { focusSvc: r, visibleCols: n, ctrlsSvc: o } = this.beans, a = {
      column: e,
      headerPosition: r.focusedHeader,
      columnIndex: n.allCols.indexOf(e),
      eventSource: i
    }, l = this.createMenu(e, t, a, s, i);
    return l ? {
      menu: l,
      eMenuGui: l.getGui(),
      anchorToElement: i || o.getGridBodyCtrl().eGridBody,
      restoreFocusParams: a
    } : void 0;
  }
  createMenu(e, t, s, i, r) {
    if (Ae(this.gos))
      return this.createBean(
        new jB(e, s, this.lastSelectedTab, i, r)
      );
    {
      const n = this.beans.colMenuFactory.getMenuItems(e, t);
      return n.length ? this.createBean(new YB(n, e, s, r)) : void 0;
    }
  }
  dispatchVisibleChangedEvent(e, t, s, i, r) {
    this.eventSvc.dispatchEvent({
      type: "columnMenuVisibleChanged",
      visible: e,
      switchingTab: t,
      key: this.lastSelectedTab ?? r ?? (Ae(this.gos) ? $s : "columnMenu"),
      column: s ?? null,
      columnGroup: i ?? null
    });
  }
  isMenuEnabled(e) {
    var r;
    if (!Ae(this.gos))
      return !0;
    const t = !((r = this.beans.filterManager) != null && r.isFilterAllowed(e)), s = e.getColDef().menuTabs ?? go;
    return (t && s.includes(Us) ? s.length - 1 : s.length) > 0;
  }
  showMenuAfterContextMenuEvent(e, t, s) {
    this.beans.menuUtils.onContextMenu({
      mouseEvent: t,
      touchEvent: s,
      source: "ui",
      showMenuCallback: (i) => (this.showMenuAfterMouseEvent(e, i, "columnMenu"), !0)
    });
  }
}, jB = class extends R {
  constructor(e, t, s, i, r) {
    super(), this.column = e, this.restoreFocusParams = t, this.initialSelection = s, this.restrictTo = i, this.sourceElement = r, this.tabFactories = {}, this.includeChecks = {};
    const { tabFactories: n, includeChecks: o } = this;
    n[$s] = this.createMainPanel.bind(this), n[Us] = this.createFilterPanel.bind(this), n[ci] = this.createColumnsPanel.bind(this), o[$s] = () => !0, o[Us] = () => {
      var a;
      return e ? !!((a = this.beans.filterManager) != null && a.isFilterAllowed(e)) : !1;
    }, o[ci] = () => !0;
  }
  postConstruct() {
    var s;
    const e = this.getTabsToCreate().map((i) => this.createTab(i)), t = new NC({
      items: e,
      cssClass: "ag-menu",
      onActiveItemClicked: this.onHidePopup.bind(this),
      onItemClicked: this.onTabItemClicked.bind(this)
    });
    this.tabbedLayout = this.createBean(t), (s = this.mainMenuList) == null || s.setParentComponent(t), this.addDestroyFunc(() => this.destroyBean(t));
  }
  getTabsToCreate() {
    var e;
    return this.restrictTo ? this.restrictTo : (((e = this.column) == null ? void 0 : e.getColDef().menuTabs) ?? go).filter(
      (t) => this.isValidMenuTabItem(t) && this.isNotSuppressed(t)
    );
  }
  isValidMenuTabItem(e) {
    let t = !0, s = go;
    return this.restrictTo != null && (t = this.restrictTo.indexOf(e) > -1, s = this.restrictTo), t = t && go.indexOf(e) > -1, t || F(175, { menuTabName: e, itemsToConsider: s }), t;
  }
  isNotSuppressed(e) {
    return this.includeChecks[e]();
  }
  createTab(e) {
    return this.tabFactories[e]();
  }
  showTabBasedOnPreviousSelection() {
    this.showTab(this.initialSelection);
  }
  showTab(e) {
    const { tabItemColumns: t, tabbedLayout: s, tabItemFilter: i, tabItemGeneral: r } = this;
    t && e === ci ? s.showItem(t) : i && e === Us ? s.showItem(i) : r && e === $s ? s.showItem(r) : s.showFirstItem();
  }
  onTabItemClicked(e) {
    let t = null;
    switch (e.item) {
      case this.tabItemColumns:
        t = ci;
        break;
      case this.tabItemFilter:
        t = Us;
        break;
      case this.tabItemGeneral:
        t = $s;
        break;
    }
    t && this.activateTab(t);
  }
  activateTab(e) {
    const t = {
      type: "tabSelected",
      key: e
    };
    this.dispatchLocalEvent(t);
  }
  createMainPanel() {
    const { beans: e, column: t } = this, s = e.colMenuFactory, i = s.createMenu(
      this,
      s.getMenuItems(t),
      this.column,
      () => this.sourceElement ?? this.getGui()
    );
    this.mainMenuList = i, i.addEventListener("closeMenu", this.onHidePopup.bind(this));
    const r = {
      title: N("legacyMenu", e, t),
      titleLabel: $s.replace("MenuTab", ""),
      bodyPromise: U.resolve(i.getGui()),
      name: $s
    };
    return this.tabItemGeneral = r, r;
  }
  onHidePopup(e) {
    this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(
      this.hidePopupFunc,
      this.restoreFocusParams,
      e
    );
  }
  createFilterPanel() {
    const e = this.column ? this.createBean(new bn(this.column, "COLUMN_MENU")) : null;
    this.filterComp = e, e != null && e.hasFilter() || j(119);
    const t = (i) => e == null ? void 0 : e.afterGuiAttached(i), s = () => e == null ? void 0 : e.afterGuiDetached();
    return this.tabItemFilter = {
      title: N("filterTab", this.beans, this.column),
      titleLabel: Us.replace("MenuTab", ""),
      bodyPromise: U.resolve(e == null ? void 0 : e.getGui()),
      afterAttachedCallback: t,
      afterDetachedCallback: s,
      name: Us
    }, this.tabItemFilter;
  }
  createColumnsPanel() {
    const e = K({ tag: "div", cls: "ag-menu-column-select-wrapper" }), { beans: t, column: s } = this, r = t.colChooserFactory.createColumnSelectPanel(
      this,
      s
    ).getGui();
    r.classList.add("ag-menu-column-select"), e.appendChild(r);
    const n = {
      title: N("columns", t, s),
      //createColumnsIcon(),
      titleLabel: ci.replace("MenuTab", ""),
      bodyPromise: U.resolve(e),
      name: ci
    };
    return this.tabItemColumns = n, n;
  }
  afterGuiAttached(e) {
    const { container: t, hidePopup: s } = e;
    this.tabbedLayout.setAfterAttachedParams({ container: t, hidePopup: s }), s && (this.hidePopupFunc = s, this.addDestroyFunc(s));
  }
  getGui() {
    return this.tabbedLayout.getGui();
  }
  destroy() {
    super.destroy(), this.destroyBean(this.filterComp);
  }
}, YB = class extends D {
  constructor(e, t, s, i) {
    super({ tag: "div", ref: "eColumnMenu", cls: "ag-menu ag-column-menu", role: "presentation" }), this.menuItems = e, this.column = t, this.restoreFocusParams = s, this.sourceElement = i, this.eColumnMenu = x;
  }
  postConstruct() {
    const e = this.beans.colMenuFactory.createMenu(
      this,
      this.menuItems,
      this.column,
      () => this.sourceElement ?? this.getGui()
    );
    this.mainMenuList = e, e.addEventListener("closeMenu", this.onHidePopup.bind(this)), this.eColumnMenu.appendChild(e.getGui());
  }
  onHidePopup(e) {
    this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(
      this.hidePopupFunc,
      this.restoreFocusParams,
      e
    );
  }
  afterGuiAttached({ hidePopup: e }) {
    e && (this.hidePopupFunc = e, this.addDestroyFunc(e)), ye(this.mainMenuList.getGui());
  }
};
function qB(e, t) {
  const { contextMenuSvc: s } = e;
  if (!s)
    return;
  const { rowNode: i, column: r, value: n, x: o, y: a } = t || {};
  let { x: l, y: c } = s.getContextMenuPosition(i, r);
  o != null && (l = o), a != null && (c = a), s.showContextMenu({
    mouseEvent: new MouseEvent("mousedown", { clientX: l, clientY: c }),
    rowNode: i,
    column: r,
    value: n,
    source: "api"
  });
}
function XB(e, t) {
  var s;
  (s = e.colChooserFactory) == null || s.showColumnChooser({ chooserParams: t });
}
function ZB(e) {
  var t;
  (t = e.colChooserFactory) == null || t.hideActiveColumnChooser();
}
var QB = class extends R {
  constructor() {
    super(...arguments), this.beanName = "menuUtils";
  }
  restoreFocusOnClose(e, t, s, i) {
    const { eventSource: r } = e, n = s instanceof KeyboardEvent;
    if (!i && !n || !r)
      return;
    const o = Q(this.beans);
    // focus is outside of comp
    !t.contains(o) && // something else has focus
    !Jt(this.beans) || this.focusHeaderCell(e);
  }
  closePopupAndRestoreFocusOnSelect(e, t, s) {
    let i;
    s && s.keyboardEvent && (i = s.keyboardEvent), e(i && { keyboardEvent: i });
    const r = this.beans, n = r.focusSvc, o = n.getFocusedCell();
    if (Jt(r))
      if (o) {
        const { rowIndex: a, rowPinned: l, column: c } = o;
        n.setFocusedCell({
          rowIndex: a,
          column: c,
          rowPinned: l,
          forceBrowserFocus: !0,
          preventScrollOnBrowserFocus: !0
        });
      } else
        this.focusHeaderCell(t);
  }
  onContextMenu(e) {
    const { mouseEvent: t, touchEvent: s, showMenuCallback: i, source: r } = e;
    if (!this.gos.get("allowContextMenuWithControlKey") && t && (t.ctrlKey || t.metaKey) || (t && this.blockMiddleClickScrollsIfNeeded(t), r === "ui" && this.gos.get("suppressContextMenu")))
      return;
    const n = t ?? s.touches[0];
    if (i(n)) {
      const o = t ?? s;
      o && o.cancelable && o.preventDefault();
    }
  }
  // make this async for react
  async focusHeaderCell(e) {
    const { column: t, columnIndex: s, headerPosition: i, eventSource: r } = e, { visibleCols: n, headerNavigation: o, focusSvc: a } = this.beans, l = await n.allCols.some((c) => c === t);
    if (this.isAlive()) {
      if (t != null && t.isAlive() && l && r && Ze(r)) {
        const c = sd(r);
        c && (o == null || o.scrollToColumn(t), c.focus());
      } else if (i && s !== -1) {
        const c = n.allCols, d = c[s] || _(c);
        d && a.focusHeaderPosition({
          headerPosition: {
            headerRowIndex: i.headerRowIndex,
            column: d
          }
        });
      }
    }
  }
  blockMiddleClickScrollsIfNeeded(e) {
    this.gos.get("suppressMiddleClickScrolls") && e.which === 2 && e.preventDefault();
  }
}, HC = {
  moduleName: "MenuCore",
  version: Y,
  beans: [BB, IB, QB],
  icons: {
    // context menu chart item
    chart: "chart",
    // columns in menu (column chooser / columns tab)
    columns: "columns",
    // loading async menu items
    loadingMenuItems: "loading",
    // "Pin column" item in column header menu
    menuPin: "pin",
    // "Value aggregation" column menu item (shown on numeric columns when grouping is active)"
    menuValue: "aggregation",
    // "Group by {column-name}" item in column header menu
    menuAddRowGroup: "group",
    // "Un-Group by {column-name}" item in column header menu
    menuRemoveRowGroup: "group",
    // context menu copy item
    clipboardCopy: "copy",
    // context menu cut item
    clipboardCut: "cut",
    // context menu paste item
    clipboardPaste: "paste",
    // context menu export item
    save: "save",
    // csv export
    csvExport: "csv",
    // excel export,
    excelExport: "excel",
    // show on column header when column is sorted ascending
    sortAscending: "asc",
    // show on column header when column is sorted descending
    sortDescending: "desc",
    // show on column header when column has no sort, only when enabled with colDef.unSortIcon=true
    sortUnSort: "none"
  },
  dependsOn: [ie, Is, gm, Aa]
}, JB = {
  moduleName: "ColumnMenu",
  version: Y,
  beans: [KB, HB, GB],
  icons: {
    ensureColumnVisible: "column-arrow",
    // menu tab icon in legacy tabbed enterprise column menu
    legacyMenu: "menu",
    // filter tab icon in legacy tabbed enterprise column menu
    filterTab: "filter",
    // column tool panel column group contracted (click to expand)
    columnSelectClosed: "tree-closed",
    // column tool panel column group expanded (click to contract)
    columnSelectOpen: "tree-open",
    // column tool panel header expand/collapse all button, shown when some children are expanded and
    //     others are collapsed
    columnSelectIndeterminate: "tree-indeterminate"
  },
  apiFunctions: {
    showColumnChooser: XB,
    hideColumnChooser: ZB
  },
  dependsOn: [HC, Hi, xd]
}, eN = {
  moduleName: "ContextMenu",
  version: Y,
  beans: [_B],
  apiFunctions: {
    showContextMenu: qB
  },
  dependsOn: [HC]
}, Wu = class extends xn {
  constructor() {
    super({ tag: "div", cls: "ag-cell-edit-wrapper" }), this.isAsync = !1;
  }
  initialiseEditor(e) {
    const { cellStartedEdit: t, values: s, eventKey: i } = this.params;
    ee(s) && F(180);
    const { params: r, valuesPromise: n } = this.buildRichSelectParams(), o = this.createManagedBean(new Ma(r));
    this.eEditor = o, o.addCss("ag-cell-editor"), this.appendChild(o), n && (this.isAsync = !0, n.then((a) => {
      o.setValueList({ valueList: a, refresh: !0 });
      const l = this.getSearchStringCallback(a);
      l && o.setSearchStringCreator(l), this.processEventKey(i);
    })), this.addManagedListeners(o, {
      fieldPickerValueSelected: this.onEditorPickerValueSelected.bind(this)
    }), this.focusAfterAttached = t;
  }
  onEditorPickerValueSelected(e) {
    this.gos.get("editType") !== "fullRow" && setTimeout(() => this.params.stopEditing(!e.fromEnterKey));
  }
  buildRichSelectParams() {
    const e = this.params, {
      cellRenderer: t,
      cellHeight: s,
      value: i,
      values: r,
      formatValue: n,
      searchDebounceDelay: o,
      valueListGap: a,
      valueListMaxHeight: l,
      valueListMaxWidth: c,
      allowTyping: d,
      filterList: h,
      searchType: u,
      highlightMatch: g,
      valuePlaceholder: p,
      eventKey: f,
      multiSelect: m,
      suppressDeselectAll: C,
      suppressMultiSelectPillRenderer: v
    } = e, w = {
      value: i,
      cellRenderer: t,
      cellRowHeight: s,
      searchDebounceDelay: o,
      valueFormatter: n,
      pickerAriaLabelKey: "ariaLabelRichSelectField",
      pickerAriaLabelValue: "Rich Select Field",
      pickerType: "virtual-list",
      pickerGap: a,
      allowTyping: d,
      filterList: h,
      searchType: u,
      highlightMatch: g,
      maxPickerHeight: l,
      maxPickerWidth: c,
      placeholder: p,
      initialInputValue: (f == null ? void 0 : f.length) === 1 ? f : void 0,
      multiSelect: m,
      suppressDeselectAll: C,
      suppressMultiSelectPillRenderer: v
    };
    let b, y;
    return typeof r == "function" ? b = r(e) : b = r ?? [], Array.isArray(b) ? (w.valueList = b, w.searchStringCreator = this.getSearchStringCallback(b)) : y = b, m && d && (e.allowTyping = w.allowTyping = !1, F(181)), { params: w, valuesPromise: y };
  }
  getSearchStringCallback(e) {
    var n;
    if (typeof e[0] != "object")
      return;
    const t = this.params, { colDef: s, formatValue: i } = t;
    if ((n = s.cellEditorParams) != null && n.formatValue)
      return (o) => o.map(i);
    const { keyCreator: r } = s;
    if (r) {
      F(266);
      const { column: o, node: a, data: l } = t;
      return (c) => c.map((d) => {
        const h = V(this.gos, {
          value: d,
          colDef: s,
          column: o,
          node: a,
          data: l
        });
        return r(h);
      });
    }
    return (o) => o.map(i);
  }
  // we need to have the gui attached before we can draw the virtual rows, as the
  // virtual row logic needs info about the gui state
  afterGuiAttached() {
    const { focusAfterAttached: e, params: t } = this;
    setTimeout(() => {
      if (!this.isAlive())
        return;
      const s = this.eEditor, { allowTyping: i, eventKey: r, cellStartedEdit: n } = t;
      if (e) {
        const o = s.getFocusableElement();
        o.focus(), i && (!r || r.length !== 1) && o.select();
      }
      n && s.showPicker(), this.isAsync || this.processEventKey(r);
    });
  }
  processEventKey(e) {
    e && (e == null ? void 0 : e.length) === 1 && this.eEditor.searchTextFromString(e);
  }
  focusIn() {
    this.eEditor.getFocusableElement().focus();
  }
  getValue() {
    var s;
    const { params: e } = this, t = this.eEditor.getValue();
    return ((s = e.parseValue) == null ? void 0 : s.call(e, t)) ?? t;
  }
  isPopup() {
    return !1;
  }
  getValidationElement() {
    return this.eEditor.getAriaElement();
  }
  getValidationErrors() {
    const { params: e } = this, { getValidationErrors: t } = e;
    return t ? t({
      value: this.getValue(),
      internalErrors: null,
      cellEditorParams: e
    }) : null;
  }
}, tN = {
  moduleName: "RichSelect",
  version: Y,
  beans: [],
  userComponents: { agRichSelect: Wu, agRichSelectCellEditor: Wu },
  icons: {
    // open icon for rich select editor
    richSelectOpen: "small-down",
    // remove for rich select editor pills
    richSelectRemove: "cancel"
  },
  dependsOn: [ie, ds]
}, gi = "__AG_SELECT_ALL__", pi = "__AG_ADD_SELECTION_TO_FILTER__", sN = class {
  constructor(e, t, s, i) {
    this.valueSvc = e, this.getValueFormatter = t, this.formatter = s, this.column = i, this.displayedKeys = [];
  }
  updateDisplayedValuesToAllAvailable(e, t, s) {
    this.displayedKeys = Array.from(s);
  }
  updateDisplayedValuesToMatchMiniFilter(e, t, s, i, r) {
    this.displayedKeys = [];
    const n = this.getValueFormatter();
    for (const o of s)
      if (o == null)
        r && this.displayedKeys.push(o);
      else {
        const a = e(o), l = this.valueSvc.formatValue(this.column, null, a, n, !1), c = this.formatter(l);
        i(c) && this.displayedKeys.push(o);
      }
  }
  getDisplayedValueCount() {
    return this.displayedKeys.length;
  }
  getDisplayedItem(e) {
    return this.displayedKeys[e];
  }
  getSelectAllItem() {
    return gi;
  }
  getAddSelectionToFilterItem() {
    return pi;
  }
  getDisplayedKeys() {
    return this.displayedKeys;
  }
  forEachDisplayedKey(e) {
    this.displayedKeys.forEach(e);
  }
  someDisplayedKey(e) {
    return this.displayedKeys.some(e);
  }
  hasGroups() {
    return !1;
  }
  refresh() {
  }
}, iN = {
  tag: "div",
  cls: "ag-set-filter-item",
  attrs: { "aria-hidden": "true" },
  children: [
    {
      tag: "span",
      cls: "ag-set-filter-group-icons",
      children: [
        { tag: "span", ref: "eGroupClosedIcon", cls: "ag-set-filter-group-closed-icon" },
        { tag: "span", ref: "eGroupOpenedIcon", cls: "ag-set-filter-group-opened-icon" },
        { tag: "span", ref: "eGroupIndeterminateIcon", cls: "ag-set-filter-group-indeterminate-icon" }
      ]
    },
    { tag: "ag-checkbox", ref: "eCheckbox", cls: "ag-set-filter-item-checkbox" }
  ]
}, rN = {
  tag: "div",
  cls: "ag-set-filter-item",
  children: [{ tag: "ag-checkbox", ref: "eCheckbox", cls: "ag-set-filter-item-checkbox" }]
}, nN = class extends D {
  constructor(e) {
    super(e.isGroup ? iN : rN, [_t]), this.eCheckbox = x, this.eGroupOpenedIcon = x, this.eGroupClosedIcon = x, this.eGroupIndeterminateIcon = x, this.formattedValue = null, this.focusWrapper = e.focusWrapper, this.value = e.value, this.params = e.params, this.translate = e.translate, this.valueFormatter = e.valueFormatter, this.item = e.item, this.isSelected = e.isSelected, this.isTree = e.isTree, this.depth = e.depth ?? 0, this.isGroup = e.isGroup, this.groupsExist = e.groupsExist, this.isExpanded = e.isExpanded, this.hasIndeterminateExpandState = e.hasIndeterminateExpandState;
  }
  postConstruct() {
    this.tooltipFeature = this.createOptionalManagedBean(
      this.beans.registry.createDynamicBean("tooltipFeature", !1, {
        getGui: () => this.focusWrapper,
        getLocation: () => "setFilterValue",
        shouldDisplayTooltip: () => {
          var e;
          return ((e = this.shouldDisplayTooltip) == null ? void 0 : e.call(this)) ?? !0;
        },
        getAdditionalParams: () => {
          const { colDef: e, column: t } = this.params, s = {
            colDef: e,
            column: t,
            valueFormatted: this.formattedValue ?? void 0
          };
          return this.isTree && (s.level = this.depth), s;
        }
      })
    ), this.addDestroyFunc(() => {
      var e;
      return (e = this.destroyCellRendererComponent) == null ? void 0 : e.call(this);
    }), this.render(), this.eCheckbox.setLabelEllipsis(!0).setValue(this.isSelected, !0).setDisabled(!!this.params.readOnly).getInputElement().setAttribute("tabindex", "-1"), this.refreshVariableAriaLabels(), this.isTree && (this.depth > 0 && (this.addCss("ag-set-filter-indent-" + this.depth), this.getGui().style.setProperty("--ag-indentation-level", String(this.depth))), this.isGroup ? this.setupExpansion() : this.groupsExist && this.addCss("ag-set-filter-add-group-indent"), Qo(this.getAriaElement(), this.depth + 1)), this.refreshAriaChecked(), !this.params.readOnly && this.eCheckbox.onValueChange((e) => this.onCheckboxChanged(!!e));
  }
  getFocusableElement() {
    return this.focusWrapper;
  }
  setupExpansion() {
    const { eGroupClosedIcon: e, eGroupOpenedIcon: t, eGroupIndeterminateIcon: s, hasIndeterminateExpandState: i, beans: r } = this;
    e.appendChild(Bt("setFilterGroupClosed", r, null)), t.appendChild(Bt("setFilterGroupOpen", r, null));
    const n = this.onExpandOrContractClicked.bind(this);
    this.addManagedElementListeners(e, { click: n }), this.addManagedElementListeners(t, { click: n }), i && (s.appendChild(Bt("setFilterGroupIndeterminate", r, null)), this.addManagedElementListeners(s, {
      click: n
    })), this.setExpandedIcons(), this.refreshAriaExpanded();
  }
  onExpandOrContractClicked() {
    this.setExpanded(!this.isExpanded);
  }
  setExpanded(e, t) {
    if (this.isGroup && e !== this.isExpanded) {
      this.isExpanded = e;
      const s = {
        type: "expandedChanged",
        isExpanded: !!e,
        item: this.item
      };
      t || this.dispatchLocalEvent(s), this.setExpandedIcons(), this.refreshAriaExpanded();
    }
  }
  setExpandedIcons() {
    const { isExpanded: e, hasIndeterminateExpandState: t, eGroupClosedIcon: s, eGroupOpenedIcon: i, eGroupIndeterminateIcon: r } = this;
    O(s, t ? e === !1 : !e), O(i, e === !0), t && O(r, e === void 0);
  }
  onCheckboxChanged(e) {
    this.isSelected = e;
    const t = {
      type: "selectionChanged",
      isSelected: e,
      item: this.item
    };
    this.dispatchLocalEvent(t), this.refreshVariableAriaLabels(), this.refreshAriaChecked();
  }
  toggleSelected() {
    this.params.readOnly || this.setSelected(!this.isSelected);
  }
  setSelected(e, t) {
    this.isSelected = e, this.eCheckbox.setValue(e, t), this.refreshAriaChecked();
  }
  refreshVariableAriaLabels() {
    if (!this.isTree)
      return;
    const e = this.getLocaleTextFunc(), t = this.eCheckbox.getValue(), s = t === void 0 ? e("ariaIndeterminate", "indeterminate") : t ? e("ariaVisible", "visible") : e("ariaHidden", "hidden"), i = e("ariaToggleVisibility", "Press SPACE to toggle visibility");
    Js(this.eCheckbox.getInputElement(), void 0), this.eCheckbox.setInputAriaLabel(`${i} (${s})`);
  }
  setupFixedAriaLabels(e) {
    if (!this.isTree)
      return;
    const s = this.getLocaleTextFunc()("ariaFilterValue", "Filter Value"), i = this.getAriaElement();
    re(i, `${e} ${s}`), Zo(i, this.eCheckbox.getInputElement().id);
  }
  refreshAriaChecked() {
    const e = this.getAriaElement();
    Ig(e, this.eCheckbox.getValue());
  }
  refreshAriaExpanded() {
    qe(this.getAriaElement(), !!this.isExpanded);
  }
  refresh(e, t, s) {
    var a;
    this.item = e, t !== this.isSelected && this.setSelected(t, !0), this.setExpanded(s, !0);
    const { cellRendererComponent: i, cellRendererParams: r, beans: n, params: o } = this;
    if (this.valueFunction) {
      const l = this.valueFunction();
      this.setTooltipAndCellRendererParams(l, l), i || this.renderCellWithoutCellRenderer();
    }
    if (i) {
      const l = fr(n.userCompFactory, o, r);
      if (!((a = i.refresh) == null ? void 0 : a.call(i, (l == null ? void 0 : l.params) ?? r))) {
        const d = i;
        this.renderCell(), this.destroyBean(d);
      }
    }
  }
  render() {
    const {
      params: { column: e }
    } = this;
    let { value: t } = this, s = null;
    typeof t == "function" ? (this.valueFunction = t, s = this.valueFunction(), t = s) : this.isTree ? s = ut(t) : s = this.getFormattedValue(e, t), this.formattedValue = s, this.setTooltipAndCellRendererParams(t, s), this.renderCell();
  }
  setTooltipAndCellRendererParams(e, t) {
    var i;
    const s = this.gos;
    if (this.params.showTooltips && (!Yr(s) || !this.params.cellRenderer)) {
      const r = t ?? ut(e);
      this.shouldDisplayTooltip = Fa(
        s,
        () => this.eCheckbox.getGui().querySelector(".ag-label")
      ), (i = this.tooltipFeature) == null || i.setTooltipAndRefresh(r);
    }
    this.cellRendererParams = V(s, {
      value: e,
      valueFormatted: t,
      colDef: this.params.colDef,
      column: this.params.column,
      setTooltip: (r, n) => {
        var o;
        s.assertModuleRegistered("Tooltip", 3), this.shouldDisplayTooltip = n, (o = this.tooltipFeature) == null || o.setTooltipAndRefresh(r);
      }
    });
  }
  getFormattedValue(e, t) {
    return this.beans.valueSvc.formatValue(e, null, t, this.valueFormatter, !1);
  }
  renderCell() {
    const e = fr(this.beans.userCompFactory, this.params, this.cellRendererParams), t = e == null ? void 0 : e.newAgStackInstance();
    if (t == null) {
      this.renderCellWithoutCellRenderer();
      return;
    }
    t.then((s) => {
      s && (this.cellRendererComponent = s, this.eCheckbox.setLabel(s.getGui()), this.destroyCellRendererComponent = () => this.destroyBean(s));
    });
  }
  renderCellWithoutCellRenderer() {
    const { valueFormatted: e, value: t } = this.cellRendererParams;
    let s = e ?? t ?? this.translate("blanks");
    typeof s != "string" && (F(208), s = ""), this.eCheckbox.setLabel(s), this.setupFixedAriaLabels(s);
  }
  getComponentHolder() {
    return this.params.column.getColDef();
  }
}, oN = {
  loadingOoo: "Loading...",
  blanks: "(Blanks)",
  searchOoo: "Search...",
  selectAll: "(Select All)",
  selectAllSearchResults: "(Select All Search Results)",
  addCurrentSelectionToFilter: "Add current selection to filter",
  noMatches: "No matches.",
  ariaSearchFilterValues: "Search filter values",
  ariaFilterList: "Filter List",
  filterSummaryListInactive: "is (All)",
  filterSummaryListSeparator: ", ",
  filterSummaryListShort: (e) => `is (${e[0]})`,
  filterSummaryListLong: (e) => `is (${e[0]}) and ${e[1]} more`
};
function Pc(e, t, s) {
  let i = e;
  return i ? (i = i.map((r) => ut(Ce(r))), !t && s && i.some((r) => r == null) ? _(i) == null ? null : i.filter((r) => r != null) : i) : null;
}
function ct(e, t, s) {
  return Nc(e, oN, t, s);
}
function aN(e) {
  e.excelMode === "windows" ? (e.buttons || (e.buttons = ["apply", "cancel"]), e.closeOnApply == null && (e.closeOnApply = !0)) : e.excelMode === "mac" && (e.buttons || (e.buttons = ["reset"]), e.applyMiniFilterWhileTyping == null && (e.applyMiniFilterWhileTyping = !0), e.debounceMs == null && (e.debounceMs = 500)), e.excelMode && e.defaultToNothingSelected && (e.defaultToNothingSelected = !1, F(207));
}
function lN() {
  return ([e, t], [s, i]) => {
    if (t == null)
      return i == null ? 0 : -1;
    if (i == null)
      return 1;
    for (let r = 0; r < t.length; r++) {
      if (r >= i.length)
        return 1;
      const n = vo(t[r], i[r]);
      if (n !== 0)
        return n;
    }
    return 0;
  };
}
var _u = class {
  constructor(e, t, s, i) {
    this.formatter = e, this.treeListPathGetter = t, this.treeListFormatter = s, this.treeDataOrGrouping = i, this.allDisplayedItemsTree = /* @__PURE__ */ new Map(), this.activeDisplayedItemsFlat = [], this.selectAllItem = {
      depth: 0,
      filterPasses: !0,
      available: !0,
      treeKey: gi,
      children: this.allDisplayedItemsTree,
      expanded: !0,
      key: gi,
      parentTreeKeys: []
    }, this.addSelectionToFilterItem = {
      depth: 0,
      filterPasses: !0,
      available: !0,
      treeKey: pi,
      expanded: !0,
      key: pi,
      parentTreeKeys: []
    };
  }
  updateParams(e, t) {
    this.treeListPathGetter = e, this.treeListFormatter = t;
  }
  updateDisplayedValuesToAllAvailable(e, t, s, i) {
    i === "reload" ? this.generateItemTree(e, t, s) : i === "otherFilter" ? (this.updateAvailable(s), this.updateExpandAll()) : i === "miniFilter" && (this.resetFilter(), this.updateExpandAll()), this.flattenItems();
  }
  updateDisplayedValuesToMatchMiniFilter(e, t, s, i, r, n) {
    n === "reload" ? this.generateItemTree(e, t, s) : n === "otherFilter" && this.updateAvailable(s), this.updateFilter(i, r), this.updateExpandAll(), this.flattenItems();
  }
  generateItemTree(e, t, s) {
    const i = /* @__PURE__ */ new Map();
    this.allDisplayedItemsTree = i;
    let r = !1;
    const n = this.getTreeListPathGetter(e, s);
    for (const o of t) {
      const a = e(o), l = n(a) ?? [null], c = l.length;
      c > 1 && (r = !0);
      const d = s.has(o);
      let h = i, u, g = [];
      for (let p = 0; p < c; p++) {
        const f = l[p];
        h || (h = /* @__PURE__ */ new Map(), u.children = h);
        const m = (f == null ? void 0 : f.toUpperCase()) ?? null;
        u = h.get(m), u || (u = {
          treeKey: f,
          depth: p,
          filterPasses: !0,
          expanded: !1,
          available: d,
          parentTreeKeys: g
        }, p === l.length - 1 && (u.key = o), h.set(m, u)), h = u.children, g = [...g, f];
      }
    }
    this.groupsExist = r, this.updateAvailable(s), this.selectAllItem.children = i, this.selectAllItem.expanded = !1;
  }
  getTreeListPathGetter(e, t) {
    if (this.treeListPathGetter)
      return this.treeListPathGetter;
    if (this.treeDataOrGrouping)
      return (i) => i;
    let s = !1;
    for (const i of t) {
      const r = e(i);
      if (r instanceof Date) {
        s = !0;
        break;
      } else if (r != null)
        break;
    }
    return s ? (i) => Xi(i, !1) : (F(211), (i) => [String(i)]);
  }
  flattenItems() {
    this.activeDisplayedItemsFlat = [];
    const e = (t) => {
      for (const s of t.values())
        !s.filterPasses || !s.available || (this.activeDisplayedItemsFlat.push(s), s.children && s.expanded && e(s.children));
    };
    e(this.allDisplayedItemsTree);
  }
  resetFilter() {
    const e = (t) => {
      const s = t.children;
      if (s)
        for (const i of s.values())
          e(i);
      t.filterPasses = !0;
    };
    for (const t of this.allDisplayedItemsTree.values())
      e(t);
  }
  updateFilter(e, t) {
    const s = (i) => i.available ? i.treeKey == null ? t : e(
      this.formatter(
        this.treeListFormatter ? this.treeListFormatter(i.treeKey, i.depth, i.parentTreeKeys) : i.treeKey
      )
    ) : !1;
    for (const i of this.allDisplayedItemsTree.values())
      this.recursiveItemCheck(i, !1, s, "filterPasses");
  }
  getDisplayedValueCount() {
    return this.activeDisplayedItemsFlat.length;
  }
  getDisplayedItem(e) {
    return this.activeDisplayedItemsFlat[e];
  }
  getSelectAllItem() {
    return this.selectAllItem;
  }
  getAddSelectionToFilterItem() {
    return this.addSelectionToFilterItem;
  }
  getDisplayedKeys() {
    const e = [];
    return this.forEachDisplayedKey((t) => e.push(t)), e;
  }
  forEachDisplayedKey(e) {
    const t = (s, i) => {
      const r = s.children;
      if (r) {
        if (!s.expanded || !i)
          for (const n of r.values())
            n.filterPasses && t(n, !1);
      } else
        e(s.key);
    };
    this.activeDisplayedItemsFlat.forEach((s) => t(s, !0));
  }
  someDisplayedKey(e) {
    const t = (s, i) => {
      const r = s.children;
      if (r) {
        if (!s.expanded || !i) {
          for (const n of r.values())
            if (n.filterPasses && t(n, !1))
              return !0;
          return !1;
        }
      } else
        return e(s.key);
      return !1;
    };
    return this.activeDisplayedItemsFlat.some((s) => t(s, !0));
  }
  hasGroups() {
    return this.groupsExist;
  }
  refresh() {
    this.updateExpandAll(), this.flattenItems();
  }
  updateExpandAll() {
    const e = (s, i, r) => {
      for (const n of s.values()) {
        if (!n.filterPasses || !n.available || !n.children)
          continue;
        if (i = i || !!n.expanded, r = r || !n.expanded, i && r)
          return;
        const o = e(n.children, i, r);
        if (o === void 0)
          return;
        o ? i = !0 : r = !0;
      }
      return i && r ? void 0 : i;
    }, t = this.getSelectAllItem();
    t.expanded = e(t.children, !1, !1);
  }
  recursiveItemCheck(e, t, s, i) {
    let r = !1;
    const n = e.children;
    if (n)
      for (const a of n.values()) {
        const l = this.recursiveItemCheck(
          a,
          t || s(e),
          s,
          i
        );
        r = r || l;
      }
    const o = t || r || s(e);
    return e[i] = o, o;
  }
  updateAvailable(e) {
    const t = (s) => e.has(s.key);
    for (const s of this.allDisplayedItemsTree.values())
      this.recursiveItemCheck(s, !1, t, "available");
  }
}, zC = class extends wa {
  constructor() {
    super("setFilter", "set-filter"), this.filterType = "set", this.eMiniFilter = x, this.eFilterLoading = x, this.eFilterLoadingIcon = x, this.eSetFilterList = x, this.eFilterNoMatches = x, this.hardRefreshVirtualList = !1, this.miniFilterText = null, this.addCurrentSelectionToFilter = !1, this.selectedKeys = /* @__PURE__ */ new Set();
  }
  setParams(e) {
    super.setParams(e);
    const t = this.updateHandler(e.getHandler()), { column: s, textFormatter: i, treeList: r, treeListPathGetter: n, treeListFormatter: o } = e;
    this.formatter = i ?? ((a) => a ?? null), this.displayValueModel = r ? new _u(
      this.formatter,
      n,
      o,
      t.isTreeDataOrGrouping()
    ) : new sN(
      this.beans.valueSvc,
      () => this.handler.valueFormatter,
      this.formatter,
      s
    ), t.valueModel.allKeys.then((a) => {
      this.updateDisplayedValues("reload", a ?? []), this.resetSelectionState(a ?? []);
    }), t.valueModel.isLoading() && this.setIsLoading(!0), this.initialiseFilterBodyUi();
  }
  refresh(e) {
    return this.params.treeList !== e.treeList ? !1 : (this.updateHandler(
      e.getHandler()
    ), super.refresh(e));
  }
  updateParams(e, t) {
    super.updateParams(e, t), this.updateMiniFilter(), e.suppressSelectAll !== t.suppressSelectAll && this.createVirtualListModel(e);
    const { textFormatter: s, treeListPathGetter: i, treeListFormatter: r } = e;
    this.formatter = s ?? ((n) => n ?? null), this.displayValueModel instanceof _u && this.displayValueModel.updateParams(i, r), this.handler.refreshFilterValues(!0);
  }
  updateHandler(e) {
    var s;
    return this.handler !== e && ((s = this.handlerDestroyFuncs) == null || s.forEach((i) => i()), this.handlerDestroyFuncs = [
      ...this.addManagedListeners(e, {
        anyFilterChanged: (i) => {
          e.valueModel.allKeys.then((r) => {
            this.isAlive() && (this.updateDisplayedValues("otherFilter", r ?? []), i.updated && (this.checkAndRefreshVirtualList(), this.showOrHideResults()));
          });
        },
        dataChanged: ({ hardRefresh: i }) => {
          e.valueModel.allKeys.then((r) => {
            var n;
            this.isAlive() && (this.updateDisplayedValues("reload", r ?? []), this.setSelectedModel(((n = this.state.model) == null ? void 0 : n.values) ?? null), i && (this.hardRefreshVirtualList = !0), this.checkAndRefreshVirtualList());
          });
        }
      }),
      ...this.addManagedListeners(e.valueModel, {
        loadingStart: () => this.setIsLoading(!0),
        loadingEnd: () => this.setIsLoading(!1)
      })
    ], this.handler = e), e;
  }
  // unlike the simple filters, nothing in the set filter UI shows/hides.
  // maybe this method belongs in abstractSimpleFilter???
  updateUiVisibility() {
  }
  createBodyTemplate() {
    return {
      tag: "div",
      cls: "ag-set-filter",
      children: [
        {
          tag: "div",
          ref: "eFilterLoading",
          cls: "ag-filter-loading ag-loading ag-hidden",
          children: [
            { tag: "span", ref: "eFilterLoadingIcon", cls: "ag-loading-icon" },
            { tag: "span", cls: "ag-loading-text", children: ct(this, "loadingOoo") }
          ]
        },
        { tag: "ag-input-text-field", ref: "eMiniFilter", cls: "ag-mini-filter" },
        {
          tag: "div",
          ref: "eFilterNoMatches",
          cls: "ag-filter-no-matches ag-hidden",
          children: ct(this, "noMatches")
        },
        { tag: "div", ref: "eSetFilterList", cls: "ag-set-filter-list", role: "presentation" }
      ]
    };
  }
  getAgComponents() {
    return [It];
  }
  handleKeyDown(e) {
    var s, i, r;
    if (super.handleKeyDown(e), e.defaultPrevented)
      return;
    const t = () => {
      if (!this.eSetFilterList.contains(Q(this.beans)))
        return;
      const n = this.virtualList.getLastFocusedRow();
      if (n == null)
        return;
      const o = this.virtualList.getComponentAt(n);
      if (o == null)
        return;
      e.preventDefault();
      const { readOnly: a } = this.params;
      if (!a)
        return o;
    };
    switch (e.key) {
      case S.SPACE:
        (s = t()) == null || s.toggleSelected();
        break;
      case S.ENTER:
        this.handleKeyEnter(e);
        break;
      case S.LEFT:
        (i = t()) == null || i.setExpanded(!1);
        break;
      case S.RIGHT:
        (r = t()) == null || r.setExpanded(!0);
        break;
    }
  }
  handleKeyEnter(e) {
    e.preventDefault();
    const { excelMode: t, readOnly: s } = this.params;
    !t || s || (this.params.onAction("apply", void 0, e), this.params.excelMode === "mac" && this.eMiniFilter.getInputElement().select());
  }
  setModelAndRefresh(e) {
    return this.setSelectedModel(e).then(() => {
      this.isAlive() && this.checkAndRefreshVirtualList();
    });
  }
  setModelIntoUi(e) {
    var s;
    this.setMiniFilter(((s = this.params.state.state) == null ? void 0 : s.miniFilterValue) ?? null, !0);
    const t = e == null ? null : e.values;
    return this.setModelAndRefresh(t);
  }
  getModelFromUi() {
    const e = this.getSelectedModel();
    return e ? { values: e, filterType: this.filterType } : null;
  }
  areNonNullModelsEqual(e, t) {
    return Xe(e.values, t.values);
  }
  setIsLoading(e) {
    O(this.eFilterLoading, e), e || (this.hardRefreshVirtualList = !0);
  }
  initialiseFilterBodyUi() {
    this.initVirtualList(), this.initMiniFilter(), this.initLoading();
  }
  initLoading() {
    const e = N("setFilterLoading", this.beans, this.params.column);
    e && this.eFilterLoadingIcon.appendChild(e);
  }
  initVirtualList() {
    const e = ct(this, "ariaFilterList"), t = !!this.params.treeList, s = this.virtualList = this.createBean(
      new yr({
        cssIdentifier: "filter",
        ariaRole: t ? "tree" : "listbox",
        listName: e
      })
    ), i = this.eSetFilterList;
    t && i.classList.add("ag-set-filter-tree-list"), i.appendChild(s.getGui());
    const { cellHeight: r } = this.params;
    r != null && s.setRowHeight(r);
    const n = (a, l) => this.createSetListItem(a, t, l);
    s.setComponentCreator(n);
    const o = (a, l) => this.updateSetListItem(a, l);
    s.setComponentUpdater(o), this.createVirtualListModel(this.params);
  }
  createVirtualListModel(e) {
    let t;
    e.suppressSelectAll ? t = new cN(this.displayValueModel) : t = new dN(
      this.displayValueModel,
      this.showAddCurrentSelectionToFilter.bind(this)
    ), e.treeList && (t = new hN(t)), this.virtualList.setModel(t);
  }
  getSelectAllLabel() {
    const e = this.miniFilterText == null || !this.params.excelMode ? "selectAll" : "selectAllSearchResults";
    return ct(this, e);
  }
  getAddSelectionToFilterLabel() {
    return ct(this, "addCurrentSelectionToFilter");
  }
  createSetListItem(e, t, s) {
    const i = this.displayValueModel.hasGroups(), { isSelected: r, isExpanded: n } = this.isSelectedExpanded(e), { value: o, depth: a, isGroup: l, hasIndeterminateExpandState: c, selectedListener: d, expandedListener: h } = this.newSetListItemAttributes(e), u = {
      focusWrapper: s,
      value: o,
      params: this.params,
      translate: (p) => ct(this, p),
      valueFormatter: this.handler.valueFormatter,
      item: e,
      isSelected: r,
      isTree: t,
      depth: a,
      groupsExist: i,
      isGroup: l,
      isExpanded: n,
      hasIndeterminateExpandState: c
    }, g = this.createBean(new nN(u));
    return g.addEventListener("selectionChanged", d), h && g.addEventListener("expandedChanged", h), g;
  }
  newSetTreeItemAttributes(e) {
    var s, i, r, n;
    const t = this.displayValueModel.hasGroups();
    return e.key === gi ? {
      value: () => this.getSelectAllLabel(),
      isGroup: t,
      depth: e.depth,
      hasIndeterminateExpandState: !0,
      selectedListener: (o) => this.onSelectAll(o.isSelected),
      expandedListener: (o) => this.onExpandAll(o.item, o.isExpanded)
    } : e.key === pi ? {
      value: () => this.getAddSelectionToFilterLabel(),
      depth: e.depth,
      isGroup: !1,
      hasIndeterminateExpandState: !1,
      selectedListener: (o) => {
        this.addCurrentSelectionToFilter = o.isSelected, this.refreshAfterSelection();
      }
    } : e.children ? {
      value: ((i = (s = this.params).treeListFormatter) == null ? void 0 : i.call(s, e.treeKey, e.depth, e.parentTreeKeys)) ?? e.treeKey,
      depth: e.depth,
      isGroup: !0,
      selectedListener: (o) => this.onGroupItemSelected(o.item, o.isSelected),
      expandedListener: (o) => this.onExpandedChanged(o.item, o.isExpanded)
    } : {
      value: ((n = (r = this.params).treeListFormatter) == null ? void 0 : n.call(r, e.treeKey, e.depth, e.parentTreeKeys)) ?? e.treeKey,
      depth: e.depth,
      selectedListener: (o) => this.onItemSelected(o.item.key, o.isSelected)
    };
  }
  newSetListItemAttributes(e) {
    return this.isSetFilterModelTreeItem(e) ? this.newSetTreeItemAttributes(e) : e === gi ? {
      value: () => this.getSelectAllLabel(),
      selectedListener: (t) => this.onSelectAll(t.isSelected)
    } : e === pi ? {
      value: () => this.getAddSelectionToFilterLabel(),
      selectedListener: (t) => {
        this.addCurrentSelectionToFilter = t.isSelected, this.refreshAfterSelection();
      }
    } : {
      value: this.handler.valueModel.allValues.get(e) ?? null,
      selectedListener: (t) => this.onItemSelected(t.item, t.isSelected)
    };
  }
  updateSetListItem(e, t) {
    const { isSelected: s, isExpanded: i } = this.isSelectedExpanded(e);
    t.refresh(e, s, i);
  }
  isSelectedExpanded(e) {
    let t, s;
    return this.isSetFilterModelTreeItem(e) ? (s = e.expanded, e.key === gi ? t = this.isSelectAllSelected() : e.key === pi ? t = this.isAddCurrentSelectionToFilterChecked() : e.children ? t = this.areAllChildrenSelected(e) : t = this.selectedKeys.has(e.key)) : e === gi ? t = this.isSelectAllSelected() : e === pi ? t = this.isAddCurrentSelectionToFilterChecked() : t = this.selectedKeys.has(e), { isSelected: t, isExpanded: s };
  }
  isSetFilterModelTreeItem(e) {
    return (e == null ? void 0 : e.treeKey) !== void 0;
  }
  initMiniFilter() {
    const { eMiniFilter: e } = this;
    this.updateMiniFilter(), e.onValueChange(() => this.onMiniFilterInput()), e.setInputAriaLabel(ct(this, "ariaSearchFilterValues")), this.addManagedElementListeners(e.getInputElement(), {
      keydown: (t) => this.onMiniFilterKeyDown(t)
    });
  }
  updateMiniFilter() {
    const { eMiniFilter: e, miniFilterText: t, params: s } = this;
    e.setDisplayed(!s.suppressMiniFilter), e.setValue(t);
  }
  // we need to have the GUI attached before we can draw the virtual rows, as the
  // virtual row logic needs info about the GUI state
  afterGuiAttached(e) {
    super.afterGuiAttached(e), this.resetExpansion(), this.refreshVirtualList();
    const { eMiniFilter: t } = this;
    t.setInputPlaceholder(ct(this, "searchOoo")), (!e || !e.suppressFocus) && (t.isDisplayed() ? t.getFocusableElement().focus() : this.virtualList.awaitStable(() => this.virtualList.focusRow(0)));
  }
  afterGuiDetached() {
    var r;
    super.afterGuiDetached();
    const { column: e, excelMode: t, model: s, onStateChange: i } = this.params;
    (r = this.beans.colFilter) != null && r.shouldKeepStateOnDetach(e) || (t && this.resetMiniFilter(), (t || s !== this.state.model) && (i({
      model: s,
      state: this.getState()
    }), this.showOrHideResults()));
  }
  canApply(e) {
    return this.params.excelMode ? e == null || e.values.length > 0 : !0;
  }
  /**
   * @deprecated v34 Internal method - should only be called by the grid.
   */
  onNewRowsLoaded() {
  }
  /**
   * @deprecated v34 Use the same method on the filter handler (`api.getColumnFilterHandler()`) instead.
   */
  setFilterValues(e) {
    F(283), this.handler.setFilterValues(e);
  }
  /**
   * @deprecated v34 Use the same method on the filter handler (`api.getColumnFilterHandler()`) instead.
   */
  resetFilterValues() {
    F(283), this.handler.resetFilterValues();
  }
  /**
   * @deprecated v34 Use the same method on the filter handler (`api.getColumnFilterHandler()`) instead.
   */
  refreshFilterValues() {
    F(283), this.doRefreshFilterValues();
  }
  doRefreshFilterValues() {
    this.handler.refreshFilterValues();
  }
  /**
   * @deprecated v34 Internal method - should only be called by the grid.
   */
  onAnyFilterChanged() {
  }
  onMiniFilterInput(e) {
    if (!this.doSetMiniFilter(this.eMiniFilter.getValue()))
      return;
    if (e) {
      this.showOrHideResults();
      return;
    }
    const { applyMiniFilterWhileTyping: t, readOnly: s, excelMode: i } = this.params, r = !s && (t || !!i), n = t && !s ? "debounce" : void 0;
    this.updateUiAfterMiniFilterChange(r, n);
  }
  updateUiAfterMiniFilterChange(e, t) {
    if (e) {
      const { excelMode: s, readOnly: i, model: r } = this.params;
      s && !i && this.miniFilterText == null ? this.setModelAndRefresh((r == null ? void 0 : r.values) ?? null) : this.selectAllMatchingMiniFilter(!0);
    }
    this.checkAndRefreshVirtualList(), this.onUiChanged(e ? t : "prevent"), this.showOrHideResults();
  }
  showOrHideResults() {
    const e = this.miniFilterText != null && this.displayValueModel.getDisplayedValueCount() < 1;
    O(this.eFilterNoMatches, e), O(this.eSetFilterList, !e);
  }
  resetMiniFilter() {
    this.eMiniFilter.setValue(null, !0), this.doSetMiniFilter(null);
  }
  onMiniFilterKeyDown(e) {
    const { excelMode: t, readOnly: s } = this.params;
    e.key === S.ENTER && !t && !s && this.updateUiAfterMiniFilterChange(!0, "immediately");
  }
  focusRowIfAlive(e) {
    return e == null ? Promise.resolve() : new Promise((t) => {
      window.setTimeout(() => {
        this.isAlive() && this.virtualList.focusRow(e), t();
      }, 0);
    });
  }
  onSelectAll(e) {
    e ? this.selectAllMatchingMiniFilter() : this.deselectAllMatchingMiniFilter(), this.refreshAfterSelection();
  }
  onGroupItemSelected(e, t) {
    const s = (i) => {
      if (!i.filterPasses)
        return;
      const r = i.children;
      if (r)
        for (const n of r.values())
          s(n);
      else
        this.setKeySelected(i.key, t);
    };
    s(e), this.refreshAfterSelection();
  }
  onItemSelected(e, t) {
    this.setKeySelected(e, t), this.refreshAfterSelection();
  }
  onExpandAll(e, t) {
    const s = (i) => {
      if (i.filterPasses && i.available && i.children) {
        for (const r of i.children.values())
          s(r);
        i.expanded = t;
      }
    };
    s(e), this.refreshAfterExpansion();
  }
  onExpandedChanged(e, t) {
    e.expanded = t, this.refreshAfterExpansion();
  }
  refreshAfterExpansion() {
    const e = this.virtualList.getLastFocusedRow();
    this.updateDisplayedValues("expansion"), this.checkAndRefreshVirtualList(), this.focusRowIfAlive(e);
  }
  refreshAfterSelection() {
    const e = this.virtualList.getLastFocusedRow();
    this.checkAndRefreshVirtualList(), this.onUiChanged(), this.focusRowIfAlive(e);
  }
  setMiniFilter(e, t) {
    this.eMiniFilter.setValue(e, t), this.onMiniFilterInput(t);
  }
  /** Sets mini filter value. Returns true if it changed from last value, otherwise false. */
  doSetMiniFilter(e) {
    return e = Ce(e), this.miniFilterText === e ? !1 : (e === null && (this.addCurrentSelectionToFilter = !1), this.miniFilterText = e, this.updateDisplayedValues("miniFilter"), !0);
  }
  getMiniFilter() {
    return this.miniFilterText;
  }
  getUiChangeEventParams() {
    return {
      miniFilterValue: this.miniFilterText
    };
  }
  getState() {
    const e = this.miniFilterText;
    return e ? { miniFilterValue: e } : void 0;
  }
  checkAndRefreshVirtualList() {
    this.virtualList.refresh(!this.hardRefreshVirtualList), this.hardRefreshVirtualList && (this.hardRefreshVirtualList = !1);
  }
  /**
   * @deprecated v34 Use the same method on the filter handler (`api.getColumnFilterHandler()`) instead.
   */
  getFilterKeys() {
    return F(283), this.handler.getFilterKeys();
  }
  /**
   * @deprecated v34 Use the same method on the filter handler (`api.getColumnFilterHandler()`) instead.
   */
  getFilterValues() {
    return F(283), this.handler.getFilterValues();
  }
  refreshVirtualList() {
    this.params.refreshValuesOnOpen ? this.doRefreshFilterValues() : this.checkAndRefreshVirtualList();
  }
  isSelectAllSelected() {
    if (this.params.defaultToNothingSelected) {
      if (this.hasSelections() && this.isEverythingVisibleSelected())
        return !0;
      if (this.isNothingVisibleSelected())
        return !1;
    } else {
      if (this.hasSelections() && this.isNothingVisibleSelected())
        return !1;
      if (this.isEverythingVisibleSelected())
        return !0;
    }
  }
  areAllChildrenSelected(e) {
    const t = (s) => {
      if (s.children) {
        let i = !1, r = !1;
        for (const n of s.children.values()) {
          if (!n.filterPasses || !n.available)
            continue;
          const o = t(n);
          if (o === void 0 || (o ? i = !0 : r = !0, i && r))
            return;
        }
        return i;
      } else
        return this.selectedKeys.has(s.key);
    };
    return this.params.defaultToNothingSelected ? this.hasSelections() && t(e) : t(e);
  }
  resetExpansion() {
    if (!this.params.treeList)
      return;
    const e = this.displayValueModel.getSelectAllItem();
    if (this.isSetFilterModelTreeItem(e)) {
      const t = (s) => {
        const i = s.children;
        if (i) {
          for (const r of i.values())
            t(r);
          s.expanded = !1;
        }
      };
      t(e), this.updateDisplayedValues("expansion");
    }
  }
  getModelAsString(e) {
    return this.handler.getModelAsString(e);
  }
  getPositionableElement() {
    return this.eSetFilterList;
  }
  updateDisplayedValues(e, t) {
    if (e === "expansion") {
      this.displayValueModel.refresh();
      return;
    }
    const s = this.handler, i = s.valueModel;
    if (this.miniFilterText == null) {
      this.displayValueModel.updateDisplayedValuesToAllAvailable(
        (a) => i.allValues.get(a) ?? null,
        t,
        i.availableKeys,
        e
      );
      return;
    }
    const r = s.caseFormat(this.formatter(this.miniFilterText) || ""), n = (a) => a != null && s.caseFormat(a).indexOf(r) >= 0, o = !!this.params.excelMode && n(ct(this, "blanks"));
    this.displayValueModel.updateDisplayedValuesToMatchMiniFilter(
      (a) => i.allValues.get(a) ?? null,
      t,
      i.availableKeys,
      n,
      o,
      e
    );
  }
  hasSelections() {
    return this.params.defaultToNothingSelected ? this.selectedKeys.size > 0 : this.handler.valueModel.allValues.size !== this.selectedKeys.size;
  }
  isInWindowsExcelMode() {
    return this.params.excelMode === "windows";
  }
  isAddCurrentSelectionToFilterChecked() {
    return this.isInWindowsExcelMode() && this.addCurrentSelectionToFilter;
  }
  showAddCurrentSelectionToFilter() {
    return this.isInWindowsExcelMode() && A(this.miniFilterText) && this.miniFilterText.length > 0;
  }
  selectAllMatchingMiniFilter(e = !1) {
    this.miniFilterText == null ? this.selectedKeys = new Set(this.handler.valueModel.allValues.keys()) : (e && this.selectedKeys.clear(), this.displayValueModel.forEachDisplayedKey((t) => this.selectedKeys.add(t)));
  }
  deselectAllMatchingMiniFilter() {
    this.miniFilterText == null ? this.selectedKeys.clear() : this.displayValueModel.forEachDisplayedKey((e) => this.selectedKeys.delete(e));
  }
  setKeySelected(e, t) {
    t ? this.selectedKeys.add(e) : (this.params.excelMode && this.isEverythingVisibleSelected() && this.resetSelectionState(this.displayValueModel.getDisplayedKeys()), this.selectedKeys.delete(e));
  }
  isEverythingVisibleSelected() {
    return !this.displayValueModel.someDisplayedKey((e) => !this.selectedKeys.has(e));
  }
  isNothingVisibleSelected() {
    return !this.displayValueModel.someDisplayedKey((e) => this.selectedKeys.has(e));
  }
  getSelectedModel() {
    var t;
    if (!this.hasSelections())
      return null;
    const e = this.isAddCurrentSelectionToFilterChecked() ? (t = this.params.model) == null ? void 0 : t.values : void 0;
    if (e != null && e.length) {
      if (this.selectedKeys) {
        const s = /* @__PURE__ */ new Set([...e, ...this.selectedKeys]);
        return Array.from(s);
      }
      return Array.from(e);
    }
    return Array.from(this.selectedKeys);
  }
  setSelectedModel(e) {
    const t = this.handler, s = t.valueModel;
    return s.allKeys.then((i) => {
      if (e == null)
        this.resetSelectionState(i ?? []);
      else {
        this.selectedKeys.clear();
        const r = /* @__PURE__ */ new Map();
        s.allValues.forEach((n, o) => {
          r.set(t.caseFormat(o), o);
        }), e.forEach((n) => {
          const o = t.caseFormat(Ce(n)), a = r.get(o);
          a !== void 0 && this.selectedKeys.add(a);
        });
      }
    });
  }
  resetSelectionState(e) {
    this.params.defaultToNothingSelected ? this.selectedKeys.clear() : this.selectedKeys = new Set(e);
  }
  getFilterHandler() {
    return this.handler;
  }
  destroy() {
    var e;
    this.virtualList = this.destroyBean(this.virtualList), (e = this.handlerDestroyFuncs) == null || e.forEach((t) => t()), this.handler = void 0, this.displayValueModel = void 0, this.selectedKeys.clear(), super.destroy();
  }
}, cN = class {
  constructor(e) {
    this.model = e;
  }
  getRowCount() {
    return this.model.getDisplayedValueCount();
  }
  getRow(e) {
    return this.model.getDisplayedItem(e);
  }
  areRowsEqual(e, t) {
    return e === t;
  }
}, dN = class {
  constructor(e, t) {
    this.model = e, this.showAddCurrentSelectionToFilter = t;
  }
  getRowCount() {
    const t = this.showAddCurrentSelectionToFilter() ? 2 : 1;
    return this.model.getDisplayedValueCount() + t;
  }
  getRow(e) {
    if (e === 0)
      return this.model.getSelectAllItem();
    const t = this.showAddCurrentSelectionToFilter(), s = t ? 2 : 1;
    return e === 1 && t ? this.model.getAddSelectionToFilterItem() : this.model.getDisplayedItem(e - s);
  }
  areRowsEqual(e, t) {
    return e === t;
  }
}, hN = class {
  constructor(e) {
    this.model = e;
  }
  getRowCount() {
    return this.model.getRowCount();
  }
  getRow(e) {
    return this.model.getRow(e);
  }
  areRowsEqual(e, t) {
    return e == null && t == null ? !0 : e != null && t != null && e.treeKey === t.treeKey && e.depth === t.depth;
  }
}, uN = class extends R {
  constructor(e, t, s, i, r) {
    super(), this.createKey = e, this.caseFormat = t, this.getValue = s, this.isTreeDataOrGrouping = i, this.isTreeData = r;
  }
  extractUniqueValuesAsync(e, t) {
    return new U((s) => {
      if (this.beans.rowModel.isRowDataLoaded())
        s(this.extractUniqueValues(e, t));
      else {
        const [i] = this.addManagedEventListeners({
          rowCountReady: () => {
            i == null || i(), s(this.extractUniqueValues(e, t));
          }
        });
      }
    });
  }
  extractUniqueValues(e, t) {
    var d;
    const s = /* @__PURE__ */ new Map(), i = this.extractExistingFormattedKeys(t), r = /* @__PURE__ */ new Set(), n = this.isTreeData(), o = this.isTreeDataOrGrouping(), a = (d = this.beans.rowGroupColsSvc) == null ? void 0 : d.columns, l = this.gos.get("groupAllowUnbalanced"), c = (h, u) => {
      const g = this.caseFormat(h);
      if (!r.has(g)) {
        r.add(g);
        let p = h, f = Ce(u);
        const m = i == null ? void 0 : i.get(g);
        m != null && (p = m, f = t.get(m)), s.set(p, f);
      }
    };
    return this.beans.rowModel.forEachLeafNode((h) => {
      if (!h.data || !e(h))
        return;
      if (o) {
        this.addValueForTreeDataOrGrouping(h, n, a, c, l);
        return;
      }
      const u = this.getValue(h);
      u != null && Array.isArray(u) ? (u.forEach((g) => {
        c(this.createKey(g, h), g);
      }), u.length === 0 && c(null, null)) : c(this.createKey(u, h), u);
    }), s;
  }
  addValueForTreeDataOrGrouping(e, t, s = [], i, r) {
    var a;
    let n;
    if (t) {
      if ((a = e.childrenAfterGroup) != null && a.length)
        return;
      n = e.getRoute() ?? [e.key ?? e.id];
    } else
      n = s.map((l) => this.beans.valueSvc.getKeyForNode(l, e)), n.push(this.getValue(e));
    const o = Pc(n, t, r);
    i(this.createKey(o), o);
  }
  extractExistingFormattedKeys(e) {
    if (!e)
      return null;
    const t = /* @__PURE__ */ new Map();
    return e.forEach((s, i) => {
      t.set(this.caseFormat(i), i);
    }), t;
  }
}, gN = class {
  constructor(e) {
    this.caseFormat = e, this.keys = null;
  }
  /** No model applied */
  isNull() {
    return this.keys == null;
  }
  /** Nothing selected */
  isEmpty() {
    var e;
    return !((e = this.keys) != null && e.size);
  }
  update(e) {
    const t = /* @__PURE__ */ new Set();
    this.keys = t;
    const s = e == null ? void 0 : e.values;
    if (s) {
      const i = this.caseFormat;
      for (let r = 0, n = s.length; r < n; r++)
        t.add(i(s[r]));
    }
  }
  has(e) {
    var t;
    return !!((t = this.keys) != null && t.has(this.caseFormat(e)));
  }
  destroy() {
    this.keys = null;
  }
}, WC = /* @__PURE__ */ ((e) => (e[e.PROVIDED_LIST = 0] = "PROVIDED_LIST", e[e.PROVIDED_CALLBACK = 1] = "PROVIDED_CALLBACK", e[e.TAKEN_FROM_GRID_VALUES = 2] = "TAKEN_FROM_GRID_VALUES", e))(WC || {}), Rl = WC, pN = class extends R {
  constructor(e, t, s, i, r) {
    super(), this.clientSideValuesExtractor = e, this.caseFormat = t, this.createKey = s, this.isTreeDataOrGrouping = i, this.params = r, this.allValues = /* @__PURE__ */ new Map(), this.availableKeys = /* @__PURE__ */ new Set(), this.providedValues = null, this.initialised = !1;
  }
  postConstruct() {
    const e = this.params, t = e.handlerParams.filterParams.values;
    this.updateParams(e), t == null ? this.valuesType = 2 : (this.valuesType = Array.isArray(t) ? 0 : 1, this.providedValues = t), this.updateAllValues();
  }
  refresh(e) {
    const t = e.handlerParams;
    if (t.source !== "colDef")
      return;
    const { values: s, suppressSorting: i } = t.filterParams, r = this.providedValues, n = this.params.handlerParams.filterParams.suppressSorting;
    this.params = e, this.updateParams(e), this.providedValues = s ?? null, (this.providedValues !== r || i !== n) && (!s || s.length === 0 ? (this.valuesType = 2, this.providedValues = null) : this.valuesType = Array.isArray(s) ? 0 : 1, this.updateAllValues());
  }
  updateParams(e) {
    const {
      handlerParams: {
        colDef: t,
        filterParams: { comparator: s, treeList: i, treeListPathGetter: r }
      },
      usingComplexObjects: n
    } = e, o = s ?? t.comparator, a = this.isTreeDataOrGrouping();
    let l;
    a && !o ? l = lN() : i && !r && !o ? l = ([c, d], [h, u]) => vo(d, u) : l = ([c, d], [h, u]) => o(d, u), this.entryComparator = l, this.keyComparator = o ?? vo, this.compareByValue = !!(n && o || a || i && !r);
  }
  updateAllValues() {
    return this.allKeys = new U((e) => {
      switch (this.valuesType) {
        case 2:
          this.getValuesFromRowsAsync().then((t) => e(this.processAllValues(t)));
          break;
        case 0: {
          e(
            this.processAllValues(
              this.uniqueValues(this.validateProvidedValues(this.providedValues))
            )
          );
          break;
        }
        case 1: {
          this.dispatchLocalEvent({ type: "loadingStart" });
          const t = this.providedValues, { column: s, colDef: i } = this.params.handlerParams, r = V(this.gos, {
            success: (n) => {
              this.dispatchLocalEvent({ type: "loadingEnd" }), e(this.processAllValues(this.uniqueValues(this.validateProvidedValues(n))));
            },
            colDef: i,
            column: s
          });
          window.setTimeout(() => t(r), 0);
          break;
        }
      }
    }), this.allKeys.then((e) => {
      this.updateAvailableKeys(e ?? []), this.initialised = !0;
    }), this.allKeys;
  }
  getAvailableValues(e) {
    return this.sortKeys(this.getValuesFromRows(e));
  }
  overrideValues(e) {
    return this.allKeys.then(() => {
      this.valuesType = 0, this.providedValues = e;
    });
  }
  refreshAvailable() {
    return new U((e) => {
      if (this.showAvailableOnly()) {
        this.allKeys.then((t) => {
          const s = t ?? [];
          this.updateAvailableKeys(s), e(!0);
        });
        return;
      }
      e(!1);
    });
  }
  refreshAll() {
    return new U((e) => {
      this.allKeys.then(() => {
        this.updateAllValues().then(() => {
          e();
        });
      });
    });
  }
  isLoading() {
    return !this.initialised && this.valuesType === 1;
  }
  isInitialised() {
    return this.initialised;
  }
  getValueForFormatter(e) {
    return this.initialised ? this.allValues.get(e) : e;
  }
  getAvailableKeys(e) {
    return this.initialised ? e.filter((t) => this.availableKeys.has(t)) : e;
  }
  getParamsForValuesFromRows(e) {
    if (!this.clientSideValuesExtractor) {
      j(113);
      return;
    }
    return e && !this.params.handlerParams.filterParams.caseSensitive ? this.allValues : void 0;
  }
  getValuesFromRows(e) {
    var s;
    const t = this.getParamsForValuesFromRows(!0);
    return ((s = this.clientSideValuesExtractor) == null ? void 0 : s.extractUniqueValues(e, t)) ?? null;
  }
  getValuesFromRowsAsync() {
    var t;
    const e = this.getParamsForValuesFromRows(!1);
    return ((t = this.clientSideValuesExtractor) == null ? void 0 : t.extractUniqueValuesAsync(() => !0, e)) ?? U.resolve(null);
  }
  processAllValues(e) {
    const t = this.sortKeys(e);
    return this.allValues = e ?? /* @__PURE__ */ new Map(), t;
  }
  uniqueValues(e) {
    const t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), { caseFormat: i, createKey: r } = this;
    return (e ?? []).forEach((n) => {
      const o = Ce(n), a = r(o), l = i(a);
      s.has(l) || (s.add(l), t.set(a, o));
    }), t;
  }
  validateProvidedValues(e) {
    if (this.params.usingComplexObjects && (e != null && e.length)) {
      const t = e[0];
      t && typeof t != "object" && typeof t != "function" && (this.createKey(t) == null ? F(209) : F(210));
    }
    return e;
  }
  sortKeys(e) {
    const t = e ?? /* @__PURE__ */ new Map(), s = this.params.handlerParams.filterParams;
    if (s.suppressSorting)
      return Array.from(t.keys());
    let i;
    return this.compareByValue ? i = Array.from(t.entries()).sort(this.entryComparator).map(([r]) => r) : i = Array.from(t.keys()).sort(this.keyComparator), s.excelMode && t.has(null) && (i = i.filter((r) => r != null), i.push(null)), i;
  }
  showAvailableOnly() {
    return this.valuesType === 2;
  }
  updateAvailableKeys(e) {
    const t = this.showAvailableOnly() ? this.getAvailableValues((s) => this.params.handlerParams.doesRowPassOtherFilter(s)) : e;
    this.availableKeys = new Set(t), this.dispatchLocalEvent({ type: "availableValuesChanged" });
  }
}, fN = class extends R {
  constructor() {
    super(...arguments), this.filterType = "set", this.treeDataTreeList = !1, this.groupingTreeList = !1, this.caseSensitive = !1, this.noValueFormatterSupplied = !1;
  }
  init(e) {
    this.updateParams(e);
    const t = this.isTreeDataOrGrouping.bind(this), s = () => this.treeDataTreeList, i = this.createKey, r = this.caseFormat.bind(this), { gos: n, beans: o } = this, a = te(n, o.rowModel) ? this.createManagedBean(
      new uN(
        i,
        r,
        e.getValue,
        t,
        s
      )
    ) : void 0;
    this.valueModel = this.createManagedBean(
      new pN(a, r, i, t, {
        handlerParams: e,
        usingComplexObjects: !!(e.filterParams.keyCreator ?? e.colDef.keyCreator)
      })
    ), this.appliedModel = new gN(this.caseFormat.bind(this)), this.appliedModel.update(e.model), this.validateModel(e), this.addEventListenersForDataChanges();
  }
  refresh(e) {
    this.updateParams(e), this.valueModel.refresh({
      handlerParams: e,
      usingComplexObjects: !!(e.filterParams.keyCreator ?? e.colDef.keyCreator)
    }), this.appliedModel.update(e.model), this.validateModel(e);
  }
  updateParams(e) {
    var l;
    this.params = e;
    const {
      colDef: t,
      filterParams: { caseSensitive: s, treeList: i, keyCreator: r, valueFormatter: n }
    } = e;
    this.caseSensitive = !!s;
    const o = !!t.showRowGroup;
    this.treeDataTreeList = this.gos.get("treeData") && !!i && o, this.groupingTreeList = !!((l = this.beans.rowGroupColsSvc) != null && l.columns.length) && !!i && o;
    const a = r ?? t.keyCreator;
    this.createKey = this.generateCreateKey(a, this.isTreeDataOrGrouping()), this.setValueFormatter(n, a, !!i, !!t.refData);
  }
  doesFilterPass(e) {
    const { appliedModel: t, treeDataTreeList: s, groupingTreeList: i } = this;
    if (t.isNull())
      return !0;
    if (t.isEmpty())
      return !1;
    const { node: r } = e;
    if (s)
      return this.doesFilterPassForTreeData(r);
    if (i)
      return this.doesFilterPassForGrouping(r);
    const n = this.params.getValue(r);
    return n != null && Array.isArray(n) ? n.length === 0 ? t.has(null) : n.some((o) => t.has(this.createKey(o, r))) : t.has(this.createKey(n, r));
  }
  getFormattedValue(e) {
    let t = this.valueModel.getValueForFormatter(e);
    this.noValueFormatterSupplied && this.isTreeDataOrGrouping() && Array.isArray(t) && (t = _(t));
    const s = this.beans.valueSvc.formatValue(
      this.params.column,
      null,
      t,
      this.valueFormatter,
      !1
    );
    return s ?? ut(t) ?? ct(this, "blanks");
  }
  getModelAsString(e, t) {
    const { values: s } = e ?? {}, i = t === "filterToolPanel";
    if (s == null)
      return i ? ct(this, "filterSummaryListInactive") : "";
    const r = this.valueModel.getAvailableKeys(s), n = r.length, o = i ? 3 : 10, a = r.slice(0, o).map((l) => this.getFormattedValue(l));
    if (i) {
      const l = a.join(ct(this, "filterSummaryListSeparator"));
      return n > 3 ? ct(this, "filterSummaryListLong", [l, String(n - 3)]) : ct(this, "filterSummaryListShort", [l]);
    }
    return `(${n}) ${a.join(",")}${n > 10 ? ",..." : ""}`;
  }
  onAnyFilterChanged() {
    window.setTimeout(() => {
      this.isAlive() && this.valueModel.refreshAvailable().then((e) => {
        this.dispatchLocalEvent({ type: "anyFilterChanged", updated: !!e });
      });
    });
  }
  onNewRowsLoaded() {
    this.syncAfterDataChange();
  }
  setFilterValues(e) {
    this.valueModel.overrideValues(e).then(() => {
      this.refreshFilterValues();
    });
  }
  resetFilterValues() {
    this.valueModel.valuesType = Rl.TAKEN_FROM_GRID_VALUES, this.syncAfterDataChange();
  }
  /**
   * @param suppressAvailableValuesCheck when refreshing values via the API, the model will be reset if all available values are selected.
   * When refreshing due to internal changes, set this to `true` to do the reset check based on all values instead.
   */
  refreshFilterValues(e) {
    this.valueModel.isInitialised() && this.valueModel.refreshAll().then(() => {
      this.dispatchLocalEvent({ type: "dataChanged", hardRefresh: !0 }), this.validateModel(this.params, void 0, !e);
    });
  }
  getFilterKeys() {
    return Array.from(this.valueModel.allValues.keys());
  }
  getFilterValues() {
    return Array.from(this.valueModel.allValues.values());
  }
  isTreeDataOrGrouping() {
    return this.treeDataTreeList || this.groupingTreeList;
  }
  caseFormat(e) {
    return e == null || typeof e != "string" || this.caseSensitive ? e : e.toUpperCase();
  }
  addEventListenersForDataChanges() {
    this.addManagedPropertyListeners(["groupAllowUnbalanced"], () => this.syncAfterDataChange());
    const e = pe(this, this.syncAfterDataChange.bind(this), 0);
    this.addManagedEventListeners({
      cellValueChanged: (t) => {
        t.column === this.params.column && e();
      }
    });
  }
  syncAfterDataChange() {
    this.isValuesTakenFromGrid() && this.valueModel.refreshAll().then(() => {
      this.dispatchLocalEvent({ type: "dataChanged" }), this.validateModel(this.params, { afterDataChange: !0 });
    });
  }
  validateModel(e, t, s) {
    const i = this.valueModel;
    i.allKeys.then(() => {
      const r = e.model;
      if (r == null)
        return;
      const n = /* @__PURE__ */ new Map(), o = (u) => n.set(this.caseFormat(u), u);
      if (s)
        for (const u of i.availableKeys)
          o(u);
      else
        i.allValues.forEach((u, g) => o(g));
      const a = [];
      let l = !1;
      for (const u of r.values) {
        const g = this.caseFormat(Ce(u)), p = n.get(g);
        p !== void 0 ? (a.push(p), p !== u && (l = !0)) : l = !0;
      }
      const c = a.length;
      if (c === 0 && e.filterParams.excelMode) {
        e.onModelChange(null, t);
        return;
      }
      const h = (this.valueModel.valuesType === Rl.TAKEN_FROM_GRID_VALUES || !e.filterParams.suppressClearModelOnRefreshValues) && c === n.size;
      if (l || !r.filterType || h) {
        const u = h ? null : { filterType: this.filterType, values: a };
        e.onModelChange(u, t);
        return;
      }
    });
  }
  isValuesTakenFromGrid() {
    return this.valueModel.valuesType === Rl.TAKEN_FROM_GRID_VALUES;
  }
  doesFilterPassForTreeData(e) {
    var i;
    if ((i = e.childrenAfterGroup) != null && i.length)
      return !1;
    const { gos: t, appliedModel: s } = this;
    return s.has(
      this.createKey(
        Pc(
          e.getRoute() ?? [e.key ?? e.id],
          !0,
          t.get("groupAllowUnbalanced")
        )
      )
    );
  }
  doesFilterPassForGrouping(e) {
    const {
      appliedModel: t,
      params: s,
      gos: i,
      beans: { rowGroupColsSvc: r, valueSvc: n }
    } = this, o = ((r == null ? void 0 : r.columns) ?? []).map((a) => n.getKeyForNode(a, e));
    return o.push(s.getValue(e)), t.has(
      this.createKey(Pc(o, !1, i.get("groupAllowUnbalanced")))
    );
  }
  generateCreateKey(e, t) {
    return t && !e ? (j(250), () => null) : e ? (s, i = null) => {
      const r = this.getKeyCreatorParams(s, i);
      return Ce(e(r));
    } : (s) => Ce(ut(s));
  }
  getKeyCreatorParams(e, t = null) {
    const { colDef: s, column: i } = this.params;
    return V(this.gos, {
      value: e,
      colDef: s,
      column: i,
      node: t,
      data: t == null ? void 0 : t.data
    });
  }
  setValueFormatter(e, t, s, i) {
    let r = e;
    if (!r) {
      if (t && !s) {
        j(249);
        return;
      }
      this.noValueFormatterSupplied = !0, i || (r = (n) => ut(n.value));
    }
    this.valueFormatter = r;
  }
  getCrossFilterModel(e) {
    var r;
    const { createKey: t, valueModel: s, params: i } = this;
    return e(t, s.availableKeys, (r = i.model) == null ? void 0 : r.values);
  }
  destroy() {
    this.appliedModel.destroy(), super.destroy(), this.valueModel = void 0;
  }
}, mN = {
  tag: "div",
  cls: "ag-floating-filter-input ag-set-floating-filter-input",
  role: "presentation",
  children: [
    {
      tag: "ag-input-text-field",
      ref: "eFloatingFilterText"
    }
  ]
}, CN = class extends D {
  constructor() {
    super(mN, [It]), this.eFloatingFilterText = x, this.listenerAdded = !1;
  }
  init(e) {
    this.params = e, this.eFloatingFilterText.setDisabled(!0).addGuiEventListener("click", () => this.params.showParentFilter()), this.setParams(e);
  }
  setParams(e) {
    const t = this.beans.colNames.getDisplayNameForColumn(e.column, "header", !0), s = this.getLocaleTextFunc();
    if (this.eFloatingFilterText.setInputAriaLabel(`${t} ${s("ariaFilterInput", "Filter Input")}`), this.gos.get("enableFilterHandlers")) {
      const i = e;
      this.updateFloatingFilterText(i.model);
    }
  }
  refresh(e) {
    this.params = e, this.setParams(e);
  }
  onParentModelChanged(e) {
    this.updateFloatingFilterText(e);
  }
  parentSetFilterInstance(e) {
    this.params.parentFilterInstance((t) => {
      if (!(t instanceof zC)) {
        j(248);
        return;
      }
      e(t);
    });
  }
  addAvailableValuesListener() {
    const e = (t) => {
      if (t == null || !t.isAlive())
        return;
      const s = t.valueModel;
      this.destroyListeners = s.addManagedListeners(s, {
        availableValuesChanged: () => this.updateFloatingFilterText(t.params.model),
        destroyed: () => {
          this.listenerAdded = !1, this.destroyListeners = void 0;
        }
      });
    };
    this.gos.get("enableFilterHandlers") ? e(this.params.getHandler()) : this.parentSetFilterInstance((t) => {
      e(t.handler);
    }), this.listenerAdded = !0;
  }
  updateFloatingFilterText(e) {
    var t, s;
    e == null ? this.eFloatingFilterText.setValue("") : (this.listenerAdded || this.addAvailableValuesListener(), this.gos.get("enableFilterHandlers") ? this.eFloatingFilterText.setValue(
      ((s = (t = this.params.getHandler()).getModelAsString) == null ? void 0 : s.call(t, e)) ?? ""
    ) : this.parentSetFilterInstance((i) => {
      this.eFloatingFilterText.setValue(i.getModelAsString(e));
    }));
  }
  destroy() {
    const e = this.destroyListeners;
    e && (e.forEach((t) => t()), e.length = 0), super.destroy();
  }
}, vN = {
  moduleName: "SetFilter",
  version: Y,
  userComponents: {
    agSetColumnFilter: {
      classImp: zC,
      params: {
        useForm: !0
      },
      processParams: (e) => (aN(e), e)
    },
    agSetColumnFloatingFilter: CN
  },
  dynamicBeans: {
    agSetColumnFilterHandler: fN
  },
  icons: {
    // set filter tree list group contracted (click to expand)
    setFilterGroupClosed: "tree-closed",
    // set filter tree list group expanded (click to contract)
    setFilterGroupOpen: "tree-open",
    // set filter tree list expand/collapse all button, shown when some children are expanded and
    //     others are collapsed
    setFilterGroupIndeterminate: "tree-indeterminate",
    // set filter async values loading
    setFilterLoading: "loading"
  },
  dependsOn: [ie, Ls]
}, wN = (
  /*css*/
  ".ag-status-bar{border-top:var(--ag-footer-row-border);display:flex;justify-content:space-between;line-height:1.5;overflow:hidden;padding-left:calc(var(--ag-spacing)*4);padding-right:calc(var(--ag-spacing)*4)}.ag-status-panel,:where(.ag-status-panel.ag-status-panel-aggregations .ag-status-name-value){display:inline-flex}.ag-status-name-value{color:var(--ag-status-bar-label-color);font-weight:var(--ag-status-bar-label-font-weight);margin-left:var(--ag-spacing);margin-right:var(--ag-spacing);padding-bottom:var(--ag-widget-container-vertical-padding);padding-top:var(--ag-widget-container-vertical-padding);white-space:nowrap}.ag-status-name-value-value{color:var(--ag-status-bar-value-color);font-weight:var(--ag-status-bar-value-font-weight)}.ag-status-bar-left{display:inline-flex}.ag-status-bar-center{display:inline-flex;text-align:center}.ag-status-bar-right{display:inline-flex}"
);
function bN(e, t, s) {
  return e.getCompDetails(t, yN, void 0, s, !0);
}
var yN = {
  name: "statusPanel",
  optionalMethods: ["refresh"]
}, SN = {
  tag: "div",
  cls: "ag-status-bar",
  children: [
    {
      tag: "div",
      ref: "eStatusBarLeft",
      cls: "ag-status-bar-left",
      role: "status"
    },
    {
      tag: "div",
      ref: "eStatusBarCenter",
      cls: "ag-status-bar-center",
      role: "status"
    },
    {
      tag: "div",
      ref: "eStatusBarRight",
      cls: "ag-status-bar-right",
      role: "status"
    }
  ]
}, xN = class extends D {
  constructor() {
    super(SN), this.updateQueued = !1, this.panelsPromise = U.resolve(), this.eStatusBarLeft = x, this.eStatusBarCenter = x, this.eStatusBarRight = x, this.compDestroyFunctions = {}, this.registerCSS(wN);
  }
  wireBeans(e) {
    this.userCompFactory = e.userCompFactory, this.statusBarSvc = e.statusBarSvc;
  }
  postConstruct() {
    this.processStatusPanels(/* @__PURE__ */ new Map()), this.addManagedPropertyListeners(["statusBar"], this.handleStatusBarChanged.bind(this));
  }
  processStatusPanels(e) {
    var s;
    const t = (s = this.gos.get("statusBar")) == null ? void 0 : s.statusPanels;
    if (t) {
      const i = t.filter(
        (o) => o.align === "left"
      ), r = t.filter(
        (o) => o.align === "center"
      ), n = t.filter(
        (o) => !o.align || o.align === "right"
      );
      this.panelsPromise = U.all([
        this.createAndRenderComponents(
          i,
          this.eStatusBarLeft,
          e
        ),
        this.createAndRenderComponents(
          r,
          this.eStatusBarCenter,
          e
        ),
        this.createAndRenderComponents(
          n,
          this.eStatusBarRight,
          e
        )
      ]);
    } else
      this.setDisplayed(!1);
  }
  handleStatusBarChanged() {
    this.updateQueued || (this.updateQueued = !0, this.panelsPromise.then(() => {
      this.updateStatusBar(), this.updateQueued = !1;
    }));
  }
  updateStatusBar() {
    var i;
    const e = (i = this.gos.get("statusBar")) == null ? void 0 : i.statusPanels, t = Array.isArray(e) && e.length > 0;
    this.setDisplayed(t);
    const s = /* @__PURE__ */ new Map();
    t && e.forEach((r) => {
      const n = r.key ?? r.statusPanel, o = this.statusBarSvc.getStatusPanel(n);
      if (o != null && o.refresh) {
        const a = V(this.gos, {
          ...r.statusPanelParams ?? {},
          key: n
        });
        o.refresh(a) && (s.set(n, o), delete this.compDestroyFunctions[n], se(o.getGui()));
      }
    }), this.resetStatusBar(), t && this.processStatusPanels(s);
  }
  resetStatusBar() {
    X(this.eStatusBarLeft), X(this.eStatusBarCenter), X(this.eStatusBarRight), this.destroyComponents(), this.statusBarSvc.unregisterAllComponents();
  }
  destroy() {
    this.destroyComponents(), super.destroy();
  }
  destroyComponents() {
    Object.values(this.compDestroyFunctions).forEach((e) => e()), this.compDestroyFunctions = {};
  }
  createAndRenderComponents(e, t, s) {
    const i = [];
    return e.forEach((r) => {
      const n = r.key || r.statusPanel, o = s.get(n);
      let a;
      if (o)
        a = U.resolve(o);
      else {
        const l = bN(
          this.userCompFactory,
          r,
          V(this.gos, { key: n })
        );
        if (l == null)
          return;
        a = l.newAgStackInstance();
      }
      i.push({
        key: n,
        promise: a
      });
    }), U.all(i.map((r) => r.promise)).then(() => {
      i.forEach((r) => {
        r.promise.then((n) => {
          const o = () => {
            this.destroyBean(n);
          };
          this.isAlive() ? (this.statusBarSvc.registerStatusPanel(r.key, n), t.appendChild(n.getGui()), this.compDestroyFunctions[r.key] = o) : o();
        });
      });
    });
  }
}, FN = {
  selector: "AG-STATUS-BAR",
  component: xN
}, RN = {
  tag: "div",
  cls: "ag-status-name-value",
  children: [
    { tag: "span", ref: "eLabel" },
    ": ",
    { tag: "span", ref: "eValue", cls: "ag-status-name-value-value" }
  ]
}, Dn = class extends D {
  constructor() {
    super(RN), this.eLabel = x, this.eValue = x;
  }
  setLabel(e, t) {
    this.setDisplayed(!1), this.eLabel.textContent = this.getLocaleTextFunc()(e, t);
  }
  setValue(e, t) {
    this.eValue.textContent = this.valueFormatter(
      V(this.gos, { value: e, totalRows: t, key: this.key })
    );
  }
}, PN = {
  selector: "AG-NAME-VALUE",
  component: Dn
}, _C = (e) => {
  let t = 0;
  return e.forEachNodeAfterFilter((s) => {
    s.data && t++;
  }), t;
}, An = (e) => {
  let t = 0;
  return e.forEachNode((s) => {
    s.data && t++;
  }), t;
};
function EN(e, t) {
  return typeof e != "number" ? "" : Ii(Math.round(e * 100) / 100, t);
}
var TN = {
  tag: "div",
  cls: "ag-status-panel ag-status-panel-aggregations",
  children: [
    {
      tag: "ag-name-value",
      ref: "avgAggregationComp"
    },
    {
      tag: "ag-name-value",
      ref: "countAggregationComp"
    },
    {
      tag: "ag-name-value",
      ref: "minAggregationComp"
    },
    {
      tag: "ag-name-value",
      ref: "maxAggregationComp"
    },
    {
      tag: "ag-name-value",
      ref: "sumAggregationComp"
    }
  ]
}, MN = class extends D {
  constructor() {
    super(TN, [PN]), this.sumAggregationComp = x, this.countAggregationComp = x, this.minAggregationComp = x, this.maxAggregationComp = x, this.avgAggregationComp = x;
  }
  postConstruct() {
    if (!te(this.gos) && !Le(this.gos)) {
      F(221);
      return;
    }
    this.avgAggregationComp.setLabel("avg", "Average"), this.countAggregationComp.setLabel("count", "Count"), this.minAggregationComp.setLabel("min", "Min"), this.maxAggregationComp.setLabel("max", "Max"), this.sumAggregationComp.setLabel("sum", "Sum"), this.addManagedEventListeners({
      cellSelectionChanged: this.onCellSelectionChanged.bind(this),
      modelUpdated: this.onCellSelectionChanged.bind(this)
    });
  }
  init(e) {
    this.refresh(e);
  }
  refresh(e) {
    this.params = e;
    const t = e.valueFormatter ?? (({ value: i }) => EN(i, this.getLocaleTextFunc.bind(this))), s = ["avg", "count", "min", "max", "sum"];
    for (const i of s) {
      const r = this.getAllowedAggregationValueComponent(i);
      r && (r.key = i, r.valueFormatter = t.bind(this));
    }
    return this.onCellSelectionChanged(), !0;
  }
  setAggregationComponentValue(e, t, s) {
    var n;
    const i = this.getAllowedAggregationValueComponent(e), r = An(this.beans.rowModel);
    A(i) && i ? (i.setValue(t, r), i.setDisplayed(s)) : (n = this.getAggregationValueComponent(e)) == null || n.setDisplayed(!1);
  }
  getAllowedAggregationValueComponent(e) {
    const { aggFuncs: t } = this.params;
    return !t || t.includes(e) ? this.getAggregationValueComponent(e) : null;
  }
  getAggregationValueComponent(e) {
    const t = `${e}AggregationComp`;
    return this[t];
  }
  onCellSelectionChanged() {
    const e = this.beans, { rangeSvc: t, valueSvc: s } = e, i = t == null ? void 0 : t.getCellRanges();
    let r = 0, n = 0, o = 0, a = null, l = null;
    const c = {};
    if (i != null && i.length && t)
      for (let u = 0; u < i.length; u++) {
        const g = i[u];
        let p = t.getRangeStartRow(g);
        const f = t.getRangeEndRow(g);
        for (; !(ee(p) || !p || Be(f, p) || !p || !g.columns); )
          g.columns.forEach((C) => {
            if (p === null)
              return;
            const v = Ws({
              rowPinned: p.rowPinned,
              column: C,
              rowIndex: p.rowIndex
            });
            if (c[v])
              return;
            c[v] = !0;
            const w = Ee(e, p);
            if (ee(w))
              return;
            let b = s.getValue(C, w);
            ee(b) || b === "" || (n++, !(typeof b == "object" && "value" in b && (b = b.value, b === "")) && (typeof b == "string" && (b = Number(b)), typeof b == "number" && !isNaN(b) && (r += b, (l === null || b > l) && (l = b), (a === null || b < a) && (a = b), o++)));
          }), p = dt(e, p);
      }
    const d = n > 1, h = o > 1;
    this.setAggregationComponentValue("count", n, d), this.setAggregationComponentValue("sum", r, h), this.setAggregationComponentValue("min", a, h), this.setAggregationComponentValue("max", l, h), this.setAggregationComponentValue("avg", r / o, h);
  }
}, DN = class extends Dn {
  postConstruct() {
    if (this.setLabel("filteredRows", "Filtered"), !te(this.gos)) {
      F(222);
      return;
    }
    this.addCss("ag-status-panel"), this.addCss("ag-status-panel-filtered-row-count"), this.setDisplayed(!0);
    const e = this.onDataChanged.bind(this);
    this.addManagedEventListeners({ modelUpdated: e });
  }
  onDataChanged() {
    const { rowModel: e } = this.beans, t = An(e), s = _C(e);
    this.setValue(s, t), this.setDisplayed(t !== s);
  }
  init(e) {
    this.refresh(e), this.onDataChanged();
  }
  updateValueFormatter(e) {
    this.valueFormatter = e ?? (({ value: t }) => Ii(t, this.getLocaleTextFunc.bind(this)));
  }
  refresh(e) {
    const { key: t, valueFormatter: s } = e;
    return this.key = t, this.updateValueFormatter(s), !0;
  }
}, AN = class extends Dn {
  postConstruct() {
    const e = this.gos;
    if (!te(e) && !Le(e)) {
      F(223);
      return;
    }
    this.setLabel("selectedRows", "Selected"), this.addCss("ag-status-panel"), this.addCss("ag-status-panel-selected-row-count");
    const t = this.onRowSelectionChanged.bind(this);
    this.addManagedEventListeners({ modelUpdated: t, selectionChanged: t });
  }
  onRowSelectionChanged() {
    const { selectionSvc: e, rowModel: t } = this.beans, s = (e == null ? void 0 : e.getSelectionCount()) ?? 0, i = An(t);
    if (this.setValue(s, i), s < 0) {
      this.setDisplayed(!0);
      return;
    }
    this.setDisplayed(s > 0);
  }
  init(e) {
    this.refresh(e), this.onRowSelectionChanged();
  }
  updateValueFormatter(e) {
    this.valueFormatter = e ?? (({ value: t }) => t == null || t >= 0 ? Ii(t, this.getLocaleTextFunc.bind(this)) : this.getLocaleTextFunc()("statusBarLastRowUnknown", "?"));
  }
  refresh(e) {
    const { key: t, valueFormatter: s } = e;
    return this.key = t, this.updateValueFormatter(s), !0;
  }
}, IN = class extends Dn {
  postConstruct() {
    if (!te(this.gos)) {
      F(224);
      return;
    }
    this.setLabel("totalAndFilteredRows", "Rows"), this.addCss("ag-status-panel"), this.addCss("ag-status-panel-total-and-filtered-row-count"), this.setDisplayed(!0), this.addManagedEventListeners({ modelUpdated: this.onDataChanged.bind(this) });
  }
  onDataChanged() {
    const { rowModel: e } = this.beans, t = _C(e), s = An(e);
    this.setValue(t, s);
  }
  init(e) {
    this.refresh(e), this.onDataChanged();
  }
  updateValueFormatter(e) {
    this.valueFormatter = e ?? (({ value: t, totalRows: s }) => {
      const i = this.getLocaleTextFunc.bind(this), r = Ii(t, i), n = Ii(s ?? t, i);
      if (t === s)
        return r;
      const o = i();
      return `${r} ${o("of", "of")} ${n}`;
    });
  }
  refresh(e) {
    const { key: t, valueFormatter: s } = e;
    return this.key = t, this.updateValueFormatter(s), !0;
  }
}, LN = class extends Dn {
  postConstruct() {
    if (this.setLabel("totalRows", "Total Rows"), !te(this.gos)) {
      F(225);
      return;
    }
    this.addCss("ag-status-panel"), this.addCss("ag-status-panel-total-row-count"), this.setDisplayed(!0), this.addManagedEventListeners({ modelUpdated: this.onDataChanged.bind(this) });
  }
  onDataChanged() {
    const e = An(this.beans.rowModel);
    this.setValue(e, e);
  }
  init(e) {
    this.refresh(e), this.onDataChanged();
  }
  updateValueFormatter(e) {
    this.valueFormatter = e ?? (({ value: t }) => Ii(t, this.getLocaleTextFunc.bind(this)));
  }
  refresh(e) {
    const { key: t, valueFormatter: s } = e;
    return this.key = t, this.updateValueFormatter(s), !0;
  }
};
function kN(e, t) {
  var i;
  const s = (i = e.statusBarSvc) == null ? void 0 : i.getStatusPanel(t);
  return Mi(s);
}
var GN = class extends R {
  // tslint:disable-next-line
  constructor() {
    super(), this.beanName = "statusBarSvc", this.comps = /* @__PURE__ */ new Map();
  }
  registerStatusPanel(e, t) {
    this.comps.set(e, t);
  }
  unregisterStatusPanel(e) {
    this.comps.delete(e);
  }
  unregisterAllComponents() {
    this.comps.clear();
  }
  getStatusPanel(e) {
    return this.comps.get(e);
  }
  destroy() {
    this.unregisterAllComponents(), super.destroy();
  }
}, ON = {
  moduleName: "StatusBar",
  version: Y,
  beans: [GN],
  userComponents: {
    agAggregationComponent: MN,
    agTotalRowCountComponent: LN,
    agFilteredRowCountComponent: DN,
    agTotalAndFilteredRowCountComponent: IN,
    agSelectedRowCountComponent: AN
  },
  selectors: [FN],
  apiFunctions: {
    getStatusPanel: kN
  },
  dependsOn: [ie, xa]
};
function UC(e) {
  var t;
  return ((t = e.excelCreator) == null ? void 0 : t.getFactoryMode()) === "MULTI_SHEET" ? (F(161), !1) : !0;
}
function VN(e, t) {
  var s;
  if (UC(e))
    return (s = e.excelCreator) == null ? void 0 : s.getDataAsExcel(t);
}
function BN(e, t) {
  var s;
  UC(e) && ((s = e.excelCreator) == null || s.exportDataAsExcel(t));
}
function NN(e, t) {
  var s, i;
  return (s = e.excelCreator) == null || s.setFactoryMode("MULTI_SHEET"), (i = e.excelCreator) == null ? void 0 : i.getSheetDataForExcel(t);
}
function HN(e, t) {
  var s;
  return (s = e.excelCreator) == null ? void 0 : s.getMultipleSheetsAsExcel(t);
}
function zN(e, t) {
  var s;
  (s = e.excelCreator) == null || s.exportMultipleSheetsAsExcel(t);
}
var WN = {
  moduleName: "ExcelExport",
  version: Y,
  beans: [p1],
  apiFunctions: {
    getDataAsExcel: VN,
    exportDataAsExcel: BN,
    getSheetDataForExcel: NN,
    getMultipleSheetsAsExcel: HN,
    exportMultipleSheetsAsExcel: zN
  },
  dependsOn: [zm, ie]
};
function _N(e) {
  const t = e.cssIdentifier || "default", s = e.direction || "vertical";
  return {
    tag: "div",
    cls: `ag-group ag-${t}-group`,
    role: "presentation",
    children: [
      {
        tag: "div",
        ref: "eToolbar",
        cls: `ag-group-toolbar ag-${t}-group-toolbar`,
        children: [{ tag: "ag-checkbox", ref: "cbGroupEnabled" }]
      },
      {
        tag: "div",
        ref: "eContainer",
        cls: `ag-group-container ag-group-container-${s} ag-${t}-group-container`
      }
    ]
  };
}
var Ms = class extends D {
  constructor(e = {}) {
    super(_N(e), [_t]), this.params = e, this.suppressEnabledCheckbox = !0, this.suppressToggleExpandOnEnableChange = !1, this.eToolbar = x, this.cbGroupEnabled = x, this.eContainer = x;
    const {
      enabled: t,
      items: s,
      suppressEnabledCheckbox: i,
      expanded: r,
      suppressToggleExpandOnEnableChange: n,
      useToggle: o
    } = e;
    this.cssIdentifier = e.cssIdentifier || "default", this.enabled = t ?? !0, this.items = s || [], this.useToggle = o ?? !1, this.alignItems = e.alignItems || "center", this.expanded = r ?? !0, i != null && (this.suppressEnabledCheckbox = i), n != null && (this.suppressToggleExpandOnEnableChange = n);
  }
  postConstruct() {
    if (this.setupTitleBar(), this.items.length) {
      const r = this.items;
      this.items = [], this.addItems(r);
    }
    const e = this.getLocaleTextFunc();
    this.cbGroupEnabled.setLabel(e("enabled", "Enabled")), this.enabled && this.setEnabled(this.enabled, void 0, !0), this.setAlignItems(this.alignItems);
    const { onEnableChange: t, onExpandedChange: s, suppressOpenCloseIcons: i } = this.params;
    this.hideEnabledCheckbox(this.suppressEnabledCheckbox), this.hideOpenCloseIcons(i ?? !1), this.refreshChildDisplay(), O(this.eContainer, this.expanded), this.cbGroupEnabled.onValueChange((r) => {
      this.setEnabled(r, !0, this.suppressToggleExpandOnEnableChange), this.dispatchEnableChangeEvent(r);
    }), t != null && this.onEnableChange(t), s != null && this.onExpandedChange(s);
  }
  refreshChildDisplay() {
    var e;
    O(this.eToolbar, this.expanded && !this.suppressEnabledCheckbox), (e = this.eTitleBar) == null || e.refreshOnExpand(this.expanded);
  }
  isExpanded() {
    return this.expanded;
  }
  setAlignItems(e) {
    this.alignItems !== e && this.removeCss(`ag-group-item-alignment-${this.alignItems}`), this.alignItems = e;
    const t = `ag-group-item-alignment-${this.alignItems}`;
    return this.addCss(t), this;
  }
  toggleGroupExpand(e, t) {
    var s;
    if ((s = this.eTitleBar) != null && s.isSuppressCollapse() && !this.useToggle)
      e = !0, t = !0;
    else if (e = e ?? !this.expanded, this.expanded === e)
      return this;
    return this.expanded = e, this.refreshChildDisplay(), O(this.eContainer, e), t || this.dispatchLocalEvent({
      type: e ? "expanded" : "collapsed"
    }), this;
  }
  addItems(e) {
    e.forEach((t) => this.addItem(t));
  }
  prependItem(e) {
    this.insertItem(e, !0);
  }
  addItem(e) {
    this.insertItem(e, !1);
  }
  insertItem(e, t) {
    const s = this.eContainer, i = Mo(e) ? e.getGui() : e;
    i.classList.add("ag-group-item", `ag-${this.cssIdentifier}-group-item`), t ? (s.insertAdjacentElement("afterbegin", i), this.items.unshift(i)) : (s.appendChild(i), this.items.push(i));
  }
  hideItem(e, t) {
    const s = this.items[t];
    O(s, !e);
  }
  getItemIndex(e) {
    const t = Mo(e) ? e.getGui() : e;
    return this.items.indexOf(t);
  }
  setTitle(e) {
    var t;
    return (t = this.eTitleBar) == null || t.setTitle(e), this;
  }
  addTitleBarWidget(e) {
    var t;
    return (t = this.eTitleBar) == null || t.addWidget(e), this;
  }
  addCssClassToTitleBar(e) {
    var t;
    (t = this.eTitleBar) == null || t.addCss(e);
  }
  dispatchEnableChangeEvent(e) {
    const t = {
      type: "enableChange",
      enabled: e
    };
    this.dispatchLocalEvent(t);
  }
  setEnabled(e, t, s) {
    var i;
    return this.enabled = e, this.refreshDisabledStyles(), s || this.toggleGroupExpand(e), t || (this.cbGroupEnabled.setValue(e), (i = this.eToggle) == null || i.setValue(e)), this;
  }
  isEnabled() {
    return this.enabled;
  }
  onEnableChange(e) {
    return this.addManagedListeners(this, { enableChange: (t) => e(t.enabled) }), this;
  }
  onExpandedChange(e) {
    return this.addManagedListeners(this, {
      expanded: () => e(!0),
      collapsed: () => e(!1)
    }), this;
  }
  hideEnabledCheckbox(e) {
    return this.suppressEnabledCheckbox = e, this.refreshChildDisplay(), this.refreshDisabledStyles(), this;
  }
  hideOpenCloseIcons(e) {
    var t;
    return (t = this.eTitleBar) == null || t.hideOpenCloseIcons(e), this;
  }
  refreshDisabledStyles() {
    var t;
    const e = !this.enabled;
    this.eContainer.classList.toggle("ag-disabled", e), (t = this.eTitleBar) == null || t.refreshDisabledStyles(this.suppressEnabledCheckbox && e), this.eContainer.classList.toggle("ag-disabled-group-container", e);
  }
  setupTitleBar() {
    const e = this.useToggle ? this.createToggleTitleBar() : this.createDefaultTitleBar();
    this.eToolbar.insertAdjacentElement("beforebegin", e.getGui());
  }
  createDefaultTitleBar() {
    const e = this.createManagedBean(new $N(this.params));
    return this.eTitleBar = e, e.refreshOnExpand(this.expanded), this.addManagedListeners(e, {
      expandedChanged: (t) => this.toggleGroupExpand(t.expanded)
    }), e;
  }
  createToggleTitleBar() {
    const e = this.createManagedBean(
      new br({
        value: this.enabled,
        label: this.params.title,
        labelAlignment: "left",
        labelWidth: "flex",
        onValueChange: (t) => {
          this.setEnabled(t, !0), this.dispatchEnableChangeEvent(t);
        }
      })
    );
    return e.addCss("ag-group-title-bar"), e.addCss(`ag-${this.params.cssIdentifier ?? "default"}-group-title-bar ag-unselectable`), this.eToggle = e, this.toggleGroupExpand(this.enabled), e;
  }
}, Pl = "ag-disabled-group-title-bar";
function UN(e) {
  const t = e.cssIdentifier ?? "default";
  return {
    tag: "div",
    cls: `ag-group-title-bar ag-${t}-group-title-bar ag-unselectable`,
    role: e.suppressKeyboardNavigation ? "presentation" : "role",
    children: [
      {
        tag: "span",
        ref: "eGroupOpenedIcon",
        cls: `ag-group-title-bar-icon ag-${t}-group-title-bar-icon`,
        role: "presentation"
      },
      {
        tag: "span",
        ref: "eGroupClosedIcon",
        cls: `ag-group-title-bar-icon ag-${t}-group-title-bar-icon`,
        role: "presentation"
      },
      { tag: "span", ref: "eTitle", cls: `ag-group-title ag-${t}-group-title` }
    ]
  };
}
var $N = class extends D {
  constructor(e = {}) {
    super(UN(e)), this.suppressOpenCloseIcons = !1, this.suppressKeyboardNavigation = !1, this.eGroupOpenedIcon = x, this.eGroupClosedIcon = x, this.eTitle = x;
    const { title: t, suppressOpenCloseIcons: s, suppressKeyboardNavigation: i } = e;
    t && t.length > 0 && (this.title = t), s != null && (this.suppressOpenCloseIcons = s), this.suppressKeyboardNavigation = i ?? !1;
  }
  postConstruct() {
    this.setTitle(this.title), this.hideOpenCloseIcons(this.suppressOpenCloseIcons), this.setupExpandContract();
  }
  setupExpandContract() {
    this.eGroupClosedIcon.appendChild(Bt("accordionClosed", this.beans, null)), this.eGroupOpenedIcon.appendChild(Bt("accordionOpen", this.beans, null)), this.addManagedElementListeners(this.getGui(), {
      click: () => this.dispatchExpandChanged(),
      keydown: (e) => {
        switch (e.key) {
          case S.ENTER:
          case S.SPACE:
            e.preventDefault(), this.dispatchExpandChanged();
            break;
          case S.RIGHT:
          case S.LEFT:
            e.preventDefault(), this.dispatchExpandChanged(e.key === S.RIGHT);
            break;
        }
      }
    });
  }
  refreshOnExpand(e) {
    this.refreshAriaStatus(e), this.refreshOpenCloseIcons(e);
  }
  refreshAriaStatus(e) {
    this.suppressOpenCloseIcons || qe(this.getGui(), e);
  }
  refreshOpenCloseIcons(e) {
    const t = !this.suppressOpenCloseIcons;
    O(this.eGroupOpenedIcon, t && e), O(this.eGroupClosedIcon, t && !e);
  }
  isSuppressCollapse() {
    return this.suppressOpenCloseIcons;
  }
  dispatchExpandChanged(e) {
    const t = {
      type: "expandedChanged",
      expanded: e
    };
    this.dispatchLocalEvent(t);
  }
  setTitle(e) {
    const t = this.getGui(), s = !!e && e.length > 0;
    e = s ? e : void 0, this.eTitle.textContent = e ?? "", O(t, s), e !== this.title && (this.title = e);
    const i = t.classList.contains(Pl);
    return this.refreshDisabledStyles(i), this;
  }
  addWidget(e) {
    return this.getGui().appendChild(e), this;
  }
  hideOpenCloseIcons(e) {
    return this.suppressOpenCloseIcons = e, e && this.dispatchExpandChanged(!0), this;
  }
  refreshDisabledStyles(e) {
    const t = this.getGui();
    e ? (t.classList.add(Pl), t.removeAttribute("tabindex")) : (t.classList.remove(Pl), typeof this.title == "string" && !this.suppressKeyboardNavigation ? t.setAttribute("tabindex", "0") : t.removeAttribute("tabindex"));
  }
}, ae = {
  selector: "AG-GROUP-COMPONENT",
  component: Ms
};
function La(e) {
  const { filters: t } = e;
  return t && t.length > 0 ? t : [{ filter: "agTextColumnFilter" }, { filter: "agSetColumnFilter" }];
}
function jo(e, t) {
  if (e != null)
    for (let s = e.length - 1; s >= 0; s--)
      t(e[s], s);
}
function KN(e, t) {
  return t.title != null ? t.title : e instanceof wa ? e.getFilterTitle() : "Filter";
}
function gn(e, t, s, i) {
  const r = [], n = e == null ? void 0 : e.filterModels;
  for (let o = 0; o < t; o++)
    r[o] = (o === i ? s : n == null ? void 0 : n[o]) ?? null;
  return r.every((o) => o == null) ? null : {
    filterType: "multi",
    filterModels: r
  };
}
function ws(e, t) {
  var s;
  return ((s = e == null ? void 0 : e.filterModels) == null ? void 0 : s[t]) ?? null;
}
function Yo(e, t, s, i) {
  const r = s.filterValueGetter;
  return r ? e.colFilter.createGetValue(t, r) : i;
}
var $C = class extends ls {
  constructor() {
    super({ tag: "div", cls: "ag-multi-filter ag-menu-list-compact" }), this.filterDefs = [], this.guiDestroyFuncs = [], this.filterGuis = [], this.lastActivatedMenuItem = null;
  }
  postConstruct() {
    this.initialiseTabGuard({
      onFocusIn: (e) => this.onFocusIn(e)
    });
  }
  refreshGui(e) {
    return e === this.lastOpenedInContainer ? U.resolve() : (this.tabGuardFeature.removeAllChildrenExceptTabGuards(), this.destroyChildren(), U.all(
      this.getFilterWrappers().map((t, s) => {
        if (!t)
          return U.resolve(null);
        const i = this.getFilterFromWrapper(t), r = this.getCompFromWrapper(t), n = this.filterDefs[s], o = KN(i, n);
        let a;
        if (n.display === "subMenu" && e !== "toolPanel")
          a = this.insertFilterMenu(r, i, o).then(
            (l) => l.getGui()
          );
        else if (n.display === "subMenu" || n.display === "accordion") {
          const l = this.insertFilterGroup(i, r, o);
          a = U.resolve(l.getGui());
        } else
          a = U.resolve(r.getGui());
        return a;
      })
    ).then((t) => {
      t.forEach((s, i) => {
        s && (i > 0 && this.appendChild(K({ tag: "div", cls: "ag-filter-separator" })), this.appendChild(s));
      }), this.filterGuis = t, this.lastOpenedInContainer = e;
    }));
  }
  destroyChildren() {
    this.guiDestroyFuncs.forEach((e) => e()), this.guiDestroyFuncs.length = 0, this.filterGuis.length = 0;
  }
  insertFilterMenu(e, t, s) {
    const i = e.getGui();
    Ye(i, "dialog");
    const r = this.createBean(new Rc()), n = {
      getGui: () => e.getGui(),
      afterGuiAttached: (o) => {
        var a, l;
        (a = e.afterGuiAttached) == null || a.call(e, o), e !== t && ((l = t.afterGuiAttached) == null || l.call(t, o));
      }
    };
    return r.init({
      menuItemDef: {
        name: s,
        subMenu: [],
        subMenuRole: "dialog",
        cssClasses: ["ag-multi-filter-menu-item"],
        menuItem: SC,
        menuItemParams: {
          cssClassPrefix: "ag-compact-menu-option",
          isCompact: !0
        }
      },
      level: 0,
      isAnotherSubMenuOpen: () => !1,
      childComponent: n,
      contextParams: {
        column: null,
        node: null,
        value: null
      }
    }).then(() => {
      r.setParentComponent(this), this.guiDestroyFuncs.push(() => this.destroyBean(r)), this.addManagedListeners(r, {
        menuItemActivated: (a) => {
          this.lastActivatedMenuItem && this.lastActivatedMenuItem !== a.menuItem && this.lastActivatedMenuItem.deactivate(), this.lastActivatedMenuItem = a.menuItem;
        }
      });
      const o = r.getGui();
      return r.addManagedElementListeners(o, {
        // `AgMenuList` normally handles keyboard navigation, so need to do here
        keydown: (a) => {
          const { key: l } = a;
          switch (l) {
            case S.UP:
            case S.RIGHT:
            case S.DOWN:
            case S.LEFT:
              a.preventDefault(), l === S.RIGHT && r.openSubMenu(!0);
              break;
          }
        },
        focusin: () => r.activate(),
        focusout: () => {
          !r.isSubMenuOpen() && !r.isSubMenuOpening() && r.deactivate();
        }
      }), r;
    });
  }
  insertFilterGroup(e, t, s) {
    const i = this.createBean(
      new Ms({
        title: s,
        cssIdentifier: "multi-filter"
      })
    );
    return this.guiDestroyFuncs.push(() => this.destroyBean(i)), i.addItem(t.getGui()), i.toggleGroupExpand(!1), e.afterGuiAttached && i.addManagedListeners(i, {
      expanded: () => e.afterGuiAttached({
        container: this.lastOpenedInContainer,
        suppressFocus: !0,
        hidePopup: this.hidePopup
      })
    }), i;
  }
  afterGuiAttached(e) {
    let t;
    e ? (this.hidePopup = e.hidePopup, t = this.refreshGui(e.container)) : (this.hidePopup = void 0, t = U.resolve());
    const s = e == null ? void 0 : e.suppressFocus;
    t.then(() => {
      const { filterDefs: i, filterGuis: r, beans: n } = this, o = this.getFilterWrappers();
      let a = !!s;
      i && jo(i, (c, d) => {
        const h = d === 0, u = c.display && c.display !== "inline", g = s || !h || u, p = { ...e ?? {}, suppressFocus: g }, f = o[d], m = f ? this.getFilterFromWrapper(f) : void 0;
        if (f) {
          const C = this.getCompFromWrapper(f);
          C !== m && C.afterGuiAttached(p);
        }
        if (m && (this.executeFunctionIfExistsOnFilter(m, "afterGuiAttached", p), h && !g && (a = !0)), !s && h && u) {
          const C = r[d];
          C && (ye(C) || C.focus({ preventScroll: !0 }), a = !0);
        }
      });
      const l = Q(n);
      !a && (Jt(n) || this.getGui().contains(l)) && this.forceFocusOutOfContainer(!0);
    });
  }
  afterGuiDetached() {
    this.executeFunctionIfExists("afterGuiDetached");
  }
  onAnyFilterChanged() {
    this.executeFunctionIfExists(
      "onAnyFilterChanged",
      (e) => this.executeOnWrapper(e, "onAnyFilterChanged")
    );
  }
  onNewRowsLoaded() {
    this.executeFunctionIfExists("onNewRowsLoaded", (e) => this.executeOnWrapper(e, "onNewRowsLoaded"));
  }
  destroy() {
    this.destroyChildren(), this.hidePopup = void 0, super.destroy();
  }
  executeOnWrapper(e, t) {
  }
  executeFunctionIfExists(e, t) {
    jo(this.getFilterWrappers(), (s) => {
      s && (t == null || t(s), this.executeFunctionIfExistsOnFilter(this.getFilterFromWrapper(s), e));
    });
  }
  executeFunctionIfExistsOnFilter(e, t, ...s) {
    const i = e[t];
    typeof i == "function" && i.apply(e, s);
  }
  onFocusIn(e) {
    const t = this.lastActivatedMenuItem;
    t != null && !t.getGui().contains(e.target) && (t.deactivate(), this.lastActivatedMenuItem = null);
  }
}, KC = class extends $C {
  constructor() {
    super(...arguments), this.filterType = "multi", this.wrappers = [], this.activeFilterIndices = [], this.afterFiltersReadyFuncs = [];
  }
  init(e) {
    this.params = e, this.filterDefs = La(e);
    const t = Pe(this.beans.colFilter.model, e.column.getColId()), { filterChangedCallback: s } = e;
    this.filterChangedCallback = s;
    const i = this.filterDefs.map(
      (r, n) => this.createFilter(r, n, t)
    );
    return new U((r) => {
      U.all(i).then((n) => {
        this.wrappers = n, this.refreshGui("columnMenu").then(() => {
          r();
        });
      });
    }).then(() => {
      this.afterFiltersReadyFuncs.forEach((r) => r()), this.afterFiltersReadyFuncs.length = 0;
    });
  }
  refresh(e) {
    return this.params = e, !0;
  }
  isFilterActive() {
    return this.wrappers.some((e) => {
      if (!e)
        return !1;
      const { filter: t, handler: s, model: i } = e;
      return s ? i != null : t.isFilterActive();
    });
  }
  getLastActiveFilterIndex() {
    const e = this.activeFilterIndices;
    return e.length > 0 ? e[e.length - 1] : null;
  }
  doesFilterPass(e, t) {
    return this.wrappers.every((s, i) => {
      if (!s || t != null && i === t)
        return !0;
      const { handler: r, filter: n, model: o } = s;
      return r ? o == null || r.doesFilterPass({
        ...e,
        model: o,
        handlerParams: s.handlerParams
      }) : !n.isFilterActive() || n.doesFilterPass(e);
    });
  }
  getModelFromUi() {
    return {
      filterType: this.filterType,
      filterModels: this.wrappers.map((t) => {
        if (!t)
          return null;
        const s = t.filter;
        return typeof s.getModelFromUi == "function" ? s.getModelFromUi() : null;
      })
    };
  }
  getModel() {
    return this.isFilterActive() ? {
      filterType: this.filterType,
      filterModels: this.wrappers.map((t) => {
        if (!t)
          return null;
        const { filter: s, handler: i, model: r } = t;
        return i ? r : s.isFilterActive() ? s.getModel() : null;
      })
    } : null;
  }
  setModel(e) {
    const t = (i, r) => new U((n) => {
      const o = i.setModel(r);
      o ? o.then(() => n()) : n();
    }), s = [];
    return this.wrappers.forEach((i, r) => {
      if (!i)
        return;
      const n = ws(e, r), { filter: o, filterParams: a, handler: l, handlerParams: c, state: d } = i;
      l ? s.push(
        Xl(
          () => U.resolve({ filter: o, filterParams: a }),
          l,
          c,
          n,
          d ?? { model: n },
          "api"
        ).then(() => {
          i.model = n, this.updateActiveListForHandler(r, n);
        })
      ) : s.push(
        t(o, n).then(() => {
          this.updateActiveListForFilter(r, o);
        })
      );
    }), U.all(s).then(() => {
    });
  }
  applyModel(e = "api") {
    let t = !1;
    return this.wrappers.forEach((s) => {
      if (s) {
        const i = s.filter;
        i instanceof wa && (t = i.applyModel(e) || t);
      }
    }), t;
  }
  getChildFilterInstance(e) {
    var t;
    return (t = this.wrappers[e]) == null ? void 0 : t.filter;
  }
  getNumChildFilters() {
    return this.wrappers.length;
  }
  destroy() {
    this.wrappers.forEach((e) => {
      this.destroyBean(e == null ? void 0 : e.filter), this.destroyBean(e == null ? void 0 : e.handler);
    }), this.wrappers.length = 0, super.destroy();
  }
  getFilterWrappers() {
    return this.wrappers;
  }
  getFilterFromWrapper(e) {
    return e.filter;
  }
  getCompFromWrapper(e) {
    return e.comp;
  }
  executeOnWrapper(e, t) {
    var s, i;
    (i = (s = e.handler) == null ? void 0 : s[t]) == null || i.call(s);
  }
  createFilter(e, t, s) {
    var u;
    const i = this.params.column;
    let r = null, n;
    const o = this.beans, {
      compDetails: a,
      handler: l,
      handlerParams: c,
      createFilterUi: d
    } = o.colFilter.createFilterInstance(
      i,
      e,
      "agTextColumnFilter",
      (g, p) => {
        const f = {
          ...g,
          filterChangedCallback: p ? () => {
          } : (m) => {
            this.executeWhenAllFiltersReady(
              () => this.onFilterModelChanged(t, m)
            );
          },
          doesRowPassOtherFilter: (m) => g.doesRowPassOtherFilter(m) && this.doesFilterPass({ node: m, data: m.data }, t),
          getValue: Yo(o, i, e, g.getValue)
        };
        return p && (r = ws(s, t), n = this.updateDisplayParams(
          f,
          t,
          r,
          () => a,
          () => l
        )), f;
      }
    );
    if (!d)
      return U.resolve(null);
    let h;
    if (l) {
      const { onModelChange: g, doesRowPassOtherFilter: p, getValue: f } = c;
      h = {
        ...c,
        onModelChange: (m, C) => g(
          gn(this.params.model, this.wrappers.length, m, t),
          C
        ),
        doesRowPassOtherFilter: (m) => p(m) && this.doesFilterPass({ node: m, data: m.data }, t),
        getValue: Yo(o, i, e, f)
      }, (u = l.init) == null || u.call(l, { ...h, model: r, source: "init" });
    }
    return d().then((g) => {
      if (!l)
        return { filter: g, comp: g };
      const p = a == null ? void 0 : a.params, f = n(g);
      return {
        filter: g,
        comp: f,
        filterParams: p,
        handler: l,
        handlerParams: h,
        model: r
      };
    });
  }
  updateDisplayParams(e, t, s, i, r) {
    const n = this.params.column, o = new Rs();
    e.model = s, e.state = { model: s }, e.onModelChange = (c, d) => {
      const h = this.wrappers[t];
      h && Xl(
        () => U.resolve({
          filter: h.filter,
          filterParams: h.filterParams
        }),
        h.handler,
        h.handlerParams,
        c,
        h.state ?? { model: c },
        "ui"
      ).then(() => {
        h.model = c, this.onHandlerModelChanged(t, c, d);
      });
    }, e.getHandler = r;
    const a = (c, d) => {
      c.state = d, o.dispatchEvent({
        type: "filterStateChanged",
        column: n,
        state: d
      });
    };
    e.onStateChange = (c) => {
      const d = this.wrappers[t];
      d && (a(d, c), ma(d.filter, d.filterParams, d.model ?? null, c, "ui"));
    };
    const l = (c, d, h) => {
      var p, f;
      const u = this.wrappers[t];
      if (!u)
        return;
      const g = () => (u == null ? void 0 : u.model) ?? null;
      Zl(
        d,
        () => {
          const m = U.resolve(u.filter);
          return {
            created: !0,
            filterParams: u.filterParams,
            compDetails: i(),
            create: () => m,
            promise: m
          };
        },
        g,
        () => (u == null ? void 0 : u.state) ?? { model: g() },
        (m) => a(u, m),
        (m) => {
          var C;
          return (C = u.filterParams) == null ? void 0 : C.onModelChange(m, h);
        },
        (f = (p = u.handler) == null ? void 0 : p.processModelToApply) == null ? void 0 : f.bind(u.handler)
      );
    };
    return e.onAction = (c, d, h) => {
      l(n, c, d), o.dispatchEvent({
        type: "filterAction",
        column: n,
        action: c,
        event: h
      });
    }, (c) => {
      var h;
      const d = (h = i()) == null ? void 0 : h.params;
      return this.createManagedBean(
        new Qp(
          n,
          {
            comp: c,
            params: d,
            isHandler: !0
          },
          o,
          l,
          !1
        )
      );
    };
  }
  executeWhenAllFiltersReady(e) {
    var t;
    (((t = this.wrappers) == null ? void 0 : t.length) ?? 0) > 0 ? e() : this.afterFiltersReadyFuncs.push(e);
  }
  updateActiveListForFilter(e, t) {
    this.updateActiveList(e, () => t == null ? void 0 : t.isFilterActive());
  }
  updateActiveListForHandler(e, t) {
    this.updateActiveList(e, () => t != null);
  }
  updateActiveList(e, t) {
    const s = this.activeFilterIndices;
    be(this.activeFilterIndices, e), t() && s.push(e);
  }
  /** Only called for non-handlers */
  onFilterModelChanged(e, t) {
    var s;
    this.updateActiveListForFilter(e, (s = this.wrappers[e]) == null ? void 0 : s.filter), this.filterChanged(e, t);
  }
  onHandlerModelChanged(e, t, s) {
    this.updateActiveListForHandler(e, t), this.filterChanged(e, s);
  }
  filterChanged(e, t) {
    this.filterChangedCallback(t), this.wrappers.forEach((s, i) => {
      var o;
      if (e === i || !s)
        return;
      const { filter: r, handler: n } = s;
      (o = n == null ? void 0 : n.onAnyFilterChanged) == null || o.call(n), typeof r.onAnyFilterChanged == "function" && r.onAnyFilterChanged();
    });
  }
  getModelAsString(e) {
    var i, r, n;
    if (!((i = e == null ? void 0 : e.filterModels) != null && i.length))
      return "";
    const t = this.getLastActiveFilterIndex() ?? 0, s = (r = this.wrappers[t]) == null ? void 0 : r.filter;
    return ((n = s == null ? void 0 : s.getModelAsString) == null ? void 0 : n.call(s, e.filterModels[t])) ?? "";
  }
}, jN = class extends R {
  constructor() {
    super(...arguments), this.filterType = "multi", this.handlerWrappers = [], this.activeFilterIndices = [], this.filterDefs = [];
  }
  init(e) {
    this.params = e;
    const t = La(e.filterParams);
    this.filterDefs = t, t.forEach((s, i) => {
      var a;
      const r = this.beans.colFilter.createHandler(e.column, s, "agTextColumnFilter");
      if (this.handlerWrappers.push(r), !r) {
        F(278, { colId: e.column.getColId() });
        return;
      }
      const { handler: n, handlerParams: o } = r;
      (a = n.init) == null || a.call(n, {
        ...this.updateHandlerParams(o, i),
        model: ws(e.model, i),
        source: "init"
      });
    }), this.resetActiveList(e.model);
  }
  refresh(e) {
    this.params = e;
    const { model: t, source: s, filterParams: i } = e, r = i == null ? void 0 : i.filters;
    this.handlerWrappers.forEach((n, o) => {
      var a, l;
      if (n) {
        const d = this.updateHandlerParams(e, o).filterParams, h = r == null ? void 0 : r[o].filterParams, u = h ? { ...d, ...h } : d, g = {
          ...this.updateHandlerParams(e, o),
          filterParams: u
        };
        n.handlerParams = g, (l = (a = n.handler).refresh) == null || l.call(a, {
          ...g,
          model: ws(t, o),
          source: s
        });
      }
    }), e.source !== "floating" && e.source !== "ui" && this.resetActiveList(e.model);
  }
  updateHandlerParams(e, t) {
    const { onModelChange: s, doesRowPassOtherFilter: i, getValue: r } = e, n = {
      ...e,
      onModelChange: (o, a) => s(
        gn(this.params.model, this.handlerWrappers.length, o, t),
        a
      ),
      doesRowPassOtherFilter: (o) => i(o) && this.doesFilterPass({ node: o, data: o.data, model: this.params.model, handlerParams: n }, t),
      getValue: Yo(this.beans, e.column, this.filterDefs[t], r)
    };
    return n;
  }
  doesFilterPass(e, t) {
    var i;
    const s = (i = e.model) == null ? void 0 : i.filterModels;
    return s == null ? !0 : this.handlerWrappers.every((r, n) => {
      const o = s[n];
      if (o == null || t != null && n === t)
        return !0;
      const a = r == null ? void 0 : r.handler;
      return !a || a.doesFilterPass({ ...e, model: o, handlerParams: r.handlerParams });
    });
  }
  resetActiveList(e) {
    this.activeFilterIndices = [];
    const t = e == null ? void 0 : e.filterModels;
    if (t != null)
      for (let s = 0; s < this.handlerWrappers.length; s++)
        t[s] != null && this.activeFilterIndices.push(s);
  }
  updateActiveList(e, t) {
    const s = this.activeFilterIndices;
    be(s, e), t != null && s.push(e);
  }
  getLastActiveFilterIndex() {
    const e = this.activeFilterIndices;
    return e.length > 0 ? e[e.length - 1] : null;
  }
  getModelAsString(e, t) {
    var o, a, l;
    const s = t === "filterToolPanel", i = () => s ? this.getLocaleTextFunc()("filterSummaryInactive", "is (All)") : "";
    if (!((o = e == null ? void 0 : e.filterModels) != null && o.length))
      return i();
    const r = this.getLastActiveFilterIndex() ?? 0, n = this.handlerWrappers[r];
    return ((l = n == null ? void 0 : (a = n.handler).getModelAsString) == null ? void 0 : l.call(a, e.filterModels[r], t)) ?? i();
  }
  getHandler(e) {
    var t;
    return (t = this.handlerWrappers[e]) == null ? void 0 : t.handler;
  }
  onAnyFilterChanged() {
    jo(this.handlerWrappers, (e) => {
      var t, s;
      return (s = (t = e == null ? void 0 : e.handler) == null ? void 0 : t.onAnyFilterChanged) == null ? void 0 : s.call(t);
    });
  }
  onNewRowsLoaded() {
    jo(this.handlerWrappers, (e) => {
      var t, s;
      return (s = (t = e == null ? void 0 : e.handler) == null ? void 0 : t.onNewRowsLoaded) == null ? void 0 : s.call(t);
    });
  }
  destroy() {
    this.handlerWrappers.forEach((e) => this.destroyBean(e == null ? void 0 : e.handler)), this.handlerWrappers.length = 0, super.destroy();
  }
}, YN = class extends R {
  constructor() {
    super(...arguments), this.beanName = "multiFilter";
  }
  getParamsForDataType(e, t, s, i) {
    let r = e == null ? void 0 : e.filters;
    const n = this.beans;
    r || (r = [{ filter: hd(s.baseDataType) }, { filter: "agSetColumnFilter" }]);
    const o = this.getLocaleTextFunc();
    return r = r.map((a) => {
      const {
        filter: l,
        filterParams: c,
        filterValueGetter: d
      } = a;
      if (typeof l != "string")
        return a;
      const { filterParams: h, filterValueGetter: u } = dd(
        l,
        c,
        d ?? t,
        s,
        i,
        n,
        o
      );
      return {
        ...a,
        filterParams: h,
        filterValueGetter: u
      };
    }), {
      filterParams: {
        ...e,
        filters: r
      }
    };
  }
}, jC = class extends $C {
  constructor() {
    super(...arguments), this.filterType = "multi", this.filters = [], this.filterParams = [], this.validity = [];
  }
  init(e) {
    this.params = e, this.filterDefs = La(e), this.allState = e.state;
    const t = this.filterDefs.map(
      (s, i) => this.createFilter(s, i)
    );
    return new U((s) => {
      U.all(t).then((i) => {
        this.filters = i, this.refreshGui("columnMenu").then(() => {
          s();
        });
      });
    });
  }
  refresh(e) {
    const { model: t, state: s, source: i } = e;
    if (i === "colDef")
      return !1;
    this.params = e;
    const r = this.filterParams;
    if (s === this.allState)
      return !0;
    this.allState = s;
    const n = s.state;
    return this.filters.forEach((o, a) => {
      const l = ws(t, a), c = {
        state: n == null ? void 0 : n[a],
        model: ws(s.model, a)
      };
      ma(o, r[a], l, c, i);
    }), !0;
  }
  getLastActiveFilterIndex() {
    var e, t;
    return ((t = (e = this.getHandler()).getLastActiveFilterIndex) == null ? void 0 : t.call(e)) ?? null;
  }
  getChildFilterInstance(e) {
    return this.filters[e] ?? void 0;
  }
  getNumChildFilters() {
    return this.filters.length;
  }
  destroy() {
    this.filters.forEach((e) => this.destroyBean(e)), this.filters.length = 0, super.destroy();
  }
  getFilterWrappers() {
    return this.filters;
  }
  getFilterFromWrapper(e) {
    return e;
  }
  getCompFromWrapper(e) {
    return e;
  }
  createFilter(e, t) {
    const s = this.beans.userCompFactory, i = this.updateParams(e, this.params, t), r = Mp(
      s,
      e,
      i,
      "agTextColumnFilter"
    );
    return r ? (this.filterParams[t] = r.params, r.newAgStackInstance()) : U.resolve(null);
  }
  updateParams(e, t, s) {
    var C;
    const {
      doesRowPassOtherFilter: i,
      model: r,
      onModelChange: n,
      state: o,
      onStateChange: a,
      column: l,
      source: c,
      onAction: d,
      onUiChange: h,
      getValue: u
    } = t, g = ws(r, s), p = o ? {
      model: ws(o.model, s),
      state: (C = o.state) == null ? void 0 : C[s]
    } : { model: g }, f = () => {
      const v = this.getHandler();
      this.filters.forEach((w, b) => {
        var y, P, E;
        s !== b && ((P = (y = v.getHandler(b)) == null ? void 0 : y.onAnyFilterChanged) == null || P.call(y), (E = w == null ? void 0 : w.onAnyFilterChanged) == null || E.call(w));
      });
    }, m = this.beans.colFilter;
    return {
      ...m.createBaseFilterParams(l),
      ...e,
      doesRowPassOtherFilter: (v) => i(v) && this.getHandler().doesFilterPass(
        {
          node: v,
          data: v.data,
          model: this.params.model,
          handlerParams: m.getHandlerParams(l)
        },
        s
      ),
      model: g,
      state: p,
      onModelChange: (v, w) => {
        const { filters: b, params: y } = this, P = gn(y.model, b.length, v, s);
        this.updateActiveList(s, v), n(P, w), f();
      },
      onStateChange: (v) => this.onStateChange(a, s, v),
      getHandler: () => this.getHandler().getHandler(s),
      onAction: (v, w, b) => {
        if (wn(t))
          return;
        const y = v === "apply" || v === "reset";
        y && this.updateActiveList(s, ws(this.params.state.model, s)), d(v, w, b), y && f();
      },
      onUiChange: h,
      source: c,
      getValue: Yo(this.beans, l, e, u)
    };
  }
  updateActiveList(e, t) {
    var s, i;
    (i = (s = this.getHandler()).updateActiveList) == null || i.call(s, e, t);
  }
  getHandler() {
    return this.params.getHandler();
  }
  onStateChange(e, t, s) {
    const { model: i, state: r, valid: n } = s, o = this.validity;
    o[t] = n;
    const a = this.allState, l = gn(a.model, this.filters.length, i, t), c = o.every((u) => u !== !1), d = [...a.state ?? []];
    d[t] = r;
    const h = {
      state: d,
      model: l,
      valid: c
    };
    this.allState = h, e(h);
  }
  getModelAsString(e) {
    var t, s;
    return ((s = (t = this.getHandler()).getModelAsString) == null ? void 0 : s.call(t, e)) ?? "";
  }
}, qN = {
  tag: "div",
  cls: "ag-multi-floating-filter ag-floating-filter-input"
}, XN = class extends D {
  constructor() {
    super(qN), this.floatingFilters = [], this.compDetailsList = [];
  }
  init(e) {
    this.params = e;
    const { compDetailsList: t } = this.getCompDetailsList(e);
    return this.setParams(t);
  }
  setParams(e) {
    const t = [];
    return e.forEach((s) => {
      const i = s == null ? void 0 : s.newAgStackInstance();
      i != null && (this.compDetailsList.push(s), t.push(i));
    }), U.all(t).then((s) => {
      s.forEach((i, r) => {
        this.floatingFilters.push(i);
        const n = i.getGui();
        this.appendChild(n), r > 0 && O(n, !1);
      });
    });
  }
  refresh(e) {
    var r, n;
    this.params = e;
    const { compDetailsList: t, floatingFilterParamsList: s } = this.getCompDetailsList(e);
    if (t.length === this.compDetailsList.length && t.every(
      (o, a) => {
        var l;
        return !((l = this.beans.colFilter) != null && l.areFilterCompsDifferent(this.compDetailsList[a], o));
      }
    )) {
      if (s.forEach((o, a) => {
        var c;
        const l = this.floatingFilters[a];
        (c = l.refresh) == null || c.call(l, o);
      }), this.gos.get("enableFilterHandlers")) {
        const o = e;
        if (o.model == null)
          this.floatingFilters.forEach((a, l) => {
            O(a.getGui(), l === 0);
          });
        else {
          const a = (n = (r = o.getHandler()) == null ? void 0 : r.getLastActiveFilterIndex) == null ? void 0 : n.call(r);
          this.floatingFilters.forEach((l, c) => {
            const d = a == null ? c === 0 : c === a;
            O(l.getGui(), d);
          });
        }
      }
    } else
      X(this.getGui()), this.destroyBeans(this.floatingFilters), this.floatingFilters = [], this.compDetailsList = [], this.setParams(t);
  }
  getCompDetailsList(e) {
    const t = [], s = [], i = e.filterParams, r = e.currentParentModel, n = La(i);
    return n.forEach((o, a) => {
      var d, h;
      const l = {
        ...e,
        // set the parent filter instance for each floating filter to the relevant child filter instance
        parentFilterInstance: (u) => {
          this.parentMultiFilterInstance((g) => {
            const p = g.getChildFilterInstance(a);
            p != null && u(p);
          });
        },
        // return the parent model for the specific filter
        currentParentModel: () => {
          var u, g;
          return ((g = (u = r()) == null ? void 0 : u.filterModels) == null ? void 0 : g[a]) ?? null;
        }
      };
      if (this.gos.get("enableFilterHandlers")) {
        const u = l;
        u.model = ((h = (d = u.model) == null ? void 0 : d.filterModels) == null ? void 0 : h[a]) ?? null;
        const { onModelChange: g, getHandler: p } = u;
        u.onModelChange = (f, m) => g(
          gn(
            this.params.model,
            n.length,
            f,
            a
          ),
          m
        ), u.getHandler = () => p().getHandler(a);
      }
      Fe(l.filterParams, o.filterParams);
      const c = this.getCompDetails(o, l);
      c && (t.push(c), s.push(l));
    }), { compDetailsList: t, floatingFilterParamsList: s };
  }
  onParentModelChanged(e, t) {
    t && t.afterFloatingFilter || this.parentMultiFilterInstance((s) => {
      if (e == null)
        this.floatingFilters.forEach((i, r) => {
          i.onParentModelChanged(null, t), O(i.getGui(), r === 0);
        });
      else {
        const i = s.getLastActiveFilterIndex();
        this.floatingFilters.forEach((r, n) => {
          const o = e.filterModels.length > n ? e.filterModels[n] : null;
          r.onParentModelChanged(o, t);
          const a = i == null ? n === 0 : n === i;
          O(r.getGui(), a);
        });
      }
    });
  }
  destroy() {
    this.destroyBeans(this.floatingFilters), this.floatingFilters.length = 0, super.destroy();
  }
  getCompDetails(e, t) {
    const { colFilter: s, frameworkOverrides: i, userCompFactory: r } = this.beans, n = rf(
      i,
      e,
      () => s.getDefaultFloatingFilter(this.params.column)
    ) ?? "agReadOnlyFloatingFilter";
    return Dp(r, e, t, n);
  }
  parentMultiFilterInstance(e) {
    this.params.parentFilterInstance((t) => {
      t instanceof KC || t instanceof jC || j(120), e(t);
    });
  }
}, ZN = {
  moduleName: "MultiFilter",
  version: Y,
  userComponents: {
    agMultiColumnFilter: {
      getComp: (e) => e.gos.get("enableFilterHandlers") ? {
        classImp: jC,
        params: {
          useForm: !0
        }
      } : KC
    },
    agMultiColumnFloatingFilter: XN
  },
  beans: [YN],
  dynamicBeans: {
    agMultiColumnFilterHandler: jN
  },
  dependsOn: [ie, Ls, Aa]
}, QN = class extends R {
  constructor() {
    super(...arguments), this.beanName = "aggColNameSvc";
  }
  getHeaderName(e, t) {
    if (this.gos.get("suppressAggFuncInHeader"))
      return t;
    const { valueColsSvc: s, colModel: i, rowGroupColsSvc: r } = this.beans, n = e.getColDef().pivotValueColumn, o = A(n);
    let a = null, l;
    if (o) {
      const c = (s == null ? void 0 : s.columns) ?? [], d = this.gos.get("removePivotHeaderRowWhenSingleValueColumn") && c.length === 1, h = e.getColDef().pivotTotalColumnIds !== void 0;
      if (d && !h)
        return t;
      a = n ? n.getAggFunc() : null, l = !0;
    } else {
      const c = e.isValueActive(), d = i.isPivotMode() || (r == null ? void 0 : r.columns.length) !== 0;
      c && d ? (a = e.getAggFunc(), l = !0) : l = !1;
    }
    if (l) {
      const c = typeof a == "string" ? a : "func";
      return `${this.getLocaleTextFunc()(c, c)}(${t})`;
    }
    return t;
  }
}, JN = {
  sum: "Sum",
  first: "First",
  last: "Last",
  min: "Min",
  max: "Max",
  count: "Count",
  avg: "Average"
}, eH = class extends R {
  constructor() {
    super(...arguments), this.beanName = "aggFuncSvc", this.aggFuncsMap = {}, this.initialised = !1;
  }
  postConstruct() {
    this.init();
  }
  init() {
    this.initialised || (this.initialiseWithDefaultAggregations(), this.addAggFuncs(this.gos.get("aggFuncs")));
  }
  initialiseWithDefaultAggregations() {
    const e = this.aggFuncsMap;
    e.sum = tH, e.first = sH, e.last = iH, e.min = rH, e.max = nH, e.count = aH, e.avg = cH, this.initialised = !0;
  }
  isAggFuncPossible(e, t) {
    const i = this.getFuncNames(e).includes(t), r = A(this.aggFuncsMap[t]);
    return i && r;
  }
  getDefaultFuncLabel(e) {
    return JN[e] ?? e;
  }
  getDefaultAggFunc(e) {
    const t = e.getColDef().defaultAggFunc;
    if (A(t) && this.isAggFuncPossible(e, t))
      return t;
    if (this.isAggFuncPossible(e, "sum"))
      return "sum";
    const s = this.getFuncNames(e);
    return s != null && s.length ? s[0] : null;
  }
  addAggFuncs(e) {
    if (this.init(), !!e)
      for (const t of Object.keys(e))
        e[t] && (this.aggFuncsMap[t] = e[t]);
  }
  getAggFunc(e) {
    return this.init(), this.aggFuncsMap[e];
  }
  getFuncNames(e) {
    const t = e.getColDef().allowedAggFuncs;
    return t ?? Object.keys(this.aggFuncsMap).sort();
  }
  clear() {
    this.aggFuncsMap = {};
  }
};
function tH(e) {
  const { values: t } = e;
  let s = null;
  for (let i = 0; i < t.length; i++) {
    const r = t[i];
    typeof r == "number" ? s === null ? s = r : s += typeof s == "number" ? r : BigInt(r) : typeof r == "bigint" && (s === null ? s = r : s = (typeof s == "bigint" ? s : BigInt(s)) + r);
  }
  return s;
}
function sH(e) {
  return e.values.length > 0 ? e.values[0] : null;
}
function iH(e) {
  return e.values.length > 0 ? _(e.values) : null;
}
function rH(e) {
  const { values: t } = e;
  let s = null;
  for (let i = 0; i < t.length; i++) {
    const r = t[i];
    (typeof r == "number" || typeof r == "bigint") && (s === null || s > r) && (s = r);
  }
  return s;
}
function nH(e) {
  const { values: t } = e;
  let s = null;
  for (let i = 0; i < t.length; i++) {
    const r = t[i];
    (typeof r == "number" || typeof r == "bigint") && (s === null || s < r) && (s = r);
  }
  return s;
}
var oH = Object.freeze({
  // the grid by default uses toString to render values for an object, so this
  // is a trick to get the default cellRenderer to display the avg value
  toString: function() {
    return this.value.toString();
  },
  // used for sorting
  toNumber: function() {
    return this.value;
  }
});
function aH(e) {
  var n, o;
  const { values: t } = e;
  let s = 0;
  for (let a = 0; a < t.length; a++) {
    const l = t[a];
    s += l != null && typeof l.value == "number" ? l.value : 1;
  }
  const i = (o = (n = e.rowNode) == null ? void 0 : n.aggData) == null ? void 0 : o[e.column.getColId()];
  if (i && i.value === s)
    return i;
  const r = Object.create(oH);
  return r.value = s, r;
}
var lH = Object.freeze({
  // the grid by default uses toString to render values for an object, so this
  // is a trick to get the default cellRenderer to display the avg value
  toString: function() {
    return typeof this.value == "number" || typeof this.value == "bigint" ? this.value.toString() : "";
  },
  // used for sorting
  toNumber: function() {
    return this.value;
  }
});
function cH(e) {
  var a, l, c;
  const { values: t } = e;
  let s = 0, i = 0;
  for (let d = 0; d < t.length; d++) {
    const h = t[d];
    let u = null;
    typeof h == "number" || typeof h == "bigint" ? (u = h, i++) : h != null && (typeof h.value == "number" || typeof h.value == "bigint") && typeof h.count == "number" && (u = h.value * (typeof h.value == "number" ? h.count : BigInt(h.count)), i += h.count), typeof u == "number" ? s += typeof s == "number" ? u : BigInt(u) : typeof u == "bigint" && (s = (typeof s == "bigint" ? s : BigInt(s)) + u);
  }
  let r = null;
  i > 0 && (r = s / (typeof s == "number" ? i : BigInt(i)));
  const n = (c = (a = e.rowNode) == null ? void 0 : a.aggData) == null ? void 0 : c[(l = e.column) == null ? void 0 : l.getColId()];
  if (n && n.count === i && n.value === r)
    return n;
  const o = Object.create(lH);
  return o.count = i, o.value = r, o;
}
function dH(e, t) {
  e.aggFuncSvc && e.aggFuncSvc.addAggFuncs(t);
}
function hH(e) {
  e.aggFuncSvc && e.aggFuncSvc.clear();
}
function uH(e, t, s) {
  var i, r;
  (r = (i = e.valueColsSvc) == null ? void 0 : i.setColumnAggFunc) == null || r.call(i, t, s, "api");
}
function cr(e, t, s, i, r, n) {
  const o = typeof s == "string" ? e.aggFuncSvc.getAggFunc(s) : s;
  if (typeof o != "function")
    return F(109, { inputValue: s.toString(), allSuggestions: e.aggFuncSvc.getFuncNames(i) }), null;
  const a = V(e.gos, {
    values: t,
    column: i,
    colDef: i.colDef,
    pivotResultColumn: n,
    rowNode: r,
    // this is typed incorrectly. Within CSRM, this will always be defined. When called from integrated charts, this will never be defined.
    data: r == null ? void 0 : r.data
  });
  return o(a);
}
var gH = class extends R {
  constructor() {
    super(...arguments), this.beanName = "aggStage", this.refreshProps = /* @__PURE__ */ new Set([
      "getGroupRowAgg",
      "alwaysAggregateAtRootLevel",
      "suppressAggFilteredOnly",
      "grandTotalRow"
    ]), this.step = "aggregate";
  }
  wireBeans(e) {
    this.colModel = e.colModel, this.pivotColsSvc = e.pivotColsSvc, this.valueColsSvc = e.valueColsSvc, this.pivotResultCols = e.pivotResultCols, this.valueSvc = e.valueSvc;
  }
  // it's possible to recompute the aggregate without doing the other parts
  // + api.refreshClientSideRowModel('aggregate')
  execute(e) {
    var r, n, o;
    const t = !((n = (r = this.valueColsSvc) == null ? void 0 : r.columns) != null && n.length), s = !this.gos.getCallback("getGroupRowAgg");
    if (t && s && ((o = e.changedPath) != null && o.active))
      return;
    const i = this.createAggDetails(e);
    this.recursivelyCreateAggData(i);
  }
  createAggDetails(e) {
    var n;
    const t = this.colModel.isPivotActive(), s = (n = this.valueColsSvc) == null ? void 0 : n.columns, i = t && this.pivotColsSvc ? this.pivotColsSvc.columns : [];
    return {
      alwaysAggregateAtRootLevel: this.gos.get("alwaysAggregateAtRootLevel"),
      groupIncludeTotalFooter: !!wr(this.gos),
      changedPath: e.changedPath,
      valueColumns: s ?? [],
      pivotColumns: i,
      filteredOnly: !this.isSuppressAggFilteredOnly(),
      userAggFunc: this.gos.getCallback("getGroupRowAgg")
    };
  }
  isSuppressAggFilteredOnly() {
    return sn(this.gos) !== void 0 || this.gos.get("suppressAggFilteredOnly");
  }
  recursivelyCreateAggData(e) {
    const t = (s) => {
      if (!s.hasChildren()) {
        s.aggData && this.setAggData(s, null);
        return;
      }
      if (s.level === -1 && !e.groupIncludeTotalFooter) {
        const n = !this.colModel.isPivotMode();
        if (!e.alwaysAggregateAtRootLevel && n) {
          this.setAggData(s, null);
          return;
        }
      }
      this.aggregateRowNode(s, e);
    };
    e.changedPath.forEachChangedNodeDepthFirst(t, !0);
  }
  aggregateRowNode(e, t) {
    const s = t.valueColumns.length === 0, i = t.pivotColumns.length === 0;
    let r;
    t.userAggFunc ? r = t.userAggFunc({ nodes: e.childrenAfterFilter }) : s ? r = null : i ? r = this.aggregateRowNodeUsingValuesOnly(e, t) : r = this.aggregateRowNodeUsingValuesAndPivot(e), this.setAggData(e, r), e.sibling && (this.setAggData(e.sibling, r), e.sibling.pinnedSibling && this.setAggData(e.sibling.pinnedSibling, r));
  }
  aggregateRowNodeUsingValuesAndPivot(e) {
    var n, o;
    const t = {}, s = ((o = (n = this.pivotResultCols) == null ? void 0 : n.getPivotResultCols()) == null ? void 0 : o.list) ?? [];
    let i = !0;
    const r = this.beans;
    for (let a = 0; a < s.length; a++) {
      const l = s[a], c = l.getColDef();
      if (c.pivotTotalColumnIds != null) {
        i = !1;
        continue;
      }
      const d = c.pivotKeys ?? [];
      let h;
      e.leafGroup ? h = this.getValuesFromMappedSet(e.childrenMapped, d, c.pivotValueColumn) : h = this.getValuesPivotNonLeaf(e, c.colId), t[c.colId] = cr(
        r,
        h,
        c.pivotValueColumn.getAggFunc(),
        c.pivotValueColumn,
        e,
        l
      );
    }
    if (!i)
      for (let a = 0; a < s.length; a++) {
        const l = s[a], c = l.getColDef();
        if (c.pivotTotalColumnIds == null || !c.pivotTotalColumnIds.length)
          continue;
        const d = c.pivotTotalColumnIds.map(
          (h) => t[h]
        );
        t[c.colId] = cr(
          r,
          d,
          c.pivotValueColumn.getAggFunc(),
          c.pivotValueColumn,
          e,
          l
        );
      }
    return t;
  }
  aggregateRowNodeUsingValuesOnly(e, t) {
    const s = {}, { changedPath: i, valueColumns: r, filteredOnly: n } = t, o = i.active ? i.getValueColumnsForNode(e, r) : r, a = i.active ? i.getNotValueColumnsForNode(e, r) : null, l = this.getValuesNormal(e, o, n), c = e.aggData, d = this.beans;
    return o.forEach((h, u) => {
      s[h.getId()] = cr(
        d,
        l[u],
        h.getAggFunc(),
        h,
        e
      );
    }), a && c && a.forEach((h) => {
      s[h.getId()] = c[h.getId()];
    }), s;
  }
  getValuesPivotNonLeaf(e, t) {
    return e.childrenAfterFilter.map((s) => s.aggData[t]);
  }
  getValuesFromMappedSet(e, t, s) {
    let i = e;
    for (let r = 0; r < t.length; r++) {
      const n = t[r];
      i = i ? i[n] : null;
    }
    return i ? i.map((r) => this.valueSvc.getValue(s, r)) : [];
  }
  getValuesNormal(e, t, s) {
    const i = [];
    t.forEach(() => i.push([]));
    const r = t.length, n = s ? e.childrenAfterFilter : e.childrenAfterGroup, o = n.length;
    for (let a = 0; a < o; a++) {
      const l = n[a];
      for (let c = 0; c < r; c++) {
        const d = t[c], h = this.valueSvc.getValue(d, l);
        i[c].push(h);
      }
    }
    return i;
  }
  setAggData(e, t) {
    const s = e.aggData;
    if (e.aggData = t, e.__localEventService) {
      const i = (r) => {
        const n = e.aggData ? e.aggData[r] : void 0, o = s ? s[r] : void 0;
        if (n === o)
          return;
        const a = this.colModel.getColById(r);
        a && e.dispatchCellChangedEvent(a, n, o);
      };
      if (s)
        for (const r of Object.keys(s))
          i(r);
      if (t)
        for (const r of Object.keys(t))
          (!s || !(r in s)) && i(r);
    }
  }
}, pH = class extends R {
  constructor() {
    super(...arguments), this.beanName = "filterAggStage", this.refreshProps = /* @__PURE__ */ new Set([]), this.step = "filter_aggregates";
  }
  wireBeans(e) {
    this.filterManager = e.filterManager;
  }
  execute(e) {
    var c, d;
    const t = this.beans.colModel.isPivotMode(), s = ((c = this.filterManager) == null ? void 0 : c.isAggregateFilterPresent()) || ((d = this.filterManager) == null ? void 0 : d.isAggregateQuickFilterPresent()), i = (h) => !h.node.group, r = (h) => h.node.leafGroup, n = sn(this.gos) || (t ? r : i), { changedPath: o } = e, a = (h, u = !1) => {
      h.childrenAfterFilter && (h.childrenAfterAggFilter = h.childrenAfterFilter, u && h.childrenAfterAggFilter.forEach((g) => a(g, u)), this.setAllChildrenCount(h)), h.sibling && (h.sibling.childrenAfterAggFilter = h.childrenAfterAggFilter);
    }, l = (h) => {
      var u;
      h.childrenAfterAggFilter = ((u = h.childrenAfterFilter) == null ? void 0 : u.filter((g) => {
        var m;
        return n({ node: g }) && this.filterManager.doesRowPassAggregateFilters({ rowNode: g }) ? (a(g, !0), !0) : (m = g.childrenAfterAggFilter) == null ? void 0 : m.length;
      })) || null, this.setAllChildrenCount(h), h.sibling && (h.sibling.childrenAfterAggFilter = h.childrenAfterAggFilter);
    };
    o.forEachChangedNodeDepthFirst(s ? l : a, !0);
  }
  /** for tree data, we include all children, groups and leafs */
  setAllChildrenCountTreeData(e) {
    const t = e.childrenAfterAggFilter;
    let s = 0;
    if (t) {
      const i = t.length;
      s = i;
      for (let r = 0; r < i; ++r)
        s += t[r].allChildrenCount ?? 0;
    }
    e.setAllChildrenCount(
      // Maintain the historical behaviour:
      // - allChildrenCount is 0 in the root if there are no children
      // - allChildrenCount is null in any non-root row if there are no children
      s === 0 && e.level >= 0 ? null : s
    );
  }
  /* for grid data, we only count the leafs */
  setAllChildrenCountGridGrouping(e) {
    let t = 0;
    e.childrenAfterAggFilter.forEach((s) => {
      s.group ? t += s.allChildrenCount : t++;
    }), e.setAllChildrenCount(t);
  }
  setAllChildrenCount(e) {
    if (!e.hasChildren()) {
      e.setAllChildrenCount(null);
      return;
    }
    this.gos.get("treeData") ? this.setAllChildrenCountTreeData(e) : this.setAllChildrenCountGridGrouping(e);
  }
};
function Fs(e, t) {
  if (e.sibling)
    return;
  const s = qp(e, t);
  s.footer = !0, s.setRowTop(null), s.setRowIndex(null), s.oldRowTop = null, s.id = "rowGroupFooter_" + e.id, s.sibling = e, e.sibling = s;
}
function Kd(e) {
  e.sibling && (e.sibling.setRowTop(null), e.sibling.setRowIndex(null), e.sibling = void 0);
}
var fH = class extends R {
  constructor() {
    super(...arguments), this.beanName = "footerSvc";
  }
  addTotalRows(e, t, s, i, r, n) {
    let o = e;
    if (r) {
      const c = i && wr(this.gos);
      return mH(n, c) && (Fs(t, this.beans), s(t.sibling, o++)), o;
    }
    const a = ur(this.gos);
    return (i && a({ node: t })) === n && (Fs(t, this.beans), s(t.sibling, o++)), o;
  }
  getTopDisplayIndex(e, t, s, i) {
    let r = t;
    if (e[0].footer) {
      if (t === 0)
        return 0;
      r -= 1;
    }
    const n = e[e.length - 1], o = r >= s.length;
    return n.footer && o ? n.rowIndex : i(r);
  }
  doesCellShowTotalPrefix(e, t) {
    var s;
    return !e.footer || !(t != null && t.getColDef().showRowGroup) ? !1 : this.gos.get("treeData") ? !0 : e.level === -1 ? ((s = this.beans.showRowGroupCols) == null ? void 0 : s.getShowRowGroupCols()[0]) === t : !!e.rowGroupColumn && t && t.isRowGroupDisplayed(e.rowGroupColumn.getId());
  }
  applyTotalPrefix(e, t, s, i) {
    var n, o;
    const r = (n = i.getColDef().cellRendererParams) == null ? void 0 : n.totalValueGetter;
    if (r) {
      const a = V(this.gos, { column: i, node: s, value: e, formattedValue: t });
      if (typeof r === "function")
        return r(a);
      if (typeof r == "string")
        return (o = this.beans.expressionSvc) == null ? void 0 : o.evaluate(r, a);
      F(179);
    }
    return s.level === -1 ? this.getLocaleTextFunc()("footerTotal", "Total") + " " : this.getTotalValue(t ?? e) ?? "";
  }
  getTotalValue(e) {
    return this.getLocaleTextFunc()("footerTotal", "Total") + " " + (e ?? "");
  }
};
function mH(e, t) {
  switch (t) {
    case "top":
    case "pinnedTop":
      return e === "top";
    case "bottom":
    case "pinnedBottom":
      return e === "bottom";
    default:
      return !1;
  }
}
var YC = class extends Zc {
  constructor() {
    super(...arguments), this.beanName = "valueColsSvc", this.eventName = "columnValueChanged", this.columnProcessors = {
      set: (e, t, s) => this.setValueActive(t, e, s),
      add: (e, t, s) => this.setValueActive(!0, e, s),
      remove: (e, t, s) => this.setValueActive(!1, e, s)
    }, this.columnExtractors = {
      setFlagFunc: (e, t, s) => this.setColValueActive(e, t, s),
      getIndexFunc: () => {
      },
      getInitialIndexFunc: () => {
      },
      getValueFunc: (e) => {
        const t = e.aggFunc;
        if (t === null || t === "")
          return null;
        if (t !== void 0)
          return !!t;
      },
      getInitialValueFunc: (e) => e.initialAggFunc != null && e.initialAggFunc != ""
    }, this.modifyColumnsNoEventsCallbacks = {
      addCol: (e) => this.columns.push(e),
      removeCol: (e) => be(this.columns, e)
    };
  }
  extractCols(e, t) {
    return this.columns = super.extractCols(e, t), this.columns.forEach((s) => {
      const i = s.getColDef();
      i.aggFunc != null && i.aggFunc != "" ? this.setColAggFunc(s, i.aggFunc) : s.getAggFunc() || this.setColAggFunc(s, i.initialAggFunc);
    }), this.columns;
  }
  setColumnAggFunc(e, t, s) {
    if (!e)
      return;
    const i = this.colModel.getColDefCol(e);
    i && (this.setColAggFunc(i, t), this.dispatchColumnChangedEvent(this.eventSvc, this.eventName, [i], s));
  }
  syncColumnWithState(e, t, s) {
    const i = s("aggFunc").value1;
    i !== void 0 && (typeof i == "string" ? (this.setColAggFunc(e, i), e.isValueActive() || (this.setColValueActive(e, !0, t), this.modifyColumnsNoEventsCallbacks.addCol(e))) : (A(i) && F(33), e.isValueActive() && (this.setColValueActive(e, !1, t), this.modifyColumnsNoEventsCallbacks.removeCol(e))));
  }
  setValueActive(e, t, s) {
    if (e !== t.isValueActive() && (this.setColValueActive(t, e, s), e && !t.getAggFunc() && this.aggFuncSvc)) {
      const i = this.aggFuncSvc.getDefaultAggFunc(t);
      this.setColAggFunc(t, i);
    }
  }
  setColAggFunc(e, t) {
    e.aggFunc = t, e.dispatchStateUpdatedEvent("aggFunc");
  }
  setColValueActive(e, t, s) {
    e.aggregationActive !== t && (e.aggregationActive = t, e.dispatchColEvent("columnValueChanged", s));
  }
}, jd = {
  moduleName: "SharedAggregation",
  version: Y,
  beans: [eH, QN, fH, YC],
  apiFunctions: {
    addAggFuncs: dH,
    clearAggFuncs: hH,
    setColumnAggFunc: uH
  },
  dependsOn: [ie]
}, qC = {
  moduleName: "Aggregation",
  version: Y,
  beans: [gH, pH],
  rowModels: ["clientSide"],
  dependsOn: [jd]
}, CH = ({ valueSvc: e }, t, s) => {
  const i = e.getValue(t, s);
  let r = null;
  return i instanceof Date ? r = i : typeof i == "string" && (r = ke(i)), r;
}, Vs = (e, t, s, i) => (r) => {
  const n = CH(e, t, r.node), o = Xi(n);
  return o ? (i == null ? void 0 : i(o[s])) ?? o[s] : null;
}, Bs = ({ colNames: e }, t, s) => (i) => {
  const r = e.getDisplayNameForColumn(t, i.location);
  return r ? `${r} (${s})` : "";
}, vH = Object.fromEntries(Do.map((e) => [e, e.toLowerCase()])), wH = (e) => {
  const t = Do[parseInt(e, 10) - 1] ?? e, s = vH[t] ?? e;
  return { month: t, localeKey: s };
}, bH = class extends R {
  constructor() {
    super(...arguments), this.beanName = "groupHierarchyColSvc", this.columns = null, this.sourceColumnMap = /* @__PURE__ */ new WeakMap(), this.inverseColumnMap = /* @__PURE__ */ new WeakMap();
  }
  addColumns(e) {
    const t = this.columns;
    t != null && (e.list = t.list.filter((s) => !e.list.some((i) => i.getColId() === s.getColId())).concat(e.list), e.tree = t.tree.filter((s) => !e.tree.some((i) => i.getId() === s.getId())).concat(e.tree), da(e));
  }
  createColumns(e) {
    var o, a;
    this.sourceColumnMap = /* @__PURE__ */ new WeakMap(), this.inverseColumnMap = /* @__PURE__ */ new WeakMap();
    const t = this.createGroupHierarchyColumns(e);
    if (ca(t, ((o = this.columns) == null ? void 0 : o.list) ?? []))
      return;
    Ht(this.beans, (a = this.columns) == null ? void 0 : a.tree), this.columns = null;
    const { colGroupSvc: i } = this.beans, r = (i == null ? void 0 : i.findDepth(e.tree)) ?? 0, n = (i == null ? void 0 : i.balanceTreeForAutoCols(t, r)) ?? [];
    this.columns = {
      list: t,
      tree: n,
      treeDepth: r,
      map: {}
    };
  }
  updateColumns(e) {
  }
  getColumn(e) {
    var t;
    return ((t = this.columns) == null ? void 0 : t.list.find((s) => nn(s, e))) ?? null;
  }
  getColumns() {
    var e;
    return ((e = this.columns) == null ? void 0 : e.list) ?? null;
  }
  expandColumnInto(e, t) {
    const s = this.getVirtualColumnsForColumn(t).concat(t);
    for (const i of s)
      e.some((r) => nn(r, i) || r.getColId() === i.getColId()) || e.push(i);
  }
  compareVirtualColumns(e, t) {
    var r, n;
    const s = this.inverseColumnMap.get(e), i = this.inverseColumnMap.get(t);
    if (s && s === i) {
      const o = this.sourceColumnMap.get(s) ?? [];
      return (o == null ? void 0 : o.indexOf(e)) - (o == null ? void 0 : o.indexOf(t));
    }
    return (r = this.sourceColumnMap.get(e)) != null && r.includes(t) ? 1 : (n = this.sourceColumnMap.get(t)) != null && n.includes(e) ? -1 : null;
  }
  insertVirtualColumnsForCol(e, t) {
    const s = this.getVirtualColumnsForColumn(t) ?? [];
    for (const i of s)
      e.includes(i) || e.push(i);
  }
  getVirtualColumnsForColumn(e) {
    return this.isGroupHierarchyColsEnabledForCol(e) ? this.sourceColumnMap.get(e) ?? [] : [];
  }
  isGroupHierarchyColsEnabled(e) {
    return e.list.some((t) => this.isGroupHierarchyColsEnabledForCol(t));
  }
  isGroupHierarchyColsEnabledForCol(e) {
    const t = e.getColDef();
    return !!(t.rowGroupingHierarchy && (t.rowGroup || t.enableRowGroup));
  }
  createGroupHierarchyColDefs(e) {
    const t = [], s = e.getColDef();
    if (!s.rowGroupingHierarchy || !this.isGroupHierarchyColsEnabledForCol(e))
      return t;
    for (const i of s.rowGroupingHierarchy) {
      let r = null;
      typeof i == "string" ? r = this.createColDefForPart(i, e, s) : r = i, r && t.push(r);
    }
    return t;
  }
  createGroupHierarchyColumns(e) {
    if (!this.isGroupHierarchyColsEnabled(e))
      return [];
    const t = [];
    for (const s of e.list)
      this.createGroupHierarchyColDefs(s).forEach((i) => {
        const r = i.colId;
        this.gos.validateColDef(i, r, !0);
        const n = new Wt(i, null, r, !0);
        this.createBean(n), t.push(n), yH(this.sourceColumnMap, s, n), this.inverseColumnMap.set(n, s);
      });
    return t;
  }
  createColDefForPart(e, t, s) {
    var d;
    const { beans: i, gos: r } = this, n = `${tb}-${t.getColId()}-${e}`, o = {
      enableRowGroup: !0,
      rowGroup: s.rowGroup,
      enablePivot: s.enablePivot,
      hide: !0,
      editable: !1
    }, a = r.get("groupHierarchyConfig") ?? {};
    if (e in a) {
      const h = a[e];
      return h.colId ?? (h.colId = n), Ti(this.beans, { ...o, ...h }, h.colId, !0);
    }
    const l = Ti(i, { colId: n, ...o }, n, !0), c = (d = i.localeSvc) == null ? void 0 : d.getLocaleTextFunc();
    switch (e) {
      case "year":
        return {
          ...l,
          headerValueGetter: Bs(i, t, "Year"),
          valueGetter: Vs(i, t, 0)
        };
      case "quarter":
        return {
          ...l,
          headerValueGetter: Bs(i, t, "Quarter"),
          valueGetter: Vs(
            i,
            t,
            1,
            (h) => (Math.floor(Number(h) / 4) + 1).toString()
          )
        };
      case "month":
        return {
          ...l,
          headerValueGetter: Bs(i, t, "Month"),
          valueGetter: Vs(i, t, 1)
        };
      case "formattedMonth":
        return {
          ...l,
          headerValueGetter: Bs(i, t, "Month"),
          valueGetter: Vs(i, t, 1, (h) => {
            const u = wH(h);
            return (c == null ? void 0 : c(u.localeKey, u.month)) ?? u.month;
          })
        };
      case "day":
        return {
          ...l,
          headerValueGetter: Bs(i, t, "Day"),
          valueGetter: Vs(i, t, 2)
        };
      case "hour":
        return {
          ...l,
          headerValueGetter: Bs(i, t, "Hour"),
          valueGetter: Vs(i, t, 3)
        };
      case "minute":
        return {
          ...l,
          headerValueGetter: Bs(i, t, "Minute"),
          valueGetter: Vs(i, t, 4)
        };
      case "second":
        return {
          ...l,
          headerValueGetter: Bs(i, t, "Second"),
          valueGetter: Vs(i, t, 5)
        };
      default:
        return null;
    }
  }
};
function yH(e, t, s) {
  const i = e.get(t);
  e.set(t, (i ?? []).concat(s));
}
var SH = {
  moduleName: "GroupHierarchy",
  version: Y,
  beans: [bH]
}, XC = class extends Zc {
  constructor() {
    super(...arguments), this.beanName = "pivotColsSvc", this.eventName = "columnPivotChanged", this.columnProcessors = {
      set: (e, t, s) => this.setColPivotActive(e, t, s),
      add: (e, t, s) => this.setColPivotActive(e, !0, s),
      remove: (e, t, s) => this.setColPivotActive(e, !1, s)
    }, this.columnOrdering = {
      enableProp: "pivot",
      initialEnableProp: "initialPivot",
      indexProp: "pivotIndex",
      initialIndexProp: "initialPivotIndex"
    }, this.columnExtractors = {
      setFlagFunc: (e, t, s) => this.setColPivotActive(e, t, s),
      getIndexFunc: (e) => e.pivotIndex,
      getInitialIndexFunc: (e) => e.initialPivotIndex,
      getValueFunc: (e) => e.pivot,
      getInitialValueFunc: (e) => e.initialPivot
    }, this.modifyColumnsNoEventsCallbacks = {
      addCol: (e) => this.columns.push(e),
      removeCol: (e) => be(this.columns, e)
    };
  }
  syncColumnWithState(e, t, s, i) {
    const { value1: r, value2: n } = s("pivot", "pivotIndex");
    (r !== void 0 || n !== void 0) && (typeof n == "number" || r ? (e.isPivotActive() || (this.setColPivotActive(e, !0, t), this.modifyColumnsNoEventsCallbacks.addCol(e)), i && typeof n == "number" && (i[e.getId()] = n)) : e.isPivotActive() && (this.setColPivotActive(e, !1, t), this.modifyColumnsNoEventsCallbacks.removeCol(e)));
  }
  setColPivotActive(e, t, s) {
    e.pivotActive !== t && (e.pivotActive = t, e.dispatchColEvent("columnPivotChanged", s)), e.dispatchStateUpdatedEvent("pivot");
  }
}, xH = class extends Zc {
  constructor() {
    super(...arguments), this.beanName = "rowGroupColsSvc", this.eventName = "columnRowGroupChanged", this.columnProcessors = {
      set: (e, t, s) => this.setActive(t, e, s),
      add: (e, t, s) => this.setActive(!0, e, s),
      remove: (e, t, s) => this.setActive(!1, e, s)
    }, this.columnOrdering = {
      enableProp: "rowGroup",
      initialEnableProp: "initialRowGroup",
      indexProp: "rowGroupIndex",
      initialIndexProp: "initialRowGroupIndex"
    }, this.columnExtractors = {
      setFlagFunc: (e, t, s) => this.setColRowGroupActive(e, t, s),
      getIndexFunc: (e) => e.rowGroupIndex,
      getInitialIndexFunc: (e) => e.initialRowGroupIndex,
      getValueFunc: (e) => e.rowGroup,
      getInitialValueFunc: (e) => e.initialRowGroup
    }, this.modifyColumnsNoEventsCallbacks = {
      addCol: (e) => {
        var t;
        (t = this.beans.groupHierarchyColSvc) == null || t.insertVirtualColumnsForCol(this.columns, e), this.columns.includes(e) || this.columns.push(e);
      },
      removeCol: (e) => be(this.columns, e)
    };
  }
  moveColumn(e, t, s) {
    if (this.columns.length === 0)
      return;
    const i = this.columns[e], r = this.columns.slice(e, t);
    this.columns.splice(e, 1), this.columns.splice(t, 0, i), this.updateIndexMap(), this.eventSvc.dispatchEvent({
      type: this.eventName,
      columns: r,
      column: r.length === 1 ? r[0] : null,
      source: s
    });
  }
  syncColumnWithState(e, t, s, i) {
    const { value1: r, value2: n } = s("rowGroup", "rowGroupIndex");
    (r !== void 0 || n !== void 0) && (typeof n == "number" || r ? (e.isRowGroupActive() || (this.setColRowGroupActive(e, !0, t), this.modifyColumnsNoEventsCallbacks.addCol(e)), i && typeof n == "number" && (i[e.getId()] = n)) : e.isRowGroupActive() && (this.setColRowGroupActive(e, !1, t), this.modifyColumnsNoEventsCallbacks.removeCol(e)));
  }
  setActive(e, t, s) {
    var r;
    if (e === t.isRowGroupActive())
      return;
    this.setColRowGroupActive(t, e, s);
    const i = (r = this.beans.groupHierarchyColSvc) == null ? void 0 : r.getColumn(t);
    tp(this.gos, e) && !i && this.colModel.setColsVisible([t], !e, s);
  }
  setColRowGroupActive(e, t, s) {
    var i;
    e.rowGroupActive !== t && (e.rowGroupActive = t, t && ((i = this.beans.groupHierarchyColSvc) == null || i.insertVirtualColumnsForCol(this.columns, e)), e.dispatchColEvent("columnRowGroupChanged", s)), e.dispatchStateUpdatedEvent("rowGroup");
  }
}, FH = class extends R {
  constructor() {
    super(...arguments), this.beanName = "autoColSvc";
  }
  postConstruct() {
    this.addManagedPropertyListener("autoGroupColumnDef", this.updateColumns.bind(this));
  }
  addColumns(e) {
    this.columns != null && (e.list = this.columns.list.concat(e.list), e.tree = this.columns.tree.concat(e.tree), da(e));
  }
  createColumns(e, t) {
    var P;
    const s = this.beans, { colModel: i, gos: r, rowGroupColsSvc: n, colGroupSvc: o } = s, a = i.isPivotMode(), l = Uc(r, a), c = a ? r.get("pivotSuppressAutoColumn") : this.isSuppressAutoCol(), d = n == null ? void 0 : n.columns, u = !(d && d.length > 0 || r.get("treeData")) || c || l, g = () => {
      this.columns && (Ht(s, this.columns.tree), this.columns = null);
    };
    if (u) {
      g();
      return;
    }
    const p = this.generateAutoCols(d), f = ca(p, ((P = this.columns) == null ? void 0 : P.list) || null), m = e.treeDepth, v = (this.columns ? this.columns.treeDepth : -1) == m;
    if (f && v)
      return;
    g();
    const w = (o == null ? void 0 : o.findDepth(e.tree)) ?? 0, b = (o == null ? void 0 : o.balanceTreeForAutoCols(p, w)) ?? [];
    this.columns = {
      list: p,
      tree: b,
      treeDepth: w,
      map: {}
    }, t((E) => {
      if (!E)
        return null;
      const M = E.filter((T) => !la(T));
      return [...p, ...M];
    });
  }
  updateColumns(e) {
    var s;
    const t = qs(e.source);
    (s = this.columns) == null || s.list.forEach((i, r) => this.updateOneAutoCol(i, r, t));
  }
  getColumn(e) {
    var t;
    return ((t = this.columns) == null ? void 0 : t.list.find((s) => nn(s, e))) ?? null;
  }
  getColumns() {
    var e;
    return ((e = this.columns) == null ? void 0 : e.list) ?? null;
  }
  generateAutoCols(e = []) {
    const t = [], s = this.gos.get("treeData");
    let i = _c(this.gos);
    return s && i && (F(182), i = !1), i ? e.forEach((r, n) => {
      t.push(this.createOneAutoCol(r, n));
    }) : t.push(this.createOneAutoCol()), t;
  }
  isSuppressAutoCol() {
    const e = this.gos;
    return e.get("groupDisplayType") === "custom" ? !0 : e.get("treeDataDisplayType") === "custom";
  }
  // rowGroupCol and index are missing if groupDisplayType != "multipleColumns"
  createOneAutoCol(e, t) {
    let s;
    e ? s = `${ti}-${e.getId()}` : s = ti;
    const i = this.createAutoColDef(s, e, t);
    i.colId = s;
    const r = new Wt(i, null, s, !0);
    return this.createBean(r), r;
  }
  /**
   * Refreshes an auto group col to load changes from defaultColDef or autoGroupColDef
   */
  updateOneAutoCol(e, t, s) {
    const i = e.getColDef(), r = typeof i.showRowGroup == "string" ? i.showRowGroup : void 0, n = this.beans, o = r != null ? n.colModel.getColDefCol(r) : void 0, a = e.getId(), l = this.createAutoColDef(a, o ?? void 0, t);
    e.setColDef(l, null, s), je(n, { state: [{ colId: a, ...l }] }, s);
  }
  createAutoColDef(e, t, s) {
    let i = this.createBaseColDef(t);
    const r = this.gos.get("autoGroupColumnDef");
    Fe(i, r), i = Ti(this.beans, i, e, !0), this.gos.get("treeData") || ee(i.field) && ee(i.valueGetter) && ee(i.filterValueGetter) && i.filter !== "agGroupColumnFilter" && (i.filter = !1), s && s > 0 && (i.headerCheckboxSelection = !1);
    const n = Gt(this.gos), o = i.valueGetter || i.field != null;
    return n && !o && (i.sortIndex = void 0, i.initialSort = void 0), i;
  }
  createBaseColDef(e) {
    const t = this.gos.get("autoGroupColumnDef"), i = {
      headerName: this.getLocaleTextFunc()("group", "Group"),
      showRowGroup: (e == null ? void 0 : e.getColId()) ?? !0
    };
    return t && (t.cellRenderer || t.cellRendererSelector) || (i.cellRenderer = "agGroupCellRenderer"), e && (i.headerName = this.beans.colNames.getDisplayNameForColumn(e, "header") ?? void 0, i.headerValueGetter = e.colDef.headerValueGetter), i;
  }
  destroy() {
    var e;
    Ht(this.beans, (e = this.columns) == null ? void 0 : e.tree), super.destroy();
  }
}, ZC = class extends R {
  addExpandedCss(e, t) {
    t.isExpandable() && (e.push("ag-row-group"), e.push(t.expanded ? "ag-row-group-expanded" : "ag-row-group-contracted"));
  }
  getRowExpandedListeners(e) {
    const { rowNode: t } = e, s = this.updateExpandedCss.bind(this, e, t);
    return {
      expandedChanged: s,
      hasChildrenChanged: s
    };
  }
  setExpanded(e, t, s, i) {
    if (e.expanded === t)
      return;
    e.expanded = t, e.dispatchRowEvent("expandedChanged");
    const r = { ...Yp(e, this.gos, "rowGroupOpened"), expanded: t, event: s || null };
    this.dispatchExpandedEvent(r, i);
  }
  isExpandable(e) {
    return e.footer ? !1 : this.beans.colModel.isPivotMode() ? e.hasChildren() && !e.leafGroup : e.hasChildren() || e.master;
  }
  updateExpandedCss(e, t) {
    const s = t.isExpandable(), i = t.expanded == !0;
    e.forEachGui(void 0, (r) => {
      const n = r.rowComp;
      n.toggleCss("ag-row-group", s), n.toggleCss("ag-row-group-expanded", s && i), n.toggleCss("ag-row-group-contracted", s && !i), qe(r.element, s && i);
    });
  }
  dispatchStateUpdatedEvent() {
    this.eventSvc.dispatchEvent({ type: "rowExpansionStateChanged" });
  }
}, RH = class extends ZC {
  constructor() {
    super(...arguments), this.beanName = "expansionSvc", this.events = [];
  }
  wireBeans(e) {
    this.rowModel = e.rowModel;
  }
  setExpansionState(e) {
    const t = new Set(e.expandedRowGroupIds);
    this.rowModel.forEachNode((s) => {
      const i = s.id;
      i && (s.expanded = t.has(i));
    }), this.onGroupExpandedOrCollapsed();
  }
  getExpansionState() {
    const e = [];
    return this.rowModel.forEachNode((t) => {
      const s = t.id;
      s && t.expanded && e.push(s);
    }), { expandedRowGroupIds: e };
  }
  expandAll(e) {
    const { gos: t, colModel: s, eventSvc: i } = this.beans, r = this.rowModel, n = t.get("treeData"), o = s.isPivotActive(), a = (c) => {
      c && c.forEach((d) => {
        const h = () => {
          d.expanded = e, a(d.childrenAfterGroup);
        };
        if (n) {
          A(d.childrenAfterGroup) && h();
          return;
        }
        if (o) {
          !d.leafGroup && h();
          return;
        }
        d.group && h();
      });
    }, l = r.rootNode;
    l && a(l.childrenAfterGroup), this.onGroupExpandedOrCollapsed(), i.dispatchEvent({
      type: "expandOrCollapseAll",
      source: e ? "expandAll" : "collapseAll"
    });
  }
  onGroupExpandedOrCollapsed() {
    this.dispatchStateUpdatedEvent(), this.rowModel.refreshModel({ step: "map" });
  }
  // because the user can call rowNode.setExpanded() many times in one VM turn,
  // we throttle the calls to ClientSideRowModel using animationFrameSvc. this means for 100
  // row nodes getting expanded, we only update the CSRM once, and then we fire all events after
  // CSRM has updated.
  //
  // if we did not do this, then the user could call setExpanded on 100+ rows, causing the grid
  // to re-render 100+ times, which would be a performance lag.
  //
  // we use animationFrameService
  // rather than debounce() so this will get done if anyone flushes the animationFrameService
  // (eg user calls api.ensureRowVisible(), which in turn flushes ).
  dispatchExpandedEvent(e, t) {
    this.events.push(e);
    const s = () => {
      this.events.forEach((r) => this.eventSvc.dispatchEvent(r));
      const i = this.events.map((r) => r.node);
      this.beans.rowRenderer.refreshCells({ rowNodes: i }), this.events = [], this.dispatchStateUpdatedEvent();
    };
    t ? s() : (this.dispatchExpandedDebounced == null && (this.dispatchExpandedDebounced = this.debounce(s)), this.dispatchExpandedDebounced());
  }
  // the advantage over normal debounce is the client can call flushAllFrames()
  // to make sure all rendering is complete. we don't wait any milliseconds,
  // as this is intended to batch calls in one VM turn.
  debounce(e) {
    const t = this.beans.animationFrameSvc;
    if (!t)
      return () => window.setTimeout(e, 0);
    let s = !1;
    return () => {
      if (!t.active) {
        window.setTimeout(e, 0);
        return;
      }
      s || (s = !0, t.addDestroyTask(() => {
        s = !1, e();
      }));
    };
  }
};
function QC(e) {
  let t = e.get("groupHideParentOfSingleChild");
  return t || (t = e.get("groupRemoveSingleChildren"), !t && e.get("groupRemoveLowestSingleChildren") && (t = "leafGroupsOnly")), {
    groupHideParentOfSingleChild: t,
    isGroupMultiAutoColumn: _c(e),
    hideOpenParents: e.get("groupHideOpenParents"),
    grandTotalRow: wr(e),
    groupTotalRow: ur(e)
  };
}
function JC(e, t, s) {
  return e.groupHideParentOfSingleChild === !0 && s && t.childrenAfterGroup.length === 1;
}
function ev(e, t, s) {
  return e.groupHideParentOfSingleChild === "leafGroupsOnly" && s && t.leafGroup && t.childrenAfterGroup.length === 1;
}
function tv(e, t, s, i, r, n) {
  const o = i && !s, a = i && t.leafGroup, l = e.hideOpenParents && t.expanded && !t.master && !a;
  return !o && !l && !r && !n;
}
var PH = class extends R {
  constructor() {
    super(...arguments), this.beanName = "flattenStage", this.refreshProps = /* @__PURE__ */ new Set([
      "groupHideParentOfSingleChild",
      "groupRemoveSingleChildren",
      "groupRemoveLowestSingleChildren",
      "groupTotalRow",
      "masterDetail"
    ]), this.step = "map";
  }
  execute(e) {
    var d;
    const t = e.rowNode, s = [], i = this.beans.colModel.isPivotMode(), r = i && t.leafGroup && t.aggData, n = r ? [t] : t.childrenAfterSort, o = QC(this.gos);
    this.recursivelyAddToRowsToDisplay(o, n, s, i, 0);
    const a = s.length > 0, l = o.grandTotalRow;
    if (!r && // don't show total footer when showRootNode is true (i.e. in pivot mode and no groups)
    a && l)
      if (Fs(t, this.beans), l === "pinnedBottom" || l === "pinnedTop")
        (d = this.beans.pinnedRowModel) == null || d.setGrandTotalPinned(l === "pinnedBottom" ? "bottom" : "top");
      else {
        const h = l === "top";
        this.addRowNodeToRowsToDisplay(o, t.sibling, s, 0, h);
      }
    return s;
  }
  recursivelyAddToRowsToDisplay(e, t, s, i, r) {
    if (!(t != null && t.length))
      return;
    const n = this.beans.masterDetailSvc;
    for (let o = 0; o < t.length; o++) {
      const a = t[o], l = a.hasChildren(), c = JC(e, a, l), d = ev(e, a, l);
      if (tv(
        e,
        a,
        l,
        i,
        c,
        d
      ) && this.addRowNodeToRowsToDisplay(e, a, s, r), !(i && a.leafGroup))
        if (l) {
          const u = c || d;
          if (a.expanded || u) {
            const g = e.groupTotalRow({ node: a });
            g || Kd(a);
            const p = u ? r : r + 1;
            g === "top" && (Fs(a, this.beans), this.addRowNodeToRowsToDisplay(e, a.sibling, s, p));
            const f = n == null ? void 0 : n.getDetail(a);
            f && this.addRowNodeToRowsToDisplay(e, f, s, r), this.recursivelyAddToRowsToDisplay(
              e,
              a.childrenAfterSort,
              s,
              i,
              p
            ), g === "bottom" && (Fs(a, this.beans), this.addRowNodeToRowsToDisplay(e, a.sibling, s, p));
          }
        } else {
          const u = n == null ? void 0 : n.getDetail(a);
          u && this.addRowNodeToRowsToDisplay(e, u, s, r);
        }
    }
  }
  // duplicated method, it's also in floatingRowModel
  addRowNodeToRowsToDisplay(e, t, s, i, r) {
    r ? s.unshift(t) : s.push(t), t.setUiLevel(e.isGroupMultiAutoColumn ? 0 : i);
  }
}, EH = class extends R {
  constructor() {
    super(...arguments), this.beanName = "groupStage", this.refreshProps = /* @__PURE__ */ new Set([
      "groupDefaultExpanded",
      "groupAllowUnbalanced",
      "initialGroupOrderComparator",
      "groupHideOpenParents",
      "groupDisplayType",
      "treeData",
      "treeDataChildrenField",
      "treeDataParentIdField"
    ]), this.step = "group", this.approach = null, this.strategyBeanName = null, this.strategy = void 0;
  }
  /** Gets a filler row by id */
  getNode(e) {
    var t;
    return (t = this.strategy) == null ? void 0 : t.getNode(e);
  }
  destroy() {
    super.destroy(), this.strategy = void 0;
  }
  execute(e) {
    const t = jc(this.gos), s = this.approach !== t, i = s ? this.changeApproach(e, t) : this.strategy;
    if (i)
      return i.execute(e, t) || s;
  }
  getStrategyBeanName(e) {
    switch (e) {
      case "group":
        return "groupStrategy";
      case "treePath":
      case "treeNested":
      case "treeSelfRef":
        return "treeGroupStrategy";
      default:
        return null;
    }
  }
  changeApproach({ rowNode: e }, t) {
    var n;
    this.approach = t;
    const s = this.getStrategyBeanName(t), i = this.strategy;
    let r = i;
    return this.strategyBeanName !== s ? (this.destroyBean(r), r = void 0, s && (r = this.beans.registry.createDynamicBean(s, !1), this.createOptionalManagedBean(r)), this.strategy = r, this.strategyBeanName = s) : (n = r == null ? void 0 : r.reset) == null || n.call(r), i && TH(e, t !== "treeNested"), r;
  }
}, TH = (e, t) => {
  const s = e.allLeafChildren, i = e.sibling;
  e.treeNodeFlags = 0, e.childrenAfterGroup = s, e.childrenMapped = null, e.groupData = null, i && (i.childrenAfterGroup = e.childrenAfterGroup, i.childrenAfterAggFilter = e.childrenAfterAggFilter, i.childrenAfterFilter = e.childrenAfterFilter, i.childrenAfterSort = e.childrenAfterSort, i.childrenMapped = null);
  for (const r of s) {
    const n = r.sibling;
    Uu(r), n && Uu(n), r.parent = e, t && (r.treeParent = null), (r.group || r.hasChildren()) && (r.group = !1, r.updateHasChildren());
  }
  e.updateHasChildren();
}, Uu = (e) => {
  e.key = null, e.treeNodeFlags = 0, e.allChildrenCount = null, e.allLeafChildren = null, e.childrenAfterGroup = null, e.childrenAfterAggFilter = null, e.childrenAfterFilter = null, e.childrenAfterSort = null, e.childrenMapped = null, e.level = 0, e.groupData && (e.groupData = null);
};
function $u(e, t, s) {
  var o;
  let i = e;
  const r = i.level - t.level;
  if (r <= 0 || !s.get("groupHideOpenParents"))
    return !1;
  for (let a = 0; a < r; a++) {
    if (!(((o = i.parent) == null ? void 0 : o.getFirstChild()) === i))
      return !1;
    i = i.parent;
  }
  return i === t;
}
var Yd = (e, t, s, i = t.group) => {
  const r = e.gos, n = i && r.get("isGroupOpenByDefault");
  if (!n) {
    const a = r.get("groupDefaultExpanded");
    return a === -1 || s < a;
  }
  const o = {
    api: e.gridApi,
    context: e.gridOptions.context,
    rowNode: t,
    field: t.field,
    key: t.key,
    level: s,
    rowGroupColumn: t.rowGroupColumn
  };
  return n(o) == !0;
}, sv = class extends R {
  constructor() {
    super(...arguments), this.indentClass = null;
  }
  init(e, t, s, i, r, n, o) {
    var d;
    this.params = o, this.eGui = t, this.eCheckbox = s, this.eExpanded = i, this.eContracted = r, this.comp = e, this.compClass = n;
    const { node: a, column: l } = o;
    if (this.node = a, this.displayedNode = a, !this.isEmbeddedRowMismatch()) {
      if (a.footer) {
        this.initFooterCell();
        return;
      }
      if (!l) {
        this.initFullWidthCell();
        return;
      }
      this.displayedNode = ((d = this.beans.showRowGroupColValueSvc) == null ? void 0 : d.getDisplayedNode(a, l)) ?? this.node, this.setupExpand(), this.setupCheckbox(), this.addGroupValue(), this.setupIndent();
    }
  }
  initFooterCell() {
    const { node: e } = this.params;
    this.addGroupValue(), this.setupIndent(), e.level === -1 || this.comp.toggleCss("ag-row-group-leaf-indent", !0);
  }
  initFullWidthCell() {
    const e = () => {
      const { rowDragSvc: t } = this.beans;
      if (!this.params.rowDrag || !t)
        return;
      const s = t.createRowDragComp(() => this.params.value, this.params.node);
      this.createManagedBean(s), this.eGui.insertAdjacentElement("afterbegin", s.getGui());
    };
    this.setupExpand(), e(), this.setupCheckbox(), this.addGroupValue(), this.setupIndent();
  }
  /**
   * Returns an aria "role" to place on full width group cells, or the parent wrapper.
   * @returns the aria role to place on the parent wrapper
   */
  getCellAriaRole() {
    var s, i;
    const e = (s = this.params.colDef) == null ? void 0 : s.cellAriaRole, t = (i = this.params.column) == null ? void 0 : i.getColDef().cellAriaRole;
    return e || t || "gridcell";
  }
  /**
   * Determines if this cell should be rendered, as when using embeddedFullWidthRows
   * only one group cell should be rendered.
   *
   * if [enableRTL] all but pinned right cells should be skipped if available
   * otherwise prioritise pinned left cell if available
   * otherwise center viewport.
   *
   * @returns whether the cell should be skipped due to embedded full width rows
   */
  isEmbeddedRowMismatch() {
    if (!this.params.fullWidth || !this.gos.get("embedFullWidthRows"))
      return !1;
    const { visibleCols: e } = this.beans, t = this.params.pinned === "left", s = this.params.pinned === "right", i = !t && !s;
    return this.gos.get("enableRtl") ? e.isPinningLeft() ? !s : !i : e.isPinningLeft() ? !t : !i;
  }
  /**
   * Displays the group value for the displayed node
   */
  addGroupValue() {
    const {
      params: { value: e, valueFormatted: t }
    } = this, s = this.getInnerCompDetails();
    this.comp.setInnerRenderer(s, t ?? e ?? null);
  }
  /**
   * Sets up expand/collapse:
   * Chevron
   * Aria-expanded
   * Child count
   */
  setupExpand() {
    const { colModel: e } = this.beans, { eGridCell: t, column: s, suppressDoubleClickExpand: i } = this.params, r = (c, d) => {
      const h = N(c, this.beans, null);
      h && (d.appendChild(h), this.addDestroyFunc(() => d.removeChild(h)));
    };
    r("groupExpanded", this.eExpanded), r("groupContracted", this.eContracted);
    const n = this.comp, o = () => {
      if (!this.isExpandable())
        return;
      const d = this.displayedNode.expanded;
      n.setExpandedDisplayed(d), n.setContractedDisplayed(!d), qe(t, !!this.displayedNode.expanded);
    }, a = () => {
      const c = this.isExpandable();
      n.toggleCss("ag-cell-expandable", c), n.toggleCss("ag-row-group", c);
      const d = !c && e.isPivotMode();
      n.toggleCss("ag-pivot-leaf-group", d);
      const h = !e.isPivotMode() && (!this.displayedNode.footer || this.displayedNode.level !== -1);
      n.toggleCss("ag-row-group-leaf-indent", !c && h);
      const u = this.getChildCount(), g = u > 0 ? `(${u})` : "";
      n.setChildCount(g), c ? o() : (n.setExpandedDisplayed(!1), n.setContractedDisplayed(!1), Dg(t));
    };
    (() => {
      !((s == null ? void 0 : s.isCellEditable(this.displayedNode)) && this.gos.get("enableGroupEdit")) && !i && this.addManagedListeners(t, { dblclick: this.onCellDblClicked.bind(this) }), this.addManagedListeners(this.eExpanded, { click: this.onExpandClicked.bind(this) }), this.addManagedListeners(this.eContracted, { click: this.onExpandClicked.bind(this) }), this.addManagedListeners(t, { keydown: this.onKeyDown.bind(this) }), this.addManagedListeners(this.displayedNode, {
        // Expandable state has changed
        allChildrenCountChanged: a,
        masterChanged: a,
        groupChanged: a,
        hasChildrenChanged: a,
        // Node expanded changed
        expandedChanged: o
      });
    })(), a();
  }
  /**
   * Return the inner renderer details for the cell
   *
   * Prioritises:
   * 1. Group row renderer for group rows
   * 2. agFindCellRenderer for find results in group rows
   * 3. Provided innerRenderer (i.e, cellRendererParams.innerRenderer)
   * 4. Cell renderer of the grouped column
   * 5. Inner renderer of the grouped column
   * 6. agFindCellRenderer for find results
   */
  getInnerCompDetails() {
    var l, c;
    const { userCompFactory: e, findSvc: t } = this.beans, s = this.params;
    if (s.fullWidth) {
      const d = this.gos.get("groupRowRendererParams"), h = kn(
        e,
        d,
        s
      );
      return h || (t != null && t.isMatch(s.node, null) ? kn(
        e,
        { ...d, innerRenderer: "agFindCellRenderer" },
        s
      ) : void 0);
    }
    const i = (d) => d && d.componentClass == this.compClass, r = kn(e, s, s);
    if (r && !i(r))
      return r;
    const {
      displayedNode: { rowGroupColumn: n }
    } = this, o = n == null ? void 0 : n.colDef, a = n && ((l = s.column) == null ? void 0 : l.isRowGroupDisplayed(n.getId()));
    if (o && a) {
      const d = fr(e, o, s);
      if (d)
        if (i(d)) {
          if ((c = o == null ? void 0 : o.cellRendererParams) != null && c.innerRenderer)
            return kn(
              e,
              o.cellRendererParams,
              s
            );
        } else
          return d;
    }
    if (t != null && t.isMatch(s.node, s.column))
      return fr(
        e,
        { ...o ?? s.colDef, cellRenderer: "agFindCellRenderer" },
        s
      );
  }
  /**
   * Get the allChildCount of a given node
   * @param node the node to return the count for
   * @returns 0 if the count should not be displayed, otherwise the count
   */
  getChildCount() {
    const { column: e, suppressCount: t } = this.params;
    if (t)
      return 0;
    const { allChildrenCount: s, rowGroupColumn: i } = this.displayedNode;
    return !((s ?? 0) > 0 && (!i || !e || (e == null ? void 0 : e.isRowGroupDisplayed(i.getId())))) || this.gos.get("showOpenedGroup") && this.displayedNode !== this.node && !$u(this.node, this.displayedNode, this.gos) ? 0 : s ?? 0;
  }
  /**
   * Checks whether the current cell is expandable, either due to [groupHideOpenParent] control or otherwise.
   * @returns whether this cell is expandable
   */
  isExpandable() {
    const { node: e, column: t, colDef: s } = this.params;
    if (!this.displayedNode.isExpandable() || e.rowPinned)
      return !1;
    if (!t)
      return !0;
    if (e.hasChildren() && s) {
      const { showRowGroup: n } = s;
      if (!n)
        return !1;
      if (n === !0)
        return !0;
    }
    return e === this.displayedNode ? e.rowGroupColumn && (t == null ? void 0 : t.isRowGroupDisplayed(e.rowGroupColumn.getId())) ? !0 : e.master ? (s == null ? void 0 : s.showRowGroup) === !0 || (s == null ? void 0 : s.showRowGroup) == null : !1 : $u(this.node, this.displayedNode, this.gos);
  }
  /**
   * For full width group cells & single group column, indents child groups based on uiLevel
   */
  setupIndent() {
    const { suppressPadding: e, node: t, colDef: s } = this.params;
    if (e)
      return;
    const i = () => {
      let r = 0;
      s && s.showRowGroup !== !0 ? r = 0 : r = t.uiLevel;
      const n = "ag-row-group-indent-" + r;
      n !== this.indentClass && (this.indentClass && this.comp.toggleCss(this.indentClass, !1), this.indentClass = n, this.comp.toggleCss(n, !0), this.eGui.style.setProperty("--ag-indentation-level", String(r)));
    };
    this.addManagedListeners(t, { uiLevelChanged: i.bind(this) }), i();
  }
  /**
   * Selection checkboxes
   */
  setupCheckbox() {
    const { node: e } = this.params;
    !e.footer && !e.rowPinned && !e.detail && (this.addManagedPropertyListener("rowSelection", ({ currentValue: s, previousValue: i }) => {
      const r = typeof s == "object" ? s : void 0, n = typeof i == "object" ? i : void 0;
      (r == null ? void 0 : r.checkboxLocation) !== (n == null ? void 0 : n.checkboxLocation) && (this.destroyCheckbox(), this.addCheckbox());
    }), this.addCheckbox());
  }
  addCheckbox() {
    const { selectionSvc: e } = this.beans;
    if (!e || !wt(this.gos))
      return;
    const { node: t, column: s } = this.params, i = this.gos.get("rowSelection"), r = rn(i);
    if (r === "selectionColumn")
      return;
    if (r === "autoGroupColumn") {
      const c = (s == null ? void 0 : s.getColDef().showRowGroup) != null, d = !s && t.group;
      if (!(c || d))
        return;
    }
    const n = typeof i == "object" ? vi(i) : this.params.checkbox;
    if (!(typeof n == "function" || n === !0))
      return;
    if (typeof (s == null ? void 0 : s.getColDef().showRowGroup) == "string" && !this.isExpandable()) {
      this.comp.setCheckboxSpacing(!0);
      return;
    }
    const l = e.createCheckboxSelectionComponent();
    this.cbComp = l, this.createBean(l), l.init({
      rowNode: t,
      // when groupHideOpenParents = true and group expanded, we want the checkbox to refer to leaf node state (not group node state)
      column: s,
      overrides: {
        isVisible: n,
        callbackParams: this.params,
        removeHidden: !0
      }
    }), this.eCheckbox.appendChild(l.getGui()), this.comp.setCheckboxVisible(!0);
  }
  destroyCheckbox() {
    this.comp.setCheckboxSpacing(!1), this.comp.setCheckboxVisible(!1), this.cbComp && this.eCheckbox.removeChild(this.cbComp.getGui()), this.cbComp = this.destroyBean(this.cbComp);
  }
  /**
   * Called when the expand / contract icon is clicked.
   */
  onExpandClicked(e) {
    St(e) || (he(e), this.onExpandOrContract(e));
  }
  /**
   * Called on cell key press - only handles 'Enter' key for expand/collapse
   */
  onKeyDown(e) {
    !(e.key === S.ENTER) || this.params.suppressEnterExpand || this.params.column && this.params.column.isCellEditable(this.params.node) || this.onExpandOrContract(e);
  }
  /**
   * Called on cell double click - only expands/collapses if the event is not on the expand / contract icon
   */
  onCellDblClicked(e) {
    if (St(e))
      return;
    Vl(this.eExpanded, e) || Vl(this.eContracted, e) || this.onExpandOrContract(e);
  }
  /**
   * Called when expand or contract is attempted, to scroll the row and update the node state
   * @param e originating event
   */
  onExpandOrContract(e) {
    if (!this.isExpandable())
      return;
    const t = this.displayedNode, s = !t.expanded;
    !s && t.sticky && this.beans.ctrlsSvc.getScrollFeature().setVerticalScrollPosition(t.rowTop - t.stickyRowTop), t.setExpanded(s, e);
  }
  destroy() {
    super.destroy(), this.destroyCheckbox();
  }
}, MH = {
  tag: "span",
  cls: "ag-cell-wrapper",
  children: [
    { tag: "span", ref: "eExpanded", cls: "ag-group-expanded ag-hidden" },
    { tag: "span", ref: "eContracted", cls: "ag-group-contracted ag-hidden" },
    { tag: "span", ref: "eCheckbox", cls: "ag-group-checkbox ag-invisible" },
    { tag: "span", ref: "eValue", cls: "ag-group-value" },
    { tag: "span", ref: "eChildCount", cls: "ag-group-child-count" }
  ]
}, Ku = class extends D {
  constructor() {
    super(MH), this.eExpanded = x, this.eContracted = x, this.eCheckbox = x, this.eValue = x, this.eChildCount = x;
  }
  init(e) {
    const t = {
      setInnerRenderer: (n, o) => this.setRenderDetails(n, o),
      setChildCount: (n) => this.eChildCount.textContent = n,
      toggleCss: (n, o) => this.toggleCss(n, o),
      setContractedDisplayed: (n) => O(this.eContracted, n),
      setExpandedDisplayed: (n) => O(this.eExpanded, n),
      setCheckboxVisible: (n) => this.eCheckbox.classList.toggle("ag-invisible", !n),
      setCheckboxSpacing: (n) => this.eCheckbox.classList.toggle("ag-group-checkbox-spacing", n)
    }, s = this.createManagedBean(new sv()), i = !e.colDef, r = this.getGui();
    s.init(t, r, this.eCheckbox, this.eExpanded, this.eContracted, this.constructor, e), i && Ye(r, s.getCellAriaRole());
  }
  setRenderDetails(e, t) {
    e ? e.newAgStackInstance().then((s) => {
      if (!s)
        return;
      const i = () => this.destroyBean(s);
      this.isAlive() ? (this.eValue.appendChild(s.getGui()), this.addDestroyFunc(i)) : i();
    }) : this.eValue.innerText = t;
  }
  destroy() {
    this.destroyBean(this.innerCellRenderer), super.destroy();
  }
  refresh() {
    return !1;
  }
}, DH = (
  /*css*/
  ".ag-group-checkbox-spacing{width:var(--ag-icon-size)}:where(.ag-ltr) .ag-group-checkbox-spacing{margin-right:var(--ag-cell-widget-spacing)}:where(.ag-rtl) .ag-group-checkbox-spacing{margin-left:var(--ag-cell-widget-spacing)}"
), AH = class extends R {
  constructor() {
    super(...arguments), this.beanName = "showRowGroupColValueSvc";
  }
  /**
   * Get the value for format in the group column, also returns the displayedNode from which the value was
   * taken in cases of groupHideOpenParents and showOpenedGroup.
   */
  getGroupValue(e, t) {
    var n;
    if (!t)
      return e.group ? { displayedNode: e, value: e.groupValue } : null;
    const s = this.beans.valueSvc, i = t.colDef.showRowGroup;
    if (!i)
      return null;
    if (e.level === -1 && e.footer)
      return { displayedNode: e, value: null };
    if (typeof i == "string") {
      if ((((n = this.beans.rowGroupColsSvc) == null ? void 0 : n.getColumnIndex(i)) ?? -1) > e.level)
        return null;
      const a = this.getDisplayedNode(e, t, !0);
      if (a)
        return {
          displayedNode: a,
          value: s.getValue(t, a)
        };
    }
    const r = s.getValue(t, e);
    if (r == null) {
      const o = this.getDisplayedNode(e, t);
      if (o)
        return {
          displayedNode: o,
          value: s.getValue(t, o)
        };
    }
    return {
      displayedNode: e,
      value: r
    };
  }
  /**
   * Formats a group col value, and prefixes it with the "Total" prefix if applicable
   */
  formatAndPrefixGroupColValue(e, t, s = !1) {
    const i = this.formatGroupColValue(e, t, s), { value: r, displayedNode: n } = e, o = this.beans.footerSvc;
    return o != null && o.doesCellShowTotalPrefix(n, t) ? o.applyTotalPrefix(r, i, n, t) : n.footer && n.level === -1 ? null : i;
  }
  /**
   * Formats the group col value using the underlying column's value formatter
   */
  formatGroupColValue(e, t, s = !1) {
    const i = this.beans.valueSvc, { displayedNode: r, value: n } = e, o = r.rowGroupColumn, a = r.group && !t;
    if (o && (a || (t == null ? void 0 : t.isRowGroupDisplayed(o.colId)))) {
      if (s && o.colDef.useValueFormatterForExport === !1)
        return null;
      const c = i.formatValue(o, r, n);
      return c == null && r.key === "" ? this.getLocaleTextFunc()("blanks", "(Blanks)") : c;
    }
    return !t || r.group || s && t.colDef.useValueFormatterForExport === !1 ? null : i.formatValue(t, r, n);
  }
  /**
   * Checks if the node has a value to inherit from the parent node for display in the given column
   *
   * This is used when [groupHideOpenParents] or [showOpenedGroup] are enabled
   *
   * @param node node to check for preferential nodes to display
   * @param column column to get the displayed node for
   * @returns a parent node of node to display the value from, or undefined if no value will be inherited
   */
  getDisplayedNode(e, t, s = !1) {
    var l, c;
    const i = this.gos, r = i.get("groupHideOpenParents"), n = i.get("showOpenedGroup") && !s;
    if (!r && !n)
      return;
    const o = t.colDef.showRowGroup;
    if (o === !0)
      return e.group ? void 0 : e.parent ?? void 0;
    let a = e;
    for (; a && ((l = a.rowGroupColumn) == null ? void 0 : l.getId()) != o; ) {
      const d = a === ((c = a.parent) == null ? void 0 : c.getFirstChild());
      if (!n && !d)
        return;
      a = a.parent;
    }
    if (a !== e)
      return a ?? void 0;
  }
}, IH = class extends R {
  constructor() {
    super(...arguments), this.beanName = "showRowGroupCols";
  }
  refresh() {
    this.showRowGroupCols = [], this.showRowGroupColsMap = {};
    const { colModel: e, rowGroupColsSvc: t } = this.beans;
    e.getCols().forEach((s) => {
      const r = s.getColDef().showRowGroup, n = typeof r == "string";
      !n && !(r === !0) || (this.showRowGroupCols.push(s), n ? this.showRowGroupColsMap[r] = s : t && t.columns.forEach((a) => {
        this.showRowGroupColsMap[a.getId()] = s;
      }));
    });
  }
  getShowRowGroupCols() {
    return this.showRowGroupCols;
  }
  getShowRowGroupCol(e) {
    return this.showRowGroupColsMap[e];
  }
  getSourceColumnsForGroupColumn(e) {
    const t = e.getColDef().showRowGroup;
    if (!t)
      return null;
    const { rowGroupColsSvc: s, colModel: i } = this.beans;
    if (t === !0 && s)
      return s.columns.slice(0);
    const r = i.getColDefCol(t);
    return r ? [r] : null;
  }
  isRowGroupDisplayed(e, t) {
    const { colDef: s } = e;
    if ((s == null ? void 0 : s.showRowGroup) == null)
      return !1;
    const i = s.showRowGroup === !0, r = s.showRowGroup === t;
    return i || r;
  }
}, LH = class extends R {
  constructor(e, t) {
    super(), this.createRowCon = e, this.destroyRowCtrls = t, this.stickyTopRowCtrls = [], this.stickyBottomRowCtrls = [], this.extraTopHeight = 0, this.extraBottomHeight = 0;
  }
  postConstruct() {
    this.isClientSide = te(this.gos), this.beans.ctrlsSvc.whenReady(this, (e) => {
      this.gridBodyCtrl = e.gridBodyCtrl;
    }), this.resetStickyContainers();
  }
  setOffsetTop(e) {
    this.extraTopHeight !== e && (this.extraTopHeight = e, this.eventSvc.dispatchEvent({
      type: "stickyTopOffsetChanged",
      offset: e
    }));
  }
  setOffsetBottom(e) {
    this.extraBottomHeight !== e && (this.extraBottomHeight = e);
  }
  resetOffsets() {
    this.setOffsetBottom(0), this.setOffsetTop(0);
  }
  /**
   * Get the last pixel of the group, this pixel is used to push the sticky node up out of the viewport.
   */
  getLastPixelOfGroup(e) {
    return this.isClientSide ? GH(e) : kH(e);
  }
  /**
   * Get the first pixel of the group, this pixel is used to push the sticky node down out of the viewport
   */
  getFirstPixelOfGroup(e) {
    return e.footer ? e.sibling.rowTop + e.sibling.rowHeight - 1 : e.hasChildren() ? e.rowTop - 1 : 0;
  }
  updateStickyRows(e) {
    const t = e === "top";
    let s = 0;
    if (!this.canRowsBeSticky())
      return this.refreshNodesAndContainerHeight(e, /* @__PURE__ */ new Set(), s);
    const { rowModel: i, rowRenderer: r, pinnedRowModel: n } = this.beans, o = t ? r.firstVisibleVPixel - this.extraTopHeight : r.lastVisibleVPixel - this.extraTopHeight, a = /* @__PURE__ */ new Set(), l = (u) => {
      if (a.add(u), t) {
        const g = this.getLastPixelOfGroup(u), p = o + s + u.rowHeight;
        g < p ? u.stickyRowTop = s + (g - p) : u.stickyRowTop = s;
      } else {
        const g = this.getFirstPixelOfGroup(u), p = o - (s + u.rowHeight);
        g > p ? u.stickyRowTop = s - (g - p) : u.stickyRowTop = s;
      }
      s = 0, a.forEach((g) => {
        const p = g.stickyRowTop + g.rowHeight;
        s < p && (s = p);
      });
    }, c = this.areFooterRowsStickySuppressed(), d = this.gos.get("suppressGroupRowsSticky"), h = (u) => {
      if (!u.displayed)
        return !1;
      if (u.footer) {
        if (c === !0 || c === "grand" && u.level === -1 || c === "group" && u.level > -1)
          return !1;
        const g = u.sibling.rowIndex ? u.sibling.rowIndex + 1 === u.rowIndex : !1;
        return e === "bottom" && g || u.level === -1 && (n != null && n.getGrandTotalPinned()) ? !1 : !a.has(u);
      }
      return u.isExpandable() ? d === !0 || e === "bottom" ? !1 : !a.has(u) && u.expanded : !1;
    };
    for (let u = 0; u < 100; u++) {
      let g = o + s;
      t || (g = o - s);
      const p = i.getRowIndexAtPixel(g), f = i.getRow(p);
      if (f == null)
        break;
      const C = this.getStickyAncestors(f).find(
        (w) => (t ? w.rowIndex < p : w.rowIndex > p) && h(w)
      );
      if (C) {
        l(C);
        continue;
      }
      if ((t ? f.rowTop < g : f.rowTop + f.rowHeight > g) && h(f)) {
        l(f);
        continue;
      }
      break;
    }
    return t || a.forEach((u) => {
      u.stickyRowTop = s - (u.stickyRowTop + u.rowHeight);
    }), this.refreshNodesAndContainerHeight(e, a, s);
  }
  areFooterRowsStickySuppressed() {
    const e = this.gos.get("suppressStickyTotalRow");
    if (e === !0)
      return !0;
    const t = e === "group", s = e === "grand";
    return t && s ? !0 : s ? "grand" : t ? "group" : !1;
  }
  canRowsBeSticky() {
    const e = aa(this.gos), t = this.areFooterRowsStickySuppressed(), s = this.gos.get("suppressGroupRowsSticky");
    return e && (!t || !s);
  }
  getStickyAncestors(e) {
    const t = [];
    let s = e.footer ? e.sibling : e.parent;
    for (; s; )
      s.sibling && t.push(s.sibling), t.push(s), s = s.parent;
    return t.reverse();
  }
  checkStickyRows() {
    const e = this.updateStickyRows("top"), t = this.updateStickyRows("bottom");
    return e || t;
  }
  destroyStickyCtrls() {
    this.resetStickyContainers();
  }
  resetStickyContainers() {
    this.refreshNodesAndContainerHeight("top", /* @__PURE__ */ new Set(), 0), this.refreshNodesAndContainerHeight("bottom", /* @__PURE__ */ new Set(), 0);
  }
  refreshStickyNode(e) {
    const t = /* @__PURE__ */ new Set();
    if (this.stickyTopRowCtrls.some((s) => s.rowNode === e)) {
      for (let s = 0; s < this.stickyTopRowCtrls.length; s++) {
        const i = this.stickyTopRowCtrls[s].rowNode;
        i !== e && t.add(i);
      }
      this.refreshNodesAndContainerHeight("top", t, this.topContainerHeight) && this.checkStickyRows();
      return;
    }
    for (let s = 0; s < this.stickyBottomRowCtrls.length; s++) {
      const i = this.stickyBottomRowCtrls[s].rowNode;
      i !== e && t.add(i);
    }
    this.refreshNodesAndContainerHeight("bottom", t, this.bottomContainerHeight) && this.checkStickyRows();
  }
  /**
   * Destroy old ctrls and create new ctrls where necessary.
   */
  refreshNodesAndContainerHeight(e, t, s) {
    const i = e === "top", r = i ? this.stickyTopRowCtrls : this.stickyBottomRowCtrls, n = {}, o = [];
    for (let g = 0; g < r.length; g++) {
      const p = r[g].rowNode;
      if (!t.has(p)) {
        n[p.id] = r[g], p.sticky = !1;
        continue;
      }
      o.push(r[g]);
    }
    const a = /* @__PURE__ */ new Set();
    for (let g = 0; g < o.length; g++)
      a.add(o[g].rowNode);
    const l = [];
    t.forEach((g) => {
      a.has(g) || (g.sticky = !0, l.push(this.createRowCon(g, !1, !1)));
    });
    let c = !!l.length || o.length !== r.length;
    i ? this.topContainerHeight !== s && (this.topContainerHeight = s, this.gridBodyCtrl.setStickyTopHeight(s), c = !0) : this.bottomContainerHeight !== s && (this.bottomContainerHeight = s, this.gridBodyCtrl.setStickyBottomHeight(s), c = !0), this.destroyRowCtrls(n, !1);
    const d = [...o, ...l];
    d.sort((g, p) => p.rowNode.rowIndex - g.rowNode.rowIndex), i || d.reverse(), d.forEach((g) => g.setRowTop(g.rowNode.stickyRowTop));
    const h = this.beans.pageBounds;
    let u = 0;
    return i ? (t.forEach((g) => {
      g.rowIndex < h.getFirstRow() && (u += g.rowHeight);
    }), u > this.topContainerHeight && (u = this.topContainerHeight), this.setOffsetTop(u)) : (t.forEach((g) => {
      g.rowIndex > h.getLastRow() && (u += g.rowHeight);
    }), u > this.bottomContainerHeight && (u = this.bottomContainerHeight), this.setOffsetBottom(u)), c ? (i ? this.stickyTopRowCtrls = d : this.stickyBottomRowCtrls = d, !0) : !1;
  }
  ensureRowHeightsValid() {
    let e = !1;
    const t = (s) => {
      const i = s.rowNode;
      if (i.rowHeightEstimated) {
        const r = He(this.beans, i);
        i.setRowHeight(r.height), e = !0;
      }
    };
    return this.stickyTopRowCtrls.forEach(t), this.stickyBottomRowCtrls.forEach(t), e;
  }
};
function kH(e) {
  var t, s;
  if (e.isExpandable() || e.footer) {
    if (e.master && e.detailNode)
      return e.detailNode.rowTop + e.detailNode.rowHeight;
    if (!e.sibling || Math.abs(e.sibling.rowIndex - e.rowIndex) === 1) {
      let r = (t = e.childStore) == null ? void 0 : t.getStoreBounds();
      return e.footer && (r = (s = e.sibling.childStore) == null ? void 0 : s.getStoreBounds()), ((r == null ? void 0 : r.heightPx) ?? 0) + ((r == null ? void 0 : r.topPx) ?? 0);
    }
    return e.footer ? e.rowTop + e.rowHeight : e.sibling.rowTop + e.sibling.rowHeight;
  }
  return Number.MAX_SAFE_INTEGER;
}
function GH(e) {
  if (e.isExpandable() || e.footer) {
    if (e.footer && e.rowIndex === 0)
      return Number.MAX_SAFE_INTEGER;
    if (!e.sibling || Math.abs(e.sibling.rowIndex - e.rowIndex) === 1) {
      let i = e.footer ? e.sibling : e;
      for (; i.isExpandable() && i.expanded; )
        if (i.master && i.detailNode)
          i = i.detailNode;
        else if (i.childrenAfterSort) {
          if (i.childrenAfterSort.length === 0)
            break;
          i = _(i.childrenAfterSort);
        }
      return i.rowTop + i.rowHeight;
    }
    return e.footer ? e.rowTop + e.rowHeight : e.sibling.rowTop + e.sibling.rowHeight;
  }
  return Number.MAX_SAFE_INTEGER;
}
var OH = class extends R {
  constructor() {
    super(...arguments), this.beanName = "stickyRowSvc";
  }
  createStickyRowFeature(e, t, s) {
    const i = this.gos;
    if (aa(i) && te(i) || Le(i))
      return e.createManagedBean(new LH(t, s));
  }
}, iv = {
  moduleName: "GroupCellRenderer",
  version: Y,
  userComponents: {
    agGroupRowRenderer: Ku,
    agGroupCellRenderer: Ku
  },
  dynamicBeans: { groupCellRendererCtrl: sv },
  icons: {
    // shown on row group when contracted (click to expand)
    groupContracted: "tree-closed",
    // shown on row group when expanded (click to contract)
    groupExpanded: "tree-open"
  },
  css: [DH],
  dependsOn: [ie]
}, rv = {
  moduleName: "GroupColumn",
  version: Y,
  beans: [
    FH,
    IH,
    AH,
    xH,
    XC,
    YC
  ],
  dependsOn: [ie, iv]
}, ka = {
  moduleName: "ClientSideRowModelHierarchy",
  version: Y,
  rowModels: ["clientSide"],
  beans: [EH, PH, RH],
  dependsOn: [ie]
}, qd = {
  moduleName: "StickyRow",
  version: Y,
  beans: [OH]
}, VH = class extends D {
  constructor() {
    super();
  }
  postConstruct() {
    this.setGui(this.createNorthPanel());
    const e = this.onRowGroupChanged.bind(this);
    this.addManagedEventListeners({
      columnRowGroupChanged: e,
      newColumnsLoaded: e
    }), this.addManagedPropertyListener("rowGroupPanelShow", e), this.addManagedPropertyListener("pivotPanelShow", () => this.onPivotPanelShow()), this.onRowGroupChanged();
  }
  createNorthPanel() {
    const e = K({ tag: "div", cls: "ag-column-drop-wrapper", role: "presentation" }), t = new VC(!0);
    this.rowGroupComp = this.createManagedBean(t);
    const s = new OC(!0);
    this.pivotComp = this.createManagedBean(s), e.appendChild(t.getGui()), e.appendChild(s.getGui());
    const i = this.onDropPanelVisible.bind(this);
    return this.addManagedListeners(t, {
      displayChanged: i
    }), this.addManagedListeners(s, {
      displayChanged: i
    }), this.onDropPanelVisible(), e;
  }
  onDropPanelVisible() {
    const { rowGroupComp: e, pivotComp: t } = this, s = e.isDisplayed() && t.isDisplayed(), i = "ag-column-drop-horizontal-half-width";
    e.toggleCss(i, s), t.toggleCss(i, s);
  }
  onRowGroupChanged() {
    var s, i;
    const e = this.rowGroupComp;
    if (!e)
      return;
    const t = this.gos.get("rowGroupPanelShow");
    if (t === "always")
      e.setDisplayed(!0);
    else if (t === "onlyWhenGrouping") {
      const r = ((i = (s = this.beans.rowGroupColsSvc) == null ? void 0 : s.columns) == null ? void 0 : i.length) !== 0;
      e.setDisplayed(r);
    } else
      e.setDisplayed(!1);
  }
  onPivotPanelShow() {
    const e = this.pivotComp;
    if (!e)
      return;
    const t = this.gos.get("pivotPanelShow");
    if (t === "always")
      e.setDisplayed(!0);
    else if (t === "onlyWhenPivoting") {
      const s = this.beans.colModel.isPivotActive();
      e.setDisplayed(s);
    } else
      e.setDisplayed(!1);
  }
}, BH = {
  selector: "AG-GRID-HEADER-DROP-ZONES",
  component: VH
};
function NH(e) {
  return e.buttons && (e.buttons = []), e;
}
var HH = {
  tag: "div",
  cls: "ag-group-filter",
  children: [
    { tag: "div", ref: "eGroupField" },
    { tag: "div", ref: "eUnderlyingFilter" }
  ]
}, zH = class extends ls {
  constructor() {
    super(HH), this.filterType = "group", this.eGroupField = x, this.eUnderlyingFilter = x;
  }
  wireBeans(e) {
    this.groupFilterSvc = e.groupFilter;
  }
  postConstruct() {
    this.initialiseTabGuard({});
  }
  init(e) {
    return this.params = e, this.updateParams().then(() => {
      this.addHandlerListeners(this.updateGroups.bind(this));
    });
  }
  refresh(e) {
    const t = e;
    return this.params = t, t.source === "colDef" && this.updateParams(), !0;
  }
  updateParams() {
    return this.validateParams(), this.updateGroups();
  }
  validateParams() {
    const { colDef: e } = this.params;
    e.field && F(234), e.filterValueGetter && F(235), e.filterParams && F(236);
  }
  addHandlerListeners(e) {
    const t = this.addManagedListeners(this.getHandler(), {
      sourceColumnsChanged: () => {
        this.updateGroups();
      },
      destroyed: () => {
        t.forEach((s) => s()), this.addHandlerListeners(e);
      }
    });
  }
  updateGroups() {
    const { sourceColumns: e, selectedColumn: t } = this.updateGroupField();
    return this.dispatchLocalEvent({
      type: "columnsChanged"
    }), this.getUnderlyingFilters(e, t);
  }
  updateGroupField() {
    this.groupColumn = this.params.column;
    const e = this.getHandler();
    if (!e)
      return { sourceColumns: null };
    const { sourceColumns: t, hasMultipleColumns: s, selectedColumn: i } = e, r = this.eGroupField;
    return X(r), this.eGroupFieldSelect && this.destroyBean(this.eGroupFieldSelect), s && t && (this.createGroupFieldSelectElement(t, i), r.appendChild(this.eGroupFieldSelect.getGui()), r.appendChild(K({ tag: "div", cls: "ag-filter-separator" }))), O(r, s), { sourceColumns: t, selectedColumn: i };
  }
  createGroupFieldSelectElement(e, t) {
    const s = this.createManagedBean(new st());
    this.eGroupFieldSelect = s;
    const i = this.getLocaleTextFunc();
    s.setLabel(i("groupFilterSelect", "Select field:")), s.setLabelAlignment("top"), s.addOptions(
      e.map((r) => ({
        value: r.getColId(),
        text: this.beans.colNames.getDisplayNameForColumn(r, "groupFilter", !1) ?? void 0
      }))
    ), s.setValue(t.getColId()), s.onValueChange((r) => this.updateSelectedColumn(r)), s.addCss("ag-group-filter-field-select-wrapper"), e.length === 1 && s.setDisabled(!0);
  }
  getUnderlyingFilters(e, t) {
    if (!e)
      return this.filterColumnPairs = void 0, this.selectedFilter = void 0, U.resolve();
    const s = [], i = [], r = this.beans.colFilter;
    return e.forEach((n) => {
      const o = r.getOrCreateFilterUi(n);
      o && s.push(
        o.then((a) => {
          a && i.push({
            filter: a,
            column: n
          }), n.getColId() === t.getColId() && (this.selectedFilter = a ?? void 0);
        })
      );
    }), U.all(s).then(() => {
      this.filterColumnPairs = i;
    });
  }
  addUnderlyingFilterElement(e) {
    var s;
    if (X(this.eUnderlyingFilter), !e)
      return U.resolve();
    const t = this.createManagedBean(new bn(e, "COLUMN_MENU"));
    return this.filterComp = t, t.hasFilter() ? (this.eUnderlyingFilter.appendChild(t.getGui()), ((s = t.getFilter()) == null ? void 0 : s.then(() => {
      var i, r;
      (i = t.afterGuiAttached) == null || i.call(t, this.afterGuiAttachedParams), !((r = this.afterGuiAttachedParams) != null && r.suppressFocus) && this.eGroupFieldSelect && !this.eGroupFieldSelect.isDisabled() && this.eGroupFieldSelect.getFocusableElement().focus();
    })) ?? U.resolve()) : U.resolve();
  }
  updateSelectedColumn(e) {
    var i;
    if (!e)
      return;
    (i = this.filterComp) == null || i.afterGuiDetached(), this.destroyBean(this.filterComp);
    const t = this.getFilterColumnPair(e), s = t == null ? void 0 : t.column;
    this.selectedFilter = t == null ? void 0 : t.filter, this.getHandler().setSelectedColumn(s), this.dispatchLocalEvent({
      type: "columnsChanged"
    }), this.addUnderlyingFilterElement(s);
  }
  isFilterActive() {
    return this.groupFilterSvc.isFilterActive(this.groupColumn);
  }
  doesFilterPass() {
    return !0;
  }
  getModel() {
    return null;
  }
  setModel() {
  }
  afterGuiAttached(e) {
    this.afterGuiAttachedParams = e, this.addUnderlyingFilterElement(this.getHandler().selectedColumn);
  }
  afterGuiDetached() {
    var e, t;
    X(this.eUnderlyingFilter), (t = (e = this.selectedFilter) == null ? void 0 : e.afterGuiDetached) == null || t.call(e);
  }
  getSelectedColumn() {
    return this.getHandler().selectedColumn;
  }
  getHandler() {
    return this.params.getHandler();
  }
  getFilterColumnPair(e) {
    var t;
    if (e)
      return (t = this.filterColumnPairs) == null ? void 0 : t.find(({ column: s }) => s.getColId() === e);
  }
}, WH = class extends R {
  init(e) {
    this.params = e, this.validateModel(e), this.updateColumns(), this.addManagedEventListeners({
      columnRowGroupChanged: this.updateColumns.bind(this),
      filterDestroyed: (t) => this.onFilterDestroyed(t)
    });
  }
  refresh(e) {
    this.params = e, this.validateModel(e), e.source === "colDef" && this.updateColumns();
  }
  doesFilterPass() {
    return !0;
  }
  setSelectedColumn(e) {
    this.selectedColumn = e, this.dispatchLocalEvent({ type: "selectedColumnChanged" });
  }
  validateModel(e) {
    e.model != null && e.onModelChange(null);
  }
  getSourceColumns() {
    const e = this.params.column;
    if (this.gos.get("treeData"))
      return F(237), [];
    const t = this.beans.groupFilter.getSourceColumns(e);
    return t || (F(183), []);
  }
  updateColumns() {
    const e = this.getSourceColumns(), t = e.filter((r) => r.isFilterAllowed());
    this.sourceColumns = t;
    let s, i;
    t.length ? e.length === 1 ? (s = t[0], i = !1) : (s = this.selectedColumn, (!s || !t.some((r) => r.getId() === s.getId())) && (s = t[0]), i = !0) : (s = void 0, i = !1), this.selectedColumn = s, this.hasMultipleColumns = i, this.dispatchLocalEvent({ type: "sourceColumnsChanged" });
  }
  onFilterDestroyed({ column: e, source: t }) {
    var i;
    if (t === "gridDestroyed")
      return;
    const s = e.getColId();
    (i = this.sourceColumns) != null && i.some((r) => r.getColId() === s) && setTimeout(() => {
      this.isAlive() && this.updateColumns();
    });
  }
}, _H = class extends R {
  constructor() {
    super(...arguments), this.beanName = "groupFilter";
  }
  postConstruct() {
    this.addManagedEventListeners({
      columnRowGroupChanged: () => this.updateFilterFlags("columnRowGroupChanged")
    });
  }
  isGroupFilter(e) {
    return e.getColDef().filter === "agGroupColumnFilter";
  }
  isFilterAllowed(e) {
    var s;
    const t = this.beans.colFilter;
    return !!((s = this.getSourceColumns(e)) != null && s.some((i) => t == null ? void 0 : t.isFilterAllowed(i)));
  }
  isFilterActive(e) {
    var s;
    const t = this.beans.colFilter;
    return !!((s = this.getSourceColumns(e)) != null && s.some((i) => t == null ? void 0 : t.isFilterActive(i)));
  }
  getSourceColumns(e) {
    var t;
    return (t = this.beans.showRowGroupCols) == null ? void 0 : t.getSourceColumnsForGroupColumn(e);
  }
  updateFilterFlags(e, t) {
    var r;
    const { autoColSvc: s, colFilter: i } = this.beans;
    (r = s == null ? void 0 : s.getColumns()) == null || r.forEach((n) => {
      this.isGroupFilter(n) && (i == null || i.setColFilterActive(
        n,
        this.isFilterActive(n),
        e,
        t
      ));
    });
  }
}, UH = {
  tag: "div",
  ref: "eFloatingFilter",
  cls: "ag-group-floating-filter ag-floating-filter-input",
  role: "presentation"
}, $H = class extends D {
  constructor() {
    super(UH), this.eFloatingFilter = x, this.haveAddedColumnListeners = !1;
  }
  init(e) {
    this.params = e;
    const t = _c(this.gos), s = this.onColChange.bind(this), i = (r) => {
      t ? this.setupUnderlyingFloatingFilterElement().then(() => r()) : (this.setupReadOnlyFloatingFilterElement(), r());
    };
    return this.gos.get("enableFilterHandlers") ? new U((r) => i(r)).then(() => {
      this.addHandlerListeners(e, s);
    }) : new U((r) => {
      this.params.parentFilterInstance((n) => {
        this.parentFilterInstance = n, i(r);
      });
    }).then(() => {
      this.addManagedListeners(this.parentFilterInstance, {
        columnsChanged: s
      });
    });
  }
  refresh(e) {
    var t, s;
    if (this.params = e, this.setParams(), this.gos.get("enableFilterHandlers"))
      if (this.showingUnderlyingFloatingFilter) {
        const i = this.getSelectedColumn(), r = this.beans.colFilter.getFloatingFilterCompDetails(
          i,
          this.params.showParentFilter
        );
        (s = (t = this.underlyingFloatingFilter) == null ? void 0 : t.refresh) == null || s.call(t, r == null ? void 0 : r.params);
      } else
        this.updateDisplayedValue();
  }
  setParams() {
    var s;
    const e = this.beans.colNames.getDisplayNameForColumn(this.params.column, "header", !0), t = this.getLocaleTextFunc();
    (s = this.eFloatingFilterText) == null || s.setInputAriaLabel(`${e} ${t("ariaFilterInput", "Filter Input")}`);
  }
  addHandlerListeners(e, t) {
    const s = this.addManagedListeners(e.getHandler(), {
      selectedColumnChanged: t,
      sourceColumnsChanged: t,
      destroyed: () => {
        s.forEach((i) => i()), this.addHandlerListeners(this.params, t);
      }
    });
  }
  setupReadOnlyFloatingFilterElement() {
    this.eFloatingFilterText || (this.eFloatingFilterText = this.createManagedBean(new yt()), this.eFloatingFilterText.setDisabled(!0).addGuiEventListener("click", () => this.params.showParentFilter()), this.setParams()), this.updateDisplayedValue(), this.eFloatingFilter.appendChild(this.eFloatingFilterText.getGui());
  }
  setupUnderlyingFloatingFilterElement() {
    this.showingUnderlyingFloatingFilter = !1, this.underlyingFloatingFilter = void 0, X(this.eFloatingFilter);
    const e = this.getSelectedColumn();
    if (e && !e.isVisible()) {
      const t = this.beans.colFilter, s = t.getFloatingFilterCompDetails(e, this.params.showParentFilter);
      if (s)
        return this.haveAddedColumnListeners || (this.haveAddedColumnListeners = !0, this.addManagedListeners(e, {
          visibleChanged: this.onColumnVisibleChanged.bind(this),
          colDefChanged: this.onColDefChanged.bind(this)
        })), s.newAgStackInstance().then((i) => {
          var r;
          this.underlyingFloatingFilter = i, (r = this.underlyingFloatingFilter) == null || r.onParentModelChanged(t.getModelForColumn(e)), this.appendChild(i.getGui()), this.showingUnderlyingFloatingFilter = !0;
        });
    }
    return this.setupReadOnlyFloatingFilterElement(), U.resolve();
  }
  getSelectedColumn() {
    return this.gos.get("enableFilterHandlers") ? this.params.getHandler().selectedColumn : this.parentFilterInstance.getSelectedColumn();
  }
  onColumnVisibleChanged() {
    this.setupUnderlyingFloatingFilterElement();
  }
  onColDefChanged(e) {
    var s, i;
    if (!e.column)
      return;
    const t = this.beans.colFilter.getFloatingFilterCompDetails(
      e.column,
      this.params.showParentFilter
    );
    t && ((i = (s = this.underlyingFloatingFilter) == null ? void 0 : s.refresh) == null || i.call(s, t.params));
  }
  onParentModelChanged(e, t) {
    var s;
    this.showingUnderlyingFloatingFilter ? (s = this.underlyingFloatingFilter) == null || s.onParentModelChanged(
      this.beans.colFilter.getModelForColumn(this.getSelectedColumn()),
      t
    ) : this.updateDisplayedValue();
  }
  updateDisplayedValue() {
    var r;
    const e = this.eFloatingFilterText;
    if (!e)
      return;
    const t = this.beans.colFilter, s = this.getSelectedColumn(), i = (n) => {
      var o;
      if (!n)
        e.setValue(""), e.setDisplayed(!1);
      else {
        const a = s ? t.getModelForColumn(s) : null;
        e.setValue(a == null ? "" : ((o = n.getModelAsString) == null ? void 0 : o.call(n, a)) ?? ""), e.setDisplayed(!0);
      }
    };
    this.gos.get("enableFilterHandlers") ? i(t.getHandler(s)) : (r = t.getOrCreateFilterUi(s)) == null || r.then((n) => {
      i(n);
    });
  }
  onColChange() {
    this.showingUnderlyingFloatingFilter || this.updateDisplayedValue();
  }
}, El = class {
  constructor() {
    this.allSets = /* @__PURE__ */ new Map();
  }
  removeFromChildrenAfterGroup(e, t) {
    const s = this.getSet(e);
    (s.fromChildrenAfterGroup ?? (s.fromChildrenAfterGroup = /* @__PURE__ */ new Set())).add(t);
  }
  isRemoveFromAllLeafChildren(e, t) {
    var s, i;
    return !!((i = (s = this.allSets.get(e)) == null ? void 0 : s.fromAllLeafChildren) != null && i.has(t));
  }
  preventRemoveFromAllLeafChildren(e, t) {
    var s, i;
    (i = (s = this.allSets.get(e)) == null ? void 0 : s.fromAllLeafChildren) == null || i.delete(t);
  }
  removeFromAllLeafChildren(e, t) {
    const s = this.getSet(e);
    (s.fromAllLeafChildren ?? (s.fromAllLeafChildren = /* @__PURE__ */ new Set())).add(t);
  }
  getSet(e) {
    let t = this.allSets.get(e);
    return t || (t = {
      fromChildrenAfterGroup: null,
      fromAllLeafChildren: null
    }, this.allSets.set(e, t)), t;
  }
  getAllParents() {
    return Array.from(this.allSets.keys());
  }
  flush() {
    const e = this.allSets;
    for (const t of e.keys()) {
      const s = e.get(t);
      if (s) {
        const { fromChildrenAfterGroup: i, fromAllLeafChildren: r } = s, { childrenAfterGroup: n, allLeafChildren: o } = t;
        n && i && (ju(n, i), t.updateHasChildren()), o && r && ju(o, r);
      }
    }
    e.clear();
  }
};
function ju(e, t) {
  let s = 0;
  for (let i = 0, r = e.length; i < r; ++i) {
    const n = e[i];
    t.has(n) || (e[s++] = n);
  }
  e.length = s;
}
var Yu = (e) => {
  if (!e)
    return [];
  const t = e.length, s = new Array(t);
  for (let i = 0; i < t; i++) {
    const r = e[i], n = r.getColDef();
    s[i] = {
      col: r,
      field: n.field,
      type: n.type,
      keyCreator: n.keyCreator,
      valueGetter: n.valueGetter
    };
  }
  return s;
}, qu = (e, t) => {
  const s = e.length;
  if (s !== (t == null ? void 0 : t.length))
    return !0;
  for (let i = 0; i < s; i++) {
    const r = e[i], n = t[i];
    if (r.col !== n)
      return !0;
    const o = n.getColDef();
    if (r.field !== o.field || r.type !== o.type || r.valueGetter !== o.valueGetter || r.keyCreator !== o.keyCreator)
      return !0;
  }
  return !1;
};
function KH(e) {
  if (!e)
    return !1;
  const t = e.length;
  if (t < 2)
    return !1;
  let s = !1;
  for (let i = 1; i < t; i++)
    if (Xu(e[i - 1], e[i]) > 0) {
      s = !0;
      break;
    }
  return s ? (e.sort(Xu), !0) : !1;
}
function Xu(e, t) {
  const s = e.sourceRowIndex, i = t.sourceRowIndex, r = s >= 0, n = i >= 0, o = r && n, a = !r && !n;
  return o ? s - i : a ? e.__objectId - t.__objectId : r ? 1 : -1;
}
var jH = class extends R {
  constructor() {
    super(...arguments), this.prevGroupCols = null, this.prevShowGroupCols = null;
  }
  wireBeans(e) {
    this.colModel = e.colModel, this.valueSvc = e.valueSvc, this.selectionSvc = e.selectionSvc, this.showRowGroupCols = e.showRowGroupCols;
  }
  getNode(e) {
    let t;
    return this.beans.rowModel.forEachNode((s) => {
      s.id === e && (t = s);
    }), t;
  }
  execute(e) {
    var r;
    const t = this.createGroupingDetails(e), s = e.changedRowNodes;
    s ? this.handleDeltaUpdate(t, s) : this.shotgunResetEverything(t, !!e.afterColumnsChanged);
    const i = e.changedPath;
    this.positionLeafsAndGroups(i), this.orderGroups(t), (r = this.selectionSvc) == null || r.updateSelectableAfterGrouping(i);
  }
  positionLeafsAndGroups(e) {
    e.forEachChangedNodeDepthFirst((t) => {
      if (t.childrenAfterGroup) {
        const s = [], i = [];
        let r;
        t.childrenAfterGroup.forEach((o) => {
          var a;
          (a = o.childrenAfterGroup) != null && a.length ? o.key === "" && !r ? r = o : i.push(o) : s.push(o);
        }), r && i.push(r), t.childrenAfterGroup = [...s, ...i];
        const n = t.sibling;
        n && (n.childrenAfterGroup = t.childrenAfterGroup);
      }
    }, !1);
  }
  createGroupingDetails(e) {
    var l;
    const { rowNode: t, changedPath: s, rowNodesOrderChanged: i } = e;
    let r = !1;
    const n = (l = this.beans.rowGroupColsSvc) == null ? void 0 : l.columns;
    let o = this.prevGroupCols;
    return (!o || qu(o, n)) && (r = !!o, this.prevGroupCols = o = Yu(n)), {
      groupCols: o,
      rootNode: t,
      pivotMode: this.colModel.isPivotMode(),
      rowNodesOrderChanged: !!i,
      groupColsChanged: r,
      // if no transaction and not immutable row data set, then it's shotgun, changed path would be 'not active' at this point anyway
      changedPath: s,
      groupAllowUnbalanced: this.gos.get("groupAllowUnbalanced"),
      isGroupOpenByDefault: this.gos.getCallback("isGroupOpenByDefault"),
      initialGroupOrderComparator: this.gos.getCallback("initialGroupOrderComparator")
    };
  }
  handleDeltaUpdate(e, { removals: t, updates: s, adds: i }) {
    const r = new El();
    t.size && this.removeNodes(t, e, r);
    for (const a of s)
      this.moveNodeInWrongPath(a, e, r);
    const n = e.changedPath;
    for (const a of i)
      this.insertOneNode(a, e), n.active && n.addParentNode(a.parent);
    const o = r.getAllParents();
    r.flush(), this.removeEmptyGroups(o, e), e.rowNodesOrderChanged && this.sortChildren(e);
  }
  // this is used when doing delta updates, eg Redux, keeps nodes in right order
  sortChildren(e) {
    e.changedPath.forEachChangedNodeDepthFirst(
      (t) => {
        KH(t.childrenAfterGroup) && e.changedPath.addParentNode(t);
      },
      !1,
      !0
    );
  }
  orderGroups(e) {
    const t = e.initialGroupOrderComparator;
    A(t) && s(e.rootNode);
    function s(i) {
      A(i.childrenAfterGroup) && // we only want to sort groups, so we do not sort leafs (a leaf group has leafs as children)
      !i.leafGroup && (i.childrenAfterGroup.sort((n, o) => t({ nodeA: n, nodeB: o })), i.childrenAfterGroup.forEach((n) => s(n)));
    }
  }
  getExistingPathForNode(e, t) {
    const s = [];
    let i = e.parent;
    for (; i && i !== t.rootNode; )
      s.push({
        key: i.key,
        rowGroupColumn: i.rowGroupColumn,
        field: i.field
      }), i = i.parent;
    return s.reverse(), s;
  }
  moveNodeInWrongPath(e, t, s) {
    t.changedPath.active && t.changedPath.addParentNode(e.parent);
    const i = (a) => a.key, r = this.getExistingPathForNode(e, t).map(i), n = this.getGroupInfo(e, t).map(i);
    Xe(r, n) || this.moveNode(e, t, s);
  }
  moveNode(e, t, s) {
    if (this.removeNodesFromParents([e], t, s), this.insertOneNode(e, t, s), e.setData(e.data), t.changedPath.active) {
      const i = e.parent;
      t.changedPath.addParentNode(i);
    }
  }
  removeNodes(e, t, s) {
    if (this.removeNodesFromParents(e, t, s), t.changedPath.active)
      for (const i of e)
        t.changedPath.addParentNode(i.parent);
  }
  forEachParentGroup(e, t, s) {
    let i = t;
    for (; i && i !== e.rootNode; )
      s(i), i = i.parent;
  }
  removeNodesFromParents(e, t, s) {
    const i = s == null, r = s || new El();
    for (const n of e)
      this.removeFromParent(n, r), this.forEachParentGroup(t, n.parent, (o) => {
        r.removeFromAllLeafChildren(o, n);
      });
    i && r.flush();
  }
  removeEmptyGroups(e, t) {
    let s = !0;
    const i = (r) => {
      var l, c;
      const n = this.getChildrenMappedKey(r.key, r.rowGroupColumn), o = (l = r.parent) == null ? void 0 : l.childrenMapped;
      return (o ? !o[n] : !0) ? !1 : !!r.group && (((c = r.childrenAfterGroup) == null ? void 0 : c.length) ?? 0) === 0;
    };
    for (; s; ) {
      s = !1;
      const r = new El();
      e.forEach((n) => {
        this.forEachParentGroup(t, n, (o) => {
          var a;
          i(o) && (s = !0, this.removeFromParent(o, r), (a = this.selectionSvc) == null || a.setNodesSelected({
            nodes: [o],
            newValue: !1,
            source: "rowGroupChanged"
          }));
        });
      }), r.flush();
    }
  }
  // removes the node from the parent by:
  // a) removing from childrenAfterGroup (using batchRemover if present, otherwise immediately)
  // b) removing from childrenMapped (immediately)
  // c) setRowTop(null) - as the rowRenderer uses this to know the RowNode is no longer needed
  // d) setRowIndex(null) - as the rowNode will no longer be displayed.
  removeFromParent(e, t) {
    var r;
    e.parent && (t ? t.removeFromChildrenAfterGroup(e.parent, e) : (be(e.parent.childrenAfterGroup, e), e.parent.updateHasChildren()));
    const s = this.getChildrenMappedKey(e.key, e.rowGroupColumn), i = (r = e.parent) == null ? void 0 : r.childrenMapped;
    i && delete i[s], e.setRowTop(null), e.setRowIndex(null);
  }
  /**
   * This is idempotent, but relies on the `key` field being the same throughout a RowNode's lifetime
   */
  addToParent(e, t) {
    const s = t.childrenMapped ?? (t.childrenMapped = {}), i = this.getChildrenMappedKey(e.key, e.rowGroupColumn);
    if (s[i] !== e) {
      s[i] = e;
      let r = t.childrenAfterGroup;
      if (!r) {
        t.childrenAfterGroup = r = [];
        const n = t.sibling;
        n && (n.childrenAfterGroup = t.childrenAfterGroup);
      }
      r.push(e), DC(t, this.beans, !0);
    }
  }
  checkAllGroupDataAfterColsChanged(e) {
    const t = (s) => {
      s && s.forEach((i) => {
        var o;
        if (!i.group)
          return;
        const n = {
          field: i.field,
          key: i.key,
          rowGroupColumn: i.rowGroupColumn,
          leafNode: (o = i.allLeafChildren) == null ? void 0 : o[0]
        };
        this.setGroupData(i, n), t(i.childrenAfterGroup);
      });
    };
    t(e.rootNode.childrenAfterGroup);
  }
  shotgunResetEverything(e, t) {
    var r, n;
    if (this.noChangeInGroupingColumns(e, t))
      return;
    (n = (r = this.selectionSvc) == null ? void 0 : r.filterFromSelection) == null || n.call(r, (o) => !o.group);
    const s = e.rootNode;
    s.leafGroup = e.groupCols.length === 0, s.childrenAfterGroup = [], s.childrenMapped = {}, s.updateHasChildren();
    const i = s.sibling;
    i && (i.childrenAfterGroup = s.childrenAfterGroup, i.childrenMapped = s.childrenMapped), this.insertNodes(s.allLeafChildren, e);
  }
  noChangeInGroupingColumns(e, t) {
    let s = !1;
    const i = this.prevShowGroupCols, r = this.showRowGroupCols.getShowRowGroupCols();
    return (!i || qu(i, r)) && (s = !!i, this.prevShowGroupCols = Yu(r)), !t || e.groupColsChanged ? !1 : (s && this.checkAllGroupDataAfterColsChanged(e), !0);
  }
  insertNodes(e, t) {
    e.forEach((s) => {
      this.insertOneNode(s, t), t.changedPath.active && t.changedPath.addParentNode(s.parent);
    });
  }
  insertOneNode(e, t, s) {
    const i = this.getGroupInfo(e, t), r = this.findParentForNode(e, i, t, s);
    r.group || F(184, { parentGroupData: r.data, childNodeData: e.data }), e.parent = r, e.level = i.length, r.childrenAfterGroup.push(e), r.updateHasChildren();
  }
  findParentForNode(e, t, s, i) {
    let r = s.rootNode;
    return t.forEach((n, o) => {
      r = this.getOrCreateNextNode(r, n, o, s), i != null && i.isRemoveFromAllLeafChildren(r, e) ? i == null || i.preventRemoveFromAllLeafChildren(r, e) : r.allLeafChildren.push(e);
    }), r;
  }
  getOrCreateNextNode(e, t, s, i) {
    const r = this.getChildrenMappedKey(t.key, t.rowGroupColumn), n = e == null ? void 0 : e.childrenMapped;
    let o = n == null ? void 0 : n[r];
    return o || (o = this.createGroup(t, e, s, i), this.addToParent(o, e)), o;
  }
  createGroup(e, t, s, i) {
    const r = new ft(this.beans);
    return r.group = !0, r.field = e.field, r.rowGroupColumn = e.rowGroupColumn, this.setGroupData(r, e), r.key = e.key, r.id = this.createGroupId(r, t, s), r.level = s, r.leafGroup = s === i.groupCols.length - 1, r.allLeafChildren = [], r.setAllChildrenCount(0), r.rowGroupIndex = s, r.childrenAfterGroup = [], r.childrenMapped = {}, r.updateHasChildren(), r.parent = t, this.setExpandedInitialValue(i, r), r;
  }
  createGroupId(e, t, s) {
    const i = (r, n) => {
      if (!r.rowGroupColumn)
        return null;
      const o = n ? i(n, n.parent) : null;
      return `${o == null ? "" : o + "-"}${r.rowGroupColumn.getColId()}-${r.key}`;
    };
    return ko + i(e, t);
  }
  setGroupData(e, t) {
    const s = t.rowGroupColumn;
    s && t.leafNode && (e.groupValue = this.valueSvc.getValue(s, t.leafNode)), e.groupData = {}, this.showRowGroupCols.getShowRowGroupCols().forEach((r) => {
      const n = e.rowGroupColumn;
      n !== null && r.isRowGroupDisplayed(n.getId()) && (e.groupData[r.getColId()] = this.valueSvc.getValue(n, t.leafNode));
    });
  }
  getChildrenMappedKey(e, t) {
    return t ? t.getId() + "-" + e : e;
  }
  setExpandedInitialValue(e, t) {
    if (e.pivotMode && t.leafGroup) {
      t.expanded = !1;
      return;
    }
    t.expanded = Yd(this.beans, t, t.level);
  }
  getGroupInfo(e, t) {
    const s = [];
    for (const { col: i, field: r } of t.groupCols) {
      let n = this.valueSvc.getKeyForNode(i, e), o = n != null && n !== "";
      if ((t.pivotMode || !t.groupAllowUnbalanced) && !o && (n = "", o = !0), o) {
        const l = {
          key: n,
          field: r,
          rowGroupColumn: i,
          leafNode: e
        };
        s.push(l);
      }
    }
    return s;
  }
};
function YH(e, t) {
  var s;
  (s = e.rowGroupColsSvc) == null || s.setColumns(t, "api");
}
function qH(e, t) {
  var s;
  (s = e.rowGroupColsSvc) == null || s.removeColumns(t, "api");
}
function XH(e, t) {
  var s;
  (s = e.rowGroupColsSvc) == null || s.addColumns(t, "api");
}
function ZH(e, t, s) {
  var i, r;
  (r = (i = e.rowGroupColsSvc) == null ? void 0 : i.moveColumn) == null || r.call(i, t, s, "api");
}
function QH(e) {
  var t;
  return ((t = e.rowGroupColsSvc) == null ? void 0 : t.columns) ?? [];
}
var nv = {
  moduleName: "SharedRowGrouping",
  version: Y,
  apiFunctions: {
    setRowGroupColumns: YH,
    removeRowGroupColumns: qH,
    addRowGroupColumns: XH,
    getRowGroupColumns: QH,
    moveRowGroupColumn: ZH
  },
  dependsOn: [
    ie,
    jd,
    rv,
    qd,
    SH
  ]
}, ov = {
  moduleName: "RowGrouping",
  version: Y,
  dynamicBeans: { groupStrategy: jH },
  rowModels: ["clientSide"],
  dependsOn: [nv, qC, ka]
}, JH = {
  moduleName: "RowGroupingPanel",
  version: Y,
  selectors: [BH],
  icons: {
    // identifies the pivot drop zone
    pivotPanel: "pivot",
    // "Row groups" drop zone in column tool panel
    rowGroupPanel: "group",
    // separator between column 'pills' when you add multiple columns to the header drop zone
    panelDelimiter: "small-right",
    // version of panelDelimiter used in RTL mode
    panelDelimiterRtl: "small-left"
  },
  dependsOn: [ie, Is]
}, ez = {
  moduleName: "GroupFilter",
  version: Y,
  userComponents: {
    agGroupColumnFilter: {
      classImp: zH,
      processParams: NH
    },
    agGroupColumnFloatingFilter: $H
  },
  beans: [_H],
  dynamicBeans: {
    agGroupColumnFilterHandler: WH
  },
  dependsOn: [ie, Ls]
}, tz = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rowModel", this.firstRow = -1, this.lastRow = -1, this.rowCount = -1, this.rowNodesByIndex = {}, this.viewportChangedContext = !1;
  }
  // we don't implement as lazy row heights is not supported in this row model
  ensureRowHeightsValid(e, t, s, i) {
    return !1;
  }
  postConstruct() {
    const e = this.beans;
    this.rowHeight = pt(e), this.addManagedEventListeners({ viewportChanged: this.onViewportChanged.bind(this) }), this.addManagedPropertyListener("viewportDatasource", () => this.updateDatasource()), this.addManagedPropertyListener("rowHeight", () => {
      this.rowHeight = pt(e), this.updateRowHeights();
    });
  }
  start() {
    this.updateDatasource();
  }
  isLastRowIndexKnown() {
    return !0;
  }
  destroy() {
    this.destroyDatasource(), super.destroy();
  }
  destroyDatasource() {
    var t;
    const e = this.datasource;
    e && ((t = e.destroy) == null || t.call(e), this.beans.rowRenderer.datasourceChanged(), this.firstRow = -1, this.lastRow = -1);
  }
  updateDatasource() {
    const e = this.gos.get("viewportDatasource");
    e && this.setViewportDatasource(e);
  }
  getPageSize() {
    return this.gos.get("viewportRowModelPageSize");
  }
  getBufferSize() {
    return this.gos.get("viewportRowModelBufferSize");
  }
  calculateFirstRow(e) {
    const t = this.getBufferSize(), s = this.getPageSize(), i = e - t;
    return i < 0 ? 0 : Math.floor(i / s) * s;
  }
  calculateLastRow(e) {
    if (e === -1)
      return e;
    const t = this.getBufferSize(), s = this.getPageSize(), i = e + t, r = Math.ceil(i / s) * s, n = this.rowCount - 1;
    return Math.min(r, n);
  }
  onViewportChanged(e) {
    var i;
    const t = this.calculateFirstRow(e.firstRow), s = this.calculateLastRow(e.lastRow);
    (this.firstRow !== t || this.lastRow !== s) && (this.firstRow = t, this.lastRow = s, this.purgeRowsNotInViewport(), this.viewportChangedContext = !0, (i = this.datasource) == null || i.setViewportRange(this.firstRow, this.lastRow), this.viewportChangedContext = !1);
  }
  purgeRowsNotInViewport() {
    const e = this.rowNodesByIndex;
    Object.keys(e).forEach((t) => {
      var i;
      const s = parseInt(t, 10);
      if (s < this.firstRow || s > this.lastRow) {
        if (this.isRowFocused(s) || (i = this.beans.editSvc) != null && i.isRowEditing(e[s]))
          return;
        delete e[s];
      }
    });
  }
  isRowFocused(e) {
    const t = this.beans.focusSvc.getFocusCellToUseAfterRefresh();
    return !t || t.rowPinned != null ? !1 : t.rowIndex === e;
  }
  setViewportDatasource(e) {
    this.destroyDatasource(), this.datasource = e, this.rowCount = -1, e.init ? e.init({
      setRowCount: this.setRowCount.bind(this),
      setRowData: this.setRowData.bind(this),
      getRow: this.getRow.bind(this)
    }) : F(226);
  }
  getType() {
    return "viewport";
  }
  getRow(e) {
    return this.rowNodesByIndex[e] || (this.rowNodesByIndex[e] = this.createBlankRowNode(e)), this.rowNodesByIndex[e];
  }
  getRowNode(e) {
    let t;
    return this.forEachNode((s) => {
      s.id === e && (t = s);
    }), t;
  }
  getRowCount() {
    return this.rowCount === -1 ? 0 : this.rowCount;
  }
  getRowIndexAtPixel(e) {
    return this.rowHeight !== 0 ? Math.floor(e / this.rowHeight) : 0;
  }
  /** Viewport row model does not support dynamic row heights by design and while it is possible to implement this feature, it leads to view-model desync due to data being not isotropic in time */
  resetRowHeights() {
  }
  onRowHeightChanged() {
  }
  getRowBounds(e) {
    const t = this.rowHeight;
    return {
      rowHeight: t,
      rowTop: t * e
    };
  }
  updateRowHeights() {
    const e = this.rowHeight;
    this.forEachNode((t) => {
      t.setRowHeight(e), t.setRowTop(e * t.rowIndex);
    }), this.eventSvc.dispatchEvent({
      type: "modelUpdated",
      newData: !1,
      newPage: !1,
      keepRenderedRows: !0,
      animate: !1
    });
  }
  getTopLevelRowCount() {
    return this.getRowCount();
  }
  getTopLevelRowDisplayedIndex(e) {
    return e;
  }
  isEmpty() {
    return this.rowCount > 0;
  }
  isRowsToRender() {
    return this.rowCount > 0;
  }
  getNodesInRangeForSelection(e, t) {
    const s = e.rowIndex, i = t.rowIndex, r = s < this.firstRow || s > this.lastRow, n = i < this.firstRow || i > this.lastRow;
    if (r || n)
      return [];
    const o = [], a = s <= i ? s : i, l = s <= i ? i : s;
    for (let c = a; c <= l; c++)
      o.push(this.rowNodesByIndex[c]);
    return o;
  }
  forEachNode(e) {
    let t = 0;
    Object.keys(this.rowNodesByIndex).forEach((s) => {
      const i = parseInt(s, 10), r = this.rowNodesByIndex[i];
      e(r, t), t++;
    });
  }
  setRowData(e) {
    const t = es(this.beans.gos), s = /* @__PURE__ */ new Map();
    if (t)
      for (const i of Object.values(this.rowNodesByIndex))
        s.set(i.id, i);
    for (let i = this.firstRow; i <= this.lastRow; i++) {
      const r = e[i];
      if (!r)
        continue;
      let n, o;
      t ? (n = t({ data: r, rowPinned: void 0, level: 0, parentKeys: void 0 }), o = s.get(n)) : o = this.rowNodesByIndex[i], o ? (o.updateData(r), o.setRowIndex(i), o.setRowTop(this.rowHeight * i)) : (o = this.createBlankRowNode(i), o.setDataAndId(r, n ?? i.toString())), this.rowNodesByIndex[i] = o;
    }
    this.viewportChangedContext || this.eventSvc.dispatchEvent({
      type: "modelUpdated",
      newData: !1,
      newPage: !1,
      keepRenderedRows: !0,
      animate: !1
    });
  }
  createBlankRowNode(e) {
    const t = new ft(this.beans), s = this.rowHeight;
    return t.setRowHeight(s), t.setRowTop(s * e), t.setRowIndex(e), t;
  }
  setRowCount(e, t = !1) {
    if (e === this.rowCount)
      return;
    this.rowCount = e;
    const s = this.eventSvc;
    s.dispatchEventOnce({
      type: "rowCountReady"
    }), s.dispatchEvent({
      type: "modelUpdated",
      newData: !1,
      newPage: !1,
      keepRenderedRows: t,
      animate: !1
    });
  }
  isRowPresent(e) {
    return !!this.getRowNode(e.id);
  }
}, sz = {
  moduleName: "ViewportRowModel",
  version: Y,
  rowModels: ["viewport"],
  beans: [tz],
  dependsOn: [ie]
};
function iz(e, t) {
  var s;
  (s = e.clipboardSvc) == null || s.copyToClipboard(t);
}
function rz(e, t) {
  var s;
  (s = e.clipboardSvc) == null || s.cutToClipboard(t);
}
function nz(e, t) {
  var s;
  (s = e.clipboardSvc) == null || s.copySelectedRowsToClipboard(t);
}
function oz(e, t) {
  var s;
  (s = e.clipboardSvc) == null || s.copySelectedRangeToClipboard(t);
}
function az(e) {
  var t;
  (t = e.clipboardSvc) == null || t.copyRangeDown();
}
function lz(e) {
  var t;
  (t = e.clipboardSvc) == null || t.pasteFromClipboard();
}
var jn = "paste", Tl = "dragCopy", Ml = "clipboard";
function cz(e, t = ",") {
  const s = [], i = (n) => n === "\r" || n === `
`;
  let r = !1;
  if (e === "")
    return [[""]];
  for (let n = 0, o = 0, a = 0; a < e.length; a++) {
    const l = e[a - 1], c = e[a], d = e[a + 1], h = () => {
      s[n] || (s[n] = []), s[n][o] || (s[n][o] = "");
    };
    if (h(), c === '"' && (r ? d === '"' ? (s[n][o] += '"', a++) : r = !1 : (l === void 0 || l === t || i(l)) && (r = !0)), !r && c !== '"') {
      if (c === t) {
        o++, h();
        continue;
      } else if (i(c)) {
        o = 0, n++, h(), c === "\r" && d === `
` && a++;
        continue;
      }
    }
    s[n][o] += c;
  }
  return s;
}
var dz = class extends R {
  constructor() {
    super(...arguments), this.beanName = "clipboardSvc", this.clientSideRowModel = null, this.gridCtrl = null, this.lastPasteOperationTime = 0, this.navigatorApiFailed = !1;
  }
  postConstruct() {
    const { gos: e, rowModel: t, ctrlsSvc: s } = this.beans;
    te(e) && (this.clientSideRowModel = t), s.whenReady(this, (i) => {
      this.gridCtrl = i.gridCtrl;
    });
  }
  destroy() {
    super.destroy(), this.clientSideRowModel = null, this.gridCtrl = null;
  }
  pasteFromClipboard() {
    !this.gos.get("suppressClipboardApi") && !this.navigatorApiFailed && navigator.clipboard && navigator.clipboard.readText ? navigator.clipboard.readText().then(this.processClipboardData.bind(this)).catch((t) => {
      F(40, { e: t, method: "readText" }), this.navigatorApiFailed = !0, this.pasteFromClipboardLegacy();
    }) : this.pasteFromClipboardLegacy();
  }
  pasteFromClipboardLegacy() {
    let e = !1;
    const t = (s) => {
      const i = Date.now();
      i - this.lastPasteOperationTime < 50 && (e = !0, s.preventDefault()), this.lastPasteOperationTime = i;
    };
    this.executeOnTempElement(
      (s) => {
        s.addEventListener("paste", t), s.focus({ preventScroll: !0 });
      },
      (s) => {
        const i = s.value;
        e ? this.refocusLastFocusedCell() : this.processClipboardData(i), s.removeEventListener("paste", t);
      }
    );
  }
  refocusLastFocusedCell() {
    const { focusSvc: e } = this.beans, t = e.getFocusedCell();
    t && e.setFocusedCell({
      rowIndex: t.rowIndex,
      column: t.column,
      rowPinned: t.rowPinned,
      forceBrowserFocus: !0
    });
  }
  getClipboardDelimiter() {
    const e = this.gos.get("clipboardDelimiter");
    return A(e) ? e : "	";
  }
  processClipboardData(e) {
    if (e == null)
      return;
    let t = cz(e, this.getClipboardDelimiter());
    const s = this.gos.getCallback("processDataFromClipboard");
    if (s && (t = s({ data: t })), t == null)
      return;
    this.gos.get("suppressLastEmptyLineOnPaste") && this.removeLastLineIfBlank(t);
    const { rangeSvc: i, editSvc: r } = this.beans, n = (o, a, l, c) => {
      (i == null ? void 0 : i.isMoreThanOneCell()) && !this.hasOnlyOneValueToPaste(t) ? this.pasteIntoActiveRange(t, o, a, c) : this.pasteStartingFromFocusedCell(t, o, a, l, c), r == null || r.stopEditing(void 0, { source: jn });
    };
    this.doPasteOperation(n);
  }
  // common code to paste operations, e.g. paste to cell, paste to range, and copy range down
  doPasteOperation(e) {
    const t = "clipboard", { eventSvc: s, focusSvc: i, rowRenderer: r, gos: n } = this.beans;
    s.dispatchEvent({
      type: "pasteStart",
      source: t
    });
    const { clientSideRowModel: o } = this, a = o == null ? void 0 : o.rootNode, l = a && new Di(n.get("aggregateOnlyChangedColumns"), a), c = {}, d = [], h = i.getFocusedCell();
    e(c, d, h, l);
    const u = [...d];
    l && (o.doAggregate(l), l.forEachChangedNodeDepthFirst((g) => {
      u.push(g);
    })), r.refreshCells({ rowNodes: u }), this.dispatchFlashCells(c), this.fireRowChanged(d), this.refocusLastFocusedCell(), s.dispatchEvent({
      type: "pasteEnd",
      source: t
    });
  }
  getPreProcessRangeCallback(e) {
    return (t) => {
      const { rangeSvc: s } = this.beans;
      if (!s)
        return;
      const { rowDiff: i, colDiff: r } = this.getAdjustedRangeDimensionForPaste(t, e);
      i !== 0 && s.extendRangeRowCountBy(t, i), r !== 0 && s.extendRangeColumnCountBy(t, r);
    };
  }
  getAdjustedRangeDimensionForPaste(e, t) {
    const s = this.beans.rangeSvc, i = t.length, r = t[0].length, n = s.getRangeRowCount(e), o = e.columns.length;
    return n >= i && n % i === 0 && o >= r && o % r === 0 ? {
      rowDiff: n - i,
      colDiff: o - r
    } : {
      rowDiff: i - n,
      colDiff: r - o
    };
  }
  pasteIntoActiveRange(e, t, s, i) {
    let r = 0, n = 0;
    const o = (a, l, c, d) => {
      var m;
      if (d - r >= e.length) {
        if (d % e.length !== 0)
          return;
        r += n, n = 0;
      }
      const u = e[d - r];
      s.push(l);
      const g = this.gos.getCallback("processCellFromClipboard"), p = c.columns, f = p.findIndex(Ds);
      f !== -1 && p.splice(f, 1);
      for (let C = 0; C < p.length; C++) {
        const v = p[C];
        if (!v.isCellEditable(l) || v.isSuppressPaste(l))
          continue;
        let w = C;
        C >= u.length && (w = C % u.length);
        const b = this.processCell(
          l,
          v,
          u[w],
          Tl,
          g,
          !0
        );
        (m = this.beans.editSvc) == null || m.commitNextEdit(), l.setDataValue(v, b, jn), i == null || i.addParentNode(l.parent, [v]);
        const { rowIndex: y, rowPinned: P } = a, E = Ws({ rowIndex: y, column: v, rowPinned: P });
        t[E] = !0;
      }
      n++;
    };
    this.iterateActiveRanges(o, !1, this.getPreProcessRangeCallback(e));
  }
  getDisplayedColumnsStartingAt(e) {
    let t = e;
    const s = [], { visibleCols: i } = this.beans;
    for (; t && Xc(t); )
      t = i.getColAfter(t);
    for (; t != null; )
      s.push(t), t = i.getColAfter(t);
    return s;
  }
  pasteStartingFromFocusedCell(e, t, s, i, r) {
    if (!i)
      return;
    const n = { rowIndex: i.rowIndex, rowPinned: i.rowPinned }, o = this.getDisplayedColumnsStartingAt(i.column);
    this.isPasteSingleValueIntoRange(e) ? this.pasteSingleValueIntoRange(e, s, t, r) : this.pasteMultipleValues(
      e,
      n,
      s,
      o,
      t,
      Ml,
      r
    );
  }
  // if range is active, and only one cell, then we paste this cell into all cells in the active range.
  isPasteSingleValueIntoRange(e) {
    const t = this.beans.rangeSvc;
    return this.hasOnlyOneValueToPaste(e) && !!t && !t.isEmpty();
  }
  pasteSingleValueIntoRange(e, t, s, i) {
    const r = e[0][0], n = (o, a, l) => {
      t.push(a), l.columns.forEach(
        (c) => this.updateCellValue(a, c, r, s, Ml, i)
      );
    };
    this.iterateActiveRanges(n);
  }
  hasOnlyOneValueToPaste(e) {
    return e.length === 1 && e[0].length === 1;
  }
  copyRangeDown() {
    const { rangeSvc: e, gos: t, valueSvc: s } = this.beans;
    if (!e || e.isEmpty())
      return;
    const i = [], r = (n, o, a, l) => {
      const c = t.getCallback("processCellForClipboard"), d = t.getCallback("processCellFromClipboard"), h = (u, g, p) => {
        const { columns: f } = p;
        i.length ? (o.push(g), f.forEach((m, C) => {
          var P;
          if (!m.isCellEditable(g) || m.isSuppressPaste(g))
            return;
          const v = this.processCell(
            g,
            m,
            i[C],
            Tl,
            d,
            !0
          );
          (P = this.beans.editSvc) == null || P.commitNextEdit(), g.setDataValue(m, v, jn), l && l.addParentNode(g.parent, [m]);
          const { rowIndex: w, rowPinned: b } = u, y = Ws({ rowIndex: w, column: m, rowPinned: b });
          n[y] = !0;
        })) : f.forEach((m) => {
          const C = this.processCell(
            g,
            m,
            s.getValue(m, g),
            Tl,
            c,
            !1,
            !0
          );
          i.push(C);
        });
      };
      this.iterateActiveRanges(h, !0);
    };
    this.doPasteOperation(r);
  }
  removeLastLineIfBlank(e) {
    const t = _(e);
    if (t && t.length === 1 && t[0] === "") {
      if (e.length === 1)
        return;
      be(e, t);
    }
  }
  fireRowChanged(e) {
    this.gos.get("editType") === "fullRow" && e.forEach((t) => {
      this.eventSvc.dispatchEvent({
        type: "rowValueChanged",
        node: t,
        data: t.data,
        rowIndex: t.rowIndex,
        rowPinned: t.rowPinned
      });
    });
  }
  pasteMultipleValues(e, t, s, i, r, n, o) {
    let a = t;
    const l = this.beans, { gos: c } = l, d = this.clientSideRowModel != null && !c.get("enableGroupEdit") && !c.get("treeData"), h = () => {
      for (; ; ) {
        if (!a)
          return null;
        const u = Ee(l, a);
        if (a = dt(l, {
          rowPinned: a.rowPinned,
          rowIndex: a.rowIndex
        }), u == null)
          return null;
        if (!(u.detail || u.footer || d && u.group))
          return u;
      }
    };
    e.forEach((u) => {
      const g = h();
      g && (u.forEach(
        (p, f) => this.updateCellValue(g, i[f], p, r, n, o)
      ), s.push(g));
    });
  }
  updateCellValue(e, t, s, i, r, n) {
    var d;
    if (!e || !t || !t.isCellEditable(e) || t.isSuppressPaste(e))
      return;
    const o = this.processCell(
      e,
      t,
      s,
      r,
      this.gos.getCallback("processCellFromClipboard"),
      !0
    );
    (d = this.beans.editSvc) == null || d.commitNextEdit(), e.setDataValue(t, o, jn);
    const { rowIndex: a, rowPinned: l } = e, c = Ws({ rowIndex: a, column: t, rowPinned: l });
    i[c] = !0, n && n.addParentNode(e.parent, [t]);
  }
  copyToClipboard(e = {}) {
    this.copyOrCutToClipboard(e);
  }
  cutToClipboard(e = {}, t = "api") {
    this.gos.get("suppressCutToClipboard") || (this.eventSvc.dispatchEvent({
      type: "cutStart",
      source: t
    }), this.copyOrCutToClipboard(e, !0), this.eventSvc.dispatchEvent({
      type: "cutEnd",
      source: t
    }));
  }
  copyOrCutToClipboard(e, t) {
    let { includeHeaders: s, includeGroupHeaders: i } = e;
    const { gos: r, focusSvc: n } = this.beans;
    s == null && (s = r.get("copyHeadersToClipboard")), i == null && (i = r.get("copyGroupHeadersToClipboard"));
    const o = { includeHeaders: s, includeGroupHeaders: i }, a = r.get("rowSelection"), l = r.get("cellSelection");
    let c = null;
    this.shouldCopyCells(l, a) ? (this.copySelectedRangeToClipboard(o), c = 0) : this.shouldCopyRows(a) ? (this.copySelectedRowsToClipboard(o), c = 1) : n.isAnyCellFocused() && (this.copyFocusedCellToClipboard(o), c = 2), t && c !== null && this.clearCellsAfterCopy(c);
  }
  shouldCopyCells(e, t) {
    const { rangeSvc: s, selectionSvc: i, gos: r } = this.beans;
    if (!s || s.isEmpty())
      return !1;
    if (e)
      return !(typeof t == "object" && t.copySelectedRows && !(i != null && i.isEmpty()));
    {
      const n = r.get("suppressCopySingleCellRanges");
      return !(!s.isMoreThanOneCell() && n);
    }
  }
  shouldCopyRows(e) {
    const { selectionSvc: t, gos: s } = this.beans;
    return (t == null ? void 0 : t.isEmpty()) ?? !0 ? !1 : e && typeof e != "string" ? e.copySelectedRows ?? !1 : !s.get("suppressCopyRowsToClipboard");
  }
  clearCellsAfterCopy(e) {
    const t = this.beans, { rangeSvc: s, focusSvc: i, eventSvc: r } = t;
    if (r.dispatchEvent({ type: "keyShortcutChangedCellStart" }), e === 0)
      s.clearCellRangeCellValues({ cellEventSource: "clipboardSvc" });
    else if (e === 1)
      this.clearSelectedRows();
    else {
      const n = i.getFocusedCell();
      if (n == null)
        return;
      const o = Ee(t, n);
      o && this.clearCellValue(o, n.column);
    }
    r.dispatchEvent({ type: "keyShortcutChangedCellEnd" });
  }
  clearSelectedRows() {
    const { selectionSvc: e, visibleCols: t } = this.beans, s = (e == null ? void 0 : e.getSelectedNodes()) ?? [], i = t.allCols;
    for (const r of s)
      for (const n of i)
        this.clearCellValue(r, n);
  }
  clearCellValue(e, t) {
    if (!t.isCellEditable(e))
      return;
    const s = this.beans.valueSvc.getDeleteValue(t, e);
    e.setDataValue(t, s, "clipboardSvc");
  }
  iterateActiveRanges(e, t, s) {
    const i = this.beans.rangeSvc;
    if (!i || i.isEmpty())
      return;
    const r = i.getCellRanges();
    (t ? [r[0]] : r).forEach((o) => this.iterateActiveRange({ cellRange: o, rowCallback: e, preProcessRange: s }));
  }
  iterateActiveRange(e) {
    const { cellRange: t, preProcessRange: s, rowCallback: i } = e, { beans: r } = this, { rangeSvc: n } = r;
    if (!n)
      return;
    s && s(t);
    let o = n.getRangeStartRow(t);
    const a = n.getRangeEndRow(t);
    let l = 0, c = !1;
    for (; !c && o != null; ) {
      const d = Ee(r, o);
      c = xe(o, a), i(o, d, t, l++), o = dt(r, o);
    }
  }
  copySelectedRangeToClipboard(e = {}) {
    const t = this.beans.rangeSvc;
    if (!t || t.isEmpty())
      return;
    const s = t.areAllRangesAbleToMerge(), { data: i, cellsToFlash: r } = s ? this.buildDataFromMergedRanges(t, e) : this.buildDataFromRanges(t, e);
    this.copyDataToClipboard(i), this.dispatchFlashCells(r);
  }
  buildDataFromMergedRanges(e, t) {
    const s = /* @__PURE__ */ new Set(), i = e.getCellRanges(), r = /* @__PURE__ */ new Map(), n = [], o = {}, a = te(this.gos, this.beans.rowModel), l = /* @__PURE__ */ new Set();
    a || this.beans.rowModel.forEachNode((u) => {
      l.add(u.rowIndex);
    }), i.forEach((u) => {
      u.columns.forEach((f) => s.add(f));
      const { rowPositions: g, cellsToFlash: p } = this.getRangeRowPositionsAndCellsToFlash(e, u);
      g.forEach((f) => {
        const m = l.has(f.rowIndex);
        if (!a && !m)
          return;
        const C = `${f.rowIndex}-${f.rowPinned || "null"}`;
        r.get(C) || (r.set(C, !0), n.push(f));
      }), Object.assign(o, p);
    });
    const c = this.beans.visibleCols.allCols, d = Array.from(s);
    return d.sort((u, g) => {
      const p = c.indexOf(u), f = c.indexOf(g);
      return p - f;
    }), { data: this.buildExportParams({
      columns: d,
      rowPositions: n,
      includeHeaders: t.includeHeaders,
      includeGroupHeaders: t.includeGroupHeaders
    }), cellsToFlash: o };
  }
  buildDataFromRanges(e, t) {
    const s = e.getCellRanges(), i = [], r = {};
    return s.forEach((n) => {
      const { rowPositions: o, cellsToFlash: a } = this.getRangeRowPositionsAndCellsToFlash(e, n);
      Object.assign(r, a), i.push(
        this.buildExportParams({
          columns: n.columns,
          rowPositions: o,
          includeHeaders: t.includeHeaders,
          includeGroupHeaders: t.includeGroupHeaders
        })
      );
    }), { data: i.join(`
`), cellsToFlash: r };
  }
  getRangeRowPositionsAndCellsToFlash(e, t) {
    const s = [], i = {}, r = e.getRangeStartRow(t), n = e.getRangeEndRow(t);
    let o = r;
    for (; o && (s.push(o), t.columns.forEach((a) => {
      const { rowIndex: l, rowPinned: c } = o, d = Ws({ rowIndex: l, column: a, rowPinned: c });
      i[d] = !0;
    }), !xe(o, n)); )
      o = dt(this.beans, o);
    return { rowPositions: s, cellsToFlash: i };
  }
  getCellsToFlashFromRowNodes(e) {
    const t = this.beans.visibleCols.allCols, s = {};
    for (let i = 0; i < e.length; i++) {
      const { level: r, rowIndex: n, rowPinned: o, sibling: a } = e[i], l = r === -1 ? a.rowIndex : n;
      if (l != null)
        for (let c = 0; c < t.length; c++) {
          const d = t[c], h = Ws({ rowIndex: l, column: d, rowPinned: o });
          s[h] = !0;
        }
    }
    return s;
  }
  copyFocusedCellToClipboard(e = {}) {
    var o;
    let t = this.beans.focusSvc.getFocusedCell();
    if (t == null)
      return;
    t = ((o = this.beans.rowSpanSvc) == null ? void 0 : o.getCellStart(t)) ?? t;
    const s = Ws(t), i = { rowPinned: t.rowPinned, rowIndex: t.rowIndex }, r = t.column, n = this.buildExportParams({
      columns: [r],
      rowPositions: [i],
      includeHeaders: e.includeHeaders,
      includeGroupHeaders: e.includeGroupHeaders
    });
    this.copyDataToClipboard(n), this.dispatchFlashCells({ [s]: !0 });
  }
  copySelectedRowsToClipboard(e = {}) {
    var o;
    const { columnKeys: t, includeHeaders: s, includeGroupHeaders: i } = e, r = this.buildExportParams({
      columns: t,
      includeHeaders: s,
      includeGroupHeaders: i
    });
    this.copyDataToClipboard(r);
    const n = ((o = this.beans.selectionSvc) == null ? void 0 : o.getSelectedNodes()) || [];
    this.dispatchFlashCells(this.getCellsToFlashFromRowNodes(n));
  }
  buildExportParams(e) {
    const { columns: t, rowPositions: s, includeHeaders: i = !1, includeGroupHeaders: r = !1 } = e, { gos: n, csvCreator: o } = this.beans, a = ({ node: c, column: d }) => {
      const { value: h, valueFormatted: u } = this.beans.valueSvc.getValueForDisplay(d, c, !0), g = u ?? h ?? "", p = n.getCallback("processCellForClipboard");
      return p ? p({
        column: d,
        node: c,
        value: g,
        type: Ml,
        formatValue: (f) => this.beans.valueSvc.formatValue(d, c, f) ?? f,
        parseValue: (f) => this.beans.valueSvc.parseValue(d, c, f, h) ?? f
      }) : g;
    }, l = {
      columnKeys: t,
      rowPositions: s,
      skipColumnHeaders: !i,
      skipColumnGroupHeaders: !r,
      suppressQuotes: !0,
      columnSeparator: this.getClipboardDelimiter(),
      onlySelected: !s,
      processCellCallback: n.getCallback("processCellForClipboard"),
      processRowGroupCallback: a,
      processHeaderCallback: n.getCallback("processHeaderForClipboard"),
      processGroupHeaderCallback: n.getCallback("processGroupHeaderForClipboard")
    };
    return o.getDataAsCsv(l, !0);
  }
  // eslint-disable-next-line @typescript-eslint/ban-types
  dispatchFlashCells(e) {
    window.setTimeout(() => {
      this.eventSvc.dispatchEvent({
        type: "flashCells",
        cells: e
      });
    }, 0);
  }
  processCell(e, t, s, i, r, n, o) {
    const a = this.beans.valueSvc;
    return r ? r({
      column: t,
      node: e,
      value: s,
      type: i,
      formatValue: (c) => a.formatValue(t, e ?? null, c) ?? c,
      parseValue: (c) => a.parseValue(t, e ?? null, c, a.getValue(t, e))
    }) : n && t.getColDef().useValueParserForImport !== !1 ? a.parseValue(t, e ?? null, s, a.getValue(t, e)) : o && t.getColDef().useValueFormatterForExport !== !1 ? a.formatValue(t, e ?? null, s) ?? s : s;
  }
  copyDataToClipboard(e) {
    const t = this.gos.getCallback("sendToClipboard");
    if (t) {
      t({ data: e });
      return;
    }
    if (!this.gos.get("suppressClipboardApi") && navigator.clipboard) {
      navigator.clipboard.writeText(e).catch((i) => {
        F(40, { e: i, method: "writeText" }), this.copyDataToClipboardLegacy(e);
      });
      return;
    }
    this.copyDataToClipboardLegacy(e);
  }
  copyDataToClipboardLegacy(e) {
    this.executeOnTempElement((t) => {
      const s = me(this.beans), i = Q(this.beans);
      t.value = e || " ", t.select(), t.focus({ preventScroll: !0 }), s.execCommand("copy") || F(41), i != null && i.focus != null && i.focus({ preventScroll: !0 });
    });
  }
  executeOnTempElement(e, t) {
    if (!this.gridCtrl)
      return;
    const s = me(this.beans), i = s.createElement("textarea"), r = i.style;
    r.width = "1px", r.height = "1px";
    const n = s.documentElement;
    r.top = n.scrollTop + "px", r.left = n.scrollLeft + "px", r.position = "absolute", r.opacity = "0";
    const o = this.gridCtrl.getGui();
    o.appendChild(i);
    try {
      e(i);
    } catch {
      F(42);
    }
    t ? window.setTimeout(() => {
      t(i), o.removeChild(i);
    }, 100) : o.removeChild(i);
  }
}, hz = {
  moduleName: "Clipboard",
  version: Y,
  beans: [dz],
  apiFunctions: {
    copyToClipboard: iz,
    cutToClipboard: rz,
    copySelectedRowsToClipboard: nz,
    copySelectedRangeToClipboard: oz,
    copySelectedRangeDown: az,
    pasteFromClipboard: lz
  },
  dependsOn: [ie, Wm, xa, _m]
}, uz = (
  /*css*/
  '.ag-row-number-cell{background-color:var(--ag-header-background-color);border:none;color:var(--ag-header-text-color);font-family:var(--ag-header-font-family);font-size:var(--ag-header-font-size);font-weight:var(--ag-header-font-weight);overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap;width:100%}:where(.ag-ltr) .ag-row-number-cell{text-align:right}:where(.ag-rtl) .ag-row-number-cell{text-align:left}.ag-row-numbers-resizer{bottom:-2px;cursor:ns-resize;height:4px;position:absolute;width:100%}:where(.ag-ltr) .ag-row-numbers-resizer{left:0}:where(.ag-rtl) .ag-row-numbers-resizer{right:0}.ag-floating-bottom .ag-row-numbers-resizer{bottom:unset;top:-2px}:where(.ag-row-number-header.ag-row-number-selection-enabled){cursor:cell}.ag-row-number-range-highlight{background-color:var(--ag-range-header-highlight-color)}.ag-row-number-range-selected{background-color:var(--ag-row-numbers-selected-color)}:where(.ag-ltr){.ag-row-number-header,:where(.ag-cell.ag-row-number-cell):not(.ag-cell-last-left-pinned){border-right:var(--ag-pinned-column-border)}:where(.ag-cell.ag-row-number-cell.ag-row-number-selection-enabled){cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxLjUiPjxwYXRoIGQ9Ik0zLjQ0NSA4LjkxMVY3LjQwOUg5Ljc1VjYuMDE0bDIuNTM1IDIuMTQ2LTIuNTM1IDIuMTQ2VjguOTExeiIgc3R5bGU9InN0cm9rZTojZmZmO3N0cm9rZS13aWR0aDouNDFweCIgdHJhbnNmb3JtPSJtYXRyaXgoMS41Nzg0IDAgMCAxLjg2NDI5IC00LjQxMyAtNy4yMTIpIi8+PC9zdmc+"),auto}}:where(.ag-rtl){.ag-row-number-header,:where(.ag-cell.ag-row-number-cell):not(.ag-cell-first-right-pinned){border-left:var(--ag-pinned-column-border)}:where(.ag-cell.ag-row-number-cell.ag-row-number-selection-enabled){cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxLjUiPjxwYXRoIGQ9Ik01Ljk3OSA4LjkxMXYxLjM5NUwzLjQ0NSA4LjE2bDIuNTM0LTIuMTQ2djEuMzk1aDYuMzA2djEuNTAyeiIgc3R5bGU9InN0cm9rZTojZmZmO3N0cm9rZS13aWR0aDouNDFweCIgdHJhbnNmb3JtPSJtYXRyaXgoMS41Nzg0IDAgMCAxLjg2NDI5IC00LjQxMyAtNy4yMTIpIi8+PC9zdmc+"),auto}}'
), gz = {
  tag: "div",
  cls: "ag-row-numbers-resizer"
}, pz = class extends D {
  constructor(e) {
    super(gz), this.cellCtrl = e, this.initialYPosition = -1, this.dragging = !1;
  }
  postConstruct() {
    const { beans: e, cellCtrl: t } = this, { dragSvc: s, environment: i } = e;
    this.defaultRowHeight = i.getDefaultRowHeight(), s.addDragSource({
      dragStartPixels: 0,
      eElement: this.getGui(),
      onDragStart: this.onDragStart.bind(this),
      onDragging: this.onDragging.bind(this),
      onDragStop: this.onDragStop.bind(this),
      onDragCancel: this.onDragCancel.bind(this),
      includeTouch: !0,
      stopPropagationForTouch: !0
    });
    const r = t.getRowPosition();
    this.node = Ee(this.beans, r);
  }
  onDragStart(e) {
    if (!this.node)
      return;
    const {
      beans: { ctrlsSvc: t, eventSvc: s }
    } = this;
    t.get("gridCtrl").setResizeCursor(Vp.Vertical), this.dragging = !0, this.initialHeight = this.node.rowHeight, s.dispatchEvent({
      type: "rowResizeStarted",
      node: this.node,
      event: e,
      rowHeight: this.initialHeight
    });
  }
  onDragging(e) {
    let { clientY: t } = e;
    if (this.cellCtrl.rowNode.rowPinned === "bottom" && (t *= -1), this.initialYPosition === -1 || !this.dragging) {
      this.initialYPosition = t;
      return;
    }
    const { beans: s, initialHeight: i, initialYPosition: r, defaultRowHeight: n, node: o } = this;
    if (i == null)
      return;
    const a = o == null ? void 0 : o.rowHeight, l = Math.max(i - (r - t), n);
    if (a === l)
      return;
    o == null || o.setRowHeight(l);
    const { rowRenderer: c, rowModel: d, pinnedRowModel: h } = s, u = !!(o != null && o.rowPinned);
    u && c.redraw({ afterScroll: !0 }), (!u || h != null && h.isManual()) && d.onRowHeightChanged({ animate: !1 });
  }
  onDragStop(e) {
    var t;
    this.beans.eventSvc.dispatchEvent({
      type: "rowResizeEnded",
      node: this.node,
      event: e,
      rowHeight: (t = this.node) == null ? void 0 : t.rowHeight
    }), this.clearDragDetails(!0);
  }
  onDragCancel() {
    this.clearDragDetails(!0);
  }
  clearDragDetails(e) {
    this.initialYPosition = -1, this.initialHeight = null, this.dragging = !1, e && this.beans.ctrlsSvc.get("gridCtrl").setResizeCursor(!1);
  }
  destroy() {
    this.clearDragDetails(!1), this.node = void 0, super.destroy();
  }
};
function av(e) {
  const t = e.get("rowNumbers");
  return !(!t || typeof t != "object" || !t.enableRowResizer);
}
var fz = class {
  constructor(e, t) {
    this.beans = e, this.cellCtrl = t;
  }
  refreshRowResizer() {
    !av(this.beans.gos) || !this.isRowResizeSupported(this.cellCtrl.rowNode) ? this.removeRowResizerFromCellComp() : this.addResizerToCellComp();
  }
  isRowResizeSupported(e) {
    const { pinnedRowModel: t, rowModel: s, visibleCols: i } = this.beans, r = !!s.onRowHeightChanged;
    return i.autoHeightCols.length ? (F(276), !1) : e.rowPinned != null ? t != null && t.isManual() ? r : !0 : r;
  }
  addResizerToCellComp() {
    const { beans: e, cellCtrl: t } = this, { eGui: s } = t;
    let { rowResizer: i } = this;
    if (i) {
      s.appendChild(i.getGui());
      return;
    }
    i = e.registry.createDynamicBean("rowNumberRowResizer", !1, t), i && (this.rowResizer = e.context.createBean(i), s.appendChild(i.getGui()));
  }
  removeRowResizerFromCellComp() {
    const {
      rowResizer: e,
      beans: { context: t }
    } = this;
    e && (se(e.getGui()), this.rowResizer = t.destroyBean(e));
  }
  destroy() {
    this.removeRowResizerFromCellComp();
  }
}, mz = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rowNumbersSvc", this.isIntegratedWithSelection = !1, this.lastColumnResized = 0;
  }
  postConstruct() {
    const e = pe(this, this.refreshCells.bind(this), 10);
    this.addManagedEventListeners({
      columnResized: () => {
        this.lastColumnResized = Date.now();
      },
      modelUpdated: (t) => {
        e(!1, !t.keepRenderedRows);
      },
      rangeSelectionChanged: () => this.refreshCells(!0),
      pinnedRowsChanged: () => e(!1, !0)
    }), this.addManagedPropertyListeners(["rowNumbers", "cellSelection"], (t) => {
      this.refreshSelectionIntegration(), this.updateColumns(t);
    }), this.refreshSelectionIntegration();
  }
  addColumns(e) {
    this.columns != null && (e.list = this.columns.list.concat(e.list), e.tree = this.columns.tree.concat(e.tree), da(e));
  }
  createColumns(e, t) {
    var u, g;
    const s = () => {
      var p;
      Ht(this.beans, (p = this.columns) == null ? void 0 : p.tree), this.columns = null;
    };
    if (!this.gos.get("rowNumbers")) {
      s();
      return;
    }
    const i = e.treeDepth, n = (((u = this.columns) == null ? void 0 : u.treeDepth) ?? -1) == i, o = this.generateRowNumberCols();
    if (ca(o, ((g = this.columns) == null ? void 0 : g.list) ?? []) && n)
      return;
    s();
    const { colGroupSvc: l } = this.beans, c = (l == null ? void 0 : l.findDepth(e.tree)) ?? 0, d = (l == null ? void 0 : l.balanceTreeForAutoCols(o, c)) ?? [];
    this.columns = {
      list: o,
      tree: d,
      treeDepth: c,
      map: {}
    }, t((p) => {
      if (!p)
        return null;
      const f = p.filter((m) => !Ke(m));
      return [...o, ...f];
    });
  }
  handleMouseDownOnCell(e, t) {
    return !this.isIntegratedWithSelection || t.target.classList.contains("ag-row-numbers-resizer") ? !1 : (!t.shiftKey && !Wl(this.beans, t) && this.focusFirstRenderedCellAtRowPosition(e), !0);
  }
  updateColumns(e) {
    var s;
    const t = qs(e.source);
    this.refreshSelectionIntegration(), (s = this.columns) == null || s.list.forEach((i) => {
      const r = this.createRowNumbersColDef();
      i.setColDef(r, null, t), je(this.beans, { state: [{ colId: i.getColId(), ...r }] }, t);
    });
  }
  getColumn() {
    var e;
    return ((e = this.columns) == null ? void 0 : e.list.find(Ke)) ?? null;
  }
  getColumns() {
    var e;
    return ((e = this.columns) == null ? void 0 : e.list) ?? null;
  }
  setupForHeader(e) {
    const { column: t, eGridHeader: s } = e.params;
    Ke(t) && (re(s, "Row Number"), this.addManagedElementListeners(s, {
      click: this.onHeaderClick.bind(this),
      keydown: this.onHeaderKeyDown.bind(this),
      focus: this.onHeaderFocus.bind(this)
    }));
  }
  createRowNumbersRowResizerFeature(e, t) {
    if (av(this.gos))
      return new fz(e, t);
  }
  refreshSelectionIntegration() {
    const { beans: e } = this, { gos: t, rangeSvc: s } = e, i = t.get("cellSelection");
    this.refreshRowNumberOverrides(), this.isIntegratedWithSelection = !!s && !!i && !this.isSuppressCellSelectionIntegration;
  }
  refreshRowNumberOverrides() {
    const e = this.gos.get("rowNumbers");
    if (this.rowNumberOverrides = {}, !e || typeof e != "object")
      return;
    e.suppressCellSelectionIntegration && (this.isSuppressCellSelectionIntegration = !0);
    const t = [
      "contextMenuItems",
      "context",
      "onCellClicked",
      "onCellContextMenu",
      "onCellDoubleClicked",
      "headerTooltip",
      "headerStyle",
      "headerComponent",
      "headerComponentParams",
      "suppressHeaderKeyboardEvent",
      "tooltipField",
      "tooltipValueGetter",
      "tooltipComponent",
      "tooltipComponentParams",
      "valueGetter",
      "valueFormatter",
      "width",
      "maxWidth",
      "minWidth",
      "resizable"
    ];
    for (const s of t)
      e[s] != null && (this.rowNumberOverrides[s] = e[s]);
  }
  onHeaderFocus() {
    var e;
    (e = this.beans.ariaAnnounce) == null || e.announceValue("Press Space to select all cells", "ariaSelectAllCells");
  }
  onHeaderKeyDown(e) {
    !this.isIntegratedWithSelection || e.key !== S.SPACE || this.handleFocusAllCellsFromHeader();
  }
  onHeaderClick(e) {
    var t;
    Date.now() - this.lastColumnResized < 100 || !this.isIntegratedWithSelection || (t = this.getColumn()) != null && t.resizing || this.handleFocusAllCellsFromHeader();
  }
  handleFocusAllCellsFromHeader() {
    lf(this.beans), this.focusFirstRenderedCellAtRowPosition();
  }
  refreshCells(e, t) {
    var i, r;
    const s = this.getColumn();
    if (s) {
      if (t) {
        const n = (i = this.beans.autoWidthCalc) == null ? void 0 : i.getPreferredWidthForElements([this.createDummyElement(s)], 2);
        n != null && ((r = this.beans.colResize) == null || r.setColumnWidths(
          [{ key: s, newWidth: n }],
          !1,
          !0,
          "rowNumbersService"
        ));
      }
      this.beans.rowRenderer.refreshCells({
        columns: [s],
        force: e
      });
    }
  }
  createDummyElement(e) {
    const t = K({ tag: "div", cls: "ag-cell-value ag-cell" });
    let s = String(this.beans.rowModel.getRowCount() + 1);
    if (typeof this.rowNumberOverrides.valueFormatter == "function") {
      const i = V(this.beans.gos, {
        data: void 0,
        value: s,
        node: null,
        column: e,
        colDef: e.colDef
      });
      s = this.rowNumberOverrides.valueFormatter(i);
    }
    return t.textContent = s, t;
  }
  createRowNumbersColDef() {
    const { gos: e, contextMenuSvc: t } = this.beans, s = e.get("enableRtl");
    return {
      // overridable properties
      minWidth: 60,
      width: 60,
      resizable: !1,
      valueGetter: this.valueGetter,
      contextMenuItems: this.isIntegratedWithSelection || !t ? void 0 : () => [],
      // overrides
      ...this.rowNumberOverrides,
      // non-overridable properties
      colId: Yc,
      chartDataType: "excluded",
      suppressHeaderMenuButton: !0,
      sortable: !1,
      suppressMovable: !0,
      lockPinned: !0,
      pinned: s ? "right" : "left",
      lockPosition: s ? "right" : "left",
      editable: !1,
      suppressFillHandle: !0,
      suppressAutoSize: !0,
      suppressSizeToFit: !0,
      suppressHeaderContextMenu: !0,
      suppressNavigable: !0,
      headerClass: this.getHeaderClass(),
      cellClass: this.getCellClass.bind(this),
      cellAriaRole: "rowheader"
    };
  }
  valueGetter(e) {
    const t = e.node;
    if (t != null && t.rowPinned && t.pinnedSibling) {
      const { rowIndex: s } = t.pinnedSibling;
      return `${s == null ? "-" : s + 1}`;
    }
    return String(((t == null ? void 0 : t.rowIndex) || 0) + 1);
  }
  getHeaderClass() {
    const e = ["ag-row-number-header"];
    return this.isIntegratedWithSelection && e.push("ag-row-number-selection-enabled"), e;
  }
  getCellClass(e) {
    const { beans: t } = this, { rangeSvc: s, gos: i } = t, { node: r } = e, n = ["ag-row-number-cell"], o = i.get("cellSelection");
    if (!s || !o)
      return n;
    this.isIntegratedWithSelection && n.push("ag-row-number-selection-enabled");
    const a = s.getCellRanges();
    if (!a.length)
      return n;
    const l = this.beans.visibleCols.allCols.length - 1, c = typeof o == "object" && o.enableHeaderHighlight;
    for (const d of a)
      s.isRowInRange(r.rowIndex, r.rowPinned, d) && (c && n.push("ag-row-number-range-highlight"), d.columns.length === l && n.push("ag-row-number-range-selected"));
    return n;
  }
  generateRowNumberCols() {
    const { gos: e } = this;
    if (!e.get("rowNumbers"))
      return [];
    const t = this.createRowNumbersColDef(), s = t.colId;
    e.validateColDef(t, s, !0);
    const i = new Wt(t, null, s, !1);
    return this.createBean(i), [i];
  }
  // focus is disabled on the Row Numbers cells, when a click happens on it,
  // it should focus the first cell of that row or first cell of the grid (from header).
  focusFirstRenderedCellAtRowPosition(e) {
    if (!e && (e = Af(this.beans), !e))
      return;
    const { beans: t, gos: s } = this, { visibleCols: i, colViewport: r } = t, n = s.get("enableRtl") ? i.rightCols : i.leftCols;
    let o;
    if (n.length == 1) {
      const d = Ee(t, e);
      if (!d)
        return;
      o = r.getColsWithinViewport(d);
    } else
      o = n;
    const a = o.find((d) => !Ke(d));
    if (!a)
      return;
    const { rowPinned: l, rowIndex: c } = e;
    setTimeout(() => {
      t.focusSvc.setFocusedCell({
        rowIndex: c,
        rowPinned: l,
        column: a,
        forceBrowserFocus: !0,
        preventScrollOnBrowserFocus: !0
      });
    });
  }
  destroy() {
    var e;
    Ht(this.beans, (e = this.columns) == null ? void 0 : e.tree), this.rowNumberOverrides = null, super.destroy();
  }
}, Cz = {
  moduleName: "RowNumbers",
  version: Y,
  beans: [mz],
  dynamicBeans: { rowNumberRowResizer: pz },
  dependsOn: [ie, jm, Hi],
  css: [uz]
}, vz = {
  tag: "div",
  cls: "ag-filter-toolpanel-search",
  role: "presentation",
  children: [
    {
      tag: "div",
      ref: "eExpand",
      cls: "ag-filter-toolpanel-expand"
    },
    {
      tag: "ag-input-text-field",
      ref: "eFilterTextField",
      cls: "ag-filter-toolpanel-search-input"
    }
  ]
}, wz = class extends D {
  constructor() {
    super(...arguments), this.eExpand = x, this.eFilterTextField = x;
  }
  postConstruct() {
    this.setTemplate(vz, [It]);
    const e = this.getLocaleTextFunc();
    this.eFilterTextField.setAutoComplete(!1).setInputAriaLabel(e("ariaFilterColumnsInput", "Filter Columns Input")).onValueChange(this.onSearchTextChanged.bind(this)), this.createExpandIcons(), this.setExpandState(
      0
      /* EXPANDED */
    ), this.addManagedElementListeners(this.eExpand, { click: this.onExpandClicked.bind(this) }), this.addManagedEventListeners({ newColumnsLoaded: this.showOrHideOptions.bind(this) });
  }
  init(e) {
    this.params = e, this.beans.colModel.ready && this.showOrHideOptions();
  }
  createExpandIcons() {
    const { eExpand: e, beans: t } = this;
    e.appendChild(this.eExpandChecked = N("accordionOpen", t)), e.appendChild(this.eExpandUnchecked = N("accordionClosed", t)), e.appendChild(this.eExpandIndeterminate = N("accordionIndeterminate", t));
  }
  // we only show expand / collapse if we are showing filters
  showOrHideOptions() {
    const { params: e, eFilterTextField: t } = this, s = !e.suppressFilterSearch, i = !e.suppressExpandAll, r = this.getLocaleTextFunc();
    t.setInputPlaceholder(r("searchOoo", "Search..."));
    const n = (a) => a.getOriginalParent() && a.isFilterAllowed(), o = this.beans.colModel.getCols().some(n);
    O(t.getGui(), s), O(this.eExpand, i && o);
  }
  onSearchTextChanged() {
    this.onSearchTextChangedDebounced || (this.onSearchTextChangedDebounced = pe(
      this,
      () => this.dispatchLocalEvent({ type: "searchChanged", searchText: this.eFilterTextField.getValue() }),
      300
    )), this.onSearchTextChangedDebounced();
  }
  onExpandClicked() {
    const e = this.currentExpandState === 0 ? { type: "collapseAll" } : { type: "expandAll" };
    this.dispatchLocalEvent(e);
  }
  setExpandState(e) {
    this.currentExpandState = e, O(
      this.eExpandChecked,
      e === 0
      /* EXPANDED */
    ), O(
      this.eExpandUnchecked,
      e === 1
      /* COLLAPSED */
    ), O(
      this.eExpandIndeterminate,
      e === 2
      /* INDETERMINATE */
    );
  }
}, bz = {
  selector: "AG-FILTERS-TOOL-PANEL-HEADER",
  component: wz
}, yz = {
  tag: "div",
  cls: "ag-filter-toolpanel-instance",
  children: [
    {
      tag: "div",
      ref: "eFilterToolPanelHeader",
      cls: "ag-filter-toolpanel-header ag-filter-toolpanel-instance-header",
      role: "button",
      attrs: { "aria-expanded": "false" },
      children: [
        { tag: "div", ref: "eExpand", cls: "ag-filter-toolpanel-expand" },
        { tag: "span", ref: "eFilterName", cls: "ag-header-cell-text" },
        {
          tag: "span",
          ref: "eFilterIcon",
          cls: "ag-header-icon ag-filter-icon ag-filter-toolpanel-instance-header-icon",
          attrs: { "aria-hidden": "true" }
        }
      ]
    },
    { tag: "div", ref: "agFilterToolPanelBody", cls: "ag-filter-toolpanel-instance-body ag-filter" }
  ]
}, lv = class extends D {
  constructor(e, t) {
    super(yz), this.hideHeader = e, this.expandedCallback = t, this.eFilterToolPanelHeader = x, this.eFilterName = x, this.agFilterToolPanelBody = x, this.eFilterIcon = x, this.eExpand = x, this.expanded = !1;
  }
  postConstruct() {
    const { beans: e, eExpand: t } = this, s = N("accordionOpen", e);
    this.eExpandChecked = s;
    const i = N("accordionClosed", e);
    this.eExpandUnchecked = i, t.appendChild(s), t.appendChild(i);
  }
  setColumn(e) {
    this.column = e;
    const { beans: t, eFilterToolPanelHeader: s, eFilterIcon: i, eExpandChecked: r, hideHeader: n } = this;
    this.eFilterName.innerText = t.colNames.getDisplayNameForColumn(e, "filterToolPanel", !1) || "", this.addManagedListeners(s, {
      click: this.toggleExpanded.bind(this),
      keydown: this.onKeyDown.bind(this)
    }), this.addManagedEventListeners({ filterOpened: this.onFilterOpened.bind(this) }), this.addInIcon("filterActive", i, e), O(i, this.isFilterActive(), { skipAriaHidden: !0 }), O(r, !1), n ? (O(s, !1), s.removeAttribute("tabindex")) : s.setAttribute("tabindex", "0"), this.addManagedListeners(e, { filterChanged: this.onFilterChanged.bind(this) });
  }
  onKeyDown(e) {
    const { key: t } = e, { ENTER: s, SPACE: i, LEFT: r, RIGHT: n } = S;
    t !== s && t !== i && t !== r && t !== n || (e.preventDefault(), t === s || t === i ? this.toggleExpanded() : t === S.LEFT ? this.collapse() : this.expand());
  }
  getColumn() {
    return this.column;
  }
  getColumnFilterName() {
    return this.beans.colNames.getDisplayNameForColumn(this.column, "filterToolPanel", !1);
  }
  addCssClassToTitleBar(e) {
    this.eFilterToolPanelHeader.classList.add(e);
  }
  addInIcon(e, t, s) {
    if (t == null)
      return;
    const i = N(e, this.beans, s);
    t.appendChild(i);
  }
  isFilterActive() {
    var e;
    return !!((e = this.beans.colFilter) != null && e.isFilterActive(this.column));
  }
  onFilterChanged() {
    O(this.eFilterIcon, this.isFilterActive(), { skipAriaHidden: !0 }), this.dispatchLocalEvent({ type: "filterChanged" });
  }
  toggleExpanded() {
    this.expanded ? this.collapse() : this.expand();
  }
  expand() {
    this.expanded || (this.expanded = !0, qe(this.eFilterToolPanelHeader, !0), O(this.eExpandChecked, !0), O(this.eExpandUnchecked, !1), this.addFilterElement(), this.expandedCallback());
  }
  addFilterElement(e) {
    var i;
    const t = K({ tag: "div", cls: "ag-filter-toolpanel-instance-filter" }), s = this.createManagedBean(new bn(this.column, "TOOLBAR"));
    this.filterComp = s, s.hasFilter() && ((i = s.getFilter()) == null || i.then((r) => {
      this.underlyingFilter = r, r && (t.appendChild(s.getGui()), this.agFilterToolPanelBody.appendChild(t), s.afterGuiAttached({ container: "toolPanel", suppressFocus: e }));
    }));
  }
  collapse() {
    if (!this.expanded)
      return;
    this.expanded = !1, qe(this.eFilterToolPanelHeader, !1), this.removeFilterElement(), O(this.eExpandChecked, !1), O(this.eExpandUnchecked, !0);
    const e = this.filterComp;
    e == null || e.afterGuiDetached(), this.destroyBean(e), this.expandedCallback();
  }
  removeFilterElement() {
    X(this.agFilterToolPanelBody);
  }
  isExpanded() {
    return this.expanded;
  }
  onPanelHidden() {
    var t;
    if (!this.expanded)
      return;
    const e = this.underlyingFilter;
    e && ((t = e.afterGuiDetached) == null || t.call(e));
  }
  onFilterOpened(e) {
    e.source === "COLUMN_MENU" && e.column === this.column && this.expanded && this.collapse();
  }
}, Ns = class extends D {
  constructor(e, t, s, i, r) {
    super(), this.columnGroup = e, this.childFilterComps = t, this.expandedCallback = s, this.depth = i, this.showingColumn = r, this.filterGroupComp = x;
  }
  postConstruct() {
    const e = {
      cssIdentifier: "filter-toolpanel",
      direction: "vertical"
    };
    this.setTemplate(
      {
        tag: "div",
        cls: "ag-filter-toolpanel-group-wrapper",
        children: [{ tag: "ag-group-component", ref: "filterGroupComp" }]
      },
      [ae],
      { filterGroupComp: e }
    ), this.setGroupTitle();
    const { filterGroupComp: t, depth: s, childFilterComps: i, gos: r } = this;
    t.setAlignItems("stretch"), t.addCss(`ag-filter-toolpanel-group-level-${s}`), t.getGui().style.setProperty("--ag-indentation-level", String(s)), t.addCssClassToTitleBar(`ag-filter-toolpanel-group-level-${s}-header`), i.forEach((o) => {
      t.addItem(o), o.addCssClassToTitleBar(`ag-filter-toolpanel-group-level-${s + 1}-header`), o.getGui().style.setProperty("--ag-indentation-level", String(s + 1));
    });
    const n = this.showingColumn ? this.columnGroup : void 0;
    this.tooltipFeature = this.createOptionalManagedBean(
      this.beans.registry.createDynamicBean("tooltipFeature", !1, {
        getGui: () => this.getGui(),
        getLocation: () => "filterToolPanelColumnGroup",
        shouldDisplayTooltip: Fa(
          r,
          () => t.getGui().querySelector(".ag-group-title")
        ),
        getAdditionalParams: () => ({
          colDef: n == null ? void 0 : n.getColDef(),
          column: n
        })
      })
    ), this.refreshFilterClass(), this.addExpandCollapseListeners(), this.addFilterChangedListeners(), this.setupTooltip(), this.addInIcon("filterActive");
  }
  setupTooltip() {
    if (!this.showingColumn)
      return;
    const e = () => {
      var t;
      (t = this.tooltipFeature) == null || t.setTooltipAndRefresh(this.columnGroup.getColDef().headerTooltip);
    };
    e(), this.addManagedEventListeners({ newColumnsLoaded: e });
  }
  addCssClassToTitleBar(e) {
    this.filterGroupComp.addCssClassToTitleBar(e);
  }
  onPanelHidden() {
    this.childFilterComps.forEach((e) => e.onPanelHidden());
  }
  isColumnGroup() {
    return oe(this.columnGroup);
  }
  isExpanded() {
    return this.filterGroupComp.isExpanded();
  }
  getChildren() {
    return this.childFilterComps;
  }
  getFilterGroupName() {
    return this.filterGroupName ?? "";
  }
  getFilterGroupId() {
    return this.columnGroup.getId();
  }
  hideGroupItem(e, t) {
    this.filterGroupComp.hideItem(e, t);
  }
  hideGroup(e) {
    this.setDisplayed(!e);
  }
  addInIcon(e) {
    const t = N(e, this.beans);
    t && t.classList.add("ag-filter-toolpanel-group-instance-header-icon"), this.filterGroupComp.addTitleBarWidget(t);
  }
  forEachToolPanelFilterChild(e) {
    this.childFilterComps.forEach((t) => {
      t instanceof lv && e(t);
    });
  }
  addExpandCollapseListeners() {
    const e = this.isColumnGroup() ? () => this.expandedCallback() : () => this.forEachToolPanelFilterChild((s) => s.expand()), t = this.isColumnGroup() ? () => this.expandedCallback() : () => this.forEachToolPanelFilterChild((s) => s.collapse());
    this.addManagedListeners(this.filterGroupComp, {
      expanded: e,
      collapsed: t
    });
  }
  getColumns() {
    return oe(this.columnGroup) ? this.columnGroup.getLeafColumns() : [this.columnGroup];
  }
  addFilterChangedListeners() {
    this.getColumns().forEach((e) => {
      this.addManagedListeners(e, { filterChanged: () => this.refreshFilterClass() });
    }), oe(this.columnGroup) || this.addManagedEventListeners({ filterOpened: this.onFilterOpened.bind(this) });
  }
  refreshFilterClass() {
    const e = this.getColumns(), t = () => e.some((s) => s.isFilterActive());
    this.filterGroupComp.toggleCss("ag-has-filter", t());
  }
  onFilterOpened(e) {
    e.source === "COLUMN_MENU" && e.column === this.columnGroup && this.isExpanded() && this.collapse();
  }
  expand() {
    this.filterGroupComp.toggleGroupExpand(!0);
  }
  collapse() {
    this.filterGroupComp.toggleGroupExpand(!1);
  }
  setGroupTitle() {
    const e = this.columnGroup, t = oe(e) ? this.getColumnGroupName(e) : this.getColumnName(e);
    this.filterGroupName = t, this.filterGroupComp.setTitle(t || "");
  }
  getColumnGroupName(e) {
    return this.beans.colNames.getDisplayNameForProvidedColumnGroup(null, e, "filterToolPanel");
  }
  getColumnName(e) {
    return this.beans.colNames.getDisplayNameForColumn(e, "filterToolPanel", !1);
  }
  destroyFilters() {
    this.childFilterComps = this.destroyBeans(this.childFilterComps), X(this.getGui());
  }
  destroy() {
    this.destroyFilters(), super.destroy();
  }
}, Sz = class extends D {
  constructor() {
    super({ tag: "div", cls: "ag-filter-list-panel" }), this.initialised = !1, this.hasLoadedInitialState = !1, this.isInitialState = !1, this.filterGroupComps = [], this.suppressOnColumnsChanged = !1, this.onColumnsChangedPending = !1;
  }
  wireBeans(e) {
    this.colModel = e.colModel;
  }
  init(e) {
    this.initialised = !0;
    const t = V(this.gos, {
      suppressExpandAll: !1,
      suppressFilterSearch: !1,
      suppressSyncLayoutWithGrid: !1
    });
    Fe(t, e), this.params = t, t.suppressSyncLayoutWithGrid || this.addManagedEventListeners({ columnMoved: () => this.onColumnsChanged() }), this.addManagedEventListeners({
      newColumnsLoaded: () => this.onColumnsChanged(),
      toolPanelVisibleChanged: (s) => {
        s.key === "filters" && !s.visible && this.onPanelHidden();
      },
      dragStarted: () => {
        this.suppressOnColumnsChanged = !0;
      },
      dragStopped: () => {
        this.suppressOnColumnsChanged = !1, this.onColumnsChangedPending && (this.onColumnsChangedPending = !1, this.onColumnsChanged());
      }
    }), this.colModel.ready && this.onColumnsChanged();
  }
  onColumnsChanged() {
    if (this.suppressOnColumnsChanged) {
      this.onColumnsChangedPending = !0;
      return;
    }
    const e = this.colModel.isPivotMode();
    !this.params.suppressSyncLayoutWithGrid && !e ? this.syncFilterLayout() : this.buildTreeFromProvidedColumnDefs(), this.refreshAriaLabel();
  }
  syncFilterLayout() {
    RC(this.colModel, this.setFiltersLayout.bind(this)), this.refreshAriaLabel();
  }
  buildTreeFromProvidedColumnDefs() {
    const e = this.colModel.getColDefColTree();
    this.recreateFilters(e);
  }
  setFiltersLayout(e) {
    const t = FC(this.colModel, e);
    this.recreateFilters(t);
  }
  recreateFilters(e) {
    const t = Q(this.beans);
    this.hasLoadedInitialState || (this.hasLoadedInitialState = !0, this.isInitialState = !!this.params.initialState);
    const s = this.getExpansionState();
    this.destroyFilters();
    const i = this.recursivelyAddComps(e, 0, s);
    this.filterGroupComps = i;
    const r = i.length;
    r && (i.forEach((o) => this.appendChild(o)), this.setFirstAndLastVisible(0, r - 1));
    const n = this.searchFilterText;
    A(n) && this.searchFilters(n), this.fireExpandedEvent(), this.getGui().contains(t) && t.focus(), this.isInitialState = !1, this.refreshAriaLabel();
  }
  recursivelyAddComps(e, t, s) {
    return e.map((i) => {
      var l;
      if (oe(i))
        return ((l = this.recursivelyAddFilterGroupComps(i, t, s)) == null ? void 0 : l.flatMap((c) => c)) ?? [];
      const r = i;
      if (!this.shouldDisplayFilter(r))
        return [];
      const n = t === 0, o = new lv(n, () => this.onFilterExpanded());
      if (this.createBean(o), o.setColumn(r), s.get(r.getId()) && o.expand(), t > 0)
        return o;
      const a = this.createBean(
        new Ns(r, [o], this.onGroupExpanded.bind(this), t, !0)
      );
      return a.addCssClassToTitleBar("ag-filter-toolpanel-header"), s.get(a.getFilterGroupId()) || a.collapse(), a;
    }).flatMap((i) => i);
  }
  refreshAriaLabel() {
    const e = this.getLocaleTextFunc(), t = e("ariaFilterPanelList", "Filter List"), s = e("filters", "Filters"), l = this.getGui().querySelectorAll(".ag-filter-toolpanel-group-item:not(.ag-filter-toolpanel-group-wrapper, .ag-hidden)").length;
    re(this.getAriaElement(), `${t} ${l} ${s}`);
  }
  recursivelyAddFilterGroupComps(e, t, s) {
    if (!this.filtersExistInChildren(e.getChildren()))
      return;
    const i = e.getColGroupDef();
    if (i && i.suppressFiltersToolPanel)
      return [];
    const r = e.isPadding() ? t : t + 1, n = this.recursivelyAddComps(e.getChildren(), r, s).flatMap(
      (l) => l
    );
    if (e.isPadding())
      return n;
    const o = new Ns(
      e,
      n,
      this.onGroupExpanded.bind(this),
      t,
      !1
    );
    this.createBean(o), o.addCssClassToTitleBar("ag-filter-toolpanel-header");
    const a = s.get(o.getFilterGroupId());
    return (this.isInitialState && !a || a === !1) && o.collapse(), [o];
  }
  filtersExistInChildren(e) {
    return e.some((t) => oe(t) ? this.filtersExistInChildren(t.getChildren()) : this.shouldDisplayFilter(t));
  }
  shouldDisplayFilter(e) {
    const t = e.getColDef() && e.getColDef().suppressFiltersToolPanel;
    return e.isFilterAllowed() && !t;
  }
  getExpansionState() {
    const e = /* @__PURE__ */ new Map();
    if (this.isInitialState) {
      const { expandedColIds: s, expandedGroupIds: i } = this.params.initialState;
      return s.forEach((r) => e.set(r, !0)), i.forEach((r) => e.set(r, !0)), e;
    }
    const t = (s) => {
      e.set(s.getFilterGroupId(), s.isExpanded()), s.getChildren().forEach((i) => {
        i instanceof Ns ? t(i) : e.set(i.getColumn().getId(), i.isExpanded());
      });
    };
    return this.filterGroupComps.forEach(t), e;
  }
  // we don't support refreshing, but must implement because it's on the tool panel interface
  refresh() {
  }
  // lazy initialise the panel
  setVisible(e) {
    super.setDisplayed(e), e && !this.initialised && this.init(this.params);
  }
  expandFilterGroups(e, t) {
    const s = [], i = (r) => {
      const n = r.getFilterGroupId();
      (!t || t.includes(n)) && (e && r.isColumnGroup() ? r.expand() : r.collapse(), s.push(n)), r.getChildren().forEach((a) => {
        a instanceof Ns && i(a);
      });
    };
    if (this.filterGroupComps.forEach(i), this.onGroupExpanded(), t) {
      const r = t.filter((n) => s.indexOf(n) < 0);
      r.length > 0 && F(166, { unrecognisedGroupIds: r });
    }
  }
  expandFilters(e, t) {
    const s = [], i = (r) => {
      if (r instanceof Ns) {
        let a = !1;
        return r.getChildren().forEach((l) => {
          i(l) && (e ? (r.expand(), a = !0) : r.isColumnGroup() || r.collapse());
        }), a;
      }
      const n = r.getColumn().getColId(), o = !t || t.includes(n);
      return o && (e ? r.expand() : r.collapse(), s.push(n)), o;
    };
    if (this.filterGroupComps.forEach(i), this.onGroupExpanded(), t) {
      const r = t.filter((n) => s.indexOf(n) < 0);
      r.length > 0 && F(167, { unrecognisedColIds: r });
    }
  }
  onGroupExpanded() {
    this.fireExpandedEvent();
  }
  onFilterExpanded() {
    this.dispatchLocalEvent({ type: "filterExpanded" });
  }
  fireExpandedEvent() {
    let e = 0, t = 0;
    const s = (r) => {
      r.isColumnGroup() && (r.isExpanded() ? e++ : t++, r.getChildren().forEach((n) => {
        n instanceof Ns && s(n);
      }));
    };
    this.filterGroupComps.forEach(s);
    let i;
    e > 0 && t > 0 ? i = 2 : t > 0 ? i = 1 : i = 0, this.dispatchLocalEvent({ type: "groupExpanded", state: i });
  }
  performFilterSearch(e) {
    this.searchFilterText = A(e) ? e.toLowerCase() : null, this.searchFilters(this.searchFilterText);
  }
  searchFilters(e) {
    const t = (n) => !A(e) || n.toLowerCase().indexOf(e) !== -1, s = (n, o) => {
      if (!(n instanceof Ns))
        return t(n.getColumnFilterName() || "");
      const a = n.getChildren(), l = t(n.getFilterGroupName()), c = o || l;
      if (c) {
        n.hideGroup(!1);
        for (let h = 0; h < a.length; h++)
          s(a[h], c), n.hideGroupItem(!1, h);
        return !0;
      }
      let d = !1;
      return a.forEach((h, u) => {
        const g = s(h, o);
        n.hideGroupItem(!g, u), g && (d = !0);
      }), n.hideGroup(!d), d;
    };
    let i, r;
    this.filterGroupComps.forEach((n, o) => {
      var l;
      s(n, !1);
      const a = (l = n.getGui()) == null ? void 0 : l.classList.contains("ag-hidden");
      i === void 0 ? a || (i = o, r = o) : !a && r !== o && (r = o);
    }), this.setFirstAndLastVisible(i, r), this.refreshAriaLabel();
  }
  setFirstAndLastVisible(e, t) {
    this.filterGroupComps.forEach((s, i) => {
      s.removeCss("ag-first-group-visible"), s.removeCss("ag-last-group-visible"), i === e && s.addCss("ag-first-group-visible"), i === t && s.addCss("ag-last-group-visible");
    });
  }
  onPanelHidden() {
    this.filterGroupComps.forEach((e) => e.onPanelHidden());
  }
  getExpandedFiltersAndGroups() {
    const e = [], t = /* @__PURE__ */ new Set(), s = (i) => {
      if (i instanceof Ns) {
        i.getChildren().forEach((n) => s(n));
        const r = i.getFilterGroupId();
        i.isExpanded() && !t.has(r) && e.push(r);
      } else
        i.isExpanded() && t.add(i.getColumn().getColId());
    };
    return this.filterGroupComps.forEach(s), { expandedGroupIds: e, expandedColIds: Array.from(t) };
  }
  destroyFilters() {
    this.filterGroupComps = this.destroyBeans(this.filterGroupComps), X(this.getGui());
  }
  destroy() {
    this.destroyFilters(), super.destroy();
  }
}, xz = {
  selector: "AG-FILTERS-TOOL-PANEL-LIST",
  component: Sz
}, Fz = (
  /*css*/
  ".ag-filter-toolpanel{flex:1 1 0px;min-width:0}.ag-filter-toolpanel-header,.ag-filter-toolpanel-search{align-items:center;color:var(--ag-header-text-color);display:flex;font-weight:var(--ag-header-font-weight);padding:0 var(--ag-spacing);>*{align-items:center;display:flex}}.ag-filter-toolpanel-header{padding-bottom:var(--ag-spacing);padding-top:var(--ag-spacing);position:relative;&:focus-visible{border-radius:var(--ag-border-radius);box-shadow:inset var(--ag-focus-shadow)}}:where(.ag-ltr) .ag-filter-toolpanel-group-instance-header-icon,:where(.ag-ltr) .ag-filter-toolpanel-instance-header-icon{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-toolpanel-group-instance-header-icon,:where(.ag-rtl) .ag-filter-toolpanel-instance-header-icon{margin-right:var(--ag-spacing)}.ag-filter-toolpanel-search{min-height:var(--ag-header-height);padding-bottom:var(--ag-spacing);padding-top:var(--ag-widget-container-vertical-padding)}:where(.ag-filter-toolpanel-group:not(.ag-has-filter)>.ag-group-title-bar) .ag-filter-toolpanel-group-instance-header-icon{display:none}.ag-filter-toolpanel-search-input{flex-grow:1;height:calc(var(--ag-spacing)*4)}:where(.ag-ltr) .ag-filter-toolpanel-group-title-bar-icon{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-toolpanel-group-title-bar-icon{margin-left:var(--ag-spacing)}.ag-filter-toolpanel-expand{cursor:pointer}:where(.ag-ltr) .ag-filter-toolpanel-expand{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-toolpanel-expand{margin-left:var(--ag-spacing)}:where(.ag-ltr) .ag-filter-toolpanel-group-title-bar,:where(.ag-ltr) .ag-filter-toolpanel-instance-header{padding-left:calc(var(--ag-spacing) + var(--ag-filter-tool-panel-group-indent)*var(--ag-indentation-level))}:where(.ag-rtl) .ag-filter-toolpanel-group-title-bar,:where(.ag-rtl) .ag-filter-toolpanel-instance-header{padding-right:calc(var(--ag-spacing) + var(--ag-filter-tool-panel-group-indent)*var(--ag-indentation-level))}:where(.ag-ltr) .ag-filter-toolpanel-instance-body{margin-left:var(--ag-filter-tool-panel-group-indent)}:where(.ag-rtl) .ag-filter-toolpanel-instance-body{margin-right:var(--ag-filter-tool-panel-group-indent)}.ag-filter-toolpanel-instance-filter{background-color:var(--ag-chrome-background-color)}.ag-filter-toolpanel-group-level-0{border-top:none}"
), Rz = {
  tag: "div",
  cls: "ag-filter-toolpanel",
  children: [
    { tag: "ag-filters-tool-panel-header", ref: "filtersToolPanelHeaderPanel" },
    { tag: "ag-filters-tool-panel-list", ref: "filtersToolPanelListPanel" }
  ]
}, Pz = class extends D {
  constructor() {
    super(Rz, [bz, xz]), this.filtersToolPanelHeaderPanel = x, this.filtersToolPanelListPanel = x, this.initialised = !1, this.listenerDestroyFuncs = [], this.registerCSS(Fz);
  }
  init(e) {
    this.initialised && (this.listenerDestroyFuncs.forEach((a) => a()), this.listenerDestroyFuncs = []), this.initialised = !0;
    const s = {
      ...{
        suppressExpandAll: !1,
        suppressFilterSearch: !1,
        suppressSyncLayoutWithGrid: !1
      },
      ...e
    };
    this.params = s;
    const { filtersToolPanelHeaderPanel: i, filtersToolPanelListPanel: r } = this;
    i.init(s), r.init(s);
    const { suppressExpandAll: n, suppressFilterSearch: o } = s;
    n && o && i.setDisplayed(!1), this.listenerDestroyFuncs.push(
      ...this.addManagedListeners(i, {
        expandAll: () => r.expandFilterGroups(!0),
        collapseAll: () => r.expandFilterGroups(!1),
        searchChanged: (a) => r.performFilterSearch(a.searchText)
      }),
      ...this.addManagedListeners(r, {
        filterExpanded: s.onStateUpdated,
        groupExpanded: (a) => {
          i.setExpandState(a.state), s.onStateUpdated();
        }
      })
    );
  }
  // lazy initialise the panel
  setVisible(e) {
    super.setDisplayed(e), e && !this.initialised && this.init(this.params);
  }
  setFilterLayout(e) {
    this.filtersToolPanelListPanel.setFiltersLayout(e);
  }
  expandFilterGroups(e) {
    this.filtersToolPanelListPanel.expandFilterGroups(!0, e);
  }
  collapseFilterGroups(e) {
    this.filtersToolPanelListPanel.expandFilterGroups(!1, e);
  }
  expandFilters(e) {
    this.filtersToolPanelListPanel.expandFilters(!0, e);
  }
  collapseFilters(e) {
    this.filtersToolPanelListPanel.expandFilters(!1, e);
  }
  syncLayoutWithGrid() {
    this.filtersToolPanelListPanel.syncFilterLayout();
  }
  refresh(e) {
    return this.init(e), !0;
  }
  getState() {
    return this.filtersToolPanelListPanel.getExpandedFiltersAndGroups();
  }
}, Ez = class extends R {
  constructor() {
    super(...arguments), this.beanName = "filterPanelSvc", this.states = /* @__PURE__ */ new Map(), this.orderedStates = [], this.initialStateApplied = !1, this.isActive = !1;
  }
  postConstruct() {
    if (!this.gos.get("enableFilterHandlers"))
      return;
    const e = this.updateFilterStates.bind(this), t = () => this.dispatchStatesUpdates(void 0, !0);
    this.addManagedEventListeners({
      newColumnsLoaded: () => {
        this.applyInitialState(), e();
      },
      filterChanged: e,
      filterDestroyed: this.onFilterDestroyed.bind(this),
      filterOpened: t,
      filterClosed: t
    }), this.addManagedListeners(this.beans.colFilter, {
      filterStateChanged: ({ column: s }) => {
        var i, r;
        (r = (i = this.states.get(s.getColId())) == null ? void 0 : i.refresh) == null || r.call(i), t();
      }
    });
  }
  getIds() {
    return Array.from(this.states.keys());
  }
  getAvailable() {
    const e = this.beans, t = [];
    for (const s of e.colModel.getCols()) {
      const i = s.getColId();
      s.isFilterAllowed() && !s.colDef.suppressFiltersToolPanel && !this.states.get(i) && t.push({
        id: i,
        name: Zu(e, s)
      });
    }
    return t;
  }
  add(e) {
    this.createFilter(e, !0), this.dispatchStatesUpdates(e);
  }
  remove(e) {
    var c;
    const {
      states: t,
      orderedStates: s,
      beans: { colFilter: i, selectableFilter: r }
    } = this, n = t.get(e);
    if (!n)
      return;
    (c = n.destroy) == null || c.call(n);
    const o = n.state.column;
    t.delete(e), r == null || r.clearActive(e), i == null || i.destroyFilter(o), this.eventSvc.dispatchEvent({
      type: "filterSwitched",
      column: o
    });
    const a = s.indexOf(e);
    s.splice(a, 1);
    const l = s[a];
    this.dispatchStatesUpdates(l);
  }
  getState(e) {
    var t;
    return (t = this.states.get(e)) == null ? void 0 : t.state;
  }
  updateFilterState(e, t, s, i) {
    const r = this.getState(e);
    r && (r[t] = s, i || this.dispatchLocalEvent({
      type: "filterPanelStateChanged",
      id: e,
      state: r
    }));
  }
  expand(e, t) {
    var o;
    const s = this.states.get(e);
    if (!s)
      return;
    (o = s.destroy) == null || o.call(s);
    const {
      handler: i,
      state: { column: r }
    } = s, n = this.createFilterState(r, i, t);
    this.states.set(e, n), this.dispatchLocalEvent({
      type: "filterPanelStateChanged",
      id: e,
      state: n.state
    });
  }
  updateType(e, t) {
    const s = this.states.get(e);
    if (!s)
      return;
    const i = s.state;
    if (i.expanded === !1)
      return;
    const r = i.filterDefs;
    if (!r)
      return;
    const { colFilter: n, selectableFilter: o } = this.beans;
    o == null || o.setActive(e, r, t), n.filterParamsChanged(e, "columnFilter");
    const a = i.column;
    this.eventSvc.dispatchEvent({
      type: "filterSwitched",
      column: a
    });
    const l = this.states.get(e);
    if (!l)
      return;
    const c = l.state;
    this.dispatchLocalEvent({
      type: "filterPanelStateChanged",
      id: e,
      state: c
    });
  }
  getActions() {
    var s, i;
    const e = (s = this.params) == null ? void 0 : s.buttons;
    if (!(e != null && e.length))
      return;
    const t = !!((i = this.beans.colFilter) != null && i.canApplyAll());
    return { actions: e, canApply: t };
  }
  doAction(e) {
    var t;
    (t = this.beans.colFilter) == null || t.updateAllModels(e);
  }
  updateParams(e, t) {
    var s, i;
    this.params = e, t && (this.initialState = t), this.dispatchStatesUpdates(), (i = this.beans.colFilter) == null || i.setGlobalButtons(!!((s = e.buttons) != null && s.length));
  }
  getGridState() {
    const e = [];
    return this.states.forEach((t, s) => {
      e.push({
        colId: s,
        expanded: t.state.expanded
      });
    }), {
      filters: e
    };
  }
  createFilter(e, t) {
    const s = this.createFilterStateWrapper(e, t);
    s && (this.states.set(e, s), this.orderedStates.push(e));
  }
  createFilterStateWrapper(e, t) {
    const { colModel: s, colFilter: i } = this.beans, r = s.getColById(e);
    if (r && !r.colDef.suppressFiltersToolPanel) {
      const n = i.getHandler(r, !0);
      if (n)
        return this.createFilterState(r, n, t);
    }
  }
  updateFilterStates() {
    var s;
    const e = this.beans.colFilter.getModel(), t = /* @__PURE__ */ new Set();
    for (const i of Object.keys(e)) {
      const r = this.states.get(i);
      r ? (s = r.refresh) == null || s.call(r) : this.createFilter(i), t.add(i);
    }
    this.states.forEach((i, r) => {
      var n;
      t.has(r) || (n = i.refresh) == null || n.call(i);
    }), this.dispatchStatesUpdates();
  }
  createFilterState(e, t, s) {
    const i = this.beans, { colFilter: r, selectableFilter: n } = i, o = Zu(i, e), a = e.getColId(), l = () => {
      var d;
      return !!((d = this.params) != null && d.buttons) && r.hasUnappliedModel(a);
    }, c = l();
    if (s) {
      const d = e.colDef, { filterDefs: h, activeFilterDef: u } = (n == null ? void 0 : n.getDefs(e, d)) ?? {}, g = this.createBean(new bn(e, "TOOLBAR", !0));
      return {
        state: {
          column: e,
          name: o,
          isEditing: c,
          expanded: s,
          detail: g.getGui(),
          activeFilterDef: u,
          filterDefs: h,
          afterGuiAttached: g.afterGuiAttached.bind(g),
          afterGuiDetached: g.afterGuiDetached.bind(g)
        },
        handler: t,
        refresh: () => {
          this.updateFilterState(a, "isEditing", l());
        },
        destroy: () => this.destroyBean(g)
      };
    } else {
      const d = e.getColId(), h = () => {
        var u;
        return ((u = t.getModelAsString) == null ? void 0 : u.call(t, r.getStateForColumn(d).model, "filterToolPanel")) ?? "";
      };
      return {
        state: {
          column: e,
          name: o,
          isEditing: c,
          expanded: !1,
          summary: h()
        },
        handler: t,
        refresh: () => {
          this.updateFilterState(d, "isEditing", l(), !0), this.updateFilterState(d, "summary", h());
        }
      };
    }
  }
  onFilterDestroyed({ column: e, source: t }) {
    var n, o;
    if (!((n = this.beans.colFilter) != null && n.isAlive()))
      return;
    const s = this.states, i = e.getColId(), r = s.get(i);
    if (r) {
      const a = this.createFilterStateWrapper(i, r.state.expanded);
      a ? ((o = r.destroy) == null || o.call(r), s.set(i, a)) : this.remove(i), t === "api" && this.dispatchStatesUpdates();
    }
  }
  dispatchStatesUpdates(e, t) {
    this.dispatchLocalEvent({
      type: "filterPanelStatesChanged",
      activeId: e,
      action: t
    });
  }
  applyInitialState() {
    var e, t;
    this.initialStateApplied || (this.initialStateApplied = !0, (t = (e = this.initialState) == null ? void 0 : e.filters) == null || t.forEach(({ colId: s, expanded: i }) => this.createFilter(s, i)), this.initialState = void 0);
  }
  destroy() {
    const { states: e, orderedStates: t } = this;
    e.forEach((s) => {
      var i;
      return (i = s.destroy) == null ? void 0 : i.call(s);
    }), e.clear(), t.length = 0, this.params = void 0, this.initialState = void 0, super.destroy();
  }
};
function Zu(e, t) {
  return e.colNames.getDisplayNameForColumn(t, "filterToolPanel") ?? t.getColId();
}
var Tz = {
  addFilterCard: "Add Filter",
  ariaLabelAddFilterField: "Add Filter Field",
  ariaLabelFilterCardDelete: "Delete Filter",
  ariaLabelFilterCardHasEdits: "Has Edits",
  agTextColumnFilterDisplayName: "Simple Filter",
  agNumberColumnFilterDisplayName: "Simple Filter",
  agDateColumnFilterDisplayName: "Simple Filter",
  agSetColumnFilterDisplayName: "Selection Filter",
  agMultiColumnFilterDisplayName: "Combo Filter",
  addFilterPlaceholder: "Search columns..."
};
function dr(e, t) {
  return Nc(e, Tz, t);
}
function Mz(e, t, s) {
  let i = 0;
  for (let r = 0; r < s.length; r++) {
    const n = s[r];
    n === t[i] ? i++ : se(n);
  }
  for (; i < t.length; )
    e.appendChild(t[i++]);
}
var Dz = class extends R {
  constructor() {
    super(...arguments), this.beanName = "selectableFilter", this.selectedFilters = /* @__PURE__ */ new Map(), this.valueGetters = /* @__PURE__ */ new Map();
  }
  getFilterValueGetter(e) {
    return this.valueGetters.get(e);
  }
  isSelectable(e) {
    return e.filter === "agSelectableColumnFilter";
  }
  getFilterDef(e, t) {
    return this.getDefs(e, t).activeFilterDef;
  }
  getDefs(e, t) {
    if (!this.isSelectable(t))
      return;
    const s = this.beans, { gos: i, dataTypeSvc: r, colFilter: n } = s;
    let o = t.filterParams;
    const a = e.colDef;
    typeof o == "function" && (o = o(
      V(i, {
        column: e,
        colDef: a
      })
    ));
    const l = r == null ? void 0 : r.getBaseDataType(e), c = r == null ? void 0 : r.getDataTypeDefinition(e), d = r == null ? void 0 : r.getFormatValue(l), { filters: h, defaultFilterParams: u, defaultFilterIndex: g } = o ?? {}, p = (v) => {
      var G;
      const { filter: w, filterParams: b, name: y, filterValueGetter: P = a.filterValueGetter } = v, E = u ? { ...u, ...b } : b;
      let M;
      c && d && (w === "agMultiColumnFilter" ? M = (G = s.multiFilter) == null ? void 0 : G.getParamsForDataType(
        E,
        P,
        c,
        d
      ) : M = dd(
        w,
        E,
        P,
        c,
        d,
        s,
        this.getLocaleTextFunc()
      ));
      let T;
      if (!y) {
        let I = w;
        typeof w == "boolean" && (I = n == null ? void 0 : n.getDefaultFilterFromDataType(() => l)), typeof I == "string" ? T = dr(this, `${I}DisplayName`) : (F(280, { colId: e.getColId() }), T = "");
      }
      return u || M || T ? {
        ...v,
        filterParams: E,
        name: T ?? y,
        ...M
      } : v;
    }, f = (h ?? this.getDefaultFilters(e)).map(p);
    let m = this.selectedFilters.get(e.getColId()) ?? // UI selected value
    g ?? // col def value
    (!h && rp(i) ? 1 : 0);
    m >= f.length && (m = 0);
    const C = f[m];
    return { filterDefs: f, activeFilterDef: C };
  }
  setActive(e, t, s) {
    const i = t.indexOf(s);
    if (i < 0)
      return;
    const { selectedFilters: r, valueGetters: n } = this;
    r.set(e, i);
    const o = s.filterValueGetter;
    o ? n.set(e, o) : n.delete(e);
  }
  clearActive(e) {
    const { selectedFilters: t, valueGetters: s } = this;
    t.delete(e), s.delete(e);
  }
  destroy() {
    const { selectedFilters: e, valueGetters: t } = this;
    e.clear(), t.clear(), super.destroy();
  }
  getDefaultFilters(e) {
    const t = this.beans, { gos: s, dataTypeSvc: i } = t, r = s.isModuleRegistered("MultiFilter"), n = i == null ? void 0 : i.getBaseDataType(e);
    return [
      { filter: hd(n, !1) },
      { filter: "agSetColumnFilter" },
      ...r ? [
        {
          filter: "agMultiColumnFilter"
        }
      ] : []
    ];
  }
}, Az = {
  tag: "div",
  cls: "ag-filter-card ag-filter-card-add"
}, Iz = class extends D {
  constructor(e) {
    super(Az), this.options = /* @__PURE__ */ new Map(), this.setOptions(e);
  }
  postConstruct() {
    this.showButton();
  }
  refresh(e) {
    this.setOptions(e);
    const { eSelect: t, options: s } = this;
    t && t.setValueList({ valueList: Array.from(s.keys()), refresh: !0 });
  }
  showButton() {
    X(this.getGui()), this.destroySelect();
    const e = K({
      tag: "button",
      cls: "ag-button ag-standard-button ag-filter-add-button",
      children: [
        { tag: "span", children: [() => N("filterAdd", this.beans)] },
        {
          tag: "span",
          cls: "ag-filter-add-button-label",
          children: dr(this, "addFilterCard")
        }
      ]
    });
    this.activateTabIndex([e]);
    const t = this.showSelect.bind(this);
    e.addEventListener("click", t), this.removeButton = () => {
      e.removeEventListener("click", t);
    }, this.appendChild(e), e.focus();
  }
  showSelect() {
    X(this.getGui()), this.destroyButton();
    const e = "ariaLabelAddFilterField", t = {
      className: "ag-filter-add-select",
      pickerType: "virtual-list",
      pickerAriaLabelKey: e,
      pickerAriaLabelValue: dr(this, e),
      placeholder: dr(this, "addFilterPlaceholder"),
      value: "",
      valueList: Array.from(this.options.keys()),
      searchType: "matchAny",
      allowTyping: !0,
      filterList: !0,
      highlightMatch: !0,
      valueFormatter: (i) => this.options.get(i)
    }, s = this.createManagedBean(new Ma(t));
    this.eSelect = s, this.appendChild(s.getGui()), s.showPicker(), s.getFocusableElement().focus(), s.addManagedListeners(s, {
      fieldPickerValueSelected: ({ value: i }) => this.dispatchLocalEvent({
        type: "filterSelected",
        id: i
      }),
      pickerHidden: () => {
        this.showButton();
      }
    });
  }
  setOptions(e) {
    const t = this.options;
    t.clear();
    for (const { id: s, name: i } of e)
      t.set(s, i);
  }
  destroySelect() {
    this.eSelect = this.destroyBean(this.eSelect);
  }
  destroyButton() {
    var e;
    this.removeButton = (e = this.removeButton) == null ? void 0 : e.call(this);
  }
  destroy() {
    this.destroySelect(), this.destroyButton(), super.destroy();
  }
}, Lz = {
  tag: "div",
  cls: "ag-filter-card-body",
  children: [{ tag: "ag-select", cls: "ag-filter-type-select", ref: "eFilterType" }]
}, kz = class extends D {
  constructor() {
    super(...arguments), this.eFilterType = x;
  }
  postConstruct() {
    const e = {
      onValueChange: (t) => this.dispatchLocalEvent({ type: "filterTypeChanged", filterDef: t })
    };
    this.setTemplate(Lz, [Ni], { eFilterType: e }), this.eFilterType.setDisplayed(!1);
  }
  refresh(e) {
    const t = this.state;
    this.state = e;
    const {
      activeFilterDef: s,
      filterDefs: i,
      detail: r,
      afterGuiAttached: n,
      afterGuiDetached: o
    } = e, { activeFilterDef: a, filterDefs: l, detail: c } = t ?? {}, d = this.eFilterType;
    if (i !== l) {
      d.clearOptions();
      const h = i == null ? void 0 : i.map((u) => ({ value: u, text: u.name }));
      h && d.clearOptions().addOptions(h).setValue(s, !0), d.setDisplayed(!!h);
    } else s !== a && d.setValue(s, !0);
    r !== c && (c && (se(c), o()), this.appendChild(r), n({
      container: "newFiltersToolPanel",
      suppressFocus: !0
    }));
  }
}, Gz = {
  tag: "div",
  cls: "ag-filter-card-summary",
  attrs: {
    "aria-hidden": "true"
  }
}, Oz = class extends D {
  constructor() {
    super(Gz);
  }
  refresh(e) {
    this.getGui().textContent = e.summary;
  }
}, Vz = {
  tag: "div",
  cls: "ag-filter-card",
  children: [
    {
      tag: "div",
      cls: "ag-filter-card-header",
      role: "presentation",
      children: [
        {
          tag: "div",
          cls: "ag-filter-card-heading",
          role: "heading",
          attrs: {
            "aria-level": "2"
          },
          children: [
            {
              tag: "button",
              ref: "eExpand",
              cls: "ag-button ag-filter-card-expand",
              children: [
                { tag: "span", ref: "eTitle", cls: "ag-filter-card-title" },
                { tag: "span", ref: "eEditing", cls: "ag-filter-card-editing-icon" },
                { tag: "span", ref: "eExpandIcon", cls: "ag-filter-card-expand-icon" }
              ]
            }
          ]
        },
        {
          tag: "button",
          ref: "eDelete",
          cls: "ag-button ag-filter-card-delete",
          children: [{ tag: "span", ref: "eDeleteIcon", cls: "ag-filter-card-delete-icon" }]
        }
      ]
    }
  ]
}, Bz = class extends D {
  constructor(e) {
    super(Vz), this.id = e, this.eTitle = x, this.eExpand = x, this.eDelete = x, this.eExpandIcon = x, this.eDeleteIcon = x, this.eEditing = x;
  }
  postConstruct() {
    const { beans: e, eDelete: t, eExpand: s, eDeleteIcon: i, eEditing: r, id: n } = this, o = e.filterPanelSvc;
    re(t, dr(this, "ariaLabelFilterCardDelete")), i.appendChild(Bt("close", e, null)), this.activateTabIndex([s, t]), this.addManagedElementListeners(s, {
      click: () => {
        var a;
        return o.expand(n, !((a = this.state) != null && a.expanded));
      }
    }), this.addManagedElementListeners(t, {
      click: () => o.remove(n)
    }), this.addManagedEventListeners({ filterOpened: this.onFilterOpened.bind(this) }), r.appendChild(Bt("filterCardEditing", e, null));
  }
  refresh(e) {
    const { eExpand: t, eEditing: s, state: i, beans: r } = this;
    this.state = e;
    const { name: n, expanded: o, isEditing: a } = e;
    this.eTitle.textContent = n, O(s, a), (!i || o !== i.expanded) && this.toggleExpand(e);
    let l = o ? null : `${n} ${e.summary}`;
    a && (l = `${l ?? n}. ${dr(this, "ariaLabelFilterCardHasEdits")}`), re(t, l);
    const c = (h) => {
      if (h)
        return se(h.getGui()), this.destroyBean(h);
    }, d = (h, u, g) => (h || (h = this.createBean(new u()), g == null || g(h), this.appendChild(h.getGui())), h.refresh(e), h);
    if (e.expanded) {
      this.summaryComp = c(this.summaryComp);
      const h = d(
        this.detailComp,
        kz,
        (g) => g.addManagedListeners(g, {
          filterTypeChanged: ({ filterDef: p }) => r.filterPanelSvc.updateType(this.id, p)
        })
      );
      this.detailComp = h;
      const u = `ag-${this.getCompId()}-filter`;
      h.getGui().id = u, Ol(t, u);
    } else
      this.detailComp = c(this.detailComp), this.summaryComp = d(this.summaryComp, Oz), Ol(t, null);
  }
  toggleExpand(e) {
    const t = !!e.expanded, { eExpandIcon: s, eExpand: i, beans: r } = this;
    X(s), s.appendChild(Bt(t ? "filterCardCollapse" : "filterCardExpand", r, null)), qe(i, t);
  }
  onFilterOpened(e) {
    const { state: t, beans: s, id: i } = this;
    e.source === "COLUMN_MENU" && e.column === (t == null ? void 0 : t.column) && (t != null && t.expanded) && s.filterPanelSvc.expand(i, !1);
  }
  destroy() {
    this.detailComp = this.destroyBean(this.detailComp), this.summaryComp = this.destroyBean(this.summaryComp), this.state = void 0, super.destroy();
  }
};
function Nz(e) {
  return !!(e != null && e.id);
}
function Hz(e) {
  return !!(e != null && e.action);
}
var zz = {
  tag: "div",
  cls: "ag-filter-panel",
  children: [{ tag: "div", cls: "ag-filter-panel-container", ref: "eContainer" }]
}, Wz = class extends D {
  constructor() {
    super(zz), this.eContainer = x, this.filters = /* @__PURE__ */ new Map();
  }
  refresh(e) {
    var C, v;
    if (Hz(e)) {
      this.refreshActions();
      return;
    }
    if (Nz(e)) {
      (C = this.filters.get(e.id)) == null || C.refresh(e.state);
      return;
    }
    const { eContainer: t, filters: s, beans: i } = this, r = i.filterPanelSvc, n = r.getIds(), o = /* @__PURE__ */ new Map(), a = !Jt(i), l = a ? Q(i) : void 0, c = a && t.contains(l), d = [], h = [];
    for (const w of n) {
      const b = s.get(w) ?? this.createBean(new Bz(w));
      b.refresh(r.getState(w)), o.set(w, b), h.push(b.getGui());
    }
    this.filters = o;
    const u = [];
    s.forEach((w, b) => {
      d.push(w.getGui()), o.has(b) || u.push(w);
    });
    let g = this.addFilterComp;
    g && d.push(g.getGui());
    const p = r.getAvailable();
    p.length ? (g || (g = this.createBean(new Iz(p)), g.addManagedListeners(g, {
      filterSelected: ({ id: w }) => r.add(w)
    })), g.refresh(p), h.push(g.getGui())) : g = this.destroyBean(g), this.addFilterComp = g, Mz(t, h, d), u.forEach((w) => this.destroyBean(w));
    const f = e == null ? void 0 : e.activeId, m = f && ((v = o.get(f)) == null ? void 0 : v.getGui());
    m ? ye(m) : c && Jt(i) && ye(h[h.length - 1] ?? t), this.refreshActions();
  }
  refreshActions() {
    const e = this.beans.filterPanelSvc, { actions: t, canApply: s } = e.getActions() ?? {};
    let i = this.buttonComp;
    if (t != null && t.length) {
      const r = t.map((n) => ({
        type: n,
        label: vs(this, `${n}Filter`)
      }));
      if (!i) {
        i = this.createBean(new Ca({ className: "ag-filter-panel-buttons" })), this.getGui().appendChild(i.getGui());
        const n = {};
        ["apply", "clear", "reset", "cancel"].forEach((o) => {
          n[o] = () => e.doAction(o);
        }), i.addManagedListeners(i, n);
      }
      i.updateButtons(r), i.updateValidity(s !== !1);
    } else
      i && (se(i.getGui()), i = this.destroyBean(i));
    this.buttonComp = i;
  }
  destroy() {
    this.addFilterComp = this.destroyBean(this.addFilterComp), this.buttonComp = this.destroyBean(this.buttonComp);
    const e = this.filters;
    e.forEach((t) => this.destroyBean(t)), e.clear(), super.destroy();
  }
}, _z = (
  /*css*/
  ".ag-filter-panel{display:flex;flex-direction:column;width:100%;:where(.ag-standard-button){transition:background-color .25s ease-in-out,color .25s ease-in-out}}.ag-filter-panel .ag-simple-filter-body-wrapper{padding:var(--ag-widget-vertical-spacing) var(--ag-widget-container-horizontal-padding) 0}.ag-filter-panel .ag-mini-filter{margin-left:var(--ag-widget-container-horizontal-padding);margin-right:var(--ag-widget-container-horizontal-padding);margin-top:var(--ag-widget-vertical-spacing)}.ag-filter-panel-container{flex:1;overflow:auto;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding) 0}.ag-filter-panel-container>:where(:not(:last-child)){margin-bottom:var(--ag-widget-container-vertical-padding)}.ag-filter-card{background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:var(--ag-border-radius)}.ag-filter-card-header{align-items:center;display:flex;flex-direction:row;padding-top:var(--ag-widget-vertical-spacing)}:where(.ag-ltr) .ag-filter-card-header{&>:where(:not(:last-child)){padding-right:var(--ag-spacing)}}:where(.ag-rtl) .ag-filter-card-header{&>:where(:not(:last-child)){padding-left:var(--ag-spacing)}}.ag-filter-card-heading{flex:1;overflow:hidden;padding-bottom:calc(var(--ag-widget-container-vertical-padding) - var(--ag-widget-vertical-spacing));padding-top:calc(var(--ag-widget-container-vertical-padding) - var(--ag-widget-vertical-spacing))}:where(.ag-ltr) .ag-filter-card-heading{padding-left:var(--ag-widget-horizontal-spacing)}:where(.ag-rtl) .ag-filter-card-heading{padding-right:var(--ag-widget-horizontal-spacing)}.ag-filter-card-expand{align-items:center;display:flex;flex-direction:row;width:100%}.ag-filter-card-title{font-weight:var(--ag-header-font-weight);overflow:hidden;text-overflow:ellipsis}.ag-filter-card-expand-icon{display:flex;flex:1;justify-content:end}.ag-filter-card-editing-icon{margin:0 var(--ag-spacing)}.ag-filter-card-delete-icon,.ag-filter-card-editing-icon,.ag-filter-card-expand-icon,.ag-filter-card-summary{color:var(--ag-filter-panel-card-subtle-color)}.ag-filter-card-delete-icon,.ag-filter-card-expand-icon{transition:color .25s ease-in-out}.ag-filter-card-delete-icon:hover,.ag-filter-card-expand-icon:hover,.ag-filter-card-heading:hover .ag-filter-card-expand-icon{color:var(--ag-filter-panel-card-subtle-hover-color)}.ag-filter-add-button,.ag-filter-card-delete,.ag-filter-card-expand{border-radius:var(--ag-button-border-radius)}.ag-filter-card-summary,.ag-filter-type-select{margin-left:var(--ag-widget-container-horizontal-padding);margin-right:var(--ag-widget-container-horizontal-padding)}:where(.ag-ltr) .ag-filter-card-delete{margin-right:var(--ag-widget-horizontal-spacing)}:where(.ag-rtl) .ag-filter-card-delete{margin-left:var(--ag-widget-horizontal-spacing)}.ag-filter-card-summary{margin-bottom:var(--ag-widget-container-vertical-padding)}.ag-filter-type-select{padding-top:var(--ag-widget-vertical-spacing)}.ag-filter-card-add{border:0;padding:0}.ag-filter-add-button{align-items:center;display:flex;flex-direction:row;line-height:1.5;width:100%}:where(.ag-ltr) .ag-filter-add-button-label{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-add-button-label{margin-right:var(--ag-spacing)}.ag-filter-add-select{border:0;.ag-rich-select-value{border:0;padding:calc(((1.5*var(--ag-font-size) + 2*var(--ag-button-vertical-padding)) - var(--ag-input-height))/2) var(--ag-spacing)}}:where(.ag-ltr) .ag-filter-add-select{.ag-text-field-input{padding-left:calc(var(--ag-spacing)*1.5 + 12px)!important}}:where(.ag-rtl) .ag-filter-add-select{.ag-text-field-input{padding-right:calc(var(--ag-spacing)*1.5 + 12px)!important}}.ag-filter-panel-buttons{display:flex;flex-wrap:wrap;gap:var(--ag-widget-vertical-spacing) var(--ag-widget-horizontal-spacing);justify-content:flex-end;overflow:hidden;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding) 0}.ag-filter-panel-buttons-button{line-height:1.5}.ag-filter-panel .ag-filter-panel-buttons-apply-button{background-color:var(--ag-filter-panel-apply-button-background-color);color:var(--ag-filter-panel-apply-button-color)}.ag-filter-panel>:where(:last-child){padding-bottom:var(--ag-widget-container-vertical-padding)}.ag-filter-panel .ag-set-filter-body-wrapper,.ag-filter-panel .ag-simple-filter-body-wrapper>:last-child{margin-bottom:var(--ag-widget-container-vertical-padding)}"
), Uz = class extends D {
  constructor() {
    super(), this.registerCSS(_z);
  }
  init(e) {
    if (!this.gos.get("enableFilterHandlers")) {
      F(282);
      return;
    }
    const t = this.beans.filterPanelSvc;
    t.isActive = !0, this.addDestroyFunc(() => {
      t.isActive = !1;
    }), this.updateParams(e, e.initialState);
    const s = this.createManagedBean(new Wz());
    this.filterPanel = s;
    const i = (r) => {
      s.refresh(r), e.onStateUpdated();
    };
    i(), this.addManagedListeners(t, {
      filterPanelStatesChanged: i,
      filterPanelStateChanged: i
    });
  }
  getGui() {
    var e;
    return (e = this.filterPanel) == null ? void 0 : e.getGui();
  }
  refresh(e) {
    return this.updateParams(e), !0;
  }
  updateParams(e, t) {
    var s;
    (s = this.beans.filterPanelSvc) == null || s.updateParams(e, t);
  }
  getState() {
    var e;
    return ((e = this.beans.filterPanelSvc) == null ? void 0 : e.getGridState()) ?? {};
  }
}, $z = {
  moduleName: "FiltersToolPanel",
  version: Y,
  userComponents: { agFiltersToolPanel: Pz },
  icons: {
    // filter tool panel tab
    filtersToolPanel: "filter"
  },
  dependsOn: [Da, ie, Ls]
}, Kz = {
  moduleName: "NewFiltersToolPanel",
  version: Y,
  userComponents: { agNewFiltersToolPanel: Uz },
  beans: [Ez, Dz],
  icons: {
    // filter add button in new filter tool panel
    filterAdd: "filter-add",
    // filter tool panel tab
    filtersToolPanel: "filter",
    // open icon for rich select
    richSelectOpen: "small-down",
    // remove for rich select editor pills
    richSelectRemove: "cancel",
    // button to expand filter card in new filter tool panel
    filterCardExpand: "chevron-down",
    // button to collapse filter card in new filter tool panel
    filterCardCollapse: "chevron-up",
    // indicates filter card in new filter tool panel has edits
    filterCardEditing: "edit"
  },
  dependsOn: [Da, ie, Ls]
}, cv = class extends R {
  constructor() {
    super(...arguments), this.loadRowDataVersion = 0;
  }
  wireBeans(e) {
    this.environment = e.environment;
  }
  init(e, t) {
    this.params = t, this.comp = e, t.pinned == null && (this.setAutoHeightClasses(), this.setupRefreshStrategy(), this.createDetailGrid(), this.loadRowData(), this.addManagedEventListeners({ fullWidthRowFocused: this.onFullWidthRowFocused.bind(this) }));
  }
  onFullWidthRowFocused(e) {
    const t = this.params, s = { rowIndex: t.node.rowIndex, rowPinned: t.node.rowPinned }, i = { rowIndex: e.rowIndex, rowPinned: e.rowPinned };
    xe(s, i) && ye(this.comp.getGui(), e.fromBelow);
  }
  setAutoHeightClasses() {
    const e = this.gos.get("detailRowAutoHeight"), t = e ? "ag-details-row-auto-height" : "ag-details-row-fixed-height", s = e ? "ag-details-grid-auto-height" : "ag-details-grid-fixed-height", i = this.comp;
    i.toggleCss(t, !0), i.toggleDetailGridCss(s, !0);
  }
  setupRefreshStrategy() {
    const e = this.params.refreshStrategy;
    if (e == "everything" || e == "nothing" || e == "rows") {
      this.refreshStrategy = e;
      return;
    }
    e != null && F(170, { providedStrategy: e }), this.refreshStrategy = "rows";
  }
  createDetailGrid() {
    const { params: e, gos: t } = this;
    if (ee(e.detailGridOptions)) {
      F(171);
      return;
    }
    const s = t.get("theme"), i = e.detailGridOptions.theme;
    i && i !== s && F(267);
    const r = {
      themeStyleContainer: this.environment.eStyleContainer,
      ...e.detailGridOptions,
      theme: s
    };
    t.get("detailRowAutoHeight") && (r.domLayout = "autoHeight"), this.comp.setDetailGrid(r);
  }
  registerDetailWithMaster(e) {
    const {
      params: t,
      beans: { selectionSvc: s, findSvc: i }
    } = this, r = t.node.id, n = t.api, o = {
      id: r,
      api: e
    }, a = t.node;
    if (n.isDestroyed())
      return;
    n.addDetailGridInfo(r, o), a.detailGridInfo = o;
    const l = a.parent;
    i == null || i.registerDetailGrid(a, e);
    function c() {
      l && (s == null || s.refreshMasterNodeState(l));
    }
    function d({ node: h, source: u }) {
      h !== l || u === "masterDetail" || e.isDestroyed() || s == null || s.setDetailSelectionState(l, t.detailGridOptions, e);
    }
    e.addEventListener("firstDataRendered", () => {
      e.isDestroyed() || n.isDestroyed() || (s == null || s.setDetailSelectionState(l, t.detailGridOptions, e), e.addEventListener("selectionChanged", c), n.addEventListener("rowSelected", d));
    }), this.addDestroyFunc(() => {
      a.detailGridInfo === o && (n.isDestroyed() || n.removeDetailGridInfo(r), a.detailGridInfo = null);
    });
  }
  loadRowData() {
    var n, o, a;
    this.loadRowDataVersion++;
    const e = this.loadRowDataVersion, t = this.params;
    if (((n = t.detailGridOptions) == null ? void 0 : n.rowModelType) === "serverSide") {
      (a = (o = t.node.detailGridInfo) == null ? void 0 : o.api) == null || a.refreshServerSide({ purge: !0 });
      return;
    }
    const s = t.getDetailRowData;
    if (!s) {
      F(172);
      return;
    }
    const i = (l) => {
      this.loadRowDataVersion === e && this.comp.setRowData(l);
    }, r = {
      node: t.node,
      // we take data from node, rather than params.data
      // as the data could have been updated with new instance
      data: t.node.data,
      successCallback: i,
      context: V(this.gos, {}).context
    };
    s(r);
  }
  refresh() {
    switch (this.refreshStrategy) {
      case "nothing":
        return !0;
      case "everything":
        return !1;
    }
    return this.loadRowData(), !0;
  }
}, jz = class {
  constructor(e) {
    this.parentWrapper = e;
  }
  wrap(e, t, s, i) {
    return this.parentWrapper.wrap(e, t, s, i);
  }
}, Yz = { tag: "div", cls: "ag-details-row" }, qz = {
  tag: "div",
  cls: "ag-details-row",
  role: "gridcell",
  children: [{ tag: "div", ref: "eDetailGrid", cls: "ag-details-grid", role: "presentation" }]
}, Xz = class extends D {
  constructor() {
    super(...arguments), this.eDetailGrid = x;
  }
  wireBeans(e) {
    this.context = e.context;
  }
  init(e) {
    this.params = e, this.selectAndSetTemplate();
    const t = {
      toggleCss: (s, i) => this.toggleCss(s, i),
      toggleDetailGridCss: (s, i) => this.eDetailGrid.classList.toggle(s, i),
      setDetailGrid: (s) => this.setDetailGrid(s),
      setRowData: (s) => this.setRowData(s),
      getGui: () => this.eDetailGrid
    };
    this.ctrl = this.createManagedBean(new cv()), this.ctrl.init(t, e);
  }
  refresh() {
    var e;
    return ((e = this.ctrl) == null ? void 0 : e.refresh()) ?? !1;
  }
  selectAndSetTemplate() {
    const e = this.params;
    if (e.pinned) {
      this.setTemplate(Yz);
      return;
    }
    const t = () => {
      this.setTemplate(qz);
    };
    if (ee(e.template))
      t();
    else if (typeof e.template == "string")
      this.setTemplate(e.template, []);
    else if (typeof e.template == "function") {
      const s = e.template, i = s(e);
      this.setTemplate(i, []);
    } else
      F(168), t();
    this.eDetailGrid == null && F(169);
  }
  setDetailGrid(e) {
    var n;
    if (!this.eDetailGrid)
      return;
    const t = this.context.getBean("frameworkCompWrapper"), s = new jz(t), { frameworkOverrides: i } = this.beans, r = cm(this.eDetailGrid, e, {
      frameworkOverrides: i,
      providedBeanInstances: { frameworkCompWrapper: s },
      modules: SP(this.params.api.getGridId(), e.rowModelType ?? "clientSide")
    });
    this.detailApi = r, (n = this.ctrl) == null || n.registerDetailWithMaster(r), this.addDestroyFunc(() => {
      r.destroy();
    });
  }
  setRowData(e) {
    var t;
    (t = this.detailApi) == null || t.setGridOption("rowData", e);
  }
};
function Ga(e, t) {
  var i;
  const s = (i = e.masterDetailSvc) == null ? void 0 : i.store;
  return s ? t(s) : void 0;
}
function Zz(e, t, s) {
  Ga(e, (i) => {
    i[t] = s;
  });
}
function Qz(e, t) {
  Ga(e, (s) => {
    delete s[t];
  });
}
function Jz(e, t) {
  return Ga(e, (s) => s[t]);
}
function e2(e, t) {
  Ga(e, (s) => {
    let i = 0;
    Object.values(s).forEach((r) => {
      r && t(r, i++);
    });
  });
}
var t2 = (
  /*css*/
  ".ag-details-row{width:100%}.ag-details-row-fixed-height{height:100%}.ag-details-grid{width:100%}.ag-details-grid-fixed-height{height:100%}"
), s2 = class extends R {
  constructor() {
    super(...arguments), this.beanName = "masterDetailSvc", this.store = {};
  }
  isEnabled() {
    return !!this.gos.get("masterDetail");
  }
  postConstruct() {
    te(this.gos) && (this.enabled = this.isEnabled());
  }
  refreshModel(e) {
    if (e.changedProps) {
      const t = this.isEnabled();
      if (this.enabled !== t) {
        this.setMasters(null);
        return;
      }
    }
    e.rowDataUpdated && this.setMasters(e.changedRowNodes);
  }
  setMasters(e) {
    var o, a;
    const t = this.isEnabled();
    this.enabled = t;
    const s = this.gos, i = s.get("isRowMaster"), r = s.get("treeData"), n = (l, c, d) => {
      var g;
      const h = l.master;
      let u = t;
      if (t)
        if (c || d) {
          if (i) {
            const p = l.data;
            u = !!p && !!i(p);
          }
        } else
          u = h;
      if (!r)
        if (u && c) {
          const p = ((g = this.beans.rowGroupColsSvc) == null ? void 0 : g.columns.length) ?? 0;
          l.expanded = Yd(this.beans, l, p, !1);
        } else !u && h && (l.expanded = !1);
      u !== h && (l.master = u, l.dispatchRowEvent("masterChanged"));
    };
    if (e) {
      for (const l of e.updates)
        n(l, !1, !0);
      for (const l of e.adds)
        n(l, !0, !1);
    } else {
      const l = (a = (o = cs(this.beans)) == null ? void 0 : o.rootNode) == null ? void 0 : a.allLeafChildren;
      if (l)
        for (let c = 0, d = l.length; c < d; ++c)
          n(l[c], !0, !1);
    }
  }
  /** Used by flatten stage to get or create a detail node from a master node */
  getDetail(e) {
    if (!e.master || !e.expanded)
      return null;
    let t = e.detailNode;
    return t || (t = new ft(this.beans), t.detail = !0, t.selectable = !1, t.parent = e, A(e.id) && (t.id = "detail_" + e.id), t.data = e.data, t.level = e.level + 1, e.detailNode = t, t);
  }
  setupDetailRowAutoHeight(e, t) {
    const { gos: s, beans: i } = this;
    if (!s.get("detailRowAutoHeight"))
      return;
    const r = () => {
      const o = t.clientHeight;
      if (o != null && o > 0) {
        const a = () => {
          const { rowModel: l } = this.beans, { rowNode: c } = e;
          c.setRowHeight(o), (te(s) || Le(s)) && l.onRowHeightChanged();
        };
        window.setTimeout(a, 0);
      }
    }, n = os(i, t, r);
    e.addDestroyFunc(n), r();
  }
  destroy() {
    this.store = {}, super.destroy();
  }
}, i2 = {
  moduleName: "SharedMasterDetail",
  version: Y,
  beans: [s2],
  userComponents: { agDetailCellRenderer: Xz },
  dynamicBeans: { detailCellRendererCtrl: cv },
  apiFunctions: {
    addDetailGridInfo: Zz,
    removeDetailGridInfo: Qz,
    getDetailGridInfo: Jz,
    forEachDetailGridInfo: e2
  },
  dependsOn: [ie, iv, qd],
  css: [t2]
}, r2 = {
  moduleName: "MasterDetail",
  version: Y,
  dependsOn: [i2, ka, Ym]
}, dv = class extends D {
  constructor() {
    super(...arguments), this.changedCalculatedValues = !1, this.dragging = !1, this.shouldDestroyOnEndDragging = !1;
  }
  postConstruct() {
    const { dragSvc: e, rangeSvc: t } = this.beans;
    e.addDragSource({
      dragStartPixels: 0,
      eElement: this.getGui(),
      onDragStart: this.onDragStart.bind(this),
      onDragging: (s) => {
        this.dragging = !0, t.autoScrollService.check(s), this.changedCalculatedValues && (this.onDrag(s), this.changedCalculatedValues = !1);
      },
      onDragStop: (s) => {
        this.dragging = !1, this.onDragEnd(s), this.clearDragProperties(), this.shouldDestroyOnEndDragging && this.destroy();
      },
      onDragCancel: () => {
        this.dragging = !1, this.onDragCancel(), this.clearDragProperties();
      }
    }), this.addManagedElementListeners(this.getGui(), { mousedown: this.preventRangeExtension.bind(this) });
  }
  getLastCellHovered() {
    return this.lastCellHovered;
  }
  preventRangeExtension(e) {
    e.stopPropagation();
  }
  onDragStart(e) {
    [this.cellHoverListener] = this.addManagedElementListeners(this.beans.ctrlsSvc.get("gridCtrl").getGui(), {
      mousemove: this.updateValuesOnMove.bind(this)
    }), document.body.classList.add(this.getDraggingCssClass());
  }
  getDraggingCssClass() {
    return `ag-dragging-${this.type === 0 ? "fill" : "range"}-handle`;
  }
  updateValuesOnMove(e) {
    const t = pf(this.gos, e);
    !t || this.shouldSkipCell(t) || this.lastCellHovered && Pn(t, this.lastCellHovered) || (this.lastCellHovered = t, this.changedCalculatedValues = !0);
  }
  clearDragProperties() {
    this.clearValues(), this.beans.rangeSvc.autoScrollService.ensureCleared(), document.body.classList.remove(this.getDraggingCssClass());
  }
  getType() {
    return this.type;
  }
  refresh(e) {
    const t = this.cellCtrl, s = this.getGui(), i = _(this.beans.rangeSvc.getCellRanges()), r = i.startRow, n = i.endRow;
    if (r && n && (Be(n, r) ? (this.rangeStartRow = n, this.rangeEndRow = r) : (this.rangeStartRow = r, this.rangeEndRow = n)), t !== e || !Ze(s)) {
      this.cellCtrl = e;
      const o = e.comp.getParentOfValue();
      o && o.appendChild(s);
    }
    this.cellRange = i;
  }
  clearValues() {
    this.lastCellHovered = void 0, this.removeListeners();
  }
  removeListeners() {
    const e = this.cellHoverListener;
    e && (e(), this.cellHoverListener = void 0);
  }
  destroy() {
    var t;
    if (!this.shouldDestroyOnEndDragging && this.dragging) {
      O(this.getGui(), !1), this.shouldDestroyOnEndDragging = !0;
      return;
    }
    this.shouldDestroyOnEndDragging = !1, super.destroy(), this.removeListeners();
    const e = this.getGui();
    (t = e.parentElement) == null || t.removeChild(e);
  }
};
function n2(e) {
  const t = e.length;
  let s = 0;
  if (t <= 1)
    return e;
  for (let h = 0; h < e.length; h++) {
    const u = e[h], g = u.toString().split("e-");
    if (g.length > 1) {
      s = Math.max(s, parseInt(g[1], 10));
      continue;
    }
    Math.floor(u) !== u && (s = Math.max(s, u.toString().split(".")[1].length));
  }
  let i = 0, r = 0, n = 0, o = 0, a = 0;
  for (let h = 0; h < t; h++)
    a = e[h], i += h, r += a, o += h * h, n += h * a;
  const l = (t * n - i * r) / (t * o - i * i), c = r / t - l * i / t, d = [];
  for (let h = 0; h <= t; h++)
    d.push(parseFloat((h * l + c).toFixed(s)));
  return d;
}
var o2 = {
  tag: "div",
  cls: "ag-fill-handle"
}, a2 = class extends dv {
  constructor() {
    super(o2), this.markedCells = [], this.cellValues = [], this.isUp = !1, this.isLeft = !1, this.isReduce = !1, this.type = 0;
  }
  postConstruct() {
    super.postConstruct(), this.addManagedElementListeners(this.getGui(), {
      dblclick: this.onDblClick.bind(this)
    });
  }
  onDblClick(e) {
    var c, d;
    he(e);
    const { cellRange: t, rangeStartRow: s, beans: i } = this, { rangeSvc: r, visibleCols: n } = i, o = If(i);
    if (!o)
      return;
    const a = this.getFillHandleDirection();
    this.dragAxis = a === "xy" ? "y" : a;
    const l = r == null ? void 0 : r.createCellRangeFromCellRangeParams({
      rowStartIndex: s.rowIndex,
      rowStartPinned: s.rowPinned,
      columnStart: t.columns[0],
      rowEndIndex: this.dragAxis === "x" ? ((c = t.endRow) == null ? void 0 : c.rowIndex) ?? null : o.rowIndex,
      rowEndPinned: this.dragAxis === "x" ? (d = t.endRow) == null ? void 0 : d.rowPinned : o.rowPinned,
      columnEnd: this.dragAxis === "x" ? _(n.allCols) : _(t.columns)
    });
    this.isUp = !1, this.isLeft = !1, l && this.performFill({
      event: e,
      initialRange: t,
      finalRange: l
    }), this.dragAxis = void 0;
  }
  updateValuesOnMove(e) {
    super.updateValuesOnMove(e), this.initialXY || (this.initialXY = Vo(this.beans, e));
    const { x: t, y: s } = this.initialXY, { x: i, y: r } = Vo(this.beans, e), n = Math.abs(t - i), o = Math.abs(s - r), a = this.getFillHandleDirection();
    let l;
    a === "xy" ? l = n > o ? "x" : "y" : l = a, l !== this.dragAxis && (this.dragAxis = l, this.changedCalculatedValues = !0);
  }
  shouldSkipCell(e) {
    return Ke(e.column);
  }
  onDrag(e) {
    if (!this.initialPosition) {
      const s = this.cellCtrl;
      if (!s)
        return;
      this.initialPosition = s.cellPosition;
    }
    const t = this.getLastCellHovered();
    t && this.markPathFrom(this.initialPosition, t);
  }
  onDragEnd(e) {
    if (this.initialXY = null, !this.markedCells.length)
      return;
    const t = this.dragAxis === "x", {
      cellRange: s,
      rangeStartRow: i,
      rangeEndRow: r,
      beans: { rangeSvc: n }
    } = this, o = s.columns.length;
    let a;
    if (!this.isUp && !this.isLeft)
      a = n.createCellRangeFromCellRangeParams({
        rowStartIndex: i.rowIndex,
        rowStartPinned: i.rowPinned,
        columnStart: s.columns[0],
        rowEndIndex: t ? r.rowIndex : this.lastCellMarked.rowIndex,
        rowEndPinned: t ? r.rowPinned : this.lastCellMarked.rowPinned,
        columnEnd: t ? this.lastCellMarked.column : s.columns[o - 1]
      });
    else {
      const l = t ? i : this.lastCellMarked;
      a = n.createCellRangeFromCellRangeParams({
        rowStartIndex: l.rowIndex,
        rowStartPinned: l.rowPinned,
        columnStart: t ? this.lastCellMarked.column : s.columns[0],
        rowEndIndex: r.rowIndex,
        rowEndPinned: r.rowPinned,
        columnEnd: s.columns[o - 1]
      });
    }
    a && this.performFill({
      event: e,
      initialRange: s,
      finalRange: a,
      shouldUpdateRange: !0
    });
  }
  onDragCancel() {
    this.initialXY = null, this.markedCells.length && this.clearMarkedPath();
  }
  performFill({
    event: e,
    initialRange: t,
    finalRange: s,
    shouldUpdateRange: i
  }) {
    const { eventSvc: r, rangeSvc: n } = this.beans;
    r.dispatchEvent({ type: "fillStart" }), this.handleValueChanged(t, s, e), i && n.setCellRanges([s]), r.dispatchEvent({
      type: "fillEnd",
      initialRange: t,
      finalRange: s
    });
  }
  getFillHandleDirection() {
    var t;
    const e = (t = _a(this.gos)) == null ? void 0 : t.direction;
    return e ? e !== "x" && e !== "y" && e !== "xy" ? (F(177), "xy") : e : "xy";
  }
  handleValueChanged(e, t, s) {
    var y, P;
    const { beans: i } = this, { rangeSvc: r, gos: n, valueSvc: o } = i, a = r.getRangeEndRow(e), l = r.getRangeStartRow(e), c = r.getRangeEndRow(t), d = r.getRangeStartRow(t), h = this.dragAxis === "y";
    if (this.isReduce && !((y = _a(n)) != null && y.suppressClearOnFillReduction)) {
      const E = h ? e.columns : e.columns.filter((T) => t.columns.indexOf(T) < 0), M = h ? dt(i, c) : d;
      M && this.clearCellsInRange(M, a, E);
      return;
    }
    const u = [], g = [], p = [], f = [];
    let m = !0, C = 0;
    const v = () => {
      u.length = 0, g.length = 0, p.length = 0, f.length = 0, C = 0;
    }, w = (E, M) => {
      let T = this.isUp ? a : l, G = !1;
      for (h && (m = !0, v()); !G && T; ) {
        const I = Ee(i, T);
        if (!I)
          break;
        h && E ? b(
          u,
          E,
          I,
          () => !xe(T, this.isUp ? l : a)
        ) : M && (m = !0, v(), M.forEach(
          (L) => b(
            u,
            L,
            I,
            () => L !== (this.isLeft ? e.columns[0] : _(e.columns))
          )
        )), G = xe(T, this.isUp ? d : c), T = this.isUp ? xs(this.beans, T) : dt(i, T);
      }
    }, b = (E, M, T, G) => {
      let I, L = !1;
      if (m)
        I = o.getValue(M, T), g.push(I), p.push(o.getValue(M, T, !0)), f.push(o.formatValue(M, T, I)), m = G();
      else {
        const { value: $, fromUserFunction: z, sourceCol: W, sourceRowNode: H } = this.processValues({
          event: s,
          values: E,
          initialValues: g,
          initialNonAggregatedValues: p,
          initialFormattedValues: f,
          col: M,
          rowNode: T,
          idx: C++
        });
        if (I = $, M.isCellEditable(T)) {
          const J = o.getValue(M, T);
          if (!z) {
            if (W) {
              const le = W.getColDef();
              if (le.useValueFormatterForExport !== !1 && le.valueFormatter) {
                const fe = o.formatValue(W, H, I);
                fe != null && (I = fe);
              }
            }
            M.getColDef().useValueParserForImport !== !1 && (I = o.parseValue(
              M,
              T,
              // if no sourceCol, then currentValue is a number
              W ? I : ut(I),
              J
            ));
          }
          !z || J !== I ? T.setDataValue(M, I, "rangeSvc") : L = !0;
        }
      }
      L || E.push({
        value: I,
        column: M,
        rowNode: T
      });
    };
    if (h)
      e.columns.forEach((E) => {
        w(E);
      });
    else {
      const E = this.isLeft ? [...t.columns].reverse() : t.columns;
      w(void 0, E);
    }
    (P = this.beans.editSvc) == null || P.stopEditing(void 0, { source: "fillHandle" });
  }
  clearCellsInRange(e, t, s) {
    const i = {
      startRow: e,
      endRow: t,
      columns: s,
      startColumn: s[0]
    };
    this.beans.rangeSvc.clearCellRangeCellValues({ cellRanges: [i] });
  }
  processValues(e) {
    var g;
    const { event: t, values: s, initialValues: i, initialNonAggregatedValues: r, initialFormattedValues: n, col: o, rowNode: a, idx: l } = e, c = (g = _a(this.gos)) == null ? void 0 : g.setFillValue, d = this.dragAxis === "y";
    let h;
    if (d ? h = this.isUp ? "up" : "down" : h = this.isLeft ? "left" : "right", c) {
      const p = V(this.gos, {
        event: t,
        values: s.map(({ value: m }) => m),
        initialValues: i,
        initialNonAggregatedValues: r,
        initialFormattedValues: n,
        currentIndex: l,
        currentCellValue: this.beans.valueSvc.getValue(o, a),
        direction: h,
        column: o,
        rowNode: a
      }), f = c(p);
      if (f !== !1)
        return { value: f, fromUserFunction: !0 };
    }
    const u = !s.some(({ value: p }) => {
      const f = parseFloat(p);
      return isNaN(f) || f.toString() !== p.toString();
    });
    if (t.altKey || !u) {
      if (u && i.length === 1) {
        const C = this.isUp || this.isLeft ? -1 : 1;
        return { value: parseFloat(_(s).value) + 1 * C, fromUserFunction: !1 };
      }
      const { value: p, column: f, rowNode: m } = s[l % s.length];
      return { value: p, fromUserFunction: !1, sourceCol: f, sourceRowNode: m };
    }
    return {
      value: _(n2(s.map(({ value: p }) => Number(p)))),
      fromUserFunction: !1
    };
  }
  clearValues() {
    this.clearMarkedPath(), this.clearCellValues(), this.lastCellMarked = void 0, super.clearValues();
  }
  clearMarkedPath() {
    this.markedCells.forEach((e) => {
      if (!e.isAlive())
        return;
      const { comp: t } = e;
      t.toggleCss("ag-selection-fill-top", !1), t.toggleCss("ag-selection-fill-right", !1), t.toggleCss("ag-selection-fill-bottom", !1), t.toggleCss("ag-selection-fill-left", !1);
    }), this.markedCells.length = 0, this.isUp = !1, this.isLeft = !1, this.isReduce = !1;
  }
  clearCellValues() {
    this.cellValues.length = 0;
  }
  markPathFrom(e, t) {
    if (this.clearMarkedPath(), this.clearCellValues(), this.dragAxis === "y") {
      if (xe(t, e))
        return;
      const s = Be(t, e), { rangeStartRow: i, rangeEndRow: r } = this;
      s && (t.rowPinned == i.rowPinned && t.rowIndex >= i.rowIndex || i.rowPinned != r.rowPinned && t.rowPinned == r.rowPinned && t.rowIndex <= r.rowIndex) ? (this.reduceVertical(e, t), this.isReduce = !0) : (this.extendVertical(e, t, s), this.isReduce = !1);
    } else {
      const s = e.column, i = t.column;
      if (s === i)
        return;
      const r = this.beans.visibleCols.allCols, n = r.indexOf(s), o = r.indexOf(i);
      o <= n && o >= r.indexOf(this.cellRange.columns[0]) ? (this.reduceHorizontal(e, t), this.isReduce = !0) : (this.extendHorizontal(e, t, o < n), this.isReduce = !1);
    }
    this.lastCellMarked = t;
  }
  extendVertical(e, t, s) {
    const i = this.beans, { rangeSvc: r } = i;
    let n = e;
    do {
      const o = this.cellRange, a = o.columns.length;
      for (let l = 0; l < a; l++) {
        const c = o.columns[l], h = { ...{ rowIndex: n.rowIndex, rowPinned: n.rowPinned }, column: c }, u = r.isCellInSpecificRange(h, o), g = xe(n, e);
        if (s && (this.isUp = !0), !g) {
          const p = qt(i, h);
          if (p) {
            this.markedCells.push(p);
            const f = p.comp;
            u || (f.toggleCss("ag-selection-fill-left", l === 0), f.toggleCss("ag-selection-fill-right", l === a - 1)), f.toggleCss(
              s ? "ag-selection-fill-top" : "ag-selection-fill-bottom",
              xe(n, t)
            );
          }
        }
      }
      if (xe(n, t))
        break;
    } while (
      // tslint:disable-next-line
      n = s ? xs(this.beans, n) : dt(i, n)
    );
  }
  reduceVertical(e, t) {
    let s = e;
    const i = this.beans;
    do {
      const r = this.cellRange, n = r.columns.length, o = xe(s, t);
      for (let a = 0; a < n; a++) {
        const c = { ...{ rowIndex: s.rowIndex, rowPinned: s.rowPinned }, column: r.columns[a] }, d = qt(i, c);
        d && (this.markedCells.push(d), d.comp.toggleCss("ag-selection-fill-bottom", xe(s, t)));
      }
      if (o)
        break;
    } while (s = xs(i, s));
  }
  extendHorizontal(e, t, s) {
    const i = this.beans, { visibleCols: r } = i, n = r.allCols, o = n.indexOf(s ? t.column : e.column), a = n.indexOf(s ? this.cellRange.columns[0] : t.column), l = s ? 0 : 1, c = n.slice(o + l, a + l), { rangeStartRow: d, rangeEndRow: h } = this;
    c.forEach((u) => {
      let g = d, p = !1;
      do {
        p = xe(g, h);
        const f = qt(i, {
          rowIndex: g.rowIndex,
          rowPinned: g.rowPinned,
          column: u
        });
        if (f) {
          this.markedCells.push(f);
          const m = f.comp;
          m.toggleCss("ag-selection-fill-top", xe(g, d)), m.toggleCss("ag-selection-fill-bottom", xe(g, h)), s ? (this.isLeft = !0, m.toggleCss("ag-selection-fill-left", u === c[0])) : m.toggleCss("ag-selection-fill-right", u === _(c));
        }
        g = dt(i, g);
      } while (!p);
    });
  }
  reduceHorizontal(e, t) {
    const s = this.beans, { visibleCols: i } = s, r = i.allCols, n = r.indexOf(t.column), o = r.indexOf(e.column), a = r.slice(n, o), { rangeStartRow: l, rangeEndRow: c } = this;
    a.forEach((d) => {
      let h = l, u = !1;
      do {
        u = xe(h, c);
        const g = qt(this.beans, {
          rowIndex: h.rowIndex,
          rowPinned: h.rowPinned,
          column: d
        });
        g && (this.markedCells.push(g), g.comp.toggleCss("ag-selection-fill-right", d === a[0])), h = dt(s, h);
      } while (!u);
    });
  }
  refresh(e) {
    const t = this.beans.rangeSvc.getCellRanges()[0];
    if (!t.startRow || !t.endRow) {
      this.destroy();
      return;
    }
    super.refresh(e);
  }
}, l2 = class extends dv {
  constructor() {
    super({ tag: "div", cls: "ag-range-handle" }), this.type = 1, this.rangeFixed = !1;
  }
  onDrag(e) {
    const t = this.getLastCellHovered();
    if (!t)
      return;
    const s = this.beans.rangeSvc, i = s.getCellRanges(), r = _(i);
    this.rangeFixed || (this.fixRangeStartEnd(r), this.rangeFixed = !0), this.endPosition = {
      rowIndex: t.rowIndex,
      rowPinned: t.rowPinned,
      column: t.column
    }, i.length === 2 && i[0].type === Mt.DIMENSION && r.type === Mt.VALUE && !xe(this.endPosition, s.getRangeEndRow(r)) && s.updateRangeRowBoundary({
      cellRange: i[0],
      boundary: "end",
      cellPosition: {
        ...this.endPosition,
        column: i[0].columns[0]
      },
      silent: !0
    }), s.extendLatestRangeToCell(this.endPosition);
  }
  shouldSkipCell(e) {
    return !1;
  }
  onDragEnd(e) {
    const t = _(this.beans.rangeSvc.getCellRanges());
    this.fixRangeStartEnd(t), this.rangeFixed = !1;
  }
  onDragCancel() {
    this.rangeFixed = !1;
  }
  fixRangeStartEnd(e) {
    const t = this.beans.rangeSvc, s = t.getRangeStartRow(e), i = t.getRangeEndRow(e), r = e.columns[0];
    e.startRow = s, e.endRow = i, e.startColumn = r;
  }
}, c2 = (
  /*css*/
  ".ag-body-viewport:not(.ag-has-focus) .ag-cell-range-single-cell:not(.ag-cell-inline-editing),.ag-cell-range-selected.ag-cell-range-chart,.ag-cell-range-selected:not(.ag-cell-focus){background-color:var(--ag-range-selection-background-color);&.ag-cell-range-chart{background-color:var(--ag-range-selection-chart-background-color)!important;&.ag-cell-range-chart-category{background-color:var(--ag-range-selection-chart-category-background-color)!important}}}.ag-cell-range-selected-1.ag-cell-range-chart,.ag-cell-range-selected-1:not(.ag-cell-focus),.ag-root:not(.ag-context-menu-open) .ag-body-viewport:not(.ag-has-focus) .ag-cell-range-selected-1:not(.ag-cell-inline-editing){background-color:var(--ag-range-selection-background-color)}.ag-cell-range-selected-2.ag-cell-range-chart,.ag-cell-range-selected-2:not(.ag-cell-focus){background-image:linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color))}.ag-cell-range-selected-3.ag-cell-range-chart,.ag-cell-range-selected-3:not(.ag-cell-focus){background-image:linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color)),linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color))}.ag-cell-range-selected-4.ag-cell-range-chart,.ag-cell-range-selected-4:not(.ag-cell-focus){background-image:linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color)),linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color)),linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color))}.ag-cell.ag-cell-range-selected:not(.ag-cell-range-single-cell){&.ag-cell-range-top{border-top-color:var(--ag-range-selection-border-color);border-top-style:var(--ag-range-selection-border-style)}&.ag-cell-range-right{border-right-color:var(--ag-range-selection-border-color);border-right-style:var(--ag-range-selection-border-style)}&.ag-cell-range-bottom{border-bottom-color:var(--ag-range-selection-border-color);border-bottom-style:var(--ag-range-selection-border-style)}&.ag-cell-range-left{border-left-color:var(--ag-range-selection-border-color);border-left-style:var(--ag-range-selection-border-style)}}.ag-cell.ag-selection-fill-top,.ag-cell.ag-selection-fill-top.ag-cell-range-selected{border-top:1px dashed;border-top-color:var(--ag-range-selection-border-color)}:where(.ag-ltr) .ag-cell.ag-selection-fill-right,:where(.ag-ltr) .ag-cell.ag-selection-fill-right.ag-cell-range-selected{border-right:1px dashed var(--ag-range-selection-border-color)!important}:where(.ag-rtl) .ag-cell.ag-selection-fill-right,:where(.ag-rtl) .ag-cell.ag-selection-fill-right.ag-cell-range-selected{border-left:1px dashed var(--ag-range-selection-border-color)!important}.ag-cell.ag-selection-fill-bottom,.ag-cell.ag-selection-fill-bottom.ag-cell-range-selected{border-bottom:1px dashed;border-bottom-color:var(--ag-range-selection-border-color)}:where(.ag-ltr) .ag-cell.ag-selection-fill-left,:where(.ag-ltr) .ag-cell.ag-selection-fill-left.ag-cell-range-selected{border-left:1px dashed var(--ag-range-selection-border-color)!important}:where(.ag-rtl) .ag-cell.ag-selection-fill-left,:where(.ag-rtl) .ag-cell.ag-selection-fill-left.ag-cell-range-selected{border-right:1px dashed var(--ag-range-selection-border-color)!important}.ag-fill-handle,.ag-range-handle{background-color:var(--ag-range-selection-border-color);bottom:-1px;height:6px;position:absolute;width:6px}:where(.ag-ltr) .ag-fill-handle,:where(.ag-ltr) .ag-range-handle{right:-1px}:where(.ag-rtl) .ag-fill-handle,:where(.ag-rtl) .ag-range-handle{left:-1px}.ag-fill-handle{cursor:crosshair}:where(.ag-ltr) .ag-range-handle{cursor:nwse-resize}:where(.ag-rtl) .ag-range-handle{cursor:nesw-resize}"
);
function d2(e) {
  var t;
  return ((t = e.rangeSvc) == null ? void 0 : t.getCellRanges()) ?? null;
}
function h2(e, t) {
  var s;
  (s = e.rangeSvc) == null || s.addCellRange(t);
}
function Qu(e) {
  var t;
  (t = e.rangeSvc) == null || t.removeAllCellRanges();
}
var Lr = "ag-cell-range-selected", u2 = "ag-cell-range-chart", g2 = "ag-cell-range-single-cell", p2 = "ag-cell-range-chart-category", f2 = "ag-cell-range-handle", m2 = "ag-cell-range-top", C2 = "ag-cell-range-right", v2 = "ag-cell-range-bottom", w2 = "ag-cell-range-left";
function b2(e) {
  var i;
  const t = e.get("cellSelection");
  return t !== void 0 ? typeof t != "boolean" ? ((i = t.handle) == null ? void 0 : i.mode) === "range" : !1 : e.get("enableRangeHandle");
}
function Ju(e) {
  var i;
  const t = e.get("cellSelection");
  return t !== void 0 ? typeof t != "boolean" ? ((i = t.handle) == null ? void 0 : i.mode) === "fill" : !1 : e.get("enableFillHandle");
}
var y2 = class {
  constructor(e, t) {
    this.beans = e, this.cellCtrl = t, this.rangeSvc = e.rangeSvc;
  }
  setComp(e) {
    this.cellComp = e, this.eGui = this.cellCtrl.eGui, this.onCellSelectionChanged();
  }
  onCellSelectionChanged() {
    const e = this.cellComp;
    if (!e)
      return;
    const { rangeSvc: t, cellCtrl: s, eGui: i } = this, r = t.getCellRangeCount(s.cellPosition);
    this.rangeCount = r;
    const n = this.getHasChartRange();
    this.hasChartRange = n, e.toggleCss(Lr, r !== 0), e.toggleCss(`${Lr}-1`, r === 1), e.toggleCss(`${Lr}-2`, r === 2), e.toggleCss(`${Lr}-3`, r === 3), e.toggleCss(`${Lr}-4`, r >= 4), e.toggleCss(u2, n), ta(i, r > 0 ? !0 : void 0), e.toggleCss(g2, this.isSingleCell()), this.updateRangeBorders(), this.refreshHandle();
  }
  updateRangeBorders() {
    const e = this.getRangeBorders(), t = this.isSingleCell(), s = !t && e.top, i = !t && e.right, r = !t && e.bottom, n = !t && e.left, o = this.cellComp;
    o.toggleCss(m2, s), o.toggleCss(C2, i), o.toggleCss(v2, r), o.toggleCss(w2, n);
  }
  isSingleCell() {
    const { rangeSvc: e } = this;
    return this.rangeCount === 1 && !!e && !e.isMoreThanOneCell();
  }
  getHasChartRange() {
    const { rangeSvc: e } = this;
    if (!this.rangeCount || !e)
      return !1;
    const t = e.getCellRanges();
    return t.length > 0 && t.every((s) => [Mt.DIMENSION, Mt.VALUE].includes(s.type));
  }
  updateRangeBordersIfRangeCount() {
    this.rangeCount > 0 && (this.updateRangeBorders(), this.refreshHandle());
  }
  getRangeBorders() {
    const e = this.beans.gos.get("enableRtl");
    let t = !1, s = !1, i = !1, r = !1;
    const {
      rangeSvc: n,
      beans: { visibleCols: o },
      cellCtrl: { cellPosition: a }
    } = this, l = a.column, c = n.getCellRanges().filter((u) => n.isCellInSpecificRange(a, u));
    if (!c.length)
      return { top: t, right: s, bottom: i, left: r };
    let d, h;
    e ? (d = o.getColAfter(l), h = o.getColBefore(l)) : (d = o.getColBefore(l), h = o.getColAfter(l)), d || (r = !0), h || (s = !0);
    for (let u = 0; u < c.length && !(t && s && i && r); u++) {
      const g = c[u], p = n.getRangeStartRow(g), f = n.getRangeEndRow(g);
      !t && xe(p, a) && (t = !0), !i && xe(f, a) && (i = !0), !r && d && g.columns.indexOf(d) < 0 && (r = !0), !s && h && g.columns.indexOf(h) < 0 && (s = !0);
    }
    return { top: t, right: s, bottom: i, left: r };
  }
  refreshHandle() {
    if (this.beans.context.isDestroyed())
      return;
    const e = this.shouldHaveSelectionHandle();
    this.selectionHandle && !e && (this.selectionHandle = this.beans.context.destroyBean(this.selectionHandle)), e && this.addSelectionHandle(), this.cellComp.toggleCss(f2, !!this.selectionHandle);
  }
  shouldHaveSelectionHandle() {
    const { gos: e, editSvc: t } = this.beans, s = this.rangeSvc, i = s.getCellRanges(), r = i.length;
    if (this.rangeCount < 1 || r < 1)
      return !1;
    const n = _(i), { cellPosition: o, column: a } = this.cellCtrl, l = Ju(e) && !a.isSuppressFillHandle(), c = b2(e), d = t == null ? void 0 : t.isEditing(this.cellCtrl, { withOpenEditor: !0 });
    let h = r === 1 && !d && (l || c);
    if (this.hasChartRange) {
      const g = i[0].type === Mt.DIMENSION && s.isCellInSpecificRange(o, i[0]);
      this.cellComp.toggleCss(p2, g), h = n.type === Mt.VALUE;
    }
    return h && n.endRow != null && s.isContiguousRange(n) && s.isBottomRightCell(n, o);
  }
  addSelectionHandle() {
    var n;
    const { beans: e, rangeSvc: t } = this, s = _(t.getCellRanges()).type, r = Ju(e.gos) && ee(s) ? 0 : 1;
    if (this.selectionHandle && this.selectionHandle.getType() !== r && (this.selectionHandle = e.context.destroyBean(this.selectionHandle)), !this.selectionHandle) {
      const o = e.registry.createDynamicBean(
        r === 0 ? "fillHandle" : "rangeHandle",
        !1
      );
      o && (this.selectionHandle = e.context.createBean(o));
    }
    (n = this.selectionHandle) == null || n.refresh(this.cellCtrl);
  }
  destroy() {
    this.beans.context.destroyBean(this.selectionHandle);
  }
}, S2 = class extends R {
  constructor(e) {
    super(), this.eContainer = e;
  }
  postConstruct() {
    const { beans: e, gos: t, eContainer: s } = this, i = e.rangeSvc, r = {
      eElement: s,
      onDragStart: i.onDragStart.bind(i),
      onDragStop: i.onDragStop.bind(i),
      onDragging: i.onDragging.bind(i)
    }, n = e.dragSvc, o = n.addDragSource.bind(n, r), a = n.removeDragSource.bind(n, r);
    this.addManagedPropertyListeners(["enableRangeSelection", "cellSelection"], () => {
      et(t) ? o() : a();
    }), this.addDestroyFunc(a), et(t) && o();
  }
}, x2 = class extends R {
  constructor(e, t) {
    super(), this.column = e, this.comp = t, this.columnMap = /* @__PURE__ */ new Map(), this.isActive = !1, this.resetColumnMap();
  }
  postConstruct() {
    this.addManagedPropertyListener("cellSelection", () => {
      this.refreshActive();
    }), this.refreshActive(), this.setupRangeHeaderHighlight();
  }
  resetColumnMap() {
    this.columnMap.clear();
    let e;
    this.column.isColumn ? e = [this.column] : e = this.column.getDisplayedLeafColumns();
    for (const t of e)
      this.columnMap.set(t, !1);
  }
  refreshActive() {
    const { gos: e, rangeSvc: t } = this.beans, s = e.get("cellSelection");
    this.isActive = !!(s && t && typeof s == "object" && s.enableHeaderHighlight);
  }
  setupRangeHeaderHighlight() {
    const e = this.onRangeSelectionChanged.bind(this);
    this.addManagedEventListeners({
      rangeSelectionChanged: e,
      columnPinned: e,
      columnMoved: e,
      columnGroupOpened: e
    }), e();
  }
  onRangeSelectionChanged() {
    if (!this.isActive)
      return;
    this.resetColumnMap();
    const e = this.beans.rangeSvc.getCellRanges();
    let t = !1, s = !0;
    for (const i of e) {
      if (t)
        break;
      for (const r of i.columns)
        this.columnMap.has(r) && (this.columnMap.set(r, !0), t || (t = !0));
    }
    for (const i of Array.from(this.columnMap.values()))
      if (i === !1) {
        s = !1;
        break;
      }
    this.comp.toggleCss("ag-header-range-highlight", t && s);
  }
  destroy() {
    super.destroy(), this.comp = null, this.column = null;
  }
}, F2 = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rangeSvc", this.cellRanges = [], this.bodyScrollListener = this.onBodyScroll.bind(this), this.dragging = !1, this.intersectionRange = !1;
  }
  wireBeans(e) {
    this.rowModel = e.rowModel, this.dragSvc = e.dragSvc, this.colModel = e.colModel, this.visibleCols = e.visibleCols, this.cellNavigation = e.cellNavigation, this.ctrlsSvc = e.ctrlsSvc, this.valueSvc = e.valueSvc;
  }
  postConstruct() {
    const e = this.onColumnsChanged.bind(this), t = () => this.removeAllCellRanges(), s = this.refreshLastRangeStart.bind(this);
    this.addManagedEventListeners({
      newColumnsLoaded: e,
      columnVisible: e,
      columnValueChanged: e,
      columnPivotModeChanged: t,
      columnRowGroupChanged: t,
      columnPivotChanged: t,
      columnGroupOpened: s,
      columnMoved: s,
      columnPinned: s
    }), this.ctrlsSvc.whenReady(this, (i) => {
      const r = i.gridBodyCtrl;
      this.autoScrollService = new yd({
        scrollContainer: r.eBodyViewport,
        scrollAxis: "xy",
        getVerticalPosition: () => r.scrollFeature.getVScrollPosition().top,
        setVerticalPosition: (n) => r.scrollFeature.setVerticalScrollPosition(n),
        getHorizontalPosition: () => r.scrollFeature.getHScrollPosition().left,
        setHorizontalPosition: (n) => r.scrollFeature.setHorizontalScrollPosition(n),
        shouldSkipVerticalScroll: () => !Ie(this.gos, "normal"),
        shouldSkipHorizontalScroll: () => !r.scrollFeature.isHorizontalScrollShowing()
      });
    });
  }
  // Drag And Drop Target Methods
  onDragStart(e) {
    var d, h;
    const t = this.gos;
    if (!et(t) || (d = af(t, e.target)) != null && d.isSuppressMouseEvent(e))
      return;
    const { ctrlKey: s, metaKey: i, shiftKey: r } = e, n = s || i, a = !Ln(t) ? n : !1, l = r && !!((h = this.cellRanges) != null && h.length);
    !a && (!l || A(_(this.cellRanges).type)) && this.removeAllCellRanges(!0);
    const c = this.dragSvc.startTarget;
    if (c && this.updateValuesOnMove(c), !!this.lastCellHovered) {
      if (this.dragging = !0, this.lastMouseEvent = e, this.intersectionRange = a && this.getCellRangeCount(this.lastCellHovered) > 1, l || this.setNewestRangeStartCell(this.lastCellHovered), this.cellRanges.length > 0)
        this.draggingRange = _(this.cellRanges);
      else {
        const u = {
          rowIndex: this.lastCellHovered.rowIndex,
          rowPinned: this.lastCellHovered.rowPinned
        }, g = this.getColumnsFromModel([this.lastCellHovered.column]);
        if (!g || !g.length)
          return;
        this.draggingRange = {
          startRow: u,
          endRow: u,
          columns: g,
          startColumn: this.newestRangeStartCell.column
        }, this.cellRanges.push(this.draggingRange);
      }
      this.ctrlsSvc.getGridBodyCtrl().eBodyViewport.addEventListener("scroll", this.bodyScrollListener, { passive: !0 }), this.dispatchChangedEvent(!0, !1, this.draggingRange.id);
    }
  }
  onDragging(e) {
    const { dragging: t, lastCellHovered: s, newestRangeStartCell: i, autoScrollService: r, cellHasChanged: n } = this;
    if (!t || !e)
      return;
    this.updateValuesOnMove(e.target), this.lastMouseEvent = e;
    const o = (g) => s && s.rowPinned === g && i.rowPinned === g, a = o("top") || o("bottom");
    if (r.check(e, a), !n || !s)
      return;
    const l = i == null ? void 0 : i.column, c = s == null ? void 0 : s.column, d = this.calculateColumnsBetween(l, c);
    if (!d)
      return;
    const { rowIndex: h, rowPinned: u } = s;
    this.draggingRange.endRow = {
      rowIndex: h,
      rowPinned: u
    }, this.draggingRange.columns = d, this.dispatchChangedEvent(!1, !1, this.draggingRange.id);
  }
  onDragStop() {
    if (!this.dragging)
      return;
    const { id: e } = this.draggingRange;
    this.autoScrollService.ensureCleared(), this.ctrlsSvc.getGridBodyCtrl().eBodyViewport.removeEventListener("scroll", this.bodyScrollListener), this.lastMouseEvent = null, this.dragging = !1, this.draggingRange = void 0, this.lastCellHovered = void 0, this.intersectionRange && (this.intersectionRange = !1, this.intersectLastRange()), this.dispatchChangedEvent(!1, !0, e);
  }
  // Called for both columns loaded & column visibility events
  onColumnsChanged() {
    this.refreshLastRangeStart();
    const e = this.visibleCols.allCols;
    this.cellRanges.forEach((s) => {
      const i = s.columns;
      s.columns = s.columns.filter(
        (n) => n.isVisible() && e.indexOf(n) !== -1
      ), !Xe(i, s.columns) && this.dispatchChangedEvent(!1, !0, s.id);
    });
    const t = this.cellRanges.length;
    this.cellRanges = this.cellRanges.filter((s) => s.columns.length > 0), t > this.cellRanges.length && this.dispatchChangedEvent(!1, !0);
  }
  refreshLastRangeStart() {
    const e = _(this.cellRanges);
    e && this.refreshRangeStart(e);
  }
  isContiguousRange(e) {
    const t = e.columns;
    if (!t.length)
      return !1;
    const s = this.visibleCols.allCols, i = t.map((r) => s.indexOf(r)).sort((r, n) => r - n);
    return _(i) - i[0] + 1 === t.length;
  }
  getRangeStartRow(e) {
    var i;
    return e.startRow && e.endRow ? Be(e.startRow, e.endRow) ? e.startRow : e.endRow : { rowIndex: 0, rowPinned: (((i = this.beans.pinnedRowModel) == null ? void 0 : i.getPinnedTopRowCount()) ?? 0) > 0 ? "top" : null };
  }
  getRangeEndRow(e) {
    var i;
    if (e.startRow && e.endRow)
      return Be(e.startRow, e.endRow) ? e.endRow : e.startRow;
    const t = ((i = this.beans.pinnedRowModel) == null ? void 0 : i.getPinnedBottomRowCount()) ?? 0;
    return t > 0 ? {
      rowIndex: t - 1,
      rowPinned: "bottom"
    } : {
      rowIndex: this.rowModel.getRowCount() - 1,
      rowPinned: null
    };
  }
  getRangeRowCount(e) {
    const t = this.beans, s = this.getRangeStartRow(e), i = this.getRangeEndRow(e), r = _h(t, s);
    return _h(t, i) - r + 1;
  }
  setRangeToCell(e, t = !1) {
    const { gos: s } = this;
    if (!et(s))
      return;
    const i = s.get("rowNumbers"), r = Ke(e.column);
    i && this.setSelectionMode(r);
    const n = this.calculateColumnsBetween(e.column, e.column);
    if (!n)
      return;
    (Ln(this.gos) || !t || ee(this.cellRanges)) && this.removeAllCellRanges(!0);
    const a = {
      rowIndex: e.rowIndex,
      rowPinned: e.rowPinned
    }, l = {
      startRow: a,
      endRow: a,
      columns: n,
      startColumn: e.column
    };
    this.cellRanges.push(l), this.setNewestRangeStartCell(e), this.onDragStop(), this.dispatchChangedEvent(!0, !0);
  }
  getRangeLastColumn(e) {
    var i;
    const t = e.columns[0], s = _(e.columns);
    return ((i = this.newestRangeStartCell) == null ? void 0 : i.column) === t ? s : t;
  }
  extendRangeRowCountBy(e, t) {
    const { beans: s } = this, { startRow: i, endRow: r } = e;
    if (!i || !r)
      return;
    let n = 0, o;
    const a = Be(r, i);
    a ? o = i : o = r;
    const l = t > 0 ? dt : xs, c = Math.abs(t);
    for (; n < c; ) {
      const h = l(s, o);
      if (!h)
        break;
      o = h, n++;
    }
    if (n !== c)
      return;
    const d = {
      ...o,
      column: this.getRangeLastColumn(e)
    };
    this.updateRangeRowBoundary({ cellRange: e, boundary: a ? "start" : "end", cellPosition: d });
  }
  extendRangeColumnCountBy(e, t) {
    const { columns: s, startColumn: i } = e;
    if (t === 0)
      return;
    const r = this.getColumnsFromModel();
    if (!r)
      return;
    const n = _(s), o = i === s[0] ? n : s[0];
    if (!n || !o)
      return;
    let a = r.indexOf(i), l = r.indexOf(o);
    const c = l < a;
    c && ([a, l] = [l, a]);
    const h = s.length + t;
    if (h <= 0)
      return;
    const u = [];
    for (let g = a; g < a + h; g++) {
      const p = r[g];
      if (!p)
        break;
      u.push(p);
    }
    if (u.length === h) {
      if (c) {
        const g = _(u);
        e.startColumn = g, this.focusCellOnNewColumn(e, g);
      }
      e.columns = u, this.dispatchChangedEvent(!0, !0, e.id);
    }
  }
  extendLatestRangeToCell(e) {
    if (this.isEmpty() || !this.newestRangeStartCell)
      return;
    const t = _(this.cellRanges);
    this.setSelectionMode(Ke(e.column)), this.updateRangeRowBoundary({ cellRange: t, boundary: "end", cellPosition: e });
  }
  updateRangeRowBoundary(e) {
    const { cellRange: t, boundary: s, cellPosition: i, silent: r = !1 } = e, n = i.column, o = this.calculateColumnsBetween(t.startColumn, n);
    !o || this.isLastCellOfRange(t, i) || (s === "start" && this.focusCellOnNewRow(t, i), t.columns = o, t[s === "start" ? "startRow" : "endRow"] = {
      rowIndex: i.rowIndex,
      rowPinned: i.rowPinned
    }, r || this.dispatchChangedEvent(!0, !0, t.id));
  }
  getRangeEdgeColumns(e) {
    const t = this.visibleCols.allCols, s = e.columns.map((i) => t.indexOf(i)).filter((i) => i > -1).sort((i, r) => i - r);
    return {
      left: t[s[0]],
      right: t[_(s)]
    };
  }
  // returns true if successful, false if not successful
  extendLatestRangeInDirection(e) {
    if (this.isEmpty() || !this.newestRangeStartCell)
      return;
    const t = e.key, s = e.ctrlKey || e.metaKey, i = _(this.cellRanges), r = this.newestRangeStartCell, n = i.endRow.rowIndex, o = i.endRow.rowPinned, l = { column: this.getRangeLastColumn(i), rowIndex: n, rowPinned: o }, c = this.cellNavigation.getNextCellToFocus(t, l, s);
    if (c)
      return this.setCellRange({
        rowStartIndex: r.rowIndex,
        rowStartPinned: r.rowPinned,
        rowEndIndex: c.rowIndex,
        rowEndPinned: c.rowPinned,
        columnStart: r.column,
        columnEnd: c.column
      }), c;
  }
  setCellRange(e) {
    et(this.gos) && (this.removeAllCellRanges(!0), this.addCellRange(e));
  }
  setCellRanges(e) {
    if (!Xe(this.cellRanges, e) && this.verifyCellRanges(this.gos)) {
      this.removeAllCellRanges(!0);
      for (const t of e) {
        if (t.columns && t.startRow) {
          const s = this.getColumnsFromModel(t.columns);
          if (!s || s.length === 0)
            continue;
          t.columns = s;
          const { startRow: i } = t;
          this.setNewestRangeStartCell({
            rowIndex: i.rowIndex,
            rowPinned: i.rowPinned,
            column: t.columns[0]
          });
        }
        this.cellRanges.push(t);
      }
      this.dispatchChangedEvent(!1, !0);
    }
  }
  clearCellRangeCellValues(e) {
    const { beans: t, valueSvc: s, eventSvc: i } = this, { cellEventSource: r = "rangeSvc", dispatchWrapperEvents: n, wrapperEventSource: o = "deleteKey" } = e;
    let { cellRanges: a } = e;
    n && (i.dispatchEvent({
      type: "cellSelectionDeleteStart",
      source: o
    }), i.dispatchEvent({
      type: "rangeDeleteStart",
      source: o
    })), a || (a = this.cellRanges), a.forEach((l) => {
      this.forEachRowInRange(l, (c) => {
        const d = Ee(t, c);
        if (d)
          for (let h = 0; h < l.columns.length; h++) {
            const u = this.getColumnFromModel(l.columns[h]);
            if (!u || !u.isCellEditable(d))
              continue;
            const g = s.getDeleteValue(u, d);
            d.setDataValue(u, g, r);
          }
      });
    }), n && (i.dispatchEvent({
      type: "cellSelectionDeleteEnd",
      source: o
    }), i.dispatchEvent({
      type: "rangeDeleteEnd",
      source: o
    }));
  }
  createCellRangeFromCellRangeParams(e) {
    return this.createPartialCellRangeFromRangeParams(e, !1);
  }
  // Range service can't normally support a range without columns, but charts can
  createPartialCellRangeFromRangeParams(e, t) {
    const {
      columns: s,
      columnStart: i,
      columnEnd: r,
      rowStartIndex: n,
      rowStartPinned: o,
      rowEndIndex: a,
      rowEndPinned: l
    } = e, c = this.getColumnsFromParams(
      s,
      i,
      r
    );
    if (!c || !t && c.columns.length === 0)
      return;
    const { columns: d, startsOnTheRight: h } = c, u = this.createRowPosition(n, o), g = this.createRowPosition(a, l);
    return {
      startRow: u,
      endRow: g,
      columns: d,
      startColumn: this.getColumnFromModel(i) ?? (h ? _(d) : d[0])
    };
  }
  addCellRange(e) {
    const t = this.gos;
    if (!et(t) || !this.verifyCellRanges(t))
      return;
    this.setSelectionMode(!1);
    const s = this.createCellRangeFromCellRangeParams(e);
    s && (s.startRow && this.setNewestRangeStartCell({
      rowIndex: s.startRow.rowIndex,
      rowPinned: s.startRow.rowPinned,
      column: s.startColumn
    }), this.cellRanges.push(s), this.dispatchChangedEvent(!1, !0, s.id));
  }
  getCellRanges() {
    return this.cellRanges;
  }
  isEmpty() {
    return this.cellRanges.length === 0;
  }
  isMoreThanOneCell() {
    const e = this.cellRanges.length;
    if (e === 0)
      return !1;
    if (e > 1)
      return !0;
    const t = this.cellRanges[0], s = this.getRangeStartRow(t), i = this.getRangeEndRow(t);
    return s.rowPinned !== i.rowPinned || s.rowIndex !== i.rowIndex || t.columns.length !== 1;
  }
  areAllRangesAbleToMerge() {
    const e = /* @__PURE__ */ new Map();
    if (this.cellRanges.length <= 1)
      return !0;
    this.cellRanges.forEach((i) => {
      this.forEachRowInRange(i, (r) => {
        const n = `${r.rowPinned || "normal"}_${r.rowIndex}`, o = e.get(n), a = i.columns.map((l) => l.getId());
        if (o) {
          const l = a.filter((c) => o.indexOf(c) === -1);
          o.push(...l);
        } else
          e.set(n, a);
      });
    });
    let s;
    for (const i of e.values()) {
      const r = i.sort().join();
      if (s === void 0) {
        s = r;
        continue;
      }
      if (s !== r)
        return !1;
    }
    return !0;
  }
  removeAllCellRanges(e) {
    this.isEmpty() || (this.onDragStop(), this.cellRanges.length = 0, e || this.dispatchChangedEvent(!1, !0));
  }
  isCellInAnyRange(e) {
    return this.getCellRangeCount(e) > 0;
  }
  isCellInSpecificRange(e, t) {
    const s = t.columns !== null && t.columns.includes(e.column), i = this.isRowInRange(e.rowIndex, e.rowPinned, t);
    return s && i;
  }
  isBottomRightCell(e, t) {
    const s = this.visibleCols.allCols, i = e.columns.map((c) => s.indexOf(c)).sort((c, d) => c - d), { startRow: r, endRow: n } = e, o = Be(r, n) ? n : r, a = s.indexOf(t.column) === _(i), l = t.rowIndex === o.rowIndex && Ce(t.rowPinned) === Ce(o.rowPinned);
    return a && l;
  }
  // returns the number of ranges this cell is in
  getCellRangeCount(e) {
    return this.isEmpty() ? 0 : this.cellRanges.filter((t) => this.isCellInSpecificRange(e, t)).length;
  }
  isRowInRange(e, t, s) {
    const i = this.getRangeStartRow(s), r = this.getRangeEndRow(s), n = { rowIndex: e, rowPinned: t || null }, o = n.rowIndex === i.rowIndex && n.rowPinned == i.rowPinned, a = n.rowIndex === r.rowIndex && n.rowPinned == r.rowPinned;
    if (o || a)
      return !0;
    const l = !Be(n, i), c = Be(n, r);
    return l && c;
  }
  intersectLastRange(e) {
    if (e && this.dragging || Ln(this.gos) || this.isEmpty())
      return;
    const t = _(this.cellRanges), s = this.getRangeStartRow(t), i = this.getRangeEndRow(t), r = [];
    this.cellRanges.slice(0, -1).forEach((n) => {
      const o = this.getRangeStartRow(n), a = this.getRangeEndRow(n), l = n.columns, c = l.filter((h) => t.columns.indexOf(h) === -1);
      if (c.length === l.length) {
        r.push(n);
        return;
      }
      if (Be(i, o) || Be(a, s)) {
        r.push(n);
        return;
      }
      const d = r.length;
      if (Be(o, s)) {
        const h = {
          columns: [...l],
          startColumn: t.startColumn,
          startRow: { ...o },
          endRow: xs(this.beans, s)
        };
        r.push(h);
      }
      if (c.length > 0) {
        const h = {
          columns: c,
          startColumn: c.includes(t.startColumn) ? t.startColumn : c[0],
          startRow: this.rowMax([{ ...s }, { ...o }]),
          endRow: this.rowMin([{ ...i }, { ...a }])
        };
        r.push(h);
      }
      Be(i, a) && r.push({
        columns: [...l],
        startColumn: t.startColumn,
        startRow: dt(this.beans, i),
        endRow: { ...a }
      }), r.length - d === 1 && (r[r.length - 1].id = n.id);
    }), this.cellRanges = r, e && this.dispatchChangedEvent(!1, !0);
  }
  createRangeHighlightFeature(e, t, s) {
    e.createManagedBean(new x2(t, s));
  }
  setSelectionMode(e) {
    this.selectionMode = e ? 1 : 0;
  }
  refreshRangeStart(e) {
    const { startColumn: t, columns: s } = e, i = (l, c) => {
      const d = e.columns.filter((h) => h !== l);
      l ? (e.startColumn = l, e.columns = c ? [l, ...d] : [...d, l]) : e.columns = d;
    }, { left: r, right: n } = this.getRangeEdgeColumns(e);
    if (t === s[0] && t !== r) {
      i(r, !0);
      return;
    }
    if (t === _(s) && t === n) {
      i(n, !1);
      return;
    }
  }
  setNewestRangeStartCell(e) {
    this.newestRangeStartCell = e;
  }
  getColumnsFromParams(e, t, s) {
    const i = !e && !t && !s;
    let r, n = !1;
    return i || e ? r = this.getColumnsFromModel(i ? void 0 : e) : t && s && (r = this.calculateColumnsBetween(t, s), r && r.length && (n = r[0] !== this.getColumnFromModel(t))), r ? {
      columns: r,
      startsOnTheRight: n
    } : void 0;
  }
  createRowPosition(e, t) {
    return e != null ? { rowIndex: e, rowPinned: t } : void 0;
  }
  verifyCellRanges(e) {
    const t = Kw(e) && Ln(e) && this.cellRanges.length > 1;
    return t && F(93), !t;
  }
  forEachRowInRange(e, t) {
    const s = this.getRangeStartRow(e), i = this.getRangeEndRow(e);
    let r = s;
    for (; r && (t(r), !xe(r, i)); )
      r = dt(this.beans, r);
  }
  // as the user is dragging outside of the panel, the div starts to scroll, which in turn
  // means we are selection more (or less) cells, but the mouse isn't moving, so we recalculate
  // the selection my mimicking a new mouse event
  onBodyScroll() {
    this.dragging && this.lastMouseEvent && this.onDragging(this.lastMouseEvent);
  }
  isLastCellOfRange(e, t) {
    const { startRow: s, endRow: i } = e, r = Be(s, i) ? i : s, n = t.rowIndex === r.rowIndex && t.rowPinned === r.rowPinned, o = e.columns[0], a = _(e.columns), l = e.startColumn === o ? a : o;
    return t.column === l && n;
  }
  rowMax(e) {
    let t;
    return e.forEach((s) => {
      (t === void 0 || Be(t, s)) && (t = s);
    }), t;
  }
  rowMin(e) {
    let t;
    return e.forEach((s) => {
      (t === void 0 || Be(s, t)) && (t = s);
    }), t;
  }
  updateValuesOnMove(e) {
    var r;
    const t = ba(this.gos, e), s = t == null ? void 0 : t.cellPosition;
    if (this.cellHasChanged = !1, !s || this.lastCellHovered && Pn(s, this.lastCellHovered))
      return;
    if ((r = this.beans.editSvc) == null ? void 0 : r.isEditing(t, {
      withOpenEditor: !0
    })) {
      this.dragSvc.cancelDrag(e);
      return;
    }
    this.lastCellHovered && (this.cellHasChanged = !0), this.lastCellHovered = s;
  }
  shouldSkipCurrentColumn(e) {
    return Ke(e);
  }
  dispatchChangedEvent(e, t, s) {
    this.eventSvc.dispatchEvent({
      type: "cellSelectionChanged",
      started: e,
      finished: t,
      id: s
    }), this.eventSvc.dispatchEvent({
      type: "rangeSelectionChanged",
      started: e,
      finished: t,
      id: s
    });
  }
  getColumnFromModel(e) {
    return typeof e == "string" ? this.colModel.getCol(e) : e;
  }
  getColumnsFromModel(e) {
    const { gos: t, visibleCols: s } = this, i = t.get("rowNumbers");
    (!e || this.selectionMode === 1) && (e = s.allCols);
    const r = [];
    for (const n of e) {
      const o = this.getColumnFromModel(n);
      !o || i && this.shouldSkipCurrentColumn(o) || r.push(o);
    }
    return r.length ? r : void 0;
  }
  calculateColumnsBetween(e, t) {
    const s = this.visibleCols.allCols, i = this.getColumnFromModel(e), r = this.getColumnFromModel(t), n = i === r, o = s.indexOf(i);
    if (o < 0) {
      F(178, { colId: i.getId() });
      return;
    }
    const a = n ? o : s.indexOf(r);
    if (a < 0) {
      F(178, { colId: r.getId() });
      return;
    }
    if (n || this.selectionMode === 1)
      return this.getColumnsFromModel([i]);
    const l = Math.min(o, a), c = l === o ? a : o, d = [];
    for (let h = l; h <= c; h++)
      d.push(s[h]);
    return this.getColumnsFromModel(d);
  }
  focusCellOnNewColumn(e, t) {
    const { focusSvc: s } = this.beans, i = s.getFocusedCell();
    i && this.isCellInSpecificRange(i, e) && s.setFocusedCell({
      ...i,
      column: t,
      forceBrowserFocus: !0,
      preventScrollOnBrowserFocus: !0
    });
  }
  focusCellOnNewRow(e, t) {
    const { focusSvc: s } = this.beans, i = s.getFocusedCell();
    i && this.isCellInSpecificRange(i, e) && s.setFocusedCell({
      ...t,
      column: i.column,
      forceBrowserFocus: !0,
      preventScrollOnBrowserFocus: !0
    });
  }
  createDragListenerFeature(e) {
    return new S2(e);
  }
  createCellRangeFeature(e, t) {
    return new y2(e, t);
  }
}, hv = {
  moduleName: "CellSelection",
  version: Y,
  beans: [F2],
  dynamicBeans: { fillHandle: a2, rangeHandle: l2 },
  apiFunctions: {
    getCellRanges: d2,
    addCellRange: h2,
    clearRangeSelection: Qu,
    clearCellSelection: Qu
  },
  dependsOn: [ie, xa, Sd],
  css: [c2]
}, R2 = {
  tag: "div",
  cls: "ag-loading",
  children: [
    { tag: "span", ref: "eLoadingIcon", cls: "ag-loading-icon" },
    { tag: "span", ref: "eLoadingText", cls: "ag-loading-text" }
  ]
}, P2 = class extends D {
  constructor() {
    super(R2), this.eLoadingIcon = x, this.eLoadingText = x;
  }
  init(e) {
    e.node.failedLoad ? this.setupFailed() : this.setupLoading();
  }
  setupFailed() {
    this.eLoadingText.textContent = this.getLocaleTextFunc()("loadingError", "ERR");
  }
  setupLoading() {
    const e = N("groupLoading", this.beans, null);
    e && this.eLoadingIcon.appendChild(e), this.eLoadingText.textContent = this.getLocaleTextFunc()("loadingOoo", "Loading");
  }
  refresh(e) {
    return !1;
  }
}, E2 = {
  moduleName: "LoadingCellRenderer",
  version: Y,
  userComponents: {
    agLoadingCellRenderer: P2
  },
  icons: {
    // rotating spinner shown by the loading cell renderer
    groupLoading: "loading"
  },
  dependsOn: [ie]
};
function T2(e) {
  return e.colModel.isPivotMode();
}
function M2(e, t, s) {
  var i;
  return ((i = e.pivotResultCols) == null ? void 0 : i.lookupPivotResultCol(t, s)) ?? null;
}
function D2(e, t) {
  var s;
  (s = e.valueColsSvc) == null || s.setColumns(t, "api");
}
function A2(e) {
  var t;
  return ((t = e.valueColsSvc) == null ? void 0 : t.columns) ?? [];
}
function I2(e, t) {
  var s;
  (s = e.valueColsSvc) == null || s.removeColumns(t, "api");
}
function L2(e, t) {
  var s;
  (s = e.valueColsSvc) == null || s.addColumns(t, "api");
}
function k2(e, t) {
  var s;
  (s = e.pivotColsSvc) == null || s.setColumns(t, "api");
}
function G2(e, t) {
  var s;
  (s = e.pivotColsSvc) == null || s.removeColumns(t, "api");
}
function O2(e, t) {
  var s;
  (s = e.pivotColsSvc) == null || s.addColumns(t, "api");
}
function V2(e) {
  var t;
  return ((t = e.pivotColsSvc) == null ? void 0 : t.columns) ?? [];
}
function B2(e, t) {
  var s;
  (s = e.pivotResultCols) == null || s.setPivotResultCols(t, "api");
}
function N2(e) {
  var s;
  const t = (s = e.pivotResultCols) == null ? void 0 : s.getPivotResultCols();
  return t ? t.list : null;
}
var eg = "PivotRowTotal_", H2 = ({ headerName: e }, { headerName: t }) => e && !t ? 1 : !e && t ? -1 : !e && !t ? 0 : e < t ? -1 : e > t ? 1 : 0, z2 = (e) => (t, s) => e(t.headerName, s.headerName), W2 = class extends R {
  constructor() {
    super(...arguments), this.beanName = "pivotColDefSvc";
  }
  wireBeans(e) {
    this.colModel = e.colModel, this.pivotColsSvc = e.pivotColsSvc, this.valueColsSvc = e.valueColsSvc, this.colNames = e.colNames;
  }
  postConstruct() {
    const e = () => this.gos.get("serverSidePivotResultFieldSeparator") ?? "_";
    this.fieldSeparator = e(), this.addManagedPropertyListener("serverSidePivotResultFieldSeparator", () => {
      this.fieldSeparator = e();
    });
    const t = () => this.gos.get("pivotDefaultExpanded");
    this.pivotDefaultExpanded = t(), this.addManagedPropertyListener("pivotDefaultExpanded", () => {
      this.pivotDefaultExpanded = t();
    });
  }
  createPivotColumnDefs(e) {
    const t = this.createPivotColumnsFromUniqueValues(e);
    function s(r, n = []) {
      return r.forEach((o) => {
        o.children !== void 0 ? s(o.children, n) : n.push(o);
      }), n;
    }
    const i = s(t);
    return this.addRowGroupTotals(t, i), this.addExpandablePivotGroups(t, i), this.addPivotTotalsToGroups(t, i), t;
  }
  createPivotColumnsFromUniqueValues(e) {
    var r;
    const t = ((r = this.pivotColsSvc) == null ? void 0 : r.columns) ?? [], s = t.length;
    return this.recursivelyBuildGroup(
      0,
      e,
      [],
      s,
      t
    );
  }
  recursivelyBuildGroup(e, t, s, i, r) {
    var c;
    if (e >= i)
      return this.buildMeasureCols(s);
    const { pivotComparator: n } = r[e].getColDef(), o = n ? z2(n) : H2, a = (c = this.valueColsSvc) == null ? void 0 : c.columns;
    if ((a == null ? void 0 : a.length) === 1 && this.gos.get("removePivotHeaderRowWhenSingleValueColumn") && e === i - 1) {
      const d = [];
      for (const h of t.keys()) {
        const u = [...s, h], g = this.createColDef(a[0], h, u);
        g.columnGroupShow = "open", d.push(g);
      }
      return d.sort(o), d;
    }
    const l = [];
    for (const d of t.keys()) {
      const h = this.pivotDefaultExpanded === -1 || e < this.pivotDefaultExpanded, u = [...s, d];
      l.push({
        children: this.recursivelyBuildGroup(
          e + 1,
          t.get(d),
          u,
          i,
          r
        ),
        headerName: d,
        pivotKeys: u,
        columnGroupShow: "open",
        openByDefault: h,
        groupId: this.generateColumnGroupId(u)
      });
    }
    return l.sort(o), l;
  }
  buildMeasureCols(e) {
    var s;
    const t = ((s = this.valueColsSvc) == null ? void 0 : s.columns) ?? [];
    return t.length === 0 ? [this.createColDef(null, "-", e)] : t.map((i) => {
      const r = this.colNames.getDisplayNameForColumn(i, "header"), n = this.createColDef(i, r, e);
      return n.columnGroupShow = "open", n;
    });
  }
  addExpandablePivotGroups(e, t) {
    const s = this.gos.get("suppressExpandablePivotGroups");
    if (s || this.gos.get("pivotColumnGroupTotals"))
      return;
    const i = (r, n, o) => {
      if ("children" in r) {
        const { valueColsSvc: c } = this, { columns: d = [] } = c ?? {}, h = /* @__PURE__ */ new Map();
        r.children.forEach((p) => {
          i(p, n, h);
        });
        const u = !r.children.some((p) => p.children), g = u && d.length === 1 && this.gos.get("removePivotHeaderRowWhenSingleValueColumn");
        d.forEach((p) => {
          const f = this.colNames.getDisplayNameForColumn(p, "header"), m = this.createColDef(p, f, r.pivotKeys);
          m.pivotTotalColumnIds = h.get(p.getColId()), m.columnGroupShow = s ? "open" : "closed", m.aggFunc = p.getAggFunc(), (!u || g) && (r.children.push(m), n.push(m));
        }), this.merge(o, h);
        return;
      }
      if (!r.pivotValueColumn)
        return;
      const a = r.pivotValueColumn.getColId();
      o.has(a) ? o.get(a).push(r.colId) : o.set(a, [r.colId]);
    };
    e.forEach((r) => {
      i(r, t, /* @__PURE__ */ new Map());
    });
  }
  addPivotTotalsToGroups(e, t) {
    var n;
    if (!this.gos.get("pivotColumnGroupTotals"))
      return;
    const s = this.gos.get("pivotColumnGroupTotals") === "after", i = (n = this.valueColsSvc) == null ? void 0 : n.columns, r = i == null ? void 0 : i.map((o) => o.getAggFunc());
    if (!(!r || r.length < 1 || !this.sameAggFuncs(r)) && i) {
      const o = i[0];
      e.forEach((a) => {
        this.recursivelyAddPivotTotal(a, t, o, s);
      });
    }
  }
  recursivelyAddPivotTotal(e, t, s, i) {
    const r = e;
    if (!r.children) {
      const o = e;
      return o.colId ? [o.colId] : null;
    }
    let n = [];
    if (r.children.forEach((o) => {
      const a = this.recursivelyAddPivotTotal(o, t, s, i);
      a && (n = n.concat(a));
    }), r.children.length > 1) {
      const a = this.getLocaleTextFunc()("pivotColumnGroupTotals", "Total"), l = this.createColDef(s, a, e.pivotKeys, !0);
      l.pivotTotalColumnIds = n, l.aggFunc = s.getAggFunc(), l.columnGroupShow = this.gos.get("suppressExpandablePivotGroups") ? "open" : void 0;
      const c = e.children;
      i ? c.push(l) : c.unshift(l), t.push(l);
    }
    return n;
  }
  addRowGroupTotals(e, t) {
    var o;
    if (!this.gos.get("pivotRowTotals"))
      return;
    const s = this.gos.get("pivotRowTotals") === "after", r = (((o = this.valueColsSvc) == null ? void 0 : o.columns) ?? []).slice();
    s || r.reverse();
    const n = r.length > 1 || !this.gos.get("removePivotHeaderRowWhenSingleValueColumn");
    for (let a = 0; a < r.length; a++) {
      const l = r[a], c = this.colNames.getDisplayNameForColumn(l, "header"), d = this.createColDef(l, c, []), h = [];
      for (let g = 0; g < t.length; g++) {
        const p = t[g];
        p.pivotValueColumn === l && h.push(p.colId);
      }
      d.pivotTotalColumnIds = h, d.colId = eg + d.colId;
      const u = n ? {
        children: [d],
        pivotKeys: [],
        groupId: `${eg}_pivotGroup_${l.getColId()}`
      } : d;
      t.push(d), s ? e.push(u) : e.unshift(u);
    }
  }
  /**
   * Recreate a pivot colDef to update from a changed valueColumn colDef
   */
  recreateColDef(e) {
    var d;
    const {
      pivotValueColumn: t,
      headerName: s,
      pivotKeys: i,
      pivotTotalColumnIds: r,
      columnGroupShow: n,
      colId: o,
      valueGetter: a,
      aggFunc: l
    } = e;
    if (!t)
      return e;
    const c = this.createColDef(t, s, i, !!r);
    return c.columnGroupShow = n, c.colId = o, c.valueGetter = a, c.aggFunc = l, c.pivotTotalColumnIds = r, (d = this.gos.get("processPivotResultColDef")) == null || d(c), c;
  }
  createColDef(e, t, s, i = !1) {
    const r = {};
    if (e) {
      const n = e.getColDef();
      Object.assign(r, n), r.hide = !1;
    }
    return r.headerName = t, r.colId = this.generateColumnId(
      s || [],
      e && !i ? e.getColId() : ""
    ), r.field = r.colId, r.valueGetter = (n) => {
      var o;
      return (o = n.data) == null ? void 0 : o[n.colDef.field];
    }, r.pivotKeys = s, r.pivotValueColumn = e, r.filter === !0 && (r.filter = "agNumberColumnFilter"), r;
  }
  sameAggFuncs(e) {
    if (e.length == 1)
      return !0;
    for (let t = 1; t < e.length; t++)
      if (e[t] !== e[0])
        return !1;
    return !0;
  }
  merge(e, t) {
    t.forEach((s, i) => {
      const n = [...e.has(i) ? e.get(i) : [], ...s];
      e.set(i, n);
    });
  }
  generateColumnGroupId(e) {
    var s;
    return `pivotGroup_${(((s = this.pivotColsSvc) == null ? void 0 : s.columns) ?? []).map((i) => i.getColId()).join("-")}_${e.join("-")}`;
  }
  generateColumnId(e, t) {
    var i;
    return `pivot_${(((i = this.pivotColsSvc) == null ? void 0 : i.columns) ?? []).map((r) => r.getColId()).join("-")}_${e.join("-")}_${t}`;
  }
  /**
   * Used by the SSRM to create secondary columns from provided fields
   * @param fields
   */
  createColDefsFromFields(e) {
    const t = /* @__PURE__ */ new Map();
    for (let r = 0; r < e.length; r++) {
      const o = e[r].split(this.fieldSeparator);
      let a = t;
      for (let l = 0; l < o.length; l++) {
        const c = o[l];
        let d = a.get(c);
        d || (d = /* @__PURE__ */ new Map(), a.set(c, d)), a = d;
      }
    }
    const s = (r, n, o, a) => {
      const l = [];
      for (const [h, u] of o) {
        const g = s(`${r}${this.fieldSeparator}${h}`, h, u, a + 1);
        l.push(g);
      }
      if (l.length === 0) {
        const h = this.colModel.getColDefCol(n);
        if (h) {
          const g = this.colNames.getDisplayNameForColumn(h, "header") ?? n, p = this.createColDef(h, g, void 0, !1);
          return p.colId = r, p.aggFunc = h.getAggFunc(), p.valueGetter = (f) => {
            var m;
            return (m = f.data) == null ? void 0 : m[r];
          }, p;
        }
        return {
          colId: r,
          headerName: n,
          // this is to support using pinned rows, normally the data will be extracted from the aggData object using the colId
          // however pinned rows still access the data object by field, this prevents values with dots from being treated as complex objects
          valueGetter: (g) => {
            var p;
            return (p = g.data) == null ? void 0 : p[r];
          }
        };
      }
      return this.gos.get("removePivotHeaderRowWhenSingleValueColumn") && l.length === 1 && "colId" in l[0] ? (l[0].headerName = n, l[0]) : {
        openByDefault: this.pivotDefaultExpanded === -1 || a < this.pivotDefaultExpanded,
        groupId: r,
        headerName: n,
        children: l
      };
    }, i = [];
    for (const [r, n] of t) {
      const o = s(r, r, n, 0);
      i.push(o);
    }
    return i;
  }
}, _2 = class extends R {
  constructor() {
    super(...arguments), this.beanName = "pivotResultCols";
  }
  wireBeans(e) {
    this.colModel = e.colModel, this.visibleCols = e.visibleCols;
  }
  destroy() {
    var e;
    Ht(this.beans, (e = this.pivotResultCols) == null ? void 0 : e.tree), super.destroy();
  }
  isPivotResultColsPresent() {
    return this.pivotResultCols != null;
  }
  lookupPivotResultCol(e, t) {
    if (this.pivotResultCols == null)
      return null;
    const s = this.colModel.getColDefCol(t);
    let i = null;
    return this.pivotResultCols.list.forEach((r) => {
      const n = r.getColDef().pivotKeys, o = r.getColDef().pivotValueColumn;
      Xe(n, e) && o === s && (i = r);
    }), i;
  }
  getPivotResultCols() {
    return this.pivotResultCols;
  }
  getPivotResultCol(e) {
    return this.pivotResultCols ? this.colModel.getColFromCollection(e, this.pivotResultCols) : null;
  }
  setPivotResultCols(e, t) {
    var s, i;
    if (this.colModel.ready && !(e == null && this.pivotResultCols == null)) {
      if (e) {
        this.processPivotResultColDef(e);
        const n = (t === "api" ? cp : ib)(
          this.beans,
          e,
          !1,
          ((s = this.pivotResultCols) == null ? void 0 : s.tree) || this.previousPivotResultCols || void 0,
          t
        );
        Ht(this.beans, (i = this.pivotResultCols) == null ? void 0 : i.tree, n.columnTree);
        const o = n.columnTree, a = n.treeDepth, l = qc(o), c = {};
        this.pivotResultCols = { tree: o, treeDepth: a, list: l, map: c }, this.pivotResultCols.list.forEach((h) => this.pivotResultCols.map[h.getId()] = h);
        const d = !!this.previousPivotResultCols;
        this.previousPivotResultCols = null, this.colModel.refreshCols(!d);
      } else
        this.previousPivotResultCols = this.pivotResultCols ? this.pivotResultCols.tree : null, this.pivotResultCols = null, this.colModel.refreshCols(!1);
      this.visibleCols.refresh(t);
    }
  }
  processPivotResultColDef(e) {
    const t = this.gos.get("processPivotResultColDef"), s = this.gos.get("processPivotResultColGroupDef");
    if (!t && !s)
      return;
    const i = (r) => {
      r.forEach((n) => {
        if (A(n.children)) {
          const a = n;
          s && s(a), i(a.children);
        } else
          t && t(n);
      });
    };
    e && i(e);
  }
}, tg = "Exceeded maximum allowed pivot column count.", po = (e) => {
  const t = {};
  return e.forEach((s, i) => t[i] = s instanceof Map ? po(s) : s), t;
}, U2 = class extends R {
  constructor() {
    super(...arguments), this.beanName = "pivotStage", this.refreshProps = /* @__PURE__ */ new Set([
      "removePivotHeaderRowWhenSingleValueColumn",
      "pivotRowTotals",
      "pivotColumnGroupTotals",
      "suppressExpandablePivotGroups"
    ]), this.step = "pivot", this.uniqueValues = /* @__PURE__ */ new Map(), this.lastTimeFailed = !1, this.maxUniqueValues = -1, this.currentUniqueCount = 0;
  }
  wireBeans(e) {
    this.valueSvc = e.valueSvc, this.colModel = e.colModel, this.pivotResultCols = e.pivotResultCols, this.rowGroupColsSvc = e.rowGroupColsSvc, this.valueColsSvc = e.valueColsSvc, this.pivotColsSvc = e.pivotColsSvc, this.pivotColDefSvc = e.pivotColDefSvc;
  }
  execute(e) {
    const t = e.changedPath;
    this.colModel.isPivotActive() ? this.executePivotOn(t) : this.executePivotOff(t);
  }
  executePivotOff(e) {
    this.aggregationColumnsHashLastTime = null, this.uniqueValues = /* @__PURE__ */ new Map(), this.pivotResultCols.isPivotResultColsPresent() && (this.pivotResultCols.setPivotResultCols(null, "rowModelUpdated"), e && (e.active = !1));
  }
  executePivotOn(e) {
    var C, v, w;
    const t = ((C = this.valueColsSvc) == null ? void 0 : C.columns.length) ?? 1, s = this.gos.get("pivotMaxGeneratedColumns");
    this.maxUniqueValues = s === -1 ? -1 : s / t;
    let i;
    try {
      i = this.bucketUpRowNodes(e);
    } catch (b) {
      if (b.message === tg) {
        this.pivotResultCols.setPivotResultCols([], "rowModelUpdated"), this.eventSvc.dispatchEvent({
          type: "pivotMaxColumnsExceeded",
          message: b.message
        }), this.lastTimeFailed = !0;
        return;
      }
      throw b;
    }
    const r = this.setUniqueValues(i), n = ((v = this.valueColsSvc) == null ? void 0 : v.columns) ?? [], o = n.map((b) => `${b.getId()}-${b.getColDef().headerName}`).join("#"), a = n.map((b) => b.getAggFunc().toString()).join("#"), l = this.aggregationColumnsHashLastTime !== o, c = this.aggregationFuncsHashLastTime !== a;
    this.aggregationColumnsHashLastTime = o, this.aggregationFuncsHashLastTime = a;
    const d = (((w = this.rowGroupColsSvc) == null ? void 0 : w.columns) ?? []).map((b) => b.getId()).join("#"), h = d !== this.groupColumnsHashLastTime;
    this.groupColumnsHashLastTime = d;
    const u = this.gos.get("pivotRowTotals"), g = this.gos.get("pivotColumnGroupTotals"), p = this.gos.get("suppressExpandablePivotGroups"), f = this.gos.get("removePivotHeaderRowWhenSingleValueColumn"), m = u !== this.pivotRowTotalsLastTime || g !== this.pivotColumnGroupTotalsLastTime || p !== this.suppressExpandablePivotGroupsLastTime || f !== this.removePivotHeaderRowWhenSingleValueColumnLastTime;
    if (this.pivotRowTotalsLastTime = u, this.pivotColumnGroupTotalsLastTime = g, this.suppressExpandablePivotGroupsLastTime = p, this.removePivotHeaderRowWhenSingleValueColumnLastTime = f, this.lastTimeFailed || r || l || h || c || m) {
      const b = this.pivotColDefSvc.createPivotColumnDefs(this.uniqueValues);
      this.pivotResultCols.setPivotResultCols(b, "rowModelUpdated"), e && (e.active = !1);
    }
    this.lastTimeFailed = !1;
  }
  setUniqueValues(e) {
    const t = JSON.stringify(po(this.uniqueValues)), s = JSON.stringify(po(e));
    return t !== s ? (this.uniqueValues = e, !0) : !1;
  }
  bucketUpRowNodes(e) {
    this.currentUniqueCount = 0;
    const t = /* @__PURE__ */ new Map();
    e.forEachChangedNodeDepthFirst((i) => {
      i.leafGroup && (i.childrenMapped = null);
    });
    const s = (i) => {
      var r;
      i.leafGroup ? this.bucketRowNode(i, t) : (r = i.childrenAfterFilter) == null || r.forEach(s);
    };
    return e.executeFromRootNode(s), t;
  }
  bucketRowNode(e, t) {
    var i;
    const s = (i = this.pivotColsSvc) == null ? void 0 : i.columns;
    (s == null ? void 0 : s.length) === 0 ? e.childrenMapped = null : e.childrenMapped = po(
      this.bucketChildren(e.childrenAfterFilter, s, 0, t)
    ), e.sibling && (e.sibling.childrenMapped = e.childrenMapped);
  }
  bucketChildren(e, t = [], s, i) {
    const r = /* @__PURE__ */ new Map(), n = t[s];
    if (e.forEach((a) => {
      let l = this.valueSvc.getKeyForNode(n, a);
      if (ee(l) && (l = ""), !i.get(l)) {
        this.currentUniqueCount += 1, i.set(l, /* @__PURE__ */ new Map());
        const c = this.maxUniqueValues !== -1, d = this.currentUniqueCount > this.maxUniqueValues;
        if (c && d)
          throw Error(tg);
      }
      r.has(l) || r.set(l, []), r.get(l).push(a);
    }), s === t.length - 1)
      return r;
    const o = /* @__PURE__ */ new Map();
    for (const a of r.keys())
      o.set(
        a,
        this.bucketChildren(r.get(a), t, s + 1, i.get(a))
      );
    return o;
  }
}, uv = {
  moduleName: "SharedPivot",
  version: Y,
  beans: [_2, W2, XC],
  apiFunctions: {
    isPivotMode: T2,
    getPivotResultColumn: M2,
    setValueColumns: D2,
    getValueColumns: A2,
    removeValueColumns: I2,
    addValueColumns: L2,
    setPivotColumns: k2,
    removePivotColumns: G2,
    addPivotColumns: O2,
    getPivotColumns: V2,
    setPivotResultColumns: B2,
    getPivotResultColumns: N2
  },
  dependsOn: [nv, Bf]
}, $2 = {
  moduleName: "Pivot",
  version: Y,
  rowModels: ["clientSide"],
  beans: [U2],
  dependsOn: [uv, ov, ka]
}, K2 = (e) => {
  if (typeof e != "string" || !e.length)
    return [];
  const t = e.split(".");
  return t.includes("__proto__") ? [] : t;
}, gv = (e) => {
  const t = K2(e);
  let s = null;
  const i = t.length - 1;
  return i === 0 ? s = (r) => r == null ? void 0 : r[e] : i > 0 ? s = (r) => {
    let n = r;
    for (let o = 0; o <= i && n !== null && n !== void 0; ++o)
      if (n = n[t[o]], o < i && typeof n != "object" && n !== void 0)
        return null;
    return n;
  } : s = () => {
  }, s.path = e, s;
}, j2 = class extends Rf {
  constructor() {
    super(...arguments), this.beanName = "csrmChildrenTreeNodeSvc", this.childrenGetter = null;
  }
  destroy() {
    super.destroy(), this.childrenGetter = null;
  }
  extractRowData() {
    var e, t;
    return (t = (e = this.rootNode) == null ? void 0 : e.childrenAfterGroup) == null ? void 0 : t.map(({ data: s }) => s);
  }
  activate(e) {
    const t = this.childrenGetter, s = this.gos.get("treeDataChildrenField") ?? null;
    (!t || t.path !== s) && (this.childrenGetter = gv(s)), super.activate(e);
  }
  deactivate() {
    this.childrenGetter = null, super.deactivate();
  }
  updateRowData(e, t) {
    return F(268), {
      changedRowNodes: t,
      rowNodeTransaction: { add: [], remove: [], update: [] },
      rowsInserted: !1
    };
  }
  loadNewRowData(e) {
    const t = this.rootNode, s = this.childrenGetter, i = /* @__PURE__ */ new Map(), r = [];
    t.allLeafChildren = r;
    const n = (o, a) => {
      let l = i.get(a);
      if (l !== void 0) {
        j(2, { nodeId: l.id });
        return;
      }
      l = this.createRowNode(a, r.length), l.treeParent = o, i.set(a, l), r.push(l);
      const c = s == null ? void 0 : s(a);
      if (c)
        for (let d = 0, h = c.length; d < h; ++d)
          n(l, c[d]);
    };
    for (let o = 0, a = e.length; o < a; ++o)
      n(t, e[o]);
  }
  setImmutableRowData(e, t) {
    this.dispatchRowDataUpdateStartedEvent(t);
    const s = this.gos, i = this.rootNode, r = this.childrenGetter, n = es(s), o = !s.get("suppressMaintainUnsortedOrder"), a = /* @__PURE__ */ new Map(), l = new Di(!1, i);
    e.changedPath = l;
    const c = e.changedRowNodes, d = i.allLeafChildren, h = [], u = [];
    let g = !1, p = !1;
    const f = (v, w, b) => {
      const y = w == null ? void 0 : w.length;
      let P = !0, E = -1;
      for (let M = 0; M < y; ++M) {
        const T = m(v, w[M], b);
        o && T >= 0 && (T < E && (P = !1), E = T);
      }
      P || (g = !0);
    }, m = (v, w, b) => {
      let y = a.get(w);
      if (y !== void 0)
        return F(2, { nodeId: y.id }), -1;
      const P = n({ data: w, level: b });
      if (y = this.getRowNode(P), y) {
        let T = !1;
        y.data !== w && (T = !0, y.updateData(w), !y.selectable && y.isSelected() && u.push(y)), y.treeParent !== v && (y.treeParent = v, T = !0), T && (p = !0, c.update(y));
      } else
        y = this.createRowNode(w, -1), y.treeParent = v, p = !0, c.add(y);
      a.set(w, y);
      let E;
      o ? (E = y.sourceRowIndex, y.sourceRowIndex = h.push(y) - 1) : E = -1;
      const M = r == null ? void 0 : r(w);
      return M && f(y, M, b + 1), E;
    };
    if (f(i, t, 0), d) {
      const v = this.beans.pinnedRowModel;
      for (let w = 0, b = d.length; w < b; ++w) {
        const y = d[w];
        if (!a.has(y.data)) {
          y.treeParent = null, y.treeNodeFlags = 0;
          const P = y.pinnedSibling;
          P && (v == null || v.pinRow(P, null)), y.clearRowTopAndRowIndex(), this.rowNodeDeleted(y), y.isSelected() && u.push(y), c.remove(y);
        }
      }
    }
    if (!o) {
      if (d) {
        const v = c.removals;
        for (let w = 0, b = d.length; w < b; ++w) {
          const y = d[w];
          v.has(y) || (y.sourceRowIndex = h.push(y) - 1);
        }
      }
      for (const v of c.adds)
        v.sourceRowIndex = h.push(v) - 1;
    }
    i.allLeafChildren = h, u.length && this.deselectNodes(u);
    const C = i.sibling;
    C && (C.allLeafChildren = h), (p || g) && (e.rowDataUpdated = !0, e.rowNodesOrderChanged || (e.rowNodesOrderChanged = g));
  }
}, Je = 2147483648, at = 1073741824, Yn = 536870912, Hs = 268435456, kr = 268435455, qn = String.fromCharCode(31, 4096 + Math.random() * 61440, 4096 + Math.random() * 61440, 8291), Dl = 4, Y2 = class extends R {
  constructor() {
    super(...arguments), this.groupColsIds = "", this.groupColsChanged = !0, this.parentIdGetter = null, this.fillerNodesById = null, this.nodesToUnselect = null;
  }
  destroy() {
    super.destroy(), this.groupColsIds = "", this.parentIdGetter = null, this.fillerNodesById = null, this.nodesToUnselect = null;
  }
  reset() {
    this.destroyFillerRows(), this.deselectHiddenNodes(!1), this.groupColsIds = "", this.groupColsChanged = !0, this.parentIdGetter = null;
  }
  getNode(e) {
    var t;
    return (t = this.fillerNodesById) == null ? void 0 : t.get(e);
  }
  execute(e, t) {
    const { changedRowNodes: s, changedPath: i, afterColumnsChanged: r } = e;
    this.checkGroupColsUpdated(r);
    const n = e.rowNode, o = i != null && i.active ? i : void 0, a = !s && !o, l = !!s && this.flagUpdatedNodes(s);
    (a || l) && (t === "treeNested" ? this.loadNested(e, a) : t === "treeSelfRef" ? this.loadSelfRef(e, a) : this.loadDataPath(e, a));
    const c = this.initRowsParents(n);
    this.destroyFillerRows(), this.initRowsChildrenSize(n);
    let d = this.preprocessRows(n);
    const h = c || (d & Je) !== 0;
    d &= ~Je;
    const u = this.traverseRoot(n, o);
    return d > 0 && d !== u && (this.handleCycles(n), this.traverseRoot(n, o)), n.treeNodeFlags = 0, this.deselectHiddenNodes(c || a), h;
  }
  flagUpdatedNodes(e) {
    const { adds: t, updates: s, removals: i } = e;
    let r = i.size > 0;
    if (t.size > 0) {
      r = !0;
      for (const n of t)
        n.treeNodeFlags |= at;
    }
    if (s.size > 0) {
      r = !0;
      for (const n of s)
        n.treeNodeFlags |= at;
    }
    return r;
  }
  initRowsParents(e) {
    const t = e.allLeafChildren, s = t.length;
    let i = !1;
    for (let r = 0; r < s; ++r) {
      let n = t[r];
      for (; ; ) {
        const o = n.parent, a = n.treeParent;
        if (a === null) {
          o && (i = !0, this.hideRow(n));
          break;
        }
        let l = a.treeNodeFlags + 1;
        if (o !== a && (i = !0, l |= at, n.parent = a, o)) {
          const c = o.treeNodeFlags;
          c & Hs && !(l & Hs) && a.treeParent !== null && !a.data && (a.expanded = o.expanded, l |= Hs), o.treeNodeFlags = c | at;
        }
        if (a.data || a.treeNodeFlags & Yn || a.treeParent === null) {
          a.treeNodeFlags = l;
          break;
        }
        a.treeNodeFlags = l | Yn | n.treeNodeFlags & at, n = a;
      }
    }
    return i;
  }
  destroyFillerRows() {
    const e = this.fillerNodesById;
    if (e) {
      for (const t of e.values())
        (t.treeParent === null || !(t.treeNodeFlags & kr)) && (e.delete(t.id), this.hideRow(t));
      e.size === 0 && (this.fillerNodesById = null);
    }
  }
  initRowsChildrenSize(e) {
    this.initRowChildrenSize(e);
    const t = e.allLeafChildren, s = t.length;
    for (let r = 0; r < s; ++r)
      this.initRowChildrenSize(t[r]);
    const i = this.fillerNodesById;
    if (i !== null)
      for (const r of i.values())
        this.initRowChildrenSize(r);
  }
  initRowChildrenSize(e) {
    let { childrenAfterGroup: t, allLeafChildren: s, treeNodeFlags: i } = e;
    const r = t == null ? void 0 : t.length, n = i & kr;
    if (e.treeNodeFlags = i & ~kr | ((r || 0) !== n ? Je : 0), n === 0 && e.level >= 0) {
      if (t !== ps) {
        e.childrenAfterGroup = ps;
        const o = e.sibling;
        o && (o.childrenAfterGroup = ps);
      }
    } else if (r !== n || t === s)
      if (!t || t === ps || t === s) {
        e.childrenAfterGroup = t = new Array(n);
        const o = e.sibling;
        o && (o.childrenAfterGroup = t);
      } else
        t.length = n;
  }
  preprocessRows(e) {
    const t = e.allLeafChildren, s = t.length, i = this.groupColsChanged;
    let r = 0, n = !1;
    for (let o = 0; o < s; ++o) {
      let a = t[o];
      for (; ; ) {
        const l = a.treeParent;
        if (l === null)
          break;
        ++r;
        let c = l.treeNodeFlags;
        const d = l.childrenAfterGroup, h = c & kr;
        if (c = c & ~kr | h + 1, (c & Je || d[h] !== a) && (c |= Je, d[h] = a, n = !0), l.treeNodeFlags = c, (!a.groupData || i) && (a.treeNodeFlags |= at, this.setGroupData(a, a.key)), l.data || !(l.treeNodeFlags & Yn) || l.treeParent === null)
          break;
        l.treeNodeFlags = c & ~Yn | a.treeNodeFlags & at, a = l;
      }
    }
    return r | (n ? Je : 0);
  }
  traverseRoot(e, t) {
    let s = 0;
    const i = e.childrenAfterGroup;
    for (let r = 0, n = i.length; r < n; ++r)
      s += this.traverse(i[r], 0, !1, t);
    return s & ~Je;
  }
  /**
   * After all the rows are initialized and treeParent is set and childrenAfterGroup is filled,
   * we traverse the tree to finalize it
   * @returns the number of leaf nodes processed, which is used to detect cycles in the tree, and a flag set if leaf children were changed.
   */
  traverse(e, t, s, i) {
    var c;
    const r = e.childrenAfterGroup, n = r.length;
    let o = e.treeNodeFlags;
    e.treeNodeFlags = o & Hs, e.level = t, e.group !== !!n ? (DC(e, this.beans, !!n), o |= at) : e.hasChildren() !== !!n && (e.updateHasChildren(), o |= at), o & (at | Je) && (i == null || i.addParentNode(e)), n !== 0 || e.master ? o & Hs || (e.treeNodeFlags |= Hs, e.expanded = Yd(this.beans, e, t)) : (e.expanded && (e.expanded = !1), o & Hs && (e.treeNodeFlags &= ~Hs)), s && e.rowIndex !== null && e.clearRowTopAndRowIndex(), s || (s = e.expanded === !1), ++t, o &= Je;
    let l = 0;
    for (let d = 0; d < n; ++d) {
      const h = r[d], u = this.traverse(h, t, s, i);
      o = o + (u & ~Je) | u & Je, l += (((c = h.allLeafChildren) == null ? void 0 : c.length) || 0) + (h.data ? 1 : 0);
    }
    return this.updateAllLeafChildren(e, l, (o & Je) !== 0) ? (o | Je) + 1 : (o & ~Je) + 1;
  }
  updateAllLeafChildren(e, t, s) {
    let i = e.allLeafChildren, r = ((i == null ? void 0 : i.length) || 0) !== t;
    if (t === 0) {
      if (i !== null) {
        e.allLeafChildren = null;
        const n = e.sibling;
        n && (n.allLeafChildren = null);
      }
    } else if (r || s) {
      if (i)
        r && (i.length = t);
      else {
        e.allLeafChildren = i = new Array(t);
        const o = e.sibling;
        o && (o.allLeafChildren = i);
      }
      const n = e.childrenAfterGroup;
      for (let o = 0, a = 0, l = n.length; o < l; ++o) {
        const c = n[o];
        c.data && ((r || (r = i[a] !== c)) && (i[a] = c), ++a);
        const d = c.allLeafChildren;
        if (d)
          for (let h = 0, u = d.length; h < u; ++h, ++a) {
            const g = d[h];
            (r || (r = i[a] !== g)) && (i[a] = g);
          }
      }
    }
    return r;
  }
  /** Handle cycles in a tree. Is not optimal for performance but this is an edge case that shouldn't happen as is a warning. */
  handleCycles(e) {
    const t = /* @__PURE__ */ new Set(), s = (r) => t.has(r) ? !1 : (t.add(r), r.childrenAfterGroup.forEach(s), !0);
    s(e);
    const i = e.childrenAfterGroup;
    i.length = 0;
    for (const r of e.allLeafChildren) {
      const n = r.treeParent;
      n && s(r) ? (n.treeNodeFlags |= Je | at, r.parent = e, be(n.childrenAfterGroup, r), i.push(r), F(270, { id: r.id, parentId: (n == null ? void 0 : n.id) ?? "" })) : n === e && i.push(r);
    }
  }
  setGroupData(e, t) {
    var r;
    const s = {}, i = (r = this.beans.showRowGroupCols) == null ? void 0 : r.getShowRowGroupCols();
    if (e.groupData = s, i)
      for (const n of i)
        s[n.getColId()] = t;
  }
  /** Load the tree structure for nested groups, aka children property */
  loadNested({ rowNode: e, changedRowNodes: t }, s) {
    if (!s && t) {
      for (const r of t.adds)
        r.key = r.id;
      return;
    }
    const i = e.allLeafChildren;
    for (let r = 0, n = i.length; r < n; ++r) {
      const o = i[r], a = o.id;
      o.key !== a && (o.key = a, o.groupData = null);
    }
  }
  /** Load the tree structure for self-referencing data, aka parentId field */
  loadSelfRef({ rowNode: e, changedRowNodes: t }, s) {
    const i = e.allLeafChildren, r = this.gos;
    if (!r.get("getRowId")) {
      for (let c = 0, d = i.length; c < d; ++c)
        i[c].treeParent = null;
      return;
    }
    const n = this.beans.rowModel, o = t == null ? void 0 : t.removals;
    let a = this.parentIdGetter;
    const l = r.get("treeDataParentIdField") || null;
    (a == null ? void 0 : a.path) !== l && (this.parentIdGetter = a = gv(l), s = !0);
    for (let c = 0, d = i.length; c < d; ++c) {
      const h = i[c];
      if (s || h.treeNodeFlags & at || o != null && o.has(h.treeParent)) {
        let u;
        const g = a(h.data);
        g != null && (u = n.getRowNode(g), u || F(271, { id: h.id, parentId: g })), h.treeParent = u ?? e;
        const p = h.id;
        h.key !== p && (h.key = p, h.groupData = null);
      } else
        h.treeParent ?? (h.treeParent = e);
    }
  }
  loadFlattened(e) {
    const t = e.allLeafChildren;
    for (let s = 0, i = t.length; s < i; ++s) {
      const r = t[s];
      r.treeParent = e;
      const n = r.id;
      r.key !== n && (r.key = n, r.groupData = null);
    }
  }
  /** Load the tree structure for data paths, aka getDataPath callback */
  loadDataPath({ rowNode: e }, t) {
    const s = this.gos.get("getDataPath");
    if (!s) {
      this.loadFlattened(e);
      return;
    }
    const i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
    let n;
    t || (n = this.loadExistingDataPath(e, i, r));
    const o = e.allLeafChildren;
    for (let a = 0, l = o.length; a < l; ++a) {
      const c = o[a];
      if (!t && c.treeParent !== null && !(c.treeNodeFlags & at))
        continue;
      const d = s(c.data), h = d == null ? void 0 : d.length;
      if (!h) {
        F(185, { data: c.data });
        continue;
      }
      const u = d[h - 1];
      c.key !== u && (c.key = u, c.groupData = null);
      const g = d.join(qn);
      r.set(c, g);
      const p = i.get(g);
      p === void 0 ? i.set(g, c) : p !== c && (n = this.duplicatedPath(i, n, p, c, g));
    }
    n && this.processDuplicatePaths(n, r), this.buildFromPaths(e, i, r);
  }
  loadExistingDataPath(e, t, s) {
    let i;
    const r = e.allLeafChildren;
    for (let n = 0, o = r.length; n < o; ++n) {
      const a = r[n], l = a.treeParent;
      if (l === null || a.treeNodeFlags & at)
        continue;
      let c = a.key, d = l;
      for (; d && d !== e && d !== a; ) {
        c = qn + c;
        const h = s.get(d);
        if (h !== void 0) {
          c = h + c;
          break;
        }
        c = d.key + c, d = d.treeParent;
      }
      if (d !== a) {
        s.set(a, c);
        const h = t.get(c);
        h === void 0 ? t.set(c, a) : h !== a && (i = this.duplicatedPath(t, i, h, a, c));
      }
    }
    return i;
  }
  duplicatedPath(e, t, s, i, r) {
    i.sourceRowIndex < s.sourceRowIndex && e.set(r, i);
    const n = (t ?? (t = /* @__PURE__ */ new Map())).get(r);
    return n === void 0 ? t.set(r, [s, i]) : n.push(i), t;
  }
  buildFromPaths(e, t, s) {
    const i = new Array(48), r = e.allLeafChildren;
    for (let n = 0, o = r.length; n < o; ++n) {
      const a = r[n], l = s.get(a);
      if (l === void 0)
        continue;
      const c = this.splitPathKey(i, l);
      let d = 0, h = e;
      for (let u = c - 1; u >= 0; --u) {
        const g = t.get(l.slice(0, i[u]));
        if (g) {
          h = g, d = u + 1;
          break;
        }
      }
      d < c && (h = this.buildMissingFillers(
        t,
        l,
        i,
        c,
        d,
        h
      )), a.treeParent = h;
    }
  }
  /** Collect separators positions, fast string split without allocations */
  splitPathKey(e, t) {
    let s = 0, i = 0;
    const r = t.length;
    for (; i < r; ) {
      const n = t.indexOf(qn, i);
      if (n === -1)
        break;
      e[s++] = n, i = n + Dl;
    }
    return s;
  }
  /** Walk forward from startLevel to segmentsLen creating missing filler nodes and return the final parent. */
  buildMissingFillers(e, t, s, i, r, n) {
    let o = 0, a = "row-group";
    n.sourceRowIndex < 0 && n.treeParent && (o = r, a = n.id);
    do {
      const l = r === 0 ? 0 : s[r - 1] + Dl, c = s[r], d = t.slice(0, c);
      let h = e.get(d);
      if (h !== void 0)
        h.sourceRowIndex < 0 && (a = h.id, o = r + 1);
      else {
        const u = l === 0 ? d : t.slice(l, c);
        a = this.makeFillerIdBase(t, s, r, a, o) + u, h = this.getOrCreateFiller(u, a), e.set(d, h), o = r + 1;
      }
      h.treeParent = n, n = h, ++r;
    } while (r < i);
    return n;
  }
  processDuplicatePaths(e, t) {
    for (const s of e.values()) {
      s.sort(q2);
      const i = s.length, r = new Array(i - 1);
      for (let o = 1; o < i; ++o) {
        const a = s[o];
        t.delete(a), a.treeParent = null, r[o - 1] = a.data;
      }
      const n = s[0];
      F(186, { rowId: n.id, rowData: n.data, duplicateRowsData: r });
    }
  }
  getOrCreateFiller(e, t) {
    const s = this.fillerNodesById ?? (this.fillerNodesById = /* @__PURE__ */ new Map());
    let i = s.get(t);
    return i === void 0 && (i = new ft(this.beans), i.id = t, i.key = e, i.group = !0, i.leafGroup = !1, i.rowGroupIndex = null, s.set(t, i)), i;
  }
  /**
   * Build the base filler ID up to the given 'level' and include the final level separator prefix.
   * Caller should append only the 'fillerKey' after this base.
   * Result format:
   * - With no prefix and level === 0: _ROW_ID_PREFIX_ROW_GROUP + '0-'
   * - With no prefix and level > 0: _ROW_ID_PREFIX_ROW_GROUP + '0-key0-1-key1-...-(level-1)-key(level-1)-level-'
   * - With prefix present: prefixId + '-level-'
   */
  makeFillerIdBase(e, t, s, i, r) {
    for (; r < s; ) {
      const n = r > 0 ? t[r - 1] + Dl : 0, o = t[r];
      i += "-" + r + "-" + e.slice(n, o), ++r;
    }
    return i + "-" + s + "-";
  }
  deselectHiddenNodes(e) {
    var r;
    const t = this.beans.selectionSvc, s = this.nodesToUnselect, i = "rowDataChanged";
    if (s && (this.nodesToUnselect = null, t == null || t.setNodesSelected({ newValue: !1, nodes: s, suppressFinishActions: !0, source: i })), (s || e) && ((r = t == null ? void 0 : t.updateGroupsFromChildrenSelections) == null || r.call(t, i)), s) {
      const n = (t == null ? void 0 : t.getSelectedNodes()) ?? null;
      this.eventSvc.dispatchEvent({ type: "selectionChanged", source: i, selectedNodes: n, serverSideState: null });
    }
  }
  hideRow(e) {
    e.isSelected() && (this.nodesToUnselect ?? (this.nodesToUnselect = [])).push(e), e.parent = null, e.group = !1, e.groupData = null, e.treeParent = null, e.treeNodeFlags = 0, e.allLeafChildren = null, e.childrenAfterGroup = ps;
    const t = e.sibling;
    t && (t.allLeafChildren = null, t.childrenAfterGroup = ps), e.updateHasChildren(), e.rowIndex !== null && e.clearRowTopAndRowIndex();
  }
  checkGroupColsUpdated(e) {
    var t;
    if (this.groupColsChanged = !1, e || !this.groupColsIds) {
      const s = ((t = this.beans.showRowGroupCols) == null ? void 0 : t.getShowRowGroupCols()) ?? ps;
      let i = "";
      for (let r = 0, n = s.length; r < n; ++r)
        i += s[r].getId() + qn;
      this.groupColsIds !== i && (this.groupColsIds = i, this.groupColsChanged = !0);
    }
  }
}, q2 = (e, t) => e.sourceRowIndex - t.sourceRowIndex, pv = {
  moduleName: "SharedTreeData",
  version: Y,
  dependsOn: [ie, jd, rv, qd]
}, X2 = {
  moduleName: "TreeData",
  version: Y,
  beans: [j2],
  dynamicBeans: { treeGroupStrategy: Y2 },
  rowModels: ["clientSide"],
  dependsOn: [pv, qC, ka]
}, Z2 = "ag-Grid-MissingKey", Q2 = class extends R {
  constructor() {
    super(...arguments), this.beanName = "ssrmBlockUtils";
  }
  wireBeans(e) {
    this.valueSvc = e.valueSvc, this.showRowGroupCols = e.showRowGroupCols, this.nodeManager = e.ssrmNodeManager, this.expansionSvc = e.expansionSvc, this.serverSideRowModel = e.rowModel, this.storeFactory = e.ssrmStoreFactory;
  }
  createRowNode(e) {
    const t = new ft(this.beans), s = e.rowHeight != null ? e.rowHeight : pt(this.beans);
    return t.setRowHeight(s), t.group = e.group, t.leafGroup = e.leafGroup, t.level = e.level, t.uiLevel = e.level, t.parent = e.parent, t.stub = !0, t.__needsRefreshWhenVisible = !1, t.group && (t.expanded = !1, t.field = e.field, t.rowGroupColumn = e.rowGroupColumn, t.rowGroupIndex = e.level), t;
  }
  destroyRowNode(e, t = !1) {
    e.childStore && !t && (this.destroyBean(e.childStore), e.childStore = null), e.sibling && !e.footer && this.destroyRowNode(e.sibling, !1), e.clearRowTopAndRowIndex(), e.id != null && this.nodeManager.removeNode(e);
  }
  setTreeGroupInfo(e) {
    e.updateHasChildren();
    const t = this.gos.get("getServerSideGroupKey"), s = e.hasChildren();
    s && t != null && (e.key = t(e.data)), !s && e.childStore != null && (this.destroyBean(e.childStore), e.childStore = null, e.master || (e.expanded = !1));
  }
  setRowGroupInfo(e) {
    if (e.key = this.valueSvc.getValue(e.rowGroupColumn, e), (e.key === null || e.key === void 0) && oa(() => {
      var r;
      F(190, { rowGroupId: (r = e.rowGroupColumn) == null ? void 0 : r.getId(), data: e.data });
    }, "SSBlock-BadKey"), this.gos.get("groupAllowUnbalanced") && e.key === "") {
      const r = this.serverSideRowModel.getParams();
      e.childStore = this.createBean(this.storeFactory.createStore(r, e));
    }
    ur(this.beans.gos)({ node: e }) && (Fs(e, this.beans), e.sibling && (e.sibling.uiLevel = e.uiLevel + 1));
  }
  setMasterDetailInfo(e) {
    const t = this.gos.get("isRowMaster");
    t != null ? e.master = t(e.data) : e.master = !0;
  }
  updateDataIntoRowNode(e, t) {
    e.updateData(t), this.gos.get("treeData") ? (this.setTreeGroupInfo(e), this.setChildCountIntoRowNode(e), this.updateRowFooter(e)) : e.group ? (this.setChildCountIntoRowNode(e), this.updateRowFooter(e)) : this.gos.get("masterDetail");
  }
  updateRowFooter(e) {
    if (!e.footer) {
      if (e.group && ur(this.beans.gos)({ node: e }) && !e.sibling) {
        Fs(e, this.beans);
        return;
      }
      e.sibling && Kd(e);
    }
  }
  setDataIntoRowNode(e, t, s, i) {
    var o;
    e.stub = !1;
    const r = this.gos.get("treeData");
    e.setDataAndId(t, s);
    const n = e.group;
    (r || !n) && this.gos.get("masterDetail") && this.setMasterDetailInfo(e), r ? this.setTreeGroupInfo(e) : n && this.setRowGroupInfo(e), (r || n) && (this.setGroupDataIntoRowNode(e), this.setChildCountIntoRowNode(e)), A(t) && (e.setRowHeight(He(this.beans, e, !1, i).height), (o = e.sibling) == null || o.setRowHeight(
      He(this.beans, e.sibling, !1, i).height
    ));
  }
  setChildCountIntoRowNode(e) {
    const t = this.gos.get("getChildCount");
    t && e.setAllChildrenCount(t(e.data));
  }
  setGroupDataIntoRowNode(e) {
    var i;
    e.groupValue = e.key;
    const t = ((i = this.showRowGroupCols) == null ? void 0 : i.getShowRowGroupCols()) ?? [], s = this.gos.get("treeData");
    t.forEach((r) => {
      if (e.groupData == null && (e.groupData = {}), s)
        e.groupData[r.getColId()] = e.key;
      else if (r.isRowGroupDisplayed(e.rowGroupColumn.getId())) {
        const n = this.valueSvc.getValue(e.rowGroupColumn, e);
        e.groupData[r.getColId()] = n;
      }
    });
  }
  clearDisplayIndex(e) {
    var i, r;
    e.clearRowTopAndRowIndex(), e.hasChildren() && !!e.childStore && ((i = e.childStore) == null || i.clearDisplayIndexes()), e.master && e.detailNode && ((r = e.detailNode) == null || r.clearRowTopAndRowIndex());
  }
  setDisplayIndex(e, t, s, i) {
    const r = this.gos.get("groupAllowUnbalanced") && e.group && e.key === "";
    if (this.gos.get("groupHideOpenParents") && e.group && e.expanded || r ? (e.setRowIndex(null), e.setRowTop(null)) : (e.setRowIndex(t.value++), e.setRowTop(s.value), s.value += e.rowHeight), e.setUiLevel(i), e.footer)
      return;
    if (e.master && (e.expanded && e.detailNode ? (e.detailNode.setRowIndex(t.value++), e.detailNode.setRowTop(s.value), s.value += e.detailNode.rowHeight) : e.detailNode && e.detailNode.clearRowTopAndRowIndex()), e.hasChildren() && !!e.childStore) {
      const l = e.childStore;
      e.expanded || r ? l.setDisplayIndexes(t, s, r ? i : i + 1) : l.clearDisplayIndexes();
    }
  }
  extractRowBounds(e, t) {
    const s = (i) => ({
      rowHeight: i.rowHeight,
      rowTop: i.rowTop
    });
    if (e.rowIndex === t)
      return s(e);
    if (e.hasChildren() && e.expanded && e.childStore) {
      const i = e.childStore;
      if (i.isDisplayIndexInStore(t))
        return i.getRowBounds(t);
    } else if (e.master && e.expanded && e.detailNode && e.detailNode.rowIndex === t)
      return s(e.detailNode);
  }
  isPixelInNodeRange(e, t) {
    return !A(e.rowTop) || !A(e.rowHeight) ? !1 : t >= e.rowTop && t < e.rowTop + e.rowHeight;
  }
  getIndexAtPixel(e, t) {
    if (this.isPixelInNodeRange(e, t))
      return e.rowIndex;
    const s = e.master && e.expanded, i = e.detailNode;
    if (s && i && this.isPixelInNodeRange(i, t))
      return i.rowIndex;
    if (e.hasChildren() && e.expanded && e.childStore) {
      const r = e.childStore;
      if (r.isPixelInRange(t))
        return r.getRowIndexAtPixel(t);
    }
    return null;
  }
  createNodeIdPrefix(e) {
    const t = [];
    let s = e;
    for (; s && s.level >= 0; )
      s.key === "" ? t.push(Z2) : t.push(s.key), s = s.parent;
    if (t.length > 0)
      return t.reverse().join("-");
  }
  checkOpenByDefault(e) {
    var i;
    const t = !!((i = this.expansionSvc) != null && i.isNodeExpanded(e)), s = e.expanded;
    !!s !== t ? e.setExpanded(t) : s === void 0 && (e.expanded = t);
  }
}, J2 = class extends R {
  constructor() {
    super(...arguments), this.beanName = "ssrmExpandListener";
  }
  postConstruct() {
    Le(this.gos) && this.addManagedEventListeners({ rowExpansionStateChanged: this.onRowExpandStateChanged.bind(this) });
  }
  onRowExpandStateChanged() {
    const e = this.beans, t = e.expansionSvc;
    e.rowModel.forEachNode((s) => {
      t.updateExpandedState(s);
    }), this.eventSvc.dispatchEvent({ type: "storeUpdated" });
  }
}, eW = class extends R {
  constructor() {
    super(...arguments), this.beanName = "ssrmFilterListener";
  }
  wireBeans(e) {
    this.serverSideRowModel = e.rowModel, this.filterManager = e.filterManager, this.listenerUtils = e.ssrmListenerUtils;
  }
  postConstruct() {
    Le(this.gos) && this.addManagedEventListeners({
      advancedFilterEnabledChanged: () => this.onFilterChanged(!0),
      filterChanged: () => this.onFilterChanged()
    });
  }
  onFilterChanged(e) {
    var l, c;
    const t = this.serverSideRowModel.getParams();
    if (!t)
      return;
    const s = t.filterModel;
    let i, r;
    if ((l = this.filterManager) != null && l.isAdvFilterEnabled()) {
      i = this.filterManager.getAdvFilterModel();
      const d = e ? Object.keys(s ?? {}) : this.getAdvancedFilterColumns(s), h = this.getAdvancedFilterColumns(i);
      d.forEach((u) => h.add(u)), r = Array.from(h);
    } else if (i = ((c = this.filterManager) == null ? void 0 : c.getFilterModel()) ?? {}, e) {
      const d = this.getAdvancedFilterColumns(s);
      Object.keys(i).forEach((h) => d.add(h)), r = Array.from(d);
    } else
      r = this.findChangedColumns(s, i);
    const n = this.listenerUtils.isSortingWithValueColumn(r), o = this.listenerUtils.isSortingWithSecondaryColumn(r), a = {
      valueColChanged: n,
      secondaryColChanged: o,
      changedColumns: r
    };
    this.serverSideRowModel.refreshAfterFilter(i, a);
  }
  findChangedColumns(e, t) {
    const s = {};
    Object.keys(e).forEach((r) => s[r] = !0), Object.keys(t).forEach((r) => s[r] = !0);
    const i = [];
    return Object.keys(s).forEach((r) => {
      const n = JSON.stringify(e[r]), o = JSON.stringify(t[r]);
      n != o && i.push(r);
    }), i;
  }
  getAdvancedFilterColumns(e) {
    const t = /* @__PURE__ */ new Set();
    if (!e)
      return t;
    const s = (i) => {
      i.filterType === "join" ? i.conditions.forEach((r) => s(r)) : t.add(i.colId);
    };
    return s(e), t;
  }
}, tW = class extends R {
  constructor() {
    super(...arguments), this.beanName = "ssrmListenerUtils";
  }
  wireBeans(e) {
    this.pivotResultCols = e.pivotResultCols, this.valueColsSvc = e.valueColsSvc;
  }
  isSortingWithValueColumn(e) {
    var s;
    const t = (((s = this.valueColsSvc) == null ? void 0 : s.columns) ?? []).map((i) => i.getColId());
    for (let i = 0; i < e.length; i++)
      if (t.indexOf(e[i]) > -1)
        return !0;
    return !1;
  }
  isSortingWithSecondaryColumn(e) {
    var i;
    const t = (i = this.pivotResultCols) == null ? void 0 : i.getPivotResultCols();
    if (!t)
      return !1;
    const s = t.list.map((r) => r.getColId());
    for (let r = 0; r < e.length; r++)
      if (s.indexOf(e[r]) > -1)
        return !0;
    return !1;
  }
}, sW = class extends R {
  constructor() {
    super(...arguments), this.beanName = "ssrmSortSvc";
  }
  wireBeans(e) {
    this.sortSvc = e.sortSvc, this.serverSideRowModel = e.rowModel, this.listenerUtils = e.ssrmListenerUtils;
  }
  postConstruct() {
    Le(this.gos) && this.addManagedEventListeners({ sortChanged: this.onSortChanged.bind(this) });
  }
  onSortChanged() {
    const e = this.serverSideRowModel.getParams();
    if (!e)
      return;
    const t = this.sortSvc.getSortModel(), s = e.sortModel, i = this.findChangedColumnsInSort(t, s), r = this.listenerUtils.isSortingWithValueColumn(i), n = this.listenerUtils.isSortingWithSecondaryColumn(i), o = {
      valueColChanged: r,
      secondaryColChanged: n,
      changedColumns: i
    };
    this.serverSideRowModel.refreshAfterSort(t, o);
  }
  // returns back all the cols that were effected by the sorting. eg if we were sorting by col A,
  // and now we are sorting by col B, the list of impacted cols should be A and B. so if a cache
  // is impacted by sorting on A or B then it needs to be refreshed. this includes where the cache
  // was previously sorted by A and then the A sort now needs to be cleared.
  findChangedColumnsInSort(e, t) {
    let s = [];
    [e, t].forEach((n) => {
      if (n) {
        const o = n.map((a) => a.colId);
        s = s.concat(o);
      }
    });
    const i = (n, o) => {
      const a = n ? n.sort : null, l = o ? o.sort : null;
      return a !== l;
    }, r = (n, o) => {
      const a = n ? t.indexOf(n) : -1, l = o ? e.indexOf(o) : -1;
      return a !== l;
    };
    return s.filter((n) => {
      const o = t.find((l) => l.colId === n), a = e.find((l) => l.colId === n);
      return i(o, a) || r(o, a);
    });
  }
}, iW = class extends R {
  constructor() {
    super(...arguments), this.beanName = "ssrmNodeManager", this.rowNodes = /* @__PURE__ */ new Map();
  }
  addRowNode(e) {
    const t = e.id;
    this.rowNodes.has(t) && F(187, {
      rowId: t,
      firstData: this.rowNodes.get(t).data,
      secondData: e.data
    }), this.rowNodes.set(t, e);
  }
  removeNode(e) {
    const t = e.id;
    this.rowNodes.delete(t);
  }
  destroy() {
    this.clear(), super.destroy();
  }
  clear() {
    this.rowNodes.clear(), super.destroy();
  }
}, rW = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rowModel", this.started = !1, this.managingPivotResultColumns = !1, this.onRowHeightChanged_debounced = pe(this, this.onRowHeightChanged.bind(this), 100);
  }
  wireBeans(e) {
    this.colModel = e.colModel, this.colNames = e.colNames, this.pivotResultCols = e.pivotResultCols, this.rowGroupColsSvc = e.rowGroupColsSvc, this.pivotColsSvc = e.pivotColsSvc, this.valueColsSvc = e.valueColsSvc, this.filterManager = e.filterManager, this.sortSvc = e.sortSvc, this.rowRenderer = e.rowRenderer, this.nodeManager = e.ssrmNodeManager, this.storeFactory = e.ssrmStoreFactory, this.pivotColDefSvc = e.pivotColDefSvc;
  }
  // we don't implement as lazy row heights is not supported in this row model
  ensureRowHeightsValid() {
    return !1;
  }
  start() {
    this.started = !0, this.updateDatasource();
  }
  destroyDatasource() {
    this.datasource && (this.datasource.destroy && this.datasource.destroy(), this.rowRenderer.datasourceChanged(), this.datasource = void 0);
  }
  postConstruct() {
    const e = this.resetRootStore.bind(this);
    this.addManagedEventListeners({
      newColumnsLoaded: this.onColumnEverything.bind(this),
      storeUpdated: this.onStoreUpdated.bind(this),
      columnValueChanged: e,
      columnPivotChanged: e,
      columnRowGroupChanged: e,
      columnPivotModeChanged: e
    }), this.addManagedPropertyListeners(
      [
        /**
         * Following properties omitted as they are likely to come with undesired  side effects.
         * 'getRowId', 'isRowMaster', 'getRowHeight', 'isServerSideGroup', 'getServerSideGroupKey',
         * */
        "masterDetail",
        "treeData",
        "removePivotHeaderRowWhenSingleValueColumn",
        "cacheBlockSize"
      ],
      e
    ), this.addManagedPropertyListeners(["groupAllowUnbalanced", "groupTotalRow"], () => this.onStoreUpdated()), this.addManagedPropertyListener("rowHeight", () => this.resetRowHeights()), this.verifyProps(), this.addManagedPropertyListener("serverSideDatasource", () => this.updateDatasource());
  }
  updateDatasource() {
    const e = this.gos.get("serverSideDatasource");
    e && this.setDatasource(e);
  }
  verifyProps() {
    wt(this.gos) && !this.gos.exists("getRowId") && F(188, { feature: "selection" });
  }
  setDatasource(e) {
    this.started && (this.destroyDatasource(), this.datasource = e, this.resetRootStore());
  }
  applyRowData(e, t, s) {
    const i = this.getRootStore();
    if (!i)
      return;
    const r = i.getChildStore(s);
    r && r.applyRowData(e, t, e.rowData.length);
  }
  isLastRowIndexKnown() {
    const e = this.getRootStore();
    return e ? e.isLastRowIndexKnown() : !1;
  }
  onColumnEverything() {
    var c, d, h, u;
    if (!this.storeParams) {
      this.resetRootStore();
      return;
    }
    const e = this.columnsToValueObjects((c = this.rowGroupColsSvc) == null ? void 0 : c.columns), t = this.columnsToValueObjects((d = this.valueColsSvc) == null ? void 0 : d.columns), s = this.columnsToValueObjects((h = this.pivotColsSvc) == null ? void 0 : h.columns), i = (g) => {
      const p = {};
      g.oldCols.forEach((C) => p[C.id] = C);
      const f = g.newCols.every((C) => {
        const v = p[C.id];
        return v && delete p[C.id], v && v.field === C.field && v.aggFunc === C.aggFunc;
      }), m = !g.allowRemovedColumns && !!Object.values(p).length;
      return f && !m;
    }, r = !Si(this.storeParams.sortModel, ((u = this.sortSvc) == null ? void 0 : u.getSortModel()) ?? []), n = !i({
      oldCols: this.storeParams.rowGroupCols,
      newCols: e
    }), o = !i({
      oldCols: this.storeParams.pivotCols,
      newCols: s
    }), a = !!(e != null && e.length) && !i({
      oldCols: this.storeParams.valueCols,
      newCols: t,
      allowRemovedColumns: !0
    });
    if (r || n || o || a)
      this.resetRootStore();
    else {
      const g = this.createStoreParams();
      this.storeParams.rowGroupCols = g.rowGroupCols, this.storeParams.pivotCols = g.pivotCols, this.storeParams.valueCols = g.valueCols;
    }
  }
  destroyRootStore() {
    !this.rootNode || !this.rootNode.childStore || (this.rootNode.childStore = this.destroyBean(this.rootNode.childStore), this.nodeManager.clear());
  }
  refreshAfterSort(e, t) {
    this.storeParams && (this.storeParams.sortModel = e);
    const s = this.getRootStore();
    s && (s.refreshAfterSort(t), this.onStoreUpdated());
  }
  generateSecondaryColumns(e) {
    var s;
    if (!this.pivotColDefSvc) {
      this.gos.assertModuleRegistered("SharedPivot", 2);
      return;
    }
    const t = this.pivotColDefSvc.createColDefsFromFields(e);
    this.managingPivotResultColumns = !0, (s = this.pivotResultCols) == null || s.setPivotResultCols(t, "rowModelUpdated");
  }
  resetRowHeights() {
    const e = this.resetRowHeightsForAllRowNodes(), t = He(this.beans, this.rootNode);
    if (this.rootNode.setRowHeight(t.height, t.estimated), this.rootNode.sibling) {
      const s = He(this.beans, this.rootNode.sibling);
      this.rootNode.sibling.setRowHeight(s.height, s.estimated);
    }
    e && this.onRowHeightChanged();
  }
  resetRowHeightsForAllRowNodes() {
    let e = !1;
    return this.forEachNode((t) => {
      const s = He(this.beans, t);
      t.setRowHeight(s.height, s.estimated);
      const i = t.detailNode;
      if (i) {
        const r = He(this.beans, i);
        i.setRowHeight(r.height, r.estimated);
      }
      if (t.sibling) {
        const r = He(this.beans, t.sibling);
        i == null || i.setRowHeight(r.height, r.estimated);
      }
      e = !0;
    }), e;
  }
  resetRootStore() {
    var e;
    this.destroyRootStore(), this.rootNode = new ft(this.beans), this.rootNode.group = !0, this.rootNode.level = -1, this.datasource && (this.storeParams = this.createStoreParams(), this.rootNode.childStore = this.createBean(this.storeFactory.createStore(this.storeParams, this.rootNode)), this.updateRowIndexesAndBounds()), this.managingPivotResultColumns && ((e = this.pivotResultCols) == null || e.setPivotResultCols(null, "api"), this.managingPivotResultColumns = !1), this.dispatchModelUpdated(!0);
  }
  columnsToValueObjects(e = []) {
    return e.map(
      (t) => ({
        id: t.getId(),
        aggFunc: t.getAggFunc(),
        displayName: this.colNames.getDisplayNameForColumn(t, "model"),
        field: t.getColDef().field
      })
    );
  }
  createStoreParams() {
    var n, o, a, l, c, d, h;
    const e = this.columnsToValueObjects((n = this.rowGroupColsSvc) == null ? void 0 : n.columns), t = this.columnsToValueObjects((o = this.valueColsSvc) == null ? void 0 : o.columns), s = this.columnsToValueObjects((a = this.pivotColsSvc) == null ? void 0 : a.columns), i = Wc(this.gos);
    return {
      // the columns the user has grouped and aggregated by
      valueCols: t,
      rowGroupCols: e,
      pivotCols: s,
      pivotMode: this.colModel.isPivotMode(),
      // sort and filter model
      filterModel: (l = this.filterManager) != null && l.isAdvFilterEnabled() ? (c = this.filterManager) == null ? void 0 : c.getAdvFilterModel() : ((d = this.filterManager) == null ? void 0 : d.getFilterModel()) ?? {},
      sortModel: ((h = this.sortSvc) == null ? void 0 : h.getSortModel()) ?? [],
      datasource: this.datasource,
      lastAccessedSequence: { value: 0 },
      // blockSize: blockSize == null ? 100 : blockSize,
      dynamicRowHeight: i
    };
  }
  getParams() {
    return this.storeParams;
  }
  dispatchModelUpdated(e = !1) {
    this.eventSvc.dispatchEvent({
      type: "modelUpdated",
      animate: !e,
      keepRenderedRows: !e,
      newPage: !1,
      newData: !1
    });
  }
  onStoreUpdated() {
    this.updateRowIndexesAndBounds(), this.dispatchModelUpdated();
  }
  onRowHeightChanged() {
    this.updateRowIndexesAndBounds(), this.dispatchModelUpdated();
  }
  updateRowIndexesAndBounds() {
    const e = this.getRootStore();
    e && e.setDisplayIndexes({ value: 0 }, { value: 0 }, 0);
  }
  retryLoads() {
    const e = this.getRootStore();
    e && (e.retryLoads(), this.onStoreUpdated());
  }
  getRow(e) {
    const t = this.getRootStore();
    if (t)
      return t.getRowUsingDisplayIndex(e);
  }
  refreshAfterFilter(e, t) {
    this.storeParams && (this.storeParams.filterModel = e);
    const s = this.getRootStore();
    s && (s.refreshAfterFilter(t), this.onStoreUpdated());
  }
  getRootStore() {
    var e;
    return (e = this.rootNode) == null ? void 0 : e.childStore;
  }
  getRowCount() {
    const e = this.getRootStore();
    return e ? e.getDisplayIndexEnd() : 0;
  }
  getTopLevelRowCount() {
    const e = this.getRootStore();
    return e ? e.getRowCount() : 1;
  }
  getTopLevelRowDisplayedIndex(e) {
    const t = this.getRootStore();
    return t ? t.getTopLevelRowDisplayedIndex(e) : e;
  }
  getRowBounds(e) {
    const t = this.getRootStore();
    return t ? t.getRowBounds(e) : {
      rowTop: 0,
      rowHeight: pt(this.beans)
    };
  }
  getBlockStates() {
    const e = this.getRootStore();
    if (!e)
      return;
    const t = {};
    return e.forEachStoreDeep((s) => {
      const i = s.getBlockStates();
      for (const r of Object.keys(i))
        t[r] = i[r];
    }), t;
  }
  getRowIndexAtPixel(e) {
    const t = this.getRootStore();
    return e <= 0 || !t ? 0 : t.getRowIndexAtPixel(e);
  }
  isEmpty() {
    return !1;
  }
  isRowsToRender() {
    return this.getRootStore() != null && this.getRowCount() > 0;
  }
  getType() {
    return "serverSide";
  }
  forEachNode(e) {
    const t = this.getRootStore();
    t && t.forEachNodeDeep(e);
  }
  forEachDisplayedNode(e) {
    const t = (s, i) => {
      s.stub || !s.displayed || e(s, i);
    };
    this.forEachNode(t);
  }
  forEachNodeAfterFilterAndSort(e, t = !1) {
    const s = this.getRootStore();
    s && s.forEachNodeDeepAfterFilterAndSort(e, void 0, t);
  }
  /** @returns false if store hasn't started */
  executeOnStore(e, t) {
    if (!this.started)
      return !1;
    const s = this.getRootStore();
    if (!s)
      return !0;
    const i = s.getChildStore(e);
    return i && t(i), !0;
  }
  refreshStore(e = {}) {
    const t = e.route ? e.route : [];
    this.executeOnStore(t, (s) => s.refreshStore(e.purge == !0));
  }
  getStoreState() {
    const e = [], t = this.getRootStore();
    return t && t.addStoreStates(e), e;
  }
  getNodesInRangeForSelection(e, t) {
    const s = e.rowIndex, i = t.rowIndex;
    if (s === null && i === null)
      return [];
    if (i === null)
      return e ? [e] : [];
    if (s === null)
      return [t];
    const r = [], [n, o] = [s, i].sort((a, l) => a - l);
    return this.forEachNode((a) => {
      const l = a.rowIndex;
      l == null || a.stub || l >= n && l <= o && r.push(a);
    }), r.length !== o - n + 1 ? null : r;
  }
  getRowNode(e) {
    let t;
    return this.forEachNode((s) => {
      s.id === e && (t = s), s.detailNode && s.detailNode.id === e && (t = s.detailNode);
    }), t;
  }
  isRowPresent(e) {
    return !!this.getRowNode(e.id);
  }
  setRowCount(e, t) {
    const s = this.getRootStore();
    s && s.setRowCount(e, t);
  }
  destroy() {
    this.destroyDatasource(), this.destroyRootStore(), super.destroy();
  }
  /**
   * @deprecated v33.1
   */
  onRowHeightChangedDebounced() {
    this.onRowHeightChanged_debounced();
  }
};
function nW(e) {
  var t;
  return ((t = e.selectionSvc) == null ? void 0 : t.getSelectionState()) ?? null;
}
function oW(e, t) {
  var s;
  (s = e.selectionSvc) == null || s.setSelectionState(t, "api");
}
function aW(e, t) {
  var s;
  return (s = e.ssrmTxnManager) == null ? void 0 : s.applyTransaction(t);
}
function lW(e, t) {
  var r;
  const s = t.startRow ?? 0, i = t.route ?? [];
  if (s < 0) {
    F(189, { startRow: s });
    return;
  }
  (r = Rn(e)) == null || r.applyRowData(t.successParams, s, i);
}
function cW(e, t, s) {
  var i;
  return (i = e.ssrmTxnManager) == null ? void 0 : i.applyTransactionAsync(t, s);
}
function dW(e) {
  var t;
  (t = Rn(e)) == null || t.retryLoads();
}
function hW(e) {
  var t;
  return (t = e.ssrmTxnManager) == null ? void 0 : t.flushAsyncTransactions();
}
function uW(e, t) {
  var s;
  (s = Rn(e)) == null || s.refreshStore(t);
}
function gW(e) {
  var t;
  return ((t = Rn(e)) == null ? void 0 : t.getStoreState()) ?? [];
}
var Al = class extends R {
  constructor() {
    super(...arguments), this.name = "expand", this.expanded = /* @__PURE__ */ new Set(), this.collapsed = /* @__PURE__ */ new Set(), this.initialState = /* @__PURE__ */ new Map();
  }
  /**
   * Set the expanded and collapsed rows.
   * @param expandedRows the rows to expand
   * @param touchedRows the rows that have been touched
   */
  setExpandedState({ expandedRowGroupIds: e, collapsedRowGroupIds: t }) {
    this.expanded = new Set(e), this.collapsed = new Set(t);
    for (const s of this.expanded)
      this.initialState.set(s, !1);
    for (const s of this.collapsed)
      this.initialState.set(s, !0);
  }
  /**
   * Get the serializable expanded state
   * @returns an object containing the expanded and collapsed rows
   */
  getExpandedState() {
    return {
      expandedRowGroupIds: Array.from(this.expanded),
      collapsedRowGroupIds: Array.from(this.collapsed)
    };
  }
  /**
   * Set the expanded state for a row.
   * @param row the row to expand/collapse
   * @param expanded true to expand the row, false to collapse it
   */
  setRowExpanded(e, t) {
    const s = e.id, i = this.initialState.get(s) === t;
    if (t) {
      this.collapsed.delete(s), i || this.expanded.add(s);
      return;
    }
    this.expanded.delete(s), i || this.collapsed.add(s);
  }
  /**
   * Check if a row is expanded.
   * @param rowId the row id to check
   * @returns true if the row is expanded
   */
  isRowExpanded(e) {
    const t = e.id;
    if (this.expanded.has(t))
      return !0;
    if (this.collapsed.has(t))
      return !1;
    const s = this.initialState.get(t);
    if (s != null)
      return s;
    const i = this.getInitialRowState(e);
    return this.initialState.set(t, i), i;
  }
  /**
   * This is different from just checking expandedState.isExpanded(rowNode.id),
   * as this correctly prioritizes user interaction over the user-defined initial state.
   * Plus sanity checks that the rowNode is actually expandable.
   */
  getInitialRowState(e) {
    if (!e.isExpandable())
      return !1;
    const t = this.gos.getCallback("isServerSideGroupOpenByDefault");
    if (!t)
      return !1;
    const s = {
      data: e.data,
      rowNode: e
    };
    return t(s);
  }
  /**
   * if the row is expanded or has been collapsed intentionally, do not apply initial state.
   * @param rowId the row id to check
   * @returns true if the row has been toggled
   */
  isRowInitialised(e) {
    return this.initialState.has(e);
  }
  /**
   * Expand or collapse all loaded rows.
   * @param expanded true to expand all rows, false to collapse all rows
   */
  expandAll(e) {
    this.beans.rowModel.forEachNode((t) => {
      this.setRowExpanded(t, e);
    });
  }
}, sg = class extends R {
  constructor() {
    super(...arguments), this.name = "expandAll", this.allExpanded = !1, this.flipped = /* @__PURE__ */ new Set();
  }
  setExpandedState(e) {
    this.allExpanded = e.expandAll, this.flipped = new Set(e.invertedRowGroupIds);
  }
  getExpandedState() {
    return {
      expandAll: this.allExpanded,
      invertedRowGroupIds: Array.from(this.flipped)
    };
  }
  setRowExpanded(e, t) {
    const s = e.id;
    if (t === this.allExpanded) {
      this.flipped.delete(s);
      return;
    }
    this.flipped.add(s);
  }
  isRowExpanded(e) {
    const t = e.id;
    return this.allExpanded !== this.flipped.has(t);
  }
  isRowInitialised() {
    return !0;
  }
  expandAll(e) {
    this.allExpanded = e, this.flipped.clear();
  }
}, pW = class extends ZC {
  constructor() {
    super(...arguments), this.beanName = "expansionSvc";
  }
  wireBeans(e) {
    this.serverSideRowModel = e.rowModel, this.storeFactory = e.ssrmStoreFactory;
  }
  postConstruct() {
    const e = () => {
      this.strategy = this.createManagedBean(new Al());
    };
    this.addManagedEventListeners({
      // when row grouping changes, the old expand all state is no longer valid as rows changed
      columnRowGroupChanged: e
    }), this.addManagedPropertyListener("ssrmExpandAllAffectsAllRows", (t) => {
      t.currentValue || (this.strategy = this.createManagedBean(new Al()), this.updateAllNodes(), this.dispatchStateUpdatedEvent());
    }), e();
  }
  setExpansionState(e) {
    const t = "expandAll" in e, s = this.isExpandAllStrategy(this.strategy);
    t !== s && (this.strategy = t ? this.createManagedBean(new sg()) : this.createManagedBean(new Al())), this.strategy.setExpandedState(e), this.dispatchStateUpdatedEvent(), this.updateAllNodes();
  }
  getExpansionState() {
    return this.strategy.getExpandedState();
  }
  /**
   * Updates all nodes to the correct expanded/collapsed state.
   */
  updateAllNodes() {
    this.serverSideRowModel.forEachNode((e) => {
      super.setExpanded(e, this.isNodeExpanded(e));
    });
  }
  isNodeExpanded(e) {
    return this.strategy.isRowExpanded(e);
  }
  setExpanded(e, t, s, i) {
    this.strategy.setRowExpanded(e, t), super.setExpanded(e, t, s), this.dispatchStateUpdatedEvent(), this.updateExpandedState(e);
  }
  expandAll(e) {
    const t = this.beans.gos.get("ssrmExpandAllAffectsAllRows"), s = this.isExpandAllStrategy(this.strategy) || !t ? this.strategy : new sg();
    this.strategy = s, s.expandAll(e), this.updateAllNodes(), this.dispatchStateUpdatedEvent(), this.beans.eventSvc.dispatchEvent({
      type: "expandOrCollapseAll",
      source: e ? "expandAll" : "collapseAll"
    });
  }
  isExpandAllStrategy(e) {
    return e.name === "expandAll";
  }
  onGroupExpandedOrCollapsed() {
  }
  dispatchExpandedEvent(e) {
    this.eventSvc.dispatchEvent(e), this.beans.rowRenderer.refreshCells({ rowNodes: [e.node] });
  }
  updateExpandedState(e) {
    const t = e.childStore;
    if (e.expanded) {
      if (e.master && !e.detailNode && (e.detailNode = this.createDetailNode(e)), !t && e.hasChildren()) {
        const s = this.serverSideRowModel.getParams();
        e.childStore = this.createBean(this.storeFactory.createStore(s, e));
      }
    } else t && this.gos.get("purgeClosedRowNodes") && (e.childStore = this.destroyBean(t));
  }
  createDetailNode(e) {
    const t = new ft(this.beans);
    t.detail = !0, t.selectable = !1, t.parent = e, A(e.id) && (t.id = "detail_" + e.id), t.data = e.data, t.level = e.level + 1;
    const s = 200, i = He(this.beans, t).height;
    return t.rowHeight = i || s, t;
  }
}, Il = class extends R {
  constructor(e) {
    super(), this.selectionCtx = e, this.selectedState = { selectAll: !1, toggledNodes: /* @__PURE__ */ new Set() }, this.selectAllUsed = !1, this.selectedNodes = {};
  }
  getSelectedState() {
    return {
      selectAll: this.selectedState.selectAll,
      toggledNodes: [...this.selectedState.toggledNodes]
    };
  }
  setSelectedState(e) {
    if (typeof e != "object") {
      j(116);
      return;
    }
    if (!("selectAll" in e)) {
      j(116);
      return;
    }
    if (typeof e.selectAll != "boolean") {
      j(117);
      return;
    }
    if (!("toggledNodes" in e) || !Array.isArray(e.toggledNodes))
      return F(197);
    const t = {
      selectAll: e.selectAll,
      toggledNodes: /* @__PURE__ */ new Set()
    };
    e.toggledNodes.forEach((i) => {
      typeof i == "string" ? t.toggledNodes.add(i) : F(196, { key: i });
    });
    const s = t.selectAll || t.toggledNodes.size > 1;
    if (Kc(this.gos) && !Ps(this.gos) && s) {
      F(130);
      return;
    }
    this.selectedState = t;
  }
  deleteSelectionStateFromParent(e, t) {
    if (this.selectedState.toggledNodes.size === 0)
      return !1;
    let s = !1;
    return t.forEach((i) => {
      this.selectedState.toggledNodes.delete(i) && (s = !0);
    }), s;
  }
  setNodesSelected(e) {
    const { nodes: t, clearSelection: s, newValue: i, source: r } = e;
    if (t.length === 0)
      return 0;
    const n = s && i;
    if (!Ps(this.gos) || n) {
      if (t.length > 1)
        return j(130), 0;
      const a = t[0], l = a.footer ? a.sibling : a;
      return i && l.selectable ? (this.selectedNodes = { [l.id]: l }, this.selectedState = {
        selectAll: !1,
        toggledNodes: /* @__PURE__ */ new Set([l.id])
      }) : (this.selectedNodes = {}, this.selectedState = {
        selectAll: !1,
        toggledNodes: /* @__PURE__ */ new Set()
      }), 1;
    }
    const o = (a, l = i) => {
      const c = a.footer ? a.sibling : a;
      l && c.selectable ? this.selectedNodes[c.id] = c : delete this.selectedNodes[c.id], l === this.selectedState.selectAll || !c.selectable ? this.selectedState.toggledNodes.delete(c.id) : this.selectedState.toggledNodes.add(c.id);
    };
    return t.forEach((a) => o(a)), t.length === 1 && r === "api" && this.selectionCtx.setRoot(t[0].footer ? t[0].sibling : t[0]), 1;
  }
  processNewRow(e) {
    this.selectedNodes[e.id] && (this.selectedNodes[e.id] = e);
  }
  isNodeSelected(e) {
    const t = this.selectedState.toggledNodes.has(e.id);
    return this.selectedState.selectAll ? !t : t;
  }
  getSelectedNodes(e = !1, t = !0) {
    const {
      selectedState: { selectAll: s },
      selectedNodes: i,
      selectAllUsed: r
    } = this;
    return t && r && F(199), e && s ? null : Object.values(i);
  }
  getSelectedRows() {
    return (this.getSelectedNodes() ?? []).map((e) => e.data);
  }
  getSelectionCount() {
    return this.selectedState.selectAll ? -1 : this.selectedState.toggledNodes.size;
  }
  isEmpty() {
    var e;
    return !this.selectedState.selectAll && !((e = this.selectedState.toggledNodes) != null && e.size);
  }
  selectAllRowNodes() {
    this.reset(!0);
  }
  deselectAllRowNodes() {
    this.reset(!1);
  }
  reset(e) {
    this.selectedState = { selectAll: e, toggledNodes: /* @__PURE__ */ new Set() }, this.selectedNodes = {}, this.selectAllUsed || (this.selectAllUsed = e);
  }
  getSelectAllState() {
    return this.selectedState.selectAll ? this.selectedState.toggledNodes.size > 0 ? null : !0 : this.selectedState.toggledNodes.size > 0 ? null : !1;
  }
}, Xn = class extends R {
  constructor(e) {
    super(), this.selectionCtx = e, this.selectedState = { selectAllChildren: !1, toggledNodes: /* @__PURE__ */ new Map() };
  }
  wireBeans(e) {
    this.rowModel = e.rowModel, this.rowGroupColsSvc = e.rowGroupColsSvc, this.filterManager = e.filterManager, this.selectionSvc = e.selectionSvc;
  }
  postConstruct() {
    this.addManagedEventListeners({
      // if model has updated, a store may now be fully loaded to clean up indeterminate states
      modelUpdated: () => this.removeRedundantState(),
      // when the grouping changes, the state no longer makes sense, so reset the state.
      columnRowGroupChanged: () => this.selectionSvc.reset("rowGroupChanged")
    });
  }
  getSelectedState() {
    const { gos: e, rowGroupColsSvc: t, selectedState: s } = this, i = e.get("treeData"), r = (n, o, a) => {
      const l = {
        nodeId: a
      };
      if ((i || t && o <= t.columns.length) && (l.selectAllChildren = n.selectAllChildren), n.toggledNodes.size) {
        const c = [];
        n.toggledNodes.forEach((d, h) => {
          const u = r(d, o + 1, h);
          c.push(u);
        }), l.toggledNodes = c;
      }
      return l;
    };
    return r(s, 0);
  }
  setSelectedState(e) {
    if ("selectAll" in e) {
      j(111);
      return;
    }
    const t = (s, i) => {
      var a;
      if (typeof s != "object")
        throw j(243), new Error();
      if ("selectAllChildren" in s && typeof s.selectAllChildren != "boolean")
        throw j(244), new Error();
      if ("toggledNodes" in s) {
        if (!Array.isArray(s.toggledNodes))
          throw j(245), new Error();
        if (!s.toggledNodes.every(
          (c) => typeof c == "object" && "nodeId" in c && typeof c.nodeId == "string"
        ))
          throw j(246), new Error();
      }
      const r = s.selectAllChildren ?? !i, n = (a = s.toggledNodes) == null ? void 0 : a.map((l) => [
        l.nodeId,
        t(l, r)
      ]);
      if (n == null ? void 0 : n.some(
        ([, l]) => r === l.selectAllChildren && l.toggledNodes.size === 0
      ))
        throw j(247), new Error();
      return {
        selectAllChildren: r,
        toggledNodes: new Map(n)
      };
    };
    try {
      this.selectedState = t(e, !!e.selectAllChildren);
    } catch {
    }
  }
  deleteSelectionStateFromParent(e, t) {
    let s = this.selectedState;
    const i = [...e];
    for (; s && i.length; )
      s = s.toggledNodes.get(i.pop());
    if (!s)
      return !1;
    let r = !1;
    return t.forEach((n) => {
      s != null && s.toggledNodes.delete(n) && (r = !0);
    }), r && this.removeRedundantState(), r;
  }
  setNodesSelected({ nodes: e, newValue: t, clearSelection: s, source: i }) {
    if (e.length === 0)
      return 0;
    const r = s && t;
    if (!Ps(this.gos) || r) {
      if (e.length > 1)
        return j(130), 0;
      this.deselectAllRowNodes();
    }
    return e.forEach((n) => {
      const o = n.footer ? n.sibling : n, a = this.getRouteToNode(o);
      this.recursivelySelectNode(a, this.selectedState, t);
    }), this.removeRedundantState(), e.length === 1 && i === "api" && this.selectionCtx.setRoot(e[0].footer ? e[0].sibling : e[0]), 1;
  }
  isNodeSelected(e) {
    const t = this.getRouteToNode(e);
    return this.isNodePathSelected(t, this.selectedState);
  }
  isNodePathSelected([e, ...t], s) {
    if (t.length === 0) {
      const i = s.toggledNodes.has(e.id);
      if (e.hasChildren()) {
        const r = s.toggledNodes.get(e.id);
        if (r && r.toggledNodes.size)
          return;
      }
      return s.selectAllChildren ? !i : i;
    }
    if (s.toggledNodes.has(e.id)) {
      const i = s.toggledNodes.get(e.id);
      if (i)
        return this.isNodePathSelected(t, i);
    }
    return s.selectAllChildren;
  }
  getRouteToNode(e) {
    const t = [];
    let s = e;
    for (; s.parent; )
      t.push(s), s = s.parent;
    return t.reverse();
  }
  removeRedundantState() {
    var t;
    if ((t = this.filterManager) != null && t.isAnyFilterPresent())
      return;
    const e = (s = this.selectedState, i, r) => {
      if (s.toggledNodes.forEach((a, l) => {
        e(a, l, s);
      }), i) {
        const a = this.rowModel.getRowNode(i), l = a == null ? void 0 : a.childStore;
        if ((l == null ? void 0 : l.isLastRowIndexKnown()) && s.toggledNodes.size >= l.getRowCount()) {
          for (const h of s.toggledNodes.entries()) {
            const [u, g] = h;
            if (g.toggledNodes.size > 0 || !this.rowModel.getRowNode(u))
              return;
          }
          s.selectAllChildren = !s.selectAllChildren, s.toggledNodes.clear();
        }
      }
      const n = s.toggledNodes.size === 0, o = (r == null ? void 0 : r.selectAllChildren) === s.selectAllChildren;
      n && o && (r == null || r.toggledNodes.delete(i));
    };
    e();
  }
  recursivelySelectNode([e, ...t], s, i) {
    if (!e)
      return;
    if (!t.length) {
      const a = e.selectable;
      if (s.selectAllChildren === i || !a) {
        s.toggledNodes.delete(e.id);
        return;
      }
      const c = {
        selectAllChildren: i,
        toggledNodes: /* @__PURE__ */ new Map()
      };
      s.toggledNodes.set(e.id, c);
      return;
    }
    const n = s.toggledNodes.has(e.id), o = s.toggledNodes.get(e.id) ?? {
      selectAllChildren: s.selectAllChildren,
      toggledNodes: /* @__PURE__ */ new Map()
    };
    n || s.toggledNodes.set(e.id, o), this.recursivelySelectNode(t, o, i), s.selectAllChildren === o.selectAllChildren && o.toggledNodes.size === 0 && s.toggledNodes.delete(e.id);
  }
  getSelectedNodes(e = !1) {
    if (F(202), this.selectedState.selectAllChildren && e)
      return null;
    const t = [];
    return this.rowModel.forEachNode((s) => {
      s.isSelected() && t.push(s);
    }), t;
  }
  processNewRow() {
  }
  getSelectedRows() {
    var e;
    return ((e = this.getSelectedNodes()) == null ? void 0 : e.map((t) => t.data)) ?? [];
  }
  getSelectionCount() {
    return -1;
  }
  isEmpty() {
    var e;
    return !this.selectedState.selectAllChildren && !((e = this.selectedState.toggledNodes) != null && e.size);
  }
  selectAllRowNodes() {
    this.reset(!0);
  }
  deselectAllRowNodes() {
    this.reset(!1);
  }
  reset(e) {
    this.selectedState = { selectAllChildren: e, toggledNodes: /* @__PURE__ */ new Map() };
  }
  getSelectAllState() {
    return this.selectedState.selectAllChildren ? this.selectedState.toggledNodes.size > 0 ? null : !0 : this.selectedState.toggledNodes.size > 0 ? null : !1;
  }
}, fW = class extends Ef {
  constructor() {
    super(...arguments), this.beanName = "selectionSvc";
  }
  postConstruct() {
    super.postConstruct(), this.addManagedPropertyListeners(["groupSelectsChildren", "rowSelection"], () => {
      const s = Ei(this.gos), i = s && this.selectionStrategy instanceof Il ? Xn : !s && this.selectionStrategy instanceof Xn ? Il : void 0;
      i && (this.destroyBean(this.selectionStrategy), this.selectionStrategy = this.createManagedBean(new i(this.selectionCtx)), this.shotgunResetNodeSelectionState(), this.dispatchSelectionChanged("api"));
    }), this.addManagedPropertyListeners(["rowSelection"], () => {
      const s = gr(this.gos);
      s !== this.selectionMode && (this.selectionMode = s, this.deselectAllRowNodes({ source: "api" }));
    }), this.selectionMode = gr(this.gos);
    const t = Ei(this.gos) ? Xn : Il;
    this.selectionStrategy = this.createManagedBean(new t(this.selectionCtx));
  }
  handleSelectionEvent(e, t, s) {
    if (this.isRowSelectionBlocked(t))
      return 0;
    let i = 0;
    const r = this.inferNodeSelections(t, e.shiftKey, e.metaKey || e.ctrlKey, s);
    return r == null ? 0 : (this.selectionCtx.selectAll = !1, "select" in r ? (r.reset ? this.selectionStrategy.deselectAllRowNodes({ source: "api" }) : this.selectionStrategy.setNodesSelected({ nodes: r.deselect, newValue: !1, source: s }), i = this.selectionStrategy.setNodesSelected({ nodes: r.select, newValue: !0, source: s })) : i = this.selectionStrategy.setNodesSelected({
      nodes: [r.node],
      newValue: r.newValue,
      clearSelection: r.clearSelection,
      event: e,
      source: s
    }), this.shotgunResetNodeSelectionState(s), this.dispatchSelectionChanged(s), i);
  }
  getSelectionState() {
    return this.selectionStrategy.getSelectedState();
  }
  setSelectionState(e, t) {
    if (!wt(this.gos)) {
      e && F(132);
      return;
    }
    Array.isArray(e) || (e ? (this.selectionStrategy.setSelectedState(e), this.shotgunResetNodeSelectionState(), this.dispatchSelectionChanged(t)) : this.deselectAllRowNodes({ source: t }));
  }
  setNodesSelected(e) {
    if (!wt(this.gos) && e.newValue)
      return F(132), 0;
    const { nodes: t, ...s } = e;
    if (t.length > 1 && this.selectionMode !== "multiRow")
      return F(130), 0;
    const i = {
      nodes: t.filter((n) => n.selectable),
      ...s
    };
    if (!i.nodes.length)
      return 0;
    const r = this.selectionStrategy.setNodesSelected(i);
    return this.shotgunResetNodeSelectionState(i.source), this.dispatchSelectionChanged(i.source), r;
  }
  /**
   * Deletes the selection state for a set of nodes, for use after deleting nodes via
   * transaction. As this is designed for transactions, all nodes should belong to the same group.
   */
  deleteSelectionStateFromParent(e, t) {
    this.selectionStrategy.deleteSelectionStateFromParent(e, t) && (this.shotgunResetNodeSelectionState(), this.dispatchSelectionChanged("api"));
  }
  shotgunResetNodeSelectionState(e) {
    this.beans.rowModel.forEachNode((t) => {
      if (t.stub)
        return;
      const s = this.selectionStrategy.isNodeSelected(t);
      s !== t.isSelected() && this.selectRowNode(t, s, void 0, e);
    });
  }
  getSelectedNodes() {
    return this.selectionStrategy.getSelectedNodes() ?? [];
  }
  getSelectedRows() {
    return this.selectionStrategy.getSelectedRows();
  }
  getSelectionCount() {
    return this.selectionStrategy.getSelectionCount();
  }
  syncInRowNode(e) {
    this.selectionStrategy.processNewRow(e);
    const t = this.selectionStrategy.isNodeSelected(e);
    if (t != !1 && !e.selectable) {
      this.selectionStrategy.setNodesSelected({
        nodes: [e],
        newValue: !1,
        source: "api"
      }), this.shotgunResetNodeSelectionState(), this.dispatchSelectionChanged("api");
      return;
    }
    e.__selected = t;
  }
  reset() {
    this.selectionStrategy.deselectAllRowNodes({ source: "api" }), this.selectionCtx.reset();
  }
  isEmpty() {
    return this.selectionStrategy.isEmpty();
  }
  hasNodesToSelect() {
    return !0;
  }
  selectAllRowNodes(e) {
    if (!wt(this.gos)) {
      F(132);
      return;
    }
    if (ig(e), Kc(this.gos) && !Ps(this.gos))
      return F(130);
    this.selectionStrategy.selectAllRowNodes(e), this.selectionCtx.selectAll = !0, this.beans.rowModel.forEachNode((t) => {
      t.stub || this.selectRowNode(t, !0, void 0, e.source);
    }), this.dispatchSelectionChanged(e.source);
  }
  deselectAllRowNodes(e) {
    ig(e), this.selectionStrategy.deselectAllRowNodes(e), this.selectionCtx.selectAll = !1, this.beans.rowModel.forEachNode((t) => {
      t.stub || this.selectRowNode(t, !1, void 0, e.source);
    }), this.dispatchSelectionChanged(e.source);
  }
  getSelectAllState(e) {
    return this.selectionStrategy.getSelectAllState(e);
  }
  // used by CSRM
  getBestCostNodeSelection() {
    return F(194, { method: "getBestCostNodeSelection" });
  }
  /**
   * Updates the selectable state for a node by invoking isRowSelectable callback.
   * If the node is not selectable, it will be deselected.
   *
   * Callers:
   *  - property isRowSelectable changed
   *  - after grouping / treeData
   */
  updateSelectable() {
    if (!wt(this.gos))
      return;
    const e = [];
    this.beans.rowModel.forEachNode((t) => {
      !this.updateRowSelectable(t, !0) && t.isSelected() && e.push(t);
    }), e.length && this.setNodesSelected({
      nodes: e,
      newValue: !1,
      source: "selectableChanged"
    });
  }
  dispatchSelectionChanged(e) {
    this.eventSvc.dispatchEvent({
      type: "selectionChanged",
      source: e,
      selectedNodes: this.selectionStrategy instanceof Xn ? null : this.selectionStrategy.getSelectedNodes(!0, !1),
      serverSideState: this.getSelectionState()
    });
  }
  updateSelectableAfterGrouping() {
    return j(194, { method: "updateSelectableAfterGrouping" });
  }
  refreshMasterNodeState() {
  }
  setDetailSelectionState() {
  }
};
function ig({ selectAll: e }) {
  (e === "filtered" || e === "currentPage") && F(195, { justCurrentPage: e === "currentPage" });
}
var mW = class extends R {
  constructor() {
    super(...arguments), this.beanName = "rowChildrenSvc";
  }
  getHasChildrenValue(e) {
    const t = this.gos.get("treeData"), s = this.gos.get("isServerSideGroup");
    return !e.stub && !e.footer && (t ? !!s && s(e.data) : !!e.group);
  }
}, CW = class extends R {
  constructor() {
    super(...arguments), this.beanName = "lazyBlockLoadingSvc", this.outboundRequests = 0, this.cacheLoadingNodesMap = /* @__PURE__ */ new Map(), this.isCheckQueued = !1, this.nextBlockToLoad = void 0;
  }
  wireBeans(e) {
    this.rowRenderer = e.rowRenderer, this.rowModel = e.rowModel;
  }
  postConstruct() {
    this.maxOutboundRequests = ep(this.gos);
  }
  subscribe(e) {
    this.cacheLoadingNodesMap.set(e, /* @__PURE__ */ new Set());
  }
  unsubscribe(e) {
    this.cacheLoadingNodesMap.delete(e);
  }
  /**
   * Queues a microtask to check if any blocks need to be loaded.
   */
  queueLoadCheck() {
    this.isCheckQueued || (this.isCheckQueued = !0, setTimeout(() => {
      this.queueLoadAction(), this.isCheckQueued = !1;
    }));
  }
  onLoadComplete() {
    this.outboundRequests -= 1, this.queueLoadCheck();
  }
  hasAvailableLoadBandwidth() {
    return this.maxOutboundRequests === void 0 ? !0 : this.outboundRequests < this.maxOutboundRequests;
  }
  queueLoadAction() {
    const e = this.getBlockToLoad();
    if (!e)
      return;
    const t = this.nextBlockToLoad && this.nextBlockToLoad.cache === e.cache && this.nextBlockToLoad.index === e.index;
    if (!t && (!this.nextBlockToLoad || !t)) {
      this.nextBlockToLoad = e, window.clearTimeout(this.loaderTimeout);
      const s = Number(this.nextBlockToLoad.index), i = this.nextBlockToLoad.cache, r = e.index + e.cache.getBlockSize();
      this.loaderTimeout = window.setTimeout(() => {
        i.isAlive() && (this.loaderTimeout = void 0, this.attemptLoad(i, s, r), this.nextBlockToLoad = void 0);
      }, this.gos.get("blockLoadDebounceMillis"));
    }
  }
  attemptLoad(e, t, s) {
    this.hasAvailableLoadBandwidth() && (this.executeLoad(e, t, s), this.queueLoadCheck());
  }
  executeLoad(e, t, s) {
    var h;
    const i = e.getSsrmParams(), r = {
      startRow: t,
      endRow: s,
      rowGroupCols: i.rowGroupCols,
      valueCols: i.valueCols,
      pivotCols: i.pivotCols,
      pivotMode: i.pivotMode,
      groupKeys: e.store.getParentNode().getRoute() ?? [],
      filterModel: i.filterModel,
      sortModel: i.sortModel
    }, n = this.cacheLoadingNodesMap.get(e), o = () => {
      for (let u = 0; u < s - t; u++)
        n.delete(t + u);
    }, a = () => {
      for (let u = 0; u < s - t; u++)
        n.add(t + u);
    }, l = (u) => {
      this.onLoadComplete(), e.onLoadSuccess(t, s - t, u), o();
    }, c = () => {
      this.onLoadComplete(), e.onLoadFailed(t, s - t), o();
    }, d = V(this.gos, {
      request: r,
      success: l,
      fail: c,
      parentNode: e.store.getParentNode()
    });
    a(), this.outboundRequests += 1, (h = e.getSsrmParams().datasource) == null || h.getRows(d);
  }
  getBlockToLoad() {
    var a, l;
    const e = this.rowRenderer.firstRenderedRow, t = this.rowRenderer.lastRenderedRow;
    for (let c = e; c <= t; c++) {
      const d = this.rowModel.getRow(c);
      if (!d)
        continue;
      const h = (a = d.parent) == null ? void 0 : a.childStore;
      if (!h)
        continue;
      const u = h.getCache(), g = u.getNodes().getBy("node", d);
      if (!g)
        continue;
      const p = this.cacheLoadingNodesMap.get(u);
      if (!(p != null && p.has(g.index)) && (d.__needsRefreshWhenVisible || d.stub && !d.failedLoad))
        return {
          cache: u,
          index: u.getBlockStartIndex(g.index)
        };
    }
    let s = null, i = null, r = Number.MAX_SAFE_INTEGER;
    for (const c of this.cacheLoadingNodesMap.keys())
      c.getNodesToRefresh().forEach((h) => {
        if (h.rowIndex == null) {
          i = h, s = c;
          return;
        }
        const u = c.getNodes().getBy("node", h);
        if (!u)
          return;
        const g = this.cacheLoadingNodesMap.get(c);
        if (g != null && g.has(u.index))
          return;
        const p = Math.abs(e - h.rowIndex), f = Math.abs(h.rowIndex - t);
        p < r && (i = h, r = p, s = c), f < r && (i = h, r = f, s = c);
      });
    if (!s)
      return;
    const n = s, o = (l = n.getNodes().getBy("node", i)) == null ? void 0 : l.index;
    return o == null ? void 0 : {
      cache: n,
      index: n.getBlockStartIndex(o)
    };
  }
  isRowLoading(e, t) {
    var s;
    return ((s = this.cacheLoadingNodesMap.get(e)) == null ? void 0 : s.has(t)) ?? !1;
  }
}, vW = class {
  constructor(...e) {
    this.indexes = e, this.maps = new Map(this.indexes.map((t) => [t, /* @__PURE__ */ new Map()]));
  }
  getSize() {
    return this.maps.get(this.indexes[0]).size;
  }
  getBy(e, t) {
    return this.maps.get(e).get(t);
  }
  set(e) {
    this.indexes.forEach((t) => {
      this.maps.get(t).set(e[t], e);
    });
  }
  delete(e) {
    this.indexes.forEach((t) => {
      this.maps.get(t).delete(e[t]);
    });
  }
  clear() {
    this.maps.forEach((e) => e.clear());
  }
  getIterator(e) {
    return this.maps.get(e).values();
  }
  forEach(e) {
    const t = this.getIterator(this.indexes[0]);
    let s;
    for (; (s = t.next()) && !s.done; )
      e(s.value);
  }
  find(e) {
    const t = this.getIterator(this.indexes[0]);
    let s;
    for (; (s = t.next()) && !s.done; )
      if (e(s.value))
        return s.value;
  }
  filter(e) {
    const t = this.getIterator(this.indexes[0]);
    let s;
    const i = [];
    for (; (s = t.next()) && !s.done; )
      e(s.value) && i.push(s.value);
    return i;
  }
}, wW = 100, Ll = class extends R {
  constructor(e, t, s, i) {
    super(), this.live = !0, this.removedNodeCache = /* @__PURE__ */ new Map(), this.store = e, this.numberOfRows = t, this.isLastRowKnown = s, this.storeParams = i;
  }
  wireBeans(e) {
    this.rowRenderer = e.rowRenderer, this.blockUtils = e.ssrmBlockUtils, this.focusSvc = e.focusSvc, this.nodeManager = e.ssrmNodeManager, this.serverSideRowModel = e.rowModel, this.rowNodeSorter = e.rowNodeSorter, this.sortSvc = e.sortSvc, this.lazyBlockLoadingSvc = e.lazyBlockLoadingSvc, this.colModel = e.colModel;
  }
  postConstruct() {
    this.lazyBlockLoadingSvc.subscribe(this), this.nodeMap = new vW("index", "id", "node"), this.nodeDisplayIndexMap = /* @__PURE__ */ new Map(), this.nodesToRefresh = /* @__PURE__ */ new Set(), this.defaultNodeIdPrefix = this.blockUtils.createNodeIdPrefix(this.store.getParentNode()), this.getRowIdFunc = es(this.gos), this.isMasterDetail = this.gos.get("masterDetail");
  }
  destroy() {
    this.lazyBlockLoadingSvc.unsubscribe(this), this.numberOfRows = 0, this.nodeMap.forEach((e) => this.blockUtils.destroyRowNode(e.node)), this.nodeMap.clear(), this.nodeDisplayIndexMap.clear(), this.nodesToRefresh.clear(), this.live = !1, super.destroy();
  }
  /**
   * Get the row node for a specific display index from this store
   * @param displayIndex the display index of the node to find
   * @returns undefined if the node is not in the store bounds, otherwise will always return a node
   */
  getRowByDisplayIndex(e) {
    var l, c, d, h, u;
    if (!this.store.isDisplayIndexInStore(e))
      return;
    const t = this.nodeDisplayIndexMap.get(e);
    if (t)
      return (t.stub || t.__needsRefreshWhenVisible) && this.lazyBlockLoadingSvc.queueLoadCheck(), t;
    if (this.gos.get("groupHideOpenParents") || this.gos.get("groupAllowUnbalanced")) {
      const g = this.nodeMap.find(
        (p) => {
          var f;
          return !!((f = p.node.childStore) != null && f.isDisplayIndexInStore(e));
        }
      );
      if (g)
        return (l = g.node.childStore) == null ? void 0 : l.getRowUsingDisplayIndex(e);
    }
    if (e === this.store.getDisplayIndexStart())
      return this.createStubNode(0, e);
    const i = this.nodeDisplayIndexMap.get(e - 1);
    if (i) {
      if (this.isMasterDetail && i.master && i.expanded)
        return i.detailNode;
      if (i.expanded && ((c = i.childStore) != null && c.isDisplayIndexInStore(e)))
        return (d = i.childStore) == null ? void 0 : d.getRowUsingDisplayIndex(
          e
        );
      const g = this.nodeMap.getBy("node", i);
      return this.createStubNode(g.index + 1, e);
    }
    const r = this.getSurroundingNodesByDisplayIndex(e);
    if (r == null) {
      const g = this.store.getRowCount() - (this.store.getDisplayIndexEnd() - e);
      return this.createStubNode(g, e);
    }
    const { previousNode: n, nextNode: o } = r;
    if (n && n.node.expanded && ((h = n.node.childStore) != null && h.isDisplayIndexInStore(e)))
      return (u = n.node.childStore) == null ? void 0 : u.getRowUsingDisplayIndex(e);
    if (o) {
      const g = o.node.rowIndex - e, p = o.index - g;
      return this.createStubNode(p, e);
    }
    const a = this.store.getRowCount() - (this.store.getDisplayIndexEnd() - e);
    return this.createStubNode(a, e);
  }
  /**
   * Used for creating and positioning a stub node without firing a store updated event
   */
  createStubNode(e, t) {
    const s = this.store.getRowBounds(t), i = this.createRowAtIndex(e, null, (r) => {
      r.setRowIndex(t), r.setRowTop(s.rowTop), this.nodeDisplayIndexMap.set(t, r);
    });
    if (e === 0 && this.gos.get("groupHideOpenParents")) {
      const r = this.store.getParentNode().groupData;
      if (r)
        for (const n of Object.keys(r))
          Vu(i, this.colModel, n, r[n]);
    }
    return this.lazyBlockLoadingSvc.queueLoadCheck(), i;
  }
  /**
   * @param index The row index relative to this store
   * @returns A rowNode at the given store index
   */
  getRowByStoreIndex(e) {
    var t;
    return (t = this.nodeMap.getBy("index", e)) == null ? void 0 : t.node;
  }
  /**
   * Given a number of rows, skips through the given sequence & row top reference (using default row height)
   * @param numberOfRowsToSkip number of rows to skip over in the given sequence
   * @param displayIndexSeq the sequence in which to skip
   * @param nextRowTop the row top reference in which to skip
   */
  skipDisplayIndexes(e, t, s) {
    if (e === 0)
      return;
    const i = pt(this.beans);
    t.value += e, s.value += e * i;
  }
  /**
   * @param displayIndexSeq the number sequence for generating the display index of each row
   * @param nextRowTop an object containing the next row top value intended to be modified by ref per row
   */
  setDisplayIndexes(e, t, s) {
    this.nodeDisplayIndexMap.clear();
    const i = {};
    this.nodeMap.forEach((o) => {
      i[o.index] = o.node;
    });
    let r = -1;
    for (const o of Object.keys(i)) {
      const a = i[o], l = Number(o), c = l - 1 - r;
      this.skipDisplayIndexes(c, e, t);
      const d = l === 0;
      if (a.firstChild !== d && (a.firstChild = d, a.dispatchRowEvent("firstChildChanged")), d && this.gos.get("groupHideOpenParents")) {
        const h = this.store.getParentNode().groupData;
        if (h)
          for (const u of Object.keys(h))
            Vu(a, this.colModel, u, d ? h[u] : void 0);
      }
      this.blockUtils.setDisplayIndex(a, e, t, s), a.rowIndex != null && this.nodeDisplayIndexMap.set(a.rowIndex, a), r = l;
    }
    const n = this.numberOfRows - 1 - r;
    this.skipDisplayIndexes(n, e, t), this.purgeExcessRows();
  }
  getRowCount() {
    return this.numberOfRows;
  }
  setRowCount(e, t) {
    this.numberOfRows = e, t != null && (this.isLastRowKnown = t, t === !1 && (this.numberOfRows += 1)), this.fireStoreUpdatedEvent();
  }
  getNodes() {
    return this.nodeMap;
  }
  getNodeCachedByDisplayIndex(e) {
    return this.nodeDisplayIndexMap.get(e) ?? null;
  }
  getNodesToRefresh() {
    return this.nodesToRefresh;
  }
  /**
   * @returns the previous and next loaded row nodes surrounding the given display index
   */
  getSurroundingNodesByDisplayIndex(e) {
    let t, s;
    return this.nodeMap.forEach((i) => {
      if (e > i.node.rowIndex) {
        (s == null || s.node.rowIndex < i.node.rowIndex) && (s = i);
        return;
      }
      if (t == null || t.node.rowIndex > i.node.rowIndex) {
        t = i;
        return;
      }
    }), !s && !t ? null : { previousNode: s, nextNode: t };
  }
  /**
   * Get or calculate the display index for a given store index
   * @param storeIndex the rows index within this store
   * @returns the rows visible display index relative to the grid
   */
  getDisplayIndexFromStoreIndex(e) {
    var o;
    const t = this.nodeMap.getBy("index", e);
    if (t)
      return t.node.rowIndex;
    let s, i;
    if (this.nodeMap.forEach((a) => {
      if (e > a.index) {
        (i == null || i.index < a.index) && (i = a);
        return;
      }
      if (s == null || s.index > a.index) {
        s = a;
        return;
      }
    }), !s)
      return this.store.getDisplayIndexEnd() - (this.numberOfRows - e);
    if (!i)
      return this.store.getDisplayIndexStart() + e;
    const r = e - i.index;
    return (((o = i.node.childStore) == null ? void 0 : o.getDisplayIndexEnd()) ?? i.node.rowIndex) + r;
  }
  /**
   * Creates a new row and inserts it at the given index
   * @param atStoreIndex the node index relative to this store
   * @param data the data object to populate the node with
   * @returns the new row node
   */
  createRowAtIndex(e, t, s) {
    var n, o;
    const i = this.nodeMap.getBy("index", e);
    if (i) {
      const { node: a } = i;
      if (a.__needsRefreshWhenVisible = !1, this.doesNodeMatch(t, a))
        return this.blockUtils.updateDataIntoRowNode(a, t), this.nodesToRefresh.delete(a), a;
      if (this.getRowIdFunc == null && a.hasChildren() && a.expanded)
        return this.nodesToRefresh.delete(a), a;
      this.destroyRowAtIndex(e);
    }
    if (t && this.getRowIdFunc != null) {
      const a = this.getRowId(t), l = a && ((n = this.removedNodeCache) == null ? void 0 : n.get(a));
      if (l)
        return (o = this.removedNodeCache) == null || o.delete(a), this.blockUtils.updateDataIntoRowNode(l, t), this.nodeMap.set({
          id: l.id,
          node: l,
          index: e
        }), this.nodesToRefresh.delete(l), l.__needsRefreshWhenVisible = !1, l;
      const c = this.nodeMap.getBy("id", a);
      if (c) {
        this.nodeMap.delete(c);
        const { node: d, index: h } = c;
        return this.blockUtils.updateDataIntoRowNode(d, t), this.nodeMap.set({
          id: d.id,
          node: d,
          index: e
        }), this.nodesToRefresh.delete(d), d.__needsRefreshWhenVisible = !1, this.getBlockStartIndex(h) === this.getBlockStartIndex(e) || this.markBlockForVerify(h), d;
      }
    }
    const r = this.blockUtils.createRowNode(this.store.getRowDetails());
    if (t != null) {
      const a = this.getPrefixedId(this.store.getIdSequence().value++);
      this.blockUtils.setDataIntoRowNode(r, t, a, void 0), this.blockUtils.checkOpenByDefault(r), this.nodeManager.addRowNode(r);
    }
    return this.nodeMap.set({
      id: r.id,
      node: r,
      index: e
    }), s && s(r), r;
  }
  getBlockStates() {
    const e = {}, t = {};
    this.nodeMap.forEach(({ node: n, index: o }) => {
      const a = this.getBlockStartIndex(o);
      !n.stub && !n.failedLoad && (e[a] = (e[a] ?? 0) + 1);
      let l = "loaded";
      n.failedLoad ? l = "failed" : this.lazyBlockLoadingSvc.isRowLoading(this, a) ? l = "loading" : (this.nodesToRefresh.has(n) || n.stub) && (l = "needsLoading"), t[a] || (t[a] = /* @__PURE__ */ new Set()), t[a].add(l);
    });
    const s = {
      loading: 4,
      failed: 3,
      needsLoading: 2,
      loaded: 1
    }, i = this.blockUtils.createNodeIdPrefix(this.store.getParentNode()), r = {};
    for (const n of Object.keys(t)) {
      const a = [...t[n]].sort(
        (d, h) => (s[d] ?? 0) - (s[h] ?? 0)
      )[0], l = Number(n) / this.getBlockSize(), c = i ? `${i}-${l}` : String(l);
      r[c] = {
        blockNumber: l,
        startRow: Number(n),
        endRow: Number(n) + this.getBlockSize(),
        pageStatus: a,
        loadedRowCount: e[n] ?? 0
      };
    }
    return r;
  }
  destroyRowAtIndex(e) {
    const t = this.nodeMap.getBy("index", e);
    t && (this.nodeMap.delete(t), this.nodeDisplayIndexMap.delete(t.node.rowIndex), this.nodesToRefresh.size > 0 ? this.removedNodeCache.set(t.node.id, t.node) : this.blockUtils.destroyRowNode(t.node), this.nodesToRefresh.delete(t.node));
  }
  getSsrmParams() {
    return this.store.getSsrmParams();
  }
  /**
   * @param id the base id to be prefixed
   * @returns a node id with prefix if required
   */
  getPrefixedId(e) {
    return this.defaultNodeIdPrefix ? this.defaultNodeIdPrefix + "-" + e : e.toString();
  }
  markBlockForVerify(e) {
    const [t, s] = this.getBlockBounds(e);
    this.nodeMap.filter((r) => r.index >= t && r.index < s).forEach(({ node: r }) => {
      r.__needsRefreshWhenVisible = !0;
    });
  }
  doesNodeMatch(e, t) {
    if (t.stub)
      return !1;
    const s = this.getRowId(e);
    return s === null ? t.data === e : t.id === s;
  }
  /**
   * Deletes any stub nodes not within the given range
   */
  purgeStubsOutsideOfViewport() {
    const { firstRenderedRow: e, lastRenderedRow: t } = this.rowRenderer, s = this.getBlockStartIndex(e), [, i] = this.getBlockBounds(t);
    this.nodeMap.forEach((r) => {
      this.lazyBlockLoadingSvc.isRowLoading(this, r.index) || r.node.failedLoad || r.node.stub && (r.index < s || r.index > i) && this.destroyRowAtIndex(r.index);
    });
  }
  getBlocksDistanceFromRow(e, t) {
    const s = {};
    return e.forEach(({ node: i, index: r }) => {
      const [n, o] = this.getBlockBounds(r);
      if (n in s)
        return;
      const a = Math.abs(i.rowIndex - t);
      let l;
      const c = this.nodeMap.getBy("index", [o - 1]);
      c && (l = Math.abs(c.node.rowIndex - t));
      const d = l == null || a < l ? a : l;
      s[n] = d;
    }), Object.entries(s);
  }
  purgeExcessRows() {
    if (this.purgeStubsOutsideOfViewport(), this.store.getDisplayIndexEnd() == null || this.storeParams.maxBlocksInCache == null)
      return;
    const { firstRenderedRow: e, lastRenderedRow: t } = this.rowRenderer, s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
    this.nodeMap.forEach(({ index: g, node: p }) => {
      const f = this.getBlockStartIndex(g);
      s.add(f), p.rowIndex >= e && p.rowIndex <= t && i.add(f);
    });
    const r = Math.max(i.size, this.storeParams.maxBlocksInCache ?? 0), o = s.size - r;
    if (o <= 0)
      return;
    let a = Number.MAX_SAFE_INTEGER, l = Number.MIN_SAFE_INTEGER;
    i.forEach((g) => {
      a > g && (a = g), l < g && (l = g);
    });
    const c = this.nodeMap.filter(({ node: g, index: p }) => {
      const f = this.getBlockStartIndex(p);
      return !(f >= a && f <= l) && !this.isNodeCached(g);
    });
    if (c.length === 0)
      return;
    const d = e + (t - e) / 2, h = this.getBlocksDistanceFromRow(c, d), u = this.getBlockSize();
    h.sort((g, p) => Math.sign(p[1] - g[1]));
    for (let g = 0; g < Math.min(o, h.length); g++) {
      const p = Number(h[g][0]);
      for (let f = p; f < p + u; f++) {
        const m = this.nodeMap.getBy("index", f);
        !m || this.isNodeCached(m.node) || this.destroyRowAtIndex(f);
      }
    }
  }
  isNodeFocused(e) {
    const t = this.focusSvc.getFocusCellToUseAfterRefresh();
    return !t || t.rowPinned != null ? !1 : t.rowIndex === e.rowIndex;
  }
  isNodeCached(e) {
    const t = this.gos.get("groupAllowUnbalanced") && e.key === "";
    return e.isExpandable() && e.expanded || this.isNodeFocused(e) || t;
  }
  extractDuplicateIds(e) {
    if (this.getRowIdFunc == null)
      return [];
    const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
    return e.forEach((i) => {
      const r = this.getRowId(i);
      if (t.has(r)) {
        s.add(r);
        return;
      }
      t.add(r);
    }), [...s];
  }
  onLoadSuccess(e, t, s) {
    if (!this.live)
      return;
    const i = s.groupLevelInfo;
    if (this.store.setStoreInfo(i), this.getRowIdFunc != null) {
      const o = this.extractDuplicateIds(s.rowData);
      if (o.length > 0) {
        const a = o.join(", ");
        F(205, { duplicateIdText: a }), this.onLoadFailed(e, t);
        return;
      }
    }
    s.pivotResultFields && this.serverSideRowModel.generateSecondaryColumns(s.pivotResultFields);
    const r = this.nodesToRefresh.size > 0;
    if (s.rowData.forEach((o, a) => {
      var d;
      const l = e + a, c = this.nodeMap.getBy("index", l);
      if ((d = c == null ? void 0 : c.node) != null && d.stub) {
        this.createRowAtIndex(l, o);
        return;
      }
      if (c && this.doesNodeMatch(o, c.node)) {
        this.blockUtils.updateDataIntoRowNode(c.node, o), this.nodesToRefresh.delete(c.node), c.node.__needsRefreshWhenVisible = !1;
        return;
      }
      this.createRowAtIndex(l, o);
    }), s.rowCount != null && s.rowCount !== -1)
      this.numberOfRows = s.rowCount, this.isLastRowKnown = !0;
    else if (t > s.rowData.length)
      this.numberOfRows = e + s.rowData.length, this.isLastRowKnown = !0;
    else if (!this.isLastRowKnown) {
      const o = e + s.rowData.length + 1;
      o > this.numberOfRows && (this.numberOfRows = o);
    }
    this.isLastRowKnown && this.nodeMap.filter((a) => a.index >= this.numberOfRows).forEach((a) => this.destroyRowAtIndex(a.index)), this.fireStoreUpdatedEvent();
    const n = this.nodesToRefresh.size === 0;
    r && n && this.fireRefreshFinishedEvent();
  }
  fireRefreshFinishedEvent() {
    this.nodesToRefresh.size === 0 && (this.removedNodeCache.forEach((t) => {
      this.blockUtils.destroyRowNode(t);
    }), this.removedNodeCache = /* @__PURE__ */ new Map(), this.store.fireRefreshFinishedEvent());
  }
  /**
   * @returns true if all rows are loaded
   */
  isStoreFullyLoaded() {
    const e = this.isLastRowKnown, t = this.nodeMap.getSize() === this.numberOfRows;
    if (!e || !t || this.nodesToRefresh.size > 0)
      return;
    let s = -1;
    return this.nodeMap.find((r) => (s += 1, !!(r.index !== s || r.node.__needsRefreshWhenVisible || r.node.stub))) == null;
  }
  isLastRowIndexKnown() {
    return this.isLastRowKnown;
  }
  onLoadFailed(e, t) {
    if (!this.live)
      return;
    const s = this.nodesToRefresh.size > 0;
    for (let r = e; r < e + t && r < this.getRowCount(); r++) {
      let { node: n } = this.nodeMap.getBy("index", r) ?? {};
      n && this.nodesToRefresh.delete(n), (!n || !n.stub) && (n && !n.stub && this.destroyRowAtIndex(r), n = this.createRowAtIndex(r)), n.__needsRefreshWhenVisible = !1, n.failedLoad = !0;
    }
    const i = this.nodesToRefresh.size === 0;
    s && i && this.fireRefreshFinishedEvent(), this.fireStoreUpdatedEvent();
  }
  markNodesForRefresh() {
    this.nodeMap.forEach((e) => {
      e.node.stub && !e.node.failedLoad || this.nodesToRefresh.add(e.node);
    }), this.lazyBlockLoadingSvc.queueLoadCheck(), this.isLastRowKnown && this.numberOfRows === 0 && (this.numberOfRows = 1, this.isLastRowKnown = !1, this.fireStoreUpdatedEvent());
  }
  isNodeInCache(e) {
    return !!this.nodeMap.getBy("id", e);
  }
  // gets called 1) row count changed 2) cache purged 3) items inserted
  fireStoreUpdatedEvent() {
    this.live && this.store.fireStoreUpdatedEvent();
  }
  getRowId(e) {
    if (this.getRowIdFunc == null)
      return null;
    const { level: t } = this.store.getRowDetails(), s = this.store.getParentNode().getRoute() ?? [];
    return this.getRowIdFunc({
      data: e,
      parentKeys: s.length > 0 ? s : void 0,
      level: t
    });
  }
  getOrderedNodeMap() {
    const e = {};
    return this.nodeMap.forEach((t) => e[t.index] = t), e;
  }
  clearDisplayIndexes() {
    this.nodeDisplayIndexMap.clear();
  }
  /**
   * Client side sorting
   */
  clientSideSortRows() {
    var r;
    const e = ((r = this.sortSvc) == null ? void 0 : r.getSortOptions()) ?? [];
    if (!e.some((n) => n.sort != null) || !this.rowNodeSorter)
      return;
    const s = new Array(this.nodeMap.getSize());
    this.nodeMap.forEach((n) => s[n.index] = n.node), this.nodeMap.clear(), this.rowNodeSorter.doFullSort(s, e).forEach((n, o) => {
      this.nodeMap.set({
        id: n.id,
        node: n,
        index: o
      });
    });
  }
  /**
   * Transaction Support here
   */
  updateRowNodes(e) {
    const t = [];
    return e.forEach((s) => {
      const i = this.getRowId(s), r = this.nodeMap.getBy("id", i);
      r && (this.blockUtils.updateDataIntoRowNode(r.node, s), t.push(r.node));
    }), t;
  }
  insertRowNodes(e, t) {
    const s = this.store.getRowCount() - (this.store.getParentNode().sibling ? 1 : 0), i = t == null && this.isLastRowKnown ? s : t;
    if (i == null || s < i)
      return [];
    const r = {};
    e.forEach((l) => {
      const c = this.getRowId(l);
      c && this.isNodeInCache(c) || (r[c] = l);
    });
    const n = Object.values(r), o = n.length;
    if (o === 0)
      return [];
    const a = this.nodeMap.filter((l) => l.index >= i);
    return a.forEach((l) => this.nodeMap.delete(l)), a.forEach((l) => {
      this.nodeMap.set({
        node: l.node,
        index: l.index + o,
        id: l.id
      });
    }), this.numberOfRows += o, n.map(
      (l, c) => this.createRowAtIndex(i + c, l)
    );
  }
  removeRowNodes(e) {
    const t = [], s = [];
    let i = 0;
    const r = [...e], n = this.getOrderedNodeMap();
    let o = -1;
    for (const a of Object.keys(n)) {
      o += 1;
      const l = n[a], c = r.findIndex((h) => h === l.id);
      if (c !== -1) {
        r.splice(c, 1), this.destroyRowAtIndex(Number(a)), t.push(l.node), i += 1;
        continue;
      }
      if (i === 0)
        continue;
      const d = Number(a);
      o !== d && s.push(l.node), this.nodeMap.delete(l), this.nodeMap.set({
        id: l.id,
        node: l.node,
        index: d - i
      });
    }
    return this.numberOfRows -= this.isLastRowIndexKnown() ? e.length : i, r.length > 0 && s.length > 0 && (s.forEach((a) => a.__needsRefreshWhenVisible = !0), this.lazyBlockLoadingSvc.queueLoadCheck()), t;
  }
  /**
   * Return the block size configured for this cache
   */
  getBlockSize() {
    return this.storeParams.cacheBlockSize || wW;
  }
  /**
   * Get the start index of the loading block for a given index
   */
  getBlockStartIndex(e) {
    const t = this.getBlockSize();
    return e - e % t;
  }
  /**
   * Get the start and end index of a block, given a row store index
   */
  getBlockBounds(e) {
    const t = this.getBlockStartIndex(e), s = this.getBlockSize();
    return [t, t + s];
  }
}, bW = class extends R {
  constructor(e, t, s) {
    super(), this.idSequence = { value: 0 }, this.ssrmParams = e, this.parentRowNode = s, this.storeParams = t, this.level = s.level + 1, this.group = e.rowGroupCols ? this.level < e.rowGroupCols.length : !1, this.leafGroup = e.rowGroupCols ? this.level === e.rowGroupCols.length - 1 : !1, this.info = {};
  }
  wireBeans(e) {
    this.blockUtils = e.ssrmBlockUtils, this.storeUtils = e.ssrmStoreUtils, this.selectionSvc = e.selectionSvc, this.rowGroupColsSvc = e.rowGroupColsSvc;
  }
  postConstruct() {
    let e = 1;
    if (this.level === 0 && (e = this.storeUtils.getServerSideInitialRowCount() ?? 1, this.eventSvc.dispatchEventOnce({
      type: "rowCountReady"
    })), this.cache = this.createManagedBean(new Ll(this, e, !1, this.storeParams)), !this.gos.get("treeData") && this.group && this.rowGroupColsSvc) {
      const s = this.ssrmParams.rowGroupCols[this.level];
      this.groupField = s.field, this.rowGroupColumn = this.rowGroupColsSvc.columns[this.level];
    }
  }
  destroy() {
    this.displayIndexStart = void 0, this.displayIndexEnd = void 0, this.destroyBean(this.cache), super.destroy();
  }
  /**
   * Given a server response, ingest the rows outside of the data source lifecycle.
   *
   * @param rowDataParams the server response containing the rows to ingest
   * @param startRow the index to start ingesting rows
   * @param expectedRows the expected number of rows in the response (used to determine if the last row index is known)
   */
  applyRowData(e, t, s) {
    this.cache.onLoadSuccess(t, s, e);
  }
  /**
   * Applies a given transaction to the data set within this store
   *
   * @param transaction an object containing delta instructions determining the changes to apply to this store
   * @returns an object determining the status of this transaction and effected nodes
   */
  applyTransaction(e) {
    var d, h, u;
    const t = es(this.gos);
    if (!t)
      return F(206), {
        status: Kt.Cancelled
      };
    const s = this.gos.getCallback("isApplyServerSideTransaction");
    if (s) {
      const g = {
        transaction: e,
        parentNode: this.parentRowNode,
        groupLevelInfo: this.info
      };
      if (!s(g))
        return { status: Kt.Cancelled };
    }
    const i = this.cache.isStoreFullyLoaded();
    let r;
    (d = e.update) != null && d.length && (r = this.cache.updateRowNodes(e.update));
    let n;
    if ((h = e.add) != null && h.length) {
      let g = e.addIndex;
      g != null && g < 0 && (g = void 0), n = this.cache.insertRowNodes(e.add, g);
    }
    let o;
    if ((u = e.remove) != null && u.length) {
      const g = e.remove.map(
        (f) => t({ level: this.level, parentKeys: this.parentRowNode.getRoute() ?? [], data: f })
      ), p = [...new Set(g)];
      o = this.cache.removeRowNodes(p);
    }
    const a = this.gos.get("serverSideEnableClientSideSort"), l = (r == null ? void 0 : r.length) || (n == null ? void 0 : n.length);
    return i && a && l && this.cache.clientSideSortRows(), this.updateSelectionAfterTransaction(r, o), {
      status: Kt.Applied,
      update: r,
      add: n,
      remove: o
    };
  }
  updateSelectionAfterTransaction(e, t) {
    if (!this.selectionSvc)
      return;
    const s = [];
    e == null || e.forEach((i) => {
      i.isSelected() && !i.selectable && s.push(i);
    }), t == null || t.forEach((i) => {
      i.isSelected() && s.push(i);
    }), s.length && this.selectionSvc.setNodesSelected({
      newValue: !1,
      clearSelection: !1,
      nodes: s,
      source: "rowDataChanged"
    });
  }
  /**
   * Clear the display indexes, used for fading rows out when stores are not being destroyed
   */
  clearDisplayIndexes() {
    this.displayIndexStart = void 0, this.displayIndexEnd = void 0, this.cache.getNodes().forEach((e) => this.blockUtils.clearDisplayIndex(e.node)), this.parentRowNode.sibling && this.blockUtils.clearDisplayIndex(this.parentRowNode.sibling), this.cache.clearDisplayIndexes();
  }
  /**
   * @returns an index representing the last sequentially displayed row in the grid for this store
   */
  getDisplayIndexStart() {
    return this.displayIndexStart;
  }
  /**
   * @returns the index representing one after the last sequentially displayed row in the grid for this store
   */
  getDisplayIndexEnd() {
    return this.displayIndexEnd;
  }
  /**
   * @returns the virtual size of this store
   */
  getRowCount() {
    return this.parentRowNode.sibling ? this.cache.getRowCount() + 1 : this.cache.getRowCount();
  }
  /**
   * Sets the current row count of the store, and whether the last row index is known
   */
  setRowCount(e, t) {
    this.cache.setRowCount(e, t);
  }
  /**
   * Given a display index, returns whether that row is within this store or a child store of this store
   *
   * @param displayIndex the visible index of a row
   * @returns whether or not the row exists within this store
   */
  isDisplayIndexInStore(e) {
    return this.cache.getRowCount() === 0 ? !1 : this.displayIndexStart <= e && e < this.getDisplayIndexEnd();
  }
  /**
   * Recursively sets up the display indexes and top position of every node belonging to this store.
   *
   * Called after a row height changes, or a store updated event.
   *
   * @param displayIndexSeq the number sequence for generating the display index of each row
   * @param nextRowTop an object containing the next row top value intended to be modified by ref per row
   */
  setDisplayIndexes(e, t, s) {
    this.displayIndexStart = e.value, this.topPx = t.value;
    const i = this.parentRowNode.level > -1 && ur(this.gos)({ node: this.parentRowNode });
    i || Kd(this.parentRowNode), i === "top" && (Fs(this.parentRowNode, this.beans), this.blockUtils.setDisplayIndex(this.parentRowNode.sibling, e, t, s)), this.cache.setDisplayIndexes(e, t, s), i === "bottom" && (Fs(this.parentRowNode, this.beans), this.blockUtils.setDisplayIndex(this.parentRowNode.sibling, e, t, s)), this.displayIndexEnd = e.value, this.heightPx = t.value - this.topPx;
  }
  /**
   * Recursively applies a provided function to every node
   *
   * For the purpose of exclusively server side filtered stores, this is the same as getNodes().forEachDeepAfterFilterAndSort
   */
  forEachStoreDeep(e, t = { value: 0 }) {
    e(this, t.value++), this.cache.getNodes().forEach((s) => {
      const i = s.node.childStore;
      i && i.forEachStoreDeep(e, t);
    });
  }
  /**
   * Recursively applies a provided function to every node
   *
   * For the purpose of exclusively server side filtered stores, this is the same as getNodes().forEachDeepAfterFilterAndSort
   */
  forEachNodeDeep(e, t = { value: 0 }) {
    this.cache.getNodes().forEach((s) => {
      e(s.node, t.value++);
      const i = s.node.childStore;
      i && i.forEachNodeDeep(e, t);
    });
  }
  /**
   * Recursively applies a provided function to every node
   *
   * For the purpose of exclusively server side filtered stores, this is the same as getNodes().forEachDeep
   */
  forEachNodeDeepAfterFilterAndSort(e, t = { value: 0 }, s = !1) {
    const i = this.parentRowNode.level > -1 && ur(this.gos)({ node: this.parentRowNode });
    i === "top" && e(this.parentRowNode.sibling, t.value++);
    const r = this.cache.getOrderedNodeMap();
    for (const n of Object.values(r)) {
      e(n.node, t.value++);
      const o = n.node.childStore;
      o && o.forEachNodeDeepAfterFilterAndSort(e, t, s);
    }
    i === "bottom" && e(this.parentRowNode.sibling, t.value++);
  }
  /**
   * Removes the failed status from all nodes, and marks them as stub to encourage reloading
   */
  retryLoads() {
    this.cache.getNodes().forEach(({ node: e }) => {
      e.failedLoad && (e.failedLoad = !1, e.__needsRefreshWhenVisible = !0, e.stub = !0);
    }), this.forEachChildStoreShallow((e) => e.retryLoads()), this.fireStoreUpdatedEvent();
  }
  /**
   * Given a display index, returns the row at that location.
   *
   * @param displayRowIndex the displayed index within the grid to search for
   * @returns the row node if the display index falls within the store, if it didn't exist this will create a new stub to return
   */
  getRowUsingDisplayIndex(e) {
    return this.parentRowNode.sibling && e === this.parentRowNode.sibling.rowIndex ? this.parentRowNode.sibling : this.cache.getRowByDisplayIndex(e);
  }
  /**
   * Given a display index, returns the row top and height for the row at that index.
   *
   * @param displayIndex the display index of the node
   * @returns an object containing the rowTop and rowHeight of the node at the given displayIndex
   */
  getRowBounds(e) {
    if (!this.isDisplayIndexInStore(e))
      return null;
    const t = this.cache.getNodeCachedByDisplayIndex(e);
    if (t) {
      const a = this.blockUtils.extractRowBounds(t, e);
      if (a)
        return a;
    }
    const { previousNode: s, nextNode: i } = this.cache.getSurroundingNodesByDisplayIndex(e) ?? {};
    if (s) {
      const a = this.blockUtils.extractRowBounds(s.node, e);
      if (a != null)
        return a;
    }
    const r = pt(this.beans);
    if (i) {
      const a = (i.node.rowIndex - e) * r;
      return {
        rowTop: i.node.rowTop - a,
        rowHeight: r
      };
    }
    const n = this.topPx + this.heightPx, o = (this.getDisplayIndexEnd() - e) * r;
    return {
      rowTop: n - o,
      rowHeight: r
    };
  }
  /**
   * Given a vertical pixel, determines whether this store contains a row at that pixel
   *
   * @param pixel a vertical pixel position from the grid
   * @returns whether that pixel points to a virtual space belonging to this store
   */
  isPixelInRange(e) {
    return e >= this.topPx && e < this.topPx + this.heightPx;
  }
  /**
   * Given a vertical pixel, returns the row existing at that pixel location
   *
   * @param pixel a vertical pixel position from the grid
   * @returns the display index at the given pixel location
   */
  getRowIndexAtPixel(e) {
    if (e < this.topPx)
      return this.getDisplayIndexStart();
    if (e >= this.topPx + this.heightPx)
      return this.getDisplayIndexEnd() - 1;
    if (this.parentRowNode.sibling && e > this.parentRowNode.sibling.rowTop && e < this.parentRowNode.sibling.rowTop + this.parentRowNode.sibling.rowHeight)
      return this.parentRowNode.sibling.rowIndex;
    let t = Number.MAX_SAFE_INTEGER, s = null, i = Number.MAX_SAFE_INTEGER, r = null;
    if (this.cache.getNodes().forEach(({ node: l }) => {
      const c = Math.abs(e - l.rowTop);
      if (l.rowTop < e) {
        c < t && (t = c, s = l);
        return;
      }
      c < i && (i = c, r = l);
    }), s = s, r = r, s) {
      const l = this.blockUtils.getIndexAtPixel(s, e);
      if (l != null)
        return l;
    }
    const n = pt(this.beans);
    if (r) {
      const l = r.rowTop, c = Math.ceil((l - e) / n);
      return r.rowIndex - c;
    }
    const o = this.topPx + this.heightPx, a = Math.floor((o - e) / n);
    return this.getDisplayIndexEnd() - a;
  }
  /**
   * Given a path of group keys, returns the child store for that group.
   *
   * @param keys the grouping path to the desired store
   * @returns the child store for the given keys, or null if not found
   */
  getChildStore(e) {
    return this.storeUtils.getChildStore(e, this, (t) => {
      const s = this.cache.getNodes().find((i) => i.node.key == t);
      return s ? s.node : null;
    });
  }
  /**
   * Executes a provided callback on each child store belonging to this store
   *
   * @param cb the callback to execute
   */
  forEachChildStoreShallow(e) {
    this.cache.getNodes().forEach(({ node: t }) => {
      t.childStore && e(t.childStore);
    });
  }
  /**
   * Executes after a change to sorting, determines recursively whether this store or a child requires refreshed.
   *
   * If a purge refresh occurs, the row count is preserved.
   *
   * @param params a set of properties pertaining to the sort changes
   */
  refreshAfterSort(e) {
    if (this.storeUtils.isServerSideSortAllLevels() || this.storeUtils.isServerRefreshNeeded(this.parentRowNode, this.ssrmParams.rowGroupCols, e)) {
      const s = this.cache.isStoreFullyLoaded(), i = this.gos.get("serverSideEnableClientSideSort");
      if (!(s && i)) {
        const n = this.cache.getRowCount(), o = this.cache.isLastRowIndexKnown();
        this.destroyBean(this.cache), this.cache = this.createManagedBean(new Ll(this, n, o, this.storeParams));
        return;
      }
      this.cache.clientSideSortRows();
    }
    this.forEachChildStoreShallow((s) => s.refreshAfterSort(e));
  }
  /**
   * Executes after a change to filtering, determines recursively whether this store or a child requires refreshed.
   *
   * If a refresh occurs, the row count is reset.
   *
   * @param params a set of properties pertaining to the filter changes
   */
  refreshAfterFilter(e) {
    if (!this.storeUtils.isServerSideOnlyRefreshFilteredGroups() || this.storeUtils.isServerRefreshNeeded(this.parentRowNode, this.ssrmParams.rowGroupCols, e)) {
      this.refreshStore(!0);
      return;
    }
    this.forEachChildStoreShallow((s) => s.refreshAfterFilter(e));
  }
  /**
   * Marks all existing nodes as requiring reloaded, and triggers a load check
   *
   * @param purge whether to remove all nodes and data in favour of stub nodes
   */
  refreshStore(e) {
    if (e) {
      this.destroyBean(this.cache), this.cache = this.createManagedBean(new Ll(this, 1, !1, this.storeParams)), this.fireStoreUpdatedEvent();
      return;
    }
    this.cache.markNodesForRefresh();
  }
  /**
   * Used for pagination, given a local/store index, returns the display index of that row
   *
   * @param topLevelIndex the store index of a row
   * @returns the display index for the given store index
   */
  getTopLevelRowDisplayedIndex(e) {
    return this.cache.getDisplayIndexFromStoreIndex(e) ?? e;
  }
  /**
   * Used for pagination to determine if the last page is known, and for aria to determine if the last grid row is known
   *
   * @returns whether the last index of this store is known, or if lazy loading still required
   */
  isLastRowIndexKnown() {
    return this.cache.isLastRowIndexKnown();
  }
  /**
   * Used by the selection service to select a range of nodes
   *
   * @param firstInRange the first node in the range to find
   * @param lastInRange the last node in the range to find
   * @returns a range of nodes between firstInRange and lastInRange inclusive
   */
  getRowNodesInRange(e, t) {
    return this.cache.getNodes().filter(({ node: s }) => s.rowIndex >= e.rowIndex && s.rowIndex <= t.rowIndex).map(({ node: s }) => s);
  }
  /**
   * Mutates a given array to add this stores state, and recursively add all the children store states.
   *
   * @param result a mutable results array
   */
  addStoreStates(e) {
    e.push({
      route: this.parentRowNode.getRoute() ?? [],
      rowCount: this.getRowCount(),
      lastRowIndexKnown: this.isLastRowIndexKnown(),
      info: this.info,
      maxBlocksInCache: this.storeParams.maxBlocksInCache,
      cacheBlockSize: this.storeParams.cacheBlockSize
    }), this.forEachChildStoreShallow((t) => t.addStoreStates(e));
  }
  getIdSequence() {
    return this.idSequence;
  }
  getParentNode() {
    return this.parentRowNode;
  }
  getRowDetails() {
    return {
      field: this.groupField,
      group: this.group,
      leafGroup: this.leafGroup,
      level: this.level,
      parent: this.parentRowNode,
      rowGroupColumn: this.rowGroupColumn
    };
  }
  getSsrmParams() {
    return this.ssrmParams;
  }
  setStoreInfo(e) {
    e && Object.assign(this.info, e);
  }
  // gets called 1) row count changed 2) cache purged
  fireStoreUpdatedEvent() {
    this.eventSvc.dispatchEvent({
      type: "storeUpdated"
    });
  }
  // gets called when row data updated, and no more refreshing needed
  fireRefreshFinishedEvent() {
    this.eventSvc.dispatchEvent({
      type: "storeRefreshed",
      route: this.parentRowNode.getRoute()
    });
  }
  getBlockStates() {
    return this.cache.getBlockStates();
  }
  getStoreBounds() {
    return {
      topPx: this.topPx,
      heightPx: this.heightPx
    };
  }
  getCache() {
    return this.cache;
  }
  getFirstNode() {
    const e = this.cache.getNodes().getBy("index", 0);
    return (e == null ? void 0 : e.node) ?? null;
  }
}, yW = class extends R {
  constructor() {
    super(...arguments), this.beanName = "ssrmStoreFactory";
  }
  wireBeans(e) {
    this.colModel = e.colModel, this.rowGroupColsSvc = e.rowGroupColsSvc, this.pivotColsSvc = e.pivotColsSvc, this.rowAutoHeight = e.rowAutoHeight;
  }
  createStore(e, t) {
    const s = this.getStoreParams(e, t);
    return new bW(e, s, t);
  }
  getStoreParams(e, t) {
    const s = this.getLevelSpecificParams(t), i = this.getBlockSize(s), r = this.getMaxBlocksInCache(e, s);
    return {
      cacheBlockSize: i,
      maxBlocksInCache: r
    };
  }
  getMaxBlocksInCache(e, t) {
    var r;
    const s = t && t.maxBlocksInCache != null ? t.maxBlocksInCache : this.gos.get("maxBlocksInCache");
    if (s != null && s >= 0) {
      if (e.dynamicRowHeight) {
        F(203);
        return;
      }
      if ((r = this.rowAutoHeight) != null && r.active) {
        F(204);
        return;
      }
      return s;
    }
  }
  getBlockSize(e) {
    const t = e && e.cacheBlockSize != null ? e.cacheBlockSize : this.gos.get("cacheBlockSize");
    return t != null && t > 0 ? t : 100;
  }
  getLevelSpecificParams(e) {
    var r, n;
    const t = this.gos.getCallback("getServerSideGroupLevelParams");
    if (!t)
      return;
    const s = {
      level: e.level + 1,
      parentRowNode: e.level >= 0 ? e : void 0,
      rowGroupColumns: ((r = this.rowGroupColsSvc) == null ? void 0 : r.columns) ?? [],
      pivotColumns: ((n = this.pivotColsSvc) == null ? void 0 : n.columns) ?? [],
      pivotMode: this.colModel.isPivotMode()
    };
    return t(s);
  }
}, SW = class extends R {
  constructor() {
    super(...arguments), this.beanName = "ssrmStoreUtils";
  }
  wireBeans(e) {
    this.colModel = e.colModel, this.serverSideRowModel = e.rowModel, this.storeFactory = e.ssrmStoreFactory;
  }
  getChildStore(e, t, s) {
    if (!(e != null && e.length))
      return t;
    const i = e[0], r = s(i);
    if (r) {
      if (e.length === 1 && !r.childStore) {
        const a = this.serverSideRowModel.getParams();
        r.childStore = this.createBean(this.storeFactory.createStore(a, r));
      }
      const n = e.slice(1, e.length), o = r.childStore;
      return o ? o.getChildStore(n) : null;
    }
    return null;
  }
  isServerRefreshNeeded(e, t, s) {
    if (s.valueColChanged || s.secondaryColChanged)
      return !0;
    const i = e.level + 1;
    if (!(i < t.length))
      return !0;
    const o = t[i].id;
    return s.changedColumns.indexOf(o) > -1 ? !0 : this.colModel.getCols().filter((d) => d.getColDef().showRowGroup && s.changedColumns.includes(d.getId())).map((d) => d.getColDef().showRowGroup).some((d) => d === !0 || d === o);
  }
  getServerSideInitialRowCount() {
    return this.gos.get("serverSideInitialRowCount");
  }
  isServerSideSortAllLevels() {
    return this.gos.get("serverSideSortAllLevels") && Le(this.gos);
  }
  isServerSideOnlyRefreshFilteredGroups() {
    return this.gos.get("serverSideOnlyRefreshFilteredGroups") && Le(this.gos);
  }
}, xW = class extends R {
  constructor() {
    super(...arguments), this.beanName = "ssrmTxnManager", this.asyncTransactions = [];
  }
  wireBeans(e) {
    this.valueCache = e.valueCache, this.serverSideRowModel = e.rowModel, this.selectionSvc = e.selectionSvc;
  }
  postConstruct() {
    Le(this.gos);
  }
  applyTransactionAsync(e, t) {
    this.asyncTransactionsTimeout == null && this.scheduleExecuteAsync(), this.asyncTransactions.push({ transaction: e, callback: t });
  }
  scheduleExecuteAsync() {
    const e = this.gos.get("asyncTransactionWaitMillis");
    this.asyncTransactionsTimeout = window.setTimeout(() => {
      this.executeAsyncTransactions();
    }, e);
  }
  executeAsyncTransactions() {
    var r;
    if (!this.asyncTransactions)
      return;
    const e = [], t = [], s = [];
    let i = !1;
    this.asyncTransactions.forEach((n) => {
      let o;
      if (this.serverSideRowModel.executeOnStore(n.transaction.route, (c) => {
        o = c.applyTransaction(n.transaction);
      }) ? o == null && (o = { status: Kt.StoreNotFound }) : o = { status: Kt.StoreNotStarted }, t.push(o), o.status == Kt.StoreLoading) {
        s.push(n);
        return;
      }
      n.callback && e.push(() => n.callback(o)), o.status === Kt.Applied && (i = !0);
    }), e.length > 0 && window.setTimeout(() => {
      e.forEach((n) => n());
    }, 0), this.asyncTransactionsTimeout = void 0, this.asyncTransactions = s, i && ((r = this.valueCache) == null || r.onDataChanged(), this.eventSvc.dispatchEvent({ type: "storeUpdated" })), t.length > 0 && this.eventSvc.dispatchEvent({
      type: "asyncTransactionsFlushed",
      results: t
    });
  }
  flushAsyncTransactions() {
    this.asyncTransactionsTimeout != null && clearTimeout(this.asyncTransactionsTimeout), this.executeAsyncTransactions();
  }
  applyTransaction(e) {
    var i;
    let t;
    if (this.serverSideRowModel.executeOnStore(e.route, (r) => {
      t = r.applyTransaction(e);
    }))
      if (t) {
        if ((i = this.valueCache) == null || i.onDataChanged(), t.remove && this.selectionSvc) {
          const r = t.remove.map((n) => n.id);
          this.selectionSvc.deleteSelectionStateFromParent(e.route || [], r);
        }
        return this.eventSvc.dispatchEvent({ type: "storeUpdated" }), t;
      } else
        return { status: Kt.StoreNotFound };
    else return { status: Kt.StoreNotStarted };
  }
}, FW = {
  moduleName: "ServerSideRowModel",
  version: Y,
  rowModels: ["serverSide"],
  beans: [
    rW,
    J2,
    SW,
    Q2,
    iW,
    xW,
    eW,
    yW,
    tW,
    fW,
    CW,
    mW,
    pW,
    sW
  ],
  dependsOn: [
    ie,
    Dd,
    Om,
    uv,
    pv,
    E2
  ]
}, RW = {
  moduleName: "ServerSideRowModelApi",
  version: Y,
  apiFunctions: {
    getServerSideSelectionState: nW,
    setServerSideSelectionState: oW,
    applyServerSideTransaction: aW,
    applyServerSideTransactionAsync: cW,
    applyServerSideRowData: lW,
    retryServerSideLoads: dW,
    flushServerSideAsyncTransactions: hW,
    refreshServerSide: uW,
    getServerSideGroupLevelState: gW,
    resetRowHeights: zd,
    onRowHeightChanged: Hd
  },
  dependsOn: [ie, Bm, Vm, Nm]
}, PW = (
  /*css*/
  ".ag-sparkline-wrapper{height:100%;line-height:normal;position:absolute;top:0;width:100%}"
), kl = Symbol("WrappedFunctionMarker"), rg = (e, t) => {
  if (e[kl])
    return e;
  const s = (...i) => t(e, ...i);
  return s[kl] = kl, s;
};
function EW(e) {
  return { content: `${e.xValue} ${e.yValue}` };
}
function TW(e) {
  return { content: `${e.yValue}` };
}
var MW = class extends D {
  constructor() {
    super({
      tag: "div",
      cls: "ag-sparkline-wrapper",
      children: [{ tag: "span", ref: "eSparkline" }]
    }), this.eSparkline = x, this.cachedWidth = 0, this.cachedHeight = 0, this.dataRef = [], this.processedData = [];
  }
  postConstruct() {
    this.env = this.beans.environment, this.addManagedPropertyListeners(
      ["chartThemeOverrides", "chartThemes", "styleNonce"],
      () => this.refresh(this.params)
    );
  }
  createListener(e = !0) {
    return () => {
      var t, s, i;
      return this.updateSize(((s = (t = this.params) == null ? void 0 : t.column) == null ? void 0 : s.getActualWidth()) ?? 0, (((i = this.params) == null ? void 0 : i.node.rowHeight) ?? 0) - 2, e);
    };
  }
  initGridObserver() {
    var r, n;
    const e = this.createListener(), t = this.createListener(!1), s = (r = this.params) == null ? void 0 : r.column, i = (n = this.params) == null ? void 0 : n.node;
    s.__addEventListener("columnStateUpdated", e), i.__addEventListener("heightChanged", e), this.addDestroyFunc(() => {
      s.__removeEventListener("columnStateUpdated", e), i.__removeEventListener("heightChanged", e);
    }), t();
  }
  updateSize(e, t, s = !0) {
    if (e -= this.env.getCellPadding(), e !== this.cachedWidth || t !== this.cachedHeight) {
      this.cachedWidth = e, this.cachedHeight = t;
      const i = this.refresh.bind(this);
      s ? Fo(() => this.isAlive() && i()) : i();
    }
  }
  init(e) {
    this.params = e, this.initGridObserver();
  }
  refresh(e = this.params) {
    var n, o, a, l, c;
    var t;
    this.params = e;
    const s = this.cachedWidth, i = this.cachedHeight, r = this.gos.get("styleNonce");
    if (!this.sparklineInstance && e && s > 0 && i > 0) {
      if (this.sparklineOptions = {
        container: this.eSparkline,
        width: s,
        height: i,
        ...e.sparklineOptions,
        ...r ? { styleNonce: r } : {},
        data: this.processData(e.value)
      }, (t = this.sparklineOptions).type ?? (t.type = "line"), (n = this.sparklineOptions.tooltip) != null && n.renderer)
        this.wrapTooltipRenderer();
      else {
        const h = this.getDefaultTooltipRenderer();
        this.sparklineOptions.tooltip = {
          ...this.sparklineOptions.tooltip,
          renderer: h
        };
      }
      const d = (o = this.sparklineOptions) == null ? void 0 : o.theme;
      return this.sparklineOptions.type === "bar" && this.sparklineOptions.itemStyler ? this.wrapItemStyler(this.sparklineOptions) : (c = (l = (a = d == null ? void 0 : d.overrides) == null ? void 0 : a.bar) == null ? void 0 : l.series) != null && c.itemStyler && this.wrapItemStyler(d.overrides.bar.series), this.sparklineInstance = e.createSparkline(this.sparklineOptions), !0;
    } else if (this.sparklineInstance)
      return this.sparklineInstance.update({
        ...this.sparklineOptions,
        data: this.processData(e == null ? void 0 : e.value),
        width: s,
        height: i,
        ...r ? { styleNonce: r } : {}
      }), !0;
    return !1;
  }
  processData(e = []) {
    return e.length === 0 ? e : (this.dataRef !== e && (this.dataRef = e, this.processedData = Array.isArray(e[0]) ? e.filter((t) => t != null) : e), this.processedData);
  }
  createContext() {
    var e, t;
    return {
      data: (e = this.params) == null ? void 0 : e.data,
      cellData: (t = this.params) == null ? void 0 : t.value
    };
  }
  getDefaultTooltipRenderer(e) {
    var n;
    const t = e == null ? void 0 : e.title, s = this.sparklineOptions.xKey, i = Array.isArray((n = this.sparklineOptions.data) == null ? void 0 : n[0]);
    return !t && (s || i) ? EW : TW;
  }
  wrapItemStyler(e) {
    e.itemStyler = rg(e.itemStyler, (t, s) => t({
      ...s,
      context: this.createContext()
    }));
  }
  wrapTooltipRenderer() {
    this.sparklineOptions.tooltip = {
      ...this.sparklineOptions.tooltip,
      renderer: rg(this.sparklineOptions.tooltip.renderer, (e, t) => {
        const s = e({
          ...t,
          context: this.createContext()
        });
        return typeof s == "string" ? s : {
          ...this.getDefaultTooltipRenderer(s)(t),
          ...s
        };
      })
    };
  }
  destroy() {
    var e;
    super.destroy(), (e = this.sparklineInstance) == null || e.destroy();
  }
}, ng = "Sparklines", DW = {
  moduleName: ng,
  version: Y,
  dependsOn: [ie],
  validate: () => ({
    isValid: !1,
    message: Zg(258)
  }),
  with: (e) => (e.setup(), {
    moduleName: ng,
    version: Y,
    dependsOn: [ie],
    css: [PW],
    userComponents: {
      agSparklineCellRenderer: {
        classImp: MW,
        /** Default params for provided components */
        params: { createSparkline: e.createSparkline }
      }
    },
    validate: () => ({ isValid: !0 })
  })
}, AW = (
  /*css*/
  ".ag-find-cell{display:block;overflow:hidden;text-overflow:ellipsis}.ag-find-match{background-color:var(--ag-find-match-background-color);color:var(--ag-find-match-color)}.ag-find-active-match{background-color:var(--ag-find-active-match-background-color);color:var(--ag-find-active-match-color)}"
);
function IW(e) {
  var t;
  (t = e.findSvc) == null || t.next();
}
function LW(e) {
  var t;
  (t = e.findSvc) == null || t.previous();
}
function kW(e) {
  var t;
  return ((t = e.findSvc) == null ? void 0 : t.totalMatches) ?? 0;
}
function GW(e, t, s) {
  var i;
  (i = e.findSvc) == null || i.goTo(t, s);
}
function OW(e) {
  var t;
  (t = e.findSvc) == null || t.clearActive();
}
function VW(e) {
  var t;
  return (t = e.findSvc) == null ? void 0 : t.activeMatch;
}
function BW(e, t) {
  var r;
  const { node: s, column: i } = t;
  return ((r = e.findSvc) == null ? void 0 : r.getNumMatches(s, i)) ?? 0;
}
function NW(e, t) {
  var s;
  return ((s = e.findSvc) == null ? void 0 : s.getParts(t)) ?? [];
}
function HW(e) {
  var t;
  return (t = e.findSvc) == null ? void 0 : t.refresh(!0);
}
var zW = { tag: "span", cls: "ag-find-cell" }, WW = class extends D {
  constructor() {
    super(zW);
  }
  init(e) {
    this.refresh(e);
  }
  refresh(e) {
    const { node: t, column: s } = e, { findSvc: i, valueSvc: r } = this.beans, { value: n, valueFormatted: o } = r.getValueForDisplay(s, t, !0), a = o ?? n ?? "", l = this.getGui();
    X(l);
    const c = i == null ? void 0 : i.getParts({ value: a, node: t, column: s ?? null });
    if (!c)
      return l.textContent = Nt(a) ?? "", l.classList.remove("ag-find-cell-active-match"), !0;
    let d = !1;
    for (const { value: h, match: u, activeMatch: g } of c) {
      const p = Nt(h) ?? "";
      if (u) {
        const f = K({ tag: "mark", cls: "ag-find-match" });
        f.textContent = p, g && (f.classList.add("ag-find-active-match"), d = !0), l.appendChild(f);
      } else
        l.appendChild(document.createTextNode(p));
    }
    return l.classList.toggle("ag-find-cell-active-match", d), !0;
  }
};
function og(e) {
  return e == null ? void 0 : e.toLocaleLowerCase();
}
function Gr(e, t, s) {
  const i = t(Nt(s));
  let r = 0;
  if (i != null && i.length) {
    let n = -1;
    for (; n = i.indexOf(e, n + 1), n != -1; )
      r++;
  }
  return r;
}
var _W = class extends R {
  constructor() {
    super(...arguments), this.beanName = "findSvc", this.active = !1, this.topMatches = /* @__PURE__ */ new Map(), this.topNodes = [], this.topNumMatches = 0, this.centerMatches = /* @__PURE__ */ new Map(), this.centerNodes = [], this.centerNumMatches = 0, this.bottomMatches = /* @__PURE__ */ new Map(), this.bottomNodes = [], this.caseFormat = og, this.scrollOnRefresh = !1, this.totalMatches = 0;
  }
  postConstruct() {
    if (!te(this.gos))
      return;
    const e = this.refresh.bind(this, !1), t = this.refresh.bind(this, !0), s = pe(
      this,
      () => {
        this.isAlive() && t();
      },
      0
    );
    this.refreshDebounced = s, this.addManagedPropertyListener("findSearchValue", e), this.addManagedPropertyListener("findOptions", ({ currentValue: r, previousValue: n }) => {
      Si(r, n) || e();
    }), this.addManagedPropertyListeners(["groupSuppressBlankHeader", "showOpenedGroup"], t), this.addManagedEventListeners({
      modelUpdated: t,
      displayedColumnsChanged: t,
      pinnedRowDataChanged: t,
      cellValueChanged: s,
      rowNodeDataChanged: s
    });
    const i = this.beans.rowSpanSvc;
    i && this.addManagedListeners(i, { spannedCellsUpdated: s }), e();
  }
  next() {
    this.findAcrossContainers(!1, ["top", null, "bottom"], 1, 1);
  }
  previous() {
    this.findAcrossContainers(!0, ["bottom", null, "top"], this.totalMatches, -1);
  }
  goTo(e, t) {
    var a;
    if (!t && e === ((a = this.activeMatch) == null ? void 0 : a.numOverall))
      return;
    const { topMatches: s, topNumMatches: i, centerMatches: r, centerNumMatches: n, bottomMatches: o } = this;
    if (e <= i) {
      this.goToInContainer(s, e, 0);
      return;
    }
    if (e <= n) {
      this.goToInContainer(r, e, i);
      return;
    }
    this.goToInContainer(o, e, i + n);
  }
  clearActive() {
    this.activeMatch && this.setActive(void 0);
  }
  // called by cell ctrl, so needs to be performant
  isMatch(e, t) {
    var s;
    return this.active && !!((s = this.getMatches(e.rowPinned).get(e)) != null && s.some(([i]) => i === t));
  }
  getNumMatches(e, t) {
    var s, i;
    return ((i = (s = this.getMatches(e.rowPinned).get(e)) == null ? void 0 : s.find(([r]) => r === t)) == null ? void 0 : i[1]) ?? 0;
  }
  /**
   * Get detail for cell renderer. Splits up the cell value into strings depending on
   * whether they don't match, match, or are the active match
   */
  getParts(e) {
    const { value: t, node: s, column: i, precedingNumMatches: r } = e, n = this.findSearchValue, o = Nt(t) ?? "";
    if (ee(n))
      return [{ value: o }];
    const a = this.caseFormat(o) ?? "", l = this.getActiveMatchNum(s, i) - (r ?? 0);
    let c = 0, d = 0;
    const h = n.length, u = [];
    for (; ; ) {
      const g = a.indexOf(n, c);
      if (g != -1) {
        d++, g > c && u.push({ value: o.slice(c, g) });
        const p = g + h;
        u.push({
          value: o.slice(g, p),
          match: !0,
          activeMatch: d === l
        }), c = p;
      } else
        return c < o.length && u.push({
          value: o.slice(c)
        }), u;
    }
  }
  // when a detail grid is created, we need to sync the matches
  registerDetailGrid(e, t) {
    const s = this.gos;
    if (!te(s))
      return;
    const i = () => {
      var n;
      return (n = s.get("findOptions")) == null ? void 0 : n.searchDetail;
    }, r = (n) => {
      var l;
      const o = (l = this.centerMatches.get(e)) == null ? void 0 : l[0], a = (o == null ? void 0 : o[1]) ?? 0;
      n !== a && this.refreshDebounced();
    };
    t.addEventListener("findChanged", (n) => {
      t.isDestroyed() || !this.isAlive() || !this.active || !i() || r(n.totalMatches);
    }), t.addEventListener("gridPreDestroyed", () => {
      var l, c;
      if (!this.isAlive() || !this.active || !i())
        return;
      const n = e.parent, o = this.findSearchValue;
      if (!n || !o)
        return;
      const a = ((c = (l = s.get("detailCellRendererParams")) == null ? void 0 : l.getFindMatches) == null ? void 0 : c.call(l, {
        node: n,
        data: n.data,
        findSearchValue: s.get("findSearchValue"),
        updateMatches: this.refreshDebounced,
        getMatchesForValue: (d) => Gr(o, this.caseFormat, d)
      })) ?? 0;
      r(a);
    }), i() && t.setGridOption("findSearchValue", s.get("findSearchValue"));
  }
  // updates all the matches
  refresh(e) {
    var Te, Me;
    const t = /* @__PURE__ */ new Set([...this.topNodes, ...this.centerNodes, ...this.bottomNodes]);
    this.topNodes = [], this.centerNodes = [], this.bottomNodes = [];
    const {
      topNodes: s,
      topMatches: i,
      centerMatches: r,
      centerNodes: n,
      bottomNodes: o,
      bottomMatches: a,
      beans: {
        gos: l,
        visibleCols: c,
        rowModel: d,
        valueSvc: h,
        pinnedRowModel: u,
        pagination: g,
        rowSpanSvc: p,
        masterDetailSvc: f,
        colModel: m
      },
      findSearchValue: C
    } = this, v = l.get("findOptions"), w = v != null && v.caseSensitive ? (Z) => Z ?? void 0 : og;
    this.caseFormat = w;
    const b = l.get("findSearchValue"), y = w(b == null ? void 0 : b.trim());
    this.findSearchValue = y, i.clear(), r.clear(), a.clear();
    const P = e ? this.activeMatch : void 0;
    this.activeMatch = void 0;
    const E = l.get("masterDetail") && (v == null ? void 0 : v.searchDetail) && f;
    if (ee(y)) {
      if (this.active = !1, this.topNumMatches = 0, this.centerNumMatches = 0, this.totalMatches = 0, this.refreshRows(t), E) {
        const Z = f.store;
        for (const Lt of Object.keys(Z))
          (Me = (Te = Z[Lt]) == null ? void 0 : Te.api) == null || Me.findClearActive();
      }
      ee(C) || this.dispatchFindChanged();
      return;
    }
    const M = c.allCols, T = l.getCallback("isFullWidthRow"), G = l.get("detailCellRendererParams"), I = l.get("fullWidthCellRendererParams"), L = l.get("groupRowRendererParams"), $ = QC(l), z = m.isPivotMode();
    let W = 0, H, J, le = !1;
    const fe = (Z, Lt, Qe, Wi) => {
      if (!Qe)
        return;
      let oi = H.get(Z);
      oi || (oi = [], H.set(Z, oi), J.push(Z), Wi || t.add(Z)), oi.push([Lt, Qe]), W += Qe;
    }, ve = (Z) => {
      var oi, ah, lh, ch, dh;
      if (le) {
        let ce = Z.rowIndex, De = Z.parent;
        for (; ce == null && De; )
          ce = De.rowIndex, De = De.parent;
        if (ce == null || !g.isRowInPage(ce))
          return;
      }
      const Lt = Z.hasChildren();
      if (!tv(
        $,
        Z,
        Lt,
        z,
        JC($, Z, Lt),
        ev($, Z, Lt)
      ))
        return;
      const Qe = Z.data;
      if (T != null && T({ rowNode: Z })) {
        if (I) {
          const ce = ((oi = I.getFindMatches) == null ? void 0 : oi.call(I, {
            node: Z,
            data: Qe,
            findSearchValue: b,
            updateMatches: this.refreshDebounced,
            getMatchesForValue: (De) => Gr(y, w, De)
          })) ?? 0;
          fe(Z, null, ce);
        }
        return;
      }
      if ($c(l, Z, z)) {
        let ce;
        const De = L == null ? void 0 : L.getFindText;
        if (De) {
          const _i = h.getValueForDisplay(void 0, Z).value;
          ce = De(
            V(l, {
              value: _i,
              node: Z,
              data: Qe,
              column: null,
              colDef: null,
              getValueFormatted: () => {
                const { valueFormatted: Ui } = h.getValueForDisplay(void 0, Z, !0);
                return Ui;
              }
            })
          );
        } else {
          const { value: _i, valueFormatted: Ui } = h.getValueForDisplay(void 0, Z, !0);
          ce = Ui ?? _i;
        }
        const us = Gr(y, w, ce);
        fe(Z, null, us);
        return;
      }
      const Wi = Z.level > 0 && l.get("groupHideOpenParents") && ((ah = Z.parent) == null ? void 0 : ah.getFirstChild()) === Z && !((lh = Z.parent) != null && lh.expanded);
      for (const ce of M) {
        if (Xc(ce))
          continue;
        const De = p == null ? void 0 : p.getCellSpan(ce, Z);
        if (De && De.firstNode !== Z || ce.colDef.showRowGroup && Wi)
          continue;
        let us;
        const _i = ce.colDef, Ui = _i.getFindText;
        if (Ui) {
          const Ba = h.getValueForDisplay(ce, Z).value;
          us = Ui(
            V(l, {
              value: Ba,
              node: Z,
              data: Qe,
              column: ce,
              colDef: _i,
              getValueFormatted: () => {
                const { valueFormatted: Na } = h.getValueForDisplay(ce, Z, !0);
                return Na;
              }
            })
          );
        } else {
          const { value: Ba, valueFormatted: Na } = h.getValueForDisplay(ce, Z, !0);
          us = Na ?? Ba;
        }
        const tw = Gr(y, w, us);
        fe(Z, ce, tw);
      }
      if (Z.master && E) {
        const ce = Z.detailNode;
        if (ce) {
          const De = (ch = ce.detailGridInfo) == null ? void 0 : ch.api;
          if (De) {
            De.setGridOption("findSearchValue", b);
            const us = De.findGetTotalMatches();
            fe(ce, null, us);
            return;
          }
        }
        if (G) {
          const De = ((dh = G.getFindMatches) == null ? void 0 : dh.call(G, {
            node: Z,
            data: Qe,
            findSearchValue: b,
            updateMatches: this.refreshDebounced,
            getMatchesForValue: (us) => Gr(y, w, us)
          })) ?? 0;
          fe(
            ce ?? { parent: Z, dummy: !0 },
            null,
            De,
            !ce
            // if dummy detail node, don't refresh
          );
        }
      }
    };
    H = i, J = s, u == null || u.forEachPinnedRow("top", ve), this.topNumMatches = W;
    let Ge = W;
    H = r, J = n, W = 0, le = !!g && !!(v != null && v.currentPageOnly), d.forEachNodeAfterFilterAndSort(ve, !0), this.centerNumMatches = W, Ge += W, H = a, J = o, W = 0, le = !1, u == null || u.forEachPinnedRow("bottom", ve), Ge += W, this.totalMatches = Ge, this.active = !0, this.refreshRows(t), P && this.resetActiveMatch(P), this.dispatchFindChanged();
  }
  // update the active match back to what it was previously if possible. e.g. row index might have changed
  resetActiveMatch(e) {
    var c, d, h;
    const { column: t, numInMatch: s } = e;
    let i = e.node;
    if (i.dummy) {
      const u = (c = i.parent) == null ? void 0 : c.detailNode;
      if (!u)
        return;
      i = u;
    }
    const r = i.rowPinned ?? null;
    if (!((h = (d = this.getMatches(r)) == null ? void 0 : d.get(i)) == null ? void 0 : h.some(([u, g]) => u === t && g >= s)))
      return;
    let o = 0;
    r == null ? o = this.topNumMatches : r === "bottom" && (o = this.topNumMatches + this.centerNumMatches), (() => {
      const u = this.getMatches(r);
      for (const g of u.keys()) {
        const p = g === i, f = u.get(g);
        for (const [m, C] of f) {
          if (p && m === t) {
            o += s;
            return;
          }
          o += C;
        }
      }
    })();
    const l = {
      ...e,
      node: i,
      numOverall: o
    };
    this.activeMatch = l, this.refreshRows(/* @__PURE__ */ new Set([i]), t == null ? void 0 : /* @__PURE__ */ new Set([t])), this.scrollOnRefresh && (this.scrollOnRefresh = !1, this.scrollToActive(l)), this.setDetailActive(l);
  }
  refreshRows(e, t) {
    e.size && this.beans.rowRenderer.refreshCells({
      rowNodes: [...e],
      columns: t ? [...t] : void 0,
      force: !0,
      suppressFlash: !0
    });
  }
  // go to the next/previous match across all containers
  findAcrossContainers(e, t, s, i) {
    if (!this.totalMatches) {
      this.setActive();
      return;
    }
    const r = this.activeMatch;
    let n = t;
    if (r) {
      const { column: o, node: a, numInMatch: l, numOverall: c } = r, d = a.rowPinned ?? null, h = c + i;
      if (this.findInContainer(
        d,
        e,
        h,
        a,
        o,
        l
      ))
        return;
      const g = t.indexOf(d), p = t.length;
      if (t.slice(g + 1, p).some(
        (m) => this.findInContainer(m, e, h)
      ))
        return;
      n = t.slice(0, g + 1);
    }
    n.some((o) => this.findInContainer(o, e, s));
  }
  // go to the next/previous match within a container
  findInContainer(e, t, s, i, r, n) {
    const o = this.getMatches(e), a = this.getRowNodes(e), l = t ? -1 : 1;
    if (i != null) {
      const u = o.get(i), g = u == null ? void 0 : u.findIndex(([f]) => f === r);
      if (g != null && g != -1) {
        const [f, m] = u[g];
        if (t ? n > 1 : n < m)
          return this.setActive({
            column: f,
            node: i,
            numInMatch: n + l,
            numOverall: s
          }), !0;
      }
      const p = g != null && g != -1 ? u == null ? void 0 : u[g + l] : void 0;
      if (p) {
        const [f, m] = p;
        return this.setActive({
          column: f,
          node: i,
          numInMatch: t ? m : 1,
          numOverall: s
        }), !0;
      }
    }
    let c;
    if (i == null)
      c = a[t ? a.length - 1 : 0];
    else {
      const u = a.findIndex((g) => g === i);
      c = a[u + l];
    }
    if (c == null)
      return !1;
    const d = o.get(c), h = d == null ? void 0 : d[t ? d.length - 1 : 0];
    if (h) {
      const [u, g] = h;
      return this.setActive({
        column: u,
        node: c,
        numInMatch: t ? g : 1,
        numOverall: s
      }), !0;
    }
    return !1;
  }
  dispatchFindChanged() {
    const { eventSvc: e, activeMatch: t, totalMatches: s, findSearchValue: i } = this;
    e.dispatchEvent({
      type: "findChanged",
      activeMatch: t,
      totalMatches: s,
      findSearchValue: i
    });
  }
  setActive(e) {
    var s;
    if (e && e.node.rowIndex == null) {
      const i = e.node;
      let r = i.footer ? i.sibling : i.parent;
      for (; r && r.level !== -1; )
        r.expanded = !0, r = r.parent;
      this.activeMatch = e, this.scrollOnRefresh = !0, (s = this.beans.expansionSvc) == null || s.onGroupExpandedOrCollapsed();
      return;
    }
    const t = this.activeMatch;
    this.activeMatch = e, this.refreshAndScrollToActive(e, t), e && this.setDetailActive(e), this.dispatchFindChanged();
  }
  setDetailActive({ node: e, numInMatch: t }) {
    var s, i;
    e.detail && ((i = (s = e.detailGridInfo) == null ? void 0 : s.api) == null || i.findGoTo(t));
  }
  refreshAndScrollToActive(e, t) {
    if (e || t) {
      const s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
      let r = !1;
      const n = (o) => {
        if (!o)
          return;
        const { node: a, column: l } = o;
        s.add(a), l == null ? r = !0 : i.add(l);
      };
      n(e), n(t), this.refreshRows(s, r ? void 0 : i);
    }
    e && this.scrollToActive(e);
  }
  scrollToActive({ node: { rowPinned: e, rowIndex: t }, column: s }) {
    var a;
    const { ctrlsSvc: i, pagination: r, gos: n } = this.beans, o = i.getScrollFeature();
    e == null && t != null && (r && !((a = n.get("findOptions")) != null && a.currentPageOnly) && !r.isRowInPage(t) && r.goToPageWithIndex(t), o.ensureIndexVisible(t)), o.ensureColumnVisible(s);
  }
  // search for the specified overall `match` number with the provided container, and set it to be active
  goToInContainer(e, t, s) {
    let i = s;
    for (const r of e.keys()) {
      const n = e.get(r);
      for (const [o, a] of n) {
        if (t <= i + a) {
          this.setActive({
            column: o,
            node: r,
            numInMatch: t - i,
            numOverall: t
          });
          return;
        }
        i += a;
      }
    }
  }
  getMatches(e) {
    return e === "top" ? this.topMatches : e === "bottom" ? this.bottomMatches : this.centerMatches;
  }
  getRowNodes(e) {
    return e === "top" ? this.topNodes : e === "bottom" ? this.bottomNodes : this.centerNodes;
  }
  getActiveMatchNum(e, t) {
    const s = this.activeMatch;
    return s != null && s.node === e && s.column === t ? s.numInMatch : 0;
  }
  destroy() {
    this.topMatches.clear(), this.topNodes.length = 0, this.centerMatches.clear(), this.centerNodes.length = 0, this.bottomMatches.clear(), this.bottomNodes.length = 0, this.activeMatch = void 0, super.destroy();
  }
}, UW = {
  moduleName: "FindCore",
  version: Y,
  rowModels: ["clientSide"],
  beans: [_W],
  userComponents: {
    agFindCellRenderer: WW
  },
  css: [AW]
}, $W = {
  moduleName: "Find",
  version: Y,
  apiFunctions: {
    findGetTotalMatches: kW,
    findGoTo: GW,
    findNext: IW,
    findPrevious: LW,
    findGetActiveMatch: VW,
    findGetNumMatches: BW,
    findGetParts: NW,
    findClearActive: OW,
    findRefresh: HW
  },
  dependsOn: [UW]
};
function KW({ editSvc: e, gos: t, rowModel: s }) {
  if (!(e != null && e.isBatchEditing())) {
    if (!te(t)) {
      F(289, { rowModelType: t.get("rowModelType") });
      return;
    }
    e == null || e.setBatchEditing(!0);
  }
}
function jW({ editSvc: e }) {
  e != null && e.isBatchEditing() && (e == null || e.stopEditing(void 0, { cancel: !0, source: "api", forceCancel: !0 }), e == null || e.setBatchEditing(!1));
}
function YW({ editSvc: e }) {
  e != null && e.isBatchEditing() && (e == null || e.stopEditing(void 0, { source: "api", forceStop: !0 }), e == null || e.setBatchEditing(!1));
}
function qW(e) {
  var t;
  return ((t = e.editSvc) == null ? void 0 : t.isBatchEditing()) ?? !1;
}
var XW = {
  moduleName: "BatchEdit",
  version: Y,
  beans: [],
  apiFunctions: {
    isBatchEditing: qW,
    startBatchEdit: KW,
    cancelBatchEdit: jW,
    commitBatchEdit: YW
  },
  dependsOn: [ds, ie],
  css: []
}, ZW = class extends R {
  constructor(e) {
    super(), this.beanName = "agChartsExports", this.isEnterprise = !1, this.create = e.create, this._Theme = e._Theme, this._Scene = e._Scene, this.isEnterprise = e.isEnterprise, this._Util = e._Util;
  }
};
function ag(e) {
  return e.chart != null ? e.chart : e;
}
var QW = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
function hi(e, t, s) {
  if (e == null)
    return s;
  const i = t.split(".");
  let r = e;
  for (; i.length > 1; )
    if (r = r[i.shift()], r == null)
      return s;
  const n = r[i[0]];
  return n ?? s;
}
function JW(e, t, s) {
  if (e == null)
    return;
  const i = t.split(".");
  let r = e;
  i.filter((n) => !QW.has(n)).forEach((n, o) => {
    r[n] || (r[n] = {}), o < i.length - 1 && (r = r[n]);
  }), r[i[i.length - 1]] = s;
}
var e_ = {
  column: "bar",
  groupedColumn: "bar",
  stackedColumn: "bar",
  normalizedColumn: "bar",
  bar: "bar",
  groupedBar: "bar",
  stackedBar: "bar",
  normalizedBar: "bar",
  line: "line",
  stackedLine: "line",
  normalizedLine: "line",
  scatter: "scatter",
  bubble: "bubble",
  pie: "pie",
  donut: "donut",
  doughnut: "donut",
  area: "area",
  stackedArea: "area",
  normalizedArea: "area",
  histogram: "histogram",
  radarLine: "radar-line",
  radarArea: "radar-area",
  nightingale: "nightingale",
  radialColumn: "radial-column",
  radialBar: "radial-bar",
  sunburst: "sunburst",
  rangeBar: "range-bar",
  rangeArea: "range-area",
  boxPlot: "box-plot",
  treemap: "treemap",
  heatmap: "heatmap",
  waterfall: "waterfall",
  funnel: "funnel",
  coneFunnel: "cone-funnel",
  pyramid: "pyramid"
}, t_ = /* @__PURE__ */ new Set(["columnLineCombo", "areaColumnCombo", "customCombo"]), s_ = ["grouped", "stacked", "normalized"], fv = {
  area: {
    isCartesian: !0,
    canInvert: !0
  },
  bar: {
    isCartesian: !0,
    canInvert: !0
  },
  histogram: {
    isCartesian: !0
  },
  line: {
    isCartesian: !0,
    canInvert: !0
  },
  pie: {
    isPie: !0
  },
  donut: {
    isPie: !0,
    canInvert: !0
  },
  scatter: {
    isCartesian: !0
  },
  bubble: {
    isCartesian: !0
  },
  "radial-column": {
    isPolar: !0,
    isEnterprise: !0,
    isRadial: !0,
    canInvert: !0
  },
  "radial-bar": {
    isPolar: !0,
    isEnterprise: !0,
    isRadial: !0,
    canInvert: !0
  },
  "radar-line": {
    isPolar: !0,
    isEnterprise: !0,
    canInvert: !0
  },
  "radar-area": {
    isPolar: !0,
    isEnterprise: !0,
    canInvert: !0
  },
  nightingale: {
    isPolar: !0,
    isEnterprise: !0,
    canInvert: !0
  },
  "range-bar": {
    isCartesian: !0,
    isEnterprise: !0,
    canSwitchDirection: !0
  },
  "range-area": {
    isCartesian: !0,
    isEnterprise: !0
  },
  "box-plot": {
    isCartesian: !0,
    isEnterprise: !0,
    canSwitchDirection: !0
  },
  treemap: {
    isEnterprise: !0,
    isHierarchical: !0
  },
  sunburst: {
    isEnterprise: !0,
    isHierarchical: !0
  },
  heatmap: {
    isCartesian: !0,
    isEnterprise: !0
  },
  waterfall: {
    isCartesian: !0,
    isEnterprise: !0,
    canSwitchDirection: !0
  },
  funnel: {
    isCartesian: !0,
    isEnterprise: !0,
    canSwitchDirection: !0
  },
  "cone-funnel": {
    isCartesian: !0,
    isEnterprise: !0,
    canSwitchDirection: !0
  },
  pyramid: {
    isCartesian: !0,
    isEnterprise: !0,
    canSwitchDirection: !0
  }
};
function i_(e) {
  return !!fv[e];
}
function Xd(e) {
  return t_.has(e);
}
function ri(e, t) {
  var s;
  return !!((s = fv[e]) != null && s[t]);
}
function r_(e) {
  return ri(de(e), "isEnterprise");
}
var n_ = /* @__PURE__ */ new Set(["stackedColumn", "normalizedColumn", "stackedBar", "normalizedBar"]);
function o_(e) {
  return n_.has(e);
}
function Ys(e) {
  return ri(e, "isCartesian");
}
function Ec(e) {
  return e === "funnel" || e === "cone-funnel" || e === "pyramid";
}
function Tc(e) {
  return ri(e, "isPolar");
}
function a_(e) {
  return ri(e, "isRadial");
}
function fi(e) {
  return ri(e, "isHierarchical");
}
function pn(e) {
  return e === "doughnut" ? "donut" : e;
}
function mv(e) {
  return e_[e];
}
function de(e) {
  return mv(e) ?? "line";
}
function Cv(e) {
  return ri(e, "isPie");
}
function l_(e) {
  return e === "pie" || e === "waterfall" || e === "histogram" || e === "funnel" || e === "coneFunnel" || e === "pyramid";
}
function Mc(e) {
  return fi(de(e)) ? void 0 : 1;
}
function qo(e) {
  return fi(de(e)) ? 2 : l_(e) ? 1 : void 0;
}
function vv(e) {
  return !Xd(e) && ri(de(e), "canInvert");
}
function c_(e) {
  return ri(de(e), "canSwitchDirection");
}
function Zd(e) {
  switch (e) {
    case "groupedColumn":
    case "stackedColumn":
    case "normalizedColumn":
    case "groupedBar":
    case "stackedBar":
    case "normalizedBar":
    case "stackedLine":
    case "normalizedLine":
    case "stackedArea":
    case "normalizedArea":
      return `${e}Full`;
    case "doughnut":
      return "donut";
    case "areaColumnCombo":
      return "AreaColumnCombo";
    default:
      return e;
  }
}
var wv = ["number", "category", "grouped-category", "log", "time"];
function d_(e) {
  switch (e) {
    case "bar":
    case "stackedBar":
    case "normalizedBar":
      return ["number", "category"];
    case "groupedBar":
      return ["number", "grouped-category"];
    case "column":
    case "stackedColumn":
    case "normalizedColumn":
    case "line":
    case "stackedLine":
    case "normalizedLine":
    case "area":
    case "stackedArea":
    case "normalizedArea":
    case "histogram":
      return ["category", "number"];
    case "groupedColumn":
      return ["grouped-category", "number"];
    case "scatter":
    case "bubble":
      return ["number", "number"];
    default:
      return;
  }
}
function h_(e, t, s, i, r) {
  const { chartOptionsToRestore: n, chartPaletteToRestore: o, chartThemeToRestore: a, agChartsExports: l } = e, c = C_(e), d = Qd(c, l._Theme), h = d ? { baseTheme: c } : bv(e, c) ?? {}, u = e.getGridOptionsChartThemeOverrides(), g = e.apiChartThemeOverrides, p = de(e.chartType), f = e.crossFiltering ? g_(t, e, p) : void 0, v = [
    d ? f_(e, s, (() => {
      const w = (b) => b ? Object.keys(b).some((y) => hi(b[y], "title.enabled", !1)) : !1;
      return w(u) || w(g);
    })()) : void 0,
    m_(),
    i,
    f,
    u,
    g,
    { ...n ?? {} },
    r
  ].filter((w) => !!w).reduce(
    (w, b) => ({
      baseTheme: w,
      overrides: b
    }),
    h
  );
  if (o && c === a) {
    const w = e.agChartsExports._Theme.getChartTheme(h).palette;
    u_(o, w) || (v.palette = o);
  }
  return v;
}
function u_(e, t) {
  const s = (i, r) => i === r ? !0 : (i == null ? void 0 : i.length) !== (r == null ? void 0 : r.length) ? !1 : (i == null ? void 0 : i.every((n, o) => n === (r == null ? void 0 : r[o]))) ?? !1;
  return s(e.fills, t.fills) && s(e.strokes, t.strokes);
}
function Qd(e, t) {
  return Object.keys(t.themes).includes(e);
}
function g_(e, t, s) {
  const r = {
    tooltip: {
      delay: 500
    },
    legend: {
      listeners: {
        legendItemClick: (o) => {
          const a = e.getChart(), l = [o.seriesId, `${o.seriesId}-filtered-out`];
          a.series.filter((c) => l.includes(c.id)).forEach((c) => c.toggleSeriesItem(void 0, "category", o.itemId, void 0));
        }
      }
    },
    listeners: {
      click: (o) => t.crossFilterCallback(o, !0)
    }
  };
  if (s === "pie" || s === "donut")
    return {
      [s]: {
        series: {
          fills: {
            $if: [
              { $eq: [{ $value: "$index" }, 0] },
              {
                $map: [
                  { $mix: [{ $value: "$1" }, { $ref: "backgroundColor" }, 0.7] },
                  { $palette: "fills" }
                ]
              },
              { $palette: "fills" }
            ]
          },
          strokes: {
            $if: [
              { $eq: [{ $value: "$index" }, 0] },
              {
                $map: [
                  { $mix: [{ $value: "$1" }, { $ref: "backgroundColor" }, 0.7] },
                  { $palette: "strokes" }
                ]
              },
              { $palette: "strokes" }
            ]
          }
        },
        ...r
      }
    };
  const n = {};
  return s !== "line" && (n.fill = {
    $if: [
      { $isEven: [{ $value: "$index" }] },
      { $palette: "fill" },
      {
        $mix: [
          {
            $path: ["../$prevIndex/fill", { $palette: "fill" }]
          },
          { $ref: "backgroundColor" },
          0.7
        ]
      }
    ]
  }), {
    [s]: {
      series: {
        stroke: {
          $if: [
            { $isEven: [{ $value: "$index" }] },
            { $palette: "stroke" },
            {
              $mix: [
                {
                  $path: ["../$prevIndex/fill", { $palette: "stroke" }]
                },
                { $ref: "backgroundColor" },
                0.7
              ]
            }
          ]
        },
        ...n
      },
      ...r
    }
  };
}
var p_ = wv.reduce(
  (e, t) => ({ ...e, [t]: { title: { _enabledFromTheme: !0 } } }),
  {}
);
function f_(e, t, s) {
  const i = e.getExtraPaddingDirections();
  return {
    common: {
      ...t ? { animation: { duration: 500 } } : void 0,
      axes: p_,
      padding: {
        // don't add extra padding when a title is present!
        top: !s && i.includes("top") ? 40 : 20,
        right: i.includes("right") ? 30 : 20,
        bottom: i.includes("bottom") ? 40 : 20,
        left: i.includes("left") ? 30 : 20
      }
    }
  };
}
function m_() {
  return {
    pie: {
      series: {
        title: { _enabledFromTheme: !0 },
        calloutLabel: { _enabledFromTheme: !0 },
        sectorLabel: {
          enabled: !1,
          _enabledFromTheme: !0
        }
      }
    },
    donut: {
      series: {
        title: { _enabledFromTheme: !0 },
        calloutLabel: { _enabledFromTheme: !0 },
        sectorLabel: {
          enabled: !1,
          _enabledFromTheme: !0
        }
      }
    }
  };
}
function C_(e) {
  let t = e.getChartThemeName();
  const s = e.getChartThemes();
  return s.includes(t) || (t = s[0]), t;
}
function bv(e, t) {
  const { customChartThemes: s } = e, i = s && s[t];
  return i || F(140, { name: t }), i;
}
var Sr = class {
  constructor(e) {
    this.chartProxyParams = e, this.clearThemeOverrides = !1, this.agChartsExports = e.agChartsExports, this.chart = e.chartInstance, this.chartType = e.chartType, this.crossFiltering = e.crossFiltering, this.crossFilterCallback = e.crossFilterCallback, this.standaloneChartType = de(this.chartType), this.chart == null ? this.chart = e.agChartsExports.create(this.getCommonChartOptions()) : this.clearThemeOverrides = !0;
  }
  crossFilteringReset() {
  }
  update(e) {
    this.getChartRef().update(this.getUpdateOptions(e, this.getCommonChartOptions(e.updatedOverrides)));
  }
  updateThemeOverrides(e) {
    this.getChartRef().updateDelta({ theme: { overrides: e } });
  }
  getChart() {
    return ag(this.chart);
  }
  getChartRef() {
    return this.chart;
  }
  downloadChart(e, t, s) {
    const { chart: i } = this, r = ag(i), n = t || r.title.node.getPlainText(), { width: o, height: a } = e || {};
    i.download({ width: o, height: a, fileName: n, fileFormat: s });
  }
  getChartImageDataURL(e) {
    return this.getChart().getCanvasDataURL(e);
  }
  getChartOptions() {
    return this.chart.getOptions();
  }
  getChartThemeOverrides() {
    return this.getChartOptions().theme.overrides ?? {};
  }
  getChartPalette() {
    return this.agChartsExports._Theme.getChartTheme(this.getChartOptions().theme).palette;
  }
  setPaired(e) {
    const t = de(this.chartProxyParams.chartType);
    this.chart.updateDelta({ theme: { overrides: { [t]: { paired: e } } } });
  }
  isPaired() {
    const e = de(this.chartProxyParams.chartType);
    return hi(this.getChartThemeOverrides(), `${e}.paired`, !0);
  }
  lookupCustomChartTheme(e) {
    return bv(this.chartProxyParams, e);
  }
  getSeriesGroupType() {
  }
  transformCategoryData(e, t) {
    return e.map((s, i) => {
      const r = s[t], n = r && r.toString ? r.toString() : "", o = { ...s };
      return o[t] = { id: i, value: r, toString: () => n }, o;
    });
  }
  getCommonChartOptions(e) {
    var o;
    const t = this.clearThemeOverrides ? {} : ((o = this.chart) == null ? void 0 : o.getOptions()) ?? {}, s = this.chart != null ? this.getActiveFormattingPanelOverrides() : void 0;
    this.clearThemeOverrides = !1;
    const i = this.chartProxyParams.styleNonce, r = h_(
      this.chartProxyParams,
      this,
      this.agChartsExports.isEnterprise,
      this.getChartThemeDefaults(),
      e ?? s
    ), n = {
      ...t,
      mode: "integrated",
      ...i ? { styleNonce: i } : {}
    };
    return this.chartProxyParams.suppressFieldDotNotation !== void 0 && (n.suppressFieldDotNotation = this.chartProxyParams.suppressFieldDotNotation), n.theme = r, n.container = this.chartProxyParams.parentElement, n;
  }
  getChartThemeDefaults() {
    const e = this.getSeriesChartThemeDefaults(), t = e ? {
      [this.standaloneChartType]: e
    } : {}, s = {
      enabled: !0,
      snap: !0,
      label: {
        enabled: !1
      }
    }, i = this.agChartsExports.isEnterprise ? {
      zoom: {
        enabled: !0
      },
      animation: {
        enabled: !0,
        duration: 500
      },
      axes: {
        number: { crosshair: s },
        category: { crosshair: s },
        log: { crosshair: s },
        time: { crosshair: s }
      }
    } : {};
    return i.minHeight = 0, i.minWidth = 0, i.navigator = {
      enabled: !1,
      height: 18
    }, i.context = this.chartProxyParams.context, {
      common: i,
      ...t
    };
  }
  getSeriesChartThemeDefaults() {
  }
  getActiveFormattingPanelOverrides() {
    var t;
    if (this.clearThemeOverrides)
      return {};
    const e = (t = this.chart) == null ? void 0 : t.getOptions().theme;
    return (e == null ? void 0 : e.overrides) ?? {};
  }
  destroy({ keepChartInstance: e = !1 } = {}) {
    if (e)
      return this.chart.resetAnimations(), this.chart;
    this.destroyChart();
  }
  destroyChart() {
    this.chart && (this.chart.destroy(), this.chart = void 0);
  }
}, ni = class extends Sr {
  constructor() {
    super(...arguments), this.crossFilteringAllPoints = /* @__PURE__ */ new Set(), this.crossFilteringSelectedPoints = [];
  }
  getUpdateOptions(e, t) {
    const s = this.getAxes(e, t);
    return {
      ...t,
      data: this.getData(e, s),
      axes: s,
      series: this.getSeries(e)
    };
  }
  getData(e, t) {
    const s = ["area", "line"].includes(this.standaloneChartType);
    return this.crossFiltering && s ? this.getCrossFilterData(e) : this.getDataTransformedData(e, t);
  }
  getDataTransformedData(e, t) {
    const s = t[0].type, { categories: i, data: r } = e, [n] = i;
    switch (s) {
      case "category":
        return this.transformCategoryData(r, n.id);
      case "time":
        return this.transformTimeData(r, n.id, n.convertTime);
      default:
        return r;
    }
  }
  getXAxisType(e) {
    return e.grouping ? "grouped-category" : this.isXAxisOfType(e, "time", (t) => t instanceof Date) ? "time" : this.isXAxisOfType(e, "number") ? "number" : "category";
  }
  isXAxisOfType(e, t, s) {
    const [i] = e.categories;
    if (i != null && i.chartDataType)
      return i.chartDataType === t;
    if (!s)
      return !1;
    const r = e.data[0];
    return r ? s(r[i.id]) : !1;
  }
  transformTimeData(e, t, s) {
    var r;
    return ((r = e[0]) == null ? void 0 : r[t]) instanceof Date ? e : e.map((n) => {
      const o = n[t];
      return typeof o == "string" ? {
        ...n,
        [t]: s ? s(o) : ke(o)
      } : n;
    });
  }
  crossFilteringReset() {
    this.crossFilteringSelectedPoints = [], this.crossFilteringAllPoints.clear();
  }
  crossFilteringPointSelected(e) {
    return this.crossFilteringSelectedPoints.length == 0 || this.crossFilteringSelectedPoints.includes(e);
  }
  crossFilteringDeselectedPoints() {
    return this.crossFilteringSelectedPoints.length > 0 && this.crossFilteringAllPoints.size !== this.crossFilteringSelectedPoints.length;
  }
  extractLineAreaCrossFilterSeries(e, t) {
    const [s] = t.categories, i = (r) => this.standaloneChartType === "area" ? t.getCrossFilteringContext().lastSelectedChartId === t.chartId ? r + "-total" : r : r + "-total";
    return e.map((r) => (r.yKey = i(r.yKey), r.listeners = {
      seriesNodeClick: (n) => {
        const o = n.datum[r.xKey], a = n.event.metaKey || n.event.ctrlKey;
        this.crossFilteringAddSelectedPoint(a, o), this.crossFilterCallback(n);
      }
    }, r.marker = {
      itemStyler: (n) => {
        const o = n.datum[s.id];
        return {
          fill: n.highlighted ? "yellow" : n.fill,
          size: n.highlighted ? 14 : this.crossFilteringPointSelected(o) ? 8 : 0
        };
      }
    }, this.standaloneChartType === "area" && (r.fillOpacity = this.crossFilteringDeselectedPoints() ? 0.3 : 1), this.standaloneChartType === "line" && (r.strokeOpacity = this.crossFilteringDeselectedPoints() ? 0.3 : 1), r));
  }
  getCrossFilterData(e) {
    this.crossFilteringAllPoints.clear();
    const [t] = e.categories, s = e.fields[0].colId, i = `${s}-filtered-out`, r = e.getCrossFilteringContext().lastSelectedChartId;
    return e.data.map((n) => {
      const o = n[t.id];
      this.crossFilteringAllPoints.add(o);
      const a = this.crossFilteringPointSelected(o);
      return this.standaloneChartType === "area" && r === e.chartId && (n[`${s}-total`] = a ? n[s] : n[s] + n[i]), this.standaloneChartType === "line" && (n[`${s}-total`] = a ? n[s] : n[s] + n[i]), n;
    });
  }
  crossFilteringAddSelectedPoint(e, t) {
    e ? this.crossFilteringSelectedPoints.push(t) : this.crossFilteringSelectedPoints = [t];
  }
  isHorizontal(e) {
    const t = this.standaloneChartType;
    if (t !== "waterfall" && t !== "box-plot" && t !== "range-bar")
      return !1;
    const s = e.theme, i = (r) => {
      var o, a, l;
      const n = (l = (a = (o = r == null ? void 0 : r.overrides) == null ? void 0 : o[t]) == null ? void 0 : a.series) == null ? void 0 : l.direction;
      return n != null ? n === "horizontal" : typeof (r == null ? void 0 : r.baseTheme) == "object" ? i(r.baseTheme) : !1;
    };
    return i(s);
  }
}, v_ = class extends ni {
  getSeries(e) {
    const t = e.fields[0];
    return [
      {
        type: this.standaloneChartType,
        xKey: t.colId,
        xName: t.displayName,
        yName: this.chartProxyParams.translate("histogramFrequency"),
        areaPlot: !1
        // only constant width is supported via integrated charts
      }
    ];
  }
  getAxes(e) {
    return [
      {
        type: "number",
        position: "bottom"
      },
      {
        type: "number",
        position: "left"
      }
    ];
  }
}, w_ = class extends ni {
  getAxes(e, t) {
    return [
      {
        type: this.getXAxisType(e),
        position: this.isHorizontal(t) ? "left" : "bottom"
      },
      {
        type: "number",
        position: this.isHorizontal(t) ? "bottom" : "left"
      }
    ];
  }
  getSeries(e) {
    const [t] = e.categories, [s] = e.fields;
    return [{
      type: this.standaloneChartType,
      xKey: t.id,
      xName: t.name,
      yKey: s.colId,
      yName: s.displayName ?? void 0
    }];
  }
}, b_ = class extends Sr {
  getUpdateOptions(e, t) {
    return {
      ...t,
      data: this.transformFunnelCategories(e),
      series: this.getSeries(e)
    };
  }
  transformFunnelCategories(e) {
    const { data: t } = e, [{ id: s }] = e.categories;
    return t.map((i, r) => ({
      ...i,
      [s]: {
        name: i[s],
        id: r,
        toString: () => i[s]
      }
    }));
  }
  getSeriesChartThemeDefaults() {
    const e = {
      crosshair: {
        enabled: !1
      }
    };
    return {
      zoom: {
        enabled: !1
      },
      ...this.chartType !== "pyramid" && {
        axes: {
          category: e,
          number: e
        }
      }
    };
  }
  getSeries(e) {
    const [{ id: t }] = e.categories, [{ colId: s }] = e.fields;
    return [{
      type: this.standaloneChartType,
      stageKey: t,
      valueKey: s
    }];
  }
}, fo = "AG-GRID-DEFAULT-LABEL-KEY";
function y_(e, t) {
  const s = yv(e, i, r);
  return Jd(s);
  function i(o) {
    return t.length;
  }
  function r(o, a) {
    const l = t[a], c = o[l];
    return n(c);
  }
  function n(o) {
    return o == null ? null : String(o);
  }
}
function S_(e, t) {
  const s = yv(e, i, r);
  return Jd(s);
  function i(n) {
    var o;
    return ((o = t(n)) == null ? void 0 : o.length) ?? 0;
  }
  function r(n, o) {
    const a = t(n);
    return a && a[o];
  }
}
function Jd(e, t = null, s) {
  const { depth: i, rootValues: r, value: n, children: o } = e;
  if (r)
    return r.map((l) => ({ [fo]: t, ...l }));
  if (i === 0)
    return [{ [fo]: t, ...n }];
  const a = [];
  for (const [l, c] of o.entries())
    a.push(...Jd(c, l, !0));
  return s ? [
    {
      [fo]: t,
      children: a,
      ...n ?? {}
    }
  ] : a;
}
function yv(e, t, s) {
  const i = { depth: 0, children: /* @__PURE__ */ new Map() };
  return e.forEach((n) => {
    const o = t(n);
    r(n, o, s, 0, i);
  }), i;
  function r(n, o, a, l, c) {
    if (l === o)
      return l === 0 ? (c.rootValues || (c.rootValues = []), c.rootValues.push(n)) : c.value = n, c;
    {
      const d = a(n, l), h = c.children.get(d), u = r(
        n,
        o,
        a,
        l + 1,
        h || { depth: 0, children: /* @__PURE__ */ new Map() }
      );
      return c.children.set(d, u), c.depth = Math.max(1 + u.depth, c.depth), c;
    }
  }
}
var x_ = class extends Sr {
  getUpdateOptions(e, t) {
    const { fields: s } = e, [i, r] = s;
    return {
      ...t,
      series: this.getSeries(i, r),
      data: this.getData(e, i, r)
    };
  }
  getSeriesChartThemeDefaults() {
    return {
      gradientLegend: {
        gradient: {
          preferredLength: 200
        },
        position: "right"
      }
    };
  }
  getSeries(e, t) {
    return [
      {
        type: this.standaloneChartType,
        labelKey: fo,
        // Size and color fields are inferred from the range data
        sizeKey: e == null ? void 0 : e.colId,
        sizeName: (e == null ? void 0 : e.displayName) ?? void 0,
        colorKey: t == null ? void 0 : t.colId,
        colorName: (t == null ? void 0 : t.displayName) ?? void 0
      }
    ];
  }
  getData(e, t, s) {
    const { categories: i, data: r, groupData: n, grouping: o } = e;
    if (o) {
      const a = s ? r.concat(
        (n == null ? void 0 : n.map((l) => {
          const c = { ...l };
          return delete c[t.colId], c;
        })) ?? []
      ) : r;
      return S_(
        a,
        (l) => {
          var c;
          return ((c = l[ti]) == null ? void 0 : c.value) ?? null;
        }
      );
    } else {
      const a = i.map(({ id: l }) => l);
      return y_(r, a);
    }
  }
}, F_ = class extends Sr {
  getAxes(e) {
    const t = this.standaloneChartType === "radial-bar";
    return [
      { type: t ? "angle-number" : "angle-category" },
      { type: t ? "radius-category" : "radius-number" }
    ];
  }
  getSeries(e) {
    const { fields: t, categories: s, seriesGroupType: i } = e, [r] = s, n = this.standaloneChartType === "radial-bar", o = this.getSeriesGroupTypeOptions(i);
    return t.map((a) => ({
      type: this.standaloneChartType,
      angleKey: n ? a.colId : r.id,
      angleName: n ? a.displayName ?? void 0 : r.name,
      radiusKey: n ? r.id : a.colId,
      radiusName: n ? r.name : a.displayName ?? void 0,
      ...o
    }));
  }
  getSeriesGroupType() {
    var i, r;
    const e = this.standaloneChartType;
    if (!["nightingale", "radial-bar", "radial-column"].includes(e))
      return;
    const t = (r = (i = this.getChart().series) == null ? void 0 : i[0]) == null ? void 0 : r.properties.toJson(), s = () => t.normalizedTo ? "normalized" : "stacked";
    return e === "nightingale" ? t.grouped ? "grouped" : s() : t.stacked ? s() : "grouped";
  }
  getUpdateOptions(e, t) {
    const s = this.getAxes(e);
    return {
      ...t,
      data: this.getData(e, s),
      axes: s,
      series: this.getSeries(e)
    };
  }
  getData(e, t) {
    if (t.some((i) => i.type === "angle-category" || i.type === "radius-category")) {
      const [i] = e.categories;
      return this.transformCategoryData(e.data, i.id);
    } else
      return e.data;
  }
  getSeriesGroupTypeOptions(e) {
    return e ? {
      grouped: e === "grouped" || void 0,
      stacked: e !== "grouped" || void 0,
      normalizedTo: e === "normalized" ? 100 : void 0
    } : {};
  }
}, R_ = "AG-GRID-DEFAULT-HEATMAP-CATEGORY-KEY", P_ = "AG-GRID-DEFAULT-HEATMAP-SERIES-KEY", E_ = "AG-GRID-DEFAULT-HEATMAP-VALUE-KEY";
function T_(e, t) {
  return e.reduce((s, i, r, n) => s.concat(t(i, r, n)), new Array());
}
var M_ = class extends Sr {
  getUpdateOptions(e, t) {
    const s = P_, i = E_, r = R_;
    return {
      ...t,
      series: this.getSeries(e, s, i, r),
      data: this.getData(e, s, i, r)
    };
  }
  getSeries(e, t, s, i) {
    const [r] = e.categories;
    return [
      {
        type: this.standaloneChartType,
        // The axis keys reference synthetic fields based on the category values and series column names
        yKey: i,
        xKey: t,
        // The color key references a synthetic field based on the series column value for a specific cell
        colorKey: s,
        yName: r.name,
        // We don't know how to label the 'x' series, as it is a synthetic series created from the set of all input columns
        // In future releases we may want to consider inferring the series label from column groupings etc
        xName: void 0,
        colorName: void 0
      }
    ];
  }
  getData(e, t, s, i) {
    const [r] = e.categories;
    return T_(e.data, (n, o) => {
      const a = n[r.id], l = a == null ? "" : String(a), c = { id: o, value: a, toString: () => l };
      return e.fields.map(({ colId: d, displayName: h }) => ({
        ...n,
        [t]: h,
        [s]: n[d],
        [i]: c
      }));
    });
  }
  getSeriesChartThemeDefaults() {
    return {
      gradientLegend: {
        gradient: {
          preferredLength: 200
        },
        position: "right"
      },
      series: {
        tooltip: {
          renderer: D_
        }
      }
    };
  }
};
function D_(e) {
  const { xKey: t, yKey: s, colorKey: i, yName: r, datum: n } = e;
  return {
    title: "",
    data: [
      { label: r, value: n[s] },
      { label: n[t], value: i && n[i] }
    ].map(({ label: a, value: l }) => ({ label: String(a), value: String(l) }))
  };
}
var A_ = class extends R {
  wireBeans(e) {
    this.sortSvc = e.sortSvc, this.gridRowModel = e.rowModel, this.colModel = e.colModel, this.valueSvc = e.valueSvc, this.pivotResultCols = e.pivotResultCols, this.rowNodeSorter = e.rowNodeSorter;
  }
  getData(e) {
    if (e.crossFiltering) {
      if (e.grouping)
        return F(141), { chartData: [], colNames: {} };
      if (!te(this.gos))
        return F(142), { chartData: [], colNames: {} };
    }
    Le(this.gos) && e.pivoting && this.updatePivotKeysForSSRM();
    const s = this.extractRowsFromGridRowModel(e);
    return s.chartData = this.aggregateRowsByDimension(e, s.chartData), s;
  }
  extractRowsFromGridRowModel(e) {
    const { crossFiltering: t, startRow: s, endRow: i, valueCols: r, dimensionCols: n, grouping: o, crossFilteringSort: a } = e;
    let l = [];
    const c = {}, d = {}, h = {};
    let u = {}, g = [], p;
    if (t)
      u = this.getFilteredRowNodes(), g = this.getAllRowNodes(a), p = g.length;
    else {
      const w = this.gridRowModel.getRowCount() - 1;
      s === i && s === 0 && n.length === 0 && r.length === 0 ? p = 0 : p = (i >= 0 ? Math.min(i, w) : w) - s + 1;
    }
    p > 0 && r.forEach((w) => {
      let b = [];
      const y = w.getColDef().pivotKeys;
      y && (b = y.slice());
      const P = w.getColDef().headerName;
      P && b.push(P), b.length > 0 && (c[w.getId()] = b);
    });
    let f = 0, m = 0;
    const C = {};
    for (let w = 0; w < p; w++) {
      const b = t ? g[w] : this.gridRowModel.getRow(w + s);
      if (b.footer || b.detail) {
        f++;
        continue;
      }
      const y = { node: b };
      n.forEach((P) => {
        const E = P.colId, M = this.colModel.getCol(E);
        if (M) {
          const T = this.valueSvc.getValue(M, b);
          if (o) {
            const G = T != null && T.toString ? String(T.toString()) : " ", I = this.getGroupLabels(b, G), L = I.slice().reverse(), $ = {
              value: L,
              // this is needed so that standalone can handle animations properly when data updates
              id: m++,
              toString: () => L.filter(Boolean).join(" - ")
            }, z = $.toString(), W = C[z];
            y[E] = W || (C[z] = $), b.group && (d[I.toString()] = w - f);
            const H = I.slice(1, I.length).toString();
            H && (h[H] = d[H]);
          } else
            y[E] = T;
        } else
          y[ns] = w + 1;
      }), r.forEach((P) => {
        const E = P.getColId();
        if (t) {
          const M = E + "-filtered-out", T = this.valueSvc.getValue(P, b);
          let G = T;
          T != null && (typeof T.toNumber == "function" ? G = T.toNumber() : typeof T.value == "number" && (G = T.value)), u[b.id] ? (y[E] = G, y[M] = e.aggFunc || e.isScatter ? void 0 : 0) : (y[E] = e.aggFunc || e.isScatter ? void 0 : 0, y[M] = G);
        } else {
          let M = this.valueSvc.getValue(P, b);
          M && typeof M.value == "number" && (M = M.value), M && Object.prototype.hasOwnProperty.call(M, "toString") && (M = parseFloat(M.toString())), y[E] = M != null && typeof M.toNumber == "function" ? M.toNumber() : M;
        }
      }), l.push(y);
    }
    let v;
    if (o) {
      const w = Object.values(h), b = l;
      l = [], v = [];
      for (let y = 0; y < b.length; y++)
        (w.includes(y) ? v : l).push(b[y]);
    }
    return { chartData: l, colNames: c, groupChartData: v };
  }
  aggregateRowsByDimension(e, t) {
    const s = e.dimensionCols;
    if (!e.aggFunc || s.length === 0)
      return t;
    const i = _(s), r = i && i.colId, n = {}, o = [];
    return t.forEach((a) => {
      let l = n;
      s.forEach((c) => {
        const d = c.colId, h = a[d];
        if (d === r) {
          let u = l[h];
          u || (u = { __children: [] }, s.forEach((g) => {
            const p = g.colId;
            u[p] = a[p];
          }), l[h] = u, o.push(u)), u.__children.push(a);
        } else
          l[h] || (l[h] = {}), l = l[h];
      });
    }), this.gos.assertModuleRegistered("SharedAggregation", 1) && o.forEach(
      (a) => e.valueCols.forEach((l) => {
        const c = l.getColId();
        if (e.crossFiltering) {
          const d = a.__children.filter((f) => typeof f[c] < "u").map((f) => f[c]), h = cr(this.beans, d, e.aggFunc, l);
          a[c] = h && typeof h.value < "u" ? h.value : h;
          const u = `${c}-filtered-out`, g = a.__children.filter((f) => typeof f[u] < "u").map((f) => f[u]), p = cr(
            this.beans,
            g,
            e.aggFunc,
            l
          );
          a[u] = p && typeof p.value < "u" ? p.value : p;
        } else {
          const d = a.__children.map((u) => u[c]), h = cr(this.beans, d, e.aggFunc, l);
          a[c] = h && typeof h.value < "u" ? h.value : h;
        }
      })
    ), o;
  }
  updatePivotKeysForSSRM() {
    var s, i;
    const e = (i = (s = this.pivotResultCols) == null ? void 0 : s.getPivotResultCols()) == null ? void 0 : i.list;
    if (!e)
      return;
    const t = this.extractPivotKeySeparator(e);
    e.forEach((r) => {
      if (t === "")
        r.getColDef().pivotKeys = [];
      else {
        const n = r.getColId().split(t);
        r.getColDef().pivotKeys = n.slice(0, n.length - 1);
      }
    });
  }
  extractPivotKeySeparator(e) {
    if (e.length === 0)
      return "";
    const t = (i, r) => {
      const n = i.getGroupId();
      return i.getParent() ? t(i.getParent(), n) : r.split(n)[1][0];
    }, s = e[0];
    return s.getParent() == null ? "" : t(s.getParent(), s.getColId());
  }
  getGroupLabels(e, t) {
    const s = [t];
    for (; e && e.level !== 0; )
      if (e = e.parent, e)
        if (e.group) {
          const i = this.colModel.getCol(ti);
          if (i) {
            const r = this.valueSvc.getValue(i, e), n = r != null && r.toString ? String(r.toString()) : " ";
            s.push(n);
          }
        } else
          s.push(e.key);
    return s;
  }
  /** cross filtering only */
  getFilteredRowNodes() {
    const e = {};
    return this.gridRowModel.forEachNodeAfterFilterAndSort((t) => {
      e[t.id] = t;
    }), e;
  }
  /** cross filtering only */
  getAllRowNodes(e) {
    const t = [];
    return this.gridRowModel.forEachNode((s) => {
      t.push(s);
    }), this.sortRowNodes(t, e);
  }
  /** cross filtering only */
  sortRowNodes(e, t) {
    var i;
    const s = t === !0 ? (i = this.sortSvc) == null ? void 0 : i.getSortOptions() : t;
    return !s || s.length == 0 || !this.rowNodeSorter ? e : this.rowNodeSorter.doFullSort(e, s);
  }
}, I_ = class extends R {
  constructor() {
    super(...arguments), this.valueColsWithoutSeriesType = /* @__PURE__ */ new Set();
  }
  wireBeans(e) {
    this.colModel = e.colModel, this.colNames = e.colNames, this.valueSvc = e.valueSvc;
  }
  postConstruct() {
    const e = () => this.valueColsWithoutSeriesType.clear();
    this.addManagedEventListeners({
      newColumnsLoaded: e,
      rowDataUpdated: e
    });
  }
  getColumn(e) {
    return this.colModel.getColDefCol(e);
  }
  getAllDisplayedColumns() {
    return this.beans.visibleCols.allCols;
  }
  getColDisplayName(e, t) {
    const s = "chart", i = this.colNames.getDisplayNameForColumn(e, s);
    if (t) {
      const r = [i], n = (o) => {
        if (!o)
          return;
        const a = this.colNames.getDisplayNameForColumnGroup(o, s);
        a != null && a.length && (r.unshift(a), n(o.getParent()));
      };
      return n(e.getParent()), r.join(" - ");
    }
    return i;
  }
  getRowGroupColumns() {
    var e;
    return ((e = this.beans.rowGroupColsSvc) == null ? void 0 : e.columns) ?? [];
  }
  getGroupDisplayColumns() {
    var e;
    return ((e = this.beans.showRowGroupCols) == null ? void 0 : e.getShowRowGroupCols()) ?? [];
  }
  isPivotMode() {
    return this.colModel.isPivotMode();
  }
  isPivotActive() {
    return this.colModel.isPivotActive();
  }
  getChartColumns() {
    const e = this.colModel.getCols(), t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
    return e.forEach((i) => {
      const r = i.getColDef(), n = r.chartDataType;
      if (n)
        switch (n) {
          case "category":
          case "time":
            t.add(i);
            return;
          case "series":
            s.add(i);
            return;
          case "excluded":
            return;
          default:
            F(153, { chartDataType: n });
            break;
        }
      if (r.colId === "ag-Grid-AutoColumn") {
        t.add(i);
        return;
      }
      if (!i.isPrimary()) {
        s.add(i);
        return;
      }
      (this.isInferredValueCol(i) ? s : t).add(i);
    }), { dimensionCols: t, valueCols: s };
  }
  isInferredValueCol(e) {
    const t = e.getColId();
    if (t === "ag-Grid-AutoColumn")
      return !1;
    const s = Ee(this.beans, { rowIndex: 0, rowPinned: null });
    if (!s)
      return this.valueColsWithoutSeriesType.has(t);
    let i = this.valueSvc.getValue(e, s);
    i == null && (i = this.extractLeafData(s, e)), i != null && (typeof i.toNumber == "function" ? i = i.toNumber() : typeof i.value == "number" && (i = i.value));
    const r = typeof i == "number" || e.colDef.cellDataType === "number" || ["series", "time"].includes(e.colDef.chartDataType);
    return r ? this.valueColsWithoutSeriesType.add(t) : i == null && e.colDef.cellDataType !== "number" && F(265, { colId: t }), r;
  }
  extractLeafData(e, t) {
    if (!e.allLeafChildren)
      return null;
    for (let s = 0; s < e.allLeafChildren.length; s++) {
      const i = e.allLeafChildren[s], r = this.valueSvc.getValue(t, i);
      if (r != null)
        return r;
    }
    return null;
  }
  destroy() {
    this.valueColsWithoutSeriesType.clear(), super.destroy();
  }
}, L_ = /* @__PURE__ */ new Set(["line", "groupedColumn", "stackedColumn", "area", "stackedArea"]), k_ = class extends R {
  constructor(e) {
    super(), this.suppressComboChartWarnings = !1, this.chartDataModel = e, this.seriesChartTypes = e.params.seriesChartTypes ?? [];
  }
  postConstruct() {
    this.initComboCharts();
  }
  update(e) {
    this.seriesChartTypes = e ?? this.seriesChartTypes, this.initComboCharts(), this.updateSeriesChartTypes();
  }
  initComboCharts() {
    const e = this.seriesChartTypes && this.seriesChartTypes.length > 0;
    (this.chartDataModel.chartType === "customCombo" || e) && (this.chartDataModel.chartType = "customCombo", this.savedCustomSeriesChartTypes = this.seriesChartTypes || []);
  }
  updateSeriesChartTypes() {
    if (this.chartDataModel.isComboChart()) {
      if (this.seriesChartTypes = this.seriesChartTypes.map((e) => {
        const t = ["groupedColumn", "stackedColumn", "stackedArea"].includes(e.chartType);
        return e.secondaryAxis = t ? !1 : e.secondaryAxis, e;
      }), this.chartDataModel.chartType === "customCombo") {
        this.updateSeriesChartTypesForCustomCombo();
        return;
      }
      this.updateChartSeriesTypesForBuiltInCombos();
    }
  }
  updateSeriesChartTypesForCustomCombo() {
    !(this.seriesChartTypes && this.seriesChartTypes.length > 0) && !this.suppressComboChartWarnings && F(150), this.seriesChartTypes = this.seriesChartTypes.map((i) => (L_.has(i.chartType) || (F(151, { chartType: i.chartType }), i.chartType = "line"), i));
    const t = (i) => {
      (!this.savedCustomSeriesChartTypes || this.savedCustomSeriesChartTypes.length === 0) && (this.savedCustomSeriesChartTypes = this.seriesChartTypes);
      const r = this.savedCustomSeriesChartTypes.find((n) => n.colId === i.colId);
      return r || (i.selected && !this.suppressComboChartWarnings && F(152, { colId: i.colId }), {
        colId: i.colId,
        chartType: "line",
        secondaryAxis: !1
      });
    }, s = this.chartDataModel.valueColState.map(t);
    this.seriesChartTypes = s, this.savedCustomSeriesChartTypes = s, this.suppressComboChartWarnings = !0;
  }
  updateChartSeriesTypesForBuiltInCombos() {
    const { chartType: e, valueColState: t } = this.chartDataModel, s = e === "columnLineCombo" ? "groupedColumn" : "stackedArea", i = e === "columnLineCombo" ? "line" : "groupedColumn", r = t.filter((o) => o.selected), n = Math.ceil(r.length / 2);
    this.seriesChartTypes = r.map((o, a) => {
      const l = a >= n ? i : s;
      return { colId: o.colId, chartType: l, secondaryAxis: !1 };
    });
  }
}, ns = "AG-GRID-DEFAULT-CATEGORY", G_ = class extends R {
  constructor(e) {
    super(), this.unlinked = !1, this.chartData = [], this.valueColState = [], this.dimensionColState = [], this.colNames = {}, this.crossFiltering = !1, this.crossFilteringSort = !0, this.grouping = !1, this.params = e, this.chartId = e.chartId, this.setParams(e);
  }
  wireBeans(e) {
    this.rangeSvc = e.rangeSvc, this.chartTranslation = e.chartTranslation;
  }
  setParams(e) {
    const {
      chartType: t,
      pivotChart: s,
      chartThemeName: i,
      switchCategorySeries: r,
      aggFunc: n,
      cellRange: o,
      suppressChartRanges: a,
      unlinkChart: l,
      crossFiltering: c,
      crossFilteringSort: d,
      seriesGroupType: h
    } = e;
    this.chartType = t, this.pivotChart = s ?? !1, this.chartThemeName = i, this.switchCategorySeries = !!r, this.aggFunc = n, this.referenceCellRange = o, this.suppliedCellRange = o, this.suppressChartRanges = a ?? !1, this.unlinked = !!l, this.crossFiltering = !!c, this.crossFilteringSort = d ?? !0, this.seriesGroupType = h;
  }
  postConstruct() {
    this.datasource = this.createManagedBean(new A_()), this.chartColSvc = this.createManagedBean(new I_()), this.comboChartModel = this.createManagedBean(new k_(this)), this.updateCellRanges({ setColsFromRange: !0 }), this.updateData();
  }
  updateModel(e) {
    const { cellRange: t, seriesChartTypes: s } = e;
    t !== this.suppliedCellRange && (this.dimensionCellRange = void 0, this.valueCellRange = void 0), this.setParams(e), this.updateSelectedDimensions(t == null ? void 0 : t.columns), this.updateCellRanges({ setColsFromRange: !0 }), (this.isComboChart() || s) && this.comboChartModel.update(s), this.unlinked || this.updateData();
  }
  updateCellRanges(e) {
    const { updatedColState: t, resetOrder: s, maintainColState: i, setColsFromRange: r } = e ?? {};
    this.valueCellRange && (this.referenceCellRange = this.valueCellRange);
    const { dimensionCols: n, valueCols: o } = this.chartColSvc.getChartColumns(), a = this.getAllColumnsFromRanges();
    t && this.updateColumnState(t, s), this.setDimensionCellRange(n, a, t), this.setValueCellRange(o, a, r), !t && !i && (this.resetColumnState(), this.syncDimensionCellRange()), this.comboChartModel.updateSeriesChartTypes();
  }
  updateData() {
    const { startRow: e, endRow: t } = this.getRowIndexes();
    this.pivotChart && this.resetColumnState(), this.grouping = this.isGrouping();
    const s = {
      aggFunc: this.aggFunc,
      dimensionCols: this.getSelectedDimensions(),
      grouping: this.grouping,
      pivoting: this.isPivotActive(),
      crossFiltering: this.crossFiltering,
      crossFilteringSort: this.getCrossFilteringSort(),
      valueCols: this.getSelectedValueCols(),
      startRow: e,
      endRow: t,
      isScatter: ["scatter", "bubble"].includes(this.chartType)
    }, { chartData: i, colNames: r, groupChartData: n } = this.datasource.getData(s);
    this.chartData = i, this.groupChartData = n, this.colNames = r, this.categoryAxisType = void 0;
  }
  isGrouping() {
    const e = this.gos.get("treeData"), t = e ? null : this.chartColSvc.getRowGroupColumns(), s = e || t && t.length > 0, i = this.getSelectedDimensions().map(({ colId: o }) => o), n = this.chartColSvc.getGroupDisplayColumns().map((o) => o.getColId()).some((o) => i.includes(o));
    return !!s && n;
  }
  getSelectedValueCols() {
    return this.valueColState.filter((e) => e.selected).map((e) => e.column);
  }
  getSelectedDimensions() {
    return this.dimensionColState.filter((e) => e.selected);
  }
  getColDisplayName(e, t) {
    return this.chartColSvc.getColDisplayName(e, t);
  }
  isPivotMode() {
    return this.chartColSvc.isPivotMode();
  }
  getChartDataType(e) {
    const t = this.chartColSvc.getColumn(e);
    return t ? t.getColDef().chartDataType : void 0;
  }
  getConvertTime(e) {
    var s;
    const t = this.chartColSvc.getColumn(e);
    if ((t == null ? void 0 : t.colDef.cellDataType) === "dateString")
      return (s = this.beans.dataTypeSvc) == null ? void 0 : s.getDateParserFunction(t);
  }
  isPivotActive() {
    return this.chartColSvc.isPivotActive();
  }
  createCellRange(e, ...t) {
    return {
      id: this.chartId,
      // set range ID to match chart ID so we can identify changes to the ranges for this chart
      startRow: this.referenceCellRange.startRow,
      endRow: this.referenceCellRange.endRow,
      columns: t,
      startColumn: e === Mt.DIMENSION || this.referenceCellRange.startColumn == null ? t[0] : this.referenceCellRange.startColumn,
      type: e
    };
  }
  getAllColumnsFromRanges() {
    if (this.pivotChart)
      return new Set(this.chartColSvc.getAllDisplayedColumns());
    const e = this.dimensionCellRange || this.valueCellRange ? [] : this.referenceCellRange.columns;
    return this.dimensionCellRange && e.push(...this.dimensionCellRange.columns), this.valueCellRange && e.push(...this.valueCellRange.columns), new Set(e);
  }
  getRowIndexes() {
    let e = 0, t = 0;
    const { rangeSvc: s, valueCellRange: i, dimensionCellRange: r } = this, n = i || r;
    if (s && n) {
      e = s.getRangeStartRow(n).rowIndex;
      const o = s.getRangeEndRow(n);
      t = o.rowPinned === "bottom" ? -1 : o.rowIndex;
    }
    return { startRow: e, endRow: t };
  }
  resetColumnState() {
    const { dimensionCols: e, valueCols: t } = this.chartColSvc.getChartColumns(), s = this.getAllColumnsFromRanges(), i = this.valueColState.length < 1;
    this.dimensionColState = [], this.valueColState = [];
    const r = fi(de(this.chartType));
    let n = !1, o = 1;
    const a = this.suppliedCellRange.columns[0];
    e.forEach((d) => {
      const h = d.getColId() === "ag-Grid-AutoColumn";
      let u = !1;
      this.crossFiltering && this.aggFunc ? a.getColId() === d.getColId() && (u = !0) : u = h ? !0 : (!n || r) && s.has(d), this.dimensionColState.push({
        column: d,
        colId: d.getColId(),
        displayName: this.getColDisplayName(d),
        selected: u,
        order: o++
      }), u && (n = !0);
    });
    const l = {
      colId: ns,
      displayName: this.chartTranslation.translate("defaultCategory"),
      selected: !n,
      // if no dimensions in range select the default
      order: 0
    };
    this.dimensionColState.unshift(l);
    const c = this.referenceCellRange.columns.filter(
      (d) => t.has(d)
    );
    t.forEach((d) => {
      i && this.referenceCellRange.columns.includes(d) && (d = c.shift()), this.valueColState.push({
        column: d,
        colId: d.getColId(),
        displayName: this.getColDisplayName(d),
        selected: s.has(d),
        order: o++
      });
    });
  }
  updateColumnState(e, t) {
    const s = (c) => c.colId === e.colId, { dimensionColState: i, valueColState: r } = this, n = i.find(s), o = r.find(s);
    if (n)
      if (fi(de(this.chartType)))
        n.selected = e.selected;
      else {
        const d = e.selected ? n : i.filter((h) => h !== n).find(({ selected: h }) => h);
        i.forEach((h) => h.selected = h === d);
      }
    else o && (o.selected = e.selected);
    const a = [...i, ...r], l = [];
    t || (a.forEach((c, d) => {
      d === e.order && l.push(e.colId), c.colId !== e.colId && l.push(c.colId);
    }), a.forEach((c) => {
      const d = l.indexOf(c.colId);
      c.order = d >= 0 ? l.indexOf(c.colId) : a.length - 1;
    })), this.reorderColState();
  }
  reorderColState() {
    const e = (t, s) => t.order - s.order;
    this.dimensionColState.sort(e), this.valueColState.sort(e);
  }
  setDimensionCellRange(e, t, s) {
    this.dimensionCellRange = void 0;
    const i = fi(de(this.chartType));
    if (!s && !this.dimensionColState.length) {
      const a = new Array();
      e.forEach((l) => {
        a.length > 0 && !i || !t.has(l) || a.push(l);
      }), a.length > 0 && (this.dimensionCellRange = this.createCellRange(Mt.DIMENSION, ...a));
      return;
    }
    let r = s ? [s] : [];
    if (this.crossFiltering && this.aggFunc) {
      const a = this.suppliedCellRange.columns[0];
      r = this.dimensionColState.filter(
        (l) => l.colId === a.getColId()
      );
    } else (i || r.length === 0 || r.some(({ column: a }) => !a || !e.has(a))) && (r = this.dimensionColState.filter((a) => a.selected));
    const n = r.length === 1 ? r[0].colId === ns : !1, o = r.map(({ column: a }) => a).filter((a) => a != null);
    o.length > 0 && !n && (this.dimensionCellRange = this.createCellRange(Mt.DIMENSION, ...o));
  }
  setValueCellRange(e, t, s) {
    this.valueCellRange = void 0;
    const i = [], r = qo(this.chartType);
    let n = 0;
    if (e.forEach((o) => {
      s ? (r == null || n < r) && t.has(o) && (i.push(o), n++) : this.valueColState.some((a) => a.selected && a.colId === o.getColId()) && i.push(o);
    }), i.length > 0) {
      let o = [];
      this.valueColState.length > 0 ? o = this.valueColState.map((a) => a.colId) : t.forEach((a) => o.push(a.getColId())), i.sort((a, l) => o.indexOf(a.getColId()) - o.indexOf(l.getColId())), this.valueCellRange = this.createCellRange(Mt.VALUE, ...i);
    }
  }
  resetCellRanges(e, t) {
    if (!e && !t)
      return;
    const { dimensionCols: s, valueCols: i } = this.chartColSvc.getChartColumns(), r = this.getAllColumnsFromRanges();
    e && this.setDimensionCellRange(s, r), t && this.setValueCellRange(i, r);
  }
  updateSelectedDimensions(e) {
    const t = new Set(e.map((i) => i.getColId()));
    if (fi(de(this.chartType))) {
      const i = this.dimensionColState.filter((n) => t.has(n.colId)), r = new Set(i.map((n) => n.colId));
      this.dimensionColState = this.dimensionColState.map((n) => ({
        ...n,
        selected: r.has(n.colId)
      }));
    } else {
      const r = (this.dimensionColState.find((n) => t.has(n.colId)) || this.dimensionColState[0]).colId;
      this.dimensionColState = this.dimensionColState.map((n) => ({
        ...n,
        selected: n.colId === r
      }));
    }
  }
  syncDimensionCellRange() {
    const e = this.getSelectedDimensions();
    if (e.length === 0)
      return;
    const t = e.map(({ column: s }) => s).filter((s) => s != null);
    t.length > 0 && (this.dimensionCellRange = this.createCellRange(Mt.DIMENSION, ...t));
  }
  isComboChart(e) {
    return Xd(e ?? this.chartType);
  }
  getCrossFilteringSort() {
    const e = this.crossFilteringSort;
    if (typeof e == "boolean")
      return e;
    const t = [];
    return e.forEach(({ sort: s, colId: i }) => {
      const r = this.chartColSvc.getColumn(i);
      r && t.push({
        sort: s,
        column: r
      });
    }), t;
  }
}, Sv = class extends ni {
  getAxes(e, t) {
    return [
      {
        type: this.getXAxisType(e),
        position: this.isHorizontal(t) ? "left" : "bottom"
      },
      {
        type: "number",
        position: this.isHorizontal(t) ? "bottom" : "left"
      }
    ];
  }
  computeSeriesStatistics(e, t) {
    const { data: s, fields: i } = e, [r] = e.categories, n = r.id || ns, o = this.groupDataByCategory(n, s);
    return Array.from(o).map(([a, l]) => {
      const c = { [r.id]: a };
      return i.forEach((d, h) => {
        const u = l.map((p) => p[d.colId]).filter((p) => typeof p == "number" && !isNaN(p)), g = t(u);
        for (const p of Object.keys(g)) {
          const f = `${p}:${h}`;
          c[f] = u.length > 0 ? g[p] : null;
        }
      }), c;
    });
  }
  groupDataByCategory(e, t) {
    const s = (i) => {
      if (e === ns)
        return 1;
      const r = i[e];
      return r == null ? "" : r instanceof Date ? r.getTime() : r;
    };
    return t.reduce((i, r) => {
      const n = s(r), o = i.get(n);
      return o ? o.push(r) : i.set(n, [r]), i;
    }, /* @__PURE__ */ new Map());
  }
}, O_ = class extends Sv {
  getSeries(e) {
    const [t] = e.categories;
    return e.fields.map((s, i) => ({
      type: this.standaloneChartType,
      // xKey/xName refer to category buckets
      xKey: t.id,
      xName: t.name,
      // yName is used to label the series
      yName: s.displayName ?? void 0,
      // custom field labels shown in the tooltip
      minName: "Min",
      q1Name: "Q1",
      medianName: "Median",
      q3Name: "Q3",
      maxName: "Max",
      // generated 'synthetic fields' from getData()
      minKey: `min:${i}`,
      q1Key: `q1:${i}`,
      medianKey: `median:${i}`,
      q3Key: `q3:${i}`,
      maxKey: `max:${i}`
    }));
  }
  getData(e) {
    return this.computeSeriesStatistics(e, (t) => {
      const s = t.sort((i, r) => i - r);
      return {
        min: s[0],
        q1: this.quantile(s, 0.25),
        median: this.quantile(s, 0.5),
        q3: this.quantile(s, 0.75),
        max: s[s.length - 1]
      };
    });
  }
  quantile(e, t) {
    const s = (e.length - 1) * t, i = Math.floor(s), r = s - i;
    return e[i + 1] !== void 0 ? e[i] + r * (e[i + 1] - e[i]) : e[i];
  }
}, V_ = class extends Sv {
  getSeries(e) {
    const [t] = e.categories;
    return e.fields.map((s, i) => ({
      type: this.standaloneChartType,
      // xKey/xName refer to category buckets
      xKey: t.id,
      xName: t.name,
      // yName is used to label the series
      yName: s.displayName ?? void 0,
      // custom field labels shown in the tooltip
      yLowName: "Min",
      yHighName: "Max",
      // generated 'synthetic fields' from getData()
      yLowKey: `min:${i}`,
      yHighKey: `max:${i}`
    }));
  }
  getData(e) {
    return this.computeSeriesStatistics(e, (t) => ({
      min: Math.min(...t),
      max: Math.max(...t)
    }));
  }
}, B_ = class extends R {
  constructor() {
    super(...arguments), this.beanName = "enterpriseChartProxyFactory";
  }
  createChartProxy(e) {
    switch (e.chartType) {
      case "histogram":
        return new v_(e);
      case "radarLine":
      case "radarArea":
      case "nightingale":
      case "radialColumn":
      case "radialBar":
        return new F_(e);
      case "rangeBar":
      case "rangeArea":
        return new V_(e);
      case "boxPlot":
        return new O_(e);
      case "treemap":
      case "sunburst":
        return new x_(e);
      case "heatmap":
        return new M_(e);
      case "waterfall":
        return new w_(e);
      case "funnel":
      case "coneFunnel":
      case "pyramid":
        return new b_(e);
    }
  }
}, xv = class extends R {
  constructor(e, t, s, i) {
    super(), this.chartController = e, this.eGui = t, this.cssClass = s, this.createPanels = i, this.panels = [];
  }
  postConstruct() {
    this.addManagedListeners(this.chartController, {
      chartUpdated: () => this.refreshPanels(!0),
      chartApiUpdate: () => this.refreshPanels(!1)
    });
  }
  addComponent(e) {
    this.createBean(e), this.panels.push(e), e.addCss(this.cssClass), this.eGui.appendChild(e.getGui());
  }
  refreshPanels(e) {
    const t = this.chartController.getChartType(), s = this.chartController.isGrouping(), i = de(t);
    e && t === this.chartType && s === this.isGrouping || (this.destroyPanels(), this.createPanels(t, i), this.chartType = t, this.isGrouping = s);
  }
  destroyPanels() {
    this.panels.forEach((e) => {
      se(e.getGui()), this.destroyBean(e);
    }), this.panels = [];
  }
  destroy() {
    this.destroyPanels(), super.destroy();
  }
}, N_ = class extends D {
  constructor(e) {
    super(), this.chartMenuParamsFactory = e;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const e = this.chartMenuParamsFactory.addEnableParams(
      "animation.enabled",
      {
        cssIdentifier: "charts-advanced-settings-top-level",
        direction: "vertical",
        suppressOpenCloseIcons: !0,
        title: this.chartTranslation.translate("animation"),
        suppressEnabledCheckbox: !0,
        useToggle: !0
      }
    ), t = this.chartMenuParamsFactory.getDefaultNumberInputParams(
      "animation.duration",
      "durationMillis",
      {
        min: 0
      }
    );
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="animationGroup">
                <ag-input-number-field data-ref="animationHeightInput"></ag-input>
            </ag-group-component>
        </div>`,
      [ae, pa],
      {
        animationGroup: e,
        animationHeightInput: t
      }
    );
  }
}, H_ = {
  tag: "div",
  cls: "ag-color-input",
  role: "presentation",
  children: [
    { tag: "div", ref: "eLabel", cls: "ag-input-field-label" },
    {
      tag: "div",
      ref: "eWrapper",
      cls: "ag-wrapper ag-input-wrapper",
      role: "presentation",
      children: [
        { tag: "input", ref: "eInput", cls: "ag-input-field-input" },
        { tag: "div", ref: "eColor", cls: "ag-color-input-color" }
      ]
    }
  ]
}, z_ = class extends yt {
  constructor() {
    super({
      template: H_
    }), this.eColor = x;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation, this.color = e.agChartsExports._Util.Color;
  }
  setColor(e) {
    const t = e.toRgbaString();
    this.setValue(this.color.fromString(t).toHexString().toUpperCase(), !0), this.eColor.style.backgroundColor = t;
  }
  setValue(e, t) {
    const s = this.color.validColorString(e ?? "");
    return this.eInput.setCustomValidity(s ? "" : this.chartTranslation.translate("invalidColor")), super.setValue(e, t), s && !t && this.dispatchLocalEvent({ type: "colorChanged" }), this;
  }
  onColorChanged(e) {
    this.addManagedListeners(this, { colorChanged: () => e(this.color.fromString(this.value)) });
  }
}, W_ = {
  selector: "AG-COLOR-INPUT",
  component: z_
}, lg = 8, Zn = [], __ = class extends D {
  constructor(e) {
    super(
      /* html */
      `<div class="ag-color-panel" tabindex="-1">
            <div data-ref="spectrumColor" class="ag-spectrum-color">
                <div class="ag-spectrum-sat ag-spectrum-fill">
                    <div data-ref="spectrumVal" class="ag-spectrum-val ag-spectrum-fill">
                        <div data-ref="spectrumDragger" class="ag-spectrum-dragger"></div>
                    </div>
                </div>
            </div>
            <div class="ag-spectrum-tools">
                <div data-ref="spectrumHue" class="ag-spectrum-hue ag-spectrum-tool">
                    <div class="ag-spectrum-hue-background"></div>
                    <div data-ref="spectrumHueSlider" class="ag-spectrum-slider"></div>
                </div>
                <div data-ref="spectrumAlpha" class="ag-spectrum-alpha ag-spectrum-tool">
                    <div class="ag-spectrum-alpha-background"></div>
                    <div data-ref="spectrumAlphaSlider" class="ag-spectrum-slider"></div>
                </div>
                <ag-color-input data-ref="colorInput"></ag-color-input>
                <div data-ref="recentColors" class="ag-recent-colors"></div>
            </div>
        </div>`,
      [W_]
    ), this.H = 1, this.S = 1, this.B = 1, this.A = 1, this.isSpectrumDragging = !1, this.isSpectrumHueDragging = !1, this.isSpectrumAlphaDragging = !1, this.colorChanged = !1, this.spectrumColor = x, this.spectrumVal = x, this.spectrumDragger = x, this.spectrumHue = x, this.spectrumHueSlider = x, this.spectrumAlpha = x, this.spectrumAlphaSlider = x, this.colorInput = x, this.recentColors = x, this.picker = e.picker;
  }
  wireBeans(e) {
    this._Color = e.agChartsExports._Util.Color;
  }
  postConstruct() {
    this.initTabIndex(), this.initRecentColors(), this.addGuiEventListener("focus", () => this.spectrumColor.focus()), this.addGuiEventListener("keydown", (e) => {
      e.key === S.ENTER && !e.defaultPrevented && this.destroy();
    }), this.addManagedListeners(this.spectrumColor, { keydown: (e) => this.moveDragger(e) }), this.addManagedListeners(this.spectrumAlphaSlider, { keydown: (e) => this.moveAlphaSlider(e) }), this.addManagedListeners(this.spectrumHueSlider, { keydown: (e) => this.moveHueSlider(e) }), this.addManagedListeners(this.spectrumVal, { mousedown: this.onSpectrumDraggerDown.bind(this) }), this.addManagedListeners(this.spectrumHue, { mousedown: this.onSpectrumHueDown.bind(this) }), this.addManagedListeners(this.spectrumAlpha, { mousedown: this.onSpectrumAlphaDown.bind(this) }), this.addGuiEventListener("mousemove", (e) => {
      this.onSpectrumDraggerMove(e), this.onSpectrumHueMove(e), this.onSpectrumAlphaMove(e);
    }), this.addManagedListeners(document, { mouseup: this.onMouseUp.bind(this) }), this.colorInput.onColorChanged(this.setColor.bind(this)), this.addManagedListeners(this.recentColors, {
      click: this.onRecentColorClick.bind(this),
      keydown: (e) => {
        (e.key === S.ENTER || e.key === S.SPACE) && (e.preventDefault(), this.onRecentColorClick(e));
      }
    });
  }
  initTabIndex() {
    const e = this.tabIndex = this.gos.get("tabIndex").toString();
    this.spectrumColor.setAttribute("tabindex", e), this.spectrumHueSlider.setAttribute("tabindex", e), this.spectrumAlphaSlider.setAttribute("tabindex", e);
  }
  refreshSpectrumRect() {
    return this.spectrumValRect = this.spectrumVal.getBoundingClientRect();
  }
  refreshHueRect() {
    return this.spectrumHueRect = this.spectrumHue.getBoundingClientRect();
  }
  refreshAlphaRect() {
    return this.spectrumAlphaRect = this.spectrumAlpha.getBoundingClientRect();
  }
  onSpectrumDraggerDown(e) {
    e.preventDefault(), this.refreshSpectrumRect(), this.isSpectrumDragging = !0, this.moveDragger(e);
  }
  onSpectrumDraggerMove(e) {
    this.isSpectrumDragging && this.moveDragger(e);
  }
  onSpectrumHueDown(e) {
    this.refreshHueRect(), this.isSpectrumHueDragging = !0, this.moveHueSlider(e);
  }
  onSpectrumHueMove(e) {
    this.isSpectrumHueDragging && this.moveHueSlider(e);
  }
  onSpectrumAlphaDown(e) {
    this.refreshAlphaRect(), this.isSpectrumAlphaDragging = !0, this.moveAlphaSlider(e);
  }
  onSpectrumAlphaMove(e) {
    this.isSpectrumAlphaDragging && this.moveAlphaSlider(e);
  }
  onMouseUp() {
    this.isSpectrumDragging = !1, this.isSpectrumHueDragging = !1, this.isSpectrumAlphaDragging = !1;
  }
  moveDragger(e) {
    const t = this.spectrumValRect;
    if (!t)
      return;
    let s, i;
    if (e instanceof MouseEvent)
      s = e.clientX - t.left, i = e.clientY - t.top;
    else {
      const r = e.key === S.LEFT, n = e.key === S.RIGHT, o = e.key === S.UP, a = e.key === S.DOWN, l = o || a, c = r || n;
      if (!l && !c)
        return;
      e.preventDefault();
      const { x: d, y: h } = this.getSpectrumValue();
      s = d + (c ? r ? -5 : 5 : 0), i = h + (l ? o ? -5 : 5 : 0);
    }
    s = Math.max(s, 0), s = Math.min(s, t.width), i = Math.max(i, 0), i = Math.min(i, t.height), this.setSpectrumValue(s / t.width, 1 - i / t.height);
  }
  moveHueSlider(e) {
    const t = this.spectrumHueRect;
    if (!t)
      return;
    const s = this.moveSlider(this.spectrumHueSlider, e);
    s != null && (this.H = 1 - s / t.width, this.update());
  }
  moveAlphaSlider(e) {
    const t = this.spectrumAlphaRect;
    if (!t)
      return;
    const s = this.moveSlider(this.spectrumAlphaSlider, e);
    s != null && (this.A = s / t.width, this.update());
  }
  moveSlider(e, t) {
    var o;
    const s = e.getBoundingClientRect(), i = (o = e.parentElement) == null ? void 0 : o.getBoundingClientRect();
    if (!e || !i)
      return null;
    const r = s.width / 2;
    let n;
    if (t instanceof MouseEvent)
      n = Math.floor(t.clientX - i.left);
    else {
      const a = t.key === S.LEFT, l = t.key === S.RIGHT;
      if (!a && !l)
        return null;
      t.preventDefault();
      const c = a ? -5 : 5;
      n = parseFloat(e.style.left) + r + c;
    }
    return n = Math.max(n, 0), n = Math.min(n, i.width), e.style.left = n - r + "px", n;
  }
  update(e) {
    const { A: t, S: s, B: i, H: r, _Color: n } = this, o = r * 360, a = n.fromHSB(o, s, i, t), l = a.toRgbaString(), d = n.fromHSB(o, s, i).toRgbaString(), u = n.fromHSB(o, 1, 1).toRgbaString(), g = this.picker;
    n.fromString(g.getValue()).toRgbaString() !== l && (this.colorChanged = !0), g.setValue(l), this.spectrumColor.style.backgroundColor = u, this.spectrumDragger.style.backgroundColor = d, this.spectrumHueSlider.style.backgroundColor = u, this.spectrumAlpha.style.setProperty(
      "--ag-internal-spectrum-alpha-color-from",
      n.fromHSB(o, s, i, 0).toRgbaString()
    ), this.spectrumAlpha.style.setProperty("--ag-internal-spectrum-alpha-color-to", d), this.spectrumAlpha.style.setProperty("--ag-internal-spectrum-alpha-color", l), e || this.colorInput.setColor(a);
  }
  /**
   * @param saturation In the [0, 1] interval.
   * @param brightness In the [0, 1] interval.
   */
  setSpectrumValue(e, t, s) {
    const i = this.spectrumValRect || this.refreshSpectrumRect();
    if (i == null)
      return;
    const r = this.spectrumDragger, n = r.getBoundingClientRect();
    e = Math.max(0, e), e = Math.min(1, e), t = Math.max(0, t), t = Math.min(1, t), this.S = e, this.B = t, r.style.left = e * i.width - n.width / 2 + "px", r.style.top = (1 - t) * i.height - n.height / 2 + "px", this.update(s);
  }
  getSpectrumValue() {
    const e = this.spectrumDragger, t = e.getBoundingClientRect(), s = parseFloat(e.style.left) + t.width / 2, i = parseFloat(e.style.top) + t.height / 2;
    return { x: s, y: i };
  }
  initRecentColors() {
    const e = Zn, t = e.map((s, i) => (
      /* html */
      `<div class="ag-recent-color" id=${i} style="background-color: ${s}; width: 15px; height: 15px;" recent-color="${s}" tabIndex="${this.tabIndex}"></div>`
    ));
    this.recentColors.innerHTML = t.join(""), O(this.recentColors, !!e.length);
  }
  setValue(e) {
    const t = this._Color.fromString(e);
    this.setColor(t, !0);
  }
  setColor(e, t) {
    const [s, i, r] = e.toHSB();
    this.H = (isNaN(s) ? 0 : s) / 360, this.A = e.a;
    const n = this.spectrumHueRect || this.refreshHueRect(), o = this.spectrumAlphaRect || this.refreshAlphaRect();
    this.spectrumHueSlider.style.left = `${(this.H - 1) * -n.width - this.spectrumHueSlider.getBoundingClientRect().width / 2}px`, this.spectrumAlphaSlider.style.left = `${this.A * o.width - this.spectrumAlphaSlider.getBoundingClientRect().width / 2}px`, this.setSpectrumValue(i, r, !t);
  }
  onRecentColorClick(e) {
    const t = e.target;
    if (!A(t.id))
      return;
    const s = parseInt(t.id, 10);
    this.setValue(Zn[s]), this.destroy();
  }
  addRecentColor() {
    const t = this._Color.fromHSB(this.H * 360, this.S, this.B, this.A).toRgbaString();
    let s = Zn;
    !this.colorChanged || s[0] === t || (s = s.filter((i) => i != t), s = [t].concat(s), s.length > lg && (s = s.slice(0, lg)), Zn = s);
  }
  destroy() {
    this.addRecentColor(), super.destroy();
  }
}, Fv = class extends rd {
  constructor(e) {
    super({
      pickerAriaLabelKey: "ariaLabelColorPicker",
      pickerAriaLabelValue: "Color Picker",
      pickerType: "ag-list",
      className: "ag-color-picker",
      pickerIcon: "chartsColorPicker",
      ...e
    });
  }
  postConstruct() {
    this.eDisplayFieldColor = K({
      tag: "span",
      cls: "ag-color-picker-color"
    }), this.eDisplayFieldText = K({
      tag: "span",
      cls: "ag-color-picker-value"
    }), this.eDisplayField.append(this.eDisplayFieldColor, this.eDisplayFieldText), super.postConstruct(), this.value && this.setValue(this.value);
  }
  createPickerComponent() {
    const e = this.eWrapper.getBoundingClientRect(), t = this.beans.popupSvc.getParentRect();
    return this.createBean(
      new Tn({
        closable: !1,
        modal: !0,
        hideTitleBar: !0,
        minWidth: 190,
        width: 190,
        height: 250,
        x: e.right - t.left - 190,
        y: e.top - t.top - 250 - (this.config.pickerGap ?? 0),
        postProcessPopupParams: {
          type: "colorPicker",
          eventSource: this.eWrapper
        }
      })
    );
  }
  renderAndPositionPicker() {
    const e = this.pickerComponent, t = this.createBean(new __({ picker: this }));
    return e.addCss("ag-color-dialog"), t.addDestroyFunc(() => {
      e.isAlive() && this.destroyBean(e);
    }), e.setParentComponent(this), e.setBodyComponent(t), t.setValue(this.getValue()), t.getGui().focus(), e.addDestroyFunc(() => {
      this.isDestroyingPicker ? this.isDestroyingPicker = !1 : (this.beforeHidePicker(), this.isDestroyingPicker = !0, t.isAlive() && this.destroyBean(t), this.isAlive() && this.getFocusableElement().focus());
    }), () => {
      var s;
      return (s = this.pickerComponent) == null ? void 0 : s.close();
    };
  }
  setValue(e) {
    return this.value === e ? this : (this.eDisplayFieldColor.style.backgroundColor = e, this.eDisplayFieldText.textContent = this.beans.agChartsExports._Util.Color.fromString(
      e
    ).toHexString().toUpperCase(), super.setValue(e));
  }
  getValue() {
    return this.value;
  }
}, hs = {
  selector: "AG-COLOR-PICKER",
  component: Fv
}, U_ = class extends D {
  constructor(e) {
    super(), this.chartMenuParamsFactory = e;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const e = this.chartMenuParamsFactory.addEnableParams(
      "crosshair.enabled",
      {
        cssIdentifier: "charts-advanced-settings-top-level",
        direction: "vertical",
        suppressOpenCloseIcons: !0,
        title: this.chartTranslation.translate("crosshair"),
        suppressEnabledCheckbox: !0,
        useToggle: !0
      }
    ), t = this.chartMenuParamsFactory.getDefaultCheckboxParams(
      "crosshair.label.enabled",
      "crosshairLabel"
    ), s = this.chartMenuParamsFactory.getDefaultCheckboxParams(
      "crosshair.snap",
      "crosshairSnap"
    ), i = this.chartMenuParamsFactory.getDefaultColorPickerParams(
      "crosshair.stroke",
      "color"
    );
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="crosshairGroup">
                <ag-checkbox data-ref="crosshairLabelCheckbox"></ag-checkbox>
                <ag-checkbox data-ref="crosshairSnapCheckbox"></ag-checkbox>
                <ag-color-picker data-ref="crosshairStrokeColorPicker"></ag-color-picker>
            </ag-group-component>
        </div>`,
      [ae, _t, hs],
      {
        crosshairGroup: e,
        crosshairLabelCheckbox: t,
        crosshairSnapCheckbox: s,
        crosshairStrokeColorPicker: i
      }
    );
  }
}, $_ = class extends Ks {
  constructor(e) {
    super(e, "ag-range-field", "range");
  }
  postConstruct() {
    super.postConstruct();
    const { min: e, max: t, step: s } = this.config;
    e != null && this.setMinValue(e), t != null && this.setMaxValue(t), this.setStep(s || 1);
  }
  addInputListeners() {
    this.addManagedElementListeners(this.eInput, {
      input: (e) => {
        const t = e.target.value;
        this.setValue(t);
      }
    });
  }
  setMinValue(e) {
    return this.min = e, this.eInput.setAttribute("min", e.toString()), this;
  }
  setMaxValue(e) {
    return this.max = e, this.eInput.setAttribute("max", e.toString()), this;
  }
  setStep(e) {
    return this.eInput.setAttribute("step", e.toString()), this;
  }
  setValue(e, t) {
    this.min != null && (e = Math.max(parseFloat(e), this.min).toString()), this.max != null && (e = Math.min(parseFloat(e), this.max).toString());
    const s = super.setValue(e, t);
    return this.eInput.value = e, s;
  }
}, K_ = {
  selector: "AG-INPUT-RANGE",
  component: $_
}, Ct = class extends id {
  constructor(e) {
    super(
      e,
      /* html */
      `<div class="ag-slider">
            <label data-ref="eLabel"></label>
            <div class="ag-wrapper ag-slider-wrapper">
                <ag-input-range data-ref="eSlider"></ag-input-range>
                <ag-input-number-field data-ref="eText"></ag-input-number-field>
            </div>
        </div>`,
      [K_, pa]
    ), this.eLabel = x, this.eSlider = x, this.eText = x, this.labelAlignment = "top";
  }
  postConstruct() {
    super.postConstruct(), this.eSlider.addCss("ag-slider-field");
    const { minValue: e, maxValue: t, textFieldWidth: s, step: i, value: r, onValueChange: n } = this.config;
    e != null && this.setMinValue(e), t != null && this.setMaxValue(t), s != null && this.setTextFieldWidth(s), i != null && this.setStep(i), r != null && this.setValue(r), n != null && this.onValueChange(n);
  }
  onValueChange(e) {
    return this.addManagedListeners(this.eText, {
      fieldValueChanged: () => {
        const t = parseFloat(this.eText.getValue());
        this.eSlider.setValue(t.toString(), !0), e(t || 0);
      }
    }), this.addManagedListeners(this.eSlider, {
      fieldValueChanged: () => {
        const t = this.eSlider.getValue();
        this.eText.setValue(t, !0), e(parseFloat(t));
      }
    }), this;
  }
  setSliderWidth(e) {
    return this.eSlider.setWidth(e), this;
  }
  setTextFieldWidth(e) {
    return this.eText.setWidth(e), this;
  }
  setMinValue(e) {
    return this.eSlider.setMinValue(e), this.eText.setMin(e), this;
  }
  setMaxValue(e) {
    return this.eSlider.setMaxValue(e), this.eText.setMax(e), this;
  }
  getValue() {
    return this.eText.getValue();
  }
  setValue(e, t) {
    return this.getValue() === e ? this : (this.eText.setValue(e, !0), this.eSlider.setValue(e, !0), t || this.dispatchLocalEvent({ type: "fieldValueChanged" }), this);
  }
  setStep(e) {
    return this.eSlider.setStep(e), this.eText.setStep(e), this;
  }
}, mt = {
  selector: "AG-SLIDER",
  component: Ct
}, j_ = class extends D {
  constructor(e) {
    super(), this.chartMenuParamsFactory = e;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const e = this.chartMenuParamsFactory.addEnableParams(
      "navigator.enabled",
      {
        cssIdentifier: "charts-advanced-settings-top-level",
        direction: "vertical",
        suppressOpenCloseIcons: !0,
        title: this.chartTranslation.translate("navigator"),
        suppressEnabledCheckbox: !0,
        useToggle: !0
      }
    ), t = this.chartMenuParamsFactory.getDefaultSliderParams(
      "navigator.height",
      "height",
      60
    );
    t.minValue = 10;
    const s = this.chartMenuParamsFactory.getDefaultCheckboxParams(
      "navigator.miniChart.enabled",
      "miniChart"
    );
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="navigatorGroup">
                <ag-slider data-ref="navigatorHeightSlider"></ag-slider>
                <ag-checkbox data-ref="navigatorMiniChartCheckbox"></ag-checkbox>
            </ag-group-component>
        </div>`,
      [ae, mt, _t],
      {
        navigatorGroup: e,
        navigatorHeightSlider: t,
        navigatorMiniChartCheckbox: s
      }
    );
  }
}, Y_ = class extends D {
  constructor(e) {
    super(), this.chartMenuParamsFactory = e, this.zoomScrollingStepInput = x;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const e = this.chartMenuParamsFactory.addEnableParams("zoom.enabled", {
      cssIdentifier: "charts-advanced-settings-top-level",
      direction: "vertical",
      suppressOpenCloseIcons: !0,
      title: this.chartTranslation.translate("zoom"),
      suppressEnabledCheckbox: !0,
      useToggle: !0
    }), t = this.chartMenuParamsFactory.getDefaultCheckboxParams(
      "zoom.enableScrolling",
      "scrollingZoom"
    ), s = this.chartMenuParamsFactory.getDefaultSliderParams(
      "zoom.scrollingStep",
      "scrollingStep",
      1
    );
    s.step = 0.01, s.minValue = s.step;
    const i = this.chartMenuParamsFactory.getDefaultCheckboxParams(
      "zoom.enableSelecting",
      "selectingZoom"
    );
    t.onValueChange = /* @__PURE__ */ ((r) => (n) => {
      r && (r(n), this.zoomScrollingStepInput.setDisabled(!n));
    })(t.onValueChange), this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="zoomGroup">
                <ag-checkbox data-ref="zoomSelectingCheckbox"></ag-checkbox>
                <ag-checkbox data-ref="zoomScrollingCheckbox"></ag-checkbox>
                <ag-slider data-ref="zoomScrollingStepInput"></ag-slider>
            </ag-group-component>
        </div>`,
      [ae, _t, mt],
      {
        zoomGroup: e,
        zoomScrollingCheckbox: t,
        zoomScrollingStepInput: s,
        zoomSelectingCheckbox: i
      }
    ), this.zoomScrollingStepInput.setDisabled(!t.value);
  }
}, q_ = ["navigator", "zoom", "animation", "crosshair"], X_ = class extends D {
  constructor(e) {
    super(
      /* html */
      '<div class="ag-chart-advanced-settings-wrapper"></div>'
    ), this.chartMenuContext = e;
  }
  postConstruct() {
    this.chartPanelFeature = this.createManagedBean(
      new xv(
        this.chartMenuContext.chartController,
        this.getGui(),
        "ag-chart-advanced-settings-section",
        (e, t) => this.createPanels(e, t)
      )
    ), this.chartPanelFeature.refreshPanels();
  }
  createPanels(e, t) {
    q_.forEach((s) => {
      if (!this.isGroupPanelShownForSeries(s, t))
        return;
      const i = this.createPanel(s);
      this.chartPanelFeature.addComponent(i);
    });
  }
  isGroupPanelShownForSeries(e, t) {
    return e === "animation" || Ys(t) && !Ec(t);
  }
  createPanel(e) {
    const { chartMenuParamsFactory: t, chartAxisMenuParamsFactory: s } = this.chartMenuContext;
    switch (e) {
      case "navigator":
        return new j_(t);
      case "zoom":
        return new Y_(t);
      case "animation":
        return new N_(t);
      case "crosshair":
        return new U_(s);
    }
  }
}, Z_ = class extends R {
  constructor() {
    super(...arguments), this.beanName = "advSettingsMenuFactory";
  }
  showMenu(e, t) {
    this.hideMenu();
    const s = this.createBean(new Q_(e));
    this.activeDialog = this.createBean(
      new Tn({
        title: this.beans.chartTranslation.translate("advancedSettings"),
        component: s,
        width: 300,
        height: 400,
        resizable: !0,
        movable: !0,
        centered: !0,
        closable: !0,
        afterGuiAttached: () => {
          var i;
          (i = Vt(s.getGui())[0]) == null || i.focus();
        },
        closedCallback: () => {
          this.activeMenu = this.destroyBean(this.activeMenu), this.activeDialog = void 0, t == null || t.focus({ preventScroll: !0 });
        }
      })
    ), this.activeMenu = s;
  }
  hideMenu() {
    this.activeDialog && this.destroyBean(this.activeDialog);
  }
  destroy() {
    this.activeMenu = this.destroyBean(this.activeMenu), this.activeDialog = this.destroyBean(this.activeDialog), super.destroy();
  }
}, Q_ = class extends ls {
  constructor(e) {
    super(
      /* html */
      '<div class="ag-chart-advanced-settings"></div>'
    ), this.chartMenuContext = e;
  }
  postConstruct() {
    this.advancedSettingsPanel = this.createManagedBean(new X_(this.chartMenuContext)), this.getGui().appendChild(this.advancedSettingsPanel.getGui()), this.initialiseTabGuard({
      onTabKeyDown: this.onTabKeyDown.bind(this),
      focusTrapActive: !0
    });
  }
  onTabKeyDown(e) {
    if (e.defaultPrevented)
      return;
    e.preventDefault();
    const t = e.shiftKey, s = this.advancedSettingsPanel.getGui(), i = ze(this.beans, s, !1, t);
    if (i)
      i.focus();
    else {
      const r = Vt(s);
      r.length && r[t ? r.length - 1 : 0].focus();
    }
  }
}, J_ = class extends R {
  constructor() {
    super(...arguments), this.beanName = "chartMenuListFactory";
  }
  wireBeans(e) {
    this.popupSvc = e.popupSvc, this.chartMenuSvc = e.chartMenuSvc, this.chartTranslation = e.chartTranslation;
  }
  showMenuList(e) {
    const { eventSource: t, showMenu: s, chartMenuContext: i } = e, r = this.chartMenuSvc.doChartToolPanelsExist(i.chartController), n = this.mapWithStockItems(
      this.getMenuItems(i.chartController, r),
      i,
      s,
      t,
      r
    );
    if (!n.length)
      return;
    const o = this.createBean(new eU(n));
    this.activeChartMenuList = o;
    let a = -1, l = "left";
    this.gos.get("enableRtl") && (a = 1, l = "right");
    const c = o.getGui();
    this.popupSvc.addPopup({
      modal: !0,
      eChild: c,
      closeOnEsc: !0,
      closedCallback: () => {
        this.destroyBean(o), this.activeChartMenuList = void 0, Jt(this.beans) && t.focus({ preventScroll: !0 });
      },
      afterGuiAttached: (d) => o.afterGuiAttached(d),
      positionCallback: () => {
        this.popupSvc.positionPopupByComponent({
          type: "chartMenu",
          eventSource: t,
          ePopup: c,
          alignSide: l,
          nudgeX: 4 * a,
          nudgeY: 4,
          position: "under",
          keepWithinBounds: !0
        });
      },
      ariaLabel: "Chart Menu"
    });
  }
  getMenuItems(e, t) {
    const s = [
      ...t ? ["chartEdit"] : [],
      ...e.isEnterprise() ? ["chartAdvancedSettings"] : [],
      e.isChartLinked() ? "chartUnlink" : "chartLink",
      "chartDownload"
    ], i = this.gos.get("chartMenuItems");
    return i ? Array.isArray(i) ? i : i(
      V(this.gos, {
        defaultItems: s,
        chartId: e.getChartId()
      })
    ) : s;
  }
  mapWithStockItems(e, t, s, i, r) {
    if (!e)
      return [];
    const n = [];
    return e.forEach((o) => {
      let a;
      if (typeof o == "string" ? a = this.getStockMenuItem(
        o,
        t,
        s,
        i,
        r
      ) : a = { ...o }, !a)
        return;
      const { subMenu: l } = a;
      Array.isArray(l) && (a.subMenu = this.mapWithStockItems(
        l,
        t,
        s,
        i,
        r
      )), n.push(a);
    }), n;
  }
  getStockMenuItem(e, t, s, i, r) {
    switch (e) {
      case "chartEdit":
        return r ? this.createMenuItem(this.chartTranslation.translate("chartEdit"), "chartsMenuEdit", s) : null;
      case "chartAdvancedSettings":
        return this.createMenuItem(
          this.chartTranslation.translate("chartAdvancedSettings"),
          "chartsMenuAdvancedSettings",
          () => this.chartMenuSvc.openAdvancedSettings(t, i)
        );
      case "chartUnlink":
        return t.chartController.isChartLinked() ? this.createMenuItem(
          this.chartTranslation.translate("chartUnlink"),
          "unlinked",
          () => this.chartMenuSvc.toggleLinked(t)
        ) : null;
      case "chartLink":
        return t.chartController.isChartLinked() ? null : this.createMenuItem(
          this.chartTranslation.translate("chartLink"),
          "linked",
          () => this.chartMenuSvc.toggleLinked(t)
        );
      case "chartDownload":
        return this.createMenuItem(
          this.chartTranslation.translate("chartDownload"),
          "chartsDownload",
          () => this.chartMenuSvc.downloadChart(t)
        );
    }
    return null;
  }
  createMenuItem(e, t, s) {
    return {
      name: e,
      icon: N(t, this.beans, null),
      action: s
    };
  }
  destroy() {
    this.destroyBean(this.activeChartMenuList), super.destroy();
  }
}, eU = class extends D {
  constructor(e) {
    super(
      /* html */
      `
            <div data-ref="eChartsMenu" role="presentation" class="ag-menu ag-chart-menu-popup"></div>
        `
    ), this.menuItems = e, this.eChartsMenu = x;
  }
  postConstruct() {
    this.mainMenuList = this.createManagedBean(new Mn(0)), this.mainMenuList.addMenuItems(this.menuItems), this.mainMenuList.addEventListener("closeMenu", this.onHidePopup.bind(this)), this.eChartsMenu.appendChild(this.mainMenuList.getGui());
  }
  onHidePopup() {
    var e;
    (e = this.hidePopupFunc) == null || e.call(this);
  }
  afterGuiAttached({ hidePopup: e }) {
    e && (this.hidePopupFunc = e, this.addDestroyFunc(e)), ye(this.mainMenuList.getGui());
  }
}, tU = class extends R {
  constructor() {
    super(...arguments), this.beanName = "chartCrossFilterSvc";
  }
  filter(e, t = !1) {
    const s = this.beans.filterManager, i = (s == null ? void 0 : s.getFilterModel()) ?? {};
    if (t) {
      Object.keys(i).length > 0 && (s == null || s.setFilterModel(null));
      return;
    }
    let r = cg(e);
    r.indexOf("-filtered-out") && (r = r.replace("-filtered-out", "")), this.updateFilters(i, e, r);
  }
  updateFilters(e, t, s) {
    const i = cg(t), r = this.convertRawValue(s, t.datum[i]);
    if (r === void 0)
      return;
    const n = this.beans.filterManager;
    n == null || n.getColumnFilterInstance(s).then((o) => {
      const a = o == null ? void 0 : o.filterType;
      let l, c = (p) => p;
      if (a === "multi") {
        const p = iU(o);
        l = p.setFilter, c = p.processModel ?? c;
      } else a === "set" && (l = o);
      if (!l) {
        F(154, { colId: s });
        return;
      }
      const d = t.event.metaKey || t.event.ctrlKey, h = l.getFilterHandler().getCrossFilterModel(
        (p, f, m) => rU(d, p(r), f, m)
      ), u = c(h), g = d ? { ...e } : {};
      g[s] = u, n == null || n.setFilterModel(g);
    });
  }
  convertRawValue(e, t) {
    const { colModel: s, dataTypeSvc: i } = this.beans, r = s.getColById(e), n = r == null ? void 0 : r.colDef;
    return n && i && n.chartDataType === "time" && n.cellDataType === "dateString" ? i.getDateFormatterFunction(r)(t) : t;
  }
};
function sU(e, t, s) {
  const i = new Array(s);
  for (let r = 0; r < s; r++)
    i[r] = r === t ? e : null;
  return { filterType: "multi", filterModels: i };
}
function iU(e) {
  const t = e.getNumChildFilters();
  for (let s = 0; s < t; s++) {
    const i = e.getChildFilterInstance(s);
    if ((i == null ? void 0 : i.filterType) === "set")
      return {
        setFilter: i,
        processModel: (r) => sU(r, s, t)
      };
  }
  return {};
}
function cg(e) {
  return e.xKey || e.calloutLabelKey;
}
function rU(e, t, s, i) {
  let r;
  if (e)
    if (s.has(t) && (i == null || i.includes(t)))
      if (r = [], i == null)
        for (const n of s)
          n !== t && r.push(n);
      else
        for (const n of i)
          n !== t && s.has(n) && r.push(n);
    else {
      if (i == null)
        r = Array.from(s);
      else {
        r = [];
        for (const n of i)
          s.has(n) && r.push(n);
      }
      r.push(t);
    }
  else
    r = [t];
  return {
    filterType: "set",
    values: r
  };
}
var nU = [
  "chartUnlink",
  "chartLink",
  "chartDownload",
  "chartMenu"
], mo = {
  settings: "chartSettings",
  data: "chartData",
  format: "chartFormat"
}, oU = class extends R {
  constructor() {
    super(...arguments), this.beanName = "chartMenuSvc";
  }
  wireBeans(e) {
    this.advSettingsMenuFactory = e.advSettingsMenuFactory;
  }
  downloadChart(e, t, s, i) {
    e.chartController.getChartProxy().downloadChart(t, s, i);
  }
  toggleLinked(e) {
    e.chartController.detachChartRange();
  }
  openAdvancedSettings(e, t) {
    var s;
    (s = this.advSettingsMenuFactory) == null || s.showMenu(e, t);
  }
  hideAdvancedSettings() {
    var e;
    (e = this.advSettingsMenuFactory) == null || e.hideMenu();
  }
  getChartToolbarOptions() {
    const e = ["chartMenu"], t = this.gos.getCallback("getChartToolbarItems");
    return t ? t({
      defaultItems: e
    }).filter((i) => nU.includes(i) ? !0 : (F(155, { option: i }), !1)) : e;
  }
  getChartToolPanels(e) {
    var o;
    const t = this.gos.get("chartToolPanelsDef");
    let i = ((o = t == null ? void 0 : t.panels) == null ? void 0 : o.map((a) => {
      const l = mo[a];
      return l || F(156, { panel: a }), l;
    }).filter((a) => !!a)) ?? Object.values(mo);
    e.isPivotChart() && (i = i.filter((a) => a !== "chartData"));
    const r = t == null ? void 0 : t.defaultToolPanel, n = r && mo[r] || i[0];
    return {
      panels: i,
      defaultPanel: n
    };
  }
  doesChartToolbarExist() {
    return this.getChartToolbarOptions().length > 0;
  }
  doChartToolPanelsExist(e) {
    const { panels: t } = this.getChartToolPanels(e);
    return t.length > 0;
  }
}, aU = {
  pivotChartTitle: "Pivot Chart",
  rangeChartTitle: "Range Chart",
  settings: "Chart",
  data: "Set Up",
  format: "Customize",
  categories: "Categories",
  defaultCategory: "(None)",
  series: "Series",
  switchCategorySeries: "Switch Category / Series",
  categoryValues: "Category Values",
  seriesLabels: "Series Labels",
  aggregate: "Aggregate",
  xyValues: "X Y Values",
  paired: "Paired Mode",
  axis: "Axis",
  xAxis: "Horizontal Axis",
  yAxis: "Vertical Axis",
  polarAxis: "Polar Axis",
  radiusAxis: "Radius Axis",
  navigator: "Navigator",
  zoom: "Zoom",
  animation: "Animation",
  crosshair: "Crosshair",
  color: "Color",
  thickness: "Thickness",
  preferredLength: "Preferred Length",
  xType: "X Type",
  axisType: "Axis Type",
  automatic: "Automatic",
  category: "Category",
  number: "Number",
  time: "Time",
  timeFormat: "Time Format",
  autoRotate: "Auto Rotate",
  labelRotation: "Rotation",
  circle: "Circle",
  polygon: "Polygon",
  square: "Square",
  cross: "Cross",
  diamond: "Diamond",
  plus: "Plus",
  triangle: "Triangle",
  heart: "Heart",
  orientation: "Orientation",
  fixed: "Fixed",
  parallel: "Parallel",
  perpendicular: "Perpendicular",
  radiusAxisPosition: "Position",
  ticks: "Ticks",
  gridLines: "Grid Lines",
  width: "Width",
  height: "Height",
  length: "Length",
  padding: "Padding",
  spacing: "Spacing",
  chartStyle: "Chart Style",
  title: "Title",
  chartTitles: "Titles",
  chartTitle: "Chart Title",
  chartSubtitle: "Subtitle",
  horizontalAxisTitle: "Horizontal Axis Title",
  verticalAxisTitle: "Vertical Axis Title",
  polarAxisTitle: "Polar Axis Title",
  titlePlaceholder: "Chart Title",
  background: "Background",
  font: "Font",
  weight: "Weight",
  top: "Top",
  right: "Right",
  bottom: "Bottom",
  left: "Left",
  labels: "Labels",
  calloutLabels: "Callout Labels",
  sectorLabels: "Sector Labels",
  positionRatio: "Position Ratio",
  size: "Size",
  shape: "Shape",
  minSize: "Minimum Size",
  maxSize: "Maximum Size",
  legend: "Legend",
  position: "Position",
  markerSize: "Marker Size",
  markerStroke: "Marker Stroke",
  markerPadding: "Marker Padding",
  itemSpacing: "Item Spacing",
  itemPaddingX: "Item Padding X",
  itemPaddingY: "Item Padding Y",
  layoutHorizontalSpacing: "Horizontal Spacing",
  layoutVerticalSpacing: "Vertical Spacing",
  strokeWidth: "Stroke Width",
  offset: "Offset",
  offsets: "Offsets",
  tooltips: "Tooltips",
  callout: "Callout",
  markers: "Markers",
  shadow: "Shadow",
  blur: "Blur",
  xOffset: "X Offset",
  yOffset: "Y Offset",
  lineWidth: "Line Width",
  lineDash: "Line Dash",
  lineDashOffset: "Dash Offset",
  scrollingZoom: "Scrolling",
  scrollingStep: "Scrolling Step",
  selectingZoom: "Selecting",
  durationMillis: "Duration (ms)",
  crosshairLabel: "Label",
  crosshairSnap: "Snap to Node",
  normal: "Normal",
  bold: "Bold",
  italic: "Italic",
  boldItalic: "Bold Italic",
  predefined: "Predefined",
  fillOpacity: "Fill Opacity",
  strokeColor: "Line Color",
  strokeOpacity: "Line Opacity",
  miniChart: "Mini-Chart",
  histogramBinCount: "Bin count",
  connectorLine: "Connector Line",
  seriesItems: "Series Items",
  seriesItemType: "Item Type",
  seriesItemPositive: "Positive",
  seriesItemNegative: "Negative",
  seriesItemLabels: "Item Labels",
  columnGroup: "Column",
  barGroup: "Bar",
  pieGroup: "Pie",
  lineGroup: "Line",
  scatterGroup: "X Y (Scatter)",
  areaGroup: "Area",
  polarGroup: "Polar",
  statisticalGroup: "Statistical",
  hierarchicalGroup: "Hierarchical",
  specializedGroup: "Specialized",
  combinationGroup: "Combination",
  groupedColumnTooltip: "Grouped",
  stackedColumnTooltip: "Stacked",
  normalizedColumnTooltip: "100% Stacked",
  groupedBarTooltip: "Grouped",
  stackedBarTooltip: "Stacked",
  normalizedBarTooltip: "100% Stacked",
  pieTooltip: "Pie",
  donutTooltip: "Donut",
  lineTooltip: "Line",
  stackedLineTooltip: "Stacked",
  normalizedLineTooltip: "100% Stacked",
  groupedAreaTooltip: "Area",
  stackedAreaTooltip: "Stacked",
  normalizedAreaTooltip: "100% Stacked",
  scatterTooltip: "Scatter",
  bubbleTooltip: "Bubble",
  histogramTooltip: "Histogram",
  radialColumnTooltip: "Radial Column",
  radialBarTooltip: "Radial Bar",
  radarLineTooltip: "Radar Line",
  radarAreaTooltip: "Radar Area",
  nightingaleTooltip: "Nightingale",
  rangeBarTooltip: "Range Bar",
  rangeAreaTooltip: "Range Area",
  boxPlotTooltip: "Box Plot",
  treemapTooltip: "Treemap",
  sunburstTooltip: "Sunburst",
  waterfallTooltip: "Waterfall",
  heatmapTooltip: "Heatmap",
  columnLineComboTooltip: "Column & Line",
  areaColumnComboTooltip: "Area & Column",
  customComboTooltip: "Custom Combination",
  innerRadius: "Inner Radius",
  startAngle: "Start Angle",
  endAngle: "End Angle",
  reverseDirection: "Reverse Direction",
  groupPadding: "Group Padding",
  seriesPadding: "Series Padding",
  tile: "Tile",
  whisker: "Whisker",
  cap: "Cap",
  capLengthRatio: "Length Ratio",
  labelPlacement: "Placement",
  inside: "Inside",
  outside: "Outside",
  noDataToChart: "No data available to be charted.",
  pivotChartRequiresPivotMode: "Pivot Chart requires Pivot Mode enabled.",
  chartSettingsToolbarTooltip: "Menu",
  chartLinkToolbarTooltip: "Linked to Grid",
  chartUnlinkToolbarTooltip: "Unlinked from Grid",
  chartDownloadToolbarTooltip: "Download Chart",
  chartMenuToolbarTooltip: "Menu",
  chartEdit: "Edit Chart",
  chartAdvancedSettings: "Advanced Settings",
  chartLink: "Link to Grid",
  chartUnlink: "Unlink from Grid",
  chartDownload: "Download Chart",
  histogramFrequency: "Frequency",
  seriesChartType: "Series Chart Type",
  seriesType: "Series Type",
  secondaryAxis: "Secondary Axis",
  seriesAdd: "Add a series",
  categoryAdd: "Add a category",
  bar: "Bar",
  column: "Column",
  histogram: "Histogram",
  advancedSettings: "Advanced Settings",
  direction: "Direction",
  horizontal: "Horizontal",
  vertical: "Vertical",
  seriesGroupType: "Group Type",
  groupedSeriesGroupType: "Grouped",
  stackedSeriesGroupType: "Stacked",
  normalizedSeriesGroupType: "100% Stacked",
  legendEnabled: "Enabled",
  invalidColor: "Color value is invalid",
  groupedColumnFull: "Grouped Column",
  stackedColumnFull: "Stacked Column",
  normalizedColumnFull: "100% Stacked Column",
  groupedBarFull: "Grouped Bar",
  stackedBarFull: "Stacked Bar",
  normalizedBarFull: "100% Stacked Bar",
  stackedAreaFull: "Stacked Area",
  normalizedAreaFull: "100% Stacked Area",
  stackedLineFull: "Stacked Line",
  normalizedLineFull: "100% Stacked Line",
  customCombo: "Custom Combination",
  funnel: "Funnel",
  coneFunnel: "Cone Funnel",
  pyramid: "Pyramid",
  funnelGroup: "Funnel",
  funnelTooltip: "Funnel",
  coneFunnelTooltip: "Cone Funnel",
  pyramidTooltip: "Pyramid",
  dropOff: "Drop-Off",
  stageLabels: "Stage Labels",
  reverse: "Reverse",
  tooltipMode: "Tooltip Mode",
  tooltipModeSingle: "Single",
  tooltipModeShared: "Multiple",
  tooltipModeCompact: "Compact",
  // menu items
  groupedColumn: "Grouped",
  stackedColumn: "Stacked",
  pie: "Pie",
  donut: "Donut",
  line: "Line",
  scatter: "Scatter",
  bubble: "Bubble",
  area: "Area",
  stackedArea: "Stacked",
  radarLine: "Radar Line",
  radarArea: "Radar Area",
  nightingale: "Nightingale",
  radialColumn: "Radial Column",
  radialBar: "Radial Bar",
  boxPlot: "Box Plot",
  rangeBar: "Range Bar",
  rangeArea: "Range Area",
  treemap: "Treemap",
  sunburst: "Sunburst",
  waterfall: "Waterfall",
  heatmap: "Heatmap",
  columnLineCombo: "Column & Line",
  AreaColumnCombo: "Area & Column",
  // aria
  ariaChartMenuClose: "Close Chart Edit Menu",
  ariaChartSelected: "Selected",
  // group
  group: "Group",
  // time formats
  timeFormatSlashesDDMMYYYY: "DD/MM/YYYY",
  timeFormatSlashesMMDDYYYY: "MM/DD/YYYY",
  timeFormatSlashesDDMMYY: "DD/MM/YY",
  timeFormatSlashesMMDDYY: "MM/DD/YY",
  timeFormatDotsDDMYY: "DD.M.YY",
  timeFormatDotsMDDYY: "M.DD.YY",
  timeFormatDashesYYYYMMDD: "YYYY-MM-DD",
  timeFormatSpacesDDMMMMYYYY: "DD MMMM YYYY",
  timeFormatHHMMSS: "HH:MM:SS",
  timeFormatHHMMSSAmPm: "HH:MM:SS AM/PM",
  // agg funcs
  sum: "Sum",
  first: "First",
  last: "Last",
  min: "Min",
  max: "Max",
  count: "Count",
  avg: "Average"
}, lU = class extends R {
  constructor() {
    super(...arguments), this.beanName = "chartTranslation";
  }
  translate(e) {
    const t = this.getLocaleTextFunc(), s = aU[e];
    return t(e, s);
  }
}, xr = (e) => (t) => t == null ? !0 : e(t), dg = (e) => typeof e == "string", Rv = (e) => typeof e == "boolean", cU = (e) => typeof e == "object", bs = (e, t) => (s) => `AG Grid - unable to update chart as invalid params supplied:  \`${e}: ${s}\`, expected ${t}.`, Pv = (e) => `${e} is not supported in AG Charts Community ('ag-charts-enterprise' hasn't been loaded). See https://www.ag-grid.com/javascript-data-grid/integrated-charts-installation/ for more details.`, dU = ["doughnut"], eh = [
  "type",
  "chartId",
  "chartType",
  "chartThemeName",
  "chartThemeOverrides",
  "unlinkChart"
];
function hU(e) {
  return !!mv(e) || Xd(e);
}
function uU(e) {
  return dU.includes(e);
}
var gU = xr(
  (e) => {
    if (hU(e))
      return !0;
    if (uU(e)) {
      const t = pn(e);
      return Zt(`The chart type '${e}' has been deprecated. Please use '${t}' instead.`), t;
    }
    return !1;
  }
), pU = xr((e) => typeof e == "object"), fU = xr((e) => typeof e == "object"), mU = xr((e) => typeof e == "string" || typeof e == "function"), Ev = (e) => ({
  property: "chartType",
  validationFn: xr(
    (t) => e || !t || !r_(t)
  ),
  warnMessage: (t) => Pv(`The '${t}' chart type`)
}), Tv = (e) => ({
  property: "switchCategorySeries",
  validationFn: xr((t) => {
    if (!t || e)
      return !0;
  }),
  warnMessage: () => Pv("'switchCategorySeries' has been ignored as it"),
  warnIfFixed: !0
}), th = () => [
  { property: "chartId", validationFn: dg, warnMessage: bs("chartId", "string") },
  {
    property: "chartType",
    validationFn: gU,
    warnMessage: bs("chartType", "ChartType")
  },
  {
    property: "chartThemeName",
    validationFn: dg,
    warnMessage: bs("chartThemeName", "string")
  },
  {
    property: "chartThemeOverrides",
    validationFn: pU,
    warnMessage: bs("chartThemeOverrides", "AgChartThemeOverrides")
  },
  { property: "unlinkChart", validationFn: Rv, warnMessage: bs("unlinkChart", "boolean") }
], Mv = (e) => [
  {
    property: "cellRange",
    validationFn: fU,
    warnMessage: bs("cellRange", "ChartParamsCellRange")
  },
  {
    property: "suppressChartRanges",
    validationFn: Rv,
    warnMessage: bs("suppressChartRanges", "boolean")
  },
  {
    property: "aggFunc",
    validationFn: mU,
    warnMessage: bs("aggFunc", "string or IAggFunc")
  },
  Tv(e)
];
function CU(e, t) {
  switch (e.type) {
    case "rangeChartUpdate":
      return wU(e, t);
    case "pivotChartUpdate":
      return bU(e);
    case "crossFilterChartUpdate":
      return yU(e, t);
    default:
      return Zt(
        `Invalid value supplied for 'type': ${e.type}. It must be either 'rangeChartUpdate', 'pivotChartUpdate', or 'crossFilterChartUpdate'.`
      ), !1;
  }
}
function vU(e, t) {
  return Oa(e, [
    Ev(t),
    Tv(t)
  ]);
}
function wU(e, t) {
  const s = [
    ...th(),
    Ev(t),
    ...Mv(t),
    {
      property: "seriesChartTypes",
      validationFn: (i) => i === void 0 || Array.isArray(i) && i.every(cU),
      warnMessage: bs("seriesChartTypes", "Array of SeriesChartType")
    }
  ];
  return Oa(
    e,
    s,
    [
      ...eh,
      "cellRange",
      "suppressChartRanges",
      "switchCategorySeries",
      "aggFunc",
      "seriesChartTypes",
      "seriesGroupType"
    ],
    "UpdateRangeChartParams"
  );
}
function bU(e) {
  const t = [...th()];
  return Oa(e, t, [...eh], "UpdatePivotChartParams");
}
function yU(e, t) {
  const s = [
    ...th(),
    ...Mv(t)
  ];
  return Oa(
    e,
    s,
    [...eh, "cellRange", "suppressChartRanges", "aggFunc"],
    "UpdateCrossFilterChartParams"
  );
}
function Oa(e, t, s, i) {
  let r;
  for (const n of t) {
    const { property: o, validationFn: a, warnMessage: l, warnIfFixed: c } = n;
    if (o in e) {
      const d = e[o], h = a(d);
      if (h === !0)
        continue;
      if (h === !1)
        return Zt(l(d)), !1;
      r = r || { ...e }, r[o] = h, c && Zt(l(d));
    }
  }
  if (s) {
    for (const n of Object.keys(e))
      if (!s.includes(n))
        return Zt(`Unexpected property supplied. ${i} does not contain: \`${n}\`.`), !1;
  }
  return r || !0;
}
var Dv = ["ag-default", "ag-material", "ag-sheets", "ag-polychroma", "ag-vivid"], SU = class extends R {
  constructor(e) {
    super(), this.model = e, this.isEnterprise = () => this.agChartsExports.isEnterprise;
  }
  wireBeans(e) {
    this.rangeSvc = e.rangeSvc, this.agChartsExports = e.agChartsExports;
  }
  postConstruct() {
    this.setChartRange(), this.model.unlinked && this.rangeSvc && this.rangeSvc.setCellRanges([]);
    const e = this.updateForGridChange.bind(this, {});
    this.addManagedEventListeners({
      cellSelectionChanged: (t) => {
        t.id && t.id === this.model.chartId && this.updateForRangeChange();
      },
      columnMoved: e,
      columnPinned: e,
      columnVisible: e,
      columnRowGroupChanged: e,
      modelUpdated: e,
      cellValueChanged: this.updateForDataChange.bind(this),
      cellEditValuesChanged: this.updateForDataChange.bind(this)
    });
  }
  update(e) {
    if (!this.validUpdateType(e))
      return !1;
    const t = CU(e, this.agChartsExports.isEnterprise);
    if (!t)
      return !1;
    const s = t === !0 ? e : t;
    return this.applyValidatedChartParams(s), !0;
  }
  applyValidatedChartParams(e) {
    var l;
    const { chartId: t, chartType: s, chartThemeName: i, unlinkChart: r } = e, o = { ...{
      chartId: t,
      pivotChart: this.model.pivotChart,
      chartType: s ?? this.model.chartType,
      chartThemeName: i ?? this.model.chartThemeName,
      unlinkChart: r ?? this.model.unlinked,
      cellRange: this.model.suppliedCellRange,
      switchCategorySeries: this.model.switchCategorySeries,
      aggFunc: this.model.aggFunc,
      seriesChartTypes: void 0,
      suppressChartRanges: !1,
      crossFiltering: !1
    } };
    switch (e.type) {
      case "rangeChartUpdate":
        o.cellRange = this.createCellRange(e) ?? this.model.suppliedCellRange, o.switchCategorySeries = e.switchCategorySeries ?? this.model.switchCategorySeries, o.aggFunc = e.aggFunc ?? this.model.aggFunc, o.seriesChartTypes = e.seriesChartTypes, o.suppressChartRanges = e.suppressChartRanges ?? this.model.suppressChartRanges, o.seriesGroupType = e.seriesGroupType ?? this.model.seriesGroupType;
        break;
      case "crossFilterChartUpdate":
        o.cellRange = this.createCellRange(e) ?? this.model.suppliedCellRange, o.switchCategorySeries = !1, o.aggFunc = e.aggFunc ?? this.model.aggFunc, o.crossFiltering = !0, o.crossFilteringSort = this.model.crossFilteringSort, o.suppressChartRanges = e.suppressChartRanges ?? this.model.suppressChartRanges;
        break;
      case "pivotChartUpdate":
        o.switchCategorySeries = !1;
        break;
    }
    this.model.updateModel(o), o.unlinkChart || o.suppressChartRanges ? (l = this.rangeSvc) == null || l.setCellRanges([]) : this.setChartRange();
  }
  updateForGridChange(e) {
    if (this.model.unlinked)
      return;
    const { maintainColState: t, setColsFromRange: s } = e ?? {};
    this.model.updateCellRanges({ maintainColState: t, setColsFromRange: s }), this.model.updateData(), this.setChartRange();
  }
  updateForDataChange() {
    this.model.unlinked || (this.model.updateData(), this.raiseChartModelUpdateEvent());
  }
  updateForRangeChange() {
    this.updateForGridChange({ setColsFromRange: !0 }), this.raiseChartRangeSelectionChangedEvent();
  }
  updateForPanelChange(e) {
    this.model.updateCellRanges(e), this.model.updateData(), e.skipAnimation && this.getChartProxy().getChartRef().skipAnimations(), this.setChartRange(), this.raiseChartRangeSelectionChangedEvent();
  }
  updateThemeOverrides(e) {
    this.chartProxy.updateThemeOverrides(e);
  }
  getChartUpdateParams(e) {
    const s = this.getSelectedValueColState().map((a) => ({ colId: a.colId, displayName: a.displayName })), i = this.getChartData(), r = this.getSelectedDimensions(), n = this.model, o = {
      data: i,
      groupData: n.groupChartData,
      grouping: this.isGrouping(),
      categories: r.map(({ colId: a, displayName: l }) => {
        const c = n.categoryAxisType ?? n.getChartDataType(a);
        return {
          id: a,
          name: l,
          chartDataType: c,
          convertTime: c === "time" ? n.getConvertTime(a) : void 0
        };
      }),
      fields: s,
      chartId: this.getChartId(),
      getCrossFilteringContext: () => ({ lastSelectedChartId: "xxx" }),
      //this.params.crossFilteringContext, //TODO
      seriesChartTypes: this.getSeriesChartTypes(),
      updatedOverrides: e,
      seriesGroupType: n.seriesGroupType
    };
    return this.isCategorySeriesSwitched() ? this.invertCategorySeriesParams(o) : o;
  }
  invertCategorySeriesParams(e) {
    const [t] = e.categories, s = [{ id: ns, name: "" }], i = e.data.map((n, o) => {
      const a = `${t.id}:${o}`, l = n[t.id], c = l == null ? "" : String(l);
      return { colId: a, displayName: c };
    }), r = e.fields.map((n) => {
      const o = {
        [ns]: n.displayName
      };
      for (const [a, l] of e.data.entries()) {
        const c = `${t.id}:${a}`, d = l[n.colId];
        o[c] = d;
      }
      return o;
    });
    return {
      ...e,
      categories: s,
      fields: i,
      data: r
    };
  }
  getChartModel() {
    var s, i;
    const e = this.model.pivotChart ? "pivot" : "range", t = this.isComboChart() ? this.model.comboChartModel.seriesChartTypes : void 0;
    return {
      modelType: e,
      chartId: this.model.chartId,
      chartType: this.model.chartType,
      chartThemeName: this.getChartThemeName(),
      chartOptions: (s = this.chartProxy) == null ? void 0 : s.getChartThemeOverrides(),
      chartPalette: (i = this.chartProxy) == null ? void 0 : i.getChartPalette(),
      cellRange: this.getCellRangeParams(),
      switchCategorySeries: this.model.switchCategorySeries,
      suppressChartRanges: this.model.suppressChartRanges,
      aggFunc: this.model.aggFunc,
      unlinkChart: this.model.unlinked,
      seriesChartTypes: t,
      seriesGroupType: this.model.seriesGroupType
    };
  }
  getChartId() {
    return this.model.chartId;
  }
  getChartData() {
    return this.model.chartData;
  }
  getChartType() {
    return this.model.chartType;
  }
  setChartType(e) {
    this.updateMultiSeriesAndCategory(this.model.chartType, e), this.model.chartType = e, this.model.comboChartModel.updateSeriesChartTypes(), this.model.switchCategorySeries = !1, this.model.categoryAxisType = void 0, this.model.seriesGroupType = void 0, this.raiseChartModelUpdateEvent();
  }
  isCategorySeriesSwitched() {
    return this.model.switchCategorySeries && !this.model.isGrouping();
  }
  switchCategorySeries(e) {
    vv(this.getChartType()) && (this.model.switchCategorySeries = e, this.raiseChartModelUpdateEvent());
  }
  getAggFunc() {
    return this.model.aggFunc;
  }
  setAggFunc(e, t) {
    this.model.aggFunc !== e && (this.model.aggFunc = e, !t && (this.model.updateData(), this.raiseChartModelUpdateEvent()));
  }
  updateMultiSeriesAndCategory(e, t) {
    const s = (a, l) => {
      let c = 0;
      for (const d of a)
        d.selected && (c >= l ? d.selected = !1 : c++);
      c === 0 && (a[0].selected = !0);
    }, i = Mc(t), r = qo(t), n = i != null && (Mc(e) ?? 100) > (i ?? 100), o = r != null && (qo(e) ?? 100) > (r ?? 100);
    n && s(this.model.dimensionColState, i), o && s(this.model.valueColState, r), (n || o) && (this.model.resetCellRanges(n, o), this.setChartRange(!0));
  }
  setChartThemeName(e, t) {
    this.model.chartThemeName = e, t || this.raiseChartModelUpdateEvent();
  }
  getChartThemeName() {
    return this.model.chartThemeName;
  }
  isPivotChart() {
    return this.model.pivotChart;
  }
  isPivotMode() {
    return this.model.isPivotMode();
  }
  isGrouping() {
    return this.model.isGrouping();
  }
  isCrossFilterChart() {
    return this.model.crossFiltering;
  }
  getThemeNames() {
    return this.gos.get("chartThemes") || Dv;
  }
  getThemes() {
    return this.getThemeNames().map((t) => {
      const i = Qd(t, this.agChartsExports._Theme) ? t : this.chartProxy.lookupCustomChartTheme(t);
      return this.agChartsExports._Theme.getChartTheme(i);
    });
  }
  getPalettes() {
    return this.getThemes().map((t) => t.palette);
  }
  getValueColState() {
    return this.model.valueColState.map(this.displayNameMapper.bind(this));
  }
  getSelectedValueColState() {
    return this.getValueColState().filter((e) => e.selected);
  }
  getSelectedDimensions() {
    return this.model.getSelectedDimensions();
  }
  displayNameMapper(e) {
    const { column: t } = e;
    if (t)
      e.displayName = this.model.getColDisplayName(t, this.model.isPivotMode());
    else {
      const s = this.model.colNames[e.colId];
      e.displayName = s ? s.join(" - ") : this.model.getColDisplayName(t);
    }
    return e;
  }
  getColStateForMenu() {
    return { dimensionCols: this.model.dimensionColState, valueCols: this.getValueColState() };
  }
  setChartRange(e = !1) {
    this.rangeSvc && !this.model.suppressChartRanges && !this.model.unlinked && this.rangeSvc.setCellRanges(this.getCellRanges()), e || this.raiseChartModelUpdateEvent();
  }
  detachChartRange() {
    this.model.unlinked = !this.model.unlinked, this.model.unlinked ? this.rangeSvc && this.rangeSvc.setCellRanges([]) : this.updateForGridChange(), this.dispatchLocalEvent({ type: "chartLinkedChanged" });
  }
  setChartProxy(e) {
    this.chartProxy = e;
  }
  getChartProxy() {
    return this.chartProxy;
  }
  isActiveXYChart() {
    return ["scatter", "bubble"].includes(this.getChartType());
  }
  isChartLinked() {
    return !this.model.unlinked;
  }
  customComboExists() {
    const e = this.model.comboChartModel.savedCustomSeriesChartTypes;
    return e && e.length > 0;
  }
  getSeriesChartTypes() {
    return this.model.comboChartModel.seriesChartTypes;
  }
  isComboChart(e) {
    return this.model.isComboChart(e);
  }
  updateSeriesChartType(e, t, s) {
    const i = this.model.comboChartModel.seriesChartTypes.find((r) => r.colId === e);
    if (i) {
      const r = this.model.chartType !== "customCombo";
      r && (this.model.chartType = "customCombo");
      const n = i.chartType;
      t != null && (i.chartType = t), s != null && (i.secondaryAxis = s), this.model.comboChartModel.savedCustomSeriesChartTypes = this.model.comboChartModel.seriesChartTypes, this.model.comboChartModel.updateSeriesChartTypes(), this.updateForDataChange(), r && this.dispatchLocalEvent({
        type: "chartTypeChanged"
      }), n !== t && this.dispatchLocalEvent({
        type: "chartSeriesChartTypeChanged"
      }), this.raiseChartOptionsChangedEvent();
    }
  }
  getActiveSeriesChartTypes() {
    const e = this.getSelectedValueColState().map((t) => t.colId);
    return this.getSeriesChartTypes().filter((t) => e.includes(t.colId));
  }
  getChartSeriesTypes(e) {
    const t = e ?? this.getChartType();
    return this.isComboChart(t) ? ["line", "bar", "area"] : [de(t)];
  }
  getChartSeriesType() {
    const e = this.getSeriesChartTypes();
    if (e.length === 0)
      return "bar";
    const t = e[0].chartType;
    return t === "columnLineCombo" ? "bar" : t === "areaColumnCombo" ? "area" : de(t);
  }
  getCellRanges() {
    return [this.model.dimensionCellRange, this.model.valueCellRange].filter((e) => e);
  }
  createCellRange(e) {
    var t;
    return e.cellRange && ((t = this.rangeSvc) == null ? void 0 : t.createPartialCellRangeFromRangeParams(e.cellRange, !0));
  }
  validUpdateType(e) {
    if (!e.type)
      return F(136), !1;
    const t = {
      "Range Chart": () => !this.isPivotChart() && !this.isCrossFilterChart(),
      "Pivot Chart": () => this.isPivotChart(),
      "Cross Filter Chart": () => this.isCrossFilterChart()
    }, s = Object.keys(t).find((r) => t[r]()) ?? "Range Chart", i = e.type === `${s[0].toLowerCase()}${s.slice(1).replace(/ /g, "")}Update`;
    return i || F(137, { currentChartType: s, type: e.type }), i;
  }
  getCellRangeParams() {
    const e = this.getCellRanges(), t = e[0], s = t && t.startRow || null, i = t && t.endRow || null;
    return {
      rowStartIndex: s && s.rowIndex,
      rowStartPinned: s && s.rowPinned,
      rowEndIndex: i && i.rowIndex,
      rowEndPinned: i && i.rowPinned,
      columns: e.reduce(
        (r, n) => r.concat(n.columns.map((o) => o.getId())),
        []
      )
    };
  }
  setCategoryAxisType(e) {
    this.model.categoryAxisType = e, this.raiseChartModelUpdateEvent();
  }
  getSeriesGroupType() {
    return this.model.seriesGroupType ?? this.chartProxy.getSeriesGroupType();
  }
  setSeriesGroupType(e) {
    this.model.seriesGroupType = e, this.raiseChartModelUpdateEvent();
  }
  raiseChartModelUpdateEvent() {
    this.dispatchLocalEvent({ type: "chartModelUpdate" }), this.raiseChartOptionsChangedEvent();
  }
  raiseChartUpdatedEvent() {
    this.dispatchLocalEvent({ type: "chartUpdated" });
  }
  raiseChartApiUpdateEvent() {
    this.dispatchLocalEvent({ type: "chartApiUpdate" });
  }
  raiseChartOptionsChangedEvent() {
    var s;
    const { chartId: e, chartType: t } = this.getChartModel();
    this.eventSvc.dispatchEvent({
      type: "chartOptionsChanged",
      chartId: e,
      chartType: t,
      chartThemeName: this.getChartThemeName(),
      chartOptions: (s = this.chartProxy) == null ? void 0 : s.getChartThemeOverrides()
    });
  }
  raiseChartRangeSelectionChangedEvent() {
    this.eventSvc.dispatchEvent({
      type: "chartRangeSelectionChanged",
      id: this.model.chartId,
      chartId: this.model.chartId,
      cellRange: this.getCellRangeParams()
    });
  }
  destroy() {
    super.destroy(), this.rangeSvc && this.rangeSvc.setCellRanges([]);
  }
}, xU = class extends ni {
  getAxes(e) {
    const t = [
      {
        type: this.getXAxisType(e),
        position: "bottom"
      },
      {
        type: "number",
        position: "left"
      }
    ];
    if (this.isNormalised()) {
      const s = t[1];
      s.label = { ...s.label, formatter: (i) => Math.round(i.value) + "%" };
    }
    return t;
  }
  getSeries(e) {
    const [t] = e.categories, s = e.fields.map(
      (i) => ({
        type: this.standaloneChartType,
        xKey: t.id,
        xName: t.name,
        yKey: i.colId,
        yName: i.displayName,
        normalizedTo: this.chartType === "normalizedArea" ? 100 : void 0,
        stacked: ["normalizedArea", "stackedArea"].includes(this.chartType)
      })
    );
    return this.crossFiltering ? this.extractLineAreaCrossFilterSeries(s, e) : s;
  }
  isNormalised() {
    return !this.crossFiltering && this.chartType === "normalizedArea";
  }
}, FU = /* @__PURE__ */ new Set(["bar", "groupedBar", "stackedBar", "normalizedBar"]), RU = class extends ni {
  getAxes(e) {
    const t = [
      {
        type: this.getXAxisType(e),
        position: this.isHorizontal() ? "left" : "bottom"
      },
      {
        type: "number",
        position: this.isHorizontal() ? "bottom" : "left"
      }
    ];
    if (this.isNormalised()) {
      const s = t[1];
      s.label = { ...s.label, formatter: (i) => Math.round(i.value) + "%" };
    }
    return t;
  }
  getSeries(e) {
    const [t] = e.categories, s = e.fields.map(
      (i) => ({
        type: this.standaloneChartType,
        direction: this.isHorizontal() ? "horizontal" : "vertical",
        stacked: this.crossFiltering || o_(this.chartType),
        normalizedTo: this.isNormalised() ? 100 : void 0,
        xKey: t.id,
        xName: t.name,
        yKey: i.colId,
        yName: i.displayName
      })
    );
    return this.crossFiltering ? this.extractCrossFilterSeries(s) : s;
  }
  extractCrossFilterSeries(e) {
    const t = [];
    for (let s = 0; s < e.length; s++) {
      const r = {
        ...e[s],
        listeners: {
          seriesNodeClick: this.crossFilterCallback
        }
      }, n = {
        ...r,
        yKey: `${r.yKey}-filtered-out`,
        showInLegend: !1
      };
      t.push(r), t.push(n);
    }
    return t;
  }
  isNormalised() {
    const e = ["normalizedColumn", "normalizedBar"];
    return !this.crossFiltering && e.includes(this.chartType);
  }
  isHorizontal() {
    return FU.has(this.chartType);
  }
}, PU = class extends ni {
  getAxes(e) {
    const t = [
      {
        type: this.getXAxisType(e),
        position: "bottom"
      },
      {
        type: "number",
        position: "left"
      }
    ];
    if (this.isNormalised()) {
      const s = t[1];
      s.label = { ...s.label, formatter: (i) => Math.round(i.value) + "%" };
    }
    return t;
  }
  getSeries(e) {
    const [t] = e.categories, s = ["normalizedLine", "stackedLine"].includes(this.chartType), i = e.fields.map(
      (r) => ({
        type: this.standaloneChartType,
        xKey: t.id,
        xName: t.name,
        yKey: r.colId,
        yName: r.displayName,
        normalizedTo: s && this.isNormalised() ? 100 : void 0,
        stacked: s
      })
    );
    return this.crossFiltering ? this.extractLineAreaCrossFilterSeries(i, e) : i;
  }
  isNormalised() {
    const e = ["normalizedLine"];
    return !this.crossFiltering && e.includes(this.chartType);
  }
}, EU = class extends ni {
  getAxes(e) {
    return [
      {
        type: "number",
        position: "bottom"
      },
      {
        type: "number",
        position: "left"
      }
    ];
  }
  getSeries(e) {
    const [t] = e.categories, s = this.isPaired(), i = this.getSeriesDefinitions(e.fields, s), r = t.id === ns ? void 0 : t, n = i.map((o) => o != null && o.sizeField ? {
      type: "bubble",
      xKey: o.xField.colId,
      xName: o.xField.displayName ?? void 0,
      yKey: o.yField.colId,
      yName: o.yField.displayName ?? void 0,
      title: `${o.yField.displayName} vs ${o.xField.displayName}`,
      sizeKey: o.sizeField.colId,
      sizeName: o.sizeField.displayName ?? "",
      labelKey: r ? r.id : o.yField.colId,
      labelName: r ? r.name : void 0
    } : {
      type: "scatter",
      xKey: o.xField.colId,
      xName: o.xField.displayName ?? void 0,
      yKey: o.yField.colId,
      yName: o.yField.displayName ?? void 0,
      title: `${o.yField.displayName} vs ${o.xField.displayName}`,
      labelKey: r ? r.id : o.yField.colId,
      labelName: r ? r.name : void 0
    });
    return this.crossFiltering ? this.extractCrossFilterSeries(n, e) : n;
  }
  extractCrossFilterSeries(e, t) {
    const { data: s } = t, i = (l) => `${l}-filtered-out`, r = (l, c) => {
      const d = [1 / 0, -1 / 0];
      if (c != null)
        for (const h of l) {
          const u = h[c] ?? h[i(c)];
          u < d[0] && (d[0] = u), u > d[1] && (d[1] = u);
        }
      if (d[0] <= d[1])
        return d;
    }, n = (l) => {
      let c;
      if (l.type === "bubble") {
        const { sizeKey: d } = l;
        c = r(s, d);
      }
      return {
        ...l,
        domain: c,
        highlight: { highlightedItem: { fill: "yellow" } },
        listeners: {
          ...l.listeners,
          seriesNodeClick: this.crossFilterCallback
        }
      };
    }, o = (l) => {
      const { yKey: c, xKey: d } = l;
      let h = {};
      return l.type === "bubble" && (h = { sizeKey: i(l.sizeKey) }), {
        ...l,
        ...h,
        yKey: i(c),
        xKey: i(d),
        showInLegend: !1,
        listeners: {
          ...l.listeners,
          seriesNodeClick: (u) => {
            const g = u.datum[i(d)], p = {
              ...u,
              xKey: d,
              datum: { ...u.datum, [d]: g }
            };
            this.crossFilterCallback(p);
          }
        }
      };
    }, a = e.map(n);
    return [...a, ...a.map(o)];
  }
  getSeriesDefinitions(e, t) {
    if (e.length < 2)
      return [];
    const s = this.chartType === "bubble";
    if (t)
      return s ? e.map(
        (r, n) => n % 3 === 0 ? {
          xField: r,
          yField: e[n + 1],
          sizeField: e[n + 2]
        } : null
      ).filter((r) => r && r.yField && r.sizeField) : e.map(
        (r, n) => n % 2 === 0 ? {
          xField: r,
          yField: e[n + 1]
        } : null
      ).filter((r) => r && r.yField);
    const i = e[0];
    return s ? e.map(
      (r, n) => n % 2 === 1 ? {
        xField: i,
        yField: r,
        sizeField: e[n + 1]
      } : null
    ).filter((r) => r && r.sizeField) : e.filter((r, n) => n > 0).map((r) => ({ xField: i, yField: r }));
  }
}, TU = class extends ni {
  getAxes(e) {
    const t = e ? e.fields : [], s = new Map(t.map((o) => [o.colId, o])), { primaryYKeys: i, secondaryYKeys: r } = this.getYKeys(t, e.seriesChartTypes), n = [
      {
        type: this.getXAxisType(e),
        position: "bottom"
      }
    ];
    return i.length > 0 && n.push({
      type: "number",
      keys: i,
      position: "left"
    }), r.length > 0 && r.forEach((o) => {
      const a = s.get(o);
      if (!(a && a.colId === o))
        return;
      const c = {
        type: "number",
        keys: [o],
        position: "right"
      };
      n.push(c);
    }), n;
  }
  getSeries(e) {
    const { fields: t, seriesChartTypes: s } = e, [i] = e.categories;
    return t.map((r) => {
      const n = s.find((o) => o.colId === r.colId);
      if (n) {
        const o = n.chartType, l = ["groupedColumn", "groupedBar"].includes(o) ? { grouped: !0 } : {};
        return {
          type: de(o),
          xKey: i.id,
          yKey: r.colId,
          yName: r.displayName,
          stacked: ["stackedArea", "stackedColumn"].includes(o),
          ...l
        };
      }
    });
  }
  getYKeys(e, t) {
    const s = [], i = [];
    return e.forEach((r) => {
      const n = r.colId, o = t.find((a) => a.colId === n);
      o && (o.secondaryAxis ? i.push(n) : s.push(n));
    }), { primaryYKeys: s, secondaryYKeys: i };
  }
};
function MU(e) {
  const t = e.currentOffset;
  e.currentOffset -= e.offsetAmount;
  const s = e.currentOffset;
  return e.currentOffset -= e.offsetAmount, { outerRadiusOffset: t, innerRadiusOffset: s };
}
var DU = class extends Sr {
  getUpdateOptions(e, t) {
    return {
      ...t,
      data: this.crossFiltering ? this.getCrossFilterData(e) : e.data,
      series: this.getSeries(e)
    };
  }
  getSeries(e) {
    const [t] = e.categories, s = e.fields.length, i = {
      currentOffset: 0,
      offsetAmount: s > 1 ? 20 : 40
    }, r = this.getFields(e).map(
      (n) => {
        const o = {
          type: this.standaloneChartType,
          angleKey: n.colId,
          angleName: n.displayName,
          sectorLabelKey: n.colId,
          calloutLabelName: t.name,
          calloutLabelKey: t.id
        };
        if (this.chartType === "donut" || this.chartType === "doughnut") {
          const { outerRadiusOffset: a, innerRadiusOffset: l } = MU(i), c = n.displayName ? {
            title: { text: n.displayName, showInLegend: s > 1 }
          } : void 0;
          return {
            ...o,
            type: "donut",
            outerRadiusOffset: a,
            innerRadiusOffset: l,
            ...c
          };
        }
        return o;
      }
    );
    return this.crossFiltering ? this.extractCrossFilterSeries(r) : r;
  }
  getCrossFilterData(e) {
    const t = e.fields[0].colId, s = `${t}-filtered-out`;
    return e.data.map((i) => {
      const r = i[t] + i[s];
      return i[`${t}-total`] = r, i[s] = 1, i[t] = i[t] / r, i;
    });
  }
  extractCrossFilterSeries(e) {
    const t = e[0], s = t.angleKey, i = {
      ...t,
      radiusMin: 0,
      radiusMax: 1,
      listeners: {
        seriesNodeClick: this.crossFilterCallback
      },
      legendItemKey: t.calloutLabelKey,
      angleKey: `${s}-total`
    }, r = {
      ...i,
      radiusKey: s,
      sectorLabelKey: `${s}-total`
    };
    return [{
      ...i,
      radiusKey: `${s}-filtered-out`,
      showInLegend: !1
    }, r];
  }
  getFields(e) {
    return this.chartType === "pie" ? e.fields.slice(0, 1) : e.fields;
  }
}, AU = class extends D {
  constructor() {
    super(
      /* html */
      '<div class="ag-chart-menu" data-ref="eMenu"></div>'
    ), this.eMenu = x, this.buttonListenersDestroyFuncs = [];
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  updateParams(e) {
    const { buttons: t } = e;
    this.createButtons(t);
  }
  createButtons(e) {
    this.buttonListenersDestroyFuncs.forEach((s) => s == null ? void 0 : s()), this.buttonListenersDestroyFuncs = [];
    const t = this.eMenu;
    X(t), e.forEach((s) => {
      const { buttonName: i, iconName: r, callback: n } = s, o = this.createButton(r), a = this.chartTranslation.translate(
        i + "ToolbarTooltip"
      );
      a && o instanceof HTMLElement && (o.title = a), this.buttonListenersDestroyFuncs.push(
        ...this.addManagedElementListeners(o, {
          click: (l) => n(l.currentTarget)
        })
      ), t.appendChild(o);
    });
  }
  createButton(e) {
    const t = N(e, this.beans);
    t.classList.add("ag-chart-menu-icon");
    const s = K({
      tag: "button",
      attrs: { type: "button" },
      cls: "ag-chart-menu-toolbar-button"
    });
    return s.appendChild(t), s;
  }
  destroy() {
    this.buttonListenersDestroyFuncs = [], super.destroy();
  }
}, IU = (
  /*css*/
  ".ag-pill-select{display:flex;flex-direction:column}:where(.ag-pill-select){.ag-column-drop-list{padding:0}.ag-select{padding-top:var(--ag-spacing)}.ag-picker-field-wrapper{background-color:transparent;border:0}.ag-picker-field-display{cursor:pointer;font-weight:500}.ag-picker-field-display,.ag-picker-field-icon{color:var(--ag-chart-menu-label-color)}}"
), LU = class extends D {
  constructor(e) {
    super(
      /* html */
      '<div class="ag-pill-select" role="presentation"></div>'
    ), this.config = e ?? {};
    const { selectedValueList: t, valueFormatter: s, valueList: i } = this.config;
    this.selectedValues = t ?? [], this.valueList = i ?? [], this.valueFormatter = s ?? ((r) => bt(r)), this.registerCSS(IU);
  }
  postConstruct() {
    const { ariaLabel: e, onValuesChange: t, dragSourceId: s } = this.config;
    this.dropZonePanel = this.createManagedBean(
      new GU(
        {
          getValues: () => this.selectedValues,
          setValues: (r) => this.updateValues(r),
          isDraggable: () => this.selectedValues.length > 1
        },
        (r) => this.valueFormatter(r),
        e,
        s
      )
    ), this.getGui().appendChild(this.dropZonePanel.getGui()), this.initSelect(), t != null && (this.onValuesChange = t);
  }
  setValues(e, t) {
    const { added: s, removed: i, updated: r } = this.getChanges(this.valueList, e);
    let n = !1;
    return (s.length || i.length || r.length) && (n = !0), this.valueList = e, this.updateValues(t, n, !0), this;
  }
  setValueFormatter(e) {
    return this.valueFormatter = e, this;
  }
  initSelect() {
    const e = this.createSelectOptions();
    if (!e.length)
      return !1;
    const { selectPlaceholder: t } = this.config;
    return this.eSelect = this.createBean(
      new st({
        options: e,
        placeholder: t,
        onValueChange: (s) => this.addValue(s),
        pickerIcon: "chartsMenuAdd"
      })
    ), this.getGui().appendChild(this.eSelect.getGui()), !0;
  }
  createSelectOptions() {
    const e = [], { maxSelection: t } = this.config;
    return t && this.selectedValues.length >= t || this.valueList.forEach((s) => {
      this.selectedValues.includes(s) || e.push({ value: s, text: this.valueFormatter(s) });
    }), e;
  }
  addValue(e) {
    this.dropZonePanel.addItem(e);
  }
  updateValues(e, t, s) {
    var d, h, u, g, p;
    const i = this.selectedValues;
    this.selectedValues = e;
    const r = this.getChanges(i, e), n = t || r.added.length || r.removed.length, o = Q(this.beans), a = (d = this.eSelect) == null ? void 0 : d.getGui().contains(o), l = (h = this.dropZonePanel) == null ? void 0 : h.getGui().contains(o);
    s || (u = this.onValuesChange) == null || u.call(this, r);
    const c = n ? !this.refreshSelect() : !1;
    this.dropZonePanel.refreshGui(), n && a && (c ? this.dropZonePanel.focusList(!0) : (g = this.eSelect) == null || g.getFocusableElement().focus()), l && !e.length && ((p = this.eSelect) == null || p.getFocusableElement().focus());
  }
  getChanges(e, t) {
    const s = t.filter((n) => !e.includes(n)), i = e.filter((n) => !t.includes(n)), r = t.filter((n, o) => e[o] !== n);
    return { added: s, removed: i, updated: r, selected: t };
  }
  refreshSelect() {
    if (!this.eSelect)
      return this.initSelect();
    const e = this.createSelectOptions();
    return e.length ? (this.eSelect.clearOptions().addOptions(e).setValue(void 0, !0), !0) : (se(this.eSelect.getGui()), this.eSelect = this.destroyBean(this.eSelect), !1);
  }
  destroy() {
    this.destroyBean(this.eSelect), super.destroy();
  }
}, kU = class extends GC {
  constructor(e, t, s, i, r, n) {
    super(t, s, !1), this.value = e, this.valueFormatter = i, this.draggable = r, this.sourceId = n;
  }
  getItem() {
    return this.value;
  }
  getDisplayName() {
    return this.valueFormatter(this.value);
  }
  getAriaDisplayName() {
    return this.getDisplayName();
  }
  getTooltip() {
  }
  createGetDragItem() {
    return () => ({
      value: this.value
    });
  }
  getDragSourceType() {
    return zt.ChartPanel;
  }
  getDragSourceId() {
    return this.sourceId;
  }
  isMovable() {
    return this.isDraggable();
  }
  isDraggable() {
    return this.draggable;
  }
}, GU = class extends kC {
  constructor(e, t, s, i) {
    super(!1), this.model = e, this.valueFormatter = t, this.ariaLabel = s, this.sourceId = i;
  }
  postConstruct() {
    super.init();
  }
  isItemDroppable(e, t) {
    return this.isSourceEventFromTarget(t) || this.sourceId != null && this.sourceId === t.dragSource.sourceId;
  }
  updateItems(e) {
    this.model.setValues(e);
  }
  getExistingItems() {
    return this.model.getValues();
  }
  getIconName() {
    return this.isPotentialDndItems() ? "move" : "notAllowed";
  }
  getAriaLabel() {
    return this.ariaLabel;
  }
  createPillComponent(e, t, s) {
    return new kU(
      e,
      t,
      s,
      this.valueFormatter,
      this.model.isDraggable(),
      this.sourceId
    );
  }
  getItems(e) {
    return [e.value];
  }
  isInterestedIn(e) {
    return e === zt.ChartPanel;
  }
}, Av = class extends D {
  constructor(e, t, s, i) {
    super(i), this.chartController = e, this.allowMultipleSelection = t, this.maxSelection = s;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  addItem(e) {
    this.groupComp.addItem(e);
  }
  createGroup(e, t, s, i, r) {
    if (this.allowMultipleSelection) {
      const n = e.filter((o) => o.selected);
      this.valuePillSelect = this.groupComp.createManagedBean(
        new LU({
          valueList: e,
          selectedValueList: n,
          valueFormatter: t,
          selectPlaceholder: this.chartTranslation.translate(s),
          dragSourceId: i,
          onValuesChange: (o) => this.onValueChange(o),
          maxSelection: this.maxSelection
        })
      ), this.groupComp.addItem(this.valuePillSelect);
    } else {
      const n = this.createValueSelectParams(e);
      n.onValueChange = (o) => {
        e.forEach((a) => {
          a.selected = !1;
        }), o.selected = !0, o.colId === ns && this.chartController.setAggFunc(void 0, !0), this.chartController.updateForPanelChange({ updatedColState: o, skipAnimation: r == null ? void 0 : r() });
      }, this.valueSelect = this.groupComp.createManagedBean(new st(n)), this.groupComp.addItem(this.valueSelect);
    }
  }
  refreshValueSelect(e) {
    if (!this.valueSelect)
      return;
    const { options: t, value: s } = this.createValueSelectParams(e);
    this.valueSelect.clearOptions().addOptions(t).setValue(s, !0);
  }
  createValueSelectParams(e) {
    let t;
    return {
      options: e.map((i) => {
        const r = i.displayName ?? "";
        return i.selected && (t = i), {
          value: i,
          text: r
        };
      }),
      value: t
    };
  }
  onValueChange({ added: e, updated: t, removed: s, selected: i }) {
    let r, n;
    const o = () => {
      i.forEach((a, l) => {
        a.order = l;
      }), n = !0;
    };
    e.length ? (r = e[0], r.selected = !0, o()) : s.length ? (r = s[0], r.selected = !1) : t.length && (o(), r = t[0]), r && this.chartController.updateForPanelChange({ updatedColState: r, resetOrder: n });
  }
  destroy() {
    this.valuePillSelect = void 0, this.valueSelect = void 0, super.destroy();
  }
}, OU = "sum", VU = class extends Av {
  constructor(e, t, s, i, r) {
    super(
      e,
      s,
      void 0,
      /* html */
      '<div id="categoriesGroup"></div>'
    ), this.title = t, this.dimensionCols = i, this.isOpen = r;
  }
  postConstruct() {
    this.groupComp = this.createBean(
      new Ms({
        title: this.title,
        enabled: !0,
        suppressEnabledCheckbox: !0,
        suppressOpenCloseIcons: !1,
        cssIdentifier: "charts-data",
        expanded: this.isOpen
      })
    ), this.createGroup(
      this.dimensionCols,
      (e) => e.displayName ?? "",
      "categoryAdd",
      "categorySelect",
      () => !this.chartController.getAggFunc()
    ), this.createAggFuncControls(this.dimensionCols), this.getGui().appendChild(this.groupComp.getGui());
  }
  refresh(e) {
    var t;
    (t = this.valuePillSelect) == null || t.setValues(
      e,
      e.filter((s) => s.selected)
    ), this.refreshValueSelect(e), this.refreshAggFuncControls(e, this.chartController.getAggFunc());
  }
  createAggFuncControls(e) {
    const t = this.chartController.getAggFunc();
    this.groupComp.addItem(
      this.aggFuncToggle = this.createBean(
        new br({
          label: this.chartTranslation.translate("aggregate"),
          labelAlignment: "left",
          labelWidth: "flex",
          inputWidth: "flex",
          value: t != null,
          onValueChange: (s) => {
            var r, n;
            const i = s ? OU : void 0;
            this.chartController.setAggFunc(i), (r = this.aggFuncSelect) == null || r.setValue(i, !0), (n = this.aggFuncSelect) == null || n.setDisplayed(i != null);
          }
        })
      )
    ), this.groupComp.addItem(
      this.aggFuncSelect = this.createBean(
        new st({
          options: [
            { value: "sum", text: this.chartTranslation.translate("sum") },
            { value: "first", text: this.chartTranslation.translate("first") },
            { value: "last", text: this.chartTranslation.translate("last") },
            { value: "min", text: this.chartTranslation.translate("min") },
            { value: "max", text: this.chartTranslation.translate("max") },
            { value: "count", text: this.chartTranslation.translate("count") },
            { value: "avg", text: this.chartTranslation.translate("avg") }
          ],
          value: typeof t == "string" ? t : void 0,
          onValueChange: (s) => {
            this.chartController.setAggFunc(s);
          }
        })
      )
    ), this.refreshAggFuncControls(e, t);
  }
  refreshAggFuncControls(e, t) {
    var r, n, o, a;
    const i = e.filter((l) => l.selected).some((l) => l.colId !== ns);
    (r = this.aggFuncToggle) == null || r.setValue(t != null), (n = this.aggFuncSelect) == null || n.setValue(typeof t == "string" ? t : void 0, !0), (o = this.aggFuncToggle) == null || o.setDisplayed(i), (a = this.aggFuncSelect) == null || a.setDisplayed(i && t != null);
  }
  clearAggFuncControls() {
    this.aggFuncToggle = this.destroyBean(this.aggFuncToggle), this.aggFuncSelect = this.destroyBean(this.aggFuncSelect);
  }
  destroy() {
    this.clearAggFuncControls(), this.groupComp = this.destroyBean(this.groupComp), super.destroy();
  }
}, Oi = class extends R {
  constructor(e) {
    super(), this.chartOptionsProxy = e;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  getDefaultColorPickerParams(e, t, s) {
    return this.addValueParams(
      e,
      {
        label: this.chartTranslation.translate(t ?? "color"),
        labelWidth: "flex",
        inputWidth: "flex",
        labelAlignment: "top",
        pickerGap: 6
      },
      s
    );
  }
  getDefaultNumberInputParams(e, t, s) {
    return this.addValueParams(
      e,
      {
        label: this.chartTranslation.translate(t),
        labelAlignment: "top",
        labelWidth: "flex",
        inputWidth: "flex",
        precision: s == null ? void 0 : s.precision,
        step: s == null ? void 0 : s.step,
        min: s == null ? void 0 : s.min,
        max: s == null ? void 0 : s.max
      },
      {
        parseInputValue: (i) => {
          const r = Number(i);
          return isNaN(r) ? void 0 : r;
        },
        formatInputValue: (i) => i == null ? "" : `${i}`
      }
    );
  }
  getDefaultSliderParams(e, t, s, i) {
    let r = this.chartOptionsProxy.getValue(e) ?? 0;
    i && Array.isArray(r) && (r = r[0]);
    const n = this.getDefaultSliderParamsWithoutValueParams(r, t, s);
    return n.onValueChange = (o) => this.chartOptionsProxy.setValue(e, i ? [o] : o), n;
  }
  getDefaultSliderParamsWithoutValueParams(e, t, s) {
    return {
      label: this.chartTranslation.translate(t),
      minValue: 0,
      maxValue: Math.max(e, s),
      textFieldWidth: 45,
      value: `${e}`
    };
  }
  getDefaultCheckboxParams(e, t, s) {
    const i = this.chartOptionsProxy.getValue(e), r = {
      label: this.chartTranslation.translate(t),
      value: i,
      readOnly: s == null ? void 0 : s.readOnly,
      passive: s == null ? void 0 : s.passive
    };
    return r.onValueChange = (n) => {
      this.chartOptionsProxy.setValue(e, typeof n == "boolean" ? n : void 0);
    }, r;
  }
  getDefaultToggleParams(e, t, s) {
    const i = this.chartOptionsProxy.getValue(e), r = {
      label: this.chartTranslation.translate(t),
      labelAlignment: "left",
      labelWidth: "flex",
      inputWidth: "flex",
      value: i,
      readOnly: s == null ? void 0 : s.readOnly,
      passive: s == null ? void 0 : s.passive
    };
    return r.onValueChange = (n) => {
      this.chartOptionsProxy.setValue(e, typeof n == "boolean" ? n : void 0);
    }, r;
  }
  getDefaultSelectParams(e, t, s) {
    return this.getDefaultSelectParamsWithoutValueParams(
      t,
      s,
      this.chartOptionsProxy.getValue(e),
      (i) => {
        this.chartOptionsProxy.setValue(e, i);
      }
    );
  }
  getDefaultSelectParamsWithoutValueParams(e, t, s, i) {
    return {
      label: this.chartTranslation.translate(e),
      labelAlignment: "top",
      options: t,
      pickerGap: 6,
      value: s,
      onValueChange: i
    };
  }
  getDefaultFontPanelParams(e, t) {
    const s = (i) => `${e}.${i}`;
    return this.addEnableParams(s("enabled"), {
      name: this.chartTranslation.translate(t),
      suppressEnabledCheckbox: !1,
      chartMenuParamsFactory: this,
      keyMapper: s
    });
  }
  addValueParams(e, t, s) {
    const i = this.chartOptionsProxy.getValue(e);
    return t.value = s != null && s.formatInputValue ? s.formatInputValue(i) : i, t.onValueChange = (r) => {
      const n = s != null && s.parseInputValue ? s.parseInputValue(r) : r;
      this.chartOptionsProxy.setValue(e, n);
    }, t;
  }
  addEnableParams(e, t) {
    return t.enabled = this.chartOptionsProxy.getValue(e) ?? !1, t.onEnableChange = (s) => this.chartOptionsProxy.setValue(e, s), t;
  }
  getChartOptions() {
    return this.chartOptionsProxy;
  }
}, BU = class extends D {
  constructor(e, t) {
    super(), this.chartMenuContext = e, this.isOpen = t, this.chartSpecificGroup = x, this.hasContent = !1;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation, this.chartSvc = e.chartSvc;
  }
  postConstruct() {
    const t = {
      title: this.getTitle(),
      enabled: !0,
      suppressEnabledCheckbox: !0,
      suppressOpenCloseIcons: !1,
      cssIdentifier: "charts-data",
      expanded: this.isOpen,
      items: [...this.createDirectionSelect(), this.createReverseSelect(), this.createGroupTypeSelect()]
    };
    this.setTemplate(
      /* html */
      `
            <div id="chartSpecificGroup">
                <ag-group-component data-ref="chartSpecificGroup"></ag-group-component>
            </div>`,
      [ae],
      {
        chartSpecificGroup: t
      }
    ), this.setDisplayed(this.hasContent);
  }
  refresh() {
    this.hasContent = !1, this.chartSpecificGroup.setTitle(this.getTitle()), this.updateDirectionSelect(), this.updateReverseSelect(), this.updateGroupTypeSelect(), this.setDisplayed(this.hasContent);
  }
  getTitle() {
    const e = this.chartMenuContext.chartController.getChartType();
    return this.chartTranslation.translate(Zd(e));
  }
  createDirectionSelect() {
    if (!this.chartSvc.isEnterprise())
      return [];
    const { chartOptionsService: e, chartController: t } = this.chartMenuContext, s = e.getSeriesOptionsProxy(
      () => de(t.getChartType())
    ), i = this.createManagedBean(
      new Oi(s)
    ), r = ["horizontal", "vertical"].map((a) => ({
      value: a,
      text: this.chartTranslation.translate(a)
    })), n = i.getDefaultSelectParams("direction", "direction", r), o = n.onValueChange;
    return n.onValueChange = (a) => {
      o(a), t.raiseChartModelUpdateEvent();
    }, this.directionSelect = this.createManagedBean(new st(n)), this.updateDirectionSelect(), [this.directionSelect];
  }
  createReverseSelect() {
    const { chartMenuParamsFactory: e } = this.chartMenuContext, t = e.getDefaultToggleParams("series.reverse", "reverse");
    return this.reverseToggle = this.createManagedBean(new br(t)), this.updateReverseSelect(), this.reverseToggle;
  }
  updateReverseSelect() {
    const e = this.chartMenuContext.chartController.getChartType() === "pyramid";
    this.updateDisplayed(this.reverseToggle, e);
  }
  updateDirectionSelect() {
    const e = c_(this.chartMenuContext.chartController.getChartType());
    this.updateDisplayed(this.directionSelect, e);
  }
  createGroupTypeSelect() {
    const { chartController: e, chartMenuParamsFactory: t } = this.chartMenuContext;
    return this.groupTypeSelect = this.createManagedBean(
      new st(
        t.getDefaultSelectParamsWithoutValueParams(
          "seriesGroupType",
          s_.map((s) => ({
            value: s,
            text: this.chartTranslation.translate(`${s}SeriesGroupType`)
          })),
          e.getSeriesGroupType(),
          (s) => e.setSeriesGroupType(s)
        )
      )
    ), this.updateGroupTypeSelect(), this.groupTypeSelect;
  }
  updateGroupTypeSelect() {
    const e = ["radialColumn", "radialBar", "nightingale"].includes(
      this.chartMenuContext.chartController.getChartType()
    );
    this.updateDisplayed(this.groupTypeSelect, e);
  }
  updateDisplayed(e, t) {
    e == null || e.setDisplayed(t), e && (this.hasContent = this.hasContent || t);
  }
}, NU = class extends D {
  constructor(e, t, s) {
    super(
      /* html */
      '<div id="seriesChartTypeGroup"></div>'
    ), this.chartController = e, this.columns = t, this.isOpen = s, this.selectedColIds = [], this.chartTypeComps = /* @__PURE__ */ new Map(), this.secondaryAxisComps = /* @__PURE__ */ new Map();
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    this.createSeriesChartTypeGroup(this.columns);
  }
  refresh(e) {
    Xe(this.getValidColIds(e), this.selectedColIds) ? this.refreshComps() : this.recreate(e);
  }
  recreate(e) {
    this.isOpen = this.seriesChartTypeGroupComp.isExpanded(), X(this.getGui()), this.destroyBean(this.seriesChartTypeGroupComp), this.columns = e, this.selectedColIds = [], this.clearComps(), this.postConstruct();
  }
  getValidColIds(e) {
    const t = this.chartController.getSeriesChartTypes();
    return e.filter((s) => s.selected && !!t.filter((i) => i.colId === s.colId)[0]).map(({ colId: s }) => s);
  }
  createSeriesChartTypeGroup(e) {
    this.seriesChartTypeGroupComp = this.createBean(
      new Ms({
        title: this.chartTranslation.translate("seriesChartType"),
        enabled: !0,
        suppressEnabledCheckbox: !0,
        suppressOpenCloseIcons: !1,
        cssIdentifier: "charts-data",
        expanded: this.isOpen
      })
    );
    const t = this.chartController.getSeriesChartTypes();
    e.forEach((s) => {
      if (!s.selected)
        return;
      const i = t.filter((c) => c.colId === s.colId)[0];
      if (!i)
        return;
      this.selectedColIds.push(s.colId);
      const r = this.seriesChartTypeGroupComp.createManagedBean(
        new Ms({
          title: s.displayName,
          enabled: !0,
          suppressEnabledCheckbox: !0,
          suppressOpenCloseIcons: !0,
          cssIdentifier: "charts-format-sub-level"
        })
      ), n = (c) => ["groupedColumn", "stackedColumn", "stackedArea"].includes(c), o = this.seriesChartTypeGroupComp.createManagedBean(
        new Bi({
          label: this.chartTranslation.translate("secondaryAxis"),
          labelWidth: "flex",
          disabled: n(i.chartType),
          value: !!i.secondaryAxis,
          onValueChange: (c) => this.chartController.updateSeriesChartType(s.colId, void 0, c)
        })
      );
      r.addItem(o);
      const a = ["line", "area", "stackedArea", "groupedColumn", "stackedColumn"].map(
        (c) => ({
          value: c,
          text: this.chartTranslation.translate(Zd(c))
        })
      ), l = r.createManagedBean(
        new st({
          options: a,
          value: i.chartType,
          onValueChange: (c) => this.chartController.updateSeriesChartType(s.colId, c)
        })
      );
      r.addItem(l), this.seriesChartTypeGroupComp.addItem(r), this.chartTypeComps.set(s.colId, l), this.secondaryAxisComps.set(s.colId, o);
    }), this.getGui().appendChild(this.seriesChartTypeGroupComp.getGui());
  }
  refreshComps() {
    const e = this.chartController.getSeriesChartTypes();
    this.selectedColIds.forEach((t) => {
      const s = e.find((n) => n.colId === t);
      if (!s)
        return;
      const i = this.chartTypeComps.get(t), r = this.secondaryAxisComps.get(t);
      i == null || i.setValue(s.chartType), r == null || r.setValue(!!s.secondaryAxis), r == null || r.setDisabled(this.isSecondaryAxisDisabled(s.chartType));
    });
  }
  clearComps() {
    this.chartTypeComps.clear(), this.secondaryAxisComps.clear();
  }
  isSecondaryAxisDisabled(e) {
    return ["groupedColumn", "stackedColumn", "stackedArea"].includes(e);
  }
  destroy() {
    this.clearComps(), this.seriesChartTypeGroupComp = this.destroyBean(this.seriesChartTypeGroupComp), super.destroy();
  }
}, HU = class extends Av {
  constructor(e, t, s, i, r, n, o) {
    super(
      e,
      i,
      r,
      /* html */
      '<div id="seriesGroup"></div>'
    ), this.chartOptionsService = t, this.title = s, this.valueCols = n, this.isOpen = o;
  }
  postConstruct() {
    if (this.groupComp = this.createBean(
      new Ms({
        title: this.title,
        enabled: !0,
        suppressEnabledCheckbox: !0,
        suppressOpenCloseIcons: !1,
        cssIdentifier: "charts-data",
        expanded: this.isOpen
      })
    ), this.chartController.isActiveXYChart()) {
      const e = this.groupComp.createManagedBean(
        new br({
          label: this.chartTranslation.translate("paired"),
          labelAlignment: "left",
          labelWidth: "flex",
          inputWidth: "flex",
          value: this.chartOptionsService.getPairedMode(),
          onValueChange: (t) => {
            this.chartOptionsService.setPairedMode(!!t), this.chartController.updateForGridChange({ maintainColState: !0 });
          }
        })
      );
      this.groupComp.addItem(e);
    }
    this.createGroup(this.valueCols, this.generateGetSeriesLabel(this.valueCols), "seriesAdd", "seriesSelect"), this.getGui().appendChild(this.groupComp.getGui());
  }
  refresh(e) {
    var t, s;
    (t = this.valuePillSelect) == null || t.setValueFormatter(this.generateGetSeriesLabel(e)), (s = this.valuePillSelect) == null || s.setValues(
      e,
      e.filter((i) => i.selected)
    ), this.refreshValueSelect(e);
  }
  generateGetSeriesLabel(e) {
    if (!this.chartController.isActiveXYChart())
      return (n) => n.displayName ?? "";
    const t = e.filter((n) => n.selected), s = this.chartController.getChartType() === "bubble", i = this.chartOptionsService.getPairedMode(), r = /* @__PURE__ */ new Map();
    return r.set(0, "X"), r.set(1, "Y"), r.set(2, "size"), (n) => {
      const o = n.displayName ?? "";
      if (!n.selected)
        return o;
      const a = t.indexOf(n);
      if (a === -1)
        return o;
      let l;
      return i ? l = r.get(a % (s ? 3 : 2)) : a === 0 ? l = "X" : l = s && a % 2 === 0 ? "size" : "Y", `${o} (${l})`;
    };
  }
  destroy() {
    this.groupComp = this.destroyBean(this.groupComp), super.destroy();
  }
}, zU = {
  groups: [
    { type: "categories", isOpen: !0 },
    { type: "series", isOpen: !0 },
    { type: "seriesChartType", isOpen: !0 },
    { type: "chartSpecific", isOpen: !0 }
  ]
}, WU = class extends D {
  constructor(e) {
    super(
      /* html */
      '<div class="ag-chart-data-wrapper ag-scrollable-container"></div>'
    ), this.chartMenuContext = e, this.isSwitchCategorySeriesToggled = !1, this.restoreSwitchCategorySeriesToggleFocus = !1, this.panels = [], this.chartController = e.chartController;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation, this.chartSvc = e.chartSvc;
  }
  postConstruct() {
    this.createSwitchCategorySeriesToggle(), this.isSwitchCategorySeriesToggled = this.chartController.isCategorySeriesSwitched(), this.updatePanels();
    const e = this.updatePanels.bind(this);
    this.addManagedListeners(this.chartController, {
      chartModelUpdate: e,
      chartApiUpdate: e
    });
  }
  destroy() {
    this.clearPanelComponents(), super.destroy();
  }
  updatePanels() {
    var o, a, l, c, d;
    const e = this.chartType, t = this.isSwitchCategorySeriesToggled, { dimensionCols: s, valueCols: i } = this.chartController.getColStateForMenu();
    this.chartType = this.chartController.getChartType(), this.isSwitchCategorySeriesToggled = this.chartController.isCategorySeriesSwitched();
    const r = this.isSwitchCategorySeriesToggled !== t;
    this.canRefresh(e, this.chartType) && !r ? ((o = this.categoriesDataPanel) == null || o.refresh(s), (a = this.seriesDataPanel) == null || a.refresh(i), (l = this.seriesChartTypePanel) == null || l.refresh(i), (c = this.chartSpecificPanel) == null || c.refresh()) : this.recreatePanels(s, i);
    const n = vv(this.chartType) && this.chartSvc.isEnterprise() && !this.chartController.isGrouping();
    O(this.switchCategorySeriesToggle.getGui(), n), r && ((d = this.switchCategorySeriesToggle) == null || d.setValue(this.chartController.isCategorySeriesSwitched())), this.restoreSwitchCategorySeriesToggleFocus && (this.restoreSwitchCategorySeriesToggleFocus = !1, n && this.switchCategorySeriesToggle.getFocusableElement().focus());
  }
  canRefresh(e, t) {
    if (e === void 0)
      return !1;
    if (e === t)
      return !0;
    const s = (i) => ["columnLineCombo", "areaColumnCombo", "customCombo"].includes(i);
    return !!(s(e) && s(t));
  }
  recreatePanels(e, t) {
    var r, n;
    this.clearPanelComponents();
    const { chartType: s } = this;
    if (!s)
      return;
    const i = this.chartController.isCategorySeriesSwitched();
    (r = this.getDataPanelDef().groups) == null || r.forEach(({ type: o, isOpen: a }) => {
      o === (i ? "series" : "categories") ? (this.categoriesDataPanel = this.createBean(
        new VU(
          this.chartController,
          this.getCategoryGroupTitle(i),
          this.getCategoryGroupMultipleSelect(s, i),
          e,
          a
        )
      ), this.panels.push(this.categoriesDataPanel)) : o === (i ? "categories" : "series") ? (this.seriesDataPanel = this.createBean(
        new HU(
          this.chartController,
          this.chartMenuContext.chartOptionsService,
          this.getSeriesGroupTitle(i),
          this.getSeriesGroupMultipleSelect(s, i),
          this.getSeriesGroupMaxSelection(s, i),
          t,
          a
        )
      ), this.panels.push(this.seriesDataPanel)) : o === "seriesChartType" ? this.chartController.isComboChart() && (this.seriesChartTypePanel = this.createBean(
        new NU(this.chartController, t, a)
      ), this.panels.push(this.seriesChartTypePanel)) : o === "chartSpecific" ? (this.chartSpecificPanel = this.createBean(new BU(this.chartMenuContext, a)), this.panels.push(this.chartSpecificPanel)) : F(144, { type: o });
    }), (n = i ? this.categoriesDataPanel : this.seriesDataPanel) == null || n.addItem(
      this.switchCategorySeriesToggle.getGui()
    ), this.addPanelComponents();
  }
  addPanelComponents() {
    if (!this.panels.length)
      return;
    const t = me(this.beans).createDocumentFragment();
    for (const s of this.panels)
      s.addCss("ag-chart-data-section"), t.appendChild(s.getGui());
    this.getGui().appendChild(t);
  }
  clearPanelComponents() {
    const e = this.getGui();
    this.panels.forEach((t) => {
      e.removeChild(t.getGui()), this.destroyBean(t);
    }), this.panels = [];
  }
  getDataPanelDef() {
    var e;
    return ((e = this.gos.get("chartToolPanelsDef")) == null ? void 0 : e.dataPanel) ?? zU;
  }
  getCategoryGroupTitle(e) {
    return e ? this.chartTranslation.translate("seriesLabels") : this.chartTranslation.translate(this.chartController.isActiveXYChart() ? "labels" : "categories");
  }
  getCategoryGroupMultipleSelect(e, t) {
    return t ? !1 : Mc(e) !== 1;
  }
  getSeriesGroupTitle(e) {
    return e ? this.chartTranslation.translate("categoryValues") : this.chartTranslation.translate(this.chartController.isActiveXYChart() ? "xyValues" : "series");
  }
  getSeriesGroupMultipleSelect(e, t) {
    return this.getSeriesGroupMaxSelection(e, t) !== 1;
  }
  getSeriesGroupMaxSelection(e, t) {
    if (!t)
      return qo(e);
  }
  createSwitchCategorySeriesToggle() {
    this.switchCategorySeriesToggle = this.createManagedBean(
      new br({
        label: this.chartTranslation.translate("switchCategorySeries"),
        labelAlignment: "left",
        labelWidth: "flex",
        inputWidth: "flex",
        value: this.chartController.isCategorySeriesSwitched(),
        onValueChange: (e) => {
          this.restoreSwitchCategorySeriesToggleFocus = !0, this.chartController.switchCategorySeries(e);
        }
      })
    );
  }
}, _U = class extends id {
  constructor(e) {
    super(
      e,
      /* html */
      `<div class="ag-angle-select">
            <div data-ref="eLabel"></div>
            <div class="ag-wrapper ag-angle-select-wrapper">
                <div class="ag-angle-select-field">
                    <div data-ref="eParentCircle" class="ag-angle-select-parent-circle">
                        <div data-ref="eChildCircle" class="ag-angle-select-child-circle"></div>
                    </div>
                </div>
                <ag-input-number-field data-ref="eAngleValue"></ag-input-number-field>
            </div>
        </div>`,
      [pa]
    ), this.eLabel = x, this.eParentCircle = x, this.eChildCircle = x, this.eAngleValue = x, this.radius = 0, this.offsetX = 0, this.offsetY = 0;
  }
  wireBeans(e) {
    this.dragSvc = e.dragSvc;
  }
  postConstruct() {
    var s;
    super.postConstruct();
    const { value: e, onValueChange: t } = this.config;
    e != null && this.setValue(e, void 0, !0), t != null && this.onValueChange(t), this.dragListener = {
      eElement: this.eParentCircle,
      dragStartPixels: 0,
      onDragStart: () => {
        this.parentCircleRect = this.eParentCircle.getBoundingClientRect();
      },
      onDragging: (i) => this.calculateAngleDrag(i),
      onDragStop: () => {
      }
    }, (s = this.dragSvc) == null || s.addDragSource(this.dragListener), this.eAngleValue.setLabel("").setLabelWidth(5).setInputWidth(45).setMin(0).setMax(360).setValue(`${this.degrees}`).onValueChange((i) => {
      (i == null || i === "") && (i = "0"), i = this.eAngleValue.normalizeValue(i);
      let r = parseFloat(i);
      r > 180 && (r = r - 360), this.setValue(r);
    }), this.updateNumberInput(), A(this.getValue()) && this.eAngleValue.setValue(this.normalizeNegativeValue(this.getValue()).toString()), this.addManagedListeners(this, {
      fieldValueChanged: () => {
        this.eAngleValue.getInputElement().contains(Q(this.beans)) || this.updateNumberInput();
      }
    });
  }
  updateNumberInput() {
    const e = this.normalizeNegativeValue(this.getValue());
    this.eAngleValue.setValue(e.toString());
  }
  positionChildCircle(e) {
    const t = this.parentCircleRect || { width: 24, height: 24 }, s = this.eChildCircle, i = t.width / 2, r = t.height / 2;
    s.style.left = `${i + Math.cos(e) * 8}px`, s.style.top = `${r + Math.sin(e) * 8}px`;
  }
  calculatePolar() {
    const e = this.offsetX, t = this.offsetY, s = Math.atan2(t, e);
    this.degrees = this.toDegrees(s), this.radius = Math.sqrt(e * e + t * t), this.positionChildCircle(s);
  }
  calculateCartesian() {
    const e = this.toRadians(this.getValue()), t = this.getRadius();
    this.setOffsetX(Math.cos(e) * t).setOffsetY(Math.sin(e) * t);
  }
  setOffsetX(e) {
    return this.offsetX !== e && (this.offsetX = e, this.calculatePolar()), this;
  }
  setOffsetY(e) {
    return this.offsetY !== e && (this.offsetY = e, this.calculatePolar()), this;
  }
  calculateAngleDrag(e) {
    const t = this.parentCircleRect, s = t.width / 2, i = t.height / 2, r = e.clientX - t.left, n = e.clientY - t.top, o = r - s, a = n - i, l = Math.atan2(a, o);
    this.setValue(l, !0);
  }
  toDegrees(e) {
    return e / Math.PI * 180;
  }
  toRadians(e) {
    return e / 180 * Math.PI;
  }
  normalizeNegativeValue(e) {
    return e < 0 ? 360 + e : e;
  }
  normalizeAngle180(e) {
    return e %= Math.PI * 2, e < -Math.PI ? e += Math.PI * 2 : e >= Math.PI && (e -= Math.PI * 2), e;
  }
  getRadius() {
    return this.radius;
  }
  setRadius(e) {
    return this.radius === e ? this : (this.radius = e, this.calculateCartesian(), this);
  }
  onValueChange(e) {
    return this.addManagedListeners(this, {
      fieldValueChanged: () => {
        e(this.degrees);
      }
    }), this;
  }
  getValue(e) {
    return e ? this.toRadians(this.degrees) : this.degrees;
  }
  setValue(e, t, s) {
    let i;
    return t ? i = e : i = this.normalizeAngle180(this.toRadians(e)), e = this.toDegrees(i), this.degrees !== e && (this.degrees = Math.floor(e), this.calculateCartesian(), this.positionChildCircle(i), s || this.dispatchLocalEvent({ type: "fieldValueChanged" })), this;
  }
  setWidth(e) {
    return Ot(this.getGui(), e), this;
  }
  setDisabled(e) {
    return super.setDisabled(e), this.eAngleValue.setDisabled(e), this;
  }
  destroy() {
    var e;
    (e = this.dragSvc) == null || e.removeDragSource(this.dragListener), super.destroy();
  }
};
function UU(e) {
  return e[0].toUpperCase() + e.substring(1).toLowerCase();
}
var Qs = class extends D {
  constructor(e) {
    super(), this.params = e, this.fontGroup = x, this.activeComps = [], this.chartOptions = e.chartMenuParamsFactory.getChartOptions();
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const {
      cssIdentifier: e = "charts-format-sub-level",
      name: t,
      enabled: s,
      onEnableChange: i,
      suppressEnabledCheckbox: r,
      chartMenuParamsFactory: n,
      keyMapper: o
    } = this.params, a = {
      cssIdentifier: e,
      direction: "vertical",
      suppressOpenCloseIcons: !0,
      title: t,
      enabled: s,
      suppressEnabledCheckbox: !0,
      onEnableChange: (l) => {
        i && i(l);
      },
      useToggle: !r
    };
    this.setTemplate(
      /* html */
      `<div class="ag-font-panel">
        <ag-group-component data-ref="fontGroup">
            <ag-select data-ref="familySelect"></ag-select>
            <ag-select data-ref="weightStyleSelect"></ag-select>
            <div class="ag-charts-font-size-color">
                <ag-select data-ref="sizeSelect"></ag-select>
                <ag-color-picker data-ref="colorPicker"></ag-color-picker>
            </div>
        </ag-group-component>
    </div>`,
      [ae, Ni, hs],
      {
        fontGroup: a,
        familySelect: this.getFamilySelectParams(),
        weightStyleSelect: this.getWeightStyleSelectParams(),
        sizeSelect: this.getSizeSelectParams(),
        colorPicker: n.getDefaultColorPickerParams(o("color"))
      }
    ), this.toggleCss("ag-font-panel-no-header", !t);
  }
  addItem(e, t) {
    t ? this.fontGroup.prependItem(e) : this.fontGroup.addItem(e), this.activeComps.push(e);
  }
  setEnabled(e) {
    this.fontGroup.setEnabled(e);
  }
  getFamilySelectParams() {
    const e = [
      "Arial, sans-serif",
      "Aria Black, sans-serif",
      "Book Antiqua,  serif",
      "Charcoal, sans-serif",
      "Comic Sans MS, cursive",
      "Courier, monospace",
      "Courier New, monospace",
      "Gadget, sans-serif",
      "Geneva, sans-serif",
      "Helvetica, sans-serif",
      "Impact, sans-serif",
      "Lucida Console, monospace",
      "Lucida Grande, sans-serif",
      "Lucida Sans Unicode,  sans-serif",
      "Monaco, monospace",
      "Palatino Linotype, serif",
      "Palatino, serif",
      "Times New Roman, serif",
      "Times, serif",
      "Verdana, sans-serif"
    ], t = this.getInitialFontValue("fontFamily");
    let s = e[0];
    if (t) {
      const n = e.map((o) => o.toLowerCase()).indexOf(t.toLowerCase());
      if (n >= 0)
        s = e[n];
      else {
        const o = UU(t);
        e.push(o), s = o;
      }
    }
    const i = e.sort().map((r) => ({ value: r, text: r }));
    return this.params.chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams(
      "font",
      i,
      `${s}`,
      (r) => this.setFont({ fontFamily: r })
    );
  }
  getSizeSelectParams() {
    const e = [8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36], t = this.getInitialFontValue("fontSize");
    e.includes(t) || e.push(t);
    const s = e.sort((i, r) => i - r).map((i) => ({ value: `${i}`, text: `${i}` }));
    return this.params.chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams(
      "size",
      s,
      `${t}`,
      (i) => this.setFont({ fontSize: parseInt(i, 10) })
    );
  }
  getWeightStyleSelectParams() {
    const e = this.getInitialFontValue("fontWeight") ?? "normal", t = this.getInitialFontValue("fontStyle") ?? "normal", s = [
      { name: "normal", weight: "normal", style: "normal" },
      { name: "bold", weight: "bold", style: "normal" },
      { name: "italic", weight: "normal", style: "italic" },
      { name: "boldItalic", weight: "bold", style: "italic" }
    ];
    let i = s.find((n) => n.weight === e && n.style === t);
    i || (i = { name: "predefined", weight: e, style: t }, s.unshift(i));
    const r = s.map((n) => ({
      value: n.name,
      text: this.chartTranslation.translate(n.name)
    }));
    return this.params.chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams(
      "weight",
      r,
      i.name,
      (n) => {
        const o = s.find((a) => a.name === n);
        this.setFont({ fontWeight: o.weight, fontStyle: o.style });
      }
    );
  }
  destroyActiveComps() {
    this.activeComps.forEach((e) => {
      se(e.getGui()), this.destroyBean(e);
    });
  }
  destroy() {
    this.destroyActiveComps(), super.destroy();
  }
  setFont(e) {
    const { keyMapper: t } = this.params;
    for (const s of Object.keys(e)) {
      const i = e[s];
      i && this.chartOptions.setValue(t(s), i);
    }
  }
  getInitialFontValue(e) {
    const { keyMapper: t } = this.params;
    return this.chartOptions.getValue(t(e));
  }
}, $U = class extends D {
  constructor(e) {
    super(), this.chartMenuUtils = e, this.axisTicksSizeSlider = x;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const { chartMenuUtils: e } = this, t = e.addEnableParams("tick.enabled", {
      cssIdentifier: "charts-format-sub-level",
      direction: "vertical",
      suppressOpenCloseIcons: !0,
      title: this.chartTranslation.translate("ticks"),
      suppressEnabledCheckbox: !0,
      useToggle: !0
    }), s = e.getDefaultColorPickerParams("tick.stroke"), i = e.getDefaultSliderParams("tick.width", "width", 10), r = e.getDefaultSliderParams("tick.size", "length", 30);
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="axisTicksGroup">
                <ag-color-picker data-ref="axisTicksColorPicker"></ag-color-picker>
                <ag-slider data-ref="axisTicksWidthSlider"></ag-slider>
                <ag-slider data-ref="axisTicksSizeSlider"></ag-slider>
            </ag-group-component>
        </div>`,
      [ae, hs, mt],
      {
        axisTicksGroup: t,
        axisTicksColorPicker: s,
        axisTicksWidthSlider: i,
        axisTicksSizeSlider: r
      }
    );
  }
  setTickSizeSliderDisplayed(e) {
    this.axisTicksSizeSlider.setDisplayed(e);
  }
}, KU = class extends D {
  constructor(e) {
    super(), this.chartMenuUtils = e, this.chartOptions = e.getChartOptions();
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const e = this.chartMenuUtils.addEnableParams("gridLine.enabled", {
      cssIdentifier: "charts-format-sub-level",
      direction: "vertical",
      suppressOpenCloseIcons: !0,
      title: this.chartTranslation.translate("gridLines"),
      suppressEnabledCheckbox: !0,
      useToggle: !0
    }), t = this.getGridLineColorPickerParams("color"), s = this.getGridLineWidthSliderParams("thickness"), i = this.getGridLineDashSliderParams("lineDash");
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="gridLineGroup">
                <ag-color-picker data-ref="gridLineColorPicker"></ag-color-picker>
                <ag-slider data-ref="gridLineWidthSlider"></ag-slider>
                <ag-slider data-ref="gridLineLineDashSlider"></ag-slider>
            </ag-group-component>
        </div>`,
      [ae, hs, mt],
      {
        gridLineGroup: e,
        gridLineColorPicker: t,
        gridLineWidthSlider: s,
        gridLineLineDashSlider: i
      }
    );
  }
  getGridLineColorPickerParams(e) {
    return this.chartMenuUtils.getDefaultColorPickerParams("gridLine.style", e, {
      formatInputValue: (t) => {
        var s;
        return (s = t == null ? void 0 : t[0]) == null ? void 0 : s.stroke;
      },
      parseInputValue: (t) => {
        const s = this.chartOptions.getValue("gridLine.style") ?? [];
        return s.length === 0 ? [{ stroke: t, lineDash: [] }] : [{ ...s[0], stroke: t }];
      }
    });
  }
  getGridLineWidthSliderParams(e) {
    return this.chartMenuUtils.getDefaultSliderParams("gridLine.width", e, 10);
  }
  getGridLineDashSliderParams(e) {
    var r, n;
    const t = this.chartOptions.getValue("gridLine.style"), s = (n = (r = t == null ? void 0 : t[0]) == null ? void 0 : r.lineDash) == null ? void 0 : n[0], i = this.chartMenuUtils.getDefaultSliderParamsWithoutValueParams(s ?? 0, e, 30);
    return i.onValueChange = (o) => {
      const a = this.chartOptions.getValue("gridLine.style.0.stroke");
      this.chartOptions.setValue("gridLine.style", [
        { lineDash: [o], stroke: a }
      ]);
    }, i;
  }
}, jU = "%d %B %Y", Qn = class extends D {
  constructor(e, t) {
    super(), this.axisType = e, this.options = t, this.axisGroup = x, this.axisTypeSelect = x, this.axisPositionSelect = x, this.axisTimeFormatSelect = x, this.activePanels = [], this.updateFuncs = [];
    const { chartOptionsService: s, seriesType: i, chartController: r } = t;
    this.chartOptionsService = s, this.chartController = r, this.chartOptionsSeriesProxy = s.getSeriesOptionsProxy(() => i);
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    var f;
    const { isExpandedOnInit: e, chartOptionsService: t, registerGroupComponent: s } = this.options, i = this.axisType, r = {
      cssIdentifier: "charts-format-top-level",
      direction: "vertical",
      title: this.translate(i),
      expanded: e,
      suppressEnabledCheckbox: !0
    }, n = t.getCartesianAxisOptionsProxy(this.axisType), o = this.createManagedBean(new Oi(n)), a = this.createManagedBean(
      new Oi(t.getCartesianAxisThemeOverridesProxy(this.axisType))
    ), l = this.getAxisTypeSelectParams(
      o,
      t.getCartesianAxisAppliedThemeOverridesProxy(this.axisType)
    ), c = this.getAxisPositionSelectParams(o), d = this.getAxisTimeFormatSelectParams(o), h = this.getAxisColorInputParams(a), u = this.getAxisLineWidthSliderParams(a);
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="axisGroup">
                <ag-select data-ref="axisTypeSelect"></ag-select>
                <ag-select data-ref="axisTimeFormatSelect"></ag-select>
                <ag-select data-ref="axisPositionSelect"></ag-select>
                <ag-color-picker data-ref="axisColorInput"></ag-color-picker>
                <ag-slider data-ref="axisLineWidthSlider"></ag-slider>
            </ag-group-component>
        </div>`,
      [ae, Ni, hs, mt],
      {
        axisGroup: r,
        axisTypeSelect: l ?? void 0,
        axisPositionSelect: c ?? void 0,
        axisTimeFormatSelect: d ?? void 0,
        axisColorInput: h,
        axisLineWidthSlider: u
      }
    ), s(this.axisGroup), this.axisTypeSelect.setDisplayed(!!((f = l.options) != null && f.length)), c || this.removeTemplateComponent(this.axisPositionSelect);
    const g = () => {
      const m = n.getValue("type") === "time";
      O(this.axisTimeFormatSelect.getGui(), m);
    };
    d ? (g(), this.addManagedEventListeners({
      chartOptionsChanged: () => {
        g();
      }
    })) : this.removeTemplateComponent(this.axisTimeFormatSelect), this.initGridLines(a), this.initAxisTicks(a), this.initAxisLabels(a);
    const p = () => this.updateFuncs.forEach((m) => m());
    this.addManagedListeners(this.chartController, {
      chartUpdated: p,
      chartModelUpdate: () => setTimeout(() => {
        this.isAlive() && (this.refreshAxisTypeSelect(o), g());
      })
    });
  }
  getAxisTypeSelectParams(e, t) {
    const s = e.getChartOptions(), i = this.getAxisTypeSelectOptions(), r = e.getDefaultSelectParams("type", "axisType", i);
    return r.onValueChange = (n) => {
      const o = s.getValue("type");
      if (n === o)
        return;
      const a = t.getValue("*"), l = o === "time", c = n === "time", d = l !== c ? c ? jU : void 0 : null;
      if (this.chartOptionsService.setCartesianCategoryAxisType(this.axisType, n), d !== null) {
        const h = s.getValue("label") ?? {};
        s.setValue("label", {
          ...h,
          format: d
        });
      }
      t.setValue("*", a);
    }, r;
  }
  refreshAxisTypeSelect(e) {
    const t = this.getAxisTypeSelectOptions(), s = !!t.length;
    this.axisTypeSelect.setDisplayed(s), s && this.axisTypeSelect.clearOptions().addOptions(t).setValue(e.getChartOptions().getValue("type"));
  }
  getAxisTypeSelectOptions() {
    const e = this.chartController, t = e.getChartType(), s = () => {
      const i = e.getChartData()[0];
      return i ? e.getSelectedDimensions().every((r) => !isNaN(parseFloat(i[r.colId]))) : !1;
    };
    return ["heatmap", "histogram", "boxPlot", "rangeBar", "scatter", "bubble"].includes(t) || e.isGrouping() || !this.isCategoryAxis() || e.isCategorySeriesSwitched() || !s() ? [] : ["category", "number", "time"].map((i) => ({
      value: i,
      text: this.translate(i)
    }));
  }
  isCategoryAxis() {
    const e = this.chartOptionsSeriesProxy.getValue("direction") === "horizontal";
    return e && this.axisType === "yAxis" || !e && this.axisType === "xAxis";
  }
  getAxisPositionSelectParams(e) {
    const t = ((s, i) => {
      switch (s) {
        case "heatmap":
          return null;
        default:
          switch (i) {
            case "xAxis":
              return [
                { value: "top", text: this.translate("top") },
                { value: "bottom", text: this.translate("bottom") }
              ];
            case "yAxis":
              return [
                { value: "left", text: this.translate("left") },
                { value: "right", text: this.translate("right") }
              ];
          }
      }
    })(this.chartController.getChartType(), this.axisType);
    return t ? e.getDefaultSelectParams("position", "position", t) : null;
  }
  getAxisTimeFormatSelectParams(e) {
    if (!this.isCategoryAxis())
      return null;
    const t = [
      { value: "%d/%m/%Y", text: this.translate("timeFormatSlashesDDMMYYYY") },
      { value: "%m/%d/%Y", text: this.translate("timeFormatSlashesMMDDYYYY") },
      { value: "%d/%m/%y", text: this.translate("timeFormatSlashesDDMMYY") },
      { value: "%m/%d/%y", text: this.translate("timeFormatSlashesMMDDYY") },
      { value: "%d.%e.%y", text: this.translate("timeFormatDotsDDMYY") },
      { value: "%e.%d.%y", text: this.translate("timeFormatDotsMDDYY") },
      { value: "%Y-%m-%d", text: this.translate("timeFormatDashesYYYYMMDD") },
      { value: "%d %B %Y", text: this.translate("timeFormatSpacesDDMMMMYYYY") },
      { value: "%H:%M:%S", text: this.translate("timeFormatHHMMSS") },
      { value: "%I:%M:%S %p", text: this.translate("timeFormatHHMMSSAmPm") }
    ];
    return e.getDefaultSelectParams("label.format", "timeFormat", t);
  }
  getAxisColorInputParams(e) {
    return e.getDefaultColorPickerParams("line.stroke");
  }
  getAxisLineWidthSliderParams(e) {
    const t = e.getChartOptions(), s = () => t.getValue("line.enabled") ? t.getValue("line.width") : null, i = (n) => {
      t.setValues([
        { expression: "line.enabled", value: n != null },
        { expression: "line.width", value: n ?? 0 }
      ]);
    }, r = e.getDefaultSliderParamsWithoutValueParams(
      s() ?? 0,
      "thickness",
      10
    );
    return r.onValueChange = (n) => {
      i(n === 0 ? null : n);
    }, r;
  }
  initGridLines(e) {
    if (this.chartController.getChartType() === "heatmap")
      return;
    const s = this.createBean(new KU(e));
    this.axisGroup.addItem(s), this.activePanels.push(s);
  }
  initAxisTicks(e) {
    if (!this.hasConfigurableAxisTicks())
      return;
    const t = this.createBean(new $U(e));
    this.axisGroup.addItem(t), this.activePanels.push(t);
    const s = () => t.setTickSizeSliderDisplayed(this.isGroupedCategoryAxis());
    this.updateFuncs.push(s), s();
  }
  hasConfigurableAxisTicks() {
    switch (this.chartController.getChartType()) {
      case "radarLine":
      case "radarArea":
      case "rangeBar":
      case "boxPlot":
      case "waterfall":
        return !1;
      default:
        return !0;
    }
  }
  initAxisLabels(e) {
    const t = {
      name: this.translate("labels"),
      enabled: !0,
      suppressEnabledCheckbox: !0,
      chartMenuParamsFactory: e,
      keyMapper: (i) => `label.${i}`
    }, s = this.createBean(new Qs(t));
    this.axisGroup.addItem(s), this.activePanels.push(s), this.addAdditionalLabelComps(s, e);
  }
  addAdditionalLabelComps(e, t) {
    this.addLabelPadding(e, t);
    const s = this.createRotationWidget("labelRotation", t), i = this.initLabelRotation(s, t);
    e.addItem(i), e.addItem(s);
  }
  initLabelRotation(e, t) {
    const s = t.getChartOptions(), i = () => s.getValue("label.rotation"), r = () => s.getValue("label.autoRotate"), n = (d) => {
      d && (this.prevRotation = i()), s.setValues([
        { expression: "label.autoRotate", value: d },
        // Clear the rotation option when activating auto-rotate, reinstate the previous value when deactivating
        { expression: "label.rotation", value: d ? void 0 : this.prevRotation }
      ]), e.setDisplayed(!d);
    }, a = typeof i() == "number" ? !1 : r(), l = this.createBean(
      new Bi({
        label: this.translate("autoRotate"),
        value: a,
        onValueChange: n
      })
    );
    e.setDisplayed(!a);
    const c = () => l.setDisplayed(this.isGroupedCategoryAxis());
    return this.updateFuncs.push(c), c(), l;
  }
  createRotationWidget(e, t) {
    const s = t.getChartOptions(), i = () => s.getValue("label.rotation"), r = (l) => s.setValue("label.rotation", l), o = `${this.chartTranslation.translate(e)} °`, a = new _U({
      label: o,
      labelWidth: "flex",
      value: i() ?? 0,
      onValueChange: r
    });
    return this.updateFuncs.push(() => {
      a.setValue(i() ?? 0);
    }), this.createBean(a);
  }
  isGroupedCategoryAxis() {
    return this.chartOptionsService.getCartesianAxisOptionsProxy(this.axisType).getValue("type") === "grouped-category" ? !this.isCategoryAxis() : !0;
  }
  addLabelPadding(e, t) {
    const s = this.createBean(
      new Ct(t.getDefaultSliderParams("label.spacing", "padding", 30))
    );
    e.addItem(s);
  }
  translate(e) {
    return this.chartTranslation.translate(e);
  }
  removeTemplateComponent(e) {
    se(e.getGui()), this.destroyBean(e);
  }
  destroyActivePanels() {
    this.activePanels.forEach((e) => {
      se(e.getGui()), this.destroyBean(e);
    });
  }
  destroy() {
    this.destroyActivePanels(), super.destroy();
  }
}, YU = class extends D {
  constructor(e) {
    super(), this.options = e, this.axisGroup = x;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const { isExpandedOnInit: e, chartAxisMenuParamsFactory: t, registerGroupComponent: s } = this.options, i = {
      cssIdentifier: "charts-format-top-level",
      direction: "vertical",
      title: this.translate("polarAxis"),
      expanded: e,
      suppressEnabledCheckbox: !0
    }, r = t.getDefaultColorPickerParams("line.stroke"), n = t.getDefaultSliderParams(
      "line.width",
      "thickness",
      10
    );
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="axisGroup">
                <ag-color-picker data-ref="axisColorInput"></ag-color-picker>
                <ag-slider data-ref="axisLineWidthSlider"></ag-slider>
            </ag-group-component>
        </div>`,
      [ae, hs, mt],
      {
        axisGroup: i,
        axisColorInput: r,
        axisLineWidthSlider: n
      }
    ), s(this.axisGroup), this.initAxis(), this.initAxisLabels(), this.initRadiusAxis();
  }
  initAxis() {
    const e = this.options.chartController.getChartType();
    if (["radarLine", "radarArea"].includes(e)) {
      const s = [
        { value: "circle", text: this.translate("circle") },
        { value: "polygon", text: this.translate("polygon") }
      ];
      this.axisGroup.addItem(
        this.createSelect({
          labelKey: "shape",
          options: s,
          property: "shape"
        })
      );
    }
    e !== "pie" && this.axisGroup.addItem(
      this.createSlider({
        labelKey: "innerRadius",
        defaultMaxValue: 1,
        property: "innerRadiusRatio"
      })
    );
  }
  initAxisLabels() {
    const e = {
      name: this.translate("labels"),
      enabled: !0,
      suppressEnabledCheckbox: !0,
      chartMenuParamsFactory: this.options.chartAxisMenuParamsFactory,
      keyMapper: (i) => `label.${i}`
    }, t = this.createManagedBean(new Qs(e)), s = this.createOrientationWidget();
    t.addItem(s), this.axisGroup.addItem(t);
  }
  createOrientationWidget() {
    const e = [
      { value: "fixed", text: this.translate("fixed") },
      { value: "parallel", text: this.translate("parallel") },
      { value: "perpendicular", text: this.translate("perpendicular") }
    ];
    return this.createSelect({
      labelKey: "orientation",
      options: e,
      property: "label.orientation"
    });
  }
  initRadiusAxis() {
    const e = de(this.options.chartController.getChartType());
    if (!a_(e))
      return;
    const t = [
      this.createSlider({
        labelKey: "groupPadding",
        defaultMaxValue: 1,
        property: "paddingInner"
      }),
      this.createSlider({
        labelKey: "seriesPadding",
        defaultMaxValue: 1,
        property: "groupPaddingInner"
      })
    ], s = this.createManagedBean(
      new Ms({
        cssIdentifier: "charts-format-sub-level",
        direction: "vertical",
        suppressOpenCloseIcons: !0,
        enabled: !0,
        suppressEnabledCheckbox: !0,
        title: this.translate("padding"),
        items: t
      })
    ).hideEnabledCheckbox(!0).hideOpenCloseIcons(!0);
    this.axisGroup.addItem(s);
  }
  createSlider(e) {
    const { labelKey: t, defaultMaxValue: s, step: i = 0.05, property: r } = e, n = this.options.chartAxisMenuParamsFactory.getDefaultSliderParams(
      r,
      t,
      s
    );
    return n.step = i, this.createManagedBean(new Ct(n));
  }
  createSelect(e) {
    const { labelKey: t, options: s, property: i } = e;
    return this.createManagedBean(
      new st(this.options.chartAxisMenuParamsFactory.getDefaultSelectParams(i, t, s))
    );
  }
  translate(e) {
    return this.chartTranslation.translate(e);
  }
}, qU = class extends D {
  constructor(e) {
    super(), this.chartMenuUtils = e;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const e = this.chartMenuUtils.addEnableParams(
      "background.visible",
      {
        cssIdentifier: "charts-format-sub-level",
        direction: "vertical",
        suppressOpenCloseIcons: !0,
        title: this.chartTranslation.translate("background"),
        suppressEnabledCheckbox: !0,
        useToggle: !0
      }
    ), t = this.chartMenuUtils.getDefaultColorPickerParams("background.fill");
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="chartBackgroundGroup">
                <ag-color-picker data-ref="colorPicker"></ag-color-picker>
            </ag-group-component>
        <div>`,
      [ae, hs],
      {
        chartBackgroundGroup: e,
        colorPicker: t
      }
    );
  }
}, XU = class extends D {
  constructor(e, t) {
    super(), this.chartMenuUtils = e, this.chartController = t, this.paddingTopSlider = x;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const e = {
      cssIdentifier: "charts-format-sub-level",
      direction: "vertical",
      suppressOpenCloseIcons: !0,
      title: this.chartTranslation.translate("padding"),
      suppressEnabledCheckbox: !0
    }, t = (s) => this.chartMenuUtils.getDefaultSliderParams("padding." + s, s, 200);
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="chartPaddingGroup">
                <ag-slider data-ref="paddingTopSlider"></ag-slider>
                <ag-slider data-ref="paddingRightSlider"></ag-slider>
                <ag-slider data-ref="paddingBottomSlider"></ag-slider>
                <ag-slider data-ref="paddingLeftSlider"></ag-slider>
            </ag-group-component>
        <div>`,
      [ae, mt],
      {
        chartPaddingGroup: e,
        paddingTopSlider: t("top"),
        paddingRightSlider: t("right"),
        paddingBottomSlider: t("bottom"),
        paddingLeftSlider: t("left")
      }
    ), this.addManagedEventListeners({
      chartOptionsChanged: (s) => {
        this.updateTopPadding(s.chartOptions);
      }
    });
  }
  updateTopPadding(e) {
    const t = [...this.chartController.getChartSeriesTypes(), "common"].map((s) => {
      var i, r;
      return (r = (i = e == null ? void 0 : e[s]) == null ? void 0 : i.padding) == null ? void 0 : r.top;
    }).find((s) => s != null);
    t != null && this.paddingTopSlider.setValue(`${t}`);
  }
}, ZU = class extends D {
  constructor(e) {
    super(), this.options = e, this.chartGroup = x;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const {
      chartController: e,
      chartMenuParamsFactory: t,
      isExpandedOnInit: s,
      registerGroupComponent: i
    } = this.options, r = {
      cssIdentifier: "charts-format-top-level",
      direction: "vertical",
      title: this.chartTranslation.translate("chartStyle"),
      expanded: s,
      suppressEnabledCheckbox: !0,
      items: [
        this.createManagedBean(new XU(t, e)),
        this.createManagedBean(new qU(t))
      ]
    };
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="chartGroup"></ag-group-component>
        </div>`,
      [ae],
      { chartGroup: r }
    ), i(this.chartGroup);
  }
}, QU = class extends R {
  constructor(e) {
    super(), this.groupContainer = e, this.id = 0, this.groupComponents = /* @__PURE__ */ new Map();
  }
  addGroupComponent(e) {
    const t = this.id++;
    this.groupComponents.set(t, e), e.isExpanded() && (this.expandedGroupComponent = t), e.onExpandedChange((s) => {
      var i;
      if (s) {
        const r = this.expandedGroupComponent;
        if (this.expandedGroupComponent = t, r != null) {
          const n = e.getGui(), o = n.offsetTop - this.groupContainer.parentElement.scrollTop;
          (i = this.groupComponents.get(r)) == null || i.toggleGroupExpand(!1, !0);
          let a = n.offsetTop - o;
          a < 0 && (a = 0), a !== this.groupContainer.parentElement.scrollTop && (this.groupContainer.parentElement.scrollTop = a);
        }
      } else
        this.expandedGroupComponent = void 0;
    });
  }
  destroy() {
    this.groupComponents.clear(), super.destroy();
  }
}, JU = class extends D {
  constructor(e, t) {
    super(), this.options = e, this.legendGroup = x, this.enabledGroup = x, this.isGradient = ["treemap", "sunburst", "heatmap"].includes(e.seriesType), this.key = this.isGradient ? "gradientLegend" : "legend", this.chartController = t.chartController;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const { chartMenuParamsFactory: e, isExpandedOnInit: t, registerGroupComponent: s } = this.options, i = this.createManagedBean(
      new st(
        e.getDefaultSelectParams(
          `${this.key}.position`,
          "position",
          ["top", "right", "bottom", "left"].map((o) => ({
            value: o,
            text: this.chartTranslation.translate(o)
          }))
        )
      )
    );
    this.enabledGroup = this.createManagedBean(
      new Ms(
        e.addEnableParams(`${this.key}.enabled`, {
          cssIdentifier: "charts-format-sub-level",
          direction: "vertical",
          suppressOpenCloseIcons: !0,
          title: this.chartTranslation.translate("legendEnabled"),
          suppressEnabledCheckbox: !0,
          useToggle: !0,
          items: [
            this.createLabelPanel(e),
            i,
            ...this.getItems(e)
          ]
        })
      )
    );
    const r = {
      cssIdentifier: "charts-format-top-level",
      direction: "vertical",
      title: this.chartTranslation.translate("legend"),
      suppressEnabledCheckbox: !0,
      expanded: t,
      items: [this.enabledGroup]
    };
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="legendGroup">
            </ag-group-component>
        </div>`,
      [ae],
      {
        legendGroup: r
      }
    ), s(this.legendGroup);
    const n = this.updateLegendEnabledState.bind(this);
    this.addManagedListeners(this.chartController, {
      chartModelUpdate: n,
      chartApiUpdate: n
    });
  }
  updateLegendEnabledState() {
    const { valueCols: e } = this.chartController.getColStateForMenu();
    this.enabledGroup.setEnabled(e.filter((t) => t.selected).length > 1);
  }
  getItems(e) {
    const t = (s, i, r) => this.createManagedBean(
      new Ct(
        e.getDefaultSliderParams(
          `${this.key}.${s}`,
          i,
          r
        )
      )
    );
    return this.isGradient ? [
      this.createManagedBean(
        new Bi(
          e.addValueParams("gradientLegend.reverseOrder", {
            label: this.chartTranslation.translate("reverseDirection"),
            labelWidth: "flex"
          })
        )
      ),
      t("gradient.thickness", "thickness", 40),
      t("gradient.preferredLength", "preferredLength", 300),
      t("spacing", "spacing", 200)
    ] : [
      t("spacing", "spacing", 200),
      t("item.marker.size", "markerSize", 40),
      t("item.marker.strokeWidth", "markerStroke", 10),
      t("item.marker.padding", "itemSpacing", 20),
      t("item.paddingX", "layoutHorizontalSpacing", 50),
      t("item.paddingY", "layoutVerticalSpacing", 50)
    ];
  }
  createLabelPanel(e) {
    const t = this.isGradient ? "gradientLegend.scale.label" : "legend.item.label", s = {
      enabled: !0,
      suppressEnabledCheckbox: !0,
      chartMenuParamsFactory: e,
      keyMapper: (i) => `${t}.${i}`,
      cssIdentifier: "charts-format-sub-level-no-header"
    };
    return this.createManagedBean(new Qs(s));
  }
}, e5 = class extends D {
  constructor(e) {
    super(), this.params = e, this.toggleableGroup = x, this.activeComps = [], this.chartOptions = e.chartMenuParamsFactory.getChartOptions();
  }
  postConstruct() {
    const { tag: e, cssIdentifier: t = "charts-format-sub-level", title: s, suppressEnabledCheckbox: i } = this.params, r = this.params.chartMenuParamsFactory.addEnableParams(`${e}.enabled`, {
      cssIdentifier: t,
      direction: "vertical",
      suppressOpenCloseIcons: !0,
      title: s,
      suppressEnabledCheckbox: !0,
      useToggle: !i
    });
    this.setTemplate(
      /* html */
      `<div class="ag-toggleable-group-panel">
                <ag-group-component data-ref="toggleableGroup">
                </ag-group-component>
            </div>`,
      [ae],
      {
        toggleableGroup: r
      }
    ), this.toggleCss("ag-toggleable-group-panel-no-header", !s);
  }
  addItem(e, t) {
    t ? this.toggleableGroup.prependItem(e) : this.toggleableGroup.addItem(e), this.activeComps.push(e);
  }
  setEnabled(e) {
    this.toggleableGroup.setEnabled(e);
  }
  destroyActiveComps() {
    this.activeComps.forEach((e) => {
      se(e.getGui()), this.destroyBean(e);
    });
  }
  destroy() {
    this.destroyActiveComps(), super.destroy();
  }
}, t5 = class extends D {
  constructor(e) {
    super(), this.chartMenuUtils = e;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const e = {
      cssIdentifier: "charts-format-sub-level",
      direction: "vertical",
      title: this.chartTranslation.translate("callout"),
      enabled: !0,
      suppressOpenCloseIcons: !0,
      suppressEnabledCheckbox: !0
    };
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="calloutGroup">
                <ag-slider data-ref="calloutLengthSlider"></ag-slider>
                <ag-slider data-ref="calloutStrokeWidthSlider"></ag-slider>
                <ag-slider data-ref="labelOffsetSlider"></ag-slider>
            </ag-group-component>
        </div>`,
      [ae, mt],
      {
        calloutGroup: e,
        calloutLengthSlider: this.chartMenuUtils.getDefaultSliderParams("calloutLine.length", "length", 40),
        calloutStrokeWidthSlider: this.chartMenuUtils.getDefaultSliderParams(
          "calloutLine.strokeWidth",
          "strokeWidth",
          10
        ),
        labelOffsetSlider: this.chartMenuUtils.getDefaultSliderParams("calloutLabel.offset", "offset", 30)
      }
    );
  }
}, s5 = class extends D {
  constructor(e) {
    super(), this.chartMenuUtils = e;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const e = {
      cssIdentifier: "charts-format-sub-level",
      direction: "vertical",
      title: this.chartTranslation.translate("cap"),
      enabled: !0,
      suppressOpenCloseIcons: !0,
      suppressEnabledCheckbox: !0
    }, t = this.chartMenuUtils.getDefaultSliderParams(
      "cap.lengthRatio",
      "capLengthRatio",
      1
    );
    t.step = 0.05, this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="capsGroup">
                <ag-slider data-ref="capLengthRatioSlider"></ag-slider>
            </ag-group-component>
        </div>`,
      [ae, mt],
      {
        capsGroup: e,
        capLengthRatioSlider: t
      }
    );
  }
}, i5 = class extends D {
  constructor(e) {
    super(), this.chartMenuUtils = e;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const e = {
      cssIdentifier: "charts-format-sub-level",
      direction: "vertical",
      title: this.chartTranslation.translate("connectorLine"),
      enabled: !0,
      suppressOpenCloseIcons: !0,
      suppressEnabledCheckbox: !0
    };
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="lineGroup">
                <ag-color-picker data-ref="lineColorPicker"></ag-color-picker>
                <ag-slider data-ref="lineStrokeWidthSlider"></ag-slider>
                <ag-slider data-ref="lineOpacitySlider"></ag-slider>
                <ag-slider data-ref="lineDashSlider"></ag-slider>                
            </ag-group-component>
        </div>`,
      [ae, hs, mt],
      {
        lineGroup: e,
        lineColorPicker: this.chartMenuUtils.getDefaultColorPickerParams("line.stroke"),
        lineStrokeWidthSlider: this.getSliderParams("strokeWidth", 10, "line.strokeWidth"),
        lineDashSlider: this.getSliderParams("lineDash", 30, "line.lineDash", 1, !0),
        lineOpacitySlider: this.getSliderParams("strokeOpacity", 1, "line.strokeOpacity", 0.05)
      }
    );
  }
  getSliderParams(e, t, s, i = 1, r = !1) {
    const n = this.chartMenuUtils.getDefaultSliderParams(s, e, t, r);
    return n.step = i, n;
  }
};
function Iv(e) {
  return ["square", "circle", "cross", "diamond", "plus", "triangle", "heart"].map((t) => ({
    value: t,
    text: e.translate(t)
  }));
}
var r5 = class extends D {
  constructor(e) {
    super(), this.chartMenuUtils = e;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const e = this.chartMenuUtils.addEnableParams("marker.enabled", {
      cssIdentifier: "charts-format-sub-level",
      direction: "vertical",
      title: this.chartTranslation.translate("markers"),
      suppressEnabledCheckbox: !0,
      useToggle: !0,
      suppressOpenCloseIcons: !0
    });
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="seriesMarkersGroup">
                <ag-select data-ref="seriesMarkerShapeSelect"></ag-select>
                <ag-slider data-ref="seriesMarkerSizeSlider"></ag-slider>
                <ag-slider data-ref="seriesMarkerStrokeWidthSlider"></ag-slider>
            </ag-group-component>
        </div>`,
      [ae, Ni, mt],
      {
        seriesMarkersGroup: e,
        seriesMarkerShapeSelect: this.chartMenuUtils.getDefaultSelectParams(
          "marker.shape",
          "shape",
          Iv(this.chartTranslation)
        ),
        seriesMarkerSizeSlider: this.chartMenuUtils.getDefaultSliderParams("marker.size", "size", 60),
        seriesMarkerStrokeWidthSlider: this.chartMenuUtils.getDefaultSliderParams(
          "marker.strokeWidth",
          "strokeWidth",
          10
        )
      }
    );
  }
}, n5 = class extends D {
  constructor(e) {
    super(), this.chartMenuUtils = e, this.seriesItemsGroup = x, this.activePanels = [];
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const e = {
      cssIdentifier: "charts-format-sub-level",
      direction: "vertical",
      title: this.chartTranslation.translate("seriesItems"),
      enabled: !0,
      suppressOpenCloseIcons: !0,
      suppressEnabledCheckbox: !0
    };
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="seriesItemsGroup">
                <ag-select data-ref="seriesItemSelect"></ag-select>
            </ag-group-component>
        </div>`,
      [ae, Ni],
      {
        seriesItemsGroup: e,
        seriesItemSelect: this.getSeriesItemsParams()
      }
    ), this.initSeriesControls();
  }
  getSeriesItemsParams() {
    const e = [
      { value: "positive", text: this.chartTranslation.translate("seriesItemPositive") },
      { value: "negative", text: this.chartTranslation.translate("seriesItemNegative") }
    ], t = (s) => {
      this.destroyActivePanels(), this.initSeriesControls(s);
    };
    return this.chartMenuUtils.getDefaultSelectParamsWithoutValueParams(
      "seriesItemType",
      e,
      "positive",
      t
    );
  }
  initSeriesControls(e = "positive") {
    this.initSlider("strokeWidth", 10, `item.${e}.strokeWidth`), this.initSlider("lineDash", 30, `item.${e}.lineDash`, 1, !0), this.initSlider("strokeOpacity", 1, `item.${e}.strokeOpacity`, 0.05, !1), this.initSlider("fillOpacity", 1, `item.${e}.fillOpacity`, 0.05, !1), this.initItemLabels(e);
  }
  initSlider(e, t, s, i = 1, r = !1) {
    const n = this.chartMenuUtils.getDefaultSliderParams(s, e, t, r);
    n.step = i;
    const o = this.seriesItemsGroup.createManagedBean(new Ct(n));
    this.seriesItemsGroup.addItem(o), this.activePanels.push(o);
  }
  initItemLabels(e) {
    const t = this.chartMenuUtils.getDefaultFontPanelParams(
      `item.${e}.label`,
      "seriesItemLabels"
    ), s = this.createBean(new Qs(t));
    this.seriesItemsGroup.addItem(s), this.activePanels.push(s);
  }
  destroyActivePanels() {
    this.activePanels.forEach((e) => {
      se(e.getGui()), this.destroyBean(e);
    });
  }
  destroy() {
    this.destroyActivePanels(), super.destroy();
  }
}, o5 = class extends D {
  constructor(e, t = "shadow") {
    super(), this.chartMenuUtils = e, this.propertyKey = t;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const e = this.propertyKey, t = this.chartMenuUtils.addEnableParams(
      `${e}.enabled`,
      {
        cssIdentifier: "charts-format-sub-level",
        direction: "vertical",
        suppressOpenCloseIcons: !0,
        title: this.chartTranslation.translate("shadow"),
        suppressEnabledCheckbox: !0,
        useToggle: !0
      }
    ), s = this.chartMenuUtils.getDefaultColorPickerParams(`${e}.color`);
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="shadowGroup">
                <ag-color-picker data-ref="shadowColorPicker"></ag-color-picker>
                <ag-slider data-ref="shadowBlurSlider"></ag-slider>
                <ag-slider data-ref="shadowXOffsetSlider"></ag-slider>
                <ag-slider data-ref="shadowYOffsetSlider"></ag-slider>
            </ag-group-component>
        </div>`,
      [ae, hs, mt],
      {
        shadowGroup: t,
        shadowColorPicker: s,
        shadowBlurSlider: this.getSliderParams("blur", 0, 20),
        shadowXOffsetSlider: this.getSliderParams("xOffset", -10, 10),
        shadowYOffsetSlider: this.getSliderParams("yOffset", -10, 10)
      }
    );
  }
  getSliderParams(e, t, s) {
    const i = `${this.propertyKey}.${e}`, r = this.chartMenuUtils.getDefaultSliderParams(i, e, s);
    return r.minValue = t, r;
  }
}, a5 = class extends D {
  constructor(e) {
    super(), this.chartMenuUtils = e;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const e = {
      cssIdentifier: "charts-format-sub-level",
      direction: "vertical",
      enabled: !0,
      suppressOpenCloseIcons: !0,
      suppressEnabledCheckbox: !0
    };
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="groupSpacing">
                <ag-slider data-ref="groupPaddingSlider"></ag-slider>
                <ag-slider data-ref="groupSpacingSlider"></ag-slider>
            </ag-group-component>
            <ag-group-component data-ref="tileSpacing">
                <ag-slider data-ref="tilePaddingSlider"></ag-slider>
                <ag-slider data-ref="tileSpacingSlider"></ag-slider>
            </ag-group-component>
        </div>`,
      [ae, mt],
      {
        groupSpacing: { ...e, title: this.chartTranslation.translate("group") },
        tileSpacing: { ...e, title: this.chartTranslation.translate("tile") },
        groupPaddingSlider: this.getSliderParams("padding", "group.padding"),
        groupSpacingSlider: this.getSliderParams("spacing", "group.gap"),
        tilePaddingSlider: this.getSliderParams("padding", "tile.padding"),
        tileSpacingSlider: this.getSliderParams("spacing", "tile.gap")
      }
    );
  }
  getSliderParams(e, t) {
    return this.chartMenuUtils.getDefaultSliderParams(t, e, 10);
  }
};
function l5(e) {
  return e[0].toUpperCase() + e.substring(1);
}
var c5 = class extends D {
  constructor(e) {
    super(), this.chartMenuUtils = e, this.tooltipMode = x;
  }
  postConstruct() {
    const { chartMenuUtils: e, beans: t } = this, s = "tooltip", i = t.chartTranslation, r = e.addEnableParams(`${s}.enabled`, {
      cssIdentifier: "charts-format-sub-level",
      direction: "vertical",
      suppressOpenCloseIcons: !0,
      title: i.translate("tooltips"),
      suppressEnabledCheckbox: !0,
      useToggle: !0
    }), n = "tooltipMode", o = ["single", "shared", "compact"].map((c) => ({
      value: c,
      text: i.translate(`${n}${l5(c)}`)
    })), a = `${s}.mode`, l = e.getDefaultSelectParams(
      a,
      n,
      o
    );
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="tooltipGroup">
                <ag-select data-ref="tooltipMode"></ag-select>
            </ag-group-component>
        </div>`,
      [ae, Ni],
      {
        tooltipGroup: r,
        tooltipMode: l
      }
    ), this.addManagedEventListeners({
      chartOptionsChanged: () => {
        const c = e.getChartOptions().getValue(a);
        this.tooltipMode.setValue(c, !0);
      }
    });
  }
}, d5 = class extends D {
  constructor(e) {
    super(), this.chartMenuUtils = e;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const e = {
      cssIdentifier: "charts-format-sub-level",
      direction: "vertical",
      title: this.chartTranslation.translate("whisker"),
      enabled: !0,
      suppressOpenCloseIcons: !0,
      suppressEnabledCheckbox: !0
    };
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="whiskersGroup">
                <ag-color-picker data-ref="whiskerColorPicker"></ag-color-picker>
                <ag-slider data-ref="whiskerThicknessSlider"></ag-slider>
                <ag-slider data-ref="whiskerOpacitySlider"></ag-slider>
                <ag-slider data-ref="whiskerLineDashSlider"></ag-slider>
                <ag-slider data-ref="whiskerLineDashOffsetSlider"></ag-slider>
            </ag-group-component>
        </div>`,
      [ae, hs, mt],
      {
        whiskersGroup: e,
        whiskerColorPicker: this.chartMenuUtils.getDefaultColorPickerParams("whisker.stroke"),
        whiskerThicknessSlider: this.chartMenuUtils.getDefaultSliderParams(
          "whisker.strokeWidth",
          "strokeWidth",
          10
        ),
        whiskerOpacitySlider: this.chartMenuUtils.getDefaultSliderParams(
          "whisker.strokeOpacity",
          "strokeOpacity",
          1
        ),
        whiskerLineDashSlider: this.chartMenuUtils.getDefaultSliderParams(
          "whisker.lineDash",
          "lineDash",
          30,
          !0
        ),
        whiskerLineDashOffsetSlider: this.chartMenuUtils.getDefaultSliderParams(
          "whisker.lineDashOffset",
          "lineDashOffset",
          30
        )
      }
    );
  }
}, ue = "tooltips", Oe = "strokeWidth", Or = "lineWidth", _e = "lineDash", Re = "lineOpacity", Ue = "fillOpacity", Se = "labels", gs = "shadow", Jn = "stageLabels", Vr = "markers", h5 = class extends D {
  constructor(e) {
    super(), this.options = e, this.seriesGroup = x, this.activePanels = [], this.widgetFuncs = {
      lineWidth: () => this.initStrokeWidth(Or),
      [Oe]: () => this.initStrokeWidth("strokeWidth"),
      lineColor: () => this.initLineColor(),
      [_e]: () => this.initLineDash(),
      [Re]: () => this.initOpacity("strokeOpacity"),
      [Ue]: () => this.initOpacity("fillOpacity"),
      markers: () => new r5(this.chartMenuUtils),
      [Se]: () => this.initLabels(),
      sectorLabels: () => this.initSectorLabels(),
      [gs]: () => new o5(this.chartMenuUtils),
      [ue]: () => new c5(this.options.chartMenuParamsFactory),
      bins: () => this.initBins(),
      whiskers: () => new d5(this.chartMenuUtils),
      caps: () => new s5(this.chartMenuUtils),
      connectorLine: () => new i5(this.chartMenuUtils),
      seriesItems: () => new n5(this.chartMenuUtils),
      tileSpacing: () => new a5(this.chartMenuUtils),
      shape: () => this.initShape(),
      size: () => this.initSize("size", "size"),
      minSize: () => this.initSize("size", "minSize"),
      maxSize: () => this.initSize("maxSize", "maxSize"),
      dropoff: () => this.initDropOff(),
      stageLabels: () => this.initStageLabels()
    }, this.seriesWidgetMappings = {
      bar: [ue, Oe, _e, Re, Ue, Se, gs],
      pie: [ue, Oe, Re, Ue, Se, "sectorLabels", gs],
      donut: [ue, Oe, Re, Ue, Se, "sectorLabels", gs],
      line: [ue, Or, _e, Re, Vr, Se],
      scatter: [ue, "shape", "size", Oe, Se],
      bubble: [ue, "shape", "minSize", "maxSize", Oe, Se],
      area: [ue, Or, _e, Re, Ue, Vr, Se, gs],
      histogram: [ue, "bins", Oe, _e, Re, Ue, Se, gs],
      "radial-column": [ue, Oe, _e, Re, Ue, Se],
      "radial-bar": [ue, Oe, _e, Re, Ue, Se],
      "radar-line": [ue, Oe, _e, Re, Vr, Se],
      "radar-area": [ue, Oe, _e, Re, Ue, Vr, Se],
      nightingale: [ue, Oe, _e, Re, Ue, Se],
      "box-plot": [ue, Oe, _e, Re, Ue, "whiskers", "caps"],
      "range-bar": [ue, Oe, _e, Re, Ue, Se],
      "range-area": [ue, Or, _e, Re, Ue, Vr, Se, gs],
      treemap: [ue, "tileSpacing"],
      sunburst: [ue],
      heatmap: [ue, Se, "lineColor", Or, Re],
      waterfall: [ue, "connectorLine", "seriesItems"],
      funnel: [ue, Oe, _e, Re, Ue, Se, "dropoff", Jn, gs],
      "cone-funnel": [ue, Oe, _e, Re, Ue, Se, Jn],
      pyramid: [ue, Oe, _e, Re, Ue, Se, Jn, gs]
    }, this.seriesType = e.seriesType;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const {
      isExpandedOnInit: e,
      chartOptionsService: t,
      chartController: s,
      registerGroupComponent: i
    } = this.options, r = {
      cssIdentifier: "charts-format-top-level",
      direction: "vertical",
      title: this.translate("series"),
      expanded: e,
      suppressEnabledCheckbox: !0
    };
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="seriesGroup">
            </ag-group-component>
        </div>`,
      [ae],
      { seriesGroup: r }
    ), i(this.seriesGroup), this.chartMenuUtils = this.createManagedBean(
      new Oi(t.getSeriesOptionsProxy(() => this.seriesType))
    ), this.addManagedListeners(s, { chartSeriesChartTypeChanged: this.refreshWidgets.bind(this) }), this.refreshWidgets();
  }
  refreshWidgets() {
    const { chartController: e } = this.options;
    this.destroyActivePanels(), e.getChartProxy().getChart().waitForUpdate().then(() => {
      this.isAlive() && (e.isComboChart() && (this.updateSeriesType(), this.initSeriesSelect()), (this.seriesWidgetMappings[this.seriesType] ?? []).forEach((i) => {
        const r = this.widgetFuncs[i]();
        let n;
        if (Array.isArray(r)) {
          const o = this.createBean(r[0]);
          n = o, r[1](o);
        } else
          n = this.createBean(r);
        this.seriesGroup.addItem(n), this.activePanels.push(n);
      }));
    }).catch((s) => j(105, { e: s }));
  }
  initSeriesSelect() {
    const e = this.createBean(
      new st(
        this.chartMenuUtils.getDefaultSelectParamsWithoutValueParams(
          "seriesType",
          this.getSeriesSelectOptions(),
          `${this.seriesType}`,
          (t) => {
            this.seriesType = t, this.refreshWidgets();
          }
        )
      )
    );
    this.seriesGroup.addItem(e), this.activePanels.push(e);
  }
  initLineColor() {
    return new Fv(this.chartMenuUtils.getDefaultColorPickerParams("stroke", "strokeColor"));
  }
  initStrokeWidth(e, t) {
    return new Ct(
      this.chartMenuUtils.getDefaultSliderParams(
        t ? `${t}.${e}` : "strokeWidth",
        e,
        10
      )
    );
  }
  initLineDash(e) {
    return new Ct(
      this.chartMenuUtils.getDefaultSliderParams(
        e ? `${e}.lineDash` : "lineDash",
        "lineDash",
        30,
        !0
      )
    );
  }
  initOpacity(e, t) {
    const s = this.chartMenuUtils.getDefaultSliderParams(t ? `${t}.${e}` : e, e, 1);
    return s.step = 0.05, new Ct(s);
  }
  initDropOff() {
    return [new e5({
      tag: "dropOff",
      cssIdentifier: "charts-format-sub-level",
      title: this.translate("dropOff"),
      suppressEnabledCheckbox: !1,
      chartMenuParamsFactory: this.chartMenuUtils
    }), (s) => {
      [
        this.initStrokeWidth("strokeWidth", "dropOff"),
        this.initLineDash("dropOff"),
        this.initOpacity("strokeOpacity", "dropOff"),
        this.initOpacity("fillOpacity", "dropOff")
      ].forEach((i) => {
        const r = s.createManagedBean(i);
        s.addItem(r), this.activePanels.push(r);
      });
    }];
  }
  initLabels() {
    const e = Cv(this.seriesType), t = e ? "calloutLabel" : "label", s = e ? "calloutLabels" : "labels", i = this.chartMenuUtils.getDefaultFontPanelParams(t, s);
    return [new Qs(i), (o) => {
      if (e) {
        const a = o.createManagedBean(new t5(this.chartMenuUtils));
        o.addItem(a), this.activePanels.push(a);
      }
      if (this.seriesType === "range-bar") {
        const a = [
          { value: "inside", text: this.translate("inside") },
          { value: "outside", text: this.translate("outside") }
        ], l = o.createManagedBean(
          new st(
            this.chartMenuUtils.getDefaultSelectParams("label.placement", "labelPlacement", a)
          )
        );
        o.addItem(l), this.activePanels.push(l);
        const c = o.createManagedBean(
          new Ct(this.chartMenuUtils.getDefaultSliderParams("label.padding", "padding", 200))
        );
        o.addItem(c), this.activePanels.push(c);
      }
    }];
  }
  initSectorLabels() {
    const e = this.chartMenuUtils.getDefaultFontPanelParams("sectorLabel", "sectorLabels");
    return [new Qs(e), (i) => {
      const r = this.chartMenuUtils.getDefaultSliderParams(
        "sectorLabel.positionRatio",
        "positionRatio",
        1
      );
      r.step = 0.05;
      const n = i.createManagedBean(new Ct(r));
      i.addItem(n);
    }];
  }
  initStageLabels() {
    return new Qs(this.chartMenuUtils.getDefaultFontPanelParams("stageLabel", Jn));
  }
  initBins() {
    const e = this.chartMenuUtils.getDefaultSliderParams("binCount", "histogramBinCount", 20), t = this.chartMenuUtils.getChartOptions(), s = (t.getValue("bins") ?? t.getValue("calculatedBins", !0)).length;
    return e.value = `${s}`, e.maxValue = Math.max(s, 20), new Ct(e);
  }
  initShape() {
    return new st(
      this.chartMenuUtils.getDefaultSelectParams("shape", "shape", Iv(this.chartTranslation))
    );
  }
  initSize(e, t) {
    return new Ct(this.chartMenuUtils.getDefaultSliderParams(e, t, 60));
  }
  getSeriesSelectOptions() {
    const e = this.getActiveSeriesTypes();
    return ["area", "bar", "line"].filter((t) => e.includes(t)).map((t) => ({ value: t, text: this.translate(t) }));
  }
  updateSeriesType() {
    const e = this.getActiveSeriesTypes();
    !e.includes(this.seriesType) && e.length > 0 && (this.seriesType = e[0]);
  }
  getActiveSeriesTypes() {
    return this.options.chartController.getActiveSeriesChartTypes().map((e) => de(e.chartType));
  }
  translate(e) {
    return this.chartTranslation.translate(e);
  }
  destroyActivePanels() {
    this.activePanels.forEach((e) => {
      se(e.getGui()), this.destroyBean(e);
    });
  }
  destroy() {
    this.destroyActivePanels(), super.destroy();
  }
}, _r = class extends D {
  constructor(e, t, s) {
    super(
      /* html */
      "<div></div>"
    ), this.chartMenuUtils = e, this.name = t, this.key = s, this.chartOptions = e.getChartOptions();
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    this.initFontPanel();
  }
  hasTitle() {
    const e = this.chartOptions.getValue(this.key);
    return e && e.enabled && e.text && e.text.length > 0;
  }
  initFontPanel() {
    const e = this.hasTitle(), t = {
      name: this.chartTranslation.translate(this.name),
      enabled: e,
      suppressEnabledCheckbox: !1,
      chartMenuParamsFactory: this.chartMenuUtils,
      keyMapper: (s) => `${this.key}.${s}`,
      onEnableChange: (s) => this.onEnableChange(s)
    };
    this.fontPanel = this.createManagedBean(new Qs(t)), this.fontPanel.addItem(this.createBean(new yt(this.getTextInputParams())), !0), this.fontPanel.addItem(this.createBean(new Ct(this.getSpacingSliderParams()))), this.getGui().appendChild(this.fontPanel.getGui());
  }
  getTextInputParams() {
    return this.chartMenuUtils.addValueParams(`${this.key}.text`, {
      label: this.chartTranslation.translate("title"),
      labelAlignment: "top"
    });
  }
  getSpacingSliderParams() {
    return this.chartMenuUtils.getDefaultSliderParams(`${this.key}.spacing`, "spacing", 100);
  }
  onEnableChange(e) {
    this.chartOptions.setValue(`${this.key}.enabled`, e);
  }
}, u5 = class extends _r {
  wireBeans(e) {
    super.wireBeans(e), this.chartMenuSvc = e.chartMenuSvc;
  }
  postConstruct() {
    this.titlePlaceholder = this.chartTranslation.translate("titlePlaceholder"), super.postConstruct(), this.addManagedEventListeners({
      chartTitleEdit: () => {
        this.fontPanel.setEnabled(this.hasTitle());
      }
    });
  }
  getTextInputParams() {
    const e = super.getTextInputParams();
    return this.shouldOverrideTextWithPlaceholder(e.value) && (e.value = this.titlePlaceholder), e;
  }
  getSpacingSliderParams() {
    const e = super.getSpacingSliderParams();
    return e.value = "10", e;
  }
  onEnableChange(e) {
    if (this.chartMenuSvc.doesChartToolbarExist()) {
      const s = this.chartOptions.getValue("padding.top");
      this.chartOptions.setValue("padding.top", e ? s - 20 : s + 20);
    }
    this.chartOptions.setValue(`${this.key}.enabled`, e);
    const t = this.chartOptions.getValue(`${this.key}.text`);
    e && this.shouldOverrideTextWithPlaceholder(t) && this.chartOptions.setValue(`${this.key}.text`, this.titlePlaceholder);
  }
  shouldOverrideTextWithPlaceholder(e) {
    return e === "Title" || (e == null ? void 0 : e.trim().length) === 0;
  }
}, g5 = class extends D {
  constructor(e) {
    super(), this.options = e, this.titleGroup = x;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    const {
      chartMenuParamsFactory: e,
      chartAxisMenuParamsFactory: t,
      chartOptionsService: s,
      seriesType: i,
      isExpandedOnInit: r = !1,
      registerGroupComponent: n
    } = this.options, o = [];
    if (Ys(i) && i !== "pyramid") {
      const l = (c) => this.createManagedBean(
        new Oi(s.getCartesianAxisThemeOverridesProxy(c))
      );
      o.push(
        this.createManagedBean(new _r(l("xAxis"), "horizontalAxisTitle", "title"))
      ), o.push(
        this.createManagedBean(new _r(l("yAxis"), "verticalAxisTitle", "title"))
      );
    } else Tc(i) && o.push(
      this.createManagedBean(new _r(t, "polarAxisTitle", "title"))
    );
    const a = {
      cssIdentifier: "charts-format-top-level",
      direction: "vertical",
      title: this.chartTranslation.translate("chartTitles"),
      expanded: r,
      suppressEnabledCheckbox: !0,
      items: [
        this.createManagedBean(new u5(e, "chartTitle", "title")),
        this.createManagedBean(new _r(e, "chartSubtitle", "subtitle")),
        ...o
      ]
    };
    this.setTemplate(
      /* html */
      `<div>
            <ag-group-component data-ref="titleGroup"></ag-group-component>
        </div>`,
      [ae],
      { titleGroup: a }
    ), n(this.titleGroup);
  }
}, p5 = {
  groups: [{ type: "chart" }, { type: "titles" }, { type: "legend" }, { type: "series" }, { type: "axis" }]
}, hg = ["axis", "horizontalAxis", "verticalAxis"], f5 = class extends D {
  constructor(e) {
    super(
      /* html */
      '<div class="ag-chart-format-wrapper"></div>'
    ), this.chartMenuContext = e;
  }
  postConstruct() {
    this.groupExpansionFeature = this.createManagedBean(new QU(this.getGui())), this.chartPanelFeature = this.createManagedBean(
      new xv(
        this.chartMenuContext.chartController,
        this.getGui(),
        "ag-chart-format-section",
        (e, t) => this.createPanels(t)
      )
    ), this.chartPanelFeature.refreshPanels();
  }
  createPanels(e) {
    var s;
    let t = !1;
    (s = this.getFormatPanelDef().groups) == null || s.forEach(({ type: i, isOpen: r = !1 }) => {
      if (!this.isGroupPanelShownInSeries(i, e))
        return;
      r && (t && F(145, { group: i }), t = !0);
      const n = (a) => this.groupExpansionFeature.addGroupComponent(a), o = {
        ...this.chartMenuContext,
        isExpandedOnInit: r,
        seriesType: e,
        registerGroupComponent: n
      };
      switch (i) {
        case "chart":
          this.chartPanelFeature.addComponent(new ZU(o));
          break;
        case "titles":
          this.chartPanelFeature.addComponent(new g5(o));
          break;
        case "legend":
          this.chartPanelFeature.addComponent(new JU(o, this.chartMenuContext));
          break;
        case "axis":
          Tc(e) ? this.chartPanelFeature.addComponent(new YU(o)) : Ys(e) && (this.chartPanelFeature.addComponent(new Qn("xAxis", o)), this.chartPanelFeature.addComponent(new Qn("yAxis", o)));
          break;
        case "horizontalAxis":
          this.chartPanelFeature.addComponent(new Qn("xAxis", o));
          break;
        case "verticalAxis":
          this.chartPanelFeature.addComponent(new Qn("yAxis", o));
          break;
        case "series":
          this.chartPanelFeature.addComponent(new h5(o));
          break;
        default:
          F(147, { group: i });
      }
    });
  }
  getFormatPanelDef() {
    var t;
    const e = (t = this.gos.get("chartToolPanelsDef")) == null ? void 0 : t.formatPanel;
    return e || p5;
  }
  isGroupPanelShownInSeries(e, t) {
    const s = ["chart", "titles", "legend", "series"].includes(e) || Ys(t) && hg.includes(e) || Tc(t) && e === "axis", i = Ec(t) && e === "legend" || Ec(t) && hg.includes(e);
    return s && !i;
  }
}, m5 = "ag-chart-mini-thumbnail-canvas", zi = class extends D {
  constructor(e, t, s) {
    super(), this.agChartsExports = t, this.tooltipName = s, this.size = 58, this.padding = 5;
    const { _Scene: i } = t;
    this.root = new i.Group();
    const r = new i.Scene({
      width: this.size,
      height: this.size
    });
    r.canvas.element.classList.add(m5), r.setRoot(this.root), r.setContainer(e), this.scene = r;
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    this.scene.canvas.element.title = this.chartTranslation.translate(this.tooltipName);
    try {
      this.scene.render();
    } catch (e) {
      j(108, { e });
    }
  }
};
function In(e) {
  const {
    stacked: t,
    size: s,
    padding: i,
    xScalePadding: r,
    xScaleDomain: n,
    yScaleDomain: o,
    agChartsExports: { _Scene: a }
  } = e, l = new a.CategoryScale();
  l.domain = n, l.range = [i, s - i], l.paddingInner = r, l.paddingOuter = r;
  const c = new a.LinearScale();
  c.domain = o, c.range = [s - i, i];
  const d = (h, u, g) => h.map((p, f) => {
    const m = g.convert(p), C = new a.Rect();
    return C.x = u.convert(f), C.y = m, C.width = u.bandwidth, C.height = g.convert(0) - m, C.strokeWidth = 0, C.crisp = !0, C;
  });
  return t ? e.data.map((h) => d(h, l, c)) : d(e.data, l, c);
}
function C5(e, t, s, i) {
  const r = [], n = [];
  t.forEach((l) => {
    l.forEach(([c, d]) => {
      r.push(c), n.push(d);
    });
  });
  const o = new e.LinearScale();
  o.domain = [Math.min(...r), Math.max(...r)], o.range = [i, s - i];
  const a = new e.LinearScale();
  return a.domain = [Math.min(...n), Math.max(...n)], a.range = [s - i, i], { xScale: o, yScale: a };
}
function Lv(e, t, s, i) {
  const r = [0, t[0].length - 1], n = t.reduce(
    (l, c) => (c.forEach((d) => {
      d < l[0] && (l[0] = d), d > l[1] && (l[1] = d);
    }), l),
    [1 / 0, -1 / 0]
  );
  n[0]--, n[n.length - 1]++;
  const o = new e.LinearScale();
  o.domain = r, o.range = [i, s - i];
  const a = new e.LinearScale();
  return a.domain = n, a.range = [s - i, i], { xScale: o, yScale: a };
}
function kv(e, t, s) {
  return e.map(
    (i) => i.map((r, n) => [
      n > 0 ? "lineTo" : "moveTo",
      t.convert(n),
      s.convert(r)
    ])
  );
}
function v5(e, t, s) {
  return e.map(([i, r], n) => [n > 0 ? "lineTo" : "moveTo", t.convert(i), s.convert(r)]);
}
function w5(e) {
  const t = e[0], s = e[1], i = _(e);
  return (s[1] !== i[1] || s[2] !== i[2]) && e.push([t[0], s[1], s[2]]), e;
}
function Gv(e, t) {
  const s = new e.Path();
  return t.forEach(([i, r, n]) => s.path[i](r, n)), s;
}
function b5(e, t, s) {
  return e.map((i, r, n) => {
    const a = [...s ? y5(n, r, t) : Ov(i, t)].reverse().map(([d, h, u]) => ["lineTo", h, u]), l = i[0], c = _(a);
    return (l[1] !== c[1] || l[2] !== c[2]) && a.push(["lineTo", l[1], l[2]]), [...i, ...a];
  });
}
function y5(e, t, s) {
  return t === 0 ? Ov(e[t], s) : [...e[t - 1]];
}
function Ov(e, t) {
  return e.map(([s, i]) => [s, i, t.convert(0)]);
}
function Vv(e, t) {
  const s = Gv(e, t);
  return s.fill = void 0, s.lineCap = "round", s.strokeWidth = 3, s;
}
function S5({ _Scene: e }, t, s, i, r) {
  const { xScale: n, yScale: o } = C5(e, s, i, r), d = s.map((u) => v5(u, n, o)).map((u) => w5(u)).map((u) => Vv(e, u)).reduce((u, g) => u.concat(g), []), h = new e.Group();
  return h.setClipRect(new e.BBox(r, r, i - r * 2, i - r * 2)), h.append(d), t.append(h), d;
}
function sh({ _Scene: e }, t, s, i, r) {
  const { xScale: n, yScale: o } = Lv(e, s, i, r), l = kv(s, n, o).map((d) => Vv(e, d)), c = new e.Group();
  return c.setClipRect(new e.BBox(r, r, i - r * 2, i - r * 2)), c.append(l), t.append(c), l;
}
function x5(e, t, s, i, r, n = !1) {
  const { xScale: o, yScale: a } = Lv(e, s, i, r), l = b5(kv(s, o, a), a, n), c = new e.Group();
  c.setClipRect(new e.BBox(r, r, i - r * 2, i - r * 2));
  const d = l.map((h) => Gv(e, h));
  return c.append(d), t.append(c), d;
}
function Bv(e) {
  return e.map(
    (t, s, i) => t.map((r, n) => i.slice(0, s + 1).reduce((o, a) => o + a[n], 0))
  );
}
function Nv(e) {
  const t = e.map((s, i) => e.reduce((r, n) => Math.max(r, n[i]), 0));
  return e.map((s) => s.map((i, r) => i / t[r] * 19));
}
function Hv(e, t, s, i, r, n, o = 0) {
  const { _Scene: a } = e, l = new a.LinearScale();
  l.domain = [0, 7], l.range = [-Math.PI, Math.PI].map((p) => p + Math.PI / 2);
  const c = new a.LinearScale();
  c.domain = [0, 10], c.range = [r, n];
  const d = [], h = i / 2, u = s.map((p) => {
    const f = new a.Path();
    return f.strokeWidth = 1, f.strokeOpacity = 0.5, f.lineCap = "round", f.fill = void 0, f.fillOpacity = 0.8, p.forEach((m, C) => {
      const v = l.convert(C), w = r + n - c.convert(m), b = w * Math.cos(v) + h, y = w * Math.sin(v) + h;
      if (f.path[C > 0 ? "lineTo" : "moveTo"](b, y), o > 0) {
        const P = new a.Marker({ shape: "circle" });
        P.x = b, P.y = y, P.size = o, d.push(P);
      }
    }), f.path.closePath(), f;
  }), g = new a.Group();
  return g.append([...u, ...d]), t.append(g), { paths: u, markers: d };
}
function Va(e) {
  let [t, s] = [1 / 0, -1 / 0];
  return { processedData: e.reduce((r, n, o) => {
    const a = o > 0 ? r[o - 1] : void 0;
    r[o] ?? (r[o] = []);
    const l = r[o];
    return n.forEach((c, d) => {
      a && (c += a[d]), l[d] = c, l[d] < t && (t = l[d]), l[d] > s && (s = l[d]);
    }), r;
  }, []), min: t, max: s };
}
var F5 = [
  [
    [13, 16],
    [13, 12],
    [3, 12],
    [3, 16]
  ],
  [
    [12, 11],
    [12, 7],
    [4, 7],
    [4, 11]
  ],
  [
    [10.125, 6],
    [10.125, 1.5],
    [5.875, 1.5],
    [5.875, 6]
  ]
], ih = class extends zi {
  constructor(e, t, s, i, r, n = "funnelTooltip", o = F5) {
    super(e, t, n), this.shapes = S5(t, this.root, o, this.size, this.padding), this.updateColors(s, i);
  }
  updateColors(e, t) {
    this.shapes.forEach((s) => {
      s.fill = e[0], s.stroke = t[0], s.strokeWidth = 0;
    });
  }
}, R5 = {
  chartType: "funnel",
  miniChart: ih
}, P5 = [
  [
    [13, 16],
    [10.75, 11.5],
    [5.25, 11.5],
    [3, 16]
  ],
  [
    [10.75, 11.5],
    [8.875, 6],
    [7.125, 6],
    [5.25, 11.5]
  ],
  [
    [8.875, 6],
    [8.875, 1.5],
    [7.125, 1.5],
    [7.125, 6]
  ]
], E5 = class extends ih {
  constructor(e, t, s, i, r, n = "coneFunnelTooltip") {
    super(e, t, s, i, r, n, P5);
  }
  updateColors(e, t) {
    this.shapes.forEach((s, i) => {
      s.fill = e[0], s.fillOpacity = 1 - i * 0.2, s.stroke = t[0], s.strokeWidth = 0;
    });
  }
}, T5 = {
  chartType: "coneFunnel",
  miniChart: E5
}, M5 = [
  [
    [8, 16],
    [10, 12],
    [6, 12]
  ],
  [
    [10.5, 11],
    [12.5, 7],
    [3.5, 7],
    [5.5, 11]
  ],
  [
    [13, 6],
    [15.5, 1.5],
    [0.5, 1.5],
    [3, 6]
  ]
], D5 = class extends ih {
  constructor(e, t, s, i, r, n = "pyramidTooltip") {
    super(e, t, s, i, r, n, M5);
  }
  updateColors(e, t) {
    this.shapes.forEach((s, i) => {
      s.fill = e[i], s.stroke = t[i], s.strokeWidth = 0;
    });
  }
}, A5 = {
  chartType: "pyramid",
  miniChart: D5
}, nt = class extends zi {
  constructor(e, t, s) {
    super(e, t, s), this.stroke = "gray", this.axisOvershoot = 3;
  }
  postConstruct() {
    const { _Scene: e } = this.agChartsExports, t = this.size, s = this.padding, i = new e.Line();
    i.x1 = s, i.y1 = s, i.x2 = s, i.y2 = t - s + this.axisOvershoot, i.stroke = this.stroke;
    const r = new e.Line();
    r.x1 = s - this.axisOvershoot + 1, r.y1 = t - s, r.x2 = t - s + 1, r.y2 = t - s, r.stroke = this.stroke;
    const n = this.root;
    n.append(i), n.append(r), super.postConstruct();
  }
}, I5 = class extends nt {
  constructor(e, t, s, i) {
    super(e, t, "groupedColumnTooltip"), this.columnData = [2, 3, 4];
    const { root: r, columnData: n, size: o, padding: a } = this;
    this.columns = In({
      stacked: !1,
      data: n,
      size: o,
      padding: a,
      xScaleDomain: [0, 1, 2],
      yScaleDomain: [0, 4],
      xScalePadding: 0.3,
      agChartsExports: t
    }), r.append(this.columns), this.updateColors(s, i);
  }
  updateColors(e, t) {
    this.columns.forEach((s, i) => {
      s.fill = e[i], s.stroke = t[i];
    });
  }
}, L5 = {
  chartType: "groupedColumn",
  miniChart: I5
}, k5 = [
  [8, 12, 16],
  [6, 9, 12],
  [2, 3, 4]
], zv = class extends nt {
  constructor(e, t, s, i, r, n = k5, o = [0, 16], a = "stackedColumnTooltip") {
    super(e, t, a);
    const { root: l, size: c, padding: d } = this;
    this.stackedColumns = In({
      stacked: !0,
      data: n,
      size: c,
      padding: d,
      xScaleDomain: [0, 1, 2],
      yScaleDomain: o,
      xScalePadding: 0.3,
      agChartsExports: t
    }), l.append(ap(this.stackedColumns)), this.updateColors(s, i);
  }
  updateColors(e, t) {
    this.stackedColumns.forEach(
      (s, i) => s.forEach((r) => {
        r.fill = e[i], r.stroke = t[i];
      })
    );
  }
}, G5 = {
  chartType: "stackedColumn",
  miniChart: zv
}, O5 = [
  [10, 10, 10],
  [6, 7, 8],
  [2, 4, 6]
], V5 = class extends zv {
  constructor(e, t, s, i, r) {
    super(
      e,
      t,
      s,
      i,
      r,
      O5,
      [0, 10],
      "normalizedColumnTooltip"
    );
  }
}, B5 = {
  chartType: "normalizedColumn",
  miniChart: V5
}, N5 = class extends nt {
  constructor(e, t, s, i) {
    super(e, t, "groupedBarTooltip");
    const { _Scene: r } = t, n = this.padding, o = this.size, a = [2, 3, 4], l = new r.CategoryScale();
    l.domain = [0, 1, 2], l.range = [n, o - n], l.paddingInner = 0.3, l.paddingOuter = 0.3;
    const c = new r.LinearScale();
    c.domain = [0, 4], c.range = [o - n, n];
    const d = c.convert(0), h = l.bandwidth;
    this.bars = a.map((u, g) => {
      const p = new r.Rect();
      return p.x = n, p.y = l.convert(g), p.width = d - c.convert(u), p.height = h, p.strokeWidth = 0, p.crisp = !0, p;
    }), this.updateColors(s, i), this.root.append(this.bars);
  }
  updateColors(e, t) {
    this.bars.forEach((s, i) => {
      s.fill = e[i], s.stroke = t[i];
    });
  }
}, H5 = {
  chartType: "groupedBar",
  miniChart: N5
}, z5 = [
  [8, 12, 16],
  [6, 9, 12],
  [2, 3, 4]
], Wv = class extends nt {
  constructor(e, t, s, i, r, n = z5, o = [0, 16], a = "stackedBarTooltip") {
    super(e, t, a);
    const { _Scene: l } = t, c = this.size, d = this.padding, h = new l.CategoryScale();
    h.domain = [0, 1, 2], h.range = [d, c - d], h.paddingInner = 0.3, h.paddingOuter = 0.3;
    const u = new l.LinearScale();
    u.domain = o, u.range = [c - d, d];
    const g = u.convert(0), p = h.bandwidth;
    this.bars = n.map(
      (f) => f.map((m, C) => {
        const v = new l.Rect();
        return v.x = d, v.y = h.convert(C), v.width = g - u.convert(m), v.height = p, v.strokeWidth = 0, v.crisp = !0, v;
      })
    ), this.updateColors(s, i), this.root.append(ap(this.bars));
  }
  updateColors(e, t) {
    this.bars.forEach(
      (s, i) => s.forEach((r) => {
        r.fill = e[i], r.stroke = t[i];
      })
    );
  }
}, W5 = {
  chartType: "stackedBar",
  miniChart: Wv
}, _5 = [
  [10, 10, 10],
  [6, 7, 8],
  [2, 4, 6]
], U5 = class extends Wv {
  constructor(e, t, s, i, r) {
    super(
      e,
      t,
      s,
      i,
      r,
      _5,
      [0, 10],
      "normalizedBarTooltip"
    );
  }
}, $5 = {
  chartType: "normalizedBar",
  miniChart: U5
}, _v = class extends zi {
  constructor(e, t, s, i, r, n = 0.6, o = "donutTooltip") {
    super(e, t, o);
    const {
      size: a,
      padding: l,
      agChartsExports: { _Scene: c }
    } = this, d = (a - l * 2) / 2, h = d + l, u = c.toRadians, g = [
      [u(-90), u(30)],
      [u(30), u(120)],
      [u(120), u(180)],
      [u(180), u(210)],
      [u(210), u(240)],
      [u(240), u(270)]
    ];
    this.sectors = g.map(([p, f]) => {
      const m = new c.Sector();
      return m.centerX = h, m.centerY = h, m.innerRadius = d * n, m.outerRadius = d, m.startAngle = p, m.endAngle = f, m.stroke = void 0, m.strokeWidth = 0, m.inset = 0.75, m;
    }), this.updateColors(s, i), this.root.append(this.sectors);
  }
  updateColors(e, t) {
    this.sectors.forEach((s, i) => {
      s.fill = e[i % e.length], s.stroke = t[i % t.length];
    });
  }
}, ug = {
  chartType: "donut",
  miniChart: _v
}, K5 = class extends _v {
  constructor(e, t, s, i, r) {
    super(e, t, s, i, r, 0, "pieTooltip");
  }
}, j5 = {
  chartType: "pie",
  miniChart: K5
}, rh = [
  [1, 3, 5],
  [2, 6, 4],
  [5, 3, 1]
], nh = class extends nt {
  constructor(e, t, s, i, r, n = rh, o = "lineTooltip") {
    super(e, t, o);
    const { size: a, padding: l, root: c } = this;
    this.lines = sh(t, c, n, a, l), this.updateColors(s, i);
  }
  updateColors(e, t) {
    this.lines.forEach((s, i) => {
      s.stroke = e[i];
    });
  }
}, Y5 = {
  chartType: "line",
  miniChart: nh
}, Uv = Bv(rh), q5 = class extends nh {
  constructor(e, t, s, i, r, n = Uv, o = "stackedLineTooltip") {
    super(e, t, s, i, r, n, o);
  }
}, X5 = {
  chartType: "stackedLine",
  miniChart: q5
}, Z5 = Nv(Uv), Q5 = class extends nh {
  constructor(e, t, s, i, r, n = Z5, o = "normalizedLineTooltip") {
    super(e, t, s, i, r, n, o);
  }
}, J5 = {
  chartType: "normalizedLine",
  miniChart: Q5
}, e3 = class extends nt {
  constructor(e, t, s, i) {
    super(e, t, "scatterTooltip");
    const {
      size: r,
      padding: n,
      agChartsExports: { _Scene: o }
    } = this, a = [
      [
        [0.3, 3],
        [1.1, 0.9],
        [2, 0.4],
        [3.4, 2.4]
      ],
      [
        [0, 0.3],
        [1, 2],
        [2.4, 1.4],
        [3, 0]
      ]
    ], l = new o.LinearScale();
    l.domain = [-0.5, 4], l.range = [n * 2, r - n];
    const c = new o.LinearScale();
    c.domain = [-0.5, 3.5], c.range = [r - n, n];
    const d = [];
    a.forEach((u) => {
      u.forEach(([g, p]) => {
        const f = new o.Arc();
        f.strokeWidth = 0, f.centerX = l.convert(g), f.centerY = c.convert(p), f.radius = 2.5, d.push(f);
      });
    }), this.points = d, this.updateColors(s, i);
    const h = new o.Group();
    h.setClipRect(new o.BBox(n, n, r - n * 2, r - n * 2)), h.append(this.points), this.root.append(h);
  }
  updateColors(e, t) {
    this.points.forEach((s, i) => {
      s.stroke = t[i % t.length], s.fill = e[i % e.length];
    });
  }
}, t3 = {
  chartType: "scatter",
  miniChart: e3
}, s3 = class extends nt {
  constructor(e, t, s, i) {
    super(e, t, "bubbleTooltip");
    const {
      size: r,
      padding: n,
      agChartsExports: { _Scene: o }
    } = this, a = [
      [
        [0.1, 0.3, 5],
        [0.5, 0.4, 7],
        [0.2, 0.8, 7]
      ],
      [
        [0.8, 0.7, 5],
        [0.7, 0.3, 9]
      ]
    ], l = new o.LinearScale();
    l.domain = [0, 1], l.range = [n * 2, r - n];
    const c = new o.LinearScale();
    c.domain = [0, 1], c.range = [r - n, n];
    const d = [];
    a.forEach((u) => {
      u.forEach(([g, p, f]) => {
        const m = new o.Arc();
        m.strokeWidth = 0, m.centerX = l.convert(g), m.centerY = c.convert(p), m.radius = f, m.fillOpacity = 0.7, d.push(m);
      });
    }), this.points = d, this.updateColors(s, i);
    const h = new o.Group();
    h.setClipRect(new o.BBox(n, n, r - n * 2, r - n * 2)), h.append(this.points), this.root.append(h);
  }
  updateColors(e, t) {
    this.points.forEach((s, i) => {
      s.stroke = t[i % t.length], s.fill = e[i % e.length];
    });
  }
}, i3 = {
  chartType: "bubble",
  miniChart: s3
}, $v = rh, Kv = class extends nt {
  constructor(e, t, s, i, r, n = $v, o = "groupedAreaTooltip", a = !1) {
    super(e, t, o), this.areas = x5(t._Scene, this.root, n, this.size, this.padding, a), this.updateColors(s, i);
  }
  updateColors(e, t) {
    this.areas.forEach((s, i) => {
      s.fill = e[i], s.stroke = t[i], s.strokeWidth = 1, s.strokeOpacity = 0.75, s.fillOpacity = 0.7;
    });
  }
}, r3 = {
  chartType: "area",
  miniChart: Kv
}, jv = Bv($v), Yv = class extends Kv {
  constructor(e, t, s, i, r, n = jv, o = "stackedAreaTooltip") {
    super(e, t, s, i, r, n, o, !0);
  }
  updateColors(e, t) {
    this.areas.forEach((s, i) => {
      s.fill = e[i], s.stroke = t[i];
    });
  }
}, n3 = {
  chartType: "stackedArea",
  miniChart: Yv
}, o3 = Nv(jv), a3 = class extends Yv {
  constructor(e, t, s, i, r, n = o3, o = "normalizedAreaTooltip") {
    super(e, t, s, i, r, n, o);
  }
}, l3 = {
  chartType: "normalizedArea",
  miniChart: a3
}, c3 = class extends nt {
  constructor(e, t, s, i) {
    super(e, t, "histogramTooltip");
    const {
      padding: r,
      size: n,
      agChartsExports: { _Scene: o }
    } = this, a = [2, 5, 11, 13, 10, 6, 1], l = new o.LinearScale();
    l.domain = [0, a.length], l.range = [r, n - r];
    const c = new o.LinearScale();
    c.domain = [0, a.reduce((h, u) => Math.max(h, u), 0)], c.range = [n - r, r];
    const d = c.convert(0);
    this.bars = a.map((h, u) => {
      const g = c.convert(h), p = l.convert(u), f = l.convert(u + 1), m = new o.Rect();
      return m.x = p, m.y = g, m.width = f - p, m.height = d - g, m.strokeWidth = 1, m.strokeOpacity = 0.75, m.crisp = !0, m;
    }), this.updateColors(s, i), this.root.append(this.bars);
  }
  updateColors([e], [t]) {
    this.bars.forEach((s) => {
      s.fill = e, s.stroke = t;
    });
  }
}, d3 = {
  chartType: "histogram",
  miniChart: c3
}, Fr = class extends zi {
  constructor(e, t, s) {
    super(e, t, s), this.stroke = "gray", this.showRadiusAxisLine = !0, this.showAngleAxisLines = !0;
  }
  postConstruct() {
    const { _Scene: e } = this.agChartsExports, t = this.size, s = this.padding, i = s * 2, r = (t - i) / 2, n = this.showAngleAxisLines ? [r, r * 0.8, r * 0.6, r * 0.4] : [], o = new e.Line();
    o.x1 = t / 2, o.y1 = s, o.x2 = t / 2, o.y2 = t - s - r - n[n.length - 1], o.stroke = this.stroke, o.strokeOpacity = 0.5, o.fill = void 0, o.visible = this.showRadiusAxisLine;
    const a = s + r;
    this.gridLines = n.map((c, d) => {
      const h = new e.Path();
      return h.path.arc(a, a, c, 0, 2 * Math.PI), h.strokeWidth = 1, h.stroke = this.stroke, h.strokeOpacity = d === 0 ? 0.5 : 0.2, h.fill = void 0, h;
    });
    const l = this.root;
    l.append(o), this.gridLines.length > 0 && l.append(this.gridLines), super.postConstruct();
  }
}, h3 = class extends Fr {
  constructor(e, t, s, i) {
    super(e, t, "radialColumnTooltip"), this.data = [
      [6, 8, 10, 2, 6, 5],
      [4, 4, 3, 6, 4, 4],
      [5, 4, 2, 9, 8, 9]
    ], this.showRadiusAxisLine = !1;
    const {
      padding: r,
      size: n,
      data: o,
      agChartsExports: { _Scene: a }
    } = this, l = (n - r * 2) / 2, d = l * 0.4, h = new a.CategoryScale();
    h.domain = o[0].map((C, v) => v), h.range = [0, 2 * Math.PI], h.paddingInner = 0, h.paddingOuter = 0;
    const u = h.bandwidth * 0.7, { processedData: g, max: p } = Va(o), f = new a.LinearScale();
    f.domain = [0, p], f.range = [d, l];
    const m = this.size / 2;
    this.series = g.map((C, v) => {
      const b = v === 0 ? void 0 : g[v - 1], y = new a.TranslatableGroup({ zIndex: 1e6 }), P = C.map((E, M) => {
        const T = b == null ? void 0 : b[M], G = f.convert(E), I = f.convert(T ?? 0), L = h.convert(M), $ = L + u, z = a.getRadialColumnWidth(L, $, l, 0.5, 0.5), W = new a.RadialColumnShape();
        return W.columnWidth = z, W.innerRadius = I, W.outerRadius = G, W.startAngle = L, W.endAngle = $, W.isBeveled = !0, W.axisInnerRadius = d, W.axisOuterRadius = l, W.stroke = void 0, W.strokeWidth = 0, W;
      });
      return y.append(P), y.translationX = m, y.translationY = m, y;
    }), this.root.append(this.series), this.updateColors(s, i);
  }
  updateColors(e, t) {
    this.series.forEach((s, i) => {
      for (const r of s.children())
        r.fill = e[i % e.length], r.stroke = t[i % t.length];
    });
  }
}, u3 = {
  chartType: "radialColumn",
  miniChart: h3
}, g3 = class extends Fr {
  constructor(e, t, s, i) {
    super(e, t, "radialBarTooltip"), this.data = [
      [6, 8, 10],
      [4, 4, 3],
      [5, 4, 2]
    ], this.showRadiusAxisLine = !1;
    const {
      size: r,
      padding: n,
      data: o,
      agChartsExports: { _Scene: a }
    } = this, l = (r - n) / 2, d = l * 0.4, h = new a.CategoryScale();
    h.domain = o[0].map((w, b) => b), h.range = [d, l], h.paddingInner = 0.5, h.paddingOuter = 0;
    const u = h.bandwidth, { processedData: g, max: p } = Va(o), f = new a.LinearScale();
    f.domain = [0, Math.ceil(p * 1.5)];
    const m = 3 / 2 * Math.PI, C = m + 2 * Math.PI;
    f.range = [m, C];
    const v = r / 2;
    this.series = g.map((w, b) => {
      const y = b < 0 ? void 0 : g[b - 1], P = new a.Group({ zIndex: 1e6 }), E = w.map((M, T) => {
        const G = (y == null ? void 0 : y[T]) ?? 0, I = h.convert(T), L = I - u, $ = f.convert(G), z = f.convert(M), W = new a.Sector();
        return W.centerX = v, W.centerY = v, W.innerRadius = L, W.outerRadius = I, W.startAngle = $, W.endAngle = z, W.stroke = void 0, W.strokeWidth = 0, W;
      });
      return P.append(E), P;
    }), this.root.append(this.series), this.updateColors(s, i);
  }
  updateColors(e, t) {
    this.series.forEach((s, i) => {
      for (const r of s.children())
        r.fill = e[i % e.length], r.stroke = t[i % t.length];
    });
  }
}, p3 = {
  chartType: "radialBar",
  miniChart: g3
}, f3 = class extends Fr {
  constructor(e, t, s, i) {
    super(e, t, "radarLineTooltip"), this.markerSize = 4, this.data = [
      [8, 7, 8, 7, 8, 8, 7, 8],
      [6, 8, 5, 10, 6, 7, 4, 6],
      [0, 3, 3, 5, 4, 4, 2, 0]
    ], this.showRadiusAxisLine = !1;
    const { size: r, padding: n, root: o, data: a } = this, l = (r - n * 2) / 2, c = 0, { paths: d, markers: h } = Hv(
      t,
      o,
      a,
      r,
      l,
      c,
      this.markerSize
    );
    this.lines = d, this.markers = h, this.updateColors(s, i);
  }
  updateColors(e, t) {
    this.lines.forEach((s, i) => {
      const r = this.data[i].length;
      s.stroke = e[i];
      const n = i * r, o = n + r;
      this.markers.slice(n, o).forEach((l) => {
        l.stroke = t[i], l.fill = e[i];
      });
    });
  }
}, m3 = {
  chartType: "radarLine",
  miniChart: f3
}, C3 = class extends Fr {
  constructor(e, t, s, i) {
    super(e, t, "radarAreaTooltip"), this.data = [
      [8, 10, 5, 7, 4, 1, 5, 8],
      [1, 1, 2, 7, 7, 8, 10, 1],
      [4, 5, 9, 9, 4, 2, 3, 4]
    ];
    const { size: r, padding: n, root: o, data: a } = this;
    this.showRadiusAxisLine = !1;
    const l = (r - n * 2) / 2, c = l - r * 0.3;
    this.areas = Hv(t, o, a, r, l, c).paths, this.updateColors(s, i);
  }
  updateColors(e, t) {
    this.areas.forEach((s, i) => {
      s.fill = e[i], s.stroke = t[i];
    });
  }
}, v3 = {
  chartType: "radarArea",
  miniChart: C3
}, w3 = class extends Fr {
  constructor(e, t, s, i) {
    super(e, t, "nightingaleTooltip"), this.data = [
      [6, 10, 9, 8, 7, 8],
      [4, 6, 5, 4, 5, 5],
      [3, 5, 4, 3, 4, 7]
    ], this.showRadiusAxisLine = !1;
    const {
      size: r,
      padding: n,
      data: o,
      agChartsExports: { _Scene: a }
    } = this, l = (r - n * 2) / 2, c = new a.CategoryScale();
    c.domain = o[0].map((f, m) => m), c.range = [-Math.PI, Math.PI], c.paddingInner = 0, c.paddingOuter = 0;
    const d = c.bandwidth * 0.7, { processedData: h, max: u } = Va(o), g = new a.LinearScale();
    g.domain = [0, u], g.range = [0, l];
    const p = r / 2;
    this.series = h.map((f, m) => {
      const C = m < 0 ? void 0 : h[m - 1], v = new a.Group({ zIndex: 1e6 }), w = f.map((b, y) => {
        const P = C == null ? void 0 : C[y], E = g.convert(b), M = g.convert(P ?? 0), T = c.convert(y), G = T + d, I = new a.Sector();
        return I.centerX = p, I.centerY = p, I.innerRadius = M, I.outerRadius = E, I.startAngle = T, I.endAngle = G, I.stroke = void 0, I.strokeWidth = 0, I;
      });
      return v.append(w), v;
    }), this.root.append(this.series), this.updateColors(s, i);
  }
  updateColors(e, t) {
    this.series.forEach((s, i) => {
      for (const r of s.children())
        r.fill = e[i % e.length], r.stroke = t[i % t.length];
    });
  }
}, b3 = {
  chartType: "nightingale",
  miniChart: w3
}, y3 = class extends nt {
  constructor(e, t, s, i) {
    super(e, t, "rangeBarTooltip");
    const r = [3, 3.5, 3];
    this.bars = this.createRangeBar(this.root, r, this.size, this.padding, "vertical"), this.updateColors(s, i);
  }
  updateColors(e, t) {
    this.bars.forEach((s, i) => {
      s.fill = e[i], s.stroke = t[i];
    });
  }
  createRangeBar(e, t, s, i, r) {
    const n = r === "horizontal", o = 2 * i, { _Scene: a } = this.agChartsExports, l = new a.CategoryScale();
    l.domain = t.map((p, f) => f), l.range = [i, s - i], l.paddingInner = 0.3, l.paddingOuter = 0.3;
    const c = 0.7, d = 1.3, h = new a.LinearScale();
    h.domain = [
      t.reduce((p, f) => Math.min(p, f), 1 / 0) * c,
      t.reduce((p, f) => Math.max(p, f), 0) * d
    ], h.range = [o, s - o];
    const u = l.bandwidth, g = t.map((p, f) => {
      const [m, C] = [p * c, p * d], v = l.convert(f), w = h.convert(m), b = h.convert(C) - w, y = new a.Rect();
      return y.x = n ? w : v, y.y = n ? v : w, y.width = n ? b : u, y.height = n ? u : b, y.strokeWidth = 0, y.crisp = !0, y;
    });
    return e.append(g), g;
  }
}, S3 = {
  chartType: "rangeBar",
  miniChart: y3
}, x3 = class extends nt {
  constructor(e, t, s, i) {
    super(e, t, "rangeAreaTooltip");
    const r = 4, n = [
      Gl({ offset: 0.375 * r, length: r, pattern: { low: 3, high: 5, period: r } }),
      Gl({ offset: 0.375 * r, length: r, pattern: { low: 2.25, high: 4.25, period: r } }),
      Gl({ offset: 0.75 * r, length: r, pattern: { low: 2.5, high: 4.5, period: r } })
    ], o = 1.75, a = n.map(
      (d) => d.map(([h, u]) => ({
        x: h,
        low: u - 0.5 * o,
        high: u + 0.5 * o
      }))
    ), { lines: l, areas: c } = this.createRangeArea(this.root, a, this.size, this.padding);
    this.lines = l, this.areas = c, this.updateColors(s, i);
  }
  updateColors(e, t) {
    e = pg(e, 1, 2), t = pg(t, 1, 2), this.lines.forEach(([s, i], r) => {
      s.fill = void 0, s.stroke = t[r], i.fill = void 0, i.stroke = t[r];
    }), this.areas.forEach((s, i) => {
      s.fill = e[i];
    });
  }
  createRangeArea(e, t, s, i) {
    const r = t.reduce((f, m) => m.reduce((C, { x: v }) => Math.min(C, v), f), 1 / 0), n = t.reduce((f, m) => m.reduce((C, { x: v }) => Math.max(C, v), f), -1 / 0), o = t.reduce((f, m) => m.reduce((C, { low: v }) => Math.min(C, v), f), 1 / 0), a = t.reduce(
      (f, m) => m.reduce((C, { high: v }) => Math.max(C, v), f),
      -1 / 0
    ), { _Scene: l } = this.agChartsExports, c = new l.LinearScale();
    c.domain = [r, n], c.range = [i, s - i];
    const d = 2 * i, h = new l.LinearScale();
    h.domain = [o, a], h.range = [s - d, d];
    const u = [], g = [];
    return t.map((f) => {
      const m = new l.Path(), C = new l.Path(), v = new l.Path();
      return u.push([m, C]), g.push(v), m.strokeWidth = 0, C.strokeWidth = 0, v.strokeWidth = 0, v.fillOpacity = 0.8, m.path.clear(), C.path.clear(), v.path.clear(), f.map((w, b) => {
        const { x: y, low: P, high: E } = w, M = c.convert(y), T = h.convert(P), G = h.convert(E), I = b > 0 ? "lineTo" : "moveTo";
        return m.path[I](M, G), C.path[I](M, T), v.path[I](M, G), [M, T];
      });
    }).forEach((f, m) => {
      const C = f.length - 1, v = g[m];
      for (let w = C; w >= 0; w--) {
        const [b, y] = f[w];
        v.path.lineTo(b, y);
      }
    }), e.append(g.concat(...u)), { lines: u, areas: g };
  }
};
function Gl(e) {
  const { offset: t, length: s, pattern: i } = e, r = a(t, s, i), n = 0, o = s;
  return (r.length === 0 || r[0][0] !== n) && r.unshift(l(n, t, i)), r[r.length - 1][0] !== o && r.push(l(o, t, i)), r;
  function a(d, h, u) {
    const { period: g } = u, p = d / g, m = [0, 0.5].map((v) => v - p).map(gg).sort((v, w) => v - w);
    return Array.from(
      { length: Math.floor(m.length * (g / h)) },
      (v, w) => m[w % m.length] + Math.floor(w / m.length)
    ).map((v) => v * g).map((v) => l(v, d, u));
  }
  function l(d, h, u) {
    return [d, c(h + d, u)];
  }
  function c(d, h) {
    const { low: u, high: g, period: p } = h, f = gg(d / p), m = f > 0.5 ? 1 - 2 * (f - 0.5) : 2 * f;
    return u + (g - u) * m;
  }
}
function gg(e) {
  const t = e % 1;
  return t < 0 ? t + 1 : t;
}
function pg(e, t, s) {
  const i = [...e], r = i[t];
  return i[t] = i[s], i[s] = r, i;
}
var F3 = {
  chartType: "rangeArea",
  miniChart: x3
}, R3 = class extends nt {
  constructor(e, t, s, i, r) {
    super(e, t, "boxPlotTooltip");
    const {
      size: n,
      padding: o,
      agChartsExports: { _Scene: a }
    } = this, l = [11, 11.5, 10.5], c = 1.2, d = 1.1, h = 0.9, u = 0.8, g = new a.LinearScale();
    g.domain = [
      l.reduce((C, v) => Math.min(C, v), 1 / 0) * u,
      l.reduce((C, v) => Math.max(C, v), 0) * c
    ], g.range = [n - 1.5 * o, o];
    const p = new a.CategoryScale();
    p.domain = l.map((C, v) => v), p.range = [o, n - o], p.paddingInner = 0.4, p.paddingOuter = 0.2;
    const f = Math.round(p.bandwidth), m = Math.round(p.bandwidth / 2);
    this.boxPlotGroups = l.map((C, v) => {
      const [w, b, y, P] = [
        C * u,
        C * h,
        C * d,
        C * c
      ], E = Math.round(g.convert(y)), M = Math.round(p.convert(v)), T = Math.round(M + f), G = Math.round(g.convert(b)), I = Math.round(g.convert(w)), L = Math.round(g.convert(C)), $ = Math.round(g.convert(P)), z = M + m, W = new a.Group(), H = new a.Rect(), J = new a.Line(), le = new a.Line(), fe = new a.Line(), ve = new a.Line(), Ge = new a.Line();
      return H.x = M, H.y = E, H.width = f, H.height = G - E, H.strokeWidth = 1, H.strokeOpacity = 0.75, H.crisp = !0, this.setLineProperties(J, M, T, L, L), this.setLineProperties(le, z, z, $, E), this.setLineProperties(fe, z, z, I, G), this.setLineProperties(ve, M, T, $, $), this.setLineProperties(Ge, M, T, I, I), W.append([H, J, le, fe, ve, Ge]), W;
    }), this.updateColors(s, i, r), this.root.append(this.boxPlotGroups);
  }
  updateColors(e, t, s) {
    const { _Theme: i } = this.agChartsExports;
    this.boxPlotGroups.forEach((r, n) => {
      for (const o of r.children()) {
        const a = e[n % e.length];
        o.fill = s ? a : i.resolveOperation({ $mix: [a, { $ref: "backgroundColor" }, 0.7] }), o.stroke = t[n % t.length];
      }
    });
  }
  setLineProperties(e, t, s, i, r) {
    e.x1 = t, e.x2 = s, e.y1 = i, e.y2 = r, e.strokeOpacity = 0.75;
  }
}, P3 = {
  chartType: "boxPlot",
  miniChart: R3
}, E3 = class extends zi {
  constructor(e, t, s, i, r) {
    super(e, t, "treemapTooltip");
    const {
      size: n,
      padding: o,
      agChartsExports: { _Scene: a }
    } = this, l = [
      [1, 1],
      [3, 2, 1]
    ], d = l.length % 2 === 0 ? 0.3 : 0.2, h = [o, n - o], u = l.length, g = u * (u + 1) / 2, p = d / (u - 1), f = h[1] - h[0], m = f - d;
    let C = h[0];
    this.rects = l.reduce((w, b, y) => {
      w ?? (w = []);
      const P = (u - y) / g, E = m * P, M = b.length, T = b.reduce((z, W) => z += W, 0), G = d / (M - 1 || 1), I = M > 1 ? f - d : f;
      let L = h[0];
      const $ = b.map((z) => {
        const W = new a.Rect(), H = I * z / T;
        return W.x = C, W.y = L, W.width = E, W.height = H, W.strokeWidth = 0.75, W.crisp = !0, L += H + G, W;
      });
      return C += E + p, w.push(...$), w;
    }, []), this.updateColors(s, i, r);
    const v = new a.Group();
    v.setClipRect(new a.BBox(o, o, n - o, n - o)), v.append(this.rects), this.root.append(v);
  }
  updateColors(e, t, s) {
    const { _Theme: i } = this.agChartsExports;
    this.rects.forEach((r, n) => {
      r.fill = e[n % t.length], r.stroke = s ? t[n % t.length] : i.resolveOperation({ $ref: "backgroundColor" });
    });
  }
}, T3 = {
  chartType: "treemap",
  miniChart: E3
}, M3 = class extends Fr {
  constructor(e, t, s, i) {
    super(e, t, "sunburstTooltip"), this.data = [
      [[], []],
      [[], []],
      [[], []]
    ], this.angleOffset = -Math.PI / 2, this.innerRadiusRatio = 0, this.showRadiusAxisLine = !1, this.showAngleAxisLines = !1;
    const {
      data: r,
      size: n,
      padding: o,
      angleOffset: a,
      innerRadiusRatio: l,
      agChartsExports: { _Scene: c }
    } = this, d = (n - o * 2) / 2, h = [a + 0, a + 2 * Math.PI], u = Math.abs(h[1] - h[0]), g = [d * l, d], p = Math.abs(g[1] - g[0]);
    let f = 0;
    const m = (y, P) => {
      y.forEach((E) => {
        const M = P + 1;
        f = Math.max(f, M), m(E, M);
      });
    };
    m(r, 0);
    const C = p / f, v = this.size / 2, w = h[0];
    this.series = [];
    const b = (y, P, E, M, T) => {
      if (!Array.isArray(y))
        return;
      const I = P + 1;
      let L = E;
      y.forEach(($, z, W) => {
        let H = T;
        H || (H = new c.Group(), this.series.push(H));
        const J = g[0] + P * C, le = g[0] + I * C, fe = 1 / W.length, ve = L, Ge = ve + M * fe, Te = new c.Sector();
        Te.centerX = v, Te.centerY = v, Te.innerRadius = J, Te.outerRadius = le, Te.startAngle = ve, Te.endAngle = Ge, Te.stroke = void 0, Te.strokeWidth = 0, Te.inset = 0.75, L = Ge, H.append(Te), b($, I, ve, Math.abs(Ge - ve), H);
      });
    };
    b(r, 0, w, u), this.root.append(this.series), this.updateColors(s, i);
  }
  updateColors(e, t) {
    this.series.forEach((s, i) => {
      for (const r of s.children())
        r.fill = e[i % e.length], r.stroke = t[i % t.length];
    });
  }
}, D3 = {
  chartType: "sunburst",
  miniChart: M3
}, A3 = class extends zi {
  constructor(e, t, s, i, r) {
    super(e, t, "heatmapTooltip");
    const {
      size: n,
      padding: o,
      agChartsExports: { _Scene: a }
    } = this, l = 3, c = Array.from(
      { length: l },
      (m, C) => Array.from({ length: l }, (v, w) => w)
    ), d = c.map((m, C) => C), h = new a.CategoryScale();
    h.domain = d, h.range = [o, n - o], h.paddingInner = 0.01, h.paddingOuter = 0.1;
    const u = new a.CategoryScale();
    u.domain = d, u.range = [o, n - o], u.paddingInner = 0.01, u.paddingOuter = 0.1;
    const g = h.bandwidth ?? 0, p = u.bandwidth ?? 0;
    this.rects = c.reduce((m, C, v) => {
      m ?? (m = []);
      const w = C.map((b, y) => {
        const P = new a.Rect();
        return P.x = h.convert(v), P.y = u.convert(y), P.width = g, P.height = p, P.strokeWidth = 0, P.crisp = !0, P;
      });
      return m.push(...w), m;
    }, []), this.updateColors(s, i, r);
    const f = new a.Group();
    f.setClipRect(new a.BBox(o, o, n - o, n - o)), f.append(this.rects), this.root.append(f);
  }
  updateColors(e, t, s) {
    const { _Theme: i, _Util: r } = this.agChartsExports, n = s ? [e[0], e[1]] : i.resolveOperation({ $palette: "divergingColors" }), o = s ? t[0] : i.resolveOperation({ $ref: "backgroundColor" }), a = r.interpolateColor(n[0], n[1]);
    this.rects.forEach((l, c) => {
      l.fill = a(c * 0.2), l.stroke = o;
    });
  }
}, I3 = {
  chartType: "heatmap",
  miniChart: A3
}, L3 = class extends nt {
  constructor(e, t, s, i, r) {
    super(e, t, "waterfallTooltip"), this.data = [4, 3, -3, 6, -3], this.bars = this.createWaterfall(this.root, this.data, this.size, this.padding, "vertical").bars, this.updateColors(s, i, r);
  }
  updateColors(e, t, s) {
    const {
      data: i,
      agChartsExports: { _Theme: r }
    } = this, n = {
      fill: s ? e[0] : r.resolveOperation({ $palette: "altUp.fill" }),
      stroke: s ? t[0] : r.resolveOperation({ $palette: "altUp.stroke" })
    }, o = {
      fill: s ? e[1] : r.resolveOperation({ $palette: "altDown.fill" }),
      stroke: s ? t[1] : r.resolveOperation({ $palette: "altDown.stroke" })
    };
    this.bars.forEach((a, l) => {
      const c = i[l] >= 0;
      a.fill = c ? n.fill : o.fill, a.stroke = c ? n.stroke : o.stroke;
    });
  }
  createWaterfall(e, t, s, i, r) {
    const n = 2 * i, { processedData: o, min: a, max: l } = Va(t.map((w) => [w])), c = o.reduce((w, b) => w.concat(b), []), { _Scene: d } = this.agChartsExports, h = new d.LinearScale();
    h.domain = [Math.min(a, 0), l], h.range = [s - n, n];
    const u = new d.CategoryScale();
    u.domain = t.map((w, b) => b), u.range = [i, s - i], u.paddingInner = 0.2, u.paddingOuter = 0.3;
    const g = u.bandwidth, p = new d.Path();
    p.stroke = "#575757", p.strokeWidth = 0;
    const f = Math.floor(p.strokeWidth) % 2 / 2, m = p.path;
    m.clear();
    const C = r === "horizontal", v = c.map((w, b) => {
      const y = b > 0 ? c[b - 1] : 0, E = t[b] > 0, M = Math.round(h.convert(w)), T = Math.round(h.convert(y)), G = (E ? M : T) - f, I = (E ? T : M) + f, L = Math.abs(I - G), $ = u.convert(b), z = new d.Rect();
      z.x = C ? G : $, z.y = C ? $ : G, z.width = C ? L : g, z.height = C ? g : L, z.strokeWidth = 0, z.crisp = !0;
      const W = M + f, H = T + f;
      if (b > 0) {
        const fe = C ? H : z.x, ve = C ? z.y : H;
        m.lineTo(fe, ve);
      }
      const J = C ? W : z.x, le = C ? z.y : W;
      return m.moveTo(J, le), z;
    });
    return e.append([p, ...v]), { bars: v };
  }
}, k3 = {
  chartType: "waterfall",
  miniChart: L3
}, G3 = class extends nt {
  constructor(e, t, s, i) {
    super(e, t, "columnLineComboTooltip"), this.columnData = [3, 4], this.lineData = [[5, 4, 6, 5, 4]];
    const { root: r, columnData: n, lineData: o, size: a, padding: l } = this;
    this.columns = In({
      stacked: !1,
      data: n,
      size: a,
      padding: l,
      xScaleDomain: [0, 1],
      yScaleDomain: [0, 4],
      xScalePadding: 0.5,
      agChartsExports: t
    }), r.append(this.columns), this.lines = sh(t, r, o, a, l), this.updateColors(s, i);
  }
  updateColors(e, t) {
    this.columns.forEach((s, i) => {
      s.fill = e[i], s.stroke = t[i];
    }), this.lines.forEach((s, i) => {
      s.stroke = e[i + 2];
    });
  }
}, O3 = {
  chartType: "columnLineCombo",
  miniChart: G3
}, V3 = class extends nt {
  constructor(e, t, s, i) {
    super(e, t, "areaColumnComboTooltip"), this.columnData = [3, 4.5], this.areaData = [[5, 4, 6, 5, 4]];
    const {
      root: r,
      columnData: n,
      areaData: o,
      size: a,
      padding: l,
      agChartsExports: { _Scene: c }
    } = this;
    this.columns = In({
      stacked: !1,
      data: n,
      size: a,
      padding: l,
      xScaleDomain: [0, 1],
      yScaleDomain: [0, 6],
      xScalePadding: 0.5,
      agChartsExports: t
    });
    const d = new c.CategoryScale();
    d.range = [l, a - l], d.domain = [0, 1, 2, 3, 4], d.paddingInner = 1, d.paddingOuter = 0;
    const h = new c.LinearScale();
    h.range = [a - l, l], h.domain = [0, 6];
    const u = [], g = h.convert(0), p = d.convert(0);
    o.forEach((C, v) => {
      const w = u[v] || (u[v] = []);
      C.forEach((y, P) => {
        const E = y, M = P, T = d.convert(M), G = h.convert(E);
        w[P] = { x: T, y: G };
      });
      const b = d.convert(C.length - 1);
      u[v].push(
        {
          x: b,
          y: g
        },
        {
          x: p,
          y: g
        }
      );
    }), this.areas = u.map((C) => {
      const v = new c.Path();
      v.strokeWidth = 0, v.fillOpacity = 0.8;
      const w = v.path;
      return C.forEach((b, y) => w[y > 0 ? "lineTo" : "moveTo"](b.x, b.y)), v;
    });
    const f = new c.Group();
    f.setClipRect(new c.BBox(l, l, a - l * 2, a - l * 2));
    const m = new c.Group();
    m.setClipRect(new c.BBox(l, l, a - l * 2, a - l * 2)), f.append(this.areas), m.append(this.columns), r.append(f), r.append(m), this.updateColors(s, i);
  }
  updateColors(e, t) {
    this.areas.forEach((s, i) => {
      s.fill = e[i], s.stroke = t[i];
    }), this.columns.forEach((s, i) => {
      s.fill = e[i + 1], s.stroke = t[i + 1];
    });
  }
}, B3 = {
  chartType: "areaColumnCombo",
  miniChart: V3
}, N3 = class extends zi {
  constructor(e, t, s, i) {
    super(e, t, "customComboTooltip"), this.columnData = [3, 4], this.lineData = [[5, 4, 6, 5, 4]];
    const {
      root: r,
      columnData: n,
      lineData: o,
      size: a,
      padding: l,
      agChartsExports: { _Scene: c }
    } = this;
    this.columns = In({
      stacked: !1,
      data: n,
      size: a,
      padding: l,
      xScaleDomain: [0, 1],
      yScaleDomain: [0, 4],
      xScalePadding: 0.5,
      agChartsExports: t
    }), r.append(this.columns), this.lines = sh(this.agChartsExports, r, o, a, l);
    const d = "grey", h = 3, u = new c.Line();
    u.x1 = l, u.y1 = l, u.x2 = l, u.y2 = a - l + h, u.stroke = d;
    const g = new c.Line();
    g.x1 = l - h + 1, g.y1 = a - l, g.x2 = a - l + 1, g.y2 = a - l, g.stroke = d;
    const p = new c.Path();
    this.buildPenIconPath(p), p.fill = "whitesmoke", p.stroke = "darkslategrey", p.strokeWidth = 1, r.append([g, u, p]), this.updateColors(s, i);
  }
  updateColors(e, t) {
    this.columns.forEach((s, i) => {
      s.fill = e[i], s.stroke = t[i];
    }), this.lines.forEach((s, i) => {
      s.stroke = e[i + 2];
    });
  }
  buildPenIconPath(e) {
    const { path: t } = e;
    t.moveTo(25.76, 43.46), t.lineTo(31.27, 48.53), t.moveTo(49.86, 22), t.lineTo(49.86, 22), t.cubicCurveTo(49.01994659053345, 21.317514933510974, 47.89593834348529, 21.09645997825817, 46.86, 21.41), t.lineTo(46.86, 21.41), t.cubicCurveTo(45.55460035985361, 21.77260167850787, 44.38777081121966, 22.517979360321792, 43.51, 23.55), t.lineTo(25.51, 43.8), t.lineTo(25.43, 43.89), t.lineTo(23.01, 51.89), t.lineTo(22.83, 52.46), t.lineTo(31.02, 48.86), t.lineTo(49.02, 28.52), t.lineTo(49.02, 28.52), t.cubicCurveTo(49.940716461596224, 27.521914221246085, 50.54302631059587, 26.2720342455763, 50.75, 24.93), t.lineTo(50.75, 24.93), t.cubicCurveTo(50.95363374988308, 23.866379846512814, 50.62080640232334, 22.77066734274871, 49.86, 22), t.closePath(), t.moveTo(41.76, 25.5), t.lineTo(47.34, 30.5), t.moveTo(40.74, 26.65), t.lineTo(46.25, 31.71);
  }
}, H3 = {
  chartType: "customCombo",
  miniChart: N3
}, fg = {
  columnGroup: {
    column: { range: !0, pivot: !0, enterprise: !1, icon: L5 },
    stackedColumn: { range: !0, pivot: !0, enterprise: !1, icon: G5 },
    normalizedColumn: { range: !0, pivot: !0, enterprise: !1, icon: B5 }
  },
  barGroup: {
    bar: { range: !0, pivot: !0, enterprise: !1, icon: H5 },
    stackedBar: { range: !0, pivot: !0, enterprise: !1, icon: W5 },
    normalizedBar: { range: !0, pivot: !0, enterprise: !1, icon: $5 }
  },
  pieGroup: {
    pie: { range: !0, pivot: !0, enterprise: !1, icon: j5 },
    donut: { range: !0, pivot: !0, enterprise: !1, icon: ug },
    doughnut: { range: !0, pivot: !0, enterprise: !1, icon: ug }
  },
  lineGroup: {
    line: { range: !0, pivot: !0, enterprise: !1, icon: Y5 },
    stackedLine: { range: !0, pivot: !0, enterprise: !1, icon: X5 },
    normalizedLine: { range: !0, pivot: !0, enterprise: !1, icon: J5 }
  },
  scatterGroup: {
    scatter: { range: !0, pivot: !0, enterprise: !1, icon: t3 },
    bubble: { range: !0, pivot: !0, enterprise: !1, icon: i3 }
  },
  areaGroup: {
    area: { range: !0, pivot: !0, enterprise: !1, icon: r3 },
    stackedArea: { range: !0, pivot: !0, enterprise: !1, icon: n3 },
    normalizedArea: { range: !0, pivot: !0, enterprise: !1, icon: l3 }
  },
  polarGroup: {
    radarLine: { range: !0, pivot: !1, enterprise: !0, icon: m3 },
    radarArea: { range: !0, pivot: !1, enterprise: !0, icon: v3 },
    nightingale: { range: !0, pivot: !1, enterprise: !0, icon: b3 },
    radialColumn: { range: !0, pivot: !1, enterprise: !0, icon: u3 },
    radialBar: { range: !0, pivot: !1, enterprise: !0, icon: p3 }
  },
  statisticalGroup: {
    boxPlot: { range: !0, pivot: !1, enterprise: !0, icon: P3 },
    histogram: { range: !0, pivot: !1, enterprise: !1, icon: d3 },
    rangeBar: { range: !0, pivot: !1, enterprise: !0, icon: S3 },
    rangeArea: { range: !0, pivot: !1, enterprise: !0, icon: F3 }
  },
  hierarchicalGroup: {
    treemap: { range: !0, pivot: !0, enterprise: !0, icon: T3 },
    sunburst: { range: !0, pivot: !0, enterprise: !0, icon: D3 }
  },
  specializedGroup: {
    heatmap: { range: !0, pivot: !1, enterprise: !0, icon: I3 },
    waterfall: { range: !0, pivot: !1, enterprise: !0, icon: k3 }
  },
  combinationGroup: {
    columnLineCombo: { range: !0, pivot: !0, enterprise: !1, icon: O3 },
    areaColumnCombo: { range: !0, pivot: !0, enterprise: !1, icon: B3 },
    customCombo: { range: !0, pivot: !0, enterprise: !1, icon: H3 }
  },
  funnelGroup: {
    funnel: { range: !0, pivot: !1, enterprise: !0, icon: R5 },
    coneFunnel: { range: !0, pivot: !1, enterprise: !0, icon: T5 },
    pyramid: { range: !0, pivot: !1, enterprise: !0, icon: A5 }
  }
}, z3 = {
  columnGroup: ["column", "stackedColumn", "normalizedColumn"],
  barGroup: ["bar", "stackedBar", "normalizedBar"],
  pieGroup: ["pie", "donut"],
  lineGroup: ["line", "stackedLine", "normalizedLine"],
  areaGroup: ["area", "stackedArea", "normalizedArea"],
  scatterGroup: ["scatter", "bubble"],
  polarGroup: ["radarLine", "radarArea", "nightingale", "radialColumn", "radialBar"],
  statisticalGroup: ["boxPlot", "histogram", "rangeBar", "rangeArea"],
  hierarchicalGroup: ["treemap", "sunburst"],
  specializedGroup: ["heatmap", "waterfall"],
  funnelGroup: ["funnel", "coneFunnel", "pyramid"],
  combinationGroup: ["columnLineCombo", "areaColumnCombo", "customCombo"]
}, W3 = class extends D {
  constructor(e, t, s, i, r = z3) {
    super(
      /* html */
      '<div class="ag-chart-settings-mini-wrapper"></div>'
    ), this.wrappers = /* @__PURE__ */ new Map(), this.chartController = e, this.fills = t, this.strokes = s, this.isCustomTheme = i, this.chartGroups = { ...r };
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    !this.chartController.customComboExists() && this.chartGroups.combinationGroup && (this.chartGroups.combinationGroup = this.chartGroups.combinationGroup.filter(
      (n) => n !== "customCombo"
    ));
    const e = this.getGui(), t = this.chartController.isEnterprise(), s = this.chartController.isPivotChart(), i = !s, r = Object.keys(this.chartGroups).map((n) => {
      const o = n in fg ? fg[n] : void 0;
      if (!o)
        return F(148, { group: n }), null;
      const l = (this.chartGroups[n] ?? []).map((c) => {
        const d = c in o ? o[c] : void 0;
        return d ? !t && d.enterprise ? null : i && d.range || s && d.pivot ? d : null : (F(149, { group: n, chartType: c }), null);
      }).filter((c) => c != null);
      return l.length === 0 ? null : {
        label: this.chartTranslation.translate(n),
        items: l
      };
    }).filter((n) => n != null);
    for (const { label: n, items: o } of r) {
      const a = this.createBean(
        new Ms({
          title: n,
          suppressEnabledCheckbox: !0,
          enabled: !0,
          suppressOpenCloseIcons: !0,
          cssIdentifier: "charts-settings",
          direction: "horizontal",
          suppressKeyboardNavigation: !0
        })
      );
      for (const l of o) {
        const { miniChart: c, chartType: d } = l.icon, h = document.createElement("div");
        h.classList.add("ag-chart-mini-thumbnail"), h.setAttribute("tabindex", "0"), h.setAttribute("role", "button");
        const u = d, g = () => {
          this.chartController.setChartType(u), this.updateSelectedMiniChart();
        };
        this.addManagedListeners(h, {
          click: g,
          keydown: (p) => {
            (p.key == S.ENTER || p.key === S.SPACE) && (p.preventDefault(), g());
          }
        }), this.wrappers.set(u, h), this.createBean(
          new c(h, this.beans.agChartsExports, this.fills, this.strokes, this.isCustomTheme)
        ), a.addItem(h);
      }
      e.appendChild(a.getGui());
    }
    this.updateSelectedMiniChart();
  }
  updateSelectedMiniChart() {
    const e = this.chartController.getChartType();
    this.wrappers.forEach((t, s) => {
      const i = s === e;
      t.classList.toggle("ag-selected", i);
      const r = this.chartTranslation.translate(Zd(s)), n = i ? `${r}. ${this.chartTranslation.translate("ariaChartSelected")}` : r;
      re(t, n);
    });
  }
  destroy() {
    this.wrappers.clear(), super.destroy();
  }
}, _3 = class extends D {
  constructor(e) {
    super(
      /* html */
      `<div class="ag-chart-settings-wrapper">
            <div data-ref="eMiniChartsContainer" class="ag-chart-settings-mini-charts-container ag-scrollable-container"></div>
            <div data-ref="eNavBar" class="ag-chart-settings-nav-bar">
                <div data-ref="ePrevBtn" class="ag-chart-settings-prev">
                    <button type="button" class="ag-button ag-chart-settings-prev-button"></button>
                </div>
                <div data-ref="eCardSelector" class="ag-chart-settings-card-selector"></div>
                <div data-ref="eNextBtn" class="ag-chart-settings-next">
                    <button type="button" class="ag-button ag-chart-settings-next-button"></button>
                </div>
            </div>
        </div>`
    ), this.chartController = e, this.eMiniChartsContainer = x, this.eNavBar = x, this.eCardSelector = x, this.ePrevBtn = x, this.eNextBtn = x, this.miniChartsContainers = [], this.cardItems = [], this.activePaletteIndex = 0, this.palettes = [], this.themes = [];
  }
  postConstruct() {
    this.resetPalettes(), this.ePrevBtn.insertAdjacentElement("afterbegin", N("chartsThemePrevious", this.beans)), this.eNextBtn.insertAdjacentElement("afterbegin", N("chartsThemeNext", this.beans)), this.addManagedElementListeners(this.ePrevBtn, { click: () => this.setActivePalette(this.getPrev(), "left") }), this.addManagedElementListeners(this.eNextBtn, { click: () => this.setActivePalette(this.getNext(), "right") });
    const e = () => this.resetPalettes(!0);
    this.addManagedListeners(this.chartController, {
      chartTypeChanged: e,
      chartApiUpdate: e
    }), this.scrollSelectedIntoView();
  }
  scrollSelectedIntoView() {
    setTimeout(() => {
      const e = (i) => !i.getGui().classList.contains("ag-hidden"), s = this.miniChartsContainers.find(e).getGui().querySelector(".ag-selected");
      if (s) {
        const i = s.offsetParent;
        i && this.eMiniChartsContainer.scrollTo(0, i.offsetTop);
      }
    }, 250);
  }
  resetPalettes(e) {
    var r, n;
    const t = this.chartController.getPalettes(), s = (n = (r = this.gos.get("chartToolPanelsDef")) == null ? void 0 : r.settingsPanel) == null ? void 0 : n.chartGroupsDef;
    if (Xe(t, this.palettes) && !e || this.isAnimating)
      return;
    this.palettes = t, this.themes = this.chartController.getThemeNames(), this.activePaletteIndex = this.themes.findIndex((o) => o === this.chartController.getChartThemeName()), this.cardItems = [], X(this.eCardSelector), this.destroyMiniCharts();
    const { themes: i } = this;
    this.palettes.forEach((o, a) => {
      const l = this.activePaletteIndex === a, { fills: c = [], strokes: d = [] } = o, h = i[a], u = !Qd(h, this.beans.agChartsExports._Theme), g = this.createBean(
        new W3(this.chartController, c, d, u, s)
      );
      this.miniChartsContainers.push(g), this.eMiniChartsContainer.appendChild(g.getGui()), this.addCardLink(a), l ? g.updateSelectedMiniChart() : g.setDisplayed(!1);
    }), O(this.eNavBar, this.palettes.length > 1), bo(this.cardItems[this.activePaletteIndex], "ag-selected", "ag-not-selected");
  }
  addCardLink(e) {
    const t = document.createElement("div");
    t.classList.add("ag-chart-settings-card-item"), this.addManagedElementListeners(t, {
      click: () => {
        this.setActivePalette(e, e < this.activePaletteIndex ? "left" : "right");
      }
    }), this.eCardSelector.appendChild(t), this.cardItems.push(t);
  }
  getPrev() {
    let e = this.activePaletteIndex - 1;
    return e < 0 && (e = this.palettes.length - 1), e;
  }
  getNext() {
    let e = this.activePaletteIndex + 1;
    return e >= this.palettes.length && (e = 0), e;
  }
  setActivePalette(e, t) {
    if (this.isAnimating || this.activePaletteIndex === e)
      return;
    bo(this.cardItems[e], "ag-selected", "ag-not-selected");
    const s = this.miniChartsContainers[this.activePaletteIndex], i = s.getGui(), r = this.miniChartsContainers[e], n = r.getGui();
    s.updateSelectedMiniChart(), r.updateSelectedMiniChart();
    const o = t === "left" ? -1 : 1, a = n.style.left = `${Ri(this.getGui()) * o}px`;
    this.activePaletteIndex = e, this.isAnimating = !0;
    const l = "ag-animating";
    r.setDisplayed(!0), s.addCss(l), r.addCss(l), this.chartController.setChartThemeName(this.themes[e]), window.setTimeout(() => {
      i.style.left = `${-parseFloat(a)}px`, n.style.left = "0px";
    }, 0), window.setTimeout(() => {
      this.isAnimating = !1, s.removeCss(l), r.removeCss(l), s.setDisplayed(!1);
    }, 300);
  }
  destroyMiniCharts() {
    X(this.eMiniChartsContainer), this.miniChartsContainers = this.destroyBeans(this.miniChartsContainers);
  }
  destroy() {
    this.destroyMiniCharts(), super.destroy();
  }
}, U3 = "data", $3 = "format", K3 = class extends D {
  constructor(e, t) {
    super(), this.panels = e, this.chartMenuContext = t, this.tabs = [];
  }
  wireBeans(e) {
    this.chartTranslation = e.chartTranslation;
  }
  postConstruct() {
    this.panels.forEach((e) => {
      const t = e.replace("chart", "").toLowerCase(), s = this.createPanel(t), i = this.createTab(e, t, s);
      this.tabs.push(i), this.addDestroyFunc(() => this.destroyBean(s));
    }), this.tabbedLayout = new NC({
      items: this.tabs,
      cssClass: "ag-chart-tabbed-menu",
      keepScrollPosition: !0,
      suppressFocusBodyOnOpen: !0,
      suppressTrapFocus: !0,
      enableCloseButton: !0,
      closeButtonAriaLabel: this.chartTranslation.translate("ariaChartMenuClose"),
      onCloseClicked: () => {
        var e;
        (e = this.eventSource) == null || e.focus({ preventScroll: !0 }), this.dispatchLocalEvent({ type: "closed" });
      }
    }), this.createBean(this.tabbedLayout);
  }
  createTab(e, t, s) {
    const i = K({ tag: "div", cls: `ag-chart-tab ag-chart-${t}` });
    this.createBean(s), i.appendChild(s.getGui());
    const r = this.chartTranslation.translate(t);
    return {
      title: K({ tag: "div", children: r }),
      titleLabel: r,
      bodyPromise: U.resolve(i),
      getScrollableContainer: () => i.querySelector(".ag-scrollable-container") || i,
      name: e
    };
  }
  showTab(e) {
    const t = this.tabs[e];
    this.tabbedLayout.showItem(t);
  }
  getGui() {
    return this.tabbedLayout && this.tabbedLayout.getGui();
  }
  showMenu(e, t) {
    var s;
    this.eventSource = e, t || (s = this.tabbedLayout) == null || s.focusHeader(!0);
  }
  destroy() {
    this.parentComponent && this.parentComponent.isAlive() && this.destroyBean(this.parentComponent), super.destroy();
  }
  createPanel(e) {
    switch (e) {
      case U3:
        return new WU(this.chartMenuContext);
      case $3:
        return new f5(this.chartMenuContext);
      default:
        return new _3(this.chartMenuContext.chartController);
    }
  }
}, j3 = class extends D {
  constructor(e, t, s) {
    super(
      /* html */
      '<div class="ag-chart-menu-wrapper"></div>'
    ), this.eChartContainer = e, this.eMenuPanelContainer = t, this.chartMenuContext = s, this.buttons = {
      chartLink: { iconName: "linked", callback: () => this.chartMenuSvc.toggleLinked(this.chartMenuContext) },
      chartUnlink: {
        iconName: "unlinked",
        callback: () => this.chartMenuSvc.toggleLinked(this.chartMenuContext)
      },
      chartDownload: {
        iconName: "chartsDownload",
        callback: () => this.chartMenuSvc.downloadChart(this.chartMenuContext)
      },
      chartMenu: { iconName: "chartsMenu", callback: (i) => this.showMenuList(i) }
    }, this.panels = [], this.menuVisible = !1, this.chartController = s.chartController;
  }
  wireBeans(e) {
    this.chartMenuSvc = e.chartMenuSvc, this.chartMenuListFactory = e.chartMenuListFactory;
  }
  postConstruct() {
    this.chartToolbar = this.createManagedBean(new AU()), this.getGui().appendChild(this.chartToolbar.getGui()), this.refreshToolbarAndPanels(), this.addManagedEventListeners({
      chartCreated: (e) => {
        var t;
        e.chartId === this.chartController.getChartId() && ((t = this.gos.get("chartToolPanelsDef")) != null && t.defaultToolPanel) && this.showMenu({ panel: this.defaultPanel, suppressFocus: !0 });
      }
    }), this.addManagedListeners(this.chartController, {
      chartLinkedChanged: this.refreshToolbarAndPanels.bind(this)
    }), this.refreshMenuClasses(), this.addManagedListeners(this.chartController, { chartApiUpdate: this.refreshToolbarAndPanels.bind(this) });
  }
  isVisible() {
    return this.menuVisible;
  }
  getExtraPaddingDirections() {
    return ["chartMenu", "chartLink", "chartUnlink", "chartDownload"].some(
      (e) => this.chartToolbarOptions.includes(e)
    ) ? ["top"] : [];
  }
  refreshToolbarAndPanels() {
    this.initToolbarOptionsAndPanels(), this.updateToolbar();
  }
  initToolbarOptionsAndPanels() {
    const { panels: e, defaultPanel: t } = this.chartMenuSvc.getChartToolPanels(this.chartController);
    this.panels = e, this.defaultPanel = t, this.chartToolbarOptions = this.chartMenuSvc.getChartToolbarOptions();
  }
  updateToolbar() {
    const e = this.chartToolbarOptions.map((t) => {
      const { iconName: s, callback: i } = this.buttons[t];
      return {
        buttonName: t,
        iconName: s,
        callback: i
      };
    });
    this.chartToolbar.updateParams({ buttons: e });
  }
  createMenuPanel(e) {
    const t = this.menuPanel = this.createBean(
      new dC({
        height: "100%",
        closable: !0,
        hideTitleBar: !0,
        cssIdentifier: "chart-menu"
      })
    );
    return t.setParentComponent(this), this.eMenuPanelContainer.appendChild(t.getGui()), this.tabbedMenu = this.createBean(new K3(this.panels, this.chartMenuContext)), this.addManagedListeners(this.tabbedMenu, {
      closed: () => {
        this.hideMenu();
      }
    }), this.addManagedListeners(t, { destroyed: () => this.destroyBean(this.tabbedMenu) }), new U((s) => {
      window.setTimeout(() => {
        t.setBodyComponent(this.tabbedMenu), this.tabbedMenu.showTab(e), s(t);
      }, 100);
    });
  }
  showContainer(e, t) {
    this.menuPanel && (this.menuVisible = !0, this.refreshMenuClasses(), this.tabbedMenu.showMenu(e, t));
  }
  showMenu(e) {
    const { panel: t, eventSource: s, suppressFocus: i } = e ?? {};
    if (this.menuPanel && !t)
      this.showContainer(s, i);
    else {
      const r = t || this.defaultPanel;
      let n = this.panels.indexOf(r);
      n < 0 && (F(143, { panel: t }), n = this.panels.indexOf(this.defaultPanel)), this.menuPanel ? (this.tabbedMenu.showTab(n), this.showContainer(s, i)) : this.createMenuPanel(n).then(() => this.showContainer(s, i));
    }
  }
  hideMenu() {
    this.menuVisible = !1, this.refreshMenuClasses();
  }
  refreshMenuClasses() {
    this.eChartContainer.classList.toggle("ag-chart-menu-visible", this.menuVisible), this.eChartContainer.classList.toggle("ag-chart-menu-hidden", !this.menuVisible);
  }
  showMenuList(e) {
    this.chartMenuListFactory.showMenuList({
      eventSource: e,
      showMenu: () => this.showMenu({ eventSource: e }),
      chartMenuContext: this.chartMenuContext
    });
  }
  destroy() {
    super.destroy(), this.menuPanel && this.menuPanel.isAlive() && this.destroyBean(this.menuPanel), this.tabbedMenu && this.tabbedMenu.isAlive() && this.destroyBean(this.tabbedMenu);
  }
}, qv = ["number", "category", "time", "grouped-category"], Y3 = ["angle-category", "angle-number", "radius-category", "radius-number"], q3 = [...qv, ...Y3], X3 = class extends R {
  constructor(e) {
    super(), this.chartController = e;
  }
  getChartThemeOverridesProxy() {
    return {
      getValue: (e) => this.getChartOption(e),
      setValue: (e, t) => this.setChartThemeOverrides([{ expression: e, value: t }]),
      setValues: (e) => this.setChartThemeOverrides(e)
    };
  }
  getAxisThemeOverridesProxy() {
    return {
      getValue: (e) => this.getAxisProperty(e),
      setValue: (e, t) => this.setAxisThemeOverrides([{ expression: e, value: t }]),
      setValues: (e) => this.setAxisThemeOverrides(e)
    };
  }
  getCartesianAxisOptionsProxy(e) {
    return {
      getValue: (t) => this.getCartesianAxisProperty(e, t),
      setValue: (t, s) => this.setCartesianAxisOptions(e, [{ expression: t, value: s }]),
      setValues: (t) => this.setCartesianAxisOptions(e, t)
    };
  }
  getCartesianAxisThemeOverridesProxy(e) {
    return {
      getValue: (t) => this.getCartesianAxisProperty(e, t),
      setValue: (t, s) => this.setCartesianAxisThemeOverrides(e, [{ expression: t, value: s }]),
      setValues: (t) => this.setCartesianAxisThemeOverrides(e, t)
    };
  }
  getCartesianAxisAppliedThemeOverridesProxy(e) {
    return {
      getValue: (t) => this.getCartesianAxisThemeOverride(
        e,
        // Allow the caller to specify a wildcard expression to retrieve the whole set of overrides
        t === "*" ? null : t
      ),
      setValue: (t, s) => this.setCartesianAxisThemeOverrides(
        e,
        // Allow the caller to specify a wildcard expression to set the whole set of overrides
        [{ expression: t === "*" ? null : t, value: s }]
      ),
      setValues: (t) => this.setCartesianAxisThemeOverrides(e, t)
    };
  }
  getSeriesOptionsProxy(e) {
    return {
      getValue: (t, s) => this.getSeriesOption(e(), t, s),
      setValue: (t, s) => this.setSeriesOptions(e(), [{ expression: t, value: s }]),
      setValues: (t) => this.setSeriesOptions(e(), t)
    };
  }
  /**
   * Determine the set of theme overrides that should be retained when transitioning from one chart type to another.
   */
  getPersistedChartThemeOverrides(e, t, s, i) {
    const r = this.getRetainedChartThemeOverrideKeys(s, i), n = this.getRetainedChartAxisThemeOverrideKeys(
      null,
      s,
      i
    ), o = this.createChartOptions();
    for (const a of r) {
      const l = this.retrieveChartOptionsThemeOverride(e, s, a);
      l !== void 0 && this.assignChartOptionsThemeOverride(o, i, a, l);
    }
    return t && this.assignPersistedAxisOverrides({
      existingAxes: t,
      retainedChartAxisThemeOverrideKeys: n,
      existingChartOptions: e,
      targetChartOptions: o,
      existingChartType: s,
      targetChartType: i
    }), o.theme.overrides;
  }
  assignPersistedAxisOverrides(e) {
    const {
      existingAxes: t,
      retainedChartAxisThemeOverrideKeys: s,
      existingChartOptions: i,
      targetChartOptions: r,
      existingChartType: n,
      targetChartType: o
    } = e;
    for (const { expression: a, targetAxisTypes: l } of s)
      for (const c of t.map((d) => d.type)) {
        const d = this.retrieveChartOptionsThemeOverride(
          i,
          n,
          ["axes", c, a].join(".")
        );
        if (d !== void 0)
          for (const h of l)
            this.assignChartOptionsThemeOverride(
              r,
              o,
              ["axes", h, a].join("."),
              d
            );
      }
  }
  getRetainedChartThemeOverrideKeys(e, t) {
    const s = ["animation"], i = ["zoom", "navigator"], r = ((n, o) => {
      const a = new Array();
      return Ys(de(n)) && Ys(de(o)) && a.push(...i), a;
    })(e, t);
    return [...s, ...r];
  }
  getRetainedChartAxisThemeOverrideKeys(e, t, s) {
    return Ys(de(t)) && Ys(de(s)) ? this.getRetainedCartesianAxisThemeOverrideKeys(e).map((r) => ({ expression: r, targetAxisTypes: qv })) : [];
  }
  getRetainedCartesianAxisThemeOverrideKeys(e) {
    const t = e === "xAxis" ? ["", ".top", ".bottom"] : e === "yAxis" ? ["", ".left", ".right"] : ["", ".left", ".right", ".top", ".bottom"], s = ["crosshair"], i = new Array();
    for (const r of s)
      for (const n of t)
        i.push(`${r}${n}`);
    return i;
  }
  getChartOption(e) {
    return hi(this.getChart(), e, void 0);
  }
  setChartThemeOverrides(e) {
    const t = this.getChartType(), s = this.createChartOptions();
    for (const { expression: i, value: r } of e)
      this.assignChartOptionsThemeOverride(s, t, i, r);
    this.applyChartOptions(s);
  }
  applyChartOptions(e, t) {
    if (Object.keys(e).length === 0)
      return;
    this.updateChart(e), !(t != null && t.silent) && this.raiseChartOptionsChangedEvent();
  }
  awaitChartOptionUpdate(e) {
    this.chartController.getChartProxy().getChart().waitForUpdate().then(() => e()).catch((s) => j(108, { e: s }));
  }
  getAxisProperty(e) {
    var t;
    return hi((t = this.getChart().axes) == null ? void 0 : t[0], e, void 0);
  }
  setAxisThemeOverrides(e) {
    var r;
    const t = this.getChart(), s = this.getChartType(), i = this.createChartOptions();
    for (const { expression: n, value: o } of e) {
      const a = (r = t.axes) == null ? void 0 : r.filter((l) => {
        const c = n.split(".");
        let d = l;
        for (const h of c) {
          if (!(h in d))
            return !1;
          d = d[h];
        }
        return !0;
      });
      if (a)
        for (const l of a)
          this.isValidAxisType(l) && this.assignChartAxisThemeOverride(i, s, l.type, null, n, o);
    }
    this.applyChartOptions(i);
  }
  getCartesianAxisProperty(e, t) {
    const s = this.getChartAxes(), i = this.getCartesianAxis(s, e);
    return hi(i, t, void 0);
  }
  getCartesianAxisThemeOverride(e, t) {
    const s = this.getChartAxes(), i = this.getCartesianAxis(s, e);
    if (!i || !this.isValidAxisType(i))
      return;
    const r = this.getChartType(), n = this.getChart().getOptions();
    return this.retrieveChartAxisThemeOverride(
      n,
      r,
      i.type,
      e === "yAxis" ? ["left", "right"] : ["bottom", "top"],
      t
    );
  }
  setCartesianAxisThemeOverrides(e, t) {
    const s = this.getChartAxes(), i = this.getCartesianAxis(s, e);
    if (!i || !this.isValidAxisType(i))
      return;
    const r = this.getChartType(), n = this.createChartOptions();
    for (const { expression: o, value: a } of t)
      this.assignChartAxisThemeOverride(
        n,
        r,
        i.type,
        e === "yAxis" ? ["left", "right"] : ["bottom", "top"],
        o,
        a
      );
    this.applyChartOptions(n);
  }
  setCartesianAxisOptions(e, t) {
    this.updateCartesianAxisOptions(e, (s, i, r) => {
      const n = i.indexOf(r);
      for (const { expression: o, value: a } of t)
        this.assignChartOption(s, `axes.${n}.${o}`, a);
    });
  }
  updateCartesianAxisOptions(e, t) {
    const s = this.getChart().getOptions(), i = "axes" in s ? s.axes : void 0;
    if (!s || !i)
      return;
    const r = this.getChartAxes(), n = this.getCartesianAxis(r, e);
    if (!n)
      return;
    const o = this.createChartOptions();
    o.axes = i, t(o, r, n, s), this.applyChartOptions(o);
  }
  setCartesianCategoryAxisType(e, t) {
    this.updateCartesianAxisOptions(e, (s, i, r, n) => {
      const o = this.getChartType();
      this.assignPersistedAxisOverrides({
        existingAxes: [r],
        retainedChartAxisThemeOverrideKeys: this.getRetainedChartAxisThemeOverrideKeys(
          e,
          o,
          o
        ),
        existingChartOptions: n,
        targetChartOptions: s,
        existingChartType: o,
        targetChartType: o
      }), this.assignChartOption(s, "axes.0.type", t), this.chartController.setCategoryAxisType(t);
    });
  }
  getCartesianAxis(e, t) {
    if (!(e.length < 2))
      switch (t) {
        case "xAxis":
          return e[0].direction === "x" ? e[0] : e[1];
        case "yAxis":
          return e[1].direction === "y" ? e[1] : e[0];
      }
  }
  getSeriesOption(e, t, s) {
    const i = this.getChart().series.find((r) => Z3(e, r));
    return hi(s ? i : i == null ? void 0 : i.properties.toJson(), t, void 0);
  }
  setSeriesOptions(e, t) {
    const s = this.createChartOptions();
    for (const { expression: i, value: r } of t)
      this.assignChartOptionsSeriesThemeOverride(s, e, `series.${i}`, r);
    this.applyChartOptions(s);
  }
  getPairedMode() {
    return this.chartController.getChartProxy().isPaired();
  }
  setPairedMode(e) {
    this.chartController.getChartProxy().setPaired(e);
  }
  getChartAxes() {
    return this.getChart().axes ?? [];
  }
  retrieveChartAxisThemeOverride(e, t, s, i, r) {
    if (i)
      for (const n of i) {
        const o = this.retrieveChartOptionsThemeOverride(
          e,
          t,
          ["axes", s, n, ...r ? [r] : []].join(".")
        );
        if (o !== void 0)
          return o;
      }
    else
      return this.retrieveChartOptionsThemeOverride(
        e,
        t,
        ["axes", s, ...r ? [r] : []].join(".")
      );
  }
  assignChartAxisThemeOverride(e, t, s, i, r, n) {
    if (i)
      for (const o of i)
        this.assignChartOptionsThemeOverride(
          e,
          t,
          ["axes", s, o, ...r ? [r] : []].join("."),
          n
        );
    else
      this.assignChartOptionsThemeOverride(
        e,
        t,
        ["axes", s, ...r ? [r] : []].join("."),
        n
      );
  }
  isValidAxisType(e) {
    return q3.includes(e.type);
  }
  getChartType() {
    return this.chartController.getChartType();
  }
  getChart() {
    return this.chartController.getChartProxy().getChart();
  }
  updateChart(e) {
    const t = this.chartController.getChartProxy().getChartRef();
    t.skipAnimations(), t.updateDelta(e);
  }
  createChartOptions() {
    return {
      theme: {
        overrides: {}
      }
    };
  }
  retrieveChartOptionsThemeOverride(e, t, s) {
    const i = this.getChartThemeOverridesSeriesTypeKeys(t);
    for (const r of i) {
      const n = this.retrieveChartOptionsSeriesThemeOverride(e, r, s);
      if (n !== void 0)
        return n;
    }
  }
  assignChartOptionsThemeOverride(e, t, s, i) {
    const r = this.getChartThemeOverridesSeriesTypeKeys(t);
    for (const n of r)
      this.assignChartOptionsSeriesThemeOverride(e, n, s, i);
  }
  retrieveChartOptionsSeriesThemeOverride(e, t, s) {
    return this.retrieveChartOption(
      e,
      ["theme", "overrides", t, ...s ? [s] : []].join(".")
    );
  }
  assignChartOptionsSeriesThemeOverride(e, t, s, i) {
    this.assignChartOption(
      e,
      ["theme", "overrides", t, ...s ? [s] : []].join("."),
      i
    );
  }
  getChartThemeOverridesSeriesTypeKeys(e) {
    const t = this.chartController.getChartSeriesTypes(e);
    return this.chartController.isComboChart() && t.push("common"), t;
  }
  retrieveChartOption(e, t) {
    return hi(e, t, void 0);
  }
  assignChartOption(e, t, s) {
    JW(e, t, s);
  }
  raiseChartOptionsChangedEvent() {
    const e = this.chartController.getChartModel();
    this.eventSvc.dispatchEvent({
      type: "chartOptionsChanged",
      chartId: e.chartId,
      chartType: e.chartType,
      chartThemeName: this.chartController.getChartThemeName(),
      chartOptions: e.chartOptions
    });
  }
};
function Z3(e, t) {
  return i_(e) && t.type === e;
}
var Q3 = class extends D {
  constructor(e) {
    super(
      /* html */
      `
            <div style="height: 100%; width: 100%;">
                <div class="ag-chart" data-ref="eWrapper">
                    <div data-ref="eChartContainer" class="ag-chart-components-wrapper ag-chart-menu-hidden">
                        <div data-ref="eChart" class="ag-chart-canvas-wrapper"></div>
                        <div data-ref="eEmpty" class="ag-chart-empty-text ag-unselectable"></div>
                    </div>
                    <div data-ref="eMenuContainer" class="ag-chart-docked-container"></div>
                </div>
            </div>
            `
    ), this.eChart = x, this.eWrapper = x, this.eChartContainer = x, this.eMenuContainer = x, this.eEmpty = x, this.params = e;
  }
  wireBeans(e) {
    this.crossFilterService = e.chartCrossFilterSvc, this.chartTranslation = e.chartTranslation, this.chartMenuSvc = e.chartMenuSvc, this.focusSvc = e.focusSvc, this.popupSvc = e.popupSvc, this.enterpriseChartProxyFactory = e.enterpriseChartProxyFactory, this.environment = e.environment;
  }
  postConstruct() {
    const e = {
      ...this.params,
      chartType: pn(this.params.chartType),
      chartThemeName: this.getThemeName()
    }, t = this.gos.get("enableRtl");
    this.eWrapper.classList.add(t ? "ag-rtl" : "ag-ltr");
    const s = this.createBean(new G_(e));
    this.chartController = this.createManagedBean(new SU(s)), this.chartOptionsService = this.createManagedBean(new X3(this.chartController)), this.validateCustomThemes(), this.createChart(), this.params.insideDialog ? this.addDialog() : (this.addManagedEventListeners({
      gridStylesChanged: this.updateTheme.bind(this)
    }), this.updateTheme()), this.addMenu(), this.addManagedElementListeners(this.getGui(), { focusin: this.setActiveChartCellRange.bind(this) }), this.addManagedListeners(this.chartController, { chartModelUpdate: this.update.bind(this) }), this.addManagedPropertyListeners(
      ["chartThemeOverrides", "chartThemes"],
      this.reactivePropertyUpdate.bind(this)
    ), this.update(), this.raiseChartCreatedEvent();
  }
  updateTheme() {
    this.environment.applyThemeClasses(this.getGui());
  }
  createChart() {
    let e;
    this.chartProxy && (e = this.chartProxy.destroy({ keepChartInstance: !0 }));
    const t = (r, n) => {
      const o = this.params.crossFilteringContext;
      o.lastSelectedChartId = n ? "" : this.chartController.getChartId(), n && this.params.crossFilteringResetCallback(), this.crossFilterService.filter(r, n);
    }, s = this.chartController.getChartType(), i = {
      agChartsExports: this.beans.agChartsExports,
      chartType: s,
      chartInstance: e,
      getChartThemeName: this.getChartThemeName.bind(this),
      getChartThemes: this.getChartThemes.bind(this),
      customChartThemes: this.gos.get("customChartThemes"),
      styleNonce: this.gos.get("styleNonce"),
      getGridOptionsChartThemeOverrides: () => this.getGridOptionsChartThemeOverrides(),
      getExtraPaddingDirections: () => {
        var r;
        return ((r = this.chartMenu) == null ? void 0 : r.getExtraPaddingDirections()) ?? [];
      },
      apiChartThemeOverrides: this.params.chartThemeOverrides,
      crossFiltering: this.params.crossFiltering ?? !1,
      crossFilterCallback: t,
      parentElement: this.eChart,
      grouping: this.chartController.isGrouping(),
      chartThemeToRestore: this.params.chartThemeName,
      chartOptionsToRestore: this.params.chartOptionsToRestore,
      chartPaletteToRestore: this.params.chartPaletteToRestore,
      seriesChartTypes: this.chartController.getSeriesChartTypes(),
      suppressFieldDotNotation: this.gos.get("suppressFieldDotNotation"),
      translate: (r) => this.chartTranslation.translate(r),
      context: V(this.gos, {})
    };
    if (this.params.chartOptionsToRestore = void 0, this.chartType = s, this.chartProxy = this.createChartProxy(i), !this.chartProxy) {
      F(138, { chartType: i.chartType });
      return;
    }
    this.chartController.setChartProxy(this.chartProxy), this.createMenuContext();
  }
  createMenuContext() {
    if (this.chartMenuContext)
      return;
    const e = this.createManagedBean(
      new Oi(this.chartOptionsService.getChartThemeOverridesProxy())
    ), t = this.createManagedBean(
      new Oi(this.chartOptionsService.getAxisThemeOverridesProxy())
    );
    this.chartMenuContext = {
      chartController: this.chartController,
      chartOptionsService: this.chartOptionsService,
      chartMenuParamsFactory: e,
      chartAxisMenuParamsFactory: t
    };
  }
  getChartThemeName() {
    return this.chartController.getChartThemeName();
  }
  getChartThemes() {
    return this.chartController.getThemeNames();
  }
  getGridOptionsChartThemeOverrides() {
    return this.gos.get("chartThemeOverrides");
  }
  createChartProxy(e) {
    var i;
    const { chartType: t } = e;
    switch (t) {
      case "column":
      case "bar":
      case "groupedColumn":
      case "stackedColumn":
      case "normalizedColumn":
      case "groupedBar":
      case "stackedBar":
      case "normalizedBar":
        return new RU(e);
      case "pie":
      case "donut":
      case "doughnut":
        return new DU(e);
      case "area":
      case "stackedArea":
      case "normalizedArea":
        return new xU(e);
      case "line":
      case "stackedLine":
      case "normalizedLine":
        return new PU(e);
      case "scatter":
      case "bubble":
        return new EU(e);
      case "columnLineCombo":
      case "areaColumnCombo":
      case "customCombo":
        return new TU(e);
    }
    const s = (i = this.enterpriseChartProxyFactory) == null ? void 0 : i.createChartProxy(e);
    if (!s)
      throw gt(251, { chartType: t });
    return s;
  }
  addDialog() {
    const e = this.chartTranslation.translate(this.params.pivotChart ? "pivotChartTitle" : "rangeChartTitle"), { width: t, height: s } = this.getBestDialogSize(), i = this.params.focusDialogOnOpen ? () => setTimeout(() => ye(this.getGui())) : void 0;
    this.chartDialog = new Tn({
      resizable: !0,
      movable: !0,
      maximizable: !0,
      title: e,
      width: t,
      height: s,
      component: this,
      centered: !0,
      closable: !0,
      afterGuiAttached: i,
      postProcessPopupParams: {
        type: "chart"
      }
    }), this.createBean(this.chartDialog), this.chartDialog.addEventListener("destroyed", () => {
      this.destroy(), this.chartMenuSvc.hideAdvancedSettings();
      const r = this.focusSvc.getFocusedCell();
      setTimeout(() => {
        this.focusSvc.isAlive() && (r ? this.focusSvc.setFocusedCell({ ...r, forceBrowserFocus: !0 }) : bf(this.beans));
      });
    });
  }
  getBestDialogSize() {
    const e = this.popupSvc.getPopupParent(), t = Ri(e) * 0.75, s = ra(e) * 0.75, i = 0.553, r = this.chartProxy.getChart();
    let n = this.params.insideDialog ? 850 : r.width, o = this.params.insideDialog ? 470 : r.height;
    return (n > t || o > s) && (n = Math.min(n, t), o = Math.round(n * i), o > s && (o = s, n = Math.min(n, Math.round(o / i)))), { width: n, height: o };
  }
  addMenu() {
    this.params.crossFiltering || (this.chartMenu = this.createBean(
      new j3(this.eChartContainer, this.eMenuContainer, this.chartMenuContext)
    ), this.eChartContainer.appendChild(this.chartMenu.getGui()));
  }
  update(e) {
    if (e != null && e.chartId && !this.chartController.update(e))
      return;
    const t = this.chartTypeChanged(e), s = t || this.chartEmpty ? ((r) => {
      const n = this.chartType, o = r, a = this.chartProxy.getChart(), l = a == null ? void 0 : a.getOptions(), c = a == null ? void 0 : a.axes;
      return this.chartOptionsService.getPersistedChartThemeOverrides(
        l,
        c,
        n,
        o ?? n
      );
    })(t) : void 0;
    t && this.createChart(), s && (e != null && e.chartThemeOverrides) && Fe(s, e.chartThemeOverrides);
    const i = s ?? (e == null ? void 0 : e.chartThemeOverrides);
    this.updateChart(i), e != null && e.chartId && this.chartProxy.getChart().waitForUpdate().then(() => {
      this.chartController.raiseChartApiUpdateEvent();
    });
  }
  updateChart(e) {
    const { chartProxy: t } = this, s = this.chartController.getSelectedValueColState(), i = this.chartController.getChartData(), r = this.handleEmptyChart(i, s.length);
    if (this.chartEmpty = r, r) {
      e && this.chartController.updateThemeOverrides(e);
      return;
    }
    const n = this.chartController.getChartUpdateParams(e);
    t.update(n), this.chartProxy.getChart().waitForUpdate().then(() => {
      this.chartController.raiseChartUpdatedEvent();
    });
  }
  chartTypeChanged(e) {
    const [t, s] = [this.chartController.getChartType(), e == null ? void 0 : e.chartType], i = s ? pn(s) : void 0;
    return this.chartType !== t ? i ?? t : i && t !== i ? i : null;
  }
  getChartModel() {
    return this.chartController.getChartModel();
  }
  getChartImageDataURL(e) {
    return this.chartProxy.getChartImageDataURL(e);
  }
  handleEmptyChart(e, t) {
    const s = this.chartController.isPivotChart() && !this.chartController.isPivotMode(), i = this.chartController.getChartType();
    let r = 1;
    this.chartController.isActiveXYChart() ? r = i === "bubble" ? 3 : 2 : fi(de(i)) && (r = 0);
    const n = t < r || e.length === 0;
    if (this.eChart) {
      const o = s || n;
      O(this.eChart, !o), O(this.eEmpty, o);
    }
    return s ? (this.eEmpty.textContent = this.chartTranslation.translate("pivotChartRequiresPivotMode"), !0) : n ? (this.eEmpty.textContent = this.chartTranslation.translate("noDataToChart"), !0) : !1;
  }
  downloadChart(e, t, s) {
    this.chartProxy.downloadChart(e, t, s);
  }
  openChartToolPanel(e) {
    const t = e && mo[e];
    this.chartMenu.showMenu({ panel: t });
  }
  closeChartToolPanel() {
    this.chartMenu.hideMenu();
  }
  getChartId() {
    return this.chartController.getChartId();
  }
  getUnderlyingChart() {
    return this.chartProxy.getChartRef();
  }
  crossFilteringReset() {
    this.chartProxy.crossFilteringReset();
  }
  setMaximized(e) {
    var t;
    (t = this.chartDialog) == null || t.setMaximized(e);
  }
  setActiveChartCellRange(e) {
    this.getGui().contains(e.relatedTarget) || this.chartController.setChartRange(!0);
  }
  getThemeName() {
    const e = this.gos.get("chartThemes") || Dv;
    if (e.length === 0)
      throw new Error(gt(254));
    const { chartThemeName: t } = this.params;
    return e.includes(t) ? t : e[0];
  }
  getAllKeysInObjects(e) {
    const t = {};
    return e.filter((s) => s != null).forEach((s) => {
      Object.keys(s).forEach((i) => t[i] = null);
    }), Object.keys(t);
  }
  validateCustomThemes() {
    const e = this.getChartThemes(), t = this.gos.get("customChartThemes");
    t && this.getAllKeysInObjects([t]).forEach((s) => {
      e.includes(s) || F(139, { customThemeName: s });
    });
  }
  reactivePropertyUpdate() {
    this.chartController.setChartThemeName(this.getThemeName(), !0);
    const e = this.getChartId(), t = this.chartController.isCrossFilterChart() ? "crossFilter" : this.getChartModel().modelType, s = this.gos.get("chartThemeOverrides") || {};
    this.update({
      type: `${t}ChartUpdate`,
      chartId: e,
      chartThemeOverrides: s
    });
  }
  raiseChartCreatedEvent() {
    this.chartProxy.getChart().waitForUpdate().then(() => {
      this.eventSvc.dispatchEvent({
        type: "chartCreated",
        chartId: this.chartController.getChartId()
      });
    });
  }
  raiseChartDestroyedEvent() {
    this.eventSvc.dispatchEvent({
      type: "chartDestroyed",
      chartId: this.chartController.getChartId()
    });
  }
  destroy() {
    var t;
    super.destroy(), this.chartProxy && this.chartProxy.destroy(), this.destroyBean(this.chartMenu), this.chartDialog && this.chartDialog.isAlive() && this.destroyBean(this.chartDialog), (t = this.onDestroyColorSchemeChangeListener) == null || t.call(this);
    const e = this.getGui();
    X(e), se(e), this.raiseChartDestroyedEvent();
  }
};
function J3(e) {
  return e.version, e.version == null && (e.version = f4(e)), e = Ve("23.0.0", e, e4), e = Ve("24.0.0", e, t4), e = Ve("25.1.0", e, s4), e = Ve("26.0.0", e, i4), e = Ve("26.1.0", e, r4), e = Ve("26.2.0", e, n4), e = Ve("28.0.0", e, o4), e = Ve("28.2.0", e, a4), e = Ve("29.0.0", e, l4), e = Ve("29.1.0", e, Xv), e = Ve("29.2.0", e, Zv), e = Ve("30.0.0", e, c4), e = Ve("31.0.0", e, d4), e = Ve("32.0.0", e, h4), e = Ve("33.0.0", e, u4), e = Ve("34.0.0", e, g4), e = p4(e), e = Ve(Y, e, (t) => t), e;
}
function e4(e) {
  return e = Ne("chartOptions.legend.item.marker.type", "shape", e), e = Ne("chartOptions.seriesDefaults.marker.type", "shape", e), e = Ne("chartOptions.legend.padding", "spacing", e), e;
}
function t4(e) {
  e = ne("chartOptions.seriesDefaults.marker.minSize", e);
  const {
    chartType: t,
    chartPalette: s,
    // Migrate.
    chartOptions: { xAxis: i, yAxis: r, ...n },
    ...o
  } = e, a = d_(t), l = a == null ? void 0 : a.map((d, h) => ({
    type: d,
    ...h === 0 ? i : r
  }));
  return {
    chartType: t,
    chartThemeName: {
      borneo: "ag-default",
      material: "ag-material",
      bright: "ag-vivid"
    }[s] ?? "ag-default",
    chartOptions: {
      ...n,
      axes: l,
      xAxis: i,
      yAxis: r
    },
    ...o
  };
}
function s4(e) {
  return e = Ne("chartOptions.seriesDefaults.label.minRequiredAngle", "minAngle", e), e;
}
function i4(e) {
  return e = Ss("chartOptions.seriesDefaults.highlightStyle", e, ({ dimOpacity: s, ...i }) => ({
    ...i,
    ...s != null ? { series: { dimOpacity: s } } : {}
  })), e = ne("chart", e), e = ne("chartOptions.seriesDefaults.tooltipClass", e), e = ne("chartOptions.seriesDefaults.tooltipTracking", e), e = Cg("chartOptions.axes[].label.rotation", 0, e), e = Cg("chartOptions.axes[].label.rotation", 335, e), e;
}
function r4(e) {
  const t = ({ item: s, series: i, ...r }) => ({
    item: { ...r, ...s },
    ...i ? { series: i } : {}
  });
  return e = Ss("chartOptions.seriesDefaults.highlightStyle", e, t), e = Ss("chartOptions.series[].highlightStyle", e, t), e;
}
function n4(e) {
  e = Co("chartOptions.seriesDefaults.fill.opacity", "chartOptions.seriesDefaults.fillOpacity", e), e = Co("chartOptions.seriesDefaults.stroke.opacity", "chartOptions.seriesDefaults.strokeOpacity", e), e = Co("chartOptions.seriesDefaults.stroke.width", "chartOptions.seriesDefaults.strokeWidth", e), e = ne("chartOptions.seriesDefaults.fill", e), e = ne("chartOptions.seriesDefaults.stroke", e), e = ne("chartOptions.seriesDefaults.callout.colors", e), e = ne("chartOptions.xAxis", e), e = ne("chartOptions.yAxis", e);
  const {
    chartType: t,
    // disable no-unused-vars because `series` is required here, even though
    // unused, because it serves to take the `series` key out of otherChartOptions
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    chartOptions: { axes: s, series: i, seriesDefaults: r, ...n },
    ...o
  } = e, a = pn(t), l = de(a), c = [l], d = {};
  if (!Cv(l)) {
    const u = { top: {}, bottom: {}, left: {}, right: {} }, g = s.map(({ type: p, ...f }) => ({
      [p]: { ...u, ...f }
    })).reduce(wg, {});
    wv.filter((p) => g[p] == null).forEach((p) => {
      g[p] = { ...u };
    }), d.axes = g;
  }
  const h = c.map((u) => ({
    [u]: {
      ...d,
      series: r,
      ...n
    }
  })).reduce(wg, {});
  return e = {
    ...o,
    chartType: a,
    chartOptions: h
  }, e;
}
function o4(e) {
  return e = ne("chartOptions.*.title.padding", e), e = ne("chartOptions.*.subtitle.padding", e), e = ne("chartOptions.*.axes.*.title.padding", e), e = oh("chartOptions.*.axes.*.title.enabled", !1, e), e;
}
function a4(e) {
  return e = Ne("chartOptions.pie.series.callout", "calloutLine", e), e = Ne("chartOptions.pie.series.label", "calloutLabel", e), e = Ne("chartOptions.pie.series.labelKey", "sectorLabelKey", e), e = Ne("chartOptions.pie.series.labelName", "sectorLabelName", e), e = Ne("chartOptions.donut.series.callout", "calloutLine", e), e = Ne("chartOptions.donut.series.label", "calloutLabel", e), e = Ne("chartOptions.donut.series.labelKey", "sectorLabelKey", e), e = Ne("chartOptions.donut.series.labelName", "sectorLabelName", e), e;
}
function l4(e) {
  return e = Br("chartOptions.scatter.series.fill", "chartOptions.scatter.series.marker.fill", e), e = Br(
    "chartOptions.scatter.series.fillOpacity",
    "chartOptions.scatter.series.marker.fillOpacity",
    e
  ), e = Br("chartOptions.scatter.series.stroke", "chartOptions.scatter.series.marker.stroke", e), e = Br(
    "chartOptions.scatter.series.strokeOpacity",
    "chartOptions.scatter.series.marker.strokeOpacity",
    e
  ), e = Br(
    "chartOptions.scatter.series.strokeWidth",
    "chartOptions.scatter.series.marker.strokeWidth",
    e
  ), e = Co("chartOptions.scatter.series.paired", "chartOptions.scatter.paired", e), e;
}
function Xv(e) {
  return e = ne("chartOptions.axes[].tick.count", e), e;
}
function Zv(e) {
  return e = Ss("chartOptions.*.tooltip", e, ({ tracking: s, ...i }) => {
    const r = { ...i };
    return s === !1 ? (r.position ?? (r.position = { type: "pointer" }), r.range ?? (r.range = "nearest")) : s === !0 && (r.position ?? (r.position = { type: "node" }), r.range ?? (r.range = "nearest")), r;
  }), e;
}
function c4(e) {
  return e = Ne("chartOptions.pie.series.labelKey", "sectorLabelKey", e), e = Ne("chartOptions.pie.series.labelName", "sectorLabelName", e), e = Xv(e), e = Zv(e), e = ne("chartOptions.*.series.flipXY", e), e = Qv("chartOptions.common.legend.enabled", !0, e), e = oh("chartOptions.common.legend.position", "right", e), e;
}
function d4(e) {
  const t = {
    "ag-pastel": "ag-sheets",
    "ag-solar": "ag-polychroma"
  }, s = Ne("chartOptions.column", "bar", e), i = t[s.chartThemeName] || s.chartThemeName;
  return {
    ...s,
    chartThemeName: i
  };
}
function h4(e) {
  return e = At("chartOptions.*.autoSize", !0, e, (t, s) => {
    t[s] === !0 || t[s] === !1 && (t.minHeight = 600, t.minWidth = 300), delete t[s];
  }), e;
}
function u4(e) {
  return e = ne("chartOptions.*.axes.category.label.format", e), e = ne("chartOptions.*.axes.category.crosshair.label.format", e), e = ne("chartOptions.*.axes.angle-category.label.format", e), e = ne("chartOptions.*.axes.radius-category.label.format", e), e = Ne("chartOptions.*.axes.*.label.padding", "spacing", e), e = Ne("chartOptions.*.navigator.miniChart.label.padding", "spacing", e), e = ne("chartOptions.*.axes.*.crossLines.label.className", e), e = At("chartOptions.*.axes.*.crossLines.label.position", !0, e, (t, s) => {
    typeof t[s] == "string" && (t[s] = t[s].replace(/([A-Z])/, "-$1").toLowerCase());
  }), e = ne("chartOptions.bullet", e), e = vg("chartOptions.bar.series.label.placement", e, {
    inside: "inside-center",
    outside: "inside-end"
  }), e = vg("chartOptions.waterfall.series.item.*.label.placement", e, {
    inside: "inside-center",
    start: "outside-start",
    end: "outside-end"
  }), e = ne("chartOptions.*.navigator.min", e), e = ne("chartOptions.*.navigator.max", e), e = ne("chartOptions.*.zoom.ratioX", e), e = ne("chartOptions.*.zoom.ratioY", e), e = ne("chartOptions.*.zoom.rangeX", e), e = ne("chartOptions.*.zoom.rangeY", e), e;
}
function g4(e) {
  return At("chartOptions.series[].highlightStyle", !0, e, (s, i) => {
    const r = s[i];
    if (r == null)
      return;
    const n = {};
    if (r.item && (n.highlightedItem = r.item), r.series) {
      const { dimOpacity: o, ...a } = r.series;
      o != null && (n.unhighlightedSeries = { opacity: o }), Object.keys(a).length > 0 && (n.highlightedSeries = a);
    }
    delete s[i], s.highlight = n;
  }), e;
}
function p4(e) {
  return e = ne("chartOptions.*.width", e), e = ne("chartOptions.*.height", e), e = oh("chartOptions.*.axes.category.label.autoRotate", !0, e), e;
}
function f4(e) {
  var c, d;
  const t = e;
  if (e.version != null)
    return e.version;
  const s = (h, ...u) => Object.keys(h || {}).some((g) => u.includes(g)), i = t.chartOptions, r = s(i, "seriesDefaults") ? i == null ? void 0 : i.seriesDefaults : i == null ? void 0 : i[Object.keys(i)[0]], n = {
    "27.0.0": s(t, "seriesChartTypes"),
    "26.2.0": !s(i, "seriesDefaults"),
    "26.1.0": s(r == null ? void 0 : r.highlightStyle, "item"),
    "26.0.0": s(r == null ? void 0 : r.highlightStyle, "series"),
    // '26.0.0': modelAny.chart === undefined,
    "25.1.0": s(r == null ? void 0 : r.label, "minAngle"),
    "25.0.0": s(t, "modelType", "aggFunc", "unlinkChart", "suppressChartRanges") || s(r, "lineDash", "lineDashOffset"),
    "24.0.0": s(t, "chartThemeName", "chart") || s(i, "series"),
    "23.2.0": s(i, "navigator"),
    "23.0.0": s((d = (c = i == null ? void 0 : i.legend) == null ? void 0 : c.item) == null ? void 0 : d.marker, "shape"),
    "22.1.0": s(t, "chartPalette", "chartType")
  }, o = "27.1.0", a = Object.entries(n).filter(([h, u]) => u), [l = o] = a[0];
  return l;
}
function Ve(e, t, s) {
  if (mg(e) > mg(t.version)) {
    const i = s(t);
    return i.version = e, i;
  }
  return t;
}
function m4(e) {
  const t = e.includes("-beta") ? e.replace(/-beta.*/, "") : e, s = typeof t == "string" ? t.split(".").map((i) => Number(i)) : [];
  if (s.length !== 3 || s.some((i) => isNaN(i)))
    throw new Error(gt(253, { version: t }));
  return {
    major: s[0],
    minor: s[1],
    patch: s[2]
  };
}
function mg(e) {
  const { major: t, minor: s, patch: i } = m4(e);
  return t * 1e4 + s * 100 + i;
}
function Cg(e, t, s) {
  return At(e, !0, s, (i, r) => {
    i[r] === t && delete i[r];
  });
}
function oh(e, t, s) {
  return At(e, !1, s, (i, r) => {
    i[r] == null && (i[r] = t);
  });
}
function Qv(e, t, s) {
  typeof e == "string" && (e = e.split("."));
  const i = e[0];
  return e.length > 1 && (s[i] = Qv(e.slice(1), t, s[i] ?? {})), Object.keys(s).includes(i) || (s[i] = t), s;
}
function Co(e, t, s) {
  let i, r = !1;
  return s = At(e, !0, s, (n, o) => {
    r = !0, i = n[o], delete n[o];
  }), r ? At(t, !1, s, (n, o) => {
    n[o] = i;
  }) : s;
}
function Br(e, t, s) {
  let i, r = !1;
  return s = At(e, !0, s, (n, o) => {
    r = !0, i = n[o], delete n[o];
  }), r ? At(t, !1, s, (n, o) => {
    n[o] === void 0 && (n[o] = i);
  }) : s;
}
function Ne(e, t, s) {
  return At(e, !0, s, (i, r) => {
    i[t] = i[r], delete i[r];
  });
}
function ne(e, t) {
  return At(e, !0, t, (s, i) => delete s[i]);
}
function At(e, t, s, i) {
  const r = e instanceof Array ? e : e.split("."), n = r.slice(0, r.length - 1), o = r[r.length - 1];
  return Ss(n, s, (a) => {
    const l = Object.keys(a).includes(o);
    if (t && !l)
      return a;
    const c = { ...a };
    return i(c, o), c;
  });
}
function Ss(e, t, s) {
  const i = e instanceof Array ? e : e.split(".");
  if (t = { ...t }, i.length === 0)
    return s(t);
  if (i[0].startsWith("{")) {
    const r = i[0].substring(1, i[0].lastIndexOf("}")).split(",");
    for (const n of r)
      t[n] != null && (t[n] = Ss(i.slice(1), t[n], s));
  } else if (i[0].endsWith("[]")) {
    const r = i[0].substring(0, e[0].indexOf("["));
    t[r] instanceof Array && (t[r] = t[r].map((n) => Ss(i.slice(1), n, s)));
  } else if (i[0] === "*")
    for (const r of Object.keys(t))
      t[r] = Ss(i.slice(1), t[r], s);
  else t[i[0]] != null && (t[i[0]] = Ss(i.slice(1), t[i[0]], s));
  return t;
}
function vg(e, t, s) {
  return At(e, !0, t, (i, r) => {
    typeof i[r] == "string" && (i[r] = s[r] ?? r);
  });
}
var wg = (e, t) => ({ ...e, ...t }), C4 = class extends R {
  constructor() {
    super(...arguments), this.beanName = "chartSvc", this.activeCharts = /* @__PURE__ */ new Set(), this.activeChartComps = /* @__PURE__ */ new Set(), this.crossFilteringContext = {
      lastSelectedChartId: ""
    }, this.isEnterprise = () => this.agChartsExports.isEnterprise;
  }
  wireBeans(e) {
    this.visibleCols = e.visibleCols, this.rangeSvc = e.rangeSvc, this.agChartsExports = e.agChartsExports;
  }
  updateChart(e) {
    if (this.activeChartComps.size === 0) {
      F(124);
      return;
    }
    const t = [...this.activeChartComps].find((s) => s.getChartId() === e.chartId);
    if (!t) {
      F(125, { chartId: e.chartId });
      return;
    }
    t.update(e);
  }
  getChartModels() {
    const e = [], t = (s) => ({ ...s, version: Y });
    return this.activeChartComps.forEach((s) => e.push(t(s.getChartModel()))), e;
  }
  getChartRef(e) {
    let t;
    return this.activeCharts.forEach((s) => {
      s.chartId === e && (t = s);
    }), t;
  }
  getChartComp(e) {
    let t;
    return this.activeChartComps.forEach((s) => {
      s.getChartId() === e && (t = s);
    }), t;
  }
  getChartImageDataURL(e) {
    let t;
    return this.activeChartComps.forEach((s) => {
      s.getChartId() === e.chartId && (t = s.getChartImageDataURL(e.fileFormat));
    }), t;
  }
  downloadChart(e) {
    const t = Array.from(this.activeChartComps).find((s) => s.getChartId() === e.chartId);
    t == null || t.downloadChart(e.dimensions, e.fileName, e.fileFormat);
  }
  openChartToolPanel(e) {
    const t = Array.from(this.activeChartComps).find((s) => s.getChartId() === e.chartId);
    t == null || t.openChartToolPanel(e.panel);
  }
  closeChartToolPanel(e) {
    const t = Array.from(this.activeChartComps).find((s) => s.getChartId() === e);
    t == null || t.closeChartToolPanel();
  }
  createChartFromCurrentRange(e = "groupedColumn", t) {
    const s = this.getSelectedRange();
    return this.createChart({ cellRange: s, chartType: e, focusDialogOnOpen: !t });
  }
  restoreChart(e, t) {
    if (!e) {
      F(126);
      return;
    }
    e.version !== Y && (e = J3(e));
    let s, i, r, n;
    if (e.modelType === "pivot" ? (this.gos.updateGridOptions({ options: { pivotMode: !0 }, source: "pivotChart" }), s = this.createCellRange(void 0, !0), i = !0, r = !0) : (s = this.createCellRange(e.cellRange), n = e.chartPalette, r = e.suppressChartRanges), !!s)
      return this.createChart({
        ...e,
        cellRange: s,
        pivotChart: i,
        suppressChartRanges: r,
        chartContainer: t,
        chartOptionsToRestore: e.chartOptions,
        chartPaletteToRestore: n
      });
  }
  createRangeChart(e, t) {
    const s = this.createCellRange(e.cellRange);
    if (s)
      return this.createChart({
        ...e,
        cellRange: s,
        focusDialogOnOpen: !t
      });
  }
  createPivotChart(e, t) {
    this.gos.updateGridOptions({ options: { pivotMode: !0 }, source: "pivotChart" });
    const s = this.createCellRange(void 0, !0);
    if (s)
      return this.createChart({
        ...e,
        cellRange: s,
        pivotChart: !0,
        suppressChartRanges: !0,
        focusDialogOnOpen: !t
      });
  }
  createCrossFilterChart(e, t) {
    const s = this.createCellRange(e.cellRange);
    if (!s)
      return;
    const r = typeof e.suppressChartRanges < "u" && e.suppressChartRanges !== null ? e.suppressChartRanges : !0;
    return this.createChart({
      ...e,
      cellRange: s,
      suppressChartRanges: r,
      crossFiltering: !0,
      crossFilteringSort: e.sort,
      focusDialogOnOpen: !t
    });
  }
  createChart(e) {
    const t = vU(e, this.agChartsExports.isEnterprise);
    if (!t)
      return;
    e = t === !0 ? e : t;
    const { chartType: s, chartContainer: i } = e, r = this.gos.getCallback("createChartContainer"), n = {
      ...e,
      chartId: this.generateId(),
      chartType: pn(s),
      insideDialog: !(i || r),
      crossFilteringContext: this.crossFilteringContext,
      crossFilteringResetCallback: () => this.activeChartComps.forEach((l) => l.crossFilteringReset())
    }, o = new Q3(n);
    this.createBean(o);
    const a = this.createChartRef(o);
    return i ? i.appendChild(a.chartElement) : r ? r(a) : o.addEventListener("destroyed", () => {
      this.activeChartComps.delete(o), this.activeCharts.delete(a);
    }), a;
  }
  createChartRef(e) {
    const t = {
      destroyChart: () => {
        this.activeCharts.has(t) && (this.destroyBean(e), this.activeChartComps.delete(e), this.activeCharts.delete(t));
      },
      focusChart: () => {
        ye(e.getGui());
      },
      chartElement: e.getGui(),
      chart: e.getUnderlyingChart(),
      chartId: e.getChartModel().chartId,
      setMaximized: e.setMaximized.bind(e)
    };
    return this.activeCharts.add(t), this.activeChartComps.add(e), t;
  }
  getSelectedRange() {
    var n;
    const e = (n = this.rangeSvc) == null ? void 0 : n.getCellRanges();
    if (!e || e.length === 0)
      return { columns: [] };
    const t = /* @__PURE__ */ new Set();
    let s = Number.MAX_VALUE, i = -Number.MAX_VALUE;
    if (e.forEach(({ startRow: o, endRow: a, columns: l }) => {
      if (!(o && a))
        return;
      l.forEach((g) => t.add(g));
      let { rowIndex: c, rowPinned: d } = o, { rowIndex: h, rowPinned: u } = a;
      if (d === "top") {
        if (u === "top")
          return;
        c = 0;
      }
      if (u === "bottom") {
        if (d === "bottom")
          return;
        h = this.beans.pageBounds.getLastRow();
      }
      c !== void 0 && (s = Math.min(s, c)), h !== void 0 && (i = Math.max(i, h));
    }), s === Number.MAX_VALUE || i === -Number.MAX_VALUE)
      return { columns: [] };
    const r = Array.from(t);
    return {
      // Don't specify id here, as it should be chart-specific
      // but we don't have that context yet
      columns: r,
      startColumn: r[0],
      startRow: {
        rowIndex: s,
        rowPinned: void 0
      },
      endRow: {
        rowIndex: i,
        rowPinned: void 0
      }
    };
  }
  generateId() {
    return `id-${Math.random().toString(36).substring(2, 18)}`;
  }
  createCellRange(e, t) {
    var r;
    const s = t ? {
      rowStartIndex: null,
      rowStartPinned: void 0,
      rowEndIndex: null,
      rowEndPinned: void 0,
      columns: this.visibleCols.allCols.map((n) => n.getColId())
    } : e, i = s && ((r = this.rangeSvc) == null ? void 0 : r.createPartialCellRangeFromRangeParams(s, !0));
    return i || F(127, { allRange: t }), i;
  }
  destroy() {
    this.activeCharts.forEach((e) => e.destroyChart()), super.destroy();
  }
};
function v4(e) {
  return e.frameworkOverrides.wrapIncoming(() => {
    var t;
    return (t = e.chartSvc) == null ? void 0 : t.getChartModels();
  });
}
function w4(e, t) {
  return e.frameworkOverrides.wrapIncoming(() => {
    var s;
    return (s = e.chartSvc) == null ? void 0 : s.getChartRef(t);
  });
}
function b4(e, t) {
  return e.frameworkOverrides.wrapIncoming(() => {
    var s;
    return (s = e.chartSvc) == null ? void 0 : s.getChartImageDataURL(t);
  });
}
function y4(e, t) {
  return e.frameworkOverrides.wrapIncoming(() => {
    var s;
    return (s = e.chartSvc) == null ? void 0 : s.downloadChart(t);
  });
}
function S4(e, t) {
  return e.frameworkOverrides.wrapIncoming(() => {
    var s;
    return (s = e.chartSvc) == null ? void 0 : s.openChartToolPanel(t);
  });
}
function x4(e, t) {
  return e.frameworkOverrides.wrapIncoming(() => {
    var s;
    return (s = e.chartSvc) == null ? void 0 : s.closeChartToolPanel(t.chartId);
  });
}
function F4(e, t) {
  return e.frameworkOverrides.wrapIncoming(() => {
    var s;
    return (s = e.chartSvc) == null ? void 0 : s.createRangeChart(t, !0);
  });
}
function R4(e, t) {
  return e.frameworkOverrides.wrapIncoming(() => {
    var s;
    return (s = e.chartSvc) == null ? void 0 : s.createPivotChart(t, !0);
  });
}
function P4(e, t) {
  return e.frameworkOverrides.wrapIncoming(() => {
    var s;
    return (s = e.chartSvc) == null ? void 0 : s.createCrossFilterChart(t, !0);
  });
}
function E4(e, t) {
  return e.frameworkOverrides.wrapIncoming(() => {
    var s;
    return (s = e.chartSvc) == null ? void 0 : s.updateChart(t);
  });
}
function T4(e, t, s) {
  return e.frameworkOverrides.wrapIncoming(() => {
    var i;
    return (i = e.chartSvc) == null ? void 0 : i.restoreChart(t, s);
  });
}
var M4 = (
  /*css*/
  `.ag-chart{display:flex;height:100%;position:relative;width:100%}.ag-chart-components-wrapper{display:flex}.ag-chart-canvas-wrapper,.ag-chart-components-wrapper{flex:1 1 auto;position:relative}.ag-chart-menu{background:var(--ag-background-color);background-color:color-mix(in srgb,transparent,var(--ag-background-color) 30%);border-radius:var(--ag-border-radius);display:flex;flex-direction:row;gap:20px;padding:4px 2px;position:absolute;top:8px;width:auto;--ag-icon-size:20px}:where(.ag-ltr) .ag-chart-menu{justify-content:right;right:calc(var(--ag-cell-horizontal-padding) + var(--ag-spacing) - 4px)}:where(.ag-rtl) .ag-chart-menu{justify-content:left;left:calc(var(--ag-cell-horizontal-padding) + var(--ag-spacing) - 4px)}.ag-chart-docked-container{min-width:var(--ag-chart-menu-panel-width);position:relative}:where(.ag-chart-menu-hidden)~.ag-chart-docked-container{display:none}.ag-chart-tabbed-menu{display:flex;flex-direction:column;height:100%;overflow:hidden;width:100%}.ag-chart-tabbed-menu-header{cursor:default;flex:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ag-chart-tabbed-menu-body{align-items:stretch;display:flex;flex:1 1 auto;overflow:hidden;position:relative;&:after{background:linear-gradient(var(--ag-background-color),transparent);content:"";display:block;height:16px;left:0;position:absolute;right:0;top:0}}.ag-chart-tab{overflow:hidden;overflow-y:auto;width:100%}.ag-chart-settings{overflow-x:hidden}.ag-chart-settings-wrapper{display:flex;flex-direction:column;height:100%;overflow:hidden;position:relative;width:100%}.ag-chart-settings-nav-bar{align-items:center;border-top:solid var(--ag-border-width) var(--ag-border-color);display:flex;height:30px;padding:0 10px;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.ag-chart-settings-card-selector{align-items:center;display:flex;flex:1 1 auto;height:100%;justify-content:space-around;padding:0 10px}.ag-chart-settings-card-item{background-color:var(--ag-foreground-color);border-radius:4px;cursor:pointer;height:8px;position:relative;width:8px;&.ag-not-selected{opacity:.2}&:before{background-color:transparent;content:" ";display:block;height:20px;left:50%;margin-left:-10px;margin-top:-10px;position:absolute;top:50%;width:20px}&.ag-selected{background-color:var(--ag-accent-color)}}.ag-chart-settings-next,.ag-chart-settings-prev{flex:none;position:relative;&:focus-within{border-radius:1px;box-shadow:var(--ag-focus-shadow)}}.ag-chart-settings-next-button,.ag-chart-settings-prev-button{cursor:pointer;height:100%;left:0;opacity:0;position:absolute;top:0;width:100%}.ag-chart-settings-mini-charts-container{flex:1 1 auto;overflow:hidden auto;position:relative}.ag-chart-settings-mini-wrapper{display:flex;flex-direction:column;left:0;min-height:100%;overflow:hidden;padding-bottom:var(--ag-widget-container-vertical-padding);position:absolute;top:0;width:100%;&.ag-animating{transition:left .3s;transition-timing-function:ease-in-out}}.ag-chart-mini-thumbnail{border:solid var(--ag-border-width) var(--ag-border-color);border-radius:5px;cursor:pointer;padding:1px;&.ag-selected{border-color:var(--ag-accent-color);border-width:calc(var(--ag-border-width) + 1px);padding:unset}&:focus-visible{border-color:var(--ag-accent-color);box-shadow:var(--ag-focus-shadow)}}.ag-chart-mini-thumbnail-canvas{display:block}.ag-chart-advanced-settings-wrapper,.ag-chart-data-wrapper,.ag-chart-format-wrapper{display:flex;flex-direction:column;padding-bottom:16px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ag-chart-advanced-settings-wrapper,.ag-chart-data-wrapper{height:100%;overflow-y:auto}.ag-chart-advanced-settings{background-color:var(--ag-chrome-background-color)}.ag-chart-advanced-settings,.ag-chart-advanced-settings-wrapper{width:100%}.ag-chart-advanced-settings-wrapper{padding-bottom:0}.ag-chart-advanced-settings-section{border-bottom:solid var(--ag-border-width) var(--ag-border-color);display:flex;margin:0;padding-bottom:var(--ag-widget-container-vertical-padding);padding-top:var(--ag-widget-container-vertical-padding)}.ag-chart-empty-text{align-items:center;background-color:var(--ag-background-color);display:flex;height:100%;justify-content:center;top:0;width:100%}.ag-charts-font-size-color{align-self:stretch;display:flex;justify-content:space-between}.ag-charts-data-group-item{padding-bottom:var(--ag-widget-container-vertical-padding);position:relative}.ag-charts-data-group-item:where(:not(:last-child)){margin-bottom:var(--ag-spacing)}.ag-chart-menu-icon{border-radius:var(--ag-border-radius);cursor:pointer;margin:2px 0;opacity:.8;&:hover{opacity:1}}.ag-chart-menu-toolbar-button{background-color:unset;border:0;border-radius:1px;padding:0 2px}.ag-chart-data-column-drag-handle{margin-left:var(--ag-spacing)}.ag-charts-advanced-settings-top-level-group-title-bar{background-color:unset;position:relative}.ag-charts-data-group-container{padding:calc(var(--ag-widget-container-vertical-padding)*.5) var(--ag-widget-container-horizontal-padding)}.ag-charts-data-group-item:where(:not(.ag-charts-format-sub-level-group,.ag-pill-select,.ag-select)){height:var(--ag-list-item-height)}.ag-charts-data-group-item:where(.ag-picker-field){margin-top:var(--ag-spacing)}.ag-charts-advanced-settings-top-level-group-container,.ag-charts-format-top-level-group-container{margin-left:calc(var(--ag-spacing)*2);padding:var(--ag-spacing)}.ag-charts-advanced-settings-top-level-group-item,.ag-charts-format-top-level-group-item{margin:var(--ag-spacing) 0}.ag-charts-format-sub-level-group-container{display:flex;flex-direction:column;padding:var(--ag-widget-vertical-spacing) 0}.ag-charts-settings-group-container{display:grid;grid-template-columns:60px 1fr 60px 1fr 60px;padding:var(--ag-spacing);row-gap:8px;:where(.ag-chart-mini-thumbnail:nth-child(3n+1)){grid-column:1}:where(.ag-chart-mini-thumbnail:nth-child(3n+2)){grid-column:3}:where(.ag-chart-mini-thumbnail:nth-child(3n+3)){grid-column:5}}.ag-chart-data-section,.ag-chart-format-section{display:flex;margin:0;:where(.ag-label:not(.ag-group-title-bar)){color:var(--ag-chart-menu-label-color)}:where(.ag-label-align-top .ag-label){margin-bottom:var(--ag-widget-vertical-spacing);margin-top:calc(var(--ag-widget-vertical-spacing)*.5)}:where(.ag-slider.ag-label-align-top .ag-label){margin-bottom:0}:where(label){display:inline-block}}.ag-chart-menu-panel{--ag-panel-background-color:var(--ag-chrome-background-color)}:where(.ag-ltr) .ag-chart-menu-panel{border-left:solid var(--ag-border-width) var(--ag-border-color)}:where(.ag-rtl) .ag-chart-menu-panel{border-right:solid var(--ag-border-width) var(--ag-border-color)}.ag-charts-data-group-title-bar,.ag-charts-format-top-level-group-title-bar,.ag-charts-settings-group-container,.ag-charts-settings-group-title-bar{border-top:none;font-weight:500;padding:0 calc(var(--ag-spacing)*1.5)}.ag-charts-format-sub-level-group-title-bar{background:none;font-weight:500;padding:var(--ag-widget-vertical-spacing) 0}.ag-chart-data-wrapper,.ag-chart-format-wrapper,.ag-charts-data-group-container,.ag-charts-data-group-title-bar,.ag-charts-format-sub-level-group,.ag-charts-format-sub-level-group-container>*,.ag-charts-format-sub-level-group-item:last-child,.ag-charts-format-top-level-group,.ag-charts-format-top-level-group-item,.ag-charts-format-top-level-group-title-bar,.ag-charts-settings-group-container,.ag-charts-settings-group-title-bar,:where(.ag-charts-format-top-level-group) .ag-charts-format-top-level-group-container{margin:0;padding:0}.ag-charts-data-group-title-bar,.ag-charts-format-top-level-group-title-bar,.ag-charts-settings-group-title-bar{padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);position:relative}.ag-charts-data-group,.ag-charts-format-top-level-group{border-top:solid var(--ag-border-width) var(--ag-border-color)}:where(.ag-charts-data-group) .ag-charts-data-group-container,:where(.ag-charts-format-top-level-group) .ag-charts-format-top-level-group-container,:where(.ag-charts-settings-group) .ag-charts-settings-group-container{padding:0 var(--ag-widget-container-horizontal-padding)}.ag-charts-format-sub-level-group-container>*,.ag-charts-format-sub-level-no-header-group-container>*,.ag-charts-format-top-level-group-container>*{margin-bottom:var(--ag-widget-vertical-spacing)}.ag-charts-advanced-settings-top-level-group-container{margin:0}:where(.ag-charts-advanced-settings-top-level-group){.ag-charts-advanced-settings-top-level-group-container,.ag-charts-advanced-settings-top-level-group-title-bar{padding:0 var(--ag-widget-container-horizontal-padding)}}.ag-charts-advanced-settings-top-level-group-item{margin-bottom:0;margin-top:calc(var(--ag-widget-vertical-spacing)*2)}.ag-chart-settings-card-item.ag-not-selected:hover{opacity:.35}.ag-angle-select{align-items:center;display:flex}.ag-angle-select-wrapper{display:flex}.ag-angle-select-parent-circle{background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:12px;display:block;height:24px;position:relative;width:24px}.ag-angle-select-child-circle{background-color:var(--ag-foreground-color);border-radius:3px;height:6px;left:12px;margin-left:-3px;margin-top:-4px;position:absolute;top:4px;width:6px}.ag-slider-wrapper{display:flex;:where(.ag-input-field){flex:1 1 auto}}.ag-color-panel{display:flex;flex-direction:column;padding:var(--ag-spacing);text-align:center;width:100%}.ag-spectrum-color{cursor:default;flex:1 1 auto;overflow:visible;position:relative}.ag-spectrum-color,.ag-spectrum-fill{border-radius:var(--ag-border-radius)}.ag-spectrum-fill{inset:0;position:absolute}.ag-spectrum-val{background-image:linear-gradient(0deg,#000,hsla(20,42%,65%,0));cursor:pointer}.ag-spectrum-dragger{background:#000;border:var(--ag-color-picker-thumb-border-width) solid #fff;border-radius:var(--ag-color-picker-thumb-size);box-shadow:0 0 2px 0 rgba(0,0,0,.24);cursor:pointer;height:var(--ag-color-picker-thumb-size);pointer-events:none;position:absolute;width:var(--ag-color-picker-thumb-size)}.ag-spectrum-alpha,.ag-spectrum-hue{cursor:default}.ag-spectrum-hue-background{background:linear-gradient(270deg,red 3%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);height:100%;width:100%}.ag-spectrum-alpha-background{background:linear-gradient(to right,var(--ag-internal-spectrum-alpha-color-from),var(--ag-internal-spectrum-alpha-color-to)),url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4"><rect x="0" y="0" width="4" height="4" fill="%23fff"/><path d="M0 0H2V4H4V2H0Z" fill="%23b2b2b2"/></svg>') 0 0 /4px 4px;height:100%;width:100%}.ag-spectrum-tool{cursor:pointer;height:var(--ag-color-picker-track-size);margin-bottom:10px;position:relative}.ag-spectrum-slider,.ag-spectrum-tool{border-radius:var(--ag-color-picker-thumb-size)}.ag-spectrum-slider{border:var(--ag-color-picker-thumb-border-width) solid #fff;box-shadow:0 1px 4px 0 rgba(0,0,0,.37);height:var(--ag-color-picker-thumb-size);margin-top:calc(var(--ag-color-picker-track-size)/2*-1 + var(--ag-color-picker-thumb-size)/2*-1);pointer-events:none;position:absolute;width:var(--ag-color-picker-thumb-size)}:where(.ag-spectrum-alpha) .ag-spectrum-slider{background:linear-gradient(to bottom,var(--ag-internal-spectrum-alpha-color),var(--ag-internal-spectrum-alpha-color)) var(--ag-background-color)}.ag-recent-colors{display:flex;gap:6px;margin:10px var(--ag-spacing) 2px}.ag-recent-color{border:solid var(--ag-border-width) var(--ag-border-color);cursor:pointer}.ag-angle-select[disabled]{opacity:.5;pointer-events:none}:where(.ag-ltr) .ag-angle-select-field,:where(.ag-ltr) .ag-slider-field{margin-right:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-angle-select-field,:where(.ag-rtl) .ag-slider-field{margin-left:calc(var(--ag-spacing)*2)}.ag-color-dialog{border-radius:5px}:where(.ag-color-picker){.ag-picker-field-wrapper{padding-left:var(--ag-spacing);padding-right:var(--ag-spacing)}.ag-picker-field-display{align-items:center;display:flex;flex-direction:row;min-height:var(--ag-list-item-height)}}:where(.ag-ltr) .ag-color-picker-color,:where(.ag-ltr) .ag-color-picker-value{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-color-picker-color,:where(.ag-rtl) .ag-color-picker-value{margin-left:var(--ag-spacing)}.ag-spectrum-tools{padding:10px 0 0}.ag-spectrum-alpha-background,.ag-spectrum-hue-background{border-radius:var(--ag-color-picker-track-border-radius)}.ag-color-input-color,.ag-color-picker-color,.ag-recent-color{border-radius:var(--ag-color-picker-color-border-radius)}.ag-spectrum-sat{background-image:linear-gradient(90deg,#fff,hsla(20,42%,65%,0))}.ag-recent-color,.ag-spectrum-color,.ag-spectrum-slider{&:where(:not(:disabled,[readonly])):focus-visible{box-shadow:var(--ag-focus-shadow)}}.ag-color-input-color,.ag-color-picker-color{border:solid var(--ag-border-width) var(--ag-border-color);height:var(--ag-icon-size);width:var(--ag-icon-size)}:where(.ag-ltr) .ag-color-input .ag-input-field-input{padding-left:calc(var(--ag-icon-size) + var(--ag-spacing)*2)}:where(.ag-rtl) .ag-color-input .ag-input-field-input{padding-right:calc(var(--ag-icon-size) + var(--ag-spacing)*2)}:where(.ag-color-input) .ag-color-input-color{position:absolute}:where(.ag-ltr) :where(.ag-color-input) .ag-color-input-color{margin-left:var(--ag-spacing)}:where(.ag-rtl) :where(.ag-color-input) .ag-color-input-color{margin-right:var(--ag-spacing)}.ag-range-field{align-items:center;display:flex;:where(.ag-input-wrapper){height:100%}}.ag-range-field-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;height:100%;overflow:visible;padding:0;width:100%;&:disabled{opacity:.5}}.ag-range-field-input{&::-webkit-slider-runnable-track{background-color:var(--ag-border-color);border-radius:1.5px;height:3px;margin:0;padding:0;width:100%}&::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:100%;height:var(--ag-icon-size);margin:0;padding:0;transform:translateY(calc(var(--ag-icon-size)*-.5 + 1.5px));width:var(--ag-icon-size)}&:focus::-webkit-slider-thumb{border-color:var(--ag-accent-color);box-shadow:var(--ag-focus-shadow)}&:active::-webkit-slider-runnable-track{background-color:var(--ag-accent-color)}}.ag-range-field-input{&::-moz-range-track{background-color:var(--ag-border-color);border-radius:1.5px;height:3px;margin:0;padding:0;width:100%}&::-moz-ag-range-thumb{-moz-appearance:none;appearance:none;background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:100%;height:var(--ag-icon-size);margin:0;padding:0;transform:translateY(calc(var(--ag-icon-size)*-.5 + 1.5px));width:var(--ag-icon-size)}&:focus::-moz-ag-range-thumb{border-color:var(--ag-accent-color);box-shadow:var(--ag-focus-shadow)}&:active::-moz-ag-range-track{background-color:var(--ag-accent-color)}}`
), Jv = 28, ew = 6;
function Dc(e) {
  return e && e.match(/\d+\.\d+\.\d+/);
}
function D4({
  gridMajorVersion: e,
  chartsMajorVersion: t
}) {
  const s = parseInt(e, 10), i = parseInt(t, 10), r = s - Jv, n = i - ew, o = r >= 0;
  return r === n && o;
}
function A4(e) {
  if (!Dc(e))
    return;
  const [t, s] = e.split(".") || [], i = `${t}.${s}.x`, n = parseInt(t, 10) - Jv + ew;
  if (n < 0)
    return;
  const a = `${n}.${s}.x`;
  return {
    gridMajorMinor: i,
    chartsMajorMinor: a
  };
}
function eo({
  type: e,
  gridVersion: t,
  chartsVersion: s
}) {
  const i = "AG Grid: AG Grid version is incompatible. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information.", r = A4(t);
  if (!r)
    return i;
  const { gridMajorMinor: n, chartsMajorMinor: o } = r;
  return e === "incompatible" ? `AG Grid version ${t} and AG Charts version ${s} is not supported. AG Grid version ${n} should be used with AG Chart ${o}. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information.` : e === "invalidCharts" ? `AG Grid version ${n} should be used with AG Chart ${o} not ${s}. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information.` : i;
}
function I4({
  gridVersion: e,
  chartsVersion: t
}) {
  if (!Dc(t))
    return {
      isValid: !1,
      message: eo({ type: "invalidCharts", gridVersion: e, chartsVersion: t })
    };
  if (!Dc(e))
    return {
      isValid: !1,
      message: eo({ type: "invalidGrid", gridVersion: e, chartsVersion: t })
    };
  const [s, i] = e.split(".") || [], [r, n, o] = t.split(".") || [], a = D4({
    gridMajorVersion: s,
    chartsMajorVersion: r
  });
  return a && i === n || o.includes("beta") ? {
    isValid: !0
  } : !a || i !== n ? {
    isValid: !1,
    message: eo({ type: "incompatible", gridVersion: e, chartsVersion: t })
  } : {
    isValid: !1,
    message: eo({ type: "invalid", gridVersion: e, chartsVersion: t })
  };
}
var L4 = {
  // shown on top right of chart when chart is linked to range data (click to unlink)
  linked: "linked",
  // shown on top right of chart when chart is not linked to range data (click to link)
  unlinked: "unlinked",
  // icon to open charts menu
  chartsMenu: "menu-alt",
  // download chart
  chartsDownload: "save",
  // Edit Chart menu item shown in Integrated Charts menu
  chartsMenuEdit: "chart",
  // Advanced Settings menu item shown in Integrated Charts menu
  chartsMenuAdvancedSettings: "settings",
  // shown in Integrated Charts menu add fields
  chartsMenuAdd: "plus",
  // shown in Integrated Charts tool panel color picker
  chartsColorPicker: "small-down",
  // previous in Integrated Charts settings tool panel theme switcher
  chartsThemePrevious: "previous",
  // next in Integrated Charts settings tool panel theme switcher
  chartsThemeNext: "next"
}, k4 = {
  getChartModels: v4,
  getChartRef: w4,
  getChartImageDataURL: b4,
  downloadChart: y4,
  openChartToolPanel: S4,
  closeChartToolPanel: x4,
  createRangeChart: F4,
  createPivotChart: R4,
  createCrossFilterChart: P4,
  updateChart: E4,
  restoreChart: T4
}, bg = [
  hv,
  ie,
  Hi,
  Is,
  Aa
], yg = "IntegratedCharts", G4 = {
  moduleName: yg,
  version: Y,
  dependsOn: bg,
  // included to avoid other false positive warnings about missing modules
  validate: () => ({
    isValid: !1,
    message: Zg(257)
  }),
  with: (e) => {
    var t;
    if (e.setup(), (t = e.setGridContext) == null || t.call(e, !0), e.isEnterprise && e.setLicenseKey) {
      const s = {
        setLicenseKey: e.setLicenseKey
      };
      Wr.setChartsLicenseManager(s);
    }
    return {
      moduleName: yg,
      version: Y,
      icons: L4,
      apiFunctions: k4,
      dependsOn: bg,
      css: [M4],
      validate: () => I4({
        gridVersion: Y,
        chartsVersion: e.VERSION
      }),
      beans: [
        // bind the params to the constructor to avoid the need for static properties
        ZW.bind(null, e),
        C4,
        lU,
        tU,
        J_,
        oU,
        // Include enterprise beans for now for all users as tiny compared to charts bundle size
        B_,
        Z_
      ]
    };
  }
}, Sg = [
  qm,
  hz,
  AB,
  WN,
  $z,
  Kz,
  r2,
  JB,
  eN,
  hv,
  tN,
  Cz,
  ov,
  JH,
  ez,
  FW,
  RW,
  vN,
  ZN,
  CV,
  Da,
  ON,
  sz,
  $2,
  X2,
  $W,
  XW
], xg = "AllEnterprise", O4 = {
  with: (e) => ({
    moduleName: xg,
    version: Y,
    dependsOn: [...Sg, G4.with(e), DW.with(e)]
  }),
  moduleName: xg,
  version: Y,
  dependsOn: Sg
};
RP.registerModules([qm, O4]);
function V4({ model: e, el: t }) {
  const s = document.createElement("div");
  s.classList.add("ag-theme-quartz"), s.style.height = e.get("height") ?? "400px", s.style.width = "100%";
  const i = Yf.withParams({
    headerFontSize: 14,
    spacing: 4
  }), r = e.get("default_column_def") ?? {
    sortable: !0,
    filter: !0,
    resizable: !0,
    flex: 1
  }, n = e.get("column_defs") ?? [], o = e.get("row_data") ?? [], a = e.get("grid_options") ?? {
    rowSelection: {
      mode: "singleRow",
      checkboxes: !0,
      enableClickSelection: !0
    },
    rowNumbers: !0
  }, l = {
    theme: i,
    columnDefs: n,
    rowData: o,
    defaultColDef: r,
    onSelectionChanged(d) {
      e.set("selected_row", d.api.getSelectedRows()), e.save_changes();
    },
    ...a
  };
  console.log("gridOptions:", l);
  const c = cm(s, l);
  e.on("change:row_data", () => {
    c.setGridOption("rowData", e.get("row_data"));
  }), t.appendChild(s);
}
const B4 = { render: V4 };
export {
  B4 as default,
  V4 as render
};
